From a489a92ce5c84f8f40b68a37c17e7bd7f8556bc9 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Thu, 14 Dec 2000 21:42:22 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'gcc-vendor-gcc_cvs_20000711_1732'. --- contrib/gcc/BUGS | 27 - contrib/gcc/COPYING | 340 - contrib/gcc/COPYING.LIB | 482 - contrib/gcc/ChangeLog | 17450 ------------- contrib/gcc/FSFChangeLog | 2154 -- contrib/gcc/LANGUAGES | 91 - contrib/gcc/Makefile.in | 3198 --- contrib/gcc/NEWS | 1071 - contrib/gcc/ORDERS | 3757 --- contrib/gcc/PROBLEMS | 117 - contrib/gcc/PROJECTS | 449 - contrib/gcc/README | 26 - contrib/gcc/README-bugs | 144 - contrib/gcc/README-fixinc | 9 - contrib/gcc/README.ACORN | 18 - contrib/gcc/README.ALTOS | 55 - contrib/gcc/README.APOLLO | 112 - contrib/gcc/README.DWARF | 574 - contrib/gcc/README.FRESCO | 17 - contrib/gcc/README.NS32K | 130 - contrib/gcc/README.RS6000 | 111 - contrib/gcc/README.TRAD | 55 - contrib/gcc/README.X11 | 447 - contrib/gcc/README.g77 | 263 - contrib/gcc/SERVICE | 1609 -- contrib/gcc/TESTS.FLUNK | 39 - contrib/gcc/acconfig.h | 131 - contrib/gcc/aclocal.m4 | 659 - contrib/gcc/alias.c | 1570 -- contrib/gcc/alloca.c | 504 - contrib/gcc/ansidecl.h | 163 - contrib/gcc/assert.h | 54 - contrib/gcc/basic-block.h | 262 - contrib/gcc/bc-emit.c | 992 - contrib/gcc/bc-emit.h | 133 - contrib/gcc/bc-optab.c | 789 - contrib/gcc/bc-optab.h | 75 - contrib/gcc/bc-typecd.def | 21 - contrib/gcc/bc-typecd.h | 54 - contrib/gcc/bi-arity.c | 80 - contrib/gcc/bi-defs.h | 48 - contrib/gcc/bi-lexer.c | 167 - contrib/gcc/bi-opcode.c | 78 - contrib/gcc/bi-opname.c | 59 - contrib/gcc/bi-parser.y | 169 - contrib/gcc/bi-reverse.c | 61 - contrib/gcc/bi-run.h | 159 - contrib/gcc/bitmap.c | 642 - contrib/gcc/bitmap.h | 317 - contrib/gcc/build-make | 35 - contrib/gcc/bytecode.def | 322 - contrib/gcc/bytecode.h | 81 - contrib/gcc/bytetypes.h | 35 - contrib/gcc/c-aux-info.c | 665 - contrib/gcc/c-common.c | 3259 --- contrib/gcc/c-convert.c | 97 - contrib/gcc/c-decl.c | 7452 ------ contrib/gcc/c-iterate.c | 604 - contrib/gcc/c-lang.c | 217 - contrib/gcc/c-lex.c | 2350 -- contrib/gcc/c-lex.h | 88 - contrib/gcc/c-parse.gperf | 88 - contrib/gcc/c-parse.in | 3091 --- contrib/gcc/c-pragma.c | 500 - contrib/gcc/c-pragma.h | 101 - contrib/gcc/c-tree.h | 554 - contrib/gcc/c-typeck.c | 6947 ----- contrib/gcc/caller-save.c | 757 - contrib/gcc/calls.c | 3940 --- contrib/gcc/cccp.1 | 674 - contrib/gcc/cccp.c | 11135 -------- contrib/gcc/cexp.y | 1222 - contrib/gcc/choose-temp.c | 203 - contrib/gcc/collect2.c | 3804 --- contrib/gcc/collect2.h | 36 - contrib/gcc/combine.c | 11991 --------- contrib/gcc/conditions.h | 118 - contrib/gcc/config.guess | 4 - contrib/gcc/config.in | 366 - contrib/gcc/config.sub | 976 - contrib/gcc/config/README | 5 - contrib/gcc/config/alpha/alpha-interix.h | 252 - contrib/gcc/config/alpha/alpha.c | 5280 ---- contrib/gcc/config/alpha/alpha.h | 2550 -- contrib/gcc/config/alpha/alpha.md | 5415 ---- contrib/gcc/config/alpha/alpha32.h | 104 - contrib/gcc/config/alpha/crtbegin.asm | 192 - contrib/gcc/config/alpha/crtend.asm | 108 - contrib/gcc/config/alpha/elf.h | 534 - contrib/gcc/config/alpha/freebsd.h | 103 - contrib/gcc/config/alpha/gdb-osf12.h | 26 - contrib/gcc/config/alpha/gdb-osf2.h | 26 - contrib/gcc/config/alpha/gdb.h | 26 - contrib/gcc/config/alpha/lib1funcs.asm | 325 - contrib/gcc/config/alpha/linux-ecoff.h | 37 - contrib/gcc/config/alpha/linux-elf.h | 48 - contrib/gcc/config/alpha/linux.h | 46 - contrib/gcc/config/alpha/netbsd-elf.h | 32 - contrib/gcc/config/alpha/netbsd.h | 39 - contrib/gcc/config/alpha/openbsd.h | 126 - contrib/gcc/config/alpha/osf.h | 137 - contrib/gcc/config/alpha/osf12.h | 33 - contrib/gcc/config/alpha/osf2.h | 32 - contrib/gcc/config/alpha/osf2or3.h | 30 - contrib/gcc/config/alpha/t-crtbe | 9 - contrib/gcc/config/alpha/t-ieee | 6 - contrib/gcc/config/alpha/t-interix | 16 - contrib/gcc/config/alpha/t-vms | 6 - contrib/gcc/config/alpha/va_list.h | 16 - contrib/gcc/config/alpha/vms-tramp.asm | 22 - contrib/gcc/config/alpha/vms.h | 506 - contrib/gcc/config/alpha/vxworks.h | 51 - contrib/gcc/config/alpha/x-alpha | 2 - contrib/gcc/config/alpha/xm-alpha-interix.h | 45 - contrib/gcc/config/alpha/xm-alpha.h | 76 - contrib/gcc/config/alpha/xm-openbsd.h | 23 - contrib/gcc/config/alpha/xm-vms.h | 93 - contrib/gcc/config/aoutos.h | 41 - contrib/gcc/config/dbx.h | 30 - contrib/gcc/config/dbxcoff.h | 87 - contrib/gcc/config/dbxelf.h | 109 - contrib/gcc/config/elfos.h | 705 - contrib/gcc/config/float-i128.h | 96 - contrib/gcc/config/float-i32.h | 96 - contrib/gcc/config/float-i386.h | 104 - contrib/gcc/config/float-i64.h | 96 - contrib/gcc/config/float-m68k.h | 97 - contrib/gcc/config/float-sh.h | 130 - contrib/gcc/config/float-vax.h | 96 - contrib/gcc/config/fp-bit.c | 1507 -- contrib/gcc/config/freebsd.h | 120 - contrib/gcc/config/gnu.h | 23 - contrib/gcc/config/gofast.h | 96 - contrib/gcc/config/i386/386bsd.h | 76 - contrib/gcc/config/i386/aix386.h | 69 - contrib/gcc/config/i386/aix386ng.h | 140 - contrib/gcc/config/i386/att.h | 93 - contrib/gcc/config/i386/bsd.h | 128 - contrib/gcc/config/i386/bsd386.h | 33 - contrib/gcc/config/i386/config-nt.sed | 38 - contrib/gcc/config/i386/crtdll.h | 40 - contrib/gcc/config/i386/cygwin.asm | 32 - contrib/gcc/config/i386/cygwin.h | 525 - contrib/gcc/config/i386/dgux.c | 192 - contrib/gcc/config/i386/dgux.h | 248 - contrib/gcc/config/i386/djgpp-rtems.h | 41 - contrib/gcc/config/i386/djgpp.h | 161 - contrib/gcc/config/i386/freebsd-aout.h | 247 - contrib/gcc/config/i386/freebsd-elf.h | 257 - contrib/gcc/config/i386/freebsd.h | 257 - contrib/gcc/config/i386/freebsd.h.fixed | 257 - contrib/gcc/config/i386/gas.h | 162 - contrib/gcc/config/i386/gmon-sol2.c | 409 - contrib/gcc/config/i386/gnu.h | 38 - contrib/gcc/config/i386/go32.h | 96 - contrib/gcc/config/i386/gstabs.h | 9 - contrib/gcc/config/i386/i386-aout.h | 34 - contrib/gcc/config/i386/i386-coff.h | 103 - contrib/gcc/config/i386/i386-interix.h | 575 - contrib/gcc/config/i386/i386.c | 5741 ----- contrib/gcc/config/i386/i386.h | 2810 --- contrib/gcc/config/i386/i386.md | 8195 ------ contrib/gcc/config/i386/i386iscgas.h | 67 - contrib/gcc/config/i386/interix.c | 110 - contrib/gcc/config/i386/isc.h | 96 - contrib/gcc/config/i386/isccoff.h | 12 - contrib/gcc/config/i386/iscdbx.h | 43 - contrib/gcc/config/i386/linux-aout.h | 74 - contrib/gcc/config/i386/linux-oldld.h | 75 - contrib/gcc/config/i386/linux.h | 236 - contrib/gcc/config/i386/lynx-ng.h | 37 - contrib/gcc/config/i386/lynx.h | 39 - contrib/gcc/config/i386/mach.h | 20 - contrib/gcc/config/i386/mingw32.h | 94 - contrib/gcc/config/i386/moss.h | 35 - contrib/gcc/config/i386/netbsd.h | 87 - contrib/gcc/config/i386/next.c | 7 - contrib/gcc/config/i386/next.h | 233 - contrib/gcc/config/i386/openbsd.h | 136 - contrib/gcc/config/i386/os2.h | 76 - contrib/gcc/config/i386/osf1-ci.asm | 65 - contrib/gcc/config/i386/osf1-cn.asm | 46 - contrib/gcc/config/i386/osf1elf.h | 260 - contrib/gcc/config/i386/osf1elfgdb.h | 7 - contrib/gcc/config/i386/osfelf.h | 79 - contrib/gcc/config/i386/osfrose.h | 914 - contrib/gcc/config/i386/perform.h | 98 - contrib/gcc/config/i386/ptx4-i.h | 247 - contrib/gcc/config/i386/rtems.h | 34 - contrib/gcc/config/i386/rtemself.h | 169 - contrib/gcc/config/i386/sco.h | 117 - contrib/gcc/config/i386/sco4.h | 86 - contrib/gcc/config/i386/sco4dbx.h | 81 - contrib/gcc/config/i386/sco5.h | 976 - contrib/gcc/config/i386/sco5gas.h | 24 - contrib/gcc/config/i386/scodbx.h | 92 - contrib/gcc/config/i386/seq-gas.h | 46 - contrib/gcc/config/i386/seq-sysv3.h | 42 - contrib/gcc/config/i386/seq2-sysv3.h | 8 - contrib/gcc/config/i386/sequent.h | 151 - contrib/gcc/config/i386/sol2-c1.asm | 156 - contrib/gcc/config/i386/sol2-ci.asm | 51 - contrib/gcc/config/i386/sol2-cn.asm | 46 - contrib/gcc/config/i386/sol2-gc1.asm | 160 - contrib/gcc/config/i386/sol2.h | 125 - contrib/gcc/config/i386/sol2gas.h | 9 - contrib/gcc/config/i386/sun.h | 83 - contrib/gcc/config/i386/sun386.h | 142 - contrib/gcc/config/i386/svr3.ifile | 48 - contrib/gcc/config/i386/svr3dbx.h | 83 - contrib/gcc/config/i386/svr3gas.h | 293 - contrib/gcc/config/i386/svr3z.ifile | 48 - contrib/gcc/config/i386/sysv3.h | 124 - contrib/gcc/config/i386/sysv4.h | 253 - contrib/gcc/config/i386/sysv4gdb.h | 7 - contrib/gcc/config/i386/sysv5.h | 35 - contrib/gcc/config/i386/t-crtpic | 10 - contrib/gcc/config/i386/t-crtstuff | 2 - contrib/gcc/config/i386/t-cygwin | 16 - contrib/gcc/config/i386/t-dgux | 8 - contrib/gcc/config/i386/t-djgpp | 2 - contrib/gcc/config/i386/t-i386bare | 3 - contrib/gcc/config/i386/t-interix | 16 - contrib/gcc/config/i386/t-iscscodbx | 2 - contrib/gcc/config/i386/t-mingw32 | 4 - contrib/gcc/config/i386/t-next | 12 - contrib/gcc/config/i386/t-osf | 2 - contrib/gcc/config/i386/t-osf1elf | 18 - contrib/gcc/config/i386/t-sco5 | 20 - contrib/gcc/config/i386/t-sco5gas | 20 - contrib/gcc/config/i386/t-sol2 | 40 - contrib/gcc/config/i386/t-svr3dbx | 7 - contrib/gcc/config/i386/t-udk | 2 - contrib/gcc/config/i386/t-uwin | 5 - contrib/gcc/config/i386/t-vsta | 2 - contrib/gcc/config/i386/t-winnt | 6 - contrib/gcc/config/i386/udk.h | 30 - contrib/gcc/config/i386/unix.h | 190 - contrib/gcc/config/i386/uwin.asm | 32 - contrib/gcc/config/i386/uwin.h | 93 - contrib/gcc/config/i386/v3gas.h | 80 - contrib/gcc/config/i386/vsta.h | 78 - contrib/gcc/config/i386/vxi386.h | 62 - contrib/gcc/config/i386/win-nt.h | 150 - contrib/gcc/config/i386/win32.h | 280 - contrib/gcc/config/i386/winnt.c | 600 - contrib/gcc/config/i386/x-aix | 12 - contrib/gcc/config/i386/x-cygwin | 4 - contrib/gcc/config/i386/x-dgux | 11 - contrib/gcc/config/i386/x-djgpp | 24 - contrib/gcc/config/i386/x-freebsd | 3 - contrib/gcc/config/i386/x-isc | 3 - contrib/gcc/config/i386/x-isc3 | 4 - contrib/gcc/config/i386/x-ncr3000 | 34 - contrib/gcc/config/i386/x-next | 3 - contrib/gcc/config/i386/x-osf1elf | 8 - contrib/gcc/config/i386/x-osfrose | 27 - contrib/gcc/config/i386/x-sco | 7 - contrib/gcc/config/i386/x-sco4 | 10 - contrib/gcc/config/i386/x-sco5 | 10 - contrib/gcc/config/i386/x-sysv3 | 1 - contrib/gcc/config/i386/x-vsta | 1 - contrib/gcc/config/i386/xm-aix.h | 2 - contrib/gcc/config/i386/xm-bsd386.h | 3 - contrib/gcc/config/i386/xm-cygwin.h | 58 - contrib/gcc/config/i386/xm-dgux.h | 12 - contrib/gcc/config/i386/xm-djgpp.h | 44 - contrib/gcc/config/i386/xm-dos.h | 38 - contrib/gcc/config/i386/xm-freebsd.h | 4 - contrib/gcc/config/i386/xm-gnu.h | 5 - contrib/gcc/config/i386/xm-i386-interix.h | 34 - contrib/gcc/config/i386/xm-i386.h | 43 - contrib/gcc/config/i386/xm-isc.h | 4 - contrib/gcc/config/i386/xm-linux.h | 24 - contrib/gcc/config/i386/xm-lynx.h | 33 - contrib/gcc/config/i386/xm-mingw32.h | 48 - contrib/gcc/config/i386/xm-netbsd.h | 4 - contrib/gcc/config/i386/xm-next.h | 5 - contrib/gcc/config/i386/xm-openbsd.h | 23 - contrib/gcc/config/i386/xm-os2.h | 75 - contrib/gcc/config/i386/xm-osf.h | 2 - contrib/gcc/config/i386/xm-osf1elf.h | 6 - contrib/gcc/config/i386/xm-sco.h | 13 - contrib/gcc/config/i386/xm-sco5.h | 7 - contrib/gcc/config/i386/xm-sun.h | 23 - contrib/gcc/config/i386/xm-sysv3.h | 4 - contrib/gcc/config/i386/xm-sysv4.h | 5 - contrib/gcc/config/i386/xm-uwin.h | 39 - contrib/gcc/config/i386/xm-vsta.h | 2 - contrib/gcc/config/i386/xm-winnt.h | 24 - contrib/gcc/config/interix.h | 107 - contrib/gcc/config/libgloss.h | 35 - contrib/gcc/config/linux-aout.h | 48 - contrib/gcc/config/linux.h | 115 - contrib/gcc/config/lynx-ng.h | 118 - contrib/gcc/config/lynx.h | 179 - contrib/gcc/config/netbsd.h | 209 - contrib/gcc/config/nextstep.c | 97 - contrib/gcc/config/nextstep.h | 601 - contrib/gcc/config/nextstep21.h | 65 - contrib/gcc/config/openbsd.h | 311 - contrib/gcc/config/psos.h | 183 - contrib/gcc/config/ptx4.h | 860 - contrib/gcc/config/sparc/aout.h | 26 - contrib/gcc/config/sparc/bsd.h | 7 - contrib/gcc/config/sparc/elf.h | 58 - contrib/gcc/config/sparc/gmon-sol2.c | 425 - contrib/gcc/config/sparc/hal.h | 33 - contrib/gcc/config/sparc/lb1spc.asm | 784 - contrib/gcc/config/sparc/lb1spl.asm | 246 - contrib/gcc/config/sparc/linux-aout.h | 130 - contrib/gcc/config/sparc/linux.h | 259 - contrib/gcc/config/sparc/linux64.h | 366 - contrib/gcc/config/sparc/lite.h | 38 - contrib/gcc/config/sparc/litecoff.h | 113 - contrib/gcc/config/sparc/lynx-ng.h | 41 - contrib/gcc/config/sparc/lynx.h | 53 - contrib/gcc/config/sparc/netbsd.h | 46 - contrib/gcc/config/sparc/openbsd.h | 68 - contrib/gcc/config/sparc/pbd.h | 156 - contrib/gcc/config/sparc/rtems.h | 35 - contrib/gcc/config/sparc/sol2-c1.asm | 110 - contrib/gcc/config/sparc/sol2-ci.asm | 68 - contrib/gcc/config/sparc/sol2-cn.asm | 54 - contrib/gcc/config/sparc/sol2-g1.asm | 88 - contrib/gcc/config/sparc/sol2-sld-64.h | 363 - contrib/gcc/config/sparc/sol2-sld.h | 11 - contrib/gcc/config/sparc/sol2.h | 236 - contrib/gcc/config/sparc/sp64-aout.h | 38 - contrib/gcc/config/sparc/sp64-elf.h | 158 - contrib/gcc/config/sparc/sparc.c | 7843 ------ contrib/gcc/config/sparc/sparc.h | 3309 --- contrib/gcc/config/sparc/sparc.md | 8236 ------ contrib/gcc/config/sparc/splet.h | 69 - contrib/gcc/config/sparc/sun4gas.h | 27 - contrib/gcc/config/sparc/sun4o3.h | 29 - contrib/gcc/config/sparc/sunos4.h | 49 - contrib/gcc/config/sparc/sysv4.h | 216 - contrib/gcc/config/sparc/t-elf | 39 - contrib/gcc/config/sparc/t-halos | 2 - contrib/gcc/config/sparc/t-linux64 | 21 - contrib/gcc/config/sparc/t-sol2 | 30 - contrib/gcc/config/sparc/t-sol2-64 | 8 - contrib/gcc/config/sparc/t-sp64 | 2 - contrib/gcc/config/sparc/t-sparcbare | 26 - contrib/gcc/config/sparc/t-sparclite | 24 - contrib/gcc/config/sparc/t-splet | 22 - contrib/gcc/config/sparc/t-sunos40 | 7 - contrib/gcc/config/sparc/t-sunos41 | 16 - contrib/gcc/config/sparc/t-vxsparc | 17 - contrib/gcc/config/sparc/vxsim.h | 131 - contrib/gcc/config/sparc/vxsparc.h | 61 - contrib/gcc/config/sparc/x-sysv4 | 2 - contrib/gcc/config/sparc/xm-linux.h | 26 - contrib/gcc/config/sparc/xm-lynx.h | 39 - contrib/gcc/config/sparc/xm-openbsd.h | 23 - contrib/gcc/config/sparc/xm-pbd.h | 10 - contrib/gcc/config/sparc/xm-sol2.h | 4 - contrib/gcc/config/sparc/xm-sp64.h | 27 - contrib/gcc/config/sparc/xm-sparc.h | 49 - contrib/gcc/config/sparc/xm-sysv4-64.h | 27 - contrib/gcc/config/sparc/xm-sysv4.h | 48 - contrib/gcc/config/svr3.h | 375 - contrib/gcc/config/svr4.h | 926 - contrib/gcc/config/t-freebsd | 4 - contrib/gcc/config/t-gnu | 16 - contrib/gcc/config/t-libc-ok | 3 - contrib/gcc/config/t-linux-aout | 11 - contrib/gcc/config/t-netbsd | 9 - contrib/gcc/config/t-openbsd | 7 - contrib/gcc/config/t-openbsd-thread | 5 - contrib/gcc/config/t-rtems | 13 - contrib/gcc/config/t-svr4 | 8 - contrib/gcc/config/tm-dwarf2.h | 4 - contrib/gcc/config/x-interix | 24 - contrib/gcc/config/x-linux | 5 - contrib/gcc/config/x-linux-aout | 14 - contrib/gcc/config/x-lynx | 6 - contrib/gcc/config/x-netbsd | 6 - contrib/gcc/config/x-svr4 | 9 - contrib/gcc/config/xm-alloca.h | 4 - contrib/gcc/config/xm-freebsd.h | 24 - contrib/gcc/config/xm-gnu.h | 32 - contrib/gcc/config/xm-interix.h | 77 - contrib/gcc/config/xm-linux.h | 33 - contrib/gcc/config/xm-lynx.h | 51 - contrib/gcc/config/xm-netbsd.h | 26 - contrib/gcc/config/xm-openbsd.h | 35 - contrib/gcc/config/xm-siglist.h | 6 - contrib/gcc/config/xm-std32.h | 34 - contrib/gcc/config/xm-svr3.h | 25 - contrib/gcc/config/xm-svr4.h | 29 - contrib/gcc/configure | 9202 ------- contrib/gcc/configure.frag | 77 - contrib/gcc/configure.in | 4514 ---- contrib/gcc/configure.lang | 233 - contrib/gcc/convert.c | 444 - contrib/gcc/convert.h | 24 - contrib/gcc/cp/ChangeLog | 16207 ------------ contrib/gcc/cp/Make-lang.in | 310 - contrib/gcc/cp/Makefile.in | 324 - contrib/gcc/cp/NEWS | 262 - contrib/gcc/cp/call.c | 4558 ---- contrib/gcc/cp/class.c | 5753 ----- contrib/gcc/cp/class.h | 117 - contrib/gcc/cp/config-lang.in | 41 - contrib/gcc/cp/cp-tree.def | 258 - contrib/gcc/cp/cp-tree.h | 3574 --- contrib/gcc/cp/cvt.c | 1141 - contrib/gcc/cp/decl.c | 15160 ----------- contrib/gcc/cp/decl.h | 54 - contrib/gcc/cp/decl2.c | 5379 ---- contrib/gcc/cp/edsel.c | 928 - contrib/gcc/cp/errfn.c | 352 - contrib/gcc/cp/error.c | 2093 -- contrib/gcc/cp/except.c | 1161 - contrib/gcc/cp/exception.cc | 343 - contrib/gcc/cp/expr.c | 461 - contrib/gcc/cp/friend.c | 472 - contrib/gcc/cp/g++.1 | 642 - contrib/gcc/cp/g++.c | 582 - contrib/gcc/cp/g++spec.c | 266 - contrib/gcc/cp/gc.c | 1550 -- contrib/gcc/cp/gpcompare.texi | 236 - contrib/gcc/cp/gxx.gperf | 111 - contrib/gcc/cp/gxxint.texi | 2075 -- contrib/gcc/cp/inc/exception | 39 - contrib/gcc/cp/inc/new | 42 - contrib/gcc/cp/inc/new.h | 11 - contrib/gcc/cp/inc/typeinfo | 58 - contrib/gcc/cp/init.c | 3499 --- contrib/gcc/cp/input.c | 207 - contrib/gcc/cp/lang-options.h | 134 - contrib/gcc/cp/lang-specs.h | 97 - contrib/gcc/cp/lex.c | 5025 ---- contrib/gcc/cp/lex.h | 137 - contrib/gcc/cp/method.c | 2656 -- contrib/gcc/cp/mpw-config.in | 11 - contrib/gcc/cp/mpw-make.sed | 112 - contrib/gcc/cp/new.cc | 42 - contrib/gcc/cp/new1.cc | 89 - contrib/gcc/cp/new2.cc | 80 - contrib/gcc/cp/parse.y | 3807 --- contrib/gcc/cp/pt.c | 9876 -------- contrib/gcc/cp/ptree.c | 185 - contrib/gcc/cp/reno.texi | 752 - contrib/gcc/cp/repo.c | 447 - contrib/gcc/cp/rtti.c | 1203 - contrib/gcc/cp/search.c | 3350 --- contrib/gcc/cp/semantics.c | 1686 -- contrib/gcc/cp/sig.c | 1067 - contrib/gcc/cp/spew.c | 489 - contrib/gcc/cp/templates.texi | 235 - contrib/gcc/cp/tinfo.cc | 134 - contrib/gcc/cp/tinfo.h | 55 - contrib/gcc/cp/tinfo2.cc | 300 - contrib/gcc/cp/tree.c | 2811 --- contrib/gcc/cp/tree.def | 116 - contrib/gcc/cp/typeck.c | 7749 ------ contrib/gcc/cp/typeck2.c | 1660 -- contrib/gcc/cp/xref.c | 841 - contrib/gcc/cplus-dem.c | 4615 ---- contrib/gcc/cpp.1 | 1 - contrib/gcc/cpp.texi | 2967 --- contrib/gcc/cppalloc.c | 81 - contrib/gcc/cpperror.c | 208 - contrib/gcc/cppexp.c | 1058 - contrib/gcc/cppfiles.c | 1605 -- contrib/gcc/cpphash.c | 1735 -- contrib/gcc/cpphash.h | 61 - contrib/gcc/cppinit.c | 1779 -- contrib/gcc/cpplib.c | 3275 --- contrib/gcc/cpplib.h | 770 - contrib/gcc/cppmain.c | 112 - contrib/gcc/cppspec.c | 234 - contrib/gcc/cppulp.c | 26 - contrib/gcc/cross-make | 14 - contrib/gcc/crtstuff.c | 564 - contrib/gcc/cse.c | 9267 ------- contrib/gcc/cstamp-h.in | 1 - contrib/gcc/dbxout.c | 2719 -- contrib/gcc/dbxout.h | 33 - contrib/gcc/dbxstclass.h | 17 - contrib/gcc/defaults.h | 156 - contrib/gcc/demangle.h | 95 - contrib/gcc/doprint.c | 295 - contrib/gcc/doschk.c | 360 - contrib/gcc/dostage2 | 2 - contrib/gcc/dostage3 | 3 - contrib/gcc/dwarf.h | 315 - contrib/gcc/dwarf2.h | 549 - contrib/gcc/dwarf2out.c | 10135 -------- contrib/gcc/dwarf2out.h | 41 - contrib/gcc/dwarfout.c | 6105 ----- contrib/gcc/dwarfout.h | 42 - contrib/gcc/dyn-string.c | 97 - contrib/gcc/dyn-string.h | 32 - contrib/gcc/eh-common.h | 142 - contrib/gcc/emit-rtl.c | 3830 --- contrib/gcc/enquire.c | 2887 --- contrib/gcc/except.c | 2967 --- contrib/gcc/except.h | 401 - contrib/gcc/exgettext | 118 - contrib/gcc/explow.c | 1548 -- contrib/gcc/expmed.c | 4578 ---- contrib/gcc/expr.c | 11736 --------- contrib/gcc/expr.h | 1035 - contrib/gcc/extend.texi | 3782 --- contrib/gcc/f/BUGS | 159 - contrib/gcc/f/ChangeLog | 1278 - contrib/gcc/f/INSTALL | 352 - contrib/gcc/f/Make-lang.in | 463 - contrib/gcc/f/Makefile.in | 529 - contrib/gcc/f/NEWS | 412 - contrib/gcc/f/README | 7 - contrib/gcc/f/RELEASE-PREP | 5 - contrib/gcc/f/ansify.c | 208 - contrib/gcc/f/assert.j | 27 - contrib/gcc/f/bad.c | 544 - contrib/gcc/f/bad.def | 715 - contrib/gcc/f/bad.h | 108 - contrib/gcc/f/bit.c | 201 - contrib/gcc/f/bit.h | 84 - contrib/gcc/f/bld-op.def | 69 - contrib/gcc/f/bld.c | 5803 ----- contrib/gcc/f/bld.h | 1039 - contrib/gcc/f/bugs.texi | 275 - contrib/gcc/f/bugs0.texi | 9 - contrib/gcc/f/com-rt.def | 283 - contrib/gcc/f/com.c | 17447 ------------- contrib/gcc/f/com.h | 393 - contrib/gcc/f/config-lang.in | 37 - contrib/gcc/f/config.j | 27 - contrib/gcc/f/convert.j | 28 - contrib/gcc/f/data.c | 1816 -- contrib/gcc/f/data.h | 74 - contrib/gcc/f/equiv.c | 1498 -- contrib/gcc/f/equiv.h | 103 - contrib/gcc/f/expr.c | 19425 -------------- contrib/gcc/f/expr.h | 194 - contrib/gcc/f/ffe.texi | 2024 -- contrib/gcc/f/fini.c | 776 - contrib/gcc/f/flags.j | 27 - contrib/gcc/f/g77.1 | 365 - contrib/gcc/f/g77.texi | 15091 ----------- contrib/gcc/f/g77install.texi | 2251 -- contrib/gcc/f/g77spec.c | 582 - contrib/gcc/f/glimits.j | 28 - contrib/gcc/f/global.c | 1593 -- contrib/gcc/f/global.h | 200 - contrib/gcc/f/hconfig.j | 27 - contrib/gcc/f/implic.c | 382 - contrib/gcc/f/implic.h | 74 - contrib/gcc/f/info-b.def | 36 - contrib/gcc/f/info-k.def | 37 - contrib/gcc/f/info-w.def | 41 - contrib/gcc/f/info.c | 304 - contrib/gcc/f/info.h | 186 - contrib/gcc/f/input.j | 27 - contrib/gcc/f/intdoc.c | 1347 - contrib/gcc/f/intdoc.in | 2704 -- contrib/gcc/f/intdoc.texi | 10930 -------- contrib/gcc/f/intrin.c | 2085 -- contrib/gcc/f/intrin.def | 3357 --- contrib/gcc/f/intrin.h | 137 - contrib/gcc/f/lab.c | 159 - contrib/gcc/f/lab.h | 154 - contrib/gcc/f/lang-options.h | 169 - contrib/gcc/f/lang-specs.h | 110 - contrib/gcc/f/lex.c | 4759 ---- contrib/gcc/f/lex.h | 201 - contrib/gcc/f/malloc.c | 552 - contrib/gcc/f/malloc.h | 183 - contrib/gcc/f/name.c | 242 - contrib/gcc/f/name.h | 109 - contrib/gcc/f/news.texi | 2957 --- contrib/gcc/f/news0.texi | 9 - contrib/gcc/f/output.j | 27 - contrib/gcc/f/parse.c | 95 - contrib/gcc/f/proj.c | 68 - contrib/gcc/f/proj.h | 83 - contrib/gcc/f/root.texi | 40 - contrib/gcc/f/rtl.j | 28 - contrib/gcc/f/src.c | 445 - contrib/gcc/f/src.h | 144 - contrib/gcc/f/st.c | 554 - contrib/gcc/f/st.h | 81 - contrib/gcc/f/sta.c | 2000 -- contrib/gcc/f/sta.h | 117 - contrib/gcc/f/stb.c | 25204 ------------------- contrib/gcc/f/stb.h | 253 - contrib/gcc/f/stc.c | 13902 ---------- contrib/gcc/f/stc.h | 360 - contrib/gcc/f/std.c | 6928 ----- contrib/gcc/f/std.h | 298 - contrib/gcc/f/ste.c | 5773 ----- contrib/gcc/f/ste.h | 172 - contrib/gcc/f/storag.c | 573 - contrib/gcc/f/storag.h | 167 - contrib/gcc/f/stp.c | 59 - contrib/gcc/f/stp.h | 508 - contrib/gcc/f/str-1t.fin | 135 - contrib/gcc/f/str-2t.fin | 60 - contrib/gcc/f/str-fo.fin | 55 - contrib/gcc/f/str-io.fin | 43 - contrib/gcc/f/str-nq.fin | 55 - contrib/gcc/f/str-op.fin | 57 - contrib/gcc/f/str-ot.fin | 50 - contrib/gcc/f/str.c | 217 - contrib/gcc/f/str.h | 85 - contrib/gcc/f/sts.c | 273 - contrib/gcc/f/sts.h | 89 - contrib/gcc/f/stt.c | 1044 - contrib/gcc/f/stt.h | 230 - contrib/gcc/f/stu.c | 1161 - contrib/gcc/f/stu.h | 69 - contrib/gcc/f/stv.c | 66 - contrib/gcc/f/stv.h | 165 - contrib/gcc/f/stw.c | 428 - contrib/gcc/f/stw.h | 187 - contrib/gcc/f/symbol.c | 1478 -- contrib/gcc/f/symbol.def | 654 - contrib/gcc/f/symbol.h | 296 - contrib/gcc/f/system.j | 27 - contrib/gcc/f/target.c | 2564 -- contrib/gcc/f/target.h | 1891 -- contrib/gcc/f/tconfig.j | 27 - contrib/gcc/f/tm.j | 27 - contrib/gcc/f/top.c | 919 - contrib/gcc/f/top.h | 267 - contrib/gcc/f/toplev.j | 27 - contrib/gcc/f/tree.j | 28 - contrib/gcc/f/type.c | 107 - contrib/gcc/f/type.h | 64 - contrib/gcc/f/version.c | 1 - contrib/gcc/f/version.h | 6 - contrib/gcc/f/where.c | 542 - contrib/gcc/f/where.h | 138 - contrib/gcc/final.c | 4149 --- contrib/gcc/fix-header.c | 1333 - contrib/gcc/fixcpp | 109 - contrib/gcc/fixinc-nt.sed | 5 - contrib/gcc/fixinc.dgux | 185 - contrib/gcc/fixinc.ptx | 257 - contrib/gcc/fixinc.sco | 427 - contrib/gcc/fixinc.svr4 | 1726 -- contrib/gcc/fixinc.winnt | 232 - contrib/gcc/fixincludes | 3265 --- contrib/gcc/fixproto | 309 - contrib/gcc/flags.h | 540 - contrib/gcc/floatlib.c | 945 - contrib/gcc/flow.c | 5255 ---- contrib/gcc/fold-const.c | 6619 ----- contrib/gcc/fp-test.c | 231 - contrib/gcc/frame.c | 864 - contrib/gcc/frame.h | 85 - contrib/gcc/function.c | 7011 ------ contrib/gcc/function.h | 305 - contrib/gcc/future.options | 29 - contrib/gcc/gansidecl.h | 85 - contrib/gcc/gbl-ctors.h | 92 - contrib/gcc/gcc.1 | 4191 --- contrib/gcc/gcc.c | 5835 ----- contrib/gcc/gcc.texi | 4776 ---- contrib/gcc/gccspec.c | 43 - contrib/gcc/gcov-io.h | 142 - contrib/gcc/gcov.c | 1403 -- contrib/gcc/gcov.texi | 344 - contrib/gcc/gcse.c | 4704 ---- contrib/gcc/gen-protos.c | 185 - contrib/gcc/genattr.c | 446 - contrib/gcc/genattrtab.c | 6164 ----- contrib/gcc/gencheck.c | 84 - contrib/gcc/gencodes.c | 178 - contrib/gcc/genconfig.c | 379 - contrib/gcc/genemit.c | 829 - contrib/gcc/genextract.c | 561 - contrib/gcc/genflags.c | 315 - contrib/gcc/gengenrtl.c | 353 - contrib/gcc/genmultilib | 269 - contrib/gcc/genopinit.c | 399 - contrib/gcc/genoutput.c | 1051 - contrib/gcc/genpeep.c | 526 - contrib/gcc/genrecog.c | 1834 -- contrib/gcc/getopt.c | 1056 - contrib/gcc/getopt.h | 133 - contrib/gcc/getopt1.c | 190 - contrib/gcc/getpwd.c | 90 - contrib/gcc/ginclude/iso646.h | 15 - contrib/gcc/ginclude/math-3300.h | 461 - contrib/gcc/ginclude/math-68881.h | 529 - contrib/gcc/ginclude/ppc-asm.h | 170 - contrib/gcc/ginclude/proto.h | 4 - contrib/gcc/ginclude/stdarg.h | 212 - contrib/gcc/ginclude/stdbool.h | 20 - contrib/gcc/ginclude/stddef.h | 342 - contrib/gcc/ginclude/va-alpha.h | 128 - contrib/gcc/ginclude/va-arc.h | 111 - contrib/gcc/ginclude/va-c4x.h | 34 - contrib/gcc/ginclude/va-clipper.h | 60 - contrib/gcc/ginclude/va-h8300.h | 56 - contrib/gcc/ginclude/va-i860.h | 214 - contrib/gcc/ginclude/va-i960.h | 79 - contrib/gcc/ginclude/va-m32r.h | 86 - contrib/gcc/ginclude/va-m88k.h | 87 - contrib/gcc/ginclude/va-mips.h | 277 - contrib/gcc/ginclude/va-mn10200.h | 37 - contrib/gcc/ginclude/va-mn10300.h | 35 - contrib/gcc/ginclude/va-pa.h | 52 - contrib/gcc/ginclude/va-ppc.h | 255 - contrib/gcc/ginclude/va-pyr.h | 130 - contrib/gcc/ginclude/va-sh.h | 229 - contrib/gcc/ginclude/va-sparc.h | 165 - contrib/gcc/ginclude/va-spur.h | 64 - contrib/gcc/ginclude/va-v850.h | 34 - contrib/gcc/ginclude/varargs.h | 229 - contrib/gcc/glimits.h | 98 - contrib/gcc/global.c | 1845 -- contrib/gcc/gmon.c | 329 - contrib/gcc/graph.c | 475 - contrib/gcc/gstab.h | 17 - contrib/gcc/gsyms.h | 86 - contrib/gcc/gsyslimits.h | 8 - contrib/gcc/gthr-dce.h | 150 - contrib/gcc/gthr-posix.h | 147 - contrib/gcc/gthr-single.h | 62 - contrib/gcc/gthr-solaris.h | 177 - contrib/gcc/gthr-vxworks.h | 142 - contrib/gcc/gthr.h | 105 - contrib/gcc/haifa-sched.c | 8828 ------- contrib/gcc/halfpic.c | 397 - contrib/gcc/halfpic.h | 71 - contrib/gcc/hard-reg-set.h | 470 - contrib/gcc/hash.c | 245 - contrib/gcc/hash.h | 131 - contrib/gcc/hwint.h | 96 - contrib/gcc/input.h | 47 - contrib/gcc/install.sh | 238 - contrib/gcc/install.texi | 2381 -- contrib/gcc/integrate.c | 3484 --- contrib/gcc/integrate.h | 154 - contrib/gcc/intl.c | 6 - contrib/gcc/intl.h | 52 - contrib/gcc/invoke.texi | 6784 ----- contrib/gcc/jump.c | 5182 ---- contrib/gcc/just-fixinc | 39 - contrib/gcc/lcm.c | 799 - contrib/gcc/libgcc1-test.c | 106 - contrib/gcc/libgcc1.c | 596 - contrib/gcc/libgcc2.c | 4014 --- contrib/gcc/libiberty.h | 180 - contrib/gcc/limitx.h | 12 - contrib/gcc/limity.h | 10 - contrib/gcc/listing | 227 - contrib/gcc/local-alloc.c | 2267 -- contrib/gcc/longlong.h | 1258 - contrib/gcc/loop.c | 9757 ------- contrib/gcc/loop.h | 249 - contrib/gcc/machmode.def | 123 - contrib/gcc/machmode.h | 162 - contrib/gcc/makefile.vms | 413 - contrib/gcc/mbchar.c | 290 - contrib/gcc/mbchar.h | 41 - contrib/gcc/md.texi | 4258 ---- contrib/gcc/mips-tdump.c | 1606 -- contrib/gcc/mips-tfile.c | 5782 ----- contrib/gcc/modemap.def | 31 - contrib/gcc/move-if-change | 17 - contrib/gcc/objc-act.c | 8268 ------ contrib/gcc/objc-act.h | 117 - contrib/gcc/objc-tree.def | 37 - contrib/gcc/objc/Make-lang.in | 165 - contrib/gcc/objc/Makefile | 100 - contrib/gcc/objc/Makefile.in | 73 - contrib/gcc/objc/NXConstStr.h | 44 - contrib/gcc/objc/NXConstStr.m | 42 - contrib/gcc/objc/Object.h | 124 - contrib/gcc/objc/Object.m | 387 - contrib/gcc/objc/Protocol.h | 58 - contrib/gcc/objc/Protocol.m | 128 - contrib/gcc/objc/README | 97 - contrib/gcc/objc/archive.c | 1651 -- contrib/gcc/objc/class.c | 358 - contrib/gcc/objc/config-lang.in | 35 - contrib/gcc/objc/encoding.c | 554 - contrib/gcc/objc/encoding.h | 75 - contrib/gcc/objc/hash.c | 283 - contrib/gcc/objc/hash.h | 206 - contrib/gcc/objc/init.c | 834 - contrib/gcc/objc/lang-specs.h | 96 - contrib/gcc/objc/list.h | 150 - contrib/gcc/objc/makefile.dos | 56 - contrib/gcc/objc/misc.c | 152 - contrib/gcc/objc/objc-act.c | 8572 ------- contrib/gcc/objc/objc-act.h | 117 - contrib/gcc/objc/objc-api.h | 584 - contrib/gcc/objc/objc-tree.def | 37 - contrib/gcc/objc/objc.gperf | 64 - contrib/gcc/objc/objc.h | 157 - contrib/gcc/objc/objects.c | 92 - contrib/gcc/objc/runtime.h | 88 - contrib/gcc/objc/sarray.c | 522 - contrib/gcc/objc/sarray.h | 237 - contrib/gcc/objc/selector.c | 458 - contrib/gcc/objc/sendmsg.c | 651 - contrib/gcc/objc/typedstream.h | 132 - contrib/gcc/obstack.c | 593 - contrib/gcc/obstack.h | 593 - contrib/gcc/optabs.c | 4850 ---- contrib/gcc/output.h | 515 - contrib/gcc/patch-apollo-includes | 69 - contrib/gcc/pcp.h | 101 - contrib/gcc/pexecute.c | 734 - contrib/gcc/prefix.c | 345 - contrib/gcc/prefix.h | 28 - contrib/gcc/print-rtl.c | 486 - contrib/gcc/print-tree.c | 696 - contrib/gcc/profile.c | 1707 -- contrib/gcc/protoize.c | 4702 ---- contrib/gcc/pself.c | 1 - contrib/gcc/pself1.c | 1 - contrib/gcc/pself2.c | 1 - contrib/gcc/pself3.c | 1 - contrib/gcc/pself4.c | 2 - contrib/gcc/pself5.c | 5 - contrib/gcc/real.c | 6862 ----- contrib/gcc/real.h | 495 - contrib/gcc/recog.c | 2688 -- contrib/gcc/recog.h | 208 - contrib/gcc/reg-stack.c | 3032 --- contrib/gcc/regclass.c | 2231 -- contrib/gcc/regmove.c | 2190 -- contrib/gcc/regs.h | 223 - contrib/gcc/reload.c | 6759 ----- contrib/gcc/reload.h | 344 - contrib/gcc/reload1.c | 10263 -------- contrib/gcc/reorg.c | 3673 --- contrib/gcc/resource.c | 1289 - contrib/gcc/resource.h | 46 - contrib/gcc/rtl.c | 961 - contrib/gcc/rtl.def | 880 - contrib/gcc/rtl.h | 1633 -- contrib/gcc/rtl.texi | 2998 --- contrib/gcc/rtlanal.c | 2291 -- contrib/gcc/sbitmap.c | 470 - contrib/gcc/sbitmap.h | 122 - contrib/gcc/scan-decls.c | 255 - contrib/gcc/scan-types.sh | 139 - contrib/gcc/scan.c | 241 - contrib/gcc/scan.h | 75 - contrib/gcc/sched.c | 4470 ---- contrib/gcc/sdbout.c | 1680 -- contrib/gcc/sdbout.h | 39 - contrib/gcc/sort-protos | 9 - contrib/gcc/splay-tree.c | 368 - contrib/gcc/splay-tree.h | 116 - contrib/gcc/stab.def | 234 - contrib/gcc/stack.h | 42 - contrib/gcc/stmt.c | 6130 ----- contrib/gcc/stor-layout.c | 1415 -- contrib/gcc/stupid.c | 770 - contrib/gcc/sys-protos.h | 1354 - contrib/gcc/sys-types.h | 240 - contrib/gcc/system.h | 498 - contrib/gcc/tlink.c | 732 - contrib/gcc/tm.texi | 7691 ------ contrib/gcc/toplev.c | 5729 ----- contrib/gcc/toplev.h | 118 - contrib/gcc/tree.c | 5170 ---- contrib/gcc/tree.def | 797 - contrib/gcc/tree.h | 2372 -- contrib/gcc/typeclass.h | 14 - contrib/gcc/unprotoize.c | 2 - contrib/gcc/unroll.c | 4130 --- contrib/gcc/varasm.c | 4489 ---- contrib/gcc/varray.c | 70 - contrib/gcc/varray.h | 199 - contrib/gcc/version.c | 1 - contrib/gcc/xcoffout.c | 545 - contrib/gcc/xcoffout.h | 211 - contrib/libf2c/ChangeLog.egcs | 200 - contrib/libg++/COPYING | 339 - contrib/libg++/COPYING.LIB | 481 - contrib/libg++/include/ChangeLog | 990 - contrib/libg++/include/ansidecl.h | 141 - contrib/libg++/include/demangle.h | 89 - contrib/libg++/include/floatformat.h | 88 - contrib/libg++/include/getopt.h | 129 - contrib/libg++/include/libiberty.h | 137 - contrib/libg++/include/obstack.h | 518 - contrib/libg++/libg++/ChangeLog | 2271 -- contrib/libg++/libg++/Makefile.in | 263 - contrib/libg++/libg++/NEWS | 573 - contrib/libg++/libg++/README | 247 - contrib/libg++/libg++/README.SHLIB | 38 - contrib/libg++/libg++/TODO | 13 - contrib/libg++/libg++/g++FAQ.texi | 1986 -- contrib/libg++/libg++/genclass/ChangeLog | 27 - contrib/libg++/libg++/genclass/Makefile.in | 23 - contrib/libg++/libg++/genclass/configure.in | 26 - contrib/libg++/libg++/genclass/expected.out | 1027 - contrib/libg++/libg++/genclass/genclass.sh | 452 - contrib/libg++/libg++/genclass/gentest.sh | 174 - contrib/libg++/libg++/libg++.texi | 4803 ---- contrib/libg++/libg++/src/ACG.cc | 292 - contrib/libg++/libg++/src/ACG.h | 68 - contrib/libg++/libg++/src/AllocRing.cc | 110 - contrib/libg++/libg++/src/AllocRing.h | 62 - contrib/libg++/libg++/src/Binomial.cc | 34 - contrib/libg++/libg++/src/Binomial.h | 55 - contrib/libg++/libg++/src/BitSet.cc | 1104 - contrib/libg++/libg++/src/BitSet.h | 360 - contrib/libg++/libg++/src/BitString.cc | 1608 -- contrib/libg++/libg++/src/BitString.h | 763 - contrib/libg++/libg++/src/ChangeLog | 1213 - contrib/libg++/libg++/src/Complex.h | 10 - contrib/libg++/libg++/src/CursesW.cc | 257 - contrib/libg++/libg++/src/CursesW.h | 603 - contrib/libg++/libg++/src/DLList.cc | 327 - contrib/libg++/libg++/src/DLList.h | 139 - contrib/libg++/libg++/src/DiscUnif.cc | 29 - contrib/libg++/libg++/src/DiscUnif.h | 72 - contrib/libg++/libg++/src/Erlang.cc | 32 - contrib/libg++/libg++/src/Erlang.h | 68 - contrib/libg++/libg++/src/Fix.cc | 670 - contrib/libg++/libg++/src/Fix.h | 523 - contrib/libg++/libg++/src/Fix16.cc | 238 - contrib/libg++/libg++/src/Fix16.h | 648 - contrib/libg++/libg++/src/Fix24.cc | 329 - contrib/libg++/libg++/src/Fix24.h | 597 - contrib/libg++/libg++/src/Geom.cc | 30 - contrib/libg++/libg++/src/Geom.h | 52 - contrib/libg++/libg++/src/GetOpt.cc | 253 - contrib/libg++/libg++/src/GetOpt.h | 129 - contrib/libg++/libg++/src/HypGeom.cc | 30 - contrib/libg++/libg++/src/HypGeom.h | 70 - contrib/libg++/libg++/src/Incremental.h | 12 - contrib/libg++/libg++/src/Intdouble.cc | 142 - contrib/libg++/libg++/src/Integer.cc | 2282 -- contrib/libg++/libg++/src/Integer.h | 1134 - contrib/libg++/libg++/src/Integer.hP | 30 - contrib/libg++/libg++/src/LogNorm.cc | 36 - contrib/libg++/libg++/src/LogNorm.h | 78 - contrib/libg++/libg++/src/MLCG.cc | 103 - contrib/libg++/libg++/src/MLCG.h | 87 - contrib/libg++/libg++/src/Makefile.in | 75 - contrib/libg++/libg++/src/NegExp.cc | 28 - contrib/libg++/libg++/src/NegExp.h | 55 - contrib/libg++/libg++/src/Normal.cc | 60 - contrib/libg++/libg++/src/Normal.h | 66 - contrib/libg++/libg++/src/Obstack.cc | 127 - contrib/libg++/libg++/src/Obstack.h | 218 - contrib/libg++/libg++/src/Pix.h | 5 - contrib/libg++/libg++/src/Poisson.cc | 36 - contrib/libg++/libg++/src/Poisson.h | 51 - contrib/libg++/libg++/src/RNG.cc | 131 - contrib/libg++/libg++/src/RNG.h | 58 - contrib/libg++/libg++/src/Random.cc | 4 - contrib/libg++/libg++/src/Random.h | 54 - contrib/libg++/libg++/src/Rational.cc | 416 - contrib/libg++/libg++/src/Rational.h | 290 - contrib/libg++/libg++/src/Regex.cc | 149 - contrib/libg++/libg++/src/Regex.h | 78 - contrib/libg++/libg++/src/RndInt.cc | 4 - contrib/libg++/libg++/src/RndInt.h | 176 - contrib/libg++/libg++/src/SLList.cc | 247 - contrib/libg++/libg++/src/SLList.h | 129 - contrib/libg++/libg++/src/Sample.cc | 241 - contrib/libg++/libg++/src/SmplHist.cc | 112 - contrib/libg++/libg++/src/SmplHist.h | 72 - contrib/libg++/libg++/src/SmplStat.cc | 160 - contrib/libg++/libg++/src/SmplStat.h | 69 - contrib/libg++/libg++/src/String.cc | 1307 - contrib/libg++/libg++/src/String.h | 1284 - contrib/libg++/libg++/src/Uniform.cc | 27 - contrib/libg++/libg++/src/Uniform.h | 71 - contrib/libg++/libg++/src/Weibull.cc | 33 - contrib/libg++/libg++/src/Weibull.h | 74 - contrib/libg++/libg++/src/bitand.c | 41 - contrib/libg++/libg++/src/bitany.c | 38 - contrib/libg++/libg++/src/bitblt.c | 97 - contrib/libg++/libg++/src/bitclear.c | 37 - contrib/libg++/libg++/src/bitcopy.c | 41 - contrib/libg++/libg++/src/bitcount.c | 64 - contrib/libg++/libg++/src/bitdo1.h | 32 - contrib/libg++/libg++/src/bitdo2.h | 184 - contrib/libg++/libg++/src/bitinvert.c | 37 - contrib/libg++/libg++/src/bitlcomp.c | 81 - contrib/libg++/libg++/src/bitprims.h | 125 - contrib/libg++/libg++/src/bitset1.c | 37 - contrib/libg++/libg++/src/bitxor.c | 41 - contrib/libg++/libg++/src/bool.h | 24 - contrib/libg++/libg++/src/builtin.cc | 4 - contrib/libg++/libg++/src/builtin.h | 125 - contrib/libg++/libg++/src/compare.cc | 4 - contrib/libg++/libg++/src/compare.h | 91 - contrib/libg++/libg++/src/configure.in | 45 - contrib/libg++/libg++/src/depend | 849 - contrib/libg++/libg++/src/dtoa.cc | 335 - contrib/libg++/libg++/src/error.cc | 49 - contrib/libg++/libg++/src/fmtq.cc | 29 - contrib/libg++/libg++/src/gcd.cc | 52 - contrib/libg++/libg++/src/gen/AVLMap.ccP | 614 - contrib/libg++/libg++/src/gen/AVLMap.hP | 141 - contrib/libg++/libg++/src/gen/AVLSet.ccP | 892 - contrib/libg++/libg++/src/gen/AVLSet.hP | 152 - contrib/libg++/libg++/src/gen/AVec.ccP | 397 - contrib/libg++/libg++/src/gen/AVec.hP | 118 - contrib/libg++/libg++/src/gen/BSTSet.ccP | 377 - contrib/libg++/libg++/src/gen/BSTSet.hP | 152 - contrib/libg++/libg++/src/gen/Bag.ccP | 74 - contrib/libg++/libg++/src/gen/Bag.hP | 79 - contrib/libg++/libg++/src/gen/CHBag.ccP | 210 - contrib/libg++/libg++/src/gen/CHBag.hP | 76 - contrib/libg++/libg++/src/gen/CHMap.ccP | 168 - contrib/libg++/libg++/src/gen/CHMap.hP | 104 - contrib/libg++/libg++/src/gen/CHNode.ccP | 21 - contrib/libg++/libg++/src/gen/CHNode.hP | 43 - contrib/libg++/libg++/src/gen/CHSet.ccP | 273 - contrib/libg++/libg++/src/gen/CHSet.hP | 84 - contrib/libg++/libg++/src/gen/DLDeque.ccP | 4 - contrib/libg++/libg++/src/gen/DLDeque.hP | 130 - contrib/libg++/libg++/src/gen/DLList.ccP | 339 - contrib/libg++/libg++/src/gen/DLList.hP | 157 - contrib/libg++/libg++/src/gen/Deque.ccP | 11 - contrib/libg++/libg++/src/gen/Deque.hP | 57 - contrib/libg++/libg++/src/gen/FPQueue.ccP | 4 - contrib/libg++/libg++/src/gen/FPQueue.hP | 112 - contrib/libg++/libg++/src/gen/FPStack.ccP | 4 - contrib/libg++/libg++/src/gen/FPStack.hP | 114 - contrib/libg++/libg++/src/gen/FPlex.ccP | 167 - contrib/libg++/libg++/src/gen/FPlex.hP | 253 - contrib/libg++/libg++/src/gen/List.ccP | 972 - contrib/libg++/libg++/src/gen/List.hP | 279 - contrib/libg++/libg++/src/gen/MPlex.ccP | 848 - contrib/libg++/libg++/src/gen/MPlex.hP | 414 - contrib/libg++/libg++/src/gen/Map.ccP | 59 - contrib/libg++/libg++/src/gen/Map.hP | 87 - contrib/libg++/libg++/src/gen/OSLBag.ccP | 196 - contrib/libg++/libg++/src/gen/OSLBag.hP | 91 - contrib/libg++/libg++/src/gen/OSLSet.ccP | 321 - contrib/libg++/libg++/src/gen/OSLSet.hP | 101 - contrib/libg++/libg++/src/gen/OXPBag.ccP | 221 - contrib/libg++/libg++/src/gen/OXPBag.hP | 73 - contrib/libg++/libg++/src/gen/OXPSet.ccP | 280 - contrib/libg++/libg++/src/gen/OXPSet.hP | 102 - contrib/libg++/libg++/src/gen/PHPQ.ccP | 339 - contrib/libg++/libg++/src/gen/PHPQ.hP | 108 - contrib/libg++/libg++/src/gen/PQ.ccP | 63 - contrib/libg++/libg++/src/gen/PQ.hP | 78 - contrib/libg++/libg++/src/gen/PSList.hP | 32 - contrib/libg++/libg++/src/gen/PVec.hP | 79 - contrib/libg++/libg++/src/gen/Plex.ccP | 222 - contrib/libg++/libg++/src/gen/Plex.hP | 494 - contrib/libg++/libg++/src/gen/Queue.ccP | 14 - contrib/libg++/libg++/src/gen/Queue.hP | 51 - contrib/libg++/libg++/src/gen/RAVLMap.ccP | 690 - contrib/libg++/libg++/src/gen/RAVLMap.hP | 147 - contrib/libg++/libg++/src/gen/RPlex.ccP | 477 - contrib/libg++/libg++/src/gen/RPlex.hP | 257 - contrib/libg++/libg++/src/gen/SLBag.ccP | 105 - contrib/libg++/libg++/src/gen/SLBag.hP | 96 - contrib/libg++/libg++/src/gen/SLList.ccP | 292 - contrib/libg++/libg++/src/gen/SLList.hP | 137 - contrib/libg++/libg++/src/gen/SLQueue.ccP | 4 - contrib/libg++/libg++/src/gen/SLQueue.hP | 108 - contrib/libg++/libg++/src/gen/SLSet.ccP | 77 - contrib/libg++/libg++/src/gen/SLSet.hP | 87 - contrib/libg++/libg++/src/gen/SLStack.ccP | 4 - contrib/libg++/libg++/src/gen/SLStack.hP | 109 - contrib/libg++/libg++/src/gen/Set.ccP | 117 - contrib/libg++/libg++/src/gen/Set.hP | 78 - contrib/libg++/libg++/src/gen/SkipBag.ccP | 322 - contrib/libg++/libg++/src/gen/SkipBag.hP | 171 - contrib/libg++/libg++/src/gen/SkipMap.ccP | 307 - contrib/libg++/libg++/src/gen/SkipMap.hP | 176 - contrib/libg++/libg++/src/gen/SkipSet.ccP | 395 - contrib/libg++/libg++/src/gen/SkipSet.hP | 187 - contrib/libg++/libg++/src/gen/SplayBag.ccP | 445 - contrib/libg++/libg++/src/gen/SplayBag.hP | 126 - contrib/libg++/libg++/src/gen/SplayMap.ccP | 401 - contrib/libg++/libg++/src/gen/SplayMap.hP | 154 - contrib/libg++/libg++/src/gen/SplayNode.ccP | 21 - contrib/libg++/libg++/src/gen/SplayNode.hP | 44 - contrib/libg++/libg++/src/gen/SplayPQ.ccP | 523 - contrib/libg++/libg++/src/gen/SplayPQ.hP | 123 - contrib/libg++/libg++/src/gen/SplaySet.ccP | 499 - contrib/libg++/libg++/src/gen/SplaySet.hP | 145 - contrib/libg++/libg++/src/gen/Stack.ccP | 11 - contrib/libg++/libg++/src/gen/Stack.hP | 51 - contrib/libg++/libg++/src/gen/VHBag.ccP | 264 - contrib/libg++/libg++/src/gen/VHBag.hP | 84 - contrib/libg++/libg++/src/gen/VHMap.ccP | 210 - contrib/libg++/libg++/src/gen/VHMap.hP | 84 - contrib/libg++/libg++/src/gen/VHSet.ccP | 263 - contrib/libg++/libg++/src/gen/VHSet.hP | 96 - contrib/libg++/libg++/src/gen/VOHSet.ccP | 305 - contrib/libg++/libg++/src/gen/VOHSet.hP | 88 - contrib/libg++/libg++/src/gen/VQueue.ccP | 83 - contrib/libg++/libg++/src/gen/VQueue.hP | 130 - contrib/libg++/libg++/src/gen/VStack.ccP | 66 - contrib/libg++/libg++/src/gen/VStack.hP | 120 - contrib/libg++/libg++/src/gen/Vec.ccP | 478 - contrib/libg++/libg++/src/gen/Vec.hP | 135 - contrib/libg++/libg++/src/gen/XPBag.ccP | 72 - contrib/libg++/libg++/src/gen/XPBag.hP | 98 - contrib/libg++/libg++/src/gen/XPDeque.ccP | 4 - contrib/libg++/libg++/src/gen/XPDeque.hP | 133 - contrib/libg++/libg++/src/gen/XPPQ.ccP | 143 - contrib/libg++/libg++/src/gen/XPPQ.hP | 105 - contrib/libg++/libg++/src/gen/XPQueue.ccP | 4 - contrib/libg++/libg++/src/gen/XPQueue.hP | 114 - contrib/libg++/libg++/src/gen/XPSet.ccP | 63 - contrib/libg++/libg++/src/gen/XPSet.hP | 89 - contrib/libg++/libg++/src/gen/XPStack.ccP | 4 - contrib/libg++/libg++/src/gen/XPStack.hP | 115 - contrib/libg++/libg++/src/gen/XPlex.ccP | 397 - contrib/libg++/libg++/src/gen/XPlex.hP | 238 - contrib/libg++/libg++/src/gen/defs.hP | 57 - contrib/libg++/libg++/src/gen/intSList.hP | 33 - contrib/libg++/libg++/src/gen/intVec.hP | 80 - contrib/libg++/libg++/src/generic.h | 54 - contrib/libg++/libg++/src/getpagesize.h | 27 - contrib/libg++/libg++/src/hash.cc | 56 - contrib/libg++/libg++/src/ioob.cc | 32 - contrib/libg++/libg++/src/lg.cc | 32 - contrib/libg++/libg++/src/libc.h | 1 - contrib/libg++/libg++/src/malloc.c | 2690 -- contrib/libg++/libg++/src/minmax.cc | 5 - contrib/libg++/libg++/src/minmax.h | 65 - contrib/libg++/libg++/src/osfcn.h | 17 - contrib/libg++/libg++/src/pow.cc | 70 - contrib/libg++/libg++/src/sqrt.cc | 43 - contrib/libg++/libg++/src/std.h | 35 - contrib/libg++/libg++/src/strclass.h | 5 - contrib/libg++/libg++/src/swap.h | 3 - contrib/libg++/libg++/src/sysent.h | 2 - contrib/libg++/libg++/src/timer.c | 165 - contrib/libg++/libg++/src/typemacros.h | 8 - contrib/libg++/libg++/test-install/ChangeLog | 74 - contrib/libg++/libg++/test-install/Foo.cc | 89 - contrib/libg++/libg++/test-install/Foo.h | 24 - contrib/libg++/libg++/test-install/Makefile.in | 170 - contrib/libg++/libg++/test-install/a.cc | 10 - contrib/libg++/libg++/test-install/bf.cc | 18 - contrib/libg++/libg++/test-install/bm.cc | 14 - contrib/libg++/libg++/test-install/configure.in | 25 - contrib/libg++/libg++/test-install/ex_bar.cc | 123 - contrib/libg++/libg++/test-install/expected.out | 15 - contrib/libg++/libg++/test-install/foo_func.cc | 17 - contrib/libg++/libg++/test-install/foo_main.cc | 40 - contrib/libg++/libg++/tests/ChangeLog | 346 - contrib/libg++/libg++/tests/Makefile.in | 22 - contrib/libg++/libg++/tests/Makefile.sh | 174 - contrib/libg++/libg++/tests/configure.in | 27 - contrib/libg++/libg++/tests/depend | 161 - contrib/libg++/libg++/tests/tBag.cc | 540 - contrib/libg++/libg++/tests/tBag.exp | 35 - contrib/libg++/libg++/tests/tBag.inp | 0 contrib/libg++/libg++/tests/tBitSet.cc | 220 - contrib/libg++/libg++/tests/tBitSet.exp | 49 - contrib/libg++/libg++/tests/tBitSet.inp | 0 contrib/libg++/libg++/tests/tBitString.cc | 327 - contrib/libg++/libg++/tests/tBitString.exp | 79 - contrib/libg++/libg++/tests/tBitString.inp | 0 contrib/libg++/libg++/tests/tCurses.cc | 80 - contrib/libg++/libg++/tests/tCurses.inp | 2 - contrib/libg++/libg++/tests/tDeque.cc | 168 - contrib/libg++/libg++/tests/tDeque.exp | 6 - contrib/libg++/libg++/tests/tDeque.inp | 0 contrib/libg++/libg++/tests/tFile.cc | 371 - contrib/libg++/libg++/tests/tFile.exp | 49 - contrib/libg++/libg++/tests/tFile.inp | 4 - contrib/libg++/libg++/tests/tFix.cc | 101 - contrib/libg++/libg++/tests/tFix.exp | 70 - contrib/libg++/libg++/tests/tFix.inp | 0 contrib/libg++/libg++/tests/tFix16.cc | 110 - contrib/libg++/libg++/tests/tFix16.exp | 64 - contrib/libg++/libg++/tests/tFix16.inp | 0 contrib/libg++/libg++/tests/tFix24.cc | 113 - contrib/libg++/libg++/tests/tFix24.exp | 61 - contrib/libg++/libg++/tests/tFix24.inp | 0 contrib/libg++/libg++/tests/tGetOpt.cc | 65 - contrib/libg++/libg++/tests/tGetOpt.exp | 11 - contrib/libg++/libg++/tests/tGetOpt.inp | 0 contrib/libg++/libg++/tests/tInteger.cc | 437 - contrib/libg++/libg++/tests/tInteger.exp | 48 - contrib/libg++/libg++/tests/tInteger.inp | 3 - contrib/libg++/libg++/tests/tLList.cc | 236 - contrib/libg++/libg++/tests/tLList.exp | 49 - contrib/libg++/libg++/tests/tLList.inp | 0 contrib/libg++/libg++/tests/tList.cc | 129 - contrib/libg++/libg++/tests/tList.exp | 39 - contrib/libg++/libg++/tests/tList.inp | 0 contrib/libg++/libg++/tests/tMap.cc | 339 - contrib/libg++/libg++/tests/tMap.exp | 25 - contrib/libg++/libg++/tests/tMap.inp | 0 contrib/libg++/libg++/tests/tObstack.cc | 80 - contrib/libg++/libg++/tests/tObstack.exp | 32 - contrib/libg++/libg++/tests/tObstack.inp | 5 - contrib/libg++/libg++/tests/tPQ.cc | 275 - contrib/libg++/libg++/tests/tPQ.exp | 15 - contrib/libg++/libg++/tests/tPQ.inp | 0 contrib/libg++/libg++/tests/tPlex.cc | 719 - contrib/libg++/libg++/tests/tPlex.exp | 10 - contrib/libg++/libg++/tests/tPlex.inp | 0 contrib/libg++/libg++/tests/tQueue.cc | 209 - contrib/libg++/libg++/tests/tQueue.exp | 15 - contrib/libg++/libg++/tests/tQueue.inp | 0 contrib/libg++/libg++/tests/tRandom.cc | 103 - contrib/libg++/libg++/tests/tRandom.exp | 85 - contrib/libg++/libg++/tests/tRandom.inp | 0 contrib/libg++/libg++/tests/tRational.cc | 194 - contrib/libg++/libg++/tests/tRational.exp | 41 - contrib/libg++/libg++/tests/tRational.inp | 1 - contrib/libg++/libg++/tests/tSet.cc | 744 - contrib/libg++/libg++/tests/tSet.exp | 50 - contrib/libg++/libg++/tests/tSet.inp | 0 contrib/libg++/libg++/tests/tStack.cc | 188 - contrib/libg++/libg++/tests/tStack.exp | 8 - contrib/libg++/libg++/tests/tStack.inp | 0 contrib/libg++/libg++/tests/tString.cc | 416 - contrib/libg++/libg++/tests/tString.exp | 50 - contrib/libg++/libg++/tests/tString.inp | 1 - contrib/libg++/libg++/tests/tVec.cc | 96 - contrib/libg++/libg++/tests/tVec.exp | 33 - contrib/libg++/libg++/tests/tVec.inp | 0 contrib/libg++/libg++/tests/test_h.cc | 102 - contrib/libg++/libg++/tests/tiLList.cc | 271 - contrib/libg++/libg++/tests/tiLList.exp | 54 - contrib/libg++/libiberty/ChangeLog | 1872 -- contrib/libg++/libiberty/insque.c | 50 - contrib/libg++/libiberty/strerror.c | 829 - contrib/libg++/libio/ChangeLog | 1799 -- contrib/libg++/libio/Makefile.in | 124 - contrib/libg++/libio/NEWS | 51 - contrib/libg++/libio/PlotFile.cc | 157 - contrib/libg++/libio/PlotFile.h | 89 - contrib/libg++/libio/README | 30 - contrib/libg++/libio/SFile.cc | 82 - contrib/libg++/libio/SFile.h | 55 - contrib/libg++/libio/builtinbuf.cc | 78 - contrib/libg++/libio/builtinbuf.h | 68 - contrib/libg++/libio/cleanup.c | 17 - contrib/libg++/libio/depend | 327 - contrib/libg++/libio/editbuf.cc | 717 - contrib/libg++/libio/editbuf.h | 185 - contrib/libg++/libio/filebuf.cc | 206 - contrib/libg++/libio/filedoalloc.c | 102 - contrib/libg++/libio/fileops.c | 755 - contrib/libg++/libio/floatconv.c | 2350 -- contrib/libg++/libio/floatio.h | 51 - contrib/libg++/libio/fstream.cc | 110 - contrib/libg++/libio/fstream.h | 92 - contrib/libg++/libio/gen-params | 692 - contrib/libg++/libio/genops.c | 852 - contrib/libg++/libio/indstream.cc | 121 - contrib/libg++/libio/indstream.h | 77 - contrib/libg++/libio/ioassign.cc | 49 - contrib/libg++/libio/ioextend.cc | 132 - contrib/libg++/libio/iofclose.c | 47 - contrib/libg++/libio/iofdopen.c | 121 - contrib/libg++/libio/iofflush.c | 38 - contrib/libg++/libio/iofgetpos.c | 46 - contrib/libg++/libio/iofgets.c | 40 - contrib/libg++/libio/iofopen.c | 49 - contrib/libg++/libio/iofprintf.c | 48 - contrib/libg++/libio/iofputs.c | 37 - contrib/libg++/libio/iofread.c | 38 - contrib/libg++/libio/iofscanf.c | 48 - contrib/libg++/libio/iofsetpos.c | 43 - contrib/libg++/libio/ioftell.c | 45 - contrib/libg++/libio/iofwrite.c | 44 - contrib/libg++/libio/iogetdelim.c | 99 - contrib/libg++/libio/iogetline.c | 74 - contrib/libg++/libio/iogets.c | 47 - contrib/libg++/libio/ioignore.c | 46 - contrib/libg++/libio/iolibio.h | 53 - contrib/libg++/libio/iomanip.cc | 90 - contrib/libg++/libio/iomanip.h | 165 - contrib/libg++/libio/iopadn.c | 65 - contrib/libg++/libio/ioperror.c | 22 - contrib/libg++/libio/iopopen.c | 222 - contrib/libg++/libio/ioprims.c | 72 - contrib/libg++/libio/ioprintf.c | 47 - contrib/libg++/libio/ioputs.c | 38 - contrib/libg++/libio/ioscanf.c | 47 - contrib/libg++/libio/ioseekoff.c | 43 - contrib/libg++/libio/ioseekpos.c | 39 - contrib/libg++/libio/iosetbuffer.c | 36 - contrib/libg++/libio/iosetvbuf.c | 78 - contrib/libg++/libio/iosprintf.c | 47 - contrib/libg++/libio/iosscanf.c | 47 - contrib/libg++/libio/iostdio.h | 114 - contrib/libg++/libio/iostream.cc | 821 - contrib/libg++/libio/iostream.h | 254 - contrib/libg++/libio/iostream.texi | 1971 -- contrib/libg++/libio/iostreamP.h | 26 - contrib/libg++/libio/iostrerror.c | 12 - contrib/libg++/libio/ioungetc.c | 35 - contrib/libg++/libio/iovfprintf.c | 881 - contrib/libg++/libio/iovfscanf.c | 787 - contrib/libg++/libio/iovsprintf.c | 40 - contrib/libg++/libio/iovsscanf.c | 37 - contrib/libg++/libio/isgetline.cc | 139 - contrib/libg++/libio/isgetsb.cc | 59 - contrib/libg++/libio/isscan.cc | 45 - contrib/libg++/libio/istream.h | 25 - contrib/libg++/libio/libio.h | 255 - contrib/libg++/libio/libioP.h | 494 - contrib/libg++/libio/osform.cc | 54 - contrib/libg++/libio/ostream.h | 25 - contrib/libg++/libio/outfloat.c | 204 - contrib/libg++/libio/parsestream.cc | 317 - contrib/libg++/libio/parsestream.h | 156 - contrib/libg++/libio/pfstream.cc | 92 - contrib/libg++/libio/pfstream.h | 59 - contrib/libg++/libio/procbuf.cc | 55 - contrib/libg++/libio/procbuf.h | 50 - contrib/libg++/libio/sbform.cc | 40 - contrib/libg++/libio/sbgetline.cc | 31 - contrib/libg++/libio/sbscan.cc | 45 - contrib/libg++/libio/stdfiles.c | 44 - contrib/libg++/libio/stdiostream.cc | 159 - contrib/libg++/libio/stdiostream.h | 79 - contrib/libg++/libio/stdstrbufs.cc | 115 - contrib/libg++/libio/stdstreams.cc | 153 - contrib/libg++/libio/stream.cc | 170 - contrib/libg++/libio/stream.h | 59 - contrib/libg++/libio/streambuf.cc | 343 - contrib/libg++/libio/streambuf.h | 475 - contrib/libg++/libio/strfile.h | 52 - contrib/libg++/libio/strops.c | 290 - contrib/libg++/libio/strstream.cc | 116 - contrib/libg++/libio/strstream.h | 113 - contrib/libg++/libio/tests/ChangeLog | 111 - contrib/libg++/libio/tests/Makefile.in | 195 - contrib/libg++/libio/tests/configure.in | 21 - contrib/libg++/libio/tests/hounddog.cc | 85 - contrib/libg++/libio/tests/hounddog.exp | 7 - contrib/libg++/libio/tests/hounddog.inp | 7 - contrib/libg++/libio/tests/putbackdog.cc | 97 - contrib/libg++/libio/tests/tFile.cc | 550 - contrib/libg++/libio/tests/tFile.exp | 75 - contrib/libg++/libio/tests/tFile.inp | 5 - contrib/libg++/libio/tests/tfformat.c | 4145 --- contrib/libg++/libio/tests/tiformat.c | 5093 ---- contrib/libg++/libio/tests/tiomanip.cc | 35 - contrib/libg++/libio/tests/tiomanip.exp | 4 - contrib/libg++/libio/tests/tiomisc.cc | 236 - contrib/libg++/libio/tests/tiomisc.exp | 11 - contrib/libg++/libio/tests/tstdiomisc.c | 43 - contrib/libg++/libio/tests/tstdiomisc.exp | 8 - contrib/libg++/librx/ChangeLog | 302 - contrib/libg++/librx/DOC | 179 - contrib/libg++/librx/rx.c | 7193 ------ contrib/libg++/librx/rx.h | 3732 --- contrib/libg++/libstdc++/ChangeLog | 620 - contrib/libg++/libstdc++/Makefile.in | 310 - contrib/libg++/libstdc++/algorithm | 7 - contrib/libg++/libstdc++/cassert | 6 - contrib/libg++/libstdc++/cctype | 6 - contrib/libg++/libstdc++/cerrno | 6 - contrib/libg++/libstdc++/cfloat | 6 - contrib/libg++/libstdc++/cinst.cc | 151 - contrib/libg++/libstdc++/ciso646 | 6 - contrib/libg++/libstdc++/climits | 6 - contrib/libg++/libstdc++/clocale | 6 - contrib/libg++/libstdc++/cmath | 6 - contrib/libg++/libstdc++/cmathi.cc | 7 - contrib/libg++/libstdc++/complex | 6 - contrib/libg++/libstdc++/complex.h | 6 - contrib/libg++/libstdc++/csetjmp | 6 - contrib/libg++/libstdc++/csignal | 6 - contrib/libg++/libstdc++/cstdarg | 6 - contrib/libg++/libstdc++/cstddef | 6 - contrib/libg++/libstdc++/cstdio | 6 - contrib/libg++/libstdc++/cstdlib | 6 - contrib/libg++/libstdc++/cstdlibi.cc | 7 - contrib/libg++/libstdc++/cstring | 6 - contrib/libg++/libstdc++/cstringi.cc | 7 - contrib/libg++/libstdc++/ctime | 6 - contrib/libg++/libstdc++/cwchar | 6 - contrib/libg++/libstdc++/cwctype | 6 - contrib/libg++/libstdc++/deque | 7 - contrib/libg++/libstdc++/exception | 6 - contrib/libg++/libstdc++/exceptioni.cc | 78 - contrib/libg++/libstdc++/functional | 7 - contrib/libg++/libstdc++/iterator | 7 - contrib/libg++/libstdc++/list | 7 - contrib/libg++/libstdc++/map | 7 - contrib/libg++/libstdc++/memory | 7 - contrib/libg++/libstdc++/new | 6 - contrib/libg++/libstdc++/new.h | 7 - contrib/libg++/libstdc++/newi.cc | 7 - contrib/libg++/libstdc++/numeric | 7 - contrib/libg++/libstdc++/queue | 7 - contrib/libg++/libstdc++/set | 7 - contrib/libg++/libstdc++/sinst.cc | 147 - contrib/libg++/libstdc++/stack | 7 - contrib/libg++/libstdc++/std/bastring.cc | 489 - contrib/libg++/libstdc++/std/bastring.h | 574 - contrib/libg++/libstdc++/std/cassert.h | 7 - contrib/libg++/libstdc++/std/cctype.h | 7 - contrib/libg++/libstdc++/std/cerrno.h | 7 - contrib/libg++/libstdc++/std/cfloat.h | 7 - contrib/libg++/libstdc++/std/cinst.h | 112 - contrib/libg++/libstdc++/std/ciso646.h | 7 - contrib/libg++/libstdc++/std/climits.h | 7 - contrib/libg++/libstdc++/std/clocale.h | 7 - contrib/libg++/libstdc++/std/cmath.h | 76 - contrib/libg++/libstdc++/std/complex.h | 18 - contrib/libg++/libstdc++/std/complext.cc | 273 - contrib/libg++/libstdc++/std/complext.h | 317 - contrib/libg++/libstdc++/std/csetjmp.h | 8 - contrib/libg++/libstdc++/std/csignal.h | 7 - contrib/libg++/libstdc++/std/cstdarg.h | 7 - contrib/libg++/libstdc++/std/cstddef.h | 7 - contrib/libg++/libstdc++/std/cstdio.h | 7 - contrib/libg++/libstdc++/std/cstdlib.h | 23 - contrib/libg++/libstdc++/std/cstring.h | 71 - contrib/libg++/libstdc++/std/ctime.h | 7 - contrib/libg++/libstdc++/std/cwchar.h | 7 - contrib/libg++/libstdc++/std/cwctype.h | 7 - contrib/libg++/libstdc++/std/dcomplex.h | 89 - contrib/libg++/libstdc++/std/exception.h | 39 - contrib/libg++/libstdc++/std/fcomplex.h | 85 - contrib/libg++/libstdc++/std/ldcomplex.h | 93 - contrib/libg++/libstdc++/std/new.h | 34 - contrib/libg++/libstdc++/std/sinst.h | 73 - contrib/libg++/libstdc++/std/stddef.h | 25 - contrib/libg++/libstdc++/std/stdexcept.h | 126 - contrib/libg++/libstdc++/std/straits.h | 161 - contrib/libg++/libstdc++/std/string.h | 13 - contrib/libg++/libstdc++/std/typeinfo.h | 245 - contrib/libg++/libstdc++/stddef | 6 - contrib/libg++/libstdc++/stddefi.cc | 7 - contrib/libg++/libstdc++/stdexcept | 6 - contrib/libg++/libstdc++/stdexcepti.cc | 8 - contrib/libg++/libstdc++/stl.h | 15 - contrib/libg++/libstdc++/stl/ChangeLog | 86 - contrib/libg++/libstdc++/stl/Makefile.in | 12 - contrib/libg++/libstdc++/stl/README | 86 - contrib/libg++/libstdc++/stl/algo.h | 2386 -- contrib/libg++/libstdc++/stl/algobase.h | 232 - contrib/libg++/libstdc++/stl/bool.h | 20 - contrib/libg++/libstdc++/stl/bvector.h | 421 - contrib/libg++/libstdc++/stl/configure.in | 37 - contrib/libg++/libstdc++/stl/defalloc.h | 176 - contrib/libg++/libstdc++/stl/deque.h | 684 - contrib/libg++/libstdc++/stl/faralloc.h | 120 - contrib/libg++/libstdc++/stl/fdeque.h | 39 - contrib/libg++/libstdc++/stl/flist.h | 39 - contrib/libg++/libstdc++/stl/fmap.h | 44 - contrib/libg++/libstdc++/stl/fmultmap.h | 44 - contrib/libg++/libstdc++/stl/fmultset.h | 44 - contrib/libg++/libstdc++/stl/fset.h | 44 - contrib/libg++/libstdc++/stl/function.h | 282 - contrib/libg++/libstdc++/stl/hdeque.h | 39 - contrib/libg++/libstdc++/stl/heap.h | 193 - contrib/libg++/libstdc++/stl/hlist.h | 39 - contrib/libg++/libstdc++/stl/hmap.h | 44 - contrib/libg++/libstdc++/stl/hmultmap.h | 44 - contrib/libg++/libstdc++/stl/hmultset.h | 44 - contrib/libg++/libstdc++/stl/hset.h | 44 - contrib/libg++/libstdc++/stl/hugalloc.h | 38 - contrib/libg++/libstdc++/stl/hvector.h | 39 - contrib/libg++/libstdc++/stl/iterator.h | 395 - contrib/libg++/libstdc++/stl/lbvector.h | 39 - contrib/libg++/libstdc++/stl/ldeque.h | 39 - contrib/libg++/libstdc++/stl/list.h | 531 - contrib/libg++/libstdc++/stl/llist.h | 39 - contrib/libg++/libstdc++/stl/lmap.h | 44 - contrib/libg++/libstdc++/stl/lmultmap.h | 44 - contrib/libg++/libstdc++/stl/lmultset.h | 44 - contrib/libg++/libstdc++/stl/lngalloc.h | 54 - contrib/libg++/libstdc++/stl/lset.h | 44 - contrib/libg++/libstdc++/stl/map.h | 150 - contrib/libg++/libstdc++/stl/multimap.h | 142 - contrib/libg++/libstdc++/stl/multiset.h | 129 - contrib/libg++/libstdc++/stl/neralloc.h | 38 - contrib/libg++/libstdc++/stl/nmap.h | 44 - contrib/libg++/libstdc++/stl/nmultmap.h | 44 - contrib/libg++/libstdc++/stl/nmultset.h | 44 - contrib/libg++/libstdc++/stl/nset.h | 44 - contrib/libg++/libstdc++/stl/pair.h | 46 - contrib/libg++/libstdc++/stl/projectn.h | 33 - contrib/libg++/libstdc++/stl/random.cc | 60 - contrib/libg++/libstdc++/stl/set.h | 132 - contrib/libg++/libstdc++/stl/stack.h | 120 - contrib/libg++/libstdc++/stl/tempbuf.cc | 18 - contrib/libg++/libstdc++/stl/tempbuf.h | 55 - contrib/libg++/libstdc++/stl/tree.cc | 3 - contrib/libg++/libstdc++/stl/tree.h | 1246 - contrib/libg++/libstdc++/stl/vector.h | 355 - contrib/libg++/libstdc++/string | 6 - contrib/libg++/libstdc++/tests/ChangeLog | 52 - contrib/libg++/libstdc++/tests/Makefile.in | 35 - contrib/libg++/libstdc++/tests/configure.in | 49 - contrib/libg++/libstdc++/tests/tcomplex.cc | 143 - contrib/libg++/libstdc++/tests/tcomplex.exp | 37 - contrib/libg++/libstdc++/tests/tcomplex.inp | 1 - contrib/libg++/libstdc++/tests/tlist.cc | 162 - contrib/libg++/libstdc++/tests/tlist.exp | 44 - contrib/libg++/libstdc++/tests/tmap.cc | 66 - contrib/libg++/libstdc++/tests/tmap.exp | 7 - contrib/libg++/libstdc++/tests/tstring.cc | 189 - contrib/libg++/libstdc++/tests/tstring.exp | 20 - contrib/libg++/libstdc++/tests/tstring.inp | 1 - contrib/libg++/libstdc++/tests/tvector.cc | 20 - contrib/libg++/libstdc++/tests/tvector.exp | 4 - contrib/libg++/libstdc++/typeinfo | 6 - contrib/libg++/libstdc++/typeinfoi.cc | 131 - contrib/libg++/libstdc++/utility | 8 - contrib/libg++/libstdc++/vector | 7 - contrib/libio/ChangeLog | 2775 -- contrib/libio/Makefile.in | 137 - contrib/libio/NEWS | 57 - contrib/libio/PlotFile.cc | 157 - contrib/libio/PlotFile.h | 89 - contrib/libio/README | 30 - contrib/libio/SFile.cc | 82 - contrib/libio/SFile.h | 55 - contrib/libio/builtinbuf.cc | 78 - contrib/libio/builtinbuf.h | 68 - contrib/libio/cleanup.c | 17 - contrib/libio/config.shared | 499 - contrib/libio/config/hpux.mt | 3 - contrib/libio/config/isc.mt | 4 - contrib/libio/config/linux.mt | 25 - contrib/libio/config/linuxaxp1-libc-lock.h | 112 - contrib/libio/config/linuxaxp1-stdio-lock.h | 36 - contrib/libio/config/linuxaxp1.mt | 10 - contrib/libio/config/linuxlibc1.mt | 26 - contrib/libio/config/mn10200.mt | 3 - contrib/libio/config/mtsafe.mt | 2 - contrib/libio/config/netware.mt | 16 - contrib/libio/config/sco4.mt | 3 - contrib/libio/configure.in | 199 - contrib/libio/dbz/Makefile.in | 218 - contrib/libio/dbz/README | 25 - contrib/libio/dbz/altbytes | 7 - contrib/libio/dbz/byteflip.c | 38 - contrib/libio/dbz/case.c | 129 - contrib/libio/dbz/case.h | 12 - contrib/libio/dbz/configure.in | 17 - contrib/libio/dbz/dbz.1 | 221 - contrib/libio/dbz/dbz.3z | 547 - contrib/libio/dbz/dbz.c | 1768 -- contrib/libio/dbz/dbz.h | 32 - contrib/libio/dbz/dbzmain.c | 519 - contrib/libio/dbz/fake.c | 144 - contrib/libio/dbz/firstlast25 | 50 - contrib/libio/dbz/getmap | 6 - contrib/libio/dbz/random.c | 31 - contrib/libio/dbz/revbytes | 7 - contrib/libio/dbz/stdio.h | 1 - contrib/libio/depend | 379 - contrib/libio/editbuf.cc | 717 - contrib/libio/editbuf.h | 185 - contrib/libio/filebuf.cc | 223 - contrib/libio/filedoalloc.c | 107 - contrib/libio/fileops.c | 811 - contrib/libio/floatconv.c | 2375 -- contrib/libio/floatio.h | 51 - contrib/libio/fstream.cc | 110 - contrib/libio/fstream.h | 92 - contrib/libio/gen-params | 739 - contrib/libio/genops.c | 946 - contrib/libio/include/empty.h | 37 - contrib/libio/indstream.cc | 121 - contrib/libio/indstream.h | 77 - contrib/libio/ioassign.cc | 49 - contrib/libio/ioextend.cc | 132 - contrib/libio/iofclose.c | 60 - contrib/libio/iofdopen.c | 134 - contrib/libio/iofeof.c | 45 - contrib/libio/ioferror.c | 45 - contrib/libio/iofflush.c | 49 - contrib/libio/iofflush_u.c | 40 - contrib/libio/iofgetpos.c | 55 - contrib/libio/iofgets.c | 56 - contrib/libio/iofopen.c | 64 - contrib/libio/iofprintf.c | 51 - contrib/libio/iofputs.c | 49 - contrib/libio/iofread.c | 49 - contrib/libio/iofscanf.c | 48 - contrib/libio/iofsetpos.c | 56 - contrib/libio/ioftell.c | 53 - contrib/libio/iofwrite.c | 54 - contrib/libio/iogetc.c | 50 - contrib/libio/iogetdelim.c | 125 - contrib/libio/iogetline.c | 112 - contrib/libio/iogets.c | 71 - contrib/libio/ioignore.c | 47 - contrib/libio/iolibio.h | 63 - contrib/libio/iomanip.cc | 90 - contrib/libio/iomanip.h | 180 - contrib/libio/iopadn.c | 70 - contrib/libio/ioperror.c | 22 - contrib/libio/iopopen.c | 248 - contrib/libio/ioprims.c | 80 - contrib/libio/ioprintf.c | 47 - contrib/libio/ioputc.c | 44 - contrib/libio/ioputs.c | 49 - contrib/libio/ioscanf.c | 47 - contrib/libio/ioseekoff.c | 54 - contrib/libio/ioseekpos.c | 48 - contrib/libio/iosetbuffer.c | 46 - contrib/libio/iosetvbuf.c | 100 - contrib/libio/iosprintf.c | 50 - contrib/libio/iosscanf.c | 47 - contrib/libio/iostdio.h | 114 - contrib/libio/iostream.cc | 1041 - contrib/libio/iostream.h | 273 - contrib/libio/iostream.texi | 1971 -- contrib/libio/iostreamP.h | 26 - contrib/libio/iostrerror.c | 12 - contrib/libio/ioungetc.c | 46 - contrib/libio/iovfprintf.c | 890 - contrib/libio/iovfscanf.c | 790 - contrib/libio/iovsprintf.c | 60 - contrib/libio/iovsscanf.c | 59 - contrib/libio/isgetline.cc | 153 - contrib/libio/isgetsb.cc | 63 - contrib/libio/isscan.cc | 55 - contrib/libio/istream.h | 25 - contrib/libio/libio.h | 364 - contrib/libio/libioP.h | 648 - contrib/libio/osform.cc | 66 - contrib/libio/ostream.h | 25 - contrib/libio/outfloat.c | 211 - contrib/libio/parsestream.cc | 317 - contrib/libio/parsestream.h | 156 - contrib/libio/peekc.c | 42 - contrib/libio/pfstream.cc | 92 - contrib/libio/pfstream.h | 59 - contrib/libio/procbuf.cc | 54 - contrib/libio/procbuf.h | 50 - contrib/libio/sbform.cc | 40 - contrib/libio/sbgetline.cc | 31 - contrib/libio/sbscan.cc | 45 - contrib/libio/stdfiles.c | 51 - contrib/libio/stdio/ChangeLog | 149 - contrib/libio/stdio/Makefile.in | 35 - contrib/libio/stdio/clearerr.c | 30 - contrib/libio/stdio/clearerr_u.c | 28 - contrib/libio/stdio/configure.in | 49 - contrib/libio/stdio/fdopen.c | 9 - contrib/libio/stdio/feof.c | 43 - contrib/libio/stdio/feof_u.c | 37 - contrib/libio/stdio/ferror.c | 43 - contrib/libio/stdio/ferror_u.c | 37 - contrib/libio/stdio/fgetc.c | 40 - contrib/libio/stdio/fileno.c | 49 - contrib/libio/stdio/fputc.c | 41 - contrib/libio/stdio/fputc_u.c | 38 - contrib/libio/stdio/freopen.c | 44 - contrib/libio/stdio/fseek.c | 42 - contrib/libio/stdio/getc.c | 48 - contrib/libio/stdio/getc_u.c | 37 - contrib/libio/stdio/getchar.c | 40 - contrib/libio/stdio/getchar_u.c | 35 - contrib/libio/stdio/getline.c | 13 - contrib/libio/stdio/getw.c | 13 - contrib/libio/stdio/obprintf.c | 168 - contrib/libio/stdio/popen.c | 23 - contrib/libio/stdio/putc.c | 42 - contrib/libio/stdio/putc_u.c | 31 - contrib/libio/stdio/putchar.c | 35 - contrib/libio/stdio/putchar_u.c | 30 - contrib/libio/stdio/putw.c | 15 - contrib/libio/stdio/rewind.c | 38 - contrib/libio/stdio/setbuf.c | 35 - contrib/libio/stdio/setfileno.c | 17 - contrib/libio/stdio/setlinebuf.c | 36 - contrib/libio/stdio/snprintf.c | 51 - contrib/libio/stdio/stdio.h | 219 - contrib/libio/stdio/vasprintf.c | 72 - contrib/libio/stdio/vfprintf.c | 35 - contrib/libio/stdio/vfscanf.c | 36 - contrib/libio/stdio/vprintf.c | 33 - contrib/libio/stdio/vscanf.c | 41 - contrib/libio/stdio/vsnprintf.c | 136 - contrib/libio/stdiostream.cc | 159 - contrib/libio/stdiostream.h | 79 - contrib/libio/stdstrbufs.cc | 126 - contrib/libio/stdstreams.cc | 153 - contrib/libio/stream.cc | 170 - contrib/libio/stream.h | 59 - contrib/libio/streambuf.cc | 364 - contrib/libio/streambuf.h | 490 - contrib/libio/strfile.h | 71 - contrib/libio/strops.c | 303 - contrib/libio/strstream.cc | 116 - contrib/libio/strstream.h | 113 - contrib/libio/tests/ChangeLog | 162 - contrib/libio/tests/Makefile.in | 196 - contrib/libio/tests/configure.in | 36 - contrib/libio/tests/hounddog.cc | 85 - contrib/libio/tests/hounddog.exp | 7 - contrib/libio/tests/hounddog.inp | 7 - contrib/libio/tests/putbackdog.cc | 97 - contrib/libio/tests/tFile.cc | 558 - contrib/libio/tests/tFile.exp | 75 - contrib/libio/tests/tFile.inp | 5 - contrib/libio/tests/tfformat.c | 4181 --- contrib/libio/tests/tiformat.c | 5112 ---- contrib/libio/tests/tiomanip.cc | 35 - contrib/libio/tests/tiomanip.exp | 4 - contrib/libio/tests/tiomisc.cc | 236 - contrib/libio/tests/tiomisc.exp | 11 - contrib/libio/tests/tstdiomisc.c | 43 - contrib/libio/tests/tstdiomisc.exp | 8 - contrib/libio/testsuite/ChangeLog | 95 - contrib/libio/testsuite/Makefile.in | 90 - contrib/libio/testsuite/config/default.exp | 1 - contrib/libio/testsuite/configure.in | 22 - contrib/libio/testsuite/lib/libio.exp | 167 - contrib/libio/testsuite/libio.tests/hounddog.exp | 3 - contrib/libio/testsuite/libio.tests/putbackdog.exp | 3 - contrib/libio/testsuite/libio.tests/tFile.exp | 3 - contrib/libio/testsuite/libio.tests/tfformat.exp | 1 - contrib/libio/testsuite/libio.tests/tiformat.exp | 1 - contrib/libio/testsuite/libio.tests/tiomanip.exp | 1 - contrib/libio/testsuite/libio.tests/tiomisc.exp | 1 - contrib/libio/testsuite/libio.tests/tstdiomisc.exp | 1 - contrib/libobjc/ChangeLog | 165 - contrib/libobjc/Makefile.in | 322 - contrib/libobjc/NXConstStr.m | 42 - contrib/libobjc/Object.m | 387 - contrib/libobjc/Protocol.m | 128 - contrib/libobjc/README | 97 - contrib/libobjc/README.threads | 50 - contrib/libobjc/THREADS | 374 - contrib/libobjc/THREADS.MACH | 23 - contrib/libobjc/archive.c | 1651 -- contrib/libobjc/class.c | 358 - contrib/libobjc/configure | 1459 -- contrib/libobjc/configure.in | 142 - contrib/libobjc/encoding.c | 918 - contrib/libobjc/gc.c | 458 - contrib/libobjc/hash.c | 283 - contrib/libobjc/init.c | 834 - contrib/libobjc/libobjc.def | 161 - contrib/libobjc/libobjc_entry.c | 55 - contrib/libobjc/linking.m | 40 - contrib/libobjc/makefile.dos | 56 - contrib/libobjc/misc.c | 180 - contrib/libobjc/nil_method.c | 40 - contrib/libobjc/objc-features.texi | 392 - contrib/libobjc/objc/NXConstStr.h | 44 - contrib/libobjc/objc/Object.h | 124 - contrib/libobjc/objc/Protocol.h | 58 - contrib/libobjc/objc/encoding.h | 99 - contrib/libobjc/objc/hash.h | 206 - contrib/libobjc/objc/objc-api.h | 597 - contrib/libobjc/objc/objc-list.h | 147 - contrib/libobjc/objc/objc.h | 158 - contrib/libobjc/objc/runtime.h | 88 - contrib/libobjc/objc/sarray.h | 237 - contrib/libobjc/objc/thr.h | 143 - contrib/libobjc/objc/typedstream.h | 132 - contrib/libobjc/objects.c | 105 - contrib/libobjc/sarray.c | 522 - contrib/libobjc/selector.c | 458 - contrib/libobjc/sendmsg.c | 648 - contrib/libobjc/thr-dce.c | 281 - contrib/libobjc/thr-decosf1.c | 281 - contrib/libobjc/thr-irix.c | 235 - contrib/libobjc/thr-mach.c | 312 - contrib/libobjc/thr-os2.c | 267 - contrib/libobjc/thr-posix.c | 229 - contrib/libobjc/thr-pthreads.c | 218 - contrib/libobjc/thr-single.c | 192 - contrib/libobjc/thr-solaris.c | 259 - contrib/libobjc/thr-vxworks.c | 192 - contrib/libobjc/thr-win32.c | 272 - contrib/libobjc/thr.c | 534 - contrib/libstdc++/ChangeLog | 1401 -- contrib/libstdc++/Makefile.in | 385 - contrib/libstdc++/NEWS | 9 - contrib/libstdc++/cassert | 7 - contrib/libstdc++/cctype | 7 - contrib/libstdc++/cerrno | 7 - contrib/libstdc++/cfloat | 7 - contrib/libstdc++/cinst.cc | 154 - contrib/libstdc++/ciso646 | 7 - contrib/libstdc++/climits | 7 - contrib/libstdc++/clocale | 7 - contrib/libstdc++/cmath | 76 - contrib/libstdc++/cmathi.cc | 7 - contrib/libstdc++/complex | 18 - contrib/libstdc++/complex.h | 6 - contrib/libstdc++/config/aix.ml | 9 - contrib/libstdc++/config/dec-osf.ml | 6 - contrib/libstdc++/config/delta.mt | 2 - contrib/libstdc++/config/elf.ml | 8 - contrib/libstdc++/config/elfshlibm.ml | 6 - contrib/libstdc++/config/freebsd.ml | 6 - contrib/libstdc++/config/gnu.ml | 6 - contrib/libstdc++/config/hpux.ml | 6 - contrib/libstdc++/config/irix5.ml | 6 - contrib/libstdc++/config/linux.ml | 11 - contrib/libstdc++/config/linux.mt | 2 - contrib/libstdc++/config/openbsd.ml | 7 - contrib/libstdc++/config/openbsd.mt | 3 - contrib/libstdc++/config/posix.mt | 1 - contrib/libstdc++/config/sol2pth.mt | 1 - contrib/libstdc++/config/sol2shm.ml | 6 - contrib/libstdc++/config/sol2solth.mt | 1 - contrib/libstdc++/config/sunos4.ml | 9 - contrib/libstdc++/config/x86-interix.ml | 9 - contrib/libstdc++/configure.in | 203 - contrib/libstdc++/csetjmp | 8 - contrib/libstdc++/csignal | 7 - contrib/libstdc++/cstdarg | 7 - contrib/libstdc++/cstddef | 7 - contrib/libstdc++/cstdio | 7 - contrib/libstdc++/cstdlib | 23 - contrib/libstdc++/cstdlibi.cc | 7 - contrib/libstdc++/cstring | 96 - contrib/libstdc++/cstringi.cc | 7 - contrib/libstdc++/ctime | 7 - contrib/libstdc++/cwchar | 7 - contrib/libstdc++/cwctype | 7 - contrib/libstdc++/fstream | 7 - contrib/libstdc++/iomanip | 7 - contrib/libstdc++/iosfwd | 15 - contrib/libstdc++/iostream | 7 - contrib/libstdc++/sinst.cc | 135 - contrib/libstdc++/sstream | 225 - contrib/libstdc++/std/bastring.cc | 524 - contrib/libstdc++/std/bastring.h | 657 - contrib/libstdc++/std/complext.cc | 273 - contrib/libstdc++/std/complext.h | 400 - contrib/libstdc++/std/dcomplex.h | 91 - contrib/libstdc++/std/fcomplex.h | 87 - contrib/libstdc++/std/gslice.h | 111 - contrib/libstdc++/std/gslice_array.h | 170 - contrib/libstdc++/std/indirect_array.h | 157 - contrib/libstdc++/std/ldcomplex.h | 95 - contrib/libstdc++/std/mask_array.h | 154 - contrib/libstdc++/std/slice.h | 76 - contrib/libstdc++/std/slice_array.h | 156 - contrib/libstdc++/std/std_valarray.h | 728 - contrib/libstdc++/std/straits.h | 161 - contrib/libstdc++/std/valarray_array.h | 346 - contrib/libstdc++/std/valarray_array.tcc | 130 - contrib/libstdc++/std/valarray_meta.h | 1046 - contrib/libstdc++/stdexcept | 97 - contrib/libstdc++/stdexcepti.cc | 21 - contrib/libstdc++/stl.h | 15 - contrib/libstdc++/stl/ChangeLog | 377 - contrib/libstdc++/stl/README | 13 - contrib/libstdc++/stl/algo.h | 114 - contrib/libstdc++/stl/algobase.h | 71 - contrib/libstdc++/stl/algorithm | 40 - contrib/libstdc++/stl/alloc.h | 46 - contrib/libstdc++/stl/bitset | 1066 - contrib/libstdc++/stl/bvector.h | 51 - contrib/libstdc++/stl/defalloc.h | 87 - contrib/libstdc++/stl/deque | 40 - contrib/libstdc++/stl/deque.h | 42 - contrib/libstdc++/stl/function.h | 118 - contrib/libstdc++/stl/functional | 26 - contrib/libstdc++/stl/hash_map | 40 - contrib/libstdc++/stl/hash_map.h | 49 - contrib/libstdc++/stl/hash_set | 40 - contrib/libstdc++/stl/hash_set.h | 44 - contrib/libstdc++/stl/hashtable.h | 48 - contrib/libstdc++/stl/heap.h | 46 - contrib/libstdc++/stl/iterator | 44 - contrib/libstdc++/stl/iterator.h | 104 - contrib/libstdc++/stl/list | 40 - contrib/libstdc++/stl/list.h | 42 - contrib/libstdc++/stl/map | 40 - contrib/libstdc++/stl/map.h | 41 - contrib/libstdc++/stl/memory | 108 - contrib/libstdc++/stl/multimap.h | 41 - contrib/libstdc++/stl/multiset.h | 41 - contrib/libstdc++/stl/numeric | 42 - contrib/libstdc++/stl/pair.h | 51 - contrib/libstdc++/stl/pthread_alloc | 479 - contrib/libstdc++/stl/pthread_alloc.h | 31 - contrib/libstdc++/stl/queue | 45 - contrib/libstdc++/stl/rope | 32 - contrib/libstdc++/stl/rope.h | 34 - contrib/libstdc++/stl/ropeimpl.h | 1550 -- contrib/libstdc++/stl/set | 40 - contrib/libstdc++/stl/set.h | 41 - contrib/libstdc++/stl/slist | 28 - contrib/libstdc++/stl/slist.h | 30 - contrib/libstdc++/stl/stack | 41 - contrib/libstdc++/stl/stack.h | 46 - contrib/libstdc++/stl/stl_algo.h | 2894 --- contrib/libstdc++/stl/stl_algobase.h | 526 - contrib/libstdc++/stl/stl_alloc.h | 1057 - contrib/libstdc++/stl/stl_bvector.h | 838 - contrib/libstdc++/stl/stl_config.h | 356 - contrib/libstdc++/stl/stl_construct.h | 90 - contrib/libstdc++/stl/stl_deque.h | 1698 -- contrib/libstdc++/stl/stl_function.h | 700 - contrib/libstdc++/stl/stl_hash_fun.h | 93 - contrib/libstdc++/stl/stl_hash_map.h | 416 - contrib/libstdc++/stl/stl_hash_set.h | 401 - contrib/libstdc++/stl/stl_hashtable.h | 1039 - contrib/libstdc++/stl/stl_heap.h | 281 - contrib/libstdc++/stl/stl_iterator.h | 915 - contrib/libstdc++/stl/stl_list.h | 840 - contrib/libstdc++/stl/stl_map.h | 242 - contrib/libstdc++/stl/stl_multimap.h | 232 - contrib/libstdc++/stl/stl_multiset.h | 224 - contrib/libstdc++/stl/stl_numeric.h | 239 - contrib/libstdc++/stl/stl_pair.h | 77 - contrib/libstdc++/stl/stl_queue.h | 202 - contrib/libstdc++/stl/stl_raw_storage_iter.h | 81 - contrib/libstdc++/stl/stl_relops.h | 62 - contrib/libstdc++/stl/stl_rope.h | 2541 -- contrib/libstdc++/stl/stl_set.h | 216 - contrib/libstdc++/stl/stl_slist.h | 945 - contrib/libstdc++/stl/stl_stack.h | 111 - contrib/libstdc++/stl/stl_tempbuf.h | 156 - contrib/libstdc++/stl/stl_tree.h | 1333 - contrib/libstdc++/stl/stl_uninitialized.h | 279 - contrib/libstdc++/stl/stl_vector.h | 823 - contrib/libstdc++/stl/tempbuf.h | 61 - contrib/libstdc++/stl/tree.h | 46 - contrib/libstdc++/stl/type_traits.h | 373 - contrib/libstdc++/stl/utility | 38 - contrib/libstdc++/stl/vector | 41 - contrib/libstdc++/stl/vector.h | 42 - contrib/libstdc++/stlinst.cc | 10 - contrib/libstdc++/string | 13 - contrib/libstdc++/strstream | 7 - contrib/libstdc++/tests/ChangeLog | 128 - contrib/libstdc++/tests/Makefile.in | 35 - contrib/libstdc++/tests/configure.in | 65 - contrib/libstdc++/tests/tcomplex.cc | 151 - contrib/libstdc++/tests/tcomplex.exp | 37 - contrib/libstdc++/tests/tcomplex.inp | 1 - contrib/libstdc++/tests/tlist.cc | 151 - contrib/libstdc++/tests/tlist.exp | 44 - contrib/libstdc++/tests/tmap.cc | 59 - contrib/libstdc++/tests/tmap.exp | 7 - contrib/libstdc++/tests/tstring.cc | 249 - contrib/libstdc++/tests/tstring.exp | 22 - contrib/libstdc++/tests/tstring.inp | 1 - contrib/libstdc++/tests/tvector.cc | 20 - contrib/libstdc++/tests/tvector.exp | 4 - contrib/libstdc++/testsuite/ChangeLog | 90 - contrib/libstdc++/testsuite/Makefile.in | 67 - contrib/libstdc++/testsuite/config/default.exp | 1 - contrib/libstdc++/testsuite/configure.in | 24 - contrib/libstdc++/testsuite/lib/libstdc++.exp | 179 - .../libstdc++/testsuite/libstdc++.tests/test.exp | 34 - contrib/libstdc++/valarray | 8 - contrib/libstdc++/valarray.cc | 50 - 1958 files changed, 1076227 deletions(-) delete mode 100644 contrib/gcc/BUGS delete mode 100644 contrib/gcc/COPYING delete mode 100644 contrib/gcc/COPYING.LIB delete mode 100644 contrib/gcc/ChangeLog delete mode 100644 contrib/gcc/FSFChangeLog delete mode 100644 contrib/gcc/LANGUAGES delete mode 100644 contrib/gcc/Makefile.in delete mode 100644 contrib/gcc/NEWS delete mode 100644 contrib/gcc/ORDERS delete mode 100644 contrib/gcc/PROBLEMS delete mode 100644 contrib/gcc/PROJECTS delete mode 100644 contrib/gcc/README delete mode 100644 contrib/gcc/README-bugs delete mode 100644 contrib/gcc/README-fixinc delete mode 100644 contrib/gcc/README.ACORN delete mode 100644 contrib/gcc/README.ALTOS delete mode 100644 contrib/gcc/README.APOLLO delete mode 100644 contrib/gcc/README.DWARF delete mode 100644 contrib/gcc/README.FRESCO delete mode 100644 contrib/gcc/README.NS32K delete mode 100644 contrib/gcc/README.RS6000 delete mode 100644 contrib/gcc/README.TRAD delete mode 100644 contrib/gcc/README.X11 delete mode 100644 contrib/gcc/README.g77 delete mode 100644 contrib/gcc/SERVICE delete mode 100644 contrib/gcc/TESTS.FLUNK delete mode 100644 contrib/gcc/acconfig.h delete mode 100644 contrib/gcc/aclocal.m4 delete mode 100644 contrib/gcc/alias.c delete mode 100644 contrib/gcc/alloca.c delete mode 100644 contrib/gcc/ansidecl.h delete mode 100644 contrib/gcc/assert.h delete mode 100644 contrib/gcc/basic-block.h delete mode 100644 contrib/gcc/bc-emit.c delete mode 100644 contrib/gcc/bc-emit.h delete mode 100644 contrib/gcc/bc-optab.c delete mode 100644 contrib/gcc/bc-optab.h delete mode 100644 contrib/gcc/bc-typecd.def delete mode 100644 contrib/gcc/bc-typecd.h delete mode 100644 contrib/gcc/bi-arity.c delete mode 100644 contrib/gcc/bi-defs.h delete mode 100644 contrib/gcc/bi-lexer.c delete mode 100644 contrib/gcc/bi-opcode.c delete mode 100644 contrib/gcc/bi-opname.c delete mode 100644 contrib/gcc/bi-parser.y delete mode 100644 contrib/gcc/bi-reverse.c delete mode 100644 contrib/gcc/bi-run.h delete mode 100644 contrib/gcc/bitmap.c delete mode 100644 contrib/gcc/bitmap.h delete mode 100644 contrib/gcc/build-make delete mode 100644 contrib/gcc/bytecode.def delete mode 100644 contrib/gcc/bytecode.h delete mode 100644 contrib/gcc/bytetypes.h delete mode 100644 contrib/gcc/c-aux-info.c delete mode 100644 contrib/gcc/c-common.c delete mode 100644 contrib/gcc/c-convert.c delete mode 100644 contrib/gcc/c-decl.c delete mode 100644 contrib/gcc/c-iterate.c delete mode 100644 contrib/gcc/c-lang.c delete mode 100644 contrib/gcc/c-lex.c delete mode 100644 contrib/gcc/c-lex.h delete mode 100644 contrib/gcc/c-parse.gperf delete mode 100644 contrib/gcc/c-parse.in delete mode 100644 contrib/gcc/c-pragma.c delete mode 100644 contrib/gcc/c-pragma.h delete mode 100644 contrib/gcc/c-tree.h delete mode 100644 contrib/gcc/c-typeck.c delete mode 100644 contrib/gcc/caller-save.c delete mode 100644 contrib/gcc/calls.c delete mode 100644 contrib/gcc/cccp.1 delete mode 100644 contrib/gcc/cccp.c delete mode 100644 contrib/gcc/cexp.y delete mode 100644 contrib/gcc/choose-temp.c delete mode 100644 contrib/gcc/collect2.c delete mode 100644 contrib/gcc/collect2.h delete mode 100644 contrib/gcc/combine.c delete mode 100644 contrib/gcc/conditions.h delete mode 100755 contrib/gcc/config.guess delete mode 100644 contrib/gcc/config.in delete mode 100755 contrib/gcc/config.sub delete mode 100644 contrib/gcc/config/README delete mode 100644 contrib/gcc/config/alpha/alpha-interix.h delete mode 100644 contrib/gcc/config/alpha/alpha.c delete mode 100644 contrib/gcc/config/alpha/alpha.h delete mode 100644 contrib/gcc/config/alpha/alpha.md delete mode 100644 contrib/gcc/config/alpha/alpha32.h delete mode 100644 contrib/gcc/config/alpha/crtbegin.asm delete mode 100644 contrib/gcc/config/alpha/crtend.asm delete mode 100644 contrib/gcc/config/alpha/elf.h delete mode 100644 contrib/gcc/config/alpha/freebsd.h delete mode 100644 contrib/gcc/config/alpha/gdb-osf12.h delete mode 100644 contrib/gcc/config/alpha/gdb-osf2.h delete mode 100644 contrib/gcc/config/alpha/gdb.h delete mode 100644 contrib/gcc/config/alpha/lib1funcs.asm delete mode 100644 contrib/gcc/config/alpha/linux-ecoff.h delete mode 100644 contrib/gcc/config/alpha/linux-elf.h delete mode 100644 contrib/gcc/config/alpha/linux.h delete mode 100644 contrib/gcc/config/alpha/netbsd-elf.h delete mode 100644 contrib/gcc/config/alpha/netbsd.h delete mode 100644 contrib/gcc/config/alpha/openbsd.h delete mode 100644 contrib/gcc/config/alpha/osf.h delete mode 100644 contrib/gcc/config/alpha/osf12.h delete mode 100644 contrib/gcc/config/alpha/osf2.h delete mode 100644 contrib/gcc/config/alpha/osf2or3.h delete mode 100644 contrib/gcc/config/alpha/t-crtbe delete mode 100644 contrib/gcc/config/alpha/t-ieee delete mode 100644 contrib/gcc/config/alpha/t-interix delete mode 100644 contrib/gcc/config/alpha/t-vms delete mode 100644 contrib/gcc/config/alpha/va_list.h delete mode 100644 contrib/gcc/config/alpha/vms-tramp.asm delete mode 100644 contrib/gcc/config/alpha/vms.h delete mode 100644 contrib/gcc/config/alpha/vxworks.h delete mode 100644 contrib/gcc/config/alpha/x-alpha delete mode 100644 contrib/gcc/config/alpha/xm-alpha-interix.h delete mode 100644 contrib/gcc/config/alpha/xm-alpha.h delete mode 100644 contrib/gcc/config/alpha/xm-openbsd.h delete mode 100644 contrib/gcc/config/alpha/xm-vms.h delete mode 100644 contrib/gcc/config/aoutos.h delete mode 100644 contrib/gcc/config/dbx.h delete mode 100644 contrib/gcc/config/dbxcoff.h delete mode 100644 contrib/gcc/config/dbxelf.h delete mode 100644 contrib/gcc/config/elfos.h delete mode 100644 contrib/gcc/config/float-i128.h delete mode 100644 contrib/gcc/config/float-i32.h delete mode 100644 contrib/gcc/config/float-i386.h delete mode 100644 contrib/gcc/config/float-i64.h delete mode 100644 contrib/gcc/config/float-m68k.h delete mode 100644 contrib/gcc/config/float-sh.h delete mode 100644 contrib/gcc/config/float-vax.h delete mode 100644 contrib/gcc/config/fp-bit.c delete mode 100644 contrib/gcc/config/freebsd.h delete mode 100644 contrib/gcc/config/gnu.h delete mode 100644 contrib/gcc/config/gofast.h delete mode 100644 contrib/gcc/config/i386/386bsd.h delete mode 100644 contrib/gcc/config/i386/aix386.h delete mode 100644 contrib/gcc/config/i386/aix386ng.h delete mode 100644 contrib/gcc/config/i386/att.h delete mode 100644 contrib/gcc/config/i386/bsd.h delete mode 100644 contrib/gcc/config/i386/bsd386.h delete mode 100644 contrib/gcc/config/i386/config-nt.sed delete mode 100644 contrib/gcc/config/i386/crtdll.h delete mode 100644 contrib/gcc/config/i386/cygwin.asm delete mode 100644 contrib/gcc/config/i386/cygwin.h delete mode 100644 contrib/gcc/config/i386/dgux.c delete mode 100644 contrib/gcc/config/i386/dgux.h delete mode 100644 contrib/gcc/config/i386/djgpp-rtems.h delete mode 100644 contrib/gcc/config/i386/djgpp.h delete mode 100644 contrib/gcc/config/i386/freebsd-aout.h delete mode 100644 contrib/gcc/config/i386/freebsd-elf.h delete mode 100644 contrib/gcc/config/i386/freebsd.h delete mode 100644 contrib/gcc/config/i386/freebsd.h.fixed delete mode 100644 contrib/gcc/config/i386/gas.h delete mode 100644 contrib/gcc/config/i386/gmon-sol2.c delete mode 100644 contrib/gcc/config/i386/gnu.h delete mode 100644 contrib/gcc/config/i386/go32.h delete mode 100644 contrib/gcc/config/i386/gstabs.h delete mode 100644 contrib/gcc/config/i386/i386-aout.h delete mode 100644 contrib/gcc/config/i386/i386-coff.h delete mode 100644 contrib/gcc/config/i386/i386-interix.h delete mode 100644 contrib/gcc/config/i386/i386.c delete mode 100644 contrib/gcc/config/i386/i386.h delete mode 100644 contrib/gcc/config/i386/i386.md delete mode 100644 contrib/gcc/config/i386/i386iscgas.h delete mode 100644 contrib/gcc/config/i386/interix.c delete mode 100644 contrib/gcc/config/i386/isc.h delete mode 100644 contrib/gcc/config/i386/isccoff.h delete mode 100644 contrib/gcc/config/i386/iscdbx.h delete mode 100644 contrib/gcc/config/i386/linux-aout.h delete mode 100644 contrib/gcc/config/i386/linux-oldld.h delete mode 100644 contrib/gcc/config/i386/linux.h delete mode 100644 contrib/gcc/config/i386/lynx-ng.h delete mode 100644 contrib/gcc/config/i386/lynx.h delete mode 100644 contrib/gcc/config/i386/mach.h delete mode 100644 contrib/gcc/config/i386/mingw32.h delete mode 100644 contrib/gcc/config/i386/moss.h delete mode 100644 contrib/gcc/config/i386/netbsd.h delete mode 100644 contrib/gcc/config/i386/next.c delete mode 100644 contrib/gcc/config/i386/next.h delete mode 100644 contrib/gcc/config/i386/openbsd.h delete mode 100644 contrib/gcc/config/i386/os2.h delete mode 100644 contrib/gcc/config/i386/osf1-ci.asm delete mode 100644 contrib/gcc/config/i386/osf1-cn.asm delete mode 100644 contrib/gcc/config/i386/osf1elf.h delete mode 100644 contrib/gcc/config/i386/osf1elfgdb.h delete mode 100644 contrib/gcc/config/i386/osfelf.h delete mode 100644 contrib/gcc/config/i386/osfrose.h delete mode 100644 contrib/gcc/config/i386/perform.h delete mode 100644 contrib/gcc/config/i386/ptx4-i.h delete mode 100644 contrib/gcc/config/i386/rtems.h delete mode 100644 contrib/gcc/config/i386/rtemself.h delete mode 100644 contrib/gcc/config/i386/sco.h delete mode 100644 contrib/gcc/config/i386/sco4.h delete mode 100644 contrib/gcc/config/i386/sco4dbx.h delete mode 100644 contrib/gcc/config/i386/sco5.h delete mode 100644 contrib/gcc/config/i386/sco5gas.h delete mode 100644 contrib/gcc/config/i386/scodbx.h delete mode 100644 contrib/gcc/config/i386/seq-gas.h delete mode 100644 contrib/gcc/config/i386/seq-sysv3.h delete mode 100644 contrib/gcc/config/i386/seq2-sysv3.h delete mode 100644 contrib/gcc/config/i386/sequent.h delete mode 100644 contrib/gcc/config/i386/sol2-c1.asm delete mode 100644 contrib/gcc/config/i386/sol2-ci.asm delete mode 100644 contrib/gcc/config/i386/sol2-cn.asm delete mode 100644 contrib/gcc/config/i386/sol2-gc1.asm delete mode 100644 contrib/gcc/config/i386/sol2.h delete mode 100644 contrib/gcc/config/i386/sol2gas.h delete mode 100644 contrib/gcc/config/i386/sun.h delete mode 100644 contrib/gcc/config/i386/sun386.h delete mode 100644 contrib/gcc/config/i386/svr3.ifile delete mode 100644 contrib/gcc/config/i386/svr3dbx.h delete mode 100644 contrib/gcc/config/i386/svr3gas.h delete mode 100644 contrib/gcc/config/i386/svr3z.ifile delete mode 100644 contrib/gcc/config/i386/sysv3.h delete mode 100644 contrib/gcc/config/i386/sysv4.h delete mode 100644 contrib/gcc/config/i386/sysv4gdb.h delete mode 100644 contrib/gcc/config/i386/sysv5.h delete mode 100644 contrib/gcc/config/i386/t-crtpic delete mode 100644 contrib/gcc/config/i386/t-crtstuff delete mode 100644 contrib/gcc/config/i386/t-cygwin delete mode 100644 contrib/gcc/config/i386/t-dgux delete mode 100644 contrib/gcc/config/i386/t-djgpp delete mode 100644 contrib/gcc/config/i386/t-i386bare delete mode 100644 contrib/gcc/config/i386/t-interix delete mode 100644 contrib/gcc/config/i386/t-iscscodbx delete mode 100644 contrib/gcc/config/i386/t-mingw32 delete mode 100644 contrib/gcc/config/i386/t-next delete mode 100644 contrib/gcc/config/i386/t-osf delete mode 100644 contrib/gcc/config/i386/t-osf1elf delete mode 100644 contrib/gcc/config/i386/t-sco5 delete mode 100644 contrib/gcc/config/i386/t-sco5gas delete mode 100644 contrib/gcc/config/i386/t-sol2 delete mode 100644 contrib/gcc/config/i386/t-svr3dbx delete mode 100644 contrib/gcc/config/i386/t-udk delete mode 100644 contrib/gcc/config/i386/t-uwin delete mode 100644 contrib/gcc/config/i386/t-vsta delete mode 100644 contrib/gcc/config/i386/t-winnt delete mode 100644 contrib/gcc/config/i386/udk.h delete mode 100644 contrib/gcc/config/i386/unix.h delete mode 100644 contrib/gcc/config/i386/uwin.asm delete mode 100644 contrib/gcc/config/i386/uwin.h delete mode 100644 contrib/gcc/config/i386/v3gas.h delete mode 100644 contrib/gcc/config/i386/vsta.h delete mode 100644 contrib/gcc/config/i386/vxi386.h delete mode 100644 contrib/gcc/config/i386/win-nt.h delete mode 100644 contrib/gcc/config/i386/win32.h delete mode 100644 contrib/gcc/config/i386/winnt.c delete mode 100644 contrib/gcc/config/i386/x-aix delete mode 100644 contrib/gcc/config/i386/x-cygwin delete mode 100644 contrib/gcc/config/i386/x-dgux delete mode 100644 contrib/gcc/config/i386/x-djgpp delete mode 100644 contrib/gcc/config/i386/x-freebsd delete mode 100644 contrib/gcc/config/i386/x-isc delete mode 100644 contrib/gcc/config/i386/x-isc3 delete mode 100644 contrib/gcc/config/i386/x-ncr3000 delete mode 100644 contrib/gcc/config/i386/x-next delete mode 100644 contrib/gcc/config/i386/x-osf1elf delete mode 100644 contrib/gcc/config/i386/x-osfrose delete mode 100644 contrib/gcc/config/i386/x-sco delete mode 100644 contrib/gcc/config/i386/x-sco4 delete mode 100644 contrib/gcc/config/i386/x-sco5 delete mode 100644 contrib/gcc/config/i386/x-sysv3 delete mode 100644 contrib/gcc/config/i386/x-vsta delete mode 100644 contrib/gcc/config/i386/xm-aix.h delete mode 100644 contrib/gcc/config/i386/xm-bsd386.h delete mode 100644 contrib/gcc/config/i386/xm-cygwin.h delete mode 100644 contrib/gcc/config/i386/xm-dgux.h delete mode 100644 contrib/gcc/config/i386/xm-djgpp.h delete mode 100644 contrib/gcc/config/i386/xm-dos.h delete mode 100644 contrib/gcc/config/i386/xm-freebsd.h delete mode 100644 contrib/gcc/config/i386/xm-gnu.h delete mode 100644 contrib/gcc/config/i386/xm-i386-interix.h delete mode 100644 contrib/gcc/config/i386/xm-i386.h delete mode 100644 contrib/gcc/config/i386/xm-isc.h delete mode 100644 contrib/gcc/config/i386/xm-linux.h delete mode 100644 contrib/gcc/config/i386/xm-lynx.h delete mode 100644 contrib/gcc/config/i386/xm-mingw32.h delete mode 100644 contrib/gcc/config/i386/xm-netbsd.h delete mode 100644 contrib/gcc/config/i386/xm-next.h delete mode 100644 contrib/gcc/config/i386/xm-openbsd.h delete mode 100644 contrib/gcc/config/i386/xm-os2.h delete mode 100644 contrib/gcc/config/i386/xm-osf.h delete mode 100644 contrib/gcc/config/i386/xm-osf1elf.h delete mode 100644 contrib/gcc/config/i386/xm-sco.h delete mode 100644 contrib/gcc/config/i386/xm-sco5.h delete mode 100644 contrib/gcc/config/i386/xm-sun.h delete mode 100644 contrib/gcc/config/i386/xm-sysv3.h delete mode 100644 contrib/gcc/config/i386/xm-sysv4.h delete mode 100644 contrib/gcc/config/i386/xm-uwin.h delete mode 100644 contrib/gcc/config/i386/xm-vsta.h delete mode 100644 contrib/gcc/config/i386/xm-winnt.h delete mode 100644 contrib/gcc/config/interix.h delete mode 100644 contrib/gcc/config/libgloss.h delete mode 100644 contrib/gcc/config/linux-aout.h delete mode 100644 contrib/gcc/config/linux.h delete mode 100644 contrib/gcc/config/lynx-ng.h delete mode 100644 contrib/gcc/config/lynx.h delete mode 100644 contrib/gcc/config/netbsd.h delete mode 100644 contrib/gcc/config/nextstep.c delete mode 100644 contrib/gcc/config/nextstep.h delete mode 100644 contrib/gcc/config/nextstep21.h delete mode 100644 contrib/gcc/config/openbsd.h delete mode 100644 contrib/gcc/config/psos.h delete mode 100644 contrib/gcc/config/ptx4.h delete mode 100644 contrib/gcc/config/sparc/aout.h delete mode 100644 contrib/gcc/config/sparc/bsd.h delete mode 100644 contrib/gcc/config/sparc/elf.h delete mode 100644 contrib/gcc/config/sparc/gmon-sol2.c delete mode 100644 contrib/gcc/config/sparc/hal.h delete mode 100644 contrib/gcc/config/sparc/lb1spc.asm delete mode 100644 contrib/gcc/config/sparc/lb1spl.asm delete mode 100644 contrib/gcc/config/sparc/linux-aout.h delete mode 100644 contrib/gcc/config/sparc/linux.h delete mode 100644 contrib/gcc/config/sparc/linux64.h delete mode 100644 contrib/gcc/config/sparc/lite.h delete mode 100644 contrib/gcc/config/sparc/litecoff.h delete mode 100644 contrib/gcc/config/sparc/lynx-ng.h delete mode 100644 contrib/gcc/config/sparc/lynx.h delete mode 100644 contrib/gcc/config/sparc/netbsd.h delete mode 100644 contrib/gcc/config/sparc/openbsd.h delete mode 100644 contrib/gcc/config/sparc/pbd.h delete mode 100644 contrib/gcc/config/sparc/rtems.h delete mode 100644 contrib/gcc/config/sparc/sol2-c1.asm delete mode 100644 contrib/gcc/config/sparc/sol2-ci.asm delete mode 100644 contrib/gcc/config/sparc/sol2-cn.asm delete mode 100644 contrib/gcc/config/sparc/sol2-g1.asm delete mode 100644 contrib/gcc/config/sparc/sol2-sld-64.h delete mode 100644 contrib/gcc/config/sparc/sol2-sld.h delete mode 100644 contrib/gcc/config/sparc/sol2.h delete mode 100644 contrib/gcc/config/sparc/sp64-aout.h delete mode 100644 contrib/gcc/config/sparc/sp64-elf.h delete mode 100644 contrib/gcc/config/sparc/sparc.c delete mode 100644 contrib/gcc/config/sparc/sparc.h delete mode 100644 contrib/gcc/config/sparc/sparc.md delete mode 100644 contrib/gcc/config/sparc/splet.h delete mode 100644 contrib/gcc/config/sparc/sun4gas.h delete mode 100644 contrib/gcc/config/sparc/sun4o3.h delete mode 100644 contrib/gcc/config/sparc/sunos4.h delete mode 100644 contrib/gcc/config/sparc/sysv4.h delete mode 100644 contrib/gcc/config/sparc/t-elf delete mode 100644 contrib/gcc/config/sparc/t-halos delete mode 100644 contrib/gcc/config/sparc/t-linux64 delete mode 100644 contrib/gcc/config/sparc/t-sol2 delete mode 100644 contrib/gcc/config/sparc/t-sol2-64 delete mode 100644 contrib/gcc/config/sparc/t-sp64 delete mode 100644 contrib/gcc/config/sparc/t-sparcbare delete mode 100644 contrib/gcc/config/sparc/t-sparclite delete mode 100644 contrib/gcc/config/sparc/t-splet delete mode 100644 contrib/gcc/config/sparc/t-sunos40 delete mode 100644 contrib/gcc/config/sparc/t-sunos41 delete mode 100644 contrib/gcc/config/sparc/t-vxsparc delete mode 100644 contrib/gcc/config/sparc/vxsim.h delete mode 100644 contrib/gcc/config/sparc/vxsparc.h delete mode 100644 contrib/gcc/config/sparc/x-sysv4 delete mode 100644 contrib/gcc/config/sparc/xm-linux.h delete mode 100644 contrib/gcc/config/sparc/xm-lynx.h delete mode 100644 contrib/gcc/config/sparc/xm-openbsd.h delete mode 100644 contrib/gcc/config/sparc/xm-pbd.h delete mode 100644 contrib/gcc/config/sparc/xm-sol2.h delete mode 100644 contrib/gcc/config/sparc/xm-sp64.h delete mode 100644 contrib/gcc/config/sparc/xm-sparc.h delete mode 100644 contrib/gcc/config/sparc/xm-sysv4-64.h delete mode 100644 contrib/gcc/config/sparc/xm-sysv4.h delete mode 100644 contrib/gcc/config/svr3.h delete mode 100644 contrib/gcc/config/svr4.h delete mode 100644 contrib/gcc/config/t-freebsd delete mode 100644 contrib/gcc/config/t-gnu delete mode 100644 contrib/gcc/config/t-libc-ok delete mode 100644 contrib/gcc/config/t-linux-aout delete mode 100644 contrib/gcc/config/t-netbsd delete mode 100644 contrib/gcc/config/t-openbsd delete mode 100644 contrib/gcc/config/t-openbsd-thread delete mode 100644 contrib/gcc/config/t-rtems delete mode 100644 contrib/gcc/config/t-svr4 delete mode 100644 contrib/gcc/config/tm-dwarf2.h delete mode 100644 contrib/gcc/config/x-interix delete mode 100644 contrib/gcc/config/x-linux delete mode 100644 contrib/gcc/config/x-linux-aout delete mode 100644 contrib/gcc/config/x-lynx delete mode 100644 contrib/gcc/config/x-netbsd delete mode 100644 contrib/gcc/config/x-svr4 delete mode 100644 contrib/gcc/config/xm-alloca.h delete mode 100644 contrib/gcc/config/xm-freebsd.h delete mode 100644 contrib/gcc/config/xm-gnu.h delete mode 100644 contrib/gcc/config/xm-interix.h delete mode 100644 contrib/gcc/config/xm-linux.h delete mode 100644 contrib/gcc/config/xm-lynx.h delete mode 100644 contrib/gcc/config/xm-netbsd.h delete mode 100644 contrib/gcc/config/xm-openbsd.h delete mode 100644 contrib/gcc/config/xm-siglist.h delete mode 100644 contrib/gcc/config/xm-std32.h delete mode 100644 contrib/gcc/config/xm-svr3.h delete mode 100644 contrib/gcc/config/xm-svr4.h delete mode 100755 contrib/gcc/configure delete mode 100644 contrib/gcc/configure.frag delete mode 100644 contrib/gcc/configure.in delete mode 100644 contrib/gcc/configure.lang delete mode 100644 contrib/gcc/convert.c delete mode 100644 contrib/gcc/convert.h delete mode 100644 contrib/gcc/cp/ChangeLog delete mode 100644 contrib/gcc/cp/Make-lang.in delete mode 100644 contrib/gcc/cp/Makefile.in delete mode 100644 contrib/gcc/cp/NEWS delete mode 100644 contrib/gcc/cp/call.c delete mode 100644 contrib/gcc/cp/class.c delete mode 100644 contrib/gcc/cp/class.h delete mode 100644 contrib/gcc/cp/config-lang.in delete mode 100644 contrib/gcc/cp/cp-tree.def delete mode 100644 contrib/gcc/cp/cp-tree.h delete mode 100644 contrib/gcc/cp/cvt.c delete mode 100644 contrib/gcc/cp/decl.c delete mode 100644 contrib/gcc/cp/decl.h delete mode 100644 contrib/gcc/cp/decl2.c delete mode 100644 contrib/gcc/cp/edsel.c delete mode 100644 contrib/gcc/cp/errfn.c delete mode 100644 contrib/gcc/cp/error.c delete mode 100644 contrib/gcc/cp/except.c delete mode 100644 contrib/gcc/cp/exception.cc delete mode 100644 contrib/gcc/cp/expr.c delete mode 100644 contrib/gcc/cp/friend.c delete mode 100644 contrib/gcc/cp/g++.1 delete mode 100644 contrib/gcc/cp/g++.c delete mode 100644 contrib/gcc/cp/g++spec.c delete mode 100644 contrib/gcc/cp/gc.c delete mode 100644 contrib/gcc/cp/gpcompare.texi delete mode 100644 contrib/gcc/cp/gxx.gperf delete mode 100644 contrib/gcc/cp/gxxint.texi delete mode 100644 contrib/gcc/cp/inc/exception delete mode 100644 contrib/gcc/cp/inc/new delete mode 100644 contrib/gcc/cp/inc/new.h delete mode 100644 contrib/gcc/cp/inc/typeinfo delete mode 100644 contrib/gcc/cp/init.c delete mode 100644 contrib/gcc/cp/input.c delete mode 100644 contrib/gcc/cp/lang-options.h delete mode 100644 contrib/gcc/cp/lang-specs.h delete mode 100644 contrib/gcc/cp/lex.c delete mode 100644 contrib/gcc/cp/lex.h delete mode 100644 contrib/gcc/cp/method.c delete mode 100644 contrib/gcc/cp/mpw-config.in delete mode 100644 contrib/gcc/cp/mpw-make.sed delete mode 100644 contrib/gcc/cp/new.cc delete mode 100644 contrib/gcc/cp/new1.cc delete mode 100644 contrib/gcc/cp/new2.cc delete mode 100644 contrib/gcc/cp/parse.y delete mode 100644 contrib/gcc/cp/pt.c delete mode 100644 contrib/gcc/cp/ptree.c delete mode 100644 contrib/gcc/cp/reno.texi delete mode 100644 contrib/gcc/cp/repo.c delete mode 100644 contrib/gcc/cp/rtti.c delete mode 100644 contrib/gcc/cp/search.c delete mode 100644 contrib/gcc/cp/semantics.c delete mode 100644 contrib/gcc/cp/sig.c delete mode 100644 contrib/gcc/cp/spew.c delete mode 100644 contrib/gcc/cp/templates.texi delete mode 100644 contrib/gcc/cp/tinfo.cc delete mode 100644 contrib/gcc/cp/tinfo.h delete mode 100644 contrib/gcc/cp/tinfo2.cc delete mode 100644 contrib/gcc/cp/tree.c delete mode 100644 contrib/gcc/cp/tree.def delete mode 100644 contrib/gcc/cp/typeck.c delete mode 100644 contrib/gcc/cp/typeck2.c delete mode 100644 contrib/gcc/cp/xref.c delete mode 100644 contrib/gcc/cplus-dem.c delete mode 100644 contrib/gcc/cpp.1 delete mode 100644 contrib/gcc/cpp.texi delete mode 100644 contrib/gcc/cppalloc.c delete mode 100644 contrib/gcc/cpperror.c delete mode 100644 contrib/gcc/cppexp.c delete mode 100644 contrib/gcc/cppfiles.c delete mode 100644 contrib/gcc/cpphash.c delete mode 100644 contrib/gcc/cpphash.h delete mode 100644 contrib/gcc/cppinit.c delete mode 100644 contrib/gcc/cpplib.c delete mode 100644 contrib/gcc/cpplib.h delete mode 100644 contrib/gcc/cppmain.c delete mode 100644 contrib/gcc/cppspec.c delete mode 100644 contrib/gcc/cppulp.c delete mode 100644 contrib/gcc/cross-make delete mode 100644 contrib/gcc/crtstuff.c delete mode 100644 contrib/gcc/cse.c delete mode 100644 contrib/gcc/cstamp-h.in delete mode 100644 contrib/gcc/dbxout.c delete mode 100644 contrib/gcc/dbxout.h delete mode 100644 contrib/gcc/dbxstclass.h delete mode 100644 contrib/gcc/defaults.h delete mode 100644 contrib/gcc/demangle.h delete mode 100644 contrib/gcc/doprint.c delete mode 100644 contrib/gcc/doschk.c delete mode 100755 contrib/gcc/dostage2 delete mode 100755 contrib/gcc/dostage3 delete mode 100644 contrib/gcc/dwarf.h delete mode 100644 contrib/gcc/dwarf2.h delete mode 100644 contrib/gcc/dwarf2out.c delete mode 100644 contrib/gcc/dwarf2out.h delete mode 100644 contrib/gcc/dwarfout.c delete mode 100644 contrib/gcc/dwarfout.h delete mode 100644 contrib/gcc/dyn-string.c delete mode 100644 contrib/gcc/dyn-string.h delete mode 100644 contrib/gcc/eh-common.h delete mode 100644 contrib/gcc/emit-rtl.c delete mode 100644 contrib/gcc/enquire.c delete mode 100644 contrib/gcc/except.c delete mode 100644 contrib/gcc/except.h delete mode 100755 contrib/gcc/exgettext delete mode 100644 contrib/gcc/explow.c delete mode 100644 contrib/gcc/expmed.c delete mode 100644 contrib/gcc/expr.c delete mode 100644 contrib/gcc/expr.h delete mode 100644 contrib/gcc/extend.texi delete mode 100644 contrib/gcc/f/BUGS delete mode 100644 contrib/gcc/f/ChangeLog delete mode 100644 contrib/gcc/f/INSTALL delete mode 100644 contrib/gcc/f/Make-lang.in delete mode 100644 contrib/gcc/f/Makefile.in delete mode 100644 contrib/gcc/f/NEWS delete mode 100644 contrib/gcc/f/README delete mode 100644 contrib/gcc/f/RELEASE-PREP delete mode 100644 contrib/gcc/f/ansify.c delete mode 100644 contrib/gcc/f/assert.j delete mode 100644 contrib/gcc/f/bad.c delete mode 100644 contrib/gcc/f/bad.def delete mode 100644 contrib/gcc/f/bad.h delete mode 100644 contrib/gcc/f/bit.c delete mode 100644 contrib/gcc/f/bit.h delete mode 100644 contrib/gcc/f/bld-op.def delete mode 100644 contrib/gcc/f/bld.c delete mode 100644 contrib/gcc/f/bld.h delete mode 100644 contrib/gcc/f/bugs.texi delete mode 100644 contrib/gcc/f/bugs0.texi delete mode 100644 contrib/gcc/f/com-rt.def delete mode 100644 contrib/gcc/f/com.c delete mode 100644 contrib/gcc/f/com.h delete mode 100644 contrib/gcc/f/config-lang.in delete mode 100644 contrib/gcc/f/config.j delete mode 100644 contrib/gcc/f/convert.j delete mode 100644 contrib/gcc/f/data.c delete mode 100644 contrib/gcc/f/data.h delete mode 100644 contrib/gcc/f/equiv.c delete mode 100644 contrib/gcc/f/equiv.h delete mode 100644 contrib/gcc/f/expr.c delete mode 100644 contrib/gcc/f/expr.h delete mode 100644 contrib/gcc/f/ffe.texi delete mode 100644 contrib/gcc/f/fini.c delete mode 100644 contrib/gcc/f/flags.j delete mode 100644 contrib/gcc/f/g77.1 delete mode 100644 contrib/gcc/f/g77.texi delete mode 100644 contrib/gcc/f/g77install.texi delete mode 100644 contrib/gcc/f/g77spec.c delete mode 100644 contrib/gcc/f/glimits.j delete mode 100644 contrib/gcc/f/global.c delete mode 100644 contrib/gcc/f/global.h delete mode 100644 contrib/gcc/f/hconfig.j delete mode 100644 contrib/gcc/f/implic.c delete mode 100644 contrib/gcc/f/implic.h delete mode 100644 contrib/gcc/f/info-b.def delete mode 100644 contrib/gcc/f/info-k.def delete mode 100644 contrib/gcc/f/info-w.def delete mode 100644 contrib/gcc/f/info.c delete mode 100644 contrib/gcc/f/info.h delete mode 100644 contrib/gcc/f/input.j delete mode 100644 contrib/gcc/f/intdoc.c delete mode 100644 contrib/gcc/f/intdoc.in delete mode 100644 contrib/gcc/f/intdoc.texi delete mode 100644 contrib/gcc/f/intrin.c delete mode 100644 contrib/gcc/f/intrin.def delete mode 100644 contrib/gcc/f/intrin.h delete mode 100644 contrib/gcc/f/lab.c delete mode 100644 contrib/gcc/f/lab.h delete mode 100644 contrib/gcc/f/lang-options.h delete mode 100644 contrib/gcc/f/lang-specs.h delete mode 100644 contrib/gcc/f/lex.c delete mode 100644 contrib/gcc/f/lex.h delete mode 100644 contrib/gcc/f/malloc.c delete mode 100644 contrib/gcc/f/malloc.h delete mode 100644 contrib/gcc/f/name.c delete mode 100644 contrib/gcc/f/name.h delete mode 100644 contrib/gcc/f/news.texi delete mode 100644 contrib/gcc/f/news0.texi delete mode 100644 contrib/gcc/f/output.j delete mode 100644 contrib/gcc/f/parse.c delete mode 100644 contrib/gcc/f/proj.c delete mode 100644 contrib/gcc/f/proj.h delete mode 100644 contrib/gcc/f/root.texi delete mode 100644 contrib/gcc/f/rtl.j delete mode 100644 contrib/gcc/f/src.c delete mode 100644 contrib/gcc/f/src.h delete mode 100644 contrib/gcc/f/st.c delete mode 100644 contrib/gcc/f/st.h delete mode 100644 contrib/gcc/f/sta.c delete mode 100644 contrib/gcc/f/sta.h delete mode 100644 contrib/gcc/f/stb.c delete mode 100644 contrib/gcc/f/stb.h delete mode 100644 contrib/gcc/f/stc.c delete mode 100644 contrib/gcc/f/stc.h delete mode 100644 contrib/gcc/f/std.c delete mode 100644 contrib/gcc/f/std.h delete mode 100644 contrib/gcc/f/ste.c delete mode 100644 contrib/gcc/f/ste.h delete mode 100644 contrib/gcc/f/storag.c delete mode 100644 contrib/gcc/f/storag.h delete mode 100644 contrib/gcc/f/stp.c delete mode 100644 contrib/gcc/f/stp.h delete mode 100644 contrib/gcc/f/str-1t.fin delete mode 100644 contrib/gcc/f/str-2t.fin delete mode 100644 contrib/gcc/f/str-fo.fin delete mode 100644 contrib/gcc/f/str-io.fin delete mode 100644 contrib/gcc/f/str-nq.fin delete mode 100644 contrib/gcc/f/str-op.fin delete mode 100644 contrib/gcc/f/str-ot.fin delete mode 100644 contrib/gcc/f/str.c delete mode 100644 contrib/gcc/f/str.h delete mode 100644 contrib/gcc/f/sts.c delete mode 100644 contrib/gcc/f/sts.h delete mode 100644 contrib/gcc/f/stt.c delete mode 100644 contrib/gcc/f/stt.h delete mode 100644 contrib/gcc/f/stu.c delete mode 100644 contrib/gcc/f/stu.h delete mode 100644 contrib/gcc/f/stv.c delete mode 100644 contrib/gcc/f/stv.h delete mode 100644 contrib/gcc/f/stw.c delete mode 100644 contrib/gcc/f/stw.h delete mode 100644 contrib/gcc/f/symbol.c delete mode 100644 contrib/gcc/f/symbol.def delete mode 100644 contrib/gcc/f/symbol.h delete mode 100644 contrib/gcc/f/system.j delete mode 100644 contrib/gcc/f/target.c delete mode 100644 contrib/gcc/f/target.h delete mode 100644 contrib/gcc/f/tconfig.j delete mode 100644 contrib/gcc/f/tm.j delete mode 100644 contrib/gcc/f/top.c delete mode 100644 contrib/gcc/f/top.h delete mode 100644 contrib/gcc/f/toplev.j delete mode 100644 contrib/gcc/f/tree.j delete mode 100644 contrib/gcc/f/type.c delete mode 100644 contrib/gcc/f/type.h delete mode 100644 contrib/gcc/f/version.c delete mode 100644 contrib/gcc/f/version.h delete mode 100644 contrib/gcc/f/where.c delete mode 100644 contrib/gcc/f/where.h delete mode 100644 contrib/gcc/final.c delete mode 100644 contrib/gcc/fix-header.c delete mode 100755 contrib/gcc/fixcpp delete mode 100644 contrib/gcc/fixinc-nt.sed delete mode 100755 contrib/gcc/fixinc.dgux delete mode 100644 contrib/gcc/fixinc.ptx delete mode 100755 contrib/gcc/fixinc.sco delete mode 100755 contrib/gcc/fixinc.svr4 delete mode 100644 contrib/gcc/fixinc.winnt delete mode 100755 contrib/gcc/fixincludes delete mode 100755 contrib/gcc/fixproto delete mode 100644 contrib/gcc/flags.h delete mode 100644 contrib/gcc/floatlib.c delete mode 100644 contrib/gcc/flow.c delete mode 100644 contrib/gcc/fold-const.c delete mode 100644 contrib/gcc/fp-test.c delete mode 100644 contrib/gcc/frame.c delete mode 100644 contrib/gcc/frame.h delete mode 100644 contrib/gcc/function.c delete mode 100644 contrib/gcc/function.h delete mode 100644 contrib/gcc/future.options delete mode 100644 contrib/gcc/gansidecl.h delete mode 100644 contrib/gcc/gbl-ctors.h delete mode 100644 contrib/gcc/gcc.1 delete mode 100644 contrib/gcc/gcc.c delete mode 100644 contrib/gcc/gcc.texi delete mode 100644 contrib/gcc/gccspec.c delete mode 100644 contrib/gcc/gcov-io.h delete mode 100644 contrib/gcc/gcov.c delete mode 100644 contrib/gcc/gcov.texi delete mode 100644 contrib/gcc/gcse.c delete mode 100644 contrib/gcc/gen-protos.c delete mode 100644 contrib/gcc/genattr.c delete mode 100644 contrib/gcc/genattrtab.c delete mode 100644 contrib/gcc/gencheck.c delete mode 100644 contrib/gcc/gencodes.c delete mode 100644 contrib/gcc/genconfig.c delete mode 100644 contrib/gcc/genemit.c delete mode 100644 contrib/gcc/genextract.c delete mode 100644 contrib/gcc/genflags.c delete mode 100644 contrib/gcc/gengenrtl.c delete mode 100644 contrib/gcc/genmultilib delete mode 100644 contrib/gcc/genopinit.c delete mode 100644 contrib/gcc/genoutput.c delete mode 100644 contrib/gcc/genpeep.c delete mode 100644 contrib/gcc/genrecog.c delete mode 100644 contrib/gcc/getopt.c delete mode 100644 contrib/gcc/getopt.h delete mode 100644 contrib/gcc/getopt1.c delete mode 100644 contrib/gcc/getpwd.c delete mode 100644 contrib/gcc/ginclude/iso646.h delete mode 100644 contrib/gcc/ginclude/math-3300.h delete mode 100644 contrib/gcc/ginclude/math-68881.h delete mode 100644 contrib/gcc/ginclude/ppc-asm.h delete mode 100644 contrib/gcc/ginclude/proto.h delete mode 100644 contrib/gcc/ginclude/stdarg.h delete mode 100644 contrib/gcc/ginclude/stdbool.h delete mode 100644 contrib/gcc/ginclude/stddef.h delete mode 100644 contrib/gcc/ginclude/va-alpha.h delete mode 100644 contrib/gcc/ginclude/va-arc.h delete mode 100644 contrib/gcc/ginclude/va-c4x.h delete mode 100644 contrib/gcc/ginclude/va-clipper.h delete mode 100644 contrib/gcc/ginclude/va-h8300.h delete mode 100644 contrib/gcc/ginclude/va-i860.h delete mode 100644 contrib/gcc/ginclude/va-i960.h delete mode 100644 contrib/gcc/ginclude/va-m32r.h delete mode 100644 contrib/gcc/ginclude/va-m88k.h delete mode 100644 contrib/gcc/ginclude/va-mips.h delete mode 100644 contrib/gcc/ginclude/va-mn10200.h delete mode 100644 contrib/gcc/ginclude/va-mn10300.h delete mode 100644 contrib/gcc/ginclude/va-pa.h delete mode 100644 contrib/gcc/ginclude/va-ppc.h delete mode 100644 contrib/gcc/ginclude/va-pyr.h delete mode 100644 contrib/gcc/ginclude/va-sh.h delete mode 100644 contrib/gcc/ginclude/va-sparc.h delete mode 100644 contrib/gcc/ginclude/va-spur.h delete mode 100644 contrib/gcc/ginclude/va-v850.h delete mode 100644 contrib/gcc/ginclude/varargs.h delete mode 100644 contrib/gcc/glimits.h delete mode 100644 contrib/gcc/global.c delete mode 100644 contrib/gcc/gmon.c delete mode 100644 contrib/gcc/graph.c delete mode 100644 contrib/gcc/gstab.h delete mode 100644 contrib/gcc/gsyms.h delete mode 100644 contrib/gcc/gsyslimits.h delete mode 100644 contrib/gcc/gthr-dce.h delete mode 100644 contrib/gcc/gthr-posix.h delete mode 100644 contrib/gcc/gthr-single.h delete mode 100644 contrib/gcc/gthr-solaris.h delete mode 100644 contrib/gcc/gthr-vxworks.h delete mode 100644 contrib/gcc/gthr.h delete mode 100644 contrib/gcc/haifa-sched.c delete mode 100644 contrib/gcc/halfpic.c delete mode 100644 contrib/gcc/halfpic.h delete mode 100644 contrib/gcc/hard-reg-set.h delete mode 100644 contrib/gcc/hash.c delete mode 100644 contrib/gcc/hash.h delete mode 100644 contrib/gcc/hwint.h delete mode 100644 contrib/gcc/input.h delete mode 100755 contrib/gcc/install.sh delete mode 100644 contrib/gcc/install.texi delete mode 100644 contrib/gcc/integrate.c delete mode 100644 contrib/gcc/integrate.h delete mode 100644 contrib/gcc/intl.c delete mode 100644 contrib/gcc/intl.h delete mode 100644 contrib/gcc/invoke.texi delete mode 100644 contrib/gcc/jump.c delete mode 100755 contrib/gcc/just-fixinc delete mode 100644 contrib/gcc/lcm.c delete mode 100644 contrib/gcc/libgcc1-test.c delete mode 100644 contrib/gcc/libgcc1.c delete mode 100644 contrib/gcc/libgcc2.c delete mode 100644 contrib/gcc/libiberty.h delete mode 100644 contrib/gcc/limitx.h delete mode 100644 contrib/gcc/limity.h delete mode 100755 contrib/gcc/listing delete mode 100644 contrib/gcc/local-alloc.c delete mode 100644 contrib/gcc/longlong.h delete mode 100644 contrib/gcc/loop.c delete mode 100644 contrib/gcc/loop.h delete mode 100644 contrib/gcc/machmode.def delete mode 100644 contrib/gcc/machmode.h delete mode 100644 contrib/gcc/makefile.vms delete mode 100644 contrib/gcc/mbchar.c delete mode 100644 contrib/gcc/mbchar.h delete mode 100644 contrib/gcc/md.texi delete mode 100644 contrib/gcc/mips-tdump.c delete mode 100644 contrib/gcc/mips-tfile.c delete mode 100644 contrib/gcc/modemap.def delete mode 100755 contrib/gcc/move-if-change delete mode 100644 contrib/gcc/objc-act.c delete mode 100644 contrib/gcc/objc-act.h delete mode 100644 contrib/gcc/objc-tree.def delete mode 100644 contrib/gcc/objc/Make-lang.in delete mode 100644 contrib/gcc/objc/Makefile delete mode 100644 contrib/gcc/objc/Makefile.in delete mode 100644 contrib/gcc/objc/NXConstStr.h delete mode 100644 contrib/gcc/objc/NXConstStr.m delete mode 100644 contrib/gcc/objc/Object.h delete mode 100644 contrib/gcc/objc/Object.m delete mode 100644 contrib/gcc/objc/Protocol.h delete mode 100644 contrib/gcc/objc/Protocol.m delete mode 100644 contrib/gcc/objc/README delete mode 100644 contrib/gcc/objc/archive.c delete mode 100644 contrib/gcc/objc/class.c delete mode 100644 contrib/gcc/objc/config-lang.in delete mode 100644 contrib/gcc/objc/encoding.c delete mode 100644 contrib/gcc/objc/encoding.h delete mode 100644 contrib/gcc/objc/hash.c delete mode 100644 contrib/gcc/objc/hash.h delete mode 100644 contrib/gcc/objc/init.c delete mode 100644 contrib/gcc/objc/lang-specs.h delete mode 100644 contrib/gcc/objc/list.h delete mode 100644 contrib/gcc/objc/makefile.dos delete mode 100644 contrib/gcc/objc/misc.c delete mode 100644 contrib/gcc/objc/objc-act.c delete mode 100644 contrib/gcc/objc/objc-act.h delete mode 100644 contrib/gcc/objc/objc-api.h delete mode 100644 contrib/gcc/objc/objc-tree.def delete mode 100644 contrib/gcc/objc/objc.gperf delete mode 100644 contrib/gcc/objc/objc.h delete mode 100644 contrib/gcc/objc/objects.c delete mode 100644 contrib/gcc/objc/runtime.h delete mode 100644 contrib/gcc/objc/sarray.c delete mode 100644 contrib/gcc/objc/sarray.h delete mode 100644 contrib/gcc/objc/selector.c delete mode 100644 contrib/gcc/objc/sendmsg.c delete mode 100644 contrib/gcc/objc/typedstream.h delete mode 100644 contrib/gcc/obstack.c delete mode 100644 contrib/gcc/obstack.h delete mode 100644 contrib/gcc/optabs.c delete mode 100644 contrib/gcc/output.h delete mode 100755 contrib/gcc/patch-apollo-includes delete mode 100644 contrib/gcc/pcp.h delete mode 100644 contrib/gcc/pexecute.c delete mode 100644 contrib/gcc/prefix.c delete mode 100644 contrib/gcc/prefix.h delete mode 100644 contrib/gcc/print-rtl.c delete mode 100644 contrib/gcc/print-tree.c delete mode 100644 contrib/gcc/profile.c delete mode 100644 contrib/gcc/protoize.c delete mode 100644 contrib/gcc/pself.c delete mode 100644 contrib/gcc/pself1.c delete mode 100644 contrib/gcc/pself2.c delete mode 100644 contrib/gcc/pself3.c delete mode 100644 contrib/gcc/pself4.c delete mode 100644 contrib/gcc/pself5.c delete mode 100644 contrib/gcc/real.c delete mode 100644 contrib/gcc/real.h delete mode 100644 contrib/gcc/recog.c delete mode 100644 contrib/gcc/recog.h delete mode 100644 contrib/gcc/reg-stack.c delete mode 100644 contrib/gcc/regclass.c delete mode 100644 contrib/gcc/regmove.c delete mode 100644 contrib/gcc/regs.h delete mode 100644 contrib/gcc/reload.c delete mode 100644 contrib/gcc/reload.h delete mode 100644 contrib/gcc/reload1.c delete mode 100644 contrib/gcc/reorg.c delete mode 100644 contrib/gcc/resource.c delete mode 100644 contrib/gcc/resource.h delete mode 100644 contrib/gcc/rtl.c delete mode 100644 contrib/gcc/rtl.def delete mode 100644 contrib/gcc/rtl.h delete mode 100644 contrib/gcc/rtl.texi delete mode 100644 contrib/gcc/rtlanal.c delete mode 100644 contrib/gcc/sbitmap.c delete mode 100644 contrib/gcc/sbitmap.h delete mode 100644 contrib/gcc/scan-decls.c delete mode 100755 contrib/gcc/scan-types.sh delete mode 100644 contrib/gcc/scan.c delete mode 100644 contrib/gcc/scan.h delete mode 100644 contrib/gcc/sched.c delete mode 100644 contrib/gcc/sdbout.c delete mode 100644 contrib/gcc/sdbout.h delete mode 100755 contrib/gcc/sort-protos delete mode 100644 contrib/gcc/splay-tree.c delete mode 100644 contrib/gcc/splay-tree.h delete mode 100644 contrib/gcc/stab.def delete mode 100644 contrib/gcc/stack.h delete mode 100644 contrib/gcc/stmt.c delete mode 100644 contrib/gcc/stor-layout.c delete mode 100644 contrib/gcc/stupid.c delete mode 100644 contrib/gcc/sys-protos.h delete mode 100644 contrib/gcc/sys-types.h delete mode 100644 contrib/gcc/system.h delete mode 100644 contrib/gcc/tlink.c delete mode 100644 contrib/gcc/tm.texi delete mode 100644 contrib/gcc/toplev.c delete mode 100644 contrib/gcc/toplev.h delete mode 100644 contrib/gcc/tree.c delete mode 100644 contrib/gcc/tree.def delete mode 100644 contrib/gcc/tree.h delete mode 100644 contrib/gcc/typeclass.h delete mode 100644 contrib/gcc/unprotoize.c delete mode 100644 contrib/gcc/unroll.c delete mode 100644 contrib/gcc/varasm.c delete mode 100644 contrib/gcc/varray.c delete mode 100644 contrib/gcc/varray.h delete mode 100644 contrib/gcc/version.c delete mode 100644 contrib/gcc/xcoffout.c delete mode 100644 contrib/gcc/xcoffout.h delete mode 100644 contrib/libf2c/ChangeLog.egcs delete mode 100644 contrib/libg++/COPYING delete mode 100644 contrib/libg++/COPYING.LIB delete mode 100644 contrib/libg++/include/ChangeLog delete mode 100644 contrib/libg++/include/ansidecl.h delete mode 100644 contrib/libg++/include/demangle.h delete mode 100644 contrib/libg++/include/floatformat.h delete mode 100644 contrib/libg++/include/getopt.h delete mode 100644 contrib/libg++/include/libiberty.h delete mode 100644 contrib/libg++/include/obstack.h delete mode 100644 contrib/libg++/libg++/ChangeLog delete mode 100644 contrib/libg++/libg++/Makefile.in delete mode 100644 contrib/libg++/libg++/NEWS delete mode 100644 contrib/libg++/libg++/README delete mode 100644 contrib/libg++/libg++/README.SHLIB delete mode 100644 contrib/libg++/libg++/TODO delete mode 100644 contrib/libg++/libg++/g++FAQ.texi delete mode 100644 contrib/libg++/libg++/genclass/ChangeLog delete mode 100644 contrib/libg++/libg++/genclass/Makefile.in delete mode 100644 contrib/libg++/libg++/genclass/configure.in delete mode 100644 contrib/libg++/libg++/genclass/expected.out delete mode 100755 contrib/libg++/libg++/genclass/genclass.sh delete mode 100755 contrib/libg++/libg++/genclass/gentest.sh delete mode 100644 contrib/libg++/libg++/libg++.texi delete mode 100644 contrib/libg++/libg++/src/ACG.cc delete mode 100644 contrib/libg++/libg++/src/ACG.h delete mode 100644 contrib/libg++/libg++/src/AllocRing.cc delete mode 100644 contrib/libg++/libg++/src/AllocRing.h delete mode 100644 contrib/libg++/libg++/src/Binomial.cc delete mode 100644 contrib/libg++/libg++/src/Binomial.h delete mode 100644 contrib/libg++/libg++/src/BitSet.cc delete mode 100644 contrib/libg++/libg++/src/BitSet.h delete mode 100644 contrib/libg++/libg++/src/BitString.cc delete mode 100644 contrib/libg++/libg++/src/BitString.h delete mode 100644 contrib/libg++/libg++/src/ChangeLog delete mode 100644 contrib/libg++/libg++/src/Complex.h delete mode 100644 contrib/libg++/libg++/src/CursesW.cc delete mode 100644 contrib/libg++/libg++/src/CursesW.h delete mode 100644 contrib/libg++/libg++/src/DLList.cc delete mode 100644 contrib/libg++/libg++/src/DLList.h delete mode 100644 contrib/libg++/libg++/src/DiscUnif.cc delete mode 100644 contrib/libg++/libg++/src/DiscUnif.h delete mode 100644 contrib/libg++/libg++/src/Erlang.cc delete mode 100644 contrib/libg++/libg++/src/Erlang.h delete mode 100644 contrib/libg++/libg++/src/Fix.cc delete mode 100644 contrib/libg++/libg++/src/Fix.h delete mode 100644 contrib/libg++/libg++/src/Fix16.cc delete mode 100644 contrib/libg++/libg++/src/Fix16.h delete mode 100644 contrib/libg++/libg++/src/Fix24.cc delete mode 100644 contrib/libg++/libg++/src/Fix24.h delete mode 100644 contrib/libg++/libg++/src/Geom.cc delete mode 100644 contrib/libg++/libg++/src/Geom.h delete mode 100644 contrib/libg++/libg++/src/GetOpt.cc delete mode 100644 contrib/libg++/libg++/src/GetOpt.h delete mode 100644 contrib/libg++/libg++/src/HypGeom.cc delete mode 100644 contrib/libg++/libg++/src/HypGeom.h delete mode 100644 contrib/libg++/libg++/src/Incremental.h delete mode 100644 contrib/libg++/libg++/src/Intdouble.cc delete mode 100644 contrib/libg++/libg++/src/Integer.cc delete mode 100644 contrib/libg++/libg++/src/Integer.h delete mode 100644 contrib/libg++/libg++/src/Integer.hP delete mode 100644 contrib/libg++/libg++/src/LogNorm.cc delete mode 100644 contrib/libg++/libg++/src/LogNorm.h delete mode 100644 contrib/libg++/libg++/src/MLCG.cc delete mode 100644 contrib/libg++/libg++/src/MLCG.h delete mode 100644 contrib/libg++/libg++/src/Makefile.in delete mode 100644 contrib/libg++/libg++/src/NegExp.cc delete mode 100644 contrib/libg++/libg++/src/NegExp.h delete mode 100644 contrib/libg++/libg++/src/Normal.cc delete mode 100644 contrib/libg++/libg++/src/Normal.h delete mode 100644 contrib/libg++/libg++/src/Obstack.cc delete mode 100644 contrib/libg++/libg++/src/Obstack.h delete mode 100644 contrib/libg++/libg++/src/Pix.h delete mode 100644 contrib/libg++/libg++/src/Poisson.cc delete mode 100644 contrib/libg++/libg++/src/Poisson.h delete mode 100644 contrib/libg++/libg++/src/RNG.cc delete mode 100644 contrib/libg++/libg++/src/RNG.h delete mode 100644 contrib/libg++/libg++/src/Random.cc delete mode 100644 contrib/libg++/libg++/src/Random.h delete mode 100644 contrib/libg++/libg++/src/Rational.cc delete mode 100644 contrib/libg++/libg++/src/Rational.h delete mode 100644 contrib/libg++/libg++/src/Regex.cc delete mode 100644 contrib/libg++/libg++/src/Regex.h delete mode 100644 contrib/libg++/libg++/src/RndInt.cc delete mode 100644 contrib/libg++/libg++/src/RndInt.h delete mode 100644 contrib/libg++/libg++/src/SLList.cc delete mode 100644 contrib/libg++/libg++/src/SLList.h delete mode 100644 contrib/libg++/libg++/src/Sample.cc delete mode 100644 contrib/libg++/libg++/src/SmplHist.cc delete mode 100644 contrib/libg++/libg++/src/SmplHist.h delete mode 100644 contrib/libg++/libg++/src/SmplStat.cc delete mode 100644 contrib/libg++/libg++/src/SmplStat.h delete mode 100644 contrib/libg++/libg++/src/String.cc delete mode 100644 contrib/libg++/libg++/src/String.h delete mode 100644 contrib/libg++/libg++/src/Uniform.cc delete mode 100644 contrib/libg++/libg++/src/Uniform.h delete mode 100644 contrib/libg++/libg++/src/Weibull.cc delete mode 100644 contrib/libg++/libg++/src/Weibull.h delete mode 100644 contrib/libg++/libg++/src/bitand.c delete mode 100644 contrib/libg++/libg++/src/bitany.c delete mode 100644 contrib/libg++/libg++/src/bitblt.c delete mode 100644 contrib/libg++/libg++/src/bitclear.c delete mode 100644 contrib/libg++/libg++/src/bitcopy.c delete mode 100644 contrib/libg++/libg++/src/bitcount.c delete mode 100644 contrib/libg++/libg++/src/bitdo1.h delete mode 100644 contrib/libg++/libg++/src/bitdo2.h delete mode 100644 contrib/libg++/libg++/src/bitinvert.c delete mode 100644 contrib/libg++/libg++/src/bitlcomp.c delete mode 100644 contrib/libg++/libg++/src/bitprims.h delete mode 100644 contrib/libg++/libg++/src/bitset1.c delete mode 100644 contrib/libg++/libg++/src/bitxor.c delete mode 100644 contrib/libg++/libg++/src/bool.h delete mode 100644 contrib/libg++/libg++/src/builtin.cc delete mode 100644 contrib/libg++/libg++/src/builtin.h delete mode 100644 contrib/libg++/libg++/src/compare.cc delete mode 100644 contrib/libg++/libg++/src/compare.h delete mode 100644 contrib/libg++/libg++/src/configure.in delete mode 100644 contrib/libg++/libg++/src/depend delete mode 100644 contrib/libg++/libg++/src/dtoa.cc delete mode 100644 contrib/libg++/libg++/src/error.cc delete mode 100644 contrib/libg++/libg++/src/fmtq.cc delete mode 100644 contrib/libg++/libg++/src/gcd.cc delete mode 100644 contrib/libg++/libg++/src/gen/AVLMap.ccP delete mode 100644 contrib/libg++/libg++/src/gen/AVLMap.hP delete mode 100644 contrib/libg++/libg++/src/gen/AVLSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/AVLSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/AVec.ccP delete mode 100644 contrib/libg++/libg++/src/gen/AVec.hP delete mode 100644 contrib/libg++/libg++/src/gen/BSTSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/BSTSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/Bag.ccP delete mode 100644 contrib/libg++/libg++/src/gen/Bag.hP delete mode 100644 contrib/libg++/libg++/src/gen/CHBag.ccP delete mode 100644 contrib/libg++/libg++/src/gen/CHBag.hP delete mode 100644 contrib/libg++/libg++/src/gen/CHMap.ccP delete mode 100644 contrib/libg++/libg++/src/gen/CHMap.hP delete mode 100644 contrib/libg++/libg++/src/gen/CHNode.ccP delete mode 100644 contrib/libg++/libg++/src/gen/CHNode.hP delete mode 100644 contrib/libg++/libg++/src/gen/CHSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/CHSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/DLDeque.ccP delete mode 100644 contrib/libg++/libg++/src/gen/DLDeque.hP delete mode 100644 contrib/libg++/libg++/src/gen/DLList.ccP delete mode 100644 contrib/libg++/libg++/src/gen/DLList.hP delete mode 100644 contrib/libg++/libg++/src/gen/Deque.ccP delete mode 100644 contrib/libg++/libg++/src/gen/Deque.hP delete mode 100644 contrib/libg++/libg++/src/gen/FPQueue.ccP delete mode 100644 contrib/libg++/libg++/src/gen/FPQueue.hP delete mode 100644 contrib/libg++/libg++/src/gen/FPStack.ccP delete mode 100644 contrib/libg++/libg++/src/gen/FPStack.hP delete mode 100644 contrib/libg++/libg++/src/gen/FPlex.ccP delete mode 100644 contrib/libg++/libg++/src/gen/FPlex.hP delete mode 100644 contrib/libg++/libg++/src/gen/List.ccP delete mode 100644 contrib/libg++/libg++/src/gen/List.hP delete mode 100644 contrib/libg++/libg++/src/gen/MPlex.ccP delete mode 100644 contrib/libg++/libg++/src/gen/MPlex.hP delete mode 100644 contrib/libg++/libg++/src/gen/Map.ccP delete mode 100644 contrib/libg++/libg++/src/gen/Map.hP delete mode 100644 contrib/libg++/libg++/src/gen/OSLBag.ccP delete mode 100644 contrib/libg++/libg++/src/gen/OSLBag.hP delete mode 100644 contrib/libg++/libg++/src/gen/OSLSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/OSLSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/OXPBag.ccP delete mode 100644 contrib/libg++/libg++/src/gen/OXPBag.hP delete mode 100644 contrib/libg++/libg++/src/gen/OXPSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/OXPSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/PHPQ.ccP delete mode 100644 contrib/libg++/libg++/src/gen/PHPQ.hP delete mode 100644 contrib/libg++/libg++/src/gen/PQ.ccP delete mode 100644 contrib/libg++/libg++/src/gen/PQ.hP delete mode 100644 contrib/libg++/libg++/src/gen/PSList.hP delete mode 100644 contrib/libg++/libg++/src/gen/PVec.hP delete mode 100644 contrib/libg++/libg++/src/gen/Plex.ccP delete mode 100644 contrib/libg++/libg++/src/gen/Plex.hP delete mode 100644 contrib/libg++/libg++/src/gen/Queue.ccP delete mode 100644 contrib/libg++/libg++/src/gen/Queue.hP delete mode 100644 contrib/libg++/libg++/src/gen/RAVLMap.ccP delete mode 100644 contrib/libg++/libg++/src/gen/RAVLMap.hP delete mode 100644 contrib/libg++/libg++/src/gen/RPlex.ccP delete mode 100644 contrib/libg++/libg++/src/gen/RPlex.hP delete mode 100644 contrib/libg++/libg++/src/gen/SLBag.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SLBag.hP delete mode 100644 contrib/libg++/libg++/src/gen/SLList.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SLList.hP delete mode 100644 contrib/libg++/libg++/src/gen/SLQueue.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SLQueue.hP delete mode 100644 contrib/libg++/libg++/src/gen/SLSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SLSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/SLStack.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SLStack.hP delete mode 100644 contrib/libg++/libg++/src/gen/Set.ccP delete mode 100644 contrib/libg++/libg++/src/gen/Set.hP delete mode 100644 contrib/libg++/libg++/src/gen/SkipBag.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SkipBag.hP delete mode 100644 contrib/libg++/libg++/src/gen/SkipMap.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SkipMap.hP delete mode 100644 contrib/libg++/libg++/src/gen/SkipSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SkipSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/SplayBag.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SplayBag.hP delete mode 100644 contrib/libg++/libg++/src/gen/SplayMap.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SplayMap.hP delete mode 100644 contrib/libg++/libg++/src/gen/SplayNode.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SplayNode.hP delete mode 100644 contrib/libg++/libg++/src/gen/SplayPQ.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SplayPQ.hP delete mode 100644 contrib/libg++/libg++/src/gen/SplaySet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/SplaySet.hP delete mode 100644 contrib/libg++/libg++/src/gen/Stack.ccP delete mode 100644 contrib/libg++/libg++/src/gen/Stack.hP delete mode 100644 contrib/libg++/libg++/src/gen/VHBag.ccP delete mode 100644 contrib/libg++/libg++/src/gen/VHBag.hP delete mode 100644 contrib/libg++/libg++/src/gen/VHMap.ccP delete mode 100644 contrib/libg++/libg++/src/gen/VHMap.hP delete mode 100644 contrib/libg++/libg++/src/gen/VHSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/VHSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/VOHSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/VOHSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/VQueue.ccP delete mode 100644 contrib/libg++/libg++/src/gen/VQueue.hP delete mode 100644 contrib/libg++/libg++/src/gen/VStack.ccP delete mode 100644 contrib/libg++/libg++/src/gen/VStack.hP delete mode 100644 contrib/libg++/libg++/src/gen/Vec.ccP delete mode 100644 contrib/libg++/libg++/src/gen/Vec.hP delete mode 100644 contrib/libg++/libg++/src/gen/XPBag.ccP delete mode 100644 contrib/libg++/libg++/src/gen/XPBag.hP delete mode 100644 contrib/libg++/libg++/src/gen/XPDeque.ccP delete mode 100644 contrib/libg++/libg++/src/gen/XPDeque.hP delete mode 100644 contrib/libg++/libg++/src/gen/XPPQ.ccP delete mode 100644 contrib/libg++/libg++/src/gen/XPPQ.hP delete mode 100644 contrib/libg++/libg++/src/gen/XPQueue.ccP delete mode 100644 contrib/libg++/libg++/src/gen/XPQueue.hP delete mode 100644 contrib/libg++/libg++/src/gen/XPSet.ccP delete mode 100644 contrib/libg++/libg++/src/gen/XPSet.hP delete mode 100644 contrib/libg++/libg++/src/gen/XPStack.ccP delete mode 100644 contrib/libg++/libg++/src/gen/XPStack.hP delete mode 100644 contrib/libg++/libg++/src/gen/XPlex.ccP delete mode 100644 contrib/libg++/libg++/src/gen/XPlex.hP delete mode 100644 contrib/libg++/libg++/src/gen/defs.hP delete mode 100644 contrib/libg++/libg++/src/gen/intSList.hP delete mode 100644 contrib/libg++/libg++/src/gen/intVec.hP delete mode 100644 contrib/libg++/libg++/src/generic.h delete mode 100644 contrib/libg++/libg++/src/getpagesize.h delete mode 100644 contrib/libg++/libg++/src/hash.cc delete mode 100644 contrib/libg++/libg++/src/ioob.cc delete mode 100644 contrib/libg++/libg++/src/lg.cc delete mode 100644 contrib/libg++/libg++/src/libc.h delete mode 100644 contrib/libg++/libg++/src/malloc.c delete mode 100644 contrib/libg++/libg++/src/minmax.cc delete mode 100644 contrib/libg++/libg++/src/minmax.h delete mode 100644 contrib/libg++/libg++/src/osfcn.h delete mode 100644 contrib/libg++/libg++/src/pow.cc delete mode 100644 contrib/libg++/libg++/src/sqrt.cc delete mode 100644 contrib/libg++/libg++/src/std.h delete mode 100644 contrib/libg++/libg++/src/strclass.h delete mode 100644 contrib/libg++/libg++/src/swap.h delete mode 100644 contrib/libg++/libg++/src/sysent.h delete mode 100644 contrib/libg++/libg++/src/timer.c delete mode 100644 contrib/libg++/libg++/src/typemacros.h delete mode 100644 contrib/libg++/libg++/test-install/ChangeLog delete mode 100644 contrib/libg++/libg++/test-install/Foo.cc delete mode 100644 contrib/libg++/libg++/test-install/Foo.h delete mode 100644 contrib/libg++/libg++/test-install/Makefile.in delete mode 100644 contrib/libg++/libg++/test-install/a.cc delete mode 100644 contrib/libg++/libg++/test-install/bf.cc delete mode 100644 contrib/libg++/libg++/test-install/bm.cc delete mode 100644 contrib/libg++/libg++/test-install/configure.in delete mode 100644 contrib/libg++/libg++/test-install/ex_bar.cc delete mode 100644 contrib/libg++/libg++/test-install/expected.out delete mode 100644 contrib/libg++/libg++/test-install/foo_func.cc delete mode 100644 contrib/libg++/libg++/test-install/foo_main.cc delete mode 100644 contrib/libg++/libg++/tests/ChangeLog delete mode 100644 contrib/libg++/libg++/tests/Makefile.in delete mode 100755 contrib/libg++/libg++/tests/Makefile.sh delete mode 100644 contrib/libg++/libg++/tests/configure.in delete mode 100644 contrib/libg++/libg++/tests/depend delete mode 100644 contrib/libg++/libg++/tests/tBag.cc delete mode 100644 contrib/libg++/libg++/tests/tBag.exp delete mode 100644 contrib/libg++/libg++/tests/tBag.inp delete mode 100644 contrib/libg++/libg++/tests/tBitSet.cc delete mode 100644 contrib/libg++/libg++/tests/tBitSet.exp delete mode 100644 contrib/libg++/libg++/tests/tBitSet.inp delete mode 100644 contrib/libg++/libg++/tests/tBitString.cc delete mode 100644 contrib/libg++/libg++/tests/tBitString.exp delete mode 100644 contrib/libg++/libg++/tests/tBitString.inp delete mode 100644 contrib/libg++/libg++/tests/tCurses.cc delete mode 100644 contrib/libg++/libg++/tests/tCurses.inp delete mode 100644 contrib/libg++/libg++/tests/tDeque.cc delete mode 100644 contrib/libg++/libg++/tests/tDeque.exp delete mode 100644 contrib/libg++/libg++/tests/tDeque.inp delete mode 100644 contrib/libg++/libg++/tests/tFile.cc delete mode 100644 contrib/libg++/libg++/tests/tFile.exp delete mode 100644 contrib/libg++/libg++/tests/tFile.inp delete mode 100644 contrib/libg++/libg++/tests/tFix.cc delete mode 100644 contrib/libg++/libg++/tests/tFix.exp delete mode 100644 contrib/libg++/libg++/tests/tFix.inp delete mode 100644 contrib/libg++/libg++/tests/tFix16.cc delete mode 100644 contrib/libg++/libg++/tests/tFix16.exp delete mode 100644 contrib/libg++/libg++/tests/tFix16.inp delete mode 100644 contrib/libg++/libg++/tests/tFix24.cc delete mode 100644 contrib/libg++/libg++/tests/tFix24.exp delete mode 100644 contrib/libg++/libg++/tests/tFix24.inp delete mode 100644 contrib/libg++/libg++/tests/tGetOpt.cc delete mode 100644 contrib/libg++/libg++/tests/tGetOpt.exp delete mode 100644 contrib/libg++/libg++/tests/tGetOpt.inp delete mode 100644 contrib/libg++/libg++/tests/tInteger.cc delete mode 100644 contrib/libg++/libg++/tests/tInteger.exp delete mode 100644 contrib/libg++/libg++/tests/tInteger.inp delete mode 100644 contrib/libg++/libg++/tests/tLList.cc delete mode 100644 contrib/libg++/libg++/tests/tLList.exp delete mode 100644 contrib/libg++/libg++/tests/tLList.inp delete mode 100644 contrib/libg++/libg++/tests/tList.cc delete mode 100644 contrib/libg++/libg++/tests/tList.exp delete mode 100644 contrib/libg++/libg++/tests/tList.inp delete mode 100644 contrib/libg++/libg++/tests/tMap.cc delete mode 100644 contrib/libg++/libg++/tests/tMap.exp delete mode 100644 contrib/libg++/libg++/tests/tMap.inp delete mode 100644 contrib/libg++/libg++/tests/tObstack.cc delete mode 100644 contrib/libg++/libg++/tests/tObstack.exp delete mode 100644 contrib/libg++/libg++/tests/tObstack.inp delete mode 100644 contrib/libg++/libg++/tests/tPQ.cc delete mode 100644 contrib/libg++/libg++/tests/tPQ.exp delete mode 100644 contrib/libg++/libg++/tests/tPQ.inp delete mode 100644 contrib/libg++/libg++/tests/tPlex.cc delete mode 100644 contrib/libg++/libg++/tests/tPlex.exp delete mode 100644 contrib/libg++/libg++/tests/tPlex.inp delete mode 100644 contrib/libg++/libg++/tests/tQueue.cc delete mode 100644 contrib/libg++/libg++/tests/tQueue.exp delete mode 100644 contrib/libg++/libg++/tests/tQueue.inp delete mode 100644 contrib/libg++/libg++/tests/tRandom.cc delete mode 100644 contrib/libg++/libg++/tests/tRandom.exp delete mode 100644 contrib/libg++/libg++/tests/tRandom.inp delete mode 100644 contrib/libg++/libg++/tests/tRational.cc delete mode 100644 contrib/libg++/libg++/tests/tRational.exp delete mode 100644 contrib/libg++/libg++/tests/tRational.inp delete mode 100644 contrib/libg++/libg++/tests/tSet.cc delete mode 100644 contrib/libg++/libg++/tests/tSet.exp delete mode 100644 contrib/libg++/libg++/tests/tSet.inp delete mode 100644 contrib/libg++/libg++/tests/tStack.cc delete mode 100644 contrib/libg++/libg++/tests/tStack.exp delete mode 100644 contrib/libg++/libg++/tests/tStack.inp delete mode 100644 contrib/libg++/libg++/tests/tString.cc delete mode 100644 contrib/libg++/libg++/tests/tString.exp delete mode 100644 contrib/libg++/libg++/tests/tString.inp delete mode 100644 contrib/libg++/libg++/tests/tVec.cc delete mode 100644 contrib/libg++/libg++/tests/tVec.exp delete mode 100644 contrib/libg++/libg++/tests/tVec.inp delete mode 100644 contrib/libg++/libg++/tests/test_h.cc delete mode 100644 contrib/libg++/libg++/tests/tiLList.cc delete mode 100644 contrib/libg++/libg++/tests/tiLList.exp delete mode 100644 contrib/libg++/libiberty/ChangeLog delete mode 100644 contrib/libg++/libiberty/insque.c delete mode 100644 contrib/libg++/libiberty/strerror.c delete mode 100644 contrib/libg++/libio/ChangeLog delete mode 100644 contrib/libg++/libio/Makefile.in delete mode 100644 contrib/libg++/libio/NEWS delete mode 100644 contrib/libg++/libio/PlotFile.cc delete mode 100644 contrib/libg++/libio/PlotFile.h delete mode 100644 contrib/libg++/libio/README delete mode 100644 contrib/libg++/libio/SFile.cc delete mode 100644 contrib/libg++/libio/SFile.h delete mode 100644 contrib/libg++/libio/builtinbuf.cc delete mode 100644 contrib/libg++/libio/builtinbuf.h delete mode 100644 contrib/libg++/libio/cleanup.c delete mode 100644 contrib/libg++/libio/depend delete mode 100644 contrib/libg++/libio/editbuf.cc delete mode 100644 contrib/libg++/libio/editbuf.h delete mode 100644 contrib/libg++/libio/filebuf.cc delete mode 100644 contrib/libg++/libio/filedoalloc.c delete mode 100644 contrib/libg++/libio/fileops.c delete mode 100644 contrib/libg++/libio/floatconv.c delete mode 100644 contrib/libg++/libio/floatio.h delete mode 100644 contrib/libg++/libio/fstream.cc delete mode 100644 contrib/libg++/libio/fstream.h delete mode 100755 contrib/libg++/libio/gen-params delete mode 100644 contrib/libg++/libio/genops.c delete mode 100644 contrib/libg++/libio/indstream.cc delete mode 100644 contrib/libg++/libio/indstream.h delete mode 100644 contrib/libg++/libio/ioassign.cc delete mode 100644 contrib/libg++/libio/ioextend.cc delete mode 100644 contrib/libg++/libio/iofclose.c delete mode 100644 contrib/libg++/libio/iofdopen.c delete mode 100644 contrib/libg++/libio/iofflush.c delete mode 100644 contrib/libg++/libio/iofgetpos.c delete mode 100644 contrib/libg++/libio/iofgets.c delete mode 100644 contrib/libg++/libio/iofopen.c delete mode 100644 contrib/libg++/libio/iofprintf.c delete mode 100644 contrib/libg++/libio/iofputs.c delete mode 100644 contrib/libg++/libio/iofread.c delete mode 100644 contrib/libg++/libio/iofscanf.c delete mode 100644 contrib/libg++/libio/iofsetpos.c delete mode 100644 contrib/libg++/libio/ioftell.c delete mode 100644 contrib/libg++/libio/iofwrite.c delete mode 100644 contrib/libg++/libio/iogetdelim.c delete mode 100644 contrib/libg++/libio/iogetline.c delete mode 100644 contrib/libg++/libio/iogets.c delete mode 100644 contrib/libg++/libio/ioignore.c delete mode 100644 contrib/libg++/libio/iolibio.h delete mode 100644 contrib/libg++/libio/iomanip.cc delete mode 100644 contrib/libg++/libio/iomanip.h delete mode 100644 contrib/libg++/libio/iopadn.c delete mode 100644 contrib/libg++/libio/ioperror.c delete mode 100644 contrib/libg++/libio/iopopen.c delete mode 100644 contrib/libg++/libio/ioprims.c delete mode 100644 contrib/libg++/libio/ioprintf.c delete mode 100644 contrib/libg++/libio/ioputs.c delete mode 100644 contrib/libg++/libio/ioscanf.c delete mode 100644 contrib/libg++/libio/ioseekoff.c delete mode 100644 contrib/libg++/libio/ioseekpos.c delete mode 100644 contrib/libg++/libio/iosetbuffer.c delete mode 100644 contrib/libg++/libio/iosetvbuf.c delete mode 100644 contrib/libg++/libio/iosprintf.c delete mode 100644 contrib/libg++/libio/iosscanf.c delete mode 100644 contrib/libg++/libio/iostdio.h delete mode 100644 contrib/libg++/libio/iostream.cc delete mode 100644 contrib/libg++/libio/iostream.h delete mode 100644 contrib/libg++/libio/iostream.texi delete mode 100644 contrib/libg++/libio/iostreamP.h delete mode 100644 contrib/libg++/libio/iostrerror.c delete mode 100644 contrib/libg++/libio/ioungetc.c delete mode 100644 contrib/libg++/libio/iovfprintf.c delete mode 100644 contrib/libg++/libio/iovfscanf.c delete mode 100644 contrib/libg++/libio/iovsprintf.c delete mode 100644 contrib/libg++/libio/iovsscanf.c delete mode 100644 contrib/libg++/libio/isgetline.cc delete mode 100644 contrib/libg++/libio/isgetsb.cc delete mode 100644 contrib/libg++/libio/isscan.cc delete mode 100644 contrib/libg++/libio/istream.h delete mode 100644 contrib/libg++/libio/libio.h delete mode 100644 contrib/libg++/libio/libioP.h delete mode 100644 contrib/libg++/libio/osform.cc delete mode 100644 contrib/libg++/libio/ostream.h delete mode 100644 contrib/libg++/libio/outfloat.c delete mode 100644 contrib/libg++/libio/parsestream.cc delete mode 100644 contrib/libg++/libio/parsestream.h delete mode 100644 contrib/libg++/libio/pfstream.cc delete mode 100644 contrib/libg++/libio/pfstream.h delete mode 100644 contrib/libg++/libio/procbuf.cc delete mode 100644 contrib/libg++/libio/procbuf.h delete mode 100644 contrib/libg++/libio/sbform.cc delete mode 100644 contrib/libg++/libio/sbgetline.cc delete mode 100644 contrib/libg++/libio/sbscan.cc delete mode 100644 contrib/libg++/libio/stdfiles.c delete mode 100644 contrib/libg++/libio/stdiostream.cc delete mode 100644 contrib/libg++/libio/stdiostream.h delete mode 100644 contrib/libg++/libio/stdstrbufs.cc delete mode 100644 contrib/libg++/libio/stdstreams.cc delete mode 100644 contrib/libg++/libio/stream.cc delete mode 100644 contrib/libg++/libio/stream.h delete mode 100644 contrib/libg++/libio/streambuf.cc delete mode 100644 contrib/libg++/libio/streambuf.h delete mode 100644 contrib/libg++/libio/strfile.h delete mode 100644 contrib/libg++/libio/strops.c delete mode 100644 contrib/libg++/libio/strstream.cc delete mode 100644 contrib/libg++/libio/strstream.h delete mode 100644 contrib/libg++/libio/tests/ChangeLog delete mode 100644 contrib/libg++/libio/tests/Makefile.in delete mode 100644 contrib/libg++/libio/tests/configure.in delete mode 100644 contrib/libg++/libio/tests/hounddog.cc delete mode 100644 contrib/libg++/libio/tests/hounddog.exp delete mode 100644 contrib/libg++/libio/tests/hounddog.inp delete mode 100644 contrib/libg++/libio/tests/putbackdog.cc delete mode 100644 contrib/libg++/libio/tests/tFile.cc delete mode 100644 contrib/libg++/libio/tests/tFile.exp delete mode 100644 contrib/libg++/libio/tests/tFile.inp delete mode 100644 contrib/libg++/libio/tests/tfformat.c delete mode 100644 contrib/libg++/libio/tests/tiformat.c delete mode 100644 contrib/libg++/libio/tests/tiomanip.cc delete mode 100644 contrib/libg++/libio/tests/tiomanip.exp delete mode 100644 contrib/libg++/libio/tests/tiomisc.cc delete mode 100644 contrib/libg++/libio/tests/tiomisc.exp delete mode 100644 contrib/libg++/libio/tests/tstdiomisc.c delete mode 100644 contrib/libg++/libio/tests/tstdiomisc.exp delete mode 100644 contrib/libg++/librx/ChangeLog delete mode 100644 contrib/libg++/librx/DOC delete mode 100644 contrib/libg++/librx/rx.c delete mode 100644 contrib/libg++/librx/rx.h delete mode 100644 contrib/libg++/libstdc++/ChangeLog delete mode 100644 contrib/libg++/libstdc++/Makefile.in delete mode 100644 contrib/libg++/libstdc++/algorithm delete mode 100644 contrib/libg++/libstdc++/cassert delete mode 100644 contrib/libg++/libstdc++/cctype delete mode 100644 contrib/libg++/libstdc++/cerrno delete mode 100644 contrib/libg++/libstdc++/cfloat delete mode 100644 contrib/libg++/libstdc++/cinst.cc delete mode 100644 contrib/libg++/libstdc++/ciso646 delete mode 100644 contrib/libg++/libstdc++/climits delete mode 100644 contrib/libg++/libstdc++/clocale delete mode 100644 contrib/libg++/libstdc++/cmath delete mode 100644 contrib/libg++/libstdc++/cmathi.cc delete mode 100644 contrib/libg++/libstdc++/complex delete mode 100644 contrib/libg++/libstdc++/complex.h delete mode 100644 contrib/libg++/libstdc++/csetjmp delete mode 100644 contrib/libg++/libstdc++/csignal delete mode 100644 contrib/libg++/libstdc++/cstdarg delete mode 100644 contrib/libg++/libstdc++/cstddef delete mode 100644 contrib/libg++/libstdc++/cstdio delete mode 100644 contrib/libg++/libstdc++/cstdlib delete mode 100644 contrib/libg++/libstdc++/cstdlibi.cc delete mode 100644 contrib/libg++/libstdc++/cstring delete mode 100644 contrib/libg++/libstdc++/cstringi.cc delete mode 100644 contrib/libg++/libstdc++/ctime delete mode 100644 contrib/libg++/libstdc++/cwchar delete mode 100644 contrib/libg++/libstdc++/cwctype delete mode 100644 contrib/libg++/libstdc++/deque delete mode 100644 contrib/libg++/libstdc++/exception delete mode 100644 contrib/libg++/libstdc++/exceptioni.cc delete mode 100644 contrib/libg++/libstdc++/functional delete mode 100644 contrib/libg++/libstdc++/iterator delete mode 100644 contrib/libg++/libstdc++/list delete mode 100644 contrib/libg++/libstdc++/map delete mode 100644 contrib/libg++/libstdc++/memory delete mode 100644 contrib/libg++/libstdc++/new delete mode 100644 contrib/libg++/libstdc++/new.h delete mode 100644 contrib/libg++/libstdc++/newi.cc delete mode 100644 contrib/libg++/libstdc++/numeric delete mode 100644 contrib/libg++/libstdc++/queue delete mode 100644 contrib/libg++/libstdc++/set delete mode 100644 contrib/libg++/libstdc++/sinst.cc delete mode 100644 contrib/libg++/libstdc++/stack delete mode 100644 contrib/libg++/libstdc++/std/bastring.cc delete mode 100644 contrib/libg++/libstdc++/std/bastring.h delete mode 100644 contrib/libg++/libstdc++/std/cassert.h delete mode 100644 contrib/libg++/libstdc++/std/cctype.h delete mode 100644 contrib/libg++/libstdc++/std/cerrno.h delete mode 100644 contrib/libg++/libstdc++/std/cfloat.h delete mode 100644 contrib/libg++/libstdc++/std/cinst.h delete mode 100644 contrib/libg++/libstdc++/std/ciso646.h delete mode 100644 contrib/libg++/libstdc++/std/climits.h delete mode 100644 contrib/libg++/libstdc++/std/clocale.h delete mode 100644 contrib/libg++/libstdc++/std/cmath.h delete mode 100644 contrib/libg++/libstdc++/std/complex.h delete mode 100644 contrib/libg++/libstdc++/std/complext.cc delete mode 100644 contrib/libg++/libstdc++/std/complext.h delete mode 100644 contrib/libg++/libstdc++/std/csetjmp.h delete mode 100644 contrib/libg++/libstdc++/std/csignal.h delete mode 100644 contrib/libg++/libstdc++/std/cstdarg.h delete mode 100644 contrib/libg++/libstdc++/std/cstddef.h delete mode 100644 contrib/libg++/libstdc++/std/cstdio.h delete mode 100644 contrib/libg++/libstdc++/std/cstdlib.h delete mode 100644 contrib/libg++/libstdc++/std/cstring.h delete mode 100644 contrib/libg++/libstdc++/std/ctime.h delete mode 100644 contrib/libg++/libstdc++/std/cwchar.h delete mode 100644 contrib/libg++/libstdc++/std/cwctype.h delete mode 100644 contrib/libg++/libstdc++/std/dcomplex.h delete mode 100644 contrib/libg++/libstdc++/std/exception.h delete mode 100644 contrib/libg++/libstdc++/std/fcomplex.h delete mode 100644 contrib/libg++/libstdc++/std/ldcomplex.h delete mode 100644 contrib/libg++/libstdc++/std/new.h delete mode 100644 contrib/libg++/libstdc++/std/sinst.h delete mode 100644 contrib/libg++/libstdc++/std/stddef.h delete mode 100644 contrib/libg++/libstdc++/std/stdexcept.h delete mode 100644 contrib/libg++/libstdc++/std/straits.h delete mode 100644 contrib/libg++/libstdc++/std/string.h delete mode 100644 contrib/libg++/libstdc++/std/typeinfo.h delete mode 100644 contrib/libg++/libstdc++/stddef delete mode 100644 contrib/libg++/libstdc++/stddefi.cc delete mode 100644 contrib/libg++/libstdc++/stdexcept delete mode 100644 contrib/libg++/libstdc++/stdexcepti.cc delete mode 100644 contrib/libg++/libstdc++/stl.h delete mode 100644 contrib/libg++/libstdc++/stl/ChangeLog delete mode 100644 contrib/libg++/libstdc++/stl/Makefile.in delete mode 100644 contrib/libg++/libstdc++/stl/README delete mode 100644 contrib/libg++/libstdc++/stl/algo.h delete mode 100644 contrib/libg++/libstdc++/stl/algobase.h delete mode 100644 contrib/libg++/libstdc++/stl/bool.h delete mode 100644 contrib/libg++/libstdc++/stl/bvector.h delete mode 100644 contrib/libg++/libstdc++/stl/configure.in delete mode 100644 contrib/libg++/libstdc++/stl/defalloc.h delete mode 100644 contrib/libg++/libstdc++/stl/deque.h delete mode 100644 contrib/libg++/libstdc++/stl/faralloc.h delete mode 100644 contrib/libg++/libstdc++/stl/fdeque.h delete mode 100644 contrib/libg++/libstdc++/stl/flist.h delete mode 100644 contrib/libg++/libstdc++/stl/fmap.h delete mode 100644 contrib/libg++/libstdc++/stl/fmultmap.h delete mode 100644 contrib/libg++/libstdc++/stl/fmultset.h delete mode 100644 contrib/libg++/libstdc++/stl/fset.h delete mode 100644 contrib/libg++/libstdc++/stl/function.h delete mode 100644 contrib/libg++/libstdc++/stl/hdeque.h delete mode 100644 contrib/libg++/libstdc++/stl/heap.h delete mode 100644 contrib/libg++/libstdc++/stl/hlist.h delete mode 100644 contrib/libg++/libstdc++/stl/hmap.h delete mode 100644 contrib/libg++/libstdc++/stl/hmultmap.h delete mode 100644 contrib/libg++/libstdc++/stl/hmultset.h delete mode 100644 contrib/libg++/libstdc++/stl/hset.h delete mode 100644 contrib/libg++/libstdc++/stl/hugalloc.h delete mode 100644 contrib/libg++/libstdc++/stl/hvector.h delete mode 100644 contrib/libg++/libstdc++/stl/iterator.h delete mode 100644 contrib/libg++/libstdc++/stl/lbvector.h delete mode 100644 contrib/libg++/libstdc++/stl/ldeque.h delete mode 100644 contrib/libg++/libstdc++/stl/list.h delete mode 100644 contrib/libg++/libstdc++/stl/llist.h delete mode 100644 contrib/libg++/libstdc++/stl/lmap.h delete mode 100644 contrib/libg++/libstdc++/stl/lmultmap.h delete mode 100644 contrib/libg++/libstdc++/stl/lmultset.h delete mode 100644 contrib/libg++/libstdc++/stl/lngalloc.h delete mode 100644 contrib/libg++/libstdc++/stl/lset.h delete mode 100644 contrib/libg++/libstdc++/stl/map.h delete mode 100644 contrib/libg++/libstdc++/stl/multimap.h delete mode 100644 contrib/libg++/libstdc++/stl/multiset.h delete mode 100644 contrib/libg++/libstdc++/stl/neralloc.h delete mode 100644 contrib/libg++/libstdc++/stl/nmap.h delete mode 100644 contrib/libg++/libstdc++/stl/nmultmap.h delete mode 100644 contrib/libg++/libstdc++/stl/nmultset.h delete mode 100644 contrib/libg++/libstdc++/stl/nset.h delete mode 100644 contrib/libg++/libstdc++/stl/pair.h delete mode 100644 contrib/libg++/libstdc++/stl/projectn.h delete mode 100644 contrib/libg++/libstdc++/stl/random.cc delete mode 100644 contrib/libg++/libstdc++/stl/set.h delete mode 100644 contrib/libg++/libstdc++/stl/stack.h delete mode 100644 contrib/libg++/libstdc++/stl/tempbuf.cc delete mode 100644 contrib/libg++/libstdc++/stl/tempbuf.h delete mode 100644 contrib/libg++/libstdc++/stl/tree.cc delete mode 100644 contrib/libg++/libstdc++/stl/tree.h delete mode 100644 contrib/libg++/libstdc++/stl/vector.h delete mode 100644 contrib/libg++/libstdc++/string delete mode 100644 contrib/libg++/libstdc++/tests/ChangeLog delete mode 100644 contrib/libg++/libstdc++/tests/Makefile.in delete mode 100644 contrib/libg++/libstdc++/tests/configure.in delete mode 100644 contrib/libg++/libstdc++/tests/tcomplex.cc delete mode 100644 contrib/libg++/libstdc++/tests/tcomplex.exp delete mode 100644 contrib/libg++/libstdc++/tests/tcomplex.inp delete mode 100644 contrib/libg++/libstdc++/tests/tlist.cc delete mode 100644 contrib/libg++/libstdc++/tests/tlist.exp delete mode 100644 contrib/libg++/libstdc++/tests/tmap.cc delete mode 100644 contrib/libg++/libstdc++/tests/tmap.exp delete mode 100644 contrib/libg++/libstdc++/tests/tstring.cc delete mode 100644 contrib/libg++/libstdc++/tests/tstring.exp delete mode 100644 contrib/libg++/libstdc++/tests/tstring.inp delete mode 100644 contrib/libg++/libstdc++/tests/tvector.cc delete mode 100644 contrib/libg++/libstdc++/tests/tvector.exp delete mode 100644 contrib/libg++/libstdc++/typeinfo delete mode 100644 contrib/libg++/libstdc++/typeinfoi.cc delete mode 100644 contrib/libg++/libstdc++/utility delete mode 100644 contrib/libg++/libstdc++/vector delete mode 100644 contrib/libio/ChangeLog delete mode 100644 contrib/libio/Makefile.in delete mode 100644 contrib/libio/NEWS delete mode 100644 contrib/libio/PlotFile.cc delete mode 100644 contrib/libio/PlotFile.h delete mode 100644 contrib/libio/README delete mode 100644 contrib/libio/SFile.cc delete mode 100644 contrib/libio/SFile.h delete mode 100644 contrib/libio/builtinbuf.cc delete mode 100644 contrib/libio/builtinbuf.h delete mode 100644 contrib/libio/cleanup.c delete mode 100644 contrib/libio/config.shared delete mode 100644 contrib/libio/config/hpux.mt delete mode 100644 contrib/libio/config/isc.mt delete mode 100644 contrib/libio/config/linux.mt delete mode 100644 contrib/libio/config/linuxaxp1-libc-lock.h delete mode 100644 contrib/libio/config/linuxaxp1-stdio-lock.h delete mode 100644 contrib/libio/config/linuxaxp1.mt delete mode 100644 contrib/libio/config/linuxlibc1.mt delete mode 100644 contrib/libio/config/mn10200.mt delete mode 100644 contrib/libio/config/mtsafe.mt delete mode 100644 contrib/libio/config/netware.mt delete mode 100644 contrib/libio/config/sco4.mt delete mode 100644 contrib/libio/configure.in delete mode 100644 contrib/libio/dbz/Makefile.in delete mode 100644 contrib/libio/dbz/README delete mode 100644 contrib/libio/dbz/altbytes delete mode 100644 contrib/libio/dbz/byteflip.c delete mode 100644 contrib/libio/dbz/case.c delete mode 100644 contrib/libio/dbz/case.h delete mode 100644 contrib/libio/dbz/configure.in delete mode 100644 contrib/libio/dbz/dbz.1 delete mode 100644 contrib/libio/dbz/dbz.3z delete mode 100644 contrib/libio/dbz/dbz.c delete mode 100644 contrib/libio/dbz/dbz.h delete mode 100644 contrib/libio/dbz/dbzmain.c delete mode 100644 contrib/libio/dbz/fake.c delete mode 100644 contrib/libio/dbz/firstlast25 delete mode 100755 contrib/libio/dbz/getmap delete mode 100644 contrib/libio/dbz/random.c delete mode 100644 contrib/libio/dbz/revbytes delete mode 100644 contrib/libio/dbz/stdio.h delete mode 100644 contrib/libio/depend delete mode 100644 contrib/libio/editbuf.cc delete mode 100644 contrib/libio/editbuf.h delete mode 100644 contrib/libio/filebuf.cc delete mode 100644 contrib/libio/filedoalloc.c delete mode 100644 contrib/libio/fileops.c delete mode 100644 contrib/libio/floatconv.c delete mode 100644 contrib/libio/floatio.h delete mode 100644 contrib/libio/fstream.cc delete mode 100644 contrib/libio/fstream.h delete mode 100755 contrib/libio/gen-params delete mode 100644 contrib/libio/genops.c delete mode 100644 contrib/libio/include/empty.h delete mode 100644 contrib/libio/indstream.cc delete mode 100644 contrib/libio/indstream.h delete mode 100644 contrib/libio/ioassign.cc delete mode 100644 contrib/libio/ioextend.cc delete mode 100644 contrib/libio/iofclose.c delete mode 100644 contrib/libio/iofdopen.c delete mode 100644 contrib/libio/iofeof.c delete mode 100644 contrib/libio/ioferror.c delete mode 100644 contrib/libio/iofflush.c delete mode 100644 contrib/libio/iofflush_u.c delete mode 100644 contrib/libio/iofgetpos.c delete mode 100644 contrib/libio/iofgets.c delete mode 100644 contrib/libio/iofopen.c delete mode 100644 contrib/libio/iofprintf.c delete mode 100644 contrib/libio/iofputs.c delete mode 100644 contrib/libio/iofread.c delete mode 100644 contrib/libio/iofscanf.c delete mode 100644 contrib/libio/iofsetpos.c delete mode 100644 contrib/libio/ioftell.c delete mode 100644 contrib/libio/iofwrite.c delete mode 100644 contrib/libio/iogetc.c delete mode 100644 contrib/libio/iogetdelim.c delete mode 100644 contrib/libio/iogetline.c delete mode 100644 contrib/libio/iogets.c delete mode 100644 contrib/libio/ioignore.c delete mode 100644 contrib/libio/iolibio.h delete mode 100644 contrib/libio/iomanip.cc delete mode 100644 contrib/libio/iomanip.h delete mode 100644 contrib/libio/iopadn.c delete mode 100644 contrib/libio/ioperror.c delete mode 100644 contrib/libio/iopopen.c delete mode 100644 contrib/libio/ioprims.c delete mode 100644 contrib/libio/ioprintf.c delete mode 100644 contrib/libio/ioputc.c delete mode 100644 contrib/libio/ioputs.c delete mode 100644 contrib/libio/ioscanf.c delete mode 100644 contrib/libio/ioseekoff.c delete mode 100644 contrib/libio/ioseekpos.c delete mode 100644 contrib/libio/iosetbuffer.c delete mode 100644 contrib/libio/iosetvbuf.c delete mode 100644 contrib/libio/iosprintf.c delete mode 100644 contrib/libio/iosscanf.c delete mode 100644 contrib/libio/iostdio.h delete mode 100644 contrib/libio/iostream.cc delete mode 100644 contrib/libio/iostream.h delete mode 100644 contrib/libio/iostream.texi delete mode 100644 contrib/libio/iostreamP.h delete mode 100644 contrib/libio/iostrerror.c delete mode 100644 contrib/libio/ioungetc.c delete mode 100644 contrib/libio/iovfprintf.c delete mode 100644 contrib/libio/iovfscanf.c delete mode 100644 contrib/libio/iovsprintf.c delete mode 100644 contrib/libio/iovsscanf.c delete mode 100644 contrib/libio/isgetline.cc delete mode 100644 contrib/libio/isgetsb.cc delete mode 100644 contrib/libio/isscan.cc delete mode 100644 contrib/libio/istream.h delete mode 100644 contrib/libio/libio.h delete mode 100644 contrib/libio/libioP.h delete mode 100644 contrib/libio/osform.cc delete mode 100644 contrib/libio/ostream.h delete mode 100644 contrib/libio/outfloat.c delete mode 100644 contrib/libio/parsestream.cc delete mode 100644 contrib/libio/parsestream.h delete mode 100644 contrib/libio/peekc.c delete mode 100644 contrib/libio/pfstream.cc delete mode 100644 contrib/libio/pfstream.h delete mode 100644 contrib/libio/procbuf.cc delete mode 100644 contrib/libio/procbuf.h delete mode 100644 contrib/libio/sbform.cc delete mode 100644 contrib/libio/sbgetline.cc delete mode 100644 contrib/libio/sbscan.cc delete mode 100644 contrib/libio/stdfiles.c delete mode 100644 contrib/libio/stdio/ChangeLog delete mode 100644 contrib/libio/stdio/Makefile.in delete mode 100644 contrib/libio/stdio/clearerr.c delete mode 100644 contrib/libio/stdio/clearerr_u.c delete mode 100644 contrib/libio/stdio/configure.in delete mode 100644 contrib/libio/stdio/fdopen.c delete mode 100644 contrib/libio/stdio/feof.c delete mode 100644 contrib/libio/stdio/feof_u.c delete mode 100644 contrib/libio/stdio/ferror.c delete mode 100644 contrib/libio/stdio/ferror_u.c delete mode 100644 contrib/libio/stdio/fgetc.c delete mode 100644 contrib/libio/stdio/fileno.c delete mode 100644 contrib/libio/stdio/fputc.c delete mode 100644 contrib/libio/stdio/fputc_u.c delete mode 100644 contrib/libio/stdio/freopen.c delete mode 100644 contrib/libio/stdio/fseek.c delete mode 100644 contrib/libio/stdio/getc.c delete mode 100644 contrib/libio/stdio/getc_u.c delete mode 100644 contrib/libio/stdio/getchar.c delete mode 100644 contrib/libio/stdio/getchar_u.c delete mode 100644 contrib/libio/stdio/getline.c delete mode 100644 contrib/libio/stdio/getw.c delete mode 100644 contrib/libio/stdio/obprintf.c delete mode 100644 contrib/libio/stdio/popen.c delete mode 100644 contrib/libio/stdio/putc.c delete mode 100644 contrib/libio/stdio/putc_u.c delete mode 100644 contrib/libio/stdio/putchar.c delete mode 100644 contrib/libio/stdio/putchar_u.c delete mode 100644 contrib/libio/stdio/putw.c delete mode 100644 contrib/libio/stdio/rewind.c delete mode 100644 contrib/libio/stdio/setbuf.c delete mode 100644 contrib/libio/stdio/setfileno.c delete mode 100644 contrib/libio/stdio/setlinebuf.c delete mode 100644 contrib/libio/stdio/snprintf.c delete mode 100644 contrib/libio/stdio/stdio.h delete mode 100644 contrib/libio/stdio/vasprintf.c delete mode 100644 contrib/libio/stdio/vfprintf.c delete mode 100644 contrib/libio/stdio/vfscanf.c delete mode 100644 contrib/libio/stdio/vprintf.c delete mode 100644 contrib/libio/stdio/vscanf.c delete mode 100644 contrib/libio/stdio/vsnprintf.c delete mode 100644 contrib/libio/stdiostream.cc delete mode 100644 contrib/libio/stdiostream.h delete mode 100644 contrib/libio/stdstrbufs.cc delete mode 100644 contrib/libio/stdstreams.cc delete mode 100644 contrib/libio/stream.cc delete mode 100644 contrib/libio/stream.h delete mode 100644 contrib/libio/streambuf.cc delete mode 100644 contrib/libio/streambuf.h delete mode 100644 contrib/libio/strfile.h delete mode 100644 contrib/libio/strops.c delete mode 100644 contrib/libio/strstream.cc delete mode 100644 contrib/libio/strstream.h delete mode 100644 contrib/libio/tests/ChangeLog delete mode 100644 contrib/libio/tests/Makefile.in delete mode 100644 contrib/libio/tests/configure.in delete mode 100644 contrib/libio/tests/hounddog.cc delete mode 100644 contrib/libio/tests/hounddog.exp delete mode 100644 contrib/libio/tests/hounddog.inp delete mode 100644 contrib/libio/tests/putbackdog.cc delete mode 100644 contrib/libio/tests/tFile.cc delete mode 100644 contrib/libio/tests/tFile.exp delete mode 100644 contrib/libio/tests/tFile.inp delete mode 100644 contrib/libio/tests/tfformat.c delete mode 100644 contrib/libio/tests/tiformat.c delete mode 100644 contrib/libio/tests/tiomanip.cc delete mode 100644 contrib/libio/tests/tiomanip.exp delete mode 100644 contrib/libio/tests/tiomisc.cc delete mode 100644 contrib/libio/tests/tiomisc.exp delete mode 100644 contrib/libio/tests/tstdiomisc.c delete mode 100644 contrib/libio/tests/tstdiomisc.exp delete mode 100644 contrib/libio/testsuite/ChangeLog delete mode 100644 contrib/libio/testsuite/Makefile.in delete mode 100644 contrib/libio/testsuite/config/default.exp delete mode 100644 contrib/libio/testsuite/configure.in delete mode 100644 contrib/libio/testsuite/lib/libio.exp delete mode 100644 contrib/libio/testsuite/libio.tests/hounddog.exp delete mode 100644 contrib/libio/testsuite/libio.tests/putbackdog.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tFile.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tfformat.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tiformat.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tiomanip.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tiomisc.exp delete mode 100644 contrib/libio/testsuite/libio.tests/tstdiomisc.exp delete mode 100644 contrib/libobjc/ChangeLog delete mode 100644 contrib/libobjc/Makefile.in delete mode 100644 contrib/libobjc/NXConstStr.m delete mode 100644 contrib/libobjc/Object.m delete mode 100644 contrib/libobjc/Protocol.m delete mode 100644 contrib/libobjc/README delete mode 100644 contrib/libobjc/README.threads delete mode 100644 contrib/libobjc/THREADS delete mode 100644 contrib/libobjc/THREADS.MACH delete mode 100644 contrib/libobjc/archive.c delete mode 100644 contrib/libobjc/class.c delete mode 100755 contrib/libobjc/configure delete mode 100644 contrib/libobjc/configure.in delete mode 100644 contrib/libobjc/encoding.c delete mode 100644 contrib/libobjc/gc.c delete mode 100644 contrib/libobjc/hash.c delete mode 100644 contrib/libobjc/init.c delete mode 100644 contrib/libobjc/libobjc.def delete mode 100644 contrib/libobjc/libobjc_entry.c delete mode 100644 contrib/libobjc/linking.m delete mode 100644 contrib/libobjc/makefile.dos delete mode 100644 contrib/libobjc/misc.c delete mode 100644 contrib/libobjc/nil_method.c delete mode 100644 contrib/libobjc/objc-features.texi delete mode 100644 contrib/libobjc/objc/NXConstStr.h delete mode 100644 contrib/libobjc/objc/Object.h delete mode 100644 contrib/libobjc/objc/Protocol.h delete mode 100644 contrib/libobjc/objc/encoding.h delete mode 100644 contrib/libobjc/objc/hash.h delete mode 100644 contrib/libobjc/objc/objc-api.h delete mode 100644 contrib/libobjc/objc/objc-list.h delete mode 100644 contrib/libobjc/objc/objc.h delete mode 100644 contrib/libobjc/objc/runtime.h delete mode 100644 contrib/libobjc/objc/sarray.h delete mode 100644 contrib/libobjc/objc/thr.h delete mode 100644 contrib/libobjc/objc/typedstream.h delete mode 100644 contrib/libobjc/objects.c delete mode 100644 contrib/libobjc/sarray.c delete mode 100644 contrib/libobjc/selector.c delete mode 100644 contrib/libobjc/sendmsg.c delete mode 100644 contrib/libobjc/thr-dce.c delete mode 100644 contrib/libobjc/thr-decosf1.c delete mode 100644 contrib/libobjc/thr-irix.c delete mode 100644 contrib/libobjc/thr-mach.c delete mode 100644 contrib/libobjc/thr-os2.c delete mode 100644 contrib/libobjc/thr-posix.c delete mode 100644 contrib/libobjc/thr-pthreads.c delete mode 100644 contrib/libobjc/thr-single.c delete mode 100644 contrib/libobjc/thr-solaris.c delete mode 100644 contrib/libobjc/thr-vxworks.c delete mode 100644 contrib/libobjc/thr-win32.c delete mode 100644 contrib/libobjc/thr.c delete mode 100644 contrib/libstdc++/ChangeLog delete mode 100644 contrib/libstdc++/Makefile.in delete mode 100644 contrib/libstdc++/NEWS delete mode 100644 contrib/libstdc++/cassert delete mode 100644 contrib/libstdc++/cctype delete mode 100644 contrib/libstdc++/cerrno delete mode 100644 contrib/libstdc++/cfloat delete mode 100644 contrib/libstdc++/cinst.cc delete mode 100644 contrib/libstdc++/ciso646 delete mode 100644 contrib/libstdc++/climits delete mode 100644 contrib/libstdc++/clocale delete mode 100644 contrib/libstdc++/cmath delete mode 100644 contrib/libstdc++/cmathi.cc delete mode 100644 contrib/libstdc++/complex delete mode 100644 contrib/libstdc++/complex.h delete mode 100644 contrib/libstdc++/config/aix.ml delete mode 100644 contrib/libstdc++/config/dec-osf.ml delete mode 100644 contrib/libstdc++/config/delta.mt delete mode 100644 contrib/libstdc++/config/elf.ml delete mode 100644 contrib/libstdc++/config/elfshlibm.ml delete mode 100644 contrib/libstdc++/config/freebsd.ml delete mode 100644 contrib/libstdc++/config/gnu.ml delete mode 100644 contrib/libstdc++/config/hpux.ml delete mode 100644 contrib/libstdc++/config/irix5.ml delete mode 100644 contrib/libstdc++/config/linux.ml delete mode 100644 contrib/libstdc++/config/linux.mt delete mode 100644 contrib/libstdc++/config/openbsd.ml delete mode 100644 contrib/libstdc++/config/openbsd.mt delete mode 100644 contrib/libstdc++/config/posix.mt delete mode 100644 contrib/libstdc++/config/sol2pth.mt delete mode 100644 contrib/libstdc++/config/sol2shm.ml delete mode 100644 contrib/libstdc++/config/sol2solth.mt delete mode 100644 contrib/libstdc++/config/sunos4.ml delete mode 100644 contrib/libstdc++/config/x86-interix.ml delete mode 100644 contrib/libstdc++/configure.in delete mode 100644 contrib/libstdc++/csetjmp delete mode 100644 contrib/libstdc++/csignal delete mode 100644 contrib/libstdc++/cstdarg delete mode 100644 contrib/libstdc++/cstddef delete mode 100644 contrib/libstdc++/cstdio delete mode 100644 contrib/libstdc++/cstdlib delete mode 100644 contrib/libstdc++/cstdlibi.cc delete mode 100644 contrib/libstdc++/cstring delete mode 100644 contrib/libstdc++/cstringi.cc delete mode 100644 contrib/libstdc++/ctime delete mode 100644 contrib/libstdc++/cwchar delete mode 100644 contrib/libstdc++/cwctype delete mode 100644 contrib/libstdc++/fstream delete mode 100644 contrib/libstdc++/iomanip delete mode 100644 contrib/libstdc++/iosfwd delete mode 100644 contrib/libstdc++/iostream delete mode 100644 contrib/libstdc++/sinst.cc delete mode 100644 contrib/libstdc++/sstream delete mode 100644 contrib/libstdc++/std/bastring.cc delete mode 100644 contrib/libstdc++/std/bastring.h delete mode 100644 contrib/libstdc++/std/complext.cc delete mode 100644 contrib/libstdc++/std/complext.h delete mode 100644 contrib/libstdc++/std/dcomplex.h delete mode 100644 contrib/libstdc++/std/fcomplex.h delete mode 100644 contrib/libstdc++/std/gslice.h delete mode 100644 contrib/libstdc++/std/gslice_array.h delete mode 100644 contrib/libstdc++/std/indirect_array.h delete mode 100644 contrib/libstdc++/std/ldcomplex.h delete mode 100644 contrib/libstdc++/std/mask_array.h delete mode 100644 contrib/libstdc++/std/slice.h delete mode 100644 contrib/libstdc++/std/slice_array.h delete mode 100644 contrib/libstdc++/std/std_valarray.h delete mode 100644 contrib/libstdc++/std/straits.h delete mode 100644 contrib/libstdc++/std/valarray_array.h delete mode 100644 contrib/libstdc++/std/valarray_array.tcc delete mode 100644 contrib/libstdc++/std/valarray_meta.h delete mode 100644 contrib/libstdc++/stdexcept delete mode 100644 contrib/libstdc++/stdexcepti.cc delete mode 100644 contrib/libstdc++/stl.h delete mode 100644 contrib/libstdc++/stl/ChangeLog delete mode 100644 contrib/libstdc++/stl/README delete mode 100644 contrib/libstdc++/stl/algo.h delete mode 100644 contrib/libstdc++/stl/algobase.h delete mode 100644 contrib/libstdc++/stl/algorithm delete mode 100644 contrib/libstdc++/stl/alloc.h delete mode 100644 contrib/libstdc++/stl/bitset delete mode 100644 contrib/libstdc++/stl/bvector.h delete mode 100644 contrib/libstdc++/stl/defalloc.h delete mode 100644 contrib/libstdc++/stl/deque delete mode 100644 contrib/libstdc++/stl/deque.h delete mode 100644 contrib/libstdc++/stl/function.h delete mode 100644 contrib/libstdc++/stl/functional delete mode 100644 contrib/libstdc++/stl/hash_map delete mode 100644 contrib/libstdc++/stl/hash_map.h delete mode 100644 contrib/libstdc++/stl/hash_set delete mode 100644 contrib/libstdc++/stl/hash_set.h delete mode 100644 contrib/libstdc++/stl/hashtable.h delete mode 100644 contrib/libstdc++/stl/heap.h delete mode 100644 contrib/libstdc++/stl/iterator delete mode 100644 contrib/libstdc++/stl/iterator.h delete mode 100644 contrib/libstdc++/stl/list delete mode 100644 contrib/libstdc++/stl/list.h delete mode 100644 contrib/libstdc++/stl/map delete mode 100644 contrib/libstdc++/stl/map.h delete mode 100644 contrib/libstdc++/stl/memory delete mode 100644 contrib/libstdc++/stl/multimap.h delete mode 100644 contrib/libstdc++/stl/multiset.h delete mode 100644 contrib/libstdc++/stl/numeric delete mode 100644 contrib/libstdc++/stl/pair.h delete mode 100644 contrib/libstdc++/stl/pthread_alloc delete mode 100644 contrib/libstdc++/stl/pthread_alloc.h delete mode 100644 contrib/libstdc++/stl/queue delete mode 100644 contrib/libstdc++/stl/rope delete mode 100644 contrib/libstdc++/stl/rope.h delete mode 100644 contrib/libstdc++/stl/ropeimpl.h delete mode 100644 contrib/libstdc++/stl/set delete mode 100644 contrib/libstdc++/stl/set.h delete mode 100644 contrib/libstdc++/stl/slist delete mode 100644 contrib/libstdc++/stl/slist.h delete mode 100644 contrib/libstdc++/stl/stack delete mode 100644 contrib/libstdc++/stl/stack.h delete mode 100644 contrib/libstdc++/stl/stl_algo.h delete mode 100644 contrib/libstdc++/stl/stl_algobase.h delete mode 100644 contrib/libstdc++/stl/stl_alloc.h delete mode 100644 contrib/libstdc++/stl/stl_bvector.h delete mode 100644 contrib/libstdc++/stl/stl_config.h delete mode 100644 contrib/libstdc++/stl/stl_construct.h delete mode 100644 contrib/libstdc++/stl/stl_deque.h delete mode 100644 contrib/libstdc++/stl/stl_function.h delete mode 100644 contrib/libstdc++/stl/stl_hash_fun.h delete mode 100644 contrib/libstdc++/stl/stl_hash_map.h delete mode 100644 contrib/libstdc++/stl/stl_hash_set.h delete mode 100644 contrib/libstdc++/stl/stl_hashtable.h delete mode 100644 contrib/libstdc++/stl/stl_heap.h delete mode 100644 contrib/libstdc++/stl/stl_iterator.h delete mode 100644 contrib/libstdc++/stl/stl_list.h delete mode 100644 contrib/libstdc++/stl/stl_map.h delete mode 100644 contrib/libstdc++/stl/stl_multimap.h delete mode 100644 contrib/libstdc++/stl/stl_multiset.h delete mode 100644 contrib/libstdc++/stl/stl_numeric.h delete mode 100644 contrib/libstdc++/stl/stl_pair.h delete mode 100644 contrib/libstdc++/stl/stl_queue.h delete mode 100644 contrib/libstdc++/stl/stl_raw_storage_iter.h delete mode 100644 contrib/libstdc++/stl/stl_relops.h delete mode 100644 contrib/libstdc++/stl/stl_rope.h delete mode 100644 contrib/libstdc++/stl/stl_set.h delete mode 100644 contrib/libstdc++/stl/stl_slist.h delete mode 100644 contrib/libstdc++/stl/stl_stack.h delete mode 100644 contrib/libstdc++/stl/stl_tempbuf.h delete mode 100644 contrib/libstdc++/stl/stl_tree.h delete mode 100644 contrib/libstdc++/stl/stl_uninitialized.h delete mode 100644 contrib/libstdc++/stl/stl_vector.h delete mode 100644 contrib/libstdc++/stl/tempbuf.h delete mode 100644 contrib/libstdc++/stl/tree.h delete mode 100644 contrib/libstdc++/stl/type_traits.h delete mode 100644 contrib/libstdc++/stl/utility delete mode 100644 contrib/libstdc++/stl/vector delete mode 100644 contrib/libstdc++/stl/vector.h delete mode 100644 contrib/libstdc++/stlinst.cc delete mode 100644 contrib/libstdc++/string delete mode 100644 contrib/libstdc++/strstream delete mode 100644 contrib/libstdc++/tests/ChangeLog delete mode 100644 contrib/libstdc++/tests/Makefile.in delete mode 100644 contrib/libstdc++/tests/configure.in delete mode 100644 contrib/libstdc++/tests/tcomplex.cc delete mode 100644 contrib/libstdc++/tests/tcomplex.exp delete mode 100644 contrib/libstdc++/tests/tcomplex.inp delete mode 100644 contrib/libstdc++/tests/tlist.cc delete mode 100644 contrib/libstdc++/tests/tlist.exp delete mode 100644 contrib/libstdc++/tests/tmap.cc delete mode 100644 contrib/libstdc++/tests/tmap.exp delete mode 100644 contrib/libstdc++/tests/tstring.cc delete mode 100644 contrib/libstdc++/tests/tstring.exp delete mode 100644 contrib/libstdc++/tests/tstring.inp delete mode 100644 contrib/libstdc++/tests/tvector.cc delete mode 100644 contrib/libstdc++/tests/tvector.exp delete mode 100644 contrib/libstdc++/testsuite/ChangeLog delete mode 100644 contrib/libstdc++/testsuite/Makefile.in delete mode 100644 contrib/libstdc++/testsuite/config/default.exp delete mode 100644 contrib/libstdc++/testsuite/configure.in delete mode 100644 contrib/libstdc++/testsuite/lib/libstdc++.exp delete mode 100644 contrib/libstdc++/testsuite/libstdc++.tests/test.exp delete mode 100644 contrib/libstdc++/valarray delete mode 100644 contrib/libstdc++/valarray.cc diff --git a/contrib/gcc/BUGS b/contrib/gcc/BUGS deleted file mode 100644 index 2d875a092efb..000000000000 --- a/contrib/gcc/BUGS +++ /dev/null @@ -1,27 +0,0 @@ -If you think you may have found a bug in GCC, please -read the Bugs section of the GCC manual for advice on - -(1) how to tell when to report a bug, -(2) where to send your bug report, and -(3) how to write a useful bug report and what information -it needs to have. - -There are three ways to read the Bugs section. - -(1) In a printed copy of the GCC manual. You can order one from the -Free Software Foundation; see the file ORDERS. But if you don't have -a copy on hand and you think you have found a bug, you shouldn't wait -to get a printed manual; you should read the section right away as -described below. - -(2) With Info. Start Emacs, do C-h i to enter Info, -then m gcc RET to get to the GCC manual, then m Bugs RET -to get to the section on bugs. Or use standalone Info in -a like manner. (Standalone Info is part of the Texinfo distribution.) - -(3) By hand. Search for the chapter "Reporting Bugs" in gcc.texi, or - cat /usr/local/info/gcc* | more "+/^File: gcc.info, Node: Bugs," - -You may also want to take a look at the GCC FAQ, in which there are -additional instructions for submitting bug reports: - http://www.gnu.org/software/gcc/faq.html#bugreport diff --git a/contrib/gcc/COPYING b/contrib/gcc/COPYING deleted file mode 100644 index 60549be514af..000000000000 --- a/contrib/gcc/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program 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 of the License, or - (at your option) any later version. - - This program 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. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/contrib/gcc/COPYING.LIB b/contrib/gcc/COPYING.LIB deleted file mode 100644 index 161a3d1d47b9..000000000000 --- a/contrib/gcc/COPYING.LIB +++ /dev/null @@ -1,482 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/contrib/gcc/ChangeLog b/contrib/gcc/ChangeLog deleted file mode 100644 index 61272bd79e77..000000000000 --- a/contrib/gcc/ChangeLog +++ /dev/null @@ -1,17450 +0,0 @@ -Fri May 26 10:30:02 2000 Richard Earnshaw (rearnsha@arm.com) - - * arm.md (negdi2): Add clobber of condition code register. - -Wed May 24 00:25:45 2000 Alexandre Oliva - - 2000-05-22 Richard Henderson - * function.c (thread_prologue_and_epilogue_insns): Make sure - existing line number notes appear after the prologue. - -2000-05-16 Franz Sirl - - * sysv4.h (CPP_OS_LINUX_SPEC): Define __unix and __linux according - to given options. - -2000-05-14 Franz Sirl - - * rs6000/rs6000.md (nonlocal_goto_receiver): Add length attribute. - -Wed Apr 12 00:42:19 2000 Jeffrey A Law (law@cygnus.com) - - 2000-02-19 Richard Henderson - * c-typeck.c (add_pending_init): Don't abort for multiple - fields at the same offset. - (pending_init_member): Test the correct member. - - Wed Apr 12 00:44:31 2000 Jeffrey A Law (law@cygnus.com) - * config/i386/freebsd-elf.h (DEFAULT_VTABLE_THUNKS): Changed to 2. - - Tue Nov 9 17:14:40 1999 H.J. Lu - * invoke.texi (-fvtable-thunks): Document that Linux/GNU uses - version 2 as default. - - Tue Nov 9 10:16:55 1999 H.J. Lu - * alpha/linux-elf.h (DEFAULT_VTABLE_THUNKS): Changed to 2. - * arm/linux-elf.h: Likewise. - * rs6000/linux.h: Likewise. - * sparc/linux.h: Likewise. - - Mon Nov 8 14:41:34 1999 H.J. Lu - * config/linux.h (DEFAULT_VTABLE_THUNKS): Changed to 2. - - Sun May 2 08:49:27 1999 Martin von Löwis - * invoke.texi (-fvtable-thunks): Document numeric argument. - -2000-04-11 Alexandre Oliva - - * config/elfos.h (SELECT_SECTION): Decide whether to use a data or - const section to output a CONSTRUCTOR based on the same conditions - used for VAR_DECLs. - -Mon Apr 3 02:31:32 2000 Jeffrey A Law (law@cygnus.com) - - 2000-01-20 Michael Hayes - * unroll.c (loop_iterations): Don't abort if REG_USERVAR_P set - on iteration_var. - -Wed Mar 22 13:11:54 2000 David Edelsohn - - * rs6000.c (reg_or_u_cint_operand): New function. - (logical_operand): Handle 64-bit hosts. - (logical_u_operand): New function. - (non_logical_cint_operand): Handle 64-bit hosts. - (non_logical_u_cint_operand): New function. - (expand_block_move): Allow 8 DImode loads for PowerPC64. - * rs6000.h (PREDICATE_CODES): Define new functions. - * rs6000.md (iordi3, xordi3): Constant int must be unsigned 32-bits. - (movdi_64): Bracket code intended for 64-bit hosts. Create - CONST_DOUBLE for 32-bit values. - - * glimits.h (__LONG_MAX__): Recognize 64-bit AIX too. - -Wed Mar 22 13:11:54 2000 Gabriel Paubert - - * rs6000.md: Correct instructions length attributes and - constraints on unsigned compare instructions. - (*ne0): Disable for PowerPC64. - -Tue Mar 7 21:41:17 2000 Jeffrey A Law (law@cygnus.com) - - * cccp.c (handle_directive): Initialize backslash_newlines_p. - - Wed Jan 19 20:39:17 2000 Jim Wilson - * fixinc/inclhack.tpl: Test for directory before trying to cd into it. - * fixinc/fixincl.sh, fixinc/inclhack.sh: Regenerate. - - Tue Oct 12 09:45:19 1999 Jonathan Larmour - * config/rs6000/eabi-ctors.c (__do_global_ctors): Run through - __CTOR_LIST__ in opposite order, which is the correct order for sorted - constructors. - (__do_global_dtors): similarly for __DTOR_LIST__. - - 2000-01-05 Bernd Schmidt - * reload1.c (choose_reload_regs): When disabling a reload, also - set reload_spill_index to -1. - - Thu Nov 4 15:52:35 1999 Andrew Haley - * reload1.c (reload_reg_free_for_value_p): Don't use a register - that is in reload_reg_used. - - 2000-01-18 Clinton Popetz - * loop.c (check_dbra_loop): When checking a loop for - reversability, check the source of any stores to ensure they - don't depend on an initial value. - - Sat Jan 8 12:12:46 2000 Nick Clifton - * config/v850/v850.c (expand_epilogue): Interrupt functions no - longer allocate extra stack for function calls. - -Fri Feb 18 13:32:32 2000 Martin von Loewis - - * gcc.texi (Bug Reporting): Refer to bugs.html. - (Bug Lists): Likewise. - * system.h (GCCBUGURL): New preprocessor define. - (abort): Use it. - * gcc.c (main): Likewise. - -Thu Feb 3 10:53:45 2000 Richard Henderson - - Wed Nov 3 10:10:58 1999 Richard Henderson - * c-decl.c (duplicate_decls): Copy DECL_MODE too. - -Thu Jan 20 10:02:07 2000 Richard Henderson - - 2000-01-03 Anthony Green - * config/i386/i386.md (builtin_setjmp_receiver): New pattern. - Restore the pic register if required. - -Fri Jan 7 14:40:05 2000 Richard Henderson - - Thu Oct 28 18:06:50 1999 Richard Kenner - * stmt.c (expand_value_return): Correctly convert VAL when promoting - function return. - -Tue Jan 4 02:22:27 2000 Jeffrey A Law (law@cygnus.com) - - Mon Oct 18 18:50:51 1999 Andreas Schwab - * config/m68k/m68k.h (INITIAL_FRAME_POINTER_OFFSET): Add one word - if the pic register is used. - - Sat Sep 25 13:11:07 1999 Jeffrey A Law (law@cygnus.com) - * cse.c: Update comments. - (cse_insn): When converting a conditional/computed jump into - an unconditional jump, always make sure a BARRIER immediately - follows the converted jump. Do not delete unreachable code. - (cse_basic_block): Do not delete unreachable code. - * toplev.c (rest_of_compilation): Move call to - delete_trivially_dead_insns after the conditional call to - jump_optimize. - - -Wed Dec 29 22:47:43 1999 Jeffrey A Law (law@cygnus.com) - - 1999-12-12 Stephen L Moshier - * loop.c (load_mems): Don't hoist written floating point mem - if -ffloat-store. - - * cppinit.c (is_idchar): Only use special initialization for - gcc-2.8 and later versions of the compiler. - - Wed Oct 27 01:42:26 1999 Scott Christley - * sparc.md (call): Don't bound structure return size to 0xfff. - -Mon Dec 27 07:32:59 1999 Jeffrey A Law (law@cygnus.com) - - Fri Sep 3 10:16:37 HST 1999 Glen Nakamura - * cccp.c (rescan): Fixed obp pointer handling around call to - check_expand subroutine. - - Thu Sep 16 00:46:35 1999 Geoff Keating - * loop.c (basic_induction_var): A non-integer variable which is - being set by a paradoxical subreg is probably not a biv. - - 1999-08-31 12:20 -0700 Zack Weinberg - * loop.c (check_dbra_loop): Check bl->biv->add_val is a - CONST_INT before using its INTVAL. - - Tue Nov 2 15:27:31 1999 Alexandre Oliva - * configure.in (m68k-hp-hpux*, xm_alloca.h): The underscore should - have been an hyphen, fixed. - * configure: Rebuilt. - -Thu Dec 23 11:59:56 1999 Jeffrey A Law (law@cygnus.com) - - 1999-12-23 Martin v. Löwis - * fold-const.c (operand_equal_p): Use memcmp to compare string - constants. - Suggested by D. J. Bernstein - - Thu Dec 16 02:26:11 1999 Jeffrey A Law (law@cygnus.com) - * h8300.md (HImode preinc peephole): Fix typo. - - 1999-12-14 Bernd Schmidt - * loop.c (check_dbra_loop): Can't reverse a biv that has - maybe_multiple set. - -1999-12-07 Martin v. Löwis - - * invoke.texi (C Dialect Options): Remove -flang-c9x, add -std - documentation. - -Sun Oct 31 22:32:17 1999 Alexandre Oliva - - * config/i386/sol2gas.h: I had installed the wrong version of Sept - 22's patch in the release branch. Fixed. - * configure.in: Likewise. - * configure: Rebuilt. - Reported by Jason Beardsley - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -Mon Oct 25 00:43:05 1999 Jeffrey A Law (law@cygnus.com) - - * loop.c (note_set_pseudo_multiple_uses_retval): New variable. - (note_set_pseudo_multiple_uses): New function. - (check_dbra_loop): Use not_set_pseudo_multiple_uses to determine - if a pseudo set in the loop exit is used elsewhere. - -Wed Oct 20 10:46:41 1999 Richard Earnshaw (rearnsha@arm.com) - - * jump.c (jump_optimize_1): More accurately detect casesi insns. - -Wed Oct 20 22:57:58 1999 Jeffrey A Law (law@cygnus.com) - - * toplev.c (main): Do not turn on strict aliasing by default. - * invoke.texi: Corresponding changes. - - * sparc.md (movsf_const_intreg): If splitting, length must be > 1. - (movdf_const_intreg_sp64): Similarly. - - * local-alloc.c (update_equiv_regs): Check the correct insn - for pre-existing REG_EQUIV notes. - -Tue Oct 19 02:03:00 1999 Jeffrey A Law (law@cygnus.com) - - Revert this change. Gavin's patch to operand_equal_p is a better fix. - * fold-const.c (fold_range_test): Do not try to fold the range - test if the rhs or lhs has side effects. - - Fri Sep 17 15:05:27 1999 Gavin Romig-Koch - * fold-const.c (operand_equal_p): Pay attention to side effects. - - * reg-stack.c (stack_result): Aggregates are not returned in - stack registers. - -Mon Oct 18 01:41:35 1999 Jeffrey A Law (law@cygnus.com) - - * combine.c (get_last_value): If the last set of a register - is after subst_low_cuid, then we can not use it to determine - the register's last value. - -Sat Oct 16 15:20:15 1999 Jeffrey A Law (law@cygnus.com) - - Sat Oct 16 00:07:01 1999 Richard Henderson - * gcse.c (hash_expr_1): Add in MEM_ALIAS_SET. - (expr_equiv_p): Reject memories with different alias sets. - -Wed Oct 13 01:46:14 1999 Jeffrey A Law (law@cygnus.com) - - Wed Oct 13 01:44:29 1999 Carol LePage - * configure.in (sparc-hal-solaris2*): Fix xm_file, xm_defines, - float_format and thread_file definitions. - * configure: Rebuilt. - -Tue Oct 12 17:09:38 1999 David Edelsohn - - * collect2.c (main): Do preliminary link on AIX if rflag. - -Mon Oct 11 23:35:19 1999 Jeffrey A Law (law@cygnus.com) - - Fri Sep 3 09:14:32 1999 Marc Espie - * tlink.c (scan_linker_output): Skip the initial underscore in - a mangled name if appropriate. - - Fri Aug 27 19:19:43 CEST 1999 Marc Espie - * config/openbsd.h (SET_ASM_OP): Define. - - Mon Oct 4 08:54:12 1999 Alexandre Oliva - * cppinit.c (is_idchar initializer): Loosen tests to accept - gcc 2.>6 and >2. - - Tue Jun 29 01:37:53 1999 Jeffrey A Law (law@cygnus.com) - * pa.h (CPP_SPEC): Conditionally add -D__STDC_EXT__ to the cpp - command line. - - Thu Sep 2 20:08:23 1999 J"orn Rennecke - * regmove.c (fixup_match_1): Don't change an unchanging register. - (stable_but_for_p): Renamed to: - (stable_and_no_regs_but_for_p). Reject unchanging registers too. - Changed all callers. - - Tue Aug 17 22:06:11 1999 Jan Hubicka - * haifa-sched.c (insn_unit): Fix typo on out of range test. - * sched.c (insn_unit): Likewise. - -Sun Oct 10 20:58:27 1999 David Edelsohn - - * rs6000.md (scc patterns): Disable most SImode variants if - TARGET_POWERPC64. - * rs6000.c (expand_block_move): Fix gen_movsi typos. - - Thu Oct 7 23:06:50 1999 Richard Henderson - * rs6000.md (fix_truncdfsi2_internal+1): Emit a clobber - before the fctiwz insn. - - Thu Oct 7 00:36:17 1999 Diego Novillo - * config/rs6000/rs6000.c (secondary_reload_class): For TARGET_ELF - make sure that HIGH instructions are copied into BASE_REGS. - -Thu Sep 30 05:40:34 1999 Richard Earnshaw - - * c-lang.c (finish_file case ndef ASM_OUTPUT_{CON,DE}STRUCTOR): - Correctly build argument list to constructor and destructor functions. - -Wed Sep 22 17:55:31 1999 David Edelsohn - - * rs6000.c (expand_block_move): DImode loads and stores require - word-aligned displacements. Increment address registers with - adddi3 on 64-bit platform. Use TARGET_POWERPC64 not TARGET_64BIT. - -Wed Sep 22 07:07:44 1999 Alexandre Oliva - - * config/i386/sol2.h (PREFERRED_DEBUGGING_TYPE): Use stabs. - (ASM_SPEC): Moved from sol2dbg.h. Added work-around for gas. - * config/i386/sol2dbg.h: Removed. - * config/i386/sol2gas.h: New file, to enable gas work-around. - * configure.in: Use i386/sol2gas.h on Solaris/x86 --with-gas. - Don't use sol2dbg.h. - * configure: Rebuilt. - -Wed Sep 15 21:20:38 1999 Mark Mitchell - - * c-typeck.c (qualify_type): Merge qualifiers from both types. - -Wed Sep 15 10:07:27 1999 Scott Bambrough - - * config/arm/linux-elf.h: define NO_IMPLICIT_EXTERN_C - -Tue Sep 7 16:50:59 1999 David Edelsohn - - * rs6000.h (ASM_FILE_START): Specify complete filename, including - path, in .file directive. - -Tue Sep 7 01:27:21 1999 Jeffrey A Law (law@cygnus.com) - - Thu Sep 2 00:06:43 1999 Jeffrey A Law (law@cygnus.com) - * fold-const.c (fold_range_test): Do not try to fold the range - test if the rhs or lhs has side effects. - - Sun Aug 29 03:27:23 1999 Scott Weikart - * fix-header.c (main): Do not pass a null pointer to strcmp. - - Thu Aug 19 14:42:38 1999 Mike Stump - Mark Mitchell - * c-common.c (c_get_alias_set): Fix support for pointers and - references. - - Fri Aug 27 01:03:48 1999 Jim Kingdon - with much help from Jeffrey A Law and Richard Henderson - * i386.md: In the 6 insns which call output_fix_trunc, - earlyclobber operands[0]. - - Fri Aug 27 01:01:51 1999 Philip Blundell - * jump.c (duplicate_loop_exit_test): Call reg_scan_update after - creating new registers. - - Fri Aug 27 15:35:24 1999 Jeffrey A Law (law@cygnus.com) - * cse.c (fold_rtx): Work around bug in Sun V5.0 compilers. - * pa.c (emit_move_sequence): Do not stop on SUBREG_WORD of an - operand. - - Tue Aug 31 11:51:06 1999 Jim Kingdon - * i386.c (output_strlen_unroll): Don't write xops[7] - label if it wasn't set. - - Fri Aug 27 09:36:17 1999 Andreas Schwab - * function.c (assign_stack_temp_for_type): Fix change of Mar 5 for - the fact that ALIGN is measured in bits, not bytes. - - Wed Aug 25 14:00:18 1999 Jason Merrill - * c-common.c (combine_strings): Always set TREE_CONSTANT. - -Wed Aug 18 01:16:43 1999 David S. Miller - - * config/sparc/sparc.c (sparc_block_profiler): Fix typo in Aug 2 - change. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -1999-08-13 Michael Meissner - - * Makefile.in (GCC_FOR_TARGET): Move -B./ after the tooldir -B. - -Fri Aug 13 01:42:24 1999 Jeffrey A Law (law@cygnus.com) - - Tue Aug 3 00:03:41 1999 Kaveh R. Ghazi - * fixincludes: Fix the return type of bsearch, char* -> void*. - * fixinc/inclhack.def: Likewise. - -Fri Aug 13 01:29:57 1999 Alexandre Oliva - - * dwarfout.c (fundamental_type_code): Return FT_boolean for - INTEGER_TYPE with precision==1, it's __java_boolean. - -1999-08-11 Richard Earnshaw (rearnsha@arm.com) - - * emit-rtl.c (mark_reg_pointer): Don't increase the alignment of - a register that is already known to be a pointer. - -1999-08-11 Bruce Korb - - * fixinc/inclhack.tpl: Only install assert.h conditionally. - * fixinc/inclhack.sh: Regenerated. - * fixinc/fixincl.sh: Regenerated. - -Wed Aug 11 00:34:22 1999 Joe Buck - - * invoke.texi: s/GNU CC/GCC/ for consistency with gcc.texi. - Fix documentation of -ansi flag to describe its C++ behavior. - Remove bogus reference to GCC 2.9. - -Tue Aug 10 22:40:36 1999 Jeffrey A Law (law@cygnus.com) - - Thu Aug 5 22:27:15 1999 J"orn Rennecke - * config/sh/lib1funcs.asm (___movstrSI0): Change or r0,r0,r0 to nop. - (___mulsi3): Use '!' comment character. - -Sat Aug 7 00:06:30 1999 Jeffrey A Law (law@cygnus.com) - - * gcc.texi: Update bug reporting text. - - Tue Jul 20 17:07:54 1999 Richard Henderson - * rs6000.h (struct rs6000_args): Add sysv_gregno. - * rs6000.c (init_cumulative_args): Init sysv_gregno. - (function_arg_boundary): Align DFmode. - (function_arg_advance): Restructure for ABI_V4; use sysv_gregno - to get fp reg and stack overflow correct. - (function_arg): Likewise. - (function_arg_pass_by_reference): True for TFmode for ABI_V4. - (setup_incoming_varargs): Restructure for ABI_V4; use - function_arg_advance to skip final named argument. - (expand_builtin_saveregs): Properly unskip the last integer arg - when doing varargs. Adjust overflow location calculation. - * ginclude/va-ppc.h (struct __va_list_tag): Make gpr and fpr - explicitly unsigned. - (__VA_FP_REGSAVE): Use new OFS argument instead of AP->fpr directly. - (__VA_GP_REGSAVE): Similarly. - (__va_longlong_p): Delete. - (__va_arg_type_violation): New declaration. - (va_arg): Restructure. Flag promotion errors. Align double. - TFmode passed by reference. - * rs6000.md (movdi_32+1): Use GEN_INT after arithmetic - in the HOST_BITS_PER_WIDE_INT > 32 case. - -1999-08-6 Herman A.J. ten Brugge - - * reg-stack.c (change_stack) Fixed problem with negative array index. - -Fri Aug 6 20:41:08 1999 Jeffrey A Law (law@cygnus.com) - - Mon Jul 19 15:09:29 1999 David Edelsohn - * rs6000.md (arithmetic, logical, and shift Rc combiner patterns): - Disable patterns performing SImode comparisons with SImode values - if TARGET_POWERPC64 and instruction does not sign-extend or does - not mask to narrower than SImode, i.e. where bit 31 and bit 63 may - differ for signed quantities. - (indirect_jump): Add expander to choose RTL based on TARGET_64BIT. - (tablejump): Patterns contingent on TARGET_64BIT not TARGET_POWERPC64. - (decrement_and_branch_on_count): Add 64-bit variant. - -Thu Aug 5 02:40:42 1999 Jeffrey A Law (law@cygnus.com) - - * gcc.c: Update URLs and mail addresses. - * gcc.texi: Likewise. - -Thu Aug 5 01:14:13 1999 Daniel Jacobowitz - - * rs6000.c (current_file_function_operand): Return zero for - weak functions. - (rs6000_encode_section_info): Do not set SYMBOL_REF_FLAG for - weak symbols. - * rs6000.h (ENCODE_SECTION_NIFO): Do not set SYMBOL_REF_FLAG - for weak symbols. - -Thu Aug 5 00:56:30 1999 Geoffrey Keating - - * rs6000.c (rs6000_stack_info): For ABI_V4/ABI_SOLARIS -fpic, always - allocate space in the stack frame for the PIC register. - -Thu Aug 5 00:20:47 1999 Jeffrey A Law (law@cygnus.com) - - * m68k.md (xordi3, anddi3): These patterns are not available on - the coldfire. - -Wed Aug 4 23:39:20 1999 Mark Mitchell - - * real.c (GET_REAL): Don't violate ANSI/ISO aliasing rules. - (PUT_REAL): Likewise. - -Wed Aug 4 02:15:32 1999 Richard Henderson - - * jump.c (delete_insn): Delete the addr_vec when deleting a tablejump. - -Wed Aug 4 01:08:44 1999 Jeffrey A Law (law@cygnus.com) - - * flow.c (delete_unreachable_blocks): Do not call merge_blocks - or tidy_fallthru_edge if the last insn in the block is not - an unconditional jump or a simple conditional jump. - -Tue Aug 3 03:51:20 1999 Jeffrey A Law (law@cygnus.com) - - * cse.c (cse_insn): Fix dumb thinko in last change. - -Mon Aug 2 23:45:45 1999 Hans-Peter Nilsson - - * dwarf2out.c (add_location_or_const_value_attribute): Correct - test for sizes of passed and declared parameter types. - -Mon Aug 2 12:45:09 1999 Richard Henderson - - * alpha.c (override_options): Don't force ALPHA_TP_PROG for ev6. - -Mon Aug 2 01:34:22 1999 Jeffrey A Law (law@cygnus.com) - - * fix-header.c (main): When testing for CONTINUED, use string - equality, not pointer equality. - -Mon Aug 2 01:27:24 1999 Dan Nicolaescu - - * sparc.c (sparc_block_profiler): Use the %g2 register, not %o0. - -Sun Aug 1 22:46:42 1999 Jeffrey A Law (law@cygnus.com) - - * cse.c (cse_insn): Fix loop which deletes insns after a jump - that has become an unconditional jump. - - * m68k.c (output_function_prologue): Fix typo in CPU32 case. - (output_function_epilogue): Similarly. - - Tue Jul 20 12:37:30 1999 Hans-Peter Nilsson - * dwarf2out.c (output_abbrev_section): Terminate with a zero. - - Thu Jul 15 15:40:09 1999 Jim Wilson - * tree.c (build_type_attribute_variant): Move current_obstack restore - after build_qualified_type call. - - Fri Jun 4 03:20:40 1999 J"orn Rennecke - * sh.c (fixup_addr_diff_vecs): Emit braf reference label. - (braf_label_ref_operand): Delete. - * sh.h (PREDICATE_CODES): Remove braf_label_ref_operand. - * sh.md (casesi_jump_2): Operand1 is now the inside of a - label_ref, and has no predicate. - The patten has a predicate to guard against invalid substitutions. - (dummy_jump): Delete. - (casesi): Update use of casesi_jump_2. - -Thu Jul 31 12:34:45 1999 Joe Buck - - * gcc.texi: Use terms "GNU Compiler Collection" and "GCC". - Also update copyright. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - - * verison.c: No longer a prerelease. - -Wed Jul 28 13:49:03 1999 Jeffrey A Law (law@cygnus.com) - - * README: Update. - -Sun Jul 25 21:40:33 1999 Jeffrey A Law (law@cygnus.com) - - * gcc.texi: More changes related to list conversion. - * invoke.texi: Likewise. - -Sat Jul 17 23:58:24 1999 David Edelsohn - - * rs6000.md (insv, extzv): Remove SImode dependence in named - patterns. Explicitly generate DImode RTL if PowerPC64 and - operand is DImode. - (insvdi): Reverse start and size in instruction template. - -1999-07-17 Alexandre Oliva - - * gcc.texi: Update e-mail addresses and URLs to gcc.gnu.org. - Removed paragraph about compression of files and size limitation, - duplicated in the FAQ. Use gcc-patches for posting patches. - * gcc.c (main): Updated URL with bug reporting instructions to - gcc.gnu.org. Removed e-mail address. - * system.h (abort): Likewise. - -1999-07-17 Kaveh R. Ghazi - - * Makefile.in (stmp-multilib-sub): Make the files extracted - from $(LIBGCC1) writable. - -Fri Jul 16 01:39:57 1999 Jeffrey A Law (law@cygnus.com) - - * m68k.c (output_function_prologue): Fix computation of save mask - when generating PIC code. - -1999-07-12 Joseph S. Myers - - * invoke.texi: Typo fixes. - -Wed Jul 14 23:28:06 1999 Jeffrey A Law (law@cygnus.com) - - * emit-rtl.c (gen_realpart): Issue an error for cases GCC can not - handle at this time instead of silently generating incorrect code. - (gen_imagpart): Likewise. - - * reload.c (find_reloads): Emit a USE for a pseudo register without - a hard register if we could not create an optional reload for the - pseudo. - -Wed Jul 14 01:57:39 1999 Richard Henderson - - * regclass.c (scan_one_insn): Notice subregs that change the - size of their operand. - (record_reg_classes): Use that to obey CLASS_CANNOT_CHANGE_SIZE. - -Wed Jul 14 01:37:06 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in (alpha*-*-*): Include alpha/t-ieee. - * configure: Rebuilt. - * alpha/t-ieee: New file. - -Tue Jul 13 10:44:14 1999 Jeffrey A Law (law@cygnus.com) - - Wed Jun 16 20:29:00 1999 J"orn Rennecke - * cse.c (cse_insn): Don't put hard register source into tables for - the last insn of a libcall. - - * rs6000.c (find_addr_reg): Do not select r0 as an address - register. - -Tue Jul 13 00:46:18 1999 Philippe De Muyter - - * m68k/x-mot3300 (XCFLAGS): List of big files now includes `cse.o'. - -Mon Jul 12 23:39:08 1999 Jeffrey A Law (law@cygnus.com) - - * rs6000.md (movsf): Do not force easy FP constants into memory. - -Sun Jul 11 11:21:24 1999 Jason Merrill - - * toplev.c (main): Don't complain about saying -gdwarf. - -Fri Jul 9 03:51:52 1999 Jeffrey A Law (law@cygnus.com) - - * version.c: Drop "gcc-" prefix from version #. - -Thu Jul 8 19:15:51 1999 Jim Wilson - - * unroll.c (unroll_loops): Don't delete named CODE_LABEL or - NOTE_INSN_DELETED_LABEL note. - -Thu Jul 8 14:18:46 1999 Richard Henderson - - * m68k.c (output_function_prologue): Add pic register to mask - if live and flag_pic. - (output_function_epilogue): Likewise. - -Thu Jul 8 10:28:25 1999 Craig Burley - - * invoke.texi (DEC Alpha Options): Put @end table at - beginning of line, to avoid confusing texi2html. - -Wed Jul 7 02:00:04 1999 Franz Sirl - - * reload1.c (gen_reload): When synthesizing a 3 operand add - sequence, improve test for when to reload OP1 into the reload - register instead of OP0. - -Wed Jul 7 01:38:03 1999 Jim Wilson - - * unroll.c (unroll_loop): Don't delete NOTE_INSN_DELETED_LABEL notes. - -1999-07-07 Manfred Hollstein - - * m88k/dguxbcs.h (CPP_SPEC): Add missing \ in multi-line - string literal. - -Wed Jul 7 01:16:43 1999 Richard Henderson - - * ginclude/varargs.h (__builtin_va_alist_t): New typedef. - (va_dcl): Use __builtin_va_alist_t. - -Wed Jul 7 01:13:31 1999 Jason Merrill - - * dwarf2out.c (gen_struct_or_union_type_die): Only remember types - on the permanent_obstack. - * dwarfout.c (output_type): Likewise. - -Fri Jul 2 03:05:13 1999 Jeffrey A Law (law@cygnus.com) - - * dwarfout.c (field_byte_offset): Correctly compute the object's - byte offset for the first bit of a field which crosses an alignment - boundary on a !BYTES_BIG_ENDIAN target. - -Fri Jul 2 01:36:36 1999 Robert Lipe - - * fixinc.svr4: Fix by deleting protos for htons and - ntohs. - -Fri Jul 2 00:46:47 1999 Richard Henderson - Jeff Law - - * ginclude/varargs.h (va_dcl): Use word_mode for type of - __builtin_va_list. - - * except.c: Include intl.h. - (expand_eh_return): Set current_function_cannot_inline. - (save_eh_status, restore_eh_status): Twiddle eh_return_stub_label. - * function.h (struct function): Add eh_return_stub_label. - * flow.c (delete_unreachable_blocks): Don't merge across EH edges. - * Makefile.in (except.o): Depend on intl.h. - -Fri Jul 2 00:04:23 1999 David Edelsohn - - * rs6000.md (movdf_hardfloat32): Handle PRE_INC and PRE_DEC the - same as offsettable in cases 1 and 2. - -1999-07-01 Mark Kettenis - - * config/i386/gnu.h (CPP_SPEC): Define __PIC__ and __pic__ if - -fPIC or -fpic is specified. - -Wed Jun 30 23:56:01 1999 Jeffrey A Law (law@cygnus.com) - - * expr.c (emit_block_move): Use copy_to_mode_reg for - !TARGET_MEM_FUNCTIONS case too. - -Tue Jun 29 01:37:53 1999 Jeffrey A Law (law@cygnus.com) - - * mips.md (leasi, leadi): New patterns. - - * expr.c (emit_block_move): Properly handle case where one of the - block move arguments has a queued increment or decrement. - (clear_storage): Similarly. Fix formatting goof. - -Mon Jun 28 05:32:09 1999 Jeffrey A Law (law@cygnus.com) - - * m68k.h (CONDITIONAL_REGISTER_USAGE): Define for !SUN_FPA - case. Also make the PIC register call_used. - - * m68k.h (FINALIZE_PIC): Delete. - * m68k.c (finalize_pic): Delete. - - * m68k.h (CONDITIONAL_REGISTER_USAGE): Make the PIC register fixed - when -fpic/-fPIC. - -Mon Jun 28 05:16:35 1999 Richard Henderson - - * m68k.h (PREFERRED_RELOAD_CLASS): Don't force any FP const_doubles - to memory. - -Mon Jun 28 04:07:27 1999 David Edelsohn - - * rs6000.c (output_toc): Always use hex values for floating-point - constants. Store single-precision values in upper-half of TOC - entry in 64-bit mode. - * rs6000.md (floatsidf2, floatunssidf2): Add !TARGET_POWERPC64 - to final constraints. - (fix_truncdfsi2 splitter): Change pattern matching fctiwz. - (fctiwz): Improve accuracy of RTL for pattern. - - * rs6000.c (print_operand, case 'L'): Use plus_constant_for_output. - - * expmed.c (expand_divmod): Ensure unsigned value fits in reg_note. - -Fri Jun 25 06:06:37 1999 Richard Henderson - - * alpha.h (MASK_SUPPORT_ARCH, MASK_CPU_EV5, MASK_CPU_EV6): Define - such that MASK_SUPPORT_ARCH is not negative. - -Fri Jun 25 05:35:44 1999 Jeffrey A Law (law@cygnus.com) - - * loop.c (verify_dominator): Properly handle ADDR_VEC and - ADDR_DIFF_VEC insns that appear inside loops. - -Thu Jun 24 22:54:05 1999 David Edelsohn - Jeff Law - - * rs6000.md (movdf_hardfloat32): Revert previous patch. - Handle LO_SUM the same as offsettable in cases 1 and 2. - * rs6000.c (find_addr_reg): Revert previous patch. - -Thu Jun 24 22:43:12 1999 Philippe De Muyter - - * system.h (strstr): New external function declaration. - * acconfig.h (NEED_DECLARATION_STRSTR): New define slot. - * configure.in (GCC_NEED_DECLARATIONS): Check for strstr. - * config.in, configure: Rebuilt. - -1999-06-24 Tom Tromey - - * gcc.c (main): Read user-specified specs files after computing - additional startfile_prefixes. - -1999-06-24 Bruce Korb - - *fixinc/inclhack.def(end_else_label): combined else_label - and endif_label and fixed the sed expression. - *fixinc/{fixincl.x|inclhack.sh}: regen - -Tue Jun 22 01:58:18 1999 Jeffrey A Law (law@cygnus.com) - - * rs6000.md (movdf_hardfloat32): Use %X instead of always emitting - 'x' when handling non-offsettable addresses - -Tue Jun 22 00:20:05 1999 Richard Earnshaw (rearnsha@arm.com) - - * final.c (shorten_branches): Don't try to split an insn that has - been deleted. - -Mon Jun 21 23:32:17 1999 Jeffrey A Law (law@cygnus.com) - - Thu Jun 17 15:07 1999 Bruce Korb - * fixincludes: ISCNTL patch - -Mon Jun 21 22:15:50 1999 Jeffrey A Law (law@cygnus.com) - - * rs6000.c (find_addr_reg): Handle LO_SUM addresses. - -Mon Jun 21 22:14:05 1999 David Edelsohn - - * rs6000.md (movdf_hardfloat32): Fix typo. - -Mon Jun 21 20:10:42 1999 Richard Henderson - - * collect2.c (main): Log frame table count. - (GCC_OK_SYMBOL) [ECOFF]: Accept stGlobal. - (scan_prog_file) [COFF]: Handle frame tables. - - * alpha/alpha.h (UNALIGNED_SHORT_ASM_OP): Define. - (UNALIGNED_INT_ASM_OP, UNALIGNED_DOUBLE_INT_ASM_OP): Define. - * alpha/elf.h: Undef them again. - * alpha/vms.h: Remove their definitions. - -1999-06-21 Jakub Jelinek - - * real.c (ereal_from_double): Fix for 64-bit big endian hosts. - * emit-rtl.c (gen_lowpart_common): Add case for hosts where double - fits in HOST_WIDE_INT and one uses union to access a long constant - as double. - -Mon Jun 21 17:18:25 1999 Richard Henderson - - * sparc.c (sparc_override_options): Don't allow profiling for - code models other than medlow. - (sparc_function_profiler): New function from old FUNCTION_PROFILER - macro. Use ASM_GENERATE_INTERNAL_LABEL and MCOUNT_FUNCTION. - (sparc_function_block_profiler): Likewise. Use user_label_prefix. - (sparc_block_profiler): Likewise. - (sparc_function_block_profiler_exit): Likewise. - * sparc.h (FUNCTION_PROFILER): Call new sparc.c function. - (FUNCTION_BLOCK_PROFILER): Likewise. - (BLOCK_PROFILER): Likewise. - (FUNCTION_BLOCK_PROFILER_EXIT): Likewise. - (MCOUNT_FUNCTION): New. - * sparc/pbd.h (FUNCTION_PROFILER): Delete. - (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER): Delete. - * sparc/sun4o3.h (FUNCTION_PROFILER): Delete. - (MCOUNT_FUNCTION): New. - * sparc/sysv4.h (FUNCTION_BLOCK_PROFILER): Delete. - (BLOCK_PROFILER): Delete. - (MCOUNT_FUNCTION): New. - -Mon Jun 21 06:22:21 1999 Mark Elbrecht - - * i386/djgpp.h (LIB_SPEC): New. - (STARTFILE_SPEC): New. - - * i386/xm-djgpp.h (NO_SYS_SIGLIST): Deleted. Now obsolete. - -Mon Jun 21 06:19:33 1999 Philippe De Muyter - - * fixinc/Makefile.in (gnu-regex.o): Do not define STDC_HEADERS in - compiler flags. - - * system.h (WSTOPSIG): New macro. - -Mon Jun 21 05:33:15 1999 Mumit Khan - - * c-pragma.c (push_alignment): Don't ignore alignments greater than - 4 bytes. - (insert_pack_attributes): Take into account member natural - alignment. - - * i386/winnt.c (exports_head): New static variable. - (i386_pe_record_exported_symbol): New function. - (i386_pe_asm_file_end): Use. - * i386/cygwin.h (ASM_OUTPUT_COMMON): Record the exported - symbols to be emitted at end of assembly. - (ASM_DECLARE_OBJECT_NAME): Likewise. - (ASM_DECLARE_FUNCTION_NAME): Likewise. - - * i386/uwin.h (CPP_SPEC): Use -idirafter instead -iprefix and - -iwithprefix. - -Mon Jun 21 05:17:00 1999 David Edelsohn - - * rs6000.md (movdf_hardfloat32): Use worst case insn length - attributes for cases 1 and 2. - - * rs6000.c (find_addr_reg): New function. - * rs6000.h (find_addr_reg): Declare. - (offsettable_addr_operand): Delete. - * rs6000.md (movdf_hardfloat32): Handle non-offsettable loads - from and stores to GPRs. - -Mon Jun 21 04:44:31 1999 Jeffrey A Law (law@cygnus.com) - - * sparc.h (LEGITIMIZE_RELOAD_ADDRESS): Fix paren error introduced - in last change. - -Sun Jun 20 17:24:35 1999 Richard Henderson - - * haifa-sched.c (sched_analyze): Don't clear reg_last_uses on calls. - -Sat Jun 19 22:52:55 1999 Richard Henderson - - * haifa-sched.c (sched_analyze): Mark call-user regs as clobbered - instead of set. - -Sat Jun 19 05:40:07 1999 Philip Blundell - - * arm.c (arm_reload_in_hi): Invert sense of test on BYTES_BIG_ENDIAN. - -Sat Jun 19 05:25:05 1999 Richard Earnshaw (rearnsha@arm.com) - - * arm.h (CONDITIONAL_REGISTER_USAGE): If flag_pic, never use - PIC_OFFSET_TABLE_REGNUM for general alloaction. - (INITIAL_ELIMINATION_OFFSET): Count the fact that the PIC register - must be stacked if it is used for PIC accesses. - * arm.c (use_return_insn): Handle PIC register specially. - (output_return_instruction): Likewise. - (output_func_{prologue,epilogue}): Likewise. - (output_expand_prologue): Likewise. - - * arm.c (arm_override_options): Remove warning about PIC code - not being supported. - -Fri Jun 18 15:44:18 1999 Richard Henderson - - * alpha.c (alpha_expand_block_move): Use get_insns rather than - gen_sequence as argument to emit_no_conflict_block. - -Fri Jun 18 06:48:30 1999 Kaveh R. Ghazi - - * fixinc/inclhack.def (ioctl_fix_ctrl): Fix the definition of _*ISCTRL(). - * fixinc/{fixincl.x,inclhack.sh}: regen - -Thu Jun 17 13:28:30 1999 David O'Brien - - * i386/freebsd-elf.h (LINK_SPEC): Fix typo. - - * i386/freebsd-elf.h (FUNCTION_PROFILER): labels are not needed and - the reference to `mcount' was not correct for the ELF on FreeBSD. - -Thu Jun 17 02:54:30 1999 Jeffrey A Law (law@cygnus.com) - - * invoke.texi (ia32 options): Fix typo. - - * emit-rtl.c (operand_subword): Tighten checks for when it is safe - to safe to extract a subword out of a REG. - -Wed Jun 16 10:33:02 1999 Jason Merrill - - * dwarfout.c (add_incomplete_type): New fn. - (output_type): Call it. - (retry_incomplete_types): New fn. - (dwarfout_finish): Call it. - - From Eric Raskin : - (output_type): Output types for bases. - -Tue Jun 15 01:55:20 1999 David O'Brien - - * i386/freebsd-elf.h (LINK_SPEC): clean up the linking library - specifications and make it realistic. - (LIB_SPEC): Likewise. - -Mon Jun 14 03:55:40 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in (rs6000-ibm-aix4.3*, powerpc-ibm-aix4.3*): Do not - require a sub-version #. - * configure: Rebuilt. - -1999-06-14 Robert Lipe (robertlipe@usa.net) - - * svr4.h (DWARF2_DEBUGGING_INFO): Check for redefinition. - -1999-06-14 Andreas Jaeger - - * gcc.texi: Mention gcc 2.95 instead of egcs 1.00. - -Sun Jun 13 01:08:02 1999 Mark Mitchell - - * invoke.texi (node Option Summary): Add -fpermissive flag. - -Sat Jun 12 03:40:42 1999 Jeffrey A Law (law@cygnus.com) - - * sparc.h (LEGITIMIZE_RELOAD_ADDRESS): Do nothing with operands - that require PIC code sequences. - -Fri Jun 11 03:17:51 1999 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (libgcc2): Pass MAYBE_USE_COLLECT2 as an argument. - * libgcc2.c (__CTOR_LIST, __DTOR_LIST); Do not provide - initializers is some circumstances. - - * fixinc/inclhack.def (endif_label): Add additional selector for - more bogus stuff after #endif statements. - * fixinc/inclhack.sh, fixinc/fixincl.x: Rebuilt. - -Thu Jun 10 20:45:27 1999 Mumit Khan - - * i386/cygwin.h (SET_ASM_OP): Define. - -Thu Jun 10 20:37:57 1999 Mumit Khan - - * reg-stack.c (stack_reg_life_analysis): Find all the RETURN insns. - -Thu Jun 10 14:47:59 1999 Bruce Korb - - * fixinc/inclhack.def(sun_auth_proto): We do not know how to - test for the presence of valid prototypes. Delete bypass expr. - (ioctl_fix_ctrl): Correct the selection expression. - - * fixinc/inclhack.def(no_double_slash): fixed quoting rules - * fixinc/inclhack.sh: regen - * fixinc/fixincl.x: regen - -Thu Jun 10 01:22:59 1999 Jeffrey A Law (law@cygnus.com) - - * loop.c (strength_reduce): Disable biv->giv translations and - giv recombination. For the release branch only. - -Wed Jun 9 15:57:57 1999 Franz Sirl - - * rs6000.md (movsi_got_internal_mem): Delete. - * rs6000.h (CONDITIONAL_REGISTER_USAGE): Mark PIC_OFFSET_TABLE_REGNUM. - (GOT_TOC_REGNUM): Delete. - (PIC_OFFSET_TABLE_REGNUM): Define. - (FINALIZE_PIC): Disable. - * rs6000.c (rs6000_got_register): New code for fixed pic register. - (rs6000_replace_regno): Delete. - (rs6000_finalize_pic): Likewise. - (output_prolog): Handle PIC_OFFSET_TABLE_REGNUM. - -Wed Jun 9 19:44:26 1999 J"orn Rennecke - - * loop.c (loop_insn_first_p): Don't compare LUIDs when P - is a note; use <= for the compare; advance P while it is - a NOTE. - -Wed Jun 9 13:12:24 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc/inclhack.def (no_double_slash): Fix quoting for test. - * fixinc/inclhack.sh, fixinc/fixincl.x, fixinc/fixincl.sh; Rebuilt. - - * varasm.c (remove_from_pending_weak_list): Verify t->name - is non-NULL before passing it to strcmp. - -Wed Jun 9 23:01:17 1999 Michael Hayes - - * invoke.texi: Add C4x invocation docs. - -Wed Jun 9 22:42:49 1999 Michael Hayes - - * config/c4x/c4x.h (TARGET_EXPOSE_LDP, LEGITIMIZE_RELOAD_ADDRESS): - Define new macros. - * config/c4x/c4x.c (c4x_emit_move_sequence, src_operand): Use - TARGET_EXPOSE_LDP. - (c4x_legitimize_reload_address): New function. - * config/c4x/c4x.md: Update docs. - -Wed Jun 9 06:50 1999 Bruce Korb - - * fixinc/inclhack.def(sun_auth_proto): bypass the patch if - the typed arguments are not part of a comment - (ioctl_fix_ctrl): Added a purpose comment - * fixinc/fixincl.x: regenerate - * fixinc/inclhack.sh: regenerate - -Wed Jun 9 04:14:48 1999 Jeffrey A Law (law@cygnus.com) - - * fixincludes: Avoid removing '.'. - * fixinc/fixinc.svr4: Likewise. - * fixinc/fixinc.winnt: Likewise. - * fixinc/inclhack.tpl: Likewise. - * fixinc/fixincl.sh, fixinc/inclhack.sh: Rebuilt. - -Wed Jun 9 03:55:34 1999 Jim Wilson - - * configure.in (rs6000-ibm-aix4.[12]*): Change rx6000 to rs6000. - * configure: Regenerate. - - * configure.in (rs6000-ibm-aix4.[12]*): Delete use of aix41-gld.h. - Add use of x-aix41-gld. - -1999-06-09 Kaveh R. Ghazi - - * fixinc/inclhack.def (sun_catmacro): Escape parens in the select - pattern. - * fixinc/fixincl.x, fixinc/inclhack.sh: Rebuilt. - -Wed Jun 9 03:10:34 1999 Mumit Khan - - * c-pragma.c (handle_pragma_token): Handle `#pragma pack()' - correctly. - -Tue Jun 8 05:47:48 1999 Richard Earnshaw (rearnsha@arm.com) - - * optabs.c (expand_cmplxdiv_wide): Use expand_abs to get the absolute - values. - -Mon Jun 7 22:30:37 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc/inclhack.def (bad_lval): Remove bogus selector. - * fixinc/inclhack.sh, fixinc/fixincl.x, fixinc/fixincl.sh; Rebuilt. - - * fixinc/inclhack.def (avoid_bool): Also catch - "typedef [unsigned] int bool". - * fixinc/inclhack.sh, fixinc/fixincl.x, fixinc/fixincl.sh: Rebuilt. - - * m68k/x-hp3bsd44: Delete obsolete and incorrect file. - * configure.in (m68k-hp-bsd4.4): No longer use x-hp3bsd44. - * configure: Rebuilt. - -Mon Jun 7 22:05:03 1999 Mark Kettenis - - * config/i386/gnu.h: Include right after , - such that we can override its definitions if necessary. - (CPP_SPEC): New define. Support processor specific predefines via - %(cpp_cpu). - (CC1_SPEC): New define. Support processor specific compiler - options via %(cc1_cpu). - (STARTFILE_SPEC): New define. Use crt0.o instead of crt1.o for - -static. - -1999-06-07 Kaveh R. Ghazi - - * fixinc/inclhack.def (math_gcc_ifndefs): Insert whitespace - between sed's -e flag, and the open-quote following it. - * fixinc/fixincl.x, fixinc/fixincl.sh: Rebuilt. - -Mon Jun 7 20:34:20 1999 Robert Lipe - Jeffrey A Law (law@cygnus.com) - - * varasm.c (assemble_start_function): Remove the function - from the pending weak decls list when we define a function. - (assemble_variable): Similarly for variables. - (weak_finish): Ignore items on the list with a NULL name. - (remove_from_ending_weak_list); New function to "remove" an item - from the pending weak declarations list. - -Mon Jun 7 19:27:07 1999 Jerry Quinn - - * pa.md (fmpyfadd, fmpynfadd, fnegabs): New patterns. - -Sun Jun 6 11:58:34 1999 Jakub Jelinek - - * sparc.md (abstf2): This should be an expand. - (split after abstf2_notv9): Fix mode. - (abstf2_hq_v9): New pattern. - (abstf2_v9): Only use when no hard quad. - (absdf2_v9): Fix if target is not the same as source. - (ashrsi3_extend, ashrsi3_extend2, lshrsi3_extend, lshrsi3_extend2): - Add correct output constraints. - -Sat Jun 5 17:04:16 1999 Craig Burley - - From Dave Love to egcs-patches on 20 May 1999 17:38:38 +0100: - * invoke.texi: Clarify text vis-a-vis Intel CPUs. - -Fri Jun 4 13:30:27 1999 Rainer Orth - - * alpha/osf.h (CPP_SUBTARGET_SPEC): Handle -threads. - (LIB_SPEC): Likewise. - Link with -lprof1_r for -g/-pg. - -1999-06-04 Andreas Schwab - - * loop.c (check_dbra_loop): Fix change of Jan 19. - -Fri Jun 4 00:12:40 1999 Marc Espie - - * freebsd-elf.h (SWITCH_TAKES_ARG): Redefine, not define. - (STARTFILE_SPEC): Define, override the svr4.h version. - (ENDFILE_SPEC): Likewise. - -Thu Jun 3 23:58:55 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc/inclhack.def (limits_ifndefs): Also apply to sys/limits.h - * fixinc/fixincl.x: Regenerated. - * fixinc/inclhack.sh: Regenerated. - -Thu Jun 3 07:48 1999 Bruce Korb - - * fixinc/inclhack.def(Io_Def_Quotes): corrected sed expression - * fixinc/fixincl.x: regenerate - * fixinc/inclhack.sh: regenerate - -Thu Jun 3 22:27:50 1999 Robert Lipe - - * i386/udk.h (LINK_SPEC): Correct linker search path for - system libraries. - -Thu Jun 3 02:15:07 1999 Jason Merrill - - * dwarf2out.c (add_incomplete_type): New fn. - (gen_struct_or_union_type_die): Call it. - (retry_incomplete_types): New fn. - (dwarf2out_finish): Call it. - -Thu Jun 3 01:19:03 1999 Jeffrey A Law (law@cygnus.com) - - * gcse.c (insert_insn_end_bb): Correct placement of insns when the - current block starts with a CODE_LABEL and ends with a CALL and - we can not find all the argument setup instructions for the CALL. - -Wed Jun 2 12:25:55 1999 Richard Henderson - - * alpha.c (override_options): Thinko in last patch. - - * alpha/osf.h (CPP_SUBTARGET_SPEC): Define. - (LIB_SPEC): Recognize -pthread. - -Wed Jun 2 07:07 1999 Bruce Korb - - * fixinc/fixincl.c(global def): Add FD_SHELL_SCRIPT to mark - fixes that need "file=xxx\n" prepended before invocation - (start_fixer - new): starting the fixer process is complex enough - to warrent its own routine. It prepends the "file=xxx\n" stuff. - (process): uses the new routine; omit usage of putenv() - * fixinc/fixincl.tpl: mark shell scripts with FD_SHELL_SCRIPT - * fixinc/fixincl.x: regenerate - -Wed Jun 2 06:36:14 1999 Richard Earnshaw (rearnsha@arm.com) - - * arm.md (zero_extendqidi2): Don't allow operand1 to be a memory - reference. Temporary work-around for problems with constant - pool handling. - -Wed Jun 2 02:40:43 1999 Jeffrey A Law (law@cygnus.com) - - * README, configure.in, gcc.1, gcc.texi: Update name (egcs -> gcc) - and version #s (1.1 -> 2.95) as needed. - * README.g77: Kill way out of date file in the toplevel directory. - -Wed Jun 2 00:52:34 1999 David O'Brien - - * configure.in (i[34567]86-*-freebsdelf): Don't include linux.h, - i386/freebsd-elf.h no longer requires it. Instead include svr4.h. - * configure: Rebuilt. - * i386/freebsd-elf.h (DEFAULT_VTABLE_THUNKS): Define. - (ASM_COMMENT_START, ASM_APP_ON, ASM_APP_OFF, SET_ASM_OP): Likewise. - (PREFERRED_DEBUGGING_TYPE, WCHAR_UNSIGNED): Likewise. - (SWITCH_TAKES_ARG): Likewise. - * i386/freebsd.h: Remove FREEBSD_NATIVE support. - * config/t-freebsd: Moved from config/i386/ so it can used for all - FreeBSD targets. - -Mon May 31 02:22:55 1999 Philippe De Muyter - - * m68k/x-mot3300 (XCFLAGS): Fixed to match stb.o, not f/stb.o. - -Wed Jun 2 00:08:34 1999 Robert Lipe - - * configure.in (i[34567]86-*-udk*): Install headers with cpio. - * configure: Rebuilt. - -Wed Jun 2 00:49:00 EDT 1999 John Wehle (john@feith.com) - - * flow.c (mark_regs_live_at_end, insn_dead_p, - mark_set_1, mark_used_regs): Only give FRAME_POINTER_REGNUM - and HARD_FRAME_POINTER_REGNUM special treatment if reload - hasn't run or the frame pointer is needed. - * haifa-sched.c (attach_deaths): Likewise. - * sched.c (attach_deaths): Likewise. - -Thu May 27 22:06:52 1999 Mark Mitchell - - * cccp.c (handle_directive): Handle backslash-newlines in quoted - strings correctly. - -Mon May 31 22:42:02 1999 Jeffrey A Law (law@cygnus.com) - - * Remove this patch (from the branch only) - Wed May 26 09:53:05 1999 Mark Mitchell - * fold-const.c (fold): STRIP_NOPS when deciding whether or not - something is a candidate for optimize_bit_field_compare. - -Mon May 31 15:23:23 1999 Richard Henderson - - * alpha.md (reload_*_help): New patterns and splitters. - (reload_*): Use them. - (mov[qh]i): Likewise. - -Mon May 31 09:36:11 1999 Cort Dougan - - * rs6000/linux.h (LINK_SPEC): Use emulation elf32ppclinux. - -Sat May 29 19:08:10 1999 Philip Blundell - - * config/arm/aout.h (ASM_OUTPUT_ALIGN): Only define if not already - defined. - * config/arm/elf.h (ASM_OUTPUT_ALIGN): Define. - (MAX_OFILE_ALIGNMENT): Likewise. - -Mon May 31 00:45:14 1999 Jeffrey A Law (law@cygnus.com) - - * jump.c (jump_optimize_1): Only set CAN_REACH_END if - calculate_can_reach_end returns nonzero. - - * Makefile.in (CFLAGS): Remove warning flags. - (WARN_CFLAGS): Disable. - - * configure.in (native gas tests): Search for an assembler in the - same manner that the installed compiler will. - * configure: Rebuilt. - * tm.texi (MD_EXEC_PREFIX): Note need to update configure.in too. - - * alias.c (find_base_term): Improve handling of addresses - constructed from binary operations. - -Sun May 30 14:43:37 1999 Robert Lipe - - * fixincl.c: Replace local include scheme with #includes of - gansidecl.h and system.h. - * procopen.c: Likewise. - * server.c: Likewise. - -Sun May 30 14:18:40 1999 Jeffrey A Law (law@cygnus.com) - - * function.h (cleanup_label, frame_offset): Declare. - (tail_recursion_label, tail_recursion_reentry): Likewise. - (arg_pointer_save_area, rtl_expr_chain): Likewise. - * stmt.c (cleanup_label, frame_offset): Delete extern declarations. - (tail_recursion_label, tail_recursion_reentry): Likewise. - (arg_pointer_save_area, rtl_expr_chain): Likewise. - -Fri May 28 03:47:03 1999 Eric Raskin (ehr@listworks.com) - - * i386/t-dgux (EXTRA_PARTS): Add crti.o. - (crti.o): Add build rule and dependencies. - -Fri May 28 03:07:10 1999 Franz Sirl - - * rs6000/sysv4.h (CC1_SPEC): Add support for -profile - (LIB_LINUX_SPEC): Likewise. - (LIB_LINUX_SPEC): Add support for -pthread - (CPP_OS_LINUX_SPEC): Likewise. - (CPP_SYSV_SPEC): Avoid redefinitions if both -fpic and -fPIC are - specified - - * rs6000.c (output_mi_thunk): Enable full support again. - -Thu May 27 13:04:52 1999 H.J. Lu (hjl@gnu.org) - - * i386.c (output_fp_cc0_set): Don't check the JUMP_INSN code for - conditional move. - (notice_update_cc, output_float_compare): Enable TARGET_CMOVE support. - (output_float_compare, output_fp_cc0_set): Fix the FLOAT comparison - for IEEE math and CC_FCOMI. - (put_jump_code): No IEEE if CC_FCOMI is set. - -1999-05-27 Andreas Schwab - - * fold-const.c (fold_truthop): Make the field reference unsigned - when converting a single bit compare. - -Thu May 27 03:07:13 1999 Philip Blundell - - Based on patch by Scott Bambrough and Pat Beirne: - * config/arm/arm.c (making_const_table): New variable. - * config/arm/arm.h (making_const_table): Declare. - (OUTPUT_INT_ADDR_CONST): Mark symbols as position independent if - appropriate. - * config/arm/arm.md (consttable_4, consttable_8, consttable_end): - Keep track of when we are building the constant table. - -Thu May 27 02:52:55 1999 Jeffrey A Law (law@cygnus.com) - - * varasm.c (STRIP_NAME_ENCODING): Remove default definition. - * output.h (STRIP_NAME_ENCODING): Strip '*' like the old varasm - version did. - -Thu May 27 02:40:48 1999 J"orn Rennecke - - * loop.c (strength_reduce): Don't do biv->giv conversion on constants. - -Thu May 27 02:09:27 1999 Jeffrey A Law (law@cygnus.com) - - * reload.c (push_reload): Do not call remove_address_replacements - when presented with identical optional reloads. - -Wed May 26 14:18:05 1999 Richard Henderson - - * alpha.h (MASK_FIX, TARGET_FIX): New. - (MASK_*): Reorganize constants. - (CPP_AM_FIX_SPEC): New. - (TARGET_SWITCHES): Add FIX. - (EXTRA_SPECS): Likewise. - (CPP_CPU_EV6_SPEC): Use FIX, not CIX. - (SECONDARY_MEMORY_NEEDED): Likewise. - (REGISTER_MOVE_COST): Likewise. - * alpha.c (override_options): Add FIX support. Always use - ALPHA_TP_PROG for ev6. - * alpha.md (sqrt and mov[sd]i patterns): Use FIX, not CIX. - * alpha/elf.h (ASM_FILE_START): Look at FIX too. - * configure.in (target_cpu_default2) [ev6]: Use FIX, not CIX. - -Wed May 26 09:53:05 1999 Mark Mitchell - - * fold-const.c (fold): STRIP_NOPS when deciding whether or not - something is a candidate for optimize_bit_field_compare. - -Wed May 26 03:54:33 1999 Melissa O'Neill - - * fixinc/fixincl.c: (WIFSIGNALED): Define if not already defined. - (WTERMSIG, WIFEXITED, WEXITSTATUS, WIFSTOPPED, WSTOPSIG): Likewise. - (S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP): Likewise. - (S_IROTH, S_IWOTH, S_IXOTH, S_IRWXU, S_IRWXG, S_IRWXO): Likewise. - -Wed May 26 02:19:31 1999 Philip Blundell - - * arm.h (NEED_PLT_GOT): Fix mistake in last change. - (GOT_PCREL): New macro. Define to 1 if not already defined. - * arm/elf.h (GOT_PCREL): Define to 0. - * arm.c (arm_finalize_pic): Take into account the setting of - GOT_PCREL. - -Tue May 25 14:06:06 1999 Jeffrey A Law (law@cygnus.com) - - * output.h (STRIP_NAME_ENCODING): Provide default definition. - * dwarf2out.c (ASM_NAME_TO_STRING): Use STRIP_NAME_ENCODING. - - * flow.c (mark_set_1): Do not record BLKmode stores as dead - store elimination candidates. - -Mon May 24 14:34:31 1999 Jeffrey A Law (law@cygnus.com) - - * loop.c (strength_reduce): Do not clear NOT_EVERY_ITERATION at the - last CODE_LABEL in a loop if we have previously passed a jump - to the top of the loop. - -Mon May 24 01:02:58 1999 Mark Mitchell - - * stmt.c (expand_end_bindings): Ignore any elements of VARS that - are not VAR_DECLs. - -Sun May 23 20:31:16 1999 Jeffrey A Law (law@cygnus.com) - - * loop.c (strength_reduce): Grow reg_single_usage as needed. - -Sun May 23 10:13:20 1999 David O'Brien - - * i386/freebsd-elf.h (LINK_SPEC): Change -static to -Bstatic. - Also remove a useless comment. - -Sun May 23 10:05:23 1999 Jerry Quinn - - * pa.md (negdf2,negsf2): Use fneg instead of fsub on pa 2.0. - -Sat May 22 01:27:49 1999 Mark Mitchell - - * expr.h (lang_expand_constant): Guard with #ifdef TREE_CODE. - -Thu May 20 10:00:42 1999 Stephen L Moshier - - * Makefile.in (GCC_FOR_TARGET): Add -I$(build_tooldir)/include. - -Thu May 20 09:58:57 1999 Jan Hubicka - - * function.c (assign_stack_local): Align stack slot propertly. - (assign_outer_stack_local): Likewise. - -Thu May 20 10:38:43 1999 Mark Mitchell - - * expr.h (lang_expand_constant): Declare. - * toplev.c (lang_expand_constant): Define it. - * varasm.c (output_constant): Use it. - -Thu May 20 11:28:53 1999 Kaveh R. Ghazi - - * optabs.c (expand_cmplxdiv_straight, expand_cmplxdiv_wide): - Change function definitions to K&R style. - -Thu May 20 08:15:00 1999 Bruce Korb - - * fixinc/fixincl.c(main): we must not ignore SIGCLD now. - -Thu May 20 07:06:39 1999 Alexandre Oliva - - * fixinc/Makefile.in(gnu-regex.o): add $(INCLUDES) to compile options - * fixinc/fixincl.c(wait_for_pid): K&R-ify arguments - (several places): omit static initialization - (process): use single fd, since only the read fd is used - * fixinc/gnu-regex.c: define 'const' away, if not supported - * fixinc/procopen.c(several places): omit static initialization - * fixinc/server.c: define 'volitile' away, if not supported - -1999-05-20 Andreas Schwab - - * config/dbxcoff.h (DBX_OUTPUT_MAIN_SOURCE_FILE_END): Use - asm_fprintf and %L to generate the label name. - * config/dbxelf.h (DBX_OUTPUT_MAIN_SOURCE_FILE_END): Likewise. - (ASM_OUTPUT_SOURCE_LINE): Correct generation of internal labels. - -Thu May 20 01:40:55 1999 Jeffrey A Law (law@cygnus.com) - - * jump.c (can_reverse_comparison_p): Do not abort if the comparison - insn for a conditional jump can not be found. - -Wed May 19 23:58:58 1999 Jeffrey A Law (law@cygnus.com) - - * mips.h (ENCODE_SECTION_INFO): Do not perform GP optimizations - on variables in specific sections other than .sbss and .sdata. - -Tue May 18 11:20:48 1999 Mark Mitchell - - * stmt.c (expand_return): Call start_cleanup_deferral and - end_cleanup_deferral around conditional code. - -Wed May 19 03:10:08 1999 Bruce Korb - - * fixinc/fixincl.tpl: Avoid depending on ANSI C features for - filename lists. Utilizes new AutoGen function "krstr". - * fixinc/fixincl.x: Rebuilt. - -Wed May 19 02:47:11 1999 Jan Hubicka (hubicka@freesoft.cz) - - * i386.c (output_float_compare): Avoid GNU-C extensions. - -Wed May 19 00:50:24 1999 Jeffrey A Law (law@cygnus.com) - - * version.c: Bump version to gcc-2.95 prerelease. - -Tue May 18 03:53:37 1999 Craig Burley - - Improve open-coding of complex divide: - * flags.h: Declare new front-end-malleable flag. - * toplev.c: Define new flag. - * optabs.c (expand_cmplxdiv_straight): New function to do original - open-coding. - (expand_cmplxdiv_wide): New function to do new open-coding, - from Toon Moene, with changes (call to emit_barrier, dropping - of spurious `ok = 1;', plus the obvious `break;' -> `return 0;'). - (expand_binop): A bit of spacing fixing, while at it. - Use new functions instead of inlining the open-coding code. - -Tue May 18 00:51:46 1999 Krister Walfridsson - - * configure.in (arm*-*-netbsd*): Use collect2. - (i[34567]86-*-netbsd*): Likewise. - (m68k*-*-netbsd*): Likewise. - (ns32k-*-netbsd*): Likewise. - (sparc-*-netbsd*): Likewise. - (vax-*-netbsd*): Likewise. - * configure: Rebuilt. - -Tue May 18 00:21:34 1999 Zack Weinberg - - * cppspec.c: Insert -no-gcc into command line unless -gcc was - given by user. - * gcc.c (default_compilers): Define __GNUC__ and - __GNUC_MINOR__ only if -no-gcc was not given. - * objc/lang-specs.h: Likewise. - * cpp.texi: Document -x and -std options; explain that -lang - is no longer supported. Minor related corrections. - -Mon May 17 23:56:39 1999 Alexandre Oliva - - * Makefile.in (stmp-fixproto): Pass location of mkinstalldirs to - fixproto. - * fixproto: Avoid unportable constructs such as `basename' and - `mkdir -p'. Use mkinstalldirs from the environment if `mkdir -p' - fails. - - * fixinc/fixincl.c: Remove #error, it is not portable. - -Mon May 17 23:50:41 1999 Marc Espie - - * collect2.c (main): Fix typo in COLLECT2_HOST_INITIALIZATION. - -Mon May 17 19:45:41 1999 Rainer Orth - - * fixinc/fixincl.c (process): Wait for children from chain_open() - to avoid creating zombies. - - * fixinc/inclhack.tpl: Removed no-op pipe. - - * fixinc/inclhack.sh fixinc/fixincl.sh: regenerate - -Mon May 17 07:23:34 1999 Mark Mitchell - - * tree.def (TYPE_NONCOPIED_PARTS): Revise documentation to match - reality. - * expr.c (init_noncopied_parts): Don't generate initializers for - parts that don't need them. - -Mon May 17 02:56:35 PDT 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Oct 31 05:08:34 CET 1998 Jan Hubicka (hubicka@freesoft.cz) - - * reg-stack.c: Do not emit pop insns after cc0 setter. - (emit_pop_insn): Do not emit insn in case WHEN is NULL. - (compare_for_stack_reg): Update REG_DEAD note and - do not emit push insn. - - * i386.c: (output_float_compare): Handle new REG_DEAD notes. - -Mon May 17 01:57:37 1999 David Daney - - * i386/sol2.h (LINK_SPEC): Do not pass "-z text" to the linker - if -mimpure-text. - -1999-05-17 Andreas Schwab - - * m68k.c (standard_68881_constant_p): Don't accept -0.0 as valid - 68881 constant. - - * fold-const.c (fold_truthop): When converting a one-bit - comparison don't sign extend the constant. - - * cse.c (cse_insn): Copy SRC_CONST before putting it in the - REG_EQUAL note. - -1999-05-17 Mike Stump - - * rs6000/vxppc.h (CPP_SPEC): Fix support for vararg functions. - -Sat May 15 14:22:40 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc/hackshell.tpl: Fix mis-applied patch. - * fixinc/inclhack.sh: Regenerated. - -Thu May 13 21:05:55 1999 Mark Kettenis - - * fixinc/mkfixinc.sh: Add the Hurd (*-*-gnu*) to the list of - targets that do not need any fixes. - -Sat May 15 14:12:38 1999 Michael Hayes - - * config/c4x/c4x.md (set_lo_sum+2): New splitter to load large - const_ints. - -Sat May 15 14:09:08 1999 Michael Hayes - - * config/c4x/c4x.md (decrement_and_branch_on_count): Disabled. - (doloop_begin, doloop_end): New patterns. - (*rptb_init): Added extra operands. - -Fri May 14 21:31:36 1999 Michael Hayes - - * config/c4x/c4x.md (*umulqi3_highpart_clobber): Fix operand 2 - constraints order. - -1999-05-14 Ulrich Drepper - - * fixinc/fixinc.x86-linux-gnu (FD_ZERO): Fix operand numbers in - asm input operands. - -Thu May 13 15:34:18 1999 David Edelsohn - - * rs6000.c (mask_constant): Delete. - (mask_operand): Move mask_constant() body to here. - * rs6000.h (mask_constant): Delete declaration. - * rs6000.md (nabsdi2): Reverse subtraction in splitter. - -Thu May 13 02:25:01 1999 Jeffrey A Law (law@cygnus.com) - - * cpp.texi: Fix some typos. - -Thu May 13 01:49:55 1999 Graham Stott - - * loop.c (maybe_eliminate_biv): Check regno against - max_reg_before_loop. - - * i386.c (memory_address_info): Correct the scale - factor test. - -Thu May 13 01:31:19 1999 Nick Burrett - - * arm.md (nop): Backout Apr 27 change. Ensure REGISTER_PREFIX is - applied to each register. - * aof.h (ASM_FILE_START): Define register `r0'. - -1999-05-12 20:22 -0400 Zack Weinberg - - * configure.in: Make --enable-cpp and --with-cpp-install-dir - documented options. Enable the cpp driver by default. - * configure: Rebuilt. - -Wed May 12 18:08:48 1999 David Edelsohn - Richard Henderson - - * rs6000.c (print_operand) [w]: Calculate signed constant more clearly. - (rs6000_allocate_stack_space): Print as hexadecimal value. - * rs6000.h (CONST_OK_FOR_LETTER_P): 'L' checks for a signed, - 16-bit shifted constant. Fix typo for 'P'. - (EXTRA_CONSTARINT): 'T' checks for a 32-bit mask operand. - * rs6000.md (movsi, addsi3_internal1, movdi, adddi3_internal1): - Use 'L' for shifted constant. - (anddi3_internal3): Fix typo. - (32-bit mask patterns): Use 'T'. - -Wed May 12 07:30:31 1999 Bruce Korb - - * fixinc/fixincl.c(quoted_file_exists): new procedure to ensure that - a file exists before trying to copy it into the destination - (extract_quoted_files): use that routine. - -Wed May 12 07:27:31 1999 Craig Burley - - Allow front end (like g77's) to override maintenance of errno: - * expr.c (expand_builtin): Bother with errno only if - flag_errno_math. - * flags.h: Declare flag_errno_math. - * toplev.c: Define flag_errno_math. - -Tue May 11 23:55:49 1999 Jeffrey A Law (law@cygnus.com) - - * fixproto: Change "mkdir" calls to "mkdir -p" - - * fixinc/inclhack.def (io_def_quotes): Consistently allow multiple - whitespace characters between the "define" and the name of the macro. - * fixinc/fixincl.x, fixinc/inclhack.sh: Rebuilt. - -Tue May 11 20:46:37 1999 Richard Henderson - - * alpha.c (alpha_expand_block_move): Handle TImode registers - used with ADDRESSOF. - (alpha_expand_block_clear): Handle ADDRESSOF specially. - -1999-05-11 Ulrich Drepper - - * fixinc/fixinc.x86-linux-gnu (FD_ZERO): Remove unneccessary - memory output operand which irritates gcc. - -Tue May 11 11:45:16 1999 Dave Brolley - - * toplev.c (documented_lang_options): Add -MD, -MMD, -M and -MM for - cpplib-enabled compilers. - -Tue May 11 11:34:56 1999 Vladimir Makarov - - * config/sparc/sparc.h (GO_IF_LEGITIMATE_ADDRESS): Add parentheses - around &&. - -Mon May 10 13:51:24 1999 Nick Clifton - - * tm.texi (FUNCTION_ARG): Stack element of PARALLEL must come - first. - -Tue May 11 01:32:01 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc/inclhack.def (sun_auth_proto): Apply to all targets. - (sysz_stdlib_for_sun): Similarly. - * fixinc/fixincl.x, fixinc/inclhack.sh: Rebuilt. - -Mon May 10 20:34:10 1999 Jim Wilson - - * config/mips/elf.h (UNIQUE_SECTION_P): Undef. - * config/mips/elf64.h (UNIQUE_SECTION_P): Undef. - * config/mips/mips.h (UNIQUE_SECTION_P): Define to 0. - -1999-05-10 18:21 -0400 Zack Weinberg - - * cppfiles.c (initialize_input_buffer): New function. - (finclude): Call it, if pfile->input_buffer is NULL. Accept - any character device as an input file. - (read_and_prescan): Use pfile->input_buffer and - pfile->input_speccase. - * cppinit.c (cpp_cleanup): Free pfile->input_buffer and - pfile->input_speccase. - * cpplib.h (cpp_reader): Add input_buffer, input_speccase, and - input_buffer_len members. Use memcpy in CPP_PUTS_Q. - - * cppmain.c: Buffer output in the token_buffer; throttle - number of calls to fwrite; check for errors from fwrite. - -1999-05-10 18:21 -0400 Zack Weinberg - - * cppspec.c: Treat two non-option arguments as input and - output file. Three or more non-option args is an error. - Clean up. - * gcc.c (default_compilers): Pass -$ to the preprocessor. - * objc/lang-specs.h: Likewise. - -Mon May 10 12:59:20 1999 Jeffrey A Law (law@cygnus.com) - - * optabs.c (emit_cmp_and_jump_insns): Handle the case where both - operands to the comparison are constants. - -Mon May 10 07:28:10 1999 Bruce Korb - - * fixinc/inclhack.def(arm_norcroft_hint): check before fixing - (no_double_slash): portability - (math_exception): added reminder comment - -Mon May 10 01:28:10 1999 Craig Burley - - From Fri May 7 9:31:41 1999 Donn Terry (donn@interix.com): - * varasm.c (mark_constant_pool): Add some transitive closure. - -Sun May 9 22:51:04 1999 Craig Burley - - Fix gcc.dg/990506-0.c: - * c-typeck.c (require_complete_type): Handle ERROR_MARK input. - -Sun May 9 13:19:12 1999 Jeffrey A Law (law@cygnus.com) - - * gcse.c (cprop_insn): Do not try to simplify a simple jump. - -Sun May 9 11:12:19 1999 Philip Blundell - - * config/arm/arm.h (ASM_OUTPUT_MI_THUNK): Add (PLT) to branch if - necessary. Reported by jim@federated.com. - -Sat May 8 23:05:35 1999 Jeffrey A Law (law@cygnus.com) - - * pa.h (PRINT_OPERAND_ADDRESS): Output "%r0", not "r0" for the - base register in an absolute memory address. - * pa.md (conditional moves): Avoid using immediate zero for - register zero. - -Sat May 8 06:23:21 1999 Philip Blundell - - Based on patch by Scott Bambrough: - * config/arm/arm.h (NEED_PLT_GOT): New macro. Set to 0 if not - already defined. - * config/arm/elf.h (NEED_PLT_GOT): Define to flag_pic. - * config/arm/arm.md (call_symbol, call_value_symbol et al.): If - NEED_PLT_GOT is true, add explicit "(PLT)" to generated branches. - * config/arm/arm.c (output_func_epilogue, - output_return_instruction): Likewise for calls to abort. - -Sat May 8 01:57:58 1999 Donn Terry (donn@interix.com) - - * calls.c (rtx_for_function_call): Extend function pointer being - passed to chkr_check_exec_libfunc, if needed. - -Sat May 8 01:51:50 1999 David Edelsohn - - * ginclude/stdarg.h (__va_rounded_size): Use long type for - rounding on AIX. - * ginclude/varargs.h: Likewise. - -Sat May 8 01:47:20 1999 Andreas Schwab - - * invoke.texi: Remove duplicates in the description of -d - letters. Fix use of @item vs. @itemx. - -Sat May 8 01:43:02 1999 Franz Sirl - - * rs6000.h (RS6000_VARARGS_OFFSET): Die die die. - (CUMULATIVE_ARGS): Remove varargs_offset; update commentary. - * rs6000.c (setup_incoming_varargs): Fix typo last change. - (init_cumulative_args): Remove varargs_offset references. - - * rs6000/linux.h (NO_IMPLICIT_EXTERN_C): Define. - (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Undefine. - -Sat May 8 01:34:19 1999 Andreas Schwab - - * reload1.c (gen_mode_int): New function. - (reload_cse_move2add): Use it to generate the new constants. - -Sat May 8 01:25:09 1999 Andreas Schwab - - * varasm.c (output_constant): Do nothing if -fsyntax-only. - -Fri May 7 19:10:15 1999 Vladimir Makarov - - * sparc.h (GO_IF_LEGITIMATE_ADDRESS): Prohibit REG+REG addressing - for TFmode when there are no instructions which accept REG+REG - instructions. - -Fri May 7 12:38:54 1999 Jim Wilson - - * mips/elf64.h (MAKE_DECL_ONE_ONLY, UNIQUE_SECTION_P): Define. - * mips/mips.c (mips_select_rtx_section): When TARGET_MIPS16, use - function_section instead of text_section. - * mips/mips.h (ENCODE_SECTION_INFO): Add check for UNIQUE_SECTION_P - in TARGET_MIPS16 STRING_CST handling. - -Fri May 7 09:54:11 1999 Nick Clifton - - Patch from: Nick Burrett - - * arm.c (arm_poke_function_name): New function to implement - -mpoke-function-name. - * aof.h (ASM_DECLARE_FUNCTION_NAME): Call it. - * aout.h (ASM_DECLARE_FUNCTION_NAME): Likewise. - * elf.h (ASM_DECLARE_FUNCTION_NAME): Likewise. - * arm.h: Prototype it. - (TARGET_SWITCHES): Add `no-poke-function-name'. - -Fri May 7 14:19:31 1999 Rainer Orth - - * fixinc/server.c (load_data): Cast text_size to long, adapt - format. - * fixinc/server.c (read_pipe_timeout): Declare volatile, modified - in signal handler. - (sig_handler): Add debug code. - * fixinc/server.c (run_shell): Don't \-escape cd, it breaks the - Ultrix V4.3 /bin/sh. - * fixinc/server.c (def_args): Use static instead of STATIC to - avoid redefinition error from linker iff DEBUG. - - * fixinc/hackshell.tpl: Don't strip trailing directory from - DESTDIR - that is already done - - * fixinc/fixincl.c (run_compiles): fix memory leak - -Thu May 6 20:34:00 1999 Mark Mitchell - - * resource.c (mark_referenced_resources): Make volatil - monotonically increasing. - (mark_set_resources): Likewise. - -Thu May 6 20:02:33 1999 Fred Fish - - * rs6000/xm-beos.h (HAVE_VPRINTF): Don't redefine if already defined. - (HAVE_PUTENV, HAVE_ATEXIT, HAVE_RENAME): Likewise. - -Wed May 5 20:28:32 1999 Jason Merrill - - * install.texi (Header Dirs): s/GPLUS/GPLUSPLUS/. - -Wed May 5 23:44:15 1999 J"orn Rennecke - - * unroll.c (copy_loop_body): Don't copy VTOP notes from copy_notes_from. - -Wed May 5 16:26:13 1999 Vladimir Makarov - - * function.c (purge_addressof_replacements): Rename into - purge_bitfield_addressof_replacements. - (purge_addressof_replacements): New variable. - (purge_addressof_1): Add code for changing addressof in notes for - field values which are extracted by usage MEM with narrower mode. - (purge_addressof): Initialize purge_bitfield_addressof_replacements. - -Wed May 5 07:40:02 1999 Nick Clifton - - Patch from: Nick Burrett - * config/arm/arm.h (ARM_MCOUNT_NAME): Define. - (FUNCTION_PROFILER): Remove assembler dialect dependency and use - ARM_MCOUNT_NAME. - (TRAMPOLINE_TEMPLATE): Remove assembler dialect dependency. - - * config/arm/aof.h (ARM_MCOUNT_NAME): Define. - -1999-05-05 09:58 -0400 Zack Weinberg - - * gcc.c (default_compilers): Fix brace nesting bug. - * objc/lang-specs.h: Use %i, not %g.mi, for the input file - when processing an .mi file. - -Tue May 4 13:17:55 1999 Mark Mitchell - - * resource.c (mark_set_resources): Handle UNSPEC_VOLATILE, - ASM_INPUT, TRAP_IF, and ASM_OPERANDS just like in - mark_referenced_resources. - -Mon May 3 22:38:41 1999 David Edelsohn - - * rs6000/aix43.h (SUBTARGET_OVERRIDE_OPTIONS): Change non-PowerPC - and AIX64 combination to warning. Add warning for disabling - PowerPC64 support when using 64-bit mode. - (LIB_SPEC): Do not link with libg.a in 64-bit mode. - (LINK_SPEC): Do not export libg.exp symbols in 64-bit mode. - * rs6000/rs6000.h (MY_ISCOFF): Treat import/export files as valid - XCOFF files. - (read_only_data_section, private_data_section, - read_only_private_data_section): Always align CSECTs to doubleword - boundary regardless of mode. - (TEXT_SECTION_ASM_OP): Align text CSECT on doubleword boundary in - 64-bit mode. - (DATA_SECTION_ASM_OP): Always align CSECT to doubleword boundary. - (ASM_OUTPUT_LOCAL): Use rounded size in 64-bit mode to - maintain doublword alignment. - -Mon May 3 14:45:23 1999 Jeffrey A Law (law@cygnus.com) - - * mn10200.md (btst insns): btst does not leave cc0 in a useable - state for redundant tst eliminatino. - * mn10300.md (btst insns): Likewise. - -Mon May 3 16:14:32 1999 Kaveh R. Ghazi - - * mips.h (Pmode): Revert Oct 14th change which added a cast. - -Sun May 2 14:02:21 1999 Mark Mitchell - - * tree.h (struct tree_decl): Add comdat_flag. - (DECL_COMDAT): Define it. - * toplev.c (wrapup_global_declarations): Don't output a - DECL_COMDAT function just because it's public. - -Sun May 2 15:16:42 1999 Joseph S. Myers - - * pdp11.h (TARGET_SWITCHES): Fix error in previous change. - (ASSEMBLER_DIALECT): Define. - (CONDITIONAL_REGISTER_USAGE): Rename floating point registers if - required for the UNIX assembler. - (ASM_OUTPUT_INT): Remove. The compiler will synthesise it. - (ASM_OUTPUT_ADDR_VEC_PROLOGUE): Remove. - (ASM_OPEN_PAREN, ASM_CLOSE_PAREN): Change to "[" and "]". - (TRAMPOLINE_TEMPLATE): Use ASM_OUTPUT_SHORT. - * pdp11.c (output_addr_const_pdp11): Copy of output_addr_const - adapted to output constants in octal. - * pdp11.c, pdp11.h, pdp11.md: Use output_addr_const_pdp11 instead - of output_addr_const. Output constants in octal. Use assembler - dialect alternatives where DEC and UNIX assemblers use different - instruction names. - -Sun May 2 01:15:06 PDT 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Fri Apr 30 13:55:43 1999 Richard Henderson - - * va-ppc.h (__va_start_common): Let __builtin_saveregs do the work. - * rs6000.c (expand_builtin_saveregs): For V4, initialize a private - va_list struct, and return a pointer to it. - (setup_incoming_varargs): V4 save area based off virtual_stack_vars - instead of frame_pointer. - -Thu Apr 29 23:02:22 1999 Mark Mitchell - - * emit-rtl.c (start_sequence): Expand comments. - (start_sequence_for_rtl_expr): Likewise. - (push_to_sequence): Likewise. - (end_sequence): Likewise. - * expr.c (inhibit_defer_pop): Likewise. - * expr.h (inhibit_defer_pop): Likewise. - (NO_DEFER_POP): Likewise. - (OK_DEFER_POP): Likewise. - -Thu Apr 29 22:13:46 1999 Robert Lipe - - * configure.in (i?86-UnixWare7*-sysv): Set thread_file to 'posix' - --enable-threads[={yes,pthreads,posix}] is passed as a command - line parameter to configure. - * config/i386/sysv5.h (LIB_SPEC): Add support for '-pthread'. - (CPP_SPEC): Likewise. - -Thu Apr 29 17:23:59 1999 Richard Henderson - - * emit-rtl.c (operand_subword): Religiously mask and sign-extend - from 32-bits to HOST_WIDE_INT. - -Thu Apr 29 15:58:52 1999 Robert Lipe - - * fixinc/regex.c, fixinc/regex.h: Removed. Replace with... - * fixinc/gnu-regex.c, fixinc/gnu-regex.h: Imported from GDB 4.18. - * fixinc/Makefile.in (OBJ, HDR): Handle name changes from above. - (gnu-regex.o): Define REGEX_MALLOC to avoid memory leak. - * fixinc/fixincl.c: new regex.h header name - * Makefile.in: new regex.[ch] file names - -Thu Apr 29 12:53:33 1999 Richard Henderson - - * calls.c (emit_call_1): Pass rounded_stack_size to emit_call - instead of the unrounded size. - -1999-04-28 14:40 Bruce Korb - - * fixinc/mkfixinc.sh: Makesure the result shell script is writable - -Wed Apr 28 10:36:39 1999 Andreas Schwab - - * config/m68k/m68k.md (cmpsi+1): Use cmp.w when comparing a 16 bit - constant with an address register. - -Wed Apr 28 00:14:41 PDT 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Tue Apr 27 19:50:25 EDT 1999 Andrew MacLeod - - * rtl.h (REG_EH_REGION): Update comment to indicate a value of -1 - indicates no throw and no nonlocal gotos. - * optabs.c (emit_libcall_block): Emit REG_EH_REGION with a value - of -1 instead of 0 to indicate a nonlocal goto won't happen either. - * flow.c (count_basic_blocks, find_basic_blocks_1): Ignore libcall - blocks, look for REG_EH_REGION note exclusively. - (make_edges): Check for REG_EH_REGION > 0 for specified handlers. - -Tue Apr 27 15:33:42 1999 David Edelsohn - - * rs6000.h (read_only_data_section, private_data_section, - read_only_private_data_section, toc_section): Align CSECT on - doubleword boundary for 64-bit target. - (DATA_SECTION_ASM_OP): Likewise. - * rs6000.c (rs6000_stack_info): Leaf procedure stack limit is 288. - -Tue Apr 27 20:19:47 1999 J"orn Rennecke - - * sh.md (insv): Use copy_addr_to_reg. - - * final.c (insn_lengths_max_uid): New variable. - (init_insn_lengths, shorten_branches): Set it. - (get_attr_lengths): Test insn uid against insn_lengths_max_uid. - -1999-04-27 08:32 -0400 Zack Weinberg - - * expr.c (emit_move_insn_1): Abort if MODE argument is invalid. - (compare): Punt if TREE_OPERAND (exp, 0) is an ERROR_MARK. - -Tue Apr 27 01:33:43 1999 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (ORDINARY_FLAGS_TO_PASS): Renmaed from FLAGS_TO_PASS. - Remove "CC". - (FLAGS_TO_PASS): New variable. - -Tue Apr 27 00:36:44 1999 Nick Burrett - - * arm.md (nop): Output instruction using output_asm_insn to fix - assembler dialect problems. - -Mon Apr 26 23:55:50 1999 Robert Lipe - - * Makefile.in (fixinc.sh): Fix dependencies. - - * fixinc/inclhack.def (avoid_bool): Enable match if typedefs are - prepended by spaces. - (sco5_stat_wrappers): New fix. Make sys/stat.h C++ safe. - * fixinc/fixincl.sh, fixinc/fixincl.x, fixinc/inclhack.sh: Rebuilt. - -Mon Apr 26 23:28:54 1999 Mumit Khan - Donn Terry - - * function.c (put_var_into_stack): Change ptr_mode to Pmode - in setup for chkr_set_right_libfunc calls. - (assign_params): Likewise. - * expr.c (emit_push_insn): Change ptr_mode to Pmode in - setup for chkr_copy_bitmap_libfunc and chkr_set_right_libfunc calls. - (expand_assignment): Change ptr_mode to Pmode in - setup for chkr_add_libfunc and chkr_copy_bitmap_libfunc. - (store_expr): Change ptr_mode to Pmode in - setup for chkr_add_libfunc and chkr_copy_bitmap_libfunc. - (expand_expr): Change ptr_mode to Pmode in - setup for chkr_check_addr_libfunc. - (expand_builtin): Change ptr_mode to Pmode in - setup for chkr_check_str_libfunc, chkr_copy_bitmap_libfunc and - chkr_check_addr_libfunc. - * calls.c (rtx_for_function_call): Change ptr_mode to Pmode in - setup for chkr_check_exec_libfunc. - (expand_call): Change ptr_mode to Pmode in - setup for chkr_set_right_libfunc. - (expand_call): Change ptr_mode to Pmode in - setup for chkr_set_right_libfunc. - (store_one_arg): Change ptr_mode to Pmode in - setup for chkr_set_right_libfunc. - - * c-parse.in (absdcl1): Allow attributes in explicit typespecs. - (%expect): Update. - * c-parse.y: Regenerate. - * c-parse.c: Likewise. - * objc/objc-parse.c: Likewise. - * objc/objc-parse.y: Likewise. - -Mon Apr 26 21:17:41 1999 Jason Merrill - - * c-pragma.c (push_alignment): Don't ignore alignments greater than - 4 bytes. - (handle_pragma_token): Likewise. - - * c-pragma.c: Support for #pragma pack (push, , ). - (struct align_stack): Add id field. - (push_alignment, pop_alignment): Take id parameter. - (handle_pragma_token): Add necessary states. - * c-pragma.h (enum pragma_state): Add necessary states. - -Tue Apr 27 13:58:23 1999 Michael Hayes - - * config/c4x/c4x.md (*cmpqf, *cmpqf_noov, *cmpqi_test, - *cmpqi_test_noov): Remove ? modifier from constraints list. - (*smulqi3_highpart_clobber, *umulqi3_highpart_clobber): Swap - output strings to match new constraint ordering. - -1999-04-26 19:16 -0400 Zack Weinberg - - * cpphash.c (dump_definition): New function. - * cpphash.h: Prototype it. - - * cpplib.c (handle_directive): Don't output anything here. - Streamline. - (pass_thru_directive): Take a length, not a pointer to the - end. All callers changed. - (do_define): Handle -dD, -dN, -g3 entirely here. Streamline. - (do_include): Handle -dI here. - (do_ident): Correct to match cccp. - (do_pragma): Copy the pragma through here. - (do_assert, do_unassert): Tidy. - - * cppinit.c (cpp_finish): If -dM was specified, walk the macro - hash table and call dump_definition on all the entries. - * cppmain.c: cpp_finish may produce output. - -Mon Apr 26 15:27:33 1999 Mark Mitchell - - * toplev.c (compile_file): Move call to check_global_declarations - after output_exception_table to restore behavior as it was before - 1999-04-22 change. - -1999-04-26 10:50 -0700 Bruce Korb - - * fixinc/fixincl.c: Improve the handling of child process exits - * fixinc/server.[ch]: Export the interface for shutting down - the server process - * fixinc/inclhack.tpl: Remove unnecessary character quote - * fixinc/fixincl.sh, fixinc/inclhack.sh: Regenerate - -Mon Apr 26 10:41:42 EDT 1999 Andrew MacLeod - - * alpha.md (builtin_setjmp_receiver): Use a label_ref instead of - a code label. - -1999-04-26 09:47 -0400 Zack Weinberg - - * rtl.texi: Document the rtl classes and their relation to - formats. - -Mon Apr 26 01:02:38 1999 Richard Henderson - - * alpha.md (fix_trunc patterns): Use reg_no_subreg_operand on op0 - for less work in reload. - (movsf and movdf patterns): Put fp reg alternatives first. - -Mon Apr 26 01:55:56 1999 Marc Espie - - * configure.in (openbsd): Factorize xmake_file. - (ix86 openbsd): Trim obsolete comment. - (vax openbsd): Fix typo. - * configure: Rebuilt. - -Mon Apr 26 01:30:59 1999 Donn Terry - - * expr.c (expand_assignment): Improve test for pointer type. - -Mon Apr 26 00:26:18 1999 Richard Henderson - - * alpha.c (print_operand_address): Account for the subreg word. - -Mon Apr 26 01:08:36 1999 Toshiyasu Morita (tm@netcom.com) - - * fold-const.c (make_range): Always initialize arg0 and arg1. - (fold): Similarly for alt0 and alt1. - * function.c (fixup_var_refs_insns): Initialize insn_list. - (instantiate_virtual_regs_1): Initialize offset. - * optabs.c (expand_binop): Initialize carry_in, carry_out, op0_xhigh - and op1_xhigh. - * stmt.c (expand_end_case): Initialize minval and maxval. - -Mon Apr 26 01:02:34 1999 Nathan Sidwell - - * toplev.c (report_error_function): Reorder file stack and - function name printing. Ignore FILE parameter. - -Mon Apr 26 00:58:54 1999 Jerry Quinn - - * pa.h (architecture_type): New enum. - (pa_arch_string, pa_arch): Declare. - (MASK_PA_10, MASK_PA_20): New flags. - (TARGET_SWITCHES): Add pa-risc-2-0. Update docs for PA1.0 codegen. - (TARGET_OPTIONS): Add -march= option. - * pa.c (pa_arch, pa_arch_string): Define. - (override_options): Set them. - * pa/pa-hpux10.h (ASM_FILE_START): Output LEVEL 2.0 asm directive for - 2.0 architecture. - * invoke.texi (Option Summary, HPPA Options): Document new - architecture flags. - - * pa/pa-hpux.h, pa/pa-hpux10.h, pa/pa-hpux9.h, pa/pa-osf.h, pa.h, - pa.c, pa.md, configure.in, configure: Replace TARGET_SNAKE by - TARGET_PA_11 and MASK_SNAKE by MASK_PA_11. - -Mon Apr 26 00:28:25 1999 Theodore Papadopoulo - - * flags.h (inline_max_insns): Declare. - * integrate.c (inline_max_insns): New variable. - (function_cannot_inline_p): Use it. - * toplev.c (main): Add the flag -finline-limit-n. - (display_help): Document -finline-limit-n. - * invoke.texi: Document -finline-limit-n - -Sun Apr 25 23:03:32 1999 Richard Henderson - - * stmt.c (expand_asm_operands): Reload in-out reg-only memory operands. - -Sun Apr 25 13:06:13 1999 Richard Henderson - - * function.c (assign_parms/STACK_BYTES): Revert last change, - and that of 19 Nov. - -Sun Apr 25 12:30:50 1999 Richard Henderson - - * calls.c (emit_call_1): New arg rounded_stack_size; update callers. - Update pending_stack_adjust based on this value. - (compute_argument_block_size): Include pending_stack_adjust in - PREFERRED_STACK_BOUNDARY alignment. - * function.c (assign_parms): Don't round to PREFERRED_STACK_BOUNDARY. - -Sun Apr 25 14:38:10 EDT 1999 John Wehle (john@feith.com) - - * stupid.c (stupid_mark_refs): Generate a REG_UNUSED note - for a register which is clobbered even if the register - was used by an earlier instruction. - - * i386.md (fix_truncsfdi2, fix_truncdfdi2, - fix_truncxfdi2): Don't bother with the gen_reg_RTX. - (fix_truncsfsi2, fix_truncsfdi2, fix_truncdfsi2, - fix_truncdfdi2, fix_truncxfsi2, fix_truncxfdi2): Update - operand constraints and modes. - * i386.c (output_fix_trunc): Use HImode register to avoid - memory stalls. Call output_move_double instead of output_to_reg. - (output_to_reg): Remove. - * i386.h: Likewise. - - * i386.md (negsf2, negdf2, negxf2): Set the type - attribute to fpop. - -Sat Apr 24 23:15:57 1999 Donn Terry (donn@interix.com) - - * alpha.md (call_value_nt): Correct subscripts. - -Sat Apr 24 20:49:20 1999 Richard Henderson - - * alpha.h (PRINT_OPERAND_ADDRESS): Break out to ... - * alpha.c (print_operand_address): here. Handle subregs. - -Fri Apr 23 22:35:41 EDT 1999 John Wehle (john@feith.com) - - * acconfig.h (HAVE_GAS_FILDS_FISTS): Add. - * configure.in: Check assembler instructions. - * configure: Rebuild. - * config.in: Likewise. - * i386.md (floathisf2, floathidf2, floathixf2): New patterns. - * i386.c (print_operand): Use the proper suffix for a 387 HImode - operand. Abort if a 387 operand has an unsupported size. - -Fri Apr 23 16:57:40 1999 Richard Henderson - - * alpha.c (alpha_write_verstamp): Mark `file' unused. - * alpha.h (FUNCTION_VALUE): Use gen_rtx_REG not gen_rtx. - (LIBCALL_VALUE): Likewise. - (GO_IF_LEGITIMATE_SIMPLE_ADDRESS): Handle normal subregs. - -Fri Apr 23 14:57:33 1999 Donn Terry - - * alpha32.h (INITIALIZE_TRAMPOLINE): Get offsets right. - - * alpha.c (alpha_initialize_trampoline): Add covert_memory_address - calls as needed. - -Fri Apr 23 14:36:47 1999 Richard Henderson - - * alpha.c (alpha_expand_prologue): Don't negate frame size - for use with subq. - -Fri Apr 23 09:43:18 1999 Nick Clifton - - * print-rtl.c (print_rtx): Display LABEL_NUSES for labels. - -Thu Apr 22 23:08:37 1999 Mark Mitchell - - * toplev.h (wrapup_global_declarations): Declare. - (check_global_declarations): Likewise. - * toplev.c (wrapup_global_declarations): New function, split out - from ... - (check_global_declarations): Likewise... - (compile_file): Here. - -Thu Apr 22 22:34:41 1999 Richard Henderson - - * c-parse.in (expr_no_commas): Verify we've an expr before - calling C_SET_EXP_ORIGINAL_CODE. - -Thu Apr 22 22:22:15 EDT 1999 John Wehle (john@feith.com) - - * toplev.c (rest_of_compilation): Always set - current_function_uses_only_leaf_regs appropriately. - -Thu Apr 22 14:39:43 1999 Mumit Khan - - * i386/xm-cygwin.h (HAVE_BCOPY): Delete unneeded macro. - (HAVE_BZERO): Likewise. - (HAVE_BCMP): Likewise. - (HAVE_RINDEX): Likewise. - (HAVE_INDEX): Likewise. - (DIR_SEPARATOR_2): Define. - (GET_ENV_PATH_LIST): Turn path lists into POSIX. - (PATH_SEPARATOR): Use ':'. - -1999-04-22 Bruce Korb - - * configure.in: enable disabling of fast fixincludes - * configure: regenerate - -1999-04-21 14:55 -0400 Zack Weinberg - - * gen-protos.c: #undef abort after including system.h. - Delete defns of fancy_abort and fatal. - * fix-header.c: Delete defn of fancy_abort. - -Wed Apr 21 12:09:38 1999 Mumit Khan - - * cccp.c (simplify_filename): Always preserve leading double slash. - -Wed Apr 21 18:15:55 1999 Michael Hayes - - * config/c4x/c4x.md: Add new peepholes to remove redundant loads. - -Wed Apr 21 17:41:29 1999 Michael Hayes - - * config/c4x/c4x.md (binary patterns): Reorder alternatives - so that two operand instructions are chosen before three operand - instructions. - -Tue Apr 20 23:38:58 1999 Nathan Sidwell - - * objc/Make-lang.in (objc-parse.c): Put BISON parameters in correct - order. - - * Makefile.in (c-parse.c): Put BISON parameters in correct - order. - -Tue Apr 20 16:38:11 1999 Richard Henderson - - * alpha.md (nt_lda): New pattern. - * alpha.c (alpha_expand_prologue): Use it for large frames - under windows nt. - -Tue Apr 20 17:57:14 1999 Catherine Moore - - * config/arm/arm.md (movhi): Add check for odd offset. - -Tue Apr 20 13:14:58 EDT 1999 John Wehle (john@feith.com) - - * i386.c (output_move_double): Abort if a non-offsettable - memory operand is encountered. Delete unused code. - (find_addr_reg): Remove. - -Mon Apr 19 21:13:02 1999 Craig Burley - - * tree.def (BLOCK): Fix typo in comment. - -1999-04-19 14:51 -0400 Zack Weinberg - - * cpplib.c (output_line_command): Drop CONDITIONAL argument. - We can omit unnecessary line commands if file_change == - same_file and pfile->lineno != 0. All callers changed. - (cpp_get_token [case '\n']): Don't bump pfile->lineno if - CPP_OPTIONS (pfile)->no_line_commands is set. - * cpplib.h: Fix prototype of output_line_command. - -1999-04-18 17:46 -0400 Zack Weinberg - - * cppfiles.c (find_position, read_and_prescan): Use `unsigned - long' variables consistently to count line and column numbers. - -Sun Apr 18 15:50:33 EDT 1999 John Wehle (john@feith.com) - - * output.h (current_function_is_leaf, - current_function_uses_only_leaf_regs): Declare. - * function.c (current_function_is_leaf, - current_function_uses_only_leaf_regs): Define. - (init_function_start): Initialize current_function_is_leaf - and current_function_uses_only_leaf_regs. - * final.c (leaf_function): Don't define. - (final_start_function): Replace uses of leaf_function with - current_function_uses_only_leaf_regs. - * toplev.c (rest_of_compilation): Set current_function_is_leaf - prior to invoking local register allocation. - (rest_of_compilation): Replace uses of leaf_function with - current_function_uses_only_leaf_regs. - * dbxout.c (dbxout_symbol, dbxout_parms): Likewise. - * dwarf2out.c (add_location_or_const_vaule_attribute): Likewise. - * dwarfout.c (add_location_or_const_value_attribute): Likewise. - * sdbout.c (sdbout_symbol): Likewise. - * sparc.h (FUNCTION_PROLOGUE, FUNCTION_EPILOGUE): Likewise. - * sparc.c (eligible_for_epilogue_delay, output_return, - sparc_return_peephole_ok): Likewise. - * sparc.md (leaf_function attribute, untyped_return): Likewise. - * i386.c (ix86_compute_frame_size): Don't align the stack - for leaf functions which don't allocate any stack slots. - * tm.texi: Update documentation. - -Sun Apr 18 02:15:09 PDT 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Apr 18 00:08:45 1999 Richard Henderson - - * alpha.h (GO_IF_LEGITIMATE_SIMPLE_ADDRESS): Correct last change -- - make sure FP_BASE_P registers are only used with an integer. - -Sat Apr 17 22:54:17 1999 Richard Henderson - - * alpha.h (REG_OK_FP_BASE_P): New macro. - (GO_IF_LEGITIMATE_SIMPLE_ADDRESS): Use it. - * alpha.md (adddi3+1): New insn to handle large constants off - the soft frame pointer. - (adddi3+2): Don't split soft frame pointer or arg pointer additions. - -Sun Apr 18 17:24:10 1999 Michael Hayes - - * config/c4x/c4x.c (legitimize_operands): Use rtx_cost - to determine if it is worthwhile forcing a constant into a register. - * config/c4x/c4x.h (CONST_COSTS): An integer value of 255 or 65535 - used with a logical and or an integer value of 16 or 24 used with - a right shift has zero cost on the C40. - -Sat Apr 17 21:30:11 1999 Bernd Schmidt - - * gcse.c (compute_local_properties): If setp is nonzero, clear - TRANSP instead of setting it to all ones. - -Sat Apr 17 21:10:10 1999 Jan Hubicka - - * i386.c (i386_preferred_stack_boundary_string): New global variable. - (i386_preferred_stack_boundary): New global variable. - (override_functions): Set it. Tidy option setting code. - * i386.h (TARGET_OPTIONS): New command line option. - (i386_preferred_stack_boundary_string): Declare it. - (i386_preferred_stack_boundary): Likewise. - (PREFERRED_STACK_BOUNDARY): Use i386_preferred_stack_boundary. - -Sat Apr 17 19:22:38 1999 Jan Hubicka - - * i386.c (k6_cost): Take into account the decoding time. - -Sat Apr 17 19:13:22 1999 Donn Terry - - * i386.h (PRINT_OPERAND_PUNCT_VALID_P): Allow _. - * i386.c (print_operand): New %_ operator. - (load_pic_register): Proper number of leading _ in GOT literal. - * i386.md (prologue_get_pc_and_set_got): Likewise. - * i386/unix.h (ASM_OUTPUT_MI_THUNK): Likewise. - -Sat Apr 17 19:13:07 1999 Richard Henderson - - * alpha.c (alpha_expand_prologue): Use gen_adddi3 instead of - emit_move_insn+plus_constant. For NT, don't use the stack probe - loop pointer to allocate stack space. - * alpha.md (adddi3): Always use lda to set the stack pointer. - -1999-04-17 20:11 -0400 Zack Weinberg - - * c-aux-info.c, emit-rtl.c, explow.c, expmed.c, gcse.c, - haifa-sched.c, optabs.c, reorg.c, resource.c, sched.c: Include - toplev.h for real declaration of trim_filename. - * Makefile.in: Update dependencies. - -Sat Apr 17 14:36:19 1999 Craig Burley - - * tree.c (chainon): Check for circularity only if - ENABLE_CHECKING is defined. - -1999-04-17 10:15 -0400 Zack Weinberg - - * cccp.c: Make fatal non-static. - -Sat Apr 17 23:47:24 1999 Michael Hayes - - * config/c4x/c4x.md (*andqi3_255_clobber,*andqi3_65535_clobber): - New logical and patterns using C40 bit-field insert instructions. - (*lshrqi3_24_clobber,*ashrqi3_24_clobber,*lshrqi3_16_clobber, - *ashrqi3_16_clobber): New shift patterns using C40 bit-field insert - instructions. - -1999-04-16 22:44 -0400 Zack Weinberg - - * system.h: Always prototype abort. Prototype fatal. Define - abort to call fatal, not fprintf/exit. Define a stub macro - for trim_filename. - * toplev.c: Define DIR_SEPARATOR. (trim_filename): New - function. - * toplev.h: Prototype trim_filename, and #undef system.h's stub. - - * gcc.c, genattr.c, genattrtab.c, gencodes.c, genconfig.c, - genemit.c, genextract.c, genflags.c, genopinit.c, genoutput.c, - genpeep.c, genrecog.c: Make fatal non-static. - * gcov.c, gengenrtl.c, protoize.c: #undef abort after - including system.h. - - * config/i386/dgux.h, config/m68k/xm-amix.h: Remove stale code - relating to abort. - -Sat Apr 17 11:25:44 1999 Michael Hayes - - * config/c4x/c4x.md (mulqf3_clrqf_clobber, mulqi3_clrqi_clobber): - New patterns to support parallel multiply and load of zero. - -Fri Apr 16 01:23:47 1999 Jason Merrill - - * tree.c (valid_machine_attribute): If we're modifying the - FUNCTION_TYPE within a POINTER_TYPE and we don't get a decl, - update the POINTER_TYPE. - -Fri Apr 16 00:19:31 1999 Jan Hubicka - - * i386.c (x86_adjust_cost): Move break statement to correct place. - -Thu Apr 15 23:17:33 1999 Jerry Quinn - - * pa.h (HAVE_PRE_INCREMENT, HAVE_POST_INCREMENT, - HAVE_PRE_DECREMENT, HAVE_POST_DECREMENT): Fix pa_cpu value from - 8000 to PROCESSOR_8000. - -Thu Apr 15 20:46:57 1999 Donn Terry (donn@interix.com) - - * expr.c (expand_assignment): Force pointers to proper mode if - POINTERS_EXTEND_UNSIGNED is defined. - - * xm-alpha.h (alloca.h): Add Interix to list of special machines - that don't like alloca.h, pending using autoconf results. - - * except.c (start_catch_hadler): Be sure rtime_address is Pmode - if POINTERS_EXTEND_UNSIGNED. - - * except.c (expand_eh_return): Force pointers to proper mode if - POINTERS_EXTEND_UNSIGNED. - -Thu Apr 15 23:13:35 1999 Michael Hayes - - * config/c4x/c4x.h: Tweaked comment formatting. - * config/c4x/c4x.c: Likewise. - -Thu Apr 15 02:45:19 1999 Mumit Khan - - * aclocal.m4 (GCC_FUNC_MKDIR_TAKES_ONE_ARG): Define. - * configure.in: Use. - * configure: Rebuilt. - * acconfig.h (MKDIR_TAKES_ONE_ARG): Add. - * config.in: Rebuilt. - * system.h: Use. - -Thu Apr 15 01:03:21 1999 Jan Hubicka - Jeff Law - - * i386.md (QImode add pattern): Support lea instruction. - (HImode add pattern): Likewise. - - * i386.md (ashlsi patterns): Call output_ashl instead of output_ashlsi3. - (ashlqi): Use expander, separate LEA and SAL / ADD patterns; call - output_ashl. - (ashlhi): Likewise. - * i386.h (output_ashl): Renamed from output_ashlsi3. - * i386.c (output_ashl): Likewise; support HImode and QImode operands - as well. - - * i386.md (notsi, nothi, xorsi, xorhi, and xorqi patterns): Call - memory_address_displacement_length instead of memory_address_length. - * i386.c (memory_address_info): Renamed from memory_address_length. - Accept new argument DISP_LENGTH. All callers changed. If DISP_LENGTH, - then return the displacement length. Else return length of the - entire memory address. Handle MULT case correctly. - * i386.h (memory_address_info): Update declaration. - - * i386.md (memory_bit_test): Fix paren error. - -Wed Apr 14 21:29:18 1999 Andrew Haley - - * flow.c: (make_edges): Always make edges from a basic block - to its exception handlers, even if the block ends with a jump. - -1999-04-14 23:26 -0400 Zack Weinberg - - * graph.c (node_data): Return void. Ignore result of - print_rtl_single. Change caller to match. - * integrate.c (subst_constants): Initialize op0_mode to an - invalid mode, and abort before use if it's still invalid. - (Can only happen if the RTX_CLASS, RTX_FORMAT tables are corrupted.) - * objc/objc-act.c (get_objc_string_decl, - build_selector_translation_table, generate_protocol_list, - synth_id_with_class_suffix, build_keyword_selector, - build_selector_expr, gen_declarator): Abort when the tree - structure is corrupted. - -Wed Apr 14 19:57:49 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in (alpha interix): Use symbolic names to set - target_cpu_default. - * configure: Rebuilt. - - * explow.c (allocate_dynamic_stack_space): Undo last change. Use - convert_memory_address instead. - -Wed Apr 14 19:42:02 1999 Donn Terry (donn@interix.com) - - * alpha/lib1funcs.asm: New file. - * alpha/t-interix (lib1funcs.asm): Add to build. - - * explow.c (allocate_dynamic_stack_space): Correctly convert TARGET - to Pmode. - -Wed Apr 14 14:26:36 1999 John Wehle (john@feith.com) - - * i386.md (truncxfdf): Output the template supplied - by output_move_double with the correct operands. - - * i386.md (extendsfdf, extendsfxf, extenddfxf): Use - output_float_extend instead specifying '#' as the template. - * i386.c (output_float_extend): Define. - * i386.h (output_float_extend): Declare. - -Wed Apr 14 10:48:03 1999 Catherine Moore - - * config/mips/elf.h, config/mips/elf64.h - (CTORS_SECTION_ASM_OP): Define. - (DTORS_SECTION_ASM_OP): Define. - (EXTRA_SECTIONS): Define. - (INVOKE__main): Define. - (NAME__MAIN): Define. - (SYMBOL__MAIN): Define. - (EXTRA_SECTIONS_FUNCTIONS): Define. - (SECTION_FUNCTION_TEMPLATE): Define. - (ASM_OUTPUT_CONSTRUCTOR): Define. - (ASM_OUTPUT_DESTRUCTOR): Define. - (CTOR_LIST_BEGIN): Define. - (CTOR_LIST_END): Define. - (DTOR_LIST_BEGIN): Define. - (DTOR_LIST_END): Define. - (LIB_SPEC): Define. - (STARTFILE_SPEC): Define. - (ENDFILE_SPEC): Define. - * config/mips/linux.h: Undefine all of the above. - * config/mips/rtems64.h: Likewise. - * config/mips/t-r3900: Likewise. - * config/mips/t-elf: New file. - * config/mips/vxworks.h: New file. - * configure.in (mips-wrs-vxworks): Use mips/vxworks.h. - (mips*-*-*elf*): Use t-elf instead of t-ecoff. - * configure: Regenerate. - -Wed Apr 14 09:59:38 1999 Richard Henderson - - * reload1.c (emit_reload_insns): Also find equivalent mems - for subregs of pseudos. - - * alpha.c (aligned_memory_operand): Recognize the output of - LEGITIMIZE_RELOAD_ADDRESS. Examine reg_equiv_memory_loc in - the event of a pseudo. - (unaligned_memory_operand): Likewise. Don't otherwise accept - completely illegal addresses. - (normal_memory_operand): Likewise. Handle subregs of pseudos. - (get_aligned_mem): Revert previous change. Abort if we don't have a - mem. During reload, call find_replacement on all illegal memories. - (get_unaligned_address): Likewise. - * alpha.h (SECONDARY_INPUT_RELOAD_CLASS): Use !aligned_memory_operand - instead of unaligned_memory_operand. - * alpha.md: Revert extra argument to get_aligned_mem. - (reload_inqi): Use any_memory_operand in constraints. Abort if - we're not given some sort of mem. - (reload_inhi): Likewise. - (reload_outqi, reload_outhi): Likewise. - -Wed Apr 14 09:39:20 1999 Richard Henderson - - * i386.md (neghi): Use the whole register when widening the op. - -1999-04-14 12:37 -0400 Zack Weinberg - - * cpperror.c, cppexp.c, cpplib.c: Never call abort. - * cpphash.c: Only call abort when we detect corruption of the - malloc arena. - * cppmain.c: Don't define fatal or fancy_abort. - -Wed Apr 14 09:19:39 1999 Jan Hubicka - - * i386.c (x86_adjust_cost): Agi stall takes 1 cycle on Pentium, fst - requires value to be ready one extra cycle. - -Wed Apr 14 11:28:34 1999 Dave Brolley - - * config/i386/i386.c (memory_address_length): Add missing parenthesis. - -Wed Apr 14 13:59:27 1999 Martin von Loewis - - * extend.texi (Deprecated Features): New node. - * invoke.texi (-Wdeprecated): Document. - -Wed Apr 14 00:18:22 1999 Jan Hubicka - - * i386.md (SImode logical compare): Avoid outputing non-pariable testw - and testl on Pentium. - (register and memory bit tests): Likewise. - (setcc, normal and reversed conditional branches): Use shorter - sequence for testing flags stored in EAX. - - * i386.md (xorsi3): Do not output NOT instrctions on Pentium. - (xorqi3): Likewise. - (xorhi3): Likewise. - (notsi2): Likewise. - (notqi2): Likewise. - (nothi2): Likewise; do not output prefixed opcodes when possible. - - * i386.md (neghi2): Do not output prefixed opcode when possible. - (ashlhi3): Likewise. - -Wed Apr 14 00:08:46 1999 Richard Henderson - - * i386.c (memory_address_length): New function. - * i386.h (memory_address_length): Declare it. - -Tue Apr 13 22:52:04 1999 Donn Terry (donn@interix.com) - Martin Heller (Ing.-Buero_Heller@t-online.de) - - * configure.in (interix Alpha): Add. - (winnt Alpha): Use alpha32.h - (interix i386): Parallel Alpha32. - * configure: Rebuilt. - - * config/interix.h: Move common elements from i386-interix.h. - * config/i386/i386-interix.h: Delete same. - * config/alpha/alpha-interix.h: New file. - - * config/alpha/alpha32.h: New file, part fron win-nt.h. - * config/alpha/win-nt.h: Deletions (-> alpha32.h). - * config/alpha/interix.h: New file - - * config/alpha/alpha.md (interix): Comment. - - * config/alpha/xm-alpha-interix.h: New file. - - * config/alpha/t-interix: New file. - - * fixinc/mkfixinc.sh (interix/Alpha): Add. - -1999-04-13 Mike Stump - - * i386/vxi386.h (CPP_CPU_SPEC): Define appropriately for vxworks. - (CPP_PREDEFINES, LIB_SPEC, STARTFILE_SPEC, ENDFILE_SPEC): likewise. - -Tue Apr 13 21:01:36 1999 Jason Merrill - - * c-common.c (default_valid_lang_attribute): New fn. - (valid_lang_attribute): New callback ptr. - (decl_attributes): Call it. Move init_priority support into - C++ frontend. - -Tue Apr 13 17:47:14 1999 John Wehle (john@feith.com) - - * i386.md (movdi): Add splitter. - -Wed Apr 14 10:04:27 1999 Michael Hayes - - * config/c4x/c4x.md (storeqf_int, storeqf_int_clobber, loadqf_int, - loadqf_int_clobber): Add new patterns with corresponding splitters - to handle moves of floating point values into and out of intager - registers by using memory. - - * config/c4x/c4x.c (c4x_check_legit_addr): Disallow PRE_INC for modes - other than QFmode and QImode. - (mixed_subreg_operand): New function. - (c4x_emit_move_sequence): If moving a floating point value into or - out of an integer register, use the new patterns storeqf_int_clobber - or loadqf_int_clobber. - (reg_imm_operand, *_reg_operand): Call reg_operand instead of - register_operand. - (reg_operand, src_operand): Disallow operand if it satisifes - mixed_subreg_operand. - - * config/c4x/c4x.h (mixed_subreg_operand): Add prototype. - -Tue Apr 13 14:49:13 1999 Jan Hubicka - - * i386.c (agi_dependent): Handle push operation more correctly. - -Tue Apr 13 14:45:17 1999 Jan Hubicka - - * i386.md (anddi3): Add % constraint. - (iordi3, xordi3): Likewise. - -Tue Apr 13 14:29:58 1999 Jan Hubicka - - * i386.md (extendhisi2): Output mov instead of cw instruction for K6 - to improve decoding bandwidth. - * i386.md (extendhiqi2): Likewise. - -Tue Apr 13 14:26:31 1999 Jan Hubicka - - * i386.md (movsf_push): Handle memory to memory case too, new splitter. - (movdf_push, movxf_push): Likewise. - (movsf_push_memory, movdf_push_memory, movxf_push_memory): Remove. - -Tue Apr 13 14:14:06 1999 Jan Hubicka - - * i386.md: Do not output mov %0,reg on AMD K6. - -Tue Apr 13 12:14:07 1999 Dave Brolley - - * cppinit.c (cpp_start_read): Fix buffer overwrite. - * Makefile.in (cppinit.o): Typo in dependencies. - -Tue Apr 13 05:04:59 1999 Richard Earnshaw (rearnsha@arm.com) - - * arm.h (function prototypes for arm.c): Ifdef these out if - HAVE_CONFIG_H is not defined. - -Tue Apr 13 02:11:11 1999 Jeffrey A Law (law@cygnus.com) - - * pa.c: Avoid Using immediate zero for register zero. - * pa.md: Likewise. - - * pa.c (print_operand, case 'f'): New case for FP register or 0.0. - (print_operand, case 'r'): Use %r0 for zero value. - * pa.md (move patterns, fcmp patterns): Use new %f output arg. - - * pa.c: Use a register name, not a raw immediate in branch, - compare/clear, sub, subb, uaddcm and vshd instructions. - * pa.md: Likewise. - - * pa.md, pa.h, ee.asm, ee_fp.asm, lib2funcs.asm: Likewise. - - * pa.c: Use a register name, not a raw immediate in "bv" instructions. - * pa.md, pa.h, ee.asm, ee_fp.asm, lib2funcs.asm: Likewise. - - * pa.c: Remove space register specification in memory addresses, - except where it is actually needed. - * pa.md, pa.h, ee.asm, ee_fp.asm, lib2funcs.asm: Likewise. - -Mon Apr 12 23:34:35 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Apr 12 14:58:30 1999 Jan Hubicka - - * reg-stack.c (check_stack_regs_mentioned): Remove variable SIZE. - -Mon Apr 12 19:15:17 1999 Daniel Jacobowitz - - * rs6000/sysv4.h (CPP_OS_LINUX_SPEC): Add missing backslash. - -Mon Apr 12 19:11:38 1999 Mumit Khan - - * i386/cygwin.h (SUBTARGET_SWITCHES): Add -mconsole; fix - -mno-nop-fun-dllimport and minor doc fixes. - (STARTFILE_SPEC): Cygwin DLLs don't have dllcrt0. - (LINK_SPEC): Add -mconsole support. - * i386/mingw32.h (LIB_SPEC): Make libraries consistent with - Cygwin. - (LINK_SPEC): Remove. Use Cygwin's version. - (MATH_LIBRARY): Make it null. - * i386/crtdll.h (MATH_LIBRARY): Likewise. - -Fri Apr 12 15:00:52 1999 Stan Cox - - * c-decl.c (c_decode_option, start_decl, start_function, - finish_function) : Recognize -Wno-main so we can avoid warnings. - -1999-04-12 Zack Weinberg - - * cpphash.c (collect_expansion, macroexpand, - push_macro_expansion): Make the escape character in macro - buffers '\r', not '@'. Remove code to protect literal - occurences of the escape character; '\r' cannot appear - in a macro buffer unless we put it there. - * cpplib.c (skip_comment, copy_comment, cpp_skip_hspace, - copy_rest_of_line, cpp_get_token, parse_string, - parse_assertion): '\r' might be a backslash-newline marker, or - it might be a macro escape marker, depending on - CPP_BUFFER (pfile)->has_escapes. '@' is not a special - character. - * cpplib.h: Update commentary. - -Mon Apr 12 09:30:03 1999 Richard Earnshaw (rearnsha@arm.com) - - * arm.h (target_fp_name, structure_size_string, arm_cpu_select): - Const-ify. - * arm.c (target_fp_name, structure_size_string): Const-ify. - - * arm.md (reload_inhi, reload_outhi): Make the scratch DImode. - * arm.c (arm_reload_in_hi): Handle cases when the input is still - a pseudo, make use of scratch registers for reloading the address - as appropriate. - (arm_reload_outhi): Similarly for when the output is still a pseudo. - - * riscix.h (SUBTARGET_SWITCHES): Document. - -1999-04-12 Bruce Korb - - * fixincludes: - make fixincludes behave like the scripts in fixinc/ - - * Makefile.in( stmp-fixinc ): - ensure the SHELL value is that of the make - - * fixincl/inclhack.tpl: - the file name lists ought to be restricted to "*.h" anyway - C++ files may be named .../[a-z]++/... also - Adding copyright year and attribution to output - - * fixincl/inclhack.def: - fixed broken expression - Clarify a some comments - - * fixincl/fixincl.tpl: - Clarify a some comments - Remove dead template text - Correct the counting of regular expressions - -Mon Apr 12 03:07:44 1999 Richard Henderson - - * alpha.c (aligned_memory_operand): Handle out of range stack slots. - Take a new SCRATCH argument for the occasion. Update all callers. - (get_unaligned_address): Abort on out of range stack slots. - * alpha.md (adddi3 splitter): Check s_p_rtx not REGNO. - (reload_inqi): Check for aligned mems before unaligned. - (reload_inhi): Likewise. - -Mon Apr 12 03:11:30 1999 Jeffrey A Law (law@cygnus.com) - - * flow.c (flow_delete_insn): If we delete a CODE_LABEL, also remove - it from the nonlocal_goto_handler_labels list. - * jump.c (delete_insn): Likewise. - (jump_optimize_1): Also recompute LABEL_NUSES when we are just - marking labels. - * rtl.h (remove_node_from_expr_list): Declare. - * rtlanal.c (remove_node_from_expr_list): New function. - -Mon Apr 12 02:37:02 1999 Jan Hubicka - - * reg-stack.c: Update comment, include varray.h. - (stack_regs_mentioned_data): New global variable. - (check_stack_regs_mentioned): New function. - (stack_regs_mentioned): New function. - (reg_to_stack): Initialize and free stack_regs_mentioned_data, - use stack_regs_mentioned. - (record_asm_reg_life): Change insn type cache for changed insn. - (record_reg_life): Do not change the insn mode. - (emit_pop_insn): Likewise. - (emit_swap_insn): Likewise. - (move_for_stack_reg): Likewise. - (stack_reg_life_analysis): Use stack_regs_mentioned. - (emit_swap_insn): Likewise. - (subst_stack_regs): Likewise. - (convert_regs): Likewise. - * jump.c (find_cross_jump): Use stack_regs_mentioned. - * rtl.h (stack_regs_mentioned): Declare. - -Mon Apr 12 00:57:10 1999 Theodore Papadopoulo - - * integrate.c (INTEGRATE_THRESHOLD): Sync it with the comment. - -Sun Apr 11 10:24:18 1999 Mark Mitchell - - * rtl.h (rtx_def): Update documentation for jump and call. - -Sun Apr 11 07:43:44 1999 Kaveh R. Ghazi - - * jump.c (jump_optimize_1): Make the definition static to match - the prototype. - -Sat Apr 10 22:51:53 1999 Jan Hubicka - - * flow.c (life_analysis): New parameter remove_dead_code. - (life_analysis_1): Likewise. - (propagate_block): Likewise; use it. - * output.h: Update prototype. - * toplev.c: Update calls to life_analysis. - -Sat Apr 10 22:12:12 1999 Jan Hubicka - - * recog.c (constrain_operands): Ignore unary operators when - matching operands. Recognize '5'..'9' as well. - -Sat Apr 10 21:53:02 1999 Philipp Thomas (kthomas@gwdg.de) - Richard Henderson - - * configure.in: Set target_cpu_default2 for target_alias k6. - * i386.h (TARGET_SWITCHES): Remove no- entries. - (CC1_CPU_SPEC): Likewise. - (CPP_CPU_DEFAULT_SPEC): Streamline definition. Add K6 version. - (CPP_K6_SPEC): New. - (CPP_CPU_SPEC): Add K6 variant. - (EXTRA_SPECS): Likewise. - -Fri Apr 9 11:29:17 1999 Richard Henderson - - * flow.c (merge_blocks_nomove): Rewrite to properly handle two - blocks that vanish entirely during merging. - -Sat Apr 10 20:09:55 1999 John Wehle (john@feith.com) - - * i386.md (floatsisf2, floatdisf2, floatsidf2, floatdidf2, - floatsixf2, floatdixf2, movsicc, movhicc, movsfcc, movdfcc, - movxfcc, movdicc): Remove unused register constraints from - the splitters. - - * i386.md (fixuns_truncsfsi2, fixuns_truncdfsi2, - fixuns_truncxfsi2): Delete. - - * reg-stack.c (delete_insn_for_stacker): Ensure that - the only side effects of a PARALLEL are clobbers. - (subst_stack_regs): Handle subst_stack_regs_pat deleting - a PARALLEL. - * i386.md (extendsfdf2, extenddfxf2, - extendsfxf2): Rewrite using a splitter. - * i386.c (output_op_from_reg): Remove. - * i386.h: Likewise. - -Sat Apr 10 13:09:18 1999 Nick Clifton - - * config/arm/arm.c (di_operand): Allow SUBREGs as well. - (soft_df_operand): Allow SUBREGs as well. - -Sat Apr 10 06:14:31 1999 Jan Hubicka - - * extend.texi (Assembler Instructions with C Expression Operands): - Document the i386 floating point operands. - -1999-04-10 Mike Stump - - * configure.in (*-*-vxworks): Add vxWorks thread support for all - vxWorks targets. - * configure.in (thumb-wrs-xvworks): Add vxWorks support for thumb. - * configure: Rebuilt. - -Sat Apr 10 06:04:50 1999 Donn Terry (donn@interix.com) - - * i386/t-interix: Use mostly system headers unchanged. - Use system assert.h - * fixinc/fixinc.interix: Ditto (make almost no-op). - * config/x-interix.h (_ALL_SOURCE): add -D - * config/x-interix.h (crti.o): Delete dependency. - * config/xm-interix.h (ONLY_INT_FIELDS): Define only when bootstrapping. - * i386/xm-i386-interix.h: New file. - * i386/interix.h (ASM_OUTPUT_LIMITED_STRING): Fix warnings. - * i386/i386-interix.h: Renamed from interix.h. - * configure.in (interix): Use new files. - * configure: Rebuilt. - -Sat Apr 10 05:25:28 1999 Daniel Jacobowitz - - * rs6000/sysv4.h (CPP_OS_LINUX_SPEC): Fix conditions - for -Dunix and -Dlinux, and remove duplicate definition. - Change -Asystem(linux) to -Asystem(posix). - (CPP_OS_SOLARIS_SPEC): Fix conditions for -Dunix, -Dsun, - -DSVR4, -D__EXTENSIONS__. - - * rs6000/linux.h (CPP_PREDEFINES): Remove -Dunix, - -Dlinux, -Asystem(linux), and -Asystem(unix). - -Sat Apr 10 05:14:50 1999 Mark Elbrecht - - * i386/djgpp.h (SET_ASM_OP): Define. - - * cccp.c (DIR_SEPARATOR): Move to the top of the file. - (is_dir_separator): New function. - (simplify_filename): Use it. - * collect2.c (find_a_file): Use HAVE_DOS_BASED_FILE_SYSTEM in place - of the DIR_SEPARATOR test. - Consider any file starting with a drivename to be absolute. - If the absolute filename test fails and EXECUTABLE_SUFFIX is - defined, append EXECUTABLE_SUFFIX to the file and try again. - * cppinit.c (base_name): Use HAVE_DOS_BASED_FILE_SYSTEM - in place of __MSDOS__ and _WIN32. - * cppfiles.c (simplify_pathname): Likewise. - * gcc.c (IS_DIR_SEPARATOR): Define new macro. Returns true if a - character is a directory separator. - (find_a_file): Use it. - (convert_filename): Likewise. - (process_command): Likewise. - (do_spec_1): Likewise. - (is_directory): Likewise. - (main): Likewise. - * prefix.c (IS_DIR_SEPARATOR): Define. Tests whether a character is - a directory separator. - (translate_name): Use it. - (update_path): Change DIR_SEPARATOR_2 to DIR_SEPARATOR. Fix - warning in block where '/' is changed to DIR_SEPARATOR. - * i386/xm-djgpp.h (DIR_SEPARATOR): Set to '/'. - (DIR_SEPARATOR_2): New macro. Set to '\'. - (HAVE_DOS_BASED_FILESYS): Define. - * i386/xm-mingw32.h: Updated copyright. Set - DIR_SEPARATOR_2 to '/'. Define HAVE_DOS_BASED_FILE_SYSTEM. - * i386/xm-os2.h: Likewise. - * winnt/xm-winnt.h: Likewise. - * i386/xm-dos.h: Likewise. Add copyright. - -1999-04-10 Joseph S. Myers - - * pdp11.h (TARGET_SWITCHES): Add option to vary assembler syntax. - (TARGET_DEFAULT): Possibly use UNIX syntax. - (TARGET_UNIX_ASM, TARGET_UNIX_ASM_DEFAULT): New macros. - (REGISTER_NAMES): Use "r5" instead of "fp". - (ASM_OUTPUT_ALIGN): Use ".even" directive, and abort for any - greater alignment. - * 2bsd.h (TARGET_UNIX_ASM_DEFAULT): Default to UNIX assembler - syntax for 2BSD. - * pdp11.c (output_ascii): Use working syntax for ".byte". - (print_operand_address): Use "*" instead of "@" when using UNIX - assembler syntax. - -Sat Apr 10 03:50:12 1999 Jeffrey A Law (law@cygnus.com) - - * rtl.h (rebuild_jump_labels): Declare. - * jump.c (jump_optimize_1): Renamed from jump_optimize. Make static. - Add new argument MARK_LABELS_ONLY. Quit after mark_all_labels if - requested. - (jump_optimize, rebuild_jump_labels): New wrapper functions for - jump_optimize_1. - * toplev.c (rest_of_compilation): Use rebuild_jump_labels instead of - running the entire jump optimizer. - - * rtl.h (local_alloc): Returns an integer now. - * local-alloc.c (recorded_label_ref): New file scoped variable. - (local_alloc): Initialize recorded_label_ref to zero. Return its - value when local allocation has completed. - (update_equiv_regs); If we create an equivalence for a LABEL_REF, - set recorded_label_ref. - * toplev.c (rest_of_compilation): Run the jump optimizer after - register allocation and reloading if needed. - -Fri Apr 9 21:02:57 1999 Krister Walfridsson (cato@df.lth.se) - - * i386/gas.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Fix typo. - * i386/freebsd-elf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. - -1999-04-09 Zack Weinberg - - * cpphash.c (special_symbol): When expanding __LINE__, use the - top file buffer, not the top buffer. - -Fri Apr 9 13:41:04 1999 Jim Wilson - - * Makefile.in (check-g++, check-gcc, check-g77, check-objc): Add - cd .. to TCL_LIBRARY command. - -Fri Apr 9 13:04:52 1999 Nick Clifton - - * config/arm/unknown-elf.h (SUBTARGET_CPU_DEFAULT): Only define if - not already specified. - -Fri Apr 9 11:18:55 1999 Jason Merrill - - * c-common.c (decl_attributes, A_INIT_PRIORITY): Allow arrays - of classes, too. - -Fri Apr 9 10:40:10 1999 Kaveh R. Ghazi - - * rs6000.c (rs6000_override_options, ptt, rs6000_file_start, - rs6000_float_const, rs6000_replace_regno, debug_stack_info, - rs6000_output_load_toc_table, output_prolog, output_epilog): - Const-ify a char*. - (output_mi_thunk): Likewise. Mark parameter `thunk_fndecl' with - ATTRIBUTE_UNUSED. Hide unused variables `r0', `sp', `toc', - `schain', `r12', `buf' and `labelno'. - (output_ascii): Const-ify a char*. - (rs6000_gen_section_name): Initialize variable `last_period'. - (rs6000_adjust_priority): Mark parameter `insn' with - ATTRIBUTE_UNUSED. - (rs6000_trampoline_template, rs6000_dll_import_ref, - rs6000_longcall_ref, rs6000_encode_section_info): Const-ify a char*. - - * rs6000.h (offsettable_mem_operand, optimization_options): Add - prototypes. - - * rs6000.md (movdi, define_split): Cast a value to HOST_WIDE_INT - when comparing against one. - -Thu Apr 8 19:20:18 1999 Jeffrey A Law (law@cygnus.com) - - * expr.c (expand_expr, case ARRAY_REF, COMPONENT_REF, BIT_FIELD_REF): - Do not try to optimize a aggregate address which has VOIDmode. - Mirrors March 23 change to expand_assignment. - - * flow.c (delete_unreachable_blocks): Do not require EDGE_FALLTHRU - for an edge when tidying an edge which connects consecutive basic - blocks. - - * flow.c (can_delete_label_p): Do not convert a label into a - deleted label here. - - * cse.c (flush_hash_table): New function. - (cse_insn): Flush the hash table when we encounter a volatile asm. - (cse_basic_block): Use flush_hash_table instead of doing it - inline. - - * reload1.c (reload_cse_regs_1): Flush known register values if - we encounter a volatile asm. - - * loop.c (strength_reduce): Re-enable Joern's loop improvements. - -Thu Apr 8 09:37:40 1999 Nick Clifton - - * config/arm/arm.c (arm_print_operand): Undo previous change - - always print large constants in decimal. - -Thu Apr 8 10:22:23 1999 Kaveh R. Ghazi - - * configure.in (host_xm_file, build_xm_file): Include hwint.h. - Use case statements instead of "if test -a ... -a ... -a ..." - - * machmode.h: Don't define HOST_WIDE_INT, etc. Wrap use of - HOST_WIDE_INT in #ifdef. - - * mips.h: Include hwint.h instead of providing definitions for - HOST_WIDE_INT, etc. Wrap uses of HOST_WIDE_INT in #ifdef. - -Thu Apr 8 06:16:14 1999 John Wehle (john@feith.com) - - * i386.md (truncdfsf2, truncxfsf2, - truncxfdf2): Rewrite using a splitter. - -Thu Apr 8 01:26:05 1999 Arg Haas (ahaas@neosoft.com) - Jeffrey A Law (law@cygnus.com) - - * freebsd-elf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Avoid ambiguous - else statement. - * gas.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. - * linux.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. - * openbsd.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Likewise. - -Wed Apr 7 22:40:19 1999 Jim Wilson - - * i960/i960.c (i960_function_prologue): Don't save static chain - pointer. - * i960/i960.h (STACK_CHAIN_REGNUM): Change from r3 to g12. - (TRAMPOLINE_TEMPLATE): Likewise. - (FRAME_POINTER_REQUIRED): Check current_function_has_nonlocal_goto. - * i960/i960.md (nonlocal_goto): Rewrite. - -Tue Apr 6 17:49:49 1999 Philip Blundell - - * config/arm/lib1funcs.asm: Test for __ELF__ not __elf__. - -Wed Apr 7 14:07:34 1999 Jeffrey A Law (law@cygnus.com) - - * h8300.c (h8300_adjust_insn_length): Also avoid recognizing - ADDR_VEC and ADDR_DIFF_VEC insns. - - * h8300.c (h8300_adjust_insn_length): Avoid trying to recognize - USE, CLOBBER or SEQUENCE insns. - - * unroll.c (unroll_loop): For HAVE_cc0 machines, adjust copy_end_luid - to account for the uncopied insn that sets cc0 at the end of the loop. - - * unroll.c (copy_loop_body): Always ensure at least two insns - are in the copied loop. - -Wed Apr 7 14:52:18 1999 Catherine Moore - - * config/mips/elf.h (MAKE_DECL_ONE_ONLY): Define. - (UNIQUE_SECTION_P): Define. - -1999-04-07 Bruce Korb - - * fixinc/inclhack.tpl & fixincl.tpl: - Remove dynamic content from generated files - -Wed Apr 7 13:16:22 1999 John Wehle (john@feith.com) - - * i386.c (output_move_memory): Remove. - * i386.h: Likewise. - - * i386.md (movsi, movhi, movstricthi, movqi, movstrictqi, - movsf, movdf, movxf, movdi): Check no_new_pseudos instead - of (reload_in_progress | reload_completed). - -Wed Apr 7 03:16:45 1999 Richard Henderson - - * alpha.c (reg_no_subreg_operand): New function. - * alpha.h (PREDICATE_CODES): Add it. - * alpha.md (floatdi?f patterns): Use it for op1. - - * alpha.c (alpha_end_function): Don't flag weak functions. - -Wed Apr 7 02:11:55 1999 Richard Henderson - - * expr.c (expand_builtin) [BUILT_IN_RETURN_ADDRESS]: Use - copy_to_mode_reg; don't force constants into a register. - -Tue Apr 6 22:55:25 1999 Richard Henderson - - * toplev.c (compile_file): Typo flow_dump -> flow2_dump. - -1999-04-06 Joseph S. Myers - - * pdp11.c (simple_memory_operand): Add default case in switch. - * pdp11.h (TARGET_SWITCHES): Add help strings. - (NOTICE_UPDATE_CC): Don't include excess argument to format. - (ASM_OUTPUT_DOUBLE_INT): Remove. - -Tue Apr 6 22:09:40 1999 Richard Henderson - - * expr.c (expand_builtin_setjmp): Put setjmp return label on - nonlocal_goto_handler_labels for flow. - -Tue Apr 6 22:05:21 1999 Jan Hubicka - Richard Henderson - - * flow.c (verify_flow_info): New function. - (find_basic_blocks): Call it if ENABLE_CHECKING. - (merge_blocks): Don't merge if there are non-deletable labels. - * toplev.c (fatal_insn): Allow a printf-style arg list. - * toplev.h (fatal_insn): Update prototype. - -Tue Apr 6 16:18:58 1999 Jan Hubicka - - * flow.c (split_edge) update correctly flow graph, disable - EDGE_CRITICAL flag on the split edge, update NUSES for new label. - -Tue Apr 6 15:47:51 1999 Richard Henderson - - * emit-rtl.c (gen_rtx_CONST_DOUBLE): Use XWINT not XINT. - Clear third and following slots, if they exist. - -Tue Apr 6 15:45:28 1999 Richard Henderson - - * flow.c (create_basic_block): Make sure the bb note is in the block. - (can_delete_note_p): Rename from delete_note_p. - (delete_insn_chain): Preserve undeleteable labels too. - (tidy_fallthru_edge): Use next_real_insn instead of confusing - inline code. - -1999-04-06 Zack Weinberg - - * cppexp.c (parse_charconst): Initialize c. - (cpp_parse_expr): Initialize rprio. - * cppfiles.c (merge_include_chains): Initialize prev. - (finclude): Set fp->line_base to fp->buf before returning. - * cpphash.c (macroexpand): Initialize token. - * cppspec.c (lang_specific_driver): Change suff to - const char *const *. - -1999-04-06 Zack Weinberg - - * cppinit.c (install_predefs): Delete function. - (cpp_start_read): Don't call install_predefs. - (cpp_handle_option): Remove case 'u' and all refs to - opts->inhibit_predefs. - (print_help): Don't mention -undef. - (initialize_builtins): Define __HAVE_BUILTIN_SETJMP__, to - match cccp. - * cpplib.h (struct cpp_options): Remove inhibit_predefs - member. - - * cccp.c (predefs): Delete variable. - (main): Remove case 'u' in argument parse loop, - 'inhibit_predefs' variable, and the code block that would - process CPP_PREDEFINES. - (initialize_builtins): Don't define __OBJC__, the driver will - do that. - - * gcc.c (default_compilers): Remove -undef from all specs that - invoke a C preprocessor. - * ch/lang-specs.h: Likewise. - * cp/lang-specs.h: Likewise. - * f/lang-specs.h: Likewise. - * objc/lang-specs.h: Likewise. - -Mon Apr 5 11:55:31 1999 Donn Terry (donn@interix.com) - - * Makefile.in (SUBDIR_FLAGS_TO_PASS): Fix misapplied patch. - -Mon Apr 5 11:51:38 1999 Jeffrey A Law (law@cygnus.com) - - * m68k.md (movdf): Hide GPR sources & destinations from regclass. - -Mon Apr 5 09:54:42 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Apr 5 05:55:15 1999 Bruce Korb - - * fixincl.tpl: Separate "-e" from its argument, a la - the Sat Apr 3 17:05:13 1999 fix. - * genfixes: Ensure that the server shell is _NOT_ csh. - -Mon Apr 5 03:52:30 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Apr 5 04:47:14 1999 Jeffrey A Law (law@cygnus.com) - - * i386.c (x86_double_with_add): Turn off for Pentium and PPro. - (small_shift_operand, output_ashlsi3): New functions. - * i386.h (small_shift_operand, output_ashlsi3): Declare. - * i386.md (ashlsi3): Simplify ahlsi3 patterns. Remove splitters - that are no longer needed. - -Sun Apr 4 04:05:04 1999 Jeffrey A Law (law@cygnus.com) - - * stmt.c (expand_loop_end): When copying the loop exit test, - do not walk into a nested loop. - -Sun Apr 4 00:14:54 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc/hackshell.tpl: Skip links to directories, to avoid - removing them. - * fixinc/inclhack.tpl: Likewise. - * fixinc/fixinc.sh, fixinc/fixincl.x, fixinc/inclhack.sh: Rebuilt. - -Sat Apr 3 23:46:13 1999 David Edelsohn - - * rs6000.md (addsi3, iorsi3, xorsi3, adddi3, iordi3, xordi3, - movsi_got, movsi, movsf): Use no_new_pseudos. - * rs6000.c (rs6000_got_register): Likewise. - (offsettable_mem_opereand): Use || not |. - -Sat Apr 3 22:02:56 1999 Jeffrey A Law (law@cygnus.com) - - * acconfig.h (ENABLE_CHECKING): Remove redundant #undef. - * config.in: Rebuilt. - -Sat Apr 3 16:22:59 1999 Toshiyasu Morita (tm@netcom.com) - - * gcc.texi: Add info on regmove pass. - - * regmove.c (fixup_match_1): Consistently evaluate - HAVE_POST_INCREMENT and HAVE_POST_DECREMENT. - -Sat Apr 3 19:21:05 1999 Alexandre Oliva - - * configure.in (DEFAULT_LINKER, DEFAULT_ASSEMBLER): Use grep - instead of test and sed to check whether they're GNU programs. - * configure: Rebuilt. - -Sat Apr 3 17:57:35 1999 Alexandre Oliva - - * Makefile.in (install-headers-tar, install-headers-cpio): Avoid - problems with CDPATH. - Reported by Ralf Canis - -Sat Apr 3 13:50:16 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc.x86-linux-gnu: Deleted. - -Sat Apr 3 17:05:13 1999 Alexandre Oliva - - * inclhack.tpl: Insert spaces between `sed -e' and '...'. - Reported by Kaveh R. Ghazi - * fixinc/fixincl.sh, fixinc/fixincl.x, fixinc/inclhack.sh: Regen. - -Sat Apr 3 14:54:46 1999 Craig Burley - - * tree.def (BLOCK): Fix typo in comment. - -Sat Apr 3 00:53:29 1999 John Wehle (john@feith.com) - - * i386.md (floatsisf2, floatdisf2, floatsidf2, floatdidf2, - floatsixf2, floatdixf2): Rewrite using a splitter. - -Fri Apr 2 17:36:10 1999 Nick Clifton - - * config/arm/arm.c (arm_print_operand): Print large constants in - hex rather than decimal. - -Fri Apr 2 17:23:58 1999 Nick Clifton - - * print-rtl.c (print_rtx): Use both HOST_WIDE_INT_PRINT_DEC - and HOST_WIDE_INT_PRINT_HEX to display constants. - -1999-04-02 Zack Weinberg - - * config/i386/i386.h: Document all TARGET_SWITCHES or add - explicit null initializer. - - * config/i386/cygwin.h: Document all SUBTARGET_SWITCHES. - * config/i386/dgux.h: Likewise. - * config/i386/osf1elf.h: Likewise. - * config/i386/win32.h: Likewise. - * config/i386/osfrose.h: Likewise. Drop obsolete -mno-ident option. - -Fri Apr 2 17:49:44 1999 Toshiyasu Morita - - * regmove.c (fixup_match_1): Remove now useless if (0). - -Sat Apr 3 11:37:20 1999 Michael Hayes - - * tm.texi (USE_LOAD_POST_DECREMENT, USE_LOAD_PRE_DECREMENT, - USE_STORE_POST_DECREMENT, USE_STORE_PRE_DECREMENT): Document. - (USE_LOAD_POST_INCREMENT, USE_LOAD_PRE_INCREMENT, - USE_STORE_POST_INCREMENT, USE_STORE_PRE_INCREMENT): Fix documentation. - - * rtl.h (USE_LOAD_POST_DECREMENT, USE_LOAD_PRE_DECREMENT, - USE_STORE_POST_DECREMENT, USE_STORE_PRE_DECREMENT, - USE_LOAD_POST_INCREMENT, USE_LOAD_PRE_INCREMENT, - USE_STORE_POST_INCREMENT, USE_STORE_PRE_INCREMENT): Provide default - definition. - - * expr.c (USE_LOAD_POST_INCREMENT, USE_LOAD_PRE_INCREMENT, - USE_STORE_POST_INCREMENT, USE_STORE_PRE_INCREMENT): Delete default - definition. - -Fri Apr 2 16:03:05 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc.dgux, fixinc.interix, fixinc.irix, fixinc.ptx: Deleted. - * fixinc.sco, fixinc.svr4, fixinc.winnt, fixinc.wrap: Likewise. - -Fri Apr 2 15:46:25 1999 Donn Terry (donn@interix.com) - - * configure.in: Set and substitute quoted_cc_set_by_configure. - * configure: Rebuilt. - * Makefile.in (SUBDIR_FLAGS_TO_PASS): Fix quoting problem with ``. - -Fri Apr 2 14:35:45 1999 Stan Cox - - * config/i386/cygwin.h (CPP_SPEC): Use mingw_include_path instead - of a hardcoded path for -mno-cygwin. - (mingw_include_path): New. - -1999-04-02 Joseph S. Myers - - * pdp11.c: Include "recog.h". - (output_function_prologue): Remove unused variables `nregs', `i', - `offset'. - (output_function_epilogue): Remove unused variables - `may_call_alloca', `nregs', `regno', `adjust_fp'. - (output_ascii): Mark as returning void. - (print_operand_address: Likewise. - (simple_memory_operand): Remove unused variables `plus0', `plus1', - `offset'. - * pdp11.h: Declare functions `arith_operand', - `const_immediate_operand', `expand_shift_operand', - `legitimate_address_p', `notice_update_cc_on_set', `output_ascii', - `output_function_epilogue', `output_function_prologue', - `print_operand_address', `register_move_cost', - `simple_memory_operand'. - (HARD_REGNO_MODE_OK): Parenthesize `REGNO' arg. - (REGNO_REG_CLASS): Likewise. - * pdp11.md: Add explicit `int' to `static count' (in two places). - (addhi3): Add explicit braces to avoid ambiguous else. - (addqi3): Likewise. - (ashlhi3): Likewise. - -Fri Apr 2 14:17:10 1999 Jerry James - - * gcc/invoke.texi: Add documentation for additional supported - MIPS CPU types, options -mips16 and -mentry, and ABI and ISA - defaults. - -Fri Apr 2 14:12:06 1999 John Wehle (john@feith.com) - - * i386.md: Delete floating point compare, add, subtract, - multiply, and divide patterns which allowed integer - operands. - * i386.c (output_387_binary_op): Delete unused code. - (output_float_compare): Likewise. - -Fri Apr 2 11:53:37 1999 John Wehle (john@feith.com) - - * i386.md (movsf+1, movdf+1, movxf+1): Update constraints - so that SECONDARY_MEMORY_RELOAD is used. Remove dead code. - -1999-04-02 Bruce Korb - - * fixinc/mkfixinc.sh: Added support for x86-interix. - * fixinc/fixinc.interix: Fixincludes script, slight changes - from ./fixinc.interix. Untested (needs interix box). - * fixinc/inclhack.def: - Complete the change to the 'fixinc.tmp' file. - Fixed regex for finding C++ headers. - * fixincl.x, fixincl.sh, inclhack.sh: Regenerate. - -Fri Apr 2 11:36:12 1999 Jan Hubicka (hubicka@paru.cas.cz) - - * i386.c (print_operand_address, case REG): Do not use ESI addressing - mode for the K6. - - * i386.c (print_operand_address, case MULT): Use more efficient - encoding (mult (reg) (const_int 2)). - -Thu Apr 1 17:01:50 1999 Richard Henderson - - Move over patch from Bernd Schmidt from GC branch: - * emit-rtl.c (gen_rtx_CONST_DOUBLE): New function. - (gen_rtx): Call it. Tidy cases. - * rtl.h (gen_rtx_CONST_DOUBLE): Prototype it. - * gengenrtl.c: Add commentary. - (special_rtx): Also match CONST_DOUBLE. - (gencode): Emit call to memset instead of bzero. - -Fri Apr 2 12:58:26 1999 Michael Hayes - - * config/c4x/c4x.md (ashlhi3, lshrhi3, ashrhi3): Force operand 1 - into a register if shift count not constant. - (ashlhi3_reg, lshrhi3_reg, ashrhi3_reg): Ensure that operand 1 - is a register. - -Fri Apr 2 12:19:17 1999 Michael Hayes - - * config/c4x/c4x.md (*db): Enable pattern if TARGET_LOOP_UNSIGNED - is non-zero. - (movstrqi_small, movstrqi_large, *cmpstrqi): Add + modifier to address - register constraints. - (*movhi_clobber+1): Modify splitter pattern to handle destination - register that is used in the source address. - (*xorhi3_clobber): Replace AND with XOR in call to legitimize_operands. - -Fri Apr 2 12:16:15 1999 Michael Hayes - - * config/c4x/c4x.h: Added more comments. - -Fri Apr 2 11:58:22 1999 Michael Hayes - - * config/c4x/c4x.c (c4x_emit_move_sequence): Force invalid QImode - constants into memory if we get called directly from gen_move_insn - rather than emit_move_insn. - (c4x_legitimize_address): Fix up LABEL_REF addresses. - -Thu Apr 1 12:04:05 1999 Jim Wilson - - * expr.c (store_field): When check direct_store, assume all complex - modes can be directly stored. - -1999-04-01 Bruce Korb - - * fixinc/genfixes: New shell script that runs autogen - to create the generated files. - -1999-04-01 Manfred Hollstein - - * Makefile.in (cppmain$(exeext)): Depend on intl.o. Link in intl.o. - -Thu Apr 1 03:48:34 1999 H.J. Lu (hjl@gnu.org) - - * i386.c (output_fp_conditional_move): Abort for LT, LE, GE, and GT - signed integer comparisons. - - * i386.c (output_int_conditional_move): Use "enum rtx_code" for code - type. - - * i386.c (notice_update_cc): No need to check the INT mode for - conditional moves since FLOAT conditional moves don't affect cc0. - -Thu Apr 1 02:17:18 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc/inclhack.def (zzz_ki_syscalls, zzz_time): Fix trigger - string to only match on hpux11. - * fixinc/fixincl.x, fixinc/inclhack.sh, fixinc/fixinc.sh: Rebuilt. - -Thu Apr 1 01:09:27 1999 Alexandre Oliva - - * fixinc/hackshell.tpl: Complete transition to fixinc.tmp. - * fixinc/inclhack.sh: Rebuilt. - - * fixinc/inclhack.def: Fix typos in c_asm.h fix. - * fixinc/fixincl.x, fixinc/inclhack.sh, fixinc/fixinc.sh: Rebuilt. - -Wed Mar 31 17:20:11 1999 Jeffrey A Law (law@cygnus.com) - - * toplev.c (rest_of_compilation): Allow dbr_schedule to write to - the dump file too. - -Wed Mar 31 12:32:43 1999 Richard Henderson - - * flow.c (find_basic_blocks): New argument `do_cleanup'. - Conditionally call delete_unreachable_blocks. - (free_basic_block_vars): Zero ENTRY/EXIT data. - (allocate_for_life_analysis): Kill. Split into... - (allocate_bb_life_data, allocate_reg_life_data): ... new functions. - (life_analysis_1): Update. - * gcse.c (gcse_main): Update find_basic_blocks call. - * toplev.c (rest_of_compilation): Likewise. - * stupid.c (stupid_life_analysis): Update life data calls. - * rtl.h, output.h: Update prototypes. - -Wed Mar 31 12:10:00 1999 Bruce Korb - - * inclhack.def (several): Added spaces in tests to ensure - correct shell syntax. Added c_asm.h fix from fixincludes. - Also corrected the corrected fix to C++ comments :-} - - * inclhack.tpl: Changed method of traversing symlink trees - so that file name matching will work correctly. - - * fixincl.c, hackshell.tpl: Fallout from above. - * fixincl.x, inclhack.sh, fixincl.sh: Rebuilt. - -Tue Mar 30 10:43:49 1999 Philip Blundell - - * config/arm/aout.h (DBX_DEBUGGING_INFO): Avoid redefinition if - dbxelf.h was previously included. - (CPP_APCS_PC_DEFAULT_SPEC): No need to undefine. - - * config/arm/linux-elf.h (FP_DEFAULT): Correctly override the - definition from arm.h. - -Wed Mar 31 10:33:37 1999 Kaveh R. Ghazi - - * Makefile.in (c-gperf.h): Generate using gperf language 'C', not - 'KR-C', so gperf uses the `const' keyword on strings. - - * c-parse.gperf (resword): Const-ify a char*. - -Wed Mar 31 01:49:31 1999 Ian Lance Taylor - - * t-rtems (LIMITS_H_TEST, LIBGCC2_INCLUDES): Define. - -Wed Mar 31 00:50:48 1999 Jeffrey A Law (law@cygnus.com) - - * system.h (STDERR_FILENO): Fix typo. - - * inclhack.def (bool): Also fix bogus bool in curses_colr/curses.h. - * fixincl.x, inclhack.sh, fixincl.sh: Rebuilt. - -Tue Mar 30 20:51:40 1999 Mark Mitchell - - * alias.c (alias_set_compare): Remove. - (record_alias_subset): Use splay_tree_compare_ints instead of - alias_set_compare. - (init_alias_once): Likewise. - * cse.c: Include splay-tree.h. - (reg_qty): Remove. - (reg_tick): Likewise. - (reg_table): Likewise. - (cse_reg_info): New structure. - (cse_reg_info_free_list): New variable. - (cse_reg_info_tree): Likewise. - (cached_regno): Likewise. - (cached_cse_reg_info): Likewise. - (all_minus_one): Remove. - (consec_ints): Likewise. - (GET_CSE_REG_INFO): New macro. - (REG_TICK): Likewise. Use throughout instead of reg_tick. - (REG_IN_TABLE): Likewise. Use throughout instead of reg_in_table. - (REG_QTY): Likewise. Use throughout instead of reg_qty. - (get_cse_reg_info): New function. - (free_cse_reg_info): Likewise. - (new_basic_block): Reinitialize cse_reg_info_tree instead of - reg_tick, all_minus_one, and consec_ints. - * Makefile.in (cse.o): Depend on splay-tree.h - -Tue Mar 30 13:19:36 1999 Jason Merrill - - * libgcc2.c (throw_helper): Just return the SP offset, rather than - a whole udata. Include args_size in the offset. - (__throw, __rethrow): Adjust. - -Tue Mar 30 11:39:27 1999 Craig Burley - - * extend.texi (Extended Asm): Delete spurious `b' before - `@end example', which was confusing texi2html. - -Tue Mar 30 00:26:34 1999 Jason Merrill - - * dwarf2out.c (output_line_info): Don't emit redundant info. - Do start a new row if the file changes and the line # doesn't. - -Mon Mar 29 15:48:39 1999 Jason Merrill - - * invoke.texi (Invoking G++, C++ Dialect Options): Update. - -Mon Mar 29 15:05:39 1999 Richard Henderson - - * except.c (start_dynamic_handler): Force jmp_buf address to - and operand before moving to memory. - -Mon Mar 29 15:11:10 1999 Craig Burley - - * invoke.texi (Code Gen Options): Attempt to clarify - -fcheck-memory-usage. Minor edits to -fprefix-function-name. - -Mon Mar 29 20:52:47 1999 J"orn Rennecke - - * loop.c (maybe_eliminate_biv): For libcalls that set a giv, skip to - end of libcall. - -Mon Mar 29 20:35:49 1999 J"orn Rennecke - - * sh.md (mulsi3): Tag an extra REG_EQUAL note to the middle insn. - -Mon Mar 29 11:50:34 1999 Jerry Quinn - - * pa.h (HAVE_PRE_INCREMENT): Disable when optimizing for a PA8000 - class machine. - (HAVE_PRE_DECREMENT, HAVE_POST_INCREMENT): Likewise. - (HAVE_POST_DECREMENT): Likewise. - -Mon Mar 29 08:24:43 1999 Bruce Korb - - * fixinc/mkfixinc.sh: Fix portability problems with old shells. - - * fixinc/README: Updated for release announcement - -Sun Mar 28 20:26:55 1999 Kaveh R. Ghazi - - * recog.h (insn_outfun, insn_operand_predicate): Add prototype - arguments. - - * rtl.h (note_stores): Likewise. - - * rtlanal.c (note_stores): Likewise. - -Sun Mar 28 15:34:28 1999 Richard Henderson - - * varasm.c (output_constant_pool): Always mark the constant pool. - -Sun Mar 28 16:09:01 1999 Jerry Quinn - - * pa.md (pa7100LCshiftmem, pa7100LCalu): Change simultaneity. Use - shift/mem ops in pa7100LCalu. - - * pa.c (pa_adjust_cost): Don't do cost adjustments on pa8000. - (pa_reorg): Don't call pa_combine_instructions on pa8000. - -Sun Mar 28 15:27:26 1999 Jeffrey A Law (law@cygnus.com) - - * reload1.c (reload): Remove accidental code duplication. - -Sun Mar 28 12:22:12 1999 Robert Lipe (robertlipe@usa.net) - - * i386/sysv5.h: New file to describe UnixWare7/SVR5. - * configure.in (i?86-UnixWare7*-sysv): Use it. - * i386/udk.h: Use sysv5.h. Now uses Dwarf-2. - -Sun Mar 28 01:15:04 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Mar 28 00:44:27 1999 Jeffrey A Law (law@cygnus.com) - - * sdbout.c (sdbout_symbol): Do not call build_pointer_type, build - one on the fly and do not cache the result. - - * gcc.cps, cpp.cps: Delete unwanted files. - -Sat Mar 27 23:37:40 1999 John Wehle (john@feith.com) - - * i386.md (movdicc+3, movdicc+4): Rewrite using split_di. - * i386.c (output_int_conditional_move): Delete unused code. - -Sat Mar 27 21:17:36 1999 David Edelsohn - - * rs6000/{aix41.h,aix43.h} (ASM_CPU_SPEC): Add 604e. - -Sat Mar 27 16:13:50 1999 Jeffrey A Law (law@cygnus.com) - - * flow.c (mark_used_regs): Improve handling of ASMs. - -1999-03-26 Zack Weinberg - - * Makefile.in (xcpp, cppspec.o): New targets. - (CPP_INSTALL_NAME): New macro. - (install-cpp): Install xcpp. Use CPP_INSTALL_NAME. - (all.build, start.encap): Build xcpp. - - * cppspec.c: New file, implements argument filtering for a - user-visible C preprocessor. - * cpp.sh: Removed. - -Fri Mar 26 20:41:46 1999 Jim Wilson - - * Makefile.in (stmp-fixinc): Use tooldir instead of gcc_tooldir. - -Fri Mar 26 16:02:37 1999 Nick Clifton - - * configure.in (arm-*-vxworks*): Just include arm/vxarm.h. - * configure: Regenerate. - * config/arm/vxarm.h: Define SUBTARGET_CPU_DEFAULT before - including arm/coff.h - -1999-02-16 Scott Bambrough - - * configure.in (arm*-*-linux-gnu*): Set thread_file to 'posix' if - --enable-threads[={yes,pthreads,posix}] is passed as a command - line parameter to configure. - - * configure: Regenerate. - - * gcc/config/arm/t-linux (TARGET_LIBGCC2_CFLAGS): Include -fPIC. - -Fri Mar 26 19:42:19 1999 J"orn Rennecke - - * loop.c (combine_givs): Fix index into can_combine when doing - benefit adjustment for remaining givs when having combined a giv. - -Fri Mar 26 11:38:01 1999 Nick Clifton - - * config/arm/t-arm-elf (EXTRA_MULTILIB_PARTS): Define. - -Fri Mar 26 10:48:27 1999 Nick Clifton - - * config/arm/linux-elf.h: Include dbxelf.h - -Fri Mar 26 10:43:47 1999 Nick Clifton - - * config/svr4.h: Include new header file dbxelf.h. - (DBX_DEBUGGING_INFO): Remove definition. - (DBX_USE_BINCL): Remove definition. - (DBX_BLOCKS_FUNCTION_RELATIVE): Remove definition. - (ASM_IDENTIFY_GCC): Remove definition. - (ASM_IDENTIFY_GCC_AFTER_SOURCE): Remove definition. - (ASM_OUTPUT_SOURCE_LINE): Remove definition. - (DBX_FUNCTION_FIRST): Remove definition. - (DBX_OUTPUT_MAIN_SOURCE_FILE_END): Remove definition. - - * config/elfos.h: Include new header file dbxelf.h. - (DBX_DEBUGGING_INFO): Remove definition. - (DBX_BLOCKS_FUNCTION_RELATIVE): Remove definition. - (ASM_IDENTIFY_GCC): Remove definition. - (ASM_IDENTIFY_GCC_AFTER_SOURCE): Remove definition. - (ASM_OUTPUT_SOURCE_LINE): Remove definition. - (DBX_FUNCTION_FIRST): Remove definition. - - * config/dbxelf.h: New header file. - (DBX_DEBUGGING_INFO): Define. - (DBX_BLOCKS_FUNCTION_RELATIVE): Define. - (DBX_FUNCTION_FIRST): Define. - (DBX_USE_BINCL): Define. - (DBX_CONTIN_LENGTH): Define. - (ASM_IDENTIFY_GCC): Define. - (ASM_IDENTIFY_GCC_AFTER_SOURCE): Define. - (ASM_OUTPUT_SOURCE_LINE): Define. - (DBX_OUTPUT_MAIN_SOURCE_FILE_END): Define. - -Fri Mar 26 01:59:15 1999 "Charles M. Hannum" - - * fold-const.c (fold_truthop): Optimize bitfield references with - different masks as long as their size and bit position are the same. - - * fold-const.c (fold_truthop): Build a type for both the lhs and - rhs and use it appropriately. - - * fold-const.c (fold_truthop): Mask the lhs and rhs after merging - adjacent bitfield references. - - * fold-const.c (fold_truthop): Verify that the lhs and rhs are - in the same bit position when optimizing bitfield references - which have the same mask. - -Thu Mar 25 22:53:27 1999 Martin von Löwis - - * gcc.texi (Copy Assignment): New node. - -1999-03-25 Zack Weinberg - - * gcc.c: Compile unconditionally all code formerly dependent - on #ifdef LANG_SPECIFIC_DRIVER. - * gccspec.c: New file with stub lang_specific_driver, - lang_specific_pre_link. - * Makefile.in: Link gccspec.o into xgcc. Add rule to compile - -Thu Mar 25 21:08:02 1999 Jason Merrill - - * gcc.texi (Temporaries): Update. - -Thu Mar 25 16:53:53 1999 Richard Henderson - - * combine.c (distribute_notes): Place REG_LABEL also where - REG_EQUAL indicates. - -Thu Mar 25 12:46:37 1999 Jim Wilson - - * a29k/a29k.h (TARGET_SWITCHES): Add doc strings. - * i960/i960.h (TARGET_SWITCHES): Add doc strings. - * invoke.texi (a29k): Add documentation for -mno-multm option. - -Thu Mar 25 14:04:54 1999 Andrew MacLeod - - * rtl.texi (RTX_FRAME_RELATED_P): Add documentation. - * rtl.h (struct rtx_def): Update comment for frame_related field. - (set_unique_reg_note): Declare prototype. - * dwarf2out.c (dwarf2out_frame_debug_expr): Split out from - 'dwarf2out_frame_debug' to handle only expressions, and process - component parts of a PARALLEL expression. - (dwarf2out_frame_debug): Process insns only, and call - new function 'dwarf2out_frame_debug_expr' for patterns. - * emit-rtl.c (set_unique_reg_note): New function to add a reg note, - but if there is an existing one, delete it first. - * expmed.c (expand_mult, expand_divmod): Use set_unique_reg_note. - * optabs.c (add_equal_note, expand_binop): Use set_unique_reg_note. - (emit_no_conflict_block, emit_libcall_block): Use set_unique_reg_note. - (expand_fix): Use set_unique_reg_note. - -Thu Mar 25 11:47:49 1999 Art Haas - - * tlink.c (symbol_hash_newfunc): Remove redundant call to - hash_newfunc. - (file_hash_newfunc, demangled_hash_newfunc): Likewise. - -Thu Mar 25 10:05:56 1999 Richard Henderson - - * i386.h (PREFERRED_STACK_BOUNDARY): Set to 128. - -1999-03-25 Philip Blundell - - Based on patch from Jim Studt : - * config/arm/linux-elf.h (STARTFILE_SPEC, ENDFILE_SPEC): Copy - definitions from config/linux.h. - (DBX_BLOCKS_FUNCTION_RELATIVE): Define to 1. - -Thu Mar 25 02:12:42 1999 Finn Hakansson - - * loop.c (strength_reduce): Correct a comment. - - * rtl.h (MEM_COPY_ATTRIBUTES): Remove unnecessary ending backslash. - -Thu Mar 25 02:02:13 1999 Axel Thimm - - * Makefile.in (RANLIB_TEST): Improve test. - -Thu Mar 25 01:15:33 1999 Donn Terry - - * combine.c (force_to_mode, case PLUS): Use sign extended mask - when masking the low bits out of a constant. - -Tue Mar 23 15:45:25 1999 Richard Earnshaw (rearnsha@arm.com) - Jeff Law - - * fold-const.c (make_range): If orig_type is unset, set it as soon - as we know the type. Remove now unnecessary set of orig_type for - conversions. - -Wed Mar 24 23:27:25 1999 Mark Elbrecht - Jeff Law - - * system.h (STDIN_FILENO): Provide default definition if one is not - provided by the system header files. - (STDOUT_FILENO, STDERR_FILENO): Likewise. - - * i386/xm-djgpp.h (COLLECT2_HOST_INITIALIZATION): New macro. - * collect2.c (main): Use it. - (pexecute_pid): New variable. Holds return value from call to pexecute. - (collect2_execute): Rework to use pexecute instead of fork. - (collect2_wait): Use pwait() instead of wait(). - - * i386/djgpp.h: Fix typo. - -Wed Mar 24 23:24:30 1999 Jeffrey A Law (law@cygnus.com) - - * fixinc/mkfixinc.sh: Recognize cygwin* instead of only - cygwin32. - -Wed Mar 24 15:44:12 1999 Nick Clifton - - * config/m32r/m32r.c (init_idents): Accept both NAME and __NAME__ - versions of attribute names and values. - (m32r_valid_machine_decl_attribute): Likewise. - (m32r_encode_section_info): Likewise. - -Wed Mar 24 21:42:15 1999 J"orn Rennecke - - * reload1.c (choose_reload_regs): If output-reloading for a - simple move insn, try to inherit an equivalence for the input. - -1999-02-24 Mike Stump - - * arm/aout.h (DBX_OUTPUT_MAIN_SOURCE_FILENAME): Fix quoting. - -1999-03-24 Jim Blandy - - * libgcc2.c (__CTOR_LIST__, __DTOR_LIST__): Initialize on all - platforms. - -Wed Mar 24 01:35:01 1999 Geoff Keating - - * fold-const.c (fold): Recognize a rotate by an unsigned amount. - -Tue Mar 23 23:32:14 1999 Jeffrey A Law (law@cygnus.com) - - * pa.md (rotlsi3): New expander. Synthesize a variable rotate - left using a variable rotate right. Provide anonymous pattern for - rotate left by a constant value. - - * expr.c (expand_assignment): Do not try to optimize a aggregate - address which has VOIDmode. - -Tue Mar 23 22:51:48 1999 Mumit Khan - Donn Terry - - * protoize.c (abspath): Preserve multiple leading slashes for - _WIN32 and Interix. - -1999-01-23 Mike Stump - - * arm/vxarm.h: Split out vxWorks support into separate headerfile - and vxify. - * arm/arm.c (cpu_defaults): Allow arm710 as default. - - * configure.in: Split out vxWorks support for Arm. - * configure: Rebuilt. - -Tue Mar 23 11:20:03 1999 Per Bothner - - * tree.c (first_rtl_op, has_cleanups): Handle GOTO_SUBROUTINE_EXPR. - -Tue Mar 23 09:00:39 1999 Nick Clifton - - * config/arm/riscix1.h (SUBTARGET_SWITCHES): Add doc string. - * config/arm/riscix1-1.h (SUBTARGET_SWITCHES): Add doc string. - -Tue Mar 23 07:50:20 1999 Mark Mitchell - - * function.c: Include hash.h. - (insns_for_mem_entry): New struct. - (put_reg_into_stack): Take an optional hash-table mapping MEMs to - the INSNs that use them. - (fixup_var_refs): Likewise. - (put_addressof_into_stack): Likewise. - (purge_addressof_1): Likewise. Keep the hash-table up to date if - we add new instructions. - (fixup_var_refs_insns): Use it to avoid searching the entire - instruction chain. - (insns_for_mem_newfunc): New function. - (insns_for_mem_comp): Likewise. - (insns_for_mem_walk): Likewise. - (compute_insns_for_mem): Likewise. - (pop_function_context_from): Pass NULL for the hash-table. - (put_var_into_stack): Likewise. - (gen_mem_addressof): Likewise. - (flush_addressof): Likewise. - (purge_addressof): Call compute_insns_for_mem to pre-compute the - hash table. - * Makefile.in (OBJS): Include hash.o. - (function.o): Depend on hash.h. - -Tue Mar 23 00:39:14 1999 Jeffrey A Law (law@cygnus.com) - - * i386/openbsd.h (TARGET_DEFAULT): Use symbolic names instead of - numbers. - * i386/netbsd.h, i386/freebsd.h: Likewise. - - * crtstuff.c: Use ANSI function definitions. Fix minor whitespace - problems. - - * i386/openbsd.h (TARGET_DEFAULT): Define. - * configure.in: Do not set TARGET_CPU_DEFAULT for x86 OpenBSD - configurations. - * configure: Rebuilt. - -Tue Mar 23 00:39:10 1999 John Wehle (john@feith.com) - - * i386/freebsd.h (TARGET_DEFAULT): Define instead - of TARGET_CPU_DEFAULT. - * i386/netbsd.h (TARGET_DEFAULT): Likewise. - -Mon Mar 22 23:52:01 1999 Mumit Khan - Donn Terry - - * sdbout.c (syms.h): Don't include on Interix. - * toplev.c (main): No sbrk on Interix. - - * configure.in: Add i386-pc-interix support. - * configure: Regenerate. - * fixinc.interix: New file. - * config/interix.h: New file. - * config/x-interix: New file. - * config/xm-interix.h: New file. - * i386/interix.h: New file. - * i386/interix.c: New file. - * i386/t-interix: New file. - -Mon Mar 22 23:41:49 1999 Jeffrey A Law (law@cygnus.com) - - * i386.h (PREFERRED_STACK_BOUNDARY): Define. - -Mon Mar 22 23:41:31 1999 John Wehle (john@feith.com) - - * i386.c (ix86_compute_frame_size): New function. - (ix86_prologue, ix86_epilogue): Use it. - * i386.h (INITIAL_ELIMINATION_OFFSET): Likewise. - * reload1.c: Provide default for PREFERRED_STACK_BOUNDARY. - -Mon Mar 22 18:06:59 1999 Jim Wilson - - * mips/mips.h (TARGET_SWITCHES, TARGET_OPTIONS): Add option doc - strings. - * mips/abi64.h (SUBTARGET_TARGET_OPTIONS): Likewise. - -Mon Mar 22 16:18:27 1999 Nick Clifton - - * config/arm/elf.h (VALID_MACHINE_DECL_ATTRIBUTE): Do not bother - passing ATTRIBUTES to arm_valid_machine_decl_attribute. - - * config/arm/coff.h (VALID_MACHINE_DECL_ATTRIBUTE): Do not bother - passing ATTRIBUTES to arm_valid_machine_decl_attribute. - - * config/arm/arm.h (DEFAULT_RTX_COSTS): Do not bother passing - OUTER_CODE to arm_rtx_costs - it is not used. - (arm_compare_fp): Delete declaration. - (FINAL_PRESCAN_INSN): Do not bother passing OPVEC or NOPERANDS to - arm_final_prescan_insn - they are not used. - (const_ok_for_op): Remove prototype. - (arm_rtx_costs): Fix prototype. - (arm_valid_machine_decl_attribute): Fix prototype. - (final_prescan_insn): Fix prototype. - - * config/arm/arm.md: Remove references to arm_compare_fp. - - * config/arm/arm.c (arm_compare_fp): Delete. - (const_ok_for_op): Make function static. Add prototype. Remove - mode parameter - it is unused. - (arm_rtx_costs): Remove outer_code parameter. - (reload_memory_operand): Declare mode parameter unused. - (power_of_two_operand): Declare mode parameter unused. - (equality_operator): Declare mode parameter unused. - (load_multiple_operation): Declare mode parameter unused. - (store_multiple_operation): Declare mode parameter unused. - (multi_register_push): Declare mode parameter unused. - (arm_valid_machine_decl_attribute): Remove attributes parameter - - it is unused. - (select_dominance_cc_mode): Remove op parameter - it is unused. - (gen_compare_reg): Remove fp parameter - it is unused. - (final_prescan_insn): Remove opvec and noperands parameters - they - are unused. - -Mon Mar 22 14:35:28 1999 Nick Clifton - - * tm.texi (MD_SCHED_INIT): Add missing closing parenthesis. - -Mon Mar 22 22:24:30 1999 J"orn Rennecke - - * reload1.c (reload_as_needed): Set reload_is_output_reload / - reload_has_output_reload for auto_inc expressions that could be - reloaded. Call forget_old_reloads for REG_INC notes. - -Mon Mar 22 21:51:57 1999 J"orn Rennecke - - * cse.c (cse_insn): Don't change the result register of a libcall. - -Mon Mar 22 21:08:59 1999 J"orn Rennecke - - * rtl.h (shallow_copy_rtx): Declare. - * rtl.c (shallow_copy_rtx): New function. - * reload.c (find_reloads_toplev): Use shallow_copy_rtx instead of - copy_rtx. - -Mon Mar 22 10:44:33 1999 Vladimir Makarov - - * config/h8300/h8300.md (adjust_length): New attribute. - (modhi3+1, andsi3+1, iorsi3+1, extzv+1, extzv+2): Change insn - default value of attribute "adjust_length" onto "no". - - * config/h8300/h8300.c (h8300_adjust_insn_length): Adjust - length only if the attribute "adjust_length" value is "yes". - Use 0 if the shift is negative. - - * final.c (shorten_branches): Check insn length after its - adjusting. - -Sun Mar 21 17:33:48 1999 Jeffrey A Law (law@cygnus.com) - - * i860.h (TARGET_SWITCHES): Add documentation for default case. - * i860/paragon.h (TARGET_SWITCHES): Add documentation for default case. - * i370.h (TARGET_SWITCHES): Add documentation for default case. - * fx80.h (TARGET_SWITCHES): Add documentation for default case. - * elxsi.h (TARGET_SWITCHES): Add documentation for default case. - * clipper.h (TARGET_SWITCHES): Add documentation for default case. - * 1750a.h (TARGET_SWITCHES): Add documentation for default case. - * pa.h (TARGET_SWITCHES): Add documentation for default case. - (TARGET_OPTIONS): Likewise for default case. - * mn10300.h (TARGET_SWITCHES): Add documentation for default case. - * h8300.h (TARGET_SWITCHES): Add documentation for default case. - - * gcse.c (dump_hash_table): Fix whitespace in declaration. - (compute_transpout): Renamed from pre_compute_transpout. - (compute_pre_*): Deleted. - (pre_expr_reaches_here_p): New argument, CHECK_PRE_COMP. All - callers changed. - (insert_insn_end_bb): Renamed from pre_insert_insn. - (pre_*): Delete unused variables. Only leave local properties and - global redundant/optimal computation points. - (alloc_pre_mem, free_pre_mem): Corresponding changes. - (compute_pre_data): Simplify and call pre_lcm to run the lazy - code motion dataflow analysis. - (pre_insert, pre_insert_copies, pre_delete): Revamp to use LCM - based redundant and optimal computation points. - - * basic-block.h (pre_lcm, pre_rev_lcm): Declare. - - * toplev.c (main): A debug option without a level defaults to - level 2. - -Sun Mar 21 12:13:01 1999 Nick Clifton - - * flow.c (can_delete_label_p): Do not allow user specified - labels to be deleted. - * dwarf2out.c (gen_label_die): Generate addresses for deleted - (programmer specified) labels. - * dwarfout.c (output_label_die): Generate addresses for deleted - (programmer specified) labels. - -1999-03-21 Manfred Hollstein - - * Makefile.in (xgcc$(exeext)): Add intl.o to list of files to be - linked with. - -Sun Mar 21 01:15:03 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Mar 20 22:26:23 1999 Kaveh R. Ghazi - - * sparc.h (TARGET_SWITCHES): Add null description to default case. - -Sat Mar 20 21:46:06 1999 Kaveh R. Ghazi - - * c-lex.c (yylex): Remove unused variable `bytes'. - - * flow.c (print_rtl_with_bb): Cast the return value of alloca. - - * function.c (assign_parms): Wrap variable `varargs_setup' in - macro SETUP_INCOMING_VARARGS. - (thread_prologue_and_epilogue_insns): Mark parameter `f' with - ATTRIBUTE_UNUSED. - - * local-alloc.c (no_equiv): Likewise for parameter `store'. - - * sched.c (schedule_insns): Remove unused variables `insn' and `next'. - - * tlink.c (symbol_hash_newfunc, symbol_hash_lookup, - file_hash_newfunc, file_hash_lookup, demangled_hash_newfunc, - demangled_hash_lookup, symbol_push, symbol_pop, file_push, - file_pop, tlink_init, tlink_execute, frob_extension, - obstack_fgets, tfgets, pfgets, freadsym, read_repo_file, - maybe_tweak, recompile_files, read_repo_files, - demangle_new_symbols, scan_linker_output): Add static prototype. - - (symbol_hash_newfunc, file_hash_newfunc, demangled_hash_newfunc): - Make the third argument a `hash_table_key'. - - * toplev.c (debug_start_source_file): Mark parameter `filename' - with ATTRIBUTE_UNUSED. - -Sun Mar 21 02:28:21 1999 Andreas Schwab - - * tm.texi (Varargs): Don't split argument of @item across lines. - - * invoke.texi: Fix use of @item vs @itemx. - -Sun Mar 21 09:59:54 1999 Michael Hayes - - * config/c4x/c4x.h (TARGET_SWITCHES): Add null description to - default case. - -Sat Mar 20 23:33:54 1999 Michael Hayes - - * loop.c (check_dbra_loop): Fix debug message. - -Sat Mar 20 15:54:35 1999 Michael Hayes - - * config/c4x/c4x.md (decrement_and_branch_on_count): Emit rptb_end - pattern instead of decrement_and_branch_until_zero pattern. - -Sat Mar 20 11:39:58 1999 Michael Hayes - - * config/c4x/c4x.h (TARGET_SWITCHES): Add documentation. - * config/c4x/c4x.h (TARGET_OPTIONS): Add documentation. - -Fri Mar 19 23:26:29 1999 Martin von Löwis - - * expr.c (expand_expr): Handle ERROR_MARK much earlier. - -Fri Mar 19 15:28:38 1999 Kaveh R. Ghazi - - * cccp.c (create_definition): Cast to U_CHAR* when assigning to one. - - * cppfiles.c (read_and_prescan): Likewise. - Start a #define in column 0. - - * cpplib.c (cpp_define): Cast to U_CHAR* when assigning to one. - (cpp_push_buffer): Likewise for cpp_buffer*. - (do_include): Change the type of `fbeg' and `fend' to unsigned char*. - (do_endif): Cast to char* when assigning to one. - (do_assert): Likewise. - (do_unassert): Likewise. - (cpp_read_check_assertion): Change the type of `name' to U_CHAR*. - Don't do unnecessary cast to char* anymore. - - * genrecog.c (make_insn_sequence): Cast to char** when assigning - to one. Cast the first argument of bzero to PTR. - - * loop.c (strength_reduce): Remove unused variable `note'. - - * reload1.c (new_insn_chain): Cast to struct insn_chain* when - assigning to one. - - * rtl.c (copy_rtx): Use memcpy instead of bcopy. - -Fri Mar 19 11:19:31 1999 Kaveh R. Ghazi - - * calls.c (initialize_argument_information): Mark parameters - `num_actuals' and `n_named_args' with ATTRIBUTE_UNUSED. - - * dbxout.c (dbxout_start_new_source_file): Likewise for parameter - `filename'. - (dbxout_finish): Likewise for parameters `file' and `filename'. - (dbxout_prepare_symbol): Likewise for parameter `decl'. - (dbxout_begin_function): Likewise. - - * explow.c (hard_function_value): Likewise for parameter `func'. - - * function.c (locate_and_pad_parm): Likewise for parameter `fndecl'. - - * expmed.c (expand_divmod): Omit unused argument to `expand_abs'. - * expr.c (expand_expr): Likewise. - * expr.h (expand_abs): Delete unused argument from prototype. - * optabs.c (expand_abs): Remove unused parameter `unsignedp'. - - * sdbout.c (sdbout_init): Mark parameter `syms' with ATTRIBUTE_UNUSED. - (sdbout_end_block): Likewise for parameter `n'. - - * toplev.c (debug_define): Likewise for parameters `lineno' and - `buffer'. - (debug_undef): Likewise. - - * varasm.c (named_section): Likewise for parameter 'reloc'. - (assemble_external): Likewise for parameter `decl'. - (assemble_alias): Likewise for parameter `target'. - -Fri Mar 19 01:54:30 1999 Theodore Papadopoulo - - * toplev.c (read_integral_parameter): Constify. Better control of - error messages. - (main): Use read_integral_parameter to set optimize, id_clash_len, - larger_than_size, and the debugging level. - * toplev.h (read_integral_parameter): Update prototype. - -Fri Mar 19 01:42:05 1999 Zack Weinberg - - * system.h: Use putc_unlocked, fputc_unlocked, and - fputs_unlocked only if putc_unlocked has a prototype already. - Prototype fputs_unlocked if necessary. - * configure.in: Check for prototypes of putc_unlocked and - fputs_unlocked. - * acconfig.h: Updated. - * config.in, configure: Rebuilt. - -Fri Mar 19 02:45:12 1999 Alexandre Oliva - - * Makefile.in (INTL_TARGETS): New macro. - ($(INTL_TARGETS)): Depend on generated sources; drop dependencies - on cp/parse.c and objc/objc-parse.c. - ($(srcdir)/cp/parse.c): Move to cp/Make-lang.in. - * objc/Make-lang.in ($(INTL_TARGETS)): Depend on objc/objc-parse.c. - -Thu Mar 18 22:28:53 1999 Jeffrey A Law (law@cygnus.com) - - * i860.h (TARGET_SWITCHES): Add documentation. - * i860/paragon.h (TARGET_SWITCHES): Add documentation. - * i370.h (TARGET_SWITCHES): Add documentation. - * fx80.h (TARGET_SWITCHES): Add documentation. - * elxsi.h (TARGET_SWITCHES): Add documentation. - * clipper.h (TARGET_SWITCHES): Add documentation. - * 1750a.h (TARGET_SWITCHES): Add documentation. - * pa.h (TARGET_SWITCHES): Add documentation. - (TARGET_OPTIONS): Likewise. - * mn10300.h (TARGET_SWITCHES): Add documentation. - * h8300.h (TARGET_SWITCHES): Add documentation. - -Thu Mar 18 15:58:26 1999 Nick Clifton - - * loop.c (strength_reduce): Do not perform pseudo replacements - if the loop contains volatile memory references. - -Thu Mar 18 19:09:50 1999 J"orn Rennecke - - * reload.c (find_reloads_toplev): When processing X recursively, - don't alter it destructively except by filling in constants. - -Thu Mar 18 10:14:18 1999 Kaveh R. Ghazi - - * cccp.c (default_include): Initialize structure members. - (pass_thru_directive): Change the type of 'keyword_length' to int. - (main): Cast `bindtextdomain' and `textdomain' to (void). - - * collect2.c (main): Likewise. - - * cppmain.c (main): Likewise. - - * gcc.c (main): Likewise. - - * gcov.c (main): Likewise. - - * protoize.c (main): Likewise. - - * toplev.c (main): Likewise. - -1999-03-18 Gavin Romig-Koch - - * config/mips/mips.c (mips_explicit_type_size_string): Correct - its type. - -Thu Mar 18 01:24:25 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in: Use "exit 1", not "exit (1)". - * configure: Rebuilt. - -Wed Mar 17 23:17:42 1999 Mark Kettenis - - * config/t-gnu (SYSTEM_HEADER_DIR): New variable. Set to - `/include' in order to find the system's limits.h. - -Wed Mar 17 23:00:18 1999 Robert Lipe - - * fixinc/fixincl.c: Include auto-host.h instead of config.h. - * fixinc/procopen.c: Likewise. - * fixinc/regex.c: Likewise. - * fixinc/server.c: Likewise. - -Wed Mar 17 22:46:13 1999 Mark Elbrecht - Jeff Law - - * pa.md: Add real PA8000 scheduling information. - - * pa.h (processor_type): Add PROCESSOR_8000 symbol. - (ISSUE_RATE): Revamp, including PA8000 support. - * pa.c (override_options): Add 8000 as -mschedule= option. - Do not call strcmp if pa_cpu_string is null. - * pa.md (attr cpu): Add 8000. - * invoke.texi: Add documentation for PA8000 scheduling. - -Wed Mar 17 18:20:24 1999 David S. Miller - - * config/sparc/sparc.h (TARGET_SWITCHES, TARGET_OPTIONS): - Add descriptions. - * config/sparc/sp64-elf.h (SUBTARGET_SWITCHES): Likewise. - * config/sparc/splet.h (SUBTARGET_SWITCHES): Likewise. - -Wed Mar 17 14:51:19 1999 Richard Henderson - - * flow.c (compute_immediate_dominators): New function. - * basic-block.h (compute_immediate_dominators): Declare it. - - * alpha.h (HARD_REGNO_MODE_OK): Allow only 4 and 8 byte unit modes - in FP regs. - (MODES_TIEABLE_P): Define asymmetricly wrt modes illegal in FP regs. - -Wed Mar 17 14:41:41 1999 Nick Clifton - - * config/arm/aout.h (ASM_GENERATE_INTERNAL_LABEL): Fix compile - time warning. - * config/arm/arm.md: Fix various compile time warnings. - * config/arm/arm.h: Fix various compile time warnings. Add - function prototypes. - * config/arm/arm.c: Fix various compile time warnings. - (arm_override_options): Reorganize to separate tuning from - targetting. - (bit_count): New function: Return a count of the number of bits - set in a word. - -Wed Mar 17 21:29:12 1999 J"orn Rennecke - - * reload1.c (eliminate_regs): Don't keep REG_DEAD notes around for - things that were eliminated. - -Wed Mar 17 12:16:26 1999 Richard Henderson - - * function.c (fixup_var_refs_1): First try moving the expression - directly into a register. Don't separate cc0 setter and user. - -Wed Mar 17 11:20:29 1999 Dave Brolley - - * cppfiles.c (PIPE_BUF): #define PIPE_BUF if not defined already. - -Wed Mar 17 09:25:06 1999 Kaveh R. Ghazi - - * c-lex.c: Don't include setjmp.h. - (parse_float): New static function. - (pf_args): New struct. - (yylex): Use them in call to `do_float_handler'. - -1999-03-16 Andreas Schwab - - * cexp.y (yyerror): Call verror to get a useful error message. - * cexp.c: Rebuilt. - - * .gdbinit: Move command to put breakpoint at abort to end of file - so that gdb does not bail out early. - -Tue Mar 16 15:30:19 1999 Nick Clifton - - * rtl.h: Rename prototype for free_bb_memory to free_bb_mem. - -Tue Mar 16 23:40:09 1999 J"orn Rennecke - - * sh.md (movsi_i): Move t/r alternative after r/rI alternative. - -Tue Mar 16 13:44:50 1999 Jim Wilson - - * mn10200/mn10200.md (addsi3, subsi3, ashlsi3, lshrsi3, ashrsi3): - Delete emit_library_call_value declaration. - -1999-03-16 Zack Weinberg - - * cppfiles.c (read_and_prescan): Map backslash-newline to '\r' - (which cannot otherwise appear in the processed buffer) and - move it out of tokens that it appears in the middle of. - Improve performance. - (find_position): New function. - - * cpplib.c: \r (one character) indicates backslash - newline, not \\\n (two characters). It cannot appear in the - middle of a token. Call CPP_BUMP_LINE (pfile) whenever - parsing moves past \n or \r. Increment pfile->lineno whenever - a \n is placed into token_buffer. Only one mark can exist at - a time, and CPP_BUMP_LINE must not be used while it is - active. It is automatically cleared by cpp_pop_buffer and - parse_goto_mark. \r is not in is_hor_space or is_space. - - (NEWLINE_FIX, NEWLINE_FIX1, adjust_position, - update_position, count_newlines, parse_move_mark): Removed. - (parse_string, copy_comment): New functions. - (parse_name): Returns void. - (parse_set_mark, parse_clear_mark, parse_goto_mark): Take only - one argument, a cpp_reader *. Change for new marking scheme. - (skip_comment): Handle CHILL line comments too. Second - argument is now first character of comment marker; all callers - changed. Issue error for unterminated block comment here. - (cpp_skip_hspace): Recognize CHILL comments. - (copy_rest_of_line): Likewise. Call skip_comment and - parse_string directly, don't go through cpp_get_token. Emit - "/**/" for block comments if -traditional (create_definition - needs this). - (do_define): Don't play with put_out_comments. - (cpp_push_buffer): Initialize ->mark to -1. - (cpp_buf_line_and_col): Just read out the values in the buffer - structure. - (output_line_command): Use cpp_buf_line_and_col. Fix - formatting. Remove stale code. - (cpp_get_token): Break out string parsing code to - parse_string. Use skip_comment for CHILL comments too. Use - copy_comment for put_out_comments instead of dinking with - marks. Remove stale code. Don't call output_line_command - unless it's necessary. - - * cpplib.h (parse_marker): Removed. - (struct cpp_buffer): Line_base is now a unsigned char *; add - `mark' [long], remove `marks' [struct parse_marker *]. - (parse_set_mark, parse_clear_mark, parse_goto_mark): Update - prototypes. - (CPP_BUMP_LINE, CPP_BUMP_BUFFER_LINE): New macros. - * cppinit.c (is_hor_space, is_space): '\r' is not considered - whitespace. - * cppexp.c (cpp_parse_expression): Use cpp_skip_hspace, not - SKIP_WHITE_SPACE. - * cpphash.c (macarg): Disable line commands while expanding. - -Tue Mar 16 11:30:19 1999 Gavin Romig-Koch - - * c-lex.c (yylex) : Remove warning for integer literals being - larger than the largest target int. Add warning for integer - literal being larger than than its chosen type. - -Tue Mar 16 10:53:17 1999 Gavin Romig-Koch - - * invoke.texi: Add -mlong32 documentation. - * config/mips/mips.h (mips_explicit_type_size_string): New. - (TARGET_SWITCHES): Add 'long32'. - (TARGET_OPTIONS): Add 'explicit-type-size'. - (CC1_SPECS): Set -mexplicit-type-size. - (LONG_MAX_SPEC): Change a use of 'no-long64' to 'long32'. - * config/mips/abi64.h (LONG_MAX_SPEC): Same. Add 'mabi=32'. - * config/mips/mips.c (mips_explicit_type_size_string): New. - (override_options): Use it. - * config/mips/osfrose.h (CC1_SPECS): Set -mexplicit-type-size. - - * config/mips/mips.h (SUBTARGET_CPP_SIZE_SPEC): - Pointer size now depends on both size longs and size of GP - registers. - -Tue Mar 16 10:22:22 1999 Gavin Romig-Koch - - * config/mips/iris.h (CTORS_SECTION_ASM_OP,DTORS_SECTION_ASM_OP, - dtors_section): Use Pmode == DImode rather than TARGET_LONG64. - * config/mips/mips.c (override_options): Allow -mlong64 and - -mint64 with -mips2 or less. - * config/mips/mips.h (MASK_LONG64): Fix comment. - (POINTER_SIZE): Use Pmode == DImode rather than TARGET_LONG64. - (Pmode): Make Pmode the smaller of longs or gp registers. - * invoke.texi: Note the new size for pointers. - -Mon Mar 15 22:45:25 1999 David Edelsohn - - * rs6000.h (ASM_OUTPUT_{DOUBLE,FLOAT}): Always generate IEEE 754 - bit-pattern directly. - (ASM_OUTPUT_REG_{PUSH,POP}): Delete. - * rs6000.c (first_reg_to_save): If profiling and context needed, - allocate a reg to save static chain for all ABIs. For AIX - profiling, calculate parameter registers to save based on need. - (output_function_profiler): Save and restore static chain around - profile call for all ABIs. - -1999-03-15 Zack Weinberg - - * cppinit.c: Instead of one pending list, keep separate lists - for each category of pending option: -D/-U, -A, -include, - -imacros. Move the four partial include-path lists into the - pending block. Use head and tail pointers so we don't ever - have to reverse the lists. - - (cpp_start_read): Break out blocks of code to their own - functions: install_predefs and initialize_dependency_output. - Use path_include for C_INCLUDE_PATH and friends as well as - CPATH. Remove include_defaults gunk. Warn about the - combination of -lang-chill and -trigraphs. Optimize string - bashing. Walk each pending list once, deallocating as we go. - - (append_include_chain): Brought over from cppfiles.c. Mark - dirs as system include dirs if and only if appending to - system include path. If opts->verbose, print a notice when a - dir is dropped from the include path because it doesn't - exist. Fix memory leak: this function is not supposed to copy - its DIR argument. - - (nreverse_pending, push_pending): Removed. - (APPEND): New macro for adding to pending lists. - (path_include): Can now add to any partial include path. - (base_name): Bring over from cccp.c. - (cpp_options_init): Allocate the pending block. - (cpp_handle_option): Add --version. Exit after --help. Fix - formatting. Order -ifoo options by frequency of usage. - (install_predefs): New function, simplified version of code - that was in cpp_start_read. - (initialize_dependency_output): Likewise. Understand OBJECT_SUFFIX. - - * cppfiles.c (simplify_pathname): Export. - (merge_include_chains): Don't nreverse the lists. If - opts->verbose, print a notice when a duplicate dir is detected - and dropped from the include path. - (finclude): Fix excessive cleverness in setting - fp->system_header_p. - (actual_directory): Set x->sysp from - CPP_BUFFER (pfile)->system_header_p so that one system header - may include another with "". - (deps_output): Fix double adjustment of deps_size which would - cause all dependencies after the first two lines to be lost. - - * cpplib.c (cpp_unassert): New function. - * cpplib.h: Lay out struct cpp_pending here. Adjust - prototypes. Add include_prefix_len to struct cpp_options. - -Mon Mar 15 16:01:52 1999 Jim Wilson - - * config/misp/mips.h (REGISTER_MOVE_COST): Make the cost of moving - from HI/LO/HILO/MD into general registers the same as for one - of moving general registers to HI/LO/HILO/MD. - -Mon Mar 15 12:39:38 1999 Nick Clifton - - * config/m32r/m32r.c (init_idents): New function. Initialize - static tree nodes for m32r specific attribute identifiers. Remove - leading and trailing double underscores from the attribute names. - (m32r_valid_machine_decl_attribute): Call init_idents. - (m32r_encode_section_info): Call init_idents. - -Mon Mar 15 10:20:20 1999 Mark Mitchell - - * reload.c (find_reloads): Add a REG_LABEL note if we substitute a - LABEL_REF for something else. - -Mon Mar 15 08:24:17 1999 Kaveh R. Ghazi - - * fold-const.c (exact_real_inverse): Move variable `float_error' - into the scope where it is used. - (const_binop_1): New static function. - (cb_args): New struct. - (const_binop): Use them in call to `do_float_handler'. - (fold_convert_1): New static function. - (fc_args): New struct. - (fold_convert): Use them in call to `do_float_handler'. - -Mon Mar 15 22:50:18 1999 Michael Hayes - - * rtlanal.c (auto_inc_p): New function. - * rtl.h (auto_inc_p): Prototype it. - * reload1.c (add_auto_inc_notes): New function. - (reload): Strip REG_INC notes and call add_auto_inc_notes - for each insn to restore them correctly. - -1999-03-15 Manfred Hollstein - - * fixinc/Makefile.in (procopen.o): List the actual - dependencies. - -Sun Mar 14 16:22:10 1999 Kaveh R. Ghazi - - * cse.c (check_fold_consts): New static function. - (cfc_args): New struct. - (simplify_relational_operation): Use them in call to - `do_float_handler'. - - * toplev.c (do_float_handler): New function to wrap calls to - setjmp/set_float_handler. - - * toplev.h (do_float_handler): Add extern prototype. - - * tree.c (build_real_from_int_cst_1): New static function. - (brfic_args): New struct. - (build_real_from_int_cst): Use them in call to - `do_float_handler'. - -Sun Mar 14 01:15:06 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Mar 13 17:37:18 1999 Richard Henderson - - * haifa-sched.c (sched_analyze_1): Only clear reg_last_uses on a SET. - -Sat Mar 13 11:36:16 1999 Richard Earnshaw (rearnsha@arm.com) - - * arm.c (arm_split_constant): Don't try to force a constant to - memory after arm_reorg has run. - (after_arm_reorg): New static variable. - (arm_reorg): Set it. - (output_func_epilogue): Clear it. - -Fri Mar 12 20:26:32 1999 David Edelsohn - - * configure.in ({rs6000,powerpc}-ibm-aix*): Set float_format to none. - * configure: Rebuilt. - -Fri Mar 12 20:45:30 1999 J"orn Rennecke - - * unroll.c (loop_iterations): Don't return a final value for EQ - comparison loops. - -Fri Mar 12 12:35:01 1999 Jim Wilson - - * reload1.c (calculate_needs_all_insns): When ignore equivalence - setting insn, clear need_elim, need_reload, and need_operand_change. - -Fri Mar 12 07:54:43 1999 Bruce Korb - - * fixinc/fixinc.*: Some changes from the fixincl-branch - were not applied (??!!). Corrected. - - * fixinc/Makefile.in: Same thing. - -Fri Mar 12 00:51:43 1999 Jeffrey A Law (law@cygnus.com) - - * expr.c (expand_expr): Allow a CALL_EXPR with a mode wider than - MAX_INTEGER_COMPUTATION_MODE. - -Thu Mar 11 14:00:58 1999 Richard Henderson - - * alpha.h (HARD_REGNO_MODE_OK): Disallow QI/HImode in fp regs. - (MODES_TIEABLE_P): Update. - - * alpha.md (ev5_e0): Conflict loads and stores. - -Thu Mar 11 13:55:52 1999 Richard Henderson - - * machmode.h (smallest_mode_for_size): Prototype. - * stor-layout.c (smallest_mode_for_size): Remove static. - -Thu Mar 11 21:25:59 1999 J"orn Rennecke - - * loop.c (strength_reduce): Don't do biv increment -> DEST_REG giv - conversion if we don't know the lifetime. - -Thu Mar 11 20:37:59 1999 J"orn Rennecke - - * reload.1c (delete_address_reloads_1): Check for reloads of - CURRENT_INSN even if it sets DST. - -Thu Mar 11 10:29:50 1999 Jason Merrill - - * dwarf2out.c (add_AT_lbl_offset): Rename from add_AT_section_offset. - (print_die, size_of_die, value_format, output_die): Adjust. - -Thu Mar 11 10:27:42 1999 Robert Lipe - - * dwarf2out.c (TEXT_SECTION_LABEL, DEBUG_LINE_SECTION_LABEL, - DEBUG_INFO_SECTION_LABEL, ABBREV_SECTION_LABEL, - text_section_label, debug_line_section_label, - debug_info_section_label, abbrev_section_label): New. - (output_compilation_unit_header): Emit label associated - with section instead of section name itself. - (out_pubnames, output_aranges, output_line_info, - dwarf2out_finish): Likewise. - (dwarf2out_init): Build internal label names for sections - from static labels. - -Thu Mar 11 17:28:32 1999 J"orn Rennecke - - * sh.md (mulsi3): End mul.l sequence with a no-op move. - -Thu Mar 11 08:52:02 1999 Bruce Korb - - * Makefile.in: Activated fixinc/mkfixinc.sh. - * configure.in: Activated fixinc/mkfixinc.sh. - -Thu Mar 11 01:38:02 1999 Mumit Khan - - * cppfiles.c (INO_T_EQ): Handle UWIN. - - * c-common.c (decl_attributes): Flag unrecognized attribute - functions as warnings instead of as errors. - - Support for i386-pc-uwin. - * i386/uwin.h: New file. - * i386/xm-uwin.h: New file. - * i386/t-uwin: New file. - * i386/uwin.asm: New file. - * configure.in (i[3456]86-*-uwin*): Define. - Add Workaround for vfork bug when hosted on uwin. - * configure: Regenerate. - - * cccp.c (INO_T_EQ): Undefine. UWIN has inodes. - (absolute_filename): UWIN uses POSIX pathnames only. - * libgcc2.c (getpagesize): Do not define for UWIN. - (mprotect): Likewise. - * protoize.c (dirent.h): Conditionally include. - (fputc): Prototype only if it's not a macro. - -Wed Mar 10 02:49:04 1999 Jason Merrill - - * configure.in: Remove init_priority stuff. - -1999-03-11 Colin Smith - - * sdbout.c (plain_type_1): Make boolean types work better with sdb. - -Thu Mar 11 00:20:52 1999 Alexandre Oliva - - * gcc.texi: Update bug reporting instructions to match - current ezmlm list reality. - -Wed Mar 10 23:11:19 1999 Kaveh R. Ghazi - - * gcc.c (print_file_name, print_prog_name, spec_machine, - read_specs, set_spec, lookup_compiler, build_search_list, - putenv_from_prefixes, find_a_file, record_temp_file, - delete_if_ordinary, handle_braces, do_spec, do_spec_1, find_file, - is_directory, validate_switches, used_arg, default_arg, - pfatal_with_name, perror_with_name, pfatal_pexecute, fatal, error, - notice, add_preprocessor_option, add_assembler_option, - add_linker_option, process_command, execute, - unused_prefix_warnings, clear_args, fatal_error, - lang_specific_driver, user_specs, compiler, link_command_spec, - option_map, translate_options, make_temp_file, temp_name, - programname, path_prefix, machine_suffix, just_machine_suffix, - gcc_exec_prefix, standard_exec_prefix, standard_exec_prefix_1, - md_exec_prefix, md_startfile_prefix, md_startfile_prefix_1, - standard_startfile_prefix, standard_startfile_prefix_1, - standard_startfile_prefix_2, tooldir_base_prefix, tooldir_prefix, - multilib_dir, temp_filename, temp_file, command, switchstr, - infile, outfiles, input_filename, input_basename, input_suffix, - check_live_switch, main): Qualify a char* with the `const' keyword. - -Wed Mar 10 20:28:29 1999 Jeffrey A Law (law@cygnus.com) - - * lcm.c: New file. - * Makefile.in (OBJS): Add lcm.o. - (lcm.o): Add dependencies. - - * gcse.c (compute_pre_local_properties): Delete. - (compute_pre_data): Use compute_local_properties instead of - compute_pre_local_properties. - - * gcse.c: More comments, whitespace and similar fixes. - (dump_cuid_table, maybe_set_rd_gen, dump_cprop_data): Delete. - (dump_pre_data, compute_cprop_local_properties): Likewise. - (one_classic_gcse_pass): Lose unused argument. All callers changed. - (compute_hash_table, compute_expr_hash_table): Likewise. - (compute_set_hash_table, one_pre_gcse_pass, mark_call): Likewise. - (cprop_insn, cprop, one_cprop_pass): Add new argument ALTER_JUMPS. - All callers changed. Only alter jumps if ALTER_JUMPS is nonzero. - Lose unused argument. - (gcse_main): Always run a cprop pass after finishing global cse. - (compute_local_properties): New function. - (hash_scan_pat, hash_scan_insn): No longer call maybe_set_rd_gen. - (compute_cprop_data): Use compute_local_properties. - - * gcse.c: Update various comments. - (current_function_calls_longjmp): Delete declaration. - - * gcse.c (run_jump_opt_after_gcse): New variable. - (gcse_main): Returns an integer. - (hash_scan_set): Record initializations from CONST_DOUBLEs too. - (try_replace_reg): Update some comments. - (cprop_insn): Allow propagation into some JUMP_INSNs too. - * rtl.h (gcse_main): Update prototype. - * toplev.c (rest_of_compilation): If gcse_main returns nonzero, - then run a jump optimization pass. - * jump.c (delete_barrier_successors): Delete nop jumps too. - -Wed Mar 10 19:04:31 1999 J"orn Rennecke - - * sh.c (fp_arith_reg_operand): Actually test if reg is suitable - for FP arithmetic. Changed caller. - * sh.md (subsf3, subsf_i): Use fp_arith_reg_operand. - -Wed Mar 10 18:56:31 1999 J"orn Rennecke - - * reload1.c (choose_reload_regs): When inheriting from the frame - pointer, don't clobber it. - -Wed Mar 10 08:01:52 1999 Bruce Korb - - * fixinc/fixinc.*: Resync-ed with the files in this - directory. - - * fixinc/mkfixinc.sh: The machine case elements were - out-of-order. (the ix86-*-linux-gnu* entry needed to - be earlier). - -Wed Mar 10 00:01:24 1999 J"orn Rennecke - - * reload1.c (reload_combine_note_store): Fix calculation of number - of affected registers. - -Tue Mar 9 15:48:15 1999 Richard Henderson - - * flow.c (tidy_fallthru_edge): Be more careful finding the last - BARRIER of a list. Delete the cc0 setter as well as a cond jump. - -Tue Mar 9 15:26:02 1999 Hans-Peter Nilsson - - * i386.md (ashlsi3 splitter): Fix typo in last change. - -Tue Mar 9 11:35:20 1999 Richard Henderson - - * reg-stack.c (stack_reg_life_analysis): Use returnjump_p - instead of an explicit test for RETURN. - -Tue Mar 9 09:33:16 1999 Kaveh R. Ghazi - - * Makefile.in (toplev.o): Depend on $(BASIC_BLOCK_H). - - * toplev.c: Include basic-block.h. - -Tue Mar 9 02:08:17 1999 Jeffrey A Law (law@cygnus.com) - - * calls.c (load_register_parameters): New function. - (expand_call): Use it. - - * calls.c (expand_call): Slightly reorganize code. - - * calls.c (compute_argument_addresses): New function. - (rtx_for_function_call): New function. - (expand_call): Use them. - - * i386.md (zero_extendhisi2): Split into an expander and anonymous - pattern. Add new anonymous pattern for use when optimizing for - size or for the PPro. - (zero_extendqihi2, zero_extendqisi2): Likewise. - -Mon Mar 8 23:43:47 1999 Richard Henderson - - * haifa-sched.c (sched_analyze_1): Fix last change -- add clobber - dependencies to sets in the non-hard-reg case too. - -Mon Mar 8 18:55:21 1999 Marc Espie - - * config/openbsd.h (HANDLE_SYSV_PRAGMA): Define. - -Mon Mar 8 16:04:44 1999 Jim Wilson - - * local-alloc.c (combine_regs): Don't combine if we have a hard reg - for which CLASS_LIKELY_SPILLED_P is true. - - * unroll.c (loop_iterations): Only call loop_find_equiv_value if we - have a REG or SUBREG. - -Mon Mar 8 15:27:42 1999 Jeffrey A Law (law@cygnus.com) - - * i386.md (ashlsi3): Revise comments. Provide new anonymous - pattern for Pentium and PPro/PII. Reverse constraints in - generic ashlsi3 anonymous pattern. - - * calls.c (initialize_argument_info): Accept a pointer to - CUMULATIVE_ARGS. - (expand_call): Pass the address of CUMULATIVE_ARGS. - - * rs6000/xm-sysv4.h (HOST_BITS_PER_LONGLONG): Remove #if 0. - - * mn10300.h (CASE_DROPS_THROUGH): Delete. - * mn10200.h (CASE_DROPS_THROUGH): Delete. - * h8300.h (CASE_DROPS_THROUGH): Delete. - - * flow.c (merge_blocks_nomove): For HAVE_cc0 targets, make sure - to also delete the cc0 setter when deleting a conditional branch - to the next block. - -Mon Mar 8 18:47:11 1999 J"orn Rennecke - - * regmove.c (copy_src_to_dest): New argument max_old_uid. - -Mon Mar 8 08:23:00 1999 Bruce Korb - - * ChangeLog: Merged entries from fixincl-branch. - -Sun Mar 7 11:48:56 1999 Richard Henderson - - * haifa-sched.c (ENCODE_BLOCKAGE): Don't shift unit too far. - (print_exp): Special case addition of a constant. - (print_value) [CONST_INT]: Use HOST_WIDE_INT_PRINT_HEX. - -Sun Mar 7 11:21:02 1999 Richard Henderson - - * haifa-sched.c (reg_last_clobbers): New. - (reg_pending_clobbers, bb_reg_last_clobbers): New. - (compute_block_backward_dependences): Allocate memory for them. - (schedule_region): Likewise. - (sched_analyze_1): Clobbers don't interfere with one another. - They do interfere with sets ... - (sched_analyze_2): ... and uses. - (sched_analyze): Likewise. - (sched_analyze_insn): Update reg_last_clobbers appropriately. - -Sun Mar 7 08:30:37 1999 Kaveh R. Ghazi - - * gmon-sol2.c: Include config.h and system.h. Don't redundantly - include system header files. - (sccsid): Remove. - (moncontrol, monstartup, _mcleanup, internal_mcount): Prototype. - (_mcleanup): Add the `const' keyword to a char*. - (internal_mcount): Declare `etext' as a char[] not a function. - Cast `etext' to char* when calling `monstartup'. - - * sparc.c (frame_base_name, save_regs, restore_regs, - build_big_number, sparc_cmodel_string, sparc_align_loops_string, - sparc_align_jumps_string, sparc_align_funcs_string, code_model, - cpu_default, cpu_table, output_function_prologue, - output_function_epilogue, output_return, - sparc_flat_output_function_prologue, ultra_code_names, - sparc_flat_output_function_epilogue): Constify a char*. - (hypersparc_adjust_cost): Add a default case in a switch. - - * sparc.h (sparc_cmodel_string, OVERRIDE_OPTIONS, - sparc_cpu_select, sparc_align_loops_string, - sparc_align_jumps_string, sparc_align_funcs_string, - output_return): Constify a char*. - - * sparc.md (movdi): Change the comparison of HOST_BITS_PER_WIDE_INT - so that we check "== 32", instead of "!= 64". Cast a value to - HOST_WIDE_INT when comparing against one. Hide the declaration - for variable `chain'. - -Sun Mar 7 08:05:27 1999 Kaveh R. Ghazi - - * system.h (const, inline): Move the stage2 handling of these - keywords-as-macros from here... - - * gansidecl.h (const, inline): ...to here. - -Sun Mar 7 02:44:15 1999 Richard Henderson - - * recog.c (push_operand, pop_operand): VOIDmode needn't match modes. - -Sun Mar 7 01:58:47 1999 Richard Henderson - - * cse.c (canon_hash): Never reject hard regs in CCmode. - -Sun Mar 7 01:15:04 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Mar 6 17:18:44 1999 Richard Earnshaw (rearnsha@arm.com) - Richard Henderson - - * flow.c (make_edges): Handle casesi that jump to default branch. - If CASE_DROPS_THROUGH, force fallthru to block after casesi. - -Sat Mar 6 07:49:23 1999 Kaveh R. Ghazi - - * c-aux-info.c (data_type, affix_data_type, gen_decl, - gen_formal_list_for_type, gen_formal_list_for_func_def, gen_type): - Qualify a char* with the `const' keyword. - - * c-common.c (declare_hidden_char_array, add_attribute, if_elt, - declare_function_name, decl_attributes, format_char_info, - check_format_info, binary_op_error): Likewise. - - * cexp.y (yyerror, error, pedwarn, warning, token): Likewise. - - * gcse.c (dump_hash_table): Likewise. - - * integrate.c (function_cannot_inline_p): Likewise. - - * optabs.c: Include insn-config.h earlier. - (init_libfuncs, init_integral_libfuncs, init_floating_libfuncs): - Qualify a char* with the `const' keyword. - - * real.c (asctoe24, asctoe53, asctoe64, asctoe113, asctoe, - asctoeg, mtherr, ereal_atof): Likewise. - - * real.h (ereal_atof): Likewise. - - * sbitmap.c (dump_sbitmap_vector): Likewise. - - * sbitmap.h (dump_sbitmap_vector): Likewise. - - * stmt.c (nesting, n_occurrences, expand_start_case): Likewise. - - * toplev.c (rest_of_compilation): Likewise. - - * tree.h (function_cannot_inline_p, expand_start_case): Likewise. - -Fri Mar 5 23:16:42 1999 David Edelsohn - - * rs6000.h (ASM_OUTPUT_REG_{PUSH,POP}): Add 64-bit support and do - not overwrite AIX link register save area. - -Fri Mar 5 23:08:01 1999 J"orn Rennecke - - * reload.c (find_reloads_subreg_address): Actually create the USE - for the register, not the new memory location. - -Fri Mar 5 21:41:07 1999 J"orn Rennecke - - * reload1.c (emit_reload_insns): If pseudo that can't be replaced - with its equivalent constant, fall back to reload_in. - -Fri Mar 5 13:20:39 1999 Richard Henderson - - * Makefile.in: Delete .flow2 debugging files. - -Fri Mar 5 11:36:11 1999 Nick Clifton - - * config/arm/arm.c (arm_override_options): Change default target - cpu selection so that enabling TARGET_APCS_32 does not override - default target CPU. - -Fri Mar 5 19:26:23 1999 J"orn Rennecke - - * sh.h (SLOW_BYTE_ACCESS): Define to 1. - (BOOL_TYPE_SIZE): Define. - -Fri Mar 5 02:14:54 1999 John Wehle (john@feith.com) - - * function.c (assign_stack_temp_for_type): Abort - if mode == Blkmode and align is less than - BIGGEST_ALIGNMENT / BITS_PER_UNIT. - (assign_stack_temp_for_type): Round the size parameter - passed to assign_stack_local instead of size itself. - -Thu Mar 4 15:00:35 1999 Richard Henderson - - * flow.c (delete_unreachable_blocks): Mark blocks as they - are put on to the worklist, not as they are taken off. - -Thu Mar 4 00:05:44 1999 Jeffrey A Law (law@cygnus.com) - - * function.c (current_function_has_computed_jump): Remove duplicate - definition. - -Wed Mar 3 19:09:11 1999 Jim Wilson - - * m68k/m68020-elf.h (INIT_SECTION_ASM_OP, FINI_SECTION_ASM_OP): Undef. - (STARTFILE_SPEC, ENDFILE_SPEC): Define to empty string. - - * sparc/elf.h (MULDI3_LIBCALL, DIVDI3_LIBCALL, UDIVDI3_LIBCALL, - MODDI3_LIBCALL, UMODDI3_LIBCALL, STDC_0_IN_SYSTEM_HEADERS): Undef. - (INIT_SUBTARGET_OPTABS): Define to empty. - -Wed Mar 3 00:00:37 1999 J"orn Rennecke - - * sh.c (force_into): New function. - (expand_block_move): Use it. - -Tue Mar 2 10:39:43 1999 Nick Clifton - - * cccp.c (struct default_include): Add 'included' field. - (main): Set 'included' field when a default include directory - is added to the chain. If -v is specified list all default - include directories which do not get appended to the chain. - -Tue Mar 2 09:24:10 1999 Nick Clifton - - * configure.in (gxx_include_dir): Rename to - gcc_gxx_include_dir in order to prevent it being overridden by - a top level Makefile. - (gcc_tooldir): If $exec_prefix != $prefix then use the - difference between the two as the basis for gcc_tooldir. - - * configure: Rebuild. - - * Makefile.in: Rename gxx_include_dir to gcc_gxx_include_dir. - -Tue Mar 2 16:45:31 1999 J"orn Rennecke - - * unroll.c (copy_loop_body): Don't make extra copies of - NOTE_INSN_LOOP_CONT notes. - -Tue Mar 2 07:44:56 1999 Mark Mitchell - - * tree.c (save_tree_status): Don't treat functions with no context - as nested. - -Tue Mar 2 09:37:05 1999 Robert Lipe - - * Makefile.in (MAKEINFO): Use makeinfo built from sibling - tree when available. - -Tue Mar 2 10:12:48 1999 Kaveh R. Ghazi - - * alpha.c (alpha_cpu_name, alpha_cpu_string, alpha_tp_string, - alpha_fprm_string, alpha_fptm_string, alpha_mlat_string, - current_function_file): Add the `const' keyword. - (normal_memory_operand): Mark parameter `mode' with - ATTRIBUTE_UNUSED. - (alpha_expand_unaligned_load): Add a default case to a switch. - - * alpha.h (alpha_cpu_string, alpha_fprm_string, alpha_fptm_string, - alpha_tp_string, alpha_mlat_string): Add the `const' keyword. - (normal_memory_operand): Add prototype. - - * alpha.md: Cast an expression to `unsigned HOST_WIDE_INT' when - comparing against one. - -Tue Mar 2 10:00:21 1999 Kaveh R. Ghazi - - * mips.c (abort_with_insn): Make function static, add a prototype, - constify 2nd parameter and mark with ATTRIBUTE_NORETURN. - (current_function_file, mips_cpu_string, mips_isa_string, - mips_abi_string, mips_no_mips16_string, mips_entry_string, - mips_move_1word, mips_move_2words, output_block_move, load_store, - override_options, make_temp_file, mips16_fp_args): Qualify a char* - with the `const' keyword. - - * mips.h (current_function_file, mips_cpu_string, mips_isa_string, - mips_abi_string, mips_entry_string, mips_no_mips16_string, - mips_move_1word, mips_move_2words, output_block_move): Likewise. - (abort_with_insn): Remove extern prototype. - - * mips.md: Qualify a char* with the `const' keyword. - Remove many unused variables named `label'. - -Tue Mar 2 01:27:52 1999 H.J. Lu (hjl@gnu.org) - - * Makefile.in (cpp_install_dir, INSTALL_CPP, UNINSTALL_CPP): New - variables. - (install-cpp, uninstall-cpp): New targets. - (install-normal): Depend on $(INSTALL_CPP). - (uninstall): Depend on $(UNINSTALL_CPP). - * configure.in (cpp_install_dir): New, substitute. - (tmake_file): Added t-install-cpp for --enable-cpp. - * configure: Rebuilt. - * cpp.sh: New cpp script. - * config/t-install-cpp: New target fragment. - -Tue Mar 2 01:40:01 1999 Franz Sirl - Jeffrey A Law (law@cygnus.com) - - * cse.c (fold_rtx): Update comments for (const (minus (label) (label))) - case. - (cse_insn): Avoid creating a bogus REG_EQUAL note for - (const (minus (label) (label))) - (record_jump_cond): Fix mismatched paren in comment. - -Tue Mar 2 01:07:12 1999 Dan Nicolaescu - - * final.c (end_final): There are 11 words in the "main header" - structure, not 10. - -Tue Mar 2 00:09:18 1999 Marc Espie - - * extend.texi: Reference __extension__ in the index. - -Mon Mar 1 19:09:32 1999 Jim Wilson - - * Makefile.in (CROSS_FLOAT_H): Delete. - (FLOAT_H): Use float_h_file. - (rest.cross, stmp-int-hdrs): Delete gfloat.h dependency. - (gfloat.h): Delete. - (stmp-int-hdrs): Use FLOAT_H instead of gfloat.h. - (mostlyclean): Delete gloat.h reference. - (install-cross-rest, install-float-h-cross, stmp-headers): Update - comments. - * configure.in (sparcv9-*-solaris2*): Set float_format to none. - (sparc-*-solaris2*): Set float_format to none for 2.5 and higher. - (float_h_file): Set from float_format. Substitute into Makefile.in. - (float_format): No longer substitute into Makefile.in. - * cross-make (FLOAT_H): Delete. - * config/mips/t-cross64 (FLOAT_H): Delete. - * configure: Rebuilt. - -Mon Mar 1 16:36:18 1999 Jeffrey A Law (law@cygnus.com) - - * mips.md (div_trap_normal, div_trap_mips16): Require the dependent - insn to be an INSN before looking at its pattern. - -Mon Mar 1 15:03:51 1999 Jim Wilson - - * config/m68k/lb1sf68.asm (udivsi3): Change jmi to jcs. Fix comments. - * config/m68k/m68k.h (LEGITIMATE_INDEX_REG_P): Reject SIGN_EXTEND of - HImode reg when TARGET_5200. - -Mon Mar 1 21:44:30 1999 J"orn Rennecke - - From Toshiyasu Morita: - * sh.h (CACHE_LOG): SH2 has cache, too. - -Mon Mar 1 14:23:36 1999 Catherine Moore - - * toplev.c (compile_file): Disable -ffunction-sections and - debugging warning if the object format is elf. - -Mon Mar 1 11:46:25 1999 Vladimir N. Makarov - - * config/h8300/h8300.c (print_operand): Use 16 bit addressing - when the data in 8-bit area and can not be addressed by 8-bit. - -Sun Feb 28 16:40:00 1999 Richard Henderson - - * flow.c (create_basic_block): Disregard integrated bb notes. - -Sun Feb 28 15:57:06 1999 Richard Henderson - - * sparc.md (blockage, nonlocal_goto_receiver): Set length to 0. - -Sun Feb 28 14:47:53 1999 Arturo Montes - - * config/i386/t-sco5gas (crti.o): New target. - -Sun Feb 28 15:10:17 1999 David Edelsohn - - * rs6000.md (elf_high, movsi_got, *movsi_got_internal, - *movsi_got_internal_mem, GOT splitter, movdf_hardfloat32, - movdf_softfloat32, movdf_hardfloat64, movdf_softfloat64, - load_multiple, allocate_stack, call_indirect_aix32, - call_indirect_aix64, call_value_indirect_aix32, - call_value_indirect_aix64, call_indirect_nt, - call_value_indirect_nt): Use gpc_reg_operand instead of - register_operand. - -Sun Feb 28 15:10:17 1999 Michael Meissner - - * rs6000.md (one_cmplsi2, andsi3, iorsi3, xorsi3, *eqvsi3, - *andcsi3, *iorcsi3, *nandsi3, *norsi3): Add alternatives to use CR - other than cr0. - * rs6000.c (and{,64}_operand): If the user did -ffixed-cr0, don't - allow andi. or andis. which always set cr0. - -Sun Feb 28 01:15:04 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Feb 28 02:00:38 1999 Jeffrey A Law (law@cygnus.com) - - * invoke.texi: Update information for PA scheduling. - -Sat Feb 27 23:21:47 1999 Jerry Quinn - Mike Stump - - * pa.c (override_options): Change default to 7100LC. - - * pa.h (REG_ALLOC_ORDER): Change order to allocate left half of - float regs before right half of float regs. - -Sat Feb 27 22:48:38 1999 H.J. Lu (hjl@gnu.org) - Jeffrey A Law (law@cygnus.com) - - * frame.h: Update some comments. - * defaults.h (TARGET_ATTRIBUTE_WEAK): Define. - * crtstuff.c (__register_frame_info, __deregister_frame_info): Declare - using TARGET_WEAK_ATTRIBUTE. - (__do_global_dtors_aux): Check if __deregister_frame_info is - zero before calling it. - (__do_global_dtors): Likewise. - (frame_dummy): Check if __register_frame_info is zero before - calling it. - (__frame_dummy): Likewise. - -Sat Feb 27 19:18:24 1999 Jeffrey A Law (law@cygnus.com) - - * SERVICE: Update from the FSF. - -Sat Feb 27 14:31:22 1999 Arturo Montes - - * config/i386/t-sco5 (crti.o): New target. - * config/i386/sco5.h (STARTFILE_SPEC): Include crti.o when - linking -shared. - * configure.in (i[34567]86-*-sco3.2v5*): Add crti.o. - -Sat Feb 27 01:12:40 1999 Jeffrey A Law (law@cygnus.com) - - * md.texi (prologue,epilogue): Document named patterns. - -Fri Feb 26 19:31:25 1999 Dave Love - - * md.texi, invoke.texi: Fix unterminated @xrefs. - -Fri Feb 26 15:33:45 1999 Richard Henderson - - * genattrtab.c (simplify_knowing): Fix uninitialized read - in Feb 21 change. - - * genextract.c (main): Clear recog_operands before extracting. - -Fri Feb 26 02:24:57 1999 Jeffrey A Law (law@cygnus.com) - - * c-pragma.c (add_weak); Delete. Moved into... - * varasm.c (add_weak): New external function. - (declare_weak): If HANDLE_PRAGMA_WEAK, then add the function to - the list of weak functions. - * c-pragma (add_weak): Declare. - -Thu Feb 25 23:43:59 1999 Richard Henderson - - Flow rewrite to use basic block structures and edge lists: - - * basic-block.h (x_basic_block_head, x_basic_block_end): Kill. - (basic_block_computed_jump_target, basic_block_live_at_start): Kill. - (struct edge_def): New. - (struct basic_block_def): New. - (basic_block_info): New. - (BLOCK_HEAD, BLOCK_END): Update. - (ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR): New. - (uid_block_number): Kill. - (basic_block_for_insn, BLOCK_FOR_INSN): New. - (BLOCK_NUM): Update. - * flow.c (XNMALLOC): Kill. - (max_uid_for_flow): Kill. - (uid_block_number): Kill. - (uid_volatile): Turn into a bitmap. - (SET_INSN_VOLATILE): New. - (basic_block_info): New. - (entry_exit_blocks): New. - (x_basic_block_head, x_basic_block_end): Kill. - (basic_block_computed_jump_target, basic_block_live_at_start): Kill. - (flow_int_list_blocks, basic_block_succ, basic_block_pred): Kill. - (basic_block_loop_depth): Kill. - (basic_block_for_insn): New. - (find_basic_blocks): Split out initial block counting into - count_basic_blocks. Call functions split out of find_basic_blocks_1. - (count_basic_blocks): New. - (find_basic_blocks_1): Split out edge recognition, unreachable - block deletion. - (create_basic_block): New. - (compute_bb_for_insn): New. - (clear_edges): New. - (free_bb_memory): Kill. - (add_edge, add_edge_to_label): Kill. - (mark_label_ref): Kill. - (make_edges): Rewrite to use edge lists. - (make_edge, make_label_edge): New. - (mark_critical_edges): New. - (split_edge, insert_insn_on_edge): New. - (commit_one_edge_insertion, commit_edge_insertions): New. - (delete_unreachable_blocks): Rewrite to use edge lists. - Split out EH region manipulation into delete_eh_regions. - Call tidy_fallthru_edge and merge_blocks. - (delete_eh_regions): New. - (delete_note_p): New. - (delete_insn_chain): New. - (delete_block): Split out code into delete_insn_chain and - tidy_fallthru_edge. Update edge lists. - (expunge_block): New. - (flow_delete_insn): New? - (can_delete_label_p): New? - (merge_blocks_nomove, merge_blocks): New. - (tidy_fallthru_edge): New. - (calculate_loop_depth): New. - (life_analysis): Allocate and free uid_volatile. - (free_basic_block_vars): Update for new structures. - (record_volatile_insns): Use SET_INSN_VOLATILE. - (mark_regs_live_at_end): Tidy EXIT_IGNORE_STACK usage. - (mark_used_regs): Likewise. - (life_analysis_1): Use bb global_live_at_start, global_live_at_end, - local_set regsets. Use bb->aux to store new_live_at_end. Begin - life propagation from EXIT_BLOCK rather than last block. Clear - regs_ever_live after mark_regs_live_at_end. - (allocate_for_life_analysis): Update for new structures. - (propagate_block): Split out loop depth calculation to - calculate_loop_depth. - (regno_uninitialized): Use bb->global_live_at_start. - (regno_clobbered_at_setjmp): Likewise. - (dump_bb_data): Likewise. - (find_auto_inc): Use BLOCK_FOR_INSN instead of BLOCK_NUM. - (dump_flow_info): Update for new structures. - (dump_edge_info): New. - (print_rtl_with_bb): Update for new structures. - (compute_preds_succs): Do no work -- convert edge lists. - (set_block_for_insn): From corpse of old set_block_num. - (set_block_num): Call it. - - * rtl.c (note_insn_name): Add NOTE_INSN_BASIC_BLOCK. - * rtl.h (rtunion_def): Add bb entry. - (NOTE_BASIC_BLOCK): New. - (NOTE_INSN_BASIC_BLOCK): New. - - * varray.h (varray_data_tag): Add bb entry. - (VARRAY_BB_INIT, VARRAY_BB): New. - - * emit-rtl.c (emit_label_before): New. - - * except.c (expand_rethrow): Delete insns following the call to - rethrow. Put the REG_EH_RETHROW on the call. - - * jump.c (returnjump_p, returnjump_p_1): New. - - * expr.h (nonlocal_goto_handler_labels): New declaration. - * function.c (nonlocal_goto_handler_labels): Define it. - (push_function_context_to): Save it. - (pop_function_context_from): Restore it. - (init_function_start): Clear it. - (nonlocal_label_rtx_list): Kill. - * function.h (struct function): Add storage space for it. - * stmt.c (expand_nl_handler_label): Return the new label. - (expand_nl_goto_receivers): Collect a list of them in - nonlocal_goto_handler_labels. - - * Makefile.in (print-rtl.o): Depend on basic-block.h. - (flow.o): Depend on insn-flags.h. - - * function.c (thread_prologue_and_epilogue_insns): Do not - half-heartedly update bb structures. - - * toplev.c: Add flow2 dump as -dw. - (rest_of_compilation): Finish .greg before flow2. - - * graph.c (draw_edge): Handle class 3. - (print_rtl_graph_with_bb): Make abnormal edges red class 2, - change non-fall-thru but adjacent to green class 3. Update - to use new structures. - - * print-rtl.c (print_rtx): Handle NOTE_INSN_BASIC_BLOCK. - - * reg-stack.c (BLOCK_NUM): Convert to function. Abort if - block_number is -1. - (reg_to_stack): Initialize block_num to -1. - - * combine.c (set_nonzero_bits_and_sign_copies): Update reference - to basic_block_live_at_start to bb->global_live_at_start. - (try_combine): Likewise. - (reg_dead_at_p): Likewise. - * global.c (global_conflicts): Likewise. - Handle stack regs on all abnormal edges, not just computed jumps. - (mark_elimination): Update reference to basic_block_live_at_start. - (build_insn_chain): Likewise. - * haifa-sched.c (haifa_edge): Rename from edge for conflict. - (is_cfg_nonregular): Look at nonlocal_goto_handler_labels instead - of nonlocal_label_rtx_list. - (check_live_1): Update reference to basic_block_live_at_start. - (update_live_1): Likewise. - (find_pre_sched_live): Likewise. - (find_post_sched_live): Likewise. - * local-alloc.c (update_equiv_regs): Likewise. - (block_alloc): Likewise. - * reload1.c (reload, reload_combine): Likewise. - * regmove.c (mark_flags_life_zones): Likewise. - * resource.c (mark_target_live_regs): Likewise. - * sched.c (schedule_block): Likewise. - - * regclass.c (regset_release_memory): Don't free - basic_block_live_at_start. - - * unroll.c (copy_loop_body): Don't duplicate NOTE_INSN_BASIC_BLOCK. - -Thu Feb 25 21:32:34 1999 Jason Merrill - - * fixinc.wrap: Also handle struct queue in sys/stream.h. - * fixinc.svr4: Likewise. - - * dwarf2out.c (scope_die_for): Set scope_die to comp_unit_die - rather than asserting it. - -Thu Feb 25 23:33:06 1999 Kaveh R. Ghazi - - * cppexp.c (left_shift, right_shift, parse_charconst, COMPARE, - cpp_parse_expr): Replace uses of long/HOST_BITS_PER_LONG with - HOST_WIDEST_INT/HOST_BITS_PER_WIDEST_INT. - - * Makefile.in (cppmain.o, cpplib.o, cpphash.o, cppalloc.o, - cpperror.o, cppexp.o, cppfiles.o, cppinit.o, fix-header.o, - scan-decls.o): Don't depend on machmode.h. - - * cppexp.c: Don't define CHAR_BIT or HOST_BITS_PER_WIDE_INT anymore. - Replace all instances of HOST_WIDE_INT with HOST_WIDEST_INT. - - * cppfiles.c: Likewise. - - * cpplib.c: Likewise. - - * cpplib.h: Likewise. Also don't include machmode.h anymore. - -Thu Feb 25 18:46:26 1999 Richard Henderson - - * gcc.c (default_compilers): Define __FAST_MATH__ when appropriate. - * objc/lang-specs.h: Likewise. - -Thu Feb 25 16:19:43 1999 Jeffrey A Law (law@cygnus.com) - - * pa.md (call patterns): Lose unused argument to output_call. - - * print-rtl.c (print_rtl): Print /j and /c for the jump/call flags. - -1999-02-25 Zack Weinberg - - * cpphash.c (install): Rename to cpp_install, add cpp_reader* - first argument. All callers changed. - (hashtab): Removed. - (cpp_lookup, cpp_install): Change all refs to hashtab to - pfile->hashtab. - (cpp_hash_cleanup): Removed. - * cpphash.h: Adjust prototypes. - * cpplib.h (struct cpp_reader): Add hashtab pointer. - * cppinit.c (cpp_reader_init): Also allocate space for the - hashtab. - (cpp_cleanup): Delete all macros and free the hashtab. - -Thu Feb 25 21:52:54 1999 J"orn Rennecke - - * sh.h (PASS_IN_REG_P): For TARGET_HITACHI, don't pass structures - in registers. - - * expr.h (PRETEND_OUTGOING_VARARGS_NAMED): Provide default definition. - * function.c (assign_parms): Honour PRETEND_OUTGOING_VARARGS_NAMED. - * calls.c (expand_call): Likewise. - - * sh.c (sh_expand_prologue): For TARGET_HITACHI, don't push varargs / - stdarg arguments. - * sh.h (CPP_SPEC): Add -D__HITACHI__ for -mhitachi. - (FUNCTION_ARG): For TARGET_HITACHI, don't pass unnamed - arguments in registers. - (PRETEND_OUTGOING_VARARGS_NAMED): Define. - * va-sh.h (entire file): If __HITACHI__ is defined, use sh[123] - flavor varargs. - -Thu Feb 25 14:32:40 1999 Kaveh R. Ghazi - - * cse.c (dump_class): Revert last change and make the prototype - extern. - -Thu Feb 25 19:13:42 1999 J"orn Rennecke - - * rtl.h (insn_first_p): Don't declare. - * rtlanal.c (insn_first_p): Delete. - * loop.c (loop_insn_first_p): Faster implementation. - -Thu Feb 25 10:44:35 1999 Richard Earnshaw (rearnsha@arm.com) - - * arm.h (TARGET_SWITCHES): Delete deprecated switches -m[236]. - (TARGET_3, TARGET_6): Delete. - (ARM_FLAG_ARM[36]): Delete. - (CPP_CPU_ARCH_SPEC): No need to handle -m[236] any more. - (CC1_SPEC): Don't expand -m[236] into new equivalents. - (CPP_APCS_PC_SPEC): No need to handle -m[236] any more. - * arm.c (arm_override_options): Delete warnings about deprecated - options -m[236]. - - * arm.c (arm_finalize_pic): Build the label into the special pic - adjustment insn instead of issuing it separately. - * arm.md (pic_add_dot_plus_eight): Rework to contain the label - that is needed. - - * arm.md (*zeroextractqi_compare0_scratch): Delete. - (*ne_zeroextractsi): New pattern. - -Thu Feb 25 18:40:06 1999 J"orn Rennecke - - * stmt.c (expand_end_loop): Grok code emitted by - expand_exit_loop_if_false. - -Thu Feb 25 10:17:32 1999 Nick Clifton - - * config/arm/arm.c (return_in_memory): Float fields in unions - force a return in memory. - (load_multiple_sequence): Add comment explaining why two LDR - instructions can be better than an LDMIA instruction. - - * config/arm/arm.h (TARGET_SHORT_BY_BYTES): Add comment - describing the real meaning of this option. - (FIXED_REGISTERS): Default r10 to not-fixed. - (CALL_USED_REGISTERS): Default r10 to not-call-used. - (SUBTARGET_CONDITIONAL_REGISTER_USAGE): If not defined, define - as empty. - (CONDITIONAL_REGISTER_USAGE): Fix r10 if TARGET_APCS_STACK is - true. Invoke SUBTARGET_CONDITIONAL_REGISTER_USAGE after - performing other checks. - - * config/arm/arm.md (zero_extendhisi2): Undo previous change. - (extendhisi2): Undo previous change. - Also add comments describing why TARGET_SHORT_BY_BYTES can be - ignored for armv4(t) architectures. - - * config/arm/riscix.h (SUBTARGET_CONDITIONAL_REGISTER_USAGE): - Define to fix r10. - - * config/arm/riscix1-1.h - (SUBTARGET_CONDITIONAL_REGISTER_USAGE): Define to fix r10. - -Thu Feb 25 12:09:04 1999 Kaveh R. Ghazi - - * cse.c (dump_class): Make the function definition static to match - the prototype. - -Wed Feb 24 17:47:28 1999 Jim Wilson - - * dbxout.c (gstab.h): Use if CROSS_COMPILE. - - * dwarf2out.c (add_location_or_const_value_attribute): Add big - endian correction for parms passed in regs but living on the stack. - -Wed Feb 24 14:03:54 1999 Jeffrey A Law (law@cygnus.com) - - * calls.c (initialize_argument_information): New function extracted - from expand_call. - (expand_call): Use initialize_argument_information. Remove variables - which are no longer used due to cleanups. - - * calls.c (compute_argument_block_size): New function, extracted from - expand_calls. - (expand_calls): Use compute_argument_block_size. Delete - original_args_size, use unadjusted_args_size instead. - - * calls.c (precompute_arguments): New function, extracted from - expand_call. - (expand_call): Use precompute_arguments. - - * calls.c (finalize_must_preallocate): New function, extracted from - expand_call. - (expand_call): Use finalize_must_preallocate. - - * calls.c (store_one_arg): Mark "variable_size" as possibly unused. - - * regclass.c (record_reg_classes, case 'p'): Set classes appropriately. - An alternative always fails if it needs a pseudo and no suitable - register class can be found. - -Wed Feb 24 19:47:56 1999 J"orn Rennecke - - * loop.h (loop_insn_first_p): Declare. - * loop.c (loop_insn_first_p): No longer static. - * unroll.c (iteration_info): Fix comparison to - reg_iv_type->num_elements. - Before accessing reg_biv_class, check index against - max_reg_before_loop. - Fix and enable code for giv iterators. - (loop_iterations): Compare with reg_iv_type->num_elements instead - of with max_reg_before_loop. - -Wed Feb 24 19:17:11 1999 J"orn Rennecke - - * unroll.c (unroll_loop): Avoid out-of-bounds index for local_regno. - -Wed Feb 24 11:26:41 1999 Vladimir N. Makarov - - * config/sparc/sparc.h (CONDITIONAL_REGISTER_USAGE): Don't use - PIC_OFFSET_TABLE_REGNUM for register allocation when -fPIC. - -Tue Feb 23 16:24:19 1999 Marc Lehmann - - * config/i386/i386.md: Fix typo. - -Mon Feb 22 19:36:33 1999 Andrew Cagney - - * config/mips/mips.c (mips_debugger_offset): When TARGET_MIPS16 && - frame_pointer_needed adjust frame size. - (function_prologue): Don't MIPS16 .mask GPOFFSET. Already adjusted - in .frame pseudo-op. - Frm Jim Wilson : - * mips.c (function_prologue): Adjust frame size in .frame pseudo-op - when TARGET_MIPS16 && frame_pointer_needed. - -1999-02-22 Nick Clifton - - * config/arm/arm.h: Add TARGET_CPU_strongarm1100. - Add -mno-sched command line switch to disable scheduling of - instructions into the function's prologue. - (enum processor_type): Remove. - (TARGET_OPTIONS): Add "fpe=" option to match documentation. - (struct arm_cpu_select): Replace 'set_tune_p' and 'set_arch_p' - fields with 'processors' field. - (CONDITIONAL_REGISTER_USAGE): Allow r10 to be used if stack - checking is not enabled. - (RETURN_IN_MEMORY): Always call arm_return_in_memory. - - * config/arm/arm.c (arm_cpu): Remove. - (tune_flags): Remove. - (arm_is_strong): New variable: true iff the target processor is a - StrongARM. - (arm_is_6_or_7): New variable: true iff the target processor is an - ARM6 or and ARM7. - (arm_select): Fields reorganised. - (struct processors): processor_type field removed. - (all_procs): Remove. - (all_cores): New array: Definitions of all known ARM cpu cores. - (all_architectures): New array: Definitions of all known ARM - architectures. - (streq): New macro. - (FL_SCHED): New processor flag: processor required load - scheduling. - (FL_STRONG): New processor flag: processor is a StrongARM. - (arm_override_options): Reorganized to make code clearer. - (use_return_insn): Test for "not (TARGET_APCS and - frame_pointer_needed)". - (arm_return_in_memory): Improve handling of structures. - - * config/arm/arm.md: Remove "cpu" attribute. Replace with - "is_strongarm" and "is_arm_6_or_7" attributes. - (zero_extendhisi2): Check for TARGET_SHORT_BY_BYTES before - arm_arch4. - (extendhisi2): Check for TARGET_SHORT_BY_BYTES before arm_arch4. - - * invoke.texi (ARM Options): Document -mtune= and -mfp= options. - -1999-02-22 Philip Blundell - - * config/arm/linux-gas.h (INITIALIZE_TRAMPOLINE): Replace default - definition with one including cache synchronization. - (CLEAR_INSN_CACHE): Correct syscall number and enable definition. - Move definition of inhibit_libc to... - * config/arm/xm-linux.h: ... here. - - * config/arm/t-linux: Disable multilib configurations since the - only effect for most people is to cause builds to fail. - - * config/arm/elf.h (ASM_FILE_START): Add .file directive. - (ASM_SPEC): Translate -mapcs-float to -mfloat for the assembler. - - * config/arm/linux-elf.h (DEFAULT_VTABLE_THUNKS): Define. - (HANDLE_SYSV_PRAGMA): Likewise. - (LIB_SPEC): Copy definition from generic Linux files. - (LIBGCC_SPEC): Include -lfloat if -msoft-float was given. - (FP_DEFAULT): Set to SOFT3 on 32-bit targets. - (DWARF2_DEBUGGING_INFO): Define. - (PREFERRED_DEBUGGING_TYPE): Define as DBX_DEBUG. - -Mon Feb 22 16:54:18 1999 Andrew MacLeod - - * loop.c (libcall_other_regs): Make extern. - * rtl.h (find_last_value): Add parameter to prototype. - (libcall_other_reg): Add extern declaration. - * rtlanal.c (find_last_value): Add another parameter to allow - a definition using a hardware register to be found as well. - -Mon Feb 22 13:33:47 1999 Mark Mitchell - - * cse.c (dump_class): New function. - (invalidate_memory): Fix typo in comment. - * function.c (temp_slot): Add an alias set field. - (assign_stack_temp): Only reuse slots if they will have the - same alias set as before. - (combine_temp_slots): Don't combine if -fstrict-aliasing; - that's unsafe. - * rtl.c (copy_rtx): Copy all the flags (in particular, - MEM_SCALAR_P). - -Mon Feb 22 14:13:23 1999 Vladimir N. Makarov - - * configure.in (i[34567]86-*-linux-gnu*, - i[34567]86-*-linux-gnulibc1, i[34567]86-*-linux-gnuaout*, - i[34567]86-*-linux-gnuoldld*): Use fixinc.x86-linux-gnu as - fixincludes. - - * configure: Rebuilt. - - * fixinc.x86-linux-gnu: New script for fixing asm-statements bug - on x86 linux. - - * fixinc/fixinc.x86-linux-gnu: Copy of the previous one. - - * fixinc/mkfixinc.sh (i[34567]86-*-linux-gnu*, - i[34567]86-*-linux-gnulibc1, i[34567]86-*-linux-gnuaout*, - i[34567]86-*-linux-gnuoldld*): Use fixinc.x86-linux-gnu as - fixincludes. - -Mon Feb 22 08:55:05 1999 Ovidiu Predescu - - * objc/objc-act.c (encode_type): Temporary revert to the old - behavior of encoding types as the new one seems to break the - encoding of bitfields. - -Mon Feb 22 11:40:44 1999 Craig Burley -Sat Feb 20 09:59:36 1999 Craig Burley - - * Makefile.in (all.internal, all.cross): Depend on `doc' - target, to ensure docs get made before installation. - - Decrease spurious warnings from -fsyntax-only: - * stmt.c (expand_expr_stmt): Expand expr even when -fsyntax-only. - -Mon Feb 22 10:55:00 1999 Gavin Romig-Koch - - * c-lex.c (yylex): Replace warning about integer constants being - larger than long-longs, with a warning about integer constants - being larger than the largest target integer. - -Mon Feb 22 08:35:38 1999 Craig Burley - - Fix -fsyntax-only ICEs: - * varasm.c (assemble_zeros, assemble_variable, - output_constant_def): Do nothing when -fsyntax-only. - -Fri Feb 19 18:18:56 1999 Don Bowman - - * configure.in (mips*-*-vxworks*): Enable gthreads vxworks support. - * configure: Rebuilt. - -Sun Feb 21 20:34:44 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Feb 21 20:35:10 1999 Jeffrey A Law (law@cygnus.com) - - * config/aoutos.h (ASM_OUTPUT_CONSTRUCTOR): Delete. - (ASM_OUTPUT_DESTRUCTOR, ASM_OUTPUT_GC_ENTRY): Likewise. - * tm.texi: Update docs for constructors and destructors. - -Sun Feb 21 17:11:18 1999 Richard Henderson - - * genattrtab.c (check_attr_value): Allow negative const_int if - negative_ok. Accept integral arithmetic operators. Accept - direct references to other attributes. Accept symbol_ref in - non-constant attributes. - (max_attr_value): Add new argument `unknownp'. Update all callers. - (or_attr_value): Likewise. - (simplify_knowing): Don't optimize if max_attr_value unknown. - (write_length_unit_log): Likewise with or_attr_value. - (find_and_mark_used_attributes): Don't fallthru case. - (write_attr_set): Pass thru all non-cond expressions. - (write_attr_value): Handle symbol_ref, attr, and arithmetic. - -Sun Feb 21 13:16:44 1999 Michael Hayes - - * regmove.c (discover_flags_reg): Use word_mode instead of SImode. - -Sun Feb 21 13:15:40 1999 Richard Henderson - - * regmove.c (discover_flags_reg): Remove cc0 code. - (mark_flags_life_zones) [HAVE_cc0]: Force use of cc0; bail if - a potential flags register was identified. - -Sat Feb 20 16:16:07 1998 Franz Sirl - - * rs6000.md (scc plus ltu): Fix typo in last change. - -Sat Feb 20 09:08:44 1999 Richard Earnshaw (rearnsha@arm.com) - - * xm-arm.h (HOST_BITS_PER_LONGLONG): Define. - -Fri Feb 19 23:02:02 1999 Richard Henderson - - * regmove.c (discover_flags_reg): New function. - (flags_set_1, mark_flags_life_zones): New functions. - (regmove_optimize): Call them. - (fixup_match_1): Use insn modes rather than sets_cc0_p. - -Fri Feb 19 22:47:01 1999 J"orn Rennecke - - * rtlanal.c (insn_first_p): Fix return value for insn == reference. - - * loop.c (strength_reduce, check_final_value, check_dbra_loop): - Use loop_insn_first_p. - -Fri Feb 19 15:49:26 1999 Michael Meissner - David Edelsohn - - * rs6000.md (scc plus eq): Fix output template. - (scc plus ltu): Fix output template and collapse variants - correcting early clobbers. - (scc plus geu): Fix output template. - (scc plus gt): Fix output template. - (scc plus gtu): Fix output template and collapse variants. - -Fri Feb 19 15:43:59 1999 Kaveh R. Ghazi - - * cppinit.c (print_help): Remove unescaped newline in string. - -Fri Feb 19 19:55:06 1999 J"orn Rennecke - - * loop.c (strength_reduce): Check for intervening jumps when - converting biv increment to giv. - -Thu Feb 18 16:36:58 1999 Per Bothner - - * tree.def (TRY_FINALLY_EXPR, GOTO_SUBROUTINE_EXPR): New tree nodes, - * expr.c (expand_expr): Support new tree nodes. - -Fri Feb 19 10:17:56 1999 Andreas Schwab - - * config/m68k/m68k.c (m68k_align_loops_string, - m68k_align_jumps_string, m68k_align_funcs_string): Add const. - * config/m68k/m68k.h (m68k_align_loops_string, - m68k_align_jumps_string, m68k_align_funcs_string): Likewise. - -Thu Feb 18 23:28:35 1999 Kaveh R. Ghazi - - * bitmap.c (bitmap_print): Qualify a char* with the `const' keyword. - - * bitmap.h (bitmap_print): Likewise. - - * c-decl.c (builtin_function, grokdeclarator, grokfield): Likewise. - - * c-lang.c (build_objc_string): Likewise. - - * c-lex.c (yyerror, extend_token_buffer): Likewise. Don't include - limits.h or ctype.h. Remove unused variable `p'. - - * c-lex.h (yyerror): Qualify a char* with the `const' keyword. - - * c-pragma.c (handle_pragma_token): Likewise. - - * c-pragma.h (handle_pragma_token): Likewise. - - * c-tree.h (build_objc_string, builtin_function, grokfield, - build_indirect_ref, lvalue_or_else, readonly_warning, error_init, - pedwarn_init): Likewise. - - * c-typeck.c (convert_for_assignment, warn_for_assignment, - push_string, warning_init, incomplete_type_error, - build_indirect_ref, lvalue_or_else, readonly_warning, - build_c_cast, spelling, push_member_name, print_spelling, - error_init, pedwarn_init, start_init): Likewise. - - * objc/objc-act.c (build_objc_string): Likewise. - - * print-tree.c (print_node_brief, print_node): Likewise. - - * tree.h (lvalue_or_else, print_node, print_node_brief): Likewise. - -Thu Feb 18 20:44:21 1999 David Edelsohn - - * regclass.c (record_reg_classes): Correctly handle 'p' constraint. - -Thu Feb 18 19:59:37 1999 Marc Espie - - * configure.in :Handle OpenBSD platforms. - * configure: Rebuilt. - * config/openbsd.h: New file. - * config/xm-openbsd.h: New file. - * config/t-openbsd: New file. - * config/t-openbsd-thread: New file. - -Thu Feb 18 18:47:09 1999 Jeffrey A Law (law@cygnus.com) - - * function.c (assign_stack_temp_for_type): Round SIZE before calling - assign_stack_local for BLKmode slots. - -Fri Feb 19 01:45:06 1999 J"orn Rennecke - - * loop.c (strength_reduce): For derived givs, replace the - giv this was derived from with its new_reg. - (recombine_givs): Don't set new_reg for derived giv. - And don't print it, print SUM instead. - -Thu Feb 18 15:52:49 1999 Jim Wilson - - * m68kelf.h (ASM_RETURN_CASE_JUMP): Add 5200 support. - -1999-02-18 Zack Weinberg - - * cpplib.c: Kill define of STDC_VALUE. Don't include output.h - or prefix.h. Change CPP_IS_MACRO_BUFFER to not refer to - macro_cleanup. - (GET_ENV_PATH_LIST, PATH_SEPARATOR, STANDARD_INCLUDE_DIR, - predefs, SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE, - CPP_WCHAR_TYPE, USER_LABEL_PREFIX, REGISTER_PREFIX, struct - cpp_pending, version_string, struct default_include, - include_defaults_array, path_include, cpp_options_init, - dump_special_to_buffer, initialize_builtins, cpp_start_read, - cpp_reader_init, nreverse_pending, push_pending, print_help, - cpp_handle_option, cpp_handle_options, cpp_finish, - cpp_cleanup): Move to cppinit.c. - (macro_cleanup, struct arglist, collect_expansion, - create_definition, compare_defs, comp_def_part, ARG_BASE, - struct argdata, macarg, change_newlines, timestamp, - monthnames, special_symbol, unsafe_chars, macroexpand, - push_macro_expansion): Move to cpphash.c. - (quote_string, check_macro_name, cpp_expand_to_buffer, - output_line_command, cpp_undef): Export. - (null_underflow, null_cleanup, handle_directive): Make static. - - * cpplib.h: Prototype now-exported functions. Adjust decls of - syntax tables so we can include cpplib.h in cppinit.c. - * cpphash.h: Prototype all functions exported by cpphash.c. - * cppinit.c: Make syntax tables initialized data if possible - (uses GCC designated-initializer extension). - * cppexp.c: Make cpp_lex static. - * Makefile.in: Move -D switches for the various include dirs - from cpplib.o rule to cppinit.o rule. Adjust dependencies. - -Thu Feb 18 13:15:56 1999 Marc Espie - - * alpha/openbsd.h: New file. - * alpha/xm-openbsd.h: New file. - * sparc/openbsd.h: New file. - * sparc/xm-openbsd.h: New file. - * m68k/openbsd.h: New file. - * m68k/xm-openbsd.h: New file. - * i386/openbsd.h: New file, originally from netbsd. - * i386/xm-openbsd.h: New file. - -1999-02-17 Zack Weinberg - - * Makefile.in: Correct dependencies for cpplib object files. - -Wed Feb 17 14:04:18 1999 Michael Meissner - - * rs6000.md ({add,sub}si3 `.'): Add alternatives to use CR other - than cr0. - -Wed Feb 17 16:59:28 1999 J"orn Rennecke - - * loop.c (strength_reduce): Don't move giv insn for biv turned giv - below scan_start. - -Wed Feb 17 10:56:24 1999 Kaveh R. Ghazi - - * tree.c (tree_node_kind_names, print_obstack_name, - get_identifier, maybe_get_identifier, build_string, - build_expr_wfl, is_attribute_p, lookup_attribute, - print_obstack_statistics, get_file_function_name_long, tree_check, - tree_class_check, expr_check): Qualify a char* with the `const' - keyword. - - * tree.h (get_identifier, maybe_get_identifier, build_string, - build_expr_wfl, is_attribute_p, lookup_attribute, - print_obstack_statistics, print_obstack_name, tree_check, - tree_class_check, expr_check): Likewise. - -Tue Feb 16 21:29:38 1999 Jeffrey A Law (law@cygnus.com) - - * i386/freebsd-elf.h, i386/gas.h, i386/linux.h: Fix minor spacing - errors. - - * calls.c (store_one_arg): Mark any slots used for the argument - as in-use immediately after we're done saving any slots which - will be overwritten by this argument. - -Tue Feb 16 21:02:07 1999 Anton Hartl - - * rs6000.md (call_value): Fix typo. - -Wed Feb 17 01:29:07 1999 J"orn Rennecke - - * loop.c (strength_reduce): Calculate maybe_dead before - calling recombine_givs. - -Wed Feb 17 00:43:12 1999 J"orn Rennecke - - * loop.c (strength_reduce): Dump biv increment -> giv conversions. - -Tue Feb 16 15:31:39 1999 Ovidiu Predescu - - * objc/objc-act.c (encode_type): Encode the type instead of - encoding the mode of the type (patch from Richard Frith-Macdonald - ). - -Tue Feb 16 10:53:51 1999 Richard Earnshaw (rearnsha@arm.com) - - * config/arm/arm.md (*zeroextractqi_compare0_scratch): Re-add load - instruction killed in previous change. Simplify mask generation. - (*zeroextractsi_compare0_scratch): Simplify mask generation. - -Tue Feb 16 09:52:26 1999 Nick Clifton - - * config/arm/arm.md (zeroextractqi_compare0_scratch): Ensure that - bitfield does not overflow a byte boundary. - -Tue Feb 16 01:37:33 1999 Charles G Waldman - - * c-common.c (shorten_compare): Get the min/max value from the - underlying type of an enumeration, not the enumerated type itself. - -Mon Feb 15 23:04:48 1999 Jeffrey A Law (law@cygnus.com) - - * jump.c: Include insn-attr.h. - (delete_computation): If reload has completed and insn scheduling - after reload is enabled, then do not depend on REG_DEAD notes. - * Makefile.in (jump.o): Depend on insn-attr.h. - -Mon Feb 15 16:57:38 1999 Richard Henderson - - * i386.md (addsi3): Allow lea for any constant_p. - -1999-02-15 Zack Weinberg - - * toplev.c (documented_lang_options): Remove -fident and - -fnoident, which are now handled by the language independent - option parser. - -1999-02-15 Zack Weinberg - - * c-common.c (UNGETC [USE_CPPLIB=1]): Do nothing if c is EOF. - * c-lex.c: Likewise. - * cpplib.c (cpp_push_buffer, cpp_pop_buffer): Use a linked - list in malloced memory for the buffer stack. - (cpp_get_token): Don't pop the last buffer off the stack. - Calls after CPP_EOF has been returned produce CPP_EOF with no - state change. - (cpp_finish): Pop last buffer here. - (do_line): Don't free ip->last_nominal_fname if it is equal to - ip->fname. - (special_symbol): If a T_CONST is the empty string, push a - single `@ ' escape instead. - (macroexpand): Special symbol buffers have escapes too. - * cpplib.h (struct cpp_buffer): Remove unused fields, add prev - buffer pointer. - (struct cpp_reader): Remove buffer_stack. Add - buffer_stack_depth. - (CPP_PREV_BUFFER, CPP_NULL_BUFFER): Buffer stack is now a - linked list. - -Mon Feb 15 14:44:53 1999 Kaveh R. Ghazi - - * cccp.c: Don't define HOST_WIDE_INT. Replace all occurrences of - WIDE_INT with WIDEST_INT. - - * cexp.y: Likewise. - Don't define unsigned_HOST_WIDE_INT, CHAR_BIT or - HOST_BITS_PER_WIDE_INT. Replace occurrences of PRINTF_PROTO_1() - style with PVPROTO() ATTRIBUTE_PRINTF_1 style macros. Replace - occurrences of "unsigned_HOST" with "unsigned HOST". Provide a - definition of variable `c89' when compiling a test binary and set it. - - * system.h: Don't define the PRINTF_PROTO_* macros. - -Mon Feb 15 11:33:51 1999 Jeffrey A Law (law@cygnus.com) - - * loop.c (mark_loop_jump): Handle LO_SUM. If we encounter something - we do not understand, mark the loop and containing loops as invalid. - -Mon Feb 15 00:40:45 1999 J"orn Rennecke - - * alias.c (init_alias_analysis): Avoid self-referential value - when setting reg_known_value from REG_EQUAL notes. - -Sun Feb 14 23:12:10 1999 Richard Henderson - - * i386.c (legitimate_address_p): Verify modes of base and index. - -Sun Feb 14 23:01:28 1999 Richard Henderson - - * i386.c (legitimate_pic_address_disp_p): Remove static. - * i386.h (LEGITIMATE_PIC_OPERAND_P): Use it instead of - open-coding cases. - -Sun Feb 14 21:03:28 1999 Jeffrey A Law (law@cygnus.com) - - * except.c (start_catch_handler): Use emit_cmp_and_jump_insns. - * explow.c (probe_stack_range): Likewise. - * expmed.c (do_cmp_and_jump): Likewise. - * expr.c (store_expr, expand_expr, expand_builtin): Likewise. - (do_tablejump): Likewise. - * stmt.c (expand_expr_stmt, expand_end_case): Likewise. - (do_jump_if_equal, emit_case_nodes): Likewise. - * optabs.c (emit_cmp_and_jump_insns): Clarify comments. If UNSIGNEDP, - then convert comparison to an unsigned code before emitting the jump. - (expand_float, expand_fix): Use emit_cmp_and_jump_insns. - -Sun Feb 14 02:24:15 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Feb 14 01:15:04 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Feb 14 00:45:50 1999 Jeffrey A Law (law@cygnus.com) - - * loop.c: Disable recent loop changes. Temporary as Joern - continues to fix problems. - -Sat Feb 13 23:29:42 1999 Richard Henderson - - * loop.c (combine_givs_used_by_other): Delete. - (combine_givs_benefit_from): Delete. - (combine_givs): Deny combination of givs only used once. Simplify - code with the death of combine_givs_benefit_from. - -Sun Feb 14 11:24:05 1999 Michael Hayes - - * loop.c (scan_loop): Call reg_in_basic_block_p before - loop_reg_used_before_p. - -Sat Feb 13 05:32:00 1999 Richard Earnshaw (rearnsha@arm.com) - - * arm.md: Use gen_rtx_FOO instead of gen_rtx (FOO, ...). - * arm.h: Likewise. - * arm.c: Likewise. - - * arm.h (TARGET_OPTIONS): Reformat for clarity. - (GO_IF_LEGITIMATE_ADDRESS): When generating PIC, references to symbols - in the constant pool aren't valid. - (LEGITIMATE_PIC_OPERAND_P): Likewise. - - * arm.c: Include "system.h", not stdio.h and string.h. - -Fri Feb 12 13:06:28 1999 Jim Wilson - - * stmt.c (expand_return): Return if optimize_tail_recursion succeeded. - (optimize_tail_recursion): Change return type from void to int. - Add return statements. - * tree.h (optimize_tail_recursion): Change prototype to match. - -Fri Feb 12 21:09:51 1999 J"orn Rennecke - - * reload.c (find_reloads_subreg_address): New function, broken out of - find_reloads_toplev. - (find_reloads_toplev, find_reloads_address_1): Use it. - -Fri Feb 12 13:20:52 1999 Jeffrey A Law (law@cygnus.com) - - * h8300.md (zero_extendhisi2 H8/300 variant): Correctly handle - extending a CONST_INT. - - * h8300.md (peephole for combining memrefs): Delete incorrect peephole. - -Fri Feb 12 18:29:11 1999 J"orn Rennecke - - * loop.c (loop_insn_first_p, biv_elimination_giv_has_0_offset): - New functions. - (maybe_eliminate_biv_1): Use biv_elimination_giv_has_0_offset. - -Fri Feb 12 16:56:10 1999 J"orn Rennecke - - * loop.c (load_mems): Don't guess how to do a load / store, use - emit_move_insn. - -Fri Feb 12 09:24:26 1999 Kaveh R. Ghazi - - * system.h: Provide a definition for HOST_WIDEST_INT, etc. - -Fri Feb 12 23:37:26 1999 Michael Hayes - - * config/c4x/c4x.c (c4x_address_cost): Revert 9 Feb change. - -Fri Feb 12 00:51:26 1999 Jeffrey A Law (law@cygnus.com) - - * reload.c (find_reloads_address_1): Fix handling of an autoincremented - pseudo which is homed in the stack. - - * mips.c (save_restore_insns): Fix loop to save/restore FP registers. - (compute_frame_size): Change loop over FP regs to be consistent - with the loop in save_restore_insns. - -Thu Feb 11 17:38:40 1999 Jim Wilson - - * i960/i960.h (OVERRIDE_OPTIONS): Warn if -mlong-double-64 is used. - (LONG_DOUBLE_TYPE_SIZE): Undef then unconditionally define to 96. - -Thu Feb 11 15:11:35 1999 Jeffrey A Law (law@cygnus.com) - - * mn10200.md (bset); Re-enable. - -Thu Feb 11 15:20:49 1999 J"orn Rennecke - - * sh.md (is_sfunc): New attribute. - * sh.h (INSN_SETS_ARE_DELAYED, INSN_REFERENCES_ARE_DELAYED): Use it. - -Thu Feb 11 01:06:49 1999 Nathan Sidwell - - * fold-const.c (range_binop): Take account of the bounded nature - of fixed length arithmetic when comparing unbounded ranges. - -Thu Feb 11 00:08:17 1999 John Wehle (john@feith.com) - - * function.c (assign_stack_temp_for_type): Clear best_p - when an exact match is found. - - * i386.h (LOCAL_ALIGNMENT): Define. - * function.c (assign_stack_local, assign_outer_stack_local): Use it. - (assign_stack_temp_for_type): New function based on assign_stack_temp. - (assign_stack_temp): Call it. - (assign_temp): Use assign_stack_temp_for_type, not assign_stack_temp. - * stmt.c: Use assign_temp, not assign_stack_temp. - * tm.texi: Document LOCAL_ALIGNMENT. - -Wed Feb 10 23:28:28 1999 Jeffrey A Law (law@cygnus.com) - - * reorg.c: Finish deleting half-deleted comment. - -Wed Feb 10 17:12:21 1999 Jim Wilson - - * emit-rtl.c (operand_subword): Sign extend REAL_VALUE_TO_TARGET_SINGLE - result. - * final.c (split_double): Sign extend REAL_VALUE_TO_TARGET_DOUBLE - result. - * real.c (endian): Delete sign extension code. - * config/m32r/m32r.md (movsf_insn+1): REAL_VALUE_TO_TARGET_SINGLE call - replaced with operand_subword call. - -Wed Feb 10 15:16:39 1999 Richard Henderson - - * alpha.md (cmov compound patterns): Delete. Jump can now - create the correct constructs in the first place. - -Wed Feb 10 11:03:22 1999 Richard Henderson - - * configure.in (alphaev6*): Fix typo in target_cpu_default2. - -Wed Feb 10 13:59:18 1999 Dave Brolley - - * mbchar.c (local_mb_cur_max): Handle the case where MB_CUR_MAX is 0. - -Wed Feb 10 10:35:05 1999 Jim Wilson - - * tmp-emsgids.c: Delete. - -Wed Feb 10 09:57:08 1999 Mark Mitchell - - * rtlanal.c (for_each_rtx): Fix declaration to conform to GNU - coding standards. - -Wed Feb 10 10:09:41 1999 Jeffrey A Law (law@cygnus.com) - - * mn10200.md (bset, bclr): Operand 0 is a read/write operand. - - * reload1.c (reload_combine_note_store): Second argument is no - longer unused/ignored. Handle multi-register hard regs. - (move2add_note_store): Simplify. - -Wed Feb 10 10:05:23 1999 Mumit Khan - - * collect2.c (collect_execute): Remove cygwin-specific code. - -Tue Feb 9 17:27:29 1999 Nathan Sidwell - - * system.h (_, N_): Remove dummy i18n macros. - * protoize.c: Move inclusion of intl.h to after system.h. - * cexp.y: Include intl.h. - * cexp.c: Rebuilt. - -Tue Feb 9 16:52:22 1999 Mumit Khan - - * i386/cygwin.h (SUBTARGET_OVERRIDE_OPTIONS): New macro to ignore - fpic/fPIC for windows32 targets. - * i386/xm-cygwin.h (GET_ENV_PATH_LIST): Replace '\\' in windows32 - paths with '/'. - * i386/mingw32.h (CPP_SPEC): Define. - (CPP_PREDEFINES): Add MINGW32 version id. - * i386/crtdll.h (CPP_PREDEFINES): Likewise. - - * Makefile.in (collect2$(exeext)): Delete redundant dependency and - add missing exeext to target. - - * gcc.c (convert_filename): Handle null filename argument. - -Wed Feb 10 15:46:10 1999 Michael Hayes - - * config/c4x/c4x.md (*movhf_noclobber, *movhi_noclobber): Use - m constraint instead of QT. - -1999-02-09 Brendan Kehoe - - * cpplib.c (special_symbol): Move IP to be declared in function - scope, rather than individual case statements. - -1999-02-09 Zack Weinberg - - * cppfiles.c (finclude): Handle pipes properly under old BSD - derivatives. - -1999-02-09 Melissa O'Neill - - * system.h: Provide fallback definitions for S_ISCHR, - S_ISSOCK, S_ISFIFO, O_NONBLOCK, and O_NOCTTY. - -1999-02-09 Zack Weinberg - - * cpplib.c (do_define): Allow redefining __STDC__ with -D. - -1999-02-09 Jim Blandy - - * configure.in: For PowerPC configurations, accept "401", "ec603e", - "740", and "750" as valid arguments to --with-cpu. - * configure: Rebuilt. - -Tue Feb 9 00:00:14 1999 Mark Kettenis - - * configure.in (i[34567]86-*gnu*): Set float_format to i386. - * configure: Rebuilt. - -Mon Feb 8 22:38:24 1999 Jeffrey A Law (law@cygnus.com) - - * rs6000.md: Revert "alternate use of crs if cr0 not available" - patches from 01-22-1999, 01-24-1999, 01-26-1999, and 02-08-1999. - -Mon Feb 8 21:36:44 1999 Richard Henderson - - * output.h (current_function_has_computed_jump): Rename from - current_function_addresses_labels. - * function.h (struct function): Likewise for addresses_labels member. - * rtl.h (FUNCTION_FLAGS_HAS_COMPUTED_JUMP): Likewise. - * function.c (current_function_has_computed_jump): Likewise. - Update all references. - * integrate.c (function_cannot_inline_p): - Test current_function_has_computed_jump instead of addresses_labels. - (initialize_for_inline): Likewise save. - (output_inline_function): Likewise restore. - - * expr.c (expand_expr): Don't reference addresses_labels variables. - * stmt.c (expand_computed_goto): Set has_computed_jump. - -1999-02-08 Michael Meissner - - This is being installed only to get it into the repository to help - with the revert, resubmit & review process for the massive rs6000.md - changes. - * rs6000.md (andsi3_internal1 splitter): Don't split if using the - rlwinm instruction. - (anddi3_internal1): Likewise. - (andsi3_internal{2,3}): Correct some insn lengths. - (anddi3*): Restore missing TARGET_POWERPC64, and don't emit old - mnemonics. - -Mon Feb 8 21:31:06 1999 Richard Henderson - - * loop.c (reg_single_usage): New file-scope variable ... - (scan_loop): ... moved out of here. Always initialize. - Test loop_has_call instead of reg_single_usage not zero. - Free reg_single_usage after strength reduction. - (count_loop_regs_set): Assume single_usage non-zero. - (combine_givs_used_by_other): Test reg_single_usage. - (load_mems_and_recount_loop_regs_set): Remove reg_single_usage - as a parameter. Assume non-zero. - -1999-02-08 Zack Weinberg - - * cpplib.c (special_symbol): Rewrite. Don't copy things - multiple times. Handle __STDC__ specially. T_CONST - indicates a constant /string/. Don't handle T_*_TYPE and - T_SPEC_DEFINED. Use cpp_buf_line_and_col instead of - adjust_position. Determine the file buffer only if needed. - (initialize_builtins): Handle __SIZE_TYPE__, - __PTRDIFF_TYPE__, __WCHAR_TYPE__, __USER_LABEL_PREFIX__, and - __REGISTER_PREFIX__ with T_CONST special hashtab entries. - Don't provide __OBJC__; the driver does that. Provide - __STDC_VERSION__, using T_CONST. Use T_STDC for - __STDC__. Give install the length of all symbols defined. - (eval_if_expression): Drop code to insert and remove the - "defined" special symbol. - - * cpplib.h: Remove SELF_DIR_DUMMY (no longer used). Remove - T_*_TYPE and T_SPEC_DEFINED from enum node_type; add T_STDC. - - * cpphash.c (install): Drop the `ivalue' parameter. Constify - the `value' parameter. All callers changed. - * cpphash.h (install): Change prototype to match. - (union hashval): Remove `ival' member. - * cppexp.c (cpp_lex): Handle `defined' here. - -Mon Feb 8 17:29:42 1999 Jeffrey A Law (law@cygnus.com) - - * pa.h (EXTRA_CONSTRAINT): Fix comment. - -Mon Feb 8 18:57:45 1999 Vladimir N. Makarov - - * c-typeck.c (check_init_type_bitfields): Use nonincremental - initialization of unions whose first member is a bitfield. - Remove unnecessary code for checking the declaration mode - after DECL_C_BIT_FIELD. - - * varasm.c (output_constructor): Additional comment about the - constructor of bitfield union initialization. - -Tue Feb 9 11:55:04 1999 Michael Hayes - - * config/c4x/c4x.md (*movhi_stik): New pattern. - (movhi): Allow some immediate constants to be directly - stored in memory. - -Tue Feb 9 11:34:15 1999 Michael Hayes - - * config/c4x/c4x.md (all call patterns): Add constraints "Ur". - (call, call_value): Force address into a register if not valid - for a call instruction. - (load_immed_address): Emit a USE of the SYMBOL_REF that is - forced into memory. - * config/c4x/c4x.c (c4x_print_operand): Fix 'C' and 'U' modifiers. - -Tue Feb 9 11:08:41 1999 Michael Hayes - - * config/c4x/c4x.c (call_address_operand, symbolic_address_operand): - Rename from call_operand and symbolic_operand respectively. All - callers changed. - * config/c4x/c4x.md (call_address_operand, symbolic_address_operand): - Likewise. - * config/c4x/c4x.h (call_address_operand, symbolic_address_operand): - Likewise. - (PREDICATE_CODES): Allow CONST, LABEL_REF for call_address_operand. - -Tue Feb 9 10:52:27 1999 Michael Hayes - - * config/c4x/c4x.c (c4x_legitimize_address): Don't generate a - LO_SUM address for HImode or HFmode but instead force address into - a register so that it is offsettable. - (c4x_emit_move_sequence): Handle LO_SUM immediate address. - -Tue Feb 9 10:46:42 1999 Michael Hayes - - * config/c4x/c4x.c (c4x_address_cost): Return cost of 1 for - REG+REG addressing if strength reduction enabled. - -Tue Feb 9 10:10:31 1999 Michael Hayes - - * config/c4x/t-c4x (LIBGCC2_CFLAGS): Delete. - (TARGET_LIBGCC2_CFLAGS): Define. - -1999-02-08 Nick Clifton - - * config/v850/v850.md: Replace \\n\\t with \\; - - * config/v850/v850.md: Enforce TARGET_LONG_CALLS option. - * config/v850/v850.c (construct_restore_jr, construct_save_jarl): - Enforce TARGET_LONG_CALLS option. - -Mon Feb 8 11:43:07 1999 Donn Terry - - * real.c (PUT_REAL) [XFmode]: Zero the balance of the structure. - -Mon Feb 8 11:37:24 1999 Marc Espie (espie@cvs.openbsd.org) - - * m88k/t-luna-gas: Remove bash dependency. - -Mon Feb 8 11:34:44 1999 Graham - - * collect2.c (xrealloc): Fix typo in last change. - -Mon Feb 8 09:13:38 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Feb 7 22:18:42 1999 Robert Lipe - - * tree.h (TYPE_CHECK): Make it clear to the preprocessor - that we do not want macro replacement within a character constant. - (TYPE_CHECK1): Likewise. - -Sun Feb 7 15:37:10 1999 Jason Merrill - - * tree.h (DECL_P): New macro. - -Sun Feb 7 01:15:04 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Feb 6 18:14:46 1999 Jeffrey A Law (law@cygnus.com) - - * mn10300.md (reload_insi): Do not earlyclobber the output operand. - - * README.g77, gcc.c, gcc.texi: Update email addresses. - * invoke.texi system.h: Likewise. - -Sat Feb 6 11:04:08 1999 Jim Wilson - - * unroll.c (find_splittable_givs): After express_from, call replace_rtx - to convert dest_reg to new_reg. - -Sat Feb 6 10:31:35 1999 Jeffrey A Law (law@cygnus.com) - - * reload1.c (reload_combine_note_store): Be more careful with - STRICT_LOW_PART, ZERO_EXTRACT and SIGN_EXTRACT. - (move2add_note_store): Likewise. - -Sat Feb 6 10:18:01 1999 Kaveh R. Ghazi - - * cppfiles.c (read_and_prescan): Cast the result of `xrealloc' to - U_CHAR* when assigning to one. Ensure the values of a ?: operator - have the same type. - - * cppinit.c (initialize_char_syntax): Use K&R function definition. - -Sat Feb 6 11:17:03 1999 Richard Earnshaw - - Support for ARM9 - * config/arm/arm.c (all_procs): Add arm9 and arm9tdmi. - * config/arm/arm.h ((TARGET_CPU_arm9, TARGET_CPUD_arm9tdmi): Define. - (TARGET_CPU_DEFAULT): Rework to support ARM9. - (CPP_CPU_ARCH_SPEC): Likewise. - (enum processor_type): Likewise. - * config/arm/arm.md (attr cpu): Add arm9. - - General scheduling changes - * config/arm/arm.c (MAX_INSNS_SKIPPED): Delete. - (max_insns_skipped): New variable. - (arm_override_options): If generating hard floating point code for - the FPA, emit code for version 3. - When optimizing for space, don't synthesize constants. - Reword several flags based on the requested processor and optimization - level. - (use_return_insn): New argument iscond, all callers changed. Don't - use a return insn if it will be conditional and that would be - expensive; eg on StrongARM. - (arm_adjust_cost): Anti- and output- dependencies normally have no - cost. - (load_multiple_sequence): Newer ARMs don't benefit from ldm if - the sequence is short. - (final_prescan_insn): Use max_insns_skipped instead of - MAX_INSNS_SKIPPED. Note whether we will make a return instruction - conditional, and aviod this if it would be expensive. - * config/arm/arm.md (scheduling attributes and function units): - Rewrite to better describe ARM8, 9 and StrongARM. - - * config/arm/arm.md (*movhi_insn_littleend): Make op0 predicate - s_register_operand. - (*ifcompare_plus_move): Use arm_rhs_operand in place of - arm_rhsm_operand. Rework constraints. - (*if_plus_move): Likewise. - (*ifcompare_move_plus): Likewise. - (*if_move_plus): Likewise. - (*ifcompre_arith_move): Likewise. - (*if_arith_move): Likewise. - (*ifcompare_move_arith): Likewise. - (*if_move_arith): Likewise. - - * config/arm/xm-netbsd.h: Don't include arm/xm-arm.h. - -1999-02-05 Michael Meissner - - * loop.c (check_dbra_loop): A store using an address giv for which - we have no life information is not reversible. - -Fri Feb 5 17:08:01 1999 Dave Brolley - - * function.c (fixup_var_refs): Scan catch_clauses too. - -Fri Feb 5 11:49:49 1999 Benjamin Kosnik - - * c-common.c (decl_attributes): Fix reserved space for init_priority. - * tree.h (MAX_RESERVED_INIT_PRIORITY): New macro. - -Fri Feb 5 12:37:05 1999 Jeffrey A Law (law@cygnus.com) - - * loop.c (strength_reduce): Clear not_every_iteration when - passing the NOTE_INSN_LOOP_CONT note. - - * haifa-sched.c (add_dependence): Do not add a dependency on a - note. - -Fri Feb 5 10:55:43 1999 Nick Clifton - - * recog.c (split_block_insns): Only call update_flow_info if - instruction scheduling is enabled. - -1999-02-05 Zack Weinberg - - * Makefile.in (gen-protos): Use libcpp.a like everyone else. - -Fri Feb 5 07:09:29 1999 J"orn Rennecke - - * loop.c (first_loop_store_insn): New file-scope variable. - (prescan_loop): Set it. - (check_dbra_loop): Check if a store depends on a register - that is set after the store. - -Fri Feb 5 06:55:15 1999 J"orn Rennecke - - * unroll.c (entire file): Remove tabs / spaces at end of lines. - Replace spaces with tabs where appropriate. - -Thu Feb 4 15:12:41 1999 J"orn Rennecke - - * loop.c (scan_loop): New argument loop_cont. Changed caller. - (strength_reduce): New argument loop_cont. Changed caller. - Before clearing not_every_iteration after a label, check if - we are not already past LOOP_CONT. - -1999-02-04 Zack Weinberg - - * cpperror.c (cpp_print_containing_files): Fix formatting - bug induced by merge. - -1999-02-04 Zack Weinberg - - * cpplib.c (initialize_char_syntax): Move to cppinit.c. - (cpp_define): Remove redundant syntax checks. - (make_assertion): Rename cpp_assert, remove redundant syntax - checks, export. - (cpp_options_init): Don't init things to zero twice. - (cpp_expand_to_buffer): Use memcpy, not a char-by-char loop. - (do_include): Kill excessively verbose #import warning that - snuck back in in the gcc2 merge. - (convert_string): Removed. - (do_line): Rewrite with simple last-name-used cache instead of - private hashtable. - (cpp_start_read): Call initialize_char_syntax here, not... - (cpp_reader_init): ...here. - (cpp_handle_options): Support the -std switch. - * cpplib.h (cpp_buffer): Add last_nominal_fname member. - (cpp_options): Add c9x flag. - Declare all the is_* tables and trigraph table here, as const. - Prototype cpp_assert and initialize_char_syntax. - * cppinit.c: New file. - * cppfiles.c (read_and_prescan): Optimize. - * Makefile.in (LIBCPP_OBJS): Add cppinit.o. - -Thu Feb 4 10:46:30 1999 Gavin Romig-Koch - - * config/mips/mips.md ([u]divmodsi4,[u]divmoddi4,[u]divsi3,[u]divdi3, - [u]modsi3,[u]moddi3) : Don't copy the "zero" argument to a register - before calling gen_div_trap. - -Wed Feb 3 21:56:27 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in (hppa1.1-*-*, hppa2*-*): Use symbolic value rather - than numeric value for target_cpu_default.. - * configure: Rebuilt. - -Wed Feb 3 21:55:56 1999 Marc Espie - - * Makefile.in (xgcc$(exeext)): Remove choose-temp, pexecute and - mkstemp. Get them from libiberty. - (COLLECT2_OBJS): Similarly for choose-temp, cplus-dem and mkstemp. - (PROTO_OBJS): Similarly for choose-temp, getopt, getopt1 and pexecute. - (cplus-dem.o, pexecute.o, choose-temp.o): Remove build rules. - (mkstemp.o, getopt1.o, getopt.o): Likewise. - - * pa-gas.h (TARGET_DEFAULT): Use symbolic values rather than numeric - values. - * pa-hpux.h (LINK_SPEC): Likewise. - * pa-hpux10.h (LINK_SPEC): Likewise. - * pa-hpux9.h (LINK_SPEC): Likewise. - * pa-osf.h (LINK_SPEC): Likewise. - * pa-pro.h (TARGET_DEFAULT): Likewise. - * pa1.h (TARGET_DEFAULT): Likewise. - * pa.h (MASK_*): New defines. - (TARGET_*): Use symbolic values rather than numeric values. - (TARGET_SWITCHES): Likewise. - (TARGET_DEFAULT): Likewise. - (CPP_SPEC): Likewise. - -Wed Feb 3 21:07:38 1999 Bernd Schmidt - - * reload1.c (reload_cse_regs_1): Undo Jan 16 patch. - * reload.c (find_reusable_reload): New function, broken out of - push_reload. Add code to verify that none of the involved - outputs are subject to earlyclobbers. - (push_reload): Break out new function find_reusable_reload. - Delete "register" keyword for IN, OUT args. - -Wed Feb 3 15:51:04 1999 Gavin Romig-Koch - - * config/mips/mips.c (true_reg_or_0_operand) : New function. - * config/mips/mips.h (PREDICATE_CODES): Add true_reg_or_0_operand. - * config/mips/mips.md (div_trap,div_trap_normal,div_trap_mips16): - Use true_reg_or_0_operand for div_trap. - -Wed Feb 3 20:44:59 1999 J"orn Rennecke - - * loop.h (express_from): Declare. - (struct induction): Replace derived flag with derived_from pointer. - * loop.c (strength_reduce, record_giv, recombine_givs): Likewise. - (express_from): No longer static. - * unroll.c (find_splittable_givs): Replace derived with derived_from. - When processing an address giv with which another giv has been - combined that has also been derived from a third giv, handle like - having combined with the third giv. - Set splittable_regs_updates appropriately for derived givs. - -Wed Feb 3 15:26:58 1999 Gavin Romig-Koch - - * config/mips/mips.md (div_trap_mips16): Remove nop's after branches. - -Wed Feb 3 11:56:23 1999 Jeffrey A Law (law@cygnus.com) - - * pa.c (insn_sets_and_refs_are_delayed): New function. - * pa.h (INSN_SETS_ARE_DELAYED): Use it. - (INSN_REFERENCES_ARE_DELAYED): Likewise. - -Wed Feb 3 06:24:49 1999 Richard Earnshaw (rearnsha@arm.com) - - * config/arm/t-arm-elf (LIBGCC2_CFLAGS): Delete. - * config/arm/t-linux (LIBGCC2_CFLAGS): Delete. - (TARGET_LIBGCC2_CFLAGS): Define. - (LIBGCC2_DEBUG_CFLAGS): Define. - * config/arm/t-netbsd: Likewise. - * config/arm/t-semi: Likewise. - * config/arm/t-semiaof: Likewise. - * config/arm/t-riscix: Likewise. - -Wed Feb 3 10:59:07 1999 Andreas Schwab - - * config/m68k/m68k.c (print_operand_address): When printing a - SYMBOL_REF that ends in `.' put parentheses around it. - -Tue Feb 2 23:38:35 1999 David O'Brien - - * i386/freebsd*.h now allows '$' in label names and does not use the - PCC struct return method. - -Tue Feb 2 22:38:23 1999 Jim Wilson - - * Makefile.in: Change all uses of AR to AR_FOR_TARGET. Change all uses - of HOST_AR to AR. Likewise for AR_FLAGS, RANLIB, and RANLIB_TEST. - (RANLIB_TEST): Test to see if ranlib exists. Only test absolute file - names if host == target. - (HOST_AR, HOST_AR_FLAGS, HOST_RANLIB, HOST_RANLIB_TEST): Delete. - (AR_FLAGS_FOR_TARGET): Renamed from AR_FOR_TARGET_FLAGS. - (AR, AR_FLAGS, OLDAR, OLDAR_FLAGS, RANLIB, RANLIB_TEST): Delete rules - setting them to *_FOR_TARGET. - * cross-make (AR, AR_FLAGS, OLDAR, OLDAR_FLAGS, RANLIB, RANLIB_TEST): - Delete. - -Tue Feb 2 22:38:19 1999 Theodore Papadopoulo - - * toplev.h (read_integral_parameter): Declare. - * toplev.c (read_integral_parameter): New function. - -Fri Jan 29 21:00:56 1999 Bob Manson - - * resource.c, resource.h: New files. - * Makefile.in (OBJS): Add it. - - * haifa-sched.c (regno_use_in): Moved to rtlanal.c. - (split_block_insns): Moved to recog.c. - (update_flow_info): Make public. - * rtl.h: Declare them. - - * reorg.c: Moved the functions dealing with computing resource - usage to resource.c. - - * sched.c (regno_use_in): Moved to rtlanal.c. - (update_flow_info): Make public. - (schedule_insns): Use split_block_insns. - - * recog.c (split_block_insns): New function. - -Tue Feb 2 22:03:26 1999 David Edelsohn - - * rs6000/linux.h (LINK_START_DEFAULT_SPEC): Delete, unused. - (LINK_OS_DEFAULT_SPEC): Delete, unused. - -Tue Feb 2 20:29:34 1999 Catherine Moore - - * configure.in (arm-*-oabi): Support. - * configure: Regenerate. - * config/arm/unknown-elf-oabi.h: New file. - -Tue Feb 2 19:43:59 1999 Jeffrey A Law (law@cygnus.com) - - * i386.md (ashlsi3): Turn into a define_expand an anonymous pattern. - Make the anonymous pattern match when ! optimize_size. - (ashlsi3 size optimizer): New pattern. - - * intl/Makefile.in (uninstall): Add missing "; \". - -Tue Feb 2 18:21:23 1999 Stan Cox - - * sparc.h (TARGET_CPU_sparc86x): Added. TARGET_CPU_sparclite86x - synonym. - -Tue Feb 2 20:24:11 1999 J"orn Rennecke - - * loop.c (loop_optimize): Fix value max_uid_for_loop is reset - to after find_and_verify_loops call. - -Tue Feb 2 19:48:29 1999 J"orn Rennecke - - * (recombine_givs): Don't use a giv that's likely to be dead to - derive others. - - * loop.c (recombine_givs): Fix test for lifetime overlaps / loop - wrap around when deriving givs. - -Mon Feb 1 20:00:40 1999 Richard Henderson - - * recog.c (check_asm_operands): Treat indeterminate operand ok - results as success. Try harder to resolve a matching constraint. - * stmt.c (expand_asm_operands): Recognize when an output operand's - constraint does not allow memory. Treat indeterminate operand ok - results as failure. Try harder to resolve a matching constraint. - -Mon Feb 1 15:00:02 1999 Ken Raeburn - - Use varrays for constant-equivalence data: - - * varray.h (struct const_equiv_data): New type. - (union varray_data_tag): New element const_equiv. - (VARRAY_CONST_EQUIV_INIT, VARRAY_CONST_EQUIV): New macros. - (VARRAY_SIZE): New macro, returns number of elements. - * integrate.h: Include varray.h. - (struct inline_remap): Replace const_equiv_map, const_age_map and - const_equiv_map_size with a const_equiv_varray element. - (MAYBE_EXTEND_CONST_EQUIV_VARRAY): New macro; grows varray if - needed. - (SET_CONST_EQUIV_DATA): New macro; sets rtx and age fields - simultaneously, growing the varray if needed. - - * integrate.c (global_const_equiv_map, - global_const_equiv_map_size): Deleted, replaced by.... - (global_const_equiv_varray): New variable. - (expand_inline_function): References changed. - * integrate.h: Update declarations. - - * integrate.c (process_reg_parm, expand_inline_function, - copy_rtx_and_substitute, try_constants, subst_constants, - mark_stores): Use varray allocation and accessor macros, new - integrate.h macros, and global_const_equiv_varray. Don't - conditionalize non-NULL stores on array size; instead, expand the - array as needed. - * unroll.c (unroll_loop): Likewise. - - * unroll.c (unroll_loop): Initialize const_equiv_varray element to - zero. After allocating varray, always exit through bottom of - function, where it can be deallocated if needed. Don't explicitly - reallocate const_equiv_map storage; instead, just ensure the - varray has been initialized, and update the global reference. - -Mon Feb 1 09:40:25 1999 Kaveh R. Ghazi - - * system.h (inline, const): Handle these for stage2 (and later) gcc. - - * dwarf2out.c (inline): Don't define. - - * dwarfout.c (inline): Likewise. - -Sun Jan 31 22:04:37 1999 Richard Henderson - - * loop.c (recombine_givs): Dump recombination and derivation data. - -Sun Jan 31 20:34:29 1999 Zack Weinberg - - * flags.h: Declare flag_no_ident. - * toplev.c: Define flag_no_ident. Process -f(no-)ident here. - * c-tree.h: Don't declare flag_no_ident. - * c-decl.c: Don't define flag_no_ident. Don't process - -f(no-)ident switches here. - - * config/elfos.h (ASM_FILE_END): Output final .ident directive - only if !flag_no_ident. - * config/ptx4.h: Likewise. - * config/svr4.h: Likewise. - * config/alpha/elf.h: Likewise. - * config/arm/linux-elf.h: Likewise. - * config/i386/sco5.h: Likewise. - * config/i860/fx2800.h: Likewise. - * config/mips/gnu.h: Likewise. - * config/i386/osfrose.h: Likewise. - - * gcc.c (C specs): Map -Qn to -fno-ident. - * objc/lang-specs.h: Likewise. - -Mon Feb 1 10:52:07 1999 Michael Hayes - - * configure.in: Don't remove loop.o and unroll.o when - enable-haifa is selected. - * configure: Rebuilt. - -Sun Jan 31 13:22:02 1999 John Wehle (john@feith.com) - - * i386.md (movsicc, movhicc, movsfcc, movdfcc, - movxfcc, movdicc): Delete unconstrained alternatives. - * i386.c (output_fp_conditional_move, - output_int_conditional_move): Delete unused case. - -Sun Jan 31 01:15:04 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Jan 31 00:52:37 1999 Richard Henderson - - * alpha.md (mov patterns): Emit the assembler aliases mov and fmov - instead of bis and cpys. Combine alternatives where possible. - -Sat Jan 30 23:14:13 1999 Kaveh R. Ghazi - - * gcov.c (fnotice): Add missing FILE* parameter. - (function_summary): Fix format specifiers in calls to `fnotice'. - (output_data): Likewise. - - * toplev.c (fnotice): Constify char* parameter. - - * toplev.h (fnotice): Add prototype. - Wrap prototype with BUFSIZ to protect FILE* usage. - -Sun Jan 31 15:33:09 1999 Michael Hayes - - * config/c4x/c4x.h (RTX_COSTS): Explicitly define c4x costs. - -Sat Jan 30 08:27:23 1999 Jeffrey A Law (law@cygnus.com) - - * combine.c (distribute_notes): Handle REG_EH_REGION notes. - - * alias.c (fixed_scalar_and_varying_struct_p): Add "static" to - function definition. - (aliases_everything_p, write_dependence_p):Likewise. - - * install.texi: Fix merge lossages. - - * cccp.c (main): Only call setlocale (LC_MESSAGES, ...) if LC_MESSAGES - is defined. - * collect2.c (main): Likewise. - * cppmain.c (main): Likewise. - * gcc.c (main): Likewise. - * gcov.c (main): Likewise. - * protoize.c (main): Likewise. - * toplev.c (main): Likewise. - - * pa.md (parallel shift and shiftadd): Mark output of shift as an - earlyclobber. - - * loop.c: Disable recent loop changes. Temporary as Joern - continues to fix problems. - -Sat Jan 30 03:24:37 1999 J"orn Rennecke - - * loop.c (strength_reduce): Size reg_map according to reg_iv_type. - -Fri Jan 29 18:26:07 1999 Dave Brolley - - * emit-rtl.c (remove_insn): New function. - * rtl.h (remove_insn): Add prototype. - * function.c (reposition_prologue_and_epilogue_notes): Call remove_insn. - -Fri Jan 29 22:34:41 1999 J"orn Rennecke - - * loop.c (recombine_givs): Don't try to derive givs that have combined. - -Fri Jan 29 15:00:39 1999 Kaveh R. Ghazi - - * toplev.c (notice, fnotice): Check ANSI_PROTOTYPES, not __STDC__, - when declaring arguments and calling va_arg() to initialize them. - - * collect2.c (notice): Likewise. - - * loop.c (find_life_end): Use PROTO() macro in the prototype. - -Fri Jan 29 14:36:11 1999 Kaveh R. Ghazi - - * collect2.c (error): Fix typo in declaration. - - * cpperror.c (cpp_message): Likewise. - - * cpplib.c (cpp_warning): Likewise. - - * cpplib.h (cpp_notice): Use PVPROTO not VPROTO, also add - ATTRIBUTE_PRINTF_1. - - * toplev.c (error): Fix typo in declaration. - -Fri Jan 29 15:44:13 1999 J"orn Rennecke - - * loop.c (strength_reduce): Fix HAVE_cc0 handling when scanning - forward from cont dominator. - -Fri Jan 29 07:10:27 1999 Kaveh R. Ghazi - - * cccp.c (eprint_string): Constify a char*. - (notice): Likewise. Use PVPROTO not VPROTO, add ATTRIBUTE_PRINTF_1. - (vnotice): Constify a char*. - (error): Likewise. Use PVPROTO not VPROTO, add ATTRIBUTE_PRINTF_1. - (verror): Constify a char*. - (warning): Likewise. Use PVPROTO not VPROTO, add ATTRIBUTE_PRINTF_1. - (vwarning): Constify a char*. - (error_with_line): Likewise. Use PVPROTO not VPROTO, add - ATTRIBUTE_PRINTF_2. - (verror_with_line): Constify a char*. - (vwarning_with_line): Likewise. - (warning_with_line): Likewise. Use PVPROTO not VPROTO, add - ATTRIBUTE_PRINTF_2. - (pedwarn): Constify a char*. Use PVPROTO not VPROTO, add - ATTRIBUTE_PRINTF_1. - (pedwarn_with_line): Likewise with ATTRIBUTE_PRINTF_2. - (pedwarn_with_file_and_line): Likewise with ATTRIBUTE_PRINTF_4. - Also correct typo in parameter name declaration. - (make_assertion): Constify a char*. - (quote_string_for_make): Likewise. - (deps_output): Likewise. - (fatal): Likewise. Use PVPROTO not VPROTO, add - ATTRIBUTE_PRINTF_1. Use ATTRIBUTE_NORETURN not an explicit - "__attribute__ ((noreturn))". - (fancy_abort): Likewise for ATTRIBUTE_NORETURN. - (pfatal_with_name): Likewise. - (pipe_closed): Likewise. - (memory_full): Likewise. - -Fri Jan 29 00:14:55 1999 J"orn Rennecke - - * loop.c (strength_reduce): Grow set_in_loop / n_times_set / - may_not_optimize to proper size when converting biv increments - into givs. - If necessary, reallocate reg_iv_type / reg_iv_info before calling - recombine_givs. - -Thu Jan 28 23:24:08 1999 J"orn Rennecke - - * loop.c (recombine_givs): New parameter unroll_p. If set, don't - generate complex adds. Changed caller. - Don't generate adds that cost more than the original one. - (strength_reduce): Warning fixes. - -Thu Jan 28 09:41:11 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in (hppa1.0-hp-hpux10*): Use t-pa. - * configure: Rebuilt. - -Wed Jan 27 23:39:53 1999 J"orn Rennecke - - * rtl.h (insn_first_p, no_jumps_between_p): Declare. - * rtlanal.c (insn_first_p, no_jumps_between_p): New function. - * loop.h (varray.h): Include. - (struct induction): Change combined_with to unsigned. - New members derived, ix and last_use. - (reg_iv_type, reg_iv_info): Now varray_type. All references changed. - (REG_IV_TYPE, REG_IV_INFO): Define. - (first_increment_giv, last_increment_giv): Declare. - * loop.c (loop_number_loop_cont): New static variable. - (loop_number_cont_dominator): Likewise. - (reg_iv_type, reg_iv_info): Now varray_type. - (first_increment_giv, last_increment_giv): New variables. - (compute_luids, verify_dominator, find_life_end): New functions. - (cmp_recombine_givs_stats, recombine_givs): Likewise. - (loop_optimize): Allocate loop_number_loop_cont and - loop_number_cont_dominator. Use compute_luids. - (find_and_verify_loops): Initialize loop_number_loop_cont and - loop_number_cont_dominator. - (strength_reduce): Try to find bivs that can be expressed as givs - of another biv, and to convert biv increments into givs. - Call recombine_givs. Handle derived givs. - (record_biv): New argument location. All callers changed. - (record_giv): Initialize derived and last_use fields. - (basic_induction_var): New argument location. All callers changed. - (combine_givs): Don't combine a DEST_REG giv with a DEST_ADDR giv. - Increment combined_with instead of setting to 1. - * unroll.c (derived_regs): New static variable. - (unroll_loop): Initialize it. - Allocate local_regno according to max_reg_num. - (copy_loop_body): Cope with derived givs. - (find_splittable_givs): Check for Givs made from biv increments. - Set derived_regs for givs. - * Makefile.in (stmt.o, loop.o, unroll.o): Depend on loop.h . - -Wed Jan 27 19:31:36 1999 J"orn Rennecke - - * function.c (purge_addressof_1): Handle case when a register - has been used in a wider mode. - -1999-01-27 Bruce Korb - - * fixinc/fixincl.c, fixinc/server.[ch]: - Removed the last of the capitalized variable and proc names. - - * fixinc/server.c: Removed the process open code. - * fixinc/procopen.c: New file containing the proc open code. - * fixinc/inclhack.tpl: Added code to bypass a readability test - when a file is not present. A problem on some systems. - * fixinc/inclhack.sh, fixinc/fixincl.sh: Regenerated. - -Wed Jan 27 11:58:18 1999 Dave Brolley - - * cpplib.h (cpp_notice): Add prototype. - -Wed Jan 27 02:20:48 1999 Jeffrey A Law (law@cygnus.com) - - * Merge gcc2 snapshot 19980929. - - * cccp.c (PRINTF_PROTO): Remove. - (PRINTF_PROTO_{1,2,3,4}: Likewise. - * cexp.y: Likewise. - * system.h: Add PRINTF_PROTO and PRINTF_PROTO_{1,2,3,4}. - - * fix-header.c (cpp_file_lin_for_message): Delete. In libcpp. - (cpp_print_containing_files, v_cpp_message, cpp_message): Likewise. - (cpp_fatal, cpp-Pfatal_with_name): Likewise. - - * gen-protos.c (hashf): Delete in cpphash.o. - * gen-protos.c (hashf): Delete in cpphash.o. - - * expr.c: Do not merge SAVE_STACKAREA_MODE changes. - * expmed.c: Likewise. - * rs6000.md: Likewise. - - * rs6000.c, rs6000.md: Do not merge formatting changes yet. - -Wed Jan 27 01:13:42 1999 Richard Henderson - - * rs6000.c (input_operand): Don't expect CONST around CONSTANT_P_RTX. - * rs6000.md (movsi, movdi): Likewise. - -Tue Jan 26 13:31:38 1999 Jim Wilson - - * function.c (expand_function_end): Pass arg_pointer_save_area to - validize_mem before using it. Emit code into a sequence. - -Tue Jan 26 13:41:38 1999 David Edelsohn - - * rs6000.md (doz + set cr and or + set cr patterns): Add missing - '#' to split patterns. Correct indentation of some new patterns. - -1999-01-26 Zack Weinberg - - * cppfiles.c (safe_read): Deleted. - (read_and_prescan): New function, replaces safe_read, converts - and/or warns about trigraphs, silently converts odd line - terminators (\r, \n\r, \r\n). Warns about no newline at EOF. - (finclude): Use read_and_prescan; turn off nonblocking mode on - the input descriptor; remove file-size-examination and - no-newline-at-EOF gunk which is longer necessary; be more - careful about checking that we've been handed a legitimate - file to read (only real files, pipes, and ttys are acceptable). - * cpplib.h (cpp_options): Rename no_trigraphs flag to - `trigraphs' and invert its sense. - (trigraph_table): Declare. - (cpp_warning_with_line): Prototype. - * cpplib.c: Remove all references to trigraph_pcp. Define - trigraph_table; initialize it in initialize_char_syntax. Open - files in nonblocking mode. s/no_trigraphs/trigraphs/ - throughout, and invert sense. Put cpp_warning_with_line back - in and export it. - -Tue Jan 26 23:21:49 1999 Michael Hayes - - * config/c4x/c4x.h (COUNTER_REGS): New register class. - * config/c4x/c4x.md (*rptb_init): Change constraints. - (rptb_end): Emit alternate looping instructions if - RC register not allocated for loop counter. - (decrement_and_branch_on_count): Allow other registers - for loop counter. - -1999-01-25 Zack Weinberg - - * cppexp.c (struct arglist): Removed. - (parse_number): Use HOST_WIDE_INT for the accumulator. - Allow two `l' suffixes unless C89. Clean up. Make static. - (parse_charconst): New function broken out of cpp_lex. - Code cleaned up drastically. Don't use a token_buffer. - (token_buffer): Removed. - (cpp_lex): Don't call parse_number on a constant string. - Use parse_charconst. - (cpp_parse_expr): Properly handle an ERROR op returned by - cpp_lex. - -1999-01-25 Zack Weinberg - - * cpplib.c: Don't include signal.h, sys/times.h, or - sys/resource.h. Don't declare localtime. - (macroexpand): Handle special symbols here. - (push_macro_expansion): Chop off the trailing '@ ' if possible - here. - (cpp_get_token): Don't do either of the above two things here. - Move `string' label just after case '"' so that wide strings - don't crash the preprocessor. - -Sun Jan 24 20:13:45 1999 David Edelsohn - - * rs6000.md (left shift + set cr patterns): Add missing '#' to - split patterns. - (move register + set cr pattern): Likewise. - (movdi, !TARGET_POWERPC64 splitters): Add back in Jan. 15th patch, - inadvertently deleted. - -Sun Jan 24 08:07:59 1999 Jeffrey A Law (law@cygnus.com) - - * stmt.c (stmt_loop_nest_empty): New function. - * tree.h (stmt_loop_nest_empty): Declare it. - * rtl.def (CALL_PLACEHOLDER): New rtx code. - -Sun Jan 24 21:24:43 1999 Michael Hayes - - * config/c4x/c4x.c (c4x_emit_move_sequence, c4x_encode_section_info): - New functions. - (c4x_check_legit_addr): Remove USE and PLUS, allow - LO_SUM, and disable SYMBOL_REF, LABEL_REF, and CONST cases. - (c4x_legitimize_address): Penalize SYMBOL_REF, LABEL_REF, and - CONST cases. Add LO_SUM. - (c4x_print_operand): Modified 'C' and 'R' cases for calls. - Added 'U' case. Remove dependence on SYMBOL_REF_FLAG. - (c4x_print_operand_address): Handle LO_SUM. - (c4x_scan_for_ldp): Delete. Hooray! - (c4x_process_after_reload): Remove call to c4x_scan_for_ldp. - Split all insns. - (c4x_immed_int_constant): Renamed from c4x_int_constant. All callers - changed. - (c4x_immed_float_constant): Renamed from c4x_float_constant. All - callers changed. - (c4x_T_constraint): Allow LO_SUM, disable SYMBOL_REF, LABEL_REF, - and CONST. - (c4x_U_constraint, symbolic_operand): New functions. - (src_operand): Allow 'I' constants in HImode. Allow LO_SUM, - disable SYMBOL_REF, LABEL_REF, and CONST. - (lsrc_operand, tsrc_operand): Call src_operand instead of - general_operand. - (c4x_operand_subword): Update comments. - - * config/c4x/c4x.c (TARGET_LOAD_ADDRESS): New macro. - (LEGITIMATE_CONSTANT_P): Allow SYMBOL_REF, LABEL_REF, CONST, - plus HIGH and LO_SUM for the C40. - (ENCODE_SECTION_INFO): Define macro. - (symbolic_operand, c4x_U_constraint, c4x_emit_move_sequence): New - prototypes. - (PREDICATE_CODES): Add symbolic_operand. - - * config/c4x/c4x.md (movqi, movgqf, movhi, movhi): Call - c4x_emit_move_sequence. - (floatunsqiqf2, fixuns_truncqfqi2): Rework emitted RTL - to avoid symbol references. - (all patterns with g constraint): Replace 'g' constraint with 'rIm'. - (set_high): Renamed from set_high_use. - (set_lo_sum): Renamed from set_ior_lo_use. - (all call patterns): Make MEM explicit in call address operands. - Modified output templates to use 'U' modifier. - -Sun Jan 24 01:15:05 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Jan 23 22:34:57 1999 Kaveh R. Ghazi - - * final.c (bb_str): Qualify a char* with the keyword `const'. - (add_bb_string, final_scan_insn, output_asm_insn): Likewise. - - * fix-header.c (read_scan_file): Likewise. - - * genoutput.c (output_epilogue, process_template): Likewise. - - * local-alloc.c (requires_inout, block_alloc): Likewise. - - * output.h (output_asm_insn, assemble_string): Likewise. - - * recog.c (recog_constraints, check_asm_operands, - decode_asm_operands, extract_insn, preprocess_constraints, - constrain_operands): Likewise. - - * recog.h (operand_alternative, recog_constraints, insn_template, - insn_outfun, insn_operand_constraint, insn_name): Likewise. - - * regclass.c (record_reg_classes, scan_one_insn): Likewise. - - * regmove.c (find_matches): Likewise. - - * reload.c (alternative_allows_memconst): Likewise. - - * reload1.c (constraint_accepts_reg_p, - reload_cse_simplify_operands): Likewise. - - * rtl.h (decode_asm_operands): Likewise. - - * scan.h (fn_decl): Likewise. - - * varasm.c (assemble_string): Likewise. - -Sat Jan 23 01:37:36 1999 Jeffrey A Law (law@cygnus.com) - - * configure.in (gcc_tooldir): Handle case where exec_prefix has - not been explicitly set. - * configure: Rebuilt. - - * fold-const.c (lshift_double): Mark 'prec' arguments as possibly - unused. - - * bitmap.h (bitmap_head_def): Make indx field unsigned. - - * configure.in (gcc_tooldir): When not making a relative gcc_tooldir, - use $exec_prefix/$target_alias for gcc_tooldir. - * configure: Rebuilt. - -Fri Jan 22 11:48:56 1999 Richard Henderson - - * cppp.c (xrealloc): Fix typo last change. - * cppalloc.c, gcc.c, genattr.c, genattrtab.c, gencodes.c: Likewise. - * genconfig.c, genemit.c, genextract.c, genflags.c: Likewise. - * genopinit.c, genoutput.c, genpeep.c, genrecog.c: Likewise. - -1999-01-22 Michael Meissner - - * rs6000.h (CR0_REGNO_P): New macro to test if cr0. - (CR_REGNO_NOT_CR0_P): New macro to test if cr, but not cr0. - (PREDICATE_CODES): Add cc_reg_not_cr0_operand. - (cc_reg_not_cr0_operand): Add declaration. - - * rs6000.c (cc_reg_not_cr0_operand): Return true if register is a - pseudo register, or a control register that is not CR0. - - * rs6000.md (all combiner patterns building . instructions): For - all `.' instructions that do something and set cr0, add an - alternative that does the operation, and then sets a different - flag, in order to avoid using the costly mcrf instruction and also - allow cr0 to be clobbered in asm statements. Also fix a few - patterns that used the wrong register. - - * rs6000.h (rs6000_cpu_select): Make string, names be const char *. - (rs6000_debug_name): Make const char *, not char *. - - * sysv4.h (rs6000_{abi,sdata}_name): Make const char *. - - * rs6000.c (rs6000_{debug,abi,sdata}_name): Make const char *. - (rs6000_select): Use const char * in casts. - -Fri Jan 22 07:43:01 1999 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (gcc_tooldir): Move before first reference. - Let autoconf substitute in a value. - * configure.in (gcc_tooldir): Only use a relative path to the - tool directory if $exec_prefix == $prefix. - * configure: Rebuilt. - - * Makefile.in (tooldir): Replace with gcc_tooldir. - -Thu Jan 21 23:21:57 1999 Jeffrey A Law (law@cygnus.com) - - * m68k.md (ashldi_const): Disable for !TARGET_5200. Fix indentation. - (ashldi3 expander): Similarly. Update comments. - (ashrdi_const, lshrdi_const): Fix indentation. - (ashrdi3, lshrdi3): Fix indentation. Update comments. - -Thu Jan 21 21:53:36 1999 Richard Henderson - - * emit-rtl.c (try_split): Don't try to split non-instructions. - -Thu Jan 21 23:47:30 1999 Andrew MacLeod - - * expr.c (emit_push_insn): Fix dumb typo. - -Thu Jan 21 20:24:02 1999 Richard Henderson - - * rs6000.h (LEGITIMIZE_RELOAD_ADDRESS): Recognize and accept - transformations that we have performed earlier. - * alpha.h (LEGITIMIZE_RELOAD_ADDRESS): Likewise. - - * alpha.md (prologue_stack_probe_loop): Don't do our own label - handling, call gen_label_rtx instead. - -Thu Jan 21 17:45:18 1999 Richard Henderson - - * configure.in ({rs6000|powerpc}-ibm-aix4.[12]*): Add missing `then'. - - * cccp.c (xrealloc): Call malloc given a NULL old pointer. - * collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise. - * gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise. - * genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise. - * genrecog.c, mips-tfile.c, protoize.c: Likewise. - -Thu Jan 21 19:44:55 1999 Michael Meissner - - * configure.in ({rs6000|powerpc}-ibm-aix4.[12]*): If - --with-gnu-ld, use x-aix41-gld instead of x-aix41 to suppress - adding -Wl,-bbigtoc to BOOT_LDFLAGS. - * configure: Regenerate. - - * config/rs6000/x-aix41-gld: New file, don't set BOOT_LDFLAGS. - -Thu Jan 21 15:48:03 1999 Dave Brolley - - * cppexp.c (cpp_lex): Allocate token_buffer dynamically. - -Thu Jan 21 14:18:04 1999 Andrew MacLeod - - * expr.c (MOVE_BY_PIECES_P): Define condition for deciding to use - move_by_pieces. - (MOVE_MAX_PIECES): Define maximum number of bytes to move at once. - (USE_LOAD_POST_INCREMENT, USE_LOAD_PRE_DECREMENT): Define defaults. - (USE_STORE_POST_INCREMENT, USE_STORE_PRE_DECREMENT): Define defaults. - (move_by_pieces): Use new macros. - (emit_block_move): Use new macros. - (clear_by_pieces): Use new macros. - (clear_storage): Use new macros. - (emit_push_insn): Use new macros. - (expand_expr): Use new macros. - * config/sh/sh.h (USE_LOAD_POST_INCREMENT, USE_LOAD_PRE_DECREMENT): - Define. - (USE_STORE_POST_INCREMENT, USE_STORE_PRE_DECREMENT): Define. - (MOVE_BY_PIECES_P): Define based on alignment and TARGET_SMALLCODE. - (MOVE_MAX_PIECES): Move 8 bytes on SH4. - * tm.texi(MOVE_BY_PIECES_P, MOVE_MAX_PIECES, USE_LOAD_POST_INCREMENT, - USE_LOAD_PRE_DECREMENT, USE_STORE_POST_INCREMENT, - USE_STORE_PRE_DECREMENT): Describe new macros. - -Thu Jan 21 14:13:31 1999 Vladimir N. Makarov - - * varasm.c (output_constant_pool): Use floor_log2 instead of - exact_log2 for ASM_OUTPUT_ALIGN. - - * stor-layout.c (layout_type): Do machine-dependent extra alignment. - - * emit-rtl.c (operand_subword): Handle case when a subword outside - the operand. - - * tm.texi (ROUND_TYPE_{SIZE,ALIGN}): More accurate descriptions of - the macros. - -Thu Jan 21 01:59:30 1999 Richard Henderson - - * cse.c (fold_rtx): Revert 29 Dec change. - (cse_insn): Revert 12 Jan change. - * expr.c (expand_builtin): Don't emit CONST around CONSTANT_P_RTX. - * regclass.c (reg_scan_mark_refs): Revert 29 Dec change. - * rtl.def: Likewise. - * rtl.h (CONSTANT_P): Likewise. - - * expr.c (emit_move_insn): Never try to flush CONSTANT_P_RTX - to memory. - * recog.c (immediate_operand): Accept CONSTANT_P_RTX. - * alpha.c (input_operand): Likewise. - * c4x.c (const_operand): Likewise. - - * explow.c (allocate_dynamic_stack_space): Use register_operand - instead of arith_operand, which does not exist. - - * 1750a.h: Fix comment closure. - * a29k.c (a29k_set_memflags): Fix typo in 19 Jan change. - * arc.md (one_cmplsi2_set_cc_insn): Fix set mode mismatch. - * arm.h (TARGET_SWITCHES): Fix typo. - * i370.md (anon mult and div patterns): Fix set mode mismatch. - * i860.c (output_delayed_branch): Fix operands to constrain_operands. - (output_delay_insn): Likewise. - * m88k.md (anon rotate insns): Fix set mode mismatch. - (anon BLKmode moves): Commonize and fix set mode mismatches. - * ns32k.md (udivmoddi[shq]i4_internal): Fix mode mismatch. - * romp.md (movdf): Fix typo. - -Thu Jan 21 00:29:35 1999 Nathan Sidwell - - * Makefile.in (install-common): Remove extraneous chmod for gcov - install. - -Wed Jan 20 18:15:08 1999 Dave Brolley - - * function.c (assign_parms): Save and restore setting of - TREE_USED (parm). - -Wed Jan 20 12:51:42 1999 Mark Mitchell - - * arm.md: Use MEM_COPY_ATTRIBUTES where appropriate throughout. - Pass MEM_SCALAR_P to arm_gen_store_multiple where appropriate. - -Tue Jan 19 21:20:52 1999 Richard Henderson - - * recog.c (pop_operand): New function. - * recog.h (pop_operand): Declare it. - * genrecog.c (preds): Define it. - - * expr.c (do_jump_for_compare): Handle conditional branch expanders - emitting multiple jump instructions. - * jump.c (condjump_label): New function. - * rtl.h (condjump_label): Declare it. - -Tue Jan 19 21:08:20 1999 Richard Henderson - - * expr.c (emit_move_insn_1): Revert 17 Dec change. Don't emit - clobber during or after reload. - -Tue Jan 19 16:56:03 1999 Richard Henderson - - * genoutput.c (name_for_index): New function. - (scan_operands, validate_insn_alternatives): Use it. - * genrecog.c (insn_name_ptr_size): New variable. - (make_insn_sequence): Fill in insn_name_ptr. - (merge_trees): Use it. - -Tue Jan 19 16:37:36 1999 Richard Henderson - - * i386/isc.h (TARGET_DEFAULT): Define symbolicly. - * i386/isccoff.h, i386/next.h, i386/sco.h, i386/sco5.h: Likewise. - * i386/scodbx.h, i386/sequent.h, i386.unix.h: Likewise. - -Tue Jan 19 15:00:10 1999 Jeffrey A Law (law@cygnus.com) - - * loop.c (NUM_STORES): Delete. - (loop_store_mems): Turn into an EXPR_LIST of MEMs. - (prescan_loop): Properly initialize loop_mems_idx. - (note_addr_stored): Simplify using list structure instead of - fixed sized array. - (invariant_p, check_dbra_loop, load_mems): Similarly. - - * flow.c (invalidate_from_autoinc): New function. - (mark_set_1, mark_used_regs): Use it. - - * Makefile.in (protoize.o, unprotoize.o): Depend on Makefile. - -1999-01-19 Vladimir N. Makarov - - * invoke.texi (-mlong-double-64): New option description. - -1999-01-19 Jim Wilson - - * libgcc2.c: Change all uses of LONG_DOUBLE_TYPE_SIZE to - LIBGCC2_LONG_DOUBLE_TYPE_SIZE. - (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): New. Set to LONG_DOUBLE_TYPE_SIZE - if not defined. - * i960/i960.h (MULTILIB_DEFAULTS): Define to mnumerics. - (CPP_SPECS): Add -mlong-double-64 support. - (TARGET_FLAG_LONG_DOUBLE_64, TARGET_LONG_DOUBLE_64): New. - (TARGET_SWITCHES): Add -mlong-double-64 support. - (LONG_DOUBLE_TYPE_SIZE): Likewise. - (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Define. - * i960/vx960-coff.h (MULTILIB_DEFAULTS): Define to msoft-float. - (CPP_SPECS): Add -mlong-double-64 support. - * i960/t-960bare (MULTILIB_OPTIONS): Add mlong-double-64. - (MULTILIB_DIRNAMES): Add ld64. - * i960/t-vxworks960 (MULTILIB_OPTIONS, MULTILIB_DIRNAMES): Likewise. - -Tue Jan 19 11:54:04 1999 Jason Merrill - - * calls.c (expand_call): Strip a TARGET_EXPR if we're passing by - invisible reference. - -Tue Jan 19 14:51:36 1999 David Edelsohn - - * rs6000.c (offsettable_addr_operand): Delete. - (offsettable_mem_operand): New function. - * rs6000.h (PREDICATE_CODES): Reflect function change. - (RS6000_SAVE_TOC): Represent address as MEM. - * win-nt.h (RS6000_SAVE_TOC): Same. - * rs6000.md (indirect calls): Change offsettable address parameter - to offsettable memory parameter. - -Tue Jan 19 10:24:53 1999 Mark Mitchell - - * rtl.h (rtx_def): Update documentation. - (MEM_IN_STRUCT_P): Likewise. - (MEM_SCALAR_P): New macro. - (MEM_COPY_ATTRIBUTES): Likewise. - (MEM_SET_IN_STRUCT_P): Likewise. - * rtl.texi (MEM_SCALAR_P): Document. - * alias.c (canon_rtx): Use MEM_COPY_ATTRIBUTES. - (fixed_scalar_and_varying_struct_p): New function. Use - MEM_SCALAR_P rather than !MEM_IN_STRUCT_P. - (aliases_everything_p): Likewise. - (true_dependence): Use them. - (write_dependence_p): New function, containing code common to - anti_dependence and output_dependence. - (anti_dependence): Use it. - (output_dependence): Likewise. - * calls.c (save_fixed_argument_area): Don't clear - MEM_IN_STRUCT_P. - (expand_call): Use MEM_SET_IN_STRUCT_P. - (emit_library_call): Don't clear MEM_IN_STRUCT_P. - (emit_library_call_value): Likewise. - (store_one_arg): Use MEM_SET_IN_STRUCT_P. - * combine.c (simplify_rtx): Use MEM_COPY_ATTRIBUTES. - (make_extraction): Likewise. - (simplify_shift_const): Likewise. - (gen_lowpart_for_combine): Likewise. - * cse.c (gen_lowpart_if_possible): Use MEM_COPY_ATTRIBUTES. - * emit-rtl.c (operand_subword): Likewise. - (change_address): Likewise. - * explow.c (stabilize): Use MEM_COPY_ATTRIBUTES. - * expr.c (protect_from_queue): Use MEM_COPY_ATTRIBUTES. - (emit_group_store): Use MEM_SET_IN_STRUCT_P. - (copy_blkmode_from_reg): Likewise. - (store_field): Likewise. - (expand_expr): Remove bogus guesswork setting MEM_IN_STRUCT_P - heuristically. Use MEM_SET_IN_STRUCT_P. - (get_memory_rtx): Likewise. - * final.c (alter_subreg): Use MEM_COPY_ATTRIBUTES. - * function.c (assign_stack_temp): Clear MEM_SCALAR_P and - MEM_ALIAS_SET on newly returned MEMs. - (assign_temp): Use MEM_SET_IN_STRUCT_P. - (put_reg_into_stack): Likewise. - (fixup_var_refs1): Use MEM_COPY_ATTRIBUTES. - (gen_mem_addressof): Use MEM_SET_IN_STRUCT_P. - (assign_parms): Likewise. - (expand_function): Likewise. - * integrate.c (expand_inline_function): Likewise. - (copy_rtx_and_substitute): Use MEM_COPY_ATTRIBUTES. - * loop.c (note_addr_stored): Remove check on MEM_IN_STRUCT_P. - * optabs.c (gen_move_insn): Use MEM_COPY_ATTRIBUTES. - * print-rtl.c (print_rtx): Print /f for frame_related. - * recog.c (validate_replace_rtx_1): Use MEM_COPY_ATTRIBUTES. - * reload1.c (reload): Copy MEM_SCALAR_P as well. - * stmt.c (expand_decl): Use MEM_SET_IN_STRUCT_P. - (expand_anon_union_decl): Use MEM_COPY_ATTRIBUTES. - * varasm.c (make_decl_rtl): Use MEM_SET_IN_STRUCT_P. - (output_constant_def): Likewise. - * a29k.c (a29k_set_memflags_1): Take scalar_p. - Set MEM_SCALAR_P. - (a29k_set_memflags): Use it. - * alpha.c (get_aligned_mem): Use MEM_COPY_ATTRIBUTES. - * c4x.c (c4x_scan_for_ld): Likewise. - * h8300.c (fix_bit_operand): Likewise. - * m88k.c (legitimize_address): Likewise. - (block_move_loop): Likewise. - (block_move_no_loop): Likewise. - (block_move_sequence): Likewise. - (m88k_builtin_saveregs): Use MEM_SET_IN_STRUCT_P. - * mips/abi64.h (SETUP_INCOMING_VARARGS): Likewise. - * rs6000.c (expand_block_move_insn): Use MEM_COPY_ATTRIBUTES. - * sh.c (sh_builtin_saveregs): Use MEM_SET_IN_STRUCT_P. - * arm.h (arm_gen_load_multiple): Take scalar_p. - (arm_store_load_multiple): Likewise. - * arm.c (arm_gen_load_multiple): Likewise. - (arm_gen_store_multiple): Likewise. - (arm_gen_movstrqi): Treat MEM_SCALAR_P like MEM_IN_STRUCT_P. - -Tue Jan 19 12:30:37 1999 Andrew MacLeod - - * optabs.c (emit_libcall_block): Add a REG_EH_REGION reg note to all - calls within a libcall block to indicate no throws are possible. - * flow.c (find_basic_blocks, find_basic_blocks_1): Don't look for - libcall blocks. Don't add edges to exception handlers if we see - a REG_EH_REGION note with a value of 0. - (make_edges): Override active_eh_region vector if the call has a note - indicating the call does not throw. - -1999-01-19 Vladimir N. Makarov - - * config/rs6000/sysv4.h (CC1_SPEC): Fix correct numbers of {}. - -Tue Jan 19 06:26:30 1999 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (cccp.o, cpplib.o): Depend on Makefile. - -Mon Jan 18 09:56:41 1999 Jason Merrill - - * invoke.texi (C++ Dialect Options): Document -fno-rtti. - -1999-01-18 Vladimir N. Makarov - - * invoke.texi (-mcpu=740, -mcpu=750): New options. - (-m(no-)multiple, -m(no-)string): Describe cases for PPC740 & - PPC750. - -1999-01-18 Michael Meissner - - * rs6000.h ({ASM,CPP}_CPU_SPEC): Add support for all machines - supported with -mcpu=xxx. - (processor_type): Add PROCESSOR_PPC750. - (ADJUST_PRIORITY): Call rs6000_adjust_priority. - (RTX_COSTS): Supply costs for 750 multiply/divide operations. - (rs6000_adjust_priority): Add declaration. - - * rs6000.c (rs6000_override_options): -mcpu={750,740} now sets the - processor type as 750, not 603. Allow -mmultiple and -mstring on - little endian 750 systems. - (rs6000_adjust_priority): Stub for now. - (get_issue_rate): The PowerPC 750 can issue 2 instructions/cycle. - - * rs6000.md (function/cpu attributes): Add initial ppc750 support. - - * sysv4.h (STRICT_ALIGNMENT): Don't force strict alignment if - little endian. - (CC1_SPEC): Pass -mstrict-align if little endian, and not - overridden. - (CC1_ENDIAN_{LITTLE,BIG,DEFAULT}_SPEC): Endian specific configs. - (SUBTARGET_EXTRA_SPECS): Add cc1 endian specs. - - * {sysv4,eabi}le.h (CC1_ENDIAN_DEFAULT_SPEC): Override, default is - little endian. - - * t-ppcgas (MULTILIB_*): Delete obsolete Solaris multilibs. - -Mon Jan 18 12:03:08 1999 Gavin Romig-Koch - - * config/mips/mips.md (div_trap): Split div_trap_mips16 - from div_trap. - (div_trap_normal,div_trap_mips16): Correct the length attributes. - -Mon Jan 18 11:48:28 1999 Kaveh R. Ghazi - - * cpplib.c (special_symbol): Qualify a char* with the `const' keyword. - Instead of writing to const char *buf directly, use a non-const - variable `wbuf' to allocate and write a string, then set buf = wbuf. - - * cppulp.c (user_label_prefix): Qualify a char* with the `const' - keyword. - - * dyn-string.c (dyn_string_append): Likewise. - - * dyn-string.h (dyn_string_append): Likewise. - - * final.c (end_final, output_operand_lossage, asm_fprintf): Likewise. - - * output.h (end_final, output_operand_lossage, asm_fprintf, - named_section, decode_reg_name, make_decl_rtl, user_label_prefix): - Likewise. - - * profile.c (init_branch_prob): Likewise. - - * toplev.c (set_target_switch, vmessage, - v_message_with_file_and_line, v_message_with_decl, - v_error_with_file_and_line, v_error_with_decl, v_error_for_asm, - verror, vfatal, v_warning_with_file_and_line, v_warning_with_decl, - v_warning_for_asm, vwarning, vpedwarn, v_pedwarn_with_decl, - v_pedwarn_with_file_and_line, vsorry, v_really_sorry, - open_dump_file, dump_rtl, clean_dump_file, - print_version, print_single_switch, print_switch_values, - dump_base_name, debug_args, lang_independent_options, - user_label_prefix, documented_lang_options, target_switches, - target_options, print_time, pfatal_with_name, fatal_io_error, - fatal_insn, default_print_error_function, print_error_function, - report_error_function, error_with_file_and_line, error_with_decl, - error_for_asm, error, fatal, warning_with_file_and_line, - warning_with_decl, warning_for_asm, warning, pedwarn, - pedwarn_with_decl, pedwarn_with_file_and_line, sorry, - really_sorry, botch, output_quoted_string, output_file_directive, - open_dump_file, rest_of_decl_compilation, display_help, main): - Likewise. - - * toplev.h (print_time, fatal, fatal_io_error, pfatal_with_name, - fatal_insn, warning, error, pedwarn, pedwarn_with_file_and_line, - warning_with_file_and_line, error_with_file_and_line, sorry, - really_sorry, default_print_error_function, report_error_function, - rest_of_decl_compilation, pedwarn_with_decl, warning_with_decl, - error_with_decl, error_for_asm, warning_for_asm, output_quoted_string, - output_file_directive, botch): Likewise. - - * tree.h (make_decl_rtl): Likewise. - - * varasm.c (strip_reg_name, named_section, decode_reg_name, - make_decl_rtl): Likewise. - -Mon Jan 18 11:35:49 1999 Gavin Romig-Koch - - * Makefile.in (TCL_LIBRARY): Use 'cd' to find the library - directory logically rather than physically. - -Mon Jan 18 09:05:37 1999 Kaveh R. Ghazi - - * loop.c (insert_bct): Hide the definition of variables - `increment_direction', `compare_direction', `add_iteration' and - `loop_var_mode'. - - * recog.c (mode_dependent_address_p): Mark parameter `addr' with - ATTRIBUTE_UNUSED. Mark label `win' with ATTRIBUTE_UNUSED_LABEL. - (mode_independent_operand): Mark label `lose' with - ATTRIBUTE_UNUSED_LABEL. - - * regclass.c (n_occurrences): Remove prototype and definition. - - * reload.c (find_reloads_address_1): Mark variable `tem' with - ATTRIBUTE_UNUSED. - - * reload1.c (reload): Cast the first two arguments of `bcopy' to PTR. - - * sbitmap.c (sbitmap_copy): Likewise. - - * scan-decls.c (scan_decls): Hide label `handle_comma'. - - * toplev.c (output_lang_identify): Mark prototype with - ATTRIBUTE_UNUSED. - - * tree.c (make_node): Cast the first argument of `bzero' to PTR. - (make_tree_vec): Likewise. - (build1): Likewise. - - * varasm.c (assemble_static_space): Mark variable `tem' with - ATTRIBUTE_UNUSED. - -Mon Jan 18 04:28:36 1999 Nathan Sidwell - - * Makefile.in (GCOV_INSTALL_NAME): New macro. - (install-common): Use it. - (uninstall): Use it. - (uninstall): Use correct names for protoize and unprotoize. - -Mon Jan 18 03:52:56 1999 Christian Bruel - Jeffrey A Law (law@cygnus.com) - - * flow.c (last_mem_set): Delete variable. References removed. - (mem_set_list): New variable. - (life_analysis): Initialize and finalize alias analysis. - (propagate_block); Initialize mem_set_list. Clear for CALL_INSNs. - (insn_dead_p): For a store to memory, search the entire mem_set_list - for a match. - (mark_set_1): Kill entries on the mem_set_list for aliased writes or - changes to their addresses. Add new entries to the mem_set_list for - memory writes writes. - (mark_used_regs): Kill entries on the mem_set_list which may be - referenced by a load operation. - -Mon Jan 18 01:01:02 1999 Jeffrey A Law (law@cygnus.com) - - * alias.c (base_alias_check): Add missing return for differing - symbols case. - -Mon Jan 18 00:36:13 1999 Rainer Orth - - * mips-tdump.c (print_file_desc): Handle unknown filenames and - missing local symbols. - -Sun Jan 17 21:04:31 1999 Richard Henderson - - * jump.c (rtx_renumbered_equal_p): Special case CODE_LABEL. - - * system.h (bcopy): Implement with memmove not memcpy. - -Sun Jan 17 19:23:20 1999 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (cppulp.o): Add dependencies. - - * i386.md (integer conditional moves): Add missing earlyclobbers. - - * regmove.c (optimize_reg_copy_1): Undo Aug 18 change. Update - REG_N_CALLS_CROSSED and REG_LIVE_LENGH if and only if we change - where a register is live. - -Sun Jan 17 03:20:47 1999 H.J. Lu (hjl@gnu.org) - - * reg-stack.c (subst_stack_regs_pat): Abort if the destination - of a FP conditional move is not on the FP register stack. - -Sun Jan 17 01:15:04 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Jan 16 23:40:33 1999 Jeffrey A Law (law@cygnus.com) - - * reload1.c (reload_cse_regs_1): Do not call - reload_cse_simplify_operands for an insn with asm operands. - - * cccp.c (print_help): Fix typos. - * cpplib.c (print_help): Fix typos. - * toplev.c (f_optiosn): Fix typos. - (documented_lang_options): Fix typos. - -Sat Jan 16 21:48:17 1999 Marc Espie (Marc.Espie@openbsd.org) - - * gcc.c (do_spec_1): Fix obvious typo. - -Sat Jan 16 19:31:07 1999 Kaveh R. Ghazi - - * c-decl.c (duplicate_decls): If `warn_traditional', warn when - a non-static function declaration follows a static one. - - * invoke.texi (-Wtraditional): Document the extra check now done - by this flag. - -Sat Jan 16 15:13:46 1999 Jeffrey A Law (law@cygnus.com) - - * pa.md (shadd): Create shadd insns, even if the result of the shift is - needed without the addition. - -Sat Jan 16 10:48:16 1999 J"orn Rennecke - - * sh.md (movdf, movsf): Temporary workaround for no_new_pseudos lossage. - -Fri Jan 15 23:44:37 1999 Richard Henderson - - * sparc.c (sparc_issue): Add hypersparc/sparclite86x entries. - -Fri Jan 15 22:30:04 1999 David Edelsohn - - * rs6000.h (CONST_OK_FOR_LETTER_P): Do not assume 32-bit CONST_INT. - * rs6000.c (u_short_cint_operand, add_operand, logical_operand, - non_add_cint_operand, non_logical_cint_operand): Likewise. - (get_issue_rate): Add CPU_PPC604E case. - * rs6000.md (movdi, !TARGET_POWERPC64 splitters): Handle 64-bit hosts. - -Fri Jan 15 18:42:12 1999 Richard Henderson - - * expr.c (queued_subexp_p): Make public. - * expr.h (queued_subexp_p): Declare it. - * recog.c (asm_operand_ok): New function. - (check_asm_operands): Use it. After reload, use constrain_operands - instead. - * recog.h (asm_operand_ok): Declare it. - * stmt.c (expand_asm_operands): Use it to try harder to make - asms initially satisfy their constraints. - -Fri Jan 15 17:43:59 1999 Jeffrey A. Law - - * sparc.h (LEGITIMIZE_RELOAD_ADDRESS): Do not create - (mem (lo_sum (...)) for TFmode unless TARGET_V9. - -Sat Jan 16 12:47:15 1999 Michael Hayes - - * config/c4x/c4x.md (not_repeat_reg): Allow ldp instruction - in delay slot of RPTBD. - -Sat Jan 16 12:26:40 1999 Michael Hayes - - * config/c4x/libgcc.S (___divhi3, ___modhi3): Fix long long - divide and modulo sign problem. - -Fri Jan 15 11:02:31 1999 Michael Hayes - - * unroll.c (loop_iterations): Return 0 if the last loop insn - is not a jump insn or if the loop has multiple back edges. - -1999-01-15 Manfred Hollstein - - * configure.in (fixinc_defs): Do not define for m[68]8k-motorola-sysv{,3}; - it's working properly now. Remove comment saying "see m68k-motorola-sysv - as an example". - * configure: Regenerate using autoconf. - - * fixinc/fixincl.c (main): Do not ignore SIGCHLD. - -Thu Jan 14 22:38:41 1999 Jeffrey A Law (law@cygnus.com) - - * unroll.c (find_splittable_givs): For a DEST_ADDR giv, do not share - a register with another DEST_ADDR giv if the address is not valid. - - * pa.c (hppa_expand_epilogue): Save and restore the static chain - around the call to mcount. - - * h8300.h (ASM_OUTPUT_LABELREF): Use asm_fprintf, not fprintf. - - * stmt.c (expand_end_case): Use emit_cmp_and_jump_insns to avoid - generating non-canonical rtl. - -1999-01-14 Vladimir N. Makarov - - * config/i960/i960.c (i960_output_move_double_zero, - i960_output_move_quad_zero): New functions for moving zeros. - (i960_output_move_double, i960_output_move_quad): Additional code - for situation when moving unaligned register group. - - * config/i960/i960.h (i960_output_move_double_zero, - i960_output_move_quad_zero): The function definitions. - - * config/i960/i960.md (movdi+1, movti+1): Usage of the functions. - -1999-01-13 Vladimir N. Makarov - - * config/i960/i960.c (i960_function_prologue): New code (optimal - solution) for saving global registers in local registers. - (form_reg_groups, reg_group_compare, split_reg_group): New - functions used by the code. - (reg_group): New structure definition for the new code. - -1999-01-13 Manfred Hollstein - - * fixinc/fixincl.c (create_file): Pass file creation mask as - third parameter to "open". Use O_TRUNC flag to open instead of - explicitly unlink'ing the file. - (process): and forget about the "chmod" stuff. - -Wed Jan 13 20:12:37 1999 Richard Henderson - - * integrate.c (expand_inline_function): Recognize (mem (addressof)) - and substitute. Copy the return value from there into a new pseudo. - -Wed Jan 13 16:47:00 1999 Catherine Moore - - * config/arm.c (output_func_epilogue): Check TARGET_ABORT_NORETURN - before generating a call to abort for volatile functions. - * config/arm.h (ARM_FLAG_ABORT_NORETURN): Define. - (TARGET_ABORT_NORETURN): Define. - (abort-on-noreturn): New option. - -Thu Jan 14 13:52:42 1999 Michael Hayes - - * config/c4x/c4x.md (in_annul_slot_3): Correctly allow unarycc - and binarycc operations in 3rd annulled delay slot! - -Wed Jan 13 16:16:44 1999 Catherine Moore - - * config/arm.c (output_func_epilogue): Check TARGET_ABORT_NORETURN - before generating a call to abort for volatile functions. - * config/arm.h (ARM_FLAG_ABORT_NORETURN): Define. - (TARGET_ABORT_NORETURN): Define. - (abort-on-noreturn): New option. - -Wed Jan 13 13:30:08 1999 Kaveh R. Ghazi - - * cccp.c (xstrdup): Renamed from `savestring'. All callers changed. - Remove prototype which we get from libiberty.h. - - * collect2.c (xstrdup): Likewise. - - * genextract.c (xstrdup): Likewise for `copystr'. - (mybzero): Remove it and use `memset' instead. - - * genoutput.c (mybcopy, mybzero): Remove these. All callers changed - to use `memcpy' and `memset' instead. - - * genrecog.c (xstrdup): Renamed from `copystr'. All callers - changed. Remove prototype. - (mybcopy, mybzero): Remove these and use memcpy/memset. - -Wed Jan 13 00:59:04 1999 Jeffrey A Law (law@cygnus.com) - - * mips.h (LOAD_EXTEND_OP): Correct for SImode and CCmode moves when - generating code for TARGET_64BIT. - -Tue Jan 12 14:05:37 1999 David Edelsohn - - * rs6000.c (print_operand, cases 'm' and 'M'): Do not depend on - HOST_WIDE_INT word-size. - (rs6000_stack_info): Remove redundant alignment of fpmem. - -Tue Jan 12 14:05:37 1999 Richard Henderson - - * rs6000.c (short_cint_operand): Remove CONSTANT_P_RTX handling. - (u_short_cint_operand, reg_or_cint_operand, logical_operand): Likewise. - (input_operand): Adjust CONSTANT_P_RTX handling. - * rs6000.h (PREDICATE_CODES): Remove CONSTANT_P_RTX references. - * rs6000.md (movsi): Adjust CONSTANT_P_RTX handling. - (movhi, movqi): Remove CONSTANT_P_RTX handling. - (movdi): Adjust CONSTANT_P_RTX handling. - -1999-01-12 Manfred Hollstein - - * configure: Regenerate using autoconf. - - * fixinc/Makefile.in (INCLUDES): Add -I$(srcdir)/../../include. - * fixinc/fixincl.c (SIGCHLD): Use SIGCLD on (very) old systems. - (process): "fchmod" isn't available on all systems, use "chmod" - instead. - * fixinc/server.c: Add #include . - (STDIN_FILENO): Add default definition if no include file defines - it already. - (STDOUT_FILENO): Likewise. - -Tue Jan 12 10:23:24 1999 Stan Cox - - * mips.md (call_value_internal3c): New pattern for -mips16 -mlong-calls. - -1999-01-12 Manfred Hollstein - - * m68k/mot3300.h (ADD_MISSING_POSIX, ADD_MISSING_XOPEN): Define to - ensure all prototypes necessary for building libio will be available. - * m68k/xm-mot3300.h (ADD_MISSING_POSIX, ADD_MISSING_XOPEN): Remove - definitions here as they are not host specific. - * m88k/sysv3.h, m88k/xm-sysv3.h: Likewise. - -Tue Jan 12 02:53:46 1999 Richard Henderson - - * cse.c (cse_insn): Never prefer (const (constant_p_rtx)). - -Tue Jan 12 02:36:10 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Tue Jan 12 01:30:19 1999 Richard Henderson - - * rtl.c (rtx_alloc): Use memset instead of inline loop. - - * recog.h (recog_op_alt): Declare extern. - -Tue Jan 12 00:23:31 1999 Richard Henderson - - * function.c (purge_addressof_1): If the note accesses a mem+addressof - in a wider mode than any replacement, adjust the cached replacement. - Cache trivial substitutions as well. - -Tue Jan 12 00:06:00 1999 Richard Henderson - - * Makefile.in (OBJECTS): Add sbitmap.o. - (BASIC_BLOCK_H): Add sbitmap.h. - * basic-block.h: Move simple bitmap code to sbitmap.h. - * flow.c: Move simple bitmap code to sbitmap.c. - * sbitmap.h, sbitmap.c: New files. - -Mon Jan 11 23:51:50 1999 Richard Henderson - - * alpha.h (TARGET_SWITCHES): Document switches. - (TARGET_OPTIONS): Likewise. - - * alpha/elf.h (ASM_FINISH_DECLARE_OBJECT): Use HOST_WIDE_INT_PRINT_DEC. - -Mon Jan 11 22:54:14 1999 Richard Henderson - - * tree.c (new_alias_set): Return zero if !flag_strict_aliasing. - -Mon Jan 11 22:36:01 1999 Richard Henderson - - * basic-block.h (basic_block_head): Rename to x_basic_block_head. - (basic_block_end): Rename to x_basic_block_end. - (BLOCK_HEAD, BLOCK_END): Update. - - * caller-save.c: Change basic_block_head/end references to - BLOCK_HEAD/END. - * combine.c, flow.c, function.c, gcse.c, global.c: Likewise. - * graph.c, haifa-sched.c, local-alloc.c, regclass.c: Likewise. - * regmove.c, reload1.c, reorg.c, sched.c: Likewise. - -Sat Jan 9 23:54:09 1999 Kaveh R. Ghazi - - * gcc.c (xstrerror): Renamed from my_strerror. All callers - changed. Remove prototype since we get that from libiberty.h. - - * protoize.c (xstrerror): Likewise. - -Sat Jan 9 23:22:04 1999 Kaveh R. Ghazi - - * gcc.c (read_specs): Ensure format specifiers match their arguments. - -Sat Jan 9 20:04:24 1999 Richard Henderson - - * tree.c (copy_node): Oops. That would be copy not zero - in that last change. - -Sun Jan 10 15:35:41 1999 Michael Hayes - - * config/c4x/c4x.c: Include system.h. - (c4x_caller_save_map): Disable caller save for RC. - (c4x_optimization_options): Disable scheduling before reload. - (valid_parallel_load_store) : Define return type as int. - Remove unused variable regs. - * config/c4x/c4x.h (REGISTER_MOVE_COST): Make independent of register - class. - * config/c4x/c4x.md (rotlqi3, rotrqi3): Fix up emitted RTL to - handle rotations. - (*db, decrement_and_branch_until_zero): Fix up constraints - to keep reload happy. - -Sat Jan 9 18:35:29 1999 Richard Henderson - - * tree.c (make_node): Call bzero instead of inline clear. - (copy_node, make_tree_vec, build1): Likewise. - (get_identifier): Call strlen instead of inline count. - (maybe_get_identifier): Likewise. - -Sun Jan 10 14:04:51 1999 Michael Hayes - - * config/c4x/c4x.md (in_annul_slot_3): Allow unarycc and binarycc - operations in 3rd annulled delay slot. - (*lshrqi3_const_set): Disallow c constraint for operand0. - (modhi3+1, modhi3+2): Set attribute type to multi. - * config/c4x/c4x.c (c4x_S_constraint): Removed space in middle of - != operator. - -Sat Jan 9 11:44:55 1999 Kaveh R. Ghazi - - * gansidecl.h: Allow attribute unused on labels only when we are - version 2.93 or higher. Not all versions of 2.92 have this feature. - - * version.c: Bump minor number to 93. - -Fri Jan 8 10:51:13 1999 Andreas Schwab - - * config/m68k/m68k.h: Declare output_function_epilogue. - * recog.h: Declare next_insn_tests_no_inequality. - -Fri Jan 8 01:43:53 1999 Jeffrey A Law (law@cygnus.com) - - * stmt.c (optimize_tail_recursion): New function, extracted from ... - (expand_return): Use optimize_tail_recursion. - * tree.h (optimize_tail_recursion): Declare. - - * toplev.c (compile_file): Move call to output_func_start_profiler - to after the loop to emit deferred functions. - -Thu Jan 7 19:52:53 1999 Gerald Pfeifer - - * system.h (abort): Supply more detailed information on how to - report an Internal Compiler Error. - -Thu Jan 7 09:25:58 1999 Bruce Korb (korb@datadesign.com) - - * fixinc/fixincl.c (*): More decapitalization of variables - plus some explanatory comments. - - * fixinc/Makefile.in fixinc/mkfixinc.sh: - When the fixincl program does not work for a certain system, - we substitute a shell script. Added user commentary when - this happens. - -Thu Jan 7 11:26:17 1999 Mark Mitchell - - * calls.c (store_unaligned_arguments_into_pseudos): Use xmalloc to - allocate memory that will live beyond this function. - (expand_call): Free it here. - -Thu Jan 7 03:08:17 1999 Richard Henderson - - * sparc.h (PREFERRED_RELOAD_CLASS): Select GENERAL_REGS for - integer data not destined for fp regs. - (LEGITIMIZE_RELOAD_ADDRESS): New. - -Thu Jan 7 03:03:42 1999 Stan Cox - Richard Henderson - - Support for Hypersparc and Sparclite86x: - * sparc.h (TARGET_CPU_hypersparc, TARGET_CPU_sparclite86x): New. - (CPP_CPU32_DEFAULT_SPEC): Fix up for the new targets. - (ASM_CPU32_DEFAULT_SPEC): Likewise. - (TARGET_CPU_DEFAULT): Likewise. - (enum processor_type): Likewise. - (CPP_ENDIAN_SPEC): Handle little endian data. - (LIBGCC2_WORDS_BIG_ENDIAN): Likewise. - (ADJUST_COST): Call sparc_adjust_cost. - * sparc.c (sparc_override_options): Fix up for the new targets. - (supersparc_adjust_cost): Make static. - (hypersparc_adjust_cost): New. - (ultrasparc_adjust_cost): Make static. - (sparc_adjust_cost): New. - * sparc.md (attr cpu): Add hypersparc and sparclite86x. - (function_unit): Add hypersparc scheduling rules. - - * configure.in (with_cpu handler): Recognize hypersparc. - -Thu Jan 7 23:54:05 1999 Michael Hayes - - * config/c4x/c4x.c: Added space after negation operator. - * config/c4x/c4x.h: Likewise. - * config/c4x/c4x.md: Likewise. - -Thu Jan 7 23:39:27 1999 Michael Hayes - - * config/c4x/c4x.c (c4x_preferred_reload_class): Always return class. - -Thu Jan 7 00:29:25 1999 Bernd Schmidt - - * combine.c (num_sign_bit_copies): In NEG, MULT, DIV and MOD cases, - when a test can't be performed due to limited width of - HOST_BITS_PER_WIDE_INT, use the more conservative approximation. - Fix UDIV case for cases where the first operand has the highest bit - set. - -Thu Jan 7 00:01:38 1999 Lutz Vieweg - - * pa.h (reg_class): Add FPUPPER_REGS. - (REG_CLASS_NAMES): Similarly. - (REG_CLASS_CONTENTS): Similarly. - (REGNO_REG_CLASS): Handle FPUPPER_REGS. - (FP_REG_CLASS_P): Likewise. - (REG_CLASS_FROM_LETTER): Similarly. - (CLASS_MAX_NREGS): Similarly. - -1999-01-06 Brendan Kehoe - - * fixincludes: For HP/UX 10.20, also look in curses_colr/curses.h - for a typedef of bool. Make sure to have a copy of the file is - in place before we look to fix it. Fix typo in variable name to - FILE. - -Wed Jan 6 07:51:05 1999 Richard Henderson - - * expr.c (expand_builtin) [case BUILT_IN_CONSTANT_P]: Use - value_mode for the return mode. - -Wed Jan 6 17:55:19 1999 Robert Lipe - - * configure.in: New flag --with-dwarf2. If set, enables DWARF-2 - debugging as default. - - * config/tm-dwarf2.h: New file. - -Wed Jan 6 16:08:54 1999 Jeffrey A Law (law@cygnus.com) - - * h8300.h (ASM_OUTPUT_LABELREF): Define. - - * pa.h (DONT_RECORD_EQUIVALENCE): Kill. - * local-alloc.c (update_equiv_regs): Corresponding changes. - * tm.texi (DONT_RECORD_EQUIVALENCE): Kill. - - * calls.c (special_function_p): Push alloca test inside the large - conditional which excludes functions not at file scope or not - extern. - - * calls.c (special_function_p): New function broken out of - expand_call. - (precompute_register_parameters): Likewise. - (store_one_arg): Likewise. - (store_unaligned_argumetns_into_pseudos): Likewise. - (save_fixed_argument_area): Likewise. - (restore_fixed_argument_area): Likewise. - (expand_call): Corresponding changes. - -Thu Jan 7 00:12:24 1999 Michael Hayes - - * config/c4x/c4x.md (addqi3): If the destination operand is - a hard register other than an extended precision register, - emit addqi3_noclobber. - (*addqi3_noclobber_reload): New pattern added so that reload - will recognize a store of a pseudo, equivalent to the sum - of the frame pointer and a constant, as an add insn. - -1999-01-06 Manfred Hollstein - - * fixinc/fixincl.c: Re-indent according to the GNU standards. - fixinc/server.c: Likewise. - fixinc/server.h: Likewise. - -Wed Jan 6 10:43:29 1999 Andreas Schwab - - * config/m68k/m68k.c (const_uint32_operand): Remove CONSTANT_P_RTX - handling. - (const_sint32_operand): Likewise. - -Wed Jan 6 09:44:51 1999 Kaveh R. Ghazi - - * toplev.h: In addition to checking _JBLEN, also check if `setjmp' - is a macro when deciding if we can use `jmp_buf' in prototypes. - -Wed Jan 6 03:18:53 1999 Mark Elbrecht - - * configure.in (pc-msdosdjgpp): Set x_make to x-go32. - * configure: Rebuilt. - * i386/xm-go32.h: Define LIBSTDCXX. - * i386/x-go32: New. - * i386/go32.h (MD_EXEC_PREFIX): Define. - (FILE_NAME_ABSOLUTE_P): Define. - (LINK_COMMAND_SPEC): Define. - -Wed Jan 6 02:23:36 1999 "Charles M. Hannum" - - * expr.c (store_expr): If the lhs is a memory location pointed - to be a postincremented (or postdecremented) pointer, always - force the rhs to be evaluated into a pseudo. - -Wed Jan 6 00:54:21 1999 Geoff Keating - - * real.c (mtherr): Print more reasonable warning messages. - -Tue Jan 5 21:57:42 1999 Kaveh R. Ghazi - - * Makefile.in (gcc.o, prefix.o, cccp.o, cpplib.o): Depend on prefix.h. - - * cccp.c: Include prefix.h, don't prototype prefix.c functions. - (new_include_prefix): Constify char* parameters. - - * cppfiles.c (read_name_map): Likewise. - (append_include_chain): Likewise. Also, use a writable char* copy - of parameter `dir' which we then modify, rather than using the - parameter itself to store the new writable string. - (remap_filename): Constify some variables. Also, use a writable - char* to store an allocated string which we will be modifying. - - * cpplib.c: Include prefix.h, don't prototype prefix.c functions. - (cpp_start_read): Constify variable `str'. - - * cpplib.h (append_include_chain): Constify a char* parameter. - - * gcc.c Include prefix.h, don't prototype prefix.c functions. - (add_prefix, save_string): Constify char* parameters. - (fatal, error): Add ATTRIBUTE_PRINTF_1 to prototypes. - - * prefix.c: Include prefix.h. - (get_key_value, translate_name, save_string, update_path, - set_std_prefix): Constify various char* parameters and variables. - (save_string): Use xmalloc, not malloc. - (translate_name): Use a writable temporary variable to create and - modify a string before setting it to a const char*. - - * prefix.h: New file to prototype functions exported from prefix.c. - -Tue Jan 5 08:52:18 1999 Bruce Korb (korb@datadesign.com) - - * fixinc/fixincl.c (various): Added debug code so - Manfred can trace the processing. - - * fixinc/inclhack.def (sys/utsname.h): Provide forward declaration of - struct utsname on Ultrix V4.[35]. - - * fixinc/{fixincl.x|fixincl.sh|inclhack.sh} : Regenerated. - -Mon Jan 4 15:37:30 1999 Zack Weinberg - - * cpplib.c (skip_if_group): Split out the logic that handles - directive recognition to its own function. Don't use - parse markers; use a bare pointer into the buffer. Use - copy/skip_rest_of_line instead of doing it by hand. Remove - `return on any directive' mode which was never used, and take - only one argument. - (consider_directive_while_skipping): New function, subroutine - of skip_if_group. Logic streamlined a bit. - (conditional_skip, do_elif, do_else): Call skip_if_group with - only one argument. - -Mon Jan 4 15:27:30 1999 Zack Weinberg - - * cpplib.c (do_undef): EOF immediately after '#undef FOO' is not an - error. - -Mon Jan 4 11:55:51 1999 Jason Merrill - - * extend.texi (Bound member functions): Document. - -Mon Jan 4 11:01:48 1999 Kaveh R. Ghazi - - * mips-tdump.c (st_to_string, sc_to_string, glevel_to_string, - lang_to_string, type_to_string): Make return type const char*. - (print_symbol): Apply `const' keyword to a char*. - (print_file_desc): Cast structure member `crfd' to ulong when - comparing against one. - - * mips-tfile.c (pfatal_with_name): Apply `const' keyword to char*. - (fatal, error): Add ATTRIBUTE_PRINTF_1 to prototypes. - (progname, input_name): Apply `const' keyword to a char*. - Don't redundantly include sys/stat.h. - (alloc_info): Apply `const' keyword to a char*. - (st_to_string, sc_to_string): Likewise. - (hash_string): Cast variable `hash_string' to a symint_t when - comparing against one. - (add_string): Cast PAGE_USIZE to Ptrdiff_t when comparing against one. - Likewise cast it to long when comparing against one. - (add_local_symbol): Apply `const' keyword to a char*. - (add_ext_symbol): Likewise. - (add_unknown_tag): Likewise. - (add_procedure): Cast a printf-style field width to an int. - (add_file): Cast PAGE_USIZE to long when comparing against one. - (parse_begin): Cast a printf-style field width to an int. - (parse_bend): Likewise. - (parse_def): Likewise. - (parse_end): Likewise. - (mark_stabs): Mark parameter `start' with ATTRIBUTE_UNUSED. - (parse_stabs_common): Fix format specifier. - (parse_input): Change type of variable `i' to Size_t. - (write_object): Fix arguments to match format specifiers. - Cast variable `num_write' to long when comparing against one. - (read_seek): Cast variable `sys_read' to symint_t when comparing - against one. Fix arguments to match format specifiers. Cast - variable `size' to long when comparing against one. - (copy_object): Cast result of `sizeof' to int when comparing - against one. Fix arguments to match format specifiers. Cast - variable `ifd' to long when comparing against a signed value. - Likewise, likewise. - -Mon Jan 4 10:30:33 1999 Kaveh R. Ghazi - - * c-common.c (decl_attributes): Allow applying attribute `unused' - on a LABEL_DECL. - - * c-parse.in (label): Parse attributes after a label, and call - `decl_attributes' to handle them. - - * gansidecl.h (ATTRIBUTE_UNUSED_LABEL): Define. - - * genrecog.c (OUTPUT_LABEL, write_tree_1, write_tree): When - generating labels, mark them with ATTRIBUTE_UNUSED_LABEL. - - * invoke.texi: Note that labels can be marked `unused'. - -Sun Jan 3 23:32:18 1999 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Jan 3 23:00:42 1999 Jeffrey A Law (law@cygnus.com) - - * optabs.c (emit_cmp_and_jump_insns): Use CONSTANT_P canonicalizing - RTL for a compare/jump sequence. - -Sun Jan 3 22:58:15 1999 Michael Hayes - - * optabs.c (emit_cmp_insn): Abort if asked to emit non-canonical RTL - for a target with HAVE_cc0 defined. - (emit_cmp_and_jump_insns): New function. - * expr.h (emit_cmp_and_jump_insns): Prototype it. - * loop.c (check_dbra_loop): Use it to replace calls - to emit_cmp_insn and emit_jump_insn and to canonicalize - the comparison if necessary. - * unroll.c (unroll_loop): Likewise. - -Sun Jan 3 21:01:04 1999 Rainer Orth - - * fixincludes (sys/utsname.h): Provide forward declaration of - struct utsname on Ultrix V4.[35]. - - * mips.md (div_trap): Use local labels instead of dot-relative - branches. - -Sun Jan 3 20:40:34 1999 Jeffrey A Law (law@cygnus.com) - - * pa.md (branch, negated branch): Handle (const_int 0) as first - source operand. - * pa.c (output_cbranch): Likewise. - -Sun Jan 3 03:20:38 1999 David Edelsohn - - * rs6000.c (rs6000_stack_info): Undo spurious part of last - change. - -1999-01-01 Manfred Hollstein - - * extend.texi (__builtin_constant_p): Add missing @smallexample. - -Fri Jan 1 11:48:20 1999 Jeffrey A Law (law@cygnus.com) - - * i386.md (doubleword shifts): Fix dumb mistakes in previous change. - -Wed Dec 30 23:38:55 1998 Jeffrey A Law (law@cygnus.com) - - * m68k.md (adddi_dilshr32): Allow all operands to be registers too. - (adddi_dishl32): Similarly. - - * cse.c (invalidate_skipped_block): Call invalidate_from_clobbers - for each insn in the skipped block. - - * reload1.c (reload_as_needed): Verify that the insn satisfies its - constraints after replacing a register address with an autoincrement - address for reload inheritance purposes. - - * i386.md (doubleword shifts): Avoid namespace pollution. - -Wed Dec 30 23:00:28 1998 David O'Brien - - * configure.in (FreeBSD ELF): Needs special crt files. - -Wed Dec 30 22:50:13 1998 Geoffrey Noer - - * i386/xm-cygwin.h: Change DIR_SEPARATOR to forward slash. - -1998-12-30 Andreas Schwab - - * loop.c (check_dbra_loop): While reversing the loop, if the - comparison value has a VOID mode use the mode of the other operand - to compute the mask. - -Wed Dec 30 22:24:00 1998 Michael Meissner - - * rs6000.md ({save,restore}_stack_function): Take 2 operands to - avoid warnings in compiling explow.c. - - (patch from Ken Raeburn, raeburn@cygnus.com) - * rs6000.c (rs6000_stack_info): Force 8-byte alignment of - fpmem_offset. Compute total size after that, and then - rs6000_fpmem_offset using both values. - -Mon Dec 28 19:26:32 1998 Gerald Pfeifer - - * gcc.texi (Non-bugs): ``Empty'' loops will be optimized away in - the future; indeed that already happens in some cases. - -Tue Dec 29 11:58:53 1998 Richard Henderson - - * sparc.c (input_operand): Recognize (const (constant_p_rtx)). - (arith_operand): Remove constant_p_rtx handling. - (const64_operand, const64_high_operand): Likewise. - (arith11_operand, arith10_operand, arith_double_operand): Likewise. - (arith11_double_operand, arith10_double_operand, small_int): Likewise. - (small_int_or_double, uns_small_int, zero_operand): Likewise. - * sparc.h (PREDICATE_CODES): Likewise. - - * rtl.h (CONSTANT_P): Remove CONSTANT_P_RTX. - -Tue Dec 29 11:32:54 1998 Richard Kenner - - * rtl.def (CONSTANT_P_RTX): Clarify commentary. - * expr.c (expand_builtin, case BUILT_IN_CONSTANT_P): Rework to - consider constant CONSTRUCTOR constant and to defer some cases - to cse. - * cse.c (fold_rtx, case CONST): Add handling for CONSTANT_P_RTX. - * regclass.c (reg_scan_mark_refs, case CONST): Likewise. - -Tue Dec 29 11:30:10 1998 Richard Henderson - - * expr.c (init_expr_once): Kill can_handle_constant_p recognition. - * cse.c (fold_rtx, case 'x'): Remove standalone CONSTANT_P_RTX code. - - * alpha.c (reg_or_6bit_operand): Remove CONSTANT_P_RTX handling. - (reg_or_8bit_operand, cint8_operand, add_operand): Likewise. - (sext_add_operand, and_operand, or_operand): Likewise. - (reg_or_cint_operand, some_operand, input_operand): Likewise. - * alpha.h (PREDICATE_CODES): Likewise. - -Sat Dec 26 23:26:26 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Dec 26 09:17:04 1998 Jeffrey A Law (law@cygnus.com) - - * gengenrtl.c (gencode): Always use bzero to clear memory instead - of dangerous casts and stores. - - * Makefile.in (compare, gnucompare): Add missing else true clauses. - -Fri Dec 25 23:00:56 1998 Jeffrey A Law (law@cygnus.com) - - * alpha.md (builtin_longjmp): Add missing "DONE". - -Thu Dec 24 10:39:57 1998 Stan Cox - - * gcc.c (execute): Enable -pipe with win32. - -Wed Dec 23 10:27:44 1998 Nick Clifton - - * config/arm/t-arm-elf: Add multiplib option for leading - underscores. - - * config/arm/thumb.h (ASM_OUTPUT_LABELREF): Use variable - 'user_label_prefix' rather than macro USER_LABEL_PREFIX. - - (thumb_shiftable_const): Use macro 'BASE_REG_CLASS' rather - than variable 'reload_address_base_reg_class'. [Note this - change is unrelated to the others in this patch]. - - * config/arm/unknown-elf.h (USER_LABEL_PREFIX): Default to no - leading underscore. - -Wed Dec 23 09:51:32 1998 Kaveh R. Ghazi - - * alias.c (record_alias_subset): Remove ignored `&'. - (init_alias_once): Likewise. - - * c-lex.c (UNGETC): Cast first argument of comma expression to void. - - * config/mips/mips.c (mips_asm_file_end): Cast the result of - fwrite to `int' when comparing against one. - - * config/mips/mips.h (CAN_ELIMINATE): Add parens around && within ||. - (INITIAL_ELIMINATION_OFFSET): Add braces to avoid ambiguous `else'. - - * cse.c (rehash_using_reg): Change type of variable `i' to - unsigned int. - - * dwarf2out.c (initial_return_save): Cast -1 to unsigned before - assigning it to one. - - * except.c (duplicate_eh_handlers): Remove unused variable `tmp'. - - * final.c (final_scan_insn): Likewise for variable `i'. - (output_asm_insn): Cast a char to unsigned char when used as an - array index. - - * gcse.c (compute_pre_ppinout): Cast -1 to SBITMAP_ELT_TYPE when - assigning it to one. - - * loop.c (strength_reduce): Remove unused variables `count' and `temp'. - - * recog.c (preprocess_constraints): Cast a char to unsigned char - when used as an array index. - - * regmove.c (find_matches): Likewise. - - * reload1.c (calculate_needs): Add default case in switch. - (eliminate_regs_in_insn): Initialize variable `offset'. - (set_offsets_for_label): Change type of variable `i' to unsigned. - (reload_as_needed): Wrap variable `i' in macro check on - AUTO_INC_DEC || INSN_CLOBBERS_REGNO_P. - - * scan-decls.c (scan_decls): Mark parameters `argc' and `argv' - with ATTRIBUTE_UNUSED. Cast variable `start_written' to size_t - when comparing against one. - - * stor-layout.c (layout_decl): Cast maximum_field_alignment to - unsigned when comparing against one. Likewise for - GET_MODE_ALIGNMENT(). - (layout_record): Cast record_align to int when comparing against a - signed value. - (layout_type): Cast TYPE_ALIGN() to int when comparing against a - signed value. - - * tree.c (get_identifier): Cast variable `len' to unsigned when - comparing against one. - (maybe_get_identifier): Likewise - -Wed Dec 23 00:10:01 1998 Jeffrey A Law (law@cygnus.com) - - * toplev.c (rest_of_compilation): Do not set reload_completed. - * reload1.c (reload): Set reload_completed before calling - cleanup_subreg_operands. - -Tue Dec 22 23:58:31 1998 Richard Henderson - - * reload1.c (emit_reload_insns): Check `set' not null before use. - -Tue Dec 22 15:15:45 1998 Nick Clifton - - * rtlanal.c (multiple_sets): Change type of 'found' from 'rtx' to - 'int'. - -Tue Dec 22 13:55:44 1998 Theodore Papadopoulo - - * halfpic.c (half_pic_encode): Delete redundant code. - -Tue Dec 22 13:02:22 1998 Michael Meissner - - * toplev.c (main): Delete handling of -dM as a preprocessor - option. - -Mon Dec 21 17:39:38 1998 Michael Meissner - - * toplev.c (main): Don't emit any warnings when using -dD, -dM, or - -dI, which are handled by the preprocessor. - -Sun Dec 20 16:13:44 1998 John F. Carr - - * configure.in: Handle Digital UNIX 5.x the same as 4.x. - * i386/sol2.h: Define LOCAL_LABEL_PREFIX as ".". - -Sun Dec 20 07:39:52 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Dec 19 22:24:22 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Dec 19 21:41:32 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Dec 19 09:52:27 1998 Kaveh R. Ghazi - - * genattr.c (fatal): Qualify a char* with the `const' keyword. - - * genattrtab.c (fatal, attr_printf, attr_string, write_attr_set, - write_unit_name, write_eligible_delay, expand_units, - make_length_attrs, write_attr_case, find_attr, - make_internal_attr): Likewise. - * gencheck.c (tree_codes): Likewise. - * gencodes.c (fatal): Likewise. - * genconfig.c (fatal): Likewise. - * genemit.c (fatal): Likewise. - * genextract.c (fatal, walk_rtx, copystr): Likewise. - * genflags.c (fatal): Likewise. - * genopinit.c (fatal, optabs, gen_insn): Likewise. - * genoutput.c (fatal, error, predicates): Likewise. - * genpeep.c (fatal): Likewise. - * genrecog.c (fatal, decision, pred_table, add_to_sequence, - write_tree_1, write_tree, change_state, copystr, indents): Likewise. - -Thu Dec 17 18:21:49 1998 Rainer Orth - - * configure.in (with-fast-fixincludes): Fix whitespace. - * configure: Rebuilt. - - * fixincludes (c_asm.h): Wrap Digital UNIX V4.0B DEC C specific - asm() etc. function declarations in __DECC. - -Thu Dec 17 13:57:23 1998 Nick Clifton - - * expr.c (emit_move_insn_1): Only emit a clobber if the target - is a pseudo register. - -Thu Dec 17 13:50:29 1998 Nick Clifton - - * gcse.c: Include expr.h in order to get the prototype for - get_condition() which is used in delete_null_pointer_checks(). - -Thu Dec 17 15:58:26 1998 Kaveh R. Ghazi - - * hwint.h: New file to consolidate HOST_WIDE_INT (etc) macros. - -Thu Dec 17 12:31:12 1998 Jim Wilson - - * Makefile.in (INTERNAL_CFLAGS): Add SCHED_CFLAGS. - (ALL_CFLAGS): Delete SCHED_CFLAGS. - -1998-12-17 Vladimir N. Makarov - - * config/i60/i960.md (extendqihi2): Fix typo (usage ',' instead of - ';'). - -1998-12-17 Michael Tiemann - - * i960.md (extend*, zero_extend*): Don't generate rtl that looks - like (subreg:SI (reg:SI N) 0), because it's wrong, and it hides - optimizations from the combiner. - -Thu Dec 17 08:27:03 1998 J"orn Rennecke - - * loop.c (combine_givs_used_by_other): Don't depend on n_times_set. - -Wed Dec 16 17:30:35 1998 Nick Clifton - - * toplev.c (main): Disable optimize_size if a specific - optimization level is requested. Always set optimization - level to 2 if -Os is specified. - -Wed Dec 16 16:33:04 1998 Dave Brolley - - * objc/lang-specs.h: Pass -MD, -MMD and -MG to cc1obj if configured with - cpplib. - * cpplib.c (cpp_start_read): If in_fname is not initialized, try to - initialize it using fname. - -1998-12-16 Zack Weinberg - - * cpplib.c (do_include): Treat #include_next in the - primary source file as #include plus warning. Treat - #include_next in a file included by absolute path as an - error. fp == CPP_NULL_BUFFER is a fatal inconsistency. - -Wed Dec 16 12:28:54 1998 Kaveh R. Ghazi - - * cccp.c: Don't define MIN/MAX anymore. - * cpplib.c: Likewise. - * machmode.h: Likewise. - * system.h: Provide definitions for MIN/MAX. - -Tue Dec 15 23:47:42 1998 Zack Weinberg - - * fix-header.c: Don't define xstrdup here. - -Wed Dec 16 05:11:04 1998 J"orn Rennecke - - * loop.c (consec_sets_giv): New argument last_consec_insn. - (strength_reduce): Provide / use it. - -Wed Dec 16 17:24:07 1998 Michael Hayes - - * loop.h (loop_info): New field 'vtop'. - * loop.c (check_dbra_loop): Use loop_info->vtop rather than - scanning loop for vtop. - * unroll.c (subtract_reg_term, find_common_reg_term): New functions. - (loop_iterations): Use them to determine if loop has a constant - number of iterations. Set loop_info->vtop. Don't subtract - common reg term from initial_value and final_value if have a - do-while loop. - -Tue Dec 15 13:49:55 1998 Jeffrey A Law (law@cygnus.com) - - * mn10200.md (addsi3 expander): Use "nonmemory_operand" for operand 2. - - * mn10300.md (bset, bclr): Operand 0 is a read/write operand. - - * mn10200.md (abssf2, negsf2): New expanders. - - * mn10300.md (absdf2, abssf2, negdf2, negsf2): New expanders. - -Tue Dec 15 11:55:30 1998 Nick Clifton - - * integrate.c (copy_rtx_and_substitute): If a SUBREG is - replaced by a CONCAT whose components do not have the same - mode as the original SUBREG, use a new SUBREG to restore the - mode. - - * emit-rtl.c (subreg_realpart_p): Cope with subregs containing - multiword complex values. - -1998-12-15 Zack Weinberg - - * cppalloc.c: Add xstrdup here. - * cpplib.h: Remove savestring prototype. - * cpplib.c: Remove savestring function. s/savestring/xstrdup/ - throughout. - * cppfiles.c: s/savestring/xstrdup/ throughout. - -1998-12-15 Zack Weinberg - - * cpplib.c: Make all directive handlers read their own - arguments. - (struct directive): Remove last two arguments from FUNC - member prototype. Remove `command_reads_line' member - entirely. - (directive_table): Remove initializations of - command_reads_line flag. Pretty-print. - (eval_if_expression, do_define, do_line, do_include, - do_undef, do_error, do_pragma, do_ident, do_if, do_xifdef, - do_else, do_elif, do_sccs, do_assert, do_unassert, - do_warning): Take only two args. - - (cpp_define): Call do_define with two args and the text to - define stuffed into a buffer. - (make_assertion): Call do_assert with two args. - (handle_directive): Call do_line with two args. Call - kt->func with two args. Remove command_reads_line - processing. - (do_define, do_undef, do_error, do_warning, do_pragma, - do_sccs): Read the rest of the line here. - (do_ident): Gobble rest of line, as cccp does. - (cpp_undef): New function. - (cpp_start_read): Call cpp_undef instead of do_undef. - -1998-12-15 Zack Weinberg - - * cpphash.h (union hash_value): Remove `keydef' member, add a - `struct hashnode *aschain' member for #assert. - - * cpplib.c (struct tokenlist_list, struct - assertion_hashnode): Delete structure definitions. - (assertion_install, assertion_lookup, delete_assertion, - check_assertion, compare_token_lists, reverse_token_list, - read_token_list, free_token_list): Delete functions. - (parse_assertion): New function. - (cpp_cleanup): Don't destroy the assertion_hashtable. - - (do_assert): Gut and rewrite. #assert foo (bar) places - entries for `#foo' and `#foo(bar)' in the macro hash table, - type T_ASSERT. The value union's `aschain' member is used - to chain all answers for a given predicate together. - (do_unassert): Also rewritten. Take an un-asserted - answer off the chain from its predicate and call - delete_macro on the hashnode, or walk a predicate chain - calling delete_macro on all the entries. - (cpp_read_check_assertion): Simply call parse_assertion to - get the canonical assertion name, and look that up in the - hash table. - - * cpplib.h (ASSERTION_HASHNODE,ASSERTION_HASHSIZE,assertion_hashtab): - Removed. - - * cpphash.c (install): Use bcopy instead of an explicit loop - to copy the macro name. - - * cppexp.c (cpp_lex): Convert the result of - cpp_read_check_assertion to a `struct operation' directly; - don't go through parse_number. - -Tue Dec 15 18:27:39 1998 J"orn Rennecke - - * loop.h (struct induction): Delete times_used member. - * loop.c (n_times_set): Rename to set_in_loop. Changed all users. - (n_times_used): Rename to n_times_set. Changed all users. - (scan_loop): Free reg_single_usage before strength reduction. - (record_giv, combine_givs): Remove handling of times_used member. - (combine_givs_used_once): Rename to: - (combine_givs_used_by_other) . Changed all callers. - -Tue Dec 15 01:45:26 1998 Jason Merrill - - * dwarf2out.c (gen_struct_or_union_type_die): Check AGGREGATE_TYPE_P - instead of TREE_CODE_CLASS == 't'. - (gen_type_die): Likewise. - (scope_die_for): Ignore FUNCTION_TYPE "scopes". - -Mon Dec 14 16:23:27 1998 Jim Wilson - - * real.c (endian): Disable last change unless - HOST_BITS_PER_WIDE_INT is greater than 32. - -Mon Dec 14 17:13:36 1998 Andrew MacLeod - - * output.h (force_data_section): New prototype. - * varasm.c (force_data_section): New function to force the - data section, regardless of what in_section thinks. - * dwarf2out.c (output_call_frame_info): Call force_data_section - since varasm may not realize we've changes sections. - -Mon Dec 14 14:09:34 1998 Nick Clifton - - * reload1.c (reload): Delete REG_RETVAL and REG_LIBCALL notes - after completing reload. - - * rtl.texi: Document that REG_RETVAL and REG_LIBCALL are - deleted after reload. - -Mon Dec 14 01:39:28 1998 Jeffrey A Law (law@cygnus.com) - - * rtl.h (multiple_sets): Fix prototype. - * rtlanal.c (multiple_sets): Fix return type. - -Sun Dec 13 12:43:58 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Dec 13 01:05:22 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -1998-12-13 Manfred Hollstein - - * protoize.c (fputs): Wrap extern declaration in #ifndef fputs. - -Sun Dec 13 00:24:14 1998 J"orn Rennecke - - * rtl.h (recompute_reg_usage): Add second argument. - * flow.c (recompute_reg_usage): Likewise. - * toplev.c (rest_of_compilation): Supply second argument to - recompute_reg_usage. - - * reload1.c (compute_use_by_pseudos): Allow reg_renumber[regno] < 0 - after reload. - -Sat Dec 12 23:39:10 1998 Jeffrey A Law (law@cygnus.com) - - * m68k/t-m68kelf (MULTILIB_OPTIONS): Add mcpu32. - (MULTILIB_MATCHES): -m68332 now uses mcpu32 libraries, not m68000. - (MULTILIB_EXCEPTIONS): Don't build 68881 libraries for m68000, - mcpu32 or m5200. - - * i386/next.h (ASM_OUTPUT_ALIGN): Use 0x90 for fill character. - - * rtlanal.c (multiple_sets): New function. - * rtl.h (multiple_sets): Declare it. - * local-alloc.c (wipe_dead_reg): Use it. - * global.c (global_conflicts): Likewise. - -Sat Dec 12 22:13:02 1998 Mark Mitchell - - * global.c (record_conflicts): Don't use an array of shorts to - store an array of ints. - (global_conflicts): Likewise. - -Sat Dec 12 16:49:24 1998 Richard Henderson - - * alpha.c (alpha_expand_block_move): mode_for_size expects - bits, not bytes. Infer extra alignment from addressof. - -1998-12-11 Michael Meissner - - * rs6000/sysv4.h (ASM_OUTPUT_ALIGNED_LOCAL): Put small data in the - .sbss section, not .sdata. - -1998-12-11 Manfred Hollstein - - * cccp.c: Do not #include here; this is already done - by "system.h". - * collect2.c: Likewise. - * cpplib.h: Likewise. - * gcc.c: Likewise. - * gcov.c: Likewise. - * getpwd.c: Likewise. - * protoize.c: Likewise. - * toplev.c: Likewise. - - * cpplib.h (HOST_WIDE_INT): Get definition from "machmode.h" - and don't try to define it here. - * Makefile.in (cppmain.o): Depend on machmode.h. - (cpplib.o): Likewise. - (cpperror.o): Likewise. - (cppexp.o): Likewise. - (cppfiles.o): Likewise. - (cpphash.o): Likewise. - (cppalloc.o): Likewise. - (fix-header.o): Likewise. - (scan-decls.o): Likewise. - -Fri Dec 11 11:02:49 1998 Stan Cox - - * sh.c (print_operand): Lookup interrupt_handler attribute instead - of relying on static variable. - * (calc_live_regs): Likewise. - * (sh_pragma_insert_attributes): Create interrupt_handler - attribute if a pragma was specified. - * (sh_valid_machine_decl_attribute): Don't set static flag. - * sh.h (PRAGMA_INSERT_ATTRIBUTES): New. - -Fri Dec 11 12:56:07 1998 J"orn Rennecke - - * reload1.c (reload_combine): Use BASIC_BLOCK_LIVE_AT_START - to determine if a register is live at a jump destination. - Everything is dead at a BARRIER. - -Thu Dec 10 16:02:06 1998 Jim Wilson - - * cse.c (simplify_unary_operation): Sign-extend constants when - they have the most significant bit set for the target. - * real.c (endian): Sign-extend 32 bit output values on a 64 bit - host. - * m32r/m32r.c (m32r_expand_prologue): Store pretend_size in - HOST_WIDE_INT temporary before negating it. - * m32r/m32r.md (movsi_insn+1): Use ~0xffff instead of 0xffff0000. - -Thu Dec 10 15:05:59 1998 Dave Brolley - - * objc/objc-act.c (lang_init_options): Enclose cpplib related code in - #if USE_CPPLIB. - -Thu Dec 10 13:39:46 1998 Kaveh R. Ghazi - - * collect2.h: New header file for prototypes. - - * Makefile.in (collect2.o, tlink.o): Depend on collect2.h. - - * collect2.c: Include collect2.h. - * tlink.c: Likewise. - -Wed Dec 9 23:55:11 1998 Jeffrey A Law (law@cygnus.com) - - * flow.c: Update some comments. - -Wed Dec 9 15:29:26 1998 Dave Brolley - - * objc/objc-act.c (cpp_initialized): Removed. - (lang_init_options): Initialize cpplib. - (lang_decode_option): Move initialization of cpplib to - lang_init_options. - * c-lang.c (parse_options,parse_in): Added. - (lang_init_options): Initialized cpplib here. - * c-decl.c (parse_options,cpp_initialized): Removed. - (c_decode_option): Move initialization of cpplib to - lang_init_options. - -Wed Dec 9 19:36:57 1998 J"orn Rennecke - - * reload1.c (reload_combine, reload_combine_note_store): - Make STORE_RUID always valid. - (reload_combine): Check if BASE is clobbered too early. - -Wed Dec 9 09:53:58 1998 Nick Clifton - - * reload.c (find_reloads): Display the insn that cannot be - reloaded. - -Wed Dec 9 12:15:26 1998 Dave Brolley - - * cccp.c (create_definition): Fix end of buffer logic. - -Wed Dec 9 10:15:45 1998 Kaveh R. Ghazi - - * except.c (duplicate_eh_handlers, rethrow_symbol_map): Function - pointer parameters changed to use the PARAMS() macro. - -Wed Dec 9 09:12:40 1998 Andrew MacLeod - - * except.h (struct handler_info): Add handler_number field. - * except.c (gen_exception_label): EH labels no longer need to be - on the permanent obstack. - (get_new_handler): Set the label number field. - (output_exception_table_entry): Regenerate handler label reference - from the label number field. - (init_eh): Remove a blank line. - * integrate.c (get_label_from_map): Labels no longer need to be - on the permanent obstack. - -Tue Dec 8 22:04:33 1998 Jim Wilson - - * i960/i960.h (CONST_COSTS, case CONST_INT): Accept power2_operand - only when OUTER_CODE is SET. - -Tue Dec 8 22:47:15 1998 J"orn Rennecke - - * loop.c (strength_reduce): If scan_start points to the loop exit - test, be wary of subversive use of gotos inside expression statements. - Don't set maybe_multiple for a backward jump that does not - include the label under consideration into its range. - * unroll.c (biv_total_increment): Make use of maybe_multiple field. - -Tue Dec 8 22:33:18 1998 J"orn Rennecke - - * explow.c (plus_constant_wide): Don't immediately return with - result of recursive call. - -Tue Dec 8 15:32:56 1998 Andrew MacLeod - - * eh-common.h (struct eh_context): Add table_index for rethrows. - - * rtl.h (enum reg_note): Add REG_EH_REGION and REG_EH_RETHROW reg notes. - (SYMBOL_REF_NEED_ADJUST): New flag indicating symbol needs to be - processed when inlined or unrolled (ie duplicated in some way). - - * rtl.c (reg_note_name): Add strings for new reg_note enums. - - * expr.h (rethrow_libfunc): New library decl. - - * optabs.c (rethrow_libfunc): Initialize. - - * except.h (struct eh_entry): Add new field 'rethrow_label'. - (new_eh_region_entry): No longer exported from except.c. - (duplicate_handlers): Renamed to duplicate_eh_handlers and - different prototype. - (rethrow_symbol_map, rethrow_used): New exported functions. - (eh_region_from_symbol): New exported function. - - * except.c (create_rethrow_ref): New function to create a single - SYMBOL_REF for a rethrow region. - (push_eh_entry): Initialize a rethrow ref. - (func_eh_entry): Add a rethrow_label field. - (new_eh_region_entry): Make static, and initialize the rethrow entry. - (duplicate_eh_handlers): Create a new region, and remap labels/symbols. - (eh_region_from_symbol): Find an EH region based on its rethrow symbol. - (rethrow_symbol_map): Given a label map, maps a rethrow symbol for - a region into an appropriate new symbol. - (rethrow_used): Indicate whether a rethrow symbol has been referenced. - (expand_eh_region_end): Don't issue jump around code for new-exceptions. - (end_catch_handler): Emit a barrier for new-exceptions since - control can never drop through the end of a catch block. - (expand_end_all_catch): new-exceptions never fall through a catch - block. - (expand_rethrow): Use __rethrow routine for new exceptions. - (output_exception_table_entry): Generate rethrow labels, if needed. - (output_exception_table): Generate start and end rethrow labels. - (init_eh): Create rethrow symbols for beginning and end of table. - (scan_region): Don't eliminate EH regions which are the targets of - rethrows. - - * flow.c (make_edges): Add different edges for rethrow calls, - identified by having the REG_EH_RETHROW reg label. - (delete_unreachable_blocks): Don't delete regions markers which are - the target of a rethrow. - - * integrate.c (save_for_inline_eh_labelmap): New callback routine to - allow save_for_inline_copying to call duplicate_eh_handlers. - (save_for_inline_copying): Call duplicate_eh_handlers instead of - exposing internal details of exception regions. - (copy_for_inline): Check if SYMBOL_REFs need adjustment. - (expand_inline_function_eh_labelmap): New callback routine to - allow expand_inline_function to call duplicate_eh_handlers. - (expand_inline_function): Call duplicate_eh_handlers instead of - exposing internal details of exception regions. - (copy_rtx_and_substitute): Adjust SYMBOL_REFS if SYMBOL_REF_NEED_ADJUST - flag is set. - - * libgcc2.c (find_exception_handler): Generalize to enable it to - pick up processing where it left off last time for a rethrow. - (__unwinding_cleanup): New function. debug hook which is called before - unwinding when __throw finds there is nothing but cleanups left. - (throw_helper): Common parts of __throw extracted out for reuse. - (__throw): Common parts moved to throw_helper. - (__rethrow): New function for performing rethrows. - -Tue Dec 8 13:11:04 1998 Jeffrey A Law (law@cygnus.com) - - * reload1.c (current_function_decl): Tweak declaration. - -Tue Dec 8 10:23:52 1998 Richard Henderson - - * c-decl.c (flag_isoc9x): Default off. - (c_decode_option): Kill -std=gnu, add -std=gnu89 and -std=gnu9x. - * cccp.c (print_help, main): Likewise. - * gcc.c (default_compilers): Update for -std=gnu*. - -Tue Dec 8 01:14:46 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (DEMANGLE_H): Change location to shared demangle.h. - * demangle.h: Deleted. - - * reload1.c (current_function_decl): Declare. - -Tue Dec 8 11:58:51 1998 Kaveh R. Ghazi - - * cpplib.c (convert_string): Use `0x00ff', not `0x00ffU'. - -Tue Dec 8 09:28:36 1998 Kaveh R. Ghazi - - * dbxout.c: If USG is defined use gstab.h, even if HAVE_STAB_H is set. - -1998-12-08 Ulrich Drepper - - * configure.in: Test for availability of putc_unlocked, fputc_unlocked, - and fputs_unlocked. - * configure: Rebuilt. - * system.h: If the *_unlocked functions are available use them - instead of the locked counterparts by defining macros. - * config.in: Regenerated. - -Tue Dec 8 00:34:05 1998 Mike Stump - - * i386/bsd.h (ASM_FILE_START): Don't use dump_base_name, it is - wrong and should only be used for dump related things, not - debugging information, instead main_input_filename should be used. - Also, reuse output_file_directive if possible. - * i386/aix386ng.h (ASM_FILE_START): Likewise. - * i386/isc.h (ASM_FILE_START): Likewise. - * i386/win-nt.h (ASM_FILE_START): Likewise. - * i386/sun386.h (ASM_FILE_START): Likewise. - -Mon Dec 7 23:56:28 1998 Robert Lipe - - * configure.in (mips*-*-linux*): Handle big and little endian - systems. - * configure: Rebuilt. - -Mon Dec 7 23:14:51 1998 Mike Stump - - * emit-rtl.c: Fix typo. - -Mon Dec 7 23:07:38 1998 Nathan Sidwell - - * reload1.c (eliminate_regs): Don't do anything, if we're not - generating code. - -Mon Dec 7 15:27:09 1998 DJ Delorie - - * mips/mips.h (ENCODE_SECTION_INFO): Handle TARGET_EMBEDDED_DATA. - Add comment. - * mips/mips.c (mips_select_section): Add comment. - -Mon Dec 7 17:55:06 1998 Mike Stump - - * cccp.c (ignore_escape_flag): Add support for \ as `natural' - characters in file names in #line to be consistent with #include - handling. We support escape processing in the # 1 "..." version of - the command. See also support in cp/lex.c. - (handle_directive): Likewise. - (do_line): Likewise. - -1998-12-07 Zack Weinberg - - * cpplib.c (initialize_char_syntax): Use ISALPHA and ISALNUM - so it'll work on non-ASCII platforms. Always consider $ an - identifier character. Take no arguments. - (cpp_reader_init): Call initialize_char_syntax with no - arguments. - (cpp_start_read): Don't call initialize_char_syntax again. - Clear is_idchar['$'] and is_idstart['$'] if not - opts->dollars_in_ident. - - * cpplib.h (struct cpp_reader): Replace void *data element by - cpp_options *opts. Rearrange elements to make gdb printout - less annoying (put buffer stack at end). - (CPP_OPTIONS): Get rid of now-unnecessary cast. - - * cppmain.c: s/data/opts/ when initializing cpp_reader - structure. - * c-decl.c: Likewise. - * objc/objc-act.c: Likewise. - * fix-header.c: Likewise. - -1998-12-07 Zack Weinberg - - * cpplib.h (struct cpp_buffer): Replace dir and dlen members - with a struct file_name_list pointer. - (struct cpp_reader): Add pointer to chain of `actual - directory' include searchpath entries. - (struct file_name_list): Add *alloc pointer for the sake of - the actual-directory chain. - - Move definition of HOST_WIDE_INT here. - (cpp_parse_escape): Change prototype to match changes in - cppexp.c. - - * cppfiles.c (actual_directory): New function. - (finclude): Use it to initialize the buffer's actual_dir - entry. - (find_include_file): We don't need to fix up max_include_len - here. - - * cpplib.c (do_include): Don't allocate a file_name_list on - the fly for current directory "" includes, use the one that's - been preallocated in pfile->buffer->actual_dir. Hoist out - duplicate code from the search_start selection logic. - (cpp_reader_init): Initialize pfile->actual_dirs. - - Remove definition of HOST_WIDE_INT. Change calls - to cpp_parse_escape to match changes in cppexp.c (note - hardcoded MASK, which is safe since this is the source - character set). - - * cppexp.c: Bring over changes to cpp_parse_escape from cccp.c - to handle wide character constants in #if directives. The - function now returns a HOST_WIDE_INT, and takes a third - argument which is a binary mask for all legal values (0x00ff - for 8-bit `char', 0xffff for 16-bit `wchar_t', etc.) Define - MAX_CHAR_TYPE_MASK and MAX_WCHAR_TYPE_MASK. Change callers of - cpp_parse_escape to match. [Fixes c-torture/execute/widechar-1.c] - -Mon Dec 7 15:38:25 1998 Dave Brolley - - * gcc.c (default_compilers): Fix typo in USE_CPPLIB spec for cc1. - -Mon Dec 7 15:38:25 1998 Kaveh R. Ghazi - - * c-aux-info.c (concat): Wrap function definition in !USE_CPPLIB. - * cppalloc.c: Move function `xcalloc' from cpplib.c to here. - * cpplib.c: Move function `xcalloc' from here to cppalloc.c. - -Mon Dec 7 11:30:49 1998 Nick Clifton - - * final.c (output_asm_name): Use tabs to separate comments from - assembly text. - - Include instruction lengths (if defined) in output. - -Mon Dec 7 10:53:38 1998 Michael Hayes - - * loop.c (check_dbra_loop): Fix initial_value and initial_equiv_value - in the loop_info structure. - -Mon Dec 7 11:04:40 1998 Catherine Moore - - * configure.in (arm*-*-ecos-elf): New target. - * configure: Regenerated. - * config/arm/elf.h (ASM_WEAKEN_LABEL): Define. - * config/arm/ecos-elf.h: New file. - * config/arm/unknown-elf.h (TARGET_VERSION): Check - for redefinition. - -Mon Dec 7 16:15:51 1998 J"orn Rennecke - - * sh.c (output_far_jump): Emit braf only for TARGET_SH2. - -Sun Dec 6 04:19:45 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Dec 6 05:16:16 1998 Michael Hayes - - * loop.c (check_dbra_loop): New argument loop_info. Update fields - as needed. - -Sun Dec 6 03:40:13 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Dec 6 07:49:29 1998 Alexandre Oliva - - * gcc.texi (Bug Reporting): 40Kb is a soft limit, larger - compressed reports are ok and preferred over URLs. - -Sun Dec 6 07:45:33 1998 Alexandre Oliva - - * invoke.texi (Warning Options): Soften the tone of -pedantic. - -Sun Dec 6 00:20:44 1998 H.J. Lu (hjl@gnu.org) - - * print-rtl.c (print_rtx): Add prototype. - - * unroll.c (iteration_info): Make it static. - -Sun Dec 6 01:19:46 1998 Richard Henderson - - * alias.c (memrefs_conflict_p): A second ANDed address - disables the aligned address optimization. - -Sat Dec 5 18:48:25 1998 Richard Henderson - - * alpha.c (alpha_emit_set_const_1): Fix parenthesis error - in -c << n case. - -Sat Dec 5 15:14:52 1998 Jason Merrill - - * i960.h (BOOL_TYPE_SIZE): Define. - -Sun Dec 6 00:28:16 1998 Michael Hayes - - * config/c4x/c4x.c (valid_parallel_load_store): Flog functionality - from old valid_parallel_operands_4. - (valid_parallel_operands_4): Check that operands for 4 operand - parallel insns are valid, excluding load/store insns. - * config/c4x/c4x.h (valid_parallel_load_store): Add prototype. - * config/c4x/c4x.md (*movqf_parallel, *movqi_parallel): Use - valid_parallel_load_store instead of valid_parallel_operands_4. - (*absqf2_movqf_clobber, *floatqiqf2_movqf_clobber, - *negqf2_movqf_clobber, *absqi2_movqi_clobber, - *fixqfqi2_movqi_clobber, *negqi2_movqi_clobber, - *notqi_movqi_clobber): Use valid_parallel_operands_4. - (*subqf3_movqf_clobber, *ashlqi3_movqi_clobber, - *ashrqi3_movqi_clobber, *lshrqi3_movqi_clobber, - *subqi3_movqi_clobber): Use valid_parallel_operands_5. - -Sat Dec 5 23:52:01 1998 Michael Hayes - - * config/c4x/c4x.c (iteration_info): Delete extern. - -Fri Dec 4 20:15:57 1998 Bernd Schmidt - - * tm.texi (SMALL_REGISTER_CLASSES): Make description match reality. - - * final.c (cleanup_subreg_operands): Delete some unused code. - - * recog.h (MAX_RECOG_ALTERNATIVES): New macro. - (struct insn_alternative): New structure definition. - (recog_op_alt): Declare variable. - (preprocess_constraints): Declare function. - * recog.c (recog_op_alt): New variable. - (extract_insn): Verify number of alternatives is in range. - (preprocess_constraints): New function. - * reg-stack.c: Include recog.h. - (constrain_asm_operands): Delete. - (get_asm_operand_lengths): Delete. - (get_asm_operand_n_inputs): New function. - (record_asm_reg_life): Delete OPERANDS, CONSTRAINTS, N_INPUTS and - N_OUTPUTS args. All callers changed. - Compute number of inputs and outputs here by calling - get_asm_operand_n_inputs. - Instead of constrain_asm_operands, call extract_insn, - constrain_operands and preprocess_constraints. Use information - computed by these functions throughout. - (record_reg_life): Delete code that is unused due to changes in - record_asm_reg_life. - (subst_asm_stack_regs): Delete OPERANDS, OPERAND_LOC, CONSTRAINTS, - N_INPUTS and N_OUTPUTS args. All callers changed. - Similar changes as in record_asm_reg_life. - (subst_stack_regs): Move n_operands declaration into the if statement - where it's used. - Delete code that is unused due to changes in subst_asm_stack_regs. - * stmt.c (expand_asm_operands): Verify number of alternatives is in - range. - * Makefile.in (reg-stack.o): Depend on recog.h. - -Fri Dec 4 02:23:24 1998 Jeffrey A Law (law@cygnus.com) - - * except.c (set_exception_version_code): Argument is an "int". - -Fri Dec 4 01:29:28 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in (hppa2*-*-*): Handle like hppa1.1-*-* for now. - * configure: Rebuilt. - -Fri Dec 4 01:29:28 1998 Robert Lipe - - * configure.in (mipsel-*-linux*): New target. - * mips/linux.h: New file, based on other Linux targets. - -Thu Dec 3 11:19:50 1998 Mike Stump - - * gthr-vxworks.h (__ehdtor): Fix memory leak. The delete hook - runs in the context of the deleter, not the deletee, so we must - use taskVarGet to find the correct memory to free. - (__gthread_key_create): Initialize the task - variable subsystem so that the task variable is still active when - the delete hook is run. - -1998-12-03 Joseph S. Myers - - * pdp11.h: Use optimize_size for space optimizations. - * pdp11.c: Likewise. - * pdp11.md: Likewise. - - * pdp11.h (TARGET_40_PLUS): Fix typo. - -Thu Dec 3 11:48:32 1998 Jeffrey A Law (law@cygnus.com) - - * local-alloc.c (block_alloc): Slightly retune heuristic to widen - qty lifetimes. - -Thu Dec 3 22:30:18 1998 Michael Hayes - - * alias.c (addr_side_effect_eval): New function. - (memrefs_conflict_p): Use it. - * rtl.h (addr_side_effect_eval): Prototype it. - -1998-12-02 Joseph S. Myers - - * pdp11.md (extendsfdf2): Fix mode mismatch in SET. - -Wed Dec 2 11:23:07 1998 Jim Wilson - - * reload.c (find_reloads): When force const to memory, put result - in substed_operand not *recog_operand_loc. - -1998-12-02 Ulrich Drepper - - * c-lex.c: Fix indentation from last patch. - Remove trailing whitespace. - * real.c: Likewise. - -Wed Dec 2 10:11:12 1998 Jeffrey A Law (law@cygnus.com) - - * flow.c (delete_block): Call set_last_insn after we have reset - NEXT_INSN (kept_tail). - -Wed Dec 2 00:47:31 1998 Jeffrey A Law (law@cygnus.com) - - * mips.md (trap_if): Use "$0" for the value zero. - -Tue Dec 1 20:49:49 1998 Ulrich Drepper - Stephen L Moshier - Richard Henderson - - * c-common.c (declare_function_name): Declare predefined variable - `__func__'. - - * c-decl.c (flag_isoc9x): Set to 1 by default. - (c_decode_option): Handle -std= option. Remove -flang-isoc9x. - (grokdeclarator): Always emit warning about implicit int for ISO C 9x. - - * c-parse.in: Allow constructors in ISO C 9x. - Rewrite designator list handling. - Allow [*] parameters. - Don't warn about comma at end of enum definition for ISO C 9x. - - * cccp.c (c9x): New variable. - (rest_extension): New variable. - (print_help): Document new -std= option. - (main): Recognize -std= option. Set c9x appropriately. - (create_definition): Recognize ISO C 9x vararg macros. - - * gcc.c (default_compilers): Adjust specs for -std options. - (option_map): Add --std. - (display_help): Document -std. - - * toplev.c (documented_lang_options): Add -std and remove - -flang-isoc9x. - - * c-lex.c (yylex): Recognize hex FP constants and call REAL_VALUE_ATOF - or REAL_VALUE_HTOF based on base of the constants. - * fold-const.c (real_hex_to_f): New function. Replacement function - for hex FP conversion if REAL_ARITHMETIC is not defined. - * real.c (asctoeg): Add handling of hex FP constants. - * real.h: Define REAL_VALUE_HTOF if necessary using ereal_atof or - real_hex_to_f. - -Tue Dec 1 16:45:49 1998 Stan Cox - - * mips.md (divmodsi4*, divmoddi4*, udivmodsi4*, udivmoddi4): Add - -mcheck-range-division/-mcheck-zero-division checking. Avoid as macro - expansion. Use hi/lo as destination register. - (div_trap): New. - (divsi3*, divdi3*, modsi3*, moddi3*, udivsi3*, udivdi3*, umodsi3*, - umoddi3*): Add -mcheck-range-division/-mcheck-zero-division checking. - Avoid as macro expansion. Use hi/lo as destination register. - - * mips.h (MASK_CHECK_RANGE_DIV): New. - (MASK_NO_CHECK_ZERO_DIV): New. - (ELIMINABLE_REGS): Added GP_REG_FIRST + 31. - (CAN_ELIMINATE, INITIAL_ELIMINATION_OFFSET): Allow for getting - return address for leaf functions out of r31 to support - builtin_return_address. - -Tue Dec 1 15:03:30 1998 Herman A.J. ten Brugge - - * jump.c (jump_optimize): Call regs_set_between_p with PREV_INSN(x), - NEXT_INSN(x) to check insn x. - -Tue Dec 1 15:20:44 1998 Jeffrey A Law (law@cygnus.com) - - * flow.c (delete_block): Call set_last_insn if we end up deleting the - last insn in the rtl chain. - - * reload1.c (reload): Do not set reload_completed or split insns - here. Instead... - * toplev.c (rest_of_compilation): Set reload_completed after - reload returns. Split insns after reload_cse has run. - -Tue Dec 1 11:55:04 1998 Richard Henderson - - * final.c (final_scan_insn): Abort if block_depth falls below 0. - -Tue Dec 1 10:23:16 1998 Nick Clifton - - * config/arm/t-arm-elf (LIBGCC2_CFLAGS): Define inhibit_libc. - -Tue Dec 1 10:22:18 1998 Nick Clifton - - * config/arm/unknown-elf.h (ASM_OUTPUT_DWARF2_ADDR_CONST): Remove - use of user-label_prefix. - -Tue Dec 1 17:58:26 1998 J"orn Rennecke - - * reload1.c (emit_reload_insns): Clear spill_reg_store - when doing a new non-inherited reload from the same pseudo. - - * local-alloc.c (function_invariant_p): New function. - (update_equiv_regs): Use function_invariant_p instead of CONSTANT_P - to decide if an equivalence should be recorded. - * reload1.c (num_eliminable_invariants): New static variable. - (reload): Set it. Use function_invariant_p instead of CONSTANT_P - to decide if an equivalence should be recorded. - Unshare PLUS. - (calculate_needs_all_insns): Skip insns that only set an equivalence. - Take num_eliminable_invariants into account when deciding - if register elimination should be done. - (reload_as_needed): Take num_eliminable_invariants into account - when deciding if register elimination should be done. - (eliminate_regs): Handle non-constant reg_equiv_constant. - * rtl.h (function_invariant_p): Declare. - -Mon Nov 30 02:00:08 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Nov 30 00:42:59 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Nov 29 22:59:40 1998 Jason Merrill - - * except.c (add_new_handler): Complain about additional handlers - after one that catches everything. - -Sat Nov 28 10:56:32 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in (alpha*-*-netbsd): Fix typo. - * configure: Rebuilt. - -Fri Nov 27 12:28:56 1998 Kaveh R. Ghazi - - * system.h: Include libiberty.h. - - * c-aux-info.c: Remove prototypes for concat/concat3. Change - function `concat' from fixed parameters to variable parameters, - as is done in libiberty. All callers of concat/concat3 - changed to use the new `concat' with variable args. - - * cccp.c: Remove things made redundant by libiberty.h and/or - conform to libiberty standards. - * cexp.y: Likewise. - * collect2.c: Likewise. - * config/1750a/1750a.h: Likewise. - * cppalloc.c: Likewise. - * cppexp.c: Likewise. - * cppfiles.c: Likewise. - * cpphash.c: Likewise. - * cpplib.c: Likewise. - * dyn-string.c: Likewise. - * fix-header.c: Likewise. - * gcc.c: Likewise. - * gcov.c: Likewise. - * genattr.c: Likewise. - * genattrtab.c: Likewise. - * gencheck.c: Likewise. - * gencodes.c: Likewise. - * genconfig.c: Likewise. - * genemit.c: Likewise. - * genextract.c: Likewise. - * genflags.c: Likewise. - * gengenrtl.c: Likewise. - * genopinit.c: Likewise. - * genoutput.c: Likewise. - * genpeep.c: Likewise. - * genrecog.c: Likewise. - * getpwd.c: Likewise. - * halfpic.c: Likewise. - * hash.c: Likewise. - * mips-tdump.c: Likewise. Wrap malloc/realloc/calloc prototypes - in NEED_DECLARATION_* macros. - - * mips-tfile.c: Remove things made redundant by libiberty.h and/or - conform to libiberty standards. - (fatal): Fix const-ification of variable `format' in - !ANSI_PROTOTYPES case. - - * prefix.c: Remove things made redundant by libiberty.h and/or - conform to libiberty standards. - - * print-rtl.c: Rename variable `spaces' to `xspaces' to avoid - conflicting with function `spaces' from libiberty. - - * profile.c: Remove things made redundant by libiberty.h and/or - conform to libiberty standards. - * protoize.c: Likewise. - * rtl.h: Likewise. - * scan.h: Likewise. - * tlink.c: Likewise. - * toplev.c: Likewise. - * toplev.h: Likewise. - * tree.h: Likewise. - -Thu Nov 26 08:38:06 1998 Kaveh R. Ghazi - - * cppfiles.c (simplify_pathname): Un-ANSI-fy function definition. - -Thu Nov 26 23:45:37 1998 Michael Hayes - - * README.C4X: Updated URLs. - * config/c4x/c4x.c (c4x_address_conflict): Fix typo. - (valid_parallel_operands_5): Remove unused variable. - -Thu Nov 26 23:40:03 1998 Michael Hayes - - * config/c4x/c4x.h (TARGET_DEFAULT): Fix typo. - -1998-11-26 Manfred Hollstein - - * Makefile.in (CONFIG_LANGUAGES): New macro taking all languages - which can be configured. - (LANGUAGES): Use $(CONFIG_LANGUAGES) instead of @all_languages@ - (Makefile): Pass actual LANGUAGES through the environment when - re-configuring. - (cstamp-h): Likewise. - (config.status): Likewise. - - * configure.in (enable_languages): Add new configuration parameter - "--enable-languages=lang1,lang2,...". - (${srcdir}/*/config-lang.in): Change handling to configure only - those directories, that the user might have enabled; default to - "all" existing languages. - * configure: Regenerate. - -Thu Nov 26 00:19:19 1998 Richard Henderson - - * rtlanal.c (regs_set_between_p): New function. - * rtl.h (regs_set_between_p): Prototype it. - * jump.c (jump_optimize): Use it instead of modified_between_p - in the Sep 2 change. - -Wed Nov 25 23:32:02 1998 Ian Dall - Matthias Pfaller - - * invoke.texi (Option Summary, NS32K Options): Add description - of NS32K specific options. - - * ns32k.md (tstdf, cmpdf, movdf, truncdfsf2, fixdfqi2, fixdfhi2, - fixdfsi2, fixunsdfqi2, fixunsdfhi2, fixunsdfsi2, fix_truncdfqi2, - fix_truncdfhi2, fix_truncdfsi2, adddf3, subdf3, muldf3, divdf3, - negdf2, absdf2): Use l instead of f since the double class and - float class are no longer the same. - (cmpsi, truncsiqi2, truncsihi2, addsi3, subsi3, mulsi3, umulsidi3, - divsi3, modsi3, andsi3, iorsi3, xorsi3, negsi2, one_cmplsi2, - ashlsi3, ashlhi3, ashlqi3, rotlsi3, rotlhi3, rotlqi3, abssi2,...): - Use "g" instead of "rmn" since LEGITIMATE_PIC_OPERAND has been - fixed. - (cmpsi, cmphi, cmpqi): Use general_operand instead of - non_immediate_operand. Removes erroneous assumption that can't - compare constants. - (movsf, movsi, movhi, movqi,...): New register numbering scheme. - (movsi, addsi3): Use NS32K_DISPLACEMENT_P instead of hard coded - constants. - (movstrsi, movstrsi1, movstrsi2): Completely new block move - scheme. - (...): Patterns to exploit multiply-add instructions. - (udivmodsi4, udivmodsi_internal4, udivmodhi4, - udivmoddihi4_internal, udivmodqi4, udivmoddiqi4_internal): New - patterns to exploit extended divide insns. - (udivsi3, udivhi3, udivqi3): Remove since superseded by udivmodsi - etc patterns. - - * ns32k.h (FUNCTION_VALUE, LIBCALL_VALUE): Use f0 for complex - float return values as well as simple scalar floats. - (TARGET_32381, TARGET_MULT_ADD, TARGET_SWITCHES): - Support new flag to denote 32381 fpu. - (OVERRIDE_OPTIONS): 32381 is a strict superset of 32081. - (CONDITIONAL_REGISTER_USAGE): Disable extra 32381 registers if not - compiling for 32381. - (FIRST_PSEUDO_REGISTER, FIXED_REGISTERS, CALL_USED_REGISTERS, - REGISTER_NAMES, ADDITIONAL_REGISTER_NAMES, OUTPUT_REGISTER_NAMES, - REG_ALLOC_ORDER, DBX_REGISTER_NUMBER, R0_REGNUM, F0_REGNUM, - L1_REGNUM, STACK_POINTER_REGNUM, FRAME_POINTER_REGNUM, - LONG_FP_REGS_P, ARG_POINTER_REGNUM, reg_class, REG_CLASS_NAMES, - REG_CLASS_CONTENTS, SUBSET_P,REGNO_REG_CLASS, - REG_CLASS_FROM_LETTER, FUNCTION_PROLOGUE, FUNCTION_EPILOGUE, - REGNO_OK_FOR_INDEX_P, FP_REG_P, REG_OK_FOR_INDEX_P, - REG_OK_FOR_BASE_P, MEM_REG): New register scheme to include 32381 - fpu registers and special register classes for new 32381 - instructions dotf and polyf. - (MODES_TIEABLE_P): Allow all integer modes, notably DI and SI, to - be tieable. - (INCOMING_RETURN_ADDR_RTX, RETURN_ADDR_RTX, - INCOMING_FRAME_SP_OFFSET): New macros in case DWARF support is - required. - (SMALL_REGISTER_CLASSES): Make dependent on -mmult-add option. - (MOVE_RATIO): Set to zero because of smart movstrsi implementation. - (REGISTER_MOVE_COST): Move code to register_move_cost function for - ease of coding and debugging. - (CLASS_LIKELY_SPILLED_P): Under new register scheme class - LONG_FLOAT_REGO is likely spilled but not caught by default - definition. - (CONSTANT_ADDRESS_P, CONSTANT_ADDRESS_NO_LABEL_P): Use macro - instead of hard coded numbers in range check. - (ASM_OUTPUT_LABELREF_AS_INT): Delete since unused. - (...): Add prototypes for functions in ns32k.c but disable because - of problems when ns32k.h is included in machine independent files. - - * ns32k.c: Include "system.h", "tree.h", "expr.h", "flags.h". - (ns32k_reg_class_contents, regcass_map, ns32k_out_reg_names, - hard_regno_mode_ok, secondary_reload_class, - print_operand, print_operand_address): New register scheme to - include 32381 fpu registers and special register classes for new - 32381 instructions dotf and polyf. - (gen_indexed_expr): Make static to keep namespace clean. - (check_reg): Remove since never called. - (move_tail, expand_block_move): Helper functions for "movstrsi" - block move insn. - (register_move_cost): Helper function for REGISTER_MOVE_COST macro. - Increase cost of moves which go via memory. - * netbsd.h (TARGET_DEFAULT): Set (new) 32381 fpu flag. - (CPP_PREDEFINES): No longer predefine "unix". - - * ns32k.md (movsi, movsi, adddi3, subdi3, subsi3, subhi3, subqi3,...): - Remove erroneous %$. print_operand() can work out from the rtx is - an immediate prefix is required. - - * ns32k.h (RETURN_POPS_ARGS, VALID_MACHINE_DECL_ATTRIBUTE, - VALID_MACHINE_TYPE_ATTRIBUTE, COMP_TYPE_ATTRIBUTES, - SET_DEFAULT_TYPE_ATTRIBUTES): Support for -mrtd calling - convention. - (LEGITIMATE_PIC_OPERAND_P, SYMBOLIC_CONST): Correct handling of - pic operands. - - * ns32k.c (symbolic_reference_mentioned_p, print_operand): - Correct handling of pic operands. - (ns32k_valid_decl_attribute_p, ns32k_valid_type_attribute_p, - ns32k_comp_type_attributes, ns32k_return_pops_args): Support for - -mrtd calling convention. - -Wed Nov 25 23:42:20 1998 Tom Tromey - - * gcc.c (option_map): Recognize --output-class-directory. - -Thu Nov 26 18:26:21 1998 Michael Hayes - - * loop.h (precondition_loop_p): Added new mode argument. - * unroll.c (precondition_loop_p): Likewise. - (approx_final_value): Function deleted and subsumed - into loop_iterations. - (loop_find_equiv_value): New function. - (loop_iterations): Use loop_find_equiv_value to find increments - too large to be immediate constants. Also use it to find terms - common to initial and final iteration values that can be removed. - -Thu Nov 26 18:05:04 1998 Michael Hayes - - * loop.h (struct loop_info): Define new structure. - (precondition_loop_p): Added prototype. - (unroll_loop): Added new argument loop_info to prototype. - (final_biv_value, final_giv_value): Added new argument n_iterations - to prototype. - * loop.c (strength_reduce): Declare new structure loop_iteration_info - and new pointer loop_info. - (loop_n_iterations): Replace global variable by element in - loop_info structure. - (check_final_value): New argument n_iterations. - (insert_bct): New argument loop_info. - (loop_unroll_factor): Replace global array by element in - loop_info structure. - (loop_optimize): Remove code to allocate and initialize - loop_unroll_factor_array. - * unroll.c (precondition_loop_p): No longer static since - used by branch on count optimization. - (precondition_loop_p, unroll_loop): New argument loop_info. - (final_biv_value, final_giv_value, find_splittable_regs): New - argument n_iterations. - (loop_iteration_var, loop_initial_value, loop_increment, - loop_final_value, loop_comparison_code, loop_unroll_factor): - Replaced global variables by loop_info structure. - (loop_unroll_factor): Replace global array by element in - loop_info structure. - -Thu Nov 26 17:49:29 1998 Michael Hayes - - * loop.c (check_dbra_loop): Update JUMP_LABEL field of jump insn - when loop reversed. - - * unroll.c (precondition_loop_p): Return loop_initial_value - for initial_value instead of loop_iteration_var. - -Thu Nov 26 17:15:38 1998 Michael Hayes - - * config/c4x/c4x.md: Fix minor formatting problems. Update docs. - (*b, *b_rev, *b_noov, *b_noov_rev, *db, - decrement_and_branch_until_zero, rptb_end): Use c4x_output_cbranch - to output the instruction sequences. - (rpts): Delete. - (rptb_top): Provide alternatives to use any register or memory - for loop counter. - (rptb_end): Emit use of operands rather than assigning them - explicitly to the RS and RE registers. - -Thu Nov 26 16:37:59 1998 Michael Hayes - - * config/c4x/c4x.c (c4x_modified_between_p, c4x_mem_set_p, - c4x_mem_set_p, c4x_mem_modified_between_p, c4x_insn_moveable_p, - c4x_parallel_pack, c4x_parallel_find, c4x_update_info_reg, - c4x_update_info_regs, c4x_copy_insn_after, c4x_copy_insns_after, - c4x_merge_notes, c4x_parallel_process, - c4x_combine_parallel_independent, c4x_combine_parallel_dependent, - c4x_combine_parallel): Delete. - -Thu Nov 26 15:16:05 1998 Michael Hayes - - * config/c4x/c4x.c (c4x_override_options): For compatibility - with old target options clear flag_branch_on_count_reg if - -mno-rptb specified and set flag_argument_alias is -mno-aliases - specified. - (c4x_output_cbranch): Handle a sequence of insns rather than a - single insn. - (c4x_rptb_insert): Do not emit a RPTB insn if the RC register - has not been allocated as the loop counter. - (c4x_address_conflict): Do not allow two volatile memory references. - (valid_parallel_operands_4, valid_parallel_operands_5, - valid_parallel_operands_6): Reject pattern if the register destination - of the first set is used as part of an address in the second set. - -Thu Nov 26 14:56:32 1998 Michael Hayes - - * config/c4x/c4x.h (TARGET_DEFAULT): Add PARALEL_MPY_FLAG. - (TARGET_SMALL_REG_CLASS): Set to 0 so that SMALL_REGISTER_CLASSES - is no longer enabled if PARALLEL_MPY_FLAG set. - (HARD_REGNO_CALL_CLOBBERED): Add parentheses to remove ambiguity. - (REG_CLASS_CONTENTS): Add braces around initializers. - (HAVE_MULTIPLE_PACK): Define. - (ASM_OUTPUT_BYTE_FLOAT): Use %lf format specifier with - REAL_VALUE_TO_DECIMAL. - (ASM_OUTPUT_SHORT_FLOAT): Use %lf format specifier with - REAL_VALUE_TO_DECIMAL. - (ar0_reg_operand): Add prototype. - (ar0_mem_operand): Likewise. - (ar1_reg_operand): Likewise. - (ar1_mem_operand): Likewise. - (ar2_reg_operand): Likewise. - (ar2_mem_operand): Likewise. - (ar3_reg_operand): Likewise. - (ar3_mem_operand): Likewise. - (ar4_reg_operand): Likewise. - (ar4_mem_operand): Likewise. - (ar5_reg_operand): Likewise. - (ar5_mem_operand): Likewise. - (ar6_reg_operand): Likewise. - (ar6_mem_operand): Likewise. - (ar7_reg_operand): Likewise. - (ar7_mem_operand): Likewise. - (ir0_reg_operand): Likewise. - (ir0_mem_operand): Likewise. - (ir1_reg_operand): Likewise. - (ir1_mem_operand): Likewise. - (group1_reg_operand): Likewise. - (group1_mem_operand): Likewise. - (ir1_reg_operand): Likewise. - (arx_reg_operand): Likewise. - (not_rc_reg): Likewise. - (not_modify_reg): Likewise. - (c4x_group1_reg_operand): Remove prototype. - (c4x_group1_mem_operand): Likewise. - (c4x_arx_reg_operand): Likewise. - -Wed Nov 25 19:02:55 1998 (Stephen L Moshier) - - * emit-rtl.c (gen_lowpart_common): Remove earlier change. - * real.c (make_nan): Make SIGN arg actually specify the sign bit. - -Thu Nov 26 14:12:05 1998 Michael Hayes - - * config/c4x/c4x.md (addqi3): Emit addqi3_noclobber pattern - during reload. - -Wed Nov 25 22:05:28 1998 J"orn Rennecke - - * config/sh/lib1funcs.asm (___udivsi3_i4): Don't switch to sz == 1 - unless FMOVD_WORKS is defined. - -Wed Nov 25 20:11:04 1998 J"orn Rennecke - - * regclass.c (init_reg_sets): Move code that calculates tables - dependent on reg_class_contents from here... - (init_reg_sets_1): To here. - -Wed Nov 25 14:54:46 1998 Zack Weinberg - - * cpplib.h: Delete struct import_file. Add ihash element to - struct cpp_buffer. Delete dont_repeat_files and - import_hash_table elements from cpp_reader; change - all_include_files to a hash table. Delete all foobar_include - / last_foobar_include elements from struct cpp_options; put - back four such: quote_include, bracket_include, - system_include, after_include. Redo struct file_name_list - completely. Add new structure type include_hash. Add - prototypes for merge_include_chains and include_hash. Change - prototypes for finclude, find_include_file, and - append_include_chain to match changes below. - - * cppfiles.c (simplify_pathname, include_hash, - remap_filename, merge_include_chains): New functions. - (add_import, lookup_import, open_include_file): Removed. - (INO_T_EQ): Define this (copied from cccp.c). - (hack_vms_include_specification): Remove all calls and #if 0 - out the definition. It was being called incorrectly and at - the wrong times. Until a VMSie can look at this, it's better - to not pretend to support it. - (append_include_chain): Change calling convention; now takes - only one directory at a time, and sets up the data structure - itself. - (redundant_include_p): Rewritten - this is now used for all - include redundancy, whether by #ifndef, #import, or #pragma - once. Looks up things in the include hash table. - (file_cleanup): Decrement pfile->system_include_depth here if - it's >0. - (find_include_file): Calling convention changed; now passes - around a struct include_hash instead of 3 separate parameters. - Guts ripped out and replaced with new include_hash mechanism. - (finclude): Calling convention changed as for - find_include_file. Error exits pulled out-of-line. Reformat. - (safe_read): Return a long, not an int. - (deps_output): Don't recurse. - - * cpplib.c (is_system_include): Deleted. - (path_include): Fix up call to append_include_chain. - (do_include): Fix up calls to find_include_file and finclude. - Clean up dependency output a bit. Shorten obnoxiously lengthy - #import warning message. Don't decrement - pfile->system_include_depth here. - (do_pragma): Understand the include_hash structure. Reformat. - (do_endif): Correct handling of control macros. Understand - the include_hash. - (cpp_start_read): Fix up calls to finclude. Call - merge_include_chains. - (cpp_handle_option): Fix up calls to append_include_chain. - Understand the four partial include chains. - (cpp_finish): Add debugging code (#if 0-ed out) for the - include_hash. - (cpp_cleanup): Free the include_hash, not the import hash and - the all_include and dont_repeat lists which no longer exist. - -Wed Nov 25 11:26:19 1998 Jeffrey A Law (law@cygnus.com) - - * toplev.c (no_new_pseudos): Define. - (rest_of_compilation): Set no_new_pseudos as needed. - * emit-rtl.c (gen_reg_rtx): Abort if we try to create a new pseudo - if no_new_pseudos is set. - * rtl.h (no_new_pseudos): Declare it. - * reload1.c (reload): Update comments. - * md.texi: Corresponding changes. - -Wed Nov 25 11:26:17 1998 Bernd Schmidt - - * reload1.c (reg_used_in_insn): Renamed from reg_used_by_pseudo. - (choose_reload_regs): Rename it here as well. When computing it, - also merge in used hardregs. - -1998-11-25 Zack Weinberg - - * gcc.c: Split out Objective-C specs to... - * objc/lang-specs.h: here. (New file.) Make the specs cpplib - aware. - - * c-lex.c (init_parse): Always initialize the filename global. - * objc/objc-act.c (lang_init): Always call check_newline at - beginning of file. - -Wed Nov 25 00:48:29 1998 Graham - - * reload1.c (reload): Remove unused variable. - (reload_reg_free_for_value_p): Add missing parameter definition. - - * jump.c (jump_optimize): Remove unused variable. - -Wed Nov 25 00:07:11 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (graph.o): Depend on $(RTL_H), not rtl.h. - - * cse.c (fold_rtx): Make autoincrement addressing mode tests be - runtime selectable. - * expr.c (move_by_pieces): Similarly. - (move_by_pieces_1, clear_by_pieces, clear_by_pieces_1): Similarly. - * flow.c (find_auto_inc): Similarly. - (try_pre_increment): Similarly. - * loop.c (strength_reduce): Similarly. - * regclass.c (auto_inc_dec_reg_p): Similarly. - * regmove.c (try_auto_increment): Similarly. - (fixup_match_1): Similarly. - * rtl.h (HAVE_PRE_INCREMENT): Define if not already defined. - (HAVE_PRE_DECREMENT): Similarly. - (HAVE_POST_INCREMENT, HAVE_POST_DECREMENT): Similarly. - * Corresponding changes to all target header files. - * tm.texi: Update docs for autoinc addressing modes. - -Tue Nov 24 20:24:59 1998 Jim Wilson - - * configure.in (m68020-*-elf*, m68k-*-elf*): New targets. - * configure: Rebuild. - * config/elfos.h: New file. - * config/m68k/m68020-elf.h, config/m68k/m68kelf.h, - config/m68k/t-m68kelf: New file. - -Tue Nov 24 13:40:06 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (HOST_AR): Define. - (HOST_AR_FLAGS, HOST_RANLIB, HOST_RANLIB_TEST): Similarly. - (libcpp.a): Use the host tools explicitly. - (STAGESTUFF): Add libcpp.a. - -Tue Nov 24 09:33:49 1998 Nick Clifton - - * config/m32r/m32r.md (movstrsi_internal): Describe changes made - to source and destination registers. - -Mon Nov 23 20:28:02 1998 Mike Stump - - * libgcc2.c (top_elt): Remove top_elt, it isn't thread safe. - The strategy we now use is to pre allocate the top_elt along - with the EH context so that each thread has its own top_elt. - This is necessary as the dynamic cleanup chain is used on the - top element of the stack and each thread MUST have its own. - (eh_context_static): Likewise. - (new_eh_context): Likewise. - (__sjthrow): Likewise. - -Mon Nov 23 20:25:03 1998 Jason Merrill - - * i386/linux.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Wrap in do...while. - * i386.md (prologue_get_pc): Remove unused variable. - -Mon Nov 23 17:05:40 1998 Geoffrey Noer - - * i386/xm-cygwin.h: Rename cygwin_ path funcs back to cygwin32_. - -Mon Nov 23 16:40:00 1998 Ulrich Drepper - - * Makefile.in (OBJS): Add graph.o. - (graph.o): New dependency list. - * flags.h: Declare dump_for_graph and define graph_dump_types type. - * print-rtl.c (dump_for_graph): Define new variable. - (print_rtx): Rewrite to allow use in graph dumping functions. - * toplev.c: Declare print_rtl_graph_with_bb, clean_graph_dump_file, - finish_graph_dump_file. - Define graph_dump_format. - (compile_file): If graph dumping is enabled also clear these files. - Finish graph dump files. - (rest_of_compilation): Also dump graph information if enabled. - (main): Recognize -dv to enabled VCG based graph dumping. - * graph.c: New file. Graph dumping functions. - -Mon Nov 23 16:39:04 1998 Richard Henderson - - * configure.in: Look for . - * system.h: Include it before substitute S_ISREG definitions. - -Mon Nov 23 17:40:37 1998 Gavin Romig-Koch - - * config/mips/abi.h: Use ABI_O64, duplicating ABI_32 usage. - * config/mips/iris6.h: Same. - * config/mips/mips.md: Same. - * config/mips/mips.c: Same; also add "-mabi=o64" option. - * config/mips/mips.h: Same; also define ABI_O64. - -Mon Nov 23 17:02:27 1998 Kaveh R. Ghazi - - * configure.in: Use AC_PREREQ(2.12.1). - -Mon Nov 23 10:16:38 1998 Melissa O'Neill - - * cccp.c (S_ISREG, S_ISDIR): Delete defines. - * cpplib.c, gcc.c: Likewise. - * system.h (S_ISREG, S_ISDIR): Define if not already defined. - -Mon Nov 23 09:53:44 1998 Richard Henderson - - * local-alloc.c (local_alloc): Use malloc not alloca for - reg_qty, reg_offset, ref_next_in_qty. - -Mon Nov 23 16:46:46 1998 J"orn Rennecke - - * caller-save.c (insert_one_insn): Initialize the live_before and - live_after register sets. - - Add SH4 support: - - * config/sh/lib1funcs.asm (___movstr_i4_even, ___movstr_i4_odd): Define. - (___movstrSI12_i4, ___sdivsi3_i4, ___udivsi3_i4): Define. - * sh.c (reg_class_from_letter, regno_reg_class): Add DF_REGS. - (fp_reg_names, assembler_dialect): New variables. - (print_operand_address): Handle SUBREGs. - (print_operand): Added 'o' case. - Don't use adj_offsettable_operand on PRE_DEC / POST_INC. - Name of FP registers depends on mode. - (expand_block_move): Emit different code for SH4 hardware. - (prepare_scc_operands): Use emit_sf_insn / emit_df_insn as appropriate. - (from_compare): Likewise. - (add_constant): New argument last_value. Changed all callers. - (find_barrier): Don't try HImode load for FPUL_REG. - (machine_dependent_reorg): Likewise. - (sfunc_uses_reg): A CLOBBER cannot be the address register use. - (gen_far_branch): Emit a barrier after the new jump. - (barrier_align): Don't trust instruction lengths before - fixing up pcloads. - (machine_dependent_reorg): Add support for FIRST_XD_REG .. LAST_XD_REG. - Use auto-inc addressing for fp registers if doubles need to - be loaded in two steps. - Set sh_flag_remove_dead_before_cse. - (push): Support for TARGET_FMOVD. Use gen_push_fpul for fpul. - (pop): Support for TARGET_FMOVD. Use gen_pop_fpul for fpul. - (calc_live_regs): Support for TARGET_FMOVD. Don't save FPSCR. - Support for FIRST_XD_REG .. LAST_XD_REG. - (sh_expand_prologue): Support for FIRST_XD_REG .. LAST_XD_REG. - (sh_expand_epilogue): Likewise. - (sh_builtin_saveregs): Use DFmode moves for fp regs on SH4. - (initial_elimination_offset): Take TARGET_ALIGN_DOUBLE into account. - (arith_reg_operand): FPUL_REG is OK for SH4. - (fp_arith_reg_operand, fp_extended_operand): New functions. - (tertiary_reload_operand, fpscr_operand): Likewise. - (commutative_float_operator, noncommutative_float_operator): Likewise. - (binary_float_operator, get_fpscr_rtx, emit_sf_insn): Likewise. - (emit_df_insn, expand_sf_unop, expand_sf_binop): Likewise. - (expand_df_unop, expand_df_binop, expand_fp_branch): Likewise. - (emit_fpscr_use, mark_use, remove_dead_before_cse): Likewise. - * sh.h (CPP_SPEC): Add support for -m4, m4-single, m4-single-only. - (CONDITIONAL_REGISTER_USAGE): Likewise. - (HARD_SH4_BIT, FPU_SINGLE_BIT, SH4_BIT, FMOVD_BIT): Define. - (TARGET_CACHE32, TARGET_SUPERSCALAR, TARGET_HARWARD): Define. - (TARGET_HARD_SH4, TARGET_FPU_SINGLE, TARGET_SH4, TARGET_FMOVD): Define. - (target_flag): Add -m4, m4-single, m4-single-only, -mfmovd. - (OPTIMIZATION_OPTIONS): If optimizing, set flag_omit_frame_pointer - to -1 and sh_flag_remove_dead_before_cse to 1. - (ASSEMBLER_DIALECT): Define to assembler_dialect. - (assembler_dialect, fp_reg_names): Declare. - (OVERRIDE_OPTIONS): Add code for TARGET_SH4. - Hide names of registers that are not accessible. - (CACHE_LOG): Take TARGET_CACHE32 into account. - (LOOP_ALIGN): Take TARGET_HARWARD into account. - (FIRST_XD_REG, LAST_XD_REG, FPSCR_REG): Define. - (FIRST_PSEUDO_REGISTER: Now 49. - (FIXED_REGISTERS, CALL_USED_REGISTERS): Include values for registers. - (HARD_REGNO_NREGS): Special treatment of FIRST_XD_REG .. LAST_XD_REG. - (HARD_REGNO_MODE_OK): Update. - (enum reg_class): Add DF_REGS and FPSCR_REGS. - (REG_CLASS_NAMES, REG_CLASS_CONTENTS, REG_ALLOC_ORDER): Likewise. - (SECONDARY_OUTPUT_RELOAD_CLASS, SECONDARY_INPUT_RELOAD_CLASS): Update. - (CLASS_CANNOT_CHANGE_SIZE, DEBUG_REGISTER_NAMES): Define. - (NPARM_REGS): Eight floating point parameter registers on SH4. - (BASE_RETURN_VALUE_REG): SH4 also passes double values - in floating point registers. - (GET_SH_ARG_CLASS): Likewise. - Complex float types are also returned in float registers. - (BASE_ARG_REG): Complex float types are also passes in float registers. - (FUNCTION_VALUE): Change mode like PROMOTE_MODE does. - (LIBCALL_VALUE): Remove trailing semicolon. - (ROUND_REG): Round when double precision value is passed in floating - point register(s). - (FUNCTION_ARG_ADVANCE): No change wanted for SH4 when things are - passed on the stack. - (FUNCTION_ARG): Little endian adjustment for SH4 SFmode. - (FUNCTION_ARG_PARTIAL_NREGS): Zero for SH4. - (TRAMPOLINE_ALIGNMENT): Take TARGET_HARWARD into account. - (INITIALIZE_TRAMPOLINE): Emit ic_invalidate_line for TARGET_HARWARD. - (MODE_DISP_OK_8): Not for SH4 DFmode. - (GO_IF_LEGITIMATE_ADDRESS): No base reg + index reg for SH4 DFmode. - Allow indexed addressing for PSImode after reload. - (LEGITIMIZE_ADDRESS): Not for SH4 DFmode. - (LEGITIMIZE_RELOAD_ADDRESS): Handle SH3E SFmode. - Don't change SH4 DFmode nor PSImode RELOAD_FOR_INPUT_ADDRESS. - (DOUBLE_TYPE_SIZE): 64 for SH4. - (RTX_COSTS): Add PLUS case. - Increase cost of ASHIFT, ASHIFTRT, LSHIFTRT case. - (REGISTER_MOVE_COST): Add handling of R0_REGS, FPUL_REGS, T_REGS, - MAC_REGS, PR_REGS, DF_REGS. - (REGISTER_NAMES): Use fp_reg_names. - (enum processor_type): Add PROCESSOR_SH4. - (sh_flag_remove_dead_before_cse): Declare. - (rtx_equal_function_value_matters, fpscr_rtx, get_fpscr_rtx): Declare. - (PREDICATE_CODES): Add binary_float_operator, - commutative_float_operator, fp_arith_reg_operand, fp_extended_operand, - fpscr_operand, noncommutative_float_operator. - (ADJUST_COST): Use different scale for TARGET_SUPERSCALAR. - (SH_DYNAMIC_SHIFT_COST): Cheaper for SH4. - * sh.md (attribute cpu): Add value sh4. - (attrbutes fmovd, issues): Define. - (attribute type): Add values dfp_arith, dfp_cmp, dfp_conv, dfdiv. - (function units memory, int, mpy, fp): Make dependent on issue rate. - (function units issue, single_issue, load_si, load): Define. - (function units load_store, fdiv, gp_fpul): Define. - (attribute hit_stack): Provide proper default. - (use_sfunc_addr+1, udivsi3): Predicated on ! TARGET_SH4. - (udivsi3_i4, udivsi3_i4_single, divsi3_i4, divsi3_i4_single): New insns. - (udivsi3, divsi3): Emit special patterns for SH4 hardware, - (mulsi3_call): Now uses match_operand for function address. - (mulsi3): Also emit code for SH1 case. Wrap result in REG_LIBCALL / - REG_RETVAL notes. - (push, pop, push_e, pop_e): Now define_expands. - (push_fpul, push_4, pop_fpul, pop_4, ic_invalidate_line): New expanders. - (movsi_ie): Added y/i alternative. - (ic_invalidate_line_i, movdf_i4): New insns. - (movdf_i4+[123], reload_outdf+[12345], movsi_y+[12]): New splitters. - (reload_indf, reload_outdf, reload_outsf, reload_insi): New expanders. - (movdf): Add special code for SH4. - (movsf_ie, movsf_ie+1, reload_insf, calli): Make use of fpscr visible. - (call_valuei, calli, call_value): Likewise. - (movsf): Emit no-op move. - (mov_nop, movsi_y): New insns. - (blt, sge): Generalize to handle DFmode. - (return predicate): Call emit_fpscr_use and remove_dead_before_cse. - (block_move_real, block_lump_real): Predicate on ! TARGET_HARD_SH4. - (block_move_real_i4, block_lump_real_i4, fpu_switch): New insns. - (fpu_switch0, fpu_switch1, movpsi): New expanders. - (fpu_switch+[12], fix_truncsfsi2_i4_2+1): New splitters. - (toggle_sz): New insn. - (addsf3, subsf3, mulsf3, divsf3): Now define_expands. - (addsf3_i, subsf3_i, mulsf3_i4, mulsf3_ie, divsf3_i): New insns. - (macsf3): Make use of fpscr visible. Disable for SH4. - (floatsisf2): Make use of fpscr visible. - (floatsisf2_i4): New insn. - (floatsisf2_ie, fixsfsi, cmpgtsf_t, cmpeqsf_t): Disable for SH4. - (ieee_ccmpeqsf_t): Likewise. - (fix_truncsfsi2): Emit different code for SH4. - (fix_truncsfsi2_i4, fix_truncsfsi2_i4_2, cmpgtsf_t_i4): New insns. - (cmpeqsf_t_i4, ieee_ccmpeqsf_t_4): New insns. - (negsf2, sqrtsf2, abssf2): Now expanders. - (adddf3, subdf3i, muldf2, divdf3, floatsidf2): New expanders. - (negsf2_i, sqrtsf2_i, abssf2_i, adddf3_i, subdf3_i): New insns. - (muldf3_i, divdf3_i, floatsidf2_i, fix_truncdfsi2_i): New insns. - (fix_truncdfsi2, cmpdf, negdf2, sqrtdf2, absdf2): New expanders. - (fix_truncdfsi2_i4, cmpgtdf_t, cmpeqdf_t, ieee_ccmpeqdf_t): New insns. - (fix_truncdfsi2_i4_2+1): New splitters. - (negdf2_i, sqrtdf2_i, absdf2_i, extendsfdf2_i4): New insns. - (extendsfdf2, truncdfsf2): New expanders. - (truncdfsf2_i4): New insn. - * t-sh (LIB1ASMFUNCS): Add _movstr_i4, _sdivsi3_i4, _udivsi3_i4. - (MULTILIB_OPTIONS): Add m4-single-only/m4-single/m4. - * float-sh.h: When testing for __SH3E__, also test for - __SH4_SINGLE_ONLY__ . - * va-sh.h (__va_freg): Define to float. - (__va_greg, __fa_freg, __gnuc_va_list, va_start): - Define for __SH4_SINGLE_ONLY__ like for __SH3E__ . - (__PASS_AS_FLOAT, __TARGET_SH4_P): Likewise. - (__PASS_AS_FLOAT): Use different definition for __SH4__ and - __SH4_SINGLE__. - (TARGET_SH4_P): Define. - (va_arg): Use it. - - * sh.md (movdf_k, movsf_i): Tweak the condition so that - init_expr_once is satisfied about the existence of load / store insns. - - * sh.md (movsi_i, movsi_ie, movsi_i_lowpart, movsf_i, movsf_ie): - Change m constraint in source operand to mr / mf. - - * va-sh.h (__va_arg_sh1): Use __asm instead of asm. - - * (__VA_REEF): Define. - (__va_arg_sh1): Use it. - - * va-sh.h (va_start, va_arg, va_copy): Add parentheses. - -Sun Nov 22 21:34:02 1998 Jeffrey A Law (law@cygnus.com) - - * i386/dgux.c (struct option): Add new "description field". - * m88k/m88k.c (struct option): Likewise. - -Sun Nov 22 16:07:57 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Nov 22 13:40:02 1998 Bernd Schmidt - - * regmove.c (regmove_profitable_p): Use return value of find_matches - properly. - -Sun Nov 22 02:47:37 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Nov 21 22:12:09 1998 Jeffrey A Law (law@cygnus.com) - - * reload1.c (eliminate_regs): Do not lose if eliminate_regs is called - without reload having been called earlier. - - * v850.c (ep_memory_operand): Offsets < 0 are not valid for EP - addressing modes. - (v850_reorg): Similarly. - - * loop.c (check_dbra_loop): Avoid using gen_add2_insn. - -Sat Nov 21 02:18:38 1998 J"orn Rennecke - - * loop.c (move_movables): Start of libcall might be new loop start. - -Fri Nov 20 12:14:16 1998 Kaveh R. Ghazi - - * hash.c (hash_table_init_n): Wrap prototype arguments in PARAMS(). - -Fri Nov 20 08:34:00 1998 Bernd Schmidt - - * function.c (nonlocal_goto_handler_slots): Renamed from - nonlocal_goto_handler_slot; now an EXPR_LIST chain. - (push_function_context_to): Adjust for this change. - (pop_function_context_from): Likewise. - (init_function_start): Likewise. - (expand_function_end): Likewise. - * function.h (struct function): Likewise. - * calls.c (expand_call): Likewise. - * explow.c (allocate_dynamic_stack_space): Likewise. - * expr.h (nonlocal_goto_handler_slots): Rename its declaration. - * stmt.c (declare_nonlocal_label): Make a new handler slot for each - label. - (expand_goto): When doing a nonlocal goto, find corresponding handler - slot for it. Don't put the label address in the static chain register. - (expand_end_bindings): Break out nonlocal goto handling code into - three new functions. - (expand_nl_handler_label, expand_nl_goto_receiver, - expand_nl_goto_receivers): New static functions, broken out of - expand_end_bindings and adapted to create one handler per nonlocal - label. - * function.c (delete_handlers): Delete insn if it references any of - the nonlocal goto handler slots. - * i960.md (nonlocal_goto): Comment out code that modifies - static_chain_rtx. - * sparc.md (nonlocal_goto): Likewise. - (goto_handler_and_restore_v9): Comment out. - (goto_handler_and_restore_v9_sp64): Comment out. - -Thu Nov 19 23:44:38 1998 Bernd Schmidt - - * expr.c (STACK_BYTES): Delete unused macro. - * calls.c: Provide default for PREFERRED_STACK_BOUNDARY. - (STACK_BYTES): Use PREFERRED_STACK_BOUNDARY, not STACK_BOUNDARY. - (expand_call): Likewise. - (emit_library_call): Likewise. - (emit_library_call_value): Likewise. - * function.c: Provide default for PREFERRED_STACK_BOUNDARY. - (STACK_BYTES): Use PREFERRED_STACK_BOUNDARY, not STACK_BOUNDARY. - * explow.c: Provide default for PREFERRED_STACK_BOUNDARY. - (round_push): Use PREFERRED_STACK_BOUNDARY, not STACK_BOUNDARY. - (allocate_dynamic_stack_space): Likewise. - * tm.texi (PREFERRED_STACK_BOUNDARY): Document new macro. - (STACK_BOUNDARY): Update description to reflect the new situation. - -Thu Nov 19 22:20:51 1998 Jeffrey A Law (law@cygnus.com) - - * reorg.c (relax_delay_slots): When optimizing for code size, if a - return with a filled delay slot is followed by a return with an - unfilled delay slot, delete the first return and reemit the insn - that was previously in its delay slot. - - * i860.c (single_insn_src_p): Add missing parens. - * ginclude/math-3300.h: Likewise. - -Thu Nov 19 20:55:59 1998 H.J. Lu (hjl@gnu.org) - - * regclass.c (init_reg_sets_1): Add prototype. - (init_reg_modes): Likewise. - -1998-11-19 Zack Weinberg - - * c-common.c: Change warning messages to say `comparison is - always true' or `comparison is always false' instead of the - confusing `is always 0', `is always 1'. - -Thu Nov 19 19:05:49 1998 Per Bothner - - * print-tree.c (print_node): After printing BLOCK or BIND_EXPR, - break instead of return (which loses closing '>'). - -Thu Nov 19 19:34:13 1998 Jeffrey A Law (law@cygnus.com) - - * i386.h (LEGITIMATE_CONSTANT_P): Reject CONST_DOUBLEs that are not - standard 387 constants. - - * i386.md (jump): Explicitly set "memory" attribute. - (indirect_jump, prologue_set_stack_ptr): Likewise. - (prologue_get_pc_and_set_got, pop): Likewise. - (allocate_stack_worder, blockage, return_internal): Likewise. - (return_pop_internal, nop): Likewise. - (epilogue_set_stack_ptr, leave): Likewise. - -Thu Nov 19 15:42:54 1998 Nick Clifton - - * config/arm/coff.h: Set USER_LABEL_PREFIX to "_". - -Thu Nov 19 23:20:59 1998 J"orn Rennecke - - * reload1.c (reload_reg_free_for_value_p): - Early auto_inc reloads don't conflict with outputs. - -Thu Nov 19 12:58:55 1998 Kaveh R. Ghazi - - * configure.in: Don't do AC_CHECK_HEADERS(wait.h sys/wait.h). - Instead call AC_HEADER_SYS_WAIT. - - * collect2.c: Don't provide defaults for sys/wait.h macros. - * gcc.c: Likewise. - * protoize.c: Likewise. Also, don't include sys/wait.h. - - * system.h: Include sys/wait.h and provide macro defaults. - -1998-11-19 Andreas Schwab - - * Makefile.in (mandir): Set to @mandir@. - (man1dir): New variable to hold the former value of $(mandir). - Replace all uses of $(mandir) by $(man1dir). - -Wed Nov 18 16:31:28 1998 Jim Wilson - - * reload.c (find_reloads_address_part): If have a CONST_INT, create - a new one before passing it to force_const_mem. - - * reload.c (find_reloads_toplev): Pass &x instead of NULL_PTR in - find_reloads_address call. - -Wed Nov 18 22:13:00 1998 J"orn Rennecke - - * expr.c (store_expr): Don't generate load-store pair - if TEMP is identical (according to ==) with TARGET. - -Tue Nov 17 22:25:16 1998 J"orn Rennecke - - * reload1.c (reload_reg_free_for_value_p): When considered reload - has an output, matching inputs are not sufficient to avoid conflict. - -Tue Nov 17 11:51:16 1998 Mark Mitchell - - * hash.h (hash_table_key): New type. - (hash_entry): Change `string' field to generic `key'. - (hash_table): Add `comp' and `hash' functions. - (hash_table_init): Take them as input. - (hash_table_init_n): Likewise. - (hash_lookup): Modify for generic keys. - (hash_newfunc): Likewise. - (hash_traverse): Likewise. - (string_hash): New function. - (string_compare): Likewise. - (string_copy): Likewise. - * hash.c (hash_table_init_n): Modify for generic keys. - (hash_table_init): Likewise. - (hash_lookup): Likewise. - (hash_newfunc): Likewise. - (hash_traverse): Likewise. - (string_hash): Split out from hash_lookup. - (string_compare): New function. - (string_copy): Split out from hash_lookup. - * tlink.c (symbol_hash_newfunc): Modify for new interfaces to hash - tables. - (symbol_hash_lookup): Likewise. - (file_hash_newfunc): Likewise. - (file_hash_lookup): Likewise. - (demangled_hash_newfunc): Likewise. - (demangled_hash_lookup): Likewise. - (tlink_int): Likewise. - (read_repo_file): Likewise. - (recompile_files): Likewise. - (demangle_new_symbols): Likewise. - (scan_linker_output): Likewise. - -Tue Nov 17 17:13:53 1998 J"orn Rennecke - - * flow.c (insn_dead_p): New argument NOTES. Changed all callers. - -Mon Nov 16 17:56:07 1998 David Edelsohn - - * rs6000.c (output_mi_thunk): Improve test for local branch. - -Mon Nov 16 17:56:07 1998 Franz Sirl - - * rs6000.c (output_mi_thunk): Correct test for aggregate values. - -Mon Nov 16 21:02:52 1998 J"orn Rennecke - - * reload1.c (reload_reg_free_before_p): Delete. - Changed all callers to use reload_reg_free_for_value_p instead. - (reload_reg_free_for_value_p): Handle more reload types. - A RELOAD_FOR_INPUT doesn't conflict with its - RELOAD_FOR_INPUT_ADDRESS / RELOAD_FOR_INPADDR_ADDRESS. - Add special case for OUT == const0_rtx. - Added ignore_address_reloads argument. Changed all callers. - -Mon Nov 16 02:22:29 1998 Jason Merrill - - * toplev.c (compile_file): Don't pedwarn about undefined static - functions just because we passed -Wunused. - -Mon Nov 16 04:41:41 1998 J"orn Rennecke - - * function.c (purge_addressof_1): Unshare rtl created by - store_bit_field. - -Mon Nov 16 04:23:06 1998 J"orn Rennecke - - * regmove.c (regmove_optimize): Don't do anything but - optimize_reg_copy[123] when flag_regmove is not set. - -Sat Nov 14 15:05:07 1998 Richard Henderson - - * alpha.md (addsi3, subsi3): Revise 5 Nov change to store DImode - value in paradoxical SImode result, rather than truncating midpoint. - -Fri Nov 13 22:19:23 1998 Richard Henderson - - * alpha.c (reg_not_elim_operand): New. - * alpha.h (PREDICATE_CODES): Add it. - * alpha.md (s48addq, s48subq patterns): Use it as the predicate - for the multiplicand. - -Fri Nov 13 22:50:37 1998 David Edelsohn - - * rs6000.md (movsf): Remove explicit secondary-reload-like - functionality. Only truncate SFmode store if in FPR. - (movsf splitters): Combine const_double splitters. - (movsf_hardfloat): Add GPR support. - -Fri Nov 13 11:02:11 1998 Stan Cox - - * splet.h (SUBTARGET_OVERRIDE_OPTIONS): New to - deprecate -mlive-g0 and -mbroken-saverestore. - * t-splet (MULTILIB_OPTIONS): Likewise. - - * sparc.c (sparc_flat_compute_frame_size): Correctly calc args_size - in a leaf function. Clarify total_size/extra_size relationship. - -Thu Nov 12 19:20:57 1998 Geoffrey Noer - - * i386/cygwin32.asm: Delete. - * i386/cygwin.asm: New file, renamed from cygwin32.asm. - * i386/cygwin32.h: Delete. - * i386/cygwin.h: New file, renamed from cygwin32.h. - * i386/t-cygwin32: Delete. - * i386/t-cygwin: New file, renamed from t-cygwin32. Include - cygwin.asm instead of cygwin32.asm. Remove "32" from comment. - * i386/x-cygwin32: Delete. - * i386/x-cygwin: New file, renamed from x-cygwin32. - * i386/xm-cygwin32: Delete. - * i386/xm-cygwin: New file, renamed from xm-cygwin32. Use newly - renamed cygwin_ funcs for path translations. - * i386/win32.h: Define __CYGWIN__ when -mcygwin given. - * i386/winnt.c: Remove "32" from comment about cygwin. - * i386/mingw32.h: Fix references to cygwin32.h in light of above. - * rs6000/cygwin32.h: Delete. - * rs6000/cygwin.h: New file, renamed from cygwin32.h. Add - -D__CYGWIN__ to CPP_PREDEFINES. - * rs6000/x-cygwin32: Delete. - * rs6000/x-cygwin: New file, renamed from x-cygwin32. - * rs6000/xm-cygwin32: Delete. - * rs6000/xm-cygwin: New file, renamed from xm-cygwin32. - - * configure.in: Check for cygwin* instead of cygwin32. Account - for the rename of cygwin-related config files to lose the "32"s. - * configure: Regenerate. - - * cccp.c, collect2.c, gcc.c, getpwd.c, libgcc2.c, protoize.c, - toplev.c: Change all refs to __CYGWIN32__ to __CYGWIN__. - -Wed Nov 11 12:25:19 1998 Tom Tromey - - * Makefile.in (JAVAGC): New macro. - * configure: Rebuilt. - * configure.in: Recognize --enable-java-gc argument. Subst - `JAVAGC' variable. - -Thu Nov 12 03:32:16 1998 J"orn Rennecke - - Handle equivalences that have been obscured by gcse: - - * reload1.c (reload): Handle equivalences set up in multiple places. - * local-alloc.c (reg_equiv_init_insns): New variable. - (no_equiv): New function. - (update_equiv_regs): Handle equivalences set up in multiple places. - Don't ignore an insn just because its destination is likely to be - spilled. - -Wed Nov 11 13:46:13 1998 Jim Wilson - - * except.c (expand_eh_return): Readd force_operand call lost in - Sept 15 change. - -Tue Nov 10 17:04:11 1998 David Edelsohn - - * rs6000.h (LEGITIMIZE_ADDRESS): Add missing goto on last case. - -1998-11-09 Andreas Schwab - - * dbxout.c: Check HAVE_STAB_H instead of HAVE_STABS_H. - -Mon Nov 9 20:15:19 1998 Bernd Schmidt - - * regmove.c (regmove_optimize): Fix error in last change. - -Mon Nov 9 16:37:52 1998 Andrew Cagney - - * mips.c (function_prologue): When TARGET_MIPS16, adjust the register - offset in the .mask pseudo to compensate for frame pointer adjustments. - (mips16_fp_args, build_mips16_call_stub): For little endian, do not - word swap arguments moved to/from FP registers. - * mips16.S (DFREVCMP): Reverse arguments to OPCODE. - -Mon Nov 9 09:47:06 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Nov 9 02:14:14 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Nov 9 03:06:24 1998 Jeffrey A Law (law@cygnus.com) - - * reload1.c (delete_output_reload_insn): If a pseudo is set multiple - times, then it can not be completely replaced. - -Mon Nov 9 00:39:02 1998 Richard Henderson - - * alpha.md (call, call_value) [OSF]: Correct alt 3 insn length. - -Sun Nov 8 17:50:30 1998 Kaveh R. Ghazi - - * gansidecl.h: Prepend a "G" to the macro wrapping this file - (to distinguish it from the macro wrapping ansidecl.h.) - Include libiberty's ansidecl.h. Remove all redundant definitions. - Define the PROTO() style macros in terms of the PARAMS() ones. - - - * calls.c (emit_library_call): Switch on ANSI_PROTOTYPES, not - __STDC__, when deciding whether to use ANSI variable args. - (emit_library_call_value): Likewise. - - * cccp.c (error): Likewise. - (warning): Likewise. - (error_with_line): Likewise. - (warning_with_line): Likewise. - (pedwarn): Likewise. - (pedwarn_with_line): Likewise. - (pedwarn_with_file_and_line): Likewise. - (fatal): Likewise. - - * cexp.y (error): Likewise. - (pedwarn): Likewise. - (warning): Likewise. - - * collect2.c (fatal_perror): Likewise. - (fatal): Likewise. - (error): Likewise. - - * combine.c (gen_rtx_combine): Likewise. - - * cpperror.c (cpp_message): Likewise. - (cpp_fatal): Likewise. - - * cpplib.c (cpp_error): Likewise. - (cpp_warning): Likewise. - (cpp_pedwarn): Likewise. - (cpp_error_with_line): Likewise. - (cpp_warning_with_line): Likewise. - (cpp_pedwarn_with_line): Likewise. - (cpp_pedwarn_with_file_and_line): Likewise. - - * cpplib.h: Don't define PARAMS() macro. - - * demangle.h: Likewise. - - * doprint.c (checkit): Switch on ANSI_PROTOTYPES, not __STDC__, - when deciding whether to use ANSI variable args. - - * emit-rtl.c (gen_rtx): Likewise. - (gen_rtvec): Likewise. - - * final.c (asm_fprintf): Likewise. - - * fix-header.c (cpp_message): Likewise. - (fatal): Likewise. - (cpp_fatal): Likewise. - - * gcc.c (concat): Likewise. - (fatal): Likewise. - (error): Likewise. - - * genattr.c (fatal): Likewise. - - * genattrtab.c (attr_rtx): Likewise. - (attr_printf): Likewise. - (fatal): Likewise. - - * gencodes.c (fatal): Likewise. - - * genconfig.c (fatal): Likewise. - - * genemit.c (fatal): Likewise. - - * genextract.c (fatal): Likewise. - - * genflags.c (fatal): Likewise. - - * genopinit.c (fatal): Likewise. - - * genoutput.c (fatal): Likewise. - (error): Likewise. - - * genpeep.c (fatal): Likewise. - - * genrecog.c (fatal): Likewise. - - * halfpic.h: Switch on ANSI_PROTOTYPES, not __STDC__, when - deciding whether to declare `tree_node' and `rtx_def'. - - * hash.h: Don't define stuff we get from gansidecl.h. - - * mips-tfile.c: Likewise. Define __proto() in terms of PARAMS(). - (fatal): Switch on ANSI_PROTOTYPES, not __STDC__, when deciding - whether to use ANSI variable args. - (error): Likewise. - - * prefix.c (concat): Likewise. - - * scan.h: Likewise. - - * system.h: Likewise. - - * toplev.c (error_with_file_and_line): Likewise. - (error_with_decl): Likewise. - (error_for_asm): Likewise. - (error): Likewise. - (fatal): Likewise. - (warning_with_file_and_line): Likewise. - (warning_with_decl): Likewise. - (warning_for_asm): Likewise. - (warning): Likewise. - (pedwarn): Likewise. - (pedwarn_with_decl): Likewise. - (pedwarn_with_file_and_line): Likewise. - (sorry): Likewise. - (really_sorry): Likewise. - - * toplev.h: Switch on ANSI_PROTOTYPES, not __STDC__, when deciding - whether to declare `tree_node' and `rtx_def'. - - * tree.c (build): Switch on ANSI_PROTOTYPES, not __STDC__, when - deciding whether to use ANSI variable args. - (build_nt): Likewise. - (build_parse_node): Likewise. - -Sun Nov 8 13:10:55 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sat Nov 7 23:34:01 1998 Kaveh R. Ghazi - - * Makefile.in (libcpp.a): Check RANLIB_TEST before runing RANLIB. - -Sat Nov 7 22:26:19 1998 David Edelsohn - - * collect2.c (main, case 'b'): Use else if. - -Sat Nov 7 15:35:25 1998 Kaveh R. Ghazi - - * configure.in (host_xm_file, build_xm_file, xm_file, tm_file): - Arrange to include gansidecl.h in {ht}config.h & tm.h just - before the config/ directory headers. - (tm_file_list, host_xm_file_list, build_xm_file_list): Handle - gansidecl.h in the list of dependencies. - - * Makefile.in (RTL_BASE_H): Don't depend on gansidecl.h. - (TREE_H, DEMANGLE_H, RECOG_H, REGS_H, libgcc2.a, stmp-multilib, - mbchar.o, collect2.o, pexecute.o, vfprintf.o, splay-tree.o, gcc.o, - gencheck.o, choose-temp.o, mkstemp.o, mkstemp.o, prefix.o, - dyn-string.o, cexp.o, cccp.o, cppmain.o, cpplib.o, cpperror.o, - cppexp.o, cppfiles.o, cpphash.o, cppalloc.o, scan-decls.o): - Likewise. - - * cccp.c: Don't include gansidecl.h. - * cexp.y: Likewise. - * collect2.c: Likewise. - * config/c4x/c4x.c: Likewise. - * config/v850/v850.h: Likewise. - * cppalloc.c: Likewise. - * cpperror.c: Likewise. - * cppexp.c: Likewise. - * cppfiles.c: Likewise. - * cpphash.c: Likewise. - * cpplib.c: Likewise. - * cppmain.c: Likewise. - * cppulp.c: Likewise. - * demangle.h: Likewise. - * doprint.c: Likewise. - * dyn-string.c: Likewise. - * eh-common.h: Likewise. - * fix-header.c: Likewise. - * frame.c: Likewise. - * gcc.c: Likewise. - * gcov.c: Likewise. - * gen-protos.c: Likewise. - * gencheck.c: Likewise. - * halfpic.h: Likewise. - * hash.c: Likewise. - * machmode.h: Likewise. - * mbchar.c: Likewise. - * prefix.c: Likewise. - * protoize.c: Likewise. - * recog.h: Likewise. - * rtl.h: Likewise. - * scan-decls.c: Likewise. - * tree.h: Likewise. - * varray.h: Likewise. - -Sat Nov 7 11:37:53 1998 Richard Henderson - - * i386.md (call_value_pop): If we're not popping anything, - defer to call_value. - (call_pop): Likewise defer to call. - -Sat Nov 7 02:49:56 1998 Richard Henderson - - * function.c (purge_addressof): Clear purge_addressof_replacements - only after processing the whole function. - -Sat Nov 7 00:54:55 1998 Jeffrey A Law (law@cygnus.com) - - * reload1.c (reload): If we can not perform a particular elimination - when we thought we could earlier, then we must always iterate through - the loop at least one more time. - -Fri Nov 6 19:37:33 1998 Richard Henderson - - * alpha.c (add_operand): Simplify the CONST_INT match. - (sext_add_operand): Correct typo in comparison by using - CONST_OK_FOR_LETTER_P. - * alpha.md (s?addq): Use sext_add_operand to allow the negative - constant alternatives to be generated. - (mulsi3, muldi3, umuldi3_highpart): Loosen constraints to allow - small constants, since the hw instructions do. - -Fri Nov 6 20:15:19 1998 Bernd Schmidt - - * reload1.c (emit_reload_insns): When rewriting the SET_DEST of a - previous insn to store directly into our reload register, make sure - that if the source of the previous insn is a reload register, its - spill_reg_store and spill_reg_stored_to values are cleared. - -Fri Nov 6 16:35:10 1998 David Edelsohn - - * rs6000.md (floatunssidf2_internal splitter): Use base register - operand, not hard-coded SP. - -Fri Nov 6 04:07:53 1998 David S. Miller - - * jump.c (calculate_can_reach_end): Fix thinko. - -Fri Nov 6 00:16:04 1998 Jeffrey A Law (law@cygnus.com) - - * reorg.c (fill_simple_delay_slots): Fix typo. - - * romp.h (LEGITIMIZE_ADDRESS): Fix typo. - -Fri Nov 6 00:10:00 1998 Jan Hubicka (hubicka@freesoft.cz) - - * i386.md (extendsidi2): Use # in the output template. - (extendsidi splitters): New splitters. - -Thu Nov 5 11:13:27 1998 Nick Clifton - - * configure.in: Use unknown-elf.h as tm_file for arm-elf - configurations. - * configure: Regenerate. - -Thu Nov 5 07:59:05 1998 David S. Miller - - * jump.c (init_label_info, delete_barrier_successors, - mark_all_labels, delete_unreferenced_labels, - delete_noop_moves, calculate_can_reach_end): New functions broken - out of jump_optimize. - (jump_optimize): Use them. - -Thu Nov 5 07:57:45 1998 Andrew MacLeod - - * except.c (expand_fixup_region_end): Make sure outer context labels - are not issued in an inner context during cleanups. - -Thu Nov 5 04:03:06 1998 Richard Henderson - - * alpha.md (addsi3, subsi3): No new temporaries once cse is - no longer expected. - -Thu Nov 5 03:29:19 1998 Richard Henderson - - * alpha.md (addsi3, subsi3): Expand to a DImode temporary so as - to expose this midpoint to CSE. - -Thu Nov 5 03:42:54 1998 David S. Miller - - * config/sparc/sparc.md (movdf_const_intreg_sp64): Enable again. - -Thu Nov 5 10:53:01 1998 Andreas Schwab - - * configure.in: Bring over gcc2 change of Nov 19 1997. - -Wed Nov 4 23:43:08 1998 Graham - - * toplev.c (output_lang_identify): Make definition dependent on - ASM_IDENTIFY_LANGUAGE. - - * print-rtl.c (spaces): Make static. - -Wed Nov 4 22:16:36 1998 Hans-Peter Nilsson - - * extend.texi: Clarify proper uses for register clobbers in asms. - -Wed Nov 4 22:16:36 1998 Bernd Schmidt - - * recog.h (enum op_type): Define. - (constrain_operands): Adjust prototype. - (recog_op_type): Declare new variable. - * recog.c (recog_op_type): New variable. - (insn_invalid_p): Allow modifying an asm statement after reload. - (extract_insn): Set up recog_op_type. - (constrain_operands): Lose INSN_CODE_NUM arg. All callers changed. - Don't compute operand types, use recog_op_type. - Use the information computed by extract_insn instead of the previous - method of finding it by insn code number. - * caller-save.c (init_caller_save): Use extract_insn, not insn_extract. - * reorg.c (fill_slots_from_thread): Likewise. - * reload1.c (reload_as_needed): Likewise. - (gen_reload): Likewise. - (inc_for_reload): Likewise. - (reload_cse_simplify_operands): Likewise. - Use the information computed by extract_insn instead of the previous - method of finding it by insn code number. - * genattrtab.c (write_attr_case): Generate call to extract_insn, not - insn_extract. - * final.c (final_scan_insn): Use extract_insn, not insn_extract. - (cleanup_operand_subregs): Use extract_insn, not insn_extract. - Use the information computed by extract_insn instead of the previous - method of finding it by insn code number. - * regmove.c (find_matches): Likewise. Change meaning of the return - value to be nonzero if the optimization can be performed, zero if - not. All callers changed. - Shorten some variable names to fix formatting problems. - (regmove_optimize): Shorten some variable names to fix formatting - problems. - Use the information computed by extract_insn instead of the previous - method of finding it by insn code number. - * regclass.c (scan_one_insn): Likewise. - (record_reg_classes): Don't compute operand types, use recog_op_type. - * reload.c (find_reloads): Lose CONSTRAINTS1 variable; use - recog_constraints instead. - -Wed Nov 4 21:37:46 1998 Jeffrey A Law (law@cygnus.com) - - * rtl.h (flow2_completed): Declare. - * flow.c (flow2_completed): Definition. - * toplev.c (rest_of_compilation): Set and clear flow2_completed - as necessary. - -Wed Nov 4 19:15:37 1998 Melissa O'Neill - - * Makefile.in (libcpp.a): Ranlib libcpp.a. - - * cppulp.c (user_label_prefix): Initialize. - -Wed Nov 4 19:07:08 1998 John Wehle (john@feith.com) - - * flow.c (mark_regs_live_at_end): Mark the stack pointer as live - at a RETURN if current_function_sp_is_unchanging is set. - -Wed Nov 4 18:16:29 1998 Herman A.J. ten Brugge - - * emit-rtl.c (try_split): Fixed error in Oct 10 patch. - -Wed Nov 4 15:11:15 1998 Geoffrey Noer - - * i386/cygwin32.h (MASK_WIN32, MASK_CYGWIN, MASK_WINDOWS, MASK_DLL, - TARGET_WIN32, TARGET_CYGWIN, TARGET_WINDOWS, TARGET_DLL): New. - (SUBTARGET_SWITCHES): Add -mno-cygwin, -mcygwin, and -mdll options. - (CPP_PREDEFINES): Don't define __CYGWIN32__ here. - (STARTFILE_SPEC): Handle -mdll, -mno-cygwin options. - (CPP_SPEC): Handle -mno-cygwin option. Define __CYWIN__ in addition - to __CYGWIN32__. - (LIB_SPEC): Handle -mno-cygwin option. - (LINK_SPEC): Handle -mdll. - -Wed Nov 4 22:56:14 1998 J"orn Rennecke - - * reload.c (find_reloads): Fix test for usage by other reload - to handle secondary reloads properly. - -Wed Nov 4 17:25:10 1998 Kaveh R. Ghazi - - * reload1.c (ELIMINABLE_REGS, NUM_ELIMINABLE_REGS): Introduce an - intermediate structure which has exactly the members provided by - ELIMINABLE_REGS. Define NUM_ELIMINABLE_REGS in terms of the - static intermediate structure. - - (init_elim_table): Xmalloc() `reg_eliminate', and initialize it - from the intermediate structure. Do the same analogous fix in - the case where ELIMINABLE_REGS is not defined. - -Tue Nov 3 20:50:03 1998 Jeffrey A Law (law@cygnus.com) - - * pa.h (SELECT_SECTION): Fix thinko. - -Tue Nov 3 17:51:36 1998 Jim Wilson - - * dwarf2out.c (output_call_frame_info): Comments on last change. - -Tue Nov 3 07:51:43 1998 Richard Earnshaw (rearnsha@arm.com) - - * arm.c (add_constant): When taking the address of an item in the - pool, get the mode of the item addressed. - - * arm.c (final_prescan_insn case INSN): If an insn doesn't - contain a SET or a PARALLEL, don't consider it for conditional - execution. - - Restore ABI compatibility for NetBSD. - * arm/netbsd.h (DEFAULT_PCC_STRUCT_RETURN): Override setting in - arm.h. - (RETURN_IN_MEMORY): Likewise. - -Mon Nov 2 11:46:17 1998 Doug Evans - - * m32r/m32r.c (m32r_expand_block_move): Fix byte count computations. - (m32r_output_block_move): Rewrite bytes < 4 handling. - -Mon Nov 2 10:10:35 1998 Kaveh R. Ghazi - - * configure.in: Call AC_FUNC_VFORK. - - * collect2.c: Define VFORK_STRING as a printable string for - error messages (either "vfork" or "fork".) If HAVE_VFORK_H is - defined, include vfork.h. If VMS is defined, define vfork() - appropriately. Remove vfork check on USG, we're using autoconf. - (collect_execute): Pass VFORK_STRING to fatal_perror instead of - checking locally what string to pass. - (scan_prog_file): Likewise. - (scan_libraries): Likewise. - - * gcc.c: Remove vfork check on USG, we're using autoconf. - Besides, no calls to vfork/fork occur in this file. - - * protoize.c: Likewise. - -Mon Nov 2 07:52:28 1998 Alexandre Oliva - - * configure.in (DEFAULT_LINKER): Renamed from LD. - (DEFAULT_ASSEMBLER): Renamed from AS; reverted Schwab's patch. - (gcc_cv_as): Try $DEFAULT_ASSEMBLER before $AS. - * configure: Rebuilt. - -Mon Nov 2 01:48:10 1998 Alexandre Oliva - - * BUGS: Fix the regexp for `more' to find the appropriate node. - Reported by Joerg Pietschmann - - * BUGS: Added link to the WWW FAQ. - -Sun Nov 1 18:27:15 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Nov 1 11:04:32 1998 Jeffrey A Law (law@cygnus.com) - - * From Christian Gafton: - * i386/linux.h (CPP_PREDEFINES): Add -D__i386__. - * sparc/linux.h (CPP_PREDEFINES): Add -D__sparc__. - * sparc/linux64.h (CPP_PREDEFINES): Add -D__sparc__. - -Sat Oct 31 21:42:39 1998 Mark Mitchell - - * c-common.c (c_get_alias_set): Allow all type-punning through - unions. Don't get confused about the type of a bit-field, despite - the antics of build_modify_expr. - -Sat Oct 31 22:35:29 1998 Jean-Pierre Radley - - * fixinc.sco: Parameterize #include_next values. - * fixinc/fixinc.sco: Likewise. - -Sat Oct 31 20:39:35 1998 Jeffrey A Law (law@cygnus.com) - - * toplev.c (rest_of_compilation): No longer set reload_completed. - * reload1.c (reload): Set it here. Perform instruction splitting - after reload has completed if we will be running the scheduler - again. - -Sat Oct 31 12:30:02 1998 Jeffrey A Law (law@cygnus.com) - - * jump.c (jump_optimize): Initialize mappings from INSN_UID to - EH region if exceptions are enabled and we're performing cross - jump optimizations. - (find_cross_jump): Exit loop if the insns are in different EH regions. - -Sat Oct 31 10:02:48 1998 Mark Mitchell - - * dwarf2out.c (output_call_frame_info): Use - ASM_OUTPUT_DWARF_DELTA4 for the CIE offset to match frame.c. - -Sat Oct 31 10:23:14 1998 Kaveh R. Ghazi - - Reinstall Apr 24th fix, lost during May 6th gcc2 merge: - * c-common.c (check_format_info): Don't check for the 'x' - format character twice, instead check for 'x' and 'X' - -Fri Oct 30 14:50:25 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in (assembler features): Also make gas is configured if - we find it in the source tree. - -Fri Oct 30 13:23:20 1998 Richard Henderson - - * i386.c (i386_comp_type_attributes): Compare whether the - attributes are defined, not their tree nodes. - -Fri Oct 30 11:39:47 1998 Alexandre Oliva - - * configure.in (gxx_include_dir): Bitten by autoconf quoting - characters. :-( - * configure: Rebuilt. - -Fri Oct 30 10:43:29 1998 Andreas Schwab - - * configure.in: Ignore non-absolute value in $AS. - -Fri Oct 30 00:54:25 1998 Peter Jakubek - - * m68k.h (INDIRECTABLE_1_ADDRESS_P): Fix thinko. - -Fri Oct 30 00:42:34 1998 Mark Elbrecht - - * configure.in (msdosdjgpp): Set exeext and target_alias. - -Thu Oct 29 23:55:43 1998 Bernd Schmidt - - * flow.c (XNMALLOC): New macro. - (flow_int_list_blocks, basic_block_succ, basic_block_pred): New - static variables. - (add_edge, add_edge_to_label): New static functions. - (free_bb_memory): New function. - (flow_delete_insn): Delete function. - (basic_block_drops_in): Delete variable. - (find_basic_blocks): Allocate and initialize basic_block_head, - basic_block_succ. Don't allocate basic_block_drops_in. - Call free_bb_memory at the beginning. - (find_basic_blocks_1): Don't do multiple passes. - Delete code to compute basic_block_drops_in. - After calling make_edges, mark blocks reached by current block live. - Update test for unreachable live blocks. - (mark_label_ref): Delete args X, CHECKDUP. Add PRED arg. All callers - changed. - Simplify to call add_edge_to_label when a LABEL_REF is found. - (make_edges): Simplify to call add_edge_to_label instead of - mark_label_ref most of the time. - Compute here whether control drops into the next block. - (delete_unreachable_blocks): Return void. All callers changed. - Delete unreachable blocks in reverse order. - After deleting all unreachable blocks, renumber the remaining ones - and update n_basic_blocks. - (delete_block): Speed up deletion a bit. - Don't set basic_block_drops_in for deleted blocks. - (free_basic_block_vars): Don't free basic_block_drops_in. - (life_analysis_1): Update to use new edge representation. - (dump_flow_info): Delete code to print basic block info; call - dump_bb_data instead. - (compute_preds_succs): Delete code to recompute basic_block_drops_in - and uid_block_number. - Simply copy the previously computed cfg. - (dump_bb_data): New arg LIVE_INFO. All callers changed. - Print register lifetime information if LIVE_INFO is nonzero. - * basic-block.h (dump_bb_data): Adjust prototype. - * gcse.c (gcse_main): Update call to dump_bb_data. - * rtl.h (free_bb_memory): Declare. - * toplev.c (rest_of_compilation): Call free_bb_memory. - - * reload1.c (struct elim_table): Delete MAX_OFFSET member. - (update_eliminable_offsets): Don't compute it. - (set_initial_elim_offsets): Don't initialize it. - Break out some code into set_initial_label_offsets so the rest of - this function can be called from reload_as_needed. - Assume that INITIAL_FRAME_POINTER_OFFSET is defined when - ELIMINABLE_REGS isn't. - (set_initial_label_offsets): New function, broken out of - set_initial_elim_offsets. - (set_offsets_for_label): New function, broken out of set_label_offsets - and reload_as_needed. - (reload): Call the two new functions. - (reload_as_needed): Call set_initial_elim_offsets instead of - duplicating the code. Likewise for set_offsets_for_label. - - * reload1.c (choose_reload_regs): Fix typo in Oct 17 change. - (emit_reload_insns): Ensure that when we set reg_reloaded_valid for - any hard reg, reg_reloaded_dead contains valid data. - -Thu Oct 29 22:30:54 1998 Marcus Meissner - - * i386.c (i386_comp_type_attributes): Return nonzero for mismatched - "stdcall" and "cdecl" attributes. - -Thu Oct 29 19:05:17 1998 Jim Wilson - - * sched.c (update_flow_info): Add code to ! found_orig_dest case to - handle deleted no-op moves of hard registers. - * haifa-sched.c (update_flow_info): Likewise. - -Thu Oct 29 18:07:47 1998 Jeffrey A Law (law@cygnus.com) - - * mips.md (reload_{in,out}{si,di}): Emit a USE of HILO at the end - of the sequences to reload the HILO register which do not actually - reference HILO. - -Thu Oct 29 12:39:35 1998 Jim Wilson - - * c-common.c (c_get_alias_set): Handle ARRAY_REF of union field. - -Thu Oct 29 14:10:22 1998 Andrew MacLeod - - * except.c (emit_eh_context): Make the EH context register stay alive - at -O0 so stupid.c doesn't get confused. - -1998-10-29 Herman A.J. ten Brugge - - * emit-rtl.c (try_split): Do not try to split a BARRIER. - -Thu Oct 29 01:33:54 1998 Jan Hubicka - Jeffrey A Law (law@cygnus.com) - - * i386.md: Change ix86_cpu == PROCESSOR_PENTIUM to TARGET_PENTIUM. - (zero_extendsidi2): Use # in output template and handle completely by - splits. - (zero_extend splitters): New define_splits. - (ashiftrt_32): New pattern. - -Wed Oct 28 22:58:35 1998 Jason Merrill - - * tree.c (append_random_chars): New fn. - (get_file_function_name_long): Use it. - -Wed Oct 28 22:27:05 1998 Richard Henderson - - * Makefile.in (cc1): Put C_OBJS, and thence @extra_c_objs@ last. - (LIBCPP_OBJS): New. Add cppulp.o. - (cppmain, fix-header): Depend on and use libcpp.a. - * configure.in (extra_c_objs, extra_cxx_objs): Use libcpp.a instead - of the individual object files. - * objc/Make-lang.in (cc1obj): Put OBJC_OBJS, and thence @extra_c_objs@, - last. - - * cccp.c (user_label_prefix): New. - (main): Set it off -f*leading-underscore. - (special_symbol): Use it. - * cpplib.c (special_symbol): Likewise. - (cpp_handle_option): Handle -f*leading-underscore. - * cppulp.c: New file. - - * output.h (user_label_prefix): Declare it. - * dwarf2out.c (ASM_NAME_TO_STRING): Prepend user_label_prefix. - * toplev.c (f_options, main): Handle -f*leading-underscore. - - * defaults.h (ASM_OUTPUT_LABELREF): Use asm_fprintf instead of - referencing USER_LABEL_PREFIX directly. - * config/nextstep.h (ASM_OUTPUT_LABELREF): Likewise. - * m32r/m32r.h (ASM_OUTPUT_LABELREF): Likewise. - * final.c (asm_fprintf): Use user_label_prefix instead. - * arm/thumb.c (thumb_print_operand): Likewise. - - * gcc.c (default_compilers): Pass -f*leading-underscore on to - cpp wherever appropriate. - -Wed Oct 28 23:09:25 1998 Robert Lipe - - * sco5.h (SUBTARGET_SWITCHES): Add documentation for OpenServer- - specific compiler switches. - -Wed Oct 28 21:05:53 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (c-common.o): Depend on c-pragma.h. Use $(RTL_H) instead - of rtl.h. - -Wed Oct 28 20:52:47 1998 Kaveh R. Ghazi - - * gcc.c (EXTRA_SPECS, extra_specs): Introduce an intermediate - structure which has exactly the members provided by EXTRA_SPECS. - Xmalloc() the real `extra_specs', and initialize it from this - intermediate structure. - - * alpha.h (EXTRA_SPECS): Revert change for missing initializers. - - * mips.h (EXTRA_SPECS): Likewise. - - * sparc.h (EXTRA_SPECS): Likewise. - -Wed Oct 28 16:46:07 1998 Andreas Schwab - - * function.c (purge_addressof_1): Instead of aborting when a - bitfield insertion as a replacement for (MEM (ADDRESSOF)) does not - work just put the ADDRESSOF on stack. Otherwise remember all such - successful replacements, so that exactly the same replacements - can be made on the REG_NOTEs. Remove the special case for CALL - insns again. - (purge_addressof_replacements): New variable. - (purge_addressof): Clear it at end. - -1998-10-28 Zack Weinberg - - * c-lang.c: Declare extern char *yy_cur if USE_CPPLIB. - (lang_init): Call check_newline always. - * c-lex.c (init_parse) [USE_CPPLIB=1]: After calling - cpp_start_read, set yy_cur and yy_lim to read from - parse_in.token_buffer, so that we'll see the first #line - directive. - * cpplib.c (cpp_start_read): finclude the main input file - before processing -include/-imacros. Process -imacros and - -include separately, and handle -include by stacking a - buffer for the file in question as if it'd been #included. - * toplev.c (documented_lang_options): Recognize -H when - USE_CPPLIB is on. - -1998-10-28 Zack Weinberg - - * cpplib.c: Merge do_once into do_pragma. Break file handling - code out of do_include. - Move append_include_chain, deps_output, - file_cleanup, redundant_include_p, import_hash, - lookup_import, add_import, read_filename_string, read_name_map, - open_include_file, finclude, safe_read to cppfiles.c. - Move prototypes for deps_output, append_include_chain, - finclude to cpplib.h. Move definition of struct - file_name_list there also. - - * cppfiles.c: New file. Contains all the above functions - broken out of cpplib.c; also hack_vms_include_specification - from cccp.c and find_include_file, a new function broken out of - do_include. - - * Makefile.in (cppmain): Depend on cppfiles.o. - (fix-header): Likewise. - (cppfiles.o): New target. - * configure.in (--enable-c-cpplib): Add cppfiles.o to - extra_c_objs. Add ../cppfiles.o to extra_cxx_objs. - -Wed Oct 28 14:06:49 1998 Jim Wilson - - * dwarfout.c (dwarfout_file_scope_decl): If DECL_CONTEXT, don't abort - if pending_types is non-zero. - (dwarfout_finish): Verify pending_types is zero before finishing. - -Wed Oct 28 10:29:09 1998 Nick Clifton - - * expr.c (convert_move): Use shifts to perform the move if a - suitable extend pattern cannot be found. Code written by - Richard Henderson . - -Wed Oct 28 03:59:29 1998 Bernd Schmidt - - * regclass.c (renumber, regno_allocated): New static variables, moved - out of allocate_reg_info. - (allocate_reg_info): Move these two variables outside the function. - Move code to free memory into new function free_reg_info. - (free_reg_info): New function, broken out of allocate_reg_info. - * toplev.c (compile_file): Call free_reg_info, not allocate_reg_info. - * rtl.h (allocate_reg_info): Don't declare. - (free_reg_info): Declare. - - * final.c (cleanup_subreg_operands): ASM_INPUTs need no treatment. - -Wed Oct 28 02:38:12 1998 Jason Merrill - - * toplev.c (compile_file): Temporarily revert last change. - -Wed Oct 28 00:00:35 1998 Jason Merrill - - * c-typeck.c (convert_for_assignment): Parenthesize. - -1998-10-28 Andreas Schwab - - * reload1.c (delete_output_reload): Avoid ambigous else. - -Wed Oct 28 00:10:35 1998 Jeffrey A Law (law@cygnus.com) - - * toplev.c (compile_file): Call allocate_reg_info to free register - table memory. - * rtl.h (allocate_reg_info): Declare. - - * PROJECTS: Remove entry for local spilling. - - * final.c (cleanup_subreg_operands): New function. - (final_scan_insn): Use it. - (alter_subreg): Clear the "used" field when we turn a SUBREG into - a REG. - * reload1.c (reload): Delete CLOBBER insns and also cleanup SUBREG - operands when reload has finished. - * reload.h (cleanup_subreg_operands): Declare.. - * flow.c (life_analysis_1): No longer delete CLOBBER insns after - reload. Handled in reload itself. - -Tue Oct 27 23:32:34 1998 Bernd Schmidt - - * reload1.c (verify_initial_offsets): New function. - (reload): Call it after reload_as_needed. Also verify that the frame - size stays constant during reload_as_needed. - * i386.h (CONST_DOUBLE_OK_FOR_LETTER_P): Undo Jul 26 change. - - * reload.h (struct insn_chain): Add need_operand_change element. - * reload1.c (new_insn_chain): Clear it. - (calculate_needs_all_insns): Set it; don't overload need_reload. - (reload_as_needed): Use it. - - * reload.c (find_reloads_address): Use BASE_REG_CLASS instead of - reload_address_base_reg_class throughout. Similar for INDEX_REG_CLASS - and reload_address_index_reg_class. - (find_reloads_address_1): Likewise. - * reload.h (reload_address_base_reg_class, - reload_address_index_reg_class): Don't declare. - * reload1.c (reg_old_renumber, pseudo_previous_regs, - pseudo_forbidden_regs, bad_spill_regs_global): New static variables. - (used_spill_regs): Now static. - (reload_address_base_reg_class, reload_address_index_reg_class, - regs_explicitly_used, counted_for_groups, counted_for_nongroups, - basic_block_needs, max_needs, group_size, group_mode, max_groups, - max_nongroups, max_needs_insn, max_groups_insn, max_nongroups_insn, - forbidden_regs): - Deleted variables. - (init_reload): Delete code to compute base/index reg classes. - (reload): Delete variable J. - Delete code to manage basic_block_needs. - Don't compute regs_explicitly_used. - Allocate, initialize and free reg_old_renumber, pseudo_forbidden_regs, - pseudo_previous_regs. - Initialize bad_spill_regs_global. - Don't call order_regs_for_reload here. - Don't initialize spill_reg_order and n_spills. - Don't forbid explicitly used regs to be used for spill regs. - Change main loop to infinite loop, with explicit break statements. - Make SOMETHING_CHANGED variable local to that loop. - Don't initialize max_needs, max_groups, max_nongroups, max_needs_insn, - max_groups_insn, max_nongroups_insn, group_size, group_mode. - Make sure spilled_pseudos is cleared before calling spill_hard_reg or - new_spill_reg. - Don't call dump_needs. - Delete code to reset potential_reload_regs. - Delete code to terminate loop conditional on the global needs variables - showing no further needs. - (calculate_needs_all_insns): Return void. All callers changed. - Initialize something_needs_elimination here, not in reload. - Delete avoid_return_reg kludge. - (calculate_needs): Lose AVOID_RETURN_REG and GLOBAL args, return void. - All callers changed. - Initialize the group_mode and group_size elements of the arg CHAIN. - Delete code to manage basic_block_needs. - Operate on elements of CHAIN instead of global variables. - Delete avoid_return_reg kludge. - (find_tworeg_group): Lose GLOBAL arg, take CHAIN arg, return void. - All callers changed. - Operate on elements of CHAIN instead of global variables. - Delete special SMALL_REGISTER_CLASSES code. - Delete spill_failure code; now in new_spill_reg. - (find_group): Lose GLOBAL arg, take CHAIN arg, return void. - All callers changed. - Operate on elements of CHAIN instead of global variables. - (maybe_mark_pseudo_spilled): New static function. - (find_reload_regs): Lose GLOBAL arg, take CHAIN arg, return void. - All callers changed. - Operate on elements of CHAIN instead of global variables. - Call order_regs_for_reload here, not in reload. - Initialize spill_reg_order and n_spills. - Simplify test whether an asm insn is involved. - Delete spill_failure code; now in new_spill_reg. - Call maybe_mark_pseudo_spilled for everything marked as live in - CHAIN. Merge CHAIN's used_spill_regs into the global variable - used_spill_regs. - (dump_needs): Take CHAIN arg. No longer static, to prevent the - compiler from optimizing this function (now unused) away. - Operate on elements of CHAIN instead of global variables. - (possible_group_p): Lose MAX_GROUPS arg, take CHAIN arg. All callers - changed. - Operate on elements of CHAIN instead of global variables. - (count_possible_groups): Lose GROUP_SIZE, GROUP_MODE, MAX_GROUPS args, - take CHAIN arg. All callers changed. - Operate on elements of CHAIN instead of global variables. - (new_spill_reg): Lose MAX_NEEDS, MAX_NONGROUPS, GLOBAL args, take - CHAIN, NONGROUP args. Return void. All callers changed. - Verify caller isn't trying to spill a pseudo. - Simplify test for illegal reg, just use bad_spill_regs. - Generate better error messages. - Operate on elements of CHAIN instead of global variables. - Mark spilled register in CHAIN's used_spill_regs element. - Don't call spill_hard_reg. - (spill_hard_reg): Lose GLOBAL arg, return void. All callers changed. - Mark spilled hard regs in bad_spill_regs_global. - Mark affected pseudos in spilled_pseudos, but don't spill them. - (ior_hard_reg_set): New static function. - (finish_spills): Return int. All callers changed. - Compute spill_reg_order, n_spills and spill_regs here. Also update - regs_ever_live for regs used as spills. - For every pseudo in spilled_pseudos, spill it and mark the previous - hard reg it had in pseudo_previous_regs. Compute which hard regs - are used as spills in insns during which it is live, and retry global - register allocation. Update all life information in the - reload_insn_chain not to include pseudos without hard regs. - Call alter_reg for all affected speudos. - - (scan_paradoxical_subregs): Disable SMALL_REGISTER_CLASSES special - case, it's not clear what it's supposed to do. - - (hard_reg_use_compare): Take bad_spill_regs into account. - (pseudos_counted): New static variable. - (count_pseudo): New static function. - (order_regs_for_reload): Take CHAIN arg. All callers changed. - Initialize bad_spill_regs from bad_spill_regs_global, then merge any - hard registers explicitly used across the current insn into the set. - Compute hard_reg_n_uses taking only pseudos live across this insn - into account. - Tweak sorting of potential_reload_regs. - (compare_spill_regs): Delete function. - (reload_as_needed): Don't sort the spill_regs array, it's computed - in proper order in finish_spills. - Delete avoid_return_reg kludge. - Delete code to manage basic_block_needs. - (allocate_reload_reg): Minor speed/readability tweaks. - Operate on elements of CHAIN instead of global variables. - (choose_reload_regs): Lose AVOID_RETURN_REG arg. All callers changed. - Delete avoid_return_reg kludge. - Initialize reload_reg_used from CHAIN's used_spill_regs element. - Delete unused label FAIL. - (reload_combine): Replace reload_address_index_reg_class with - INDEX_REGS. - Don't use used_spill_regs to determine information about lifetime of - hard regs. - -Tue Oct 27 13:15:02 1998 Nick Clifton - - * toplev.c (display_help): Ignore empty target specific - options, and if -W is also specified on the command line then - display undocumented options. - - * config/arm/arm.c: Updated with changes in devo sources. - * config/arm/arm.h: Updated with changes in devo sources. - * config/arm/lib1funcs.asm: Updated with changes in devo sources. - * config/arm/lib1thumb.asm: Add ELF support. - -Tue Oct 27 16:11:43 1998 David Edelsohn - - * collect2.c (aix64_flag): New variable. - (main, case 'b'): Parse it. - (GCC_CHECK_HDR): Object magic number must match mode. - (scan_prog_file): Only check for shared object if valid header. - Print debugging if header/mode mismatch. - -Tue Oct 27 10:15:02 1998 Nick Clifton - - Added support for arm-elf-linux configuration, submitted by Philip - Blundell , and integrated this with the arm-elf - code developed by Catherine Moore . The following - files are affected: - - * configure.in: Add arm-*-linux-gnu, armv2-*-linux and arm-*-elf - targets. - - * configure: Regenerated. - - * config/arm/aout.h: Add default definitions of REGISTER_PREFIX, - USER_LABEL_PREFIX and LOCAL_LABEL_PREFIX. Make other macro - definitions conditional on their not having been already defined. - - * config/arm/lin1funcs.asm: Add ELF only macros to generate .size - and .type directives, and add "(PLT)" qualification to function - calls. - - * config/arm/linux.h: Deleted. This file is now superseded by - either linux-elf.h or linux-aout.h. - - * config/arm/linux-gas.h: Define `inhibit_libc' if cross-compiling. - (CLEAR_INSN_CACHE): New macro, currently disabled (awaiting kernel - support). - Move definitions from old linux.h file here. - - * config/arm/elf.h: New file. Generic ARM/ELF support. - - * config/arm/linux-aout.h: New file. Support for Linux with a.out. - - * config/arm/linux-elf.h: New file. Support for Linux with ELF. - - * config/arm/linux-elf26.h: New file. Support for Linux with ELF - using the 26bit APCS. - - * config/arm/unknown-elf.h: New file. Support for OS'es other - than Linux with ELF. - - * config/arm/t-arm-elf: New file. makefile fragment for arm-elf - builds. - - * config/arm/coff.h: Include aout.h for basic assembler macros. - Add support for -mstructure_size_boundary= command line option. - - * config/arm/arm.h: Add support for -mstructure_size_boundary= - command line option. Make macro definitions conditional on their - not having been already defined. - - * config/arm/arm.c: Add support for -mstructure_size_boundary= - command line option. - - -Tue Oct 27 08:56:46 1998 Andrew MacLeod - - * dwarfout.c (ASM_OUTPUT_DWARF_STRING_NEWLINE): ASM_OUTPUT_DWARF_STRING - has been changed to not include a newline. Use this macro instead. - (output_enumeral_list, const_value_attribute, name_attribute, - comp_dir_attribute, prototyped_attribute, producer_attribute, - inline_attribute, pure_or_virtual_attribute, output_inheritance_die, - dwarfout_file_scope_decl, generate_new_sfname_entry, - generate_macinfo_entry, dwarfout_init, dwarfout_finish): Use - ASM_OUTPUT_DWARF_STRING_NEWLINE macro. - -Mon Oct 26 13:35:02 1998 Richard Henderson - - * combine.c (subst): Process the inputs to a parallel asm_operands - only once. - -Mon Oct 26 13:32:31 1998 Richard Henderson - - * stmt.c (expand_asm_operands): Accept `=' or `+' at any position. - -Mon Oct 26 12:53:14 1998 Jeffrey A Law (law@cygnus.com) - - * tm.texi (ASM_OUTPUT_MAX_SKIP_ALIGN): Document. - -Mon Oct 26 00:36:58 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Oct 25 23:36:52 1998 Jason Merrill - - * stmt.c (expand_fixup): Set fixup->before_jump to a - NOTE_INSN_DELETED instead of a NOTE_INSN_BLOCK_BEG. - -Sun Oct 25 15:49:57 1998 Kaveh R. Ghazi - - * Makefile.in (recog.o): Depend on toplev.h. - (insn-emit.o): Depend on recog.h. - (insn-peep.o): Depend on recog.h and insn-config.h. - - * combine.c (simplify_set): Remove unused variable `scratches'. - - * final.c (final_scan_insn): Wrap declaration of variables `vlen' - and `idx' in macro conditional controlling their use. - - * genemit.c (main): Make the generated output file include - recog.h. Don't have it declare `insn_operand_constraint', since - we get it from recog.h. - - * genpeep.c (main): Make the generated output file include - insn-config.h and recog.h. - - * recog.c: Include toplev.h. - (extract_insn): Remove unused variable `p'. - - * regclass.c (fix_register): Add missing braces around initializer - for `what_option'. - (allocate_reg_info): Move variable `i' into the scope where it is - used. Change its type to `size_t'. - -Sun Oct 25 13:10:15 1998 Bernd Schmidt - - * reload.c (push_reload): When merging reloads, make sure - that reload_in_reg and reload_in are from the same reload in - all cases. - -Sun Oct 25 12:07:00 1998 Mumit Khan - - * i386/crtdll.h (CPP_PREDEFINES): Fix typo. - * i386/mingw32.h (CPP_PREDEFINES): Likewise. - -Fri Oct 23 23:42:03 1998 David Edelsohn - - * loop.c (loop_has_tablejump): New variable. - (prescan_loop): Scan for it. - (insert_bct): Replace explicit scan with use of it. - * regclass.c (regclass): Restore loop variable j. - (record_reg_classes): Deterine op_types modifiers and initialize - classes[i] before matching constraints. Handle matching - constraints 5-9. - -Fri Oct 23 13:55:48 1998 Jim Wilson - - * m32r/m32r.c (gen_split_move_double): Call alter_subreg. Delete - subreg support. - -Fri Oct 23 16:19:24 1998 Kaveh R. Ghazi - - * mips.h (EXTRA_SPECS): Add missing initializers. - -Fri Oct 23 16:08:39 1998 Kaveh R. Ghazi - - * sparc.h (EXTRA_SPECS): Add missing initializers. - (sparc_defer_case_vector): Provide a prototype. - - * svr4.h (ASM_OUTPUT_ASCII): Cast STRING_LIMIT to (long) when - comparing it to the result of a pointer subtraction. - -Fri Oct 23 15:34:14 1998 Kaveh R. Ghazi - - * alpha.c (override_options): Use ISDIGIT(), not isdigit(). Cast - the argument to (unsigned char). - - * alpha.h (EXTRA_SPECS): Add missing initializers. - (ASM_GENERATE_INTERNAL_LABEL): Ensure the argument matches the - format specifier. - -Fri Oct 23 13:12:35 1998 Jeffrey A Law (law@cygnus.com) - - * flow.c (life_analysis_1): Enable "rescan" code after reload. - (propagate_block): Delete dead code after reload. - - * sched.c (update_flow_info): Revert Oct 19, 1998 change. Brings - back Oct 15, 1998 change. - * haifa-sched.c (update_flow_info): Likewise. - * flow.c (life_analysis_1): Delete CLOBBER insns after reload. - - * mn10200.md (truncated shift): Accept constant inputs too. - -Fri Oct 23 04:06:57 1998 Richard Earnshaw (rearnsha@arm.com) - - * machmode.h (mode_mask_array): No longer const. - * rtl.c (init_rtl): Fully initialize it if EXTRA_CC_MODES defined. - -Fri Oct 23 11:19:06 1998 Martin v. Löwis - - * frame.c: Somewhat explain `FDE'. - Suggested by Brendan Kehoe - -Fri Oct 23 00:56:11 1998 Jason Merrill - - * expr.c (pending_chain): Move up. - (save_expr_status): Do save pending_chain. - (restore_expr_status): And restore it. - * function.h (struct function): Add pending_chain. - -1998-10-23 Herman A.J. ten Brugge - - * reorg.c (relax_delay_slots): Fixed test for mostly_true_jump. The - did not match the code. - -Fri Oct 23 00:07:01 1998 Bernd Schmidt - - * regclass.c (regclass): Break out some code into new function - scan_one_insn, and into regclass_init. - (init_cost): New static variable, moved out of regclass. - (regclass_init): Initialize it here, not in . - (scan_one_insn): New static function, broken out of regclass. - * recog.c (apply_change_group): Break out some code into new - function insn_invalid_p. - (insn_invalid_p): New static fn, broken out of apply_change_group. - -Thu Oct 22 22:34:42 1998 Jim Wilson - - * reload1.c (reload_as_needed): When rewrite POST_INC, verify - reg_reloaded_contents matches incremented pseudo. - - * v850/v850.c (v850_reorg): Call alter_subreg. Delete subreg support. - -Fri Oct 23 11:11:56 1998 Michael Hayes - - * rtl.def (POST_MODIFY, PRE_MODIFY): New generalized operators for - addressing modes with side effects. These are currently - placeholders for the C4x target. - -Thu Oct 22 16:46:35 1998 Bernd Schmidt - - * loop.c (express_from): Make sure that when generating a PLUS of - a PLUS, any constant expression appears on the outermost PLUS. - -Thu Oct 22 15:46:23 1998 Per Bothner (bothner@cygnus.com) - - * Makefile.in (distdir-cvs, distdir-start): Clean up so it - works if "$(srcdir)" != ".". - -Wed Oct 21 19:23:59 1998 Jim Wilson - - * expmed.c (store_bit_field): If need to add a SUBREG, then remove - existing SUBREG if we can, otherwise abort. - -Wed Oct 21 09:58:51 1998 Mark Mitchell - - * c-common.c (c_apply_type_quals_to_decl): Don't crash when - `restrict' is applied to a non-pointer variable. - -Wed Oct 21 09:18:58 1998 Mark Mitchell - - * invoke.texi: Document -flang-isoc9x. - - * Makefile.in (OBJS): Add splay-tree.o. - (c-common.o): Depend on rtl.h. - (splay-tree.o): List dependencies and provide build rule. - - * rtl.h (record_alias_subset): New function. - * alias.c: Include splay-tree.h. - (alias_set_entry): New type. - (CHECK_ALIAS_SETS_FOR_CONSISTENCY): Remove. - (DIFFERENT_ALIAS_SETS_P): Use mem_in_disjoint_alias_sets_p. - (mems_in_disjoin_alias_sets_p): New function. - (alias_set_compare): Likewise. - (insert_subset_children): Likewise. - (get_alias_set_entry): Likewise. - - * tree.h (TYPE_RESTRICT): New macro. - (TYPE_UNQUALIFIED): New manifest constant. - (TYPE_QUAL_CONST): Likewise. - (TYPE_QUAL_VOLATILE): Likewise. - (TYPE_QUAL_RESTRICT): Likewise. - (tree_type): Add restrict_flag. Reduce count of free bits. - (DECL_POINTER_ALIAS_SET): New macro. - (DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise. - (tree_decl): Add pointer_alias_set. - (build_qualified_type): New function. - (build_type_variant): Define in terms of build_qualified_type. - * tree.c (set_type_quals): New function. - (make_node): Initialize DECL_POINTER_ALIAS_SET. - (build_type_attribute_variant): Use build_qualified_type and - set_type_quals. - (build_type_variant): Rename, and modify, to become... - (build_qualified_type): New function. - (build_complex_type): Use set_type_quals. - - * c-tree.h (C_TYPE_OBJECT_P): New macro. - (C_TYPE_FUNCTION_P): Likewise. - (C_TYPE_INCOMPLETE_P): Likewise. - (C_TYPE_OBJECT_OR_INCOMPLETE_P): Likewise. - (c_apply_type_quals_to_decl): New function. - (c_build_qualified_type): New function. - (c_build_type_variant): Define in terms of c_build_qualified_type. - (flag_isoc9x): Declare. - * c-typeck.c (qualify_type): Use c_build_qualified_type. - (common_type): Change to use TYPE_QUALS. - (comptypes): Likewise. - (convert_for_assignment): Likewise. - * c-aux-info.c (gen_type): Likewise. Deal with `restrict'. - * c-decl.c (flag_isoc9x): Define. - (c_decode_option): Handle -flang-isoc9x. - (grokdeclarator): Update to handle restrict. Use TYPE_QUALS, - c_build_qualified_type, etc. Use c_apply_type_quals_to_decl. - * c-lex.c (init_lex): Deal with restrict. - (init_lex): Don't treat restrict as a reserved word in - -traditional mode, or without -flang-isoc9x. - * c-lex.h (rid): Add RID_RESTRICT. - * c-parse.gperf (restrict, __restrict, __restrict__): Make - equivalent to RID_RESTRICT. - * c-parse.in (TYPE_QUAL): Update comment. - * c-common.c: Include rtl.h. - (c_find_base_decl): New function. - (c_build_type_variant): Rename, and modify, to become ... - (c_build_qualified_type): New function. - (c_apply_type_quals_to_decl): Likewise. - (c_get_alias_set): For INDIRECT_REFs, check to see if we can find - a particular alias set for the reference. - * toplev.c (documented_lang_options): Add -flang-isoc9x. - -Wed Oct 21 09:15:06 1998 Nick Clifton - - * config/arm/arm.h (TARGET_SWITCHES): Document arm specific - command line switches. - -Tue Oct 20 10:04:51 1998 Graham - - * reload.c (loc_mentioned_in_p): Add missing braces to bind - else to correct if. - -Mon Oct 19 16:34:05 1998 Tom Tromey - - * gcc.c (option_map): Added --classpath and --CLASSPATH. - -Tue Oct 20 10:59:02 1998 Gavin Romig-Koch - - * regclass.c (fix_register): Add error message. - * invoke.texi (-fcall-used-REG,-fcall-saved-REG): Note the - new error message. - -Tue Oct 20 10:12:17 1998 Kaveh R. Ghazi - - * c-decl.c (warn_missing_noreturn): New global variable. - (c_decode_option): Check for new flags -W{no-}missing-noreturn. - (finish_function): Implement missing noreturn warning. - - * c-tree.h (warn_missing_noreturn): Declare extern. - - * invoke.texi: Document new flags. - - * toplev.c (documented_lang_options): Add description. - -Tue Oct 20 22:16:11 1998 Michael Hayes - - * config/c4x/c4x.c (c4x_parallel_process): Disable until BCT - loop optimization stable for the C4x. - (c4x_rptb_info_t, c4x_dump, c4x_rptb_in_range, c4x_rptb_unjumped_loop, - c4x_rptb_find_comp_and_jump, c4x_rptb_loop_info_get, - c4x_rptb_emit_init, c4x_rptb_process): Deleted (superseded by BCT - loop optimization). - (c4x_address_conflict): Be more paranoid when packing a volatile - memref in a parallel load/store. - -Tue Oct 20 21:56:05 1998 Michael Hayes - - * config/c4x/c4x.md (repeat_block_top, repeat_block_end, - repeat_block_filler): Deleted. - (*ashlqi3_set, *ashrqi3_const_set, *ashrqi3_nonconst_clobber): - Condition code not set if destination register from 'c' class. - (*subbqi3_carry_clobber): Fix typo. - -1998-10-18 Herman A.J. ten Brugge - - * reorg.c (steal_delay_list_from_target): Check for insns that - modify the condition codes and effect the direction of the jump - in the sequence. - -Sat Oct 17 13:09:09 1998 Graham - - * function.c (purge_addressof_1): Replace call to - emit_insns_before() with emit_insn_before(). - -Mon Oct 19 19:34:03 1998 Mike Stump - - * libgcc2.c (__pure_virtual): Call __terminate instead of _exit. - -Mon Oct 19 13:26:24 1998 Bernd Schmidt - - * jump.c (sets_cc0_p): Compile only if HAVE_cc0. - -Mon Oct 19 11:40:56 1998 Jeffrey A Law (law@cygnus.com) - - * gcse.c (compute_hash_table): Correctly identify hard regs which are - clobbered across calls. - - * loop.c (scan_loop): Be more selective about what invariants are - moved out of a loop. - -Mon Oct 19 10:46:58 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Oct 19 11:40:56 1998 Jeffrey A Law (law@cygnus.com) - - * libgcc2.c (eh_context_static): Do not call malloc to allocate the - static eh_context structure. - -Mon Oct 19 10:45:40 1998 Bernd Schmidt - - * combine.c (recog_for_combine): Lose PADDED_SCRATCHES arg. All - callers changed. - (try_combine): Don't update max_scratch. - * flow.c (max_scratch, num_scratch): Delete variables. - (life_analysis_1): Don't initialize max_scratch. - (propagate_block): Don't update max_scratch. - (mark_set_1): Don't increment num_scratch. - * regs.h (max_scratch): Delete declaration. - -Mon Oct 19 10:28:15 1998 Jeffrey A Law (law@cygnus.com) - - * reload1.c (reload_reg_free_before_p): Hack. Return 0 if EQUIV - is nonzero. This is temporary! - - * sched.c (update_flow_info): Handle death notes made invalid by - instruction splitting. Partially reverts Oct 15, 1998 patch. - * haifa-sched.c (update_flow_info): Likewise. - -Sun Oct 18 17:31:26 1998 Jeffrey A Law (law@cygnus.com) - - * function.c (uninitialized_vars_warning): Do not warn for a VAR_DECL - if it has a nonzero DECL_INITIAL. - -Sat Oct 17 23:18:08 1998 Kaveh R. Ghazi - - * Makefile.in (flow.o): Depend on recog.h. - - * cpplib.h (directive_table): Add missing initializiers. - (finclude): Change type of variable `bsize' to size_t. - - * cse.c (rtx_cost): Mark parameter `outer_code' with ATTRIBUTE_UNUSED. - - * dwarfout.h (dwarfout_label): Wrap prototype in macro RTX_CODE. - - * fix-header.c (lookup_std_proto): Cast the result of `strlen' to - `int' when comparing against one. - (cpp_file_line_for_message): Mark parameter `pfile' with - ATTRIBUTE_UNUSED. - (cpp_fatal): Mark parameter `pfile' with ATTRIBUTE_UNUSED. - - * flow.c: Include recog.h. - (sbitmap_copy): Cast arguments 1 & 2 of `bcopy' to (PTR). - - * function.c (thread_prologue_and_epilogue_insns): Mark parameter - `f' with ATTRIBUTE_UNUSED. - (reposition_prologue_and_epilogue_notes): Likewise. - - * genopinit.c (gen_insn): Cast argument of ctype functions to - `unsigned char'. - - * haifa-sched.c: Include recog.h. - (blockage_range): Cast result of UNIT_BLOCKED macro to (int) when - comparing against one. - - * libgcc2.a (__throw): Revert ATTRIBUTE_UNUSED change for now. - - * mips-tfile.c (parse_end): Cast the argument of ctype function to - `unsigned char'. - (parse_ent): Likewise. - (parse_input): Likewise. - - * optabs.c (init_libfuncs): Likewise. - - * protoize.c (find_rightmost_formals_list): Likewise. - - * recog.h (const_double_operand): Fix typo in prototype. - - * tlink.c (scan_linker_output): Cast the argument of ctype - function to `unsigned char'. - - * toplev.c (check_lang_option): Cast the result of `strlen' to - `int' when comparing against one. - -Sat Oct 17 13:09:09 1998 Graham - - * gcse.c (dump_cuid_table): Correct typo. - -Sat Oct 17 11:02:47 1998 Nick Clifton - - * toplev.c (display_help): Prepend '-m' to target specific - options. - (check_lang_option): Ignore text after end of first word of a - language specific option. - -Sat Oct 17 02:26:03 1998 Bernd Schmidt - - * reload1.c (reg_used_by_pseudo): New static variable. - (choose_reload_regs): Initialize it. - Use it instead of testing spill_reg_order to determine whether a - pseudo is live in a hard register across the current insn. - Fix a typo in a reference to reload_reg_rtx. - - * flow.c (propagate_block): Replace code that computes and uses - regs_sometimes_live with simpler code that just walks the set of - currently live registers. - - * Makefile.in (insn-extract.o): Fix dependencies. - * genextract.c (main): Generate includes for insn-config.h and - recog.h. - Delete generation of declarations which are now in recog.h. - * genrecog.c (main): Delete generation of definitions which are - now in recog.c. - * local-alloc.c (block_alloc): Use extract_insn and the variables - it sets up instead of looking up values by insn_code. - * recog.c (recog_operand, recog_operand_loc, recog_dup_loc, - recog_dup_num): Define here instead of generating the definition in - genrecog.c. - (recog_n_operands, recog_n_dups, recog_n_alternatives, - recog_operand_mode, recog_constraints, recog_operand_address_p): - New variables. - (extract_insn): New function. - * recog.h (extract_insn): Declare function. - (which_alternative, recog_n_operands, recog_n_dups, - recog_n_alternatives, recog_operand_mode, recog_constraints, - recog_operand_address_p): Declare variables. - * regclass.c (n_occurrences): New static function. - * reload.c (n_occurrences): Delete function. - (find_reloads): Use extract_insn. - * reload.h (n_occurrences): Delete declaration. - -Sat Oct 17 01:17:51 1998 Jeffrey A Law (law@cygnus.com) - - * reload1.c (reload_as_needed): Fix test for when to call - update_eliminable_offsets. - -Fri Oct 16 20:40:50 1998 J"orn Rennecke - - Fix consistency problems with reg_equiv_{mem,address}; - Improve reload inheritance; - - * reload.c (reload_out_reg): New variable. - (loc_mentioned_in_p, remove_address_replacements): New functions. - (remove_replacements): Deleted. - (push_reload): Set reload_out_reg[i]. - When merging, also set reload_{in,out}_reg[i], and remove - duplicate address reloads. - (combine_reloads): Copy reload_out_reg[i]. - (find_reloads): Do make_memloc substitution also when - reg_equiv_memory_loc[regno] and num_not_at_initial_offset - are both nonzero. - Include *recog_operand_loc in commutativity operand changes. - Generate optional output reloads. - Delete reference to n_memlocs. Don't set *recog_operand_loc before - processing operands. Call make_memloc in reg_equiv_address code. - Set *recog_operand_loc only after processing operands, and only - if replace is true. Return a value. - When changing address reload types for operands that didn't get - reloaded, use RELOAD_FOR_OPADDR_ADDRESS for - RELOAD_FOR_INPADDR_ADDRESS / RELOAD_FOR_OUTADDR_ADDRESS reloads. - Don't emit USEs for pseudo SUBREGs when not replacing. - (find_reloads_address): Do make_memloc substitution also when - reg_equiv_memory_loc[regno] and num_not_at_initial_offset - are both nonzero. - (find_reloads_toplev): Likewise. - Call make_memloc in reg_equiv_address code. - (debug_reload_to_stream): Add code to output reload_out_reg. - (make_memloc): Delete local variable i, ifdefed out code, and - references to memlocs and n_memlocs. - (memlocs, n_memlocs): Delete. - (push_secondary_reload): Clear reload_out_reg. - (find_reloads_address_1): Provide memrefloc argument to all calls - to find_reloads_address. - In AUTO_INC code, handle non-directly addressable equivalences properly. - * reload.h (reload_out_reg, num_not_at_initial_offset): Declare. - (find_reloads): Add return type. - (remove_address_replacements, deallocate_reload_reg): Declare. - * reload1.c (num_not_at_initial_offset): No longer static. - (delete_address_reloads, delete_address_reloads_1): Likewise. - (deallocate_reload_reg): New function. - (spill_reg_stored_to): New array. - (eliminate_regs): Don't substitute from reg_equiv_memory_loc. - (eliminate_regs_in_insn): Move assignments of previous_offset and - max_offset fields, and recalculation of num_not_at_initial_offset - into new static function: - (update_eliminable_offsets) . - (reload_as_needed): Call update_eliminable_offsets after calling - find_reloads. - Call forget_old_reloads_1 with contents of reloaded auto_inc - expressions if the actual addressing can't be changed to match the - auto_inc. - (choose_reload_regs): For inheritance, replace - reload_reg_free_before_p test with reload_reg_used_at_all test, and - remove stand-alone reload_reg_used_at_all test. - Use reload_out_reg to determine which reload regs have output reloads. - Treat reload_override_in more similar to inherited reloads. - Handle (subreg (reg... for inheritance. - For flag_expensive_optimizations, add an extra pass to remove - unnecessary reloads from known working inheritance. - Delete obsolete code for pseudos replaced with MEMs. - Handle inheritance from auto_inc expressions. - (emit_reload_insns): If reload_in is a MEM, set OLD to - reload_in_reg[j]. - Don't reload directly from oldequiv; if it's a pseudo with a - stack slot, use reload_in[j]. - Check that reload_in_reg[j] is a MEM before replacing reload_in - from reg_reloaded_contents. - Include non-spill registers in reload inheritance processing. - Also try to use reload_out_reg to set spill_reg_store / - reg_last_reload_reg. - In code to set new_spill_reg_store, use single_set to find out if - there is a single set. - Add code that allows to delete optional output reloads. - Add code to allow deletion of output reloads that use no spill reg. - At the end, set reload_override_in to oldequiv. - Also call delete_output_reload if reload_out_reg is equal to old - in oldequiv code. - Add code to call delete_output_reload for stores with no matching load. - Set / use spill_reg_stored_to. - Handle case where secondary output reload uses a temporary, but - actual store isn't found. - When looking for a store of a value not loaded in order to call - delete_output_reload, count_occurrences should return 0 for no - loads; but discount inherited input reloadill_reg_stored_to. - Do checks for extra uses of REG. Changed all - callers. - Use delete_address_reloads. - (reload): Take return value of find_reloads into account. - If a no-op set needs more than one reload, delete it. - (reload_reg_free_before_p): RELOAD_FOR_INPUT - can ignore RELOAD_FOR_INPUT_ADDRESS / RELOAD_FOR_INPADDR_ADDRESS - for the same operand. - (clear_reload_reg_in_use): Check for other reloads that keep a - register in use. - (reload_reg_free_for_value_p): Handle RELOAD_FOR_OPERAND_ADDRESS / - RELOAD_FOR_OPADDR_ADDR. - Take into account when an address address reload is only needed - for the address reload we are considering. - (count_occurrences): Use rtx_equal_p for MEMs. - (inc_for_reload): Return instruction that stores into RELOADREG. - New argument two, IN, and rtx. Changed all callers. - (calculate_needs_all_insns, reload_as_needed): - Don't clear after_call for a CLOBBER. - Keep track of how many hard registers need to be copied from - after_call, and don't clear after_call before we have seen - that much copies, or we see a different instruction. - -Fri Oct 16 10:58:23 1998 Jeffrey A Law (law@cygnus.com) - - * flow.c (find_basic_blocks_1): Do not delete unreachable blocks - after reload has completed. - -Fri Oct 16 17:26:10 1998 Dave Brolley - - * cpplib.c (cpp_get_token): Replace whitespace that occurs between - a macro name and the next token with a single blank if that whitespace - is in a macro buffer and the next token is not '('. - -Fri Oct 16 15:44:02 1998 Dave Brolley - - * cccp.c (rescan): Handle multibyte characters ending in backslash. - (rescan): Likewise. - (skip_if_group): Likewise. - (skip_to_end_of_comment): Likewise. - (macarg1): Likewise. - (discard_comments): Likewise. - (change_newlines): Likewise. - -Fri Oct 16 15:26:24 1998 Dave Brolley - - * c-lex.c (yylex): Fix unaligned access of wchar_t. - -Fri Oct 16 10:47:53 1998 Nick Clifton - - * config/arm/arm.h (TARGET_SWITCHES): Add --help documentation. - (TARGET_OPTIONS): Add --help documentation. - -Fri Oct 16 11:49:01 1998 Kaveh R. Ghazi - - * rtl.h (sets_cc0_p): Revert Oct 14 ATTRIBUTE_NORETURN change. - -Fri Oct 16 07:08:46 1998 Bruce Korb - - * fixinc/* Moved in from ../contrib directory in preparation - for integrating it into the normal build process. In particular, - fixinc/Makefile.in must be config-ed into the build directory - as fixinc/Makefile. Proposed patches to ./Makefile.in and - ./configure.in will be "in the mail" momentarily. - -Fri Oct 16 08:13:46 1998 David S. Miller - - * cse.c (cse_basic_block): Fixup hash flushing loop so we do not - accidently walk into the free list. Comment how that can happen. - (invalidate): Fix indentation. - -Thu Oct 15 23:53:29 1998 Bernd Schmidt - Jeffrey A Law (law@cygnus.com) - - * flow.c (life_analysis_1): Do not clobber regs_ever_live after - reload. Never perform rescans of the insn chain after reload. - (propagate_block): Do not delete insn or create new autoinc addressing - modes after reload. - - * jump.c (jump_optimize): Unconditionally use the code that was - previously conditional on PRESERVE_DEATH_INFO_REGNO_P. - * reload1.c (reload): When reloading is finished, delete all - REG_DEAD and REG_UNUSED notes. - (emit_reload_insns): Delete all code that was conditional on - PRESERVE_DEATH_INFO_REGNO_P. - (no_longer_dead_regs): Delete variable. - (reload_cse_delete_death_notes): Delete function. - (reload_cse_no_longer_dead): Delete function. - (reload_cse_regs_1): Delete all code to handle deletion of death - notes. - (reload_cse_noop_set_p): Likewise. - (reload_cse_simplify_set): Likewise. - (reload_cse_simplify_operands): Likewise. - (reload_cse_move2add): Likewise. - * reorg.c (used_spill_regs): Delete declaration. - (max_label_num_after_reload): Delete declaration. - (find_dead_or_set_registers): Don't assume that spill regs are - dead at a CODE_LABEL. - * rtlanal.c (dead_or_set_regno_p): Death notes are always accurate, - even after reload. - * sched.c (sched_analyze_insn): Likewise. - (update_flow_info): Likewise. - * haifa-sched.c (sched_analyze_insn): Likewise. - (update_flow_info): Likewise. - * tm.texi (PRESERVE_DEATH_INFO_REGNO_P): Delete documentation. - * toplev.c (max_label_num_after_reload): Delete variable. - (rest_of_compilation): Don't set max_label_num_after_reload. - Call life_analysis after reload_cse_regs if optimizing. - * config/gmicro/gmicro.h: Delete comment referring to - PRESERVE_DEATH_INFO_REGNO_P. - * config/i386/i386.h: Likewise. - * config/m88k/m88k.h: Likewise. - * config/m32r/m32r.h (PRESERVE_DEATH_INFO_REGNO_P): Delete definition. - * config/sh/sh.h: Likewise. - -Thu Oct 15 19:48:41 1998 David Edelsohn - - * loop.c (strength_reduce): Restore marking bct_p as - ATTRIBUTE_UNUSED. - * rs6000.c (optimization_options): Change #ifdef HAIFA to - HAVE_decrement_and_branch_on_count. - (small_data_operand): Remove TARGET_ELF condition for marking - parameters ATTRIBUTE_UNUSED. - -Thu Oct 15 11:45:51 1998 Robert Lipe - - * config/i386/sco5.h (MAX_OFILE_ALIGNMENT): Define. - (SELECT_SECTION): Resync with svr4.h. - -Thu Oct 15 12:42:13 1998 David Edelsohn - - * loop.c (strength_reduce): Undo Oct 14 change marking bct_p - ATTRIBUTE_UNUSED. - -Thu Oct 15 00:57:55 1998 Robert Lipe - - * c-pragma.c (handle_pragma_token): Test for null tree before - dereferencing TREE_CODE. - -Thu Oct 15 17:36:48 1998 Michael Hayes - - * config/c4x/c4x.c: Convert to use GEN_INT. - (c4x_parallel_process): Rework to handle new repeat loop structure. - - * config/c4x/c4x.md: Convert to use GEN_INT. - (rptb_end): Convert to use GE test. Replace uses with clobbers. - (decrement_and_branch_on_count): Likewise. - - * config/c4x/c4x.h (REPEAT_BLOCK_PROCESS): Deleted hook now that - loop.c has the desired functionality. - (rc_reg_operand): New prototype. - - * config/c4x/t-c4x: Can now build all front ends. - -Wed Oct 14 23:27:08 1998 Didier FORT (didier.fort@fedex.com) - - * fixincludes: Fix up rpc/{clnt,svr,xdr}.h for SunOS. - -Wed Oct 14 22:13:28 1998 Joel Sherrill (joel@OARcorp.com) - - * Makefile.in (stmp-fixinc): Do not install assert.h if not desired. - * config/t-rtems: Do not install assert.h -- use newlib's. - -Wed Oct 14 21:57:08 1998 J"orn Rennecke - - * combine.c (combine_instructions): When finished, call init_recog. - * regmove.c (optimize_reg_copy_3): Reject volatile MEMs. - -Wed Oct 14 16:10:22 1998 Per Bothner - - * toplev.c: If flag_syntax_only, don't open or write assembler file. - -Wed Oct 14 13:26:05 1998 Kaveh R. Ghazi - - * cppalloc.c (memory_full): Mark function prototype with - ATTRIBUTE_NORETURN. - - * demangle.h (collect_exit): Likewise. - - * fix-header.c (v_fatal, fatal): Likewise. - - * gcc.c (pfatal_with_name, pfatal_pexecute, fatal, fancy_abort): - Likewise. - - * gcov.c (print_usage): Likewise. - - * genattr.c (fatal, fancy_abort): Likewise. - - * genattrtab.c (fatal, fancy_abort): Likewise. - - * gencodes.c (fatal, fancy_abort): Likewise. - - * genconfig.c (fatal, fancy_abort): Likewise. - - * genemit.c (fatal, fancy_abort): Likewise. - - * genextract.c (fatal, fancy_abort): Likewise. - - * genflags.c (fatal, fancy_abort): Likewise. - - * genopinit.c (fatal, fancy_abort): Likewise. - - * genoutput.c (fatal, fancy_abort): Likewise. - - * genpeep.c (fatal, fancy_abort): Likewise. - - * genrecog.c (fatal, fancy_abort): Likewise. - - * libgcc2.c (__eprintf, __default_terminate, __sjthrow, - __sjpopnthrow, __throw): Likewise. - - * objc/objc-act.c (objc_fatal): Likewise. - - * protoize.c (usage, aux_info_corrupted, - declare_source_confusing): Likewise. - - * rtl.c (dump_and_abort): Likewise. - - * rtl.h (sets_cc0_p): Likewise. - - * toplev.c (float_signal, pipe_closed): Likewise. - -1998-10-14 Andreas Schwab - - * dwarf2out.c (expand_builtin_dwarf_reg_size): Look at all ranges - when generating the decision tree for the general case. - - * config/m68k/m68k.h (HARD_REGNO_MODE_OK): Don't accept modes - wider that 12 bytes in fpu regs or wider than 8 byte in fpa regs. - -Wed Oct 14 11:14:02 1998 Kaveh R. Ghazi - - * Makefile.in (sched.o): Depend on recog.h. - - * alias.c (REG_BASE_VALUE): Cast the result of REGNO() macro to - (unsigned) when comparing against one. - (find_base_value): Likewise. - (record_base_value): Cast variable `regno' to (unsigned) when - comparing against one. Cast the result of REGNO() macro to - (unsigned) when comparing against one. - (memrefs_conflict_p): Change type of variables `r_x' and `r_y' to - unsigned. - (init_alias_analysis): Add unsigned variable `ui'. Use it as loop - variable where an unsigned index is needed. - - * caller-save.c (init_caller_save): Cast `-1' to (enum insn_code) - before comparing against one. - - * collect2.c: Add prototypes for functions `error', `fatal' and - `fatal_perror'. Make these functions take variable arguments - instead of faking it with a fixed number of args. - (write_c_file_stat): Cast the argument of ctype macro to (unsigned - char). - - * combine.c (can_combine_p): Mark parameter `pred' with - ATTRIBUTE_UNUSED. - (find_split_point): Cast variable `src' to (unsigned - HOST_WIDE_INT) when comparing against one. - (simplify_rtx): Cast 1 to (unsigned HOST_WIDE_INT) in shift. - (simplify_logical): Likewise. - (force_to_mode): Cast result of INTVAL() macro to (unsigned - HOST_WIDE_INT) when comparing against one. Cast 1 to (unsigned - HOST_WIDE_INT) in shift. - (simplify_and_const_int): Cast result of INTVAL() macro to - `unsigned HOST_WIDE_INT' when comparing against one. - (merge_outer_ops): Cast variable const0 to `unsigned - HOST_WIDE_INT' when comparing against the result of - GET_MODE_MASK() macro. - (simplify_comparison): Likewise for variable `c0'. Cast variable - `const_op' to `unsigned HOST_WIDE_INT' when comparing against - one. Cast `1' to `unsigned HOST_WIDE_INT' in shift. Cast the - result of `GET_MODE_MASK()/2' to `HOST_WIDE_INT' when comparing - against one. Cast `1' to `unsigned HOST_WIDE_INT' in shift. Cast - result of INTVAL() macro to `unsigned HOST_WIDE_INT' when - comparing against one. - (distribute_notes): Wrap variable `cc0_setter' in macro `HAVE_cc0'. - - config/mips/mips.c (gen_int_relational): Cast result of INTVAL() - macro to `unsigned HOST_WIDE_INT' when comparing against one. - (output_block_move): Cast `sizeof' expression to (int) when - comparing against one. - (function_arg): Cast BITS_PER_WORD to `unsigned' when comparing - against one. - (save_restore_insns): Cast `base_offset' to `long' to match format - specifier in fprintf. - - * config/mips/mips.h (Pmode): Cast the result of `Pmode' macro - to `enum machine_mode'. - - * flow.c (life_analysis_1): Remove unused variable `insn'. - - * gcc.c (translate_options): Move variables `j' and `k' into the - scope in which they are used. Change their types to `size_t'. - (set_spec): Cast the argument of ctype macro to `unsigned char'. - (read_specs): Likewise. - (process_command): Cast `sizeof' to (int) when comparing against one. - (do_spec_1): Cast the argument of ctype macro to `unsigned char'. - (handle_braces): Cast both sides of `==' expression to `long' to - ensure sign matching. - (main): Cast variable `i' to `int' when comparing against one. - - * gcov-io.h (__fetch_long): Change type of parameter `bytes' from - int to size_t. Cast variable `i' to size_t when comparing against - one. - - * genattrtab.c (convert_set_attr_alternative): Remove unused - parameter `insn_code'. All callers changed. - (convert_set_attr): Likewise. - - * genrecog.c (add_to_sequence): Cast result of XVECLEN() macro to - size_t when comparing against one. Likewise for variable `len'. - - * global.c (global_alloc): Cast variable `max_regno' to size_t - when comparing against one. Likewise for variable `max_allocno'. - - * jump.c (sets_cc0_p): Mark parameter `x' with ATTRIBUTE_UNUSED. - - * local-alloc.c (validate_equiv_mem_from_store): Mark parameter - `set' with ATTRIBUTE_UNUSED. - (find_free_reg): Cast `sizeof' expression to (int) when comparing - against one. - - * loop.c (count_loop_regs_set): Remove unused variable `dest'. - (strength_reduce): Mark parameter `bct_p' with ATTRIBUTE_UNUSED. - (get_condition): Cast variable `const_val' to `unsigned - HOST_WIDE_INT' when comparing against one. Cast unsigned - expression to HOST_WIDE_INT when comparing against one. - (insert_loop_mem): Mark parameter `data' with ATTRIBUTE_UNUSED. - (load_mems_and_recount_loop_regs_set): Cast variable `nregs' to - `unsigned' when comparing against one. - - * protoize.c (is_id_char): Change type of parameter `ch' to - unsigned char. - (munge_compile_params): Cast argument of ctype macro to (const - unsigned char). - (process_aux_info_file): Cast variable `aux_info_size' to int when - comparing against one. - (forward_to_next_token_char): Cast argument of ctype macro to - `const unsigned char'. - (edit_formals_lists): Likewise. - (find_rightmost_formals_list): Likewise. - (add_local_decl): Likewise. - (add_global_decls): Likewise. - (edit_fn_definition): Likewise. - (do_cleaning): Likewise. - (scan_for_missed_items): Likewise. - (edit_file): Cast variable `orig_size' to (int) when comparing - against one. - (main): Cast argument of ctype macro to `const unsigned char'. - - * recog.c (const_int_operand): Mark parameter `mode' with - ATTRIBUTE_UNUSED. - - * regclass.c (record_reg_classes): Change type of variable `c' to - `unsigned char'. Cast `char' array index to `unsigned char'. - - * reload.c (push_secondary_reload): Cast argument to - REG_CLASS_FROM_LETTER() macro to `unsigned char'. - - * reload1.c (calculate_needs): Cast `char' array index to - `unsigned char'. - (set_label_offsets): Change type of variable `i' to unsigned int. - Cast result of XVECLEN() macro to unsigned when comparing against - one. - (mark_not_eliminable): Change type of variable `i' to unsigned. - (order_regs_for_reload): Likewise. Cast `max_regno' to unsigned - when comparing against one. - (reload_as_needed): Cast macro NUM_ELIMINABLE_REGS to (int) when - comparing against one. - (choose_reload_regs): Hide unused label `fail'. - (reload_cse_simplify_operands): Cast `char' array index to - `unsigned char'. - (reload_combine_note_store): Mark parameter `set' with - ATTRIBUTE_UNUSED. Cast UNITS_PER_WORD to unsigned when comparing - against one. - (reload_cse_move2add): Remove unused variable `src2'. - - * sched.c: Include recog.h. - (sched_note_set): Remove unused parameter `b'. All callers - changed. - (split_hard_reg_notes): Likewise for parameter `orig_insn'. - (blockage_range): Cast result of UNIT_BLOCKED() macro to (int) - when comparing against one. - - * stupid.c (stupid_find_reg): Mark parameter `changes_size' with - ATTRIBUTE_UNUSED. Cast `sizeof' expression to (int) when - comparing against one. - - * unroll.c (precondition_loop_p): Remove unused parameter - `loop_end'. All callers changed. - -Tue Oct 13 22:12:11 1998 Bernd Schmidt - - * reload1.c (maybe_fix_stack_asms): New static function. - (reload): Call it. - - * reload.h (compute_use_by_pseudos): Declare. - - * reload1.c (spilled_pseudos, insns_need_reload): New variables. - (something_needs_reloads): Delete variable. - (finish_spills): New function. - (compute_use_by_pseudos): New function. - - (delete_caller_save_insns): Lose argument FIRST. All callers changed. - Use the reload_insn_chain instead of walking the rtl directly. - - (reload): Allocate and free spilled_pseudos. - Ensure that all calls of spill_hard_reg are followed by a call to - finish_spills. - Use the insns_need_reload list instead of something_needs_reloads - to find out if reload_as_needed must be called. - Clear unused_insn_chains at the end. - - (calculate_needs_all_insns): Lose FIRST parameter. All callers - changed. - Delete code to keep track of current basic block. - Walk reload_insn_chain instead of the rtl structure. Build the - insns_need_reload chain. - Remember which insns need reloading/elimination by setting the - appropriate fields in struct insn_chain, not by putting modes on the - insn. - - (calculate_needs): Lose THIS_BLOCK arg. Accept arg CHAIN instead of - arg INSN. All callers changed. - Delete declaration of struct needs. - Don't set something_needs_reloads. - Record insn needs in the CHAIN argument. - - (spill_hard_reg): Record the affected pseudos in spilled_pseudos. - - (reload_as_needed): Lose FIRST arg. All callers changed. - Walk the reload_insn_chain instead of the rtx structure. - Delete code to keep track of current basic block. - Rename one of the NEXT variables to OLD_NEXT. - - (allocate_reload_reg): Accept arg CHAIN instead of arg INSN. All - callers changed. - (choose_reload_regs): Likewise. - - (emit_reload_insns): Replace INSN and BB args with arg CHAIN. All - callers changed. - - * caller-save.c (MOVE_MAX_WORDS): New macro. Use it throughout - instead of (MOVE_MAX / UNITS_PER_WORD) computation. - (hard_regs_live, hard_regs_need_restore): Delete variables. - (n_regs_saved): Now static. - (referenced_regs, this_insn_sets): New variables. - - (setup_save_areas): Restructure the code a bit. - - (restore_referenced_regs): Delete function. - (mark_referenced_regs): New function, similar to the old - restore_referenced_regs, but mark registers in referenced_regs. - - (clear_reg_live): Delete function. - (mark_set_regs): Renamed from set_reg_live. All callers changed. - Only mark registers in this_insn_sets. - - (save_call_clobbered_regs): Rework this function to walk the - reload_insn_chain instead of using the list of instructions directly. - Delete code to keep track of register lives, compute live regs on the - fly from information in the chain. - Instead of calling restore_referenced_regs, use mark_referenced_regs, - then walk the set it computes and call insert_restore as appropriate. - - (insert_restore): Lose INSN and BLOCK args. Add CHAIN arg. All - callers changed. - Restructure the code a bit. Test hard_regs_saved instead of - hard_regs_need_restore. - (insert_save): Lose INSN and BLOCK args. Add CHAIN and TO_SAVE - args. All callers changed. - Restructure the code a bit. Use TO_SAVE to determine which regs to - save instead of more complicated test. - (insert_one_arg): Lose INSN and BLOCK args. Add CHAIN arg. All - callers changed. - Create a new insn_chain structure for the new insn and place it - into the chain. - - * rtl.texi: Update documentation to reflect that reload no longer - puts modes on the insns. - -1998-10-14 Andreas Schwab - - * function.c (purge_addressof_1): Force the first argument of a - CALL insn to memory. - -Wed Oct 14 00:38:40 1998 Jeffrey A Law (law@cygnus.com) - - * rtl.h: Delete duplicate prototypes. Add some missing - prototypes. - * rtlanal.c (for_each_rtx): Formatting tweak. - -1998-10-13 Herman A.J. ten Brugge - - * real.c (emdnorm and etoasc): Disable round to even for c4x target - to be compatible with TI compiler. - - * Makefile.in (USER_H): Add va-c4x.h to definition. - -Tue Oct 13 23:03:37 1998 Richard Henderson - - * function.c (purge_addressof_1): Fix typo in inequality: do - bitfield optimization for equal mode sizes. - * expmed.c (store_bit_field): Don't take subregs of subregs in - the movstrict case. Tidy a potential problem in the multi-word case. - (extract_bit_field): Likewise. - -Tue Oct 13 22:12:11 1998 Bernd Schmidt - - * flow.c (find_basic_blocks): Emit NOPs after normal calls in this - function. - Compute max_uid_for_flow by calling get_max_uid after the scan. - (find_basic_blocks_1): Don't emit NOPs here. - -Tue Oct 13 22:05:49 1998 Richard Henderson - - * alias.c (base_alias_check): Accept new args for the modes of the - two references. Use them to determine if an AND can overlap. Update - all callers. - (memrefs_conflict_p): Assume sizes are aligned, and uses them - to determine if an AND can overlap. - -Tue Oct 13 17:51:04 1998 Jim Wilson - - * config/m68k/m68k.h (HARD_REGNO_MODE_OK): For FP regs, add REGNO >= 16 - check. Add comment to document problems with TARGET_SUN_FPA version - of this macro. - * config/m68k/m68k.md (movxf+1): Support 'r'/'r' moves. - -Tue Oct 13 17:46:18 1998 Kaveh R. Ghazi - - * Makefile.in (gencheck.o): Depend on gansidecl.h. - - * c-common.c (print_char_table): Add missing initializers. - (scan_char_table): Likewise. - (time_char_table): Likewise. - - * c-decl.c (c_decode_option): Mark parameter `argc' with - ATTRIBUTE_UNUSED. - (declare_parm_level): Mark parameter `definition_flag' with - ATTRIBUTE_UNUSED. - - * c-lex.c (readescape): Use `(unsigned)1' in shift. - (yylex): Likewise. Cast `sizeof' to an (int) when comparing - against one. - - * calls.c (store_one_arg): Remove unused parameter `fndecl'. All - callers changed. - (emit_call_1): Mark parameters `fndecl' and `funtype' with - ATTRIBUTE_UNUSED. - (expand_call): Cast result of MIN() to (unsigned int) when - comparing against an unsigned value. - - * cccp.c (pcfinclude): Remove unused parameter `limit'. All - callers changed. - (make_definition): Remove unused parameter `op'. All callers - changed. - (create_definition): Cast REST_EXTENSION_LENGTH to (long) when - comparing against the result of pointer arithmetic. - - * config/mips/mips.h (FUNCTION_ARG_BOUNDARY): Cast to (unsigned) - when comparing against one. - - * dwarf2out.c (dwarf2out_frame_debug): Cast REGNO() and - HARD_FRAME_POINTER_REGNUM to (unsigned) when comparing against - one. - (output_die): Move variable `i' into the scope in which it is - used. Change its type to `unsigned'. - (output_die): Cast the result of `strlen' to (int) when passing it - to ASM_OUTPUT_ASCII(). - (output_pubnames): Likewise. - (output_line_info): Likewise. - - * emit-rtl.c (global_rtl): Add missing initializers. - - * explow.c (promote_mode): Mark parameter `for_call' with - ATTRIBUTE_UNUSED. - - * expmed.c (expand_shift): Cast the result of GET_MODE_BITSIZE to - `unsigned HOST_WIDE_INT' when comparing against one. - (synth_mult): Change type of variable `cost' to int. - (emit_store_flag): Use `(unsigned HOST_WIDE_INT) 1' in shift. - - * expr.c (copy_blkmode_from_reg): Cast BITS_PER_WORD to (unsigned) - when comparing against one. - (get_inner_reference): Change variable `alignment' to unsigned. - (expand_expr): Cast the result of GET_MODE_ALIGNMENT to (unsigned - int) when comparing against one. - (expand_builtin_setjmp): Change type of variable `i' to size_t. - - * fold-const.c (div_and_round_double): Cast BASE to - (HOST_WIDE_INT) when comparing against one. - - * gencheck.c: Include gansidecl.h. - (main): Mark parameter `argv' with ATTRIBUTE_UNUSED. - - * optabs.c (gen_cond_trap): Mark parameters `code', `op2' and - `tcode' with ATTRIBUTE_UNUSED. - - * real.c (edivm): Cast constant value to (unsigned long) in - expression compared against an unsigned value. - - * stmt.c (expand_return): Cast BITS_PER_WORD to (unsigned) when - comparing against one. - (expand_end_case): Cast CASE_VALUES_THRESHOLD to (unsigned int) - when comparing against one. - - * stor-layout.c (mode_for_size): Cast MAX_FIXED_MODE_SIZE to - (unsigned int) when comparing against one. Likewise for - GET_MODE_BITSIZE. - (smallest_mode_for_size): Likewise. - (save_storage_status): Mark parameter `p' with ATTRIBUTE_UNUSED. - (restore_storage_status): Likewise. - - * toplev.c (debug_args): Add missing initializer. - (f_options): Spelling correction. Add missing initializers. - (documented_lang_options): Likewise. - (debug_end_source_file): Mark parameter `lineno' with - ATTRIBUTE_UNUSED. - - * tree.c (valid_machine_attribute): Mark parameters `attr_args', - `decl' and `type' with ATTRIBUTE_UNUSED. - - * varasm.c (decode_reg_name): Cast `sizeof' expression to (int) - when comparing against one. - (assemble_variable): Mark parameter `top_level' with - ATTRIBUTE_UNUSED. - (assemble_external_libcall): Mark parameter `fun' with - ATTRIBUTE_UNUSED. - (output_constant_pool): Mark parameters `fnname' and `fndecl' with - ATTRIBUTE_UNUSED. - -Tue Oct 13 12:51:04 1998 Nick Clifton - - * config/v850/lib1funcs.asm (_udivsi3): Add .type declaration. - Replace use of r5 with use of r19. - - * config/v850/v850.h (LINK_POINTER_REGNUM): Define. - - * config/v850/v850.c (compute_register_save_size): Allow for the - fact that helper functions save all registers, not just those used - by the function. - - Replace constant 31 with macro LINK_POINTER_REGNUM. - - * config/v850/v850.md: Use 'indirect_operand' rather than - 'memory_operand' for bit test/set/clear patterns. - -Tue Oct 13 11:49:14 1998 Jason Merrill - - * mips/iris6.h (ASM_OUTPUT_WEAK_ALIAS): Call ASM_GLOBALIZE_LABEL. - * varasm.c (assemble_start_function et al): Don't call - ASM_GLOBALIZE_LABEL for weak symbols. - -Tue Oct 13 11:37:45 1998 Nick Clifton - - * cse.c (equiv_constant): Check for NULL return from - gen_lowpart_if_possible(). - -Tue Oct 13 11:24:51 1998 Jeffrey A Law (law@cygnus.com) - - * mn10200.md (addsi3, subsi3, negsi2): Only allow register operands. - - * collect2.c (main): Pass -EL/-EB through to the compiler. - -1998-10-12 Herman A.J. ten Brugge - - * expr.c (push_block): Handle targets where the stack grows - to higher addresses, but args grow to lower addresses and - ACCUMULATE_OUTGOING_ARGS is not defined. - -Tue Oct 13 08:00:52 1998 Catherine Moore - - * config/v850/v850.c (print_operand): Extend meaning - of 'c' operands to support .vtinherit. - -Tue Oct 13 21:38:35 1998 Michael Hayes - - * config/c4x/c4x.c: Convert to gen_rtx_FOO. - Added ATTRIBUTE_UNUSED to unused function arguments. - (rc_reg_operand): New predicate. - (c4x_rptb_insert): New function. - (c4x_rptb_nop_p): Recognize modified rptb_top pattern. - (c4x_optimization_options): New function. - - * config/c4x/c4x.md: Convert to gen_rtx_FOO. - (decrement_and_branch_on_count): New pattern. - (rptb_top): Modified pattern to work with BCT optimization. - - * config/c4x/c4x.h (RC_REG): New register class. - (rc_reg_operand): Define prototype. - (IS_RC_REG): New macro. - (IS_RC_OR_PSEUDO_REG): New macro. - (IS_RC_OR_PSEUDO_REGNO): New macro. - (OPTIMIZATION_OPTIONS): Define. - -Mon Oct 12 19:57:34 1998 Jason Merrill - - * collect2.c (extract_init_priority): No priority is 65535. - -Mon Oct 12 12:10:37 1998 Alexandre Oliva - - * Makefile.in (build_tooldir): New variable, same as old - $(tooldir), but without depending on $(libdir)/$(unlibsubdir). - (GCC_FOR_TARGET): Add -B$(build_tooldir)/bin/. - (bootstrap, bootstrap2, bootstrap3, bootstrap4): Likewise. - - * configure.in (gxx_include_dir): Set default based on unlibsubdir. - * Makefile.in (tooldir): Likewise. - (cccp.o, cpplib.o): Use unlibsubdir implicitly through - gxx_include_dir, includedir and tooldir. - (protoize.o, unprotoize.o): Likewise. - -Mon Oct 12 10:50:44 1998 Nick Clifton - - * config/arm/arm.md: Replace (reg 24) with (reg:CC 24). - - * config/arm/thumb.c (thumb_override_options): Add warning about - PIC code not being supported just yet. - -Sun Oct 11 16:49:15 1998 John Wehle (john@feith.com) - - * flow.c: Update comment. - (notice_stack_pointer_modification): New static function. - (record_volatile_insns): Use it. - (mark_regs_live_at_end): Mark the stack pointer as alive - at the end of the function if current_function_sp_is_unchanging - is set. - (life_analysis_1): Set current_function_sp_is_unchanging. - * function.c: Define it. - (init_function_start): Initialize it. - * output.h: Declare it. - * reorg.c (fill_simple_delay_slots, dbr_schedule): Mark - the stack pointer as alive at the end of the function if - current_function_sp_is_unchanging is set. - * i386.c (ix86_epilogue): Optimize the restoring - of the stack pointer. - -Mon Oct 12 01:22:53 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Oct 11 23:04:30 1998 Robert Lipe - - * c-pragma.c (handle_pragma_token): If passed a token instead - of a tree, use that as the pack value. - -Sun Oct 11 14:21:14 1998 Mark Mitchell - - * flow.c (find_basic_blocks_1): Fix prototype. - -Sun Oct 11 05:03:41 1998 Ken Raeburn - - * tree.h (DECL_NO_CHECK_MEMORY_USAGE): New macros. - (struct tree_decl): New fields no_check_memory_usage. - * c-common.c (enum attrs): Add A_NO_CHECK_MEMORY_USAGE. - (init_attributes): Register it as a new attribute. - (decl_attributes): Set flags on functions given that attribute. - * c-decl.c (duplicate_decls): Merge new attribute. - * expr.h (current_function_check_memory_usage): Declare new var. - * calls.c, expr.c, function.c, stmt.c, alpha.c, clipper.c, m88k.c, - pa.c, sparc.c: Replace uses of flag_check_memory_usage with - current_function_check_memory_usage. - * function.h: Add field to struct function. - * function.c (current_function_check_memory_usage): Define it. - (push_function_context_to, pop_function_context_from): Save and - restore it. - (expand_function_start): Set it, based on global flag and function - attribute. - - * expr.c (expand_expr, case VAR_DECL): In memory-checking code, do - check non-automatic variables, to permit detection of writes to - read-only locations in embedded systems without memory management. - * calls.c (store_one_arg): Use ARGS_SIZE_RTX to get size of argument - when emitting chkr_set_right_libfunc call, even if the argument is - BLKmode or variable-sized; don't abort. - - * optabs.c (init_optabs): Create Checker and __cyg_profile_* - symbols in Pmode, not VOIDmode. - -Sun Oct 11 01:03:05 1998 Zack Weinberg - - * cppexp.c: When forcing unsigned comparisons, cast both sides - of the operation. - - * cpphash.h: Move static declaration of hashtab[]... - * cpphash.c: ...here. - - * cpplib.c: Cast difference of two pointers to size_t before - comparing it to size_t. Cast signed to unsigned - before comparing to size_t. (FIXME: struct argdata should use - unsigned buffer sizes.) - * cpplib.h (struct cpp_reader): Declare token_buffer_size as - unsigned int. (CPP_WRITTEN): Cast return value to size_t. - (CPP_RESERVE): Parenthesize N for evaluation order, cast to - size_t before comparison. - -Sun Oct 11 00:15:29 1998 Jeffrey A Law (law@cygnus.com) - - * flow.c (find_basic_blocks): Delete "live_reachable_p" argument. - (find_basic_blocks_1): Similarly. - * output.h (find_basic_blocks): Fix prototype. - * gcse.c, toplev.c: Don't pass "live_reachable_p" argument to - find_basic_blocks anymore. - -Sat Oct 10 22:00:34 1998 Richard Henderson - - * basic-block.h (EXECUTE_IF_SET_IN_SBITMAP): New macro. - (sbitmap_free, sbitmap_vector_free): New macros. - * output.h (rtl_dump_file): Declare. - -Sat Oct 10 17:01:42 1998 Jeffrey A Law (law@cygnus.com) - - * regmove.c (optimize_reg_copy_3): Honor TRULY_NOOP_TRUNCATION. - -Fri Oct 9 22:08:05 1998 Kaveh R. Ghazi - - * fp-bit.c (SFtype): Don't implicitly use int in declaration. - (DFtype): Likewise. - (_fpdiv_parts): Remove unused parameter `tmp', all callers changed. - (divide): Remove unused variable `tmp'. - (si_to_float): Cast numeric constant to (SItype) before comparing - it against one. - -Fri Oct 9 16:03:19 1998 Graham - - * flow.c (print_rtl_with_bb): Changed type of in_bb_p to match use. - * gcc.c (add_preprocessor_option): Correct typo when allocating - memory, sizeof() argument had one too many `*'. - (add_assembler_option): Likewise. - (add_linker_option): Likewise. - * gcov.c (output_data): Likewise. - * local-alloc.c (memref_used_between_p): Likewise. - (update_equiv_regs): Likewise. - * loop.c (strength_reduce): Likewise. - * reg-stack.c (record_asm_reg_life): Likewise. - (subst_asm_stack_reg): Likewise. - * reorg.c (dbr_schedule): Likewise. - -Fri Oct 9 15:57:51 1998 Bernd Schmidt - - * flow.c (life_analysis_1): Break out some functions. - (find_basic_blocks_1): Likewise. Also move some variables out and - make them static. - Rename NONLOCAL_LABEL_LIST arg to NONLOCAL_LABELS and initialize - new static var nonlocal_label_list with it. - (active_eh_region, nested_eh_region, label_value_list, - nonlocal_label_list): New static variables. - (make_edges, delete_unreachable_blocks, delete_block): New static - functions, broken out of find_basic_blocks_1. - (record_volatile_insns, mark_regs_live_at_end, set_noop_p, - noop_move_p): New static functions, broken out of life_analysis_1. - -Fri Oct 9 15:49:29 1998 Richard Henderson - - * expmed.c (store_bit_field): Pun non-integral str_rtx modes. - Take extra care for op0 now possibly being a subreg. - (extract_bit_field): Likewise. - * function.c (purge_addressof_1): Revert Oct 4 change. Drop - the reg to memory if there is no equal sized integral mode. - * stor-layout.c (int_mode_for_mode): New function. - * machmode.h: Prototype it. - -Fri Oct 9 14:26:44 1998 Jeffrey A Law (law@cygnus.com) - - * global.c (build_insn_chain): Verify no real insns exist past the - end of the last basic block, then exit the loop. - -Fri Oct 9 11:44:47 1998 David Edelsohn - - * loop.c (insert_bct): Ensure loop_iteration_var non-zero before use. - -Thu Oct 8 21:59:47 1998 Dave Brolley - - * emit-rtl.c (init_emit_once): Call INIT_EXPANDERS. - -Thu Oct 8 22:03:45 1998 David Edelsohn - - * rs6000.h (RTX_COSTS): Add PROCESSOR_PPC604e cases. - -Thu Oct 8 17:00:18 1998 Richard Henderson - - * flow.c (find_basic_blocks): Correctly determine when a call - is within an exception region. - -Thu Oct 8 17:15:04 1998 Jeffrey A Law (law@cygnus.com) - - * toplev.c (output_file_directive): Use DIR_SEPARATOR, not '/'. - - * cpplib.h: Protect from multiple inclusions. - * cpplib.c: Fix minor formatting problems. - - * i386/xm-cygwin32.h: Only define POSIX if it is not already defined. - - * jump.c (jump_optimize): Revert accidental patch. - - * Makefile.in (cpplib.o): Use unlibsubdir. - -Thu Oct 8 12:50:47 1998 Jim Wilson - - * loop.c (get_condition): Allow combine when either compare is - VOIDmode. - -Thu Oct 8 11:31:01 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Thu Oct 8 12:21:14 1998 Richard Frith-Macdonald - - * c-lex.c (remember_protocol_qualifiers): Handle RID_BYREF. - (init_lex): Initialize ridpointers[RID_BYREF]. - * c-lex.h (enum rid): Add RID_BYREF. - * c-parse.gperf: Add RID_BYREF as a type qualifier. - * objc/objc-act.c (is_objc_type_qualifiers): Handle RID_BYREF. - (encode_type_qualifiers): Similarly. - * c-gperf.h: Rebuilt. - -Thu Oct 8 05:56:00 1998 Jeffrey A Law (law@cygnus.com) - - * c-common.c (type_for_mode): Only return TItype nodes when - HOST_BITS_PER_WIDE_INT is >= 64 bits. - * c-decl.c (intTI_type_node, unsigned_intTI_type_node): Only declare - when HOST_BITS_PER_WIDE_INT is >= 64 bits. - (init_decl_processing): Only create TItype nodes when - HOST_BITS_PER_WIDE_INT is >= 64 bits. - * c-tree.h (intTI_type_node, unsigned_intTI_type_node): Only declare - when HOST_BITS_PER_WIDE_INT is >= 64 bits. - -Thu Oct 8 05:05:34 1998 Bernd Schmidt - - * stmt.c (n_occurrences): New static function. - (expand_asm_operands): Verify that all constrains match in the - number of alternatives. - Verify that '+' or '=' are at the beginning of an output constraint. - Don't allow '&' for input operands. - Verify that '%' isn't written for the last operand. - * reload.c (find_reloads): Abort if an asm is found with invalid - constraints; all possible problems ought to be checked for earlier. - -Thu Oct 8 04:26:20 1998 Michael Hayes - - * flags.h (flag_branch_on_count_reg): Always declare. - * toplev.c (flag_branch_on_count_reg): Likewise. - * toplev.c: Fix typos. - - * real.c (c4xtoe): Remove unused variables. Add some missing parens. - (toc4x): Similarly. - -Thu Oct 8 01:25:22 1998 Richard Henderson - - * flow.c (find_basic_blocks): Calc upper bound for extra nops in - max_uids_for_flow. - (find_basic_blocks_1): Add a nop to the end of a basic block when - a trailing call insn does not have abnormal control flow. - * gcse.c (pre_transpout): New variable. - (alloc_pre_mem, free_pre_mem, dump_pre_data): Bookkeeping for it. - (compute_pre_transpout): Calculate it. - (compute_pre_ppinout): Use it to eliminate impossible placements - due to abnormal control flow through calls. - (compute_pre_data): Call compute_pre_transpout. - -Wed Oct 7 21:40:24 1998 David S. Miller - - * config/sparc/sol2-sld-64.h (ASM_CPU_SPEC): Fix typo. - -Wed Oct 7 21:19:46 1998 Ken Raeburn - - * config/mips/mips.md (tablejump_internal3, tablejump_internal4 - and matching define_insns): Tack on a `use' of the table label, so - flow analysis will recognize a tablejump. - -Wed Oct 7 17:33:39 1998 Richard Henderson - - * gcse.c (pre_insert_insn): Tweek to notice that calls do not - always end basic blocks for abnormal edge reasons. - -Wed Oct 7 14:40:43 1998 Nick Clifton - - * config/i386/i386.h: Remove definition of - HANDLE_PRAGMA_PACK_PUSH_POP. - - * config/i386/go32.h: Add definition of - HANDLE_PRAGMA_PACK_PUSH_POP. - - * config/i386/win32.h: Add definition of - HANDLE_PRAGMA_PACK_PUSH_POP. - - * config/i386/cygwin32.h: Add definition of - HANDLE_PRAGMA_PACK_PUSH_POP. - - * c-pragma.c (insert_pack_attributes): Do not insert - attributes unless #pragma pack(push,) is in effect. - -Wed Oct 7 12:10:46 1998 Jim Wilson - - * expr.c (emit_group_store): Handle a PARALLEL destination. - -Wed Oct 7 10:07:29 1998 Richard Henderson - - * gcse.c (pre_insert_insn): When a call ends a bb, insert - the new insns before the argument regs are loaded. - -Wed Oct 7 12:55:26 1998 Kaveh R. Ghazi - - * Makefile.in (c-gperf.h): Add -L KR-C -F ', 0, 0' flags to gperf. - (c-parse.gperf): Update comments describing invocation flags. - (c-gperf.h): Regenerate using gperf 2.7.1 (19981006 egcs). - -1998-10-07 Manfred Hollstein - - * reload1.c (reload): Call free before clobbering the memory - locations or constants pointers. - -Wed Oct 7 02:05:20 1998 David S. Miller - - * config/sparc/sol2-sld-64.h (TRANSFER_FROM_TRAMPOLINE): Rework - for efficiency by checking whether we need to modify the current - stack permission at all. - (ASM_OUTPUT_CONSTRUCTOR, ASM_OUTPUT_DESTRUCTOR): Define. - * config/sparc/sparc.c (sparc_initialize_trampoline): Emit - __enable_execute_stack libcall here too if - TRANSFER_FROM_TRAMPOLINE is defined. - * config/sparc/sparc.h: Set TARGET_ARCH32 to a constant if - IN_LIBGCC2. - -Wed Oct 7 02:27:52 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (DRIVER_DEFINES): Remove last change. - -Wed Oct 7 01:08:43 1998 Bernd Schmidt - - * jump.c (duplicate_loop_exit_test): Strip REG_WAS_0 notes off all - insns we're going to copy. - * regclass.c (reg_scan_mark_refs): Don't test X for NULL_RTX. - - * loop.c (count_one_set): Add prototype. - - * caller-save.c (restore_referenced_regs): Lose mode argument. - (insert_save): Lose mode argument. - (insert_restore): Lose mode argument. - (insert_one_insn): Lose mode argument. - (save_call_clobbered_regs): Lose mode argument. - (setup_save_areas): Take no argument and return void. All callers - changed. - Don't verify validity of memory addresses. - * reload.h (setup_save_ares): Adjust prototype. - (save_call_clobbered_regs): Likewise. - * reload1.c (delete_caller_save_insns): New function. - (caller_save_spill_class): Delete variable. - (caller_save_group_size): Delete variable. - (reload): Call setup_save_areas and save_call_clobbered_regs - in the main loop, before calling calculate_needs_all_insns. - Don't call save_call_clobbered_regs after the loop. - Call delete_caller_save_insns at the end of an iteration if - something changed. - Delete code to manage caller_save_spill_class. - Emit the final note before setting reload_first_uid. - Simplify test that determines whether reload_as_needed gets run. - (calculate_needs): Delete code to manage caller_save_spill_class. - -Tue Oct 6 15:42:27 1998 Richard Henderson - - * collect2.c (main): Initialize ld_file_name. - -Tue Oct 6 15:45:15 1998 Catherine Moore - - * config/sparc/sysv4.h (ASM_OUTPUT_SECTION_NAME): Don't - check for flag_function_sections. - -Tue Oct 6 20:02:31 1998 J"orn Rennecke - - * cse.c (insert_regs): Fix bug in Sep 24 change. - -Tue Oct 6 17:00:42 1998 J"orn Rennecke - - * flags.h (flag_dump_unnumbered): Declare. - * toplev.c (flag_dump_unnumbered): Don't declare. - * print-rtl.c (flags.h): Include. - (print_rtl_single): Add return value. - * rtl.h (print_rtl_single): Update declaration. - * flow.c (flag_dump_unnumbered): Don't declare. - (print_rtl_with_bb): Use return value of print_rtl_single. - -Tue Oct 6 01:36:00 1998 Bernd Schmidt - - * loop.c (count_one_set): New static function, broken out of - count_loop_regs_set. - (count_loop_regs_set): Call it. - * global.c (mark_reg_store): Handle clobbers here by not calling - set_preference. - (mark_reg_clobber): Just call mark_reg_store after ensuring SETTER - is in fact a clobber. - * integrate.c (process_reg_param): New function, broken out of - expand_inline_function. - (expand_inline_function): Call it. - - * i386.md (addsidi3_1): Delete unused variable temp. - (addsidi3_2): Likewise. - (clstrstrsi): Delete unused variable addr1. - - * rtl.h: Don't declare any functions also declared in recog.h. - - * Makefile.in (stupid.o): Update dependencies. - (global.o): Likewise. - - * global.c: Include reload.h. - (reg_becomes_live): New function. - (reg_dies): New function. - (build_insn_chain): New function. - (global_alloc): Call build_insn_chain before calling reload. - - * reload.h (struct needs): New structure definition. - (struct insn_chain): Likewise. - (reload_insn_chain): Declare variable. - (new_insn_chain): Declare function. - - * reload1.c (reload_startobj): New variable. - (reload_insn_chain): New variable. - (unused_insn_chains): New variable. - (new_insn_chain): New function. - (init_reload): Initialize reload_startobj, not reload_firstobj. - (reload): Initialize reload_firstobj. - Before returning, free everything on the reload_obstack. - - * stupid.c: Include insn-config.h, reload.h and basic-block.h. - (reg_where_dead_chain, reg_where_born_exact, reg_where_born_clobber, - current_chain): New variables. - (reg_where_born): Delete variable. - (REG_WHERE_BORN): New macro. - (find_clobbered_regs): New function. - (stupid_life_analysis): Don't allocate/free reg_where_born. - Allocate and free reg_where_born_exact, reg_where_born_clobber, - reg_where_dead_chain. - Use REG_WHERE_BORN instead of reg_where_born. - While processing the insns, build the reload_insn_chain with - information about register lifetimes. - (stupid_reg_compare): Use REG_WHERE_BORN instead of reg_where_born. - (stupid_mark_refs): Replace arg INSN with arg CHAIN. All callers - changed. - Compute and information about birth and death of pseudo registers in - reg_where_dead_chain, reg_where_born_exact and reg_where_born_clobber. - Delete code to set elements of reg_where_born. - -Mon Oct 5 22:34:30 1998 Alexandre Petit-Bianco - - * tree.def (GOTO_EXPR): Modified documentation. - * expr.c (expand_expr): Expand GOTO_EXPR into a goto or a computed - goto. - -Mon Oct 5 22:43:36 1998 David Edelsohn - - * unroll.c (loop_iteration_var, loop_initial_value, loop_increment - loop_final_value, loop_comparison_code): No longer static. - (unroll_loop): Delete loop_start_value update. - * loop.h (loop_iteration_var, loop_initial_value, loop_increment, - loop_final_value, loop_comparison_code): Extern. - (loop_start_value): Delete extern. - * loop.c (loop_can_insert_bct, loop_increment, loop_start_value, - loop_comparison_value, loop_comparison_code): Delete. - (loop_optimize): Remove initialization for deleted variables. - (strength_reduce): Delete analyze_loop_iterations call. Only call - insert_bct if flag_branch_count_on_reg set. - (analyze_loop_iterations): Delete. - (insert_bct): Remove iteration count calculation. Move checks for - viable BCT optimization to here. Obtain iteration count from - loop_iterations and correct for unrolling. Check for enough - iteration to be beneficial. Comment out runtime iteration count - case. - (insert_bct): Print iteration count in dump file. Remove - loop_var_mode and use word_mode directly. - - * rs6000.h (processor_type): Add PROCESSOR_PPC604e. - * rs6000.c (rs6000_override_options): Use it. - (optimization_options): Enable use of flag_branch_on_count_reg. - * rs6000.md (define_function_unit): Describe 604e. - -1998-10-05 Herman A.J. ten Brugge - - * loop.c (move_movables): Corrected threshold calculation for - moved_once registers. - -Mon Oct 5 21:18:45 1998 Bernd Schmidt - - * loop.c (combine_givs_p): Fix test for identical givs. - -Mon Oct 5 10:11:28 1998 Nick Clifton - - * dwarf2out.c (gen_subprogram_die): If errorcount nonzero, don't - call abort if the function is already defined. - -Mon Oct 5 10:02:36 1998 Jeffrey A Law (law@cygnus.com) - - * combine.c (simplify_rtx): Do not replace TRUNCATE with a SUBREG if - truncation is not a no-op. - -Mon Oct 5 09:02:04 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Oct 5 08:19:55 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Oct 5 01:07:23 1998 Torbjorn Granlund - - * expmed.c (expand_divmod): Don't widen for computing remainder - if we seem to have a divmod pattern for needed mode. - -Mon Oct 5 01:01:42 1998 Zack Weinberg - - * cpplib.c (macroexpand): Correct off-by-one error in handling - of escapes. - -Sun Oct 4 23:58:30 1998 Richard Henderson - - * combine.c (expand_field_assignment): Don't do bitwise operations - on MODE_FLOAT; pun to MODE_INT if possible. - -Sun Oct 4 18:33:24 1998 Jason Merrill - scott snyder - - * tlink.c (scan_linker_output): Recognize errors from irix 6.2 - linker. Recognize mangled names in quotes. - -Sun Oct 4 02:58:20 1998 Jakub Jelinek - - * config/sparc/sparc.md (ashldi3+1): Name it ashldi3_sp64. - (ashlsi3_const1, ashldi3_const1): New combiner patterns. - (ashrsi3_extend, ashrsi3_extend2): New combiner patterns. - (lshrsi3_extend, lshrsi3_extend2): Likewise. - -Sun Oct 4 00:23:00 1998 David S. Miller - - * function.c (purge_addressof_1): If trying to take a sub-word - integral piece of a floating point mode, put it on the stack. - -Sat Oct 3 19:01:03 1998 Richard Henderson - - * alpha/linux.h (CPP_PREDEFINES): Define __alpha__ for imake. - -Sat Oct 3 14:42:19 1998 Jason Merrill - - * PROJECTS: Remove template friends. - - * collect2.c (sort_ids): Remove unused variable. - - * tm.texi (MATH_LIBRARY): Document. - (NEED_MATH_LIBRARY): Remove. - - * varasm.c (assemble_start_function, assemble_variable, weak_finish, - assemble_alias): Do ASM_GLOBALIZE_LABEL for weak symbols, too. - -Sat Oct 3 16:14:44 1998 John Carr - - * dwarf2out.c (expand_builtin_dwarf_reg_size): Initialize - last_end to 0x7fffffff. - -Fri Oct 2 19:14:20 1998 David S. Miller - - * function.c (purge_addressof_1): Do not perform endianness - corrections on bitpos, who we call will do it for us. - -Fri Oct 2 11:52:35 1998 Jeffrey A Law (law@cygnus.com) - - * h8300.c (WORD_REG_USED): Fix typo. - (initial_offset): Use WORD_REG_USED. - - * h8300.c (handle_pragma): Fix typo. - -Fri Oct 2 10:51:35 1998 Bernd Schmidt - - * caller-save.c (insert_save_restore): Break this function up - into new functions insert_restore, insert_save and insert_one_insn. - All callers changed. - (insert_restore): New function, mostly broken out of - insert_save_restore. - (insert_save): Likewise. - (insert_one_insn): Likewise. - (restore_referenced_regs): New argument BLOCK. All callers changed. - (save_call_clobbered_regs): Don't keep track of basic block boundaries - in this function, do it in insert_one_insn instead. - - * reload1.c (reload): Break out some more pieces into separate - functions. - (dump_needs): New function, broken out of reload. - (set_initial_elim_offsets): Likewise. - (init_elim_table): Likewise. - (update_eliminables): Likewise. - - * global.c (global_alloc): Delete code to manage the scratch_list. - * local-alloc.c (qty_scratch_rtx): Delete. - (scratch_block): Delete. - (scratch_list): Delete. - (scratch_list_length): Delete. - (scratch_index): Delete. - (alloc_qty_for_scratch): Delete. - (local-alloc): Update initialization of max_qty. - Delete code to manage the scratch list. - Delete code to allocate/initialize qty_scratch_rtx. - (block_alloc): Don't allocate quantities for scratches. - Delete code to manage the scratch list. - * regs.h (scratch_list): Delete declaration. - (scratch_block): Delete declaration. - (scratch_list_length): Delete declaration. - * reload1.c (reload): Delete code to manage the scratch list. - (spill_hard_reg): Likewise. - (mark_scratch_live): Delete. - - * recog.c (alter_subreg): Delete declaration. - -1998-10-02 Andreas Jaeger - - * Makefile.in (cccp.o): Fix typo in last patch. - -Fri Oct 2 16:13:12 1998 J"orn Rennecke - - * t-sh (LIB1ASMFUNCS): Add _set_fpscr . - * config/sh/lib1funcs.asm (___set_fpscr): Add. - -Fri Oct 2 02:01:59 1998 Jeffrey A Law (law@cygnus.com) - - * regclass.c (reg_scan_mark_refs): Return immediately if passed a - NULL_RTX as an argument. - - * Makefile.in (unlibsubdir): Define. - (DRIVER_DEFINES): Use unlibsubdir. - (cccp.o, cpplib.o, protoize.o, unprotoize.o): Similarly. - (stmp-fixinc): Similarly. - -Thu Oct 1 19:58:30 1998 Bernd Schmidt - - * regmove.c (regmove_optimize): Add variable old_max_uid. - At the end of the function, update basic_block_end. - -Thu Oct 1 17:58:25 1998 David S. Miller - - * dwarf2out.c (expand_builtin_dwarf_reg_size): Use - FIRST_PSEUDO_REGISTER as upper bound for last_end, not an - arbitrary constant. - -Thu Oct 1 17:57:14 1998 Nick Clifton - - * config/arm/arm.c: Improve interworking support. - -Thu Oct 1 18:43:35 1998 J"orn Rennecke - - * reload1.c (choose_reload_regs): Fix test if reload_reg_rtx[r] was - copied from reload_out[r] . - -Thu Oct 1 19:20:09 1998 John Carr - - * dwarf2out.c (expand_builtin_dwarf_reg_size): Fix to work - with more than three size ranges. - - * flow.c (sbitmap_copy): Use bcopy to copy bitmap. - - * rtl.c (mode_name): Add a null string at the end of the array. - (mode_wider_mode): Change type to unsigned char. - (mode_mask_array): New variable. - (init_rtl): Update for mode_wider_mode type change. - - * rtl.h (mode_wider_mode): Change type to unsigned char. - (mode_mask_array): Declare. - (GET_MODE_MASK): Use mode_mask_array. - -Thu Oct 1 15:56:01 1998 Gavin Romig-Koch - - * calls.c (expand_call) : Encapsulate code into - copy_blkmode_from_reg. - * expr.c (copy_blkmode_from_reg): New function. - * expr.h (copy_blkmode_from_reg): New function. - * integrate.c (function_cannot_inline_p): We can inline - these now. - (expand_inline_function): Use copy_blkmode_from_reg - if needed. Avoid creating BLKmode REGs. - (copy_rtx_and_substitute): Don't try to SUBREG a BLKmode - object. - -Thu Oct 1 10:42:27 1998 Nick Clifton - - * config/v850/v850.c: Add function prototypes. - Add support for v850 special data areas. - - * config/v850/v850.h: Add support for v850 special data areas. - - * c-pragma.c: Add support for HANDLE_PRAGMA_PACK and - HANDLE_PRAGMA_PACK_PUSH_POP. - (push_alignment): New function: Cache an alignment requested - by a #pragma pack(push,). - (pop_alignment): New function: Pop an alignment from the - alignment stack. - (insert_pack_attributes): New function: Generate __packed__ - and __aligned__ attributes for new decls whilst a #pragma pack - is in effect. - (add_weak): New function: Cache a #pragma weak directive. - (handle_pragma_token): Document calling conventions. Add - support for #pragma pack(push,) and #pragma pack (pop). - - * c-pragma.h: If HANDLE_SYSV_PRAGMA or HANDLE_PRAGMA_PACK_PUSH_POP - are defined enable HANDLE_PRAGMA_PACK. - Move 'struct weak_syms' here (from varasm.c). - Add pragma states for push and pop pragmas. - - * c-common.c (decl_attributes): Call PRAGMA_INSERT_ATTRIBUTES - if it is defined. - - * c-lex.c: Replace occurances of HANDLE_SYSV_PRAGMA with - HANDLE_GENERIC_PRAGMAS. - - * varasm.c: Move definition of 'struct weak_syms' into - c-pragma.h. - (handle_pragma_weak): Deleted. - - * config/i386/i386.h: Define HANDLE_PRAGMA_PACK_PUSH_POP. - - * config/winnt/win-nt.h: Define HANDLE_PRAGMA_PACK_PUSH_POP. - - * c-decl.c (start_function): Add invocation of - SET_DEFAULT_DECL_ATTRIBUTES, if defined. - - * tm.texi: Remove description of non-existent macro - SET_DEFAULT_SECTION_NAME. - - (HANDLE_SYSV_PRAGMA): Document. - (HANDLE_PRAGMA_PACK_PUSH_POP): Document. - -Wed Sep 30 22:27:53 1998 Robert Lipe - - * config.sub: Recognize i[34567]86-pc-udk as new target. - * configure.in: Likewise. - * config/i386/t-udk: New file. - * config/i386/udk.h: New file. - -Wed Sep 30 19:33:07 1998 Jeffrey A Law (law@cygnus.com) - - * reorg.c (check_annul_list_true_false): Remove unused variables. - (steal_delay_list_from_target): Add missing "used_annul" variable. - (try_merge_delay_insns): Close out half formed comment. - -Wed Sep 30 19:13:20 1998 Zack Weinberg - - * cpplib.c (macroexpand): If arg->raw_before or - arg->raw_after, remove any no-reexpansion escape at the - beginning of the pasted token. Correct handling of whitespace - markers and no-reexpand markers at the end if arg->raw_after. - - * toplev.c (documented_lang_options): Recognize -include, - -imacros, -iwithprefix, -iwithprefixbefore. - * cpplib.c (cpp_start_read): Process -imacros and -include - switches at the same time and in command-line order, after - initializing the dependency-output code. Emit properly nested - #line directives for them. Emit a #line for the main file - before processing these switches, and don't do it again - afterward. - -Wed Sep 30 18:03:22 1998 Richard Henderson - - * function.c (purge_addressof_1): Use bitfield manipulation - routines to handle mem mode < reg mode. - -Wed Sep 30 18:43:32 1998 Herman ten Brugge - - * reorg.c (try_merge_delay_insns): Account for resources referenced - in each instruction in INSN's delay list before trying to eliminate - useless instructions. Similarly when looking at a trial insn's delay - slots. - - * reorg.c (check_annul_list_true_false): New function. - (steal_delay_list_from_{target,fallthrough}): Call it and also - refine tests for when we may annul if already filled a slot. - (fill_slots_from_thread): Likewise. - (delete_from_delay_slot): Return newly-created thread. - (try_merge_delay_isns): Use its new return value. - -Wed Sep 30 18:29:26 1998 Jeffrey A Law (law@cygnus.com) - - * loop.c (check_dbra_loop): Use a vanilla loop reversal if the biv is - used to compute a giv or as some other non-counting use. - -Wed Sep 30 18:19:27 1998 Michael Hayes - - * regs.h (HARD_REGNO_CALL_PART_CLOBBERED): New macro. - * local-alloc.c (find_free_reg): Use it. - * global.c (find_reg): Likewise. - * tm.texi: Document HARD_REGNO_CALL_PART_CLOBBERED. - - * regs.h (HARD_REGNO_CALLER_SAVE_MODE): New macro. - * caller-save.c (init_caller_save): Use it. - * tm.texi: Document HARD_REGNO_CALLER_SAVE_MODE. - -Wed Sep 30 12:57:30 1998 Zack Weinberg - - * configure.in: Add --enable-cpplib option which uses cpplib - for cpp, but doesn't link cpplib into cc1. Make help text - capitalization consistent. - * configure: Rebuilt. - -Wed Sep 30 10:09:39 1998 Mark Mitchell - - * function.c (gen_mem_addressof): If the address REG is - REG_USERVAR_P make the new REG be so also. - * loop.c (scan_loop): Apply DeMorgan's laws and add documentation - in an attempt to clarify slightly. - -Wed Sep 30 09:57:40 1998 Jeffrey A Law (law@cygnus.com) - - * expr.c (expand_expr): Handle COMPONENT_REF, BIT_FIELD_REF ARRAY_REF - and INDIRECT_REF in code to check MAX_INTEGER_COMPUTATION_MODE. - -Wed Sep 30 10:13:39 1998 Catherine Moore - - * toplev.c: Fix last patch. - -Tue Sep 29 20:03:18 1998 Jim Wilson - - * loop.c (get_condition): Fix typo in May 9 change. - -Tue Sep 29 11:11:38 1998 Andrew MacLeod - - * invoke.texi (-fexceptions): Merge 2 different descriptions. - -Mon Sep 28 22:08:52 1998 Kaveh R. Ghazi - - * toplev.c (documented_lang_options): Spelling corrections. - -Mon Sep 28 19:41:24 1998 Alexandre Oliva - - * configure.in: New flags --with-ld and --with-as, equivalent - to setting LD and AS environment variables. Test whether - specified arguments are GNU commands, and report them with - checking messages. Use the specified AS for configure - tests too. - * configure: Likewise. - * acconfig.h: Add DEFAULT_ASSEMBLER and DEFAULT_LINKER. - * config.in: Likewise. - * gcc.c (find_a_file): When looking for `as' and `ld', return - the DEFAULT program if it exists. - * collect2.c (main): Use DEFAULT_LINKER if it exists. - - * gcc.c (find_a_file): The test for existence of a full - pathname was reversed. - -Mon Sep 28 17:34:35 1998 Michael Meissner - - * rs6000.h (ASM_OUTPUT_MI_THUNK): Only define on ELF systems. - * rs6000.c (output_mi_thunk): Always use a raw jump for now. - -Mon Sep 28 14:24:03 1998 Mark Mitchell - - * tree.h (TYPE_BINFO): Document. - -Mon Sep 28 12:55:49 1998 Stan Cox - - * i386-coff.h (dbxcoff.h): Added. - -Mon Sep 28 12:51:00 1998 Catherine Moore - - * toplev.c: Fix bad patch around flag_data_sections. - -Mon Sep 28 10:32:28 1998 Nick Clifton - - * reload1.c (reload): Use reload_address_index_reg_class and - reload_address_base_reg_class when setting - caller_save_spill_class. (Patch generated by Jim Wilson: - wilson@cygnus.com). - -Mon Sep 28 07:43:34 1998 Mark Mitchell - - * c-common.c (c_get_alias_set): Tighten slightly for FUNCTION_TYPEs - and ARRAY_TYPEs. Tidy up. Improve support for type-punning. - * expr.c (store_field): Add alias_set parameter. Set the - MEM_ALIAS_SET accordingly, if the target is a MEM. - (expand_assignment): Use it. - (store_constructor_field): Pass 0. - (expand_expr): Likewise. - -Mon Sep 28 07:54:03 1998 Catherine Moore - - * flags.h: Add flag_data_sections. - * toplev.c: Add option -fdata-sections. Add flag_data_sections. - (compile_file): Error if flag_data_sections not supported. - * varasm.c (assemble_variable): Handle flag_data_sections. - * config/svr4.h: Modify prefixes for UNIQUE_SECTION_NAME. - * config/mips/elf.h: Likewise. - * config/mips/elf64.h: Likewise. - * invoke.texi: Describe -fdata-sections. - -Mon Sep 28 04:15:44 1998 Craig Burley - - * invoke.texi (-ffloat-store): Clarify that this option - does not affect intermediate results -- only variables. - -Mon Sep 28 04:11:35 1998 Jeffrey A Law (law@cygnus.com) - - * cpp.texi: Update for Fortran usage from Craig. - -Fri Sep 25 22:09:47 1998 David Edelsohn - - * rs6000.c (function_arg_boundary): Revert accidental change on - September 18. - -Fri Sep 25 20:30:00 1998 Michael Meissner - - * rs6000.h (ASM_OUTPUT_MI_THUNK): Declare, call output_mi_thunk. - (output_mi_thunk): Declare. - - * rs6000.c (output_mi_thunk): Function to create thunks for MI. - (output_function_profiler): Use r12 for temp, instead of r11 so - that we preserve the static chain register. - -Fri Sep 25 14:18:33 1998 Jim Wilson - - * sdbout.c (sdbout_one_type): Don't look at TYPE_BINFO field of enums. - -Fri Sep 25 19:30:19 1998 J"orn Rennecke - - * sh.c (gen_shl_sext): Fix case 5. - -Fri Sep 25 17:35:23 1998 J"orn Rennecke - - * reload1.c (reload_combine): Re-add line that got accidentally lost. - -Fri Sep 25 10:43:47 1998 Kaveh R. Ghazi - - * cccp.c (pedwarn_with_file_and_line): For !__STDC__ case, avoid - accessing variables until they are initialized via va_arg(). - -Thu Sep 24 22:12:16 1998 David S. Miller - - * reload1.c (reload_combine): Initialize set before using. - -Thu Sep 24 18:53:20 1998 Jason Merrill - - * sdbout.c (sdbout_field_types): Don't emit the types of fields we - won't be emitting. - -Thu Sep 24 17:05:30 1998 Nick Clifton - - * config/arm/arm.md (insv): Add comment. In CONST_INT case, and - operand3 with mask before using it. Patch provided by Jim Wilson. - -Thu Sep 24 15:08:08 1998 Jakub Jelinek - - * config/sparc/sparc.c (function_value): Perform the equivalent of - PROMOTE_MODE for ARCH64. - (eligible_for_epilogue_delay): Allow DImode operations in delay - slot of a return for ARCH64. - -Thu Sep 24 22:17:54 1998 J"orn Rennecke - - * sh.md (sqrtsf2): Fix mode of sqrt. - -Thu Sep 24 21:48:51 1998 J"orn Rennecke - - * reload1.c (choose_reload_regs): Also try inheritance when - reload_in is a stack slot of a pseudo, even if we already got a - reload reg. - -Thu Sep 24 21:22:39 1998 J"orn Rennecke - - * reload1.c (reload_cse_regs_1): Renamed from reload_cse_regs. - (reload_cse_regs): New function body: call reload_cse_regs_1, - reload_combine, reload_cse_move2add. - When doing expensive_optimizations, call reload_cse_regs_1 a - second time after reload_cse_move2add. - (reload_combine, reload_combine_note_store): New functions. - (reload_combine_note_use): New function. - (reload_cse_move2add, move2add_note_store): New functions. - -Thu Sep 24 18:48:43 1998 J"orn Rennecke - - * reload.c (find_reloads): In code to promote RELOAD_FOR_X_ADDR_ADDR - reloads to RELOAD_FOR_X_ADDRESS reloads, test for reload sharing. - - Properly keep track of first RELOAD_FOR_X_ADDRESS also for - more than 3 such reloads. - - If there is not more than one RELOAD_FOR_X_ADDRESS, don't change - RELOAD_FOR_X_ADDR_ADDR reload. - -Thu Sep 24 17:45:55 1998 J"orn Rennecke - - * expr.c (store_constructor): When initializing a field that is smaller - than a word, at the start of a word, try to widen it to a full word. - - * cse.c (cse_insn): When we are about to change a register, - remove any invalid references to it. - - (remove_invalid_subreg_refs): New function. - (mention_regs): Special treatment for SUBREGs. - (insert_regs): Don't strip SUBREG for call to mention_regs. - Check if reg_tick needs to be bumped up before that call. - (lookup_as_function): Try to match known word_mode constants when - looking for a norrower constant. - (canon_hash): Special treatment for SUBREGs. - -Thu Sep 24 01:35:34 1998 David S. Miller - - * config/sparc/sol2-sld-64.h (TRANSFER_FROM_TRAMPOLINE): Define. - * config/sparc/sparc.c (sparc64_initialize_trampoline): If that is - defined, emit libcall to __enable_execute_stack. Also fix opcodes - and offsets in actual stack trampoline code so they match the - commentary and actually work. - -Thu Sep 24 01:19:02 1998 Jakub Jelinek - - * configure.in (sparcv9-*-solaris): Use t-sol2 and t-sol2-64 for - tmake_file. - (sparc64-*-linux): Use t-linux and sparc/t-linux64 for - tmake_file. Set extra_parts to needed crt objects. - * configure: Rebuilt. - * config/sparc/linux64.h (SPARC_BI_ARCH): Define. - (TARGET_DEFAULT): Set if default is v9 or ultra. - (STARTFILE_SPEC32, STARTFILE_SPEC64): New macros. - (STARTFILE_SPEC): Set to those upon SPARC_BI_ARCH. - (ENDFILE_SPEC32, ENDFILE_SPEC64, ENDFILE_SPEC): Likewise. - (SUBTARGET_EXTRA_SPECS, LINK_ARCH32_SPEC, LINK_ARCH64_SPEC, - LINK_SPEC, LINK_ARCH_SPEC): Likewise. - (TARGET_VERSION): Define. - (MULTILIB_DEFAULT): Define. - * config/sparc/sparc.h (CPP_CPU_DEFAULT_SPEC): Rearrange so that - mixed 32/64 bit compilers based upon SPARC_BI_ARCH work. - (CPP_CPU64_DEFAULT_SPEC, CPP_CPU32_DEFAULT_SEC): Define - appropriately. - (TARGET_SWITCHES): Allow ptr32/ptr64 options once more. - * config/sparc/sparc.c (sparc_override_options): If arch and - pointer size disagree, emit diagnostic and fix it up. If - SPARC_BI_ARCH and TARGET_ARCH32, set cmodel to CM_32. Turn off - V8PLUS in 64-bit mode. - * config/sparc/t-linux64: New file. - * config/sparc/t-sol2-64: New file. - * config/sparc/t-sol2: Adjust build rules to use MULTILIB_CFLAGS. - * config/sparc/sol2-sld-64.h (SPARC_BI_ARCH): Define. - (ASM_CPU32_DEFAULT_SPEC, ASM_CPU64_DEFAULT_SPEC, - CPP_CPU32_DEFAULT_SPEC, CPP_CPU64_DEFAULT_SPEC): Define. - (ASM_SPEC, CPP_CPU_SPEC): Set appropriately based upon those. - (STARTFILE_SPEC32, STARTFILE_SPEC32, STARTFILE_ARCH_SPEC): - Define. - (STARTFILE_SPEC): Set appropriately based upon those. - (CPP_CPU_DEFAULT_SPEC, ASM_CPU_DEFAULT_SPEC): Set based upon - disposition of DEFAULT_ARCH32_P. - (LINK_ARCH32_SPEC, LINK_ARCH64_SPEC): Define. - (LINK_ARCH_SPEC, LINK_ARCH_DEFAULT_SPEC): Set based upon those. - (CC1_SPEC, MULTILIB_DEFAULTS): Set based upon DEFAULT_ARCH32_P. - (MD_STARTFILE_PREFIX): Set correctly based upon SPARC_BI_ARCH. - * config/sparc/xm-sysv4-64.h (HOST_BITS_PER_LONG): Only set on - arch64/v9. - * config/sparc/xm-sp64.h (HOST_BITS_PER_LONG): Likewise. - -Wed Sep 23 22:32:31 1998 Mark Mitchell - - * rtl.h (init_virtual_regs): New function. - * emit-rtl.c (init_virtual_regs): Define. - (insn_emit): Use it. - * integrate.c (save_for_inline_copying): Likewise. - -Wed Sep 23 16:22:01 1998 Nick Clifton - - * config/arm/thumb.h: The following patches were made by Jim Wilson: - (enum reg_class): Add NONARG_LO_REGS support. - (REG_CLASS_NAMES, REG_CLASS_CONTENTS, REGNO_REG_CLASS, - PREFERRED_RELOAD_CLASS, SECONDARY_RELOAD_CLASS): Likewise. - (GO_IF_LEGITIMATE_ADDRESS): Disable REG+REG addresses before reload - completes. Re-enable HImode REG+OFFSET addresses. - (LEGITIMIZE_RELOAD_ADDRESS): Define. - - * expmed.c (extract_bit_field): Add comment from Jim Wilson. - -Wed Sep 23 13:26:02 1998 Richard Henderson - - * alpha.c (get_aligned_mem): Revert Sep 20 change. - (alpha_set_memflags, alpha_set_memflags_1): Likewise. - (alpha_align_insns): Properly calculate initial offset wrt max_align. - -Wed Sep 23 10:45:44 1998 Richard Earnshaw (rearnsha@arm.com) - - * arm.c (find_barrier): Revert change of Apr 23. Handle table - jumps as a single entity, taking into account the size of the - table. - -Tue Sep 22 15:13:34 1998 Alexandre Petit-Bianco - - * tree.def (SWITCH_EXPR): New tree node definition. - -Mon Sep 21 23:40:38 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Sep 21 22:31:14 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Sep 21 22:48:09 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in: Recognize i[34567]86-*-openbsd* and handle it like - NetBSD. - -Mon Sep 21 22:05:28 1998 Jeffrey A Law (law@cygnus.com) - - * Revert this patch. - * reload.c (find_reloads): Do not replace a pseudo with - (MEM (reg_equiv_addr)) in the initializing insn for the - pseudo. - -Mon Sep 21 20:19:41 1998 John Carr - - * final.c (final_scan_insn): Disable tracking CC across branches. - -Mon Sep 21 17:15:26 1998 Andrew MacLeod - - * expr.h (eh_rtime_match_libfunc): New extern declaration. - * optabs.c (init_optabs): Set eh_rtime_match_libfunc. - * except.c (start_catch_handler): Use eh_rtime_match_libfunc. - * libgcc2.c (__eh_rtime_match): Always return 0 if the matcher is - NULL. Only include if inhibit_libc is not defined. - -Mon Sep 21 14:10:51 1998 Jason Merrill - - * toplev.c (rest_of_compilation): Skip compiling anything with - DECL_EXTERNAL set, not just if it has DECL_INLINE as well. - -Mon Sep 21 13:51:05 1998 Jim Wilson - - * flow.c (find_basic_blocks): Delete check for in_libcall_block when - prev_code is a CALL_INSN. Change check for REG_RETVAL note to - use in_libcall_block. - (find_basic_blocks_1): Delete check for in_libcall_block when prev_code - is a CALL_INSN. If CALL_INSN and in_libcall_block, then change code - to INSN. - -Mon Sep 21 14:02:23 1998 Robert Lipe - - * i386.h (TARGET_SWITCHES): Improve doc for align-double. Fix - typo in no-fancy-math-387 description. - -Mon Sep 21 09:27:18 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Sep 21 09:24:49 1998 Stan Cox - - * i386-coff.h (DBX_DEBUGGING_INFO): Added. - -Mon Sep 21 09:14:49 1998 Robert Lipe - - * i386.h (TARGET_SWITCHES): Add description fields for flags - documented in install.texi. - (TARGET_OPTIONS): Likewise. - -Mon Sep 21 01:39:03 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Sep 21 01:53:05 1998 Felix Lee - - * c-lex.c (init_lex): Use getenv ("LANG"), not GET_ENVIRONMENT (). - * cccp.c (main): Likewise. - - * cccp.c, collect2.c, cpplib.c, gcc.c, config/i386/xm-cygwin32.h: - Rename GET_ENVIRONMENT to GET_ENV_PATH_LIST, and fix some - macro-use bugs. - -Mon Sep 21 00:52:12 1998 Per Bothner - - * Makefile.in (LIBS): Link in libiberty.a. - * c-common.c, gcc.c, toplev.c: Replace (some) bcopy calls by memcpy. - -Sun Sep 20 23:28:11 1998 Richard Henderson - - * reload1.c (emit_reload_insns): Accept a new arg for the bb. Use - it to update bb boundaries. Update caller. - * function.c (reposition_prologue_and_epilogue_notes): Update - bb boundaries wrt the moved note. - -Sun Sep 20 20:57:02 1998 Robert Lipe - - * configure.in (i*86-*-sysv5*): Use fixinc.svr4 to patch byteorder - problems. - * configure: Regenerate. - -Sun Sep 20 19:01:51 1998 Richard Henderson - - * alpha.c (alpha_sr_alias_set): New variable. - (override_options): Set it. - (alpha_expand_prologue, alpha_expand_epilogue): Use it. - (mode_mask_operand): Fix signed-unsigned comparison warning. - (alpha_expand_block_move): Likewise. - (print_operand): Likewise. - (get_aligned_mem): Use change_address. - (alpha_set_memflags, alpha_set_memflags_1): Set the alias set. - (alphaev4_insn_pipe, alphaev4_next_group): New functions. - (alphaev4_next_nop, alphaev5_next_nop): New functions. - (alpha_align_insns): Remade from old alphaev5_align_insns - to handle multiple processors. - (alpha_reorg): Call alpha_align_insns for both ev4 and ev5. - * output.h (label_to_alignment): Prototype. - - * tree.c (new_alias_set): New function. - * tree.h (new_alias_set): Declare it. - * c-common.c (c_get_alias_set): Use it. - -Sun Sep 20 12:35:55 1998 Richard Henderson - - * fold-const.c (fold): Yet another COND_EXPR bug: when folding - to an ABS expr, convert an unsigned input to signed. - -Sun Sep 20 12:14:45 1998 Jeffrey A Law (law@cygnus.com) - - * fold-const.c (fold): Fix another type in COND_EXPR handling code. - -1998-09-20 Michael Hayes - - * configure.in: Add support for c4x targets. - * configure: Rebuilt. - -Sun Sep 20 00:00:51 1998 Richard Henderson - - * combine.c (distribute_notes): If an insn is a cc0 user, only - delete it if we can also delete the cc0 setter. - -Sun Sep 20 00:22:23 1998 Michael Tiemann - - * fold-const.c (fold): Fix typo in COND_EXPR handling code. - (invert_truthvalue): Enable truthvalue inversion for - floating-point operands if -ffast-math. - -Sat Sep 19 23:58:07 1998 Melissa O'Neill - - * configure.in: Disable collect2 for nextstep. Instead use - crtbegin/crtend. - * configure: Rebuilt. - * config/nextstep.h (STARTFILE_SPEC): Add crtbegin. - (ENDFILE_SPEC): Define. - (OBJECT_FORMAT_MACHO): Define. - (EH_FRAME_SECTION_ASM_OP): Define. - * crtstuff.c: Handle MACHO. - -Sun Sep 20 00:24:24 1998 Robert Lipe - - * config/i386/sco5.h (TARGET_MEM_FUNCTIONS): Define. - -1998-09-19 Torbjorn Granlund - - * fp-bit.c (pack_d): Do not clear SIGN when fraction is 0. - (_fpadd_parts): Get sign right for 0. - -1998-09-19 Michael Hayes - - * ginclude/varargs.h: Add support for C4x target. - * ginclude/stdargs.h: Likewise. - -Sat Sep 19 12:05:09 1998 Richard Henderson - - * alpha.c (alpha_return_addr): SET should be VOIDmode. - (alpha_emit_set_long_const): Rewrite to be callable from reload - and 32-bit hosts. - (alpha_expand_epilogue): Update for alpha_emit_set_long_const. - * alpha.md (movdi): Likewise. - -Sat Sep 19 07:33:36 1998 Richard Earnshaw (rearnsha@arm.com) - - * arm.c (add_constant): New parameter address_only, change caller. - Set it non-zero if taking the address of an item in the pool. - (arm_reorg): Handle cases where we need the address of an item in - the pool. - - * arm.c (bad_signed_byte_operand): Check both arms of a sum in - a memory address. - * arm.md (splits for *extendqihi_insn and *extendqisi_insn): Handle - memory addresses that are not in standard canonical form. - -Sat Sep 19 01:00:32 1998 Michael Hayes (mph@elec.canterbury.ac.nz) - - * README.C4X: New file with information about the c4x ports. - * ginclude/va-c4x.h: New file for c4x varargs support. - * config/c4x: New directory with c4x port files. - -Fri Sep 18 22:52:05 1998 Jeffrey A Law (law@cygnus.com) - - * reload.c (find_reloads): Do not replace a pseudo with - (MEM (reg_equiv_addr)) in the initializing insn for the - pseudo. - -Fri Sep 18 23:50:56 1998 David Edelsohn - - * toplev.c (rest_of_compilation): Set bct_p on second call to - loop_optimize. - * loop.c (loop_optimize, scan_loop, strength_reduce): New argument - bct_p. - (strength_reduce): Only call analyze_loop_iterations and - insert_bct if bct_p set. - (check_dbra_loop): Fix typo. - (insert_bct): Use word_mode instead of SImode. - (instrument_loop_bct): Likewise. Do not delete iteration count - condition code generation insn. Initialize iteration count before - loop start. - * rtl.h (loop_optimize): Update prototype. - - * ginclude/va-ppc.h (va_arg): longlong types in overflow area are - not doubleword aligned. - - * rs6000.c (optimization_options): New function. - (secondary_reload_class): Only call true_regnum for PSEUDO_REGs. - * rs6000.h (OPTIMIZATION_OPTIONS): Define. - (REG_ALLOC_ORDER): Allocate highest numbered condition regsiters - first; cr1 can be used for FP record condition insns. - -Fri Sep 18 09:44:55 1998 Nick Clifton - - * config/m32r/m32r.h (m32r_block_immediate_operand): Add to - PREDICATE_CODES. - - * config/m32r/m32r.md: Add "movstrsi" and "movstrsi_internal" - patterns. - - * config/m32r/m32r.c (m32r_print_operand): Add 's' and 'p' - operators. - (block_move_call): New function: Call a library routine to copy a - block of memory. - (m32r_expand_block_move): New function: Expand a "movstrsi" - pattern into a sequence of insns. - (m32r_output_block_move): New function: Expand a - "movstrsi_internal" pattern into a sequence of assembler opcodes. - (m32r_block_immediate_operand): New function: Return true if the - RTL is an integer constant, less than or equal to MAX_MOVE_BYTES. - -Thu Sep 17 16:42:16 1998 Andrew MacLeod - - * except.c (start_catch_handler): Issue 'fatal' instead of 'error' and - re-align some code. - * libgcc2.c (__eh_rtime_match): fprintf a runtime error. Use . - -Thu Sep 17 12:24:33 1998 J"orn Rennecke - - * regmove.c (copy_src_to_dest): Check that modes match. - -Wed Sep 16 22:10:42 1998 Robert Lipe - - * config/i386/sco5.h (SUPPORTS_WEAK): True only if targeting ELF. - -Wed Sep 16 15:24:54 1998 Richard Henderson - - * i386.h (PREFERRED_RELOAD_CLASS): Respect an existing class - narrower than FLOAT_REGS. - -Wed Sep 16 17:51:00 1998 Alexandre Oliva - - * cpplib.c: Removed OLD_GPLUSPLUS_INCLUDE_DIR. - * cccp.c: Likewise. - * Makefile.in (old_gxx_include_dir): Removed. - -Wed Sep 16 12:29:22 1998 Nick Clifton - - * config/sh/sh.h: Update definition of HANDLE_PRAGMA to match - new specification. - - * config/sh/sh.c (handle_pragma): Rename to sh_handle_pragma(). - (sh_handle_pragma): Change function arguments to match new - specification for HANDLE_PRAGMA. - -Wed Sep 16 12:43:19 1998 Kaveh R. Ghazi - - * gen-protos.c (parse_fn_proto): Cast argument of ISALNUM to - `unsigned char'. - (main): Mark parameter `argc' with ATTRIBUTE_UNUSED. - When generating output, initialize missing struct member to zero. - -Wed Sep 16 14:47:43 1998 J"orn Rennecke - - * regmove.c (copy_src_to_dest): Don't copy if that requires - (a) new register(s). - -Wed Sep 16 01:29:12 1998 Bernd Schmidt - - * global.c (reg_allocno): Now static. - * reload1.c (reg_allocno): Delete declaration. - (order_regs_for_reload): Take no arguments. Don't treat regs - allocated by global differently than those allocated by local-alloc. - -Wed Sep 16 01:09:01 1998 Kamil Iskra - - * m68k/m68k.c (output_function_prologue): Reverse NO_ADDSUB_Q - condition, fix format strings. - (output_function_epilogue): Likewise. - - * m68k/m68k.c: Don't include directly. - -Wed Sep 16 00:30:56 1998 Geoff Keating - - * gcse.c: New definition NEVER_SET for reg_first_set, reg_last_set, - mem_first_set, mem_last_set; because 0 can be a CUID. - (oprs_unchanged_p): Use new definition. - (record_last_reg_set_info): Likewise. - (record_last_mem_set_info): Likewise. - (compute_hash_table): Likewise. - -Tue Sep 15 22:59:52 1998 Jeffrey A Law (law@cygnus.com) - - * rs6000.c (output_epilogue): Handle Chill. - - * mn10200.h (ASM_OUTPUT_DWARF2_ADDR_CONST): Define. - * mn10300.h (ASM_OUTPUT_DWARF2_ADDR_CONST): Define. - - * combine.c (make_extraction): If no mode is specified for - an operand of insv, extv, or extzv, default it to word_mode. - (simplify_comparison): Similarly. - * expmed.c (store_bit_field): Similarly. - (extract_bit_field): Similarly. - * function.c (fixup_var_regs_1): Similarly. - * recog.c (validate_replace_rtx_1): Similarly. - * mips.md (extv, extzv, insv expanders): Default modes for most - operands. Handle TARGET_64BIT. - (movdi_uld, movdi_usd): New patterns. - - * pa.c (emit_move_sequence): Do not replace a pseudo with its - equivalent memory location unless we have been provided a scratch - register. Similarly do not call find_replacement unless a - scratch register has been provided. - -Tue Sep 15 19:23:01 1998 Bernd Schmidt - - * i386.h (PREFERRED_RELOAD_CLASS): For standard 387 constants, - return FLOAT_REGS. - -Tue Sep 15 19:09:06 1998 Richard Henderson - - * tree.h (BUILT_IN_CALLER_RETURN_ADDRESS): Unused. Kill. - (BUILT_IN_FP, BUILT_IN_SP, BUILT_IN_SET_RETURN_ADDR_REG): Kill. - (BUILT_IN_EH_STUB_OLD, BUILT_IN_EH_STUB, BUILT_IN_SET_EH_REGS): Kill. - (BUILT_IN_EH_RETURN, BUILT_IN_DWARF_CFA): New. - * c-decl.c (init_decl_processing): Update accordingly. - * expr.c (expand_builtin): Likewise. - - * rtl.h (global_rtl): Add cfa entry. - (virtual_cfa_rtx, VIRTUAL_CFA_REGNUM): New. - (LAST_VIRTUAL_REGISTER): Update. - * emit-rtl.c (global_rtl): Add cfa entry. - (init_emit): Initialize it. - * function.c (cfa_offset): New. - (instantiate_virtual_regs): Initialize it. - (instantiate_virtual_regs_1): Instantiate virtual_cfa_rtx. - (expand_function_end): Call expand_eh_return. - * tm.texi (ARG_POINTER_CFA_OFFSET): New. - - * except.c (current_function_eh_stub_label): Kill. - (current_function_eh_old_stub_label): Likwise; update all references. - (expand_builtin_set_return_addr_reg): Kill. - (expand_builtin_eh_stub_old, expand_builtin_eh_stub): Kill. - (expand_builtin_set_eh_regs): Kill. - (eh_regs): Produce a third reg for the actual handler address. - (eh_return_context, eh_return_stack_adjust): New. - (eh_return_handler, eh_return_stub_label): New. - (init_eh_for_function): Initialize them. - (expand_builtin_eh_return, expand_eh_return): New. - * except.h: Update prototypes. - * flow.c (find_basic_blocks_1): Update references to the stub label. - * function.h (struct function): Kill stub label elements. - - * libgcc2.c (in_reg_window): For REG_SAVED_REG, check that the - register number is one that would be in the previous window. - Provide a dummy definition for non-windowed targets. - (get_reg_addr): New function. - (get_reg, put_reg, copy_reg): Use it. - (__throw): Rely on in_reg_window, not INCOMING_REGNO. Kill stub - generating code and use __builtin_eh_return. Use __builtin_dwarf_cfa. - - * alpha.c (alpha_eh_epilogue_sp_ofs): New. - (alpha_init_expanders): Initialize it. - (alpha_expand_epilogue): Use it. - * alpha.h: Declare it. - * alpha.md (eh_epilogue): New. - - * m68h.h (ARG_POINTER_CFA_OFFSET): New. - * sparc.h (ARG_POINTER_CFA_OFFSET): New. - -Tue Sep 15 19:31:58 1998 Michael Meissner - - * i960.h (CONST_COSTS): Fix thinko. Test flag, not the constant - flag bit mask. - -Tue Sep 15 14:10:54 1998 Andrew MacLeod - - * except.h (struct eh_entry): Add false_label field. - (end_catch_handler): Add prototype. - * except.c (push_eh_entry): Set false_label field to NULL_RTX. - (start_catch_handler): When using old style exceptions, issue - runtime typematch code before continuing with the handler. - (end_catch_handler): New function, generates label after handler - if needed by older style exceptions. - (expand_start_all_catch): No need to check for new style exceptions. - (output_exception_table_entry): Only output the first handler label - for old style exceptions. - * libgcc2.c (__eh_rtime_match): New routine to lump runtime matching - mechanism into one function, if a runtime matcher is provided. - -Tue Sep 15 13:53:59 1998 Andrew MacLeod - - * config/i960/i960.h (SLOW_BYTE_ACCESS): Change definition to 1. - -Tue Sep 15 09:59:01 1998 Mark Mitchell - - * integrate.c (copy_decl_list): Fix typo. - -Tue Sep 15 04:18:52 1998 David S. Miller - - * config/sparc/sparc.md (movdf_const_intreg_sp32): Fix length - attribute. - -Mon Sep 14 14:02:53 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Sep 14 10:33:56 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Mon Sep 14 09:51:05 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Sep 13 22:10:18 1998 David S. Miller - - * invoke.texi (C Dialect Options): Put back missing @end itemize. - -Mon Sep 14 02:33:46 1998 Alexandre Oliva - - * configure.in: Remove usage of `!' to negate the result of a - command; some common shells do not support it. - -Sun Sep 13 19:17:35 1998 David S. Miller - - * configure.in: In sparc9-sol2 config, use 'if test' not - brackets. - * configure: Rebuilt. - - * config/sparc/sol2-sld-64.h (SPARC_DEFAULT_CMODEL): Change to - CM_MEDANY. - (CPP_CPU_SPEC): Do not define _LP64, header files do this. - (CPP_CPU_DEFAULT_SPEC): Likewise. - * config/sparc/sol2.h (INIT_SUBTARGET_OPTABS): Get the names right - for arch64 libfuncs. - - * config/sparc/sparc.md (goto_handler_and_restore): Allow any mode - for operand zero. - -Sun Sep 13 09:11:59 1998 Kaveh R. Ghazi - - * acconfig.h (NEED_DECLARATION_STRSIGNAL): Provide a stub. - - * collect2.c: Don't declare `sys_siglist' here. - (my_strsignal): Prototype and define new function. Use it in - place of `sys_siglist' hacks. - - * mips_tfile.c: Likewise. - - * configure.in (AC_CHECK_FUNCS): Check for strsignal. - (GCC_NEED_DECLARATIONS): Likewise. - - * system.h (strsignal): Prototype it, if necessary. - (sys_siglist): Declare it, if necessary. - -Sun Sep 13 04:37:28 1998 David S. Miller - - * loop.c (move_movables): While removing insn sequences, preserve - the next pointer of the most recently deleted insn when we skip - over a NOTE. - -Sun Sep 13 08:13:39 1998 Ben Elliston - - * objc/config-lang.in: Do not output the name of the selected - thread file when building the front-end. The Makefile for the - runtime library will do this. - - * objc/Make-lang.in: Do not build the runtime library or install - the Objective C header files. The Makefile for the runtime - library will do this. - - * objc/Makefile.in (all.indirect): Only build the front-end. - (compiler): Rename to `frontend'. - (obj-runtime): Remove target. - (copy-headers): Likewise. - (clean): No need to remove `libobjc.a' any longer. - -Sat Sep 12 11:37:19 1998 Michael Meissner - - * rs6000.h ({ASM,CPP}_CPU_SPEC): Add support for all machines - supported with -mcpu=xxx. - -Fri Sep 11 23:55:54 1998 David S. Miller - - * flow.c (mark_set_1): Recognize multi-register structure return - values in CALL insns. - (mark_used_regs): Likewise. - (count_reg_sets_1): Likewise. - (count_reg_references): Likewise. - * rtlanal.c (note_stores): Likewise. - (reg_overlap_mentioned_p): Likewise. - * haifa-sched.c (check_live_1): Likewise. - (update_live_1): Likewise. - (sched_analyze_1): Likewise. - (sched_note_set): Likewise. - (birthing_insn_p): Likewise. - (attach_deaths): Likewise. - - * config/sparc/sparc.md (movdf_const_intreg_sp64): Disable. - -Fri Sep 11 22:57:55 1998 Eric Dumazet - - * config/i386/sco5.h (ASM_WEAKEN_LABEL): Defined as in svr4.h. - -Thu Sep 10 22:02:04 1998 David S. Miller - - * glimits.h (__LONG_MAX__): Recognize __sparcv9 too. - -Thu Sep 10 21:19:10 1998 Jakub Jelinek - - * configure.in: Add check for GAS subsection -1 support. - * acconfig.h (HAVE_GAS_SUBSECTION_ORDERING): Add. - * configure config.in: Rebuilt. - * config/sparc/sparc.h (CASE_VECTOR_MODE): For V9 flag_pic, use - SImode is subsection -1 works, else use DImode. - (ASM_OUTPUT_ADDR_VEC_START, ASM_OUTPUT_ADDR_VEC_END): Define if - subsection -1 works. - * config/sparc/sparc.c (sparc_output_addr_vec, - sparc_output_addr_diff_vec): Use them if defined. - -Thu Sep 10 10:46:01 1998 Mark Mitchell - - * tree.h (DECL_ORIGIN): New macro. - * integrate.c (copy_and_set_decl_abstract_origin): New function. - (copy_decl_list): Use it. - (integrate_parm_decls): Likewise. - (integrate_decl_tree): Likewise. - * dwarf2out.c (decl_ultimate_origin): Simplify. - * dwarfout.c (decl_ultimate_origin): Likewise. - * c-decl.c (duplicate_decls): Use DECL_ORIGIN. - (pushdecl): Likewise. - -Thu Sep 10 08:01:31 1998 Anthony Green - - * config/rs6000/rs6000.c (output_epilog): Add Java support. - -Thu Sep 10 14:48:59 1998 Martin von Löwis - - * invoke.texi (C++ Dialect Options): Document -fhonor-std. - -Thu Sep 10 01:38:05 1998 Jeffrey A Law (law@cygnus.com) - - * reg-stack.c (straighten_stack): Do nothing if the virtual stack is - empty or has a single entry. - - * toplev.c (rest_of_compilation): Open up the dump file for reg-stack - before calling reg_to_stack. - -Thu Sep 10 00:03:34 1998 Richard Henderson - - * alpha.c (alphaev5_insn_pipe): Abort on default case. - (alphaev5_next_group): Swallow CLOBBERs and USEs. - - * c-tree.h (warn_long_long): Declare it. - -Wed Sep 9 23:31:36 1998 (Stephen L Moshier) - - * emit-rtl.c (gen_lowpart_common): Disable optimization of - initialized float-int union if the value is a NaN. - -Wed Sep 9 23:00:48 1998 Nathan Sidwell - - * c-lex.c (real_yylex): Don't warn about long long constants if - we're allowing long long - -Wed Sep 9 21:58:41 1998 Bernd Schmidt - - * except.h (current_function_eh_stub_label): Declare. - (current_function_eh_old_stub_label): Declare. - * function.h (struct function): New members eh_stub_label and - eh_old_stub_label. - * except.c (current_function_eh_stub_label): New variable. - (current_function_eh_old_stub_label): New variable. - (init_eh_for_function): Clear them. - (save_eh_status): Save them. - (restore_eh_status): Restore them. - (expand_builtin_eh_stub): Set current_function_eh_stub_label. - (expand_builtin_eh_stub_old): Set current_function_eh_old_stub_label. - * flow.c (find_basic_blocks_1): When handling a REG_LABEL note, don't - make an edge from the block that contains it to the block starting - with the label if this label is one of the eh stub labels. - If eh stub labels exist, show they are reachable from the last block - in the function. - - * reload1.c (reload): Break out several subroutines and make some - variables global. - (calculate_needs_all_insns): New function, broken out of reload. - (calculate_needs): Likewise. - (find_reload_regs): Likewise. - (find_group): Likewise. - (find_tworeg_group): Likewise. - (something_needs_reloads): New global variable, formerly in reload. - (something_needs_elimination): Likewise. - (caller_save_spill_class): Likewise. - (caller_save_group_size): Likewise. - (max_needs): Likewise. - (group_size): Likewise. - (max_groups): Likewise. - (max_nongroups): Likewise. - (group_mode): Likewise. - (max_needs_insn): Likewise. - (max_groups_insn): Likewise. - (max_nongroups_insn): Likewise. - (failure): Likewise. - - * print-rtl.c (print_rtx): For MEMs, print MEM_ALIAS_SET. - -Wed Sep 9 13:14:41 1998 Richard Henderson - - * loop.c (load_mems): Copy rtx for output mem. - -Wed Sep 9 15:16:58 1998 Gavin Romig-Koch - - * mips/abi64.h (LONG_MAX_SPEC): Don't set LONG_MAX for - mips1 or mips2 either. - -Wed Sep 9 12:31:35 1998 Jeffrey A Law (law@cygnus.com) - - * pa.c (pa_reorg): New marking scheme for jumps inside switch - tables. - (pa_adjust_insn_length): Update to work with new marking scheme - for jumps inside switch tables. - * pa.md (switch_jump): Remove pattern. - (jump): Handle jumps inside jump tables. - - * Makefile.in (profile.o): Depend on insn-config.h - -Wed Sep 9 09:36:51 1998 Jim Wilson - - * iris6.h (DWARF2_UNWIND_INFO): Undef. - -Wed Sep 9 01:32:01 1998 David S. Miller - - Add preliminary native sparcv9 Solaris support. - * configure.in: Recognize sparv9-*-solaris2* - * configure: Rebuilt. - * config.sub: Recognize sparcv9 just like sparc64. - * config/sparc/sol2-c1.asm config/sparc/sol2-ci.asm - config/sparc/sol2-cn.asm: Macroize so it can be shared between - 32-bit and 64-bit Solaris systems. - * config/sparc/t-sol2: Assemble those with cpp. - * config/sparc/sparc.h (TARGET_CPU_sparcv9): New alias for v9. - (*TF*_LIBCALL): If ARCH64 use V9 names. - * config/sparc/{xm-sysv4-64,sol2-sld-64}.h: New files. - -Wed Sep 9 01:07:30 1998 Jakub Jelinek - - * config/sparc/sparc.h (TARGET_CM_MEDMID): Fix documentation. - (CASE_VECTOR_MODE): Set to SImode even if PTR64, when MEDLOW and - not doing pic. - (ASM_OUTPUT_ADDR_{VEC,DIFF}_ELT): Check CASE_VECTOR_MODE not - Pmode. - * config/sparc/sparc.md (tablejump): Likewise, and sign extend op0 - to Pmode if CASE_VECTOR_MODE is something else. - -Wed Sep 9 00:10:31 1998 Jeffrey A Law (law@cygnus.com) - - * prefix.c (update_path): Correctly handle cases where PATH is - a substring of the builtin prefix, but specifies a different - directory location. - -Tue Sep 8 23:46:04 1998 Hans-Peter Nilsson - - * expr.c: Corrected comment about what MOVE_RATIO does. - * config/alpha/alpha.h: Likewise. - * config/1750a/1750a.h: Likewise. - * config/clipper/clipper.h: Likewise. - * config/i386/i386.h: Likewise. - -Tue Sep 8 22:56:12 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in (m68k-next-nextstep3*): Use collect2. - Similarly for x86 NeXT configurations. - * configure: Rebuilt. - -Tue Sep 8 01:38:57 1998 Nathan Sidwell - - * configure.in: Don't assume srcdir is .../gcc. - * configure: Rebuilt. - -Sat Sep 5 16:34:34 1998 John Wehle (john@feith.com) - - * global.c: Update comments. - (global_alloc): Assign allocation-numbers - even for registers allocated by local_alloc in case - they are later spilled and retry_global_alloc is called. - (mark_reg_store, mark_reg_clobber, - mark_reg_conflicts, mark_reg_death): Always record a - conflict with a pseudo register even if it has been - assigned to a hard register. - (dump_conflicts): Don't list pseudo registers already assigned to - a hard register as needing to be allocated, but do list their - conflicts. - * local-alloc.c: Update comment. - -Mon Sep 7 23:38:01 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in: Check for bogus GCC_EXEC_PREFIX and LIBRARY_PATH. - * configure: Rebuilt. - -Mon Sep 7 22:41:46 1998 Michael Meissner - - * rs6000.c (rs6000_override_options): Fix name for ec603e, to add - missing 'c'. - * t-ppccomm (MULTILIB_MATCHES_FLOAT): Add support for -mcpu=xxx - for all targets that set -msoft-float. - -Mon Sep 7 23:30:07 1998 Kaveh R. Ghazi - - * toplev.c (print_switch_values): Make static to match prototype. - -Mon Sep 7 19:13:59 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in: If we are unable to find the "gnatbind" program, - then do not configure the ada subdir. - * configure: Rebuilt. - -Sun Sep 6 14:03:58 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Sep 6 13:28:07 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Sun Sep 6 08:54:14 1998 Kaveh R. Ghazi - - * Makefile.in (toplev.o): Depend on $(EXPR_H). - (insn-extract.o, insn-attrtab.o): Depend on toplev.h. - - * gansidecl.h: Define ATTRIBUTE_NORETURN. - - * genattrtab.c: Have insn-attrtab.c include toplev.h. - - * genextract.c: Have insn-extract.c include toplev.h. - - * rtl.h: Don't prototype `fatal_insn_not_found' and `fatal_insn'. - - * toplev.c: Include expr.h. - (really_sorry, fancy_abort): Remove prototypes. - (set_target_switch): Add argument in prototype. - (vfatal): Mark prototype with ATTRIBUTE_NORETURN. - (v_really_sorry): Likewise. - (print_version, print_single_switch, print_switch_values): Make - static and add prototype arguments. - (decl_printable_name): Add prototype arguments. - (lang_expand_expr_t): New typedef. - (lang_expand_expr): Declare as a lang_expand_expr_t. - (incomplete_decl_finalize_hook): Add prototype argument. - (decl_name): Mark variable `verbosity' with ATTRIBUTE_UNUSED. - (botch): Likewise for variable `s'. - (rest_of_type_compilation): Mark variables `type' and `toplev' - with ATTRIBUTE_UNUSED if none of DBX_DEBUGGING_INFO, - XCOFF_DEBUGGING_INFO or SDB_DEBUGGING_INFO are defined. - (display_help): Make variable `i' an `unsigned long'. - (main): Remove unused parameter `envp'. - Cast assignment to `lang_expand_expr' to a `lang_expand_expr_t'. - Cast -1 when comparing it with a `size_t'. - - * toplev.h (fatal, fatal_io_error, pfatal_with_name): Mark - prototype with ATTRIBUTE_NORETURN. - (fatal_insn_not_found, fatal_insn, really_sorry, - push_float_handler, pop_float_handler): Add prototypes. - (fancy_abort): Mark prototype with ATTRIBUTE_NORETURN. - (do_abort, botch): Add prototypes. - -Sat Sep 6 12:05:18 1998 John Carr - - * final.c (final): If a label is reached only from a single jump, - call NOTICE_UPDATE_CC on the jump and its predecessor before - emitting the insn after the label. - - * i386.h: Add AMD K6 support. - Change TARGET_* macros to use table lookup. - (INITIALIZE_TRAMPOLINE): Improve trampoline code. - (ADJUST_COST): Change definition to call function in i386.c. - (ISSUE_RATE): Define as 2 for anything newer than an 80486. - * i386.c: Add AMD K6 support. - Add constants for feature tests used by TARGET_* macros. - (split_di): If before reload, call gen_lowpart and gen_highpart. - (x86_adjust_cost): New function. - (put_jump_code): New function. - (print_operand): New codes 'D' and 'd'. - * i386.md: New insn types. New insn attribute "memory". - Redefine scheduling parameters to use new types and add AMD K6 - support. Explicitly set type of most insns. - (move insns): K6 prefers movl $0,reg to xorl reg,reg. Pentium - Pro and K6 prefer movl $1,reg to incl reg. - (adddi3, subdi3): Set cc_status. - (DImode shift patterns): Change label counters from HOST_WIDE_INT - to int; x86 can't have more than 2^31 DImode shifts per file. - (setcc): Combine all setcc patterns. Allow writing memory. - Combine all jump patterns using match_operator. - (*bzero): Name pattern. Emit multiple stos instructions when that - is faster than rep stos. - (xordi3, anddi3, iordi3): Simplify DImode logical patterns and - add define_split. - -Sun Sep 6 11:17:20 1998 Dave Love - - * config/m68k/x-next (BOOT_LDFLAGS): Define suitably for f771 - linking. - -Sat Sep 5 22:05:25 1998 Richard Henderson - - * alpha.c (alpha_ra_ever_killed): Inspect the topmost sequence, - not whatever we're generating now. - - * alpha.c (set_frame_related_p, FRP): New. - (alpha_expand_prologue): Mark frame related insns. - (alpha_expand_epilogue): Likewise, but with a null FRP. - * alpha.h (INCOMING_RETURN_ADDR_RTX): New. - * alpha.md (exception_receiver): New. - * alpha/crtbegin.asm (.eh_frame): New beginning. - (__do_frame_setup, __do_frame_takedown): New. - * alpha/crtend.asm (.eh_frame): New ending. - * alpha/elf.h (DWARF2_DEBUGGING_INFO): Define. - (ASM_SPEC): Don't emit both dwarf2 and mdebug. - (ASM_FILE_START): Don't emit .file for dwarf2. - - * rtl.h (enum reg_note): Add REG_FRAME_RELATED_EXPR. - * rtl.c (reg_note_name): Likewise. - * rtl.texi (REG_NOTES): Likewise. - * dwarf2out.c (dwarf2out_frame_debug): Use it. Recognize a store - without an offset. - -Sat Sep 5 14:47:17 1998 Richard Henderson - - * i386.h (PREFERRED_RELOAD_CLASS): Standard fp constants load to TOS. - * i386.md (movsf, movdf, movxf): Validate memory address returned - from force_const_mem. Kill useless REG_EQUAL setting code. - -Sat Sep 5 14:23:31 1998 Torbjorn Granlund - - * m68k.md (zero_extendsidi2): Fix typo. - -Sat Sep 5 13:40:24 1998 Krister Walfridsson - - * configure.in: Removed references to the removed file. - * config/xm-netbsd.h: Use ${cpu_type}/xm-netbsd.h for - arm*-*-netbsd* and ns32k-*-netbsd*. - * config/i386/xm-netbsd.h: Removed unnecessary file. - * config/m68k/xm-netbsd.h: Likewise. - * config/sparc/xm-netbsd.h: Likewise. - * config/mips/xm-netbsd.h: Likewise. - -Sat Aug 29 13:32:58 1998 Mumit Khan - - * i386/cygwin32.h (BIGGEST_ALIGNMENT): Define. - (PCC_BITFIELD_TYPE_MATTERS): Define to be 0. - - * i386/cygwin32.h (ASM_OUTPUT_SECTION_NAME): Don't check for - for exact section attributions. - - * i386/mingw32.h (CPP_PREDEFINES): Add __MSVCRT__ for msvc - runtime. - * i386/crtdll.h (CPP_PREDEFINES): Define. - -Sat Sep 5 03:23:05 1998 Jeffrey A Law (law@cygnus.com) - - * m68k.md (5200 movqi): Do not allow byte sized memory references - using address regs. - * m68k.c (output_move_qimode): Do not use byte sized operations on - address registers. - - * Makefile.in (pexecute.o): Use pexecute.c from libiberty. Provide - explicit rules for building. Similarly for alloca, vfprintf, - choose-temp and mkstemp, getopt, getopt1, and obstack. - (INCLUDES): Add $(srcdir)/../include. - * pexecute.c, alloca.c, vfprintf.c, choose-temp.c, mkstemp.c: Delete. - * getopt.h, getopt.c getopt1.c, obstack.c, obstack.h: Likewise. - -Fri Sep 4 11:57:50 1998 Tom Tromey - - * gcc.c (do_spec_1): [case 'o'] Account for - lang_specific_extra_outfiles. - (main): Correctly clear all slots in outfiles for - lang_specific_extra_outfiles. Set input_file_number before - calling lang_specific_pre_link. - -Fri Sep 4 10:37:07 1998 Jim Wilson - - * loop.c (load_mems): Fix JUMP_LABEL field after for_each_rtx call. - -Fri Sep 4 02:01:05 1998 David S. Miller - - * config/sparc/sparc.c (output_double_int): In all V9 symbolic - cases, use xword. - (sparc_output_deferred_case_vectors): If no work to do, return. - Fix thinko in Sept 1 change. - -1998-09-03 SL Baur - - * Makefile.in: Add semicolon in BISON definition for portability. - -Thu Sep 3 13:34:41 1998 Toon Moene - - * config/nextstep.c (handle_pragma): Correct name of third - argument. - -Tue Sep 1 11:30:33 1998 Nick Clifton - - * config/m32r/m32r.md: Change (reg:CC 17) to (reg:SI 17). - * config/m32r/m32r.h: Make register 17 be fixed. - * config/m32r/m32r.c: Use SImode for cc operations. - -Thu Sep 3 18:17:34 1998 Benjamin Kosnik - - * invoke.texi (Warning Options): Add -Wnon-template-friend - documentation. - -Thu Sep 3 18:16:16 1998 Michael Meissner - - * rs6000.c (rs6000_override_options): Add -mcpu={401,e603e}. - -Thu Sep 3 18:05:16 1998 David Edelsohn - - * rs6000.md (movsf): Disable explicit secondary-reload-like - functionality if TARGET_POWERPC64. - (movdf): Remove TARGET_POWERPC64 explicit secondary-reload-like - functionality. - -Thu Sep 3 11:41:40 1998 Robert Lipe - - * fixinc.sco: Borrow code to wrap 'bool' typedefs from tinfo.h - and term.h from fixinc.wrap. - -Thu Sep 3 09:47:31 1998 Kaveh R. Ghazi - - * aclocal.m4 (GCC_HEADER_STRING): New macro to detect if it is - safe to include both string.h and strings.h together. - (GCC_NEED_DECLARATION): Test STRING_WITH_STRINGS when deciding - which headers to search for function declarations. Continue to - prefer string.h over strings.h when both are not acceptable. - - * acconfig.h (STRING_WITH_STRINGS): Add stub. - - * configure.in: Call GCC_HEADER_STRING. - - * system.h: Test STRING_WITH_STRINGS when deciding which headers - to include. Continue to prefer string.h over strings.h when both - are not acceptable. - -Wed Sep 2 23:56:29 1998 David S. Miller - - * config/sparc/sparc.c (output_double_int): If V9 and MEDLOW, do - not assume top 32-bits of symbolic addresses are zero if - flag_pic. - -Thu Sep 3 00:23:21 1998 Richard Henderson - - * ginclude/va-alpha.h: Protect entire second portion of the - file against double inclusion. - -Thu Sep 3 00:37:55 1998 Ovidiu Predescu - - Added support for the Boehm's garbage collector. - * configure.in: Handle --enable-objc-gc. - * configure: Rebuilt. - * Makefile.in (CHECK_TARGETS): Add check-objc. - (check-objc): New rule. - * objc/Make-lang.in: Build a different Objective-C library that - runs with the Boehm's collector. - * objc/encoding.c (objc_round_acc_size_for_types): New function. - * objc/encoding.c: Correctly compute the size of compound types in - the presence of bitfields. Skip the variable name of the type if - any. Added support for long long. - * objc/encoding.h (_C_GCINVISIBLE): New specifier. - (_F_GCINVISIBLE): New mask. - * objc/gc.c: New file. Compute the type memory mask associated with - a class based on the runtime information. - * objc/misc.c: Added the hooks that use the Boehm's collector - allocation functions. - * objc/objc-act.c (build_class_template): Generate a new class - member (gc_object_type) to hold the class' type memory mask. - (build_shared_structure_initializer): Initialize the new member to - NULL. - (encode_complete_bitfield): New function. Generate the new - encoding. - (encode_field_decl): Generate the new encoding only for the GNU - runtime. - * objc/objc-api.h (_C_LNG_LNG, _C_ULNG_LNG): New specifiers for the - long long types. - (class_get_gc_object_type): New function to mark a pointer instance - variable as a weak pointer. - * objc/objc-features.texi: New file. - * objc/objc.h (gc_object_type): New class member. - * objc/objects.c (class_create_instance): Create a typed memory - object when compiled with Boehm's collector support. - * objc/sendmsg.c (__objc_init_install_dtable): Call - __objc_send_initialize instead of setting the initialize flag. - (__objc_send_initialize): Call __objc_generate_gc_type_description - to generate the class type memory mask. Rewrite the code that - sends the +initialize so that it is called only once (bug report - and fix from Ronald Pijnacker ). - * testsuite/objc: New testsuite for Objective-C type encoding. - * testsuite/lib/objc-torture.exp: New file. - * testsuite/lib/objc.exp: New file. - -Wed Sep 2 14:47:36 1998 Jim Wilson - - * jump.c (jump_optimize): In if/then/else transformations, add - another call to modified_between_p for the jump insn. - -Wed Sep 2 14:16:49 1998 Jeffrey A Law (law@cygnus.com) - - * fix-header.c (symlink): Treat like readlink. - -Wed Sep 2 19:30:06 1998 J"orn Rennecke - - * dwarfout.c (fundamental_type_code): Encode 32 bit floats/doubles - as FT_float. - -Wed Sep 2 10:06:07 1998 Nick Clifton - - * config/nextstep.h: Update HANDLE_PRAGMA macro. - * config/h8300/h8300.h: Update HANDLE_PRAGMA macro. - * config/i960/i960.h: Update HANDLE_PRAGMA macro. - - * config/nextstep.c (handle_pragma): Take three arguments, as per - the new HANDLE_PRAGMA macro specification. - * config/h8300/h8300.c (handle_pragma): Take three arguments, as - per the new HANDLE_PRAGMA macro specification. - * config/i960/i960.c (process_pragma): Take three arguments, as - per the new HANDLE_PRAGMA macro specification. - -Wed Sep 2 09:25:29 1998 Nick Clifton - - * c-lex.c (check_newline): Call HANDLE_PRAGMA before - HANDLE_SYSV_PRAGMA if both are defined. Generate warning messages - if unknown pragmas are encountered. - (handle_sysv_pragma): Interpret return code from - handle_pragma_token (). Return success/failure indication rather - than next unprocessed character. - (pragma_getc): New function: retrieves characters from the - input stream. Defined when HANDLE_PRAGMA is enabled. - (pragma_ungetc): New function: replaces characters back into the - input stream. Defined when HANDLE_PRAGMA is enabled. - - * c-pragma.c (handle_pragma_token): Return success/failure status - of the parse. - - * c-pragma.h: Change prototype of handle_pragma_token(). - - * varasm.c (handle_pragma_weak): Only create this function if - HANDLE_PRAGMA_WEAK is defined. - - * c-common,c (decl_attributes): If defined call the expression - contained within the INSERT_ATTRIBUTES macro before adding - attributes to a decl. - - * tm.texi (HANDLE_PRAGMA): Document the new version of - HANDLE_PRAGMA, which takes three arguments. - (INSERT_ATTRIBUTES): Document this new macro. - - * LANGUAGES: Document the new version of HANDLE_PRAGMA and the - new INSERT_ATTRIBUTES macro. - -Wed Sep 2 02:03:23 1998 David S. Miller - - * config/sparc/sparc.md (movdf): Only generate special RTL for - LABEL_REFs when PIC. - (move_label_di): Remove. - (movdi_pic_label_ref, movdi_high_pic_label_ref, - movdi_lo_sum_pic_label_ref): New patterns for 64-bit label - references when PIC. - * config/sparc/sparc.h (ASM_OUTPUT_ADDR_VEC_ELT, - ASM_OUTPUT_ADDR_DIFF_ELT): Don't do anything special for MEDLOW, - output an .xword for all 64-bit cases. - -Tue Sep 1 15:55:17 1998 David S. Miller - - * config/sparc/sparc.c (finalize_pic): Don't output arbitrary - alignment, use FUNCTION_BOUNDARY instead. - (sparc_output_deferred_case_vectors): Likewise. - -Mon Aug 31 17:25:41 1998 David S. Miller - - * config/sparc/sparc.md (movsf_const_intreg): Kill warning. - (movtf_insn_sp64, movtf_no_e_insn_sp64): Reorder alternatives. - -Mon Aug 31 13:57:55 1998 Richard Henderson - - * alpha/va_list.h: New file. - * alpha/x-alpha (EXTRA_HEADERS): New. Add va_list.h. - -Mon Aug 31 14:55:02 1998 Jeffrey A Law (law@cygnus.com) - - * NEWS: Add SCO Openserver and Unixware 7 notes. - - * NEWS: Fix typos. - -Mon Aug 31 15:42:18 1998 Dave Brolley - - * varasm.c (compare_constant_1): Handle RANGE_EXPR. - (record_constant_1): Handle RANGE_EXPR. - -Mon Aug 31 10:54:03 1998 Richard Henderson - - * print-rtl.c (print_rtx): NOTE_INSN_LIVE has an rtx not a bitmap. - * haifa-sched.c (sched_analyze): Handle NOTE_INSN_RANGE_START - and NOTE_INSN_RANGE_END specially. - (reemit_notes): Likewise. - -Mon Aug 31 10:18:52 1998 Kaveh R. Ghazi - - * sparc.c (TMASK, UMASK): Use `(unsigned)1' not `1U'. - (ultrasparc_sched_init): Remove unneeded &. - -Mon Aug 31 10:47:16 1998 Andreas Schwab - - * config/m68k/m68k.h (TARGET_SWITCHES): Don't remove MASK_68040 - for m68020-60, to prevent the use of fintrz. - -Sun Aug 30 22:17:20 1998 Mark Mitchell - - * configure.in: If the native compiler is GCC use $(WARN_CFLAGS) - even in stage1. - * Makefile.in: Likewise. - * configure: Regenerated. - -Sun Aug 30 22:15:41 1998 H.J. Lu (hjl@gnu.org) - - * configure.in (gxx_include_dir): Changed to - '${prefix}/include/g++'-${libstdcxx_interface}. - * configure: Rebuilt. - -Sun Aug 30 20:19:43 1998 Hans-Peter Nilsson - - * expr.c (expand_expr): Change ">" to ">=" making MOVE_RATIO use - consistent. - * tm.texi (Costs): Say MOVE_RATIO is number of mem-mem move - *sequences* *below* which scalar moves will be used. - -Sun Aug 30 17:18:43 1998 Jeffrey A Law (law@cygnus.com) - - * collect2.c (mktemp): Delete unused declaration. - - * config/xm-netbsd.h: Remove unnecessary file. - * config/*/xm-netbsd.h: Do not include the generic xm-netbsd.h - file anymore, it is not needed. - -Sun Aug 30 16:05:45 1998 Mark Mitchell - - * convert.c (convert_to_integer): Issue an error on conversions to - incomplete types. - -Sun Aug 30 16:47:20 1998 Martin von Lvwis - - * Makefile.in: Add lang_tree_files and gencheck.h. - * configure.in: Generate them. - * gencheck.c: Include gencheck.h. - -Sat Aug 29 21:38:24 1998 David S. Miller - - * config/sparc/sparc.md (pic_lo_sum_di, pic_sethi_di): Rename to - movdi_lo_sum_pic and movdi_high_pic and make visible. - * config/sparc/sparc.c (legitimize_pic_address): For -fPIC, - emit these when Pmode is not SImode. - * config/sparc/linux64.h (SPARC_DEFAULT_CMODEL): Make CM_MEDLOW. - -Sat Aug 29 14:59:32 1998 Mumit Khan - - * i386/cygwin32.h (ASM_OUTPUT_SECTION_NAME): Don't emit - .linkonce directive after the first time. - -Sat Aug 29 12:39:56 1998 Jeffrey A Law (law@cygnus.com) - - * m68k.md (beq0_di): Generate correct (and more efficient) code when - the clobbered operand overlaps with an input. - (bne0_di): Similarly. - - * Makefile.in (INSTALL): Remove "--no-header" argument. - - * NEWS: Various updates. - -Fri Aug 28 19:00:44 1998 David S. Miller - - * config/sparc/sparc.c (arith_operand, const64_operand, - const64_high_operand, arith_double_4096_operand): Mark mode as - unused. - (create_simple_focus_bits): Remove unused arg highest_bit_set, all - callers changed. - (sparc_emit_set_const64): Remove unused variable i. - (sparc_splitdi_legitimate): Likewise for addr_part. - (ultra_code_from_mask): Likewise for mask. - (ultra_cmove_results_ready_p): Fixup entry modulo calc. and - reverse return values so it matches usage and comments. - (ultra_flush_pipeline): Likewise. - (ultra_fpmode_conflict_exists): Likewise, remove unused variable - this_type, and allow loads and stores of differing FP modes as - they do not create a conflict. - (ultra_find_type): Initialize fpmode to SFmode, fix - parenthesization thinkos in large conditional. - (ultrasparc_sched_init): Mark dump and sched_verbose as unused. - Init free_slot_mask after ultra_cur_hist is reset, not before. - (ultrasparc_rescan_pipeline_state): Remove unused variable ucode. - (ultrasparc_sched_reorder): Don't bzero current pipeline state, - use ultra_flush_pipeline instead, then re-init group pointer. - Fix statement with no effect. If no progress made in, and no - instructions scheduled at all, advance to new pipeline cycle else - we get into an endless loop. - (ultrasparc_adjust_cost): Remove previous arg. - * config/sparc/sparc.h (ADJUST_COST): Update to reflect that. - -Fri Aug 28 13:52:35 1998 Jim Wilson - - * sparc.md (DImode, DFmode, TFmode splits): Delete self_reference - code. Use reg_overlap_mentioned_p to detect when source and - destination overlap. - (negtf2_notv9+1): Use DFmode instead of SFmode in last two operands. - -1998-08-28 Brendan Kehoe - - * loop.c (check_dbra_loop): Pass COMPARISON_VALUE, not - COMPARISON_VAL, into invariant_p. - -Fri Aug 28 15:13:25 1998 J"orn Rennecke - - * regmove.c (regclass_compatible_p): New function. - (regmove_optimize): Use it. - - Use NREGS parameter instead of calling max_reg_num. - - (fixup_match_1): Don't use code = MINUS when later tieing with - a hard register is likely. - -Fri Aug 28 14:54:07 1998 J"orn Rennecke - - * loop.c (check_dbra_loop): Fix calculation of FINAL_VALUE when - COMPARISON_VAL was normalized. - -Thu Aug 27 20:10:46 1998 Jeffrey A Law (law@cygnus.com) - - * loop.c (check_dbra_loop): The loop ending comparison value - must be an invariant or we can not reverse the loop. - - * loop.c (scan_loop): Count down from max_reg_num - 1 to - FIRST_PSEUDO_REGISTER to avoid calling max_reg_num each iteration - of the loop. - (load_mems_and_recount_loop_regs_set): Likewise. - - * i386.c (print_operand): Remove obsolete 'c' docs. - -Wed Aug 26 17:13:37 1998 Tom Tromey - - * gthr.h: Document __GTHREAD_MUTEX_INIT_FUNCTION. - * frame.c (init_object_mutex): New function. - (init_object_mutex_once): Likewise. - (find_fde): Call it. - (__register_frame_info): Likewise. - (__register_frame_info_table): Likewise. - (__deregister_frame_info): Likewise. - -Thu Aug 27 15:14:18 1998 Jeffrey A Law (law@cygnus.com) - - * haifa-sched.c (sched_analyze_insn): Fix thinko in last change. - -Thu Aug 27 16:34:51 1998 J"orn Rennecke - - * loop.c (check_dbra_loop): Enable code for reversal - of some loops without a known constant loop end. - -Wed Aug 26 18:38:15 1998 Richard Henderson - - * haifa-sched.c (last_clock_var): New. - (schedule_block): Initialize it. - (schedule_insn): Use it to fill insn modes with issue information. - - * alpha.c (alpha_handle_trap_shadows): Remove do-nothing exit. - Tag trapb and next insn with TImode. - (alphaev5_insn_pipe, alphaev5_next_group, alphaev5_align_insns): New. - (alpha_reorg): Add conditional for alpha_handle_trap_shadows. - Invoke alphaev5_align_insns as appropriate. - * alpha.h (LABEL_ALIGN_AFTER_BARRIER): Was ALIGN_LABEL_AFTER_BARRIER. - (MD_SCHED_VARIABLE_ISSUE): New. - * alpha.md (attr type): Add multi. - (define_asm_attributes): New. - (prologue_stack_probe_loop, builtin_setjmp_receiver): Set type multi. - (arg_home): Likewise. - (fnop, unop, realign): New. - -Wed Aug 26 15:55:41 1998 Jim Wilson - - * iris5.h (PREFERRED_DEBUGGING_TYPE): Undef. - * iris5gas.h (PREFERRED_DEBUGGING_TYPE): Define. - - * configure.in (powerpc-ibm-aix4.[12]*): Change from 4.[12].*. - (rs6000-ibm-aix4.[12]*): Likewise. - * configure: Regenerate. - -Wed Aug 26 09:30:59 1998 Nick Clifton - - * config/arm/thumb.c (thumb_exit): Do not move a4 into lr if it - already contains the return address. - -Wed Aug 26 12:57:09 1998 Jeffrey A Law (law@cygnus.com) - - * calls.c (expand_call): Use bitfield instructions to extract/deposit - word sized hunks when loading unaligned args into registers. - - * haifa-sched.c (sched_analyze_insn): Only create scheduling - barriers for LOOP, EH and SETJMP notes on the loop_notes list. - - * mn10300.h (RTX_COSTS): Handle UDIV and UMOD too. - -Wed Aug 26 16:35:37 1998 J"orn Rennecke - - * loop.c (check_dbra_loop): Add some code that would allow reversal - of some loops without a known constant loop end if it were enabled. - -Wed Aug 26 11:08:44 1998 Gavin Romig-Koch - - * mips.md (lshrsi3_internal2+2): Fix type-o. - -Wed Aug 26 10:53:03 1998 Kaveh R. Ghazi - - * system.h: Include stdarg.h/varargs.h, make sure they are ordered - correctly with regards to stdio.h. - - * calls.c: Remove stdarg.h/varargs.h. - * cccp.c: Likewise. - * cexp.y: Likewise. - * combine.c: Likewise. - * cpperror.c: Likewise. - * cpplib.c: Likewise. - * cpplib.h: Likewise. - * doprint.c: Likewise. - * emit-rtl.c: Likewise. - * final.c: Likewise. - * fix-header.c: Likewise. - * gcc.c: Likewise. - * genattr.c: Likewise. - * 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. - * mips-tfile.c: Likewise. - * prefix.c: Likewise. - * protoize.c: Likewise. - * regmove.c: Likewise. - * toplev.c: Likewise. - * tree.c: Likewise. - -Wed Aug 26 05:09:27 1998 Jakub Jelinek - - * config/sparc/sparc.c (sparc_override_options): If not - TARGET_FPU, turn off TARGET_VIS. - * config/sparc/sparc.h (TARGET_SWITCHES): Add no-vis. - (LEGITIMATE_CONSTANT_P): Allow SF/DF mode zero when TARGET_VIS. - * config/sparc/sparc.md (movsi_insn): Use fzeros not fzero. - (movdi_insn_sp64): Add VIS fzero alternative. - (clear_sf, clear_df): New VIS patterns. - (movsf, movdf expanders): Allow fp_zero_operand flat out when - TARGET_VIS. - (one_cmpldi2_sp64): Provide new fnot1 VIS alternative. - -Tue Aug 25 10:57:41 1998 Mark Mitchell - - * loop.c (n_times_set, n_times_used, may_not_optimize, - reg_single_usage): Convert to varrays. All uses changed. - (insert_loop_mem): Return a value. - (scan_loop): Tweak AVOID_CC_MODE_COPIES code. - (load_mems_and_recount_loop_regs_set): Likewise. Grow the arrays, if - necessary. - -Tue Aug 25 23:57:12 1998 Jeffrey A Law (law@cygnus.com) - - * From Alexandre: - * configure.in: Do not set thread_file to "irix" since no such - support exists yet. - - * sparc.md (float abs/neg splits): Check reload_completed before - calling alter_subreg. - -Tue Aug 25 19:17:59 1998 David S. Miller - - * config/sparc/sparc.c (sparc_absnegfloat_split_legitimate): New - function. - * config/sparc/sparc.h: Declare it. - * config/sparc/sparc.md (float abs/neg splits): Use it. - (all other splits): Handle SUBREGs properly where necessary. - (unnamed (1< - - * config/v850/v850.c (movsi_source_operand): Treat CONSTANT_P_RTX - as an ordinary operand. - -Tue Aug 25 12:54:57 1998 Jason Merrill - - * tree.c (valid_machine_attribute): Don't apply attributes to both - decl and type. - -Tue Aug 25 12:23:20 1998 Richard Henderson - - * reload.c (operands_match_p): Handle rtvecs. - - * i386.c (legitimate_pic_address_disp_p): New. - (legitimate_address_p): Use it. - (legitimize_pic_address): Use unspecs to represent @GOT and @GOTOFF. - Handle constant pool symbols just like statics. - (emit_pic_move): Use Pmode not SImode for clarity. - (output_pic_addr_const) [SYMBOL_REF]: Remove @GOT and @GOTOFF hacks. - [UNSPEC]: New, handling what we killed above. - [PLUS]: Detect and abort on invalid symbol arithmetic. - * i386.h (CONSTANT_ADDRESS_P): Remove HIGH. - -Tue Aug 25 12:02:23 1998 Mark Mitchell - - * alias.c: Include output.h. - (DIFFERENT_ALIAS_SETS_P): Don't treat alias sets as - different if we're in a varargs function. - * Makefile.in (alias.o): Depend on output.h - -Tue Aug 25 19:20:12 1998 J"orn Rennecke - - * sh.h (GIV_SORT_CRITERION): Delete. - -Tue Aug 25 13:19:46 1998 Dave Brolley - - * regclass.c (regclass): Use xmalloc/free instead of alloca. - * stupid.c (stupid_life_analysis): Likewise. - * reload1.c (reload): Likewise. - -Tue Aug 25 05:48:18 1998 Jakub Jelinek - - * config/sparc/sparc.c (arith_4096_operand, arith_add_operand, - arith_double_4096_operand, arith_double_add_operand): New - predicates. - * config/sparc/sparc.h (PREDICATE_CODES): Add them, declare them. - * config/sparc/sparc.md (adddi3, addsi3, subdi3, subsi3): Use - them to transform add/sub 4096 into add/sub -4096. - -Mon Aug 24 23:31:03 1998 David S. Miller - - * loop.c (scan_loop): Allocate some slop to handle pseudos - generated by move_movables. - (load_mems_and_recount_loop_regs_set): Honor AVOID_CC_MODE_COPIES - here too. - -Mon Aug 24 19:45:40 1998 Jim Wilson - - * tree.def (DECL_RESULT): Correct documentation. - -Tue Aug 25 01:15:27 1998 J"orn Rennecke - - * reload1.c (reload_reg_free_before_p): New argument EQUIV; Changed - all callers. Abort for RELOAD_FOR_INSN. RELOAD_FOR_OUTADDR_ADDR: - conflicts will all RELOAD_FOR_OUTPUT reloads. - - * reload1.c (reload_cse_regs_1): When deleting a no-op move that - loads the function result, substitute with a USE. - -Mon Aug 24 15:20:19 1998 David Edelsohn - - * rs6000.h (GO_IF_LEGITIMATE_ADDRESS): Use TARGET_POWERPC64 - when testing LEGITIMATE_INDEXED_ADDRESS_P DFmode and DImode. - (LEGITIMIZE_ADDRESS): Use TARGET_POWERPC64 for INDEXED fixup. - * rs6000.c (print_operand, case 'L'): Add UNITS_PER_WORD, not 4. - (print_operand, cases 'O' and 'T'): Fix typos in lossage strings. - * rs6000.md (fix_truncdfsi2_store): Remove %w from non-CONST_INT - operand. - (movdf_softfloat32, movdf_hardfloat64, movdf_softfloat64): Change - 'o' to 'm' for GPR variant constraints. - -Mon Aug 24 10:25:46 1998 Jeffrey A Law (law@cygnus.com) - - * loop.c (scan_loop): Honor AVOID_CC_MODE_COPIES. - - * h8300.h (STRIP_NAME_ENCODING): Fix typo. - - * sparc.md (TFmode splits): Use reg_overlap_mentioned_p to detect - when the source and destination overlap. - - * stmt.c (emit_case_nodes): Change rtx_function to rtx_fn to avoid - clash with global type. - -Mon Aug 24 00:53:53 1998 Jason Merrill - - * fixinc.irix: Add curses.h handling from fixinc.wrap. - - * c-common.c (combine_strings): Also set TREE_READONLY. - Change warn_write_strings to flag_const_strings. - * c-decl.c, c-tree.h: Likewise. - -Sun Aug 23 18:39:11 1998 David S. Miller - - * config/sparc/sparc.c (sparc_emit_set_const32): If outputting a - CONST_INT, not a symbolic reference, don't use a HIGH/LO_SUM - sequence, use SET/IOR instead so CSE can see it. - * config/sparc/sparc.md (movhi_const64_special, - movsi_const64_special): New patterns necessitated by that change. - (movhi_high): Remove. - (movhi_lo_sum): Change to match an IOR. - (movdf_insn_sp32): Test TARGET_V9 not TARGET_ARCH64. - (movdf_insn_v9only): New pattern for when V9 but not ARCH64. - (movdf_insn_sp64): Test both TARGET_V9 and TARGET_ARCH64. - (movdf splits): Allow when not V9 or when not ARCH64 and integer - registers are involved. - (snesi_zero_extend split): Remove reload_completed test. - (unnamed plus and minus zero_extend sidi splits): Add it. - -Sun Aug 23 11:56:08 1998 Mark Mitchell - - * extend.texi: Remove description of extension to explicit - instantiation that is now endorsed by standard C++. - -Sun Aug 23 09:39:09 1998 David S. Miller - - * config/arc/arc.c (arc_initialize_pic): Remove. - * config/arc/arc.h (INITIALIZE_PIC): Similarly, this routine does - nothing on any platform and is invoked by no-one, it does not even - appear in the documentation. - * config/sparc/sparc.h (INITIALIZE_PIC): Likewise. - * config/sparc/sparc.c (initialize_pic): Likewise. - (find_addr_reg): Remove this as well, no longer referenced after - my rewrite. - -Sun Aug 23 00:17:14 1998 Jeffrey A Law (law@cygnus.com) - - * recog.c (validate_replace_rtx_group): New function. - * recog.h (validate_replace_rtx_group): Declare it. - * regmove.c (optimize_reg_copy_3): If any substitution fails, then undo - the entire group of substitutions. - -Sat Aug 22 23:31:00 1998 Klaus-Georg Adams (Klaus-Georg.Adams@chemie.uni-karlsruhe.de) - - * loop.c (load_mems): Fix initializers. - -Fri Aug 21 23:07:46 1998 David S. Miller - - * config/sparc/sparc.md (TFmode splits): Handle destination - registers being referenced in the address correctly. - - * expmed.c (make_tree) [CONST_INT]: Sign extend even if - TREE_UNSIGNED, when bitsize of type's mode is larger than - HOST_BITS_PER_WIDE_INT. - -Fri Aug 21 19:31:31 1998 Alexandre Petit-Bianco - - * tree.def (LABELED_BLOCK_EXPR, EXIT_BLOCK_EXPR): New tree nodes. - * tree.h (LABELED_BLOCK_LABEL, LABELED_BLOCK_BODY, - EXIT_BLOCK_LABELED_BLOCK, EXIT_BLOCK_RETURN, LOOP_EXPR_BODY): New - macros. - * expr.c (expand_expr): Handle LABELED_BLOCK_EXPR and - EXIT_BLOCK_EXPR. - -Thu Aug 20 19:43:44 1998 Jeffrey A Law (law@cygnus.com) - - * h8300.c (h8300_encode_label): Use '&' for tiny data items. - * h8300.h (TINY_DATA_NAME_P): Likewise. - (STRIP_NAME_ENCODING): Handle '&'. - - * mn10200.h (REG_OK_FOR_INDEX_P): Do not check the mode of the - register (it could be accessed via an outer SUBREG). - (REG_OK_FOR_BASE_P): Likewise. - (GO_IF_LEGITIMATE_ADDRESS): Consistently use REGNO_OK_FOR_BASE_P. - - * remove.c (optimize_reg_copy_3): Abort instead of silently generating - bogus rtl. - - * jump.c (rtx_renumbered_equal_p): Do not consider PLUS commutative. - -Thu Aug 20 17:35:20 1998 David S. Miller - - * config/sparc/sparc.md (movtf_insn_sp32): All memory operands - must be offsettable so the splits can be made. - -Thu Aug 20 13:56:53 1998 Michael Meissner - - * config/i386/winnt.c: Include system.h, not stdio.h to get - sys/param.h pulled in before rtl.h in case the system defines MIN - and MAX. - -Thu Aug 20 13:44:20 1998 David Edelsohn - - * rs6000.md (movqi, movhi): Add CONSTANT_P_RTX. - -Thu Aug 20 13:15:11 1998 Dave Brolley - - * stor-layout.c (layout_type): Compute TYPE_SIZE_UNIT correctly for - arrays of bits. - * cpplib.c (cpp_define): Handle macros with parameters. - -Wed Aug 19 21:33:19 1998 David Edelsohn - - * rs6000.c (rs6000_output_load_toc_table): Use ld for 64-bit. - (output_toc): Use single TOC slot or llong minimal-toc for DFmode - and DImode 64-bit. Use llong for minimal-toc SFmode and - SYMBOL_REF / LABEL_REF 64-bit. - (output_function_profiler): Use llong for profiler label and ld to - load 64-bit label address. - -Wed Aug 19 17:52:27 1998 Nick Clifton (nickc@cygnus.com) - - * config/arm/thumb.md (extendqisi2_insn): Cope with REG + - OFFSET addressing. - -Wed Aug 19 14:13:31 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Wed Aug 19 13:10:30 1998 Jeff Law (law@cygnus.com) - - * version.c: Bump for snapshot. - -Wed Aug 19 13:06:47 1998 Jason Merrill - - * collect2.c (extract_init_priority): Use atoi instead of strtoul. - -Wed Aug 19 13:51:35 1998 Hans-Peter Nilsson - - * tm.texi (Misc): Fix typo "teh". - - * tm.texi (PIC): Fix typo "PPIC". - - * tm.texi (Caller Saves): Say that DEFAULT_CALLER_SAVES has no - effect when -O2 and higher. - * invoke.texi (Optimize Options): Likewise for -fcaller-saves. - -1998-08-19 Michael Hayes - - * regclass.c: Changed register set documentation to be consistent - with GCC behavior. - - * final.c (final_start_function): Removed redundant test for - call_fixed_regs. - -Wed Aug 19 13:28:41 1998 Mark Mitchell - - * rtl.h (rtx_function): New type. - (for_each_rtx): New function. - * rtlanal.c (for_each_rtx): Define it. - - * recog.c (change_t): New type. - (change_objects, change_old_codes, change_locs, change_olds): - Replace with ... - (changes): New variable. - (validate_change): Dynamically allocate room for more changes, if - necessary. Uses changes array instead of change_objects, etc. - (apply_change_group): Use changes array instead of - change_objects, etc. - - * loop.c (loop_mem_info): New type. - (loop_mems): New variable. - (loop_mems_idx): Likewise. - (looop_mems_allocated): Likewise. - (scan_loop): Remove nregs parameter. - (next_insn_in_loop): New function. - (load_mems_and_recount_loop_regs_set): Likewise. - (load_mems): Likewise. - (insert_loop_mem): Likewise. - (replace_loop_mem): Likewise. - (replace_label): Likewise. - (INSN_IN_RANGE_P): New macro. - (loop_optimize): Don't pass max_reg_num() to scan_loop. - (scan_loop): Remove nregs parameter, compute it after any new - registers are created by load_mems. Use INSN_IN_RANGE_P and - next_insn_in_loop rather than expanding them inline. Call - load_mems to load memory into pseudos, if appropriate. - (prescan_loop): Figure out whether or not there are jumps from the - loop to targets other than the label immediately following the - loop. Call insert_loop_mem to notice all the MEMs used in the - loop, if it could be safe to pull MEMs into REGs for the duration - of the loop. - (strength_reduce): Use next_insn_in_loop. Tweak comments. - -Wed Aug 19 08:29:44 1998 Richard Earnshaw (rearnsha@arm.com) - - * arm.c (arm_override_options): Remove lie about ignoring PIC flag. - -Wed Aug 19 07:08:15 1998 David S. Miller - - * config/sparc/sparc.c (finalize_pic): Check for the correct - nonlocal_goto_receiver UNSPEC number. - * config/sparc/sparc.md (nonlocal_goto_receiver): Add comment - making note of this dependency existing in sparc.c. - (negtf2_notv9 split): Give NEG SFmode. - (negsf2): Fix insn output string. - -Tue Aug 18 12:40:27 1998 Richard Henderson - - * c-common.c (decl_attributes): Issue an error if the argument - to alias is not a string. - -Tue Aug 18 10:33:30 1998 Jeffrey A Law (law@cygnus.com) - - * haifa-sched.c (sched_analyze): Put all JUMP_INSNs on the last - pending memory flush list. - - * combine.c (can_combine_p): Allow combining insns with REG_RETVAL - notes. - (try_combine): Allow combining insns with REG_LIBCALL notes. - - * expr.c (emit_block_move): Do not call memcpy as a libcall - instead build up a CALL_EXPR and call it like any other - function. - (clear_storage): Similarly for memset. - - * regmove.c (fixup_match_2): Do not call reg_overlap_mentioned_p - on notes. - - * Makefile.in (cplus-dem.o): Provide explicit rules for building - cplus-dem.o. - - * regmove.c (optimize_reg_copy_1): Update REG_N_CALLS_CROSSED - and REG_LIVE_LENGTH as successful substitutions are made. - -Tue Aug 18 07:15:27 1998 Kaveh R. Ghazi - - * config/sparc/sparc.c (ultra_find_type): Add empty semicolon - statement after end of loop label. - -Tue Aug 18 07:13:27 1998 David S. Miller - - * config/sparc/sparc.c (ultra_types_avail): New variable. - (ultra_build_types_avail): New function to record mask of insn - types in ready list at this cycle. - (ultrasparc_sched_reorder): Call it. - (ultra_find_type): Use it to quicken the search. Also simplif - dependency check, don't use rtx_equal_p because we know exactly - what we are looking for. - -Tue Aug 18 03:20:53 1998 Richard Earnshaw (rearnsha@arm.com) - - * arm.h (SECONDARY_INPUT_RELOAD_CLASS): Return NO_REGS if compiling - for architecture v4. - -Mon Aug 17 21:26:38 1998 David S. Miller - - * config/sparc/sparc.md (sltu, sgeu): Don't FAIL, call - gen_compare_reg. - (movsf_const_intreg, movsf_const_high, movsf_const_lo, - movdf_const_intreg and helper splits): New patterns to move float - constants into integer registers. - (negtf2, negdf2, abstf2, absdf2): Rework using new patterns and - splits. - -Mon Aug 17 11:46:19 1998 Jeffrey A Law (law@cygnus.com) - - * From Graham - * tree.c (build_index_type): Copy TYPE_SIZE_UNIT from sizetype - to itype. - * c-decl.c (finish_enum): Copy TYPE_SIZ_UNIT from enumtype to tem. - - * rs6000.c (secondary_reload_class): For TARGET_ELF, indicate that - a BASE_REGS register is needed as an intermediate when copying - a symbolic value into any register class other than BASE_REGS. - - * expr.c (move_by_pieces): No longer static. Remove prototype. - * rtl.h (move_by_pieces): Add extern prototype. - * mips.c (expand_block_move): Handle aligned straight line copy by - calling move_by_pieces. - - * expr.c (expand_expr): Allow assignments from TImode PARM_DECLs - and VAR_DECLs. - -Mon Aug 17 10:28:52 1998 Mark Mitchell - - * stmt.c (expand_end_loop): Tidy. Allow unconditional - jumps out of the loop to be treated as part of the exit test. - -Mon Aug 17 10:06:11 1998 Kaveh R. Ghazi - Jeff Law - - * Makefile.in (cplus-dep.o): Use cplus-dem.c from libiberty. - * cplus-dem.c: Delete. - - * Makefile.in (fold-const.o): Depend on $(RTL_H). - - * fold-const.c: Include rtl.h to get the prototype for - `set_identifier_local_value'. - - * loop.c (express_from_1): Remove unused variable `tmp'. - (combine_givs): Cast the first argument of bzero to char *. - - * toplev.c (display_help): Remove unused variable `looking_for_start'. - - * c-decl.c (init_decl_processing): Remove unneeded &. - - * alpha.h (alpha_initialize_trampoline): Provide prototype. - - * except.c (set_exception_lang_code, set_exception_version_code): - Change parameter from `short' to `int' to avoid using a gcc - extension. - - * except.h (set_exception_lang_code, set_exception_version_code): - Likewise for prototypes. - - * flow.c (count_reg_references): Remove unused variables `regno' - and `i'. - - * gcse.c (hash_scan_insn): Declare parameter `in_libcall_block'. - - * prefix.c (translate_name): Cast the result of `alloca'. - - * varray.h (VARRAY_FREE): Reimplement as a `do-while(0)' statement. - -Mon Aug 17 09:23:42 1998 Andreas Schwab - - * config/m68k/m68k.c: Include "system.h" instead of . - Include "toplev.h". - (valid_dbcc_comparison_p): Mark mode argument as unused. - (symbolic_operand): Likewise. - (legitimize_pic_address): Likewise. - (const_uint32_operand): Likewise. - (const_sint32_operand): Likewise. - * sched.c [!INSN_SCHEDULING]: Define only dummy function - schedule_insns and comment out rest of file. - - * m68k.c (output_move_simode_const): Use subl to move a zero into an - address register. - (output_move_[hq]imode): Likewise. - -Mon Aug 17 09:15:47 1998 Jeffrey A Law (law@cygnus.com) - - * toplev.c (main): Enable -fstrict-aliasing for -O2 and above. - * invoke.texi: Corresponding changes. - -Mon Aug 17 02:03:55 1998 Richard Henderson - - * regclass.c (allocate_reg_info): Respect MIN when clearing data. - -Sun Aug 16 17:37:06 1998 David S. Miller - - * config/sparc/sparc.c (ultra_code_from_mask, - ultra_cmove_results_ready_p, ultra_fpmode_conflict_exists, - ultra_find_type, ultra_schedule_insn, ultra_flush_pipeline, - ultrasparc_sched_init, ultrasparc_variable_issue, - ultra_rescan_pipeline_state, ultrasparc_sched_reorder): New - functions to describe UltraSPARC pipeline exactly to Haifa. - (ultrasparc_adjust_cost): Indicate IMUL type insns have zero cost, - as there is nothing the scheduler can do about it. Indicate that - REG_DEP_OUTPUT's collide. Fixup formatting. - * config/sparc/sparc.h (RTX_COSTS): Fixup integer multiply and - divide costs on Ultra for DImode. - (MD_SCHED_INIT, MD_SCHED_REORDER, MD_SCHED_VARIABLE_ISSUE): - Define. - * config/sparc/sparc.md (ieu_unnamed function unit): Rename to - ieuN and add call_no_delay_slot to type list. - (cti function unit): New unit for branches on UltraSPARC. - (subx/addx insns): Set type to misc. - (sidi zero/sign extension insns on arch64): Set type to shift. - (sign_extendhidi2_insn): Set type to sload. - -Sun Aug 16 13:52:00 1998 David Edelsohn - - * rs6000.c (rs6000_stack_info): Use if == 0 for sizes. - (output_epilog): Use if != 0 for offset. - (rs6000_fatal_bad_address): Prepare for Intl. - * rs6000.h (rs6000_fatal_bad_address): Declare. - * rs6000.md (movsfcc, movdfcc): Use else if. - (elf_high): Use {liu|lis}. - (elf_low): Use {cal|la}. Remove %a template from old mnemonics. - (movsi): Use rs6000_fatal_bad_address. - -Sun Aug 16 01:53:21 1998 Richard Henderson - - * reload.c (find_equiv_reg): Reject equivalences separated - by a volatile instruction. - -Sun Aug 16 00:21:44 1998 Franz Sirl - - * rs6000/linux.h (CPP_OS_DEFAULT_SPEC): Define. - -Sat Aug 15 20:51:35 1998 Richard Henderson - - * alpha.md (movsicc): Fix mode mismatch. - -Sat Aug 15 20:22:33 1998 H.J. Lu (hjl@gnu.org) - - * config/alpha/alpha.h (ASM_OUTPUT_MI_THUNK): Handle aggregated - return type. - * config/alpha/win-nt.h (ASM_OUTPUT_MI_THUNK): Likewise. - -Sat Aug 15 08:39:49 1998 David S. Miller - - * config/sparc/sparc.md (movsi_lo_sum_pic_label_reg): Remove - write-only modifier from operand 1 constraint. - -Sat Aug 15 06:28:19 1998 David S. Miller - - * config/sparc/sparc.c (sparc_emit_set_const64_quick1): If - emitting a XOR of -1 at the end, emit a NOT instead for combine's - sake. - (sparc_emit_set_const64): Likewise, also when computing trailing - bits do not negate low_bits and make fast_int an int. - -Fri Aug 14 21:07:03 1998 Jeffrey A Law (law@cygnus.com) - - * loop.c (add_label_notes): Do not ignore references to labels - before dispatch tables. Mirrors Apr 8 change to mark_jump_label. - * gcse.c (add_label_notes): Similarly. - - * pa.h (ASM_OUTPUT_MI_THUNK): Strip name encoding. - - * m68k.md (adddi_dilshr32): One of the operands must be a register. - (adddi_dishl32): Similarly. - -Fri Aug 14 14:12:59 1998 Jason Merrill - - * i386.h (MODES_TIEABLE_P): Reorganize to shut up warnings. - * alias.c (memrefs_conflict_p): Add braces to shut up warnings. - * cse.c (cse_basic_block): Add parens to shut up warnings. - -Fri Aug 14 12:58:21 1998 David S. Miller - - * config/sparc/sparc.c (sparc_emit_set_const64_quick2, - sparc_emit_set_const64_longway, const64_is_2insns, - create_simple_focus_bits, sparc_emit_set_const64): Fix more bugs - in 64-bit constant formation. - * config/sparc/sparc.md (snesi_zero_extend split): Generate - rtl for addx not subx. - (define_insn movdi_const64_special): Make available even when - HOST_BITS_PER_WIDE_INT is not 64. - (movdi_lo_sum_sp64_cint, movdi_high_sp64_cint): Remove. - (losum_di_medlow, sethm, setlo): Make op2 symbolic_operand. - (cmp_siqi_trunc_set, cmp_diqi_trunc_set): Encapsulate both - instances of operand 1 inside a QI subreg. - (xordi3_sp64_dbl): Remove '%' constraint for op1. - (one_cmpldi2_sp64): Fix output string. - (one_cmplsi2_not_liveg0): Rewrite to remove unneeded extra - alternative case. - (unnamed arch64 ashift DI): Truncate shift count if greater than - 63, not 31. - -Fri Aug 14 21:52:53 1998 J"orn Rennecke - - * expr.c (store_expr): Don't optimize away load-store pair - when either source or destination have a side effect. - -Fri Aug 14 16:50:10 1998 John Carr - - * genrecog.c (add_to_sequence): Fatal error if the modes of the - operands of SET are incompatible. - - * alpha.md: Fix max and min patterns so modes of SET operands match. - -Fri Aug 14 12:22:55 1998 Ian Lance Taylor - - * configure.in: Avoid [[ by using test and changequote. - * configure: Rebuild. - -Fri Aug 14 01:22:31 1998 David S. Miller - - * rtl.def (CONSTANT_P_RTX): Fix typo in string name. - - * config/sparc/sparc.md (seqdi_special_trunc, snedi_special_trunc, - seqsi_special_extend, snesi_special_extend, snesi_zero_extend and - split, snedi_zero_trunc and split, seqsi_zero_extend and split, - seqdi_zero_trunc and split, pic_lo_sum_di, pic_sethi_di, - movdi_cc_sp64_trunc, movdi_cc_reg_sp64_trunc, addx_extend_sp32 and - split, addx_extend_sp64, subx_extend_sp64, subx_extend and split): - Fix mismatching modes in SET operands. - (conditional move patterns): Fix formatting. - (unnamed subx arch64 pattern): Remove duplicate insn. - -Fri Aug 14 00:34:34 1998 David S. Miller - - * config/sparc/sparc.c (const64_operand, const64_high_operand): - Get it right when HOST_BITS_PER_WIDE_INT is not 64. - (input_operand): Fixup test for what we accept for constant - integers. - (sparc_emit_set_const32, sparc_emit_set_symbolic_const64): Give - set VOIDmode. - (safe_constDI): Remove. - (sparc_emit_set_safe_HIGH64, gen_safe_SET64, gen_safe_OR64, - gen_safe_XOR64): New functions. - (sparc_emit_set_const64_quick1, sparc_emit_set_const64_quick2, - sparc_emit_set_const64_longway, sparc_emit_set_const64): Use - them. - * config/sparc/sparc.md (define_insn xordi3_sp64_dbl): Only make - available when HOST_BITS_PER_WIDE_INT is not 64. - (define_insn movdi_sp64_dbl, movdi_const64_special): Likewise and - move before movdi_insn_sp64 pattern. - (define_insn movdi_lo_sum_sp64_dbl, movdi_high_sp64_dbl): Remove. - (define_insn sethi_di_medlow, seth44, setm44, sethh): Use - symbolic_operand as predicate for second operand. - (DImode minus split on arch32, negsi2 expander, one_cmplsi2 - expander): Give set VOIDmode. - -Fri Aug 14 01:45:06 1998 Mumit Khan - - * i386/cygwin32 (DEFAULT_PCC_STRUCT_RETURN): Define. - -Fri Aug 14 01:40:21 1998 Geoffrey Keating - - * rs6000/linux.h (LINK_SPEC): Pass -G args to the linker. - -Fri Aug 14 01:23:23 1998 Richard Earnshaw (rearnsha@arm.com) - - * arm/netbsd.h (TARGET_DEFAULT): Default includes software floating - point. - (CPP_FLOAT_DEFAULT_SPEC): Re-define accordingly. - -Fri Aug 14 01:19:08 1998 Robert Lipe - - * install.texi: Various SCO OpenServer tweaks. - -Thu Aug 13 20:14:40 1998 Jim Wilson - - * reload1.c (eliminate_regs_in_insn): Handle another case when - eliminating the frame pointer to the hard frame pointer. Add - missing ep->to_rtx check to one existing case. - - * mips/mips.md (movhi_internal2+2): Fix typo mem:SI -> mem:HI. - -Thu Aug 13 17:08:11 1998 Jason Merrill - - * tree.h: De-conditionalize init_priority code. - - * mips.h (NM_FLAGS): Change from -Bp to -Bn. - * collect2.c (NM_FLAGS): Change from -p to -n. - - * configure.in: Turn on collect2 for mipstx39-elf. - Handle use_collect2=no properly. - - * c-common.c: De-conditionalize init_priority code. - * collect2.c (extract_init_priority, sort_ids): New fns. - (main): Call sort_ids. - Move sequence_number to file scope. - - * configure.in: Handle --enable-init-priority. - * c-common.c (attrs): Add A_INIT_PRIORITY. - (init_attributes, decl_attributes): Likewise. - * tree.h (DEFAULT_INIT_PRIORITY, MAX_INIT_PRIORITY): New macros. - * tree.c (get_file_function_name_long): Split out... - (get_file_function_name): ...from here. - -Thu Aug 13 16:09:53 1998 Martin von Loewis - - * expr.c (safe_from_p): Change code to ERROR_MARK only when not - accessing nodes. - -Thu Aug 13 15:24:48 1998 Jason Merrill - - * toplev.c (display_help): Add braces to shut up warnings. - * tree.c (simple_cst_equal): Likewise. - - * fold-const.c (non_lvalue): Don't deal with null pointer - constants here. - (fold, case COMPOUND_EXPR): Wrap a constant 0 in a NOP_EXPR. - - * c-typeck.c (initializer_constant_valid_p): Allow conversion of 0 - of any size to a pointer. - -Thu Aug 13 12:53:13 1998 Jim Wilson - - * i386/winnt.c (i386_pe_asm_file_end): Check TREE_SYMBOL_REFERENCED. - -Wed Aug 12 17:25:18 1998 Jeffrey A Law (law@cygnus.com) - - * mn10300.c (REG_SAVE_BYTES): Only reserve space for registers - which will be saved. - * mn10300.md (prologue insn): Only save registers which need saving. - (epilogue insn): Similarly. - - * mn10300.c, mn10300.h, mn10300.md: Remove "global zero register" - optimizations. - -Wed Aug 12 12:39:16 1998 Gavin Romig-Koch - - * mips/mips.h (ENCODE_SECTION_INFO): Set SYMBOL_REF_FLAG for - VAR_DECL's in gp addressable sections. - -Tue Aug 11 23:02:31 1998 John Carr - - * sparc.c: Change return to ; return; in functions - returning void. - * sparc.md: Add empty semicolon statement after final label in - move expanders. - -Tue Aug 11 22:42:01 1998 David S. Miller - - * config/sparc/sparc.md (define_insn addx_extend): Rename to - addx_extend_sp64, only allow when TARGET_ARCH64. - (define_insn addx_extend_sp32 and split): Version that works when - not TARGET_ARCH64. - (define_insn subx_extend): Likewise. - (define_split adddi3 and subdi3 with zero extension): Fixup and - correct bugs when not TARGET_ARCH64. - -Tue Aug 11 16:04:34 1998 John Carr - - * except.c (set_exception_lang_code, set_exception_version_code): - Use prototype-style definition if __STDC__, to match declaration - in except.h. - - * genemit.c: Change FAIL and DONE macros not to use loops. - -Tue Aug 11 12:27:03 1998 Jim Wilson - - * dwarf2out.c (ASM_OUTPUT_DWARF_ADDR_CONST): Use - ASM_OUTPUT_DWARF2_ADDR_CONST if defined. - - * mips/mips.md (reload_outsi): Use M16_REG_P when TARGET_MIPS16. - -Tue Aug 11 18:12:53 1998 Dave Love - - * README.g77: Update from Craig. - -Tue Aug 11 04:46:01 1998 David S. Miller - - * config/sparc/sparc.c (sparc_emit_set_const32): INTVAL is of - type HOST_WIDE_INT. - (safe_constDI sparc_emit_set_const64_quick1, - sparc_emit_set_const64_quick2, sparc_emit_set_const64_longway, - analyze_64bit_constant, const64_is_2insns, - create_simple_focus_bits): Fix some bugs when compiled on real - 64-bit hosts. - (function_arg_record_value_3, function_arg_record_value_2, - function_arg_record_value): Add fully prototyped forward decls. - * config/sparc/sparc.md (define_insn cmpsi_insn_sp32): Rename back - to cmpsi_insn and use on both 64 and 32 bit targets. - (define_insn cmpsi_insn_sp64): Remove. - (define_expand zero_extendsidi2): Allow for 32-bit target too. - (define_insn zero_extendsidi2_insn): Rename to - zero_extendsidi2_insn_sp64. - (define_insn zero_extendsidi2_insn_sp32): New pattern and - associated forced split for it. - - * config/sparc/sparc.c (const64_operand, const64_high_operand): - New predicates. - * config/sparc/sparc.h: Declare them. - (PREDICATE_CODES): Add them. - * config/sparc/sparc.md (movdi_lo_sum_sp64_dbl, - movdi_high_sp64_dbl, xordi3_sp64_dbl): Use them. - -Mon Aug 10 22:57:24 1998 John Carr - - * config/sparc/sparc.md (define_insn jump): Output ba,pt not b,pt - in v9 case as the latter makes the Solaris assembler crash. - -Mon Aug 10 22:39:09 1998 David S. Miller - - * config/sparc/sparc.c (input_operand): Do not accept a LO_SUM MEM - for TFmode when !v9. We require offsettable memory addresses. - * config/sparc/sparc.h (ALTER_HARD_SUBREG): Handle TFmode to - DFmode register number conversions. - * config/sparc/sparc.md (define_split DFmode moves): If register - is a SUBREG do alter_subreg on it before using. - (define_expand movtf): Fixup comment about alignment on v9. - (define_split TFmode moves): Don't use gen_{high,low}part, create - explicit SUBREGs instead. - -Mon Aug 10 19:02:55 1998 John Carr - - * Makefile.in (mbchar.o): Depend on mbchar.c. - -Mon Aug 10 04:28:13 1998 David S. Miller - Richard Henderson - - Rewrite Sparc backend for better code generation and - improved sparc64 support. - * config/sparc/sp64-elf.h: Set JUMP_TABLES_IN_TEXT_SECTION to - zero. - * config/sparc/sysv4.h: Likewise. - * config/sparc/sparc.c (v8plus_regcmp_p, sparc_operand, - move_operand, v8plus_regcmp_op, emit_move_sequence, - singlemove_string, doublemove_string, mem_aligned_8, - output_move_double, output_move_quad, output_fp_move_double, - move_quad_direction, output_fp_move_quad, output_scc_insn): - Remove. - (small_int_or_double): New predicate. - (gen_compare_reg): Remove TARGET_V8PLUS cmpdi_v8plus emission. - (legitimize_pic_address): Emit movsi_{high,lo_sum}_pic instead of - old pic_{sethi,lo_sum}_si patterns. - (mem_min_alignment): New generic function to replace - mem_aligned_8, which uses REGNO_POINTER_ALIGN information when - available and can test for arbitrary alignments. All callers - changed. - (save_regs, restore_regs, build_big_number, - output_function_prologue, output_cbranch, output_return, - sparc_flat_save_restore, sparc_flat_output_function_prologue, - sparc_flat_output_function_epilogue): Prettify - insn output. - (output_function_epilogue): Likewise and add code to output - deferred case vectors. - (output_v9branch): Likewise, add new arg INSN and use it to tack - on branch prediction settings. All callers changed. - (print_operand): Likewise and output %l44 for LO_SUMs when - TARGET_CM_MEDMID. - (sparc_splitdi_legitimate): New function to make sure DImode - splits can be run properly when !arch64. - (sparc_initialize_trampoline, sparc64_initialize_trampoline): - Reformat example code in comments. - (set_extends): Remove UNSPEC/v8plus_clear_high case. - (sparc_addr_diff_list, sparc_addr_list): New statics to keep track - of deferred case vectors we need to output. - (sparc_defer_case_vector): Record a case vector. - (sparc_output_addr_vec, sparc_output_addr_diff_vec, - sparc_output_deferred_case_vectors): New functions to output them. - (sparc_emit_set_const32): New function to form 32-bit constants in - registers when that requires more than one instruction. - (safe_constDI, sparc_emit_set_const64_quick1, - sparc_emit_set_const64_quick2, sparc_emit_set_const64_longway, - analyze_64bit_constant, const64_is_2insns, - create_simple_focus_bits, sparc_emit_set_const64): New functions - which do the same for 64-bit constants when arch64. - (sparc_emit_set_symbolic_const64): New function to emit address - loading for all code models on v9. - * config/sparc/sparc.h (CONDITIONAL_REGISTER_USAGE): Do not make - %g1 fixed when arch64, unfix %g0 when TARGET_LIVE_G0. - (ALTER_HARD_SUBREG): Fix thinko, return REGNO + 1 not 1. - (SECONDARY_INPUT_RELOAD_CLASS, SECONDARY_OUTPUT_RELOAD_CLASS): Fix - inaccuracies in comments, add symbolic and text_segment operands - when TARGET_CM_MEDANY and TARGET_CM_EMBMEDANY respectively. Use - GENERAL_REGS in these cases as a temp REG is needed to load these - addresses into a register properly. - (EXTRA_CONSTRAINT): Document more accurately, remove Q case as it - is no longer used. - (GO_IF_LEGITIMATE_ADDRESS): Allow TFmode for LO_SUM on v9 since fp - quads are guaranteed to have 16-byte alignment. - (LEGITIMIZE_ADDRESS): For SYMBOL_REF, CONST, and LABEL_REF use - copy_to_suggested_reg instead of explicit LO_SUM and HIGH. - (ASM_OUTPUT_ADDR_VEC, ASM_OUTPUT_ADDR_DIFF_VEC): New macros for - deferred case vector implementation. - (ASM_OUTPUT_ADDR_VEC_ELT): Use fputc to output newline. - (ASM_OUTPUT_ADDR_DIFF_ELT): Parenthesize LABEL in macro calls. - Generate "internal label - label" instead of "label - 1b". - (PRINT_OPERAND_ADDRESS): For LO_SUM use %l44 on TARGET_CM_MEDMID. - (PREDICATE_CODES): Remove sparc_operand, move_operand, - v8plus_regcmp_op. Add small_int_or_double, input_operand, and - zero_operand. - (doublemove_string, output_block_move, output_fp_move_double, - output_fp_move_quad, output_move_double, output_move_quad, - output_scc_insn, singlemove_string, mem_aligned_8, move_operand, - sparc_operand, v8plus_regcmp_op, v8plus_regcmp_p): Remove externs. - (sparc_emit_set_const32, sparc_emit_set_const64, - sparc_emit_set_symbolic_const64, input_operand, zero_operand, - mem_min_alignment, small_int_or_double): Add externs. - * config/sparc/sparc.md: Document the many uses of UNSPEC and - UNSPEC_VOLATILE in this backend. - (define_function_unit ieu): Rename to ieu_unnamed. Add move and - unary to types which execute in it. - (define_function_unit ieu_shift): Rename to ieu0. - (define_function_unit ieu1): New, executes compare, call, and - uncond_branch type insns. - (define_function_units for type fdivs, fdivd, fsqrt): These - execute in the fpu multiply unit not the adder on UltraSparc. - (define_expand cmpdi): Disallow TARGET_V8PLUS. - (define_insn cmpsi_insn): Rename to cmpsi_insn_sp32. - (define_insn cmpsi_insn_sp64): New, same as sp32 variant except it - allows the arith_double_operand predicate and rHI constraint when - TARGET_ARCH64. - (define_insn cmpdi_sp64, cmpsf_fpe, cmpdf_fpe, cmptf_fpe, - cmpsf_fp, cmpdf_fp, cmptf_fp, sltu_insn, neg_sltu_insn, - neg_sltu_minux_x, neg_sltu_plus_x, sgeu_insn, neg_sgeu_insn, - sltu_plus_x, sltu_plus_x, sltu_plus_x_plus_y, x_minus_sltu, - sgeu_plus_x, x_minus_sgeu, movqi_cc_sp64, movhi_cc_sp64, - movsi_cc_sp64, movdi_cc_sp64, movsf_cc_sp64, movdf_cc_sp64, - movtf_cc_sp64, movqi_cc_reg_sp64, movhi_cc_reg_sp64, - movsi_cc_reg_sp64, movdi_cc_reg_sp64, movsf_cc_reg_sp64, - movdf_cc_reg_sp64, movtf_cc_reg_sp64, zero_extendhisi2_insn, - cmp_siqi_trunc, cmp_siqi_trunc_set, sign_extendhisi2_insn, - sign_extendqihi2_insn, sign_extendqisi2_insn, - sign_extendqidi2_insn, sign_extendhidi2_insn, - extendsfdf2, extendsftf2, extenddftf2, truncdfsf2, trunctfsf2, - trunctfdf2, floatsisf2, floatsidf2, floatsitf2, floatdisf2, - floatdidf2, floatditf2, fix_truncsfsi2, fix_truncdfsi2, - fix_trunctfsi2, fix_truncsfdi2, fix_truncdfdi2, fix_trunctfdi2, - adddi3_sp64, addsi3, cmp_ccx_plus, cmp_cc_plus_set, subdi_sp64, - subsi3, cmp_minus_ccx, cmp_minus_ccx_set, mulsi3, muldi3, - muldi3_v8plus, cmp_mul_set, mulsidi3, mulsidi3_v8plus, - const_mulsidi3_v8plus, mulsidi3_sp32, const_mulsidi3, - smulsi3_highpart_v8plus, unnamed subreg mult, - const_smulsi3_highpart_v8plus, smulsi3_highpart_sp32, - const_smulsi3_highpart, umulsidi3_v8plus, umulsidi3_sp32, - const_umulsidi3, const_umulsidi3_v8plus, umulsi3_highpart_v8plus, - const_umulsi3_highpart_v8plus, umulsi3_highpart_sp32, - const_umulsi3_highpart, divsi3, divdi3, cmp_sdiv_cc_set, udivsi3, - udivdi3, cmp_udiv_cc_set, smacsi, smacdi, umacdi, anddi3_sp64, - andsi3, and_not_di_sp64, and_not_si, iordi3_sp64, iorsi3, - or_not_di_sp64, or_not_si, xordi3_sp64, xorsi3, xor_not_di_sp64, - xor_not_si, cmp_cc_arith_op, cmp_ccx_arith_op, - cmp_cc_arith_op_set, cmp_ccx_arith_op_set, cmp_ccx_xor_not, - cmp_cc_xor_not_set, cmp_ccx_xor_not_set, cmp_cc_arith_op_not, - cmp_ccx_arith_op_not, cmp_cc_arith_op_not_set, - cmp_ccx_arith_op_not_set, negdi2_sp64, cmp_cc_neg, cmp_ccx_neg, - cmp_cc_set_neg, cmp_ccx_set_neg, one_cmpldi2_sp64, cmp_cc_not, - cmp_ccx_not, cmp_cc_set_not, cmp_ccx_set_not, addtf3, adddf3, - addsf3, subtf3, subdf3, subsf3, multf3, muldf3, mulsf3, - muldf3_extend, multf3_extend, divtf3, divdf3, divsf3, negtf2, - negdf2, negsf2, abstf2, absdf2, abssf2, sqrttf2, sqrtdf2, sqrtsf2, - ashlsi3, ashldi3, unnamed DI ashift, cmp_cc_ashift_1, - cmp_cc_set_ashift_1, ashrsi3, ashrdi3, unnamed DI ashiftrt, - ashrdi3_v8plus, lshrsi3, lshrdi3, unnamed DI lshiftrt, - lshrdi3_v8plus, tablejump_sp32, tablejump_sp64, call_address_sp32, - call_symbolic_sp32, call_address_sp64, call_symbolic_sp64, - call_address_struct_value_sp32, call_symbolic_struct_value_sp32, - call_address_untyped_struct_value_sp32, - call_symbolic_untyped_struct_value_sp32, call_value_address_sp32, - call_value_symbolic_sp32, call_value_address_sp64, - call_value_symbolic_sp64, branch_sp32, branch_sp64, - flush_register_windows, goto_handler_and_restore, - goto_handler_and_restore_v9, goto_handler_and_restore_v9_sp64, - flush, all ldd/std peepholes, return_qi, return_hi, return_si, - return_addsi, return_di, return_adddi, return_sf, all call+jump - peepholes, trap, unnamed trap insns): Prettify output strings. - (define_insn anddi3_sp32, and_not_di_sp32, iordi3_sp32, - or_not_di_sp32, xordi3_sp32, xor_not_di_sp32, one_cmpldi2): - Likewise and force + implement splits for integer cases. - (define_insn return_sf_no_fpu): Likewise and allow to match when - no-fpu because of our subreg SFmode splits. - (define_insn zero_extendqihi2, zero_extendqisi2_insn, - zero_extendqidi2_insn, zero_extendhidi2_insn, - zero_extendsidi2_insn, sign_extendsidi2_insn): Likewise and use - input_operand for second operand. - (cmp_minus_cc, cmp_minus_cc_set): Likewise and use - reg_or_0_operand for operand 2 so new splits can use it. - (cmp_zero_extendqisi2, cmp_zero_extendqisi2_set, cmp_cc_plus, - cmp_cc_xor_not): Likewise and don't forget to check TARGET_LIVE_G0 - too. - (cmp_zero_extract, cmp_zero_extract_sp64): Likewise and allow - CONST_DOUBLEs for operand 2. - (define_insn move_label_di): Likewise and label distance - optimization because it no longer works with new deferred case - vector scheme. To be revisited. - (define_insn x_minus_y_minus_sltu, x_minus_sltu_plus_y): Likewise - and allow reg_or_0_operand and J constraint for second operand. - (define_insn jump): Set branch predict taken on V9. - (define_insn tablejump): Emit LABEL_REF + PLUS memory address for - new deferred case vector scheme. - (define_insn pic_tablejump_32, pic_tablejump_64): Remove. - (define_insn negdi2_sp32): Force + implement splits. - (define_insn negsi2, one_cmplsi2): Rename to negsi2_not_liveg0 and - one_cmplsi2_not_liveg0 respectively, and create expander of original - names which emit special rtl for TARGET_LIVE_G0. - (define_insn cmpdi_v8plus, scc_si, scc_di): Remove. - (define_insn seq, sne, slt, sge, sle, sltu, sgeu): Don't do - gen_compare_reg, FAIL instead. - (define_insn sgtu, sleu): Likewise and check gen_s*() return - values when trying to reverse condition codes, if they FAIL then - do likewise. - (define_insn snesi_zero, neg_snesi_zero, snesi_zero_extend, - snedi_zero, neg_snedi_zero, snedi_zero_trunc, seqsi_zero, - neg_seqsi_zero, seqsi_zero_extend, seqdi_zero, neg_seqdi_zero, - seqdi_zero_trunc, x_plus_i_ne_0, x_minus_i_ne_0, x_plus_i_eq_0, - x_minus_i_eq_0): Add new splits to perform these multi-insn cases, - set output string to # to indicate they are mandatory splits. - (define_insn pic_lo_sum_si, pic_sethi_si, pic_lo_sum_di, - pic_sethi_di, move_pic_label_si): Remove. - (define_insn movsi_low_sum, movsi_high, movsi_lo_sum_pic, - movsi_high_pic, movsi_pic_label_reg): New patterns to take their - place. - (define_expand movsi_pic_label_ref, define_insn - movsi_high_pic_label_ref, movsi_lo_sum_pic_label_ref): New - expander and insns to handle PIC label references and deferred - case vectors. - (define_insn get_pc_via_rdpc): Comment out as it is no longer - used. - (define_expand movqi, movhi, movsi, movdi, movsf, movdf, movtf): - Rewrite to not use emit_move_sequence, make use of new constant - formation code, and new splits for all multi-insn cases. - (define_insn movqi_insn): Remove sethi case, it can never happen. - Use reg_or_zero_operand instead of const0_rtx explicit test, - use input_operand instead of move_operand for source, and use - general_operand now for dest. - (define_insn movhi_insn): Similar but leave sethi case. - (define_insn lo_sum_qi, store_qi, store_hi): Remove. - (define_insn sethi_hi lo_sum_hi): Rename to movhi_high and - movhi_lo_sum respectively, prettify output string. - (define_insn movsi_zero_liveg0): New pattern to put zero into a - register when needed on TARGET_LIVE_G0. - (define_insn movsi_insn): Use general_operand and input_operand - for dest and src respectively. Simplify applicability test. - Prettify output strings, and add clr alternative for J - constraint. - (define_insn movdi_sp32_v9, movdi_sp32, define_splits for - deprecated std and reg-reg DI moves): Remove and... - (define_insn movdi_insn_sp32, movdi_insn_sp64): Replace with new - implementation which uses forced splits for all non-single insn - cases. - (define_split DI move cases on !arch64): New splits to handle all - situations of 64-bit double register DImode on 32bit, and - unaligned registers and memory addresses for all subtargets. - (define_insn movsf_const_insn, movdf_const_insn, store_sf): - Remove. - (define_insn movsf_insn, movsf_no_f_insn): Use general_operand and - input_operand for dest and src respectively, prettify output - strings. - (define_insn movdf_insn, movdf_no_e_insn, store_df, - movtf_const_insn, movtf_insn, movtf_no_e_insn, store_tf): Remove - and... - (define_insn movdf_insn_sp32, movdf_no_e_insn_sp32, - movdf_insn_sp64, movdf_no_e_insn_sp64, movtf_insn, - movtf_no_e_insn_sp32, movtf_insn_hq_sp64, movtf_insn_sp64, - movtf_no_e_insn_sp64): Replace with new - implementation which uses forced splits for all non-single insn - cases. - (define_split DF move cases): New splits in similar vein to DI - move counterparts. - (define_insn sethi_di_medlow, sethi_di_medium_pic, - sethi_di_embmedany_data, sethi_di_embmedany_text, sethi_di_sp64, - movdi_sp64_insn): Remove old v9 code model and constant loading - support insns and.. - (define_insn pic_lo_sum_di, pic_sethi_di, - sethi_di_medlow_embmedany_pic, sethi_di_medlow, losum_di_medlow, - seth44, setm44, setl44, sethh, setlm, sethm, setlo, - embmedany_sethi, embmedany_losum, embmedany_brsum, - embmedany_textuhi, embmedany_texthi, embmedany_textulo, - embmedany_textlo, movdi_lo_sum_sp64_cint, movdi_lo_sum_sp64_dbl, - movdi_high_sp64_cint, movdi_high_sp64_dbl): Replace with new - scheme, using unspecs, secondary reloads, and one to one sparc - insn to rtl insn mapping for better scheduling and code gen. - (define_expand reload_indi, reload_outdi): Reload helpers for - MEDANY and EMBMEDANY symbol address loading cases which require a - temporary register. - (define_expand movsicc): Remove v8plus_regcmp cases. - (define_insn movdi_cc_sp64_trunc, movdi_cc_reg_sp64_trunc, - cmp_zero_extendqidi2, cmp_zero_extendqidi2_set, cmp_qidi_trunc, - cmp_diqi_trunc_set): New patterns used by some of the new scc - splits on arch64. - (define_insn xordi3_sp64_dbl): New pattern used for constant - formation when crossing from 32-bit targets. - (define_insn movsi_cc_reg_v8plus, v8plus_clear_high, and helper - split): Remove. - (define_insn addx, subx): Make visible and prettify. - (define_insn adddi3_insn_sp32): Likewise and force split. - (define_insn addx_extend, subx_extend, unnamed): New patterns for - 64bit scc split usage. - (define_insn unnamed plusDI zero_extend, unnamed minusDI - zero_extend, subdi3): Force and implement splits. - - * final.c (final_scan_insn): Don't output labels if target - specifies ASM_OUTPUT_ADDR_{DIFF}_VEC. Do these macro operations - instead. - - * reorg.c (dbr_schedule): When taking on BR_PRED notes at the end, - don't forget to walk inside SEQUENCESs too as these are what the - delay slot scheduler will create. - -Mon Aug 10 01:21:01 1998 Richard Henderson - - * alpha.md (extxl+1,+2): New patterns to work around - combine lossage. - -Sat Aug 8 19:20:22 1998 Gary Thomas (gdt@linuxppc.org) - - * rs6000.c (rs6000_allocate_stack_space): Fix typo which - caused bad assembly code to be generated. - -Sat Aug 8 18:53:28 1998 Jeffrey A Law (law@cygnus.com) - - * netbsd.h: Fix typo. - -Mon Aug 3 00:06:42 1998 Robert Lipe - - * config.sub: Fix typo. - -Sun Aug 2 22:39:08 1998 Hans-Peter Nilsson - - * invoke.texi (Environment Variables): Typo: Change "ascpects" - into "aspects". - (Running Protoize): Typo: Change "ther" into "other". - -Sun Aug 2 00:42:50 1998 Jeffrey A Law (law@cygnus.com) - - * i386/netbsd.h: Undo previous change to DWARF2_UNWIND_INFO. - * m68k/netbsd.h: Likewise. - * ns32k/netbsd.h: Likewise. - * sparc/netbsd.h: Likewise. - -Sat Aug 1 17:59:30 1998 Richard Henderson - - * ginclude/va-alpha.h (va_list): Use a typedef, not a define. - * ginclude/va-clipper.h (va_list): Likewise. - -Fri Jul 31 20:22:02 1998 Michael Meissner - - * rs6000.c (rs6000_override_options): If big endian and -Os, use - load/store multiple instructions unless user overrides. - -Fri Jul 31 17:08:59 1998 Jeffrey A Law (law@cygnus.com) - - * ns32k/netbsd.h: Fix typo. - -Fri Jul 31 10:23:55 1998 Doug Evans - - * m32r/m32r.h (ASM_OUTPUT_SOURCE_LINE): Always output line number - labels with .debugsym if no parallel insns. - -Thu Jul 30 19:15:53 1998 Richard Henderson - - * alpha.md (fp cmp): Replicate patterns for ALPHA_TP_INSN. - (fcmov): Remove ALPHA_TP_INSN patterns -- fcmov doesn't trap. - -Thu Jul 30 19:50:15 1998 David Edelsohn - - * rs6000/x-aix43 (AR_FOR_TARGET_FLAGS): Delete. - (AR_FOR_TARGET): Define. - -Thu Jul 30 12:29:12 1998 Mark Mitchell - - * dyn-string.h: New file. - * dyn-string.c: Likewise. - * Makefile.in (OBJS): Add dyn-string.o. - (dwarf2out.o): Add dyn-string.h dependency. - (dyn-string.o): List dependencies. - * dwarf2out.c: Include dyn-string.h. - (ASM_NAME_TO_STRING): Use dyn_string_append, rather than strcpy. - (addr_const_to_string): Take a dyn_string_t, not a char* as a - prototype. Use dyn_string_append rather than strcat, throughout. - (addr_to_string): Use dyn_string_t. - -Thu Jul 30 13:08:07 1998 Ken Raeburn - - Function entry/exit profiling instrumentation: - * expr.h (profile_function_entry_libfunc, - profile_function_exit_libfunc): Declare new variables. - * optabs.c: Define them here. - (init_optabs): Initialize them. - * tree.h (struct tree_decl): New flag - no_instrument_function_entry_exit. - (DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT): New accessor macro. - * c-decl.c (duplicate_decls): Merge it. - * c-common.c (enum attrs): New value A_NO_INSTRUMENT_FUNCTION. - (init_attributes): Use it for "no_instrument_function". - (decl_attributes): Handle it, for functions that have not yet been - compiled. Set decl flag. - * flags.h (flag_instrument_function_entry_exit): Declare new - variable. - * toplev.c (flag_instrument_function_entry_exit): Define it here. - (f_options): New option "instrument-functions". - * function.h (struct function): New field instrument_entry_exit. - * function.c (current_function_instrument_entry_exit): New - variable. - (push_function_context_to, pop_function_context_from): Save and - restore. - (expand_function_start): Set current_ variable, maybe emit return - label and entry profile call. - (expand_function_end): Maybe emit exit profile call. - -Thu Jul 30 00:58:34 1998 Jeffrey A Law (law@cygnus.com) - - * i386.md (movqi): When optimizing a load of (const_int 1) into a - NON_QI_REG_P, pretend the register is SImode. - -Wed Jul 29 23:49:23 1998 Todd Vierling - - * configure.in: Use xm-netbsd.h as the NetBSD xm file (not xm-siglist). - Accept arm32 as arm, m68k4k as m68k, mipsle as mips-dec, and any - manufacturer id for ns32k. - * configure: Regenerated. - * config/netbsd.h: When using ASM_WEAKEN_LABEL, make it global too. - * config/t-netbsd: Don't compile libgcc1-test as the fns are in libc. - * config/i386/netbsd.h: Undefine DWARF2_UNWIND_INFO, not define as 0. - * config/m68k/netbsd.h: Same. - * config/ns32k/netbsd.h: Same. - * config/sparc/netbsd.h: Same. - -Wed Jul 29 22:39:21 1998 Jeffrey A Law (law@cygnus.com) - - * unroll.c (unroll_loop): Do not abort for an UNROLL_MODULO - or UNROLL_COMPLETELY loop that starts with a jump to its - exit code. - -Wed Jul 29 22:18:14 1998 David Edelsohn - - * rs6000/rs6000.md (absdi2 define_split): Swap operands of MINUS. - * rs6000/rs6000.c (mask64_operand): Use HOST_BITS_PER_WIDE_INT. - (print_operand, case 'B'): Don't fall through. - (print_operand, case 'S'): Correct mask begin/end computation. - Use HOST_BITS_PER_WIDE_INT. - * rs6000/rs6000.h (CPP_PREDEFINES): Define _LONG_LONG. - (CONDITIONAL_REGISTER_USAGE): GPR13 fixed if TARGET_64BIT. - * rs6000/aix41.h (CPP_PREDEFINES): Same. - * rs6000/aix43.h (CPP_PREDEFINES): Same. - -Wed Jul 29 11:47:10 1998 Nick Clifton - - * config/arm/thumb.md (extendqisi2_insn): Remove earlyclobber - constraint from second alternative. - -Tue Jul 28 23:29:04 1998 Jason Merrill - - * configure.in: Fix --without/--disable cases for local-prefix, - gxx-include-dir and checking. - -Tue Jul 28 22:01:23 1998 David S. Miller - - * configure.in (enable_haifa): Set by default for sparc64 too. - configure: Rebuilt. - -Tue Jul 28 23:29:04 1998 Jason Merrill - - * i386/cygwin32.h (VALID_MACHINE_TYPE_ATTRIBUTE): New macro. - * i386/winnt.c (associated_type): New fn. - (i386_pe_valid_type_attribute_p): New fn. - (i386_pe_check_vtable_importexport): Remove. - (i386_pe_dllexport_p): Use associated_type. - (i386_pe_dllimport_p): Likewise. - - From Antonio M. O. Neto : - * i386.c (i386_valid_type_attribute_p): Also accept - attributes for METHOD_TYPEs. - -Tue Jul 28 23:17:39 1998 Peter Gerwinski - - * tree.c (build_range_type): Copy TYPE_SIZE_UNIT. - -Tue Jul 28 22:31:12 1998 Craig Burley - - * gcc.c: Fix commentary describing %g, %u, %U, and %O. - - * gcc.c (do_spec_1): Fix handling of %g%O and %U%O to prevent - them from generating a new base name for each occurrence of - a specific suffix. - -1998-07-28 Vladimir N. Makarov - - * cse.c (cse_insn): Enable substitution inside libcall only for REG, - SUBREG, MEM. - * rtlanal.c (replace_rtx): Prohibit replaces in CONST_DOUBLE. - - * cplus-dem.c (type_kind_t): New type. - (demangle_template_value_parm): Add type_kind_t parameter. Rely - on this parameter, rather than demangling the type again. - (demangle_integral_value): Pass tk_integral. - (demangle_template_: Pass the value returned from do_type. - (do_type): Return a type_kind_t. Pass tk_integral to - demangle_template_value_parm for array bounds. - (demangle_fund_type): Likewise. - -Mon Jul 27 00:54:41 1998 Jason Merrill - - * tree.c (simple_cst_equal, case CONSTRUCTOR): OK if the elts are - identical. - -Mon Jul 27 22:18:36 1998 Jeffrey A Law (law@cygnus.com) - - * pa.c (move_operand): Accept CONSTANT_P_RTX. - -Mon Jul 27 17:18:52 1998 Dave Brolley - - * stor-layout.c (layout_type): Handle arrays of bits, for Chill. - - * expr.c (get_inner_reference): Handle zero-based, unsigned, array - index conversion. - -Mon Jul 27 14:51:33 1998 Jeffrey A Law (law@cygnus.com) - - * mn10300.h (DEBUGGER_AUTO_OFFSET): Define. - (DEBUGGER_ARG_OFFSET): Likewise. - - * mn10300.md (movsf): Remove last change. Not needed. - -Mon Jul 27 14:22:36 1998 Dave Brolley - - * c-lex.c (yylex): Fix boundary conditions in character literal and - string literal loops. - -Mon Jul 27 11:43:54 1998 Stan Cox - - * longlong.h (count_leading_zeros): Sparclite scan instruction was - being invoked incorrectly. - - * i386.c (ix86_prologue): Added SUBTARGET_PROLOGUE invocation. - * i386/cygwin32.h (STARTFILE_SPEC, LIB_SPEC, SUBTARGET_PROLOGUE): - Add -pg support. - * i386/win32.h: New file. Hybrid mingw32.h/cygwin32.h configuration. - * configure.in: Added i[34567]86-*-win32. - * config.sub: Likewise. - * configure: Rebuilt. - -Sun Jul 26 01:11:12 1998 H.J. Lu (hjl@gnu.org) - - * i386.h (CONST_DOUBLE_OK_FOR_LETTER_P): Return 0 when eliminating - the frame pointer and compiling PIC code and reload has not completed. - - * i386.c (output_to_reg): Add code to emulate non-popping DImode - case. - -Sun Jul 26 01:01:32 1998 Jeffrey A Law (law@cygnus.com) - - * regmove.c (regmove_optimize): Fix typo initializing regmove_bb_head. - -Sat Jul 25 23:29:23 1998 Gerald Pfeifer - - * Makefile.in (install-info): Only try to update the info - directory file if it exists in the first place. - -Fri Jul 24 18:58:37 1998 Klaus Espenlaub - - * rs6000.h (ASM_OUTPUT_CONSTRUCTOR, ASM_OUTPUT_DESTRUCTOR): Delete. - -Fri Jul 24 14:20:26 1998 Jeffrey A Law (law@cygnus.com) - - * mn10300.md (movqi, movhi, movsi, movsf): Correctly handle - CONST_DOUBLE source. - -Fri Jul 24 11:17:04 1998 Nick Clifton - - * config/arm/thumb.c (thumb_print_operand): Decode %_ in asm - strings as the insertion of USER_LABEL_PREFIX. - * config/arm/thumb.h (PRINT_OPERAND_PUNCT_VALID_P): Accept _ as a - valid code. - * config/arm/thumb.md: Use %_ as a prefix to gcc library function - calls. - -Thu Jul 23 18:53:20 1998 Jim Wilson - - * dbxout.c (dbxout_range_type): Only call dbxout_type_index for - already defined type. - -Thu Jul 23 13:49:41 1998 Jeffrey A Law (law@cygnus.com) - - * expr.c (check_max_integer_computation_mode): Allow conversions - of constant integers to MAX_INTEGER_COMPUTATION_MODE. - (expand_expr): Likewise. - -Thu Jul 23 11:12:06 1998 Alexandre Petit-Bianco - - * expr.c (expand_expr): Expand RETURN_EXPR. - -Thu Jul 23 11:00:29 1998 Jim Wilson - - * dwarf2out.c (dwarf2out_finish): Call stripattributes on TEXT_SECTION. - -Wed Jul 22 19:10:00 1998 Catherine Moore - - * dwarf2out.c (output_aranges): Call stripattributes - for TEXT_SECTION references. - (output_line_info): Likewise. - -Wed Jul 22 14:08:54 1998 David S. Miller - - * profile.c (branch_prob): Call allocate_reg_info after outputting - profile rtl in instrument_arcs. - -Wed Jul 22 12:47:49 1998 Jim Wilson - - * fixinc.irix (math.h): Install wrapper instead of copying. - -Wed Jul 22 12:37:14 1998 Alexandre Petit-Bianco - - * tree.def (EXPR_WITH_FILE_LOCATION): Defined as an 'e' expression - so WFL are expanded correctly when contained in a COMPOUND_EXPR. - * tree.h (EXPR_WFL_EMIT_LINE_NOTE): Change macro not to use - lang_flag_0. Added documentation in the flag table. - -Tue Jul 21 23:28:35 1998 Klaus Kaempf - - * cccp.c (do_include): Fix vax c style include handling. - -Tue Jul 21 13:28:19 1998 Jason Merrill - - * cplus-dem.c (do_type): Use demangle_template_value_parm for arrays. - -Sun Jul 12 01:27:05 1998 Jason Merrill - - * fold-const.c (non_lvalue): Don't deal with null pointer - constants here. - (fold, case COMPOUND_EXPR): Wrap a constant 0 in a NOP_EXPR. - -Tue Jul 21 15:49:31 1998 David Edelsohn - - * rs6000.h (PREDICATE_CODES): Add CONSTANT_P_RTX. - * rs6000.md (movsi, movdi): Add CONSTANT_P_RTX. - * rs6000.c (short_cint_operand): Add CONSTANT_P_RTX. - (u_short_cint_operand): Same. - (reg_or_cint_operand): Same. - (logical_operand): Same. - (input_operand): Same. - (reg_or_short_operand): Use u_short_cint_operand. - -Tue Jul 21 08:56:42 1998 Richard Henderson - - * alpha.md (fix_truncdfsi2, fix_truncsfsi2): Remove the define_expands, - but keep the insns and splits. Adjust so when the ultimate destination - is memory, use cvtql. - -Tue Jul 21 08:55:09 1998 Richard Henderson - - * flow.c (regno_uninitialized): Fixed regs are never uninitialized. - -Tue Jul 21 00:31:01 1998 Jeffrey A Law (law@cygnus.com) - - * gcc.c (do_spec): Call "error" not "warning". - - * configure.in: Fix minor problems with gas feature detection code. - * configure: Rebuilt. - - * gcc.c (do_spec): Issue a warning for '%[]' usage. - - * Undo this change. - * gcc.c: Delete %[spec] support. - (do_spec_1, case '('): Likewise. - (do_spec_1, case '['): Call error. - -Mon Jul 20 22:34:17 1998 Richard Henderson - - * alpha.h (CPP_SPEC): Tidy. Hook to cpp_cpu and cpp_subtarget. - (CPP_SUBTARGET_SPEC): Default to empty string. - (CPP_AM_*, CPP_IM_*, CPP_CPU_*, CPP_CPU_SPEC): New. - (EXTRA_SPECS, SUBTARGET_EXTRA_SPECS): New. - * alpha/elf.h (LD_SPEC): Use %(elf_dynamic_linker). - * alpha/linux-elf.h (SUBTARGET_EXTRA_SPECS): New. - (LIB_SPEC): Tidy. - * alpha/linux.h (CPP_PREDEFINES): Tidy. - * alpha/netbsd-elf.h (SUBTARGET_EXTRA_SPECS): New. - * alpha/netbsd.h (CPP_PREDEFINES): Tidy. - * alpha/osf.h (CPP_PREDEFINES): Remove bits subsumed by CPP_CPU_SPEC. - * alpha/win-nt.h (CPP_PREDEFINES): Likewise. - * alpha/vsf.h (CPP_PREDEFINES): Likewise. - (CPP_SUBTARGET_SPEC): New. Do this instead of overriding CPP_SPEC. - * alpha/vxworks.h: Likewise. - -Mon Jul 20 22:51:57 1998 Ken Raeburn - - * mips.md (reload_outsi): Added missing REGNO call. - (smulsi3_highpart, umulsi3_highpart): Provide prototype for - function pointer. - (mul_acc_di, mul_acc_64bit_di): Don't use match_op_dup, use - another match_operator and compare the codes. - - * mips.h (MASK_DEBUG_E, MASK_DEBUG_I): Set to zero. - - * MIPS multiply pattern fixes: - * mips.h (enum reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS): - Add union classes for HI, LO, or HILO plus general registers. - (GENERATE_MADD): Deleted. - * mips.md (mulsi3_mult3): Don't disparage output-LO alternative. - Add TARGET_MAD to condition. - (mulsi3): Test HAVE_mulsi3_mult3, not specific flags. - (mul_acc_si): Expand GENERATE_MADD here; it's the only use. Use - "*d" for accumulator, to give preference to LO initially but not - during reload. - -Mon Jul 20 16:16:38 1998 Dave Brolley - - * configure.in (enable_c_mbchar): New configure option. - (extra_cpp_objs): Always available now. - - * cexp.y (mbchar.h): #include it. - (yylex): Handle Multibyte characters in character literals. - - * cccp.c (mbchar.h): #include it. - (main): Set character set based on LANG environment variable. - (rescan): Handle multibyte characters in comments. - (skip_if_group): See above. - (validate_else): See above. - (skip_to_end_of_comment): See above. - (macarg1): See above. - (discard_comments): See above. - (rescan): Handle multibyte characters in string and character literals. - (collect_expansion): See above. - (skip_quoted_string): See above. - (macroexpand): See above. - (macarg1): See above. - (discard_comments): See above. - (change_newlines): See above. - - * c-lex.c (mbchar.h): #include it. - (GET_ENVIRONMENT): New macro. - (init_lex): Set character set based on LANG environment variable. - (yylex): Handle multibyte characters in character literals. - (yylex): Handle multibyte characters in string literals. - - * Makefile.in (mbchar.o): New target. - (cccp$(exeext)): @extra_cpp_objs@ is always available. - (cppmain$(exeext)): @extra_cpp_objs@ is always available. - - * mbchar.[ch]: New files for multibyte character handling. - -Mon Jul 20 01:11:11 1998 David S. Miller - - * jump.c (jump_optimize): When simplifying noop moves and - PUSH_ROUNDING, fix thinko so we use same criterion for identifying - the PUSHes to rewrite in second loop as we did in the first. - -Sun Jul 19 08:23:53 1998 Kaveh R. Ghazi - - * cplus-dem.c (demangle_nested_args): Make function definition - static to match the prototype. - -Fri Jul 17 14:58:44 1998 Richard Henderson - - * alloca.c: Respect USE_C_ALLOCA. - * gencheck.c (xmalloc): Ignore __GNUC__ for definition. - * gengenrtl.c (xmalloc): Likewise. - -Fri Jul 17 14:18:14 1998 Richard Henderson - - * loop.h (struct induction): Add no_const_addval. - * loop.c (the_movables, reg_address_cost): New variables. - (init_loop): Init reg_address_cost. - (loop_optimize): Call end_alias_analysis. - (scan_loop): Init the_movables. - (record_giv): Init induction->no_const_addval. - (basic_induction_var) [PLUS]: Use rtx_equal_p instead of ==. - [REG]: Rearrange loop search test to catch more cases. - (general_induction_var): Return success not benefit; take an extra - argument for that. Change all callers. - (simplify_giv_expr) [PLUS]: Always combine invariants. Use sge_plus. - [MULT]: Use rtx_equal_p instead of ==. Combine simple invariants. - [default]: Search the_movables for additional combinations. - (sge_plus_constant, sge_plus): New functions. - (express_from_1): New function. - (express_from): Always define. Rewrite using express_from_1. - (combine_givs_p): Handle more cases. Ignore address cost. - (cmp_combine_givs_stats): New function. - (combine_givs_used_once, combine_givs_benefit_from): New functions. - (combine_givs): Rewrite to do best-fit combination. - - * fold-const.c (operand_equal_p): Handle RTL_EXPR. - (fold): Do a complete (A*C)+(B*C) association check. - -Fri Jul 17 11:21:55 1998 Jim Wilson - - * function.c (fixup_var_refs_insns): Handle CLOBBER of a CONCAT. - -Fri Jul 17 11:48:55 1998 Jeffrey A Law (law@cygnus.com) - - * mn10300.c (MODES_TIEABLE_P): Fix typo. - -Fri Jul 17 03:26:12 1998 Rihcard Earnshaw (rearnsha@arm.com) - - * tree.c (valid_machine_attribute): Only create a new type variant if - there is a decl to use it. - -Thu Jul 16 14:48:04 1998 Nick Clifton - - * gcc.c (do_spec_1): Cope with %g/%u/%U options which do not have - a suffix. - -Fri Jul 17 03:24:40 1998 Hans-Peter Nilsson - - * extend.texi (Explicit Reg Vars): Typo: change "may deleted" into "may - be deleted" - -Thu Jul 16 14:48:47 1998 Jeffrey A Law (law@cygnus.com) - - * mn10300.c (count_tst_insns): New arg oreg_countp. Callers changed. - Simplify tests for clearing an address register. - (expand_prologue): Corresponding changes. - - * mn10300.md (movXX patterns): Make sure the destination is an - ADDRESS_REG when substituting "zero_areg" for (const_int 0). - (logical patterns): Split into expanders + patterns. - (zero and sign extension patterns): Similarly. - (shift patterns): Similarly. - -Thu Jul 16 01:17:44 1998 Richard Henderson - - * loop.c (emit_iv_add_mult): Scan the entire insn list generated - for the sequence, recording base values. - -Wed Jul 15 10:49:55 1998 Richard Henderson - - * i386.h (CPP_CPU_SPEC): Remove -Asystem(unix). - -Tue Jul 14 14:15:30 1998 Nick Clifton - - * gcc.c: Remove ANSI-C ism from --help code. - - * toplev.c: Support --help with USE_CPPLIB. - -Tue Jul 14 14:46:08 1998 Jeffrey A Law (law@cygnus.com) - - * configure.in: Rework gas feature code to work with symlink based - source trees. - - * extend.texi: Clarify some issues related to local variables - assigned to explicit registers. - - * mn10300.md (mulsi): Turn into expander + pattern. - - * mn10300.md (movsi, movsf, movdi, movdf): Remove "x" from I -> a - alternative. - -Tue Jul 14 07:41:59 1998 Richard Earnshaw (rearnsha@arm.com) - - * arm/tcoff.h (USER_LABEL_PREFIX): Make it empty to match coff.h. - -Tue Jul 14 03:02:44 1998 Jeffrey A Law (law@cygnus.com) - - * version.c: Bump again to distinguish mainline tree from the - egcs-1.1 branch. - -See ChangeLog.0 for earlier changes. - -Local Variables: -add-log-time-format: current-time-string -End: diff --git a/contrib/gcc/FSFChangeLog b/contrib/gcc/FSFChangeLog deleted file mode 100644 index 9a0e7f828045..000000000000 --- a/contrib/gcc/FSFChangeLog +++ /dev/null @@ -1,2154 +0,0 @@ -Wed Sep 30 14:27:49 1998 Andreas Schwab - - * function.c (assign_parms): Undo change of June 9. - -Tue Sep 29 09:57:26 1998 Richard Kenner - - * expr.c (get_inner_reference): Fix typo in last change. - -Mon Sep 27 21:34:00 1998 Paul Eggert - - * po/en_UK.po (Project-Id-Version): Set to cc 2.8.1.19980813 for now. - (PO-Revision-Date): Set to the current date. - -Sun Sep 27 07:33:18 1998 Richard Kenner - - * m68k/vxm68k.h (LINK_SPEC): Always use -r. - (WIDEST_HARDWARE_FP_SIZE): Define. - - * reload.c (push_reload): If in STRICT_LOW_PART, always reload - inside even if SUBREG_WORD is not zero. - - * flow.c (print_rtl_with_bb): Don't say not in basic block if we - aren't making basic blocks.8 - -Sat Sep 26 10:57:09 1998 Richard Kenner - - * function.c (optimize_bit_field): Don't remove SUBREG from dest - if SUBREG_REG is multi-word. - -Wed Sep 23 05:43:23 1998 Richard Kenner - - * reload.c (find_reloads_address): Deal with address which is - an AND; clean up return values some more. - -Fri Sep 11 13:02:26 1998 Richard Kenner - - * function.c (purge_addressof_1): Properly copy flags when making MEM. - -Mon Sep 7 18:33:06 1998 Richard Kenner - - * expr.c (get_inner_reference): If not COMPONENT_REF or BITFIELD_REF - and mode is BLKmode, set size_tree. - - * expr.c (expand_builtin, case BUILT_IN_LONGJMP): Fix typo in - last change. - -Wed Sep 2 15:38:01 1998 Paul Eggert - - * libgcc2.c (__floatdisf): Use signed comparison to test - whether u is close to zero; unsigned comparison is not what's - wanted here. - -Mon Aug 17 02:19:30 1998 David Edelsohn - - * xcoffout.c (UNKNOWN_STAB): Fix typo in previous change; missing - backslash before newline. - -Mon Aug 17 00:12:42 1998 Paul Eggert - - * reorg.c (check_annul_list_true_false): Fix typo in Jul 17 change. - -Sun Aug 2 01:10:15 1998 Paul Eggert - - Add Native Language Support. - - * intl/, ABOUT-NLS, mkinstalldirs, po/Makefile.in.in: New - subdirectory and files. They should be kept identical to the - corresponding items from the GNU gettext distribution. - - * ABOUT-GCC-NLS, exgettext, intl.c, intl.h, po/POTFILES.in, - po/en_UK.po: New files. - - * Makefile.in (AWK, datadir, localedir, top_builddir, USE_NLS, - INTLLIBS, POSUB, INTL_SUBDIRS, HOST_INTLLIBS, - PREPEND_DOTDOT_TO_RELATIVE_PATHS, SUBDIR_FLAGS_TO_PASS, GCC_OBJS, - COLLECT2_OBJS, CCCP_OBJS, CPPMAIN_OBJS, PROTO_OBJS, GCOV_OBJS, - INTL_DISTCLEAN, GEN_PROTOS_OBJS): New vars. - (LIBDEPS, LIBS): Add $(INTLLIBS). - (HOST_LIBDEPS, HOST_LIBS): Add $(HOST_INTLLIBS). - (LIBS): Add @LIBS@. - (ORDINARY_FLAGS_TO_PASS): New var, containing all the old values - from FLAGS_TO_PASS, except for CC. - (FLAGS_TO_PASS): Pass datadir, distdir, localedir. - (OBJS): Add intl.o. - (GEN): Add gencheck. - (STAGESTUFF): Add tree-check.h, gencheck$(exeext). - (native): Depend on intl.all. - (xgcc, collect2, cccp, cppmain, protoize, unprotoize, gcov): Link - intl.o. - (c-typeck.o, c-lex.o, collect2.o, gcc.o, toplev.o, integrate.o, - final.o, cccp.o, cppmain.o, cpplib.o, cpperror.o, s-proto, - gcov.o): Depend on intl.h. - (gencheck): Depend on $(HOST_LIBDEPS) instead of tree.h and - tree.def. - (gencheck.o, intl.o, $(top_builddir)/intl/libintl.a, - $(srcdir)/cp/parse.c, intl.all, intl.install, intl.uninstall, - intl.distdir, intl.mostlyclean, intl.clean, intl.distclean, - intl.maintainer-clean, intl.distdir-fixup, distdir-check): New - rules. - (gen-protos): Link cpperror.o, cppexp.o, cpphash.o, cpplib.o, - prefix.o, version.o; needed for `cpp_notice'. - (mostlyclean): Depend on intl.mostlyclean. - (clean): Depend on intl.clean. - (distclean): Depend on intl.disclean, unless the invoker defines - INTL_DISTCLEAN to be empty. Remove intl/libintl.h and libintl.h - (created by configure). - (maintainer-clean): Make intl.maintainer-clean, but define - INTL_DISTCLEAN to be empty. - (install-normal): Depend on intl.install. - (uninstall): Depend on intl.uninstall. - (distdir-start): Make sure invoker configured with --enable-nls. - Use $(AWK), not awk. Make tmp/intl and tmp/po directories. - (distdir-finish): Make distdir-check at the end. - (distdir): Depend on intl.distdir, intl.distdir-fixup. - (compare, compare3, gnucompare, gnucompare3, stage1-start, - stage2-start, stage3-start, stage4-start): Handle intl - subdirectory. - - * acconfig.h (ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, - HAVE_LC_MESSAGES, HAVE_STPCPY, PACKAGE, VERSION): New macros. - - * aclocal.m4 (AC_ISC_POSIX, AM_WITH_NLS, AM_GNU_GETTEXT, - AM_LC_MESSAGES, AM_PATH_PROG_WITH_TEST): New functions; taken from - gettext distribution. - - * bi-arity.c, bi-opcode.c, bi-opname.c: Include config file first. - - * c-common.c: Don't include . - (tfaff): Now a function, not a string. All users changed. - (check_format_info): Use is_C_digit, not isdigit. - Reword messages to ease localization. - - * c-decl.c (redeclaration_error_message): Now returns int, not - message. - (poplevel, duplicate_decls, pushdecl): Revamp to pass explicit - strings to diagnostic generators. - (duplicate_decls, parmlist_tags_warning, finish_struct): Reword - messages to ease localization. - - * c-iterate.c (prdecl): Reword messages so that they do not require - localization. - - * c-lex.c: Include limits.h if available. - Include intl.h. - Include ctype.h only if MAP_CHARACTER is defined. - (UCHAR_MAX): Define if limits.h doesn't. - (C_alnum_array): New var. - (init_lex): Initialize it. - (yyerror): Localize msgid arg. - (yylex): Use is_C_alnum and is_C_digit, not isalnum and isdigit. - - * c-lex.h (C_alnum_array): New decl. - (is_C_alnum, is_C_digit): New macros. - - * c-typeck.c: Include intl.h. - (warning_init): Now takes just one arg. - (incomplete_type_error, build_unary_op, lvalue_or_else, - readonly_warning, build_modify_expr): Reword messages to ease - localization. - (build_unary_op, readonly_warning): Revamp to pass explicit - strings to diagnostic generators. - (build_modify_expr, warn_for_assignment, c_expand_return): - Translate strings passed to functions expecting translated - strings. - (get_spelling): Remove; it was a no-op. All callers changed. - (error_init, pedwarn_init): Now takes just one arg. All callers - and decls changed. This makes it easier to localize. - - * cccp.c: Include intl.h. - (char_name): Remove. - (check_macro_name): Now takes int 2nd arg, not char *. All - callers changed. - (macarg): Now returns int, not char *. All callers changed. - (notice, vnotice, pedwarn_strange_white_space): New functions. - (verror): Now extern; used by cexp.y. - (main): Set message locale, and defer memory allocation until - after. - (main, do_include, print_containing_files): Invoke `notice' to - localize notices. - (handle_directive): Invoke pedwarn_strange_white_space instead of - using char_name. - (do_include, check_macro_name): Reword messages to ease - localization. - (my_strerror): Reword message so that it does not require - localization. - (verror, vwarning, verror_with_line, vwarning_with_line, - pedwarn_with_file_and_line, fatal): Invoke vnotice to localize - msgid. - (initialize_char_syntax): No need to initialize char_name. - - * cexp.y (yyerror): Now takes msgid format and args, not just string. - (verror): New decl. - (parse_number, yylex): Reword messages to ease - localization. - (verror): New test function. - (pedwarn, warning): Translate msgid arg. - - * collect2.c: Include intl.h. - (my_strerror, main, collect_execute, scan_prog_file, - scan_libraries, read_file, end_file): Reword messages so that they - do not require localization. - (notice): Nwe function. - (fatal, error, main, collect_execute, maybe_unlink, - write_c_file_stat, locatelib, scan_libraries, scan_prog_file, - add_func_table): Use it to translate msgid strings. - (main): Set message locale, and defer memory allocation until - after. - (collect_wait): Reword messages to ease localization. - (bad_header): Revamp to pass explicit strings to diagnostic - generators. - - * combine.c (dump_combine_stats, dump_combine_total_stats): - Use fnotice to translate diagnostic messages. - - * config/1750a/1750a.c (memop_valid): Don't use `valid' as an - identifier; it runs afoul of SunOS 4.1.4 . - - * config/arc/initfini.c (__do_global_dtors): Put backslash before - newline in strings, to pacify xgettext. - - * config/dsp16xx/dsp16xx.c, config/dsp16xx/dsp16xx.h - (dsp16xx_invalid_register_for_compare): New function. - * config/dsp16xx/dsp16xx.md: Use it to report invalid registers. - - * config/i370/i370.h: Include . - - * config/i386/i386.c: Include config.h first. - - * config/m32r/initfini.c (__do_global_dtors): Put backslash before - newline in strings, to pacify xgettext. - * config/m88k/dguxbcs.h (CPP_SPEC): Likewise. - - * config/rs6000/rs6000.c: Include config.h first. - * config/rs6000/rs6000.c, config/rs6000/rs6000.h - (rs6000_fatal_bad_address): New function. - * config/rs6000/rs6000.md: Use it to report bad addresses. - - * config/v850/v850.c: Include config.h first. - - * configure.in: When generating config.h and mentioning a file - taken from the config directory, surround it with #ifdef IN_GCC, - so that programs compiled without IN_GCC -- notably in the intl - subdirectory -- don't need to be compiled with -Iconfig. - (PACKAGE, VERSION, ALL_LINGUAS): New vars. - (AC_ARG_ENABLE): Add --enable-nls. - (AM_GNU_GETTEXT): Add. Override XGETTEXT so that we use exgettext - instead of xgettext to extract strings. - (all_outputs): Add intl/Makefile, po/Makefile.in. - Do not use the shell variable 'l'; it runs afoul of gettext's - aclocal mechanism! - If libintl.h is created, echo '#include "intl/libintl.h"' - >libintl.h so that we don't have to futz with our include paths. - - * cp/Make-lang.in (g++.o): Depend on gansidecl.h, intl.h, Makefile; - do not depend on config.status. - (GXX_OBJS): New var. - (g++$(exeext)): Link intl.o. - - * cp/Makefile.in (top_builddir, INTLLIBS): New vars. - (LIBS): Add $(INTLLIBS). - - * cppalloc.c (memory_full): Use `cpp_notice' to print diagnostic. - - * cpperror.c: Include intl.h. - (cpp_print_containing_files): Use cpp_notice to translate messages. - (cpp_message): is_error is -1 for notices. Translate "warning:". - (cpp_fatal): Translate msgid arg. - - * cppexp.c (cpp_lex): Revamp to pass explicit strings to - diagnostic generators. - (cpp_parse_expr): Use cpp_error, not fprintf, to report - unimplemented operators. - - * cpplib.c: Include intl.h. - (check_macro_name): Now takes int 2nd arg, not char *. All - callers changed. - (check_macro_name, do_define): Reword messages to ease - localization. - (do_define): Revamp to pass explicit strings to diagnostic - generators. - (do_define, cpp_start_read, cpp_handle_options): Use cpp_notice to - translate messages. - (cpp_error, cpp_warning, cpp_warning_with_line, - cpp_pedwarn_with_file_and_line): Translate msgid arg. - (cpp_notice): New function. - (my_strerror): Reword message so that it does not require - localization. - - * cpplib.h (cpp_notice): New decl. - - * cppmain.c: Include intl.h. - (main): Set message locale. - - * cse.c (cse_main): Use fnotice to print diagnostic. - - * final.c: Include intl.h; do not include ctype.h. - (output_operand_lossage): Translate msgid arg. - - * fold-const.c (optimize_bit_field_compare, fold_truthop): Reword - messages to ease localization. - - * gcc.c: Include intl.h. - (my_strerror, snapshot_warning): Reword messages so that they do - not require localization. - (init_spec, set_spec, read_specs, execute, do_spec_1, main, - snapshot_warning): Invoke `notice' to localize notices. - (struct switchstr): Don't use `valid' as an identifier; it runs - afoul of SunOS 4.1.4 . All uses changed. - (do_spec_1): Treat %e string as msgid format, which needs - translation. - (main): Set message locale. - (pfatal_with_name): Invoke perror_with_name, not fatal, so that we - don't have to translate "%s: %s". - (perror_with_name): Invoke printf, not error, so that we don't - have to translate "%s: %s". - (pfatal_pexecute): Invoke pfatal_with_name, not fatal, so that we - don't have to translate "%s: %s". - (fatal, error): Translate msgid arg. - (notice): New function. - - * gcov.c: Include intl.h; include stdarg.h if __STDC__ is defined. - (main): Set message locale. - (fnotice): New function. - (xmalloc, fancy_abort, print_usage, open_files, read_files, - function_summary, output_data): Use it to to print diagnostics. - - * install.texi: Explain new configure options --enable-nls, - --with-included-gettext, --with-catgets. - - * integrate.c: Include intl.h. - (function_cannot_inline_p): Mark msgids with N_. - - * invoke.texi: Describe environment variables affecting locale. - - * pexecute.c: Include libintl.h if ENABLE_NLS, otherwise define - gettext to be a noop. - (_, N_): New macros. - (install_error_msg): Wrap inside N_. - (pexecute): Translate diagnostics. - - * protoize.c: Include intl.h. - (__attribute__): New macro. - (notice): New function. - (my_strerror): Reword message so that it does not require - localization. - (xmalloc, xrealloc, fancy_abort, safe_write, usage, - file_normally_convertible, abspath, find_file, aux_info_corrupted, - save_def_or_dec, gen_aux_info_file, process_aux_info_file, - rename_c_file, find_extern_def, find_static_definition, - declare_source_confusing, edit_fn_declaration, edit_formals_lists, - add_local_decl, add_global_decls, edit_fn_definition, - scan_for_missed_items, edit_file, main): Use `notice' to print - diagnostic. - (main): Set message locale. - - * real.c (NMSGS, ermsg): Remove. - (mtherr): Revamp to pass explicit strings to diagnostic - generators. Abort on invalid operations. - - * regclass.c (fix_register): Reword messages to ease localization. - - * toplev.c: Include intl.h; do not include ctype.h. - (v_really_sorry, really_sorry): Remove unused functions. - (count_error, fatal_io_error): Translate strings. - (default_print_error_function, report_error_function, main, - print_version): Reword messages to ease localization. Use - `notice' to translate diagnostics. - (vnotice, notice, fnotice): New functions. - (vmessage): Remove. - (v_message_with_file_and_line, vsorry): Translate msgid with - vnotice. - (v_message_with_file_and_line, v_message_with_decl): Use - report_file_and_line. Now takes int warning flag, not prefix; - this is easier to localize. All callers changed. - (v_message_with_decl): Abort if first format spec is neither %% - nor %s. Translate "((anonymous))". - (main): Set message locale. - (set_target_switch): Don't use `valid' as an identifier; it runs - afoul of SunOS 4.1.4 . - (__VERSION__): Reword message so that it does not require - localization. - (print_switch_values): Translate "options passed" and "options - enabled". - - * tree.c (valid_machine_attribute): Don't use `valid' as an - identifier; it runs afoul of SunOS 4.1.4 . - - * xcoffout.c (xcoff_output_standard_types): Use `error' to - output diagnostic, so that it gets translated. - - * patch-apollo-includes: Remove; this is part of README.APOLLO. - -Mon Jul 27 18:28:58 1998 Richard Kenner - - * reload.c (find_reloads): If no_input_reloads, abort if - reloads were made for addresses. - * m68k.md (sxx): Operand 0 cannot be memory. - -Fri Jul 17 07:31:04 1998 Andreas Schwab - - * m68k.c (output_move_simode_const): Use subl to move 0 into addr reg. - (output_move_[hq]imode): Likewise. - - * m68k.md (extend[sd]fxf2): Accept constants and general reg as - source operand if the destination is a floating point register. - -Fri Jul 17 07:23:49 1998 Herman ten Brugge - - * reorg.c (check_annul_list_true_false): New function. - (steal_delay_list_from_{target,fallthrough}): Call it and also - refine tests for when we may annul if already filled a slot. - (fill_slots_from_thread): Likewise. - (delete_from_delay_slot): Return newly-created thread. - (try_merge_delay_isns): Use its new return value. - -Sat Jul 4 11:07:33 1998 Eberhard Mattes - - * function.c (assign_parms): Handle PARALLEL which include stack. - -Sat Jul 4 09:44:29 1998 Paul Edwards - - * tree.c, print-tree.c, c-lang.c: Include stdio.h before tree.h. - * expr.c (bc_expand_component_address): Correct args to - bc_push_offset_and_size. - * reload1.c (reload_cse_simplify_operands): Add missing return value. - -Fri Jul 3 07:17:19 1998 Richard Kenner - - * alpha.c (normal_memory_operand): Handle case when REG will be - eliminated by reload. - -Thu Jul 2 18:43:53 1998 James Carlson - - * floatlib.c (HIDDEND_LL, MANTD_LL, PACKD_LL): New macros. - (__addsf3): Fixed cases returning wrong type and causing unintended - conversions and data corruption. - (__mulsf3): Fixed rounding flaws caused wrong scaling. - (__float{didf,sisf,disf},__fix{,uns}dfdi): New functions. - (__{gt,ge,lt,le,eq,ne}df2): Likewise. - (__truncdfsf2): Fixed normalization problems - (__fixunsdfsi): Fixed compiler warning - (__{add,sub,mul}df3): Rewrite to do real DP math. - (__divdf3): Removed previous version by Barrett Richardson. - -Thu Jul 2 17:57:20 1998 Douglas B. Rupp - - * cpperror.c: Include errno.h. - -Thu Jul 2 16:46:36 1998 Andreas Schwab - - * c-decl.c (grokdeclarator): Don't warn about implicit int in - `typedef foo = bar'. - -Tue Jun 30 18:32:49 1998 Geert Bosch - - * alpha/vxworks.h (LINK_SPEC): Add -taso -T 0. - -Tue Jun 30 09:39:32 1998 David Edelsohn - - * expr.c (expand_builtin_{set,long}jmp): If STACK_SAVEAREA_MODE - defined, override sa_mode using its value. - * explow.c (emit_stack_save): Likewise. - - * rs6000/aix41.h (ASM_CPU_SPEC): Define relative to ASM_DEFAULT_SPEC. - (CPP_CPU_SPEC): Define relative to CPU_DEFAULT_SPEC. - * rs6000.c (processor_target_table, 620): Don't affect MASK_POWERPC64. - (rs6000_override_options): Ignore flag_pic for AIX. - (rs6000_immed_double_const): Delete. - ({reg_or_u_short,u_short_cint}_operand): Don't assume 32-bit CONST_INT. - ({non_logical_cint,logical}_operand): Likewise. - (num_insns_constant): mask64_operand is 2 insns. - (easy_fp_constant): Any CONST_DOUBLE_HIGH is okay for 64-bit. - (mask_constant): HOST_WIDE_INT parameter. - (non_and_cint_operand): Delete. - ({mask,and}64_operand): New functions. - (function_arg{,_advance}): DImode arguments don't need special - alignment when 64-bit. - (setup_incoming_varargs): Reverse reg_size assignment. - (print_operand): HOST_WIDE_INT second parameter. - (print_operand, case 'B', 'S'): New cases. - (print_operand, case 'M'): Fix typo in lossage string. - (rs6000_stack_info): Reverse reg_size assignment. Use total_raw_size - to compute AIX push_p. Use reg_size to compute {cr,lr}_save_offset. - (rs6000_output_load_toc_table): Reverse init_ptr assignment. Use - TARGET_64BIT not TARGET_POWERPC64. Convert fprintf to fputs. - Load GOT highpart, don't add it. Add lowpart with {cal|la}. - (rs6000_allocate_stack_space): Use {cal|la}. - (output_epilog): Use {cal|la} - (output_function_profiler): Add call glue to mcount call. - Load GOT highpart, don't add it. Add lowpart with {cal|la}. - Use asm_fprintf and convert fprintf to fputs. - - * rs6000.h (TARGET_SWITCHES): Add powerpc64. - (STACK_BOUNDARY): Depend on TARGET_32BIT. - (ADJUST_FIELD_ALIGN): Calculate array alignment using innermost type. - (CONST_OK_FOR_LETTER_P): Don't assume 32-bit CONST_INT. - (EXTRA_CONSTRAINTS): Remove 'S' and 'T'. Replace 'S' with - 64-bit mask operand. - (RS6000_SAVE_TOC): Depend on TARGET_32BIT. - (STACK_SAVEAREA_MODE): New macro. - (LEGITIMATE_CONSTANT_P): DImode okay for 64bit. - (RTX_COSTS, AND/IOR/XOR): Reflect current machine description. - (ASM_FILE_START): Emit 64-bit ABI directive. - (ASM_DECLARE_FUNCTION_NAME): Align CSECT on doubleword in 64-bit mode. - (ASM_OUTPUT_SPECIAL_POOL_ENTRY): DImode okay for 64-bit. - (PREDICATE_CODES): Add "and64_operand" and "mask64_operand". - Delete "non_and_cint_operand". "input_operand" includes CONST_DOUBLE. - - * rs6000.md (iorsi3, xorsi3): Use HOST_WIDE_INT for mask. - Restore define_split. - (floatsidf2, floatunssidf2): Remove !TARGET_POWERPC64 final constraint. - (floatsidf2_internal, floatunssidf2_internal2): Likewise. - Do not specify base register operand mode. - (floatsidf2_loadaddr): Don't specify base register operand mode. - (floatsidf2_store1, floatsidf2_store2): Operand 1 must be base - register; do not specify mode. Remove !TARGET_POWERPC64 final - constraint. - (floatsidf2_load): Don't specify base register operand mode. - Remove !TARGET_POWERPC64 final constraint. - (fix_truncdfsi2_internal, fix_truncdfsi2_{store,load}): Don't specify - base register operand mode. - (mulsidi3): Add !TARGET_POWERPC64 constraint. - (adddi3): Split large constants early. - (absdi3): Shift by 63, not 31. - (rotldi3): Add masking combiner patterns. - (anddi3): Add rldic{r,l} masking. Remove split of large constants. - (iordi3, xordi3): Split large constants early. - (movsi matcher): Remove S and T constraints. - (movsf const_double): create SImode constant from TARGET_DOUBLE. - (movdf_hardfloat32): Add default abort case. - (movdf easy_fp_const): create DImode constant from TARGET_DOUBLE. - (movdi): Remove 64-bit constant generator. Try to convert - CONST_DOUBLE to CONST_INT. Handle TOC memory constants. - (movdi_32): Add default abort case. - (movdi_64): Add numerous ways to split 64-bit constants. - Make catch-all define_split more optimal and never FAIL. - (movti_ppc64): Add default abort case. - (allocate_stack): Remove operand modes; use Pmode. - (restore_stack_block): Remove operand modes. Generate Pmode - temporary. Generate MEM and specify mode. - (save_stack_nonlocal, restore_stack_nonlocal): Generate Pmode - temporary. Save area is double Pmode. - (call_indirect_aix64, call_value_indirect_aix64): New patterns. - (call, call_value): Do not specify address operand mode. Choose - appropriate AIX ABI. - (*call_local64, *ret_call_local64): New patterns. - (*call_nonlocal_aix64, *ret_call_nonlocal_aix64): New patterns. - (*ret_call_nonlocal_aix32): Use call_value_indirect for REG. - (compare): Materialize DImode truthvalues. - -Tue Jun 30 06:31:40 1998 Richard Henderson - - * alpha.h (PRINT_OPERAND_PUNCT_VALID_P): Add '`'. - * alpha.c (print_operand): Handle it. - * alpha.md (fix_truncdfsi2, fix_truncsfsi2): New patterns and - related define_splits. - -Tue Jun 30 06:02:07 1998 Richard Kenner - - * calls.c (emit_library_call{,_value}): Pass null - to REG_PARM_STACK_SPACE. - - * alpha.c (normal_memory_operand): New function. - * alpha.h (EXTRA_CONSTRAINT, case 'Q'): Call it. - - * fold-const.c (count_cond): New function. - (fold): Don't try to build COND_EXPR from binary op when both sides - are COND_EXPR unless not nested too deeply. - -Thu Jun 25 09:54:55 1998 Nick Clifton - - * arm.h (REG_ALLOC_ORDER): Add ARG_POINTER_REGNUM, noticed by - grahams@rcp.co.uk. - -Mon Jun 15 17:41:33 1998 Richard Kenner - - * reload1.c (reload): Issue guidance message on stack frame too large - for reliable stack check. - - * fold-const.c (fold_range_test): Prevent falling through with no ret. - -Sat Jun 13 15:49:53 1998 Carol LePage - - * configure.in (sparc-hal-solaris2*): New target. - * sparc/hal.h, sparc/t-halos: New files. - -Sat Jun 13 14:30:25 1998 David W. Schuler - - * i386/aix386ng.h (CPP_SPEC): Remove bogus quote. - -Sat Jun 13 14:16:34 1998 Andreas Schwab - - * regmove.c (try_auto_increment): Fix typo. - - * c-common.c (truthvalue_conversion): Protect side effects in the - expression when splitting a complex value. - * fold-const.c (fold): Likewise. - - * expr.c (do_jump, case EQ_EXPR, NE_EXPR): When comparing complex - prevent operands from being evaluated twice. - -Sat Jun 13 12:53:22 1998 Richard Earnshaw (rearnsha@arm.com) - - * unroll.c (verify_addresses): Use validate_replace_rtx to undo - changes; abort if undo fails. - -Sat Jun 13 11:46:38 1998 Anders Blomdell - - * flags.h (flag_volatile_static): Declare. - * toplev.c (flag_volatile_static): Define. - (f_options): Include -fvolatile-static. - * varasm.c (make_decl_rtl): Support -fvolatile-static. - -Sat Jun 13 08:26:21 1998 Richard Kenner - - * reload1.c (reload_cse_regno_equal_p): If -ffloat-store, don't - consider a MEM in FP mode as equal. - - * varasm.c (assemble_variable): Never put decl with specified section - name into bss. - - * output.h (current_function_addresses_labels): Declare. - * function.h (struct function): New field `addresses_labels'. - * function.c (current_function_addresses_labels): Define. - ({push,pop}_function_context): Save/restore it. - (init_function_start): Initialize it. - * rtl.h (FUNCTION_FLAGS_ADDRESSES_LABELS): New flag. - * expr.c (expand_expr, case LABEL_DECL): Show addresses labels. - * integrate.c (function_cannot_inline_p): Can't if addresses labels. - (initialize_for_inline): Save current_function_addresses_labels. - (output_inline_function): Restore it. - - * reload.c (find_reloads, case 'o'): All reloaded addresses - are offsettable. - (find_reloads_address): If replacing address, don't return 1. - - * profile.c (output_func_start_profiler): Add missing steps in - defining function. - -Fri Jun 12 17:10:16 1998 Richard Kenner - - * m68k.md (extendqidi2): Operand 1 must be in data register. - -Tue Jun 9 07:24:01 1998 Richard Kenner - - * cccp.c (handle_directive): If -dM, also include #undef. - * cpplib.c (handle_directive): Likewise. - - * calls.c (expand_call): Allow function pointer to be a REFERENCE_TYPE. - - * function.c (assign_parms): Use proper mode for location of arg - on stack when promotions are occurring. - - * regmove.c ({next,prev}_insn_for_regmove): Properly handle end of - function. - -Mon Jun 8 15:26:49 1998 Juha Sarlin - - * h8300.c (get_shift_alg): Add special cases for shifts of 8 and 24. - -Mon Jun 8 14:40:02 1998 John Wehle (john@feith.com) - - * i386.md (movsf_push, movsf_mem): Remove. - (movsf_push): Rename from movsf_push_nomove and move in front of - movsf; allow memory operands during and after reload. - (movsf_push_memory): New pattern. - (movsf): Don't bother checking for push_operand. If TARGET_MOVE and - both operands refer to memory then force operand[1] into a register. - (movsf_normal): Change to unnamed pattern. - Likewise for movdf, movxf, and friends. - -Mon Jun 8 13:18:04 1998 Martin v. Loewis - - * Makefile.in (TREE_H): Add tree-check.h. - (tree-check.h, s-check, gencheck): New targets. - (STAGESTUFF): Add s-check. - * gencheck.c: New file. - * tree.c (tree_check, tree_class_check, expr_check): New functions. - * tree.h (TREE_CHECK, TREE_CLASS_CHECK): Define. - (TYPE_CHECK, DECL_CHECK): Define. - Modify all access macros to use generated checking macros. - * acconfig.h (ENABLE_CHECKING): Undefine. - * configure.in (--enable-checking): New option. - -Mon Jun 8 12:13:25 1998 Richard Kenner - - * regmove.c: Remove include for varargs or stdarg. - -Mon Jun 8 07:49:41 1998 Andris Pavenis - - * gcc.c (link_command_spec): Support LINK_COMMAND_SPEC. - -Sun Jun 7 18:00:28 1998 Andreas Schwab - - * fold-const.c (fold, case EQ_EXPR): When folding VAR++ == CONST - or VAR-- == CONST construct a proper mask if VAR is a bitfield. - Cope with CONST being out of range for the bitfield. - -Sun Jun 7 17:19:35 1998 Tom Quiggle - - * mips/iris6.h (DWARF2_FRAME_INFO): Define. - * dwarf2out.c (dwarf2out_do_frame): Do something if DWARF2_FRAME_INFO. - -Sun Jun 7 15:29:04 1998 Andreas Schwab - - * regmove.c: New file. - * Makefile.in (OBJS): Add regmove.o. - (regmove.o): New rules. - (mostlyclean): Remove regmove dumps. - * toplev.c (regmove_{dump,dump_file,time}, flag_regmove): New vars. - (f_options): Add -foptimize-register-move. - (compile_file): Run regmove pass after combine pass and do its dump. - (main): Enable regmove dump when -dN or -da. - (fatal_insn): Flush regmove dump file. - * flags.h (flag_regmove): Declare. - * flow.c (find_use_as_address): Export. - * rtl.h (find_use_as_address): Declare. - * local-alloc.c (optimize_reg_copy_{1,2}): Removed, all calls deleted. - * reload1.c (count_occurrences): Export. - * reload.h (count_occurrences): Declare. - -Sun Jun 7 09:30:31 1998 Richard Kenner - - * Makefile.in (uninstall): Uninstall gcov. - - * alpha.h (ASM_COMMENT_START): Define. - - * alpha.h (EXTRA_CONSTRAINT, case 'S'): New case. - * alpha.md ({ashl,ashr,lshr}di3): Use 'S' for constraint. - - * i386.md (cmpxf): Add missing extend pattern from SFmode and fix - operand numbers in one extend pattern from DFmode. - - * pa.md ({pre,post}_{ld,st}wm and similar): When operand is being - incremented, use '+', not '=', for constraint. - - * reload.c (find_reloads): Give preference to pseudo that was the - reloaded output of previous insn. - - * emit-rtl.c (init_emit_once): Provide default for DOUBLE_TYPE_SIZE. - - * expr.c (init_expr_once): Free all RTL we generate here. - * expmed.c (init_expmed): Allocate all RTX in memory we'll free. - - * genemit.c (main): Generate #include "reload.h". - - * expr.c (expand_expr, case INDIRECT_EXPR): A dereference of - a REFERENCE_TYPE is always considered in a structure. Likewise for - a dereference of a NOP_EXPR whose input is a pointer to aggregate. - -Sat Jun 6 17:25:14 1998 Richard Kenner - - * mips.md (reload_{in,out}di): Allow other operand to be invalid - MEM and get any reload replacement before using address. - -Tue May 26 18:52:23 1998 Richard Kenner - - * reload1.c (reload): Get MEM_IN_STRUCT_P and RTX_UNCHANGING_P - from reg_equiv_memory_loc; set the latter when changing REG to MEM. - (alter_reg): Don't set RTX_UNCHANGING_P for shared slots. - -Mon May 25 12:07:12 1998 Hans-Peter Nilsson - - * cplus-dem.c (MBUF_SIZE): Bumped from 512 to 32767. - -Sun May 24 21:50:12 1998 Alan Modra - - * i386/linux{,-aout,oldld}.h (ASM_COMMENT_START): Define. - -Sun May 24 11:58:37 1998 Andreas Schwab - - * m68k.md (adddi3, subdi3): Properly negate the DImode constant. - -Sun May 24 11:30:08 1998 Torbjorn Granlund - - * m68k/lb1sf68.asm (__addsf3): Fix typo in exg on coldfire. - -Sun May 24 09:38:17 1998 John Wehle (john@feith.com) - - * i386.md (movsi): Remove redundant integer push patterns. - Don't check for TARGET_PUSH_MEMORY when pushing constants or registers. - -Sun May 24 08:59:27 1998 Richard Kenner - - * fold-const.c (fold, case EQ_EXPR): Split COMPLEX_TYPE operands - if either is COMPLEX_CST in addition to COMPLEX_EXPR. - - * expr.c (do_jump, case EQ_EXPR, case NE_EXPR): Check for COMPLEX - before testing for operand 1 being zero. - - * genattrtab.c (optimize): Define. - - * configure.lang: Fix substitution of target_alias. - -Sat May 23 22:31:17 1998 Michael P. Hayes - - * emit_rtl.c (double_mode): New variable. - (init_emit_once): Set and use it. - * real.c (ereal_atof, real_value_truncate): Handle double_mode not - being DFmode for C4x. - -Sat May 23 22:19:55 1998 Mike Stump - - * expr.c (expand_builtin_setjmp): Handle BUILTIN_SETJMP_FRAME_VALUE. - * i960.h (SETUP_FRAME_ADDRESSES, BUILTIN_SETJMP_FRAME_VALUE): Define. - * i960.md (ret, flush_register_windows): Define. - (nonlocal_goto): Likewise. Nested function nonlocal gotos don't - work yet. - -Sat May 23 18:45:59 1998 Andreas Schwab - - * m68k/t-linux: Remove stuff already included in config/t-linux. - -Sat May 23 18:35:07 1998 Richard Kenner - - * final.c: Select and "gstab.h" with NO_STAB_H. - - * gcc.c (default_compilers): Remove ".ada" extension. - - * combine.c (rtx_equal_for_field_assignment): Remove code that - checks get_last_value. - - * Makefile.in (uninstall): Delete info files. - -Sat May 23 18:28:27 1998 Herman A.J. ten Brugge - - * c-decl.c (start_decl): Use new macro SET_DEFAULT_DECL_ATTRIBUTES. - * c-lex.c (check_newline): Put last read character back on input - stream. - -Sat May 23 18:13:53 1998 David Edelsohn - - * rs6000.md (floatsidf2_loadaddr): rs6000_fpmem_offset will be - negative in a stackless frame. - * rs6000.c (rs6000_stack_info): Don't include fixed-size link area - in stackless frame size. Support 64-bit stackless frame size. - Combine fpmem offset calculations and don't add total_size to - offset if not pushing a stack frame. - - * tree.c (get_inner_array_type): New function. - * tree.h (get_inner_array_type): Likewise. - -Wed May 20 15:42:22 1998 Richard Kenner - - * expmed.c (expand_divmod): Save last divison constant and - if rem is same as div, don't adjust rem cost. - -Thu May 14 14:11:37 1998 Richard Kenner - - * alpha/vxworks.h: New file. - * configure.in (alpha*-*-vxworks*): New target. - - * alpha.c (tree.h): Include earlier. - (alpha_initialize_trampoline): New function. - * alpha.h (INITIALIZE_TRAMPOLINE): Call it. - * alpha/linux.h (INITIALIZE_TRAMPOLINE): Don't redefine. - -Thu May 14 13:35:53 1998 Cyrille Comar - - * Makefile.in (STAGESTUFF): Add s-under. - -Wed May 13 17:38:35 1998 Richard Kenner - - * combine.c (simplify_comparison, case AND): Don't commute AND - with SUBREG if constant is whole mode and don't do if lowpart - and not WORD_REGISTER_OPERATIONS. - - * expmed.c (expand_mult): Use 0 as add_target if should preserve - subexpressions. - -Mon May 11 17:26:06 1998 Paul Eggert - - * dwarf2out.c: Undo most recent change. - -Sun May 10 17:09:20 1998 Richard Kenner - - * fold-const.c (fold_range_test, fold): If need to make SAVE_EXPR - to do optimization, suppress if contains_placeholder_p. - -Thu May 7 18:14:31 Paul Eggert - - * dwarf2out.c: Don't assume `.section ".text"' causes assembler to - treat .text as label for start of section; instead, output - `.section ".text"; .LLtext0:' and use .LLtext0 in label contexts. - (ABBREV_LABEL, DEBUG_INFO_LABEL, DEBUG_LINE_LABEL, TEXT_LABEL): New. - (abbrev_label, debug_info_label, debug_line_label, text_label): New. - (dwarf2out_init): Initialize the vars. Output defn for text_label. - (dwarf2out_finish): Output defns for the other 3 vars. - (dw_val_node): Rename val_section to val_section_label, as it's - now a label, not a section. - (add_AT_section_offset): Arg is now a label, not a section. - (print_die): In label contexts, output section label, not section. - (output_die, output_compilation_unit_header): Likewise. - (output_{pubnames,aranges,line_info}, dwarf2out_finish): Likewise. - - * fixinc.wrap: Renamed from fixinc.math. Put wrapper around - curses.h if it contains `typedef char bool;'. - - * configure.in (arm-*-netbsd*): Rename fixinc.math to fixinc.wrap. - (i[34567]86-*-freebsdelf*, i[34567]86-*-freebsd*): Likewise. - (i[34567]86-*-netbsd*, i[34567]86-*-solaris2*): Likewise. - (m68k-*-netbsd*, mips-dec-netbsd*, ns32k-pc532-netbsd*): Likewise. - (powerpcle-*-solaris2*, sparc-*-netbsd*, sparc-*-solaris2*): Likewise. - (vax-*-netbsd*): Likewie. - -Wed May 6 06:44:28 1998 Richard Kenner - - * combine.c (simplify_rtx, case TRUNCATE): Reflect that it sign-extends - instead of zero-extending. - -Sat May 2 20:39:22 1998 Richard Kenner - - * fold-const.c (fold): When commutting COND_EXPR and binary operation, - avoid quadratic behavior if have nested COND_EXPRs. - -Tue Apr 28 17:30:05 1998 Richard Kenner - - * mips.h (HOST_WIDE_INT): Define if not already. - (compute_frame_size, mips_debugger_offset): Return HOST_WIDE_INT. - (DEBUGGER_{AUTO,ARG}_OFFSET): Cast second arg to HOST_WIDE_INT. - * mips.c (mips_debugger_offset): Now returns HOST_WIDE_INT. - Likewise for internal variable frame_size. - - * final.c (alter_subreg): Make new SUBREG if reload replacement - scheduled inside it. - - * dwarf2out.c (add_bound_info, case SAVE_EXPR): Pass - SAVE_EXPR_RTL address through fix_lexical_addr. - -Mon Apr 27 18:57:18 1998 Jim Wilson - - * mips/sni-svr4.h (CPP_PREDEFINES): Add -Dsinix and -DSNI. - -Mon Apr 20 14:48:29 1998 Michael Meissner - - * rs6000.md (mov{sf,df} define_splits): When splitting move of - constant to int reg, don't split insns that do simple AND and OR - operations; just split each word and let normal movsi define split - handle it further. - -Sun Apr 19 20:21:19 1998 Michael P. Hayes - - * real.h (C4X_FLOAT_FORMAT): New macro. - * real.c (c4xtoe, etoc4x, toc4x): New functions. - -Sun Apr 19 20:17:32 1998 Niklas Hallqvist - - * m68k.c (notice_update_cc): Use modified_in_p to check for update. - -Sun Apr 19 18:48:07 1998 K. Richard Pixley - - * fixincludes: Discard empty C++ comments. - Special case more files with C++ comments nested in C comments. - -Sun Apr 19 18:30:11 1998 Andreas Schwab - - * m68k.md ({add,sub}di3): Optimize for constant operand. - -Sun Apr 19 18:27:11 1998 Alan Modra - - * i386.c (output_387_binary_op): Swap operands when popping if result - is st(0). - -Sun Apr 19 17:58:01 1998 Peter Jeremy - - * expr.c (do_jump_by_parts_equality_rtx): Now public. - * expmed.c (do_cmp_and_jump): New function. - (expand_divmod): Use do_cmp_and_jmp instead of emit_cmp_insn and - emit_jump_insn. - -Sun Apr 19 07:48:37 1998 Richard Kenner - - * c-typeck.c (build_c_cast): Check underlying type when seeing - if discarding const or volatile. - - * c-decl.c (pushdecl): Avoid duplicate warning about implicit redecl. - - * configure.in (stab.h): Check for it. - (i386-*-vsta): Include xm-i386.h too. - * dbxout.c (stab.h): Include based on autoconf results. - * vax/xm-vms.h (NO_STAB_H): Deleted. - * alpha/xm-vms.h, xm-mips.h, i386/xm-mingw32.h, i386/go32.h: Likewise. - * i386/xm-cygwin32.h: Likewise. - * i386/xm-vsta.h (NO_STAB_H): Likewise. - (i386/xm-i386.h): No longer include. - - * mips.c: Cleanups and reformatting throughout. - ({expand,output}_block_move): Use HOST_WIDE_INT for sizes. - (mips_debugger_offset, compute_frame_size): Likewise. - (save_restore_insns, mips_expand_{pro,epi}logue): Likewise. - (siginfo): Deleted. - (override_options): Don't set up to call it; don't call setvbuf. - -Mon Apr 13 06:40:17 1998 Richard Kenner - - * configure.in (sparc-*-vxsim*): Include xm-siglist.h and - define USG and POSIX. - -Sun Apr 12 21:59:27 1998 Jeffrey A. Law - - * calls.c (expand_call): Fix typo in STRICT_ARGUMENT_NAMING. - -Sun Apr 12 21:42:23 1998 D. Karthikeyan - - * m68k.h (TARGET_SWITCHES): Add missing comma. - -Sun Apr 12 21:33:33 1998 Eric Valette - - * configure.in (i[34567]86-*-rtemself*): New configuration. - * i386/rtemself.h: New file. - -Sun Apr 12 21:08:28 1998 Jim Wilson - - * loop.c (loop_optimize): Reset max_uid_for_loop after - find_and_verify_loops call. - (strength_reduce): In auto_inc_opt code, verify v->insn has valid - INSN_LUID. - -Sun Apr 12 20:54:59 1998 Richard Earnshaw (rearnsha@arm.com) - - * configure.in (sparc-*-solaris2*): Add xm-siglist.h to xm_file. - Add USG and POSIX to xm_defines. - -Sun Apr 12 20:47:37 1998 Pat Rankin - - * cccp.c (eprint_string): New function. - (do_elif, do_else, verror): Use it instead of fwrite(,,,stderr). - (error_from_errno, vwarning): Likewise. - ({verror,vwarning,pedwarn}_with_line): Likewise. - (pedwarn_with_file_and_line, print_containing_files): Likewise. - -Sun Apr 12 20:40:44 1998 Richard Henderson - - * configure.in (alpha*-*-linux-gnu*): Add alpha/t-crtbe. - Add crt{begin,end}.o in extra_parts and delete crt{begin,end}S.o.o - * alpha/t-crtbe, alpha/crt{begin,end}.asm: New files. - - * alpha.h (PRINT_OPERAND_PUNCT_VALID_P): Accept '(' for s/sv/svi. - * alpha.c (print_operand): Handle it. - * alpha.md (fix_trunc[ds]fdi2): Use it. Add earlyclobber pattern - for ALPHA_TP_INSN. - -Sun Apr 12 13:09:46 1998 Scott Christley - - * objc/encoding.c (objc_sizeof_type, _C_VOID): New case. - -Sun Apr 12 13:04:55 1998 Nikolay Yatsenko (nikolay@osf.org) - - * configure.in (i[34567]86-*-osf1*): New entry. - * i386/osf1-c[in].asm: New files for OSF/1. - * i386/osf1elf{,gdb}.h, i386/[xt]-osf1elf, i386/xm-osf1elf.h: Likewise. - -Sun Apr 12 10:03:51 1998 Noel Cragg - - * fixincludes: Remove specification of parameters when renaming - functions in Alpha DEC Unix include files. - -Sun Apr 12 07:33:46 1998 Richard Kenner - - * mips.c (large_int): Use HOST_WIDE_INT, not int. - (print_operand): Use HOST_WIDE_INT_PRINT_* macros. - - * toplev.c (main): Sort order of handling of -d letters. - Use `F' instead of `D' for addressof_dump. - - * libgcc2.c (_eh_compat): Deleted. - * Makefile.in (LIB2FUNCS): Delete _eh_compat. - - * configure.in (alpha*-*-linux-gnu*): Don't include alpha/xm-linux.h. - - * c-common.c (check_format_info): Properly test for nested pointers. - - * pa.md (casesi0): Add missing mode for operand 0. - - * function.c (purge_addressof_1, case MEM): If BLKmode, put ADDRESSOF - into stack. - - * c-parse.in (label): Give warning if pedantic and label not integral. - - * c-decl.c (grokdeclarator): Don't warn about return type if in - system header. - - * reload.c (reload_nongroup): New variable. - (push{_secondary,}_reload): Initialize it. - (find_reloads): Compute it. - (debug_reload): Print it. - * reload.h (reload_nongroup): Declare. - * reload1.c (reload): Use reload_nongroup instead of local computation. - Check caller_save_spill_class against any nongroup reloads. - (reloads_conflict): No longer static. - -Sun Apr 12 05:52:18 1998 John David Anglin - - * vax.md (call patterns): Operand 1 is always a CONST_INT. - -Sat Apr 11 16:01:11 1998 Richard Kenner - - * convert.c (convert_to_{pointer,integer,real,complex}): Use switch. - Add missing integer-like types. - Simplify return of zero in error case. - (convert_to_pointer): Remove dubious abort. - (convert_to_integer, case POINTER_TYPE): Make recursive call. - (convert_to_integer, case COND_EXPR): Always convert arms. - * tree.c (type_precision): Deleted. - - * cccp.c (do_warning): Give pedantic warning if -pedantic and not - in system file. - * cpplib.c (do_warning): Likewise. - - * function.c (target_temp_slot_level): Define here. - (push_temp_slots_for_target, {get,set}_target_temp_slot_level): New. - * stmt.c (target_temp_slot_level): Don't define here. - * expr.h (temp_slot_level): New declaration. - -Fri Apr 10 16:35:48 1998 Paul Eggert - - * c-common.c (decl_attributes): Support strftime format checking. - (record_function_format, {check,init_function}_format_info): Likewise. - (enum format_type): New type. - (record_function_format): Now static; takes value of type - enum format_type instead of int. - (time_char_table): New constant. - (struct function_format_info): format_type member renamed from is_scan. - (check_format_info): Use `warning' rather than sprintf followed by - `warning', to avoid mishandling `%' in warnings. - Change a `pedwarn' to `warning'. - * c-tree.h (record_function_format): Remove decl. - -Thu Apr 2 17:34:27 1998 Manfred Hollstein - - * regclass.c (memory_move_secondary_cost): Protect uses of - SECONDARY_{INPUT,OUTPUT}_RELOAD_CLASS with #ifdef tests. - -Thu Apr 2 07:06:57 1998 Andreas Schwab - - * m68k.c (standard_68881_constant_p): Don't use fmovecr on 68060. - -Thu Apr 2 06:19:25 1998 Ken Raeburn - - * Makefile.in (version.c): Put "cvs log" output in build directory. - - * reload.h (MEMORY_MOVE_COST): Define here if not already defined. - (memory_move_secondary_cost): Declare. - * regclass.c (MEMORY_MOVE_COST): Don't define default here. - (memory_move_secondary_cost) [HAVE_SECONDARY_RELOADS]: New function. - (regclass, record_reg_classes, copy_cost, record_address_regs): - Pass register class and direction of move to MEMORY_MOVE_COST. - (top_of_stack) [HAVE_SECONDARY_RELOADS]: New static array. - (init_regs) [HAVE_SECONDARY_RELOADS]: Initialize it. - * reload1.c (MEMORY_MOVE_COST): Don't define default here. - (emit_reload_insns, reload_cse_simplify_set): Pass register class - and direction of move to MEMORY_MOVE_COST. - * 1750a.h (MEMORY_MOVE_COST): Add extra ignored arguments. - * a29k.h, alpha.h, arc.h, arm.h, dsp16xx.h, i386.h, m32r.h: Likewise. - * m88k.h, rs6000.h: Likewise. - * mips.h (MEMORY_MOVE_COST): Likewise. - Add memory_move_secondary_cost result to cpu-specific cost. - -Mon Mar 30 13:56:30 1998 Jim Wilson - - * mips/ultrix.h (SUBTARGET_CPP_SPEC): Define. - -Wed Mar 25 16:09:01 1998 Michael Meissner - - * rs6000.h (FUNCTION_ARG_PADDING): Cast result to be enum direction. - (function_arg_padding): Declare. - - * rs6000.c: Include stdlib.h if we have it. - (function_arg_padding): Change return type to int, cast enum's to int. - - (From Kaveh R. Ghazi ) - * rs6000.c (rs6000_override_options): Change type of `i', `j' and - `ptt_size' from int to size_t. - (rs6000_file_start): Likewise for `i'. - (rs6000_replace_regno): Add default case in enumeration switch. - (output_epilog): Remove unused variable `i'. - (rs6000_longcall_ref): Remove unused variables `len', `p', `reg[12]'. - - * rs6000.h (ADDITIONAL_REGISTER_NAMES): Add missing braces around - initializer. - (get_issue_rate, non_logical_cint_operand): Add prototype. - (rs6000_output_load_toc_table): Likewise. - - * rs6000.md (udivmodsi4): Add explicit braces to avoid ambiguous - `else'. - -Wed Mar 25 02:39:01 1998 Paul Eggert - - * configure.in (i[34567]86-*-solaris2*, powerpcle-*-solaris2*, - sparc-*-solaris2*): Use fixinc.svr4 if Solaris 2.0 through 2.4. - -Mon Mar 23 07:27:19 1998 Philippe De Muyter - - * m68k.md (ashldi_const): Allow shift count in range ]32,63]. - (ashldi3): Allow constant shift count in range ]32,63]. - (ashrdi_const, ashrid3, lshrdi_const, lshrdi3): Likewise. - - * m68k.md (zero_extend[qh]idi2, iordi_zext): New patterns. - (zero_extendsidi2): Avoid useless copy. - (iorsi_zexthi_ashl16): Avoid "0" constraint for operand 2. - (iorsi_zext): New name for old unnamed pattern; indentation fixes. - -Mon Mar 23 07:12:05 1998 Richard Kenner - - * final.c (only_leaf_regs_used): If pic_offset_table_rtx used, - make sure it is a permitted register. - -Sun Mar 22 06:57:04 1998 Richard Kenner - - * expmed.c (extract_bit_field): Don't confuse SUBREG_WORD with - endian adjustment in SUBREG case. - Don't abort if can't make SUBREG needed for extv/extzv. - -Sat Mar 21 08:02:17 1998 Richard Gorton - - * alpha.md (zero_extendqi[hsd]i2): Use "and", not "zapnot". - -Sat Mar 21 07:47:04 1998 Richard Kenner - - * unroll.c (verify_addresses): Use validate_replace_rtx. - (find_splittable_givs): If invalid address, show nothing same_insn. - -Fri Mar 20 10:24:12 1998 Philippe De Muyter - - * fold-const.c (fold, case CONVERT_EXPR): Replace sign-extension of - a zero-extended value by a single zero-extension. - -Thu Mar 19 14:59:32 1998 Andrew Pochinsky - - * sparc.h (ASM_OUTPUT_LOOP_ALIGN): Fix error in last change. - -Thu Mar 19 14:48:35 1998 Michael Meissner - - * gcc.c (default_arg): Don't wander off the end of allocated memory. - - * rs6000/sysv4.h (RELATIVE_PREFIX_NOT_LINKDIR): Undef for System V - and EABI. - -Thu Mar 19 06:17:59 1998 Richard Kenner - - * Makefile.in (toplev.o): Depend on Makefile. - -Wed Mar 18 17:40:09 1998 Michael P. Hayes - - * expr.c (convert_move): Add [QH]Imode/P[QH]Imode conversions. - * machmode.def (PQImode, PHImode): New modes. - -Wed Mar 18 17:11:18 1998 Andreas Schwab - - * m68k.md (movsf+1): Optimize moving a CONST_DOUBLE zero. - -Wed Mar 18 17:07:54 1998 Ken Raeburn - - * regclass.c (init_reg_sets): Delete init of reg-move cost tables. - (init_reg_sets_1): Put it here. - -Wed Mar 18 16:43:11 1998 Jim Wilson - - * i960.md (tablejump): Handle flag_pic. - - * profile.c (branch_prob): If see computed goto, call fatal. - - * calls.c (expand_call): Fix typos in n_named_args computation. - -Wed Mar 18 05:54:25 1998 Richard Kenner - - * fold-const.c (operand_equal_for_comparison_p): See if equal - when nop conversions are removed. - - * expr.c (expand_expr, case COND_EXPR): If have conditional move, - don't use ORIGINAL_TARGET unless REG. - - * function.c (fixup_var_refs_insns): Also delete insn storing pseudo - back into arg list. - - * combine.c (gen_binary): Don't make AND that does nothing. - (simplify_comparison, case AND): Commute AND and SUBREG. - * i386.h (CONST_CONSTS, case CONST_INT): One-byte integers are cost 0. - -Mon Mar 16 15:57:17 1998 Geoffrey Keating - - * rs6000.c (small_data_operand): Ensure any address referenced - relative to small data area is inside SDA. - -Sun Mar 15 16:01:19 1998 Andrew Pochinsky - - * sparc.h (ASM_OUTPUT_LOOP_ALIGN): Write nop's. - -Sun Mar 15 15:53:39 1998 Philippe De Muyter - - * libgcc2.c (exit): Don't call __bb_exit_func if HAVE_ATEXIT. - -Sun Mar 15 15:44:41 1998 Paul Eggert - - * cccp.c: Fix bugs relating to NUL in input file name, - e.g. with `#line 2 "x\0y"'. - (PRINTF_PROTO_4): New macro. - (struct {file_buf,definition,if_stack}): New member nominal_fname_len. - (main, expand_to_temp_buffer): Store length of input file names. - (finclude, create_definition, do_line, conditional_skip): Likewise. - (skip_if_group, macroexpand): Likewise. - (make_{definition,undef,assertion}): Likewise. - (special_symbol, do_include): Use stored length of input file names. - (do_define, do_elif, do_else, output_line_directive, verror): Likewise. - (error_from_errno, vwarning, verror_with_line): Likewise. - (vwarning_with_line, pedwarn_with_file_and_line): Likewise. - (print_containing_files): Likewise. - (do_line): Fix off-by-1 problem: 1 too many bytes were being allocated. - (quote_string, pedwarn_with_file_and_line): New arg specifies length. - All callers changed. - -Sun Mar 15 15:38:16 1998 Andreas Schwab - - * c-typeck.c: Collect pending initializers in AVL tree instead of list. - (add_pending_init, pending_init_member): New functions. - (output_init_element): Use them. - (output_pending_init_elements): Rewritten to exploit AVL order. - -Sun Mar 15 05:10:49 1998 Richard Kenner - - * gnu.h (GNU_CPP_PREDEFINES): Deleted; not valid in traditional C. - * {i386,mips}/gnu.h (CPP_PREDEFINES): Don't call GNU_CPP_PREDEFINES. - - * flow.c (insn_dead_p): A CLOBBER of a dead pseudo is dead. - - * alpha.h (REG_ALLOC_ORDER): Put $f1 after other nonsaved. - - * sparc.c (sparc_type_code): Fix error in previous change. - -Sat Mar 14 05:45:21 1998 Richard Kenner - - * i386/xm-aix.h, i386/xm-osf.h (i386/xm-i386.h): Don't include. - (USG): Don't define. - * i386/xm-isc.h (i386/xm-sysv3.h): Don't include. - * i386/xm-sco.h (i386/xm-sysv3.h): Likewise. - (BROKEN_LDEXP, SMALL_ARG_MAX, NO_SYS_SIGLIST): Don't define. - * m68k/xm-3b1.h (m68k/xm-m68k.h): Don't include. - (USG): Don't define. - * m68k/xm-atari.h (m68k/xm-m68kv.h): Don't include. - (HAVE_VPRINTF, FULL_PROTOTYPES): Don't define. - * m68k/xm-crds.h (m68k/xm-m68k.h): Don't include. - (USE_C_ALLOCA, unos, USG): Don't define. - * m68k/xm-mot3300.h (m68k/xm-m68k.h): Don't include. - (USE_C_ALLOCA, NO_SYS_SIGLIST): Don't define. - * m68k/xm-plexus.h (m68k/xm-m68k.h): Don't include. - (USE_C_ALLOCA, USG): Don't define. - * m88k/xm-sysv3.h (m88k/xm-m88k.h): Don't include. - * m68k/xm-next.h (m68k/xm-m68k.h): Don't include. - * ns32k/xm-pc532-min.h (ns32k/xm-ns32k.h): Don't include. - (USG): Don't define. - * rs6000/xm-mach.h: Don't include xm-rs6000.h. - * rs6000/xm-cygwin32.h (rs6000/xm-rs6000.h): Don't include. - (NO_STAB_H): Don't define. - * sparc/xm-linux.h (xm-linux.h): Don't include. - * sparc/xm-sol2.h (sparc/xm-sysv4.h): Don't include. - * a29k/xm-unix.h, alpha/xm-linux.h, arm/xm-linux.h: Deleted. - * arm/xm-netbsd.h, i386/xm-bsd386.h, i386/xm-gnu.h: Deleted. - * i386/xm-linux.h, i386/xm-sun.h, i386/xm-sysv3.h: Deleted. - * i386/xm-winnt.h, m68k/xm-altos3068.h, m68k/xm-amix.h: Deleted. - * m68k/xm-amix.h, m68k/xm-hp320.h, m68k/xm-linux.h: Deleted. - * m68k/xm-m68kv.h, mips/xm-iris5.h, ns32k/xm-genix.h: Deleted. - * sparc/xm-pbd.h, vax/xm-vaxv.h, xm-svr3.h, xm-linux.h: Deleted. - * configure.in: Reflect above changes. - - * xm-siglist.h, xm-alloca.h: New files. - * i386/xm-sysv4.h (i386/xm-i386.h, xm-svr4.h): Don't include. - (USE_C_ALLOCA, SMALL_ARG_MAX): Don't define. - * i386/xm-sco5.h (i386/xm-sysv3.h): Don't include. - (SYS_SIGLIST_DECLARED, USE_C_ALLOCA): Don't define. - * rs6000/xm-sysv4.h, sparc/xm-sysv4.h: Don't include xm-svr4.h. - * xm-svr4.h, i386/xm-dgux.h, mips/xm-news.h, mips/xm-sysv4.h: Deleted. - * configure.in: Reflect above changes. - - * configure.in ({,host_,build_}xm_defines): New variables. - Set to USG instead of including xm-usg.h. - Write #define lines in config.h files from xm_defines vars. - * xm-usg.h: Deleted. - -Fri Mar 13 07:10:59 1998 Richard Kenner - - * calls.c (expand_call): Fix typo in previous change. - - * sparc.c (sparc_type_code): Avoid infinite loop when have - pointer to array of same pointer. - (sparc_type_code, case REAL_TYPE): Process subtypes here too. - - * mips/bsd-4.h, mips/iris3.h, mips/news{4,5}.h: Don't include mips.h. - * mips/news5.h, mips/osfrose.h, mips/svr{3,4}-4.h: Likewise. - * mips/ultrix.h: Likewise. - * mips/cross64.h: Don't include iris6.h. - * mips/ecoff.h: Don't include mips.h or gofast.h. - * mips/elforion.h: Don't include elf64.h. - * mips/iris4.h: Don't include iris3.h. - * mips/iris4loser.h: Don't include iris4.h. - * mips/iris5gas.h: Don't include iris5.h. - * mips/elflorion.h, mips/nws3250v4.h, mips/xm-iris{3,4}.h: Deleted. - * mips/xm-nws3250v4.h, mips/xm-sysv.h: Deleted. - * mips/rtems64.h: Don't include elflorion.h. - * mips/sni-gas.h: Don't include sni-svr4.h. - * mips/svr4-t.h: Don't include svr4-5.h. - * mips/dec-osf1.h: Also include mips.h. - * mips/ecoffl.h, mips/elf.h: Also include mips.h and gofast.h. - * mips/iris5.h: Also include iris3.h and mips.h. - * xm-usg.h: New file. - * mips/xm-iris5.h: Don't include xm-mips.h; don't define USG. - * mips/xm-news.h, mips/xm-sysv4.h: Don't include xm-sysv.h. - * configure.in: Reflect above changes. - -Thu Mar 12 07:18:48 1998 Richard Kenner - - * expr.h (STRICT_ARGUMENT_NAMING): Provide default value of 0. - * calls.c (expand_call): Use value of STRICT_ARGUMENT_NAMING. - * function.c (assign_parm): Likewise. - * mips/abi64.h (STRICT_ARGUMENT_NAMING): Return 0 for ABI_32. - * sparc.h (STRICT_ARGUMENT_NAMING): Only nonzero for V9. - - * calls.c (expand_call, expand_library_call{,_value}, store_one_arg): - Rework handling of REG_PARM_STACK_SPACE to treat return value of - zero as if macro not defined; add new arg to emit_push_insn. - * expr.c (emit_push_insn): New arg, REG_PARM_STACK_SPACE. - * expr.h (emit_push_insn): Likewise. - * mips/abi64.h (REG_PARM_STACK_SPACE): Define. - -Wed Mar 11 06:58:13 1998 Andreas Schwab - - * m68k.h (CONST_OK_FOR_LETTER_P, case 'M'): Correct range check. - -Wed Mar 11 06:15:52 1998 Richard Kenner - - * expr.c (emit_push_insn): Use loop to find movstr patterns - instead of explicit tests. - - * Makefile.in (extraclean): Don't delete install1.texi. - -Tue Mar 10 14:27:51 1998 Richard Kenner - - * combine.c (make_field_assignment): Don't get confused if OTHER - has VOIDmode and don't do anything if DEST is wider than a host word. - - * vax.c (check_float_value): Cast bcopy args to char *. - -Tue Mar 10 13:56:12 1998 Jim Wilson - - * mips/abi64.h (LONG_MAX_SPEC): Check MIPS_ABI_DEFAULT and - TARGET_DEFAULT and define __LONG_MAX__ appropriately. - Add support for -mabi=X, -mlong64, and -mgp{32,64} options. - * mips.c (mips_abi): Change type to int. - * mips.h (enum mips_abi_type): Delete. - (ABI_32, ABI_N32, ABI_64, ABI_EABI): Define as constants. - (mips_abi): Change type to int. - -Mon Mar 2 08:06:58 1998 Richard Kenner - - * Version 2.8.1 released. - - * Makefile.in (mostlyclean): Remove duplicate deletion of temp - files. Delete more stamp files and [df]p-bit.c - (clean): Don't delete stamp files here. - (VERSION_DEP): New variable. - (distdir-finish): Pass a value of null for it. - (version.c): Use it. - Avoid broken pipe with cvs log. - - * objc/Make-lang.in (objc/runtime-info.h): Rename emptyfile to - tmp-runtime and delete at end. - -Sun Mar 1 05:50:25 1998 Richard Kenner - - * tree.c (build_reference_type): Handle obstacks like - build_pointer_type. - - * Makefile.in (tmp-gcc.xtar): Renamed from gcc.xtar. - (gcc.xtar.gz): Deleted; merged with `dist'. - (diff): Create gcc-$(oldversion)-$(version).diff. - (distdir): Depend on distdir-cvs. - (distdir-cvs): New rule. - (distdir-start): Depend on version.c and TAGS. - (TAGS): Use tmp-tags instead of temp. - (dist): Create gcc-$(version).tar.gz. - - * varasm.c (compare_constant_1): Fix typo in previous change. - - * objc/Make-lang.in (objc-distdir): Properly rebuild objc-parse.c. - -Sat Feb 28 16:58:08 1998 Tristan Gingold - - * stmt.c (expand_decl): If -fcheck-memory-usage, put vars in memory. - * expr.c (get_memory_usage_from_modifier): Convert - EXPAND_{CONST_ADDRESS, INITIALIZER} to MEMORY_USE_DONT. - -Sat Feb 28 08:13:43 1998 Richard Kenner - - * i860/fx2800.h (DATA_ALIGNMENT): Use POINTER_TYPE_P. - * m68k/a-ux.h (FUNCTION_VALUE): Likewise. - * expr.c (get_pointer_alignment, compare, do_store_flag): Likewise. - (expand_builtin): Likewise. - * fold-const.c (force_fit_type, fold_convert, fold): Likewise. - * function.c (assign_parms): Likewise. - * integrate.c (expand_inline_function): Likewise. - * sdbout.c (sdbout_field_types): Likewise. - * tree.c (integer_pow2p, tree_log2, valid_machine_attribute): Likewise. - * stmt.c (expand_decl): Likewise. - ({,bc_}expand_decl_init): Also test for REFERENCE_TYPE. - - * configure.in (version_dep): New variable; if srcdir is CVS working - directory, set to ChangeLog. - (version): Supply default if no version.c. - * Makefile.in (version.c): New rule. - - * gcc.c (snapshot_warning): New function. - (main): Call it for snapshots. - - * dwarf2out.c (expand_builtin_dwarf_reg_size): If reg_raw_mode - not valid for reg, use last size. Also refine range assertion. - -Sat Feb 28 05:04:47 1998 Michael P. Hayes - - * enquire.c (cprop): Don't perform exhaustive search for char_min - and char_max when bits_per_byte > 16. - -Thu Feb 26 15:12:03 1998 Christopher Taylor - - * fixincludes: Avoid using '0-~' in egrep. - -Thu Feb 26 08:04:05 1998 Tristan Gingold - - * function.c (assign_parms): Call 'chkr_set_right' when DECL_RTL - is stack_parm. - * expr.c (get_memory_usage_from_modifier): Convert - EXPAND_{SUM, CONST_ADDRESS, INITIALIZER} to MEMORY_USE_RO. - -Thu Feb 26 07:33:53 1998 Paul Eggert - - * c-lex.c (yylex): Don't munge errno before using it. - * cccp.c (error_from_errno, perror_with_name): Likewise. - * cpplib.c (cpp_error_from_errno): Likewise. - * gcc.c (pfatal_pexecute): Likewise. - * protoize.c (safe_write, find_file, process_aux_info_file): Likewise. - (rename_c_file, edit_file): Likewise. - - * c-lex.c (yylex): Remove unused variable exceeds_double. - -Thu Feb 26 07:05:14 1998 Michael P. Hayes - - * reorg.c (fill_slots_from_thread): Don't steal delay list from target - if condition code of jump conflicts with opposite_needed. - -Thu Feb 26 06:45:23 1998 Richard Kenner - - * Makefile.in (distdir-start): Don't copy CVS subdirectory of config. - - * varasm.c ({compare,record}_constant_1, case CONSTRUCTOR): - Handle the case when we have TREE_PURPOSE values. - -Thu Feb 26 05:59:01 1998 Philippe De Muyter - - * fixincludes (sys/limits.h): Fix a nested comment problem with - HUGE_VAL definition on sysV68 R3V7.1. - -Wed Feb 25 21:09:38 1998 Philippe De Muyter - - * toplev.c (TICKS_PER_SECOND): Renamed from CLOCKS_PER_SECOND. - -Wed Feb 25 20:50:08 1998 Michael P. Hayes - - * reorg.c (fill_slots_from_thread): Mark resources referenced in - opposite_needed thread. Return delay_list even when cannot get - any more delay insns from end of subroutine. - -Wed Feb 25 19:50:01 1998 Mikael Pettersson - - * gcc.c (lookup_compiler): Remove redundant test. - -Wed Feb 25 07:24:22 1998 Richard Kenner - - * vax.md (call insns): Second operand to CALL rtl is SImode. - - * configure.in (i[34567]86-*-mingw32): Support msv and crt suffix. - * i386/crtdll.h: New file. - - * sparc.c (pic_setup_code): If -O0, write USE of pic_offset_table_rtx. - - * expr.c (safe_from_p): Add new arg, TOP_P; all callers changed. - -Sat Feb 21 07:02:39 1998 Jim Wilson - - * mips/iris5.h (DWARF2_UNWIND_INFO): Define to 0. - * mips/iris5gas.h (DWARF2_UNWIND_INFO): Define to 1. - -Fri Feb 20 08:27:46 1998 Paul Eggert - - * sparc/sol2-sld.h: New file. - * configure.in (sparc-*-solaris2*): Use it when using system linker. - * toplev.c (main): Don't default to DWARF2_DEBUG with -ggdb - if LINKER_DOES_NOT_WORK_WITH_DWARF2 is defined. - -Fri Feb 20 08:21:49 1998 H.J. Lu (hjl@gnu.org) - - * alpha/elf.h (STARTFILE_SPEC, ENDFILE_SPEC): Support shared library. - (LIB_SPEC, DEFAULT_VTABLE_THUNKS): Defined #ifndef USE_GNULIBC_1. - * sparc/linux.h (DEFAULT_VTABLE_THUNKS): Likewise. - (LIB_SPEC): Add -lc for -shared #ifndef USE_GNULIBC_1. - * linux.h (LIB_SPEC): Likewise. - * sparc/linux64.h (LIB_SPEC): Likewise; also updated for glibc 2. - (LIBGCC_SPEC): Removed. - (CPP_SUBTARGET_SPEC): Add %{pthread:-D_REENTRANT}. - -Fri Feb 20 05:22:12 1998 Richard Kenner - - * Makefile.in (distdir-start): Add dependence on bi-parser.[ch]. - -Thu Feb 19 18:07:11 1998 Jim Wilson - - * m68k.h (TARGET_SWITCHES): For 68000, 68302, subtract MASK_68881. - For 68303, 68332, cpu32, subtract MASK_68040_ONLY. - -Wed Feb 18 09:37:29 1998 Paul Eggert - - * fixincludes (stdlib.h): Do not double-wrap the size_t typedef. - -Wed Feb 18 07:32:11 1998 Jim Wilson - - * i960.c (emit_move_sequence): Handle unaligned stores to pseudos. - * i960.md (store_unaligned_[dt]i_reg): Handle register dest. - (store_unaligned_ti_reg): Likewise. - - * m68k.h (MACHINE_STATE_{SAVE,RESTORE} [MOTOROLA]): Add %# and %/; - add : to make them into extended asms. - -Wed Feb 18 07:08:05 1998 Richard Kenner - - * reg-stack.c (compare_for_stack_reg): Only handle FP conditional - move as next insn specially. - - * reload.c (find_reloads): Always convert address reload for - non-reloaded operand to RELOAD_FOR_OPERAND_ADDRESS. - - * emit-rtl.c (hard-reg-set.h): Include. - (get_lowpart_common): Don't make new REG for hard reg in a - class that cannot change size. - * Makefile.in (emit-rtl.o): Depend on hard-reg-set.h. - -Sat Feb 14 09:59:00 1998 Richard Earnshaw (rearnsha@arm.com) - - * arm.md (movsfcc): Also validate operands[3] for hard float. - (movdfcc): Only accept fpu_add_operand for operands[3].8 - -Sat Feb 14 09:32:34 1998 Jim Wilson - - * dwarf2out.c (expand_builtin_dwarf_reg_size): New variable mode. - Convert CCmode to word_mode before calling GET_MODE_SIZE. - -Sat Feb 14 09:27:42 1998 David Edelsohn - - * rs6000.h (MY_ISCOFF): Check for U803XTOCMAGIC. - -Sat Feb 14 08:29:43 1998 Arvind Sankar - - * t-svr4 (TARGET_LIBGCC_CFLAGS): New definition. - -Sat Feb 14 07:45:16 1998 Ken Rose (rose@acm.org) - - * reorg.c (fill_slots_from_thread): New parameter, delay_list. - All callers changed. - -Sat Feb 14 07:14:02 1998 Richard Kenner - - * reload.c (debug_reload): Properly output insn codes. - - * pa.c (emit_move_sequence): If in reload, call find_replacement. - - * gansidecl.h (bcopy, bzero, {,r}index): Don't define if IN_LIBGCC2. - - * combine.c (distribute_notes, case REG_DEAD): When seeing if place - to put new note sets register, use reg_bitfield_target_p, as in - original code. - - * gcc.c (process_command): If file is for linker, set lang to "*". - (lookup_compiler): Return 0 for language of "*". - - * sched.c (attach_deaths, case SUBREG): Fix error in last change. - - * i386.md (mov[sdx]fcc): Disable for now. - (mov[sd]fcc_1): Add earlyclobber for output on last alternative. - -Sat Feb 14 06:42:50 1998 Jason Merrill - - * except.c (get_dynamic_handler_chain): Only make call once per func. - (expand_fixup_region_{start,end}): New functions. - (expand_eh_region_start_tree): Store cleanup into finalization here. - * stmt.c (expand_cleanups): Use new functions to protect fixups. - - * except.c (get_dynamic_handler_chain): Build up a FUNCTION_DECL. - * optabs.c (init_optabs): Don't init get_dynamic_handler_chain_libfunc. - * expr.h (get_dynamic_handler_chain_libfunc): Deleted. - -Sat Feb 14 06:34:41 1998 Peter Lawrence - - * optabs.c (emit_conditional_move): Don't reverse condition for FP. - -Fri Feb 13 07:22:04 1998 Richard Kenner - - * Makefile.in (mostlyclean): Only use s-* convention for stamp - files in main dir. - - * configure.in: Add support for i786 (Pentium II); same as i686. - -Thu Feb 12 20:16:35 1998 Michael Meissner - - * rs6000.md: Replace gen_rtx (CONST_INT,...) with GEN_INT. - -Thu Feb 12 10:08:14 1998 John Hassey - - * configure.in (i[3456]86-dg-dgux*): Don't need fixincludes. - -Thu Feb 12 07:27:39 1998 Mumit Khan - - * i386/cygwin32.h (NO_IMPLICIT_EXTERN_C): Define. - about system headers. - (LIB_SPEC): Add -ladvapi32 -lshell32. - -Thu Feb 12 07:19:31 1998 Richard Kenner - - * expr.c (expand_assignment): Fix typo in checking OFFSET. - - * gbl-ctors.h (atexit): Don't define unless needed. - - * combine.c (distribute_notes): Completely check for note operand being - only partially set on potential note target; adjust what notes - we make in that case. - - * i386/xm-go32.h (HAVE_{BCOPY,BZERO,INDEX,RINDEX}): Deleted. - -Wed Feb 11 08:53:27 1998 Richard Kenner - - * calls.c (emit_call_1): Size args now HOST_WIDE_INT. - (expand_call): struct_value_size now HOST_WIDE_INT. - -Tue Feb 10 09:04:39 1998 Richard Kenner - - * integrate.c (initialize_for_inline): Ensure DECL_INCOMING_RTL - is always copied. - -Tue Feb 10 06:10:49 1998 Paul Eggert - - * cccp.c (rescan): Fix bug with macro name appearing - immediately after L'x'. - -Mon Feb 9 20:45:32 1998 Andreas Schwab - - * c-common.c (format_char_info): Add new field zlen. - (print_char_table): Remove entry for 'Z' as a format character. - Initialize zlen field as appropriate. - (scan_char_table): Set zlen field to NULL in each entry. - (check_format_info): Recognize 'Z' as a length modifier, with a - warning in pedantic mode. - Avoid infinite loop when a repeated flag character is detected. - -Mon Feb 9 09:24:04 1998 Paul Eggert - - * c-parse.in (primary): Minor wording fix in diagnostic. - -Mon Feb 9 07:50:19 1998 Richard Kenner - - * c-decl.c (grokdeclarator): Remove warning on inline of varargs. - - * reload.c (find_reloads): Check for const_to_mem case before - checking for invalid reload; use force_const_mem if no_input_reloads. - - * function.c (push_function_context_to): Call init_emit last. - - * protoize.c (my_link): Define as -1 in mingw32. - (link): Remove declaration. - - * rs6000.c (setup_incoming_varargs): Always set rs6000_sysv_varargs_p. - - * integrate.c (expand_inline_function): Clear label_map with bzero. - - * unroll.c (copy_loop_body, case JUMP_INSN): Correct error in last - change: call single_set on COPY, not INSN. - -Sun Feb 8 08:07:37 1998 Richard Kenner - - * msdos/top.sed, winnt/config-nt.sed: Change version number to 2.8.1. - - * configure.in (i[3456]86-*-sco3.2v5*): Use cpio for headers. - -Sat Feb 7 07:32:46 1998 Richard Kenner - - * i386/mingw32.h (LIBGCC_SPEC, STARTFILE_SPEC, MATH_LIBRARY): - Use msvcrt, not crtdll. - -Fri Feb 6 20:32:06 1998 Geert Bosch - - * i386/xm-os2.h (EMX, USG, BSTRING, HAVE_{PUTENV,VPRINTF,STRERROR}): - Define ifdef __EMX__. - (strcasecmp): Define to be stricmp if __EMX__. - (spawnv{,p}): Don't define if EMX. - (OBJECT_SUFFIX): Don't define if EMX. - (MKTEMP_EACH_FILE): Define. - -Fri Feb 6 16:37:29 1998 Kaveh R. Ghazi - - * objc/Make-lang.in (objc.stage1): Depend on stage1-start. - (objc.stage2, objc.stage3, objc.stage4): Likewise for the - respective stageN-start targets. - (objc/sendmsg.o): Depend on objc/runtime-info.h. - -Fri Feb 6 16:27:09 1998 Bernd Schmidt - - * stmt.c (expand_asm_operands): Properly treat asm statement - statements with no operands as volatile. - -Fri Feb 6 16:03:25 1998 Greg McGary - - * c-decl.c (pushdecl): Set DECL_ORIGINAL_TYPE once only. - -Fri Feb 6 15:57:36 1998 Mumit Khan - - * i386/cygwin32.h (STRIP_NAME_ENCODING): New macro. - -Fri Feb 6 15:50:42 1998 Paul Eggert - - * libgcc2.c (__floatdi[xtds]f): Round properly even when rounding - large negative integer to plus or minus infinity. - -Fri Feb 6 15:45:16 1998 Philippe De Muyter - - * sdbout.c (plain_type_1): Return T_DOUBLE, not T_VOID, for - long double #ifndef EXTENDED_SDB_BASIC_TYPES. - -Fri Feb 6 15:23:49 1998 John David Anglin - - * vax/ultrix.h (HAVE_ATEXIT): Define. - * x-vax: File deleted. - -Fri Feb 6 14:34:19 1998 Douglas Rupp - - * gcc.c (process_command, case "-dumpversion"): Print spec_version. - -Fri Feb 6 11:01:13 1998 Josh Littlefield - - * i386/gmon-sol2.c (internal_mcount): Do set-up when program starts - and install hook to do clean-up when it exits. - * i386/sol2-c1.asm (_mcount): Make a weak instead of global symbol. - * i386/sol2dbg.h (ASM_SPEC): Support Solaris bundled assembler's -V - argument; pass -s argument to assembler. - -Fri Feb 6 09:13:21 1998 Jim Wilson (wilson@cygnus.com) - - * function.c (assign_parms): New variable named_arg, with value - depending on STRICT_ARGUMENT_NAMING. Use instead of ! last_named. - - * crtstuff.c (__frame_dummy): New function for irix6. - (__do_global_ctors): Call __frame_dummy for irix6. - * mips/iris6.h (LINK_SPEC): Hide __frame_dummy too. - -Fri Feb 6 09:08:21 1998 Mike Stump - - * rtlanal.c (dead_or_set_regno_p): Ignore REG_DEAD notes after reload. - * genattrtab.c (reload_completed): Define. - - * configure.in (i960-wrs-vxworks): Same as i960-wrs-vxworks5*. - -Fri Feb 6 08:47:38 1998 Richard Kenner - - * Makefile.in (diff): Add INSTALL, configure, and config.in; - remove objc-*. - * objc/config-lang.in (diff_excludes): Add objc-parse.[cy]. - - * i386/xm-mingw32.h (link): Delete macro. - - * alpha.c (output_prolog): Write out frame sizes as longs and - print too large sizes as zero. - - * function.c (combine_temp_slots): No need to allocate and free rtx. - Don't do anything if too many slots in the list. - (put_var_into_stack): Don't use ADDRESSOF if not optimizing. - - * function.c (purge_addressof_1): Force into mem if VOLATILE reference. - - * calls.c (expand_call): Show VAR_DECL made for structure return - address is used; remove bogus set of MEM_IN_STRUCT_P. - * expr.c (expand_expr, case SAVE_EXPR, case TARGET_EXPR): Show used. - (expand_builtin, case BUILT_IN_LONGJMP): Show __dummy used. - * function.c (put_reg_into_stack): New arg USED_P; all callers changed. - - * expr.c (expand_expr, case SAVE_EXPR): assign_temp with KEEP of 3. - * function.c (var_temp_slot_level): New variable. - (push_function_context_to, pop_function_context_from): Save/restore - it and target_temp_slot_level. - (assign_stack_temp): Implement KEEP of 3. - (push_temp_slots_for_block): New function. - (init_temp_slots): Initialize var_temp_slot_level. - * function.h (struct function, fields {var,target}_temp_slot_level): - New fields. - * stmt.c (expand_start_bindings): Call push_temp_slots_for_block. - - * function.c (struct temp_slot): SIZE, BASE_OFF_SET, and FULL_SIZE - now HOST_WIDE_INT. - (assign_{,outer_}stack_local, assign_{,stack_}temp): Size arg is - now HOST_WIDE_INT. - (assign_stack_temp): Do size computations in HOST_WIDE_INT. - (fixup_var_refs_1, optimize_bit_field, instantiate_decls): Likewise. - (instantiate_virtual_regs_1, fix_lexical_address): Likewise. - * rtl.h (assign_stack_{local,temp}): Size arg is HOST_WIDE_INT. - (assign_temp): Likewise. - * expr.h (struct args_size): Field CONSTANT is now HOST_WIDE_INT. - - * sched.c (attach_deaths, case REG): Don't check for REG_UNUSED. - (attach_deaths, case SUBREG, STRICT_LOW_PART, {ZERO,SIGN}_EXTRACT): - Don't pass set_p of 1 if partial assignment. - - * tree.h (size_in_bytes): Returns HOST_WIDE_INT. - * tree.c (size_in_bytes): Likewise. - Tighen up logic some to avoid returning a bogus value instead of -1. - - * expr.c (get_inner_reference, case ARRAY_EXPR): Make WITH_RECORD_EXPR - just for index. - (expand_expr, case PLACEHOLDER_EXPR): Refine search again; look - at each expression and look for pointer to type. - - * expr.c (safe_from_p, case ADDR_EXPR): If TREE_STATIC, no trampoline. - (expand_expr, case ADDR_EXPR): Likewise. - - * expr.c (emit_block_move): Use conservative range for movstr mode. - - * configure.in: See if "cp -p" works if "ln -s" doesn't; else "cp". - - * combine.c (try_combine.c): Pass elim_i2 and elim_i1 to - distribute_notes for i3dest_killed REG_DEAD note. - - * configure.in (mips-dec-netbsd*): Remove bogus setting of prefix. - - * c-decl.c (duplicate_decls): Set DECL_IGNORED_P in newdecl if - different bindings levels. - - * configure.in: Test ln -s by symlinking gcc.c. - - * configure.in (i[3456]86-dg-dgux): Add wildcard for version. - - * crtstuff.c (__do_global_ctors_aux): Switch back to text section - in proper place. - - * rtlanal.c (rtx_varies_p, case REG): pic_offset_table_rtx is fixed. - * genattrtab.c (pic_offset_table_rtx): Define (dummy). - * cse.c (set_nonvarying_address_components): Understand PIC refs. - - * loop.c (strength_reduce): When placing increment for auto-inc - case, do comparison in loop order. - - * i860.c (output_delayed_branch): Add missing arg to recog. - (output_delay_insn): Add missing arg to constrain_operands. - - * configure.in: Truncate target after finished comparing it with host. - - * i386.h (MAX_FIXED_MODE_SIZE): Delete. - - * c-parse.in (expr_no_comma): Clarify undefined error. - - * prefix.c (get_key_value): Don't default to PREFIX here. - (translate_name): Remove bogus addition of "$" if getenv fails; - clean up application of default value of PREFIX. - - * fold-const.c (fold_convert): Call force_fit_type even if input - already overflows. - -Fri Feb 6 07:45:01 1998 Robert Hoehne - - * i386/xm-go32.h (HAVE_{BCOPY,BZERO,BCMP,RINDEX,INDEX}): Define. - - * gcc.c (main): Treat paths starting with '$' or DOS drives - as absolute in standard_startfile_prefix. - -Thu Feb 5 21:07:12 1998 John David Anglin - - * cpplib.c (IS_INCLUDE_DIRECTIVE_TYPE): Add casts from enum to int. - * cccp.c (IS_INCLUDE_DIRECTIVE_TYPE, handle_directive): Likewise. - -Thu Feb 5 19:00:44 1998 Richard Kenner - - * expr.c (expand_expr, case CONSTRUCTOR): Correct shift count - when making signed bit field; use EXPAND_NORMAL, not 0. - -Thu Feb 5 17:42:43 1998 Manfred Hollstein - - * libgcc2.c (__clear_insn_cache): On sysV68 enable the memctl - stuff only if MCT_TEXT is #define'd. - -Thu Feb 5 17:32:01 1998 Robert Hoehne - - * Makefile.in: Changed most stamp-* to s-*. - -Tue Feb 3 19:45:50 1998 James Hawtin - - * i386/sol2.h (STARTFILE_SPEC, LIB_SPEC): Update -pg files. - * configure.in (i[3456]86-*-solaris2*): Add gcrt1.o and gmon.o - to extra_parts. - -Tue Feb 3 17:28:48 1998 Christopher C Chimelis - - * configure.in (alpha*-*-linux-gnu*): Add extra_parts for crtstuff. - -Tue Feb 3 17:18:19 1998 Richard Earnshaw - - * arm.c (find_barrier): Fix one-too-many bug if fail to find barrier. - - * arm.c (arm_reload_in_hi): Handle cases where the MEM is too - complex for a simple offset. - -Tue Feb 3 16:14:21 1998 Robert Hoehne - - * i386/xm-go32.h (EXECUTABLE_SUFFIX): Define. - - * configure.in (i[3456]86-pc-msdosdjgpp*): New entry. - -Tue Feb 3 07:33:58 1998 Richard Kenner - - * explow.c (probe_stack_range): Properly check for small - number of probes. - - * gcc.c (process_command, case 'V'): Validate arg. - - * configure.in (sbrk): Add check for needed declaration. - * acconfig.h (NEED_DECLARATION_SBRK): New entry. - * toplev.c (sbrk): Update declaration conditional. - * mips-tfile.c (sbrk, free): Likewise. - - * sparc/sysv4.h (DBX_REGISTER_NUMBER): Remove abort. - - * mips.c (mips_expand_prologue): Pass reg 25 to gen_loadgp. - * mips.md (loadgp): Add second operand for register number to add. - (builtin_setjmp_receiver): Pass new label and reg 31 to loadgp. - - * toplev.c: Include insn-codes.h, insn-config.h, and recog.h. - (compile_file): Try to emit nop to separate gcc_compiled symbol. - * Makefile.in (toplev.o): Depends on insn-{codes,config}.h, recog.h. - -Tue Feb 3 06:58:46 1998 Mark Mitchell - - * integrate.c (get_label_from_map): New function. - (expand_inline_function): Use it. - Initialize label_map to NULL_RTX instead of gen_label_rtx. - (copy_rtx_and_substitute): Use get_label_from_map. - * integrate.h (get_label_from_map): New function. - (set_label_from_map): New macro. - * unroll.c (unroll_loop, copy_loop_body): Use them. - -Mon Feb 2 16:33:01 1998 Richard Kenner - - * i386.md (mov{si,hi,sf,df,xf}cc{,_1}): Remove cases with branches. - - * rs6000/x-aix31 (INSTALL): Deleted. - * mips/x-dec-osf1, mips/x-osfrose, i386/x-osfrose: Likewise. - * arm/x-riscix: Likewise. - - * c-typeck.c (signed_or_unsigned_type): Properly handle pointer types. - -Mon Feb 2 15:33:58 1998 Michael P. Hayes - - * unroll.c (copy_loop_body): Use single_set instead of - PATTERN to detect increment of an iv inside a PARALLEL. - -Fri Jan 16 20:29:50 1998 Paul Eggert - - * toplev.c (): New include. - (get_run_time): Prefer CLK_TCK (if available) to HZ, and - prefer sysconf (_SC_CLK_TCK) (if available) to CLK_TCK. - * configure.in (sysconf): Call AC_CHECK_FUNCS. - -Wed Jan 14 20:10:51 1998 Paul Eggert - - * cccp.c: (rescan): Don't report line 0 as the possible real start - of an unterminated string constant. - Don't mishandle backslash-newlines that in are the output of - a macro expansion. Properly skip // style comments between a function - macro name and '(', as well as backslash-newlines in comments there. - (handle_directive): Handle / \ newline * between # and directive name. - In #include directives, \ does not escape ". - (do_include): For `#include "file', do not bother expanding into temp - buffer. When error encountered when expanding, do not try result. - (skip_if_group): When skipping an include directive, use include - tokenization, not normal tokenization. Backslash-newline is still - special when skipping. Handle * \ newline / correctly in comments - when skipping. - (skip_quoted_string): After \ newline, set *backslash_newlines_p - even if count_newlines is 0. - (macroexpand): Newline space is not a special marker inside a string. - (macroexpand, macarg): Do not generate \ddd for control characters - when stringifying; the C Standard does not allow this. - (macarg1): New arg MACRO. All callers changed. - Do not treat /*, //, or backslash-newline specially when processing - the output of a macro. - (discard_comments): Don't go past limit if looking for end of comment. - Discard backslash-newline properly when discarding comments. - (change_newlines): \" does not end a string. - (make_definition): Do not treat backslash-newline specially, as it - has already been removed before we get here. - - * profile.c (output_func_start_profiler): Don't fflush output - if -quiet. - * toplev.c (rest_of_compilation): Likewise. - - * i386/x-sco5 (CC): Remove trailing white space. - * x-convex (CCLIBFLAGS): Likewise. - * arm/t-semi (LIBGCC2_CFLAGS): Likewise. - -Wed Jan 7 18:02:42 1998 Richard Kenner - - * Version 2.8.0 released. - -Wed Jan 7 17:54:41 1998 J. Kean Johnston - - * i386/sco5.h ({END,START}FILE_SPEC): Link with correct crtbegin.o - and crtend.o when using -static. - -Wed Jan 7 17:49:14 1998 Jan Christiaan van Winkel - - * cppexp.c (gansidecl.h): Include. - -Wed Jan 7 17:45:07 1998 Tristan Gingold - - * expr.c (get_push_address): Use copy_to_reg instead of force_operand. - (emit_push_insn): Avoid null pointer deference if aggregate has no - types. - (expand_expr): Avoid finite but useless recursion. - (expand_builtin): Fix typo in calling function. - * function.c (assign_parms): Avoid useless call to chkr_set_right. - -Wed Jan 7 17:31:13 1998 Christian Iseli - - * combine.c (force_to_mode): Return if operand is a CLOBBER. - -Wed Jan 7 17:23:24 1998 Richard Kenner - - * x-rs6000 (INSTALL): Remove. - - * jump.c (jump_optimize): Don't use a hard reg as an operand - of a conditional move if small register classes. - -Wed Jan 7 17:09:28 1998 Jim Wilson - - * cse.c (max_insn_uid): New variable. - (cse_around_loop): Use it. - (cse_main): Set it. - -See ChangeLog.11 for earlier changes. - -Use a consistent time stamp format in ChangeLog entries. -Not everyone has Emacs 20 yet, so stick with Emacs 19 format for now. - -Local Variables: -add-log-time-format: current-time-string -End: diff --git a/contrib/gcc/LANGUAGES b/contrib/gcc/LANGUAGES deleted file mode 100644 index c3d4223477ee..000000000000 --- a/contrib/gcc/LANGUAGES +++ /dev/null @@ -1,91 +0,0 @@ -Right now there is no documentation for the GCC tree -> rtl interfaces -(or more generally the interfaces for adding new languages). - -Such documentation would be of great benefit to the project. Until such -time as we can formally start documenting the interface this file will -serve as a repository for information on these interface and any incompatable -changes we've made. - -Aug 31, 1998: - The interface to HANDLE_PRAGMA has changed. It now takes three arguments. - The first two are pointers to functions that should be used to read characters - from the input stream, and to push them back into the input stream respectively. - The third argument is a pointer to a null terminate string which is the first - word after #pragma. The expression supplied by HANDLE_PRAGMA should return - non-zero if it parsed and implemented the pragma. Otherwise it should return - zero, and leave the input stream as it was before the expression was evaluated. - - A new back-end definable macro has been added: INSERT_ATTRIBUTES. This macro - allows backend to add attributes to decls as they are created. - -Jun 10, 1998: - The interface to lang_decode_option has changed. It now uses and argc/argv - interface to allow for options that use more than one input string. The new - declaration is: int lang_decode_option (int argc, char** argv). It now - returns the number of input strings processed, or 0 if the option is - unknown. - -Jun 7, 1998: - Front-ends must now define lang_init_options. It is safe for this - function to do nothing. See c-lang.c. - -Apr 21, 1998: - Front ends which link with c-common or other files from the C/C++ - front-ends may need to handle TI types. Look for references to - [unsigned]int_DI_type_node in your front end. If you have references - to these variables, you'll need up update the front end. - - To update the front end you must mirror all the code which currently - deals with intDI_type_node to also handle intTI_type_node. - - -Apr 7, 1998: - The interface between toplev.c and the language front ends for opening the - source file has changed: - - o init_lex() has been renamed to init_parse (char *filename) where filename - is the name of the source file. - o The code in toplev.c which opened the source file should be moved to - the new init_parse function. - o toplev.c now calls finish_parse() instead of closing the source file - using fclose(). This should now be done in finish_parse, if necessary. - -Apr 1, 1998: - Front-ends must now define lang_print_xnode. It is safe for this - function to do nothing. See c-lang.c. - -Feb 1, 1998: - - GCC used to store structure sizes & offsets to elements as bitsize - quantities. This causes problems because a structure can only be - (target memsize / 8) bytes long (this may effect arrays too). This - is particularly problematical on machines with small address spaces. - - So: - - All trees that represent sizes in bits should have a TREE_TYPE of - bitsizetype (rather than sizetype). - - Accordingly, when such values are computed / initialized, care has to - be takes to use / compute the proper type. - - When a size in bits is converted into a size in bytes, which is expressed - in trees, care should be taken to change the tree's type again to sizetype. - - We've updated C, C++, Fortran & Objective-C to work with the new - scheme. Other languages will need to be updated accordingly. - Contact amylaar@cygnus.com for additional information. - -?? 1997: - - In an effort to decrease cache thrashing and useless loads we've changed the - third argument to the DEFTREECODE macro to be a single char. This will - effect languages that defined their own tree codes (usually in a .def file). - - Old way: - - DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", "d", 0) - - New way: - - DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", 'd', 0) diff --git a/contrib/gcc/Makefile.in b/contrib/gcc/Makefile.in deleted file mode 100644 index 0240f72417f7..000000000000 --- a/contrib/gcc/Makefile.in +++ /dev/null @@ -1,3198 +0,0 @@ -# Makefile for GNU C compiler. -# Copyright (C) 1987, 88, 90-98, 1999 Free Software Foundation, Inc. - -#This file is part of GNU CC. - -#GNU CC 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. - -#GNU CC 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. - -#You should have received a copy of the GNU General Public License -#along with GNU CC; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, -#Boston MA 02111-1307, USA. - -# The targets for external use include: -# all, doc, proto, install, install-cross, install-cross-rest, -# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean, -# stage1, stage2, stage3, stage4. - -# Suppress smart makes who think they know how to automake Yacc files -.y.c: - -# Directory where sources are, from where we are. -srcdir = @srcdir@ -VPATH = @srcdir@ - -# Variables that exist for you to override. -# See below for how to change them for certain systems. - -# List of language subdirectories. -# This is overridden by configure. -SUBDIRS =@subdirs@ - -# Selection of languages to be made. -# This is overridden by configure. -CONFIG_LANGUAGES = @all_languages@ -LANGUAGES = c proto gcov$(exeext) $(CONFIG_LANGUAGES) - -# Languages should create dependencies of $(INTL_TARGETS) on generated -# sources in Make-lang.in. Example: -# $(INTL_TARGETS): $(srcdir)/cp/parse.c -INTL_TARGETS = intl.all intl.install intl.distdir - -# Selection of languages to be made during stage1 build. -# This is overridden by configure. -BOOT_LANGUAGES = c @all_boot_languages@ - -ALLOCA = -ALLOCA_FLAGS = -ALLOCA_FINISH = true - -# Various ways of specifying flags for compilations: -# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2. -# BOOT_CFLAGS is the value of CFLAGS to pass -# to the stage2 and stage3 compilations -# WARN_CFLAGS are the warning flags to pass to stage2 and stage3. -# (And for stage 1 if the native compiler is GCC.) It is -# separate from BOOT_CFLAGS because people tend to override optimization -# flags and we'd like them to still have warnings turned on. They are free -# to explicitly turn warnings off if they wish. -# XCFLAGS is used for most compilations but not when using the GCC just built. -# TCFLAGS is used for compilations with the GCC just built. -XCFLAGS = -TCFLAGS = -# -W -Wall warnings are disabled for releases. -CFLAGS = -g -BOOT_CFLAGS = -O2 $(CFLAGS) -#WARN_CFLAGS = -W -Wall -# These exists to be overridden by the x-* and t-* files, respectively. -X_CFLAGS = -T_CFLAGS = - -X_CPPFLAGS = -T_CPPFLAGS = - -AWK = @AWK@ -CC = @CC@ -# srcdir might be a relative pathname which won't be valid in a subdirectory, -# so we must use objdir/srcdir instead to make it safe. objdir is always -# a full pathname. -BISON = `if [ -f $(objdir)/../bison/bison ] ; then case $(srcdir) in \ - /*) echo $(objdir)/../bison/bison -L $(srcdir)/../bison/ ;; \ - *) echo $(objdir)/../bison/bison -L $(objdir)/$(srcdir)/../bison/ ;; \ - esac; else echo bison ; fi` -BISONFLAGS = -LEX = `if [ -f $(objdir)/../flex/flex ] ; then echo $(objdir)/../flex/flex ; else echo flex ; fi` -LEXFLAGS = -AR = ar -AR_FLAGS = rc -LN = @symbolic_link@ -DLLTOOL = dlltool -SHELL = /bin/sh -# on sysV, define this as cp. -INSTALL = @INSTALL@ -# Some systems may be missing symbolic links, regular links, or both. -# Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate. -LN=@LN@ -LN_S=@LN_S@ -# These permit overriding just for certain files. -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -MAKEINFO = `if [ -f $(objdir)/../texinfo/makeinfo/Makefile ] ; \ - then echo $(objdir)/../texinfo/makeinfo/makeinfo ; \ - else echo makeinfo ; fi` -MAKEINFOFLAGS = -TEXI2DVI = texi2dvi -# For GNUmake: let us decide what gets passed to recursive makes. -MAKEOVERRIDES = -@SET_MAKE@ - -# Define this as & to perform parallel make on a Sequent. -# Note that this has some bugs, and it seems currently necessary -# to compile all the gen* files first by hand to avoid erroneous results. -P = - -# How to invoke ranlib. -RANLIB = ranlib -# Test to use to see whether ranlib exists on the system. -RANLIB_TEST = \ - [ -f $(RANLIB) ] \ - || [ -f /usr/bin/ranlib -o -f /bin/ranlib ] - -# Compiler to use for compiling libgcc1.a. -# OLDCC should not be the GNU C compiler, -# since that would compile typical libgcc1.a functions such as mulsi3 -# into infinite recursions. -OLDCC = cc - -# CFLAGS for use with OLDCC, for compiling libgcc1.a. -# NOTE: -O does not work on some Unix systems! -CCLIBFLAGS = -O - -# Version of ar to use when compiling libgcc1.a. -OLDAR = ar -OLDAR_FLAGS = qc - -# Target to use when installing include directory. Either -# install-headers-tar or install-headers-cpio. -INSTALL_HEADERS_DIR = @build_install_headers_dir@ - -# Header files that are made available under the same name -# to programs compiled with GCC. -USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \ - $(srcdir)/ginclude/varargs.h $(srcdir)/ginclude/va-alpha.h \ - $(srcdir)/ginclude/va-h8300.h $(srcdir)/ginclude/va-i860.h \ - $(srcdir)/ginclude/va-i960.h $(srcdir)/ginclude/va-mips.h \ - $(srcdir)/ginclude/va-m88k.h $(srcdir)/ginclude/va-mn10200.h \ - $(srcdir)/ginclude/va-mn10300.h $(srcdir)/ginclude/va-pa.h \ - $(srcdir)/ginclude/va-pyr.h $(srcdir)/ginclude/va-sparc.h \ - $(srcdir)/ginclude/va-clipper.h $(srcdir)/ginclude/va-spur.h \ - $(srcdir)/ginclude/va-m32r.h $(srcdir)/ginclude/va-sh.h \ - $(srcdir)/ginclude/va-v850.h $(srcdir)/ginclude/va-arc.h \ - $(srcdir)/ginclude/iso646.h $(srcdir)/ginclude/va-ppc.h \ - $(srcdir)/ginclude/va-c4x.h $(EXTRA_HEADERS) $(LANG_EXTRA_HEADERS) \ - $(srcdir)/ginclude/proto.h $(srcdir)/ginclude/stdbool.h - -# Target to use whe installing assert.h. Some systems may -# want to set this empty. -INSTALL_ASSERT_H = install-assert-h - -# The GCC to use for compiling libgcc2.a, enquire, and libgcc1-test. -# Usually the one we just built. -# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS). -GCC_FOR_TARGET = ./xgcc -B$(build_tooldir)/bin/ -B./ -I$(build_tooldir)/include - -# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET. -# It omits XCFLAGS, and specifies -B./. -# It also specifies -I./include to find, e.g., stddef.h. -GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include $(TCFLAGS) - -# Sed command to transform gcc to installed name. Overwritten by configure. -program_transform_name = @program_transform_name@ -program_transform_cross_name = s,^,$(target_alias)-, - -build_canonical = @build_canonical@ -host_canonical = @host_canonical@ - -# Tools to use when building a cross-compiler. -# These are used because `configure' appends `cross-make' -# to the makefile when making a cross-compiler. - -# Use the tools from the build tree, if they are available. - -# objdir is set by configure. -objdir = @objdir@ - -AR_FOR_TARGET = ` \ - if [ -f $(objdir)/../binutils/ar ] ; then \ - echo $(objdir)/../binutils/ar ; \ - else \ - if [ "$(host_canonical)" = "$(target)" ] ; then \ - echo ar; \ - else \ - t='$(program_transform_name)'; echo ar | sed -e $$t ; \ - fi; \ - fi` -AR_FLAGS_FOR_TARGET = rc -RANLIB_FOR_TARGET = ` \ - if [ -f $(objdir)/../binutils/ranlib ] ; then \ - echo $(objdir)/../binutils/ranlib ; \ - else \ - if [ "$(host_canonical)" = "$(target)" ] ; then \ - echo ranlib; \ - else \ - t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \ - fi; \ - fi` -RANLIB_TEST_FOR_TARGET = \ - [ -f $(RANLIB_FOR_TARGET) ] \ - || ( [ "$(host_canonical)" = "$(target)" ] \ - && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ) - -# Dir to search for system headers. Overridden by cross-make. -SYSTEM_HEADER_DIR = /usr/include - -# Control whether to run fixproto. -STMP_FIXPROTO = stmp-fixproto - -# Test to see whether exists in the system header files. -LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ] - -# There may be a premade insn-attrtab.c for this machine. -# (You could rebuild it with genattrtab as usual, but it takes a long time.) -# PREMADE_ATTRTAB is the file name of the file to use. -# PREMADE_ATTRTAB_MD is the md file it corresponds to. -PREMADE_ATTRTAB_MD = Makefile # Guaranteed not to cmp equal to md. -PREMADE_ATTRTAB = - -target=@target@ -target_alias=@target_alias@ -xmake_file=@dep_host_xmake_file@ -tmake_file=@dep_tmake_file@ -out_file=$(srcdir)/config/@out_file@ -out_object_file=@out_object_file@ -md_file=$(srcdir)/config/@md_file@ -tm_file=@tm_file_list@ -build_xm_file=@build_xm_file_list@ -host_xm_file=@host_xm_file_list@ -lang_specs_files=@lang_specs_files@ -lang_options_files=@lang_options_files@ -lang_tree_files=@lang_tree_files@ -GCC_THREAD_FILE=@thread_file@ -OBJC_BOEHM_GC=@objc_boehm_gc@ -JAVAGC=@JAVAGC@ -GTHREAD_FLAGS=@gthread_flags@ -# Be prepared for gcc2 merges. -gcc_version=@gcc_version@ -gcc_version_trigger=@gcc_version_trigger@ -version=$(gcc_version) -mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c` - -# Common prefix for installation directories. -# NOTE: This directory must exist when you start installation. -prefix = @prefix@ -# Directory in which to put localized header files. On the systems with -# gcc as the native cc, `local_prefix' may not be `prefix' which is -# `/usr'. -# NOTE: local_prefix *should not* default from prefix. -local_prefix = @local_prefix@ -# Directory in which to put host dependent programs and libraries -exec_prefix = @exec_prefix@ -# Directory in which to put the executable for the command `gcc' -bindir = @bindir@ -# Directory in which to put the directories used by the compiler. -libdir = @libdir@ -# Directory in which the compiler finds executables, libraries, etc. -libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version) -# Used to produce a relative $(gcc_tooldir) in gcc.o -unlibsubdir = ../../.. -# Directory in which to find other cross-compilation tools and headers. -dollar = @dollar@ -# Used in install-cross. -gcc_tooldir = @gcc_tooldir@ -# Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/ -build_tooldir = $(exec_prefix)/$(target_alias) -# Directory in which the compiler finds g++ includes. -gcc_gxx_include_dir= @gcc_gxx_include_dir@ -# Directory to search for site-specific includes. -includedir = $(local_prefix)/include -# assertdir is overridden in cross-make. -# (But this currently agrees with what is in cross-make.) -assertdir = $(gcc_tooldir)/include -# where the info files go -infodir = @infodir@ -# Where cpp should go besides $prefix/bin if necessary -cpp_install_dir = @cpp_install_dir@ -# where the locale files go -datadir = $(prefix)/@DATADIRNAME@ -localedir = $(datadir)/locale -# Extension (if any) to put in installed man-page filename. -manext = .1 -objext = .o -exeext = @host_exeext@ -build_exeext = @build_exeext@ - -# Directory in which to put man pages. -mandir = @mandir@ -man1dir = $(mandir)/man1 -# Dir for temp files. -tmpdir = /tmp - -# Top build directory, relative to here. -top_builddir = . - -# Whether we were configured with NLS. -USE_NLS = @USE_NLS@ - -# Internationalization library. -INTLLIBS = @INTLLIBS@ - -# List of internationalization subdirectories. -POSUB = @POSUB@ -INTL_SUBDIRS = intl $(POSUB) - -# Additional system libraries to link with. -CLIB= - -# Change this to a null string if obstacks are installed in the -# system library. -OBSTACK=obstack.o - -# Configure will set these if you need vfprintf and possibly _doprnt support. -VFPRINTF=@vfprintf@ -DOPRINT=@doprint@ - -# Specify the rule for actually making libgcc.a, -LIBGCC = libgcc.a -# and the rule for installing it. -INSTALL_LIBGCC = install-libgcc - -# Specify the rule for actually making libgcc1.a. -# The value may be empty; that means to do absolutely nothing -# with or for libgcc1.a. -LIBGCC1 = libgcc1.a - -# Specify the rule for making libgcc1.a for a cross-compiler. -# The default rule assumes that libgcc1.a is supplied by the user. -CROSS_LIBGCC1 = libgcc1.cross - -# Specify the rule for actually making libgcc2.a. -LIBGCC2 = libgcc2.a - -# Options to use when compiling libgcc2.a. -# -g1 causes output of debug info only for file-scope entities. -# we use this here because that should be enough, and also -# so that -g1 will be tested. -# -LIBGCC2_DEBUG_CFLAGS = -g1 -LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@ - -# Additional options to use when compiling libgcc2.a. -# Some targets override this to -Iinclude -LIBGCC2_INCLUDES = - -# Additional target-dependent options for compiling libgcc2.a. -TARGET_LIBGCC2_CFLAGS = - -# Things which must be built before building libgcc2.a. -# Some targets override this to stmp-int-hdrs -LIBGCC2_DEPS = - -# libgcc1-test target (must also be overridable for a target) -LIBGCC1_TEST = libgcc1-test - -# List of extra executables that should be compiled for this target machine -# that are used for compiling from source code to object code. -# The rules for compiling them should be in the t-* file for the machine. -EXTRA_PASSES =@extra_passes@ - -# Like EXTRA_PASSES, but these are used when linking. -EXTRA_PROGRAMS = @extra_programs@ - -# List of extra object files that should be compiled for this target machine. -# The rules for compiling them should be in the t-* file for the machine. -EXTRA_PARTS = @extra_parts@ - -# List of extra object files that should be compiled and linked with -# compiler proper (cc1, cc1obj, cc1plus). -EXTRA_OBJS = @extra_objs@ - -# List of extra object files that should be compiled and linked with -# the gcc driver. -EXTRA_GCC_OBJS =@host_extra_gcc_objs@ - -# List of additional header files to install. -# Often this is edited directly by `configure'. -EXTRA_HEADERS =@extra_headers_list@ - -# Set this to `collect2' to enable use of collect2. -USE_COLLECT2 = @will_use_collect2@ -# If we might be using collect2, then this variable will be set to -# -DUSE_COLLECT2. toplev.c, collect2.c and libgcc2.c all need to -# if we may be using collect2. -MAYBE_USE_COLLECT2 = @maybe_use_collect2@ -# It is convenient for configure to add the assignment at the beginning, -# so don't override it here. -USE_COLLECT2 = collect2$(exeext) - -# List of extra C and assembler files to add to libgcc1.a. -# Assembler files should have names ending in `.asm'. -LIB1FUNCS_EXTRA = - -# List of extra C and assembler files to add to libgcc2.a. -# Assembler files should have names ending in `.asm'. -LIB2FUNCS_EXTRA = - -# Handle cpp installation. -INSTALL_CPP= -UNINSTALL_CPP= - -# We do not try to build float.h anymore. Let configure select the -# appropriate pre-built float.h file for the target. -FLOAT_H=@float_h_file@ - -# Program to convert libraries. -LIBCONVERT = - -# Control whether header files are installed. -INSTALL_HEADERS=install-headers - -# Options for tar when copying trees. So HPUX can override it. -TAROUTOPTS = xpBf - -# Additional directories of header files to run fixincludes on. -# These should be directories searched automatically by default -# just as /usr/include is. -# *Do not* use this for directories that happen to contain -# header files, but are not searched automatically by default. -# On most systems, this is empty. -OTHER_FIXINCLUDES_DIRS= - -# A list of all the language-specific executables. -# This is overridden by configure. -COMPILERS = cc1$(exeext) @all_compilers@ - -# List of things which should already be built whenever we try to use xgcc -# to compile anything (without linking). -GCC_PASSES=xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) - -# List of things which should already be built whenever we try to use xgcc -# to link anything. -GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS) - -# Directory to link to, when using the target `maketest'. -DIR = ../gcc - -# Guaranteed to not exist when not passing md through cpp. -# This value is overridden directly by configure. -MD_FILE = md-cpp-not-used - -# Flags to use when cross-building GCC. -# Prefix to apply to names of object files when using them -# to run on the machine we are compiling on. -HOST_PREFIX= -# Prefix to apply to names of object files when compiling them -# to run on the machine we are compiling on. -# The default for this variable is chosen to keep these rules -# out of the way of the other rules for compiling the same source files. -HOST_PREFIX_1=loser- -HOST_CC=$(CC) -HOST_CFLAGS=$(ALL_CFLAGS) -HOST_CLIB=$(CLIB) -HOST_INTLLIBS=$(INTLLIBS) -HOST_LDFLAGS=$(LDFLAGS) -HOST_CPPFLAGS=$(ALL_CPPFLAGS) -HOST_ALLOCA=$(ALLOCA) -HOST_MALLOC=$(MALLOC) -HOST_OBSTACK=$(OBSTACK) -HOST_VFPRINTF=$(VFPRINTF) -HOST_DOPRINT=$(DOPRINT) - -# Actual name to use when installing a native compiler. -GCC_INSTALL_NAME = `t='$(program_transform_name)'; echo gcc | sed -e $$t` -CPP_INSTALL_NAME = `t='$(program_transform_name)'; echo cpp | sed -e $$t` -PROTOIZE_INSTALL_NAME = `t='$(program_transform_name)'; echo protoize | sed -e $$t` -UNPROTOIZE_INSTALL_NAME = `t='$(program_transform_name)'; echo unprotoize | sed -e $$t` -GCOV_INSTALL_NAME = `t='$(program_transform_name)'; echo gcov | sed -e $$t` - -# Actual name to use when installing a cross-compiler. -GCC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcc | sed -e $$t` -PROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo protoize | sed -e $$t` -UNPROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo unprotoize | sed -e $$t` - -# Choose the real default target. -ALL=all.internal - -# Choose the real install target. -INSTALL_TARGET=install-normal - -# Setup the testing framework, if you have one -EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \ - echo $${rootme}/../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \ - echo $${srcdir}/../dejagnu/runtest ; \ - else echo runtest; fi` -RUNTESTFLAGS = - -# Extra symbols for fixproto to define when parsing headers. -FIXPROTO_DEFINES = - -# Extra flags to use when compiling crt{begin,end}.o. -CRTSTUFF_T_CFLAGS = - -# Extra flags to use when compiling [m]crt0.o. -CRT0STUFF_T_CFLAGS = - -# "t" or nothing, for building multilibbed versions of, say, crtbegin.o. -T = - -# End of variables for you to override. - -# Definition of `all' is here so that new rules inserted by sed -# do not specify the default target. -# The real definition is under `all.internal' (for native compilers) -# or `all.cross' (for cross compilers). -all: all.indirect - -# This tells GNU Make version 3 not to put all variables in the environment. -.NOEXPORT: - -# sed inserts variable overrides after the following line. -####target overrides -@target_overrides@ - -####host overrides -@host_overrides@ - -####cross overrides -@cross_defines@ -@cross_overrides@ - -####build overrides -@build_overrides@ -# -# Now figure out from those variables how to compile and link. - -all.indirect: $(ALL) - -# IN_GCC tells various files that system.h, toplev.c, etc are available. -INTERNAL_CFLAGS = $(CROSS) -DIN_GCC $(SCHED_CFLAGS) @extra_c_flags@ - -# This is the variable actually used when we compile. -# If you change this line, you probably also need to change the definition -# of HOST_CFLAGS in build-make to match. -ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) \ - @DEFS@ - -# Likewise. -ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) - -# Even if ALLOCA is set, don't use it if compiling with GCC. -USE_ALLOCA= ${ALLOCA} -USE_HOST_ALLOCA= ` case "${HOST_ALLOCA}" in ?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac ` -USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac ` -USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac ` -USE_HOST_VFPRINTF= ` case "${HOST_VFPRINTF}" in ?*) echo ${HOST_PREFIX}${HOST_VFPRINTF} ;; esac ` -USE_HOST_DOPRINT= ` case "${HOST_DOPRINT}" in ?*) echo ${HOST_PREFIX}${HOST_DOPRINT} ;; esac ` - -# Dependency on obstack, alloca, malloc or whatever library facilities -# are not installed in the system libraries. -# We don't use USE_ALLOCA because backquote expansion doesn't work in deps. -LIBDEPS= $(INTLLIBS) $(OBSTACK) $(ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT) - -# Likewise, for use in the tools that must run on this machine -# even if we are cross-building GCC. -# We don't use USE_ALLOCA because backquote expansion doesn't work in deps. -HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_INTLLIBS) $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC) $(HOST_PREFIX)$(HOST_VFPRINTF) $(HOST_PREFIX)$(HOST_DOPRINT) - -# How to link with both our special library facilities -# and the system's installed libraries. -LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(INTLLIBS) @LIBS@ $(VFPRINTF) $(DOPRINT) $(CLIB) ../libiberty/libiberty.a - -# Likewise, for use in the tools that must run on this machine -# even if we are cross-building GCC. -HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \ - $(HOST_INTLLIBS) $(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) \ - $(HOST_CLIB) - -HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o -HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o -HOST_PRINT = $(HOST_PREFIX)print-rtl.o - -# Specify the directories to be searched for header files. -# Both . and srcdir are used, in that order, -# so that tm.h and config.h will be found in the compilation -# subdirectory rather than in the source directory. -INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config -I$(srcdir)/../include - -# Always use -I$(srcdir)/config when compiling. -.c.o: - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< - -# This tells GNU make version 3 not to export all the variables -# defined in this file into the environment. -.NOEXPORT: -# -# Support for additional languages (other than c and objc). -# ??? objc can be supported this way too (leave for later). - -# These next lines are overridden by configure. -LANG_MAKEFILES = @all_lang_makefiles@ -LANG_STAGESTUFF = @all_stagestuff@ -LANG_DIFF_EXCLUDES = @all_diff_excludes@ -LANG_LIB2FUNCS = @all_lib2funcs@ -LANG_EXTRA_HEADERS = @all_headers@ - -# Flags to pass to recursive makes. -# CC is set by configure. Hosts without symlinks need special handling -# because we need CC="stage1/xgcc -Bstage1/" to work in the language -# subdirectories. -# ??? The choices here will need some experimenting with. -ORDINARY_FLAGS_TO_PASS = \ - "AR_FLAGS_FOR_TARGET=$(AR_FLAGS_FOR_TARGET)" \ - "AR_FOR_TARGET=$(AR_FOR_TARGET)" \ - "BISON=$(BISON)" \ - "BISONFLAGS=$(BISONFLAGS)" \ - "CFLAGS=$(CFLAGS)" \ - "CLIB=$(CLIB)" \ - "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \ - "LDFLAGS=$(LDFLAGS)" \ - "LEX=$(LEX)" \ - "LEXFLAGS=$(LEXFLAGS)" \ - "LN=$(LN)" \ - "LN_S=$(LN_S)" \ - "MAKEINFO=$(MAKEINFO)" \ - "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \ - "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \ - "RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \ - "SHELL=$(SHELL)" \ - "STAGE_PREFIX=@stage_prefix_set_by_configure@" \ - "exeext=$(exeext)" \ - "build_exeext=$(build_exeext)" \ - "objext=$(objext)" \ - "exec_prefix=$(exec_prefix)" \ - "prefix=$(prefix)" \ - "local_prefix=$(local_prefix)" \ - "gxx_include_dir=$(gcc_gxx_include_dir)" \ - "tooldir=$(tooldir)" \ - "gcc_tooldir=$(gcc_tooldir)" \ - "bindir=$(bindir)" \ - "libsubdir=$(libsubdir)" \ - "datadir=$(datadir)" \ - "distdir=../tmp/\$$(subdir)" \ - "localedir=$(localedir)" -FLAGS_TO_PASS = $(ORDINARY_FLAGS_TO_PASS) "CC=@cc_set_by_configure@" -PREPEND_DOTDOT_TO_RELATIVE_PATHS = sed \ - -e 's|^ *[^ /][^ /]*/|%&|' \ - -e 's| -B| -B%|g' \ - -e 's|% *[^- /]|%&|g' \ - -e 's|%% *|../|g' \ - -e 's|%||g' -SUBDIR_FLAGS_TO_PASS = $(ORDINARY_FLAGS_TO_PASS) \ - "CC=`echo @quoted_cc_set_by_configure@ | $(PREPEND_DOTDOT_TO_RELATIVE_PATHS)`" -# -# Lists of files for various purposes. - -# Language-specific object files for C and Objective C. -C_AND_OBJC_OBJS = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \ - c-aux-info.o c-common.o c-iterate.o @extra_c_objs@ - -# Language-specific object files for C. -C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS) - -SCHED_PREFIX = @sched_prefix@ -SCHED_CFLAGS = @sched_cflags@ - -# Language-independent object files. -OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \ - function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o \ - intl.o varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o real.o \ - dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o gcse.o \ - integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o varray.o \ - regclass.o regmove.o local-alloc.o global.o reload.o reload1.o caller-save.o \ - insn-peep.o reorg.o $(SCHED_PREFIX)sched.o final.o recog.o reg-stack.o \ - insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o lcm.o \ - profile.o insn-attrtab.o $(out_object_file) getpwd.o $(EXTRA_OBJS) convert.o \ - mbchar.o dyn-string.o splay-tree.o graph.o sbitmap.o resource.o hash.o - -# GEN files are listed separately, so they can be built before doing parallel -# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load -# them before rtl.o is compiled. -GEN= genemit genoutput genrecog genextract genflags gencodes genconfig \ - genpeep gengenrtl gencheck - -CCCP=@cpp_main@ - -# Files to be copied away after each stage in building. -STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \ - insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \ - insn-attr.h insn-attrtab.c insn-opinit.c tree-check.h \ - s-flags s-config s-codes s-mlib s-under\ - s-output s-recog s-emit s-extract s-peep s-check \ - s-attr s-attrtab s-opinit s-crt s-crtS s-crt0 \ - genemit$(build_exeext) genoutput$(build_exeext) genrecog$(build_exeext) \ - genextract$(build_exeext) genflags$(build_exeext) gencodes$(build_exeext) \ - genconfig$(build_exeext) genpeep$(build_exeext) genattrtab$(build_exeext) \ - genattr$(build_exeext) genopinit$(build_exeext) gengenrtl$(build_exeext) \ - gencheck$(build_exeext) \ - xgcc$(exeext) xcpp$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) \ - $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \ - $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \ - protoize$(exeext) unprotoize$(exeext) \ - specs collect2$(exeext) $(USE_COLLECT2) underscore.c \ - gcov$(exeext) *.bp \ - *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \ - *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.gcse *.flow2 \ - *.[si] libcpp.a \ - $(LANG_STAGESTUFF) - -# Members of libgcc1.a. -LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \ - _lshrsi3 _ashrsi3 _ashlsi3 \ - _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \ - _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \ - _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \ - _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \ - _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2 - -# Library members defined in libgcc2.c. -LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \ - _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \ - _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \ - _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \ - _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \ - _fixtfdi _fixunstfdi _floatditf \ - __gcc_bcmp _varargs __dummy _eprintf \ - _bb _shtab _clear_cache _trampoline __main _exit \ - _ctors _pure - -LIB2FUNCS_EH = _eh - -FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \ - _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \ - _lt_sf _le_sf _si_to_sf _sf_to_si _negate_sf _make_sf \ - _sf_to_df - -DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \ - _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \ - _lt_df _le_df _si_to_df _df_to_si _negate_df _make_df \ - _df_to_sf - -# The files that "belong" in CONFIG_H are deliberately omitted -# because having them there would not be useful in actual practice. -# All they would do is cause complete recompilation every time -# one of the machine description files is edited. -# That may or may not be what one wants to do. -# If it is, rm *.o is an easy way to do it. -# CONFIG_H = $(host_xm_file) $(tm_file) -CONFIG_H = -RTL_BASE_H = rtl.h rtl.def machmode.h machmode.def -RTL_H = $(RTL_BASE_H) genrtl.h -TREE_H = tree.h real.h tree.def machmode.h machmode.def tree-check.h -BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h -DEMANGLE_H = $(srcdir)/../include/demangle.h -RECOG_H = recog.h -EXPR_H = expr.h insn-codes.h -REGS_H = regs.h varray.h machmode.h machmode.def -# -# Language makefile fragments. - -# The following targets define the interface between us and the languages. -# -# all.build, all.cross, start.encap, rest.encap, -# info, dvi, -# install-normal, install-common, install-info, install-man, -# uninstall, distdir, -# mostlyclean, clean, distclean, extraclean, maintainer-clean, -# stage1, stage2, stage3, stage4 -# -# Each language is linked in with a series of hooks (since we can't use `::' -# targets). The name of each hooked is "lang.${target_name}" (eg: lang.info). -# Configure computes and adds these here. - -####language hooks -@language_hooks@ - -# sed inserts language fragments after the following line. -####language fragments -@language_fragments@ - -# End of language makefile fragments. -# -# The only suffixes we want for implicit rules are .c and .o, so clear -# the list and add them. This speeds up GNU Make, and allows -r to work. -.SUFFIXES: -.SUFFIXES: .c .o - -Makefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.c \ - $(xmake_file) $(tmake_file) $(LANG_MAKEFILES) - $(SHELL) $(srcdir)/configure.frag $(srcdir) "$(SUBDIRS)" \ - "$(xmake_file)" "$(tmake_file)" - cp config.status config.run - LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.run - rm -f config.run - -$(srcdir)/configure: $(srcdir)/configure.in - cd $(srcdir); autoconf - -# cstamp-h.in controls rebuilding of config.in. -# It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't -# delete it. A stamp file is needed as autoheader won't update the file if -# nothing has changed. -# It remains in the source directory and is part of the distribution. -# This follows what is done in shellutils, fileutils, etc. -# "echo timestamp" is used instead of touch to be consistent with other -# packages that use autoconf (??? perhaps also to avoid problems with patch?). -# ??? Newer versions have a maintainer mode that may be useful here. -$(srcdir)/config.in: $(srcdir)/cstamp-h.in -$(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h - cd $(srcdir) && autoheader - @rm -f $(srcdir)/cstamp-h.in - echo timestamp > $(srcdir)/cstamp-h.in -auto-host.h: cstamp-h ; @true -cstamp-h: config.in config.status - CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status - -# Really, really stupid make features, such as SUN's KEEP_STATE, may force -# a target to build even if it is up-to-date. So we must verify that -# config.status does not exist before failing. -config.status: configure version.c - @if [ ! -f config.status ] ; then \ - echo You must configure gcc. Look at the INSTALL file for details.; \ - false; \ - else \ - LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \ - fi - -all.internal: start.encap rest.encap doc -# This is what to compile if making a cross-compiler. -# Note that we can compile enquire using the cross-compiler just built, -# although we can't run it on this machine. -all.cross: native gcc-cross specs stmp-headers $(STMP_FIXPROTO) $(LIBGCC) \ - $(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross doc -# This is what to compile if making gcc with a cross-compiler. -all.build: native xgcc$(exeext) xcpp$(exeext) $(EXTRA_PARTS) lang.all.build -# This is what must be made before installing GCC and converting libraries. -start.encap: native xgcc$(exeext) xcpp$(exeext) specs $(LIBGCC1) \ - xlimits.h lang.start.encap -# These can't be made until after GCC can run. -rest.encap: stmp-headers $(STMP_FIXPROTO) $(LIBGCC) $(EXTRA_PARTS) lang.rest.encap -# This is what is made with the host's compiler -# whether making a cross compiler or not. -native: config.status auto-host.h cpp$(exeext) intl.all $(LANGUAGES) \ - $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) - -# Define the names for selecting languages in LANGUAGES. -C c: cc1$(exeext) -PROTO: proto - -# Tell GNU make these are phony targets. -.PHONY: C c PROTO proto - -# On the target machine, finish building a cross compiler. -# This does the things that can't be done on the host machine. -rest.cross: $(LIBGCC) specs - -# Verify that it works to compile and link libgcc1-test. -# If it does, then there are sufficient replacements for libgcc1.a. -libgcc1-test: libgcc1-test.o native $(GCC_PARTS) - @echo "Testing libgcc1. Ignore linker warning messages." - $(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \ - -nostartfiles -nostdlib `$(GCC_FOR_TARGET) --print-libgcc-file-name` -libgcc1-test.o: libgcc1-test.c native xgcc$(exeext) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/libgcc1-test.c - -# Recompile all the language-independent object files. -# This is used only if the user explicitly asks for it. -compilations: ${OBJS} - -# Create a list of the language-independent object files so the language -# subdirectories needn't mention their names explicitly. -stamp-objlist: $(OBJS) - echo " $(OBJS)" | sed -e 's, \([a-z0-9]\), ../\1,g' -e 's/\.o/$(objext)/g' >stamp-objlist - -# We call this executable `xgcc' rather than `gcc' -# to avoid confusion if the current directory is in the path -# and CC is `gcc'. It is renamed to `gcc' when it is installed. -xgcc$(exeext): gcc.o gccspec.o version.o intl.o prefix.o \ - version.o $(LIBDEPS) $(EXTRA_GCC_OBJS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o gccspec.o intl.o \ - prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS) - -# We call this executable `xcpp' rather than `cpp' -# since the real preprocessor is named `cpp'. It too is renamed -# when it is installed. -# The only difference from xgcc is that it's linked with cppspec.o -# instead of gccspec.o. -xcpp$(exeext): gcc.o cppspec.o version.o intl.o prefix.o \ - version.o $(LIBDEPS) $(EXTRA_GCC_OBJS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o cppspec.o intl.o \ - prefix.o version.o $(EXTRA_GCC_OBJS) $(LIBS) - -# Dump a specs file to make -B./ read these specs over installed ones. -specs: xgcc$(exeext) - $(GCC_FOR_TARGET) -dumpspecs > tmp-specs - mv tmp-specs specs - -# We do want to create an executable named `xgcc', so we can use it to -# compile libgcc2.a. -# Also create gcc-cross, so that install-common will install properly. -gcc-cross: xgcc$(exeext) - cp xgcc$(exeext) gcc-cross$(exeext) - -cc1$(exeext): $(P) $(OBJS) $(C_OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(C_OBJS) $(LIBS) - -# Build the version of limits.h that we will install. -xlimits.h: glimits.h limitx.h limity.h - if $(LIMITS_H_TEST) ; then \ - cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \ - else \ - cat $(srcdir)/glimits.h > tmp-xlimits.h; \ - fi - mv tmp-xlimits.h xlimits.h -# -# Build libgcc.a. -# This is done in two parts because some functions, in libgcc1.c, -# must be compiled with something other than GCC, -# while the rest, in libgcc2.c, must be compiled with xgcc. -# That means we can't do libgcc2.c until after xgcc, cc1, etc. - -# Use this as value of LIBGCC1 to cause conversion to GNU library format. -# LIBCONVERT should put its output in libgcc1.conv. -libgcc1.conv: libgcc1.a - $(LIBCONVERT) libgcc1.a libgcc1.conv - -# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely. -# Make an empty file instead. -libgcc1.null: $(GCC_PASSES) - echo "void __foo () {}" > dummy.c - $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c - $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) libgcc1.null dummy$(objext) - rm -f dummy$(objext) dummy.c - -# This is $(LIBGCC1) for a cross-compiler. -# We have no automatic way of building libgcc1.a, -# so it's up to the installer to find a way to do that. -# This rule deliberately does not depend on libgcc1.a -# so that it will fail if the installer hasn't provided it. -libgcc1.cross: - mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false) - -# Compile the library of arithmetic subroutines with the native compiler. -# Don't compile it with GCC! -# (That would cause most arithmetic functions to call themselves.) -# -# NOTE: If you modify these rules substantially, please be sure to -# check at least config/i386/t-sco5 and possibly other makefile -# fragments. -libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status - -rm -f tmplibgcc1.a -# Actually build it in tmplibgcc1.a, then rename at end, -# so that libgcc1.a itself remains nonexistent if compilation is aborted. -# -e causes any failing command to make this rule fail. -# -e doesn't work in certain shells, so we test $$? as well. -# lynx has a broken ar, it always complains when the initial library is -# empty, thus this command works only if we don't do -e -# There is a trailing backslash (\) deleted from the following line. -# set -e; - for name in $(LIB1FUNCS); \ - do \ - echo $${name}; \ - rm -f $${name}$(objext); \ - $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - mv libgcc1$(objext) $${name}$(objext); \ - $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \ - rm -f $${name}$(objext); \ - done -# Some shells crash when a loop has no items. -# So make sure there is always at least one--`..'. -# Then ignore it. -# We don't use -e here because there are if statements -# that should not make the command give up when the if condition is false. -# Instead, we test for failure after each command where it matters. - for file in .. $(LIB1FUNCS_EXTRA); \ - do \ - if [ x$${file} != x.. ]; then \ - name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \ - echo $${name}; \ - if [ $${name}.asm = $${file} ]; then \ - cp $${file} $${name}.s || exit 1; file=$${name}.s; \ - else true; fi; \ - $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - rm -f $${name}.s $${name}$(objext); \ - else true; \ - fi; \ - done - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) tmplibgcc1.a; \ - else true; fi - mv tmplibgcc1.a libgcc1.a - -# Build libgcc1.a from assembler source. LIB1ASMFUNCS is the list of -# functions. LIB1ASMSRC is the name of the source file in the config -# subdirectory. -libgcc1-asm.a: libgcc2.ready config.status $(srcdir)/config/$(LIB1ASMSRC) - -rm -f tmplibgcc1.a libgcc1.S - cp $(srcdir)/config/$(LIB1ASMSRC) libgcc1.S -# Actually build it in tmplibgcc1.a, then rename at end, -# so that libgcc1-asm.a itself remains nonexistent if compilation is aborted. -# -e causes any failing command to make this rule fail. -# -e doesn't work in certain shells, so we test $$? as well. -# lynx has a broken ar, it always complains when the initial library is -# empty, thus this command works only if we don't do -e -# There is a trailing backslash (\) deleted from the following line. -# set -e; - for name in $(LIB1ASMFUNCS); \ - do \ - echo $${name}; \ - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - mv libgcc1$(objext) $${name}$(objext); \ - $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc1.a $${name}$(objext); \ - rm -f $${name}$(objext); \ - done - -rm -f libgcc1.S - mv tmplibgcc1.a libgcc1-asm.a - -# Generate assembly versions of the functions required for libgcc1. -# You'll still need to massage the code by hand (possibly hacking -# underscores and local labels) but this will get you started. -libgcc1.S: libgcc1.c $(CONFIG_H) config.status - -rm -f libgcc1.S - touch libgcc1.S - for name in $(LIB1FUNCS); \ - do \ - echo $${name}; \ - $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -S -DL$${name} $(srcdir)/libgcc1.c; \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - echo '#ifdef ' L$${name} >> libgcc1.S; \ - cat libgcc1.s >> libgcc1.S; \ - echo '#endif /*' L$${name} '*/' >> libgcc1.S; \ - echo "" >> libgcc1.S; \ - done - -# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled. -# But recompiling cc1 should not force recompilation of libgcc2.a. -# If you want to force recompilation, delete libgcc2.a. -libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs $(STMP_FIXPROTO) - -if [ -f libgcc2.ready ] ; then \ - true; \ - else \ - touch libgcc2.ready; \ - fi - -LIB2ADD = $(srcdir)/frame.c $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS) -libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(FPBIT) $(DPBIT) $(LIB2ADD) \ - machmode.h longlong.h frame.h gbl-ctors.h config.status -# Actually build it in tmplibgcc2.a, then rename at end, -# so that libgcc2.a itself remains nonexistent if compilation is aborted. - -rm -f tmplibgcc2.a -# -e causes any failing command to make this rule fail. -# -e doesn't work in certain shells, so we test $$? as well. -# lynx has a broken ar, it always complains when the initial library is -# empty, thus this command works only if we don't do -e -# There is a trailing backslash (\) deleted from the following line. -# set -e; - for name in $(LIB2FUNCS); \ - do \ - echo $${name}; \ - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \ - $(MAYBE_USE_COLLECT2) $(srcdir)/libgcc2.c -o $${name}$(objext); \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \ - rm -f $${name}$(objext); \ - done - for name in $(LIB2FUNCS_EH); \ - do \ - echo $${name}; \ - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -fexceptions $(INCLUDES) -c \ - -DL$${name} $(srcdir)/libgcc2.c -o $${name}$(objext); \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \ - rm -f $${name}$(objext); \ - done - if [ x$(FPBIT) != x ]; then \ - for name in $(FPBIT_FUNCS); \ - do \ - echo $${name}; \ - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \ - -DFINE_GRAINED_LIBRARIES $(FPBIT) -o $${name}$(objext); \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \ - rm -f $${name}$(objext); \ - done; \ - else true; fi; - if [ x$(DPBIT) != x ]; then \ - for name in $(DPBIT_FUNCS); \ - do \ - echo $${name}; \ - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \ - -DFINE_GRAINED_LIBRARIES $(DPBIT) -o $${name}$(objext); \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \ - rm -f $${name}$(objext); \ - done; \ - else true; fi; -# Some shells crash when a loop has no items. -# So make sure there is always at least one--`..'. -# Then ignore it. -# We don't use -e here because there are if statements -# that should not make the command give up when the if condition is false. -# Instead, we test for failure after each command where it matters. - for file in $(LIB2ADD); do \ - name=`echo $${file} | sed -e 's/[.][cSo]$$//' -e 's/[.]asm$$//' -e 's/[.]txt$$//'`; \ - oname=` echo $${name} | sed -e 's,.*/,,'`; \ - if [ $${name}.txt = $${file} ]; then \ - for f in .. `cat $${file}`; do if [ x$${f} != x.. ]; then \ - $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" CC="$(CC)" \ - CFLAGS="$(CFLAGS)" HOST_PREFIX="$(HOST_PREFIX)" \ - HOST_PREFIX_1="$(HOST_PREFIX_1)" \ - LANGUAGES="$(LANGUAGES)" \ - LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $${f}; \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${f}; \ - rm -f $${f}; \ - else true; \ - fi; done; \ - else \ - echo $${name}; \ - if [ $${name}.asm = $${file} ]; then \ - cp $${file} $${name}.s || exit 1; file=$${name}.s; \ - else true; fi; \ - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${oname}$(objext); \ - rm -f $${name}.s $${oname}$(objext); \ - fi; \ - done - mv tmplibgcc2.a libgcc2.a -# These lines were deleted from above the mv command -# because ranlibing libgcc.a itself should suffice. -# -if [ x${HPUX_GAS} = x ] ; then \ -# if $(RANLIB_TEST_FOR_TARGET) ; then \ -# $(RANLIB_FOR_TARGET) tmplibgcc2.a; -# else true; fi; \ -# else true; fi - -# Combine the various libraries into a single library, libgcc.a. -libgcc.a: $(LIBGCC1) $(LIBGCC2) - -rm -rf tmplibgcc.a libgcc.a tmpcopy - mkdir tmpcopy - -if [ x$(LIBGCC1) != x ]; \ - then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1)); \ - else true; \ - fi -# Some versions of ar (specifically the one in RISC/os 5.x), create an -# unwritable table of contents file, and then print an error message when -# the second ar command tries to overwrite this file. To avoid the error -# message from ar, we make sure all files are writable. - -(cd tmpcopy; chmod +w * > /dev/null 2>&1) - (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2)) - (cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext)) - rm -rf tmpcopy - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) tmplibgcc.a; \ - else true; fi -# Actually build it in tmplibgcc.a, then rename at end, -# so that libgcc.a itself remains nonexistent if compilation is aborted. - mv tmplibgcc.a libgcc.a - -# Use the genmultilib shell script to generate the information the gcc -# driver program needs to select the library directory based on the -# switches. -multilib.h: s-mlib; @true -s-mlib: $(srcdir)/genmultilib Makefile - $(SHELL) $(srcdir)/genmultilib \ - "$(MULTILIB_OPTIONS)" \ - "$(MULTILIB_DIRNAMES)" \ - "$(MULTILIB_MATCHES)" \ - "$(MULTILIB_EXCEPTIONS)" \ - "$(MULTILIB_EXTRA_OPTS)" > tmp-mlib.h - $(srcdir)/move-if-change tmp-mlib.h multilib.h - touch s-mlib - -# Build multiple copies of libgcc.a, one for each target switch. -stmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \ - frame.h \ - $(LIB2ADD) machmode.h longlong.h gbl-ctors.h config.status - for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \ - dir=`echo $$i | sed -e 's/;.*$$//'`; \ - flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ - $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ - CC="$(CC)" CFLAGS="$(CFLAGS)" \ - RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ - RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \ - LANGUAGES="$(LANGUAGES)" \ - HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \ - LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \ - MULTILIB_CFLAGS="$${flags}" \ - LIBGCC1="$(LIBGCC1)" LIBGCC2="$(LIBGCC2)" \ - dir="$${dir}" stmp-multilib-sub; \ - if [ $$? -eq 0 ] ; then true; else exit 1; fi; \ - done - touch stmp-multilib - -# Subroutine of stmp-multilib so make -n works. -stmp-multilib-sub: - rm -f $(LIBGCC2) - if [ -d $(dir) ]; then \ - cd $(dir); \ - rm -f libgcc.a $(EXTRA_MULTILIB_PARTS); \ - else true; \ - fi - $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ - CC="$(CC)" CFLAGS="$(CFLAGS)" \ - HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \ - LANGUAGES="$(LANGUAGES)" \ - LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC2) - if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \ - then true; \ - else rm -f $(LIBGCC1); \ - fi - if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \ - then true; \ - else \ - $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ - CC="$(CC)" CFLAGS="$(CFLAGS)" \ - HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \ - LANGUAGES="$(LANGUAGES)" \ - LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC1); \ - fi - rm -rf tmplibgcc.a tmpcopy - mkdir tmpcopy - if [ x$(LIBGCC1) != x ]; \ - then (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC1)); \ - else true; \ - fi -# Some versions of ar (specifically the one in RISC/os 5.x), create an -# unwritable table of contents file, and then print an error message when -# the second ar command tries to overwrite this file. To avoid the error -# message from ar, we make sure all files are writable. - -(cd tmpcopy; chmod +w * > /dev/null 2>&1) - (cd tmpcopy; $(AR_FOR_TARGET) x ../$(LIBGCC2)) - (cd tmpcopy; $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) ../tmplibgcc.a *$(objext)) - rm -rf libgcc2.a tmpcopy - if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) tmplibgcc.a; \ - else true; fi - if [ -d $(dir) ]; then true; else mkdir $(dir); fi - mv tmplibgcc.a $(dir)/libgcc.a - for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ - $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \ - AR_FOR_TARGET="$(AR_FOR_TARGET)" \ - AR_FLAGS_FOR_TARGET="$(AR_FLAGS_FOR_TARGET)" \ - CC="$(CC)" CFLAGS="$(CFLAGS)" \ - HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \ - LANGUAGES="$(LANGUAGES)" \ - MULTILIB_CFLAGS="$(MULTILIB_CFLAGS)" T="t" t$${f}; \ - mv t$${f} $(dir)/$${f}; \ - else true; \ - fi; done - -# Compile two additional files that are linked with every program -# linked using GCC on systems using COFF or ELF, for the sake of C++ -# constructors. -$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ - defaults.h frame.h gbl-ctors.h - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o $(T)crtbegin$(objext) - -$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ - defaults.h frame.h gbl-ctors.h - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \ - -c $(srcdir)/crtstuff.c -DCRT_END -o $(T)crtend$(objext) - -# On some systems we also want to install versions of these files -# compiled using PIC for use in shared libraries. -crtbeginS.o crtendS.o: s-crtS ; @true - -s-crtS: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ - defaults.h frame.h gbl-ctors.h - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \ - -DCRT_BEGIN -DCRTSTUFFS_O -finhibit-size-directive -fno-inline-functions \ - -fno-exceptions -g0 -c $(srcdir)/crtstuff.c - mv crtstuff$(objext) crtbeginS$(objext) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \ - -DCRT_END -DCRTSTUFFS_O -finhibit-size-directive -fno-inline-functions \ - -fno-exceptions -g0 -c $(srcdir)/crtstuff.c -o crtendS$(objext) - touch s-crtS - -# Compile the start modules crt0.o and mcrt0.o that are linked with every program -crt0.o: s-crt0 ; @true -mcrt0.o: s-crt0; @true - -s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \ - -o crt0.o -c $(CRT0_S) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \ - -o mcrt0.o -c $(MCRT0_S) - touch s-crt0 -# -# Compiling object files from source files. - -# Note that dependencies on obstack.h are not written -# because that file is not part of GCC. - -# C language specific files. - -c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \ - $(srcdir)/c-parse.h c-tree.h input.h flags.h system.h toplev.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c -$(srcdir)/c-parse.h: $(srcdir)/c-parse.c -$(srcdir)/c-parse.c: $(srcdir)/c-parse.y - cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o c-parse.c c-parse.y -$(srcdir)/c-parse.y: c-parse.in - echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y - sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \ - -e "/^ifc$$/d" -e "/^end ifc$$/d" \ - $(srcdir)/c-parse.in >>tmp-c-parse.y - $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y - -$(srcdir)/c-gperf.h: c-parse.gperf - gperf -L C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \ - -k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h - $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h - -c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h flags.h \ - output.h toplev.h -c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \ - intl.h output.h $(EXPR_H) $(RTL_H) toplev.h -c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h toplev.h \ - output.h -c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \ - $(srcdir)/c-parse.h input.h intl.h flags.h $(srcdir)/c-gperf.h c-pragma.h \ - toplev.h output.h mbchar.h -c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \ - toplev.h -c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h -c-pragma.o: c-pragma.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) except.h \ - function.h defaults.h c-pragma.h toplev.h -c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \ - flags.h toplev.h $(EXPR_H) -mbchar.o: mbchar.c $(CONFIG_H) system.h mbchar.h -graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \ - hard-reg-set.h $(BASIC_BLOCK_H) -sbitmap.o: sbitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) - -COLLECT2_OBJS = collect2.o tlink.o hash.o intl.o underscore.o version.o -collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS) -# Don't try modifying collect2 (aka ld) in place--it might be linking this. - -rm -f collect2$(exeext) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(COLLECT2_OBJS) $(LIBS) - -collect2.o : collect2.c $(CONFIG_H) system.h gstab.h intl.h \ - $(srcdir)/../include/obstack.h $(DEMANGLE_H) collect2.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DTARGET_MACHINE=\"$(target_alias)\" $(MAYBE_USE_COLLECT2) \ - -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'` - -tlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H) system.h toplev.h collect2.h -hash.o: hash.c hash.h system.h toplev.h - -vfprintf.o: $(srcdir)/../libiberty/vfprintf.c $(CONFIG_H) system.h - rm -f vfprintf.c - $(LN_S) $(srcdir)/../libiberty/vfprintf.c vfprintf.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) vfprintf.c - -splay-tree.o: $(srcdir)/../libiberty/splay-tree.c \ - $(srcdir)/../include/splay-tree.h $(srcdir)/../include/libiberty.h - rm -f splay-tree.c - $(LN_S) $(srcdir)/../libiberty/splay-tree.c splay-tree.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) splay-tree.c - -underscore.c: s-under ; @true - -s-under: $(GCC_PASSES) - echo "int xxy_us_dummy;" >tmp-dum.c - $(GCC_FOR_TARGET) -S tmp-dum.c - echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c - if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \ - echo "int prepends_underscore = 1;" >>tmp-under.c; \ - else \ - echo "int prepends_underscore = 0;" >>tmp-under.c; \ - fi - $(srcdir)/move-if-change tmp-under.c underscore.c - -rm -f tmp-dum.c tmp-dum.s - touch s-under - -# A file used by all variants of C. - -c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \ - flags.h toplev.h output.h c-pragma.h $(RTL_H) - -# Language-independent files. - -DRIVER_DEFINES = \ - -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \ - -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \ - -DDEFAULT_TARGET_VERSION=\"$(version)\" \ - -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \ - -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" -gcc.o: gcc.c $(CONFIG_H) system.h intl.h multilib.h \ - Makefile $(lang_specs_files) prefix.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - $(DRIVER_DEFINES) \ - -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'` - -gccspec.o: gccspec.c $(CONFIG_H) system.h -cppspec.o: cppspec.c $(CONFIG_H) system.h - -tree-check.h: s-check ; @true -s-check : gencheck $(srcdir)/move-if-change - ./gencheck > tmp-check.h - $(srcdir)/move-if-change tmp-check.h tree-check.h - touch s-check - -gencheck : gencheck.o $(lang_tree_files) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - gencheck.o $(HOST_LIBS) - -gencheck.o : gencheck.c tree.def $(CONFIG_H) hconfig.h system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \ - $(srcdir)/gencheck.c - -dumpvers: dumpvers.c - -version.o: version.c -obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H) - rm -f obstack.c - $(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) obstack.c - -prefix.o: prefix.c $(CONFIG_H) system.h Makefile prefix.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DPREFIX=\"$(prefix)\" \ - -c `echo $(srcdir)/prefix.c | sed 's,^\./,,'` - -convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h - -tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h except.h -print-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H) -stor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \ - function.h $(EXPR_H) $(RTL_H) toplev.h except.h -fold-const.o : fold-const.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h \ - $(RTL_H) -toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) \ - flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \ - insn-codes.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \ - dwarf2out.h sdbout.h dbxout.h $(EXPR_H) $(BASIC_BLOCK_H) \ - $(lang_options_files) - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \ - -DTARGET_NAME=\"$(target_alias)\" \ - -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'` - -rtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h - -print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h basic-block.h -rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H) - -varasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \ - function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \ - xcoffout.h output.h c-pragma.h toplev.h except.h dbxout.h sdbout.h -function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ - function.h insn-flags.h insn-codes.h $(EXPR_H) $(REGS_H) hard-reg-set.h \ - insn-config.h $(RECOG_H) output.h toplev.h except.h hash.h -stmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \ - insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \ - loop.h $(RECOG_H) toplev.h output.h varray.h -except.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ - function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \ - insn-config.h $(RECOG_H) output.h except.h toplev.h intl.h -expr.o : expr.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \ - $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) \ - output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h -calls.o : calls.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \ - insn-flags.h $(REGS_H) toplev.h output.h -expmed.o : expmed.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ - insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) real.h toplev.h -explow.o : explow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ - hard-reg-set.h insn-config.h $(EXPR_H) $(RECOG_H) insn-flags.h \ - insn-codes.h toplev.h -optabs.o : optabs.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ - insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) reload.h \ - toplev.h -dbxout.o : dbxout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h $(REGS_H) \ - insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h dbxout.h \ - toplev.h -sdbout.o : sdbout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h except.h \ - function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) defaults.h real.h \ - insn-config.h $(srcdir)/../include/obstack.h xcoffout.h c-pragma.h \ - sdbout.h toplev.h -dwarfout.o : dwarfout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf.h \ - flags.h insn-config.h reload.h output.h defaults.h toplev.h dwarfout.h -dwarf2out.o : dwarf2out.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf2.h \ - flags.h insn-config.h reload.h output.h defaults.h \ - hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h dyn-string.h -xcoffout.o : xcoffout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) xcoffout.h \ - flags.h toplev.h output.h dbxout.h -emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ - except.h function.h $(REGS_H) insn-config.h $(RECOG_H) real.h \ - $(EXPR_H) $(srcdir)/../include/obstack.h hard-reg-set.h bitmap.h toplev.h -real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h -getpwd.o : getpwd.c $(CONFIG_H) system.h - -integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \ - integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \ - intl.h function.h output.h $(RECOG_H) except.h toplev.h - -jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \ - insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h \ - toplev.h insn-attr.h -stupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \ - $(BASIC_BLOCK_H) insn-config.h reload.h flags.h toplev.h - -cse.o : cse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \ - real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h \ - $(srcdir)/../include/splay-tree.h -gcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \ - flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) \ - output.h toplev.h -resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \ - $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h toplev.h -lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \ - real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) -profile.o : profile.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-flags.h \ - gcov-io.h $(TREE_H) output.h $(REGS_H) toplev.h insn-config.h -loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h loop.h insn-config.h \ - insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \ - toplev.h varray.h -unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \ - integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h varray.h -flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-config.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h recog.h \ - insn-flags.h -combine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h \ - insn-config.h insn-flags.h insn-codes.h insn-attr.h $(REGS_H) $(EXPR_H) \ - $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h -regclass.o : regclass.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h flags.h \ - $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h toplev.h \ - output.h -local-alloc.o : local-alloc.c $(CONFIG_H) system.h $(RTL_H) flags.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) output.h \ - insn-attr.h toplev.h -bitmap.o : bitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) \ - $(REGS_H) -global.o : global.c $(CONFIG_H) system.h $(RTL_H) flags.h reload.h \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h toplev.h -varray.o : varray.c $(CONFIG_H) system.h varray.h $(RTL_H) $(TREE_H) bitmap.h - -reload.o : reload.c $(CONFIG_H) system.h $(RTL_H) flags.h output.h $(EXPR_H) \ - reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h $(REGS_H) \ - real.h toplev.h -reload1.o : reload1.c $(CONFIG_H) system.h $(RTL_H) real.h flags.h $(EXPR_H) \ - reload.h $(REGS_H) hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \ - $(BASIC_BLOCK_H) $(RECOG_H) output.h toplev.h -caller-save.o : caller-save.c $(CONFIG_H) system.h $(RTL_H) flags.h \ - $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) \ - $(RECOG_H) reload.h $(EXPR_H) toplev.h -reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \ - $(BASIC_BLOCK_H) $(REGS_H) insn-config.h insn-attr.h insn-flags.h \ - $(RECOG_H) flags.h output.h $(EXPR_H) toplev.h -alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \ - $(REGS_H) toplev.h output.h $(EXPR_H) -regmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \ - $(RECOG_H) output.h reload.h $(REGS_H) hard-reg-set.h flags.h \ - $(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h -$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) system.h $(RTL_H) \ - $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h \ - insn-attr.h toplev.h recog.h -final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h intl.h \ - $(REGS_H) $(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h \ - output.h hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h \ - defaults.h toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h dbxout.h -recog.o : recog.c $(CONFIG_H) system.h $(RTL_H) \ - $(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \ - insn-flags.h insn-codes.h real.h toplev.h -reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) recog.h \ - $(REGS_H) hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h -dyn-string.o: dyn-string.c dyn-string.h $(CONFIG_H) system.h - -$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \ - $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \ - insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file) - -# Build auxiliary files that support ecoff format. -mips-tfile: mips-tfile.o version.o $(LIBDEPS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS) - -mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H) system.h machmode.h - -mips-tdump: mips-tdump.o version.o $(LIBDEPS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS) - -mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) system.h - -# Build file to support OSF/rose half-pic format. -halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H) system.h - -# Normally this target is not used; but it is used if you -# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c -# from the GNU Emacs distribution. -alloca.o: $(srcdir)/../libiberty/alloca.c - rm -f alloca.c - $(LN_S) $(srcdir)/../libiberty/alloca.c alloca.c - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \ - -c `echo alloca.c | sed 's,^\./,,'` - $(ALLOCA_FINISH) -# -# Generate header and source files from the machine description, -# and compile them. - -.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \ - insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \ - insn-attr.h insn-attrtab.c - -# The following pair of rules has this effect: -# genconfig is run only if the md has changed since genconfig was last run; -# but the file insn-config.h is touched only when its contents actually change. - -# Each of the other insn-* files is handled by a similar pair of rules. - -# This causes an anomaly in the results of make -n -# because insn-* is older than s-* -# and thus make -n thinks that insn-* will be updated -# and force recompilation of things that depend on it. -# We use move-if-change precisely to avoid such recompilation. -# But there is no way to teach make -n that it will be avoided. - -# Each of the insn-*.[ch] rules has a semicolon at the end, -# for otherwise the system Make on SunOS 4.1 never tries -# to recompile insn-*.o. To avoid problems and extra noise from -# versions of make which don't like empty commands (nothing after the -# trailing `;'), we call true for each. - -insn-config.h: s-config ; @true -s-config : $(md_file) genconfig $(srcdir)/move-if-change - ./genconfig $(md_file) > tmp-config.h - $(srcdir)/move-if-change tmp-config.h insn-config.h - touch s-config - -insn-flags.h: s-flags ; @true -s-flags : $(md_file) genflags $(srcdir)/move-if-change - ./genflags $(md_file) > tmp-flags.h - $(srcdir)/move-if-change tmp-flags.h insn-flags.h - touch s-flags - -insn-codes.h: s-codes ; @true -s-codes : $(md_file) gencodes $(srcdir)/move-if-change - ./gencodes $(md_file) > tmp-codes.h - $(srcdir)/move-if-change tmp-codes.h insn-codes.h - touch s-codes - -insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \ - insn-config.h insn-flags.h insn-codes.h system.h reload.h recog.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c - -insn-emit.c: s-emit ; @true -s-emit : $(md_file) genemit $(srcdir)/move-if-change - ./genemit $(md_file) > tmp-emit.c - $(srcdir)/move-if-change tmp-emit.c insn-emit.c - touch s-emit - -insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \ - real.h output.h flags.h system.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c - -insn-recog.c: s-recog ; @true -s-recog : $(md_file) genrecog $(srcdir)/move-if-change - ./genrecog $(md_file) > tmp-recog.c - $(srcdir)/move-if-change tmp-recog.c insn-recog.c - touch s-recog - -insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \ - insn-config.h flags.h $(RECOG_H) $(EXPR_H) reload.h system.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c - -insn-opinit.c: s-opinit ; @true -s-opinit : $(md_file) genopinit $(srcdir)/move-if-change - ./genopinit $(md_file) > tmp-opinit.c - $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c - touch s-opinit - -insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) system.h toplev.h \ - insn-config.h recog.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c - -insn-extract.c: s-extract ; @true -s-extract : $(md_file) genextract $(srcdir)/move-if-change - ./genextract $(md_file) > tmp-extract.c - $(srcdir)/move-if-change tmp-extract.c insn-extract.c - touch s-extract - -insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h \ - system.h insn-config.h recog.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c - -insn-peep.c: s-peep ; @true -s-peep : $(md_file) genpeep $(srcdir)/move-if-change - ./genpeep $(md_file) > tmp-peep.c - $(srcdir)/move-if-change tmp-peep.c insn-peep.c - touch s-peep - -insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \ - output.h insn-attr.h insn-config.h system.h toplev.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c - -insn-attr.h: s-attr ; @true -s-attr : $(md_file) genattr $(srcdir)/move-if-change - ./genattr $(md_file) > tmp-attr.h - $(srcdir)/move-if-change tmp-attr.h insn-attr.h - touch s-attr - -insn-attrtab.c: s-attrtab ; @true -s-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change - if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file); \ - then \ - echo Using $(PREMADE_ATTRTAB); \ - cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \ - else \ - ./genattrtab $(md_file) > tmp-attrtab.c; \ - fi - $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c - touch s-attrtab - -insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h conditions.h \ - hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \ - insn-codes.h system.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c - -insn-output.c: s-output ; @true -s-output : $(md_file) genoutput $(srcdir)/move-if-change - ./genoutput $(md_file) > tmp-output.c - $(srcdir)/move-if-change tmp-output.c insn-output.c - touch s-output - -genrtl.o : genrtl.c $(CONFIG_H) $(RTL_H) system.h -genrtl.c genrtl.h : s-genrtl - @true # force gnu make to recheck modification times. - -s-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H) - ./gengenrtl tmp-genrtl.h tmp-genrtl.c - $(srcdir)/move-if-change tmp-genrtl.h genrtl.h - $(srcdir)/move-if-change tmp-genrtl.c genrtl.c - touch s-genrtl - -# -# Compile the programs that generate insn-* from the machine description. -# They are compiled with $(HOST_CC), and associated libraries, -# since they need to run on this machine -# even if GCC is being compiled to run on some other machine. - -# $(CONFIG_H) is omitted from the deps of the gen*.o -# because these programs don't really depend on anything -# about the target machine. They do depend on config.h itself, -# since that describes the host machine. - -# Pass the md file through cpp if the target requests it. -$(MD_FILE): $(MD_DEPS) - rm -f $@ - $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@ - mv tmp-$@ $@ - -genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -genconfig.o : genconfig.c $(RTL_H) $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c - -genflags : genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -genflags.o : genflags.c $(RTL_H) $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c - -gencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -gencodes.o : gencodes.c $(RTL_H) $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c - -genemit : genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -genemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c - -genopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -genopinit.o : genopinit.c $(RTL_H) $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c - -genrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -genrecog.o : genrecog.c $(RTL_H) $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c - -genextract : genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -genextract.o : genextract.c $(RTL_H) $(build_xm_file) system.h insn-config.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c - -genpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -genpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c - -genattr : genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -genattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c - -genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS) - -genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) system.h insn-config.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c - -genoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS) - -genoutput.o : genoutput.c $(RTL_H) $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c - -gengenrtl : gengenrtl.o $(HOST_LIBDEPS) - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \ - gengenrtl.o $(HOST_LIBS) - -gengenrtl.o : gengenrtl.c $(RTL_BASE_H) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gengenrtl.c - -# -# Compile the libraries to be used by gen*. -# If we are not cross-building, gen* use the same .o's that cc1 will use, -# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict -# with the rules for rtl.o, alloca.o, etc. -$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h - rm -f $(HOST_PREFIX)rtl.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c - -$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H) \ - bitmap.h basic-block.h - rm -f $(HOST_PREFIX)print-rtl.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c - -$(HOST_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(CONFIG_H) system.h $(RTL_H) \ - flags.h $(BASIC_BLOCK_H) $(REGS_H) - rm -f $(HOST_PREFIX)bitmap.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(HOST_PREFIX)bitmap.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)bitmap.c - -$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H) - rm -f $(HOST_PREFIX)rtlanal.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c - -$(HOST_PREFIX_1)alloca.o: $(srcdir)/../libiberty/alloca.c - rm -f $(HOST_PREFIX)alloca.c - $(LN_S) $(srcdir)/../libiberty/alloca.c $(HOST_PREFIX)alloca.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c - -$(HOST_PREFIX_1)obstack.o: $(srcdir)/../libiberty/obstack.c - rm -f $(HOST_PREFIX)obstack.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/obstack.c > $(HOST_PREFIX)obstack.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c - -$(HOST_PREFIX_1)vfprintf.o: $(srcdir)/../libiberty/vfprintf.c - rm -f $(HOST_PREFIX)vfprintf.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/vfprintf.c > $(HOST_PREFIX)vfprintf.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)vfprintf.c - -$(HOST_PREFIX_1)doprint.o: doprint.c - rm -f $(HOST_PREFIX)doprint.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/doprint.c > $(HOST_PREFIX)doprint.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)doprint.c - -$(HOST_PREFIX_1)malloc.o: malloc.c - rm -f $(HOST_PREFIX)malloc.c - sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c - -# This satisfies the dependency that we get if you cross-compile a compiler -# that does not need to compile alloca, malloc or whatever. -$(HOST_PREFIX_1): - touch $(HOST_PREFIX_1) - - -# -# Remake internationalization support. - -intl.o: intl.c intl.h gansidecl.h Makefile - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DLOCALEDIR=\"$(localedir)\" \ - -c `echo $(srcdir)/intl.c | sed 's,^\./,,'` - -# This is needed to when doing a partial build after a `make clean'. -# libintl.a does not depend on intl.all, -# as that would force a lot of recompiling. -$(top_builddir)/intl/libintl.a: - @echo "$(MAKE) intl.all" - @$(MAKE) $(FLAGS_TO_PASS) intl.all - -# Make sure all the headers are there for xgettext to scan. -$(INTL_TARGETS): $(srcdir)/c-gperf.h \ - $(srcdir)/c-parse.c $(srcdir)/c-parse.h $(srcdir)/cexp.c - -intl.all intl.install intl.uninstall intl.distdir \ - intl.mostlyclean intl.clean intl.distclean intl.maintainer-clean: - @for d in $(INTL_SUBDIRS); do \ - target=`expr $@ : 'intl.\(.*\)'` && \ - echo "(cd $$d && $(MAKE) $$target)" && \ - (cd $$d && AWK='$(AWK)' $(MAKE) $(SUBDIR_FLAGS_TO_PASS) $$target); \ - done - -# intl.distdir doesn't copy the intl makefiles (since they aren't distributed), -# but we need them for the `make extraclean' in distdir-finish. -intl.distdir-fixup: - for d in $(INTL_SUBDIRS); do \ - ln $$d/Makefile tmp/$$d || cp $$d/Makefile tmp/$$d || exit; \ - done -# -# Remake cpp and protoize. - -# Making the preprocessor -cpp$(exeext): $(CCCP)$(exeext) - -rm -f cpp$(exeext) - $(LN) $(CCCP)$(exeext) cpp$(exeext) -CCCP_OBJS = cccp.o cexp.o intl.o prefix.o version.o @extra_cpp_objs@ mbchar.o -cccp$(exeext): $(CCCP_OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(CCCP_OBJS) $(LIBS) -cexp.o: $(srcdir)/cexp.c $(CONFIG_H) system.h - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c -$(srcdir)/cexp.c: $(srcdir)/cexp.y - cd $(srcdir); $(BISON) -o cexp.c cexp.y - -# We use $(libsubdir)/$(unlibsubdir) to match the -# -iprefix argument which gcc will pass if GCC_EXEC_PREFIX is used. -cccp.o: cccp.c $(CONFIG_H) intl.h pcp.h version.c config.status system.h \ - mbchar.h prefix.h Makefile.in - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ - -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ - -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \ - -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \ - -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ - -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'` - -LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \ - cppinit.o cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@ - -# All the other archives built/used by this makefile are for targets. This -# one is strictly for the host. -# -libcpp.a: $(LIBCPP_OBJS) - $(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS) - if $(RANLIB_TEST) ; then $(RANLIB) libcpp.a ; else true ; fi - -cppmain$(exeext): cppmain.o intl.o libcpp.a $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cppmain$(exeext) cppmain.o \ - intl.o libcpp.a $(LIBS) - -cppmain.o: cppmain.c $(CONFIG_H) cpplib.h intl.h system.h - -cppulp.o: cppulp.c $(CONFIG_H) system.h output.h -cpplib.o: cpplib.c $(CONFIG_H) cpplib.h intl.h system.h cpphash.h -cpphash.o: cpphash.c $(CONFIG_H) cpplib.h intl.h system.h cpphash.h -cppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h intl.h system.h -cpperror.o: cpperror.c $(CONFIG_H) cpplib.h intl.h system.h -cppexp.o: cppexp.c $(CONFIG_H) cpplib.h intl.h system.h -cppfiles.o: cppfiles.c $(CONFIG_H) cpplib.h intl.h system.h - -cppinit.o: cppinit.c $(CONFIG_H) cpplib.h intl.h system.h \ - cpphash.h prefix.h output.h Makefile - $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ - -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ - -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \ - -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \ - -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ - -c `echo $(srcdir)/cppinit.c | sed 's,^\./,,'` - -# Note for the stamp targets, we run the program `true' instead of -# having an empty command (nothing following the semicolon). - -proto: config.status protoize$(exeext) unprotoize$(exeext) SYSCALLS.c.X - -PROTO_OBJS = getpwd.o intl.o version.o - -protoize$(exeext): protoize.o $(PROTO_OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ protoize.o $(PROTO_OBJS) $(LIBS) - -unprotoize$(exeext): unprotoize.o $(PROTO_OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ unprotoize.o $(PROTO_OBJS) $(LIBS) - -protoize.o: protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h \ - Makefile - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ - -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ - -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \ - -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ - -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \ - -DSTD_PROTO_DIR=\"$(libsubdir)\" \ - $(srcdir)/protoize.c - -unprotoize.o: unprotoize.c protoize.c $(srcdir)/../include/getopt.h \ - $(CONFIG_H) system.h Makefile - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \ - -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \ - -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \ - -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \ - -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \ - -DSTD_PROTO_DIR=\"$(libsubdir)\" \ - $(srcdir)/unprotoize.c - -# This info describes the target machine, so compile with GCC just built. -SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \ - stmp-int-hdrs - -rm -f SYSCALLS.c tmp-SYSCALLS.s - cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c - -rm -f SYSCALLS.c tmp-SYSCALLS.s - - -test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES) - -rm -f tmp-proto.[cso] - cp $(srcdir)/protoize.c tmp-proto.c - chmod u+w tmp-proto.c - ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \ - $(CFLAGS) $(INCLUDES) \ - -DGCC_INCLUDE_DIR=0 \ - -DGPLUSPLUS_INCLUDE_DIR=0 \ - -DCROSS_INCLUDE_DIR=0 \ - -DTOOL_INCLUDE_DIR=0 \ - -DSTD_PROTO_DIR=0" tmp-proto.c - @echo '**********' Expect 400 lines of differences. - -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff - -wc -l tmp-proto.diff - ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \ - $(CFLAGS) $(INCLUDES) \ - -DGCC_INCLUDE_DIR=0 \ - -DGPLUSPLUS_INCLUDE_DIR=0 \ - -DCROSS_INCLUDE_DIR=0 \ - -DTOOL_INCLUDE_DIR=0 \ - -DSTD_PROTO_DIR=0" tmp-proto.c - @echo Expect zero differences. - diff $(srcdir)/protoize.c tmp-proto.c | cat - -rm -f tmp-proto.[cs] tmp-proto$(objext) - -gcov.o: gcov.c gcov-io.h intl.h system.h - -# Only one of 'gcov' or 'gcov.exe' is actually built, depending -# upon whether $(exeext) is empty or not. -GCOV_OBJS = gcov.o intl.o -gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@ -# -# Build the include directory. The stamp files are stmp-* rather than -# s-* so that mostlyclean does not force the include directory to -# be rebuilt. - -# Build the include directory including float.h (which no longer depends upon -# enquire). -stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h -# Copy in the headers provided with gcc. -# The sed command gets just the last file name component; -# this is necessary because VPATH could add a dirname. -# Using basename would be simpler, but some systems don't have it. -# The touch command is here to workaround an AIX/Linux NFS bug. - for file in .. $(USER_H); do \ - if [ X$$file != X.. ]; then \ - realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \ - touch include/$$realfile; \ - rm -f include/$$realfile; \ - cp $$file include; \ - chmod a+r include/$$realfile; \ - fi; \ - done - rm -f include/limits.h - cp xlimits.h include/limits.h - chmod a+r include/limits.h - rm -f include/float.h - if [ x$(FLOAT_H) != xMakefile.in ]; then \ - cp $(srcdir)/config/$(FLOAT_H) include/float.h && \ - chmod a+r include/float.h; \ - else :; fi -# Install the README - rm -f include/README - cp $(srcdir)/README-fixinc include/README - chmod a+r include/README - touch $@ - -# Now that float.h no longer depends upon enquire, this is actually a no-op. -stmp-headers: - touch $@ - -FIXINCSRCDIR=$(srcdir)/fixinc -fixinc.sh: $(FIXINCSRCDIR)/mkfixinc.sh $(FIXINCSRCDIR)/fixincl.c \ - $(FIXINCSRCDIR)/procopen.c $(FIXINCSRCDIR)/gnu-regex.c \ - $(FIXINCSRCDIR)/server.c $(FIXINCSRCDIR)/gnu-regex.h \ - $(FIXINCSRCDIR)/server.h $(FIXINCSRCDIR)/inclhack.def - MAKE="$(MAKE)"; srcdir=`cd $(srcdir)/fixinc; pwd` ; \ - export MAKE srcdir ; \ - cd ./fixinc; $(SHELL) $${srcdir}/mkfixinc.sh $(target) - -##stmp-fixinc: $(FIXINCLUDES) gsyslimits.h -## rm -rf include -## mkdir include -## if [ x$(FIXINCLUDES) != xMakefile.in ]; \ -## then \ -## for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \ -## if [ -d $$dir ]; \ -## then \ -## $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \ -## else true; fi; \ -## done; \ -## if [ x$(INSTALL_ASSERT_H) != x ] ; \ -## then \ -## rm -f include/assert.h; \ -## cp $(srcdir)/assert.h include/assert.h; \ -## chmod a+r include/assert.h; \ -## fi \ -## else true; \ -## fi - -# Build fixed copies of system files. -stmp-fixinc: fixinc.sh gsyslimits.h - rm -rf include; mkdir include - TARGET_MACHINE=$(target); srcdir=`cd $(srcdir); pwd`; \ - INSTALL_ASSERT_H=$(INSTALL_ASSERT_H); SHELL=$(SHELL) ;\ - export TARGET_MACHINE srcdir INSTALL_ASSERT_H SHELL ; \ - $(SHELL) ./fixinc.sh `pwd`/include $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) - rm -f include/syslimits.h - if [ -f include/limits.h ]; then \ - mv include/limits.h include/syslimits.h; \ - else \ - cp $(srcdir)/gsyslimits.h include/syslimits.h; \ - fi - chmod a+r include/syslimits.h -# If $(SYSTEM_HEADER_DIR) is $(tooldir)/sys-include, and -# that directory exists, then make sure that $(libsubdir) exists. -# This is because cpp is compiled to find $(tooldir)/include via -# $(libsubdir)/$(unlibsubdir), which will only work if $(libsubdir) -# exists. -# We deliberately use tooldir instead of gcc_tooldir here. gcc_tooldir -# won't work because libsubdir doesn't exist yet. - if [ "$(SYSTEM_HEADER_DIR)" = "$(tooldir)/sys-include" ] \ - && [ -d $(tooldir)/sys-include ]; then \ - if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi; \ - if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib; fi; \ - if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; fi; \ - if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version) ; fi; \ - else true; fi - - touch stmp-fixinc - -# Files related to the fixproto script. - -deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs - if [ -d $(SYSTEM_HEADER_DIR) ]; \ - then \ - CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \ - export CC; \ - $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h; \ - mv tmp-deduced.h deduced.h; \ - else \ - touch deduced.h; \ - fi - -GEN_PROTOS_OBJS = gen-protos.o scan.o libcpp.a -gen-protos: $(GEN_PROTOS_OBJS) $(HOST_LIBDEPS) - ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gen-protos \ - $(GEN_PROTOS_OBJS) $(HOST_LIBS) - -gen-protos.o: gen-protos.c scan.h $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c - -scan.o: scan.c scan.h $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c - -xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile - cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c - mv tmp-fixtmp.c fixtmp.c - $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \ - | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \ - | ./gen-protos >xsys-protos.hT - mv xsys-protos.hT xsys-protos.h - rm -rf fixtmp.c - -fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \ - libcpp.a - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \ - scan-decls.o scan.o libcpp.a $(HOST_LIBS) - -fix-header.o: fix-header.c $(srcdir)/../include/obstack.h scan.h \ - xsys-protos.h $(build_xm_file) system.h cpplib.h cpphash.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c - -scan-decls.o: scan-decls.c scan.h cpplib.h $(build_xm_file) system.h - $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c - -# stmp-fixproto depends on this, not on fix-header directly. -# The idea is to make sure fix-header gets built, -# but not rerun fixproto after each stage -# just because fix-header's mtime has changed. -fixhdr.ready: fix-header - -if [ -f fixhdr.ready ] ; then \ - true; \ - else \ - touch fixhdr.ready; \ - fi - -# stmp-headers is to make sure fixincludes has already finished. -# The if statement is so that we don't run fixproto a second time -# if it has already been run on the files in `include'. -stmp-fixproto: fixhdr.ready fixproto stmp-headers - @echo "Various warnings and error messages from fixproto are normal" - -if [ -d include ] ; then true; else mkdir include; fi - -if [ -f include/fixed ] ; then true; \ - else \ - : This line works around a 'make' bug in BSDI 1.1.; \ - FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \ - mkinstalldirs="$(SHELL) $(srcdir)/mkinstalldirs"; \ - export mkinstalldirs; \ - if [ -d $(SYSTEM_HEADER_DIR) ] ; then \ - $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \ - else true; fi; \ - touch include/fixed; \ - fi - touch stmp-fixproto -# -# Remake the info files. - -doc: info -info: cpp.info gcc.info lang.info - -cpp.info: $(srcdir)/cpp.texi - $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi - -gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \ - $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \ - $(srcdir)/tm.texi $(srcdir)/gcov.texi - $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi - -dvi: gcc.dvi cpp.dvi lang.dvi - -# This works with GNU Make's default rule. -gcc.dvi: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \ - $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \ - $(srcdir)/tm.texi $(srcdir)/gcov.texi - TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi - texindex gcc.?? - TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi - -cpp.dvi: $(srcdir)/cpp.texi - TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi - texindex cpp.?? - TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi - - -INSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi - cd $(srcdir); $(MAKEINFO) -D INSTALLONLY \ - --no-split -o INSTALL install1.texi -# -# Deletion of files made during compilation. -# There are four levels of this: -# `mostlyclean', `clean', `distclean' and `maintainer-clean'. -# `mostlyclean' is useful while working on a particular type of machine. -# It deletes most, but not all, of the files made by compilation. -# It does not delete libgcc.a or its parts, so it won't have to be recompiled. -# `clean' deletes everything made by running `make all'. -# `distclean' also deletes the files made by config. -# `maintainer-clean' also deletes everything that could be regenerated -# automatically, except for `configure'. -# We remove as much from the language subdirectories as we can -# (less duplicated code). - - -mostlyclean: intl.mostlyclean lang.mostlyclean - -rm -f $(STAGESTUFF) -# Delete the temporary source copies for cross compilation. - -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c - -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c - -rm -f $(HOST_PREFIX_1)obstack.c -# Delete the temp files made in the course of building libgcc.a. - -rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test - for name in $(LIB1FUNCS); do rm -f $${name}.c; done -# Delete other built files. - -rm -f t-float.h-cross xsys-protos.hT fp-bit.c dp-bit.c -# Delete the stamp and temporary files. - -rm -f s-* tmp-* stamp-* stmp-* - -rm -f */stamp-* */tmp-* -# Delete debugging dump files. - -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop - -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.addressof - -rm -f *.regmove *.mach *.bp *.gcse *.flow2 - -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl - -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2 - -rm -f */*.sched2 */*.stack */*.regmove */*.gcse */*.flow2 -# Delete some files made during installation. - -rm -f specs float.h-* enquire SYSCALLS.c.X SYSCALLS.c - -rm -f collect collect2 mips-tfile mips-tdump alloca.s -# Delete files generated for fixproto - -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \ - gen-protos fixproto.list fixtmp.* fixhdr.ready -# Delete unwanted output files from TeX. - -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg - -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg -# Delete sorted indices we don't actually use. - -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns -# Delete core dumps. - -rm -f core */core - -rm -f *.bp */*.bp - -# Delete all files made by compilation -# that don't exist in the distribution. -clean: mostlyclean intl.clean lang.clean -# It may not be quite desirable to delete unprotoize.c here, -# but the spec for `make clean' requires it. -# Using unprotoize.c is not quite right in the first place, -# but what better way is there? - -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready - -rm -f libgcc1.null - -rm -f *.dvi - -rm -f */*.dvi - -if [ -f md.pre-cpp ]; then \ - rm -f md ; \ - fi -# Delete the include directory. - -rm -rf include -# Delete files used by the "multilib" facility (including libgcc subdirs). - -rm -f multilib.h tmpmultilib* - -if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \ - rm -rf $(MULTILIB_DIRNAMES); \ - else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \ - rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \ - fi ; fi - -rm -fr stage1 stage2 stage3 stage4 - -# Delete all files that users would normally create -# while building and installing GCC. -INTL_DISTCLEAN = intl.distclean -distclean: clean $(INTL_DISTCLEAN) lang.distclean - -rm -f tm.h config.h auto-host.h auto-build.h tconfig.h hconfig.h - -rm -f md cstamp-h - -rm -f config.status config.run config.cache config.bak - -rm -f Make-lang Make-hooks Make-host Make-target - -rm -f Makefile specs.h options.h gencheck.h *.oaux - -rm -f gthr-default.h - -rm -f */stage1 */stage2 */stage3 */stage4 */include - -rm -f c-parse.output - -rm -f *.asm - -rm -f float.h - -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak - -rm -f testsuite/{gcc,g++}.{log,sum} - -rm -f intl/libintl.h libintl.h - -# Delete anything likely to be found in the source directory -# that shouldn't be in the distribution. -extraclean: distclean lang.extraclean - -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~* - -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej - -rm -f config/*/=* config/*/"#"* config/*/*~* - -rm -f config/*/*.orig config/*/*.rej - -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz - -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs - -rm -f *lose config/*lose config/*/*lose - -rm -f *.s *.s[0-9] *.i config/ChangeLog - -rm -f y.tab.c yacc.* - -rm -f */=* */"#"* */*~* - -rm -f */patch* */*.orig */*.rej - -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz - -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs - -rm -f */*lose */*.s */*.s[0-9] */*.i - -# Get rid of every file that's generated from some other file, except for `configure'. -# Most of these files ARE PRESENT in the GCC distribution. -# We define INTL_DISTCLEAN to be empty in the submake, so that -# we don't descend into intl after its makefile has been removed. -maintainer-clean: - @echo 'This command is intended for maintainers to use; it' - @echo 'deletes files that may need special tools to rebuild.' - $(MAKE) INTL_DISTCLEAN= distclean \ - intl.maintainer-clean lang.maintainer-clean - -rm -f c-parse.y c-gperf.h - -rm -f c-parse.c c-parse.h c-parse.output - -rm -f cexp.c cexp.output TAGS - -rm -f cpp.info* cpp.??s cpp.*aux - -rm -f gcc.info* gcc.??s gcc.*aux -# -# Entry points `install' and `uninstall'. -# Also use `install-collect2' to install collect2 when the config files don't. - -# The semicolon is to prevent the install.sh -> install default rule -# from doing anything. Having it run true helps avoid problems and -# noise from versions of make which don't like to have null commands. -install: $(INSTALL_TARGET) ; @true - -# Copy the compiler files into directories where they will be run. -# Install the driver last so that the window when things are -# broken is small. -install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \ - $(INSTALL_CPP) install-man install-info intl.install lang.install-normal \ - install-driver - -# Do nothing while making gcc with a cross-compiler. The person who -# makes gcc for the target machine has to know how to put a complete -# gcc together by hand. -install-build: force - @echo You have to install gcc on your target machine by hand. - -# Run this on the target machine -# to finish installation of cross compiler. -# This is not used anymore now that float.h does not depend on enquire. -install-cross-rest: install-float-h-cross - -# Handle cpp installation. -install-cpp: xcpp$(exeext) - -rm -f $(bindir)/$(CPP_INSTALL_NAME)$(exeext) - $(INSTALL_PROGRAM) -m 755 xcpp$(exeext) $(bindir)/$(CPP_INSTALL_NAME)$(exeext) - if [ x$(cpp_install_dir) != x ]; then \ - rm -f $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) -m 755 xcpp$(exeext) $(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \ - else true; fi - -uninstall-cpp: - -rm -f $(bindir)/cpp - -if [ x$(cpp_install_dir) != x ]; then \ - rm -f $(prefix)/$(cpp_install_dir)/cpp; \ - else true; fi - -# Install float.h for cross compiler. -# Run this on the target machine! -# This is not used anymore now that float.h does not depend on enquire. -install-float-h-cross: installdirs -# if [ -f enquire ] ; then true; else false; fi -# Note: don't use -. We should fail right away if enquire was not made. - ./enquire -f > $(tmpdir)/float.h - -rm -f $(libsubdir)/include/float.h - $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h - -rm -f $(tmpdir)/float.h - chmod a-x $(libsubdir)/include/float.h - -# Create the installation directories. -installdirs: - -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi - -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi - -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi - -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi -# This dir isn't currently searched by cpp. -# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi - -fdir= ; for dir in `echo $(libsubdir) | tr '/' ' '`; do \ - fdir=$${fdir}/$${dir}; \ - if [ -d $${fdir} ] ; then true ; else mkdir $${fdir}; chmod a+rx $${fdir}; fi ; \ - done - -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi - -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi - -if [ -d $(gcc_tooldir) ] ; then true ; else mkdir $(gcc_tooldir) ; chmod a+rx $(gcc_tooldir) ; fi - -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi - -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi -# We don't use mkdir -p to create the parents of man1dir, -# because some systems don't support it. -# Instead, we use this technique to create the immediate parent of man1dir. - -parent=`echo $(man1dir)|sed -e 's@/[^/]*$$@@'`; \ - if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi - -if [ -d $(man1dir) ] ; then true ; else mkdir $(man1dir) ; chmod a+rx $(man1dir) ; fi - -# Install the compiler executables built during cross compilation. -install-common: native installdirs $(EXTRA_PARTS) lang.install-common - for file in $(COMPILERS); do \ - if [ -f $$file ] ; then \ - rm -f $(libsubdir)/$$file; \ - $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \ - else true; \ - fi; \ - done - for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \ - if [ x"$$file" != x.. ]; then \ - rm -f $(libsubdir)/$$file; \ - $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \ - else true; fi; \ - done - for file in $(EXTRA_PARTS) ..; do \ - if [ x"$$file" != x.. ]; then \ - rm -f $(libsubdir)/$$file; \ - $(INSTALL_DATA) $$file $(libsubdir)/$$file; \ - chmod a-x $(libsubdir)/$$file; \ - else true; fi; \ - done -# Don't mess with specs if it doesn't exist yet. - -if [ -f specs ] ; then \ - rm -f $(libsubdir)/specs; \ - $(INSTALL_DATA) specs $(libsubdir)/specs; \ - chmod a-x $(libsubdir)/specs; \ - fi -# Install protoize if it was compiled. - -if [ -f protoize$(exeext) ]; \ - then \ - if [ -f gcc-cross$(exeext) ] ; then \ - rm -f $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \ - rm -f $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \ - else \ - rm -f $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \ - rm -f $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \ - fi ; \ - rm -f $(libsubdir)/SYSCALLS.c.X; \ - $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \ - chmod a-x $(libsubdir)/SYSCALLS.c.X; \ - fi - -rm -f $(libsubdir)/cpp$(exeext) - $(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext) -# Install gcov if it was compiled. - -if [ -f gcov$(exeext) ]; \ - then \ - rm -f $(bindir)/gcov$(exeext); \ - $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \ - fi - -# Install the driver program as $(target_alias)-gcc -# and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc. -install-driver: xgcc$(exeext) - -if [ -f gcc-cross$(exeext) ] ; then \ - rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \ - if [ -d $(gcc_tooldir)/bin/. ] ; then \ - rm -f $(gcc_tooldir)/bin/gcc$(exeext); \ - $(INSTALL_PROGRAM) gcc-cross$(exeext) $(gcc_tooldir)/bin/gcc$(exeext); \ - else true; fi; \ - else \ - rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \ - rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \ - $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \ - mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \ - fi - -# Install the info files. -# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir -# to do the install. -install-info: doc installdirs lang.install-info - -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info* - for f in cpp.info* gcc.info*; do \ - $(INSTALL_DATA) $$f $(infodir)/$$f; \ - done - -if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ - if [ -f $(infodir)/dir ] ; then \ - for f in cpp.info gcc.info; do \ - install-info --dir-file=$(infodir)/dir $(infodir)/$$f; \ - done; \ - else true; fi; \ - else true; fi; - -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info* - -# Install the man pages. -install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man - -if [ -f gcc-cross$(exeext) ] ; then \ - rm -f $(man1dir)/$(GCC_CROSS_NAME)$(manext); \ - $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_CROSS_NAME)$(manext); \ - chmod a-x $(man1dir)/$(GCC_CROSS_NAME)$(manext); \ - else \ - rm -f $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \ - $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \ - chmod a-x $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \ - fi - -rm -f $(man1dir)/cccp$(manext) - -$(INSTALL_DATA) $(srcdir)/cccp.1 $(man1dir)/cccp$(manext) - -chmod a-x $(man1dir)/cccp$(manext) - -# Install the library. -install-libgcc: libgcc.a installdirs - -if [ -f libgcc.a ] ; then \ - rm -f $(libsubdir)/libgcc.a; \ - $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \ - if $(RANLIB_TEST_FOR_TARGET) ; then \ - (cd $(libsubdir); $(RANLIB_FOR_TARGET) libgcc.a); else true; fi; \ - chmod a-x $(libsubdir)/libgcc.a; \ - else true; fi - -# Install multiple versions of libgcc.a. -install-multilib: stmp-multilib installdirs - for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \ - dir=`echo $$i | sed -e 's/;.*$$//'`; \ - if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \ - for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \ - rm -f $(libsubdir)/$${dir}/$${f}; \ - $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \ - done; \ - if $(RANLIB_TEST_FOR_TARGET); then \ - (cd $(libsubdir)/$${dir}; $(RANLIB_FOR_TARGET) libgcc.a); \ - else true; fi; \ - chmod a-x $(libsubdir)/$${dir}/libgcc.a; \ - done - -# Install all the header files built in the include subdirectory. -install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H) -# Fix symlinks to absolute paths in the installed include directory to -# point to the installed directory, not the build directory. -# Don't need to use LN_S here since we really do need ln -s and no substitutes. - -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \ - if [ $$? -eq 0 ]; then \ - dir=`cd include; pwd`; \ - for i in $$files; do \ - dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \ - if expr "$$dest" : "$$dir.*" > /dev/null; then \ - rm -f $(libsubdir)/include/$$i; \ - ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \ - fi; \ - done; \ - fi - -# Create or recreate the gcc private include file directory. -install-include-dir: installdirs - -rm -rf $(libsubdir)/include - mkdir $(libsubdir)/include - -chmod a+rx $(libsubdir)/include - -# Install the include directory using tar. -install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir -# We use `pwd`/include instead of just include to problems with CDPATH -# Unless a full pathname is provided, some shells would print the new CWD, -# found in CDPATH, corrupting the output. We could just redirect the -# output of `cd', but some shells lose on redirection within `()'s - (cd `pwd`/include ; \ - tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - ) -# /bin/sh on some systems returns the status of the first tar, -# and that can lose with GNU tar which always writes a full block. -# So use `exit 0' to ignore its exit status. - -# Install the include directory using cpio. -install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir -# See discussion about the use of `pwd` above - cd `pwd`/include ; \ - find . -print | cpio -pdum $(libsubdir)/include - -# Put assert.h where it won't override GNU libc's assert.h. -# It goes in a dir that is searched after GNU libc's headers; -# thus, the following conditionals are no longer needed. -# But it's not worth deleting them now. -## Don't replace the assert.h already there if it is not from GCC. -## This code would be simpler if it tested for -f ... && ! grep ... -## but supposedly the ! operator is missing in sh on some systems. -install-assert-h: assert.h installdirs - if [ -f $(assertdir)/assert.h ]; \ - then \ - if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \ - then \ - rm -f $(assertdir)/assert.h; \ - $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \ - chmod a-x $(assertdir)/assert.h; \ - else true; \ - fi; \ - else \ - rm -f $(assertdir)/assert.h; \ - $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \ - chmod a-x $(assertdir)/assert.h; \ - fi - -# Use this target to install the program `collect2' under the name `collect2'. -install-collect2: collect2 installdirs - $(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/collect2$(exeext) -# Install the driver program as $(libsubdir)/gcc for collect2. - $(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext) - -# Cancel installation by deleting the installed files. -uninstall: intl.uninstall lang.uninstall $(UNINSTALL_CPP) - -rm -rf $(libsubdir) - -rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext) - -rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext) - -rm -rf $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext) - -rm -rf $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext) - -rm -rf $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext) - -rm -rf $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext) - -rm -rf $(bindir)/$(GCOV_INSTALL_NAME)$(exeext) - -rm -rf $(man1dir)/$(GCC_INSTALL_NAME)$(manext) - -rm -rf $(man1dir)/$(GCC_CROSS_NAME)$(manext) - -rm -rf $(man1dir)/cccp$(manext) - -rm -rf $(man1dir)/protoize$(manext) - -rm -rf $(man1dir)/unprotoize$(manext) - -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info* -# -# These targets are for the dejagnu testsuites. The file site.exp -# contains global variables that all the testsuites will use. - -# Set to $(target_alias)/ for cross. -target_subdir = @target_subdir@ - -site.exp: ./config.status Makefile - @echo "Making a new config file..." - -@rm -f ./tmp? - @touch site.exp - -@mv site.exp site.bak - @echo "## these variables are automatically generated by make ##" > ./tmp0 - @echo "# Do not edit here. If you wish to override these values" >> ./tmp0 - @echo "# add them to the last section" >> ./tmp0 - @echo "set rootme \"`pwd`\"" >> ./tmp0 - @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0 - @echo "set host_triplet $(host_canonical)" >> ./tmp0 - @echo "set build_triplet $(build_canonical)" >> ./tmp0 - @echo "set target_triplet $(target)" >> ./tmp0 - @echo "set target_alias $(target_alias)" >> ./tmp0 -# CFLAGS is set even though it's empty to show we reserve the right to set it. - @echo "set CFLAGS \"\"" >> ./tmp0 - @echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0 -# If newlib has been configured, we need to pass -B to gcc so it can find -# newlib's crt0.o if it exists. This will cause a "path prefix not used" -# message if it doesn't, but the testsuite is supposed to ignore the message - -# it's too difficult to tell when to and when not to pass -B (not all targets -# have crt0's). We could only add the -B if ../newlib/crt0.o exists, but that -# seems like too selective a test. -# ??? Another way to solve this might be to rely on linker scripts. Then -# theoretically the -B won't be needed. -# We also need to pass -L ../ld so that the linker can find ldscripts. - @if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \ - echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \ - echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \ - echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \ - echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \ - echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \ - else true; \ - fi - @if [ -d $(objdir)/../ld ] ; then \ - echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \ - else true; \ - fi - echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 - @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0 - @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 - @cat ./tmp0 > site.exp - @cat site.bak | sed \ - -e '1,/^## All variables above are.*##/ d' >> site.exp - -@rm -f ./tmp? - -CHECK_TARGETS = check-gcc check-g++ check-g77 check-objc - -check: $(CHECK_TARGETS) - -testsuite/site.exp: site.exp - if [ -d testsuite ]; then \ - true; \ - else \ - mkdir testsuite; \ - fi - rm -rf testsuite/site.exp - cp site.exp testsuite/site.exp - -check-g++: testsuite/site.exp - -rootme=`pwd`; export rootme; \ - srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ - cd testsuite; \ - EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $${rootme}/../expect/expect ] ; then \ - TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \ - export TCL_LIBRARY ; fi ; \ - $(RUNTEST) --tool g++ $(RUNTESTFLAGS) - -check-gcc: testsuite/site.exp - -rootme=`pwd`; export rootme; \ - srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ - cd testsuite; \ - EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $${rootme}/../expect/expect ] ; then \ - TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \ - export TCL_LIBRARY ; fi ; \ - $(RUNTEST) --tool gcc $(RUNTESTFLAGS) - -check-g77: testsuite/site.exp - -rootme=`pwd`; export rootme; \ - srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ - cd testsuite; \ - EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $${rootme}/../expect/expect ] ; then \ - TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \ - export TCL_LIBRARY ; fi ; \ - $(RUNTEST) --tool g77 $(RUNTESTFLAGS) - -check-objc: testsuite/site.exp - -rootme=`pwd`; export rootme; \ - srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ - cd testsuite; \ - EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $${rootme}/../expect/expect ] ; then \ - TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; pwd` ; \ - export TCL_LIBRARY ; fi ; \ - $(RUNTEST) --tool objc $(RUNTESTFLAGS) - -# These exist for maintenance purposes. - -# Update the tags table. -TAGS: force - cd $(srcdir); \ - mkdir tmp-tags; \ - mv -f c-parse.[ch] cexp.c =*.[chy] tmp-tags; \ - etags *.y *.h *.c; \ - mv tmp-tags/* .; \ - rmdir tmp-tags - -# Create the distribution tar.gz file. -dist: tmp-gcc.xtar - gzip --best < tmp-gcc.xtar > tmp-gcc.xtar.gz - mv tmp-gcc.xtar.gz gcc-$(version).tar.gz - -tmp-gcc.xtar: distdir -# Make the distribution. - tar -chf tmp-gcc.xtar gcc-$(version) - -distdir-cvs: force - if [ -d $(srcdir)/CVS ]; then cd $(srcdir) && cvs -r update; fi - -# This target exists to do the initial work before the language specific -# stuff gets done. -distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \ - $(srcdir)/c-parse.c $(srcdir)/cexp.c $(srcdir)/config.in \ - $(srcdir)/version.c TAGS - @case '$(USE_NLS)' in \ - yes) ;; \ - *) echo "configure with --enable-nls before making a distribution"; \ - exit 1;; \ - esac - @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \ - then true; \ - else echo "You must update the version number in \`gcc.texi'"; sleep 10;\ - fi -# Update the version number in README - $(AWK) '$$1 " " $$2 " " $$3 == "This directory contains" \ - { $$6 = version; print $$0 } \ - $$1 " " $$2 " " $$3 != "This directory contains"' \ - version=$(version) $(srcdir)/README > tmp.README - mv tmp.README README - -rm -rf gcc-$(version) tmp -# Put all the files in a temporary subdirectory -# which has the name that we want to have in the tar file. - mkdir tmp - mkdir tmp/config - mkdir tmp/ginclude - mkdir tmp/objc - mkdir tmp/intl - mkdir tmp/po - for file in `(cd $(srcdir) && echo *[0-9a-zA-Z+])`; do \ - test -f $(srcdir)/$$file && $(LN_S) $(srcdir)/$$file tmp; \ - done - if test "$(srcdir)" != "." ; then \ - for file in c-parse.c cexp.c ; do \ - test -f ./$$file && $(LN_S) ../$$file tmp; \ - done; \ - fi - for file in `(cd $(srcdir)/config && echo *[0-9a-zA-Z+])`; do \ - if test -d $(srcdir)/config/$$file \ - && test "$$file" != RCS && test "$$file" != CVS; then \ - mkdir tmp/config/$$file; \ - for subfile in `(cd $(srcdir)/config/$$file && echo *[0-9a-zA-Z+])`; do \ - $(LN_S) $(srcdir)/config/$$file/$$subfile tmp/config/$$file; \ - done; \ - else \ - $(LN_S) $(srcdir)/config/$$file tmp/config; \ - fi; \ - done - for file in `(cd $(srcdir)/ginclude && echo *[0-9a-zA-Z+])`; do \ - $(LN_S) $(srcdir)/ginclude/$$file tmp/ginclude; \ - done - for file in `(cd $(srcdir)/objc && echo *[0-9a-zA-Z+])`; do \ - $(LN_S) $(srcdir)/objc/$$file tmp/objc; \ - done - $(LN_S) .gdbinit tmp - -# Finish making `distdir', after the languages have done their thing. -distdir-finish: - mv tmp gcc-$(version) -# Get rid of everything we don't want in the distribution. We'd want -# this to use Makefile.in, but it doesn't have the `lang.foo' targets -# expanded. - cd gcc-$(version); make extraclean distdir-check VERSION_DEP= - -distdir-check: - ($(AWK) '/^[^#]/{print} /^#[A-Za-z]/{print substr($$1, 2)}' | sort) \ - < po/POTFILES.in > tmp.POTFILES - ls [A-Za-z]*.[ch] [a-z]*/[A-Za-z]*.[ch] \ - [a-z]*/[a-z]*/[A-Za-z]*.[ch] | sort > tmp.src - diff tmp.POTFILES tmp.src || { \ - echo "po/POTFILES.in and sources do not match -- please fix"; \ - exit 1; \ - } - rm -f tmp.* - -distdir: distdir-cvs distdir-start intl.distdir intl.distdir-fixup \ - lang.distdir distdir-finish - -# make diff oldversion=M.N -# creates a diff file between an older distribution and this one. -# The -P option assumes this is GNU diff. -diff: - diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \ - -x cexp.c -x -x TAGS -x INSTALL \ - -x configure -x config.in \ - -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \ - -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \ - $(LANG_DIFF_EXCLUDES) \ - gcc-$(oldversion) gcc-$(version) > gcc-$(oldversion)-$(version).diff - -bootstrap bootstrap-lean: force -# Only build the C compiler for stage1, because that is the only one that -# we can guarantee will build with the native compiler, and also it is the -# only thing useful for building stage2. - $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)" - $(MAKE) stage1 -# This used to define ALLOCA as empty, but that would lead to bad results -# for a subsequent `make install' since that would not have ALLOCA empty. -# To prevent `make install' from compiling alloca.o and then relinking cc1 -# because alloca.o is newer, we permit these recursive makes to compile -# alloca.o. Then cc1 is newer, so it won't have to be relinked. - $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)" - $(MAKE) stage2 - -if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi - $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)" - -bootstrap2 bootstrap2-lean: force - $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)" - $(MAKE) stage2 - -if test $@ = bootstrap2-lean; then rm -rf stage1; else true; fi - $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)" - -bootstrap3 bootstrap3-lean: force - $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)" - -bootstrap4 bootstrap4-lean: force - $(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)" - -# Compare the object files in the current directory with those in the -# stage2 directory. - -# ./ avoids bug in some versions of tail. -compare compare3 compare4 compare-lean compare3-lean compare4-lean: force - -rm -f .bad_compare - case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - for file in *$(objext); do \ - tail +16c ./$$file > tmp-foo1; \ - tail +16c stage$$stage/$$file > tmp-foo2 \ - && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ - done - case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - for dir in tmp-foo intl $(SUBDIRS); do \ - if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \ - for file in $$dir/*$(objext); do \ - tail +16c ./$$file > tmp-foo1; \ - tail +16c stage$$stage/$$file > tmp-foo2 \ - && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ - done; \ - else true; fi; \ - done - -rm -f tmp-foo* - case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - if [ -f .bad_compare ]; then \ - echo "Bootstrap comparison failure!"; \ - cat .bad_compare; \ - exit 1; \ - else \ - case "$@" in \ - *-lean ) rm -rf stage$$stage ;; \ - *) ;; \ - esac; true; \ - fi - -# Compare the object files in the current directory with those in the -# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid -# running tail and the overhead of twice copying each object file. - -gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force - -rm -f .bad_compare - case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - for file in *$(objext); do \ - (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ - done - case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - for dir in tmp-foo intl $(SUBDIRS); do \ - if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \ - for file in $$dir/*$(objext); do \ - (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \ - done; \ - else true; fi; \ - done - case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \ - if [ -f .bad_compare ]; then \ - echo "Bootstrap comparison failure!"; \ - cat .bad_compare; \ - exit 1; \ - else \ - case "$@" in \ - *-lean ) rm -rf stage$$stage ;; \ - esac; true; \ - fi - -# Copy the object files from a particular stage into a subdirectory. -stage1-start: - -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi - -for dir in intl $(SUBDIRS) ; \ - do \ - if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \ - done - -mv $(STAGESTUFF) stage1 - -mv intl/*$(objext) stage1/intl -# Copy as/ld if they exist to stage dir, so that running xgcc from the stage -# dir will work properly. - -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage1 ; else true ; fi - -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage1 ; else true ; fi - -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage1 ; else true ; fi - -rm -f stage1/libgcc.a - -cp libgcc.a stage1 - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) stage1/libgcc.a; \ - else true; fi - -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ - cp stage1/$${f} . ; \ - else true; \ - fi; done -stage1: force stage1-start lang.stage1 - -stage2-start: - -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi - -for dir in intl $(SUBDIRS) ; \ - do \ - if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \ - done - -mv $(STAGESTUFF) stage2 - -mv intl/*$(objext) stage2/intl -# Copy as/ld if they exist to stage dir, so that running xgcc from the stage -# dir will work properly. - -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage2 ; else true ; fi - -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage2 ; else true ; fi - -if [ -f collect-ld ] ; then $(LN_S) ../collect-ld$(exeext) stage2 ; else true ; fi - -rm -f stage2/libgcc.a - -cp libgcc.a stage2 - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) stage2/libgcc.a; \ - else true; fi - -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ - cp stage2/$${f} . ; \ - else true; \ - fi; done -stage2: force stage2-start lang.stage2 - -stage3-start: - -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi - -for dir in intl $(SUBDIRS) ; \ - do \ - if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \ - done - -mv $(STAGESTUFF) stage3 - -mv intl/*$(objext) stage3/intl -# Copy as/ld if they exist to stage dir, so that running xgcc from the stage -# dir will work properly. - -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage3 ; else true ; fi - -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage3 ; else true ; fi - -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage3 ; else true ; fi - -rm -f stage3/libgcc.a - -cp libgcc.a stage3 - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) stage3/libgcc.a; \ - else true; fi - -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ - cp stage3/$${f} . ; \ - else true; \ - fi; done -stage3: force stage3-start lang.stage3 - -stage4-start: - -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi - -for dir in intl $(SUBDIRS) ; \ - do \ - if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \ - done - -mv $(STAGESTUFF) stage4 - -mv intl/*$(objext) stage4/intl -# Copy as/ld if they exist to stage dir, so that running xgcc from the stage -# dir will work properly. - -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage4 ; else true ; fi - -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage4 ; else true ; fi - -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage4 ; else true ; fi - -rm -f stage4/libgcc.a - -cp libgcc.a stage4 - -if $(RANLIB_TEST_FOR_TARGET) ; then \ - $(RANLIB_FOR_TARGET) stage4/libgcc.a; \ - else true; fi - -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \ - cp stage4/$${f} . ; \ - else true; \ - fi; done -stage4: force stage4-start lang.stage4 - -# Copy just the executable files from a particular stage into a subdirectory, -# and delete the object files. Use this if you're just verifying a version -# that is pretty sure to work, and you are short of disk space. -risky-stage1: stage1 - -make clean - -risky-stage2: stage2 - -make clean - -risky-stage3: stage3 - -make clean - -risky-stage4: stage4 - -make clean - -#In GNU Make, ignore whether `stage*' exists. -.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap -.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4 - -force: - -# --- -# The enquire rules are still useful for building new float-anything.h. -# Special flags for compiling enquire. -# We disable optimization to make floating point more reliable. -ENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0 -ENQUIRE_LDFLAGS = $(LDFLAGS) - -# Enquire target (This is a variable so that a target can choose not to -# build it.) -ENQUIRE = enquire - -# Test to see whether exists in the system header files, -# and is not derived from GCC. -FLOAT_H_TEST = \ - [ -f $(SYSTEM_HEADER_DIR)/float.h ] && \ - if grep 'ifndef _FLOAT_H___' $(SYSTEM_HEADER_DIR)/float.h >/dev/null; \ - then false; \ - else :; fi -# We pretend to not having a usable , hence disable the FLOAT_H_TEST -# to ensure, we're emitting a full blown ourselves. -FLOAT_H_TEST = false - -# Used to compile enquire with standard cc, but have forgotten why. -# Let's try with GCC. -enquire: enquire.o $(GCC_PARTS) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@ -enquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs - if $(FLOAT_H_TEST); then \ - rm -f include/float.h; \ - SYS_FLOAT_H_WRAP=1; \ - else :; \ - SYS_FLOAT_H_WRAP=0; \ - fi; \ - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) \ - -DSYS_FLOAT_H_WRAP=$$SYS_FLOAT_H_WRAP \ - -I. -c $(srcdir)/enquire.c - -# Create float.h source for the native machine. -# Make it empty if we can use the system float.h without changes. -float.h-nat: enquire - -./enquire -f > tmp-float.h - grep '#define [^_]' tmp-float.h >/dev/null || true > tmp-float.h - mv tmp-float.h float.h-nat - -# Create a dummy float.h source for a cross-compiler. -# ??? This isn't used anymore. Should we create config/float-unkn.h -# and make that the default float_format in configure? -float.h-cross: - echo "#ifndef __GCC_FLOAT_NOT_NEEDED" > t-float.h-cross - echo "#error float.h values not known for cross-compiler" >> t-float.h-cross - echo "#endif" >> t-float.h-cross - mv t-float.h-cross float.h-cross - diff --git a/contrib/gcc/NEWS b/contrib/gcc/NEWS deleted file mode 100644 index 427df254eb6f..000000000000 --- a/contrib/gcc/NEWS +++ /dev/null @@ -1,1071 +0,0 @@ -Noteworthy changes in GCC after EGCS 1.1. ------------------------------------------ - -Target specific NEWS - - RS6000/PowerPC: -mcpu=401 was added as an alias for -mcpu=403. -mcpu=e603e - was added to do -mcpu=603e and -msoft-float. - -Noteworthy changes in GCC for EGCS 1.1. ---------------------------------------- - -The compiler now implements global common subexpression elimination (gcse) as -well as global constant/copy propagation. (link to gcse page). - -More major improvements have been made to the alias analysis code. A new -option to allow front-ends to provide alias information to the optimizers -has also been added (-fstrict-aliasing). -fstrict-aliasing is off by default -now, but will be enabled by default in the future. (link to alias page) - -Major changes continue in the exception handling support. This release -includes some changes to reduce static overhead for exception handling. It -also includes some major changes to the setjmp/longjmp based EH mechanism to -make it less pessimistic. And finally, major infrastructure improvements -to the dwarf2 EH mechanism have been made to make our EH support extensible. - -We have fixed the infamous security problems with temporary files. - -The "regmove" optimization pass has been nearly completely rewritten. It now -uses much more information about the target to determine profitability of -transformations. - -The compiler now recomputes register usage information immediately before -register allocation. Previously such information was only not kept up to -date after instruction combination which led to poor register allocation -choices by our priority based register allocator. - -The register reloading phase of the compiler has been improved to better -optimize spill code. This primarily helps targets which generate lots of -spills (like the x86 ports and many register poor embedded ports). - -A few changes in the heuristics used by the register allocator and scheduler -have been made which can significantly improve performance for certain -applications. - -The compiler's branch shortening algorithms have been significantly improved -to work better on targets which align jump targets. - -The compiler now supports the "ADDRESSOF" optimization which can significantly -reduce the overhead for certain inline calls (and inline calls in general). - -The compiler now supports a code size optimization switch (-Os). When enabled -the compiler will prefer optimizations which improve code size over those -which improve code speed. - -The compiler has been improved to completely eliminate library calls which -compute constant values. This is particularly useful on machines which -do not have integer mul/div or floating point support on-chip. - -GCC now supports a "--help" option to print detailed help information. - -cpplib has been greatly improved. It is probably useable for some sites now -(major missing feature is trigraphs). - -Memory footprint for the compiler has been significantly reduced for certain -pathalogical cases. - -Build time improvements for targets which support lots of sched parameters -(alpha and mips primarily). - -Compile time for certain programs using large constant initializers has been -improved (effects glibc significantly). - -Plus an incredible number of infrastructure changes, warning fixes, bugfixes -and local optimizations. - -Various improvements have been made to better support cross compilations. They -are still not easy, but they are improving. - -Target specific NEWS - - Sparc: Now includes V8 plus and V9 support, lots of tuning for Ultrasparcs - and uses the Haifa scheduler by default. - - Alpha: EV6 tuned, optimized expansion of memcpy/bzero. - - x86: Data in the static store is aligned per Intel recommendations. Jump - targets are aligned per Intel recommendations. Improved epilogue - sequences for Pentium chips. Backend improvements which should help - register allocation on all x86 variants. Support for PPro conditional - move instructions has been fixed and enabled. Random changes - throughout the port to make generated code more Pentium friendly. - Improved support for 64bit integer operations. - Unixware 7, a System V Release 5 target is now supported. - SCO OpenServer targets can support GAS. See gcc/INSTALL for details. - - RS6000/PowerPC: Includes AIX4.3 support as well as PowerPC64 support. - Haifa instruction scheduling is enabled by default now. - - MIPS: Multiply/Multiply-Add support has been largely rewritten to generate - more efficient code. Includes mips16 support. - - M68K: Various micro-optimizations and Coldfire fixes. - - M32r: Major improvements to this port. - - Arm: Includes Thumb and super interworking support. - -EGCS includes all gcc2 changes up to and including the June 9, 1998 snapshot. - - -Noteworthy changes in GCC version 2.8.1 ---------------------------------------- - -Numerous bugs have been fixed and some minor performance -improvements (compilation speed) have been made. - -Noteworthy changes in GCC version 2.8.0 ---------------------------------------- - -A major change in this release is the addition of a framework for -exception handling, currently used by C++. Many internal changes and -optimization improvements have been made. These increase the -maintainability and portability of GCC. GCC now uses autoconf to -compute many host parameters. - -The following lists changes that add new features or targets. - -See cp/NEWS for new features of C++ in this release. - -New tools and features: - - The Dwarf 2 debugging information format is supported on ELF systems, and - is the default for -ggdb where available. It can also be used for C++. - The Dwarf version 1 debugging format is also permitted for C++, but - does not work well. - - gcov.c is provided for test coverage analysis and branch profiling - analysis is also supported; see -fprofile-arcs, -ftest-coverage, - and -fbranch-probabilities. - - Support for the Checker memory checking tool. - - New switch, -fstack-check, to check for stack overflow on systems that - don't have such built into their ABI. - - New switches, -Wundef and -Wno-undef to warn if an undefined identifier - is evaluated in an #if directive. - - Options -Wall and -Wimplicit now cause GCC to warn about implicit int - in declarations (e.g. `register i;'), since the C Standard committee - has decided to disallow this in the next revision of the standard; - -Wimplicit-function-declarations and -Wimplicit-int are subsets of - this. - - Option -Wsign-compare causes GCC to warn about comparison of signed and - unsigned values. - - Add -dI option of cccp for cxref. - -New features in configuration, installation and specs file handling: - - New option --enable-c-cpplib to configure script. - - You can use --with-cpu on the configure command to specify the default - CPU that GCC should generate code for. - - The -specs=file switch allows you to override default specs used in - invoking programs like cc1, as, etc. - - Allow including one specs file from another and renaming a specs - variable. - - You can now relocate all GCC files with a single environment variable - or a registry entry under Windows 95 and Windows NT. - -Changes in Objective-C: - - The Objective-C Runtime Library has been made thread-safe. - - The Objective-C Runtime Library contains an interface for creating - mutexes, condition mutexes, and threads; it requires a back-end - implementation for the specific platform and/or thread package. - Currently supported are DEC/OSF1, IRIX, Mach, OS/2, POSIX, PCThreads, - Solaris, and Windows32. The --enable-threads parameter can be used - when configuring GCC to enable and select a thread back-end. - - Objective-C is now configured as separate front-end language to GCC, - making it more convenient to conditionally build it. - - The internal structures of the Objective-C Runtime Library have - changed sufficiently to warrant a new version number; now version 8. - Programs compiled with an older version must be recompiled. - - The Objective-C Runtime Library can be built as a DLL on Windows 95 - and Windows NT systems. - - The Objective-C Runtime Library implements +load. - -The following new targets are supported (see also list under each -individual CPU below): - - Embedded target m32r-elf. - Embedded Hitachi Super-H using ELF. - RTEMS real-time system on various CPU targets. - ARC processor. - NEC V850 processor. - Matsushita MN10200 processor. - Matsushita MN10300 processor. - Sparc and PowerPC running on VxWorks. - Support both glibc versions 1 and 2 on Linux-based GNU systems. - -New features for DEC Alpha systems: - - Allow detailed specification of IEEE fp support: - -mieee, -mieee-with-inexact, and -mieee-conformant - -mfp-trap-mode=xxx, -mfp-round-mode=xxx, -mtrap-precision=xxx - -mcpu=xxx for CPU selection - Support scheduling parameters for EV5. - Add support for BWX, CIX, and MAX instruction set extensions. - Support Linux-based GNU systems. - Support VMS. - -Additional supported processors and systems for MIPS targets: - - MIPS4 instruction set. - R4100, R4300 and R5000 processors. - N32 and N64 ABI. - IRIX 6.2. - SNI SINIX. - -New features for Intel x86 family: - - Add scheduling parameters for Pentium and Pentium Pro. - Support stabs on Solaris-x86. - Intel x86 processors running the SCO OpenServer 5 family. - Intel x86 processors running DG/UX. - Intel x86 using Cygwin32 or Mingw32 on Windows 95 and Windows NT. - -New features for Motorola 68k family: - - Support for 68060 processor. - More consistent switches to specify processor. - Motorola 68k family running AUX. - 68040 running pSOS, ELF object files, DBX debugging. - Coldfire variant of Motorola m68k family. - -New features for the HP PA RISC: - - -mspace and -mno-space - -mlong-load-store and -mno-long-load-store - -mbig-switch -mno-big-switch - - GCC on the PA requires either gas-2.7 or the HP assembler; for best - results using GAS is highly recommended. GAS is required for -g and - exception handling support. - -New features for SPARC-based systems: - - The ultrasparc cpu. - The sparclet cpu, supporting only a.out file format. - Sparc running SunOS 4 with the GNU assembler. - Sparc running the Linux-based GNU system. - Embedded Sparc processors running the ELF object file format. - -mcpu=xxx - -mtune=xxx - -malign-loops=xxx - -malign-jumps=xxx - -malign-functions=xxx - -mimpure-text and -mno-impure-text - - Options -mno-v8 and -mno-sparclite are no longer supported on SPARC - targets. Options -mcypress, -mv8, -msupersparc, -msparclite, -mf930, - and -mf934 are deprecated and will be deleted in GCC 2.9. Use - -mcpu=xxx instead. - -New features for rs6000 and PowerPC systems: - - Solaris 2.51 running on PowerPC's. - The Linux-based GNU system running on PowerPC's. - -mcpu=604e,602,603e,620,801,823,mpc505,821,860,power2 - -mtune=xxx - -mrelocatable-lib, -mno-relocatable-lib - -msim, -mmve, -memb - -mupdate, -mno-update - -mfused-madd, -mno-fused-madd - - -mregnames - -meabi - -mcall-linux, -mcall-solaris, -mcall-sysv-eabi, -mcall-sysv-noeabi - -msdata, -msdata=none, -msdata=default, -msdata=sysv, -msdata=eabi - -memb, -msim, -mmvme - -myellowknife, -mads - wchar_t is now of type long as per the ABI, not unsigned short. - -p/-pg support - -mcpu=403 now implies -mstrict-align. - Implement System V profiling. - - Aix 4.1 GCC targets now default to -mcpu=common so that programs - compiled can be moved between rs6000 and powerpc based systems. A - consequence of this is that -static won't work, and that some programs - may be slightly slower. - - You can select the default value to use for -mcpu=xxx on rs6000 and - powerpc targets by using the --with-cpu=xxx option when configuring the - compiler. In addition, a new options, -mtune=xxx was added that - selects the machine to schedule for but does not select the - architecture level. - - Directory names used for storing the multilib libraries on System V - and embedded PowerPC systems have been shortened to work with commands - like tar that have fixed limits on pathname size. - -New features for the Hitachi H8/300(H): - - -malign-300 - -ms (for the Hitachi H8/S processor) - -mint32 - -New features for the ARM: - - -march=xxx, -mtune=xxx, -mcpu=xxx - Support interworking with Thumb code. - ARM processor with a.out object format, COFF, or AOF assembler. - ARM on "semi-hosted" platform. - ARM running NetBSD. - ARM running the Linux-based GNU system. - -New feature for Solaris systems: - - GCC installation no longer makes a copy of system include files, - thus insulating GCC better from updates to the operating system. - - -Noteworthy changes in GCC version 2.7.2 ---------------------------------------- - -A few bugs have been fixed (most notably the generation of an -invalid assembler opcode on some RS/6000 systems). - -Noteworthy changes in GCC version 2.7.1 ---------------------------------------- - -This release fixes numerous bugs (mostly minor) in GCC 2.7.0, but -also contains a few new features, mostly related to specific targets. - -Major changes have been made in code to support Windows NT. - -The following new targets are supported: - - 2.9 BSD on PDP-11 - Linux on m68k - HP/UX version 10 on HP PA RISC (treated like version 9) - DEC Alpha running Windows NT - -When parsing C, GCC now recognizes C++ style `//' comments unless you -specify `-ansi' or `-traditional'. - -The PowerPC System V targets (powerpc-*-sysv, powerpc-*-eabi) now use the -calling sequence specified in the System V Application Binary Interface -Processor Supplement (PowerPC Processor ABI Supplement) rather than the calling -sequence used in GCC version 2.7.0. That calling sequence was based on the AIX -calling sequence without function descriptors. To compile code for that older -calling sequence, either configure the compiler for powerpc-*-eabiaix or use -the -mcall-aix switch when compiling and linking. - -Noteworthy changes in GCC version 2.7.0 ---------------------------------------- - -GCC now works better on systems that use ".obj" and ".exe" instead of -".o" and no extension. This involved changes to the driver program, -gcc.c, to convert ".o" names to ".obj" and to GCC's Makefile to use -".obj" and ".exe" in filenames that are not targets. In order to -build GCC on such systems, you may need versions of GNU make and/or -compatible shells. At this point, this support is preliminary. - -Object file extensions of ".obj" and executable file extensions of -".exe" are allowed when using appropriate version of GNU Make. - -Numerous enhancements were made to the __attribute__ facility including -more attributes and more places that support it. We now support the -"packed", "nocommon", "noreturn", "volatile", "const", "unused", -"transparent_union", "constructor", "destructor", "mode", "section", -"align", "format", "weak", and "alias" attributes. Each of these -names may also be specified with added underscores, e.g., "__packed__". -__attribute__ may now be applied to parameter definitions, function -definitions, and structure, enum, and union definitions. - -GCC now supports returning more structures in registers, as specified by -many calling sequences (ABIs), such as on the HP PA RISC. - -A new option '-fpack-struct' was added to automatically pack all structure -members together without holes. - -There is a new library (cpplib) and program (cppmain) that at some -point will replace cpp (aka cccp). To use cppmain as cpp now, pass -the option CCCP=cppmain to make. The library is already used by the -fix-header program, which should speed up the fixproto script. - -New options for supported targets: - - GNU on many targets. - NetBSD on MIPS, m68k, VAX, and x86. - LynxOS on x86, m68k, Sparc, and RS/6000. - VxWorks on many targets. - - Windows/NT on x86 architecture. Initial support for Windows/NT on Alpha - (not fully working). - - Many embedded targets, specifically UDI on a29k, aout, coff, elf, - and vsta "operating systems" on m68k, m88k, mips, sparc, and x86. - -Additional support for x86 (i386, i486, and Pentium): - - Work with old and new linkers for Linux-based GNU systems, - supporting both a.out and ELF. - FreeBSD on x86. - Stdcall convention. - -malign-double, -mregparm=, -malign-loops= and -malign-jumps= switches. - On ISC systems, support -Xp like -posix. - -Additions for RS/6000: - - Instruction scheduling information for PowerPC 403. - AIX 4.1 on PowerPC. - -mstring and -mno-string. - -msoft-float and floating-point emulation included. - Preliminary support for PowerPC System V.4 with or without the GNU as. - Preliminary support for EABI. - Preliminary support for 64-bit systems. - Both big and little endian systems. - -New features for MIPS-based systems: - - r4650. - mips4 and R8000. - Irix 6.0. - 64-bit ABI. - Allow dollar signs in labels on SGI/Irix 5.x. - -New support for HP PA RISC: - - Generation of PIC (requires binutils-2.5.2.u6 or later). - HP-UX version 9 on HP PA RISC (dynamically links even with -g). - Processor variants for HP PA RISC: 700, 7100, and 7100LC. - Automatic generation of long calls when needed. - -mfast-indirect-calls for kernels and static binaries. - - The called routine now copies arguments passed by invisible reference, - as required by the calling standard. - -Other new miscellaneous target-specific support: - - -mno-multm on a29k. - -mold-align for i960. - Configuration for "semi-hosted" ARM. - -momit-leaf-frame-pointer for M88k. - SH3 variant of Hitachi Super-H and support both big and little endian. - -Changes to Objective-C: - - Bare-bones implementation of NXConstantString has been added, - which is invoked by the @"string" directive. - - Class * has been changed to Class to conform to the NextSTEP and - OpenStep runtime. - - Enhancements to make dynamic loading easier. - - The module version number has been updated to Version 7, thus existing - code will need to be recompiled to use the current run-time library. - -GCC now supports the ISO Normative Addendum 1 to the C Standard. -As a result: - - The header defines macros for C programs written - in national variants of ISO 646. - - The following digraph tokens are supported: - <: :> <% %> %: %:%: - These behave like the following, respectively: - [ ] { } # ## - - Digraph tokens are supported unless you specify the `-traditional' - option; you do not need to specify `-ansi' or `-trigraphs'. Except - for contrived and unlikely examples involving preprocessor - stringizing, digraph interpretation doesn't change the meaning of - programs; this is unlike trigraph interpretation, which changes the - meanings of relatively common strings. - - The macro __STDC_VERSION__ has the value 199409L. - - As usual, for full conformance to the standard, you also need a - C library that conforms. - -The following lists changes that have been made to g++. If some -features mentioned below sound unfamiliar, you will probably want to -look at the recently-released public review copy of the C++ Working -Paper. For PostScript and PDF (Adobe Acrobat) versions, see the -archive at ftp://research.att.com/dist/stdc++/WP. For HTML and ASCII -versions, see ftp://ftp.cygnus.com/pub/g++. On the web, see -http://www.cygnus.com/~mrs/wp-draft. - -The scope of variables declared in the for-init-statement has been changed -to conform to http://www.cygnus.com/~mrs/wp-draft/stmt.html#stmt.for; as a -result, packages such as groff 1.09 will not compile unless you specify the --fno-for-scope flag. PLEASE DO NOT REPORT THIS AS A BUG; this is a change -mandated by the C++ standardization committee. - -Binary incompatibilities: - - The builtin 'bool' type is now the size of a machine word on RISC targets, - for code efficiency; it remains one byte long on CISC targets. - - Code that does not use #pragma interface/implementation will most - likely shrink dramatically, as g++ now only emits the vtable for a - class in the translation unit where its first non-inline, non-abstract - virtual function is defined. - - Classes that do not define the copy constructor will sometimes be - passed and returned in registers. This may illuminate latent bugs in - your code. - -Support for automatic template instantiation has *NOT* been added, due -to a disagreement over design philosophies. - -Support for exception handling has been improved; more targets are now -supported, and throws will use the RTTI mechanism to match against the -catch parameter type. Optimization is NOT SUPPORTED with --fhandle-exceptions; no need to report this as a bug. - -Support for Run-Time Type Identification has been added with -frtti. -This support is still in alpha; one major restriction is that any file -compiled with -frtti must include . - -Preliminary support for namespaces has been added. This support is far -from complete, and probably not useful. - -Synthesis of compiler-generated constructors, destructors and -assignment operators is now deferred until the functions are used. - -The parsing of expressions such as `a ? b : c = 1' has changed from -`(a ? b : c) = 1' to `a : b ? (c = 1)'. - -The code generated for testing conditions, especially those using || -and &&, is now more efficient. - -The operator keywords and, and_eq, bitand, bitor, compl, not, not_eq, -or, or_eq, xor and xor_eq are now supported. Use -ansi or --foperator-names to enable them. - -The 'explicit' keyword is now supported. 'explicit' is used to mark -constructors and type conversion operators that should not be used -implicitly. - -g++ now accepts the typename keyword, though it currently has no -semantics; it can be a no-op in the current template implementation. -You may want to start using it in your code, however, since the -pending rewrite of the template implementation to compile STL properly -(perhaps for 2.8.0, perhaps not) will require you to use it as -indicated by the current draft. - -Handling of user-defined type conversion has been overhauled so that -type conversion operators are now found and used properly in -expressions and function calls. - --fno-strict-prototype now only applies to function declarations with -"C" linkage. - -g++ now warns about 'if (x=0)' with -Wparentheses or -Wall. - -#pragma weak and #pragma pack are supported on System V R4 targets, as -are various other target-specific #pragmas supported by gcc. - -new and delete of const types is now allowed (with no additional -semantics). - -Explicit instantiation of template methods is now supported. Also, -'inline template class foo;' can be used to emit only the vtable -for a template class. - -With -fcheck-new, g++ will check the return value of all calls to -operator new, and not attempt to modify a returned null pointer. - -The template instantiation code now handles more conversions when -passing to a parameter that does not depend on template arguments. -This means that code like 'string s; cout << s;' now works. - -Invalid jumps in a switch statement past declarations that require -initializations are now caught. - -Functions declared 'extern inline' now have the same linkage semantics -as inline member functions. On supported targets, where previously -these functions (and vtables, and template instantiations) would have -been defined statically, they will now be defined as weak symbols so -that only one out-of-line definition is used. - -collect2 now demangles linker output, and c++filt has become part of -the gcc distribution. - -Noteworthy changes in GCC version 2.6.3: - -A few more bugs have been fixed. - -Noteworthy changes in GCC version 2.6.2: - -A few bugs have been fixed. - -Names of attributes can now be preceded and followed by double underscores. - -Noteworthy changes in GCC version 2.6.1: - -Numerous (mostly minor) bugs have been fixed. - -The following new configurations are supported: - - GNU on x86 (instead of treating it like MACH) - NetBSD on Sparc and Motorola 68k - AIX 4.1 on RS/6000 and PowerPC systems - Sequent DYNIX/ptx 1.x and 2.x. - Both COFF and ELF configurations on AViiON without using /bin/gcc - Windows/NT on x86 architecture; preliminary - AT&T DSP1610 digital signal processor chips - i960 systems on bare boards using COFF - PDP11; target only and not extensively tested - -The -pg option is now supported for Alpha under OSF/1 V3.0 or later. - -Files with an extension of ".c++" are treated as C++ code. - -The -Xlinker and -Wl arguments are now passed to the linker in the -position they were specified on the command line. This makes it -possible, for example, to pass flags to the linker about specific -object files. - -The use of positional arguments to the configure script is no longer -recommended. Use --target= to specify the target; see the GCC manual. - -The 386 now supports two new switches: -mreg-alloc= changes -the default register allocation order used by the compiler, and --mno-wide-multiply disables the use of the mul/imul instructions that -produce 64 bit results in EAX:EDX from 32 bit operands to do long long -multiplies and 32-bit division by constants. - -Noteworthy changes in GCC version 2.6.0: - -Numerous bugs have been fixed, in the C and C++ front-ends, as -well as in the common compiler code. - -This release includes the C, Objective-C, and C++ compilers. However, -we have moved the files for the C++ compiler (G++) files to a -subdirectory, cp. Subsequent releases of GCC will split these files -to a separate TAR file. - -The G++ team has been tracking the development of the ANSI standard for C++. -Here are some new features added from the latest working paper: - - * built-in boolean type 'bool', with constants 'true' and 'false'. - * array new and delete (operator new [] and delete []). - * WP-conforming lifetime of temporaries. - * explicit instantiation of templates (template class A;), - along with an option (-fno-implicit-templates) to disable emission - of implicitly instantiated templates, obsoletes -fexternal-templates. - * static member constants (static const int foo = 4; within the - class declaration). - -Many error messages have been improved to tell the user more about the -problem. Conformance checking with -pedantic-errors has been -improved. G++ now compiles Fresco. - -There is now an experimental implementation of virtual functions using -thunks instead of Cfront-style vtables, enabled with -fvtable-thunks. -This option also enables a heuristic which causes the compiler to only -emit the vtable in the translation unit where its first non-inline -virtual function is defined; using this option and --fno-implicit-templates, users should be able to avoid #pragma -interface/implementation altogether. - -Signatures have been added as a GNU C++ extension. Using the option --fhandle-signatures, users are able to turn on recognition of -signatures. A short introduction on signatures is in the section -`Extension to the C++ Language' in the manual. - -The `g++' program is now a C program, rather than a shell script. - -Lots and lots and lots of bugs fixes, in nested types, access control, -pointers to member functions, the parser, templates, overload -resolution, etc, etc. - -There have been two major enhancements to the Objective-C compiler: - -1) Added portability. It now runs on Alpha, and some problems with - message forwarding have been addressed on other platforms. - -2) Selectors have been redefined to be pointers to structs like: - { void *sel_id, char *sel_types }, where the sel_id is the unique - identifier, the selector itself is no longer unique. - - Programmers should use the new function sel_eq to test selector - equivalence. - -The following major changes have been made to the base compiler and -machine-specific files. - -- The MIL-STD-1750A is a new port, but still preliminary. - -- The h8/300h is now supported; both the h8/300 and h8/300h ports come - with 32 bit IEEE 754 software floating point support. - -- The 64-bit Sparc (v9) and 64-bit MIPS chips are supported. - -- NetBSD is supported on m68k, Intel x86, and pc523 systems and FreeBSD - on x86. - -- COFF is supported on x86, m68k, and Sparc systems running LynxOS. - -- 68K systems from Bull and Concurrent are supported and System V - Release 4 is supported on the Atari. - -- GCC supports GAS on the Motorola 3300 (sysV68) and debugging - (assuming GAS) on the Plexus 68K system. (However, GAS does not yet - work on those systems). - -- System V Release 4 is supported on MIPS (Tandem). - -- For DG/UX, an ELF configuration is now supported, and both the ELF - and BCS configurations support ELF and COFF object file formats. - -- OSF/1 V2.0 is supported on Alpha. - -- Function profiling is also supported on Alpha. - -- GAS and GDB is supported for Irix 5 (MIPS). - -- "common mode" (code that will run on both POWER and PowerPC - architectures) is now supported for the RS/6000 family; the - compiler knows about more PPC chips. - -- Both NeXTStep 2.1 and 3 are supported on 68k-based architectures. - -- On the AMD 29k, the -msoft-float is now supported, as well as - -mno-sum-in-toc for RS/6000, -mapp-regs and -mflat for Sparc, and - -membedded-pic for MIPS. - -- GCC can now convert division by integer constants into the equivalent - multiplication and shift operations when that is faster than the - division. - -- Two new warning options, -Wbad-function-cast and - -Wmissing-declarations have been added. - -- Configurations may now add machine-specific __attribute__ options on - type; many machines support the `section' attribute. - -- The -ffast-math flag permits some optimization that violate strict - IEEE rules, such as converting X * 0.0 to 0.0. - -Noteworthy changes in GCC version 2.5.8: - -This release only fixes a few serious bugs. These include fixes for a -bug that prevented most programs from working on the RS/6000, a bug -that caused invalid assembler code for programs with a `switch' -statement on the NS32K, a G++ problem that caused undefined names in -some configurations, and several less serious problems, some of which -can affect most configuration. - -Noteworthy change in GCC version 2.5.7: - -This release only fixes a few bugs, one of which was causing bootstrap -compare errors on some systems. - -Noteworthy change in GCC version 2.5.6: - -A few backend bugs have been fixed, some of which only occur on one -machine. - -The C++ compiler in 2.5.6 includes: - - * fixes for some common crashes - * correct handling of nested types that are referenced as `foo::bar' - * spurious warnings about friends being declared static and never - defined should no longer appear - * enums that are local to a method in a class, or a class that's - local to a function, are now handled correctly. For example: - class foo { void bar () { enum { x, y } E; x; } }; - void bar () { class foo { enum { x, y } E; E baz; }; } - -Noteworthy change in GCC version 2.5.5: - -A large number of C++ bugs have been fixed. - -The fixproto script adds prototypes conditionally on __cplusplus. - -Noteworthy change in GCC version 2.5.4: - -A bug fix in passing of structure arguments for the HP-PA architecture -makes code compiled with GCC 2.5.4 incompatible with code compiled -with earlier versions (if it passes struct arguments of 33 to 64 bits, -interspersed with other types of arguments). - -Noteworthy change in gcc version 2.5.3: - -The method of "mangling" C++ function names has been changed. So you -must recompile all C++ programs completely when you start using GCC -2.5. Also, GCC 2.5 requires libg++ version 2.5. Earlier libg++ -versions won't work with GCC 2.5. (This is generally true--GCC -version M.N requires libg++ version M.N.) - -Noteworthy GCC changes in version 2.5: - -* There is now support for the IBM 370 architecture as a target. -Currently the only operating system supported is MVS; GCC does not run -on MVS, so you must produce .s files using GCC as a cross compiler, -then transfer them to MVS to assemble them. This port is not reliable -yet. - -* The Power PC is now supported. - -* The i860-based Paragon machine is now supported. - -* The Hitachi 3050 (an HP-PA machine) is now supported. - -* The variable __GNUC_MINOR__ holds the minor version number of GCC, as -an integer. For version 2.5.X, the value is 5. - -* In C, initializers for static and global variables are now processed -an element at a time, so that they don't need a lot of storage. - -* The C syntax for specifying which structure field comes next in an -initializer is now `.FIELDNAME='. The corresponding syntax for -array initializers is now `[INDEX]='. For example, - - char whitespace[256] - = { [' '] = 1, ['\t'] = 1, ['\n'] = 1 }; - -This was changed to accord with the syntax proposed by the Numerical -C Extensions Group (NCEG). - -* Complex numbers are now supported in C. Use the keyword __complex__ -to declare complex data types. See the manual for details. - -* GCC now supports `long double' meaningfully on the Sparc (128-bit -floating point) and on the 386 (96-bit floating point). The Sparc -support is enabled on Solaris 2.x because earlier system versions -(SunOS 4) have bugs in the emulation. - -* All targets now have assertions for cpu, machine and system. So you -can now use assertions to distinguish among all supported targets. - -* Nested functions in C may now be inline. Just declare them inline -in the usual way. - -* Packed structure members are now supported fully; it should be possible -to access them on any supported target, no matter how little alignment -they have. - -* To declare that a function does not return, you must now write -something like this (works only in 2.5): - - void fatal () __attribute__ ((noreturn)); - -or like this (works in older versions too): - - typedef void voidfn (); - - volatile voidfn fatal; - -It used to be possible to do so by writing this: - - volatile void fatal (); - -but it turns out that ANSI C requires that to mean something -else (which is useless). - -Likewise, to declare that a function is side-effect-free -so that calls may be deleted or combined, write -something like this (works only in 2.5): - - int computation () __attribute__ ((const)); - -or like this (works in older versions too): - - typedef int intfn (); - - const intfn computation; - -* The new option -iwithprefixbefore specifies a directory to add to -the search path for include files in the same position where -I would -put it, but uses the specified prefix just like -iwithprefix. - -* Basic block profiling has been enhanced to record the function the -basic block comes from, and if the module was compiled for debugging, -the line number and filename. A default version of the basic block -support module has been added to libgcc2 that appends the basic block -information to a text file 'bb.out'. Machine descriptions can now -override the basic block support module in the target macro file. - -New features in g++: - -* The new flag `-fansi-overloading' for C++. Use a newly implemented -scheme of argument matching for C++. It makes g++ more accurately -obey the rules set down in Chapter 13 of the Annotated C++ Reference -Manual (the ARM). This option will be turned on by default in a -future release. - -* The -finline-debug flag is now gone (it was never really used by the - compiler). - -* Recognizing the syntax for pointers to members, e.g., "foo::*bar", has been - dramatically improved. You should not get any syntax errors or incorrect - runtime results while using pointers to members correctly; if you do, it's - a definite bug. - -* Forward declaration of an enum is now flagged as an error. - -* Class-local typedefs are now working properly. - -* Nested class support has been significantly improved. The compiler - will now (in theory) support up to 240 nested classes before hitting - other system limits (like memory size). - -* There is a new C version of the `g++' driver, to replace the old - shell script. This should significantly improve the performance of - executing g++ on a system where a user's PATH environment variable - references many NFS-mounted filesystems. This driver also works - under MS-DOS and OS/2. - -* The ANSI committee working on the C++ standard has adopted a new - keyword `mutable'. This will allow you to make a specific member be - modifiable in an otherwise const class. - -Noteworthy GCC changes in version 2.4.4: - - A crash building g++ on various hosts (including m68k) has been - fixed. Also the g++ compiler no longer reports incorrect - ambiguities in some situations where they do not exist, and - const template member functions are now being found properly. - -Noteworthy GCC changes in version 2.4: - -* On each target, the default is now to return short structures -compatibly with the "usual" compiler on that target. - -For most targets, this means the default is to return all structures -in memory, like long structures, in whatever way is used on that -target. Use -freg-struct-return to enable returning short structures -(and unions) in registers. - -This change means that newly compiled binaries are incompatible with -binaries compiled with previous versions of GCC. - -On some targets, GCC is itself the usual compiler. On these targets, -the default way to return short structures is still in registers. -Use -fpcc-struct-return to tell GCC to return them in memory. - -* There is now a floating point emulator which can imitate the way all -supported target machines do floating point arithmetic. - -This makes it possible to have cross compilation to and from the VAX, -and between machines of different endianness. However, this works -only when the target machine description is updated to use the new -facilities, and not all have been updated. - -This also makes possible support for longer floating point types. -GCC 2.4 supports extended format on the 68K if you use `long double', -for targets that have a 68881. (When we have run time library -routines for extended floating point, then `long double' will use -extended format on all 68K targets.) - -We expect to support extended floating point on the i386 and Sparc in -future versions. - -* Building GCC now automatically fixes the system's header files. -This should require no attention. - -* GCC now installs an unsigned data type as size_t when it fixes the -header files (on all but a handful of old target machines). -Therefore, the bug that size_t failed to be unsigned is fixed. - -* Building and installation are now completely separate. -All new files are constructed during the build process; -installation just copies them. - -* New targets supported: Clipper, Hitachi SH, Hitachi 8300, and Sparc -Lite. - -* A totally new and much better Objective C run time system is included. - -* Objective C supports many new features. Alas, I can't describe them -since I don't use that language; however, they are the same ones -supported in recent versions of the NeXT operating system. - -* The builtin functions __builtin_apply_args, __builtin_apply and -__builtin_return let you record the arguments and returned -value of a function without knowing their number or type. - -* The builtin string variables __FUNCTION__ and __PRETTY_FUNCTION__ -give the name of the function in the source, and a pretty-printed -version of the name. The two are the same in C, but differ in C++. - -* Casts to union types do not yield lvalues. - -* ## before an empty rest argument discards the preceding sequence -of non-whitespace characters from the macro definition. -(This feature is subject to change.) - - -New features specific to C++: - -* The manual contains a new section ``Common Misunderstandings with -GNU C++'' that C++ users should read. - -* #pragma interface and #pragma implementation let you use the same -C++ source file for both interface and implementation. -However, this mechanism is still in transition. - -* Named returned values let you avoid an extra constructor call -when a function result has a class type. - -* The C++ operators ? yield min and max, respectively. - -* C++ gotos can exit a block safely even if the block has -aggregates that require destructors. - -* gcc defines the macro __GNUG__ when compiling C++ programs. - -* GNU C++ now correctly distinguishes between the prefix and postfix -forms of overloaded operator ++ and --. To avoid breaking old -code, if a class defines only the prefix form, the compiler -accepts either ++obj or obj++, unless -pedantic is used. - -* If you are using version 2.3 of libg++, you need to rebuild it with -`make CC=gcc' to avoid mismatches in the definition of `size_t'. - -Newly documented compiler options: - --fnostartfiles - Omit the standard system startup files when linking. - --fvolatile-global - Consider memory references to extern and global data items to - be volatile. - --idirafter DIR - Add DIR to the second include path. - --iprefix PREFIX - Specify PREFIX for later -iwithprefix options. - --iwithprefix DIR - Add PREFIX/DIR to the second include path. - --mv8 - Emit Sparc v8 code (with integer multiply and divide). --msparclite - Emit Sparclite code (roughly v7.5). - --print-libgcc-file-name - Search for the libgcc.a file, print its absolute file name, and exit. - --Woverloaded-virtual - Warn when a derived class function declaration may be an error - in defining a C++ virtual function. - --Wtemplate-debugging - When using templates in a C++ program, warn if debugging is - not yet fully available. - -+eN - Control how C++ virtual function definitions are used - (like cfront 1.x). - diff --git a/contrib/gcc/ORDERS b/contrib/gcc/ORDERS deleted file mode 100644 index 665c26df4caf..000000000000 --- a/contrib/gcc/ORDERS +++ /dev/null @@ -1,3757 +0,0 @@ -The actual order form follows the descriptions of media contents. - -Most of this file is excerpted from the draft of the June 1995 GNU's Bulletin. -The Order Form itself is accurate, but the information in the other articles -is not completely updated. You can ask gnu@prep.ai.mit.edu for the complete -June, 1995 Order From to get up-to-date information. - -Please send suggestions for improvements to gnu@prep.ai.mit.edu or the postal -address at the end of the order form. Thank You. - ---------------------------------------------------------------------- - - -FSF Order Form with Descriptions preliminary, June 1995 - - - -Free Software Foundation, Inc. Telephone: +1-617-542-5942 -59 Temple Place - Suite 330 Fax: (including Japan) +1-617-542-2652 -Boston, MA 02111-1307 Free Dial Fax (in Japan): -USA 0031-13-2473 (KDD) -Electronic mail: `gnu@prep.ai.mit.edu' 0066-3382-0158 (IDC) - - -There are some sections (e.g. ``Forthcoming GNUs'' and ``How to Get GNU -Software'') which are not in this Order Form file. If you wish to see them, -ask gnu@prep.ai.mit.edu for the complete June, 1995 GNU's Bulletin. - - -Table of Contents ------------------ - - Donations Translate Into Free Software - Cygnus Matches Donations! - Free Software Redistributors Donate - Help from Free Software Companies - (not included) Major Changes in GNU Software and Documentation (not - included as it was not done when this file was assembled). - GNU Documentation - GNU Software (not completely up to date) - Program/Package Cross Reference (not completely up to date) - Tapes - Languages Tape (version numbers not completely up to date) - Lisps and Emacs Tape (version numbers not completely up to date) - Utilities Tape (version numbers not completely up to date) - Scheme Tape - X11 Tapes - Berkeley 4.4BSD-Lite Tape - VMS Emacs and VMS Compiler Tapes - CD-ROMs - Pricing of the GNU CD-ROMs - MS-DOS CD-ROM - Debian GNU/Linux CD-ROM - Compiler Tools Binaries CD-ROM - Source Code CD-ROMs - June 1995 Source Code CD-ROM (version numbers not completely up - to date) - May 1994 Source Code CD-ROM - November 1993 Source Code CD-ROM - MS-DOS Diskettes - DJGPP Diskettes (version numbers not completely up to date) - Emacs Diskettes (version numbers not completely up to date) - Selected Utilities Diskettes (not completely up to date) - Windows Diskette - Tape & CD-ROM Subscription Service - The Deluxe Distribution - FSF T-shirt - Free Software Foundation Order Form - - - -Donations Translate Into Free Software -************************************** - -If you appreciate Emacs, GNU CC, Ghostscript, and other free software, you -may wish to help us make sure there is more in the future--remember, -*donations translate into more free software!* - -Your donation to us is tax-deductible in the United States. We gladly accept -*any* currency, although the U.S. dollar is the most convenient. -m{No Value For "ergegrafkludge"} If your employer has a matching gifts -program for charitable donations, please arrange to: add the FSF to the list -of organizations for your employer's matching gifts program; and have your -donation matched (note *Note Cygnus Matches Donations!::), if you do not -know, please ask your personnel department. Circle amount you are donating, -cut out this form, and send it with your donation to: - Free Software Foundation - 59 Temple Place -- Suite 330 - Boston, MA 02111-1307 - USA - - $500 $250 $100 $50 other $________ - - Other currency:________ - - -You can charge a donation to any of Carte Blanche, Diner's Club, JCB, -Mastercard, Visa, or American Express. Charges may also be faxed to -+1-617-492-9057. Individuals in Japan who are unable to place international -calls may use the "free dial" numbers: 0031-13-2473 (KDD) and -0066-3382-0158 (IDC). - - Card type: __________________ Expiration Date: _____________ - - Account Number: _____________________________________________ - - Cardholder's Signature: _____________________________________ - - Name: _______________________________________________________ - - Street Address: _____________________________________________ - - City/State/Province: ________________________________________ - - Zip Code/Postal Code/Country: _______________________________ - - - -Cygnus Matches Donations! -************************* - -To encourage cash donations to the Free Software Foundation, Cygnus Support -will continue to contribute corporate funds to FSF to accompany gifts by its -employees, and by its customers and their employees. - -Donations payable to the Free Software Foundation should be sent by eligible -persons to Cygnus Support, which will add its gifts and forward the total to -the FSF each quarter. The FSF will provide the contributor with a receipt to -recognize the contribution (which is tax-deductible on U.S. tax returns). -For more information, please contact Cygnus: - Cygnus Support - 1937 Landings Drive - Mountain View, CA 94043 - USA - - Telephone: 415-903-1400 - +1-800-Cygnus1 (-294-6871) - Fax: 415-903-0122 - Electronic-Mail: `info@cygnus.com' - FTP: `ftp.cygnus.com' - WWW: `http://www.cygnus.com/' - - - -Free Software Redistributors Donate -*********************************** - -by Richard Stallman - -The Sun Users Group Deutschland and ASCII Corporation (Japan) have added -donations to the FSF to the price of their next CD-ROM of GNU software. -Potential purchasers will know precisely how much of the price is for the FSF -and how much is for the redistributor. - -Austin Code Works, a redistributor of free software, is supporting free -software development by giving the FSF 20% of the selling price for the GNU -software packages they produce and sell. The producers of the SNOW 2.1 CD -added the words "Includes $5 donation to the FSF" to the front of their CD. -Walnut Creek CDROM and Info Magic, two more free software redistributors, are -also giving us a percentage of their selling price. CQ Publishing made a -large donation from the sales of their book about GAWK in Japanese. - -In the long run, the success of free software depends on how much new free -software people develop. Free software distribution offers an opportunity to -raise funds for such development in an ethical way. These redistributors -have made use of the opportunity. Many others let it go to waste. - -You can help promote free software development by convincing for-a-fee -redistributors to contribute--either by doing development themselves, or by -donating to development organizations (the FSF and others). - -The way to convince distributors to contribute is to demand and expect this -of them. This means choosing among distributors partly by how much they give -to free software development. Then you can show distributors they must -compete to be the one who gives the most. - -To make this work, you must insist on numbers that you can compare, such as, -"We will give ten dollars to the Foobar project for each disk sold." A vague -commitment, such as "A portion of the profits is donated," doesn't give you a -basis for comparison. Even a precise fraction "of the profits from this -disk" is not very meaningful, since creative accounting and unrelated -business decisions can greatly alter what fraction of the sales price counts -as profit. - -Also, press developers for firm information about what kind of development -they do or support. Some kinds make much more long-term difference than -others. For example, maintaining a separate version of a GNU program -contributes very little; maintaining a program on behalf of the GNU Project -contributes much. Easy new ports contribute little, since someone else would -surely do them; difficult ports such as adding a new CPU to the GNU compiler -contribute more; major new features and programs contribute the most. - -By establishing the idea that supporting further development is "the proper -thing to do" when distributing free software for a fee, we can assure a -steady flow of resources for making more free software. - - - -Help from Free Software Companies -********************************* - -When choosing a free software business, ask those you are considering how -much they do to assist free software development, e.g., by contributing money -to free software development or by writing free software improvements -themselves for general use. By basing your decision partially on this -factor, you can help encourage those who profit from free software to -contribute to its growth. - -These free software support companies regularly donate a part of their income -to the Free Software Foundation to support the development of new GNU -programs. Listing them here is our way of thanking them. Wingnut has made a -pledge to donate 10% of their income to the FSF, and has also purchased -several Deluxe Distribution packages in Japan. (Wingnut is SRA's special GNU -support group). Also see *Note Cygnus Matches Donations!::. - - Wingnut Project - Software Research Associates, Inc. - 1-1-1 Hirakawa-cho, Chiyoda-ku - Tokyo 102, Japan - - Phone: (+81-3)3234-2611 - Fax: (+81-3)3942-5174 - E-mail: `info-wingnut@sra.co.jp' - - - -GNU Documentation -***************** - -GNU is dedicated to having quality, easy-to-use online and printed -documentation. GNU manuals are intended to explain underlying concepts, -describe how to use all the features of each program, and give examples of -command use. GNU manuals are distributed as Texinfo source files, which -yield both typeset hardcopy via the TeX document formatting system, and online -hypertext display via the menu-driven Info system. Source for these manuals -comes with our software; here we list the manuals that we publish as printed -books as well; see the *note Free Software Foundation Order Form::.. - -Most GNU manuals are bound as soft cover books with "lay-flat" bindings. -This allows you to open them so they lie flat on a table without creasing the -binding. These books have an inner cloth spine and an outer cardboard cover -that will not break or crease as an ordinary paperback will. Currently, the -`GDB', `Emacs', `Emacs Lisp Reference', `GAWK', `Make', `Bison', and `Texinfo' -manuals have this binding. The other GNU manuals also lie flat when opened, -using a GBC or Wire-O binding. All of our manuals are 7in by 9.25in except -the 8.5in by 11in `Calc' manual. - -The edition number of the manual and version number of the program listed -after each manual's name were current at the time this Bulletin was published. - -`Debugging with GDB' (Edition 4.12 for Version 4.14) tells how to use the GNU -Debugger, run your program under debugger control, examine and alter data, -modify a program's flow of control, and use GDB through GNU Emacs. - -The `Emacs Manual' (11th Edition for Version 19.29) describes editing with -GNU Emacs. It explains advanced features, including outline mode and regular -expression search; how to use special modes for programming in languages like -C++ and TeX; how to use the `tags' utility; how to compile and correct code; -how to make your own keybindings; and other elementary customizations. - -`Programming in Emacs Lisp, An Introduction' (Edition 1.03 for Version 19.29) -is an elementary introduction to programming in Emacs Lisp. It is written -for people who are not necessarily interested in programming, but who do want -to customize or extend their computing environment. It tells how to write -programs that find files; switchbuffers; use searches, conditionals, loops, -and recursion; how to write Emacs initialization files; and how to run the -Emacs Lisp debuggers. If you read the text in GNU Emacs under Info mode, you -can run the sample programs directly. - -The `GNU Emacs Lisp Reference Manual' (Edition 2.4 for Version 19.29) covers -this programming language in depth, including data types, control structures, -functions, macros, syntax tables, searching/matching, modes, windows, -keymaps, byte compilation, and the operating system interface. - -The `GAWK Manual' (Edition 0.16 for Version 2.16) tells how to use the GNU -implementation of `awk'. It is written for those who have never used `awk' -and describes the features of this powerful string and record manipulation -language. - -The `Make Manual' (Edition 0.46 for Version 3.72) describes GNU `make', a -program used to rebuild parts of other programs. The manual tells how to -write "makefiles", which specify how a program is to be compiled and how its -files depend on each other. Included are an introductory chapter for novice -users and a section about automatically generated dependencies. - -The `Flex Manual' (Edition 1.03 for Version 2.3.7) teaches you to write a -lexical scanner definition for the `flex' program to create a C++ or C-coded -scanner that recognizes the patterns defined. You need no prior knowledge of -scanners. - -The `Bison Manual' (December 1993 Edition for Version 1.23) teaches you how -to write context-free grammars for the Bison program that convert into -C-coded parsers. You need no prior knowledge of parser generators. - -`Using and Porting GNU CC' (September 1994 Edition for Version 2.6) tells how -to run, install, and port the GNU C Compiler to new systems. It lists new -features and incompatibilities of GCC, but people not familiar with C will -still need a good reference on the C programming language. It also covers -G++. - -The `Texinfo Manual' (Edition 2.20 for Version 3) explains the markup -language used to generate both the online Info documentation and typeset -hardcopies. It tells you how to make tables, lists, chapters, nodes, -indexes, cross references, how to use Texinfo mode in GNU Emacs, and how to -catch mistakes. This second edition describes over 50 new commands. - -The `Termcap Manual' (2nd Edition for Version 1.2), often described as "twice -as much as you ever wanted to know about termcap," details the format of the -termcap database, the definitions of terminal capabilities, and the process -of interrogating a terminal description. This manual is primarily for -programmers. - -The `C Library Reference Manual' (Edition 0.06 for Version 1.09) describes -most of the facilities of the GNU C library, including both what Unix calls -"library functions" and "system calls." We are doing limited copier runs of -this manual until it becomes more stable. Please send corrections and -improvements to `bug-glibc-manual@prep.ai.mit.edu'. - -The `Emacs Calc Manual' (Edition 2.02 for Version 2.02) is both a tutorial -and a reference manual. It tells how to do ordinary arithmetic, how to use -Calc for algebra, calculus, and other forms of mathematics, and how to extend -Calc. - - - -GNU Software - (NOT COMPLETELY UP TO DATE) -************ - -All our software is available via FTP; see *Note How to Get GNU Software::. -In addition, we offer software on various media and printed documentation: - - * *Note CD-ROMs::. - - * *Note Tapes::. - - * *Note MS-DOS Diskettes::. - - * *Note Documentation::, which includes manuals and reference cards. - -We welcome all bug reports sent to the appropriate electronic mailing list -(*note Free Software Support::.). - -In the articles describing the contents of each medium, the version number -listed after each program name was current when we published this Bulletin. -When you order a distribution tape, diskette or newer CD-ROM, some of the -programs may be newer, and therefore the version number higher. - -Key to cross reference: - - - BinCD - Binaries CD-ROM - - DjgppD - Djgpp Diskettes - - DosCD - MS-DOS CD-ROM - - EmcsD - Emacs Diskettes - - LspEmcT - Lisps/Emacs Tape - - LangT - Languages Tape - - LiteT - 4.4BSD-Lite Tape - - SchmT - Scheme Tape - - SrcCD - Source CD-ROM - - UtilD - Selected Utilities Diskettes - - UtilT - Utilities Tape - - VMSCompT - VMS Compiler Tape - - VMSEmcsT - VMS Emacs Tape - - WdwsD - Windows Diskette - - X11OptT - X11 Optional Tape - - X11ReqT - X11 Required Tape - - - -Configuring GNU Software: - -We are using a uniform scheme for configuring GNU software packages in order -to compile them. It uses the `Autoconf' program (see item below). The goal -is to have all GNU software support the same alternatives for naming machine -and system types. When the GNU system is complete it will be possible to -configure and build the entire system at once, eliminating the need to -separately configure each individual package. The configuration scheme lets -you specify both the host and target system to build cross-compilation tools. - - - -GNU software currently available: - -(For new features and coming programs, see *Note Forthcoming GNUs::.) - - * `acm' (SrcCD, UtilT) - - `acm' is a LAN-oriented, multiplayer aerial combat simulation that runs - under the X Window System. Players engage in air to air combat against - one another using heat seeking missiles and cannons. We are working on - more accurate simulation of real airplane flight characteristics. - - * Autoconf (SrcCD, UtilT) - - Autoconf produces shell scripts which automatically configure source code - packages. These scripts adapt the packages to many kinds of Unix-like - systems without manual user intervention. Autoconf creates a script for - a package from a template file which lists the operating system features - which the package can use, in the form of `m4' macro calls. Autoconf - requires GNU `m4' to operate, but the resulting configure scripts it - generates do not. - - Most GNU programs now use Autoconf-generated configure scripts. - - * BASH (SrcCD, UtilT) - - The GNU shell, BASH (Bourne Again SHell), is compatible with the Unix - `sh' and offers many extensions found in `csh' and `ksh'. BASH has job - control, `csh'-style command history, and command-line editing (with - Emacs and `vi' modes built-in, and the ability to rebind keys) via the - readline library. BASH conforms to the POSIX 1003.2 shell specification. - - * `bc' (DjgppD, DosCD, SrcCD, UtilT) - - `bc' is an interactive algebraic language with arbitrary precision - numbers. GNU `bc' follows the POSIX.2-1992 standard, with several - extensions including multi-character variable names, an `else' - statement, and full Boolean expressions. The RPN calculator `dc' is now - distributed as part of the same package, but GNU `bc' is not implemented - as a `dc' preprocessor. - - * BFD (BinCD, DjggpD, DosCD, LangT, SrcCD) - - The Binary File Descriptor library allows a program which operates on - object files (e.g., `ld' or GDB) to support many different formats in a - clean way. BFD provides a portable interface, so that only BFD needs to - know the details of a particular format. One result is that all - programs using BFD will support formats such as a.out, COFF, and ELF. - BFD comes with source for Texinfo documentation (not yet published on - paper). Presently BFD is not distributed separately; it is included - with packages that use it. - - * Binutils (BinCD, DjgppD, DosCD, LangT, SrcCD) - - Binutils includes the programs: `ar', `c++filt', `demangle', `gas', - `gprof', `ld', `nlmconv', `nm', `objcopy', `objdump', `ranlib', `size', - `strings', and `strip'. - - Binutils Version 2 uses the BFD library. The GNU linker `ld' emits - source-line numbered error messages for multiply-defined symbols and - undefined references. It interprets a superset of the AT&T Linker - Command Language, which gives general control over where segments are - placed in memory. `nlmconv' converts object files into Novell NetWare - Loadable Modules. `objdump' can disassemble code for a29k, ALPHA, - H8/300, H8/500, HP-PA, i386, i960, m68k, m88k, MIPS, SH, SPARC, & Z8000 - processors, and can display other data (e.g., symbols & relocations) - from any file format understood by BFD. - - * Bison (BinCD, DjgppD, DosCD, LangT, SrcCD, VMSCompT) - - Bison is an upwardly compatible replacement for the parser generator - `yacc'. Texinfo source for the `Bison Manual' and reference card are - included. *Note Documentation::. - - We recently decided to change the policy for using the parsers that - Bison generates. It is now permitted to use Bison-generated parsers in - non-free programs. *Note GNUs Flashes::. - - * GNU C Library (BinCD, LangT, SrcCD) - - The GNU C library supports ANSI C-1989, POSIX 1003.1-1990 and most of the - functions in POSIX 1003.2-1992. It is upwardly compatible with 4.4BSD - and includes many System V functions, plus GNU extensions. - - The C Library will perform many functions of the Unix system calls in - the Hurd. Mike Haertel has written a fast `malloc' which wastes less - memory than the old GNU version. The GNU regular-expression functions - (`regex' and `rx') now nearly conform to the POSIX 1003.2 standard. - - GNU `stdio' lets you define new kinds of streams, just by writing a few - C functions. The `fmemopen' function uses this to open a stream on a - string, which can grow as necessary. You can define your own `printf' - formats to use a C function you have written. For example, you can - safely use format strings from user input to implement a `printf'-like - function for another programming language. Extended `getopt' functions - are already used to parse options, including long options, in many GNU - utilities. - - The C Library runs on Sun-3 (SunOS 4.1), Sun-4 (SunOS 4.1 or Solaris 2), - HP 9000/300 (4.3BSD), SONY News 800 (NewsOS 3 or 4), MIPS DECstation - (Ultrix 4), DEC Alpha (OSF/1), i386/i486 (System V, SVR4, BSD, SCO 3.2 & - SCO ODT 2.0), Sequent Symmetry i386 (Dynix 3) & SGI (Irix 4). Texinfo - source for the `GNU C Library Reference Manual' is included (*note - Documentation::.); the manual is now being updated. - - * GNU C++ Library (BinCD, DjgppD, DosCD, LangT, SrcCD) - - The GNU C++ library (libg++) contains an extensive collection of C++ - `forest' classes, an IOStream library for input/output routines, and - support tools for use with G++. Supported classes include: Obstacks, - multiple-precision Integers and Rationals, Complex numbers, arbitrary - length Strings, BitSets and BitStrings. Version 2.6.2 includes the - initial release of the libstdc++ library. This implements library - facilities defined by the forthcoming ANSI/ISO C++ standard, including - the Standard Template Library. - - * Calc (LspEmcT, SrcCD) - - Calc (written by Dave Gillespie in Emacs Lisp) is an extensible, advanced - desk calculator & mathematical tool that runs as part of GNU Emacs. You - can use Calc just as a simple four-function calculator, but it has many - more features including: choice of algebraic or RPN (stack-based) entry; - logarithmic, trigonometric & financial functions; arbitrary precision; - complex numbers; vectors; matrices; dates; times; infinities; sets; - algebraic simplification; differentiation & integration. It outputs to - `gnuplot' & comes with source for a reference card & a Manual. *Note - Documentation::. - - * GNU Chess (SrcCD, UtilT, WdwsD) - - GNU Chess lets the computer play a full game of chess with you. It runs - on most platforms & has dumb terminal, "curses" & X terminal interfaces. - The X terminal interface is based on the `xboard' program. - m{No Value For "ergegrafkludge"} GNU Chess implements many specialized - features including the null move heuristic, a hash table with aging, the - history heuristic (another form of the earlier killer heuristic), - caching of static evaluations, & a database which lets it play the first - several moves of the game quickly. Recent improvements include better - heuristics, faster evaluation, thinking on opponent's time, a perfect - King and Pawn vs King endgame routine, Swedish & German language - support, support for more book formats, a rudimentary Bobby Fischer - clock, & bug fixes. It is primarily supported by Stuart Cracraft, Chua - Kong Sian, & Tim Mann on behalf of the FSF. - - * CLISP (LspEmcT, SrcCD) - - CLISP is a Common Lisp implementation by Bruno Haible and Michael Stoll. - It mostly supports the Lisp described by `Common LISP: The Language (2nd - edition)' and the ANSI Common Lisp standard. CLISP includes an - interpreter, a byte-compiler, a large subset of CLOS, a foreign language - interface and, for some machines, a screen editor. The user interface - language (English, German, French) is chooseable at run time. Major - packages that run in CLISP include CLX & Garnet. CLISP needs only 2 MB - of memory & runs on many microcomputers (including MS-DOS systems, OS/2, - the Atari ST, Amiga 500-4000, Acorn RISC PC) & Unix-like systems - (GNU/Linux, Sun4, SVR4, SGI, HP-UX, DEC Alpha, NeXTstep & others). - - * GNU Common Lisp (LspEmcT, SrcCD) - - GNU Common Lisp (GCL) has a compiler and interpreter for Common Lisp. It - used to be known as Kyoto Common Lisp. It is very portable and extremely - efficient on a wide class of applications. It compares favorably in - performance with commercial Lisps on several large theorem-prover and - symbolic algebra systems. It supports the CLtL1 specification but is - moving towards the proposed ANSI definition. GCL compiles to C and - then uses the native optimizing C compilers (e.g., GCC). A function - with a fixed number of args and one value turns into a C function of the - same number of args, returning one value, so GCL is maximally efficient - on such calls. It has a conservative garbage collector which allows - great freedom for the C compiler to put Lisp values in arbitrary - registers. It has a source level Lisp debugger for interpreted code, - with display of source code in an Emacs window. Ita profiling tools - (based on the C profiling tools) count function calls and the time spent - in each function. CLX works with GCL. - - There is now a builtin interface with the TK widget system. It runs in - a separate process so that users may monitor progress on lisp - computations, or interact with running computations via a windowing - interface. - - There is also an Xlib interface via C (xgcl-2). PCL runs with GCL (see - PCL item later in this article). *Note Forthcoming GNUs::, for plans for - about GCL, or for recent developments. GCL version 2.0 is released - under the GNU Library General Public License. - - * `cpio' (DjgppD, DosCD, SrcCD, UtilD, UtilT) - - `cpio' is an alternative archive program with all the features of SVR4 - `cpio', including support for the final POSIX 1003.1 `ustar' standard. - `mt', a program to position magnetic tapes, is included with `cpio'. - - * CVS (SrcCD, UtilT) - - CVS, the Concurrent Version System, manages software revision and release - control in a multi-developer, multi-directory, multi-group environment. - It works best in conjunction with RCS versions 4 and above, but will - parse older RCS formats with the loss of CVS's fancier features. See - Berliner, Brian, "CVS-II: Parallelizing Software Development," - `Proceedings of the Winter 1990 USENIX Association Conference'. To find - out how to get a copy of this report, contact `office@usenix.org'. - - * DejaGnu (LangT, SrcCD) - - DejaGnu is a framework for testing other programs that provides a single - front end for all tests. The framework's flexibility and consistency - makes it easy to write tests for any program. DejaGnu comes with - `expect', which runs scripts to conduct dialogs with programs. - - * Diffutils (DjgppD, DosCD, SrcCD, UtilD, UtilT) - - GNU `diff' compares files showing line-by-line changes in several - flexible formats. It is much faster than traditional Unix versions. The - Diffutils package contains `diff', `diff3', `sdiff', and `cmp'. - - Recent Diffutils improvements include more consistent handling of - character sets, and a new `diff' option to do all input/output in - binary; this is useful on some non-Posix hosts. - - Plans for the Diffutils package include support for internationalization - (e.g., error messages in Chinese), and for some non-Unix PC environments. - - * DJGPP (BinCD, DjgppD, DosCD) - - DJ Delorie has ported GCC/G++ 2.6.0 (see the GCC item in this section) - to the i386 MS-DOS platform. The DJGPP package also contains a 32-bit - 80386 DOS extender with symbolic debugger; development libraries; and - ports of Bison, `flex', GAS, and the GNU Binutils. Full source code is - provided. It requires at least 5MB of hard disk space to install and - 512K of RAM to use. It supports SVGA (up to 1024x768), XMS & VDISK - memory allocation, `himem.sys', VCPI (e.g., QEMM, DESQview, & 386MAX), - and DPMI (e.g., Windows 3.x, OS/2, QEMM, & QDPMI). Ask - `djgpp-request@sun.soe.clarkson.edu' to join a DJGPP users mailing list. - - * `dld' (LangT, SrcCD) - - `dld' is a dynamic linker written by W. Wilson Ho. Linking your program - with the `dld' library allows you to dynamically load object files into - the running binary. Currently supported are VAX (Ultrix), Sun 3 (SunOS - 3.4 & 4.0), SPARC (SunOS 4.0), Sequent Symmetry (Dynix), & Atari ST. - - * `doschk' (DjgppD, DosCD, SrcCD, UtilT) - - This program is intended as a utility to help software developers ensure - that their source file names are distinguishable on System V platforms - with 14-character filenames and on MS-DOS with 8+3 character filenames. - - * `ecc' (SrcCD, UtilT) - - `ecc' is a Reed-Solomon error correction checking program, which can - correct three byte errors in a block of 255 bytes and detect more severe - errors. Contact `paulf@Stanford.EDU' for more information. - - * `ed' (SrcCD, UtilT) - - Ed is the standard text editor. - - * Elib (LspEmcT, SrcCD) - - Elib is a small library of Emacs Lisp functions, including routines for - using AVL trees and doubly-linked lists. - - * GNU Emacs - - In 1975, Richard Stallman developed the first Emacs, an extensible, - customizable real-time display editor and computing environment. GNU - Emacs is his second implementation. It offers true Lisp--smoothly - integrated into the editor--for writing extensions, and provides an - interface to the X Window System. It also runs on MS-DOS and Windows - NT. In addition to its powerful native command set, Emacs has - extensions which emulate the editors vi and EDT (DEC's VMS editor). - Emacs has many other features which make it a full computing support - environment. Our long term plan is now to move it in the direction of a - WYSIWYG word processor and make it easy for beginners to use. Source - for the `GNU Emacs Manual', `Programming in Emacs Lisp, An - Introduction', the `GNU Emacs Lisp Reference Manual', and a reference - card come with the software. *Note Documentation::. - - * GNU Emacs 18 (EmcsD, LspEmcT, SrcCD, VMSEmcsT) - - GNU Emacs 18.59 is the last release of version 18 from the FSF. We are - no longer maintaining it. It runs on many Unix systems. In hardware - order: Alliant FX/80 & FX/2800, Altos 3068, Amdahl (UTS), Apollo, AT&T - (3Bs & 7300 PC), DG Aviion, Bull DPX/2 (2nn & 3nn) CCI 5/32 & 6/32, - Celerity, Convex, Digital (DECstation 3100 & 5000 (PMAXes), Mips, VAX - (BSD, SysV & VMS)), Motorola Delta 147 & 187, Dual, Elxsi 6400, Encore - (DPC, APC & XPC), Gould, HP (9000 series 200, 300, 700 & 800, but not - 500), HLH Orion (original & 1/05), IBM (RS/6000 (AIX), RT/PC (4.2 & AIX) - & PS/2 (AIX (386 only))), ISI (Optimum V, 80386), Intel 860 & 80386 - (BSD, Esix, SVR3, SVR4, SCO, ISC, IX, AIX & others), Iris (2500, 2500 - Turbo & 4D), Masscomp, MIPS, National Semiconductor 32000, NeXT (Mach), - NCR Tower 32 (SVR2 & SVR3), Nixdorf Targon 31, Nu (TI & LMI), pfa50, - Plexus, Prime EXL, Pyramid (original & MIPS), Sequent (Balance & - Symmetry), SONY News (m68k & MIPS), Stride (system release 2), all Suns - including 386i (all SunOS & some Solaris vers.), Tadpole, Tahoe, Tandem - Integrity S2, Tektronix (16000 & 4300), Triton 88, Ustation E30 (SS5E), - Whitechapel (MG1) & Wicat. - - In operating system order: AIX (RS/6000, RT/PC, 386-PS/2), BSD (vers. - 4.1, 4.2, 4.3), DomainOS, Esix (386), HP-UX (HP 9000 series 200, 300, - 700, 800 but not 500), ISC (386), IX (386), Mach, Microport, NewsOS - (Sony m68k & MIPS) SCO (386), SVR0 (Vax, AT&T 3Bs), SVR2, SVR3, SVR4, - Solaris 2.0, SunOS, UTS (Amdahl), Ultrix (vers. 3.0, 4,1), Uniplus 5.2 - (Dual machines), VMS (vers. 4.0, 4.2, 4.4, 5.5) & Xenix (386). - - * GNU Emacs 19 (DosCD, EmacsD, LspEmcT, SrcCD) - - Emacs 19 works with character-only terminals as well as with the X - Window System (with or without the X toolkit); New features in Emacs 19 - include: multiple X windows ("frames" to Emacs), with either a separate - X window for the minibuffer or a minibuffer attached to each X window; - property lists associated with regions of text in a buffer; multiple - fonts and colors defined by those properties; simplified and improved - processing of function keys, mouse clicks and mouse movement; X - selection processing, including clipboard selections; hooks to be run if - point or mouse moves outside a certain range; menu bars and popup menus - defined by keymaps; scrollbars; before and after change hooks; - source-level debugging of Emacs Lisp programs; European character sets - support; floating point numbers; improved buffer allocation, including - returning storage to the system when a buffer is killed; interfacing - with the X resource manager; GNU configuration scheme support; good RCS - support; & many updated libraries. - - Recent features include support for Motif widgets as well as the Athena - widgets, displaying multiple views of an outline at the same time, - version control support for CVS and for multiple branches, ability to - open frames on more than one X display from a single Emacs job, - operation on MS-DOS and MS Windows, commands to edit text properties, - text properties for formatting text, the ability to save text properties - in files, & GNU-standard long named command line options. - - Emacs 19.29 is believed to work on, in hardware order: Acorn Risc - machine (RISCiX); Alliant FX/2800 (BSD); Alpha (OSF/1); Apollo - (DomainOS); Bull DPX/2 2nn & 3nn (SysV.3) & sps7 (SysV.2); Clipper; - Convex (BSD); Cubix QBx (SysV); Data General Aviion (DGUX); DEC MIPS - (Ultrix 4.2 & OSF/1, not VMS); Elxsi 6400 (SysV); Gould Power Node & NP1 - (4.2 & 4.3BSD); Harris Night Hawk 1200 and 3000, 4000 and 5000 (cxux); - Honeywell XPS100 (SysV); HP 9000 series 200, 300, 700, 800 (but not 500) - (4.3BSD or HP-UX 7, 8, 9); Intel i386, i486 and Pentium (386BSD, AIX, - BSDI/386, FreeBSD, Esix, GNU/Linux, ISC, MS-DOS (*note MS-DOS - Diskettes::. & *Note MS-DOS CD-ROM::), NetBSD, SCO3.2v4, SysV, Xenix, - WindowsNT); IBM RS6000 (AIX 3.2); IBM RT/PC (AIX or BSD); Motorola Delta - 147 & 187 (SysV.3, SysV.4, & m88kbcs); National Semiconductor 32K - (Genix); NeXT (BSD or Mach 2 w/ NeXTStep 3.0); Paragon (OSF/1); Prime - EXL (SysV); Pyramid (BSD); Sequent Symmetry (BSD, ptx); Siemens RM400 - and RM600 (SysV); SGI Iris 4D (Irix 4.x & 5.x); Sony News/RISC (NewsOS); - Stardent i860 (SysV); Sun 3 & 4, SPARC 1, 1+, 2, 10 & Classic (SunOS - 4.0, 4.1, Solaris 2.0-2.3); Tadpole 68k (SysV); Tektronix XD88 (SysV.3) - & 4300 (BSD); & Titan P2 & P3 (SysV). - - In operating system order: AIX (i386, RS6000, RT/PC); 4.1, 4.2, 4.3BSD - (i386, i860, Convex, Gould Power Node & NP1, HP9000 series 300, NeXT, - Pyramid, Symmetry, Tektronix 4300, RT/PC); DG/UX (Aviion); - DomainOS(Apollo); Esix (i386); FreeBSD (i386); Genix (ns32k); GNU/Linux - (i386); HP-UX 7, 8, 9 (HP 9000 series 200, 300, 700, 800, but not 500); - Irix 4 & 5 (Iris 4D); ISC (i386); Mach 2 & 3 (i386, NeXT); MS-DOS (*note - MS-DOS Diskettes::. & *Note MS-DOS CD-ROM::); NetBSD (i386, HP9000 - series 300); OSF/1 (Alpha, Paragon); RISCiX (Acorn); SCO 3.2v4 (i386); - SysV (Cubix QBx, Elxsi 6400, Honeywell XPS100, Intel i386, Prime EXL, - Siemens RM400 and RM600, Stardent, Tadpole 68k, Titan P2 & P3); SysV.2 - (Bull sps7); SysV.3 (Bull DPX/2 2nn & 3nn, Motorola Delta 147 & 187, - Tektronix XD88); SysV.4 (Motorola Delta 147 & 187, Stardent i860); - Solaris 2 (SPARC 1, 1+, 2, 10, Classic); SunOS 4.0, 4.1 (Sun 3 & 4, - SPARC 1, 1+, 2, 10 & Classic); Ultrix 4.2 (DEC MIPS); Windows NT; & - Xenix (i386). - - Other configurations supported by Emacs 18 should work with few changes - in Emacs 19; as users tell us more about their experiences with different - systems, we will augment the list. Also see *Note Forthcoming GNUs::. - - * `es' (SrcCD, UtilT) - - `es' is an extensible shell based on `rc' with first class functions, - lexical scope, exceptions, and rich return values (i.e., functions can - return values other than just numbers). `es''s extensibility comes from - the ability to modify and extend the shell's builtin services, such as - path searching and redirection. Like `rc', it is great for both - interactive use and for scripting, particularly since its quoting rules - are much less baroque than the C or Bourne shells. - - * `f2c' (LangT, SrcCD) - - `f2c' converts Fortran-77 source files into C or C++, which can be - compiled with GCC. You can get bug fixes by FTP from site - `netlib.att.com' or by email from `netlib@research.att.com'. The fixes - are summarized in the file `/netlib/f2c/changes.Z'. *Note Forthcoming - GNUs::, for information about GNU Fortran. - - * Fileutils (DjgppD, DosCD, SrcCD, UtilD, UtilT) - - The fileutils work on files: `chgrp', `chmod', `chown', `cp', `dd', `df', - `dir', `du', `install', `ln', `ls', `mkdir', `mkfifo', `mknod', `mv', - `mvdir', `rm', `rmdir', `sync', `touch', & `vdir'. Only some of these - are on the *Note Selected Utilities Diskettes::. - - * Findutils (DjgppD, DosCD, SrcCD, UtilD, UtilT) - - `find' is frequently used both interactively and in shell scripts to - find files which match certain criteria and perform arbitrary operations - on them. Also included are `xargs', which applies a command to a list - of files, and `locate', which scans a database for file names that match - a pattern. - - * Finger (SrcCD, UtilT) - - GNU Finger has more features than other finger programs. For sites with - many hosts, a single host may be designated as the finger "server" host, - and other hosts at that site configured as finger "clients". The server - host collects information about who is logged in to the clients. To - finger a user at a GNU Finger site, a query to any its client hosts gets - useful information. GNU Finger supports many customization features, - including user output filters, and site programmable output for special - target names. - - * `flex' (DjgppD, DosCD, LangT, SrcCD, UtilD) - - `flex' is a replacement for the `lex' scanner generator. `flex' was - written by Vern Paxson of the Lawrence Berkeley Laboratory and generates - far more efficient scanners than `lex' does. Source for the `Flex - Manual' and reference card are included. *Note Documentation::. - - * FlexFAX (UtilT) - - FlexFAX is now called HylaFAX. For more information, *Note GNU - Software::. - - * Fontutils (SrcCD, UtilT) - - The fontutils create fonts for use with Ghostscript or TeX, starting - with a scanned type image and converting the bitmaps to outlines. They - also contain general conversion programs and other utilities. - - Fontutils programs include: `bpltobzr', `bzrto', `charspace', - `fontconvert', `gsrenderfont', `imageto', `imgrotate', `limn', and - `xbfe'. - - * GAWK (DjgppD, DosCD, LangT, SrcCD) - - GAWK is upwardly compatible with the latest POSIX specification of - `awk'. It also provides several useful extensions not found in other - `awk' implementations. Texinfo source for the `GAWK Manual' comes with - the software. *Note Documentation::. - - * GCC (BinCD, DjgppD, DosCD, LangT, SrcCD, VMSCompT) - - Version 2 of the GNU C Compiler supports multiple languages; the source - file name suffix or a compiler option selects the language. The GNU C - Compiler distribution includes support for C, C++ and Objective-C. - Support for Objective-C was donated by NeXT. The runtime support needed - to run Objective-C programs is now distributed with GCC (this does not - include any Objective-C classes aside from `object'). As much as - possible, G++ is kept compatible with the evolving draft ANSI standard, - but not with `cfront' (AT&T's compiler), which has been diverging from - ANSI. - - The GNU C Compiler is a fairly portable optimizing compiler which - performs automatic register allocation, common sub-expression - elimination, invariant code motion from loops, induction variable - optimizations, constant propagation and copy propagation, delayed - popping of function call arguments, tail recursion elimination, - integration of inline functions and frame pointer elimination, - instruction scheduling, loop unrolling, filling of delay slots, leaf - function optimization, optimized multiplication by constants, a certain - amount of common subexpression elimination (CSE) between basic blocks - (though not all of the supported machine descriptions provide for - scheduling or delay slots), a feature for assigning attributes to - instructions, and many local optimizations that are automatically - deduced from the machine description. Position-independent code is - supported on the 68k, i386, i486, Pentium, Hitachi Slt, Hitachi H8/300, - Clipper, 88k, SPARC & SPARClite. - - GCC can open-code most arithmetic on 64-bit values (type `long long - int'). It supports extended floating point (type `long double') on the - 68k; other machines will follow. - - GCC supports full ANSI C, traditional C & GNU C extensions (including: - nested functions support, nonlocal gotos & taking the address of a - label). - - GCC can generate a.out, COFF, ELF & OSF-Rose files when used with a - suitable assembler. It can produce debugging information in these - formats: BSD stabs, COFF, ECOFF, ECOFF with stabs & DWARF. - - GCC generates code for many CPUs, including: a29k, Alpha, ARM, AT&T - DSP1610, Convex cN, Clipper, Elxsi, Fujitsu Gmicro, H8/300, HP-PA (1.0 - and 1.1) i370, i386, i486, Pentium, i860, i960, m68k, m68020, m68030, - m68040, m88k, MIL-STD-1750a, MIPS, ns32k, PDP-11, Pyramid, ROMP, RS6000, - SH, SPARC, SPARClite, VAX, & we32k. - - Operating systems supported include: AIX, ACIS, AOS, BSD, Clix, Ctix, - DG/UX, Dynix, Genix, GNU, HP-UX, ISC, Irix, GNU/Linux, Luna, LynxOS, - Mach, Minix, NetBSD, NewsOS, OSF, OSF-Rose, RISCOS, SCO, Solaris 2, - SunOS 4, SysV, Ultrix, Unos, VMS & Windows/NT. - - Using the configuration scheme for GCC, building a cross-compiler is as - easy as building a native compiler. - - We no longer maintain version 1 of GCC, G++, or libg++. - - Texinfo source for the `Using and Porting GNU CC' manual, is included - with GCC. *Note Forthcoming GNUs::, for plans for later releases of - GCC. - - * GDB (BinCD, DjgppD, DosCD, LangT, SrcCD) - - GDB, the GNU DeBugger, is a source-level debugger which supports C, C++, - and Fortran. - - GDB can debug both C and C++ programs, and will work with executables - produced by many different compilers; however, C++ debugging will have - some limitations if you do not use GCC. - - GDB has a command line user interface; GNU Emacs comes with a GDB mode, - and `xxgdb' provides an X interface (but it is not distributed or - maintained by the FSF; FTP it from `ftp.x.org' in the - `/contrib/utilities' directory). - - Executable files and symbol tables are read via the BFD library, which - allows a single copy of GDB to debug programs with multiple object file - formats (e.g., a.out, COFF, ELF). Other features include a rich command - language, remote debugging over serial lines or TCP/IP, and watchpoints - (breakpoints triggered when the value of an expression changes). - - GDB defines a standard interface for simulators, and the included - simulator library includes simulators for the Zilog Z8001/2, Hitachi - H8/300, H8/500 & Super-H. - - GDB can perform cross-debugging. To say that GDB "targets" a platform - means that it can perform native or cross-debugging for it. To say that - GDB can "host" a given platform means that it can be built on it, but - cannot necessarily debug native programs. GDB can: - - * "target" & "host": Amiga 3000 (Amix), DEC Alpha (OSF/1), DECstation - 3100 & 5000 (Ultrix), HP 9000/300 (BSD, HP-UX), HP 9000/700 (HP-UX), - i386 (BSD, FreeBSD, GNU/Linux, LynxOS, NetBSD, SCO), IBM RS/6000 - (AIX, LynxOS), Motorola Delta m88k (System V, CX/UX), PC532 - (NetBSD), Motorola m68k MVME-167 (LynxOS), NCR 3000 (SVR4), SGI - (Irix V3, V4, V5), SONY News (NewsOS 3.x), SPARC (SunOS 4.1, - Solaris, NetBSD, LynxOS) Sun-3 (SunOS 4.1), & Ultracomputer (a29k - running Sym1). - - * "target", but not "host": AMD 29000 (COFF & a.out), Hitachi H8/300, - Hitachi SH, i386 (a.out, COFF, OS/9000) i960 (Nindy, VxWorks), - m68k/m68332 (a.out, COFF, VxWorks), MIPS (IDT ecoff, ELF), Fujitsu - SPARClite (a.out, COFF), & Z8000. - - * "host", but not "target": IBM RT/PC (AIX), and HP/Apollo 68k (BSD). - - GDB can use the symbol tables emitted by the vendor-supplied compilers of - most MIPS-based machines, including DEC. (These tables are in a format - which almost nobody else uses.) Source for the manual - `Debugging with GDB' and a reference card are included. *Note - Documentation::. - - * `gdbm' (LangT, SrcCD, UtilD) - - `gdbm' is the GNU replacement for the traditional `dbm' and `ndbm' - libraries. It implements a database using quick lookup by hashing. - `gdbm' does not ordinarily make sparse files (unlike its Unix and BSD - counterparts). - - * Ghostscript (DjgppD, DosCD, SrcCD, UtilT) - - GNU Ghostscript is the GNU release of Ghostscript, which is an - interpreter for the Postscript graphics language (*note Forthcoming - GNUs::., for news on future plans). - - The current version of GNU Ghostscript is 2.6.2. Features include the - ability to use the fonts provided by the platform on which Ghostscript - runs (X Window System and Microsoft Windows), resulting in much - better-looking screen displays; improved text file printing (like - `enscript'); a utility to extract the text from a Postscript language - document; a much more reliable (and faster) Microsoft Windows - implementation; support for Microsoft C/C++ 7.0; drivers for many new - printers, including the SPARCprinter, and for TIFF/F (fax) file format; - many more Postscript Level 2 facilities, including most of the color - space facilities (but not patterns), and the ability to switch between - Level 1 and Level 2 dynamically. Version 2.6.2 adds a LaserJet 4 driver - and several important bug fixes to version 2.6.1. - - Ghostscript executes commands in the Postscript language by writing - directly to a printer, drawing on an X window, or writing to a file for - later printing (or to a bitmap file that you can manipulate with other - graphics programs). - - Ghostscript includes a C-callable graphics library (for client programs - that do not want to deal with the Postscript language). It also supports - IBM PCs and compatibles with EGA, VGA, or SuperVGA graphics (but please - do *not* ask the FSF staff any questions about this; we do not use PCs). - - * Ghostview (SrcCD, UtilT) - - Tim Theisen, `ghostview@cs.wisc.edu', has created Ghostview, a previewer - for multi-page files with an X11 user interface. Ghostview and - Ghostscript function as two cooperating programs; Ghostview creates a - viewing window and Ghostscript draws in it. - - * `gmp' (LangT, SrcCD) - - GNU mp is a library for arbitrary precision arithmetic on signed integers - and rational numbers. It has a rich set of functions with a regular - interface. - - * GNATS (SrcCD, UtilT) - - GNATS (GNats: A Tracking System, not to be confused with GNAT, The GNU - Ada Translator) is a bug-tracking system. It is based upon the paradigm - of a central site or organization which receives problem reports and - negotiates their resolution by electronic mail. Although it has been - used primarily as a software bug-tracking system so far, it is - sufficiently generalized so that it could be used for handling system - administration issues, project management or any number of other - applications. - - * `gnuplot' (SrcCD, UtilT, WdwsD) - - `gnuplot' is an interactive program for plotting mathematical - expressions and data. It handles both curves (2 dimensions) and surfaces - (3 dimensions). Curiously, the program was neither written nor named for - the GNU Project; the name is a coincidence. Various GNU programs use - `gnuplot' to produce graphical output. - - * GnuGo (SrcCD, UtilT) - - GnuGo plays the game of Go (Wei-Chi); it is not yet very sophisticated. - - * `gperf' (LangT, SrcCD) - - `gperf' generates perfect hash tables. There are two implementations of - `gperf', written in C and C++. Both produce hash functions in either C - or C++. - - * GNU Graphics (SrcCD, UtilT) - - GNU Graphics is a system which produces x-y plots from ASCII or binary - data. It supports output in Postscript, Tektronix 4010 compatible and - Unix device-independent "plot" formats as well as a previewer for the X - Window System. Features include a `spline' interpolation program; - examples of shell scripts using `graph' and `plot'; and a statistics - toolkit; and output in TekniCAD TDA and ln03 file formats. Email bugs or - questions to Rich Murphey, `Rich@lamprey.utmb.edu'. - - * grep (DjgppD, DosCD, SrcCD, UtilD, UtilT) - - This package has GNU `grep', `egrep', and `fgrep' which find lines that - match inputed patterns. They are much faster than the traditional Unix - versions. - - * Groff (DjgppD, DosCD, SrcCD, UtilT) - - Groff is a document formatting system based on an implementation of - device-independent troff, which also includes implementations of `eqn', - `nroff', `pic', `refer', `tbl', `troff', and the `man', `ms', and `mm' - macros, as well as drivers for Postscript, TeX `dvi' format, and - typewriter-like devices. - - Groff's `mm' macro package is almost compatible with the DWB `mm' macros - and has several extensions. Also included is a modified version of the - Berkeley `me' macros and an enhanced version of the X11 `xditview' - previewer. Written in C++, these programs can be compiled with GNU C++ - Version 2.5 or later. A driver for the LaserJet 4 series of printers is - currently in test. - - Groff users are encouraged to contribute enhancements. Most needed are - complete Texinfo documentation, a `grap' emulation (a `pic' preprocessor - for typesetting graphs), a page-makeup postprocessor similar to `pm' - (see `Computing Systems', Vol. 2, No. 2; ask `office@usenix.org' how to - get a copy) and an ASCII output class for `pic' so that `pic' can be - integrated with Texinfo. Questions and bug reports from users who have - read the documentation provided with groff can be sent to - `bug-groff@prep.ai.mit.edu'. - - * `gzip' (DjgppD, DosCD, LangT, LspEmcT, SrcCD, UtilT) - - Some of the contents of our tape and FTP distributions are compressed. - We have software on our tapes and FTP sites to uncompress these files. - Due to patent troubles with `compress', we use another compression - program, `gzip'. (Such prohibitions on software development are fought - by the League for Programming Freedom, *note What Is the LPF::., for - details.) `gzip' can expand LZW-compressed files but uses another, - unpatented algorithm for compression which generally produces better - results. It also expands files compressed with System V's `pack' - program. - - * `hello' (DjgppD, DosCD, SrcCD, UtilT) - - The GNU `hello' program produces a familiar, friendly greeting. It - allows non-programmers to use a classic computer science tool which would - otherwise be unavailable to them. Because it is protected by the GNU - General Public License, users are free to share and change it. - - Like any truly useful program, `hello' contains a built-in mail reader. - - * `hp2xx' (SrcCD, UtilT) - - GNU `hp2xx' reads HP-GL files, decomposes all drawing commands into - elementary vectors, and converts them into a variety of vector and raster - output formats. It is also an HP-GL previewer. Currently supported - vector formats include encapsulated Postscript, Uniplex RGIP, Metafont - and various special TeX-related formats, and simplified HP-GL (line - drawing only) for imports. Raster formats supported include IMG, PBM, - PCX, & HP-PCL (including Deskjet & DJ5xxC support). Previewers work - under X11 (Unix), OS/2 (PM & full screen), MS-DOS (SVGA, VGA, & HGC). - - * HylaFAX (UtilT) - - HylaFAX is a facsimile system for Unix systems. It supports sending, - receiving, and polled retrieval of facsimile, as well as transparent - shared data use of the modem. Information is also available on the - World Wide Web at URL: `http://www.vix.com/hylafax/'. - - * `indent' (DjgppD, DosCD, SrcCD, UtilD, UtilT) - - GNU `indent' is a revision of the BSD version. By default, it formats C - source according to the GNU coding standards. The BSD default, K&R and - other formats are available as options. It is also possible to define - your own format. GNU `indent' is more robust and provides more - functionality than other versions, e.g., it handles C++ comments. - - * Ispell (DjgppD, DosCD, SrcCD, UtilT) - - Ispell is an interactive spell checker that suggests "near misses" as - replacements for unrecognized words. System & user-maintained - dictionaries for multiple languages can be used. Standalone & GNU Emacs - interfaces are available. Previously, the GNU Project had its own - version of ispell ("Ispell 4.0"), but has dropped it for a parallel - branch that has had more development ("Ispell 3.1"). (Version 3 was an - earlier release from the original Ispell author, but others have since - made it more sophisticated.) - - * JACAL *Not available from the FSF* - - JACAL is a symbolic mathematics system for the manipulation and - simplification of equations and single and multiple-valued algebraic - expressions constructed of numbers, variables, radicals, differential - operators, and algebraic and holonomic functions. Vectors, matrices, - and tensors of these objects are also supported. - - JACAL was written in Scheme by Aubrey Jaffer. It comes with SCM, an IEEE - P1178 and R4RS compliant version of Scheme written in C. SCM runs on - Amiga, Atari-ST, MS-DOS, OS/2, NOS/VE, Unicos, VMS, Unix, and similar - systems. SLIB is a portable Scheme library used by JACAL. - m{No Value For "ergegrafkludge"} The FSF is not distributing JACAL on - any media. To receive an IBM PC floppy disk with the source and - executable files, send $99.00 to: - Aubrey Jaffer - 84 Pleasant Street - Wakefield, MA 01880-1846 - USA - - * `less' (SrcCD, UtilD, UtilT) - - `less' is a display paginator similar to `more' and `pg' but with - various features (such as the ability to scroll backwards) that most - pagers lack. - - * `m4' (DjgppD, DosCD, SrcCD, UtilD, UtilT) - - GNU `m4' is an implementation of the traditional Unix macro processor. - It is mostly SVR4 compatible, although it has some extensions (for - example, handling more than 9 positional parameters to macros). `m4' - also has built-in functions for including files, running shell commands, - doing arithmetic, etc. - - * `make' (BinCD, DjgppD, DosCD, LangT, LspEmcT, SrcCD, UtilD, - UtilT) - - GNU `make' supports POSIX 1003.2 and has all but a few obscure features - of the BSD and System V versions of `make', as well as many of our own - extensions. GNU extensions include long options, parallel compilation, - flexible implicit pattern rules, conditional execution and powerful text - manipulation functions. Texinfo source for the `Make Manual' comes with - the program. *Note Documentation::. - - GNU `make' is on several of our tapes because some system vendors supply - no `make' utility at all, and some native `make' programs lack the - `VPATH' feature essential for using the GNU configure system to its full - extent. The GNU `make' sources have a shell script to build `make' - itself on such systems. - - MS-DOS binaries for `make' are available with the DJGPP distribution. - - * MandelSpawn (SrcCD, UtilT) - - A parallel Mandelbrot generation program for the X Window System. - - * mtools (SrcCD, UtilT) - - mtools is a set of public domain programs to allow Unix systems to read, - write and manipulate files on an MS-DOS file system (usually a diskette). - - * MULE (EmcsD, DosCD, SrcCD) - - MULE is a MULtilingual Enhancement to GNU Emacs. It can handle many - character sets at once including Japanese, Chinese, Korean, Vietnamese, - Thai, Greek, the ISO Latin-1 through Latin-8 character sets, Ukrainian, - Arabic, Hebrew, Russian, and other Cyrillic alphabets. A text buffer in - MULE can contain a mixture of characters from these languages. To input - any of these characters, you can use various input methods provided by - MULE itself. In addition, if you use MULE under some terminal emulators - (kterm, cxterm, or exterm), you can use its input methods. MULE is - being merged into GNU Emacs. *Note GNU and Other Free Software in - Japan::, for more information about MULE. - - * NetHack (SrcCD, UtilT) - - NetHack is a display-oriented adventure game similar to Rogue. Both - ASCII and X displays are supported. - - * NIH Class Library (LangT, SrcCD) - - The NIH Class Library (formerly known as "OOPS", Object-Oriented Program - Support) is a portable collection of C++ classes, similar to those in - Smalltalk-80, which has been developed by Keith Gorlen of the National - Institutes of Health (NIH), using the C++ programming language. - - * `nvi' (SrcCD, UtilT) - - `nvi' is a free implementation of the `vi'/`ex' Unix editor. It has - most of the functionality of the original `vi'/`ex', except "open" mode - & the `lisp' option, which will be added. Enhancements over `vi'/`ex' - include split screens with multiple buffers, handling 8-bit data, - infinite file & line lengths, tag stacks, infinite undo & extended - regular expressions. It runs under GNU/Linux, BSD, NetBSD, FreeBSD, - BSDI, AIX, HP-UX, DGUX, IRIX, PSF, PTX, Solaris, SunOS, Ultrix, Unixware - & should port easily to many other systems. - - * GNU Objective-C Library (LangT, SrcCD) - - The GNU Objective-C Class Library (`libobjects') is a library of - general-purpose, non-graphical Objective-C objects written by Andrew - McCallum and other volunteers. It includes collection classes for - maintaining groups of objects and C types, streams for I/O to various - destinations, coders for formatting objects and C types to streams, ports - for network packet transmission, distributed objects (remote object - messaging), string classes, pseudo-random number generators, and time - handling facilities. The package will also include the foundation - classes for the GNUStep project; over 50 of these classes have already - been implemented. The library is known to work on i386, i486, Pentium, - m68k, SPARC, MIPS, & RS6000. Send queries and bug reports to - `mccallum@gnu.ai.mit.edu'. - - * `OBST' (LangT, SrcCD) - - `OBST' is a persistent object management system with bindings to C++. - `OBST' supports incremental loading of methods. Its graphical tools - require the X Window System. It features a hands-on tutorial including - sample programs. It compiles with g++ and should install easily on most - Unix platforms. - - * Octave (LangT, SrcCD) - - Octave is a high-level language similar to MATLAB that is primarily - intended for numerical computations. It provides a convenient command - line interface for solving linear and nonlinear problems numerically. - m{No Value For "ergegrafkludge"} Octave does arithmetic for real and - complex scalars and matrices, solves sets of nonlinear algebraic - equations, integrates systems of ordinary differential and - differential-algebraic equations, and integrates functions over finite - and infinite intervals. Two- and three-dimensional plotting is - available using `gnuplot'. Send queries and bug reports to: - `bug-octave@che.utexas.edu'. Source is included for a 220+ page - Texinfo manual, which is not yet published by the FSF. - - * Oleo (SrcCD, UtilT) - - Oleo is a spreadsheet program (better for you than the more expensive - spreadsheets). It supports the X Window System and character-based - terminals, and can output Embedded Postscript renditions of spreadsheets. - Keybindings should be familiar to Emacs users and are configurable. - Under X and in Postscript output, Oleo supports multiple, variable width - fonts. *Note Forthcoming GNUs::, for the plans for later releases of - Oleo. - - * `p2c' (LangT, SrcCD) - - `p2c' is a Pascal-to-C translator written by Dave Gillespie. It - recognizes many Pascal dialects including Turbo, HP, VAX, and ISO, and - produces readable, maintainable, portable C. - - * `patch' (DjgppD, DosCD, SrcCD, UtilT) - - `patch' is our version of Larry Wall's program to take `diff''s output - and apply those differences to an original file to generate the modified - version. - - * PCL (LspEmcT, SrcCD) - - PCL is a free implementation of a large subset of CLOS, the Common Lisp - Object System. It runs under both GCL and CLISP, mentioned above. - - * `perl' (LangT, SrcCD) - - Larry Wall's `perl' combines the features and capabilities of `sed', - `awk', `sh' and C, as well as interfaces to the Unix system calls and - many C library routines. - - * `ptx' (SrcCD, UtilD, UtilT) - - GNU `ptx' is our version of the traditional permuted index generator. - It handles multiple input files at once, produces TeX compatible output, - & outputs readable "KWIC" (KeyWords In Context) indexes. It does not - yet handle input files that do not fit in memory all at once. - - * `rc' (SrcCD, UtilT) - - `rc' is a shell that features a C-like syntax (much more so than `csh') - and far cleaner quoting rules than the C or Bourne shells. It's - intended to be used interactively, but is also great for writing - scripts. It inspired the shell `es'. - - * RCS (SrcCD, UtilD, UtilT) - - RCS, the Revision Control System, is used for version control & - management of software projects. When used with GNU `diff', RCS can - handle binary files (executables, object files, 8-bit data, etc). Also - see the item about CVS in this section. - - * `recode' (SrcCD, UtilT) - - GNU `recode' converts files between character sets and usages. When - exact transliterations are not possible, it may get rid of the offending - characters or fall back on approximations. This program recognizes or - produces nearly 150 different character sets and is able to - transliterate files between almost any pair. Most RFC 1345 character - sets are supported. - - * regex (LangT, SrcCD) - - The GNU regular expression library supports POSIX.2, except for - internationalization features. It is included in many GNU programs which - do regular expression matching and available separately. An alternative - regular expression package, `rx', comes with `sed'; it has the potential - to be faster than `regex' in most cases, but still needs work. - - * Scheme (SchmT, SrcCD) - - For information about Scheme, see *Note Scheme Tape::. - - * `screen' (SrcCD, UtilT) - - `screen' is a terminal multiplexer that runs several separate "screens" - (ttys) on a single character-based terminal. Each virtual terminal - emulates a DEC VT100 plus several ISO 6429 (ECMA 48, ANSI X3.64) and ISO - 2022 functions. Arbitrary keyboard input translation is also supported. - `screen' sessions can be detached and resumed later on a different - terminal type. Output in detached sessions is saved for later viewing. - - * `sed' (DjgppD, DosCD, SrcCD, UtilD, UtilT) - - `sed' is a stream-oriented version of `ed'. GNU `sed' comes with the - `rx' library, a faster version of `regex' (*note Forthcoming GNUs::.). - - * Sharutils (SrcCD, UtilT) - - `shar' makes so-called shell archives out of many files, preparing them - for transmission by electronic mail services, while `unshar' helps - unpack these shell archives after reception. `uuencode' prepares a file - for transmission over an electronic channel which ignores or otherwise - mangles the high order bit of bytes, while `uudecode' does the converse - transformation. - - * Shellutils (DjgppD, DosCD, SrcCD, UtilT) - - Use shellutils interactively or in shell scripts: `basename', `date', - `dirname', `echo', `env', `expr', `false', `groups', `hostname', `id', - `logname', `nice', `nohup', `pathchk', `printenv', `printf', `pwd', - `sleep', `stty', `su', `tee', `test', `true', `tty', `uname', `users', - `who', `whoami', and `yes'. - - * GNU Shogi (SrcCD, UtilT) - - Shogi is a Japanese game similar to Chess; a major difference is that - captured pieces can be returned into play. GNU Shogi is a variant of - GNU Chess; GNU Shogi implements the same features as GNU Chess and uses - similar heuristics. As a new feature, sequences of partial board - patterns can be introduced in order to help the program play toward - specific opening patterns. There are both character and X display - interfaces. GNU Shogi is primarily supported by Matthias Mutz on - behalf of the FSF. - - * Smalltalk (LangT, SrcCD) - - GNU Smalltalk is an interpreted object-oriented programming language - system written in highly portable C. It has been successfully ported to - many Unix and some other platforms, including DOS (but these non-Unix - ports are not available from the FSF). Current features include a - binary image save capability, the ability to invoke user-written C code - and pass parameters to it, a GNU Emacs editing mode, a version of the X - protocol invocable from Smalltalk, optional byte-code compilation - tracing and byte-code execution tracing, and automatically loaded - per-user initialization files. It implements all of the classes and - protocol in the Smalltalk-80 book "Smalltalk-80: The Language", except - for the graphic user interface (`GUI') related classes. - - *Note Forthcoming GNUs::, for plans for later releases of Smalltalk. - - * Superopt (LangT, SrcCD) - - Superopt is a function sequence generator that uses an exhaustive - generate-and-test approach to find the shortest instruction sequence for - a given function. You provide a function as input, a CPU to generate - code for, and how many instructions you can accept. Its application in - GCC is described in the `ACM SIGPLAN PLDI'92' proceedings. Superopt - supports: SPARC, m68k, m68020, m88k, IBM RS/6000, AMD 29000, Intel - 80x86, Pyramid, DEC Alpha, & HP-PA. - - * `tar' (SrcCD, UtilT) - - GNU `tar' includes multivolume support, the ability to archive sparse - files, automatic archive compression/decompression, remote archives and - special features that allow `tar' to be used for incremental and full - backups. Unfortunately, GNU `tar' implements an early draft of the - POSIX 1003.1 `ustar' standard which is different from the final - standard. Adding support for the new changes in a backward-compatible - fashion is not trivial. - - * Termcap Library (SrcCD, UtilT) - - The GNU Termcap library is a drop-in replacement for `libtermcap.a' on - any system. It does not place an arbitrary limit on the size of Termcap - entries, unlike most other Termcap libraries. Included is source for the - `Termcap Manual' in Texinfo format. *Note Documentation::. - - * TeX (SrcCD) - - TeX is a document formatting system that handles complicated - typesetting, including mathematics. It is GNU's standard text formatter. - - You can obtain TeX from the University of Washington, which maintains and - supports a tape distribution of TeX for Unix systems. The core material - consists of Karl Berry's `web2c' TeX package, the sources for which are - available via anonymous ftp; retrieval instructions are in - `pub/tex/unixtex.ftp' on `ftp.cs.umb.edu'. If you receive any - installation support from the University of Washington, please consider - sending them a donation. - - To order a full distribution written in `tar' on either a 1/4inch - 4-track QIC-24 cartridge or a 4mm DAT cartridge, send $210.00 to: - - Pierre A. MacKay - Department of Classics - DH-10, Denny Hall 218 - University of Washington - Seattle, WA 98195 - USA - - Electronic-Mail: `mackay@cs.washington.edu' - Telephone: +1-206-543-2268 - - Please make checks payable to the University of Washington. Do not - specify any other payee. That causes accounting difficulties. Checks - must be in U.S. dollars, drawn on a U.S. bank. Prepaid orders are the - only orders that can now be handled. Overseas sites: please add to the - base cost $20.00 for shipment via air parcel post, or $30.00 for - shipment via courier. Please check with the above for current prices - and formats. - - * Texinfo (DjgppD, DosCD, LangT, LspEmcT, SrcCD, UtilD, UtilT) - - Texinfo is a set of utilities which generate both printed manuals and - online hypertext documentation (called "Info"). There are also programs - for reading online Info documents. Version 3 has both GNU Emacs Lisp - and standalone programs written in C or shell script. Texinfo mode for - GNU Emacs enables easy editing and updating of Texinfo files. Programs - provided include `makeinfo', `info', `texi2dvi', `texindex', `tex2patch', - and `fixfonts'. Source for the `Texinfo Manual' is included. *Note - Documentation::. - - * Textutils (DjgppD, DosCD, SrcCD, UtilT) - - The Textutils programs manipulate textual data. They include: `cat', - `cksum', `comm', `csplit', `cut', `expand', `fmt', `fold', `head', - `join', `nl', `od', `paste', `pr', `sort', `split', `sum', `tac', `tail', - `tr', `unexpand', `uniq', and `wc'. - - * Tile Forth (LangT, SrcCD) - - Tile Forth is a 32-bit implementation of the Forth-83 standard written - in C, allowing it to be easily ported to new systems, and extended with - "any" C-function (graphics, windowing, etc). Many Forth libraries with - full documentation are available including ones for top-down parsing, - multi-threads, and object oriented programming. - - * `time' (SrcCD, UtilT) - - `time' is used to report statistics (usually from a shell) about the - amount of user, system and real time used by a process. On some systems - it also reports memory usage, page faults, and other statistics. - - * `tput' (SrcCD, UtilT) - - `tput' is a portable way for shell scripts to use special terminal - capabilities. Our `tput' uses the Termcap database, instead of Terminfo - as most others do. - - * UUCP (SrcCD, UtilT) - - This version of UUCP was written by Ian Lance Taylor, and is GNU's - standard UUCP system. It supports the `f', `g' and `v' (in all window - and packet sizes), `G', `t', `e', Zmodem and two new bidirectional (`i' - and `j') protocols. If you have a Berkeley sockets library, it can make - TCP connections. If you have TLI libraries, it can make TLI - connections. Source is included for a Texinfo manual, which is not yet - published by the FSF. - - * `wdiff' (DjgppD, DosCD, SrcCD, UtilT) - - `wdiff' is a front-end to GNU `diff'. It compares two files, finding - the words deleted or added to the first to make the second. It has many - output formats and works well with terminals and pagers. `wdiff' is - very useful when two texts differ only by a few words and paragraphs - have been refilled. - - * `Ygl' (SrcCD, UtilT) - - `Ygl' emulates SGI's GL (Graphics Language) library under X11. It runs - under GNU/Linux with XFree, AIX 3.2, ConvexOS, HP-UX 7.0/8.0/9.0, SunOS - and many others. - - - -Program/Package Cross Reference - (NOT COMPLETELY UP TO DATE) -******************************* - -Here is a list of what package each GNU program or library is in. You can -anonymously FTP a full list in the file `/pub/gnu/ProgramIndex' from a GNU -FTP host (*note How to Get GNU Software::. for a list). - - * a2p perl - * a2x xopt - * ac bsd44 - * accton bsd44 - * acl bsd44 - * acm acm - * acms acm - * addftinfo Groff - * adventure bsd44 - * afm2tfm TeX - * amd bsd44 - * ansitape bsd44 - * AnswerGarden xopt - * apply bsd44 - * appres xreq - * apropos bsd44 - * ar Binutils - * arithmetic bsd44 - * arp bsd44 - * atc bsd44 - * autoconf Autoconf - * autoheader Autoconf - * autoreconf Autoconf - * autoscan Autoconf - * autoupdate Autoconf - * auto_box xopt - * auto_box xreq - - * b2m Emacs - * backgammon bsd44 - * bad144 bsd44 - * badsect bsd44 - * banner bsd44 - * basename Shellutils - * bash BASH - * battlestar bsd44 - * bc bc - * bcd bsd44 - * bdes bsd44 - * bdftops Ghostscript - * beach_ball xopt - * beach_ball xreq - * beach_ball2 xopt - * bibtex TeX - * biff bsd44 - * bison Bison - * bitmap xreq - * boggle bsd44 - * bpltobzr Fontutils - * bugfiler bsd44 - * build ispell - * bzrto Fontutils - - * c++ GCC - * c++filt Binutils - * c2ph perl - * ca100 xopt - * caeser bsd44 - * cal bsd44 - * calendar bsd44 - * canfield bsd44 - * cat Textutils - * cbars wdiff - * cc GCC - * cc1 GCC - * cc1obj GCC - * cc1plus GCC - * cccp GCC - * charspace Fontutils - * checknr bsd44 - * chess bsd44 - * chflags bsd44 - * chgrp Fileutils - * ching bsd44 - * chmod Fileutils - * chown Fileutils - * chpass bsd44 - * chroot bsd44 - * ci RCS - * cksum Textutils - * clisp CLISP - * clri bsd44 - * cmail xboard - * cmmf TeX - * cmodext xopt - * cmp Diffutils - * co RCS - * col bsd44 - * colcrt bsd44 - * colrm bsd44 - * column bsd44 - * comm Textutils - * compress bsd44 - * comsat bsd44 - * connectd bsd44 - * cp Fileutils - * cpicker xopt - * cpio cpio - * cpp GCC - * cppstdin perl - * cribbage bsd44 - * crock xopt - * csh bsd44 - * csplit Textutils - * ctags Emacs - * ctwm xopt - * cu UUCP - * cut Textutils - * cvs CVS - * cvscheck CVS - * cvtmail Emacs - * cxterm xopt - - * d Fileutils - * date Shellutils - * dc bc - * dd Fileutils - * delatex TeX - * demangle Binutils - * descend CVS - * detex TeX - * df Fileutils - * diff Diffutils - * diff3 Diffutils - * digest-doc Emacs - * dipress bsd44 - * dir Fileutils - * dirname Shellutils - * dish xopt - * disklabel bsd44 - * diskpart bsd44 - * dld dld - * dm bsd44 - * dmesg bsd44 - * doschk doschk - * dox xopt - * du Fileutils - * dump bsd44 - * dumpfs bsd44 - * dvi2tty TeX - * dvicopy TeX - * dvips TeX - * dvitype TeX - - * ecc ecc - * echo Shellutils - * ed ed - * edit-pr GNATS - * editres xreq - * edquota bsd44 - * eeprom bsd44 - * egrep grep - * emacs Emacs - * emacsclient Emacs - * emacsserver Emacs - * emacstool Emacs - * emu xopt - * env Shellutils - * eqn Groff - * error bsd44 - * es es - * esdebug es - * etags Emacs - * ex nvi - * expand Textutils - * expect DejaGnu - * expr Shellutils - * exterm xopt - - * f2c f2c - * factor bsd44 - * fakemail Emacs - * false Shellutils - * fastboot bsd44 - * fax2ps HylaFAX - * faxalter HylaFAX - * faxanswer HylaFAX - * faxcover HylaFAX - * faxd HylaFAX - * faxd.recv HylaFAX - * faxmail HylaFAX - * faxquit HylaFAX - * faxrcvd HylaFAX - * faxrm HylaFAX - * faxstat HylaFAX - * fc f2c - * fdraw xopt - * fgrep grep - * file bsd44 - * find Findutils - * find2perl perl - * finger finger - * fingerd finger - * fish bsd44 - * fixfonts Texinfo - * fixinc.svr4 GCC - * fixincludes GCC - * flex flex - * fmt bsd44 - * fold Textutils - * font2c Ghostscript - * fontconvert Fontutils - * forth Tile Forth - * forthicon Tile Forth - * forthtool Tile Forth - * fortune bsd44 - * fpr bsd44 - * freq ispell - * freqtbl ispell - * from bsd44 - * fsck bsd44 - * fsplit bsd44 - * fstat bsd44 - * ftp bsd44 - * ftpd bsd44 - - * g++ GCC - * gas Binutils - * gawk Gawk - * gcc GCC - * gcore bsd44 - * gdb GDB - * genclass libg++ - * getty bsd44 - * gftodvi TeX - * gftopk TeX - * gftype TeX - * ghostview Ghostview - * gnats GNATS - * gnuchess Chess - * gnuchessc Chess - * gnuchessn Chess - * gnuchessr Chess - * gnuchessx Chess - * gnupdisp Shogi - * gnuplot gnuplot - * gnuplot_x11 gnuplot - * gnushogi Shogi - * gnushogir Shogi - * gnushogix Shogi - * go GnuGo - * gpc xopt - * gpc xreq - * gperf gperf - * gperf libg++ - * gprof Binutils - * graph Graphics - * grep grep - * grodvi Groff - * groff Groff - * grops Groff - * grotty Groff - * groups Shellutils - * gs Ghostscript - * gsbj Ghostscript - * gsdj Ghostscript - * gslj Ghostscript - * gslp Ghostscript - * gsnd Ghostscript - * gsrenderfont Fontutils - * gunzip gzip - * gwm xopt - * gzexe gzip - * gzip gzip - - * h2ph perl - * h2pl perl - * hack bsd44 - * hangman bsd44 - * head Textutils - * hello hello - * hexdump bsd44 - * hexl Emacs - * hostname Shellutils - * hp2xx hp2xx - * hterm xopt - - * i18nOlwmV2 xopt - * i2mif xopt - * ico xopt - * ico xreq - * id Shellutils - * ident RCS - * ifconfig bsd44 - * ifnames Autoconf - * ImageMagick xopt - * imageto Fontutils - * iman xopt - * imgrotate Fontutils - * indent indent - * indxbib Groff - * inetd bsd44 - * info Texinfo - * inimf TeX - * init bsd44 - * initex TeX - * inn bsd44 - * install Fileutils - * iostat bsd44 - * ispell ispell - * ixterm xopt - * ixx xopt - - * join Textutils - * jot bsd44 - * jove bsd44 - - * kdestroy bsd44 - * kdump bsd44 - * kermit bsd44 - * kgames xopt - * kgmon bsd44 - * kill bsd44 - * kinit bsd44 - * kinput2 xopt - * klist bsd44 - * kpasswdd bsd44 - * ksrvtgt bsd44 - * kterm xopt - * ktrace bsd44 - - * lam bsd44 - * larn bsd44 - * lasergnu gnuplot - * last bsd44 - * lastcomm bsd44 - * latex TeX - * lclock xopt - * ld Binutils - * leave bsd44 - * less less - * lesskey less - * libbfd.a Binutils - * libbfd.a GAS - * libbfd.a GDB - * libbzr.a Fontutils - * libc.a C Library - * libcompat.a bsd44 - * libcurses.a bsd44 - * libcurses.a nvi - * libedit.a bsd44 - * libF77.a f2c - * libg++.a libg++ - * libgdbm.a gdbm - * libgf.a Fontutils - * libgmp.a gmp - * libI77.a f2c - * libkvm.a bsd44 - * libm.a bsd44 - * libnihcl.a NIHCL - * libnihclmi.a NIHCL - * libnihclvec.a NIHCL - * libnls.a xreq - * liboctave.a Octave - * liboldX.a xreq - * libpbm.a Fontutils - * libPEXt.a xopt - * libpk.a Fontutils - * libresolv.a bsd44 - * librpc.a bsd44 - * libtcl.a DejaGnu - * libtelnet.a bsd44 - * libterm.a bsd44 - * libtermcap.a Termcap - * libtfm.a Fontutils - * libutil.a bsd44 - * libWc.a xopt - * libwidgets.a Fontutils - * libX.a xreq - * libXau.a xreq - * libXaw.a xreq - * libXcp.a xopt - * libXcu.a xopt - * libXdmcp.a xreq - * libXmp.a xopt - * libXmu.a xreq - * libXO.a xopt - * libXop.a xopt - * libXp.a xopt - * libXpex.a xopt - * libXt.a xopt - * libXt.a xreq - * libXwchar.a xopt - * liby.a bsd44 - * libYgl.a Ygl - * limn Fontutils - * listres xopt - * listres xreq - * lkbib Groff - * ln Fileutils - * locate Findutils - * lock bsd44 - * logger bsd44 - * login bsd44 - * logname Shellutils - * look ispell - * lookbib Groff - * lorder bsd44 - * lpr bsd44 - * ls Fileutils - - * m4 m4 - * mail bsd44 - * make Make - * make-docfile Emacs - * make-path Emacs - * makeindex TeX - * makeinfo Texinfo - * MakeTeXPK TeX - * man bsd44 - * man-macros Groff - * mattrib mtools - * maze xopt - * maze xreq - * mazewar xopt - * mcd mtools - * mcopy mtools - * mdel mtools - * mdir mtools - * me-macros Groff - * merge RCS - * mesg bsd44 - * mf TeX - * mformat mtools - * mft TeX - * mgdiff xopt - * mh bsd44 - * mille bsd44 - * mkdep bsd44 - * mkdir Fileutils - * mkfifo Fileutils - * mklocale bsd44 - * mkmanifest mtools - * mkmf bsd44 - * mkmodules CVS - * mknod Fileutils - * mkstr bsd44 - * mlabel mtools - * mm-macros Groff - * mmd mtools - * monop bsd44 - * more bsd44 - * morse bsd44 - * mount bsd44 - * mountd bsd44 - * movemail Emacs - * mprof bsd44 - * mrd mtools - * mread mtools - * mren mtools - * ms-macros Groff - * msgs bsd44 - * mt cpio - * mterm xopt - * mtree bsd44 - * mtype mtools - * mule MULE - * muncher xopt - * mv Fileutils - * mvdir Fileutils - * mwrite mtools - - * nethack Nethack - * netstat bsd44 - * newfs bsd44 - * nfsd bsd44 - * nfsiod bsd44 - * nfsstat bsd44 - * nice Shellutils - * nl Textutils - * nlmconv Binutils - * nm Binutils - * nohup Shellutils - * notify HylaFAX - * nroff Groff - * number bsd44 - - * objc GCC - * objcopy Binutils - * objdump Binutils - * objective-c GCC - * obst-boot OBST - * obst-CC OBST - * obst-cct OBST - * obst-cgc OBST - * obst-cmp OBST - * obst-cnt OBST - * obst-cpcnt OBST - * obst-csz OBST - * obst-dir OBST - * obst-dmp OBST - * obst-gen OBST - * obst-gsh OBST - * obst-init OBST - * obst-scp OBST - * obst-sil OBST - * obst-stf OBST - * oclock xreq - * octave Octave - * od Textutils - * oleo Oleo - * ora-examples xopt - - * p2c p2c - * pagesize bsd44 - * palette xopt - * pascal bsd44 - * passwd bsd44 - * paste Textutils - * patch patch - * patgen TeX - * pathalias bsd44 - * pathchk Shellutils - * pax bsd44 - * pbmplus xopt - * perl perl - * pfbtops Groff - * phantasia bsd44 - * pic Groff - * pig bsd44 - * ping bsd44 - * pixedit xopt - * pixmap xopt - * pktogf TeX - * pktype TeX - * plaid xopt - * plot2fig Graphics - * plot2plot Graphics - * plot2ps Graphics - * plot2tek Graphics - * pltotf TeX - * pollrcvd HylaFAX - * pom bsd44 - * pooltype TeX - * portmap bsd44 - * ppt bsd44 - * pr Textutils - * pr-addr GNATS - * pr-edit GNATS - * primes bsd44 - * printenv Shellutils - * printf Shellutils - * protoize GCC - * ps bsd44 - * ps2ascii Ghostscript - * ps2epsi Ghostscript - * ps2fax HylaFAX - * psbb Groff - * pstat bsd44 - * psycho xopt - * ptx ptx - * pubdic+ xopt - * puzzle xopt - * puzzle xreq - * pwd Shellutils - * pyramid xopt - - * query-pr GNATS - * quiz bsd44 - * quot bsd44 - * quota bsd44 - * quotacheck bsd44 - * quotaon bsd44 - - * rain bsd44 - * random bsd44 - * ranlib Binutils - * rbootd bsd44 - * rc rc - * rcp bsd44 - * rcs RCS - * rcs-to-cvs CVS - * rcs2log Emacs - * rcsdiff RCS - * rcsfreeze RCS - * rcsmerge RCS - * rdist bsd44 - * reboot bsd44 - * recode recode - * recvstats HylaFAX - * refer Groff - * renice bsd44 - * repquota bsd44 - * restore bsd44 - * rev bsd44 - * rexecd bsd44 - * rlog RCS - * rlogin bsd44 - * rlogind bsd44 - * rm Fileutils - * rmail bsd44 - * rmdir Fileutils - * rmt cpio - * rmt tar - * robots bsd44 - * rogue bsd44 - * route bsd44 - * routed bsd44 - * rr xopt - * rs bsd44 - * rsh bsd44 - * rshd bsd44 - * runtest DejaGnu - * runtest.exp DejaGnu - * ruptime bsd44 - * rwho bsd44 - * rwhod bsd44 - - * s2p perl - * sail bsd44 - * savecore bsd44 - * sc bsd44 - * sccs bsd44 - * sccs2rcs CVS - * scdisp xopt - * screen screen - * script bsd44 - * scsiformat bsd44 - * sctext xopt - * sdiff Diffutils - * sed sed - * send-pr GNATS - * sendfax HylaFAX - * sendmail bsd44 - * sgi2fax HylaFAX - * sh bsd44 - * shar Sharutils - * shinbun xopt - * shogi Shogi - * showfont xopt - * showmount bsd44 - * shutdown bsd44 - * size Binutils - * sj3 xopt - * sjxa xopt - * slattach bsd44 - * sleep Shellutils - * sliplogin bsd44 - * snake bsd44 - * snftobdf xopt - * soelim Groff - * sort Textutils - * sos2obst OBST - * spider xopt - * split Textutils - * startslip bsd44 - * stf OBST - * strings Binutils - * strip Binutils - * stty Shellutils - * su Shellutils - * sum Textutils - * superopt Superopt - * swapon bsd44 - * sync bsd44 - * sysctl bsd44 - * syslogd bsd44 - * systat bsd44 - - * tac Textutils - * tail Textutils - * taintperl perl - * talk bsd44 - * talkd bsd44 - * tangle TeX - * tar tar - * tbl Groff - * tcl DejaGnu - * tclsh DejaGnu - * tcopy bsd44 - * tcp Emacs - * tee Shellutils - * tek2plot Graphics - * telnet bsd44 - * telnetd bsd44 - * test Shellutils - * test-g++ DejaGnu - * test-tool DejaGnu - * tetris bsd44 - * tex TeX - * tex3patch Texinfo - * texi2dvi Texinfo - * texindex Texinfo - * texspell TeX - * textfmt HylaFAX - * tfmtodit Groff - * tftopl TeX - * tftp bsd44 - * tftpd bsd44 - * tgrind TeX - * time time - * timed bsd44 - * timer Emacs - * timex xopt - * tip bsd44 - * tkpostage xopt - * tn3270 bsd44 - * touch Fileutils - * tput tput - * tr Textutils - * traceroute bsd44 - * transcript HylaFAX - * transfig xopt - * trek bsd44 - * trn3 bsd44 - * troff Groff - * trpt bsd44 - * trsp bsd44 - * true Shellutils - * tset bsd44 - * tsort bsd44 - * tty Shellutils - * tunefs bsd44 - * tvtwm xopt - * twm xreq - - * ul bsd44 - * umount bsd44 - * uname Shellutils - * uncompress gzip - * unexpand Textutils - * unifdef bsd44 - * uniq Textutils - * unprotoize GCC - * unshar Sharutils - * unvis bsd44 - * update bsd44 - * updatedb Findutils - * users Shellutils - * uuchk UUCP - * uucico UUCP - * uuconv UUCP - * uucp UUCP - * uucpd bsd44 - * uudecode Sharutils - * uudir UUCP - * uuencode Sharutils - * uulog UUCP - * uuname UUCP - * uupick UUCP - * uurate UUCP - * uusched UUCP - * uustat UUCP - * uuto UUCP - * uux UUCP - * uuxqt UUCP - - * v Fileutils - * vacation bsd44 - * vandal xopt - * vcdiff Emacs - * vdir Fileutils - * vftovp TeX - * vgrind bsd44 - * vi nvi - * viewres xopt - * viewres xreq - * vine xopt - * vipw bsd44 - * virmf TeX - * virtex TeX - * vis bsd44 - * vmstat bsd44 - * vptovf TeX - - * w bsd44 - * wakeup Emacs - * wall bsd44 - * wargames bsd44 - * wc Textutils - * wdiff wdiff - * weave TeX - * what bsd44 - * whatis bsd44 - * whereis bsd44 - * who Shellutils - * whoami Shellutils - * whois bsd44 - * window bsd44 - * winterp xopt - * wish DejaGnu - * worm bsd44 - * worms bsd44 - * write bsd44 - * wump bsd44 - - * x11perf xreq - * x2p perl - * xalarm xopt - * xancur xopt - * xargs Findutils - * xauth xreq - * xbfe Fontutils - * xbiff xopt - * xbiff xreq - * xboard xboard - * xboing xopt - * xbuffy3 xopt - * xcalc xopt - * xcalc xreq - * xcalendar xopt - * xcdplayer xopt - * xcell xopt - * xclipboard xreq - * xclock xreq - * xcmdmenu xopt - * xcms xopt - * xcmsdb xreq - * xcmstest xreq - * xco xopt - * xcolorize xopt - * xcolors xopt - * xconsole xreq - * xcrtca xopt - * xdaliclock xopt - * xdiary xopt - * xditview Groff - * xditview xopt - * xditview xreq - * xdm xreq - * xdpyinfo xreq - * xdu xopt - * xdvi TeX - * xdvi xopt - * xdvorak xopt - * xearth xopt - * xed xopt - * xedit xopt - * xedit xreq - * xev xopt - * xev xreq - * xexit xopt - * xeyes xopt - * xeyes xreq - * xfd xreq - * xfed xopt - * xfedor xopt - * xfeoak xopt - * xferstats HylaFAX - * xfig xopt - * xfontsel xopt - * xfontsel xreq - * xforecast xopt - * xgas xopt - * xgas xreq - * xgc xopt - * xgc xreq - * xhearts xopt - * xhelp xopt - * xhost xreq - * xinit xreq - * xkeycaps xopt - * xkill xreq - * xlax xopt - * xlayout xopt - * xlbiff xopt - * xless xopt - * xload xopt - * xload xreq - * xlogin xopt - * xlogo xreq - * xlsatoms xreq - * xlsclients xreq - * xlsfonts xreq - * xmag xreq - * xmail xopt - * xmailbox xopt - * xmailwatcher xopt - * xman xopt - * xman xreq - * xmandel xopt - * xmessage xopt - * xmeter xopt - * xmh xreq - * xmh-icons xopt - * xmh.editor xopt - * xmodmap xreq - * xmon xopt - * xmove xopt - * xmphone xopt - * xpd xopt - * xphoon xopt - * xpipeman xopt - * xplot Graphics - * xpostit xopt - * xpr xopt - * xpr xreq - * xprompt xopt - * xproof xopt - * xprop xreq - * xpserv xopt - * xrdb xreq - * xrefresh xreq - * xrsh xopt - * xrubik xopt - * xrunclient xopt - * xscope xopt - * xscreensaver xopt - * xsession xopt - * xset xreq - * xsetroot xreq - * xshogi xshogi - * xstdcmap xreq - * xstr bsd44 - * xtalk xopt - * xterm xreq - * xterm_color xopt - * xtetris xopt - * xTeXcad.13 xopt - * xtiff xopt - * xtree xopt - * xtv xopt - * xwd xreq - * xwininfo xreq - * xwud xreq - - * yacc bsd44 - * yes Shellutils - * youbin xopt - * yow Emacs - - * zcat gzip - * zcmp gzip - * zdiff gzip - * zforce gzip - * zgrep gzip - * zmore gzip - * znew gzip - - * [ Shellutils - - - -Tapes -***** - -We offer Unix source code on tapes in `tar' format on these media: - - * 4mm DAT cartridges - - * 8mm Exabyte cartridges - - * Sun DC300XLP QIC-24 1/4in cartridges (readable on some other systems) - - * Hewlett-Packard 16-track DC600HC 1/4in cartridges - - * IBM RS/6000 QIC-150 1/4in cartridges (readable on some other systems) - - * 1600bpi 9-track 1/2in reel tape - -The contents of the reel and various cartridge tapes for Unix systems are the -same (except for the RS/6000 Emacs tape, which also has executables for -Emacs); only the media are different. For pricing information, see the *note -Free Software Foundation Order Form::.. Source code for the manuals and -reference cards is included (*note Documentation::.). - -Some of the files on the tapes may be compressed with `gzip' to make them -fit. Refer to the top-level `README' file at the beginning of each tape for -instructions on uncompressing them. `uncompress' and `unpack' *do not work*! - - - -Languages Tape - (VERSION NUMBERS NOT COMPLETELY UP TO DATE) --------------- - -This tape contains programming tools: compilers, interpreters, and related -programs (parsers, conversion programs, debuggers, etc.). - - * Binutils 2.5.2 - * Bison 1.22 - * C Library 1.09 - * DejaGnu 1.2 - * dld 3.2.3 - * ecc 1.2.1 - * f2c 1994.11.03 - * flex 2.4.7 - * Gawk 2.15.5 - * GCC/G++/Objective-C 2.7.0 - * GDB 4.13 - * gdbm 1.7.3 - * gmp 1.3.2 - * gperf 2.1a - * gzip 1.2.4 - * indent 1.9.1 - * libg++ 2.6.1 - * libobjects 0.1.0 - * Make 3.72.1 - * NIHCL 3.0 - * OBST 3.4 - * Octave 1.0 - * p2c 1.20 - * perl 4.036 - * perl 5.000 - * regex 0.12 - * rx 0.05 - * Smalltalk 1.1.1 - * Superopt 2.3 - * Texinfo 3.1 - * Tile Forth 2.1 - - - -Lisps and Emacs Tape - (VERSION NUMBERS NOT COMPLETELY UP TO DATE) --------------------- - -This tape has Common Lisp systems and libraries, GNU Emacs, assorted -extensions that work with GNU Emacs, and a few other important utilities. - - * Calc 2.02c - * CLISP 1994.10.26 - * Common Lisp 1.1 - * elib 0.06 - * Emacs 18.59 - * Emacs 19.29 - * GNU Emacs Lisp Reference Manaul, Ed. 2.3 - * gzip 1.2.4 - * Make 3.72.1 - * MULE 2.1 - * PCL 1993.03.18 - * Texinfo 3.1 - - - -Utilities Tape - (VERSION NUMBERS NOT COMPLETELY UP TO DATE) --------------- - -This tape consists mostly of smaller utilities and miscellaneous applications. - - * acm 4.6 - * Autoconf 1.11 - * Autoconf 2.1 - * BASH 1.14.2 - * bc 1.03 - * Chess 4.0.73 - * cpio 2.3 - * CVS 1.3 - * dc 0.2 - * Diffutils 2.7 - * doschk 1.1 - * ed 0.2 - * es 0.84 - * Fileutils 3.12 - * Findutils 4.1 - * finger 1.37 - * HylaFAX 2.2.2.1 - * Fontutils 0.6 - * Ghostscript 2.6.1 - * Ghostview 1.5 - * GNATS 3.2 - * GnuGo 1.1 - * gnuplot 3.5 - * Graphics 0.17 - * grep 2.0 - * Groff 1.09 - * gzip 1.2.4 - * hello 1.3 - * hp2xx 3.1.4 - * ispell 3.1.13 - * m4 1.3 - * Make 3.72.1 - * mkisofs 1.01 - * mm 1.07 - * mtools 2.0.7 - * Nethack 3.1.3 - * nvi 1.34 - * Oleo 1.6 - * patch 2.1 - * ptx 0.4 - * rc 1.4 - * RCS 5.6.0.1 - * recode 3.4 - * saoimage 1.08 - * screen 3.5.2 - * screen 3.6.0 - * sed 1.18 & 2.05 - * Sharutils 4.1 - * Shellutils 1.12 - * Shogi 1.2.02 - * tar 1.11.2 - * Termcap 1.2 - * Texinfo 3.1 - * Textutils 1.11 - * time 1.6 - * tput 1.0 - * UUCP 1.05 - * wdiff 0.04 - * xboard 3.1.1 - * xshogi 1.2.02 - * Ygl 2.9 - - - -Scheme Tape ------------ - -Scheme is a simplified, lexically-scoped dialect of Lisp. It was designed at -MIT and other universities to teach students the art of programming, and to -research new parallel programming constructs and compilation techniques. - -This tape now contains MIT Scheme 7.3, which conforms to the "Revised^4 -Report On the Algorithmic Language Scheme" (MIT AI Lab Memo 848b), for which -TeX source is included. It is written partly in C, but is presently hard to -bootstrap. Binaries that can be used to bootstrap Scheme are available for: - - * HP 9000 series 300, 400, 700 & 800 running HP-UX 7.0 or 8.0 - - * NeXT running NeXT OS 1.0 or 2.0 - - * Sun-3 or Sun-4 running SunOS 4.1 - - * DECstation 3100/5100 running Ultrix 4.0 - - * Sony NeWS-3250 running NEWS OS 5.01 - - * Vax running 4.3BSD - -If your system is not on this list and you don't enjoy the bootstrap -challenge, see the JACAL item in *Note GNU Software::. - - - -X11 Tapes ---------- - -The two X11 tapes contain Version 11, Release 6 of the X Window System. The -first tape contains all of the core software, documentation and some -contributed clients. We call this the "required" X tape since it is -necessary for running X or running GNU Emacs under X. The second, "optional" -tape contains contributed libraries and other toolkits, the Andrew User -Interface System, games, and other programs. - -The X11 Required tape also contains all fixes and patches released to date. -We update this tape as new fixes and patches are released for programs on -both tapes. *Note Tape & CD-ROM Subscription Service::. - -We will distribute X11R5 on tape until X11R6 is stable, and on the *Note -November 1993 Source Code CD-ROM::, while supplies last. - - - -Berkeley 4.4BSD-Lite Tape -------------------------- - -The "4.4BSD-Lite" release is the last from the Computer Systems Research -Group at the University of California at Berkeley. It has most of the BSD -software system, except for a few files that remain proprietary. It is much -more complete than the previous "Net2" release. - - - -VMS Emacs and VMS Compiler Tapes --------------------------------- - -We offer two VMS tapes. One has just GNU Emacs 18.59 (none of the other -software on the *Note Lisps/Emacs Tape::, is included). The other has GCC -2.3.3, Bison 1.19 (to compile GCC), GAS 1.38 (to assemble GCC's output) and -some library and include files (none of the other software on the *Note -Languages Tape::, is included). We are not aware of a GDB port for VMS. -Both VMS tapes have DEC VAX executables from which you can bootstrap, as the -DEC VMS C compiler cannot compile GCC. We do not have executables for DEC -Alpha VMS systems. Please do not ask us to devote effort to VMS support, -because it is peripheral to the GNU Project. - - - -CD-ROMs -******* - -We offer these CD-ROMs: - - * *Note MS-DOS CD-ROM::, expected in September 1995. - - * *Note Debian GNU/Linux CD-ROM::, expected in late fall 1995. - - * *Note Compiler Tools Binaries CD-ROM::. - - * *Note June 1995 Source Code CD-ROM::. - - * *Note May 1994 Source Code CD-ROM::. - - * *Note November 1993 Source Code CD-ROM::. - -Our CD-ROMs are in ISO 9660 format & can be mounted as a read-only file -system on most computers. If your driver supports it you can mount each -CD-ROM with "Rock Ridge" extensions (the MS-DOS CD-ROM is only in ISO 9660 -format) & it will look just like an ordinary Unix file system, rather than -one full of truncated & otherwise mangled names that fit vanilla ISO 9660. - -You can build most of the software without copying the sources off the CD. -You only need enough disk space for object files and intermediate build -targets. - - - -Pricing of the GNU CD-ROMs --------------------------- - -If a business or organization is ultimately paying, the June 1995 Source CD -costs $240. It costs $60 if you, an individual, are paying out of your own -pocket. The December 1994 Compiler Tools Binaries CD-ROM costs $220 for a -business or organization, and $55 for an individual. - - - -What do the individual and company prices mean? - -The software on our disk is free; anyone can copy it and anyone can run it. -What we charge for is the physical disk and the service of distribution. - -We charge two different prices depending on who is buying. When a company or -other organization buys the June 1995 Source CD-ROM, we charge $240. When an -individual buys the same disk, we charge just $60. - -This distinction is not a matter of who is allowed to use the software. In -either case, once you have a copy, you can distribute as many copies as you -wish, and there's no restriction on who can have or run them. The price -distinction is entirely a matter of what kind of entity pays for the CD. - -You, the reader, are certainly an individual, not a company. If you are -buying a disk "in person", then you are probably doing so as an individual. -But if you expect to be reimbursed by your employer, then the disk is really -for the company; so please pay the company price and get reimbursed for it. -We won't try to check up on you--we use the honor system--so please cooperate. - -Buying CDs at the company price is very helpful for GNU; just 140 Source CDs -at that price supports an FSF programmer or tech writer for a year. - - - -Why is there an individual price? - -In the past, our distribution tapes have been ordered mainly by companies. -The CD at the price of $240 provides them with all of our software for a much -lower price than they would previously have paid for six different tapes. To -lower the price more would cut into the FSF's funds very badly, and decrease -the software development we can do. - -However, for individuals, $240 is too high a price; hardly anyone could -afford that. So we decided to make CDs available to individuals at the lower -price of $60. - - - -Is there a maximum price? - -Our stated prices are minimum prices. Feel free to pay a higher price if you -wish to support GNU development more. The sky's the limit; we will accept as -high a price as you can offer. Or simply give a donation (tax-deductible in -the U.S.) to the Free Software Foundation, a tax-exempt public charity. - - - -MS-DOS CD-ROM -------------- - -We expect to release our first CD-ROM for MS-DOS in September, 1995. Contact -either address on page 1 for more information at that time. The MS-DOS CD -will be packaged inside a book describing its contents. It will have all the -sources and executables on the MS-DOS Diskettes. For details and version -numbers, *note MS-DOS Diskettes::.. - - - -Debian GNU/Linux CD-ROM ------------------------ - -The FSF expects to ship a CD-ROM with Debian GNU/Linux on it in the late fall -1995. This CD will be packaged inside a book describing its contents. -m{No Value For "ergegrafkludge"} Debian GNU/Linux is a complete operating -system for x86 machines, available in both source code and binary form. It -is a GNU/Linux system--that is to say, a variant GNU system which uses Linux -as the kernel. (All the systems now available which use the Linux kernel are -GNU/Linux systems.) - -Debian is being developed by Ian Murdock and the Debian Association in -conjunction with the Free Software Foundation. We are distributing it as an -interim measure until the GNU kernel (the Hurd) is ready for users. - -Debian GNU/Linux is available for FTP at `ftp.cps.cmich.edu' in file -`/pub/debian'. For more information about the Debian Project and how to get -involved, see `/pub/gnu/GNUinfo/DEBIAN' on a GNU FTP host (*note How to Get -GNU Software::. for a list). - - - -December 1994 Compiler Tools Binaries CD-ROM --------------------------------------------- - -We are now offering a CD-ROM that contains executables for GNU compiler tools -for some systems which lack a compiler. This enables the people who use -these systems to compile GNU and other free software without having to buy a -proprietary compiler. You can also use the GNU compilation system to compile -your own C/C++/Objective-C programs. - -We hope to have more systems on each update of this CD. If you can help -build binaries for new systems (especially those that don't come with a C -compiler), or have one to suggest, please contact us at the addresses on page -1. - -These packages: - - *DJGPP 1.12.m2 from GCC 2.6.0 - *GCC/G++/Objective-C 2.6.2 - *GNU C Library 1.09 - *GDB 4.13 - *Binutils 2.5.2 - *Bison 1.22 - *Emacs 19.26 (MS-DOS only) - *Flex 2.4.7 - *Make 3.72.1 - *libg++ 2.6.1 - -On these platforms: - - *`i386-msdos' - *`hppa1.1-hp-hpux9' - *`sparc-sun-solaris2' - *`sparc-sun-sunos4.1' - - - -Source Code CD-ROMs -------------------- - -We have several versions of our Source Code CD-ROMs available: - - * *Note June 1995 Source Code CD-ROM::. - - * *Note May 1994 Source Code CD-ROM::. - - * *Note November 1993 Source Code CD-ROM::. - -The older Source Code CDs will be available while supplies last at a reduced -price; see the *note Free Software Foundation Order Form::.. - -All of the Source Code CDs also contain Texinfo source for the GNU manuals -listed in *Note Documentation::. - -The VMS tapes' contents are *not* included. Many programs that are only on -MS-DOS diskettes and not on the tapes are also *not* included. The contents -of the MIT Scheme & X11 Optional tapes are *not* on the November 1993 & May -1994 Source CDs. *Note Tapes:: & *Note MS-DOS Diskettes::. - -There are no precompiled programs on these Source CDs. You will need a C -compiler (programs which need some other interpreter or compiler normally -provide the C source for a bootstrapping program). We ship C compiler -binaries for some systems on the *Note Compiler Tools Binaries CD-ROM::. - - - -June 1995 Source Code CD-ROM - (VERSION NUMBERS NOT COMPLETELY UP TO DATE) -............................ - -We now have the sixth edition of our Source CD. This CD has Edition X.X for -version 19 of the `GNU Emacs Lisp Reference Manual' & some additional -software; not all FSF distributed software is included (*note Source Code -CD-ROMs::.). It contains the following packages: - *XXXXX UPDATE THIS LIST XXXXX* - *acm 4.5 - *Autoconf 1.10 - *BASH 1.13.5 - *bc 1.02 - *Binutils 2.3 - *Bison 1.22 - *C Library 1.08 - *Calc 2.02c - *Chess 4.0.69 - *CLISP 1994.01.08 - *Common Lisp 1.0 - *cpio 2.3 - *CVS 1.3 - *dc 0.2 - *DejaGnu 1.2 - *Diffutils 2.6 - *dld 3.2.3 - *doschk 1.1 - *ecc 1.2.1 - *ed 0.1 - *elib 0.06 - *Emacs 18.59 - *Emacs 19.23 - *es 0.84 - *f2c 1994.04.14 - *Fileutils 3.9 - *find 3.8 - *finger 1.37 - *flex 2.4.6 - *Fontutils 0.6 - *GAS 1.36.utah - *GAS 2.2 - *Gawk 2.15.4 - *GCC 2.5.8 - *GDB 4.12 - *gdbm 1.7.1 - *Ghostscript 2.6.1 - *Ghostview 1.5 - *Ghostview for Windows 1.0 - *gmp 1.3.2 - *GNATS 3.2 - *GnuGo 1.1 - *gnuplot 3.5 - *gperf 2.1a - *Graphics 0.17 - *grep 2.0 - *Groff 1.09 - *gzip 1.2.4 - *hello 1.3 - *hp2xx 3.1.4 - *indent 1.9.1 - *ispell 4.0 - *libg++ 2.5.3 - *m4 1.1 - *Make 3.71 - *MandelSpawn 0.07 - *mtools 2.0.7 - *MULE 1.0 - *NetFax 3.2.1 - *Nethack 3.1.3 - *NIHCL 3.0 - *nvi 1.11 - *Octave 1.0 - *Oleo 1.5 - *p2c 1.20 - *patch 2.1 - *PCL 1993.03.18 - *perl 4.036 - *ptx 0.3 - *rc 1.4 - *RCS 5.6.0.1 - *recode 3.3 - *regex 0.12 - *screen 3.5.2 - *sed 2.05 - *shellutils 1.9.4 - *Shogi 1.1.02 - *Smalltalk 1.1.1 - *Superopt 2.3 - *tar 1.11.2 - *Termcap 1.2 - *TeX 3.1 - *Texinfo 3.1 - *Textutils 1.9.1 - *Tile Forth 2.1 - *time 1.6 - *tput 1.0 - *UUCP 1.05 - *uuencode 1.0 - *wdiff 0.04 - *X11R6 - *xboard 3.0.9 - *xshogi 1.2.02 - - - -May 1994 Source Code CD-ROM -........................... - -We still have the fourth edition of our Source CD, at a reduced price. This -CD has Edition 2.3 for version 19 of the `GNU Emacs Lisp Reference Manual' & -some additional software; not all FSF distributed software is included (*note -Source Code CD-ROMs::.). It contains these packages: - *acm 4.5 - *Autoconf 1.10 - *BASH 1.13.5 - *bc 1.02 - *Binutils 2.3 - *Bison 1.22 - *C Library 1.08 - *Calc 2.02c - *Chess 4.0.69 - *CLISP 1994.01.08 - *Common Lisp 1.0 - *cpio 2.3 - *CVS 1.3 - *dc 0.2 - *DejaGnu 1.2 - *Diffutils 2.6 - *dld 3.2.3 - *doschk 1.1 - *ecc 1.2.1 - *ed 0.1 - *elib 0.06 - *Emacs 18.59 - *Emacs 19.23 - *es 0.84 - *f2c 1994.04.14 - *Fileutils 3.9 - *find 3.8 - *finger 1.37 - *flex 2.4.6 - *Fontutils 0.6 - *GAS 1.36.utah - *GAS 2.2 - *Gawk 2.15.4 - *GCC 2.5.8 - *GDB 4.12 - *gdbm 1.7.1 - *Ghostscript 2.6.1 - *Ghostview 1.5 - *Ghostview for Windows 1.0 - *gmp 1.3.2 - *GNATS 3.2 - *GnuGo 1.1 - *gnuplot 3.5 - *gperf 2.1a - *Graphics 0.17 - *grep 2.0 - *Groff 1.09 - *gzip 1.2.4 - *hello 1.3 - *hp2xx 3.1.4 - *indent 1.9.1 - *ispell 4.0 - *libg++ 2.5.3 - *m4 1.1 - *Make 3.71 - *MandelSpawn 0.07 - *mtools 2.0.7 - *MULE 1.0 - *NetFax 3.2.1 - *Nethack 3.1.3 - *NIHCL 3.0 - *nvi 1.11 - *Octave 1.0 - *Oleo 1.5 - *p2c 1.20 - *patch 2.1 - *PCL 1993.03.18 - *perl 4.036 - *ptx 0.3 - *rc 1.4 - *RCS 5.6.0.1 - *recode 3.3 - *regex 0.12 - *screen 3.5.2 - *sed 2.05 - *shellutils 1.9.4 - *Shogi 1.1.02 - *Smalltalk 1.1.1 - *Superopt 2.3 - *tar 1.11.2 - *Termcap 1.2 - *TeX 3.1 - *Texinfo 3.1 - *Textutils 1.9.1 - *Tile Forth 2.1 - *time 1.6 - *tput 1.0 - *UUCP 1.05 - *uuencode 1.0 - *wdiff 0.04 - *X11R6 - *xboard 3.0.9 - *xshogi 1.2.02 - - - -November 1993 Source Code CD-ROM -................................ - -We still have the third edition of our Source CD, at a reduced price. It -contains X11R5, as we feel that people should have a choice between X11R5 and -X11R6 until the latter is stable. This CD has Edition 2.2 for version 19 of -the `GNU Emacs Lisp Reference Manual' & some additional software; not all FSF -distributed software is included (*note Source Code CD-ROMs::.). It contains -the following packages: - *acm 3.1 - *Autoconf 1.7 - *BASH 1.13.4 - *bc 1.02 - *Binutils 1.9 2.3 - *Bison 1.22 - *C Library 1.06.7 - *Calc 2.02b - *Chess 4.0p62 - *CLISP 93.11.08 - *cpio 2.3 - *CVS 1.3 - *dc 0.2 - *DejaGnu 1.0.1 - *Diffutils 2.6 - *dld 3.2.3 - *doschk 1.1 - *ecc 1.2.1 - *elib 0.06 - *Emacs 18.59 - *Emacs 19.21 - *es 0.84 - *f2c 1993.04.28 - *Fileutils 3.9 - *find 3.8 - *finger 1.37 - *flex 2.3.8 - *Fontutils 0.6 - *GAS 1.36.utah - *GAS 1.38.1 - *GAS 2.2 - *Gawk 2.15.3 - *GCC 2.5.4 - *GDB 4.11 - *gdbm 1.7.1 - *Ghostscript 2.6.1 - *Ghostview 1.5 - *Ghostview for Windows 1.0 - *gmp 1.3.2 - *GNATS 3.01 - *GnuGo 1.1 - *gnuplot 3.5 - *gperf 2.1a - *Graphics 0.17 - *grep 2.0 - *Groff 1.08 - *gzip 1.2.4 - *hello 1.3 - *hp2xx 3.1.3a - *indent 1.8 - *Ispell 4.0 - *less 177 - *libg++ 2.5.1 - *m4 1.1 - *Make 3.69.1 - *MandelSpawn 0.06 - *mtools 2.0.7 - *MULE 1.0 - *NetFax 3.2.1 - *Nethack 3.1.3 - *NIHCL 3.0 - *Oleo 1.5 - *p2c 1.20 - *patch 2.1 - *PCL 93.03.18 - *perl 4.036 - *ptx 0.3 - *rc 1.4 - *RCS 5.6.0.1 - *recode 3.2.4 - *regex 0.12 - *screen 3.5.2 - *sed 1.18 2.03 - *Shellutils 1.9.1 - *Shogi 1.1p02 - *Smalltalk 1.1.1 - *Superopt 2.3 - *tar 1.11.2 - *Termcap 1.2 - *TeX 3.1 - *Texinfo 3.1 - *Tile Forth 2.1 - *time 1.6 - *time 1.6 - *tput 1.0 - *UUCP 1.04 - *uuencode 1.0 - *wdiff 0.04 - *X11R5 - - - - -MS-DOS Diskettes -**************** - -The FSF distributes some of the GNU software ported to MS-DOS, on 3.5inch -1.44MB diskettes. These disks have both sources and executables. - - - -DJGPP Diskettes - (VERSION NUMBERS NOT COMPLETELY UP TO DATE) ---------------- - -We offer DJGPP on 30 diskettes. For further details, see *Note GNU -Software::. The DJGPP diskettes contain the following: - - * bc 1.03 - * Binutils 2.4 - * Bison 1.22 - * cpio 2.3 - * Diffutils 2.6 - * doschk 1.1 - * Fileutils 3.9 - * Findutils 3.8 - * GAS 2.4 - * Gawk 2.15.5 - * GCC 2.6.0 - * GDB 4.12 - * Ghostscript 2.6.1 - * Ghostview for Windows 1.0 - * Groff 1.09 - * gzip 1.24 - * hello 1.3 - * indent 1.9 - * ispell 4.0 - * m4 1.2 - * Make 3.71 - * patch 2.1 - * sed 1.18 - * shellutils 1.9 - * Texinfo 3.1 - * texutils 1.9 - * wdiff 0.04 - - - -Emacs Diskettes - (VERSION NUMBERS NOT COMPLETELY UP TO DATE) ---------------- - -Two versions of GNU Emacs are included on the Emacs diskettes we distribute: -GNU Emacs version 19.29 handles 8-bit character sets; the other, MULE version -2.1, handles 16-bit character sets including Kanji. - - - -Selected Utilities Diskettes - (NOT COMPLETELY UP TO DATE) ----------------------------- - -The GNUish MS-DOS Project ported GNU software to PC compatibles. Though the -GNUish Project is no longer active, users still ask for these ports that were -done several years ago. You can anonymous FTP files -`/pub/gnu/MicrosPorts/MSDOS*' from `prep.ai.mit.edu' to find out how to -access these ports over the Internet. We offer these programs on five -diskettes. In general, this software will run on 8086 and 80286-based 16-bit -machines; an 80386 is not required. Some of these utilities are necessarily -missing features. Included are: `cpio', `diff', `find', `flex', `gdbm', -`grep', `indent', `less', `m4', `make', `ptx', RCS, `sed', `shar', `sort', & -Texinfo. - - - -Windows Diskette ----------------- - -We offer GNU Chess and `gnuplot' for Microsoft Windows on a single diskette. - - - -Tape & CD-ROM Subscription Service -********************************** - -If you do not have net access, our subscription service enables you to stay -current with the latest GNU developments. For a one-time cost equivalent to -three tapes or CD-ROMs (plus shipping in some cases), we will ship you four -new versions of the tape of your choice or the Source Code CD-ROM. The tapes -are sent each quarter; the CD-ROMs are sent as they are issued (which is -between two and four times a year.) - -Regularly, we will send you a new version of an Lisps/Emacs, Languages, -Utilities, or X Window System (X11R6) Required tape or the Source CD-ROM. -The MIT Scheme and X Window System Optional tapes are not changed often -enough to warrant quarterly updates. We do not yet know if we will be -offering subscriptions to the Compiler Tools Binaries or our new CD-ROMs. - -Since Emacs 19 is on the Lisps/Emacs Tape and the Source CD-ROM, a -subscription to either is an easy way to keep current with Emacs 19 as it -evolves. - -A subscription is an easy way to keep up with the regular bug fixes to the X -Window System. We update the X11R6 Required tape as fixes and patches are -issued throughout the year. Each new edition of the *Note Source Code -CD-ROMs::, also has updated sources for the X Window System. - -Please note: In two cases, you must pay 4 times the normal shipping required -for a single order when you pay for each subscription. If you're in Alaska, -Hawaii, or Puerto Rico you must add $20.00 for shipping for each -subscription. If you're outside of U.S., Canada, and Puerto Rico, you have -to add $80.00 for each subscription. See "Unix and VMS Software" & "Shipping -Instructions" on the *note Free Software Foundation Order Form::.. - - - -The Deluxe Distribution -*********************** - -The Free Software Foundation has been asked repeatedly to create a package -that provides executables for all of our software. Normally we offer only -sources. In addition to providing binaries with the source code, the Deluxe -Distribution includes a complete set of our printed manuals and reference -cards. - -The FSF Deluxe Distribution contains the binaries and sources to hundreds of -different programs including GNU Emacs, the GNU C Compiler, the GNU Debugger, -the complete X Window System, and all the GNU utilities. - -We will make a Deluxe Distribution for any machine, with any operating -system. We will send someone to your office to do the compilation, if we -can't find a suitable machine close to us! However, we can only compile the -programs that already support your chosen machine and system - porting is a -separate matter (if you wish to commission a port, see the GNU Service -Directory, details in *Note Free Software Support::). Compiling all these -programs take time; a Deluxe Distribution for an unusual machine will take -longer to produce then one for a common machine. Please contact the FSF -office if you have any questions. - -We supply the software in one of these tape formats in Unix `tar' format: -1600 or 6250bpi 1/2in reel, Sun DC300XLP 1/4in cartridge - QIC24, -Hewlett-Packard 16-track DC600HC 1/4in cartridge, IBM RS/6000 1/4in cartridge -- QIC 150, Exabyte 8mm cartridge, or DAT 4mm cartridge. If your computer -cannot read any of these, please contact us to see if we can handle your -format. - -The manuals included are one each of the `Bison', `Calc', `Gawk', `GNU C -Compiler', `GNU C Library', `GDB', `Flex', `GNU Emacs Lisp Reference', -`Programming in Emacs Lisp: An Introduction', `Make', `Texinfo', & `Termcap' -manuals; six copies of the `GNU Emacs' manual; and a packet of ten reference -cards each for GNU Emacs, Bison, Calc, Flex, & GDB. Every Deluxe -Distribution also includes a copy of the latest editions of our CD-ROMs -(including the MS-DOS CD & the Debian GNU/Linux CD when they are available) -that contain sources of our software & compiler tool binaries for some -systems. The MS-DOS CD is in ISO 9660 format. The other CDs are in ISO 9660 -format with Rock Ridge extensions. - -The price of the Deluxe Distribution is $5000 (shipping included). These -sales provide enormous financial assistance to help the FSF develop more free -software. To order, please fill out the "Deluxe Distribution" section on the -*note Free Software Foundation Order Form::. and send it to: - - Free Software Foundation, Inc. - 59 Temple Place -- Suite 330 - Boston, MA 02111--1307 - USA - - Telephone: +1-617-542-5942 - Fax (including Japan): +1-617-542-2652 - Free Dial Fax (in Japan): - 0031-13-2473 (KDD) - 0066-3382-0158 (IDC) - Electronic mail: gnu@prep.ai.mit.edu - - - -FSF T-shirt -*********** - -Our latest T-shirt has artwork by Berkeley, CA artist Etienne Suvasa. The -front has the ever-popular picture of GNArnold from the `Flex Manual', while -the back has the Preamble to the GNU General Public License. - -They are available in two colors, Natural & Black. Natural is an off-white, -unbleached, undyed, environment-friendly cotton, printed with black ink, & is -great for tye-dyeing or displaying as is. Black is printed with white ink & -is perfect for late night hacking. All shirts are thick 100% cotton, & are -available in sizes M, L, XL & XXL. This shirt makes a great gift for your -favorite hacker! - -The previous version of the T-shirt will be available while supplies last, -but please contact the FSF to see if we have what you would like before -ordering. - - - -Free Software Foundation Order Form -*********************************** - -All items are distributed with permission to copy and to redistribute. -Texinfo source for each manual and source for each reference card is on -the appropriate tape, diskette, or CD-ROM; the prices for these magnetic -media do not include printed documentation. All items are provided on -an ``as is'' basis, with no warranty of any kind. Please allow six -weeks for delivery (though it won't usually take that long). - - - PRICE AND CONTENTS MAY CHANGE WITHOUT NOTICE AFTER January 31, 1996. - - - -Unix and VMS Software ---------------------- - -These tapes in the formats indicated (*note Tapes::., for contents): - - Please circle the dollar amount for each tape you order. - - Reel to Sun (1) HP IBM (2) Exabyte DAT - reel RS/6000 - Unix tar Unix tar Unix tar Unix tar Unix tar Unix tar - 9-track QIC-24 16-track QIC-150 - 1600 bpi DC300XLP DC600HC DC600A - 1/2" reel 1/4" c.t. 1/4" c.t. 1/4" c.t. 8mm c.t. 4mm c.t. - - (c.t. = cartridge tape) - -Lisps/Emacs $200 $210 $230 $215 (3) $205 $225 -Languages $200 $210 $230 $215 $205 $225 -Utilities $200 $210 $230 $215 $205 $225 -4.4BSD-Lite $200 $210 $230 $215 $205 $225 -Scheme $200 $210 $230 $215 $205 $225 -X11R5-Required $200 $210 $230 $215 $205 $225 -X11R5-Optional $200 $210 $230 $215 $205 $225 -X11R6-Required $200 $210 $230 $215 $205 $225 -X11R6-Optional $200 $210 $230 $215 $205 $225 - - (1) Sun tapes can be read on some other Unix systems. - (2) IBM RS/6000 tapes can be read on some other Unix systems. - (3) The IBM Emacs tape also has binaries for GNU Emacs. - - -Subscriptions, 4 updates for one year (*note Tape & CD-ROM Subscription Service::.): - -Emacs $600 $630 $690 $645 $615 $675 -Languages $600 $630 $690 $645 $615 $675 -Utilities $600 $630 $690 $645 $615 $675 -X11R6-Required $600 $630 $690 $645 $615 $675 - - Subtotal $ ______ Please put total of the above circled amounts here. - - -These 1600 bpi reel-to-reel 9 track 1/2" tapes, in VMS BACKUP format (aka -interchange format) (*note VMS Emacs and VMS Compiler Tapes::.): - -____ @ $195 = $ ______ VMS Emacs, GNU Emacs source & executables only. - -____ @ $195 = $ ______ VMS Compiler, GCC, GAS, and Bison source and - executables only. - - -FSF Deluxe Distribution (*note Deluxe Distribution::.): -...................................................... - - -____ @ $5000 = $ ______ The Deluxe Distribution, with manuals, etc. - -Machine: _____________________________________________________________________ - -Operating system: ____________________________________________________________ - -Media type: __________________________________________________________________ - - - -CD-ROMs, in ISO 9660 format (*note CD-ROMs::.): -.............................................. - - -GNU Source Code CD-ROM, Version 6 with X11R6 (*note June 1995 Source Code CD-ROM::.): - -____ @ $240 = $ ______ for corporations and other organizations. - -____ @ $ 60 = $ ______ for individuals. - - - -GNU Compiler Tools Binaries CD-ROM, Version 2, December 1994 Edition -(*note Compiler Tools Binaries CD-ROM::.): - -____ @ $220 = $ ______ for corporations and other organizations. - -____ @ $55 = $ ______ for individuals. - - - -Debian GNU/Linux Book with CD-ROM - expected late fall 1995 (*note Debian GNU/Linux CD-ROM::.): - -____ @ $200 = $ ______ for corporations and other organizations. - -____ @ $50 = $ ______ for individuals. - - -Subscriptions, next 4 updates, of the Source Code CD-ROM, in ISO 9660 format -(*note Tape & CD-ROM Subscription Service::.): - -____ @ $720 = $ ______ for corporations and other organizations. - -____ @ $180 = $ ______ for individuals. - - - -MS-DOS Software ---------------- - -MS-DOS Book with CD-ROM - expected September 1995 (*note MS-DOS CD-ROM::.): - -____ @ $180 = $ ______ for corporations and other organizations. - -____ @ $45 = $ ______ for individuals. - - - -The following sources and executables for MS-DOS, on 3.5" 1.44MB diskettes -(*note MS-DOS Diskettes::.): - -____ @ $ 90 = $ ______ Emacs diskettes, GNU Emacs, for 80386 and up. - -____ @ $ 80 = $ ______ DJGPP diskettes, GCC version 2, for 80386 and up - (also on the *note Compiler Tools Binaries CD-ROM::. and *note MS-DOS CD-ROM::..) -____ @ $ 85 = $ ______ Selected Utilities diskettes, 8086 and up. - -____ @ $ 40 = $ ______ Windows diskette, GNU Chess and gnuplot for - Microsoft Windows. - - -Manuals -------- - -These manuals (*note Documentation::.). Please call for bulk purchase -discounts. - -____ @ $300 = $ ______ One copy each of the following 13 manuals. - -____ @ $ 25 = $ ______ GNU Emacs version manual, with a reference card. - -____ @ $ 50 = $ ______ GNU Emacs Lisp Reference manual, in two volumes. - -____ @ $ 50 = $ ______ Using and Porting GNU CC. - -____ @ $ 50 = $ ______ GNU C Library Reference Manual. - -____ @ $ 50 = $ ______ GNU Emacs Calc manual, with a reference card. - -____ @ $ 20 = $ ______ Programming in Emacs Lisp, An Introduction - -____ @ $ 20 = $ ______ Debugging with GDB, with a reference card. - -____ @ $ 20 = $ ______ Gawk manual. - -____ @ $ 20 = $ ______ Make manual. - -____ @ $ 20 = $ ______ Bison manual, with a reference card. - -____ @ $ 20 = $ ______ Flex manual, with a reference card. - -____ @ $ 20 = $ ______ Texinfo manual. - -____ @ $ 15 = $ ______ Termcap manual. - - - -Reference Cards ---------------- - -The following reference cards, in packets of ten. For single copies please -call. - -____ @ $ 10 = $ ______ GNU Emacs version 19 reference cards. - -____ @ $ 10 = $ ______ GNU Emacs Calc reference cards. - -____ @ $ 10 = $ ______ GDB reference cards. - -____ @ $ 10 = $ ______ Bison reference cards. - -____ @ $ 10 = $ ______ Flex reference cards. - - - -T-shirts --------- - -GNU/FSF T-shirts, thick 100% cotton (*note FSF T-shirt::.): - -____ @ $ 15 = $ ______ Size M ____ natural ____ black. - -____ @ $ 15 = $ ______ Size L ____ natural ____ black. - -____ @ $ 15 = $ ______ Size XL ____ natural ____ black. - -____ @ $ 15 = $ ______ Size XXL ____ natural ____ black. - - - -Older Items ------------ - -Older items are only available while supplies last. - -____ @ $ 5 = $ ______ GNU Emacs version 18 reference cards, in packets - of ten. - -Please fill in the number of each older CD-ROM you order: - - for for - corporations individuals: - and other - organizations: - -GNU Compiler Tools Binaries CD-ROM - December 1993 Edition (Version 1) ____________ ____________ - - -GNU Source Code CD-ROM - May 1994 edition with X11R6 ____________ ____________ - -GNU Source Code CD-ROM - November 1993 edition with X11R5 ____________ ____________ - -GNU Source Code CD-ROM - May 1993 edition with X11R5 ____________ ____________ - -GNU Source Code CD-ROM - October 1992 edition with X11R5 ____________ ____________ - - -Please put the total count and cost of the above older CD-ROMs here: - -____ @ $ 80 = $ ______ for corporations and other organizations. - -____ @ $ 20 = $ ______ for individuals. - - ====== - - Subtotal $ ______ - - - -Tax and Shipping Costs ----------------------- - - + $ ______ In Massachusetts: add 5% sales tax, or give tax - exempt number. - + $ ______ In Alaska, Hawaii, or Puerto Rico for shipping: - for GNU Emacs Lisp Reference and GNU Emacs Calc - manuals, add $5 *each*. For *each* tape or - CD-ROM subscription, add $20. For all other - items, add $5 base charge, then $1 per item except - reference cards; i.e., - shipping for all other items = $5 + ($1 * i). - + $ ______ Outside of U.S., Canada, and Puerto Rico for - shipping: Add $20 base charge; then add $80 more - for *each* tape or CD-ROM subscription; and then - add $10 more for *each* manual in the order; - i.e., shipping for all other items - = $20 + ($80 * s) + ($10 * m). - + $ ______ Optional (tax-deductible in the U.S.) donation. - ------ We suggest 5% if paying by credit card. - - TOTAL $ ______ We pay for shipping via UPS ground transportation in - the contiguous 48 states and Canada. For very - large orders, ask about actual shipping costs for - that order. - - - -Shipping Information --------------------- - -Name: ________________________________________________________________________ - -Mail Stop/Dept. Name: ________________________________________________________ - -Organization: ________________________________________________________________ - -Street Address: ______________________________________________________________ - -City/State/Province: _________________________________________________________ - -Zip Code/Postal Code/Country: ________________________________________________ - -Telephone number in case of a problem with your order. -For international orders, please include a FAX number. _______________________ - - ------------------------------------------------------------------------------- -| | -| Orders filled only upon receipt of check, money order or credit card | -| order in U.S. dollars. Unpaid orders will be returned to the sender. | -| We do not have the staff to handle the billing of unpaid orders. Please | -| help keep our lives simple by including your payment with your order. | -| | ------------------------------------------------------------------------------- - - -For orders from outside the U.S.: ---------------------------------- - -You are responsible for paying all duties, tariffs, and taxes. If you -refuse to pay the charges, the shipper will return or abandon the order. - - - --------------------------------------------------------------------------- - | | - | Please make checks payable to the ``Free Software Foundation''. | - | | - --------------------------------------------------------------------------- - - -For Credit Card Orders: ------------------------ - -The Free Software Foundation takes these credit cards: Carte Blanche, -Diner's Club, JCB, Mastercard, Visa, or American Express. Please note that -we are charged about 5% of an order's total amount in credit card -processing fees. Please consider paying by check instead, or adding on a -5% donation to make up the difference. To place a credit card order, -please give us this information: - - -Card type: ___________________________________________________________________ - -Account Number: ______________________________________________________________ - -Expiration Date: _____________________________________________________________ - -Cardholder's Signature: ______________________________________________________ - - - ------------------------------------------------------------------------------- -| | -| If you wish to pay by wire transfer, or you are a reseller, please | -| call or write us for details. | -| | ------------------------------------------------------------------------------- - - - Please mail orders to: Free Software Foundation - 59 Temple Place -- Suite 330 - Boston, MA 02111 - +1-617-542-5942 - FAX (including Japan): +1-617-542-2652 - Free Dial FAX numbers in Japan: -PRICES AND CONTENTS MAY CHANGE 0031-13-2473 (KDD) -WITHOUT NOTICE AFTER January 31, 1996. 0066-3382-0158 (IDC) - -Version: June 1995 ASCII Bull to June 1995 Src CD/GNU 19.29/GCC 2.7.0 - ---------------------------------------------------------------------- -local variables: -mode: text -fill-column: 78 -end: diff --git a/contrib/gcc/PROBLEMS b/contrib/gcc/PROBLEMS deleted file mode 100644 index bc532e641a8d..000000000000 --- a/contrib/gcc/PROBLEMS +++ /dev/null @@ -1,117 +0,0 @@ -3. When find_reloads is used to count number of spills needed -it does not take into account the fact that a reload may -turn out to be a dummy. - -I'm not sure this really happens any more. Doesn't it find -all the dummies on both passes? - -10. movl a3@,a0 - movl a3@(16),a1 - clrb a0@(a1:l) -is generated and may be worse than - movl a3@,a0 - addl a3@(16),a0 - clrb a0@ -If ordering of operands is improved, many more -such cases will be generated from typical array accesses. - -38. Hack expand_mult so that if there is no same-modes multiply -it will use a widening multiply and then truncate rather than -calling the library. - -39. Hack expanding of division to notice cases for -long -> short division. - -40. Represent divide insns as (DIV:SI ...) followed by -a separate lowpart extract. Represent remainder insns as DIV:SI -followed by a separate highpart extract. Then cse can work on -the DIV:SI part. Problem is, this may not be desirable on machines -where computing the quotient alone does not necessarily give -a remainder--such as the 68020 for long operands. - -52. Reloading can look at how reload_contents got set up. -If it was copied from a register, just reload from that register. -Otherwise, perhaps can change the previous insn to move the -data via the reload reg, thus avoiding one memory ref. - -63. Potential problem in cc_status.value2, if it ever activates itself -after a two-address subtraction (which currently cannot happen). -It is supposed to compare the current value of the destination -but eliminating it would use the results of the subtraction, equivalent -to comparing the previous value of the destination. - -65. Should loops that neither start nor end with a break -be rearranged to end with the last break? - -69. Define the floating point converting arithmetic instructions -for the 68881. - -74. Combine loop opt with cse opt in one pass. Do cse on each loop, -then loop opt on that loop, and go from innermost loops outward. -Make loop invariants available for cse at end of loop. - -85. pea can force a value to be reloaded into an areg -which can make it worse than separate adding and pushing. -This can only happen for adding something within addql range -and it only loses if the qty becomes dead at that point -so it can be added to with no copying. - -93. If a pseudo doesn't get a hard reg everywhere, -can it get one during a loop? - -96. Can do SImode bitfield insns without reloading, but must -alter the operands in special ways. - -99. final could check loop-entry branches to see if they -screw up deletion of a test instruction. If they do, -can put another test instruction before the branch and -make it conditional and redirect it. - -106. Aliasing may be impossible if data types of refs differ -and data type of containing objects also differ. -(But check this wrt unions.) - -108. Can speed up flow analysis by making a table saying which -register is set and which registers are used by each instruction that -only sets one register and only uses two. This way avoid the tree -walk for such instructions (most instructions). - -109. It is desirable to avoid converting INDEX to SImode if a -narrower mode suffices, as HImode does on the 68000. -How can this be done? - -110. Possible special combination pattern: -If the two operands to a comparison die there and both come from insns -that are identical except for replacing one operand with the other, -throw away those insns. Ok if insns being discarded are known 1 to 1. -An andl #1 after a seq is 1 to 1, but how should compiler know that? - -112. Can convert float to unsigned int by subtracting a constant, -converting to signed int, and changing the sign bit. - -117. Any number of slow zero-extensions in one loop, that have -their clr insns moved out of the loop, can share one register -if their original life spans are disjoint. -But it may be hard to be sure of this since -the life span data that regscan produces may be hard to interpret -validly or may be incorrect after cse. - -118. In cse, when a bfext insn refers to a register, if the field -corresponds to a halfword or a byte and the register is equivalent -to a memory location, it would be possible to detect this and -replace it with a simple memory reference. - -121. Insns that store two values cannot be moved out of loops. -The code in scan_loop doesn't even try to deal with them. - -122. When insn-output.c turns a bit-test into a sign-test, -it should see whether the cc is already set up with that sign. - -123. When a conditional expression is used as a function arg, it would -be faster (and in some cases shorter) to push each alternative rather -than compute in a register and push that. This would require -being able to specify "push this" as a target for expand_expr. - -124. On the 386, bad code results from foo (bar ()) when bar -returns a double, because the pseudo used fails to get preferenced -into an fp reg because of the distinction between regs 8 and 9. diff --git a/contrib/gcc/PROJECTS b/contrib/gcc/PROJECTS deleted file mode 100644 index 2c2111a2a6e3..000000000000 --- a/contrib/gcc/PROJECTS +++ /dev/null @@ -1,449 +0,0 @@ -C++ template friend functions (mmitchell@usa.net) - -Haifa scheduler (haifa-sched.c, loop.[ch], unroll.[ch], genattrtab.c): -(contact law@cygnus.com before starting any serious haifa work) - - * Fix all the formatting problems. Simple, mindless work. - - * Fix/add comments throughout the code. Many of the comments are from - the old scheduler and are out of date and misleading. Many new hunks - of code don't have sufficient comments and documentation. Those which - do have comments need to be rewritten to use complete sentences and - proper formatting. - - * Someone needs make one (or more) passes over the scheduler as a whole to - just clean it up. Try to move the machine dependent bits into the target - files where they belong, avoid re-creating functions where or near - equivalents already exist (ie is_conditional_branch and friends), etc., etc. - - * Document the new scheduling options. Remove those options which are - not really useful (like reverse scheduling for example). In general - the haifa scheduler adds _way_ too many options. I'm definitely of the - opinion that gcc already has too many -foptions, and haifa doesn't help - that situation. - - * Testing and benchmarking. We've converted a few ports to using the - Haifa scheduler (hppa, sparc, ppc, alpha). We need to continue testing - and benchmarking the new scheduler on additional targets. - - We need to have some kind of docs for how to best describe a machine to - the haifa scheduler to get good performance. Some existing ports have - been tuned to deal with the old scheduler -- they may need to be tuned - to generate good schedules with haifa. - - - -Improvements to global cse and partial redundancy elimination: - -The current implementation of global cse uses partial redundancy elimination -as described in Chow's thesis. - -Long term we want to use lazy code motion as the basis for partial redundancy -elimination. lcm will find as many (or more) redunancies *and* it will -place the remaining computations at computationally optimal placement points -within the function. This reduces the number of redundant operations performed -as well as reducing register lifetimes. My experiments have shown that the -cases were the current PRE code hurts performance are greatly helped by using -lazy code motion. - -lcm also provides the underlying framework for several additional optimizations -such as shrink wrapping, spill code motion, dead store elimination, and generic -load/store motion (all the other examples are subcases of load/store motion). - -It can probably also be used to improve the reg-stack pass of the compiler. - -Contact law@cygnus.com if you're interested in working on lazy code motion. - -------------- - -The old PROJECTS file. Stuff I know has been done has been deleted. -Stuff in progress has a contact name associated with it. -has been - -1. Better optimization. - -* Constants in unused inline functions - -It would be nice to delay output of string constants so that string -constants mentioned in unused inline functions are never generated. -Perhaps this would also take care of string constants in dead code. - -The difficulty is in finding a clean way for the RTL which refers -to the constant (currently, only by an assembler symbol name) -to point to the constant and cause it to be output. - -* Optimize a sequence of if statements whose conditions are exclusive. - -It is possible to optimize - - if (x == 1) ...; - if (x == 2) ...; - if (x == 3) ...; - -into - - if (x == 1) ...; - else if (x == 2) ...; - else if (x == 3) ...; - -provided that x is not altered by the contents of the if statements. - -It's not certain whether this is worth doing. Perhaps programmers -nearly always write the else's themselves, leaving few opportunities -to improve anything. - -* Un-cse. - -Perhaps we should have an un-cse step right after cse, which tries to -replace a reg with its value if the value can be substituted for the -reg everywhere, if that looks like an improvement. Which is if the -reg is used only a few times. Use rtx_cost to determine if the -change is really an improvement. - -* Clean up how cse works. - -The scheme is that each value has just one hash entry. The -first_same_value and next_same_value chains are no longer needed. - -For arithmetic, each hash table elt has the following slots: - -* Operation. This is an rtx code. -* Mode. -* Operands 0, 1 and 2. These point to other hash table elements. - -So, if we want to enter (PLUS:SI (REG:SI 30) (CONST_INT 104)), we -first enter (CONST_INT 104) and find the entry that (REG:SI 30) now -points to. Then we put these elts into operands 0 and 1 of a new elt. -We put PLUS and SI into the new elt. - -Registers and mem refs would never be entered into the table as such. -However, the values they contain would be entered. There would be a -table indexed by regno which points at the hash entry for the value in -that reg. - -The hash entry index now plays the role of a qty number. -We still need qty_first_reg, reg_next_eqv, etc. to record which regs -share a particular qty. - -When a reg is used whose contents are unknown, we need to create a -hash table entry whose contents say "unknown", as a place holder for -whatever the reg contains. If that reg is added to something, then -the hash entry for the sum will refer to the "unknown" entry. Use -UNKNOWN for the rtx code in this entry. This replaces make_new_qty. - -For a constant, a unique hash entry would be made based on the -value of the constant. - -What about MEM? Each time a memory address is referenced, we need a -qty (a hash table elt) to represent what is in it. (Just as for a -register.) If this isn't known, create one, just as for a reg whose -contents are unknown. - -We need a way to find all mem refs that still contain a certain value. -Do this with a chain of hash elts (for memory addresses) that point to -locations that hold the value. The hash elt for the value itself should -point to the start of the chain. It would be good for the hash elt -for an address to point to the hash elt for the contents of that address -(but this ptr can be null if the contents have never been entered). - -With this data structure, nothing need ever be invalidated except -the lists of which regs or mems hold a particular value. It is easy -to see if there is a reg or mem that is equiv to a particular value. -If the value is constant, it is always explicitly constant. - -* Support more general tail-recursion among different functions. - -This might be possible under certain circumstances, such as when -the argument lists of the functions have the same lengths. -Perhaps it could be done with a special declaration. - -You would need to verify in the calling function that it does not -use the addresses of any local variables and does not use setjmp. - -* Put short statics vars at low addresses and use short addressing mode? - -Useful on the 68000/68020 and perhaps on the 32000 series, -provided one has a linker that works with the feature. -This is said to make a 15% speedup on the 68000. - -* Keep global variables in registers. - -Here is a scheme for doing this. A global variable, or a local variable -whose address is taken, can be kept in a register for an entire function -if it does not use non-constant memory addresses and (for globals only) -does not call other functions. If the entire function does not meet -this criterion, a loop may. - -The VAR_DECL for such a variable would have to have two RTL expressions: -the true home in memory, and the pseudo-register used temporarily. -It is necessary to emit insns to copy the memory location into the -pseudo-register at the beginning of the function or loop, and perhaps -back out at the end. These insns should have REG_EQUIV notes so that, -if the pseudo-register does not get a hard register, it is spilled into -the memory location which exists in any case. - -The easiest way to set up these insns is to modify the routine -put_var_into_stack so that it does not apply to the entire function -(sparing any loops which contain nothing dangerous) and to call it at -the end of the function regardless of where in the function the -address of a local variable is taken. It would be called -unconditionally at the end of the function for all relevant global -variables. - -For debugger output, the thing to do is to invent a new binding level -around the appropriate loop and define the variable name as a register -variable with that scope. - -* Live-range splitting. - -Currently a variable is allocated a hard register either for the full -extent of its use or not at all. Sometimes it would be good to -allocate a variable a hard register for just part of a function; for -example, through a particular loop where the variable is mostly used, -or outside of a particular loop where the variable is not used. (The -latter is nice because it might let the variable be in a register most -of the time even though the loop needs all the registers.) - -Contact meissner@cygnus.com before starting any work on live range -splitting. - -* Detect dead stores into memory? - -A store into memory is dead if it is followed by another store into -the same location; and, in between, there is no reference to anything -that might be that location (including no reference to a variable -address). - -This can be modeled as a partial redundancy elimination/lazy code motion -problem. Contact law@cygnus.com before working on dead store elimination -optimizations. - -* Loop optimization. - -Strength reduction and iteration variable elimination could be -smarter. They should know how to decide which iteration variables are -not worth making explicit because they can be computed as part of an -address calculation. Based on this information, they should decide -when it is desirable to eliminate one iteration variable and create -another in its place. - -It should be possible to compute what the value of an iteration -variable will be at the end of the loop, and eliminate the variable -within the loop by computing that value at the loop end. - -When a loop has a simple increment that adds 1, -instead of jumping in after the increment, -decrement the loop count and jump to the increment. -This allows aob insns to be used. - -* Using constraints on values. - -Many operations could be simplified based on knowledge of the -minimum and maximum possible values of a register at any particular time. -These limits could come from the data types in the tree, via rtl generation, -or they can be deduced from operations that are performed. For example, -the result of an `and' operation one of whose operands is 7 must be in -the range 0 to 7. Compare instructions also tell something about the -possible values of the operand, in the code beyond the test. - -Value constraints can be used to determine the results of a further -comparison. They can also indicate that certain `and' operations are -redundant. Constraints might permit a decrement and branch -instruction that checks zeroness to be used when the user has -specified to exit if negative. - -* Smarter reload pass. - -The reload pass as currently written can reload values only into registers -that are reserved for reloading. This means that in order to use a -register for reloading it must spill everything out of that register. - -It would be straightforward, though complicated, for reload1.c to keep -track, during its scan, of which hard registers were available at each -point in the function, and use for reloading even registers that were -free only at the point they were needed. This would avoid much spilling -and make better code. - -* Change the type of a variable. - -Sometimes a variable is declared as `int', it is assigned only once -from a value of type `char', and then it is used only by comparison -against constants. On many machines, better code would result if -the variable had type `char'. If the compiler could detect this -case, it could change the declaration of the variable and change -all the places that use it. - -* Better handling for very sparse switches. - -There may be cases where it would be better to compile a switch -statement to use a fixed hash table rather than the current -combination of jump tables and binary search. - -* Order of subexpressions. - -It might be possible to make better code by paying attention -to the order in which to generate code for subexpressions of an expression. - -* More code motion. - -Consider hoisting common code up past conditional branches or tablejumps. - -Contact law@cygnus.com before working on code hoisting. - -* Trace scheduling. - -This technique is said to be able to figure out which way a jump -will usually go, and rearrange the code to make that path the -faster one. - -* Distributive law. - -The C expression *(X + 4 * (Y + C)) compiles better on certain -machines if rewritten as *(X + 4*C + 4*Y) because of known addressing -modes. It may be tricky to determine when, and for which machines, to -use each alternative. - -Some work has been done on this, in combine.c. - -* Can optimize by changing if (x) y; else z; into z; if (x) y; -if z and x do not interfere and z has no effects not undone by y. -This is desirable if z is faster than jumping. - -* For a two-insn loop on the 68020, such as - foo: movb a2@+,a3@+ - jne foo -it is better to insert dbeq d0,foo before the jne. -d0 can be a junk register. The challenge is to fit this into -a portable framework: when can you detect this situation and -still be able to allocate a junk register? - -2. Simpler porting. - -Right now, describing the target machine's instructions is done -cleanly, but describing its addressing mode is done with several -ad-hoc macro definitions. Porting would be much easier if there were -an RTL description for addressing modes like that for instructions. -Tools analogous to genflags and genrecog would generate macros from -this description. - -There would be one pattern in the address-description file for each -kind of addressing, and this pattern would have: - - * the RTL expression for the address - * C code to verify its validity (since that may depend on - the exact data). - * C code to print the address in assembler language. - * C code to convert the address into a valid one, if it is not valid. - (This would replace LEGITIMIZE_ADDRESS). - * Register constraints for all indeterminates that appear - in the RTL expression. - -3. Other languages. - -Front ends for Pascal, Fortran, Algol, Cobol, Modula-2 and Ada are -desirable. - -Pascal, Modula-2 and Ada require the implementation of functions -within functions. Some of the mechanisms for this already exist. - -4. More extensions. - -* Generated unique labels. Have some way of generating distinct labels -for use in extended asm statements. I don't know what a good syntax would -be. - -* A way of defining a structure containing a union, in which the choice of -union alternative is controlled by a previous structure component. - -Here is a possible syntax for this. - -struct foo { - enum { INT, DOUBLE } code; - auto union { case INT: int i; case DOUBLE: double d;} value : code; -}; - -* Allow constructor expressions as lvalues, like this: - - (struct foo) {a, b, c} = foo(); - -This would call foo, which returns a structure, and then store the -several components of the structure into the variables a, b, and c. - -5. Generalize the machine model. - -* Some new compiler features may be needed to do a good job on machines -where static data needs to be addressed using base registers. - -* Some machines have two stacks in different areas of memory, one used -for scalars and another for large objects. The compiler does not -now have a way to understand this. - -6. Useful warnings. - -* Warn about statements that are undefined because the order of -evaluation of increment operators makes a big difference. Here is an -example: - - *foo++ = hack (*foo); - -7. Better documentation of how GCC works and how to port it. - -Here is an outline proposed by Allan Adler. - -I. Overview of this document -II. The machines on which GCC is implemented - A. Prose description of those characteristics of target machines and - their operating systems which are pertinent to the implementation - of GCC. - i. target machine characteristics - ii. comparison of this system of machine characteristics with - other systems of machine specification currently in use - B. Tables of the characteristics of the target machines on which - GCC is implemented. - C. A priori restrictions on the values of characteristics of target - machines, with special reference to those parts of the source code - which entail those restrictions - i. restrictions on individual characteristics - ii. restrictions involving relations between various characteristics - D. The use of GCC as a cross-compiler - i. cross-compilation to existing machines - ii. cross-compilation to non-existent machines - E. Assumptions which are made regarding the target machine - i. assumptions regarding the architecture of the target machine - ii. assumptions regarding the operating system of the target machine - iii. assumptions regarding software resident on the target machine - iv. where in the source code these assumptions are in effect made -III. A systematic approach to writing the files tm.h and xm.h - A. Macros which require special care or skill - B. Examples, with special reference to the underlying reasoning -IV. A systematic approach to writing the machine description file md - A. Minimal viable sets of insn descriptions - B. Examples, with special reference to the underlying reasoning -V. Uses of the file aux-output.c -VI. Specification of what constitutes correct performance of an - implementation of GCC - A. The components of GCC - B. The itinerary of a C program through GCC - C. A system of benchmark programs - D. What your RTL and assembler should look like with these benchmarks - E. Fine tuning for speed and size of compiled code -VII. A systematic procedure for debugging an implementation of GCC - A. Use of GDB - i. the macros in the file .gdbinit for GCC - ii. obstacles to the use of GDB - a. functions implemented as macros can't be called in GDB - B. Debugging without GDB - i. How to turn off the normal operation of GCC and access specific - parts of GCC - C. Debugging tools - D. Debugging the parser - i. how machine macros and insn definitions affect the parser - E. Debugging the recognizer - i. how machine macros and insn definitions affect the recognizer - -ditto for other components - -VIII. Data types used by GCC, with special reference to restrictions not - specified in the formal definition of the data type -IX. References to the literature for the algorithms used in GCC - diff --git a/contrib/gcc/README b/contrib/gcc/README deleted file mode 100644 index a12bf7594630..000000000000 --- a/contrib/gcc/README +++ /dev/null @@ -1,26 +0,0 @@ -This directory contains the GNU Compiler Collection (GCC) version 2.95. -It includes all of the support for compiling C, C++, Objective C, Fortran, -Java, and Chill. - -The GNU Compiler Collection is free software. See the file COPYING for copying -permission. - -See the file gcc.texi (together with other files that it includes) for -installation and porting information. The file INSTALL contains a -copy of the installation information, as plain ASCII. - -Installing this package will create various files in subdirectories of -/usr/local/lib, which are passes used by the compiler and a library -named libgcc.a. It will also create /usr/local/bin/gcc, which is -the user-level command to do a compilation. - -See the Bugs chapter of the GCC Manual for how to report bugs -usefully. An online readable version of the manual is in the files -gcc.info*. - -The files pself.c and pself1.c are not part of GCC. -They are programs that print themselves on standard output. -They were written by Dario Dariol and Giovanni Cozzi, and are -included for your hacking pleasure. Likewise pself2.c -(Who is the author of that?) and pself3.c (by Vlad Taeerov and Rashit -Fakhreyev). diff --git a/contrib/gcc/README-bugs b/contrib/gcc/README-bugs deleted file mode 100644 index 06e15bb8af70..000000000000 --- a/contrib/gcc/README-bugs +++ /dev/null @@ -1,144 +0,0 @@ -The purpose of GCC pretesting is to verify that the new GCC -distribution, about to be released, works properly on your system *with -no change whatever*, when installed following the precise -recommendations that come with the distribution. - -Here are some guidelines on how to do pretesting so as to make it -helpful. All of them follow from common sense together with the -nature of the purpose and the situation. - -* It is absolutely vital that you mention even the smallest change or -departure from the standard sources and installation procedure. - -Otherwise, you are not testing the same program that I wrote. Testing -a different program is usually of no use whatever. It can even cause -trouble if you fail to tell me that you tested some other program -instead of what I know as GCC. I might think that GCC works, when in -fact it has not been properly tried, and might have a glaring fault. - -* Even changing the compilation options counts as a change in the -program. The GCC sources specify which compilation options to use. -Some of them are specified in makefiles, and some in machine-specific -configuration files. - -You have ways to override this--but if you do, then you are not -testing what ordinary users will do. Therefore, when pretesting, it -is vital to test with the default compilation options. - -(It is okay to test with nonstandard options as well as testing with -the standard ones.) - -* The machine and system configuration files of GCC are parts of -GCC. So when you test GCC, you need to do it with the -configuration files that come with GCC. - -If GCC does not come with configuration files for a certain machine, -and you test it with configuration files that don't come with GCC, -this is effectively changing GCC. Because the crucial fact about -the planned release is that, without changes, it doesn't work on that -machine. - -To make GCC work on that machine, I would need to install new -configuration files. That is not out of the question, since it is -safe--it certainly won't break any other machines that already work. -But you will have to rush me the legal papers to give the FSF -permission to use a large piece of text. - -* Look for recommendations for your system. - -You can find these recommendations in the Installation node of the -manual, and in the file INSTALL. (These two files have the same text.) - -These files say which configuration name to use for your machine, so -use the ones that are recommended. If you guess, you might guess -wrong and encounter spurious difficulties. What's more, if you don't -follow the recommendations then you aren't helping to test that its -recommendations are valid. - -These files may describe other things that you need to do to make GCC -work on your machine. If so, you should follow these recommendations -also, for the same reason. - -Also look at the Trouble chapter of the manual for items that -pertain to your machine. - -* Don't delay sending information. - -When you find a problem, please double check it if you can do so -quickly. But don't spend a long time double-checking. A good rule is -always to tell me about every problem on the same day you encounter -it, even if that means you can't find a solution before you report the -problem. - -I'd much rather hear about a problem today and a solution tomorrow -than get both of them tomorrow at the same time. - -* Make each bug report self-contained. - -If you refer back to another message, whether from you or from someone -else, then it will be necessary for anyone who wants to investigate -the bug to find the other message. This may be difficult, it is -probably time-consuming. - -To help me save time, simply copy the relevant parts of any previous -messages into your own bug report. - -In particular, if I ask you for more information because a bug report -was incomplete, it is best to send me the *entire* collection of -relevant information, all together. If you send just the additional -information, that makes me do extra work. There is even a risk that -I won't remember what question you are sending me the answer to. - -* Always be precise when talking about changes you have made. Show -things rather than describing them. Use exact filenames (relative to -the main directory of the distribution), not partial ones. For -example, say "I changed Makefile" rather than "I changed the -makefile". Instead of saying "I defined the MUMBLE macro", send a -diff that shows your change. - -* Always use `diff -c' to make diffs. If you don't include context, -it may be hard for me to figure out where you propose to make the -changes. I might have to ignore your patch because I can't tell what -it means. - -* When you write a fix, keep in mind that I can't install a change -that would break other systems. - -People often suggest fixing a problem by changing machine-independent -files such as toplev.c to do something special that a particular -system needs. Sometimes it is totally obvious that such changes would -break GCC for almost all users. I can't possibly make a change like -that. All I can do is send it back to you and ask you to find a fix -that is safe to install. - -Sometimes people send fixes that *might* be an improvement in -general--but it is hard to be sure of this. I can install such -changes some of the time, but not during pretest, when I am trying to -get a new version to work reliably as quickly as possible. - -The safest changes for me to install are changes to the configuration -files for a particular machine. At least I know those can't create -bugs on other machines. - -* Don't try changing GCC unless it fails to work if you don't change it. - -* Don't even suggest changes that would only make GCC cleaner. -Every change I install could introduce a bug, so I won't install -a change unless I see it is necessary. - -* If you would like to suggest changes for purposes other than fixing -serious bugs, don't wait till pretest time. Instead, send them just -after I make a release. That's the best time for me to install them. - -* In some cases, if you don't follow these guidelines, your -information might still be useful, but I might have to do more work to -make use of it. Unfortunately, I am so far behind in my work that I -just can't get the job done unless you help me to do it efficiently. - - - Thank you - rms - -Local Variables: -mode: text -End: diff --git a/contrib/gcc/README-fixinc b/contrib/gcc/README-fixinc deleted file mode 100644 index 4b303ddc63a3..000000000000 --- a/contrib/gcc/README-fixinc +++ /dev/null @@ -1,9 +0,0 @@ -This README file is copied into the directory for GCC-only header files -when fixincludes is run by the makefile for GCC. - -Many of the files in this directory were made from the standard system -header files of this system by the shell script `fixincludes'. -They are system-specific, and will not work on any other kind of system. -They are also not part of GCC. The reason for making the files here -is to fix the places in the header files which use constructs -that are incompatible with ANSI C. diff --git a/contrib/gcc/README.ACORN b/contrib/gcc/README.ACORN deleted file mode 100644 index 769dba74a334..000000000000 --- a/contrib/gcc/README.ACORN +++ /dev/null @@ -1,18 +0,0 @@ -Specifying the -g flag to GCC on a RISC iX machine requires upgrading the -standard assembler distributed with both RISC iX 1.1 and RISC iX 1.2 with a -replacement that is available from Acorn. This version of the assembler is -also an order of magnitude faster when assembling to an NFS mounted -file-system. - -Users of RISC iX 1.2 and above can obtain a copy of the assembler from the -following places: - -1) Via ftp from acorn.acorn.co.uk, directory pub/riscix. - -2) From Acorn Customer Services. - -3) From Granada Microcare. - -Users of versions of RISC iX prior 1.2 should contact Acorn Customer Services; -the assembler available on the net will not work with these versions due to -changes in the shared libraries and system call numbers. diff --git a/contrib/gcc/README.ALTOS b/contrib/gcc/README.ALTOS deleted file mode 100644 index c0a1a04145fd..000000000000 --- a/contrib/gcc/README.ALTOS +++ /dev/null @@ -1,55 +0,0 @@ -Since COFF-encapsulation is obsolete, this may not be needed anymore. - -Return-Path: -Date: Mon, 10 Apr 89 10:13:45 +0300 -From: Jyrki Kuoppala -Sender: jkp@sauna.hut.fi -To: info-gcc@prep.ai.mit.edu -Subject: Kernel fix needed for Altos 3068 to get coff-encapsulation working right -Organization: Helsinki University of Technology, Finland. - -Here's a description how to fix a kernel bug in Altos 3068 and get -gcc-compiled programs working. - -Author: Jyrki Kuoppala (jkp@cs.hut.fi) -Last modified: Mon Apr 10 09:28:40 1989 - -There's a bug in the Altos 3068 kernel that causes gcc-compiled -programs to fail in certain situations when the machine has a heavy -load and also in some other situations. The bug exists at least in -SVR 2.2 1.0gT1 and SVR 2.2 1.0e. - -If you have source code to your system, apply the following change to -os/exec.c (function gethead): - -Change the lines containing - - u.u_exdata.ux_tstart = sizeof(struct naout) + - sizeof(struct filhd) + (ep->ef.nscns * sizeof(struct scnhdr)); - -to - - u.u_exdata.ux_tstart = u.u_exdata.ux_txtorg; - -If you only have binary, use sdb to find out the address of the -previous lines (on our system it's gethead+0x140) and use your -favourite binary editor to change the bytes '3036 0162 fffc 0002 0280 -0000' to '23f9 01fb f4ca 01fb f4c2 6016'. This may or may not work in -your case, depending on the version of the operating system and the -phase of the moon. - -Here's what is just before gethead+0x140 to ease finding out the right place: - -0x9224 (gethead+0x122): 23f9 01fb f4ca 01fb f4ce mov.l &0x1fbf4ca.L,&0 -x1fbf4ce.L [] -0x922e (gethead+0x12c): 23f9 01fb f4c6 01fb f4ca mov.l &0x1fbf4c6.L,&0 -x1fbf4ca.L [] -0x9238 (gethead+0x136): 23f9 01fb f4c2 01fb f4c6 mov.l &0x1fbf4c2.L,&0 -x1fbf4c6.L [] - -Good luck ! - -//Jyrki - -jkp@cs.hut.fi - diff --git a/contrib/gcc/README.APOLLO b/contrib/gcc/README.APOLLO deleted file mode 100644 index ca02de142840..000000000000 --- a/contrib/gcc/README.APOLLO +++ /dev/null @@ -1,112 +0,0 @@ -README.apollo - -Building GCC 2.0 for 680x0 based Apollo systems requires the GNU -assembler (GAS) version 1.38.1, with John Vasta's patches applied. - -If you haven't done so yet, get `gas-1.38.1.tar.Z' from your favourite -GNU distribution site. Furthermore, get `apollo-gas-1.38.1.diffs' -from `labrea.stanford.edu:/pub/gnu', apply the patches, compile and -install gas (under the name as). This should go through without any -problems. - -After switching into the BSD environment, you can configure GCC 2.0 -with the command - -% ./configure m68k-apollo-bsd - -The Apollo's `/usr/include/setjmp.h' uses a nonstandard `#options()' -construct. You should create a local copy of this file and remove -these constructs from the declarations of SIGSETJMP and SIGLONGJMP. - -The Apollo's `/usr/include/sys/types.h' (BSD Version) doesn't allow -to test for the definition of `size_t'. This should be fixed by - - #ifndef _SIZE_T - #define _SIZE_T - typedef long size_t; - #endif - -The script `patch-apollo-includes' fixes these two problems, but does -_not_ pretend to be a full fledged `fixincludes' for this system. - -If you now follow the standard GCC installation instructions, building -GCC 2.0 (including G++ 2.0) should proceed without any problems. - -NB: Debugging is not yet supported for the Apollo. If someone wants - to do a _big_ favour to the Apollo users, he/she should consider - porting the Binary File Description library (BFD) to the Apollo. - This library can be found in the gdb-4.x distributions or in the - binutils-1.9x distributions. - - - - -#!/bin/sh -# patch-apollo-includes -- fix some (but not all!) Apollo brain damage. - -FILES_TO_PATCH='sys/types.h setjmp.h' - -mkdir sys - -for i in $FILES_TO_PATCH; -do - cp /bsd4.3/usr/include/$i ./$i -done - -patch -b -apollo <<'EOP' -*** /bsd4.3/usr/include/sys/types.h Fri Apr 8 20:29:06 1988 ---- sys/types.h Wed Feb 26 21:17:57 1992 -*************** -*** 38,44 **** ---- 38,47 ---- - typedef char * caddr_t; - typedef u_long ino_t; - typedef long swblk_t; -+ #ifndef _SIZE_T -+ #define _SIZE_T - typedef long size_t; -+ #endif - typedef long time_t; - typedef long dev_t; - typedef long off_t; -*** /bsd4.3/usr/include/setjmp.h Fri Feb 3 21:40:21 1989 ---- setjmp.h Sun Feb 23 19:06:55 1992 -*************** -*** 24,30 **** ---- 24,39 ---- - #endif - - -+ #ifdef __GNUC__ - #ifdef _PROTOTYPES -+ extern int sigsetjmp (sigjmp_buf env, int savemask); -+ extern void siglongjmp (sigjmp_buf env, int val); -+ #else -+ extern int sigsetjmp(); -+ extern void siglongjmp(); -+ #endif /* _PROTOTYPES */ -+ #else /* not __GNUC__ */ -+ #ifdef _PROTOTYPES - extern int sigsetjmp( - sigjmp_buf env, - int savemask -*************** -*** 37,43 **** - extern int sigsetjmp() #options(abnormal); - extern void siglongjmp() #options(noreturn); - #endif /* _PROTOTYPES */ -! - #undef _PROTOTYPES - - #ifdef __cplusplus ---- 46,52 ---- - extern int sigsetjmp() #options(abnormal); - extern void siglongjmp() #options(noreturn); - #endif /* _PROTOTYPES */ -! #endif /* not __GNUC__ */ - #undef _PROTOTYPES - - #ifdef __cplusplus -EOP - -exit 0 diff --git a/contrib/gcc/README.DWARF b/contrib/gcc/README.DWARF deleted file mode 100644 index 97459508b3c4..000000000000 --- a/contrib/gcc/README.DWARF +++ /dev/null @@ -1,574 +0,0 @@ -Notes on the GNU Implementation of DWARF Debugging Information --------------------------------------------------------------- -Last Updated: Sun Jul 17 08:17:42 PDT 1994 by rfg@segfault.us.com ------------------------------------------------------------- - -This file describes special and unique aspects of the GNU implementation -of the DWARF debugging information language, as provided in the GNU version -2.x compiler(s). - -For general information about the DWARF debugging information language, -you should obtain the DWARF version 1 specification document (and perhaps -also the DWARF version 2 draft specification document) developed by the -UNIX International Programming Languages Special Interest Group. A copy -of the DWARF version 1 specification (in PostScript form) may be -obtained either from me or from the main Data General -FTP server. (See below.) The file you are looking at now only describes -known deviations from the DWARF version 1 specification, together with -those things which are allowed by the DWARF version 1 specification but -which are known to cause interoperability problems (e.g. with SVR4 SDB). - -To obtain a copy of the DWARF Version 1 and/or DWARF Version 2 specification -from Data General's FTP server, use the following procedure: - ---------------------------------------------------------------------------- - ftp to machine: "dg-rtp.dg.com" (128.222.1.2). - - Log in as "ftp". - cd to "plsig" - get any of the following file you are interested in: - - dwarf.1.0.3.ps - dwarf.2.0.0.index.ps - dwarf.2.0.0.ps ---------------------------------------------------------------------------- - -The generation of DWARF debugging information by the GNU version 2.x C -compiler has now been tested rather extensively for m88k, i386, i860, and -Sparc targets. The DWARF output of the GNU C compiler appears to inter- -operate well with the standard SVR4 SDB debugger on these kinds of target -systems (but of course, there are no guarantees). - -DWARF generation for the GNU g++ compiler is still not operable. This is -due primarily to the many remaining cases where the g++ front end does not -conform to the conventions used in the GNU C front end for representing -various kinds of declarations in the TREE data structure. It is not clear -at this time how these problems will be addressed. - -Future plans for the dwarfout.c module of the GNU compiler(s) includes the -addition of full support for GNU FORTRAN. (This should, in theory, be a -lot simpler to add than adding support for g++... but we'll see.) - -Many features of the DWARF version 2 specification have been adapted to -(and used in) the GNU implementation of DWARF (version 1). In most of -these cases, a DWARF version 2 approach is used in place of (or in addition -to) DWARF version 1 stuff simply because it is apparent that DWARF version -1 is not sufficiently expressive to provide the kinds of information which -may be necessary to support really robust debugging. In all of these cases -however, the use of DWARF version 2 features should not interfere in any -way with the interoperability (of GNU compilers) with generally available -"classic" (pre version 1) DWARF consumer tools (e.g. SVR4 SDB). - -The DWARF generation enhancement for the GNU compiler(s) was initially -donated to the Free Software Foundation by Network Computing Devices. -(Thanks NCD!) Additional development and maintenance of dwarfout.c has -been largely supported (i.e. funded) by Intel Corporation. (Thanks Intel!) - -If you have questions or comments about the DWARF generation feature, please -send mail to me . I will be happy to investigate any bugs -reported and I may even provide fixes (but of course, I can make no promises). - -The DWARF debugging information produced by GCC may deviate in a few minor -(but perhaps significant) respects from the DWARF debugging information -currently produced by other C compilers. A serious attempt has been made -however to conform to the published specifications, to existing practice, -and to generally accepted norms in the GNU implementation of DWARF. - - ** IMPORTANT NOTE ** ** IMPORTANT NOTE ** ** IMPORTANT NOTE ** - -Under normal circumstances, the DWARF information generated by the GNU -compilers (in an assembly language file) is essentially impossible for -a human being to read. This fact can make it very difficult to debug -certain DWARF-related problems. In order to overcome this difficulty, -a feature has been added to dwarfout.c (enabled by the -fverbose-asm -option) which causes additional comments to be placed into the assembly -language output file, out to the right-hand side of most bits of DWARF -material. The comments indicate (far more clearly that the obscure -DWARF hex codes do) what is actually being encoded in DWARF. Thus, the --fverbose-asm option can be highly useful for those who must study the -DWARF output from the GNU compilers in detail. - ---------- - -(Footnote: Within this file, the term `Debugging Information Entry' will -be abbreviated as `DIE'.) - - -Release Notes (aka known bugs) -------------------------------- - -In one very obscure case involving dynamically sized arrays, the DWARF -"location information" for such an array may make it appear that the -array has been totally optimized out of existence, when in fact it -*must* actually exist. (This only happens when you are using *both* -g -*and* -O.) This is due to aggressive dead store elimination in the -compiler, and to the fact that the DECL_RTL expressions associated with -variables are not always updated to correctly reflect the effects of -GCC's aggressive dead store elimination. - -------------------------------- - -When attempting to set a breakpoint at the "start" of a function compiled -with -g1, the debugger currently has no way of knowing exactly where the -end of the prologue code for the function is. Thus, for most targets, -all the debugger can do is to set the breakpoint at the AT_low_pc address -for the function. But if you stop there and then try to look at one or -more of the formal parameter values, they may not have been "homed" yet, -so you may get inaccurate answers (or perhaps even addressing errors). - -Some people may consider this simply a non-feature, but I consider it a -bug, and I hope to provide some GNU-specific attributes (on function -DIEs) which will specify the address of the end of the prologue and the -address of the beginning of the epilogue in a future release. - -------------------------------- - -It is believed at this time that old bugs relating to the AT_bit_offset -values for bit-fields have been fixed. - -There may still be some very obscure bugs relating to the DWARF description -of type `long long' bit-fields for target machines (e.g. 80x86 machines) -where the alignment of type `long long' data objects is different from -(and less than) the size of a type `long long' data object. - -Please report any problems with the DWARF description of bit-fields as you -would any other GCC bug. (Procedures for bug reporting are given in the -GNU C compiler manual.) - --------------------------------- - -At this time, GCC does not know how to handle the GNU C "nested functions" -extension. (See the GCC manual for more info on this extension to ANSI C.) - --------------------------------- - -The GNU compilers now represent inline functions (and inlined instances -thereof) in exactly the manner described by the current DWARF version 2 -(draft) specification. The version 1 specification for handling inline -functions (and inlined instances) was known to be brain-damaged (by the -PLSIG) when the version 1 spec was finalized, but it was simply too late -in the cycle to get it removed before the version 1 spec was formally -released to the public (by UI). - --------------------------------- - -At this time, GCC does not generate the kind of really precise information -about the exact declared types of entities with signed integral types which -is required by the current DWARF draft specification. - -Specifically, the current DWARF draft specification seems to require that -the type of an non-unsigned integral bit-field member of a struct or union -type be represented as either a "signed" type or as a "plain" type, -depending upon the exact set of keywords that were used in the -type specification for the given bit-field member. It was felt (by the -UI/PLSIG) that this distinction between "plain" and "signed" integral types -could have some significance (in the case of bit-fields) because ANSI C -does not constrain the signedness of a plain bit-field, whereas it does -constrain the signedness of an explicitly "signed" bit-field. For this -reason, the current DWARF specification calls for compilers to produce -type information (for *all* integral typed entities... not just bit-fields) -which explicitly indicates the signedness of the relevant type to be -"signed" or "plain" or "unsigned". - -Unfortunately, the GNU DWARF implementation is currently incapable of making -such distinctions. - --------------------------------- - - -Known Interoperability Problems -------------------------------- - -Although the GNU implementation of DWARF conforms (for the most part) with -the current UI/PLSIG DWARF version 1 specification (with many compatible -version 2 features added in as "vendor specific extensions" just for good -measure) there are a few known cases where GCC's DWARF output can cause -some confusion for "classic" (pre version 1) DWARF consumers such as the -System V Release 4 SDB debugger. These cases are described in this section. - --------------------------------- - -The DWARF version 1 specification includes the fundamental type codes -FT_ext_prec_float, FT_complex, FT_dbl_prec_complex, and FT_ext_prec_complex. -Since GNU C is only a C compiler (and since C doesn't provide any "complex" -data types) the only one of these fundamental type codes which GCC ever -generates is FT_ext_prec_float. This fundamental type code is generated -by GCC for the `long double' data type. Unfortunately, due to an apparent -bug in the SVR4 SDB debugger, SDB can become very confused wherever any -attempt is made to print a variable, parameter, or field whose type was -given in terms of FT_ext_prec_float. - -(Actually, SVR4 SDB fails to understand *any* of the four fundamental type -codes mentioned here. This will fact will cause additional problems when -there is a GNU FORTRAN front-end.) - --------------------------------- - -In general, it appears that SVR4 SDB is not able to effectively ignore -fundamental type codes in the "implementation defined" range. This can -cause problems when a program being debugged uses the `long long' data -type (or the signed or unsigned varieties thereof) because these types -are not defined by ANSI C, and thus, GCC must use its own private fundamental -type codes (from the implementation-defined range) to represent these types. - --------------------------------- - - -General GNU DWARF extensions ----------------------------- - -In the current DWARF version 1 specification, no mechanism is specified by -which accurate information about executable code from include files can be -properly (and fully) described. (The DWARF version 2 specification *does* -specify such a mechanism, but it is about 10 times more complicated than -it needs to be so I'm not terribly anxious to try to implement it right -away.) - -In the GNU implementation of DWARF version 1, a fully downward-compatible -extension has been implemented which permits the GNU compilers to specify -which executable lines come from which files. This extension places -additional information (about source file names) in GNU-specific sections -(which should be totally ignored by all non-GNU DWARF consumers) so that -this extended information can be provided (to GNU DWARF consumers) in a way -which is totally transparent (and invisible) to non-GNU DWARF consumers -(e.g. the SVR4 SDB debugger). The additional information is placed *only* -in specialized GNU-specific sections, where it should never even be seen -by non-GNU DWARF consumers. - -To understand this GNU DWARF extension, imagine that the sequence of entries -in the .lines section is broken up into several subsections. Each contiguous -sequence of .line entries which relates to a sequence of lines (or statements) -from one particular file (either a `base' file or an `include' file) could -be called a `line entries chunk' (LEC). - -For each LEC there is one entry in the .debug_srcinfo section. - -Each normal entry in the .debug_srcinfo section consists of two 4-byte -words of data as follows: - - (1) The starting address (relative to the entire .line section) - of the first .line entry in the relevant LEC. - - (2) The starting address (relative to the entire .debug_sfnames - section) of a NUL terminated string representing the - relevant filename. (This filename name be either a - relative or an absolute filename, depending upon how the - given source file was located during compilation.) - -Obviously, each .debug_srcinfo entry allows you to find the relevant filename, -and it also points you to the first .line entry that was generated as a result -of having compiled a given source line from the given source file. - -Each subsequent .line entry should also be assumed to have been produced -as a result of compiling yet more lines from the same file. The end of -any given LEC is easily found by looking at the first 4-byte pointer in -the *next* .debug_srcinfo entry. That next .debug_srcinfo entry points -to a new and different LEC, so the preceding LEC (implicitly) must have -ended with the last .line section entry which occurs at the 2 1/2 words -just before the address given in the first pointer of the new .debug_srcinfo -entry. - -The following picture may help to clarify this feature. Let's assume that -`LE' stands for `.line entry'. Also, assume that `* 'stands for a pointer. - - - .line section .debug_srcinfo section .debug_sfnames section - ---------------------------------------------------------------- - - LE <---------------------- * - LE * -----------------> "foobar.c" <--- - LE | - LE | - LE <---------------------- * | - LE * -----------------> "foobar.h" <| | - LE | | - LE | | - LE <---------------------- * | | - LE * -----------------> "inner.h" | | - LE | | - LE <---------------------- * | | - LE * ------------------------------- | - LE | - LE | - LE | - LE | - LE <---------------------- * | - LE * ----------------------------------- - LE - LE - LE - -In effect, each entry in the .debug_srcinfo section points to *both* a -filename (in the .debug_sfnames section) and to the start of a block of -consecutive LEs (in the .line section). - -Note that just like in the .line section, there are specialized first and -last entries in the .debug_srcinfo section for each object file. These -special first and last entries for the .debug_srcinfo section are very -different from the normal .debug_srcinfo section entries. They provide -additional information which may be helpful to a debugger when it is -interpreting the data in the .debug_srcinfo, .debug_sfnames, and .line -sections. - -The first entry in the .debug_srcinfo section for each compilation unit -consists of five 4-byte words of data. The contents of these five words -should be interpreted (by debuggers) as follows: - - (1) The starting address (relative to the entire .line section) - of the .line section for this compilation unit. - - (2) The starting address (relative to the entire .debug_sfnames - section) of the .debug_sfnames section for this compilation - unit. - - (3) The starting address (in the execution virtual address space) - of the .text section for this compilation unit. - - (4) The ending address plus one (in the execution virtual address - space) of the .text section for this compilation unit. - - (5) The date/time (in seconds since midnight 1/1/70) at which the - compilation of this compilation unit occurred. This value - should be interpreted as an unsigned quantity because gcc - might be configured to generate a default value of 0xffffffff - in this field (in cases where it is desired to have object - files created at different times from identical source files - be byte-for-byte identical). By default, these timestamps - are *not* generated by dwarfout.c (so that object files - compiled at different times will be byte-for-byte identical). - If you wish to enable this "timestamp" feature however, you - can simply place a #define for the symbol `DWARF_TIMESTAMPS' - in your target configuration file and then rebuild the GNU - compiler(s). - -Note that the first string placed into the .debug_sfnames section for each -compilation unit is the name of the directory in which compilation occurred. -This string ends with a `/' (to help indicate that it is the pathname of a -directory). Thus, the second word of each specialized initial .debug_srcinfo -entry for each compilation unit may be used as a pointer to the (string) -name of the compilation directory, and that string may in turn be used to -"absolutize" any relative pathnames which may appear later on in the -.debug_sfnames section entries for the same compilation unit. - -The fifth and last word of each specialized starting entry for a compilation -unit in the .debug_srcinfo section may (depending upon your configuration) -indicate the date/time of compilation, and this may be used (by a debugger) -to determine if any of the source files which contributed code to this -compilation unit are newer than the object code for the compilation unit -itself. If so, the debugger may wish to print an "out-of-date" warning -about the compilation unit. - -The .debug_srcinfo section associated with each compilation will also have -a specialized terminating entry. This terminating .debug_srcinfo section -entry will consist of the following two 4-byte words of data: - - (1) The offset, measured from the start of the .line section to - the beginning of the terminating entry for the .line section. - - (2) A word containing the value 0xffffffff. - --------------------------------- - -In the current DWARF version 1 specification, no mechanism is specified by -which information about macro definitions and un-definitions may be provided -to the DWARF consumer. - -The DWARF version 2 (draft) specification does specify such a mechanism. -That specification was based on the GNU ("vendor specific extension") -which provided some support for macro definitions and un-definitions, -but the "official" DWARF version 2 (draft) specification mechanism for -handling macros and the GNU implementation have diverged somewhat. I -plan to update the GNU implementation to conform to the "official" -DWARF version 2 (draft) specification as soon as I get time to do that. - -Note that in the GNU implementation, additional information about macro -definitions and un-definitions is *only* provided when the -g3 level of -debug-info production is selected. (The default level is -g2 and the -plain old -g option is considered to be identical to -g2.) - -GCC records information about macro definitions and undefinitions primarily -in a section called the .debug_macinfo section. Normal entries in the -.debug_macinfo section consist of the following three parts: - - (1) A special "type" byte. - - (2) A 3-byte line-number/filename-offset field. - - (3) A NUL terminated string. - -The interpretation of the second and third parts is dependent upon the -value of the leading (type) byte. - -The type byte may have one of four values depending upon the type of the -.debug_macinfo entry which follows. The 1-byte MACINFO type codes presently -used, and their meanings are as follows: - - MACINFO_start A base file or an include file starts here. - MACINFO_resume The current base or include file ends here. - MACINFO_define A #define directive occurs here. - MACINFO_undef A #undef directive occur here. - -(Note that the MACINFO_... codes mentioned here are simply symbolic names -for constants which are defined in the GNU dwarf.h file.) - -For MACINFO_define and MACINFO_undef entries, the second (3-byte) field -contains the number of the source line (relative to the start of the current -base source file or the current include files) when the #define or #undef -directive appears. For a MACINFO_define entry, the following string field -contains the name of the macro which is defined, followed by its definition. -Note that the definition is always separated from the name of the macro -by at least one whitespace character. For a MACINFO_undef entry, the -string which follows the 3-byte line number field contains just the name -of the macro which is being undef'ed. - -For a MACINFO_start entry, the 3-byte field following the type byte contains -the offset, relative to the start of the .debug_sfnames section for the -current compilation unit, of a string which names the new source file which -is beginning its inclusion at this point. Following that 3-byte field, -each MACINFO_start entry always contains a zero length NUL terminated -string. - -For a MACINFO_resume entry, the 3-byte field following the type byte contains -the line number WITHIN THE INCLUDING FILE at which the inclusion of the -current file (whose inclusion ends here) was initiated. Following that -3-byte field, each MACINFO_resume entry always contains a zero length NUL -terminated string. - -Each set of .debug_macinfo entries for each compilation unit is terminated -by a special .debug_macinfo entry consisting of a 4-byte zero value followed -by a single NUL byte. - --------------------------------- - -In the current DWARF draft specification, no provision is made for providing -a separate level of (limited) debugging information necessary to support -tracebacks (only) through fully-debugged code (e.g. code in system libraries). - -A proposal to define such a level was submitted (by me) to the UI/PLSIG. -This proposal was rejected by the UI/PLSIG for inclusion into the DWARF -version 1 specification for two reasons. First, it was felt (by the PLSIG) -that the issues involved in supporting a "traceback only" subset of DWARF -were not well understood. Second, and perhaps more importantly, the PLSIG -is already having enough trouble agreeing on what it means to be "conforming" -to the DWARF specification, and it was felt that trying to specify multiple -different *levels* of conformance would only complicate our discussions of -this already divisive issue. Nonetheless, the GNU implementation of DWARF -provides an abbreviated "traceback only" level of debug-info production for -use with fully-debugged "system library" code. This level should only be -used for fully debugged system library code, and even then, it should only -be used where there is a very strong need to conserve disk space. This -abbreviated level of debug-info production can be used by specifying the --g1 option on the compilation command line. - --------------------------------- - -As mentioned above, the GNU implementation of DWARF currently uses the DWARF -version 2 (draft) approach for inline functions (and inlined instances -thereof). This is used in preference to the version 1 approach because -(quite simply) the version 1 approach is highly brain-damaged and probably -unworkable. - --------------------------------- - - -GNU DWARF Representation of GNU C Extensions to ANSI C ------------------------------------------------------- - -The file dwarfout.c has been designed and implemented so as to provide -some reasonable DWARF representation for each and every declarative -construct which is accepted by the GNU C compiler. Since the GNU C -compiler accepts a superset of ANSI C, this means that there are some -cases in which the DWARF information produced by GCC must take some -liberties in improvising DWARF representations for declarations which -are only valid in (extended) GNU C. - -In particular, GNU C provides at least three significant extensions to -ANSI C when it comes to declarations. These are (1) inline functions, -and (2) dynamic arrays, and (3) incomplete enum types. (See the GCC -manual for more information on these GNU extensions to ANSI C.) When -used, these GNU C extensions are represented (in the generated DWARF -output of GCC) in the most natural and intuitively obvious ways. - -In the case of inline functions, the DWARF representation is exactly as -called for in the DWARF version 2 (draft) specification for an identical -function written in C++; i.e. we "reuse" the representation of inline -functions which has been defined for C++ to support this GNU C extension. - -In the case of dynamic arrays, we use the most obvious representational -mechanism available; i.e. an array type in which the upper bound of -some dimension (usually the first and only dimension) is a variable -rather than a constant. (See the DWARF version 1 specification for more -details.) - -In the case of incomplete enum types, such types are represented simply -as TAG_enumeration_type DIEs which DO NOT contain either AT_byte_size -attributes or AT_element_list attributes. - --------------------------------- - - -Future Directions ------------------ - -The codes, formats, and other paraphernalia necessary to provide proper -support for symbolic debugging for the C++ language are still being worked -on by the UI/PLSIG. The vast majority of the additions to DWARF which will -be needed to completely support C++ have already been hashed out and agreed -upon, but a few small issues (e.g. anonymous unions, access declarations) -are still being discussed. Also, we in the PLSIG are still discussing -whether or not we need to do anything special for C++ templates. (At this -time it is not yet clear whether we even need to do anything special for -these.) - -Unfortunately, as mentioned above, there are quite a few problems in the -g++ front end itself, and these are currently responsible for severely -restricting the progress which can be made on adding DWARF support -specifically for the g++ front-end. Furthermore, Richard Stallman has -expressed the view that C++ friendships might not be important enough to -describe (in DWARF). This view directly conflicts with both the DWARF -version 1 and version 2 (draft) specifications, so until this small -misunderstanding is cleared up, DWARF support for g++ is unlikely. - -With regard to FORTRAN, the UI/PLSIG has defined what is believed to be a -complete and sufficient set of codes and rules for adequately representing -all of FORTRAN 77, and most of Fortran 90 in DWARF. While some support for -this has been implemented in dwarfout.c, further implementation and testing -will have to await the arrival of the GNU Fortran front-end (which is -currently in early alpha test as of this writing). - -GNU DWARF support for other languages (i.e. Pascal and Modula) is a moot -issue until there are GNU front-ends for these other languages. - -GNU DWARF support for DWARF version 2 will probably not be attempted until -such time as the version 2 specification is finalized. (More work needs -to be done on the version 2 specification to make the new "abbreviations" -feature of version 2 more easily implementable. Until then, it will be -a royal pain the ass to implement version 2 "abbreviations".) For the -time being, version 2 features will be added (in a version 1 compatible -manner) when and where these features seem necessary or extremely desirable. - -As currently defined, DWARF only describes a (binary) language which can -be used to communicate symbolic debugging information from a compiler -through an assembler and a linker, to a debugger. There is no clear -specification of what processing should be (or must be) done by the -assembler and/or the linker. Fortunately, the role of the assembler -is easily inferred (by anyone knowledgeable about assemblers) just by -looking at examples of assembly-level DWARF code. Sadly though, the -allowable (or required) processing steps performed by a linker are -harder to infer and (perhaps) even harder to agree upon. There are -several forms of very useful `post-processing' steps which intelligent -linkers *could* (in theory) perform on object files containing DWARF, -but any and all such link-time transformations are currently both disallowed -and unspecified. - -In particular, possible link-time transformations of DWARF code which could -provide significant benefits include (but are not limited to): - - Commonization of duplicate DIEs obtained from multiple input - (object) files. - - Cross-compilation type checking based upon DWARF type information - for objects and functions. - - Other possible `compacting' transformations designed to save disk - space and to reduce linker & debugger I/O activity. diff --git a/contrib/gcc/README.FRESCO b/contrib/gcc/README.FRESCO deleted file mode 100644 index 334e78023a98..000000000000 --- a/contrib/gcc/README.FRESCO +++ /dev/null @@ -1,17 +0,0 @@ -Compiling Fresco with g++ ------------------------------ - -Fresco is an evolving interface and toolkit for object-oriented -graphics. A preliminary version (written in C++) was released -with x11r6. - -Previous versions of Fresco have not compiled using g++, -partly because of the use of true and false as identifiers. -(They are now reserved words in g++, as required by the -ANSI/ISO draft standard for C++.) - -If you get x11r6 with public patch #5 or a later version -of Fresco, these problems should now be fixed. - -See http://www.faslab.com/fresco/HomePage.html for information -on Fresco, including how to get the latest version. diff --git a/contrib/gcc/README.NS32K b/contrib/gcc/README.NS32K deleted file mode 100644 index 93c5beaef54a..000000000000 --- a/contrib/gcc/README.NS32K +++ /dev/null @@ -1,130 +0,0 @@ -This file describes the implementation notes of the GNU C Compiler for -the National Semiconductor 32032 chip (and 32000 family). - -The 32032 machine description and configuration file for this compiler -is, for NS32000 family machine, primarily machine independent. -However, since this release still depends on vendor-supplied -assemblers and linkers, the compiler must obey the existing -conventions of the actual machine to which this compiler is targeted. -In this case, the actual machine which this compiler was targeted to -is a Sequent Balance 8000, running DYNIX 2.1. - -The assembler for DYNIX 2.1 (and DYNIX 3.0, alas) does not cope with -the full generality of the addressing mode REGISTER RELATIVE. -Specifically, it generates incorrect code for operands of the -following form: - - sym(rn) - -Where `rn' is one of the general registers. Correct code is generated -for operands of the form - - sym(pn) - -where `pn' is one of the special processor registers (sb, fp, or sp). - -An equivalent operand can be generated by the form - - sym[rn:b] - -although this addressing mode is about twice as slow on the 32032. - -The more efficient addressing mode is controlled by defining the -constant SEQUENT_ADDRESS_BUG to 0. It is currently defined to be 1. - -Another bug in the assembler makes it impossible to compute with -explicit addresses. In order to compute with a symbolic address, it -is necessary to load that address into a register using the "addr" -instruction. For example, it is not possible to say - - cmpd _p,@_x - -Rather one must say - - addr _x,rn - cmpd _p,rn - - -The ns32032 chip has a number of known bugs. Any attempt to make the -compiler unaware of these deficiencies will surely bring disaster. -The current list of know bugs are as follows (list provided by Richard -Stallman): - -1) instructions with two overlapping operands in memory -(unlikely in C code, perhaps impossible). - -2) floating point conversion instructions with constant -operands (these may never happen, but I'm not certain). - -3) operands crossing a page boundary. These can be prevented -by setting the flag in tm.h that requires strict alignment. - -4) Scaled indexing in an insn following an insn that has a read-write -operand in memory. This can be prevented by placing a no-op in -between. I, Michael Tiemann, do not understand what exactly is meant -by `read-write operand in memory'. If this is referring to the special -TOS mode, for example "addd 5,tos" then one need not fear, since this -will never be generated. However, is this includes "addd 5,-4(fp)" -then there is room for disaster. The Sequent compiler does not insert -a no-op for code involving the latter, and I have been informed that -Sequent is aware of this list of bugs, so I must assume that it is not -a problem. - -5) The 32032 cannot shift by 32 bits. It shifts modulo the word size -of the operand. Therefore, for 32-bit operations, 32-bit shifts are -interpreted as zero bit shifts. 32-bit shifts have been removed from -the compiler, but future hackers must be careful not to reintroduce -them. - -6) The ns32032 is a very slow chip; however, some instructions are -still very much slower than one might expect. For example, it is -almost always faster to double a quantity by adding it to itself than -by shifting it by one, even if that quantity is deep in memory. The -MOVM instruction has a 20-cycle setup time, after which it moves data -at about the speed that normal moves would. It is also faster to use -address generation instructions than shift instructions for left -shifts less than 4. I do not claim that I generate optimal code for all -given patterns, but where I did escape from National's "clean -architecture", I did so because the timing specification from the data -book says that I will win if I do. I suppose this is called the -"performance gap". - - -Signed bitfield extraction has not been implemented. It is not -provided by the NS32032, and while it is most certainly possible to do -better than the standard shift-left/shift-right sequence, it is also -quite hairy. Also, since signed bitfields do not yet exist in C, this -omission seems relatively harmless. - - -Zero extractions could be better implemented if it were possible in -GCC to provide sized zero extractions: i.e. a byte zero extraction -would be allowed to yield a byte result. The current implementation -of GCC manifests 68000-ist thinking, where bitfields are extracted -into a register, and automatically sign/zero extended to fill the -register. See comments in ns32k.md around the "extzv" insn for more -details. - - -It should be noted that while the NS32000 family was designed to -provide odd-aligned addressing capability for multi-byte data (also -provided by the 68020, but not by the 68000 or 68010), many machines -do not opt to take advantage of this. For example, on the sequent, -although there is no advantage to long-word aligning word data, shorts -must be int-aligned in structs. This is an example of another -machine-specific machine dependency. - - -Because the ns32032 is has a coherent byte-order/bit-order -architecture, many instructions which would be different for -68000-style machines, fold into the same instruction for the 32032. -The classic case is push effective address, where it does not matter -whether one is pushing a long, word, or byte address. They all will -push the same address. - - -The macro FUNCTION_VALUE_REGNO_P is probably not sufficient, what is -needed is FUNCTION_VALUE_P, which also takes a MODE parameter. In -this way it will be possible to determine more exactly whether a -register is really a function value register, or just one that happens -to look right. diff --git a/contrib/gcc/README.RS6000 b/contrib/gcc/README.RS6000 deleted file mode 100644 index d29604f968ac..000000000000 --- a/contrib/gcc/README.RS6000 +++ /dev/null @@ -1,111 +0,0 @@ - AIX 3.1 and 3.2 assembler problems - -Specifying the -g flag to GCC on the RS/6000 requires upgrading the -standard AIX assembler distributed with AIX 3.1 and versions of AIX -3.2 earlier than 3.2.4 with a replacement that is available from IBM. -Note that Makefile.in specifies the -g when compiling libgcc2.c. - -You can test for the presence of a fixed assembler by entering the following: - % as -u < /dev/null -If the command exits normally, the assembler fix already is installed. -If the assembler complains that "-u" is an unknown flag, you need to order -the fix. - -If you are running AIX 3.1 (lslpp -h bos.obj output reports -03.01.0005.XXXX where the 0005 can be any higher number and the XXXX -can be any value), call IBM Support at 800-237-5511 and ask for -shipment of AIX/6000 fix PTF U403044 for APAR IX22829 (.extern foo -conflicts with defining foo). - -If you are running AIX 3.2 but not 3.2.4 or later (lslpp -h bos.obj -output reports 03.02.0000.0000), a newer update to the assembler fix -is available. Ask for shipment of AIX/6000 fix PTF U416277 for -IX32992 (.global prevents detection of duplicate symbol). - -If you are running AIX 3.2.4 or later, you already have the new -assembler. - -Any customer can order and get the replacement assembler, and install it on -one or more machines. It is available on diskette from IBM Customer Support -and from the IBM Internet fix anonymous ftp server (FixDist) at -aix.boulder.ibm.com (198.17.57.66). - -If you contact IBM Customer Support, they may also ask you for your customer -number. If you do not know it, you will still be able to get the fix, but -you will have to be persistent. IBM has corresponding support organizations -outside of North America. Call your IBM branch office and ask them to put -you in touch with the department that handles fixes for AIX/6000. If that -doesn't work, ask for the department that handles software defect support -for AIX/6000 and ask for the APAR fix. - -If you use the GNU assembler instead of the system supplied assembler, you need -an assembler modified after October 16th, 1995 in order to build the GNU C -compiler. This is because the GNU C compiler wants to build a variant of its -library, libgcc.a with the -mcpu=common switch to support building programs -that can run on either the Power or PowerPC machines. - - - AIX NLS problems - -AIX on the RS/6000 provides support (NLS) for environments outside of -the United States. Compilers and assemblers use NLS to support -locale-specific representations of various objects including -floating-point numbers ("." vs "," for separating decimal fractions). -There have been problems reported where the library linked with GCC does -not produce the same floating-point formats that the assembler accepts. -If you have this problem, set the LANG environment variable to "C" or -"En_US". - - - AIX 3.2.5 XLC-1.3 problems - -XLC version 1.3.0.0 distributed with AIX 3.2.5 will miscompile jump.c when -building the stage1 compiler during the bootstrap process. This will cause -GCC to crash and the bootstrap to fail later while compiling libgcc2.c. XLC -version 1.3.0.1 or later fixes this problem. XLC-1.3.0.19 also cannot -bootstrap GCC so please avoid that release as well. You can obtain -XLC-1.3.0.24 by requesting PTF 432238 from IBM, or just ask for the latest -release of XLC-1.3. - -There also have been reports of problems bootstrapping GCC with some older -releases of xlc-1.2.1, including xlc-1.2.1.8. Newer releases of xlc-1.2.1 -do not exhibit this problem: xlc-1.2.1.28 is known to bootstrap properly. - - - AIX 3.2 common-mode support - -AIX common-mode providing transparent support of both the POWER and PowerPC -architectures is usable in AIX 3.2.3 and above but an export file and -support for hidden export via libc.a will not exist until AIX 4.1. libgcc.a -also must be compiled in common-mode. Note that executables generated for -the POWER (RIOS1 and RSC) architecture will run directly on systems using -the MPC601 chip. Common-mode only improves the performance of a single -executable run on both POWER and PowerPC architecture platforms by not using -POWER- or PowerPC-specific instructions and eliminating the need to trap to -emulation (for POWER instructions run on PowerPC). - -To link a common-mode application prior to AIX 4.1 and run it on a system at -AIX level 3.2.3 or above, use the text between the "<>" as an export file -(e.g. milli.exp) - -<><><><><><><><><><><> -#! -__mulh 0x3100 -__mull 0x3180 -__divss 0x3200 -__divus 0x3280 -__quoss 0x3300 -__quous 0x3380 -<><><><><><><><><><><> - -and then link with -Wl,-bI:milli.exp. - - - AIX 4.1 binder - -Due to changes in the way that GCC invokes the binder (linker) for AIX 4.1, -the link step now may produce warnings of duplicate symbols which were not -reported before. The assembly files generated by GCC for AIX always have -included multiple symbol definitions for certain global variable and -function declarations in the original program. The warnings should not -prevent the linker from producing a correct library or runnable executable. diff --git a/contrib/gcc/README.TRAD b/contrib/gcc/README.TRAD deleted file mode 100644 index 07ccd16437b1..000000000000 --- a/contrib/gcc/README.TRAD +++ /dev/null @@ -1,55 +0,0 @@ -This is a partial list of how `gcc -traditional' disagrees with -traditional C compilers (perhaps only some of them). Most of these -differences are not bugs. - ---------------------------------------------------------------------------- -K&R-1 (2.4.3) says: - - "If the character following a backslash is not one of those - specified {in the table above}, the backslash is ignored." - -Up until recently, `gcc -traditional' complained about \x \a and \v -appearing in a character or string literal. I believe however that -this non-feature has been eliminated (recently). - ---------------------------------------------------------------------------- -When in -traditional mode, gcc allows the following erroneous pair of -declarations to appear together in a given scope: - - typedef int foo; - typedef foo foo; - ---------------------------------------------------------------------------- -K&R-1 (8.5) says: - - "No field may be wider than a word." - -Gcc however allows: - - struct S { int i:33; }; - ---------------------------------------------------------------------------- -In K&R-1 there is no restriction against comments crossing include file -boundaries. Gcc however doesn't allow this, even when in -traditional mode. - ---------------------------------------------------------------------------- -Regarding the length of identifiers, K&R-1 (2.2) says: - - "No more than the first eight characters are significant, - although more may be used." - -Gcc treats all characters of identifiers as significant, even when in --traditional mode. - ---------------------------------------------------------------------------- -K&R-1 (2.2) says: - - "An identifier is a sequence of letters and digits; the first - character must be a letter. The underscore _ counts as a letter." - -Gcc also allows dollar signs in identifiers. (This may also be an issue -for the -pedantic option.) - ---------------------------------------------------------------------------- - - diff --git a/contrib/gcc/README.X11 b/contrib/gcc/README.X11 deleted file mode 100644 index 359dd5f96030..000000000000 --- a/contrib/gcc/README.X11 +++ /dev/null @@ -1,447 +0,0 @@ -[This file contains two alternative recipes for compiling X11 with GCC. -The first alternative puts libgcc.a into the shared X library; the second -does not. Neither alternative works on all kinds of systems. -It may be that when using GCC 2.4, both alternatives work okay on -relatively recent Sparc systems. The first alternative is likely -not to work on a Sun 3 without hardware floating point.] - -How to compile X11R5 (patch level 11) with GCC version 2: - -The patches include support for building the shared libraries with GCC -2 on the Sparc and 68k machines. This version includes the necessary -parts of libgcc.a in the shared library for X, in case functions in -that library need it. Thus the default behavior is now to build -everything, including the libraries, with gcc. - -If you build the shared library this way, it may not work with -executables made with older versions of GCC (2.3.3 and earlier). -If that happens, relink those executables with the latest GCC. -IF YOU THINK YOU MIGHT COMPILE X FOR SOLARIS 2, then you really don't -need this patch: get /contrib/R5.SunOS5.patch.tar.Z from -export.lcs.mit.edu instead. It has everything you need to do the -build for Solaris 2, sets you up to everything with GCC, and is -backward compatible with Sunos 4.*. Get the the README -(/contrib/R5.SunOS5.patch.README at export) for more info. - -If you see undefined symbols _dlopen, _dlsym, or _dlclose when linking -with -lX11, compile and link against the file mit/util/misc/dlsym.c in -the MIT X11R5 distribution. Alternatively, do dynamic linking -by using a non-GNU ld. - -mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2. -If -fstrength-reduce (or any other -f option) is a major win, then it -will most likely be turned on by -O2 optimization. - -mit/config/sunLib.rules -- If HasGcc and GccVersion > 1 are true, then -use gcc -fpic to generate PIC code. Make sure that gcc does not use -gas (the GNU assembler) when compiling PIC code; gas does not assemble -it correctly. - -***If you have gas installed where gcc uses it by default, you might have -to add -B/bin/ to the PositionIndependentCFlags.*** - -mit/config/site.def -- Define GccVersion to be 2. - -mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization. - -mit/config/sunLib.rules -- When compiling with GCC 2, use -fpic for -position independent code generation. - -mit/rgb/Imakefile -- No longer need to compile some modules with -cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code. - -mit/server/os/Imakefile -- Likewise. - -mit/server/ddx/sun/Imakefile -- When compiling with GCC 2, some modules -should be compiled with -fvolatile. - -mit/clients/twm/Imakefile -- Fix bad decls of malloc, realloc in gram.c. - -mit/lib/X/Imakefile -- Make libgcc.a a required lib for libX11.so - -*** mit/clients/twm/Imakefile Mon May 17 22:05:22 1993 ---- new/clients/twm/Imakefile Mon May 17 22:28:46 1993 -*************** -*** 32,41 **** ---- 32,48 ---- - ComplexProgramTarget(twm) - InstallNonExecFile(system.twmrc,$(TWMDIR)) - -+ #if HasGcc && GccVersion > 1 && defined (SunArchitecture) - gram.h gram.c: gram.y - yacc $(YFLAGS) gram.y -+ sed -e 's/^extern char \*malloc(), \*realloc();//g' y.tab.c >gram.c -+ $(MV) y.tab.h gram.h -+ #else -+ gram.h gram.c: gram.y -+ yacc $(YFLAGS) gram.y - $(MV) y.tab.c gram.c - $(MV) y.tab.h gram.h -+ #endif - - clean:: - $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c -*** mit/config/Imake.tmpl Mon May 17 22:02:57 1993 ---- new/config/Imake.tmpl Mon May 17 22:15:06 1993 -*************** -*** 500,506 **** ---- 500,510 ---- - #endif - #ifndef CcCmd - #if HasGcc -+ #if GccVersion > 1 -+ #define CcCmd gcc -fpcc-struct-return -+ #else - #define CcCmd gcc -fstrength-reduce -fpcc-struct-return -+ #endif - #else - #define CcCmd cc - #endif -*** mit/config/site.def Mon May 17 22:02:44 1993 ---- new/config/site.def Mon May 17 22:22:28 1993 -*************** -*** 25,31 **** - - #ifdef BeforeVendorCF - -! /* #define HasGcc YES */ - - #endif /* BeforeVendorCF */ - ---- 25,33 ---- - - #ifdef BeforeVendorCF - -! #define HasGcc YES -! /* GccVersion > 1 implies building shared libraries with gcc */ -! #define GccVersion 2 - - #endif /* BeforeVendorCF */ - -*** mit/config/sun.cf Mon May 17 22:03:02 1993 ---- new/config/sun.cf Mon May 17 22:24:55 1993 -*************** -*** 41,49 **** ---- 41,55 ---- - - #if HasGcc - -+ #if GccVersion > 1 -+ #define OptimizedCDebugFlags -O2 -+ #else -+ #define OptimizedCDebugFlags -O - #define SharedLibraryCcCmd cc - #define ExtraLoadFlags -B/usr/bin/ - #define AllocateLocalDefines /**/ -+ #endif -+ - - .c.o: - $(CC) -c $(CFLAGS) $*.c -*** mit/config/sunLib.rules Mon May 17 22:02:46 1993 ---- new/config/sunLib.rules Mon May 17 22:19:06 1993 -*************** -*** 23,29 **** ---- 23,33 ---- - #define SharedLibraryLoadFlags -assert pure-text - #endif - #ifndef PositionIndependentCFlags -+ #if defined(HasGcc) && GccVersion > 1 -+ #define PositionIndependentCFlags -fpic -+ #else - #define PositionIndependentCFlags -pic -+ #endif - #endif - - /* -*** mit/lib/X/Imakefile Mon May 17 22:05:03 1993 ---- new/lib/X/Imakefile Mon May 17 22:32:26 1993 -*************** -*** 9,14 **** ---- 9,31 ---- - #define MotifBC NO - #endif - -+ #if defined(SunArchitecture) -+ #if SystemV4 -+ #if HasGcc -+ REQUIREDLIBS= -lgcc -lc -+ #else -+ REQUIREDLIBS= -lc -+ #endif -+ #else -+ #if HasGcc && GccVersion > 1 -+ XCOMM Hack to fix gcc 2 ``-nostdlib'' deficiency on SunOS 4.x -+ REQUIREDLIBS= `gcc -v 2>&1 | awk '{print $$4}' | sed -e 's/specs$$/libgcc.a/'` -+ #else -+ REQUIREDLIBS= -+ #endif -+ #endif -+ #endif -+ - #ifndef BuildXimp - #define BuildXimp NO - #endif -*** mit/rgb/Imakefile Mon May 17 22:05:31 1993 ---- new/rgb/Imakefile Mon May 17 22:25:30 1993 -*************** -*** 17,23 **** - #if !(defined(SGIArchitecture) || SystemV4) - DBMLIB = -ldbm - #endif -! #if defined(SparcArchitecture) && HasGcc - CC = cc - CCOPTIONS = /**/ - EXTRA_LOAD_FLAGS = /**/ ---- 17,23 ---- - #if !(defined(SGIArchitecture) || SystemV4) - DBMLIB = -ldbm - #endif -! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1 - CC = cc - CCOPTIONS = /**/ - EXTRA_LOAD_FLAGS = /**/ -*** mit/server/ddx/sun/Imakefile Mon May 17 22:05:57 1993 ---- new/server/ddx/sun/Imakefile Mon May 17 22:27:23 1993 -*************** -*** 43,48 **** ---- 43,53 ---- - LinkFile(sunGX.o,sunGX.o.dist) - #endif - -+ #if HasGcc && GccVersion > 1 -+ SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile) -+ SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile) -+ #endif -+ - sunInitExtMono.o: $(ICONFIGFILES) - ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT) - ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY) -*** mit/server/os/Imakefile Mon May 17 22:05:46 1993 ---- new/server/os/Imakefile Mon May 17 22:26:02 1993 -*************** -*** 132,138 **** - SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES)) - SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES)) - SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES)) -! #if defined(SparcArchitecture) && HasGcc - oscolor.o: $(ICONFIGFILES) - $(RM) $@ - cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c ---- 132,138 ---- - SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES)) - SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES)) - SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES)) -! #if defined(SparcArchitecture) && HasGcc && GccVersion <= 1 - oscolor.o: $(ICONFIGFILES) - $(RM) $@ - cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c - - -[This is the older version] - -How to compile X11R5 (patch level 11) with GCC version 2: - -The patches include support for building the shared libraries with GCC 2 on -the Sparc and 68k machines. - -NOTE: Such shared libraries built with GCC version 2.3 DID NOT WORK -with executables previously linked using Sun CC! This is because -neither those executables nor the gcc-compiled shared libraries contain -libgcc.a. The shared libraries did work with executables linked using -GCC (running the Sun linker, of course) because GCC tells the linker to -link in libgcc.a. Because of these limitations the default behavior is -to NOT build the shared libraries with gcc. - -Changes in GCC 2.4 seem to have eliminated the problem, and such a -shared library now seems work with all executables. If you want the -gcc-compiled shared libraries turn on "Gcc2BuildLibs" in site.def. If -you try this, please tell bug-gcc@prep.ai.mit.edu whether it works. - -Sun forgot to include a static version of libdl.a with some versions -of SunOS (4.1 mainly). If you see undefined symbols _dlopen, _dlsym, -or _dlclose when linking with -lX11, compile and link against the file -mit/util/misc/dlsym.c in the MIT X11R5 distribution. - -mit/config/Imake.tmpl -- Do not set -fstrength-reduce if we have GCC 2. If --fstrength-reduce (or any other -f option) is a major win, then it will -most likely be turned on by -O2 optimization. - -mit/config/sunLib.rules -- If HasGcc2 and Gcc2BuildLibs are defined, then -use gcc -fpic to generate PIC code. Make sure that gcc does not use gas (the -GNU assembler) when compiling PIC code; gas does not assemble it correctly. -If you have gas installed where gcc uses it by default, you might have to add --B/bin/ to the PositionIndependentCFlags. - -mit/config/site.def -- Define HasGcc2 to be YES. - -mit/config/sun.cf -- When compiling with GCC 2, use -O2 optimization. - -mit/rgb/Imakefile -- No longer need to compile some modules with -cc on the Sparc since GCC 2 produces proper -fpcc-struct-return code. - -mit/server/os/Imakefile -- Likewise. - -mit/clients/twm/Imakefile -- fix bad decls of malloc, realloc in gram.c. - -*** mit/config/Imake.tmpl.ORIG Tue Dec 31 11:07:56 1991 ---- mit/config/Imake.tmpl Tue Dec 31 12:30:47 1991 -*************** -*** 499,508 **** ---- 499,512 ---- - #define HasGcc NO - #endif - #ifndef CcCmd -+ #if HasGcc2 -+ #define CcCmd gcc -fpcc-struct-return -+ #else - #if HasGcc - #define CcCmd gcc -fstrength-reduce -fpcc-struct-return - #else - #define CcCmd cc -+ #endif - #endif - #endif - #if HasFortran -*** mit/config/sunLib.rules.ORIG Tue Dec 31 11:11:24 1991 ---- mit/config/sunLib.rules Tue May 5 12:26:12 1992 -*************** -*** 23,30 **** ---- 23,34 ---- - #define SharedLibraryLoadFlags -assert pure-text - #endif - #ifndef PositionIndependentCFlags -+ #if defined(HasGcc2) && defined (Gcc2BuildLibs) -+ #define PositionIndependentCFlags -fpic -+ #else - #define PositionIndependentCFlags -pic - #endif -+ #endif - - /* - * InstallSharedLibrary - generate rules to install the shared library. -*** mit/config/site.def.ORIG Tue Dec 31 11:13:49 1991 ---- mit/config/site.def Tue Dec 31 12:02:59 1991 -*************** -*** 25,31 **** - - #ifdef BeforeVendorCF - -! /* #define HasGcc YES */ - - #endif /* BeforeVendorCF */ - ---- 25,33 ---- - - #ifdef BeforeVendorCF - -! #define HasGcc YES -! #define HasGcc2 YES -! /* #define Gcc2BuildLibs YES */ - - #endif /* BeforeVendorCF */ - -*** mit/config/sun.cf.ORIG Tue Dec 31 11:13:57 1991 ---- mit/config/sun.cf Tue May 5 12:29:50 1992 -*************** -*** 34,42 **** ---- 41,61 ---- - - #if HasGcc - -+ #if defined(HasGcc2) -+ #define OptimizedCDebugFlags -O2 -+ /* Leave Alone XXX */ -+ #else -+ #define OptimizedCDebugFlags -O - #define SharedLibraryCcCmd cc - #define ExtraLoadFlags -B/usr/bin/ - #define AllocateLocalDefines /**/ -+ #endif -+ -+ #if !defined(Gcc2BuildLibs) -+ #define SharedLibraryCcCmd cc -+ #define ExtraLoadFlags -B/usr/bin/ -+ #define AllocateLocalDefines /**/ -+ #endif - - .c.o: - $(CC) -c $(CFLAGS) $*.c -*** mit/rgb/Imakefile.ORIG Wed Jan 15 16:43:18 1992 ---- mit/rgb/Imakefile Thu Jan 2 13:34:09 1992 -*************** -*** 17,23 **** - #if !(defined(SGIArchitecture) || SystemV4) - DBMLIB = -ldbm - #endif -! #if defined(SparcArchitecture) && HasGcc - CC = cc - CCOPTIONS = /**/ - EXTRA_LOAD_FLAGS = /**/ ---- 17,23 ---- - #if !(defined(SGIArchitecture) || SystemV4) - DBMLIB = -ldbm - #endif -! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2) - CC = cc - CCOPTIONS = /**/ - EXTRA_LOAD_FLAGS = /**/ -*** mit/server/os/Imakefile.ORIG Wed Jan 15 16:46:23 1992 ---- mit/server/os/Imakefile Wed Jan 15 16:46:48 1992 -*************** -*** 132,138 **** - SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES)) - SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES)) - SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES)) -! #if defined(SparcArchitecture) && HasGcc - oscolor.o: $(ICONFIGFILES) - $(RM) $@ - cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c ---- 132,138 ---- - SpecialObjectRule(osinit.o,$(ICONFIGFILES),$(ADM_DEFINES)) - SpecialObjectRule(WaitFor.o,$(ICONFIGFILES),$(EXT_DEFINES)) - SpecialObjectRule(fonttype.o,$(ICONFIGFILES),$(FONT_DEFINES)) -! #if defined(SparcArchitecture) && HasGcc && !defined(HasGcc2) - oscolor.o: $(ICONFIGFILES) - $(RM) $@ - cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c -*** 1.1 1992/09/08 19:52:07 ---- mit/server/ddx/sun/Imakefile 1992/09/08 21:10:22 -*************** -*** 43,48 **** ---- 43,53 ---- - LinkFile(sunGX.o,sunGX.o.dist) - #endif - -+ #if HasGcc2 -+ SpecialObjectRule(sunCG2C.o,sunCG2C.c,-fvolatile) -+ SpecialObjectRule(sunCG2M.o,sunCG2M.c,-fvolatile) -+ #endif -+ - sunInitExtMono.o: $(ICONFIGFILES) - ObjectFromSpecialSource(sunInitExtMono,../mi/miinitext,-UPEXEXT) - ObjectFromSpecialSource(sunInitMono,sunInit,-DMONO_ONLY) - -*** /tmp/RCSAa24446 Tue Sep 15 12:23:32 1992 ---- mit/clients/twm/Imakefile Thu Aug 13 18:18:07 1992 -*************** -*** 32,41 **** ---- 32,48 ---- - ComplexProgramTarget(twm) - InstallNonExecFile(system.twmrc,$(TWMDIR)) - -+ #if HasGcc2 && defined (SunArchitecture) - gram.h gram.c: gram.y - yacc $(YFLAGS) gram.y -+ sed -e 's/^extern char \*malloc(), \*realloc();//g' y.tab.c >gram.c -+ $(MV) y.tab.h gram.h -+ #else -+ gram.h gram.c: gram.y -+ yacc $(YFLAGS) gram.y - $(MV) y.tab.c gram.c - $(MV) y.tab.h gram.h -+ #endif - - clean:: - $(RM) y.tab.h y.tab.c lex.yy.c gram.h gram.c lex.c deftwmrc.c - diff --git a/contrib/gcc/README.g77 b/contrib/gcc/README.g77 deleted file mode 100644 index f22f1799c35e..000000000000 --- a/contrib/gcc/README.g77 +++ /dev/null @@ -1,263 +0,0 @@ -1998-08-11 - -This directory contains the egcs variant of version 0.5.24 of the -GNU Fortran compiler (g77). The GNU Fortran compiler is free software. -See the file COPYING.g77 for copying permission. - -Currently, two variants of g77 exist. One is the Free Software Foundation -(FSF) variant. The other is the egcs variant. As of egcs version 1.1, -these variants are kept fairly similar in most respects. Pertinent -differences, such as the layout of the source code, are specified below. - -Below, `[FSF]' denotes information applicable to only the FSF variant of -g77, while `[egcs]' denotes egcs-only information. - - -* IMPORTANT: Things you *must* do (or avoid) are marked with a * at the - beginning of the line in this file!!! - - -The email address to which bugs are to be reported is either -[FSF] or [egcs] . - -* *DO NOT* send any email (reporting bugs, asking questions, etc.) to - either of these addresses without *first* reading the g77 documentation. - Use `info', Info mode in GNU Emacs, or a text viewer such as `more' to - do this. - - The g77 documentation is in the source files named `g77.info', - `g77.info-1', `g77.info-2', and so on in the `f' subdirectory. If these - files are not present or you can't find them, contact the person or - organization that put together the g77 distribution you are using (probably - not the FSF or egcs), or ask your system administrator for help. - - -This README applies to only the g77-specific portions of the source-code -tree that contains it. These portions include: - - - The README.g77 and [FSF] COPYING.g77 files, in this directory, "this - directory" being [FSF] the top-level directory containing a g77 - distribution or [egcs] the gcc/ subdirectory of an egcs distribution. - - - The g77 front end, in the f/ subdirectory of this directory. - - - The libg2c library, in [FSF] the f/runtime/ subdirectory of this - directory or [egcs] the libf2c/ directory under the top-level - directory of the egcs distribution. - - -* To build g77, you must have a source distribution of [FSF] gcc - version 2.8 or [egcs] egcs version 1.1. Do not attempt to use - any other version of gcc or egcs, because this version of g77 is - designed to work with only those versions. - - Note that you must have *source* copies of the gcc or egcs distribution! - You cannot build g77 just using binaries of gcc or egcs. Also, unless - you are an expert, avoid using any distribution of gcc or egcs not - identical to the ones distributed by the FSF and Cygnus Support, - respectively. The primary FSF distribution site is: - - - - The primary egcs distribution site is: - - - - Both of these sites have approved mirror sites from which valid - distributions also may be obtained. - -* Do not attempt to combine the egcs version of g77 with the FSF - gcc distribution, or the FSF version of g77 with the egcs gcc - distribution. Although the differences are minor, they might - be sufficient to prevent g77 from building properly, or from - working properly if the build appears to succeed. - -[FSF] g77 is distributed as g77-/f/ so that unpacking the g77 -distribution is done in the normal GNU way, resulting in a directory having -the version number in the name. However, to build g77, the g77 distribution -must be merged with an appropriate gcc distribution, normally in a gcc -source directory, before configuring, building, and installing g77. - -[FSF] If you have just unpacked the g77 distribution, before proceeding, -you must merge the contents of the g77 distribution with the appropriate -gcc distribution on your system. - -* [FSF] Read and follow the instructions in f/INSTALL that - explain how to merge a g77 source directory into a gcc source - directory. You can use Info to read the same installation - instructions via: - - info -f f/g77.info -n Unpacking - -[FSF] The resulting directory layout includes the following, where gcc/ -might be a link to, for example, gcc-2.8.1/: - - gcc/ Non-g77 files in gcc - gcc/COPYING.g77 A copy of the GPL, under which g77 is licensed - gcc/README.g77 This file - gcc/f/ GNU Fortran front end - gcc/f/runtime/ libg2c configuration and g2c.h file generation - gcc/f/runtime/libF77/ Non-I/O portion of libg2c - gcc/f/runtime/libI77/ I/O portion of libg2c - gcc/f/runtime/libU77/ Additional interfaces to libc for libg2c - -[FSF] Applying g77 patches in the form of .diff files is done by typing -`patch -p1 -d gcc' (where gcc/ contains the f/ subdirectory). That is, -g77 patches are distributed in the same form, and at the same directory -level, as patches to the gcc distribution. (Note: make sure you're -using GNU patch, version 2.5 or later! Other versions of patch -have trouble with g77-related patches.) - -[egcs] The egcs version of g77 is distributed already merged with -the rest of egcs (such as the gcc back end). - -[egcs] The resulting directory layout includes the following, where egcs/ -might be a link to, for example, egcs-1.1/: - - egcs/gcc/ Non-g77 files in gcc - egcs/gcc/README.g77 This file - egcs/gcc/f/ GNU Fortran front end - egcs/libf2c/ libg2c configuration and g2c.h file generation - egcs/libf2c/libF77/ Non-I/O portion of libg2c - egcs/libf2c/libI77/ I/O portion of libg2c - egcs/libf2c/libU77/ Additional interfaces to libc for libg2c - -[egcs] Applying g77-specific patches to egcs is done the same way as -applying other egcs patches. - - -Below, `libf2c/' shall denote [FSF] gcc/f/runtime/ or [egcs] egcs/libf2c/, -while `f/' shall denote [FSF] the rest of gcc/f/ or [egcs] egcs/gcc/f/. - - -Components of note in g77 are described below. - -f/ as a whole contains the program GNU Fortran (g77), while libf2c/ -contains a portion of the separate program f2c. Note: The libf2c -code is not part of the program g77, just distributed with it. - -f/ contains text files that document the Fortran compiler, source -files for the GNU Fortran Front End (FFE), and some other stuff. -The g77 compiler code is placed in f/ because it, along with its contents, -is designed to be a subdirectory of a GNU CC (gcc) source directory, gcc/, -which is structured so that language-specific front ends can be "dropped -in" as subdirectories. The C++ front end (g++), is an example of this -- -it resides in the cp/ subdirectory. Note that the C front end (also -referred to as gcc) is an exception to this, as its source files reside -in the gcc/ directory itself. - -libf2c/ contains the run-time libraries for the f2c program, also used -by g77. These libraries normally referred to collectively as libf2c. -When built as part of g77, libf2c is installed under the name libg2c to avoid -conflict with any existing version of libf2c, and thus is often referred -to as libg2c when the g77 version is specifically being referred to. - -The netlib version of libf2c/ contains two distinct libraries, libF77 and -libI77, each in their own subdirectories. In g77, this distinction is not -made, beyond maintaining the subdirectory structure in the source-code tree. - -libf2c/ is not part of the program g77, just distributed with it. It -contains files not present in the official (netlib) version of libf2c, -and also contains some minor changes made from libf2c, to fix some bugs, -and to facilitate automatic configuration, building, and installation of -libf2c (as libg2c) for use by g77 users. - -* See libf2c/README for more information, including licensing conditions - governing distribution of programs containing code from libg2c. - -libg2c, g77's version of libf2c, adds Dave Love's implementation of -libU77, in the libf2c/libU77/ directory. This library is distributed -under the GNU Library General Public License (LGPL) -- see the -file libf2c/libU77/COPYING.LIB for more information, as this license -governs distribution conditions for programs containing code from -this portion of the library. - - -Files of note in g77 are described below. - -f/BUGS lists some important bugs known to be in g77. Or: - - info -f f/g77.info -n "Actual Bugs" - -f/ChangeLog lists recent changes to g77 internals. - -libf2c/ChangeLog lists recent changes to libg2c internals. - -[FSF] f/INSTALL describes how to build and install GNU Fortran. Or: - - info -f f/g77.info -n Installation - -f/NEWS contains the per-release changes. These include the user-visible -changes described under "Changes" in the g77 documentation, plus internal -changes of import. Or: - - info -f f/g77.info -n News - -* All users of g77 (not just installers) should read f/g77.info* - as well, using the `more' command if neither the `info' command, - nor GNU Emacs (with its Info mode), are available, or if they - aren't yet accustomed to using these tools. Read f/BUGS and f/NEWS - plus, if you are planning on building or installing the FSF version - of g77, f/INSTALL, at the very least! All of these files are - readable as "plain text" files. - -* Also see for up-to-date information - regarding g77 bug reports, known bugs, bug-fixes, and new versions. - - -The rest of this file is of note to only those who wish to -debug, modify, or test the FFE (in conjunction with the gcc back end). - -If you want to explore the FFE code, which lives entirely in f/, here -are a few clues. The file g77spec.c contains the g77-specific source code -for the `g77' command only -- this just forms a variant of the `gcc' -command, so, just as the `gcc' command itself does not contain -the C front end, the `g77' command does not contain the Fortran front -end (FFE). The FFE code ends up in an executable named `f771', which -does the actual compiling, so it contains the FFE plus the gcc back end -(the latter to do most of the optimization, and the code generation). - -The file parse.c is the source file for main() for a stand-alone FFE and -yyparse() for f771. (Stand-alone building of the FFE doesn't work these days.) -The file top.c contains the top-level FFE function ffe_file and it (along -with top.h) define all ffe_[a-z].*, ffe[A-Z].*, and FFE_[A-Za-z].* symbols. -The file fini.c is a main() program that is used when building the FFE to -generate C header and source files for recognizing keywords. The files -malloc.c and malloc.h comprise a memory manager that defines all -malloc_[a-z].*, malloc[A-Z].*, and MALLOC_[A-Za-z].* symbols. All other -modules named are comprised of all files named *. and -define all ffe_[a-z].*, ffe[A-Z].*, and FFE_[A-Za-z].* symbols. -If you understand all this, congratulations -- it's easier for me to remember -how it works than to type in these grep patterns (such as they are). But it -does make it easy to find where a symbol is defined -- for example, -the symbol "ffexyz_set_something" would be defined in xyz.h and implemented -there (if it's a macro) or in xyz.c. - -The "porting" files of note currently are: proj.h, which defines the -"language" used by all the other source files (the language being -Standard C plus some useful things like ARRAY_SIZE and such) -- change -this file when you find your system doesn't properly define a Standard C -macro or function, for example; target.h and target.c, which describe -the target machine in terms of what data types are supported, how they are -denoted (what C type does an INTEGER*8 map to, for example), how to convert -between them, and so on (though as of 0.5.3, more and more of this information -is being dynamically configured by ffecom_init_0); com.h and com.c, which -interface to the target back end (currently only FFE stand-alone and the GBE); -ste.c, which contains code for implementing recognized executable statements -in the target back end (again currently either FFE or GBE); src.h and src.c, -which describe information on the format(s) of source files (such as whether -they are never to be processed as case-insensitive with regard to Fortran -keywords); and proj.c, which contains whatever code is needed to support -the language defined by proj.h. - -If you want to debug the f771 executable, for example if it crashes, -note that the global variables "lineno" and "input_filename" are set -to reflect the current line being read by the lexer during the first-pass -analysis of a program unit and to reflect the current line being -processed during the second-pass compilation of a program unit. If -an invocation of the function ffestd_exec_end() is on the stack, -the compiler is in the second pass, otherwise it is in the first. -(This information might help you reduce a test case and/or work around -a bug in g77 until a fix is available.) - -Any questions or comments on these topics? Read the g77 documentation! diff --git a/contrib/gcc/SERVICE b/contrib/gcc/SERVICE deleted file mode 100644 index 6404b7c6a137..000000000000 --- a/contrib/gcc/SERVICE +++ /dev/null @@ -1,1609 +0,0 @@ - -*- text -*- -GNU Service Directory ---------------------- - -This is a list of people who have asked to be listed as offering -support services for GNU software, including GNU Emacs, for a fee -or in some cases at no charge. - -The information comes from the people who asked to be listed; -we do not include any information we know to be false, but we -cannot check out any of the information; we are transmitting it to -you as it was given to us and do not promise it is correct. -Also, this is not an endorsement of the people listed here. -We have no opinions and usually no information about the abilities of -any specific person. We provide this list to enable you to contact -service providers and decide for yourself whether to hire one. - -Before FSF will list your name in the GNU Service Directory, we ask -that you agree informally to the following terms: - -1. You will not restrict (except by copyleft) the use or distribution -of any software, documentation, or other information you supply anyone -in the course of modifying, extending, or supporting GNU software. -This includes any information specifically designed to ameliorate the -use of GNU software. - -2. You will not take advantage of contact made through the Service -Directory to advertise an unrelated business (e.g., sales of -non-GNU-related proprietary information). You may spontaneously -mention your availability for general consulting, but you should not -promote a specific unrelated business unless the client asks. - -Please include some indication of your rates, because otherwise users -have nothing to go by. Please put each e-mail address inside "<>". -Please put nothing else inside "<>". Thanks! - -For a current copy of this directory, or to have yourself listed, ask: - gnu@gnu.org - -** Please keep the entries in this file alphabetical ** - -Alc?ve -12 place Indira Gandhi -92230 Gennevilliers -France - -http://www.alcove.fr -T?l.: +33 1 47 33 82 84 -Fax: +33 1 47 33 76 98 - -Alc?ve offers a comprehensive range of corporate-quality -Free Software related solutions, with technical support -via telephone, fax or email and remote system management. -We also offers consulting and training. - -Rates approximately 3000FF per day, depending on the job. - -Updated: 1998-09-09 - -Altrasoft -4880 Stevens Creek Blvd., Suite 205 -San Jose, CA 95129-1034 -+1 408 243 3300 -http://www.altrasoft.com - -Altrasoft provides corporate-quality support, development and user -documentation for GNU Emacs, XEmacs and InfoDock. (InfoDock is a turnkey -information management and software development toolset built atop emacs, -written by one of our associates.) Emacs distributions for a variety of -platforms are also available, as is support for other emacs variants, such as -those often found on PCs. - -Our unique focus on emacs-related work allows us to attract expert talent in -this area to keep you on the leading edge of productivity, especially if you -do software development work. We do the porting, patching, coding, -integrating, debugging, documenting and testing so that your people spend -much more productive time on their mainline tasks. - -Standard support packages include help on all aspects of the packages -supported, including all tools shipped as a standard part of the original -package distribution. In general, we want to give you an unbelievably strong -level of support, so where we can, we will also answer questions concerning -any add-on Lisp code that is used at your site. Setup and customization -help, bug fixes, and announcements of new releases are, of course, included. - -Support rates start at $1,500 USD, for single user support for one year. -Discounts are available for group contracts. We also offer Golden Support -contracts for those who need the absolute best in mission-critical support; -contact us for details. Hourly development rates and fixed bid work are -available. - -Updated: 1997-05-12 - -Magnus Alvestad - -GNU Emacs, GCC, the Unix tools, Linux, Jolt. - -Rates: Free, or from $50/hour. - -Updated: 1997-05-09 - -AO UrbanSoft -St. Petersburg State University Science Campus -St. Petersburg, Russia -www.usoft.spb.ru - -AO UrbanSoft packages, markets and supports -industry standard free software products, -including the Linux operating system and -TeX document compiler. -The company also provides programming services -based on TeX, Tk, Python, HTML, Java, Perl and -Intranet. - -Rates approximately 15 USD per hour. - -Updated: 1997-05-25 - -Joseph Arceneaux -307 Chattanooga St. http://www.arceneaux.com -San Francisco, CA 94114 -+1 415 648 9988 - -I am a former FSF staffmember who made Wells Fargo Bank the first bank -to provide secure banking over the Internet. I have 20 years -experience with various computer systems. I performed the X11 -implementation of Emacs version 19, and designed and implemented -WYSIWYG features of Emacs. I also installed and administered FSF -network. Maintainer of GNU indent. - -I provide installation, porting, debugging and customization or -development of GNU and other software. I also design and implement -free software projects and consult on software engineering, security, -and intranet design. - -Time and material rates around $150 USD per hour, depending upon the -particular job. I am also very interested in fixed-bid jobs. For -selected non-profit organizations with worthy goals, I work for free. - -Updated: 1998-06-24 - -Dipl.-Inform. Gerd Aschemann -Osannstr. 49 -D-64285 Darmstadt -Tel.: +49 6151 16 2259 -http://www.informatik.tu-darmstadt.de/VS/Mitarbeiter/Aschemann/ - -- System Administrator (UNIX and NT) at CS Department, TU Darmstadt, Germany -- 18 years working in the CS field, System administration on different platforms -- 12 years with UNIX/Networking/FreeWare/GNU/X11 -- 9 years courses on Operating Systems and Distributed Systems -- Lectures on System and Network Administration -- Platforms: Solaris, Linux, SunOS, Ultrix, HP-UX, Digital Unix, AIX, SCO, FreeBSDs -- Distributed Platforms and Information Systems (CORBA, WWW, Java) -- Experience with parallel environments (Connection Machine, Meiko, Parsytec) -- Consultant - -Rates are at 150,-- DM (~85 US$) per hour minimum, depending on the job. -I am willing to travel for sufficiently large jobs. - -Updated: 1998-07-23 - - - Basis Technology Corp. - One Kendall Square, Bldg 200 - Cambridge, MA 02139 - U.S.A. - - Tel: +1-617-252-5636 - Fax: +1-617-252-9150 - E-mail: - Web: http://www.basistech.com - -Technical Expertise: - Multilingual software development - Internationalization and localization of software products - International character encodings, including Unicode, ISO-10646, - ISO-2022, ISO-8859-n, JIS, KSC5601, BIG5, GB2312 - Translation of technical materials into Japanese, Korean, and Chinese - including HTML, SGML, RTF, MIF, etc. - -GNU-related Services: - Custom internationalization and localization of GNU software, or - applications developed using GNU tools (GCC, G++, Emacs Lisp, etc.) - Custom multilingual application development based on MULE. - -GNU Contributions: - Organized 1992, 1993, and 1994 fund-raising seminars and lecture - tours for FSF in Japan. - Negotiated book royalty agreements with Japanese publishers on - behalf of the FSF. - Negotiated hardware contributions from Japanese PC vendors to - the FSF. - -Contacts: - Carl Hoffman, Steve Cohen, or Karen Watts - -Updated: 1998-07-23 - -Laurent Bernardin -16, rue Dicks -L-6944 Niederanven -Luxemburg - -+41 1 632 7469 - -Support and installation of all GNU software. - -Expertise: C, C++, Java, Motif, X, Unix administration, network security - -Rates: ~60 US$ / hour (Flux 2000.-) - -Updated: 1998-07-23 - -Dean Brettle Computer Consulting - - -http://www.brettle.com/ - -7485 Rush River Drive -Suite 710-193 -Sacramento, CA 95831 -916-422-8129 - -I provide development, technical support, and training for free software -and open source systems including GNU/Linux, the GNU development suite, -Tcl/Tk, Emacs, and the GIMP. - -I have over 9 years experience building and maintaining systems ranging -from computed tomography systems to airborne sensor control systems -- -all with free software. - -Rates range from $65.00/hr to $72.50/hr USD, depending upon work -location. I am also willing to work on fixed price contracts. - -Updated: 1998-07-07 - -Philip Brown - -(703) 893-8967 (prefer email) -Northern-VA, D.C. Area (world-wide via internet) -Rates: $45/Hr + extra for site visit; less for educational or charitable organizations - -Systems Supported: - - Sun boxes running Solaris 2.5-up - HP9000s running HP/UX 8.07 - 10.X - IBM RS6000 running AIX 3.2.X-up - Also SGI/Indy - -Software Supported: - Most all FSF (Gnu) software - esp. GCC, GDB, Emacs, Binutils, GS, et al... - -Statement: - I'd be more than happy to assist anyone in my area with acquiring, - installing, and configuring any FSF tools/utilities on any of the - above systems. I'm also willing to work with other UNIX systems not - listed above. In addition, I'm glad to share my many years of - experience with anyone having difficulty using or configuring these - tools. I've been installing and using them for about 5 years now - and I'll swear by their quality and the people/principles that made - them available. - - - Phil Brown - -Updated: 1998-07-23 - -James Craig Burley -97 Arrowhead Circle -Ashland, MA 01721-1987 -(Email and postal mail contacts only, please.) -Email: - -Expertise: - Compiler Internals (author of GNU Fortran, for example) - Operating Systems Internals - Tools/Utilities Development and Maintenance - Microcode Development and Maintenance (primarily VLIW machines) - System Design (computers, operating systems, toolsets, &c) - Debugging (often asked to help debug Other People's Code) - Documentation (authored many books and ran a few doc projects) - Extensive experience with a variety of operating systems, hardware, - languages, and so on - -Rate: $100/hour -- willing to consider flat-fee arrangements - -Updated: 1999-02-01 - -Thomas Bushnell, BSG -Becket House -66 Highland Ave. No. 8 -Somerville, MA 02143 -(617) 623-0654 - -All GNU software: Installation, customization, answering simple or - complex questions, bug fixing, extension. - -Experience: I have done Unix and GNU programming for many years. - I am the primary author of the Hurd (which provides most - kernel related facilities for the GNU OS). - -I am easily available in the Cambridge/Boston area; work via email. -I am willing to travel for sufficiently large jobs. - -Rates: $100/hr, negotiable, less for non-profit organizations. - -Updated: 1998-07-27 - -C2V Michel Delval -82 bd Haussmann Jean-Alain Le Borgne -75008 Paris -France -Tel (33 1) 40.08.07.07 -Fax (33 1) 43.87.35.99 -Compuserve 100413,1012 -http://www.c2v.com/freesoft.htm -e-mail: - -Services: we offer source or source+binary distribution, -installation, training, maintenance, technical support, -consulting, specific development and followup on the GNU software -development environment: Emacs, gcc/g++, binutils, gas, gdb. - -Porting on new platforms, and professionally developing software -with the GNU tools in the Unix/X11 environment since they were -first available. - -Experience: GNU C Compilation toolchain for the SGS-Thomson D950 -and ST20 DSP chips. - -GNU C compilation toolchain (cross-compiler, compiler, linker, -assembler, debugger) for SparcV7 ERC32 based space systems -(Sextant Avionique / Alcatel Espace). - -Feasability study, analysis and prototyping of a complete -compilation toolchain based on the GNU programming tools for the -CSEM RISC microprocessor family. - -Rates: from 2000 FF/day to 150 000 FF/year, 40% discount for -educational institutions, add taxes and expenses. Ask for list. - -Updated: 1998-07-23 - -Bruce Dawson - -CodeMeta, Inc. -Manchester, NH USA -800-354-2209 - -Specializing in GNU tools such as guile, CVS, gnats, bash, gawk, fileutils... - -Services: - - o 800 phone support. - - o Modification and development. - - o Training. - -Rate: $75/hour or per quote. - -http://www.codemeta.com - -Updated: 1998-07-23 - -Kevin Cosgrove - - - I can help folks with porting & installation of many GNU - and X packages on a variety of Unix platforms. - - - My rates depend on the scope of each project but range - from $35 to $90 per hour. - -Updated: 1997-05-07 - -Couvares Consulting -1312 Chandler St. -Madison, WI 53715 -Phone: (608) 256-6901 -Email: -Contact: Peter F. Couvares - -Type of support: We offer phone/email support, installation, systems -integration, systems programming, training, and specialized consulting -services for free software in UNIX and NT environments. - -Sample prices: USD100/hour commercial, 50/hour non-profit, sliding -scale for individuals. - -Updated: 1998-07-23 - -Stuart Cracraft -P.O. Box 6752 -Laguna Niguel, CA, 92607, USA -Phone: 714-308-7900 -Website: http://home.earthlink.net/~cracraft/index.html -Rate: $50/hour, and as appropriate for the project. - -Consultation topics: -Entire GNU suite - porting, compilation, installation, -user-training, administrator-training. - -Method: via any combination of telephone, dialup, Internet, in-person, email. - -Experience: supporting GNU since project inception, original port of -GNU Emacs to Sun Solaris, original author of GNU Emacs online tutorial. -Expertise in C, Emacs Lisp, Perl, Expect, Oracle, Informix, SunOS, Solaris, -NIS, NFS, system-monitoring via paging. Unix System and Database -administration or development. Coordinator of the GNU mascots: GNU Chess, -GNU Shogi, GNU Go. - -Updated: 1998-07-23 - -Noel Cragg -6244 Aberdeen Av -Goleta CA 93117 -805-964-1892 - -I'll do installation, debugging, and extension of GNU tools on a -contract basis. CVS and configuration management are my current -specialties. Rate: $75/hour or per-project negotiated fee. - -Updated: 1998-07-22 - -Cygnus Solutions - -1325 Chesapeake Terrace -Sunnyvale, CA 94089 USA -+1 408 542 9600 voice -+1 408 542 9699 fax - -Cygnus Solutions provides supported and maintained versions of gcc, g++, gdb -with GUI, GNU linker and GNU macro assembler. In addition, Cygnus provides -these GNU software development tools for well over 100 host-target -configurations. Support includes bug fixes and semi-annual releases of the -toolset. Each release is regression tested and includes substantial -improvements and additions to the current release. Support is available for -groups of 5 or 25 on a wide range of standard, special and vintage -toolchains for native and embedded applications. New target processors are -being added regularly. Rates for support for standard products start at $7495. - -Cygnus Solutions contacts: - - Kathy Powers - ph: +1-206-888-6002 - fx: +1-206-888-6145 - email: - - - Erik Westcott - ph: +1 408 542 9637 - fx: +1 408 542 9699 - email: -Updated: 1997-09-02 by rms - -Marcus G. Daniels -1399 Hyde Park Road -Santa Fe, NM 87501 -(505)984-8800 x267 - -I can customize, extend, port, and repair many types of free software. -I have software maintenance experience (e.g. CLISP, Swarm), and have -contributed to several GNU packages (e.g. Emacs). Twelve years of C -and Unix experience. Consulting rates start at $60 US/hr. - -Updated: 1998-07-22 - -DSS Distributed Systems Software, Inc. -7500 Abercrombie Dr., Suite 103 -Richmond, British Columbia V6Y 3J9 http://www.dss.bc.ca -CANADA (604) 270-9559 - -GNU-related services: - We specialize in support for GCC (mainly C and C++), including porting, - retargeting, and customizing. - Also, GNU and other free software that falls within our areas of expertise. - -Expertise: - DSS provides software design, implementation, and consulting services. - - Distributed systems: - o Client/Server architectures, computer networking, communication -protocols - o Directory systems, including X.500 and LDAP - o High-performance and special-purpose distributed systems and databases: - scalability, reliability, availability, transactions - o Computer systems performance analysis - - Compilers, translators, and interpreters, including "small" and - special-purpose languages - -Rates: - Consulting rates are $85-$300 (Canadian dollars) per hour, plus - applicable taxes. Fixed-cost projects are also possible. - -Updated: 1998-06-24 - -Echo Labs -29 Weld St, http://www.iinet.net.au/~echo/ -Nedlands, WA 6009 -Perth, Australia -+61 (0) 41 985 9603 - -Echo Labs is a software consultancy that also provides support and -development skills. Specialising in GNU software, particularly Tcl/Tk -and Linux. We can deliver systems at a fraction of the cost of those -based on more traditional technologies. Internet/intranet and data -communications solutions, for all platforms are undertaken. GUI -front-ends done quickly. - -While typically involved in engineering and technical areas, any -GNU/Open Source software will be supported. - -For further details see: http://www.iinet.net.au/~echo/ - -Experience: 13+ years C/Unix, Sun, SCO, Linux, Win/NT. - Secure WWW servers (Apache SSL), Ecommerce solutions. - Systems programming, device drivers, hardware interfacing. - GNU tools/utilities, Embedded & realtime systems. - Communications protocols and implementation. - -Degrees: BAppSc (CS), Curtin University, Perth - -Rates: AUS $50-75/hr neg. - -Updated: 1998-07-23 - -Andrew Ford -Ford & Mason Ltd. http://www.ford-mason.co.uk/aford/ -South Wing, Compton House Tel: +44 1531 829900 -Compton Green, Redmarley Fax: +44 1531 829901 -Gloucester, United Kingdom - -Experience: - * 18 years in the computer industry - * 14 years Unix/C programming experience - * 10 years experience with GNU software - * 4 years web experience (author of the first book about setting up a web site) - -Services offered: - * Installing and customizing GNU and other free software - * GNU Emacs customization and emacs lisp coding - * Perl module development - * TeX and LaTeX macro development - * software development (especially in Perl, C, C++) - * web site setup (with Apache) - * web application development with mod_perl - * translation (German -> English) - * writing documentation - -Rates: - around 60 pounds/hour (approx US$80/hour) plus expenses - less for charities and non-profit organization - -Updated: 1998-06-24 - -Free Software Association of Germany -Michaela Merz -Heimatring 19 -6000 Frankfurt/Main 70 -phone: (+49 69) 6312083) -ert : (+49-172-6987246) -email: (info@elara.fsag.de) - -Supporting all kinds of freeware (i.e. GNU), freeware development, consulting, -training, installation. Special LINUX support group. - -RATES: - -Companies and for profit -organizations : 100 US$ / hour -Private and not-for-profit -organizations : 40 US$ / hour -ert (24h Emergency -response team) : 300 US$ / hour - -Entered: 1994-04-14 - -Noah Friedman -4463 Moraga Avenue -Oakland, CA 94611 -(permanent) - -Author of several Emacs Lisp packages and parts of Emacs, as well as -numerous network and unix system utilities. Co-maintained GNU Texinfo and -Autoconf for a couple of years. Experienced unix systems engineer. -FSF employee Feb 1991--Sep 1994. - -I can perform installation, porting, and enhancement of all GNU software -and any other free software, especially for Linux/GNU systems; design -high-capacity hardware-redundant servers for production environments; -provide consulting on the use of version control management with CVS; and I -am willing to provide handholding for shell programming and Emacs Lisp -development. - -Fees negotiable, averaging $100-$150/hour. I can work in the California -bay area or anywhere accessible on the Internet. For larger jobs I may be -willing to travel. - -Updated: 1998-06-24 - -Ronald F. Guilmette -RG Consulting -1751 East Roseville Pkwy. #1828 -Roseville, CA 95661 -Tel: +1 916 786 7945 -FAX: +1 916 786 5311 - -Services: Development & porting of GNU software development tools. - -GNU Contributions: - Invented, designed, and implemented the protoize and - unprotoize tools supplied with GCC2. - - Designed and developed all code to support the generation - of Dwarf symbolic debugging information for System V Release - 4 in GCC2. - - Performed original port of GNU compilers to SVr4 system. - - Finished port of GNU compilers to Intel i860 RISC - processor. - -Experience: 13+ years UNIX systems experience, all working on compilers - and related tools. - - 7+ years working professionally on GCC, G++, and GDB under - contract to various firms including the Microelectronics - and Computer Technology Corporation (MCC), Data General (DG), - Network Computing Devices (NCD), and Intel Corp. - -Other qualifications: - Developer of the RoadTest (tm) C and C++ commercial - compiler test suites. - - Former vice-chairman of UNIX International Programming - Languages Special Interest Group (UI/PLSIG). - - Bachelor's and a Master's degrees, both in Computer Science. - -Rates: Variable depending upon contract duration. Call for quote. - -Updated: 1998-07-10 - -Kevin Harris -Dallas, Texas USA - -Entire GNU suite - porting, compilation, installation and maintenance -Platforms: Any unix variant (AIX, *BSD, Digital Unix, HP/UX, GNU/Linux, -Solaris, SunOS, et al) - -Method: Call-in via modem to your site, telnet, or on-site. - -Rates: US $0-75/hour depending upon client requirements - -Note: If you are an individual installing GNU software on your personal Linux -system, or are a non-profit organization, my hourly rate for you is simple: -FREE. You just have to pay for the phone calls and/or travel/lodging, if any is -required. - -Experience: I've used, supported and maintained GNU software on numerous unix -systems since 1989. - -I have extensive experience in C, Emacs Lisp, Perl and general unix systems. - -Updated: 1998-06-24 - -Michael P. Deignan -Ideamation, Inc. -136 Nelson Street -Providence, RI 02908 -(401) 331-3708 -(401) 272-6449 fax. - -Rate: Varies depending on complexity of task. - Hourly and fixed-rate contracts are available. -Programs Supported: All - -Updated: 1998-07-23 - - Interactive Information Limited is an Edinburgh-based company that - specialises in WWW services and in particular support for accessing - existing systems and information. - - Our staff have many years experience in using, and developing lisp packages - within, Emacs, and in using other GNU/Unix tools, particularly under public - domain UNIXes. - - We can provide services throughout the UK, at any level from general - consultancy through fetching, installing and customising software to - bespoke programming. Fees would be in the range #300 - #600 per day, - depending primarily on the size of the job. - - You can contact us - by email: - by phone: 0370 30 40 52 (UK) - (+44) 370 30 40 52 (International) - by post: 3, Lauriston Gardens, - Edinburgh EH3 9HH - Scotland - -Updated: 1998-07-24 - -Kaman Sciences Corporation -Griffiss Business & Technology Park -775 Daedalian Drive -Rome, NY 13441-4909 -(315) 334-4900 - -CONTACTS: - Dennis Fitzgerald - Tom Robbins - -Kaman Sciences has performed a GNU port for a custom RISC processor. -We have experience in the definition and description of the machine -register transfer language to the GNU tool-set. This includes rewriting -and modification of the necessary description and source files of gcc, gas, -and gld and other binutils. Kaman also has services for installation and -setup of GNU tools, (GAWK, GCC, EMACS, etc.) on Sun workstations. - -Work is on a "service contract" basis and development is charged either -hourly or as a fixed price contract. - -Consulting rates: $70 to $175 per hour. - -Updated: 1997-05-07 - -Joseph R. Kiniry -Caltech Mailstop 256-80 http://www.cs.caltech.edu/~kiniry/ -Pasadena, CA 91125 -Phone: 626-395-4840 -Fax: 626-792-4257 - -Long-term high-level consultant with four advanced degrees in a -variety of domains. See http://www.cs.caltech.edu/~kiniry/resume.html -for more information on professional and academic background. - -I provide installation, porting, debugging, customization, design, and -development of GNU and other UNIX and non-UNIX software. I am or have -been a certified developer with Microsoft, SunSoft, NeXT, and Amiga. -I have a great deal of development and management experience and an -extremely broad background which contributes to my excellent system -integration capabilities. I have a special expertise and conduct -research in distributed systems and component/object technologies. - -Time and material rates for local work vary regionally, but are -currently $250 per hour on the west coast. Other rates apply for -long-term jobs (day rates, travel, etc.) and remote work (usually 1/2 -fee). I am interested in fixed-bid jobs and will work for lower rates -for non-profit organizations and educational institutions. - -Updated: 1998-08-27 - -Bradley M. Kuhn - -http://www.ebb.org/bkuhn - -I am available for Unix system administration and software development -consulting, including but not limited to installation, configuration and -integration of GNU tools and other copy-lefted software such as GNU/Linux -and the various distributions of GNU/Linux. - -Please visit my homepage for more information on my background and skills. My -resume is also available there. - -I am available for both 1099 (preferred) and W2 on-site contracting in the -Cincinnati, OH, USA metropolitan area, as well as remote consulting via dialup -or Internet connection anywhere in the USA. I have no interest in permanent -relocation at this time. - -My rate varies greatly between $25-$40/hour, depending on the circumstances. -Rates for non-profit organizations are substantially lower, and possibly free. - -Updated: 1998-09-12 - -Fen Labalme -CoMedia Consulting http://www.comedia.com/ -142 S. Lake Merced Hill WE ARE EVERYWHERE -San Francisco CA 94132 JUST SAY "KNOW" - -Consulting, installation, customization and training for GNU Emacs, -and selected other GNU & network software. Design & implementation -of free software projects, as well as software engineering & system -design. I have been hacking Emacs since '76 when it was TECO and ^R -macros (don't ask), and am inter/intra-network, UNIX & Web friendly. - -Rates: $150 hour & up, depending; flat rate jobs considered. - Lower rates, barter or free for selected non-profits. - -Updated: 1998-06-24 - -Greg Lehey -LEMIS -PO Box 460 -Echunga SA 5153 -Australia - -Phone: +61-8-8388-8250 -Fax: +61-8-8388-8250 -Mobile: +61-41-739-7062 -Mail - -Services: Supply, porting, installation, consultation on all GNU -products. - -Experience: 25 years OS and compiler experience, ports of most GNU -products. Author of ported software CD-ROM for UNIX System V.4.2, -"Porting UNIX Software" (O'Reilly), "Installing and Running FreeBSD" -and "The Complete FreeBSD" (both Walnut Creek). - -Rates: Choice of AUD 180 per hour or hotline rates AUD 3 per minute. -Outside Australia, $US 100 per hour or $US 2 per minute. Quick -questions may be free. Limited free support available for -purchasers of LEMIS CD-ROMs. - -Updated: 1998-08-26 - -Alan Lehotsky -Quality Software Management -634 West St -Carlisle, MA 01741 - -Phone: (978)287-0435 -Fax: (978)287-0436 - -Services: - - Support for GNU compilers, including rehost/retarget - - General system software work (SW tools, O/S, device drivers) - - runtime library (especially floating point) - - project management - - software process improvement - -Experience: 15+ years of design and implementation of optimizing - compilers. "Mr. Bliss" at Digital in the 70's and early - 80's. Experience with Motorola 68k, PowerPC, SPARC, x86, - NS32K, ADI SHARC DSP. Compilers for languages including - Ada, BLISS, C, C++, FORTRAN, Pascal, Modula/2, O/S - experience includes Unix (OSF/1, SunOS, Solaris, AIX, HP/UX), - VAX/VMS, Windows/NT, MacOS. - - 4 years experience with GCC internals, including major - changes to support 8 bit bytes on word-address SHARC DSP. - -References available - -Rates: $100/hr - fixed price possible for well-defined deliverables - -Updated: 1998-06-24 - -Rohan Lenard -32 Holtermann St. -Crows Nest, NSW 2065 -AUSTRALIA -+61 411250024 - -* The human face behind the bug-g++@gnu.org mailing list - known - in the past as and - now - known as . - -* Interested in providing first line support and development. - -Experience: 10+ years C/Unix, 6+ years C++ - Extensive experience with GNU tools, cross-compilers, - embedded/hosted systems, realtime, simulations, - and military software. - -Degrees: BSc (CS), BE (Comms), University of Melbourne - -Rates: AUS $75+/hr neg. - -Updated: 1997-05-17 - -Reuven M. Lerner -17 Disraeli Street -Haifa 34333 -Israel - -Phone: 04-824-2265 (within Israel) - +972-4-824-2265 (outside of Israel) - -Fax: 04-826-1219 (within Israel) - +972-4-826-1219 (outside of Israel) - -WWW: http://www.netvision.net.il/php/reuven - -- System and network administration, especially Linux-based systems - and networks -- Administration, training, and programming for Internet nodes and - World-Wide Web sites -- Installation, support and training in the use of Linux, Emacs, Perl, - and other free software -- Expertise in C, Emacs Lisp, and Perl - -Consulting rates: $75/hour, less for educational institutions. - -Updated: 1998-06-24 - -Richard Levitte (in TeX: Richard Levitte -Levitte Programming Levitte Programming -Spannvagen 38, I Spannv\"agen 28, I -S-168 35 Bromma S-168 35 Bromma -Sweden Sweden) -Tel.nr.: +46 (8) 26 52 47 (there is an answering machine) -Cellular: +46 (10) 222 64 05 -e-mail: - -What I do: - Primarily I work on GNU software for VMS, both VAX and AXP. I've - been porting GNU Emacs to VMS since spring 1991. I've ported a - bunch of other GNU programs as well. I maintain GNU vmslib. - For further info, see http://www.lp.se/~levitte/prof/resume.html - -Programs supported: - To a varying degree (ranging from extension and porting to - installation and simple questions) at the time of updating this - entry: - - GNU vmslib, emacs, autoconf, zip, diffutils, m4, patch, texinfo, - C/C++; on both VMS and Unix. - - Other GNU programs to a small degree; on Unix. - For further info, look at http://www.lp.se/products/gnu.html - -Experience: - Fluent in TeX/LaTeX and many programming languages. - Modified key elements in Emacs (e.g., memory and process management) - to work transparently on VMS. I have very good knowledge in the VMS - operating system. I'm also knowledged in the a few Unix flavors. - For further info, see http://www.lp.se/~levitte/prof/resume.html - -Your Rate: - $70-$100/hour (500-800 SEK in sweden), plus expenses. My rates - are negotiable, depending on how interesting the project is to me. - -Updated: 1997-05-08 - -Sean Levy -352 Roup Ave http://www.StAlphonsos.COM/~attila/ -Pittsburgh, PA 15232 +1.412.361.7802 -USA - -I have been a professional hacker for over 15 years, and have worked on -everything from PDP-10's and -11's and early microcomputers to modern Unix -workstations of various kinds, at all levels. I've done every kind of -hacking, in many different languages (including some I designed and -implemented). Current efforts are focused on Linux, GNU software, WWW-based -systems, and security. My resume and PGP key are available via my web -pages. - -Based in Pittsburgh, PA, available anywhere via the Internet. Possibility -of travel for some jobs. Speak Spanish, have traveled in Europe and -Scandinavia. - -Rates: $100 USD/hour standard, lower for non-profits or other worthy causes, - $200 USD/hour for pager access and 24-hour support - -Updated: 1998-06-24 - -Lexa Software info@lexa.com -1590 The Alameda, Suite 102 -San Jose, CA 95126 - -+1 800 278-2040 -+1 408 278-2043 voice -+1 408 278-2045 fax - -http://www.lexa.com - -Lexa Software provides support for GNU C/C++ including the GNU debugger -and linker. Lexa has extensive experience supporting GCC/G++ on SNI -and Pyramid as well as all other MIPS ABI platforms. We offer support -to 2, 5, 25 and larger number of users via phone, email, ftp. - -Updated: 1997-05-01 - -Gord Matzigkeit -#15, 2105 Cornwall Street http://www.fig.org/~gord/ -Regina, Saskatchewan S4P 2K8 Voice: (306) 522-7884 -CANADA - -I will gladly help novice and intermediate computer users to install, -understand, and use free software, whether or not I have prior -experience with that software. I know my limitations well, and will -freely give other contacts if I cannot solve your problem myself. - -I have over 3 years of experience with several of the major free OSes: -Linux/GNU (Red Hat, Debian, Slackware), NetBSD, FreeBSD, and GNU/Hurd. -Some of my specialties are networking, Emacs, Automake, Autoconf, C, -Perl, and shell script programming. - -My rates are negotiable depending on the task: usually $10-$40 -(Canadian) per hour. - -Updated: 1998-10-19 - -Andrew McCallum -6623 Dalzell Place -Pittsburgh, PA 15217 -Home: (412) 422-0688 - -http://www.cs.rochester.edu/u/mccallum - -Services: Support, enhancements, new development in: - GNU Objective C - GNUstep, both graphical and non-graphical. - GNUstep Base Library: libgnustep-base - (especially Distributed Objects) - Interface between Objective-C and Guile or TCL: libguileobjc. - -Experience: 10+ years of UNIX experience. - Programming for NeXTSTEP since version 0.8, 1988. - MA and PhD in Computer Science. - Extensive work on GNU Objective C Runtime. - Author of GNUstep Base Library, including Distributed Objects - FSF Chief Maintainer of the GNUstep Project. - Contributor to GCC, Emacs, Guile. - C, Objective-C, Postscript, Scheme, Lisp, ELisp, Linux. - English and Francais. - -Rates: $90-$150 / hour, negotiable, depending on many variables. - -Updated: 1997-05-07 - -Mark P. Mitchell -3421 El Camino Real #35 -Atherton, CA 94027 -(650) 364-5360 -http://home.earthlink.net/~mbmitchell/consulting.html - -Experience ----------- -I am an experienced software engineer, with particular expertise in -the field of programming tools. I am responsible for the -implementation of member templates in currently available versions of -G++ as well as many other G++ bug-fixes, and continue to work actively on -improving G++. - -I am willing to work on any and all projects involving free software. - -Please see my resume at the above URL for further information on -my experience and qualifications. - -Rates ------ -My standard rate is $125/hr, but I am willing to negotiate flat fees, and -discounts for deserving organizations. - -Updated: 1998-02-13 - -NET-Community -526 NW 21st, #48 http://www.net-community.com -Portland, OR 97209 USA -1-503-279-8845 voice - -NET-Community provides support for the complete GNUstep toolset -including the Objective-C runtime within GCC, the GNUstep Base Library, -the Display Ghostscript system, the GNUstep GUI Library, the GNUstep -X/DPS GUI Backend, and the GNUstep Database Library. NET-Community also -provides support for its own MediaBook software including the MediaBook -Random Library and the MediaBook Speech Synthesis Library. -NET-Community actively supports and develops free software on all -GNUstep platforms; a portion of the proceeds, usually 20%, generated -from CD-ROM sales go towards additional development and enhancement of -GNUstep. - -Updated: 1998-09-08 - -Thi Nguyen -San Jose, CA, USA +1 408 314 3470 - -Expertise: Hardware Verification Tools and Environment - - simulators / transactors / stimulus generators - - scripts of all sorts / environment / flows - - elisp customizations - - speak: C, C++, elisp, Scheme, Perl, Verilog, sh - -Please see ftp://ftp.netcom.com/pub/tt/ttn/resume.html for resume. - -Rate: $100/hr, possibly less - -Updated: 1998-06-24 - -Peter Olsen -P.O. Box 410 -Simpsonville, MD 21150 - -pcolsen@acm.org - -What I do: Mathematical modeling and model building using Gnu - and other Free Software. Scientific and engineering - analysis, modeling, and programming in FORTRAN, C, LISP, - Java, and Smalltalk. Statistical analysis. - Emacs customization. - -Examples of my previous work: - 1. I built the model used predict the - amount of work required to clean up the Exxon Valdez oil - spill. Model was completed in ten days, used to allocate - resources for $2 billion summer cleanup, predictions were - accurate. - 2. I built a model applying commercial capital - investment standards to a Federal Agency budget, helped - support $250 Million budget increase. - -Credo: Engineering is the art of applying a professional - knowledge of mathematics and the physical sciences to - improve the quality of life. - -Rates: $225/hour (+ travel and expenses) on site, - $175/hour remote access. - -Notes: 1. Visiting Lecturer for Society for Industrial and Applied - Mathematics: Will speak without fee about Valdez model - (or other work) to Educational and not-for-profit - organizations (plus most-economical travel and living - expenses or travel or living arrangements in kind). - - 2. I do not accept offers which pose even the appearance - of conflict of interest with any present or former client - or employer. - -Updated: 1998-06-24 - - Open Systems Consultants a.s Open Systems Consultants a.s - St. Olavsgt. 24 Fabrikkvn 8 - N-0166 OSLO N-4033 FORUS - NORWAY NORWAY - - -Phone: Fax: - +47 22 20 40 50 +47 22 20 02 85 - -Web: E-mail: - http://www.osc.no - -Open Systems Consultants a.s can provide programming support for all -GNU software -- extending or adopting it to meet customer needs. -Prices vary with software and project. Hourly fees are in the $80-120 -range. Fixed-priced projects are also available. Phone support is -available only for customers with support contracts. - -Updated: 1998-08-26 - -Francesco Potorti` -Via S.Stefano, 8 -56123 Pisa, Italy -Tel. (050)560671 - -Emacs: installation and maintenance, training and tutorials, - customisation, extensions, troubleshooting. Author of some of - the packages in the emacs distribution, has made the porting - of emacs to the Motorola Delta architecture. - -Other: installation and maintenance of GNU software. Experience with - hylafax, RCS, gperf, etags, smail, indent, diff, gawk, gcc, - screen. Is the current maintainer of etags. - -Rates: 30-80 KL/hr, depending on experience on the particular task. - Average is 50 KL/hr $50/hr. - Prefer e-mail communication to telephone. - -Qualifications: Electronic Engineering degree, Pisa. Full time - researcher in CNUCE-CNR. - Familiar with elisp programming and porting of C programs. - -Updated: 1998-08-26 - -Dipl.-Inform. Klaus K?mpf -L?hnerstrasse 14 -D-90491 N?rnberg -Germany - -- 15 years C/Unix experience -- 6 years VMS experience -- Ported BFD library, Binutils, GNU Assembler, GNU C, GNU C++, - GNU C++ libraries, and GNU Make to openVMS/Alpha. - -I do a lot of cross-platform (Unix/Linux-OpenVMS-WindowsNT) development -mostly with the GNU compiler environment. I am actively supporting GNU -software on OpenVMS/Alpha and OpenVMS/VAX. - -Updated: 1998-08-26 - -Quiotix Corporation -Menlo Park, CA - -Contact: Jeffrey Siegal - jbs@quiotix.com - 415 324-0535 - -Area of focus: Embedded systems--using GNU software to develop for -embedded systems, porting GNU software to embedded systems, extending GNU -software to better support embedded environments, developing new tools and -utilities for embedded development using GNU software. - -Services: porting, development, support, project management, advisory -consulting. - -Rates: $125-$250/hour or fixed fees depending on services provided. - -Updated: 1997-05-16 - -Wolfgang S. Rupprecht -47 Esparito Ave. -Fremont, CA 94539-3827 -(510) 659-9757 - -Anything, (lisp, C, customization, porting, installing) I have -written thousands of lines of GNU Emacs C and Lisp code. Original -author of the floating point additions in Emacs 19. - -Rates: $95/hr. - -Updated: 1997-05-08 - -Stanislav Shalunov - -Email: shalunov@mccme.ru -Phones: on request - -Installing, configuring, helping learn any free software. -Handholding, trouble shooting. Making custom changes to free -software written in C. Teaching, lecturing, consulting. - -Want to have a free OS with free software serving your needs but do -not want to spend time yourself or not very skilled with the -computers? Cannot decide which free software suits your needs -better? Drop me a line. - -Well, essentially, anything else on special request. :-) - -Rate: $30/hour if you are in Moscow and I am there when you request -job done, $50 if the job may be done remotely (like configuring user -level program), $60/hour + travel expenses otherwise. (Negotiable, -significant discounts may apply.) - -Entered 1997-07-17 - -Vin Shelton -EtherSoft, Inc -781.488.5135 - - -I have been a professional programmer for 20 years, with most of that time -spent doing UNIX/C/C++ hacking. My specialties are (in no particular -order): system/kernel hacking, speech recognition, perl, object-oriented -design and analysis, FSF software (I have built nearly every FSF package on -several different platforms), small language design and implementation, and -HTML/web programming. Currently I'm a member of the XEmacs and egcs beta -teams. My rates vary from $60 - $100 per hour, depending on the size of the -project. - -Updated: 1998-06-24 - -Signum Support AB -Teknikringen 8 -S-583 30 Linkoping, Sweden -+46 13 21 46 00 voice -+46 13 21 47 00 fax -http://www.signum.se/ - -Signum Support AB is a company dedicated to supporting, developing and -distributing free software for mainly UNIX systems. The people behind -Signum Support AB have many years of general UNIX and Internet -experience, both as system administrators and as programmers, and also -extensive experience in maintaining and administering the GNU programs -and Linux. - -Signum Support develops and markets the free GUI equipped Readynet -Internet server, the free PHTTPD http server and the easy to use Linux -based Fuego firewall. - -Services offered: - - - Support on Internet service software, especially the free - Readynet Internet server we have developed for Linux. - - Support on Linux. - - Customization of Linux. - - Installation and customizing GNU and other free software. We are - making free software as easy to install and use as shrink wrapped - programs. - - Warranty protection. - - Finding, Recommending and Investigation of free software in any - area of the customer's choice. - - Regular consulting. - -Rates: For software items, request our price list. - For consulting, 700-900 SEK/hour. - -Updated: 1997-05-12 - - Jon Solomon - 235 Main St., Apt 3C-1 - East Hartford, Conn. 06118 - +1 860 895-8289 - - Maintains all GNU software... Available for General Consulting - (contact me if you are interested)... - Sendmail a specialty... Can answer questions pertaining to the - installation, maintenance, bug reporting and fixing for - most GNU products... Adhering to the FSF/GNU copyleft for all - work... (I only charge for the time it takes to do the above, - the software (and most GNU copyleft'd software) is free. - I can make tapes for you if you need that... - -Updated: 1997-05-09 - -Name: Julian Stacey -Location: Munich Germany, & on the Internet. -Qualifications: University Degree, BSc Hons Computer & Cybernetics, 1980. -Phone: +49.89.268616 Fax: +49.89.260812 Data: +49.89.26023276 -Resume: http://www.freebsd.org/~jhs/ -Time Zone: +01:00 -Rate: 130-170 DM/Hour. 2.7846 DM = 1 Pound = US $1.6332 -Commercial Independent Freelance Consultancy: - Any Unix (inc FreeBSD, Linux etc), C, X-Windows, FSF Tools, - Internet, Systems engineering, hardware interfacing, - real time, comms & scientific industrial, even Cyrillic & - Chinese interfaces etc. No Emacs. No Cobol. -Free Sources: FSF, FreeBSD & NetBSD CVS & current (daily!) & releases, - X-Windows, XFree86, Free dial in soon (details on web). - Media Copy Charge ~DM 100 QIC 1/4" 525M, 150M, & 60M; & CAS-60M. -Free GCC-1.40 For Symmetric Computer Systems Model 375 (native cc is broken). -Languages: Deutsch & Francais - Man kann mir in Deutsch schreiben, (oder mich anrufen). - Je comprend Francais, mais je n'ecris pas des responses en Fr. -! NO FREE HELP ! - - The Free Software Foundation do not pay me. - - I earn my living from professional consultancy fees. - - Though I write code for public domain ... - - I will Not solve stranger's complex problems for free ! -WHEN CONTACTING ME, DO THIS :- - 1) Tell me Immediately, Are You: - A) Expecting to pay my bill for professional consultancy. - B) Seeking a few minutes advice free of charge. - 2) Give me your email address, or that of a friend. - or Volunteer to phone back ~ 5 days later to collect follow-up - info. from the net. (No I will not incur bills phoning you back). - 3) Speak English if you want free advice ! I speak German, & - listen in French, but if you're not paying, make some effort too ! - -Updated: 1997-05-15 - -Richard M. Stallman -545 Tech Sq, Rm 430 -Cambridge, MA 02139 - -Emacs: anything whatever -Is anyone interested in courses in using or extending GNU Emacs? - -Original inventor of Emacs and main author of GNU Emacs and GCC. - -Rates: $6/min or $250/hr. - -Updated: 1997-05-09 - -Kayvan Sylvan -Sylvan Associates -879 Lewiston Drive -San Jose, CA 95136-1517 -Phone: (408) 978-1407 -Fax: (408) 978-1417 - -I will help you port, install and customize GNU Emacs, GCC, G++, -bison, and other GNU tools on almost any architecture and operating -system. Questions answered. GNU C and lisp hacking available. I will -also do ongoing support and periodic upgrades if you get on my GNU -software subscription list. - -Rates: $70-$100/hour, depending on type of work. Substantial discounts -for long-term contracts and also for educational or non-profit -institutions. - -Experience: Many different Unix systems (2.9BSD to 4.4BSD, Xenix, SVR3 and -SVR4, Linux, FreeBSD). Systems programming and system administration on all -brands of Unix. Kernel hacking experience. Lots of porting experience. - -Updated: 1997-05-09 - -TerraTel AB -Tankeg=E5ngen 4 -S-417 56 G=F6teborg, Sweden -+46 31 50 79 40 voice -+46 31 50 79 39 fax -http://www.netg.se - -TerraTel AB is a company that does consultant jobs and holds courses -in the fields of Unix software, TCP/IP networking and Internet -applications. The people behind TerraTel AB have many years -of general UNIX experience, both as system administrators and as -programmers, and also extensive experience in maintaining the GNU -programs; in administration as well as finding and fixing bugs. - -Services offered: - -- Installation and customizing GNU and other free software. We will - make free software as easy to install and use as shrink wrapped - programs. -- Service and support subscriptions. -- Warranty protection. -- Customization and porting. -- Subscriptions to new versions which we will send monthly or with - any other interval. -- Finding, recommending and investigating free software in any - area of the customers choice. -- Regular consulting. -- Support on Internet service software, especially the free -- Support on Linux. -- Freeware based courses in Unix usage, C, C++, or any GNU tools - -Rates: For courses, contact us for a quote, -For consulting, $60-120/hour, depending on contract length. - -Entered: 1997-05-12 - -Jonathan Thornburg / BKIS Consulting -E-mail: (preferred way to contact me) -Postal: Box 8-7, Thetis Island BC V0R 2Y0, Canada -Phone: (250) 246-3640 (somewhat unreliable) - -* B.Sc (Honors 1st Class) in Math+Physics+CS, M.Sc and Ph.D in Astronomy -* 20+ years computing experience using a wide range of software and - hardware environments - -* Very fluent in C (15+ years experience) -* Fluent in C++, Perl, sh, csh, Awk, Fortran, PL/I, Pascal, APL, Lisp, - Basic, Maple, Reduce, various machine languages -* Very fluent (10+ years experience) in general Unix toolset and programming -* Good knowledge (4+ years experience) of Unix system administration - (SunOS, Linux, SGI) -* Strong background (both theory and practical experience) in Unix/network - security, computer graphics, X and Motif GUI programming -* Good general knowledge of Unix (kernel) internals and device drivers -* Very fluent in LaTeX, TeX, also HTML, HTTP, and CGI programming -* Member of Usenix (professional and technical Unix association) and - SAGE (system administrator's guild) - -* Very strong background (extensive experience) in numerical analysis -* Strong backgrounds in hardware architecture, microprogramming, - programming language implementation, compiler theory, data structures, - OS design and internals, networking, symbolic manipulation, AI - -I'm available for Unix-based contract programming, software installation, -and/or general system administration. My recent projects include several -20K-50K 50K line C/Maple/Awk scientific applications, several small (1K line) -Perl/Awk text processors and "system glue" CGI programs, finding and fixing -bugs in a (free) 50K line graphics package, and a partially completed project -to port (really rewrite) the GUI of a 50K line C++ Netscape plugin from -Win32 to Unix/X/Motif. - -Unless otherwise required by a client, all the software I write is covered -by the GNU General Public License. My basic rate is Can$50/hour for work I -can do remotely over the Internet, more for on-site work, less for selected -non-profit organizations. - -Updated: 1997-05-19 - -Leonard H. Tower Jr. -36 Porter Street -Somerville, MA 02143 -USA -+1-617-623-7739 - -Will work on most GNU software. -Installation, handholding, trouble shooting, extensions, teaching. - -Rates: $ 150.00/hour + travel expenses. Fixed fee quotes available. - Negotiable for non-profits. - -Experience: Have hacked on over a dozen architectures in many languages. Have -system mothered too many varieties of Unixes. Assisted rms with the front end -of gcc and its back-end support. Resume available on request. - -Updated: 1998-02-10 - -noris network GmbH -Matthias Urlichs -Schleiermacherstrasse 12 -90491 Nuernberg -Germany -Phone: +49 911 59818-0 -Fax: +49 911 59818-11 - -http://info.noris.de/ (German) - -Expertise: - OS internals, esp. Linux and BSD, esp. device drivers - Network protocol / program design and coding - Utilities coding and maintenance - Program debugging, testing - User interface design and testing - Several programming and tool languages - -Services: - Installation, debugging, enhancement, distribution, - for all kinds of free software. - System administration for most Unix-like systems. - Email, Fax, phone, and in-person consulting (and/or "question answering"). - Remote support and system monitoring (over the Internet), - Update service (new tools tested and installed automagically) - Internet access - -Rates: - DM 150 (~$85) per hour - Support contracts start at DM 220/month + DM 30/supported system. - Willing to travel for sufficiently large jobs. - Rates don't include taxes. - -Updated: 1997-08-04 - -Paul C.A. van Gool - - -Address: Netherlands Organization for Applied Scientific Research - Physics and Electronics Laboratory - PO Box 96864, 2509 JG the Hague - The Netherlands - -Phone: +31-70-3740260 -Fax : +31-70-3740652 - -I would like to provide unpaid support for the following things: - -- C -- C++ -- f2c -- compilation and installation of most GNU packages - -Updated: 1998-06-24 - -Joel N. Weber II -185 Lowell St #2 -Somerville, MA 02144-2629 -devnull@gnu.org - -I can install GNU software, customize it, fix bugs, answer questions, -and teach. - -I am fluent in C, emacs lisp, Bourne shell, and awk. I also have a -good understanding of automake and autoconf. - -I have modified identd, cvs, and ftpd to change their security -procedures; I have modified the GNU fileutils to understand new flag -bits that were added to the Hurd. I have been involved in developing -Hurd translators. Long ago, I worked on developing a web browser; -that project was eventually killed, but I learned a lot in the -process. - -I am experienced in webmastering and system administration. - -Rate: $100/hour, negotiable. - -Arne Wichmann - -EMail: -Telephone on request. - -I support GNU software on the following platforms: - -Linux -SunOS 4.X 5.X -HPUX 9.X -other platforms on request. - -Usual rates: 20DM per hour. Free support for private people as time -permits. - -Updated: 1997-05-16 - -Jody Winston -xprt Computer Consulting, Inc. -731 Voyager -Houston, TX, 77058 -(281) 480-UNIX, - -We have supported, installed, and used the entire GNU software suite -for over 8 years on many different Unix platforms. We have written -character device drivers and proc file systems for custom hardware -running on Linux. In addition, we have developed a custom X11 server -and X input extensions. Our consulting rate is $150.00 US dollars per -hour, negotiable, plus a per diem for out of town work. - -Updated: 1997-05-12 - -Lige Zhou -Consultant -Open Technologies Corporation -Sun Lotus Bldg. 2nd Floor -2-9-1 Chuou, Nakano-ku, Tokyo 164 Japan -Tel: +81-3-3365-2911 Fax: +81-3-3365-2920 -E-mail: - -My profile is listed at: http://www.opentech.co.jp/~zhou/ - -I have two years of experience porting and supporting GNU C Compiler and -GNU Assembler at the Wingnut project of SRA, Inc., Tokyo. - -I can provide free consultation on these products if the problem is not -time-consuming. - -Updated: 1996-12-04 - - -For a current copy of this directory, or to have yourself listed, ask: - gnu@gnu.org - -** Please keep the entries in this file alphabetical ** diff --git a/contrib/gcc/TESTS.FLUNK b/contrib/gcc/TESTS.FLUNK deleted file mode 100644 index 04641e3c8fb8..000000000000 --- a/contrib/gcc/TESTS.FLUNK +++ /dev/null @@ -1,39 +0,0 @@ -This is a collection of things that test suites have -said were "wrong" with GCC--but that I don't agree with. - -First, test suites sometimes test for compatibility with -traditional C. GCC with -traditional is not completely -compatible with traditional C, and in some ways I think it -should not be. - -* K&R C allowed \x to appear in a string literal (or character -literal?) even in cases where it is *not* followed by a sequence of -hex digits. I'm not convinced this is desirable. - -* K&R compilers allow comments to cross over an inclusion boundary (i.e. -started in an include file and ended in the including file). -I think this would be quite ugly and can't imagine it could -be needed. - -Sometimes tests disagree with GCC's interpretation of the ANSI standard. - -* One test claims that this function should return 1. - - enum {A, B} foo; - - func (enum {B, A} arg) - { - return B; - } - -I think it should return 0, because the definition of B that -applies is the one in func. - -* Some tests report failure when the compiler does not produce -an error message for a certain program. - -ANSI C requires a "diagnostic" message for certain kinds of invalid -programs, but a warning counts as a diagnostic. If GCC produces -a warning but not an error, that is correct ANSI support. -When test suites call this "failure", the tests are broken. - diff --git a/contrib/gcc/acconfig.h b/contrib/gcc/acconfig.h deleted file mode 100644 index d702b0e0222e..000000000000 --- a/contrib/gcc/acconfig.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Define if you can safely include both and . */ -#undef STRING_WITH_STRINGS - -/* Define if printf supports "%p". */ -#undef HAVE_PRINTF_PTR - -/* Define if you want expensive run-time checks. */ -#undef ENABLE_CHECKING - -/* Define to 1 if NLS is requested. */ -#undef ENABLE_NLS - -/* Define as 1 if you have catgets and don't want to use GNU gettext. */ -#undef HAVE_CATGETS - -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT - -/* Define if your cpp understands the stringify operator. */ -#undef HAVE_CPP_STRINGIFY - -/* Define if your compiler understands volatile. */ -#undef HAVE_VOLATILE - -/* Define if your assembler supports specifying the maximum number - of bytes to skip when using the GAS .p2align command. */ -#undef HAVE_GAS_MAX_SKIP_P2ALIGN - -/* Define if your assembler supports .balign and .p2align. */ -#undef HAVE_GAS_BALIGN_AND_P2ALIGN - -/* Define if your assembler supports .subsection and .subsection -1 starts - emitting at the beginning of your section */ -#undef HAVE_GAS_SUBSECTION_ORDERING - -/* Define if your assembler uses the old HImode fild and fist notation. */ -#undef HAVE_GAS_FILDS_FISTS - -/* Define if you have a working header file. */ -#undef HAVE_INTTYPES_H - -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Define as 1 if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Whether malloc must be declared even if is included. */ -#undef NEED_DECLARATION_MALLOC - -/* Whether realloc must be declared even if is included. */ -#undef NEED_DECLARATION_REALLOC - -/* Whether calloc must be declared even if is included. */ -#undef NEED_DECLARATION_CALLOC - -/* Whether free must be declared even if is included. */ -#undef NEED_DECLARATION_FREE - -/* Whether bcopy must be declared even if is included. */ -#undef NEED_DECLARATION_BCOPY - -/* Whether bcmp must be declared even if is included. */ -#undef NEED_DECLARATION_BCMP - -/* Whether bzero must be declared even if is included. */ -#undef NEED_DECLARATION_BZERO - -/* Whether index must be declared even if is included. */ -#undef NEED_DECLARATION_INDEX - -/* Whether rindex must be declared even if is included. */ -#undef NEED_DECLARATION_RINDEX - -/* Whether getenv must be declared even if is included. */ -#undef NEED_DECLARATION_GETENV - -/* Whether atol must be declared even if is included. */ -#undef NEED_DECLARATION_ATOL - -/* Whether atof must be declared even if is included. */ -#undef NEED_DECLARATION_ATOF - -/* Whether sbrk must be declared even if is included. */ -#undef NEED_DECLARATION_SBRK - -/* Whether abort must be declared even if is included. */ -#undef NEED_DECLARATION_ABORT - -/* Whether strerror must be declared even if is included. */ -#undef NEED_DECLARATION_STRERROR - -/* Whether strsignal must be declared even if is included. */ -#undef NEED_DECLARATION_STRSIGNAL - -/* Whether strstr must be declared even if is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether getcwd must be declared even if is included. */ -#undef NEED_DECLARATION_GETCWD - -/* Whether getwd must be declared even if is included. */ -#undef NEED_DECLARATION_GETWD - -/* Whether getrlimit must be declared even if is included. */ -#undef NEED_DECLARATION_GETRLIMIT - -/* Whether setrlimit must be declared even if is included. */ -#undef NEED_DECLARATION_SETRLIMIT - -/* Whether putc_unlocked must be declared even if is included. */ -#undef NEED_DECLARATION_PUTC_UNLOCKED - -/* Whether fputs_unlocked must be declared even if is included. */ -#undef NEED_DECLARATION_FPUTS_UNLOCKED - -/* Define to enable the use of a default assembler. */ -#undef DEFAULT_ASSEMBLER - -/* Define to enable the use of a default linker. */ -#undef DEFAULT_LINKER - -/* Define if host mkdir takes a single argument. */ -#undef MKDIR_TAKES_ONE_ARG - -/* Define to the name of the distribution. */ -#undef PACKAGE - -/* Define to the version of the distribution. */ -#undef VERSION -@TOP@ diff --git a/contrib/gcc/aclocal.m4 b/contrib/gcc/aclocal.m4 deleted file mode 100644 index fe4d83282c93..000000000000 --- a/contrib/gcc/aclocal.m4 +++ /dev/null @@ -1,659 +0,0 @@ -dnl See whether we can include both string.h and strings.h. -AC_DEFUN(GCC_HEADER_STRING, -[AC_CACHE_CHECK([whether string.h and strings.h may both be included], - gcc_cv_header_string, -[AC_TRY_COMPILE([#include -#include ], , gcc_cv_header_string=yes, gcc_cv_header_string=no)]) -if test $gcc_cv_header_string = yes; then - AC_DEFINE(STRING_WITH_STRINGS) -fi -]) - -dnl See whether we need a declaration for a function. -dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES]) -AC_DEFUN(GCC_NEED_DECLARATION, -[AC_MSG_CHECKING([whether $1 must be declared]) -AC_CACHE_VAL(gcc_cv_decl_needed_$1, -[AC_TRY_COMPILE([ -#include -#ifdef STRING_WITH_STRINGS -# include -# include -#else -# ifdef HAVE_STRING_H -# include -# else -# ifdef HAVE_STRINGS_H -# include -# endif -# endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifndef HAVE_RINDEX -#define rindex strrchr -#endif -#ifndef HAVE_INDEX -#define index strchr -#endif -$2], -[char *(*pfn) = (char *(*)) $1], -eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")]) -if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then - AC_MSG_RESULT(yes) - gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - AC_DEFINE_UNQUOTED($gcc_tr_decl) -else - AC_MSG_RESULT(no) -fi -])dnl - -dnl Check multiple functions to see whether each needs a declaration. -dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES]) -AC_DEFUN(GCC_NEED_DECLARATIONS, -[for ac_func in $1 -do -GCC_NEED_DECLARATION($ac_func, $2) -done -]) - -dnl Check if we have vprintf and possibly _doprnt. -dnl Note autoconf checks for vprintf even though we care about vfprintf. -AC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT, -[AC_FUNC_VPRINTF -vfprintf= -doprint= -if test $ac_cv_func_vprintf != yes ; then - vfprintf=vfprintf.o - if test $ac_cv_func__doprnt != yes ; then - doprint=doprint.o - fi -fi -AC_SUBST(vfprintf) -AC_SUBST(doprint) -]) - -dnl See if the printf functions in libc support %p in format strings. -AC_DEFUN(GCC_FUNC_PRINTF_PTR, -[AC_CACHE_CHECK(whether the printf functions support %p, - gcc_cv_func_printf_ptr, -[AC_TRY_RUN([#include - -main() -{ - char buf[64]; - char *p = buf, *q = NULL; - sprintf(buf, "%p", p); - sscanf(buf, "%p", &q); - exit (p != q); -}], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no, - gcc_cv_func_printf_ptr=no) -rm -f core core.* *.core]) -if test $gcc_cv_func_printf_ptr = yes ; then - AC_DEFINE(HAVE_PRINTF_PTR) -fi -]) - -dnl See if symbolic links work and if not, try to substitute either hard links or simple copy. -AC_DEFUN(GCC_PROG_LN_S, -[AC_MSG_CHECKING(whether ln -s works) -AC_CACHE_VAL(gcc_cv_prog_LN_S, -[rm -f conftestdata_t -echo >conftestdata_f -if ln -s conftestdata_f conftestdata_t 2>/dev/null -then - gcc_cv_prog_LN_S="ln -s" -else - if ln conftestdata_f conftestdata_t 2>/dev/null - then - gcc_cv_prog_LN_S=ln - else - gcc_cv_prog_LN_S=cp - fi -fi -rm -f conftestdata_f conftestdata_t -])dnl -LN_S="$gcc_cv_prog_LN_S" -if test "$gcc_cv_prog_LN_S" = "ln -s"; then - AC_MSG_RESULT(yes) -else - if test "$gcc_cv_prog_LN_S" = "ln"; then - AC_MSG_RESULT([no, using ln]) - else - AC_MSG_RESULT([no, and neither does ln, so using cp]) - fi -fi -AC_SUBST(LN_S)dnl -]) - -dnl See if hard links work and if not, try to substitute either symbolic links or simple copy. -AC_DEFUN(GCC_PROG_LN, -[AC_MSG_CHECKING(whether ln works) -AC_CACHE_VAL(gcc_cv_prog_LN, -[rm -f conftestdata_t -echo >conftestdata_f -if ln conftestdata_f conftestdata_t 2>/dev/null -then - gcc_cv_prog_LN="ln" -else - if ln -s conftestdata_f conftestdata_t 2>/dev/null - then - gcc_cv_prog_LN="ln -s" - else - gcc_cv_prog_LN=cp - fi -fi -rm -f conftestdata_f conftestdata_t -])dnl -LN="$gcc_cv_prog_LN" -if test "$gcc_cv_prog_LN" = "ln"; then - AC_MSG_RESULT(yes) -else - if test "$gcc_cv_prog_LN" = "ln -s"; then - AC_MSG_RESULT([no, using ln -s]) - else - AC_MSG_RESULT([no, and neither does ln -s, so using cp]) - fi -fi -AC_SUBST(LN)dnl -]) - -dnl See whether the stage1 host compiler accepts the volatile keyword. -AC_DEFUN(GCC_C_VOLATILE, -[AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile, -[AC_TRY_COMPILE(, [volatile int foo;], - gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)]) -if test $gcc_cv_c_volatile = yes ; then - AC_DEFINE(HAVE_VOLATILE) -fi -]) - -dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead -dnl of the usual 2. -AC_DEFUN(GCC_FUNC_MKDIR_TAKES_ONE_ARG, -[AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg, -[AC_TRY_COMPILE([ -#include -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_DIRECT_H -# include -#endif], [mkdir ("foo", 0);], - gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)]) -if test $gcc_cv_mkdir_takes_one_arg = yes ; then - AC_DEFINE(MKDIR_TAKES_ONE_ARG) -fi -]) - -AC_DEFUN(EGCS_PROG_INSTALL, -[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -AC_MSG_CHECKING(for a BSD compatible install) -if test -z "$INSTALL"; then -AC_CACHE_VAL(ac_cv_path_install, -[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" -])dnl - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -dnl We do special magic for INSTALL instead of AC_SUBST, to get -dnl relative paths right. -AC_MSG_RESULT($INSTALL) -AC_SUBST(INSTALL)dnl - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -AC_SUBST(INSTALL_PROGRAM)dnl - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -AC_SUBST(INSTALL_DATA)dnl -]) - -#serial 1 -dnl This test replaces the one in autoconf. -dnl Currently this macro should have the same name as the autoconf macro -dnl because gettext's gettext.m4 (distributed in the automake package) -dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader -dnl give these diagnostics: -dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX -dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX - -undefine([AC_ISC_POSIX]) -AC_DEFUN(AC_ISC_POSIX, - [ - dnl This test replaces the obsolescent AC_ISC_POSIX kludge. - AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) - ] -) - -# Macro to add for using GNU gettext. -# Ulrich Drepper , 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -# serial 5 - -AC_DEFUN(AM_WITH_NLS, - [AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) - - USE_INCLUDED_LIBINTL=no - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - AC_DEFINE(ENABLE_NLS) - AC_MSG_CHECKING([whether included gettext is requested]) - AC_ARG_WITH(included-gettext, - [ --with-included-gettext use the GNU gettext library included here], - nls_cv_force_use_gnu_gettext=$withval, - nls_cv_force_use_gnu_gettext=no) - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - dnl User does not insist on using GNU NLS library. Figure out what - dnl to use. If gettext or catgets are available (in this order) we - dnl use this. Else we have to fall back to GNU NLS library. - dnl catgets is only used if permitted by option --with-catgets. - nls_cv_header_intl= - nls_cv_header_libgt= - CATOBJEXT=NONE - - AC_CHECK_HEADER(libintl.h, - [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, - [AC_TRY_LINK([#include ], [return (int) gettext ("")], - gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) - - if test "$gt_cv_func_gettext_libc" != "yes"; then - AC_CHECK_LIB(intl, bindtextdomain, - [AC_CACHE_CHECK([for gettext in libintl], - gt_cv_func_gettext_libintl, - [AC_CHECK_LIB(intl, gettext, - gt_cv_func_gettext_libintl=yes, - gt_cv_func_gettext_libintl=no)], - gt_cv_func_gettext_libintl=no)]) - fi - - if test "$gt_cv_func_gettext_libc" = "yes" \ - || test "$gt_cv_func_gettext_libintl" = "yes"; then - AC_DEFINE(HAVE_GETTEXT) - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl - if test "$MSGFMT" != "no"; then - AC_CHECK_FUNCS(dcgettext) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; - return _nl_msg_cat_cntr], - [CATOBJEXT=.gmo - DATADIRNAME=share], - [CATOBJEXT=.mo - DATADIRNAME=lib]) - INSTOBJEXT=.mo - fi - fi - ]) - - if test "$CATOBJEXT" = "NONE"; then - AC_MSG_CHECKING([whether catgets can be used]) - AC_ARG_WITH(catgets, - [ --with-catgets use catgets functions if available], - nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) - AC_MSG_RESULT($nls_cv_use_catgets) - - if test "$nls_cv_use_catgets" = "yes"; then - dnl No gettext in C library. Try catgets next. - AC_CHECK_LIB(i, main) - AC_CHECK_FUNC(catgets, - [AC_DEFINE(HAVE_CATGETS) - INTLOBJS="\$(CATOBJS)" - AC_PATH_PROG(GENCAT, gencat, no)dnl - if test "$GENCAT" != "no"; then - AC_PATH_PROG(GMSGFMT, gmsgfmt, no) - if test "$GMSGFMT" = "no"; then - AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) - fi - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.cat - INSTOBJEXT=.cat - DATADIRNAME=lib - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi]) - fi - fi - - if test "$CATOBJEXT" = "NONE"; then - dnl Neither gettext nor catgets in included in the C library. - dnl Fall back on GNU gettext library. - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions used to generate GNU NLS library. - INTLOBJS="\$(GETTOBJS)" - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - AC_SUBST(MSGFMT) - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INSTOBJEXT=.mo - DATADIRNAME=share - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi - - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - fi - - # We need to process the po/ directory. - POSUB=po - else - DATADIRNAME=share - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi - AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) - AC_OUTPUT_COMMANDS( - [case "$CONFIG_FILES" in *po/Makefile.in*) - sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile - esac]) - - - # If this is used in GNU gettext we have to set USE_NLS to `yes' - # because some of the sources are only built for this goal. - if test "$PACKAGE" = gettext; then - USE_NLS=yes - USE_INCLUDED_LIBINTL=yes - fi - - dnl These rules are solely for the distribution goal. While doing this - dnl we only have to keep exactly one list of the available catalogs - dnl in configure.in. - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - - dnl Make all variables we use known to autoconf. - AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATALOGS) - AC_SUBST(CATOBJEXT) - AC_SUBST(DATADIRNAME) - AC_SUBST(GMOFILES) - AC_SUBST(INSTOBJEXT) - AC_SUBST(INTLDEPS) - AC_SUBST(INTLLIBS) - AC_SUBST(INTLOBJS) - AC_SUBST(POFILES) - AC_SUBST(POSUB) - ]) - -AC_DEFUN(AM_GNU_GETTEXT, - [AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_CONST])dnl - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_OFF_T])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h sys/param.h]) - AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ -strdup __argz_count __argz_stringify __argz_next]) - - if test "${ac_cv_func_stpcpy+set}" != "set"; then - AC_CHECK_FUNCS(stpcpy) - fi - if test "${ac_cv_func_stpcpy}" = "yes"; then - AC_DEFINE(HAVE_STPCPY) - fi - - AM_LC_MESSAGES - AM_WITH_NLS - - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - AC_MSG_CHECKING(for catalogs to be installed) - NEW_LINGUAS= - for lang in ${LINGUAS=$ALL_LINGUAS}; do - case "$ALL_LINGUAS" in - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; - esac - done - LINGUAS=$NEW_LINGUAS - AC_MSG_RESULT($LINGUAS) - fi - - dnl Construct list of names of catalog files to be constructed. - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - - dnl The reference to in the installed file - dnl must be resolved because we cannot expect the users of this - dnl to define HAVE_LOCALE_H. - if test $ac_cv_header_locale_h = yes; then - INCLUDE_LOCALE_H="#include " - else - INCLUDE_LOCALE_H="\ -/* The system does not provide the header . Take care yourself. */" - fi - AC_SUBST(INCLUDE_LOCALE_H) - - dnl Determine which catalog format we have (if any is needed) - dnl For now we know about two different formats: - dnl Linux libc-5 and the normal X/Open format - test -d intl || mkdir intl - if test "$CATOBJEXT" = ".cat"; then - AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) - - dnl Transform the SED scripts while copying because some dumb SEDs - dnl cannot handle comments. - sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed - fi - dnl po2tbl.sed is always needed. - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ - $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed - - dnl In the intl/Makefile.in we have a special dependency which makes - dnl only sense for gettext. We comment this out for non-gettext - dnl packages. - if test "$PACKAGE" = "gettext"; then - GT_NO="#NO#" - GT_YES= - else - GT_NO= - GT_YES="#YES#" - fi - AC_SUBST(GT_NO) - AC_SUBST(GT_YES) - - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but ($top_srcdir). - dnl Try to locate is. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) - - dnl *** For now the libtool support in intl/Makefile is not for real. - l= - AC_SUBST(l) - - dnl Generate list of files to be processed by xgettext which will - dnl be included in po/Makefile. - test -d po || mkdir po - if test "x$srcdir" != "x."; then - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then - posrcprefix="$srcdir/" - else - posrcprefix="../$srcdir/" - fi - else - posrcprefix="../" - fi - rm -f po/POTFILES - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ - < $srcdir/po/POTFILES.in > po/POTFILES - ]) - -# Check whether LC_MESSAGES is available in . -# Ulrich Drepper , 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -# serial 1 - -AC_DEFUN(AM_LC_MESSAGES, - [if test $ac_cv_header_locale_h = yes; then - AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, - [AC_TRY_LINK([#include ], [return LC_MESSAGES], - am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) - if test $am_cv_val_LC_MESSAGES = yes; then - AC_DEFINE(HAVE_LC_MESSAGES) - fi - fi]) - -# Search path for a program which passes the given test. -# Ulrich Drepper , 1996. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -# serial 1 - -dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, -dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) -AC_DEFUN(AM_PATH_PROG_WITH_TEST, -[# Extract the first word of "$2", so it can be a program name with args. -set dummy $2; ac_word=[$]2 -AC_MSG_CHECKING([for $ac_word]) -AC_CACHE_VAL(ac_cv_path_$1, -[case "[$]$1" in - /*) - ac_cv_path_$1="[$]$1" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in ifelse([$5], , $PATH, [$5]); do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if [$3]; then - ac_cv_path_$1="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" -dnl If no 4th arg is given, leave the cache variable unset, -dnl so AC_PATH_PROGS will keep looking. -ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" -])dnl - ;; -esac])dnl -$1="$ac_cv_path_$1" -if test -n "[$]$1"; then - AC_MSG_RESULT([$]$1) -else - AC_MSG_RESULT(no) -fi -AC_SUBST($1)dnl -]) diff --git a/contrib/gcc/alias.c b/contrib/gcc/alias.c deleted file mode 100644 index 9d8aac7832a4..000000000000 --- a/contrib/gcc/alias.c +++ /dev/null @@ -1,1570 +0,0 @@ -/* Alias analysis for GNU C - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. - Contributed by John Carr (jfc@mit.edu). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "expr.h" -#include "regs.h" -#include "hard-reg-set.h" -#include "flags.h" -#include "output.h" -#include "toplev.h" -#include "splay-tree.h" - -/* The alias sets assigned to MEMs assist the back-end in determining - which MEMs can alias which other MEMs. In general, two MEMs in - different alias sets to not alias each other. There is one - exception, however. Consider something like: - - struct S {int i; double d; }; - - a store to an `S' can alias something of either type `int' or type - `double'. (However, a store to an `int' cannot alias a `double' - and vice versa.) We indicate this via a tree structure that looks - like: - struct S - / \ - / \ - |/_ _\| - int double - - (The arrows are directed and point downwards.) If, when comparing - two alias sets, we can hold one set fixed, and trace the other set - downwards, and at some point find the first set, the two MEMs can - alias one another. In this situation we say the alias set for - `struct S' is the `superset' and that those for `int' and `double' - are `subsets'. - - Alias set zero is implicitly a superset of all other alias sets. - However, this is no actual entry for alias set zero. It is an - error to attempt to explicitly construct a subset of zero. */ - -typedef struct alias_set_entry { - /* The alias set number, as stored in MEM_ALIAS_SET. */ - int alias_set; - - /* The children of the alias set. These are not just the immediate - children, but, in fact, all children. So, if we have: - - struct T { struct S s; float f; } - - continuing our example above, the children here will be all of - `int', `double', `float', and `struct S'. */ - splay_tree children; -}* alias_set_entry; - -static rtx canon_rtx PROTO((rtx)); -static int rtx_equal_for_memref_p PROTO((rtx, rtx)); -static rtx find_symbolic_term PROTO((rtx)); -static int memrefs_conflict_p PROTO((int, rtx, int, rtx, - HOST_WIDE_INT)); -static void record_set PROTO((rtx, rtx)); -static rtx find_base_term PROTO((rtx)); -static int base_alias_check PROTO((rtx, rtx, enum machine_mode, - enum machine_mode)); -static rtx find_base_value PROTO((rtx)); -static int mems_in_disjoint_alias_sets_p PROTO((rtx, rtx)); -static int insert_subset_children PROTO((splay_tree_node, - void*)); -static alias_set_entry get_alias_set_entry PROTO((int)); -static rtx fixed_scalar_and_varying_struct_p PROTO((rtx, rtx, int (*)(rtx))); -static int aliases_everything_p PROTO((rtx)); -static int write_dependence_p PROTO((rtx, rtx, int)); - -/* Set up all info needed to perform alias analysis on memory references. */ - -#define SIZE_FOR_MODE(X) (GET_MODE_SIZE (GET_MODE (X))) - -/* Returns nonzero if MEM1 and MEM2 do not alias because they are in - different alias sets. We ignore alias sets in functions making use - of variable arguments because the va_arg macros on some systems are - not legal ANSI C. */ -#define DIFFERENT_ALIAS_SETS_P(MEM1, MEM2) \ - mems_in_disjoint_alias_sets_p (MEM1, MEM2) - -/* Cap the number of passes we make over the insns propagating alias - information through set chains. - - 10 is a completely arbitrary choice. */ -#define MAX_ALIAS_LOOP_PASSES 10 - -/* reg_base_value[N] gives an address to which register N is related. - If all sets after the first add or subtract to the current value - or otherwise modify it so it does not point to a different top level - object, reg_base_value[N] is equal to the address part of the source - of the first set. - - A base address can be an ADDRESS, SYMBOL_REF, or LABEL_REF. ADDRESS - expressions represent certain special values: function arguments and - the stack, frame, and argument pointers. The contents of an address - expression are not used (but they are descriptive for debugging); - only the address and mode matter. Pointer equality, not rtx_equal_p, - determines whether two ADDRESS expressions refer to the same base - address. The mode determines whether it is a function argument or - other special value. */ - -rtx *reg_base_value; -rtx *new_reg_base_value; -unsigned int reg_base_value_size; /* size of reg_base_value array */ -#define REG_BASE_VALUE(X) \ - ((unsigned) REGNO (X) < reg_base_value_size ? reg_base_value[REGNO (X)] : 0) - -/* Vector of known invariant relationships between registers. Set in - loop unrolling. Indexed by register number, if nonzero the value - is an expression describing this register in terms of another. - - The length of this array is REG_BASE_VALUE_SIZE. - - Because this array contains only pseudo registers it has no effect - after reload. */ -static rtx *alias_invariant; - -/* Vector indexed by N giving the initial (unchanging) value known - for pseudo-register N. */ -rtx *reg_known_value; - -/* Indicates number of valid entries in reg_known_value. */ -static int reg_known_value_size; - -/* Vector recording for each reg_known_value whether it is due to a - REG_EQUIV note. Future passes (viz., reload) may replace the - pseudo with the equivalent expression and so we account for the - dependences that would be introduced if that happens. */ -/* ??? This is a problem only on the Convex. The REG_EQUIV notes created in - assign_parms mention the arg pointer, and there are explicit insns in the - RTL that modify the arg pointer. Thus we must ensure that such insns don't - get scheduled across each other because that would invalidate the REG_EQUIV - notes. One could argue that the REG_EQUIV notes are wrong, but solving - the problem in the scheduler will likely give better code, so we do it - here. */ -char *reg_known_equiv_p; - -/* True when scanning insns from the start of the rtl to the - NOTE_INSN_FUNCTION_BEG note. */ - -static int copying_arguments; - -/* The splay-tree used to store the various alias set entries. */ - -static splay_tree alias_sets; - -/* Returns a pointer to the alias set entry for ALIAS_SET, if there is - such an entry, or NULL otherwise. */ - -static alias_set_entry -get_alias_set_entry (alias_set) - int alias_set; -{ - splay_tree_node sn = - splay_tree_lookup (alias_sets, (splay_tree_key) alias_set); - - return sn ? ((alias_set_entry) sn->value) : ((alias_set_entry) 0); -} - -/* Returns nonzero value if the alias sets for MEM1 and MEM2 are such - that the two MEMs cannot alias each other. */ - -static int -mems_in_disjoint_alias_sets_p (mem1, mem2) - rtx mem1; - rtx mem2; -{ - alias_set_entry ase; - -#ifdef ENABLE_CHECKING -/* Perform a basic sanity check. Namely, that there are no alias sets - if we're not using strict aliasing. This helps to catch bugs - whereby someone uses PUT_CODE, but doesn't clear MEM_ALIAS_SET, or - where a MEM is allocated in some way other than by the use of - gen_rtx_MEM, and the MEM_ALIAS_SET is not cleared. If we begin to - use alias sets to indicate that spilled registers cannot alias each - other, we might need to remove this check. */ - if (!flag_strict_aliasing && - (MEM_ALIAS_SET (mem1) || MEM_ALIAS_SET (mem2))) - abort (); -#endif - - /* The code used in varargs macros are often not conforming ANSI C, - which can trick the compiler into making incorrect aliasing - assumptions in these functions. So, we don't use alias sets in - such a function. FIXME: This should be moved into the front-end; - it is a language-dependent notion, and there's no reason not to - still use these checks to handle globals. */ - if (current_function_stdarg || current_function_varargs) - return 0; - - if (!MEM_ALIAS_SET (mem1) || !MEM_ALIAS_SET (mem2)) - /* We have no alias set information for one of the MEMs, so we - have to assume it can alias anything. */ - return 0; - - if (MEM_ALIAS_SET (mem1) == MEM_ALIAS_SET (mem2)) - /* The two alias sets are the same, so they may alias. */ - return 0; - - /* Iterate through each of the children of the first alias set, - comparing it with the second alias set. */ - ase = get_alias_set_entry (MEM_ALIAS_SET (mem1)); - if (ase && splay_tree_lookup (ase->children, - (splay_tree_key) MEM_ALIAS_SET (mem2))) - return 0; - - /* Now do the same, but with the alias sets reversed. */ - ase = get_alias_set_entry (MEM_ALIAS_SET (mem2)); - if (ase && splay_tree_lookup (ase->children, - (splay_tree_key) MEM_ALIAS_SET (mem1))) - return 0; - - /* The two MEMs are in distinct alias sets, and neither one is the - child of the other. Therefore, they cannot alias. */ - return 1; -} - -/* Insert the NODE into the splay tree given by DATA. Used by - record_alias_subset via splay_tree_foreach. */ - -static int -insert_subset_children (node, data) - splay_tree_node node; - void *data; -{ - splay_tree_insert ((splay_tree) data, - node->key, - node->value); - - return 0; -} - -/* Indicate that things in SUBSET can alias things in SUPERSET, but - not vice versa. For example, in C, a store to an `int' can alias a - structure containing an `int', but not vice versa. Here, the - structure would be the SUPERSET and `int' the SUBSET. This - function should be called only once per SUPERSET/SUBSET pair. At - present any given alias set may only be a subset of one superset. - - It is illegal for SUPERSET to be zero; everything is implicitly a - subset of alias set zero. */ - -void -record_alias_subset (superset, subset) - int superset; - int subset; -{ - alias_set_entry superset_entry; - alias_set_entry subset_entry; - - if (superset == 0) - abort (); - - superset_entry = get_alias_set_entry (superset); - if (!superset_entry) - { - /* Create an entry for the SUPERSET, so that we have a place to - attach the SUBSET. */ - superset_entry = - (alias_set_entry) xmalloc (sizeof (struct alias_set_entry)); - superset_entry->alias_set = superset; - superset_entry->children - = splay_tree_new (splay_tree_compare_ints, 0, 0); - splay_tree_insert (alias_sets, - (splay_tree_key) superset, - (splay_tree_value) superset_entry); - - } - - subset_entry = get_alias_set_entry (subset); - if (subset_entry) - /* There is an entry for the subset. Enter all of its children - (if they are not already present) as children of the SUPERSET. */ - splay_tree_foreach (subset_entry->children, - insert_subset_children, - superset_entry->children); - - /* Enter the SUBSET itself as a child of the SUPERSET. */ - splay_tree_insert (superset_entry->children, - (splay_tree_key) subset, - /*value=*/0); -} - -/* Inside SRC, the source of a SET, find a base address. */ - -static rtx -find_base_value (src) - register rtx src; -{ - switch (GET_CODE (src)) - { - case SYMBOL_REF: - case LABEL_REF: - return src; - - case REG: - /* At the start of a function argument registers have known base - values which may be lost later. Returning an ADDRESS - expression here allows optimization based on argument values - even when the argument registers are used for other purposes. */ - if (REGNO (src) < FIRST_PSEUDO_REGISTER && copying_arguments) - return new_reg_base_value[REGNO (src)]; - - /* If a pseudo has a known base value, return it. Do not do this - for hard regs since it can result in a circular dependency - chain for registers which have values at function entry. - - The test above is not sufficient because the scheduler may move - a copy out of an arg reg past the NOTE_INSN_FUNCTION_BEGIN. */ - if (REGNO (src) >= FIRST_PSEUDO_REGISTER - && (unsigned) REGNO (src) < reg_base_value_size - && reg_base_value[REGNO (src)]) - return reg_base_value[REGNO (src)]; - - return src; - - case MEM: - /* Check for an argument passed in memory. Only record in the - copying-arguments block; it is too hard to track changes - otherwise. */ - if (copying_arguments - && (XEXP (src, 0) == arg_pointer_rtx - || (GET_CODE (XEXP (src, 0)) == PLUS - && XEXP (XEXP (src, 0), 0) == arg_pointer_rtx))) - return gen_rtx_ADDRESS (VOIDmode, src); - return 0; - - case CONST: - src = XEXP (src, 0); - if (GET_CODE (src) != PLUS && GET_CODE (src) != MINUS) - break; - /* fall through */ - - case PLUS: - case MINUS: - { - rtx temp, src_0 = XEXP (src, 0), src_1 = XEXP (src, 1); - - /* If either operand is a REG, then see if we already have - a known value for it. */ - if (GET_CODE (src_0) == REG) - { - temp = find_base_value (src_0); - if (temp) - src_0 = temp; - } - - if (GET_CODE (src_1) == REG) - { - temp = find_base_value (src_1); - if (temp) - src_1 = temp; - } - - /* Guess which operand is the base address. - - If either operand is a symbol, then it is the base. If - either operand is a CONST_INT, then the other is the base. */ - - if (GET_CODE (src_1) == CONST_INT - || GET_CODE (src_0) == SYMBOL_REF - || GET_CODE (src_0) == LABEL_REF - || GET_CODE (src_0) == CONST) - return find_base_value (src_0); - - if (GET_CODE (src_0) == CONST_INT - || GET_CODE (src_1) == SYMBOL_REF - || GET_CODE (src_1) == LABEL_REF - || GET_CODE (src_1) == CONST) - return find_base_value (src_1); - - /* This might not be necessary anymore. - - If either operand is a REG that is a known pointer, then it - is the base. */ - if (GET_CODE (src_0) == REG && REGNO_POINTER_FLAG (REGNO (src_0))) - return find_base_value (src_0); - - if (GET_CODE (src_1) == REG && REGNO_POINTER_FLAG (REGNO (src_1))) - return find_base_value (src_1); - - return 0; - } - - case LO_SUM: - /* The standard form is (lo_sum reg sym) so look only at the - second operand. */ - return find_base_value (XEXP (src, 1)); - - case AND: - /* If the second operand is constant set the base - address to the first operand. */ - if (GET_CODE (XEXP (src, 1)) == CONST_INT && INTVAL (XEXP (src, 1)) != 0) - return find_base_value (XEXP (src, 0)); - return 0; - - case ZERO_EXTEND: - case SIGN_EXTEND: /* used for NT/Alpha pointers */ - case HIGH: - return find_base_value (XEXP (src, 0)); - - default: - break; - } - - return 0; -} - -/* Called from init_alias_analysis indirectly through note_stores. */ - -/* while scanning insns to find base values, reg_seen[N] is nonzero if - register N has been set in this function. */ -static char *reg_seen; - -/* Addresses which are known not to alias anything else are identified - by a unique integer. */ -static int unique_id; - -static void -record_set (dest, set) - rtx dest, set; -{ - register int regno; - rtx src; - - if (GET_CODE (dest) != REG) - return; - - regno = REGNO (dest); - - if (set) - { - /* A CLOBBER wipes out any old value but does not prevent a previously - unset register from acquiring a base address (i.e. reg_seen is not - set). */ - if (GET_CODE (set) == CLOBBER) - { - new_reg_base_value[regno] = 0; - return; - } - src = SET_SRC (set); - } - else - { - if (reg_seen[regno]) - { - new_reg_base_value[regno] = 0; - return; - } - reg_seen[regno] = 1; - new_reg_base_value[regno] = gen_rtx_ADDRESS (Pmode, - GEN_INT (unique_id++)); - return; - } - - /* This is not the first set. If the new value is not related to the - old value, forget the base value. Note that the following code is - not detected: - extern int x, y; int *p = &x; p += (&y-&x); - ANSI C does not allow computing the difference of addresses - of distinct top level objects. */ - if (new_reg_base_value[regno]) - switch (GET_CODE (src)) - { - case LO_SUM: - case PLUS: - case MINUS: - if (XEXP (src, 0) != dest && XEXP (src, 1) != dest) - new_reg_base_value[regno] = 0; - break; - case AND: - if (XEXP (src, 0) != dest || GET_CODE (XEXP (src, 1)) != CONST_INT) - new_reg_base_value[regno] = 0; - break; - default: - new_reg_base_value[regno] = 0; - break; - } - /* If this is the first set of a register, record the value. */ - else if ((regno >= FIRST_PSEUDO_REGISTER || ! fixed_regs[regno]) - && ! reg_seen[regno] && new_reg_base_value[regno] == 0) - new_reg_base_value[regno] = find_base_value (src); - - reg_seen[regno] = 1; -} - -/* Called from loop optimization when a new pseudo-register is created. */ -void -record_base_value (regno, val, invariant) - int regno; - rtx val; - int invariant; -{ - if ((unsigned) regno >= reg_base_value_size) - return; - - /* If INVARIANT is true then this value also describes an invariant - relationship which can be used to deduce that two registers with - unknown values are different. */ - if (invariant && alias_invariant) - alias_invariant[regno] = val; - - if (GET_CODE (val) == REG) - { - if ((unsigned) REGNO (val) < reg_base_value_size) - { - reg_base_value[regno] = reg_base_value[REGNO (val)]; - } - return; - } - reg_base_value[regno] = find_base_value (val); -} - -static rtx -canon_rtx (x) - rtx x; -{ - /* Recursively look for equivalences. */ - if (GET_CODE (x) == REG && REGNO (x) >= FIRST_PSEUDO_REGISTER - && REGNO (x) < reg_known_value_size) - return reg_known_value[REGNO (x)] == x - ? x : canon_rtx (reg_known_value[REGNO (x)]); - else if (GET_CODE (x) == PLUS) - { - rtx x0 = canon_rtx (XEXP (x, 0)); - rtx x1 = canon_rtx (XEXP (x, 1)); - - if (x0 != XEXP (x, 0) || x1 != XEXP (x, 1)) - { - /* We can tolerate LO_SUMs being offset here; these - rtl are used for nothing other than comparisons. */ - if (GET_CODE (x0) == CONST_INT) - return plus_constant_for_output (x1, INTVAL (x0)); - else if (GET_CODE (x1) == CONST_INT) - return plus_constant_for_output (x0, INTVAL (x1)); - return gen_rtx_PLUS (GET_MODE (x), x0, x1); - } - } - /* This gives us much better alias analysis when called from - the loop optimizer. Note we want to leave the original - MEM alone, but need to return the canonicalized MEM with - all the flags with their original values. */ - else if (GET_CODE (x) == MEM) - { - rtx addr = canon_rtx (XEXP (x, 0)); - if (addr != XEXP (x, 0)) - { - rtx new = gen_rtx_MEM (GET_MODE (x), addr); - RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (x); - MEM_COPY_ATTRIBUTES (new, x); - MEM_ALIAS_SET (new) = MEM_ALIAS_SET (x); - x = new; - } - } - return x; -} - -/* Return 1 if X and Y are identical-looking rtx's. - - We use the data in reg_known_value above to see if two registers with - different numbers are, in fact, equivalent. */ - -static int -rtx_equal_for_memref_p (x, y) - rtx x, y; -{ - register int i; - register int j; - register enum rtx_code code; - register char *fmt; - - if (x == 0 && y == 0) - return 1; - if (x == 0 || y == 0) - return 0; - x = canon_rtx (x); - y = canon_rtx (y); - - if (x == y) - return 1; - - code = GET_CODE (x); - /* Rtx's of different codes cannot be equal. */ - if (code != GET_CODE (y)) - return 0; - - /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent. - (REG:SI x) and (REG:HI x) are NOT equivalent. */ - - if (GET_MODE (x) != GET_MODE (y)) - return 0; - - /* REG, LABEL_REF, and SYMBOL_REF can be compared nonrecursively. */ - - if (code == REG) - return REGNO (x) == REGNO (y); - if (code == LABEL_REF) - return XEXP (x, 0) == XEXP (y, 0); - if (code == SYMBOL_REF) - return XSTR (x, 0) == XSTR (y, 0); - if (code == CONST_INT) - return INTVAL (x) == INTVAL (y); - if (code == ADDRESSOF) - return REGNO (XEXP (x, 0)) == REGNO (XEXP (y, 0)) && XINT (x, 1) == XINT (y, 1); - - /* For commutative operations, the RTX match if the operand match in any - order. Also handle the simple binary and unary cases without a loop. */ - if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c') - return ((rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)) - && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1))) - || (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 1)) - && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 0)))); - else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == '2') - return (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)) - && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1))); - else if (GET_RTX_CLASS (code) == '1') - return rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)); - - /* Compare the elements. If any pair of corresponding elements - fail to match, return 0 for the whole things. - - Limit cases to types which actually appear in addresses. */ - - fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - { - switch (fmt[i]) - { - case 'i': - if (XINT (x, i) != XINT (y, i)) - return 0; - break; - - case 'E': - /* Two vectors must have the same length. */ - if (XVECLEN (x, i) != XVECLEN (y, i)) - return 0; - - /* And the corresponding elements must match. */ - for (j = 0; j < XVECLEN (x, i); j++) - if (rtx_equal_for_memref_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0) - return 0; - break; - - case 'e': - if (rtx_equal_for_memref_p (XEXP (x, i), XEXP (y, i)) == 0) - return 0; - break; - - /* This can happen for an asm which clobbers memory. */ - case '0': - break; - - /* It is believed that rtx's at this level will never - contain anything but integers and other rtx's, - except for within LABEL_REFs and SYMBOL_REFs. */ - default: - abort (); - } - } - return 1; -} - -/* Given an rtx X, find a SYMBOL_REF or LABEL_REF within - X and return it, or return 0 if none found. */ - -static rtx -find_symbolic_term (x) - rtx x; -{ - register int i; - register enum rtx_code code; - register char *fmt; - - code = GET_CODE (x); - if (code == SYMBOL_REF || code == LABEL_REF) - return x; - if (GET_RTX_CLASS (code) == 'o') - return 0; - - fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - { - rtx t; - - if (fmt[i] == 'e') - { - t = find_symbolic_term (XEXP (x, i)); - if (t != 0) - return t; - } - else if (fmt[i] == 'E') - break; - } - return 0; -} - -static rtx -find_base_term (x) - register rtx x; -{ - switch (GET_CODE (x)) - { - case REG: - return REG_BASE_VALUE (x); - - case ZERO_EXTEND: - case SIGN_EXTEND: /* Used for Alpha/NT pointers */ - case HIGH: - case PRE_INC: - case PRE_DEC: - case POST_INC: - case POST_DEC: - return find_base_term (XEXP (x, 0)); - - case CONST: - x = XEXP (x, 0); - if (GET_CODE (x) != PLUS && GET_CODE (x) != MINUS) - return 0; - /* fall through */ - case LO_SUM: - case PLUS: - case MINUS: - { - rtx tmp1 = XEXP (x, 0); - rtx tmp2 = XEXP (x, 1); - - /* This is a litle bit tricky since we have to determine which of - the two operands represents the real base address. Otherwise this - routine may return the index register instead of the base register. - - That may cause us to believe no aliasing was possible, when in - fact aliasing is possible. - - We use a few simple tests to guess the base register. Additional - tests can certainly be added. For example, if one of the operands - is a shift or multiply, then it must be the index register and the - other operand is the base register. */ - - /* If either operand is known to be a pointer, then use it - to determine the base term. */ - if (REG_P (tmp1) && REGNO_POINTER_FLAG (REGNO (tmp1))) - return find_base_term (tmp1); - - if (REG_P (tmp2) && REGNO_POINTER_FLAG (REGNO (tmp2))) - return find_base_term (tmp2); - - /* Neither operand was known to be a pointer. Go ahead and find the - base term for both operands. */ - tmp1 = find_base_term (tmp1); - tmp2 = find_base_term (tmp2); - - /* If either base term is named object or a special address - (like an argument or stack reference), then use it for the - base term. */ - if (tmp1 - && (GET_CODE (tmp1) == SYMBOL_REF - || GET_CODE (tmp1) == LABEL_REF - || (GET_CODE (tmp1) == ADDRESS - && GET_MODE (tmp1) != VOIDmode))) - return tmp1; - - if (tmp2 - && (GET_CODE (tmp2) == SYMBOL_REF - || GET_CODE (tmp2) == LABEL_REF - || (GET_CODE (tmp2) == ADDRESS - && GET_MODE (tmp2) != VOIDmode))) - return tmp2; - - /* We could not determine which of the two operands was the - base register and which was the index. So we can determine - nothing from the base alias check. */ - return 0; - } - - case AND: - if (GET_CODE (XEXP (x, 0)) == REG && GET_CODE (XEXP (x, 1)) == CONST_INT) - return REG_BASE_VALUE (XEXP (x, 0)); - return 0; - - case SYMBOL_REF: - case LABEL_REF: - return x; - - default: - return 0; - } -} - -/* Return 0 if the addresses X and Y are known to point to different - objects, 1 if they might be pointers to the same object. */ - -static int -base_alias_check (x, y, x_mode, y_mode) - rtx x, y; - enum machine_mode x_mode, y_mode; -{ - rtx x_base = find_base_term (x); - rtx y_base = find_base_term (y); - - /* If the address itself has no known base see if a known equivalent - value has one. If either address still has no known base, nothing - is known about aliasing. */ - if (x_base == 0) - { - rtx x_c; - if (! flag_expensive_optimizations || (x_c = canon_rtx (x)) == x) - return 1; - x_base = find_base_term (x_c); - if (x_base == 0) - return 1; - } - - if (y_base == 0) - { - rtx y_c; - if (! flag_expensive_optimizations || (y_c = canon_rtx (y)) == y) - return 1; - y_base = find_base_term (y_c); - if (y_base == 0) - return 1; - } - - /* If the base addresses are equal nothing is known about aliasing. */ - if (rtx_equal_p (x_base, y_base)) - return 1; - - /* The base addresses of the read and write are different expressions. - If they are both symbols and they are not accessed via AND, there is - no conflict. We can bring knowledge of object alignment into play - here. For example, on alpha, "char a, b;" can alias one another, - though "char a; long b;" cannot. */ - if (GET_CODE (x_base) != ADDRESS && GET_CODE (y_base) != ADDRESS) - { - if (GET_CODE (x) == AND && GET_CODE (y) == AND) - return 1; - if (GET_CODE (x) == AND - && (GET_CODE (XEXP (x, 1)) != CONST_INT - || GET_MODE_UNIT_SIZE (y_mode) < -INTVAL (XEXP (x, 1)))) - return 1; - if (GET_CODE (y) == AND - && (GET_CODE (XEXP (y, 1)) != CONST_INT - || GET_MODE_UNIT_SIZE (x_mode) < -INTVAL (XEXP (y, 1)))) - return 1; - /* Differing symbols never alias. */ - return 0; - } - - /* If one address is a stack reference there can be no alias: - stack references using different base registers do not alias, - a stack reference can not alias a parameter, and a stack reference - can not alias a global. */ - if ((GET_CODE (x_base) == ADDRESS && GET_MODE (x_base) == Pmode) - || (GET_CODE (y_base) == ADDRESS && GET_MODE (y_base) == Pmode)) - return 0; - - if (! flag_argument_noalias) - return 1; - - if (flag_argument_noalias > 1) - return 0; - - /* Weak noalias assertion (arguments are distinct, but may match globals). */ - return ! (GET_MODE (x_base) == VOIDmode && GET_MODE (y_base) == VOIDmode); -} - -/* Return the address of the (N_REFS + 1)th memory reference to ADDR - where SIZE is the size in bytes of the memory reference. If ADDR - is not modified by the memory reference then ADDR is returned. */ - -rtx -addr_side_effect_eval (addr, size, n_refs) - rtx addr; - int size; - int n_refs; -{ - int offset = 0; - - switch (GET_CODE (addr)) - { - case PRE_INC: - offset = (n_refs + 1) * size; - break; - case PRE_DEC: - offset = -(n_refs + 1) * size; - break; - case POST_INC: - offset = n_refs * size; - break; - case POST_DEC: - offset = -n_refs * size; - break; - - default: - return addr; - } - - if (offset) - addr = gen_rtx_PLUS (GET_MODE (addr), XEXP (addr, 0), GEN_INT (offset)); - else - addr = XEXP (addr, 0); - - return addr; -} - -/* Return nonzero if X and Y (memory addresses) could reference the - same location in memory. C is an offset accumulator. When - C is nonzero, we are testing aliases between X and Y + C. - XSIZE is the size in bytes of the X reference, - similarly YSIZE is the size in bytes for Y. - - If XSIZE or YSIZE is zero, we do not know the amount of memory being - referenced (the reference was BLKmode), so make the most pessimistic - assumptions. - - If XSIZE or YSIZE is negative, we may access memory outside the object - being referenced as a side effect. This can happen when using AND to - align memory references, as is done on the Alpha. - - Nice to notice that varying addresses cannot conflict with fp if no - local variables had their addresses taken, but that's too hard now. */ - - -static int -memrefs_conflict_p (xsize, x, ysize, y, c) - register rtx x, y; - int xsize, ysize; - HOST_WIDE_INT c; -{ - if (GET_CODE (x) == HIGH) - x = XEXP (x, 0); - else if (GET_CODE (x) == LO_SUM) - x = XEXP (x, 1); - else - x = canon_rtx (addr_side_effect_eval (x, xsize, 0)); - if (GET_CODE (y) == HIGH) - y = XEXP (y, 0); - else if (GET_CODE (y) == LO_SUM) - y = XEXP (y, 1); - else - y = canon_rtx (addr_side_effect_eval (y, ysize, 0)); - - if (rtx_equal_for_memref_p (x, y)) - { - if (xsize <= 0 || ysize <= 0) - return 1; - if (c >= 0 && xsize > c) - return 1; - if (c < 0 && ysize+c > 0) - return 1; - return 0; - } - - /* This code used to check for conflicts involving stack references and - globals but the base address alias code now handles these cases. */ - - if (GET_CODE (x) == PLUS) - { - /* The fact that X is canonicalized means that this - PLUS rtx is canonicalized. */ - rtx x0 = XEXP (x, 0); - rtx x1 = XEXP (x, 1); - - if (GET_CODE (y) == PLUS) - { - /* The fact that Y is canonicalized means that this - PLUS rtx is canonicalized. */ - rtx y0 = XEXP (y, 0); - rtx y1 = XEXP (y, 1); - - if (rtx_equal_for_memref_p (x1, y1)) - return memrefs_conflict_p (xsize, x0, ysize, y0, c); - if (rtx_equal_for_memref_p (x0, y0)) - return memrefs_conflict_p (xsize, x1, ysize, y1, c); - if (GET_CODE (x1) == CONST_INT) - { - if (GET_CODE (y1) == CONST_INT) - return memrefs_conflict_p (xsize, x0, ysize, y0, - c - INTVAL (x1) + INTVAL (y1)); - else - return memrefs_conflict_p (xsize, x0, ysize, y, - c - INTVAL (x1)); - } - else if (GET_CODE (y1) == CONST_INT) - return memrefs_conflict_p (xsize, x, ysize, y0, c + INTVAL (y1)); - - return 1; - } - else if (GET_CODE (x1) == CONST_INT) - return memrefs_conflict_p (xsize, x0, ysize, y, c - INTVAL (x1)); - } - else if (GET_CODE (y) == PLUS) - { - /* The fact that Y is canonicalized means that this - PLUS rtx is canonicalized. */ - rtx y0 = XEXP (y, 0); - rtx y1 = XEXP (y, 1); - - if (GET_CODE (y1) == CONST_INT) - return memrefs_conflict_p (xsize, x, ysize, y0, c + INTVAL (y1)); - else - return 1; - } - - if (GET_CODE (x) == GET_CODE (y)) - switch (GET_CODE (x)) - { - case MULT: - { - /* Handle cases where we expect the second operands to be the - same, and check only whether the first operand would conflict - or not. */ - rtx x0, y0; - rtx x1 = canon_rtx (XEXP (x, 1)); - rtx y1 = canon_rtx (XEXP (y, 1)); - if (! rtx_equal_for_memref_p (x1, y1)) - return 1; - x0 = canon_rtx (XEXP (x, 0)); - y0 = canon_rtx (XEXP (y, 0)); - if (rtx_equal_for_memref_p (x0, y0)) - return (xsize == 0 || ysize == 0 - || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0)); - - /* Can't properly adjust our sizes. */ - if (GET_CODE (x1) != CONST_INT) - return 1; - xsize /= INTVAL (x1); - ysize /= INTVAL (x1); - c /= INTVAL (x1); - return memrefs_conflict_p (xsize, x0, ysize, y0, c); - } - - case REG: - /* Are these registers known not to be equal? */ - if (alias_invariant) - { - unsigned int r_x = REGNO (x), r_y = REGNO (y); - rtx i_x, i_y; /* invariant relationships of X and Y */ - - i_x = r_x >= reg_base_value_size ? 0 : alias_invariant[r_x]; - i_y = r_y >= reg_base_value_size ? 0 : alias_invariant[r_y]; - - if (i_x == 0 && i_y == 0) - break; - - if (! memrefs_conflict_p (xsize, i_x ? i_x : x, - ysize, i_y ? i_y : y, c)) - return 0; - } - break; - - default: - break; - } - - /* Treat an access through an AND (e.g. a subword access on an Alpha) - as an access with indeterminate size. Assume that references - besides AND are aligned, so if the size of the other reference is - at least as large as the alignment, assume no other overlap. */ - if (GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT) - { - if (GET_CODE (y) == AND || ysize < -INTVAL (XEXP (x, 1))) - xsize = -1; - return memrefs_conflict_p (xsize, XEXP (x, 0), ysize, y, c); - } - if (GET_CODE (y) == AND && GET_CODE (XEXP (y, 1)) == CONST_INT) - { - /* ??? If we are indexing far enough into the array/structure, we - may yet be able to determine that we can not overlap. But we - also need to that we are far enough from the end not to overlap - a following reference, so we do nothing with that for now. */ - if (GET_CODE (x) == AND || xsize < -INTVAL (XEXP (y, 1))) - ysize = -1; - return memrefs_conflict_p (xsize, x, ysize, XEXP (y, 0), c); - } - - if (CONSTANT_P (x)) - { - if (GET_CODE (x) == CONST_INT && GET_CODE (y) == CONST_INT) - { - c += (INTVAL (y) - INTVAL (x)); - return (xsize <= 0 || ysize <= 0 - || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0)); - } - - if (GET_CODE (x) == CONST) - { - if (GET_CODE (y) == CONST) - return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)), - ysize, canon_rtx (XEXP (y, 0)), c); - else - return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)), - ysize, y, c); - } - if (GET_CODE (y) == CONST) - return memrefs_conflict_p (xsize, x, ysize, - canon_rtx (XEXP (y, 0)), c); - - if (CONSTANT_P (y)) - return (xsize < 0 || ysize < 0 - || (rtx_equal_for_memref_p (x, y) - && (xsize == 0 || ysize == 0 - || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0)))); - - return 1; - } - return 1; -} - -/* Functions to compute memory dependencies. - - Since we process the insns in execution order, we can build tables - to keep track of what registers are fixed (and not aliased), what registers - are varying in known ways, and what registers are varying in unknown - ways. - - If both memory references are volatile, then there must always be a - dependence between the two references, since their order can not be - changed. A volatile and non-volatile reference can be interchanged - though. - - A MEM_IN_STRUCT reference at a non-QImode non-AND varying address can never - conflict with a non-MEM_IN_STRUCT reference at a fixed address. We must - allow QImode aliasing because the ANSI C standard allows character - pointers to alias anything. We are assuming that characters are - always QImode here. We also must allow AND addresses, because they may - generate accesses outside the object being referenced. This is used to - generate aligned addresses from unaligned addresses, for instance, the - alpha storeqi_unaligned pattern. */ - -/* Read dependence: X is read after read in MEM takes place. There can - only be a dependence here if both reads are volatile. */ - -int -read_dependence (mem, x) - rtx mem; - rtx x; -{ - return MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem); -} - -/* Returns MEM1 if and only if MEM1 is a scalar at a fixed address and - MEM2 is a reference to a structure at a varying address, or returns - MEM2 if vice versa. Otherwise, returns NULL_RTX. If a non-NULL - value is returned MEM1 and MEM2 can never alias. VARIES_P is used - to decide whether or not an address may vary; it should return - nozero whenever variation is possible. */ - -static rtx -fixed_scalar_and_varying_struct_p (mem1, mem2, varies_p) - rtx mem1; - rtx mem2; - int (*varies_p) PROTO((rtx)); -{ - rtx mem1_addr = XEXP (mem1, 0); - rtx mem2_addr = XEXP (mem2, 0); - - if (MEM_SCALAR_P (mem1) && MEM_IN_STRUCT_P (mem2) - && !varies_p (mem1_addr) && varies_p (mem2_addr)) - /* MEM1 is a scalar at a fixed address; MEM2 is a struct at a - varying address. */ - return mem1; - - if (MEM_IN_STRUCT_P (mem1) && MEM_SCALAR_P (mem2) - && varies_p (mem1_addr) && !varies_p (mem2_addr)) - /* MEM2 is a scalar at a fixed address; MEM1 is a struct at a - varying address. */ - return mem2; - - return NULL_RTX; -} - -/* Returns nonzero if something about the mode or address format MEM1 - indicates that it might well alias *anything*. */ - -static int -aliases_everything_p (mem) - rtx mem; -{ - if (GET_MODE (mem) == QImode) - /* ANSI C says that a `char*' can point to anything. */ - return 1; - - if (GET_CODE (XEXP (mem, 0)) == AND) - /* If the address is an AND, its very hard to know at what it is - actually pointing. */ - return 1; - - return 0; -} - -/* True dependence: X is read after store in MEM takes place. */ - -int -true_dependence (mem, mem_mode, x, varies) - rtx mem; - enum machine_mode mem_mode; - rtx x; - int (*varies) PROTO((rtx)); -{ - register rtx x_addr, mem_addr; - - if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem)) - return 1; - - if (DIFFERENT_ALIAS_SETS_P (x, mem)) - return 0; - - /* If X is an unchanging read, then it can't possibly conflict with any - non-unchanging store. It may conflict with an unchanging write though, - because there may be a single store to this address to initialize it. - Just fall through to the code below to resolve the case where we have - both an unchanging read and an unchanging write. This won't handle all - cases optimally, but the possible performance loss should be - negligible. */ - if (RTX_UNCHANGING_P (x) && ! RTX_UNCHANGING_P (mem)) - return 0; - - if (mem_mode == VOIDmode) - mem_mode = GET_MODE (mem); - - if (! base_alias_check (XEXP (x, 0), XEXP (mem, 0), GET_MODE (x), mem_mode)) - return 0; - - x_addr = canon_rtx (XEXP (x, 0)); - mem_addr = canon_rtx (XEXP (mem, 0)); - - if (! memrefs_conflict_p (GET_MODE_SIZE (mem_mode), mem_addr, - SIZE_FOR_MODE (x), x_addr, 0)) - return 0; - - if (aliases_everything_p (x)) - return 1; - - /* We cannot use aliases_everyting_p to test MEM, since we must look - at MEM_MODE, rather than GET_MODE (MEM). */ - if (mem_mode == QImode || GET_CODE (mem_addr) == AND) - return 1; - - /* In true_dependence we also allow BLKmode to alias anything. Why - don't we do this in anti_dependence and output_dependence? */ - if (mem_mode == BLKmode || GET_MODE (x) == BLKmode) - return 1; - - return !fixed_scalar_and_varying_struct_p (mem, x, varies); -} - -/* Returns non-zero if a write to X might alias a previous read from - (or, if WRITEP is non-zero, a write to) MEM. */ - -static int -write_dependence_p (mem, x, writep) - rtx mem; - rtx x; - int writep; -{ - rtx x_addr, mem_addr; - rtx fixed_scalar; - - if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem)) - return 1; - - /* If MEM is an unchanging read, then it can't possibly conflict with - the store to X, because there is at most one store to MEM, and it must - have occurred somewhere before MEM. */ - if (!writep && RTX_UNCHANGING_P (mem)) - return 0; - - if (! base_alias_check (XEXP (x, 0), XEXP (mem, 0), GET_MODE (x), - GET_MODE (mem))) - return 0; - - x = canon_rtx (x); - mem = canon_rtx (mem); - - if (DIFFERENT_ALIAS_SETS_P (x, mem)) - return 0; - - x_addr = XEXP (x, 0); - mem_addr = XEXP (mem, 0); - - if (!memrefs_conflict_p (SIZE_FOR_MODE (mem), mem_addr, - SIZE_FOR_MODE (x), x_addr, 0)) - return 0; - - fixed_scalar - = fixed_scalar_and_varying_struct_p (mem, x, rtx_addr_varies_p); - - return (!(fixed_scalar == mem && !aliases_everything_p (x)) - && !(fixed_scalar == x && !aliases_everything_p (mem))); -} - -/* Anti dependence: X is written after read in MEM takes place. */ - -int -anti_dependence (mem, x) - rtx mem; - rtx x; -{ - return write_dependence_p (mem, x, /*writep=*/0); -} - -/* Output dependence: X is written after store in MEM takes place. */ - -int -output_dependence (mem, x) - register rtx mem; - register rtx x; -{ - return write_dependence_p (mem, x, /*writep=*/1); -} - - -static HARD_REG_SET argument_registers; - -void -init_alias_once () -{ - register int i; - -#ifndef OUTGOING_REGNO -#define OUTGOING_REGNO(N) N -#endif - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - /* Check whether this register can hold an incoming pointer - argument. FUNCTION_ARG_REGNO_P tests outgoing register - numbers, so translate if necessary due to register windows. */ - if (FUNCTION_ARG_REGNO_P (OUTGOING_REGNO (i)) - && HARD_REGNO_MODE_OK (i, Pmode)) - SET_HARD_REG_BIT (argument_registers, i); - - alias_sets = splay_tree_new (splay_tree_compare_ints, 0, 0); -} - -void -init_alias_analysis () -{ - int maxreg = max_reg_num (); - int changed, pass; - register int i; - register unsigned int ui; - register rtx insn; - - reg_known_value_size = maxreg; - - reg_known_value - = (rtx *) oballoc ((maxreg - FIRST_PSEUDO_REGISTER) * sizeof (rtx)) - - FIRST_PSEUDO_REGISTER; - reg_known_equiv_p = - oballoc (maxreg - FIRST_PSEUDO_REGISTER) - FIRST_PSEUDO_REGISTER; - bzero ((char *) (reg_known_value + FIRST_PSEUDO_REGISTER), - (maxreg-FIRST_PSEUDO_REGISTER) * sizeof (rtx)); - bzero (reg_known_equiv_p + FIRST_PSEUDO_REGISTER, - (maxreg - FIRST_PSEUDO_REGISTER) * sizeof (char)); - - /* Overallocate reg_base_value to allow some growth during loop - optimization. Loop unrolling can create a large number of - registers. */ - reg_base_value_size = maxreg * 2; - reg_base_value = (rtx *)oballoc (reg_base_value_size * sizeof (rtx)); - new_reg_base_value = (rtx *)alloca (reg_base_value_size * sizeof (rtx)); - reg_seen = (char *)alloca (reg_base_value_size); - bzero ((char *) reg_base_value, reg_base_value_size * sizeof (rtx)); - if (! reload_completed && flag_unroll_loops) - { - alias_invariant = (rtx *)xrealloc (alias_invariant, - reg_base_value_size * sizeof (rtx)); - bzero ((char *)alias_invariant, reg_base_value_size * sizeof (rtx)); - } - - - /* The basic idea is that each pass through this loop will use the - "constant" information from the previous pass to propagate alias - information through another level of assignments. - - This could get expensive if the assignment chains are long. Maybe - we should throttle the number of iterations, possibly based on - the optimization level or flag_expensive_optimizations. - - We could propagate more information in the first pass by making use - of REG_N_SETS to determine immediately that the alias information - for a pseudo is "constant". - - A program with an uninitialized variable can cause an infinite loop - here. Instead of doing a full dataflow analysis to detect such problems - we just cap the number of iterations for the loop. - - The state of the arrays for the set chain in question does not matter - since the program has undefined behavior. */ - - pass = 0; - do - { - /* Assume nothing will change this iteration of the loop. */ - changed = 0; - - /* We want to assign the same IDs each iteration of this loop, so - start counting from zero each iteration of the loop. */ - unique_id = 0; - - /* We're at the start of the funtion each iteration through the - loop, so we're copying arguments. */ - copying_arguments = 1; - - /* Wipe the potential alias information clean for this pass. */ - bzero ((char *) new_reg_base_value, reg_base_value_size * sizeof (rtx)); - - /* Wipe the reg_seen array clean. */ - bzero ((char *) reg_seen, reg_base_value_size); - - /* Mark all hard registers which may contain an address. - The stack, frame and argument pointers may contain an address. - An argument register which can hold a Pmode value may contain - an address even if it is not in BASE_REGS. - - The address expression is VOIDmode for an argument and - Pmode for other registers. */ - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (TEST_HARD_REG_BIT (argument_registers, i)) - new_reg_base_value[i] = gen_rtx_ADDRESS (VOIDmode, - gen_rtx_REG (Pmode, i)); - - new_reg_base_value[STACK_POINTER_REGNUM] - = gen_rtx_ADDRESS (Pmode, stack_pointer_rtx); - new_reg_base_value[ARG_POINTER_REGNUM] - = gen_rtx_ADDRESS (Pmode, arg_pointer_rtx); - new_reg_base_value[FRAME_POINTER_REGNUM] - = gen_rtx_ADDRESS (Pmode, frame_pointer_rtx); -#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM - new_reg_base_value[HARD_FRAME_POINTER_REGNUM] - = gen_rtx_ADDRESS (Pmode, hard_frame_pointer_rtx); -#endif - if (struct_value_incoming_rtx - && GET_CODE (struct_value_incoming_rtx) == REG) - new_reg_base_value[REGNO (struct_value_incoming_rtx)] - = gen_rtx_ADDRESS (Pmode, struct_value_incoming_rtx); - - if (static_chain_rtx - && GET_CODE (static_chain_rtx) == REG) - new_reg_base_value[REGNO (static_chain_rtx)] - = gen_rtx_ADDRESS (Pmode, static_chain_rtx); - - /* Walk the insns adding values to the new_reg_base_value array. */ - for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - { - if (GET_RTX_CLASS (GET_CODE (insn)) == 'i') - { - rtx note, set; - /* If this insn has a noalias note, process it, Otherwise, - scan for sets. A simple set will have no side effects - which could change the base value of any other register. */ - - if (GET_CODE (PATTERN (insn)) == SET - && (find_reg_note (insn, REG_NOALIAS, NULL_RTX))) - record_set (SET_DEST (PATTERN (insn)), NULL_RTX); - else - note_stores (PATTERN (insn), record_set); - - set = single_set (insn); - - if (set != 0 - && GET_CODE (SET_DEST (set)) == REG - && REGNO (SET_DEST (set)) >= FIRST_PSEUDO_REGISTER - && (((note = find_reg_note (insn, REG_EQUAL, 0)) != 0 - && REG_N_SETS (REGNO (SET_DEST (set))) == 1) - || (note = find_reg_note (insn, REG_EQUIV, NULL_RTX)) != 0) - && GET_CODE (XEXP (note, 0)) != EXPR_LIST - && ! reg_overlap_mentioned_p (SET_DEST (set), XEXP (note, 0))) - { - int regno = REGNO (SET_DEST (set)); - reg_known_value[regno] = XEXP (note, 0); - reg_known_equiv_p[regno] = REG_NOTE_KIND (note) == REG_EQUIV; - } - } - else if (GET_CODE (insn) == NOTE - && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG) - copying_arguments = 0; - } - - /* Now propagate values from new_reg_base_value to reg_base_value. */ - for (ui = 0; ui < reg_base_value_size; ui++) - { - if (new_reg_base_value[ui] - && new_reg_base_value[ui] != reg_base_value[ui] - && ! rtx_equal_p (new_reg_base_value[ui], reg_base_value[ui])) - { - reg_base_value[ui] = new_reg_base_value[ui]; - changed = 1; - } - } - } - while (changed && ++pass < MAX_ALIAS_LOOP_PASSES); - - /* Fill in the remaining entries. */ - for (i = FIRST_PSEUDO_REGISTER; i < maxreg; i++) - if (reg_known_value[i] == 0) - reg_known_value[i] = regno_reg_rtx[i]; - - /* Simplify the reg_base_value array so that no register refers to - another register, except to special registers indirectly through - ADDRESS expressions. - - In theory this loop can take as long as O(registers^2), but unless - there are very long dependency chains it will run in close to linear - time. - - This loop may not be needed any longer now that the main loop does - a better job at propagating alias information. */ - pass = 0; - do - { - changed = 0; - pass++; - for (ui = 0; ui < reg_base_value_size; ui++) - { - rtx base = reg_base_value[ui]; - if (base && GET_CODE (base) == REG) - { - unsigned int base_regno = REGNO (base); - if (base_regno == ui) /* register set from itself */ - reg_base_value[ui] = 0; - else - reg_base_value[ui] = reg_base_value[base_regno]; - changed = 1; - } - } - } - while (changed && pass < MAX_ALIAS_LOOP_PASSES); - - new_reg_base_value = 0; - reg_seen = 0; -} - -void -end_alias_analysis () -{ - reg_known_value = 0; - reg_base_value = 0; - reg_base_value_size = 0; - if (alias_invariant) - { - free ((char *)alias_invariant); - alias_invariant = 0; - } -} diff --git a/contrib/gcc/alloca.c b/contrib/gcc/alloca.c deleted file mode 100644 index 8f98b73dbb90..000000000000 --- a/contrib/gcc/alloca.c +++ /dev/null @@ -1,504 +0,0 @@ -/* alloca.c -- allocate automatically reclaimed memory - (Mostly) portable public-domain implementation -- D A Gwyn - - This implementation of the PWB library alloca function, - which is used to allocate space off the run-time stack so - that it is automatically reclaimed upon procedure exit, - was inspired by discussions with J. Q. Johnson of Cornell. - J.Otto Tennant contributed the Cray support. - - There are some preprocessor constants that can - be defined when compiling for your specific system, for - improved efficiency; however, the defaults should be okay. - - The general concept of this implementation is to keep - track of all alloca-allocated blocks, and reclaim any - that are found to be deeper in the stack than the current - invocation. This heuristic does not reclaim storage as - soon as it becomes invalid, but it will do so eventually. - - As a special case, alloca(0) reclaims storage without - allocating any. It is a good idea to use alloca(0) in - your main control loop, etc. to force garbage collection. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif - -#ifdef emacs -#include "blockinput.h" -#endif - -/* If compiling with GCC 2, this file's not needed. */ -#if !defined (__GNUC__) || __GNUC__ < 2 - -/* If someone has defined alloca as a macro, - there must be some other way alloca is supposed to work. */ -#ifndef alloca - -#ifdef emacs -#ifdef static -/* actually, only want this if static is defined as "" - -- this is for usg, in which emacs must undefine static - in order to make unexec workable - */ -#ifndef STACK_DIRECTION -you -lose --- must know STACK_DIRECTION at compile-time -#endif /* STACK_DIRECTION undefined */ -#endif /* static */ -#endif /* emacs */ - -/* If your stack is a linked list of frames, you have to - provide an "address metric" ADDRESS_FUNCTION macro. */ - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) -long i00afunc (); -#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) -#else -#define ADDRESS_FUNCTION(arg) &(arg) -#endif - -#if __STDC__ -typedef void *pointer; -#else -typedef char *pointer; -#endif - -#ifndef NULL -#define NULL 0 -#endif - -/* Different portions of Emacs need to call different versions of - malloc. The Emacs executable needs alloca to call xmalloc, because - ordinary malloc isn't protected from input signals. On the other - hand, the utilities in lib-src need alloca to call malloc; some of - them are very simple, and don't have an xmalloc routine. - - Non-Emacs programs expect this to call use xmalloc. - - Callers below should use malloc. */ - -#ifndef emacs -#define malloc xmalloc -#endif -extern pointer malloc (); - -/* Define STACK_DIRECTION if you know the direction of stack - growth for your system; otherwise it will be automatically - deduced at run-time. - - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ - -#ifndef STACK_DIRECTION -#define STACK_DIRECTION 0 /* Direction unknown. */ -#endif - -#if STACK_DIRECTION != 0 - -#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ - -#else /* STACK_DIRECTION == 0; need run-time code. */ - -static int stack_dir; /* 1 or -1 once known. */ -#define STACK_DIR stack_dir - -static void -find_stack_direction () -{ - static char *addr = NULL; /* Address of first `dummy', once known. */ - auto char dummy; /* To get stack address. */ - - if (addr == NULL) - { /* Initial entry. */ - addr = ADDRESS_FUNCTION (dummy); - - find_stack_direction (); /* Recurse once. */ - } - else - { - /* Second entry. */ - if (ADDRESS_FUNCTION (dummy) > addr) - stack_dir = 1; /* Stack grew upward. */ - else - stack_dir = -1; /* Stack grew downward. */ - } -} - -#endif /* STACK_DIRECTION == 0 */ - -/* An "alloca header" is used to: - (a) chain together all alloca'ed blocks; - (b) keep track of stack depth. - - It is very important that sizeof(header) agree with malloc - alignment chunk size. The following default should work okay. */ - -#ifndef ALIGN_SIZE -#define ALIGN_SIZE sizeof(double) -#endif - -typedef union hdr -{ - char align[ALIGN_SIZE]; /* To force sizeof(header). */ - struct - { - union hdr *next; /* For chaining headers. */ - char *deep; /* For stack depth measure. */ - } h; -} header; - -static header *last_alloca_header = NULL; /* -> last alloca header. */ - -/* Return a pointer to at least SIZE bytes of storage, - which will be automatically reclaimed upon exit from - the procedure that called alloca. Originally, this space - was supposed to be taken from the current stack frame of the - caller, but that method cannot be made to work for some - implementations of C, for example under Gould's UTX/32. */ - -pointer -alloca (size) - unsigned size; -{ - auto char probe; /* Probes stack depth: */ - register char *depth = ADDRESS_FUNCTION (probe); - -#if STACK_DIRECTION == 0 - if (STACK_DIR == 0) /* Unknown growth direction. */ - find_stack_direction (); -#endif - - /* Reclaim garbage, defined as all alloca'd storage that - was allocated from deeper in the stack than currently. */ - - { - register header *hp; /* Traverses linked list. */ - -#ifdef emacs - BLOCK_INPUT; -#endif - - for (hp = last_alloca_header; hp != NULL;) - if ((STACK_DIR > 0 && hp->h.deep > depth) - || (STACK_DIR < 0 && hp->h.deep < depth)) - { - register header *np = hp->h.next; - - free ((pointer) hp); /* Collect garbage. */ - - hp = np; /* -> next header. */ - } - else - break; /* Rest are not deeper. */ - - last_alloca_header = hp; /* -> last valid storage. */ - -#ifdef emacs - UNBLOCK_INPUT; -#endif - } - - if (size == 0) - return NULL; /* No allocation required. */ - - /* Allocate combined header + user data storage. */ - - { - register pointer new = malloc (sizeof (header) + size); - /* Address of header. */ - - if (new == 0) - abort(); - - ((header *) new)->h.next = last_alloca_header; - ((header *) new)->h.deep = depth; - - last_alloca_header = (header *) new; - - /* User storage begins just after header. */ - - return (pointer) ((char *) new + sizeof (header)); - } -} - -#if defined (CRAY) && defined (CRAY_STACKSEG_END) - -#ifdef DEBUG_I00AFUNC -#include -#endif - -#ifndef CRAY_STACK -#define CRAY_STACK -#ifndef CRAY2 -/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ -struct stack_control_header - { - long shgrow:32; /* Number of times stack has grown. */ - long shaseg:32; /* Size of increments to stack. */ - long shhwm:32; /* High water mark of stack. */ - long shsize:32; /* Current size of stack (all segments). */ - }; - -/* The stack segment linkage control information occurs at - the high-address end of a stack segment. (The stack - grows from low addresses to high addresses.) The initial - part of the stack segment linkage control information is - 0200 (octal) words. This provides for register storage - for the routine which overflows the stack. */ - -struct stack_segment_linkage - { - long ss[0200]; /* 0200 overflow words. */ - long sssize:32; /* Number of words in this segment. */ - long ssbase:32; /* Offset to stack base. */ - long:32; - long sspseg:32; /* Offset to linkage control of previous - segment of stack. */ - long:32; - long sstcpt:32; /* Pointer to task common address block. */ - long sscsnm; /* Private control structure number for - microtasking. */ - long ssusr1; /* Reserved for user. */ - long ssusr2; /* Reserved for user. */ - long sstpid; /* Process ID for pid based multi-tasking. */ - long ssgvup; /* Pointer to multitasking thread giveup. */ - long sscray[7]; /* Reserved for Cray Research. */ - long ssa0; - long ssa1; - long ssa2; - long ssa3; - long ssa4; - long ssa5; - long ssa6; - long ssa7; - long sss0; - long sss1; - long sss2; - long sss3; - long sss4; - long sss5; - long sss6; - long sss7; - }; - -#else /* CRAY2 */ -/* The following structure defines the vector of words - returned by the STKSTAT library routine. */ -struct stk_stat - { - long now; /* Current total stack size. */ - long maxc; /* Amount of contiguous space which would - be required to satisfy the maximum - stack demand to date. */ - long high_water; /* Stack high-water mark. */ - long overflows; /* Number of stack overflow ($STKOFEN) calls. */ - long hits; /* Number of internal buffer hits. */ - long extends; /* Number of block extensions. */ - long stko_mallocs; /* Block allocations by $STKOFEN. */ - long underflows; /* Number of stack underflow calls ($STKRETN). */ - long stko_free; /* Number of deallocations by $STKRETN. */ - long stkm_free; /* Number of deallocations by $STKMRET. */ - long segments; /* Current number of stack segments. */ - long maxs; /* Maximum number of stack segments so far. */ - long pad_size; /* Stack pad size. */ - long current_address; /* Current stack segment address. */ - long current_size; /* Current stack segment size. This - number is actually corrupted by STKSTAT to - include the fifteen word trailer area. */ - long initial_address; /* Address of initial segment. */ - long initial_size; /* Size of initial segment. */ - }; - -/* The following structure describes the data structure which trails - any stack segment. I think that the description in 'asdef' is - out of date. I only describe the parts that I am sure about. */ - -struct stk_trailer - { - long this_address; /* Address of this block. */ - long this_size; /* Size of this block (does not include - this trailer). */ - long unknown2; - long unknown3; - long link; /* Address of trailer block of previous - segment. */ - long unknown5; - long unknown6; - long unknown7; - long unknown8; - long unknown9; - long unknown10; - long unknown11; - long unknown12; - long unknown13; - long unknown14; - }; - -#endif /* CRAY2 */ -#endif /* not CRAY_STACK */ - -#ifdef CRAY2 -/* Determine a "stack measure" for an arbitrary ADDRESS. - I doubt that "lint" will like this much. */ - -static long -i00afunc (long *address) -{ - struct stk_stat status; - struct stk_trailer *trailer; - long *block, size; - long result = 0; - - /* We want to iterate through all of the segments. The first - step is to get the stack status structure. We could do this - more quickly and more directly, perhaps, by referencing the - $LM00 common block, but I know that this works. */ - - STKSTAT (&status); - - /* Set up the iteration. */ - - trailer = (struct stk_trailer *) (status.current_address - + status.current_size - - 15); - - /* There must be at least one stack segment. Therefore it is - a fatal error if "trailer" is null. */ - - if (trailer == 0) - abort (); - - /* Discard segments that do not contain our argument address. */ - - while (trailer != 0) - { - block = (long *) trailer->this_address; - size = trailer->this_size; - if (block == 0 || size == 0) - abort (); - trailer = (struct stk_trailer *) trailer->link; - if ((block <= address) && (address < (block + size))) - break; - } - - /* Set the result to the offset in this segment and add the sizes - of all predecessor segments. */ - - result = address - block; - - if (trailer == 0) - { - return result; - } - - do - { - if (trailer->this_size <= 0) - abort (); - result += trailer->this_size; - trailer = (struct stk_trailer *) trailer->link; - } - while (trailer != 0); - - /* We are done. Note that if you present a bogus address (one - not in any segment), you will get a different number back, formed - from subtracting the address of the first block. This is probably - not what you want. */ - - return (result); -} - -#else /* not CRAY2 */ -/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. - Determine the number of the cell within the stack, - given the address of the cell. The purpose of this - routine is to linearize, in some sense, stack addresses - for alloca. */ - -static long -i00afunc (long address) -{ - long stkl = 0; - - long size, pseg, this_segment, stack; - long result = 0; - - struct stack_segment_linkage *ssptr; - - /* Register B67 contains the address of the end of the - current stack segment. If you (as a subprogram) store - your registers on the stack and find that you are past - the contents of B67, you have overflowed the segment. - - B67 also points to the stack segment linkage control - area, which is what we are really interested in. */ - - stkl = CRAY_STACKSEG_END (); - ssptr = (struct stack_segment_linkage *) stkl; - - /* If one subtracts 'size' from the end of the segment, - one has the address of the first word of the segment. - - If this is not the first segment, 'pseg' will be - nonzero. */ - - pseg = ssptr->sspseg; - size = ssptr->sssize; - - this_segment = stkl - size; - - /* It is possible that calling this routine itself caused - a stack overflow. Discard stack segments which do not - contain the target address. */ - - while (!(this_segment <= address && address <= stkl)) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); -#endif - if (pseg == 0) - break; - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - this_segment = stkl - size; - } - - result = address - this_segment; - - /* If you subtract pseg from the current end of the stack, - you get the address of the previous stack segment's end. - This seems a little convoluted to me, but I'll bet you save - a cycle somewhere. */ - - while (pseg != 0) - { -#ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o\n", pseg, size); -#endif - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - result += size; - } - return (result); -} - -#endif /* not CRAY2 */ -#endif /* CRAY */ - -#endif /* no alloca */ -#endif /* not GCC version 2 */ diff --git a/contrib/gcc/ansidecl.h b/contrib/gcc/ansidecl.h deleted file mode 100644 index cdb9fb71961e..000000000000 --- a/contrib/gcc/ansidecl.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ANSI and traditional C compatability macros - Copyright 1991, 1992, 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - -This program 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 of the License, or -(at your option) any later version. - -This program 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. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* ANSI and traditional C compatibility macros - - ANSI C is assumed if __STDC__ is #defined. - - Macro ANSI C definition Traditional C definition - ----- ---- - ---------- ----------- - ---------- - PTR `void *' `char *' - LONG_DOUBLE `long double' `double' - VOLATILE `volatile' `' - SIGNED `signed' `' - PTRCONST `void *const' `char *' - ANSI_PROTOTYPES 1 not defined - - CONST is also defined, but is obsolete. Just use const. - - obsolete -- DEFUN (name, arglist, args) - - Defines function NAME. - - ARGLIST lists the arguments, separated by commas and enclosed in - parentheses. ARGLIST becomes the argument list in traditional C. - - ARGS list the arguments with their types. It becomes a prototype in - ANSI C, and the type declarations in traditional C. Arguments should - be separated with `AND'. For functions with a variable number of - arguments, the last thing listed should be `DOTS'. - - obsolete -- DEFUN_VOID (name) - - Defines a function NAME, which takes no arguments. - - obsolete -- EXFUN (name, (prototype)) -- obsolete. - - Replaced by PARAMS. Do not use; will disappear someday soon. - Was used in external function declarations. - In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in - parentheses). In traditional C it is `NAME()'. - For a function that takes no arguments, PROTOTYPE should be `(void)'. - - obsolete -- PROTO (type, name, (prototype) -- obsolete. - - This one has also been replaced by PARAMS. Do not use. - - PARAMS ((args)) - - We could use the EXFUN macro to handle prototype declarations, but - the name is misleading and the result is ugly. So we just define a - simple macro to handle the parameter lists, as in: - - static int foo PARAMS ((int, char)); - - This produces: `static int foo();' or `static int foo (int, char);' - - EXFUN would have done it like this: - - static int EXFUN (foo, (int, char)); - - but the function is not external...and it's hard to visually parse - the function name out of the mess. EXFUN should be considered - obsolete; new code should be written to use PARAMS. - - DOTS is also obsolete. - - Examples: - - extern int printf PARAMS ((const char *format, ...)); -*/ - -#ifndef _ANSIDECL_H - -#define _ANSIDECL_H 1 - - -/* Every source file includes this file, - so they will all get the switch for lint. */ -/* LINTLIBRARY */ - - -#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) -/* All known AIX compilers implement these things (but don't always - define __STDC__). The RISC/OS MIPS compiler defines these things - in SVR4 mode, but does not define __STDC__. */ - -#define PTR void * -#define PTRCONST void *CONST -#define LONG_DOUBLE long double - -#ifndef IN_GCC -#define AND , -#define NOARGS void -#define VOLATILE volatile -#define SIGNED signed -#endif /* ! IN_GCC */ - -#define PARAMS(paramlist) paramlist -#define ANSI_PROTOTYPES 1 - -#define VPARAMS(ARGS) ARGS -#define VA_START(va_list,var) va_start(va_list,var) - -/* These are obsolete. Do not use. */ -#ifndef IN_GCC -#define CONST const -#define DOTS , ... -#define PROTO(type, name, arglist) type name arglist -#define EXFUN(name, proto) name proto -#define DEFUN(name, arglist, args) name(args) -#define DEFUN_VOID(name) name(void) -#endif /* ! IN_GCC */ - -#else /* Not ANSI C. */ - -#define PTR char * -#define PTRCONST PTR -#define LONG_DOUBLE double - -#ifndef IN_GCC -#define AND ; -#define NOARGS -#define VOLATILE -#define SIGNED -#endif /* !IN_GCC */ - -#ifndef const /* some systems define it in header files for non-ansi mode */ -#define const -#endif - -#define PARAMS(paramlist) () - -#define VPARAMS(ARGS) (va_alist) va_dcl -#define VA_START(va_list,var) va_start(va_list) - -/* These are obsolete. Do not use. */ -#ifndef IN_GCC -#define CONST -#define DOTS -#define PROTO(type, name, arglist) type name () -#define EXFUN(name, proto) name() -#define DEFUN(name, arglist, args) name arglist args; -#define DEFUN_VOID(name) name() -#endif /* ! IN_GCC */ - -#endif /* ANSI C. */ - -#endif /* ansidecl.h */ diff --git a/contrib/gcc/assert.h b/contrib/gcc/assert.h deleted file mode 100644 index ecc02ee99912..000000000000 --- a/contrib/gcc/assert.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Allow this file to be included multiple times - with different settings of NDEBUG. */ -#undef assert -#undef __assert - -#ifdef NDEBUG -#define assert(ignore) ((void) 0) -#else - -#ifndef __GNUC__ - -#define assert(expression) \ - ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__))) - -#define __assert(expression, file, lineno) \ - (printf ("%s:%u: failed assertion\n", file, lineno), \ - abort (), 0) - -#else - -#if defined(__STDC__) || defined (__cplusplus) - -/* Defined in libgcc.a */ -#ifdef __cplusplus -extern "C" { -extern void __eprintf (const char *, const char *, unsigned, const char *) - __attribute__ ((noreturn)); -} -#else -extern void __eprintf (const char *, const char *, unsigned, const char *) - __attribute__ ((noreturn)); -#endif - -#define assert(expression) \ - ((void) ((expression) ? 0 : __assert (#expression, __FILE__, __LINE__))) - -#define __assert(expression, file, line) \ - (__eprintf ("%s:%u: failed assertion `%s'\n", \ - file, line, expression), 0) - -#else /* no __STDC__ and not C++; i.e. -traditional. */ - -extern void __eprintf () __attribute__ ((noreturn)); /* Defined in libgcc.a */ - -#define assert(expression) \ - ((void) ((expression) ? 0 : __assert (expression, __FILE__, __LINE__))) - -#define __assert(expression, file, lineno) \ - (__eprintf ("%s:%u: failed assertion `%s'\n", \ - file, lineno, "expression"), 0) - -#endif /* no __STDC__ and not C++; i.e. -traditional. */ -#endif /* no __GNU__; i.e., /bin/cc. */ -#endif diff --git a/contrib/gcc/basic-block.h b/contrib/gcc/basic-block.h deleted file mode 100644 index fa3d56f25d6e..000000000000 --- a/contrib/gcc/basic-block.h +++ /dev/null @@ -1,262 +0,0 @@ -/* Define control and data flow tables, and regsets. - Copyright (C) 1987, 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "bitmap.h" -#include "sbitmap.h" -#include "varray.h" - -typedef bitmap regset; /* Head of register set linked list. */ - -/* Clear a register set by freeing up the linked list. */ -#define CLEAR_REG_SET(HEAD) bitmap_clear (HEAD) - -/* Copy a register set to another register set. */ -#define COPY_REG_SET(TO, FROM) bitmap_copy (TO, FROM) - -/* `and' a register set with a second register set. */ -#define AND_REG_SET(TO, FROM) bitmap_operation (TO, TO, FROM, BITMAP_AND) - -/* `and' the complement of a register set with a register set. */ -#define AND_COMPL_REG_SET(TO, FROM) \ - bitmap_operation (TO, TO, FROM, BITMAP_AND_COMPL) - -/* Inclusive or a register set with a second register set. */ -#define IOR_REG_SET(TO, FROM) bitmap_operation (TO, TO, FROM, BITMAP_IOR) - -/* Or into TO the register set FROM1 `and'ed with the complement of FROM2. */ -#define IOR_AND_COMPL_REG_SET(TO, FROM1, FROM2) \ - bitmap_ior_and_compl (TO, FROM1, FROM2) - -/* Clear a single register in a register set. */ -#define CLEAR_REGNO_REG_SET(HEAD, REG) bitmap_clear_bit (HEAD, REG) - -/* Set a single register in a register set. */ -#define SET_REGNO_REG_SET(HEAD, REG) bitmap_set_bit (HEAD, REG) - -/* Return true if a register is set in a register set. */ -#define REGNO_REG_SET_P(TO, REG) bitmap_bit_p (TO, REG) - -/* Copy the hard registers in a register set to the hard register set. */ -#define REG_SET_TO_HARD_REG_SET(TO, FROM) \ -do { \ - int i_; \ - CLEAR_HARD_REG_SET (TO); \ - for (i_ = 0; i_ < FIRST_PSEUDO_REGISTER; i_++) \ - if (REGNO_REG_SET_P (FROM, i_)) \ - SET_HARD_REG_BIT (TO, i_); \ -} while (0) - -/* Loop over all registers in REGSET, starting with MIN, setting REGNUM to the - register number and executing CODE for all registers that are set. */ -#define EXECUTE_IF_SET_IN_REG_SET(REGSET, MIN, REGNUM, CODE) \ - EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, CODE) - -/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting - REGNUM to the register number and executing CODE for all registers that are - set in the first regset and not set in the second. */ -#define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \ - EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, CODE) - -/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting - REGNUM to the register number and executing CODE for all registers that are - set in both regsets. */ -#define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \ - EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, CODE) - -/* Allocate a register set with oballoc. */ -#define OBSTACK_ALLOC_REG_SET(OBSTACK) BITMAP_OBSTACK_ALLOC (OBSTACK) - -/* Allocate a register set with alloca. */ -#define ALLOCA_REG_SET() BITMAP_ALLOCA () - -/* Do any cleanup needed on a regset when it is no longer used. */ -#define FREE_REG_SET(REGSET) BITMAP_FREE(REGSET) - -/* Do any one-time initializations needed for regsets. */ -#define INIT_ONCE_REG_SET() BITMAP_INIT_ONCE () - -/* Grow any tables needed when the number of registers is calculated - or extended. For the linked list allocation, nothing needs to - be done, other than zero the statistics on the first allocation. */ -#define MAX_REGNO_REG_SET(NUM_REGS, NEW_P, RENUMBER_P) - -/* Control flow edge information. */ -typedef struct edge_def { - /* Links through the predecessor and successor lists. */ - struct edge_def *pred_next, *succ_next; - - /* The two blocks at the ends of the edge. */ - struct basic_block_def *src, *dest; - - /* Instructions queued on the edge. */ - rtx insns; - - /* Auxiliary info specific to a pass. */ - void *aux; - - int flags; /* see EDGE_* below */ - int probability; /* biased by REG_BR_PROB_BASE */ -} *edge; - -#define EDGE_FALLTHRU 1 -#define EDGE_CRITICAL 2 -#define EDGE_ABNORMAL 4 -#define EDGE_ABNORMAL_CALL 8 -#define EDGE_EH 16 -#define EDGE_FAKE 32 - - -/* Basic block information indexed by block number. */ -typedef struct basic_block_def { - /* The first and last insns of the block. */ - rtx head, end; - - /* The edges into and out of the block. */ - edge pred, succ; - - /* Liveness info. */ - regset local_set; - regset global_live_at_start; - regset global_live_at_end; - - /* Auxiliary info specific to a pass. */ - void *aux; - - /* The index of this block. */ - int index; - /* The loop depth of this block plus one. */ - int loop_depth; -} *basic_block; - -/* Number of basic blocks in the current function. */ - -extern int n_basic_blocks; - -/* Index by basic block number, get basic block struct info. */ - -extern varray_type basic_block_info; - -#define BASIC_BLOCK(N) (VARRAY_BB (basic_block_info, (N))) - -/* What registers are live at the setjmp call. */ - -extern regset regs_live_at_setjmp; - -/* Indexed by n, gives number of basic block that (REG n) is used in. - If the value is REG_BLOCK_GLOBAL (-2), - it means (REG n) is used in more than one basic block. - REG_BLOCK_UNKNOWN (-1) means it hasn't been seen yet so we don't know. - This information remains valid for the rest of the compilation - of the current function; it is used to control register allocation. */ - -#define REG_BLOCK_UNKNOWN -1 -#define REG_BLOCK_GLOBAL -2 - -#define REG_BASIC_BLOCK(N) (VARRAY_REG (reg_n_info, N)->basic_block) - -/* List of integers. - These are used for storing things like predecessors, etc. - - This scheme isn't very space efficient, especially on 64 bit machines. - The interface is designed so that the implementation can be replaced with - something more efficient if desirable. */ - -typedef struct int_list { - struct int_list *next; - int val; -} int_list; - -typedef int_list *int_list_ptr; - -/* Integer list elements are allocated in blocks to reduce the frequency - of calls to malloc and to reduce the associated space overhead. */ - -typedef struct int_list_block { - struct int_list_block *next; - int nodes_left; -#define INT_LIST_NODES_IN_BLK 500 - struct int_list nodes[INT_LIST_NODES_IN_BLK]; -} int_list_block; - -/* Given a pointer to the list, return pointer to first element. */ -#define INT_LIST_FIRST(il) (il) - -/* Given a pointer to a list element, return pointer to next element. */ -#define INT_LIST_NEXT(p) ((p)->next) - -/* Return non-zero if P points to the end of the list. */ -#define INT_LIST_END(p) ((p) == NULL) - -/* Return element pointed to by P. */ -#define INT_LIST_VAL(p) ((p)->val) - -#define INT_LIST_SET_VAL(p, new_val) ((p)->val = (new_val)) - -extern void free_int_list PROTO ((int_list_block **)); - -/* Stuff for recording basic block info. */ - -#define BLOCK_HEAD(B) (BASIC_BLOCK (B)->head) -#define BLOCK_END(B) (BASIC_BLOCK (B)->end) - -/* Special block numbers [markers] for entry and exit. */ -#define ENTRY_BLOCK (-1) -#define EXIT_BLOCK (-2) - -/* Similarly, block pointers for the edge list. */ -extern struct basic_block_def entry_exit_blocks[2]; -#define ENTRY_BLOCK_PTR (&entry_exit_blocks[0]) -#define EXIT_BLOCK_PTR (&entry_exit_blocks[1]) - -/* from flow.c */ -extern void free_regset_vector PROTO ((regset *, int nelts)); - -extern varray_type basic_block_for_insn; -#define BLOCK_FOR_INSN(INSN) VARRAY_BB (basic_block_for_insn, INSN_UID (INSN)) -#define BLOCK_NUM(INSN) (BLOCK_FOR_INSN (INSN)->index + 0) - -extern void set_block_for_insn PROTO ((rtx, basic_block)); - -extern void dump_bb_data PROTO ((FILE *, int_list_ptr *, - int_list_ptr *, int)); -extern void free_bb_mem PROTO ((void)); -extern void free_basic_block_vars PROTO ((int)); - -extern basic_block split_edge PROTO ((edge)); -extern void insert_insn_on_edge PROTO ((rtx, edge)); -extern void commit_edge_insertions PROTO ((void)); - -extern void compute_preds_succs PROTO ((int_list_ptr *, int_list_ptr *, - int *, int *)); -extern void compute_dominators PROTO ((sbitmap *, sbitmap *, - int_list_ptr *, - int_list_ptr *)); -extern void compute_immediate_dominators PROTO ((int *, sbitmap *)); - -/* In lcm.c */ -extern void pre_lcm PROTO ((int, int, int_list_ptr *, - int_list_ptr *, - sbitmap *, sbitmap *, - sbitmap *, sbitmap *)); -extern void pre_rev_lcm PROTO ((int, int, int_list_ptr *, - int_list_ptr *, - sbitmap *, sbitmap *, - sbitmap *, sbitmap *)); diff --git a/contrib/gcc/bc-emit.c b/contrib/gcc/bc-emit.c deleted file mode 100644 index 9a7c0f981b62..000000000000 --- a/contrib/gcc/bc-emit.c +++ /dev/null @@ -1,992 +0,0 @@ -/* Output bytecodes for GNU C-compiler. - Copyright (C) 1993, 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "config.h" -#ifdef __STDC__ -#include -#else -#include -#endif -#include "machmode.h" -#include "rtl.h" -#include "real.h" -#include "obstack.h" -#include "bytecode.h" -#ifdef __GNUC__ -#include "bytetypes.h" -#endif -#include "bc-emit.h" -#include "bc-opcode.h" -#include "bc-typecd.h" -#include "bi-run.h" - -#include - -extern char *xmalloc (), *xrealloc (); -extern void free (); - -extern struct obstack *rtl_obstack; - -/* Indexed by mode class, gives the narrowest mode for each class. */ - -extern enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS]; - -/* Commonly used modes. */ -/* Mode whose width is BITS_PER_UNIT */ -extern enum machine_mode byte_mode; - -/* Mode whose width is BITS_PER_WORD */ -extern enum machine_mode word_mode; - -/* Vector indexed by opcode giving info about the args for each opcode. */ -static struct arityvec arityvec[] = { -#include "bc-arity.h" -}; - -/* How to print a symbol name for the assembler. */ -static void -prsym (file, s) - FILE *file; - char *s; -{ - if (*s == '*') - fprintf (file, "%s", s + 1); - else - -#ifdef NAMES_HAVE_UNDERSCORES - fprintf (file, "_%s", s); -#else - fprintf (file, "%s", s); -#endif - -} - -/* Maintain a bucket hash table for symbol names. */ - -#define HASH_BITS 32 -#define HASH_SIZE 509 - -static struct bc_sym *hashtab[HASH_SIZE]; - -static unsigned int -hash (name) - char *name; -{ - unsigned int hash = 0; - - while (*name) - { - hash = hash << 3 | hash >> HASH_BITS - 3; - hash += *name++; - } - - return hash % HASH_SIZE; -} - - -/* Look up the named symbol, creating it if it doesn't exist. */ -struct bc_sym * -sym_lookup (name) - char *name; -{ - int i; - struct bc_sym *s; - - i = hash (name); - for (s = hashtab[i]; s; s = s->next) - if (!strcmp (s->name, name)) - return s; - - s = (struct bc_sym *) xmalloc (sizeof (struct bc_sym)); - s->name = xmalloc (strlen (name) + 1); - strcpy (s->name, name); - s->defined = s->global = s->common = 0; - s->val = 0; - s->next = hashtab[i]; - hashtab[i] = s; - return s; -} - - -/* Write out .globl and common symbols to the named file. */ -static void -bc_sym_write (file) - FILE *file; -{ - int i; - struct bc_sym *s; - - for (i = 0; i < HASH_SIZE; ++i) - for (s = hashtab[i]; s; s = s->next) - { - if (s->global) - { - fprintf (file, "\n\t.globl "); - prsym (file, s->name); - putc ('\n', file); - if (s->common) - { - fprintf (file, "\n\t.comm "); - prsym (file, s->name); - fprintf (file, ", %lu\n", s->val); - } - } - else if (s->common) - { - fprintf (file, "\n\t.lcomm "); - prsym (file, s->name); - fprintf (file, ", %lu\n", s->val); - } - } -} - - - - -/* Create and initialize a new segment. */ -static struct bc_seg * -seg_create () -{ - struct bc_seg *result; - - result = (struct bc_seg *) xmalloc (sizeof (struct bc_seg)); - result->alloc = 256; - result->data = xmalloc (result->alloc); - result->size = 0; - result->syms = 0; - result->relocs = 0; - return result; -} - - -/* Advance the segment index to the next alignment boundary. */ -static void -seg_align (seg, log) - struct bc_seg *seg; - int log; -{ - unsigned int oldsize = seg->size; - - seg->size = seg->size + (1 << log) - 1 & ~((1 << log) - 1); - if (seg->size > seg->alloc) - { - while (seg->size > seg->alloc) - seg->alloc *= 2; - seg->data = xrealloc (seg->data, seg->alloc); - } - bzero (seg->data + oldsize, seg->size - oldsize); -} - - -/* Append the given data to the given segment. */ -static void -seg_data (seg, data, size) - struct bc_seg *seg; - char *data; - unsigned int size; -{ - if (seg->size + size > seg->alloc) - { - while (seg->size + size > seg->alloc) - seg->alloc *= 2; - seg->data = xrealloc (seg->data, seg->alloc); - } - - bcopy (data, seg->data + seg->size, size); - seg->size += size; -} - - -/* Append a zero-filled skip to the given segment. */ -static void -seg_skip (seg, size) - struct bc_seg *seg; - unsigned int size; -{ - if (seg->size + size > seg->alloc) - { - while (seg->size + size > seg->alloc) - seg->alloc *= 2; - seg->data = xrealloc (seg->data, seg->alloc); - } - - memset (seg->data + seg->size, 0, size); - seg->size += size; -} - - -/* Define the given name as the current offset in the given segment. It - is an error if the name is already defined. Return 0 or 1 indicating - failure or success respectively. */ -static int -seg_defsym (seg, name) - struct bc_seg *seg; - char *name; -{ - struct bc_sym *sym; - struct bc_segsym *segsym; - - sym = sym_lookup (name); - if (sym->defined) - return 0; - - sym->defined = 1; - sym->val = seg->size; - segsym = (struct bc_segsym *) xmalloc (sizeof (struct bc_segsym)); - segsym->sym = sym; - segsym->next = seg->syms; - seg->syms = segsym; - return 1; -} - - -/* Generate in seg's data a reference to the given sym, adjusted by - the given offset. */ -static void -seg_refsym (seg, name, offset) - struct bc_seg *seg; - char *name; - int offset; -{ - struct bc_sym *sym; - struct bc_segreloc *segreloc; - - sym = sym_lookup (name); - segreloc = (struct bc_segreloc *) xmalloc (sizeof (struct bc_segreloc)); - segreloc->offset = seg->size; - segreloc->sym = sym; - segreloc->next = seg->relocs; - seg->relocs = segreloc; - seg_data (seg, (char *) &offset, sizeof offset); -} - - -/* Concatenate the contents of given segments into the first argument. */ -static void -seg_concat (result, seg) - struct bc_seg *result, *seg; -{ - unsigned int fix; - struct bc_segsym *segsym; - struct bc_segreloc *segreloc; - - seg_align (result, MACHINE_SEG_ALIGN); - fix = result->size; - seg_data (result, seg->data, seg->size); - free (seg->data); - - /* Go through the symbols and relocs of SEG, adjusting their offsets - for their new location in RESULT. */ - if (seg->syms) - { - segsym = seg->syms; - do - segsym->sym->val += fix; - while (segsym->next && (segsym = segsym->next)); - segsym->next = result->syms; - result->syms = seg->syms; - } - if (seg->relocs) - { - segreloc = seg->relocs; - do - segreloc->offset += fix; - while (segreloc->next && (segreloc = segreloc->next)); - segreloc->next = result->relocs; - result->relocs = seg->relocs; - } - - free ((char *) seg); -} - -/* Write a segment to a file. */ -static void -bc_seg_write (seg, file) - struct bc_seg *seg; - FILE *file; -{ - struct bc_segsym *segsym, *nsegsym, *psegsym; - struct bc_segreloc *segreloc, *nsegreloc, *psegreloc; - int i, offset, flag; - - /* Reverse the list of symbols. */ - for (psegsym = 0, segsym = seg->syms; segsym; segsym = nsegsym) - { - nsegsym = segsym->next; - segsym->next = psegsym; - psegsym = segsym; - } - seg->syms = psegsym; - - /* Reverse the list of relocs. */ - for (psegreloc = 0, segreloc = seg->relocs; segreloc; segreloc = nsegreloc) - { - nsegreloc = segreloc->next; - segreloc->next = psegreloc; - psegreloc = segreloc; - } - seg->relocs = psegreloc; - - /* Output each byte of the segment. */ - for (i = 0, segsym = seg->syms, segreloc = seg->relocs; i < seg->size; ++i) - { - while (segsym && segsym->sym->val == i) - { - if (i % 8 != 0) - putc ('\n', file); - - BC_WRITE_SEGSYM (segsym, file); - segsym = segsym->next; - flag = 1; - } - if (segreloc && segreloc->offset == i) - { - if (i % 8 != 0) - putc ('\n', file); - - bcopy (seg->data + i, (char *) &offset, sizeof (int)); - i += sizeof (int) - 1; - - BC_WRITE_RELOC_ENTRY (segreloc, file, offset); - segreloc = segreloc->next; - flag = 1; - } - else - { - if (i % 8 == 0 || flag) - BC_START_BYTECODE_LINE (file); - - BC_WRITE_BYTECODE (i % 8 == 0 || flag ? ' ' : ',', - seg->data[i] & 0xFF, - file); - flag = 0; - if (i % 8 == 7) - putc ('\n', file); - } - } - - /* Paranoia check--we should have visited all syms and relocs during - the output pass. */ - - if (segsym || segreloc) - abort (); -} - - - -/* Text and data segments of the object file in making. */ -static struct bc_seg *bc_text_seg; -static struct bc_seg *bc_data_seg; - -/* Called before anything else in this module. */ -void -bc_initialize () -{ - int min_class_size[(int) MAX_MODE_CLASS]; - enum machine_mode mode; - int i; - - bc_init_mode_to_code_map (); - - bc_text_seg = seg_create (); - bc_data_seg = seg_create (); - - dconst0 = REAL_VALUE_ATOF ("0", DFmode); - dconst1 = REAL_VALUE_ATOF ("1", DFmode); - dconst2 = REAL_VALUE_ATOF ("2", DFmode); - dconstm1 = REAL_VALUE_ATOF ("-1", DFmode); - - /* Find the narrowest mode for each class and compute the word and byte - modes. */ - - for (i = 0; i < (int) MAX_MODE_CLASS; i++) - min_class_size[i] = 1000; - - for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE; - mode = (enum machine_mode) ((int) mode + 1)) - { - if (GET_MODE_SIZE (mode) < min_class_size[(int) GET_MODE_CLASS (mode)]) - { - class_narrowest_mode[(int) GET_MODE_CLASS (mode)] = mode; - min_class_size[(int) GET_MODE_CLASS (mode)] = GET_MODE_SIZE (mode); - } - if (GET_MODE_CLASS (mode) == MODE_INT - && GET_MODE_BITSIZE (mode) == BITS_PER_UNIT) - byte_mode = mode; - - if (GET_MODE_CLASS (mode) == MODE_INT - && GET_MODE_BITSIZE (mode) == BITS_PER_WORD) - word_mode = mode; - } -} - - -/* External addresses referenced in a function. Rather than trying to - work relocatable address directly into bytecoded functions (which would - require us to provide hairy location info and possibly obey alignment - rules imposed by the architecture) we build an auxiliary table of - pointer constants, and encode just offsets into this table into the - actual bytecode. */ -static struct bc_seg *ptrconsts; - -/* Trampoline code for the function entry. */ -struct bc_seg *trampoline; - -/* Actual byte code of the function. */ -struct bc_seg *bytecode; - -/* List of labels defined in the function. */ -struct bc_label *labels; - -/* List of label references in the function. */ -struct bc_labelref *labelrefs; - - -/* Add symbol to pointer table. Return offset into table where - pointer was stored. The offset usually goes into the bytecode - stream as a constP literal. */ -int -bc_define_pointer (p) - char *p; -{ - int offset = ptrconsts->size; - - seg_refsym (ptrconsts, p, 0); - return offset; -} - - -/* Begin a bytecoded function. */ -int -bc_begin_function (name) - char *name; -{ - ptrconsts = seg_create (); - trampoline = seg_create (); - bytecode = seg_create (); - return seg_defsym (trampoline, name); -} - - -/* Force alignment in inline bytecode. */ -void -bc_align_bytecode (align) - int align; -{ - seg_align (bytecode, align); -} - - -/* Emit data inline into bytecode. */ -void -bc_emit_bytecode_const (data, size) - char *data; - unsigned int size; -{ - if (bytecode) - seg_data (bytecode, data, size); -} - - -/* Create a new "bytecode label", to have its value defined later. - Bytecode labels have nothing to do with the object file symbol table, - and are purely local to a given bytecoded function. */ -struct bc_label * -bc_get_bytecode_label () -{ - struct bc_label *result; - - result = (struct bc_label *) xmalloc (sizeof (struct bc_label)); - result->defined = 0; - result->next = labels; - result->uid = 0; - labels = result; - return result; -} - - -/* Define the given label with the current location counter. */ -int -bc_emit_bytecode_labeldef (label) - struct bc_label *label; -{ - extern int bc_new_uid (); - - if (!label || label->defined) - return 0; - - label->offset = bytecode->size; - label->defined = 1; - label->uid = bc_new_uid (); - -#ifdef DEBUG_PRINT_CODE - fprintf (stderr, "$%lx:\n", label); -#endif - - return 1; -} - - -/* Generate a location-relative reference to the given bytecode label. - It need not be defined yet; label references will be backpatched later. */ -void -bc_emit_bytecode_labelref (label) - struct bc_label *label; -{ - struct bc_labelref *labelref; - static int zero; - - labelref = (struct bc_labelref *) xmalloc (sizeof (struct bc_labelref)); - labelref->label = label; - labelref->offset = bytecode->size; - labelref->next = labelrefs; - labelrefs = labelref; - -#ifdef DEBUG_PRINT_CODE - fprintf (stderr, " $%lx", label); -#endif - - seg_data (bytecode, (char *) &zero, sizeof zero); -} - - -/* Emit a reference to an external address; generate the reference in the - ptrconst area, and emit an offset in the bytecode. */ -void -bc_emit_code_labelref (name, offset) - char *name; - int offset; -{ - int ptroff; - - ptroff = ptrconsts->size / sizeof (char *); - seg_data (bytecode, (char *) &ptroff, sizeof ptroff); - seg_refsym (ptrconsts, name, offset); - -#ifdef DEBUG_PRINT_CODE - fprintf (stderr, " [external <%x> %s]", ptroff, name); -#endif -} - - -/* Backpatch label references in the byte code, and concatenate the bytecode - and pointer constant segments to the cumulative text for the object file. - Return a label name for the pointer constants region. */ -char * -bc_end_function () -{ - int addr; - struct bc_label *label, *next; - struct bc_labelref *ref, *nextref; - char ptrconsts_label[20]; - static int nlab; - - /* Backpatch bytecode label references. */ - for (ref = labelrefs; ref; ref = ref->next) - if (ref->label->defined) - { - addr = ref->label->offset; - bcopy ((char *) &addr, bytecode->data + ref->offset, sizeof addr); - } - - /* Free the chains of labelrefs and labeldefs. */ - for (ref = labelrefs; ref; ref = nextref) - { - nextref = ref->next; - free ((char *) ref); - } - - for (label = labels; label; label = next) - { - next = label->next; - free ((char *) label); - } - - seg_concat (trampoline, bytecode); - seg_align (trampoline, MACHINE_SEG_ALIGN); - sprintf (ptrconsts_label, "*LP%d", nlab++); - seg_defsym (trampoline, ptrconsts_label); - seg_concat (trampoline, ptrconsts); - seg_concat (bc_text_seg, trampoline); - - labels = 0; - labelrefs = 0; - trampoline = 0; - bytecode = 0; - ptrconsts = 0; - - return sym_lookup (ptrconsts_label)->name; -} - -/* Force alignment in const data. */ -void -bc_align_const (align) - int align; -{ - seg_align (bc_text_seg, align); -} - -/* Emit const data. */ -void -bc_emit_const (data, size) - char *data; - unsigned int size; -{ - seg_data (bc_text_seg, data, size); -} - -/* Emit a zero-filled constant skip. */ -void -bc_emit_const_skip (size) - unsigned int size; -{ - seg_skip (bc_text_seg, size); -} - -/* Emit a label definition in const data. */ -int -bc_emit_const_labeldef (name) - char *name; -{ - return seg_defsym (bc_text_seg, name); -} - -/* Emit a label reference in const data. */ -void -bc_emit_const_labelref (name, offset) - char *name; - int offset; -{ - seg_refsym (bc_text_seg, name, offset); -} - -/* Force alignment in data. */ -void -bc_align_data (align) - int align; -{ - seg_align (bc_data_seg, align); -} - -/* Emit data. */ -void -bc_emit_data (data, size) - char *data; - unsigned int size; -{ - seg_data (bc_data_seg, data, size); -} - -/* Emit a zero-filled data skip. */ -void -bc_emit_data_skip (size) - unsigned int size; -{ - seg_skip (bc_data_seg, size); -} - -/* Emit label definition in data. */ -int -bc_emit_data_labeldef (name) - char *name; -{ - return seg_defsym (bc_data_seg, name); -} - -/* Emit label reference in data. */ -void -bc_emit_data_labelref (name, offset) - char *name; - int offset; -{ - seg_refsym (bc_data_seg, name, offset); -} - -/* Emit a common block of the given name and size. Note that - when the .o file is actually written non-global "common" - blocks will have to be turned into space in the data section. */ -int -bc_emit_common (name, size) - char *name; - unsigned int size; -{ - struct bc_sym *sym; - - sym = sym_lookup (name); - if (sym->defined) - return 0; - - sym->defined = 1; - sym->common = 1; - sym->val = size; - return 1; -} - -/* Globalize the given label. */ -void -bc_globalize_label (name) - char *name; -{ - struct bc_sym *sym; - - sym = sym_lookup (name); - sym->global = 1; -} - -static enum { in_text, in_data } section = in_text; - -void -bc_text () -{ - section = in_text; -} - -void -bc_data () -{ - section = in_data; -} - -void -bc_align (align) - int align; -{ - if (section == in_text) - bc_align_const (align); - else - bc_align_data (align); -} - -void -bc_emit (data, size) - char *data; - unsigned int size; -{ - if (section == in_text) - bc_emit_const (data, size); - else - bc_emit_data (data, size); -} - -void -bc_emit_skip (size) - unsigned int size; -{ - if (section == in_text) - bc_emit_const_skip (size); - else - bc_emit_data_skip (size); -} - -int -bc_emit_labeldef (name) - char *name; -{ - if (section == in_text) - return bc_emit_const_labeldef (name); - else - return bc_emit_data_labeldef (name); -} - -void -bc_emit_labelref (name, offset) - char *name; - int offset; -{ - if (section == in_text) - bc_emit_const_labelref (name, offset); - else - bc_emit_data_labelref (name, offset); -} - -void -bc_write_file (file) - FILE *file; -{ - BC_WRITE_FILE (file); -} - - -/* Allocate a new bytecode rtx. - If you supply a null BC_LABEL, we generate one. */ - -rtx -bc_gen_rtx (label, offset, bc_label) - char *label; - int offset; - struct bc_label *bc_label; -{ - rtx r; - - if (bc_label == 0) - bc_label = (struct bc_label *) xmalloc (sizeof (struct bc_label)); - - r = gen_rtx (CODE_LABEL, VOIDmode, label, bc_label); - bc_label->offset = offset; - - return r; -} - - -/* Print bytecode rtx */ -void -bc_print_rtl (fp, r) - FILE *fp; - rtx r; -{ -#if 0 /* This needs to get fixed to really work again. */ - /* BC_WRITE_RTL has a definition - that doesn't even make sense for this use. */ - BC_WRITE_RTL (r, fp); -#endif -} - - -/* Emit a bytecode, keeping a running tally of the stack depth. */ -void -bc_emit_bytecode (bytecode) - enum bytecode_opcode bytecode; -{ - char byte; - static int prev_lineno = -1; - - byte = (char) bytecode; - -#ifdef BCDEBUG_PRINT_CODE - if (lineno != prev_lineno) - { - fprintf (stderr, "\n", lineno); - prev_lineno = lineno; - } - - fputs (opcode_name[(unsigned int) bytecode], stderr); -#endif - - /* Due to errors we are often requested to output bytecodes that - will cause an interpreter stack undeflow when executed. Instead of - dumping core on such occasions, we omit the bytecode. Erroneous code - should not be executed, regardless. This makes life much easier, since - we don't have to deceive ourselves about the known stack depth. */ - - bc_emit_bytecode_const (&byte, 1); - - if ((stack_depth -= arityvec[(int) bytecode].ninputs) >= 0) - { - if ((stack_depth += arityvec[(int) bytecode].noutputs) > max_stack_depth) - max_stack_depth = stack_depth; - } - -#ifdef VALIDATE_STACK_FOR_BC - VALIDATE_STACK_FOR_BC (); -#endif -} - - -#ifdef BCDEBUG_PRINT_CODE -#define PRLIT(TYPE, PTR) fprintf (stderr, " [%x]", *(TYPE *) PTR) -#else -#define PRLIT(X,Y) -#endif - -/* Emit a complete bytecode instruction, expecting the correct number - of literal values in the call. First argument is the instruction, the - remaining arguments are literals of size HOST_WIDE_INT or smaller. */ -void -bc_emit_instruction VPROTO((enum bytecode_opcode opcode, ...)) -{ -#ifndef __STDC__ - enum bytecode_opcode opcode; -#endif - va_list arguments; - int nliteral, instruction; - - VA_START (arguments, opcode); - -#ifndef __STDC__ - opcode = va_arg (arguments, enum bytecode_opcode); -#endif - - /* Emit instruction bytecode */ - bc_emit_bytecode (opcode); - instruction = (int) opcode; - - /* Loop literals and emit as bytecode constants */ - for (nliteral = 0; nliteral < arityvec[instruction].nliterals; nliteral++) - { - switch (arityvec[instruction].literals[nliteral]) - { -/* This conditional is a kludge, but it's necessary - because TYPE might be long long. */ -#ifdef __GNUC__ - /* Expand definitions into case statements */ -#define DEFTYPECODE(CODE, NAME, MODE, TYPE) \ - case CODE: \ - { \ - TYPE temp = va_arg (arguments, TYPE); \ - bc_emit_bytecode_const ((void *) &temp, sizeof temp); \ - PRLIT (TYPE, &temp); } \ - break; - -#include "bc-typecd.def" - -#undef DEFTYPECODE -#endif /* __GNUC__ */ - - default: - abort (); - } - } - -#ifdef BCDEBUG_PRINT_CODE - fputc ('\n', stderr); -#endif -} - -/* Emit the machine-code interface trampoline at the beginning of a byte - coded function. The argument is a label name of the interpreter - bytecode callinfo structure; the return value is a label name for - the beginning of the actual bytecode. */ -char * -bc_emit_trampoline (callinfo) - char *callinfo; -{ - char mylab[20]; - static int n; - - sprintf (mylab, "*LB%d", n++); - - BC_EMIT_TRAMPOLINE (trampoline, callinfo); - - seg_defsym (bytecode, mylab); - return sym_lookup (mylab)->name; -} - - -/* Simple strdup */ -char * -bc_xstrdup (str) - char *str; -{ - char *tmp = xmalloc (strlen (str) + 1); - - strcpy (tmp, str); - return tmp; -} diff --git a/contrib/gcc/bc-emit.h b/contrib/gcc/bc-emit.h deleted file mode 100644 index c00da5b35393..000000000000 --- a/contrib/gcc/bc-emit.h +++ /dev/null @@ -1,133 +0,0 @@ -/* bc-emit.h - declare entry points for producing object files of bytecodes. */ - -/* Internal format of symbol table for the object file. */ -struct bc_sym -{ - /* Private copy separately malloc'd. */ - char *name; - - /* Symbol has a defined value. */ - unsigned int defined:1; - - /* Symbol has been globalized. */ - unsigned int global:1; - - /* Symbol is common. */ - unsigned int common:1; - - /* Value if defined. */ - unsigned long int val; - - /* Used in internal symbol table structure. */ - struct bc_sym *next; -}; - - -/* List of symbols defined in a particular segment. */ -struct bc_segsym -{ - struct bc_sym *sym; - struct bc_segsym *next; -}; - - -/* List of relocations needed in a particular segment. */ -struct bc_segreloc -{ - /* Offset of datum to be relocated. */ - unsigned int offset; - - /* Symbol to be relocated by. */ - struct bc_sym *sym; - - struct bc_segreloc *next; -}; - - -/* Segment of an object file. */ -struct bc_seg -{ - /* Size allocated to contents. */ - unsigned int alloc; - - /* Pointer to base of contents. */ - char *data; - - /* Actual size of contents. */ - unsigned int size; - - /* List of symbols defined in this segment. */ - struct bc_segsym *syms; - - /* List of relocations for this segment. */ - struct bc_segreloc *relocs; -}; - - -/* Anonymous bytecode label within a single function. */ -struct bc_label -{ - /* Offset of label from start of segment. */ - unsigned int offset; - - /* True when offset is valid. */ - unsigned int defined:1; - - /* Unique bytecode ID, used to determine innermost - block containment */ - int uid; - - /* Next node in list */ - struct bc_label *next; -}; - - -/* Reference to a bc_label; a list of all such references is kept for - the function, then when it is finished they are backpatched to - contain the correct values. */ - -struct bc_labelref -{ - /* Label referenced. */ - struct bc_label *label; - - /* Code offset of reference. */ - unsigned int offset; - - /* Next labelref in list */ - struct bc_labelref *next; -}; - - - -extern void bc_initialize(); -extern int bc_begin_function(); -extern char *bc_emit_trampoline(); -extern void bc_emit_bytecode(); -extern void bc_emit_bytecode_const(); -extern struct bc_label *bc_get_bytecode_label(); -extern int bc_emit_bytecode_labeldef(); -extern void bc_emit_bytecode_labelref(); -extern void bc_emit_code_labelref(); -extern char *bc_end_function(); -extern void bc_align_const(); -extern void bc_emit_const(); -extern void bc_emit_const_skip(); -extern int bc_emit_const_labeldef(); -extern void bc_emit_const_labelref(); -extern void bc_align_data(); -extern void bc_emit_data(); -extern void bc_emit_data_skip(); -extern int bc_emit_data_labeldef(); -extern void bc_emit_data_labelref(); -extern int bc_define_pointer (); -extern int bc_emit_common(); -extern void bc_globalize_label(); -extern void bc_text(); -extern void bc_data(); -extern void bc_align(); -extern void bc_emit(); -extern void bc_emit_skip(); -extern int bc_emit_labeldef(); -extern void bc_emit_labelref(); -extern void bc_write_file(); diff --git a/contrib/gcc/bc-optab.c b/contrib/gcc/bc-optab.c deleted file mode 100644 index b7ff48652377..000000000000 --- a/contrib/gcc/bc-optab.c +++ /dev/null @@ -1,789 +0,0 @@ -/* Bytecode conversion definitions for GNU C-compiler. - Copyright (C) 1993, 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "config.h" -#include "tree.h" -#include "rtl.h" -#include "machmode.h" -#include "obstack.h" -#include "bytecode.h" -#include "bc-typecd.h" -#include "bc-opcode.h" -#include "bc-optab.h" - -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -extern char *xmalloc (); -extern void free (); - -/* Table relating interpreter typecodes to machine modes. */ -#define GET_TYPECODE_MODE(CODE) (typecode_mode[((int) CODE)]) -enum machine_mode typecode_mode[] = { -#define DEFTYPECODE(CODE, NAME, MODE, TYPE) MODE, -#include "bc-typecd.def" -#undef DEFTYPECODE -}; - -/* Machine mode to type code map */ -static enum typecode signed_mode_to_code_map[MAX_MACHINE_MODE+1]; -static enum typecode unsigned_mode_to_code_map[MAX_MACHINE_MODE+1]; - -#define GET_TYPECODE_SIZE(CODE) GET_MODE_SIZE (GET_TYPECODE_MODE (CODE)) - -#define BIG_ARBITRARY_NUMBER 100000 - -/* Table of recipes for conversions among scalar types, to be filled - in as needed at run time. */ -static struct conversion_recipe -{ - unsigned char *opcodes; /* Bytecodes to emit in order. */ - int nopcodes; /* Count of bytecodes. */ - int cost; /* A rather arbitrary cost function. */ -} conversion_recipe[NUM_TYPECODES][NUM_TYPECODES]; - -/* Binary operator tables. */ -struct binary_operator optab_plus_expr[] = { - { addSI, SIcode, SIcode, SIcode }, - { addDI, DIcode, DIcode, DIcode }, - { addSF, SFcode, SFcode, SFcode }, - { addDF, DFcode, DFcode, DFcode }, - { addXF, XFcode, XFcode, XFcode }, - { addPSI, Pcode, Pcode, SIcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_minus_expr[] = { - { subSI, SIcode, SIcode, SIcode }, - { subDI, DIcode, DIcode, DIcode }, - { subSF, SFcode, SFcode, SFcode }, - { subDF, DFcode, DFcode, DFcode }, - { subXF, XFcode, XFcode, XFcode }, - { subPP, SIcode, Pcode, Pcode }, - { -1, -1, -1, -1 }, -}; - -/* The ordering of the tables for multiplicative operators - is such that unsigned operations will be preferred to signed - operations when one argument is unsigned. */ - -struct binary_operator optab_mult_expr[] = { - { mulSU, SUcode, SUcode, SUcode }, - { mulDU, DUcode, DUcode, DUcode }, - { mulSI, SIcode, SIcode, SIcode }, - { mulDI, DIcode, DIcode, DIcode }, - { mulSF, SFcode, SFcode, SFcode }, - { mulDF, DFcode, DFcode, DFcode }, - { mulXF, XFcode, XFcode, XFcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_trunc_div_expr[] = { - { divSU, SUcode, SUcode, SUcode }, - { divDU, DUcode, DUcode, DUcode }, - { divSI, SIcode, SIcode, SIcode }, - { divDI, DIcode, DIcode, DIcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_trunc_mod_expr[] = { - { modSU, SUcode, SUcode, SUcode }, - { modDU, DUcode, DUcode, DUcode }, - { modSI, SIcode, SIcode, SIcode }, - { modDI, DIcode, DIcode, DIcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_rdiv_expr[] = { - { divSF, SFcode, SFcode, SFcode }, - { divDF, DFcode, DFcode, DFcode }, - { divXF, XFcode, XFcode, XFcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_bit_and_expr[] = { - { andSI, SIcode, SIcode, SIcode }, - { andDI, DIcode, DIcode, DIcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_bit_ior_expr[] = { - { iorSI, SIcode, SIcode, SIcode }, - { iorDI, DIcode, DIcode, DIcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_bit_xor_expr[] = { - { xorSI, SIcode, SIcode, SIcode }, - { xorDI, DIcode, DIcode, DIcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_lshift_expr[] = { - { lshiftSI, SIcode, SIcode, SIcode }, - { lshiftSU, SUcode, SUcode, SIcode }, - { lshiftDI, DIcode, DIcode, SIcode }, - { lshiftDU, DUcode, DUcode, SIcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_rshift_expr[] = { - { rshiftSI, SIcode, SIcode, SIcode }, - { rshiftSU, SUcode, SUcode, SIcode }, - { rshiftDI, DIcode, DIcode, SIcode }, - { rshiftDU, DUcode, DUcode, SIcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_truth_and_expr[] = { - { andSI, SIcode, Tcode, Tcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_truth_or_expr[] = { - { iorSI, SIcode, Tcode, Tcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_lt_expr[] = { - { ltSI, Tcode, SIcode, SIcode }, - { ltSU, Tcode, SUcode, SUcode }, - { ltDI, Tcode, DIcode, DIcode }, - { ltDU, Tcode, DUcode, DUcode }, - { ltSF, Tcode, SFcode, SFcode }, - { ltDF, Tcode, DFcode, DFcode }, - { ltXF, Tcode, XFcode, XFcode }, - { ltP, Tcode, Pcode, Pcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_le_expr[] = { - { leSI, Tcode, SIcode, SIcode }, - { leSU, Tcode, SUcode, SUcode }, - { leDI, Tcode, DIcode, DIcode }, - { leDU, Tcode, DUcode, DUcode }, - { leSF, Tcode, SFcode, SFcode }, - { leDF, Tcode, DFcode, DFcode }, - { leXF, Tcode, XFcode, XFcode }, - { leP, Tcode, Pcode, Pcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_ge_expr[] = { - { geSI, Tcode, SIcode, SIcode }, - { geSU, Tcode, SUcode, SUcode }, - { geDI, Tcode, DIcode, DIcode }, - { geDU, Tcode, DUcode, DUcode }, - { geSF, Tcode, SFcode, SFcode }, - { geDF, Tcode, DFcode, DFcode }, - { geXF, Tcode, XFcode, XFcode }, - { geP, Tcode, Pcode, Pcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_gt_expr[] = { - { gtSI, Tcode, SIcode, SIcode }, - { gtSU, Tcode, SUcode, SUcode }, - { gtDI, Tcode, DIcode, DIcode }, - { gtDU, Tcode, DUcode, DUcode }, - { gtSF, Tcode, SFcode, SFcode }, - { gtDF, Tcode, DFcode, DFcode }, - { gtXF, Tcode, XFcode, XFcode }, - { gtP, Tcode, Pcode, Pcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_eq_expr[] = { - { eqSI, Tcode, SIcode, SIcode }, - { eqDI, Tcode, DIcode, DIcode }, - { eqSF, Tcode, SFcode, SFcode }, - { eqDF, Tcode, DFcode, DFcode }, - { eqXF, Tcode, XFcode, XFcode }, - { eqP, Tcode, Pcode, Pcode }, - { -1, -1, -1, -1 }, -}; - -struct binary_operator optab_ne_expr[] = { - { neSI, Tcode, SIcode, SIcode }, - { neDI, Tcode, DIcode, DIcode }, - { neSF, Tcode, SFcode, SFcode }, - { neDF, Tcode, DFcode, DFcode }, - { neXF, Tcode, XFcode, XFcode }, - { neP, Tcode, Pcode, Pcode }, - { -1, -1, -1, -1 }, -}; - -/* Unary operator tables. */ -struct unary_operator optab_negate_expr[] = { - { negSI, SIcode, SIcode }, - { negDI, DIcode, DIcode }, - { negSF, SFcode, SFcode }, - { negDF, DFcode, DFcode }, - { negXF, XFcode, XFcode }, - { -1, -1, -1 }, -}; - -struct unary_operator optab_bit_not_expr[] = { - { notSI, SIcode, SIcode }, - { notDI, DIcode, DIcode }, - { -1, -1, -1 }, -}; - -struct unary_operator optab_truth_not_expr[] = { - { notT, SIcode, SIcode }, - { -1, -1, -1 }, -}; - -/* Increment operator tables. */ -struct increment_operator optab_predecrement_expr[] = { - { predecQI, QIcode }, - { predecQI, QUcode }, - { predecHI, HIcode }, - { predecHI, HUcode }, - { predecSI, SIcode }, - { predecSI, SUcode }, - { predecDI, DIcode }, - { predecDI, DUcode }, - { predecP, Pcode }, - { predecSF, SFcode }, - { predecDF, DFcode }, - { predecXF, XFcode }, - { -1, -1 }, -}; - -struct increment_operator optab_preincrement_expr[] = { - { preincQI, QIcode }, - { preincQI, QUcode }, - { preincHI, HIcode }, - { preincHI, HUcode }, - { preincSI, SIcode }, - { preincSI, SUcode }, - { preincDI, DIcode }, - { preincDI, DUcode }, - { preincP, Pcode }, - { preincSF, SFcode }, - { preincDF, DFcode }, - { preincXF, XFcode }, - { -1, -1 }, -}; - -struct increment_operator optab_postdecrement_expr[] = { - { postdecQI, QIcode }, - { postdecQI, QUcode }, - { postdecHI, HIcode }, - { postdecHI, HUcode }, - { postdecSI, SIcode }, - { postdecSI, SUcode }, - { postdecDI, DIcode }, - { postdecDI, DUcode }, - { postdecP, Pcode }, - { postdecSF, SFcode }, - { postdecDF, DFcode }, - { postdecXF, XFcode }, - { -1, -1 }, -}; - -struct increment_operator optab_postincrement_expr[] = { - { postincQI, QIcode }, - { postincQI, QUcode }, - { postincHI, HIcode }, - { postincHI, HUcode }, - { postincSI, SIcode }, - { postincSI, SUcode }, - { postincDI, DIcode }, - { postincDI, DUcode }, - { postincP, Pcode }, - { postincSF, SFcode }, - { postincDF, DFcode }, - { postincXF, XFcode }, - { -1, -1 }, -}; - -/* Table of conversions supported by the interpreter. */ -static struct conversion_info -{ - enum bytecode_opcode opcode; /* here indicates the conversion needs no opcode. */ - enum typecode from; - enum typecode to; - int cost; /* 1 for no-op conversions, 2 for widening conversions, - 4 for int/float conversions, 8 for narrowing conversions. */ -} conversion_info[] = { - { -1, QIcode, QUcode, 1 }, - { -1, HIcode, HUcode, 1 }, - { -1, SIcode, SUcode, 1 }, - { -1, DIcode, DUcode, 1 }, - { -1, QUcode, QIcode, 1 }, - { -1, HUcode, HIcode, 1 }, - { -1, SUcode, SIcode, 1 }, - { -1, DUcode, DIcode, 1 }, - { -1, Tcode, SIcode, 1 }, - { convertQIHI, QIcode, HIcode, 2 }, - { convertQUHU, QUcode, HUcode, 2 }, - { convertQUSU, QUcode, SUcode, 2 }, - { convertHISI, HIcode, SIcode, 2 }, - { convertHUSU, HUcode, SUcode, 2 }, - { convertSIDI, SIcode, DIcode, 2 }, - { convertSUDU, SUcode, DUcode, 2 }, - { convertSFDF, SFcode, DFcode, 2 }, - { convertDFXF, DFcode, XFcode, 2 }, - { convertHIQI, HIcode, QIcode, 8 }, - { convertSIQI, SIcode, QIcode, 8 }, - { convertSIHI, SIcode, HIcode, 8 }, - { convertSUQU, SUcode, QUcode, 8 }, - { convertDISI, DIcode, SIcode, 8 }, - { convertDFSF, DFcode, SFcode, 8 }, - { convertXFDF, XFcode, DFcode, 8 }, - { convertPSI, Pcode, SIcode, 2 }, - { convertSIP, SIcode, Pcode, 2 }, - { convertSIT, SIcode, Tcode, 2 }, - { convertDIT, DIcode, Tcode, 2 }, - { convertSFT, SFcode, Tcode, 2 }, - { convertDFT, DFcode, Tcode, 2 }, - { convertXFT, XFcode, Tcode, 2 }, - { convertQISI, QIcode, SIcode, 2 }, - { convertPT, Pcode, Tcode, 2 }, - { convertSISF, SIcode, SFcode, 4 }, - { convertSIDF, SIcode, DFcode, 4 }, - { convertSIXF, SIcode, XFcode, 4 }, - { convertSUSF, SUcode, SFcode, 4 }, - { convertSUDF, SUcode, DFcode, 4 }, - { convertSUXF, SUcode, XFcode, 4 }, - { convertDISF, DIcode, SFcode, 4 }, - { convertDIDF, DIcode, DFcode, 4 }, - { convertDIXF, DIcode, XFcode, 4 }, - { convertDUSF, DUcode, SFcode, 4 }, - { convertDUDF, DUcode, DFcode, 4 }, - { convertDUXF, DUcode, XFcode, 4 }, - { convertSFSI, SFcode, SIcode, 4 }, - { convertDFSI, DFcode, SIcode, 4 }, - { convertXFSI, XFcode, SIcode, 4 }, - { convertSFSU, SFcode, SUcode, 4 }, - { convertDFSU, DFcode, SUcode, 4 }, - { convertXFSU, XFcode, SUcode, 4 }, - { convertSFDI, SFcode, DIcode, 4 }, - { convertDFDI, DFcode, DIcode, 4 }, - { convertXFDI, XFcode, DIcode, 4 }, - { convertSFDU, SFcode, DUcode, 4 }, - { convertDFDU, DFcode, DUcode, 4 }, - { convertXFDU, XFcode, DUcode, 4 }, - { convertSIQI, SIcode, QIcode, 8 }, -}; - -#define NUM_CONVERSIONS (sizeof conversion_info / sizeof (struct conversion_info)) - -/* List form of a conversion recipe. */ -struct conversion_list -{ - enum bytecode_opcode opcode; - enum typecode to; - int cost; - struct conversion_list *prev; -}; - -/* Determine if it is "reasonable" to add a given conversion to - a given list of conversions. The following criteria define - "reasonable" conversion lists: - * No typecode appears more than once in the sequence (no loops). - * At most one conversion from integer to float or vice versa is present. - * Either sign extensions or zero extensions may be present, but not both. - * No widening conversions occur after a signed/unsigned conversion. - * The sequence of sizes must be strict nonincreasing or nondecreasing. */ -static int -conversion_reasonable_p (conversion, list) - struct conversion_info *conversion; - struct conversion_list *list; -{ - struct conversion_list *curr; - int curr_size, prev_size; - int has_int_float, has_float_int; - int has_sign_extend, has_zero_extend; - int has_signed_unsigned, has_unsigned_signed; - - has_int_float = 0; - has_float_int = 0; - has_sign_extend = 0; - has_zero_extend = 0; - has_signed_unsigned = 0; - has_unsigned_signed = 0; - - /* Make sure the destination typecode doesn't already appear in - the list. */ - for (curr = list; curr; curr = curr->prev) - if (conversion->to == curr->to) - return 0; - - /* Check for certain kinds of conversions. */ - if (TYPECODE_INTEGER_P (conversion->from) - && TYPECODE_FLOAT_P (conversion->to)) - has_int_float = 1; - if (TYPECODE_FLOAT_P (conversion->from) - && TYPECODE_INTEGER_P (conversion->to)) - has_float_int = 1; - if (TYPECODE_SIGNED_P (conversion->from) - && TYPECODE_SIGNED_P (conversion->to) - && GET_TYPECODE_SIZE (conversion->from) - < GET_TYPECODE_SIZE (conversion->to)) - has_sign_extend = 1; - if (TYPECODE_UNSIGNED_P (conversion->from) - && TYPECODE_UNSIGNED_P (conversion->to) - && GET_TYPECODE_SIZE (conversion->from) - < GET_TYPECODE_SIZE (conversion->to)) - has_zero_extend = 1; - - for (curr = list; curr && curr->prev; curr = curr->prev) - { - if (TYPECODE_INTEGER_P (curr->prev->to) - && TYPECODE_FLOAT_P (curr->to)) - has_int_float = 1; - if (TYPECODE_FLOAT_P (curr->prev->to) - && TYPECODE_INTEGER_P (curr->to)) - has_float_int = 1; - if (TYPECODE_SIGNED_P (curr->prev->to) - && TYPECODE_SIGNED_P (curr->to) - && GET_TYPECODE_SIZE (curr->prev->to) - < GET_TYPECODE_SIZE (curr->to)) - has_sign_extend = 1; - if (TYPECODE_UNSIGNED_P (curr->prev->to) - && TYPECODE_UNSIGNED_P (curr->to) - && GET_TYPECODE_SIZE (curr->prev->to) - < GET_TYPECODE_SIZE (curr->to)) - has_zero_extend = 1; - if (TYPECODE_SIGNED_P (curr->prev->to) - && TYPECODE_UNSIGNED_P (curr->to)) - has_signed_unsigned = 1; - if (TYPECODE_UNSIGNED_P (curr->prev->to) - && TYPECODE_SIGNED_P (curr->to)) - has_unsigned_signed = 1; - } - - if (TYPECODE_INTEGER_P (conversion->from) - && TYPECODE_INTEGER_P (conversion->to) - && GET_TYPECODE_SIZE (conversion->to) - > GET_TYPECODE_SIZE (conversion->from) - && (has_signed_unsigned || has_unsigned_signed)) - return 0; - - if (has_float_int && has_int_float || has_sign_extend && has_zero_extend) - return 0; - - /* Make sure the sequence of destination typecode sizes is - strictly nondecreasing or strictly nonincreasing. */ - prev_size = GET_TYPECODE_SIZE (conversion->to); - for (curr = list; curr; curr = curr->prev) - { - curr_size = GET_TYPECODE_SIZE (curr->to); - if (curr_size != prev_size) - break; - } - if (!curr) - return 1; - - if (curr_size < prev_size) - for (prev_size = curr_size; curr; curr = curr->prev) - { - curr_size = GET_TYPECODE_SIZE (curr->to); - if (curr_size > prev_size) - return 0; - prev_size = curr_size; - } - else - for (prev_size = curr_size; curr; curr = curr->prev) - { - curr_size = GET_TYPECODE_SIZE (curr->to); - if (curr_size < prev_size) - return 0; - prev_size = curr_size; - } - return 1; -} - - -/* Exhaustively search all reasonable conversions to find one to - convert the given types. */ -static struct conversion_recipe -deduce_conversion (from, to) - enum typecode from, to; -{ - struct rl - { - struct conversion_list *list; - struct rl *next; - } *prev, curr, *good, *temp; - struct conversion_list *conv, *best; - int i, cost, bestcost; - struct conversion_recipe result; - struct obstack recipe_obstack; - - - obstack_init (&recipe_obstack); - curr.next = (struct rl *) obstack_alloc (&recipe_obstack, sizeof (struct rl)); - curr.next->list = - (struct conversion_list *) obstack_alloc (&recipe_obstack, - sizeof (struct conversion_list)); - curr.next->list->opcode = -1; - curr.next->list->to = from; - curr.next->list->cost = 0; - curr.next->list->prev = 0; - curr.next->next = 0; - good = 0; - - while (curr.next) - { - /* Remove successful conversions from further consideration. */ - for (prev = &curr; prev; prev = prev->next) - if (prev->next && prev->next->list->to == to) - { - temp = prev->next->next; - prev->next->next = good; - good = prev->next; - prev->next = temp; - } - - /* Go through each of the pending conversion chains, trying - all possible candidate conversions on them. */ - for (prev = curr.next, curr.next = 0; prev; prev = prev->next) - for (i = 0; i < NUM_CONVERSIONS; ++i) - if (conversion_info[i].from == prev->list->to - && conversion_reasonable_p (&conversion_info[i], prev->list)) - { - temp = (struct rl *) obstack_alloc (&recipe_obstack, - sizeof (struct rl)); - temp->list = (struct conversion_list *) - obstack_alloc (&recipe_obstack, - sizeof (struct conversion_list)); - temp->list->opcode = conversion_info[i].opcode; - temp->list->to = conversion_info[i].to; - temp->list->cost = conversion_info[i].cost; - temp->list->prev = prev->list; - temp->next = curr.next; - curr.next = temp; - } - } - - bestcost = BIG_ARBITRARY_NUMBER; - best = 0; - for (temp = good; temp; temp = temp->next) - { - for (conv = temp->list, cost = 0; conv; conv = conv->prev) - cost += conv->cost; - if (cost < bestcost) - { - bestcost = cost; - best = temp->list; - } - } - - if (!best) - abort (); - - for (i = 0, conv = best; conv; conv = conv->prev) - if (conv->opcode != -1) - ++i; - - result.opcodes = (unsigned char *) xmalloc (i); - result.nopcodes = i; - for (conv = best; conv; conv = conv->prev) - if (conv->opcode != -1) - result.opcodes[--i] = conv->opcode; - result.cost = bestcost; - obstack_free (&recipe_obstack, 0); - return result; -} - -#define DEDUCE_CONVERSION(FROM, TO) \ - (conversion_recipe[(int) FROM][(int) TO].opcodes ? 0 \ - : (conversion_recipe[(int) FROM][(int) TO] \ - = deduce_conversion (FROM, TO), 0)) - - -/* Emit a conversion between the given scalar types. */ -void -emit_typecode_conversion (from, to) - enum typecode from, to; -{ - int i; - - DEDUCE_CONVERSION (from, to); - for (i = 0; i < conversion_recipe[(int) from][(int) to].nopcodes; ++i) - bc_emit_instruction (conversion_recipe[(int) from][(int) to].opcodes[i]); -} - - -/* Initialize mode_to_code_map[] */ -void -bc_init_mode_to_code_map () -{ - int mode; - - for (mode = 0; mode < MAX_MACHINE_MODE + 1; mode++) - { - signed_mode_to_code_map[mode] = - unsigned_mode_to_code_map[mode] = - LAST_AND_UNUSED_TYPECODE; - } - -#define DEF_MODEMAP(SYM, CODE, UCODE, CONST, LOAD, STORE) \ - { signed_mode_to_code_map[(int) SYM] = CODE; \ - unsigned_mode_to_code_map[(int) SYM] = UCODE; } -#include "modemap.def" -#undef DEF_MODEMAP - - /* Initialize opcode maps for const, load, and store */ - bc_init_mode_to_opcode_maps (); -} - -/* Given a machine mode return the preferred typecode. */ -enum typecode -preferred_typecode (mode, unsignedp) - enum machine_mode mode; - int unsignedp; -{ - enum typecode code = (unsignedp - ? unsigned_mode_to_code_map - : signed_mode_to_code_map) [MIN ((int) mode, - (int) MAX_MACHINE_MODE)]; - - if (code == LAST_AND_UNUSED_TYPECODE) - abort (); - - return code; -} - - -/* Expand a conversion between the given types. */ -void -bc_expand_conversion (from, to) - tree from, to; -{ - enum typecode fcode, tcode; - - fcode = preferred_typecode (TYPE_MODE (from), TREE_UNSIGNED (from)); - tcode = preferred_typecode (TYPE_MODE (to), TREE_UNSIGNED (to)); - - emit_typecode_conversion (fcode, tcode); -} - -/* Expand a conversion of the given type to a truth value. */ -void -bc_expand_truth_conversion (from) - tree from; -{ - enum typecode fcode; - - fcode = preferred_typecode (TYPE_MODE (from), TREE_UNSIGNED (from)); - emit_typecode_conversion (fcode, Tcode); -} - -/* Emit an appropriate binary operation. */ -void -bc_expand_binary_operation (optab, resulttype, arg0, arg1) - struct binary_operator optab[]; - tree resulttype, arg0, arg1; -{ - int i, besti, cost, bestcost; - enum typecode resultcode, arg0code, arg1code; - - resultcode = preferred_typecode (TYPE_MODE (resulttype), TREE_UNSIGNED (resulttype)); - arg0code = preferred_typecode (TYPE_MODE (TREE_TYPE (arg0)), TREE_UNSIGNED (resulttype)); - arg1code = preferred_typecode (TYPE_MODE (TREE_TYPE (arg1)), TREE_UNSIGNED (resulttype)); - - besti = -1; - bestcost = BIG_ARBITRARY_NUMBER; - - for (i = 0; optab[i].opcode != -1; ++i) - { - cost = 0; - DEDUCE_CONVERSION (arg0code, optab[i].arg0); - cost += conversion_recipe[(int) arg0code][(int) optab[i].arg0].cost; - DEDUCE_CONVERSION (arg1code, optab[i].arg1); - cost += conversion_recipe[(int) arg1code][(int) optab[i].arg1].cost; - if (cost < bestcost) - { - besti = i; - bestcost = cost; - } - } - - if (besti == -1) - abort (); - - expand_expr (arg1, 0, VOIDmode, 0); - emit_typecode_conversion (arg1code, optab[besti].arg1); - expand_expr (arg0, 0, VOIDmode, 0); - emit_typecode_conversion (arg0code, optab[besti].arg0); - bc_emit_instruction (optab[besti].opcode); - emit_typecode_conversion (optab[besti].result, resultcode); -} - -/* Emit an appropriate unary operation. */ -void -bc_expand_unary_operation (optab, resulttype, arg0) - struct unary_operator optab[]; - tree resulttype, arg0; -{ - int i, besti, cost, bestcost; - enum typecode resultcode, arg0code; - - resultcode = preferred_typecode (TYPE_MODE (resulttype), TREE_UNSIGNED (resulttype)); - arg0code = preferred_typecode (TYPE_MODE (TREE_TYPE (arg0)), TREE_UNSIGNED (TREE_TYPE (arg0))); - - besti = -1; - bestcost = BIG_ARBITRARY_NUMBER; - - for (i = 0; optab[i].opcode != -1; ++i) - { - DEDUCE_CONVERSION (arg0code, optab[i].arg0); - cost = conversion_recipe[(int) arg0code][(int) optab[i].arg0].cost; - if (cost < bestcost) - { - besti = i; - bestcost = cost; - } - } - - if (besti == -1) - abort (); - - expand_expr (arg0, 0, VOIDmode, 0); - emit_typecode_conversion (arg0code, optab[besti].arg0); - bc_emit_instruction (optab[besti].opcode); - emit_typecode_conversion (optab[besti].result, resultcode); -} - - -/* Emit an appropriate increment. */ -void -bc_expand_increment (optab, type) - struct increment_operator optab[]; - tree type; -{ - enum typecode code; - int i; - - code = preferred_typecode (TYPE_MODE (type), TREE_UNSIGNED (type)); - for (i = 0; (int) optab[i].opcode >= 0; ++i) - if (code == optab[i].arg) - { - bc_emit_instruction (optab[i].opcode); - return; - } - abort (); -} diff --git a/contrib/gcc/bc-optab.h b/contrib/gcc/bc-optab.h deleted file mode 100644 index 6ad0b8592f65..000000000000 --- a/contrib/gcc/bc-optab.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Bytecode token definitions for GNU C-compiler. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -extern void bc_expand_conversion (); -extern void bc_expand_truth_conversion (); -extern void bc_expand_binary_operation (); -extern void bc_expand_unary_operation (); - -struct binary_operator -{ - enum bytecode_opcode opcode; - enum typecode result; - enum typecode arg0; - enum typecode arg1; -}; - -extern struct binary_operator optab_plus_expr[]; -extern struct binary_operator optab_minus_expr[]; -extern struct binary_operator optab_mult_expr[]; -extern struct binary_operator optab_trunc_div_expr[]; -extern struct binary_operator optab_trunc_mod_expr[]; -extern struct binary_operator optab_rdiv_expr[]; -extern struct binary_operator optab_bit_and_expr[]; -extern struct binary_operator optab_bit_ior_expr[]; -extern struct binary_operator optab_bit_xor_expr[]; -extern struct binary_operator optab_lshift_expr[]; -extern struct binary_operator optab_rshift_expr[]; -extern struct binary_operator optab_truth_and_expr[]; -extern struct binary_operator optab_truth_or_expr[]; -extern struct binary_operator optab_lt_expr[]; -extern struct binary_operator optab_le_expr[]; -extern struct binary_operator optab_ge_expr[]; -extern struct binary_operator optab_gt_expr[]; -extern struct binary_operator optab_eq_expr[]; -extern struct binary_operator optab_ne_expr[]; - -struct unary_operator -{ - enum bytecode_opcode opcode; - enum typecode result; - enum typecode arg0; -}; - -extern struct unary_operator optab_negate_expr[]; -extern struct unary_operator optab_bit_not_expr[]; -extern struct unary_operator optab_truth_not_expr[]; - -struct increment_operator -{ - enum bytecode_opcode opcode; - enum typecode arg; -}; - -extern struct increment_operator optab_predecrement_expr[]; -extern struct increment_operator optab_preincrement_expr[]; -extern struct increment_operator optab_postdecrement_expr[]; -extern struct increment_operator optab_postincrement_expr[]; diff --git a/contrib/gcc/bc-typecd.def b/contrib/gcc/bc-typecd.def deleted file mode 100644 index fd92cdd92822..000000000000 --- a/contrib/gcc/bc-typecd.def +++ /dev/null @@ -1,21 +0,0 @@ -/* Typecodes used by the interpreter and their related - machine modes and types. - - The last argument is used for retrieving the given - type from a varargs list. Due to a bug in varargs, - the type has to be the generic machine type of - larger. */ - -DEFTYPECODE (QIcode, "QI", QImode, SItype) -DEFTYPECODE (QUcode, "QU", QImode, SUtype) -DEFTYPECODE (HIcode, "HI", HImode, SItype) -DEFTYPECODE (HUcode, "HU", HImode, SUtype) -DEFTYPECODE (SIcode, "SI", SImode, SItype) -DEFTYPECODE (SUcode, "SU", SImode, SUtype) -DEFTYPECODE (DIcode, "DI", DImode, DItype) -DEFTYPECODE (DUcode, "DU", DImode, DUtype) -DEFTYPECODE (SFcode, "SF", SFmode, SFtype) -DEFTYPECODE (DFcode, "DF", DFmode, DFtype) -DEFTYPECODE (XFcode, "XF", XFmode, XFtype) -DEFTYPECODE (Pcode, "P", PSImode, Ptype) -DEFTYPECODE (Tcode, "T", SImode, SItype) diff --git a/contrib/gcc/bc-typecd.h b/contrib/gcc/bc-typecd.h deleted file mode 100644 index 2dcea0e08f51..000000000000 --- a/contrib/gcc/bc-typecd.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Typecode definitions for Bytecode Interpreter. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef TYPECODE_H -#define TYPECODE_H - -enum typecode -{ -#define DEFTYPECODE(CODE, NAME, MACHMODE, TYPE) CODE, -#include "bc-typecd.def" -#undef DEFTYPECODE - - LAST_AND_UNUSED_TYPECODE -}; - -/* Determine if a given type is integer. */ -#define TYPECODE_INTEGER_P(TYPECODE) ((int) (TYPECODE) < (int) SFcode) - -/* Determine if a given type is unsigned. */ -#define TYPECODE_UNSIGNED_P(TYPECODE) \ - (TYPECODE_INTEGER_P(TYPECODE) && (int) (TYPECODE) & 1) - -/* Determine if a given type is signed. */ -#define TYPECODE_SIGNED_P(TYPECODE) \ - (TYPECODE_INTEGER_P(TYPECODE) && !((int) (TYPECODE) & 1)) - -/* Determine if a given type is floating. */ -#define TYPECODE_FLOAT_P(TYPECODE) \ - ((int) (TYPECODE) < (int) Pcode && !TYPECODE_INTEGER_P(TYPECODE)) - -/* Determine if the given type is arithmetic. */ -#define TYPECODE_ARITH_P(TYPECODE) \ - (TYPECODE_INTEGER_P(TYPECODE) || TYPECODE_FLOAT_P(TYPECODE)) - -#define NUM_TYPECODES ((int) LAST_AND_UNUSED_TYPECODE) - -#endif diff --git a/contrib/gcc/bi-arity.c b/contrib/gcc/bi-arity.c deleted file mode 100644 index da3607fbf5de..000000000000 --- a/contrib/gcc/bi-arity.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Bytecode Interpreter utility to generate arity table. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include -#include "hconfig.h" -#include "bi-defs.h" - -int -length (n) - struct node *n; -{ - int k; - - for (k = 0; n; n = n->next) - ++k; - return k; -} - -int -main () -{ - struct def *d; - struct variation *v; - struct node *n; - - yyparse (); - reverse (); - - for (d = defs; d; d = d->next) - for (v = d->variations; v; v = v->next) - { - printf ("{ %d, %d, %d, {", length (v->inputs), - length (v->outputs), length (v->literals)); - for (n = v->literals; n; n = n->next) - printf ("(char) %scode, ", n->text); - if (v->literals == 0) - printf ("0"); - printf ("}},\n"); - } - - fflush (stdout); - exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); - /* NOTREACHED */ - return 0; -} - -/* Safely allocate NBYTES bytes of memory. Returns pointer to block of - memory. */ -char * -xmalloc (nbytes) - int nbytes; -{ - char *tmp = (char *) malloc (nbytes); - - if (!tmp) - { - fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes); - exit (FATAL_EXIT_CODE); - } - - return tmp; -} diff --git a/contrib/gcc/bi-defs.h b/contrib/gcc/bi-defs.h deleted file mode 100644 index 868312a847db..000000000000 --- a/contrib/gcc/bi-defs.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Definitions for Bytecode Interpreter. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -struct node -{ - char *text; - struct node *next; -}; - -struct variation -{ - char *name; - int code; - struct node *inputs; - struct node *outputs; - struct node *literals; - struct variation *next; -}; - -struct def -{ - char *basename; - char *template; - struct variation *variations; - struct def *next; -}; - -extern struct def *defs; -extern int ndefs; -extern void reverse(); diff --git a/contrib/gcc/bi-lexer.c b/contrib/gcc/bi-lexer.c deleted file mode 100644 index 6601c52c05b6..000000000000 --- a/contrib/gcc/bi-lexer.c +++ /dev/null @@ -1,167 +0,0 @@ -/* Lexer for scanner of bytecode definition file. - Copyright (C) 1993, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include "hconfig.h" -#include "bi-parser.h" - - -/* Safely allocate NBYTES bytes of memory. Returns pointer to block of - memory. */ - -static char * -xmalloc (nbytes) - int nbytes; -{ - char *tmp = (char *) malloc (nbytes); - - if (!tmp) - { - fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes); - exit (FATAL_EXIT_CODE); - } - - return tmp; -} - - -/* Safely reallocate BLOCK so its size becomes NBYTES. - The block returned may be different from the one supplied. */ - -static char * -xrealloc (block, nbytes) - char *block; - int nbytes; -{ - char *tmp = (block - ? (char *) realloc (block, nbytes) - : (char *) malloc (nbytes)); - - if (!tmp) - { - fprintf (stderr, "can't reallocate %d bytes (out of virtual memory)\n", nbytes); - exit (FATAL_EXIT_CODE); - } - - return tmp; -} - - -/* Scan for string token on standard input. A string is, for our - purposes here, a sequence of characters that starts with the regexp - ``[^ #\t\n(),]'' and is then followed by the regexp ``[^#(),]*''. Any - character is accepted if preceded by a backslash, "\\". It is assumed - that the first character has already been checked by the main loop. */ - -static char * -scan_string () -{ - char *buffer = NULL; - char *point = NULL; - int buffer_size = 0; - int c; - - while ((c = getc (stdin)) != EOF - && c != '#' && c != '(' && c != ')' && c != ',') - { - /* Extend buffer, if necessary (minus two so there's room for the NUL - trailer as well as another character if this one is a backslash). */ - if (!buffer_size || (point - buffer >= buffer_size-2)) - { - int previous_point_index = point - buffer; - - buffer_size = (!buffer_size ? 32 : buffer_size * 2); - if (!buffer) - buffer = xmalloc (buffer_size); - else - buffer = xrealloc (buffer, buffer_size); - - point = buffer + previous_point_index; - } - *point++ = c & 0xff; - - if (c == '\\') - { - c = getc (stdin); - - /* Catch special case: backslash at end of file */ - if (c == EOF) - break; - - *point++ = c; - } - } - *point = 0; - - if (c != EOF) - ungetc (c, stdin); - - return buffer; -} - - -int -yylex () -{ - int c; - char *token; - - - /* First char determines what token we're looking at */ - for (;;) - { - c = getc (stdin); - - switch (c) - { - case EOF: - return 0; - - case ' ': - case '\t': - case '\n': - /* Ignore whitespace */ - continue; - - case '#': - /* Comments advance to next line */ - while ((c = getc (stdin)) != '\n' && c != EOF); - continue; - - default: - if (c != '(' && c != ')' && c != '\\' && c != ',') - { - ungetc (c, stdin); - yylval.string = scan_string (); - - /* Check if string is "define_operator"; if so, return - a DEFOP token instead. */ - if (!strcmp (yylval.string, "define_operator")) - { - free (yylval.string); - yylval.string = 0; - return DEFOP; - } - return STRING; - } - return c & 0xff; - } - } -} diff --git a/contrib/gcc/bi-opcode.c b/contrib/gcc/bi-opcode.c deleted file mode 100644 index 6b1ebe4a69e7..000000000000 --- a/contrib/gcc/bi-opcode.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Utility to generate opcode list from bytecode definition. - Copyright (C) 1993, 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include "hconfig.h" -#include "bi-defs.h" - -int -main(argc, argv) - int argc; - char **argv; -{ - struct def *d; - struct variation *v; - int i; - - yyparse(); - reverse(); - - - printf ("/* This file is automatically generated from bytecode.def,\n"); - printf ("do not make any changes here. Instead edit bytecode.def. */\n\n"); - printf ("enum bytecode_opcode\n{"); - - i = 0; - for (d = defs; d; d = d->next) - for (v = d->variations; v; v = v->next) - { - printf (" %s%s,\n", d->basename, v->name); - ++i; - } - - puts (" LAST_AND_UNUSED_OPCODE\n};"); - - if (i > 256) - fprintf (stderr, "%s: warning, number of opcodes is %d\n", *argv, i); - else - fprintf (stderr, "(Number of opcodes is %d)\n", i); - - fflush (stdout); - exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); - /* NOTREACHED */ - return 0; -} - -/* Safely allocate NBYTES bytes of memory. Returns pointer to block of - memory. */ -char * -xmalloc (nbytes) - int nbytes; -{ - char *tmp = (char *) malloc (nbytes); - - if (!tmp) - { - fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes); - exit (FATAL_EXIT_CODE); - } - - return tmp; -} diff --git a/contrib/gcc/bi-opname.c b/contrib/gcc/bi-opname.c deleted file mode 100644 index 1862e7120fb0..000000000000 --- a/contrib/gcc/bi-opname.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Utility to generate opcode name list from bytecode definition file. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include "hconfig.h" -#include "bi-defs.h" - -int -main() -{ - struct def *d; - struct variation *v; - - yyparse(); - reverse(); - - for (d = defs; d; d = d->next) - for (v = d->variations; v; v = v->next) - printf("\"%s%s\",\n", d->basename, v->name); - - fflush (stdout); - exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); - /* NOTREACHED */ - return 0; -} - -/* Safely allocate NBYTES bytes of memory. Returns pointer to block of - memory. */ -char * -xmalloc (nbytes) - int nbytes; -{ - char *tmp = (char *) malloc (nbytes); - - if (!tmp) - { - fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes); - exit (FATAL_EXIT_CODE); - } - - return tmp; -} diff --git a/contrib/gcc/bi-parser.y b/contrib/gcc/bi-parser.y deleted file mode 100644 index 0a03d0f05ada..000000000000 --- a/contrib/gcc/bi-parser.y +++ /dev/null @@ -1,169 +0,0 @@ -/* Bytecode definition file parser. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -%{ - -#include -#include "hconfig.h" -#include "bi-defs.h" - -extern char yytext[]; -extern int yyleng; - - -/* Chain of all defs built by the parser. */ -struct def *defs; -int ndefs; - -static struct node *makenode (); -static struct variation *makevar (); -static struct def *makedef (); - -void yyerror (); - -%} - -%union -{ - char *string; - struct def *def; - struct variation *variation; - struct node *node; -} - -%token DEFOP STRING -%type opt_string -%type defs def -%type variations variation -%type list items item - -%% - -top: - defs - { defs = $1; } - ; - -defs: - def - | defs def - { $2->next = $1; $$ = $2; } - ; - -def: - DEFOP '(' STRING ',' opt_string ',' '(' variations ')' ')' - { $$ = makedef ($3, $5, $8); } - ; - -variations: - variation - | variations ',' variation - { $3->next = $1; $$ = $3; } - ; - -variation: - '(' opt_string ')' - { $$ = makevar ($2, (struct node *) NULL, (struct node *) NULL, (struct node *) NULL); } - | '(' opt_string ',' list ')' - { $$ = makevar ($2, $4, (struct node *) NULL, (struct node *) NULL); } - | '(' opt_string ',' list ',' list ')' - { $$ = makevar ($2, $4, $6, (struct node *) NULL); } - | '(' opt_string ',' list ',' list ',' list ')' - { $$ = makevar ($2, $4, $6, $8); } - ; - -opt_string: - /* empty */ { $$ = ""; } - | STRING { $$ = $1; } - ; - -list: - '(' items ')' - { $$ = $2; } - | /* empty */ - { $$ = NULL; } - ; - -items: - item - /* Note right recursion. */ - | item ',' items - { $1->next = $3; $$ = $1; } - ; - -item: - STRING - { $$ = makenode ($1); } - ; - -%% - -static struct node * -makenode (s) - char *s; -{ - struct node *n; - - n = (struct node *) malloc (sizeof (struct node)); - n->text = s; - n->next = NULL; - return n; -} - -static struct variation * -makevar (name, inputs, outputs, literals) - char *name; - struct node *inputs, *outputs, *literals; -{ - struct variation *v; - - v = (struct variation *) malloc (sizeof (struct variation)); - v->name = name; - v->code = ndefs++; - v->inputs = inputs; - v->outputs = outputs; - v->literals = literals; - v->next = NULL; - return v; -} - -static struct def * -makedef (name, template, vars) - char *name, *template; - struct variation *vars; -{ - struct def *d; - - d = (struct def *) malloc (sizeof (struct def)); - d->basename = name; - d->template = template; - d->variations = vars; - d->next = NULL; - return d; -} - -void -yyerror (s) - char *s; -{ - fprintf (stderr, "syntax error in input\n"); - exit (FATAL_EXIT_CODE); -} diff --git a/contrib/gcc/bi-reverse.c b/contrib/gcc/bi-reverse.c deleted file mode 100644 index 6a84f827e73a..000000000000 --- a/contrib/gcc/bi-reverse.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Reverse order of definitions obtained from bytecode definition file. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "hconfig.h" -#include "bi-defs.h" - -void -reverse() -{ - struct def *dp, *d, *dn; - struct variation *vp, *v, *vn; - - dp = defs; - if (dp) - { - vp = dp->variations; - if (vp) - { - for (v = vp->next, vp->next = 0; v; vp = v, v = vn) - { - vn = v->next; - v->next = vp; - } - dp->variations = vp; - } - for (d = dp->next, dp->next = 0; d; dp = d, d = dn) - { - vp = d->variations; - if (vp) - { - for (v = vp->next, vp->next = 0; v; vp = v, v = vn) - { - vn = v->next; - v->next = vp; - } - d->variations = vp; - } - dn = d->next; - d->next = dp; - } - defs = dp; - } -} diff --git a/contrib/gcc/bi-run.h b/contrib/gcc/bi-run.h deleted file mode 100644 index dc9192f78b87..000000000000 --- a/contrib/gcc/bi-run.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Definitions for Bytecode Interpreter. - Copyright (C) 1993, 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define MAXLITERALS 5 - -struct arityvec -{ - char ninputs; - char noutputs; - char nliterals; - char literals[MAXLITERALS]; -}; - -struct argtype -{ - int modealign; /* Argument mode:alignment */ - int size; /* Argument size, in bytes */ -}; - -struct callinfo -{ - int nargs; /* Number of arguments in call */ - struct argtype retvaltype; /* Type of return value */ - struct argtype argtypes[1]; /* Argument types */ -}; - -/* Structure describing a bytecode function. If this changes, we also - need to change expand_function_end () in bc-trans.c */ -struct bytecode -{ - int stacksize; /* Depth required of evaluation stack. */ - int localsize; /* Size in bytes of local variables. */ - unsigned char *pc0; /* Initial program counter. */ - void **ptrlit; /* Vector of (relocatable) pointer literals. */ - struct callinfo *callinfo; /* Vector of procedure call type info. */ -}; - - -#define INTERP_BPC 8 /* Bits per char */ -#define INTERP_BPI \ - (sizeof (int) * INTERP_BPC) /* Bits per int */ - - -#ifndef min -#define min(L, R) ((L) < (R) ? (L) : (R)) -#endif - - -/* bit field operations. */ - -/* Low (high) mask: int with low (high) N bits set */ - -#define LM(N) ((1 << (N)) - 1) -#define HM(N) ((~LM (INTERP_BPI - (N)))) - - -/* Sign-extend SIZE low bits of VALUE to integer (typeof VALUE) - Signed bitfields are loaded from memory by the sxloadBI instruction, - which first retrieves the bitfield with XFIELD and then sign extends - it to an SItype. */ - -#define EXTEND(SIZE, VALUE) \ - ({ SUtype value = (SUtype) (VALUE); \ - (value & (1 << ((SIZE) - 1)) ? value | ~LM (SIZE) : value); }) - - -/* Given OFFSET:SIZE for a bitfield, calculate: - - [1] BYTE_OFFSET = the byte offset of the bit field. - [2] BIT_OFFSET = the bit offset of the bit field (less than INTERP_BPC). - [3] NBYTES = the number of integral bytes in the bit field. - [4] TRAILING_BITS= the number of trailing bits (less than INTERP_BPC). - - - , , , , , (memory bytes) - ---------------- (bitfield) - | | || | | (divisions) - ^ ^ ^ ^ - | | | |__ [4] (bits) - | | |_________ [3] (bytes) - | |_________________ [2] (bits) - |___________________________ [1] (bytes) - - - The above applies to BYTE_LOW_ENDIAN machines. In BYTE_BIG_ENDIAN machines, the - bit numbering is reversed (i.e. bit 0 is the sign bit). - - (All right, so I drew this to keep my tongue in cheek while writing the code below, - not because I'm into ASCII art.) */ - - -#define BI_PARAMS(OFFSET, SIZE, BYTE_OFFSET, BIT_OFFSET, NBYTES, TRAILING_BITS) \ - { BYTE_OFFSET = (OFFSET) / (INTERP_BPC); \ - BIT_OFFSET = (OFFSET) % (INTERP_BPC); \ - NBYTES = ((SIZE) - (INTERP_BPC - (BIT_OFFSET))) / INTERP_BPC; \ - if ((NBYTES) < 0 || ((NBYTES) > 64)) \ - NBYTES = 0; \ - if ((SIZE) + (BIT_OFFSET) <= INTERP_BPC) \ - TRAILING_BITS = 0; \ - else \ - TRAILING_BITS = ((SIZE) - (INTERP_BPC - (BIT_OFFSET))) % INTERP_BPC; } - - -/* SHIFT_IN_BITS retrieves NBITS bits from SOURCE and shifts into - DEST. The bit field starts OFFSET bits into SOURCE. - - OR_IN_BITS copies the NBITS low bits from VALUE into a the bitfield in - DEST offset by OFFSET bits. */ - - -#define SHIFT_IN_BITS(DEST, SOURCE, OFFSET, NBITS) \ - (DEST = ((DEST) << (NBITS)) \ - | (LM ((NBITS)) \ - & ((SOURCE) \ - >> (BYTES_BIG_ENDIAN \ - ? (INTERP_BPC - (OFFSET) - (NBITS)) \ - : (OFFSET))))) - -#define OR_IN_BITS(DEST, VALUE, OFFSET, NBITS) \ - (DEST = ((DEST) & ~(LM ((NBITS)) \ - << (BIG_ENDIAN \ - ? (INTERP_BPC - (OFFSET) - (NBITS)) \ - : (OFFSET))) \ - | (((VALUE) & LM ((NBITS))) \ - << (BIG_ENDIAN \ - ? (INTERP_BPC - (OFFSET) - (NBITS)) \ - : (OFFSET))))) - -/* Procedure call; arguments are a pointer to the function to be called, - a pointer to a place to store the return value, a pointer to a vector - describing the type of procedure call, and the interpreter's stack pointer, - which will point to the first of the arguments at this point. */ - -#define CALL(FUNC, CALLDESC, RETVAL, SP) __call(FUNC, CALLDESC, RETVAL, SP) - - -/* Procedure return; arguments are a pointer to the calldesc for this - function, and a pointer to the place where the value to be returned - may be found. Generally the MACHARGS above contain a machine dependent - cookie that is used to determine where to jump to. */ - -#define PROCRET(CALLDESC, RETVAL) return diff --git a/contrib/gcc/bitmap.c b/contrib/gcc/bitmap.c deleted file mode 100644 index b4fc0971601d..000000000000 --- a/contrib/gcc/bitmap.c +++ /dev/null @@ -1,642 +0,0 @@ -/* Functions to support general ended bitmaps. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "flags.h" -#include "obstack.h" -#include "regs.h" -#include "basic-block.h" - -/* Obstack to allocate bitmap elements from. */ -static struct obstack bitmap_obstack; -static int bitmap_obstack_init = FALSE; - - -#ifndef INLINE -#ifndef __GNUC__ -#define INLINE -#else -#define INLINE __inline__ -#endif -#endif - -/* Global data */ -bitmap_element bitmap_zero; /* An element of all zero bits. */ -bitmap_element *bitmap_free; /* Freelist of bitmap elements. */ - -static void bitmap_element_free PROTO((bitmap, bitmap_element *)); -static bitmap_element *bitmap_element_allocate PROTO((void)); -static int bitmap_element_zerop PROTO((bitmap_element *)); -static void bitmap_element_link PROTO((bitmap, bitmap_element *)); -static bitmap_element *bitmap_find_bit PROTO((bitmap, unsigned int)); - -/* Free a bitmap element */ - -static INLINE void -bitmap_element_free (head, elt) - bitmap head; - bitmap_element *elt; -{ - bitmap_element *next = elt->next; - bitmap_element *prev = elt->prev; - - if (prev) - prev->next = next; - - if (next) - next->prev = prev; - - if (head->first == elt) - head->first = next; - - /* Since the first thing we try is to insert before current, - make current the next entry in preference to the previous. */ - if (head->current == elt) - head->current = next != 0 ? next : prev; - - elt->next = bitmap_free; - bitmap_free = elt; -} - -/* Allocate a bitmap element. The bits are cleared, but nothing else is. */ - -static INLINE bitmap_element * -bitmap_element_allocate () -{ - bitmap_element *element; -#if BITMAP_ELEMENT_WORDS != 2 - int i; -#endif - - if (bitmap_free != 0) - { - element = bitmap_free; - bitmap_free = element->next; - } - else - { - /* We can't use gcc_obstack_init to initialize the obstack since - print-rtl.c now calls bitmap functions, and bitmap is linked - into the gen* functions. */ - if (!bitmap_obstack_init) - { - bitmap_obstack_init = TRUE; - - /* Let particular systems override the size of a chunk. */ -#ifndef OBSTACK_CHUNK_SIZE -#define OBSTACK_CHUNK_SIZE 0 -#endif - /* Let them override the alloc and free routines too. */ -#ifndef OBSTACK_CHUNK_ALLOC -#define OBSTACK_CHUNK_ALLOC xmalloc -#endif -#ifndef OBSTACK_CHUNK_FREE -#define OBSTACK_CHUNK_FREE free -#endif - -#if !defined(__GNUC__) || (__GNUC__ < 2) -#define __alignof__(type) 0 -#endif - - obstack_specify_allocation (&bitmap_obstack, OBSTACK_CHUNK_SIZE, - __alignof__ (bitmap_element), - (void *(*) ()) OBSTACK_CHUNK_ALLOC, - (void (*) ()) OBSTACK_CHUNK_FREE); - } - - element = (bitmap_element *) obstack_alloc (&bitmap_obstack, - sizeof (bitmap_element)); - } - -#if BITMAP_ELEMENT_WORDS == 2 - element->bits[0] = element->bits[1] = 0; -#else - for (i = 0; i < BITMAP_ELEMENT_WORDS; i++) - element->bits[i] = 0; -#endif - - return element; -} - -/* Return nonzero if all bits in an element are zero. */ - -static INLINE int -bitmap_element_zerop (element) - bitmap_element *element; -{ -#if BITMAP_ELEMENT_WORDS == 2 - return (element->bits[0] | element->bits[1]) == 0; -#else - int i; - - for (i = 0; i < BITMAP_ELEMENT_WORDS; i++) - if (element->bits[i] != 0) - return 0; - - return 1; -#endif -} - -/* Link the bitmap element into the current bitmap linked list. */ - -static INLINE void -bitmap_element_link (head, element) - bitmap head; - bitmap_element *element; -{ - unsigned int indx = element->indx; - bitmap_element *ptr; - - /* If this is the first and only element, set it in. */ - if (head->first == 0) - { - element->next = element->prev = 0; - head->first = element; - } - - /* If this index is less than that of the current element, it goes someplace - before the current element. */ - else if (indx < head->indx) - { - for (ptr = head->current; - ptr->prev != 0 && ptr->prev->indx > indx; - ptr = ptr->prev) - ; - - if (ptr->prev) - ptr->prev->next = element; - else - head->first = element; - - element->prev = ptr->prev; - element->next = ptr; - ptr->prev = element; - } - - /* Otherwise, it must go someplace after the current element. */ - else - { - for (ptr = head->current; - ptr->next != 0 && ptr->next->indx < indx; - ptr = ptr->next) - ; - - if (ptr->next) - ptr->next->prev = element; - - element->next = ptr->next; - element->prev = ptr; - ptr->next = element; - } - - /* Set up so this is the first element searched. */ - head->current = element; - head->indx = indx; -} - -/* Clear a bitmap by freeing the linked list. */ - -INLINE void -bitmap_clear (head) - bitmap head; -{ - bitmap_element *element, *next; - - for (element = head->first; element != 0; element = next) - { - next = element->next; - element->next = bitmap_free; - bitmap_free = element; - } - - head->first = head->current = 0; -} - -/* Copy a bitmap to another bitmap */ - -void -bitmap_copy (to, from) - bitmap to; - bitmap from; -{ - bitmap_element *from_ptr, *to_ptr = 0; -#if BITMAP_ELEMENT_WORDS != 2 - int i; -#endif - - bitmap_clear (to); - - /* Copy elements in forward direction one at a time */ - for (from_ptr = from->first; from_ptr; from_ptr = from_ptr->next) - { - bitmap_element *to_elt = bitmap_element_allocate (); - - to_elt->indx = from_ptr->indx; - -#if BITMAP_ELEMENT_WORDS == 2 - to_elt->bits[0] = from_ptr->bits[0]; - to_elt->bits[1] = from_ptr->bits[1]; -#else - for (i = 0; i < BITMAP_ELEMENT_WORDS; i++) - to_elt->bits[i] = from_ptr->bits[i]; -#endif - - /* Here we have a special case of bitmap_element_link, for the case - where we know the links are being entered in sequence. */ - if (to_ptr == 0) - { - to->first = to->current = to_elt; - to->indx = from_ptr->indx; - to_elt->next = to_elt->prev = 0; - } - else - { - to_elt->prev = to_ptr; - to_elt->next = 0; - to_ptr->next = to_elt; - } - - to_ptr = to_elt; - } -} - -/* Find a bitmap element that would hold a bitmap's bit. - Update the `current' field even if we can't find an element that - would hold the bitmap's bit to make eventual allocation - faster. */ - -static INLINE bitmap_element * -bitmap_find_bit (head, bit) - bitmap head; - unsigned int bit; -{ - bitmap_element *element; - unsigned HOST_WIDE_INT indx = bit / BITMAP_ELEMENT_ALL_BITS; - - if (head->current == 0) - return 0; - - if (head->indx > indx) - for (element = head->current; - element->prev != 0 && element->indx > indx; - element = element->prev) - ; - - else - for (element = head->current; - element->next != 0 && element->indx < indx; - element = element->next) - ; - - /* `element' is the nearest to the one we want. If it's not the one we - want, the one we want doesn't exist. */ - head->current = element; - head->indx = element->indx; - if (element != 0 && element->indx != indx) - element = 0; - - return element; -} - -/* Clear a single bit in a bitmap. */ - -void -bitmap_clear_bit (head, bit) - bitmap head; - int bit; -{ - bitmap_element *ptr = bitmap_find_bit (head, bit); - - if (ptr != 0) - { - unsigned bit_num = bit % (unsigned) HOST_BITS_PER_WIDE_INT; - unsigned word_num = ((bit / (unsigned) HOST_BITS_PER_WIDE_INT) - % BITMAP_ELEMENT_WORDS); - ptr->bits[word_num] &= ~ (((unsigned HOST_WIDE_INT) 1) << bit_num); - - /* If we cleared the entire word, free up the element */ - if (bitmap_element_zerop (ptr)) - bitmap_element_free (head, ptr); - } -} - - -/* Set a single bit in a bitmap. */ - -void -bitmap_set_bit (head, bit) - bitmap head; - int bit; -{ - bitmap_element *ptr = bitmap_find_bit (head, bit); - unsigned word_num - = ((bit / (unsigned) HOST_BITS_PER_WIDE_INT) % BITMAP_ELEMENT_WORDS); - unsigned bit_num = bit % (unsigned) HOST_BITS_PER_WIDE_INT; - unsigned HOST_WIDE_INT bit_val = ((unsigned HOST_WIDE_INT) 1) << bit_num; - - if (ptr == 0) - { - ptr = bitmap_element_allocate (); - ptr->indx = bit / BITMAP_ELEMENT_ALL_BITS; - ptr->bits[word_num] = bit_val; - bitmap_element_link (head, ptr); - } - else - ptr->bits[word_num] |= bit_val; -} - -/* Return whether a bit is set within a bitmap. */ - -int -bitmap_bit_p (head, bit) - bitmap head; - int bit; -{ - bitmap_element *ptr; - unsigned bit_num; - unsigned word_num; - - ptr = bitmap_find_bit (head, bit); - if (ptr == 0) - return 0; - - bit_num = bit % (unsigned) HOST_BITS_PER_WIDE_INT; - word_num - = ((bit / (unsigned) HOST_BITS_PER_WIDE_INT) % BITMAP_ELEMENT_WORDS); - - return - (ptr->bits[word_num] & (((unsigned HOST_WIDE_INT) 1) << bit_num)) != 0; -} - -/* Store in bitmap TO the result of combining bitmap FROM1 and - FROM2 using a specific bit manipulation. */ - -void -bitmap_operation (to, from1, from2, operation) - bitmap to; - bitmap from1; - bitmap from2; - enum bitmap_bits operation; -{ - bitmap_element *delete_list = 0; - bitmap_element *from1_ptr = from1->first; - bitmap_element *from2_ptr = from2->first; - unsigned int indx1 - = (from1_ptr) ? from1_ptr->indx : ~ (unsigned HOST_WIDE_INT) 0; - unsigned int indx2 - = (from2_ptr) ? from2_ptr->indx : ~ (unsigned HOST_WIDE_INT) 0; - bitmap_element *to_ptr = 0; - bitmap_element *from1_tmp; - bitmap_element *from2_tmp; - unsigned int indx; -#if BITMAP_ELEMENT_WORDS != 2 - int i; -#endif - - /* To simplify things, always create a new list. If the old list was one - of the inputs, free it later. Otherwise, free it now. */ - if (to == from1 || to == from2) - { - delete_list = to->first; - to->first = to->current = 0; - } - else - bitmap_clear (to); - - while (from1_ptr != 0 || from2_ptr != 0) - { - /* Figure out whether we need to substitute zero elements for - missing links. */ - if (indx1 == indx2) - { - indx = indx1; - from1_tmp = from1_ptr; - from2_tmp = from2_ptr; - from1_ptr = from1_ptr->next; - indx1 = (from1_ptr) ? from1_ptr->indx : ~ (unsigned HOST_WIDE_INT) 0; - from2_ptr = from2_ptr->next; - indx2 = (from2_ptr) ? from2_ptr->indx : ~ (unsigned HOST_WIDE_INT) 0; - } - else if (indx1 < indx2) - { - indx = indx1; - from1_tmp = from1_ptr; - from2_tmp = &bitmap_zero; - from1_ptr = from1_ptr->next; - indx1 = (from1_ptr) ? from1_ptr->indx : ~ (unsigned HOST_WIDE_INT) 0; - } - else - { - indx = indx2; - from1_tmp = &bitmap_zero; - from2_tmp = from2_ptr; - from2_ptr = from2_ptr->next; - indx2 = (from2_ptr) ? from2_ptr->indx : ~ (unsigned HOST_WIDE_INT) 0; - } - - if (to_ptr == 0) - to_ptr = bitmap_element_allocate (); - - /* Do the operation, and if any bits are set, link it into the - linked list. */ - switch (operation) - { - default: - abort (); - - case BITMAP_AND: -#if BITMAP_ELEMENT_WORDS == 2 - to_ptr->bits[0] = from1_tmp->bits[0] & from2_tmp->bits[0]; - to_ptr->bits[1] = from1_tmp->bits[1] & from2_tmp->bits[1]; -#else - for (i = BITMAP_ELEMENT_WORDS - 1; i >= 0; i--) - to_ptr->bits[i] = from1_tmp->bits[i] & from2_tmp->bits[i]; -#endif - break; - - case BITMAP_AND_COMPL: -#if BITMAP_ELEMENT_WORDS == 2 - to_ptr->bits[0] = from1_tmp->bits[0] & ~ from2_tmp->bits[0]; - to_ptr->bits[1] = from1_tmp->bits[1] & ~ from2_tmp->bits[1]; -#else - for (i = BITMAP_ELEMENT_WORDS - 1; i >= 0; i--) - to_ptr->bits[i] = from1_tmp->bits[i] & ~ from2_tmp->bits[i]; -#endif - break; - - case BITMAP_IOR: -#if BITMAP_ELEMENT_WORDS == 2 - to_ptr->bits[0] = from1_tmp->bits[0] | from2_tmp->bits[0]; - to_ptr->bits[1] = from1_tmp->bits[1] | from2_tmp->bits[1]; -#else - for (i = BITMAP_ELEMENT_WORDS - 1; i >= 0; i--) - to_ptr->bits[i] = from1_tmp->bits[i] | from2_tmp->bits[i]; -#endif - break; - } - - if (! bitmap_element_zerop (to_ptr)) - { - to_ptr->indx = indx; - bitmap_element_link (to, to_ptr); - to_ptr = 0; - } - } - - /* If we have an unallocated element due to the last element being 0, - release it back to the free pool. Don't bother calling - bitmap_element_free since it was never linked into a bitmap. */ - if (to_ptr != 0) - { - to_ptr->next = bitmap_free; - bitmap_free = to_ptr; - } - - /* If the output bitmap was one of the inputs, free up its - elements now that we're done. */ - for (; delete_list != 0; delete_list = to_ptr) - { - to_ptr = delete_list->next; - delete_list->next = bitmap_free; - bitmap_free = delete_list; - } -} - -/* Or into bitmap TO bitmap FROM1 and'ed with the complement of - bitmap FROM2. */ - -void -bitmap_ior_and_compl (to, from1, from2) - bitmap to; - bitmap from1; - bitmap from2; -{ - bitmap_head tmp; - - tmp.first = tmp.current = 0; - - bitmap_operation (&tmp, from1, from2, BITMAP_AND_COMPL); - bitmap_operation (to, to, &tmp, BITMAP_IOR); - bitmap_clear (&tmp); -} - -/* Initialize a bitmap header. */ - -bitmap -bitmap_initialize (head) - bitmap head; -{ - head->first = head->current = 0; - - return head; -} - -/* Debugging function to print out the contents of a bitmap. */ - -void -bitmap_debug_file (file, head) - FILE *file; - bitmap head; -{ - bitmap_element *ptr; - - fprintf (file, "\nfirst = "); - fprintf (file, HOST_PTR_PRINTF, head->first); - fprintf (file, " current = "); - fprintf (file, HOST_PTR_PRINTF, head->current); - fprintf (file, " indx = %u\n", head->indx); - - for (ptr = head->first; ptr; ptr = ptr->next) - { - int i, j, col = 26; - - fprintf (file, "\t"); - fprintf (file, HOST_PTR_PRINTF, ptr); - fprintf (file, " next = "); - fprintf (file, HOST_PTR_PRINTF, ptr->next); - fprintf (file, " prev = "); - fprintf (file, HOST_PTR_PRINTF, ptr->prev); - fprintf (file, " indx = %u\n\t\tbits = {", ptr->indx); - - for (i = 0; i < BITMAP_ELEMENT_WORDS; i++) - for (j = 0; j < HOST_BITS_PER_WIDE_INT; j++) - if ((ptr->bits[i] & (((unsigned HOST_WIDE_INT) 1) << j)) != 0) - { - if (col > 70) - { - fprintf (file, "\n\t\t\t"); - col = 24; - } - - fprintf (file, " %u", (ptr->indx * BITMAP_ELEMENT_ALL_BITS - + i * HOST_BITS_PER_WIDE_INT + j)); - col += 4; - } - - fprintf (file, " }\n"); - } -} - -/* Function to be called from the debugger to print the contents - of a bitmap. */ - -void -debug_bitmap (head) - bitmap head; -{ - bitmap_debug_file (stdout, head); -} - -/* Function to print out the contents of a bitmap. Unlike bitmap_debug_file, - it does not print anything but the bits. */ - -void -bitmap_print (file, head, prefix, suffix) - FILE *file; - bitmap head; - const char *prefix; - const char *suffix; -{ - const char *comma = ""; - int i; - - fputs (prefix, file); - EXECUTE_IF_SET_IN_BITMAP (head, 0, i, - { - fprintf (file, "%s%d", comma, i); - comma = ", "; - }); - fputs (suffix, file); -} - -/* Release any memory allocated by bitmaps. */ - -void -bitmap_release_memory () -{ - bitmap_free = 0; - if (bitmap_obstack_init) - { - bitmap_obstack_init = FALSE; - obstack_free (&bitmap_obstack, NULL_PTR); - } -} diff --git a/contrib/gcc/bitmap.h b/contrib/gcc/bitmap.h deleted file mode 100644 index 4ff0bf4987e0..000000000000 --- a/contrib/gcc/bitmap.h +++ /dev/null @@ -1,317 +0,0 @@ -/* Functions to support general ended bitmaps. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Number of words to use for each element in the linked list. */ - -#ifndef BITMAP_ELEMENT_WORDS -#define BITMAP_ELEMENT_WORDS 2 -#endif - -/* Number of bits in each actual element of a bitmap. We get slightly better - code for bit % BITMAP_ELEMENT_ALL_BITS and bit / BITMAP_ELEMENT_ALL_BITS if - bits is unsigned, assuming it is a power of 2. */ - -#define BITMAP_ELEMENT_ALL_BITS \ - ((unsigned) (BITMAP_ELEMENT_WORDS * HOST_BITS_PER_WIDE_INT)) - -/* Bitmap set element. We use a linked list to hold only the bits that - are set. This allows for use to grow the bitset dynamically without - having to realloc and copy a giant bit array. The `prev' field is - undefined for an element on the free list. */ - -typedef struct bitmap_element_def -{ - struct bitmap_element_def *next; /* Next element. */ - struct bitmap_element_def *prev; /* Previous element. */ - unsigned int indx; /* regno/BITMAP_ELEMENT_ALL_BITS. */ - unsigned HOST_WIDE_INT bits[BITMAP_ELEMENT_WORDS]; /* Bits that are set. */ -} bitmap_element; - -/* Head of bitmap linked list. */ -typedef struct bitmap_head_def { - bitmap_element *first; /* First element in linked list. */ - bitmap_element *current; /* Last element looked at. */ - unsigned int indx; /* Index of last element looked at. */ -} bitmap_head, *bitmap; - -/* Enumeration giving the various operations we support. */ -enum bitmap_bits { - BITMAP_AND, /* TO = FROM1 & FROM2 */ - BITMAP_AND_COMPL, /* TO = FROM1 & ~ FROM2 */ - BITMAP_IOR /* TO = FROM1 | FROM2 */ -}; - -/* Global data */ -extern bitmap_element *bitmap_free; /* Freelist of bitmap elements */ -extern bitmap_element bitmap_zero; /* Zero bitmap element */ - -/* Clear a bitmap by freeing up the linked list. */ -extern void bitmap_clear PROTO((bitmap)); - -/* Copy a bitmap to another bitmap. */ -extern void bitmap_copy PROTO((bitmap, bitmap)); - -/* Perform an operation on two bitmaps, yielding a third. */ -extern void bitmap_operation PROTO((bitmap, bitmap, bitmap, enum bitmap_bits)); - -/* `or' into one bitmap the `and' of a second bitmap witih the complement - of a third. */ -extern void bitmap_ior_and_compl PROTO((bitmap, bitmap, bitmap)); - -/* Clear a single register in a register set. */ -extern void bitmap_clear_bit PROTO((bitmap, int)); - -/* Set a single register in a register set. */ -extern void bitmap_set_bit PROTO((bitmap, int)); - -/* Return true if a register is set in a register set. */ -extern int bitmap_bit_p PROTO((bitmap, int)); - -/* Debug functions to print a bitmap linked list. */ -extern void bitmap_debug PROTO((bitmap)); -extern void bitmap_debug_file PROTO((FILE *, bitmap)); - -/* Print a bitmap */ -extern void bitmap_print PROTO((FILE *, bitmap, const char *, const char *)); - -/* Initialize a bitmap header. */ -extern bitmap bitmap_initialize PROTO((bitmap)); - -/* Release all memory held by bitmaps. */ -extern void bitmap_release_memory PROTO((void)); - -extern void debug_bitmap PROTO((bitmap)); - -/* Allocate a bitmap with oballoc. */ -#define BITMAP_OBSTACK_ALLOC(OBSTACK) \ - bitmap_initialize ((bitmap) obstack_alloc (OBSTACK, sizeof (bitmap_head))) - -/* Allocate a bitmap with alloca. */ -#define BITMAP_ALLOCA() \ - bitmap_initialize ((bitmap) alloca (sizeof (bitmap_head))) - -/* Do any cleanup needed on a bitmap when it is no longer used. */ -#define BITMAP_FREE(BITMAP) \ -do { \ - if (BITMAP) \ - { \ - bitmap_clear (BITMAP); \ - (BITMAP) = 0; \ - } \ -} while (0) - -/* Do any one-time initializations needed for bitmaps. */ -#define BITMAP_INIT_ONCE() - -/* Loop over all bits in BITMAP, starting with MIN, setting BITNUM to the - bit number and executing CODE for all bits that are set. */ - -#define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, CODE) \ -do { \ - bitmap_element *ptr_ = (BITMAP)->first; \ - unsigned int indx_ = (MIN) / BITMAP_ELEMENT_ALL_BITS; \ - unsigned bit_num_ = (MIN) % ((unsigned) HOST_BITS_PER_WIDE_INT); \ - unsigned word_num_ = (((MIN) / ((unsigned) HOST_BITS_PER_WIDE_INT)) \ - % BITMAP_ELEMENT_WORDS); \ - \ - \ - /* Find the block the minimum bit is in. */ \ - while (ptr_ != 0 && ptr_->indx < indx_) \ - ptr_ = ptr_->next; \ - \ - if (ptr_ != 0 && ptr_->indx != indx_) \ - { \ - bit_num_ = 0; \ - word_num_ = 0; \ - } \ - \ - for (; ptr_ != 0; ptr_ = ptr_->next) \ - { \ - for (; word_num_ < BITMAP_ELEMENT_WORDS; word_num_++) \ - { \ - unsigned HOST_WIDE_INT word_ = ptr_->bits[word_num_]; \ - \ - if (word_ != 0) \ - { \ - for (; bit_num_ < HOST_BITS_PER_WIDE_INT; bit_num_++) \ - { \ - unsigned HOST_WIDE_INT mask_ \ - = ((unsigned HOST_WIDE_INT) 1) << bit_num_; \ - \ - if ((word_ & mask_) != 0) \ - { \ - word_ &= ~ mask_; \ - (BITNUM) = (ptr_->indx * BITMAP_ELEMENT_ALL_BITS \ - + word_num_ * HOST_BITS_PER_WIDE_INT \ - + bit_num_); \ - CODE; \ - \ - if (word_ == 0) \ - break; \ - } \ - } \ - } \ - \ - bit_num_ = 0; \ - } \ - \ - word_num_ = 0; \ - } \ -} while (0) - -/* Loop over all bits in BITMAP1 and BITMAP2, starting with MIN, setting - BITNUM to the bit number and executing CODE for all bits that are set in - the first bitmap and not set in the second. */ - -#define EXECUTE_IF_AND_COMPL_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, CODE) \ -do { \ - bitmap_element *ptr1_ = (BITMAP1)->first; \ - bitmap_element *ptr2_ = (BITMAP2)->first; \ - unsigned int indx_ = (MIN) / BITMAP_ELEMENT_ALL_BITS; \ - unsigned bit_num_ = (MIN) % ((unsigned) HOST_BITS_PER_WIDE_INT); \ - unsigned word_num_ = (((MIN) / ((unsigned) HOST_BITS_PER_WIDE_INT)) \ - % BITMAP_ELEMENT_WORDS); \ - \ - /* Find the block the minimum bit is in in the first bitmap. */ \ - while (ptr1_ != 0 && ptr1_->indx < indx_) \ - ptr1_ = ptr1_->next; \ - \ - if (ptr1_ != 0 && ptr1_->indx != indx_) \ - { \ - bit_num_ = 0; \ - word_num_ = 0; \ - } \ - \ - for (; ptr1_ != 0 ; ptr1_ = ptr1_->next) \ - { \ - /* Advance BITMAP2 to the equivalent link, using an all \ - zero element if an equivalent link doesn't exist. */ \ - bitmap_element *tmp2_; \ - \ - while (ptr2_ != 0 && ptr2_->indx < ptr1_->indx) \ - ptr2_ = ptr2_->next; \ - \ - tmp2_ = ((ptr2_ != 0 && ptr2_->indx == ptr1_->indx) \ - ? ptr2_ : &bitmap_zero); \ - \ - for (; word_num_ < BITMAP_ELEMENT_WORDS; word_num_++) \ - { \ - unsigned HOST_WIDE_INT word_ = (ptr1_->bits[word_num_] \ - & ~ tmp2_->bits[word_num_]); \ - if (word_ != 0) \ - { \ - for (; bit_num_ < HOST_BITS_PER_WIDE_INT; bit_num_++) \ - { \ - unsigned HOST_WIDE_INT mask_ \ - = ((unsigned HOST_WIDE_INT)1) << bit_num_; \ - \ - if ((word_ & mask_) != 0) \ - { \ - word_ &= ~ mask_; \ - (BITNUM) = (ptr1_->indx * BITMAP_ELEMENT_ALL_BITS \ - + word_num_ * HOST_BITS_PER_WIDE_INT \ - + bit_num_); \ - \ - CODE; \ - if (word_ == 0) \ - break; \ - } \ - } \ - } \ - \ - bit_num_ = 0; \ - } \ - \ - word_num_ = 0; \ - } \ -} while (0) - -/* Loop over all bits in BITMAP1 and BITMAP2, starting with MIN, setting - BITNUM to the bit number and executing CODE for all bits that are set in - the both bitmaps. */ - -#define EXECUTE_IF_AND_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, CODE) \ -do { \ - bitmap_element *ptr1_ = (BITMAP1)->first; \ - bitmap_element *ptr2_ = (BITMAP2)->first; \ - unsigned int indx_ = (MIN) / BITMAP_ELEMENT_ALL_BITS; \ - unsigned bit_num_ = (MIN) % ((unsigned) HOST_BITS_PER_WIDE_INT); \ - unsigned word_num_ = (((MIN) / ((unsigned) HOST_BITS_PER_WIDE_INT)) \ - % BITMAP_ELEMENT_WORDS); \ - \ - /* Find the block the minimum bit is in in the first bitmap. */ \ - while (ptr1_ != 0 && ptr1_->indx < indx_) \ - ptr1_ = ptr1_->next; \ - \ - if (ptr1_ != 0 && ptr1_->indx != indx_) \ - { \ - bit_num_ = 0; \ - word_num_ = 0; \ - } \ - \ - for (; ptr1_ != 0 ; ptr1_ = ptr1_->next) \ - { \ - /* Advance BITMAP2 to the equivalent link */ \ - while (ptr2_ != 0 && ptr2_->indx < ptr1_->indx) \ - ptr2_ = ptr2_->next; \ - \ - if (ptr2_ == 0) \ - { \ - /* If there are no more elements in BITMAP2, exit loop now.*/ \ - ptr1_ = (bitmap_element *)0; \ - break; \ - } \ - else if (ptr2_->indx > ptr1_->indx) \ - { \ - bit_num_ = word_num_ = 0; \ - continue; \ - } \ - \ - for (; word_num_ < BITMAP_ELEMENT_WORDS; word_num_++) \ - { \ - unsigned HOST_WIDE_INT word_ = (ptr1_->bits[word_num_] \ - & ptr2_->bits[word_num_]); \ - if (word_ != 0) \ - { \ - for (; bit_num_ < HOST_BITS_PER_WIDE_INT; bit_num_++) \ - { \ - unsigned HOST_WIDE_INT mask_ \ - = ((unsigned HOST_WIDE_INT)1) << bit_num_; \ - \ - if ((word_ & mask_) != 0) \ - { \ - word_ &= ~ mask_; \ - (BITNUM) = (ptr1_->indx * BITMAP_ELEMENT_ALL_BITS \ - + word_num_ * HOST_BITS_PER_WIDE_INT \ - + bit_num_); \ - \ - CODE; \ - if (word_ == 0) \ - break; \ - } \ - } \ - } \ - \ - bit_num_ = 0; \ - } \ - \ - word_num_ = 0; \ - } \ -} while (0) diff --git a/contrib/gcc/build-make b/contrib/gcc/build-make deleted file mode 100644 index f9049ae0db96..000000000000 --- a/contrib/gcc/build-make +++ /dev/null @@ -1,35 +0,0 @@ -# We have to use the cross-compiler we just built to compile it. -CC = gcc -b $(host) - -# Need those to compile binaries running on host machine. -# It is configured by -# -# configure --host=target_cpu-target_os \ -# --target=host=target_cpu-target_os --build=host_cpu-host_os -# -# That HOST stuff has to be taken care of very carefully. -HOST_PREFIX=l- -HOST_PREFIX_1=$(HOST_PREFIX) -HOST_CC=$(CC) -b $(build) -HOST_CFLAGS=$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) -HOST_CLIB= -HOST_LDFLAGS=$(LDFLAGS) -HOST_CPPFLAGS=$(ALL_CPPFLAGS) -HOST_ALLOCA=$(ALLOCA) -HOST_MALLOC=$(MALLOC) -HOST_OBSTACK=$(OBSTACK) - -# To build the native compiler with the cross compiler, the headers -# for the target are already fixed. And /usr/include is for host, not -# target. -FIXINCLUDES=Makefile.in - -# Don't run fixproto either -STMP_FIXPROTO = - -# Cause installation using install-build. We do nothing here. -#INSTALL_TARGET = install-build - -# Don't try to compile the things we can't compile or we have made -# while making gcc with the cross-compiler. -#ALL = all.build diff --git a/contrib/gcc/bytecode.def b/contrib/gcc/bytecode.def deleted file mode 100644 index 5b24df70ed67..000000000000 --- a/contrib/gcc/bytecode.def +++ /dev/null @@ -1,322 +0,0 @@ -# -*- C -*- -# bytecode.def - definitions of bytecodes for the stack machine. - -# The production of the bytecode interpreter and compiler is -# heavily automated by using this file creatively. - -# Various elementary data types are understood by the bytecode interpreter. -# Q[IU] - quarter word (byte) signed and unsigned integers (char). -# H[IU] - half word signed and unsigned integers (short int, maybe int). -# S[IU] - single word signed and unsigned integers (maybe int, long int). -# D[IU] - double word signed and unsigned integers (long long int). -# SF - single precision floating point (float). -# DF - double precision floating point (double). -# XF - extended precision floating point (long double). -# P - pointer type for address arithmetic and other purposes. - -# The bytecode specification consists of a series of define_operator -# forms, that are parsed by preprocessors to automatically build -# various switch statements. -# define_operator(name, -# , -# ) -# The is self explanatory. -# The consists of a (parenthesized list) of -# variation items, each of which is in itself a list. A variation -# item consists of a name suffix, the types of the input arguments -# expected on the stack (shallowest item first) and (optionally) the -# types of the output arguments (similarly ordered). Finally, the -# types of the literal arguments (if any) may appear. - -# Substitution in the C prototype code is as follows: -# Substitution happens only after a dollar sign. To get a literal -# dollar sign (why would you ever want one anyway?) use $$. -# $R1 means "result 1" $TR1 means "type name of result one" -# $S1 means "source 1" and similarly with $TS1. -# $L1 means "literal (inline) argument 1" and $TL1 means type thereof. -# - -# Notice that the number following $R doesn't affect the push order; -# it's used only for clarity and orthogonality, although it's checked -# to make sure it doesn't exceed the number of outputs. A $R reference -# results in a push, and represents the result lvalue. E.g. - -# $R1 = 2\, $R2 = 17 -# will expand to: -# INTERP_PUSH($TR1) = 2, INTERP_PUSH($TR2) = 17 -# - -# Opcode 0 should never happen. -define_operator(neverneverland, abort\(\), (())) - -# Stack manipulations. -define_operator(drop, 0, ((, (SI)))) -define_operator(duplicate, 0, ((, (SI), (SI, SI)))) -define_operator(over, 0, ((, (SI), (SI, SI)))) - -# Adjust stack pointer - -define_operator(setstack, 0, ((SI,,,(SI)))) -define_operator(adjstack, 0, ((SI,,,(SI)))) - -# Constants, loads, and stores. -define_operator(const, - $R1 = $L1, - ((QI,, (QI), (QI)), (HI,, (HI), (HI)), - (SI,, (SI), (SI)), (DI,, (DI), (DI)), - (SF,, (SF), (SF)), (DF,, (DF), (DF)), - (XF,, (XF), (XF)), (P,, (P), (P)))) -define_operator(load, - $R1 = *\($TR1 *\) $S1, - ((QI, (P), (QI)), (HI, (P), (HI)), - (SI, (P), (SI)), (DI, (P), (DI)), - (SF, (P), (SF)), (DF, (P), (DF)), - (XF, (P), (XF)), (P, (P), (P)))) -define_operator(store, - *\($TS2 *\) $S1 = $S2, - ((QI, (P, QI)), (HI, (P, HI)), - (SI, (P, SI)), (DI, (P, DI)), - (SF, (P, SF)), (DF, (P, DF)), - (XF, (P, XF)), (P, (P, P)), - (BLK, (SI, BLK, BLK)))) - -# Clear memory block - -define_operator(clear, $S1 + $S2, ((BLK, (SI, BLK)))) - - -# Advance pointer by SI constant - -define_operator(addconst, $R1 = $S1, ((PSI, (P), (P), (SI)))) - - -# newlocalSI is used for creating variable-sized storage during function -# initialization. - -# Create local space, return pointer to block - -define_operator(newlocal, $R1 = $S1, ((SI, (SI), (P)))) - - -# Push the address of a local variable. -define_operator(local, $R1 = locals + $L1, ((P,, (P), (SI)))) - -# Push the address of an argument variable. -define_operator(arg, $R1 = args + $L1, ((P,, (P), (SI)))) - -# Arithmetic conversions. -define_operator(convert, - $R1 = \($TR1\) $S1, - (# Signed integral promotions (sign extensions). - (QIHI, (QI), (HI)), (HISI, (HI), (SI)), (SIDI, (SI), (DI)), - (QISI, (QI), (SI)), - # Unsigned integral promotions (zero extensions). - (QUHU, (QU), (HU)), (HUSU, (HU), (SU)), (SUDU, (SU), (DU)), - (QUSU, (QU), (SU)), - # Floating promotions. - (SFDF, (SF), (DF)), (DFXF, (DF), (XF)), - # Integral truncation. - (HIQI, (HI), (QI)), (SIHI, (SI), (HI)), (DISI, (DI), (SI)), - (SIQI, (SI), (QI)), - # Unsigned truncation. - (SUQU, (SU), (QU)), - # Floating truncation. - (DFSF, (DF), (SF)), (XFDF, (XF), (DF)), - # Integral conversions to floating types. - (SISF, (SI), (SF)), (SIDF, (SI), (DF)), (SIXF, (SI), (XF)), - (SUSF, (SU), (SF)), (SUDF, (SU), (DF)), (SUXF, (SU), (XF)), - (DISF, (DI), (SF)), (DIDF, (DI), (DF)), (DIXF, (DI), (XF)), - (DUSF, (DU), (SF)), (DUDF, (DU), (DF)), (DUXF, (DU), (XF)), - # Floating conversions to integral types. - (SFSI, (SF), (SI)), (DFSI, (DF), (SI)), (XFSI, (XF), (SI)), - (SFSU, (SF), (SU)), (DFSU, (DF), (SU)), (XFSU, (XF), (SU)), - (SFDI, (SF), (DI)), (DFDI, (DF), (DI)), (XFDI, (XF), (DI)), - (SFDU, (SF), (DU)), (DFDU, (DF), (DU)), (XFDU, (XF), (DU)), - # Pointer/integer conversions. - (PSI, (P), (SI)), (SIP, (SI), (P)))) - -# Truth value conversion. These are necessary because conversions of, e.g., -# floating types to integers may not function correctly for large values. -define_operator(convert, - $R1 = !!$S1, - ((SIT, (SI), (T)), (DIT, (DI), (T)), - (SFT, (SF), (T)), (DFT, (DF), (T)), - (XFT, (XF), (T)), (PT, (P), (T)))) - -# Bit field load/store. - -# Load and zero-extend bitfield - -define_operator(zxload, $R1 = $S1, ((BI, (SU, SU, P), (SU)))) - -# Load and sign-extend bitfield - -define_operator(sxload, $R1 = $S1, ((BI, (SU, SU, P), (SI)))) - -# Store integer in bitfield - -define_operator(sstore, $R1 = $S1, ((BI, (SU, SU, P, SI)))) - - -# Binary operations. -define_operator(add, - $R1 = $S1 + $S2, - ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)), - (SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)), - (XF, (XF, XF), (XF)), - (PSI, (P, SI), (P)))) -define_operator(sub, - $R1 = $S1 - $S2, - ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)), - (SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)), - (XF, (XF, XF), (XF)), - (PP, (P, P), (SI)))) -define_operator(mul, - $R1 = $S1 * $S2, - ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)), - (SU, (SU, SU), (SU)), (DU, (DU, DU), (DU)), - (SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)), - (XF, (XF, XF), (XF)))) -define_operator(div, - $R1 = $S1 / $S2, - ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)), - (SU, (SU, SU), (SU)), (DU, (DU, DU), (DU)), - (SF, (SF, SF), (SF)), (DF, (DF, DF), (DF)), - (XF, (XF, XF), (XF)))) -define_operator(mod, - $R1 = $S1 % $S2, - ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)), - (SU, (SU, SU), (SU)), (DU, (DU, DU), (DU)))) -define_operator(and, - $R1 = $S1 & $S2, - ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)))) -define_operator(ior, - $R1 = $S1 | $S2, - ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)))) -define_operator(xor, - $R1 = $S1 ^ $S2, - ((SI, (SI, SI), (SI)), (DI, (DI, DI), (DI)))) -define_operator(lshift, - $R1 = $S1 << $S2, - ((SI, (SI, SI), (SI)), (SU, (SU, SI), (SU)), - (DI, (DI, SI), (DI)), (DU, (DU, SI), (DU)))) -define_operator(rshift, - $R1 = $S1 >> $S2, - ((SI, (SI, SI), (SI)), (SU, (SU, SI), (SU)), - (DI, (DI, SI), (DI)), (DU, (DU, SI), (DU)))) -define_operator(lt, - $R1 = $S1 < $S2, - ((SI, (SI, SI), (T)), (SU, (SU, SU), (T)), - (DI, (DI, DI), (T)), (DU, (DU, DU), (T)), - (SF, (SF, SF), (T)), (DF, (DF, DF), (T)), - (XF, (XF, XF), (T)), (P, (P, P), (T)))) -define_operator(le, - $R1 = $S1 <= $S2, - ((SI, (SI, SI), (T)), (SU, (SU, SU), (T)), - (DI, (DI, DI), (T)), (DU, (DU, DU), (T)), - (SF, (SF, SF), (T)), (DF, (DF, DF), (T)), - (XF, (XF, XF), (T)), (P, (P, P), (T)))) -define_operator(ge, - $R1 = $S1 >= $S2, - ((SI, (SI, SI), (T)), (SU, (SU, SU), (T)), - (DI, (DI, DI), (T)), (DU, (DU, DU), (T)), - (SF, (SF, SF), (T)), (DF, (DF, DF), (T)), - (XF, (XF, XF), (T)), (P, (P, P), (T)))) -define_operator(gt, - $R1 = $S1 > $S2, - ((SI, (SI, SI), (T)), (SU, (SU, SU), (T)), - (DI, (DI, DI), (T)), (DU, (DU, DU), (T)), - (SF, (SF, SF), (T)), (DF, (DF, DF), (T)), - (XF, (XF, XF), (T)), (P, (P, P), (T)))) -define_operator(eq, - $R1 = $S1 == $S2, - ((SI, (SI, SI), (T)), (DI, (DI, DI), (T)), - (SF, (SF, SF), (T)), (DF, (DF, DF), (T)), - (XF, (XF, XF), (T)), (P, (P, P), (T)))) -define_operator(ne, - $R1 = $S1 != $S2, - ((SI, (SI, SI), (T)), (DI, (DI, DI), (T)), - (SF, (SF, SF), (T)), (DF, (DF, DF), (T)), - (XF, (XF, XF), (T)), (P, (P, P), (T)))) - -# Unary operations. -define_operator(neg, - $R1 = -$S1, - ((SI, (SI), (SI)), (DI, (DI), (DI)), - (SF, (SF), (SF)), (DF, (DF), (DF)), - (XF, (XF), (XF)))) -define_operator(not, - $R1 = ~$S1, - ((SI, (SI), (SI)), (DI, (DI), (DI)))) -define_operator(not, - $R1 = !$S1, - ((T, (SI), (SI)))) - -# Increment operations. -define_operator(predec, - $R1 = *\($TR1 *\) $S1 -= $S2, - ((QI, (P, QI), (QI)), (HI, (P, HI), (HI)), - (SI, (P, SI), (SI)), (DI, (P, DI), (DI)), - (P, (P, SI), (P)), (SF, (P, SF), (SF)), - (DF, (P, DF), (DF)), (XF, (P, XF), (XF)), - (BI, (SU, SU, P, SI), (SI)))) - -define_operator(preinc, - $R1 = *\($TR1 *\) $S1 += $S2, - ((QI, (P, QI), (QI)), (HI, (P, HI), (HI)), - (SI, (P, SI), (SI)), (DI, (P, DI), (DI)), - (P, (P, SI), (P)), (SF, (P, SF), (SF)), - (DF, (P, DF), (DF)), (XF, (P, XF), (XF)), - (BI, (SU, SU, P, SI), (SI)))) - -define_operator(postdec, - $R1 = *\($TR1 *\) $S1\, *\($TR1 *\) $S1 -= $S2, - ((QI, (P, QI), (QI)), (HI, (P, HI), (HI)), - (SI, (P, SI), (SI)), (DI, (P, DI), (DI)), - (P, (P, SI), (P)), (SF, (P, SF), (SF)), - (DF, (P, DF), (DF)), (XF, (P, XF), (XF)), - (BI, (SU, SU, P, SI), (SI)))) - -define_operator(postinc, - $R1 = *\($TR1 *\) $S1\, *\($TR1 *\) $S1 += $S2, - ((QI, (P, QI), (QI)), (HI, (P, HI), (HI)), - (SI, (P, SI), (SI)), (DI, (P, DI), (DI)), - (P, (P, SI), (P)), (SF, (P, SF), (SF)), - (DF, (P, DF), (DF)), (XF, (P, XF), (XF)), - (BI, (SU, SU, P, SI), (SI)))) - -# Jumps. -define_operator(xjumpif, if \($S1\) pc = code->pc0 + $L1, ((, (T),, (SI)))) -define_operator(xjumpifnot, if \(! $S1\) pc = code->pc0 + $L1, ((, (T),, (SI)))) -define_operator(jump, pc = code->pc0 + $L1, ((,,,(SI)))) - -# This is for GCC2. It jumps to the address on the stack. -define_operator(jump, pc = \(void *\) $S1, ((P,,))) - -# Switches. In order to (eventually) support ranges we provide four different -# varieties of switches. Arguments are the switch index from the stack, the -# bytecode offset of the switch table, the size of the switch table, and -# the default label. -define_operator(caseSI, CASESI\($S1\, $L1\, $L2\, $L3\), ((, (SI),, (SI, SI, SI)))) -define_operator(caseSU, CASESU\($S1\, $L1\, $L2\, $L3\), ((, (SU),, (SI, SI, SI)))) -define_operator(caseDI, CASEDI\($S1\, $L1\, $L2\, $L3\), ((, (DI),, (SI, SI, SI)))) -define_operator(caseDU, CASEDU\($S1\, $L1\, $L2\, $L3\), ((, (DU),, (SI, SI, SI)))) - -# Procedure call. -# Stack arguments are (deepest first): -# procedure arguments in reverse order. -# pointer to the place to hold the return value. -# address of the call description vector. -# pointer to the procedure to be called. -define_operator(call, CALL\($S1\, $S2\, $S3\, sp\), ((, (P, P, P)))) - -# Procedure return. -# Pushes on interpreter stack: -# value of retptr (pointer to return value storage slot) -define_operator(return, $R1 = retptr, ((P,,(P)))) - -# Really return. -define_operator(ret, return, (())) - -# Print an obnoxious line number. -define_operator(linenote, fprintf\(stderr\, "%d\\n"\, $L1\), ((,,,(SI)))) diff --git a/contrib/gcc/bytecode.h b/contrib/gcc/bytecode.h deleted file mode 100644 index f2233aa880d3..000000000000 --- a/contrib/gcc/bytecode.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Bytecode definitions for GNU C-compiler. - Copyright (C) 1993, 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -extern int output_bytecode; -extern int stack_depth; -extern int max_stack_depth; - -/* Emit DI constant according to target machine word ordering */ - -#define bc_emit_bytecode_DI_const(CST) \ -{ int opcode; \ - opcode = (WORDS_BIG_ENDIAN \ - ? TREE_INT_CST_HIGH (CST) \ - : TREE_INT_CST_LOW (CST)); \ - bc_emit_bytecode_const ((char *) &opcode, sizeof opcode); \ - opcode = (WORDS_BIG_ENDIAN \ - ? TREE_INT_CST_LOW (CST) \ - : TREE_INT_CST_HIGH (CST)); \ - bc_emit_bytecode_const ((char *) &opcode, sizeof opcode); \ -} - -extern void bc_expand_expr (); -extern void bc_output_data_constructor (); -extern void bc_store_field (); -extern void bc_load_bit_field (); -extern void bc_store_bit_field (); -extern void bc_push_offset_and_size (); -extern void bc_init_mode_to_code_map (); - -/* These are just stubs, so the compiler will compile for targets - that aren't yet supported by the bytecode generator. */ - -#ifndef TARGET_SUPPORTS_BYTECODE - -#define MACHINE_SEG_ALIGN 1 -#define INT_ALIGN 1 -#define PTR_ALIGN 1 -#define NAMES_HAVE_UNDERSCORES -#define BC_NOP (0) -#define BC_GLOBALIZE_LABEL(FP, NAME) BC_NOP -#define BC_OUTPUT_COMMON(FP, NAME, SIZE, ROUNDED) BC_NOP -#define BC_OUTPUT_LOCAL(FP, NAME, SIZE, ROUNDED) BC_NOP -#define BC_OUTPUT_ALIGN(FP, ALIGN) BC_NOP -#define BC_OUTPUT_LABEL(FP, NAME) BC_NOP -#define BC_OUTPUT_SKIP(FP, SIZE) BC_NOP -#define BC_OUTPUT_LABELREF(FP, NAME) BC_NOP -#define BC_OUTPUT_FLOAT(FP, VAL) BC_NOP -#define BC_OUTPUT_DOUBLE(FP, VAL) BC_NOP -#define BC_OUTPUT_BYTE(FP, VAL) BC_NOP -#define BC_OUTPUT_FILE ASM_OUTPUT_FILE -#define BC_OUTPUT_ASCII ASM_OUTPUT_ASCII -#define BC_OUTPUT_IDENT ASM_OUTPUT_IDENT -#define BCXSTR(RTX) ((RTX)->bc_label) -#define BC_WRITE_FILE(FP) BC_NOP -#define BC_WRITE_SEGSYM(SEGSYM, FP) BC_NOP -#define BC_WRITE_RELOC_ENTRY(SEGRELOC, FP, OFFSET) BC_NOP -#define BC_START_BYTECODE_LINE(FP) BC_NOP -#define BC_WRITE_BYTECODE(SEP, VAL, FP) BC_NOP -#define BC_WRITE_RTL(R, FP) BC_NOP -#define BC_EMIT_TRAMPOLINE(TRAMPSEG, CALLINFO) BC_NOP -#define VALIDATE_STACK BC_NOP - -#endif /* !TARGET_SUPPORTS_BYTECODE */ diff --git a/contrib/gcc/bytetypes.h b/contrib/gcc/bytetypes.h deleted file mode 100644 index f91566900c66..000000000000 --- a/contrib/gcc/bytetypes.h +++ /dev/null @@ -1,35 +0,0 @@ -/* These should come from genemit */ - -/* Use __signed__ in case compiling with -traditional. */ - -typedef __signed__ char QItype; -typedef unsigned char QUtype; -typedef __signed__ short int HItype; -typedef unsigned short int HUtype; -typedef __signed__ long int SItype; -typedef unsigned long int SUtype; -typedef __signed__ long long int DItype; -typedef unsigned long long int DUtype; -typedef float SFtype; -typedef double DFtype; -typedef long double XFtype; -typedef char *Ptype; -typedef int Ttype; - - -typedef union stacktype -{ - QItype QIval; - QUtype QUval; - HItype HIval; - HUtype HUval; - SItype SIval; - SUtype SUval; - DItype DIval; - DUtype DUval; - SFtype SFval; - DFtype DFval; - XFtype XFval; - Ptype Pval; - Ttype Tval; -} stacktype; diff --git a/contrib/gcc/c-aux-info.c b/contrib/gcc/c-aux-info.c deleted file mode 100644 index 9a66350cf8c8..000000000000 --- a/contrib/gcc/c-aux-info.c +++ /dev/null @@ -1,665 +0,0 @@ -/* Generate information regarding function declarations and definitions based - on information stored in GCC's tree structure. This code implements the - -aux-info option. - Copyright (C) 1989, 91, 94, 95, 97-98, 1999 Free Software Foundation, Inc. - Contributed by Ron Guilmette (rfg@segfault.us.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "toplev.h" -#include "flags.h" -#include "tree.h" -#include "c-tree.h" - -enum formals_style_enum { - ansi, - k_and_r_names, - k_and_r_decls -}; -typedef enum formals_style_enum formals_style; - - -static const char *data_type; - -static char *affix_data_type PROTO((const char *)); -static const char *gen_formal_list_for_type PROTO((tree, formals_style)); -static int deserves_ellipsis PROTO((tree)); -static const char *gen_formal_list_for_func_def PROTO((tree, formals_style)); -static const char *gen_type PROTO((const char *, tree, formals_style)); -static const char *gen_decl PROTO((tree, int, formals_style)); - -/* Concatenate a sequence of strings, returning the result. - - This function is based on the one in libiberty. */ - -/* This definition will conflict with the one from prefix.c in - libcpp.a when linking cc1 and cc1obj. So only provide it if we are - not using libcpp.a */ -#ifndef USE_CPPLIB -char * -concat VPROTO((const char *first, ...)) -{ - register int length; - register char *newstr; - register char *end; - register const char *arg; - va_list args; -#ifndef ANSI_PROTOTYPES - const char *first; -#endif - - /* First compute the size of the result and get sufficient memory. */ - - VA_START (args, first); -#ifndef ANSI_PROTOTYPES - first = va_arg (args, const char *); -#endif - - arg = first; - length = 0; - - while (arg != 0) - { - length += strlen (arg); - arg = va_arg (args, const char *); - } - - newstr = (char *) malloc (length + 1); - va_end (args); - - /* Now copy the individual pieces to the result string. */ - - VA_START (args, first); -#ifndef ANSI_PROTOTYPES - first = va_arg (args, char *); -#endif - - end = newstr; - arg = first; - while (arg != 0) - { - while (*arg) - *end++ = *arg++; - arg = va_arg (args, const char *); - } - *end = '\000'; - va_end (args); - - return (newstr); -} -#endif /* ! USE_CPPLIB */ - -/* Given a string representing an entire type or an entire declaration - which only lacks the actual "data-type" specifier (at its left end), - affix the data-type specifier to the left end of the given type - specification or object declaration. - - Because of C language weirdness, the data-type specifier (which normally - goes in at the very left end) may have to be slipped in just to the - right of any leading "const" or "volatile" qualifiers (there may be more - than one). Actually this may not be strictly necessary because it seems - that GCC (at least) accepts ` const foo;' and treats it the - same as `const foo;' but people are accustomed to seeing - `const char *foo;' and *not* `char const *foo;' so we try to create types - that look as expected. */ - -static char * -affix_data_type (param) - const char *param; -{ - char *type_or_decl = (char *) alloca (strlen (param) + 1); - char *p = type_or_decl; - char *qualifiers_then_data_type; - char saved; - - strcpy (type_or_decl, param); - - /* Skip as many leading const's or volatile's as there are. */ - - for (;;) - { - if (!strncmp (p, "volatile ", 9)) - { - p += 9; - continue; - } - if (!strncmp (p, "const ", 6)) - { - p += 6; - continue; - } - break; - } - - /* p now points to the place where we can insert the data type. We have to - add a blank after the data-type of course. */ - - if (p == type_or_decl) - return concat (data_type, " ", type_or_decl, NULL_PTR); - - saved = *p; - *p = '\0'; - qualifiers_then_data_type = concat (type_or_decl, data_type, NULL_PTR); - *p = saved; - return concat (qualifiers_then_data_type, " ", p, NULL_PTR); -} - -/* Given a tree node which represents some "function type", generate the - source code version of a formal parameter list (of some given style) for - this function type. Return the whole formal parameter list (including - a pair of surrounding parens) as a string. Note that if the style - we are currently aiming for is non-ansi, then we just return a pair - of empty parens here. */ - -static const char * -gen_formal_list_for_type (fntype, style) - tree fntype; - formals_style style; -{ - const char *formal_list = ""; - tree formal_type; - - if (style != ansi) - return "()"; - - formal_type = TYPE_ARG_TYPES (fntype); - while (formal_type && TREE_VALUE (formal_type) != void_type_node) - { - const char *this_type; - - if (*formal_list) - formal_list = concat (formal_list, ", ", NULL_PTR); - - this_type = gen_type ("", TREE_VALUE (formal_type), ansi); - formal_list - = ((strlen (this_type)) - ? concat (formal_list, affix_data_type (this_type), NULL_PTR) - : concat (formal_list, data_type, NULL_PTR)); - - formal_type = TREE_CHAIN (formal_type); - } - - /* If we got to here, then we are trying to generate an ANSI style formal - parameters list. - - New style prototyped ANSI formal parameter lists should in theory always - contain some stuff between the opening and closing parens, even if it is - only "void". - - The brutal truth though is that there is lots of old K&R code out there - which contains declarations of "pointer-to-function" parameters and - these almost never have fully specified formal parameter lists associated - with them. That is, the pointer-to-function parameters are declared - with just empty parameter lists. - - In cases such as these, protoize should really insert *something* into - the vacant parameter lists, but what? It has no basis on which to insert - anything in particular. - - Here, we make life easy for protoize by trying to distinguish between - K&R empty parameter lists and new-style prototyped parameter lists - that actually contain "void". In the latter case we (obviously) want - to output the "void" verbatim, and that what we do. In the former case, - we do our best to give protoize something nice to insert. - - This "something nice" should be something that is still valid (when - re-compiled) but something that can clearly indicate to the user that - more typing information (for the parameter list) should be added (by - hand) at some convenient moment. - - The string chosen here is a comment with question marks in it. */ - - if (!*formal_list) - { - if (TYPE_ARG_TYPES (fntype)) - /* assert (TREE_VALUE (TYPE_ARG_TYPES (fntype)) == void_type_node); */ - formal_list = "void"; - else - formal_list = "/* ??? */"; - } - else - { - /* If there were at least some parameters, and if the formals-types-list - petered out to a NULL (i.e. without being terminated by a - void_type_node) then we need to tack on an ellipsis. */ - if (!formal_type) - formal_list = concat (formal_list, ", ...", NULL_PTR); - } - - return concat (" (", formal_list, ")", NULL_PTR); -} - -/* For the generation of an ANSI prototype for a function definition, we have - to look at the formal parameter list of the function's own "type" to - determine if the function's formal parameter list should end with an - ellipsis. Given a tree node, the following function will return non-zero - if the "function type" parameter list should end with an ellipsis. */ - -static int -deserves_ellipsis (fntype) - tree fntype; -{ - tree formal_type; - - formal_type = TYPE_ARG_TYPES (fntype); - while (formal_type && TREE_VALUE (formal_type) != void_type_node) - formal_type = TREE_CHAIN (formal_type); - - /* If there were at least some parameters, and if the formals-types-list - petered out to a NULL (i.e. without being terminated by a void_type_node) - then we need to tack on an ellipsis. */ - - return (!formal_type && TYPE_ARG_TYPES (fntype)); -} - -/* Generate a parameter list for a function definition (in some given style). - - Note that this routine has to be separate (and different) from the code that - generates the prototype parameter lists for function declarations, because - in the case of a function declaration, all we have to go on is a tree node - representing the function's own "function type". This can tell us the types - of all of the formal parameters for the function, but it cannot tell us the - actual *names* of each of the formal parameters. We need to output those - parameter names for each function definition. - - This routine gets a pointer to a tree node which represents the actual - declaration of the given function, and this DECL node has a list of formal - parameter (variable) declarations attached to it. These formal parameter - (variable) declaration nodes give us the actual names of the formal - parameters for the given function definition. - - This routine returns a string which is the source form for the entire - function formal parameter list. */ - -static const char * -gen_formal_list_for_func_def (fndecl, style) - tree fndecl; - formals_style style; -{ - const char *formal_list = ""; - tree formal_decl; - - formal_decl = DECL_ARGUMENTS (fndecl); - while (formal_decl) - { - const char *this_formal; - - if (*formal_list && ((style == ansi) || (style == k_and_r_names))) - formal_list = concat (formal_list, ", ", NULL_PTR); - this_formal = gen_decl (formal_decl, 0, style); - if (style == k_and_r_decls) - formal_list = concat (formal_list, this_formal, "; ", NULL_PTR); - else - formal_list = concat (formal_list, this_formal, NULL_PTR); - formal_decl = TREE_CHAIN (formal_decl); - } - if (style == ansi) - { - if (!DECL_ARGUMENTS (fndecl)) - formal_list = concat (formal_list, "void", NULL_PTR); - if (deserves_ellipsis (TREE_TYPE (fndecl))) - formal_list = concat (formal_list, ", ...", NULL_PTR); - } - if ((style == ansi) || (style == k_and_r_names)) - formal_list = concat (" (", formal_list, ")", NULL_PTR); - return formal_list; -} - -/* Generate a string which is the source code form for a given type (t). This - routine is ugly and complex because the C syntax for declarations is ugly - and complex. This routine is straightforward so long as *no* pointer types, - array types, or function types are involved. - - In the simple cases, this routine will return the (string) value which was - passed in as the "ret_val" argument. Usually, this starts out either as an - empty string, or as the name of the declared item (i.e. the formal function - parameter variable). - - This routine will also return with the global variable "data_type" set to - some string value which is the "basic" data-type of the given complete type. - This "data_type" string can be concatenated onto the front of the returned - string after this routine returns to its caller. - - In complicated cases involving pointer types, array types, or function - types, the C declaration syntax requires an "inside out" approach, i.e. if - you have a type which is a "pointer-to-function" type, you need to handle - the "pointer" part first, but it also has to be "innermost" (relative to - the declaration stuff for the "function" type). Thus, is this case, you - must prepend a "(*" and append a ")" to the name of the item (i.e. formal - variable). Then you must append and prepend the other info for the - "function type" part of the overall type. - - To handle the "innermost precedence" rules of complicated C declarators, we - do the following (in this routine). The input parameter called "ret_val" - is treated as a "seed". Each time gen_type is called (perhaps recursively) - some additional strings may be appended or prepended (or both) to the "seed" - string. If yet another (lower) level of the GCC tree exists for the given - type (as in the case of a pointer type, an array type, or a function type) - then the (wrapped) seed is passed to a (recursive) invocation of gen_type() - this recursive invocation may again "wrap" the (new) seed with yet more - declarator stuff, by appending, prepending (or both). By the time the - recursion bottoms out, the "seed value" at that point will have a value - which is (almost) the complete source version of the declarator (except - for the data_type info). Thus, this deepest "seed" value is simply passed - back up through all of the recursive calls until it is given (as the return - value) to the initial caller of the gen_type() routine. All that remains - to do at this point is for the initial caller to prepend the "data_type" - string onto the returned "seed". */ - -static const char * -gen_type (ret_val, t, style) - const char *ret_val; - tree t; - formals_style style; -{ - tree chain_p; - - /* If there is a typedef name for this type, use it. */ - if (TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL) - data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t))); - else - { - switch (TREE_CODE (t)) - { - case POINTER_TYPE: - if (TYPE_READONLY (t)) - ret_val = concat ("const ", ret_val, NULL_PTR); - if (TYPE_VOLATILE (t)) - ret_val = concat ("volatile ", ret_val, NULL_PTR); - - ret_val = concat ("*", ret_val, NULL_PTR); - - if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE) - ret_val = concat ("(", ret_val, ")", NULL_PTR); - - ret_val = gen_type (ret_val, TREE_TYPE (t), style); - - return ret_val; - - case ARRAY_TYPE: - if (TYPE_SIZE (t) == 0 || TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST) - ret_val = gen_type (concat (ret_val, "[]", NULL_PTR), - TREE_TYPE (t), style); - else if (int_size_in_bytes (t) == 0) - ret_val = gen_type (concat (ret_val, "[0]", NULL_PTR), - TREE_TYPE (t), style); - else - { - int size = (int_size_in_bytes (t) / int_size_in_bytes (TREE_TYPE (t))); - char buff[10]; - sprintf (buff, "[%d]", size); - ret_val = gen_type (concat (ret_val, buff, NULL_PTR), - TREE_TYPE (t), style); - } - break; - - case FUNCTION_TYPE: - ret_val = gen_type (concat (ret_val, - gen_formal_list_for_type (t, style), - NULL_PTR), - TREE_TYPE (t), style); - break; - - case IDENTIFIER_NODE: - data_type = IDENTIFIER_POINTER (t); - break; - - /* The following three cases are complicated by the fact that a - user may do something really stupid, like creating a brand new - "anonymous" type specification in a formal argument list (or as - part of a function return type specification). For example: - - int f (enum { red, green, blue } color); - - In such cases, we have no name that we can put into the prototype - to represent the (anonymous) type. Thus, we have to generate the - whole darn type specification. Yuck! */ - - case RECORD_TYPE: - if (TYPE_NAME (t)) - data_type = IDENTIFIER_POINTER (TYPE_NAME (t)); - else - { - data_type = ""; - chain_p = TYPE_FIELDS (t); - while (chain_p) - { - data_type = concat (data_type, gen_decl (chain_p, 0, ansi), - NULL_PTR); - chain_p = TREE_CHAIN (chain_p); - data_type = concat (data_type, "; ", NULL_PTR); - } - data_type = concat ("{ ", data_type, "}", NULL_PTR); - } - data_type = concat ("struct ", data_type, NULL_PTR); - break; - - case UNION_TYPE: - if (TYPE_NAME (t)) - data_type = IDENTIFIER_POINTER (TYPE_NAME (t)); - else - { - data_type = ""; - chain_p = TYPE_FIELDS (t); - while (chain_p) - { - data_type = concat (data_type, gen_decl (chain_p, 0, ansi), - NULL_PTR); - chain_p = TREE_CHAIN (chain_p); - data_type = concat (data_type, "; ", NULL_PTR); - } - data_type = concat ("{ ", data_type, "}", NULL_PTR); - } - data_type = concat ("union ", data_type, NULL_PTR); - break; - - case ENUMERAL_TYPE: - if (TYPE_NAME (t)) - data_type = IDENTIFIER_POINTER (TYPE_NAME (t)); - else - { - data_type = ""; - chain_p = TYPE_VALUES (t); - while (chain_p) - { - data_type = concat (data_type, - IDENTIFIER_POINTER (TREE_PURPOSE (chain_p)), NULL_PTR); - chain_p = TREE_CHAIN (chain_p); - if (chain_p) - data_type = concat (data_type, ", ", NULL_PTR); - } - data_type = concat ("{ ", data_type, " }", NULL_PTR); - } - data_type = concat ("enum ", data_type, NULL_PTR); - break; - - case TYPE_DECL: - data_type = IDENTIFIER_POINTER (DECL_NAME (t)); - break; - - case INTEGER_TYPE: - data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t))); - /* Normally, `unsigned' is part of the deal. Not so if it comes - with a type qualifier. */ - if (TREE_UNSIGNED (t) && TYPE_QUALS (t)) - data_type = concat ("unsigned ", data_type, NULL_PTR); - break; - - case REAL_TYPE: - data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t))); - break; - - case VOID_TYPE: - data_type = "void"; - break; - - case ERROR_MARK: - data_type = "[ERROR]"; - break; - - default: - abort (); - } - } - if (TYPE_READONLY (t)) - ret_val = concat ("const ", ret_val, NULL_PTR); - if (TYPE_VOLATILE (t)) - ret_val = concat ("volatile ", ret_val, NULL_PTR); - if (TYPE_RESTRICT (t)) - ret_val = concat ("restrict ", ret_val, NULL_PTR); - return ret_val; -} - -/* Generate a string (source) representation of an entire entity declaration - (using some particular style for function types). - - The given entity may be either a variable or a function. - - If the "is_func_definition" parameter is non-zero, assume that the thing - we are generating a declaration for is a FUNCTION_DECL node which is - associated with a function definition. In this case, we can assume that - an attached list of DECL nodes for function formal arguments is present. */ - -static const char * -gen_decl (decl, is_func_definition, style) - tree decl; - int is_func_definition; - formals_style style; -{ - const char *ret_val; - - if (DECL_NAME (decl)) - ret_val = IDENTIFIER_POINTER (DECL_NAME (decl)); - else - ret_val = ""; - - /* If we are just generating a list of names of formal parameters, we can - simply return the formal parameter name (with no typing information - attached to it) now. */ - - if (style == k_and_r_names) - return ret_val; - - /* Note that for the declaration of some entity (either a function or a - data object, like for instance a parameter) if the entity itself was - declared as either const or volatile, then const and volatile properties - are associated with just the declaration of the entity, and *not* with - the `type' of the entity. Thus, for such declared entities, we have to - generate the qualifiers here. */ - - if (TREE_THIS_VOLATILE (decl)) - ret_val = concat ("volatile ", ret_val, NULL_PTR); - if (TREE_READONLY (decl)) - ret_val = concat ("const ", ret_val, NULL_PTR); - - data_type = ""; - - /* For FUNCTION_DECL nodes, there are two possible cases here. First, if - this FUNCTION_DECL node was generated from a function "definition", then - we will have a list of DECL_NODE's, one for each of the function's formal - parameters. In this case, we can print out not only the types of each - formal, but also each formal's name. In the second case, this - FUNCTION_DECL node came from an actual function declaration (and *not* - a definition). In this case, we do nothing here because the formal - argument type-list will be output later, when the "type" of the function - is added to the string we are building. Note that the ANSI-style formal - parameter list is considered to be a (suffix) part of the "type" of the - function. */ - - if (TREE_CODE (decl) == FUNCTION_DECL && is_func_definition) - { - ret_val = concat (ret_val, gen_formal_list_for_func_def (decl, ansi), - NULL_PTR); - - /* Since we have already added in the formals list stuff, here we don't - add the whole "type" of the function we are considering (which - would include its parameter-list info), rather, we only add in - the "type" of the "type" of the function, which is really just - the return-type of the function (and does not include the parameter - list info). */ - - ret_val = gen_type (ret_val, TREE_TYPE (TREE_TYPE (decl)), style); - } - else - ret_val = gen_type (ret_val, TREE_TYPE (decl), style); - - ret_val = affix_data_type (ret_val); - - if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl)) - ret_val = concat ("register ", ret_val, NULL_PTR); - if (TREE_PUBLIC (decl)) - ret_val = concat ("extern ", ret_val, NULL_PTR); - if (TREE_CODE (decl) == FUNCTION_DECL && !TREE_PUBLIC (decl)) - ret_val = concat ("static ", ret_val, NULL_PTR); - - return ret_val; -} - -extern FILE *aux_info_file; - -/* Generate and write a new line of info to the aux-info (.X) file. This - routine is called once for each function declaration, and once for each - function definition (even the implicit ones). */ - -void -gen_aux_info_record (fndecl, is_definition, is_implicit, is_prototyped) - tree fndecl; - int is_definition; - int is_implicit; - int is_prototyped; -{ - if (flag_gen_aux_info) - { - static int compiled_from_record = 0; - - /* Each output .X file must have a header line. Write one now if we - have not yet done so. */ - - if (! compiled_from_record++) - { - /* The first line tells which directory file names are relative to. - Currently, -aux-info works only for files in the working - directory, so just use a `.' as a placeholder for now. */ - fprintf (aux_info_file, "/* compiled from: . */\n"); - } - - /* Write the actual line of auxiliary info. */ - - fprintf (aux_info_file, "/* %s:%d:%c%c */ %s;", - DECL_SOURCE_FILE (fndecl), - DECL_SOURCE_LINE (fndecl), - (is_implicit) ? 'I' : (is_prototyped) ? 'N' : 'O', - (is_definition) ? 'F' : 'C', - gen_decl (fndecl, is_definition, ansi)); - - /* If this is an explicit function declaration, we need to also write - out an old-style (i.e. K&R) function header, just in case the user - wants to run unprotoize. */ - - if (is_definition) - { - fprintf (aux_info_file, " /*%s %s*/", - gen_formal_list_for_func_def (fndecl, k_and_r_names), - gen_formal_list_for_func_def (fndecl, k_and_r_decls)); - } - - fprintf (aux_info_file, "\n"); - } -} diff --git a/contrib/gcc/c-common.c b/contrib/gcc/c-common.c deleted file mode 100644 index 59dd407758de..000000000000 --- a/contrib/gcc/c-common.c +++ /dev/null @@ -1,3259 +0,0 @@ -/* Subroutines shared by all languages that are variants of C. - Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "c-lex.h" -#include "c-tree.h" -#include "flags.h" -#include "obstack.h" -#include "toplev.h" -#include "output.h" -#include "c-pragma.h" -#include "rtl.h" - -#if USE_CPPLIB -#include "cpplib.h" -cpp_reader parse_in; -cpp_options parse_options; -static enum cpp_token cpp_token; -#endif - -#ifndef WCHAR_TYPE_SIZE -#ifdef INT_TYPE_SIZE -#define WCHAR_TYPE_SIZE INT_TYPE_SIZE -#else -#define WCHAR_TYPE_SIZE BITS_PER_WORD -#endif -#endif - -extern struct obstack permanent_obstack; - -/* Nonzero means the expression being parsed will never be evaluated. - This is a count, since unevaluated expressions can nest. */ -int skip_evaluation; - -enum attrs {A_PACKED, A_NOCOMMON, A_COMMON, A_NORETURN, A_CONST, A_T_UNION, - A_NO_CHECK_MEMORY_USAGE, A_NO_INSTRUMENT_FUNCTION, - A_CONSTRUCTOR, A_DESTRUCTOR, A_MODE, A_SECTION, A_ALIGNED, - A_UNUSED, A_FORMAT, A_FORMAT_ARG, A_WEAK, A_ALIAS}; - -enum format_type { printf_format_type, scanf_format_type, - strftime_format_type }; - -static void declare_hidden_char_array PROTO((const char *, const char *)); -static void add_attribute PROTO((enum attrs, const char *, - int, int, int)); -static void init_attributes PROTO((void)); -static void record_function_format PROTO((tree, tree, enum format_type, - int, int)); -static void record_international_format PROTO((tree, tree, int)); -static tree c_find_base_decl PROTO((tree)); -static int default_valid_lang_attribute PROTO ((tree, tree, tree, tree)); - -/* Keep a stack of if statements. We record the number of compound - statements seen up to the if keyword, as well as the line number - and file of the if. If a potentially ambiguous else is seen, that - fact is recorded; the warning is issued when we can be sure that - the enclosing if statement does not have an else branch. */ -typedef struct -{ - int compstmt_count; - int line; - const char *file; - int needs_warning; -} if_elt; -static void tfaff PROTO((void)); - -static if_elt *if_stack; - -/* Amount of space in the if statement stack. */ -static int if_stack_space = 0; - -/* Stack pointer. */ -static int if_stack_pointer = 0; - -/* Generate RTL for the start of an if-then, and record the start of it - for ambiguous else detection. */ - -void -c_expand_start_cond (cond, exitflag, compstmt_count) - tree cond; - int exitflag; - int compstmt_count; -{ - /* Make sure there is enough space on the stack. */ - if (if_stack_space == 0) - { - if_stack_space = 10; - if_stack = (if_elt *)xmalloc (10 * sizeof (if_elt)); - } - else if (if_stack_space == if_stack_pointer) - { - if_stack_space += 10; - if_stack = (if_elt *)xrealloc (if_stack, if_stack_space * sizeof (if_elt)); - } - - /* Record this if statement. */ - if_stack[if_stack_pointer].compstmt_count = compstmt_count; - if_stack[if_stack_pointer].file = input_filename; - if_stack[if_stack_pointer].line = lineno; - if_stack[if_stack_pointer].needs_warning = 0; - if_stack_pointer++; - - expand_start_cond (cond, exitflag); -} - -/* Generate RTL for the end of an if-then. Optionally warn if a nested - if statement had an ambiguous else clause. */ - -void -c_expand_end_cond () -{ - if_stack_pointer--; - if (if_stack[if_stack_pointer].needs_warning) - warning_with_file_and_line (if_stack[if_stack_pointer].file, - if_stack[if_stack_pointer].line, - "suggest explicit braces to avoid ambiguous `else'"); - expand_end_cond (); -} - -/* Generate RTL between the then-clause and the else-clause - of an if-then-else. */ - -void -c_expand_start_else () -{ - /* An ambiguous else warning must be generated for the enclosing if - statement, unless we see an else branch for that one, too. */ - if (warn_parentheses - && if_stack_pointer > 1 - && (if_stack[if_stack_pointer - 1].compstmt_count - == if_stack[if_stack_pointer - 2].compstmt_count)) - if_stack[if_stack_pointer - 2].needs_warning = 1; - - /* Even if a nested if statement had an else branch, it can't be - ambiguous if this one also has an else. So don't warn in that - case. Also don't warn for any if statements nested in this else. */ - if_stack[if_stack_pointer - 1].needs_warning = 0; - if_stack[if_stack_pointer - 1].compstmt_count--; - - expand_start_else (); -} - -/* Make bindings for __FUNCTION__, __PRETTY_FUNCTION__, and __func__. */ - -void -declare_function_name () -{ - const char *name, *printable_name; - - if (current_function_decl == NULL) - { - name = ""; - printable_name = "top level"; - } - else - { - /* Allow functions to be nameless (such as artificial ones). */ - if (DECL_NAME (current_function_decl)) - name = IDENTIFIER_POINTER (DECL_NAME (current_function_decl)); - else - name = ""; - printable_name = (*decl_printable_name) (current_function_decl, 2); - } - - declare_hidden_char_array ("__FUNCTION__", name); - declare_hidden_char_array ("__PRETTY_FUNCTION__", printable_name); - /* The ISO C people "of course" couldn't use __FUNCTION__ in the - ISO C 9x standard; instead a new variable is invented. */ - declare_hidden_char_array ("__func__", name); -} - -static void -declare_hidden_char_array (name, value) - const char *name, *value; -{ - tree decl, type, init; - int vlen; - - /* If the default size of char arrays isn't big enough for the name, - or if we want to give warnings for large objects, make a bigger one. */ - vlen = strlen (value) + 1; - type = char_array_type_node; - if (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) < vlen - || warn_larger_than) - type = build_array_type (char_type_node, - build_index_type (build_int_2 (vlen, 0))); - push_obstacks_nochange (); - decl = build_decl (VAR_DECL, get_identifier (name), type); - TREE_STATIC (decl) = 1; - TREE_READONLY (decl) = 1; - TREE_ASM_WRITTEN (decl) = 1; - DECL_SOURCE_LINE (decl) = 0; - DECL_ARTIFICIAL (decl) = 1; - DECL_IN_SYSTEM_HEADER (decl) = 1; - DECL_IGNORED_P (decl) = 1; - init = build_string (vlen, value); - TREE_TYPE (init) = type; - DECL_INITIAL (decl) = init; - finish_decl (pushdecl (decl), init, NULL_TREE); -} - -/* Given a chain of STRING_CST nodes, - concatenate them into one STRING_CST - and give it a suitable array-of-chars data type. */ - -tree -combine_strings (strings) - tree strings; -{ - register tree value, t; - register int length = 1; - int wide_length = 0; - int wide_flag = 0; - int wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT; - int nchars; - - if (TREE_CHAIN (strings)) - { - /* More than one in the chain, so concatenate. */ - register char *p, *q; - - /* Don't include the \0 at the end of each substring, - except for the last one. - Count wide strings and ordinary strings separately. */ - for (t = strings; t; t = TREE_CHAIN (t)) - { - if (TREE_TYPE (t) == wchar_array_type_node) - { - wide_length += (TREE_STRING_LENGTH (t) - wchar_bytes); - wide_flag = 1; - } - else - length += (TREE_STRING_LENGTH (t) - 1); - } - - /* If anything is wide, the non-wides will be converted, - which makes them take more space. */ - if (wide_flag) - length = length * wchar_bytes + wide_length; - - p = savealloc (length); - - /* Copy the individual strings into the new combined string. - If the combined string is wide, convert the chars to ints - for any individual strings that are not wide. */ - - q = p; - for (t = strings; t; t = TREE_CHAIN (t)) - { - int len = (TREE_STRING_LENGTH (t) - - ((TREE_TYPE (t) == wchar_array_type_node) - ? wchar_bytes : 1)); - if ((TREE_TYPE (t) == wchar_array_type_node) == wide_flag) - { - memcpy (q, TREE_STRING_POINTER (t), len); - q += len; - } - else - { - int i; - for (i = 0; i < len; i++) - { - if (WCHAR_TYPE_SIZE == HOST_BITS_PER_SHORT) - ((short *) q)[i] = TREE_STRING_POINTER (t)[i]; - else - ((int *) q)[i] = TREE_STRING_POINTER (t)[i]; - } - q += len * wchar_bytes; - } - } - if (wide_flag) - { - int i; - for (i = 0; i < wchar_bytes; i++) - *q++ = 0; - } - else - *q = 0; - - value = make_node (STRING_CST); - TREE_STRING_POINTER (value) = p; - TREE_STRING_LENGTH (value) = length; - } - else - { - value = strings; - length = TREE_STRING_LENGTH (value); - if (TREE_TYPE (value) == wchar_array_type_node) - wide_flag = 1; - } - - /* Compute the number of elements, for the array type. */ - nchars = wide_flag ? length / wchar_bytes : length; - - /* Create the array type for the string constant. - -Wwrite-strings says make the string constant an array of const char - so that copying it to a non-const pointer will get a warning. - For C++, this is the standard behavior. */ - if (flag_const_strings - && (! flag_traditional && ! flag_writable_strings)) - { - tree elements - = build_type_variant (wide_flag ? wchar_type_node : char_type_node, - 1, 0); - TREE_TYPE (value) - = build_array_type (elements, - build_index_type (build_int_2 (nchars - 1, 0))); - } - else - TREE_TYPE (value) - = build_array_type (wide_flag ? wchar_type_node : char_type_node, - build_index_type (build_int_2 (nchars - 1, 0))); - - TREE_CONSTANT (value) = 1; - TREE_READONLY (value) = ! flag_writable_strings; - TREE_STATIC (value) = 1; - return value; -} - -/* To speed up processing of attributes, we maintain an array of - IDENTIFIER_NODES and the corresponding attribute types. */ - -/* Array to hold attribute information. */ - -static struct {enum attrs id; tree name; int min, max, decl_req;} attrtab[50]; - -static int attrtab_idx = 0; - -/* Add an entry to the attribute table above. */ - -static void -add_attribute (id, string, min_len, max_len, decl_req) - enum attrs id; - const char *string; - int min_len, max_len; - int decl_req; -{ - char buf[100]; - - attrtab[attrtab_idx].id = id; - attrtab[attrtab_idx].name = get_identifier (string); - attrtab[attrtab_idx].min = min_len; - attrtab[attrtab_idx].max = max_len; - attrtab[attrtab_idx++].decl_req = decl_req; - - sprintf (buf, "__%s__", string); - - attrtab[attrtab_idx].id = id; - attrtab[attrtab_idx].name = get_identifier (buf); - attrtab[attrtab_idx].min = min_len; - attrtab[attrtab_idx].max = max_len; - attrtab[attrtab_idx++].decl_req = decl_req; -} - -/* Initialize attribute table. */ - -static void -init_attributes () -{ - add_attribute (A_PACKED, "packed", 0, 0, 0); - add_attribute (A_NOCOMMON, "nocommon", 0, 0, 1); - add_attribute (A_COMMON, "common", 0, 0, 1); - add_attribute (A_NORETURN, "noreturn", 0, 0, 1); - add_attribute (A_NORETURN, "volatile", 0, 0, 1); - add_attribute (A_UNUSED, "unused", 0, 0, 0); - add_attribute (A_CONST, "const", 0, 0, 1); - add_attribute (A_T_UNION, "transparent_union", 0, 0, 0); - add_attribute (A_CONSTRUCTOR, "constructor", 0, 0, 1); - add_attribute (A_DESTRUCTOR, "destructor", 0, 0, 1); - add_attribute (A_MODE, "mode", 1, 1, 1); - add_attribute (A_SECTION, "section", 1, 1, 1); - add_attribute (A_ALIGNED, "aligned", 0, 1, 0); - add_attribute (A_FORMAT, "format", 3, 3, 1); - add_attribute (A_FORMAT_ARG, "format_arg", 1, 1, 1); - add_attribute (A_WEAK, "weak", 0, 0, 1); - add_attribute (A_ALIAS, "alias", 1, 1, 1); - add_attribute (A_NO_INSTRUMENT_FUNCTION, "no_instrument_function", 0, 0, 1); - add_attribute (A_NO_CHECK_MEMORY_USAGE, "no_check_memory_usage", 0, 0, 1); -} - -/* Default implementation of valid_lang_attribute, below. By default, there - are no language-specific attributes. */ - -static int -default_valid_lang_attribute (attr_name, attr_args, decl, type) - tree attr_name ATTRIBUTE_UNUSED; - tree attr_args ATTRIBUTE_UNUSED; - tree decl ATTRIBUTE_UNUSED; - tree type ATTRIBUTE_UNUSED; -{ - return 0; -} - -/* Return a 1 if ATTR_NAME and ATTR_ARGS denote a valid language-specific - attribute for either declaration DECL or type TYPE and 0 otherwise. */ - -int (*valid_lang_attribute) PROTO ((tree, tree, tree, tree)) - = default_valid_lang_attribute; - -/* Process the attributes listed in ATTRIBUTES and PREFIX_ATTRIBUTES - and install them in NODE, which is either a DECL (including a TYPE_DECL) - or a TYPE. PREFIX_ATTRIBUTES can appear after the declaration specifiers - and declaration modifiers but before the declaration proper. */ - -void -decl_attributes (node, attributes, prefix_attributes) - tree node, attributes, prefix_attributes; -{ - tree decl = 0, type = 0; - int is_type = 0; - tree a; - - if (attrtab_idx == 0) - init_attributes (); - - if (TREE_CODE_CLASS (TREE_CODE (node)) == 'd') - { - decl = node; - type = TREE_TYPE (decl); - is_type = TREE_CODE (node) == TYPE_DECL; - } - else if (TREE_CODE_CLASS (TREE_CODE (node)) == 't') - type = node, is_type = 1; - -#ifdef PRAGMA_INSERT_ATTRIBUTES - /* If the code in c-pragma.c wants to insert some attributes then - allow it to do so. Do this before allowing machine back ends to - insert attributes, so that they have the opportunity to override - anything done here. */ - PRAGMA_INSERT_ATTRIBUTES (node, & attributes, & prefix_attributes); -#endif - -#ifdef INSERT_ATTRIBUTES - INSERT_ATTRIBUTES (node, & attributes, & prefix_attributes); -#endif - - attributes = chainon (prefix_attributes, attributes); - - for (a = attributes; a; a = TREE_CHAIN (a)) - { - tree name = TREE_PURPOSE (a); - tree args = TREE_VALUE (a); - int i; - enum attrs id; - - for (i = 0; i < attrtab_idx; i++) - if (attrtab[i].name == name) - break; - - if (i == attrtab_idx) - { - if (! valid_machine_attribute (name, args, decl, type) - && ! (* valid_lang_attribute) (name, args, decl, type)) - warning ("`%s' attribute directive ignored", - IDENTIFIER_POINTER (name)); - else if (decl != 0) - type = TREE_TYPE (decl); - continue; - } - else if (attrtab[i].decl_req && decl == 0) - { - warning ("`%s' attribute does not apply to types", - IDENTIFIER_POINTER (name)); - continue; - } - else if (list_length (args) < attrtab[i].min - || list_length (args) > attrtab[i].max) - { - error ("wrong number of arguments specified for `%s' attribute", - IDENTIFIER_POINTER (name)); - continue; - } - - id = attrtab[i].id; - switch (id) - { - case A_PACKED: - if (is_type) - TYPE_PACKED (type) = 1; - else if (TREE_CODE (decl) == FIELD_DECL) - DECL_PACKED (decl) = 1; - /* We can't set DECL_PACKED for a VAR_DECL, because the bit is - used for DECL_REGISTER. It wouldn't mean anything anyway. */ - else - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_NOCOMMON: - if (TREE_CODE (decl) == VAR_DECL) - DECL_COMMON (decl) = 0; - else - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_COMMON: - if (TREE_CODE (decl) == VAR_DECL) - DECL_COMMON (decl) = 1; - else - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_NORETURN: - if (TREE_CODE (decl) == FUNCTION_DECL) - TREE_THIS_VOLATILE (decl) = 1; - else if (TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) - TREE_TYPE (decl) = type - = build_pointer_type - (build_type_variant (TREE_TYPE (type), - TREE_READONLY (TREE_TYPE (type)), 1)); - else - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_UNUSED: - if (is_type) - TREE_USED (type) = 1; - else if (TREE_CODE (decl) == PARM_DECL - || TREE_CODE (decl) == VAR_DECL - || TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == LABEL_DECL) - TREE_USED (decl) = 1; - else - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_CONST: - if (TREE_CODE (decl) == FUNCTION_DECL) - TREE_READONLY (decl) = 1; - else if (TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) - TREE_TYPE (decl) = type - = build_pointer_type - (build_type_variant (TREE_TYPE (type), 1, - TREE_THIS_VOLATILE (TREE_TYPE (type)))); - else - warning ( "`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_T_UNION: - if (is_type - && TREE_CODE (type) == UNION_TYPE - && (decl == 0 - || (TYPE_FIELDS (type) != 0 - && TYPE_MODE (type) == DECL_MODE (TYPE_FIELDS (type))))) - TYPE_TRANSPARENT_UNION (type) = 1; - else if (decl != 0 && TREE_CODE (decl) == PARM_DECL - && TREE_CODE (type) == UNION_TYPE - && TYPE_MODE (type) == DECL_MODE (TYPE_FIELDS (type))) - DECL_TRANSPARENT_UNION (decl) = 1; - else - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_CONSTRUCTOR: - if (TREE_CODE (decl) == FUNCTION_DECL - && TREE_CODE (type) == FUNCTION_TYPE - && decl_function_context (decl) == 0) - { - DECL_STATIC_CONSTRUCTOR (decl) = 1; - TREE_USED (decl) = 1; - } - else - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_DESTRUCTOR: - if (TREE_CODE (decl) == FUNCTION_DECL - && TREE_CODE (type) == FUNCTION_TYPE - && decl_function_context (decl) == 0) - { - DECL_STATIC_DESTRUCTOR (decl) = 1; - TREE_USED (decl) = 1; - } - else - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_MODE: - if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE) - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - else - { - int j; - const char *p = IDENTIFIER_POINTER (TREE_VALUE (args)); - int len = strlen (p); - enum machine_mode mode = VOIDmode; - tree typefm; - - if (len > 4 && p[0] == '_' && p[1] == '_' - && p[len - 1] == '_' && p[len - 2] == '_') - { - char *newp = (char *) alloca (len - 1); - - strcpy (newp, &p[2]); - newp[len - 4] = '\0'; - p = newp; - } - - /* Give this decl a type with the specified mode. - First check for the special modes. */ - if (! strcmp (p, "byte")) - mode = byte_mode; - else if (!strcmp (p, "word")) - mode = word_mode; - else if (! strcmp (p, "pointer")) - mode = ptr_mode; - else - for (j = 0; j < NUM_MACHINE_MODES; j++) - if (!strcmp (p, GET_MODE_NAME (j))) - mode = (enum machine_mode) j; - - if (mode == VOIDmode) - error ("unknown machine mode `%s'", p); - else if (0 == (typefm = type_for_mode (mode, - TREE_UNSIGNED (type)))) - error ("no data type for mode `%s'", p); - else - { - TREE_TYPE (decl) = type = typefm; - DECL_SIZE (decl) = 0; - layout_decl (decl, 0); - } - } - break; - - case A_SECTION: -#ifdef ASM_OUTPUT_SECTION_NAME - if ((TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == VAR_DECL) - && TREE_CODE (TREE_VALUE (args)) == STRING_CST) - { - if (TREE_CODE (decl) == VAR_DECL - && current_function_decl != NULL_TREE - && ! TREE_STATIC (decl)) - error_with_decl (decl, - "section attribute cannot be specified for local variables"); - /* The decl may have already been given a section attribute from - a previous declaration. Ensure they match. */ - else if (DECL_SECTION_NAME (decl) != NULL_TREE - && strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)), - TREE_STRING_POINTER (TREE_VALUE (args))) != 0) - error_with_decl (node, - "section of `%s' conflicts with previous declaration"); - else - DECL_SECTION_NAME (decl) = TREE_VALUE (args); - } - else - error_with_decl (node, - "section attribute not allowed for `%s'"); -#else - error_with_decl (node, - "section attributes are not supported for this target"); -#endif - break; - - case A_ALIGNED: - { - tree align_expr - = (args ? TREE_VALUE (args) - : size_int (BIGGEST_ALIGNMENT / BITS_PER_UNIT)); - int align; - - /* Strip any NOPs of any kind. */ - while (TREE_CODE (align_expr) == NOP_EXPR - || TREE_CODE (align_expr) == CONVERT_EXPR - || TREE_CODE (align_expr) == NON_LVALUE_EXPR) - align_expr = TREE_OPERAND (align_expr, 0); - - if (TREE_CODE (align_expr) != INTEGER_CST) - { - error ("requested alignment is not a constant"); - continue; - } - - align = TREE_INT_CST_LOW (align_expr) * BITS_PER_UNIT; - - if (exact_log2 (align) == -1) - error ("requested alignment is not a power of 2"); - else if (is_type) - TYPE_ALIGN (type) = align; - else if (TREE_CODE (decl) != VAR_DECL - && TREE_CODE (decl) != FIELD_DECL) - error_with_decl (decl, - "alignment may not be specified for `%s'"); - else - DECL_ALIGN (decl) = align; - } - break; - - case A_FORMAT: - { - tree format_type_id = TREE_VALUE (args); - tree format_num_expr = TREE_VALUE (TREE_CHAIN (args)); - tree first_arg_num_expr - = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (args))); - int format_num; - int first_arg_num; - enum format_type format_type; - tree argument; - int arg_num; - - if (TREE_CODE (decl) != FUNCTION_DECL) - { - error_with_decl (decl, - "argument format specified for non-function `%s'"); - continue; - } - - if (TREE_CODE (format_type_id) != IDENTIFIER_NODE) - { - error ("unrecognized format specifier"); - continue; - } - else - { - const char *p = IDENTIFIER_POINTER (format_type_id); - - if (!strcmp (p, "printf") || !strcmp (p, "__printf__")) - format_type = printf_format_type; - else if (!strcmp (p, "scanf") || !strcmp (p, "__scanf__")) - format_type = scanf_format_type; - else if (!strcmp (p, "strftime") - || !strcmp (p, "__strftime__")) - format_type = strftime_format_type; - else - { - warning ("`%s' is an unrecognized format function type", p); - continue; - } - } - - /* Strip any conversions from the string index and first arg number - and verify they are constants. */ - while (TREE_CODE (format_num_expr) == NOP_EXPR - || TREE_CODE (format_num_expr) == CONVERT_EXPR - || TREE_CODE (format_num_expr) == NON_LVALUE_EXPR) - format_num_expr = TREE_OPERAND (format_num_expr, 0); - - while (TREE_CODE (first_arg_num_expr) == NOP_EXPR - || TREE_CODE (first_arg_num_expr) == CONVERT_EXPR - || TREE_CODE (first_arg_num_expr) == NON_LVALUE_EXPR) - first_arg_num_expr = TREE_OPERAND (first_arg_num_expr, 0); - - if (TREE_CODE (format_num_expr) != INTEGER_CST - || TREE_CODE (first_arg_num_expr) != INTEGER_CST) - { - error ("format string has non-constant operand number"); - continue; - } - - format_num = TREE_INT_CST_LOW (format_num_expr); - first_arg_num = TREE_INT_CST_LOW (first_arg_num_expr); - if (first_arg_num != 0 && first_arg_num <= format_num) - { - error ("format string arg follows the args to be formatted"); - continue; - } - - /* If a parameter list is specified, verify that the format_num - argument is actually a string, in case the format attribute - is in error. */ - argument = TYPE_ARG_TYPES (type); - if (argument) - { - for (arg_num = 1; ; ++arg_num) - { - if (argument == 0 || arg_num == format_num) - break; - argument = TREE_CHAIN (argument); - } - if (! argument - || TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE - || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (argument))) - != char_type_node)) - { - error ("format string arg not a string type"); - continue; - } - if (first_arg_num != 0) - { - /* Verify that first_arg_num points to the last arg, - the ... */ - while (argument) - arg_num++, argument = TREE_CHAIN (argument); - if (arg_num != first_arg_num) - { - error ("args to be formatted is not ..."); - continue; - } - } - } - - record_function_format (DECL_NAME (decl), - DECL_ASSEMBLER_NAME (decl), - format_type, format_num, first_arg_num); - break; - } - - case A_FORMAT_ARG: - { - tree format_num_expr = TREE_VALUE (args); - int format_num, arg_num; - tree argument; - - if (TREE_CODE (decl) != FUNCTION_DECL) - { - error_with_decl (decl, - "argument format specified for non-function `%s'"); - continue; - } - - /* Strip any conversions from the first arg number and verify it - is a constant. */ - while (TREE_CODE (format_num_expr) == NOP_EXPR - || TREE_CODE (format_num_expr) == CONVERT_EXPR - || TREE_CODE (format_num_expr) == NON_LVALUE_EXPR) - format_num_expr = TREE_OPERAND (format_num_expr, 0); - - if (TREE_CODE (format_num_expr) != INTEGER_CST) - { - error ("format string has non-constant operand number"); - continue; - } - - format_num = TREE_INT_CST_LOW (format_num_expr); - - /* If a parameter list is specified, verify that the format_num - argument is actually a string, in case the format attribute - is in error. */ - argument = TYPE_ARG_TYPES (type); - if (argument) - { - for (arg_num = 1; ; ++arg_num) - { - if (argument == 0 || arg_num == format_num) - break; - argument = TREE_CHAIN (argument); - } - if (! argument - || TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE - || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (argument))) - != char_type_node)) - { - error ("format string arg not a string type"); - continue; - } - } - - if (TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) != POINTER_TYPE - || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (TREE_TYPE (decl)))) - != char_type_node)) - { - error ("function does not return string type"); - continue; - } - - record_international_format (DECL_NAME (decl), - DECL_ASSEMBLER_NAME (decl), - format_num); - break; - } - - case A_WEAK: - declare_weak (decl); - break; - - case A_ALIAS: - if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl)) - || (TREE_CODE (decl) != FUNCTION_DECL && ! DECL_EXTERNAL (decl))) - error_with_decl (decl, - "`%s' defined both normally and as an alias"); - else if (decl_function_context (decl) == 0) - { - tree id; - - id = TREE_VALUE (args); - if (TREE_CODE (id) != STRING_CST) - { - error ("alias arg not a string"); - break; - } - id = get_identifier (TREE_STRING_POINTER (id)); - - if (TREE_CODE (decl) == FUNCTION_DECL) - DECL_INITIAL (decl) = error_mark_node; - else - DECL_EXTERNAL (decl) = 0; - assemble_alias (decl, id); - } - else - warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); - break; - - case A_NO_CHECK_MEMORY_USAGE: - if (TREE_CODE (decl) != FUNCTION_DECL) - { - error_with_decl (decl, - "`%s' attribute applies only to functions", - IDENTIFIER_POINTER (name)); - } - else if (DECL_INITIAL (decl)) - { - error_with_decl (decl, - "can't set `%s' attribute after definition", - IDENTIFIER_POINTER (name)); - } - else - DECL_NO_CHECK_MEMORY_USAGE (decl) = 1; - break; - - case A_NO_INSTRUMENT_FUNCTION: - if (TREE_CODE (decl) != FUNCTION_DECL) - { - error_with_decl (decl, - "`%s' attribute applies only to functions", - IDENTIFIER_POINTER (name)); - } - else if (DECL_INITIAL (decl)) - { - error_with_decl (decl, - "can't set `%s' attribute after definition", - IDENTIFIER_POINTER (name)); - } - else - DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl) = 1; - break; - } - } -} - -/* Split SPECS_ATTRS, a list of declspecs and prefix attributes, into two - lists. SPECS_ATTRS may also be just a typespec (eg: RECORD_TYPE). - - The head of the declspec list is stored in DECLSPECS. - The head of the attribute list is stored in PREFIX_ATTRIBUTES. - - Note that attributes in SPECS_ATTRS are stored in the TREE_PURPOSE of - the list elements. We drop the containing TREE_LIST nodes and link the - resulting attributes together the way decl_attributes expects them. */ - -void -split_specs_attrs (specs_attrs, declspecs, prefix_attributes) - tree specs_attrs; - tree *declspecs, *prefix_attributes; -{ - tree t, s, a, next, specs, attrs; - - /* This can happen in c++ (eg: decl: typespec initdecls ';'). */ - if (specs_attrs != NULL_TREE - && TREE_CODE (specs_attrs) != TREE_LIST) - { - *declspecs = specs_attrs; - *prefix_attributes = NULL_TREE; - return; - } - - /* Remember to keep the lists in the same order, element-wise. */ - - specs = s = NULL_TREE; - attrs = a = NULL_TREE; - for (t = specs_attrs; t; t = next) - { - next = TREE_CHAIN (t); - /* Declspecs have a non-NULL TREE_VALUE. */ - if (TREE_VALUE (t) != NULL_TREE) - { - if (specs == NULL_TREE) - specs = s = t; - else - { - TREE_CHAIN (s) = t; - s = t; - } - } - else - { - if (attrs == NULL_TREE) - attrs = a = TREE_PURPOSE (t); - else - { - TREE_CHAIN (a) = TREE_PURPOSE (t); - a = TREE_PURPOSE (t); - } - /* More attrs can be linked here, move A to the end. */ - while (TREE_CHAIN (a) != NULL_TREE) - a = TREE_CHAIN (a); - } - } - - /* Terminate the lists. */ - if (s != NULL_TREE) - TREE_CHAIN (s) = NULL_TREE; - if (a != NULL_TREE) - TREE_CHAIN (a) = NULL_TREE; - - /* All done. */ - *declspecs = specs; - *prefix_attributes = attrs; -} - -/* Strip attributes from SPECS_ATTRS, a list of declspecs and attributes. - This function is used by the parser when a rule will accept attributes - in a particular position, but we don't want to support that just yet. - - A warning is issued for every ignored attribute. */ - -tree -strip_attrs (specs_attrs) - tree specs_attrs; -{ - tree specs, attrs; - - split_specs_attrs (specs_attrs, &specs, &attrs); - - while (attrs) - { - warning ("`%s' attribute ignored", - IDENTIFIER_POINTER (TREE_PURPOSE (attrs))); - attrs = TREE_CHAIN (attrs); - } - - return specs; -} - -/* Check a printf/fprintf/sprintf/scanf/fscanf/sscanf format against - a parameter list. */ - -#define T_I &integer_type_node -#define T_L &long_integer_type_node -#define T_LL &long_long_integer_type_node -#define T_S &short_integer_type_node -#define T_UI &unsigned_type_node -#define T_UL &long_unsigned_type_node -#define T_ULL &long_long_unsigned_type_node -#define T_US &short_unsigned_type_node -#define T_F &float_type_node -#define T_D &double_type_node -#define T_LD &long_double_type_node -#define T_C &char_type_node -#define T_UC &unsigned_char_type_node -#define T_V &void_type_node -#define T_W &wchar_type_node -#define T_ST &sizetype - -typedef struct { - const char *format_chars; - int pointer_count; - /* Type of argument if no length modifier is used. */ - tree *nolen; - /* Type of argument if length modifier for shortening to byte is used. - If NULL, then this modifier is not allowed. */ - tree *hhlen; - /* Type of argument if length modifier for shortening is used. - If NULL, then this modifier is not allowed. */ - tree *hlen; - /* Type of argument if length modifier `l' is used. - If NULL, then this modifier is not allowed. */ - tree *llen; - /* Type of argument if length modifier `q' or `ll' is used. - If NULL, then this modifier is not allowed. */ - tree *qlen; - /* Type of argument if length modifier `L' is used. - If NULL, then this modifier is not allowed. */ - tree *bigllen; - /* Type of argument if length modifier `Z' is used. - If NULL, then this modifier is not allowed. */ - tree *zlen; - /* List of other modifier characters allowed with these options. */ - const char *flag_chars; -} format_char_info; - -static format_char_info print_char_table[] = { - { "di", 0, T_I, T_I, T_I, T_L, T_LL, T_LL, T_ST, "-wp0 +" }, - { "oxX", 0, T_UI, T_UI, T_UI, T_UL, T_ULL, T_ULL, T_ST, "-wp0#" }, - { "u", 0, T_UI, T_UI, T_UI, T_UL, T_ULL, T_ULL, T_ST, "-wp0" }, -/* A GNU extension. */ - { "m", 0, T_V, NULL, NULL, NULL, NULL, NULL, NULL, "-wp" }, - { "feEgGaA", 0, T_D, NULL, NULL, NULL, NULL, T_LD, NULL, "-wp0 +#" }, - { "c", 0, T_I, NULL, NULL, T_W, NULL, NULL, NULL, "-w" }, - { "C", 0, T_W, NULL, NULL, NULL, NULL, NULL, NULL, "-w" }, - { "s", 1, T_C, NULL, NULL, T_W, NULL, NULL, NULL, "-wp" }, - { "S", 1, T_W, NULL, NULL, NULL, NULL, NULL, NULL, "-wp" }, - { "p", 1, T_V, NULL, NULL, NULL, NULL, NULL, NULL, "-w" }, - { "n", 1, T_I, NULL, T_S, T_L, T_LL, NULL, NULL, "" }, - { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } -}; - -static format_char_info scan_char_table[] = { - { "di", 1, T_I, T_C, T_S, T_L, T_LL, T_LL, NULL, "*" }, - { "ouxX", 1, T_UI, T_UC, T_US, T_UL, T_ULL, T_ULL, NULL, "*" }, - { "efgEGaA", 1, T_F, NULL, NULL, T_D, NULL, T_LD, NULL, "*" }, - { "c", 1, T_C, NULL, NULL, T_W, NULL, NULL, NULL, "*" }, - { "s", 1, T_C, NULL, NULL, T_W, NULL, NULL, NULL, "*a" }, - { "[", 1, T_C, NULL, NULL, NULL, NULL, NULL, NULL, "*a" }, - { "C", 1, T_W, NULL, NULL, NULL, NULL, NULL, NULL, "*" }, - { "S", 1, T_W, NULL, NULL, NULL, NULL, NULL, NULL, "*a" }, - { "p", 2, T_V, NULL, NULL, NULL, NULL, NULL, NULL, "*" }, - { "n", 1, T_I, T_C, T_S, T_L, T_LL, NULL, NULL, "" }, - { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } -}; - -/* Handle format characters recognized by glibc's strftime.c. - '2' - MUST do years as only two digits - '3' - MAY do years as only two digits (depending on locale) - 'E' - E modifier is acceptable - 'O' - O modifier is acceptable to Standard C - 'o' - O modifier is acceptable as a GNU extension - 'G' - other GNU extensions */ - -static format_char_info time_char_table[] = { - { "y", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2EO-_0w" }, - { "D", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2" }, - { "g", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2O-_0w" }, - { "cx", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "3E" }, - { "%RTXnrt", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "" }, - { "P", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "G" }, - { "HIMSUWdemw", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow" }, - { "Vju", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow" }, - { "Gklsz", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0OGw" }, - { "ABZa", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^#" }, - { "p", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "#" }, - { "bh", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^" }, - { "CY", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0EOw" }, - { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } -}; - -typedef struct function_format_info -{ - struct function_format_info *next; /* next structure on the list */ - tree name; /* identifier such as "printf" */ - tree assembler_name; /* optional mangled identifier (for C++) */ - enum format_type format_type; /* type of format (printf, scanf, etc.) */ - int format_num; /* number of format argument */ - int first_arg_num; /* number of first arg (zero for varargs) */ -} function_format_info; - -static function_format_info *function_format_list = NULL; - -typedef struct international_format_info -{ - struct international_format_info *next; /* next structure on the list */ - tree name; /* identifier such as "gettext" */ - tree assembler_name; /* optional mangled identifier (for C++) */ - int format_num; /* number of format argument */ -} international_format_info; - -static international_format_info *international_format_list = NULL; - -static void check_format_info PROTO((function_format_info *, tree)); - -/* Initialize the table of functions to perform format checking on. - The ANSI functions are always checked (whether is - included or not), since it is common to call printf without - including . There shouldn't be a problem with this, - since ANSI reserves these function names whether you include the - header file or not. In any case, the checking is harmless. - - Also initialize the name of function that modify the format string for - internationalization purposes. */ - -void -init_function_format_info () -{ - record_function_format (get_identifier ("printf"), NULL_TREE, - printf_format_type, 1, 2); - record_function_format (get_identifier ("fprintf"), NULL_TREE, - printf_format_type, 2, 3); - record_function_format (get_identifier ("sprintf"), NULL_TREE, - printf_format_type, 2, 3); - record_function_format (get_identifier ("scanf"), NULL_TREE, - scanf_format_type, 1, 2); - record_function_format (get_identifier ("fscanf"), NULL_TREE, - scanf_format_type, 2, 3); - record_function_format (get_identifier ("sscanf"), NULL_TREE, - scanf_format_type, 2, 3); - record_function_format (get_identifier ("vprintf"), NULL_TREE, - printf_format_type, 1, 0); - record_function_format (get_identifier ("vfprintf"), NULL_TREE, - printf_format_type, 2, 0); - record_function_format (get_identifier ("vsprintf"), NULL_TREE, - printf_format_type, 2, 0); - record_function_format (get_identifier ("strftime"), NULL_TREE, - strftime_format_type, 3, 0); - - record_international_format (get_identifier ("gettext"), NULL_TREE, 1); - record_international_format (get_identifier ("dgettext"), NULL_TREE, 2); - record_international_format (get_identifier ("dcgettext"), NULL_TREE, 2); -} - -/* Record information for argument format checking. FUNCTION_IDENT is - the identifier node for the name of the function to check (its decl - need not exist yet). - FORMAT_TYPE specifies the type of format checking. FORMAT_NUM is the number - of the argument which is the format control string (starting from 1). - FIRST_ARG_NUM is the number of the first actual argument to check - against the format string, or zero if no checking is not be done - (e.g. for varargs such as vfprintf). */ - -static void -record_function_format (name, assembler_name, format_type, - format_num, first_arg_num) - tree name; - tree assembler_name; - enum format_type format_type; - int format_num; - int first_arg_num; -{ - function_format_info *info; - - /* Re-use existing structure if it's there. */ - - for (info = function_format_list; info; info = info->next) - { - if (info->name == name && info->assembler_name == assembler_name) - break; - } - if (! info) - { - info = (function_format_info *) xmalloc (sizeof (function_format_info)); - info->next = function_format_list; - function_format_list = info; - - info->name = name; - info->assembler_name = assembler_name; - } - - info->format_type = format_type; - info->format_num = format_num; - info->first_arg_num = first_arg_num; -} - -/* Record information for the names of function that modify the format - argument to format functions. FUNCTION_IDENT is the identifier node for - the name of the function (its decl need not exist yet) and FORMAT_NUM is - the number of the argument which is the format control string (starting - from 1). */ - -static void -record_international_format (name, assembler_name, format_num) - tree name; - tree assembler_name; - int format_num; -{ - international_format_info *info; - - /* Re-use existing structure if it's there. */ - - for (info = international_format_list; info; info = info->next) - { - if (info->name == name && info->assembler_name == assembler_name) - break; - } - - if (! info) - { - info - = (international_format_info *) - xmalloc (sizeof (international_format_info)); - info->next = international_format_list; - international_format_list = info; - - info->name = name; - info->assembler_name = assembler_name; - } - - info->format_num = format_num; -} - -static void -tfaff () -{ - warning ("too few arguments for format"); -} - -/* Check the argument list of a call to printf, scanf, etc. - NAME is the function identifier. - ASSEMBLER_NAME is the function's assembler identifier. - (Either NAME or ASSEMBLER_NAME, but not both, may be NULL_TREE.) - PARAMS is the list of argument values. */ - -void -check_function_format (name, assembler_name, params) - tree name; - tree assembler_name; - tree params; -{ - function_format_info *info; - - /* See if this function is a format function. */ - for (info = function_format_list; info; info = info->next) - { - if (info->assembler_name - ? (info->assembler_name == assembler_name) - : (info->name == name)) - { - /* Yup; check it. */ - check_format_info (info, params); - break; - } - } -} - -/* Check the argument list of a call to printf, scanf, etc. - INFO points to the function_format_info structure. - PARAMS is the list of argument values. */ - -static void -check_format_info (info, params) - function_format_info *info; - tree params; -{ - int i; - int arg_num; - int suppressed, wide, precise; - int length_char = 0; - int format_char; - int format_length; - tree format_tree; - tree cur_param; - tree cur_type; - tree wanted_type; - tree first_fillin_param; - const char *format_chars; - format_char_info *fci = NULL; - char flag_chars[8]; - int has_operand_number = 0; - - /* Skip to format argument. If the argument isn't available, there's - no work for us to do; prototype checking will catch the problem. */ - for (arg_num = 1; ; ++arg_num) - { - if (params == 0) - return; - if (arg_num == info->format_num) - break; - params = TREE_CHAIN (params); - } - format_tree = TREE_VALUE (params); - params = TREE_CHAIN (params); - if (format_tree == 0) - return; - - /* We can only check the format if it's a string constant. */ - while (TREE_CODE (format_tree) == NOP_EXPR) - format_tree = TREE_OPERAND (format_tree, 0); /* strip coercion */ - - if (TREE_CODE (format_tree) == CALL_EXPR - && TREE_CODE (TREE_OPERAND (format_tree, 0)) == ADDR_EXPR - && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (format_tree, 0), 0)) - == FUNCTION_DECL)) - { - tree function = TREE_OPERAND (TREE_OPERAND (format_tree, 0), 0); - - /* See if this is a call to a known internationalization function - that modifies the format arg. */ - international_format_info *info; - - for (info = international_format_list; info; info = info->next) - if (info->assembler_name - ? (info->assembler_name == DECL_ASSEMBLER_NAME (function)) - : (info->name == DECL_NAME (function))) - { - tree inner_args; - int i; - - for (inner_args = TREE_OPERAND (format_tree, 1), i = 1; - inner_args != 0; - inner_args = TREE_CHAIN (inner_args), i++) - if (i == info->format_num) - { - format_tree = TREE_VALUE (inner_args); - - while (TREE_CODE (format_tree) == NOP_EXPR) - format_tree = TREE_OPERAND (format_tree, 0); - } - } - } - - if (integer_zerop (format_tree)) - { - warning ("null format string"); - return; - } - if (TREE_CODE (format_tree) != ADDR_EXPR) - return; - format_tree = TREE_OPERAND (format_tree, 0); - if (TREE_CODE (format_tree) != STRING_CST) - return; - format_chars = TREE_STRING_POINTER (format_tree); - format_length = TREE_STRING_LENGTH (format_tree); - if (format_length <= 1) - warning ("zero-length format string"); - if (format_chars[--format_length] != 0) - { - warning ("unterminated format string"); - return; - } - /* Skip to first argument to check. */ - while (arg_num + 1 < info->first_arg_num) - { - if (params == 0) - return; - params = TREE_CHAIN (params); - ++arg_num; - } - - first_fillin_param = params; - while (1) - { - int aflag; - if (*format_chars == 0) - { - if (format_chars - TREE_STRING_POINTER (format_tree) != format_length) - warning ("embedded `\\0' in format"); - if (info->first_arg_num != 0 && params != 0 && ! has_operand_number) - warning ("too many arguments for format"); - return; - } - if (*format_chars++ != '%') - continue; - if (*format_chars == 0) - { - warning ("spurious trailing `%%' in format"); - continue; - } - if (*format_chars == '%') - { - ++format_chars; - continue; - } - flag_chars[0] = 0; - suppressed = wide = precise = FALSE; - if (info->format_type == scanf_format_type) - { - suppressed = *format_chars == '*'; - if (suppressed) - ++format_chars; - while (ISDIGIT (*format_chars)) - ++format_chars; - } - else if (info->format_type == strftime_format_type) - { - while (*format_chars != 0 && index ("_-0^#", *format_chars) != 0) - { - if (pedantic) - warning ("ANSI C does not support the strftime `%c' flag", - *format_chars); - if (index (flag_chars, *format_chars) != 0) - { - warning ("repeated `%c' flag in format", - *format_chars); - ++format_chars; - } - else - { - i = strlen (flag_chars); - flag_chars[i++] = *format_chars++; - flag_chars[i] = 0; - } - } - while (ISDIGIT ((unsigned char) *format_chars)) - { - wide = TRUE; - ++format_chars; - } - if (wide && pedantic) - warning ("ANSI C does not support strftime format width"); - if (*format_chars == 'E' || *format_chars == 'O') - { - i = strlen (flag_chars); - flag_chars[i++] = *format_chars++; - flag_chars[i] = 0; - if (*format_chars == 'E' || *format_chars == 'O') - { - warning ("multiple E/O modifiers in format"); - while (*format_chars == 'E' || *format_chars == 'O') - ++format_chars; - } - } - } - else if (info->format_type == printf_format_type) - { - /* See if we have a number followed by a dollar sign. If we do, - it is an operand number, so set PARAMS to that operand. */ - if (*format_chars >= '0' && *format_chars <= '9') - { - const char *p = format_chars; - - while (*p >= '0' && *p++ <= '9') - ; - - if (*p == '$') - { - int opnum = atoi (format_chars); - - params = first_fillin_param; - format_chars = p + 1; - has_operand_number = 1; - - for (i = 1; i < opnum && params != 0; i++) - params = TREE_CHAIN (params); - - if (opnum == 0 || params == 0) - { - warning ("operand number out of range in format"); - return; - } - } - } - - while (*format_chars != 0 && index (" +#0-", *format_chars) != 0) - { - if (index (flag_chars, *format_chars) != 0) - warning ("repeated `%c' flag in format", *format_chars++); - else - { - i = strlen (flag_chars); - flag_chars[i++] = *format_chars++; - flag_chars[i] = 0; - } - } - /* "If the space and + flags both appear, - the space flag will be ignored." */ - if (index (flag_chars, ' ') != 0 - && index (flag_chars, '+') != 0) - warning ("use of both ` ' and `+' flags in format"); - /* "If the 0 and - flags both appear, - the 0 flag will be ignored." */ - if (index (flag_chars, '0') != 0 - && index (flag_chars, '-') != 0) - warning ("use of both `0' and `-' flags in format"); - if (*format_chars == '*') - { - wide = TRUE; - /* "...a field width...may be indicated by an asterisk. - In this case, an int argument supplies the field width..." */ - ++format_chars; - if (params == 0) - { - tfaff (); - return; - } - if (info->first_arg_num != 0) - { - cur_param = TREE_VALUE (params); - params = TREE_CHAIN (params); - ++arg_num; - /* size_t is generally not valid here. - It will work on most machines, because size_t and int - have the same mode. But might as well warn anyway, - since it will fail on other machines. */ - if ((TYPE_MAIN_VARIANT (TREE_TYPE (cur_param)) - != integer_type_node) - && - (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param)) - != unsigned_type_node)) - warning ("field width is not type int (arg %d)", arg_num); - } - } - else - { - while (ISDIGIT (*format_chars)) - { - wide = TRUE; - ++format_chars; - } - } - if (*format_chars == '.') - { - precise = TRUE; - ++format_chars; - if (*format_chars != '*' && !ISDIGIT (*format_chars)) - warning ("`.' not followed by `*' or digit in format"); - /* "...a...precision...may be indicated by an asterisk. - In this case, an int argument supplies the...precision." */ - if (*format_chars == '*') - { - if (info->first_arg_num != 0) - { - ++format_chars; - if (params == 0) - { - tfaff (); - return; - } - cur_param = TREE_VALUE (params); - params = TREE_CHAIN (params); - ++arg_num; - if (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param)) - != integer_type_node) - warning ("field width is not type int (arg %d)", - arg_num); - } - } - else - { - while (ISDIGIT (*format_chars)) - ++format_chars; - } - } - } - - aflag = 0; - - if (info->format_type != strftime_format_type) - { - if (*format_chars == 'h' || *format_chars == 'l') - length_char = *format_chars++; - else if (*format_chars == 'q' || *format_chars == 'L') - { - length_char = *format_chars++; - if (pedantic) - warning ("ANSI C does not support the `%c' length modifier", - length_char); - } - else if (*format_chars == 'Z') - { - length_char = *format_chars++; - if (pedantic) - warning ("ANSI C does not support the `Z' length modifier"); - } - else - length_char = 0; - if (length_char == 'l' && *format_chars == 'l') - { - length_char = 'q', format_chars++; - /* FIXME: Is allowed in ISO C 9x. */ - if (pedantic) - warning ("ANSI C does not support the `ll' length modifier"); - } - else if (length_char == 'h' && *format_chars == 'h') - { - length_char = 'H', format_chars++; - /* FIXME: Is allowed in ISO C 9x. */ - if (pedantic) - warning ("ANSI C does not support the `hh' length modifier"); - } - if (*format_chars == 'a' && info->format_type == scanf_format_type) - { - if (format_chars[1] == 's' || format_chars[1] == 'S' - || format_chars[1] == '[') - { - /* `a' is used as a flag. */ - aflag = 1; - format_chars++; - } - } - if (suppressed && length_char != 0) - warning ("use of `*' and `%c' together in format", length_char); - } - format_char = *format_chars; - if (format_char == 0 - || (info->format_type != strftime_format_type && format_char == '%')) - { - warning ("conversion lacks type at end of format"); - continue; - } - /* The m, C, and S formats are GNU extensions. */ - if (pedantic && info->format_type != strftime_format_type - && (format_char == 'm' || format_char == 'C' || format_char == 'S')) - warning ("ANSI C does not support the `%c' format", format_char); - /* ??? The a and A formats are C9X extensions, and should be allowed - when a C9X option is added. */ - if (pedantic && info->format_type != strftime_format_type - && (format_char == 'a' || format_char == 'A')) - warning ("ANSI C does not support the `%c' format", format_char); - format_chars++; - switch (info->format_type) - { - case printf_format_type: - fci = print_char_table; - break; - case scanf_format_type: - fci = scan_char_table; - break; - case strftime_format_type: - fci = time_char_table; - break; - default: - abort (); - } - while (fci->format_chars != 0 - && index (fci->format_chars, format_char) == 0) - ++fci; - if (fci->format_chars == 0) - { - if (format_char >= 040 && format_char < 0177) - warning ("unknown conversion type character `%c' in format", - format_char); - else - warning ("unknown conversion type character 0x%x in format", - format_char); - continue; - } - if (pedantic) - { - if (index (fci->flag_chars, 'G') != 0) - warning ("ANSI C does not support `%%%c'", format_char); - if (index (fci->flag_chars, 'o') != 0 - && index (flag_chars, 'O') != 0) - warning ("ANSI C does not support `%%O%c'", format_char); - } - if (wide && index (fci->flag_chars, 'w') == 0) - warning ("width used with `%c' format", format_char); - if (index (fci->flag_chars, '2') != 0) - warning ("`%%%c' yields only last 2 digits of year", format_char); - else if (index (fci->flag_chars, '3') != 0) - warning ("`%%%c' yields only last 2 digits of year in some locales", - format_char); - if (precise && index (fci->flag_chars, 'p') == 0) - warning ("precision used with `%c' format", format_char); - if (aflag && index (fci->flag_chars, 'a') == 0) - { - warning ("`a' flag used with `%c' format", format_char); - /* To simplify the following code. */ - aflag = 0; - } - /* The a flag is a GNU extension. */ - else if (pedantic && aflag) - warning ("ANSI C does not support the `a' flag"); - if (info->format_type == scanf_format_type && format_char == '[') - { - /* Skip over scan set, in case it happens to have '%' in it. */ - if (*format_chars == '^') - ++format_chars; - /* Find closing bracket; if one is hit immediately, then - it's part of the scan set rather than a terminator. */ - if (*format_chars == ']') - ++format_chars; - while (*format_chars && *format_chars != ']') - ++format_chars; - if (*format_chars != ']') - /* The end of the format string was reached. */ - warning ("no closing `]' for `%%[' format"); - } - if (suppressed) - { - if (index (fci->flag_chars, '*') == 0) - warning ("suppression of `%c' conversion in format", format_char); - continue; - } - for (i = 0; flag_chars[i] != 0; ++i) - { - if (index (fci->flag_chars, flag_chars[i]) == 0) - warning ("flag `%c' used with type `%c'", - flag_chars[i], format_char); - } - if (info->format_type == strftime_format_type) - continue; - if (precise && index (flag_chars, '0') != 0 - && (format_char == 'd' || format_char == 'i' - || format_char == 'o' || format_char == 'u' - || format_char == 'x' || format_char == 'X')) - warning ("`0' flag ignored with precision specifier and `%c' format", - format_char); - switch (length_char) - { - default: wanted_type = fci->nolen ? *(fci->nolen) : 0; break; - case 'H': wanted_type = fci->hhlen ? *(fci->hhlen) : 0; break; - case 'h': wanted_type = fci->hlen ? *(fci->hlen) : 0; break; - case 'l': wanted_type = fci->llen ? *(fci->llen) : 0; break; - case 'q': wanted_type = fci->qlen ? *(fci->qlen) : 0; break; - case 'L': wanted_type = fci->bigllen ? *(fci->bigllen) : 0; break; - case 'Z': wanted_type = fci->zlen ? *fci->zlen : 0; break; - } - if (wanted_type == 0) - warning ("use of `%c' length character with `%c' type character", - length_char, format_char); - - /* Finally. . .check type of argument against desired type! */ - if (info->first_arg_num == 0) - continue; - if (fci->pointer_count == 0 && wanted_type == void_type_node) - /* This specifier takes no argument. */ - continue; - if (params == 0) - { - tfaff (); - return; - } - cur_param = TREE_VALUE (params); - params = TREE_CHAIN (params); - ++arg_num; - cur_type = TREE_TYPE (cur_param); - - STRIP_NOPS (cur_param); - - /* Check the types of any additional pointer arguments - that precede the "real" argument. */ - for (i = 0; i < fci->pointer_count + aflag; ++i) - { - if (TREE_CODE (cur_type) == POINTER_TYPE) - { - cur_type = TREE_TYPE (cur_type); - - if (cur_param != 0 && TREE_CODE (cur_param) == ADDR_EXPR) - cur_param = TREE_OPERAND (cur_param, 0); - else - cur_param = 0; - - continue; - } - if (TREE_CODE (cur_type) != ERROR_MARK) - warning ((fci->pointer_count + aflag == 1 - ? "format argument is not a pointer (arg %d)" - : "format argument is not a pointer to a pointer (arg %d)"), - arg_num); - break; - } - - /* See if this is an attempt to write into a const type with - scanf or with printf "%n". */ - if ((info->format_type == scanf_format_type - || (info->format_type == printf_format_type - && format_char == 'n')) - && i == fci->pointer_count + aflag - && wanted_type != 0 - && TREE_CODE (cur_type) != ERROR_MARK - && (TYPE_READONLY (cur_type) - || (cur_param != 0 - && (TREE_CODE_CLASS (TREE_CODE (cur_param)) == 'c' - || (TREE_CODE_CLASS (TREE_CODE (cur_param)) == 'd' - && TREE_READONLY (cur_param)))))) - warning ("writing into constant object (arg %d)", arg_num); - - /* Check the type of the "real" argument, if there's a type we want. */ - if (i == fci->pointer_count + aflag && wanted_type != 0 - && TREE_CODE (cur_type) != ERROR_MARK - && wanted_type != TYPE_MAIN_VARIANT (cur_type) - /* If we want `void *', allow any pointer type. - (Anything else would already have got a warning.) */ - && ! (wanted_type == void_type_node - && fci->pointer_count > 0) - /* Don't warn about differences merely in signedness. */ - && !(TREE_CODE (wanted_type) == INTEGER_TYPE - && TREE_CODE (TYPE_MAIN_VARIANT (cur_type)) == INTEGER_TYPE - && (TREE_UNSIGNED (wanted_type) - ? wanted_type == (cur_type = unsigned_type (cur_type)) - : wanted_type == (cur_type = signed_type (cur_type)))) - /* Likewise, "signed char", "unsigned char" and "char" are - equivalent but the above test won't consider them equivalent. */ - && ! (wanted_type == char_type_node - && (TYPE_MAIN_VARIANT (cur_type) == signed_char_type_node - || TYPE_MAIN_VARIANT (cur_type) == unsigned_char_type_node))) - { - register const char *this; - register const char *that; - - this = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (wanted_type))); - that = 0; - if (TREE_CODE (cur_type) != ERROR_MARK - && TYPE_NAME (cur_type) != 0 - && TREE_CODE (cur_type) != INTEGER_TYPE - && !(TREE_CODE (cur_type) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (cur_type)) == INTEGER_TYPE)) - { - if (TREE_CODE (TYPE_NAME (cur_type)) == TYPE_DECL - && DECL_NAME (TYPE_NAME (cur_type)) != 0) - that = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (cur_type))); - else - that = IDENTIFIER_POINTER (TYPE_NAME (cur_type)); - } - - /* A nameless type can't possibly match what the format wants. - So there will be a warning for it. - Make up a string to describe vaguely what it is. */ - if (that == 0) - { - if (TREE_CODE (cur_type) == POINTER_TYPE) - that = "pointer"; - else - that = "different type"; - } - - /* Make the warning better in case of mismatch of int vs long. */ - if (TREE_CODE (cur_type) == INTEGER_TYPE - && TREE_CODE (wanted_type) == INTEGER_TYPE - && TYPE_PRECISION (cur_type) == TYPE_PRECISION (wanted_type) - && TYPE_NAME (cur_type) != 0 - && TREE_CODE (TYPE_NAME (cur_type)) == TYPE_DECL) - that = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (cur_type))); - - if (strcmp (this, that) != 0) - warning ("%s format, %s arg (arg %d)", this, that, arg_num); - } - } -} - -/* Print a warning if a constant expression had overflow in folding. - Invoke this function on every expression that the language - requires to be a constant expression. - Note the ANSI C standard says it is erroneous for a - constant expression to overflow. */ - -void -constant_expression_warning (value) - tree value; -{ - if ((TREE_CODE (value) == INTEGER_CST || TREE_CODE (value) == REAL_CST - || TREE_CODE (value) == COMPLEX_CST) - && TREE_CONSTANT_OVERFLOW (value) && pedantic) - pedwarn ("overflow in constant expression"); -} - -/* Print a warning if an expression had overflow in folding. - Invoke this function on every expression that - (1) appears in the source code, and - (2) might be a constant expression that overflowed, and - (3) is not already checked by convert_and_check; - however, do not invoke this function on operands of explicit casts. */ - -void -overflow_warning (value) - tree value; -{ - if ((TREE_CODE (value) == INTEGER_CST - || (TREE_CODE (value) == COMPLEX_CST - && TREE_CODE (TREE_REALPART (value)) == INTEGER_CST)) - && TREE_OVERFLOW (value)) - { - TREE_OVERFLOW (value) = 0; - if (skip_evaluation == 0) - warning ("integer overflow in expression"); - } - else if ((TREE_CODE (value) == REAL_CST - || (TREE_CODE (value) == COMPLEX_CST - && TREE_CODE (TREE_REALPART (value)) == REAL_CST)) - && TREE_OVERFLOW (value)) - { - TREE_OVERFLOW (value) = 0; - if (skip_evaluation == 0) - warning ("floating point overflow in expression"); - } -} - -/* Print a warning if a large constant is truncated to unsigned, - or if -Wconversion is used and a constant < 0 is converted to unsigned. - Invoke this function on every expression that might be implicitly - converted to an unsigned type. */ - -void -unsigned_conversion_warning (result, operand) - tree result, operand; -{ - if (TREE_CODE (operand) == INTEGER_CST - && TREE_CODE (TREE_TYPE (result)) == INTEGER_TYPE - && TREE_UNSIGNED (TREE_TYPE (result)) - && skip_evaluation == 0 - && !int_fits_type_p (operand, TREE_TYPE (result))) - { - if (!int_fits_type_p (operand, signed_type (TREE_TYPE (result)))) - /* This detects cases like converting -129 or 256 to unsigned char. */ - warning ("large integer implicitly truncated to unsigned type"); - else if (warn_conversion) - warning ("negative integer implicitly converted to unsigned type"); - } -} - -/* Convert EXPR to TYPE, warning about conversion problems with constants. - Invoke this function on every expression that is converted implicitly, - i.e. because of language rules and not because of an explicit cast. */ - -tree -convert_and_check (type, expr) - tree type, expr; -{ - tree t = convert (type, expr); - if (TREE_CODE (t) == INTEGER_CST) - { - if (TREE_OVERFLOW (t)) - { - TREE_OVERFLOW (t) = 0; - - /* Do not diagnose overflow in a constant expression merely - because a conversion overflowed. */ - TREE_CONSTANT_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (expr); - - /* No warning for converting 0x80000000 to int. */ - if (!(TREE_UNSIGNED (type) < TREE_UNSIGNED (TREE_TYPE (expr)) - && TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE - && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (expr)))) - /* If EXPR fits in the unsigned version of TYPE, - don't warn unless pedantic. */ - if ((pedantic - || TREE_UNSIGNED (type) - || ! int_fits_type_p (expr, unsigned_type (type))) - && skip_evaluation == 0) - warning ("overflow in implicit constant conversion"); - } - else - unsigned_conversion_warning (t, expr); - } - return t; -} - -void -c_expand_expr_stmt (expr) - tree expr; -{ - /* Do default conversion if safe and possibly important, - in case within ({...}). */ - if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE && lvalue_p (expr)) - || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE) - expr = default_conversion (expr); - - if (TREE_TYPE (expr) != error_mark_node - && TYPE_SIZE (TREE_TYPE (expr)) == 0 - && TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE) - error ("expression statement has incomplete type"); - - expand_expr_stmt (expr); -} - -/* Validate the expression after `case' and apply default promotions. */ - -tree -check_case_value (value) - tree value; -{ - if (value == NULL_TREE) - return value; - - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ - STRIP_TYPE_NOPS (value); - - if (TREE_CODE (value) != INTEGER_CST - && value != error_mark_node) - { - error ("case label does not reduce to an integer constant"); - value = error_mark_node; - } - else - /* Promote char or short to int. */ - value = default_conversion (value); - - constant_expression_warning (value); - - return value; -} - -/* Return an integer type with BITS bits of precision, - that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */ - -tree -type_for_size (bits, unsignedp) - unsigned bits; - int unsignedp; -{ - if (bits == TYPE_PRECISION (integer_type_node)) - return unsignedp ? unsigned_type_node : integer_type_node; - - if (bits == TYPE_PRECISION (signed_char_type_node)) - return unsignedp ? unsigned_char_type_node : signed_char_type_node; - - if (bits == TYPE_PRECISION (short_integer_type_node)) - return unsignedp ? short_unsigned_type_node : short_integer_type_node; - - if (bits == TYPE_PRECISION (long_integer_type_node)) - return unsignedp ? long_unsigned_type_node : long_integer_type_node; - - if (bits == TYPE_PRECISION (long_long_integer_type_node)) - return (unsignedp ? long_long_unsigned_type_node - : long_long_integer_type_node); - - if (bits <= TYPE_PRECISION (intQI_type_node)) - return unsignedp ? unsigned_intQI_type_node : intQI_type_node; - - if (bits <= TYPE_PRECISION (intHI_type_node)) - return unsignedp ? unsigned_intHI_type_node : intHI_type_node; - - if (bits <= TYPE_PRECISION (intSI_type_node)) - return unsignedp ? unsigned_intSI_type_node : intSI_type_node; - - if (bits <= TYPE_PRECISION (intDI_type_node)) - return unsignedp ? unsigned_intDI_type_node : intDI_type_node; - - return 0; -} - -/* Return a data type that has machine mode MODE. - If the mode is an integer, - then UNSIGNEDP selects between signed and unsigned types. */ - -tree -type_for_mode (mode, unsignedp) - enum machine_mode mode; - int unsignedp; -{ - if (mode == TYPE_MODE (integer_type_node)) - return unsignedp ? unsigned_type_node : integer_type_node; - - if (mode == TYPE_MODE (signed_char_type_node)) - return unsignedp ? unsigned_char_type_node : signed_char_type_node; - - if (mode == TYPE_MODE (short_integer_type_node)) - return unsignedp ? short_unsigned_type_node : short_integer_type_node; - - if (mode == TYPE_MODE (long_integer_type_node)) - return unsignedp ? long_unsigned_type_node : long_integer_type_node; - - if (mode == TYPE_MODE (long_long_integer_type_node)) - return unsignedp ? long_long_unsigned_type_node : long_long_integer_type_node; - - if (mode == TYPE_MODE (intQI_type_node)) - return unsignedp ? unsigned_intQI_type_node : intQI_type_node; - - if (mode == TYPE_MODE (intHI_type_node)) - return unsignedp ? unsigned_intHI_type_node : intHI_type_node; - - if (mode == TYPE_MODE (intSI_type_node)) - return unsignedp ? unsigned_intSI_type_node : intSI_type_node; - - if (mode == TYPE_MODE (intDI_type_node)) - return unsignedp ? unsigned_intDI_type_node : intDI_type_node; - -#if HOST_BITS_PER_WIDE_INT >= 64 - if (mode == TYPE_MODE (intTI_type_node)) - return unsignedp ? unsigned_intTI_type_node : intTI_type_node; -#endif - - if (mode == TYPE_MODE (float_type_node)) - return float_type_node; - - if (mode == TYPE_MODE (double_type_node)) - return double_type_node; - - if (mode == TYPE_MODE (long_double_type_node)) - return long_double_type_node; - - if (mode == TYPE_MODE (build_pointer_type (char_type_node))) - return build_pointer_type (char_type_node); - - if (mode == TYPE_MODE (build_pointer_type (integer_type_node))) - return build_pointer_type (integer_type_node); - - return 0; -} - -/* Return the minimum number of bits needed to represent VALUE in a - signed or unsigned type, UNSIGNEDP says which. */ - -int -min_precision (value, unsignedp) - tree value; - int unsignedp; -{ - int log; - - /* If the value is negative, compute its negative minus 1. The latter - adjustment is because the absolute value of the largest negative value - is one larger than the largest positive value. This is equivalent to - a bit-wise negation, so use that operation instead. */ - - if (tree_int_cst_sgn (value) < 0) - value = fold (build1 (BIT_NOT_EXPR, TREE_TYPE (value), value)); - - /* Return the number of bits needed, taking into account the fact - that we need one more bit for a signed than unsigned type. */ - - if (integer_zerop (value)) - log = 0; - else if (TREE_INT_CST_HIGH (value) != 0) - log = HOST_BITS_PER_WIDE_INT + floor_log2 (TREE_INT_CST_HIGH (value)); - else - log = floor_log2 (TREE_INT_CST_LOW (value)); - - return log + 1 + ! unsignedp; -} - -/* Print an error message for invalid operands to arith operation CODE. - NOP_EXPR is used as a special case (see truthvalue_conversion). */ - -void -binary_op_error (code) - enum tree_code code; -{ - register const char *opname; - - switch (code) - { - case NOP_EXPR: - error ("invalid truth-value expression"); - return; - - case PLUS_EXPR: - opname = "+"; break; - case MINUS_EXPR: - opname = "-"; break; - case MULT_EXPR: - opname = "*"; break; - case MAX_EXPR: - opname = "max"; break; - case MIN_EXPR: - opname = "min"; break; - case EQ_EXPR: - opname = "=="; break; - case NE_EXPR: - opname = "!="; break; - case LE_EXPR: - opname = "<="; break; - case GE_EXPR: - opname = ">="; break; - case LT_EXPR: - opname = "<"; break; - case GT_EXPR: - opname = ">"; break; - case LSHIFT_EXPR: - opname = "<<"; break; - case RSHIFT_EXPR: - opname = ">>"; break; - case TRUNC_MOD_EXPR: - case FLOOR_MOD_EXPR: - opname = "%"; break; - case TRUNC_DIV_EXPR: - case FLOOR_DIV_EXPR: - opname = "/"; break; - case BIT_AND_EXPR: - opname = "&"; break; - case BIT_IOR_EXPR: - opname = "|"; break; - case TRUTH_ANDIF_EXPR: - opname = "&&"; break; - case TRUTH_ORIF_EXPR: - opname = "||"; break; - case BIT_XOR_EXPR: - opname = "^"; break; - case LROTATE_EXPR: - case RROTATE_EXPR: - opname = "rotate"; break; - default: - opname = "unknown"; break; - } - error ("invalid operands to binary %s", opname); -} - -/* Subroutine of build_binary_op, used for comparison operations. - See if the operands have both been converted from subword integer types - and, if so, perhaps change them both back to their original type. - This function is also responsible for converting the two operands - to the proper common type for comparison. - - The arguments of this function are all pointers to local variables - of build_binary_op: OP0_PTR is &OP0, OP1_PTR is &OP1, - RESTYPE_PTR is &RESULT_TYPE and RESCODE_PTR is &RESULTCODE. - - If this function returns nonzero, it means that the comparison has - a constant value. What this function returns is an expression for - that value. */ - -tree -shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr) - tree *op0_ptr, *op1_ptr; - tree *restype_ptr; - enum tree_code *rescode_ptr; -{ - register tree type; - tree op0 = *op0_ptr; - tree op1 = *op1_ptr; - int unsignedp0, unsignedp1; - int real1, real2; - tree primop0, primop1; - enum tree_code code = *rescode_ptr; - - /* Throw away any conversions to wider types - already present in the operands. */ - - primop0 = get_narrower (op0, &unsignedp0); - primop1 = get_narrower (op1, &unsignedp1); - - /* Handle the case that OP0 does not *contain* a conversion - but it *requires* conversion to FINAL_TYPE. */ - - if (op0 == primop0 && TREE_TYPE (op0) != *restype_ptr) - unsignedp0 = TREE_UNSIGNED (TREE_TYPE (op0)); - if (op1 == primop1 && TREE_TYPE (op1) != *restype_ptr) - unsignedp1 = TREE_UNSIGNED (TREE_TYPE (op1)); - - /* If one of the operands must be floated, we cannot optimize. */ - real1 = TREE_CODE (TREE_TYPE (primop0)) == REAL_TYPE; - real2 = TREE_CODE (TREE_TYPE (primop1)) == REAL_TYPE; - - /* If first arg is constant, swap the args (changing operation - so value is preserved), for canonicalization. Don't do this if - the second arg is 0. */ - - if (TREE_CONSTANT (primop0) - && ! integer_zerop (primop1) && ! real_zerop (primop1)) - { - register tree tem = primop0; - register int temi = unsignedp0; - primop0 = primop1; - primop1 = tem; - tem = op0; - op0 = op1; - op1 = tem; - *op0_ptr = op0; - *op1_ptr = op1; - unsignedp0 = unsignedp1; - unsignedp1 = temi; - temi = real1; - real1 = real2; - real2 = temi; - - switch (code) - { - case LT_EXPR: - code = GT_EXPR; - break; - case GT_EXPR: - code = LT_EXPR; - break; - case LE_EXPR: - code = GE_EXPR; - break; - case GE_EXPR: - code = LE_EXPR; - break; - default: - break; - } - *rescode_ptr = code; - } - - /* If comparing an integer against a constant more bits wide, - maybe we can deduce a value of 1 or 0 independent of the data. - Or else truncate the constant now - rather than extend the variable at run time. - - This is only interesting if the constant is the wider arg. - Also, it is not safe if the constant is unsigned and the - variable arg is signed, since in this case the variable - would be sign-extended and then regarded as unsigned. - Our technique fails in this case because the lowest/highest - possible unsigned results don't follow naturally from the - lowest/highest possible values of the variable operand. - For just EQ_EXPR and NE_EXPR there is another technique that - could be used: see if the constant can be faithfully represented - in the other operand's type, by truncating it and reextending it - and see if that preserves the constant's value. */ - - if (!real1 && !real2 - && TREE_CODE (primop1) == INTEGER_CST - && TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (*restype_ptr)) - { - int min_gt, max_gt, min_lt, max_lt; - tree maxval, minval; - /* 1 if comparison is nominally unsigned. */ - int unsignedp = TREE_UNSIGNED (*restype_ptr); - tree val; - - type = signed_or_unsigned_type (unsignedp0, TREE_TYPE (primop0)); - - /* If TYPE is an enumeration, then we need to get its min/max - values from it's underlying integral type, not the enumerated - type itself. */ - if (TREE_CODE (type) == ENUMERAL_TYPE) - type = type_for_size (TYPE_PRECISION (type), unsignedp0); - - maxval = TYPE_MAX_VALUE (type); - minval = TYPE_MIN_VALUE (type); - - if (unsignedp && !unsignedp0) - *restype_ptr = signed_type (*restype_ptr); - - if (TREE_TYPE (primop1) != *restype_ptr) - primop1 = convert (*restype_ptr, primop1); - if (type != *restype_ptr) - { - minval = convert (*restype_ptr, minval); - maxval = convert (*restype_ptr, maxval); - } - - if (unsignedp && unsignedp0) - { - min_gt = INT_CST_LT_UNSIGNED (primop1, minval); - max_gt = INT_CST_LT_UNSIGNED (primop1, maxval); - min_lt = INT_CST_LT_UNSIGNED (minval, primop1); - max_lt = INT_CST_LT_UNSIGNED (maxval, primop1); - } - else - { - min_gt = INT_CST_LT (primop1, minval); - max_gt = INT_CST_LT (primop1, maxval); - min_lt = INT_CST_LT (minval, primop1); - max_lt = INT_CST_LT (maxval, primop1); - } - - val = 0; - /* This used to be a switch, but Genix compiler can't handle that. */ - if (code == NE_EXPR) - { - if (max_lt || min_gt) - val = boolean_true_node; - } - else if (code == EQ_EXPR) - { - if (max_lt || min_gt) - val = boolean_false_node; - } - else if (code == LT_EXPR) - { - if (max_lt) - val = boolean_true_node; - if (!min_lt) - val = boolean_false_node; - } - else if (code == GT_EXPR) - { - if (min_gt) - val = boolean_true_node; - if (!max_gt) - val = boolean_false_node; - } - else if (code == LE_EXPR) - { - if (!max_gt) - val = boolean_true_node; - if (min_gt) - val = boolean_false_node; - } - else if (code == GE_EXPR) - { - if (!min_lt) - val = boolean_true_node; - if (max_lt) - val = boolean_false_node; - } - - /* If primop0 was sign-extended and unsigned comparison specd, - we did a signed comparison above using the signed type bounds. - But the comparison we output must be unsigned. - - Also, for inequalities, VAL is no good; but if the signed - comparison had *any* fixed result, it follows that the - unsigned comparison just tests the sign in reverse - (positive values are LE, negative ones GE). - So we can generate an unsigned comparison - against an extreme value of the signed type. */ - - if (unsignedp && !unsignedp0) - { - if (val != 0) - switch (code) - { - case LT_EXPR: - case GE_EXPR: - primop1 = TYPE_MIN_VALUE (type); - val = 0; - break; - - case LE_EXPR: - case GT_EXPR: - primop1 = TYPE_MAX_VALUE (type); - val = 0; - break; - - default: - break; - } - type = unsigned_type (type); - } - - if (!max_gt && !unsignedp0 && TREE_CODE (primop0) != INTEGER_CST) - { - /* This is the case of (char)x >?< 0x80, which people used to use - expecting old C compilers to change the 0x80 into -0x80. */ - if (val == boolean_false_node) - warning ("comparison is always false due to limited range of data type"); - if (val == boolean_true_node) - warning ("comparison is always true due to limited range of data type"); - } - - if (!min_lt && unsignedp0 && TREE_CODE (primop0) != INTEGER_CST) - { - /* This is the case of (unsigned char)x >?< -1 or < 0. */ - if (val == boolean_false_node) - warning ("comparison is always false due to limited range of data type"); - if (val == boolean_true_node) - warning ("comparison is always true due to limited range of data type"); - } - - if (val != 0) - { - /* Don't forget to evaluate PRIMOP0 if it has side effects. */ - if (TREE_SIDE_EFFECTS (primop0)) - return build (COMPOUND_EXPR, TREE_TYPE (val), primop0, val); - return val; - } - - /* Value is not predetermined, but do the comparison - in the type of the operand that is not constant. - TYPE is already properly set. */ - } - else if (real1 && real2 - && (TYPE_PRECISION (TREE_TYPE (primop0)) - == TYPE_PRECISION (TREE_TYPE (primop1)))) - type = TREE_TYPE (primop0); - - /* If args' natural types are both narrower than nominal type - and both extend in the same manner, compare them - in the type of the wider arg. - Otherwise must actually extend both to the nominal - common type lest different ways of extending - alter the result. - (eg, (short)-1 == (unsigned short)-1 should be 0.) */ - - else if (unsignedp0 == unsignedp1 && real1 == real2 - && TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (*restype_ptr) - && TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr)) - { - type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1)); - type = signed_or_unsigned_type (unsignedp0 - || TREE_UNSIGNED (*restype_ptr), - type); - /* Make sure shorter operand is extended the right way - to match the longer operand. */ - primop0 = convert (signed_or_unsigned_type (unsignedp0, TREE_TYPE (primop0)), - primop0); - primop1 = convert (signed_or_unsigned_type (unsignedp1, TREE_TYPE (primop1)), - primop1); - } - else - { - /* Here we must do the comparison on the nominal type - using the args exactly as we received them. */ - type = *restype_ptr; - primop0 = op0; - primop1 = op1; - - if (!real1 && !real2 && integer_zerop (primop1) - && TREE_UNSIGNED (*restype_ptr)) - { - tree value = 0; - switch (code) - { - case GE_EXPR: - /* All unsigned values are >= 0, so we warn if extra warnings - are requested. However, if OP0 is a constant that is - >= 0, the signedness of the comparison isn't an issue, - so suppress the warning. */ - if (extra_warnings - && ! (TREE_CODE (primop0) == INTEGER_CST - && ! TREE_OVERFLOW (convert (signed_type (type), - primop0)))) - warning ("comparison of unsigned expression >= 0 is always true"); - value = boolean_true_node; - break; - - case LT_EXPR: - if (extra_warnings - && ! (TREE_CODE (primop0) == INTEGER_CST - && ! TREE_OVERFLOW (convert (signed_type (type), - primop0)))) - warning ("comparison of unsigned expression < 0 is always false"); - value = boolean_false_node; - break; - - default: - break; - } - - if (value != 0) - { - /* Don't forget to evaluate PRIMOP0 if it has side effects. */ - if (TREE_SIDE_EFFECTS (primop0)) - return build (COMPOUND_EXPR, TREE_TYPE (value), - primop0, value); - return value; - } - } - } - - *op0_ptr = convert (type, primop0); - *op1_ptr = convert (type, primop1); - - *restype_ptr = boolean_type_node; - - return 0; -} - -/* Prepare expr to be an argument of a TRUTH_NOT_EXPR, - or validate its data type for an `if' or `while' statement or ?..: exp. - - This preparation consists of taking the ordinary - representation of an expression expr and producing a valid tree - boolean expression describing whether expr is nonzero. We could - simply always do build_binary_op (NE_EXPR, expr, boolean_false_node, 1), - but we optimize comparisons, &&, ||, and !. - - The resulting type should always be `boolean_type_node'. */ - -tree -truthvalue_conversion (expr) - tree expr; -{ - if (TREE_CODE (expr) == ERROR_MARK) - return expr; - -#if 0 /* This appears to be wrong for C++. */ - /* These really should return error_mark_node after 2.4 is stable. - But not all callers handle ERROR_MARK properly. */ - switch (TREE_CODE (TREE_TYPE (expr))) - { - case RECORD_TYPE: - error ("struct type value used where scalar is required"); - return boolean_false_node; - - case UNION_TYPE: - error ("union type value used where scalar is required"); - return boolean_false_node; - - case ARRAY_TYPE: - error ("array type value used where scalar is required"); - return boolean_false_node; - - default: - break; - } -#endif /* 0 */ - - switch (TREE_CODE (expr)) - { - /* It is simpler and generates better code to have only TRUTH_*_EXPR - or comparison expressions as truth values at this level. */ -#if 0 - case COMPONENT_REF: - /* A one-bit unsigned bit-field is already acceptable. */ - if (1 == TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (expr, 1))) - && TREE_UNSIGNED (TREE_OPERAND (expr, 1))) - return expr; - break; -#endif - - case EQ_EXPR: - /* It is simpler and generates better code to have only TRUTH_*_EXPR - or comparison expressions as truth values at this level. */ -#if 0 - if (integer_zerop (TREE_OPERAND (expr, 1))) - return build_unary_op (TRUTH_NOT_EXPR, TREE_OPERAND (expr, 0), 0); -#endif - case NE_EXPR: case LE_EXPR: case GE_EXPR: case LT_EXPR: case GT_EXPR: - case TRUTH_ANDIF_EXPR: - case TRUTH_ORIF_EXPR: - case TRUTH_AND_EXPR: - case TRUTH_OR_EXPR: - case TRUTH_XOR_EXPR: - case TRUTH_NOT_EXPR: - TREE_TYPE (expr) = boolean_type_node; - return expr; - - case ERROR_MARK: - return expr; - - case INTEGER_CST: - return integer_zerop (expr) ? boolean_false_node : boolean_true_node; - - case REAL_CST: - return real_zerop (expr) ? boolean_false_node : boolean_true_node; - - case ADDR_EXPR: - /* If we are taking the address of a external decl, it might be zero - if it is weak, so we cannot optimize. */ - if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (expr, 0))) == 'd' - && DECL_EXTERNAL (TREE_OPERAND (expr, 0))) - break; - - if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 0))) - return build (COMPOUND_EXPR, boolean_type_node, - TREE_OPERAND (expr, 0), boolean_true_node); - else - return boolean_true_node; - - case COMPLEX_EXPR: - return build_binary_op ((TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1)) - ? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR), - truthvalue_conversion (TREE_OPERAND (expr, 0)), - truthvalue_conversion (TREE_OPERAND (expr, 1)), - 0); - - case NEGATE_EXPR: - case ABS_EXPR: - case FLOAT_EXPR: - case FFS_EXPR: - /* These don't change whether an object is non-zero or zero. */ - return truthvalue_conversion (TREE_OPERAND (expr, 0)); - - case LROTATE_EXPR: - case RROTATE_EXPR: - /* These don't change whether an object is zero or non-zero, but - we can't ignore them if their second arg has side-effects. */ - if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1))) - return build (COMPOUND_EXPR, boolean_type_node, TREE_OPERAND (expr, 1), - truthvalue_conversion (TREE_OPERAND (expr, 0))); - else - return truthvalue_conversion (TREE_OPERAND (expr, 0)); - - case COND_EXPR: - /* Distribute the conversion into the arms of a COND_EXPR. */ - return fold (build (COND_EXPR, boolean_type_node, TREE_OPERAND (expr, 0), - truthvalue_conversion (TREE_OPERAND (expr, 1)), - truthvalue_conversion (TREE_OPERAND (expr, 2)))); - - case CONVERT_EXPR: - /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE, - since that affects how `default_conversion' will behave. */ - if (TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE - || TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == REFERENCE_TYPE) - break; - /* fall through... */ - case NOP_EXPR: - /* If this is widening the argument, we can ignore it. */ - if (TYPE_PRECISION (TREE_TYPE (expr)) - >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (expr, 0)))) - return truthvalue_conversion (TREE_OPERAND (expr, 0)); - break; - - case MINUS_EXPR: - /* With IEEE arithmetic, x - x may not equal 0, so we can't optimize - this case. */ - if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT - && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE) - break; - /* fall through... */ - case BIT_XOR_EXPR: - /* This and MINUS_EXPR can be changed into a comparison of the - two objects. */ - if (TREE_TYPE (TREE_OPERAND (expr, 0)) - == TREE_TYPE (TREE_OPERAND (expr, 1))) - return build_binary_op (NE_EXPR, TREE_OPERAND (expr, 0), - TREE_OPERAND (expr, 1), 1); - return build_binary_op (NE_EXPR, TREE_OPERAND (expr, 0), - fold (build1 (NOP_EXPR, - TREE_TYPE (TREE_OPERAND (expr, 0)), - TREE_OPERAND (expr, 1))), 1); - - case BIT_AND_EXPR: - if (integer_onep (TREE_OPERAND (expr, 1)) - && TREE_TYPE (expr) != boolean_type_node) - /* Using convert here would cause infinite recursion. */ - return build1 (NOP_EXPR, boolean_type_node, expr); - break; - - case MODIFY_EXPR: - if (warn_parentheses && C_EXP_ORIGINAL_CODE (expr) == MODIFY_EXPR) - warning ("suggest parentheses around assignment used as truth value"); - break; - - default: - break; - } - - if (TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE) - { - tree tem = save_expr (expr); - return (build_binary_op - ((TREE_SIDE_EFFECTS (expr) - ? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR), - truthvalue_conversion (build_unary_op (REALPART_EXPR, tem, 0)), - truthvalue_conversion (build_unary_op (IMAGPART_EXPR, tem, 0)), - 0)); - } - - return build_binary_op (NE_EXPR, expr, integer_zero_node, 1); -} - -#if USE_CPPLIB -/* Read the rest of a #-directive from input stream FINPUT. - In normal use, the directive name and the white space after it - have already been read, so they won't be included in the result. - We allow for the fact that the directive line may contain - a newline embedded within a character or string literal which forms - a part of the directive. - - The value is a string in a reusable buffer. It remains valid - only until the next time this function is called. */ -unsigned char *yy_cur, *yy_lim; - -#define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ()) -#define UNGETC(c) ((c) == EOF ? 0 : yy_cur--) - -int -yy_get_token () -{ - for (;;) - { - parse_in.limit = parse_in.token_buffer; - cpp_token = cpp_get_token (&parse_in); - if (cpp_token == CPP_EOF) - return -1; - yy_lim = CPP_PWRITTEN (&parse_in); - yy_cur = parse_in.token_buffer; - if (yy_cur < yy_lim) - return *yy_cur++; - } -} - -char * -get_directive_line () -{ - static char *directive_buffer = NULL; - static unsigned buffer_length = 0; - register char *p; - register char *buffer_limit; - register int looking_for = 0; - register int char_escaped = 0; - - if (buffer_length == 0) - { - directive_buffer = (char *)xmalloc (128); - buffer_length = 128; - } - - buffer_limit = &directive_buffer[buffer_length]; - - for (p = directive_buffer; ; ) - { - int c; - - /* Make buffer bigger if it is full. */ - if (p >= buffer_limit) - { - register unsigned bytes_used = (p - directive_buffer); - - buffer_length *= 2; - directive_buffer - = (char *)xrealloc (directive_buffer, buffer_length); - p = &directive_buffer[bytes_used]; - buffer_limit = &directive_buffer[buffer_length]; - } - - c = GETC (); - - /* Discard initial whitespace. */ - if ((c == ' ' || c == '\t') && p == directive_buffer) - continue; - - /* Detect the end of the directive. */ - if (c == '\n' && looking_for == 0) - { - UNGETC (c); - c = '\0'; - } - - *p++ = c; - - if (c == 0) - return directive_buffer; - - /* Handle string and character constant syntax. */ - if (looking_for) - { - if (looking_for == c && !char_escaped) - looking_for = 0; /* Found terminator... stop looking. */ - } - else - if (c == '\'' || c == '"') - looking_for = c; /* Don't stop buffering until we see another - another one of these (or an EOF). */ - - /* Handle backslash. */ - char_escaped = (c == '\\' && ! char_escaped); - } -} -#else -/* Read the rest of a #-directive from input stream FINPUT. - In normal use, the directive name and the white space after it - have already been read, so they won't be included in the result. - We allow for the fact that the directive line may contain - a newline embedded within a character or string literal which forms - a part of the directive. - - The value is a string in a reusable buffer. It remains valid - only until the next time this function is called. - - The terminating character ('\n' or EOF) is left in FINPUT for the - caller to re-read. */ - -char * -get_directive_line (finput) - register FILE *finput; -{ - static char *directive_buffer = NULL; - static unsigned buffer_length = 0; - register char *p; - register char *buffer_limit; - register int looking_for = 0; - register int char_escaped = 0; - - if (buffer_length == 0) - { - directive_buffer = (char *)xmalloc (128); - buffer_length = 128; - } - - buffer_limit = &directive_buffer[buffer_length]; - - for (p = directive_buffer; ; ) - { - int c; - - /* Make buffer bigger if it is full. */ - if (p >= buffer_limit) - { - register unsigned bytes_used = (p - directive_buffer); - - buffer_length *= 2; - directive_buffer - = (char *)xrealloc (directive_buffer, buffer_length); - p = &directive_buffer[bytes_used]; - buffer_limit = &directive_buffer[buffer_length]; - } - - c = getc (finput); - - /* Discard initial whitespace. */ - if ((c == ' ' || c == '\t') && p == directive_buffer) - continue; - - /* Detect the end of the directive. */ - if (looking_for == 0 - && (c == '\n' || c == EOF)) - { - ungetc (c, finput); - c = '\0'; - } - - *p++ = c; - - if (c == 0) - return directive_buffer; - - /* Handle string and character constant syntax. */ - if (looking_for) - { - if (looking_for == c && !char_escaped) - looking_for = 0; /* Found terminator... stop looking. */ - } - else - if (c == '\'' || c == '"') - looking_for = c; /* Don't stop buffering until we see another - one of these (or an EOF). */ - - /* Handle backslash. */ - char_escaped = (c == '\\' && ! char_escaped); - } -} -#endif /* !USE_CPPLIB */ - -/* Make a variant type in the proper way for C/C++, propagating qualifiers - down to the element type of an array. */ - -tree -c_build_qualified_type (type, type_quals) - tree type; - int type_quals; -{ - /* A restrict-qualified pointer type must be a pointer to object or - incomplete type. Note that the use of POINTER_TYPE_P also allows - REFERENCE_TYPEs, which is appropriate for C++. Unfortunately, - the C++ front-end also use POINTER_TYPE for pointer-to-member - values, so even though it should be illegal to use `restrict' - with such an entity we don't flag that here. Thus, special case - code for that case is required in the C++ front-end. */ - if ((type_quals & TYPE_QUAL_RESTRICT) - && (!POINTER_TYPE_P (type) - || !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (type)))) - { - error ("invalid use of `restrict'"); - type_quals &= ~TYPE_QUAL_RESTRICT; - } - - if (TREE_CODE (type) == ARRAY_TYPE) - return build_array_type (c_build_qualified_type (TREE_TYPE (type), - type_quals), - TYPE_DOMAIN (type)); - return build_qualified_type (type, type_quals); -} - -/* Apply the TYPE_QUALS to the new DECL. */ - -void -c_apply_type_quals_to_decl (type_quals, decl) - int type_quals; - tree decl; -{ - if (type_quals & TYPE_QUAL_CONST) - TREE_READONLY (decl) = 1; - if (type_quals & TYPE_QUAL_VOLATILE) - { - TREE_SIDE_EFFECTS (decl) = 1; - TREE_THIS_VOLATILE (decl) = 1; - } - if (type_quals & TYPE_QUAL_RESTRICT) - { - if (!TREE_TYPE (decl) - || !POINTER_TYPE_P (TREE_TYPE (decl)) - || !C_TYPE_OBJECT_OR_INCOMPLETE_P (TREE_TYPE (TREE_TYPE (decl)))) - error ("invalid use of `restrict'"); - else if (flag_strict_aliasing) - { - /* No two restricted pointers can point at the same thing. - However, a restricted pointer can point at the same thing - as an unrestricted pointer, if that unrestricted pointer - is based on the restricted pointer. So, we make the - alias set for the restricted pointer a subset of the - alias set for the type pointed to by the type of the - decl. */ - - int pointed_to_alias_set - = get_alias_set (TREE_TYPE (TREE_TYPE (decl))); - - if (!pointed_to_alias_set) - /* It's not legal to make a subset of alias set zero. */ - ; - else - { - DECL_POINTER_ALIAS_SET (decl) = new_alias_set (); - record_alias_subset (pointed_to_alias_set, - DECL_POINTER_ALIAS_SET (decl)); - } - } - } -} - -/* T is an expression with pointer type. Find the DECL on which this - expression is based. (For example, in `a[i]' this would be `a'.) - If there is no such DECL, or a unique decl cannot be determined, - NULL_TREE is retured. */ - -static tree -c_find_base_decl (t) - tree t; -{ - int i; - tree decl; - - if (t == NULL_TREE || t == error_mark_node) - return NULL_TREE; - - if (!POINTER_TYPE_P (TREE_TYPE (t))) - return NULL_TREE; - - decl = NULL_TREE; - - if (TREE_CODE (t) == FIELD_DECL - || TREE_CODE (t) == PARM_DECL - || TREE_CODE (t) == VAR_DECL) - /* Aha, we found a pointer-typed declaration. */ - return t; - - /* It would be nice to deal with COMPONENT_REFs here. If we could - tell that `a' and `b' were the same, then `a->f' and `b->f' are - also the same. */ - - /* Handle general expressions. */ - switch (TREE_CODE_CLASS (TREE_CODE (t))) - { - case '1': - case '2': - case '3': - for (i = tree_code_length [(int) TREE_CODE (t)]; --i >= 0;) - { - tree d = c_find_base_decl (TREE_OPERAND (t, i)); - if (d) - { - if (!decl) - decl = d; - else if (d && d != decl) - /* Two different declarations. That's confusing; let's - just assume we don't know what's going on. */ - decl = NULL_TREE; - } - } - break; - - default: - break; - } - - return decl; -} - -/* Return the typed-based alias set for T, which may be an expression - or a type. */ - -int -c_get_alias_set (t) - tree t; -{ - tree type; - tree u; - - if (t == error_mark_node) - return 0; - - type = (TREE_CODE_CLASS (TREE_CODE (t)) == 't') - ? t : TREE_TYPE (t); - - if (type == error_mark_node) - return 0; - - /* Deal with special cases first; for certain kinds of references - we're interested in more than just the type. */ - - if (TREE_CODE (t) == BIT_FIELD_REF) - /* Perhaps reads and writes to this piece of data alias fields - neighboring the bitfield. Perhaps that's impossible. For now, - let's just assume that bitfields can alias everything, which is - the conservative assumption. */ - return 0; - - /* Permit type-punning when accessing a union, provided the access - is directly through the union. For example, this code does not - permit taking the address of a union member and then storing - through it. Even the type-punning allowed here is a GCC - extension, albeit a common and useful one; the C standard says - that such accesses have implementation-defined behavior. */ - for (u = t; - TREE_CODE (u) == COMPONENT_REF || TREE_CODE (u) == ARRAY_REF; - u = TREE_OPERAND (u, 0)) - if (TREE_CODE (u) == COMPONENT_REF - && TREE_CODE (TREE_TYPE (TREE_OPERAND (u, 0))) == UNION_TYPE) - return 0; - - if (TREE_CODE (t) == INDIRECT_REF) - { - /* Check for accesses through restrict-qualified pointers. */ - tree decl = c_find_base_decl (TREE_OPERAND (t, 0)); - - if (decl && DECL_POINTER_ALIAS_SET_KNOWN_P (decl)) - /* We use the alias set indicated in the declaration. */ - return DECL_POINTER_ALIAS_SET (decl); - } - - /* From here on, only the type matters. */ - - if (TREE_CODE (t) == COMPONENT_REF - && DECL_BIT_FIELD_TYPE (TREE_OPERAND (t, 1))) - /* Since build_modify_expr calls get_unwidened for stores to - component references, the type of a bit field can be changed - from (say) `unsigned int : 16' to `unsigned short' or from - `enum E : 16' to `short'. We want the real type of the - bit-field in this case, not some the integral equivalent. */ - type = DECL_BIT_FIELD_TYPE (TREE_OPERAND (t, 1)); - - if (TYPE_ALIAS_SET_KNOWN_P (type)) - /* If we've already calculated the value, just return it. */ - return TYPE_ALIAS_SET (type); - else if (TYPE_MAIN_VARIANT (type) != type) - /* The C standard specifically allows aliasing between - cv-qualified variants of types. */ - TYPE_ALIAS_SET (type) = c_get_alias_set (TYPE_MAIN_VARIANT (type)); - else if (TREE_CODE (type) == INTEGER_TYPE) - { - tree signed_variant; - - /* The C standard specifically allows aliasing between signed and - unsigned variants of the same type. We treat the signed - variant as canonical. */ - signed_variant = signed_type (type); - - if (signed_variant != type) - TYPE_ALIAS_SET (type) = c_get_alias_set (signed_variant); - else if (signed_variant == signed_char_type_node) - /* The C standard guarantess that any object may be accessed - via an lvalue that has character type. We don't have to - check for unsigned_char_type_node or char_type_node because - we are specifically looking at the signed variant. */ - TYPE_ALIAS_SET (type) = 0; - } - else if (TREE_CODE (type) == ARRAY_TYPE) - /* Anything that can alias one of the array elements can alias - the entire array as well. */ - TYPE_ALIAS_SET (type) = c_get_alias_set (TREE_TYPE (type)); - else if (TREE_CODE (type) == FUNCTION_TYPE) - /* There are no objects of FUNCTION_TYPE, so there's no point in - using up an alias set for them. (There are, of course, - pointers and references to functions, but that's - different.) */ - TYPE_ALIAS_SET (type) = 0; - else if (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE) - /* If TYPE is a struct or union type then we're reading or - writing an entire struct. Thus, we don't know anything about - aliasing. (In theory, such an access can only alias objects - whose type is the same as one of the fields, recursively, but - we don't yet make any use of that information.) */ - TYPE_ALIAS_SET (type) = 0; - else if (TREE_CODE (type) == POINTER_TYPE - || TREE_CODE (type) == REFERENCE_TYPE) - { - tree t; - - /* Unfortunately, there is no canonical form of a pointer type. - In particular, if we have `typedef int I', then `int *', and - `I *' are different types. So, we have to pick a canonical - representative. We do this below. - - Technically, this approach is actually more conservative that - it needs to be. In particular, `const int *' and `int *' - chould be in different alias sets, according to the C and C++ - standard, since their types are not the same, and so, - technically, an `int **' and `const int **' cannot point at - the same thing. - - But, the standard is wrong. In particular, this code is - legal C++: - - int *ip; - int **ipp = &ip; - const int* const* cipp = &ip; - - And, it doesn't make sense for that to be legal unless you - can dereference IPP and CIPP. So, we ignore cv-qualifiers on - the pointed-to types. This issue has been reported to the - C++ committee. */ - t = TYPE_MAIN_VARIANT (TREE_TYPE (type)); - t = ((TREE_CODE (type) == POINTER_TYPE) - ? build_pointer_type (t) : build_reference_type (t)); - if (t != type) - TYPE_ALIAS_SET (type) = c_get_alias_set (t); - } - - if (!TYPE_ALIAS_SET_KNOWN_P (type)) - { - /* Types that are not allocated on the permanent obstack are not - placed in the type hash table. Thus, there can be multiple - copies of identical types in local scopes. In the long run, - all types should be permanent. */ - if (! TREE_PERMANENT (type)) - TYPE_ALIAS_SET (type) = 0; - else - /* TYPE is something we haven't seen before. Put it in a new - alias set. */ - TYPE_ALIAS_SET (type) = new_alias_set (); - } - - return TYPE_ALIAS_SET (type); -} diff --git a/contrib/gcc/c-convert.c b/contrib/gcc/c-convert.c deleted file mode 100644 index 9cb941662f2c..000000000000 --- a/contrib/gcc/c-convert.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Language-level data type conversion for GNU C. - Copyright (C) 1987, 1988, 1991, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* This file contains the functions for converting C expressions - to different data types. The only entry point is `convert'. - Every language front end must have a `convert' function - but what kind of conversions it does will depend on the language. */ - -#include "config.h" -#include "tree.h" -#include "flags.h" -#include "convert.h" -#include "toplev.h" - -/* Change of width--truncation and extension of integers or reals-- - is represented with NOP_EXPR. Proper functioning of many things - assumes that no other conversions can be NOP_EXPRs. - - Conversion between integer and pointer is represented with CONVERT_EXPR. - Converting integer to real uses FLOAT_EXPR - and real to integer uses FIX_TRUNC_EXPR. - - Here is a list of all the functions that assume that widening and - narrowing is always done with a NOP_EXPR: - In convert.c, convert_to_integer. - In c-typeck.c, build_binary_op (boolean ops), and truthvalue_conversion. - In expr.c: expand_expr, for operands of a MULT_EXPR. - In fold-const.c: fold. - In tree.c: get_narrower and get_unwidened. */ - -/* Subroutines of `convert'. */ - - - -/* Create an expression whose value is that of EXPR, - converted to type TYPE. The TREE_TYPE of the value - is always TYPE. This function implements all reasonable - conversions; callers should filter out those that are - not permitted by the language being compiled. */ - -tree -convert (type, expr) - tree type, expr; -{ - register tree e = expr; - register enum tree_code code = TREE_CODE (type); - - if (type == TREE_TYPE (expr) - || TREE_CODE (expr) == ERROR_MARK) - return expr; - if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr))) - return fold (build1 (NOP_EXPR, type, expr)); - if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK) - return error_mark_node; - if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE) - { - error ("void value not ignored as it ought to be"); - return error_mark_node; - } - if (code == VOID_TYPE) - return build1 (CONVERT_EXPR, type, e); -#if 0 - /* This is incorrect. A truncation can't be stripped this way. - Extensions will be stripped by the use of get_unwidened. */ - if (TREE_CODE (expr) == NOP_EXPR) - return convert (type, TREE_OPERAND (expr, 0)); -#endif - if (code == INTEGER_TYPE || code == ENUMERAL_TYPE) - return fold (convert_to_integer (type, e)); - if (code == POINTER_TYPE) - return fold (convert_to_pointer (type, e)); - if (code == REAL_TYPE) - return fold (convert_to_real (type, e)); - if (code == COMPLEX_TYPE) - return fold (convert_to_complex (type, e)); - - error ("conversion to non-scalar type requested"); - return error_mark_node; -} diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c deleted file mode 100644 index 8844988fa8f3..000000000000 --- a/contrib/gcc/c-decl.c +++ /dev/null @@ -1,7452 +0,0 @@ -/* Process declarations and variables for C compiler. - Copyright (C) 1988, 92-98, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Process declarations and symbol lookup for C front end. - Also constructs types; the standard scalar types at initialization, - and structure, union, array and enum types when they are declared. */ - -/* ??? not all decl nodes are given the most useful possible - line numbers. For example, the CONST_DECLs for enum values. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "flags.h" -#include "output.h" -#include "c-tree.h" -#include "c-lex.h" -#include "toplev.h" - -#if USE_CPPLIB -#include "cpplib.h" -extern cpp_reader parse_in; -#endif - -/* In grokdeclarator, distinguish syntactic contexts of declarators. */ -enum decl_context -{ NORMAL, /* Ordinary declaration */ - FUNCDEF, /* Function definition */ - PARM, /* Declaration of parm before function body */ - FIELD, /* Declaration inside struct or union */ - BITFIELD, /* Likewise but with specified width */ - TYPENAME}; /* Typename (inside cast or sizeof) */ - -#ifndef CHAR_TYPE_SIZE -#define CHAR_TYPE_SIZE BITS_PER_UNIT -#endif - -#ifndef SHORT_TYPE_SIZE -#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2)) -#endif - -#ifndef INT_TYPE_SIZE -#define INT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_LONG_TYPE_SIZE -#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef WCHAR_UNSIGNED -#define WCHAR_UNSIGNED 0 -#endif - -#ifndef FLOAT_TYPE_SIZE -#define FLOAT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef DOUBLE_TYPE_SIZE -#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -/* We let tm.h override the types used here, to handle trivial differences - such as the choice of unsigned int or long unsigned int for size_t. - When machines start needing nontrivial differences in the size type, - it would be best to do something here to figure out automatically - from other information what type to use. */ - -#ifndef SIZE_TYPE -#define SIZE_TYPE "long unsigned int" -#endif - -#ifndef PTRDIFF_TYPE -#define PTRDIFF_TYPE "long int" -#endif - -#ifndef WCHAR_TYPE -#define WCHAR_TYPE "int" -#endif - -/* a node which has tree code ERROR_MARK, and whose type is itself. - All erroneous expressions are replaced with this node. All functions - that accept nodes as arguments should avoid generating error messages - if this node is one of the arguments, since it is undesirable to get - multiple error messages from one error in the input. */ - -tree error_mark_node; - -/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */ - -tree short_integer_type_node; -tree integer_type_node; -tree long_integer_type_node; -tree long_long_integer_type_node; - -tree short_unsigned_type_node; -tree unsigned_type_node; -tree long_unsigned_type_node; -tree long_long_unsigned_type_node; - -tree boolean_type_node; -tree boolean_false_node; -tree boolean_true_node; - -tree ptrdiff_type_node; - -tree unsigned_char_type_node; -tree signed_char_type_node; -tree char_type_node; -tree wchar_type_node; -tree signed_wchar_type_node; -tree unsigned_wchar_type_node; - -tree float_type_node; -tree double_type_node; -tree long_double_type_node; - -tree complex_integer_type_node; -tree complex_float_type_node; -tree complex_double_type_node; -tree complex_long_double_type_node; - -tree intQI_type_node; -tree intHI_type_node; -tree intSI_type_node; -tree intDI_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -tree intTI_type_node; -#endif - -tree unsigned_intQI_type_node; -tree unsigned_intHI_type_node; -tree unsigned_intSI_type_node; -tree unsigned_intDI_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -tree unsigned_intTI_type_node; -#endif - -/* a VOID_TYPE node. */ - -tree void_type_node; - -/* Nodes for types `void *' and `const void *'. */ - -tree ptr_type_node, const_ptr_type_node; - -/* Nodes for types `char *' and `const char *'. */ - -tree string_type_node, const_string_type_node; - -/* Type `char[SOMENUMBER]'. - Used when an array of char is needed and the size is irrelevant. */ - -tree char_array_type_node; - -/* Type `int[SOMENUMBER]' or something like it. - Used when an array of int needed and the size is irrelevant. */ - -tree int_array_type_node; - -/* Type `wchar_t[SOMENUMBER]' or something like it. - Used when a wide string literal is created. */ - -tree wchar_array_type_node; - -/* type `int ()' -- used for implicit declaration of functions. */ - -tree default_function_type; - -/* function types `double (double)' and `double (double, double)', etc. */ - -tree double_ftype_double, double_ftype_double_double; -tree int_ftype_int, long_ftype_long; -tree float_ftype_float; -tree ldouble_ftype_ldouble; - -/* Function type `void (void *, void *, int)' and similar ones */ - -tree void_ftype_ptr_ptr_int, int_ftype_ptr_ptr_int, void_ftype_ptr_int_int; - -/* Function type `char *(char *, char *)' and similar ones */ -tree string_ftype_ptr_ptr, int_ftype_string_string; - -/* Function type `int (const void *, const void *, size_t)' */ -tree int_ftype_cptr_cptr_sizet; - -/* Two expressions that are constants with value zero. - The first is of type `int', the second of type `void *'. */ - -tree integer_zero_node; -tree null_pointer_node; - -/* A node for the integer constant 1. */ - -tree integer_one_node; - -/* Nonzero if we have seen an invalid cross reference - to a struct, union, or enum, but not yet printed the message. */ - -tree pending_invalid_xref; -/* File and line to appear in the eventual error message. */ -char *pending_invalid_xref_file; -int pending_invalid_xref_line; - -/* While defining an enum type, this is 1 plus the last enumerator - constant value. Note that will do not have to save this or `enum_overflow' - around nested function definition since such a definition could only - occur in an enum value expression and we don't use these variables in - that case. */ - -static tree enum_next_value; - -/* Nonzero means that there was overflow computing enum_next_value. */ - -static int enum_overflow; - -/* Parsing a function declarator leaves a list of parameter names - or a chain or parameter decls here. */ - -static tree last_function_parms; - -/* Parsing a function declarator leaves here a chain of structure - and enum types declared in the parmlist. */ - -static tree last_function_parm_tags; - -/* After parsing the declarator that starts a function definition, - `start_function' puts here the list of parameter names or chain of decls. - `store_parm_decls' finds it here. */ - -static tree current_function_parms; - -/* Similar, for last_function_parm_tags. */ -static tree current_function_parm_tags; - -/* Similar, for the file and line that the prototype came from if this is - an old-style definition. */ -static char *current_function_prototype_file; -static int current_function_prototype_line; - -/* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function - that have names. Here so we can clear out their names' definitions - at the end of the function. */ - -static tree named_labels; - -/* A list of LABEL_DECLs from outer contexts that are currently shadowed. */ - -static tree shadowed_labels; - -/* Nonzero when store_parm_decls is called indicates a varargs function. - Value not meaningful after store_parm_decls. */ - -static int c_function_varargs; - -/* The FUNCTION_DECL for the function currently being compiled, - or 0 if between functions. */ -tree current_function_decl; - -/* Set to 0 at beginning of a function definition, set to 1 if - a return statement that specifies a return value is seen. */ - -int current_function_returns_value; - -/* Set to 0 at beginning of a function definition, set to 1 if - a return statement with no argument is seen. */ - -int current_function_returns_null; - -/* Set to nonzero by `grokdeclarator' for a function - whose return type is defaulted, if warnings for this are desired. */ - -static int warn_about_return_type; - -/* Nonzero when starting a function declared `extern inline'. */ - -static int current_extern_inline; - -/* For each binding contour we allocate a binding_level structure - * which records the names defined in that contour. - * Contours include: - * 0) the global one - * 1) one for each function definition, - * where internal declarations of the parameters appear. - * 2) one for each compound statement, - * to record its declarations. - * - * The current meaning of a name can be found by searching the levels from - * the current one out to the global one. - */ - -/* Note that the information in the `names' component of the global contour - is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */ - -struct binding_level - { - /* A chain of _DECL nodes for all variables, constants, functions, - and typedef types. These are in the reverse of the order supplied. - */ - tree names; - - /* A list of structure, union and enum definitions, - * for looking up tag names. - * It is a chain of TREE_LIST nodes, each of whose TREE_PURPOSE is a name, - * or NULL_TREE; and whose TREE_VALUE is a RECORD_TYPE, UNION_TYPE, - * or ENUMERAL_TYPE node. - */ - tree tags; - - /* For each level, a list of shadowed outer-level local definitions - to be restored when this level is popped. - Each link is a TREE_LIST whose TREE_PURPOSE is an identifier and - whose TREE_VALUE is its old definition (a kind of ..._DECL node). */ - tree shadowed; - - /* For each level (except not the global one), - a chain of BLOCK nodes for all the levels - that were entered and exited one level down. */ - tree blocks; - - /* The BLOCK node for this level, if one has been preallocated. - If 0, the BLOCK is allocated (if needed) when the level is popped. */ - tree this_block; - - /* The binding level which this one is contained in (inherits from). */ - struct binding_level *level_chain; - - /* Nonzero for the level that holds the parameters of a function. */ - char parm_flag; - - /* Nonzero if this level "doesn't exist" for tags. */ - char tag_transparent; - - /* Nonzero if sublevels of this level "don't exist" for tags. - This is set in the parm level of a function definition - while reading the function body, so that the outermost block - of the function body will be tag-transparent. */ - char subblocks_tag_transparent; - - /* Nonzero means make a BLOCK for this level regardless of all else. */ - char keep; - - /* Nonzero means make a BLOCK if this level has any subblocks. */ - char keep_if_subblocks; - - /* Number of decls in `names' that have incomplete - structure or union types. */ - int n_incomplete; - - /* A list of decls giving the (reversed) specified order of parms, - not including any forward-decls in the parmlist. - This is so we can put the parms in proper order for assign_parms. */ - tree parm_order; - }; - -#define NULL_BINDING_LEVEL (struct binding_level *) NULL - -/* The binding level currently in effect. */ - -static struct binding_level *current_binding_level; - -/* A chain of binding_level structures awaiting reuse. */ - -static struct binding_level *free_binding_level; - -/* The outermost binding level, for names of file scope. - This is created when the compiler is started and exists - through the entire run. */ - -static struct binding_level *global_binding_level; - -/* Binding level structures are initialized by copying this one. */ - -static struct binding_level clear_binding_level - = {NULL, NULL, NULL, NULL, NULL, NULL_BINDING_LEVEL, 0, 0, 0, 0, 0, 0, - NULL}; - -/* Nonzero means unconditionally make a BLOCK for the next level pushed. */ - -static int keep_next_level_flag; - -/* Nonzero means make a BLOCK for the next level pushed - if it has subblocks. */ - -static int keep_next_if_subblocks; - -/* The chain of outer levels of label scopes. - This uses the same data structure used for binding levels, - but it works differently: each link in the chain records - saved values of named_labels and shadowed_labels for - a label binding level outside the current one. */ - -static struct binding_level *label_level_chain; - -/* Functions called automatically at the beginning and end of execution. */ - -tree static_ctors, static_dtors; - -/* Forward declarations. */ - -static struct binding_level * make_binding_level PROTO((void)); -static void clear_limbo_values PROTO((tree)); -static int duplicate_decls PROTO((tree, tree, int)); -static int redeclaration_error_message PROTO((tree, tree)); -static void storedecls PROTO((tree)); -static void storetags PROTO((tree)); -static tree lookup_tag PROTO((enum tree_code, tree, - struct binding_level *, int)); -static tree lookup_tag_reverse PROTO((tree)); -static tree grokdeclarator PROTO((tree, tree, enum decl_context, - int)); -static tree grokparms PROTO((tree, int)); -static int field_decl_cmp PROTO((const GENERIC_PTR, const GENERIC_PTR)); -static void layout_array_type PROTO((tree)); - -/* C-specific option variables. */ - -/* Nonzero means allow type mismatches in conditional expressions; - just make their values `void'. */ - -int flag_cond_mismatch; - -/* Nonzero means give `double' the same size as `float'. */ - -int flag_short_double; - -/* Nonzero means don't recognize the keyword `asm'. */ - -int flag_no_asm; - -/* Nonzero means don't recognize any builtin functions. */ - -int flag_no_builtin; - -/* Nonzero means don't recognize the non-ANSI builtin functions. - -ansi sets this. */ - -int flag_no_nonansi_builtin; - -/* Nonzero means do some things the same way PCC does. */ - -int flag_traditional; - -/* Nonzero means use the ISO C9x dialect of C. */ - -int flag_isoc9x = 0; - -/* Nonzero means that we have builtin functions, and main is an int */ - -int flag_hosted = 1; - -/* Nonzero means to allow single precision math even if we're generally - being traditional. */ -int flag_allow_single_precision = 0; - -/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */ - -int flag_signed_bitfields = 1; -int explicit_flag_signed_bitfields = 0; - -/* Nonzero means warn about use of implicit int. */ - -int warn_implicit_int; - -/* Nonzero means warn about usage of long long when `-pedantic'. */ - -int warn_long_long = 1; - -/* Nonzero means message about use of implicit function declarations; - 1 means warning; 2 means error. */ - -int mesg_implicit_function_declaration; - -/* Nonzero means give string constants the type `const char *' - to get extra warnings from them. These warnings will be too numerous - to be useful, except in thoroughly ANSIfied programs. */ - -int flag_const_strings; - -/* Nonzero means warn about pointer casts that can drop a type qualifier - from the pointer target type. */ - -int warn_cast_qual; - -/* Nonzero means warn when casting a function call to a type that does - not match the return type (e.g. (float)sqrt() or (anything*)malloc() - when there is no previous declaration of sqrt or malloc. */ - -int warn_bad_function_cast; - -/* Warn about functions which might be candidates for attribute noreturn. */ - -int warn_missing_noreturn; - -/* Warn about traditional constructs whose meanings changed in ANSI C. */ - -int warn_traditional; - -/* Nonzero means warn about sizeof(function) or addition/subtraction - of function pointers. */ - -int warn_pointer_arith; - -/* Nonzero means warn for non-prototype function decls - or non-prototyped defs without previous prototype. */ - -int warn_strict_prototypes; - -/* Nonzero means warn for any global function def - without separate previous prototype decl. */ - -int warn_missing_prototypes; - -/* Nonzero means warn for any global function def - without separate previous decl. */ - -int warn_missing_declarations; - -/* Nonzero means warn about multiple (redundant) decls for the same single - variable or function. */ - -int warn_redundant_decls = 0; - -/* Nonzero means warn about extern declarations of objects not at - file-scope level and about *all* declarations of functions (whether - extern or static) not at file-scope level. Note that we exclude - implicit function declarations. To get warnings about those, use - -Wimplicit. */ - -int warn_nested_externs = 0; - -/* Warn about *printf or *scanf format/argument anomalies. */ - -int warn_format; - -/* Warn about a subscript that has type char. */ - -int warn_char_subscripts = 0; - -/* Warn if a type conversion is done that might have confusing results. */ - -int warn_conversion; - -/* Warn if adding () is suggested. */ - -int warn_parentheses; - -/* Warn if initializer is not completely bracketed. */ - -int warn_missing_braces; - -/* Warn if main is suspicious. */ - -int warn_main; - -/* Warn about #pragma directives that are not recognised. */ - -int warn_unknown_pragmas = 0; /* Tri state variable. */ - -/* Warn about comparison of signed and unsigned values. - If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */ - -int warn_sign_compare = -1; - -/* Nonzero means warn about use of multicharacter literals. */ - -int warn_multichar = 1; - -/* Nonzero means `$' can be in an identifier. */ - -#ifndef DOLLARS_IN_IDENTIFIERS -#define DOLLARS_IN_IDENTIFIERS 1 -#endif -int dollars_in_ident = DOLLARS_IN_IDENTIFIERS; - -/* Decode the string P as a language-specific option for C. - Return the number of strings consumed. */ - -int -c_decode_option (argc, argv) - int argc ATTRIBUTE_UNUSED; - char **argv; -{ - int strings_processed; - char *p = argv[0]; -#if USE_CPPLIB - strings_processed = cpp_handle_option (&parse_in, argc, argv); -#else - strings_processed = 0; -#endif /* ! USE_CPPLIB */ - - if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) - { - flag_traditional = 1; - flag_writable_strings = 1; - } - else if (!strcmp (p, "-fallow-single-precision")) - flag_allow_single_precision = 1; - else if (!strcmp (p, "-fhosted") || !strcmp (p, "-fno-freestanding")) - { - flag_hosted = 1; - flag_no_builtin = 0; - } - else if (!strcmp (p, "-ffreestanding") || !strcmp (p, "-fno-hosted")) - { - flag_hosted = 0; - flag_no_builtin = 1; - /* warn_main will be 2 if set by -Wall, 1 if set by -Wmain */ - if (warn_main == 2) - warn_main = 0; - } - else if (!strcmp (p, "-fnotraditional") || !strcmp (p, "-fno-traditional")) - { - flag_traditional = 0; - flag_writable_strings = 0; - } - else if (!strncmp (p, "-std=", 5)) - { - /* Select the appropriate language standard. We currently - recognize: - -std=iso9899:1990 same as -ansi - -std=iso9899:199409 ISO C as modified in amend. 1 - -std=iso9899:199x ISO C 9x - -std=c89 same as -std=iso9899:1990 - -std=c9x same as -std=iso9899:199x - -std=gnu89 default, iso9899:1990 + gnu extensions - -std=gnu9x iso9899:199x + gnu extensions - */ - const char *argstart = &p[5]; - - if (!strcmp (argstart, "iso9899:1990") - || !strcmp (argstart, "c89")) - { - iso_1990: - flag_traditional = 0; - flag_writable_strings = 0; - flag_no_asm = 1; - flag_no_nonansi_builtin = 1; - flag_isoc9x = 0; - } - else if (!strcmp (argstart, "iso9899:199409")) - { - /* ??? The changes since ISO C 1990 are not supported. */ - goto iso_1990; - } - else if (!strcmp (argstart, "iso9899:199x") - || !strcmp (argstart, "c9x")) - { - flag_traditional = 0; - flag_writable_strings = 0; - flag_no_asm = 1; - flag_no_nonansi_builtin = 1; - flag_isoc9x = 1; - } - else if (!strcmp (argstart, "gnu89")) - { - flag_traditional = 0; - flag_writable_strings = 0; - flag_no_asm = 0; - flag_no_nonansi_builtin = 0; - flag_isoc9x = 0; - } - else if (!strcmp (argstart, "gnu9x")) - { - flag_traditional = 0; - flag_writable_strings = 0; - flag_no_asm = 0; - flag_no_nonansi_builtin = 0; - flag_isoc9x = 1; - } - else - error ("unknown C standard `%s'", argstart); - } - else if (!strcmp (p, "-fdollars-in-identifiers")) - dollars_in_ident = 1; - else if (!strcmp (p, "-fno-dollars-in-identifiers")) - dollars_in_ident = 0; - else if (!strcmp (p, "-fsigned-char")) - flag_signed_char = 1; - else if (!strcmp (p, "-funsigned-char")) - flag_signed_char = 0; - else if (!strcmp (p, "-fno-signed-char")) - flag_signed_char = 0; - else if (!strcmp (p, "-fno-unsigned-char")) - flag_signed_char = 1; - else if (!strcmp (p, "-fsigned-bitfields") - || !strcmp (p, "-fno-unsigned-bitfields")) - { - flag_signed_bitfields = 1; - explicit_flag_signed_bitfields = 1; - } - else if (!strcmp (p, "-funsigned-bitfields") - || !strcmp (p, "-fno-signed-bitfields")) - { - flag_signed_bitfields = 0; - explicit_flag_signed_bitfields = 1; - } - else if (!strcmp (p, "-fshort-enums")) - flag_short_enums = 1; - else if (!strcmp (p, "-fno-short-enums")) - flag_short_enums = 0; - else if (!strcmp (p, "-fcond-mismatch")) - flag_cond_mismatch = 1; - else if (!strcmp (p, "-fno-cond-mismatch")) - flag_cond_mismatch = 0; - else if (!strcmp (p, "-fshort-double")) - flag_short_double = 1; - else if (!strcmp (p, "-fno-short-double")) - flag_short_double = 0; - else if (!strcmp (p, "-fasm")) - flag_no_asm = 0; - else if (!strcmp (p, "-fno-asm")) - flag_no_asm = 1; - else if (!strcmp (p, "-fbuiltin")) - flag_no_builtin = 0; - else if (!strcmp (p, "-fno-builtin")) - flag_no_builtin = 1; - else if (!strcmp (p, "-ansi")) - goto iso_1990; - else if (!strcmp (p, "-Werror-implicit-function-declaration")) - mesg_implicit_function_declaration = 2; - else if (!strcmp (p, "-Wimplicit-function-declaration")) - mesg_implicit_function_declaration = 1; - else if (!strcmp (p, "-Wno-implicit-function-declaration")) - mesg_implicit_function_declaration = 0; - else if (!strcmp (p, "-Wimplicit-int")) - warn_implicit_int = 1; - else if (!strcmp (p, "-Wno-implicit-int")) - warn_implicit_int = 0; - else if (!strcmp (p, "-Wimplicit")) - { - warn_implicit_int = 1; - if (mesg_implicit_function_declaration != 2) - mesg_implicit_function_declaration = 1; - } - else if (!strcmp (p, "-Wno-implicit")) - warn_implicit_int = 0, mesg_implicit_function_declaration = 0; - else if (!strcmp (p, "-Wlong-long")) - warn_long_long = 1; - else if (!strcmp (p, "-Wno-long-long")) - warn_long_long = 0; - else if (!strcmp (p, "-Wwrite-strings")) - flag_const_strings = 1; - else if (!strcmp (p, "-Wno-write-strings")) - flag_const_strings = 0; - else if (!strcmp (p, "-Wcast-qual")) - warn_cast_qual = 1; - else if (!strcmp (p, "-Wno-cast-qual")) - warn_cast_qual = 0; - else if (!strcmp (p, "-Wbad-function-cast")) - warn_bad_function_cast = 1; - else if (!strcmp (p, "-Wno-bad-function-cast")) - warn_bad_function_cast = 0; - else if (!strcmp (p, "-Wmissing-noreturn")) - warn_missing_noreturn = 1; - else if (!strcmp (p, "-Wno-missing-noreturn")) - warn_missing_noreturn = 0; - else if (!strcmp (p, "-Wpointer-arith")) - warn_pointer_arith = 1; - else if (!strcmp (p, "-Wno-pointer-arith")) - warn_pointer_arith = 0; - else if (!strcmp (p, "-Wstrict-prototypes")) - warn_strict_prototypes = 1; - else if (!strcmp (p, "-Wno-strict-prototypes")) - warn_strict_prototypes = 0; - else if (!strcmp (p, "-Wmissing-prototypes")) - warn_missing_prototypes = 1; - else if (!strcmp (p, "-Wno-missing-prototypes")) - warn_missing_prototypes = 0; - else if (!strcmp (p, "-Wmissing-declarations")) - warn_missing_declarations = 1; - else if (!strcmp (p, "-Wno-missing-declarations")) - warn_missing_declarations = 0; - else if (!strcmp (p, "-Wredundant-decls")) - warn_redundant_decls = 1; - else if (!strcmp (p, "-Wno-redundant-decls")) - warn_redundant_decls = 0; - else if (!strcmp (p, "-Wnested-externs")) - warn_nested_externs = 1; - else if (!strcmp (p, "-Wno-nested-externs")) - warn_nested_externs = 0; - else if (!strcmp (p, "-Wtraditional")) - warn_traditional = 1; - else if (!strcmp (p, "-Wno-traditional")) - warn_traditional = 0; - else if (!strcmp (p, "-Wformat")) - warn_format = 1; - else if (!strcmp (p, "-Wno-format")) - warn_format = 0; - else if (!strcmp (p, "-Wchar-subscripts")) - warn_char_subscripts = 1; - else if (!strcmp (p, "-Wno-char-subscripts")) - warn_char_subscripts = 0; - else if (!strcmp (p, "-Wconversion")) - warn_conversion = 1; - else if (!strcmp (p, "-Wno-conversion")) - warn_conversion = 0; - else if (!strcmp (p, "-Wparentheses")) - warn_parentheses = 1; - else if (!strcmp (p, "-Wno-parentheses")) - warn_parentheses = 0; - else if (!strcmp (p, "-Wreturn-type")) - warn_return_type = 1; - else if (!strcmp (p, "-Wno-return-type")) - warn_return_type = 0; - else if (!strcmp (p, "-Wcomment")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wno-comment")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wcomments")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wno-comments")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wtrigraphs")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wno-trigraphs")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wundef")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wno-undef")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wimport")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wno-import")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "-Wmissing-braces")) - warn_missing_braces = 1; - else if (!strcmp (p, "-Wno-missing-braces")) - warn_missing_braces = 0; - else if (!strcmp (p, "-Wmain")) - warn_main = 1; - else if (!strcmp (p, "-Wno-main")) - warn_main = -1; - else if (!strcmp (p, "-Wsign-compare")) - warn_sign_compare = 1; - else if (!strcmp (p, "-Wno-sign-compare")) - warn_sign_compare = 0; - else if (!strcmp (p, "-Wmultichar")) - warn_multichar = 1; - else if (!strcmp (p, "-Wno-multichar")) - warn_multichar = 0; - else if (!strcmp (p, "-Wunknown-pragmas")) - /* Set to greater than 1, so that even unknown pragmas in system - headers will be warned about. */ - warn_unknown_pragmas = 2; - else if (!strcmp (p, "-Wno-unknown-pragmas")) - warn_unknown_pragmas = 0; - else if (!strcmp (p, "-Wall")) - { - /* We save the value of warn_uninitialized, since if they put - -Wuninitialized on the command line, we need to generate a - warning about not using it without also specifying -O. */ - if (warn_uninitialized != 1) - warn_uninitialized = 2; - warn_implicit_int = 1; - mesg_implicit_function_declaration = 1; - warn_return_type = 1; - warn_unused = 1; - warn_switch = 1; - warn_format = 1; - warn_char_subscripts = 1; - warn_parentheses = 1; - warn_missing_braces = 1; - /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding can turn - it off only if it's not explicit. */ - warn_main = 2; - /* Only warn about unknown pragmas that are not in system headers. */ - warn_unknown_pragmas = 1; - } - else - return strings_processed; - - return 1; -} - -/* Hooks for print_node. */ - -void -print_lang_decl (file, node, indent) - FILE *file ATTRIBUTE_UNUSED; - tree node ATTRIBUTE_UNUSED; - int indent ATTRIBUTE_UNUSED; -{ -} - -void -print_lang_type (file, node, indent) - FILE *file ATTRIBUTE_UNUSED; - tree node ATTRIBUTE_UNUSED; - int indent ATTRIBUTE_UNUSED; -{ -} - -void -print_lang_identifier (file, node, indent) - FILE *file; - tree node; - int indent; -{ - print_node (file, "global", IDENTIFIER_GLOBAL_VALUE (node), indent + 4); - print_node (file, "local", IDENTIFIER_LOCAL_VALUE (node), indent + 4); - print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4); - print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4); - print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4); - print_node (file, "limbo value", IDENTIFIER_LIMBO_VALUE (node), indent + 4); -} - -/* Hook called at end of compilation to assume 1 elt - for a top-level array decl that wasn't complete before. */ - -void -finish_incomplete_decl (decl) - tree decl; -{ - if (TREE_CODE (decl) == VAR_DECL) - { - tree type = TREE_TYPE (decl); - if (type != error_mark_node - && TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type) == 0) - { - if (! DECL_EXTERNAL (decl)) - warning_with_decl (decl, "array `%s' assumed to have one element"); - - complete_array_type (type, NULL_TREE, 1); - - layout_decl (decl, 0); - } - } -} - -/* Create a new `struct binding_level'. */ - -static -struct binding_level * -make_binding_level () -{ - /* NOSTRICT */ - return (struct binding_level *) xmalloc (sizeof (struct binding_level)); -} - -/* Nonzero if we are currently in the global binding level. */ - -int -global_bindings_p () -{ - return current_binding_level == global_binding_level; -} - -void -keep_next_level () -{ - keep_next_level_flag = 1; -} - -/* Nonzero if the current level needs to have a BLOCK made. */ - -int -kept_level_p () -{ - return ((current_binding_level->keep_if_subblocks - && current_binding_level->blocks != 0) - || current_binding_level->keep - || current_binding_level->names != 0 - || (current_binding_level->tags != 0 - && !current_binding_level->tag_transparent)); -} - -/* Identify this binding level as a level of parameters. - DEFINITION_FLAG is 1 for a definition, 0 for a declaration. - But it turns out there is no way to pass the right value for - DEFINITION_FLAG, so we ignore it. */ - -void -declare_parm_level (definition_flag) - int definition_flag ATTRIBUTE_UNUSED; -{ - current_binding_level->parm_flag = 1; -} - -/* Nonzero if currently making parm declarations. */ - -int -in_parm_level_p () -{ - return current_binding_level->parm_flag; -} - -/* Enter a new binding level. - If TAG_TRANSPARENT is nonzero, do so only for the name space of variables, - not for that of tags. */ - -void -pushlevel (tag_transparent) - int tag_transparent; -{ - register struct binding_level *newlevel = NULL_BINDING_LEVEL; - - /* If this is the top level of a function, - just make sure that NAMED_LABELS is 0. */ - - if (current_binding_level == global_binding_level) - { - named_labels = 0; - } - - /* Reuse or create a struct for this binding level. */ - - if (free_binding_level) - { - newlevel = free_binding_level; - free_binding_level = free_binding_level->level_chain; - } - else - { - newlevel = make_binding_level (); - } - - /* Add this level to the front of the chain (stack) of levels that - are active. */ - - *newlevel = clear_binding_level; - newlevel->tag_transparent - = (tag_transparent - || (current_binding_level - ? current_binding_level->subblocks_tag_transparent - : 0)); - newlevel->level_chain = current_binding_level; - current_binding_level = newlevel; - newlevel->keep = keep_next_level_flag; - keep_next_level_flag = 0; - newlevel->keep_if_subblocks = keep_next_if_subblocks; - keep_next_if_subblocks = 0; -} - -/* Clear the limbo values of all identifiers defined in BLOCK or a subblock. */ - -static void -clear_limbo_values (block) - tree block; -{ - tree tem; - - for (tem = BLOCK_VARS (block); tem; tem = TREE_CHAIN (tem)) - if (DECL_NAME (tem) != 0) - IDENTIFIER_LIMBO_VALUE (DECL_NAME (tem)) = 0; - - for (tem = BLOCK_SUBBLOCKS (block); tem; tem = TREE_CHAIN (tem)) - clear_limbo_values (tem); -} - -/* Exit a binding level. - Pop the level off, and restore the state of the identifier-decl mappings - that were in effect when this level was entered. - - If KEEP is nonzero, this level had explicit declarations, so - and create a "block" (a BLOCK node) for the level - to record its declarations and subblocks for symbol table output. - - If FUNCTIONBODY is nonzero, this level is the body of a function, - so create a block as if KEEP were set and also clear out all - label names. - - If REVERSE is nonzero, reverse the order of decls before putting - them into the BLOCK. */ - -tree -poplevel (keep, reverse, functionbody) - int keep; - int reverse; - int functionbody; -{ - register tree link; - /* The chain of decls was accumulated in reverse order. - Put it into forward order, just for cleanliness. */ - tree decls; - tree tags = current_binding_level->tags; - tree subblocks = current_binding_level->blocks; - tree block = 0; - tree decl; - int block_previously_created; - - keep |= current_binding_level->keep; - - /* This warning is turned off because it causes warnings for - declarations like `extern struct foo *x'. */ -#if 0 - /* Warn about incomplete structure types in this level. */ - for (link = tags; link; link = TREE_CHAIN (link)) - if (TYPE_SIZE (TREE_VALUE (link)) == 0) - { - tree type = TREE_VALUE (link); - tree type_name = TYPE_NAME (type); - char *id = IDENTIFIER_POINTER (TREE_CODE (type_name) == IDENTIFIER_NODE - ? type_name - : DECL_NAME (type_name)); - switch (TREE_CODE (type)) - { - case RECORD_TYPE: - error ("`struct %s' incomplete in scope ending here", id); - break; - case UNION_TYPE: - error ("`union %s' incomplete in scope ending here", id); - break; - case ENUMERAL_TYPE: - error ("`enum %s' incomplete in scope ending here", id); - break; - } - } -#endif /* 0 */ - - /* Get the decls in the order they were written. - Usually current_binding_level->names is in reverse order. - But parameter decls were previously put in forward order. */ - - if (reverse) - current_binding_level->names - = decls = nreverse (current_binding_level->names); - else - decls = current_binding_level->names; - - /* Output any nested inline functions within this block - if they weren't already output. */ - - for (decl = decls; decl; decl = TREE_CHAIN (decl)) - if (TREE_CODE (decl) == FUNCTION_DECL - && ! TREE_ASM_WRITTEN (decl) - && DECL_INITIAL (decl) != 0 - && TREE_ADDRESSABLE (decl)) - { - /* If this decl was copied from a file-scope decl - on account of a block-scope extern decl, - propagate TREE_ADDRESSABLE to the file-scope decl. - - DECL_ABSTRACT_ORIGIN can be set to itself if warn_return_type is - true, since then the decl goes through save_for_inline_copying. */ - if (DECL_ABSTRACT_ORIGIN (decl) != 0 - && DECL_ABSTRACT_ORIGIN (decl) != decl) - TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (decl)) = 1; - else if (DECL_SAVED_INSNS (decl) != 0) - { - push_function_context (); - output_inline_function (decl); - pop_function_context (); - } - } - - /* If there were any declarations or structure tags in that level, - or if this level is a function body, - create a BLOCK to record them for the life of this function. */ - - block = 0; - block_previously_created = (current_binding_level->this_block != 0); - if (block_previously_created) - block = current_binding_level->this_block; - else if (keep || functionbody - || (current_binding_level->keep_if_subblocks && subblocks != 0)) - block = make_node (BLOCK); - if (block != 0) - { - BLOCK_VARS (block) = decls; - BLOCK_TYPE_TAGS (block) = tags; - BLOCK_SUBBLOCKS (block) = subblocks; - remember_end_note (block); - } - - /* In each subblock, record that this is its superior. */ - - for (link = subblocks; link; link = TREE_CHAIN (link)) - BLOCK_SUPERCONTEXT (link) = block; - - /* Clear out the meanings of the local variables of this level. */ - - for (link = decls; link; link = TREE_CHAIN (link)) - { - if (DECL_NAME (link) != 0) - { - /* If the ident. was used or addressed via a local extern decl, - don't forget that fact. */ - if (DECL_EXTERNAL (link)) - { - if (TREE_USED (link)) - TREE_USED (DECL_NAME (link)) = 1; - if (TREE_ADDRESSABLE (link)) - TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (link)) = 1; - } - IDENTIFIER_LOCAL_VALUE (DECL_NAME (link)) = 0; - } - } - - /* Restore all name-meanings of the outer levels - that were shadowed by this level. */ - - for (link = current_binding_level->shadowed; link; link = TREE_CHAIN (link)) - IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link); - - /* If the level being exited is the top level of a function, - check over all the labels, and clear out the current - (function local) meanings of their names. */ - - if (functionbody) - { - clear_limbo_values (block); - - /* If this is the top level block of a function, - the vars are the function's parameters. - Don't leave them in the BLOCK because they are - found in the FUNCTION_DECL instead. */ - - BLOCK_VARS (block) = 0; - - /* Clear out the definitions of all label names, - since their scopes end here, - and add them to BLOCK_VARS. */ - - for (link = named_labels; link; link = TREE_CHAIN (link)) - { - register tree label = TREE_VALUE (link); - - if (DECL_INITIAL (label) == 0) - { - error_with_decl (label, "label `%s' used but not defined"); - /* Avoid crashing later. */ - define_label (input_filename, lineno, - DECL_NAME (label)); - } - else if (warn_unused && !TREE_USED (label)) - warning_with_decl (label, "label `%s' defined but not used"); - IDENTIFIER_LABEL_VALUE (DECL_NAME (label)) = 0; - - /* Put the labels into the "variables" of the - top-level block, so debugger can see them. */ - TREE_CHAIN (label) = BLOCK_VARS (block); - BLOCK_VARS (block) = label; - } - } - - /* Pop the current level, and free the structure for reuse. */ - - { - register struct binding_level *level = current_binding_level; - current_binding_level = current_binding_level->level_chain; - - level->level_chain = free_binding_level; - free_binding_level = level; - } - - /* Dispose of the block that we just made inside some higher level. */ - if (functionbody) - DECL_INITIAL (current_function_decl) = block; - else if (block) - { - if (!block_previously_created) - current_binding_level->blocks - = chainon (current_binding_level->blocks, block); - } - /* If we did not make a block for the level just exited, - any blocks made for inner levels - (since they cannot be recorded as subblocks in that level) - must be carried forward so they will later become subblocks - of something else. */ - else if (subblocks) - current_binding_level->blocks - = chainon (current_binding_level->blocks, subblocks); - - /* Set the TYPE_CONTEXTs for all of the tagged types belonging to this - binding contour so that they point to the appropriate construct, i.e. - either to the current FUNCTION_DECL node, or else to the BLOCK node - we just constructed. - - Note that for tagged types whose scope is just the formal parameter - list for some function type specification, we can't properly set - their TYPE_CONTEXTs here, because we don't have a pointer to the - appropriate FUNCTION_TYPE node readily available to us. For those - cases, the TYPE_CONTEXTs of the relevant tagged type nodes get set - in `grokdeclarator' as soon as we have created the FUNCTION_TYPE - node which will represent the "scope" for these "parameter list local" - tagged types. - */ - - if (functionbody) - for (link = tags; link; link = TREE_CHAIN (link)) - TYPE_CONTEXT (TREE_VALUE (link)) = current_function_decl; - else if (block) - for (link = tags; link; link = TREE_CHAIN (link)) - TYPE_CONTEXT (TREE_VALUE (link)) = block; - - if (block) - TREE_USED (block) = 1; - return block; -} - -/* Delete the node BLOCK from the current binding level. - This is used for the block inside a stmt expr ({...}) - so that the block can be reinserted where appropriate. */ - -void -delete_block (block) - tree block; -{ - tree t; - if (current_binding_level->blocks == block) - current_binding_level->blocks = TREE_CHAIN (block); - for (t = current_binding_level->blocks; t;) - { - if (TREE_CHAIN (t) == block) - TREE_CHAIN (t) = TREE_CHAIN (block); - else - t = TREE_CHAIN (t); - } - TREE_CHAIN (block) = NULL; - /* Clear TREE_USED which is always set by poplevel. - The flag is set again if insert_block is called. */ - TREE_USED (block) = 0; -} - -/* Insert BLOCK at the end of the list of subblocks of the - current binding level. This is used when a BIND_EXPR is expanded, - to handle the BLOCK node inside the BIND_EXPR. */ - -void -insert_block (block) - tree block; -{ - TREE_USED (block) = 1; - current_binding_level->blocks - = chainon (current_binding_level->blocks, block); -} - -/* Set the BLOCK node for the innermost scope - (the one we are currently in). */ - -void -set_block (block) - register tree block; -{ - current_binding_level->this_block = block; -} - -void -push_label_level () -{ - register struct binding_level *newlevel; - - /* Reuse or create a struct for this binding level. */ - - if (free_binding_level) - { - newlevel = free_binding_level; - free_binding_level = free_binding_level->level_chain; - } - else - { - newlevel = make_binding_level (); - } - - /* Add this level to the front of the chain (stack) of label levels. */ - - newlevel->level_chain = label_level_chain; - label_level_chain = newlevel; - - newlevel->names = named_labels; - newlevel->shadowed = shadowed_labels; - named_labels = 0; - shadowed_labels = 0; -} - -void -pop_label_level () -{ - register struct binding_level *level = label_level_chain; - tree link, prev; - - /* Clear out the definitions of the declared labels in this level. - Leave in the list any ordinary, non-declared labels. */ - for (link = named_labels, prev = 0; link;) - { - if (C_DECLARED_LABEL_FLAG (TREE_VALUE (link))) - { - if (DECL_SOURCE_LINE (TREE_VALUE (link)) == 0) - { - error_with_decl (TREE_VALUE (link), - "label `%s' used but not defined"); - /* Avoid crashing later. */ - define_label (input_filename, lineno, - DECL_NAME (TREE_VALUE (link))); - } - else if (warn_unused && !TREE_USED (TREE_VALUE (link))) - warning_with_decl (TREE_VALUE (link), - "label `%s' defined but not used"); - IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link))) = 0; - - /* Delete this element from the list. */ - link = TREE_CHAIN (link); - if (prev) - TREE_CHAIN (prev) = link; - else - named_labels = link; - } - else - { - prev = link; - link = TREE_CHAIN (link); - } - } - - /* Bring back all the labels that were shadowed. */ - for (link = shadowed_labels; link; link = TREE_CHAIN (link)) - if (DECL_NAME (TREE_VALUE (link)) != 0) - IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link))) - = TREE_VALUE (link); - - named_labels = chainon (named_labels, level->names); - shadowed_labels = level->shadowed; - - /* Pop the current level, and free the structure for reuse. */ - label_level_chain = label_level_chain->level_chain; - level->level_chain = free_binding_level; - free_binding_level = level; -} - -/* Push a definition or a declaration of struct, union or enum tag "name". - "type" should be the type node. - We assume that the tag "name" is not already defined. - - Note that the definition may really be just a forward reference. - In that case, the TYPE_SIZE will be zero. */ - -void -pushtag (name, type) - tree name, type; -{ - register struct binding_level *b; - - /* Find the proper binding level for this type tag. */ - - for (b = current_binding_level; b->tag_transparent; b = b->level_chain) - continue; - - if (name) - { - /* Record the identifier as the type's name if it has none. */ - - if (TYPE_NAME (type) == 0) - TYPE_NAME (type) = name; - } - - if (b == global_binding_level) - b->tags = perm_tree_cons (name, type, b->tags); - else - b->tags = saveable_tree_cons (name, type, b->tags); - - /* Create a fake NULL-named TYPE_DECL node whose TREE_TYPE will be the - tagged type we just added to the current binding level. This fake - NULL-named TYPE_DECL node helps dwarfout.c to know when it needs - to output a representation of a tagged type, and it also gives - us a convenient place to record the "scope start" address for the - tagged type. */ - - TYPE_STUB_DECL (type) = pushdecl (build_decl (TYPE_DECL, NULL_TREE, type)); - - /* An approximation for now, so we can tell this is a function-scope tag. - This will be updated in poplevel. */ - TYPE_CONTEXT (type) = DECL_CONTEXT (TYPE_STUB_DECL (type)); -} - -/* Handle when a new declaration NEWDECL - has the same name as an old one OLDDECL - in the same binding contour. - Prints an error message if appropriate. - - If safely possible, alter OLDDECL to look like NEWDECL, and return 1. - Otherwise, return 0. - - When DIFFERENT_BINDING_LEVEL is true, NEWDECL is an external declaration, - and OLDDECL is in an outer binding level and should thus not be changed. */ - -static int -duplicate_decls (newdecl, olddecl, different_binding_level) - register tree newdecl, olddecl; - int different_binding_level; -{ - int types_match = comptypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); - int new_is_definition = (TREE_CODE (newdecl) == FUNCTION_DECL - && DECL_INITIAL (newdecl) != 0); - tree oldtype = TREE_TYPE (olddecl); - tree newtype = TREE_TYPE (newdecl); - int errmsg = 0; - - if (TREE_CODE_CLASS (TREE_CODE (olddecl)) == 'd') - DECL_MACHINE_ATTRIBUTES (newdecl) - = merge_machine_decl_attributes (olddecl, newdecl); - - if (TREE_CODE (newtype) == ERROR_MARK - || TREE_CODE (oldtype) == ERROR_MARK) - types_match = 0; - - /* New decl is completely inconsistent with the old one => - tell caller to replace the old one. - This is always an error except in the case of shadowing a builtin. */ - if (TREE_CODE (olddecl) != TREE_CODE (newdecl)) - { - if (TREE_CODE (olddecl) == FUNCTION_DECL - && (DECL_BUILT_IN (olddecl) - || DECL_BUILT_IN_NONANSI (olddecl))) - { - /* If you declare a built-in or predefined function name as static, - the old definition is overridden, - but optionally warn this was a bad choice of name. */ - if (!TREE_PUBLIC (newdecl)) - { - if (!warn_shadow) - ; - else if (DECL_BUILT_IN (olddecl)) - warning_with_decl (newdecl, "shadowing built-in function `%s'"); - else - warning_with_decl (newdecl, "shadowing library function `%s'"); - } - /* Likewise, if the built-in is not ansi, then programs can - override it even globally without an error. */ - else if (! DECL_BUILT_IN (olddecl)) - warning_with_decl (newdecl, - "library function `%s' declared as non-function"); - - else if (DECL_BUILT_IN_NONANSI (olddecl)) - warning_with_decl (newdecl, - "built-in function `%s' declared as non-function"); - else - warning_with_decl (newdecl, - "built-in function `%s' declared as non-function"); - } - else - { - error_with_decl (newdecl, "`%s' redeclared as different kind of symbol"); - error_with_decl (olddecl, "previous declaration of `%s'"); - } - - return 0; - } - - /* For real parm decl following a forward decl, - return 1 so old decl will be reused. */ - if (types_match && TREE_CODE (newdecl) == PARM_DECL - && TREE_ASM_WRITTEN (olddecl) && ! TREE_ASM_WRITTEN (newdecl)) - return 1; - - /* The new declaration is the same kind of object as the old one. - The declarations may partially match. Print warnings if they don't - match enough. Ultimately, copy most of the information from the new - decl to the old one, and keep using the old one. */ - - if (flag_traditional && TREE_CODE (newdecl) == FUNCTION_DECL - && IDENTIFIER_IMPLICIT_DECL (DECL_NAME (newdecl)) == olddecl - && DECL_INITIAL (olddecl) == 0) - /* If -traditional, avoid error for redeclaring fcn - after implicit decl. */ - ; - else if (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_BUILT_IN (olddecl)) - { - /* A function declaration for a built-in function. */ - if (!TREE_PUBLIC (newdecl)) - { - /* If you declare a built-in function name as static, the - built-in definition is overridden, - but optionally warn this was a bad choice of name. */ - if (warn_shadow) - warning_with_decl (newdecl, "shadowing built-in function `%s'"); - /* Discard the old built-in function. */ - return 0; - } - else if (!types_match) - { - /* Accept the return type of the new declaration if same modes. */ - tree oldreturntype = TREE_TYPE (oldtype); - tree newreturntype = TREE_TYPE (newtype); - - /* Make sure we put the new type in the same obstack as the old ones. - If the old types are not both in the same obstack, use the - permanent one. */ - if (TYPE_OBSTACK (oldtype) == TYPE_OBSTACK (newtype)) - push_obstacks (TYPE_OBSTACK (oldtype), TYPE_OBSTACK (oldtype)); - else - { - push_obstacks_nochange (); - end_temporary_allocation (); - } - - if (TYPE_MODE (oldreturntype) == TYPE_MODE (newreturntype)) - { - /* Function types may be shared, so we can't just modify - the return type of olddecl's function type. */ - tree trytype - = build_function_type (newreturntype, - TYPE_ARG_TYPES (oldtype)); - - types_match = comptypes (newtype, trytype); - if (types_match) - oldtype = trytype; - } - /* Accept harmless mismatch in first argument type also. - This is for ffs. */ - if (TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != 0 - && TYPE_ARG_TYPES (oldtype) != 0 - && TREE_VALUE (TYPE_ARG_TYPES (newtype)) != 0 - && TREE_VALUE (TYPE_ARG_TYPES (oldtype)) != 0 - && (TYPE_MODE (TREE_VALUE (TYPE_ARG_TYPES (newtype))) - == TYPE_MODE (TREE_VALUE (TYPE_ARG_TYPES (oldtype))))) - { - /* Function types may be shared, so we can't just modify - the return type of olddecl's function type. */ - tree trytype - = build_function_type (TREE_TYPE (oldtype), - tree_cons (NULL_TREE, - TREE_VALUE (TYPE_ARG_TYPES (newtype)), - TREE_CHAIN (TYPE_ARG_TYPES (oldtype)))); - - types_match = comptypes (newtype, trytype); - if (types_match) - oldtype = trytype; - } - if (! different_binding_level) - TREE_TYPE (olddecl) = oldtype; - - pop_obstacks (); - } - if (!types_match) - { - /* If types don't match for a built-in, throw away the built-in. */ - warning_with_decl (newdecl, "conflicting types for built-in function `%s'"); - return 0; - } - } - else if (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_SOURCE_LINE (olddecl) == 0) - { - /* A function declaration for a predeclared function - that isn't actually built in. */ - if (!TREE_PUBLIC (newdecl)) - { - /* If you declare it as static, the - default definition is overridden. */ - return 0; - } - else if (!types_match) - { - /* If the types don't match, preserve volatility indication. - Later on, we will discard everything else about the - default declaration. */ - TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl); - } - } - /* Permit char *foo () to match void *foo (...) if not pedantic, - if one of them came from a system header file. */ - else if (!types_match - && TREE_CODE (olddecl) == FUNCTION_DECL - && TREE_CODE (newdecl) == FUNCTION_DECL - && TREE_CODE (TREE_TYPE (oldtype)) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (newtype)) == POINTER_TYPE - && (DECL_IN_SYSTEM_HEADER (olddecl) - || DECL_IN_SYSTEM_HEADER (newdecl)) - && ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (newtype))) == void_type_node - && TYPE_ARG_TYPES (oldtype) == 0 - && self_promoting_args_p (TYPE_ARG_TYPES (newtype)) - && TREE_TYPE (TREE_TYPE (oldtype)) == char_type_node) - || - (TREE_TYPE (TREE_TYPE (newtype)) == char_type_node - && TYPE_ARG_TYPES (newtype) == 0 - && self_promoting_args_p (TYPE_ARG_TYPES (oldtype)) - && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (oldtype))) == void_type_node))) - { - if (pedantic) - pedwarn_with_decl (newdecl, "conflicting types for `%s'"); - /* Make sure we keep void * as ret type, not char *. */ - if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (oldtype))) == void_type_node) - TREE_TYPE (newdecl) = newtype = oldtype; - - /* Set DECL_IN_SYSTEM_HEADER, so that if we see another declaration - we will come back here again. */ - DECL_IN_SYSTEM_HEADER (newdecl) = 1; - } - else if (!types_match - /* Permit char *foo (int, ...); followed by char *foo (); - if not pedantic. */ - && ! (TREE_CODE (olddecl) == FUNCTION_DECL - && ! pedantic - /* Return types must still match. */ - && comptypes (TREE_TYPE (oldtype), - TREE_TYPE (newtype)) - && TYPE_ARG_TYPES (newtype) == 0)) - { - error_with_decl (newdecl, "conflicting types for `%s'"); - /* Check for function type mismatch - involving an empty arglist vs a nonempty one. */ - if (TREE_CODE (olddecl) == FUNCTION_DECL - && comptypes (TREE_TYPE (oldtype), - TREE_TYPE (newtype)) - && ((TYPE_ARG_TYPES (oldtype) == 0 - && DECL_INITIAL (olddecl) == 0) - || - (TYPE_ARG_TYPES (newtype) == 0 - && DECL_INITIAL (newdecl) == 0))) - { - /* Classify the problem further. */ - register tree t = TYPE_ARG_TYPES (oldtype); - if (t == 0) - t = TYPE_ARG_TYPES (newtype); - for (; t; t = TREE_CHAIN (t)) - { - register tree type = TREE_VALUE (t); - - if (TREE_CHAIN (t) == 0 - && TYPE_MAIN_VARIANT (type) != void_type_node) - { - error ("A parameter list with an ellipsis can't match an empty parameter name list declaration."); - break; - } - - if (TYPE_MAIN_VARIANT (type) == float_type_node - || C_PROMOTING_INTEGER_TYPE_P (type)) - { - error ("An argument type that has a default promotion can't match an empty parameter name list declaration."); - break; - } - } - } - error_with_decl (olddecl, "previous declaration of `%s'"); - } - else - { - errmsg = redeclaration_error_message (newdecl, olddecl); - if (errmsg) - { - switch (errmsg) - { - case 1: - error_with_decl (newdecl, "redefinition of `%s'"); - break; - case 2: - error_with_decl (newdecl, "redeclaration of `%s'"); - break; - case 3: - error_with_decl (newdecl, "conflicting declarations of `%s'"); - break; - default: - abort (); - } - - error_with_decl (olddecl, - ((DECL_INITIAL (olddecl) - && current_binding_level == global_binding_level) - ? "`%s' previously defined here" - : "`%s' previously declared here")); - } - else if (TREE_CODE (newdecl) == TYPE_DECL - && (DECL_IN_SYSTEM_HEADER (olddecl) - || DECL_IN_SYSTEM_HEADER (newdecl))) - { - warning_with_decl (newdecl, "redefinition of `%s'"); - warning_with_decl - (olddecl, - ((DECL_INITIAL (olddecl) - && current_binding_level == global_binding_level) - ? "`%s' previously defined here" - : "`%s' previously declared here")); - } - else if (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_INITIAL (olddecl) != 0 - && TYPE_ARG_TYPES (oldtype) == 0 - && TYPE_ARG_TYPES (newtype) != 0 - && TYPE_ACTUAL_ARG_TYPES (oldtype) != 0) - { - register tree type, parm; - register int nargs; - /* Prototype decl follows defn w/o prototype. */ - - for (parm = TYPE_ACTUAL_ARG_TYPES (oldtype), - type = TYPE_ARG_TYPES (newtype), - nargs = 1; - ; - parm = TREE_CHAIN (parm), type = TREE_CHAIN (type), nargs++) - { - if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == void_type_node - && TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node) - { - warning_with_decl (newdecl, "prototype for `%s' follows"); - warning_with_decl (olddecl, "non-prototype definition here"); - break; - } - if (TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == void_type_node - || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node) - { - error_with_decl (newdecl, "prototype for `%s' follows and number of arguments doesn't match"); - error_with_decl (olddecl, "non-prototype definition here"); - errmsg = 1; - break; - } - /* Type for passing arg must be consistent - with that declared for the arg. */ - if (! comptypes (TREE_VALUE (parm), TREE_VALUE (type)) - /* If -traditional, allow `unsigned int' instead of `int' - in the prototype. */ - && (! (flag_traditional - && TYPE_MAIN_VARIANT (TREE_VALUE (parm)) == integer_type_node - && TYPE_MAIN_VARIANT (TREE_VALUE (type)) == unsigned_type_node))) - { - error_with_decl (newdecl, - "prototype for `%s' follows and argument %d doesn't match", - nargs); - error_with_decl (olddecl, "non-prototype definition here"); - errmsg = 1; - break; - } - } - } - /* Warn about mismatches in various flags. */ - else - { - /* Warn if function is now inline - but was previously declared not inline and has been called. */ - if (TREE_CODE (olddecl) == FUNCTION_DECL - && ! DECL_INLINE (olddecl) && DECL_INLINE (newdecl) - && TREE_USED (olddecl)) - warning_with_decl (newdecl, - "`%s' declared inline after being called"); - if (TREE_CODE (olddecl) == FUNCTION_DECL - && ! DECL_INLINE (olddecl) && DECL_INLINE (newdecl) - && DECL_INITIAL (olddecl) != 0) - warning_with_decl (newdecl, - "`%s' declared inline after its definition"); - - /* If pedantic, warn when static declaration follows a non-static - declaration. Otherwise, do so only for functions. */ - if ((pedantic || TREE_CODE (olddecl) == FUNCTION_DECL) - && TREE_PUBLIC (olddecl) - && !TREE_PUBLIC (newdecl)) - warning_with_decl (newdecl, "static declaration for `%s' follows non-static"); - - /* If warn_traditional, warn when a non-static function - declaration follows a static one. */ - if (warn_traditional - && TREE_CODE (olddecl) == FUNCTION_DECL - && !TREE_PUBLIC (olddecl) - && TREE_PUBLIC (newdecl)) - warning_with_decl (newdecl, "non-static declaration for `%s' follows static"); - - /* Warn when const declaration follows a non-const - declaration, but not for functions. */ - if (TREE_CODE (olddecl) != FUNCTION_DECL - && !TREE_READONLY (olddecl) - && TREE_READONLY (newdecl)) - warning_with_decl (newdecl, "const declaration for `%s' follows non-const"); - /* These bits are logically part of the type, for variables. - But not for functions - (where qualifiers are not valid ANSI anyway). */ - else if (pedantic && TREE_CODE (olddecl) != FUNCTION_DECL - && (TREE_READONLY (newdecl) != TREE_READONLY (olddecl) - || TREE_THIS_VOLATILE (newdecl) != TREE_THIS_VOLATILE (olddecl))) - pedwarn_with_decl (newdecl, "type qualifiers for `%s' conflict with previous decl"); - } - } - - /* Optionally warn about more than one declaration for the same name. */ - if (errmsg == 0 && warn_redundant_decls && DECL_SOURCE_LINE (olddecl) != 0 - /* Don't warn about a function declaration - followed by a definition. */ - && !(TREE_CODE (newdecl) == FUNCTION_DECL && DECL_INITIAL (newdecl) != 0 - && DECL_INITIAL (olddecl) == 0) - /* Don't warn about extern decl followed by (tentative) definition. */ - && !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl))) - { - warning_with_decl (newdecl, "redundant redeclaration of `%s' in same scope"); - warning_with_decl (olddecl, "previous declaration of `%s'"); - } - - /* Copy all the DECL_... slots specified in the new decl - except for any that we copy here from the old type. - - Past this point, we don't change OLDTYPE and NEWTYPE - even if we change the types of NEWDECL and OLDDECL. */ - - if (types_match) - { - /* When copying info to olddecl, we store into write_olddecl - instead. This allows us to avoid modifying olddecl when - different_binding_level is true. */ - tree write_olddecl = different_binding_level ? newdecl : olddecl; - - /* Make sure we put the new type in the same obstack as the old ones. - If the old types are not both in the same obstack, use the permanent - one. */ - if (TYPE_OBSTACK (oldtype) == TYPE_OBSTACK (newtype)) - push_obstacks (TYPE_OBSTACK (oldtype), TYPE_OBSTACK (oldtype)); - else - { - push_obstacks_nochange (); - end_temporary_allocation (); - } - - /* Merge the data types specified in the two decls. */ - if (TREE_CODE (newdecl) != FUNCTION_DECL || !DECL_BUILT_IN (olddecl)) - { - if (different_binding_level) - TREE_TYPE (newdecl) - = build_type_attribute_variant - (newtype, - merge_attributes (TYPE_ATTRIBUTES (newtype), - TYPE_ATTRIBUTES (oldtype))); - else - TREE_TYPE (newdecl) - = TREE_TYPE (olddecl) - = common_type (newtype, oldtype); - } - - /* Lay the type out, unless already done. */ - if (oldtype != TREE_TYPE (newdecl)) - { - if (TREE_TYPE (newdecl) != error_mark_node) - layout_type (TREE_TYPE (newdecl)); - if (TREE_CODE (newdecl) != FUNCTION_DECL - && TREE_CODE (newdecl) != TYPE_DECL - && TREE_CODE (newdecl) != CONST_DECL) - layout_decl (newdecl, 0); - } - else - { - /* Since the type is OLDDECL's, make OLDDECL's size go with. */ - DECL_SIZE (newdecl) = DECL_SIZE (olddecl); - DECL_MODE (newdecl) = DECL_MODE (olddecl); - if (TREE_CODE (olddecl) != FUNCTION_DECL) - if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl)) - DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl); - } - - /* Keep the old rtl since we can safely use it. */ - DECL_RTL (newdecl) = DECL_RTL (olddecl); - - /* Merge the type qualifiers. */ - if (DECL_BUILT_IN_NONANSI (olddecl) && TREE_THIS_VOLATILE (olddecl) - && !TREE_THIS_VOLATILE (newdecl)) - TREE_THIS_VOLATILE (write_olddecl) = 0; - if (TREE_READONLY (newdecl)) - TREE_READONLY (write_olddecl) = 1; - if (TREE_THIS_VOLATILE (newdecl)) - { - TREE_THIS_VOLATILE (write_olddecl) = 1; - if (TREE_CODE (newdecl) == VAR_DECL) - make_var_volatile (newdecl); - } - - /* Keep source location of definition rather than declaration. */ - /* When called with different_binding_level set, keep the old - information so that meaningful diagnostics can be given. */ - if (DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0 - && ! different_binding_level) - { - DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl); - DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl); - } - - /* Merge the unused-warning information. */ - if (DECL_IN_SYSTEM_HEADER (olddecl)) - DECL_IN_SYSTEM_HEADER (newdecl) = 1; - else if (DECL_IN_SYSTEM_HEADER (newdecl)) - DECL_IN_SYSTEM_HEADER (write_olddecl) = 1; - - /* Merge the initialization information. */ - /* When called with different_binding_level set, don't copy over - DECL_INITIAL, so that we don't accidentally change function - declarations into function definitions. */ - if (DECL_INITIAL (newdecl) == 0 && ! different_binding_level) - DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); - - /* Merge the section attribute. - We want to issue an error if the sections conflict but that must be - done later in decl_attributes since we are called before attributes - are assigned. */ - if (DECL_SECTION_NAME (newdecl) == NULL_TREE) - DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl); - - if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - DECL_STATIC_CONSTRUCTOR(newdecl) |= DECL_STATIC_CONSTRUCTOR(olddecl); - DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl); - - DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl) - |= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl); - DECL_NO_CHECK_MEMORY_USAGE (newdecl) - |= DECL_NO_CHECK_MEMORY_USAGE (olddecl); - } - - pop_obstacks (); - } - /* If cannot merge, then use the new type and qualifiers, - and don't preserve the old rtl. */ - else if (! different_binding_level) - { - TREE_TYPE (olddecl) = TREE_TYPE (newdecl); - TREE_READONLY (olddecl) = TREE_READONLY (newdecl); - TREE_THIS_VOLATILE (olddecl) = TREE_THIS_VOLATILE (newdecl); - TREE_SIDE_EFFECTS (olddecl) = TREE_SIDE_EFFECTS (newdecl); - } - - /* Merge the storage class information. */ - DECL_WEAK (newdecl) |= DECL_WEAK (olddecl); - /* For functions, static overrides non-static. */ - if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - TREE_PUBLIC (newdecl) &= TREE_PUBLIC (olddecl); - /* This is since we don't automatically - copy the attributes of NEWDECL into OLDDECL. */ - /* No need to worry about different_binding_level here because - then TREE_PUBLIC (newdecl) was true. */ - TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl); - /* If this clears `static', clear it in the identifier too. */ - if (! TREE_PUBLIC (olddecl)) - TREE_PUBLIC (DECL_NAME (olddecl)) = 0; - } - if (DECL_EXTERNAL (newdecl)) - { - TREE_STATIC (newdecl) = TREE_STATIC (olddecl); - DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl); - /* An extern decl does not override previous storage class. */ - TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl); - if (! DECL_EXTERNAL (newdecl)) - DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl); - } - else - { - TREE_STATIC (olddecl) = TREE_STATIC (newdecl); - TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl); - } - - /* If either decl says `inline', this fn is inline, - unless its definition was passed already. */ - if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == 0) - DECL_INLINE (olddecl) = 1; - DECL_INLINE (newdecl) = DECL_INLINE (olddecl); - - if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - if (DECL_BUILT_IN (olddecl)) - { - /* Get rid of any built-in function if new arg types don't match it - or if we have a function definition. */ - if (! types_match || new_is_definition) - { - if (! different_binding_level) - { - TREE_TYPE (olddecl) = TREE_TYPE (newdecl); - DECL_BUILT_IN (olddecl) = 0; - } - } - else - { - /* If redeclaring a builtin function, and not a definition, - it stays built in. */ - DECL_BUILT_IN (newdecl) = 1; - DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl); - } - } - /* Also preserve various other info from the definition. */ - else if (! new_is_definition) - DECL_FRAME_SIZE (newdecl) = DECL_FRAME_SIZE (olddecl); - if (! new_is_definition) - { - DECL_RESULT (newdecl) = DECL_RESULT (olddecl); - /* When called with different_binding_level set, don't copy over - DECL_INITIAL, so that we don't accidentally change function - declarations into function definitions. */ - if (! different_binding_level) - DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); - DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl); - DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl); - if (DECL_INLINE (newdecl)) - DECL_ABSTRACT_ORIGIN (newdecl) = DECL_ORIGIN (olddecl); - } - } - if (different_binding_level) - { - /* Don't output a duplicate symbol or debugging information for this - declaration. - - Do not set TREE_ASM_WRITTEN for a FUNCTION_DECL since we may actually - just have two declarations without a definition. VAR_DECLs may need - the same treatment, I'm not sure. */ - if (TREE_CODE (newdecl) == FUNCTION_DECL) - DECL_IGNORED_P (newdecl) = 1; - else - TREE_ASM_WRITTEN (newdecl) = DECL_IGNORED_P (newdecl) = 1; - return 0; - } - - /* Copy most of the decl-specific fields of NEWDECL into OLDDECL. - But preserve OLDDECL's DECL_UID. */ - { - register unsigned olddecl_uid = DECL_UID (olddecl); - - bcopy ((char *) newdecl + sizeof (struct tree_common), - (char *) olddecl + sizeof (struct tree_common), - sizeof (struct tree_decl) - sizeof (struct tree_common)); - DECL_UID (olddecl) = olddecl_uid; - } - - /* NEWDECL contains the merged attribute lists. - Update OLDDECL to be the same. */ - DECL_MACHINE_ATTRIBUTES (olddecl) = DECL_MACHINE_ATTRIBUTES (newdecl); - - return 1; -} - -/* Record a decl-node X as belonging to the current lexical scope. - Check for errors (such as an incompatible declaration for the same - name already seen in the same scope). - - Returns either X or an old decl for the same name. - If an old decl is returned, it may have been smashed - to agree with what X says. */ - -tree -pushdecl (x) - tree x; -{ - register tree t; - register tree name = DECL_NAME (x); - register struct binding_level *b = current_binding_level; - - DECL_CONTEXT (x) = current_function_decl; - /* A local extern declaration for a function doesn't constitute nesting. - A local auto declaration does, since it's a forward decl - for a nested function coming later. */ - if (TREE_CODE (x) == FUNCTION_DECL && DECL_INITIAL (x) == 0 - && DECL_EXTERNAL (x)) - DECL_CONTEXT (x) = 0; - - if (warn_nested_externs && DECL_EXTERNAL (x) && b != global_binding_level - && x != IDENTIFIER_IMPLICIT_DECL (name) - /* Don't print error messages for __FUNCTION__ and __PRETTY_FUNCTION__ */ - && !DECL_IN_SYSTEM_HEADER (x)) - warning ("nested extern declaration of `%s'", IDENTIFIER_POINTER (name)); - - if (name) - { - char *file; - int line; - int different_binding_level = 0; - - t = lookup_name_current_level (name); - /* Don't type check externs here when -traditional. This is so that - code with conflicting declarations inside blocks will get warnings - not errors. X11 for instance depends on this. */ - if (! t && DECL_EXTERNAL (x) && TREE_PUBLIC (x) && ! flag_traditional) - { - t = IDENTIFIER_GLOBAL_VALUE (name); - /* Type decls at global scope don't conflict with externs declared - inside lexical blocks. */ - if (t && TREE_CODE (t) == TYPE_DECL) - t = 0; - different_binding_level = 1; - } - if (t != 0 && t == error_mark_node) - /* error_mark_node is 0 for a while during initialization! */ - { - t = 0; - error_with_decl (x, "`%s' used prior to declaration"); - } - - if (t != 0) - { - file = DECL_SOURCE_FILE (t); - line = DECL_SOURCE_LINE (t); - } - - /* If this decl is `static' and an implicit decl was seen previously, - warn. But don't complain if -traditional, - since traditional compilers don't complain. */ - if (! flag_traditional && TREE_PUBLIC (name) - /* Don't test for DECL_EXTERNAL, because grokdeclarator - sets this for all functions. */ - && ! TREE_PUBLIC (x) - && (TREE_CODE (x) == FUNCTION_DECL || b == global_binding_level) - /* We used to warn also for explicit extern followed by static, - but sometimes you need to do it that way. */ - && IDENTIFIER_IMPLICIT_DECL (name) != 0) - { - pedwarn ("`%s' was declared implicitly `extern' and later `static'", - IDENTIFIER_POINTER (name)); - pedwarn_with_file_and_line - (DECL_SOURCE_FILE (IDENTIFIER_IMPLICIT_DECL (name)), - DECL_SOURCE_LINE (IDENTIFIER_IMPLICIT_DECL (name)), - "previous declaration of `%s'", - IDENTIFIER_POINTER (name)); - TREE_THIS_VOLATILE (name) = 1; - } - - if (t != 0 && duplicate_decls (x, t, different_binding_level)) - { - if (TREE_CODE (t) == PARM_DECL) - { - /* Don't allow more than one "real" duplicate - of a forward parm decl. */ - TREE_ASM_WRITTEN (t) = TREE_ASM_WRITTEN (x); - return t; - } - return t; - } - - /* If we are processing a typedef statement, generate a whole new - ..._TYPE node (which will be just an variant of the existing - ..._TYPE node with identical properties) and then install the - TYPE_DECL node generated to represent the typedef name as the - TYPE_NAME of this brand new (duplicate) ..._TYPE node. - - The whole point here is to end up with a situation where each - and every ..._TYPE node the compiler creates will be uniquely - associated with AT MOST one node representing a typedef name. - This way, even though the compiler substitutes corresponding - ..._TYPE nodes for TYPE_DECL (i.e. "typedef name") nodes very - early on, later parts of the compiler can always do the reverse - translation and get back the corresponding typedef name. For - example, given: - - typedef struct S MY_TYPE; - MY_TYPE object; - - Later parts of the compiler might only know that `object' was of - type `struct S' if it were not for code just below. With this - code however, later parts of the compiler see something like: - - struct S' == struct S - typedef struct S' MY_TYPE; - struct S' object; - - And they can then deduce (from the node for type struct S') that - the original object declaration was: - - MY_TYPE object; - - Being able to do this is important for proper support of protoize, - and also for generating precise symbolic debugging information - which takes full account of the programmer's (typedef) vocabulary. - - Obviously, we don't want to generate a duplicate ..._TYPE node if - the TYPE_DECL node that we are now processing really represents a - standard built-in type. - - Since all standard types are effectively declared at line zero - in the source file, we can easily check to see if we are working - on a standard type by checking the current value of lineno. */ - - if (TREE_CODE (x) == TYPE_DECL) - { - if (DECL_SOURCE_LINE (x) == 0) - { - if (TYPE_NAME (TREE_TYPE (x)) == 0) - TYPE_NAME (TREE_TYPE (x)) = x; - } - else if (TREE_TYPE (x) != error_mark_node - && DECL_ORIGINAL_TYPE (x) == NULL_TREE) - { - tree tt = TREE_TYPE (x); - DECL_ORIGINAL_TYPE (x) = tt; - tt = build_type_copy (tt); - TYPE_NAME (tt) = x; - TREE_TYPE (x) = tt; - } - } - - /* Multiple external decls of the same identifier ought to match. - Check against both global declarations (when traditional) and out of - scope (limbo) block level declarations. - - We get warnings about inline functions where they are defined. - Avoid duplicate warnings where they are used. */ - if (TREE_PUBLIC (x) && ! DECL_INLINE (x)) - { - tree decl; - - if (flag_traditional && IDENTIFIER_GLOBAL_VALUE (name) != 0 - && (DECL_EXTERNAL (IDENTIFIER_GLOBAL_VALUE (name)) - || TREE_PUBLIC (IDENTIFIER_GLOBAL_VALUE (name)))) - decl = IDENTIFIER_GLOBAL_VALUE (name); - else if (IDENTIFIER_LIMBO_VALUE (name) != 0) - /* Decls in limbo are always extern, so no need to check that. */ - decl = IDENTIFIER_LIMBO_VALUE (name); - else - decl = 0; - - if (decl && ! comptypes (TREE_TYPE (x), TREE_TYPE (decl)) - /* If old decl is built-in, we already warned if we should. */ - && !DECL_BUILT_IN (decl)) - { - pedwarn_with_decl (x, - "type mismatch with previous external decl"); - pedwarn_with_decl (decl, "previous external decl of `%s'"); - } - } - - /* If a function has had an implicit declaration, and then is defined, - make sure they are compatible. */ - - if (IDENTIFIER_IMPLICIT_DECL (name) != 0 - && IDENTIFIER_GLOBAL_VALUE (name) == 0 - && TREE_CODE (x) == FUNCTION_DECL - && ! comptypes (TREE_TYPE (x), - TREE_TYPE (IDENTIFIER_IMPLICIT_DECL (name)))) - { - warning_with_decl (x, "type mismatch with previous implicit declaration"); - warning_with_decl (IDENTIFIER_IMPLICIT_DECL (name), - "previous implicit declaration of `%s'"); - } - - /* In PCC-compatibility mode, extern decls of vars with no current decl - take effect at top level no matter where they are. */ - if (flag_traditional && DECL_EXTERNAL (x) - && lookup_name (name) == 0) - { - tree type = TREE_TYPE (x); - - /* But don't do this if the type contains temporary nodes. */ - while (type) - { - if (type == error_mark_node) - break; - if (! TREE_PERMANENT (type)) - { - warning_with_decl (x, "type of external `%s' is not global"); - /* By exiting the loop early, we leave TYPE nonzero, - and thus prevent globalization of the decl. */ - break; - } - else if (TREE_CODE (type) == FUNCTION_TYPE - && TYPE_ARG_TYPES (type) != 0) - /* The types might not be truly local, - but the list of arg types certainly is temporary. - Since prototypes are nontraditional, - ok not to do the traditional thing. */ - break; - type = TREE_TYPE (type); - } - - if (type == 0) - b = global_binding_level; - } - - /* This name is new in its binding level. - Install the new declaration and return it. */ - if (b == global_binding_level) - { - /* Install a global value. */ - - /* If the first global decl has external linkage, - warn if we later see static one. */ - if (IDENTIFIER_GLOBAL_VALUE (name) == 0 && TREE_PUBLIC (x)) - TREE_PUBLIC (name) = 1; - - IDENTIFIER_GLOBAL_VALUE (name) = x; - - /* We no longer care about any previous block level declarations. */ - IDENTIFIER_LIMBO_VALUE (name) = 0; - - /* Don't forget if the function was used via an implicit decl. */ - if (IDENTIFIER_IMPLICIT_DECL (name) - && TREE_USED (IDENTIFIER_IMPLICIT_DECL (name))) - TREE_USED (x) = 1, TREE_USED (name) = 1; - - /* Don't forget if its address was taken in that way. */ - if (IDENTIFIER_IMPLICIT_DECL (name) - && TREE_ADDRESSABLE (IDENTIFIER_IMPLICIT_DECL (name))) - TREE_ADDRESSABLE (x) = 1; - - /* Warn about mismatches against previous implicit decl. */ - if (IDENTIFIER_IMPLICIT_DECL (name) != 0 - /* If this real decl matches the implicit, don't complain. */ - && ! (TREE_CODE (x) == FUNCTION_DECL - && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (x))) - == integer_type_node))) - pedwarn ("`%s' was previously implicitly declared to return `int'", - IDENTIFIER_POINTER (name)); - - /* If this decl is `static' and an `extern' was seen previously, - that is erroneous. */ - if (TREE_PUBLIC (name) - && ! TREE_PUBLIC (x) && ! DECL_EXTERNAL (x)) - { - /* Okay to redeclare an ANSI built-in as static. */ - if (t != 0 && DECL_BUILT_IN (t)) - ; - /* Okay to declare a non-ANSI built-in as anything. */ - else if (t != 0 && DECL_BUILT_IN_NONANSI (t)) - ; - /* Okay to have global type decl after an earlier extern - declaration inside a lexical block. */ - else if (TREE_CODE (x) == TYPE_DECL) - ; - else if (IDENTIFIER_IMPLICIT_DECL (name)) - { - if (! TREE_THIS_VOLATILE (name)) - pedwarn ("`%s' was declared implicitly `extern' and later `static'", - IDENTIFIER_POINTER (name)); - } - else - pedwarn ("`%s' was declared `extern' and later `static'", - IDENTIFIER_POINTER (name)); - } - } - else - { - /* Here to install a non-global value. */ - tree oldlocal = IDENTIFIER_LOCAL_VALUE (name); - tree oldglobal = IDENTIFIER_GLOBAL_VALUE (name); - IDENTIFIER_LOCAL_VALUE (name) = x; - - /* If this is an extern function declaration, see if we - have a global definition or declaration for the function. */ - if (oldlocal == 0 - && DECL_EXTERNAL (x) && !DECL_INLINE (x) - && oldglobal != 0 - && TREE_CODE (x) == FUNCTION_DECL - && TREE_CODE (oldglobal) == FUNCTION_DECL) - { - /* We have one. Their types must agree. */ - if (! comptypes (TREE_TYPE (x), - TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (name)))) - pedwarn_with_decl (x, "extern declaration of `%s' doesn't match global one"); - else - { - /* Inner extern decl is inline if global one is. - Copy enough to really inline it. */ - if (DECL_INLINE (oldglobal)) - { - DECL_INLINE (x) = DECL_INLINE (oldglobal); - DECL_INITIAL (x) = (current_function_decl == oldglobal - ? 0 : DECL_INITIAL (oldglobal)); - DECL_SAVED_INSNS (x) = DECL_SAVED_INSNS (oldglobal); - DECL_FRAME_SIZE (x) = DECL_FRAME_SIZE (oldglobal); - DECL_ARGUMENTS (x) = DECL_ARGUMENTS (oldglobal); - DECL_RESULT (x) = DECL_RESULT (oldglobal); - TREE_ASM_WRITTEN (x) = TREE_ASM_WRITTEN (oldglobal); - DECL_ABSTRACT_ORIGIN (x) = DECL_ORIGIN (oldglobal); - } - /* Inner extern decl is built-in if global one is. */ - if (DECL_BUILT_IN (oldglobal)) - { - DECL_BUILT_IN (x) = DECL_BUILT_IN (oldglobal); - DECL_FUNCTION_CODE (x) = DECL_FUNCTION_CODE (oldglobal); - } - /* Keep the arg types from a file-scope fcn defn. */ - if (TYPE_ARG_TYPES (TREE_TYPE (oldglobal)) != 0 - && DECL_INITIAL (oldglobal) - && TYPE_ARG_TYPES (TREE_TYPE (x)) == 0) - TREE_TYPE (x) = TREE_TYPE (oldglobal); - } - } - -#if 0 /* This case is probably sometimes the right thing to do. */ - /* If we have a local external declaration, - then any file-scope declaration should not - have been static. */ - if (oldlocal == 0 && oldglobal != 0 - && !TREE_PUBLIC (oldglobal) - && DECL_EXTERNAL (x) && TREE_PUBLIC (x)) - warning ("`%s' locally external but globally static", - IDENTIFIER_POINTER (name)); -#endif - - /* If we have a local external declaration, - and no file-scope declaration has yet been seen, - then if we later have a file-scope decl it must not be static. */ - if (oldlocal == 0 - && DECL_EXTERNAL (x) - && TREE_PUBLIC (x)) - { - if (oldglobal == 0) - TREE_PUBLIC (name) = 1; - - /* Save this decl, so that we can do type checking against - other decls after it falls out of scope. - - Only save it once. This prevents temporary decls created in - expand_inline_function from being used here, since this - will have been set when the inline function was parsed. - It also helps give slightly better warnings. */ - if (IDENTIFIER_LIMBO_VALUE (name) == 0) - IDENTIFIER_LIMBO_VALUE (name) = x; - } - - /* Warn if shadowing an argument at the top level of the body. */ - if (oldlocal != 0 && !DECL_EXTERNAL (x) - /* This warning doesn't apply to the parms of a nested fcn. */ - && ! current_binding_level->parm_flag - /* Check that this is one level down from the parms. */ - && current_binding_level->level_chain->parm_flag - /* Check that the decl being shadowed - comes from the parm level, one level up. */ - && chain_member (oldlocal, current_binding_level->level_chain->names)) - { - if (TREE_CODE (oldlocal) == PARM_DECL) - pedwarn ("declaration of `%s' shadows a parameter", - IDENTIFIER_POINTER (name)); - else - pedwarn ("declaration of `%s' shadows a symbol from the parameter list", - IDENTIFIER_POINTER (name)); - } - - /* Maybe warn if shadowing something else. */ - else if (warn_shadow && !DECL_EXTERNAL (x) - /* No shadow warnings for internally generated vars. */ - && DECL_SOURCE_LINE (x) != 0 - /* No shadow warnings for vars made for inlining. */ - && ! DECL_FROM_INLINE (x)) - { - char *id = IDENTIFIER_POINTER (name); - - if (TREE_CODE (x) == PARM_DECL - && current_binding_level->level_chain->parm_flag) - /* Don't warn about the parm names in function declarator - within a function declarator. - It would be nice to avoid warning in any function - declarator in a declaration, as opposed to a definition, - but there is no way to tell it's not a definition. */ - ; - else if (oldlocal != 0 && TREE_CODE (oldlocal) == PARM_DECL) - warning ("declaration of `%s' shadows a parameter", id); - else if (oldlocal != 0) - warning ("declaration of `%s' shadows previous local", id); - else if (IDENTIFIER_GLOBAL_VALUE (name) != 0 - && IDENTIFIER_GLOBAL_VALUE (name) != error_mark_node) - warning ("declaration of `%s' shadows global declaration", id); - } - - /* If storing a local value, there may already be one (inherited). - If so, record it for restoration when this binding level ends. */ - if (oldlocal != 0) - b->shadowed = tree_cons (name, oldlocal, b->shadowed); - } - - /* Keep count of variables in this level with incomplete type. */ - if (TYPE_SIZE (TREE_TYPE (x)) == 0) - ++b->n_incomplete; - } - - /* Put decls on list in reverse order. - We will reverse them later if necessary. */ - TREE_CHAIN (x) = b->names; - b->names = x; - - return x; -} - -/* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL, if appropriate. */ - -tree -pushdecl_top_level (x) - tree x; -{ - register tree t; - register struct binding_level *b = current_binding_level; - - current_binding_level = global_binding_level; - t = pushdecl (x); - current_binding_level = b; - return t; -} - -/* Generate an implicit declaration for identifier FUNCTIONID - as a function of type int (). Print a warning if appropriate. */ - -tree -implicitly_declare (functionid) - tree functionid; -{ - register tree decl; - int traditional_warning = 0; - /* Only one "implicit declaration" warning per identifier. */ - int implicit_warning; - - /* Save the decl permanently so we can warn if definition follows. */ - push_obstacks_nochange (); - end_temporary_allocation (); - - /* We used to reuse an old implicit decl here, - but this loses with inline functions because it can clobber - the saved decl chains. */ -/* if (IDENTIFIER_IMPLICIT_DECL (functionid) != 0) - decl = IDENTIFIER_IMPLICIT_DECL (functionid); - else */ - decl = build_decl (FUNCTION_DECL, functionid, default_function_type); - - /* Warn of implicit decl following explicit local extern decl. - This is probably a program designed for traditional C. */ - if (TREE_PUBLIC (functionid) && IDENTIFIER_GLOBAL_VALUE (functionid) == 0) - traditional_warning = 1; - - /* Warn once of an implicit declaration. */ - implicit_warning = (IDENTIFIER_IMPLICIT_DECL (functionid) == 0); - - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; - - /* Record that we have an implicit decl and this is it. */ - IDENTIFIER_IMPLICIT_DECL (functionid) = decl; - - /* ANSI standard says implicit declarations are in the innermost block. - So we record the decl in the standard fashion. - If flag_traditional is set, pushdecl does it top-level. */ - pushdecl (decl); - - /* This is a no-op in c-lang.c or something real in objc-actions.c. */ - maybe_objc_check_decl (decl); - - rest_of_decl_compilation (decl, NULL_PTR, 0, 0); - - if (mesg_implicit_function_declaration && implicit_warning) - { - if (mesg_implicit_function_declaration == 2) - error ("implicit declaration of function `%s'", - IDENTIFIER_POINTER (functionid)); - else - warning ("implicit declaration of function `%s'", - IDENTIFIER_POINTER (functionid)); - } - else if (warn_traditional && traditional_warning) - warning ("function `%s' was previously declared within a block", - IDENTIFIER_POINTER (functionid)); - - /* Write a record describing this implicit function declaration to the - prototypes file (if requested). */ - - gen_aux_info_record (decl, 0, 1, 0); - - pop_obstacks (); - - return decl; -} - -/* Return zero if the declaration NEWDECL is valid - when the declaration OLDDECL (assumed to be for the same name) - has already been seen. - Otherwise return 1 if NEWDECL is a redefinition, 2 if it is a redeclaration, - and 3 if it is a conflicting declaration. */ - -static int -redeclaration_error_message (newdecl, olddecl) - tree newdecl, olddecl; -{ - if (TREE_CODE (newdecl) == TYPE_DECL) - { - if (flag_traditional && TREE_TYPE (newdecl) == TREE_TYPE (olddecl)) - return 0; - /* pushdecl creates distinct types for TYPE_DECLs by calling - build_type_copy, so the above comparison generally fails. We do - another test against the TYPE_MAIN_VARIANT of the olddecl, which - is equivalent to what this code used to do before the build_type_copy - call. The variant type distinction should not matter for traditional - code, because it doesn't have type qualifiers. */ - if (flag_traditional - && TYPE_MAIN_VARIANT (TREE_TYPE (olddecl)) == TREE_TYPE (newdecl)) - return 0; - if (DECL_IN_SYSTEM_HEADER (olddecl) || DECL_IN_SYSTEM_HEADER (newdecl)) - return 0; - return 1; - } - else if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - /* Declarations of functions can insist on internal linkage - but they can't be inconsistent with internal linkage, - so there can be no error on that account. - However defining the same name twice is no good. */ - if (DECL_INITIAL (olddecl) != 0 && DECL_INITIAL (newdecl) != 0 - /* However, defining once as extern inline and a second - time in another way is ok. */ - && !(DECL_INLINE (olddecl) && DECL_EXTERNAL (olddecl) - && !(DECL_INLINE (newdecl) && DECL_EXTERNAL (newdecl)))) - return 1; - return 0; - } - else if (current_binding_level == global_binding_level) - { - /* Objects declared at top level: */ - /* If at least one is a reference, it's ok. */ - if (DECL_EXTERNAL (newdecl) || DECL_EXTERNAL (olddecl)) - return 0; - /* Reject two definitions. */ - if (DECL_INITIAL (olddecl) != 0 && DECL_INITIAL (newdecl) != 0) - return 1; - /* Now we have two tentative defs, or one tentative and one real def. */ - /* Insist that the linkage match. */ - if (TREE_PUBLIC (olddecl) != TREE_PUBLIC (newdecl)) - return 3; - return 0; - } - else if (current_binding_level->parm_flag - && TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl)) - return 0; - else - { - /* Newdecl has block scope. If olddecl has block scope also, then - reject two definitions, and reject a definition together with an - external reference. Otherwise, it is OK, because newdecl must - be an extern reference to olddecl. */ - if (!(DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl)) - && DECL_CONTEXT (newdecl) == DECL_CONTEXT (olddecl)) - return 2; - return 0; - } -} - -/* Get the LABEL_DECL corresponding to identifier ID as a label. - Create one if none exists so far for the current function. - This function is called for both label definitions and label references. */ - -tree -lookup_label (id) - tree id; -{ - register tree decl = IDENTIFIER_LABEL_VALUE (id); - - if (current_function_decl == 0) - { - error ("label %s referenced outside of any function", - IDENTIFIER_POINTER (id)); - return 0; - } - - /* Use a label already defined or ref'd with this name. */ - if (decl != 0) - { - /* But not if it is inherited and wasn't declared to be inheritable. */ - if (DECL_CONTEXT (decl) != current_function_decl - && ! C_DECLARED_LABEL_FLAG (decl)) - return shadow_label (id); - return decl; - } - - decl = build_decl (LABEL_DECL, id, void_type_node); - - /* Make sure every label has an rtx. */ - label_rtx (decl); - - /* A label not explicitly declared must be local to where it's ref'd. */ - DECL_CONTEXT (decl) = current_function_decl; - - DECL_MODE (decl) = VOIDmode; - - /* Say where one reference is to the label, - for the sake of the error if it is not defined. */ - DECL_SOURCE_LINE (decl) = lineno; - DECL_SOURCE_FILE (decl) = input_filename; - - IDENTIFIER_LABEL_VALUE (id) = decl; - - named_labels = tree_cons (NULL_TREE, decl, named_labels); - - return decl; -} - -/* Make a label named NAME in the current function, - shadowing silently any that may be inherited from containing functions - or containing scopes. - - Note that valid use, if the label being shadowed - comes from another scope in the same function, - requires calling declare_nonlocal_label right away. */ - -tree -shadow_label (name) - tree name; -{ - register tree decl = IDENTIFIER_LABEL_VALUE (name); - - if (decl != 0) - { - register tree dup; - - /* Check to make sure that the label hasn't already been declared - at this label scope */ - for (dup = named_labels; dup; dup = TREE_CHAIN (dup)) - if (TREE_VALUE (dup) == decl) - { - error ("duplicate label declaration `%s'", - IDENTIFIER_POINTER (name)); - error_with_decl (TREE_VALUE (dup), - "this is a previous declaration"); - /* Just use the previous declaration. */ - return lookup_label (name); - } - - shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels); - IDENTIFIER_LABEL_VALUE (name) = decl = 0; - } - - return lookup_label (name); -} - -/* Define a label, specifying the location in the source file. - Return the LABEL_DECL node for the label, if the definition is valid. - Otherwise return 0. */ - -tree -define_label (filename, line, name) - char *filename; - int line; - tree name; -{ - tree decl = lookup_label (name); - - /* If label with this name is known from an outer context, shadow it. */ - if (decl != 0 && DECL_CONTEXT (decl) != current_function_decl) - { - shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels); - IDENTIFIER_LABEL_VALUE (name) = 0; - decl = lookup_label (name); - } - - if (DECL_INITIAL (decl) != 0) - { - error ("duplicate label `%s'", IDENTIFIER_POINTER (name)); - return 0; - } - else - { - /* Mark label as having been defined. */ - DECL_INITIAL (decl) = error_mark_node; - /* Say where in the source. */ - DECL_SOURCE_FILE (decl) = filename; - DECL_SOURCE_LINE (decl) = line; - return decl; - } -} - -/* Return the list of declarations of the current level. - Note that this list is in reverse order unless/until - you nreverse it; and when you do nreverse it, you must - store the result back using `storedecls' or you will lose. */ - -tree -getdecls () -{ - return current_binding_level->names; -} - -/* Return the list of type-tags (for structs, etc) of the current level. */ - -tree -gettags () -{ - return current_binding_level->tags; -} - -/* Store the list of declarations of the current level. - This is done for the parameter declarations of a function being defined, - after they are modified in the light of any missing parameters. */ - -static void -storedecls (decls) - tree decls; -{ - current_binding_level->names = decls; -} - -/* Similarly, store the list of tags of the current level. */ - -static void -storetags (tags) - tree tags; -{ - current_binding_level->tags = tags; -} - -/* Given NAME, an IDENTIFIER_NODE, - return the structure (or union or enum) definition for that name. - Searches binding levels from BINDING_LEVEL up to the global level. - If THISLEVEL_ONLY is nonzero, searches only the specified context - (but skips any tag-transparent contexts to find one that is - meaningful for tags). - CODE says which kind of type the caller wants; - it is RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE. - If the wrong kind of type is found, an error is reported. */ - -static tree -lookup_tag (code, name, binding_level, thislevel_only) - enum tree_code code; - struct binding_level *binding_level; - tree name; - int thislevel_only; -{ - register struct binding_level *level; - - for (level = binding_level; level; level = level->level_chain) - { - register tree tail; - for (tail = level->tags; tail; tail = TREE_CHAIN (tail)) - { - if (TREE_PURPOSE (tail) == name) - { - if (TREE_CODE (TREE_VALUE (tail)) != code) - { - /* Definition isn't the kind we were looking for. */ - pending_invalid_xref = name; - pending_invalid_xref_file = input_filename; - pending_invalid_xref_line = lineno; - } - return TREE_VALUE (tail); - } - } - if (thislevel_only && ! level->tag_transparent) - return NULL_TREE; - } - return NULL_TREE; -} - -/* Print an error message now - for a recent invalid struct, union or enum cross reference. - We don't print them immediately because they are not invalid - when used in the `struct foo;' construct for shadowing. */ - -void -pending_xref_error () -{ - if (pending_invalid_xref != 0) - error_with_file_and_line (pending_invalid_xref_file, - pending_invalid_xref_line, - "`%s' defined as wrong kind of tag", - IDENTIFIER_POINTER (pending_invalid_xref)); - pending_invalid_xref = 0; -} - -/* Given a type, find the tag that was defined for it and return the tag name. - Otherwise return 0. */ - -static tree -lookup_tag_reverse (type) - tree type; -{ - register struct binding_level *level; - - for (level = current_binding_level; level; level = level->level_chain) - { - register tree tail; - for (tail = level->tags; tail; tail = TREE_CHAIN (tail)) - { - if (TREE_VALUE (tail) == type) - return TREE_PURPOSE (tail); - } - } - return NULL_TREE; -} - -/* Look up NAME in the current binding level and its superiors - in the namespace of variables, functions and typedefs. - Return a ..._DECL node of some kind representing its definition, - or return 0 if it is undefined. */ - -tree -lookup_name (name) - tree name; -{ - register tree val; - if (current_binding_level != global_binding_level - && IDENTIFIER_LOCAL_VALUE (name)) - val = IDENTIFIER_LOCAL_VALUE (name); - else - val = IDENTIFIER_GLOBAL_VALUE (name); - return val; -} - -/* Similar to `lookup_name' but look only at current binding level. */ - -tree -lookup_name_current_level (name) - tree name; -{ - register tree t; - - if (current_binding_level == global_binding_level) - return IDENTIFIER_GLOBAL_VALUE (name); - - if (IDENTIFIER_LOCAL_VALUE (name) == 0) - return 0; - - for (t = current_binding_level->names; t; t = TREE_CHAIN (t)) - if (DECL_NAME (t) == name) - break; - - return t; -} - -/* Create the predefined scalar types of C, - and some nodes representing standard constants (0, 1, (void *) 0). - Initialize the global binding level. - Make definitions for built-in primitive functions. */ - -void -init_decl_processing () -{ - register tree endlink; - /* Either char* or void*. */ - tree traditional_ptr_type_node; - /* Data types of memcpy and strlen. */ - tree memcpy_ftype, memset_ftype, strlen_ftype; - tree void_ftype_any, ptr_ftype_void, ptr_ftype_ptr; - int wchar_type_size; - tree temp; - tree array_domain_type; - - current_function_decl = NULL; - named_labels = NULL; - current_binding_level = NULL_BINDING_LEVEL; - free_binding_level = NULL_BINDING_LEVEL; - pushlevel (0); /* make the binding_level structure for global names */ - global_binding_level = current_binding_level; - - /* Define `int' and `char' first so that dbx will output them first. */ - - integer_type_node = make_signed_type (INT_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_INT], - integer_type_node)); - - /* Define `char', which is like either `signed char' or `unsigned char' - but not the same as either. */ - - char_type_node - = (flag_signed_char - ? make_signed_type (CHAR_TYPE_SIZE) - : make_unsigned_type (CHAR_TYPE_SIZE)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), - char_type_node)); - - long_integer_type_node = make_signed_type (LONG_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long int"), - long_integer_type_node)); - - unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"), - unsigned_type_node)); - - long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long unsigned int"), - long_unsigned_type_node)); - - long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long long int"), - long_long_integer_type_node)); - - long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"), - long_long_unsigned_type_node)); - - short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("short int"), - short_integer_type_node)); - - short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("short unsigned int"), - short_unsigned_type_node)); - - /* `unsigned long' is the standard type for sizeof. - Traditionally, use a signed type. - Note that stddef.h uses `unsigned long', - and this must agree, even if long and int are the same size. */ - set_sizetype - (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)))); - if (flag_traditional && TREE_UNSIGNED (sizetype)) - set_sizetype (signed_type (sizetype)); - - ptrdiff_type_node - = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE))); - - error_mark_node = make_node (ERROR_MARK); - TREE_TYPE (error_mark_node) = error_mark_node; - - /* Define both `signed char' and `unsigned char'. */ - signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("signed char"), - signed_char_type_node)); - - unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned char"), - unsigned_char_type_node)); - - intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node)); - - intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node)); - - intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node)); - - intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node)); - -#if HOST_BITS_PER_WIDE_INT >= 64 - intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intTI_type_node)); -#endif - - unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node)); - - unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node)); - - unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node)); - - unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node)); - -#if HOST_BITS_PER_WIDE_INT >= 64 - unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intTI_type_node)); -#endif - - float_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE; - pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_FLOAT], - float_type_node)); - layout_type (float_type_node); - - double_type_node = make_node (REAL_TYPE); - if (flag_short_double) - TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE; - else - TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE; - pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_DOUBLE], - double_type_node)); - layout_type (double_type_node); - - long_double_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE; - pushdecl (build_decl (TYPE_DECL, get_identifier ("long double"), - long_double_type_node)); - layout_type (long_double_type_node); - - complex_integer_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), - complex_integer_type_node)); - TREE_TYPE (complex_integer_type_node) = integer_type_node; - layout_type (complex_integer_type_node); - - complex_float_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), - complex_float_type_node)); - TREE_TYPE (complex_float_type_node) = float_type_node; - layout_type (complex_float_type_node); - - complex_double_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), - complex_double_type_node)); - TREE_TYPE (complex_double_type_node) = double_type_node; - layout_type (complex_double_type_node); - - complex_long_double_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), - complex_long_double_type_node)); - TREE_TYPE (complex_long_double_type_node) = long_double_type_node; - layout_type (complex_long_double_type_node); - - wchar_type_node - = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WCHAR_TYPE))); - wchar_type_size = TYPE_PRECISION (wchar_type_node); - signed_wchar_type_node = signed_type (wchar_type_node); - unsigned_wchar_type_node = unsigned_type (wchar_type_node); - - integer_zero_node = build_int_2 (0, 0); - TREE_TYPE (integer_zero_node) = integer_type_node; - integer_one_node = build_int_2 (1, 0); - TREE_TYPE (integer_one_node) = integer_type_node; - - boolean_type_node = integer_type_node; - boolean_true_node = integer_one_node; - boolean_false_node = integer_zero_node; - - size_zero_node = build_int_2 (0, 0); - TREE_TYPE (size_zero_node) = sizetype; - size_one_node = build_int_2 (1, 0); - TREE_TYPE (size_one_node) = sizetype; - - void_type_node = make_node (VOID_TYPE); - pushdecl (build_decl (TYPE_DECL, - ridpointers[(int) RID_VOID], void_type_node)); - layout_type (void_type_node); /* Uses integer_zero_node */ - /* We are not going to have real types in C with less than byte alignment, - so we might as well not have any types that claim to have it. */ - TYPE_ALIGN (void_type_node) = BITS_PER_UNIT; - - null_pointer_node = build_int_2 (0, 0); - TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node); - layout_type (TREE_TYPE (null_pointer_node)); - - string_type_node = build_pointer_type (char_type_node); - const_string_type_node - = build_pointer_type (build_type_variant (char_type_node, 1, 0)); - - /* Make a type to be the domain of a few array types - whose domains don't really matter. - 200 is small enough that it always fits in size_t - and large enough that it can hold most function names for the - initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */ - array_domain_type = build_index_type (build_int_2 (200, 0)); - - /* make a type for arrays of characters. - With luck nothing will ever really depend on the length of this - array type. */ - char_array_type_node - = build_array_type (char_type_node, array_domain_type); - /* Likewise for arrays of ints. */ - int_array_type_node - = build_array_type (integer_type_node, array_domain_type); - /* This is for wide string constants. */ - wchar_array_type_node - = build_array_type (wchar_type_node, array_domain_type); - - default_function_type - = build_function_type (integer_type_node, NULL_TREE); - - ptr_type_node = build_pointer_type (void_type_node); - const_ptr_type_node - = build_pointer_type (build_type_variant (void_type_node, 1, 0)); - - endlink = tree_cons (NULL_TREE, void_type_node, NULL_TREE); - - void_ftype_any - = build_function_type (void_type_node, NULL_TREE); - - float_ftype_float - = build_function_type (float_type_node, - tree_cons (NULL_TREE, float_type_node, endlink)); - - double_ftype_double - = build_function_type (double_type_node, - tree_cons (NULL_TREE, double_type_node, endlink)); - - ldouble_ftype_ldouble - = build_function_type (long_double_type_node, - tree_cons (NULL_TREE, long_double_type_node, - endlink)); - - double_ftype_double_double - = build_function_type (double_type_node, - tree_cons (NULL_TREE, double_type_node, - tree_cons (NULL_TREE, - double_type_node, endlink))); - - int_ftype_int - = build_function_type (integer_type_node, - tree_cons (NULL_TREE, integer_type_node, endlink)); - - long_ftype_long - = build_function_type (long_integer_type_node, - tree_cons (NULL_TREE, - long_integer_type_node, endlink)); - - void_ftype_ptr_ptr_int - = build_function_type (void_type_node, - tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, - integer_type_node, - endlink)))); - - int_ftype_cptr_cptr_sizet - = build_function_type (integer_type_node, - tree_cons (NULL_TREE, const_ptr_type_node, - tree_cons (NULL_TREE, const_ptr_type_node, - tree_cons (NULL_TREE, - sizetype, - endlink)))); - - void_ftype_ptr_int_int - = build_function_type (void_type_node, - tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, integer_type_node, - tree_cons (NULL_TREE, - integer_type_node, - endlink)))); - - string_ftype_ptr_ptr /* strcpy prototype */ - = build_function_type (string_type_node, - tree_cons (NULL_TREE, string_type_node, - tree_cons (NULL_TREE, - const_string_type_node, - endlink))); - - int_ftype_string_string /* strcmp prototype */ - = build_function_type (integer_type_node, - tree_cons (NULL_TREE, const_string_type_node, - tree_cons (NULL_TREE, - const_string_type_node, - endlink))); - - strlen_ftype /* strlen prototype */ - = build_function_type (flag_traditional ? integer_type_node : sizetype, - tree_cons (NULL_TREE, const_string_type_node, - endlink)); - - traditional_ptr_type_node - = (flag_traditional ? string_type_node : ptr_type_node); - - memcpy_ftype /* memcpy prototype */ - = build_function_type (traditional_ptr_type_node, - tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, const_ptr_type_node, - tree_cons (NULL_TREE, - sizetype, - endlink)))); - - memset_ftype /* memset prototype */ - = build_function_type (traditional_ptr_type_node, - tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, integer_type_node, - tree_cons (NULL_TREE, - sizetype, - endlink)))); - - ptr_ftype_void = build_function_type (ptr_type_node, endlink); - ptr_ftype_ptr - = build_function_type (ptr_type_node, - tree_cons (NULL_TREE, ptr_type_node, endlink)); - - builtin_function ("__builtin_constant_p", default_function_type, - BUILT_IN_CONSTANT_P, NULL_PTR); - - builtin_function ("__builtin_return_address", - build_function_type (ptr_type_node, - tree_cons (NULL_TREE, - unsigned_type_node, - endlink)), - BUILT_IN_RETURN_ADDRESS, NULL_PTR); - - builtin_function ("__builtin_frame_address", - build_function_type (ptr_type_node, - tree_cons (NULL_TREE, - unsigned_type_node, - endlink)), - BUILT_IN_FRAME_ADDRESS, NULL_PTR); - - builtin_function ("__builtin_aggregate_incoming_address", - build_function_type (ptr_type_node, NULL_TREE), - BUILT_IN_AGGREGATE_INCOMING_ADDRESS, NULL_PTR); - - /* Hooks for the DWARF 2 __throw routine. */ - builtin_function ("__builtin_unwind_init", - build_function_type (void_type_node, endlink), - BUILT_IN_UNWIND_INIT, NULL_PTR); - builtin_function ("__builtin_dwarf_cfa", ptr_ftype_void, - BUILT_IN_DWARF_CFA, NULL_PTR); - builtin_function ("__builtin_dwarf_fp_regnum", - build_function_type (unsigned_type_node, endlink), - BUILT_IN_DWARF_FP_REGNUM, NULL_PTR); - builtin_function ("__builtin_dwarf_reg_size", int_ftype_int, - BUILT_IN_DWARF_REG_SIZE, NULL_PTR); - builtin_function ("__builtin_frob_return_addr", ptr_ftype_ptr, - BUILT_IN_FROB_RETURN_ADDR, NULL_PTR); - builtin_function ("__builtin_extract_return_addr", ptr_ftype_ptr, - BUILT_IN_EXTRACT_RETURN_ADDR, NULL_PTR); - builtin_function - ("__builtin_eh_return", - build_function_type (void_type_node, - tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, - type_for_mode (ptr_mode, 0), - tree_cons (NULL_TREE, - ptr_type_node, - endlink)))), - BUILT_IN_EH_RETURN, NULL_PTR); - - builtin_function ("__builtin_alloca", - build_function_type (ptr_type_node, - tree_cons (NULL_TREE, - sizetype, - endlink)), - BUILT_IN_ALLOCA, "alloca"); - builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR); - /* Define alloca, ffs as builtins. - Declare _exit just to mark it as volatile. */ - if (! flag_no_builtin && !flag_no_nonansi_builtin) - { - temp = builtin_function ("alloca", - build_function_type (ptr_type_node, - tree_cons (NULL_TREE, - sizetype, - endlink)), - BUILT_IN_ALLOCA, NULL_PTR); - /* Suppress error if redefined as a non-function. */ - DECL_BUILT_IN_NONANSI (temp) = 1; - temp = builtin_function ("ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR); - /* Suppress error if redefined as a non-function. */ - DECL_BUILT_IN_NONANSI (temp) = 1; - temp = builtin_function ("_exit", void_ftype_any, NOT_BUILT_IN, - NULL_PTR); - TREE_THIS_VOLATILE (temp) = 1; - TREE_SIDE_EFFECTS (temp) = 1; - /* Suppress error if redefined as a non-function. */ - DECL_BUILT_IN_NONANSI (temp) = 1; - } - - builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR); - builtin_function ("__builtin_fabsf", float_ftype_float, BUILT_IN_FABS, - NULL_PTR); - builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS, - NULL_PTR); - builtin_function ("__builtin_fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS, - NULL_PTR); - builtin_function ("__builtin_labs", long_ftype_long, BUILT_IN_LABS, - NULL_PTR); - builtin_function ("__builtin_saveregs", - build_function_type (ptr_type_node, NULL_TREE), - BUILT_IN_SAVEREGS, NULL_PTR); -/* EXPAND_BUILTIN_VARARGS is obsolete. */ -#if 0 - builtin_function ("__builtin_varargs", - build_function_type (ptr_type_node, - tree_cons (NULL_TREE, - integer_type_node, - endlink)), - BUILT_IN_VARARGS, NULL_PTR); -#endif - builtin_function ("__builtin_classify_type", default_function_type, - BUILT_IN_CLASSIFY_TYPE, NULL_PTR); - builtin_function ("__builtin_next_arg", - build_function_type (ptr_type_node, NULL_TREE), - BUILT_IN_NEXT_ARG, NULL_PTR); - builtin_function ("__builtin_args_info", - build_function_type (integer_type_node, - tree_cons (NULL_TREE, - integer_type_node, - endlink)), - BUILT_IN_ARGS_INFO, NULL_PTR); - - /* Untyped call and return. */ - builtin_function ("__builtin_apply_args", - build_function_type (ptr_type_node, NULL_TREE), - BUILT_IN_APPLY_ARGS, NULL_PTR); - - temp = tree_cons (NULL_TREE, - build_pointer_type (build_function_type (void_type_node, - NULL_TREE)), - tree_cons (NULL_TREE, - ptr_type_node, - tree_cons (NULL_TREE, - sizetype, - endlink))); - builtin_function ("__builtin_apply", - build_function_type (ptr_type_node, temp), - BUILT_IN_APPLY, NULL_PTR); - builtin_function ("__builtin_return", - build_function_type (void_type_node, - tree_cons (NULL_TREE, - ptr_type_node, - endlink)), - BUILT_IN_RETURN, NULL_PTR); - - /* Currently under experimentation. */ - builtin_function ("__builtin_memcpy", memcpy_ftype, - BUILT_IN_MEMCPY, "memcpy"); - builtin_function ("__builtin_memcmp", int_ftype_cptr_cptr_sizet, - BUILT_IN_MEMCMP, "memcmp"); - builtin_function ("__builtin_memset", memset_ftype, - BUILT_IN_MEMSET, "memset"); - builtin_function ("__builtin_strcmp", int_ftype_string_string, - BUILT_IN_STRCMP, "strcmp"); - builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr, - BUILT_IN_STRCPY, "strcpy"); - builtin_function ("__builtin_strlen", strlen_ftype, - BUILT_IN_STRLEN, "strlen"); - builtin_function ("__builtin_sqrtf", float_ftype_float, - BUILT_IN_FSQRT, "sqrtf"); - builtin_function ("__builtin_fsqrt", double_ftype_double, - BUILT_IN_FSQRT, "sqrt"); - builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble, - BUILT_IN_FSQRT, "sqrtl"); - builtin_function ("__builtin_sinf", float_ftype_float, - BUILT_IN_SIN, "sinf"); - builtin_function ("__builtin_sin", double_ftype_double, - BUILT_IN_SIN, "sin"); - builtin_function ("__builtin_sinl", ldouble_ftype_ldouble, - BUILT_IN_SIN, "sinl"); - builtin_function ("__builtin_cosf", float_ftype_float, - BUILT_IN_COS, "cosf"); - builtin_function ("__builtin_cos", double_ftype_double, - BUILT_IN_COS, "cos"); - builtin_function ("__builtin_cosl", ldouble_ftype_ldouble, - BUILT_IN_COS, "cosl"); - builtin_function ("__builtin_setjmp", - build_function_type (integer_type_node, - tree_cons (NULL_TREE, - ptr_type_node, endlink)), - BUILT_IN_SETJMP, NULL_PTR); - builtin_function ("__builtin_longjmp", - build_function_type - (void_type_node, - tree_cons (NULL, ptr_type_node, - tree_cons (NULL_TREE, - integer_type_node, - endlink))), - BUILT_IN_LONGJMP, NULL_PTR); - builtin_function ("__builtin_trap", - build_function_type (void_type_node, endlink), - BUILT_IN_TRAP, NULL_PTR); - - /* In an ANSI C program, it is okay to supply built-in meanings - for these functions, since applications cannot validly use them - with any other meaning. - However, honor the -fno-builtin option. */ - if (!flag_no_builtin) - { - builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR); - builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR); - builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR); - builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS, - NULL_PTR); - builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR); - builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, NULL_PTR); - builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP, - NULL_PTR); - builtin_function ("memset", memset_ftype, BUILT_IN_MEMSET, NULL_PTR); - builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP, - NULL_PTR); - builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY, - NULL_PTR); - builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, NULL_PTR); - builtin_function ("sqrtf", float_ftype_float, BUILT_IN_FSQRT, NULL_PTR); - builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, NULL_PTR); - builtin_function ("sqrtl", ldouble_ftype_ldouble, BUILT_IN_FSQRT, - NULL_PTR); - builtin_function ("sinf", float_ftype_float, BUILT_IN_SIN, NULL_PTR); - builtin_function ("sin", double_ftype_double, BUILT_IN_SIN, NULL_PTR); - builtin_function ("sinl", ldouble_ftype_ldouble, BUILT_IN_SIN, NULL_PTR); - builtin_function ("cosf", float_ftype_float, BUILT_IN_COS, NULL_PTR); - builtin_function ("cos", double_ftype_double, BUILT_IN_COS, NULL_PTR); - builtin_function ("cosl", ldouble_ftype_ldouble, BUILT_IN_COS, NULL_PTR); - - /* Declare these functions volatile - to avoid spurious "control drops through" warnings. */ - /* Don't specify the argument types, to avoid errors - from certain code which isn't valid in ANSI but which exists. */ - temp = builtin_function ("abort", void_ftype_any, NOT_BUILT_IN, - NULL_PTR); - TREE_THIS_VOLATILE (temp) = 1; - TREE_SIDE_EFFECTS (temp) = 1; - temp = builtin_function ("exit", void_ftype_any, NOT_BUILT_IN, NULL_PTR); - TREE_THIS_VOLATILE (temp) = 1; - TREE_SIDE_EFFECTS (temp) = 1; - } - -#if 0 - /* Support for these has not been written in either expand_builtin - or build_function_call. */ - builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, NULL_PTR); - builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, NULL_PTR); - builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR, - NULL_PTR); - builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL, - NULL_PTR); - builtin_function ("__builtin_fmod", double_ftype_double_double, - BUILT_IN_FMOD, NULL_PTR); - builtin_function ("__builtin_frem", double_ftype_double_double, - BUILT_IN_FREM, NULL_PTR); - builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP, - NULL_PTR); - builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN, - NULL_PTR); -#endif - - pedantic_lvalues = pedantic; - - /* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */ - declare_function_name (); - - start_identifier_warnings (); - - /* Prepare to check format strings against argument lists. */ - init_function_format_info (); - - init_iterators (); - - incomplete_decl_finalize_hook = finish_incomplete_decl; - - lang_get_alias_set = c_get_alias_set; -} - -/* Return a definition for a builtin function named NAME and whose data type - is TYPE. TYPE should be a function type with argument types. - FUNCTION_CODE tells later passes how to compile calls to this function. - See tree.h for its possible values. - - If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME, - the name to be called if we can't opencode the function. */ - -tree -builtin_function (name, type, function_code, library_name) - const char *name; - tree type; - enum built_in_function function_code; - const char *library_name; -{ - tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type); - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; - /* If -traditional, permit redefining a builtin function any way you like. - (Though really, if the program redefines these functions, - it probably won't work right unless compiled with -fno-builtin.) */ - if (flag_traditional && name[0] != '_') - DECL_BUILT_IN_NONANSI (decl) = 1; - if (library_name) - DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name); - make_decl_rtl (decl, NULL_PTR, 1); - pushdecl (decl); - if (function_code != NOT_BUILT_IN) - { - DECL_BUILT_IN (decl) = 1; - DECL_FUNCTION_CODE (decl) = function_code; - } - /* Warn if a function in the namespace for users - is used without an occasion to consider it declared. */ - if (name[0] != '_' || name[1] != '_') - C_DECL_ANTICIPATED (decl) = 1; - - return decl; -} - -/* Called when a declaration is seen that contains no names to declare. - If its type is a reference to a structure, union or enum inherited - from a containing scope, shadow that tag name for the current scope - with a forward reference. - If its type defines a new named structure or union - or defines an enum, it is valid but we need not do anything here. - Otherwise, it is an error. */ - -void -shadow_tag (declspecs) - tree declspecs; -{ - shadow_tag_warned (declspecs, 0); -} - -void -shadow_tag_warned (declspecs, warned) - tree declspecs; - int warned; - /* 1 => we have done a pedwarn. 2 => we have done a warning, but - no pedwarn. */ -{ - int found_tag = 0; - register tree link; - tree specs, attrs; - - pending_invalid_xref = 0; - - /* Remove the attributes from declspecs, since they will confuse the - following code. */ - split_specs_attrs (declspecs, &specs, &attrs); - - for (link = specs; link; link = TREE_CHAIN (link)) - { - register tree value = TREE_VALUE (link); - register enum tree_code code = TREE_CODE (value); - - if (code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE) - /* Used to test also that TYPE_SIZE (value) != 0. - That caused warning for `struct foo;' at top level in the file. */ - { - register tree name = lookup_tag_reverse (value); - register tree t; - - found_tag++; - - if (name == 0) - { - if (warned != 1 && code != ENUMERAL_TYPE) - /* Empty unnamed enum OK */ - { - pedwarn ("unnamed struct/union that defines no instances"); - warned = 1; - } - } - else - { - t = lookup_tag (code, name, current_binding_level, 1); - - if (t == 0) - { - t = make_node (code); - pushtag (name, t); - } - } - } - else - { - if (!warned && ! in_system_header) - { - warning ("useless keyword or type name in empty declaration"); - warned = 2; - } - } - } - - if (found_tag > 1) - error ("two types specified in one empty declaration"); - - if (warned != 1) - { - if (found_tag == 0) - pedwarn ("empty declaration"); - } -} - -/* Decode a "typename", such as "int **", returning a ..._TYPE node. */ - -tree -groktypename (typename) - tree typename; -{ - if (TREE_CODE (typename) != TREE_LIST) - return typename; - return grokdeclarator (TREE_VALUE (typename), - TREE_PURPOSE (typename), - TYPENAME, 0); -} - -/* Return a PARM_DECL node for a given pair of specs and declarator. */ - -tree -groktypename_in_parm_context (typename) - tree typename; -{ - if (TREE_CODE (typename) != TREE_LIST) - return typename; - return grokdeclarator (TREE_VALUE (typename), - TREE_PURPOSE (typename), - PARM, 0); -} - -/* Decode a declarator in an ordinary declaration or data definition. - This is called as soon as the type information and variable name - have been parsed, before parsing the initializer if any. - Here we create the ..._DECL node, fill in its type, - and put it on the list of decls for the current context. - The ..._DECL node is returned as the value. - - Exception: for arrays where the length is not specified, - the type is left null, to be filled in by `finish_decl'. - - Function definitions do not come here; they go to start_function - instead. However, external and forward declarations of functions - do go through here. Structure field declarations are done by - grokfield and not through here. */ - -/* Set this to zero to debug not using the temporary obstack - to parse initializers. */ -int debug_temp_inits = 1; - -tree -start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) - tree declarator, declspecs; - int initialized; - tree attributes, prefix_attributes; -{ - register tree decl = grokdeclarator (declarator, declspecs, - NORMAL, initialized); - register tree tem; - int init_written = initialized; - - /* The corresponding pop_obstacks is in finish_decl. */ - push_obstacks_nochange (); - - if (warn_main > 0 && TREE_CODE (decl) != FUNCTION_DECL - && !strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "main")) - warning_with_decl (decl, "`%s' is usually a function"); - - if (initialized) - /* Is it valid for this decl to have an initializer at all? - If not, set INITIALIZED to zero, which will indirectly - tell `finish_decl' to ignore the initializer once it is parsed. */ - switch (TREE_CODE (decl)) - { - case TYPE_DECL: - /* typedef foo = bar means give foo the same type as bar. - We haven't parsed bar yet, so `finish_decl' will fix that up. - Any other case of an initialization in a TYPE_DECL is an error. */ - if (pedantic || list_length (declspecs) > 1) - { - error ("typedef `%s' is initialized", - IDENTIFIER_POINTER (DECL_NAME (decl))); - initialized = 0; - } - break; - - case FUNCTION_DECL: - error ("function `%s' is initialized like a variable", - IDENTIFIER_POINTER (DECL_NAME (decl))); - initialized = 0; - break; - - case PARM_DECL: - /* DECL_INITIAL in a PARM_DECL is really DECL_ARG_TYPE. */ - error ("parameter `%s' is initialized", - IDENTIFIER_POINTER (DECL_NAME (decl))); - initialized = 0; - break; - - default: - /* Don't allow initializations for incomplete types - except for arrays which might be completed by the initialization. */ - if (TYPE_SIZE (TREE_TYPE (decl)) != 0) - { - /* A complete type is ok if size is fixed. */ - - if (TREE_CODE (TYPE_SIZE (TREE_TYPE (decl))) != INTEGER_CST - || C_DECL_VARIABLE_SIZE (decl)) - { - error ("variable-sized object may not be initialized"); - initialized = 0; - } - } - else if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE) - { - error ("variable `%s' has initializer but incomplete type", - IDENTIFIER_POINTER (DECL_NAME (decl))); - initialized = 0; - } - else if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl))) == 0) - { - error ("elements of array `%s' have incomplete type", - IDENTIFIER_POINTER (DECL_NAME (decl))); - initialized = 0; - } - } - - if (initialized) - { -#if 0 /* Seems redundant with grokdeclarator. */ - if (current_binding_level != global_binding_level - && DECL_EXTERNAL (decl) - && TREE_CODE (decl) != FUNCTION_DECL) - warning ("declaration of `%s' has `extern' and is initialized", - IDENTIFIER_POINTER (DECL_NAME (decl))); -#endif - DECL_EXTERNAL (decl) = 0; - if (current_binding_level == global_binding_level) - TREE_STATIC (decl) = 1; - - /* Tell `pushdecl' this is an initialized decl - even though we don't yet have the initializer expression. - Also tell `finish_decl' it may store the real initializer. */ - DECL_INITIAL (decl) = error_mark_node; - } - - /* If this is a function declaration, write a record describing it to the - prototypes file (if requested). */ - - if (TREE_CODE (decl) == FUNCTION_DECL) - gen_aux_info_record (decl, 0, 0, TYPE_ARG_TYPES (TREE_TYPE (decl)) != 0); - - /* ANSI specifies that a tentative definition which is not merged with - a non-tentative definition behaves exactly like a definition with an - initializer equal to zero. (Section 3.7.2) - -fno-common gives strict ANSI behavior. Usually you don't want it. - This matters only for variables with external linkage. */ - if (! flag_no_common || ! TREE_PUBLIC (decl)) - DECL_COMMON (decl) = 1; - -#ifdef SET_DEFAULT_DECL_ATTRIBUTES - SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes); -#endif - - /* Set attributes here so if duplicate decl, will have proper attributes. */ - decl_attributes (decl, attributes, prefix_attributes); - - /* Add this decl to the current binding level. - TEM may equal DECL or it may be a previous decl of the same name. */ - tem = pushdecl (decl); - - /* For a local variable, define the RTL now. */ - if (current_binding_level != global_binding_level - /* But not if this is a duplicate decl - and we preserved the rtl from the previous one - (which may or may not happen). */ - && DECL_RTL (tem) == 0) - { - if (TYPE_SIZE (TREE_TYPE (tem)) != 0) - expand_decl (tem); - else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE - && DECL_INITIAL (tem) != 0) - expand_decl (tem); - } - - if (init_written) - { - /* When parsing and digesting the initializer, - use temporary storage. Do this even if we will ignore the value. */ - if (current_binding_level == global_binding_level && debug_temp_inits) - temporary_allocation (); - } - - return tem; -} - -/* Finish processing of a declaration; - install its initial value. - If the length of an array type is not known before, - it must be determined now, from the initial value, or it is an error. */ - -void -finish_decl (decl, init, asmspec_tree) - tree decl, init; - tree asmspec_tree; -{ - register tree type = TREE_TYPE (decl); - int was_incomplete = (DECL_SIZE (decl) == 0); - int temporary = allocation_temporary_p (); - char *asmspec = 0; - - /* If a name was specified, get the string. */ - if (asmspec_tree) - asmspec = TREE_STRING_POINTER (asmspec_tree); - - /* If `start_decl' didn't like having an initialization, ignore it now. */ - - if (init != 0 && DECL_INITIAL (decl) == 0) - init = 0; - /* Don't crash if parm is initialized. */ - if (TREE_CODE (decl) == PARM_DECL) - init = 0; - - if (ITERATOR_P (decl)) - { - if (init == 0) - error_with_decl (decl, "iterator has no initial value"); - else - init = save_expr (init); - } - - if (init) - { - if (TREE_CODE (decl) != TYPE_DECL) - store_init_value (decl, init); - else - { - /* typedef foo = bar; store the type of bar as the type of foo. */ - TREE_TYPE (decl) = TREE_TYPE (init); - DECL_INITIAL (decl) = init = 0; - } - } - - /* Pop back to the obstack that is current for this binding level. - This is because MAXINDEX, rtl, etc. to be made below - must go in the permanent obstack. But don't discard the - temporary data yet. */ - pop_obstacks (); -#if 0 /* pop_obstacks was near the end; this is what was here. */ - if (current_binding_level == global_binding_level && temporary) - end_temporary_allocation (); -#endif - - /* Deduce size of array from initialization, if not already known */ - - if (TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type) == 0 - && TREE_CODE (decl) != TYPE_DECL) - { - int do_default - = (TREE_STATIC (decl) - /* Even if pedantic, an external linkage array - may have incomplete type at first. */ - ? pedantic && !TREE_PUBLIC (decl) - : !DECL_EXTERNAL (decl)); - int failure - = complete_array_type (type, DECL_INITIAL (decl), do_default); - - /* Get the completed type made by complete_array_type. */ - type = TREE_TYPE (decl); - - if (failure == 1) - error_with_decl (decl, "initializer fails to determine size of `%s'"); - - if (failure == 2) - { - if (do_default) - error_with_decl (decl, "array size missing in `%s'"); - /* If a `static' var's size isn't known, - make it extern as well as static, so it does not get - allocated. - If it is not `static', then do not mark extern; - finish_incomplete_decl will give it a default size - and it will get allocated. */ - else if (!pedantic && TREE_STATIC (decl) && ! TREE_PUBLIC (decl)) - DECL_EXTERNAL (decl) = 1; - } - - /* TYPE_MAX_VALUE is always one less than the number of elements - in the array, because we start counting at zero. Therefore, - warn only if the value is less than zero. */ - if (pedantic && TYPE_DOMAIN (type) != 0 - && tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) < 0) - error_with_decl (decl, "zero or negative size array `%s'"); - - layout_decl (decl, 0); - } - - if (TREE_CODE (decl) == VAR_DECL) - { - if (DECL_SIZE (decl) == 0 - && TYPE_SIZE (TREE_TYPE (decl)) != 0) - layout_decl (decl, 0); - - if (DECL_SIZE (decl) == 0 - && (TREE_STATIC (decl) - ? - /* A static variable with an incomplete type - is an error if it is initialized. - Also if it is not file scope. - Otherwise, let it through, but if it is not `extern' - then it may cause an error message later. */ - /* A duplicate_decls call could have changed an extern - declaration into a file scope one. This can be detected - by TREE_ASM_WRITTEN being set. */ - (DECL_INITIAL (decl) != 0 - || (DECL_CONTEXT (decl) != 0 && ! TREE_ASM_WRITTEN (decl))) - : - /* An automatic variable with an incomplete type - is an error. */ - !DECL_EXTERNAL (decl))) - { - error_with_decl (decl, "storage size of `%s' isn't known"); - TREE_TYPE (decl) = error_mark_node; - } - - if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl)) - && DECL_SIZE (decl) != 0) - { - if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST) - constant_expression_warning (DECL_SIZE (decl)); - else - error_with_decl (decl, "storage size of `%s' isn't constant"); - } - - if (TREE_USED (type)) - TREE_USED (decl) = 1; - } - - /* If this is a function and an assembler name is specified, it isn't - builtin any more. Also reset DECL_RTL so we can give it its new - name. */ - if (TREE_CODE (decl) == FUNCTION_DECL && asmspec) - { - DECL_BUILT_IN (decl) = 0; - DECL_RTL (decl) = 0; - } - - /* Output the assembler code and/or RTL code for variables and functions, - unless the type is an undefined structure or union. - If not, it will get done when the type is completed. */ - - if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL) - { - if ((flag_traditional || TREE_PERMANENT (decl)) - && allocation_temporary_p ()) - { - push_obstacks_nochange (); - end_temporary_allocation (); - /* This is a no-op in c-lang.c or something real in objc-actions.c. */ - maybe_objc_check_decl (decl); - rest_of_decl_compilation (decl, asmspec, - (DECL_CONTEXT (decl) == 0 - || TREE_ASM_WRITTEN (decl)), - 0); - pop_obstacks (); - } - else - { - /* This is a no-op in c-lang.c or something real in objc-actions.c. */ - maybe_objc_check_decl (decl); - rest_of_decl_compilation (decl, asmspec, DECL_CONTEXT (decl) == 0, - 0); - } - if (DECL_CONTEXT (decl) != 0) - { - /* Recompute the RTL of a local array now - if it used to be an incomplete type. */ - if (was_incomplete - && ! TREE_STATIC (decl) && ! DECL_EXTERNAL (decl)) - { - /* If we used it already as memory, it must stay in memory. */ - TREE_ADDRESSABLE (decl) = TREE_USED (decl); - /* If it's still incomplete now, no init will save it. */ - if (DECL_SIZE (decl) == 0) - DECL_INITIAL (decl) = 0; - expand_decl (decl); - } - /* Compute and store the initial value. */ - if (TREE_CODE (decl) != FUNCTION_DECL) - expand_decl_init (decl); - } - } - - if (TREE_CODE (decl) == TYPE_DECL) - { - /* This is a no-op in c-lang.c or something real in objc-actions.c. */ - maybe_objc_check_decl (decl); - rest_of_decl_compilation (decl, NULL_PTR, DECL_CONTEXT (decl) == 0, - 0); - } - - /* ??? After 2.3, test (init != 0) instead of TREE_CODE. */ - /* This test used to include TREE_PERMANENT, however, we have the same - problem with initializers at the function level. Such initializers get - saved until the end of the function on the momentary_obstack. */ - if (!(TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl)) - && temporary - /* DECL_INITIAL is not defined in PARM_DECLs, since it shares - space with DECL_ARG_TYPE. */ - && TREE_CODE (decl) != PARM_DECL) - { - /* We need to remember that this array HAD an initialization, - but discard the actual temporary nodes, - since we can't have a permanent node keep pointing to them. */ - /* We make an exception for inline functions, since it's - normal for a local extern redeclaration of an inline function - to have a copy of the top-level decl's DECL_INLINE. */ - if (DECL_INITIAL (decl) != 0 && DECL_INITIAL (decl) != error_mark_node) - { - /* If this is a const variable, then preserve the - initializer instead of discarding it so that we can optimize - references to it. */ - /* This test used to include TREE_STATIC, but this won't be set - for function level initializers. */ - if (TREE_READONLY (decl) || ITERATOR_P (decl)) - { - preserve_initializer (); - /* Hack? Set the permanent bit for something that is permanent, - but not on the permanent obstack, so as to convince - output_constant_def to make its rtl on the permanent - obstack. */ - TREE_PERMANENT (DECL_INITIAL (decl)) = 1; - - /* The initializer and DECL must have the same (or equivalent - types), but if the initializer is a STRING_CST, its type - might not be on the right obstack, so copy the type - of DECL. */ - TREE_TYPE (DECL_INITIAL (decl)) = type; - } - else - DECL_INITIAL (decl) = error_mark_node; - } - } - - /* If requested, warn about definitions of large data objects. */ - - if (warn_larger_than - && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL) - && !DECL_EXTERNAL (decl)) - { - register tree decl_size = DECL_SIZE (decl); - - if (decl_size && TREE_CODE (decl_size) == INTEGER_CST) - { - unsigned units = TREE_INT_CST_LOW(decl_size) / BITS_PER_UNIT; - - if (units > larger_than_size) - warning_with_decl (decl, "size of `%s' is %u bytes", units); - } - } - -#if 0 - /* Resume permanent allocation, if not within a function. */ - /* The corresponding push_obstacks_nochange is in start_decl, - and in push_parm_decl and in grokfield. */ - pop_obstacks (); -#endif - - /* If we have gone back from temporary to permanent allocation, - actually free the temporary space that we no longer need. */ - if (temporary && !allocation_temporary_p ()) - permanent_allocation (0); - - /* At the end of a declaration, throw away any variable type sizes - of types defined inside that declaration. There is no use - computing them in the following function definition. */ - if (current_binding_level == global_binding_level) - get_pending_sizes (); -} - -/* If DECL has a cleanup, build and return that cleanup here. - This is a callback called by expand_expr. */ - -tree -maybe_build_cleanup (decl) - tree decl ATTRIBUTE_UNUSED; -{ - /* There are no cleanups in C. */ - return NULL_TREE; -} - -/* Given a parsed parameter declaration, - decode it into a PARM_DECL and push that on the current binding level. - Also, for the sake of forward parm decls, - record the given order of parms in `parm_order'. */ - -void -push_parm_decl (parm) - tree parm; -{ - tree decl; - int old_immediate_size_expand = immediate_size_expand; - /* Don't try computing parm sizes now -- wait till fn is called. */ - immediate_size_expand = 0; - - /* The corresponding pop_obstacks is in finish_decl. */ - push_obstacks_nochange (); - - decl = grokdeclarator (TREE_VALUE (TREE_PURPOSE (parm)), - TREE_PURPOSE (TREE_PURPOSE (parm)), PARM, 0); - decl_attributes (decl, TREE_VALUE (TREE_VALUE (parm)), - TREE_PURPOSE (TREE_VALUE (parm))); - -#if 0 - if (DECL_NAME (decl)) - { - tree olddecl; - olddecl = lookup_name (DECL_NAME (decl)); - if (pedantic && olddecl != 0 && TREE_CODE (olddecl) == TYPE_DECL) - pedwarn_with_decl (decl, "ANSI C forbids parameter `%s' shadowing typedef"); - } -#endif - - decl = pushdecl (decl); - - immediate_size_expand = old_immediate_size_expand; - - current_binding_level->parm_order - = tree_cons (NULL_TREE, decl, current_binding_level->parm_order); - - /* Add this decl to the current binding level. */ - finish_decl (decl, NULL_TREE, NULL_TREE); -} - -/* Clear the given order of parms in `parm_order'. - Used at start of parm list, - and also at semicolon terminating forward decls. */ - -void -clear_parm_order () -{ - current_binding_level->parm_order = NULL_TREE; -} - -/* Make TYPE a complete type based on INITIAL_VALUE. - Return 0 if successful, 1 if INITIAL_VALUE can't be deciphered, - 2 if there was no information (in which case assume 1 if DO_DEFAULT). */ - -int -complete_array_type (type, initial_value, do_default) - tree type; - tree initial_value; - int do_default; -{ - register tree maxindex = NULL_TREE; - int value = 0; - - if (initial_value) - { - /* Note MAXINDEX is really the maximum index, - one less than the size. */ - if (TREE_CODE (initial_value) == STRING_CST) - { - int eltsize - = int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value))); - maxindex = build_int_2 ((TREE_STRING_LENGTH (initial_value) - / eltsize) - 1, 0); - } - else if (TREE_CODE (initial_value) == CONSTRUCTOR) - { - tree elts = CONSTRUCTOR_ELTS (initial_value); - maxindex = size_binop (MINUS_EXPR, integer_zero_node, size_one_node); - for (; elts; elts = TREE_CHAIN (elts)) - { - if (TREE_PURPOSE (elts)) - maxindex = TREE_PURPOSE (elts); - else - maxindex = size_binop (PLUS_EXPR, maxindex, size_one_node); - } - maxindex = copy_node (maxindex); - } - else - { - /* Make an error message unless that happened already. */ - if (initial_value != error_mark_node) - value = 1; - - /* Prevent further error messages. */ - maxindex = build_int_2 (0, 0); - } - } - - if (!maxindex) - { - if (do_default) - maxindex = build_int_2 (0, 0); - value = 2; - } - - if (maxindex) - { - TYPE_DOMAIN (type) = build_index_type (maxindex); - if (!TREE_TYPE (maxindex)) - TREE_TYPE (maxindex) = TYPE_DOMAIN (type); - } - - /* Lay out the type now that we can get the real answer. */ - - layout_type (type); - - return value; -} - -/* Given declspecs and a declarator, - determine the name and type of the object declared - and construct a ..._DECL node for it. - (In one case we can return a ..._TYPE node instead. - For invalid input we sometimes return 0.) - - DECLSPECS is a chain of tree_list nodes whose value fields - are the storage classes and type specifiers. - - DECL_CONTEXT says which syntactic context this declaration is in: - NORMAL for most contexts. Make a VAR_DECL or FUNCTION_DECL or TYPE_DECL. - FUNCDEF for a function definition. Like NORMAL but a few different - error messages in each case. Return value may be zero meaning - this definition is too screwy to try to parse. - PARM for a parameter declaration (either within a function prototype - or before a function body). Make a PARM_DECL, or return void_type_node. - TYPENAME if for a typename (in a cast or sizeof). - Don't make a DECL node; just return the ..._TYPE node. - FIELD for a struct or union field; make a FIELD_DECL. - BITFIELD for a field with specified width. - INITIALIZED is 1 if the decl has an initializer. - - In the TYPENAME case, DECLARATOR is really an absolute declarator. - It may also be so in the PARM case, for a prototype where the - argument type is specified but not the name. - - This function is where the complicated C meanings of `static' - and `extern' are interpreted. */ - -static tree -grokdeclarator (declarator, declspecs, decl_context, initialized) - tree declspecs; - tree declarator; - enum decl_context decl_context; - int initialized; -{ - int specbits = 0; - tree spec; - tree type = NULL_TREE; - int longlong = 0; - int constp; - int restrictp; - int volatilep; - int type_quals = TYPE_UNQUALIFIED; - int inlinep; - int explicit_int = 0; - int explicit_char = 0; - int defaulted_int = 0; - tree typedef_decl = 0; - const char *name; - tree typedef_type = 0; - int funcdef_flag = 0; - enum tree_code innermost_code = ERROR_MARK; - int bitfield = 0; - int size_varies = 0; - tree decl_machine_attr = NULL_TREE; - - if (decl_context == BITFIELD) - bitfield = 1, decl_context = FIELD; - - if (decl_context == FUNCDEF) - funcdef_flag = 1, decl_context = NORMAL; - - push_obstacks_nochange (); - - if (flag_traditional && allocation_temporary_p ()) - end_temporary_allocation (); - - /* Look inside a declarator for the name being declared - and get it as a string, for an error message. */ - { - register tree decl = declarator; - name = 0; - - while (decl) - switch (TREE_CODE (decl)) - { - case ARRAY_REF: - case INDIRECT_REF: - case CALL_EXPR: - innermost_code = TREE_CODE (decl); - decl = TREE_OPERAND (decl, 0); - break; - - case IDENTIFIER_NODE: - name = IDENTIFIER_POINTER (decl); - decl = 0; - break; - - default: - abort (); - } - if (name == 0) - name = "type name"; - } - - /* A function definition's declarator must have the form of - a function declarator. */ - - if (funcdef_flag && innermost_code != CALL_EXPR) - return 0; - - /* Anything declared one level down from the top level - must be one of the parameters of a function - (because the body is at least two levels down). */ - - /* If this looks like a function definition, make it one, - even if it occurs where parms are expected. - Then store_parm_decls will reject it and not use it as a parm. */ - if (decl_context == NORMAL && !funcdef_flag - && current_binding_level->parm_flag) - decl_context = PARM; - - /* Look through the decl specs and record which ones appear. - Some typespecs are defined as built-in typenames. - Others, the ones that are modifiers of other types, - are represented by bits in SPECBITS: set the bits for - the modifiers that appear. Storage class keywords are also in SPECBITS. - - If there is a typedef name or a type, store the type in TYPE. - This includes builtin typedefs such as `int'. - - Set EXPLICIT_INT or EXPLICIT_CHAR if the type is `int' or `char' - and did not come from a user typedef. - - Set LONGLONG if `long' is mentioned twice. */ - - for (spec = declspecs; spec; spec = TREE_CHAIN (spec)) - { - register int i; - register tree id = TREE_VALUE (spec); - - if (id == ridpointers[(int) RID_INT]) - explicit_int = 1; - if (id == ridpointers[(int) RID_CHAR]) - explicit_char = 1; - - if (TREE_CODE (id) == IDENTIFIER_NODE) - for (i = (int) RID_FIRST_MODIFIER; i < (int) RID_MAX; i++) - { - if (ridpointers[i] == id) - { - if (i == (int) RID_LONG && specbits & (1< 1) - pedwarn ("duplicate `const'"); - if (restrictp > 1) - pedwarn ("duplicate `restrict'"); - if (volatilep > 1) - pedwarn ("duplicate `volatile'"); - if (! flag_gen_aux_info && (TYPE_QUALS (type))) - type = TYPE_MAIN_VARIANT (type); - type_quals = ((constp ? TYPE_QUAL_CONST : 0) - | (restrictp ? TYPE_QUAL_RESTRICT : 0) - | (volatilep ? TYPE_QUAL_VOLATILE : 0)); - - /* Warn if two storage classes are given. Default to `auto'. */ - - { - int nclasses = 0; - - if (specbits & 1 << (int) RID_AUTO) nclasses++; - if (specbits & 1 << (int) RID_STATIC) nclasses++; - if (specbits & 1 << (int) RID_EXTERN) nclasses++; - if (specbits & 1 << (int) RID_REGISTER) nclasses++; - if (specbits & 1 << (int) RID_TYPEDEF) nclasses++; - if (specbits & 1 << (int) RID_ITERATOR) nclasses++; - - /* Warn about storage classes that are invalid for certain - kinds of declarations (parameters, typenames, etc.). */ - - if (nclasses > 1) - error ("multiple storage classes in declaration of `%s'", name); - else if (funcdef_flag - && (specbits - & ((1 << (int) RID_REGISTER) - | (1 << (int) RID_AUTO) - | (1 << (int) RID_TYPEDEF)))) - { - if (specbits & 1 << (int) RID_AUTO - && (pedantic || current_binding_level == global_binding_level)) - pedwarn ("function definition declared `auto'"); - if (specbits & 1 << (int) RID_REGISTER) - error ("function definition declared `register'"); - if (specbits & 1 << (int) RID_TYPEDEF) - error ("function definition declared `typedef'"); - specbits &= ~ ((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER) - | (1 << (int) RID_AUTO)); - } - else if (decl_context != NORMAL && nclasses > 0) - { - if (decl_context == PARM && specbits & 1 << (int) RID_REGISTER) - ; - else - { - error ((decl_context == FIELD - ? "storage class specified for structure field `%s'" - : (decl_context == PARM - ? "storage class specified for parameter `%s'" - : "storage class specified for typename")), - name); - specbits &= ~ ((1 << (int) RID_TYPEDEF) | (1 << (int) RID_REGISTER) - | (1 << (int) RID_AUTO) | (1 << (int) RID_STATIC) - | (1 << (int) RID_EXTERN)); - } - } - else if (specbits & 1 << (int) RID_EXTERN && initialized && ! funcdef_flag) - { - /* `extern' with initialization is invalid if not at top level. */ - if (current_binding_level == global_binding_level) - warning ("`%s' initialized and declared `extern'", name); - else - error ("`%s' has both `extern' and initializer", name); - } - else if (specbits & 1 << (int) RID_EXTERN && funcdef_flag - && current_binding_level != global_binding_level) - error ("nested function `%s' declared `extern'", name); - else if (current_binding_level == global_binding_level - && specbits & (1 << (int) RID_AUTO)) - error ("top-level declaration of `%s' specifies `auto'", name); - else if ((specbits & 1 << (int) RID_ITERATOR) - && TREE_CODE (declarator) != IDENTIFIER_NODE) - { - error ("iterator `%s' has derived type", name); - type = error_mark_node; - } - else if ((specbits & 1 << (int) RID_ITERATOR) - && TREE_CODE (type) != INTEGER_TYPE) - { - error ("iterator `%s' has noninteger type", name); - type = error_mark_node; - } - } - - /* Now figure out the structure of the declarator proper. - Descend through it, creating more complex types, until we reach - the declared identifier (or NULL_TREE, in an absolute declarator). */ - - while (declarator && TREE_CODE (declarator) != IDENTIFIER_NODE) - { - if (type == error_mark_node) - { - declarator = TREE_OPERAND (declarator, 0); - continue; - } - - /* Each level of DECLARATOR is either an ARRAY_REF (for ...[..]), - an INDIRECT_REF (for *...), - a CALL_EXPR (for ...(...)), - an identifier (for the name being declared) - or a null pointer (for the place in an absolute declarator - where the name was omitted). - For the last two cases, we have just exited the loop. - - At this point, TYPE is the type of elements of an array, - or for a function to return, or for a pointer to point to. - After this sequence of ifs, TYPE is the type of the - array or function or pointer, and DECLARATOR has had its - outermost layer removed. */ - - if (TREE_CODE (declarator) == ARRAY_REF) - { - register tree itype = NULL_TREE; - register tree size = TREE_OPERAND (declarator, 1); - /* An uninitialized decl with `extern' is a reference. */ - int extern_ref = !initialized && (specbits & (1 << (int) RID_EXTERN)); - /* The index is a signed object `sizetype' bits wide. */ - tree index_type = signed_type (sizetype); - - declarator = TREE_OPERAND (declarator, 0); - - /* Check for some types that there cannot be arrays of. */ - - if (TYPE_MAIN_VARIANT (type) == void_type_node) - { - error ("declaration of `%s' as array of voids", name); - type = error_mark_node; - } - - if (TREE_CODE (type) == FUNCTION_TYPE) - { - error ("declaration of `%s' as array of functions", name); - type = error_mark_node; - } - - if (size == error_mark_node) - type = error_mark_node; - - if (type == error_mark_node) - continue; - - /* If this is a block level extern, it must live past the end - of the function so that we can check it against other extern - declarations (IDENTIFIER_LIMBO_VALUE). */ - if (extern_ref && allocation_temporary_p ()) - end_temporary_allocation (); - - /* If size was specified, set ITYPE to a range-type for that size. - Otherwise, ITYPE remains null. finish_decl may figure it out - from an initial value. */ - - if (size) - { - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ - STRIP_TYPE_NOPS (size); - - if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE - && TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE) - { - error ("size of array `%s' has non-integer type", name); - size = integer_one_node; - } - - if (pedantic && integer_zerop (size)) - pedwarn ("ANSI C forbids zero-size array `%s'", name); - - if (TREE_CODE (size) == INTEGER_CST) - { - constant_expression_warning (size); - if (tree_int_cst_sgn (size) < 0) - { - error ("size of array `%s' is negative", name); - size = integer_one_node; - } - } - else - { - /* Make sure the array size remains visibly nonconstant - even if it is (eg) a const variable with known value. */ - size_varies = 1; - - if (pedantic) - { - if (TREE_CONSTANT (size)) - pedwarn ("ANSI C forbids array `%s' whose size can't be evaluated", name); - else - pedwarn ("ANSI C forbids variable-size array `%s'", name); - } - } - - /* Convert size to index_type, so that if it is a variable - the computations will be done in the proper mode. */ - itype = fold (build (MINUS_EXPR, index_type, - convert (index_type, size), - convert (index_type, size_one_node))); - - /* If that overflowed, the array is too big. - ??? While a size of INT_MAX+1 technically shouldn't cause - an overflow (because we subtract 1), the overflow is recorded - during the conversion to index_type, before the subtraction. - Handling this case seems like an unnecessary complication. */ - if (TREE_OVERFLOW (itype)) - { - error ("size of array `%s' is too large", name); - type = error_mark_node; - continue; - } - - if (size_varies) - itype = variable_size (itype); - itype = build_index_type (itype); - } - -#if 0 /* This had bad results for pointers to arrays, as in - union incomplete (*foo)[4]; */ - /* Complain about arrays of incomplete types, except in typedefs. */ - - if (TYPE_SIZE (type) == 0 - /* Avoid multiple warnings for nested array types. */ - && TREE_CODE (type) != ARRAY_TYPE - && !(specbits & (1 << (int) RID_TYPEDEF)) - && !C_TYPE_BEING_DEFINED (type)) - warning ("array type has incomplete element type"); -#endif - -#if 0 /* We shouldn't have a function type here at all! - Functions aren't allowed as array elements. */ - if (pedantic && TREE_CODE (type) == FUNCTION_TYPE - && (constp || volatilep)) - pedwarn ("ANSI C forbids const or volatile function types"); -#endif - - /* Build the array type itself, then merge any constancy or - volatility into the target type. We must do it in this order - to ensure that the TYPE_MAIN_VARIANT field of the array type - is set correctly. */ - - type = build_array_type (type, itype); - if (type_quals) - type = c_build_qualified_type (type, type_quals); - -#if 0 /* don't clear these; leave them set so that the array type - or the variable is itself const or volatile. */ - type_quals = TYPE_UNQUALIFIED; -#endif - - if (size_varies) - C_TYPE_VARIABLE_SIZE (type) = 1; - } - else if (TREE_CODE (declarator) == CALL_EXPR) - { - int extern_ref = (!(specbits & (1 << (int) RID_AUTO)) - || current_binding_level == global_binding_level); - tree arg_types; - - /* Declaring a function type. - Make sure we have a valid type for the function to return. */ - if (type == error_mark_node) - continue; - - size_varies = 0; - - /* Warn about some types functions can't return. */ - - if (TREE_CODE (type) == FUNCTION_TYPE) - { - error ("`%s' declared as function returning a function", name); - type = integer_type_node; - } - if (TREE_CODE (type) == ARRAY_TYPE) - { - error ("`%s' declared as function returning an array", name); - type = integer_type_node; - } - -#ifndef TRADITIONAL_RETURN_FLOAT - /* Traditionally, declaring return type float means double. */ - - if (flag_traditional && TYPE_MAIN_VARIANT (type) == float_type_node) - type = double_type_node; -#endif /* TRADITIONAL_RETURN_FLOAT */ - - /* If this is a block level extern, it must live past the end - of the function so that we can check it against other extern - declarations (IDENTIFIER_LIMBO_VALUE). */ - if (extern_ref && allocation_temporary_p ()) - end_temporary_allocation (); - - /* Construct the function type and go to the next - inner layer of declarator. */ - - arg_types = grokparms (TREE_OPERAND (declarator, 1), - funcdef_flag - /* Say it's a definition - only for the CALL_EXPR - closest to the identifier. */ - && TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE); -#if 0 /* This seems to be false. We turn off temporary allocation - above in this function if -traditional. - And this code caused inconsistent results with prototypes: - callers would ignore them, and pass arguments wrong. */ - - /* Omit the arg types if -traditional, since the arg types - and the list links might not be permanent. */ - type = build_function_type (type, - flag_traditional - ? NULL_TREE : arg_types); -#endif - /* Type qualifiers before the return type of the function - qualify the return type, not the function type. */ - if (type_quals) - type = c_build_qualified_type (type, type_quals); - type_quals = TYPE_UNQUALIFIED; - - type = build_function_type (type, arg_types); - declarator = TREE_OPERAND (declarator, 0); - - /* Set the TYPE_CONTEXTs for each tagged type which is local to - the formal parameter list of this FUNCTION_TYPE to point to - the FUNCTION_TYPE node itself. */ - - { - register tree link; - - for (link = last_function_parm_tags; - link; - link = TREE_CHAIN (link)) - TYPE_CONTEXT (TREE_VALUE (link)) = type; - } - } - else if (TREE_CODE (declarator) == INDIRECT_REF) - { - /* Merge any constancy or volatility into the target type - for the pointer. */ - - if (pedantic && TREE_CODE (type) == FUNCTION_TYPE - && type_quals) - pedwarn ("ANSI C forbids qualified function types"); - if (type_quals) - type = c_build_qualified_type (type, type_quals); - type_quals = TYPE_UNQUALIFIED; - size_varies = 0; - - type = build_pointer_type (type); - - /* Process a list of type modifier keywords - (such as const or volatile) that were given inside the `*'. */ - - if (TREE_TYPE (declarator)) - { - register tree typemodlist; - int erred = 0; - - constp = 0; - volatilep = 0; - restrictp = 0; - for (typemodlist = TREE_TYPE (declarator); typemodlist; - typemodlist = TREE_CHAIN (typemodlist)) - { - tree qualifier = TREE_VALUE (typemodlist); - - if (qualifier == ridpointers[(int) RID_CONST]) - constp++; - else if (qualifier == ridpointers[(int) RID_VOLATILE]) - volatilep++; - else if (qualifier == ridpointers[(int) RID_RESTRICT]) - restrictp++; - else if (!erred) - { - erred = 1; - error ("invalid type modifier within pointer declarator"); - } - } - if (constp > 1) - pedwarn ("duplicate `const'"); - if (volatilep > 1) - pedwarn ("duplicate `volatile'"); - if (restrictp > 1) - pedwarn ("duplicate `restrict'"); - - type_quals = ((constp ? TYPE_QUAL_CONST : 0) - | (restrictp ? TYPE_QUAL_RESTRICT : 0) - | (volatilep ? TYPE_QUAL_VOLATILE : 0)); - } - - declarator = TREE_OPERAND (declarator, 0); - } - else - abort (); - - } - - /* Now TYPE has the actual type. */ - - /* Did array size calculations overflow? */ - - if (TREE_CODE (type) == ARRAY_TYPE - && TYPE_SIZE (type) - && TREE_OVERFLOW (TYPE_SIZE (type))) - error ("size of array `%s' is too large", name); - - /* If this is declaring a typedef name, return a TYPE_DECL. */ - - if (specbits & (1 << (int) RID_TYPEDEF)) - { - tree decl; - /* Note that the grammar rejects storage classes - in typenames, fields or parameters */ - if (pedantic && TREE_CODE (type) == FUNCTION_TYPE - && type_quals) - pedwarn ("ANSI C forbids qualified function types"); - if (type_quals) - type = c_build_qualified_type (type, type_quals); - decl = build_decl (TYPE_DECL, declarator, type); - if ((specbits & (1 << (int) RID_SIGNED)) - || (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl))) - C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1; - pop_obstacks (); - return decl; - } - - /* Detect the case of an array type of unspecified size - which came, as such, direct from a typedef name. - We must copy the type, so that each identifier gets - a distinct type, so that each identifier's size can be - controlled separately by its own initializer. */ - - if (type != 0 && typedef_type != 0 - && TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (typedef_type) - && TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == 0) - { - type = build_array_type (TREE_TYPE (type), 0); - if (size_varies) - C_TYPE_VARIABLE_SIZE (type) = 1; - } - - /* If this is a type name (such as, in a cast or sizeof), - compute the type and return it now. */ - - if (decl_context == TYPENAME) - { - /* Note that the grammar rejects storage classes - in typenames, fields or parameters */ - if (pedantic && TREE_CODE (type) == FUNCTION_TYPE - && type_quals) - pedwarn ("ANSI C forbids const or volatile function types"); - if (type_quals) - type = c_build_qualified_type (type, type_quals); - pop_obstacks (); - return type; - } - - /* Aside from typedefs and type names (handle above), - `void' at top level (not within pointer) - is allowed only in public variables. - We don't complain about parms either, but that is because - a better error message can be made later. */ - - if (TYPE_MAIN_VARIANT (type) == void_type_node && decl_context != PARM - && ! ((decl_context != FIELD && TREE_CODE (type) != FUNCTION_TYPE) - && ((specbits & (1 << (int) RID_EXTERN)) - || (current_binding_level == global_binding_level - && !(specbits - & ((1 << (int) RID_STATIC) | (1 << (int) RID_REGISTER))))))) - { - error ("variable or field `%s' declared void", name); - type = integer_type_node; - } - - /* Now create the decl, which may be a VAR_DECL, a PARM_DECL - or a FUNCTION_DECL, depending on DECL_CONTEXT and TYPE. */ - - { - register tree decl; - - if (decl_context == PARM) - { - tree type_as_written = type; - tree main_type; - - /* A parameter declared as an array of T is really a pointer to T. - One declared as a function is really a pointer to a function. */ - - if (TREE_CODE (type) == ARRAY_TYPE) - { - /* Transfer const-ness of array into that of type pointed to. */ - type = TREE_TYPE (type); - if (type_quals) - type = c_build_qualified_type (type, type_quals); - type = build_pointer_type (type); - type_quals = TYPE_UNQUALIFIED; - size_varies = 0; - } - else if (TREE_CODE (type) == FUNCTION_TYPE) - { - if (pedantic && type_quals) - pedwarn ("ANSI C forbids qualified function types"); - if (type_quals) - type = c_build_qualified_type (type, type_quals); - type = build_pointer_type (type); - type_quals = TYPE_UNQUALIFIED; - } - - decl = build_decl (PARM_DECL, declarator, type); - if (size_varies) - C_DECL_VARIABLE_SIZE (decl) = 1; - - /* Compute the type actually passed in the parmlist, - for the case where there is no prototype. - (For example, shorts and chars are passed as ints.) - When there is a prototype, this is overridden later. */ - - DECL_ARG_TYPE (decl) = type; - main_type = (type == error_mark_node - ? error_mark_node - : TYPE_MAIN_VARIANT (type)); - if (main_type == float_type_node) - DECL_ARG_TYPE (decl) = double_type_node; - /* Don't use TYPE_PRECISION to decide whether to promote, - because we should convert short if it's the same size as int, - but we should not convert long if it's the same size as int. */ - else if (TREE_CODE (main_type) != ERROR_MARK - && C_PROMOTING_INTEGER_TYPE_P (main_type)) - { - if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node) - && TREE_UNSIGNED (type)) - DECL_ARG_TYPE (decl) = unsigned_type_node; - else - DECL_ARG_TYPE (decl) = integer_type_node; - } - - DECL_ARG_TYPE_AS_WRITTEN (decl) = type_as_written; - } - else if (decl_context == FIELD) - { - /* Structure field. It may not be a function. */ - - if (TREE_CODE (type) == FUNCTION_TYPE) - { - error ("field `%s' declared as a function", name); - type = build_pointer_type (type); - } - else if (TREE_CODE (type) != ERROR_MARK && TYPE_SIZE (type) == 0) - { - error ("field `%s' has incomplete type", name); - type = error_mark_node; - } - /* Move type qualifiers down to element of an array. */ - if (TREE_CODE (type) == ARRAY_TYPE && type_quals) - { - type = build_array_type (c_build_qualified_type (TREE_TYPE (type), - type_quals), - TYPE_DOMAIN (type)); -#if 0 /* Leave the field const or volatile as well. */ - type_quals = TYPE_UNQUALIFIED; -#endif - } - decl = build_decl (FIELD_DECL, declarator, type); - if (size_varies) - C_DECL_VARIABLE_SIZE (decl) = 1; - } - else if (TREE_CODE (type) == FUNCTION_TYPE) - { - /* Every function declaration is "external" - except for those which are inside a function body - in which `auto' is used. - That is a case not specified by ANSI C, - and we use it for forward declarations for nested functions. */ - int extern_ref = (!(specbits & (1 << (int) RID_AUTO)) - || current_binding_level == global_binding_level); - - if (specbits & (1 << (int) RID_AUTO) - && (pedantic || current_binding_level == global_binding_level)) - pedwarn ("invalid storage class for function `%s'", name); - if (specbits & (1 << (int) RID_REGISTER)) - error ("invalid storage class for function `%s'", name); - /* Function declaration not at top level. - Storage classes other than `extern' are not allowed - and `extern' makes no difference. */ - if (current_binding_level != global_binding_level - && (specbits & ((1 << (int) RID_STATIC) | (1 << (int) RID_INLINE))) - && pedantic) - pedwarn ("invalid storage class for function `%s'", name); - - /* If this is a block level extern, it must live past the end - of the function so that we can check it against other - extern declarations (IDENTIFIER_LIMBO_VALUE). */ - if (extern_ref && allocation_temporary_p ()) - end_temporary_allocation (); - - decl = build_decl (FUNCTION_DECL, declarator, type); - decl = build_decl_attribute_variant (decl, decl_machine_attr); - - if (pedantic && type_quals && ! DECL_IN_SYSTEM_HEADER (decl)) - pedwarn ("ANSI C forbids qualified function types"); - - if (pedantic - && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl))) == void_type_node - && TYPE_QUALS (TREE_TYPE (TREE_TYPE (decl))) - && ! DECL_IN_SYSTEM_HEADER (decl)) - pedwarn ("ANSI C forbids qualified void function return type"); - - /* GNU C interprets a `volatile void' return type to indicate - that the function does not return. */ - if ((type_quals & TYPE_QUAL_VOLATILE) - && TREE_TYPE (TREE_TYPE (decl)) != void_type_node) - warning ("`noreturn' function returns non-void value"); - - if (extern_ref) - DECL_EXTERNAL (decl) = 1; - /* Record absence of global scope for `static' or `auto'. */ - TREE_PUBLIC (decl) - = !(specbits & ((1 << (int) RID_STATIC) | (1 << (int) RID_AUTO))); - - /* Record presence of `inline', if it is reasonable. */ - if (inlinep) - { - if (! strcmp (IDENTIFIER_POINTER (declarator), "main")) - warning ("cannot inline function `main'"); - else - /* Assume that otherwise the function can be inlined. */ - DECL_INLINE (decl) = 1; - - if (specbits & (1 << (int) RID_EXTERN)) - current_extern_inline = 1; - } - } - else - { - /* It's a variable. */ - /* An uninitialized decl with `extern' is a reference. */ - int extern_ref = !initialized && (specbits & (1 << (int) RID_EXTERN)); - - /* Move type qualifiers down to element of an array. */ - if (TREE_CODE (type) == ARRAY_TYPE && type_quals) - { - type = build_array_type (c_build_qualified_type (TREE_TYPE (type), - type_quals), - TYPE_DOMAIN (type)); -#if 0 /* Leave the variable const or volatile as well. */ - type_quals = TYPE_UNQUALIFIED; -#endif - } - - /* If this is a block level extern, it must live past the end - of the function so that we can check it against other - extern declarations (IDENTIFIER_LIMBO_VALUE). */ - if (extern_ref && allocation_temporary_p ()) - end_temporary_allocation (); - - decl = build_decl (VAR_DECL, declarator, type); - if (size_varies) - C_DECL_VARIABLE_SIZE (decl) = 1; - - if (inlinep) - pedwarn_with_decl (decl, "variable `%s' declared `inline'"); - - DECL_EXTERNAL (decl) = extern_ref; - /* At top level, the presence of a `static' or `register' storage - class specifier, or the absence of all storage class specifiers - makes this declaration a definition (perhaps tentative). Also, - the absence of both `static' and `register' makes it public. */ - if (current_binding_level == global_binding_level) - { - TREE_PUBLIC (decl) - = !(specbits - & ((1 << (int) RID_STATIC) | (1 << (int) RID_REGISTER))); - TREE_STATIC (decl) = ! DECL_EXTERNAL (decl); - } - /* Not at top level, only `static' makes a static definition. */ - else - { - TREE_STATIC (decl) = (specbits & (1 << (int) RID_STATIC)) != 0; - TREE_PUBLIC (decl) = DECL_EXTERNAL (decl); - } - - if (specbits & 1 << (int) RID_ITERATOR) - ITERATOR_P (decl) = 1; - } - - /* Record `register' declaration for warnings on & - and in case doing stupid register allocation. */ - - if (specbits & (1 << (int) RID_REGISTER)) - DECL_REGISTER (decl) = 1; - - /* Record constancy and volatility. */ - c_apply_type_quals_to_decl (type_quals, decl); - - /* If a type has volatile components, it should be stored in memory. - Otherwise, the fact that those components are volatile - will be ignored, and would even crash the compiler. */ - if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (decl))) - mark_addressable (decl); - - pop_obstacks (); - - return decl; - } -} - -/* Decode the parameter-list info for a function type or function definition. - The argument is the value returned by `get_parm_info' (or made in parse.y - if there is an identifier list instead of a parameter decl list). - These two functions are separate because when a function returns - or receives functions then each is called multiple times but the order - of calls is different. The last call to `grokparms' is always the one - that contains the formal parameter names of a function definition. - - Store in `last_function_parms' a chain of the decls of parms. - Also store in `last_function_parm_tags' a chain of the struct, union, - and enum tags declared among the parms. - - Return a list of arg types to use in the FUNCTION_TYPE for this function. - - FUNCDEF_FLAG is nonzero for a function definition, 0 for - a mere declaration. A nonempty identifier-list gets an error message - when FUNCDEF_FLAG is zero. */ - -static tree -grokparms (parms_info, funcdef_flag) - tree parms_info; - int funcdef_flag; -{ - tree first_parm = TREE_CHAIN (parms_info); - - last_function_parms = TREE_PURPOSE (parms_info); - last_function_parm_tags = TREE_VALUE (parms_info); - - if (warn_strict_prototypes && first_parm == 0 && !funcdef_flag - && !in_system_header) - warning ("function declaration isn't a prototype"); - - if (first_parm != 0 - && TREE_CODE (TREE_VALUE (first_parm)) == IDENTIFIER_NODE) - { - if (! funcdef_flag) - pedwarn ("parameter names (without types) in function declaration"); - - last_function_parms = first_parm; - return 0; - } - else - { - tree parm; - tree typelt; - /* We no longer test FUNCDEF_FLAG. - If the arg types are incomplete in a declaration, - they must include undefined tags. - These tags can never be defined in the scope of the declaration, - so the types can never be completed, - and no call can be compiled successfully. */ -#if 0 - /* In a fcn definition, arg types must be complete. */ - if (funcdef_flag) -#endif - for (parm = last_function_parms, typelt = first_parm; - parm; - parm = TREE_CHAIN (parm)) - /* Skip over any enumeration constants declared here. */ - if (TREE_CODE (parm) == PARM_DECL) - { - /* Barf if the parameter itself has an incomplete type. */ - tree type = TREE_VALUE (typelt); - if (TYPE_SIZE (type) == 0) - { - if (funcdef_flag && DECL_NAME (parm) != 0) - error ("parameter `%s' has incomplete type", - IDENTIFIER_POINTER (DECL_NAME (parm))); - else - warning ("parameter has incomplete type"); - if (funcdef_flag) - { - TREE_VALUE (typelt) = error_mark_node; - TREE_TYPE (parm) = error_mark_node; - } - } -#if 0 /* This has been replaced by parm_tags_warning - which uses a more accurate criterion for what to warn about. */ - else - { - /* Now warn if is a pointer to an incomplete type. */ - while (TREE_CODE (type) == POINTER_TYPE - || TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); - type = TYPE_MAIN_VARIANT (type); - if (TYPE_SIZE (type) == 0) - { - if (DECL_NAME (parm) != 0) - warning ("parameter `%s' points to incomplete type", - IDENTIFIER_POINTER (DECL_NAME (parm))); - else - warning ("parameter points to incomplete type"); - } - } -#endif - typelt = TREE_CHAIN (typelt); - } - - /* Allocate the list of types the way we allocate a type. */ - if (first_parm && ! TREE_PERMANENT (first_parm)) - { - /* Construct a copy of the list of types - on the saveable obstack. */ - tree result = NULL; - for (typelt = first_parm; typelt; typelt = TREE_CHAIN (typelt)) - result = saveable_tree_cons (NULL_TREE, TREE_VALUE (typelt), - result); - return nreverse (result); - } - else - /* The list we have is permanent already. */ - return first_parm; - } -} - - -/* Return a tree_list node with info on a parameter list just parsed. - The TREE_PURPOSE is a chain of decls of those parms. - The TREE_VALUE is a list of structure, union and enum tags defined. - The TREE_CHAIN is a list of argument types to go in the FUNCTION_TYPE. - This tree_list node is later fed to `grokparms'. - - VOID_AT_END nonzero means append `void' to the end of the type-list. - Zero means the parmlist ended with an ellipsis so don't append `void'. */ - -tree -get_parm_info (void_at_end) - int void_at_end; -{ - register tree decl, t; - register tree types = 0; - int erred = 0; - tree tags = gettags (); - tree parms = getdecls (); - tree new_parms = 0; - tree order = current_binding_level->parm_order; - - /* Just `void' (and no ellipsis) is special. There are really no parms. */ - if (void_at_end && parms != 0 - && TREE_CHAIN (parms) == 0 - && TYPE_MAIN_VARIANT (TREE_TYPE (parms)) == void_type_node - && DECL_NAME (parms) == 0) - { - parms = NULL_TREE; - storedecls (NULL_TREE); - return saveable_tree_cons (NULL_TREE, NULL_TREE, - saveable_tree_cons (NULL_TREE, void_type_node, NULL_TREE)); - } - - /* Extract enumerator values and other non-parms declared with the parms. - Likewise any forward parm decls that didn't have real parm decls. */ - for (decl = parms; decl; ) - { - tree next = TREE_CHAIN (decl); - - if (TREE_CODE (decl) != PARM_DECL) - { - TREE_CHAIN (decl) = new_parms; - new_parms = decl; - } - else if (TREE_ASM_WRITTEN (decl)) - { - error_with_decl (decl, "parameter `%s' has just a forward declaration"); - TREE_CHAIN (decl) = new_parms; - new_parms = decl; - } - decl = next; - } - - /* Put the parm decls back in the order they were in in the parm list. */ - for (t = order; t; t = TREE_CHAIN (t)) - { - if (TREE_CHAIN (t)) - TREE_CHAIN (TREE_VALUE (t)) = TREE_VALUE (TREE_CHAIN (t)); - else - TREE_CHAIN (TREE_VALUE (t)) = 0; - } - - new_parms = chainon (order ? nreverse (TREE_VALUE (order)) : 0, - new_parms); - - /* Store the parmlist in the binding level since the old one - is no longer a valid list. (We have changed the chain pointers.) */ - storedecls (new_parms); - - for (decl = new_parms; decl; decl = TREE_CHAIN (decl)) - /* There may also be declarations for enumerators if an enumeration - type is declared among the parms. Ignore them here. */ - if (TREE_CODE (decl) == PARM_DECL) - { - /* Since there is a prototype, - args are passed in their declared types. */ - tree type = TREE_TYPE (decl); - DECL_ARG_TYPE (decl) = type; -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) - && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)) - DECL_ARG_TYPE (decl) = integer_type_node; -#endif - - types = saveable_tree_cons (NULL_TREE, TREE_TYPE (decl), types); - if (TYPE_MAIN_VARIANT (TREE_VALUE (types)) == void_type_node && ! erred - && DECL_NAME (decl) == 0) - { - error ("`void' in parameter list must be the entire list"); - erred = 1; - } - } - - if (void_at_end) - return saveable_tree_cons (new_parms, tags, - nreverse (saveable_tree_cons (NULL_TREE, void_type_node, types))); - - return saveable_tree_cons (new_parms, tags, nreverse (types)); -} - -/* At end of parameter list, warn about any struct, union or enum tags - defined within. Do so because these types cannot ever become complete. */ - -void -parmlist_tags_warning () -{ - tree elt; - static int already; - - for (elt = current_binding_level->tags; elt; elt = TREE_CHAIN (elt)) - { - enum tree_code code = TREE_CODE (TREE_VALUE (elt)); - /* An anonymous union parm type is meaningful as a GNU extension. - So don't warn for that. */ - if (code == UNION_TYPE && TREE_PURPOSE (elt) == 0 && !pedantic) - continue; - if (TREE_PURPOSE (elt) != 0) - warning ("`%s %s' declared inside parameter list", - (code == RECORD_TYPE ? "struct" - : code == UNION_TYPE ? "union" - : "enum"), - IDENTIFIER_POINTER (TREE_PURPOSE (elt))); - else - warning ("anonymous %s declared inside parameter list", - (code == RECORD_TYPE ? "struct" - : code == UNION_TYPE ? "union" - : "enum")); - - if (! already) - { - warning ("its scope is only this definition or declaration, which is probably not what you want."); - already = 1; - } - } -} - -/* Get the struct, enum or union (CODE says which) with tag NAME. - Define the tag as a forward-reference if it is not defined. */ - -tree -xref_tag (code, name) - enum tree_code code; - tree name; -{ - int temporary = allocation_temporary_p (); - - /* If a cross reference is requested, look up the type - already defined for this tag and return it. */ - - register tree ref = lookup_tag (code, name, current_binding_level, 0); - /* Even if this is the wrong type of tag, return what we found. - There will be an error message anyway, from pending_xref_error. - If we create an empty xref just for an invalid use of the type, - the main result is to create lots of superfluous error messages. */ - if (ref) - return ref; - - push_obstacks_nochange (); - - if (current_binding_level == global_binding_level && temporary) - end_temporary_allocation (); - - /* If no such tag is yet defined, create a forward-reference node - and record it as the "definition". - When a real declaration of this type is found, - the forward-reference will be altered into a real type. */ - - ref = make_node (code); - if (code == ENUMERAL_TYPE) - { - /* (In ANSI, Enums can be referred to only if already defined.) */ - if (pedantic) - pedwarn ("ANSI C forbids forward references to `enum' types"); - /* Give the type a default layout like unsigned int - to avoid crashing if it does not get defined. */ - TYPE_MODE (ref) = TYPE_MODE (unsigned_type_node); - TYPE_ALIGN (ref) = TYPE_ALIGN (unsigned_type_node); - TREE_UNSIGNED (ref) = 1; - TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node); - TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node); - TYPE_MAX_VALUE (ref) = TYPE_MAX_VALUE (unsigned_type_node); - } - - pushtag (name, ref); - - pop_obstacks (); - - return ref; -} - -/* Make sure that the tag NAME is defined *in the current binding level* - at least as a forward reference. - CODE says which kind of tag NAME ought to be. - - We also do a push_obstacks_nochange - whose matching pop is in finish_struct. */ - -tree -start_struct (code, name) - enum tree_code code; - tree name; -{ - /* If there is already a tag defined at this binding level - (as a forward reference), just return it. */ - - register tree ref = 0; - - push_obstacks_nochange (); - if (current_binding_level == global_binding_level) - end_temporary_allocation (); - - if (name != 0) - ref = lookup_tag (code, name, current_binding_level, 1); - if (ref && TREE_CODE (ref) == code) - { - C_TYPE_BEING_DEFINED (ref) = 1; - TYPE_PACKED (ref) = flag_pack_struct; - if (TYPE_FIELDS (ref)) - error ((code == UNION_TYPE ? "redefinition of `union %s'" - : "redefinition of `struct %s'"), - IDENTIFIER_POINTER (name)); - - return ref; - } - - /* Otherwise create a forward-reference just so the tag is in scope. */ - - ref = make_node (code); - pushtag (name, ref); - C_TYPE_BEING_DEFINED (ref) = 1; - TYPE_PACKED (ref) = flag_pack_struct; - return ref; -} - -/* Process the specs, declarator (NULL if omitted) and width (NULL if omitted) - of a structure component, returning a FIELD_DECL node. - WIDTH is non-NULL for bit fields only, and is an INTEGER_CST node. - - This is done during the parsing of the struct declaration. - The FIELD_DECL nodes are chained together and the lot of them - are ultimately passed to `build_struct' to make the RECORD_TYPE node. */ - -tree -grokfield (filename, line, declarator, declspecs, width) - const char *filename ATTRIBUTE_UNUSED; - int line ATTRIBUTE_UNUSED; - tree declarator, declspecs, width; -{ - tree value; - - /* The corresponding pop_obstacks is in finish_decl. */ - push_obstacks_nochange (); - - value = grokdeclarator (declarator, declspecs, width ? BITFIELD : FIELD, 0); - - finish_decl (value, NULL_TREE, NULL_TREE); - DECL_INITIAL (value) = width; - - maybe_objc_check_decl (value); - return value; -} - -/* Function to help qsort sort FIELD_DECLs by name order. */ - -static int -field_decl_cmp (xp, yp) - const GENERIC_PTR xp; - const GENERIC_PTR yp; -{ - tree *x = (tree *)xp, *y = (tree *)yp; - - if (DECL_NAME (*x) == DECL_NAME (*y)) - return 0; - if (DECL_NAME (*x) == NULL) - return -1; - if (DECL_NAME (*y) == NULL) - return 1; - if (DECL_NAME (*x) < DECL_NAME (*y)) - return -1; - return 1; -} - -/* Fill in the fields of a RECORD_TYPE or UNION_TYPE node, T. - FIELDLIST is a chain of FIELD_DECL nodes for the fields. - ATTRIBUTES are attributes to be applied to the structure. - - We also do a pop_obstacks to match the push in start_struct. */ - -tree -finish_struct (t, fieldlist, attributes) - tree t; - tree fieldlist; - tree attributes; -{ - register tree x; - int old_momentary; - int toplevel = global_binding_level == current_binding_level; - - /* If this type was previously laid out as a forward reference, - make sure we lay it out again. */ - - TYPE_SIZE (t) = 0; - - decl_attributes (t, attributes, NULL_TREE); - - /* Nameless union parm types are useful as GCC extension. */ - if (! (TREE_CODE (t) == UNION_TYPE && TYPE_NAME (t) == 0) && !pedantic) - /* Otherwise, warn about any struct or union def. in parmlist. */ - if (in_parm_level_p ()) - { - if (pedantic) - pedwarn ((TREE_CODE (t) == UNION_TYPE ? "union defined inside parms" - : "structure defined inside parms")); - else if (! flag_traditional) - warning ((TREE_CODE (t) == UNION_TYPE ? "union defined inside parms" - : "structure defined inside parms")); - } - - old_momentary = suspend_momentary (); - - if (pedantic) - { - for (x = fieldlist; x; x = TREE_CHAIN (x)) - if (DECL_NAME (x) != 0) - break; - - if (x == 0) - pedwarn ((fieldlist - ? "%s has no named members" - : "%s has no members"), - TREE_CODE (t) == UNION_TYPE ? "union" : "struct"); - } - - /* Install struct as DECL_CONTEXT of each field decl. - Also process specified field sizes. - Set DECL_FIELD_SIZE to the specified size, or 0 if none specified. - The specified size is found in the DECL_INITIAL. - Store 0 there, except for ": 0" fields (so we can find them - and delete them, below). */ - - for (x = fieldlist; x; x = TREE_CHAIN (x)) - { - DECL_CONTEXT (x) = t; - DECL_PACKED (x) |= TYPE_PACKED (t); - DECL_FIELD_SIZE (x) = 0; - - /* If any field is const, the structure type is pseudo-const. */ - if (TREE_READONLY (x)) - C_TYPE_FIELDS_READONLY (t) = 1; - else - { - /* A field that is pseudo-const makes the structure likewise. */ - tree t1 = TREE_TYPE (x); - while (TREE_CODE (t1) == ARRAY_TYPE) - t1 = TREE_TYPE (t1); - if ((TREE_CODE (t1) == RECORD_TYPE || TREE_CODE (t1) == UNION_TYPE) - && C_TYPE_FIELDS_READONLY (t1)) - C_TYPE_FIELDS_READONLY (t) = 1; - } - - /* Any field that is volatile means variables of this type must be - treated in some ways as volatile. */ - if (TREE_THIS_VOLATILE (x)) - C_TYPE_FIELDS_VOLATILE (t) = 1; - - /* Any field of nominal variable size implies structure is too. */ - if (C_DECL_VARIABLE_SIZE (x)) - C_TYPE_VARIABLE_SIZE (t) = 1; - - /* Detect invalid nested redefinition. */ - if (TREE_TYPE (x) == t) - error ("nested redefinition of `%s'", - IDENTIFIER_POINTER (TYPE_NAME (t))); - - /* Detect invalid bit-field size. */ - if (DECL_INITIAL (x)) - STRIP_NOPS (DECL_INITIAL (x)); - if (DECL_INITIAL (x)) - { - if (TREE_CODE (DECL_INITIAL (x)) == INTEGER_CST) - constant_expression_warning (DECL_INITIAL (x)); - else - { - error_with_decl (x, "bit-field `%s' width not an integer constant"); - DECL_INITIAL (x) = NULL; - } - } - - /* Detect invalid bit-field type. */ - if (DECL_INITIAL (x) - && TREE_CODE (TREE_TYPE (x)) != INTEGER_TYPE - && TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE) - { - error_with_decl (x, "bit-field `%s' has invalid type"); - DECL_INITIAL (x) = NULL; - } - if (DECL_INITIAL (x) && pedantic - && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != integer_type_node - && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != unsigned_type_node - /* Accept an enum that's equivalent to int or unsigned int. */ - && !(TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE - && (TYPE_PRECISION (TREE_TYPE (x)) - == TYPE_PRECISION (integer_type_node)))) - pedwarn_with_decl (x, "bit-field `%s' type invalid in ANSI C"); - - /* Detect and ignore out of range field width. */ - if (DECL_INITIAL (x)) - { - unsigned HOST_WIDE_INT width = TREE_INT_CST_LOW (DECL_INITIAL (x)); - - if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0) - { - DECL_INITIAL (x) = NULL; - error_with_decl (x, "negative width in bit-field `%s'"); - } - else if (TREE_INT_CST_HIGH (DECL_INITIAL (x)) != 0 - || width > TYPE_PRECISION (TREE_TYPE (x))) - { - DECL_INITIAL (x) = NULL; - pedwarn_with_decl (x, "width of `%s' exceeds its type"); - } - else if (width == 0 && DECL_NAME (x) != 0) - { - error_with_decl (x, "zero width for bit-field `%s'"); - DECL_INITIAL (x) = NULL; - } - } - - /* Process valid field width. */ - if (DECL_INITIAL (x)) - { - register int width = TREE_INT_CST_LOW (DECL_INITIAL (x)); - - if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE - && (width < min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)), - TREE_UNSIGNED (TREE_TYPE (x))) - || width < min_precision (TYPE_MAX_VALUE (TREE_TYPE (x)), - TREE_UNSIGNED (TREE_TYPE (x))))) - warning_with_decl (x, "`%s' is narrower than values of its type"); - - DECL_FIELD_SIZE (x) = width; - DECL_BIT_FIELD (x) = DECL_C_BIT_FIELD (x) = 1; - DECL_INITIAL (x) = NULL; - - if (width == 0) - { - /* field size 0 => force desired amount of alignment. */ -#ifdef EMPTY_FIELD_BOUNDARY - DECL_ALIGN (x) = MAX (DECL_ALIGN (x), EMPTY_FIELD_BOUNDARY); -#endif -#ifdef PCC_BITFIELD_TYPE_MATTERS - if (PCC_BITFIELD_TYPE_MATTERS) - DECL_ALIGN (x) = MAX (DECL_ALIGN (x), - TYPE_ALIGN (TREE_TYPE (x))); -#endif - } - } - else if (TREE_TYPE (x) != error_mark_node) - { - unsigned int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT - : TYPE_ALIGN (TREE_TYPE (x))); - /* Non-bit-fields are aligned for their type, except packed - fields which require only BITS_PER_UNIT alignment. */ - DECL_ALIGN (x) = MAX (DECL_ALIGN (x), min_align); - } - } - - /* Now DECL_INITIAL is null on all members. */ - - /* Delete all duplicate fields from the fieldlist */ - for (x = fieldlist; x && TREE_CHAIN (x);) - /* Anonymous fields aren't duplicates. */ - if (DECL_NAME (TREE_CHAIN (x)) == 0) - x = TREE_CHAIN (x); - else - { - register tree y = fieldlist; - - while (1) - { - if (DECL_NAME (y) == DECL_NAME (TREE_CHAIN (x))) - break; - if (y == x) - break; - y = TREE_CHAIN (y); - } - if (DECL_NAME (y) == DECL_NAME (TREE_CHAIN (x))) - { - error_with_decl (TREE_CHAIN (x), "duplicate member `%s'"); - TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x)); - } - else x = TREE_CHAIN (x); - } - - /* Now we have the nearly final fieldlist. Record it, - then lay out the structure or union (including the fields). */ - - TYPE_FIELDS (t) = fieldlist; - - layout_type (t); - - /* Delete all zero-width bit-fields from the front of the fieldlist */ - while (fieldlist - && DECL_INITIAL (fieldlist)) - fieldlist = TREE_CHAIN (fieldlist); - /* Delete all such members from the rest of the fieldlist */ - for (x = fieldlist; x;) - { - if (TREE_CHAIN (x) && DECL_INITIAL (TREE_CHAIN (x))) - TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x)); - else x = TREE_CHAIN (x); - } - - /* Now we have the truly final field list. - Store it in this type and in the variants. */ - - TYPE_FIELDS (t) = fieldlist; - - /* If there are lots of fields, sort so we can look through them fast. - We arbitrarily consider 16 or more elts to be "a lot". */ - { - int len = 0; - - for (x = fieldlist; x; x = TREE_CHAIN (x)) - { - if (len > 15) - break; - len += 1; - } - if (len > 15) - { - tree *field_array; - char *space; - - len += list_length (x); - /* Use the same allocation policy here that make_node uses, to - ensure that this lives as long as the rest of the struct decl. - All decls in an inline function need to be saved. */ - if (allocation_temporary_p ()) - space = savealloc (sizeof (struct lang_type) + len * sizeof (tree)); - else - space = oballoc (sizeof (struct lang_type) + len * sizeof (tree)); - - TYPE_LANG_SPECIFIC (t) = (struct lang_type *) space; - TYPE_LANG_SPECIFIC (t)->len = len; - - field_array = &TYPE_LANG_SPECIFIC (t)->elts[0]; - len = 0; - for (x = fieldlist; x; x = TREE_CHAIN (x)) - field_array[len++] = x; - - qsort (field_array, len, sizeof (tree), field_decl_cmp); - } - } - - for (x = TYPE_MAIN_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x)) - { - TYPE_FIELDS (x) = TYPE_FIELDS (t); - TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t); - TYPE_ALIGN (x) = TYPE_ALIGN (t); - } - - /* If this was supposed to be a transparent union, but we can't - make it one, warn and turn off the flag. */ - if (TREE_CODE (t) == UNION_TYPE - && TYPE_TRANSPARENT_UNION (t) - && TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t))) - { - TYPE_TRANSPARENT_UNION (t) = 0; - warning ("union cannot be made transparent"); - } - - /* If this structure or union completes the type of any previous - variable declaration, lay it out and output its rtl. */ - - if (current_binding_level->n_incomplete != 0) - { - tree decl; - for (decl = current_binding_level->names; decl; decl = TREE_CHAIN (decl)) - { - if (TREE_TYPE (decl) == t - && TREE_CODE (decl) != TYPE_DECL) - { - layout_decl (decl, 0); - /* This is a no-op in c-lang.c or something real in objc-actions.c. */ - maybe_objc_check_decl (decl); - rest_of_decl_compilation (decl, NULL_PTR, toplevel, 0); - if (! toplevel) - expand_decl (decl); - --current_binding_level->n_incomplete; - } - else if (TYPE_SIZE (TREE_TYPE (decl)) == 0 - && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) - { - tree element = TREE_TYPE (decl); - while (TREE_CODE (element) == ARRAY_TYPE) - element = TREE_TYPE (element); - if (element == t) - layout_array_type (TREE_TYPE (decl)); - } - } - } - - resume_momentary (old_momentary); - - /* Finish debugging output for this type. */ - rest_of_type_compilation (t, toplevel); - - /* The matching push is in start_struct. */ - pop_obstacks (); - - return t; -} - -/* Lay out the type T, and its element type, and so on. */ - -static void -layout_array_type (t) - tree t; -{ - if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) - layout_array_type (TREE_TYPE (t)); - layout_type (t); -} - -/* Begin compiling the definition of an enumeration type. - NAME is its name (or null if anonymous). - Returns the type object, as yet incomplete. - Also records info about it so that build_enumerator - may be used to declare the individual values as they are read. */ - -tree -start_enum (name) - tree name; -{ - register tree enumtype = 0; - - /* If this is the real definition for a previous forward reference, - fill in the contents in the same object that used to be the - forward reference. */ - - if (name != 0) - enumtype = lookup_tag (ENUMERAL_TYPE, name, current_binding_level, 1); - - /* The corresponding pop_obstacks is in finish_enum. */ - push_obstacks_nochange (); - /* If these symbols and types are global, make them permanent. */ - if (current_binding_level == global_binding_level) - end_temporary_allocation (); - - if (enumtype == 0 || TREE_CODE (enumtype) != ENUMERAL_TYPE) - { - enumtype = make_node (ENUMERAL_TYPE); - pushtag (name, enumtype); - } - - C_TYPE_BEING_DEFINED (enumtype) = 1; - - if (TYPE_VALUES (enumtype) != 0) - { - /* This enum is a named one that has been declared already. */ - error ("redeclaration of `enum %s'", IDENTIFIER_POINTER (name)); - - /* Completely replace its old definition. - The old enumerators remain defined, however. */ - TYPE_VALUES (enumtype) = 0; - } - - enum_next_value = integer_zero_node; - enum_overflow = 0; - - if (flag_short_enums) - TYPE_PACKED (enumtype) = 1; - - return enumtype; -} - -/* After processing and defining all the values of an enumeration type, - install their decls in the enumeration type and finish it off. - ENUMTYPE is the type object, VALUES a list of decl-value pairs, - and ATTRIBUTES are the specified attributes. - Returns ENUMTYPE. */ - -tree -finish_enum (enumtype, values, attributes) - tree enumtype; - tree values; - tree attributes; -{ - register tree pair, tem; - tree minnode = 0, maxnode = 0; - int lowprec, highprec, precision; - int toplevel = global_binding_level == current_binding_level; - - if (in_parm_level_p ()) - warning ("enum defined inside parms"); - - decl_attributes (enumtype, attributes, NULL_TREE); - - /* Calculate the maximum value of any enumerator in this type. */ - - if (values == error_mark_node) - minnode = maxnode = integer_zero_node; - else - for (pair = values; pair; pair = TREE_CHAIN (pair)) - { - tree value = TREE_VALUE (pair); - if (pair == values) - minnode = maxnode = TREE_VALUE (pair); - else - { - if (tree_int_cst_lt (maxnode, value)) - maxnode = value; - if (tree_int_cst_lt (value, minnode)) - minnode = value; - } - } - - TYPE_MIN_VALUE (enumtype) = minnode; - TYPE_MAX_VALUE (enumtype) = maxnode; - - /* An enum can have some negative values; then it is signed. */ - TREE_UNSIGNED (enumtype) = tree_int_cst_sgn (minnode) >= 0; - - /* Determine the precision this type needs. */ - - lowprec = min_precision (minnode, TREE_UNSIGNED (enumtype)); - highprec = min_precision (maxnode, TREE_UNSIGNED (enumtype)); - precision = MAX (lowprec, highprec); - - if (TYPE_PACKED (enumtype) || precision > TYPE_PRECISION (integer_type_node)) - { - tree narrowest = type_for_size (precision, 1); - if (narrowest == 0) - { - warning ("enumeration values exceed range of largest integer"); - narrowest = long_long_integer_type_node; - } - - TYPE_PRECISION (enumtype) = TYPE_PRECISION (narrowest); - } - else - TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node); - - TYPE_SIZE (enumtype) = 0; - layout_type (enumtype); - - if (values != error_mark_node) - { - /* Change the type of the enumerators to be the enum type. - Formerly this was done only for enums that fit in an int, - but the comment said it was done only for enums wider than int. - It seems necessary to do this for wide enums, - and best not to change what's done for ordinary narrower ones. */ - for (pair = values; pair; pair = TREE_CHAIN (pair)) - { - TREE_TYPE (TREE_PURPOSE (pair)) = enumtype; - DECL_SIZE (TREE_PURPOSE (pair)) = TYPE_SIZE (enumtype); - if (TREE_CODE (TREE_PURPOSE (pair)) != FUNCTION_DECL) - DECL_ALIGN (TREE_PURPOSE (pair)) = TYPE_ALIGN (enumtype); - } - - /* Replace the decl nodes in VALUES with their names. */ - for (pair = values; pair; pair = TREE_CHAIN (pair)) - TREE_PURPOSE (pair) = DECL_NAME (TREE_PURPOSE (pair)); - - TYPE_VALUES (enumtype) = values; - } - - /* Fix up all variant types of this enum type. */ - for (tem = TYPE_MAIN_VARIANT (enumtype); tem; tem = TYPE_NEXT_VARIANT (tem)) - { - TYPE_VALUES (tem) = TYPE_VALUES (enumtype); - TYPE_MIN_VALUE (tem) = TYPE_MIN_VALUE (enumtype); - TYPE_MAX_VALUE (tem) = TYPE_MAX_VALUE (enumtype); - TYPE_SIZE (tem) = TYPE_SIZE (enumtype); - TYPE_SIZE_UNIT (tem) = TYPE_SIZE_UNIT (enumtype); - TYPE_MODE (tem) = TYPE_MODE (enumtype); - TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype); - TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype); - TREE_UNSIGNED (tem) = TREE_UNSIGNED (enumtype); - } - - /* Finish debugging output for this type. */ - rest_of_type_compilation (enumtype, toplevel); - - /* This matches a push in start_enum. */ - pop_obstacks (); - - return enumtype; -} - -/* Build and install a CONST_DECL for one value of the - current enumeration type (one that was begun with start_enum). - Return a tree-list containing the CONST_DECL and its value. - Assignment of sequential values by default is handled here. */ - -tree -build_enumerator (name, value) - tree name, value; -{ - register tree decl, type; - - /* Validate and default VALUE. */ - - /* Remove no-op casts from the value. */ - if (value) - STRIP_TYPE_NOPS (value); - - if (value != 0) - { - if (TREE_CODE (value) == INTEGER_CST) - { - value = default_conversion (value); - constant_expression_warning (value); - } - else - { - error ("enumerator value for `%s' not integer constant", - IDENTIFIER_POINTER (name)); - value = 0; - } - } - - /* Default based on previous value. */ - /* It should no longer be possible to have NON_LVALUE_EXPR - in the default. */ - if (value == 0) - { - value = enum_next_value; - if (enum_overflow) - error ("overflow in enumeration values"); - } - - if (pedantic && ! int_fits_type_p (value, integer_type_node)) - { - pedwarn ("ANSI C restricts enumerator values to range of `int'"); - value = integer_zero_node; - } - - /* Set basis for default for next value. */ - enum_next_value = build_binary_op (PLUS_EXPR, value, integer_one_node, 0); - enum_overflow = tree_int_cst_lt (enum_next_value, value); - - /* Now create a declaration for the enum value name. */ - - type = TREE_TYPE (value); - type = type_for_size (MAX (TYPE_PRECISION (type), - TYPE_PRECISION (integer_type_node)), - ((flag_traditional - || TYPE_PRECISION (type) >= TYPE_PRECISION (integer_type_node)) - && TREE_UNSIGNED (type))); - - decl = build_decl (CONST_DECL, name, type); - DECL_INITIAL (decl) = value; - TREE_TYPE (value) = type; - pushdecl (decl); - - return saveable_tree_cons (decl, value, NULL_TREE); -} - -/* Create the FUNCTION_DECL for a function definition. - DECLSPECS, DECLARATOR, PREFIX_ATTRIBUTES and ATTRIBUTES are the parts of - the declaration; they describe the function's name and the type it returns, - but twisted together in a fashion that parallels the syntax of C. - - This function creates a binding context for the function body - as well as setting up the FUNCTION_DECL in current_function_decl. - - Returns 1 on success. If the DECLARATOR is not suitable for a function - (it defines a datum instead), we return 0, which tells - yyparse to report a parse error. - - NESTED is nonzero for a function nested within another function. */ - -int -start_function (declspecs, declarator, prefix_attributes, attributes, nested) - tree declarator, declspecs, prefix_attributes, attributes; - int nested; -{ - tree decl1, old_decl; - tree restype; - int old_immediate_size_expand = immediate_size_expand; - - current_function_returns_value = 0; /* Assume, until we see it does. */ - current_function_returns_null = 0; - warn_about_return_type = 0; - current_extern_inline = 0; - c_function_varargs = 0; - named_labels = 0; - shadowed_labels = 0; - - /* Don't expand any sizes in the return type of the function. */ - immediate_size_expand = 0; - - decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1); - - /* If the declarator is not suitable for a function definition, - cause a syntax error. */ - if (decl1 == 0) - { - immediate_size_expand = old_immediate_size_expand; - return 0; - } - - decl_attributes (decl1, prefix_attributes, attributes); - - announce_function (decl1); - - if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl1))) == 0) - { - error ("return-type is an incomplete type"); - /* Make it return void instead. */ - TREE_TYPE (decl1) - = build_function_type (void_type_node, - TYPE_ARG_TYPES (TREE_TYPE (decl1))); - } - - if (warn_about_return_type) - warning ("return-type defaults to `int'"); - - /* Save the parm names or decls from this function's declarator - where store_parm_decls will find them. */ - current_function_parms = last_function_parms; - current_function_parm_tags = last_function_parm_tags; - - /* Make the init_value nonzero so pushdecl knows this is not tentative. - error_mark_node is replaced below (in poplevel) with the BLOCK. */ - DECL_INITIAL (decl1) = error_mark_node; - - /* If this definition isn't a prototype and we had a prototype declaration - before, copy the arg type info from that prototype. - But not if what we had before was a builtin function. */ - old_decl = lookup_name_current_level (DECL_NAME (decl1)); - if (old_decl != 0 && TREE_CODE (TREE_TYPE (old_decl)) == FUNCTION_TYPE - && !DECL_BUILT_IN (old_decl) - && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1))) - == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (old_decl)))) - && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0) - { - TREE_TYPE (decl1) = TREE_TYPE (old_decl); - current_function_prototype_file = DECL_SOURCE_FILE (old_decl); - current_function_prototype_line = DECL_SOURCE_LINE (old_decl); - } - - /* If there is no explicit declaration, look for any out-of-scope implicit - declarations. */ - if (old_decl == 0) - old_decl = IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)); - - /* Optionally warn of old-fashioned def with no previous prototype. */ - if (warn_strict_prototypes - && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0 - && !(old_decl != 0 && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0)) - warning ("function declaration isn't a prototype"); - /* Optionally warn of any global def with no previous prototype. */ - else if (warn_missing_prototypes - && TREE_PUBLIC (decl1) - && !(old_decl != 0 && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0) - && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1)))) - warning_with_decl (decl1, "no previous prototype for `%s'"); - /* Optionally warn of any def with no previous prototype - if the function has already been used. */ - else if (warn_missing_prototypes - && old_decl != 0 && TREE_USED (old_decl) - && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) == 0) - warning_with_decl (decl1, - "`%s' was used with no prototype before its definition"); - /* Optionally warn of any global def with no previous declaration. */ - else if (warn_missing_declarations - && TREE_PUBLIC (decl1) - && old_decl == 0 - && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1)))) - warning_with_decl (decl1, "no previous declaration for `%s'"); - /* Optionally warn of any def with no previous declaration - if the function has already been used. */ - else if (warn_missing_declarations - && old_decl != 0 && TREE_USED (old_decl) - && old_decl == IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1))) - warning_with_decl (decl1, - "`%s' was used with no declaration before its definition"); - - /* This is a definition, not a reference. - So normally clear DECL_EXTERNAL. - However, `extern inline' acts like a declaration - except for defining how to inline. So set DECL_EXTERNAL in that case. */ - DECL_EXTERNAL (decl1) = current_extern_inline; - -#ifdef SET_DEFAULT_DECL_ATTRIBUTES - SET_DEFAULT_DECL_ATTRIBUTES (decl1, attributes); -#endif - - /* This function exists in static storage. - (This does not mean `static' in the C sense!) */ - TREE_STATIC (decl1) = 1; - - /* A nested function is not global. */ - if (current_function_decl != 0) - TREE_PUBLIC (decl1) = 0; - - /* Warn for unlikely, improbable, or stupid declarations of `main'. */ - if (warn_main > 0 - && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1))) == 0) - { - tree args; - int argct = 0; - - if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (decl1))) - != integer_type_node) - pedwarn_with_decl (decl1, "return type of `%s' is not `int'"); - - for (args = TYPE_ARG_TYPES (TREE_TYPE (decl1)); args; - args = TREE_CHAIN (args)) - { - tree type = args ? TREE_VALUE (args) : 0; - - if (type == void_type_node) - break; - - ++argct; - switch (argct) - { - case 1: - if (TYPE_MAIN_VARIANT (type) != integer_type_node) - pedwarn_with_decl (decl1, - "first argument of `%s' should be `int'"); - break; - - case 2: - if (TREE_CODE (type) != POINTER_TYPE - || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE - || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) - != char_type_node)) - pedwarn_with_decl (decl1, - "second argument of `%s' should be `char **'"); - break; - - case 3: - if (TREE_CODE (type) != POINTER_TYPE - || TREE_CODE (TREE_TYPE (type)) != POINTER_TYPE - || (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (type))) - != char_type_node)) - pedwarn_with_decl (decl1, - "third argument of `%s' should probably be `char **'"); - break; - } - } - - /* It is intentional that this message does not mention the third - argument, which is warned for only pedantically, because it's - blessed by mention in an appendix of the standard. */ - if (argct > 0 && (argct < 2 || argct > 3)) - pedwarn_with_decl (decl1, "`%s' takes only zero or two arguments"); - - if (argct == 3 && pedantic) - pedwarn_with_decl (decl1, "third argument of `%s' is deprecated"); - - if (! TREE_PUBLIC (decl1)) - pedwarn_with_decl (decl1, "`%s' is normally a non-static function"); - } - - /* Record the decl so that the function name is defined. - If we already have a decl for this name, and it is a FUNCTION_DECL, - use the old decl. */ - - current_function_decl = pushdecl (decl1); - - pushlevel (0); - declare_parm_level (1); - current_binding_level->subblocks_tag_transparent = 1; - - make_function_rtl (current_function_decl); - - restype = TREE_TYPE (TREE_TYPE (current_function_decl)); - /* Promote the value to int before returning it. */ - if (C_PROMOTING_INTEGER_TYPE_P (restype)) - { - /* It retains unsignedness if traditional - or if not really getting wider. */ - if (TREE_UNSIGNED (restype) - && (flag_traditional - || (TYPE_PRECISION (restype) - == TYPE_PRECISION (integer_type_node)))) - restype = unsigned_type_node; - else - restype = integer_type_node; - } - DECL_RESULT (current_function_decl) - = build_decl (RESULT_DECL, NULL_TREE, restype); - - if (!nested) - /* Allocate further tree nodes temporarily during compilation - of this function only. */ - temporary_allocation (); - - /* If this fcn was already referenced via a block-scope `extern' decl - (or an implicit decl), propagate certain information about the usage. */ - if (TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (current_function_decl))) - TREE_ADDRESSABLE (current_function_decl) = 1; - - immediate_size_expand = old_immediate_size_expand; - - return 1; -} - -/* Record that this function is going to be a varargs function. - This is called before store_parm_decls, which is too early - to call mark_varargs directly. */ - -void -c_mark_varargs () -{ - c_function_varargs = 1; -} - -/* Store the parameter declarations into the current function declaration. - This is called after parsing the parameter declarations, before - digesting the body of the function. - - For an old-style definition, modify the function's type - to specify at least the number of arguments. */ - -void -store_parm_decls () -{ - register tree fndecl = current_function_decl; - register tree parm; - - /* This is either a chain of PARM_DECLs (if a prototype was used) - or a list of IDENTIFIER_NODEs (for an old-fashioned C definition). */ - tree specparms = current_function_parms; - - /* This is a list of types declared among parms in a prototype. */ - tree parmtags = current_function_parm_tags; - - /* This is a chain of PARM_DECLs from old-style parm declarations. */ - register tree parmdecls = getdecls (); - - /* This is a chain of any other decls that came in among the parm - declarations. If a parm is declared with enum {foo, bar} x; - then CONST_DECLs for foo and bar are put here. */ - tree nonparms = 0; - - /* Nonzero if this definition is written with a prototype. */ - int prototype = 0; - - if (specparms != 0 && TREE_CODE (specparms) != TREE_LIST) - { - /* This case is when the function was defined with an ANSI prototype. - The parms already have decls, so we need not do anything here - except record them as in effect - and complain if any redundant old-style parm decls were written. */ - - register tree next; - tree others = 0; - - prototype = 1; - - if (parmdecls != 0) - { - tree decl, link; - - error_with_decl (fndecl, - "parm types given both in parmlist and separately"); - /* Get rid of the erroneous decls; don't keep them on - the list of parms, since they might not be PARM_DECLs. */ - for (decl = current_binding_level->names; - decl; decl = TREE_CHAIN (decl)) - if (DECL_NAME (decl)) - IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) = 0; - for (link = current_binding_level->shadowed; - link; link = TREE_CHAIN (link)) - IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (link)) = TREE_VALUE (link); - current_binding_level->names = 0; - current_binding_level->shadowed = 0; - } - - specparms = nreverse (specparms); - for (parm = specparms; parm; parm = next) - { - next = TREE_CHAIN (parm); - if (TREE_CODE (parm) == PARM_DECL) - { - if (DECL_NAME (parm) == 0) - error_with_decl (parm, "parameter name omitted"); - else if (TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == void_type_node) - { - error_with_decl (parm, "parameter `%s' declared void"); - /* Change the type to error_mark_node so this parameter - will be ignored by assign_parms. */ - TREE_TYPE (parm) = error_mark_node; - } - pushdecl (parm); - } - else - { - /* If we find an enum constant or a type tag, - put it aside for the moment. */ - TREE_CHAIN (parm) = 0; - others = chainon (others, parm); - } - } - - /* Get the decls in their original chain order - and record in the function. */ - DECL_ARGUMENTS (fndecl) = getdecls (); - -#if 0 - /* If this function takes a variable number of arguments, - add a phony parameter to the end of the parm list, - to represent the position of the first unnamed argument. */ - if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl)))) - != void_type_node) - { - tree dummy = build_decl (PARM_DECL, NULL_TREE, void_type_node); - /* Let's hope the address of the unnamed parm - won't depend on its type. */ - TREE_TYPE (dummy) = integer_type_node; - DECL_ARG_TYPE (dummy) = integer_type_node; - DECL_ARGUMENTS (fndecl) - = chainon (DECL_ARGUMENTS (fndecl), dummy); - } -#endif - - /* Now pushdecl the enum constants. */ - for (parm = others; parm; parm = next) - { - next = TREE_CHAIN (parm); - if (DECL_NAME (parm) == 0) - ; - else if (TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == void_type_node) - ; - else if (TREE_CODE (parm) != PARM_DECL) - pushdecl (parm); - } - - storetags (chainon (parmtags, gettags ())); - } - else - { - /* SPECPARMS is an identifier list--a chain of TREE_LIST nodes - each with a parm name as the TREE_VALUE. - - PARMDECLS is a chain of declarations for parameters. - Warning! It can also contain CONST_DECLs which are not parameters - but are names of enumerators of any enum types - declared among the parameters. - - First match each formal parameter name with its declaration. - Associate decls with the names and store the decls - into the TREE_PURPOSE slots. */ - - for (parm = parmdecls; parm; parm = TREE_CHAIN (parm)) - DECL_RESULT (parm) = 0; - - for (parm = specparms; parm; parm = TREE_CHAIN (parm)) - { - register tree tail, found = NULL; - - if (TREE_VALUE (parm) == 0) - { - error_with_decl (fndecl, "parameter name missing from parameter list"); - TREE_PURPOSE (parm) = 0; - continue; - } - - /* See if any of the parmdecls specifies this parm by name. - Ignore any enumerator decls. */ - for (tail = parmdecls; tail; tail = TREE_CHAIN (tail)) - if (DECL_NAME (tail) == TREE_VALUE (parm) - && TREE_CODE (tail) == PARM_DECL) - { - found = tail; - break; - } - - /* If declaration already marked, we have a duplicate name. - Complain, and don't use this decl twice. */ - if (found && DECL_RESULT (found) != 0) - { - error_with_decl (found, "multiple parameters named `%s'"); - found = 0; - } - - /* If the declaration says "void", complain and ignore it. */ - if (found && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == void_type_node) - { - error_with_decl (found, "parameter `%s' declared void"); - TREE_TYPE (found) = integer_type_node; - DECL_ARG_TYPE (found) = integer_type_node; - layout_decl (found, 0); - } - - /* Traditionally, a parm declared float is actually a double. */ - if (found && flag_traditional - && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == float_type_node) - { - TREE_TYPE (found) = double_type_node; - DECL_ARG_TYPE (found) = double_type_node; - layout_decl (found, 0); - } - - /* If no declaration found, default to int. */ - if (!found) - { - found = build_decl (PARM_DECL, TREE_VALUE (parm), - integer_type_node); - DECL_ARG_TYPE (found) = TREE_TYPE (found); - DECL_SOURCE_LINE (found) = DECL_SOURCE_LINE (fndecl); - DECL_SOURCE_FILE (found) = DECL_SOURCE_FILE (fndecl); - if (extra_warnings) - warning_with_decl (found, "type of `%s' defaults to `int'"); - pushdecl (found); - } - - TREE_PURPOSE (parm) = found; - - /* Mark this decl as "already found" -- see test, above. - It is safe to use DECL_RESULT for this - since it is not used in PARM_DECLs or CONST_DECLs. */ - DECL_RESULT (found) = error_mark_node; - } - - /* Put anything which is on the parmdecls chain and which is - not a PARM_DECL onto the list NONPARMS. (The types of - non-parm things which might appear on the list include - enumerators and NULL-named TYPE_DECL nodes.) Complain about - any actual PARM_DECLs not matched with any names. */ - - nonparms = 0; - for (parm = parmdecls; parm; ) - { - tree next = TREE_CHAIN (parm); - TREE_CHAIN (parm) = 0; - - if (TREE_CODE (parm) != PARM_DECL) - nonparms = chainon (nonparms, parm); - else - { - /* Complain about args with incomplete types. */ - if (TYPE_SIZE (TREE_TYPE (parm)) == 0) - { - error_with_decl (parm, "parameter `%s' has incomplete type"); - TREE_TYPE (parm) = error_mark_node; - } - - if (DECL_RESULT (parm) == 0) - { - error_with_decl (parm, - "declaration for parameter `%s' but no such parameter"); - /* Pretend the parameter was not missing. - This gets us to a standard state and minimizes - further error messages. */ - specparms - = chainon (specparms, - tree_cons (parm, NULL_TREE, NULL_TREE)); - } - } - - parm = next; - } - - /* Chain the declarations together in the order of the list of names. */ - /* Store that chain in the function decl, replacing the list of names. */ - parm = specparms; - DECL_ARGUMENTS (fndecl) = 0; - { - register tree last; - for (last = 0; parm; parm = TREE_CHAIN (parm)) - if (TREE_PURPOSE (parm)) - { - if (last == 0) - DECL_ARGUMENTS (fndecl) = TREE_PURPOSE (parm); - else - TREE_CHAIN (last) = TREE_PURPOSE (parm); - last = TREE_PURPOSE (parm); - TREE_CHAIN (last) = 0; - } - } - - /* If there was a previous prototype, - set the DECL_ARG_TYPE of each argument according to - the type previously specified, and report any mismatches. */ - - if (TYPE_ARG_TYPES (TREE_TYPE (fndecl))) - { - register tree type; - for (parm = DECL_ARGUMENTS (fndecl), - type = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); - parm || (type && (TYPE_MAIN_VARIANT (TREE_VALUE (type)) - != void_type_node)); - parm = TREE_CHAIN (parm), type = TREE_CHAIN (type)) - { - if (parm == 0 || type == 0 - || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node) - { - error ("number of arguments doesn't match prototype"); - error_with_file_and_line (current_function_prototype_file, - current_function_prototype_line, - "prototype declaration"); - break; - } - /* Type for passing arg must be consistent - with that declared for the arg. */ - if (! comptypes (DECL_ARG_TYPE (parm), TREE_VALUE (type))) - { - if (TYPE_MAIN_VARIANT (TREE_TYPE (parm)) - == TYPE_MAIN_VARIANT (TREE_VALUE (type))) - { - /* Adjust argument to match prototype. E.g. a previous - `int foo(float);' prototype causes - `int foo(x) float x; {...}' to be treated like - `int foo(float x) {...}'. This is particularly - useful for argument types like uid_t. */ - DECL_ARG_TYPE (parm) = TREE_TYPE (parm); -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (TREE_TYPE (parm)) == INTEGER_TYPE - || TREE_CODE (TREE_TYPE (parm)) == ENUMERAL_TYPE) - && TYPE_PRECISION (TREE_TYPE (parm)) - < TYPE_PRECISION (integer_type_node)) - DECL_ARG_TYPE (parm) = integer_type_node; -#endif - if (pedantic) - { - pedwarn ("promoted argument `%s' doesn't match prototype", - IDENTIFIER_POINTER (DECL_NAME (parm))); - warning_with_file_and_line - (current_function_prototype_file, - current_function_prototype_line, - "prototype declaration"); - } - } - /* If -traditional, allow `int' argument to match - `unsigned' prototype. */ - else if (! (flag_traditional - && TYPE_MAIN_VARIANT (TREE_TYPE (parm)) == integer_type_node - && TYPE_MAIN_VARIANT (TREE_VALUE (type)) == unsigned_type_node)) - { - error ("argument `%s' doesn't match prototype", - IDENTIFIER_POINTER (DECL_NAME (parm))); - error_with_file_and_line (current_function_prototype_file, - current_function_prototype_line, - "prototype declaration"); - } - } - } - TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = 0; - } - - /* Otherwise, create a prototype that would match. */ - - else - { - tree actual = 0, last = 0, type; - - for (parm = DECL_ARGUMENTS (fndecl); parm; parm = TREE_CHAIN (parm)) - { - type = perm_tree_cons (NULL_TREE, DECL_ARG_TYPE (parm), - NULL_TREE); - if (last) - TREE_CHAIN (last) = type; - else - actual = type; - last = type; - } - type = perm_tree_cons (NULL_TREE, void_type_node, NULL_TREE); - if (last) - TREE_CHAIN (last) = type; - else - actual = type; - - /* We are going to assign a new value for the TYPE_ACTUAL_ARG_TYPES - of the type of this function, but we need to avoid having this - affect the types of other similarly-typed functions, so we must - first force the generation of an identical (but separate) type - node for the relevant function type. The new node we create - will be a variant of the main variant of the original function - type. */ - - TREE_TYPE (fndecl) = build_type_copy (TREE_TYPE (fndecl)); - - TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = actual; - } - - /* Now store the final chain of decls for the arguments - as the decl-chain of the current lexical scope. - Put the enumerators in as well, at the front so that - DECL_ARGUMENTS is not modified. */ - - storedecls (chainon (nonparms, DECL_ARGUMENTS (fndecl))); - } - - /* Make sure the binding level for the top of the function body - gets a BLOCK if there are any in the function. - Otherwise, the dbx output is wrong. */ - - keep_next_if_subblocks = 1; - - /* ??? This might be an improvement, - but needs to be thought about some more. */ -#if 0 - keep_next_level_flag = 1; -#endif - - /* Write a record describing this function definition to the prototypes - file (if requested). */ - - gen_aux_info_record (fndecl, 1, 0, prototype); - - /* Initialize the RTL code for the function. */ - - init_function_start (fndecl, input_filename, lineno); - - /* If this is a varargs function, inform function.c. */ - - if (c_function_varargs) - mark_varargs (); - - /* Declare __FUNCTION__ and __PRETTY_FUNCTION__ for this function. */ - - declare_function_name (); - - /* Set up parameters and prepare for return, for the function. */ - - expand_function_start (fndecl, 0); - - /* If this function is `main', emit a call to `__main' - to run global initializers, etc. */ - if (DECL_NAME (fndecl) - && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main") == 0 - && DECL_CONTEXT (fndecl) == NULL_TREE) - expand_main_function (); -} - -/* SPECPARMS is an identifier list--a chain of TREE_LIST nodes - each with a parm name as the TREE_VALUE. A null pointer as TREE_VALUE - stands for an ellipsis in the identifier list. - - PARMLIST is the data returned by get_parm_info for the - parmlist that follows the semicolon. - - We return a value of the same sort that get_parm_info returns, - except that it describes the combination of identifiers and parmlist. */ - -tree -combine_parm_decls (specparms, parmlist, void_at_end) - tree specparms, parmlist; - int void_at_end; -{ - register tree fndecl = current_function_decl; - register tree parm; - - tree parmdecls = TREE_PURPOSE (parmlist); - - /* This is a chain of any other decls that came in among the parm - declarations. They were separated already by get_parm_info, - so we just need to keep them separate. */ - tree nonparms = TREE_VALUE (parmlist); - - tree types = 0; - - for (parm = parmdecls; parm; parm = TREE_CHAIN (parm)) - DECL_RESULT (parm) = 0; - - for (parm = specparms; parm; parm = TREE_CHAIN (parm)) - { - register tree tail, found = NULL; - - /* See if any of the parmdecls specifies this parm by name. */ - for (tail = parmdecls; tail; tail = TREE_CHAIN (tail)) - if (DECL_NAME (tail) == TREE_VALUE (parm)) - { - found = tail; - break; - } - - /* If declaration already marked, we have a duplicate name. - Complain, and don't use this decl twice. */ - if (found && DECL_RESULT (found) != 0) - { - error_with_decl (found, "multiple parameters named `%s'"); - found = 0; - } - - /* If the declaration says "void", complain and ignore it. */ - if (found && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == void_type_node) - { - error_with_decl (found, "parameter `%s' declared void"); - TREE_TYPE (found) = integer_type_node; - DECL_ARG_TYPE (found) = integer_type_node; - layout_decl (found, 0); - } - - /* Traditionally, a parm declared float is actually a double. */ - if (found && flag_traditional - && TYPE_MAIN_VARIANT (TREE_TYPE (found)) == float_type_node) - { - TREE_TYPE (found) = double_type_node; - DECL_ARG_TYPE (found) = double_type_node; - layout_decl (found, 0); - } - - /* If no declaration found, default to int. */ - if (!found) - { - found = build_decl (PARM_DECL, TREE_VALUE (parm), - integer_type_node); - DECL_ARG_TYPE (found) = TREE_TYPE (found); - DECL_SOURCE_LINE (found) = DECL_SOURCE_LINE (fndecl); - DECL_SOURCE_FILE (found) = DECL_SOURCE_FILE (fndecl); - error_with_decl (found, "type of parameter `%s' is not declared"); - pushdecl (found); - } - - TREE_PURPOSE (parm) = found; - - /* Mark this decl as "already found" -- see test, above. - It is safe to use DECL_RESULT for this - since it is not used in PARM_DECLs or CONST_DECLs. */ - DECL_RESULT (found) = error_mark_node; - } - - /* Complain about any actual PARM_DECLs not matched with any names. */ - - for (parm = parmdecls; parm; ) - { - tree next = TREE_CHAIN (parm); - TREE_CHAIN (parm) = 0; - - /* Complain about args with incomplete types. */ - if (TYPE_SIZE (TREE_TYPE (parm)) == 0) - { - error_with_decl (parm, "parameter `%s' has incomplete type"); - TREE_TYPE (parm) = error_mark_node; - } - - if (DECL_RESULT (parm) == 0) - { - error_with_decl (parm, - "declaration for parameter `%s' but no such parameter"); - /* Pretend the parameter was not missing. - This gets us to a standard state and minimizes - further error messages. */ - specparms - = chainon (specparms, - tree_cons (parm, NULL_TREE, NULL_TREE)); - } - - parm = next; - } - - /* Chain the declarations together in the order of the list of names. - At the same time, build up a list of their types, in reverse order. */ - - parm = specparms; - parmdecls = 0; - { - register tree last; - for (last = 0; parm; parm = TREE_CHAIN (parm)) - if (TREE_PURPOSE (parm)) - { - if (last == 0) - parmdecls = TREE_PURPOSE (parm); - else - TREE_CHAIN (last) = TREE_PURPOSE (parm); - last = TREE_PURPOSE (parm); - TREE_CHAIN (last) = 0; - - types = saveable_tree_cons (NULL_TREE, TREE_TYPE (parm), types); - } - } - - if (void_at_end) - return saveable_tree_cons (parmdecls, nonparms, - nreverse (saveable_tree_cons (NULL_TREE, - void_type_node, - types))); - - return saveable_tree_cons (parmdecls, nonparms, nreverse (types)); -} - -/* Finish up a function declaration and compile that function - all the way to assembler language output. The free the storage - for the function definition. - - This is called after parsing the body of the function definition. - - NESTED is nonzero if the function being finished is nested in another. */ - -void -finish_function (nested) - int nested; -{ - register tree fndecl = current_function_decl; - -/* TREE_READONLY (fndecl) = 1; - This caused &foo to be of type ptr-to-const-function - which then got a warning when stored in a ptr-to-function variable. */ - - poplevel (1, 0, 1); - BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl; - - /* Must mark the RESULT_DECL as being in this function. */ - - DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl; - - /* Obey `register' declarations if `setjmp' is called in this fn. */ - if (flag_traditional && current_function_calls_setjmp) - { - setjmp_protect (DECL_INITIAL (fndecl)); - setjmp_protect_args (); - } - - if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main")) - { - if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl))) - != integer_type_node) - { - /* If warn_main is 1 (-Wmain) or 2 (-Wall), we have already warned. - If warn_main is -1 (-Wno-main) we don't want to be warned. */ - if (! warn_main) - pedwarn_with_decl (fndecl, "return type of `%s' is not `int'"); - } - else - { -#ifdef DEFAULT_MAIN_RETURN - /* Make it so that `main' always returns success by default. */ - DEFAULT_MAIN_RETURN; -#endif - } - } - - /* Generate rtl for function exit. */ - expand_function_end (input_filename, lineno, 0); - - /* So we can tell if jump_optimize sets it to 1. */ - can_reach_end = 0; - - /* Run the optimizers and output the assembler code for this function. */ - rest_of_compilation (fndecl); - - current_function_returns_null |= can_reach_end; - - if (warn_missing_noreturn - && !TREE_THIS_VOLATILE (fndecl) - && !current_function_returns_null - && !current_function_returns_value) - warning ("function might be possible candidate for attribute `noreturn'"); - - if (TREE_THIS_VOLATILE (fndecl) && current_function_returns_null) - warning ("`noreturn' function does return"); - else if (warn_return_type && can_reach_end - && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl))) != void_type_node) - /* If this function returns non-void and control can drop through, - complain. */ - warning ("control reaches end of non-void function"); - /* With just -W, complain only if function returns both with - and without a value. */ - else if (extra_warnings - && current_function_returns_value && current_function_returns_null) - warning ("this function may return with or without a value"); - - /* If requested, warn about function definitions where the function will - return a value (usually of some struct or union type) which itself will - take up a lot of stack space. */ - - if (warn_larger_than && !DECL_EXTERNAL (fndecl) && TREE_TYPE (fndecl)) - { - register tree ret_type = TREE_TYPE (TREE_TYPE (fndecl)); - - if (ret_type) - { - register tree ret_type_size = TYPE_SIZE (ret_type); - - if (TREE_CODE (ret_type_size) == INTEGER_CST) - { - unsigned units - = TREE_INT_CST_LOW (ret_type_size) / BITS_PER_UNIT; - - if (units > larger_than_size) - warning_with_decl (fndecl, - "size of return value of `%s' is %u bytes", - units); - } - } - } - - /* Free all the tree nodes making up this function. */ - /* Switch back to allocating nodes permanently - until we start another function. */ - if (! nested) - permanent_allocation (1); - - if (DECL_SAVED_INSNS (fndecl) == 0 && ! nested) - { - /* Stop pointing to the local nodes about to be freed. */ - /* But DECL_INITIAL must remain nonzero so we know this - was an actual function definition. */ - /* For a nested function, this is done in pop_c_function_context. */ - /* If rest_of_compilation set this to 0, leave it 0. */ - if (DECL_INITIAL (fndecl) != 0) - DECL_INITIAL (fndecl) = error_mark_node; - DECL_ARGUMENTS (fndecl) = 0; - } - - if (DECL_STATIC_CONSTRUCTOR (fndecl)) - { -#ifndef ASM_OUTPUT_CONSTRUCTOR - if (! flag_gnu_linker) - static_ctors = perm_tree_cons (NULL_TREE, fndecl, static_ctors); - else -#endif - assemble_constructor (IDENTIFIER_POINTER (DECL_NAME (fndecl))); - } - if (DECL_STATIC_DESTRUCTOR (fndecl)) - { -#ifndef ASM_OUTPUT_DESTRUCTOR - if (! flag_gnu_linker) - static_dtors = perm_tree_cons (NULL_TREE, fndecl, static_dtors); - else -#endif - assemble_destructor (IDENTIFIER_POINTER (DECL_NAME (fndecl))); - } - - if (! nested) - { - /* Let the error reporting routines know that we're outside a - function. For a nested function, this value is used in - pop_c_function_context and then reset via pop_function_context. */ - current_function_decl = NULL; - } -} - -/* Save and restore the variables in this file and elsewhere - that keep track of the progress of compilation of the current function. - Used for nested functions. */ - -struct c_function -{ - struct c_function *next; - tree named_labels; - tree shadowed_labels; - int returns_value; - int returns_null; - int warn_about_return_type; - int extern_inline; - struct binding_level *binding_level; -}; - -struct c_function *c_function_chain; - -/* Save and reinitialize the variables - used during compilation of a C function. */ - -void -push_c_function_context () -{ - struct c_function *p - = (struct c_function *) xmalloc (sizeof (struct c_function)); - - if (pedantic) - pedwarn ("ANSI C forbids nested functions"); - - push_function_context (); - - p->next = c_function_chain; - c_function_chain = p; - - p->named_labels = named_labels; - p->shadowed_labels = shadowed_labels; - p->returns_value = current_function_returns_value; - p->returns_null = current_function_returns_null; - p->warn_about_return_type = warn_about_return_type; - p->extern_inline = current_extern_inline; - p->binding_level = current_binding_level; -} - -/* Restore the variables used during compilation of a C function. */ - -void -pop_c_function_context () -{ - struct c_function *p = c_function_chain; - tree link; - - /* Bring back all the labels that were shadowed. */ - for (link = shadowed_labels; link; link = TREE_CHAIN (link)) - if (DECL_NAME (TREE_VALUE (link)) != 0) - IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link))) - = TREE_VALUE (link); - - if (DECL_SAVED_INSNS (current_function_decl) == 0) - { - /* Stop pointing to the local nodes about to be freed. */ - /* But DECL_INITIAL must remain nonzero so we know this - was an actual function definition. */ - DECL_INITIAL (current_function_decl) = error_mark_node; - DECL_ARGUMENTS (current_function_decl) = 0; - } - - pop_function_context (); - - c_function_chain = p->next; - - named_labels = p->named_labels; - shadowed_labels = p->shadowed_labels; - current_function_returns_value = p->returns_value; - current_function_returns_null = p->returns_null; - warn_about_return_type = p->warn_about_return_type; - current_extern_inline = p->extern_inline; - current_binding_level = p->binding_level; - - free (p); -} - -/* integrate_decl_tree calls this function, but since we don't use the - DECL_LANG_SPECIFIC field, this is a no-op. */ - -void -copy_lang_decl (node) - tree node ATTRIBUTE_UNUSED; -{ -} diff --git a/contrib/gcc/c-iterate.c b/contrib/gcc/c-iterate.c deleted file mode 100644 index dc0cc8a84af4..000000000000 --- a/contrib/gcc/c-iterate.c +++ /dev/null @@ -1,604 +0,0 @@ -/* Build expressions with type checking for C compiler. - Copyright (C) 1987, 88, 89, 92, 93, 96, 1997, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* This file is part of the C front end. - It is responsible for implementing iterators, - both their declarations and the expansion of statements using them. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "c-tree.h" -#include "flags.h" -#include "obstack.h" -#include "rtl.h" -#include "toplev.h" -#include "expr.h" - -/* - KEEPING TRACK OF EXPANSIONS - - In order to clean out expansions corresponding to statements inside - "{(...)}" constructs we have to keep track of all expansions. The - cleanup is needed when an automatic, or implicit, expansion on - iterator, say X, happens to a statement which contains a {(...)} - form with a statement already expanded on X. In this case we have - to go back and cleanup the inner expansion. This can be further - complicated by the fact that {(...)} can be nested. - - To make this cleanup possible, we keep lists of all expansions, and - to make it work for nested constructs, we keep a stack. The list at - the top of the stack (ITER_STACK.CURRENT_LEVEL) corresponds to the - currently parsed level. All expansions of the levels below the - current one are kept in one list whose head is pointed to by - ITER_STACK.SUBLEVEL_FIRST (SUBLEVEL_LAST is there for making merges - easy). The process works as follows: - - -- On "({" a new node is added to the stack by PUSH_ITERATOR_STACK. - The sublevel list is not changed at this point. - - -- On "})" the list for the current level is appended to the sublevel - list. - - -- On ";" sublevel lists are appended to the current level lists. - The reason is this: if they have not been superseded by the - expansion at the current level, they still might be - superseded later by the expansion on the higher level. - The levels do not have to distinguish levels below, so we - can merge the lists together. */ - -struct ixpansion -{ - tree ixdecl; /* Iterator decl */ - rtx ixprologue_start; /* First insn of epilogue. NULL means */ - /* explicit (FOR) expansion*/ - rtx ixprologue_end; - rtx ixepilogue_start; - rtx ixepilogue_end; - struct ixpansion *next; /* Next in the list */ -}; - -struct iter_stack_node -{ - struct ixpansion *first; /* Head of list of ixpansions */ - struct ixpansion *last; /* Last node in list of ixpansions */ - struct iter_stack_node *next; /* Next level iterator stack node */ -}; - -struct iter_stack_node *iter_stack; -struct iter_stack_node sublevel_ixpansions; - -/* A special obstack, and a pointer to the start of - all the data in it (so we can free everything easily). */ -static struct obstack ixp_obstack; -static char *ixp_firstobj; - -/* During collect_iterators, a list of SAVE_EXPRs already scanned. */ -static tree save_exprs; - -static void expand_stmt_with_iterators_1 PROTO((tree, tree)); -static tree collect_iterators PROTO((tree, tree)); -static void iterator_loop_prologue PROTO((tree, rtx *, rtx *)); -static void iterator_loop_epilogue PROTO((tree, rtx *, rtx *)); -static int top_level_ixpansion_p PROTO((void)); -static void isn_append PROTO((struct iter_stack_node *, - struct iter_stack_node *)); -static void istack_sublevel_to_current PROTO((void)); -static void add_ixpansion PROTO((tree, rtx, rtx, rtx, rtx)); -static void delete_ixpansion PROTO((tree)); - -/* Initialize our obstack once per compilation. */ - -void -init_iterators () -{ - gcc_obstack_init (&ixp_obstack); - ixp_firstobj = (char *) obstack_alloc (&ixp_obstack, 0); -} - -/* Handle the start of an explicit `for' loop for iterator IDECL. */ - -void -iterator_for_loop_start (idecl) - tree idecl; -{ - ITERATOR_BOUND_P (idecl) = 1; - add_ixpansion (idecl, 0, 0, 0, 0); - iterator_loop_prologue (idecl, 0, 0); -} - -/* Handle the end of an explicit `for' loop for iterator IDECL. */ - -void -iterator_for_loop_end (idecl) - tree idecl; -{ - iterator_loop_epilogue (idecl, 0, 0); - ITERATOR_BOUND_P (idecl) = 0; -} - -/* - ITERATOR RTL EXPANSIONS - - Expanding simple statements with iterators is straightforward: - collect the list of all free iterators in the statement, and - generate a loop for each of them. - - An iterator is "free" if it has not been "bound" by a FOR - operator. The DECL_RTL of the iterator is the loop counter. */ - -/* Expand a statement STMT, possibly containing iterator usage, into RTL. */ - -void -iterator_expand (stmt) - tree stmt; -{ - tree iter_list; - save_exprs = NULL_TREE; - iter_list = collect_iterators (stmt, NULL_TREE); - expand_stmt_with_iterators_1 (stmt, iter_list); - istack_sublevel_to_current (); -} - - -static void -expand_stmt_with_iterators_1 (stmt, iter_list) - tree stmt, iter_list; -{ - if (iter_list == 0) - expand_expr_stmt (stmt); - else - { - tree current_iterator = TREE_VALUE (iter_list); - tree iter_list_tail = TREE_CHAIN (iter_list); - rtx p_start, p_end, e_start, e_end; - - iterator_loop_prologue (current_iterator, &p_start, &p_end); - expand_stmt_with_iterators_1 (stmt, iter_list_tail); - iterator_loop_epilogue (current_iterator, &e_start, &e_end); - - /** Delete all inner expansions based on current_iterator **/ - /** before adding the outer one. **/ - - delete_ixpansion (current_iterator); - add_ixpansion (current_iterator, p_start, p_end, e_start, e_end); - } -} - - -/* Return a list containing all the free (i.e. not bound by a - containing `for' statement) iterators mentioned in EXP, plus those - in LIST. Do not add duplicate entries to the list. */ - -static tree -collect_iterators (exp, list) - tree exp, list; -{ - if (exp == 0) return list; - - switch (TREE_CODE (exp)) - { - case VAR_DECL: - if (! ITERATOR_P (exp) || ITERATOR_BOUND_P (exp)) - return list; - if (value_member (exp, list)) - return list; - return tree_cons (NULL_TREE, exp, list); - - case TREE_LIST: - { - tree tail; - for (tail = exp; tail; tail = TREE_CHAIN (tail)) - list = collect_iterators (TREE_VALUE (tail), list); - return list; - } - - case SAVE_EXPR: - /* In each scan, scan a given save_expr only once. */ - if (value_member (exp, save_exprs)) - return list; - - save_exprs = tree_cons (NULL_TREE, exp, save_exprs); - return collect_iterators (TREE_OPERAND (exp, 0), list); - - /* we do not automatically iterate blocks -- one must */ - /* use the FOR construct to do that */ - - case BLOCK: - return list; - - default: - switch (TREE_CODE_CLASS (TREE_CODE (exp))) - { - case '1': - return collect_iterators (TREE_OPERAND (exp, 0), list); - - case '2': - case '<': - return collect_iterators (TREE_OPERAND (exp, 0), - collect_iterators (TREE_OPERAND (exp, 1), - list)); - - case 'e': - case 'r': - { - int num_args = tree_code_length[(int) TREE_CODE (exp)]; - int i; - - /* Some tree codes have RTL, not trees, as operands. */ - switch (TREE_CODE (exp)) - { - case CALL_EXPR: - num_args = 2; - break; - case METHOD_CALL_EXPR: - num_args = 3; - break; - case WITH_CLEANUP_EXPR: - num_args = 1; - break; - case RTL_EXPR: - return list; - default: - break; - } - - for (i = 0; i < num_args; i++) - list = collect_iterators (TREE_OPERAND (exp, i), list); - return list; - } - default: - return list; - } - } -} - -/* Emit rtl for the start of a loop for iterator IDECL. - - If necessary, create loop counter rtx and store it as DECL_RTL of IDECL. - - The prologue normally starts and ends with notes, which are returned - by this function in *START_NOTE and *END_NODE. - If START_NOTE and END_NODE are 0, we don't make those notes. */ - -static void -iterator_loop_prologue (idecl, start_note, end_note) - tree idecl; - rtx *start_note, *end_note; -{ - tree expr; - - /* Force the save_expr in DECL_INITIAL to be calculated - if it hasn't been calculated yet. */ - expand_expr (DECL_INITIAL (idecl), const0_rtx, VOIDmode, - EXPAND_NORMAL); - - if (DECL_RTL (idecl) == 0) - expand_decl (idecl); - - if (start_note) - *start_note = emit_note (0, NOTE_INSN_DELETED); - - /* Initialize counter. */ - expr = build (MODIFY_EXPR, TREE_TYPE (idecl), idecl, integer_zero_node); - TREE_SIDE_EFFECTS (expr) = 1; - expand_expr (expr, const0_rtx, VOIDmode, EXPAND_NORMAL); - - expand_start_loop_continue_elsewhere (1); - - ITERATOR_BOUND_P (idecl) = 1; - - if (end_note) - *end_note = emit_note (0, NOTE_INSN_DELETED); -} - -/* Similar to the previous function, but for the end of the loop. - - DECL_RTL is zeroed unless we are inside "({...})". The reason for that is - described below. - - When we create two (or more) loops based on the same IDECL, and - both inside the same "({...})" construct, we must be prepared to - delete both of the loops and create a single one on the level - above, i.e. enclosing the "({...})". The new loop has to use the - same counter rtl because the references to the iterator decl - (IDECL) have already been expanded as references to the counter - rtl. - - It is incorrect to use the same counter reg in different functions, - and it is desirable to use different counters in disjoint loops - when we know there's no need to combine them (because then they can - get allocated separately). */ - -static void -iterator_loop_epilogue (idecl, start_note, end_note) - tree idecl; - rtx *start_note, *end_note; -{ - tree test, incr; - - if (start_note) - *start_note = emit_note (0, NOTE_INSN_DELETED); - expand_loop_continue_here (); - incr = build_binary_op (PLUS_EXPR, idecl, integer_one_node, 0); - incr = build (MODIFY_EXPR, TREE_TYPE (idecl), idecl, incr); - TREE_SIDE_EFFECTS (incr) = 1; - expand_expr (incr, const0_rtx, VOIDmode, EXPAND_NORMAL); - test = build_binary_op (LT_EXPR, idecl, DECL_INITIAL (idecl), 0); - expand_exit_loop_if_false (0, test); - expand_end_loop (); - - ITERATOR_BOUND_P (idecl) = 0; - /* we can reset rtl since there is not chance that this expansion */ - /* would be superseded by a higher level one */ - /* but don't do this if the decl is static, since we need to share */ - /* the same decl in that case. */ - if (top_level_ixpansion_p () && ! TREE_STATIC (idecl)) - DECL_RTL (idecl) = 0; - if (end_note) - *end_note = emit_note (0, NOTE_INSN_DELETED); -} - -/* Return true if we are not currently inside a "({...})" construct. */ - -static int -top_level_ixpansion_p () -{ - return iter_stack == 0; -} - -/* Given two chains of iter_stack_nodes, - append the nodes in X into Y. */ - -static void -isn_append (x, y) - struct iter_stack_node *x, *y; -{ - if (x->first == 0) - return; - - if (y->first == 0) - { - y->first = x->first; - y->last = x->last; - } - else - { - y->last->next = x->first; - y->last = x->last; - } -} - -/** Make X empty **/ - -#define ISN_ZERO(X) (X).first=(X).last=0 - -/* Move the ixpansions in sublevel_ixpansions into the current - node on the iter_stack, or discard them if the iter_stack is empty. - We do this at the end of a statement. */ - -static void -istack_sublevel_to_current () -{ - /* At the top level we can throw away sublevel's expansions **/ - /* because there is nobody above us to ask for a cleanup **/ - if (iter_stack != 0) - /** Merging with empty sublevel list is a no-op **/ - if (sublevel_ixpansions.last) - isn_append (&sublevel_ixpansions, iter_stack); - - if (iter_stack == 0) - obstack_free (&ixp_obstack, ixp_firstobj); - - ISN_ZERO (sublevel_ixpansions); -} - -/* Push a new node on the iter_stack, when we enter a ({...}). */ - -void -push_iterator_stack () -{ - struct iter_stack_node *new_top - = (struct iter_stack_node *) - obstack_alloc (&ixp_obstack, sizeof (struct iter_stack_node)); - - new_top->first = 0; - new_top->last = 0; - new_top->next = iter_stack; - iter_stack = new_top; -} - -/* Pop iter_stack, moving the ixpansions in the node being popped - into sublevel_ixpansions. */ - -void -pop_iterator_stack () -{ - if (iter_stack == 0) - abort (); - - isn_append (iter_stack, &sublevel_ixpansions); - /** Pop current level node: */ - iter_stack = iter_stack->next; -} - - -/* Record an iterator expansion ("ixpansion") for IDECL. - The remaining parameters are the notes in the loop entry - and exit rtl. */ - -static void -add_ixpansion (idecl, pro_start, pro_end, epi_start, epi_end) - tree idecl; - rtx pro_start, pro_end, epi_start, epi_end; -{ - struct ixpansion *newix; - - /* Do nothing if we are not inside "({...})", - as in that case this expansion can't need subsequent RTL modification. */ - if (iter_stack == 0) - return; - - newix = (struct ixpansion *) obstack_alloc (&ixp_obstack, - sizeof (struct ixpansion)); - newix->ixdecl = idecl; - newix->ixprologue_start = pro_start; - newix->ixprologue_end = pro_end; - newix->ixepilogue_start = epi_start; - newix->ixepilogue_end = epi_end; - - newix->next = iter_stack->first; - iter_stack->first = newix; - if (iter_stack->last == 0) - iter_stack->last = newix; -} - -/* Delete the RTL for all ixpansions for iterator IDECL - in our sublevels. We do this when we make a larger - containing expansion for IDECL. */ - -static void -delete_ixpansion (idecl) - tree idecl; -{ - struct ixpansion *previx = 0, *ix; - - for (ix = sublevel_ixpansions.first; ix; ix = ix->next) - if (ix->ixdecl == idecl) - { - /** zero means that this is a mark for FOR -- **/ - /** we do not delete anything, just issue an error. **/ - - if (ix->ixprologue_start == 0) - error_with_decl (idecl, - "`for (%s)' appears within implicit iteration"); - else - { - rtx insn; - /* We delete all insns, including notes because leaving loop */ - /* notes and barriers produced by iterator expansion would */ - /* be misleading to other phases */ - - for (insn = NEXT_INSN (ix->ixprologue_start); - insn != ix->ixprologue_end; - insn = NEXT_INSN (insn)) - delete_insn (insn); - for (insn = NEXT_INSN (ix->ixepilogue_start); - insn != ix->ixepilogue_end; - insn = NEXT_INSN (insn)) - delete_insn (insn); - } - - /* Delete this ixpansion from sublevel_ixpansions. */ - if (previx) - previx->next = ix->next; - else - sublevel_ixpansions.first = ix->next; - if (sublevel_ixpansions.last == ix) - sublevel_ixpansions.last = previx; - } - else - previx = ix; -} - -#ifdef DEBUG_ITERATORS - -/* The functions below are for use from source level debugger. - They print short forms of iterator lists and the iterator stack. */ - -/* Print the name of the iterator D. */ - -void -prdecl (d) - tree d; -{ - if (d) - { - if (TREE_CODE (d) == VAR_DECL) - { - tree tname = DECL_NAME (d); - char *dname = IDENTIFIER_POINTER (tname); - fprintf (stderr, dname); - } - else - fprintf (stderr, "<>"); - } - else - fprintf (stderr, "<<0>>"); -} - -/* Print Iterator List -- names only */ - -tree -pil (head) - tree head; -{ - tree current, next; - for (current = head; current; current = next) - { - tree node = TREE_VALUE (current); - prdecl (node); - next = TREE_CHAIN (current); - if (next) fprintf (stderr, ","); - } - fprintf (stderr, "\n"); -} - -/* Print IXpansion List */ - -struct ixpansion * -pixl (head) - struct ixpansion *head; -{ - struct ixpansion *current, *next; - fprintf (stderr, "> "); - if (head == 0) - fprintf (stderr, "(empty)"); - - for (current=head; current; current = next) - { - tree node = current->ixdecl; - prdecl (node); - next = current->next; - if (next) - fprintf (stderr, ","); - } - fprintf (stderr, "\n"); - return head; -} - -/* Print Iterator Stack. */ - -void -pis () -{ - struct iter_stack_node *stack_node; - - fprintf (stderr, "--SubLevel: "); - pixl (sublevel_ixpansions.first); - fprintf (stderr, "--Stack:--\n"); - for (stack_node = iter_stack; - stack_node; - stack_node = stack_node->next) - pixl (stack_node->first); -} - -#endif /* DEBUG_ITERATORS */ diff --git a/contrib/gcc/c-lang.c b/contrib/gcc/c-lang.c deleted file mode 100644 index 7da67986af1f..000000000000 --- a/contrib/gcc/c-lang.c +++ /dev/null @@ -1,217 +0,0 @@ -/* Language-specific hook definitions for C front end. - Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "input.h" -#include "c-tree.h" -#include "c-lex.h" -#include "toplev.h" -#include "output.h" - -#if USE_CPPLIB -#include "cpplib.h" -extern char *yy_cur; -extern cpp_reader parse_in; -extern cpp_options parse_options; -#endif - -/* Each of the functions defined here - is an alternative to a function in objc-actions.c. */ - -int -lang_decode_option (argc, argv) - int argc; - char **argv; -{ - return c_decode_option (argc, argv); -} - -void -lang_init_options () -{ -#if USE_CPPLIB - cpp_reader_init (&parse_in); - parse_in.opts = &parse_options; - cpp_options_init (&parse_options); -#endif -} - -void -lang_init () -{ - /* the beginning of the file is a new line; check for # */ - /* With luck, we discover the real source file's name from that - and put it in input_filename. */ -#if !USE_CPPLIB - ungetc (check_newline (), finput); -#else - check_newline (); - yy_cur--; -#endif -} - -void -lang_finish () -{ -} - -char * -lang_identify () -{ - return "c"; -} - -void -print_lang_statistics () -{ -} - -/* used by print-tree.c */ - -void -lang_print_xnode (file, node, indent) - FILE *file ATTRIBUTE_UNUSED; - tree node ATTRIBUTE_UNUSED; - int indent ATTRIBUTE_UNUSED; -{ -} - -/* Used by c-lex.c, but only for objc. */ - -tree -lookup_interface (arg) - tree arg ATTRIBUTE_UNUSED; -{ - return 0; -} - -tree -is_class_name (arg) - tree arg ATTRIBUTE_UNUSED; -{ - return 0; -} - -void -maybe_objc_check_decl (decl) - tree decl ATTRIBUTE_UNUSED; -{ -} - -int -maybe_objc_comptypes (lhs, rhs, reflexive) - tree lhs ATTRIBUTE_UNUSED; - tree rhs ATTRIBUTE_UNUSED; - int reflexive ATTRIBUTE_UNUSED; -{ - return -1; -} - -tree -maybe_objc_method_name (decl) - tree decl ATTRIBUTE_UNUSED; -{ - return 0; -} - -tree -maybe_building_objc_message_expr () -{ - return 0; -} - -int -recognize_objc_keyword () -{ - return 0; -} - -tree -build_objc_string (len, str) - int len ATTRIBUTE_UNUSED; - const char *str ATTRIBUTE_UNUSED; -{ - abort (); - return NULL_TREE; -} - -/* Called at end of parsing, but before end-of-file processing. */ - -void -finish_file () -{ -#ifndef ASM_OUTPUT_CONSTRUCTOR - extern tree static_ctors; -#endif -#ifndef ASM_OUTPUT_DESTRUCTOR - extern tree static_dtors; -#endif - extern tree build_function_call PROTO((tree, tree)); -#if !defined(ASM_OUTPUT_CONSTRUCTOR) || !defined(ASM_OUTPUT_DESTRUCTOR) - tree void_list_node = build_tree_list (NULL_TREE, void_type_node); -#endif -#ifndef ASM_OUTPUT_CONSTRUCTOR - if (static_ctors) - { - tree fnname = get_file_function_name ('I'); - start_function (void_list_node, - build_parse_node (CALL_EXPR, fnname, - tree_cons (NULL_TREE, NULL_TREE, - void_list_node), - NULL_TREE), - NULL_TREE, NULL_TREE, 0); - fnname = DECL_ASSEMBLER_NAME (current_function_decl); - store_parm_decls (); - - for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors)) - expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors), - NULL_TREE)); - - finish_function (0); - - assemble_constructor (IDENTIFIER_POINTER (fnname)); - } -#endif -#ifndef ASM_OUTPUT_DESTRUCTOR - if (static_dtors) - { - tree fnname = get_file_function_name ('D'); - start_function (void_list_node, - build_parse_node (CALL_EXPR, fnname, - tree_cons (NULL_TREE, NULL_TREE, - void_list_node), - NULL_TREE), - NULL_TREE, NULL_TREE, 0); - fnname = DECL_ASSEMBLER_NAME (current_function_decl); - store_parm_decls (); - - for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors)) - expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors), - NULL_TREE)); - - finish_function (0); - - assemble_destructor (IDENTIFIER_POINTER (fnname)); - } -#endif -} diff --git a/contrib/gcc/c-lex.c b/contrib/gcc/c-lex.c deleted file mode 100644 index 27c65f3fa27f..000000000000 --- a/contrib/gcc/c-lex.c +++ /dev/null @@ -1,2350 +0,0 @@ -/* Lexical analyzer for C and Objective C. - Copyright (C) 1987, 88, 89, 92, 94-97, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" - -#include "rtl.h" -#include "tree.h" -#include "input.h" -#include "output.h" -#include "c-lex.h" -#include "c-tree.h" -#include "flags.h" -#include "c-parse.h" -#include "c-pragma.h" -#include "toplev.h" -#include "intl.h" - -/* MULTIBYTE_CHARS support only works for native compilers. - ??? Ideally what we want is to model widechar support after - the current floating point support. */ -#ifdef CROSS_COMPILE -#undef MULTIBYTE_CHARS -#endif - -#ifdef MULTIBYTE_CHARS -#include "mbchar.h" -#include -#endif /* MULTIBYTE_CHARS */ - -#if USE_CPPLIB -#include "cpplib.h" -extern cpp_reader parse_in; -extern cpp_options parse_options; -#else -/* Stream for reading from the input file. */ -FILE *finput; -#endif - -extern void yyprint PROTO((FILE *, int, YYSTYPE)); - -/* The elements of `ridpointers' are identifier nodes - for the reserved type names and storage classes. - It is indexed by a RID_... value. */ -tree ridpointers[(int) RID_MAX]; - -/* Cause the `yydebug' variable to be defined. */ -#define YYDEBUG 1 - -#if USE_CPPLIB -extern unsigned char *yy_cur, *yy_lim; - -extern int yy_get_token (); - -#define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ()) -#define UNGETC(c) ((c) == EOF ? 0 : yy_cur--) -#else -#define GETC() getc (finput) -#define UNGETC(c) ungetc (c, finput) -#endif - -/* the declaration found for the last IDENTIFIER token read in. - yylex must look this up to detect typedefs, which get token type TYPENAME, - so it is left around in case the identifier is not a typedef but is - used in a context which makes it a reference to a variable. */ -tree lastiddecl; - -/* Nonzero enables objc features. */ - -int doing_objc_thang; - -extern int yydebug; - -/* File used for outputting assembler code. */ -extern FILE *asm_out_file; - -#ifndef WCHAR_TYPE_SIZE -#ifdef INT_TYPE_SIZE -#define WCHAR_TYPE_SIZE INT_TYPE_SIZE -#else -#define WCHAR_TYPE_SIZE BITS_PER_WORD -#endif -#endif - -/* Number of bytes in a wide character. */ -#define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT) - -static int maxtoken; /* Current nominal length of token buffer. */ -char *token_buffer; /* Pointer to token buffer. - Actual allocated length is maxtoken + 2. - This is not static because objc-parse.y uses it. */ - -static int indent_level = 0; /* Number of { minus number of }. */ - -/* Nonzero if end-of-file has been seen on input. */ -static int end_of_file; - -#if !USE_CPPLIB -/* Buffered-back input character; faster than using ungetc. */ -static int nextchar = -1; -#endif - -#ifdef HANDLE_GENERIC_PRAGMAS -static int handle_generic_pragma PROTO((int)); -#endif /* HANDLE_GENERIC_PRAGMAS */ -static int whitespace_cr PROTO((int)); -static int skip_white_space PROTO((int)); -static int skip_white_space_on_line PROTO((void)); -static char *extend_token_buffer PROTO((const char *)); -static int readescape PROTO((int *)); -static void parse_float PROTO((PTR)); - -/* Do not insert generated code into the source, instead, include it. - This allows us to build gcc automatically even for targets that - need to add or modify the reserved keyword lists. */ -#include "c-gperf.h" - -/* Return something to represent absolute declarators containing a *. - TARGET is the absolute declarator that the * contains. - TYPE_QUALS is a list of modifiers such as const or volatile - to apply to the pointer type, represented as identifiers. - - We return an INDIRECT_REF whose "contents" are TARGET - and whose type is the modifier list. */ - -tree -make_pointer_declarator (type_quals, target) - tree type_quals, target; -{ - return build1 (INDIRECT_REF, type_quals, target); -} - -void -forget_protocol_qualifiers () -{ - int i, n = sizeof wordlist / sizeof (struct resword); - - for (i = 0; i < n; i++) - if ((int) wordlist[i].rid >= (int) RID_IN - && (int) wordlist[i].rid <= (int) RID_ONEWAY) - wordlist[i].name = ""; -} - -void -remember_protocol_qualifiers () -{ - int i, n = sizeof wordlist / sizeof (struct resword); - - for (i = 0; i < n; i++) - if (wordlist[i].rid == RID_IN) - wordlist[i].name = "in"; - else if (wordlist[i].rid == RID_OUT) - wordlist[i].name = "out"; - else if (wordlist[i].rid == RID_INOUT) - wordlist[i].name = "inout"; - else if (wordlist[i].rid == RID_BYCOPY) - wordlist[i].name = "bycopy"; - else if (wordlist[i].rid == RID_BYREF) - wordlist[i].name = "byref"; - else if (wordlist[i].rid == RID_ONEWAY) - wordlist[i].name = "oneway"; -} - -char * -init_parse (filename) - char *filename; -{ -#if !USE_CPPLIB - /* Open input file. */ - if (filename == 0 || !strcmp (filename, "-")) - { - finput = stdin; - filename = "stdin"; - } - else - finput = fopen (filename, "r"); - if (finput == 0) - pfatal_with_name (filename); - -#ifdef IO_BUFFER_SIZE - setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE); -#endif -#else /* !USE_CPPLIB */ - parse_in.show_column = 1; - if (! cpp_start_read (&parse_in, filename)) - abort (); - - if (filename == 0 || !strcmp (filename, "-")) - filename = "stdin"; - - /* cpp_start_read always puts at least one line directive into the - token buffer. We must arrange to read it out here. */ - yy_cur = parse_in.token_buffer; - yy_lim = CPP_PWRITTEN (&parse_in); -#endif - - init_lex (); - - return filename; -} - -void -finish_parse () -{ -#if USE_CPPLIB - cpp_finish (&parse_in); -#else - fclose (finput); -#endif -} - -void -init_lex () -{ - /* Make identifier nodes long enough for the language-specific slots. */ - set_identifier_size (sizeof (struct lang_identifier)); - - /* Start it at 0, because check_newline is called at the very beginning - and will increment it to 1. */ - lineno = 0; - -#ifdef MULTIBYTE_CHARS - /* Change to the native locale for multibyte conversions. */ - setlocale (LC_CTYPE, ""); - literal_codeset = getenv ("LANG"); -#endif - - maxtoken = 40; - token_buffer = (char *) xmalloc (maxtoken + 2); - - ridpointers[(int) RID_INT] = get_identifier ("int"); - ridpointers[(int) RID_CHAR] = get_identifier ("char"); - ridpointers[(int) RID_VOID] = get_identifier ("void"); - ridpointers[(int) RID_FLOAT] = get_identifier ("float"); - ridpointers[(int) RID_DOUBLE] = get_identifier ("double"); - ridpointers[(int) RID_SHORT] = get_identifier ("short"); - ridpointers[(int) RID_LONG] = get_identifier ("long"); - ridpointers[(int) RID_UNSIGNED] = get_identifier ("unsigned"); - ridpointers[(int) RID_SIGNED] = get_identifier ("signed"); - ridpointers[(int) RID_INLINE] = get_identifier ("inline"); - ridpointers[(int) RID_CONST] = get_identifier ("const"); - ridpointers[(int) RID_RESTRICT] = get_identifier ("restrict"); - ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile"); - ridpointers[(int) RID_AUTO] = get_identifier ("auto"); - ridpointers[(int) RID_STATIC] = get_identifier ("static"); - ridpointers[(int) RID_EXTERN] = get_identifier ("extern"); - ridpointers[(int) RID_TYPEDEF] = get_identifier ("typedef"); - ridpointers[(int) RID_REGISTER] = get_identifier ("register"); - ridpointers[(int) RID_ITERATOR] = get_identifier ("iterator"); - ridpointers[(int) RID_COMPLEX] = get_identifier ("complex"); - ridpointers[(int) RID_ID] = get_identifier ("id"); - ridpointers[(int) RID_IN] = get_identifier ("in"); - ridpointers[(int) RID_OUT] = get_identifier ("out"); - ridpointers[(int) RID_INOUT] = get_identifier ("inout"); - ridpointers[(int) RID_BYCOPY] = get_identifier ("bycopy"); - ridpointers[(int) RID_BYREF] = get_identifier ("byref"); - ridpointers[(int) RID_ONEWAY] = get_identifier ("oneway"); - forget_protocol_qualifiers(); - - /* Some options inhibit certain reserved words. - Clear those words out of the hash table so they won't be recognized. */ -#define UNSET_RESERVED_WORD(STRING) \ - do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \ - if (s) s->name = ""; } while (0) - - if (! doing_objc_thang) - UNSET_RESERVED_WORD ("id"); - - if (flag_traditional) - { - UNSET_RESERVED_WORD ("const"); - UNSET_RESERVED_WORD ("restrict"); - UNSET_RESERVED_WORD ("volatile"); - UNSET_RESERVED_WORD ("typeof"); - UNSET_RESERVED_WORD ("signed"); - UNSET_RESERVED_WORD ("inline"); - UNSET_RESERVED_WORD ("iterator"); - UNSET_RESERVED_WORD ("complex"); - } - else if (!flag_isoc9x) - UNSET_RESERVED_WORD ("restrict"); - - if (flag_no_asm) - { - UNSET_RESERVED_WORD ("asm"); - UNSET_RESERVED_WORD ("typeof"); - UNSET_RESERVED_WORD ("inline"); - UNSET_RESERVED_WORD ("iterator"); - UNSET_RESERVED_WORD ("complex"); - } -} - -void -reinit_parse_for_function () -{ -} - -/* Function used when yydebug is set, to print a token in more detail. */ - -void -yyprint (file, yychar, yylval) - FILE *file; - int yychar; - YYSTYPE yylval; -{ - tree t; - switch (yychar) - { - case IDENTIFIER: - case TYPENAME: - case OBJECTNAME: - t = yylval.ttype; - if (IDENTIFIER_POINTER (t)) - fprintf (file, " `%s'", IDENTIFIER_POINTER (t)); - break; - - case CONSTANT: - t = yylval.ttype; - if (TREE_CODE (t) == INTEGER_CST) - fprintf (file, -#if HOST_BITS_PER_WIDE_INT == 64 -#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT - " 0x%x%016x", -#else -#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG - " 0x%lx%016lx", -#else - " 0x%llx%016llx", -#endif -#endif -#else -#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT - " 0x%lx%08lx", -#else - " 0x%x%08x", -#endif -#endif - TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t)); - break; - } -} - -/* Iff C is a carriage return, warn about it - if appropriate - - and return nonzero. */ -static int -whitespace_cr (c) - int c; -{ - static int newline_warning = 0; - - if (c == '\r') - { - /* ANSI C says the effects of a carriage return in a source file - are undefined. */ - if (pedantic && !newline_warning) - { - warning ("carriage return in source file"); - warning ("(we only warn about the first carriage return)"); - newline_warning = 1; - } - return 1; - } - return 0; -} - -/* If C is not whitespace, return C. - Otherwise skip whitespace and return first nonwhite char read. */ - -static int -skip_white_space (c) - register int c; -{ - for (;;) - { - switch (c) - { - /* We don't recognize comments here, because - cpp output can include / and * consecutively as operators. - Also, there's no need, since cpp removes all comments. */ - - case '\n': - c = check_newline (); - break; - - case ' ': - case '\t': - case '\f': - case '\v': - case '\b': - c = GETC(); - break; - - case '\r': - whitespace_cr (c); - c = GETC(); - break; - - case '\\': - c = GETC(); - if (c == '\n') - lineno++; - else - error ("stray '\\' in program"); - c = GETC(); - break; - - default: - return (c); - } - } -} - -/* Skips all of the white space at the current location in the input file. - Must use and reset nextchar if it has the next character. */ - -void -position_after_white_space () -{ - register int c; - -#if !USE_CPPLIB - if (nextchar != -1) - c = nextchar, nextchar = -1; - else -#endif - c = GETC(); - - UNGETC (skip_white_space (c)); -} - -/* Like skip_white_space, but don't advance beyond the end of line. - Moreover, we don't get passed a character to start with. */ -static int -skip_white_space_on_line () -{ - register int c; - - while (1) - { - c = GETC(); - switch (c) - { - case '\n': - default: - break; - - case ' ': - case '\t': - case '\f': - case '\v': - case '\b': - continue; - - case '\r': - whitespace_cr (c); - continue; - } - break; - } - return c; -} - -/* Make the token buffer longer, preserving the data in it. - P should point to just beyond the last valid character in the old buffer. - The value we return is a pointer to the new buffer - at a place corresponding to P. */ - -static char * -extend_token_buffer (p) - const char *p; -{ - int offset = p - token_buffer; - - maxtoken = maxtoken * 2 + 10; - token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2); - - return token_buffer + offset; -} - -#if defined HANDLE_PRAGMA -/* Local versions of these macros, that can be passed as function pointers. */ -static int -pragma_getc () -{ - return GETC(); -} - -static void -pragma_ungetc (arg) - int arg; -{ - UNGETC (arg); -} -#endif - -/* At the beginning of a line, increment the line number - and process any #-directive on this line. - If the line is a #-directive, read the entire line and return a newline. - Otherwise, return the line's first non-whitespace character. */ - -int -check_newline () -{ - register int c; - register int token; - - lineno++; - - /* Read first nonwhite char on the line. */ - - c = GETC(); - while (c == ' ' || c == '\t') - c = GETC(); - - if (c != '#') - { - /* If not #, return it so caller will use it. */ - return c; - } - - /* Read first nonwhite char after the `#'. */ - - c = GETC(); - while (c == ' ' || c == '\t') - c = GETC(); - - /* If a letter follows, then if the word here is `line', skip - it and ignore it; otherwise, ignore the line, with an error - if the word isn't `pragma', `ident', `define', or `undef'. */ - - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) - { - if (c == 'p') - { - if (GETC() == 'r' - && GETC() == 'a' - && GETC() == 'g' - && GETC() == 'm' - && GETC() == 'a' - && ((c = GETC()) == ' ' || c == '\t' || c == '\n' - || whitespace_cr (c) )) - { - while (c == ' ' || c == '\t' || whitespace_cr (c)) - c = GETC (); - if (c == '\n') - return c; - -#if defined HANDLE_PRAGMA || defined HANDLE_GENERIC_PRAGMAS - UNGETC (c); - token = yylex (); - if (token != IDENTIFIER) - goto skipline; -#endif /* HANDLE_PRAGMA || HANDLE_GENERIC_PRAGMAS */ - -#ifdef HANDLE_PRAGMA - /* We invoke HANDLE_PRAGMA before HANDLE_GENERIC_PRAGMAS (if - both are defined), in order to give the back end a chance to - override the interpretation of generic style pragmas. */ -#if !USE_CPPLIB - if (nextchar >= 0) - { - c = nextchar, nextchar = -1; - UNGETC (c); - } -#endif /* !USE_CPPLIB */ - - if (TREE_CODE (yylval.ttype) != IDENTIFIER_NODE) - goto skipline; - - if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc, - IDENTIFIER_POINTER (yylval.ttype))) - return GETC (); -#endif /* HANDLE_PRAGMA */ - -#ifdef HANDLE_GENERIC_PRAGMAS - if (handle_generic_pragma (token)) - return GETC (); -#endif /* HANDLE_GENERIC_PRAGMAS */ - - /* Issue a warning message if we have been asked to do so. - Ignoring unknown pragmas in system header file unless - an explcit -Wunknown-pragmas has been given. */ - if (warn_unknown_pragmas > 1 - || (warn_unknown_pragmas && ! in_system_header)) - warning ("ignoring pragma: %s", token_buffer); - - goto skipline; - } - } - - else if (c == 'd') - { - if (GETC() == 'e' - && GETC() == 'f' - && GETC() == 'i' - && GETC() == 'n' - && GETC() == 'e' - && ((c = GETC()) == ' ' || c == '\t' || c == '\n')) - { - if (c != '\n') - debug_define (lineno, GET_DIRECTIVE_LINE ()); - goto skipline; - } - } - else if (c == 'u') - { - if (GETC() == 'n' - && GETC() == 'd' - && GETC() == 'e' - && GETC() == 'f' - && ((c = GETC()) == ' ' || c == '\t' || c == '\n')) - { - if (c != '\n') - debug_undef (lineno, GET_DIRECTIVE_LINE ()); - goto skipline; - } - } - else if (c == 'l') - { - if (GETC() == 'i' - && GETC() == 'n' - && GETC() == 'e' - && ((c = GETC()) == ' ' || c == '\t')) - goto linenum; - } - else if (c == 'i') - { - if (GETC() == 'd' - && GETC() == 'e' - && GETC() == 'n' - && GETC() == 't' - && ((c = GETC()) == ' ' || c == '\t')) - { - /* #ident. The pedantic warning is now in cccp.c. */ - - /* Here we have just seen `#ident '. - A string constant should follow. */ - - c = skip_white_space_on_line (); - - /* If no argument, ignore the line. */ - if (c == '\n') - return c; - - UNGETC (c); - token = yylex (); - if (token != STRING - || TREE_CODE (yylval.ttype) != STRING_CST) - { - error ("invalid #ident"); - goto skipline; - } - - if (!flag_no_ident) - { -#ifdef ASM_OUTPUT_IDENT - ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (yylval.ttype)); -#endif - } - - /* Skip the rest of this line. */ - goto skipline; - } - } - - error ("undefined or invalid # directive"); - goto skipline; - } - -linenum: - /* Here we have either `#line' or `# '. - In either case, it should be a line number; a digit should follow. */ - - /* Can't use skip_white_space here, but must handle all whitespace - that is not '\n', lest we get a recursion for '\r' '\n' when - calling yylex. */ - UNGETC (c); - c = skip_white_space_on_line (); - - /* If the # is the only nonwhite char on the line, - just ignore it. Check the new newline. */ - if (c == '\n') - return c; - - /* Something follows the #; read a token. */ - - UNGETC (c); - token = yylex (); - - if (token == CONSTANT - && TREE_CODE (yylval.ttype) == INTEGER_CST) - { - int old_lineno = lineno; - int used_up = 0; - /* subtract one, because it is the following line that - gets the specified number */ - - int l = TREE_INT_CST_LOW (yylval.ttype) - 1; - - /* Is this the last nonwhite stuff on the line? */ - c = skip_white_space_on_line (); - if (c == '\n') - { - /* No more: store the line number and check following line. */ - lineno = l; - return c; - } - UNGETC (c); - - /* More follows: it must be a string constant (filename). */ - - /* Read the string constant. */ - token = yylex (); - - if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST) - { - error ("invalid #line"); - goto skipline; - } - - input_filename - = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1); - strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype)); - lineno = l; - - /* Each change of file name - reinitializes whether we are now in a system header. */ - in_system_header = 0; - - if (main_input_filename == 0) - main_input_filename = input_filename; - - /* Is this the last nonwhite stuff on the line? */ - c = skip_white_space_on_line (); - if (c == '\n') - { - /* Update the name in the top element of input_file_stack. */ - if (input_file_stack) - input_file_stack->name = input_filename; - - return c; - } - UNGETC (c); - - token = yylex (); - used_up = 0; - - /* `1' after file name means entering new file. - `2' after file name means just left a file. */ - - if (token == CONSTANT - && TREE_CODE (yylval.ttype) == INTEGER_CST) - { - if (TREE_INT_CST_LOW (yylval.ttype) == 1) - { - /* Pushing to a new file. */ - struct file_stack *p - = (struct file_stack *) xmalloc (sizeof (struct file_stack)); - input_file_stack->line = old_lineno; - p->next = input_file_stack; - p->name = input_filename; - p->indent_level = indent_level; - input_file_stack = p; - input_file_stack_tick++; - debug_start_source_file (input_filename); - used_up = 1; - } - else if (TREE_INT_CST_LOW (yylval.ttype) == 2) - { - /* Popping out of a file. */ - if (input_file_stack->next) - { - struct file_stack *p = input_file_stack; - if (indent_level != p->indent_level) - { - warning_with_file_and_line - (p->name, old_lineno, - "This file contains more `%c's than `%c's.", - indent_level > p->indent_level ? '{' : '}', - indent_level > p->indent_level ? '}' : '{'); - } - input_file_stack = p->next; - free (p); - input_file_stack_tick++; - debug_end_source_file (input_file_stack->line); - } - else - error ("#-lines for entering and leaving files don't match"); - - used_up = 1; - } - } - - /* Now that we've pushed or popped the input stack, - update the name in the top element. */ - if (input_file_stack) - input_file_stack->name = input_filename; - - /* If we have handled a `1' or a `2', - see if there is another number to read. */ - if (used_up) - { - /* Is this the last nonwhite stuff on the line? */ - c = skip_white_space_on_line (); - if (c == '\n') - return c; - UNGETC (c); - - token = yylex (); - used_up = 0; - } - - /* `3' after file name means this is a system header file. */ - - if (token == CONSTANT - && TREE_CODE (yylval.ttype) == INTEGER_CST - && TREE_INT_CST_LOW (yylval.ttype) == 3) - in_system_header = 1, used_up = 1; - - if (used_up) - { - /* Is this the last nonwhite stuff on the line? */ - c = skip_white_space_on_line (); - if (c == '\n') - return c; - UNGETC (c); - } - - warning ("unrecognized text at end of #line"); - } - else - error ("invalid #-line"); - - /* skip the rest of this line. */ - skipline: -#if !USE_CPPLIB - if (c != '\n' && c != EOF && nextchar >= 0) - c = nextchar, nextchar = -1; -#endif - while (c != '\n' && c != EOF) - c = GETC(); - return c; -} - -#ifdef HANDLE_GENERIC_PRAGMAS - -/* Handle a #pragma directive. - TOKEN is the token we read after `#pragma'. Processes the entire input - line and return non-zero iff the pragma has been successfully parsed. */ - -/* This function has to be in this file, in order to get at - the token types. */ - -static int -handle_generic_pragma (token) - register int token; -{ - register int c; - - for (;;) - { - switch (token) - { - case IDENTIFIER: - case TYPENAME: - case STRING: - case CONSTANT: - handle_pragma_token (token_buffer, yylval.ttype); - break; - default: - handle_pragma_token (token_buffer, NULL); - } -#if !USE_CPPLIB - if (nextchar >= 0) - c = nextchar, nextchar = -1; - else -#endif - c = GETC (); - - while (c == ' ' || c == '\t') - c = GETC (); - UNGETC (c); - - if (c == '\n' || c == EOF) - return handle_pragma_token (NULL, NULL); - - token = yylex (); - } -} - -#endif /* HANDLE_GENERIC_PRAGMAS */ - -#define ENDFILE -1 /* token that represents end-of-file */ - -/* Read an escape sequence, returning its equivalent as a character, - or store 1 in *ignore_ptr if it is backslash-newline. */ - -static int -readescape (ignore_ptr) - int *ignore_ptr; -{ - register int c = GETC(); - register int code; - register unsigned count; - unsigned firstdig = 0; - int nonnull; - - switch (c) - { - case 'x': - if (warn_traditional) - warning ("the meaning of `\\x' varies with -traditional"); - - if (flag_traditional) - return c; - - code = 0; - count = 0; - nonnull = 0; - while (1) - { - c = GETC(); - if (!(c >= 'a' && c <= 'f') - && !(c >= 'A' && c <= 'F') - && !(c >= '0' && c <= '9')) - { - UNGETC (c); - break; - } - code *= 16; - if (c >= 'a' && c <= 'f') - code += c - 'a' + 10; - if (c >= 'A' && c <= 'F') - code += c - 'A' + 10; - if (c >= '0' && c <= '9') - code += c - '0'; - if (code != 0 || count != 0) - { - if (count == 0) - firstdig = code; - count++; - } - nonnull = 1; - } - if (! nonnull) - error ("\\x used with no following hex digits"); - else if (count == 0) - /* Digits are all 0's. Ok. */ - ; - else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node) - || (count > 1 - && (((unsigned)1 << (TYPE_PRECISION (integer_type_node) - (count - 1) * 4)) - <= firstdig))) - pedwarn ("hex escape out of range"); - return code; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': - code = 0; - count = 0; - while ((c <= '7') && (c >= '0') && (count++ < 3)) - { - code = (code * 8) + (c - '0'); - c = GETC(); - } - UNGETC (c); - return code; - - case '\\': case '\'': case '"': - return c; - - case '\n': - lineno++; - *ignore_ptr = 1; - return 0; - - case 'n': - return TARGET_NEWLINE; - - case 't': - return TARGET_TAB; - - case 'r': - return TARGET_CR; - - case 'f': - return TARGET_FF; - - case 'b': - return TARGET_BS; - - case 'a': - if (warn_traditional) - warning ("the meaning of `\\a' varies with -traditional"); - - if (flag_traditional) - return c; - return TARGET_BELL; - - case 'v': -#if 0 /* Vertical tab is present in common usage compilers. */ - if (flag_traditional) - return c; -#endif - return TARGET_VT; - - case 'e': - case 'E': - if (pedantic) - pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c); - return 033; - - case '?': - return c; - - /* `\(', etc, are used at beginning of line to avoid confusing Emacs. */ - case '(': - case '{': - case '[': - /* `\%' is used to prevent SCCS from getting confused. */ - case '%': - if (pedantic) - pedwarn ("non-ANSI escape sequence `\\%c'", c); - return c; - } - if (c >= 040 && c < 0177) - pedwarn ("unknown escape sequence `\\%c'", c); - else - pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c); - return c; -} - -void -yyerror (msgid) - const char *msgid; -{ - const char *string = _(msgid); - - /* We can't print string and character constants well - because the token_buffer contains the result of processing escapes. */ - if (end_of_file) - error ("%s at end of input", string); - else if (token_buffer[0] == 0) - error ("%s at null character", string); - else if (token_buffer[0] == '"') - error ("%s before string constant", string); - else if (token_buffer[0] == '\'') - error ("%s before character constant", string); - else if (token_buffer[0] < 040 || (unsigned char) token_buffer[0] >= 0177) - error ("%s before character 0%o", string, (unsigned char) token_buffer[0]); - else - error ("%s before `%s'", string, token_buffer); -} - -#if 0 - -struct try_type -{ - tree *node_var; - char unsigned_flag; - char long_flag; - char long_long_flag; -}; - -struct try_type type_sequence[] = -{ - { &integer_type_node, 0, 0, 0}, - { &unsigned_type_node, 1, 0, 0}, - { &long_integer_type_node, 0, 1, 0}, - { &long_unsigned_type_node, 1, 1, 0}, - { &long_long_integer_type_node, 0, 1, 1}, - { &long_long_unsigned_type_node, 1, 1, 1} -}; -#endif /* 0 */ - -struct pf_args -{ - /* Input */ - int base; - char * p; - /* I/O */ - int c; - int imag; - tree type; - int conversion_errno; - /* Output */ - REAL_VALUE_TYPE value; -}; - -static void -parse_float (data) - PTR data; -{ - struct pf_args * args = (struct pf_args *) data; - int fflag = 0, lflag = 0; - /* Copy token_buffer now, while it has just the number - and not the suffixes; once we add `f' or `i', - REAL_VALUE_ATOF may not work any more. */ - char *copy = (char *) alloca (args->p - token_buffer + 1); - bcopy (token_buffer, copy, args->p - token_buffer + 1); - - while (1) - { - int lose = 0; - - /* Read the suffixes to choose a data type. */ - switch (args->c) - { - case 'f': case 'F': - if (fflag) - error ("more than one `f' in numeric constant"); - fflag = 1; - break; - - case 'l': case 'L': - if (lflag) - error ("more than one `l' in numeric constant"); - lflag = 1; - break; - - case 'i': case 'I': - if (args->imag) - error ("more than one `i' or `j' in numeric constant"); - else if (pedantic) - pedwarn ("ANSI C forbids imaginary numeric constants"); - args->imag = 1; - break; - - default: - lose = 1; - } - - if (lose) - break; - - if (args->p >= token_buffer + maxtoken - 3) - args->p = extend_token_buffer (args->p); - *(args->p++) = args->c; - *(args->p) = 0; - args->c = GETC(); - } - - /* The second argument, machine_mode, of REAL_VALUE_ATOF - tells the desired precision of the binary result - of decimal-to-binary conversion. */ - - if (fflag) - { - if (lflag) - error ("both `f' and `l' in floating constant"); - - args->type = float_type_node; - errno = 0; - if (args->base == 16) - args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type)); - else - args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type)); - args->conversion_errno = errno; - /* A diagnostic is required here by some ANSI C testsuites. - This is not pedwarn, because some people don't want - an error for this. */ - if (REAL_VALUE_ISINF (args->value) && pedantic) - warning ("floating point number exceeds range of `float'"); - } - else if (lflag) - { - args->type = long_double_type_node; - errno = 0; - if (args->base == 16) - args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type)); - else - args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type)); - args->conversion_errno = errno; - if (REAL_VALUE_ISINF (args->value) && pedantic) - warning ("floating point number exceeds range of `long double'"); - } - else - { - errno = 0; - if (args->base == 16) - args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type)); - else - args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type)); - args->conversion_errno = errno; - if (REAL_VALUE_ISINF (args->value) && pedantic) - warning ("floating point number exceeds range of `double'"); - } -} - -int -yylex () -{ - register int c; - register char *p; - register int value; - int wide_flag = 0; - int objc_flag = 0; - -#if !USE_CPPLIB - if (nextchar >= 0) - c = nextchar, nextchar = -1; - else -#endif - c = GETC(); - - /* Effectively do c = skip_white_space (c) - but do it faster in the usual cases. */ - while (1) - switch (c) - { - case ' ': - case '\t': - case '\f': - case '\v': - case '\b': - c = GETC(); - break; - - case '\r': - /* Call skip_white_space so we can warn if appropriate. */ - - case '\n': - case '/': - case '\\': - c = skip_white_space (c); - default: - goto found_nonwhite; - } - found_nonwhite: - - token_buffer[0] = c; - token_buffer[1] = 0; - -/* yylloc.first_line = lineno; */ - - switch (c) - { - case EOF: - end_of_file = 1; - token_buffer[0] = 0; - value = ENDFILE; - break; - - case 'L': - /* Capital L may start a wide-string or wide-character constant. */ - { - register int c = GETC(); - if (c == '\'') - { - wide_flag = 1; - goto char_constant; - } - if (c == '"') - { - wide_flag = 1; - goto string_constant; - } - UNGETC (c); - } - goto letter; - - case '@': - if (!doing_objc_thang) - { - value = c; - break; - } - else - { - /* '@' may start a constant string object. */ - register int c = GETC (); - if (c == '"') - { - objc_flag = 1; - goto string_constant; - } - UNGETC (c); - /* Fall through to treat '@' as the start of an identifier. */ - } - - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': case 'G': case 'H': case 'I': case 'J': - case 'K': case 'M': case 'N': case 'O': - case 'P': case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': case 'Y': - case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': case 'g': case 'h': case 'i': case 'j': - case 'k': case 'l': case 'm': case 'n': case 'o': - case 'p': case 'q': case 'r': case 's': case 't': - case 'u': case 'v': case 'w': case 'x': case 'y': - case 'z': - case '_': - case '$': - letter: - p = token_buffer; - while (ISALNUM (c) || c == '_' || c == '$' || c == '@') - { - /* Make sure this char really belongs in an identifier. */ - if (c == '$') - { - if (! dollars_in_ident) - error ("`$' in identifier"); - else if (pedantic) - pedwarn ("`$' in identifier"); - } - - if (p >= token_buffer + maxtoken) - p = extend_token_buffer (p); - - *p++ = c; - c = GETC(); - } - - *p = 0; -#if USE_CPPLIB - UNGETC (c); -#else - nextchar = c; -#endif - - value = IDENTIFIER; - yylval.itype = 0; - - /* Try to recognize a keyword. Uses minimum-perfect hash function */ - - { - register struct resword *ptr; - - if ((ptr = is_reserved_word (token_buffer, p - token_buffer))) - { - if (ptr->rid) - yylval.ttype = ridpointers[(int) ptr->rid]; - value = (int) ptr->token; - - /* Only return OBJECTNAME if it is a typedef. */ - if (doing_objc_thang && value == OBJECTNAME) - { - lastiddecl = lookup_name(yylval.ttype); - - if (lastiddecl == NULL_TREE - || TREE_CODE (lastiddecl) != TYPE_DECL) - value = IDENTIFIER; - } - - /* Even if we decided to recognize asm, still perhaps warn. */ - if (pedantic - && (value == ASM_KEYWORD || value == TYPEOF - || ptr->rid == RID_INLINE) - && token_buffer[0] != '_') - pedwarn ("ANSI does not permit the keyword `%s'", - token_buffer); - } - } - - /* If we did not find a keyword, look for an identifier - (or a typename). */ - - if (value == IDENTIFIER) - { - if (token_buffer[0] == '@') - error("invalid identifier `%s'", token_buffer); - - yylval.ttype = get_identifier (token_buffer); - lastiddecl = lookup_name (yylval.ttype); - - if (lastiddecl != 0 && TREE_CODE (lastiddecl) == TYPE_DECL) - value = TYPENAME; - /* A user-invisible read-only initialized variable - should be replaced by its value. - We handle only strings since that's the only case used in C. */ - else if (lastiddecl != 0 && TREE_CODE (lastiddecl) == VAR_DECL - && DECL_IGNORED_P (lastiddecl) - && TREE_READONLY (lastiddecl) - && DECL_INITIAL (lastiddecl) != 0 - && TREE_CODE (DECL_INITIAL (lastiddecl)) == STRING_CST) - { - tree stringval = DECL_INITIAL (lastiddecl); - - /* Copy the string value so that we won't clobber anything - if we put something in the TREE_CHAIN of this one. */ - yylval.ttype = build_string (TREE_STRING_LENGTH (stringval), - TREE_STRING_POINTER (stringval)); - value = STRING; - } - else if (doing_objc_thang) - { - tree objc_interface_decl = is_class_name (yylval.ttype); - - if (objc_interface_decl) - { - value = CLASSNAME; - yylval.ttype = objc_interface_decl; - } - } - } - - break; - - case '0': case '1': - { - int next_c; - /* Check first for common special case: single-digit 0 or 1. */ - - next_c = GETC (); - UNGETC (next_c); /* Always undo this lookahead. */ - if (!ISALNUM (next_c) && next_c != '.') - { - token_buffer[0] = (char)c, token_buffer[1] = '\0'; - yylval.ttype = (c == '0') ? integer_zero_node : integer_one_node; - value = CONSTANT; - break; - } - /*FALLTHRU*/ - } - case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - case '.': - { - int base = 10; - int count = 0; - int largest_digit = 0; - int numdigits = 0; - /* for multi-precision arithmetic, - we actually store only HOST_BITS_PER_CHAR bits in each part. - The number of parts is chosen so as to be sufficient to hold - the enough bits to fit into the two HOST_WIDE_INTs that contain - the integer value (this is always at least as many bits as are - in a target `long long' value, but may be wider). */ -#define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2 + 2) - int parts[TOTAL_PARTS]; - int overflow = 0; - - enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS, AFTER_EXPON} - floatflag = NOT_FLOAT; - - for (count = 0; count < TOTAL_PARTS; count++) - parts[count] = 0; - - p = token_buffer; - *p++ = c; - - if (c == '0') - { - *p++ = (c = GETC()); - if ((c == 'x') || (c == 'X')) - { - base = 16; - *p++ = (c = GETC()); - } - /* Leading 0 forces octal unless the 0 is the only digit. */ - else if (c >= '0' && c <= '9') - { - base = 8; - numdigits++; - } - else - numdigits++; - } - - /* Read all the digits-and-decimal-points. */ - - while (c == '.' - || (ISALNUM (c) && c != 'l' && c != 'L' - && c != 'u' && c != 'U' - && c != 'i' && c != 'I' && c != 'j' && c != 'J' - && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F'))))) - { - if (c == '.') - { - if (base == 16 && pedantic) - error ("floating constant may not be in radix 16"); - if (floatflag == TOO_MANY_POINTS) - /* We have already emitted an error. Don't need another. */ - ; - else if (floatflag == AFTER_POINT || floatflag == AFTER_EXPON) - { - error ("malformed floating constant"); - floatflag = TOO_MANY_POINTS; - /* Avoid another error from atof by forcing all characters - from here on to be ignored. */ - p[-1] = '\0'; - } - else - floatflag = AFTER_POINT; - - if (base == 8) - base = 10; - *p++ = c = GETC(); - /* Accept '.' as the start of a floating-point number - only when it is followed by a digit. - Otherwise, unread the following non-digit - and use the '.' as a structural token. */ - if (p == token_buffer + 2 && !ISDIGIT (c)) - { - if (c == '.') - { - c = GETC(); - if (c == '.') - { - *p++ = c; - *p = 0; - return ELLIPSIS; - } - error ("parse error at `..'"); - } - UNGETC (c); - token_buffer[1] = 0; - value = '.'; - goto done; - } - } - else - { - /* It is not a decimal point. - It should be a digit (perhaps a hex digit). */ - - if (ISDIGIT (c)) - { - c = c - '0'; - } - else if (base <= 10) - { - if (c == 'e' || c == 'E') - { - base = 10; - floatflag = AFTER_EXPON; - break; /* start of exponent */ - } - error ("nondigits in number and not hexadecimal"); - c = 0; - } - else if (base == 16 && (c == 'p' || c == 'P')) - { - floatflag = AFTER_EXPON; - break; /* start of exponent */ - } - else if (c >= 'a') - { - c = c - 'a' + 10; - } - else - { - c = c - 'A' + 10; - } - if (c >= largest_digit) - largest_digit = c; - numdigits++; - - for (count = 0; count < TOTAL_PARTS; count++) - { - parts[count] *= base; - if (count) - { - parts[count] - += (parts[count-1] >> HOST_BITS_PER_CHAR); - parts[count-1] - &= (1 << HOST_BITS_PER_CHAR) - 1; - } - else - parts[0] += c; - } - - /* If the extra highest-order part ever gets anything in it, - the number is certainly too big. */ - if (parts[TOTAL_PARTS - 1] != 0) - overflow = 1; - - if (p >= token_buffer + maxtoken - 3) - p = extend_token_buffer (p); - *p++ = (c = GETC()); - } - } - - if (numdigits == 0) - error ("numeric constant with no digits"); - - if (largest_digit >= base) - error ("numeric constant contains digits beyond the radix"); - - /* Remove terminating char from the token buffer and delimit the string */ - *--p = 0; - - if (floatflag != NOT_FLOAT) - { - tree type = double_type_node; - int imag = 0; - int conversion_errno = 0; - REAL_VALUE_TYPE value; - struct pf_args args; - - /* Read explicit exponent if any, and put it in tokenbuf. */ - - if ((base == 10 && ((c == 'e') || (c == 'E'))) - || (base == 16 && (c == 'p' || c == 'P'))) - { - if (p >= token_buffer + maxtoken - 3) - p = extend_token_buffer (p); - *p++ = c; - c = GETC(); - if ((c == '+') || (c == '-')) - { - *p++ = c; - c = GETC(); - } - /* Exponent is decimal, even if string is a hex float. */ - if (! ISDIGIT (c)) - error ("floating constant exponent has no digits"); - while (ISDIGIT (c)) - { - if (p >= token_buffer + maxtoken - 3) - p = extend_token_buffer (p); - *p++ = c; - c = GETC(); - } - } - if (base == 16 && floatflag != AFTER_EXPON) - error ("hexadecimal floating constant has no exponent"); - - *p = 0; - - /* Setup input for parse_float() */ - args.base = base; - args.p = p; - args.c = c; - args.imag = imag; - args.type = type; - args.conversion_errno = conversion_errno; - - /* Convert string to a double, checking for overflow. */ - if (do_float_handler (parse_float, (PTR) &args)) - { - /* Receive output from parse_float() */ - value = args.value; - } - else - { - /* We got an exception from parse_float() */ - error ("floating constant out of range"); - value = dconst0; - } - - /* Receive output from parse_float() */ - c = args.c; - imag = args.imag; - type = args.type; - conversion_errno = args.conversion_errno; - -#ifdef ERANGE - /* ERANGE is also reported for underflow, - so test the value to distinguish overflow from that. */ - if (conversion_errno == ERANGE && !flag_traditional && pedantic - && (REAL_VALUES_LESS (dconst1, value) - || REAL_VALUES_LESS (value, dconstm1))) - warning ("floating point number exceeds range of `double'"); -#endif - - /* If the result is not a number, assume it must have been - due to some error message above, so silently convert - it to a zero. */ - if (REAL_VALUE_ISNAN (value)) - value = dconst0; - - /* Create a node with determined type and value. */ - if (imag) - yylval.ttype = build_complex (NULL_TREE, - convert (type, integer_zero_node), - build_real (type, value)); - else - yylval.ttype = build_real (type, value); - } - else - { - tree traditional_type, ansi_type, type; - HOST_WIDE_INT high, low; - int spec_unsigned = 0; - int spec_long = 0; - int spec_long_long = 0; - int spec_imag = 0; - int warn, i; - - traditional_type = ansi_type = type = NULL_TREE; - while (1) - { - if (c == 'u' || c == 'U') - { - if (spec_unsigned) - error ("two `u's in integer constant"); - spec_unsigned = 1; - } - else if (c == 'l' || c == 'L') - { - if (spec_long) - { - if (spec_long_long) - error ("three `l's in integer constant"); - else if (pedantic && ! in_system_header && warn_long_long) - pedwarn ("ANSI C forbids long long integer constants"); - spec_long_long = 1; - } - spec_long = 1; - } - else if (c == 'i' || c == 'j' || c == 'I' || c == 'J') - { - if (spec_imag) - error ("more than one `i' or `j' in numeric constant"); - else if (pedantic) - pedwarn ("ANSI C forbids imaginary numeric constants"); - spec_imag = 1; - } - else - break; - if (p >= token_buffer + maxtoken - 3) - p = extend_token_buffer (p); - *p++ = c; - c = GETC(); - } - - /* If it won't fit in the host's representation for integers, - then pedwarn. */ - - warn = overflow; - if (warn) - pedwarn ("integer constant out of range"); - - /* This is simplified by the fact that our constant - is always positive. */ - - high = low = 0; - - for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++) - { - high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT - / HOST_BITS_PER_CHAR)] - << (i * HOST_BITS_PER_CHAR)); - low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR); - } - - yylval.ttype = build_int_2 (low, high); - TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node; - - /* If warn_traditional, calculate both the ANSI type and the - traditional type, then see if they disagree. - Otherwise, calculate only the type for the dialect in use. */ - if (warn_traditional || flag_traditional) - { - /* Calculate the traditional type. */ - /* Traditionally, any constant is signed; - but if unsigned is specified explicitly, obey that. - Use the smallest size with the right number of bits, - except for one special case with decimal constants. */ - if (! spec_long && base != 10 - && int_fits_type_p (yylval.ttype, unsigned_type_node)) - traditional_type = (spec_unsigned ? unsigned_type_node - : integer_type_node); - /* A decimal constant must be long - if it does not fit in type int. - I think this is independent of whether - the constant is signed. */ - else if (! spec_long && base == 10 - && int_fits_type_p (yylval.ttype, integer_type_node)) - traditional_type = (spec_unsigned ? unsigned_type_node - : integer_type_node); - else if (! spec_long_long) - traditional_type = (spec_unsigned ? long_unsigned_type_node - : long_integer_type_node); - else - traditional_type = (spec_unsigned - ? long_long_unsigned_type_node - : long_long_integer_type_node); - } - if (warn_traditional || ! flag_traditional) - { - /* Calculate the ANSI type. */ - if (! spec_long && ! spec_unsigned - && int_fits_type_p (yylval.ttype, integer_type_node)) - ansi_type = integer_type_node; - else if (! spec_long && (base != 10 || spec_unsigned) - && int_fits_type_p (yylval.ttype, unsigned_type_node)) - ansi_type = unsigned_type_node; - else if (! spec_unsigned && !spec_long_long - && int_fits_type_p (yylval.ttype, long_integer_type_node)) - ansi_type = long_integer_type_node; - else if (! spec_long_long - && int_fits_type_p (yylval.ttype, - long_unsigned_type_node)) - ansi_type = long_unsigned_type_node; - else if (! spec_unsigned - && int_fits_type_p (yylval.ttype, - long_long_integer_type_node)) - ansi_type = long_long_integer_type_node; - else - ansi_type = long_long_unsigned_type_node; - } - - type = flag_traditional ? traditional_type : ansi_type; - - if (warn_traditional && traditional_type != ansi_type) - { - if (TYPE_PRECISION (traditional_type) - != TYPE_PRECISION (ansi_type)) - warning ("width of integer constant changes with -traditional"); - else if (TREE_UNSIGNED (traditional_type) - != TREE_UNSIGNED (ansi_type)) - warning ("integer constant is unsigned in ANSI C, signed with -traditional"); - else - warning ("width of integer constant may change on other systems with -traditional"); - } - - if (pedantic && !flag_traditional && !spec_long_long && !warn - && (TYPE_PRECISION (long_integer_type_node) - < TYPE_PRECISION (type))) - { - warn = 1; - pedwarn ("integer constant out of range"); - } - - if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type)) - warning ("decimal constant is so large that it is unsigned"); - - if (spec_imag) - { - if (TYPE_PRECISION (type) - <= TYPE_PRECISION (integer_type_node)) - yylval.ttype - = build_complex (NULL_TREE, integer_zero_node, - convert (integer_type_node, - yylval.ttype)); - else - error ("complex integer constant is too wide for `complex int'"); - } - else if (flag_traditional && !int_fits_type_p (yylval.ttype, type)) - /* The traditional constant 0x80000000 is signed - but doesn't fit in the range of int. - This will change it to -0x80000000, which does fit. */ - { - TREE_TYPE (yylval.ttype) = unsigned_type (type); - yylval.ttype = convert (type, yylval.ttype); - TREE_OVERFLOW (yylval.ttype) - = TREE_CONSTANT_OVERFLOW (yylval.ttype) = 0; - } - else - TREE_TYPE (yylval.ttype) = type; - - - /* If it's still an integer (not a complex), and it doesn't - fit in the type we choose for it, then pedwarn. */ - - if (! warn - && TREE_CODE (TREE_TYPE (yylval.ttype)) == INTEGER_TYPE - && ! int_fits_type_p (yylval.ttype, TREE_TYPE (yylval.ttype))) - pedwarn ("integer constant out of range"); - } - - UNGETC (c); - *p = 0; - - if (ISALNUM (c) || c == '.' || c == '_' || c == '$' - || (!flag_traditional && (c == '-' || c == '+') - && (p[-1] == 'e' || p[-1] == 'E'))) - error ("missing white space after number `%s'", token_buffer); - - value = CONSTANT; break; - } - - case '\'': - char_constant: - { - register int result = 0; - register int num_chars = 0; - int chars_seen = 0; - unsigned width = TYPE_PRECISION (char_type_node); - int max_chars; -#ifdef MULTIBYTE_CHARS - int longest_char = local_mb_cur_max (); - (void) local_mbtowc (NULL_PTR, NULL_PTR, 0); -#endif - - max_chars = TYPE_PRECISION (integer_type_node) / width; - if (wide_flag) - width = WCHAR_TYPE_SIZE; - - while (1) - { - tryagain: - c = GETC(); - - if (c == '\'' || c == EOF) - break; - - ++chars_seen; - if (c == '\\') - { - int ignore = 0; - c = readescape (&ignore); - if (ignore) - goto tryagain; - if (width < HOST_BITS_PER_INT - && (unsigned) c >= ((unsigned)1 << width)) - pedwarn ("escape sequence out of range for character"); -#ifdef MAP_CHARACTER - if (ISPRINT (c)) - c = MAP_CHARACTER (c); -#endif - } - else if (c == '\n') - { - if (pedantic) - pedwarn ("ANSI C forbids newline in character constant"); - lineno++; - } - else - { -#ifdef MULTIBYTE_CHARS - wchar_t wc; - int i; - int char_len = -1; - for (i = 1; i <= longest_char; ++i) - { - if (i > maxtoken - 4) - extend_token_buffer (token_buffer); - - token_buffer[i] = c; - char_len = local_mbtowc (& wc, - token_buffer + 1, - i); - if (char_len != -1) - break; - c = GETC (); - } - if (char_len > 1) - { - /* mbtowc sometimes needs an extra char before accepting */ - if (char_len < i) - UNGETC (c); - if (! wide_flag) - { - /* Merge character into result; ignore excess chars. */ - for (i = 1; i <= char_len; ++i) - { - if (i > max_chars) - break; - if (width < HOST_BITS_PER_INT) - result = (result << width) - | (token_buffer[i] - & ((1 << width) - 1)); - else - result = token_buffer[i]; - } - num_chars += char_len; - goto tryagain; - } - c = wc; - } - else - { - if (char_len == -1) - warning ("Ignoring invalid multibyte character"); - if (wide_flag) - c = wc; -#ifdef MAP_CHARACTER - else - c = MAP_CHARACTER (c); -#endif - } -#else /* ! MULTIBYTE_CHARS */ -#ifdef MAP_CHARACTER - c = MAP_CHARACTER (c); -#endif -#endif /* ! MULTIBYTE_CHARS */ - } - - if (wide_flag) - { - if (chars_seen == 1) /* only keep the first one */ - result = c; - goto tryagain; - } - - /* Merge character into result; ignore excess chars. */ - num_chars += (width / TYPE_PRECISION (char_type_node)); - if (num_chars < max_chars + 1) - { - if (width < HOST_BITS_PER_INT) - result = (result << width) | (c & ((1 << width) - 1)); - else - result = c; - } - } - - if (c != '\'') - error ("malformatted character constant"); - else if (chars_seen == 0) - error ("empty character constant"); - else if (num_chars > max_chars) - { - num_chars = max_chars; - error ("character constant too long"); - } - else if (chars_seen != 1 && ! flag_traditional && warn_multichar) - warning ("multi-character character constant"); - - /* If char type is signed, sign-extend the constant. */ - if (! wide_flag) - { - int num_bits = num_chars * width; - if (num_bits == 0) - /* We already got an error; avoid invalid shift. */ - yylval.ttype = build_int_2 (0, 0); - else if (TREE_UNSIGNED (char_type_node) - || ((result >> (num_bits - 1)) & 1) == 0) - yylval.ttype - = build_int_2 (result & (~(unsigned HOST_WIDE_INT) 0 - >> (HOST_BITS_PER_WIDE_INT - num_bits)), - 0); - else - yylval.ttype - = build_int_2 (result | ~(~(unsigned HOST_WIDE_INT) 0 - >> (HOST_BITS_PER_WIDE_INT - num_bits)), - -1); - TREE_TYPE (yylval.ttype) = integer_type_node; - } - else - { - yylval.ttype = build_int_2 (result, 0); - TREE_TYPE (yylval.ttype) = wchar_type_node; - } - - value = CONSTANT; - break; - } - - case '"': - string_constant: - { - unsigned width = wide_flag ? WCHAR_TYPE_SIZE - : TYPE_PRECISION (char_type_node); -#ifdef MULTIBYTE_CHARS - int longest_char = local_mb_cur_max (); - (void) local_mbtowc (NULL_PTR, NULL_PTR, 0); -#endif - c = GETC (); - p = token_buffer + 1; - - while (c != '"' && c >= 0) - { - if (c == '\\') - { - int ignore = 0; - c = readescape (&ignore); - if (ignore) - goto skipnewline; - if (width < HOST_BITS_PER_INT - && (unsigned) c >= ((unsigned)1 << width)) - pedwarn ("escape sequence out of range for character"); - } - else if (c == '\n') - { - if (pedantic) - pedwarn ("ANSI C forbids newline in string constant"); - lineno++; - } - else - { -#ifdef MULTIBYTE_CHARS - wchar_t wc; - int i; - int char_len = -1; - for (i = 0; i < longest_char; ++i) - { - if (p + i >= token_buffer + maxtoken) - p = extend_token_buffer (p); - p[i] = c; - - char_len = local_mbtowc (& wc, p, i + 1); - if (char_len != -1) - break; - c = GETC (); - } - if (char_len == -1) - warning ("Ignoring invalid multibyte character"); - else - { - /* mbtowc sometimes needs an extra char before accepting */ - if (char_len <= i) - UNGETC (c); - if (! wide_flag) - { - p += (i + 1); - c = GETC (); - continue; - } - c = wc; - } -#endif /* MULTIBYTE_CHARS */ - } - - /* Add this single character into the buffer either as a wchar_t - or as a single byte. */ - if (wide_flag) - { - unsigned width = TYPE_PRECISION (char_type_node); - unsigned bytemask = (1 << width) - 1; - int byte; - - if (p + WCHAR_BYTES > token_buffer + maxtoken) - p = extend_token_buffer (p); - - for (byte = 0; byte < WCHAR_BYTES; ++byte) - { - int value; - if (byte >= (int) sizeof (c)) - value = 0; - else - value = (c >> (byte * width)) & bytemask; - if (BYTES_BIG_ENDIAN) - p[WCHAR_BYTES - byte - 1] = value; - else - p[byte] = value; - } - p += WCHAR_BYTES; - } - else - { - if (p >= token_buffer + maxtoken) - p = extend_token_buffer (p); - *p++ = c; - } - - skipnewline: - c = GETC (); - } - - /* Terminate the string value, either with a single byte zero - or with a wide zero. */ - if (wide_flag) - { - if (p + WCHAR_BYTES > token_buffer + maxtoken) - p = extend_token_buffer (p); - bzero (p, WCHAR_BYTES); - p += WCHAR_BYTES; - } - else - { - if (p >= token_buffer + maxtoken) - p = extend_token_buffer (p); - *p++ = 0; - } - - if (c < 0) - error ("Unterminated string constant"); - - /* We have read the entire constant. - Construct a STRING_CST for the result. */ - - if (wide_flag) - { - yylval.ttype = build_string (p - (token_buffer + 1), - token_buffer + 1); - TREE_TYPE (yylval.ttype) = wchar_array_type_node; - value = STRING; - } - else if (objc_flag) - { - /* Return an Objective-C @"..." constant string object. */ - yylval.ttype = build_objc_string (p - (token_buffer + 1), - token_buffer + 1); - TREE_TYPE (yylval.ttype) = char_array_type_node; - value = OBJC_STRING; - } - else - { - yylval.ttype = build_string (p - (token_buffer + 1), - token_buffer + 1); - TREE_TYPE (yylval.ttype) = char_array_type_node; - value = STRING; - } - - break; - } - - case '+': - case '-': - case '&': - case '|': - case ':': - case '<': - case '>': - case '*': - case '/': - case '%': - case '^': - case '!': - case '=': - { - register int c1; - - combine: - - switch (c) - { - case '+': - yylval.code = PLUS_EXPR; break; - case '-': - yylval.code = MINUS_EXPR; break; - case '&': - yylval.code = BIT_AND_EXPR; break; - case '|': - yylval.code = BIT_IOR_EXPR; break; - case '*': - yylval.code = MULT_EXPR; break; - case '/': - yylval.code = TRUNC_DIV_EXPR; break; - case '%': - yylval.code = TRUNC_MOD_EXPR; break; - case '^': - yylval.code = BIT_XOR_EXPR; break; - case LSHIFT: - yylval.code = LSHIFT_EXPR; break; - case RSHIFT: - yylval.code = RSHIFT_EXPR; break; - case '<': - yylval.code = LT_EXPR; break; - case '>': - yylval.code = GT_EXPR; break; - } - - token_buffer[1] = c1 = GETC(); - token_buffer[2] = 0; - - if (c1 == '=') - { - switch (c) - { - case '<': - value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done; - case '>': - value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done; - case '!': - value = EQCOMPARE; yylval.code = NE_EXPR; goto done; - case '=': - value = EQCOMPARE; yylval.code = EQ_EXPR; goto done; - } - value = ASSIGN; goto done; - } - else if (c == c1) - switch (c) - { - case '+': - value = PLUSPLUS; goto done; - case '-': - value = MINUSMINUS; goto done; - case '&': - value = ANDAND; goto done; - case '|': - value = OROR; goto done; - case '<': - c = LSHIFT; - goto combine; - case '>': - c = RSHIFT; - goto combine; - } - else - switch (c) - { - case '-': - if (c1 == '>') - { value = POINTSAT; goto done; } - break; - case ':': - if (c1 == '>') - { value = ']'; goto done; } - break; - case '<': - if (c1 == '%') - { value = '{'; indent_level++; goto done; } - if (c1 == ':') - { value = '['; goto done; } - break; - case '%': - if (c1 == '>') - { value = '}'; indent_level--; goto done; } - break; - } - UNGETC (c1); - token_buffer[1] = 0; - - if ((c == '<') || (c == '>')) - value = ARITHCOMPARE; - else value = c; - goto done; - } - - case 0: - /* Don't make yyparse think this is eof. */ - value = 1; - break; - - case '{': - indent_level++; - value = c; - break; - - case '}': - indent_level--; - value = c; - break; - - default: - value = c; - } - -done: -/* yylloc.last_line = lineno; */ - - return value; -} - -/* Sets the value of the 'yydebug' variable to VALUE. - This is a function so we don't have to have YYDEBUG defined - in order to build the compiler. */ - -void -set_yydebug (value) - int value; -{ -#if YYDEBUG != 0 - yydebug = value; -#else - warning ("YYDEBUG not defined."); -#endif -} diff --git a/contrib/gcc/c-lex.h b/contrib/gcc/c-lex.h deleted file mode 100644 index 7d73ab5d366b..000000000000 --- a/contrib/gcc/c-lex.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Define constants for communication with c-parse.y. - Copyright (C) 1987, 1992, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - - -enum rid -{ - RID_UNUSED, - RID_INT, - RID_CHAR, - RID_FLOAT, - RID_DOUBLE, - RID_VOID, - RID_UNUSED1, - - RID_UNSIGNED, - RID_SHORT, - RID_LONG, - RID_AUTO, - RID_STATIC, - RID_EXTERN, - RID_REGISTER, - RID_TYPEDEF, - RID_SIGNED, - RID_CONST, - RID_RESTRICT, - RID_VOLATILE, - RID_INLINE, - RID_NOALIAS, - RID_ITERATOR, - RID_COMPLEX, - - RID_IN, - RID_OUT, - RID_INOUT, - RID_BYCOPY, - RID_BYREF, - RID_ONEWAY, - RID_ID, - - RID_MAX -}; - -#define NORID RID_UNUSED - -#define RID_FIRST_MODIFIER RID_UNSIGNED - -/* The elements of `ridpointers' are identifier nodes - for the reserved type names and storage classes. - It is indexed by a RID_... value. */ -extern tree ridpointers[(int) RID_MAX]; - -/* the declaration found for the last IDENTIFIER token read in. - yylex must look this up to detect typedefs, which get token type TYPENAME, - so it is left around in case the identifier is not a typedef but is - used in a context which makes it a reference to a variable. */ -extern tree lastiddecl; - -extern char *token_buffer; /* Pointer to token buffer. */ - -extern tree make_pointer_declarator PROTO((tree, tree)); -extern void reinit_parse_for_function PROTO((void)); -extern void position_after_white_space PROTO((void)); -extern int check_newline PROTO((void)); - -extern int yylex PROTO((void)); -extern void yyerror PROTO((const char *)); - -extern void forget_protocol_qualifiers PROTO((void)); -extern void remember_protocol_qualifiers PROTO((void)); -extern tree is_class_name PROTO((tree)); diff --git a/contrib/gcc/c-parse.gperf b/contrib/gcc/c-parse.gperf deleted file mode 100644 index 888eee9ebe1f..000000000000 --- a/contrib/gcc/c-parse.gperf +++ /dev/null @@ -1,88 +0,0 @@ -%{ -/* Command-line: gperf -L KR-C -F ', 0, 0' -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ -%} -struct resword { const char *name; short token; enum rid rid; }; -%% -@class, CLASS, NORID -@compatibility_alias, ALIAS, NORID -@defs, DEFS, NORID -@encode, ENCODE, NORID -@end, END, NORID -@implementation, IMPLEMENTATION, NORID -@interface, INTERFACE, NORID -@private, PRIVATE, NORID -@protected, PROTECTED, NORID -@protocol, PROTOCOL, NORID -@public, PUBLIC, NORID -@selector, SELECTOR, NORID -__alignof, ALIGNOF, NORID -__alignof__, ALIGNOF, NORID -__asm, ASM_KEYWORD, NORID -__asm__, ASM_KEYWORD, NORID -__attribute, ATTRIBUTE, NORID -__attribute__, ATTRIBUTE, NORID -__complex, TYPESPEC, RID_COMPLEX -__complex__, TYPESPEC, RID_COMPLEX -__const, TYPE_QUAL, RID_CONST -__const__, TYPE_QUAL, RID_CONST -__extension__, EXTENSION, NORID -__imag, IMAGPART, NORID -__imag__, IMAGPART, NORID -__inline, SCSPEC, RID_INLINE -__inline__, SCSPEC, RID_INLINE -__iterator, SCSPEC, RID_ITERATOR -__iterator__, SCSPEC, RID_ITERATOR -__label__, LABEL, NORID -__real, REALPART, NORID -__real__, REALPART, NORID -__restrict, TYPE_QUAL, RID_RESTRICT -__restrict__, TYPE_QUAL, RID_RESTRICT -__signed, TYPESPEC, RID_SIGNED -__signed__, TYPESPEC, RID_SIGNED -__typeof, TYPEOF, NORID -__typeof__, TYPEOF, NORID -__volatile, TYPE_QUAL, RID_VOLATILE -__volatile__, TYPE_QUAL, RID_VOLATILE -asm, ASM_KEYWORD, NORID -auto, SCSPEC, RID_AUTO -break, BREAK, NORID -bycopy, TYPE_QUAL, RID_BYCOPY -byref, TYPE_QUAL, RID_BYREF -case, CASE, NORID -char, TYPESPEC, RID_CHAR -const, TYPE_QUAL, RID_CONST -continue, CONTINUE, NORID -default, DEFAULT, NORID -do, DO, NORID -double, TYPESPEC, RID_DOUBLE -else, ELSE, NORID -enum, ENUM, NORID -extern, SCSPEC, RID_EXTERN -float, TYPESPEC, RID_FLOAT -for, FOR, NORID -goto, GOTO, NORID -id, OBJECTNAME, RID_ID -if, IF, NORID -in, TYPE_QUAL, RID_IN -inout, TYPE_QUAL, RID_INOUT -inline, SCSPEC, RID_INLINE -int, TYPESPEC, RID_INT -long, TYPESPEC, RID_LONG -oneway, TYPE_QUAL, RID_ONEWAY -out, TYPE_QUAL, RID_OUT -register, SCSPEC, RID_REGISTER -restrict, TYPE_QUAL, RID_RESTRICT -return, RETURN, NORID -short, TYPESPEC, RID_SHORT -signed, TYPESPEC, RID_SIGNED -sizeof, SIZEOF, NORID -static, SCSPEC, RID_STATIC -struct, STRUCT, NORID -switch, SWITCH, NORID -typedef, SCSPEC, RID_TYPEDEF -typeof, TYPEOF, NORID -union, UNION, NORID -unsigned, TYPESPEC, RID_UNSIGNED -void, TYPESPEC, RID_VOID -volatile, TYPE_QUAL, RID_VOLATILE -while, WHILE, NORID diff --git a/contrib/gcc/c-parse.in b/contrib/gcc/c-parse.in deleted file mode 100644 index 6757c4d464aa..000000000000 --- a/contrib/gcc/c-parse.in +++ /dev/null @@ -1,3091 +0,0 @@ -/* YACC parser for C syntax and for Objective C. -*-c-*- - Copyright (C) 1987, 88, 89, 92-98, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file defines the grammar of C and that of Objective C. - ifobjc ... end ifobjc conditionals contain code for Objective C only. - ifc ... end ifc conditionals contain code for C only. - Sed commands in Makefile.in are used to convert this file into - c-parse.y and into objc-parse.y. */ - -/* To whomever it may concern: I have heard that such a thing was once - written by AT&T, but I have never seen it. */ - -ifobjc -%expect 66 -end ifobjc -ifc -%expect 51 - -/* These are the 23 conflicts you should get in parse.output; - the state numbers may vary if minor changes in the grammar are made. - -State 42 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTE.) -State 44 contains 1 shift/reduce conflict. (Two ways to recover from error.) -State 103 contains 1 shift/reduce conflict. (Two ways to recover from error.) -State 110 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTE.) -State 111 contains 1 shift/reduce conflict. (Two ways to recover from error.) -State 115 contains 1 shift/reduce conflict. (Two ways to recover from error.) -State 132 contains 1 shift/reduce conflict. (See comment at component_decl.) -State 180 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTE.) -State 194 contains 2 shift/reduce conflict. (Four ways to parse this.) -State 202 contains 1 shift/reduce conflict. (Two ways to recover from error.) -State 214 contains 1 shift/reduce conflict. (Two ways to recover from error.) -State 220 contains 1 shift/reduce conflict. (Two ways to recover from error.) -State 304 contains 2 shift/reduce conflicts. (Four ways to parse this.) -State 335 contains 2 shift/reduce conflicts. (Four ways to parse this.) -State 347 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTES.) -State 352 contains 1 shift/reduce conflict. (Two ways to parse ATTRIBUTES.) -State 383 contains 2 shift/reduce conflicts. (Four ways to parse this.) -State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */ - -end ifc - -%{ -#include "config.h" -#include "system.h" -#include - -#include "tree.h" -#include "input.h" -#include "c-lex.h" -#include "c-tree.h" -#include "flags.h" -#include "output.h" -#include "toplev.h" - -#ifdef MULTIBYTE_CHARS -#include -#endif - -ifobjc -#include "objc-act.h" -end ifobjc - -/* Since parsers are distinct for each language, put the language string - definition here. */ -ifobjc -char *language_string = "GNU Obj-C"; -end ifobjc -ifc -char *language_string = "GNU C"; -end ifc - -/* Like YYERROR but do call yyerror. */ -#define YYERROR1 { yyerror ("syntax error"); YYERROR; } - -/* Cause the `yydebug' variable to be defined. */ -#define YYDEBUG 1 -%} - -%start program - -%union {long itype; tree ttype; enum tree_code code; - char *filename; int lineno; int ends_in_label; } - -/* All identifiers that are not reserved words - and are not declared typedefs in the current block */ -%token IDENTIFIER - -/* All identifiers that are declared typedefs in the current block. - In some contexts, they are treated just like IDENTIFIER, - but they can also serve as typespecs in declarations. */ -%token TYPENAME - -/* Reserved words that specify storage class. - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token SCSPEC - -/* Reserved words that specify type. - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token TYPESPEC - -/* Reserved words that qualify type: "const", "volatile", or "restrict". - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token TYPE_QUAL - -/* Character or numeric constants. - yylval is the node for the constant. */ -%token CONSTANT - -/* String constants in raw form. - yylval is a STRING_CST node. */ -%token STRING - -/* "...", used for functions with variable arglists. */ -%token ELLIPSIS - -/* the reserved words */ -/* SCO include files test "ASM", so use something else. */ -%token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT -%token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF -%token ATTRIBUTE EXTENSION LABEL -%token REALPART IMAGPART - -/* Add precedence rules to solve dangling else s/r conflict */ -%nonassoc IF -%nonassoc ELSE - -/* Define the operator tokens and their precedences. - The value is an integer because, if used, it is the tree code - to use in the expression made from the operator. */ - -%right ASSIGN '=' -%right '?' ':' -%left OROR -%left ANDAND -%left '|' -%left '^' -%left '&' -%left EQCOMPARE -%left ARITHCOMPARE -%left LSHIFT RSHIFT -%left '+' '-' -%left '*' '/' '%' -%right UNARY PLUSPLUS MINUSMINUS -%left HYPERUNARY -%left POINTSAT '.' '(' '[' - -/* The Objective-C keywords. These are included in C and in - Objective C, so that the token codes are the same in both. */ -%token INTERFACE IMPLEMENTATION END SELECTOR DEFS ENCODE -%token CLASSNAME PUBLIC PRIVATE PROTECTED PROTOCOL OBJECTNAME CLASS ALIAS - -/* Objective-C string constants in raw form. - yylval is an OBJC_STRING_CST node. */ -%token OBJC_STRING - - -%type unop - -%type identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist exprlist -%type expr_no_commas cast_expr unary_expr primary string STRING -%type typed_declspecs reserved_declspecs -%type typed_typespecs reserved_typespecquals -%type declmods typespec typespecqual_reserved -%type typed_declspecs_no_prefix_attr reserved_declspecs_no_prefix_attr -%type declmods_no_prefix_attr -%type SCSPEC TYPESPEC TYPE_QUAL nonempty_type_quals maybe_type_qual -%type initdecls notype_initdecls initdcl notype_initdcl -%type init maybeasm -%type asm_operands nonnull_asm_operands asm_operand asm_clobbers -%type maybe_attribute attributes attribute attribute_list attrib -%type any_word - -%type compstmt - -%type declarator -%type notype_declarator after_type_declarator -%type parm_declarator - -%type structsp component_decl_list component_decl_list2 -%type component_decl components component_declarator -%type enumlist enumerator -%type struct_head union_head enum_head -%type typename absdcl absdcl1 type_quals -%type xexpr parms parm identifiers - -%type parmlist parmlist_1 parmlist_2 -%type parmlist_or_identifiers parmlist_or_identifiers_1 -%type identifiers_or_typenames - -%type setspecs - -%type lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label - -%type save_filename -%type save_lineno - -ifobjc -/* the Objective-C nonterminals */ - -%type ivar_decl_list ivar_decls ivar_decl ivars ivar_declarator -%type methoddecl unaryselector keywordselector selector -%type keyworddecl receiver objcmessageexpr messageargs -%type keywordexpr keywordarglist keywordarg -%type myparms myparm optparmlist reservedwords objcselectorexpr -%type selectorarg keywordnamelist keywordname objcencodeexpr -%type objc_string non_empty_protocolrefs protocolrefs identifier_list objcprotocolexpr - -%type CLASSNAME OBJC_STRING OBJECTNAME -end ifobjc - -%{ -/* Number of statements (loosely speaking) and compound statements - seen so far. */ -static int stmt_count; -static int compstmt_count; - -/* Input file and line number of the end of the body of last simple_if; - used by the stmt-rule immediately after simple_if returns. */ -static char *if_stmt_file; -static int if_stmt_line; - -/* List of types and structure classes of the current declaration. */ -static tree current_declspecs = NULL_TREE; -static tree prefix_attributes = NULL_TREE; - -/* Stack of saved values of current_declspecs and prefix_attributes. */ -static tree declspec_stack; - -/* 1 if we explained undeclared var errors. */ -static int undeclared_variable_notice; - -ifobjc -/* Objective-C specific information */ - -tree objc_interface_context; -tree objc_implementation_context; -tree objc_method_context; -tree objc_ivar_chain; -tree objc_ivar_context; -enum tree_code objc_inherit_code; -int objc_receiver_context; -int objc_public_flag; - -end ifobjc - -/* Tell yyparse how to print a token's value, if yydebug is set. */ - -#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL) -extern void yyprint PROTO ((FILE *, int, YYSTYPE)); -%} - -%% -program: /* empty */ - { if (pedantic) - pedwarn ("ANSI C forbids an empty source file"); - finish_file (); - } - | extdefs - { - /* In case there were missing closebraces, - get us back to the global binding level. */ - while (! global_bindings_p ()) - poplevel (0, 0, 0); - finish_file (); - } - ; - -/* the reason for the strange actions in this rule - is so that notype_initdecls when reached via datadef - can find a valid list of type and sc specs in $0. */ - -extdefs: - {$$ = NULL_TREE; } extdef - | extdefs {$$ = NULL_TREE; } extdef - ; - -extdef: - fndef - | datadef -ifobjc - | objcdef -end ifobjc - | ASM_KEYWORD '(' expr ')' ';' - { STRIP_NOPS ($3); - if ((TREE_CODE ($3) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST) - || TREE_CODE ($3) == STRING_CST) - assemble_asm ($3); - else - error ("argument of `asm' is not a constant string"); } - | extension extdef - { pedantic = $1; } - ; - -datadef: - setspecs notype_initdecls ';' - { if (pedantic) - error ("ANSI C forbids data definition with no type or storage class"); - else if (!flag_traditional) - warning ("data definition has no type or storage class"); - - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($1); } - | declmods setspecs notype_initdecls ';' - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | typed_declspecs setspecs initdecls ';' - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | declmods ';' - { pedwarn ("empty declaration"); } - | typed_declspecs ';' - { shadow_tag ($1); } - | error ';' - | error '}' - | ';' - { if (pedantic) - pedwarn ("ANSI C does not allow extra `;' outside of a function"); } - ; - -fndef: - typed_declspecs setspecs declarator - { if (! start_function (current_declspecs, $3, - prefix_attributes, NULL_TREE, 0)) - YYERROR1; - reinit_parse_for_function (); } - old_style_parm_decls - { store_parm_decls (); } - compstmt_or_error - { finish_function (0); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | typed_declspecs setspecs declarator error - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | declmods setspecs notype_declarator - { if (! start_function (current_declspecs, $3, - prefix_attributes, NULL_TREE, 0)) - YYERROR1; - reinit_parse_for_function (); } - old_style_parm_decls - { store_parm_decls (); } - compstmt_or_error - { finish_function (0); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | declmods setspecs notype_declarator error - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | setspecs notype_declarator - { if (! start_function (NULL_TREE, $2, - prefix_attributes, NULL_TREE, 0)) - YYERROR1; - reinit_parse_for_function (); } - old_style_parm_decls - { store_parm_decls (); } - compstmt_or_error - { finish_function (0); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($1); } - | setspecs notype_declarator error - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($1); } - ; - -identifier: - IDENTIFIER - | TYPENAME -ifobjc - | OBJECTNAME - | CLASSNAME -end ifobjc - ; - -unop: '&' - { $$ = ADDR_EXPR; } - | '-' - { $$ = NEGATE_EXPR; } - | '+' - { $$ = CONVERT_EXPR; } - | PLUSPLUS - { $$ = PREINCREMENT_EXPR; } - | MINUSMINUS - { $$ = PREDECREMENT_EXPR; } - | '~' - { $$ = BIT_NOT_EXPR; } - | '!' - { $$ = TRUTH_NOT_EXPR; } - ; - -expr: nonnull_exprlist - { $$ = build_compound_expr ($1); } - ; - -exprlist: - /* empty */ - { $$ = NULL_TREE; } - | nonnull_exprlist - ; - -nonnull_exprlist: - expr_no_commas - { $$ = build_tree_list (NULL_TREE, $1); } - | nonnull_exprlist ',' expr_no_commas - { chainon ($1, build_tree_list (NULL_TREE, $3)); } - ; - -unary_expr: - primary - | '*' cast_expr %prec UNARY - { $$ = build_indirect_ref ($2, "unary *"); } - /* __extension__ turns off -pedantic for following primary. */ - | extension cast_expr %prec UNARY - { $$ = $2; - pedantic = $1; } - | unop cast_expr %prec UNARY - { $$ = build_unary_op ($1, $2, 0); - overflow_warning ($$); } - /* Refer to the address of a label as a pointer. */ - | ANDAND identifier - { tree label = lookup_label ($2); - if (pedantic) - pedwarn ("ANSI C forbids `&&'"); - if (label == 0) - $$ = null_pointer_node; - else - { - TREE_USED (label) = 1; - $$ = build1 (ADDR_EXPR, ptr_type_node, label); - TREE_CONSTANT ($$) = 1; - } - } -/* This seems to be impossible on some machines, so let's turn it off. - You can use __builtin_next_arg to find the anonymous stack args. - | '&' ELLIPSIS - { tree types = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl)); - $$ = error_mark_node; - if (TREE_VALUE (tree_last (types)) == void_type_node) - error ("`&...' used in function with fixed number of arguments"); - else - { - if (pedantic) - pedwarn ("ANSI C forbids `&...'"); - $$ = tree_last (DECL_ARGUMENTS (current_function_decl)); - $$ = build_unary_op (ADDR_EXPR, $$, 0); - } } -*/ - | sizeof unary_expr %prec UNARY - { skip_evaluation--; - if (TREE_CODE ($2) == COMPONENT_REF - && DECL_C_BIT_FIELD (TREE_OPERAND ($2, 1))) - error ("`sizeof' applied to a bit-field"); - $$ = c_sizeof (TREE_TYPE ($2)); } - | sizeof '(' typename ')' %prec HYPERUNARY - { skip_evaluation--; - $$ = c_sizeof (groktypename ($3)); } - | alignof unary_expr %prec UNARY - { skip_evaluation--; - $$ = c_alignof_expr ($2); } - | alignof '(' typename ')' %prec HYPERUNARY - { skip_evaluation--; - $$ = c_alignof (groktypename ($3)); } - | REALPART cast_expr %prec UNARY - { $$ = build_unary_op (REALPART_EXPR, $2, 0); } - | IMAGPART cast_expr %prec UNARY - { $$ = build_unary_op (IMAGPART_EXPR, $2, 0); } - ; - -sizeof: - SIZEOF { skip_evaluation++; } - ; - -alignof: - ALIGNOF { skip_evaluation++; } - ; - -cast_expr: - unary_expr - | '(' typename ')' cast_expr %prec UNARY - { tree type = groktypename ($2); - $$ = build_c_cast (type, $4); } - | '(' typename ')' '{' - { start_init (NULL_TREE, NULL, 0); - $2 = groktypename ($2); - really_start_incremental_init ($2); } - initlist_maybe_comma '}' %prec UNARY - { char *name; - tree result = pop_init_level (0); - tree type = $2; - finish_init (); - - if (pedantic && ! flag_isoc9x) - pedwarn ("ANSI C forbids constructor expressions"); - if (TYPE_NAME (type) != 0) - { - if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) - name = IDENTIFIER_POINTER (TYPE_NAME (type)); - else - name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); - } - else - name = ""; - $$ = result; - if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0) - { - int failure = complete_array_type (type, $$, 1); - if (failure) - abort (); - } - } - ; - -expr_no_commas: - cast_expr - | expr_no_commas '+' expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas '-' expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas '*' expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas '/' expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas '%' expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas LSHIFT expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas RSHIFT expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas ARITHCOMPARE expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas EQCOMPARE expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas '&' expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas '|' expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas '^' expr_no_commas - { $$ = parser_build_binary_op ($2, $1, $3); } - | expr_no_commas ANDAND - { $1 = truthvalue_conversion (default_conversion ($1)); - skip_evaluation += $1 == boolean_false_node; } - expr_no_commas - { skip_evaluation -= $1 == boolean_false_node; - $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); } - | expr_no_commas OROR - { $1 = truthvalue_conversion (default_conversion ($1)); - skip_evaluation += $1 == boolean_true_node; } - expr_no_commas - { skip_evaluation -= $1 == boolean_true_node; - $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); } - | expr_no_commas '?' - { $1 = truthvalue_conversion (default_conversion ($1)); - skip_evaluation += $1 == boolean_false_node; } - expr ':' - { skip_evaluation += (($1 == boolean_true_node) - - ($1 == boolean_false_node)); } - expr_no_commas - { skip_evaluation -= $1 == boolean_true_node; - $$ = build_conditional_expr ($1, $4, $7); } - | expr_no_commas '?' - { if (pedantic) - pedwarn ("ANSI C forbids omitting the middle term of a ?: expression"); - /* Make sure first operand is calculated only once. */ - $2 = save_expr ($1); - $1 = truthvalue_conversion (default_conversion ($2)); - skip_evaluation += $1 == boolean_true_node; } - ':' expr_no_commas - { skip_evaluation -= $1 == boolean_true_node; - $$ = build_conditional_expr ($1, $2, $5); } - | expr_no_commas '=' expr_no_commas - { char class; - $$ = build_modify_expr ($1, NOP_EXPR, $3); - class = TREE_CODE_CLASS (TREE_CODE ($$)); - if (class == 'e' || class == '1' - || class == '2' || class == '<') - C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); - } - | expr_no_commas ASSIGN expr_no_commas - { char class; - $$ = build_modify_expr ($1, $2, $3); - /* This inhibits warnings in truthvalue_conversion. */ - class = TREE_CODE_CLASS (TREE_CODE ($$)); - if (class == 'e' || class == '1' - || class == '2' || class == '<') - C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); - } - ; - -primary: - IDENTIFIER - { - $$ = lastiddecl; - if (!$$ || $$ == error_mark_node) - { - if (yychar == YYEMPTY) - yychar = YYLEX; - if (yychar == '(') - { -ifobjc - tree decl; - - if (objc_receiver_context - && ! (objc_receiver_context - && strcmp (IDENTIFIER_POINTER ($1), "super"))) - /* we have a message to super */ - $$ = get_super_receiver (); - else if (objc_method_context - && (decl = is_ivar (objc_ivar_chain, $1))) - { - if (is_private (decl)) - $$ = error_mark_node; - else - $$ = build_ivar_reference ($1); - } - else -end ifobjc - { - /* Ordinary implicit function declaration. */ - $$ = implicitly_declare ($1); - assemble_external ($$); - TREE_USED ($$) = 1; - } - } - else if (current_function_decl == 0) - { - error ("`%s' undeclared here (not in a function)", - IDENTIFIER_POINTER ($1)); - $$ = error_mark_node; - } - else - { -ifobjc - tree decl; - - if (objc_receiver_context - && ! strcmp (IDENTIFIER_POINTER ($1), "super")) - /* we have a message to super */ - $$ = get_super_receiver (); - else if (objc_method_context - && (decl = is_ivar (objc_ivar_chain, $1))) - { - if (is_private (decl)) - $$ = error_mark_node; - else - $$ = build_ivar_reference ($1); - } - else -end ifobjc - { - if (IDENTIFIER_GLOBAL_VALUE ($1) != error_mark_node - || IDENTIFIER_ERROR_LOCUS ($1) != current_function_decl) - { - error ("`%s' undeclared (first use in this function)", - IDENTIFIER_POINTER ($1)); - - if (! undeclared_variable_notice) - { - error ("(Each undeclared identifier is reported only once"); - error ("for each function it appears in.)"); - undeclared_variable_notice = 1; - } - } - $$ = error_mark_node; - /* Prevent repeated error messages. */ - IDENTIFIER_GLOBAL_VALUE ($1) = error_mark_node; - IDENTIFIER_ERROR_LOCUS ($1) = current_function_decl; - } - } - } - else if (TREE_TYPE ($$) == error_mark_node) - $$ = error_mark_node; - else if (C_DECL_ANTICIPATED ($$)) - { - /* The first time we see a build-in function used, - if it has not been declared. */ - C_DECL_ANTICIPATED ($$) = 0; - if (yychar == YYEMPTY) - yychar = YYLEX; - if (yychar == '(') - { - /* Omit the implicit declaration we - would ordinarily do, so we don't lose - the actual built in type. - But print a diagnostic for the mismatch. */ -ifobjc - if (objc_method_context - && is_ivar (objc_ivar_chain, $1)) - error ("Instance variable `%s' implicitly declared as function", - IDENTIFIER_POINTER (DECL_NAME ($$))); - else -end ifobjc - if (TREE_CODE ($$) != FUNCTION_DECL) - error ("`%s' implicitly declared as function", - IDENTIFIER_POINTER (DECL_NAME ($$))); - else if ((TYPE_MODE (TREE_TYPE (TREE_TYPE ($$))) - != TYPE_MODE (integer_type_node)) - && (TREE_TYPE (TREE_TYPE ($$)) - != void_type_node)) - pedwarn ("type mismatch in implicit declaration for built-in function `%s'", - IDENTIFIER_POINTER (DECL_NAME ($$))); - /* If it really returns void, change that to int. */ - if (TREE_TYPE (TREE_TYPE ($$)) == void_type_node) - TREE_TYPE ($$) - = build_function_type (integer_type_node, - TYPE_ARG_TYPES (TREE_TYPE ($$))); - } - else - pedwarn ("built-in function `%s' used without declaration", - IDENTIFIER_POINTER (DECL_NAME ($$))); - - /* Do what we would ordinarily do when a fn is used. */ - assemble_external ($$); - TREE_USED ($$) = 1; - } - else - { - assemble_external ($$); - TREE_USED ($$) = 1; -ifobjc - /* we have a definition - still check if iVariable */ - - if (!objc_receiver_context - || (objc_receiver_context - && strcmp (IDENTIFIER_POINTER ($1), "super"))) - { - tree decl; - - if (objc_method_context - && (decl = is_ivar (objc_ivar_chain, $1))) - { - if (IDENTIFIER_LOCAL_VALUE ($1)) - warning ("local declaration of `%s' hides instance variable", - IDENTIFIER_POINTER ($1)); - else - { - if (is_private (decl)) - $$ = error_mark_node; - else - $$ = build_ivar_reference ($1); - } - } - } - else /* we have a message to super */ - $$ = get_super_receiver (); -end ifobjc - } - - if (TREE_CODE ($$) == CONST_DECL) - { - $$ = DECL_INITIAL ($$); - /* This is to prevent an enum whose value is 0 - from being considered a null pointer constant. */ - $$ = build1 (NOP_EXPR, TREE_TYPE ($$), $$); - TREE_CONSTANT ($$) = 1; - } - } - | CONSTANT - | string - { $$ = combine_strings ($1); } - | '(' expr ')' - { char class = TREE_CODE_CLASS (TREE_CODE ($2)); - if (class == 'e' || class == '1' - || class == '2' || class == '<') - C_SET_EXP_ORIGINAL_CODE ($2, ERROR_MARK); - $$ = $2; } - | '(' error ')' - { $$ = error_mark_node; } - | '(' - { if (current_function_decl == 0) - { - error ("braced-group within expression allowed only inside a function"); - YYERROR; - } - /* We must force a BLOCK for this level - so that, if it is not expanded later, - there is a way to turn off the entire subtree of blocks - that are contained in it. */ - keep_next_level (); - push_iterator_stack (); - push_label_level (); - $$ = expand_start_stmt_expr (); } - compstmt ')' - { tree rtl_exp; - if (pedantic) - pedwarn ("ANSI C forbids braced-groups within expressions"); - pop_iterator_stack (); - pop_label_level (); - rtl_exp = expand_end_stmt_expr ($2); - /* The statements have side effects, so the group does. */ - TREE_SIDE_EFFECTS (rtl_exp) = 1; - - if (TREE_CODE ($3) == BLOCK) - { - /* Make a BIND_EXPR for the BLOCK already made. */ - $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp), - NULL_TREE, rtl_exp, $3); - /* Remove the block from the tree at this point. - It gets put back at the proper place - when the BIND_EXPR is expanded. */ - delete_block ($3); - } - else - $$ = $3; - } - | primary '(' exprlist ')' %prec '.' - { $$ = build_function_call ($1, $3); } - | primary '[' expr ']' %prec '.' - { $$ = build_array_ref ($1, $3); } - | primary '.' identifier - { -ifobjc - if (doing_objc_thang) - { - if (is_public ($1, $3)) - $$ = build_component_ref ($1, $3); - else - $$ = error_mark_node; - } - else -end ifobjc - $$ = build_component_ref ($1, $3); - } - | primary POINTSAT identifier - { - tree expr = build_indirect_ref ($1, "->"); - -ifobjc - if (doing_objc_thang) - { - if (is_public (expr, $3)) - $$ = build_component_ref (expr, $3); - else - $$ = error_mark_node; - } - else -end ifobjc - $$ = build_component_ref (expr, $3); - } - | primary PLUSPLUS - { $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); } - | primary MINUSMINUS - { $$ = build_unary_op (POSTDECREMENT_EXPR, $1, 0); } -ifobjc - | objcmessageexpr - { $$ = build_message_expr ($1); } - | objcselectorexpr - { $$ = build_selector_expr ($1); } - | objcprotocolexpr - { $$ = build_protocol_expr ($1); } - | objcencodeexpr - { $$ = build_encode_expr ($1); } - | objc_string - { $$ = build_objc_string_object ($1); } -end ifobjc - ; - -/* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */ -string: - STRING - | string STRING - { $$ = chainon ($1, $2); } - ; - -ifobjc -/* Produces an OBJC_STRING_CST with perhaps more OBJC_STRING_CSTs chained - onto it. */ -objc_string: - OBJC_STRING - | objc_string OBJC_STRING - { $$ = chainon ($1, $2); } - ; -end ifobjc - -old_style_parm_decls: - /* empty */ - | datadecls - | datadecls ELLIPSIS - /* ... is used here to indicate a varargs function. */ - { c_mark_varargs (); - if (pedantic) - pedwarn ("ANSI C does not permit use of `varargs.h'"); } - ; - -/* The following are analogous to lineno_decl, decls and decl - except that they do not allow nested functions. - They are used for old-style parm decls. */ -lineno_datadecl: - save_filename save_lineno datadecl - { } - ; - -datadecls: - lineno_datadecl - | errstmt - | datadecls lineno_datadecl - | lineno_datadecl errstmt - ; - -/* We don't allow prefix attributes here because they cause reduce/reduce - conflicts: we can't know whether we're parsing a function decl with - attribute suffix, or function defn with attribute prefix on first old - style parm. */ -datadecl: - typed_declspecs_no_prefix_attr setspecs initdecls ';' - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | declmods_no_prefix_attr setspecs notype_initdecls ';' - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | typed_declspecs_no_prefix_attr ';' - { shadow_tag_warned ($1, 1); - pedwarn ("empty declaration"); } - | declmods_no_prefix_attr ';' - { pedwarn ("empty declaration"); } - ; - -/* This combination which saves a lineno before a decl - is the normal thing to use, rather than decl itself. - This is to avoid shift/reduce conflicts in contexts - where statement labels are allowed. */ -lineno_decl: - save_filename save_lineno decl - { } - ; - -decls: - lineno_decl - | errstmt - | decls lineno_decl - | lineno_decl errstmt - ; - -/* records the type and storage class specs to use for processing - the declarators that follow. - Maintains a stack of outer-level values of current_declspecs, - for the sake of parm declarations nested in function declarators. */ -setspecs: /* empty */ - { $$ = suspend_momentary (); - pending_xref_error (); - declspec_stack = tree_cons (prefix_attributes, - current_declspecs, - declspec_stack); - split_specs_attrs ($0, - ¤t_declspecs, &prefix_attributes); } - ; - -/* ??? Yuck. See after_type_declarator. */ -setattrs: /* empty */ - { prefix_attributes = chainon (prefix_attributes, $0); } - ; - -decl: - typed_declspecs setspecs initdecls ';' - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | declmods setspecs notype_initdecls ';' - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | typed_declspecs setspecs nested_function - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | declmods setspecs notype_nested_function - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | typed_declspecs ';' - { shadow_tag ($1); } - | declmods ';' - { pedwarn ("empty declaration"); } - | extension decl - { pedantic = $1; } - ; - -/* Declspecs which contain at least one type specifier or typedef name. - (Just `const' or `volatile' is not enough.) - A typedef'd name following these is taken as a name to be declared. - Declspecs have a non-NULL TREE_VALUE, attributes do not. */ - -typed_declspecs: - typespec reserved_declspecs - { $$ = tree_cons (NULL_TREE, $1, $2); } - | declmods typespec reserved_declspecs - { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); } - ; - -reserved_declspecs: /* empty */ - { $$ = NULL_TREE; } - | reserved_declspecs typespecqual_reserved - { $$ = tree_cons (NULL_TREE, $2, $1); } - | reserved_declspecs SCSPEC - { if (extra_warnings) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ($2)); - $$ = tree_cons (NULL_TREE, $2, $1); } - | reserved_declspecs attributes - { $$ = tree_cons ($2, NULL_TREE, $1); } - ; - -typed_declspecs_no_prefix_attr: - typespec reserved_declspecs_no_prefix_attr - { $$ = tree_cons (NULL_TREE, $1, $2); } - | declmods_no_prefix_attr typespec reserved_declspecs_no_prefix_attr - { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); } - ; - -reserved_declspecs_no_prefix_attr: - /* empty */ - { $$ = NULL_TREE; } - | reserved_declspecs_no_prefix_attr typespecqual_reserved - { $$ = tree_cons (NULL_TREE, $2, $1); } - | reserved_declspecs_no_prefix_attr SCSPEC - { if (extra_warnings) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ($2)); - $$ = tree_cons (NULL_TREE, $2, $1); } - ; - -/* List of just storage classes, type modifiers, and prefix attributes. - A declaration can start with just this, but then it cannot be used - to redeclare a typedef-name. - Declspecs have a non-NULL TREE_VALUE, attributes do not. */ - -declmods: - declmods_no_prefix_attr - { $$ = $1; } - | attributes - { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); } - | declmods declmods_no_prefix_attr - { $$ = chainon ($2, $1); } - | declmods attributes - { $$ = tree_cons ($2, NULL_TREE, $1); } - ; - -declmods_no_prefix_attr: - TYPE_QUAL - { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); - TREE_STATIC ($$) = 1; } - | SCSPEC - { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); } - | declmods_no_prefix_attr TYPE_QUAL - { $$ = tree_cons (NULL_TREE, $2, $1); - TREE_STATIC ($$) = 1; } - | declmods_no_prefix_attr SCSPEC - { if (extra_warnings && TREE_STATIC ($1)) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ($2)); - $$ = tree_cons (NULL_TREE, $2, $1); - TREE_STATIC ($$) = TREE_STATIC ($1); } - ; - - -/* Used instead of declspecs where storage classes are not allowed - (that is, for typenames and structure components). - Don't accept a typedef-name if anything but a modifier precedes it. */ - -typed_typespecs: - typespec reserved_typespecquals - { $$ = tree_cons (NULL_TREE, $1, $2); } - | nonempty_type_quals typespec reserved_typespecquals - { $$ = chainon ($3, tree_cons (NULL_TREE, $2, $1)); } - ; - -reserved_typespecquals: /* empty */ - { $$ = NULL_TREE; } - | reserved_typespecquals typespecqual_reserved - { $$ = tree_cons (NULL_TREE, $2, $1); } - ; - -/* A typespec (but not a type qualifier). - Once we have seen one of these in a declaration, - if a typedef name appears then it is being redeclared. */ - -typespec: TYPESPEC - | structsp - | TYPENAME - { /* For a typedef name, record the meaning, not the name. - In case of `foo foo, bar;'. */ - $$ = lookup_name ($1); } -ifobjc - | CLASSNAME protocolrefs - { $$ = get_static_reference ($1, $2); } - | OBJECTNAME protocolrefs - { $$ = get_object_reference ($2); } - -/* Make "" equivalent to "id " - - nisse@lysator.liu.se */ - | non_empty_protocolrefs - { $$ = get_object_reference ($1); } -end ifobjc - | TYPEOF '(' expr ')' - { $$ = TREE_TYPE ($3); } - | TYPEOF '(' typename ')' - { $$ = groktypename ($3); } - ; - -/* A typespec that is a reserved word, or a type qualifier. */ - -typespecqual_reserved: TYPESPEC - | TYPE_QUAL - | structsp - ; - -initdecls: - initdcl - | initdecls ',' initdcl - ; - -notype_initdecls: - notype_initdcl - | notype_initdecls ',' initdcl - ; - -maybeasm: - /* empty */ - { $$ = NULL_TREE; } - | ASM_KEYWORD '(' string ')' - { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); - $$ = $3; - } - ; - -initdcl: - declarator maybeasm maybe_attribute '=' - { $$ = start_decl ($1, current_declspecs, 1, - $3, prefix_attributes); - start_init ($$, $2, global_bindings_p ()); } - init -/* Note how the declaration of the variable is in effect while its init is parsed! */ - { finish_init (); - finish_decl ($5, $6, $2); } - | declarator maybeasm maybe_attribute - { tree d = start_decl ($1, current_declspecs, 0, - $3, prefix_attributes); - finish_decl (d, NULL_TREE, $2); - } - ; - -notype_initdcl: - notype_declarator maybeasm maybe_attribute '=' - { $$ = start_decl ($1, current_declspecs, 1, - $3, prefix_attributes); - start_init ($$, $2, global_bindings_p ()); } - init -/* Note how the declaration of the variable is in effect while its init is parsed! */ - { finish_init (); - decl_attributes ($5, $3, prefix_attributes); - finish_decl ($5, $6, $2); } - | notype_declarator maybeasm maybe_attribute - { tree d = start_decl ($1, current_declspecs, 0, - $3, prefix_attributes); - finish_decl (d, NULL_TREE, $2); } - ; -/* the * rules are dummies to accept the Apollo extended syntax - so that the header files compile. */ -maybe_attribute: - /* empty */ - { $$ = NULL_TREE; } - | attributes - { $$ = $1; } - ; - -attributes: - attribute - { $$ = $1; } - | attributes attribute - { $$ = chainon ($1, $2); } - ; - -attribute: - ATTRIBUTE '(' '(' attribute_list ')' ')' - { $$ = $4; } - ; - -attribute_list: - attrib - { $$ = $1; } - | attribute_list ',' attrib - { $$ = chainon ($1, $3); } - ; - -attrib: - /* empty */ - { $$ = NULL_TREE; } - | any_word - { $$ = build_tree_list ($1, NULL_TREE); } - | any_word '(' IDENTIFIER ')' - { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); } - | any_word '(' IDENTIFIER ',' nonnull_exprlist ')' - { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); } - | any_word '(' exprlist ')' - { $$ = build_tree_list ($1, $3); } - ; - -/* This still leaves out most reserved keywords, - shouldn't we include them? */ - -any_word: - identifier - | SCSPEC - | TYPESPEC - | TYPE_QUAL - ; - -/* Initializers. `init' is the entry point. */ - -init: - expr_no_commas - | '{' - { really_start_incremental_init (NULL_TREE); - /* Note that the call to clear_momentary - is in process_init_element. */ - push_momentary (); } - initlist_maybe_comma '}' - { $$ = pop_init_level (0); - if ($$ == error_mark_node - && ! (yychar == STRING || yychar == CONSTANT)) - pop_momentary (); - else - pop_momentary_nofree (); } - - | error - { $$ = error_mark_node; } - ; - -/* `initlist_maybe_comma' is the guts of an initializer in braces. */ -initlist_maybe_comma: - /* empty */ - { if (pedantic) - pedwarn ("ANSI C forbids empty initializer braces"); } - | initlist1 maybecomma - ; - -initlist1: - initelt - | initlist1 ',' initelt - ; - -/* `initelt' is a single element of an initializer. - It may use braces. */ -initelt: - designator_list '=' initval - | designator initval - | identifier ':' - { set_init_label ($1); } - initval - | initval - ; - -initval: - '{' - { push_init_level (0); } - initlist_maybe_comma '}' - { process_init_element (pop_init_level (0)); } - | expr_no_commas - { process_init_element ($1); } - | error - ; - -designator_list: - designator - | designator_list designator - ; - -designator: - '.' identifier - { set_init_label ($2); } - /* These are for labeled elements. The syntax for an array element - initializer conflicts with the syntax for an Objective-C message, - so don't include these productions in the Objective-C grammar. */ -ifc - | '[' expr_no_commas ELLIPSIS expr_no_commas ']' - { set_init_index ($2, $4); } - | '[' expr_no_commas ']' - { set_init_index ($2, NULL_TREE); } -end ifc - ; - -nested_function: - declarator - { push_c_function_context (); - if (! start_function (current_declspecs, $1, - prefix_attributes, NULL_TREE, 1)) - { - pop_c_function_context (); - YYERROR1; - } - reinit_parse_for_function (); } - old_style_parm_decls - { store_parm_decls (); } -/* This used to use compstmt_or_error. - That caused a bug with input `f(g) int g {}', - where the use of YYERROR1 above caused an error - which then was handled by compstmt_or_error. - There followed a repeated execution of that same rule, - which called YYERROR1 again, and so on. */ - compstmt - { finish_function (1); - pop_c_function_context (); } - ; - -notype_nested_function: - notype_declarator - { push_c_function_context (); - if (! start_function (current_declspecs, $1, - prefix_attributes, NULL_TREE, 1)) - { - pop_c_function_context (); - YYERROR1; - } - reinit_parse_for_function (); } - old_style_parm_decls - { store_parm_decls (); } -/* This used to use compstmt_or_error. - That caused a bug with input `f(g) int g {}', - where the use of YYERROR1 above caused an error - which then was handled by compstmt_or_error. - There followed a repeated execution of that same rule, - which called YYERROR1 again, and so on. */ - compstmt - { finish_function (1); - pop_c_function_context (); } - ; - -/* Any kind of declarator (thus, all declarators allowed - after an explicit typespec). */ - -declarator: - after_type_declarator - | notype_declarator - ; - -/* A declarator that is allowed only after an explicit typespec. */ - -after_type_declarator: - '(' after_type_declarator ')' - { $$ = $2; } - | after_type_declarator '(' parmlist_or_identifiers %prec '.' - { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } -/* | after_type_declarator '(' error ')' %prec '.' - { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE); - poplevel (0, 0, 0); } */ - | after_type_declarator '[' expr ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, $3); } - | after_type_declarator '[' ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); } - | '*' type_quals after_type_declarator %prec UNARY - { $$ = make_pointer_declarator ($2, $3); } - /* ??? Yuck. setattrs is a quick hack. We can't use - prefix_attributes because $1 only applies to this - declarator. We assume setspecs has already been done. - setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple - attributes could be recognized here or in `attributes'). */ - | attributes setattrs after_type_declarator - { $$ = $3; } - | TYPENAME -ifobjc - | OBJECTNAME -end ifobjc - ; - -/* Kinds of declarator that can appear in a parameter list - in addition to notype_declarator. This is like after_type_declarator - but does not allow a typedef name in parentheses as an identifier - (because it would conflict with a function with that typedef as arg). */ - -parm_declarator: - parm_declarator '(' parmlist_or_identifiers %prec '.' - { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } -/* | parm_declarator '(' error ')' %prec '.' - { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE); - poplevel (0, 0, 0); } */ -ifc - | parm_declarator '[' '*' ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); - if (! flag_isoc9x) - error ("`[*]' in parameter declaration only allowed in ISO C 9x"); - } -end ifc - | parm_declarator '[' expr ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, $3); } - | parm_declarator '[' ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); } - | '*' type_quals parm_declarator %prec UNARY - { $$ = make_pointer_declarator ($2, $3); } - /* ??? Yuck. setattrs is a quick hack. We can't use - prefix_attributes because $1 only applies to this - declarator. We assume setspecs has already been done. - setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple - attributes could be recognized here or in `attributes'). */ - | attributes setattrs parm_declarator - { $$ = $3; } - | TYPENAME - ; - -/* A declarator allowed whether or not there has been - an explicit typespec. These cannot redeclare a typedef-name. */ - -notype_declarator: - notype_declarator '(' parmlist_or_identifiers %prec '.' - { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } -/* | notype_declarator '(' error ')' %prec '.' - { $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE); - poplevel (0, 0, 0); } */ - | '(' notype_declarator ')' - { $$ = $2; } - | '*' type_quals notype_declarator %prec UNARY - { $$ = make_pointer_declarator ($2, $3); } -ifc - | notype_declarator '[' '*' ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); - if (! flag_isoc9x) - error ("`[*]' in parameter declaration only allowed in ISO C 9x"); - } -end ifc - | notype_declarator '[' expr ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, $3); } - | notype_declarator '[' ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); } - /* ??? Yuck. setattrs is a quick hack. We can't use - prefix_attributes because $1 only applies to this - declarator. We assume setspecs has already been done. - setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple - attributes could be recognized here or in `attributes'). */ - | attributes setattrs notype_declarator - { $$ = $3; } - | IDENTIFIER - ; - -struct_head: - STRUCT - { $$ = NULL_TREE; } - | STRUCT attributes - { $$ = $2; } - ; - -union_head: - UNION - { $$ = NULL_TREE; } - | UNION attributes - { $$ = $2; } - ; - -enum_head: - ENUM - { $$ = NULL_TREE; } - | ENUM attributes - { $$ = $2; } - ; - -structsp: - struct_head identifier '{' - { $$ = start_struct (RECORD_TYPE, $2); - /* Start scope of tag before parsing components. */ - } - component_decl_list '}' maybe_attribute - { $$ = finish_struct ($4, $5, chainon ($1, $7)); } - | struct_head '{' component_decl_list '}' maybe_attribute - { $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE), - $3, chainon ($1, $5)); - } - | struct_head identifier - { $$ = xref_tag (RECORD_TYPE, $2); } - | union_head identifier '{' - { $$ = start_struct (UNION_TYPE, $2); } - component_decl_list '}' maybe_attribute - { $$ = finish_struct ($4, $5, chainon ($1, $7)); } - | union_head '{' component_decl_list '}' maybe_attribute - { $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE), - $3, chainon ($1, $5)); - } - | union_head identifier - { $$ = xref_tag (UNION_TYPE, $2); } - | enum_head identifier '{' - { $3 = suspend_momentary (); - $$ = start_enum ($2); } - enumlist maybecomma_warn '}' maybe_attribute - { $$= finish_enum ($4, nreverse ($5), chainon ($1, $8)); - resume_momentary ($3); } - | enum_head '{' - { $2 = suspend_momentary (); - $$ = start_enum (NULL_TREE); } - enumlist maybecomma_warn '}' maybe_attribute - { $$= finish_enum ($3, nreverse ($4), chainon ($1, $7)); - resume_momentary ($2); } - | enum_head identifier - { $$ = xref_tag (ENUMERAL_TYPE, $2); } - ; - -maybecomma: - /* empty */ - | ',' - ; - -maybecomma_warn: - /* empty */ - | ',' - { if (pedantic && ! flag_isoc9x) - pedwarn ("comma at end of enumerator list"); } - ; - -component_decl_list: - component_decl_list2 - { $$ = $1; } - | component_decl_list2 component_decl - { $$ = chainon ($1, $2); - pedwarn ("no semicolon at end of struct or union"); } - ; - -component_decl_list2: /* empty */ - { $$ = NULL_TREE; } - | component_decl_list2 component_decl ';' - { $$ = chainon ($1, $2); } - | component_decl_list2 ';' - { if (pedantic) - pedwarn ("extra semicolon in struct or union specified"); } -ifobjc - /* foo(sizeof(struct{ @defs(ClassName)})); */ - | DEFS '(' CLASSNAME ')' - { - tree interface = lookup_interface ($3); - - if (interface) - $$ = get_class_ivars (interface); - else - { - error ("Cannot find interface declaration for `%s'", - IDENTIFIER_POINTER ($3)); - $$ = NULL_TREE; - } - } -end ifobjc - ; - -/* There is a shift-reduce conflict here, because `components' may - start with a `typename'. It happens that shifting (the default resolution) - does the right thing, because it treats the `typename' as part of - a `typed_typespecs'. - - It is possible that this same technique would allow the distinction - between `notype_initdecls' and `initdecls' to be eliminated. - But I am being cautious and not trying it. */ - -component_decl: - typed_typespecs setspecs components - { $$ = $3; - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | typed_typespecs - { if (pedantic) - pedwarn ("ANSI C forbids member declarations with no members"); - shadow_tag($1); - $$ = NULL_TREE; } - | nonempty_type_quals setspecs components - { $$ = $3; - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | nonempty_type_quals - { if (pedantic) - pedwarn ("ANSI C forbids member declarations with no members"); - shadow_tag($1); - $$ = NULL_TREE; } - | error - { $$ = NULL_TREE; } - | extension component_decl - { $$ = $2; - pedantic = $1; } - ; - -components: - component_declarator - | components ',' component_declarator - { $$ = chainon ($1, $3); } - ; - -component_declarator: - save_filename save_lineno declarator maybe_attribute - { $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE); - decl_attributes ($$, $4, prefix_attributes); } - | save_filename save_lineno - declarator ':' expr_no_commas maybe_attribute - { $$ = grokfield ($1, $2, $3, current_declspecs, $5); - decl_attributes ($$, $6, prefix_attributes); } - | save_filename save_lineno ':' expr_no_commas maybe_attribute - { $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4); - decl_attributes ($$, $5, prefix_attributes); } - ; - -/* We chain the enumerators in reverse order. - They are put in forward order where enumlist is used. - (The order used to be significant, but no longer is so. - However, we still maintain the order, just to be clean.) */ - -enumlist: - enumerator - | enumlist ',' enumerator - { if ($1 == error_mark_node) - $$ = $1; - else - $$ = chainon ($3, $1); } - | error - { $$ = error_mark_node; } - ; - - -enumerator: - identifier - { $$ = build_enumerator ($1, NULL_TREE); } - | identifier '=' expr_no_commas - { $$ = build_enumerator ($1, $3); } - ; - -typename: - typed_typespecs absdcl - { $$ = build_tree_list ($1, $2); } - | nonempty_type_quals absdcl - { $$ = build_tree_list ($1, $2); } - ; - -absdcl: /* an absolute declarator */ - /* empty */ - { $$ = NULL_TREE; } - | absdcl1 - ; - -nonempty_type_quals: - TYPE_QUAL - { $$ = tree_cons (NULL_TREE, $1, NULL_TREE); } - | nonempty_type_quals TYPE_QUAL - { $$ = tree_cons (NULL_TREE, $2, $1); } - ; - -type_quals: - /* empty */ - { $$ = NULL_TREE; } - | type_quals TYPE_QUAL - { $$ = tree_cons (NULL_TREE, $2, $1); } - ; - -absdcl1: /* a nonempty absolute declarator */ - '(' absdcl1 ')' - { $$ = $2; } - /* `(typedef)1' is `int'. */ - | '*' type_quals absdcl1 %prec UNARY - { $$ = make_pointer_declarator ($2, $3); } - | '*' type_quals %prec UNARY - { $$ = make_pointer_declarator ($2, NULL_TREE); } - | absdcl1 '(' parmlist %prec '.' - { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } - | absdcl1 '[' expr ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, $3); } - | absdcl1 '[' ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $1, NULL_TREE); } - | '(' parmlist %prec '.' - { $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); } - | '[' expr ']' %prec '.' - { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); } - | '[' ']' %prec '.' - { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); } - /* ??? It appears we have to support attributes here, however - using prefix_attributes is wrong. */ - | attributes setattrs absdcl1 - { $$ = $3; } - ; - -/* at least one statement, the first of which parses without error. */ -/* stmts is used only after decls, so an invalid first statement - is actually regarded as an invalid decl and part of the decls. */ - -stmts: - lineno_stmt_or_labels - { - if (pedantic && $1) - pedwarn ("ANSI C forbids label at end of compound statement"); - } - ; - -lineno_stmt_or_labels: - lineno_stmt_or_label - | lineno_stmt_or_labels lineno_stmt_or_label - { $$ = $2; } - | lineno_stmt_or_labels errstmt - { $$ = 0; } - ; - -xstmts: - /* empty */ - | stmts - ; - -errstmt: error ';' - ; - -pushlevel: /* empty */ - { emit_line_note (input_filename, lineno); - pushlevel (0); - clear_last_expr (); - push_momentary (); - expand_start_bindings (0); -ifobjc - if (objc_method_context) - add_objc_decls (); -end ifobjc - } - ; - -/* Read zero or more forward-declarations for labels - that nested functions can jump to. */ -maybe_label_decls: - /* empty */ - | label_decls - { if (pedantic) - pedwarn ("ANSI C forbids label declarations"); } - ; - -label_decls: - label_decl - | label_decls label_decl - ; - -label_decl: - LABEL identifiers_or_typenames ';' - { tree link; - for (link = $2; link; link = TREE_CHAIN (link)) - { - tree label = shadow_label (TREE_VALUE (link)); - C_DECLARED_LABEL_FLAG (label) = 1; - declare_nonlocal_label (label); - } - } - ; - -/* This is the body of a function definition. - It causes syntax errors to ignore to the next openbrace. */ -compstmt_or_error: - compstmt - {} - | error compstmt - ; - -compstmt_start: '{' { compstmt_count++; } - -compstmt: compstmt_start '}' - { $$ = convert (void_type_node, integer_zero_node); } - | compstmt_start pushlevel maybe_label_decls decls xstmts '}' - { emit_line_note (input_filename, lineno); - expand_end_bindings (getdecls (), 1, 0); - $$ = poplevel (1, 1, 0); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); } - | compstmt_start pushlevel maybe_label_decls error '}' - { emit_line_note (input_filename, lineno); - expand_end_bindings (getdecls (), kept_level_p (), 0); - $$ = poplevel (kept_level_p (), 0, 0); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); } - | compstmt_start pushlevel maybe_label_decls stmts '}' - { emit_line_note (input_filename, lineno); - expand_end_bindings (getdecls (), kept_level_p (), 0); - $$ = poplevel (kept_level_p (), 0, 0); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); } - ; - -/* Value is number of statements counted as of the closeparen. */ -simple_if: - if_prefix lineno_labeled_stmt -/* Make sure c_expand_end_cond is run once - for each call to c_expand_start_cond. - Otherwise a crash is likely. */ - | if_prefix error - ; - -if_prefix: - IF '(' expr ')' - { emit_line_note ($-1, $0); - c_expand_start_cond (truthvalue_conversion ($3), 0, - compstmt_count); - $$ = stmt_count; - if_stmt_file = $-1; - if_stmt_line = $0; - position_after_white_space (); } - ; - -/* This is a subroutine of stmt. - It is used twice, once for valid DO statements - and once for catching errors in parsing the end test. */ -do_stmt_start: - DO - { stmt_count++; - compstmt_count++; - emit_line_note ($-1, $0); - /* See comment in `while' alternative, above. */ - emit_nop (); - expand_start_loop_continue_elsewhere (1); - position_after_white_space (); } - lineno_labeled_stmt WHILE - { expand_loop_continue_here (); } - ; - -save_filename: - { $$ = input_filename; } - ; - -save_lineno: - { $$ = lineno; } - ; - -lineno_labeled_stmt: - save_filename save_lineno stmt - { } -/* | save_filename save_lineno error - { } -*/ - | save_filename save_lineno label lineno_labeled_stmt - { } - ; - -lineno_stmt_or_label: - save_filename save_lineno stmt_or_label - { $$ = $3; } - ; - -stmt_or_label: - stmt - { $$ = 0; } - | label - { $$ = 1; } - ; - -/* Parse a single real statement, not including any labels. */ -stmt: - compstmt - { stmt_count++; } - | all_iter_stmt - | expr ';' - { stmt_count++; - emit_line_note ($-1, $0); -/* It appears that this should not be done--that a non-lvalue array - shouldn't get an error if the value isn't used. - Section 3.2.2.1 says that an array lvalue gets converted to a pointer - if it appears as a top-level expression, - but says nothing about non-lvalue arrays. */ -#if 0 - /* Call default_conversion to get an error - on referring to a register array if pedantic. */ - if (TREE_CODE (TREE_TYPE ($1)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE ($1)) == FUNCTION_TYPE) - $1 = default_conversion ($1); -#endif - iterator_expand ($1); - clear_momentary (); } - | simple_if ELSE - { c_expand_start_else (); - $1 = stmt_count; - position_after_white_space (); } - lineno_labeled_stmt - { c_expand_end_cond (); - if (extra_warnings && stmt_count == $1) - warning ("empty body in an else-statement"); } - | simple_if %prec IF - { c_expand_end_cond (); - /* This warning is here instead of in simple_if, because we - do not want a warning if an empty if is followed by an - else statement. Increment stmt_count so we don't - give a second error if this is a nested `if'. */ - if (extra_warnings && stmt_count++ == $1) - warning_with_file_and_line (if_stmt_file, if_stmt_line, - "empty body in an if-statement"); } -/* Make sure c_expand_end_cond is run once - for each call to c_expand_start_cond. - Otherwise a crash is likely. */ - | simple_if ELSE error - { c_expand_end_cond (); } - | WHILE - { stmt_count++; - emit_line_note ($-1, $0); - /* The emit_nop used to come before emit_line_note, - but that made the nop seem like part of the preceding line. - And that was confusing when the preceding line was - inside of an if statement and was not really executed. - I think it ought to work to put the nop after the line number. - We will see. --rms, July 15, 1991. */ - emit_nop (); } - '(' expr ')' - { /* Don't start the loop till we have succeeded - in parsing the end test. This is to make sure - that we end every loop we start. */ - expand_start_loop (1); - emit_line_note (input_filename, lineno); - expand_exit_loop_if_false (NULL_PTR, - truthvalue_conversion ($4)); - position_after_white_space (); } - lineno_labeled_stmt - { expand_end_loop (); } - | do_stmt_start - '(' expr ')' ';' - { emit_line_note (input_filename, lineno); - expand_exit_loop_if_false (NULL_PTR, - truthvalue_conversion ($3)); - expand_end_loop (); - clear_momentary (); } -/* This rule is needed to make sure we end every loop we start. */ - | do_stmt_start error - { expand_end_loop (); - clear_momentary (); } - | FOR - '(' xexpr ';' - { stmt_count++; - emit_line_note ($-1, $0); - /* See comment in `while' alternative, above. */ - emit_nop (); - if ($3) c_expand_expr_stmt ($3); - /* Next step is to call expand_start_loop_continue_elsewhere, - but wait till after we parse the entire for (...). - Otherwise, invalid input might cause us to call that - fn without calling expand_end_loop. */ - } - xexpr ';' - /* Can't emit now; wait till after expand_start_loop... */ - { $7 = lineno; - $$ = input_filename; } - xexpr ')' - { - /* Start the loop. Doing this after parsing - all the expressions ensures we will end the loop. */ - expand_start_loop_continue_elsewhere (1); - /* Emit the end-test, with a line number. */ - emit_line_note ($8, $7); - if ($6) - expand_exit_loop_if_false (NULL_PTR, - truthvalue_conversion ($6)); - /* Don't let the tree nodes for $9 be discarded by - clear_momentary during the parsing of the next stmt. */ - push_momentary (); - $7 = lineno; - $8 = input_filename; - position_after_white_space (); } - lineno_labeled_stmt - { /* Emit the increment expression, with a line number. */ - emit_line_note ($8, $7); - expand_loop_continue_here (); - if ($9) - c_expand_expr_stmt ($9); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); - expand_end_loop (); } - | SWITCH '(' expr ')' - { stmt_count++; - emit_line_note ($-1, $0); - c_expand_start_case ($3); - /* Don't let the tree nodes for $3 be discarded by - clear_momentary during the parsing of the next stmt. */ - push_momentary (); - position_after_white_space (); } - lineno_labeled_stmt - { expand_end_case ($3); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); } - | BREAK ';' - { stmt_count++; - emit_line_note ($-1, $0); - if ( ! expand_exit_something ()) - error ("break statement not within loop or switch"); } - | CONTINUE ';' - { stmt_count++; - emit_line_note ($-1, $0); - if (! expand_continue_loop (NULL_PTR)) - error ("continue statement not within a loop"); } - | RETURN ';' - { stmt_count++; - emit_line_note ($-1, $0); - c_expand_return (NULL_TREE); } - | RETURN expr ';' - { stmt_count++; - emit_line_note ($-1, $0); - c_expand_return ($2); } - | ASM_KEYWORD maybe_type_qual '(' expr ')' ';' - { stmt_count++; - emit_line_note ($-1, $0); - STRIP_NOPS ($4); - if ((TREE_CODE ($4) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND ($4, 0)) == STRING_CST) - || TREE_CODE ($4) == STRING_CST) - expand_asm ($4); - else - error ("argument of `asm' is not a constant string"); } - /* This is the case with just output operands. */ - | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';' - { stmt_count++; - emit_line_note ($-1, $0); - c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE, - $2 == ridpointers[(int)RID_VOLATILE], - input_filename, lineno); } - /* This is the case with input operands as well. */ - | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' asm_operands ')' ';' - { stmt_count++; - emit_line_note ($-1, $0); - c_expand_asm_operands ($4, $6, $8, NULL_TREE, - $2 == ridpointers[(int)RID_VOLATILE], - input_filename, lineno); } - /* This is the case with clobbered registers as well. */ - | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' - asm_operands ':' asm_clobbers ')' ';' - { stmt_count++; - emit_line_note ($-1, $0); - c_expand_asm_operands ($4, $6, $8, $10, - $2 == ridpointers[(int)RID_VOLATILE], - input_filename, lineno); } - | GOTO identifier ';' - { tree decl; - stmt_count++; - emit_line_note ($-1, $0); - decl = lookup_label ($2); - if (decl != 0) - { - TREE_USED (decl) = 1; - expand_goto (decl); - } - } - | GOTO '*' expr ';' - { if (pedantic) - pedwarn ("ANSI C forbids `goto *expr;'"); - stmt_count++; - emit_line_note ($-1, $0); - expand_computed_goto (convert (ptr_type_node, $3)); } - | ';' - ; - -all_iter_stmt: - all_iter_stmt_simple -/* | all_iter_stmt_with_decl */ - ; - -all_iter_stmt_simple: - FOR '(' primary ')' - { - /* The value returned by this action is */ - /* 1 if everything is OK */ - /* 0 in case of error or already bound iterator */ - - $$ = 0; - if (TREE_CODE ($3) != VAR_DECL) - error ("invalid `for (ITERATOR)' syntax"); - else if (! ITERATOR_P ($3)) - error ("`%s' is not an iterator", - IDENTIFIER_POINTER (DECL_NAME ($3))); - else if (ITERATOR_BOUND_P ($3)) - error ("`for (%s)' inside expansion of same iterator", - IDENTIFIER_POINTER (DECL_NAME ($3))); - else - { - $$ = 1; - iterator_for_loop_start ($3); - } - } - lineno_labeled_stmt - { - if ($5) - iterator_for_loop_end ($3); - } - -/* This really should allow any kind of declaration, - for generality. Fix it before turning it back on. - -all_iter_stmt_with_decl: - FOR '(' ITERATOR pushlevel setspecs iterator_spec ')' - { -*/ /* The value returned by this action is */ - /* 1 if everything is OK */ - /* 0 in case of error or already bound iterator */ -/* - iterator_for_loop_start ($6); - } - lineno_labeled_stmt - { - iterator_for_loop_end ($6); - emit_line_note (input_filename, lineno); - expand_end_bindings (getdecls (), 1, 0); - $$ = poplevel (1, 1, 0); - if (yychar == CONSTANT || yychar == STRING) - pop_momentary_nofree (); - else - pop_momentary (); - } -*/ - -/* Any kind of label, including jump labels and case labels. - ANSI C accepts labels only before statements, but we allow them - also at the end of a compound statement. */ - -label: CASE expr_no_commas ':' - { register tree value = check_case_value ($2); - register tree label - = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - - stmt_count++; - - if (value != error_mark_node) - { - tree duplicate; - int success; - - if (pedantic && ! INTEGRAL_TYPE_P (TREE_TYPE (value))) - pedwarn ("label must have integral type in ANSI C"); - - success = pushcase (value, convert_and_check, - label, &duplicate); - - if (success == 1) - error ("case label not within a switch statement"); - else if (success == 2) - { - error ("duplicate case value"); - error_with_decl (duplicate, "this is the first entry for that value"); - } - else if (success == 3) - warning ("case value out of range"); - else if (success == 5) - error ("case label within scope of cleanup or variable array"); - } - position_after_white_space (); } - | CASE expr_no_commas ELLIPSIS expr_no_commas ':' - { register tree value1 = check_case_value ($2); - register tree value2 = check_case_value ($4); - register tree label - = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - - if (pedantic) - pedwarn ("ANSI C forbids case ranges"); - stmt_count++; - - if (value1 != error_mark_node && value2 != error_mark_node) - { - tree duplicate; - int success = pushcase_range (value1, value2, - convert_and_check, label, - &duplicate); - if (success == 1) - error ("case label not within a switch statement"); - else if (success == 2) - { - error ("duplicate case value"); - error_with_decl (duplicate, "this is the first entry for that value"); - } - else if (success == 3) - warning ("case value out of range"); - else if (success == 4) - warning ("empty case range"); - else if (success == 5) - error ("case label within scope of cleanup or variable array"); - } - position_after_white_space (); } - | DEFAULT ':' - { - tree duplicate; - register tree label - = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - int success = pushcase (NULL_TREE, 0, label, &duplicate); - stmt_count++; - if (success == 1) - error ("default label not within a switch statement"); - else if (success == 2) - { - error ("multiple default labels in one switch"); - error_with_decl (duplicate, "this is the first default label"); - } - position_after_white_space (); } - | identifier ':' maybe_attribute - { tree label = define_label (input_filename, lineno, $1); - stmt_count++; - emit_nop (); - if (label) - { - expand_label (label); - decl_attributes (label, $3, NULL_TREE); - } - position_after_white_space (); } - ; - -/* Either a type-qualifier or nothing. First thing in an `asm' statement. */ - -maybe_type_qual: - /* empty */ - { emit_line_note (input_filename, lineno); - $$ = NULL_TREE; } - | TYPE_QUAL - { emit_line_note (input_filename, lineno); } - ; - -xexpr: - /* empty */ - { $$ = NULL_TREE; } - | expr - ; - -/* These are the operands other than the first string and colon - in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */ -asm_operands: /* empty */ - { $$ = NULL_TREE; } - | nonnull_asm_operands - ; - -nonnull_asm_operands: - asm_operand - | nonnull_asm_operands ',' asm_operand - { $$ = chainon ($1, $3); } - ; - -asm_operand: - STRING '(' expr ')' - { $$ = build_tree_list ($1, $3); } - ; - -asm_clobbers: - string - { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE); } - | asm_clobbers ',' string - { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); } - ; - -/* This is what appears inside the parens in a function declarator. - Its value is a list of ..._TYPE nodes. */ -parmlist: - { pushlevel (0); - clear_parm_order (); - declare_parm_level (0); } - parmlist_1 - { $$ = $2; - parmlist_tags_warning (); - poplevel (0, 0, 0); } - ; - -parmlist_1: - parmlist_2 ')' - | parms ';' - { tree parm; - if (pedantic) - pedwarn ("ANSI C forbids forward parameter declarations"); - /* Mark the forward decls as such. */ - for (parm = getdecls (); parm; parm = TREE_CHAIN (parm)) - TREE_ASM_WRITTEN (parm) = 1; - clear_parm_order (); } - parmlist_1 - { $$ = $4; } - | error ')' - { $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); } - ; - -/* This is what appears inside the parens in a function declarator. - Is value is represented in the format that grokdeclarator expects. */ -parmlist_2: /* empty */ - { $$ = get_parm_info (0); } - | ELLIPSIS - { $$ = get_parm_info (0); - /* Gcc used to allow this as an extension. However, it does - not work for all targets, and thus has been disabled. - Also, since func (...) and func () are indistinguishable, - it caused problems with the code in expand_builtin which - tries to verify that BUILT_IN_NEXT_ARG is being used - correctly. */ - error ("ANSI C requires a named argument before `...'"); - } - | parms - { $$ = get_parm_info (1); } - | parms ',' ELLIPSIS - { $$ = get_parm_info (0); } - ; - -parms: - parm - { push_parm_decl ($1); } - | parms ',' parm - { push_parm_decl ($3); } - ; - -/* A single parameter declaration or parameter type name, - as found in a parmlist. */ -parm: - typed_declspecs setspecs parm_declarator maybe_attribute - { $$ = build_tree_list (build_tree_list (current_declspecs, - $3), - build_tree_list (prefix_attributes, - $4)); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | typed_declspecs setspecs notype_declarator maybe_attribute - { $$ = build_tree_list (build_tree_list (current_declspecs, - $3), - build_tree_list (prefix_attributes, - $4)); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | typed_declspecs setspecs absdcl maybe_attribute - { $$ = build_tree_list (build_tree_list (current_declspecs, - $3), - build_tree_list (prefix_attributes, - $4)); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | declmods setspecs notype_declarator maybe_attribute - { $$ = build_tree_list (build_tree_list (current_declspecs, - $3), - build_tree_list (prefix_attributes, - $4)); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - - | declmods setspecs absdcl maybe_attribute - { $$ = build_tree_list (build_tree_list (current_declspecs, - $3), - build_tree_list (prefix_attributes, - $4)); - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - ; - -/* This is used in a function definition - where either a parmlist or an identifier list is ok. - Its value is a list of ..._TYPE nodes or a list of identifiers. */ -parmlist_or_identifiers: - { pushlevel (0); - clear_parm_order (); - declare_parm_level (1); } - parmlist_or_identifiers_1 - { $$ = $2; - parmlist_tags_warning (); - poplevel (0, 0, 0); } - ; - -parmlist_or_identifiers_1: - parmlist_1 - | identifiers ')' - { tree t; - for (t = $1; t; t = TREE_CHAIN (t)) - if (TREE_VALUE (t) == NULL_TREE) - error ("`...' in old-style identifier list"); - $$ = tree_cons (NULL_TREE, NULL_TREE, $1); } - ; - -/* A nonempty list of identifiers. */ -identifiers: - IDENTIFIER - { $$ = build_tree_list (NULL_TREE, $1); } - | identifiers ',' IDENTIFIER - { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); } - ; - -/* A nonempty list of identifiers, including typenames. */ -identifiers_or_typenames: - identifier - { $$ = build_tree_list (NULL_TREE, $1); } - | identifiers_or_typenames ',' identifier - { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); } - ; - -extension: - EXTENSION - { $$ = pedantic; - pedantic = 0; } - ; - -ifobjc -/* Objective-C productions. */ - -objcdef: - classdef - | classdecl - | aliasdecl - | protocoldef - | methoddef - | END - { - if (objc_implementation_context) - { - finish_class (objc_implementation_context); - objc_ivar_chain = NULL_TREE; - objc_implementation_context = NULL_TREE; - } - else - warning ("`@end' must appear in an implementation context"); - } - ; - -/* A nonempty list of identifiers. */ -identifier_list: - identifier - { $$ = build_tree_list (NULL_TREE, $1); } - | identifier_list ',' identifier - { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); } - ; - -classdecl: - CLASS identifier_list ';' - { - objc_declare_class ($2); - } - -aliasdecl: - ALIAS identifier identifier ';' - { - objc_declare_alias ($2, $3); - } - -classdef: - INTERFACE identifier protocolrefs '{' - { - objc_interface_context = objc_ivar_context - = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3); - objc_public_flag = 0; - } - ivar_decl_list '}' - { - continue_class (objc_interface_context); - } - methodprotolist - END - { - finish_class (objc_interface_context); - objc_interface_context = NULL_TREE; - } - - | INTERFACE identifier protocolrefs - { - objc_interface_context - = start_class (CLASS_INTERFACE_TYPE, $2, NULL_TREE, $3); - continue_class (objc_interface_context); - } - methodprotolist - END - { - finish_class (objc_interface_context); - objc_interface_context = NULL_TREE; - } - - | INTERFACE identifier ':' identifier protocolrefs '{' - { - objc_interface_context = objc_ivar_context - = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5); - objc_public_flag = 0; - } - ivar_decl_list '}' - { - continue_class (objc_interface_context); - } - methodprotolist - END - { - finish_class (objc_interface_context); - objc_interface_context = NULL_TREE; - } - - | INTERFACE identifier ':' identifier protocolrefs - { - objc_interface_context - = start_class (CLASS_INTERFACE_TYPE, $2, $4, $5); - continue_class (objc_interface_context); - } - methodprotolist - END - { - finish_class (objc_interface_context); - objc_interface_context = NULL_TREE; - } - - | IMPLEMENTATION identifier '{' - { - objc_implementation_context = objc_ivar_context - = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE); - objc_public_flag = 0; - } - ivar_decl_list '}' - { - objc_ivar_chain - = continue_class (objc_implementation_context); - } - - | IMPLEMENTATION identifier - { - objc_implementation_context - = start_class (CLASS_IMPLEMENTATION_TYPE, $2, NULL_TREE, NULL_TREE); - objc_ivar_chain - = continue_class (objc_implementation_context); - } - - | IMPLEMENTATION identifier ':' identifier '{' - { - objc_implementation_context = objc_ivar_context - = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE); - objc_public_flag = 0; - } - ivar_decl_list '}' - { - objc_ivar_chain - = continue_class (objc_implementation_context); - } - - | IMPLEMENTATION identifier ':' identifier - { - objc_implementation_context - = start_class (CLASS_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE); - objc_ivar_chain - = continue_class (objc_implementation_context); - } - - | INTERFACE identifier '(' identifier ')' protocolrefs - { - objc_interface_context - = start_class (CATEGORY_INTERFACE_TYPE, $2, $4, $6); - continue_class (objc_interface_context); - } - methodprotolist - END - { - finish_class (objc_interface_context); - objc_interface_context = NULL_TREE; - } - - | IMPLEMENTATION identifier '(' identifier ')' - { - objc_implementation_context - = start_class (CATEGORY_IMPLEMENTATION_TYPE, $2, $4, NULL_TREE); - objc_ivar_chain - = continue_class (objc_implementation_context); - } - ; - -protocoldef: - PROTOCOL identifier protocolrefs - { - remember_protocol_qualifiers (); - objc_interface_context - = start_protocol(PROTOCOL_INTERFACE_TYPE, $2, $3); - } - methodprotolist END - { - forget_protocol_qualifiers(); - finish_protocol(objc_interface_context); - objc_interface_context = NULL_TREE; - } - ; - -protocolrefs: - /* empty */ - { - $$ = NULL_TREE; - } - | non_empty_protocolrefs - ; - -non_empty_protocolrefs: - ARITHCOMPARE identifier_list ARITHCOMPARE - { - if ($1 == LT_EXPR && $3 == GT_EXPR) - $$ = $2; - else - YYERROR1; - } - ; - -ivar_decl_list: - ivar_decl_list visibility_spec ivar_decls - | ivar_decls - ; - -visibility_spec: - PRIVATE { objc_public_flag = 2; } - | PROTECTED { objc_public_flag = 0; } - | PUBLIC { objc_public_flag = 1; } - ; - -ivar_decls: - /* empty */ - { - $$ = NULL_TREE; - } - | ivar_decls ivar_decl ';' - | ivar_decls ';' - { - if (pedantic) - pedwarn ("extra semicolon in struct or union specified"); - } - ; - - -/* There is a shift-reduce conflict here, because `components' may - start with a `typename'. It happens that shifting (the default resolution) - does the right thing, because it treats the `typename' as part of - a `typed_typespecs'. - - It is possible that this same technique would allow the distinction - between `notype_initdecls' and `initdecls' to be eliminated. - But I am being cautious and not trying it. */ - -ivar_decl: - typed_typespecs setspecs ivars - { $$ = $3; - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | nonempty_type_quals setspecs ivars - { $$ = $3; - current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | error - { $$ = NULL_TREE; } - ; - -ivars: - /* empty */ - { $$ = NULL_TREE; } - | ivar_declarator - | ivars ',' ivar_declarator - ; - -ivar_declarator: - declarator - { - $$ = add_instance_variable (objc_ivar_context, - objc_public_flag, - $1, current_declspecs, - NULL_TREE); - } - | declarator ':' expr_no_commas - { - $$ = add_instance_variable (objc_ivar_context, - objc_public_flag, - $1, current_declspecs, $3); - } - | ':' expr_no_commas - { - $$ = add_instance_variable (objc_ivar_context, - objc_public_flag, - NULL_TREE, - current_declspecs, $2); - } - ; - -methoddef: - '+' - { - remember_protocol_qualifiers (); - if (objc_implementation_context) - objc_inherit_code = CLASS_METHOD_DECL; - else - fatal ("method definition not in class context"); - } - methoddecl - { - forget_protocol_qualifiers (); - add_class_method (objc_implementation_context, $3); - start_method_def ($3); - objc_method_context = $3; - } - optarglist - { - continue_method_def (); - } - compstmt_or_error - { - finish_method_def (); - objc_method_context = NULL_TREE; - } - - | '-' - { - remember_protocol_qualifiers (); - if (objc_implementation_context) - objc_inherit_code = INSTANCE_METHOD_DECL; - else - fatal ("method definition not in class context"); - } - methoddecl - { - forget_protocol_qualifiers (); - add_instance_method (objc_implementation_context, $3); - start_method_def ($3); - objc_method_context = $3; - } - optarglist - { - continue_method_def (); - } - compstmt_or_error - { - finish_method_def (); - objc_method_context = NULL_TREE; - } - ; - -/* the reason for the strange actions in this rule - is so that notype_initdecls when reached via datadef - can find a valid list of type and sc specs in $0. */ - -methodprotolist: - /* empty */ - | {$$ = NULL_TREE; } methodprotolist2 - ; - -methodprotolist2: /* eliminates a shift/reduce conflict */ - methodproto - | datadef - | methodprotolist2 methodproto - | methodprotolist2 {$$ = NULL_TREE; } datadef - ; - -semi_or_error: - ';' - | error - ; - -methodproto: - '+' - { - /* Remember protocol qualifiers in prototypes. */ - remember_protocol_qualifiers (); - objc_inherit_code = CLASS_METHOD_DECL; - } - methoddecl - { - /* Forget protocol qualifiers here. */ - forget_protocol_qualifiers (); - add_class_method (objc_interface_context, $3); - } - semi_or_error - - | '-' - { - /* Remember protocol qualifiers in prototypes. */ - remember_protocol_qualifiers (); - objc_inherit_code = INSTANCE_METHOD_DECL; - } - methoddecl - { - /* Forget protocol qualifiers here. */ - forget_protocol_qualifiers (); - add_instance_method (objc_interface_context, $3); - } - semi_or_error - ; - -methoddecl: - '(' typename ')' unaryselector - { - $$ = build_method_decl (objc_inherit_code, $2, $4, NULL_TREE); - } - - | unaryselector - { - $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, NULL_TREE); - } - - | '(' typename ')' keywordselector optparmlist - { - $$ = build_method_decl (objc_inherit_code, $2, $4, $5); - } - - | keywordselector optparmlist - { - $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, $2); - } - ; - -/* "optarglist" assumes that start_method_def has already been called... - if it is not, the "xdecls" will not be placed in the proper scope */ - -optarglist: - /* empty */ - | ';' myxdecls - ; - -/* to get around the following situation: "int foo (int a) int b; {}" that - is synthesized when parsing "- a:a b:b; id c; id d; { ... }" */ - -myxdecls: - /* empty */ - | mydecls - ; - -mydecls: - mydecl - | errstmt - | mydecls mydecl - | mydecl errstmt - ; - -mydecl: - typed_declspecs setspecs myparms ';' - { current_declspecs = TREE_VALUE (declspec_stack); - prefix_attributes = TREE_PURPOSE (declspec_stack); - declspec_stack = TREE_CHAIN (declspec_stack); - resume_momentary ($2); } - | typed_declspecs ';' - { shadow_tag ($1); } - | declmods ';' - { pedwarn ("empty declaration"); } - ; - -myparms: - myparm - { push_parm_decl ($1); } - | myparms ',' myparm - { push_parm_decl ($3); } - ; - -/* A single parameter declaration or parameter type name, - as found in a parmlist. DOES NOT ALLOW AN INITIALIZER OR ASMSPEC */ - -myparm: - parm_declarator maybe_attribute - { $$ = build_tree_list (build_tree_list (current_declspecs, - $1), - build_tree_list (prefix_attributes, - $2)); } - | notype_declarator maybe_attribute - { $$ = build_tree_list (build_tree_list (current_declspecs, - $1), - build_tree_list (prefix_attributes, - $2)); } - | absdcl maybe_attribute - { $$ = build_tree_list (build_tree_list (current_declspecs, - $1), - build_tree_list (prefix_attributes, - $2)); } - ; - -optparmlist: - /* empty */ - { - $$ = NULL_TREE; - } - | ',' ELLIPSIS - { - /* oh what a kludge! */ - $$ = (tree)1; - } - | ',' - { - pushlevel (0); - } - parmlist_2 - { - /* returns a tree list node generated by get_parm_info */ - $$ = $3; - poplevel (0, 0, 0); - } - ; - -unaryselector: - selector - ; - -keywordselector: - keyworddecl - - | keywordselector keyworddecl - { - $$ = chainon ($1, $2); - } - ; - -selector: - IDENTIFIER - | TYPENAME - | OBJECTNAME - | reservedwords - ; - -reservedwords: - ENUM { $$ = get_identifier (token_buffer); } - | STRUCT { $$ = get_identifier (token_buffer); } - | UNION { $$ = get_identifier (token_buffer); } - | IF { $$ = get_identifier (token_buffer); } - | ELSE { $$ = get_identifier (token_buffer); } - | WHILE { $$ = get_identifier (token_buffer); } - | DO { $$ = get_identifier (token_buffer); } - | FOR { $$ = get_identifier (token_buffer); } - | SWITCH { $$ = get_identifier (token_buffer); } - | CASE { $$ = get_identifier (token_buffer); } - | DEFAULT { $$ = get_identifier (token_buffer); } - | BREAK { $$ = get_identifier (token_buffer); } - | CONTINUE { $$ = get_identifier (token_buffer); } - | RETURN { $$ = get_identifier (token_buffer); } - | GOTO { $$ = get_identifier (token_buffer); } - | ASM_KEYWORD { $$ = get_identifier (token_buffer); } - | SIZEOF { $$ = get_identifier (token_buffer); } - | TYPEOF { $$ = get_identifier (token_buffer); } - | ALIGNOF { $$ = get_identifier (token_buffer); } - | TYPESPEC | TYPE_QUAL - ; - -keyworddecl: - selector ':' '(' typename ')' identifier - { - $$ = build_keyword_decl ($1, $4, $6); - } - - | selector ':' identifier - { - $$ = build_keyword_decl ($1, NULL_TREE, $3); - } - - | ':' '(' typename ')' identifier - { - $$ = build_keyword_decl (NULL_TREE, $3, $5); - } - - | ':' identifier - { - $$ = build_keyword_decl (NULL_TREE, NULL_TREE, $2); - } - ; - -messageargs: - selector - | keywordarglist - ; - -keywordarglist: - keywordarg - | keywordarglist keywordarg - { - $$ = chainon ($1, $2); - } - ; - - -keywordexpr: - nonnull_exprlist - { - if (TREE_CHAIN ($1) == NULL_TREE) - /* just return the expr., remove a level of indirection */ - $$ = TREE_VALUE ($1); - else - /* we have a comma expr., we will collapse later */ - $$ = $1; - } - ; - -keywordarg: - selector ':' keywordexpr - { - $$ = build_tree_list ($1, $3); - } - | ':' keywordexpr - { - $$ = build_tree_list (NULL_TREE, $2); - } - ; - -receiver: - expr - | CLASSNAME - { - $$ = get_class_reference ($1); - } - ; - -objcmessageexpr: - '[' - { objc_receiver_context = 1; } - receiver - { objc_receiver_context = 0; } - messageargs ']' - { - $$ = build_tree_list ($3, $5); - } - ; - -selectorarg: - selector - | keywordnamelist - ; - -keywordnamelist: - keywordname - | keywordnamelist keywordname - { - $$ = chainon ($1, $2); - } - ; - -keywordname: - selector ':' - { - $$ = build_tree_list ($1, NULL_TREE); - } - | ':' - { - $$ = build_tree_list (NULL_TREE, NULL_TREE); - } - ; - -objcselectorexpr: - SELECTOR '(' selectorarg ')' - { - $$ = $3; - } - ; - -objcprotocolexpr: - PROTOCOL '(' identifier ')' - { - $$ = $3; - } - ; - -/* extension to support C-structures in the archiver */ - -objcencodeexpr: - ENCODE '(' typename ')' - { - $$ = groktypename ($3); - } - ; - -end ifobjc -%% diff --git a/contrib/gcc/c-pragma.c b/contrib/gcc/c-pragma.c deleted file mode 100644 index 5aa8d9f2870f..000000000000 --- a/contrib/gcc/c-pragma.c +++ /dev/null @@ -1,500 +0,0 @@ -/* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack. - Copyright (C) 1992, 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "tree.h" -#include "except.h" -#include "function.h" -#include "defaults.h" -#include "c-pragma.h" -#include "flags.h" -#include "toplev.h" - -#ifdef HANDLE_GENERIC_PRAGMAS - -#ifdef HANDLE_PRAGMA_PACK -/* When structure field packing is in effect, this variable is the - number of bits to use as the maximum alignment. When packing is not - in effect, this is zero. */ - -extern int maximum_field_alignment; -#endif - - -#ifdef HANDLE_PRAGMA_PACK_PUSH_POP -typedef struct align_stack -{ - int alignment; - unsigned int num_pushes; - tree id; - struct align_stack * prev; -} align_stack; - -static struct align_stack * alignment_stack = NULL; - -static int push_alignment PROTO((int, tree)); -static int pop_alignment PROTO((tree)); - -/* Push an alignment value onto the stack. */ -static int -push_alignment (alignment, id) - int alignment; - tree id; -{ - switch (alignment) - { - case 0: - case 1: - case 2: - case 4: - case 8: - case 16: - break; - default: - warning ("\ -Alignment must be a small power of two, not %d, in #pragma pack", - alignment); - return 0; - } - - if (alignment_stack == NULL - || alignment_stack->alignment != alignment - || id != NULL_TREE) - { - align_stack * entry; - - entry = (align_stack *) xmalloc (sizeof (* entry)); - - if (entry == NULL) - { - warning ("Out of memory pushing #pragma pack"); - return 0; - } - - entry->alignment = alignment; - entry->num_pushes = 1; - entry->id = id; - entry->prev = alignment_stack; - - alignment_stack = entry; - - maximum_field_alignment = alignment * 8; - } - else - alignment_stack->num_pushes ++; - - return 1; -} - -/* Undo a push of an alignment onto the stack. */ -static int -pop_alignment (id) - tree id; -{ - align_stack * entry; - - if (alignment_stack == NULL) - { - warning ("\ -#pragma pack (pop) encountered without matching #pragma pack (push, )" - ); - return 0; - } - - /* If we got an identifier, strip away everything above the target - entry so that the next step will restore the state just below it. */ - if (id) - { - for (entry = alignment_stack; entry; entry = entry->prev) - if (entry->id == id) - { - entry->num_pushes = 1; - alignment_stack = entry; - break; - } - if (entry == NULL) - warning ("\ -#pragma pack(pop, %s) encountered without matching #pragma pack(push, %s, )" - , IDENTIFIER_POINTER (id), IDENTIFIER_POINTER (id)); - } - - if (-- alignment_stack->num_pushes == 0) - { - entry = alignment_stack->prev; - - if (entry == NULL) - maximum_field_alignment = 0; - else - maximum_field_alignment = entry->alignment * 8; - - free (alignment_stack); - - alignment_stack = entry; - } - - return 1; -} - -/* Generate 'packed' and 'aligned' attributes for decls whilst a - #pragma pack(push... is in effect. */ -void -insert_pack_attributes (node, attributes, prefix) - tree node; - tree * attributes; - tree * prefix; -{ - tree a; - int field_alignment; - - /* If we are not packing, then there is nothing to do. */ - if (maximum_field_alignment == 0 - || alignment_stack == NULL) - return; - - /* We are only interested in fields. */ - if (TREE_CODE_CLASS (TREE_CODE (node)) != 'd' - || TREE_CODE (node) != FIELD_DECL) - return; - - field_alignment = TYPE_ALIGN (TREE_TYPE (node)); - if (field_alignment <= 0 || field_alignment > maximum_field_alignment) - field_alignment = maximum_field_alignment; - - /* Add a 'packed' attribute. */ - * attributes = tree_cons (get_identifier ("packed"), NULL, * attributes); - - /* If the alignment is > 8 then add an alignment attribute as well. */ - if (field_alignment > 8) - { - /* If the aligned attribute is already present then do not override it. */ - for (a = * attributes; a; a = TREE_CHAIN (a)) - { - tree name = TREE_PURPOSE (a); - if (strcmp (IDENTIFIER_POINTER (name), "aligned") == 0) - break; - } - - if (a == NULL) - for (a = * prefix; a; a = TREE_CHAIN (a)) - { - tree name = TREE_PURPOSE (a); - if (strcmp (IDENTIFIER_POINTER (name), "aligned") == 0) - break; - } - - if (a == NULL) - { - * attributes = tree_cons - (get_identifier ("aligned"), - tree_cons (NULL, - build_int_2 (field_alignment / 8, 0), - NULL), - * attributes); - } - } - - return; -} -#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */ - -/* Handle one token of a pragma directive. TOKEN is the current token, and - STRING is its printable form. Some front ends do not support generating - tokens, and will only pass in a STRING. Also some front ends will reuse - the buffer containing STRING, so it must be copied to a local buffer if - it needs to be preserved. - - If STRING is non-NULL, then the return value will be ignored, and there - will be futher calls to handle_pragma_token() in order to handle the rest of - the line containing the #pragma directive. If STRING is NULL, the entire - line has now been presented to handle_pragma_token() and the return value - should be zero if the pragma flawed in some way, or if the pragma was not - recognised, and non-zero if it was successfully handled. */ - -int -handle_pragma_token (string, token) - const char * string; - tree token; -{ - static enum pragma_state state = ps_start; - static enum pragma_state type; - static char * name; - static char * value; - static int align; - static tree id; - - /* If we have reached the end of the #pragma directive then - determine what value we should return. */ - - if (string == NULL) - { - int ret_val = 0; - - switch (type) - { - default: - abort (); - break; - - case ps_done: - /* The pragma was not recognised. */ - break; - -#ifdef HANDLE_PRAGMA_PACK - case ps_pack: - if (state == ps_right) - { - maximum_field_alignment = align * 8; - ret_val = 1; - } - else - warning ("malformed `#pragma pack'"); - break; -#endif /* HANDLE_PRAGMA_PACK */ - -#ifdef HANDLE_PRAGMA_PACK_PUSH_POP - case ps_push: - if (state == ps_right) - ret_val = push_alignment (align, id); - else - warning ("malformed '#pragma pack(push[,id],)'"); - break; - - case ps_pop: - if (state == ps_right) - ret_val = pop_alignment (id); - else - warning ("malformed '#pragma pack(pop[,id])'"); - break; -#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */ - -#ifdef HANDLE_PRAGMA_WEAK - case ps_weak: - if (HANDLE_PRAGMA_WEAK) - { - if (state == ps_name) - ret_val = add_weak (name, NULL); - else if (state == ps_value) - ret_val = add_weak (name, value); - else - warning ("malformed `#pragma weak'"); - } - else - ret_val = 1; /* Ignore the pragma. */ - break; -#endif /* HANDLE_PRAGMA_WEAK */ - } - - type = state = ps_start; - id = NULL_TREE; - - return ret_val; - } - - /* If we have been given a token, but it is not an identifier, - or a small constant, then something has gone wrong. */ - if (token) - { - switch (TREE_CODE (token)) - { - case IDENTIFIER_NODE: - break; - - case INTEGER_CST: - if (TREE_INT_CST_HIGH (token) != 0) - return 0; - break; - - default: - return 0; - } - } - - switch (state) - { - case ps_start: - type = state = ps_done; -#ifdef HANDLE_PRAGMA_PACK - if (strcmp (string, "pack") == 0) - type = state = ps_pack; -#endif -#ifdef HANDLE_PRAGMA_WEAK - if (strcmp (string, "weak") == 0) - type = state = ps_weak; -#endif - break; - -#ifdef HANDLE_PRAGMA_WEAK - case ps_weak: - name = permalloc (strlen (string) + 1); - if (name == NULL) - { - warning ("Out of memory parsing #pragma weak"); - state = ps_bad; - } - else - { - strcpy (name, string); - state = ps_name; - } - break; - - case ps_name: - state = (strcmp (string, "=") ? ps_bad : ps_equals); - break; - - case ps_equals: - value = permalloc (strlen (string) + 1); - if (value == NULL) - { - warning ("Out of memory parsing #pragma weak"); - state = ps_bad; - } - else - { - strcpy (value, string); - state = ps_value; - } - break; - - case ps_value: - state = ps_bad; - break; -#endif /* HANDLE_PRAGMA_WEAK */ - -#ifdef HANDLE_PRAGMA_PACK - case ps_pack: - state = (strcmp (string, "(") ? ps_bad : ps_left); - break; - - case ps_left: - - if (token == NULL_TREE) - { - /* #pragma pack () resets packing rules to their - defaults. */ - if (strcmp (string, ")") == 0) - { - align = 0; - state = ps_right; - } - else - state = ps_bad; - } - else if (TREE_CODE (token) == INTEGER_CST) - goto handle_align; - -#ifdef HANDLE_PRAGMA_PACK_PUSH_POP - else if (TREE_CODE (token) == IDENTIFIER_NODE) - { - if (strcmp (string, "push") == 0) - type = state = ps_push; - else if (strcmp (string, "pop") == 0) - type = state = ps_pop; - else - state = ps_bad; - } -#endif - else - state = ps_bad; - break; - - handle_align: - align = TREE_INT_CST_LOW (token); - switch (align) - { - case 1: - case 2: - case 4: - case 8: - case 16: - state = ps_align; - break; - - default: - state = ps_bad; - break; - } - break; - - case ps_align: - state = (strcmp (string, ")") ? ps_bad : ps_right); - break; - - case ps_right: - state = ps_bad; - break; -#endif /* HANDLE_PRAGMA_PACK */ - -#ifdef HANDLE_PRAGMA_PACK_PUSH_POP - case ps_push: - state = (strcmp (string, ",") ? ps_bad : ps_pushcomma); - break; - - case ps_pushid: - state = (strcmp (string, ",") ? ps_bad : ps_pushcomma2); - break; - - case ps_pushcomma: - if (token && TREE_CODE (token) == IDENTIFIER_NODE) - { - id = token; - state = ps_pushid; - break; - } - - /* else fall through */ - case ps_pushcomma2: - if (token && TREE_CODE (token) == INTEGER_CST) - goto handle_align; - else - state = ps_bad; - break; - - case ps_pop: - if (strcmp (string, ",") == 0) - state = ps_popcomma; - else - state = (strcmp (string, ")") ? ps_bad : ps_right); - break; - - case ps_popcomma: - if (token && TREE_CODE (token) == IDENTIFIER_NODE) - { - id = token; - state = ps_align; - } - else - state = ps_bad; - break; -#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */ - - case ps_bad: - case ps_done: - break; - - default: - abort (); - } - - return 1; -} -#endif /* HANDLE_GENERIC_PRAGMAS */ diff --git a/contrib/gcc/c-pragma.h b/contrib/gcc/c-pragma.h deleted file mode 100644 index f94ee9fe6c50..000000000000 --- a/contrib/gcc/c-pragma.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Pragma related interfaces. - Copyright (C) 1995, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef _C_PRAGMA_H -#define _C_PRAGMA_H - -#ifdef HANDLE_SYSV_PRAGMA -/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_DEF are - defined. */ -#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF) -#define HANDLE_PRAGMA_WEAK SUPPORTS_WEAK -#endif - -/* We always support #pragma pack for SYSV pragmas. */ -#ifndef HANDLE_PRAGMA_PACK -#define HANDLE_PRAGMA_PACK 1 -#endif -#endif /* HANDLE_SYSV_PRAGMA */ - - -#ifdef HANDLE_PRAGMA_PACK_PUSH_POP -/* If we are supporting #pragma pack(push... then we automatically - support #pragma pack() */ -#define HANDLE_PRAGMA_PACK 1 -#define PRAGMA_INSERT_ATTRIBUTES(node, pattr, prefix_attr) \ - insert_pack_attributes (node, pattr, prefix_attr) -extern void insert_pack_attributes PROTO((tree, tree *, tree *)); -#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */ - - -#ifdef HANDLE_PRAGMA_WEAK -/* This structure contains any weak symbol declarations waiting to be emitted. */ -struct weak_syms -{ - struct weak_syms * next; - char * name; - char * value; -}; - -/* Declared in varasm.c */ -extern struct weak_syms * weak_decls; - -extern int add_weak PROTO((char *, char *)); -#endif /* HANDLE_PRAGMA_WEAK */ - - -#if defined HANDLE_PRAGMA_PACK || defined HANDLE_PRAGMA_WEAK -/* Define HANDLE_GENERIC_PRAGMAS if any kind of front-end pragma - parsing is to be done. The code in GCC's generic C source files - will only look for the definition of this constant. They will - ignore definitions of HANDLE_PRAGMA_PACK and so on. */ -#define HANDLE_GENERIC_PRAGMAS 1 -#endif - - -#ifdef HANDLE_GENERIC_PRAGMAS -enum pragma_state -{ - ps_start, - ps_done, -#ifdef HANDLE_PRAGMA_WEAK - ps_weak, - ps_name, - ps_equals, - ps_value, -#endif -#ifdef HANDLE_PRAGMA_PACK - ps_pack, - ps_left, - ps_align, - ps_right, -#endif -#ifdef HANDLE_PRAGMA_PACK_PUSH_POP - ps_push, ps_pushcomma, ps_pushid, ps_pushcomma2, - ps_pop, ps_popcomma, -#endif - ps_bad -}; - -/* Handle a C style pragma */ -extern int handle_pragma_token PROTO((const char *, tree)); - -#endif /* HANDLE_GENERIC_PRAGMAS */ -#endif /* _C_PRAGMA_H */ diff --git a/contrib/gcc/c-tree.h b/contrib/gcc/c-tree.h deleted file mode 100644 index bcf325b68fdd..000000000000 --- a/contrib/gcc/c-tree.h +++ /dev/null @@ -1,554 +0,0 @@ -/* Definitions for C parsing and type checking. - Copyright (C) 1987, 93, 94, 95, 97, 98, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef _C_TREE_H -#define _C_TREE_H - -/* Language-dependent contents of an identifier. */ - -/* The limbo_value is used for block level extern declarations, which need - to be type checked against subsequent extern declarations. They can't - be referenced after they fall out of scope, so they can't be global. */ - -struct lang_identifier -{ - struct tree_identifier ignore; - tree global_value, local_value, label_value, implicit_decl; - tree error_locus, limbo_value; -}; - -/* Macros for access to language-specific slots in an identifier. */ -/* Each of these slots contains a DECL node or null. */ - -/* This represents the value which the identifier has in the - file-scope namespace. */ -#define IDENTIFIER_GLOBAL_VALUE(NODE) \ - (((struct lang_identifier *) (NODE))->global_value) -/* This represents the value which the identifier has in the current - scope. */ -#define IDENTIFIER_LOCAL_VALUE(NODE) \ - (((struct lang_identifier *) (NODE))->local_value) -/* This represents the value which the identifier has as a label in - the current label scope. */ -#define IDENTIFIER_LABEL_VALUE(NODE) \ - (((struct lang_identifier *) (NODE))->label_value) -/* This records the extern decl of this identifier, if it has had one - at any point in this compilation. */ -#define IDENTIFIER_LIMBO_VALUE(NODE) \ - (((struct lang_identifier *) (NODE))->limbo_value) -/* This records the implicit function decl of this identifier, if it - has had one at any point in this compilation. */ -#define IDENTIFIER_IMPLICIT_DECL(NODE) \ - (((struct lang_identifier *) (NODE))->implicit_decl) -/* This is the last function in which we printed an "undefined variable" - message for this identifier. Value is a FUNCTION_DECL or null. */ -#define IDENTIFIER_ERROR_LOCUS(NODE) \ - (((struct lang_identifier *) (NODE))->error_locus) - -/* In identifiers, C uses the following fields in a special way: - TREE_PUBLIC to record that there was a previous local extern decl. - TREE_USED to record that such a decl was used. - TREE_ADDRESSABLE to record that the address of such a decl was used. */ - -/* Nonzero means reject anything that ANSI standard C forbids. */ -extern int pedantic; - -/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ -#define C_TYPE_FIELDS_READONLY(type) TREE_LANG_FLAG_1 (type) - -/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile. */ -#define C_TYPE_FIELDS_VOLATILE(type) TREE_LANG_FLAG_2 (type) - -/* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE - nonzero if the definition of the type has already started. */ -#define C_TYPE_BEING_DEFINED(type) TYPE_LANG_FLAG_0 (type) - -/* C types are partitioned into three subsets: object, function, and - incomplete types. */ -#define C_TYPE_OBJECT_P(type) \ - (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type)) - -#define C_TYPE_FUNCTION_P(type) \ - (TREE_CODE (type) == FUNCTION_TYPE) - -#define C_TYPE_INCOMPLETE_P(type) \ - (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type) == 0) - -/* For convenience we define a single macro to identify the class of - object or incomplete types. */ -#define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \ - (!C_TYPE_FUNCTION_P (type)) - -/* In a RECORD_TYPE, a sorted array of the fields of the type. */ -struct lang_type -{ - int len; - tree elts[1]; -}; - -/* Mark which labels are explicitly declared. - These may be shadowed, and may be referenced from nested functions. */ -#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label) - -/* Record whether a type or decl was written with nonconstant size. - Note that TYPE_SIZE may have simplified to a constant. */ -#define C_TYPE_VARIABLE_SIZE(type) TYPE_LANG_FLAG_1 (type) -#define C_DECL_VARIABLE_SIZE(type) DECL_LANG_FLAG_0 (type) - -/* Record in each node resulting from a binary operator - what operator was specified for it. */ -#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp)) - -#if 0 /* Not used. */ -/* Record whether a decl for a function or function pointer has - already been mentioned (in a warning) because it was called - but didn't have a prototype. */ -#define C_MISSING_PROTOTYPE_WARNED(decl) DECL_LANG_FLAG_2(decl) -#endif - -/* Store a value in that field. */ -#define C_SET_EXP_ORIGINAL_CODE(exp, code) \ - (TREE_COMPLEXITY (exp) = (int) (code)) - -/* Record whether a typedef for type `int' was actually `signed int'. */ -#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp)) - -/* Nonzero for a declaration of a built in function if there has been no - occasion that would declare the function in ordinary C. - Using the function draws a pedantic warning in this case. */ -#define C_DECL_ANTICIPATED(exp) DECL_LANG_FLAG_3 ((exp)) - -/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as - TYPE_ARG_TYPES for functions with prototypes, but created for functions - without prototypes. */ -#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_NONCOPIED_PARTS (NODE) - -/* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */ -#define DECL_C_BIT_FIELD(NODE) DECL_LANG_FLAG_4 (NODE) - -/* Nonzero if the type T promotes to itself. - ANSI C states explicitly the list of types that promote; - in particular, short promotes to int even if they have the same width. */ -#define C_PROMOTING_INTEGER_TYPE_P(t) \ - (TREE_CODE ((t)) == INTEGER_TYPE \ - && (TYPE_MAIN_VARIANT (t) == char_type_node \ - || TYPE_MAIN_VARIANT (t) == signed_char_type_node \ - || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \ - || TYPE_MAIN_VARIANT (t) == short_integer_type_node \ - || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node)) - -/* In a VAR_DECL, means the variable is really an iterator. */ -#define ITERATOR_P(D) (DECL_LANG_FLAG_4(D)) - -/* In a VAR_DECL for an iterator, means we are within - an explicit loop over that iterator. */ -#define ITERATOR_BOUND_P(NODE) ((NODE)->common.readonly_flag) - -/* in c-lang.c and objc-act.c */ -extern tree lookup_interface PROTO((tree)); -extern tree is_class_name PROTO((tree)); -extern void maybe_objc_check_decl PROTO((tree)); -extern void finish_file PROTO((void)); -extern int maybe_objc_comptypes PROTO((tree, tree, int)); -extern tree maybe_building_objc_message_expr PROTO((void)); -extern tree maybe_objc_method_name PROTO((tree)); -extern int recognize_objc_keyword PROTO((void)); -extern tree build_objc_string PROTO((int, const char *)); - -/* in c-aux-info.c */ -extern void gen_aux_info_record PROTO((tree, int, int, int)); - -/* in c-common.c */ -extern void declare_function_name PROTO((void)); -extern void decl_attributes PROTO((tree, tree, tree)); -extern void init_function_format_info PROTO((void)); -extern void check_function_format PROTO((tree, tree, tree)); -extern int c_get_alias_set PROTO((tree)); -extern void c_apply_type_quals_to_decl PROTO((int, tree)); -/* Print an error message for invalid operands to arith operation CODE. - NOP_EXPR is used as a special case (see truthvalue_conversion). */ -extern void binary_op_error PROTO((enum tree_code)); -extern void c_expand_expr_stmt PROTO((tree)); -extern void c_expand_start_cond PROTO((tree, int, int)); -extern void c_expand_start_else PROTO((void)); -extern void c_expand_end_cond PROTO((void)); -/* Validate the expression after `case' and apply default promotions. */ -extern tree check_case_value PROTO((tree)); -/* Concatenate a list of STRING_CST nodes into one STRING_CST. */ -extern tree combine_strings PROTO((tree)); -extern void constant_expression_warning PROTO((tree)); -extern tree convert_and_check PROTO((tree, tree)); -extern void overflow_warning PROTO((tree)); -extern void unsigned_conversion_warning PROTO((tree, tree)); -/* Read the rest of the current #-directive line. */ -#if USE_CPPLIB -extern char *get_directive_line PROTO((void)); -#define GET_DIRECTIVE_LINE() get_directive_line () -#else -extern char *get_directive_line PROTO((FILE *)); -#define GET_DIRECTIVE_LINE() get_directive_line (finput) -#endif - -/* Subroutine of build_binary_op, used for comparison operations. - See if the operands have both been converted from subword integer types - and, if so, perhaps change them both back to their original type. */ -extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *)); -/* Prepare expr to be an argument of a TRUTH_NOT_EXPR, - or validate its data type for an `if' or `while' statement or ?..: exp. */ -extern tree truthvalue_conversion PROTO((tree)); -extern tree type_for_mode PROTO((enum machine_mode, int)); -extern tree type_for_size PROTO((unsigned, int)); - -/* in c-convert.c */ -extern tree convert PROTO((tree, tree)); - -/* in c-decl.c */ -/* Standard named or nameless data types of the C compiler. */ -extern tree char_array_type_node; -extern tree char_type_node; -extern tree const_ptr_type_node; -extern tree const_string_type_node; -extern tree default_function_type; -extern tree double_ftype_double; -extern tree double_ftype_double_double; -extern tree double_type_node; -extern tree float_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -extern tree intTI_type_node; -#endif -extern tree intDI_type_node; -extern tree intHI_type_node; -extern tree intQI_type_node; -extern tree intSI_type_node; -extern tree int_array_type_node; -extern tree int_ftype_cptr_cptr_sizet; -extern tree int_ftype_int; -extern tree int_ftype_ptr_ptr_int; -extern tree int_ftype_string_string; -extern tree integer_type_node; -extern tree long_double_type_node; -extern tree long_ftype_long; -extern tree long_integer_type_node; -extern tree long_long_integer_type_node; -extern tree long_long_unsigned_type_node; -extern tree long_unsigned_type_node; -extern tree complex_integer_type_node; -extern tree complex_float_type_node; -extern tree complex_double_type_node; -extern tree complex_long_double_type_node; -extern tree ptr_type_node; -extern tree ptrdiff_type_node; -extern tree short_integer_type_node; -extern tree short_unsigned_type_node; -extern tree signed_char_type_node; -extern tree signed_wchar_type_node; -extern tree string_ftype_ptr_ptr; -extern tree string_type_node; -extern tree unsigned_char_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -extern tree unsigned_intTI_type_node; -#endif -extern tree unsigned_intDI_type_node; -extern tree unsigned_intHI_type_node; -extern tree unsigned_intQI_type_node; -extern tree unsigned_intSI_type_node; -extern tree unsigned_type_node; -extern tree unsigned_wchar_type_node; -extern tree void_ftype_ptr_int_int; -extern tree void_ftype_ptr_ptr_int; -extern tree void_type_node; -extern tree wchar_array_type_node; -extern tree wchar_type_node; -extern tree boolean_type_node; -extern tree boolean_true_node; -extern tree boolean_false_node; - -extern tree build_enumerator PROTO((tree, tree)); -/* Declare a predefined function. Return the declaration. */ -extern tree builtin_function PROTO((const char *, tree, enum built_in_function function_, const char *)); -/* Add qualifiers to a type, in the fashion for C. */ -extern tree c_build_qualified_type PROTO((tree, int)); -#define c_build_type_variant(TYPE, CONST_P, VOLATILE_P) \ - c_build_qualified_type (TYPE, \ - ((CONST_P) ? TYPE_QUAL_CONST : 0) | \ - ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0)) -extern int c_decode_option PROTO((int, char **)); -extern void c_mark_varargs PROTO((void)); -extern tree check_identifier PROTO((tree, tree)); -extern void clear_parm_order PROTO((void)); -extern tree combine_parm_decls PROTO((tree, tree, int)); -extern int complete_array_type PROTO((tree, tree, int)); -extern void declare_parm_level PROTO((int)); -extern tree define_label PROTO((char *, int, tree)); -extern void delete_block PROTO((tree)); -extern void finish_decl PROTO((tree, tree, tree)); -extern void finish_decl_top_level PROTO((tree, tree, tree)); -extern tree finish_enum PROTO((tree, tree, tree)); -extern void finish_function PROTO((int)); -extern tree finish_struct PROTO((tree, tree, tree)); -extern tree get_parm_info PROTO((int)); -extern tree getdecls PROTO((void)); -extern tree gettags PROTO((void)); -extern int global_bindings_p PROTO((void)); -extern tree grokfield PROTO((const char *, int, tree, tree, tree)); -extern tree groktypename PROTO((tree)); -extern tree groktypename_in_parm_context PROTO((tree)); -extern tree implicitly_declare PROTO((tree)); -extern int in_parm_level_p PROTO((void)); -extern void init_decl_processing PROTO((void)); -extern void insert_block PROTO((tree)); -extern void keep_next_level PROTO((void)); -extern int kept_level_p PROTO((void)); -extern tree lookup_label PROTO((tree)); -extern tree lookup_name PROTO((tree)); -extern tree lookup_name_current_level PROTO((tree)); -extern tree lookup_name_current_level_global PROTO((tree)); -extern tree maybe_build_cleanup PROTO((tree)); -extern void parmlist_tags_warning PROTO((void)); -extern void pending_xref_error PROTO((void)); -extern void pop_c_function_context PROTO((void)); -extern void pop_label_level PROTO((void)); -extern tree poplevel PROTO((int, int, int)); -extern void print_lang_decl PROTO((FILE *, tree, int)); -extern void print_lang_identifier PROTO((FILE *, tree, int)); -extern void print_lang_type PROTO((FILE *, tree, int)); -extern void push_c_function_context PROTO((void)); -extern void push_label_level PROTO((void)); -extern void push_parm_decl PROTO((tree)); -extern tree pushdecl PROTO((tree)); -extern tree pushdecl_top_level PROTO((tree)); -extern void pushlevel PROTO((int)); -extern void pushtag PROTO((tree, tree)); -extern void set_block PROTO((tree)); -extern tree shadow_label PROTO((tree)); -extern void shadow_record_fields PROTO((tree)); -extern void shadow_tag PROTO((tree)); -extern void shadow_tag_warned PROTO((tree, int)); -extern tree start_enum PROTO((tree)); -extern int start_function PROTO((tree, tree, tree, - tree, int)); -extern tree start_decl PROTO((tree, tree, int, - tree, tree)); -extern tree start_struct PROTO((enum tree_code, tree)); -extern void store_parm_decls PROTO((void)); -extern tree xref_tag PROTO((enum tree_code, tree)); - -/* in c-typeck.c */ -extern tree require_complete_type PROTO((tree)); -extern void incomplete_type_error PROTO((tree, tree)); -/* Given two integer or real types, return the type for their sum. - Given two compatible ANSI C types, returns the merged type. */ -extern tree common_type PROTO((tree, tree)); -extern int comptypes PROTO((tree, tree)); -extern int self_promoting_args_p PROTO((tree)); -extern tree c_sizeof PROTO((tree)); -extern tree c_sizeof_nowarn PROTO((tree)); -extern tree c_size_in_bytes PROTO((tree)); -extern tree c_alignof PROTO((tree)); -extern tree c_alignof_expr PROTO((tree)); -extern tree default_conversion PROTO((tree)); -extern tree build_component_ref PROTO((tree, tree)); -extern tree build_indirect_ref PROTO((tree, const char *)); -extern tree build_array_ref PROTO((tree, tree)); -extern tree build_function_call PROTO((tree, tree)); -extern tree parser_build_binary_op PROTO((enum tree_code, - tree, tree)); -extern tree build_binary_op PROTO((enum tree_code, - tree, tree, int)); -extern tree build_unary_op PROTO((enum tree_code, - tree, int)); -extern int lvalue_p PROTO((tree)); -extern int lvalue_or_else PROTO((tree, const char *)); -extern void readonly_warning PROTO((tree, const char *)); -extern int mark_addressable PROTO((tree)); -extern tree build_conditional_expr PROTO((tree, tree, tree)); -extern tree build_compound_expr PROTO((tree)); -extern tree build_c_cast PROTO((tree, tree)); -extern tree build_modify_expr PROTO((tree, enum tree_code, - tree)); -extern tree initializer_constant_valid_p PROTO((tree, tree)); -extern void store_init_value PROTO((tree, tree)); -extern void error_init PROTO((const char *)); -extern void pedwarn_init PROTO((const char *)); -extern void start_init PROTO((tree, tree, int)); -extern void finish_init PROTO((void)); -extern void really_start_incremental_init PROTO((tree)); -extern void push_init_level PROTO((int)); -extern tree pop_init_level PROTO((int)); -extern void set_init_index PROTO((tree, tree)); -extern void set_init_label PROTO((tree)); -extern void process_init_element PROTO((tree)); -extern void c_expand_asm_operands PROTO((tree, tree, tree, tree, - int, char *, int)); -extern void c_expand_return PROTO((tree)); -extern tree c_expand_start_case PROTO((tree)); - -/* in c-iterate.c */ -extern void init_iterators PROTO((void)); -extern void iterator_expand PROTO((tree)); -extern void iterator_for_loop_start PROTO((tree)); -extern void iterator_for_loop_end PROTO((tree)); -extern void iterator_for_loop_record PROTO((tree)); -extern void push_iterator_stack PROTO((void)); -extern void pop_iterator_stack PROTO((void)); - -/* Set to 0 at beginning of a function definition, set to 1 if - a return statement that specifies a return value is seen. */ - -extern int current_function_returns_value; - -/* Set to 0 at beginning of a function definition, set to 1 if - a return statement with no argument is seen. */ - -extern int current_function_returns_null; - -/* Nonzero means the expression being parsed will never be evaluated. - This is a count, since unevaluated expressions can nest. */ - -extern int skip_evaluation; - -/* Nonzero means `$' can be in an identifier. */ - -extern int dollars_in_ident; - -/* Nonzero means allow type mismatches in conditional expressions; - just make their values `void'. */ - -extern int flag_cond_mismatch; - -/* Nonzero means don't recognize the keyword `asm'. */ - -extern int flag_no_asm; - -/* Nonzero means environment is hosted (i.e., not freestanding) */ - -extern int flag_hosted; - -/* Nonzero means warn about implicit declarations. */ - -extern int warn_implicit; - -/* Nonzero means give string constants the type `const char *' - to get extra warnings from them. These warnings will be too numerous - to be useful, except in thoroughly ANSIfied programs. */ - -extern int flag_const_strings; - -/* Nonzero means warn about sizeof (function) or addition/subtraction - of function pointers. */ - -extern int warn_pointer_arith; - -/* Nonzero means warn for all old-style non-prototype function decls. */ - -extern int warn_strict_prototypes; - -/* Nonzero means warn about multiple (redundant) decls for the same single - variable or function. */ - -extern int warn_redundant_decls; - -/* Nonzero means warn about extern declarations of objects not at - file-scope level and about *all* declarations of functions (whether - extern or static) not at file-scope level. Note that we exclude - implicit function declarations. To get warnings about those, use - -Wimplicit. */ - -extern int warn_nested_externs; - -/* Nonzero means warn about pointer casts that can drop a type qualifier - from the pointer target type. */ - -extern int warn_cast_qual; - -/* Nonzero means warn when casting a function call to a type that does - not match the return type (e.g. (float)sqrt() or (anything*)malloc() - when there is no previous declaration of sqrt or malloc. */ - -extern int warn_bad_function_cast; - -/* Warn about functions which might be candidates for attribute noreturn. */ - -extern int warn_missing_noreturn; - -/* Warn about traditional constructs whose meanings changed in ANSI C. */ - -extern int warn_traditional; - -/* Warn about *printf or *scanf format/argument anomalies. */ - -extern int warn_format; - -/* Warn about a subscript that has type char. */ - -extern int warn_char_subscripts; - -/* Warn if a type conversion is done that might have confusing results. */ - -extern int warn_conversion; - -/* Warn if main is suspicious. */ - -extern int warn_main; - -/* Nonzero means do some things the same way PCC does. */ - -extern int flag_traditional; - -/* Nonzero means use the ISO C9x dialect of C. */ - -extern int flag_isoc9x; - -/* Nonzero means to allow single precision math even if we're generally - being traditional. */ -extern int flag_allow_single_precision; - -/* Nonzero means warn about suggesting putting in ()'s. */ - -extern int warn_parentheses; - -/* Warn if initializer is not completely bracketed. */ - -extern int warn_missing_braces; - -/* Warn about comparison of signed and unsigned values. */ - -extern int warn_sign_compare; - -/* Warn about multicharacter constants. */ - -extern int warn_multichar; - -/* Warn about long long. */ - -extern int warn_long_long; - -/* Nonzero means we are reading code that came from a system header file. */ - -extern int system_header_p; - -/* Nonzero enables objc features. */ - -extern int doing_objc_thang; - -/* In c-decl.c */ -extern void finish_incomplete_decl PROTO((tree)); - -#endif /* not _C_TREE_H */ diff --git a/contrib/gcc/c-typeck.c b/contrib/gcc/c-typeck.c deleted file mode 100644 index d320307574b5..000000000000 --- a/contrib/gcc/c-typeck.c +++ /dev/null @@ -1,6947 +0,0 @@ -/* Build expressions with type checking for C compiler. - Copyright (C) 1987, 88, 91-97, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* This file is part of the C front end. - It contains routines to build C expressions given their operands, - including computing the types of the result, C-specific error checks, - and some optimization. - - There are also routines to build RETURN_STMT nodes and CASE_STMT nodes, - and to process initializations in declarations (since they work - like a strange sort of assignment). */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "c-tree.h" -#include "flags.h" -#include "output.h" -#include "rtl.h" -#include "expr.h" -#include "toplev.h" -#include "intl.h" - -/* Nonzero if we've already printed a "missing braces around initializer" - message within this initializer. */ -static int missing_braces_mentioned; - -static tree qualify_type PROTO((tree, tree)); -static int comp_target_types PROTO((tree, tree)); -static int function_types_compatible_p PROTO((tree, tree)); -static int type_lists_compatible_p PROTO((tree, tree)); -static int self_promoting_type_p PROTO((tree)); -static tree decl_constant_value PROTO((tree)); -static tree lookup_field PROTO((tree, tree, tree *)); -static tree convert_arguments PROTO((tree, tree, tree, tree)); -static tree pointer_int_sum PROTO((enum tree_code, tree, tree)); -static tree pointer_diff PROTO((tree, tree)); -static tree unary_complex_lvalue PROTO((enum tree_code, tree)); -static void pedantic_lvalue_warning PROTO((enum tree_code)); -static tree internal_build_compound_expr PROTO((tree, int)); -static tree convert_for_assignment PROTO((tree, tree, const char *, tree, - tree, int)); -static void warn_for_assignment PROTO((const char *, const char *, - tree, int)); -static tree valid_compound_expr_initializer PROTO((tree, tree)); -static void push_string PROTO((const char *)); -static void push_member_name PROTO((tree)); -static void push_array_bounds PROTO((int)); -static int spelling_length PROTO((void)); -static char *print_spelling PROTO((char *)); -static void warning_init PROTO((const char *)); -static tree digest_init PROTO((tree, tree, int, int)); -static void check_init_type_bitfields PROTO((tree)); -static void output_init_element PROTO((tree, tree, tree, int)); -static void output_pending_init_elements PROTO((int)); -static void add_pending_init PROTO((tree, tree)); -static int pending_init_member PROTO((tree)); - -/* Do `exp = require_complete_type (exp);' to make sure exp - does not have an incomplete type. (That includes void types.) */ - -tree -require_complete_type (value) - tree value; -{ - tree type = TREE_TYPE (value); - - if (TREE_CODE (value) == ERROR_MARK) - return error_mark_node; - - /* First, detect a valid value with a complete type. */ - if (TYPE_SIZE (type) != 0 - && type != void_type_node) - return value; - - incomplete_type_error (value, type); - return error_mark_node; -} - -/* Print an error message for invalid use of an incomplete type. - VALUE is the expression that was used (or 0 if that isn't known) - and TYPE is the type that was invalid. */ - -void -incomplete_type_error (value, type) - tree value; - tree type; -{ - const char *type_code_string; - - /* Avoid duplicate error message. */ - if (TREE_CODE (type) == ERROR_MARK) - return; - - if (value != 0 && (TREE_CODE (value) == VAR_DECL - || TREE_CODE (value) == PARM_DECL)) - error ("`%s' has an incomplete type", - IDENTIFIER_POINTER (DECL_NAME (value))); - else - { - retry: - /* We must print an error message. Be clever about what it says. */ - - switch (TREE_CODE (type)) - { - case RECORD_TYPE: - type_code_string = "struct"; - break; - - case UNION_TYPE: - type_code_string = "union"; - break; - - case ENUMERAL_TYPE: - type_code_string = "enum"; - break; - - case VOID_TYPE: - error ("invalid use of void expression"); - return; - - case ARRAY_TYPE: - if (TYPE_DOMAIN (type)) - { - type = TREE_TYPE (type); - goto retry; - } - error ("invalid use of array with unspecified bounds"); - return; - - default: - abort (); - } - - if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) - error ("invalid use of undefined type `%s %s'", - type_code_string, IDENTIFIER_POINTER (TYPE_NAME (type))); - else - /* If this type has a typedef-name, the TYPE_NAME is a TYPE_DECL. */ - error ("invalid use of incomplete typedef `%s'", - IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))); - } -} - -/* Return a variant of TYPE which has all the type qualifiers of LIKE - as well as those of TYPE. */ - -static tree -qualify_type (type, like) - tree type, like; -{ - return c_build_qualified_type (type, - TYPE_QUALS (type) | TYPE_QUALS (like)); -} - -/* Return the common type of two types. - We assume that comptypes has already been done and returned 1; - if that isn't so, this may crash. In particular, we assume that qualifiers - match. - - This is the type for the result of most arithmetic operations - if the operands have the given two types. */ - -tree -common_type (t1, t2) - tree t1, t2; -{ - register enum tree_code code1; - register enum tree_code code2; - tree attributes; - - /* Save time if the two types are the same. */ - - if (t1 == t2) return t1; - - /* If one type is nonsense, use the other. */ - if (t1 == error_mark_node) - return t2; - if (t2 == error_mark_node) - return t1; - - /* Merge the attributes. */ - attributes = merge_machine_type_attributes (t1, t2); - - /* Treat an enum type as the unsigned integer type of the same width. */ - - if (TREE_CODE (t1) == ENUMERAL_TYPE) - t1 = type_for_size (TYPE_PRECISION (t1), 1); - if (TREE_CODE (t2) == ENUMERAL_TYPE) - t2 = type_for_size (TYPE_PRECISION (t2), 1); - - code1 = TREE_CODE (t1); - code2 = TREE_CODE (t2); - - /* If one type is complex, form the common type of the non-complex - components, then make that complex. Use T1 or T2 if it is the - required type. */ - if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) - { - tree subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1) : t1; - tree subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2) : t2; - tree subtype = common_type (subtype1, subtype2); - - if (code1 == COMPLEX_TYPE && TREE_TYPE (t1) == subtype) - return build_type_attribute_variant (t1, attributes); - else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2) == subtype) - return build_type_attribute_variant (t2, attributes); - else - return build_type_attribute_variant (build_complex_type (subtype), - attributes); - } - - switch (code1) - { - case INTEGER_TYPE: - case REAL_TYPE: - /* If only one is real, use it as the result. */ - - if (code1 == REAL_TYPE && code2 != REAL_TYPE) - return build_type_attribute_variant (t1, attributes); - - if (code2 == REAL_TYPE && code1 != REAL_TYPE) - return build_type_attribute_variant (t2, attributes); - - /* Both real or both integers; use the one with greater precision. */ - - if (TYPE_PRECISION (t1) > TYPE_PRECISION (t2)) - return build_type_attribute_variant (t1, attributes); - else if (TYPE_PRECISION (t2) > TYPE_PRECISION (t1)) - return build_type_attribute_variant (t2, attributes); - - /* Same precision. Prefer longs to ints even when same size. */ - - if (TYPE_MAIN_VARIANT (t1) == long_unsigned_type_node - || TYPE_MAIN_VARIANT (t2) == long_unsigned_type_node) - return build_type_attribute_variant (long_unsigned_type_node, - attributes); - - if (TYPE_MAIN_VARIANT (t1) == long_integer_type_node - || TYPE_MAIN_VARIANT (t2) == long_integer_type_node) - { - /* But preserve unsignedness from the other type, - since long cannot hold all the values of an unsigned int. */ - if (TREE_UNSIGNED (t1) || TREE_UNSIGNED (t2)) - t1 = long_unsigned_type_node; - else - t1 = long_integer_type_node; - return build_type_attribute_variant (t1, attributes); - } - - /* Likewise, prefer long double to double even if same size. */ - if (TYPE_MAIN_VARIANT (t1) == long_double_type_node - || TYPE_MAIN_VARIANT (t2) == long_double_type_node) - return build_type_attribute_variant (long_double_type_node, - attributes); - - /* Otherwise prefer the unsigned one. */ - - if (TREE_UNSIGNED (t1)) - return build_type_attribute_variant (t1, attributes); - else - return build_type_attribute_variant (t2, attributes); - - case POINTER_TYPE: - /* For two pointers, do this recursively on the target type, - and combine the qualifiers of the two types' targets. */ - /* This code was turned off; I don't know why. - But ANSI C specifies doing this with the qualifiers. - So I turned it on again. */ - { - tree pointed_to_1 = TREE_TYPE (t1); - tree pointed_to_2 = TREE_TYPE (t2); - tree target = common_type (TYPE_MAIN_VARIANT (pointed_to_1), - TYPE_MAIN_VARIANT (pointed_to_2)); - t1 = build_pointer_type (c_build_qualified_type - (target, - TYPE_QUALS (pointed_to_1) | - TYPE_QUALS (pointed_to_2))); - return build_type_attribute_variant (t1, attributes); - } -#if 0 - t1 = build_pointer_type (common_type (TREE_TYPE (t1), TREE_TYPE (t2))); - return build_type_attribute_variant (t1, attributes); -#endif - - case ARRAY_TYPE: - { - tree elt = common_type (TREE_TYPE (t1), TREE_TYPE (t2)); - /* Save space: see if the result is identical to one of the args. */ - if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1)) - return build_type_attribute_variant (t1, attributes); - if (elt == TREE_TYPE (t2) && TYPE_DOMAIN (t2)) - return build_type_attribute_variant (t2, attributes); - /* Merge the element types, and have a size if either arg has one. */ - t1 = build_array_type (elt, TYPE_DOMAIN (TYPE_DOMAIN (t1) ? t1 : t2)); - return build_type_attribute_variant (t1, attributes); - } - - case FUNCTION_TYPE: - /* Function types: prefer the one that specified arg types. - If both do, merge the arg types. Also merge the return types. */ - { - tree valtype = common_type (TREE_TYPE (t1), TREE_TYPE (t2)); - tree p1 = TYPE_ARG_TYPES (t1); - tree p2 = TYPE_ARG_TYPES (t2); - int len; - tree newargs, n; - int i; - - /* Save space: see if the result is identical to one of the args. */ - if (valtype == TREE_TYPE (t1) && ! TYPE_ARG_TYPES (t2)) - return build_type_attribute_variant (t1, attributes); - if (valtype == TREE_TYPE (t2) && ! TYPE_ARG_TYPES (t1)) - return build_type_attribute_variant (t2, attributes); - - /* Simple way if one arg fails to specify argument types. */ - if (TYPE_ARG_TYPES (t1) == 0) - { - t1 = build_function_type (valtype, TYPE_ARG_TYPES (t2)); - return build_type_attribute_variant (t1, attributes); - } - if (TYPE_ARG_TYPES (t2) == 0) - { - t1 = build_function_type (valtype, TYPE_ARG_TYPES (t1)); - return build_type_attribute_variant (t1, attributes); - } - - /* If both args specify argument types, we must merge the two - lists, argument by argument. */ - - len = list_length (p1); - newargs = 0; - - for (i = 0; i < len; i++) - newargs = tree_cons (NULL_TREE, NULL_TREE, newargs); - - n = newargs; - - for (; p1; - p1 = TREE_CHAIN (p1), p2 = TREE_CHAIN (p2), n = TREE_CHAIN (n)) - { - /* A null type means arg type is not specified. - Take whatever the other function type has. */ - if (TREE_VALUE (p1) == 0) - { - TREE_VALUE (n) = TREE_VALUE (p2); - goto parm_done; - } - if (TREE_VALUE (p2) == 0) - { - TREE_VALUE (n) = TREE_VALUE (p1); - goto parm_done; - } - - /* Given wait (union {union wait *u; int *i} *) - and wait (union wait *), - prefer union wait * as type of parm. */ - if (TREE_CODE (TREE_VALUE (p1)) == UNION_TYPE - && TREE_VALUE (p1) != TREE_VALUE (p2)) - { - tree memb; - for (memb = TYPE_FIELDS (TREE_VALUE (p1)); - memb; memb = TREE_CHAIN (memb)) - if (comptypes (TREE_TYPE (memb), TREE_VALUE (p2))) - { - TREE_VALUE (n) = TREE_VALUE (p2); - if (pedantic) - pedwarn ("function types not truly compatible in ANSI C"); - goto parm_done; - } - } - if (TREE_CODE (TREE_VALUE (p2)) == UNION_TYPE - && TREE_VALUE (p2) != TREE_VALUE (p1)) - { - tree memb; - for (memb = TYPE_FIELDS (TREE_VALUE (p2)); - memb; memb = TREE_CHAIN (memb)) - if (comptypes (TREE_TYPE (memb), TREE_VALUE (p1))) - { - TREE_VALUE (n) = TREE_VALUE (p1); - if (pedantic) - pedwarn ("function types not truly compatible in ANSI C"); - goto parm_done; - } - } - TREE_VALUE (n) = common_type (TREE_VALUE (p1), TREE_VALUE (p2)); - parm_done: ; - } - - t1 = build_function_type (valtype, newargs); - /* ... falls through ... */ - } - - default: - return build_type_attribute_variant (t1, attributes); - } - -} - -/* Return 1 if TYPE1 and TYPE2 are compatible types for assignment - or various other operations. Return 2 if they are compatible - but a warning may be needed if you use them together. */ - -int -comptypes (type1, type2) - tree type1, type2; -{ - register tree t1 = type1; - register tree t2 = type2; - int attrval, val; - - /* Suppress errors caused by previously reported errors. */ - - if (t1 == t2 || !t1 || !t2 - || TREE_CODE (t1) == ERROR_MARK || TREE_CODE (t2) == ERROR_MARK) - return 1; - - /* Treat an enum type as the integer type of the same width and - signedness. */ - - if (TREE_CODE (t1) == ENUMERAL_TYPE) - t1 = type_for_size (TYPE_PRECISION (t1), TREE_UNSIGNED (t1)); - if (TREE_CODE (t2) == ENUMERAL_TYPE) - t2 = type_for_size (TYPE_PRECISION (t2), TREE_UNSIGNED (t2)); - - if (t1 == t2) - return 1; - - /* Different classes of types can't be compatible. */ - - if (TREE_CODE (t1) != TREE_CODE (t2)) return 0; - - /* Qualifiers must match. */ - - if (TYPE_QUALS (t1) != TYPE_QUALS (t2)) - return 0; - - /* Allow for two different type nodes which have essentially the same - definition. Note that we already checked for equality of the type - qualifiers (just above). */ - - if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2)) - return 1; - -#ifndef COMP_TYPE_ATTRIBUTES -#define COMP_TYPE_ATTRIBUTES(t1,t2) 1 -#endif - - /* 1 if no need for warning yet, 2 if warning cause has been seen. */ - if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2))) - return 0; - - /* 1 if no need for warning yet, 2 if warning cause has been seen. */ - val = 0; - - switch (TREE_CODE (t1)) - { - case POINTER_TYPE: - val = (TREE_TYPE (t1) == TREE_TYPE (t2) - ? 1 : comptypes (TREE_TYPE (t1), TREE_TYPE (t2))); - break; - - case FUNCTION_TYPE: - val = function_types_compatible_p (t1, t2); - break; - - case ARRAY_TYPE: - { - tree d1 = TYPE_DOMAIN (t1); - tree d2 = TYPE_DOMAIN (t2); - val = 1; - - /* Target types must match incl. qualifiers. */ - if (TREE_TYPE (t1) != TREE_TYPE (t2) - && 0 == (val = comptypes (TREE_TYPE (t1), TREE_TYPE (t2)))) - return 0; - - /* Sizes must match unless one is missing or variable. */ - if (d1 == 0 || d2 == 0 || d1 == d2 - || TREE_CODE (TYPE_MIN_VALUE (d1)) != INTEGER_CST - || TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST - || TREE_CODE (TYPE_MAX_VALUE (d1)) != INTEGER_CST - || TREE_CODE (TYPE_MAX_VALUE (d2)) != INTEGER_CST) - break; - - if (! ((TREE_INT_CST_LOW (TYPE_MIN_VALUE (d1)) - == TREE_INT_CST_LOW (TYPE_MIN_VALUE (d2))) - && (TREE_INT_CST_HIGH (TYPE_MIN_VALUE (d1)) - == TREE_INT_CST_HIGH (TYPE_MIN_VALUE (d2))) - && (TREE_INT_CST_LOW (TYPE_MAX_VALUE (d1)) - == TREE_INT_CST_LOW (TYPE_MAX_VALUE (d2))) - && (TREE_INT_CST_HIGH (TYPE_MAX_VALUE (d1)) - == TREE_INT_CST_HIGH (TYPE_MAX_VALUE (d2))))) - val = 0; - break; - } - - case RECORD_TYPE: - if (maybe_objc_comptypes (t1, t2, 0) == 1) - val = 1; - break; - - default: - break; - } - return attrval == 2 && val == 1 ? 2 : val; -} - -/* Return 1 if TTL and TTR are pointers to types that are equivalent, - ignoring their qualifiers. */ - -static int -comp_target_types (ttl, ttr) - tree ttl, ttr; -{ - int val; - - /* Give maybe_objc_comptypes a crack at letting these types through. */ - if ((val = maybe_objc_comptypes (ttl, ttr, 1)) >= 0) - return val; - - val = comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (ttl)), - TYPE_MAIN_VARIANT (TREE_TYPE (ttr))); - - if (val == 2 && pedantic) - pedwarn ("types are not quite compatible"); - return val; -} - -/* Subroutines of `comptypes'. */ - -/* Return 1 if two function types F1 and F2 are compatible. - If either type specifies no argument types, - the other must specify a fixed number of self-promoting arg types. - Otherwise, if one type specifies only the number of arguments, - the other must specify that number of self-promoting arg types. - Otherwise, the argument types must match. */ - -static int -function_types_compatible_p (f1, f2) - tree f1, f2; -{ - tree args1, args2; - /* 1 if no need for warning yet, 2 if warning cause has been seen. */ - int val = 1; - int val1; - - if (!(TREE_TYPE (f1) == TREE_TYPE (f2) - || (val = comptypes (TREE_TYPE (f1), TREE_TYPE (f2))))) - return 0; - - args1 = TYPE_ARG_TYPES (f1); - args2 = TYPE_ARG_TYPES (f2); - - /* An unspecified parmlist matches any specified parmlist - whose argument types don't need default promotions. */ - - if (args1 == 0) - { - if (!self_promoting_args_p (args2)) - return 0; - /* If one of these types comes from a non-prototype fn definition, - compare that with the other type's arglist. - If they don't match, ask for a warning (but no error). */ - if (TYPE_ACTUAL_ARG_TYPES (f1) - && 1 != type_lists_compatible_p (args2, TYPE_ACTUAL_ARG_TYPES (f1))) - val = 2; - return val; - } - if (args2 == 0) - { - if (!self_promoting_args_p (args1)) - return 0; - if (TYPE_ACTUAL_ARG_TYPES (f2) - && 1 != type_lists_compatible_p (args1, TYPE_ACTUAL_ARG_TYPES (f2))) - val = 2; - return val; - } - - /* Both types have argument lists: compare them and propagate results. */ - val1 = type_lists_compatible_p (args1, args2); - return val1 != 1 ? val1 : val; -} - -/* Check two lists of types for compatibility, - returning 0 for incompatible, 1 for compatible, - or 2 for compatible with warning. */ - -static int -type_lists_compatible_p (args1, args2) - tree args1, args2; -{ - /* 1 if no need for warning yet, 2 if warning cause has been seen. */ - int val = 1; - int newval = 0; - - while (1) - { - if (args1 == 0 && args2 == 0) - return val; - /* If one list is shorter than the other, - they fail to match. */ - if (args1 == 0 || args2 == 0) - return 0; - /* A null pointer instead of a type - means there is supposed to be an argument - but nothing is specified about what type it has. - So match anything that self-promotes. */ - if (TREE_VALUE (args1) == 0) - { - if (! self_promoting_type_p (TREE_VALUE (args2))) - return 0; - } - else if (TREE_VALUE (args2) == 0) - { - if (! self_promoting_type_p (TREE_VALUE (args1))) - return 0; - } - else if (! (newval = comptypes (TREE_VALUE (args1), TREE_VALUE (args2)))) - { - /* Allow wait (union {union wait *u; int *i} *) - and wait (union wait *) to be compatible. */ - if (TREE_CODE (TREE_VALUE (args1)) == UNION_TYPE - && (TYPE_NAME (TREE_VALUE (args1)) == 0 - || TYPE_TRANSPARENT_UNION (TREE_VALUE (args1))) - && TREE_CODE (TYPE_SIZE (TREE_VALUE (args1))) == INTEGER_CST - && tree_int_cst_equal (TYPE_SIZE (TREE_VALUE (args1)), - TYPE_SIZE (TREE_VALUE (args2)))) - { - tree memb; - for (memb = TYPE_FIELDS (TREE_VALUE (args1)); - memb; memb = TREE_CHAIN (memb)) - if (comptypes (TREE_TYPE (memb), TREE_VALUE (args2))) - break; - if (memb == 0) - return 0; - } - else if (TREE_CODE (TREE_VALUE (args2)) == UNION_TYPE - && (TYPE_NAME (TREE_VALUE (args2)) == 0 - || TYPE_TRANSPARENT_UNION (TREE_VALUE (args2))) - && TREE_CODE (TYPE_SIZE (TREE_VALUE (args2))) == INTEGER_CST - && tree_int_cst_equal (TYPE_SIZE (TREE_VALUE (args2)), - TYPE_SIZE (TREE_VALUE (args1)))) - { - tree memb; - for (memb = TYPE_FIELDS (TREE_VALUE (args2)); - memb; memb = TREE_CHAIN (memb)) - if (comptypes (TREE_TYPE (memb), TREE_VALUE (args1))) - break; - if (memb == 0) - return 0; - } - else - return 0; - } - - /* comptypes said ok, but record if it said to warn. */ - if (newval > val) - val = newval; - - args1 = TREE_CHAIN (args1); - args2 = TREE_CHAIN (args2); - } -} - -/* Return 1 if PARMS specifies a fixed number of parameters - and none of their types is affected by default promotions. */ - -int -self_promoting_args_p (parms) - tree parms; -{ - register tree t; - for (t = parms; t; t = TREE_CHAIN (t)) - { - register tree type = TREE_VALUE (t); - - if (TREE_CHAIN (t) == 0 && type != void_type_node) - return 0; - - if (type == 0) - return 0; - - if (TYPE_MAIN_VARIANT (type) == float_type_node) - return 0; - - if (C_PROMOTING_INTEGER_TYPE_P (type)) - return 0; - } - return 1; -} - -/* Return 1 if TYPE is not affected by default promotions. */ - -static int -self_promoting_type_p (type) - tree type; -{ - if (TYPE_MAIN_VARIANT (type) == float_type_node) - return 0; - - if (C_PROMOTING_INTEGER_TYPE_P (type)) - return 0; - - return 1; -} - -/* Return an unsigned type the same as TYPE in other respects. */ - -tree -unsigned_type (type) - tree type; -{ - tree type1 = TYPE_MAIN_VARIANT (type); - if (type1 == signed_char_type_node || type1 == char_type_node) - return unsigned_char_type_node; - if (type1 == integer_type_node) - return unsigned_type_node; - if (type1 == short_integer_type_node) - return short_unsigned_type_node; - if (type1 == long_integer_type_node) - return long_unsigned_type_node; - if (type1 == long_long_integer_type_node) - return long_long_unsigned_type_node; - if (type1 == intDI_type_node) - return unsigned_intDI_type_node; - if (type1 == intSI_type_node) - return unsigned_intSI_type_node; - if (type1 == intHI_type_node) - return unsigned_intHI_type_node; - if (type1 == intQI_type_node) - return unsigned_intQI_type_node; - - return signed_or_unsigned_type (1, type); -} - -/* Return a signed type the same as TYPE in other respects. */ - -tree -signed_type (type) - tree type; -{ - tree type1 = TYPE_MAIN_VARIANT (type); - if (type1 == unsigned_char_type_node || type1 == char_type_node) - return signed_char_type_node; - if (type1 == unsigned_type_node) - return integer_type_node; - if (type1 == short_unsigned_type_node) - return short_integer_type_node; - if (type1 == long_unsigned_type_node) - return long_integer_type_node; - if (type1 == long_long_unsigned_type_node) - return long_long_integer_type_node; - if (type1 == unsigned_intDI_type_node) - return intDI_type_node; - if (type1 == unsigned_intSI_type_node) - return intSI_type_node; - if (type1 == unsigned_intHI_type_node) - return intHI_type_node; - if (type1 == unsigned_intQI_type_node) - return intQI_type_node; - - return signed_or_unsigned_type (0, type); -} - -/* Return a type the same as TYPE except unsigned or - signed according to UNSIGNEDP. */ - -tree -signed_or_unsigned_type (unsignedp, type) - int unsignedp; - tree type; -{ - if ((! INTEGRAL_TYPE_P (type) && ! POINTER_TYPE_P (type)) - || TREE_UNSIGNED (type) == unsignedp) - return type; - if (TYPE_PRECISION (type) == TYPE_PRECISION (signed_char_type_node)) - return unsignedp ? unsigned_char_type_node : signed_char_type_node; - if (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)) - return unsignedp ? unsigned_type_node : integer_type_node; - if (TYPE_PRECISION (type) == TYPE_PRECISION (short_integer_type_node)) - return unsignedp ? short_unsigned_type_node : short_integer_type_node; - if (TYPE_PRECISION (type) == TYPE_PRECISION (long_integer_type_node)) - return unsignedp ? long_unsigned_type_node : long_integer_type_node; - if (TYPE_PRECISION (type) == TYPE_PRECISION (long_long_integer_type_node)) - return (unsignedp ? long_long_unsigned_type_node - : long_long_integer_type_node); - return type; -} - -/* Compute the value of the `sizeof' operator. */ - -tree -c_sizeof (type) - tree type; -{ - enum tree_code code = TREE_CODE (type); - tree t; - - if (code == FUNCTION_TYPE) - { - if (pedantic || warn_pointer_arith) - pedwarn ("sizeof applied to a function type"); - return size_int (1); - } - if (code == VOID_TYPE) - { - if (pedantic || warn_pointer_arith) - pedwarn ("sizeof applied to a void type"); - return size_int (1); - } - if (code == ERROR_MARK) - return size_int (1); - if (TYPE_SIZE (type) == 0) - { - error ("sizeof applied to an incomplete type"); - return size_int (0); - } - - /* Convert in case a char is more than one unit. */ - t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), - size_int (TYPE_PRECISION (char_type_node))); - t = convert (sizetype, t); - /* size_binop does not put the constant in range, so do it now. */ - if (TREE_CODE (t) == INTEGER_CST && force_fit_type (t, 0)) - TREE_CONSTANT_OVERFLOW (t) = TREE_OVERFLOW (t) = 1; - return t; -} - -tree -c_sizeof_nowarn (type) - tree type; -{ - enum tree_code code = TREE_CODE (type); - tree t; - - if (code == FUNCTION_TYPE - || code == VOID_TYPE - || code == ERROR_MARK) - return size_int (1); - if (TYPE_SIZE (type) == 0) - return size_int (0); - - /* Convert in case a char is more than one unit. */ - t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), - size_int (TYPE_PRECISION (char_type_node))); - t = convert (sizetype, t); - force_fit_type (t, 0); - return t; -} - -/* Compute the size to increment a pointer by. */ - -tree -c_size_in_bytes (type) - tree type; -{ - enum tree_code code = TREE_CODE (type); - tree t; - - if (code == FUNCTION_TYPE) - return size_int (1); - if (code == VOID_TYPE) - return size_int (1); - if (code == ERROR_MARK) - return size_int (1); - if (TYPE_SIZE (type) == 0) - { - error ("arithmetic on pointer to an incomplete type"); - return size_int (1); - } - - /* Convert in case a char is more than one unit. */ - t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), - size_int (BITS_PER_UNIT)); - t = convert (sizetype, t); - force_fit_type (t, 0); - return t; -} - -/* Implement the __alignof keyword: Return the minimum required - alignment of TYPE, measured in bytes. */ - -tree -c_alignof (type) - tree type; -{ - enum tree_code code = TREE_CODE (type); - - if (code == FUNCTION_TYPE) - return size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT); - - if (code == VOID_TYPE || code == ERROR_MARK) - return size_int (1); - - return size_int (TYPE_ALIGN (type) / BITS_PER_UNIT); -} - -/* Implement the __alignof keyword: Return the minimum required - alignment of EXPR, measured in bytes. For VAR_DECL's and - FIELD_DECL's return DECL_ALIGN (which can be set from an - "aligned" __attribute__ specification). */ - -tree -c_alignof_expr (expr) - tree expr; -{ - if (TREE_CODE (expr) == VAR_DECL) - return size_int (DECL_ALIGN (expr) / BITS_PER_UNIT); - - if (TREE_CODE (expr) == COMPONENT_REF - && DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1))) - { - error ("`__alignof' applied to a bit-field"); - return size_int (1); - } - else if (TREE_CODE (expr) == COMPONENT_REF - && TREE_CODE (TREE_OPERAND (expr, 1)) == FIELD_DECL) - return size_int (DECL_ALIGN (TREE_OPERAND (expr, 1)) / BITS_PER_UNIT); - - if (TREE_CODE (expr) == INDIRECT_REF) - { - tree t = TREE_OPERAND (expr, 0); - tree best = t; - int bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t))); - - while (TREE_CODE (t) == NOP_EXPR - && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE) - { - int thisalign; - - t = TREE_OPERAND (t, 0); - thisalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t))); - if (thisalign > bestalign) - best = t, bestalign = thisalign; - } - return c_alignof (TREE_TYPE (TREE_TYPE (best))); - } - else - return c_alignof (TREE_TYPE (expr)); -} - -/* Return either DECL or its known constant value (if it has one). */ - -static tree -decl_constant_value (decl) - tree decl; -{ - if (/* Don't change a variable array bound or initial value to a constant - in a place where a variable is invalid. */ - current_function_decl != 0 - && ! pedantic - && ! TREE_THIS_VOLATILE (decl) - && TREE_READONLY (decl) && ! ITERATOR_P (decl) - && DECL_INITIAL (decl) != 0 - && TREE_CODE (DECL_INITIAL (decl)) != ERROR_MARK - /* This is invalid if initial value is not constant. - If it has either a function call, a memory reference, - or a variable, then re-evaluating it could give different results. */ - && TREE_CONSTANT (DECL_INITIAL (decl)) - /* Check for cases where this is sub-optimal, even though valid. */ - && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR - && DECL_MODE (decl) != BLKmode) - return DECL_INITIAL (decl); - return decl; -} - -/* Perform default promotions for C data used in expressions. - Arrays and functions are converted to pointers; - enumeral types or short or char, to int. - In addition, manifest constants symbols are replaced by their values. */ - -tree -default_conversion (exp) - tree exp; -{ - register tree type = TREE_TYPE (exp); - register enum tree_code code = TREE_CODE (type); - - /* Constants can be used directly unless they're not loadable. */ - if (TREE_CODE (exp) == CONST_DECL) - exp = DECL_INITIAL (exp); - - /* Replace a nonvolatile const static variable with its value unless - it is an array, in which case we must be sure that taking the - address of the array produces consistent results. */ - else if (optimize && TREE_CODE (exp) == VAR_DECL && code != ARRAY_TYPE) - { - exp = decl_constant_value (exp); - type = TREE_TYPE (exp); - } - - /* Strip NON_LVALUE_EXPRs and no-op conversions, since we aren't using as - an lvalue. */ - /* Do not use STRIP_NOPS here! It will remove conversions from pointer - to integer and cause infinite recursion. */ - while (TREE_CODE (exp) == NON_LVALUE_EXPR - || (TREE_CODE (exp) == NOP_EXPR - && TREE_TYPE (TREE_OPERAND (exp, 0)) == TREE_TYPE (exp))) - exp = TREE_OPERAND (exp, 0); - - /* Normally convert enums to int, - but convert wide enums to something wider. */ - if (code == ENUMERAL_TYPE) - { - type = type_for_size (MAX (TYPE_PRECISION (type), - TYPE_PRECISION (integer_type_node)), - ((flag_traditional - || (TYPE_PRECISION (type) - >= TYPE_PRECISION (integer_type_node))) - && TREE_UNSIGNED (type))); - return convert (type, exp); - } - - if (TREE_CODE (exp) == COMPONENT_REF - && DECL_C_BIT_FIELD (TREE_OPERAND (exp, 1))) - { - tree width = DECL_SIZE (TREE_OPERAND (exp, 1)); - HOST_WIDE_INT low = TREE_INT_CST_LOW (width); - - /* If it's thinner than an int, promote it like a - C_PROMOTING_INTEGER_TYPE_P, otherwise leave it alone. */ - - if (low < TYPE_PRECISION (integer_type_node)) - { - if (flag_traditional && TREE_UNSIGNED (type)) - return convert (unsigned_type_node, exp); - else - return convert (integer_type_node, exp); - } - } - - if (C_PROMOTING_INTEGER_TYPE_P (type)) - { - /* Traditionally, unsignedness is preserved in default promotions. - Also preserve unsignedness if not really getting any wider. */ - if (TREE_UNSIGNED (type) - && (flag_traditional - || TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))) - return convert (unsigned_type_node, exp); - return convert (integer_type_node, exp); - } - if (flag_traditional && !flag_allow_single_precision - && TYPE_MAIN_VARIANT (type) == float_type_node) - return convert (double_type_node, exp); - if (code == VOID_TYPE) - { - error ("void value not ignored as it ought to be"); - return error_mark_node; - } - if (code == FUNCTION_TYPE) - { - return build_unary_op (ADDR_EXPR, exp, 0); - } - if (code == ARRAY_TYPE) - { - register tree adr; - tree restype = TREE_TYPE (type); - tree ptrtype; - int constp = 0; - int volatilep = 0; - - if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'r' - || TREE_CODE_CLASS (TREE_CODE (exp)) == 'd') - { - constp = TREE_READONLY (exp); - volatilep = TREE_THIS_VOLATILE (exp); - } - - if (TYPE_QUALS (type) || constp || volatilep) - restype - = c_build_qualified_type (restype, - TYPE_QUALS (type) - | (constp * TYPE_QUAL_CONST) - | (volatilep * TYPE_QUAL_VOLATILE)); - - if (TREE_CODE (exp) == INDIRECT_REF) - return convert (TYPE_POINTER_TO (restype), - TREE_OPERAND (exp, 0)); - - if (TREE_CODE (exp) == COMPOUND_EXPR) - { - tree op1 = default_conversion (TREE_OPERAND (exp, 1)); - return build (COMPOUND_EXPR, TREE_TYPE (op1), - TREE_OPERAND (exp, 0), op1); - } - - if (! lvalue_p (exp) - && ! (TREE_CODE (exp) == CONSTRUCTOR && TREE_STATIC (exp))) - { - error ("invalid use of non-lvalue array"); - return error_mark_node; - } - - ptrtype = build_pointer_type (restype); - - if (TREE_CODE (exp) == VAR_DECL) - { - /* ??? This is not really quite correct - in that the type of the operand of ADDR_EXPR - is not the target type of the type of the ADDR_EXPR itself. - Question is, can this lossage be avoided? */ - adr = build1 (ADDR_EXPR, ptrtype, exp); - if (mark_addressable (exp) == 0) - return error_mark_node; - TREE_CONSTANT (adr) = staticp (exp); - TREE_SIDE_EFFECTS (adr) = 0; /* Default would be, same as EXP. */ - return adr; - } - /* This way is better for a COMPONENT_REF since it can - simplify the offset for a component. */ - adr = build_unary_op (ADDR_EXPR, exp, 1); - return convert (ptrtype, adr); - } - return exp; -} - -/* Look up component name in the structure type definition. - - If this component name is found indirectly within an anonymous union, - store in *INDIRECT the component which directly contains - that anonymous union. Otherwise, set *INDIRECT to 0. */ - -static tree -lookup_field (type, component, indirect) - tree type, component; - tree *indirect; -{ - tree field; - - /* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers - to the field elements. Use a binary search on this array to quickly - find the element. Otherwise, do a linear search. TYPE_LANG_SPECIFIC - will always be set for structures which have many elements. */ - - if (TYPE_LANG_SPECIFIC (type)) - { - int bot, top, half; - tree *field_array = &TYPE_LANG_SPECIFIC (type)->elts[0]; - - field = TYPE_FIELDS (type); - bot = 0; - top = TYPE_LANG_SPECIFIC (type)->len; - while (top - bot > 1) - { - half = (top - bot + 1) >> 1; - field = field_array[bot+half]; - - if (DECL_NAME (field) == NULL_TREE) - { - /* Step through all anon unions in linear fashion. */ - while (DECL_NAME (field_array[bot]) == NULL_TREE) - { - tree anon = 0, junk; - - field = field_array[bot++]; - if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE) - anon = lookup_field (TREE_TYPE (field), component, &junk); - - if (anon != NULL_TREE) - { - *indirect = field; - return anon; - } - } - - /* Entire record is only anon unions. */ - if (bot > top) - return NULL_TREE; - - /* Restart the binary search, with new lower bound. */ - continue; - } - - if (DECL_NAME (field) == component) - break; - if (DECL_NAME (field) < component) - bot += half; - else - top = bot + half; - } - - if (DECL_NAME (field_array[bot]) == component) - field = field_array[bot]; - else if (DECL_NAME (field) != component) - field = 0; - } - else - { - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) - { - if (DECL_NAME (field) == NULL_TREE) - { - tree junk; - tree anon = 0; - - if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE) - anon = lookup_field (TREE_TYPE (field), component, &junk); - - if (anon != NULL_TREE) - { - *indirect = field; - return anon; - } - } - - if (DECL_NAME (field) == component) - break; - } - } - - *indirect = NULL_TREE; - return field; -} - -/* Make an expression to refer to the COMPONENT field of - structure or union value DATUM. COMPONENT is an IDENTIFIER_NODE. */ - -tree -build_component_ref (datum, component) - tree datum, component; -{ - register tree type = TREE_TYPE (datum); - register enum tree_code code = TREE_CODE (type); - register tree field = NULL; - register tree ref; - - /* If DATUM is a COMPOUND_EXPR or COND_EXPR, move our reference inside it - unless we are not to support things not strictly ANSI. */ - switch (TREE_CODE (datum)) - { - case COMPOUND_EXPR: - { - tree value = build_component_ref (TREE_OPERAND (datum, 1), component); - return build (COMPOUND_EXPR, TREE_TYPE (value), - TREE_OPERAND (datum, 0), value); - } - case COND_EXPR: - return build_conditional_expr - (TREE_OPERAND (datum, 0), - build_component_ref (TREE_OPERAND (datum, 1), component), - build_component_ref (TREE_OPERAND (datum, 2), component)); - - default: - break; - } - - /* See if there is a field or component with name COMPONENT. */ - - if (code == RECORD_TYPE || code == UNION_TYPE) - { - tree indirect = 0; - - if (TYPE_SIZE (type) == 0) - { - incomplete_type_error (NULL_TREE, type); - return error_mark_node; - } - - field = lookup_field (type, component, &indirect); - - if (!field) - { - error (code == RECORD_TYPE - ? "structure has no member named `%s'" - : "union has no member named `%s'", - IDENTIFIER_POINTER (component)); - return error_mark_node; - } - if (TREE_TYPE (field) == error_mark_node) - return error_mark_node; - - /* If FIELD was found buried within an anonymous union, - make one COMPONENT_REF to get that anonymous union, - then fall thru to make a second COMPONENT_REF to get FIELD. */ - if (indirect != 0) - { - ref = build (COMPONENT_REF, TREE_TYPE (indirect), datum, indirect); - if (TREE_READONLY (datum) || TREE_READONLY (indirect)) - TREE_READONLY (ref) = 1; - if (TREE_THIS_VOLATILE (datum) || TREE_THIS_VOLATILE (indirect)) - TREE_THIS_VOLATILE (ref) = 1; - datum = ref; - } - - ref = build (COMPONENT_REF, TREE_TYPE (field), datum, field); - - if (TREE_READONLY (datum) || TREE_READONLY (field)) - TREE_READONLY (ref) = 1; - if (TREE_THIS_VOLATILE (datum) || TREE_THIS_VOLATILE (field)) - TREE_THIS_VOLATILE (ref) = 1; - - return ref; - } - else if (code != ERROR_MARK) - error ("request for member `%s' in something not a structure or union", - IDENTIFIER_POINTER (component)); - - return error_mark_node; -} - -/* Given an expression PTR for a pointer, return an expression - for the value pointed to. - ERRORSTRING is the name of the operator to appear in error messages. */ - -tree -build_indirect_ref (ptr, errorstring) - tree ptr; - const char *errorstring; -{ - register tree pointer = default_conversion (ptr); - register tree type = TREE_TYPE (pointer); - - if (TREE_CODE (type) == POINTER_TYPE) - { - if (TREE_CODE (pointer) == ADDR_EXPR - && !flag_volatile - && (TREE_TYPE (TREE_OPERAND (pointer, 0)) - == TREE_TYPE (type))) - return TREE_OPERAND (pointer, 0); - else - { - tree t = TREE_TYPE (type); - register tree ref = build1 (INDIRECT_REF, - TYPE_MAIN_VARIANT (t), pointer); - - if (TYPE_SIZE (t) == 0 && TREE_CODE (t) != ARRAY_TYPE) - { - error ("dereferencing pointer to incomplete type"); - return error_mark_node; - } - if (TREE_CODE (t) == VOID_TYPE && skip_evaluation == 0) - warning ("dereferencing `void *' pointer"); - - /* We *must* set TREE_READONLY when dereferencing a pointer to const, - so that we get the proper error message if the result is used - to assign to. Also, &* is supposed to be a no-op. - And ANSI C seems to specify that the type of the result - should be the const type. */ - /* A de-reference of a pointer to const is not a const. It is valid - to change it via some other pointer. */ - TREE_READONLY (ref) = TYPE_READONLY (t); - TREE_SIDE_EFFECTS (ref) - = TYPE_VOLATILE (t) || TREE_SIDE_EFFECTS (pointer) || flag_volatile; - TREE_THIS_VOLATILE (ref) = TYPE_VOLATILE (t); - return ref; - } - } - else if (TREE_CODE (pointer) != ERROR_MARK) - error ("invalid type argument of `%s'", errorstring); - return error_mark_node; -} - -/* This handles expressions of the form "a[i]", which denotes - an array reference. - - This is logically equivalent in C to *(a+i), but we may do it differently. - If A is a variable or a member, we generate a primitive ARRAY_REF. - This avoids forcing the array out of registers, and can work on - arrays that are not lvalues (for example, members of structures returned - by functions). */ - -tree -build_array_ref (array, index) - tree array, index; -{ - if (index == 0) - { - error ("subscript missing in array reference"); - return error_mark_node; - } - - if (TREE_TYPE (array) == error_mark_node - || TREE_TYPE (index) == error_mark_node) - return error_mark_node; - - if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE - && TREE_CODE (array) != INDIRECT_REF) - { - tree rval, type; - - /* Subscripting with type char is likely to lose - on a machine where chars are signed. - So warn on any machine, but optionally. - Don't warn for unsigned char since that type is safe. - Don't warn for signed char because anyone who uses that - must have done so deliberately. */ - if (warn_char_subscripts - && TYPE_MAIN_VARIANT (TREE_TYPE (index)) == char_type_node) - warning ("array subscript has type `char'"); - - /* Apply default promotions *after* noticing character types. */ - index = default_conversion (index); - - /* Require integer *after* promotion, for sake of enums. */ - if (TREE_CODE (TREE_TYPE (index)) != INTEGER_TYPE) - { - error ("array subscript is not an integer"); - return error_mark_node; - } - - /* An array that is indexed by a non-constant - cannot be stored in a register; we must be able to do - address arithmetic on its address. - Likewise an array of elements of variable size. */ - if (TREE_CODE (index) != INTEGER_CST - || (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))) != 0 - && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array)))) != INTEGER_CST)) - { - if (mark_addressable (array) == 0) - return error_mark_node; - } - /* An array that is indexed by a constant value which is not within - the array bounds cannot be stored in a register either; because we - would get a crash in store_bit_field/extract_bit_field when trying - to access a non-existent part of the register. */ - if (TREE_CODE (index) == INTEGER_CST - && TYPE_VALUES (TREE_TYPE (array)) - && ! int_fits_type_p (index, TYPE_VALUES (TREE_TYPE (array)))) - { - if (mark_addressable (array) == 0) - return error_mark_node; - } - - if (pedantic && !lvalue_p (array)) - { - if (DECL_REGISTER (array)) - pedwarn ("ANSI C forbids subscripting `register' array"); - else - pedwarn ("ANSI C forbids subscripting non-lvalue array"); - } - - if (pedantic) - { - tree foo = array; - while (TREE_CODE (foo) == COMPONENT_REF) - foo = TREE_OPERAND (foo, 0); - if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo)) - pedwarn ("ANSI C forbids subscripting non-lvalue array"); - } - - type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (array))); - rval = build (ARRAY_REF, type, array, index); - /* Array ref is const/volatile if the array elements are - or if the array is. */ - TREE_READONLY (rval) - |= (TYPE_READONLY (TREE_TYPE (TREE_TYPE (array))) - | TREE_READONLY (array)); - TREE_SIDE_EFFECTS (rval) - |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) - | TREE_SIDE_EFFECTS (array)); - TREE_THIS_VOLATILE (rval) - |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) - /* This was added by rms on 16 Nov 91. - It fixes vol struct foo *a; a->elts[1] - in an inline function. - Hope it doesn't break something else. */ - | TREE_THIS_VOLATILE (array)); - return require_complete_type (fold (rval)); - } - - { - tree ar = default_conversion (array); - tree ind = default_conversion (index); - - /* Do the same warning check as above, but only on the part that's - syntactically the index and only if it is also semantically - the index. */ - if (warn_char_subscripts - && TREE_CODE (TREE_TYPE (index)) == INTEGER_TYPE - && TYPE_MAIN_VARIANT (TREE_TYPE (index)) == char_type_node) - warning ("subscript has type `char'"); - - /* Put the integer in IND to simplify error checking. */ - if (TREE_CODE (TREE_TYPE (ar)) == INTEGER_TYPE) - { - tree temp = ar; - ar = ind; - ind = temp; - } - - if (ar == error_mark_node) - return ar; - - if (TREE_CODE (TREE_TYPE (ar)) != POINTER_TYPE - || TREE_CODE (TREE_TYPE (TREE_TYPE (ar))) == FUNCTION_TYPE) - { - error ("subscripted value is neither array nor pointer"); - return error_mark_node; - } - if (TREE_CODE (TREE_TYPE (ind)) != INTEGER_TYPE) - { - error ("array subscript is not an integer"); - return error_mark_node; - } - - return build_indirect_ref (build_binary_op (PLUS_EXPR, ar, ind, 0), - "array indexing"); - } -} - -/* Build a function call to function FUNCTION with parameters PARAMS. - PARAMS is a list--a chain of TREE_LIST nodes--in which the - TREE_VALUE of each node is a parameter-expression. - FUNCTION's data type may be a function type or a pointer-to-function. */ - -tree -build_function_call (function, params) - tree function, params; -{ - register tree fntype, fundecl = 0; - register tree coerced_params; - tree name = NULL_TREE, assembler_name = NULL_TREE; - - /* Strip NON_LVALUE_EXPRs, etc., since we aren't using as an lvalue. */ - STRIP_TYPE_NOPS (function); - - /* Convert anything with function type to a pointer-to-function. */ - if (TREE_CODE (function) == FUNCTION_DECL) - { - name = DECL_NAME (function); - assembler_name = DECL_ASSEMBLER_NAME (function); - - /* Differs from default_conversion by not setting TREE_ADDRESSABLE - (because calling an inline function does not mean the function - needs to be separately compiled). */ - fntype = build_type_variant (TREE_TYPE (function), - TREE_READONLY (function), - TREE_THIS_VOLATILE (function)); - fundecl = function; - function = build1 (ADDR_EXPR, build_pointer_type (fntype), function); - } - else - function = default_conversion (function); - - fntype = TREE_TYPE (function); - - if (TREE_CODE (fntype) == ERROR_MARK) - return error_mark_node; - - if (!(TREE_CODE (fntype) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE)) - { - error ("called object is not a function"); - return error_mark_node; - } - - /* fntype now gets the type of function pointed to. */ - fntype = TREE_TYPE (fntype); - - /* Convert the parameters to the types declared in the - function prototype, or apply default promotions. */ - - coerced_params - = convert_arguments (TYPE_ARG_TYPES (fntype), params, name, fundecl); - - /* Check for errors in format strings. */ - - if (warn_format && (name || assembler_name)) - check_function_format (name, assembler_name, coerced_params); - - /* Recognize certain built-in functions so we can make tree-codes - other than CALL_EXPR. We do this when it enables fold-const.c - to do something useful. */ - - if (TREE_CODE (function) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL - && DECL_BUILT_IN (TREE_OPERAND (function, 0))) - switch (DECL_FUNCTION_CODE (TREE_OPERAND (function, 0))) - { - case BUILT_IN_ABS: - case BUILT_IN_LABS: - case BUILT_IN_FABS: - if (coerced_params == 0) - return integer_zero_node; - return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0); - default: - break; - } - - { - register tree result - = build (CALL_EXPR, TREE_TYPE (fntype), - function, coerced_params, NULL_TREE); - - TREE_SIDE_EFFECTS (result) = 1; - if (TREE_TYPE (result) == void_type_node) - return result; - return require_complete_type (result); - } -} - -/* Convert the argument expressions in the list VALUES - to the types in the list TYPELIST. The result is a list of converted - argument expressions. - - If TYPELIST is exhausted, or when an element has NULL as its type, - perform the default conversions. - - PARMLIST is the chain of parm decls for the function being called. - It may be 0, if that info is not available. - It is used only for generating error messages. - - NAME is an IDENTIFIER_NODE or 0. It is used only for error messages. - - This is also where warnings about wrong number of args are generated. - - Both VALUES and the returned value are chains of TREE_LIST nodes - with the elements of the list in the TREE_VALUE slots of those nodes. */ - -static tree -convert_arguments (typelist, values, name, fundecl) - tree typelist, values, name, fundecl; -{ - register tree typetail, valtail; - register tree result = NULL; - int parmnum; - - /* Scan the given expressions and types, producing individual - converted arguments and pushing them on RESULT in reverse order. */ - - for (valtail = values, typetail = typelist, parmnum = 0; - valtail; - valtail = TREE_CHAIN (valtail), parmnum++) - { - register tree type = typetail ? TREE_VALUE (typetail) : 0; - register tree val = TREE_VALUE (valtail); - - if (type == void_type_node) - { - if (name) - error ("too many arguments to function `%s'", - IDENTIFIER_POINTER (name)); - else - error ("too many arguments to function"); - break; - } - - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ - /* Do not use STRIP_NOPS here! We do not want an enumerator with value 0 - to convert automatically to a pointer. */ - if (TREE_CODE (val) == NON_LVALUE_EXPR) - val = TREE_OPERAND (val, 0); - - if (TREE_CODE (TREE_TYPE (val)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (val)) == FUNCTION_TYPE) - val = default_conversion (val); - - val = require_complete_type (val); - - if (type != 0) - { - /* Formal parm type is specified by a function prototype. */ - tree parmval; - - if (TYPE_SIZE (type) == 0) - { - error ("type of formal parameter %d is incomplete", parmnum + 1); - parmval = val; - } - else - { - /* Optionally warn about conversions that - differ from the default conversions. */ - if (warn_conversion) - { - int formal_prec = TYPE_PRECISION (type); - - if (INTEGRAL_TYPE_P (type) - && TREE_CODE (TREE_TYPE (val)) == REAL_TYPE) - warn_for_assignment ("%s as integer rather than floating due to prototype", (char *) 0, name, parmnum + 1); - else if (TREE_CODE (type) == COMPLEX_TYPE - && TREE_CODE (TREE_TYPE (val)) == REAL_TYPE) - warn_for_assignment ("%s as complex rather than floating due to prototype", (char *) 0, name, parmnum + 1); - else if (TREE_CODE (type) == REAL_TYPE - && INTEGRAL_TYPE_P (TREE_TYPE (val))) - warn_for_assignment ("%s as floating rather than integer due to prototype", (char *) 0, name, parmnum + 1); - else if (TREE_CODE (type) == REAL_TYPE - && TREE_CODE (TREE_TYPE (val)) == COMPLEX_TYPE) - warn_for_assignment ("%s as floating rather than complex due to prototype", (char *) 0, name, parmnum + 1); - /* ??? At some point, messages should be written about - conversions between complex types, but that's too messy - to do now. */ - else if (TREE_CODE (type) == REAL_TYPE - && TREE_CODE (TREE_TYPE (val)) == REAL_TYPE) - { - /* Warn if any argument is passed as `float', - since without a prototype it would be `double'. */ - if (formal_prec == TYPE_PRECISION (float_type_node)) - warn_for_assignment ("%s as `float' rather than `double' due to prototype", (char *) 0, name, parmnum + 1); - } - /* Detect integer changing in width or signedness. */ - else if (INTEGRAL_TYPE_P (type) - && INTEGRAL_TYPE_P (TREE_TYPE (val))) - { - tree would_have_been = default_conversion (val); - tree type1 = TREE_TYPE (would_have_been); - - if (TREE_CODE (type) == ENUMERAL_TYPE - && type == TREE_TYPE (val)) - /* No warning if function asks for enum - and the actual arg is that enum type. */ - ; - else if (formal_prec != TYPE_PRECISION (type1)) - warn_for_assignment ("%s with different width due to prototype", (char *) 0, name, parmnum + 1); - else if (TREE_UNSIGNED (type) == TREE_UNSIGNED (type1)) - ; - /* Don't complain if the formal parameter type - is an enum, because we can't tell now whether - the value was an enum--even the same enum. */ - else if (TREE_CODE (type) == ENUMERAL_TYPE) - ; - else if (TREE_CODE (val) == INTEGER_CST - && int_fits_type_p (val, type)) - /* Change in signedness doesn't matter - if a constant value is unaffected. */ - ; - /* Likewise for a constant in a NOP_EXPR. */ - else if (TREE_CODE (val) == NOP_EXPR - && TREE_CODE (TREE_OPERAND (val, 0)) == INTEGER_CST - && int_fits_type_p (TREE_OPERAND (val, 0), type)) - ; -#if 0 /* We never get such tree structure here. */ - else if (TREE_CODE (TREE_TYPE (val)) == ENUMERAL_TYPE - && int_fits_type_p (TYPE_MIN_VALUE (TREE_TYPE (val)), type) - && int_fits_type_p (TYPE_MAX_VALUE (TREE_TYPE (val)), type)) - /* Change in signedness doesn't matter - if an enum value is unaffected. */ - ; -#endif - /* If the value is extended from a narrower - unsigned type, it doesn't matter whether we - pass it as signed or unsigned; the value - certainly is the same either way. */ - else if (TYPE_PRECISION (TREE_TYPE (val)) < TYPE_PRECISION (type) - && TREE_UNSIGNED (TREE_TYPE (val))) - ; - else if (TREE_UNSIGNED (type)) - warn_for_assignment ("%s as unsigned due to prototype", (char *) 0, name, parmnum + 1); - else - warn_for_assignment ("%s as signed due to prototype", (char *) 0, name, parmnum + 1); - } - } - - parmval = convert_for_assignment (type, val, - (char *) 0, /* arg passing */ - fundecl, name, parmnum + 1); - -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) - && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) - parmval = default_conversion (parmval); -#endif - } - result = tree_cons (NULL_TREE, parmval, result); - } - else if (TREE_CODE (TREE_TYPE (val)) == REAL_TYPE - && (TYPE_PRECISION (TREE_TYPE (val)) - < TYPE_PRECISION (double_type_node))) - /* Convert `float' to `double'. */ - result = tree_cons (NULL_TREE, convert (double_type_node, val), result); - else - /* Convert `short' and `char' to full-size `int'. */ - result = tree_cons (NULL_TREE, default_conversion (val), result); - - if (typetail) - typetail = TREE_CHAIN (typetail); - } - - if (typetail != 0 && TREE_VALUE (typetail) != void_type_node) - { - if (name) - error ("too few arguments to function `%s'", - IDENTIFIER_POINTER (name)); - else - error ("too few arguments to function"); - } - - return nreverse (result); -} - -/* This is the entry point used by the parser - for binary operators in the input. - In addition to constructing the expression, - we check for operands that were written with other binary operators - in a way that is likely to confuse the user. */ - -tree -parser_build_binary_op (code, arg1, arg2) - enum tree_code code; - tree arg1, arg2; -{ - tree result = build_binary_op (code, arg1, arg2, 1); - - char class; - char class1 = TREE_CODE_CLASS (TREE_CODE (arg1)); - char class2 = TREE_CODE_CLASS (TREE_CODE (arg2)); - enum tree_code code1 = ERROR_MARK; - enum tree_code code2 = ERROR_MARK; - - if (class1 == 'e' || class1 == '1' - || class1 == '2' || class1 == '<') - code1 = C_EXP_ORIGINAL_CODE (arg1); - if (class2 == 'e' || class2 == '1' - || class2 == '2' || class2 == '<') - code2 = C_EXP_ORIGINAL_CODE (arg2); - - /* Check for cases such as x+y< TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0))) - && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op1, 0)))) - { - final_type = result_type; - op1 = TREE_OPERAND (op1, 0); - result_type = TREE_TYPE (op1); - } - if (TREE_CODE (op1) == INTEGER_CST - && TREE_CODE (op0) == NOP_EXPR - && TYPE_PRECISION (type0) > TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0))) - && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0)))) - { - final_type = result_type; - op0 = TREE_OPERAND (op0, 0); - result_type = TREE_TYPE (op0); - } - break; - - case TRUNC_MOD_EXPR: - case FLOOR_MOD_EXPR: - if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) - { - /* Although it would be tempting to shorten always here, that loses - on some targets, since the modulo instruction is undefined if the - quotient can't be represented in the computation mode. We shorten - only if unsigned or if dividing by something we know != -1. */ - shorten = (TREE_UNSIGNED (TREE_TYPE (orig_op0)) - || (TREE_CODE (op1) == INTEGER_CST - && (TREE_INT_CST_LOW (op1) != -1 - || TREE_INT_CST_HIGH (op1) != -1))); - common = 1; - } - break; - - case TRUTH_ANDIF_EXPR: - case TRUTH_ORIF_EXPR: - case TRUTH_AND_EXPR: - case TRUTH_OR_EXPR: - case TRUTH_XOR_EXPR: - if ((code0 == INTEGER_TYPE || code0 == POINTER_TYPE - || code0 == REAL_TYPE || code0 == COMPLEX_TYPE) - && (code1 == INTEGER_TYPE || code1 == POINTER_TYPE - || code1 == REAL_TYPE || code1 == COMPLEX_TYPE)) - { - /* Result of these operations is always an int, - but that does not mean the operands should be - converted to ints! */ - result_type = integer_type_node; - op0 = truthvalue_conversion (op0); - op1 = truthvalue_conversion (op1); - converted = 1; - } - break; - - /* Shift operations: result has same type as first operand; - always convert second operand to int. - Also set SHORT_SHIFT if shifting rightward. */ - - case RSHIFT_EXPR: - if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) - { - if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0) - { - if (tree_int_cst_sgn (op1) < 0) - warning ("right shift count is negative"); - else - { - if (TREE_INT_CST_LOW (op1) | TREE_INT_CST_HIGH (op1)) - short_shift = 1; - if (TREE_INT_CST_HIGH (op1) != 0 - || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1) - >= TYPE_PRECISION (type0))) - warning ("right shift count >= width of type"); - } - } - /* Use the type of the value to be shifted. - This is what most traditional C compilers do. */ - result_type = type0; - /* Unless traditional, convert the shift-count to an integer, - regardless of size of value being shifted. */ - if (! flag_traditional) - { - if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node) - op1 = convert (integer_type_node, op1); - /* Avoid converting op1 to result_type later. */ - converted = 1; - } - } - break; - - case LSHIFT_EXPR: - if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) - { - if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0) - { - if (tree_int_cst_sgn (op1) < 0) - warning ("left shift count is negative"); - else if (TREE_INT_CST_HIGH (op1) != 0 - || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1) - >= TYPE_PRECISION (type0))) - warning ("left shift count >= width of type"); - } - /* Use the type of the value to be shifted. - This is what most traditional C compilers do. */ - result_type = type0; - /* Unless traditional, convert the shift-count to an integer, - regardless of size of value being shifted. */ - if (! flag_traditional) - { - if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node) - op1 = convert (integer_type_node, op1); - /* Avoid converting op1 to result_type later. */ - converted = 1; - } - } - break; - - case RROTATE_EXPR: - case LROTATE_EXPR: - if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) - { - if (TREE_CODE (op1) == INTEGER_CST && skip_evaluation == 0) - { - if (tree_int_cst_sgn (op1) < 0) - warning ("shift count is negative"); - else if (TREE_INT_CST_HIGH (op1) != 0 - || ((unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (op1) - >= TYPE_PRECISION (type0))) - warning ("shift count >= width of type"); - } - /* Use the type of the value to be shifted. - This is what most traditional C compilers do. */ - result_type = type0; - /* Unless traditional, convert the shift-count to an integer, - regardless of size of value being shifted. */ - if (! flag_traditional) - { - if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node) - op1 = convert (integer_type_node, op1); - /* Avoid converting op1 to result_type later. */ - converted = 1; - } - } - break; - - case EQ_EXPR: - case NE_EXPR: - /* Result of comparison is always int, - but don't convert the args to int! */ - build_type = integer_type_node; - if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE - || code0 == COMPLEX_TYPE) - && (code1 == INTEGER_TYPE || code1 == REAL_TYPE - || code1 == COMPLEX_TYPE)) - short_compare = 1; - else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE) - { - register tree tt0 = TREE_TYPE (type0); - register tree tt1 = TREE_TYPE (type1); - /* Anything compares with void *. void * compares with anything. - Otherwise, the targets must be compatible - and both must be object or both incomplete. */ - if (comp_target_types (type0, type1)) - result_type = common_type (type0, type1); - else if (TYPE_MAIN_VARIANT (tt0) == void_type_node) - { - /* op0 != orig_op0 detects the case of something - whose value is 0 but which isn't a valid null ptr const. */ - if (pedantic && (!integer_zerop (op0) || op0 != orig_op0) - && TREE_CODE (tt1) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids comparison of `void *' with function pointer"); - } - else if (TYPE_MAIN_VARIANT (tt1) == void_type_node) - { - if (pedantic && (!integer_zerop (op1) || op1 != orig_op1) - && TREE_CODE (tt0) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids comparison of `void *' with function pointer"); - } - else - pedwarn ("comparison of distinct pointer types lacks a cast"); - - if (result_type == NULL_TREE) - result_type = ptr_type_node; - } - else if (code0 == POINTER_TYPE && TREE_CODE (op1) == INTEGER_CST - && integer_zerop (op1)) - result_type = type0; - else if (code1 == POINTER_TYPE && TREE_CODE (op0) == INTEGER_CST - && integer_zerop (op0)) - result_type = type1; - else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) - { - result_type = type0; - if (! flag_traditional) - pedwarn ("comparison between pointer and integer"); - } - else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE) - { - result_type = type1; - if (! flag_traditional) - pedwarn ("comparison between pointer and integer"); - } - break; - - case MAX_EXPR: - case MIN_EXPR: - if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE) - && (code1 == INTEGER_TYPE || code1 == REAL_TYPE)) - shorten = 1; - else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE) - { - if (comp_target_types (type0, type1)) - { - result_type = common_type (type0, type1); - if (pedantic - && TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids ordered comparisons of pointers to functions"); - } - else - { - result_type = ptr_type_node; - pedwarn ("comparison of distinct pointer types lacks a cast"); - } - } - break; - - case LE_EXPR: - case GE_EXPR: - case LT_EXPR: - case GT_EXPR: - build_type = integer_type_node; - if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE) - && (code1 == INTEGER_TYPE || code1 == REAL_TYPE)) - short_compare = 1; - else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE) - { - if (comp_target_types (type0, type1)) - { - result_type = common_type (type0, type1); - if ((TYPE_SIZE (TREE_TYPE (type0)) != 0) - != (TYPE_SIZE (TREE_TYPE (type1)) != 0)) - pedwarn ("comparison of complete and incomplete pointers"); - else if (pedantic - && TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids ordered comparisons of pointers to functions"); - } - else - { - result_type = ptr_type_node; - pedwarn ("comparison of distinct pointer types lacks a cast"); - } - } - else if (code0 == POINTER_TYPE && TREE_CODE (op1) == INTEGER_CST - && integer_zerop (op1)) - { - result_type = type0; - if (pedantic || extra_warnings) - pedwarn ("ordered comparison of pointer with integer zero"); - } - else if (code1 == POINTER_TYPE && TREE_CODE (op0) == INTEGER_CST - && integer_zerop (op0)) - { - result_type = type1; - if (pedantic) - pedwarn ("ordered comparison of pointer with integer zero"); - } - else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE) - { - result_type = type0; - if (! flag_traditional) - pedwarn ("comparison between pointer and integer"); - } - else if (code0 == INTEGER_TYPE && code1 == POINTER_TYPE) - { - result_type = type1; - if (! flag_traditional) - pedwarn ("comparison between pointer and integer"); - } - break; - - default: - break; - } - - if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE) - && - (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE)) - { - int none_complex = (code0 != COMPLEX_TYPE && code1 != COMPLEX_TYPE); - - if (shorten || common || short_compare) - result_type = common_type (type0, type1); - - /* For certain operations (which identify themselves by shorten != 0) - if both args were extended from the same smaller type, - do the arithmetic in that type and then extend. - - shorten !=0 and !=1 indicates a bitwise operation. - For them, this optimization is safe only if - both args are zero-extended or both are sign-extended. - Otherwise, we might change the result. - Eg, (short)-1 | (unsigned short)-1 is (int)-1 - but calculated in (unsigned short) it would be (unsigned short)-1. */ - - if (shorten && none_complex) - { - int unsigned0, unsigned1; - tree arg0 = get_narrower (op0, &unsigned0); - tree arg1 = get_narrower (op1, &unsigned1); - /* UNS is 1 if the operation to be done is an unsigned one. */ - int uns = TREE_UNSIGNED (result_type); - tree type; - - final_type = result_type; - - /* Handle the case that OP0 (or OP1) does not *contain* a conversion - but it *requires* conversion to FINAL_TYPE. */ - - if ((TYPE_PRECISION (TREE_TYPE (op0)) - == TYPE_PRECISION (TREE_TYPE (arg0))) - && TREE_TYPE (op0) != final_type) - unsigned0 = TREE_UNSIGNED (TREE_TYPE (op0)); - if ((TYPE_PRECISION (TREE_TYPE (op1)) - == TYPE_PRECISION (TREE_TYPE (arg1))) - && TREE_TYPE (op1) != final_type) - unsigned1 = TREE_UNSIGNED (TREE_TYPE (op1)); - - /* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */ - - /* For bitwise operations, signedness of nominal type - does not matter. Consider only how operands were extended. */ - if (shorten == -1) - uns = unsigned0; - - /* Note that in all three cases below we refrain from optimizing - an unsigned operation on sign-extended args. - That would not be valid. */ - - /* Both args variable: if both extended in same way - from same width, do it in that width. - Do it unsigned if args were zero-extended. */ - if ((TYPE_PRECISION (TREE_TYPE (arg0)) - < TYPE_PRECISION (result_type)) - && (TYPE_PRECISION (TREE_TYPE (arg1)) - == TYPE_PRECISION (TREE_TYPE (arg0))) - && unsigned0 == unsigned1 - && (unsigned0 || !uns)) - result_type - = signed_or_unsigned_type (unsigned0, - common_type (TREE_TYPE (arg0), TREE_TYPE (arg1))); - else if (TREE_CODE (arg0) == INTEGER_CST - && (unsigned1 || !uns) - && (TYPE_PRECISION (TREE_TYPE (arg1)) - < TYPE_PRECISION (result_type)) - && (type = signed_or_unsigned_type (unsigned1, - TREE_TYPE (arg1)), - int_fits_type_p (arg0, type))) - result_type = type; - else if (TREE_CODE (arg1) == INTEGER_CST - && (unsigned0 || !uns) - && (TYPE_PRECISION (TREE_TYPE (arg0)) - < TYPE_PRECISION (result_type)) - && (type = signed_or_unsigned_type (unsigned0, - TREE_TYPE (arg0)), - int_fits_type_p (arg1, type))) - result_type = type; - } - - /* Shifts can be shortened if shifting right. */ - - if (short_shift) - { - int unsigned_arg; - tree arg0 = get_narrower (op0, &unsigned_arg); - - final_type = result_type; - - if (arg0 == op0 && final_type == TREE_TYPE (op0)) - unsigned_arg = TREE_UNSIGNED (TREE_TYPE (op0)); - - if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type) - /* We can shorten only if the shift count is less than the - number of bits in the smaller type size. */ - && TREE_INT_CST_HIGH (op1) == 0 - && TYPE_PRECISION (TREE_TYPE (arg0)) > TREE_INT_CST_LOW (op1) - /* If arg is sign-extended and then unsigned-shifted, - we can simulate this with a signed shift in arg's type - only if the extended result is at least twice as wide - as the arg. Otherwise, the shift could use up all the - ones made by sign-extension and bring in zeros. - We can't optimize that case at all, but in most machines - it never happens because available widths are 2**N. */ - && (!TREE_UNSIGNED (final_type) - || unsigned_arg - || 2 * TYPE_PRECISION (TREE_TYPE (arg0)) <= TYPE_PRECISION (result_type))) - { - /* Do an unsigned shift if the operand was zero-extended. */ - result_type - = signed_or_unsigned_type (unsigned_arg, - TREE_TYPE (arg0)); - /* Convert value-to-be-shifted to that type. */ - if (TREE_TYPE (op0) != result_type) - op0 = convert (result_type, op0); - converted = 1; - } - } - - /* Comparison operations are shortened too but differently. - They identify themselves by setting short_compare = 1. */ - - if (short_compare) - { - /* Don't write &op0, etc., because that would prevent op0 - from being kept in a register. - Instead, make copies of the our local variables and - pass the copies by reference, then copy them back afterward. */ - tree xop0 = op0, xop1 = op1, xresult_type = result_type; - enum tree_code xresultcode = resultcode; - tree val - = shorten_compare (&xop0, &xop1, &xresult_type, &xresultcode); - if (val != 0) - return val; - op0 = xop0, op1 = xop1; - converted = 1; - resultcode = xresultcode; - - if ((warn_sign_compare < 0 ? extra_warnings : warn_sign_compare != 0) - && skip_evaluation == 0) - { - int op0_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op0)); - int op1_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op1)); - - int unsignedp0, unsignedp1; - tree primop0 = get_narrower (op0, &unsignedp0); - tree primop1 = get_narrower (op1, &unsignedp1); - - /* Avoid spurious warnings for comparison with enumerators. */ - - xop0 = orig_op0; - xop1 = orig_op1; - STRIP_TYPE_NOPS (xop0); - STRIP_TYPE_NOPS (xop1); - - /* Give warnings for comparisons between signed and unsigned - quantities that may fail. */ - /* Do the checking based on the original operand trees, so that - casts will be considered, but default promotions won't be. */ - - /* Do not warn if the comparison is being done in a signed type, - since the signed type will only be chosen if it can represent - all the values of the unsigned type. */ - if (! TREE_UNSIGNED (result_type)) - /* OK */; - /* Do not warn if both operands are unsigned. */ - else if (op0_signed == op1_signed) - /* OK */; - /* Do not warn if the signed quantity is an unsuffixed - integer literal (or some static constant expression - involving such literals) and it is non-negative. */ - else if ((op0_signed && TREE_CODE (xop0) == INTEGER_CST - && tree_int_cst_sgn (xop0) >= 0) - || (op1_signed && TREE_CODE (xop1) == INTEGER_CST - && tree_int_cst_sgn (xop1) >= 0)) - /* OK */; - /* Do not warn if the comparison is an equality operation, - the unsigned quantity is an integral constant and it does - not use the most significant bit of result_type. */ - else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR) - && ((op0_signed && TREE_CODE (xop1) == INTEGER_CST - && int_fits_type_p (xop1, signed_type (result_type))) - || (op1_signed && TREE_CODE (xop0) == INTEGER_CST - && int_fits_type_p (xop0, signed_type (result_type))))) - /* OK */; - else - warning ("comparison between signed and unsigned"); - - /* Warn if two unsigned values are being compared in a size - larger than their original size, and one (and only one) is the - result of a `~' operator. This comparison will always fail. - - Also warn if one operand is a constant, and the constant - does not have all bits set that are set in the ~ operand - when it is extended. */ - - if ((TREE_CODE (primop0) == BIT_NOT_EXPR) - != (TREE_CODE (primop1) == BIT_NOT_EXPR)) - { - if (TREE_CODE (primop0) == BIT_NOT_EXPR) - primop0 = get_narrower (TREE_OPERAND (primop0, 0), - &unsignedp0); - else - primop1 = get_narrower (TREE_OPERAND (primop1, 0), - &unsignedp1); - - if (TREE_CODE (primop0) == INTEGER_CST - || TREE_CODE (primop1) == INTEGER_CST) - { - tree primop; - long constant, mask; - int unsignedp, bits; - - if (TREE_CODE (primop0) == INTEGER_CST) - { - primop = primop1; - unsignedp = unsignedp1; - constant = TREE_INT_CST_LOW (primop0); - } - else - { - primop = primop0; - unsignedp = unsignedp0; - constant = TREE_INT_CST_LOW (primop1); - } - - bits = TYPE_PRECISION (TREE_TYPE (primop)); - if (bits < TYPE_PRECISION (result_type) - && bits < HOST_BITS_PER_LONG && unsignedp) - { - mask = (~0L) << bits; - if ((mask & constant) != mask) - warning ("comparison of promoted ~unsigned with constant"); - } - } - else if (unsignedp0 && unsignedp1 - && (TYPE_PRECISION (TREE_TYPE (primop0)) - < TYPE_PRECISION (result_type)) - && (TYPE_PRECISION (TREE_TYPE (primop1)) - < TYPE_PRECISION (result_type))) - warning ("comparison of promoted ~unsigned with unsigned"); - } - } - } - } - - /* At this point, RESULT_TYPE must be nonzero to avoid an error message. - If CONVERTED is zero, both args will be converted to type RESULT_TYPE. - Then the expression will be built. - It will be given type FINAL_TYPE if that is nonzero; - otherwise, it will be given type RESULT_TYPE. */ - - if (!result_type) - { - binary_op_error (code); - return error_mark_node; - } - - if (! converted) - { - if (TREE_TYPE (op0) != result_type) - op0 = convert (result_type, op0); - if (TREE_TYPE (op1) != result_type) - op1 = convert (result_type, op1); - } - - if (build_type == NULL_TREE) - build_type = result_type; - - { - register tree result = build (resultcode, build_type, op0, op1); - register tree folded; - - folded = fold (result); - if (folded == result) - TREE_CONSTANT (folded) = TREE_CONSTANT (op0) & TREE_CONSTANT (op1); - if (final_type != 0) - return convert (final_type, folded); - return folded; - } -} - -/* Return a tree for the sum or difference (RESULTCODE says which) - of pointer PTROP and integer INTOP. */ - -static tree -pointer_int_sum (resultcode, ptrop, intop) - enum tree_code resultcode; - register tree ptrop, intop; -{ - tree size_exp; - - register tree result; - register tree folded; - - /* The result is a pointer of the same type that is being added. */ - - register tree result_type = TREE_TYPE (ptrop); - - if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE) - { - if (pedantic || warn_pointer_arith) - pedwarn ("pointer of type `void *' used in arithmetic"); - size_exp = integer_one_node; - } - else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE) - { - if (pedantic || warn_pointer_arith) - pedwarn ("pointer to a function used in arithmetic"); - size_exp = integer_one_node; - } - else - size_exp = c_size_in_bytes (TREE_TYPE (result_type)); - - /* If what we are about to multiply by the size of the elements - contains a constant term, apply distributive law - and multiply that constant term separately. - This helps produce common subexpressions. */ - - if ((TREE_CODE (intop) == PLUS_EXPR || TREE_CODE (intop) == MINUS_EXPR) - && ! TREE_CONSTANT (intop) - && TREE_CONSTANT (TREE_OPERAND (intop, 1)) - && TREE_CONSTANT (size_exp) - /* If the constant comes from pointer subtraction, - skip this optimization--it would cause an error. */ - && TREE_CODE (TREE_TYPE (TREE_OPERAND (intop, 0))) == INTEGER_TYPE - /* If the constant is unsigned, and smaller than the pointer size, - then we must skip this optimization. This is because it could cause - an overflow error if the constant is negative but INTOP is not. */ - && (! TREE_UNSIGNED (TREE_TYPE (intop)) - || (TYPE_PRECISION (TREE_TYPE (intop)) - == TYPE_PRECISION (TREE_TYPE (ptrop))))) - { - enum tree_code subcode = resultcode; - tree int_type = TREE_TYPE (intop); - if (TREE_CODE (intop) == MINUS_EXPR) - subcode = (subcode == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR); - /* Convert both subexpression types to the type of intop, - because weird cases involving pointer arithmetic - can result in a sum or difference with different type args. */ - ptrop = build_binary_op (subcode, ptrop, - convert (int_type, TREE_OPERAND (intop, 1)), 1); - intop = convert (int_type, TREE_OPERAND (intop, 0)); - } - - /* Convert the integer argument to a type the same size as sizetype - so the multiply won't overflow spuriously. */ - - if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype) - || TREE_UNSIGNED (TREE_TYPE (intop)) != TREE_UNSIGNED (sizetype)) - intop = convert (type_for_size (TYPE_PRECISION (sizetype), - TREE_UNSIGNED (sizetype)), intop); - - /* Replace the integer argument with a suitable product by the object size. - Do this multiplication as signed, then convert to the appropriate - pointer type (actually unsigned integral). */ - - intop = convert (result_type, - build_binary_op (MULT_EXPR, intop, - convert (TREE_TYPE (intop), size_exp), 1)); - - /* Create the sum or difference. */ - - result = build (resultcode, result_type, ptrop, intop); - - folded = fold (result); - if (folded == result) - TREE_CONSTANT (folded) = TREE_CONSTANT (ptrop) & TREE_CONSTANT (intop); - return folded; -} - -/* Return a tree for the difference of pointers OP0 and OP1. - The resulting tree has type int. */ - -static tree -pointer_diff (op0, op1) - register tree op0, op1; -{ - register tree result, folded; - tree restype = ptrdiff_type_node; - - tree target_type = TREE_TYPE (TREE_TYPE (op0)); - - if (pedantic || warn_pointer_arith) - { - if (TREE_CODE (target_type) == VOID_TYPE) - pedwarn ("pointer of type `void *' used in subtraction"); - if (TREE_CODE (target_type) == FUNCTION_TYPE) - pedwarn ("pointer to a function used in subtraction"); - } - - /* First do the subtraction as integers; - then drop through to build the divide operator. - Do not do default conversions on the minus operator - in case restype is a short type. */ - - op0 = build_binary_op (MINUS_EXPR, convert (restype, op0), - convert (restype, op1), 0); - /* This generates an error if op1 is pointer to incomplete type. */ - if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (op1))) == 0) - error ("arithmetic on pointer to an incomplete type"); - - /* This generates an error if op0 is pointer to incomplete type. */ - op1 = c_size_in_bytes (target_type); - - /* Divide by the size, in easiest possible way. */ - - result = build (EXACT_DIV_EXPR, restype, op0, convert (restype, op1)); - - folded = fold (result); - if (folded == result) - TREE_CONSTANT (folded) = TREE_CONSTANT (op0) & TREE_CONSTANT (op1); - return folded; -} - -/* Construct and perhaps optimize a tree representation - for a unary operation. CODE, a tree_code, specifies the operation - and XARG is the operand. NOCONVERT nonzero suppresses - the default promotions (such as from short to int). */ - -tree -build_unary_op (code, xarg, noconvert) - enum tree_code code; - tree xarg; - int noconvert; -{ - /* No default_conversion here. It causes trouble for ADDR_EXPR. */ - register tree arg = xarg; - register tree argtype = 0; - register enum tree_code typecode = TREE_CODE (TREE_TYPE (arg)); - tree val; - - if (typecode == ERROR_MARK) - return error_mark_node; - if (typecode == ENUMERAL_TYPE) - typecode = INTEGER_TYPE; - - switch (code) - { - case CONVERT_EXPR: - /* This is used for unary plus, because a CONVERT_EXPR - is enough to prevent anybody from looking inside for - associativity, but won't generate any code. */ - if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE - || typecode == COMPLEX_TYPE)) - { - error ("wrong type argument to unary plus"); - return error_mark_node; - } - else if (!noconvert) - arg = default_conversion (arg); - break; - - case NEGATE_EXPR: - if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE - || typecode == COMPLEX_TYPE)) - { - error ("wrong type argument to unary minus"); - return error_mark_node; - } - else if (!noconvert) - arg = default_conversion (arg); - break; - - case BIT_NOT_EXPR: - if (typecode == COMPLEX_TYPE) - { - code = CONJ_EXPR; - if (!noconvert) - arg = default_conversion (arg); - } - else if (typecode != INTEGER_TYPE) - { - error ("wrong type argument to bit-complement"); - return error_mark_node; - } - else if (!noconvert) - arg = default_conversion (arg); - break; - - case ABS_EXPR: - if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE - || typecode == COMPLEX_TYPE)) - { - error ("wrong type argument to abs"); - return error_mark_node; - } - else if (!noconvert) - arg = default_conversion (arg); - break; - - case CONJ_EXPR: - /* Conjugating a real value is a no-op, but allow it anyway. */ - if (!(typecode == INTEGER_TYPE || typecode == REAL_TYPE - || typecode == COMPLEX_TYPE)) - { - error ("wrong type argument to conjugation"); - return error_mark_node; - } - else if (!noconvert) - arg = default_conversion (arg); - break; - - case TRUTH_NOT_EXPR: - if (typecode != INTEGER_TYPE - && typecode != REAL_TYPE && typecode != POINTER_TYPE - && typecode != COMPLEX_TYPE - /* These will convert to a pointer. */ - && typecode != ARRAY_TYPE && typecode != FUNCTION_TYPE) - { - error ("wrong type argument to unary exclamation mark"); - return error_mark_node; - } - arg = truthvalue_conversion (arg); - return invert_truthvalue (arg); - - case NOP_EXPR: - break; - - case REALPART_EXPR: - if (TREE_CODE (arg) == COMPLEX_CST) - return TREE_REALPART (arg); - else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE) - return fold (build1 (REALPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg)); - else - return arg; - - case IMAGPART_EXPR: - if (TREE_CODE (arg) == COMPLEX_CST) - return TREE_IMAGPART (arg); - else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE) - return fold (build1 (IMAGPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg)); - else - return convert (TREE_TYPE (arg), integer_zero_node); - - case PREINCREMENT_EXPR: - case POSTINCREMENT_EXPR: - case PREDECREMENT_EXPR: - case POSTDECREMENT_EXPR: - /* Handle complex lvalues (when permitted) - by reduction to simpler cases. */ - - val = unary_complex_lvalue (code, arg); - if (val != 0) - return val; - - /* Increment or decrement the real part of the value, - and don't change the imaginary part. */ - if (typecode == COMPLEX_TYPE) - { - tree real, imag; - - arg = stabilize_reference (arg); - real = build_unary_op (REALPART_EXPR, arg, 1); - imag = build_unary_op (IMAGPART_EXPR, arg, 1); - return build (COMPLEX_EXPR, TREE_TYPE (arg), - build_unary_op (code, real, 1), imag); - } - - /* Report invalid types. */ - - if (typecode != POINTER_TYPE - && typecode != INTEGER_TYPE && typecode != REAL_TYPE) - { - error (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR - ? "wrong type argument to increment" - : "wrong type argument to decrement"); - return error_mark_node; - } - - { - register tree inc; - tree result_type = TREE_TYPE (arg); - - arg = get_unwidened (arg, 0); - argtype = TREE_TYPE (arg); - - /* Compute the increment. */ - - if (typecode == POINTER_TYPE) - { - /* If pointer target is an undefined struct, - we just cannot know how to do the arithmetic. */ - if (TYPE_SIZE (TREE_TYPE (result_type)) == 0) - error (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR - ? "increment of pointer to unknown structure" - : "decrement of pointer to unknown structure"); - else if ((pedantic || warn_pointer_arith) - && (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE - || TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)) - pedwarn (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR - ? "wrong type argument to increment" - : "wrong type argument to decrement"); - inc = c_size_in_bytes (TREE_TYPE (result_type)); - } - else - inc = integer_one_node; - - inc = convert (argtype, inc); - - /* Handle incrementing a cast-expression. */ - - while (1) - switch (TREE_CODE (arg)) - { - case NOP_EXPR: - case CONVERT_EXPR: - case FLOAT_EXPR: - case FIX_TRUNC_EXPR: - case FIX_FLOOR_EXPR: - case FIX_ROUND_EXPR: - case FIX_CEIL_EXPR: - pedantic_lvalue_warning (CONVERT_EXPR); - /* If the real type has the same machine representation - as the type it is cast to, we can make better output - by adding directly to the inside of the cast. */ - if ((TREE_CODE (TREE_TYPE (arg)) - == TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0)))) - && (TYPE_MODE (TREE_TYPE (arg)) - == TYPE_MODE (TREE_TYPE (TREE_OPERAND (arg, 0))))) - arg = TREE_OPERAND (arg, 0); - else - { - tree incremented, modify, value; - arg = stabilize_reference (arg); - if (code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR) - value = arg; - else - value = save_expr (arg); - incremented = build (((code == PREINCREMENT_EXPR - || code == POSTINCREMENT_EXPR) - ? PLUS_EXPR : MINUS_EXPR), - argtype, value, inc); - TREE_SIDE_EFFECTS (incremented) = 1; - modify = build_modify_expr (arg, NOP_EXPR, incremented); - value = build (COMPOUND_EXPR, TREE_TYPE (arg), modify, value); - TREE_USED (value) = 1; - return value; - } - break; - - default: - goto give_up; - } - give_up: - - /* Complain about anything else that is not a true lvalue. */ - if (!lvalue_or_else (arg, ((code == PREINCREMENT_EXPR - || code == POSTINCREMENT_EXPR) - ? "invalid lvalue in increment" - : "invalid lvalue in decrement"))) - return error_mark_node; - - /* Report a read-only lvalue. */ - if (TREE_READONLY (arg)) - readonly_warning (arg, - ((code == PREINCREMENT_EXPR - || code == POSTINCREMENT_EXPR) - ? "increment" : "decrement")); - - val = build (code, TREE_TYPE (arg), arg, inc); - TREE_SIDE_EFFECTS (val) = 1; - val = convert (result_type, val); - if (TREE_CODE (val) != code) - TREE_NO_UNUSED_WARNING (val) = 1; - return val; - } - - case ADDR_EXPR: - /* Note that this operation never does default_conversion - regardless of NOCONVERT. */ - - /* Let &* cancel out to simplify resulting code. */ - if (TREE_CODE (arg) == INDIRECT_REF) - { - /* Don't let this be an lvalue. */ - if (lvalue_p (TREE_OPERAND (arg, 0))) - return non_lvalue (TREE_OPERAND (arg, 0)); - return TREE_OPERAND (arg, 0); - } - - /* For &x[y], return x+y */ - if (TREE_CODE (arg) == ARRAY_REF) - { - if (mark_addressable (TREE_OPERAND (arg, 0)) == 0) - return error_mark_node; - return build_binary_op (PLUS_EXPR, TREE_OPERAND (arg, 0), - TREE_OPERAND (arg, 1), 1); - } - - /* Handle complex lvalues (when permitted) - by reduction to simpler cases. */ - val = unary_complex_lvalue (code, arg); - if (val != 0) - return val; - -#if 0 /* Turned off because inconsistent; - float f; *&(int)f = 3.4 stores in int format - whereas (int)f = 3.4 stores in float format. */ - /* Address of a cast is just a cast of the address - of the operand of the cast. */ - switch (TREE_CODE (arg)) - { - case NOP_EXPR: - case CONVERT_EXPR: - case FLOAT_EXPR: - case FIX_TRUNC_EXPR: - case FIX_FLOOR_EXPR: - case FIX_ROUND_EXPR: - case FIX_CEIL_EXPR: - if (pedantic) - pedwarn ("ANSI C forbids the address of a cast expression"); - return convert (build_pointer_type (TREE_TYPE (arg)), - build_unary_op (ADDR_EXPR, TREE_OPERAND (arg, 0), - 0)); - } -#endif - - /* Allow the address of a constructor if all the elements - are constant. */ - if (TREE_CODE (arg) == CONSTRUCTOR && TREE_CONSTANT (arg)) - ; - /* Anything not already handled and not a true memory reference - is an error. */ - else if (typecode != FUNCTION_TYPE - && !lvalue_or_else (arg, "invalid lvalue in unary `&'")) - return error_mark_node; - - /* Ordinary case; arg is a COMPONENT_REF or a decl. */ - argtype = TREE_TYPE (arg); - /* If the lvalue is const or volatile, merge that into the type - to which the address will point. Note that you can't get a - restricted pointer by taking the address of something, so we - only have to deal with `const' and `volatile' here. */ - if (TREE_CODE_CLASS (TREE_CODE (arg)) == 'd' - || TREE_CODE_CLASS (TREE_CODE (arg)) == 'r') - { - if (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg)) - argtype = c_build_type_variant (argtype, - TREE_READONLY (arg), - TREE_THIS_VOLATILE (arg)); - } - - argtype = build_pointer_type (argtype); - - if (mark_addressable (arg) == 0) - return error_mark_node; - - { - tree addr; - - if (TREE_CODE (arg) == COMPONENT_REF) - { - tree field = TREE_OPERAND (arg, 1); - - addr = build_unary_op (ADDR_EXPR, TREE_OPERAND (arg, 0), 0); - - if (DECL_C_BIT_FIELD (field)) - { - error ("attempt to take address of bit-field structure member `%s'", - IDENTIFIER_POINTER (DECL_NAME (field))); - return error_mark_node; - } - - addr = convert (argtype, addr); - - if (! integer_zerop (DECL_FIELD_BITPOS (field))) - { - tree offset - = size_binop (EASY_DIV_EXPR, DECL_FIELD_BITPOS (field), - size_int (BITS_PER_UNIT)); - int flag = TREE_CONSTANT (addr); - addr = fold (build (PLUS_EXPR, argtype, - addr, convert (argtype, offset))); - TREE_CONSTANT (addr) = flag; - } - } - else - addr = build1 (code, argtype, arg); - - /* Address of a static or external variable or - file-scope function counts as a constant. */ - if (staticp (arg) - && ! (TREE_CODE (arg) == FUNCTION_DECL - && DECL_CONTEXT (arg) != 0)) - TREE_CONSTANT (addr) = 1; - return addr; - } - - default: - break; - } - - if (argtype == 0) - argtype = TREE_TYPE (arg); - return fold (build1 (code, argtype, arg)); -} - -#if 0 -/* If CONVERSIONS is a conversion expression or a nested sequence of such, - convert ARG with the same conversions in the same order - and return the result. */ - -static tree -convert_sequence (conversions, arg) - tree conversions; - tree arg; -{ - switch (TREE_CODE (conversions)) - { - case NOP_EXPR: - case CONVERT_EXPR: - case FLOAT_EXPR: - case FIX_TRUNC_EXPR: - case FIX_FLOOR_EXPR: - case FIX_ROUND_EXPR: - case FIX_CEIL_EXPR: - return convert (TREE_TYPE (conversions), - convert_sequence (TREE_OPERAND (conversions, 0), - arg)); - - default: - return arg; - } -} -#endif /* 0 */ - -/* Return nonzero if REF is an lvalue valid for this language. - Lvalues can be assigned, unless their type has TYPE_READONLY. - Lvalues can have their address taken, unless they have DECL_REGISTER. */ - -int -lvalue_p (ref) - tree ref; -{ - register enum tree_code code = TREE_CODE (ref); - - switch (code) - { - case REALPART_EXPR: - case IMAGPART_EXPR: - case COMPONENT_REF: - return lvalue_p (TREE_OPERAND (ref, 0)); - - case STRING_CST: - return 1; - - case INDIRECT_REF: - case ARRAY_REF: - case VAR_DECL: - case PARM_DECL: - case RESULT_DECL: - case ERROR_MARK: - return (TREE_CODE (TREE_TYPE (ref)) != FUNCTION_TYPE - && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE); - - case BIND_EXPR: - case RTL_EXPR: - return TREE_CODE (TREE_TYPE (ref)) == ARRAY_TYPE; - - default: - return 0; - } -} - -/* Return nonzero if REF is an lvalue valid for this language; - otherwise, print an error message and return zero. */ - -int -lvalue_or_else (ref, msgid) - tree ref; - const char *msgid; -{ - int win = lvalue_p (ref); - if (! win) - error (msgid); - return win; -} - -/* Apply unary lvalue-demanding operator CODE to the expression ARG - for certain kinds of expressions which are not really lvalues - but which we can accept as lvalues. - - If ARG is not a kind of expression we can handle, return zero. */ - -static tree -unary_complex_lvalue (code, arg) - enum tree_code code; - tree arg; -{ - /* Handle (a, b) used as an "lvalue". */ - if (TREE_CODE (arg) == COMPOUND_EXPR) - { - tree real_result = build_unary_op (code, TREE_OPERAND (arg, 1), 0); - - /* If this returns a function type, it isn't really being used as - an lvalue, so don't issue a warning about it. */ - if (TREE_CODE (TREE_TYPE (arg)) != FUNCTION_TYPE) - pedantic_lvalue_warning (COMPOUND_EXPR); - - return build (COMPOUND_EXPR, TREE_TYPE (real_result), - TREE_OPERAND (arg, 0), real_result); - } - - /* Handle (a ? b : c) used as an "lvalue". */ - if (TREE_CODE (arg) == COND_EXPR) - { - pedantic_lvalue_warning (COND_EXPR); - if (TREE_CODE (TREE_TYPE (arg)) != FUNCTION_TYPE) - pedantic_lvalue_warning (COMPOUND_EXPR); - - return (build_conditional_expr - (TREE_OPERAND (arg, 0), - build_unary_op (code, TREE_OPERAND (arg, 1), 0), - build_unary_op (code, TREE_OPERAND (arg, 2), 0))); - } - - return 0; -} - -/* If pedantic, warn about improper lvalue. CODE is either COND_EXPR - COMPOUND_EXPR, or CONVERT_EXPR (for casts). */ - -static void -pedantic_lvalue_warning (code) - enum tree_code code; -{ - if (pedantic) - pedwarn (code == COND_EXPR - ? "ANSI C forbids use of conditional expressions as lvalues" - : code == COMPOUND_EXPR - ? "ANSI C forbids use of compound expressions as lvalues" - : "ANSI C forbids use of cast expressions as lvalues"); -} - -/* Warn about storing in something that is `const'. */ - -void -readonly_warning (arg, msgid) - tree arg; - const char *msgid; -{ - /* Forbid assignments to iterators. */ - if (TREE_CODE (arg) == VAR_DECL && ITERATOR_P (arg)) - pedwarn ("%s of iterator `%s'", _(msgid), - IDENTIFIER_POINTER (DECL_NAME (arg))); - - if (TREE_CODE (arg) == COMPONENT_REF) - { - if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0)))) - readonly_warning (TREE_OPERAND (arg, 0), msgid); - else - pedwarn ("%s of read-only member `%s'", _(msgid), - IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (arg, 1)))); - } - else if (TREE_CODE (arg) == VAR_DECL) - pedwarn ("%s of read-only variable `%s'", _(msgid), - IDENTIFIER_POINTER (DECL_NAME (arg))); - else - pedwarn ("%s of read-only location", _(msgid)); -} - -/* Mark EXP saying that we need to be able to take the - address of it; it should not be allocated in a register. - Value is 1 if successful. */ - -int -mark_addressable (exp) - tree exp; -{ - register tree x = exp; - while (1) - switch (TREE_CODE (x)) - { - case COMPONENT_REF: - if (DECL_C_BIT_FIELD (TREE_OPERAND (x, 1))) - { - error ("cannot take address of bitfield `%s'", - IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (x, 1)))); - return 0; - } - - /* ... fall through ... */ - - case ADDR_EXPR: - case ARRAY_REF: - case REALPART_EXPR: - case IMAGPART_EXPR: - x = TREE_OPERAND (x, 0); - break; - - case CONSTRUCTOR: - TREE_ADDRESSABLE (x) = 1; - return 1; - - case VAR_DECL: - case CONST_DECL: - case PARM_DECL: - case RESULT_DECL: - if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x) - && DECL_NONLOCAL (x)) - { - if (TREE_PUBLIC (x)) - { - error ("global register variable `%s' used in nested function", - IDENTIFIER_POINTER (DECL_NAME (x))); - return 0; - } - pedwarn ("register variable `%s' used in nested function", - IDENTIFIER_POINTER (DECL_NAME (x))); - } - else if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)) - { - if (TREE_PUBLIC (x)) - { - error ("address of global register variable `%s' requested", - IDENTIFIER_POINTER (DECL_NAME (x))); - return 0; - } - - /* If we are making this addressable due to its having - volatile components, give a different error message. Also - handle the case of an unnamed parameter by not trying - to give the name. */ - - else if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (x))) - { - error ("cannot put object with volatile field into register"); - return 0; - } - - pedwarn ("address of register variable `%s' requested", - IDENTIFIER_POINTER (DECL_NAME (x))); - } - put_var_into_stack (x); - - /* drops in */ - case FUNCTION_DECL: - TREE_ADDRESSABLE (x) = 1; -#if 0 /* poplevel deals with this now. */ - if (DECL_CONTEXT (x) == 0) - TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (x)) = 1; -#endif - - default: - return 1; - } -} - -/* Build and return a conditional expression IFEXP ? OP1 : OP2. */ - -tree -build_conditional_expr (ifexp, op1, op2) - tree ifexp, op1, op2; -{ - register tree type1; - register tree type2; - register enum tree_code code1; - register enum tree_code code2; - register tree result_type = NULL; - tree orig_op1 = op1, orig_op2 = op2; - - ifexp = truthvalue_conversion (default_conversion (ifexp)); - -#if 0 /* Produces wrong result if within sizeof. */ - /* Don't promote the operands separately if they promote - the same way. Return the unpromoted type and let the combined - value get promoted if necessary. */ - - if (TREE_TYPE (op1) == TREE_TYPE (op2) - && TREE_CODE (TREE_TYPE (op1)) != ARRAY_TYPE - && TREE_CODE (TREE_TYPE (op1)) != ENUMERAL_TYPE - && TREE_CODE (TREE_TYPE (op1)) != FUNCTION_TYPE) - { - if (TREE_CODE (ifexp) == INTEGER_CST) - return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1); - - return fold (build (COND_EXPR, TREE_TYPE (op1), ifexp, op1, op2)); - } -#endif - - /* Promote both alternatives. */ - - if (TREE_CODE (TREE_TYPE (op1)) != VOID_TYPE) - op1 = default_conversion (op1); - if (TREE_CODE (TREE_TYPE (op2)) != VOID_TYPE) - op2 = default_conversion (op2); - - if (TREE_CODE (ifexp) == ERROR_MARK - || TREE_CODE (TREE_TYPE (op1)) == ERROR_MARK - || TREE_CODE (TREE_TYPE (op2)) == ERROR_MARK) - return error_mark_node; - - type1 = TREE_TYPE (op1); - code1 = TREE_CODE (type1); - type2 = TREE_TYPE (op2); - code2 = TREE_CODE (type2); - - /* Quickly detect the usual case where op1 and op2 have the same type - after promotion. */ - if (TYPE_MAIN_VARIANT (type1) == TYPE_MAIN_VARIANT (type2)) - { - if (type1 == type2) - result_type = type1; - else - result_type = TYPE_MAIN_VARIANT (type1); - } - else if ((code1 == INTEGER_TYPE || code1 == REAL_TYPE) - && (code2 == INTEGER_TYPE || code2 == REAL_TYPE)) - { - result_type = common_type (type1, type2); - } - else if (code1 == VOID_TYPE || code2 == VOID_TYPE) - { - if (pedantic && (code1 != VOID_TYPE || code2 != VOID_TYPE)) - pedwarn ("ANSI C forbids conditional expr with only one void side"); - result_type = void_type_node; - } - else if (code1 == POINTER_TYPE && code2 == POINTER_TYPE) - { - if (comp_target_types (type1, type2)) - result_type = common_type (type1, type2); - else if (integer_zerop (op1) && TREE_TYPE (type1) == void_type_node - && TREE_CODE (orig_op1) != NOP_EXPR) - result_type = qualify_type (type2, type1); - else if (integer_zerop (op2) && TREE_TYPE (type2) == void_type_node - && TREE_CODE (orig_op2) != NOP_EXPR) - result_type = qualify_type (type1, type2); - else if (TYPE_MAIN_VARIANT (TREE_TYPE (type1)) == void_type_node) - { - if (pedantic && TREE_CODE (TREE_TYPE (type2)) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids conditional expr between `void *' and function pointer"); - result_type = qualify_type (type1, type2); - } - else if (TYPE_MAIN_VARIANT (TREE_TYPE (type2)) == void_type_node) - { - if (pedantic && TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids conditional expr between `void *' and function pointer"); - result_type = qualify_type (type2, type1); - } - else - { - pedwarn ("pointer type mismatch in conditional expression"); - result_type = build_pointer_type (void_type_node); - } - } - else if (code1 == POINTER_TYPE && code2 == INTEGER_TYPE) - { - if (! integer_zerop (op2)) - pedwarn ("pointer/integer type mismatch in conditional expression"); - else - { - op2 = null_pointer_node; -#if 0 /* The spec seems to say this is permitted. */ - if (pedantic && TREE_CODE (type1) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids conditional expr between 0 and function pointer"); -#endif - } - result_type = type1; - } - else if (code2 == POINTER_TYPE && code1 == INTEGER_TYPE) - { - if (!integer_zerop (op1)) - pedwarn ("pointer/integer type mismatch in conditional expression"); - else - { - op1 = null_pointer_node; -#if 0 /* The spec seems to say this is permitted. */ - if (pedantic && TREE_CODE (type2) == FUNCTION_TYPE) - pedwarn ("ANSI C forbids conditional expr between 0 and function pointer"); -#endif - } - result_type = type2; - } - - if (!result_type) - { - if (flag_cond_mismatch) - result_type = void_type_node; - else - { - error ("type mismatch in conditional expression"); - return error_mark_node; - } - } - - /* Merge const and volatile flags of the incoming types. */ - result_type - = build_type_variant (result_type, - TREE_READONLY (op1) || TREE_READONLY (op2), - TREE_THIS_VOLATILE (op1) || TREE_THIS_VOLATILE (op2)); - - if (result_type != TREE_TYPE (op1)) - op1 = convert_and_check (result_type, op1); - if (result_type != TREE_TYPE (op2)) - op2 = convert_and_check (result_type, op2); - -#if 0 - if (code1 == RECORD_TYPE || code1 == UNION_TYPE) - { - result_type = TREE_TYPE (op1); - if (TREE_CONSTANT (ifexp)) - return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1); - - if (TYPE_MODE (result_type) == BLKmode) - { - register tree tempvar - = build_decl (VAR_DECL, NULL_TREE, result_type); - register tree xop1 = build_modify_expr (tempvar, op1); - register tree xop2 = build_modify_expr (tempvar, op2); - register tree result = fold (build (COND_EXPR, result_type, - ifexp, xop1, xop2)); - - layout_decl (tempvar, TYPE_ALIGN (result_type)); - /* No way to handle variable-sized objects here. - I fear that the entire handling of BLKmode conditional exprs - needs to be redone. */ - if (TREE_CODE (DECL_SIZE (tempvar)) != INTEGER_CST) - abort (); - DECL_RTL (tempvar) - = assign_stack_local (DECL_MODE (tempvar), - (TREE_INT_CST_LOW (DECL_SIZE (tempvar)) - + BITS_PER_UNIT - 1) - / BITS_PER_UNIT, - 0); - - TREE_SIDE_EFFECTS (result) - = TREE_SIDE_EFFECTS (ifexp) | TREE_SIDE_EFFECTS (op1) - | TREE_SIDE_EFFECTS (op2); - return build (COMPOUND_EXPR, result_type, result, tempvar); - } - } -#endif /* 0 */ - - if (TREE_CODE (ifexp) == INTEGER_CST) - return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1); - - return fold (build (COND_EXPR, result_type, ifexp, op1, op2)); -} - -/* Given a list of expressions, return a compound expression - that performs them all and returns the value of the last of them. */ - -tree -build_compound_expr (list) - tree list; -{ - return internal_build_compound_expr (list, TRUE); -} - -static tree -internal_build_compound_expr (list, first_p) - tree list; - int first_p; -{ - register tree rest; - - if (TREE_CHAIN (list) == 0) - { -#if 0 /* If something inside inhibited lvalueness, we should not override. */ - /* Consider (x, y+0), which is not an lvalue since y+0 is not. */ - - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ - if (TREE_CODE (list) == NON_LVALUE_EXPR) - list = TREE_OPERAND (list, 0); -#endif - - /* Don't let (0, 0) be null pointer constant. */ - if (!first_p && integer_zerop (TREE_VALUE (list))) - return non_lvalue (TREE_VALUE (list)); - return TREE_VALUE (list); - } - - if (TREE_CHAIN (list) != 0 && TREE_CHAIN (TREE_CHAIN (list)) == 0) - { - /* Convert arrays to pointers when there really is a comma operator. */ - if (TREE_CODE (TREE_TYPE (TREE_VALUE (TREE_CHAIN (list)))) == ARRAY_TYPE) - TREE_VALUE (TREE_CHAIN (list)) - = default_conversion (TREE_VALUE (TREE_CHAIN (list))); - } - - rest = internal_build_compound_expr (TREE_CHAIN (list), FALSE); - - if (! TREE_SIDE_EFFECTS (TREE_VALUE (list))) - { - /* The left-hand operand of a comma expression is like an expression - statement: with -W or -Wunused, we should warn if it doesn't have - any side-effects, unless it was explicitly cast to (void). */ - if ((extra_warnings || warn_unused) - && ! (TREE_CODE (TREE_VALUE (list)) == CONVERT_EXPR - && TREE_TYPE (TREE_VALUE (list)) == void_type_node)) - warning ("left-hand operand of comma expression has no effect"); - - /* When pedantic, a compound expression can be neither an lvalue - nor an integer constant expression. */ - if (! pedantic) - return rest; - } - - /* With -Wunused, we should also warn if the left-hand operand does have - side-effects, but computes a value which is not used. For example, in - `foo() + bar(), baz()' the result of the `+' operator is not used, - so we should issue a warning. */ - else if (warn_unused) - warn_if_unused_value (TREE_VALUE (list)); - - return build (COMPOUND_EXPR, TREE_TYPE (rest), TREE_VALUE (list), rest); -} - -/* Build an expression representing a cast to type TYPE of expression EXPR. */ - -tree -build_c_cast (type, expr) - register tree type; - tree expr; -{ - register tree value = expr; - - if (type == error_mark_node || expr == error_mark_node) - return error_mark_node; - type = TYPE_MAIN_VARIANT (type); - -#if 0 - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ - if (TREE_CODE (value) == NON_LVALUE_EXPR) - value = TREE_OPERAND (value, 0); -#endif - - if (TREE_CODE (type) == ARRAY_TYPE) - { - error ("cast specifies array type"); - return error_mark_node; - } - - if (TREE_CODE (type) == FUNCTION_TYPE) - { - error ("cast specifies function type"); - return error_mark_node; - } - - if (type == TREE_TYPE (value)) - { - if (pedantic) - { - if (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE) - pedwarn ("ANSI C forbids casting nonscalar to the same type"); - } - } - else if (TREE_CODE (type) == UNION_TYPE) - { - tree field; - if (TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE) - value = default_conversion (value); - - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) - if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (field)), - TYPE_MAIN_VARIANT (TREE_TYPE (value)))) - break; - - if (field) - { - const char *name; - tree t; - - if (pedantic) - pedwarn ("ANSI C forbids casts to union type"); - if (TYPE_NAME (type) != 0) - { - if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) - name = IDENTIFIER_POINTER (TYPE_NAME (type)); - else - name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); - } - else - name = ""; - t = digest_init (type, build (CONSTRUCTOR, type, NULL_TREE, - build_tree_list (field, value)), - 0, 0); - TREE_CONSTANT (t) = TREE_CONSTANT (value); - return t; - } - error ("cast to union type from type not present in union"); - return error_mark_node; - } - else - { - tree otype, ovalue; - - /* If casting to void, avoid the error that would come - from default_conversion in the case of a non-lvalue array. */ - if (type == void_type_node) - return build1 (CONVERT_EXPR, type, value); - - /* Convert functions and arrays to pointers, - but don't convert any other types. */ - if (TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE - || TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE) - value = default_conversion (value); - otype = TREE_TYPE (value); - - /* Optionally warn about potentially worrisome casts. */ - - if (warn_cast_qual - && TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (otype) == POINTER_TYPE) - { - /* Go to the innermost object being pointed to. */ - tree in_type = type; - tree in_otype = otype; - - while (TREE_CODE (in_type) == POINTER_TYPE) - in_type = TREE_TYPE (in_type); - while (TREE_CODE (in_otype) == POINTER_TYPE) - in_otype = TREE_TYPE (in_otype); - - if (TYPE_QUALS (in_otype) & ~TYPE_QUALS (in_type)) - /* There are qualifiers present in IN_OTYPE that are not - present in IN_TYPE. */ - pedwarn ("cast discards qualifiers from pointer target type"); - } - - /* Warn about possible alignment problems. */ - if (STRICT_ALIGNMENT && warn_cast_align - && TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (otype) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE - && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE - /* Don't warn about opaque types, where the actual alignment - restriction is unknown. */ - && !((TREE_CODE (TREE_TYPE (otype)) == UNION_TYPE - || TREE_CODE (TREE_TYPE (otype)) == RECORD_TYPE) - && TYPE_MODE (TREE_TYPE (otype)) == VOIDmode) - && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype))) - warning ("cast increases required alignment of target type"); - - if (TREE_CODE (type) == INTEGER_TYPE - && TREE_CODE (otype) == POINTER_TYPE - && TYPE_PRECISION (type) != TYPE_PRECISION (otype) - && !TREE_CONSTANT (value)) - warning ("cast from pointer to integer of different size"); - - if (warn_bad_function_cast - && TREE_CODE (value) == CALL_EXPR - && TREE_CODE (type) != TREE_CODE (otype)) - warning ("cast does not match function type"); - - if (TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (otype) == INTEGER_TYPE - && TYPE_PRECISION (type) != TYPE_PRECISION (otype) -#if 0 - /* Don't warn about converting 0 to pointer, - provided the 0 was explicit--not cast or made by folding. */ - && !(TREE_CODE (value) == INTEGER_CST && integer_zerop (value)) -#endif - /* Don't warn about converting any constant. */ - && !TREE_CONSTANT (value)) - warning ("cast to pointer from integer of different size"); - - ovalue = value; - value = convert (type, value); - - /* Ignore any integer overflow caused by the cast. */ - if (TREE_CODE (value) == INTEGER_CST) - { - TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue); - TREE_CONSTANT_OVERFLOW (value) = TREE_CONSTANT_OVERFLOW (ovalue); - } - } - - /* Pedantically, don't ley (void *) (FOO *) 0 be a null pointer constant. */ - if (pedantic && TREE_CODE (value) == INTEGER_CST - && TREE_CODE (expr) == INTEGER_CST - && TREE_CODE (TREE_TYPE (expr)) != INTEGER_TYPE) - value = non_lvalue (value); - - /* If pedantic, don't let a cast be an lvalue. */ - if (value == expr && pedantic) - value = non_lvalue (value); - - return value; -} - -/* Build an assignment expression of lvalue LHS from value RHS. - MODIFYCODE is the code for a binary operator that we use - to combine the old value of LHS with RHS to get the new value. - Or else MODIFYCODE is NOP_EXPR meaning do a simple assignment. */ - -tree -build_modify_expr (lhs, modifycode, rhs) - tree lhs, rhs; - enum tree_code modifycode; -{ - register tree result; - tree newrhs; - tree lhstype = TREE_TYPE (lhs); - tree olhstype = lhstype; - - /* Types that aren't fully specified cannot be used in assignments. */ - lhs = require_complete_type (lhs); - - /* Avoid duplicate error messages from operands that had errors. */ - if (TREE_CODE (lhs) == ERROR_MARK || TREE_CODE (rhs) == ERROR_MARK) - return error_mark_node; - - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ - /* Do not use STRIP_NOPS here. We do not want an enumerator - whose value is 0 to count as a null pointer constant. */ - if (TREE_CODE (rhs) == NON_LVALUE_EXPR) - rhs = TREE_OPERAND (rhs, 0); - - newrhs = rhs; - - /* Handle control structure constructs used as "lvalues". */ - - switch (TREE_CODE (lhs)) - { - /* Handle (a, b) used as an "lvalue". */ - case COMPOUND_EXPR: - pedantic_lvalue_warning (COMPOUND_EXPR); - newrhs = build_modify_expr (TREE_OPERAND (lhs, 1), - modifycode, rhs); - if (TREE_CODE (newrhs) == ERROR_MARK) - return error_mark_node; - return build (COMPOUND_EXPR, lhstype, - TREE_OPERAND (lhs, 0), newrhs); - - /* Handle (a ? b : c) used as an "lvalue". */ - case COND_EXPR: - pedantic_lvalue_warning (COND_EXPR); - rhs = save_expr (rhs); - { - /* Produce (a ? (b = rhs) : (c = rhs)) - except that the RHS goes through a save-expr - so the code to compute it is only emitted once. */ - tree cond - = build_conditional_expr (TREE_OPERAND (lhs, 0), - build_modify_expr (TREE_OPERAND (lhs, 1), - modifycode, rhs), - build_modify_expr (TREE_OPERAND (lhs, 2), - modifycode, rhs)); - if (TREE_CODE (cond) == ERROR_MARK) - return cond; - /* Make sure the code to compute the rhs comes out - before the split. */ - return build (COMPOUND_EXPR, TREE_TYPE (lhs), - /* But cast it to void to avoid an "unused" error. */ - convert (void_type_node, rhs), cond); - } - default: - break; - } - - /* If a binary op has been requested, combine the old LHS value with the RHS - producing the value we should actually store into the LHS. */ - - if (modifycode != NOP_EXPR) - { - lhs = stabilize_reference (lhs); - newrhs = build_binary_op (modifycode, lhs, rhs, 1); - } - - /* Handle a cast used as an "lvalue". - We have already performed any binary operator using the value as cast. - Now convert the result to the cast type of the lhs, - and then true type of the lhs and store it there; - then convert result back to the cast type to be the value - of the assignment. */ - - switch (TREE_CODE (lhs)) - { - case NOP_EXPR: - case CONVERT_EXPR: - case FLOAT_EXPR: - case FIX_TRUNC_EXPR: - case FIX_FLOOR_EXPR: - case FIX_ROUND_EXPR: - case FIX_CEIL_EXPR: - if (TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (newrhs)) == FUNCTION_TYPE) - newrhs = default_conversion (newrhs); - { - tree inner_lhs = TREE_OPERAND (lhs, 0); - tree result; - result = build_modify_expr (inner_lhs, NOP_EXPR, - convert (TREE_TYPE (inner_lhs), - convert (lhstype, newrhs))); - if (TREE_CODE (result) == ERROR_MARK) - return result; - pedantic_lvalue_warning (CONVERT_EXPR); - return convert (TREE_TYPE (lhs), result); - } - - default: - break; - } - - /* Now we have handled acceptable kinds of LHS that are not truly lvalues. - Reject anything strange now. */ - - if (!lvalue_or_else (lhs, "invalid lvalue in assignment")) - return error_mark_node; - - /* Warn about storing in something that is `const'. */ - - if (TREE_READONLY (lhs) || TYPE_READONLY (lhstype) - || ((TREE_CODE (lhstype) == RECORD_TYPE - || TREE_CODE (lhstype) == UNION_TYPE) - && C_TYPE_FIELDS_READONLY (lhstype))) - readonly_warning (lhs, "assignment"); - - /* If storing into a structure or union member, - it has probably been given type `int'. - Compute the type that would go with - the actual amount of storage the member occupies. */ - - if (TREE_CODE (lhs) == COMPONENT_REF - && (TREE_CODE (lhstype) == INTEGER_TYPE - || TREE_CODE (lhstype) == REAL_TYPE - || TREE_CODE (lhstype) == ENUMERAL_TYPE)) - lhstype = TREE_TYPE (get_unwidened (lhs, 0)); - - /* If storing in a field that is in actuality a short or narrower than one, - we must store in the field in its actual type. */ - - if (lhstype != TREE_TYPE (lhs)) - { - lhs = copy_node (lhs); - TREE_TYPE (lhs) = lhstype; - } - - /* Convert new value to destination type. */ - - newrhs = convert_for_assignment (lhstype, newrhs, _("assignment"), - NULL_TREE, NULL_TREE, 0); - if (TREE_CODE (newrhs) == ERROR_MARK) - return error_mark_node; - - result = build (MODIFY_EXPR, lhstype, lhs, newrhs); - TREE_SIDE_EFFECTS (result) = 1; - - /* If we got the LHS in a different type for storing in, - convert the result back to the nominal type of LHS - so that the value we return always has the same type - as the LHS argument. */ - - if (olhstype == TREE_TYPE (result)) - return result; - return convert_for_assignment (olhstype, result, _("assignment"), - NULL_TREE, NULL_TREE, 0); -} - -/* Convert value RHS to type TYPE as preparation for an assignment - to an lvalue of type TYPE. - The real work of conversion is done by `convert'. - The purpose of this function is to generate error messages - for assignments that are not allowed in C. - ERRTYPE is a string to use in error messages: - "assignment", "return", etc. If it is null, this is parameter passing - for a function call (and different error messages are output). - - FUNNAME is the name of the function being called, - as an IDENTIFIER_NODE, or null. - PARMNUM is the number of the argument, for printing in error messages. */ - -static tree -convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum) - tree type, rhs; - const char *errtype; - tree fundecl, funname; - int parmnum; -{ - register enum tree_code codel = TREE_CODE (type); - register tree rhstype; - register enum tree_code coder; - - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ - /* Do not use STRIP_NOPS here. We do not want an enumerator - whose value is 0 to count as a null pointer constant. */ - if (TREE_CODE (rhs) == NON_LVALUE_EXPR) - rhs = TREE_OPERAND (rhs, 0); - - if (TREE_CODE (TREE_TYPE (rhs)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (rhs)) == FUNCTION_TYPE) - rhs = default_conversion (rhs); - else if (optimize && TREE_CODE (rhs) == VAR_DECL) - rhs = decl_constant_value (rhs); - - rhstype = TREE_TYPE (rhs); - coder = TREE_CODE (rhstype); - - if (coder == ERROR_MARK) - return error_mark_node; - - if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype)) - { - overflow_warning (rhs); - /* Check for Objective-C protocols. This will issue a warning if - there are protocol violations. No need to use the return value. */ - maybe_objc_comptypes (type, rhstype, 0); - return rhs; - } - - if (coder == VOID_TYPE) - { - error ("void value not ignored as it ought to be"); - return error_mark_node; - } - /* Arithmetic types all interconvert, and enum is treated like int. */ - if ((codel == INTEGER_TYPE || codel == REAL_TYPE || codel == ENUMERAL_TYPE - || codel == COMPLEX_TYPE) - && (coder == INTEGER_TYPE || coder == REAL_TYPE || coder == ENUMERAL_TYPE - || coder == COMPLEX_TYPE)) - return convert_and_check (type, rhs); - - /* Conversion to a transparent union from its member types. - This applies only to function arguments. */ - else if (codel == UNION_TYPE && TYPE_TRANSPARENT_UNION (type) && ! errtype) - { - tree memb_types; - tree marginal_memb_type = 0; - - for (memb_types = TYPE_FIELDS (type); memb_types; - memb_types = TREE_CHAIN (memb_types)) - { - tree memb_type = TREE_TYPE (memb_types); - - if (comptypes (TYPE_MAIN_VARIANT (memb_type), - TYPE_MAIN_VARIANT (rhstype))) - break; - - if (TREE_CODE (memb_type) != POINTER_TYPE) - continue; - - if (coder == POINTER_TYPE) - { - register tree ttl = TREE_TYPE (memb_type); - register tree ttr = TREE_TYPE (rhstype); - - /* Any non-function converts to a [const][volatile] void * - and vice versa; otherwise, targets must be the same. - Meanwhile, the lhs target must have all the qualifiers of - the rhs. */ - if (TYPE_MAIN_VARIANT (ttl) == void_type_node - || TYPE_MAIN_VARIANT (ttr) == void_type_node - || comp_target_types (memb_type, rhstype)) - { - /* If this type won't generate any warnings, use it. */ - if (TYPE_QUALS (ttl) == TYPE_QUALS (ttr) - || ((TREE_CODE (ttr) == FUNCTION_TYPE - && TREE_CODE (ttl) == FUNCTION_TYPE) - ? ((TYPE_QUALS (ttl) | TYPE_QUALS (ttr)) - == TYPE_QUALS (ttr)) - : ((TYPE_QUALS (ttl) | TYPE_QUALS (ttr)) - == TYPE_QUALS (ttl)))) - break; - - /* Keep looking for a better type, but remember this one. */ - if (! marginal_memb_type) - marginal_memb_type = memb_type; - } - } - - /* Can convert integer zero to any pointer type. */ - if (integer_zerop (rhs) - || (TREE_CODE (rhs) == NOP_EXPR - && integer_zerop (TREE_OPERAND (rhs, 0)))) - { - rhs = null_pointer_node; - break; - } - } - - if (memb_types || marginal_memb_type) - { - if (! memb_types) - { - /* We have only a marginally acceptable member type; - it needs a warning. */ - register tree ttl = TREE_TYPE (marginal_memb_type); - register tree ttr = TREE_TYPE (rhstype); - - /* Const and volatile mean something different for function - types, so the usual warnings are not appropriate. */ - if (TREE_CODE (ttr) == FUNCTION_TYPE - && TREE_CODE (ttl) == FUNCTION_TYPE) - { - /* Because const and volatile on functions are - restrictions that say the function will not do - certain things, it is okay to use a const or volatile - function where an ordinary one is wanted, but not - vice-versa. */ - if (TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr)) - warn_for_assignment ("%s makes qualified function pointer from unqualified", - errtype, funname, parmnum); - } - else if (TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)) - warn_for_assignment ("%s discards qualifiers from pointer target type", - errtype, funname, - parmnum); - } - - if (pedantic && ! DECL_IN_SYSTEM_HEADER (fundecl)) - pedwarn ("ANSI C prohibits argument conversion to union type"); - - return build1 (NOP_EXPR, type, rhs); - } - } - - /* Conversions among pointers */ - else if (codel == POINTER_TYPE && coder == POINTER_TYPE) - { - register tree ttl = TREE_TYPE (type); - register tree ttr = TREE_TYPE (rhstype); - - /* Any non-function converts to a [const][volatile] void * - and vice versa; otherwise, targets must be the same. - Meanwhile, the lhs target must have all the qualifiers of the rhs. */ - if (TYPE_MAIN_VARIANT (ttl) == void_type_node - || TYPE_MAIN_VARIANT (ttr) == void_type_node - || comp_target_types (type, rhstype) - || (unsigned_type (TYPE_MAIN_VARIANT (ttl)) - == unsigned_type (TYPE_MAIN_VARIANT (ttr)))) - { - if (pedantic - && ((TYPE_MAIN_VARIANT (ttl) == void_type_node - && TREE_CODE (ttr) == FUNCTION_TYPE) - || - (TYPE_MAIN_VARIANT (ttr) == void_type_node - /* Check TREE_CODE to catch cases like (void *) (char *) 0 - which are not ANSI null ptr constants. */ - && (!integer_zerop (rhs) || TREE_CODE (rhs) == NOP_EXPR) - && TREE_CODE (ttl) == FUNCTION_TYPE))) - warn_for_assignment ("ANSI forbids %s between function pointer and `void *'", - errtype, funname, parmnum); - /* Const and volatile mean something different for function types, - so the usual warnings are not appropriate. */ - else if (TREE_CODE (ttr) != FUNCTION_TYPE - && TREE_CODE (ttl) != FUNCTION_TYPE) - { - if (TYPE_QUALS (ttr) & ~TYPE_QUALS (ttl)) - warn_for_assignment ("%s discards qualifiers from pointer target type", - errtype, funname, parmnum); - /* If this is not a case of ignoring a mismatch in signedness, - no warning. */ - else if (TYPE_MAIN_VARIANT (ttl) == void_type_node - || TYPE_MAIN_VARIANT (ttr) == void_type_node - || comp_target_types (type, rhstype)) - ; - /* If there is a mismatch, do warn. */ - else if (pedantic) - warn_for_assignment ("pointer targets in %s differ in signedness", - errtype, funname, parmnum); - } - else if (TREE_CODE (ttl) == FUNCTION_TYPE - && TREE_CODE (ttr) == FUNCTION_TYPE) - { - /* Because const and volatile on functions are restrictions - that say the function will not do certain things, - it is okay to use a const or volatile function - where an ordinary one is wanted, but not vice-versa. */ - if (TYPE_QUALS (ttl) & ~TYPE_QUALS (ttr)) - warn_for_assignment ("%s makes qualified function pointer from unqualified", - errtype, funname, parmnum); - } - } - else - warn_for_assignment ("%s from incompatible pointer type", - errtype, funname, parmnum); - return convert (type, rhs); - } - else if (codel == POINTER_TYPE && coder == INTEGER_TYPE) - { - /* An explicit constant 0 can convert to a pointer, - or one that results from arithmetic, even including - a cast to integer type. */ - if (! (TREE_CODE (rhs) == INTEGER_CST && integer_zerop (rhs)) - && - ! (TREE_CODE (rhs) == NOP_EXPR - && TREE_CODE (TREE_TYPE (rhs)) == INTEGER_TYPE - && TREE_CODE (TREE_OPERAND (rhs, 0)) == INTEGER_CST - && integer_zerop (TREE_OPERAND (rhs, 0)))) - { - warn_for_assignment ("%s makes pointer from integer without a cast", - errtype, funname, parmnum); - return convert (type, rhs); - } - return null_pointer_node; - } - else if (codel == INTEGER_TYPE && coder == POINTER_TYPE) - { - warn_for_assignment ("%s makes integer from pointer without a cast", - errtype, funname, parmnum); - return convert (type, rhs); - } - - if (!errtype) - { - if (funname) - { - tree selector = maybe_building_objc_message_expr (); - - if (selector && parmnum > 2) - error ("incompatible type for argument %d of `%s'", - parmnum - 2, IDENTIFIER_POINTER (selector)); - else - error ("incompatible type for argument %d of `%s'", - parmnum, IDENTIFIER_POINTER (funname)); - } - else - error ("incompatible type for argument %d of indirect function call", - parmnum); - } - else - error ("incompatible types in %s", errtype); - - return error_mark_node; -} - -/* Print a warning using MSGID. - It gets OPNAME as its one parameter. - If OPNAME is null, it is replaced by "passing arg ARGNUM of `FUNCTION'". - FUNCTION and ARGNUM are handled specially if we are building an - Objective-C selector. */ - -static void -warn_for_assignment (msgid, opname, function, argnum) - const char *msgid; - const char *opname; - tree function; - int argnum; -{ - if (opname == 0) - { - tree selector = maybe_building_objc_message_expr (); - char * new_opname; - - if (selector && argnum > 2) - { - function = selector; - argnum -= 2; - } - if (function) - { - /* Function name is known; supply it. */ - const char *argstring = _("passing arg %d of `%s'"); - new_opname = (char *) alloca (IDENTIFIER_LENGTH (function) - + strlen (argstring) + 1 + 25 - /*%d*/ + 1); - sprintf (new_opname, argstring, argnum, - IDENTIFIER_POINTER (function)); - } - else - { - /* Function name unknown (call through ptr); just give arg number.*/ - const char *argnofun = _("passing arg %d of pointer to function"); - new_opname = (char *) alloca (strlen (argnofun) + 1 + 25 /*%d*/ + 1); - sprintf (new_opname, argnofun, argnum); - } - opname = new_opname; - } - pedwarn (msgid, opname); -} - -/* Return nonzero if VALUE is a valid constant-valued expression - for use in initializing a static variable; one that can be an - element of a "constant" initializer. - - Return null_pointer_node if the value is absolute; - if it is relocatable, return the variable that determines the relocation. - We assume that VALUE has been folded as much as possible; - therefore, we do not need to check for such things as - arithmetic-combinations of integers. */ - -tree -initializer_constant_valid_p (value, endtype) - tree value; - tree endtype; -{ - switch (TREE_CODE (value)) - { - case CONSTRUCTOR: - if ((TREE_CODE (TREE_TYPE (value)) == UNION_TYPE - || TREE_CODE (TREE_TYPE (value)) == RECORD_TYPE) - && TREE_CONSTANT (value) - && CONSTRUCTOR_ELTS (value)) - return - initializer_constant_valid_p (TREE_VALUE (CONSTRUCTOR_ELTS (value)), - endtype); - - return TREE_STATIC (value) ? null_pointer_node : 0; - - case INTEGER_CST: - case REAL_CST: - case STRING_CST: - case COMPLEX_CST: - return null_pointer_node; - - case ADDR_EXPR: - return TREE_OPERAND (value, 0); - - case NON_LVALUE_EXPR: - return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype); - - case CONVERT_EXPR: - case NOP_EXPR: - /* Allow conversions between pointer types. */ - if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == POINTER_TYPE) - return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype); - - /* Allow conversions between real types. */ - if (TREE_CODE (TREE_TYPE (value)) == REAL_TYPE - && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == REAL_TYPE) - return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype); - - /* Allow length-preserving conversions between integer types. */ - if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE - && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE - && (TYPE_PRECISION (TREE_TYPE (value)) - == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0))))) - return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype); - - /* Allow conversions between other integer types only if - explicit value. */ - if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE - && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE) - { - tree inner = initializer_constant_valid_p (TREE_OPERAND (value, 0), - endtype); - if (inner == null_pointer_node) - return null_pointer_node; - return 0; - } - - /* Allow (int) &foo provided int is as wide as a pointer. */ - if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE - && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == POINTER_TYPE - && (TYPE_PRECISION (TREE_TYPE (value)) - >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0))))) - return initializer_constant_valid_p (TREE_OPERAND (value, 0), - endtype); - - /* Likewise conversions from int to pointers, but also allow - conversions from 0. */ - if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == INTEGER_TYPE) - { - if (integer_zerop (TREE_OPERAND (value, 0))) - return null_pointer_node; - else if (TYPE_PRECISION (TREE_TYPE (value)) - <= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (value, 0)))) - return initializer_constant_valid_p (TREE_OPERAND (value, 0), - endtype); - } - - /* Allow conversions to union types if the value inside is okay. */ - if (TREE_CODE (TREE_TYPE (value)) == UNION_TYPE) - return initializer_constant_valid_p (TREE_OPERAND (value, 0), - endtype); - return 0; - - case PLUS_EXPR: - if (TREE_CODE (endtype) == INTEGER_TYPE - && TYPE_PRECISION (endtype) < POINTER_SIZE) - return 0; - { - tree valid0 = initializer_constant_valid_p (TREE_OPERAND (value, 0), - endtype); - tree valid1 = initializer_constant_valid_p (TREE_OPERAND (value, 1), - endtype); - /* If either term is absolute, use the other terms relocation. */ - if (valid0 == null_pointer_node) - return valid1; - if (valid1 == null_pointer_node) - return valid0; - return 0; - } - - case MINUS_EXPR: - if (TREE_CODE (endtype) == INTEGER_TYPE - && TYPE_PRECISION (endtype) < POINTER_SIZE) - return 0; - { - tree valid0 = initializer_constant_valid_p (TREE_OPERAND (value, 0), - endtype); - tree valid1 = initializer_constant_valid_p (TREE_OPERAND (value, 1), - endtype); - /* Win if second argument is absolute. */ - if (valid1 == null_pointer_node) - return valid0; - /* Win if both arguments have the same relocation. - Then the value is absolute. */ - if (valid0 == valid1) - return null_pointer_node; - return 0; - } - - default: - return 0; - } -} - -/* If VALUE is a compound expr all of whose expressions are constant, then - return its value. Otherwise, return error_mark_node. - - This is for handling COMPOUND_EXPRs as initializer elements - which is allowed with a warning when -pedantic is specified. */ - -static tree -valid_compound_expr_initializer (value, endtype) - tree value; - tree endtype; -{ - if (TREE_CODE (value) == COMPOUND_EXPR) - { - if (valid_compound_expr_initializer (TREE_OPERAND (value, 0), endtype) - == error_mark_node) - return error_mark_node; - return valid_compound_expr_initializer (TREE_OPERAND (value, 1), - endtype); - } - else if (! TREE_CONSTANT (value) - && ! initializer_constant_valid_p (value, endtype)) - return error_mark_node; - else - return value; -} - -/* Perform appropriate conversions on the initial value of a variable, - store it in the declaration DECL, - and print any error messages that are appropriate. - If the init is invalid, store an ERROR_MARK. */ - -void -store_init_value (decl, init) - tree decl, init; -{ - register tree value, type; - - /* If variable's type was invalidly declared, just ignore it. */ - - type = TREE_TYPE (decl); - if (TREE_CODE (type) == ERROR_MARK) - return; - - /* Digest the specified initializer into an expression. */ - - value = digest_init (type, init, TREE_STATIC (decl), - TREE_STATIC (decl) || pedantic); - - /* Store the expression if valid; else report error. */ - -#if 0 - /* Note that this is the only place we can detect the error - in a case such as struct foo bar = (struct foo) { x, y }; - where there is one initial value which is a constructor expression. */ - if (value == error_mark_node) - ; - else if (TREE_STATIC (decl) && ! TREE_CONSTANT (value)) - { - error ("initializer for static variable is not constant"); - value = error_mark_node; - } - else if (TREE_STATIC (decl) - && initializer_constant_valid_p (value, TREE_TYPE (value)) == 0) - { - error ("initializer for static variable uses complicated arithmetic"); - value = error_mark_node; - } - else - { - if (pedantic && TREE_CODE (value) == CONSTRUCTOR) - { - if (! TREE_CONSTANT (value)) - pedwarn ("aggregate initializer is not constant"); - else if (! TREE_STATIC (value)) - pedwarn ("aggregate initializer uses complicated arithmetic"); - } - } -#endif - - DECL_INITIAL (decl) = value; - - /* ANSI wants warnings about out-of-range constant initializers. */ - STRIP_TYPE_NOPS (value); - constant_expression_warning (value); -} - -/* Methods for storing and printing names for error messages. */ - -/* Implement a spelling stack that allows components of a name to be pushed - and popped. Each element on the stack is this structure. */ - -struct spelling -{ - int kind; - union - { - int i; - const char *s; - } u; -}; - -#define SPELLING_STRING 1 -#define SPELLING_MEMBER 2 -#define SPELLING_BOUNDS 3 - -static struct spelling *spelling; /* Next stack element (unused). */ -static struct spelling *spelling_base; /* Spelling stack base. */ -static int spelling_size; /* Size of the spelling stack. */ - -/* Macros to save and restore the spelling stack around push_... functions. - Alternative to SAVE_SPELLING_STACK. */ - -#define SPELLING_DEPTH() (spelling - spelling_base) -#define RESTORE_SPELLING_DEPTH(depth) (spelling = spelling_base + depth) - -/* Save and restore the spelling stack around arbitrary C code. */ - -#define SAVE_SPELLING_DEPTH(code) \ -{ \ - int __depth = SPELLING_DEPTH (); \ - code; \ - RESTORE_SPELLING_DEPTH (__depth); \ -} - -/* Push an element on the spelling stack with type KIND and assign VALUE - to MEMBER. */ - -#define PUSH_SPELLING(KIND, VALUE, MEMBER) \ -{ \ - int depth = SPELLING_DEPTH (); \ - \ - if (depth >= spelling_size) \ - { \ - spelling_size += 10; \ - if (spelling_base == 0) \ - spelling_base \ - = (struct spelling *) xmalloc (spelling_size * sizeof (struct spelling)); \ - else \ - spelling_base \ - = (struct spelling *) xrealloc (spelling_base, \ - spelling_size * sizeof (struct spelling)); \ - RESTORE_SPELLING_DEPTH (depth); \ - } \ - \ - spelling->kind = (KIND); \ - spelling->MEMBER = (VALUE); \ - spelling++; \ -} - -/* Push STRING on the stack. Printed literally. */ - -static void -push_string (string) - const char *string; -{ - PUSH_SPELLING (SPELLING_STRING, string, u.s); -} - -/* Push a member name on the stack. Printed as '.' STRING. */ - -static void -push_member_name (decl) - tree decl; - -{ - const char *string - = DECL_NAME (decl) ? IDENTIFIER_POINTER (DECL_NAME (decl)) : ""; - PUSH_SPELLING (SPELLING_MEMBER, string, u.s); -} - -/* Push an array bounds on the stack. Printed as [BOUNDS]. */ - -static void -push_array_bounds (bounds) - int bounds; -{ - PUSH_SPELLING (SPELLING_BOUNDS, bounds, u.i); -} - -/* Compute the maximum size in bytes of the printed spelling. */ - -static int -spelling_length () -{ - register int size = 0; - register struct spelling *p; - - for (p = spelling_base; p < spelling; p++) - { - if (p->kind == SPELLING_BOUNDS) - size += 25; - else - size += strlen (p->u.s) + 1; - } - - return size; -} - -/* Print the spelling to BUFFER and return it. */ - -static char * -print_spelling (buffer) - register char *buffer; -{ - register char *d = buffer; - register struct spelling *p; - - for (p = spelling_base; p < spelling; p++) - if (p->kind == SPELLING_BOUNDS) - { - sprintf (d, "[%d]", p->u.i); - d += strlen (d); - } - else - { - register const char *s; - if (p->kind == SPELLING_MEMBER) - *d++ = '.'; - for (s = p->u.s; (*d = *s++); d++) - ; - } - *d++ = '\0'; - return buffer; -} - -/* Issue an error message for a bad initializer component. - MSGID identifies the message. - The component name is taken from the spelling stack. */ - -void -error_init (msgid) - const char *msgid; -{ - char *ofwhat; - - error (msgid); - ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); - if (*ofwhat) - error ("(near initialization for `%s')", ofwhat); -} - -/* Issue a pedantic warning for a bad initializer component. - MSGID identifies the message. - The component name is taken from the spelling stack. */ - -void -pedwarn_init (msgid) - const char *msgid; -{ - char *ofwhat; - - pedwarn (msgid); - ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); - if (*ofwhat) - pedwarn ("(near initialization for `%s')", ofwhat); -} - -/* Issue a warning for a bad initializer component. - MSGID identifies the message. - The component name is taken from the spelling stack. */ - -static void -warning_init (msgid) - const char *msgid; -{ - char *ofwhat; - - warning (msgid); - ofwhat = print_spelling ((char *) alloca (spelling_length () + 1)); - if (*ofwhat) - warning ("(near initialization for `%s')", ofwhat); -} - -/* Digest the parser output INIT as an initializer for type TYPE. - Return a C expression of type TYPE to represent the initial value. - - The arguments REQUIRE_CONSTANT and CONSTRUCTOR_CONSTANT request errors - if non-constant initializers or elements are seen. CONSTRUCTOR_CONSTANT - applies only to elements of constructors. */ - -static tree -digest_init (type, init, require_constant, constructor_constant) - tree type, init; - int require_constant, constructor_constant; -{ - enum tree_code code = TREE_CODE (type); - tree inside_init = init; - - if (init == error_mark_node) - return init; - - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ - /* Do not use STRIP_NOPS here. We do not want an enumerator - whose value is 0 to count as a null pointer constant. */ - if (TREE_CODE (init) == NON_LVALUE_EXPR) - inside_init = TREE_OPERAND (init, 0); - - /* Initialization of an array of chars from a string constant - optionally enclosed in braces. */ - - if (code == ARRAY_TYPE) - { - tree typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (type)); - if ((typ1 == char_type_node - || typ1 == signed_char_type_node - || typ1 == unsigned_char_type_node - || typ1 == unsigned_wchar_type_node - || typ1 == signed_wchar_type_node) - && ((inside_init && TREE_CODE (inside_init) == STRING_CST))) - { - if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), - TYPE_MAIN_VARIANT (type))) - return inside_init; - - if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init))) - != char_type_node) - && TYPE_PRECISION (typ1) == TYPE_PRECISION (char_type_node)) - { - error_init ("char-array initialized from wide string"); - return error_mark_node; - } - if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init))) - == char_type_node) - && TYPE_PRECISION (typ1) != TYPE_PRECISION (char_type_node)) - { - error_init ("int-array initialized from non-wide string"); - return error_mark_node; - } - - TREE_TYPE (inside_init) = type; - if (TYPE_DOMAIN (type) != 0 - && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST) - { - register int size = TREE_INT_CST_LOW (TYPE_SIZE (type)); - size = (size + BITS_PER_UNIT - 1) / BITS_PER_UNIT; - /* Subtract 1 (or sizeof (wchar_t)) - because it's ok to ignore the terminating null char - that is counted in the length of the constant. */ - if (size < TREE_STRING_LENGTH (inside_init) - - (TYPE_PRECISION (typ1) != TYPE_PRECISION (char_type_node) - ? TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT - : 1)) - pedwarn_init ("initializer-string for array of chars is too long"); - } - return inside_init; - } - } - - /* Any type can be initialized - from an expression of the same type, optionally with braces. */ - - if (inside_init && TREE_TYPE (inside_init) != 0 - && (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), - TYPE_MAIN_VARIANT (type)) - || (code == ARRAY_TYPE - && comptypes (TREE_TYPE (inside_init), type)) - || (code == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (inside_init)) == FUNCTION_TYPE) - && comptypes (TREE_TYPE (TREE_TYPE (inside_init)), - TREE_TYPE (type))))) - { - if (code == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (inside_init)) == FUNCTION_TYPE)) - inside_init = default_conversion (inside_init); - else if (code == ARRAY_TYPE && TREE_CODE (inside_init) != STRING_CST - && TREE_CODE (inside_init) != CONSTRUCTOR) - { - error_init ("array initialized from non-constant array expression"); - return error_mark_node; - } - - if (optimize && TREE_CODE (inside_init) == VAR_DECL) - inside_init = decl_constant_value (inside_init); - - /* Compound expressions can only occur here if -pedantic or - -pedantic-errors is specified. In the later case, we always want - an error. In the former case, we simply want a warning. */ - if (require_constant && pedantic - && TREE_CODE (inside_init) == COMPOUND_EXPR) - { - inside_init - = valid_compound_expr_initializer (inside_init, - TREE_TYPE (inside_init)); - if (inside_init == error_mark_node) - error_init ("initializer element is not constant"); - else - pedwarn_init ("initializer element is not constant"); - if (flag_pedantic_errors) - inside_init = error_mark_node; - } - else if (require_constant && ! TREE_CONSTANT (inside_init)) - { - error_init ("initializer element is not constant"); - inside_init = error_mark_node; - } - else if (require_constant - && initializer_constant_valid_p (inside_init, TREE_TYPE (inside_init)) == 0) - { - error_init ("initializer element is not computable at load time"); - inside_init = error_mark_node; - } - - return inside_init; - } - - /* Handle scalar types, including conversions. */ - - if (code == INTEGER_TYPE || code == REAL_TYPE || code == POINTER_TYPE - || code == ENUMERAL_TYPE || code == COMPLEX_TYPE) - { - /* Note that convert_for_assignment calls default_conversion - for arrays and functions. We must not call it in the - case where inside_init is a null pointer constant. */ - inside_init - = convert_for_assignment (type, init, _("initialization"), - NULL_TREE, NULL_TREE, 0); - - if (require_constant && ! TREE_CONSTANT (inside_init)) - { - error_init ("initializer element is not constant"); - inside_init = error_mark_node; - } - else if (require_constant - && initializer_constant_valid_p (inside_init, TREE_TYPE (inside_init)) == 0) - { - error_init ("initializer element is not computable at load time"); - inside_init = error_mark_node; - } - - return inside_init; - } - - /* Come here only for records and arrays. */ - - if (TYPE_SIZE (type) && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) - { - error_init ("variable-sized object may not be initialized"); - return error_mark_node; - } - - /* Traditionally, you can write struct foo x = 0; - and it initializes the first element of x to 0. */ - if (flag_traditional) - { - tree top = 0, prev = 0, otype = type; - while (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == ARRAY_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE - || TREE_CODE (type) == UNION_TYPE) - { - tree temp = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE); - if (prev == 0) - top = temp; - else - TREE_OPERAND (prev, 1) = build_tree_list (NULL_TREE, temp); - prev = temp; - if (TREE_CODE (type) == ARRAY_TYPE) - type = TREE_TYPE (type); - else if (TYPE_FIELDS (type)) - type = TREE_TYPE (TYPE_FIELDS (type)); - else - { - error_init ("invalid initializer"); - return error_mark_node; - } - } - - if (otype != type) - { - TREE_OPERAND (prev, 1) - = build_tree_list (NULL_TREE, - digest_init (type, init, require_constant, - constructor_constant)); - return top; - } - else - return error_mark_node; - } - error_init ("invalid initializer"); - return error_mark_node; -} - -/* Handle initializers that use braces. */ - -/* Type of object we are accumulating a constructor for. - This type is always a RECORD_TYPE, UNION_TYPE or ARRAY_TYPE. */ -static tree constructor_type; - -/* For a RECORD_TYPE or UNION_TYPE, this is the chain of fields - left to fill. */ -static tree constructor_fields; - -/* For an ARRAY_TYPE, this is the specified index - at which to store the next element we get. - This is a special INTEGER_CST node that we modify in place. */ -static tree constructor_index; - -/* For an ARRAY_TYPE, this is the end index of the range - to initialize with the next element, or NULL in the ordinary case - where the element is used just once. */ -static tree constructor_range_end; - -/* For an ARRAY_TYPE, this is the maximum index. */ -static tree constructor_max_index; - -/* For a RECORD_TYPE, this is the first field not yet written out. */ -static tree constructor_unfilled_fields; - -/* For an ARRAY_TYPE, this is the index of the first element - not yet written out. - This is a special INTEGER_CST node that we modify in place. */ -static tree constructor_unfilled_index; - -/* In a RECORD_TYPE, the byte index of the next consecutive field. - This is so we can generate gaps between fields, when appropriate. - This is a special INTEGER_CST node that we modify in place. */ -static tree constructor_bit_index; - -/* If we are saving up the elements rather than allocating them, - this is the list of elements so far (in reverse order, - most recent first). */ -static tree constructor_elements; - -/* 1 if so far this constructor's elements are all compile-time constants. */ -static int constructor_constant; - -/* 1 if so far this constructor's elements are all valid address constants. */ -static int constructor_simple; - -/* 1 if this constructor is erroneous so far. */ -static int constructor_erroneous; - -/* 1 if have called defer_addressed_constants. */ -static int constructor_subconstants_deferred; - -/* Structure for managing pending initializer elements, organized as an - AVL tree. */ - -struct init_node -{ - struct init_node *left, *right; - struct init_node *parent; - int balance; - tree purpose; - tree value; -}; - -/* Tree of pending elements at this constructor level. - These are elements encountered out of order - which belong at places we haven't reached yet in actually - writing the output. */ -static struct init_node *constructor_pending_elts; - -/* The SPELLING_DEPTH of this constructor. */ -static int constructor_depth; - -/* 0 if implicitly pushing constructor levels is allowed. */ -int constructor_no_implicit = 0; /* 0 for C; 1 for some other languages. */ - -static int require_constant_value; -static int require_constant_elements; - -/* 1 if it is ok to output this constructor as we read it. - 0 means must accumulate a CONSTRUCTOR expression. */ -static int constructor_incremental; - -/* DECL node for which an initializer is being read. - 0 means we are reading a constructor expression - such as (struct foo) {...}. */ -static tree constructor_decl; - -/* start_init saves the ASMSPEC arg here for really_start_incremental_init. */ -static char *constructor_asmspec; - -/* Nonzero if this is an initializer for a top-level decl. */ -static int constructor_top_level; - - -/* This stack has a level for each implicit or explicit level of - structuring in the initializer, including the outermost one. It - saves the values of most of the variables above. */ - -struct constructor_stack -{ - struct constructor_stack *next; - tree type; - tree fields; - tree index; - tree range_end; - tree max_index; - tree unfilled_index; - tree unfilled_fields; - tree bit_index; - tree elements; - int offset; - struct init_node *pending_elts; - int depth; - /* If nonzero, this value should replace the entire - constructor at this level. */ - tree replacement_value; - char constant; - char simple; - char implicit; - char incremental; - char erroneous; - char outer; -}; - -struct constructor_stack *constructor_stack; - -/* This stack records separate initializers that are nested. - Nested initializers can't happen in ANSI C, but GNU C allows them - in cases like { ... (struct foo) { ... } ... }. */ - -struct initializer_stack -{ - struct initializer_stack *next; - tree decl; - char *asmspec; - struct constructor_stack *constructor_stack; - tree elements; - struct spelling *spelling; - struct spelling *spelling_base; - int spelling_size; - char top_level; - char incremental; - char require_constant_value; - char require_constant_elements; - char deferred; -}; - -struct initializer_stack *initializer_stack; - -/* Prepare to parse and output the initializer for variable DECL. */ - -void -start_init (decl, asmspec_tree, top_level) - tree decl; - tree asmspec_tree; - int top_level; -{ - const char *locus; - struct initializer_stack *p - = (struct initializer_stack *) xmalloc (sizeof (struct initializer_stack)); - char *asmspec = 0; - - if (asmspec_tree) - asmspec = TREE_STRING_POINTER (asmspec_tree); - - p->decl = constructor_decl; - p->asmspec = constructor_asmspec; - p->incremental = constructor_incremental; - p->require_constant_value = require_constant_value; - p->require_constant_elements = require_constant_elements; - p->constructor_stack = constructor_stack; - p->elements = constructor_elements; - p->spelling = spelling; - p->spelling_base = spelling_base; - p->spelling_size = spelling_size; - p->deferred = constructor_subconstants_deferred; - p->top_level = constructor_top_level; - p->next = initializer_stack; - initializer_stack = p; - - constructor_decl = decl; - constructor_incremental = top_level; - constructor_asmspec = asmspec; - constructor_subconstants_deferred = 0; - constructor_top_level = top_level; - - if (decl != 0) - { - require_constant_value = TREE_STATIC (decl); - require_constant_elements - = ((TREE_STATIC (decl) || pedantic) - /* For a scalar, you can always use any value to initialize, - even within braces. */ - && (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE - || TREE_CODE (TREE_TYPE (decl)) == QUAL_UNION_TYPE)); - locus = IDENTIFIER_POINTER (DECL_NAME (decl)); - constructor_incremental |= TREE_STATIC (decl); - } - else - { - require_constant_value = 0; - require_constant_elements = 0; - locus = "(anonymous)"; - } - - constructor_stack = 0; - - missing_braces_mentioned = 0; - - spelling_base = 0; - spelling_size = 0; - RESTORE_SPELLING_DEPTH (0); - - if (locus) - push_string (locus); -} - -void -finish_init () -{ - struct initializer_stack *p = initializer_stack; - - /* Output subconstants (string constants, usually) - that were referenced within this initializer and saved up. - Must do this if and only if we called defer_addressed_constants. */ - if (constructor_subconstants_deferred) - output_deferred_addressed_constants (); - - /* Free the whole constructor stack of this initializer. */ - while (constructor_stack) - { - struct constructor_stack *q = constructor_stack; - constructor_stack = q->next; - free (q); - } - - /* Pop back to the data of the outer initializer (if any). */ - constructor_decl = p->decl; - constructor_asmspec = p->asmspec; - constructor_incremental = p->incremental; - require_constant_value = p->require_constant_value; - require_constant_elements = p->require_constant_elements; - constructor_stack = p->constructor_stack; - constructor_elements = p->elements; - spelling = p->spelling; - spelling_base = p->spelling_base; - spelling_size = p->spelling_size; - constructor_subconstants_deferred = p->deferred; - constructor_top_level = p->top_level; - initializer_stack = p->next; - free (p); -} - -/* Call here when we see the initializer is surrounded by braces. - This is instead of a call to push_init_level; - it is matched by a call to pop_init_level. - - TYPE is the type to initialize, for a constructor expression. - For an initializer for a decl, TYPE is zero. */ - -void -really_start_incremental_init (type) - tree type; -{ - struct constructor_stack *p - = (struct constructor_stack *) xmalloc (sizeof (struct constructor_stack)); - - if (type == 0) - type = TREE_TYPE (constructor_decl); - - /* Turn off constructor_incremental if type is a struct with bitfields. - Do this before the first push, so that the corrected value - is available in finish_init. */ - check_init_type_bitfields (type); - - p->type = constructor_type; - p->fields = constructor_fields; - p->index = constructor_index; - p->range_end = constructor_range_end; - p->max_index = constructor_max_index; - p->unfilled_index = constructor_unfilled_index; - p->unfilled_fields = constructor_unfilled_fields; - p->bit_index = constructor_bit_index; - p->elements = constructor_elements; - p->constant = constructor_constant; - p->simple = constructor_simple; - p->erroneous = constructor_erroneous; - p->pending_elts = constructor_pending_elts; - p->depth = constructor_depth; - p->replacement_value = 0; - p->implicit = 0; - p->incremental = constructor_incremental; - p->outer = 0; - p->next = 0; - constructor_stack = p; - - constructor_constant = 1; - constructor_simple = 1; - constructor_depth = SPELLING_DEPTH (); - constructor_elements = 0; - constructor_pending_elts = 0; - constructor_type = type; - - if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - { - constructor_fields = TYPE_FIELDS (constructor_type); - /* Skip any nameless bit fields at the beginning. */ - while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields) - && DECL_NAME (constructor_fields) == 0) - constructor_fields = TREE_CHAIN (constructor_fields); - constructor_unfilled_fields = constructor_fields; - constructor_bit_index = copy_node (integer_zero_node); - TREE_TYPE (constructor_bit_index) = sbitsizetype; - } - else if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - constructor_range_end = 0; - if (TYPE_DOMAIN (constructor_type)) - { - constructor_max_index - = TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type)); - constructor_index - = copy_node (TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type))); - } - else - constructor_index = copy_node (integer_zero_node); - constructor_unfilled_index = copy_node (constructor_index); - } - else - { - /* Handle the case of int x = {5}; */ - constructor_fields = constructor_type; - constructor_unfilled_fields = constructor_type; - } - - if (constructor_incremental) - { - int momentary = suspend_momentary (); - push_obstacks_nochange (); - if (TREE_PERMANENT (constructor_decl)) - end_temporary_allocation (); - make_decl_rtl (constructor_decl, constructor_asmspec, - constructor_top_level); - assemble_variable (constructor_decl, constructor_top_level, 0, 1); - pop_obstacks (); - resume_momentary (momentary); - } - - if (constructor_incremental) - { - defer_addressed_constants (); - constructor_subconstants_deferred = 1; - } -} - -/* Push down into a subobject, for initialization. - If this is for an explicit set of braces, IMPLICIT is 0. - If it is because the next element belongs at a lower level, - IMPLICIT is 1. */ - -void -push_init_level (implicit) - int implicit; -{ - struct constructor_stack *p; - - /* If we've exhausted any levels that didn't have braces, - pop them now. */ - while (constructor_stack->implicit) - { - if ((TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - && constructor_fields == 0) - process_init_element (pop_init_level (1)); - else if (TREE_CODE (constructor_type) == ARRAY_TYPE - && tree_int_cst_lt (constructor_max_index, constructor_index)) - process_init_element (pop_init_level (1)); - else - break; - } - - /* Structure elements may require alignment. Do this now if necessary - for the subaggregate, and if it comes next in sequence. Don't do - this for subaggregates that will go on the pending list. */ - if (constructor_incremental && constructor_type != 0 - && TREE_CODE (constructor_type) == RECORD_TYPE && constructor_fields - && constructor_fields == constructor_unfilled_fields) - { - /* Advance to offset of this element. */ - if (! tree_int_cst_equal (constructor_bit_index, - DECL_FIELD_BITPOS (constructor_fields))) - { - /* By using unsigned arithmetic, the result will be correct even - in case of overflows, if BITS_PER_UNIT is a power of two. */ - unsigned next = (TREE_INT_CST_LOW - (DECL_FIELD_BITPOS (constructor_fields)) - / (unsigned)BITS_PER_UNIT); - unsigned here = (TREE_INT_CST_LOW (constructor_bit_index) - / (unsigned)BITS_PER_UNIT); - - assemble_zeros ((next - here) - * (unsigned)BITS_PER_UNIT - / (unsigned)BITS_PER_UNIT); - } - /* Indicate that we have now filled the structure up to the current - field. */ - constructor_unfilled_fields = constructor_fields; - } - - p = (struct constructor_stack *) xmalloc (sizeof (struct constructor_stack)); - p->type = constructor_type; - p->fields = constructor_fields; - p->index = constructor_index; - p->range_end = constructor_range_end; - p->max_index = constructor_max_index; - p->unfilled_index = constructor_unfilled_index; - p->unfilled_fields = constructor_unfilled_fields; - p->bit_index = constructor_bit_index; - p->elements = constructor_elements; - p->constant = constructor_constant; - p->simple = constructor_simple; - p->erroneous = constructor_erroneous; - p->pending_elts = constructor_pending_elts; - p->depth = constructor_depth; - p->replacement_value = 0; - p->implicit = implicit; - p->incremental = constructor_incremental; - p->outer = 0; - p->next = constructor_stack; - constructor_stack = p; - - constructor_constant = 1; - constructor_simple = 1; - constructor_depth = SPELLING_DEPTH (); - constructor_elements = 0; - constructor_pending_elts = 0; - - /* Don't die if an entire brace-pair level is superfluous - in the containing level. */ - if (constructor_type == 0) - ; - else if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - { - /* Don't die if there are extra init elts at the end. */ - if (constructor_fields == 0) - constructor_type = 0; - else - { - constructor_type = TREE_TYPE (constructor_fields); - push_member_name (constructor_fields); - constructor_depth++; - if (constructor_fields != constructor_unfilled_fields) - constructor_incremental = 0; - } - } - else if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - constructor_type = TREE_TYPE (constructor_type); - push_array_bounds (TREE_INT_CST_LOW (constructor_index)); - constructor_depth++; - if (! tree_int_cst_equal (constructor_index, constructor_unfilled_index) - || constructor_range_end != 0) - constructor_incremental = 0; - } - - if (constructor_type == 0) - { - error_init ("extra brace group at end of initializer"); - constructor_fields = 0; - constructor_unfilled_fields = 0; - return; - } - - /* Turn off constructor_incremental if type is a struct with bitfields. */ - check_init_type_bitfields (constructor_type); - - if (implicit && warn_missing_braces && !missing_braces_mentioned) - { - missing_braces_mentioned = 1; - warning_init ("missing braces around initializer"); - } - - if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - { - constructor_fields = TYPE_FIELDS (constructor_type); - /* Skip any nameless bit fields at the beginning. */ - while (constructor_fields != 0 && DECL_C_BIT_FIELD (constructor_fields) - && DECL_NAME (constructor_fields) == 0) - constructor_fields = TREE_CHAIN (constructor_fields); - constructor_unfilled_fields = constructor_fields; - constructor_bit_index = copy_node (integer_zero_node); - TREE_TYPE (constructor_bit_index) = sbitsizetype; - } - else if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - constructor_range_end = 0; - if (TYPE_DOMAIN (constructor_type)) - { - constructor_max_index - = TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type)); - constructor_index - = copy_node (TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type))); - } - else - constructor_index = copy_node (integer_zero_node); - constructor_unfilled_index = copy_node (constructor_index); - } - else - { - warning_init ("braces around scalar initializer"); - constructor_fields = constructor_type; - constructor_unfilled_fields = constructor_type; - } -} - -/* Don't read a struct incrementally if it has any bitfields, - because the incremental reading code doesn't know how to - handle bitfields yet. */ - -static void -check_init_type_bitfields (type) - tree type; -{ - if (TREE_CODE (type) == RECORD_TYPE) - { - tree tail; - for (tail = TYPE_FIELDS (type); tail; - tail = TREE_CHAIN (tail)) - { - if (DECL_C_BIT_FIELD (tail)) - { - constructor_incremental = 0; - break; - } - - check_init_type_bitfields (TREE_TYPE (tail)); - } - } - - else if (TREE_CODE (type) == UNION_TYPE) - { - tree tail = TYPE_FIELDS (type); - if (tail && DECL_C_BIT_FIELD (tail)) - /* We also use the nonincremental algorithm for initiliazation - of unions whose first member is a bitfield, becuase the - incremental algorithm has no code for dealing with - bitfields. */ - constructor_incremental = 0; - } - - else if (TREE_CODE (type) == ARRAY_TYPE) - check_init_type_bitfields (TREE_TYPE (type)); -} - -/* At the end of an implicit or explicit brace level, - finish up that level of constructor. - If we were outputting the elements as they are read, return 0 - from inner levels (process_init_element ignores that), - but return error_mark_node from the outermost level - (that's what we want to put in DECL_INITIAL). - Otherwise, return a CONSTRUCTOR expression. */ - -tree -pop_init_level (implicit) - int implicit; -{ - struct constructor_stack *p; - int size = 0; - tree constructor = 0; - - if (implicit == 0) - { - /* When we come to an explicit close brace, - pop any inner levels that didn't have explicit braces. */ - while (constructor_stack->implicit) - process_init_element (pop_init_level (1)); - } - - p = constructor_stack; - - if (constructor_type != 0) - size = int_size_in_bytes (constructor_type); - - /* Warn when some struct elements are implicitly initialized to zero. */ - if (extra_warnings - && constructor_type - && TREE_CODE (constructor_type) == RECORD_TYPE - && constructor_unfilled_fields) - { - push_member_name (constructor_unfilled_fields); - warning_init ("missing initializer"); - RESTORE_SPELLING_DEPTH (constructor_depth); - } - - /* Now output all pending elements. */ - output_pending_init_elements (1); - -#if 0 /* c-parse.in warns about {}. */ - /* In ANSI, each brace level must have at least one element. */ - if (! implicit && pedantic - && (TREE_CODE (constructor_type) == ARRAY_TYPE - ? integer_zerop (constructor_unfilled_index) - : constructor_unfilled_fields == TYPE_FIELDS (constructor_type))) - pedwarn_init ("empty braces in initializer"); -#endif - - /* Pad out the end of the structure. */ - - if (p->replacement_value) - { - /* If this closes a superfluous brace pair, - just pass out the element between them. */ - constructor = p->replacement_value; - /* If this is the top level thing within the initializer, - and it's for a variable, then since we already called - assemble_variable, we must output the value now. */ - if (p->next == 0 && constructor_decl != 0 - && constructor_incremental) - { - constructor = digest_init (constructor_type, constructor, - require_constant_value, - require_constant_elements); - - /* If initializing an array of unknown size, - determine the size now. */ - if (TREE_CODE (constructor_type) == ARRAY_TYPE - && TYPE_DOMAIN (constructor_type) == 0) - { - int failure; - int momentary_p; - - push_obstacks_nochange (); - if (TREE_PERMANENT (constructor_type)) - end_temporary_allocation (); - - momentary_p = suspend_momentary (); - - /* We shouldn't have an incomplete array type within - some other type. */ - if (constructor_stack->next) - abort (); - - failure - = complete_array_type (constructor_type, - constructor, 0); - if (failure) - abort (); - - size = int_size_in_bytes (constructor_type); - resume_momentary (momentary_p); - pop_obstacks (); - } - - output_constant (constructor, size); - } - } - else if (constructor_type == 0) - ; - else if (TREE_CODE (constructor_type) != RECORD_TYPE - && TREE_CODE (constructor_type) != UNION_TYPE - && TREE_CODE (constructor_type) != ARRAY_TYPE - && ! constructor_incremental) - { - /* A nonincremental scalar initializer--just return - the element, after verifying there is just one. */ - if (constructor_elements == 0) - { - error_init ("empty scalar initializer"); - constructor = error_mark_node; - } - else if (TREE_CHAIN (constructor_elements) != 0) - { - error_init ("extra elements in scalar initializer"); - constructor = TREE_VALUE (constructor_elements); - } - else - constructor = TREE_VALUE (constructor_elements); - } - else if (! constructor_incremental) - { - if (constructor_erroneous) - constructor = error_mark_node; - else - { - int momentary = suspend_momentary (); - - constructor = build (CONSTRUCTOR, constructor_type, NULL_TREE, - nreverse (constructor_elements)); - if (constructor_constant) - TREE_CONSTANT (constructor) = 1; - if (constructor_constant && constructor_simple) - TREE_STATIC (constructor) = 1; - - resume_momentary (momentary); - } - } - else - { - tree filled; - int momentary = suspend_momentary (); - - if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - { - /* Find the offset of the end of that field. */ - filled = size_binop (CEIL_DIV_EXPR, - constructor_bit_index, - size_int (BITS_PER_UNIT)); - } - else if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - /* If initializing an array of unknown size, - determine the size now. */ - if (TREE_CODE (constructor_type) == ARRAY_TYPE - && TYPE_DOMAIN (constructor_type) == 0) - { - tree maxindex - = size_binop (MINUS_EXPR, - constructor_unfilled_index, - integer_one_node); - - push_obstacks_nochange (); - if (TREE_PERMANENT (constructor_type)) - end_temporary_allocation (); - maxindex = copy_node (maxindex); - TYPE_DOMAIN (constructor_type) = build_index_type (maxindex); - TREE_TYPE (maxindex) = TYPE_DOMAIN (constructor_type); - - /* TYPE_MAX_VALUE is always one less than the number of elements - in the array, because we start counting at zero. Therefore, - warn only if the value is less than zero. */ - if (pedantic - && (tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type))) - < 0)) - error_with_decl (constructor_decl, - "zero or negative array size `%s'"); - layout_type (constructor_type); - size = int_size_in_bytes (constructor_type); - pop_obstacks (); - } - - filled = size_binop (MULT_EXPR, constructor_unfilled_index, - size_in_bytes (TREE_TYPE (constructor_type))); - } - else - filled = 0; - - if (filled != 0) - assemble_zeros (size - TREE_INT_CST_LOW (filled)); - - resume_momentary (momentary); - } - - - constructor_type = p->type; - constructor_fields = p->fields; - constructor_index = p->index; - constructor_range_end = p->range_end; - constructor_max_index = p->max_index; - constructor_unfilled_index = p->unfilled_index; - constructor_unfilled_fields = p->unfilled_fields; - constructor_bit_index = p->bit_index; - constructor_elements = p->elements; - constructor_constant = p->constant; - constructor_simple = p->simple; - constructor_erroneous = p->erroneous; - constructor_pending_elts = p->pending_elts; - constructor_depth = p->depth; - constructor_incremental = p->incremental; - RESTORE_SPELLING_DEPTH (constructor_depth); - - constructor_stack = p->next; - free (p); - - if (constructor == 0) - { - if (constructor_stack == 0) - return error_mark_node; - return NULL_TREE; - } - return constructor; -} - -/* Within an array initializer, specify the next index to be initialized. - FIRST is that index. If LAST is nonzero, then initialize a range - of indices, running from FIRST through LAST. */ - -void -set_init_index (first, last) - tree first, last; -{ - while ((TREE_CODE (first) == NOP_EXPR - || TREE_CODE (first) == CONVERT_EXPR - || TREE_CODE (first) == NON_LVALUE_EXPR) - && (TYPE_MODE (TREE_TYPE (first)) - == TYPE_MODE (TREE_TYPE (TREE_OPERAND (first, 0))))) - (first) = TREE_OPERAND (first, 0); - if (last) - while ((TREE_CODE (last) == NOP_EXPR - || TREE_CODE (last) == CONVERT_EXPR - || TREE_CODE (last) == NON_LVALUE_EXPR) - && (TYPE_MODE (TREE_TYPE (last)) - == TYPE_MODE (TREE_TYPE (TREE_OPERAND (last, 0))))) - (last) = TREE_OPERAND (last, 0); - - if (TREE_CODE (first) != INTEGER_CST) - error_init ("nonconstant array index in initializer"); - else if (last != 0 && TREE_CODE (last) != INTEGER_CST) - error_init ("nonconstant array index in initializer"); - else if (! constructor_unfilled_index) - error_init ("array index in non-array initializer"); - else if (tree_int_cst_lt (first, constructor_unfilled_index)) - error_init ("duplicate array index in initializer"); - else - { - TREE_INT_CST_LOW (constructor_index) = TREE_INT_CST_LOW (first); - TREE_INT_CST_HIGH (constructor_index) = TREE_INT_CST_HIGH (first); - - if (last != 0 && tree_int_cst_lt (last, first)) - error_init ("empty index range in initializer"); - else - { - if (pedantic) - pedwarn ("ANSI C forbids specifying element to initialize"); - constructor_range_end = last; - } - } -} - -/* Within a struct initializer, specify the next field to be initialized. */ - -void -set_init_label (fieldname) - tree fieldname; -{ - tree tail; - int passed = 0; - - /* Don't die if an entire brace-pair level is superfluous - in the containing level. */ - if (constructor_type == 0) - return; - - for (tail = TYPE_FIELDS (constructor_type); tail; - tail = TREE_CHAIN (tail)) - { - if (tail == constructor_unfilled_fields) - passed = 1; - if (DECL_NAME (tail) == fieldname) - break; - } - - if (tail == 0) - error ("unknown field `%s' specified in initializer", - IDENTIFIER_POINTER (fieldname)); - else if (!passed) - error ("field `%s' already initialized", - IDENTIFIER_POINTER (fieldname)); - else - { - constructor_fields = tail; - if (pedantic) - pedwarn ("ANSI C forbids specifying structure member to initialize"); - } -} - -/* Add a new initializer to the tree of pending initializers. PURPOSE - indentifies the initializer, either array index or field in a structure. - VALUE is the value of that index or field. */ - -static void -add_pending_init (purpose, value) - tree purpose, value; -{ - struct init_node *p, **q, *r; - - q = &constructor_pending_elts; - p = 0; - - if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - while (*q != 0) - { - p = *q; - if (tree_int_cst_lt (purpose, p->purpose)) - q = &p->left; - else if (p->purpose != purpose) - q = &p->right; - else - abort (); - } - } - else - { - while (*q != NULL) - { - p = *q; - if (tree_int_cst_lt (DECL_FIELD_BITPOS (purpose), - DECL_FIELD_BITPOS (p->purpose))) - q = &p->left; - else if (p->purpose != purpose) - q = &p->right; - else - abort (); - } - } - - r = (struct init_node *) oballoc (sizeof (struct init_node)); - r->purpose = purpose; - r->value = value; - - *q = r; - r->parent = p; - r->left = 0; - r->right = 0; - r->balance = 0; - - while (p) - { - struct init_node *s; - - if (r == p->left) - { - if (p->balance == 0) - p->balance = -1; - else if (p->balance < 0) - { - if (r->balance < 0) - { - /* L rotation. */ - p->left = r->right; - if (p->left) - p->left->parent = p; - r->right = p; - - p->balance = 0; - r->balance = 0; - - s = p->parent; - p->parent = r; - r->parent = s; - if (s) - { - if (s->left == p) - s->left = r; - else - s->right = r; - } - else - constructor_pending_elts = r; - } - else - { - /* LR rotation. */ - struct init_node *t = r->right; - - r->right = t->left; - if (r->right) - r->right->parent = r; - t->left = r; - - p->left = t->right; - if (p->left) - p->left->parent = p; - t->right = p; - - p->balance = t->balance < 0; - r->balance = -(t->balance > 0); - t->balance = 0; - - s = p->parent; - p->parent = t; - r->parent = t; - t->parent = s; - if (s) - { - if (s->left == p) - s->left = t; - else - s->right = t; - } - else - constructor_pending_elts = t; - } - break; - } - else - { - /* p->balance == +1; growth of left side balances the node. */ - p->balance = 0; - break; - } - } - else /* r == p->right */ - { - if (p->balance == 0) - /* Growth propagation from right side. */ - p->balance++; - else if (p->balance > 0) - { - if (r->balance > 0) - { - /* R rotation. */ - p->right = r->left; - if (p->right) - p->right->parent = p; - r->left = p; - - p->balance = 0; - r->balance = 0; - - s = p->parent; - p->parent = r; - r->parent = s; - if (s) - { - if (s->left == p) - s->left = r; - else - s->right = r; - } - else - constructor_pending_elts = r; - } - else /* r->balance == -1 */ - { - /* RL rotation */ - struct init_node *t = r->left; - - r->left = t->right; - if (r->left) - r->left->parent = r; - t->right = r; - - p->right = t->left; - if (p->right) - p->right->parent = p; - t->left = p; - - r->balance = (t->balance < 0); - p->balance = -(t->balance > 0); - t->balance = 0; - - s = p->parent; - p->parent = t; - r->parent = t; - t->parent = s; - if (s) - { - if (s->left == p) - s->left = t; - else - s->right = t; - } - else - constructor_pending_elts = t; - } - break; - } - else - { - /* p->balance == -1; growth of right side balances the node. */ - p->balance = 0; - break; - } - } - - r = p; - p = p->parent; - } -} - -/* Return nonzero if FIELD is equal to the index of a pending initializer. */ - -static int -pending_init_member (field) - tree field; -{ - struct init_node *p; - - p = constructor_pending_elts; - if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - while (p) - { - if (field == p->purpose) - return 1; - else if (tree_int_cst_lt (field, p->purpose)) - p = p->left; - else - p = p->right; - } - } - else - { - while (p) - { - if (field == p->purpose) - return 1; - else if (tree_int_cst_lt (DECL_FIELD_BITPOS (field), - DECL_FIELD_BITPOS (p->purpose))) - p = p->left; - else - p = p->right; - } - } - - return 0; -} - -/* "Output" the next constructor element. - At top level, really output it to assembler code now. - Otherwise, collect it in a list from which we will make a CONSTRUCTOR. - TYPE is the data type that the containing data type wants here. - FIELD is the field (a FIELD_DECL) or the index that this element fills. - - PENDING if non-nil means output pending elements that belong - right after this element. (PENDING is normally 1; - it is 0 while outputting pending elements, to avoid recursion.) */ - -static void -output_init_element (value, type, field, pending) - tree value, type, field; - int pending; -{ - int duplicate = 0; - - if (TREE_CODE (TREE_TYPE (value)) == FUNCTION_TYPE - || (TREE_CODE (TREE_TYPE (value)) == ARRAY_TYPE - && !(TREE_CODE (value) == STRING_CST - && TREE_CODE (type) == ARRAY_TYPE - && TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE) - && !comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (value)), - TYPE_MAIN_VARIANT (type)))) - value = default_conversion (value); - - if (value == error_mark_node) - constructor_erroneous = 1; - else if (!TREE_CONSTANT (value)) - constructor_constant = 0; - else if (initializer_constant_valid_p (value, TREE_TYPE (value)) == 0 - || ((TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - && DECL_C_BIT_FIELD (field) - && TREE_CODE (value) != INTEGER_CST)) - constructor_simple = 0; - - if (require_constant_value && ! TREE_CONSTANT (value)) - { - error_init ("initializer element is not constant"); - value = error_mark_node; - } - else if (require_constant_elements - && initializer_constant_valid_p (value, TREE_TYPE (value)) == 0) - { - error_init ("initializer element is not computable at load time"); - value = error_mark_node; - } - - /* If this element duplicates one on constructor_pending_elts, - print a message and ignore it. Don't do this when we're - processing elements taken off constructor_pending_elts, - because we'd always get spurious errors. */ - if (pending) - { - if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE - || TREE_CODE (constructor_type) == ARRAY_TYPE) - { - if (pending_init_member (field)) - { - error_init ("duplicate initializer"); - duplicate = 1; - } - } - } - - /* If this element doesn't come next in sequence, - put it on constructor_pending_elts. */ - if (TREE_CODE (constructor_type) == ARRAY_TYPE - && !tree_int_cst_equal (field, constructor_unfilled_index)) - { - if (! duplicate) - /* The copy_node is needed in case field is actually - constructor_index, which is modified in place. */ - add_pending_init (copy_node (field), - digest_init (type, value, require_constant_value, - require_constant_elements)); - } - else if (TREE_CODE (constructor_type) == RECORD_TYPE - && field != constructor_unfilled_fields) - { - /* We do this for records but not for unions. In a union, - no matter which field is specified, it can be initialized - right away since it starts at the beginning of the union. */ - if (!duplicate) - add_pending_init (field, - digest_init (type, value, require_constant_value, - require_constant_elements)); - } - else - { - /* Otherwise, output this element either to - constructor_elements or to the assembler file. */ - - if (!duplicate) - { - if (! constructor_incremental) - { - if (field && TREE_CODE (field) == INTEGER_CST) - field = copy_node (field); - constructor_elements - = tree_cons (field, digest_init (type, value, - require_constant_value, - require_constant_elements), - constructor_elements); - } - else - { - /* Structure elements may require alignment. - Do this, if necessary. */ - if (TREE_CODE (constructor_type) == RECORD_TYPE) - { - /* Advance to offset of this element. */ - if (! tree_int_cst_equal (constructor_bit_index, - DECL_FIELD_BITPOS (field))) - { - /* By using unsigned arithmetic, the result will be - correct even in case of overflows, if BITS_PER_UNIT - is a power of two. */ - unsigned next = (TREE_INT_CST_LOW - (DECL_FIELD_BITPOS (field)) - / (unsigned)BITS_PER_UNIT); - unsigned here = (TREE_INT_CST_LOW - (constructor_bit_index) - / (unsigned)BITS_PER_UNIT); - - assemble_zeros ((next - here) - * (unsigned)BITS_PER_UNIT - / (unsigned)BITS_PER_UNIT); - } - } - output_constant (digest_init (type, value, - require_constant_value, - require_constant_elements), - int_size_in_bytes (type)); - - /* For a record or union, - keep track of end position of last field. */ - if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - { - tree temp = size_binop (PLUS_EXPR, DECL_FIELD_BITPOS (field), - DECL_SIZE (field)); - TREE_INT_CST_LOW (constructor_bit_index) - = TREE_INT_CST_LOW (temp); - TREE_INT_CST_HIGH (constructor_bit_index) - = TREE_INT_CST_HIGH (temp); - } - } - } - - /* Advance the variable that indicates sequential elements output. */ - if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - tree tem = size_binop (PLUS_EXPR, constructor_unfilled_index, - integer_one_node); - TREE_INT_CST_LOW (constructor_unfilled_index) - = TREE_INT_CST_LOW (tem); - TREE_INT_CST_HIGH (constructor_unfilled_index) - = TREE_INT_CST_HIGH (tem); - } - else if (TREE_CODE (constructor_type) == RECORD_TYPE) - constructor_unfilled_fields = TREE_CHAIN (constructor_unfilled_fields); - else if (TREE_CODE (constructor_type) == UNION_TYPE) - constructor_unfilled_fields = 0; - - /* Now output any pending elements which have become next. */ - if (pending) - output_pending_init_elements (0); - } -} - -/* Output any pending elements which have become next. - As we output elements, constructor_unfilled_{fields,index} - advances, which may cause other elements to become next; - if so, they too are output. - - If ALL is 0, we return when there are - no more pending elements to output now. - - If ALL is 1, we output space as necessary so that - we can output all the pending elements. */ - -static void -output_pending_init_elements (all) - int all; -{ - struct init_node *elt = constructor_pending_elts; - tree next; - - retry: - - /* Look thru the whole pending tree. - If we find an element that should be output now, - output it. Otherwise, set NEXT to the element - that comes first among those still pending. */ - - next = 0; - while (elt) - { - if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - if (tree_int_cst_equal (elt->purpose, - constructor_unfilled_index)) - output_init_element (elt->value, - TREE_TYPE (constructor_type), - constructor_unfilled_index, 0); - else if (tree_int_cst_lt (constructor_unfilled_index, - elt->purpose)) - { - /* Advance to the next smaller node. */ - if (elt->left) - elt = elt->left; - else - { - /* We have reached the smallest node bigger than the - current unfilled index. Fill the space first. */ - next = elt->purpose; - break; - } - } - else - { - /* Advance to the next bigger node. */ - if (elt->right) - elt = elt->right; - else - { - /* We have reached the biggest node in a subtree. Find - the parent of it, which is the next bigger node. */ - while (elt->parent && elt->parent->right == elt) - elt = elt->parent; - elt = elt->parent; - if (elt && tree_int_cst_lt (constructor_unfilled_index, - elt->purpose)) - { - next = elt->purpose; - break; - } - } - } - } - else if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - { - /* If the current record is complete we are done. */ - if (constructor_unfilled_fields == 0) - break; - if (elt->purpose == constructor_unfilled_fields) - { - output_init_element (elt->value, - TREE_TYPE (constructor_unfilled_fields), - constructor_unfilled_fields, - 0); - } - else if (tree_int_cst_lt (DECL_FIELD_BITPOS (constructor_unfilled_fields), - DECL_FIELD_BITPOS (elt->purpose))) - { - /* Advance to the next smaller node. */ - if (elt->left) - elt = elt->left; - else - { - /* We have reached the smallest node bigger than the - current unfilled field. Fill the space first. */ - next = elt->purpose; - break; - } - } - else - { - /* Advance to the next bigger node. */ - if (elt->right) - elt = elt->right; - else - { - /* We have reached the biggest node in a subtree. Find - the parent of it, which is the next bigger node. */ - while (elt->parent && elt->parent->right == elt) - elt = elt->parent; - elt = elt->parent; - if (elt - && tree_int_cst_lt (DECL_FIELD_BITPOS (constructor_unfilled_fields), - DECL_FIELD_BITPOS (elt->purpose))) - { - next = elt->purpose; - break; - } - } - } - } - } - - /* Ordinarily return, but not if we want to output all - and there are elements left. */ - if (! (all && next != 0)) - return; - - /* Generate space up to the position of NEXT. */ - if (constructor_incremental) - { - tree filled; - tree nextpos_tree = size_int (0); - - if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - { - tree tail; - /* Find the last field written out, if any. */ - for (tail = TYPE_FIELDS (constructor_type); tail; - tail = TREE_CHAIN (tail)) - if (TREE_CHAIN (tail) == constructor_unfilled_fields) - break; - - if (tail) - /* Find the offset of the end of that field. */ - filled = size_binop (CEIL_DIV_EXPR, - size_binop (PLUS_EXPR, - DECL_FIELD_BITPOS (tail), - DECL_SIZE (tail)), - size_int (BITS_PER_UNIT)); - else - filled = size_int (0); - - nextpos_tree = size_binop (CEIL_DIV_EXPR, - DECL_FIELD_BITPOS (next), - size_int (BITS_PER_UNIT)); - - TREE_INT_CST_HIGH (constructor_bit_index) - = TREE_INT_CST_HIGH (DECL_FIELD_BITPOS (next)); - TREE_INT_CST_LOW (constructor_bit_index) - = TREE_INT_CST_LOW (DECL_FIELD_BITPOS (next)); - constructor_unfilled_fields = next; - } - else if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - filled = size_binop (MULT_EXPR, constructor_unfilled_index, - size_in_bytes (TREE_TYPE (constructor_type))); - nextpos_tree - = size_binop (MULT_EXPR, next, - size_in_bytes (TREE_TYPE (constructor_type))); - TREE_INT_CST_LOW (constructor_unfilled_index) - = TREE_INT_CST_LOW (next); - TREE_INT_CST_HIGH (constructor_unfilled_index) - = TREE_INT_CST_HIGH (next); - } - else - filled = 0; - - if (filled) - { - int nextpos = TREE_INT_CST_LOW (nextpos_tree); - - assemble_zeros (nextpos - TREE_INT_CST_LOW (filled)); - } - } - else - { - /* If it's not incremental, just skip over the gap, - so that after jumping to retry we will output the next - successive element. */ - if (TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - constructor_unfilled_fields = next; - else if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - TREE_INT_CST_LOW (constructor_unfilled_index) - = TREE_INT_CST_LOW (next); - TREE_INT_CST_HIGH (constructor_unfilled_index) - = TREE_INT_CST_HIGH (next); - } - } - - /* ELT now points to the node in the pending tree with the next - initializer to output. */ - goto retry; -} - -/* Add one non-braced element to the current constructor level. - This adjusts the current position within the constructor's type. - This may also start or terminate implicit levels - to handle a partly-braced initializer. - - Once this has found the correct level for the new element, - it calls output_init_element. - - Note: if we are incrementally outputting this constructor, - this function may be called with a null argument - representing a sub-constructor that was already incrementally output. - When that happens, we output nothing, but we do the bookkeeping - to skip past that element of the current constructor. */ - -void -process_init_element (value) - tree value; -{ - tree orig_value = value; - int string_flag = value != 0 && TREE_CODE (value) == STRING_CST; - - /* Handle superfluous braces around string cst as in - char x[] = {"foo"}; */ - if (string_flag - && constructor_type - && TREE_CODE (constructor_type) == ARRAY_TYPE - && TREE_CODE (TREE_TYPE (constructor_type)) == INTEGER_TYPE - && integer_zerop (constructor_unfilled_index)) - { - constructor_stack->replacement_value = value; - return; - } - - if (constructor_stack->replacement_value != 0) - { - error_init ("excess elements in struct initializer"); - return; - } - - /* Ignore elements of a brace group if it is entirely superfluous - and has already been diagnosed. */ - if (constructor_type == 0) - return; - - /* If we've exhausted any levels that didn't have braces, - pop them now. */ - while (constructor_stack->implicit) - { - if ((TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - && constructor_fields == 0) - process_init_element (pop_init_level (1)); - else if (TREE_CODE (constructor_type) == ARRAY_TYPE - && (constructor_max_index == 0 - || tree_int_cst_lt (constructor_max_index, - constructor_index))) - process_init_element (pop_init_level (1)); - else - break; - } - - while (1) - { - if (TREE_CODE (constructor_type) == RECORD_TYPE) - { - tree fieldtype; - enum tree_code fieldcode; - - if (constructor_fields == 0) - { - pedwarn_init ("excess elements in struct initializer"); - break; - } - - fieldtype = TREE_TYPE (constructor_fields); - if (fieldtype != error_mark_node) - fieldtype = TYPE_MAIN_VARIANT (fieldtype); - fieldcode = TREE_CODE (fieldtype); - - /* Accept a string constant to initialize a subarray. */ - if (value != 0 - && fieldcode == ARRAY_TYPE - && TREE_CODE (TREE_TYPE (fieldtype)) == INTEGER_TYPE - && string_flag) - value = orig_value; - /* Otherwise, if we have come to a subaggregate, - and we don't have an element of its type, push into it. */ - else if (value != 0 && !constructor_no_implicit - && value != error_mark_node - && TYPE_MAIN_VARIANT (TREE_TYPE (value)) != fieldtype - && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE - || fieldcode == UNION_TYPE)) - { - push_init_level (1); - continue; - } - - if (value) - { - push_member_name (constructor_fields); - output_init_element (value, fieldtype, constructor_fields, 1); - RESTORE_SPELLING_DEPTH (constructor_depth); - } - else - /* Do the bookkeeping for an element that was - directly output as a constructor. */ - { - /* For a record, keep track of end position of last field. */ - tree temp = size_binop (PLUS_EXPR, - DECL_FIELD_BITPOS (constructor_fields), - DECL_SIZE (constructor_fields)); - TREE_INT_CST_LOW (constructor_bit_index) - = TREE_INT_CST_LOW (temp); - TREE_INT_CST_HIGH (constructor_bit_index) - = TREE_INT_CST_HIGH (temp); - - constructor_unfilled_fields = TREE_CHAIN (constructor_fields); - } - - constructor_fields = TREE_CHAIN (constructor_fields); - /* Skip any nameless bit fields at the beginning. */ - while (constructor_fields != 0 - && DECL_C_BIT_FIELD (constructor_fields) - && DECL_NAME (constructor_fields) == 0) - constructor_fields = TREE_CHAIN (constructor_fields); - break; - } - if (TREE_CODE (constructor_type) == UNION_TYPE) - { - tree fieldtype; - enum tree_code fieldcode; - - if (constructor_fields == 0) - { - pedwarn_init ("excess elements in union initializer"); - break; - } - - fieldtype = TREE_TYPE (constructor_fields); - if (fieldtype != error_mark_node) - fieldtype = TYPE_MAIN_VARIANT (fieldtype); - fieldcode = TREE_CODE (fieldtype); - - /* Accept a string constant to initialize a subarray. */ - if (value != 0 - && fieldcode == ARRAY_TYPE - && TREE_CODE (TREE_TYPE (fieldtype)) == INTEGER_TYPE - && string_flag) - value = orig_value; - /* Otherwise, if we have come to a subaggregate, - and we don't have an element of its type, push into it. */ - else if (value != 0 && !constructor_no_implicit - && value != error_mark_node - && TYPE_MAIN_VARIANT (TREE_TYPE (value)) != fieldtype - && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE - || fieldcode == UNION_TYPE)) - { - push_init_level (1); - continue; - } - - if (value) - { - push_member_name (constructor_fields); - output_init_element (value, fieldtype, constructor_fields, 1); - RESTORE_SPELLING_DEPTH (constructor_depth); - } - else - /* Do the bookkeeping for an element that was - directly output as a constructor. */ - { - TREE_INT_CST_LOW (constructor_bit_index) - = TREE_INT_CST_LOW (DECL_SIZE (constructor_fields)); - TREE_INT_CST_HIGH (constructor_bit_index) - = TREE_INT_CST_HIGH (DECL_SIZE (constructor_fields)); - - constructor_unfilled_fields = TREE_CHAIN (constructor_fields); - } - - constructor_fields = 0; - break; - } - if (TREE_CODE (constructor_type) == ARRAY_TYPE) - { - tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type)); - enum tree_code eltcode = TREE_CODE (elttype); - - /* Accept a string constant to initialize a subarray. */ - if (value != 0 - && eltcode == ARRAY_TYPE - && TREE_CODE (TREE_TYPE (elttype)) == INTEGER_TYPE - && string_flag) - value = orig_value; - /* Otherwise, if we have come to a subaggregate, - and we don't have an element of its type, push into it. */ - else if (value != 0 && !constructor_no_implicit - && value != error_mark_node - && TYPE_MAIN_VARIANT (TREE_TYPE (value)) != elttype - && (eltcode == RECORD_TYPE || eltcode == ARRAY_TYPE - || eltcode == UNION_TYPE)) - { - push_init_level (1); - continue; - } - - if (constructor_max_index != 0 - && tree_int_cst_lt (constructor_max_index, constructor_index)) - { - pedwarn_init ("excess elements in array initializer"); - break; - } - - /* In the case of [LO .. HI] = VALUE, only evaluate VALUE once. */ - if (constructor_range_end) - { - if (constructor_max_index != 0 - && tree_int_cst_lt (constructor_max_index, - constructor_range_end)) - { - pedwarn_init ("excess elements in array initializer"); - TREE_INT_CST_HIGH (constructor_range_end) - = TREE_INT_CST_HIGH (constructor_max_index); - TREE_INT_CST_LOW (constructor_range_end) - = TREE_INT_CST_LOW (constructor_max_index); - } - - value = save_expr (value); - } - - /* Now output the actual element. - Ordinarily, output once. - If there is a range, repeat it till we advance past the range. */ - do - { - tree tem; - - if (value) - { - push_array_bounds (TREE_INT_CST_LOW (constructor_index)); - output_init_element (value, elttype, constructor_index, 1); - RESTORE_SPELLING_DEPTH (constructor_depth); - } - - tem = size_binop (PLUS_EXPR, constructor_index, - integer_one_node); - TREE_INT_CST_LOW (constructor_index) = TREE_INT_CST_LOW (tem); - TREE_INT_CST_HIGH (constructor_index) = TREE_INT_CST_HIGH (tem); - - if (!value) - /* If we are doing the bookkeeping for an element that was - directly output as a constructor, - we must update constructor_unfilled_index. */ - { - TREE_INT_CST_LOW (constructor_unfilled_index) - = TREE_INT_CST_LOW (constructor_index); - TREE_INT_CST_HIGH (constructor_unfilled_index) - = TREE_INT_CST_HIGH (constructor_index); - } - } - while (! (constructor_range_end == 0 - || tree_int_cst_lt (constructor_range_end, - constructor_index))); - - break; - } - - /* Handle the sole element allowed in a braced initializer - for a scalar variable. */ - if (constructor_fields == 0) - { - pedwarn_init ("excess elements in scalar initializer"); - break; - } - - if (value) - output_init_element (value, constructor_type, NULL_TREE, 1); - constructor_fields = 0; - break; - } - - /* If the (lexically) previous elments are not now saved, - we can discard the storage for them. */ - if (constructor_incremental && constructor_pending_elts == 0 && value != 0 - && constructor_stack == 0) - clear_momentary (); -} - -/* Expand an ASM statement with operands, handling output operands - that are not variables or INDIRECT_REFS by transforming such - cases into cases that expand_asm_operands can handle. - - Arguments are same as for expand_asm_operands. */ - -void -c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) - tree string, outputs, inputs, clobbers; - int vol; - char *filename; - int line; -{ - int noutputs = list_length (outputs); - register int i; - /* o[I] is the place that output number I should be written. */ - register tree *o = (tree *) alloca (noutputs * sizeof (tree)); - register tree tail; - - if (TREE_CODE (string) == ADDR_EXPR) - string = TREE_OPERAND (string, 0); - if (TREE_CODE (string) != STRING_CST) - { - error ("asm template is not a string constant"); - return; - } - - /* Record the contents of OUTPUTS before it is modified. */ - for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++) - o[i] = TREE_VALUE (tail); - - /* Perform default conversions on array and function inputs. */ - /* Don't do this for other types-- - it would screw up operands expected to be in memory. */ - for (i = 0, tail = inputs; tail; tail = TREE_CHAIN (tail), i++) - if (TREE_CODE (TREE_TYPE (TREE_VALUE (tail))) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (TREE_VALUE (tail))) == FUNCTION_TYPE) - TREE_VALUE (tail) = default_conversion (TREE_VALUE (tail)); - - /* Generate the ASM_OPERANDS insn; - store into the TREE_VALUEs of OUTPUTS some trees for - where the values were actually stored. */ - expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line); - - /* Copy all the intermediate outputs into the specified outputs. */ - for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++) - { - if (o[i] != TREE_VALUE (tail)) - { - expand_expr (build_modify_expr (o[i], NOP_EXPR, TREE_VALUE (tail)), - NULL_RTX, VOIDmode, EXPAND_NORMAL); - free_temp_slots (); - } - /* Detect modification of read-only values. - (Otherwise done by build_modify_expr.) */ - else - { - tree type = TREE_TYPE (o[i]); - if (TREE_READONLY (o[i]) - || TYPE_READONLY (type) - || ((TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE) - && C_TYPE_FIELDS_READONLY (type))) - readonly_warning (o[i], "modification by `asm'"); - } - } - - /* Those MODIFY_EXPRs could do autoincrements. */ - emit_queue (); -} - -/* Expand a C `return' statement. - RETVAL is the expression for what to return, - or a null pointer for `return;' with no value. */ - -void -c_expand_return (retval) - tree retval; -{ - tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl)); - - if (TREE_THIS_VOLATILE (current_function_decl)) - warning ("function declared `noreturn' has a `return' statement"); - - if (!retval) - { - current_function_returns_null = 1; - if (warn_return_type && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE) - warning ("`return' with no value, in function returning non-void"); - expand_null_return (); - } - else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE) - { - current_function_returns_null = 1; - if (pedantic || TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE) - pedwarn ("`return' with a value, in function returning void"); - expand_return (retval); - } - else - { - tree t = convert_for_assignment (valtype, retval, _("return"), - NULL_TREE, NULL_TREE, 0); - tree res = DECL_RESULT (current_function_decl); - tree inner; - - if (t == error_mark_node) - return; - - inner = t = convert (TREE_TYPE (res), t); - - /* Strip any conversions, additions, and subtractions, and see if - we are returning the address of a local variable. Warn if so. */ - while (1) - { - switch (TREE_CODE (inner)) - { - case NOP_EXPR: case NON_LVALUE_EXPR: case CONVERT_EXPR: - case PLUS_EXPR: - inner = TREE_OPERAND (inner, 0); - continue; - - case MINUS_EXPR: - /* If the second operand of the MINUS_EXPR has a pointer - type (or is converted from it), this may be valid, so - don't give a warning. */ - { - tree op1 = TREE_OPERAND (inner, 1); - - while (! POINTER_TYPE_P (TREE_TYPE (op1)) - && (TREE_CODE (op1) == NOP_EXPR - || TREE_CODE (op1) == NON_LVALUE_EXPR - || TREE_CODE (op1) == CONVERT_EXPR)) - op1 = TREE_OPERAND (op1, 0); - - if (POINTER_TYPE_P (TREE_TYPE (op1))) - break; - - inner = TREE_OPERAND (inner, 0); - continue; - } - - case ADDR_EXPR: - inner = TREE_OPERAND (inner, 0); - - while (TREE_CODE_CLASS (TREE_CODE (inner)) == 'r') - inner = TREE_OPERAND (inner, 0); - - if (TREE_CODE (inner) == VAR_DECL - && ! DECL_EXTERNAL (inner) - && ! TREE_STATIC (inner) - && DECL_CONTEXT (inner) == current_function_decl) - warning ("function returns address of local variable"); - break; - - default: - break; - } - - break; - } - - t = build (MODIFY_EXPR, TREE_TYPE (res), res, t); - TREE_SIDE_EFFECTS (t) = 1; - expand_return (t); - current_function_returns_value = 1; - } -} - -/* Start a C switch statement, testing expression EXP. - Return EXP if it is valid, an error node otherwise. */ - -tree -c_expand_start_case (exp) - tree exp; -{ - register enum tree_code code = TREE_CODE (TREE_TYPE (exp)); - tree type = TREE_TYPE (exp); - - if (code != INTEGER_TYPE && code != ENUMERAL_TYPE && code != ERROR_MARK) - { - error ("switch quantity not an integer"); - exp = error_mark_node; - } - else - { - tree index; - type = TYPE_MAIN_VARIANT (TREE_TYPE (exp)); - - if (warn_traditional - && (type == long_integer_type_node - || type == long_unsigned_type_node)) - pedwarn ("`long' switch expression not converted to `int' in ANSI C"); - - exp = default_conversion (exp); - type = TREE_TYPE (exp); - index = get_unwidened (exp, NULL_TREE); - /* We can't strip a conversion from a signed type to an unsigned, - because if we did, int_fits_type_p would do the wrong thing - when checking case values for being in range, - and it's too hard to do the right thing. */ - if (TREE_UNSIGNED (TREE_TYPE (exp)) - == TREE_UNSIGNED (TREE_TYPE (index))) - exp = index; - } - - expand_start_case (1, exp, type, "switch statement"); - - return exp; -} diff --git a/contrib/gcc/caller-save.c b/contrib/gcc/caller-save.c deleted file mode 100644 index 7c390a5955ee..000000000000 --- a/contrib/gcc/caller-save.c +++ /dev/null @@ -1,757 +0,0 @@ -/* Save and restore call-clobbered registers which are live across a call. - Copyright (C) 1989, 1992, 94-95, 97, 98, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "insn-config.h" -#include "flags.h" -#include "regs.h" -#include "hard-reg-set.h" -#include "recog.h" -#include "basic-block.h" -#include "reload.h" -#include "expr.h" -#include "toplev.h" - -#ifndef MAX_MOVE_MAX -#define MAX_MOVE_MAX MOVE_MAX -#endif - -#ifndef MIN_UNITS_PER_WORD -#define MIN_UNITS_PER_WORD UNITS_PER_WORD -#endif - -#define MOVE_MAX_WORDS (MOVE_MAX / UNITS_PER_WORD) - -/* Modes for each hard register that we can save. The smallest mode is wide - enough to save the entire contents of the register. When saving the - register because it is live we first try to save in multi-register modes. - If that is not possible the save is done one register at a time. */ - -static enum machine_mode - regno_save_mode[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1]; - -/* For each hard register, a place on the stack where it can be saved, - if needed. */ - -static rtx - regno_save_mem[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1]; - -/* We will only make a register eligible for caller-save if it can be - saved in its widest mode with a simple SET insn as long as the memory - address is valid. We record the INSN_CODE is those insns here since - when we emit them, the addresses might not be valid, so they might not - be recognized. */ - -static enum insn_code - reg_save_code[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1]; -static enum insn_code - reg_restore_code[FIRST_PSEUDO_REGISTER][MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1]; - -/* Set of hard regs currently residing in save area (during insn scan). */ - -static HARD_REG_SET hard_regs_saved; - -/* Number of registers currently in hard_regs_saved. */ - -static int n_regs_saved; - -/* Computed by mark_referenced_regs, all regs referenced in a given - insn. */ -static HARD_REG_SET referenced_regs; - -/* Computed in mark_set_regs, holds all registers set by the current - instruction. */ -static HARD_REG_SET this_insn_sets; - - -static void mark_set_regs PROTO((rtx, rtx)); -static void mark_referenced_regs PROTO((rtx)); -static int insert_save PROTO((struct insn_chain *, int, int, - HARD_REG_SET *)); -static int insert_restore PROTO((struct insn_chain *, int, int, - int)); -static void insert_one_insn PROTO((struct insn_chain *, int, - enum insn_code, rtx)); - -/* Initialize for caller-save. - - Look at all the hard registers that are used by a call and for which - regclass.c has not already excluded from being used across a call. - - Ensure that we can find a mode to save the register and that there is a - simple insn to save and restore the register. This latter check avoids - problems that would occur if we tried to save the MQ register of some - machines directly into memory. */ - -void -init_caller_save () -{ - char *first_obj = (char *) oballoc (0); - rtx addr_reg; - int offset; - rtx address; - int i, j; - - /* First find all the registers that we need to deal with and all - the modes that they can have. If we can't find a mode to use, - we can't have the register live over calls. */ - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - { - if (call_used_regs[i] && ! call_fixed_regs[i]) - { - for (j = 1; j <= MOVE_MAX_WORDS; j++) - { - regno_save_mode[i][j] = HARD_REGNO_CALLER_SAVE_MODE (i, j); - if (regno_save_mode[i][j] == VOIDmode && j == 1) - { - call_fixed_regs[i] = 1; - SET_HARD_REG_BIT (call_fixed_reg_set, i); - } - } - } - else - regno_save_mode[i][1] = VOIDmode; - } - - /* The following code tries to approximate the conditions under which - we can easily save and restore a register without scratch registers or - other complexities. It will usually work, except under conditions where - the validity of an insn operand is dependent on the address offset. - No such cases are currently known. - - We first find a typical offset from some BASE_REG_CLASS register. - This address is chosen by finding the first register in the class - and by finding the smallest power of two that is a valid offset from - that register in every mode we will use to save registers. */ - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (TEST_HARD_REG_BIT (reg_class_contents[(int) BASE_REG_CLASS], i)) - break; - - if (i == FIRST_PSEUDO_REGISTER) - abort (); - - addr_reg = gen_rtx_REG (Pmode, i); - - for (offset = 1 << (HOST_BITS_PER_INT / 2); offset; offset >>= 1) - { - address = gen_rtx_PLUS (Pmode, addr_reg, GEN_INT (offset)); - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (regno_save_mode[i][1] != VOIDmode - && ! strict_memory_address_p (regno_save_mode[i][1], address)) - break; - - if (i == FIRST_PSEUDO_REGISTER) - break; - } - - /* If we didn't find a valid address, we must use register indirect. */ - if (offset == 0) - address = addr_reg; - - /* Next we try to form an insn to save and restore the register. We - see if such an insn is recognized and meets its constraints. */ - - start_sequence (); - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - for (j = 1; j <= MOVE_MAX_WORDS; j++) - if (regno_save_mode[i][j] != VOIDmode) - { - rtx mem = gen_rtx_MEM (regno_save_mode[i][j], address); - rtx reg = gen_rtx_REG (regno_save_mode[i][j], i); - rtx savepat = gen_rtx_SET (VOIDmode, mem, reg); - rtx restpat = gen_rtx_SET (VOIDmode, reg, mem); - rtx saveinsn = emit_insn (savepat); - rtx restinsn = emit_insn (restpat); - int ok; - - reg_save_code[i][j] = recog_memoized (saveinsn); - reg_restore_code[i][j] = recog_memoized (restinsn); - - /* Now extract both insns and see if we can meet their - constraints. */ - ok = (reg_save_code[i][j] != (enum insn_code)-1 - && reg_restore_code[i][j] != (enum insn_code)-1); - if (ok) - { - extract_insn (saveinsn); - ok = constrain_operands (1); - extract_insn (restinsn); - ok &= constrain_operands (1); - } - - if (! ok) - { - regno_save_mode[i][j] = VOIDmode; - if (j == 1) - { - call_fixed_regs[i] = 1; - SET_HARD_REG_BIT (call_fixed_reg_set, i); - } - } - } - - end_sequence (); - - obfree (first_obj); -} - -/* Initialize save areas by showing that we haven't allocated any yet. */ - -void -init_save_areas () -{ - int i, j; - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - for (j = 1; j <= MOVE_MAX_WORDS; j++) - regno_save_mem[i][j] = 0; -} - -/* Allocate save areas for any hard registers that might need saving. - We take a conservative approach here and look for call-clobbered hard - registers that are assigned to pseudos that cross calls. This may - overestimate slightly (especially if some of these registers are later - used as spill registers), but it should not be significant. - - Future work: - - In the fallback case we should iterate backwards across all possible - modes for the save, choosing the largest available one instead of - falling back to the smallest mode immediately. (eg TF -> DF -> SF). - - We do not try to use "move multiple" instructions that exist - on some machines (such as the 68k moveml). It could be a win to try - and use them when possible. The hard part is doing it in a way that is - machine independent since they might be saving non-consecutive - registers. (imagine caller-saving d0,d1,a0,a1 on the 68k) */ - -void -setup_save_areas () -{ - int i, j, k; - HARD_REG_SET hard_regs_used; - - /* Allocate space in the save area for the largest multi-register - pseudos first, then work backwards to single register - pseudos. */ - - /* Find and record all call-used hard-registers in this function. */ - CLEAR_HARD_REG_SET (hard_regs_used); - for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) - if (reg_renumber[i] >= 0 && REG_N_CALLS_CROSSED (i) > 0) - { - int regno = reg_renumber[i]; - int endregno - = regno + HARD_REGNO_NREGS (regno, GET_MODE (regno_reg_rtx[i])); - int nregs = endregno - regno; - - for (j = 0; j < nregs; j++) - { - if (call_used_regs[regno+j]) - SET_HARD_REG_BIT (hard_regs_used, regno+j); - } - } - - /* Now run through all the call-used hard-registers and allocate - space for them in the caller-save area. Try to allocate space - in a manner which allows multi-register saves/restores to be done. */ - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - for (j = MOVE_MAX_WORDS; j > 0; j--) - { - int do_save = 1; - - /* If no mode exists for this size, try another. Also break out - if we have already saved this hard register. */ - if (regno_save_mode[i][j] == VOIDmode || regno_save_mem[i][1] != 0) - continue; - - /* See if any register in this group has been saved. */ - for (k = 0; k < j; k++) - if (regno_save_mem[i + k][1]) - { - do_save = 0; - break; - } - if (! do_save) - continue; - - for (k = 0; k < j; k++) - if (! TEST_HARD_REG_BIT (hard_regs_used, i + k)) - { - do_save = 0; - break; - } - if (! do_save) - continue; - - /* We have found an acceptable mode to store in. */ - regno_save_mem[i][j] - = assign_stack_local (regno_save_mode[i][j], - GET_MODE_SIZE (regno_save_mode[i][j]), 0); - - /* Setup single word save area just in case... */ - for (k = 0; k < j; k++) - { - /* This should not depend on WORDS_BIG_ENDIAN. - The order of words in regs is the same as in memory. */ - rtx temp = gen_rtx_MEM (regno_save_mode[i+k][1], - XEXP (regno_save_mem[i][j], 0)); - - regno_save_mem[i+k][1] - = adj_offsettable_operand (temp, k * UNITS_PER_WORD); - } - } -} - -/* Find the places where hard regs are live across calls and save them. */ -void -save_call_clobbered_regs () -{ - struct insn_chain *chain, *next; - - CLEAR_HARD_REG_SET (hard_regs_saved); - n_regs_saved = 0; - - for (chain = reload_insn_chain; chain != 0; chain = next) - { - rtx insn = chain->insn; - enum rtx_code code = GET_CODE (insn); - - next = chain->next; - - if (chain->is_caller_save_insn) - abort (); - - if (GET_RTX_CLASS (code) == 'i') - { - /* If some registers have been saved, see if INSN references - any of them. We must restore them before the insn if so. */ - - if (n_regs_saved) - { - int regno; - - if (code == JUMP_INSN) - /* Restore all registers if this is a JUMP_INSN. */ - COPY_HARD_REG_SET (referenced_regs, hard_regs_saved); - else - { - CLEAR_HARD_REG_SET (referenced_regs); - mark_referenced_regs (PATTERN (insn)); - AND_HARD_REG_SET (referenced_regs, hard_regs_saved); - } - - for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if (TEST_HARD_REG_BIT (referenced_regs, regno)) - regno += insert_restore (chain, 1, regno, MOVE_MAX_WORDS); - } - - if (code == CALL_INSN) - { - rtx x; - int regno, nregs; - HARD_REG_SET hard_regs_to_save; - - /* Use the register life information in CHAIN to compute which - regs are live before the call. */ - REG_SET_TO_HARD_REG_SET (hard_regs_to_save, chain->live_before); - compute_use_by_pseudos (&hard_regs_to_save, chain->live_before); - - /* Record all registers set in this call insn. These don't need - to be saved. */ - CLEAR_HARD_REG_SET (this_insn_sets); - note_stores (PATTERN (insn), mark_set_regs); - - /* Compute which hard regs must be saved before this call. */ - AND_COMPL_HARD_REG_SET (hard_regs_to_save, call_fixed_reg_set); - AND_COMPL_HARD_REG_SET (hard_regs_to_save, this_insn_sets); - AND_COMPL_HARD_REG_SET (hard_regs_to_save, hard_regs_saved); - AND_HARD_REG_SET (hard_regs_to_save, call_used_reg_set); - - /* Registers used for function parameters need not be saved. */ - for (x = CALL_INSN_FUNCTION_USAGE (insn); x != 0; - x = XEXP (x, 1)) - { - rtx y; - - if (GET_CODE (XEXP (x, 0)) != USE) - continue; - y = XEXP (XEXP (x, 0), 0); - if (GET_CODE (y) != REG) - abort (); - regno = REGNO (y); - if (REGNO (y) >= FIRST_PSEUDO_REGISTER) - abort (); - nregs = HARD_REGNO_NREGS (regno, GET_MODE (y)); - while (nregs-- > 0) - CLEAR_HARD_REG_BIT (hard_regs_to_save, regno + nregs); - } - - /* Neither do registers for which we find a death note. */ - for (x = REG_NOTES (insn); x != 0; x = XEXP (x, 1)) - { - rtx y = XEXP (x, 0); - - if (REG_NOTE_KIND (x) != REG_DEAD) - continue; - if (GET_CODE (y) != REG) - abort (); - regno = REGNO (y); - - if (regno >= FIRST_PSEUDO_REGISTER) - regno = reg_renumber[regno]; - if (regno < 0) - continue; - nregs = HARD_REGNO_NREGS (regno, GET_MODE (y)); - while (nregs-- > 0) - CLEAR_HARD_REG_BIT (hard_regs_to_save, regno + nregs); - } - - for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if (TEST_HARD_REG_BIT (hard_regs_to_save, regno)) - regno += insert_save (chain, 1, regno, &hard_regs_to_save); - - /* Must recompute n_regs_saved. */ - n_regs_saved = 0; - for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if (TEST_HARD_REG_BIT (hard_regs_saved, regno)) - n_regs_saved++; - } - } - - if (chain->next == 0 || chain->next->block > chain->block) - { - int regno; - /* At the end of the basic block, we must restore any registers that - remain saved. If the last insn in the block is a JUMP_INSN, put - the restore before the insn, otherwise, put it after the insn. */ - - if (n_regs_saved) - for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if (TEST_HARD_REG_BIT (hard_regs_saved, regno)) - regno += insert_restore (chain, GET_CODE (insn) == JUMP_INSN, - regno, MOVE_MAX_WORDS); - } - } -} - -/* Here from note_stores when an insn stores a value in a register. - Set the proper bit or bits in this_insn_sets. All pseudos that have - been assigned hard regs have had their register number changed already, - so we can ignore pseudos. */ -static void -mark_set_regs (reg, setter) - rtx reg; - rtx setter ATTRIBUTE_UNUSED; -{ - register int regno, endregno, i; - enum machine_mode mode = GET_MODE (reg); - int word = 0; - - if (GET_CODE (reg) == SUBREG) - { - word = SUBREG_WORD (reg); - reg = SUBREG_REG (reg); - } - - if (GET_CODE (reg) != REG || REGNO (reg) >= FIRST_PSEUDO_REGISTER) - return; - - regno = REGNO (reg) + word; - endregno = regno + HARD_REGNO_NREGS (regno, mode); - - for (i = regno; i < endregno; i++) - SET_HARD_REG_BIT (this_insn_sets, i); -} - -/* Walk X and record all referenced registers in REFERENCED_REGS. */ -static void -mark_referenced_regs (x) - rtx x; -{ - enum rtx_code code = GET_CODE (x); - char *fmt; - int i, j; - - if (code == SET) - mark_referenced_regs (SET_SRC (x)); - if (code == SET || code == CLOBBER) - { - x = SET_DEST (x); - code = GET_CODE (x); - if (code == REG || code == PC || code == CC0 - || (code == SUBREG && GET_CODE (SUBREG_REG (x)) == REG)) - return; - } - if (code == MEM || code == SUBREG) - { - x = XEXP (x, 0); - code = GET_CODE (x); - } - - if (code == REG) - { - int regno = REGNO (x); - int hardregno = (regno < FIRST_PSEUDO_REGISTER ? regno - : reg_renumber[regno]); - - if (hardregno >= 0) - { - int nregs = HARD_REGNO_NREGS (hardregno, GET_MODE (x)); - while (nregs-- > 0) - SET_HARD_REG_BIT (referenced_regs, hardregno + nregs); - } - /* If this is a pseudo that did not get a hard register, scan its - memory location, since it might involve the use of another - register, which might be saved. */ - else if (reg_equiv_mem[regno] != 0) - mark_referenced_regs (XEXP (reg_equiv_mem[regno], 0)); - else if (reg_equiv_address[regno] != 0) - mark_referenced_regs (reg_equiv_address[regno]); - return; - } - - fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - { - if (fmt[i] == 'e') - mark_referenced_regs (XEXP (x, i)); - else if (fmt[i] == 'E') - for (j = XVECLEN (x, i) - 1; j >= 0; j--) - mark_referenced_regs (XVECEXP (x, i, j)); - } -} - -/* Insert a sequence of insns to restore. Place these insns in front of - CHAIN if BEFORE_P is nonzero, behind the insn otherwise. MAXRESTORE is - the maximum number of registers which should be restored during this call. - It should never be less than 1 since we only work with entire registers. - - Note that we have verified in init_caller_save that we can do this - with a simple SET, so use it. Set INSN_CODE to what we save there - since the address might not be valid so the insn might not be recognized. - These insns will be reloaded and have register elimination done by - find_reload, so we need not worry about that here. - - Return the extra number of registers saved. */ - -static int -insert_restore (chain, before_p, regno, maxrestore) - struct insn_chain *chain; - int before_p; - int regno; - int maxrestore; -{ - int i; - rtx pat = NULL_RTX; - enum insn_code code = CODE_FOR_nothing; - int numregs = 0; - - /* A common failure mode if register status is not correct in the RTL - is for this routine to be called with a REGNO we didn't expect to - save. That will cause us to write an insn with a (nil) SET_DEST - or SET_SRC. Instead of doing so and causing a crash later, check - for this common case and abort here instead. This will remove one - step in debugging such problems. */ - - if (regno_save_mem[regno][1] == 0) - abort (); - - /* Get the pattern to emit and update our status. - - See if we can restore `maxrestore' registers at once. Work - backwards to the single register case. */ - for (i = maxrestore; i > 0; i--) - { - int j, k; - int ok = 1; - - if (regno_save_mem[regno][i] == 0) - continue; - - for (j = 0; j < i; j++) - if (! TEST_HARD_REG_BIT (hard_regs_saved, regno + j)) - { - ok = 0; - break; - } - /* Must do this one restore at a time */ - if (! ok) - continue; - - pat = gen_rtx_SET (VOIDmode, - gen_rtx_REG (GET_MODE (regno_save_mem[regno][i]), - regno), - regno_save_mem[regno][i]); - code = reg_restore_code[regno][i]; - - /* Clear status for all registers we restored. */ - for (k = 0; k < i; k++) - { - CLEAR_HARD_REG_BIT (hard_regs_saved, regno + k); - n_regs_saved--; - } - - numregs = i; - break; - } - - insert_one_insn (chain, before_p, code, pat); - - /* Tell our callers how many extra registers we saved/restored */ - return numregs - 1; -} - -/* Like insert_restore above, but save registers instead. */ -static int -insert_save (chain, before_p, regno, to_save) - struct insn_chain *chain; - int before_p; - int regno; - HARD_REG_SET *to_save; -{ - int i; - rtx pat = NULL_RTX; - enum insn_code code = CODE_FOR_nothing; - int numregs = 0; - - /* A common failure mode if register status is not correct in the RTL - is for this routine to be called with a REGNO we didn't expect to - save. That will cause us to write an insn with a (nil) SET_DEST - or SET_SRC. Instead of doing so and causing a crash later, check - for this common case and abort here instead. This will remove one - step in debugging such problems. */ - - if (regno_save_mem[regno][1] == 0) - abort (); - - /* Get the pattern to emit and update our status. - - See if we can save several registers with a single instruction. - Work backwards to the single register case. */ - for (i = MOVE_MAX_WORDS; i > 0; i--) - { - int j, k; - int ok = 1; - if (regno_save_mem[regno][i] == 0) - continue; - - for (j = 0; j < i; j++) - if (! TEST_HARD_REG_BIT (*to_save, regno + j)) - { - ok = 0; - break; - } - /* Must do this one save at a time */ - if (! ok) - continue; - - pat = gen_rtx_SET (VOIDmode, regno_save_mem[regno][i], - gen_rtx_REG (GET_MODE (regno_save_mem[regno][i]), - regno)); - code = reg_save_code[regno][i]; - - /* Set hard_regs_saved for all the registers we saved. */ - for (k = 0; k < i; k++) - { - SET_HARD_REG_BIT (hard_regs_saved, regno + k); - n_regs_saved++; - } - - numregs = i; - break; - } - - insert_one_insn (chain, before_p, code, pat); - - /* Tell our callers how many extra registers we saved/restored */ - return numregs - 1; -} - -/* Emit a new caller-save insn and set the code. */ -static void -insert_one_insn (chain, before_p, code, pat) - struct insn_chain *chain; - int before_p; - enum insn_code code; - rtx pat; -{ - rtx insn = chain->insn; - struct insn_chain *new; - -#ifdef HAVE_cc0 - /* If INSN references CC0, put our insns in front of the insn that sets - CC0. This is always safe, since the only way we could be passed an - insn that references CC0 is for a restore, and doing a restore earlier - isn't a problem. We do, however, assume here that CALL_INSNs don't - reference CC0. Guard against non-INSN's like CODE_LABEL. */ - - if ((GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN) - && before_p - && reg_referenced_p (cc0_rtx, PATTERN (insn))) - chain = chain->prev, insn = chain->insn; -#endif - - new = new_insn_chain (); - if (before_p) - { - new->prev = chain->prev; - if (new->prev != 0) - new->prev->next = new; - else - reload_insn_chain = new; - - chain->prev = new; - new->next = chain; - new->insn = emit_insn_before (pat, insn); - /* ??? It would be nice if we could exclude the already / still saved - registers from the live sets. */ - COPY_REG_SET (new->live_before, chain->live_before); - COPY_REG_SET (new->live_after, chain->live_before); - if (chain->insn == BLOCK_HEAD (chain->block)) - BLOCK_HEAD (chain->block) = new->insn; - } - else - { - new->next = chain->next; - if (new->next != 0) - new->next->prev = new; - chain->next = new; - new->prev = chain; - new->insn = emit_insn_after (pat, insn); - /* ??? It would be nice if we could exclude the already / still saved - registers from the live sets, and observe REG_UNUSED notes. */ - COPY_REG_SET (new->live_before, chain->live_after); - COPY_REG_SET (new->live_after, chain->live_after); - if (chain->insn == BLOCK_END (chain->block)) - BLOCK_END (chain->block) = new->insn; - } - new->block = chain->block; - new->is_caller_save_insn = 1; - - INSN_CODE (new->insn) = code; -} diff --git a/contrib/gcc/calls.c b/contrib/gcc/calls.c deleted file mode 100644 index d0153a3d1249..000000000000 --- a/contrib/gcc/calls.c +++ /dev/null @@ -1,3940 +0,0 @@ -/* Convert function calls to rtl insns, for GNU C compiler. - Copyright (C) 1989, 92-97, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "tree.h" -#include "flags.h" -#include "expr.h" -#include "regs.h" -#include "insn-flags.h" -#include "toplev.h" -#include "output.h" - -#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY -#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY -#endif - -/* Decide whether a function's arguments should be processed - from first to last or from last to first. - - They should if the stack and args grow in opposite directions, but - only if we have push insns. */ - -#ifdef PUSH_ROUNDING - -#if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD) -#define PUSH_ARGS_REVERSED /* If it's last to first */ -#endif - -#endif - -/* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */ -#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) - -/* Data structure and subroutines used within expand_call. */ - -struct arg_data -{ - /* Tree node for this argument. */ - tree tree_value; - /* Mode for value; TYPE_MODE unless promoted. */ - enum machine_mode mode; - /* Current RTL value for argument, or 0 if it isn't precomputed. */ - rtx value; - /* Initially-compute RTL value for argument; only for const functions. */ - rtx initial_value; - /* Register to pass this argument in, 0 if passed on stack, or an - PARALLEL if the arg is to be copied into multiple non-contiguous - registers. */ - rtx reg; - /* If REG was promoted from the actual mode of the argument expression, - indicates whether the promotion is sign- or zero-extended. */ - int unsignedp; - /* Number of registers to use. 0 means put the whole arg in registers. - Also 0 if not passed in registers. */ - int partial; - /* Non-zero if argument must be passed on stack. - Note that some arguments may be passed on the stack - even though pass_on_stack is zero, just because FUNCTION_ARG says so. - pass_on_stack identifies arguments that *cannot* go in registers. */ - int pass_on_stack; - /* Offset of this argument from beginning of stack-args. */ - struct args_size offset; - /* Similar, but offset to the start of the stack slot. Different from - OFFSET if this arg pads downward. */ - struct args_size slot_offset; - /* Size of this argument on the stack, rounded up for any padding it gets, - parts of the argument passed in registers do not count. - If REG_PARM_STACK_SPACE is defined, then register parms - are counted here as well. */ - struct args_size size; - /* Location on the stack at which parameter should be stored. The store - has already been done if STACK == VALUE. */ - rtx stack; - /* Location on the stack of the start of this argument slot. This can - differ from STACK if this arg pads downward. This location is known - to be aligned to FUNCTION_ARG_BOUNDARY. */ - rtx stack_slot; -#ifdef ACCUMULATE_OUTGOING_ARGS - /* Place that this stack area has been saved, if needed. */ - rtx save_area; -#endif - /* If an argument's alignment does not permit direct copying into registers, - copy in smaller-sized pieces into pseudos. These are stored in a - block pointed to by this field. The next field says how many - word-sized pseudos we made. */ - rtx *aligned_regs; - int n_aligned_regs; -}; - -#ifdef ACCUMULATE_OUTGOING_ARGS -/* A vector of one char per byte of stack space. A byte if non-zero if - the corresponding stack location has been used. - This vector is used to prevent a function call within an argument from - clobbering any stack already set up. */ -static char *stack_usage_map; - -/* Size of STACK_USAGE_MAP. */ -static int highest_outgoing_arg_in_use; - -/* stack_arg_under_construction is nonzero when an argument may be - initialized with a constructor call (including a C function that - returns a BLKmode struct) and expand_call must take special action - to make sure the object being constructed does not overlap the - argument list for the constructor call. */ -int stack_arg_under_construction; -#endif - -static int calls_function PROTO ((tree, int)); -static int calls_function_1 PROTO ((tree, int)); -static void emit_call_1 PROTO ((rtx, tree, tree, HOST_WIDE_INT, - HOST_WIDE_INT, HOST_WIDE_INT, rtx, - rtx, int, rtx, int)); -static void special_function_p PROTO ((char *, tree, int *, int *, - int *, int *)); -static void precompute_register_parameters PROTO ((int, struct arg_data *, - int *)); -static void store_one_arg PROTO ((struct arg_data *, rtx, int, int, - int)); -static void store_unaligned_arguments_into_pseudos PROTO ((struct arg_data *, - int)); -static int finalize_must_preallocate PROTO ((int, int, - struct arg_data *, - struct args_size *)); -static void precompute_arguments PROTO ((int, int, int, - struct arg_data *, - struct args_size *)); -static int compute_argument_block_size PROTO ((int, - struct args_size *)); -static void initialize_argument_information PROTO ((int, - struct arg_data *, - struct args_size *, - int, tree, tree, - CUMULATIVE_ARGS *, - int, rtx *, int *, - int *, int *)); -static void compute_argument_addresses PROTO ((struct arg_data *, - rtx, int)); -static rtx rtx_for_function_call PROTO ((tree, tree)); -static void load_register_parameters PROTO ((struct arg_data *, - int, rtx *)); - -#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE) -static rtx save_fixed_argument_area PROTO ((int, rtx, int *, int *)); -static void restore_fixed_argument_area PROTO ((rtx, rtx, int, int)); -#endif - -/* If WHICH is 1, return 1 if EXP contains a call to the built-in function - `alloca'. - - If WHICH is 0, return 1 if EXP contains a call to any function. - Actually, we only need return 1 if evaluating EXP would require pushing - arguments on the stack, but that is too difficult to compute, so we just - assume any function call might require the stack. */ - -static tree calls_function_save_exprs; - -static int -calls_function (exp, which) - tree exp; - int which; -{ - int val; - calls_function_save_exprs = 0; - val = calls_function_1 (exp, which); - calls_function_save_exprs = 0; - return val; -} - -static int -calls_function_1 (exp, which) - tree exp; - int which; -{ - register int i; - enum tree_code code = TREE_CODE (exp); - int type = TREE_CODE_CLASS (code); - int length = tree_code_length[(int) code]; - - /* If this code is language-specific, we don't know what it will do. */ - if ((int) code >= NUM_TREE_CODES) - return 1; - - /* Only expressions and references can contain calls. */ - if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r' - && type != 'b') - return 0; - - switch (code) - { - case CALL_EXPR: - if (which == 0) - return 1; - else if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR - && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) - == FUNCTION_DECL)) - { - tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); - - if ((DECL_BUILT_IN (fndecl) - && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA) - || (DECL_SAVED_INSNS (fndecl) - && (FUNCTION_FLAGS (DECL_SAVED_INSNS (fndecl)) - & FUNCTION_FLAGS_CALLS_ALLOCA))) - return 1; - } - - /* Third operand is RTL. */ - length = 2; - break; - - case SAVE_EXPR: - if (SAVE_EXPR_RTL (exp) != 0) - return 0; - if (value_member (exp, calls_function_save_exprs)) - return 0; - calls_function_save_exprs = tree_cons (NULL_TREE, exp, - calls_function_save_exprs); - return (TREE_OPERAND (exp, 0) != 0 - && calls_function_1 (TREE_OPERAND (exp, 0), which)); - - case BLOCK: - { - register tree local; - - for (local = BLOCK_VARS (exp); local; local = TREE_CHAIN (local)) - if (DECL_INITIAL (local) != 0 - && calls_function_1 (DECL_INITIAL (local), which)) - return 1; - } - { - register tree subblock; - - for (subblock = BLOCK_SUBBLOCKS (exp); - subblock; - subblock = TREE_CHAIN (subblock)) - if (calls_function_1 (subblock, which)) - return 1; - } - return 0; - - case METHOD_CALL_EXPR: - length = 3; - break; - - case WITH_CLEANUP_EXPR: - length = 1; - break; - - case RTL_EXPR: - return 0; - - default: - break; - } - - for (i = 0; i < length; i++) - if (TREE_OPERAND (exp, i) != 0 - && calls_function_1 (TREE_OPERAND (exp, i), which)) - return 1; - - return 0; -} - -/* Force FUNEXP into a form suitable for the address of a CALL, - and return that as an rtx. Also load the static chain register - if FNDECL is a nested function. - - CALL_FUSAGE points to a variable holding the prospective - CALL_INSN_FUNCTION_USAGE information. */ - -rtx -prepare_call_address (funexp, fndecl, call_fusage, reg_parm_seen) - rtx funexp; - tree fndecl; - rtx *call_fusage; - int reg_parm_seen; -{ - rtx static_chain_value = 0; - - funexp = protect_from_queue (funexp, 0); - - if (fndecl != 0) - /* Get possible static chain value for nested function in C. */ - static_chain_value = lookup_static_chain (fndecl); - - /* Make a valid memory address and copy constants thru pseudo-regs, - but not for a constant address if -fno-function-cse. */ - if (GET_CODE (funexp) != SYMBOL_REF) - /* If we are using registers for parameters, force the - function address into a register now. */ - funexp = ((SMALL_REGISTER_CLASSES && reg_parm_seen) - ? force_not_mem (memory_address (FUNCTION_MODE, funexp)) - : memory_address (FUNCTION_MODE, funexp)); - else - { -#ifndef NO_FUNCTION_CSE - if (optimize && ! flag_no_function_cse) -#ifdef NO_RECURSIVE_FUNCTION_CSE - if (fndecl != current_function_decl) -#endif - funexp = force_reg (Pmode, funexp); -#endif - } - - if (static_chain_value != 0) - { - emit_move_insn (static_chain_rtx, static_chain_value); - - if (GET_CODE (static_chain_rtx) == REG) - use_reg (call_fusage, static_chain_rtx); - } - - return funexp; -} - -/* Generate instructions to call function FUNEXP, - and optionally pop the results. - The CALL_INSN is the first insn generated. - - FNDECL is the declaration node of the function. This is given to the - macro RETURN_POPS_ARGS to determine whether this function pops its own args. - - FUNTYPE is the data type of the function. This is given to the macro - RETURN_POPS_ARGS to determine whether this function pops its own args. - We used to allow an identifier for library functions, but that doesn't - work when the return type is an aggregate type and the calling convention - says that the pointer to this aggregate is to be popped by the callee. - - STACK_SIZE is the number of bytes of arguments on the stack, - rounded up to PREFERRED_STACK_BOUNDARY; zero if the size is variable. - This is both to put into the call insn and - to generate explicit popping code if necessary. - - STRUCT_VALUE_SIZE is the number of bytes wanted in a structure value. - It is zero if this call doesn't want a structure value. - - NEXT_ARG_REG is the rtx that results from executing - FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1) - just after all the args have had their registers assigned. - This could be whatever you like, but normally it is the first - arg-register beyond those used for args in this call, - or 0 if all the arg-registers are used in this call. - It is passed on to `gen_call' so you can put this info in the call insn. - - VALREG is a hard register in which a value is returned, - or 0 if the call does not return a value. - - OLD_INHIBIT_DEFER_POP is the value that `inhibit_defer_pop' had before - the args to this call were processed. - We restore `inhibit_defer_pop' to that value. - - CALL_FUSAGE is either empty or an EXPR_LIST of USE expressions that - denote registers used by the called function. - - IS_CONST is true if this is a `const' call. */ - -static void -emit_call_1 (funexp, fndecl, funtype, stack_size, rounded_stack_size, - struct_value_size, next_arg_reg, valreg, old_inhibit_defer_pop, - call_fusage, is_const) - rtx funexp; - tree fndecl ATTRIBUTE_UNUSED; - tree funtype ATTRIBUTE_UNUSED; - HOST_WIDE_INT stack_size; - HOST_WIDE_INT rounded_stack_size; - HOST_WIDE_INT struct_value_size; - rtx next_arg_reg; - rtx valreg; - int old_inhibit_defer_pop; - rtx call_fusage; - int is_const; -{ - rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size); - rtx struct_value_size_rtx = GEN_INT (struct_value_size); - rtx call_insn; -#ifndef ACCUMULATE_OUTGOING_ARGS - int already_popped = 0; - HOST_WIDE_INT n_popped = RETURN_POPS_ARGS (fndecl, funtype, stack_size); -#endif - - /* Ensure address is valid. SYMBOL_REF is already valid, so no need, - and we don't want to load it into a register as an optimization, - because prepare_call_address already did it if it should be done. */ - if (GET_CODE (funexp) != SYMBOL_REF) - funexp = memory_address (FUNCTION_MODE, funexp); - -#ifndef ACCUMULATE_OUTGOING_ARGS -#if defined (HAVE_call_pop) && defined (HAVE_call_value_pop) - if (HAVE_call_pop && HAVE_call_value_pop && n_popped > 0) - { - rtx n_pop = GEN_INT (n_popped); - rtx pat; - - /* If this subroutine pops its own args, record that in the call insn - if possible, for the sake of frame pointer elimination. */ - - if (valreg) - pat = gen_call_value_pop (valreg, - gen_rtx_MEM (FUNCTION_MODE, funexp), - rounded_stack_size_rtx, next_arg_reg, n_pop); - else - pat = gen_call_pop (gen_rtx_MEM (FUNCTION_MODE, funexp), - rounded_stack_size_rtx, next_arg_reg, n_pop); - - emit_call_insn (pat); - already_popped = 1; - } - else -#endif -#endif - -#if defined (HAVE_call) && defined (HAVE_call_value) - if (HAVE_call && HAVE_call_value) - { - if (valreg) - emit_call_insn (gen_call_value (valreg, - gen_rtx_MEM (FUNCTION_MODE, funexp), - rounded_stack_size_rtx, next_arg_reg, - NULL_RTX)); - else - emit_call_insn (gen_call (gen_rtx_MEM (FUNCTION_MODE, funexp), - rounded_stack_size_rtx, next_arg_reg, - struct_value_size_rtx)); - } - else -#endif - abort (); - - /* Find the CALL insn we just emitted. */ - for (call_insn = get_last_insn (); - call_insn && GET_CODE (call_insn) != CALL_INSN; - call_insn = PREV_INSN (call_insn)) - ; - - if (! call_insn) - abort (); - - /* Put the register usage information on the CALL. If there is already - some usage information, put ours at the end. */ - if (CALL_INSN_FUNCTION_USAGE (call_insn)) - { - rtx link; - - for (link = CALL_INSN_FUNCTION_USAGE (call_insn); XEXP (link, 1) != 0; - link = XEXP (link, 1)) - ; - - XEXP (link, 1) = call_fusage; - } - else - CALL_INSN_FUNCTION_USAGE (call_insn) = call_fusage; - - /* If this is a const call, then set the insn's unchanging bit. */ - if (is_const) - CONST_CALL_P (call_insn) = 1; - - /* Restore this now, so that we do defer pops for this call's args - if the context of the call as a whole permits. */ - inhibit_defer_pop = old_inhibit_defer_pop; - -#ifndef ACCUMULATE_OUTGOING_ARGS - /* If returning from the subroutine does not automatically pop the args, - we need an instruction to pop them sooner or later. - Perhaps do it now; perhaps just record how much space to pop later. - - If returning from the subroutine does pop the args, indicate that the - stack pointer will be changed. */ - - if (n_popped > 0) - { - if (!already_popped) - CALL_INSN_FUNCTION_USAGE (call_insn) - = gen_rtx_EXPR_LIST (VOIDmode, - gen_rtx_CLOBBER (VOIDmode, stack_pointer_rtx), - CALL_INSN_FUNCTION_USAGE (call_insn)); - rounded_stack_size -= n_popped; - rounded_stack_size_rtx = GEN_INT (rounded_stack_size); - } - - if (rounded_stack_size != 0) - { - if (flag_defer_pop && inhibit_defer_pop == 0 && !is_const) - pending_stack_adjust += rounded_stack_size; - else - adjust_stack (rounded_stack_size_rtx); - } -#endif -} - -/* Determine if the function identified by NAME and FNDECL is one with - special properties we wish to know about. - - For example, if the function might return more than one time (setjmp), then - set RETURNS_TWICE to a nonzero value. - - Similarly set IS_LONGJMP for if the function is in the longjmp family. - - Set IS_MALLOC for any of the standard memory allocation functions which - allocate from the heap. - - Set MAY_BE_ALLOCA for any memory allocation function that might allocate - space from the stack such as alloca. */ - -static void -special_function_p (name, fndecl, returns_twice, is_longjmp, - is_malloc, may_be_alloca) - char *name; - tree fndecl; - int *returns_twice; - int *is_longjmp; - int *is_malloc; - int *may_be_alloca; -{ - *returns_twice = 0; - *is_longjmp = 0; - *is_malloc = 0; - *may_be_alloca = 0; - - if (name != 0 && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) <= 17 - /* Exclude functions not at the file scope, or not `extern', - since they are not the magic functions we would otherwise - think they are. */ - && DECL_CONTEXT (fndecl) == NULL_TREE && TREE_PUBLIC (fndecl)) - { - char *tname = name; - - /* We assume that alloca will always be called by name. It - makes no sense to pass it as a pointer-to-function to - anything that does not understand its behavior. */ - *may_be_alloca - = (((IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 6 - && name[0] == 'a' - && ! strcmp (name, "alloca")) - || (IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 16 - && name[0] == '_' - && ! strcmp (name, "__builtin_alloca")))); - - /* Disregard prefix _, __ or __x. */ - if (name[0] == '_') - { - if (name[1] == '_' && name[2] == 'x') - tname += 3; - else if (name[1] == '_') - tname += 2; - else - tname += 1; - } - - if (tname[0] == 's') - { - *returns_twice - = ((tname[1] == 'e' - && (! strcmp (tname, "setjmp") - || ! strcmp (tname, "setjmp_syscall"))) - || (tname[1] == 'i' - && ! strcmp (tname, "sigsetjmp")) - || (tname[1] == 'a' - && ! strcmp (tname, "savectx"))); - if (tname[1] == 'i' - && ! strcmp (tname, "siglongjmp")) - *is_longjmp = 1; - } - else if ((tname[0] == 'q' && tname[1] == 's' - && ! strcmp (tname, "qsetjmp")) - || (tname[0] == 'v' && tname[1] == 'f' - && ! strcmp (tname, "vfork"))) - *returns_twice = 1; - - else if (tname[0] == 'l' && tname[1] == 'o' - && ! strcmp (tname, "longjmp")) - *is_longjmp = 1; - /* XXX should have "malloc" attribute on functions instead - of recognizing them by name. */ - else if (! strcmp (tname, "malloc") - || ! strcmp (tname, "calloc") - || ! strcmp (tname, "realloc") - /* Note use of NAME rather than TNAME here. These functions - are only reserved when preceded with __. */ - || ! strcmp (name, "__vn") /* mangled __builtin_vec_new */ - || ! strcmp (name, "__nw") /* mangled __builtin_new */ - || ! strcmp (name, "__builtin_new") - || ! strcmp (name, "__builtin_vec_new")) - *is_malloc = 1; - } -} - -/* Precompute all register parameters as described by ARGS, storing values - into fields within the ARGS array. - - NUM_ACTUALS indicates the total number elements in the ARGS array. - - Set REG_PARM_SEEN if we encounter a register parameter. */ - -static void -precompute_register_parameters (num_actuals, args, reg_parm_seen) - int num_actuals; - struct arg_data *args; - int *reg_parm_seen; -{ - int i; - - *reg_parm_seen = 0; - - for (i = 0; i < num_actuals; i++) - if (args[i].reg != 0 && ! args[i].pass_on_stack) - { - *reg_parm_seen = 1; - - if (args[i].value == 0) - { - push_temp_slots (); - args[i].value = expand_expr (args[i].tree_value, NULL_RTX, - VOIDmode, 0); - preserve_temp_slots (args[i].value); - pop_temp_slots (); - - /* ANSI doesn't require a sequence point here, - but PCC has one, so this will avoid some problems. */ - emit_queue (); - } - - /* If we are to promote the function arg to a wider mode, - do it now. */ - - if (args[i].mode != TYPE_MODE (TREE_TYPE (args[i].tree_value))) - args[i].value - = convert_modes (args[i].mode, - TYPE_MODE (TREE_TYPE (args[i].tree_value)), - args[i].value, args[i].unsignedp); - - /* If the value is expensive, and we are inside an appropriately - short loop, put the value into a pseudo and then put the pseudo - into the hard reg. - - For small register classes, also do this if this call uses - register parameters. This is to avoid reload conflicts while - loading the parameters registers. */ - - if ((! (GET_CODE (args[i].value) == REG - || (GET_CODE (args[i].value) == SUBREG - && GET_CODE (SUBREG_REG (args[i].value)) == REG))) - && args[i].mode != BLKmode - && rtx_cost (args[i].value, SET) > 2 - && ((SMALL_REGISTER_CLASSES && *reg_parm_seen) - || preserve_subexpressions_p ())) - args[i].value = copy_to_mode_reg (args[i].mode, args[i].value); - } -} - -#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE) - - /* The argument list is the property of the called routine and it - may clobber it. If the fixed area has been used for previous - parameters, we must save and restore it. */ -static rtx -save_fixed_argument_area (reg_parm_stack_space, argblock, - low_to_save, high_to_save) - int reg_parm_stack_space; - rtx argblock; - int *low_to_save; - int *high_to_save; -{ - int i; - rtx save_area = NULL_RTX; - - /* Compute the boundary of the that needs to be saved, if any. */ -#ifdef ARGS_GROW_DOWNWARD - for (i = 0; i < reg_parm_stack_space + 1; i++) -#else - for (i = 0; i < reg_parm_stack_space; i++) -#endif - { - if (i >= highest_outgoing_arg_in_use - || stack_usage_map[i] == 0) - continue; - - if (*low_to_save == -1) - *low_to_save = i; - - *high_to_save = i; - } - - if (*low_to_save >= 0) - { - int num_to_save = *high_to_save - *low_to_save + 1; - enum machine_mode save_mode - = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1); - rtx stack_area; - - /* If we don't have the required alignment, must do this in BLKmode. */ - if ((*low_to_save & (MIN (GET_MODE_SIZE (save_mode), - BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1))) - save_mode = BLKmode; - -#ifdef ARGS_GROW_DOWNWARD - stack_area = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - - *high_to_save))); -#else - stack_area = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - *low_to_save))); -#endif - if (save_mode == BLKmode) - { - save_area = assign_stack_temp (BLKmode, num_to_save, 0); - emit_block_move (validize_mem (save_area), stack_area, - GEN_INT (num_to_save), - PARM_BOUNDARY / BITS_PER_UNIT); - } - else - { - save_area = gen_reg_rtx (save_mode); - emit_move_insn (save_area, stack_area); - } - } - return save_area; -} - -static void -restore_fixed_argument_area (save_area, argblock, high_to_save, low_to_save) - rtx save_area; - rtx argblock; - int high_to_save; - int low_to_save; -{ - enum machine_mode save_mode = GET_MODE (save_area); -#ifdef ARGS_GROW_DOWNWARD - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - - high_to_save))); -#else - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - low_to_save))); -#endif - - if (save_mode != BLKmode) - emit_move_insn (stack_area, save_area); - else - emit_block_move (stack_area, validize_mem (save_area), - GEN_INT (high_to_save - low_to_save + 1), - PARM_BOUNDARY / BITS_PER_UNIT); -} -#endif - -/* If any elements in ARGS refer to parameters that are to be passed in - registers, but not in memory, and whose alignment does not permit a - direct copy into registers. Copy the values into a group of pseudos - which we will later copy into the appropriate hard registers. - - Pseudos for each unaligned argument will be stored into the array - args[argnum].aligned_regs. The caller is responsible for deallocating - the aligned_regs array if it is nonzero. */ - -static void -store_unaligned_arguments_into_pseudos (args, num_actuals) - struct arg_data *args; - int num_actuals; -{ - int i, j; - - for (i = 0; i < num_actuals; i++) - if (args[i].reg != 0 && ! args[i].pass_on_stack - && args[i].mode == BLKmode - && (TYPE_ALIGN (TREE_TYPE (args[i].tree_value)) - < (unsigned int) MIN (BIGGEST_ALIGNMENT, BITS_PER_WORD))) - { - int bytes = int_size_in_bytes (TREE_TYPE (args[i].tree_value)); - int big_endian_correction = 0; - - args[i].n_aligned_regs - = args[i].partial ? args[i].partial - : (bytes + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD; - - args[i].aligned_regs = (rtx *) xmalloc (sizeof (rtx) - * args[i].n_aligned_regs); - - /* Structures smaller than a word are aligned to the least - significant byte (to the right). On a BYTES_BIG_ENDIAN machine, - this means we must skip the empty high order bytes when - calculating the bit offset. */ - if (BYTES_BIG_ENDIAN && bytes < UNITS_PER_WORD) - big_endian_correction = (BITS_PER_WORD - (bytes * BITS_PER_UNIT)); - - for (j = 0; j < args[i].n_aligned_regs; j++) - { - rtx reg = gen_reg_rtx (word_mode); - rtx word = operand_subword_force (args[i].value, j, BLKmode); - int bitsize = MIN (bytes * BITS_PER_UNIT, BITS_PER_WORD); - int bitalign = TYPE_ALIGN (TREE_TYPE (args[i].tree_value)); - - args[i].aligned_regs[j] = reg; - - /* There is no need to restrict this code to loading items - in TYPE_ALIGN sized hunks. The bitfield instructions can - load up entire word sized registers efficiently. - - ??? This may not be needed anymore. - We use to emit a clobber here but that doesn't let later - passes optimize the instructions we emit. By storing 0 into - the register later passes know the first AND to zero out the - bitfield being set in the register is unnecessary. The store - of 0 will be deleted as will at least the first AND. */ - - emit_move_insn (reg, const0_rtx); - - bytes -= bitsize / BITS_PER_UNIT; - store_bit_field (reg, bitsize, big_endian_correction, word_mode, - extract_bit_field (word, bitsize, 0, 1, - NULL_RTX, word_mode, - word_mode, - bitalign / BITS_PER_UNIT, - BITS_PER_WORD), - bitalign / BITS_PER_UNIT, BITS_PER_WORD); - } - } -} - -/* Fill in ARGS_SIZE and ARGS array based on the parameters found in - ACTPARMS. - - NUM_ACTUALS is the total number of parameters. - - N_NAMED_ARGS is the total number of named arguments. - - FNDECL is the tree code for the target of this call (if known) - - ARGS_SO_FAR holds state needed by the target to know where to place - the next argument. - - REG_PARM_STACK_SPACE is the number of bytes of stack space reserved - for arguments which are passed in registers. - - OLD_STACK_LEVEL is a pointer to an rtx which olds the old stack level - and may be modified by this routine. - - OLD_PENDING_ADJ, MUST_PREALLOCATE and IS_CONST are pointers to integer - flags which may may be modified by this routine. */ - -static void -initialize_argument_information (num_actuals, args, args_size, n_named_args, - actparms, fndecl, args_so_far, - reg_parm_stack_space, old_stack_level, - old_pending_adj, must_preallocate, is_const) - int num_actuals ATTRIBUTE_UNUSED; - struct arg_data *args; - struct args_size *args_size; - int n_named_args ATTRIBUTE_UNUSED; - tree actparms; - tree fndecl; - CUMULATIVE_ARGS *args_so_far; - int reg_parm_stack_space; - rtx *old_stack_level; - int *old_pending_adj; - int *must_preallocate; - int *is_const; -{ - /* 1 if scanning parms front to back, -1 if scanning back to front. */ - int inc; - - /* Count arg position in order args appear. */ - int argpos; - - int i; - tree p; - - args_size->constant = 0; - args_size->var = 0; - - /* In this loop, we consider args in the order they are written. - We fill up ARGS from the front or from the back if necessary - so that in any case the first arg to be pushed ends up at the front. */ - -#ifdef PUSH_ARGS_REVERSED - i = num_actuals - 1, inc = -1; - /* In this case, must reverse order of args - so that we compute and push the last arg first. */ -#else - i = 0, inc = 1; -#endif - - /* I counts args in order (to be) pushed; ARGPOS counts in order written. */ - for (p = actparms, argpos = 0; p; p = TREE_CHAIN (p), i += inc, argpos++) - { - tree type = TREE_TYPE (TREE_VALUE (p)); - int unsignedp; - enum machine_mode mode; - - args[i].tree_value = TREE_VALUE (p); - - /* Replace erroneous argument with constant zero. */ - if (type == error_mark_node || TYPE_SIZE (type) == 0) - args[i].tree_value = integer_zero_node, type = integer_type_node; - - /* If TYPE is a transparent union, pass things the way we would - pass the first field of the union. We have already verified that - the modes are the same. */ - if (TYPE_TRANSPARENT_UNION (type)) - type = TREE_TYPE (TYPE_FIELDS (type)); - - /* Decide where to pass this arg. - - args[i].reg is nonzero if all or part is passed in registers. - - args[i].partial is nonzero if part but not all is passed in registers, - and the exact value says how many words are passed in registers. - - args[i].pass_on_stack is nonzero if the argument must at least be - computed on the stack. It may then be loaded back into registers - if args[i].reg is nonzero. - - These decisions are driven by the FUNCTION_... macros and must agree - with those made by function.c. */ - - /* See if this argument should be passed by invisible reference. */ - if ((TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST - && contains_placeholder_p (TYPE_SIZE (type))) - || TREE_ADDRESSABLE (type) -#ifdef FUNCTION_ARG_PASS_BY_REFERENCE - || FUNCTION_ARG_PASS_BY_REFERENCE (*args_so_far, TYPE_MODE (type), - type, argpos < n_named_args) -#endif - ) - { - /* If we're compiling a thunk, pass through invisible - references instead of making a copy. */ - if (current_function_is_thunk -#ifdef FUNCTION_ARG_CALLEE_COPIES - || (FUNCTION_ARG_CALLEE_COPIES (*args_so_far, TYPE_MODE (type), - type, argpos < n_named_args) - /* If it's in a register, we must make a copy of it too. */ - /* ??? Is this a sufficient test? Is there a better one? */ - && !(TREE_CODE (args[i].tree_value) == VAR_DECL - && REG_P (DECL_RTL (args[i].tree_value))) - && ! TREE_ADDRESSABLE (type)) -#endif - ) - { - /* C++ uses a TARGET_EXPR to indicate that we want to make a - new object from the argument. If we are passing by - invisible reference, the callee will do that for us, so we - can strip off the TARGET_EXPR. This is not always safe, - but it is safe in the only case where this is a useful - optimization; namely, when the argument is a plain object. - In that case, the frontend is just asking the backend to - make a bitwise copy of the argument. */ - - if (TREE_CODE (args[i].tree_value) == TARGET_EXPR - && (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND - (args[i].tree_value, 1))) - == 'd') - && ! REG_P (DECL_RTL (TREE_OPERAND (args[i].tree_value, 1)))) - args[i].tree_value = TREE_OPERAND (args[i].tree_value, 1); - - args[i].tree_value = build1 (ADDR_EXPR, - build_pointer_type (type), - args[i].tree_value); - type = build_pointer_type (type); - } - else - { - /* We make a copy of the object and pass the address to the - function being called. */ - rtx copy; - - if (TYPE_SIZE (type) == 0 - || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST - || (flag_stack_check && ! STACK_CHECK_BUILTIN - && (TREE_INT_CST_HIGH (TYPE_SIZE (type)) != 0 - || (TREE_INT_CST_LOW (TYPE_SIZE (type)) - > STACK_CHECK_MAX_VAR_SIZE * BITS_PER_UNIT)))) - { - /* This is a variable-sized object. Make space on the stack - for it. */ - rtx size_rtx = expr_size (TREE_VALUE (p)); - - if (*old_stack_level == 0) - { - emit_stack_save (SAVE_BLOCK, old_stack_level, NULL_RTX); - *old_pending_adj = pending_stack_adjust; - pending_stack_adjust = 0; - } - - copy = gen_rtx_MEM (BLKmode, - allocate_dynamic_stack_space (size_rtx, - NULL_RTX, - TYPE_ALIGN (type))); - } - else - { - int size = int_size_in_bytes (type); - copy = assign_stack_temp (TYPE_MODE (type), size, 0); - } - - MEM_SET_IN_STRUCT_P (copy, AGGREGATE_TYPE_P (type)); - - store_expr (args[i].tree_value, copy, 0); - *is_const = 0; - - args[i].tree_value = build1 (ADDR_EXPR, - build_pointer_type (type), - make_tree (type, copy)); - type = build_pointer_type (type); - } - } - - mode = TYPE_MODE (type); - unsignedp = TREE_UNSIGNED (type); - -#ifdef PROMOTE_FUNCTION_ARGS - mode = promote_mode (type, mode, &unsignedp, 1); -#endif - - args[i].unsignedp = unsignedp; - args[i].mode = mode; - args[i].reg = FUNCTION_ARG (*args_so_far, mode, type, - argpos < n_named_args); -#ifdef FUNCTION_ARG_PARTIAL_NREGS - if (args[i].reg) - args[i].partial - = FUNCTION_ARG_PARTIAL_NREGS (*args_so_far, mode, type, - argpos < n_named_args); -#endif - - args[i].pass_on_stack = MUST_PASS_IN_STACK (mode, type); - - /* If FUNCTION_ARG returned a (parallel [(expr_list (nil) ...) ...]), - it means that we are to pass this arg in the register(s) designated - by the PARALLEL, but also to pass it in the stack. */ - if (args[i].reg && GET_CODE (args[i].reg) == PARALLEL - && XEXP (XVECEXP (args[i].reg, 0, 0), 0) == 0) - args[i].pass_on_stack = 1; - - /* If this is an addressable type, we must preallocate the stack - since we must evaluate the object into its final location. - - If this is to be passed in both registers and the stack, it is simpler - to preallocate. */ - if (TREE_ADDRESSABLE (type) - || (args[i].pass_on_stack && args[i].reg != 0)) - *must_preallocate = 1; - - /* If this is an addressable type, we cannot pre-evaluate it. Thus, - we cannot consider this function call constant. */ - if (TREE_ADDRESSABLE (type)) - *is_const = 0; - - /* Compute the stack-size of this argument. */ - if (args[i].reg == 0 || args[i].partial != 0 - || reg_parm_stack_space > 0 - || args[i].pass_on_stack) - locate_and_pad_parm (mode, type, -#ifdef STACK_PARMS_IN_REG_PARM_AREA - 1, -#else - args[i].reg != 0, -#endif - fndecl, args_size, &args[i].offset, - &args[i].size); - -#ifndef ARGS_GROW_DOWNWARD - args[i].slot_offset = *args_size; -#endif - - /* If a part of the arg was put into registers, - don't include that part in the amount pushed. */ - if (reg_parm_stack_space == 0 && ! args[i].pass_on_stack) - args[i].size.constant -= ((args[i].partial * UNITS_PER_WORD) - / (PARM_BOUNDARY / BITS_PER_UNIT) - * (PARM_BOUNDARY / BITS_PER_UNIT)); - - /* Update ARGS_SIZE, the total stack space for args so far. */ - - args_size->constant += args[i].size.constant; - if (args[i].size.var) - { - ADD_PARM_SIZE (*args_size, args[i].size.var); - } - - /* Since the slot offset points to the bottom of the slot, - we must record it after incrementing if the args grow down. */ -#ifdef ARGS_GROW_DOWNWARD - args[i].slot_offset = *args_size; - - args[i].slot_offset.constant = -args_size->constant; - if (args_size->var) - { - SUB_PARM_SIZE (args[i].slot_offset, args_size->var); - } -#endif - - /* Increment ARGS_SO_FAR, which has info about which arg-registers - have been used, etc. */ - - FUNCTION_ARG_ADVANCE (*args_so_far, TYPE_MODE (type), type, - argpos < n_named_args); - } -} - -/* Update ARGS_SIZE to contain the total size for the argument block. - Return the original constant component of the argument block's size. - - REG_PARM_STACK_SPACE holds the number of bytes of stack space reserved - for arguments passed in registers. */ - -static int -compute_argument_block_size (reg_parm_stack_space, args_size) - int reg_parm_stack_space; - struct args_size *args_size; -{ - int unadjusted_args_size = args_size->constant; - - /* Compute the actual size of the argument block required. The variable - and constant sizes must be combined, the size may have to be rounded, - and there may be a minimum required size. */ - - if (args_size->var) - { - args_size->var = ARGS_SIZE_TREE (*args_size); - args_size->constant = 0; - -#ifdef PREFERRED_STACK_BOUNDARY - if (PREFERRED_STACK_BOUNDARY != BITS_PER_UNIT) - args_size->var = round_up (args_size->var, STACK_BYTES); -#endif - - if (reg_parm_stack_space > 0) - { - args_size->var - = size_binop (MAX_EXPR, args_size->var, - size_int (reg_parm_stack_space)); - -#ifndef OUTGOING_REG_PARM_STACK_SPACE - /* The area corresponding to register parameters is not to count in - the size of the block we need. So make the adjustment. */ - args_size->var - = size_binop (MINUS_EXPR, args_size->var, - size_int (reg_parm_stack_space)); -#endif - } - } - else - { -#ifdef PREFERRED_STACK_BOUNDARY - args_size->constant = (((args_size->constant - + pending_stack_adjust - + STACK_BYTES - 1) - / STACK_BYTES * STACK_BYTES) - - pending_stack_adjust); -#endif - - args_size->constant = MAX (args_size->constant, - reg_parm_stack_space); - -#ifdef MAYBE_REG_PARM_STACK_SPACE - if (reg_parm_stack_space == 0) - args_size->constant = 0; -#endif - -#ifndef OUTGOING_REG_PARM_STACK_SPACE - args_size->constant -= reg_parm_stack_space; -#endif - } - return unadjusted_args_size; -} - -/* Precompute parameters has needed for a function call. - - IS_CONST indicates the target function is a pure function. - - MUST_PREALLOCATE indicates that we must preallocate stack space for - any stack arguments. - - NUM_ACTUALS is the number of arguments. - - ARGS is an array containing information for each argument; this routine - fills in the INITIAL_VALUE and VALUE fields for each precomputed argument. - - ARGS_SIZE contains information about the size of the arg list. */ - -static void -precompute_arguments (is_const, must_preallocate, num_actuals, args, args_size) - int is_const; - int must_preallocate; - int num_actuals; - struct arg_data *args; - struct args_size *args_size; -{ - int i; - - /* If this function call is cse'able, precompute all the parameters. - Note that if the parameter is constructed into a temporary, this will - cause an additional copy because the parameter will be constructed - into a temporary location and then copied into the outgoing arguments. - If a parameter contains a call to alloca and this function uses the - stack, precompute the parameter. */ - - /* If we preallocated the stack space, and some arguments must be passed - on the stack, then we must precompute any parameter which contains a - function call which will store arguments on the stack. - Otherwise, evaluating the parameter may clobber previous parameters - which have already been stored into the stack. */ - - for (i = 0; i < num_actuals; i++) - if (is_const - || ((args_size->var != 0 || args_size->constant != 0) - && calls_function (args[i].tree_value, 1)) - || (must_preallocate - && (args_size->var != 0 || args_size->constant != 0) - && calls_function (args[i].tree_value, 0))) - { - /* If this is an addressable type, we cannot pre-evaluate it. */ - if (TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value))) - abort (); - - push_temp_slots (); - - args[i].initial_value = args[i].value - = expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0); - - preserve_temp_slots (args[i].value); - pop_temp_slots (); - - /* ANSI doesn't require a sequence point here, - but PCC has one, so this will avoid some problems. */ - emit_queue (); - - args[i].initial_value = args[i].value - = protect_from_queue (args[i].initial_value, 0); - - if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) != args[i].mode) - args[i].value - = convert_modes (args[i].mode, - TYPE_MODE (TREE_TYPE (args[i].tree_value)), - args[i].value, args[i].unsignedp); - } -} - -/* Given the current state of MUST_PREALLOCATE and information about - arguments to a function call in NUM_ACTUALS, ARGS and ARGS_SIZE, - compute and return the final value for MUST_PREALLOCATE. */ - -static int -finalize_must_preallocate (must_preallocate, num_actuals, args, args_size) - int must_preallocate; - int num_actuals; - struct arg_data *args; - struct args_size *args_size; -{ - /* See if we have or want to preallocate stack space. - - If we would have to push a partially-in-regs parm - before other stack parms, preallocate stack space instead. - - If the size of some parm is not a multiple of the required stack - alignment, we must preallocate. - - If the total size of arguments that would otherwise create a copy in - a temporary (such as a CALL) is more than half the total argument list - size, preallocation is faster. - - Another reason to preallocate is if we have a machine (like the m88k) - where stack alignment is required to be maintained between every - pair of insns, not just when the call is made. However, we assume here - that such machines either do not have push insns (and hence preallocation - would occur anyway) or the problem is taken care of with - PUSH_ROUNDING. */ - - if (! must_preallocate) - { - int partial_seen = 0; - int copy_to_evaluate_size = 0; - int i; - - for (i = 0; i < num_actuals && ! must_preallocate; i++) - { - if (args[i].partial > 0 && ! args[i].pass_on_stack) - partial_seen = 1; - else if (partial_seen && args[i].reg == 0) - must_preallocate = 1; - - if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode - && (TREE_CODE (args[i].tree_value) == CALL_EXPR - || TREE_CODE (args[i].tree_value) == TARGET_EXPR - || TREE_CODE (args[i].tree_value) == COND_EXPR - || TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value)))) - copy_to_evaluate_size - += int_size_in_bytes (TREE_TYPE (args[i].tree_value)); - } - - if (copy_to_evaluate_size * 2 >= args_size->constant - && args_size->constant > 0) - must_preallocate = 1; - } - return must_preallocate; -} - -/* If we preallocated stack space, compute the address of each argument - and store it into the ARGS array. - - We need not ensure it is a valid memory address here; it will be - validized when it is used. - - ARGBLOCK is an rtx for the address of the outgoing arguments. */ - -static void -compute_argument_addresses (args, argblock, num_actuals) - struct arg_data *args; - rtx argblock; - int num_actuals; -{ - if (argblock) - { - rtx arg_reg = argblock; - int i, arg_offset = 0; - - if (GET_CODE (argblock) == PLUS) - arg_reg = XEXP (argblock, 0), arg_offset = INTVAL (XEXP (argblock, 1)); - - for (i = 0; i < num_actuals; i++) - { - rtx offset = ARGS_SIZE_RTX (args[i].offset); - rtx slot_offset = ARGS_SIZE_RTX (args[i].slot_offset); - rtx addr; - - /* Skip this parm if it will not be passed on the stack. */ - if (! args[i].pass_on_stack && args[i].reg != 0) - continue; - - if (GET_CODE (offset) == CONST_INT) - addr = plus_constant (arg_reg, INTVAL (offset)); - else - addr = gen_rtx_PLUS (Pmode, arg_reg, offset); - - addr = plus_constant (addr, arg_offset); - args[i].stack = gen_rtx_MEM (args[i].mode, addr); - MEM_SET_IN_STRUCT_P - (args[i].stack, - AGGREGATE_TYPE_P (TREE_TYPE (args[i].tree_value))); - - if (GET_CODE (slot_offset) == CONST_INT) - addr = plus_constant (arg_reg, INTVAL (slot_offset)); - else - addr = gen_rtx_PLUS (Pmode, arg_reg, slot_offset); - - addr = plus_constant (addr, arg_offset); - args[i].stack_slot = gen_rtx_MEM (args[i].mode, addr); - } - } -} - -/* Given a FNDECL and EXP, return an rtx suitable for use as a target address - in a call instruction. - - FNDECL is the tree node for the target function. For an indirect call - FNDECL will be NULL_TREE. - - EXP is the CALL_EXPR for this call. */ - -static rtx -rtx_for_function_call (fndecl, exp) - tree fndecl; - tree exp; -{ - rtx funexp; - - /* Get the function to call, in the form of RTL. */ - if (fndecl) - { - /* If this is the first use of the function, see if we need to - make an external definition for it. */ - if (! TREE_USED (fndecl)) - { - assemble_external (fndecl); - TREE_USED (fndecl) = 1; - } - - /* Get a SYMBOL_REF rtx for the function address. */ - funexp = XEXP (DECL_RTL (fndecl), 0); - } - else - /* Generate an rtx (probably a pseudo-register) for the address. */ - { - rtx funaddr; - push_temp_slots (); - funaddr = funexp = - expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, VOIDmode, 0); - pop_temp_slots (); /* FUNEXP can't be BLKmode */ - - /* Check the function is executable. */ - if (current_function_check_memory_usage) - { -#ifdef POINTERS_EXTEND_UNSIGNED - /* It might be OK to convert funexp in place, but there's - a lot going on between here and when it happens naturally - that this seems safer. */ - funaddr = convert_memory_address (Pmode, funexp); -#endif - emit_library_call (chkr_check_exec_libfunc, 1, - VOIDmode, 1, - funaddr, Pmode); - } - emit_queue (); - } - return funexp; -} - -/* Do the register loads required for any wholly-register parms or any - parms which are passed both on the stack and in a register. Their - expressions were already evaluated. - - Mark all register-parms as living through the call, putting these USE - insns in the CALL_INSN_FUNCTION_USAGE field. */ - -static void -load_register_parameters (args, num_actuals, call_fusage) - struct arg_data *args; - int num_actuals; - rtx *call_fusage; -{ - int i, j; - -#ifdef LOAD_ARGS_REVERSED - for (i = num_actuals - 1; i >= 0; i--) -#else - for (i = 0; i < num_actuals; i++) -#endif - { - rtx reg = args[i].reg; - int partial = args[i].partial; - int nregs; - - if (reg) - { - /* Set to non-negative if must move a word at a time, even if just - one word (e.g, partial == 1 && mode == DFmode). Set to -1 if - we just use a normal move insn. This value can be zero if the - argument is a zero size structure with no fields. */ - nregs = (partial ? partial - : (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode - ? ((int_size_in_bytes (TREE_TYPE (args[i].tree_value)) - + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD) - : -1)); - - /* Handle calls that pass values in multiple non-contiguous - locations. The Irix 6 ABI has examples of this. */ - - if (GET_CODE (reg) == PARALLEL) - { - emit_group_load (reg, args[i].value, - int_size_in_bytes (TREE_TYPE (args[i].tree_value)), - (TYPE_ALIGN (TREE_TYPE (args[i].tree_value)) - / BITS_PER_UNIT)); - } - - /* If simple case, just do move. If normal partial, store_one_arg - has already loaded the register for us. In all other cases, - load the register(s) from memory. */ - - else if (nregs == -1) - emit_move_insn (reg, args[i].value); - - /* If we have pre-computed the values to put in the registers in - the case of non-aligned structures, copy them in now. */ - - else if (args[i].n_aligned_regs != 0) - for (j = 0; j < args[i].n_aligned_regs; j++) - emit_move_insn (gen_rtx_REG (word_mode, REGNO (reg) + j), - args[i].aligned_regs[j]); - - else if (partial == 0 || args[i].pass_on_stack) - move_block_to_reg (REGNO (reg), - validize_mem (args[i].value), nregs, - args[i].mode); - - /* Handle calls that pass values in multiple non-contiguous - locations. The Irix 6 ABI has examples of this. */ - if (GET_CODE (reg) == PARALLEL) - use_group_regs (call_fusage, reg); - else if (nregs == -1) - use_reg (call_fusage, reg); - else - use_regs (call_fusage, REGNO (reg), nregs == 0 ? 1 : nregs); - } - } -} - -/* Generate all the code for a function call - and return an rtx for its value. - Store the value in TARGET (specified as an rtx) if convenient. - If the value is stored in TARGET then TARGET is returned. - If IGNORE is nonzero, then we ignore the value of the function call. */ - -rtx -expand_call (exp, target, ignore) - tree exp; - rtx target; - int ignore; -{ - /* List of actual parameters. */ - tree actparms = TREE_OPERAND (exp, 1); - /* RTX for the function to be called. */ - rtx funexp; - /* Data type of the function. */ - tree funtype; - /* Declaration of the function being called, - or 0 if the function is computed (not known by name). */ - tree fndecl = 0; - char *name = 0; - - /* Register in which non-BLKmode value will be returned, - or 0 if no value or if value is BLKmode. */ - rtx valreg; - /* Address where we should return a BLKmode value; - 0 if value not BLKmode. */ - rtx structure_value_addr = 0; - /* Nonzero if that address is being passed by treating it as - an extra, implicit first parameter. Otherwise, - it is passed by being copied directly into struct_value_rtx. */ - int structure_value_addr_parm = 0; - /* Size of aggregate value wanted, or zero if none wanted - or if we are using the non-reentrant PCC calling convention - or expecting the value in registers. */ - HOST_WIDE_INT struct_value_size = 0; - /* Nonzero if called function returns an aggregate in memory PCC style, - by returning the address of where to find it. */ - int pcc_struct_value = 0; - - /* Number of actual parameters in this call, including struct value addr. */ - int num_actuals; - /* Number of named args. Args after this are anonymous ones - and they must all go on the stack. */ - int n_named_args; - - /* Vector of information about each argument. - Arguments are numbered in the order they will be pushed, - not the order they are written. */ - struct arg_data *args; - - /* Total size in bytes of all the stack-parms scanned so far. */ - struct args_size args_size; - /* Size of arguments before any adjustments (such as rounding). */ - int unadjusted_args_size; - /* Data on reg parms scanned so far. */ - CUMULATIVE_ARGS args_so_far; - /* Nonzero if a reg parm has been scanned. */ - int reg_parm_seen; - /* Nonzero if this is an indirect function call. */ - - /* Nonzero if we must avoid push-insns in the args for this call. - If stack space is allocated for register parameters, but not by the - caller, then it is preallocated in the fixed part of the stack frame. - So the entire argument block must then be preallocated (i.e., we - ignore PUSH_ROUNDING in that case). */ - -#ifdef PUSH_ROUNDING - int must_preallocate = 0; -#else - int must_preallocate = 1; -#endif - - /* Size of the stack reserved for parameter registers. */ - int reg_parm_stack_space = 0; - - /* Address of space preallocated for stack parms - (on machines that lack push insns), or 0 if space not preallocated. */ - rtx argblock = 0; - - /* Nonzero if it is plausible that this is a call to alloca. */ - int may_be_alloca; - /* Nonzero if this is a call to malloc or a related function. */ - int is_malloc; - /* Nonzero if this is a call to setjmp or a related function. */ - int returns_twice; - /* Nonzero if this is a call to `longjmp'. */ - int is_longjmp; - /* Nonzero if this is a call to an inline function. */ - int is_integrable = 0; - /* Nonzero if this is a call to a `const' function. - Note that only explicitly named functions are handled as `const' here. */ - int is_const = 0; - /* Nonzero if this is a call to a `volatile' function. */ - int is_volatile = 0; -#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE) - /* Define the boundary of the register parm stack space that needs to be - save, if any. */ - int low_to_save = -1, high_to_save; - rtx save_area = 0; /* Place that it is saved */ -#endif - -#ifdef ACCUMULATE_OUTGOING_ARGS - int initial_highest_arg_in_use = highest_outgoing_arg_in_use; - char *initial_stack_usage_map = stack_usage_map; - int old_stack_arg_under_construction; -#endif - - rtx old_stack_level = 0; - int old_pending_adj = 0; - int old_inhibit_defer_pop = inhibit_defer_pop; - rtx call_fusage = 0; - register tree p; - register int i; - - /* The value of the function call can be put in a hard register. But - if -fcheck-memory-usage, code which invokes functions (and thus - damages some hard registers) can be inserted before using the value. - So, target is always a pseudo-register in that case. */ - if (current_function_check_memory_usage) - target = 0; - - /* See if we can find a DECL-node for the actual function. - As a result, decide whether this is a call to an integrable function. */ - - p = TREE_OPERAND (exp, 0); - if (TREE_CODE (p) == ADDR_EXPR) - { - fndecl = TREE_OPERAND (p, 0); - if (TREE_CODE (fndecl) != FUNCTION_DECL) - fndecl = 0; - else - { - if (!flag_no_inline - && fndecl != current_function_decl - && DECL_INLINE (fndecl) - && DECL_SAVED_INSNS (fndecl) - && RTX_INTEGRATED_P (DECL_SAVED_INSNS (fndecl))) - is_integrable = 1; - else if (! TREE_ADDRESSABLE (fndecl)) - { - /* In case this function later becomes inlinable, - record that there was already a non-inline call to it. - - Use abstraction instead of setting TREE_ADDRESSABLE - directly. */ - if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline - && optimize > 0) - { - warning_with_decl (fndecl, "can't inline call to `%s'"); - warning ("called from here"); - } - mark_addressable (fndecl); - } - - if (TREE_READONLY (fndecl) && ! TREE_THIS_VOLATILE (fndecl) - && TYPE_MODE (TREE_TYPE (exp)) != VOIDmode) - is_const = 1; - - if (TREE_THIS_VOLATILE (fndecl)) - is_volatile = 1; - } - } - - /* If we don't have specific function to call, see if we have a - constant or `noreturn' function from the type. */ - if (fndecl == 0) - { - is_const = TREE_READONLY (TREE_TYPE (TREE_TYPE (p))); - is_volatile = TREE_THIS_VOLATILE (TREE_TYPE (TREE_TYPE (p))); - } - -#ifdef REG_PARM_STACK_SPACE -#ifdef MAYBE_REG_PARM_STACK_SPACE - reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE; -#else - reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl); -#endif -#endif - -#if defined(PUSH_ROUNDING) && ! defined(OUTGOING_REG_PARM_STACK_SPACE) - if (reg_parm_stack_space > 0) - must_preallocate = 1; -#endif - - /* Warn if this value is an aggregate type, - regardless of which calling convention we are using for it. */ - if (warn_aggregate_return && AGGREGATE_TYPE_P (TREE_TYPE (exp))) - warning ("function call has aggregate value"); - - /* Set up a place to return a structure. */ - - /* Cater to broken compilers. */ - if (aggregate_value_p (exp)) - { - /* This call returns a big structure. */ - is_const = 0; - -#ifdef PCC_STATIC_STRUCT_RETURN - { - pcc_struct_value = 1; - /* Easier than making that case work right. */ - if (is_integrable) - { - /* In case this is a static function, note that it has been - used. */ - if (! TREE_ADDRESSABLE (fndecl)) - mark_addressable (fndecl); - is_integrable = 0; - } - } -#else /* not PCC_STATIC_STRUCT_RETURN */ - { - struct_value_size = int_size_in_bytes (TREE_TYPE (exp)); - - if (target && GET_CODE (target) == MEM) - structure_value_addr = XEXP (target, 0); - else - { - /* Assign a temporary to hold the value. */ - tree d; - - /* For variable-sized objects, we must be called with a target - specified. If we were to allocate space on the stack here, - we would have no way of knowing when to free it. */ - - if (struct_value_size < 0) - abort (); - - /* This DECL is just something to feed to mark_addressable; - it doesn't get pushed. */ - d = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (exp)); - DECL_RTL (d) = assign_temp (TREE_TYPE (exp), 1, 0, 1); - mark_addressable (d); - structure_value_addr = XEXP (DECL_RTL (d), 0); - TREE_USED (d) = 1; - target = 0; - } - } -#endif /* not PCC_STATIC_STRUCT_RETURN */ - } - - /* If called function is inline, try to integrate it. */ - - if (is_integrable) - { - rtx temp; -#ifdef ACCUMULATE_OUTGOING_ARGS - rtx before_call = get_last_insn (); -#endif - - temp = expand_inline_function (fndecl, actparms, target, - ignore, TREE_TYPE (exp), - structure_value_addr); - - /* If inlining succeeded, return. */ - if (temp != (rtx) (HOST_WIDE_INT) -1) - { -#ifdef ACCUMULATE_OUTGOING_ARGS - /* If the outgoing argument list must be preserved, push - the stack before executing the inlined function if it - makes any calls. */ - - for (i = reg_parm_stack_space - 1; i >= 0; i--) - if (i < highest_outgoing_arg_in_use && stack_usage_map[i] != 0) - break; - - if (stack_arg_under_construction || i >= 0) - { - rtx first_insn - = before_call ? NEXT_INSN (before_call) : get_insns (); - rtx insn, seq; - - /* Look for a call in the inline function code. - If OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) is - nonzero then there is a call and it is not necessary - to scan the insns. */ - - if (OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) == 0) - for (insn = first_insn; insn; insn = NEXT_INSN (insn)) - if (GET_CODE (insn) == CALL_INSN) - break; - - if (insn) - { - /* Reserve enough stack space so that the largest - argument list of any function call in the inline - function does not overlap the argument list being - evaluated. This is usually an overestimate because - allocate_dynamic_stack_space reserves space for an - outgoing argument list in addition to the requested - space, but there is no way to ask for stack space such - that an argument list of a certain length can be - safely constructed. - - Add the stack space reserved for register arguments, if - any, in the inline function. What is really needed is the - largest value of reg_parm_stack_space in the inline - function, but that is not available. Using the current - value of reg_parm_stack_space is wrong, but gives - correct results on all supported machines. */ - - int adjust = (OUTGOING_ARGS_SIZE (DECL_SAVED_INSNS (fndecl)) - + reg_parm_stack_space); - - start_sequence (); - emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX); - allocate_dynamic_stack_space (GEN_INT (adjust), - NULL_RTX, BITS_PER_UNIT); - seq = get_insns (); - end_sequence (); - emit_insns_before (seq, first_insn); - emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX); - } - } -#endif - - /* If the result is equivalent to TARGET, return TARGET to simplify - checks in store_expr. They can be equivalent but not equal in the - case of a function that returns BLKmode. */ - if (temp != target && rtx_equal_p (temp, target)) - return target; - return temp; - } - - /* If inlining failed, mark FNDECL as needing to be compiled - separately after all. If function was declared inline, - give a warning. */ - if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline - && optimize > 0 && ! TREE_ADDRESSABLE (fndecl)) - { - warning_with_decl (fndecl, "inlining failed in call to `%s'"); - warning ("called from here"); - } - mark_addressable (fndecl); - } - - function_call_count++; - - if (fndecl && DECL_NAME (fndecl)) - name = IDENTIFIER_POINTER (DECL_NAME (fndecl)); - - /* See if this is a call to a function that can return more than once - or a call to longjmp or malloc. */ - special_function_p (name, fndecl, &returns_twice, &is_longjmp, - &is_malloc, &may_be_alloca); - - if (may_be_alloca) - current_function_calls_alloca = 1; - - /* Operand 0 is a pointer-to-function; get the type of the function. */ - funtype = TREE_TYPE (TREE_OPERAND (exp, 0)); - if (! POINTER_TYPE_P (funtype)) - abort (); - funtype = TREE_TYPE (funtype); - - /* When calling a const function, we must pop the stack args right away, - so that the pop is deleted or moved with the call. */ - if (is_const) - NO_DEFER_POP; - - /* Don't let pending stack adjusts add up to too much. - Also, do all pending adjustments now - if there is any chance this might be a call to alloca. */ - - if (pending_stack_adjust >= 32 - || (pending_stack_adjust > 0 && may_be_alloca)) - do_pending_stack_adjust (); - - /* Push the temporary stack slot level so that we can free any temporaries - we make. */ - push_temp_slots (); - - /* Start updating where the next arg would go. - - On some machines (such as the PA) indirect calls have a different - calling convention than normal calls. The last argument in - INIT_CUMULATIVE_ARGS tells the backend if this is an indirect call - or not. */ - INIT_CUMULATIVE_ARGS (args_so_far, funtype, NULL_RTX, (fndecl == 0)); - - /* If struct_value_rtx is 0, it means pass the address - as if it were an extra parameter. */ - if (structure_value_addr && struct_value_rtx == 0) - { - /* If structure_value_addr is a REG other than - virtual_outgoing_args_rtx, we can use always use it. If it - is not a REG, we must always copy it into a register. - If it is virtual_outgoing_args_rtx, we must copy it to another - register in some cases. */ - rtx temp = (GET_CODE (structure_value_addr) != REG -#ifdef ACCUMULATE_OUTGOING_ARGS - || (stack_arg_under_construction - && structure_value_addr == virtual_outgoing_args_rtx) -#endif - ? copy_addr_to_reg (structure_value_addr) - : structure_value_addr); - - actparms - = tree_cons (error_mark_node, - make_tree (build_pointer_type (TREE_TYPE (funtype)), - temp), - actparms); - structure_value_addr_parm = 1; - } - - /* Count the arguments and set NUM_ACTUALS. */ - for (p = actparms, i = 0; p; p = TREE_CHAIN (p)) i++; - num_actuals = i; - - /* Compute number of named args. - Normally, don't include the last named arg if anonymous args follow. - We do include the last named arg if STRICT_ARGUMENT_NAMING is nonzero. - (If no anonymous args follow, the result of list_length is actually - one too large. This is harmless.) - - If PRETEND_OUTGOING_VARARGS_NAMED is set and STRICT_ARGUMENT_NAMING is - zero, this machine will be able to place unnamed args that were passed in - registers into the stack. So treat all args as named. This allows the - insns emitting for a specific argument list to be independent of the - function declaration. - - If PRETEND_OUTGOING_VARARGS_NAMED is not set, we do not have any reliable - way to pass unnamed args in registers, so we must force them into - memory. */ - - if ((STRICT_ARGUMENT_NAMING - || ! PRETEND_OUTGOING_VARARGS_NAMED) - && TYPE_ARG_TYPES (funtype) != 0) - n_named_args - = (list_length (TYPE_ARG_TYPES (funtype)) - /* Don't include the last named arg. */ - - (STRICT_ARGUMENT_NAMING ? 0 : 1) - /* Count the struct value address, if it is passed as a parm. */ - + structure_value_addr_parm); - else - /* If we know nothing, treat all args as named. */ - n_named_args = num_actuals; - - /* Make a vector to hold all the information about each arg. */ - args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data)); - bzero ((char *) args, num_actuals * sizeof (struct arg_data)); - - /* Build up entries inthe ARGS array, compute the size of the arguments - into ARGS_SIZE, etc. */ - initialize_argument_information (num_actuals, args, &args_size, n_named_args, - actparms, fndecl, &args_so_far, - reg_parm_stack_space, &old_stack_level, - &old_pending_adj, &must_preallocate, - &is_const); - -#ifdef FINAL_REG_PARM_STACK_SPACE - reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant, - args_size.var); -#endif - - if (args_size.var) - { - /* If this function requires a variable-sized argument list, don't try to - make a cse'able block for this call. We may be able to do this - eventually, but it is too complicated to keep track of what insns go - in the cse'able block and which don't. */ - - is_const = 0; - must_preallocate = 1; - } - - /* Compute the actual size of the argument block required. The variable - and constant sizes must be combined, the size may have to be rounded, - and there may be a minimum required size. */ - unadjusted_args_size - = compute_argument_block_size (reg_parm_stack_space, &args_size); - - /* Now make final decision about preallocating stack space. */ - must_preallocate = finalize_must_preallocate (must_preallocate, - num_actuals, args, &args_size); - - /* If the structure value address will reference the stack pointer, we must - stabilize it. We don't need to do this if we know that we are not going - to adjust the stack pointer in processing this call. */ - - if (structure_value_addr - && (reg_mentioned_p (virtual_stack_dynamic_rtx, structure_value_addr) - || reg_mentioned_p (virtual_outgoing_args_rtx, structure_value_addr)) - && (args_size.var -#ifndef ACCUMULATE_OUTGOING_ARGS - || args_size.constant -#endif - )) - structure_value_addr = copy_to_reg (structure_value_addr); - - /* Precompute any arguments as needed. */ - precompute_arguments (is_const, must_preallocate, num_actuals, - args, &args_size); - - /* Now we are about to start emitting insns that can be deleted - if a libcall is deleted. */ - if (is_const || is_malloc) - start_sequence (); - - /* If we have no actual push instructions, or shouldn't use them, - make space for all args right now. */ - - if (args_size.var != 0) - { - if (old_stack_level == 0) - { - emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX); - old_pending_adj = pending_stack_adjust; - pending_stack_adjust = 0; -#ifdef ACCUMULATE_OUTGOING_ARGS - /* stack_arg_under_construction says whether a stack arg is - being constructed at the old stack level. Pushing the stack - gets a clean outgoing argument block. */ - old_stack_arg_under_construction = stack_arg_under_construction; - stack_arg_under_construction = 0; -#endif - } - argblock = push_block (ARGS_SIZE_RTX (args_size), 0, 0); - } - else - { - /* Note that we must go through the motions of allocating an argument - block even if the size is zero because we may be storing args - in the area reserved for register arguments, which may be part of - the stack frame. */ - - int needed = args_size.constant; - - /* Store the maximum argument space used. It will be pushed by - the prologue (if ACCUMULATE_OUTGOING_ARGS, or stack overflow - checking). */ - - if (needed > current_function_outgoing_args_size) - current_function_outgoing_args_size = needed; - - if (must_preallocate) - { -#ifdef ACCUMULATE_OUTGOING_ARGS - /* Since the stack pointer will never be pushed, it is possible for - the evaluation of a parm to clobber something we have already - written to the stack. Since most function calls on RISC machines - do not use the stack, this is uncommon, but must work correctly. - - Therefore, we save any area of the stack that was already written - and that we are using. Here we set up to do this by making a new - stack usage map from the old one. The actual save will be done - by store_one_arg. - - Another approach might be to try to reorder the argument - evaluations to avoid this conflicting stack usage. */ - -#ifndef OUTGOING_REG_PARM_STACK_SPACE - /* Since we will be writing into the entire argument area, the - map must be allocated for its entire size, not just the part that - is the responsibility of the caller. */ - needed += reg_parm_stack_space; -#endif - -#ifdef ARGS_GROW_DOWNWARD - highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, - needed + 1); -#else - highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, - needed); -#endif - stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use); - - if (initial_highest_arg_in_use) - bcopy (initial_stack_usage_map, stack_usage_map, - initial_highest_arg_in_use); - - if (initial_highest_arg_in_use != highest_outgoing_arg_in_use) - bzero (&stack_usage_map[initial_highest_arg_in_use], - highest_outgoing_arg_in_use - initial_highest_arg_in_use); - needed = 0; - - /* The address of the outgoing argument list must not be copied to a - register here, because argblock would be left pointing to the - wrong place after the call to allocate_dynamic_stack_space below. - */ - - argblock = virtual_outgoing_args_rtx; - -#else /* not ACCUMULATE_OUTGOING_ARGS */ - if (inhibit_defer_pop == 0) - { - /* Try to reuse some or all of the pending_stack_adjust - to get this space. Maybe we can avoid any pushing. */ - if (needed > pending_stack_adjust) - { - needed -= pending_stack_adjust; - pending_stack_adjust = 0; - } - else - { - pending_stack_adjust -= needed; - needed = 0; - } - } - /* Special case this because overhead of `push_block' in this - case is non-trivial. */ - if (needed == 0) - argblock = virtual_outgoing_args_rtx; - else - argblock = push_block (GEN_INT (needed), 0, 0); - - /* We only really need to call `copy_to_reg' in the case where push - insns are going to be used to pass ARGBLOCK to a function - call in ARGS. In that case, the stack pointer changes value - from the allocation point to the call point, and hence - the value of VIRTUAL_OUTGOING_ARGS_RTX changes as well. - But might as well always do it. */ - argblock = copy_to_reg (argblock); -#endif /* not ACCUMULATE_OUTGOING_ARGS */ - } - } - -#ifdef ACCUMULATE_OUTGOING_ARGS - /* The save/restore code in store_one_arg handles all cases except one: - a constructor call (including a C function returning a BLKmode struct) - to initialize an argument. */ - if (stack_arg_under_construction) - { -#ifndef OUTGOING_REG_PARM_STACK_SPACE - rtx push_size = GEN_INT (reg_parm_stack_space + args_size.constant); -#else - rtx push_size = GEN_INT (args_size.constant); -#endif - if (old_stack_level == 0) - { - emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX); - old_pending_adj = pending_stack_adjust; - pending_stack_adjust = 0; - /* stack_arg_under_construction says whether a stack arg is - being constructed at the old stack level. Pushing the stack - gets a clean outgoing argument block. */ - old_stack_arg_under_construction = stack_arg_under_construction; - stack_arg_under_construction = 0; - /* Make a new map for the new argument list. */ - stack_usage_map = (char *)alloca (highest_outgoing_arg_in_use); - bzero (stack_usage_map, highest_outgoing_arg_in_use); - highest_outgoing_arg_in_use = 0; - } - allocate_dynamic_stack_space (push_size, NULL_RTX, BITS_PER_UNIT); - } - /* If argument evaluation might modify the stack pointer, copy the - address of the argument list to a register. */ - for (i = 0; i < num_actuals; i++) - if (args[i].pass_on_stack) - { - argblock = copy_addr_to_reg (argblock); - break; - } -#endif - - compute_argument_addresses (args, argblock, num_actuals); - -#ifdef PUSH_ARGS_REVERSED -#ifdef PREFERRED_STACK_BOUNDARY - /* If we push args individually in reverse order, perform stack alignment - before the first push (the last arg). */ - if (argblock == 0) - anti_adjust_stack (GEN_INT (args_size.constant - unadjusted_args_size)); -#endif -#endif - - /* Don't try to defer pops if preallocating, not even from the first arg, - since ARGBLOCK probably refers to the SP. */ - if (argblock) - NO_DEFER_POP; - - funexp = rtx_for_function_call (fndecl, exp); - - /* Figure out the register where the value, if any, will come back. */ - valreg = 0; - if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode - && ! structure_value_addr) - { - if (pcc_struct_value) - valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)), - fndecl); - else - valreg = hard_function_value (TREE_TYPE (exp), fndecl); - } - - /* Precompute all register parameters. It isn't safe to compute anything - once we have started filling any specific hard regs. */ - precompute_register_parameters (num_actuals, args, ®_parm_seen); - -#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE) - - /* Save the fixed argument area if it's part of the caller's frame and - is clobbered by argument setup for this call. */ - save_area = save_fixed_argument_area (reg_parm_stack_space, argblock, - &low_to_save, &high_to_save); -#endif - - - /* Now store (and compute if necessary) all non-register parms. - These come before register parms, since they can require block-moves, - which could clobber the registers used for register parms. - Parms which have partial registers are not stored here, - but we do preallocate space here if they want that. */ - - for (i = 0; i < num_actuals; i++) - if (args[i].reg == 0 || args[i].pass_on_stack) - store_one_arg (&args[i], argblock, may_be_alloca, - args_size.var != 0, reg_parm_stack_space); - - /* If we have a parm that is passed in registers but not in memory - and whose alignment does not permit a direct copy into registers, - make a group of pseudos that correspond to each register that we - will later fill. */ - if (STRICT_ALIGNMENT) - store_unaligned_arguments_into_pseudos (args, num_actuals); - - /* Now store any partially-in-registers parm. - This is the last place a block-move can happen. */ - if (reg_parm_seen) - for (i = 0; i < num_actuals; i++) - if (args[i].partial != 0 && ! args[i].pass_on_stack) - store_one_arg (&args[i], argblock, may_be_alloca, - args_size.var != 0, reg_parm_stack_space); - -#ifndef PUSH_ARGS_REVERSED -#ifdef PREFERRED_STACK_BOUNDARY - /* If we pushed args in forward order, perform stack alignment - after pushing the last arg. */ - if (argblock == 0) - anti_adjust_stack (GEN_INT (args_size.constant - unadjusted_args_size)); -#endif -#endif - - /* If register arguments require space on the stack and stack space - was not preallocated, allocate stack space here for arguments - passed in registers. */ -#if ! defined(ACCUMULATE_OUTGOING_ARGS) && defined(OUTGOING_REG_PARM_STACK_SPACE) - if (must_preallocate == 0 && reg_parm_stack_space > 0) - anti_adjust_stack (GEN_INT (reg_parm_stack_space)); -#endif - - /* Pass the function the address in which to return a structure value. */ - if (structure_value_addr && ! structure_value_addr_parm) - { - emit_move_insn (struct_value_rtx, - force_reg (Pmode, - force_operand (structure_value_addr, - NULL_RTX))); - - /* Mark the memory for the aggregate as write-only. */ - if (current_function_check_memory_usage) - emit_library_call (chkr_set_right_libfunc, 1, - VOIDmode, 3, - structure_value_addr, Pmode, - GEN_INT (struct_value_size), TYPE_MODE (sizetype), - GEN_INT (MEMORY_USE_WO), - TYPE_MODE (integer_type_node)); - - if (GET_CODE (struct_value_rtx) == REG) - use_reg (&call_fusage, struct_value_rtx); - } - - funexp = prepare_call_address (funexp, fndecl, &call_fusage, reg_parm_seen); - - load_register_parameters (args, num_actuals, &call_fusage); - - /* Perform postincrements before actually calling the function. */ - emit_queue (); - - /* All arguments and registers used for the call must be set up by now! */ - - /* Generate the actual call instruction. */ - emit_call_1 (funexp, fndecl, funtype, unadjusted_args_size, - args_size.constant, struct_value_size, - FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1), - valreg, old_inhibit_defer_pop, call_fusage, is_const); - - /* If call is cse'able, make appropriate pair of reg-notes around it. - Test valreg so we don't crash; may safely ignore `const' - if return type is void. Disable for PARALLEL return values, because - we have no way to move such values into a pseudo register. */ - if (is_const && valreg != 0 && GET_CODE (valreg) != PARALLEL) - { - rtx note = 0; - rtx temp = gen_reg_rtx (GET_MODE (valreg)); - rtx insns; - - /* Mark the return value as a pointer if needed. */ - if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE) - { - tree pointed_to = TREE_TYPE (TREE_TYPE (exp)); - mark_reg_pointer (temp, TYPE_ALIGN (pointed_to) / BITS_PER_UNIT); - } - - /* Construct an "equal form" for the value which mentions all the - arguments in order as well as the function name. */ -#ifdef PUSH_ARGS_REVERSED - for (i = 0; i < num_actuals; i++) - note = gen_rtx_EXPR_LIST (VOIDmode, args[i].initial_value, note); -#else - for (i = num_actuals - 1; i >= 0; i--) - note = gen_rtx_EXPR_LIST (VOIDmode, args[i].initial_value, note); -#endif - note = gen_rtx_EXPR_LIST (VOIDmode, funexp, note); - - insns = get_insns (); - end_sequence (); - - emit_libcall_block (insns, temp, valreg, note); - - valreg = temp; - } - else if (is_const) - { - /* Otherwise, just write out the sequence without a note. */ - rtx insns = get_insns (); - - end_sequence (); - emit_insns (insns); - } - else if (is_malloc) - { - rtx temp = gen_reg_rtx (GET_MODE (valreg)); - rtx last, insns; - - /* The return value from a malloc-like function is a pointer. */ - if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE) - mark_reg_pointer (temp, BIGGEST_ALIGNMENT / BITS_PER_UNIT); - - emit_move_insn (temp, valreg); - - /* The return value from a malloc-like function can not alias - anything else. */ - last = get_last_insn (); - REG_NOTES (last) = - gen_rtx_EXPR_LIST (REG_NOALIAS, temp, REG_NOTES (last)); - - /* Write out the sequence. */ - insns = get_insns (); - end_sequence (); - emit_insns (insns); - valreg = temp; - } - - /* For calls to `setjmp', etc., inform flow.c it should complain - if nonvolatile values are live. */ - - if (returns_twice) - { - emit_note (name, NOTE_INSN_SETJMP); - current_function_calls_setjmp = 1; - } - - if (is_longjmp) - current_function_calls_longjmp = 1; - - /* Notice functions that cannot return. - If optimizing, insns emitted below will be dead. - If not optimizing, they will exist, which is useful - if the user uses the `return' command in the debugger. */ - - if (is_volatile || is_longjmp) - emit_barrier (); - - /* If value type not void, return an rtx for the value. */ - - /* If there are cleanups to be called, don't use a hard reg as target. - We need to double check this and see if it matters anymore. */ - if (any_pending_cleanups (1) - && target && REG_P (target) - && REGNO (target) < FIRST_PSEUDO_REGISTER) - target = 0; - - if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode - || ignore) - { - target = const0_rtx; - } - else if (structure_value_addr) - { - if (target == 0 || GET_CODE (target) != MEM) - { - target = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (exp)), - memory_address (TYPE_MODE (TREE_TYPE (exp)), - structure_value_addr)); - MEM_SET_IN_STRUCT_P (target, - AGGREGATE_TYPE_P (TREE_TYPE (exp))); - } - } - else if (pcc_struct_value) - { - /* This is the special C++ case where we need to - know what the true target was. We take care to - never use this value more than once in one expression. */ - target = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (exp)), - copy_to_reg (valreg)); - MEM_SET_IN_STRUCT_P (target, AGGREGATE_TYPE_P (TREE_TYPE (exp))); - } - /* Handle calls that return values in multiple non-contiguous locations. - The Irix 6 ABI has examples of this. */ - else if (GET_CODE (valreg) == PARALLEL) - { - int bytes = int_size_in_bytes (TREE_TYPE (exp)); - - if (target == 0) - { - target = assign_stack_temp (TYPE_MODE (TREE_TYPE (exp)), bytes, 0); - MEM_SET_IN_STRUCT_P (target, AGGREGATE_TYPE_P (TREE_TYPE (exp))); - preserve_temp_slots (target); - } - - emit_group_store (target, valreg, bytes, - TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT); - } - else if (target && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp)) - && GET_MODE (target) == GET_MODE (valreg)) - /* TARGET and VALREG cannot be equal at this point because the latter - would not have REG_FUNCTION_VALUE_P true, while the former would if - it were referring to the same register. - - If they refer to the same register, this move will be a no-op, except - when function inlining is being done. */ - emit_move_insn (target, valreg); - else if (TYPE_MODE (TREE_TYPE (exp)) == BLKmode) - target = copy_blkmode_from_reg (target, valreg, TREE_TYPE (exp)); - else - target = copy_to_reg (valreg); - -#ifdef PROMOTE_FUNCTION_RETURN - /* If we promoted this return value, make the proper SUBREG. TARGET - might be const0_rtx here, so be careful. */ - if (GET_CODE (target) == REG - && TYPE_MODE (TREE_TYPE (exp)) != BLKmode - && GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp))) - { - tree type = TREE_TYPE (exp); - int unsignedp = TREE_UNSIGNED (type); - - /* If we don't promote as expected, something is wrong. */ - if (GET_MODE (target) - != promote_mode (type, TYPE_MODE (type), &unsignedp, 1)) - abort (); - - target = gen_rtx_SUBREG (TYPE_MODE (type), target, 0); - SUBREG_PROMOTED_VAR_P (target) = 1; - SUBREG_PROMOTED_UNSIGNED_P (target) = unsignedp; - } -#endif - - /* If size of args is variable or this was a constructor call for a stack - argument, restore saved stack-pointer value. */ - - if (old_stack_level) - { - emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX); - pending_stack_adjust = old_pending_adj; -#ifdef ACCUMULATE_OUTGOING_ARGS - stack_arg_under_construction = old_stack_arg_under_construction; - highest_outgoing_arg_in_use = initial_highest_arg_in_use; - stack_usage_map = initial_stack_usage_map; -#endif - } -#ifdef ACCUMULATE_OUTGOING_ARGS - else - { -#ifdef REG_PARM_STACK_SPACE - if (save_area) - restore_fixed_argument_area (save_area, argblock, - high_to_save, low_to_save); -#endif - - /* If we saved any argument areas, restore them. */ - for (i = 0; i < num_actuals; i++) - if (args[i].save_area) - { - enum machine_mode save_mode = GET_MODE (args[i].save_area); - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - XEXP (args[i].stack_slot, 0))); - - if (save_mode != BLKmode) - emit_move_insn (stack_area, args[i].save_area); - else - emit_block_move (stack_area, validize_mem (args[i].save_area), - GEN_INT (args[i].size.constant), - PARM_BOUNDARY / BITS_PER_UNIT); - } - - highest_outgoing_arg_in_use = initial_highest_arg_in_use; - stack_usage_map = initial_stack_usage_map; - } -#endif - - /* If this was alloca, record the new stack level for nonlocal gotos. - Check for the handler slots since we might not have a save area - for non-local gotos. */ - - if (may_be_alloca && nonlocal_goto_handler_slots != 0) - emit_stack_save (SAVE_NONLOCAL, &nonlocal_goto_stack_level, NULL_RTX); - - pop_temp_slots (); - - /* Free up storage we no longer need. */ - for (i = 0; i < num_actuals; ++i) - if (args[i].aligned_regs) - free (args[i].aligned_regs); - - return target; -} - -/* Output a library call to function FUN (a SYMBOL_REF rtx) - (emitting the queue unless NO_QUEUE is nonzero), - for a value of mode OUTMODE, - with NARGS different arguments, passed as alternating rtx values - and machine_modes to convert them to. - The rtx values should have been passed through protect_from_queue already. - - NO_QUEUE will be true if and only if the library call is a `const' call - which will be enclosed in REG_LIBCALL/REG_RETVAL notes; it is equivalent - to the variable is_const in expand_call. - - NO_QUEUE must be true for const calls, because if it isn't, then - any pending increment will be emitted between REG_LIBCALL/REG_RETVAL notes, - and will be lost if the libcall sequence is optimized away. - - NO_QUEUE must be false for non-const calls, because if it isn't, the - call insn will have its CONST_CALL_P bit set, and it will be incorrectly - optimized. For instance, the instruction scheduler may incorrectly - move memory references across the non-const call. */ - -void -emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode, - int nargs, ...)) -{ -#ifndef ANSI_PROTOTYPES - rtx orgfun; - int no_queue; - enum machine_mode outmode; - int nargs; -#endif - va_list p; - /* Total size in bytes of all the stack-parms scanned so far. */ - struct args_size args_size; - /* Size of arguments before any adjustments (such as rounding). */ - struct args_size original_args_size; - register int argnum; - rtx fun; - int inc; - int count; - rtx argblock = 0; - CUMULATIVE_ARGS args_so_far; - struct arg { rtx value; enum machine_mode mode; rtx reg; int partial; - struct args_size offset; struct args_size size; rtx save_area; }; - struct arg *argvec; - int old_inhibit_defer_pop = inhibit_defer_pop; - rtx call_fusage = 0; - int reg_parm_stack_space = 0; -#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE) - /* Define the boundary of the register parm stack space that needs to be - save, if any. */ - int low_to_save = -1, high_to_save; - rtx save_area = 0; /* Place that it is saved */ -#endif - -#ifdef ACCUMULATE_OUTGOING_ARGS - int initial_highest_arg_in_use = highest_outgoing_arg_in_use; - char *initial_stack_usage_map = stack_usage_map; - int needed; -#endif - -#ifdef REG_PARM_STACK_SPACE - /* Size of the stack reserved for parameter registers. */ -#ifdef MAYBE_REG_PARM_STACK_SPACE - reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE; -#else - reg_parm_stack_space = REG_PARM_STACK_SPACE ((tree) 0); -#endif -#endif - - VA_START (p, nargs); - -#ifndef ANSI_PROTOTYPES - orgfun = va_arg (p, rtx); - no_queue = va_arg (p, int); - outmode = va_arg (p, enum machine_mode); - nargs = va_arg (p, int); -#endif - - fun = orgfun; - - /* Copy all the libcall-arguments out of the varargs data - and into a vector ARGVEC. - - Compute how to pass each argument. We only support a very small subset - of the full argument passing conventions to limit complexity here since - library functions shouldn't have many args. */ - - argvec = (struct arg *) alloca (nargs * sizeof (struct arg)); - bzero ((char *) argvec, nargs * sizeof (struct arg)); - - - INIT_CUMULATIVE_ARGS (args_so_far, NULL_TREE, fun, 0); - - args_size.constant = 0; - args_size.var = 0; - - push_temp_slots (); - - for (count = 0; count < nargs; count++) - { - rtx val = va_arg (p, rtx); - enum machine_mode mode = va_arg (p, enum machine_mode); - - /* We cannot convert the arg value to the mode the library wants here; - must do it earlier where we know the signedness of the arg. */ - if (mode == BLKmode - || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode)) - abort (); - - /* On some machines, there's no way to pass a float to a library fcn. - Pass it as a double instead. */ -#ifdef LIBGCC_NEEDS_DOUBLE - if (LIBGCC_NEEDS_DOUBLE && mode == SFmode) - val = convert_modes (DFmode, SFmode, val, 0), mode = DFmode; -#endif - - /* There's no need to call protect_from_queue, because - either emit_move_insn or emit_push_insn will do that. */ - - /* Make sure it is a reasonable operand for a move or push insn. */ - if (GET_CODE (val) != REG && GET_CODE (val) != MEM - && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val))) - val = force_operand (val, NULL_RTX); - -#ifdef FUNCTION_ARG_PASS_BY_REFERENCE - if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1)) - { - /* We do not support FUNCTION_ARG_CALLEE_COPIES here since it can - be viewed as just an efficiency improvement. */ - rtx slot = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0); - emit_move_insn (slot, val); - val = force_operand (XEXP (slot, 0), NULL_RTX); - mode = Pmode; - } -#endif - - argvec[count].value = val; - argvec[count].mode = mode; - - argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1); - if (argvec[count].reg && GET_CODE (argvec[count].reg) == PARALLEL) - abort (); -#ifdef FUNCTION_ARG_PARTIAL_NREGS - argvec[count].partial - = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1); -#else - argvec[count].partial = 0; -#endif - - locate_and_pad_parm (mode, NULL_TREE, - argvec[count].reg && argvec[count].partial == 0, - NULL_TREE, &args_size, &argvec[count].offset, - &argvec[count].size); - - if (argvec[count].size.var) - abort (); - - if (reg_parm_stack_space == 0 && argvec[count].partial) - argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD; - - if (argvec[count].reg == 0 || argvec[count].partial != 0 - || reg_parm_stack_space > 0) - args_size.constant += argvec[count].size.constant; - - FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree) 0, 1); - } - va_end (p); - -#ifdef FINAL_REG_PARM_STACK_SPACE - reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant, - args_size.var); -#endif - - /* If this machine requires an external definition for library - functions, write one out. */ - assemble_external_libcall (fun); - - original_args_size = args_size; -#ifdef PREFERRED_STACK_BOUNDARY - args_size.constant = (((args_size.constant + (STACK_BYTES - 1)) - / STACK_BYTES) * STACK_BYTES); -#endif - - args_size.constant = MAX (args_size.constant, - reg_parm_stack_space); - -#ifndef OUTGOING_REG_PARM_STACK_SPACE - args_size.constant -= reg_parm_stack_space; -#endif - - if (args_size.constant > current_function_outgoing_args_size) - current_function_outgoing_args_size = args_size.constant; - -#ifdef ACCUMULATE_OUTGOING_ARGS - /* Since the stack pointer will never be pushed, it is possible for - the evaluation of a parm to clobber something we have already - written to the stack. Since most function calls on RISC machines - do not use the stack, this is uncommon, but must work correctly. - - Therefore, we save any area of the stack that was already written - and that we are using. Here we set up to do this by making a new - stack usage map from the old one. - - Another approach might be to try to reorder the argument - evaluations to avoid this conflicting stack usage. */ - - needed = args_size.constant; - -#ifndef OUTGOING_REG_PARM_STACK_SPACE - /* Since we will be writing into the entire argument area, the - map must be allocated for its entire size, not just the part that - is the responsibility of the caller. */ - needed += reg_parm_stack_space; -#endif - -#ifdef ARGS_GROW_DOWNWARD - highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, - needed + 1); -#else - highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, - needed); -#endif - stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use); - - if (initial_highest_arg_in_use) - bcopy (initial_stack_usage_map, stack_usage_map, - initial_highest_arg_in_use); - - if (initial_highest_arg_in_use != highest_outgoing_arg_in_use) - bzero (&stack_usage_map[initial_highest_arg_in_use], - highest_outgoing_arg_in_use - initial_highest_arg_in_use); - needed = 0; - - /* The address of the outgoing argument list must not be copied to a - register here, because argblock would be left pointing to the - wrong place after the call to allocate_dynamic_stack_space below. - */ - - argblock = virtual_outgoing_args_rtx; -#else /* not ACCUMULATE_OUTGOING_ARGS */ -#ifndef PUSH_ROUNDING - argblock = push_block (GEN_INT (args_size.constant), 0, 0); -#endif -#endif - -#ifdef PUSH_ARGS_REVERSED -#ifdef PREFERRED_STACK_BOUNDARY - /* If we push args individually in reverse order, perform stack alignment - before the first push (the last arg). */ - if (argblock == 0) - anti_adjust_stack (GEN_INT (args_size.constant - - original_args_size.constant)); -#endif -#endif - -#ifdef PUSH_ARGS_REVERSED - inc = -1; - argnum = nargs - 1; -#else - inc = 1; - argnum = 0; -#endif - -#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE) - /* The argument list is the property of the called routine and it - may clobber it. If the fixed area has been used for previous - parameters, we must save and restore it. - - Here we compute the boundary of the that needs to be saved, if any. */ - -#ifdef ARGS_GROW_DOWNWARD - for (count = 0; count < reg_parm_stack_space + 1; count++) -#else - for (count = 0; count < reg_parm_stack_space; count++) -#endif - { - if (count >= highest_outgoing_arg_in_use - || stack_usage_map[count] == 0) - continue; - - if (low_to_save == -1) - low_to_save = count; - - high_to_save = count; - } - - if (low_to_save >= 0) - { - int num_to_save = high_to_save - low_to_save + 1; - enum machine_mode save_mode - = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1); - rtx stack_area; - - /* If we don't have the required alignment, must do this in BLKmode. */ - if ((low_to_save & (MIN (GET_MODE_SIZE (save_mode), - BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1))) - save_mode = BLKmode; - -#ifdef ARGS_GROW_DOWNWARD - stack_area = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - - high_to_save))); -#else - stack_area = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - low_to_save))); -#endif - if (save_mode == BLKmode) - { - save_area = assign_stack_temp (BLKmode, num_to_save, 0); - emit_block_move (validize_mem (save_area), stack_area, - GEN_INT (num_to_save), - PARM_BOUNDARY / BITS_PER_UNIT); - } - else - { - save_area = gen_reg_rtx (save_mode); - emit_move_insn (save_area, stack_area); - } - } -#endif - - /* Push the args that need to be pushed. */ - - /* ARGNUM indexes the ARGVEC array in the order in which the arguments - are to be pushed. */ - for (count = 0; count < nargs; count++, argnum += inc) - { - register enum machine_mode mode = argvec[argnum].mode; - register rtx val = argvec[argnum].value; - rtx reg = argvec[argnum].reg; - int partial = argvec[argnum].partial; -#ifdef ACCUMULATE_OUTGOING_ARGS - int lower_bound, upper_bound, i; -#endif - - if (! (reg != 0 && partial == 0)) - { -#ifdef ACCUMULATE_OUTGOING_ARGS - /* If this is being stored into a pre-allocated, fixed-size, stack - area, save any previous data at that location. */ - -#ifdef ARGS_GROW_DOWNWARD - /* stack_slot is negative, but we want to index stack_usage_map - with positive values. */ - upper_bound = -argvec[argnum].offset.constant + 1; - lower_bound = upper_bound - argvec[argnum].size.constant; -#else - lower_bound = argvec[argnum].offset.constant; - upper_bound = lower_bound + argvec[argnum].size.constant; -#endif - - for (i = lower_bound; i < upper_bound; i++) - if (stack_usage_map[i] - /* Don't store things in the fixed argument area at this point; - it has already been saved. */ - && i > reg_parm_stack_space) - break; - - if (i != upper_bound) - { - /* We need to make a save area. See what mode we can make it. */ - enum machine_mode save_mode - = mode_for_size (argvec[argnum].size.constant * BITS_PER_UNIT, - MODE_INT, 1); - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, argvec[argnum].offset.constant))); - argvec[argnum].save_area = gen_reg_rtx (save_mode); - emit_move_insn (argvec[argnum].save_area, stack_area); - } -#endif - emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0, - argblock, GEN_INT (argvec[argnum].offset.constant), - reg_parm_stack_space); - -#ifdef ACCUMULATE_OUTGOING_ARGS - /* Now mark the segment we just used. */ - for (i = lower_bound; i < upper_bound; i++) - stack_usage_map[i] = 1; -#endif - - NO_DEFER_POP; - } - } - -#ifndef PUSH_ARGS_REVERSED -#ifdef PREFERRED_STACK_BOUNDARY - /* If we pushed args in forward order, perform stack alignment - after pushing the last arg. */ - if (argblock == 0) - anti_adjust_stack (GEN_INT (args_size.constant - - original_args_size.constant)); -#endif -#endif - -#ifdef PUSH_ARGS_REVERSED - argnum = nargs - 1; -#else - argnum = 0; -#endif - - fun = prepare_call_address (fun, NULL_TREE, &call_fusage, 0); - - /* Now load any reg parms into their regs. */ - - /* ARGNUM indexes the ARGVEC array in the order in which the arguments - are to be pushed. */ - for (count = 0; count < nargs; count++, argnum += inc) - { - register rtx val = argvec[argnum].value; - rtx reg = argvec[argnum].reg; - int partial = argvec[argnum].partial; - - if (reg != 0 && partial == 0) - emit_move_insn (reg, val); - NO_DEFER_POP; - } - - /* For version 1.37, try deleting this entirely. */ - if (! no_queue) - emit_queue (); - - /* Any regs containing parms remain in use through the call. */ - for (count = 0; count < nargs; count++) - if (argvec[count].reg != 0) - use_reg (&call_fusage, argvec[count].reg); - - /* Don't allow popping to be deferred, since then - cse'ing of library calls could delete a call and leave the pop. */ - NO_DEFER_POP; - - /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which - will set inhibit_defer_pop to that value. */ - - /* The return type is needed to decide how many bytes the function pops. - Signedness plays no role in that, so for simplicity, we pretend it's - always signed. We also assume that the list of arguments passed has - no impact, so we pretend it is unknown. */ - - emit_call_1 (fun, - get_identifier (XSTR (orgfun, 0)), - build_function_type (outmode == VOIDmode ? void_type_node - : type_for_mode (outmode, 0), NULL_TREE), - original_args_size.constant, args_size.constant, 0, - FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1), - outmode != VOIDmode ? hard_libcall_value (outmode) : NULL_RTX, - old_inhibit_defer_pop + 1, call_fusage, no_queue); - - pop_temp_slots (); - - /* Now restore inhibit_defer_pop to its actual original value. */ - OK_DEFER_POP; - -#ifdef ACCUMULATE_OUTGOING_ARGS -#ifdef REG_PARM_STACK_SPACE - if (save_area) - { - enum machine_mode save_mode = GET_MODE (save_area); -#ifdef ARGS_GROW_DOWNWARD - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - - high_to_save))); -#else - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, low_to_save))); -#endif - - if (save_mode != BLKmode) - emit_move_insn (stack_area, save_area); - else - emit_block_move (stack_area, validize_mem (save_area), - GEN_INT (high_to_save - low_to_save + 1), - PARM_BOUNDARY / BITS_PER_UNIT); - } -#endif - - /* If we saved any argument areas, restore them. */ - for (count = 0; count < nargs; count++) - if (argvec[count].save_area) - { - enum machine_mode save_mode = GET_MODE (argvec[count].save_area); - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, argvec[count].offset.constant))); - - emit_move_insn (stack_area, argvec[count].save_area); - } - - highest_outgoing_arg_in_use = initial_highest_arg_in_use; - stack_usage_map = initial_stack_usage_map; -#endif -} - -/* Like emit_library_call except that an extra argument, VALUE, - comes second and says where to store the result. - (If VALUE is zero, this function chooses a convenient way - to return the value. - - This function returns an rtx for where the value is to be found. - If VALUE is nonzero, VALUE is returned. */ - -rtx -emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue, - enum machine_mode outmode, int nargs, ...)) -{ -#ifndef ANSI_PROTOTYPES - rtx orgfun; - rtx value; - int no_queue; - enum machine_mode outmode; - int nargs; -#endif - va_list p; - /* Total size in bytes of all the stack-parms scanned so far. */ - struct args_size args_size; - /* Size of arguments before any adjustments (such as rounding). */ - struct args_size original_args_size; - register int argnum; - rtx fun; - int inc; - int count; - rtx argblock = 0; - CUMULATIVE_ARGS args_so_far; - struct arg { rtx value; enum machine_mode mode; rtx reg; int partial; - struct args_size offset; struct args_size size; rtx save_area; }; - struct arg *argvec; - int old_inhibit_defer_pop = inhibit_defer_pop; - rtx call_fusage = 0; - rtx mem_value = 0; - int pcc_struct_value = 0; - int struct_value_size = 0; - int is_const; - int reg_parm_stack_space = 0; -#ifdef ACCUMULATE_OUTGOING_ARGS - int needed; -#endif - -#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE) - /* Define the boundary of the register parm stack space that needs to be - save, if any. */ - int low_to_save = -1, high_to_save; - rtx save_area = 0; /* Place that it is saved */ -#endif - -#ifdef ACCUMULATE_OUTGOING_ARGS - /* Size of the stack reserved for parameter registers. */ - int initial_highest_arg_in_use = highest_outgoing_arg_in_use; - char *initial_stack_usage_map = stack_usage_map; -#endif - -#ifdef REG_PARM_STACK_SPACE -#ifdef MAYBE_REG_PARM_STACK_SPACE - reg_parm_stack_space = MAYBE_REG_PARM_STACK_SPACE; -#else - reg_parm_stack_space = REG_PARM_STACK_SPACE ((tree) 0); -#endif -#endif - - VA_START (p, nargs); - -#ifndef ANSI_PROTOTYPES - orgfun = va_arg (p, rtx); - value = va_arg (p, rtx); - no_queue = va_arg (p, int); - outmode = va_arg (p, enum machine_mode); - nargs = va_arg (p, int); -#endif - - is_const = no_queue; - fun = orgfun; - - /* If this kind of value comes back in memory, - decide where in memory it should come back. */ - if (aggregate_value_p (type_for_mode (outmode, 0))) - { -#ifdef PCC_STATIC_STRUCT_RETURN - rtx pointer_reg - = hard_function_value (build_pointer_type (type_for_mode (outmode, 0)), - 0); - mem_value = gen_rtx_MEM (outmode, pointer_reg); - pcc_struct_value = 1; - if (value == 0) - value = gen_reg_rtx (outmode); -#else /* not PCC_STATIC_STRUCT_RETURN */ - struct_value_size = GET_MODE_SIZE (outmode); - if (value != 0 && GET_CODE (value) == MEM) - mem_value = value; - else - mem_value = assign_stack_temp (outmode, GET_MODE_SIZE (outmode), 0); -#endif - - /* This call returns a big structure. */ - is_const = 0; - } - - /* ??? Unfinished: must pass the memory address as an argument. */ - - /* Copy all the libcall-arguments out of the varargs data - and into a vector ARGVEC. - - Compute how to pass each argument. We only support a very small subset - of the full argument passing conventions to limit complexity here since - library functions shouldn't have many args. */ - - argvec = (struct arg *) alloca ((nargs + 1) * sizeof (struct arg)); - bzero ((char *) argvec, (nargs + 1) * sizeof (struct arg)); - - INIT_CUMULATIVE_ARGS (args_so_far, NULL_TREE, fun, 0); - - args_size.constant = 0; - args_size.var = 0; - - count = 0; - - push_temp_slots (); - - /* If there's a structure value address to be passed, - either pass it in the special place, or pass it as an extra argument. */ - if (mem_value && struct_value_rtx == 0 && ! pcc_struct_value) - { - rtx addr = XEXP (mem_value, 0); - nargs++; - - /* Make sure it is a reasonable operand for a move or push insn. */ - if (GET_CODE (addr) != REG && GET_CODE (addr) != MEM - && ! (CONSTANT_P (addr) && LEGITIMATE_CONSTANT_P (addr))) - addr = force_operand (addr, NULL_RTX); - - argvec[count].value = addr; - argvec[count].mode = Pmode; - argvec[count].partial = 0; - - argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1); -#ifdef FUNCTION_ARG_PARTIAL_NREGS - if (FUNCTION_ARG_PARTIAL_NREGS (args_so_far, Pmode, NULL_TREE, 1)) - abort (); -#endif - - locate_and_pad_parm (Pmode, NULL_TREE, - argvec[count].reg && argvec[count].partial == 0, - NULL_TREE, &args_size, &argvec[count].offset, - &argvec[count].size); - - - if (argvec[count].reg == 0 || argvec[count].partial != 0 - || reg_parm_stack_space > 0) - args_size.constant += argvec[count].size.constant; - - FUNCTION_ARG_ADVANCE (args_so_far, Pmode, (tree) 0, 1); - - count++; - } - - for (; count < nargs; count++) - { - rtx val = va_arg (p, rtx); - enum machine_mode mode = va_arg (p, enum machine_mode); - - /* We cannot convert the arg value to the mode the library wants here; - must do it earlier where we know the signedness of the arg. */ - if (mode == BLKmode - || (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode)) - abort (); - - /* On some machines, there's no way to pass a float to a library fcn. - Pass it as a double instead. */ -#ifdef LIBGCC_NEEDS_DOUBLE - if (LIBGCC_NEEDS_DOUBLE && mode == SFmode) - val = convert_modes (DFmode, SFmode, val, 0), mode = DFmode; -#endif - - /* There's no need to call protect_from_queue, because - either emit_move_insn or emit_push_insn will do that. */ - - /* Make sure it is a reasonable operand for a move or push insn. */ - if (GET_CODE (val) != REG && GET_CODE (val) != MEM - && ! (CONSTANT_P (val) && LEGITIMATE_CONSTANT_P (val))) - val = force_operand (val, NULL_RTX); - -#ifdef FUNCTION_ARG_PASS_BY_REFERENCE - if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1)) - { - /* We do not support FUNCTION_ARG_CALLEE_COPIES here since it can - be viewed as just an efficiency improvement. */ - rtx slot = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0); - emit_move_insn (slot, val); - val = XEXP (slot, 0); - mode = Pmode; - } -#endif - - argvec[count].value = val; - argvec[count].mode = mode; - - argvec[count].reg = FUNCTION_ARG (args_so_far, mode, NULL_TREE, 1); - if (argvec[count].reg && GET_CODE (argvec[count].reg) == PARALLEL) - abort (); -#ifdef FUNCTION_ARG_PARTIAL_NREGS - argvec[count].partial - = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, NULL_TREE, 1); -#else - argvec[count].partial = 0; -#endif - - locate_and_pad_parm (mode, NULL_TREE, - argvec[count].reg && argvec[count].partial == 0, - NULL_TREE, &args_size, &argvec[count].offset, - &argvec[count].size); - - if (argvec[count].size.var) - abort (); - - if (reg_parm_stack_space == 0 && argvec[count].partial) - argvec[count].size.constant -= argvec[count].partial * UNITS_PER_WORD; - - if (argvec[count].reg == 0 || argvec[count].partial != 0 - || reg_parm_stack_space > 0) - args_size.constant += argvec[count].size.constant; - - FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree) 0, 1); - } - va_end (p); - -#ifdef FINAL_REG_PARM_STACK_SPACE - reg_parm_stack_space = FINAL_REG_PARM_STACK_SPACE (args_size.constant, - args_size.var); -#endif - /* If this machine requires an external definition for library - functions, write one out. */ - assemble_external_libcall (fun); - - original_args_size = args_size; -#ifdef PREFERRED_STACK_BOUNDARY - args_size.constant = (((args_size.constant + (STACK_BYTES - 1)) - / STACK_BYTES) * STACK_BYTES); -#endif - - args_size.constant = MAX (args_size.constant, - reg_parm_stack_space); - -#ifndef OUTGOING_REG_PARM_STACK_SPACE - args_size.constant -= reg_parm_stack_space; -#endif - - if (args_size.constant > current_function_outgoing_args_size) - current_function_outgoing_args_size = args_size.constant; - -#ifdef ACCUMULATE_OUTGOING_ARGS - /* Since the stack pointer will never be pushed, it is possible for - the evaluation of a parm to clobber something we have already - written to the stack. Since most function calls on RISC machines - do not use the stack, this is uncommon, but must work correctly. - - Therefore, we save any area of the stack that was already written - and that we are using. Here we set up to do this by making a new - stack usage map from the old one. - - Another approach might be to try to reorder the argument - evaluations to avoid this conflicting stack usage. */ - - needed = args_size.constant; - -#ifndef OUTGOING_REG_PARM_STACK_SPACE - /* Since we will be writing into the entire argument area, the - map must be allocated for its entire size, not just the part that - is the responsibility of the caller. */ - needed += reg_parm_stack_space; -#endif - -#ifdef ARGS_GROW_DOWNWARD - highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, - needed + 1); -#else - highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, - needed); -#endif - stack_usage_map = (char *) alloca (highest_outgoing_arg_in_use); - - if (initial_highest_arg_in_use) - bcopy (initial_stack_usage_map, stack_usage_map, - initial_highest_arg_in_use); - - if (initial_highest_arg_in_use != highest_outgoing_arg_in_use) - bzero (&stack_usage_map[initial_highest_arg_in_use], - highest_outgoing_arg_in_use - initial_highest_arg_in_use); - needed = 0; - - /* The address of the outgoing argument list must not be copied to a - register here, because argblock would be left pointing to the - wrong place after the call to allocate_dynamic_stack_space below. - */ - - argblock = virtual_outgoing_args_rtx; -#else /* not ACCUMULATE_OUTGOING_ARGS */ -#ifndef PUSH_ROUNDING - argblock = push_block (GEN_INT (args_size.constant), 0, 0); -#endif -#endif - -#ifdef PUSH_ARGS_REVERSED -#ifdef PREFERRED_STACK_BOUNDARY - /* If we push args individually in reverse order, perform stack alignment - before the first push (the last arg). */ - if (argblock == 0) - anti_adjust_stack (GEN_INT (args_size.constant - - original_args_size.constant)); -#endif -#endif - -#ifdef PUSH_ARGS_REVERSED - inc = -1; - argnum = nargs - 1; -#else - inc = 1; - argnum = 0; -#endif - -#if defined(ACCUMULATE_OUTGOING_ARGS) && defined(REG_PARM_STACK_SPACE) - /* The argument list is the property of the called routine and it - may clobber it. If the fixed area has been used for previous - parameters, we must save and restore it. - - Here we compute the boundary of the that needs to be saved, if any. */ - -#ifdef ARGS_GROW_DOWNWARD - for (count = 0; count < reg_parm_stack_space + 1; count++) -#else - for (count = 0; count < reg_parm_stack_space; count++) -#endif - { - if (count >= highest_outgoing_arg_in_use - || stack_usage_map[count] == 0) - continue; - - if (low_to_save == -1) - low_to_save = count; - - high_to_save = count; - } - - if (low_to_save >= 0) - { - int num_to_save = high_to_save - low_to_save + 1; - enum machine_mode save_mode - = mode_for_size (num_to_save * BITS_PER_UNIT, MODE_INT, 1); - rtx stack_area; - - /* If we don't have the required alignment, must do this in BLKmode. */ - if ((low_to_save & (MIN (GET_MODE_SIZE (save_mode), - BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1))) - save_mode = BLKmode; - -#ifdef ARGS_GROW_DOWNWARD - stack_area = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - - high_to_save))); -#else - stack_area = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - low_to_save))); -#endif - if (save_mode == BLKmode) - { - save_area = assign_stack_temp (BLKmode, num_to_save, 0); - emit_block_move (validize_mem (save_area), stack_area, - GEN_INT (num_to_save), - PARM_BOUNDARY / BITS_PER_UNIT); - } - else - { - save_area = gen_reg_rtx (save_mode); - emit_move_insn (save_area, stack_area); - } - } -#endif - - /* Push the args that need to be pushed. */ - - /* ARGNUM indexes the ARGVEC array in the order in which the arguments - are to be pushed. */ - for (count = 0; count < nargs; count++, argnum += inc) - { - register enum machine_mode mode = argvec[argnum].mode; - register rtx val = argvec[argnum].value; - rtx reg = argvec[argnum].reg; - int partial = argvec[argnum].partial; -#ifdef ACCUMULATE_OUTGOING_ARGS - int lower_bound, upper_bound, i; -#endif - - if (! (reg != 0 && partial == 0)) - { -#ifdef ACCUMULATE_OUTGOING_ARGS - /* If this is being stored into a pre-allocated, fixed-size, stack - area, save any previous data at that location. */ - -#ifdef ARGS_GROW_DOWNWARD - /* stack_slot is negative, but we want to index stack_usage_map - with positive values. */ - upper_bound = -argvec[argnum].offset.constant + 1; - lower_bound = upper_bound - argvec[argnum].size.constant; -#else - lower_bound = argvec[argnum].offset.constant; - upper_bound = lower_bound + argvec[argnum].size.constant; -#endif - - for (i = lower_bound; i < upper_bound; i++) - if (stack_usage_map[i] - /* Don't store things in the fixed argument area at this point; - it has already been saved. */ - && i > reg_parm_stack_space) - break; - - if (i != upper_bound) - { - /* We need to make a save area. See what mode we can make it. */ - enum machine_mode save_mode - = mode_for_size (argvec[argnum].size.constant * BITS_PER_UNIT, - MODE_INT, 1); - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - argvec[argnum].offset.constant))); - argvec[argnum].save_area = gen_reg_rtx (save_mode); - emit_move_insn (argvec[argnum].save_area, stack_area); - } -#endif - emit_push_insn (val, mode, NULL_TREE, NULL_RTX, 0, partial, reg, 0, - argblock, GEN_INT (argvec[argnum].offset.constant), - reg_parm_stack_space); - -#ifdef ACCUMULATE_OUTGOING_ARGS - /* Now mark the segment we just used. */ - for (i = lower_bound; i < upper_bound; i++) - stack_usage_map[i] = 1; -#endif - - NO_DEFER_POP; - } - } - -#ifndef PUSH_ARGS_REVERSED -#ifdef PREFERRED_STACK_BOUNDARY - /* If we pushed args in forward order, perform stack alignment - after pushing the last arg. */ - if (argblock == 0) - anti_adjust_stack (GEN_INT (args_size.constant - - original_args_size.constant)); -#endif -#endif - -#ifdef PUSH_ARGS_REVERSED - argnum = nargs - 1; -#else - argnum = 0; -#endif - - fun = prepare_call_address (fun, NULL_TREE, &call_fusage, 0); - - /* Now load any reg parms into their regs. */ - - /* ARGNUM indexes the ARGVEC array in the order in which the arguments - are to be pushed. */ - for (count = 0; count < nargs; count++, argnum += inc) - { - register rtx val = argvec[argnum].value; - rtx reg = argvec[argnum].reg; - int partial = argvec[argnum].partial; - - if (reg != 0 && partial == 0) - emit_move_insn (reg, val); - NO_DEFER_POP; - } - -#if 0 - /* For version 1.37, try deleting this entirely. */ - if (! no_queue) - emit_queue (); -#endif - - /* Any regs containing parms remain in use through the call. */ - for (count = 0; count < nargs; count++) - if (argvec[count].reg != 0) - use_reg (&call_fusage, argvec[count].reg); - - /* Pass the function the address in which to return a structure value. */ - if (mem_value != 0 && struct_value_rtx != 0 && ! pcc_struct_value) - { - emit_move_insn (struct_value_rtx, - force_reg (Pmode, - force_operand (XEXP (mem_value, 0), - NULL_RTX))); - if (GET_CODE (struct_value_rtx) == REG) - use_reg (&call_fusage, struct_value_rtx); - } - - /* Don't allow popping to be deferred, since then - cse'ing of library calls could delete a call and leave the pop. */ - NO_DEFER_POP; - - /* We pass the old value of inhibit_defer_pop + 1 to emit_call_1, which - will set inhibit_defer_pop to that value. */ - /* See the comment in emit_library_call about the function type we build - and pass here. */ - - emit_call_1 (fun, - get_identifier (XSTR (orgfun, 0)), - build_function_type (type_for_mode (outmode, 0), NULL_TREE), - original_args_size.constant, args_size.constant, - struct_value_size, - FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1), - mem_value == 0 ? hard_libcall_value (outmode) : NULL_RTX, - old_inhibit_defer_pop + 1, call_fusage, is_const); - - /* Now restore inhibit_defer_pop to its actual original value. */ - OK_DEFER_POP; - - pop_temp_slots (); - - /* Copy the value to the right place. */ - if (outmode != VOIDmode) - { - if (mem_value) - { - if (value == 0) - value = mem_value; - if (value != mem_value) - emit_move_insn (value, mem_value); - } - else if (value != 0) - emit_move_insn (value, hard_libcall_value (outmode)); - else - value = hard_libcall_value (outmode); - } - -#ifdef ACCUMULATE_OUTGOING_ARGS -#ifdef REG_PARM_STACK_SPACE - if (save_area) - { - enum machine_mode save_mode = GET_MODE (save_area); -#ifdef ARGS_GROW_DOWNWARD - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, - - high_to_save))); -#else - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - plus_constant (argblock, low_to_save))); -#endif - if (save_mode != BLKmode) - emit_move_insn (stack_area, save_area); - else - emit_block_move (stack_area, validize_mem (save_area), - GEN_INT (high_to_save - low_to_save + 1), - PARM_BOUNDARY / BITS_PER_UNIT); - } -#endif - - /* If we saved any argument areas, restore them. */ - for (count = 0; count < nargs; count++) - if (argvec[count].save_area) - { - enum machine_mode save_mode = GET_MODE (argvec[count].save_area); - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, plus_constant (argblock, - argvec[count].offset.constant))); - - emit_move_insn (stack_area, argvec[count].save_area); - } - - highest_outgoing_arg_in_use = initial_highest_arg_in_use; - stack_usage_map = initial_stack_usage_map; -#endif - - return value; -} - -#if 0 -/* Return an rtx which represents a suitable home on the stack - given TYPE, the type of the argument looking for a home. - This is called only for BLKmode arguments. - - SIZE is the size needed for this target. - ARGS_ADDR is the address of the bottom of the argument block for this call. - OFFSET describes this parameter's offset into ARGS_ADDR. It is meaningless - if this machine uses push insns. */ - -static rtx -target_for_arg (type, size, args_addr, offset) - tree type; - rtx size; - rtx args_addr; - struct args_size offset; -{ - rtx target; - rtx offset_rtx = ARGS_SIZE_RTX (offset); - - /* We do not call memory_address if possible, - because we want to address as close to the stack - as possible. For non-variable sized arguments, - this will be stack-pointer relative addressing. */ - if (GET_CODE (offset_rtx) == CONST_INT) - target = plus_constant (args_addr, INTVAL (offset_rtx)); - else - { - /* I have no idea how to guarantee that this - will work in the presence of register parameters. */ - target = gen_rtx_PLUS (Pmode, args_addr, offset_rtx); - target = memory_address (QImode, target); - } - - return gen_rtx_MEM (BLKmode, target); -} -#endif - -/* Store a single argument for a function call - into the register or memory area where it must be passed. - *ARG describes the argument value and where to pass it. - - ARGBLOCK is the address of the stack-block for all the arguments, - or 0 on a machine where arguments are pushed individually. - - MAY_BE_ALLOCA nonzero says this could be a call to `alloca' - so must be careful about how the stack is used. - - VARIABLE_SIZE nonzero says that this was a variable-sized outgoing - argument stack. This is used if ACCUMULATE_OUTGOING_ARGS to indicate - that we need not worry about saving and restoring the stack. - - FNDECL is the declaration of the function we are calling. */ - -static void -store_one_arg (arg, argblock, may_be_alloca, variable_size, - reg_parm_stack_space) - struct arg_data *arg; - rtx argblock; - int may_be_alloca; - int variable_size ATTRIBUTE_UNUSED; - int reg_parm_stack_space; -{ - register tree pval = arg->tree_value; - rtx reg = 0; - int partial = 0; - int used = 0; -#ifdef ACCUMULATE_OUTGOING_ARGS - int i, lower_bound, upper_bound; -#endif - - if (TREE_CODE (pval) == ERROR_MARK) - return; - - /* Push a new temporary level for any temporaries we make for - this argument. */ - push_temp_slots (); - -#ifdef ACCUMULATE_OUTGOING_ARGS - /* If this is being stored into a pre-allocated, fixed-size, stack area, - save any previous data at that location. */ - if (argblock && ! variable_size && arg->stack) - { -#ifdef ARGS_GROW_DOWNWARD - /* stack_slot is negative, but we want to index stack_usage_map - with positive values. */ - if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS) - upper_bound = -INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)) + 1; - else - upper_bound = 0; - - lower_bound = upper_bound - arg->size.constant; -#else - if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS) - lower_bound = INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)); - else - lower_bound = 0; - - upper_bound = lower_bound + arg->size.constant; -#endif - - for (i = lower_bound; i < upper_bound; i++) - if (stack_usage_map[i] - /* Don't store things in the fixed argument area at this point; - it has already been saved. */ - && i > reg_parm_stack_space) - break; - - if (i != upper_bound) - { - /* We need to make a save area. See what mode we can make it. */ - enum machine_mode save_mode - = mode_for_size (arg->size.constant * BITS_PER_UNIT, MODE_INT, 1); - rtx stack_area - = gen_rtx_MEM (save_mode, - memory_address (save_mode, - XEXP (arg->stack_slot, 0))); - - if (save_mode == BLKmode) - { - arg->save_area = assign_stack_temp (BLKmode, - arg->size.constant, 0); - MEM_SET_IN_STRUCT_P (arg->save_area, - AGGREGATE_TYPE_P (TREE_TYPE - (arg->tree_value))); - preserve_temp_slots (arg->save_area); - emit_block_move (validize_mem (arg->save_area), stack_area, - GEN_INT (arg->size.constant), - PARM_BOUNDARY / BITS_PER_UNIT); - } - else - { - arg->save_area = gen_reg_rtx (save_mode); - emit_move_insn (arg->save_area, stack_area); - } - } - } - - /* Now that we have saved any slots that will be overwritten by this - store, mark all slots this store will use. We must do this before - we actually expand the argument since the expansion itself may - trigger library calls which might need to use the same stack slot. */ - if (argblock && ! variable_size && arg->stack) - for (i = lower_bound; i < upper_bound; i++) - stack_usage_map[i] = 1; -#endif - - /* If this isn't going to be placed on both the stack and in registers, - set up the register and number of words. */ - if (! arg->pass_on_stack) - reg = arg->reg, partial = arg->partial; - - if (reg != 0 && partial == 0) - /* Being passed entirely in a register. We shouldn't be called in - this case. */ - abort (); - - /* If this arg needs special alignment, don't load the registers - here. */ - if (arg->n_aligned_regs != 0) - reg = 0; - - /* If this is being passed partially in a register, we can't evaluate - it directly into its stack slot. Otherwise, we can. */ - if (arg->value == 0) - { -#ifdef ACCUMULATE_OUTGOING_ARGS - /* stack_arg_under_construction is nonzero if a function argument is - being evaluated directly into the outgoing argument list and - expand_call must take special action to preserve the argument list - if it is called recursively. - - For scalar function arguments stack_usage_map is sufficient to - determine which stack slots must be saved and restored. Scalar - arguments in general have pass_on_stack == 0. - - If this argument is initialized by a function which takes the - address of the argument (a C++ constructor or a C function - returning a BLKmode structure), then stack_usage_map is - insufficient and expand_call must push the stack around the - function call. Such arguments have pass_on_stack == 1. - - Note that it is always safe to set stack_arg_under_construction, - but this generates suboptimal code if set when not needed. */ - - if (arg->pass_on_stack) - stack_arg_under_construction++; -#endif - arg->value = expand_expr (pval, - (partial - || TYPE_MODE (TREE_TYPE (pval)) != arg->mode) - ? NULL_RTX : arg->stack, - VOIDmode, 0); - - /* If we are promoting object (or for any other reason) the mode - doesn't agree, convert the mode. */ - - if (arg->mode != TYPE_MODE (TREE_TYPE (pval))) - arg->value = convert_modes (arg->mode, TYPE_MODE (TREE_TYPE (pval)), - arg->value, arg->unsignedp); - -#ifdef ACCUMULATE_OUTGOING_ARGS - if (arg->pass_on_stack) - stack_arg_under_construction--; -#endif - } - - /* Don't allow anything left on stack from computation - of argument to alloca. */ - if (may_be_alloca) - do_pending_stack_adjust (); - - if (arg->value == arg->stack) - { - /* If the value is already in the stack slot, we are done moving - data. */ - if (current_function_check_memory_usage && GET_CODE (arg->stack) == MEM) - { - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, - XEXP (arg->stack, 0), Pmode, - ARGS_SIZE_RTX (arg->size), - TYPE_MODE (sizetype), - GEN_INT (MEMORY_USE_RW), - TYPE_MODE (integer_type_node)); - } - } - else if (arg->mode != BLKmode) - { - register int size; - - /* Argument is a scalar, not entirely passed in registers. - (If part is passed in registers, arg->partial says how much - and emit_push_insn will take care of putting it there.) - - Push it, and if its size is less than the - amount of space allocated to it, - also bump stack pointer by the additional space. - Note that in C the default argument promotions - will prevent such mismatches. */ - - size = GET_MODE_SIZE (arg->mode); - /* Compute how much space the push instruction will push. - On many machines, pushing a byte will advance the stack - pointer by a halfword. */ -#ifdef PUSH_ROUNDING - size = PUSH_ROUNDING (size); -#endif - used = size; - - /* Compute how much space the argument should get: - round up to a multiple of the alignment for arguments. */ - if (none != FUNCTION_ARG_PADDING (arg->mode, TREE_TYPE (pval))) - used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1) - / (PARM_BOUNDARY / BITS_PER_UNIT)) - * (PARM_BOUNDARY / BITS_PER_UNIT)); - - /* This isn't already where we want it on the stack, so put it there. - This can either be done with push or copy insns. */ - emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), NULL_RTX, 0, - partial, reg, used - size, argblock, - ARGS_SIZE_RTX (arg->offset), reg_parm_stack_space); - } - else - { - /* BLKmode, at least partly to be pushed. */ - - register int excess; - rtx size_rtx; - - /* Pushing a nonscalar. - If part is passed in registers, PARTIAL says how much - and emit_push_insn will take care of putting it there. */ - - /* Round its size up to a multiple - of the allocation unit for arguments. */ - - if (arg->size.var != 0) - { - excess = 0; - size_rtx = ARGS_SIZE_RTX (arg->size); - } - else - { - /* PUSH_ROUNDING has no effect on us, because - emit_push_insn for BLKmode is careful to avoid it. */ - excess = (arg->size.constant - int_size_in_bytes (TREE_TYPE (pval)) - + partial * UNITS_PER_WORD); - size_rtx = expr_size (pval); - } - - emit_push_insn (arg->value, arg->mode, TREE_TYPE (pval), size_rtx, - TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT, partial, - reg, excess, argblock, ARGS_SIZE_RTX (arg->offset), - reg_parm_stack_space); - } - - - /* Unless this is a partially-in-register argument, the argument is now - in the stack. - - ??? Note that this can change arg->value from arg->stack to - arg->stack_slot and it matters when they are not the same. - It isn't totally clear that this is correct in all cases. */ - if (partial == 0) - arg->value = arg->stack_slot; - - /* Once we have pushed something, pops can't safely - be deferred during the rest of the arguments. */ - NO_DEFER_POP; - - /* ANSI doesn't require a sequence point here, - but PCC has one, so this will avoid some problems. */ - emit_queue (); - - /* Free any temporary slots made in processing this argument. Show - that we might have taken the address of something and pushed that - as an operand. */ - preserve_temp_slots (NULL_RTX); - free_temp_slots (); - pop_temp_slots (); -} diff --git a/contrib/gcc/cccp.1 b/contrib/gcc/cccp.1 deleted file mode 100644 index 84eb19ede54e..000000000000 --- a/contrib/gcc/cccp.1 +++ /dev/null @@ -1,674 +0,0 @@ -.\" Copyright (c) 1991, 1992, 1993 Free Software Foundation \-*-Text-*- -.\" See section COPYING for conditions for redistribution -.TH cpp 1 "30apr1993" "GNU Tools" "GNU Tools" -.SH NAME -cccp, cpp \- The GNU C-Compatible Compiler Preprocessor. -.SH SYNOPSIS -.hy 0 -.na -.TP -.B cccp -.RB "[\|" \-$ "\|]" -.RB "[\|" \-A \c -.I predicate\c -.RB [ (\c -.I value\c -.BR ) ]\|] -.RB "[\|" \-C "\|]" -.RB "[\|" \-D \c -.I name\c -.RB [ =\c -.I definition\c -\&]\|] -.RB "[\|" \-dD "\|]" -.RB "[\|" \-dM "\|]" -.RB "[\|" "\-I\ "\c -.I directory\c -\&\|] -.RB "[\|" \-H "\|]" -.RB "[\|" \-I\- "\|]" -.RB "[\|" "\-imacros\ "\c -.I file\c -\&\|] -.RB "[\|" "\-include\ "\c -.I file\c -\&\|] -.RB "[\|" "\-idirafter\ "\c -.I dir\c -\&\|] -.RB "[\|" "\-iprefix\ "\c -.I prefix\c -\&\|] -.RB "[\|" "\-iwithprefix\ "\c -.I dir\c -\&\|] -.RB "[\|" \-lang\-c "\|]" -.RB "[\|" \-lang\-c++ "\|]" -.RB "[\|" \-lang\-objc "\|]" -.RB "[\|" \-lang\-objc++ "\|]" -.RB "[\|" \-lint "\|]" -.RB "[\|" \-M\ [ \-MG "\|]]" -.RB "[\|" \-MM\ [ \-MG "\|]]" -.RB "[\|" \-MD\ \c -.I file\ \c -\&\|] -.RB "[\|" \-MMD\ \c -.I file\ \c -\&\|] -.RB "[\|" \-nostdinc "\|]" -.RB "[\|" \-nostdinc++ "\|]" -.RB "[\|" \-P "\|]" -.RB "[\|" \-pedantic "\|]" -.RB "[\|" \-pedantic\-errors "\|]" -.RB "[\|" \-traditional "\|]" -.RB "[\|" \-trigraphs "\|]" -.RB "[\|" \-U \c -.I name\c -\&\|] -.RB "[\|" \-undef "\|]" -.RB "[\|" \-Wtrigraphs "\|]" -.RB "[\|" \-Wcomment "\|]" -.RB "[\|" \-Wall "\|]" -.RB "[\|" \-Wtraditional "\|]" -.br -.RB "[\|" \c -.I infile\c -.RB | \- "\|]" -.RB "[\|" \c -.I outfile\c -.RB | \- "\|]" -.ad b -.hy 1 -.SH DESCRIPTION -The C preprocessor is a \c -.I macro processor\c -\& that is used automatically by -the C compiler to transform your program before actual compilation. It is -called a macro processor because it allows you to define \c -.I macros\c -\&, -which are brief abbreviations for longer constructs. - -The C preprocessor provides four separate facilities that you can use as -you see fit: -.TP -\(bu -Inclusion of header files. These are files of declarations that can be -substituted into your program. -.TP -\(bu -Macro expansion. You can define \c -.I macros\c -\&, which are abbreviations -for arbitrary fragments of C code, and then the C preprocessor will -replace the macros with their definitions throughout the program. -.TP -\(bu -Conditional compilation. Using special preprocessing directives, you -can include or exclude parts of the program according to various -conditions. -.TP -\(bu -Line control. If you use a program to combine or rearrange source files into -an intermediate file which is then compiled, you can use line control -to inform the compiler of where each source line originally came from. -.PP -C preprocessors vary in some details. For a full explanation of the -GNU C preprocessor, see the -.B info -file `\|\c -.B cpp.info\c -\&\|', or the manual -.I The C Preprocessor\c -\&. Both of these are built from the same documentation source file, `\|\c -.B cpp.texinfo\c -\&\|'. The GNU C -preprocessor provides a superset of the features of ANSI Standard C. - -ANSI Standard C requires the rejection of many harmless constructs commonly -used by today's C programs. Such incompatibility would be inconvenient for -users, so the GNU C preprocessor is configured to accept these constructs -by default. Strictly speaking, to get ANSI Standard C, you must use the -options `\|\c -.B \-trigraphs\c -\&\|', `\|\c -.B \-undef\c -\&\|' and `\|\c -.B \-pedantic\c -\&\|', but in -practice the consequences of having strict ANSI Standard C make it -undesirable to do this. - -Most often when you use the C preprocessor you will not have to invoke it -explicitly: the C compiler will do so automatically. However, the -preprocessor is sometimes useful individually. - -When you call the preprocessor individually, either name -(\c -.B cpp\c -\& or \c -.B cccp\c -\&) will do\(em\&they are completely synonymous. - -The C preprocessor expects two file names as arguments, \c -.I infile\c -\& and -\c -.I outfile\c -\&. The preprocessor reads \c -.I infile\c -\& together with any other -files it specifies with `\|\c -.B #include\c -\&\|'. All the output generated by the -combined input files is written in \c -.I outfile\c -\&. - -Either \c -.I infile\c -\& or \c -.I outfile\c -\& may be `\|\c -.B \-\c -\&\|', which as \c -.I infile\c -\& -means to read from standard input and as \c -.I outfile\c -\& means to write to -standard output. Also, if \c -.I outfile\c -\& or both file names are omitted, -the standard output and standard input are used for the omitted file names. -.SH OPTIONS -Here is a table of command options accepted by the C preprocessor. -These options can also be given when compiling a C program; they are -passed along automatically to the preprocessor when it is invoked by -the compiler. -.TP -.B \-P -Inhibit generation of `\|\c -.B #\c -\&\|'-lines with line-number information in -the output from the preprocessor. This might be -useful when running the preprocessor on something that is not C code -and will be sent to a program which might be confused by the -`\|\c -.B #\c -\&\|'-lines. -.TP -.B \-C -Do not discard comments: pass them through to the output file. -Comments appearing in arguments of a macro call will be copied to the -output before the expansion of the macro call. -.TP -.B \-traditional -Try to imitate the behavior of old-fashioned C, as opposed to ANSI C. -.TP -.B \-trigraphs -Process ANSI standard trigraph sequences. These are three-character -sequences, all starting with `\|\c -.B ??\c -\&\|', that are defined by ANSI C to -stand for single characters. For example, `\|\c -.B ??/\c -\&\|' stands for -`\|\c -.BR "\e" "\|'," -so `\|\c -.B '??/n'\c -\&\|' is a character constant for a newline. -Strictly speaking, the GNU C preprocessor does not support all -programs in ANSI Standard C unless `\|\c -.B \-trigraphs\c -\&\|' is used, but if -you ever notice the difference it will be with relief. - -You don't want to know any more about trigraphs. -.TP -.B \-pedantic -Issue warnings required by the ANSI C standard in certain cases such -as when text other than a comment follows `\|\c -.B #else\c -\&\|' or `\|\c -.B #endif\c -\&\|'. -.TP -.B \-pedantic\-errors -Like `\|\c -.B \-pedantic\c -\&\|', except that errors are produced rather than -warnings. -.TP -.B \-Wtrigraphs -Warn if any trigraphs are encountered (assuming they are enabled). -.TP -.B \-Wcomment -.TP -.B \-Wcomments -Warn whenever a comment-start sequence `\|\c -.B /*\c -\&\|' appears in a comment. -(Both forms have the same effect). -.TP -.B \-Wall -Requests both `\|\c -.B \-Wtrigraphs\c -\&\|' and `\|\c -.B \-Wcomment\c -\&\|' (but not -`\|\c -.B \-Wtraditional\c -\&\|'). -.TP -.B \-Wtraditional -Warn about certain constructs that behave differently in traditional and -ANSI C. -.TP -.BI "\-I " directory\c -\& -Add the directory \c -.I directory\c -\& to the end of the list of -directories to be searched for header files. -This can be used to override a system header file, substituting your -own version, since these directories are searched before the system -header file directories. If you use more than one `\|\c -.B \-I\c -\&\|' option, -the directories are scanned in left-to-right order; the standard -system directories come after. -.TP -.B \-I\- -Any directories specified with `\|\c -.B \-I\c -\&\|' options before the `\|\c -.B \-I\-\c -\&\|' -option are searched only for the case of `\|\c -.B #include "\c -.I file\c -\&"\c -\&\|'; -they are not searched for `\|\c -.B #include <\c -.I file\c -\&>\c -\&\|'. - -If additional directories are specified with `\|\c -.B \-I\c -\&\|' options after -the `\|\c -.B \-I\-\c -\&\|', these directories are searched for all `\|\c -.B #include\c -\&\|' -directives. - -In addition, the `\|\c -.B \-I\-\c -\&\|' option inhibits the use of the current -directory as the first search directory for `\|\c -.B #include "\c -.I file\c -\&"\c -\&\|'. -Therefore, the current directory is searched only if it is requested -explicitly with `\|\c -.B \-I.\c -\&\|'. Specifying both `\|\c -.B \-I\-\c -\&\|' and `\|\c -.B \-I.\c -\&\|' -allows you to control precisely which directories are searched before -the current one and which are searched after. -.TP -.B \-nostdinc -Do not search the standard system directories for header files. -Only the directories you have specified with `\|\c -.B \-I\c -\&\|' options -(and the current directory, if appropriate) are searched. -.TP -.B \-nostdinc++ -Do not search for header files in the C++ specific standard -directories, but do still search the other standard directories. -(This option is used when building libg++.) -.TP -.BI "\-D " "name"\c -\& -Predefine \c -.I name\c -\& as a macro, with definition `\|\c -.B 1\c -\&\|'. -.TP -.BI "\-D " "name" = definition -\& -Predefine \c -.I name\c -\& as a macro, with definition \c -.I definition\c -\&. -There are no restrictions on the contents of \c -.I definition\c -\&, but if -you are invoking the preprocessor from a shell or shell-like program -you may need to use the shell's quoting syntax to protect characters -such as spaces that have a meaning in the shell syntax. If you use more than -one `\|\c -.B \-D\c -\&\|' for the same -.I name\c -\&, the rightmost definition takes effect. -.TP -.BI "\-U " "name"\c -\& -Do not predefine \c -.I name\c -\&. If both `\|\c -.B \-U\c -\&\|' and `\|\c -.B \-D\c -\&\|' are -specified for one name, the `\|\c -.B \-U\c -\&\|' beats the `\|\c -.B \-D\c -\&\|' and the name -is not predefined. -.TP -.B \-undef -Do not predefine any nonstandard macros. -.TP -.BI "\-A " "name(" value ) -Assert (in the same way as the \c -.B #assert\c -\& directive) -the predicate \c -.I name\c -\& with tokenlist \c -.I value\c -\&. Remember to escape or quote the parentheses on -shell command lines. - -You can use `\|\c -.B \-A-\c -\&\|' to disable all predefined assertions; it also -undefines all predefined macros. -.TP -.B \-dM -Instead of outputting the result of preprocessing, output a list of -`\|\c -.B #define\c -\&\|' directives for all the macros defined during the -execution of the preprocessor, including predefined macros. This gives -you a way of finding out what is predefined in your version of the -preprocessor; assuming you have no file `\|\c -.B foo.h\c -\&\|', the command -.sp -.br -touch\ foo.h;\ cpp\ \-dM\ foo.h -.br -.sp -will show the values of any predefined macros. -.TP -.B \-dD -Like `\|\c -.B \-dM\c -\&\|' except in two respects: it does \c -.I not\c -\& include the -predefined macros, and it outputs \c -.I both\c -\& the `\|\c -.B #define\c -\&\|' -directives and the result of preprocessing. Both kinds of output go to -the standard output file. -.PP -.TP -.BR \-M\ [ \-MG ] -Instead of outputting the result of preprocessing, output a rule -suitable for \c -.B make\c -\& describing the dependencies of the main -source file. The preprocessor outputs one \c -.B make\c -\& rule containing -the object file name for that source file, a colon, and the names of -all the included files. If there are many included files then the -rule is split into several lines using `\|\c -.B \\\\\c -\&\|'-newline. - -`\|\c -.B \-MG\c -\&\|' says to treat missing header files as generated files and assume \c -they live in the same directory as the source file. It must be specified \c -in addition to `\|\c -.B \-M\c -\&\|'. - -This feature is used in automatic updating of makefiles. -.TP -.BR \-MM\ [ \-MG ] -Like `\|\c -.B \-M\c -\&\|' but mention only the files included with `\|\c -.B #include -"\c -.I file\c -\&"\c -\&\|'. System header files included with `\|\c -.B #include -<\c -.I file\c -\&>\c -\&\|' are omitted. -.TP -.BI \-MD\ file -Like `\|\c -.B \-M\c -\&\|' but the dependency information is written to `\|\c -.I file\c -\&\|'. This is in addition to compiling the file as -specified\(em\&`\|\c -.B \-MD\c -\&\|' does not inhibit ordinary compilation the way -`\|\c -.B \-M\c -\&\|' does. - -When invoking gcc, do not specify the `\|\c -.I file\c -\&\|' argument. Gcc will create file names made by replacing `\|\c -.B .c\c -\&\|' with `\|\c -.B .d\c -\&\|' at the end of the input file names. - -In Mach, you can use the utility \c -.B md\c -\& to merge multiple files -into a single dependency file suitable for using with the `\|\c -.B make\c -\&\|' -command. -.TP -.BI \-MMD\ file -Like `\|\c -.B \-MD\c -\&\|' except mention only user header files, not system -header files. -.TP -.B \-H -Print the name of each header file used, in addition to other normal -activities. -.TP -.BI "\-imacros " "file"\c -\& -Process \c -.I file\c -\& as input, discarding the resulting output, before -processing the regular input file. Because the output generated from -\c -.I file\c -\& is discarded, the only effect of `\|\c -.B \-imacros \c -.I file\c -\&\c -\&\|' is to -make the macros defined in \c -.I file\c -\& available for use in the main -input. The preprocessor evaluates any `\|\c -.B \-D\c -\&\|' and `\|\c -.B \-U\c -\&\|' options -on the command line before processing `\|\c -.B \-imacros \c -.I file\c -\&\|' \c -\&. -.TP -.BI "\-include " "file" -Process -.I file -as input, and include all the resulting output, -before processing the regular input file. -.TP -.BI "-idirafter " "dir"\c -\& -Add the directory \c -.I dir\c -\& to the second include path. The directories -on the second include path are searched when a header file is not found -in any of the directories in the main include path (the one that -`\|\c -.B \-I\c -\&\|' adds to). -.TP -.BI "-iprefix " "prefix"\c -\& -Specify \c -.I prefix\c -\& as the prefix for subsequent `\|\c -.B \-iwithprefix\c -\&\|' -options. -.TP -.BI "-iwithprefix " "dir"\c -\& -Add a directory to the second include path. The directory's name is -made by concatenating \c -.I prefix\c -\& and \c -.I dir\c -\&, where \c -.I prefix\c -\& -was specified previously with `\|\c -.B \-iprefix\c -\&\|'. -.TP -.B \-lang-c -.TP -.B \-lang-c++ -.TP -.B \-lang-objc -.TP -.B \-lang-objc++ -Specify the source language. `\|\c -.B \-lang-c++\c -\&\|' makes the preprocessor -handle C++ comment syntax, and includes extra default include -directories for C++, and `\|\c -.B \-lang-objc\c -\&\|' enables the Objective C -`\|\c -.B #import\c -\&\|' directive. `\|\c -.B \-lang-c\c -\&\|' explicitly turns off both of -these extensions, and `\|\c -.B \-lang-objc++\c -\&\|' enables both. - -These options are generated by the compiler driver \c -.B gcc\c -\&, but not -passed from the `\|\c -.B gcc\c -\&\|' command line. -.TP -.B \-lint -Look for commands to the program checker \c -.B lint\c -\& embedded in -comments, and emit them preceded by `\|\c -.B #pragma lint\c -\&\|'. For example, -the comment `\|\c -.B /* NOTREACHED */\c -\&\|' becomes `\|\c -.B #pragma lint -NOTREACHED\c -\&\|'. - -This option is available only when you call \c -.B cpp\c -\& directly; -\c -.B gcc\c -\& will not pass it from its command line. -.TP -.B \-$ -Forbid the use of `\|\c -.B $\c -\&\|' in identifiers. This was formerly required for strict conformance -to the C Standard before the standard was corrected. \c - -This option is available only when you call \c -.B cpp\c -\& directly; -.B gcc\c -\& will not pass it from its command line. -.SH "SEE ALSO" -.RB "`\|" Cpp "\|'" -entry in -.B info\c -\&; -.I The C Preprocessor\c -, Richard M. Stallman. -.br -.BR gcc "(" 1 ");" -.RB "`\|" Gcc "\|'" -entry in -.B info\c -\&; -.I -Using and Porting GNU CC (for version 2.0)\c -, Richard M. Stallman. -.SH COPYING -Copyright (c) 1991, 1992, 1993 Free Software Foundation, Inc. -.PP -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. -.PP -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. -.PP -Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be included in -translations approved by the Free Software Foundation instead of in -the original English. diff --git a/contrib/gcc/cccp.c b/contrib/gcc/cccp.c deleted file mode 100644 index 83f4dff56837..000000000000 --- a/contrib/gcc/cccp.c +++ /dev/null @@ -1,11135 +0,0 @@ -/* C Compatible Compiler Preprocessor (CCCP) - Copyright (C) 1986, 87, 89, 92-98, 1999 Free Software Foundation, Inc. - Written by Paul Rubin, June 1986 - Adapted to ANSI C, Richard Stallman, Jan 1987 - -This program 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. - -This program 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. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" - -#include "system.h" -#include - -#ifdef HAVE_SYS_RESOURCE_H -# include -#endif - -typedef unsigned char U_CHAR; - -#include "pcp.h" -#include "intl.h" -#include "prefix.h" - -#ifdef MULTIBYTE_CHARS -#include "mbchar.h" -#include -#endif /* MULTIBYTE_CHARS */ - -#ifndef GET_ENV_PATH_LIST -#define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0) -#endif - -#ifndef STANDARD_INCLUDE_DIR -# define STANDARD_INCLUDE_DIR "/usr/include" -#endif - -/* By default, colon separates directories in a path. */ -#ifndef PATH_SEPARATOR -# define PATH_SEPARATOR ':' -#endif - -/* By default, a slash separates directory names. */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -#endif - -/* By default, the suffix for object files is ".o". */ -#ifdef OBJECT_SUFFIX -# define HAVE_OBJECT_SUFFIX -#else -# define OBJECT_SUFFIX ".o" -#endif - -/* VMS-specific definitions */ -#ifdef VMS -#include -#include -#include -#define open(fname,mode,prot) VMS_open (fname,mode,prot) -#define fopen(fname,mode) VMS_fopen (fname,mode) -#define freopen(fname,mode,ofile) VMS_freopen (fname,mode,ofile) -#define fstat(fd,stbuf) VMS_fstat (fd,stbuf) -static int VMS_fstat (), VMS_stat (); -static int VMS_open (); -static FILE *VMS_fopen (); -static FILE *VMS_freopen (); -static int hack_vms_include_specification (); -#define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a))) -#define INO_T_HASH(a) 0 -#define INCLUDE_LEN_FUDGE 12 /* leave room for VMS syntax conversion */ -#endif /* VMS */ - -/* Windows does not natively support inodes, and neither does MSDOS. */ -#if (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN)) \ - || defined (__MSDOS__) -#define INO_T_EQ(a, b) 0 -#endif - -#ifndef INO_T_EQ -#define INO_T_EQ(a, b) ((a) == (b)) -#endif - -#ifndef INO_T_HASH -#define INO_T_HASH(a) (a) -#endif - -#ifndef INCLUDE_LEN_FUDGE -#define INCLUDE_LEN_FUDGE 0 -#endif - -/* External declarations. */ - -extern char *version_string; -HOST_WIDEST_INT parse_escape PROTO((char **, HOST_WIDEST_INT)); -HOST_WIDEST_INT parse_c_expression PROTO((char *, int)); - -/* Name under which this program was invoked. */ - -static char *progname; - -/* Nonzero means use extra default include directories for C++. */ - -static int cplusplus; - -/* Nonzero means handle cplusplus style comments */ - -static int cplusplus_comments; - -/* Nonzero means handle #import, for objective C. */ - -static int objc; - -/* Nonzero means this is an assembly file, and allow - unknown directives, which could be comments. */ - -static int lang_asm; - -/* Current maximum length of directory names in the search path - for include files. (Altered as we get more of them.) */ - -static int max_include_len; - -/* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */ - -static int for_lint = 0; - -/* Nonzero means copy comments into the output file. */ - -static int put_out_comments = 0; - -/* Nonzero means don't process the ANSI trigraph sequences. */ - -static int no_trigraphs = 0; - -/* Nonzero means print the names of included files rather than - the preprocessed output. 1 means just the #include "...", - 2 means #include <...> as well. */ - -static int print_deps = 0; - -/* Nonzero if missing .h files in -M output are assumed to be generated - files and not errors. */ - -static int print_deps_missing_files = 0; - -/* Nonzero means print names of header files (-H). */ - -static int print_include_names = 0; - -/* Nonzero means don't output line number information. */ - -static int no_line_directives; - -/* Nonzero means output the text in failing conditionals, - inside #failed ... #endfailed. */ - -static int output_conditionals; - -/* dump_only means inhibit output of the preprocessed text - and instead output the definitions of all user-defined - macros in a form suitable for use as input to cccp. - dump_names means pass #define and the macro name through to output. - dump_definitions means pass the whole definition (plus #define) through -*/ - -static enum {dump_none, dump_only, dump_names, dump_definitions} - dump_macros = dump_none; - -/* Nonzero means pass all #define and #undef directives which we actually - process through to the output stream. This feature is used primarily - to allow cc1 to record the #defines and #undefs for the sake of - debuggers which understand about preprocessor macros, but it may - also be useful with -E to figure out how symbols are defined, and - where they are defined. */ -static int debug_output = 0; - -/* Nonzero means pass #include lines through to the output, - even if they are ifdefed out. */ -static int dump_includes; - -/* Nonzero indicates special processing used by the pcp program. The - special effects of this mode are: - - Inhibit all macro expansion, except those inside #if directives. - - Process #define directives normally, and output their contents - to the output file. - - Output preconditions to pcp_outfile indicating all the relevant - preconditions for use of this file in a later cpp run. -*/ -static FILE *pcp_outfile; - -/* Nonzero means we are inside an IF during a -pcp run. In this mode - macro expansion is done, and preconditions are output for all macro - uses requiring them. */ -static int pcp_inside_if; - -/* Nonzero means never to include precompiled files. - This is 1 since there's no way now to make precompiled files, - so it's not worth testing for them. */ -static int no_precomp = 1; - -/* Nonzero means give all the error messages the ANSI standard requires. */ - -int pedantic; - -/* Nonzero means try to make failure to fit ANSI C an error. */ - -static int pedantic_errors; - -/* Nonzero means don't print warning messages. -w. */ - -static int inhibit_warnings = 0; - -/* Nonzero means warn if slash-star appears in a slash-star comment, - or if newline-backslash appears in a slash-slash comment. */ - -static int warn_comments; - -/* Nonzero means warn if a macro argument is (or would be) - stringified with -traditional. */ - -static int warn_stringify; - -/* Nonzero means warn if there are any trigraphs. */ - -static int warn_trigraphs; - -/* Nonzero means warn if undefined identifiers are evaluated in an #if. */ - -static int warn_undef; - -/* Nonzero means warn if #import is used. */ - -static int warn_import = 1; - -/* Nonzero means turn warnings into errors. */ - -static int warnings_are_errors; - -/* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */ - -int traditional; - -/* Nonzero for the 1989 C Standard, including corrigenda and amendments. */ - -int c89; - -/* Nonzero for the 199x C Standard. */ - -int c9x; - -/* Nonzero causes output not to be done, - but directives such as #define that have side effects - are still obeyed. */ - -static int no_output; - -/* Nonzero means we should look for header.gcc files that remap file names. */ -static int remap; - -/* Nonzero means this file was included with a -imacros or -include - command line and should not be recorded as an include file. */ - -static int no_record_file; - -/* Nonzero means that we have finished processing the command line options. - This flag is used to decide whether or not to issue certain errors - and/or warnings. */ - -static int done_initializing = 0; - -/* Line where a newline was first seen in a string constant. */ - -static int multiline_string_line = 0; - -/* I/O buffer structure. - The `fname' field is nonzero for source files and #include files - and for the dummy text used for -D and -U. - It is zero for rescanning results of macro expansion - and for expanding macro arguments. */ -#define INPUT_STACK_MAX 400 -static struct file_buf { - char *fname; - /* Filename specified with #line directive. */ - char *nominal_fname; - /* The length of nominal_fname, which may contain embedded NULs. */ - size_t nominal_fname_len; - /* Include file description. */ - struct include_file *inc; - /* Record where in the search path this file was found. - For #include_next. */ - struct file_name_list *dir; - int lineno; - int length; - U_CHAR *buf; - U_CHAR *bufp; - /* Macro that this level is the expansion of. - Included so that we can reenable the macro - at the end of this level. */ - struct hashnode *macro; - /* Value of if_stack at start of this file. - Used to prohibit unmatched #endif (etc) in an include file. */ - struct if_stack *if_stack; - /* Object to be freed at end of input at this level. */ - U_CHAR *free_ptr; - /* True if this is a system header file; see is_system_include. */ - char system_header_p; -} instack[INPUT_STACK_MAX]; - -static int last_error_tick; /* Incremented each time we print it. */ -static int input_file_stack_tick; /* Incremented when the status changes. */ - -/* Current nesting level of input sources. - `instack[indepth]' is the level currently being read. */ -static int indepth = -1; -#define CHECK_DEPTH(code) \ - if (indepth >= (INPUT_STACK_MAX - 1)) \ - { \ - error_with_line (line_for_error (instack[indepth].lineno), \ - "macro or `#include' recursion too deep"); \ - code; \ - } - -/* Current depth in #include directives that use <...>. */ -static int system_include_depth = 0; - -typedef struct file_buf FILE_BUF; - -/* The output buffer. Its LENGTH field is the amount of room allocated - for the buffer, not the number of chars actually present. To get - that, subtract outbuf.buf from outbuf.bufp. */ - -#define OUTBUF_SIZE 10 /* initial size of output buffer */ -static FILE_BUF outbuf; - -/* Grow output buffer OBUF points at - so it can hold at least NEEDED more chars. */ - -#define check_expand(OBUF, NEEDED) \ - (((OBUF)->length - ((OBUF)->bufp - (OBUF)->buf) <= (NEEDED)) \ - ? grow_outbuf ((OBUF), (NEEDED)) : 0) - -struct file_name_list - { - struct file_name_list *next; - /* If the following is 1, it is a C-language system include - directory. */ - int c_system_include_path; - /* Mapping of file names for this directory. */ - struct file_name_map *name_map; - /* Non-zero if name_map is valid. */ - int got_name_map; - /* The include directory status. */ - struct stat st; - /* The include prefix: "" denotes the working directory, - otherwise fname must end in '/'. - The actual size is dynamically allocated. */ - char fname[1]; - }; - -/* #include "file" looks in source file dir, then stack. */ -/* #include just looks in the stack. */ -/* -I directories are added to the end, then the defaults are added. */ -/* The */ -static struct default_include { - char *fname; /* The name of the directory. */ - char *component; /* The component containing the directory */ - int cplusplus; /* Only look here if we're compiling C++. */ - int cxx_aware; /* Includes in this directory don't need to - be wrapped in extern "C" when compiling - C++. */ - int included; /* Set if the directory is acceptable. */ -} include_defaults_array[] -#ifdef INCLUDE_DEFAULTS - = INCLUDE_DEFAULTS; -#else - = { - /* Pick up GNU C++ specific include files. */ - { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0 }, -#ifdef CROSS_COMPILE - /* This is the dir for fixincludes. Put it just before - the files that we fix. */ - { GCC_INCLUDE_DIR, "GCC", 0, 0, 0 }, - /* For cross-compilation, this dir name is generated - automatically in Makefile.in. */ - { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0 }, -#ifdef TOOL_INCLUDE_DIR - /* This is another place that the target system's headers might be. */ - { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0, 0 }, -#endif -#else /* not CROSS_COMPILE */ -#ifdef LOCAL_INCLUDE_DIR - /* This should be /usr/local/include and should come before - the fixincludes-fixed header files. */ - { LOCAL_INCLUDE_DIR, 0, 0, 1, 0 }, -#endif -#ifdef TOOL_INCLUDE_DIR - /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here. - Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */ - { TOOL_INCLUDE_DIR, "BINUTILS", 0, 0, 0 }, -#endif - /* This is the dir for fixincludes. Put it just before - the files that we fix. */ - { GCC_INCLUDE_DIR, "GCC", 0, 0, 0 }, - /* Some systems have an extra dir of include files. */ -#ifdef SYSTEM_INCLUDE_DIR - { SYSTEM_INCLUDE_DIR, 0, 0, 0, 0 }, -#endif -#ifndef STANDARD_INCLUDE_COMPONENT -#define STANDARD_INCLUDE_COMPONENT 0 -#endif - { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 0 }, -#endif /* not CROSS_COMPILE */ - { 0, 0, 0, 0, 0 } - }; -#endif /* no INCLUDE_DEFAULTS */ - -/* The code looks at the defaults through this pointer, rather than through - the constant structure above. This pointer gets changed if an environment - variable specifies other defaults. */ -static struct default_include *include_defaults = include_defaults_array; - -static struct file_name_list *include = 0; /* First dir to search */ - /* First dir to search for */ -/* This is the first element to use for #include <...>. - If it is 0, use the entire chain for such includes. */ -static struct file_name_list *first_bracket_include = 0; -/* This is the first element in the chain that corresponds to - a directory of system header files. */ -static struct file_name_list *first_system_include = 0; -static struct file_name_list *last_include = 0; /* Last in chain */ - -/* Chain of include directories to put at the end of the other chain. */ -static struct file_name_list *after_include = 0; -static struct file_name_list *last_after_include = 0; /* Last in chain */ - -/* Chain to put at the start of the system include files. */ -static struct file_name_list *before_system = 0; -static struct file_name_list *last_before_system = 0; /* Last in chain */ - -/* Directory prefix that should replace `/usr' in the standard - include file directories. */ -static char *include_prefix; - -/* Maintain and search list of included files. */ - -struct include_file { - struct include_file *next; /* for include_hashtab */ - struct include_file *next_ino; /* for include_ino_hashtab */ - char *fname; - /* If the following is the empty string, it means #pragma once - was seen in this include file, or #import was applied to the file. - Otherwise, if it is nonzero, it is a macro name. - Don't include the file again if that macro is defined. */ - U_CHAR *control_macro; - /* Nonzero if the dependency on this include file has been output. */ - int deps_output; - struct stat st; -}; - -/* Hash tables of files already included with #include or #import. - include_hashtab is by full name; include_ino_hashtab is by inode number. */ - -#define INCLUDE_HASHSIZE 61 -static struct include_file *include_hashtab[INCLUDE_HASHSIZE]; -static struct include_file *include_ino_hashtab[INCLUDE_HASHSIZE]; - -/* Global list of strings read in from precompiled files. This list - is kept in the order the strings are read in, with new strings being - added at the end through stringlist_tailp. We use this list to output - the strings at the end of the run. -*/ -static STRINGDEF *stringlist; -static STRINGDEF **stringlist_tailp = &stringlist; - - -/* Structure returned by create_definition */ -typedef struct macrodef MACRODEF; -struct macrodef -{ - struct definition *defn; - U_CHAR *symnam; - int symlen; -}; - -enum sharp_token_type { - NO_SHARP_TOKEN = 0, /* token not present */ - - SHARP_TOKEN = '#', /* token spelled with # only */ - WHITE_SHARP_TOKEN, /* token spelled with # and white space */ - - PERCENT_COLON_TOKEN = '%', /* token spelled with %: only */ - WHITE_PERCENT_COLON_TOKEN /* token spelled with %: and white space */ -}; - -/* Structure allocated for every #define. For a simple replacement - such as - #define foo bar , - nargs = -1, the `pattern' list is null, and the expansion is just - the replacement text. Nargs = 0 means a functionlike macro with no args, - e.g., - #define getchar() getc (stdin) . - When there are args, the expansion is the replacement text with the - args squashed out, and the reflist is a list describing how to - build the output from the input: e.g., "3 chars, then the 1st arg, - then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg". - The chars here come from the expansion. Whatever is left of the - expansion after the last arg-occurrence is copied after that arg. - Note that the reflist can be arbitrarily long--- - its length depends on the number of times the arguments appear in - the replacement text, not how many args there are. Example: - #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and - pattern list - { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL } - where (x, y) means (nchars, argno). */ - -typedef struct definition DEFINITION; -struct definition { - int nargs; - int length; /* length of expansion string */ - int predefined; /* True if the macro was builtin or */ - /* came from the command line */ - U_CHAR *expansion; - int line; /* Line number of definition */ - char *file; /* File of definition */ - size_t file_len; /* Length of file (which can contain NULs) */ - char rest_args; /* Nonzero if last arg. absorbs the rest */ - struct reflist { - struct reflist *next; - - enum sharp_token_type stringify; /* set if a # operator before arg */ - enum sharp_token_type raw_before; /* set if a ## operator before arg */ - enum sharp_token_type raw_after; /* set if a ## operator after arg */ - - char rest_args; /* Nonzero if this arg. absorbs the rest */ - int nchars; /* Number of literal chars to copy before - this arg occurrence. */ - int argno; /* Number of arg to substitute (origin-0) */ - } *pattern; - union { - /* Names of macro args, concatenated in reverse order - with comma-space between them. - The only use of this is that we warn on redefinition - if this differs between the old and new definitions. */ - U_CHAR *argnames; - } args; -}; - -/* different kinds of things that can appear in the value field - of a hash node. Actually, this may be useless now. */ -union hashval { - char *cpval; - DEFINITION *defn; - KEYDEF *keydef; -}; - -/* - * special extension string that can be added to the last macro argument to - * allow it to absorb the "rest" of the arguments when expanded. Ex: - * #define wow(a, b...) process (b, a, b) - * { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); } - * { wow (one, two); } -> { process (two, one, two); } - * if this "rest_arg" is used with the concat token '##' and if it is not - * supplied then the token attached to with ## will not be outputted. Ex: - * #define wow (a, b...) process (b ## , a, ## b) - * { wow (1, 2); } -> { process (2, 1, 2); } - * { wow (one); } -> { process (one); { - */ -static char rest_extension[] = "..."; -#define REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1) - -/* This is the implicit parameter name when using variable number of - parameters for macros using the ISO C 9x extension. */ -static char va_args_name[] = "__VA_ARGS__"; -#define VA_ARGS_NAME_LENGTH (sizeof (va_args_name) - 1) - -/* The structure of a node in the hash table. The hash table - has entries for all tokens defined by #define directives (type T_MACRO), - plus some special tokens like __LINE__ (these each have their own - type, and the appropriate code is run when that type of node is seen. - It does not contain control words like "#define", which are recognized - by a separate piece of code. */ - -/* different flavors of hash nodes --- also used in keyword table */ -enum node_type { - T_DEFINE = 1, /* the `#define' keyword */ - T_INCLUDE, /* the `#include' keyword */ - T_INCLUDE_NEXT, /* the `#include_next' keyword */ - T_IMPORT, /* the `#import' keyword */ - T_IFDEF, /* the `#ifdef' keyword */ - T_IFNDEF, /* the `#ifndef' keyword */ - T_IF, /* the `#if' keyword */ - T_ELSE, /* `#else' */ - T_PRAGMA, /* `#pragma' */ - T_ELIF, /* `#elif' */ - T_UNDEF, /* `#undef' */ - T_LINE, /* `#line' */ - T_ERROR, /* `#error' */ - T_WARNING, /* `#warning' */ - T_ENDIF, /* `#endif' */ - T_SCCS, /* `#sccs', used on system V. */ - T_IDENT, /* `#ident', used on system V. */ - T_ASSERT, /* `#assert', taken from system V. */ - T_UNASSERT, /* `#unassert', taken from system V. */ - T_SPECLINE, /* special symbol `__LINE__' */ - T_DATE, /* `__DATE__' */ - T_FILE, /* `__FILE__' */ - T_BASE_FILE, /* `__BASE_FILE__' */ - T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */ - T_VERSION, /* `__VERSION__' */ - T_SIZE_TYPE, /* `__SIZE_TYPE__' */ - T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */ - T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */ - T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */ - T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */ - T_IMMEDIATE_PREFIX_TYPE, /* `__IMMEDIATE_PREFIX__' */ - T_TIME, /* `__TIME__' */ - T_CONST, /* Constant value, used by `__STDC__' */ - T_MACRO, /* macro defined by `#define' */ - T_DISABLED, /* macro temporarily turned off for rescan */ - T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */ - T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */ - T_UNUSED /* Used for something not defined. */ - }; - -struct hashnode { - struct hashnode *next; /* double links for easy deletion */ - struct hashnode *prev; - struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash - chain is kept, in case the node is the head - of the chain and gets deleted. */ - enum node_type type; /* type of special token */ - int length; /* length of token, for quick comparison */ - U_CHAR *name; /* the actual name */ - union hashval value; /* pointer to expansion, or whatever */ -}; - -typedef struct hashnode HASHNODE; - -/* Some definitions for the hash table. The hash function MUST be - computed as shown in hashf () below. That is because the rescan - loop computes the hash value `on the fly' for most tokens, - in order to avoid the overhead of a lot of procedure calls to - the hashf () function. Hashf () only exists for the sake of - politeness, for use when speed isn't so important. */ - -#define HASHSIZE 1403 -static HASHNODE *hashtab[HASHSIZE]; -#define HASHSTEP(old, c) ((old << 2) + c) -#define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */ - - -/* We let tm.h override the types used here, to handle trivial differences - such as the choice of unsigned int or long unsigned int for size_t. - When machines start needing nontrivial differences in the size type, - it would be best to do something here to figure out automatically - from other information what type to use. */ - -/* The string value for __SIZE_TYPE__. */ - -#ifndef SIZE_TYPE -#define SIZE_TYPE "long unsigned int" -#endif - -/* The string value for __PTRDIFF_TYPE__. */ - -#ifndef PTRDIFF_TYPE -#define PTRDIFF_TYPE "long int" -#endif - -/* The string value for __WCHAR_TYPE__. */ - -#ifndef WCHAR_TYPE -#define WCHAR_TYPE "int" -#endif -char * wchar_type = WCHAR_TYPE; -#undef WCHAR_TYPE - -/* The string value for __USER_LABEL_PREFIX__ */ - -#ifndef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "" -#endif -char * user_label_prefix = USER_LABEL_PREFIX; -#undef USER_LABEL_PREFIX - -/* The string value for __REGISTER_PREFIX__ */ - -#ifndef REGISTER_PREFIX -#define REGISTER_PREFIX "" -#endif - -/* The string value for __IMMEDIATE_PREFIX__ */ - -#ifndef IMMEDIATE_PREFIX -#define IMMEDIATE_PREFIX "" -#endif - -/* In the definition of a #assert name, this structure forms - a list of the individual values asserted. - Each value is itself a list of "tokens". - These are strings that are compared by name. */ - -struct tokenlist_list { - struct tokenlist_list *next; - struct arglist *tokens; -}; - -struct assertion_hashnode { - struct assertion_hashnode *next; /* double links for easy deletion */ - struct assertion_hashnode *prev; - /* also, a back pointer to this node's hash - chain is kept, in case the node is the head - of the chain and gets deleted. */ - struct assertion_hashnode **bucket_hdr; - int length; /* length of token, for quick comparison */ - U_CHAR *name; /* the actual name */ - /* List of token-sequences. */ - struct tokenlist_list *value; -}; - -typedef struct assertion_hashnode ASSERTION_HASHNODE; - -/* Some definitions for the hash table. The hash function MUST be - computed as shown in hashf below. That is because the rescan - loop computes the hash value `on the fly' for most tokens, - in order to avoid the overhead of a lot of procedure calls to - the hashf function. hashf only exists for the sake of - politeness, for use when speed isn't so important. */ - -#define ASSERTION_HASHSIZE 37 -static ASSERTION_HASHNODE *assertion_hashtab[ASSERTION_HASHSIZE]; - -/* Nonzero means inhibit macroexpansion of what seem to be - assertion tests, in rescan. For #if. */ -static int assertions_flag; - -/* `struct directive' defines one #-directive, including how to handle it. */ - -#define DO_PROTO PROTO((U_CHAR *, U_CHAR *, FILE_BUF *, struct directive *)) - -struct directive { - int length; /* Length of name */ - int (*func) DO_PROTO; /* Function to handle directive */ - char *name; /* Name of directive */ - enum node_type type; /* Code which describes which directive. */ -}; - -#define IS_INCLUDE_DIRECTIVE_TYPE(t) \ -((int) T_INCLUDE <= (int) (t) && (int) (t) <= (int) T_IMPORT) - -/* These functions are declared to return int instead of void since they - are going to be placed in the table and some old compilers have trouble with - pointers to functions returning void. */ - -static int do_assert DO_PROTO; -static int do_define DO_PROTO; -static int do_elif DO_PROTO; -static int do_else DO_PROTO; -static int do_endif DO_PROTO; -static int do_error DO_PROTO; -static int do_ident DO_PROTO; -static int do_if DO_PROTO; -static int do_include DO_PROTO; -static int do_line DO_PROTO; -static int do_pragma DO_PROTO; -#ifdef SCCS_DIRECTIVE -static int do_sccs DO_PROTO; -#endif -static int do_unassert DO_PROTO; -static int do_undef DO_PROTO; -static int do_warning DO_PROTO; -static int do_xifdef DO_PROTO; - -/* Here is the actual list of #-directives, most-often-used first. */ - -static struct directive directive_table[] = { - { 6, do_define, "define", T_DEFINE}, - { 2, do_if, "if", T_IF}, - { 5, do_xifdef, "ifdef", T_IFDEF}, - { 6, do_xifdef, "ifndef", T_IFNDEF}, - { 5, do_endif, "endif", T_ENDIF}, - { 4, do_else, "else", T_ELSE}, - { 4, do_elif, "elif", T_ELIF}, - { 4, do_line, "line", T_LINE}, - { 7, do_include, "include", T_INCLUDE}, - { 12, do_include, "include_next", T_INCLUDE_NEXT}, - { 6, do_include, "import", T_IMPORT}, - { 5, do_undef, "undef", T_UNDEF}, - { 5, do_error, "error", T_ERROR}, - { 7, do_warning, "warning", T_WARNING}, -#ifdef SCCS_DIRECTIVE - { 4, do_sccs, "sccs", T_SCCS}, -#endif - { 6, do_pragma, "pragma", T_PRAGMA}, - { 5, do_ident, "ident", T_IDENT}, - { 6, do_assert, "assert", T_ASSERT}, - { 8, do_unassert, "unassert", T_UNASSERT}, - { -1, 0, "", T_UNUSED}, -}; - -/* When a directive handler is called, - this points to the # (or the : of the %:) that started the directive. */ -U_CHAR *directive_start; - -/* table to tell if char can be part of a C identifier. */ -U_CHAR is_idchar[256]; -/* table to tell if char can be first char of a c identifier. */ -U_CHAR is_idstart[256]; -/* table to tell if c is horizontal space. */ -static U_CHAR is_hor_space[256]; -/* table to tell if c is horizontal or vertical space. */ -U_CHAR is_space[256]; - -#define SKIP_WHITE_SPACE(p) do { while (is_hor_space[*p]) p++; } while (0) -#define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[*p]) p++; } while (0) - -static int errors = 0; /* Error counter for exit code */ - -/* Name of output file, for error messages. */ -static char *out_fname; - -/* Nonzero to ignore \ in string constants. Use to treat #line 1 "A:\file.h - as a non-form feed. If you want it to be a form feed, you must use - # 1 "\f". */ -static int ignore_escape_flag = 1; - -/* Stack of conditionals currently in progress - (including both successful and failing conditionals). */ - -struct if_stack { - struct if_stack *next; /* for chaining to the next stack frame */ - char *fname; /* copied from input when frame is made */ - size_t fname_len; /* similarly */ - int lineno; /* similarly */ - int if_succeeded; /* true if a leg of this if-group - has been passed through rescan */ - U_CHAR *control_macro; /* For #ifndef at start of file, - this is the macro name tested. */ - enum node_type type; /* type of last directive seen in this group */ -}; -typedef struct if_stack IF_STACK_FRAME; -static IF_STACK_FRAME *if_stack = NULL; - -/* Buffer of -M output. */ -static char *deps_buffer; - -/* Number of bytes allocated in above. */ -static int deps_allocated_size; - -/* Number of bytes used. */ -static int deps_size; - -/* Number of bytes since the last newline. */ -static int deps_column; - -/* Nonzero means -I- has been seen, - so don't look for #include "foo" the source-file directory. */ -static int ignore_srcdir; - -static int safe_read PROTO((int, char *, int)); -static void safe_write PROTO((int, char *, int)); -static void eprint_string PROTO((const char *, size_t)); - -int main PROTO((int, char **)); - -static void path_include PROTO((char *)); - -static U_CHAR *index0 PROTO((U_CHAR *, int, size_t)); - -static void trigraph_pcp PROTO((FILE_BUF *)); - -static void newline_fix PROTO((U_CHAR *)); -static void name_newline_fix PROTO((U_CHAR *)); - -static char *get_lintcmd PROTO((U_CHAR *, U_CHAR *, U_CHAR **, int *, int *)); - -static void rescan PROTO((FILE_BUF *, int)); - -static FILE_BUF expand_to_temp_buffer PROTO((U_CHAR *, U_CHAR *, int, int)); - -static int handle_directive PROTO((FILE_BUF *, FILE_BUF *)); - -static struct tm *timestamp PROTO((void)); -static void special_symbol PROTO((HASHNODE *, FILE_BUF *)); - -static int is_system_include PROTO((char *)); -static char *base_name PROTO((char *)); -static int absolute_filename PROTO((char *)); -static size_t simplify_filename PROTO((char *)); - -static char *read_filename_string PROTO((int, FILE *)); -static struct file_name_map *read_name_map PROTO((char *)); -static int open_include_file PROTO((char *, struct file_name_list *, U_CHAR *, struct include_file **)); -static char *remap_include_file PROTO((char *, struct file_name_list *)); -static int lookup_ino_include PROTO((struct include_file *)); - -static void finclude PROTO((int, struct include_file *, FILE_BUF *, int, struct file_name_list *)); -static void record_control_macro PROTO((struct include_file *, U_CHAR *)); - -static char *check_precompiled PROTO((int, struct stat *, char *, char **)); -static int check_preconditions PROTO((char *)); -static void pcfinclude PROTO((U_CHAR *, U_CHAR *, FILE_BUF *)); -static void pcstring_used PROTO((HASHNODE *)); -static void write_output PROTO((void)); -static void pass_thru_directive PROTO((U_CHAR *, U_CHAR *, FILE_BUF *, struct directive *)); - -static MACRODEF create_definition PROTO((U_CHAR *, U_CHAR *, FILE_BUF *)); - -static int check_macro_name PROTO((U_CHAR *, int)); -static int compare_defs PROTO((DEFINITION *, DEFINITION *)); -static int comp_def_part PROTO((int, U_CHAR *, int, U_CHAR *, int, int)); - -static DEFINITION *collect_expansion PROTO((U_CHAR *, U_CHAR *, int, struct arglist *)); - -int check_assertion PROTO((U_CHAR *, int, int, struct arglist *)); -static int compare_token_lists PROTO((struct arglist *, struct arglist *)); - -static struct arglist *read_token_list PROTO((U_CHAR **, U_CHAR *, int *)); -static void free_token_list PROTO((struct arglist *)); - -static ASSERTION_HASHNODE *assertion_install PROTO((U_CHAR *, int, int)); -static ASSERTION_HASHNODE *assertion_lookup PROTO((U_CHAR *, int, int)); -static void delete_assertion PROTO((ASSERTION_HASHNODE *)); - -static void do_once PROTO((void)); - -static HOST_WIDEST_INT eval_if_expression PROTO((U_CHAR *, int)); -static void conditional_skip PROTO((FILE_BUF *, int, enum node_type, U_CHAR *, FILE_BUF *)); -static void skip_if_group PROTO((FILE_BUF *, int, FILE_BUF *)); -static void validate_else PROTO((U_CHAR *, U_CHAR *)); - -static U_CHAR *skip_to_end_of_comment PROTO((FILE_BUF *, int *, int)); -static U_CHAR *skip_quoted_string PROTO((U_CHAR *, U_CHAR *, int, int *, int *, int *)); -static char *quote_string PROTO((char *, char *, size_t)); -static U_CHAR *skip_paren_group PROTO((FILE_BUF *)); - -/* Last arg to output_line_directive. */ -enum file_change_code {same_file, enter_file, leave_file}; -static void output_line_directive PROTO((FILE_BUF *, FILE_BUF *, int, enum file_change_code)); - -static void macroexpand PROTO((HASHNODE *, FILE_BUF *)); - -struct argdata; -static int macarg PROTO((struct argdata *, int)); - -static U_CHAR *macarg1 PROTO((U_CHAR *, U_CHAR *, struct hashnode *, int *, int *, int *, int)); - -static int discard_comments PROTO((U_CHAR *, int, int)); - -static int change_newlines PROTO((U_CHAR *, int)); - -static char *my_strerror PROTO((int)); -static void notice PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; -static void vnotice PROTO((const char *, va_list)); -void error PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; -void verror PROTO((const char *, va_list)); -static void error_from_errno PROTO((char *)); -void warning PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; -static void vwarning PROTO((const char *, va_list)); -static void error_with_line PVPROTO((int, const char *, ...)) ATTRIBUTE_PRINTF_2; -static void verror_with_line PROTO((int, const char *, va_list)); -static void vwarning_with_line PROTO((int, const char *, va_list)); -static void warning_with_line PVPROTO((int, const char *, ...)) ATTRIBUTE_PRINTF_2; -void pedwarn PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; -void pedwarn_with_line PVPROTO((int, const char *, ...)) ATTRIBUTE_PRINTF_2; -static void pedwarn_with_file_and_line PVPROTO((const char *, size_t, int, const char *, ...)) ATTRIBUTE_PRINTF_4; -static void pedwarn_strange_white_space PROTO((int)); - -static void print_containing_files PROTO((void)); - -static int line_for_error PROTO((int)); -static int grow_outbuf PROTO((FILE_BUF *, int)); - -static HASHNODE *install PROTO((U_CHAR *, int, enum node_type, char *, int)); -HASHNODE *lookup PROTO((U_CHAR *, int, int)); -static void delete_macro PROTO((HASHNODE *)); -static int hashf PROTO((U_CHAR *, int, int)); - -static void dump_single_macro PROTO((HASHNODE *, FILE *)); -static void dump_all_macros PROTO((void)); -static void dump_defn_1 PROTO((U_CHAR *, int, int, FILE *)); -static void dump_arg_n PROTO((DEFINITION *, int, FILE *)); - -static void initialize_char_syntax PROTO((void)); -static void initialize_builtins PROTO((FILE_BUF *, FILE_BUF *)); - -static void make_definition PROTO((char *)); -static void make_undef PROTO((char *, FILE_BUF *)); - -static void make_assertion PROTO((const char *, const char *)); - -static struct file_name_list *new_include_prefix PROTO((struct file_name_list *, const char *, const char *, const char *)); -static void append_include_chain PROTO((struct file_name_list *, struct file_name_list *)); - -static int quote_string_for_make PROTO((char *, const char *)); -static void deps_output PROTO((const char *, int)); - -void fatal PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; -void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN; -static void perror_with_name PROTO((char *)); -static void pfatal_with_name PROTO((char *)) ATTRIBUTE_NORETURN; -static void pipe_closed PROTO((int)) ATTRIBUTE_NORETURN; - -static void memory_full PROTO((void)) ATTRIBUTE_NORETURN; -static void print_help PROTO((void)); - -/* Read LEN bytes at PTR from descriptor DESC, for file FILENAME, - retrying if necessary. If MAX_READ_LEN is defined, read at most - that bytes at a time. Return a negative value if an error occurs, - otherwise return the actual number of bytes read, - which must be LEN unless end-of-file was reached. */ - -static int -safe_read (desc, ptr, len) - int desc; - char *ptr; - int len; -{ - int left, rcount, nchars; - - left = len; - while (left > 0) { - rcount = left; -#ifdef MAX_READ_LEN - if (rcount > MAX_READ_LEN) - rcount = MAX_READ_LEN; -#endif - nchars = read (desc, ptr, rcount); - if (nchars < 0) - { -#ifdef EINTR - if (errno == EINTR) - continue; -#endif - return nchars; - } - if (nchars == 0) - break; - ptr += nchars; - left -= nchars; - } - return len - left; -} - -/* Write LEN bytes at PTR to descriptor DESC, - retrying if necessary, and treating any real error as fatal. - If MAX_WRITE_LEN is defined, write at most that many bytes at a time. */ - -static void -safe_write (desc, ptr, len) - int desc; - char *ptr; - int len; -{ - int wcount, written; - - while (len > 0) { - wcount = len; -#ifdef MAX_WRITE_LEN - if (wcount > MAX_WRITE_LEN) - wcount = MAX_WRITE_LEN; -#endif - written = write (desc, ptr, wcount); - if (written < 0) - { -#ifdef EINTR - if (errno == EINTR) - continue; -#endif - pfatal_with_name (out_fname); - } - ptr += written; - len -= written; - } -} - -/* Print a string to stderr, with extra handling in case it contains - embedded NUL characters. Any present are written as is. - - Using fwrite for this purpose produces undesireable results on VMS - when stderr happens to be a record oriented file, such as a batch log - file, rather than a stream oriented one. */ - -static void -eprint_string (string, length) - const char *string; - size_t length; -{ - size_t segment_length; - - do { - fprintf(stderr, "%s", string); - length -= (segment_length = strlen(string)); - if (length > 0) - { - fputc('\0', stderr); - length -= 1; - /* Advance past the portion which has already been printed. */ - string += segment_length + 1; - } - } while (length > 0); -} - - -static void -print_help () -{ - printf ("Usage: %s [switches] input output\n", progname); - printf ("Switches:\n"); - printf (" -include Include the contents of before other files\n"); - printf (" -imacros Accept definition of marcos in \n"); - printf (" -iprefix Specify as a prefix for next two options\n"); - printf (" -iwithprefix Add to the end of the system include paths\n"); - printf (" -iwithprefixbefore Add to the end of the main include paths\n"); - printf (" -isystem Add to the start of the system include paths\n"); - printf (" -idirafter Add to the end of the system include paths\n"); - printf (" -I Add to the end of the main include paths\n"); - printf (" -nostdinc Do not search the system include directories\n"); - printf (" -nostdinc++ Do not search the system include directories for C++\n"); - printf (" -o Put output into \n"); - printf (" -pedantic Issue all warnings demanded by strict ANSI C\n"); - printf (" -traditional Follow K&R pre-processor behaviour\n"); - printf (" -trigraphs Support ANSI C trigraphs\n"); - printf (" -lang-c Assume that the input sources are in C\n"); - printf (" -lang-c89 Assume that the input is C89; depricated\n"); - printf (" -lang-c++ Assume that the input sources are in C++\n"); - printf (" -lang-objc Assume that the input sources are in ObjectiveC\n"); - printf (" -lang-objc++ Assume that the input sources are in ObjectiveC++\n"); - printf (" -lang-asm Assume that the input sources are in assembler\n"); - printf (" -lang-chill Assume that the input sources are in Chill\n"); - printf (" -std= Specify the conformance standard; one of:\n"); - printf (" gnu89, gnu9x, c89, c9x, iso9899:1990,\n"); - printf (" iso9899:199409, iso9899:199x\n"); - printf (" -+ Allow parsing of C++ style features\n"); - printf (" -w Inhibit warning messages\n"); - printf (" -Wtrigraphs Warn if trigraphs are encountered\n"); - printf (" -Wno-trigraphs Do not warn about trigraphs\n"); - printf (" -Wcomment{s} Warn if one comment starts inside another\n"); - printf (" -Wno-comment{s} Do not warn about comments\n"); - printf (" -Wtraditional Warn if a macro argument is/would be turned into\n"); - printf (" a string if -traditional is specified\n"); - printf (" -Wno-traditional Do not warn about stringification\n"); - printf (" -Wundef Warn if an undefined macro is used by #if\n"); - printf (" -Wno-undef Do not warn about testing undefined macros\n"); - printf (" -Wimport Warn about the use of the #import directive\n"); - printf (" -Wno-import Do not warn about the use of #import\n"); - printf (" -Werror Treat all warnings as errors\n"); - printf (" -Wno-error Do not treat warnings as errors\n"); - printf (" -Wall Enable all preprocessor warnings\n"); - printf (" -M Generate make dependencies\n"); - printf (" -MM As -M, but ignore system header files\n"); - printf (" -MD As -M, but put output in a .d file\n"); - printf (" -MMD As -MD, but ignore system header files\n"); - printf (" -MG Treat missing header file as generated files\n"); - printf (" -g Include #define and #undef directives in the output\n"); - printf (" -D Define a with string '1' as its value\n"); - printf (" -D= Define a with as its value\n"); - printf (" -A () Assert the to \n"); - printf (" -U Undefine \n"); - printf (" -u or -undef Do not predefine any macros\n"); - printf (" -v Display the version number\n"); - printf (" -H Print the name of header files as they are used\n"); - printf (" -C Do not discard comments\n"); - printf (" -dM Display a list of macro definitions active at end\n"); - printf (" -dD Preserve macro definitions in output\n"); - printf (" -dN As -dD except that only the names are preserved\n"); - printf (" -dI Include #include directives in the output\n"); - printf (" -ifoutput Describe skipped code blocks in output \n"); - printf (" -P Do not generate #line directives\n"); - printf (" -$ Do not include '$' in identifiers\n"); - printf (" -remap Remap file names when including files.\n"); - printf (" -h or --help Display this information\n"); -} - -int -main (argc, argv) - int argc; - char **argv; -{ - struct stat st; - char *in_fname; - char *cp; - int f, i; - FILE_BUF *fp; - - char **pend_files; - char **pend_defs; - char **pend_undefs; - char **pend_assertions; - char **pend_includes; - - /* Record the option used with each element of pend_assertions. - This is preparation for supporting more than one option for making - an assertion. */ - char **pend_assertion_options; - int no_standard_includes = 0; - int no_standard_cplusplus_includes = 0; - int missing_newline = 0; - - /* Non-0 means don't output the preprocessed program. */ - int inhibit_output = 0; - /* Non-0 means -v, so print the full set of include dirs. */ - int verbose = 0; - - /* File name which deps are being written to. - This is 0 if deps are being written to stdout. */ - char *deps_file = 0; - /* Fopen file mode to open deps_file with. */ - char *deps_mode = "a"; - /* Stream on which to print the dependency information. */ - FILE *deps_stream = 0; - /* Target-name to write with the dependency information. */ - char *deps_target = 0; - -#if defined (RLIMIT_STACK) && defined (HAVE_GETRLIMIT) && defined (HAVE_SETRLIMIT) - /* Get rid of any avoidable limit on stack size. */ - { - struct rlimit rlim; - - /* Set the stack limit huge so that alloca (particularly stringtab - in dbxread.c) does not fail. */ - getrlimit (RLIMIT_STACK, &rlim); - rlim.rlim_cur = rlim.rlim_max; - setrlimit (RLIMIT_STACK, &rlim); - } -#endif - -#ifdef SIGPIPE - signal (SIGPIPE, pipe_closed); -#endif - -#ifdef HAVE_LC_MESSAGES - setlocale (LC_MESSAGES, ""); -#endif - (void) bindtextdomain (PACKAGE, localedir); - (void) textdomain (PACKAGE); - - progname = base_name (argv[0]); - -#ifdef VMS - { - /* Remove extension from PROGNAME. */ - char *p; - char *s = progname = xstrdup (progname); - - if ((p = rindex (s, ';')) != 0) *p = '\0'; /* strip version number */ - if ((p = rindex (s, '.')) != 0 /* strip type iff ".exe" */ - && (p[1] == 'e' || p[1] == 'E') - && (p[2] == 'x' || p[2] == 'X') - && (p[3] == 'e' || p[3] == 'E') - && !p[4]) - *p = '\0'; - } -#endif - - /* Do not invoke xmalloc before this point, since locale and - progname need to be set first, in case a diagnostic is issued. */ - - pend_files = (char **) xmalloc (argc * sizeof (char *)); - pend_defs = (char **) xmalloc (argc * sizeof (char *)); - pend_undefs = (char **) xmalloc (argc * sizeof (char *)); - pend_assertions = (char **) xmalloc (argc * sizeof (char *)); - pend_includes = (char **) xmalloc (argc * sizeof (char *)); - pend_assertion_options = (char **) xmalloc (argc * sizeof (char *)); - - in_fname = NULL; - out_fname = NULL; - - /* Initialize is_idchar. */ - initialize_char_syntax (); - - no_line_directives = 0; - no_trigraphs = 1; - dump_macros = dump_none; - no_output = 0; - cplusplus = 0; - cplusplus_comments = 1; - - bzero ((char *) pend_files, argc * sizeof (char *)); - bzero ((char *) pend_defs, argc * sizeof (char *)); - bzero ((char *) pend_undefs, argc * sizeof (char *)); - bzero ((char *) pend_assertions, argc * sizeof (char *)); - bzero ((char *) pend_includes, argc * sizeof (char *)); - -#ifdef MULTIBYTE_CHARS - /* Change to the native locale for multibyte conversions. */ - setlocale (LC_CTYPE, ""); - literal_codeset = getenv ("LANG"); -#endif - - /* Process switches and find input file name. */ - - for (i = 1; i < argc; i++) { - if (argv[i][0] != '-') { - if (out_fname != NULL) - { - print_help (); - fatal ("Too many arguments"); - } - else if (in_fname != NULL) - out_fname = argv[i]; - else - in_fname = argv[i]; - } else { - switch (argv[i][1]) { - - case 'i': - if (!strcmp (argv[i], "-include")) { - int temp = i; - - if (i + 1 == argc) - fatal ("Filename missing after `-include' option"); - else - simplify_filename (pend_includes[temp] = argv[++i]); - } - if (!strcmp (argv[i], "-imacros")) { - int temp = i; - - if (i + 1 == argc) - fatal ("Filename missing after `-imacros' option"); - else - simplify_filename (pend_files[temp] = argv[++i]); - } - if (!strcmp (argv[i], "-iprefix")) { - if (i + 1 == argc) - fatal ("Filename missing after `-iprefix' option"); - else - include_prefix = argv[++i]; - } - if (!strcmp (argv[i], "-ifoutput")) { - output_conditionals = 1; - } - if (!strcmp (argv[i], "-isystem")) { - struct file_name_list *dirtmp; - - if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, - "", argv[++i]))) - break; - dirtmp->c_system_include_path = 1; - - if (before_system == 0) - before_system = dirtmp; - else - last_before_system->next = dirtmp; - last_before_system = dirtmp; /* Tail follows the last one */ - } - /* Add directory to end of path for includes, - with the default prefix at the front of its name. */ - if (!strcmp (argv[i], "-iwithprefix")) { - struct file_name_list *dirtmp; - char *prefix; - - if (include_prefix != 0) - prefix = include_prefix; - else { - prefix = xstrdup (GCC_INCLUDE_DIR); - /* Remove the `include' from /usr/local/lib/gcc.../include. */ - if (!strcmp (prefix + strlen (prefix) - 8, "/include")) - prefix[strlen (prefix) - 7] = 0; - } - - if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, - prefix, argv[++i]))) - break; - - if (after_include == 0) - after_include = dirtmp; - else - last_after_include->next = dirtmp; - last_after_include = dirtmp; /* Tail follows the last one */ - } - /* Add directory to main path for includes, - with the default prefix at the front of its name. */ - if (!strcmp (argv[i], "-iwithprefixbefore")) { - struct file_name_list *dirtmp; - char *prefix; - - if (include_prefix != 0) - prefix = include_prefix; - else { - prefix = xstrdup (GCC_INCLUDE_DIR); - /* Remove the `include' from /usr/local/lib/gcc.../include. */ - if (!strcmp (prefix + strlen (prefix) - 8, "/include")) - prefix[strlen (prefix) - 7] = 0; - } - - dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, prefix, argv[++i]); - append_include_chain (dirtmp, dirtmp); - } - /* Add directory to end of path for includes. */ - if (!strcmp (argv[i], "-idirafter")) { - struct file_name_list *dirtmp; - - if (! (dirtmp = new_include_prefix (NULL_PTR, NULL_PTR, - "", argv[++i]))) - break; - - if (after_include == 0) - after_include = dirtmp; - else - last_after_include->next = dirtmp; - last_after_include = dirtmp; /* Tail follows the last one */ - } - break; - - case 'o': - if (out_fname != NULL) - fatal ("Output filename specified twice"); - if (i + 1 == argc) - fatal ("Filename missing after -o option"); - out_fname = argv[++i]; - if (!strcmp (out_fname, "-")) - out_fname = ""; - break; - - case 'p': - if (!strcmp (argv[i], "-pedantic")) - pedantic = 1; - else if (!strcmp (argv[i], "-pedantic-errors")) { - pedantic = 1; - pedantic_errors = 1; - } else if (!strcmp (argv[i], "-pcp")) { - char *pcp_fname; - if (i + 1 == argc) - fatal ("Filename missing after -pcp option"); - pcp_fname = argv[++i]; - pcp_outfile - = ((pcp_fname[0] != '-' || pcp_fname[1] != '\0') - ? fopen (pcp_fname, "w") - : stdout); - if (pcp_outfile == 0) - pfatal_with_name (pcp_fname); - no_precomp = 1; - } - break; - - case 't': - if (!strcmp (argv[i], "-traditional")) { - traditional = 1; - cplusplus_comments = 0; - } else if (!strcmp (argv[i], "-trigraphs")) { - no_trigraphs = 0; - } - break; - - case 'l': - if (! strcmp (argv[i], "-lang-c")) - cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; - else if (! strcmp (argv[i], "-lang-c89")) - cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; - else if (! strcmp (argv[i], "-lang-c++")) - cplusplus = 1, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 0; - else if (! strcmp (argv[i], "-lang-objc")) - cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 1; - else if (! strcmp (argv[i], "-lang-objc++")) - cplusplus = 1, cplusplus_comments = 1, c89 = 0, c9x = 0, objc = 1; - else if (! strcmp (argv[i], "-lang-asm")) - lang_asm = 1; - else if (! strcmp (argv[i], "-lint")) - for_lint = 1; - break; - - case '+': - cplusplus = 1, cplusplus_comments = 1; - break; - - case 's': - if (!strcmp (argv[i], "-std=iso9899:1990") - || !strcmp (argv[i], "-std=iso9899:199409") - || !strcmp (argv[i], "-std=c89") - || !strcmp (argv[i], "-std=gnu89")) - cplusplus = 0, cplusplus_comments = 0, c89 = 1, c9x = 0, objc = 0; - else if (!strcmp (argv[i], "-std=iso9899:199x") - || !strcmp (argv[i], "-std=c9x") - || !strcmp (argv[i], "-std=gnu9x")) - cplusplus = 0, cplusplus_comments = 1, c89 = 0, c9x = 1, objc = 0; - break; - - case 'w': - inhibit_warnings = 1; - break; - - case 'W': - if (!strcmp (argv[i], "-Wtrigraphs")) - warn_trigraphs = 1; - else if (!strcmp (argv[i], "-Wno-trigraphs")) - warn_trigraphs = 0; - else if (!strcmp (argv[i], "-Wcomment")) - warn_comments = 1; - else if (!strcmp (argv[i], "-Wno-comment")) - warn_comments = 0; - else if (!strcmp (argv[i], "-Wcomments")) - warn_comments = 1; - else if (!strcmp (argv[i], "-Wno-comments")) - warn_comments = 0; - else if (!strcmp (argv[i], "-Wtraditional")) - warn_stringify = 1; - else if (!strcmp (argv[i], "-Wno-traditional")) - warn_stringify = 0; - else if (!strcmp (argv[i], "-Wundef")) - warn_undef = 1; - else if (!strcmp (argv[i], "-Wno-undef")) - warn_undef = 0; - else if (!strcmp (argv[i], "-Wimport")) - warn_import = 1; - else if (!strcmp (argv[i], "-Wno-import")) - warn_import = 0; - else if (!strcmp (argv[i], "-Werror")) - warnings_are_errors = 1; - else if (!strcmp (argv[i], "-Wno-error")) - warnings_are_errors = 0; - else if (!strcmp (argv[i], "-Wall")) - { - warn_trigraphs = 1; - warn_comments = 1; - } - break; - - case 'f': - if (!strcmp (argv[i], "-fleading-underscore")) - user_label_prefix = "_"; - else if (!strcmp (argv[i], "-fno-leading-underscore")) - user_label_prefix = ""; - break; - - case 'M': - /* The style of the choices here is a bit mixed. - The chosen scheme is a hybrid of keeping all options in one string - and specifying each option in a separate argument: - -M|-MM|-MD file|-MMD file [-MG]. An alternative is: - -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely: - -M[M][G][D file]. This is awkward to handle in specs, and is not - as extensible. */ - /* ??? -MG must be specified in addition to one of -M or -MM. - This can be relaxed in the future without breaking anything. - The converse isn't true. */ - - /* -MG isn't valid with -MD or -MMD. This is checked for later. */ - if (!strcmp (argv[i], "-MG")) - { - print_deps_missing_files = 1; - break; - } - if (!strcmp (argv[i], "-M")) - print_deps = 2; - else if (!strcmp (argv[i], "-MM")) - print_deps = 1; - else if (!strcmp (argv[i], "-MD")) - print_deps = 2; - else if (!strcmp (argv[i], "-MMD")) - print_deps = 1; - /* For -MD and -MMD options, write deps on file named by next arg. */ - if (!strcmp (argv[i], "-MD") - || !strcmp (argv[i], "-MMD")) { - if (i + 1 == argc) - fatal ("Filename missing after %s option", argv[i]); - i++; - deps_file = argv[i]; - deps_mode = "w"; - } else { - /* For -M and -MM, write deps on standard output - and suppress the usual output. */ - deps_stream = stdout; - inhibit_output = 1; - } - break; - - case 'd': - { - char *p = argv[i] + 2; - char c; - while ((c = *p++)) { - /* Arg to -d specifies what parts of macros to dump */ - switch (c) { - case 'M': - dump_macros = dump_only; - no_output = 1; - break; - case 'N': - dump_macros = dump_names; - break; - case 'D': - dump_macros = dump_definitions; - break; - case 'I': - dump_includes = 1; - break; - } - } - } - break; - - case 'g': - if (argv[i][2] == '3') - debug_output = 1; - break; - - case '-': - if (strcmp (argv[i], "--help") != 0) - return i; - print_help (); - exit (0); - break; - - case 'v': - notice ("GNU CPP version %s", version_string); -#ifdef TARGET_VERSION - TARGET_VERSION; -#endif - fprintf (stderr, "\n"); - verbose = 1; - break; - - case 'H': - print_include_names = 1; - break; - - case 'D': - if (argv[i][2] != 0) - pend_defs[i] = argv[i] + 2; - else if (i + 1 == argc) - fatal ("Macro name missing after -D option"); - else - i++, pend_defs[i] = argv[i]; - break; - - case 'A': - { - char *p; - - if (argv[i][2] != 0) - p = argv[i] + 2; - else if (i + 1 == argc) - fatal ("Assertion missing after -A option"); - else - p = argv[++i]; - - if (!strcmp (p, "-")) { - /* -A- eliminates all predefined macros and assertions. - Let's include also any that were specified earlier - on the command line. That way we can get rid of any - that were passed automatically in from GCC. */ - int j; - for (j = 0; j < i; j++) - pend_defs[j] = pend_assertions[j] = 0; - } else { - pend_assertions[i] = p; - pend_assertion_options[i] = "-A"; - } - } - break; - - case 'U': /* JF #undef something */ - if (argv[i][2] != 0) - pend_undefs[i] = argv[i] + 2; - else if (i + 1 == argc) - fatal ("Macro name missing after -U option"); - else - pend_undefs[i] = argv[i+1], i++; - break; - - case 'C': - put_out_comments = 1; - break; - - case 'E': /* -E comes from cc -E; ignore it. */ - break; - - case 'P': - no_line_directives = 1; - break; - - case '$': /* Don't include $ in identifiers. */ - is_idchar['$'] = is_idstart['$'] = 0; - break; - - case 'I': /* Add directory to path for includes. */ - { - struct file_name_list *dirtmp; - - if (! ignore_srcdir && !strcmp (argv[i] + 2, "-")) { - ignore_srcdir = 1; - /* Don't use any preceding -I directories for #include <...>. */ - first_bracket_include = 0; - } - else { - dirtmp = new_include_prefix (last_include, NULL_PTR, "", - argv[i][2] ? argv[i] + 2 : argv[++i]); - append_include_chain (dirtmp, dirtmp); - } - } - break; - - case 'n': - if (!strcmp (argv[i], "-nostdinc")) - /* -nostdinc causes no default include directories. - You must specify all include-file directories with -I. */ - no_standard_includes = 1; - else if (!strcmp (argv[i], "-nostdinc++")) - /* -nostdinc++ causes no default C++-specific include directories. */ - no_standard_cplusplus_includes = 1; - else if (!strcmp (argv[i], "-noprecomp")) - no_precomp = 1; - break; - - case 'r': - if (!strcmp (argv[i], "-remap")) - remap = 1; - break; - - case '\0': /* JF handle '-' as file name meaning stdin or stdout */ - if (in_fname == NULL) { - in_fname = ""; - break; - } else if (out_fname == NULL) { - out_fname = ""; - break; - } /* else fall through into error */ - - default: - fatal ("Invalid option `%s'", argv[i]); - } - } - } - - /* Add dirs from CPATH after dirs from -I. */ - /* There seems to be confusion about what CPATH should do, - so for the moment it is not documented. */ - /* Some people say that CPATH should replace the standard include dirs, - but that seems pointless: it comes before them, so it overrides them - anyway. */ - GET_ENV_PATH_LIST (cp, "CPATH"); - if (cp && ! no_standard_includes) - path_include (cp); - - /* Initialize output buffer */ - - outbuf.buf = (U_CHAR *) xmalloc (OUTBUF_SIZE); - outbuf.bufp = outbuf.buf; - outbuf.length = OUTBUF_SIZE; - - /* Do partial setup of input buffer for the sake of generating - early #line directives (when -g is in effect). */ - - fp = &instack[++indepth]; - if (in_fname == NULL) - in_fname = ""; - fp->nominal_fname = fp->fname = in_fname; - fp->nominal_fname_len = strlen (in_fname); - fp->lineno = 0; - - /* In C++, wchar_t is a distinct basic type, and we can expect - __wchar_t to be defined by cc1plus. */ - if (cplusplus) - wchar_type = "__wchar_t"; - - /* Install __LINE__, etc. Must follow initialize_char_syntax - and option processing. */ - initialize_builtins (fp, &outbuf); - - /* Now handle the command line options. */ - - /* Do -U's, -D's and -A's in the order they were seen. */ - for (i = 1; i < argc; i++) { - if (pend_undefs[i]) { - if (debug_output) - output_line_directive (fp, &outbuf, 0, same_file); - make_undef (pend_undefs[i], &outbuf); - } - if (pend_defs[i]) { - if (debug_output) - output_line_directive (fp, &outbuf, 0, same_file); - make_definition (pend_defs[i]); - } - if (pend_assertions[i]) - make_assertion (pend_assertion_options[i], pend_assertions[i]); - } - - done_initializing = 1; - - { /* Read the appropriate environment variable and if it exists - replace include_defaults with the listed path. */ - char *epath = 0; - switch ((objc << 1) + cplusplus) - { - case 0: - GET_ENV_PATH_LIST (epath, "C_INCLUDE_PATH"); - break; - case 1: - GET_ENV_PATH_LIST (epath, "CPLUS_INCLUDE_PATH"); - break; - case 2: - GET_ENV_PATH_LIST (epath, "OBJC_INCLUDE_PATH"); - break; - case 3: - GET_ENV_PATH_LIST (epath, "OBJCPLUS_INCLUDE_PATH"); - break; - } - /* If the environment var for this language is set, - add to the default list of include directories. */ - if (epath) { - int num_dirs; - char *startp, *endp; - - for (num_dirs = 1, startp = epath; *startp; startp++) - if (*startp == PATH_SEPARATOR) - num_dirs++; - include_defaults - = (struct default_include *) xmalloc ((num_dirs - * sizeof (struct default_include)) - + sizeof (include_defaults_array)); - startp = endp = epath; - num_dirs = 0; - while (1) { - char c = *endp++; - if (c == PATH_SEPARATOR || !c) { - endp[-1] = 0; - include_defaults[num_dirs].fname - = startp == endp ? "." : xstrdup (startp); - endp[-1] = c; - include_defaults[num_dirs].component = 0; - include_defaults[num_dirs].cplusplus = cplusplus; - include_defaults[num_dirs].cxx_aware = 1; - num_dirs++; - if (!c) - break; - startp = endp; - } - } - /* Put the usual defaults back in at the end. */ - bcopy ((char *) include_defaults_array, - (char *) &include_defaults[num_dirs], - sizeof (include_defaults_array)); - } - } - - append_include_chain (before_system, last_before_system); - first_system_include = before_system; - - /* Unless -fnostdinc, - tack on the standard include file dirs to the specified list */ - if (!no_standard_includes) { - struct default_include *p = include_defaults; - char *specd_prefix = include_prefix; - char *default_prefix = xstrdup (GCC_INCLUDE_DIR); - int default_len = 0; - /* Remove the `include' from /usr/local/lib/gcc.../include. */ - if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) { - default_len = strlen (default_prefix) - 7; - default_prefix[default_len] = 0; - } - /* Search "translated" versions of GNU directories. - These have /usr/local/lib/gcc... replaced by specd_prefix. */ - if (specd_prefix != 0 && default_len != 0) - for (p = include_defaults; p->fname; p++) { - /* Some standard dirs are only for C++. */ - if (!p->cplusplus || (cplusplus && !no_standard_cplusplus_includes)) { - /* Does this dir start with the prefix? */ - if (!strncmp (p->fname, default_prefix, default_len)) { - /* Yes; change prefix and add to search list. */ - struct file_name_list *new - = new_include_prefix (NULL_PTR, NULL_PTR, specd_prefix, - p->fname + default_len); - if (new) { - new->c_system_include_path = !p->cxx_aware; - append_include_chain (new, new); - if (first_system_include == 0) - first_system_include = new; - p->included = 1; - } - } - } - } - /* Search ordinary names for GNU include directories. */ - for (p = include_defaults; p->fname; p++) { - /* Some standard dirs are only for C++. */ - if (!p->cplusplus || (cplusplus && !no_standard_cplusplus_includes)) { - struct file_name_list *new - = new_include_prefix (NULL_PTR, p->component, "", p->fname); - if (new) { - new->c_system_include_path = !p->cxx_aware; - append_include_chain (new, new); - if (first_system_include == 0) - first_system_include = new; - p->included = 1; - } - } - } - } - - /* Tack the after_include chain at the end of the include chain. */ - append_include_chain (after_include, last_after_include); - if (first_system_include == 0) - first_system_include = after_include; - - /* With -v, print the list of dirs to search. */ - if (verbose) { - struct file_name_list *p; - notice ("#include \"...\" search starts here:\n"); - for (p = include; p; p = p->next) { - if (p == first_bracket_include) - notice ("#include <...> search starts here:\n"); - if (!p->fname[0]) - fprintf (stderr, " .\n"); - else if (!strcmp (p->fname, "/") || !strcmp (p->fname, "//")) - fprintf (stderr, " %s\n", p->fname); - else - /* Omit trailing '/'. */ - fprintf (stderr, " %.*s\n", (int) strlen (p->fname) - 1, p->fname); - } - notice ("End of search list.\n"); - { - struct default_include * d; - notice ("The following default directories have been omitted from the search path:\n"); - for (d = include_defaults; d->fname; d++) - if (! d->included) - fprintf (stderr, " %s\n", d->fname); - notice ("End of omitted list.\n"); - } - } - - /* -MG doesn't select the form of output and must be specified with one of - -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't - inhibit compilation. */ - if (print_deps_missing_files && (print_deps == 0 || !inhibit_output)) - fatal ("-MG must be specified with one of -M or -MM"); - - /* Either of two environment variables can specify output of deps. - Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET", - where OUTPUT_FILE is the file to write deps info to - and DEPS_TARGET is the target to mention in the deps. */ - - if (print_deps == 0 - && (getenv ("SUNPRO_DEPENDENCIES") != 0 - || getenv ("DEPENDENCIES_OUTPUT") != 0)) { - char *spec = getenv ("DEPENDENCIES_OUTPUT"); - char *s; - char *output_file; - - if (spec == 0) { - spec = getenv ("SUNPRO_DEPENDENCIES"); - print_deps = 2; - } - else - print_deps = 1; - - s = spec; - /* Find the space before the DEPS_TARGET, if there is one. */ - /* This should use index. (mrs) */ - while (*s != 0 && *s != ' ') s++; - if (*s != 0) { - deps_target = s + 1; - output_file = xmalloc (s - spec + 1); - bcopy (spec, output_file, s - spec); - output_file[s - spec] = 0; - } - else { - deps_target = 0; - output_file = spec; - } - - deps_file = output_file; - deps_mode = "a"; - } - - /* For -M, print the expected object file name - as the target of this Make-rule. */ - if (print_deps) { - deps_allocated_size = 200; - deps_buffer = xmalloc (deps_allocated_size); - deps_buffer[0] = 0; - deps_size = 0; - deps_column = 0; - - if (deps_target) { - deps_output (deps_target, ':'); - } else if (*in_fname == 0) { - deps_output ("-", ':'); - } else { - char *p, *q; - int len; - - q = base_name (in_fname); - - /* Copy remainder to mungable area. */ - p = (char *) alloca (strlen(q) + 8); - strcpy (p, q); - - /* Output P, but remove known suffixes. */ - len = strlen (p); - q = p + len; - if (len >= 2 - && p[len - 2] == '.' - && index("cCsSm", p[len - 1])) - q = p + (len - 2); - else if (len >= 3 - && p[len - 3] == '.' - && p[len - 2] == 'c' - && p[len - 1] == 'c') - q = p + (len - 3); - else if (len >= 4 - && p[len - 4] == '.' - && p[len - 3] == 'c' - && p[len - 2] == 'x' - && p[len - 1] == 'x') - q = p + (len - 4); - else if (len >= 4 - && p[len - 4] == '.' - && p[len - 3] == 'c' - && p[len - 2] == 'p' - && p[len - 1] == 'p') - q = p + (len - 4); - - /* Supply our own suffix. */ - strcpy (q, OBJECT_SUFFIX); - - deps_output (p, ':'); - deps_output (in_fname, ' '); - } - } - - /* Scan the -imacros files before the main input. - Much like #including them, but with no_output set - so that only their macro definitions matter. */ - - no_output++; no_record_file++; - for (i = 1; i < argc; i++) - if (pend_files[i]) { - struct include_file *inc; - int fd = open_include_file (pend_files[i], NULL_PTR, NULL_PTR, &inc); - if (fd < 0) { - perror_with_name (pend_files[i]); - return FATAL_EXIT_CODE; - } - finclude (fd, inc, &outbuf, 0, NULL_PTR); - } - no_output--; no_record_file--; - - /* Copy the entire contents of the main input file into - the stacked input buffer previously allocated for it. */ - - /* JF check for stdin */ - if (in_fname == NULL || *in_fname == 0) { - in_fname = ""; - f = 0; - } else if ((f = open (in_fname, O_RDONLY, 0666)) < 0) - goto perror; - - if (fstat (f, &st) != 0) - pfatal_with_name (in_fname); - fp->nominal_fname = fp->fname = in_fname; - fp->nominal_fname_len = strlen (in_fname); - fp->lineno = 1; - fp->system_header_p = 0; - /* JF all this is mine about reading pipes and ttys */ - if (! S_ISREG (st.st_mode)) { - /* Read input from a file that is not a normal disk file. - We cannot preallocate a buffer with the correct size, - so we must read in the file a piece at the time and make it bigger. */ - int size; - int bsize; - int cnt; - - if (S_ISDIR (st.st_mode)) - fatal ("Input file `%s' is a directory", in_fname); - - bsize = 2000; - size = 0; - fp->buf = (U_CHAR *) xmalloc (bsize + 2); - for (;;) { - cnt = safe_read (f, (char *) fp->buf + size, bsize - size); - if (cnt < 0) goto perror; /* error! */ - size += cnt; - if (size != bsize) break; /* End of file */ - bsize *= 2; - fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2); - } - fp->length = size; - } else { - /* Read a file whose size we can determine in advance. - For the sake of VMS, st.st_size is just an upper bound. */ - size_t s = (size_t) st.st_size; - if (s != st.st_size || s + 2 < s) - memory_full (); - fp->buf = (U_CHAR *) xmalloc (s + 2); - fp->length = safe_read (f, (char *) fp->buf, s); - if (fp->length < 0) goto perror; - } - fp->bufp = fp->buf; - fp->if_stack = if_stack; - - /* Make sure data ends with a newline. And put a null after it. */ - - if ((fp->length > 0 && fp->buf[fp->length - 1] != '\n') - /* Backslash-newline at end is not good enough. */ - || (fp->length > 1 && fp->buf[fp->length - 2] == '\\')) { - fp->buf[fp->length++] = '\n'; - missing_newline = 1; - } - fp->buf[fp->length] = '\0'; - - /* Unless inhibited, convert trigraphs in the input. */ - - if (!no_trigraphs) - trigraph_pcp (fp); - - /* Now that we know the input file is valid, open the output. */ - - if (!out_fname || !strcmp (out_fname, "")) - out_fname = "stdout"; - else if (! freopen (out_fname, "w", stdout)) - pfatal_with_name (out_fname); - - output_line_directive (fp, &outbuf, 0, same_file); - - /* Scan the -include files before the main input. */ - - no_record_file++; - for (i = 1; i < argc; i++) - if (pend_includes[i]) { - struct include_file *inc; - int fd = open_include_file (pend_includes[i], NULL_PTR, NULL_PTR, &inc); - if (fd < 0) { - perror_with_name (pend_includes[i]); - return FATAL_EXIT_CODE; - } - finclude (fd, inc, &outbuf, 0, NULL_PTR); - } - no_record_file--; - - /* Scan the input, processing macros and directives. */ - - rescan (&outbuf, 0); - - if (missing_newline) - fp->lineno--; - - if (pedantic && missing_newline) - pedwarn ("file does not end in newline"); - - /* Now we have processed the entire input - Write whichever kind of output has been requested. */ - - if (dump_macros == dump_only) - dump_all_macros (); - else if (! inhibit_output) { - write_output (); - } - - if (print_deps) { - /* Don't actually write the deps file if compilation has failed. */ - if (errors == 0) { - if (deps_file && ! (deps_stream = fopen (deps_file, deps_mode))) - pfatal_with_name (deps_file); - fputs (deps_buffer, deps_stream); - putc ('\n', deps_stream); - if (deps_file) { - if (ferror (deps_stream) || fclose (deps_stream) != 0) - fatal ("I/O error on output"); - } - } - } - - if (pcp_outfile && pcp_outfile != stdout - && (ferror (pcp_outfile) || fclose (pcp_outfile) != 0)) - fatal ("I/O error on `-pcp' output"); - - if (ferror (stdout) || fclose (stdout) != 0) - fatal ("I/O error on output"); - - if (errors) - exit (FATAL_EXIT_CODE); - exit (SUCCESS_EXIT_CODE); - - perror: - pfatal_with_name (in_fname); - return 0; -} - -/* Given a colon-separated list of file names PATH, - add all the names to the search path for include files. */ - -static void -path_include (path) - char *path; -{ - char *p; - - p = path; - - if (*p) - while (1) { - char *q = p; - char c; - struct file_name_list *dirtmp; - - /* Find the end of this name. */ - while ((c = *q++) != PATH_SEPARATOR && c) - continue; - - q[-1] = 0; - dirtmp = new_include_prefix (last_include, NULL_PTR, - "", p == q ? "." : p); - q[-1] = c; - append_include_chain (dirtmp, dirtmp); - - /* Advance past this name. */ - p = q; - if (! c) - break; - } -} - -/* Return the address of the first character in S that equals C. - S is an array of length N, possibly containing '\0's, and followed by '\0'. - Return 0 if there is no such character. Assume that C itself is not '\0'. - If we knew we could use memchr, we could just invoke memchr (S, C, N), - but unfortunately memchr isn't autoconfigured yet. */ - -static U_CHAR * -index0 (s, c, n) - U_CHAR *s; - int c; - size_t n; -{ - char *p = (char *) s; - for (;;) { - char *q = index (p, c); - if (q) - return (U_CHAR *) q; - else { - size_t l = strlen (p); - if (l == n) - return 0; - l++; - p += l; - n -= l; - } - } -} - -/* Pre-C-Preprocessor to translate ANSI trigraph idiocy in BUF - before main CCCP processing. Name `pcp' is also in honor of the - drugs the trigraph designers must have been on. - - Using an extra pass through the buffer takes a little extra time, - but is infinitely less hairy than trying to handle trigraphs inside - strings, etc. everywhere, and also makes sure that trigraphs are - only translated in the top level of processing. */ - -static void -trigraph_pcp (buf) - FILE_BUF *buf; -{ - register U_CHAR c, *fptr, *bptr, *sptr, *lptr; - int len; - - fptr = bptr = sptr = buf->buf; - lptr = fptr + buf->length; - while ((sptr = index0 (sptr, '?', (size_t) (lptr - sptr))) != NULL) { - if (*++sptr != '?') - continue; - switch (*++sptr) { - case '=': - c = '#'; - break; - case '(': - c = '['; - break; - case '/': - c = '\\'; - break; - case ')': - c = ']'; - break; - case '\'': - c = '^'; - break; - case '<': - c = '{'; - break; - case '!': - c = '|'; - break; - case '>': - c = '}'; - break; - case '-': - c = '~'; - break; - case '?': - sptr--; - continue; - default: - continue; - } - len = sptr - fptr - 2; - - /* BSD doc says bcopy () works right for overlapping strings. In ANSI - C, this will be memmove (). */ - if (bptr != fptr && len > 0) - bcopy ((char *) fptr, (char *) bptr, len); - - bptr += len; - *bptr++ = c; - fptr = ++sptr; - } - len = buf->length - (fptr - buf->buf); - if (bptr != fptr && len > 0) - bcopy ((char *) fptr, (char *) bptr, len); - buf->length -= fptr - bptr; - buf->buf[buf->length] = '\0'; - if (warn_trigraphs && fptr != bptr) - warning_with_line (0, "%lu trigraph(s) encountered", - (unsigned long) (fptr - bptr) / 2); -} - -/* Move all backslash-newline pairs out of embarrassing places. - Exchange all such pairs following BP - with any potentially-embarrassing characters that follow them. - Potentially-embarrassing characters are / and * - (because a backslash-newline inside a comment delimiter - would cause it not to be recognized). */ - -static void -newline_fix (bp) - U_CHAR *bp; -{ - register U_CHAR *p = bp; - - /* First count the backslash-newline pairs here. */ - - while (p[0] == '\\' && p[1] == '\n') - p += 2; - - /* What follows the backslash-newlines is not embarrassing. */ - - if (*p != '/' && *p != '*') - return; - - /* Copy all potentially embarrassing characters - that follow the backslash-newline pairs - down to where the pairs originally started. */ - - while (*p == '*' || *p == '/') - *bp++ = *p++; - - /* Now write the same number of pairs after the embarrassing chars. */ - while (bp < p) { - *bp++ = '\\'; - *bp++ = '\n'; - } -} - -/* Like newline_fix but for use within a directive-name. - Move any backslash-newlines up past any following symbol constituents. */ - -static void -name_newline_fix (bp) - U_CHAR *bp; -{ - register U_CHAR *p = bp; - - /* First count the backslash-newline pairs here. */ - while (p[0] == '\\' && p[1] == '\n') - p += 2; - - /* What follows the backslash-newlines is not embarrassing. */ - - if (!is_idchar[*p]) - return; - - /* Copy all potentially embarrassing characters - that follow the backslash-newline pairs - down to where the pairs originally started. */ - - while (is_idchar[*p]) - *bp++ = *p++; - - /* Now write the same number of pairs after the embarrassing chars. */ - while (bp < p) { - *bp++ = '\\'; - *bp++ = '\n'; - } -} - -/* Look for lint commands in comments. - - When we come in here, ibp points into a comment. Limit is as one expects. - scan within the comment -- it should start, after lwsp, with a lint command. - If so that command is returned as a (constant) string. - - Upon return, any arg will be pointed to with argstart and will be - arglen long. Note that we don't parse that arg since it will just - be printed out again. */ - -static char * -get_lintcmd (ibp, limit, argstart, arglen, cmdlen) - register U_CHAR *ibp; - register U_CHAR *limit; - U_CHAR **argstart; /* point to command arg */ - int *arglen, *cmdlen; /* how long they are */ -{ - HOST_WIDEST_INT linsize; - register U_CHAR *numptr; /* temp for arg parsing */ - - *arglen = 0; - - SKIP_WHITE_SPACE (ibp); - - if (ibp >= limit) return NULL; - - linsize = limit - ibp; - - /* Oh, I wish C had lexical functions... hell, I'll just open-code the set */ - if ((linsize >= 10) && !bcmp (ibp, "NOTREACHED", 10)) { - *cmdlen = 10; - return "NOTREACHED"; - } - if ((linsize >= 8) && !bcmp (ibp, "ARGSUSED", 8)) { - *cmdlen = 8; - return "ARGSUSED"; - } - if ((linsize >= 11) && !bcmp (ibp, "LINTLIBRARY", 11)) { - *cmdlen = 11; - return "LINTLIBRARY"; - } - if ((linsize >= 7) && !bcmp (ibp, "VARARGS", 7)) { - *cmdlen = 7; - ibp += 7; linsize -= 7; - if ((linsize == 0) || ! ISDIGIT (*ibp)) return "VARARGS"; - - /* OK, read a number */ - for (numptr = *argstart = ibp; (numptr < limit) && ISDIGIT (*numptr); - numptr++); - *arglen = numptr - *argstart; - return "VARARGS"; - } - return NULL; -} - -/* - * The main loop of the program. - * - * Read characters from the input stack, transferring them to the - * output buffer OP. - * - * Macros are expanded and push levels on the input stack. - * At the end of such a level it is popped off and we keep reading. - * At the end of any other kind of level, we return. - * #-directives are handled, except within macros. - * - * If OUTPUT_MARKS is nonzero, keep Newline markers found in the input - * and insert them when appropriate. This is set while scanning macro - * arguments before substitution. It is zero when scanning for final output. - * There are three types of Newline markers: - * * Newline - follows a macro name that was not expanded - * because it appeared inside an expansion of the same macro. - * This marker prevents future expansion of that identifier. - * When the input is rescanned into the final output, these are deleted. - * These are also deleted by ## concatenation. - * * Newline Space (or Newline and any other whitespace character) - * stands for a place that tokens must be separated or whitespace - * is otherwise desirable, but where the ANSI standard specifies there - * is no whitespace. This marker turns into a Space (or whichever other - * whitespace char appears in the marker) in the final output, - * but it turns into nothing in an argument that is stringified with #. - * Such stringified arguments are the only place where the ANSI standard - * specifies with precision that whitespace may not appear. - * - * During this function, IP->bufp is kept cached in IBP for speed of access. - * Likewise, OP->bufp is kept in OBP. Before calling a subroutine - * IBP, IP and OBP must be copied back to memory. IP and IBP are - * copied back with the RECACHE macro. OBP must be copied back from OP->bufp - * explicitly, and before RECACHE, since RECACHE uses OBP. - */ - -static void -rescan (op, output_marks) - FILE_BUF *op; - int output_marks; -{ - /* Character being scanned in main loop. */ - register U_CHAR c; - - /* Length of pending accumulated identifier. */ - register int ident_length = 0; - - /* Hash code of pending accumulated identifier. */ - register int hash = 0; - - /* Current input level (&instack[indepth]). */ - FILE_BUF *ip; - - /* Pointer for scanning input. */ - register U_CHAR *ibp; - - /* Pointer to end of input. End of scan is controlled by LIMIT. */ - register U_CHAR *limit; - - /* Pointer for storing output. */ - register U_CHAR *obp; - - /* REDO_CHAR is nonzero if we are processing an identifier - after backing up over the terminating character. - Sometimes we process an identifier without backing up over - the terminating character, if the terminating character - is not special. Backing up is done so that the terminating character - will be dispatched on again once the identifier is dealt with. */ - int redo_char = 0; - - /* 1 if within an identifier inside of which a concatenation - marker (Newline -) has been seen. */ - int concatenated = 0; - - /* While scanning a comment or a string constant, - this records the line it started on, for error messages. */ - int start_line; - - /* Record position of last `real' newline. */ - U_CHAR *beg_of_line; - -/* Pop the innermost input stack level, assuming it is a macro expansion. */ - -#define POPMACRO \ -do { ip->macro->type = T_MACRO; \ - if (ip->free_ptr) free (ip->free_ptr); \ - --indepth; } while (0) - -/* Reload `rescan's local variables that describe the current - level of the input stack. */ - -#define RECACHE \ -do { ip = &instack[indepth]; \ - ibp = ip->bufp; \ - limit = ip->buf + ip->length; \ - op->bufp = obp; \ - check_expand (op, limit - ibp); \ - beg_of_line = 0; \ - obp = op->bufp; } while (0) - - if (no_output && instack[indepth].fname != 0) - skip_if_group (&instack[indepth], 1, NULL); - - obp = op->bufp; - RECACHE; - - beg_of_line = ibp; - - /* Our caller must always put a null after the end of - the input at each input stack level. */ - if (*limit != 0) - abort (); - - while (1) { - c = *ibp++; - *obp++ = c; - - switch (c) { - case '\\': - if (*ibp == '\n' && !ip->macro) { - /* At the top level, always merge lines ending with backslash-newline, - even in middle of identifier. But do not merge lines in a macro, - since backslash might be followed by a newline-space marker. */ - ++ibp; - ++ip->lineno; - --obp; /* remove backslash from obuf */ - break; - } - /* If ANSI, backslash is just another character outside a string. */ - if (!traditional) - goto randomchar; - /* Otherwise, backslash suppresses specialness of following char, - so copy it here to prevent the switch from seeing it. - But first get any pending identifier processed. */ - if (ident_length > 0) - goto specialchar; - if (ibp < limit) - *obp++ = *ibp++; - break; - - case '%': - if (ident_length || ip->macro || traditional) - goto randomchar; - while (*ibp == '\\' && ibp[1] == '\n') { - ibp += 2; - ++ip->lineno; - } - if (*ibp != ':') - break; - /* Treat this %: digraph as if it were #. */ - /* Fall through. */ - - case '#': - if (assertions_flag) { - if (ident_length) - goto specialchar; - /* Copy #foo (bar lose) without macro expansion. */ - obp[-1] = '#'; /* In case it was '%'. */ - SKIP_WHITE_SPACE (ibp); - while (is_idchar[*ibp]) - *obp++ = *ibp++; - SKIP_WHITE_SPACE (ibp); - if (*ibp == '(') { - ip->bufp = ibp; - skip_paren_group (ip); - bcopy ((char *) ibp, (char *) obp, ip->bufp - ibp); - obp += ip->bufp - ibp; - ibp = ip->bufp; - } - break; - } - - /* If this is expanding a macro definition, don't recognize - preprocessing directives. */ - if (ip->macro != 0) - goto randomchar; - /* If this is expand_into_temp_buffer, - don't recognize them either. Warn about them - only after an actual newline at this level, - not at the beginning of the input level. */ - if (! ip->fname) { - if (ip->buf != beg_of_line) - warning ("preprocessing directive not recognized within macro arg"); - goto randomchar; - } - if (ident_length) - goto specialchar; - - - /* # keyword: a # must be first nonblank char on the line */ - if (beg_of_line == 0) - goto randomchar; - { - U_CHAR *bp; - - /* Scan from start of line, skipping whitespace, comments - and backslash-newlines, and see if we reach this #. - If not, this # is not special. */ - bp = beg_of_line; - /* If -traditional, require # to be at beginning of line. */ - if (!traditional) { - while (1) { - if (is_hor_space[*bp]) - bp++; - else if (*bp == '\\' && bp[1] == '\n') - bp += 2; - else if (*bp == '/' && bp[1] == '*') { - bp += 2; - while (1) - { - if (*bp == '*') - { - if (bp[1] == '/') - { - bp += 2; - break; - } - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (bp, limit - bp); - if (length > 1) - bp += (length - 1); -#endif - } - bp++; - } - } - /* There is no point in trying to deal with C++ // comments here, - because if there is one, then this # must be part of the - comment and we would never reach here. */ - else break; - } - if (c == '%') { - if (bp[0] != '%') - break; - while (bp[1] == '\\' && bp[2] == '\n') - bp += 2; - if (bp + 1 != ibp) - break; - /* %: appears at start of line; skip past the ':' too. */ - bp++; - ibp++; - } - } - if (bp + 1 != ibp) - goto randomchar; - } - - /* This # can start a directive. */ - - --obp; /* Don't copy the '#' */ - - ip->bufp = ibp; - op->bufp = obp; - if (! handle_directive (ip, op)) { -#ifdef USE_C_ALLOCA - alloca (0); -#endif - /* Not a known directive: treat it as ordinary text. - IP, OP, IBP, etc. have not been changed. */ - if (no_output && instack[indepth].fname) { - /* If not generating expanded output, - what we do with ordinary text is skip it. - Discard everything until next # directive. */ - skip_if_group (&instack[indepth], 1, 0); - RECACHE; - beg_of_line = ibp; - break; - } - *obp++ = '#'; /* Copy # (even if it was originally %:). */ - /* Don't expand an identifier that could be a macro directive. - (Section 3.8.3 of the ANSI C standard) */ - SKIP_WHITE_SPACE (ibp); - if (is_idstart[*ibp]) - { - *obp++ = *ibp++; - while (is_idchar[*ibp]) - *obp++ = *ibp++; - } - goto randomchar; - } -#ifdef USE_C_ALLOCA - alloca (0); -#endif - /* A # directive has been successfully processed. */ - /* If not generating expanded output, ignore everything until - next # directive. */ - if (no_output && instack[indepth].fname) - skip_if_group (&instack[indepth], 1, 0); - obp = op->bufp; - RECACHE; - beg_of_line = ibp; - break; - - case '\"': /* skip quoted string */ - case '\'': - /* A single quoted string is treated like a double -- some - programs (e.g., troff) are perverse this way */ - - /* Handle any pending identifier; - but the L in L'...' or L"..." is not an identifier. */ - if (ident_length) { - if (! (ident_length == 1 && hash == HASHSTEP (0, 'L'))) - goto specialchar; - ident_length = hash = 0; - } - - start_line = ip->lineno; - - /* Skip ahead to a matching quote. */ - - while (1) { - if (ibp >= limit) { - if (ip->macro != 0) { - /* try harder: this string crosses a macro expansion boundary. - This can happen naturally if -traditional. - Otherwise, only -D can make a macro with an unmatched quote. */ - POPMACRO; - RECACHE; - continue; - } - if (!traditional) { - error_with_line (line_for_error (start_line), - "unterminated string or character constant"); - if (multiline_string_line) { - error_with_line (multiline_string_line, - "possible real start of unterminated constant"); - multiline_string_line = 0; - } - } - break; - } - *obp++ = *ibp; - switch (*ibp++) { - case '\n': - ++ip->lineno; - ++op->lineno; - /* Traditionally, end of line ends a string constant with no error. - So exit the loop and record the new line. */ - if (traditional) { - beg_of_line = ibp; - goto while2end; - } - if (c == '\'') { - error_with_line (line_for_error (start_line), - "unterminated character constant"); - goto while2end; - } - if (multiline_string_line == 0) { - if (pedantic) - pedwarn_with_line (line_for_error (start_line), - "string constant runs past end of line"); - multiline_string_line = ip->lineno - 1; - } - break; - - case '\\': - if (*ibp == '\n') { - /* Backslash newline is replaced by nothing at all, but - keep the line counts correct. But if we are reading - from a macro, keep the backslash newline, since backslash - newlines have already been processed. */ - if (ip->macro) - *obp++ = '\n'; - else - --obp; - ++ibp; - ++ip->lineno; - } else { - /* ANSI stupidly requires that in \\ the second \ - is *not* prevented from combining with a newline. */ - if (!ip->macro) { - while (*ibp == '\\' && ibp[1] == '\n') { - ibp += 2; - ++ip->lineno; - } - } - *obp++ = *ibp++; - } - break; - - case '\"': - case '\'': - if (ibp[-1] == c) - goto while2end; - break; -#ifdef MULTIBYTE_CHARS - default: - { - int length; - --ibp; - length = local_mblen (ibp, limit - ibp); - if (length > 0) - { - --obp; - bcopy (ibp, obp, length); - obp += length; - ibp += length; - } - else - ++ibp; - } - break; -#endif - } - } - while2end: - break; - - case '/': - if (ip->macro != 0) - goto randomchar; - if (*ibp == '\\' && ibp[1] == '\n') - newline_fix (ibp); - if (*ibp != '*' - && !(cplusplus_comments && *ibp == '/')) - goto randomchar; - if (ident_length) - goto specialchar; - - if (*ibp == '/') { - /* C++ style comment... */ - start_line = ip->lineno; - - /* Comments are equivalent to spaces. */ - if (! put_out_comments) - obp[-1] = ' '; - - { - U_CHAR *before_bp = ibp; - - while (++ibp < limit) { - if (*ibp == '\n') - { - if (put_out_comments) { - bcopy ((char *) before_bp, (char *) obp, ibp - before_bp); - obp += ibp - before_bp; - } - break; - } - if (*ibp == '\\') - { - if (ibp + 1 < limit && ibp[1] == '\n') - { - if (warn_comments) - warning ("multiline `//' comment"); - ++ip->lineno; - /* Copy the newline into the output buffer, in order to - avoid the pain of a #line every time a multiline comment - is seen. */ - if (!put_out_comments) - *obp++ = '\n'; - ++op->lineno; - ++ibp; - } - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (ibp, limit - ibp); - if (length > 1) - ibp += (length - 1); -#endif - } - } - break; - } - } - - /* Ordinary C comment. Skip it, optionally copying it to output. */ - - start_line = ip->lineno; - - ++ibp; /* Skip the star. */ - - /* If this cpp is for lint, we peek inside the comments: */ - if (for_lint) { - U_CHAR *argbp; - int cmdlen, arglen; - char *lintcmd = get_lintcmd (ibp, limit, &argbp, &arglen, &cmdlen); - - if (lintcmd != NULL) { - op->bufp = obp; - check_expand (op, cmdlen + arglen + 14); - obp = op->bufp; - /* I believe it is always safe to emit this newline: */ - obp[-1] = '\n'; - bcopy ("#pragma lint ", (char *) obp, 13); - obp += 13; - bcopy (lintcmd, (char *) obp, cmdlen); - obp += cmdlen; - - if (arglen != 0) { - *(obp++) = ' '; - bcopy (argbp, (char *) obp, arglen); - obp += arglen; - } - - /* OK, now bring us back to the state we were in before we entered - this branch. We need #line because the #pragma's newline always - messes up the line count. */ - op->bufp = obp; - output_line_directive (ip, op, 0, same_file); - check_expand (op, limit - ibp + 2); - obp = op->bufp; - *(obp++) = '/'; - } - } - - /* Comments are equivalent to spaces. - Note that we already output the slash; we might not want it. - For -traditional, a comment is equivalent to nothing. */ - if (! put_out_comments) { - if (traditional) - obp--; - else - obp[-1] = ' '; - } - else - *obp++ = '*'; - - { - U_CHAR *before_bp = ibp; - - for (;;) { - switch (*ibp++) { - case '*': - if (ibp[-2] == '/' && warn_comments) - warning ("`/*' within comment"); - if (*ibp == '\\' && ibp[1] == '\n') - newline_fix (ibp); - if (*ibp == '/') - goto comment_end; - break; - - case '\n': - ++ip->lineno; - /* Copy the newline into the output buffer, in order to - avoid the pain of a #line every time a multiline comment - is seen. */ - if (!put_out_comments) - *obp++ = '\n'; - ++op->lineno; - break; - - case 0: - if (limit < ibp) { - error_with_line (line_for_error (start_line), - "unterminated comment"); - goto limit_reached; - } - break; -#ifdef MULTIBYTE_CHARS - default: - { - int length; - length = local_mblen (ibp, limit - ibp); - if (length > 1) - ibp += (length - 1); - } - break; -#endif - } - } - comment_end: - - ibp++; - if (put_out_comments) { - bcopy ((char *) before_bp, (char *) obp, ibp - before_bp); - obp += ibp - before_bp; - } - } - break; - - case '$': - if (! is_idchar['$']) - goto randomchar; - if (pedantic) - pedwarn ("`$' in identifier"); - goto letter; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - /* If digit is not part of identifier, it starts a number, - which means that following letters are not an identifier. - "0x5" does not refer to an identifier "x5". - So copy all alphanumerics that follow without accumulating - as an identifier. Periods also, for sake of "3.e7". */ - - if (ident_length == 0) { - for (;;) { - if (!ip->macro) { - while (ibp[0] == '\\' && ibp[1] == '\n') { - ++ip->lineno; - ibp += 2; - } - } - c = *ibp++; - if (!is_idchar[c] && c != '.') { - --ibp; - break; - } - *obp++ = c; - /* A sign can be part of a preprocessing number - if it follows an `e' or `p'. */ - if (c == 'e' || c == 'E' || c == 'p' || c == 'P') { - if (!ip->macro) { - while (ibp[0] == '\\' && ibp[1] == '\n') { - ++ip->lineno; - ibp += 2; - } - } - if (*ibp == '+' || *ibp == '-') { - *obp++ = *ibp++; - /* But traditional C does not let the token go past the sign, - and C89 does not allow `p'. */ - if (traditional || (c89 && (c == 'p' || c == 'P'))) - break; - } - } - } - break; - } - /* fall through */ - - case '_': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - letter: - ident_length++; - /* Compute step of hash function, to avoid a proc call on every token */ - hash = HASHSTEP (hash, c); - break; - - case '\n': - if (ip->fname == 0 && *ibp == '-') { - /* Newline - inhibits expansion of preceding token. - If expanding a macro arg, we keep the newline -. - In final output, it is deleted. - We recognize Newline - in macro bodies and macro args. */ - if (! concatenated) { - ident_length = 0; - hash = 0; - } - ibp++; - if (!output_marks) { - obp--; - } else { - /* If expanding a macro arg, keep the newline -. */ - *obp++ = '-'; - } - break; - } - - /* If reprocessing a macro expansion, newline is a special marker. */ - else if (ip->macro != 0) { - /* Newline White is a "funny space" to separate tokens that are - supposed to be separate but without space between. - Here White means any whitespace character. - Newline - marks a recursive macro use that is not - supposed to be expandable. */ - - if (is_space[*ibp]) { - /* Newline Space does not prevent expansion of preceding token - so expand the preceding token and then come back. */ - if (ident_length > 0) - goto specialchar; - - /* If generating final output, newline space makes a space. */ - if (!output_marks) { - obp[-1] = *ibp++; - /* And Newline Newline makes a newline, so count it. */ - if (obp[-1] == '\n') - op->lineno++; - } else { - /* If expanding a macro arg, keep the newline space. - If the arg gets stringified, newline space makes nothing. */ - *obp++ = *ibp++; - } - } else abort (); /* Newline followed by something random? */ - break; - } - - /* If there is a pending identifier, handle it and come back here. */ - if (ident_length > 0) - goto specialchar; - - beg_of_line = ibp; - - /* Update the line counts and output a #line if necessary. */ - ++ip->lineno; - ++op->lineno; - if (ip->lineno != op->lineno) { - op->bufp = obp; - output_line_directive (ip, op, 1, same_file); - check_expand (op, limit - ibp); - obp = op->bufp; - } - break; - - /* Come here either after (1) a null character that is part of the input - or (2) at the end of the input, because there is a null there. */ - case 0: - if (ibp <= limit) - /* Our input really contains a null character. */ - goto randomchar; - - limit_reached: - /* At end of a macro-expansion level, pop it and read next level. */ - if (ip->macro != 0) { - obp--; - ibp--; - /* If traditional, and we have an identifier that ends here, - process it now, so we get the right error for recursion. */ - if (traditional && ident_length - && ! is_idchar[*instack[indepth - 1].bufp]) { - redo_char = 1; - goto randomchar; - } - POPMACRO; - RECACHE; - break; - } - - /* If we don't have a pending identifier, - return at end of input. */ - if (ident_length == 0) { - obp--; - ibp--; - op->bufp = obp; - ip->bufp = ibp; - goto ending; - } - - /* If we do have a pending identifier, just consider this null - a special character and arrange to dispatch on it again. - The second time, IDENT_LENGTH will be zero so we will return. */ - - /* Fall through */ - -specialchar: - - /* Handle the case of a character such as /, ', " or null - seen following an identifier. Back over it so that - after the identifier is processed the special char - will be dispatched on again. */ - - ibp--; - obp--; - redo_char = 1; - - default: - -randomchar: - - if (ident_length > 0) { - register HASHNODE *hp; - - /* We have just seen an identifier end. If it's a macro, expand it. - - IDENT_LENGTH is the length of the identifier - and HASH is its hash code. - - The identifier has already been copied to the output, - so if it is a macro we must remove it. - - If REDO_CHAR is 0, the char that terminated the identifier - has been skipped in the output and the input. - OBP-IDENT_LENGTH-1 points to the identifier. - If the identifier is a macro, we must back over the terminator. - - If REDO_CHAR is 1, the terminating char has already been - backed over. OBP-IDENT_LENGTH points to the identifier. */ - - if (!pcp_outfile || pcp_inside_if) { - for (hp = hashtab[MAKE_POS (hash) % HASHSIZE]; hp != NULL; - hp = hp->next) { - - if (hp->length == ident_length) { - int obufp_before_macroname; - int op_lineno_before_macroname; - register int i = ident_length; - register U_CHAR *p = hp->name; - register U_CHAR *q = obp - i; - int disabled; - - if (! redo_char) - q--; - - do { /* All this to avoid a strncmp () */ - if (*p++ != *q++) - goto hashcollision; - } while (--i); - - /* We found a use of a macro name. - see if the context shows it is a macro call. */ - - /* Back up over terminating character if not already done. */ - if (! redo_char) { - ibp--; - obp--; - } - - /* Save this as a displacement from the beginning of the output - buffer. We can not save this as a position in the output - buffer, because it may get realloc'ed by RECACHE. */ - obufp_before_macroname = (obp - op->buf) - ident_length; - op_lineno_before_macroname = op->lineno; - - if (hp->type == T_PCSTRING) { - pcstring_used (hp); /* Mark the definition of this key - as needed, ensuring that it - will be output. */ - break; /* Exit loop, since the key cannot have a - definition any longer. */ - } - - /* Record whether the macro is disabled. */ - disabled = hp->type == T_DISABLED; - - /* This looks like a macro ref, but if the macro was disabled, - just copy its name and put in a marker if requested. */ - - if (disabled) { -#if 0 - /* This error check caught useful cases such as - #define foo(x,y) bar (x (y,0), y) - foo (foo, baz) */ - if (traditional) - error ("recursive use of macro `%s'", hp->name); -#endif - - if (output_marks) { - op->bufp = obp; - check_expand (op, limit - ibp + 2); - obp = op->bufp; - *obp++ = '\n'; - *obp++ = '-'; - } - break; - } - - /* If macro wants an arglist, verify that a '(' follows. - first skip all whitespace, copying it to the output - after the macro name. Then, if there is no '(', - decide this is not a macro call and leave things that way. */ - if ((hp->type == T_MACRO || hp->type == T_DISABLED) - && hp->value.defn->nargs >= 0) - { - U_CHAR *old_ibp = ibp; - U_CHAR *old_obp = obp; - int old_iln = ip->lineno; - int old_oln = op->lineno; - - while (1) { - /* Scan forward over whitespace, copying it to the output. */ - if (ibp == limit && ip->macro != 0) { - POPMACRO; - RECACHE; - old_ibp = ibp; - old_obp = obp; - old_iln = ip->lineno; - old_oln = op->lineno; - } - else if (is_space[*ibp]) { - *obp++ = *ibp++; - if (ibp[-1] == '\n') { - if (ip->macro == 0) { - /* Newline in a file. Count it. */ - ++ip->lineno; - ++op->lineno; - } else if (!output_marks) { - /* A newline mark, and we don't want marks - in the output. If it is newline-hyphen, - discard it entirely. Otherwise, it is - newline-whitechar, so keep the whitechar. */ - obp--; - if (*ibp == '-') - ibp++; - else { - if (*ibp == '\n') - ++op->lineno; - *obp++ = *ibp++; - } - } else { - /* A newline mark; copy both chars to the output. */ - *obp++ = *ibp++; - } - } - } - else if (ip->macro) - break; - else if (*ibp == '/') { - /* If a comment, copy it unchanged or discard it. */ - if (ibp[1] == '\\' && ibp[2] == '\n') - newline_fix (ibp + 1); - if (ibp[1] == '*') { - if (put_out_comments) { - *obp++ = '/'; - *obp++ = '*'; - } else if (! traditional) { - *obp++ = ' '; - } - for (ibp += 2; ibp < limit; ibp++) { - /* We need not worry about newline-marks, - since they are never found in comments. */ - if (ibp[0] == '*') { - if (ibp[1] == '\\' && ibp[2] == '\n') - newline_fix (ibp + 1); - if (ibp[1] == '/') { - ibp += 2; - if (put_out_comments) { - *obp++ = '*'; - *obp++ = '/'; - } - break; - } - } - else if (*ibp == '\n') { - /* Newline in a file. Count it. */ - ++ip->lineno; - ++op->lineno; - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (ibp, limit - ibp); - if (length > 1) - { - if (put_out_comments) - { - bcopy (ibp, obp, length - 1); - obp += length - 1; - } - ibp += (length - 1); - } -#endif - } - if (put_out_comments) - *obp++ = *ibp; - } - } else if (ibp[1] == '/' && cplusplus_comments) { - if (put_out_comments) { - *obp++ = '/'; - *obp++ = '/'; - } else if (! traditional) { - *obp++ = ' '; - } - for (ibp += 2; ; ibp++) - { - if (*ibp == '\n') - break; - if (*ibp == '\\' && ibp[1] == '\n') - { - if (put_out_comments) - *obp++ = *ibp++; - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (ibp, limit - ibp); - if (length > 1) - { - if (put_out_comments) - { - bcopy (ibp, obp, length - 1); - obp += length - 1; - } - ibp += (length - 1); - } -#endif - } - if (put_out_comments) - *obp++ = *ibp; - } - } else - break; - } - else if (ibp[0] == '\\' && ibp[1] == '\n') { - ibp += 2; - ++ip->lineno; - } - else break; - } - if (*ibp != '(') { - /* It isn't a macro call. - Put back the space that we just skipped. */ - ibp = old_ibp; - obp = old_obp; - ip->lineno = old_iln; - op->lineno = old_oln; - /* Exit the for loop. */ - break; - } - } - - /* This is now known to be a macro call. - Discard the macro name from the output, - along with any following whitespace just copied, - but preserve newlines if not outputting marks since this - is more likely to do the right thing with line numbers. */ - obp = op->buf + obufp_before_macroname; - if (output_marks) - op->lineno = op_lineno_before_macroname; - else { - int newlines = op->lineno - op_lineno_before_macroname; - while (0 < newlines--) - *obp++ = '\n'; - } - - /* Prevent accidental token-pasting with a character - before the macro call. */ - if (!traditional && obp != op->buf) { - switch (obp[-1]) { - case '!': case '%': case '&': case '*': - case '+': case '-': case '.': case '/': - case ':': case '<': case '=': case '>': - case '^': case '|': - /* If we are expanding a macro arg, make a newline marker - to separate the tokens. If we are making real output, - a plain space will do. */ - if (output_marks) - *obp++ = '\n'; - *obp++ = ' '; - } - } - - /* Expand the macro, reading arguments as needed, - and push the expansion on the input stack. */ - ip->bufp = ibp; - op->bufp = obp; - macroexpand (hp, op); - - /* Reexamine input stack, since macroexpand has pushed - a new level on it. */ - obp = op->bufp; - RECACHE; - break; - } -hashcollision: - ; - } /* End hash-table-search loop */ - } - ident_length = hash = 0; /* Stop collecting identifier */ - redo_char = 0; - concatenated = 0; - } /* End if (ident_length > 0) */ - } /* End switch */ - } /* End per-char loop */ - - /* Come here to return -- but first give an error message - if there was an unterminated successful conditional. */ - ending: - if (if_stack != ip->if_stack) - { - char *str; - - switch (if_stack->type) - { - case T_IF: - str = "if"; - break; - case T_IFDEF: - str = "ifdef"; - break; - case T_IFNDEF: - str = "ifndef"; - break; - case T_ELSE: - str = "else"; - break; - case T_ELIF: - str = "elif"; - break; - default: - abort (); - } - - error_with_line (line_for_error (if_stack->lineno), - "unterminated `#%s' conditional", str); - } - if_stack = ip->if_stack; -} - -/* - * Rescan a string into a temporary buffer and return the result - * as a FILE_BUF. Note this function returns a struct, not a pointer. - * - * OUTPUT_MARKS nonzero means keep Newline markers found in the input - * and insert such markers when appropriate. See `rescan' for details. - * OUTPUT_MARKS is 1 for macroexpanding a macro argument separately - * before substitution; it is 0 for other uses. - */ -static FILE_BUF -expand_to_temp_buffer (buf, limit, output_marks, assertions) - U_CHAR *buf, *limit; - int output_marks, assertions; -{ - register FILE_BUF *ip; - FILE_BUF obuf; - int length = limit - buf; - U_CHAR *buf1; - int odepth = indepth; - int save_assertions_flag = assertions_flag; - - assertions_flag = assertions; - - if (length < 0) - abort (); - - /* Set up the input on the input stack. */ - - buf1 = (U_CHAR *) alloca (length + 1); - { - register U_CHAR *p1 = buf; - register U_CHAR *p2 = buf1; - - while (p1 != limit) - *p2++ = *p1++; - } - buf1[length] = 0; - - /* Set up to receive the output. */ - - obuf.length = length * 2 + 100; /* Usually enough. Why be stingy? */ - obuf.bufp = obuf.buf = (U_CHAR *) xmalloc (obuf.length); - obuf.nominal_fname = 0; - obuf.inc = 0; - obuf.dir = 0; - obuf.fname = 0; - obuf.macro = 0; - obuf.if_stack = 0; - obuf.free_ptr = 0; - obuf.system_header_p = 0; - - CHECK_DEPTH ({return obuf;}); - - ++indepth; - - ip = &instack[indepth]; - ip->fname = 0; - ip->nominal_fname = 0; - ip->nominal_fname_len = 0; - ip->inc = 0; - ip->system_header_p = 0; - ip->macro = 0; - ip->free_ptr = 0; - ip->length = length; - ip->buf = ip->bufp = buf1; - ip->if_stack = if_stack; - - ip->lineno = obuf.lineno = 1; - - /* Scan the input, create the output. */ - rescan (&obuf, output_marks); - - /* Pop input stack to original state. */ - --indepth; - - if (indepth != odepth) - abort (); - - /* Record the output. */ - obuf.length = obuf.bufp - obuf.buf; - - assertions_flag = save_assertions_flag; - return obuf; -} - -/* - * Process a # directive. Expects IP->bufp to point after the '#', as in - * `#define foo bar'. Passes to the directive handler - * (do_define, do_include, etc.): the addresses of the 1st and - * last chars of the directive (starting immediately after the # - * keyword), plus op and the keyword table pointer. If the directive - * contains comments it is copied into a temporary buffer sans comments - * and the temporary buffer is passed to the directive handler instead. - * Likewise for backslash-newlines. - * - * Returns nonzero if this was a known # directive. - * Otherwise, returns zero, without advancing the input pointer. - */ - -static int -handle_directive (ip, op) - FILE_BUF *ip, *op; -{ - register U_CHAR *bp, *cp; - register struct directive *kt; - register int ident_length; - U_CHAR *resume_p; - - /* Nonzero means we must copy the entire directive - to get rid of comments or backslash-newlines. */ - int copy_directive = 0; - - U_CHAR *ident, *after_ident; - - bp = ip->bufp; - - /* Record where the directive started. do_xifdef needs this. */ - directive_start = bp - 1; - - ignore_escape_flag = 1; - - /* Skip whitespace and \-newline. */ - while (1) { - if (is_hor_space[*bp]) { - if (*bp != ' ' && *bp != '\t' && pedantic) - pedwarn_strange_white_space (*bp); - bp++; - } else if (*bp == '/') { - if (bp[1] == '\\' && bp[2] == '\n') - newline_fix (bp + 1); - if (! (bp[1] == '*' || (cplusplus_comments && bp[1] == '/'))) - break; - ip->bufp = bp + 2; - skip_to_end_of_comment (ip, &ip->lineno, 0); - bp = ip->bufp; - } else if (*bp == '\\' && bp[1] == '\n') { - bp += 2; ip->lineno++; - } else break; - } - - /* Now find end of directive name. - If we encounter a backslash-newline, exchange it with any following - symbol-constituents so that we end up with a contiguous name. */ - - cp = bp; - while (1) { - if (is_idchar[*cp]) - cp++; - else { - if (*cp == '\\' && cp[1] == '\n') - name_newline_fix (cp); - if (is_idchar[*cp]) - cp++; - else break; - } - } - ident_length = cp - bp; - ident = bp; - after_ident = cp; - - /* A line of just `#' becomes blank. */ - - if (ident_length == 0 && *after_ident == '\n') { - ip->bufp = after_ident; - return 1; - } - - if (ident_length == 0 || !is_idstart[*ident]) { - U_CHAR *p = ident; - while (is_idchar[*p]) { - if (*p < '0' || *p > '9') - break; - p++; - } - /* Handle # followed by a line number. */ - if (p != ident && !is_idchar[*p]) { - static struct directive line_directive_table[] = { - { 4, do_line, "line", T_LINE}, - }; - if (pedantic) - pedwarn ("`#' followed by integer"); - after_ident = ident; - kt = line_directive_table; - ignore_escape_flag = 0; - goto old_linenum; - } - - /* Avoid error for `###' and similar cases unless -pedantic. */ - if (p == ident) { - while (*p == '#' || is_hor_space[*p]) p++; - if (*p == '\n') { - if (pedantic && !lang_asm) - warning ("invalid preprocessing directive"); - return 0; - } - } - - if (!lang_asm) - error ("invalid preprocessing directive name"); - - return 0; - } - - /* - * Decode the keyword and call the appropriate expansion - * routine, after moving the input pointer up to the next line. - */ - for (kt = directive_table; kt->length > 0; kt++) { - if (kt->length == ident_length && !bcmp (kt->name, ident, ident_length)) { - register U_CHAR *buf; - register U_CHAR *limit; - int unterminated; - int junk; - int *already_output; - - /* Nonzero means do not delete comments within the directive. - #define needs this when -traditional. */ - int keep_comments; - - old_linenum: - - limit = ip->buf + ip->length; - unterminated = 0; - already_output = 0; - keep_comments = traditional && kt->type == T_DEFINE; - /* #import is defined only in Objective C, or when on the NeXT. */ - if (kt->type == T_IMPORT - && !(objc || lookup ((U_CHAR *) "__NeXT__", -1, -1))) - break; - - /* Find the end of this directive (first newline not backslashed - and not in a string or comment). - Set COPY_DIRECTIVE if the directive must be copied - (it contains a backslash-newline or a comment). */ - - buf = bp = after_ident; - while (bp < limit) { - register U_CHAR c = *bp++; - switch (c) { - case '\\': - if (bp < limit) { - if (*bp == '\n') { - ip->lineno++; - copy_directive = 1; - bp++; - } else if (traditional) - bp++; - } - break; - - case '"': - /* "..." is special for #include. */ - if (IS_INCLUDE_DIRECTIVE_TYPE (kt->type)) { - while (bp < limit && *bp != '\n') { - if (*bp == '"') { - bp++; - break; - } - if (*bp == '\\' && bp[1] == '\n') { - ip->lineno++; - copy_directive = 1; - bp++; - } - bp++; - } - break; - } - /* Fall through. */ - case '\'': - bp = skip_quoted_string (bp - 1, limit, ip->lineno, &ip->lineno, ©_directive, &unterminated); - /* Don't bother calling the directive if we already got an error - message due to unterminated string. Skip everything and pretend - we called the directive. */ - if (unterminated) { - if (traditional) { - /* Traditional preprocessing permits unterminated strings. */ - ip->bufp = bp; - goto endloop1; - } - ip->bufp = bp; - return 1; - } - break; - - /* <...> is special for #include. */ - case '<': - if (! IS_INCLUDE_DIRECTIVE_TYPE (kt->type)) - break; - while (bp < limit && *bp != '>' && *bp != '\n') { - if (*bp == '\\' && bp[1] == '\n') { - ip->lineno++; - copy_directive = 1; - bp++; - } - bp++; - } - break; - - case '/': - if (*bp == '\\' && bp[1] == '\n') - newline_fix (bp); - if (*bp == '*' - || (cplusplus_comments && *bp == '/')) { - U_CHAR *obp = bp - 1; - ip->bufp = bp + 1; - skip_to_end_of_comment (ip, &ip->lineno, 0); - bp = ip->bufp; - /* No need to copy the directive because of a comment at the end; - just don't include the comment in the directive. */ - if (!put_out_comments) { - U_CHAR *p; - for (p = bp; *p == ' ' || *p == '\t'; p++) - continue; - if (*p == '\n') { - bp = obp; - goto endloop1; - } - } - /* Don't remove the comments if -traditional. */ - if (! keep_comments) - copy_directive++; - } - break; - - case '\f': - case '\r': - case '\v': - if (pedantic) - pedwarn_strange_white_space (c); - break; - - case '\n': - --bp; /* Point to the newline */ - ip->bufp = bp; - goto endloop1; - } - } - ip->bufp = bp; - - endloop1: - resume_p = ip->bufp; - /* BP is the end of the directive. - RESUME_P is the next interesting data after the directive. - A comment may come between. */ - - /* If a directive should be copied through, and -C was given, - pass it through before removing comments. */ - if (!no_output && put_out_comments - && ((kt->type == T_DEFINE || kt->type == T_UNDEF) - ? dump_macros == dump_definitions - : IS_INCLUDE_DIRECTIVE_TYPE (kt->type) ? dump_includes - : kt->type == T_PRAGMA)) { - int len; - - /* Output directive name. */ - check_expand (op, kt->length + 2); - /* Make sure # is at the start of a line */ - if (op->bufp > op->buf && op->bufp[-1] != '\n') { - op->lineno++; - *op->bufp++ = '\n'; - } - *op->bufp++ = '#'; - bcopy (kt->name, op->bufp, kt->length); - op->bufp += kt->length; - - /* Output arguments. */ - len = (bp - buf); - check_expand (op, len); - bcopy (buf, (char *) op->bufp, len); - op->bufp += len; - /* Take account of any (escaped) newlines just output. */ - while (--len >= 0) - if (buf[len] == '\n') - op->lineno++; - - already_output = &junk; - } /* Don't we need a newline or #line? */ - - if (copy_directive) { - register U_CHAR *xp = buf; - /* Need to copy entire directive into temp buffer before dispatching */ - - cp = (U_CHAR *) alloca (bp - buf + 5); /* room for directive plus - some slop */ - buf = cp; - - /* Copy to the new buffer, deleting comments - and backslash-newlines (and whitespace surrounding the latter). */ - - while (xp < bp) { - register U_CHAR c = *xp++; - *cp++ = c; - - switch (c) { - case '\n': - abort (); /* A bare newline should never part of the line. */ - break; - - /* <...> is special for #include. */ - case '<': - if (! IS_INCLUDE_DIRECTIVE_TYPE (kt->type)) - break; - while (xp < bp && c != '>') { - c = *xp++; - if (c == '\\' && xp < bp && *xp == '\n') - xp++; - else - *cp++ = c; - } - break; - - case '\\': - if (*xp == '\n') { - xp++; - cp--; - if (cp != buf && is_hor_space[cp[-1]]) { - while (cp - 1 != buf && is_hor_space[cp[-2]]) - cp--; - SKIP_WHITE_SPACE (xp); - } else if (is_hor_space[*xp]) { - *cp++ = *xp++; - SKIP_WHITE_SPACE (xp); - } - } else if (traditional && xp < bp) { - *cp++ = *xp++; - } - break; - - case '\'': - case '\"': - { - int backslash_newlines_p = 0; - - register U_CHAR *bp1 - = skip_quoted_string (xp - 1, bp, ip->lineno, - NULL_PTR, &backslash_newlines_p, - NULL_PTR); - if (backslash_newlines_p) - while (xp != bp1) - { - /* With something like: - - #define X "a\ - b" - - we should still remove the backslash-newline - pair as part of phase two. */ - if (xp[0] == '\\' && xp[1] == '\n') - xp += 2; - else - *cp++ = *xp++; - } - else - /* This is the same as the loop above, but taking - advantage of the fact that we know there are no - backslash-newline pairs. */ - while (xp != bp1) - *cp++ = *xp++; - } - break; - - case '/': - if (*xp == '*' - || (cplusplus_comments && *xp == '/')) { - ip->bufp = xp + 1; - /* If we already copied the directive through, - already_output != 0 prevents outputting comment now. */ - skip_to_end_of_comment (ip, already_output, 0); - if (keep_comments) - while (xp != ip->bufp) - *cp++ = *xp++; - /* Delete or replace the slash. */ - else if (traditional) - cp--; - else - cp[-1] = ' '; - xp = ip->bufp; - } - } - } - - /* Null-terminate the copy. */ - - *cp = 0; - } else - cp = bp; - - ip->bufp = resume_p; - - /* Some directives should be written out for cc1 to process, - just as if they were not defined. And sometimes we're copying - directives through. */ - - if (!no_output && already_output == 0 - && (kt->type == T_DEFINE ? (int) dump_names <= (int) dump_macros - : IS_INCLUDE_DIRECTIVE_TYPE (kt->type) ? dump_includes - : kt->type == T_PRAGMA)) { - int len; - - /* Output directive name. */ - check_expand (op, kt->length + 1); - *op->bufp++ = '#'; - bcopy (kt->name, (char *) op->bufp, kt->length); - op->bufp += kt->length; - - if (kt->type == T_DEFINE && dump_macros == dump_names) { - /* Output `#define name' only. */ - U_CHAR *xp = buf; - U_CHAR *yp; - SKIP_WHITE_SPACE (xp); - yp = xp; - while (is_idchar[*xp]) xp++; - len = (xp - yp); - check_expand (op, len + 1); - *op->bufp++ = ' '; - bcopy (yp, (char *) op->bufp, len); - } else { - /* Output entire directive. */ - len = (cp - buf); - check_expand (op, len); - bcopy (buf, (char *) op->bufp, len); - } - op->bufp += len; - } /* Don't we need a newline or #line? */ - - /* Call the appropriate directive handler. buf now points to - either the appropriate place in the input buffer, or to - the temp buffer if it was necessary to make one. cp - points to the first char after the contents of the (possibly - copied) directive, in either case. */ - (*kt->func) (buf, cp, op, kt); - check_expand (op, ip->length - (ip->bufp - ip->buf)); - - return 1; - } - } - - /* It is deliberate that we don't warn about undefined directives. - That is the responsibility of cc1. */ - return 0; -} - -static struct tm * -timestamp () -{ - static struct tm *timebuf; - if (!timebuf) { - time_t t = time ((time_t *) 0); - timebuf = localtime (&t); - } - return timebuf; -} - -static char *monthnames[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", - }; - -/* - * expand things like __FILE__. Place the expansion into the output - * buffer *without* rescanning. - */ - -static void -special_symbol (hp, op) - HASHNODE *hp; - FILE_BUF *op; -{ - char *buf; - int i, len; - int true_indepth; - FILE_BUF *ip = NULL; - struct tm *timebuf; - - int paren = 0; /* For special `defined' keyword */ - - if (pcp_outfile && pcp_inside_if - && hp->type != T_SPEC_DEFINED && hp->type != T_CONST) - error ("Predefined macro `%s' used inside `#if' during precompilation", - hp->name); - - for (i = indepth; i >= 0; i--) - if (instack[i].fname != NULL) { - ip = &instack[i]; - break; - } - if (ip == NULL) { - error ("cccp error: not in any file?!"); - return; /* the show must go on */ - } - - switch (hp->type) { - case T_FILE: - case T_BASE_FILE: - { - FILE_BUF *p = hp->type == T_FILE ? ip : &instack[0]; - char *string = p->nominal_fname; - - if (string) - { - size_t string_len = p->nominal_fname_len; - buf = (char *) alloca (3 + 4 * string_len); - quote_string (buf, string, string_len); - } - else - buf = "\"\""; - - break; - } - - case T_INCLUDE_LEVEL: - true_indepth = 0; - for (i = indepth; i >= 0; i--) - if (instack[i].fname != NULL) - true_indepth++; - - buf = (char *) alloca (8); /* Eight bytes ought to be more than enough */ - sprintf (buf, "%d", true_indepth - 1); - break; - - case T_VERSION: - buf = (char *) alloca (3 + strlen (version_string)); - sprintf (buf, "\"%s\"", version_string); - break; - -#ifndef NO_BUILTIN_SIZE_TYPE - case T_SIZE_TYPE: - buf = SIZE_TYPE; - break; -#endif - -#ifndef NO_BUILTIN_PTRDIFF_TYPE - case T_PTRDIFF_TYPE: - buf = PTRDIFF_TYPE; - break; -#endif - - case T_WCHAR_TYPE: - buf = wchar_type; - break; - - case T_USER_LABEL_PREFIX_TYPE: - buf = user_label_prefix; - break; - - case T_REGISTER_PREFIX_TYPE: - buf = REGISTER_PREFIX; - break; - - case T_IMMEDIATE_PREFIX_TYPE: - buf = IMMEDIATE_PREFIX; - break; - - case T_CONST: - buf = hp->value.cpval; -#ifdef STDC_0_IN_SYSTEM_HEADERS - if (ip->system_header_p - && hp->length == 8 && bcmp (hp->name, "__STDC__", 8) == 0 - && !lookup ((U_CHAR *) "__STRICT_ANSI__", -1, -1)) - buf = "0"; -#endif - if (pcp_inside_if && pcp_outfile) - /* Output a precondition for this macro use */ - fprintf (pcp_outfile, "#define %s %s\n", hp->name, buf); - break; - - case T_SPECLINE: - buf = (char *) alloca (10); - sprintf (buf, "%d", ip->lineno); - break; - - case T_DATE: - case T_TIME: - buf = (char *) alloca (20); - timebuf = timestamp (); - if (hp->type == T_DATE) - sprintf (buf, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon], - timebuf->tm_mday, timebuf->tm_year + 1900); - else - sprintf (buf, "\"%02d:%02d:%02d\"", timebuf->tm_hour, timebuf->tm_min, - timebuf->tm_sec); - break; - - case T_SPEC_DEFINED: - buf = " 0 "; /* Assume symbol is not defined */ - ip = &instack[indepth]; - SKIP_WHITE_SPACE (ip->bufp); - if (*ip->bufp == '(') { - paren++; - ip->bufp++; /* Skip over the paren */ - SKIP_WHITE_SPACE (ip->bufp); - } - - if (!is_idstart[*ip->bufp]) - goto oops; - if (ip->bufp[0] == 'L' && (ip->bufp[1] == '\'' || ip->bufp[1] == '"')) - goto oops; - if ((hp = lookup (ip->bufp, -1, -1))) { - if (pcp_outfile && pcp_inside_if - && (hp->type == T_CONST - || (hp->type == T_MACRO && hp->value.defn->predefined))) - /* Output a precondition for this macro use. */ - fprintf (pcp_outfile, "#define %s\n", hp->name); - buf = " 1 "; - } - else - if (pcp_outfile && pcp_inside_if) { - /* Output a precondition for this macro use */ - U_CHAR *cp = ip->bufp; - fprintf (pcp_outfile, "#undef "); - while (is_idchar[*cp]) /* Ick! */ - fputc (*cp++, pcp_outfile); - putc ('\n', pcp_outfile); - } - while (is_idchar[*ip->bufp]) - ++ip->bufp; - SKIP_WHITE_SPACE (ip->bufp); - if (paren) { - if (*ip->bufp != ')') - goto oops; - ++ip->bufp; - } - break; - -oops: - - error ("`defined' without an identifier"); - break; - - default: - error ("cccp error: invalid special hash type"); /* time for gdb */ - abort (); - } - len = strlen (buf); - check_expand (op, len); - bcopy (buf, (char *) op->bufp, len); - op->bufp += len; - - return; -} - - -/* Routines to handle #directives */ - -/* Handle #include and #import. - This function expects to see "fname" or on the input. */ - -static int -do_include (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword; -{ - U_CHAR *importing = keyword->type == T_IMPORT ? (U_CHAR *) "" : (U_CHAR *) 0; - int skip_dirs = (keyword->type == T_INCLUDE_NEXT); - static int import_warning = 0; - char *fname; /* Dynamically allocated fname buffer */ - char *pcftry; - char *pcfname; - char *fbeg, *fend; /* Beginning and end of fname */ - U_CHAR *fin; - - struct file_name_list *search_start = include; /* Chain of dirs to search */ - struct file_name_list *dsp; /* First in chain, if #include "..." */ - struct file_name_list *searchptr = 0; - size_t flen; - - int f = -3; /* file number */ - struct include_file *inc = 0; - - int retried = 0; /* Have already tried macro - expanding the include line*/ - int angle_brackets = 0; /* 0 for "...", 1 for <...> */ -#ifdef VMS - int vaxc_include = 0; /* 1 for token without punctuation */ -#endif - int pcf = -1; - char *pcfbuf; - char *pcfbuflimit; - int pcfnum; - - if (pedantic && !instack[indepth].system_header_p) - { - if (importing) - pedwarn ("ANSI C does not allow `#import'"); - if (skip_dirs) - pedwarn ("ANSI C does not allow `#include_next'"); - } - - if (importing && warn_import && !inhibit_warnings - && !instack[indepth].system_header_p && !import_warning) { - import_warning = 1; - warning ("using `#import' is not recommended"); - notice ("The fact that a certain header file need not be processed more than once\n\ -should be indicated in the header file, not where it is used.\n\ -The best way to do this is with a conditional of this form:\n\ -\n\ - #ifndef _FOO_H_INCLUDED\n\ - #define _FOO_H_INCLUDED\n\ - ... ...\n\ - #endif /* Not _FOO_H_INCLUDED */\n\ -\n\ -Then users can use `#include' any number of times.\n\ -GNU C automatically avoids processing the file more than once\n\ -when it is equipped with such a conditional.\n"); - } - -get_filename: - - fin = buf; - SKIP_WHITE_SPACE (fin); - /* Discard trailing whitespace so we can easily see - if we have parsed all the significant chars we were given. */ - while (limit != fin && is_hor_space[limit[-1]]) limit--; - fbeg = fend = (char *) alloca (limit - fin); - - switch (*fin++) { - case '\"': - { - FILE_BUF *fp; - /* Copy the operand text, concatenating the strings. */ - { - for (;;) { - for (;;) { - if (fin == limit) - goto invalid_include_file_name; - *fend = *fin++; - if (*fend == '"') - break; - fend++; - } - if (fin == limit) - break; - /* If not at the end, there had better be another string. */ - /* Skip just horiz space, and don't go past limit. */ - while (fin != limit && is_hor_space[*fin]) fin++; - if (fin != limit && *fin == '\"') - fin++; - else - goto fail; - } - } - - /* We have "filename". Figure out directory this source - file is coming from and put it on the front of the list. */ - - /* If -I- was specified, don't search current dir, only spec'd ones. */ - if (ignore_srcdir) break; - - for (fp = &instack[indepth]; fp >= instack; fp--) - { - int n; - char *nam; - - if ((nam = fp->nominal_fname) != NULL) { - /* Found a named file. Figure out dir of the file, - and put it in front of the search list. */ - dsp = ((struct file_name_list *) - alloca (sizeof (struct file_name_list) - + fp->nominal_fname_len)); - strcpy (dsp->fname, nam); - simplify_filename (dsp->fname); - nam = base_name (dsp->fname); - *nam = 0; -#ifdef VMS - /* for hack_vms_include_specification(), a local - dir specification must start with "./" on VMS. */ - if (nam == dsp->fname) - { - *nam++ = '.'; - *nam++ = '/'; - *nam = 0; - } -#endif - /* But for efficiency's sake, do not insert the dir - if it matches the search list's first dir. */ - dsp->next = search_start; - if (!search_start || strcmp (dsp->fname, search_start->fname)) { - search_start = dsp; - n = nam - dsp->fname; - if (n + INCLUDE_LEN_FUDGE > max_include_len) - max_include_len = n + INCLUDE_LEN_FUDGE; - } - dsp[0].got_name_map = 0; - break; - } - } - break; - } - - case '<': - while (fin != limit && *fin != '>') - *fend++ = *fin++; - if (*fin == '>' && fin + 1 == limit) { - angle_brackets = 1; - /* If -I-, start with the first -I dir after the -I-. */ - search_start = first_bracket_include; - break; - } - goto fail; - - default: -#ifdef VMS - /* - * Support '#include xyz' like VAX-C to allow for easy use of all the - * decwindow include files. It defaults to '#include ' (so the - * code from case '<' is repeated here) and generates a warning. - * (Note: macro expansion of `xyz' takes precedence.) - */ - /* Note: The argument of ISALPHA() can be evaluated twice, so do - the pre-decrement outside of the macro. */ - if (retried && (--fin, ISALPHA(*(U_CHAR *) (fin)))) { - while (fin != limit && (!ISSPACE(*fin))) - *fend++ = *fin++; - warning ("VAX-C-style include specification found, use '#include ' !"); - vaxc_include = 1; - if (fin == limit) { - angle_brackets = 1; - /* If -I-, start with the first -I dir after the -I-. */ - search_start = first_bracket_include; - break; - } - } -#endif - - fail: - if (! retried) { - /* Expand buffer and then remove any newline markers. - We can't just tell expand_to_temp_buffer to omit the markers, - since it would put extra spaces in include file names. */ - FILE_BUF trybuf; - U_CHAR *src; - int errors_before_expansion = errors; - trybuf = expand_to_temp_buffer (buf, limit, 1, 0); - if (errors != errors_before_expansion) { - free (trybuf.buf); - goto invalid_include_file_name; - } - src = trybuf.buf; - buf = (U_CHAR *) alloca (trybuf.bufp - trybuf.buf + 1); - limit = buf; - while (src != trybuf.bufp) { - switch ((*limit++ = *src++)) { - case '\n': - limit--; - src++; - break; - - case '\'': - case '\"': - { - U_CHAR *src1 = skip_quoted_string (src - 1, trybuf.bufp, 0, - NULL_PTR, NULL_PTR, NULL_PTR); - while (src != src1) - *limit++ = *src++; - } - break; - } - } - *limit = 0; - free (trybuf.buf); - retried = 1; - goto get_filename; - } - - invalid_include_file_name: - error ("`#%s' expects \"FILENAME\" or ", keyword->name); - return 0; - } - - /* For #include_next, skip in the search path - past the dir in which the containing file was found. */ - if (skip_dirs) { - FILE_BUF *fp; - for (fp = &instack[indepth]; fp >= instack; fp--) - if (fp->fname != NULL) { - /* fp->dir is null if the containing file was specified - with an absolute file name. In that case, don't skip anything. */ - if (fp->dir) - search_start = fp->dir->next; - break; - } - } - - *fend = 0; - flen = simplify_filename (fbeg); - - if (flen == 0) - { - error ("empty file name in `#%s'", keyword->name); - return 0; - } - - /* Allocate this permanently, because it gets stored in the definitions - of macros. */ - fname = xmalloc (max_include_len + flen + 1); - /* + 1 above for terminating null. */ - - system_include_depth += angle_brackets; - - /* If specified file name is absolute, just open it. */ - - if (absolute_filename (fbeg)) { - strcpy (fname, fbeg); - f = open_include_file (fname, NULL_PTR, importing, &inc); - } else { - - struct bypass_dir { - struct bypass_dir *next; - char *fname; - struct file_name_list *searchptr; - } **bypass_slot = 0; - - /* Search directory path, trying to open the file. - Copy each filename tried into FNAME. */ - - for (searchptr = search_start; searchptr; searchptr = searchptr->next) { - - if (searchptr == first_bracket_include) { - /* Go to bypass directory if we know we've seen this file before. */ - static struct bypass_dir *bypass_hashtab[INCLUDE_HASHSIZE]; - struct bypass_dir *p; - bypass_slot = &bypass_hashtab[hashf ((U_CHAR *) fbeg, flen, - INCLUDE_HASHSIZE)]; - for (p = *bypass_slot; p; p = p->next) - if (!strcmp (fbeg, p->fname)) { - searchptr = p->searchptr; - bypass_slot = 0; - break; - } - } - -#ifdef VMS - /* Change this 1/2 Unix 1/2 VMS file specification into a - full VMS file specification */ - if (searchptr->fname[0]) - { - strcpy (fname, searchptr->fname); - if (fname[strlen (fname) - 1] == ':') - { - char *slashp; - slashp = strchr (fbeg, '/'); - - /* start at root-dir of logical device if no path given. */ - if (slashp == 0) - strcat (fname, "[000000]"); - } - strcat (fname, fbeg); - - /* Fix up the filename */ - hack_vms_include_specification (fname, vaxc_include); - } - else - { - /* This is a normal VMS filespec, so use it unchanged. */ - strcpy (fname, fbeg); - /* if it's '#include filename', add the missing .h */ - if (vaxc_include && index(fname,'.')==NULL) - strcat (fname, ".h"); - } -#else - strcpy (fname, searchptr->fname); - strcat (fname, fbeg); -#endif /* VMS */ - f = open_include_file (fname, searchptr, importing, &inc); - if (f != -1) { - if (bypass_slot && searchptr != first_bracket_include) { - /* This is the first time we found this include file, - and we found it after first_bracket_include. - Record its location so that we can bypass to here next time. */ - struct bypass_dir *p - = (struct bypass_dir *) xmalloc (sizeof (struct bypass_dir)); - p->next = *bypass_slot; - p->fname = fname + strlen (searchptr->fname); - p->searchptr = searchptr; - *bypass_slot = p; - } - break; - } -#ifdef VMS - /* Our VMS hacks can produce invalid filespecs, so don't worry - about errors other than EACCES. */ - if (errno == EACCES) - break; -#else - if (errno != ENOENT && errno != ENOTDIR) - break; -#endif - } - } - - - if (f < 0) { - - if (f == -2) { - /* The file was already included. */ - - /* If generating dependencies and -MG was specified, we assume missing - files are leaf files, living in the same directory as the source file - or other similar place; these missing files may be generated from - other files and may not exist yet (eg: y.tab.h). */ - } else if (print_deps_missing_files - && (system_include_depth != 0) < print_deps) - { - /* If it was requested as a system header file, - then assume it belongs in the first place to look for such. */ - if (angle_brackets) - { - if (search_start) { - char *p = (char *) alloca (strlen (search_start->fname) - + strlen (fbeg) + 1); - strcpy (p, search_start->fname); - strcat (p, fbeg); - deps_output (p, ' '); - } - } - else - { - /* Otherwise, omit the directory, as if the file existed - in the directory with the source. */ - deps_output (fbeg, ' '); - } - } - /* If -M was specified, and this header file won't be added to the - dependency list, then don't count this as an error, because we can - still produce correct output. Otherwise, we can't produce correct - output, because there may be dependencies we need inside the missing - file, and we don't know what directory this missing file exists in. */ - else if (0 < print_deps && print_deps <= (system_include_depth != 0)) - warning ("No include path in which to find %s", fbeg); - else if (f != -3) - error_from_errno (fbeg); - else - error ("No include path in which to find %s", fbeg); - - } else { - - /* Actually process the file. */ - - pcftry = (char *) alloca (strlen (fname) + 30); - pcfbuf = 0; - pcfnum = 0; - - if (!no_precomp) - { - do { - sprintf (pcftry, "%s%d", fname, pcfnum++); - - pcf = open (pcftry, O_RDONLY, 0666); - if (pcf != -1) - { - struct stat s; - - if (fstat (pcf, &s) != 0) - pfatal_with_name (pcftry); - if (! INO_T_EQ (inc->st.st_ino, s.st_ino) - || inc->st.st_dev != s.st_dev) - { - pcfbuf = check_precompiled (pcf, &s, fname, &pcfbuflimit); - /* Don't need it any more. */ - close (pcf); - } - else - { - /* Don't need it at all. */ - close (pcf); - break; - } - } - } while (pcf != -1 && !pcfbuf); - } - - /* Actually process the file */ - if (pcfbuf) { - pcfname = xmalloc (strlen (pcftry) + 1); - strcpy (pcfname, pcftry); - pcfinclude ((U_CHAR *) pcfbuf, (U_CHAR *) fname, op); - } - else - finclude (f, inc, op, is_system_include (fname), searchptr); - } - - system_include_depth -= angle_brackets; - - return 0; -} - -/* Return nonzero if the given FILENAME is an absolute pathname which - designates a file within one of the known "system" include file - directories. We assume here that if the given FILENAME looks like - it is the name of a file which resides either directly in a "system" - include file directory, or within any subdirectory thereof, then the - given file must be a "system" include file. This function tells us - if we should suppress pedantic errors/warnings for the given FILENAME. - - The value is 2 if the file is a C-language system header file - for which C++ should (on most systems) assume `extern "C"'. */ - -static int -is_system_include (filename) - register char *filename; -{ - struct file_name_list *searchptr; - - for (searchptr = first_system_include; searchptr; - searchptr = searchptr->next) - if (! strncmp (searchptr->fname, filename, strlen (searchptr->fname))) - return searchptr->c_system_include_path + 1; - return 0; -} - -/* Yield the non-directory suffix of a file name. */ - -static char * -base_name (fname) - char *fname; -{ - char *s = fname; - char *p; -#if defined (__MSDOS__) || defined (_WIN32) - if (ISALPHA (s[0]) && s[1] == ':') s += 2; -#endif -#ifdef VMS - if ((p = rindex (s, ':'))) s = p + 1; /* Skip device. */ - if ((p = rindex (s, ']'))) s = p + 1; /* Skip directory. */ - if ((p = rindex (s, '>'))) s = p + 1; /* Skip alternate (int'n'l) dir. */ - if (s != fname) - return s; -#endif - if ((p = rindex (s, '/'))) s = p + 1; -#ifdef DIR_SEPARATOR - if ((p = rindex (s, DIR_SEPARATOR))) s = p + 1; -#endif - return s; -} - -/* Yield nonzero if FILENAME is absolute (i.e. not relative). */ - -static int -absolute_filename (filename) - char *filename; -{ -#if defined (__MSDOS__) \ - || (defined (_WIN32) && !defined (__CYGWIN__) && !defined (_UWIN)) - if (ISALPHA (filename[0]) && filename[1] == ':') filename += 2; -#endif -#if defined (__CYGWIN__) - /* At present, any path that begins with a drive spec is absolute. */ - if (ISALPHA (filename[0]) && filename[1] == ':') return 1; -#endif -#ifdef VMS - if (index (filename, ':') != 0) return 1; -#endif - if (filename[0] == '/') return 1; -#ifdef DIR_SEPARATOR - if (filename[0] == DIR_SEPARATOR) return 1; -#endif - return 0; -} - -/* Returns whether or not a given character is a directory separator. - Used by simplify_filename. */ -static inline -int -is_dir_separator(ch) - char ch; -{ - return (ch == DIR_SEPARATOR) -#if defined (DIR_SEPARATOR_2) - || (ch == DIR_SEPARATOR_2) -#endif - ; -} - -/* Remove unnecessary characters from FILENAME in place, - to avoid unnecessary filename aliasing. - Return the length of the resulting string. - - Do only the simplifications allowed by Posix. - It is OK to miss simplifications on non-Posix hosts, - since this merely leads to suboptimal results. */ - -static size_t -simplify_filename (filename) - char *filename; -{ - register char *from = filename; - register char *to = filename; - char *to0; - - /* Remove redundant initial /s. */ - if (is_dir_separator (*from)) - { - *to++ = DIR_SEPARATOR; - if (is_dir_separator (*++from)) - { - if (is_dir_separator (*++from)) - { - /* 3 or more initial /s are equivalent to 1 /. */ - while (is_dir_separator (*++from)) - continue; - } - else - { - /* On some hosts // differs from /; Posix allows this. */ - *to++ = DIR_SEPARATOR; - } - } - } - - to0 = to; - - for (;;) - { -#ifndef VMS - if (from[0] == '.' && from[1] == '/') - from += 2; - else -#endif - { - /* Copy this component and trailing DIR_SEPARATOR, if any. */ - while (!is_dir_separator (*to++ = *from++)) - { - if (!to[-1]) - { - /* Trim . component at end of nonempty name. */ - to -= filename <= to - 3 && to[-3] == DIR_SEPARATOR && to[-2] == '.'; - - /* Trim unnecessary trailing /s. */ - while (to0 < --to && to[-1] == DIR_SEPARATOR) - continue; - - *to = 0; - return to - filename; - } - } -#if defined(DIR_SEPARATOR_2) - /* Simplify to one directory separator. */ - to[-1] = DIR_SEPARATOR; -#endif - } - - /* Skip /s after a /. */ - while (is_dir_separator (*from)) - from++; - } -} - -/* The file_name_map structure holds a mapping of file names for a - particular directory. This mapping is read from the file named - FILE_NAME_MAP_FILE in that directory. Such a file can be used to - map filenames on a file system with severe filename restrictions, - such as DOS. The format of the file name map file is just a series - of lines with two tokens on each line. The first token is the name - to map, and the second token is the actual name to use. */ - -struct file_name_map -{ - struct file_name_map *map_next; - char *map_from; - char *map_to; -}; - -#define FILE_NAME_MAP_FILE "header.gcc" - -/* Read a space delimited string of unlimited length from a stdio - file. */ - -static char * -read_filename_string (ch, f) - int ch; - FILE *f; -{ - char *alloc, *set; - int len; - - len = 20; - set = alloc = xmalloc (len + 1); - if (! is_space[ch]) - { - *set++ = ch; - while ((ch = getc (f)) != EOF && ! is_space[ch]) - { - if (set - alloc == len) - { - len *= 2; - alloc = xrealloc (alloc, len + 1); - set = alloc + len / 2; - } - *set++ = ch; - } - } - *set = '\0'; - ungetc (ch, f); - return alloc; -} - -/* Read the file name map file for DIRNAME. - If DIRNAME is empty, read the map file for the working directory; - otherwise DIRNAME must end in '/'. */ - -static struct file_name_map * -read_name_map (dirname) - char *dirname; -{ - /* This structure holds a linked list of file name maps, one per - directory. */ - struct file_name_map_list - { - struct file_name_map_list *map_list_next; - char *map_list_name; - struct file_name_map *map_list_map; - }; - static struct file_name_map_list *map_list; - register struct file_name_map_list *map_list_ptr; - char *name; - FILE *f; - size_t dirlen; - - for (map_list_ptr = map_list; map_list_ptr; - map_list_ptr = map_list_ptr->map_list_next) - if (! strcmp (map_list_ptr->map_list_name, dirname)) - return map_list_ptr->map_list_map; - - map_list_ptr = ((struct file_name_map_list *) - xmalloc (sizeof (struct file_name_map_list))); - map_list_ptr->map_list_name = xstrdup (dirname); - map_list_ptr->map_list_map = NULL; - - dirlen = strlen (dirname); - name = (char *) alloca (dirlen + strlen (FILE_NAME_MAP_FILE) + 1); - strcpy (name, dirname); - strcat (name, FILE_NAME_MAP_FILE); - f = fopen (name, "r"); - if (!f) - map_list_ptr->map_list_map = NULL; - else - { - int ch; - - while ((ch = getc (f)) != EOF) - { - char *from, *to; - struct file_name_map *ptr; - size_t tolen; - - if (is_space[ch]) - continue; - from = read_filename_string (ch, f); - while ((ch = getc (f)) != EOF && is_hor_space[ch]) - ; - to = read_filename_string (ch, f); - - simplify_filename (from); - tolen = simplify_filename (to); - - ptr = ((struct file_name_map *) - xmalloc (sizeof (struct file_name_map))); - ptr->map_from = from; - - /* Make the real filename absolute. */ - if (absolute_filename (to)) - ptr->map_to = to; - else - { - ptr->map_to = xmalloc (dirlen + tolen + 1); - strcpy (ptr->map_to, dirname); - strcat (ptr->map_to, to); - free (to); - } - - ptr->map_next = map_list_ptr->map_list_map; - map_list_ptr->map_list_map = ptr; - - while ((ch = getc (f)) != '\n') - if (ch == EOF) - break; - } - fclose (f); - } - - map_list_ptr->map_list_next = map_list; - map_list = map_list_ptr; - - return map_list_ptr->map_list_map; -} - -/* Try to open include file FILENAME. SEARCHPTR is the directory - being tried from the include file search path. - IMPORTING is "" if we are importing, null otherwise. - Return -2 if found, either a matching name or a matching inode. - Otherwise, open the file and return a file descriptor if successful - or -1 if unsuccessful. - Unless unsuccessful, put a descriptor of the included file into *PINC. - This function maps filenames on file systems based on information read by - read_name_map. */ - -static int -open_include_file (filename, searchptr, importing, pinc) - char *filename; - struct file_name_list *searchptr; - U_CHAR *importing; - struct include_file **pinc; -{ - char *fname = remap ? remap_include_file (filename, searchptr) : filename; - int fd = -2; - - /* Look up FNAME in include_hashtab. */ - struct include_file **phead = &include_hashtab[hashf ((U_CHAR *) fname, - strlen (fname), - INCLUDE_HASHSIZE)]; - struct include_file *inc, *head = *phead; - for (inc = head; inc; inc = inc->next) - if (!strcmp (fname, inc->fname)) - break; - - if (!inc - || ! inc->control_macro - || (inc->control_macro[0] && ! lookup (inc->control_macro, -1, -1))) { - - fd = open (fname, O_RDONLY, 0); - - if (fd < 0) - { -#ifdef VMS - /* if #include fails, try again with hacked spec. */ - if (!hack_vms_include_specification (fname, 0)) - return fd; - fd = open (fname, O_RDONLY, 0); - if (fd < 0) -#endif - return fd; - } - - if (!inc) { - /* FNAME was not in include_hashtab; insert a new entry. */ - inc = (struct include_file *) xmalloc (sizeof (struct include_file)); - inc->next = head; - inc->fname = fname; - inc->control_macro = 0; - inc->deps_output = 0; - if (fstat (fd, &inc->st) != 0) - pfatal_with_name (fname); - *phead = inc; - - /* Look for another file with the same inode and device. */ - if (lookup_ino_include (inc) - && inc->control_macro - && (!inc->control_macro[0] || lookup (inc->control_macro, -1, -1))) { - close (fd); - fd = -2; - } - } - - /* For -M, add this file to the dependencies. */ - if (! inc->deps_output && (system_include_depth != 0) < print_deps) { - inc->deps_output = 1; - deps_output (fname, ' '); - } - - /* Handle -H option. */ - if (print_include_names) - fprintf (stderr, "%*s%s\n", indepth, "", fname); - } - - if (importing) - inc->control_macro = importing; - - *pinc = inc; - return fd; -} - -/* Return the remapped name of the include file FILENAME. - SEARCHPTR is the directory being tried from the include file path. */ - -static char * -remap_include_file (filename, searchptr) - char *filename; - struct file_name_list *searchptr; -{ - register struct file_name_map *map; - register char *from; - - if (searchptr) - { - if (! searchptr->got_name_map) - { - searchptr->name_map = read_name_map (searchptr->fname); - searchptr->got_name_map = 1; - } - - /* Check the mapping for the directory we are using. */ - from = filename + strlen (searchptr->fname); - for (map = searchptr->name_map; map; map = map->map_next) - if (! strcmp (map->map_from, from)) - return map->map_to; - } - - from = base_name (filename); - - if (from != filename || !searchptr) - { - /* Try to find a mapping file for the particular directory we are - looking in. Thus #include will look up sys/types.h - in /usr/include/header.gcc and look up types.h in - /usr/include/sys/header.gcc. */ - - char *dir = (char *) alloca (from - filename + 1); - bcopy (filename, dir, from - filename); - dir[from - filename] = '\0'; - - for (map = read_name_map (dir); map; map = map->map_next) - if (! strcmp (map->map_from, from)) - return map->map_to; - } - - return filename; -} - -/* Insert INC into the include file table, hashed by device and inode number. - If a file with different name but same dev+ino was already in the table, - return 1 and set INC's control macro to the already-known macro. */ - -static int -lookup_ino_include (inc) - struct include_file *inc; -{ - int hash = ((unsigned) (inc->st.st_dev + INO_T_HASH (inc->st.st_ino)) - % INCLUDE_HASHSIZE); - struct include_file *i = include_ino_hashtab[hash]; - inc->next_ino = i; - include_ino_hashtab[hash] = inc; - - for (; i; i = i->next_ino) - if (INO_T_EQ (inc->st.st_ino, i->st.st_ino) - && inc->st.st_dev == i->st.st_dev) { - inc->control_macro = i->control_macro; - return 1; - } - - return 0; -} - -/* Process file descriptor F, which corresponds to include file INC, - with output to OP. - SYSTEM_HEADER_P is 1 if this file resides in any one of the known - "system" include directories (as decided by the `is_system_include' - function above). - DIRPTR is the link in the dir path through which this file was found, - or 0 if the file name was absolute. */ - -static void -finclude (f, inc, op, system_header_p, dirptr) - int f; - struct include_file *inc; - FILE_BUF *op; - int system_header_p; - struct file_name_list *dirptr; -{ - char *fname = inc->fname; - int i; - FILE_BUF *fp; /* For input stack frame */ - int missing_newline = 0; - - CHECK_DEPTH (return;); - - fp = &instack[indepth + 1]; - bzero ((char *) fp, sizeof (FILE_BUF)); - fp->nominal_fname = fp->fname = fname; - fp->nominal_fname_len = strlen (fname); - fp->inc = inc; - fp->length = 0; - fp->lineno = 1; - fp->if_stack = if_stack; - fp->system_header_p = system_header_p; - fp->dir = dirptr; - - if (S_ISREG (inc->st.st_mode)) { - size_t s = (size_t) inc->st.st_size; - if (s != inc->st.st_size || s + 2 < s) - memory_full (); - fp->buf = (U_CHAR *) xmalloc (s + 2); - fp->bufp = fp->buf; - - /* Read the file contents, knowing that s is an upper bound - on the number of bytes we can read. */ - fp->length = safe_read (f, (char *) fp->buf, s); - if (fp->length < 0) goto nope; - } - else if (S_ISDIR (inc->st.st_mode)) { - error ("directory `%s' specified in #include", fname); - close (f); - return; - } else { - /* Cannot count its file size before reading. - First read the entire file into heap and - copy them into buffer on stack. */ - - int bsize = 2000; - int st_size = 0; - - fp->buf = (U_CHAR *) xmalloc (bsize + 2); - - for (;;) { - i = safe_read (f, (char *) fp->buf + st_size, bsize - st_size); - if (i < 0) - goto nope; /* error! */ - st_size += i; - if (st_size != bsize) - break; /* End of file */ - bsize *= 2; - fp->buf = (U_CHAR *) xrealloc (fp->buf, bsize + 2); - } - fp->bufp = fp->buf; - fp->length = st_size; - } - - if ((fp->length > 0 && fp->buf[fp->length - 1] != '\n') - /* Backslash-newline at end is not good enough. */ - || (fp->length > 1 && fp->buf[fp->length - 2] == '\\')) { - fp->buf[fp->length++] = '\n'; - missing_newline = 1; - } - fp->buf[fp->length] = '\0'; - - /* Close descriptor now, so nesting does not use lots of descriptors. */ - close (f); - - /* Must do this before calling trigraph_pcp, so that the correct file name - will be printed in warning messages. */ - - indepth++; - input_file_stack_tick++; - - if (!no_trigraphs) - trigraph_pcp (fp); - - output_line_directive (fp, op, 0, enter_file); - rescan (op, 0); - - if (missing_newline) - fp->lineno--; - - if (pedantic && missing_newline) - pedwarn ("file does not end in newline"); - - indepth--; - input_file_stack_tick++; - output_line_directive (&instack[indepth], op, 0, leave_file); - free (fp->buf); - return; - - nope: - - perror_with_name (fname); - close (f); - free (fp->buf); -} - -/* Record that inclusion of the include file INC - should be controlled by the macro named MACRO_NAME. - This means that trying to include the file again - will do something if that macro is defined. */ - -static void -record_control_macro (inc, macro_name) - struct include_file *inc; - U_CHAR *macro_name; -{ - if (!inc->control_macro || inc->control_macro[0]) - inc->control_macro = macro_name; -} - -/* Load the specified precompiled header into core, and verify its - preconditions. PCF indicates the file descriptor to read, which must - be a regular file. *ST is its file status. - FNAME indicates the file name of the original header. - *LIMIT will be set to an address one past the end of the file. - If the preconditions of the file are not satisfied, the buffer is - freed and we return 0. If the preconditions are satisfied, return - the address of the buffer following the preconditions. The buffer, in - this case, should never be freed because various pieces of it will - be referred to until all precompiled strings are output at the end of - the run. */ - -static char * -check_precompiled (pcf, st, fname, limit) - int pcf; - struct stat *st; - char *fname ATTRIBUTE_UNUSED; - char **limit; -{ - int length = 0; - char *buf; - char *cp; - - if (pcp_outfile) - return 0; - - if (S_ISREG (st->st_mode)) - { - size_t s = (size_t) st->st_size; - if (s != st->st_size || s + 2 < s) - memory_full (); - buf = xmalloc (s + 2); - length = safe_read (pcf, buf, s); - if (length < 0) - goto nope; - } - else - abort (); - - if (length > 0 && buf[length-1] != '\n') - buf[length++] = '\n'; - buf[length] = '\0'; - - *limit = buf + length; - - /* File is in core. Check the preconditions. */ - if (!check_preconditions (buf)) - goto nope; - for (cp = buf; *cp; cp++) - ; -#ifdef DEBUG_PCP - fprintf (stderr, "Using preinclude %s\n", fname); -#endif - return cp + 1; - - nope: -#ifdef DEBUG_PCP - fprintf (stderr, "Cannot use preinclude %s\n", fname); -#endif - free (buf); - return 0; -} - -/* PREC (null terminated) points to the preconditions of a - precompiled header. These are a series of #define and #undef - lines which must match the current contents of the hash - table. */ - -static int -check_preconditions (prec) - char *prec; -{ - MACRODEF mdef; - char *lineend; - - while (*prec) { - lineend = index (prec, '\n'); - - if (*prec++ != '#') { - error ("Bad format encountered while reading precompiled file"); - return 0; - } - if (!strncmp (prec, "define", 6)) { - HASHNODE *hp; - - prec += 6; - mdef = create_definition ((U_CHAR *) prec, (U_CHAR *) lineend, NULL_PTR); - - if (mdef.defn == 0) - abort (); - - if ((hp = lookup (mdef.symnam, mdef.symlen, -1)) == NULL - || (hp->type != T_MACRO && hp->type != T_CONST) - || (hp->type == T_MACRO - && !compare_defs (mdef.defn, hp->value.defn) - && (mdef.defn->length != 2 - || mdef.defn->expansion[0] != '\n' - || mdef.defn->expansion[1] != ' '))) - return 0; - } else if (!strncmp (prec, "undef", 5)) { - char *name; - int len; - - prec += 5; - while (is_hor_space[(U_CHAR) *prec]) - prec++; - name = prec; - while (is_idchar[(U_CHAR) *prec]) - prec++; - len = prec - name; - - if (lookup ((U_CHAR *) name, len, -1)) - return 0; - } else { - error ("Bad format encountered while reading precompiled file"); - return 0; - } - prec = lineend + 1; - } - /* They all passed successfully */ - return 1; -} - -/* Process the main body of a precompiled file. BUF points to the - string section of the file, following the preconditions. LIMIT is one - character past the end. NAME is the name of the file being read - in. OP is the main output buffer. */ - -static void -pcfinclude (buf, name, op) - U_CHAR *buf, *name; - FILE_BUF *op; -{ - FILE_BUF tmpbuf; - int nstrings; - U_CHAR *cp = buf; - - /* First in the file comes 4 bytes indicating the number of strings, */ - /* in network byte order. (MSB first). */ - nstrings = *cp++; - nstrings = (nstrings << 8) | *cp++; - nstrings = (nstrings << 8) | *cp++; - nstrings = (nstrings << 8) | *cp++; - - /* Looping over each string... */ - while (nstrings--) { - U_CHAR *string_start; - U_CHAR *endofthiskey; - STRINGDEF *str; - int nkeys; - - /* Each string starts with a STRINGDEF structure (str), followed */ - /* by the text of the string (string_start) */ - - /* First skip to a longword boundary */ - /* ??? Why a 4-byte boundary? On all machines? */ - /* NOTE: This works correctly even if size_t - is narrower than a pointer. - Do not try risky measures here to get another type to use! - Do not include stddef.h--it will fail! */ - if ((size_t) cp & 3) - cp += 4 - ((size_t) cp & 3); - - /* Now get the string. */ - str = (STRINGDEF *) (GENERIC_PTR) cp; - string_start = cp += sizeof (STRINGDEF); - - for (; *cp; cp++) /* skip the string */ - ; - - /* We need to macro expand the string here to ensure that the - proper definition environment is in place. If it were only - expanded when we find out it is needed, macros necessary for - its proper expansion might have had their definitions changed. */ - tmpbuf = expand_to_temp_buffer (string_start, cp++, 0, 0); - /* Lineno is already set in the precompiled file */ - str->contents = tmpbuf.buf; - str->len = tmpbuf.length; - str->writeflag = 0; - str->filename = name; - str->output_mark = outbuf.bufp - outbuf.buf; - - str->chain = 0; - *stringlist_tailp = str; - stringlist_tailp = &str->chain; - - /* Next comes a fourbyte number indicating the number of keys - for this string. */ - nkeys = *cp++; - nkeys = (nkeys << 8) | *cp++; - nkeys = (nkeys << 8) | *cp++; - nkeys = (nkeys << 8) | *cp++; - - /* If this number is -1, then the string is mandatory. */ - if (nkeys == -1) - str->writeflag = 1; - else - /* Otherwise, for each key, */ - for (; nkeys--; free (tmpbuf.buf), cp = endofthiskey + 1) { - KEYDEF *kp = (KEYDEF *) (GENERIC_PTR) cp; - HASHNODE *hp; - - /* It starts with a KEYDEF structure */ - cp += sizeof (KEYDEF); - - /* Find the end of the key. At the end of this for loop we - advance CP to the start of the next key using this variable. */ - endofthiskey = cp + strlen ((char *) cp); - kp->str = str; - - /* Expand the key, and enter it into the hash table. */ - tmpbuf = expand_to_temp_buffer (cp, endofthiskey, 0, 0); - tmpbuf.bufp = tmpbuf.buf; - - while (is_hor_space[*tmpbuf.bufp]) - tmpbuf.bufp++; - if (!is_idstart[*tmpbuf.bufp] - || tmpbuf.bufp == tmpbuf.buf + tmpbuf.length) { - str->writeflag = 1; - continue; - } - - hp = lookup (tmpbuf.bufp, -1, -1); - if (hp == NULL) { - kp->chain = 0; - install (tmpbuf.bufp, -1, T_PCSTRING, (char *) kp, -1); - } - else if (hp->type == T_PCSTRING) { - kp->chain = hp->value.keydef; - hp->value.keydef = kp; - } - else - str->writeflag = 1; - } - } - /* This output_line_directive serves to switch us back to the current - input file in case some of these strings get output (which will - result in line directives for the header file being output). */ - output_line_directive (&instack[indepth], op, 0, enter_file); -} - -/* Called from rescan when it hits a key for strings. Mark them all - used and clean up. */ - -static void -pcstring_used (hp) - HASHNODE *hp; -{ - KEYDEF *kp; - - for (kp = hp->value.keydef; kp; kp = kp->chain) - kp->str->writeflag = 1; - delete_macro (hp); -} - -/* Write the output, interspersing precompiled strings in their - appropriate places. */ - -static void -write_output () -{ - STRINGDEF *next_string; - U_CHAR *cur_buf_loc; - int line_directive_len = 80; - char *line_directive = xmalloc (line_directive_len); - int len; - - /* In each run through the loop, either cur_buf_loc == - next_string_loc, in which case we print a series of strings, or - it is less than next_string_loc, in which case we write some of - the buffer. */ - cur_buf_loc = outbuf.buf; - next_string = stringlist; - - while (cur_buf_loc < outbuf.bufp || next_string) { - if (next_string - && cur_buf_loc - outbuf.buf == next_string->output_mark) { - if (next_string->writeflag) { - len = 4 * strlen ((char *) next_string->filename) + 32; - while (len > line_directive_len) - line_directive = xrealloc (line_directive, - line_directive_len *= 2); - sprintf (line_directive, "\n# %d ", next_string->lineno); - strcpy (quote_string (line_directive + strlen (line_directive), - (char *) next_string->filename, - strlen ((char *) next_string->filename)), - "\n"); - safe_write (fileno (stdout), line_directive, strlen (line_directive)); - safe_write (fileno (stdout), - (char *) next_string->contents, next_string->len); - } - next_string = next_string->chain; - } - else { - len = (next_string - ? (next_string->output_mark - - (cur_buf_loc - outbuf.buf)) - : outbuf.bufp - cur_buf_loc); - - safe_write (fileno (stdout), (char *) cur_buf_loc, len); - cur_buf_loc += len; - } - } - free (line_directive); -} - -/* Pass a directive through to the output file. - BUF points to the contents of the directive, as a contiguous string. - LIMIT points to the first character past the end of the directive. - KEYWORD is the keyword-table entry for the directive. */ - -static void -pass_thru_directive (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword; -{ - register int keyword_length = keyword->length; - - check_expand (op, 1 + keyword_length + (limit - buf)); - *op->bufp++ = '#'; - bcopy (keyword->name, (char *) op->bufp, keyword_length); - op->bufp += keyword_length; - if (limit != buf && buf[0] != ' ') - *op->bufp++ = ' '; - bcopy ((char *) buf, (char *) op->bufp, limit - buf); - op->bufp += (limit - buf); -#if 0 - *op->bufp++ = '\n'; - /* Count the line we have just made in the output, - to get in sync properly. */ - op->lineno++; -#endif -} - -/* The arglist structure is built by do_define to tell - collect_definition where the argument names begin. That - is, for a define like "#define f(x,y,z) foo+x-bar*y", the arglist - would contain pointers to the strings x, y, and z. - Collect_definition would then build a DEFINITION node, - with reflist nodes pointing to the places x, y, and z had - appeared. So the arglist is just convenience data passed - between these two routines. It is not kept around after - the current #define has been processed and entered into the - hash table. */ - -struct arglist { - struct arglist *next; - U_CHAR *name; - int length; - int argno; - char rest_args; -}; - -/* Create a DEFINITION node from a #define directive. Arguments are - as for do_define. */ - -static MACRODEF -create_definition (buf, limit, op) - U_CHAR *buf, *limit; - FILE_BUF *op; -{ - U_CHAR *bp; /* temp ptr into input buffer */ - U_CHAR *symname; /* remember where symbol name starts */ - int sym_length; /* and how long it is */ - int line = instack[indepth].lineno; - char *file = instack[indepth].nominal_fname; - size_t file_len = instack[indepth].nominal_fname_len; - int rest_args = 0; - - DEFINITION *defn; - int arglengths = 0; /* Accumulate lengths of arg names - plus number of args. */ - MACRODEF mdef; - - bp = buf; - - while (is_hor_space[*bp]) - bp++; - - symname = bp; /* remember where it starts */ - sym_length = check_macro_name (bp, 0); - bp += sym_length; - - /* Lossage will occur if identifiers or control keywords are broken - across lines using backslash. This is not the right place to take - care of that. */ - - if (*bp == '(') { - struct arglist *arg_ptrs = NULL; - int argno = 0; - - bp++; /* skip '(' */ - SKIP_WHITE_SPACE (bp); - - /* Loop over macro argument names. */ - while (*bp != ')') { - struct arglist *temp; - - temp = (struct arglist *) alloca (sizeof (struct arglist)); - temp->name = bp; - temp->next = arg_ptrs; - temp->argno = argno++; - temp->rest_args = 0; - arg_ptrs = temp; - - if (rest_args) - pedwarn ("another parameter follows `%s'", - rest_extension); - - if (!is_idstart[*bp]) - { - if (c9x && limit - bp > (long) REST_EXTENSION_LENGTH - && bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) - { - /* This is the ISO C 9x way to write macros with variable - number of arguments. */ - rest_args = 1; - temp->rest_args = 1; - } - else - pedwarn ("invalid character in macro parameter name"); - } - - /* Find the end of the arg name. */ - while (is_idchar[*bp]) { - bp++; - /* do we have a "special" rest-args extension here? */ - if (limit - bp > (long) REST_EXTENSION_LENGTH - && bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) { - if (pedantic && !instack[indepth].system_header_p) - pedwarn ("ANSI C does not allow macro with variable arguments"); - rest_args = 1; - temp->rest_args = 1; - break; - } - } - if (bp == temp->name && rest_args == 1) - { - /* This is the ISO C 9x style. */ - temp->name = (U_CHAR *) va_args_name; - temp->length = VA_ARGS_NAME_LENGTH; - } - else - temp->length = bp - temp->name; - if (rest_args == 1) - bp += REST_EXTENSION_LENGTH; - arglengths += temp->length + 2; - SKIP_WHITE_SPACE (bp); - if (temp->length == 0 || (*bp != ',' && *bp != ')')) { - error ("badly punctuated parameter list in `#define'"); - goto nope; - } - if (*bp == ',') { - bp++; - SKIP_WHITE_SPACE (bp); - /* A comma at this point can only be followed by an identifier. */ - if (!is_idstart[*bp] - && !(c9x && limit - bp > (long) REST_EXTENSION_LENGTH - && bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0)) { - error ("badly punctuated parameter list in `#define'"); - goto nope; - } - } - if (bp >= limit) { - error ("unterminated parameter list in `#define'"); - goto nope; - } - { - struct arglist *otemp; - - for (otemp = temp->next; otemp != NULL; otemp = otemp->next) - if (temp->length == otemp->length - && bcmp (temp->name, otemp->name, temp->length) == 0) - { - error ("duplicate argument name `%.*s' in `#define'", - temp->length, temp->name); - goto nope; - } - if (rest_args == 0 && temp->length == VA_ARGS_NAME_LENGTH - && bcmp (temp->name, va_args_name, VA_ARGS_NAME_LENGTH) == 0) - { - error ("\ -reserved name `%s' used as argument name in `#define'", va_args_name); - goto nope; - } - } - } - - ++bp; /* skip paren */ - SKIP_WHITE_SPACE (bp); - /* now everything from bp before limit is the definition. */ - defn = collect_expansion (bp, limit, argno, arg_ptrs); - defn->rest_args = rest_args; - - /* Now set defn->args.argnames to the result of concatenating - the argument names in reverse order - with comma-space between them. */ - defn->args.argnames = (U_CHAR *) xmalloc (arglengths + 1); - { - struct arglist *temp; - int i = 0; - for (temp = arg_ptrs; temp; temp = temp->next) { - bcopy (temp->name, &defn->args.argnames[i], temp->length); - i += temp->length; - if (temp->next != 0) { - defn->args.argnames[i++] = ','; - defn->args.argnames[i++] = ' '; - } - } - defn->args.argnames[i] = 0; - } - } else { - /* Simple expansion or empty definition. */ - - if (bp < limit) - { - if (is_hor_space[*bp]) { - bp++; - SKIP_WHITE_SPACE (bp); - } else if (sym_length) { - switch (*bp) { - case '!': case '"': case '#': case '%': case '&': case '\'': - case ')': case '*': case '+': case ',': case '-': case '.': - case '/': case ':': case ';': case '<': case '=': case '>': - case '?': case '[': case '\\': case ']': case '^': case '{': - case '|': case '}': case '~': - warning ("missing white space after `#define %.*s'", - sym_length, symname); - break; - - default: - pedwarn ("missing white space after `#define %.*s'", - sym_length, symname); - break; - } - } - } - /* Now everything from bp before limit is the definition. */ - defn = collect_expansion (bp, limit, -1, NULL_PTR); - defn->args.argnames = (U_CHAR *) ""; - } - - defn->line = line; - defn->file = file; - defn->file_len = file_len; - - /* OP is null if this is a predefinition */ - defn->predefined = !op; - mdef.defn = defn; - mdef.symnam = symname; - mdef.symlen = sym_length; - - return mdef; - - nope: - mdef.defn = 0; - return mdef; -} - -/* Process a #define directive. -BUF points to the contents of the #define directive, as a contiguous string. -LIMIT points to the first character past the end of the definition. -KEYWORD is the keyword-table entry for #define. */ - -static int -do_define (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword; -{ - int hashcode; - MACRODEF mdef; - - /* If this is a precompiler run (with -pcp) pass thru #define directives. */ - if (pcp_outfile && op) - pass_thru_directive (buf, limit, op, keyword); - - mdef = create_definition (buf, limit, op); - if (mdef.defn == 0) - goto nope; - - hashcode = hashf (mdef.symnam, mdef.symlen, HASHSIZE); - - { - HASHNODE *hp; - if ((hp = lookup (mdef.symnam, mdef.symlen, hashcode)) != NULL) { - int ok = 0; - /* Redefining a precompiled key is ok. */ - if (hp->type == T_PCSTRING) - ok = 1; - /* Redefining a macro is ok if the definitions are the same. */ - else if (hp->type == T_MACRO) - ok = ! compare_defs (mdef.defn, hp->value.defn); - /* Redefining a constant is ok with -D. */ - else if (hp->type == T_CONST) - ok = ! done_initializing; - /* Print the warning if it's not ok. */ - if (!ok) { - /* If we are passing through #define and #undef directives, do - that for this re-definition now. */ - if (debug_output && op) - pass_thru_directive (buf, limit, op, keyword); - - pedwarn ("`%.*s' redefined", mdef.symlen, mdef.symnam); - if (hp->type == T_MACRO) - pedwarn_with_file_and_line (hp->value.defn->file, - hp->value.defn->file_len, - hp->value.defn->line, - "this is the location of the previous definition"); - } - /* Replace the old definition. */ - hp->type = T_MACRO; - hp->value.defn = mdef.defn; - } else { - /* If we are passing through #define and #undef directives, do - that for this new definition now. */ - if (debug_output && op) - pass_thru_directive (buf, limit, op, keyword); - install (mdef.symnam, mdef.symlen, T_MACRO, - (char *) mdef.defn, hashcode); - } - } - - return 0; - -nope: - - return 1; -} - -/* Check a purported macro name SYMNAME, and yield its length. - ASSERTION is nonzero if this is really for an assertion name. */ - -static int -check_macro_name (symname, assertion) - U_CHAR *symname; - int assertion; -{ - U_CHAR *p; - int sym_length; - - for (p = symname; is_idchar[*p]; p++) - ; - sym_length = p - symname; - if (sym_length == 0 - || (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '"'))) - error (assertion ? "invalid assertion name" : "invalid macro name"); - else if (!is_idstart[*symname] - || (sym_length == 7 && ! bcmp (symname, "defined", 7))) - error ((assertion - ? "invalid assertion name `%.*s'" - : "invalid macro name `%.*s'"), - sym_length, symname); - return sym_length; -} - -/* Return zero if two DEFINITIONs are isomorphic. */ - -static int -compare_defs (d1, d2) - DEFINITION *d1, *d2; -{ - register struct reflist *a1, *a2; - register U_CHAR *p1 = d1->expansion; - register U_CHAR *p2 = d2->expansion; - int first = 1; - - if (d1->nargs != d2->nargs) - return 1; - if (pedantic - && strcmp ((char *)d1->args.argnames, (char *)d2->args.argnames)) - return 1; - for (a1 = d1->pattern, a2 = d2->pattern; a1 && a2; - a1 = a1->next, a2 = a2->next) { - if (!((a1->nchars == a2->nchars && ! bcmp (p1, p2, a1->nchars)) - || ! comp_def_part (first, p1, a1->nchars, p2, a2->nchars, 0)) - || a1->argno != a2->argno - || a1->stringify != a2->stringify - || a1->raw_before != a2->raw_before - || a1->raw_after != a2->raw_after) - return 1; - first = 0; - p1 += a1->nchars; - p2 += a2->nchars; - } - if (a1 != a2) - return 1; - if (comp_def_part (first, p1, d1->length - (p1 - d1->expansion), - p2, d2->length - (p2 - d2->expansion), 1)) - return 1; - return 0; -} - -/* Return 1 if two parts of two macro definitions are effectively different. - One of the parts starts at BEG1 and has LEN1 chars; - the other has LEN2 chars at BEG2. - Any sequence of whitespace matches any other sequence of whitespace. - FIRST means these parts are the first of a macro definition; - so ignore leading whitespace entirely. - LAST means these parts are the last of a macro definition; - so ignore trailing whitespace entirely. */ - -static int -comp_def_part (first, beg1, len1, beg2, len2, last) - int first; - U_CHAR *beg1, *beg2; - int len1, len2; - int last; -{ - register U_CHAR *end1 = beg1 + len1; - register U_CHAR *end2 = beg2 + len2; - if (first) { - while (beg1 != end1 && is_space[*beg1]) beg1++; - while (beg2 != end2 && is_space[*beg2]) beg2++; - } - if (last) { - while (beg1 != end1 && is_space[end1[-1]]) end1--; - while (beg2 != end2 && is_space[end2[-1]]) end2--; - } - while (beg1 != end1 && beg2 != end2) { - if (is_space[*beg1] && is_space[*beg2]) { - while (beg1 != end1 && is_space[*beg1]) beg1++; - while (beg2 != end2 && is_space[*beg2]) beg2++; - } else if (*beg1 == *beg2) { - beg1++; beg2++; - } else break; - } - return (beg1 != end1) || (beg2 != end2); -} - -/* Read a replacement list for a macro with parameters. - Build the DEFINITION structure. - Reads characters of text starting at BUF until END. - ARGLIST specifies the formal parameters to look for - in the text of the definition; NARGS is the number of args - in that list, or -1 for a macro name that wants no argument list. - MACRONAME is the macro name itself (so we can avoid recursive expansion) - and NAMELEN is its length in characters. - -Note that comments, backslash-newlines, and leading white space -have already been deleted from the argument. */ - -/* If there is no trailing whitespace, a Newline Space is added at the end - to prevent concatenation that would be contrary to the standard. */ - -static DEFINITION * -collect_expansion (buf, end, nargs, arglist) - U_CHAR *buf, *end; - int nargs; - struct arglist *arglist; -{ - DEFINITION *defn; - register U_CHAR *p, *limit, *lastp, *exp_p; - struct reflist *endpat = NULL; - /* Pointer to first nonspace after last ## seen. */ - U_CHAR *concat = 0; - /* Pointer to first nonspace after last single-# seen. */ - U_CHAR *stringify = 0; - /* How those tokens were spelled. */ - enum sharp_token_type concat_sharp_token_type = NO_SHARP_TOKEN; - enum sharp_token_type stringify_sharp_token_type = NO_SHARP_TOKEN; - int maxsize; - int expected_delimiter = '\0'; - - /* Scan thru the replacement list, ignoring comments and quoted - strings, picking up on the macro calls. It does a linear search - thru the arg list on every potential symbol. Profiling might say - that something smarter should happen. */ - - if (end < buf) - abort (); - - /* Find the beginning of the trailing whitespace. */ - limit = end; - p = buf; - while (p < limit && is_space[limit[-1]]) limit--; - - /* Allocate space for the text in the macro definition. - Each input char may or may not need 1 byte, - so this is an upper bound. - The extra 3 are for invented trailing newline-marker and final null. */ - maxsize = (sizeof (DEFINITION) - + (limit - p) + 3); - defn = (DEFINITION *) xcalloc (1, maxsize); - - defn->nargs = nargs; - exp_p = defn->expansion = (U_CHAR *) defn + sizeof (DEFINITION); - lastp = exp_p; - - if (p[0] == '#' - ? p[1] == '#' - : p[0] == '%' && p[1] == ':' && p[2] == '%' && p[3] == ':') { - error ("`##' at start of macro definition"); - p += p[0] == '#' ? 2 : 4; - } - - /* Process the main body of the definition. */ - while (p < limit) { - int skipped_arg = 0; - register U_CHAR c = *p++; - - *exp_p++ = c; - - if (!traditional) { - switch (c) { - case '\'': - case '\"': - if (expected_delimiter != '\0') { - if (c == expected_delimiter) - expected_delimiter = '\0'; - } else - expected_delimiter = c; - break; - - case '\\': - if (p < limit && expected_delimiter) { - /* In a string, backslash goes through - and makes next char ordinary. */ - *exp_p++ = *p++; - } - break; - - case '%': - if (!expected_delimiter && *p == ':') { - /* %: is not a digraph if preceded by an odd number of '<'s. */ - U_CHAR *p0 = p - 1; - while (buf < p0 && p0[-1] == '<') - p0--; - if ((p - p0) & 1) { - /* Treat %:%: as ## and %: as #. */ - if (p[1] == '%' && p[2] == ':') { - p += 2; - goto sharp_sharp_token; - } - if (nargs >= 0) { - p++; - goto sharp_token; - } - } - } - break; - - case '#': - /* # is ordinary inside a string. */ - if (expected_delimiter) - break; - if (*p == '#') { - sharp_sharp_token: - /* ##: concatenate preceding and following tokens. */ - /* Take out the first #, discard preceding whitespace. */ - exp_p--; - while (exp_p > lastp && is_hor_space[exp_p[-1]]) - --exp_p; - /* Skip the second #. */ - p++; - concat_sharp_token_type = c; - if (is_hor_space[*p]) { - concat_sharp_token_type = c + 1; - p++; - SKIP_WHITE_SPACE (p); - } - concat = p; - if (p == limit) - error ("`##' at end of macro definition"); - } else if (nargs >= 0) { - /* Single #: stringify following argument ref. - Don't leave the # in the expansion. */ - sharp_token: - exp_p--; - stringify_sharp_token_type = c; - if (is_hor_space[*p]) { - stringify_sharp_token_type = c + 1; - p++; - SKIP_WHITE_SPACE (p); - } - if (! is_idstart[*p] || nargs == 0 - || (*p == 'L' && (p[1] == '\'' || p[1] == '"'))) - error ("`#' operator is not followed by a macro argument name"); - else - stringify = p; - } - break; - } - } else { - /* In -traditional mode, recognize arguments inside strings and - character constants, and ignore special properties of #. - Arguments inside strings are considered "stringified", but no - extra quote marks are supplied. */ - switch (c) { - case '\'': - case '\"': - if (expected_delimiter != '\0') { - if (c == expected_delimiter) - expected_delimiter = '\0'; - } else - expected_delimiter = c; - break; - - case '\\': - /* Backslash quotes delimiters and itself, but not macro args. */ - if (expected_delimiter != 0 && p < limit - && (*p == expected_delimiter || *p == '\\')) { - *exp_p++ = *p++; - continue; - } - break; - - case '/': - if (expected_delimiter != '\0') /* No comments inside strings. */ - break; - if (*p == '*') { - /* If we find a comment that wasn't removed by handle_directive, - this must be -traditional. So replace the comment with - nothing at all. */ - exp_p--; - while (++p < limit) { - if (p[0] == '*' && p[1] == '/') { - p += 2; - break; - } - } -#if 0 - /* Mark this as a concatenation-point, as if it had been ##. */ - concat = p; -#endif - } - break; - } - } - -#ifdef MULTIBYTE_CHARS - /* Handle multibyte characters inside string and character literals. */ - if (expected_delimiter != '\0') - { - int length; - --p; - length = local_mblen (p, limit - p); - if (length > 1) - { - --exp_p; - bcopy (p, exp_p, length); - p += length; - exp_p += length; - continue; - } - ++p; - } -#endif - - /* Handle the start of a symbol. */ - if (is_idchar[c] && nargs > 0) { - U_CHAR *id_beg = p - 1; - int id_len; - - --exp_p; - while (p != limit && is_idchar[*p]) p++; - id_len = p - id_beg; - - if (is_idstart[c] - && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '"'))) { - register struct arglist *arg; - - for (arg = arglist; arg != NULL; arg = arg->next) { - struct reflist *tpat; - - if (arg->name[0] == c - && arg->length == id_len - && bcmp (arg->name, id_beg, id_len) == 0) { - enum sharp_token_type tpat_stringify; - if (expected_delimiter) { - if (warn_stringify) { - if (traditional) { - warning ("macro argument `%.*s' is stringified.", - id_len, arg->name); - } else { - warning ("macro arg `%.*s' would be stringified with -traditional.", - id_len, arg->name); - } - } - /* If ANSI, don't actually substitute inside a string. */ - if (!traditional) - break; - tpat_stringify = SHARP_TOKEN; - } else { - tpat_stringify - = (stringify == id_beg - ? stringify_sharp_token_type : NO_SHARP_TOKEN); - } - /* make a pat node for this arg and append it to the end of - the pat list */ - tpat = (struct reflist *) xmalloc (sizeof (struct reflist)); - tpat->next = NULL; - tpat->raw_before - = concat == id_beg ? concat_sharp_token_type : NO_SHARP_TOKEN; - tpat->raw_after = NO_SHARP_TOKEN; - tpat->rest_args = arg->rest_args; - tpat->stringify = tpat_stringify; - - if (endpat == NULL) - defn->pattern = tpat; - else - endpat->next = tpat; - endpat = tpat; - - tpat->argno = arg->argno; - tpat->nchars = exp_p - lastp; - { - register U_CHAR *p1 = p; - SKIP_WHITE_SPACE (p1); - if (p1[0]=='#' - ? p1[1]=='#' - : p1[0]=='%' && p1[1]==':' && p1[2]=='%' && p1[3]==':') - tpat->raw_after = p1[0] + (p != p1); - } - lastp = exp_p; /* place to start copying from next time */ - skipped_arg = 1; - break; - } - } - } - - /* If this was not a macro arg, copy it into the expansion. */ - if (! skipped_arg) { - register U_CHAR *lim1 = p; - p = id_beg; - while (p != lim1) - *exp_p++ = *p++; - if (stringify == id_beg) - error ("`#' operator should be followed by a macro argument name"); - } - } - } - - if (!traditional && expected_delimiter == 0) { - /* If ANSI, put in a newline-space marker to prevent token pasting. - But not if "inside a string" (which in ANSI mode happens only for - -D option). */ - *exp_p++ = '\n'; - *exp_p++ = ' '; - } - - *exp_p = '\0'; - - defn->length = exp_p - defn->expansion; - - /* Crash now if we overrun the allocated size. */ - if (defn->length + 1 > maxsize) - abort (); - -#if 0 -/* This isn't worth the time it takes. */ - /* give back excess storage */ - defn->expansion = (U_CHAR *) xrealloc (defn->expansion, defn->length + 1); -#endif - - return defn; -} - -static int -do_assert (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op ATTRIBUTE_UNUSED; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - U_CHAR *bp; /* temp ptr into input buffer */ - U_CHAR *symname; /* remember where symbol name starts */ - int sym_length; /* and how long it is */ - struct arglist *tokens = NULL; - - if (pedantic && done_initializing && !instack[indepth].system_header_p) - pedwarn ("ANSI C does not allow `#assert'"); - - bp = buf; - - while (is_hor_space[*bp]) - bp++; - - symname = bp; /* remember where it starts */ - sym_length = check_macro_name (bp, 1); - bp += sym_length; - /* #define doesn't do this, but we should. */ - SKIP_WHITE_SPACE (bp); - - /* Lossage will occur if identifiers or control tokens are broken - across lines using backslash. This is not the right place to take - care of that. */ - - if (*bp != '(') { - error ("missing token-sequence in `#assert'"); - return 1; - } - - { - int error_flag = 0; - - bp++; /* skip '(' */ - SKIP_WHITE_SPACE (bp); - - tokens = read_token_list (&bp, limit, &error_flag); - if (error_flag) - return 1; - if (tokens == 0) { - error ("empty token-sequence in `#assert'"); - return 1; - } - - ++bp; /* skip paren */ - SKIP_WHITE_SPACE (bp); - } - - /* If this name isn't already an assertion name, make it one. - Error if it was already in use in some other way. */ - - { - ASSERTION_HASHNODE *hp; - int hashcode = hashf (symname, sym_length, ASSERTION_HASHSIZE); - struct tokenlist_list *value - = (struct tokenlist_list *) xmalloc (sizeof (struct tokenlist_list)); - - hp = assertion_lookup (symname, sym_length, hashcode); - if (hp == NULL) { - if (sym_length == 7 && ! bcmp (symname, "defined", 7)) - error ("`defined' redefined as assertion"); - hp = assertion_install (symname, sym_length, hashcode); - } - - /* Add the spec'd token-sequence to the list of such. */ - value->tokens = tokens; - value->next = hp->value; - hp->value = value; - } - - return 0; -} - -static int -do_unassert (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op ATTRIBUTE_UNUSED; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - U_CHAR *bp; /* temp ptr into input buffer */ - U_CHAR *symname; /* remember where symbol name starts */ - int sym_length; /* and how long it is */ - - struct arglist *tokens = NULL; - int tokens_specified = 0; - - if (pedantic && done_initializing && !instack[indepth].system_header_p) - pedwarn ("ANSI C does not allow `#unassert'"); - - bp = buf; - - while (is_hor_space[*bp]) - bp++; - - symname = bp; /* remember where it starts */ - sym_length = check_macro_name (bp, 1); - bp += sym_length; - /* #define doesn't do this, but we should. */ - SKIP_WHITE_SPACE (bp); - - /* Lossage will occur if identifiers or control tokens are broken - across lines using backslash. This is not the right place to take - care of that. */ - - if (*bp == '(') { - int error_flag = 0; - - bp++; /* skip '(' */ - SKIP_WHITE_SPACE (bp); - - tokens = read_token_list (&bp, limit, &error_flag); - if (error_flag) - return 1; - if (tokens == 0) { - error ("empty token list in `#unassert'"); - return 1; - } - - tokens_specified = 1; - - ++bp; /* skip paren */ - SKIP_WHITE_SPACE (bp); - } - - { - ASSERTION_HASHNODE *hp; - int hashcode = hashf (symname, sym_length, ASSERTION_HASHSIZE); - struct tokenlist_list *tail, *prev; - - hp = assertion_lookup (symname, sym_length, hashcode); - if (hp == NULL) - return 1; - - /* If no token list was specified, then eliminate this assertion - entirely. */ - if (! tokens_specified) { - struct tokenlist_list *next; - for (tail = hp->value; tail; tail = next) { - next = tail->next; - free_token_list (tail->tokens); - free (tail); - } - delete_assertion (hp); - } else { - /* If a list of tokens was given, then delete any matching list. */ - - tail = hp->value; - prev = 0; - while (tail) { - struct tokenlist_list *next = tail->next; - if (compare_token_lists (tail->tokens, tokens)) { - if (prev) - prev->next = next; - else - hp->value = tail->next; - free_token_list (tail->tokens); - free (tail); - } else { - prev = tail; - } - tail = next; - } - } - } - - return 0; -} - -/* Test whether there is an assertion named NAME - and optionally whether it has an asserted token list TOKENS. - NAME is not null terminated; its length is SYM_LENGTH. - If TOKENS_SPECIFIED is 0, then don't check for any token list. */ - -int -check_assertion (name, sym_length, tokens_specified, tokens) - U_CHAR *name; - int sym_length; - int tokens_specified; - struct arglist *tokens; -{ - ASSERTION_HASHNODE *hp; - int hashcode = hashf (name, sym_length, ASSERTION_HASHSIZE); - - if (pedantic && !instack[indepth].system_header_p) - pedwarn ("ANSI C does not allow testing assertions"); - - hp = assertion_lookup (name, sym_length, hashcode); - if (hp == NULL) - /* It is not an assertion; just return false. */ - return 0; - - /* If no token list was specified, then value is 1. */ - if (! tokens_specified) - return 1; - - { - struct tokenlist_list *tail; - - tail = hp->value; - - /* If a list of tokens was given, - then succeed if the assertion records a matching list. */ - - while (tail) { - if (compare_token_lists (tail->tokens, tokens)) - return 1; - tail = tail->next; - } - - /* Fail if the assertion has no matching list. */ - return 0; - } -} - -/* Compare two lists of tokens for equality including order of tokens. */ - -static int -compare_token_lists (l1, l2) - struct arglist *l1, *l2; -{ - while (l1 && l2) { - if (l1->length != l2->length) - return 0; - if (bcmp (l1->name, l2->name, l1->length)) - return 0; - l1 = l1->next; - l2 = l2->next; - } - - /* Succeed if both lists end at the same time. */ - return l1 == l2; -} - -/* Read a space-separated list of tokens ending in a close parenthesis. - Return a list of strings, in the order they were written. - (In case of error, return 0 and store -1 in *ERROR_FLAG.) - Parse the text starting at *BPP, and update *BPP. - Don't parse beyond LIMIT. */ - -static struct arglist * -read_token_list (bpp, limit, error_flag) - U_CHAR **bpp; - U_CHAR *limit; - int *error_flag; -{ - struct arglist *token_ptrs = 0; - U_CHAR *bp = *bpp; - int depth = 1; - - *error_flag = 0; - - /* Loop over the assertion value tokens. */ - while (depth > 0) { - struct arglist *temp; - int eofp = 0; - U_CHAR *beg = bp; - - /* Find the end of the token. */ - if (*bp == '(') { - bp++; - depth++; - } else if (*bp == ')') { - depth--; - if (depth == 0) - break; - bp++; - } else if (*bp == '"' || *bp == '\'') - bp = skip_quoted_string (bp, limit, 0, NULL_PTR, NULL_PTR, &eofp); - else - while (! is_hor_space[*bp] && *bp != '(' && *bp != ')' - && *bp != '"' && *bp != '\'' && bp != limit) - bp++; - - temp = (struct arglist *) xmalloc (sizeof (struct arglist)); - temp->name = (U_CHAR *) xmalloc (bp - beg + 1); - bcopy ((char *) beg, (char *) temp->name, bp - beg); - temp->name[bp - beg] = 0; - temp->next = token_ptrs; - token_ptrs = temp; - temp->length = bp - beg; - - SKIP_WHITE_SPACE (bp); - - if (bp >= limit) { - error ("unterminated token sequence in `#assert' or `#unassert'"); - *error_flag = -1; - return 0; - } - } - *bpp = bp; - - /* We accumulated the names in reverse order. - Now reverse them to get the proper order. */ - { - register struct arglist *prev = 0, *this, *next; - for (this = token_ptrs; this; this = next) { - next = this->next; - this->next = prev; - prev = this; - } - return prev; - } -} - -static void -free_token_list (tokens) - struct arglist *tokens; -{ - while (tokens) { - struct arglist *next = tokens->next; - free (tokens->name); - free (tokens); - tokens = next; - } -} - -/* Install a name in the assertion hash table. - - If LEN is >= 0, it is the length of the name. - Otherwise, compute the length by scanning the entire name. - - If HASH is >= 0, it is the precomputed hash code. - Otherwise, compute the hash code. */ - -static ASSERTION_HASHNODE * -assertion_install (name, len, hash) - U_CHAR *name; - int len; - int hash; -{ - register ASSERTION_HASHNODE *hp; - register int i, bucket; - register U_CHAR *p, *q; - - i = sizeof (ASSERTION_HASHNODE) + len + 1; - hp = (ASSERTION_HASHNODE *) xmalloc (i); - bucket = hash; - hp->bucket_hdr = &assertion_hashtab[bucket]; - hp->next = assertion_hashtab[bucket]; - assertion_hashtab[bucket] = hp; - hp->prev = NULL; - if (hp->next != NULL) - hp->next->prev = hp; - hp->length = len; - hp->value = 0; - hp->name = ((U_CHAR *) hp) + sizeof (ASSERTION_HASHNODE); - p = hp->name; - q = name; - for (i = 0; i < len; i++) - *p++ = *q++; - hp->name[len] = 0; - return hp; -} - -/* Find the most recent hash node for name "name" (ending with first - non-identifier char) installed by install - - If LEN is >= 0, it is the length of the name. - Otherwise, compute the length by scanning the entire name. - - If HASH is >= 0, it is the precomputed hash code. - Otherwise, compute the hash code. */ - -static ASSERTION_HASHNODE * -assertion_lookup (name, len, hash) - U_CHAR *name; - int len; - int hash; -{ - register ASSERTION_HASHNODE *bucket; - - bucket = assertion_hashtab[hash]; - while (bucket) { - if (bucket->length == len && bcmp (bucket->name, name, len) == 0) - return bucket; - bucket = bucket->next; - } - return NULL; -} - -static void -delete_assertion (hp) - ASSERTION_HASHNODE *hp; -{ - - if (hp->prev != NULL) - hp->prev->next = hp->next; - if (hp->next != NULL) - hp->next->prev = hp->prev; - - /* Make sure that the bucket chain header that the deleted guy was - on points to the right thing afterwards. */ - if (hp == *hp->bucket_hdr) - *hp->bucket_hdr = hp->next; - - free (hp); -} - -/* - * interpret #line directive. Remembers previously seen fnames - * in its very own hash table. - */ -#define FNAME_HASHSIZE 37 - -static int -do_line (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - register U_CHAR *bp; - FILE_BUF *ip = &instack[indepth]; - FILE_BUF tem; - int new_lineno; - enum file_change_code file_change = same_file; - - /* Expand any macros. */ - tem = expand_to_temp_buffer (buf, limit, 0, 0); - - /* Point to macroexpanded line, which is null-terminated now. */ - bp = tem.buf; - SKIP_WHITE_SPACE (bp); - - if (!ISDIGIT (*bp)) { - error ("invalid format `#line' directive"); - return 0; - } - - /* The Newline at the end of this line remains to be processed. - To put the next line at the specified line number, - we must store a line number now that is one less. */ - new_lineno = atoi ((char *) bp) - 1; - - /* NEW_LINENO is one less than the actual line number here. */ - if (pedantic && new_lineno < 0) - pedwarn ("line number out of range in `#line' directive"); - - /* skip over the line number. */ - while (ISDIGIT (*bp)) - bp++; - -#if 0 /* #line 10"foo.c" is supposed to be allowed. */ - if (*bp && !is_space[*bp]) { - error ("invalid format `#line' directive"); - return; - } -#endif - - SKIP_WHITE_SPACE (bp); - - if (*bp == '\"') { - static HASHNODE *fname_table[FNAME_HASHSIZE]; - HASHNODE *hp, **hash_bucket; - U_CHAR *fname, *p; - int fname_length; - - fname = ++bp; - - /* Turn the file name, which is a character string literal, - into a null-terminated string. Do this in place. */ - p = bp; - for (;;) - switch ((*p++ = *bp++)) { - case '\0': - error ("invalid format `#line' directive"); - return 0; - - case '\\': - if (! ignore_escape_flag) - { - char *bpc = (char *) bp; - HOST_WIDEST_INT c = parse_escape (&bpc, (HOST_WIDEST_INT) (U_CHAR) (-1)); - bp = (U_CHAR *) bpc; - if (c < 0) - p--; - else - p[-1] = c; - } - break; - - case '\"': - *--p = 0; - goto fname_done; - } - fname_done: - fname_length = p - fname; - - SKIP_WHITE_SPACE (bp); - if (*bp) { - if (pedantic) - pedwarn ("garbage at end of `#line' directive"); - if (*bp == '1') - file_change = enter_file; - else if (*bp == '2') - file_change = leave_file; - else if (*bp == '3') - ip->system_header_p = 1; - else if (*bp == '4') - ip->system_header_p = 2; - else { - error ("invalid format `#line' directive"); - return 0; - } - - bp++; - SKIP_WHITE_SPACE (bp); - if (*bp == '3') { - ip->system_header_p = 1; - bp++; - SKIP_WHITE_SPACE (bp); - } - if (*bp == '4') { - ip->system_header_p = 2; - bp++; - SKIP_WHITE_SPACE (bp); - } - if (*bp) { - error ("invalid format `#line' directive"); - return 0; - } - } - - hash_bucket = &fname_table[hashf (fname, fname_length, FNAME_HASHSIZE)]; - for (hp = *hash_bucket; hp != NULL; hp = hp->next) - if (hp->length == fname_length && - bcmp (hp->value.cpval, fname, fname_length) == 0) { - ip->nominal_fname = hp->value.cpval; - ip->nominal_fname_len = fname_length; - break; - } - if (hp == 0) { - /* Didn't find it; cons up a new one. */ - hp = (HASHNODE *) xcalloc (1, sizeof (HASHNODE) + fname_length + 1); - hp->next = *hash_bucket; - *hash_bucket = hp; - - ip->nominal_fname = hp->value.cpval = ((char *) hp) + sizeof (HASHNODE); - ip->nominal_fname_len = hp->length = fname_length; - bcopy (fname, hp->value.cpval, fname_length + 1); - } - } else if (*bp) { - error ("invalid format `#line' directive"); - return 0; - } - - ip->lineno = new_lineno; - output_line_directive (ip, op, 0, file_change); - check_expand (op, ip->length - (ip->bufp - ip->buf)); - return 0; -} - -/* Remove the definition of a symbol from the symbol table. - according to un*x /lib/cpp, it is not an error to undef - something that has no definitions, so it isn't one here either. */ - -static int -do_undef (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword; -{ - int sym_length; - HASHNODE *hp; - U_CHAR *orig_buf = buf; - - /* If this is a precompiler run (with -pcp) pass thru #undef directives. */ - if (pcp_outfile && op) - pass_thru_directive (buf, limit, op, keyword); - - SKIP_WHITE_SPACE (buf); - sym_length = check_macro_name (buf, 0); - - while ((hp = lookup (buf, sym_length, -1)) != NULL) { - /* If we are generating additional info for debugging (with -g) we - need to pass through all effective #undef directives. */ - if (debug_output && op) - pass_thru_directive (orig_buf, limit, op, keyword); - if (hp->type != T_MACRO) - warning ("undefining `%s'", hp->name); - delete_macro (hp); - } - - if (pedantic) { - buf += sym_length; - SKIP_WHITE_SPACE (buf); - if (buf != limit) - pedwarn ("garbage after `#undef' directive"); - } - return 0; -} - -/* Report an error detected by the program we are processing. - Use the text of the line in the error message. - (We use error because it prints the filename & line#.) */ - -static int -do_error (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op ATTRIBUTE_UNUSED; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - int length = limit - buf; - U_CHAR *copy = (U_CHAR *) alloca (length + 1); - bcopy ((char *) buf, (char *) copy, length); - copy[length] = 0; - SKIP_WHITE_SPACE (copy); - error ("#error %s", copy); - return 0; -} - -/* Report a warning detected by the program we are processing. - Use the text of the line in the warning message, then continue. - (We use error because it prints the filename & line#.) */ - -static int -do_warning (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op ATTRIBUTE_UNUSED; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - int length = limit - buf; - U_CHAR *copy = (U_CHAR *) alloca (length + 1); - bcopy ((char *) buf, (char *) copy, length); - copy[length] = 0; - SKIP_WHITE_SPACE (copy); - - if (pedantic && !instack[indepth].system_header_p) - pedwarn ("ANSI C does not allow `#warning'"); - - /* Use `pedwarn' not `warning', because #warning isn't in the C Standard; - if -pedantic-errors is given, #warning should cause an error. */ - pedwarn ("#warning %s", copy); - return 0; -} - -/* Remember the name of the current file being read from so that we can - avoid ever including it again. */ - -static void -do_once () -{ - int i; - - for (i = indepth; i >= 0; i--) - if (instack[i].inc) { - record_control_macro (instack[i].inc, (U_CHAR *) ""); - break; - } -} - -/* Report program identification. */ - -static int -do_ident (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - FILE_BUF trybuf; - int len; - - /* Allow #ident in system headers, since that's not user's fault. */ - if (pedantic && !instack[indepth].system_header_p) - pedwarn ("ANSI C does not allow `#ident'"); - - trybuf = expand_to_temp_buffer (buf, limit, 0, 0); - buf = trybuf.buf; - len = trybuf.bufp - buf; - - /* Output expanded directive. */ - check_expand (op, 7 + len); - bcopy ("#ident ", (char *) op->bufp, 7); - op->bufp += 7; - bcopy ((char *) buf, (char *) op->bufp, len); - op->bufp += len; - - free (buf); - return 0; -} - -/* #pragma and its argument line have already been copied to the output file. - Just check for some recognized pragmas that need validation here. */ - -static int -do_pragma (buf, limit, op, keyword) - U_CHAR *buf, *limit ATTRIBUTE_UNUSED; - FILE_BUF *op ATTRIBUTE_UNUSED; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - SKIP_WHITE_SPACE (buf); - if (!strncmp ((char *) buf, "once", 4)) { - /* Allow #pragma once in system headers, since that's not the user's - fault. */ - if (!instack[indepth].system_header_p) - warning ("`#pragma once' is obsolete"); - do_once (); - } - - if (!strncmp ((char *) buf, "implementation", 14)) { - /* Be quiet about `#pragma implementation' for a file only if it hasn't - been included yet. */ - - int h; - U_CHAR *p = buf + 14, *fname; - SKIP_WHITE_SPACE (p); - if (*p != '\"') - return 0; - - fname = p + 1; - if ((p = (U_CHAR *) index ((char *) fname, '\"'))) - *p = '\0'; - - for (h = 0; h < INCLUDE_HASHSIZE; h++) { - struct include_file *inc; - for (inc = include_hashtab[h]; inc; inc = inc->next) { - if (!strcmp (base_name (inc->fname), (char *) fname)) { - warning ("`#pragma implementation' for \"%s\" appears after its #include",fname); - return 0; - } - } - } - } - return 0; -} - -#if 0 -/* This was a fun hack, but #pragma seems to start to be useful. - By failing to recognize it, we pass it through unchanged to cc1. */ - -/* The behavior of the #pragma directive is implementation defined. - this implementation defines it as follows. */ - -static int -do_pragma () -{ - close (0); - if (open ("/dev/tty", O_RDONLY, 0666) != 0) - goto nope; - close (1); - if (open ("/dev/tty", O_WRONLY, 0666) != 1) - goto nope; - execl ("/usr/games/hack", "#pragma", 0); - execl ("/usr/games/rogue", "#pragma", 0); - execl ("/usr/new/emacs", "-f", "hanoi", "9", "-kill", 0); - execl ("/usr/local/emacs", "-f", "hanoi", "9", "-kill", 0); -nope: - fatal ("You are in a maze of twisty compiler features, all different"); -} -#endif - -#ifdef SCCS_DIRECTIVE - -/* Just ignore #sccs, on systems where we define it at all. */ - -static int -do_sccs (buf, limit, op, keyword) - U_CHAR *buf ATTRIBUTE_UNUSED, *limit ATTRIBUTE_UNUSED; - FILE_BUF *op ATTRIBUTE_UNUSED; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - if (pedantic) - pedwarn ("ANSI C does not allow `#sccs'"); - return 0; -} - -#endif /* defined (SCCS_DIRECTIVE) */ - -/* Handle #if directive by - 1) inserting special `defined' keyword into the hash table - that gets turned into 0 or 1 by special_symbol (thus, - if the luser has a symbol called `defined' already, it won't - work inside the #if directive) - 2) rescan the input into a temporary output buffer - 3) pass the output buffer to the yacc parser and collect a value - 4) clean up the mess left from steps 1 and 2. - 5) call conditional_skip to skip til the next #endif (etc.), - or not, depending on the value from step 3. */ - -static int -do_if (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - HOST_WIDEST_INT value; - FILE_BUF *ip = &instack[indepth]; - - value = eval_if_expression (buf, limit - buf); - conditional_skip (ip, value == 0, T_IF, NULL_PTR, op); - return 0; -} - -/* Handle a #elif directive by not changing if_stack either. - see the comment above do_else. */ - -static int -do_elif (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - HOST_WIDEST_INT value; - FILE_BUF *ip = &instack[indepth]; - - if (if_stack == instack[indepth].if_stack) { - error ("`#elif' not within a conditional"); - return 0; - } else { - if (if_stack->type != T_IF && if_stack->type != T_ELIF) { - error ("`#elif' after `#else'"); - fprintf (stderr, " (matches line %d", if_stack->lineno); - if (! (if_stack->fname_len == ip->nominal_fname_len - && !bcmp (if_stack->fname, ip->nominal_fname, - if_stack->fname_len))) { - fprintf (stderr, ", file "); - eprint_string (if_stack->fname, if_stack->fname_len); - } - fprintf (stderr, ")\n"); - } - if_stack->type = T_ELIF; - } - - if (if_stack->if_succeeded) - skip_if_group (ip, 0, op); - else { - value = eval_if_expression (buf, limit - buf); - if (value == 0) - skip_if_group (ip, 0, op); - else { - ++if_stack->if_succeeded; /* continue processing input */ - output_line_directive (ip, op, 1, same_file); - } - } - return 0; -} - -/* Evaluate a #if expression in BUF, of length LENGTH, then parse the - result as a C expression and return the value as an int. */ - -static HOST_WIDEST_INT -eval_if_expression (buf, length) - U_CHAR *buf; - int length; -{ - FILE_BUF temp_obuf; - HASHNODE *save_defined; - HOST_WIDEST_INT value; - - save_defined = install ((U_CHAR *) "defined", -1, T_SPEC_DEFINED, - NULL_PTR, -1); - pcp_inside_if = 1; - temp_obuf = expand_to_temp_buffer (buf, buf + length, 0, 1); - pcp_inside_if = 0; - delete_macro (save_defined); /* clean up special symbol */ - - temp_obuf.buf[temp_obuf.length] = '\n'; - value = parse_c_expression ((char *) temp_obuf.buf, - warn_undef && !instack[indepth].system_header_p); - - free (temp_obuf.buf); - - return value; -} - -/* routine to handle ifdef/ifndef. Try to look up the symbol, then do - or don't skip to the #endif/#else/#elif depending on what directive - is actually being processed. */ - -static int -do_xifdef (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword; -{ - int skip; - FILE_BUF *ip = &instack[indepth]; - U_CHAR *end; - int start_of_file = 0; - U_CHAR *control_macro = 0; - - /* Detect a #ifndef at start of file (not counting comments). */ - if (ip->fname != 0 && keyword->type == T_IFNDEF) { - U_CHAR *p = ip->buf; - while (p != directive_start) { - U_CHAR c = *p++; - if (is_space[c]) - ; - /* Make no special provision for backslash-newline here; this is - slower if backslash-newlines are present, but it's correct, - and it's not worth it to tune for the rare backslash-newline. */ - else if (c == '/' - && (*p == '*' || (cplusplus_comments && *p == '/'))) { - /* Skip this comment. */ - int junk = 0; - U_CHAR *save_bufp = ip->bufp; - ip->bufp = p + 1; - p = skip_to_end_of_comment (ip, &junk, 1); - ip->bufp = save_bufp; - } else { - goto fail; - } - } - /* If we get here, this conditional is the beginning of the file. */ - start_of_file = 1; - fail: ; - } - - /* Discard leading and trailing whitespace. */ - SKIP_WHITE_SPACE (buf); - while (limit != buf && is_hor_space[limit[-1]]) limit--; - - /* Find the end of the identifier at the beginning. */ - for (end = buf; is_idchar[*end]; end++); - - if (end == buf) { - skip = (keyword->type == T_IFDEF); - if (! traditional) - pedwarn (end == limit ? "`#%s' with no argument" - : "`#%s' argument starts with punctuation", - keyword->name); - } else { - HASHNODE *hp; - - if (! traditional) { - if (ISDIGIT (buf[0])) - pedwarn ("`#%s' argument starts with a digit", keyword->name); - else if (end != limit) - pedwarn ("garbage at end of `#%s' argument", keyword->name); - } - - hp = lookup (buf, end-buf, -1); - - if (pcp_outfile) { - /* Output a precondition for this macro. */ - if (hp - && (hp->type == T_CONST - || (hp->type == T_MACRO && hp->value.defn->predefined))) - fprintf (pcp_outfile, "#define %s\n", hp->name); - else { - U_CHAR *cp = buf; - fprintf (pcp_outfile, "#undef "); - while (is_idchar[*cp]) /* Ick! */ - fputc (*cp++, pcp_outfile); - putc ('\n', pcp_outfile); - } - } - - skip = (hp == NULL) ^ (keyword->type == T_IFNDEF); - if (start_of_file && !skip) { - control_macro = (U_CHAR *) xmalloc (end - buf + 1); - bcopy ((char *) buf, (char *) control_macro, end - buf); - control_macro[end - buf] = 0; - } - } - - conditional_skip (ip, skip, T_IF, control_macro, op); - return 0; -} - -/* Push TYPE on stack; then, if SKIP is nonzero, skip ahead. - If this is a #ifndef starting at the beginning of a file, - CONTROL_MACRO is the macro name tested by the #ifndef. - Otherwise, CONTROL_MACRO is 0. */ - -static void -conditional_skip (ip, skip, type, control_macro, op) - FILE_BUF *ip; - int skip; - enum node_type type; - U_CHAR *control_macro; - FILE_BUF *op; -{ - IF_STACK_FRAME *temp; - - temp = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME)); - temp->fname = ip->nominal_fname; - temp->fname_len = ip->nominal_fname_len; - temp->lineno = ip->lineno; - temp->next = if_stack; - temp->control_macro = control_macro; - if_stack = temp; - - if_stack->type = type; - - if (skip != 0) { - skip_if_group (ip, 0, op); - return; - } else { - ++if_stack->if_succeeded; - output_line_directive (ip, &outbuf, 1, same_file); - } -} - -/* Skip to #endif, #else, or #elif. adjust line numbers, etc. - Leaves input ptr at the sharp sign found. - If ANY is nonzero, return at next directive of any sort. */ - -static void -skip_if_group (ip, any, op) - FILE_BUF *ip; - int any; - FILE_BUF *op; -{ - register U_CHAR *bp = ip->bufp, *cp; - register U_CHAR *endb = ip->buf + ip->length; - struct directive *kt; - IF_STACK_FRAME *save_if_stack = if_stack; /* don't pop past here */ - U_CHAR *beg_of_line = bp; - register int ident_length; - U_CHAR *ident, *after_ident; - /* Save info about where the group starts. */ - U_CHAR *beg_of_group = bp; - int beg_lineno = ip->lineno; - int skipping_include_directive = 0; - - if (output_conditionals && op != 0) { - char *ptr = "#failed\n"; - int len = strlen (ptr); - - if (op->bufp > op->buf && op->bufp[-1] != '\n') - { - *op->bufp++ = '\n'; - op->lineno++; - } - check_expand (op, len); - bcopy (ptr, (char *) op->bufp, len); - op->bufp += len; - op->lineno++; - output_line_directive (ip, op, 1, 0); - } - - while (bp < endb) { - switch (*bp++) { - case '/': /* possible comment */ - if (*bp == '\\' && bp[1] == '\n') - newline_fix (bp); - if (*bp == '*' - || (cplusplus_comments && *bp == '/')) { - ip->bufp = ++bp; - bp = skip_to_end_of_comment (ip, &ip->lineno, 0); - } - break; - case '<': - if (skipping_include_directive) { - while (bp < endb && *bp != '>' && *bp != '\n') { - if (*bp == '\\' && bp[1] == '\n') { - ip->lineno++; - bp++; - } - bp++; - } - } - break; - case '\"': - if (skipping_include_directive) { - while (bp < endb && *bp != '\n') { - if (*bp == '"') { - bp++; - break; - } - if (*bp == '\\' && bp[1] == '\n') { - ip->lineno++; - bp++; - } - bp++; - } - break; - } - /* Fall through. */ - case '\'': - bp = skip_quoted_string (bp - 1, endb, ip->lineno, &ip->lineno, - NULL_PTR, NULL_PTR); - break; - case '\\': - /* Char after backslash loses its special meaning in some cases. */ - if (*bp == '\n') { - ++ip->lineno; - bp++; - } else if (traditional && bp < endb) - bp++; - break; - case '\n': - ++ip->lineno; - beg_of_line = bp; - skipping_include_directive = 0; - break; - case '%': - if (beg_of_line == 0 || traditional) - break; - ip->bufp = bp - 1; - while (bp[0] == '\\' && bp[1] == '\n') - bp += 2; - if (*bp == ':') - goto sharp_token; - break; - case '#': - /* # keyword: a # must be first nonblank char on the line */ - if (beg_of_line == 0) - break; - ip->bufp = bp - 1; - sharp_token: - /* Scan from start of line, skipping whitespace, comments - and backslash-newlines, and see if we reach this #. - If not, this # is not special. */ - bp = beg_of_line; - /* If -traditional, require # to be at beginning of line. */ - if (!traditional) { - while (1) { - if (is_hor_space[*bp]) - bp++; - else if (*bp == '\\' && bp[1] == '\n') - bp += 2; - else if (*bp == '/' && bp[1] == '*') { - bp += 2; - while (1) - { - if (*bp == '*') - { - if (bp[1] == '/') - { - bp += 2; - break; - } - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (bp, endb - bp); - if (length > 1) - bp += (length - 1); -#endif - } - bp++; - } - } - /* There is no point in trying to deal with C++ // comments here, - because if there is one, then this # must be part of the - comment and we would never reach here. */ - else break; - } - } - if (bp != ip->bufp) { - bp = ip->bufp + 1; /* Reset bp to after the #. */ - break; - } - - bp = ip->bufp + 1; /* Point after the '#' */ - if (ip->bufp[0] == '%') { - /* Skip past the ':' again. */ - while (*bp == '\\') { - ip->lineno++; - bp += 2; - } - bp++; - } - - /* Skip whitespace and \-newline. */ - while (1) { - if (is_hor_space[*bp]) - bp++; - else if (*bp == '\\' && bp[1] == '\n') - bp += 2; - else if (*bp == '/') { - if (bp[1] == '\\' && bp[2] == '\n') - newline_fix (bp + 1); - if (bp[1] == '*') { - for (bp += 2; ; bp++) { - if (*bp == '\n') - ip->lineno++; - else if (*bp == '*') { - if (bp[-1] == '/' && warn_comments) - warning ("`/*' within comment"); - if (bp[1] == '\\' && bp[2] == '\n') - newline_fix (bp + 1); - if (bp[1] == '/') - break; - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (bp, endb - bp); - if (length > 1) - bp += (length - 1); -#endif - } - } - bp += 2; - } else if (bp[1] == '/' && cplusplus_comments) { - for (bp += 2; ; bp++) { - if (*bp == '\n') - break; - if (*bp == '\\' && bp[1] == '\n') - { - if (warn_comments) - warning ("multiline `//' comment"); - ip->lineno++; - bp++; - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (bp, endb - bp); - if (length > 1) - bp += (length - 1); -#endif - } - } - } else - break; - } else - break; - } - - cp = bp; - - /* Now find end of directive name. - If we encounter a backslash-newline, exchange it with any following - symbol-constituents so that we end up with a contiguous name. */ - - while (1) { - if (is_idchar[*bp]) - bp++; - else { - if (*bp == '\\' && bp[1] == '\n') - name_newline_fix (bp); - if (is_idchar[*bp]) - bp++; - else break; - } - } - ident_length = bp - cp; - ident = cp; - after_ident = bp; - - /* A line of just `#' becomes blank. */ - - if (ident_length == 0 && *after_ident == '\n') { - continue; - } - - if (ident_length == 0 || !is_idstart[*ident]) { - U_CHAR *p = ident; - while (is_idchar[*p]) { - if (*p < '0' || *p > '9') - break; - p++; - } - /* Handle # followed by a line number. */ - if (p != ident && !is_idchar[*p]) { - if (pedantic) - pedwarn ("`#' followed by integer"); - continue; - } - - /* Avoid error for `###' and similar cases unless -pedantic. */ - if (p == ident) { - while (*p == '#' || is_hor_space[*p]) p++; - if (*p == '\n') { - if (pedantic && !lang_asm) - pedwarn ("invalid preprocessing directive"); - continue; - } - } - - if (!lang_asm && pedantic) - pedwarn ("invalid preprocessing directive name"); - continue; - } - - for (kt = directive_table; kt->length >= 0; kt++) { - IF_STACK_FRAME *temp; - if (ident_length == kt->length - && bcmp (cp, kt->name, kt->length) == 0) { - /* If we are asked to return on next directive, do so now. */ - if (any) - goto done; - - switch (kt->type) { - case T_IF: - case T_IFDEF: - case T_IFNDEF: - temp = (IF_STACK_FRAME *) xcalloc (1, sizeof (IF_STACK_FRAME)); - temp->next = if_stack; - if_stack = temp; - temp->lineno = ip->lineno; - temp->fname = ip->nominal_fname; - temp->fname_len = ip->nominal_fname_len; - temp->type = kt->type; - break; - case T_ELSE: - case T_ENDIF: - if (pedantic && if_stack != save_if_stack) - validate_else (bp, endb); - case T_ELIF: - if (if_stack == instack[indepth].if_stack) { - error ("`#%s' not within a conditional", kt->name); - break; - } - else if (if_stack == save_if_stack) - goto done; /* found what we came for */ - - if (kt->type != T_ENDIF) { - if (if_stack->type == T_ELSE) - error ("`#else' or `#elif' after `#else'"); - if_stack->type = kt->type; - break; - } - - temp = if_stack; - if_stack = if_stack->next; - free (temp); - break; - - case T_INCLUDE: - case T_INCLUDE_NEXT: - case T_IMPORT: - skipping_include_directive = 1; - break; - - default: - break; - } - break; - } - } - /* Don't let erroneous code go by. */ - if (kt->length < 0 && !lang_asm && pedantic) - pedwarn ("invalid preprocessing directive name"); - } - } - - ip->bufp = bp; - /* after this returns, rescan will exit because ip->bufp - now points to the end of the buffer. - rescan is responsible for the error message also. */ - - done: - if (output_conditionals && op != 0) { - char *ptr = "#endfailed\n"; - int len = strlen (ptr); - - if (op->bufp > op->buf && op->bufp[-1] != '\n') - { - *op->bufp++ = '\n'; - op->lineno++; - } - check_expand (op, beg_of_line - beg_of_group); - bcopy ((char *) beg_of_group, (char *) op->bufp, - beg_of_line - beg_of_group); - op->bufp += beg_of_line - beg_of_group; - op->lineno += ip->lineno - beg_lineno; - check_expand (op, len); - bcopy (ptr, (char *) op->bufp, len); - op->bufp += len; - op->lineno++; - } -} - -/* Handle a #else directive. Do this by just continuing processing - without changing if_stack ; this is so that the error message - for missing #endif's etc. will point to the original #if. It - is possible that something different would be better. */ - -static int -do_else (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - FILE_BUF *ip = &instack[indepth]; - - if (pedantic) { - SKIP_WHITE_SPACE (buf); - if (buf != limit) - pedwarn ("text following `#else' violates ANSI standard"); - } - - if (if_stack == instack[indepth].if_stack) { - error ("`#else' not within a conditional"); - return 0; - } else { - /* #ifndef can't have its special treatment for containing the whole file - if it has a #else clause. */ - if_stack->control_macro = 0; - - if (if_stack->type != T_IF && if_stack->type != T_ELIF) { - error ("`#else' after `#else'"); - fprintf (stderr, " (matches line %d", if_stack->lineno); - if (! (if_stack->fname_len == ip->nominal_fname_len - && !bcmp (if_stack->fname, ip->nominal_fname, - if_stack->fname_len))) { - fprintf (stderr, ", file "); - eprint_string (if_stack->fname, if_stack->fname_len); - } - fprintf (stderr, ")\n"); - } - if_stack->type = T_ELSE; - } - - if (if_stack->if_succeeded) - skip_if_group (ip, 0, op); - else { - ++if_stack->if_succeeded; /* continue processing input */ - output_line_directive (ip, op, 1, same_file); - } - return 0; -} - -/* Unstack after #endif directive. */ - -static int -do_endif (buf, limit, op, keyword) - U_CHAR *buf, *limit; - FILE_BUF *op; - struct directive *keyword ATTRIBUTE_UNUSED; -{ - if (pedantic) { - SKIP_WHITE_SPACE (buf); - if (buf != limit) - pedwarn ("text following `#endif' violates ANSI standard"); - } - - if (if_stack == instack[indepth].if_stack) - error ("unbalanced `#endif'"); - else { - IF_STACK_FRAME *temp = if_stack; - if_stack = if_stack->next; - if (temp->control_macro != 0) { - /* This #endif matched a #ifndef at the start of the file. - See if it is at the end of the file. */ - FILE_BUF *ip = &instack[indepth]; - U_CHAR *p = ip->bufp; - U_CHAR *ep = ip->buf + ip->length; - - while (p != ep) { - U_CHAR c = *p++; - if (!is_space[c]) { - if (c == '/' - && (*p == '*' || (cplusplus_comments && *p == '/'))) { - /* Skip this comment. */ - int junk = 0; - U_CHAR *save_bufp = ip->bufp; - ip->bufp = p + 1; - p = skip_to_end_of_comment (ip, &junk, 1); - ip->bufp = save_bufp; - } else - goto fail; - } - } - /* If we get here, this #endif ends a #ifndef - that contains all of the file (aside from whitespace). - Arrange not to include the file again - if the macro that was tested is defined. - - Do not do this for the top-level file in a -include or any - file in a -imacros. */ - if (indepth != 0 - && ! (indepth == 1 && no_record_file) - && ! (no_record_file && no_output)) - record_control_macro (ip->inc, temp->control_macro); - fail: ; - } - free (temp); - output_line_directive (&instack[indepth], op, 1, same_file); - } - return 0; -} - -/* When an #else or #endif is found while skipping failed conditional, - if -pedantic was specified, this is called to warn about text after - the directive name. P points to the first char after the directive - name. */ - -static void -validate_else (p, limit) - register U_CHAR *p; - register U_CHAR *limit; -{ - /* Advance P over whitespace and comments. */ - while (1) { - while (*p == '\\' && p[1] == '\n') - p += 2; - if (is_hor_space[*p]) - p++; - else if (*p == '/') { - while (p[1] == '\\' && p[2] == '\n') - p += 2; - if (p[1] == '*') { - /* Don't bother warning about unterminated comments - since that will happen later. Just be sure to exit. */ - for (p += 2; ; p++) { - if (p == limit) - return; - if (*p == '*') { - while (p[1] == '\\' && p[2] == '\n') - p += 2; - if (p[1] == '/') { - p += 2; - break; - } - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (p, limit - p); - if (length > 1) - p += (length - 1); -#endif - } - } - } - else if (cplusplus_comments && p[1] == '/') - return; - else break; - } else break; - } - if (*p != '\n') - pedwarn ("text following `#else' or `#endif' violates ANSI standard"); -} - -/* Skip a comment, assuming the input ptr immediately follows the - initial slash-star. Bump *LINE_COUNTER for each newline. - (The canonical line counter is &ip->lineno.) - Don't use this routine (or the next one) if bumping the line - counter is not sufficient to deal with newlines in the string. - - If NOWARN is nonzero, don't warn about slash-star inside a comment. - This feature is useful when processing a comment that is going to - be processed or was processed at another point in the preprocessor, - to avoid a duplicate warning. Likewise for unterminated comment - errors. */ - -static U_CHAR * -skip_to_end_of_comment (ip, line_counter, nowarn) - register FILE_BUF *ip; - int *line_counter; /* place to remember newlines, or NULL */ - int nowarn; -{ - register U_CHAR *limit = ip->buf + ip->length; - register U_CHAR *bp = ip->bufp; - FILE_BUF *op = put_out_comments && !line_counter ? &outbuf : (FILE_BUF *) 0; - int start_line = line_counter ? *line_counter : 0; - - /* JF this line_counter stuff is a crock to make sure the - comment is only put out once, no matter how many times - the comment is skipped. It almost works */ - if (op) { - *op->bufp++ = '/'; - *op->bufp++ = bp[-1]; - } - if (cplusplus_comments && bp[-1] == '/') { - for (; bp < limit; bp++) { - if (*bp == '\n') - break; - if (*bp == '\\' && bp + 1 < limit && bp[1] == '\n') - { - if (!nowarn && warn_comments) - warning ("multiline `//' comment"); - if (line_counter) - ++*line_counter; - if (op) - { - ++op->lineno; - *op->bufp++ = *bp; - } - ++bp; - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (bp, limit - bp); - if (length > 1) - { - if (op) - { - bcopy (bp, op->bufp, length - 1); - op->bufp += (length - 1); - } - bp += (length - 1); - } -#endif - } - if (op) - *op->bufp++ = *bp; - } - ip->bufp = bp; - return bp; - } - while (bp < limit) { - if (op) - *op->bufp++ = *bp; - switch (*bp++) { - case '\n': - /* If this is the end of the file, we have an unterminated comment. - Don't swallow the newline. We are guaranteed that there will be a - trailing newline and various pieces assume it's there. */ - if (bp == limit) - { - --bp; - --limit; - break; - } - if (line_counter != NULL) - ++*line_counter; - if (op) - ++op->lineno; - break; - case '*': - if (bp[-2] == '/' && !nowarn && warn_comments) - warning ("`/*' within comment"); - if (*bp == '\\' && bp[1] == '\n') - newline_fix (bp); - if (*bp == '/') { - if (op) - *op->bufp++ = '/'; - ip->bufp = ++bp; - return bp; - } - break; -#ifdef MULTIBYTE_CHARS - default: - { - int length; - bp--; - length = local_mblen (bp, limit - bp); - if (length <= 0) - length = 1; - if (op) - { - op->bufp--; - bcopy (bp, op->bufp, length); - op->bufp += length; - } - bp += length; - } -#endif - } - } - - if (!nowarn) - error_with_line (line_for_error (start_line), "unterminated comment"); - ip->bufp = bp; - return bp; -} - -/* Skip over a quoted string. BP points to the opening quote. - Returns a pointer after the closing quote. Don't go past LIMIT. - START_LINE is the line number of the starting point (but it need - not be valid if the starting point is inside a macro expansion). - - The input stack state is not changed. - - If COUNT_NEWLINES is nonzero, it points to an int to increment - for each newline passed. - - If BACKSLASH_NEWLINES_P is nonzero, store 1 thru it - if we pass a backslash-newline. - - If EOFP is nonzero, set *EOFP to 1 if the string is unterminated. */ - -static U_CHAR * -skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p, eofp) - register U_CHAR *bp; - register U_CHAR *limit; - int start_line; - int *count_newlines; - int *backslash_newlines_p; - int *eofp; -{ - register U_CHAR c, match; - - match = *bp++; - while (1) { - if (bp >= limit) { - error_with_line (line_for_error (start_line), - "unterminated string or character constant"); - error_with_line (multiline_string_line, - "possible real start of unterminated constant"); - multiline_string_line = 0; - if (eofp) - *eofp = 1; - break; - } - c = *bp++; - if (c == '\\') { - while (*bp == '\\' && bp[1] == '\n') { - if (backslash_newlines_p) - *backslash_newlines_p = 1; - if (count_newlines) - ++*count_newlines; - bp += 2; - } - if (*bp == '\n') { - if (backslash_newlines_p) - *backslash_newlines_p = 1; - if (count_newlines) - ++*count_newlines; - } - bp++; - } else if (c == '\n') { - if (traditional) { - /* Unterminated strings and character constants are 'valid'. */ - bp--; /* Don't consume the newline. */ - if (eofp) - *eofp = 1; - break; - } - if (match == '\'') { - error_with_line (line_for_error (start_line), - "unterminated string or character constant"); - bp--; - if (eofp) - *eofp = 1; - break; - } - /* If not traditional, then allow newlines inside strings. */ - if (count_newlines) - ++*count_newlines; - if (multiline_string_line == 0) { - if (pedantic) - pedwarn_with_line (line_for_error (start_line), - "string constant runs past end of line"); - multiline_string_line = start_line; - } - } else if (c == match) - break; -#ifdef MULTIBYTE_CHARS - { - int length; - --bp; - length = local_mblen (bp, limit - bp); - if (length <= 0) - length = 1; - bp += length; - } -#endif - } - return bp; -} - -/* Place into DST a quoted string representing the string SRC. - SRCLEN is the length of SRC; SRC may contain null bytes. - Return the address of DST's terminating null. */ - -static char * -quote_string (dst, src, srclen) - char *dst, *src; - size_t srclen; -{ - U_CHAR c; - char *srclim = src + srclen; - - *dst++ = '\"'; - while (src != srclim) - switch ((c = *src++)) - { - default: - if (ISPRINT (c)) - *dst++ = c; - else - { - sprintf (dst, "\\%03o", c); - dst += 4; - } - break; - - case '\"': - case '\\': - *dst++ = '\\'; - *dst++ = c; - break; - } - - *dst++ = '\"'; - *dst = '\0'; - return dst; -} - -/* Skip across a group of balanced parens, starting from IP->bufp. - IP->bufp is updated. Use this with IP->bufp pointing at an open-paren. - - This does not handle newlines, because it's used for the arg of #if, - where there aren't any newlines. Also, backslash-newline can't appear. */ - -static U_CHAR * -skip_paren_group (ip) - register FILE_BUF *ip; -{ - U_CHAR *limit = ip->buf + ip->length; - U_CHAR *p = ip->bufp; - int depth = 0; - int lines_dummy = 0; - - while (p != limit) { - int c = *p++; - switch (c) { - case '(': - depth++; - break; - - case ')': - depth--; - if (depth == 0) - return ip->bufp = p; - break; - - case '/': - if (*p == '*') { - ip->bufp = p; - p = skip_to_end_of_comment (ip, &lines_dummy, 0); - p = ip->bufp; - } - - case '"': - case '\'': - { - int eofp = 0; - p = skip_quoted_string (p - 1, limit, 0, NULL_PTR, NULL_PTR, &eofp); - if (eofp) - return ip->bufp = p; - } - break; - } - } - - ip->bufp = p; - return p; -} - -/* Write out a #line directive, for instance, after an #include file. - If CONDITIONAL is nonzero, we can omit the #line if it would - appear to be a no-op, and we can output a few newlines instead - if we want to increase the line number by a small amount. - FILE_CHANGE says whether we are entering a file, leaving, or neither. */ - -static void -output_line_directive (ip, op, conditional, file_change) - FILE_BUF *ip, *op; - int conditional; - enum file_change_code file_change; -{ - int len; - char *line_directive_buf, *line_end; - - if (no_line_directives - || ip->fname == NULL - || no_output) { - op->lineno = ip->lineno; - return; - } - - if (conditional) { - if (ip->lineno == op->lineno) - return; - - /* If the inherited line number is a little too small, - output some newlines instead of a #line directive. */ - if (ip->lineno > op->lineno && ip->lineno < op->lineno + 8) { - check_expand (op, 10); - while (ip->lineno > op->lineno) { - *op->bufp++ = '\n'; - op->lineno++; - } - return; - } - } - - /* Output a positive line number if possible. */ - while (ip->lineno <= 0 && ip->bufp - ip->buf < ip->length - && *ip->bufp == '\n') { - ip->lineno++; - ip->bufp++; - } - - line_directive_buf = (char *) alloca (4 * ip->nominal_fname_len + 100); - sprintf (line_directive_buf, "# %d ", ip->lineno); - line_end = quote_string (line_directive_buf + strlen (line_directive_buf), - ip->nominal_fname, ip->nominal_fname_len); - if (file_change != same_file) { - *line_end++ = ' '; - *line_end++ = file_change == enter_file ? '1' : '2'; - } - /* Tell cc1 if following text comes from a system header file. */ - if (ip->system_header_p) { - *line_end++ = ' '; - *line_end++ = '3'; - } -#ifndef NO_IMPLICIT_EXTERN_C - /* Tell cc1plus if following text should be treated as C. */ - if (ip->system_header_p == 2 && cplusplus) { - *line_end++ = ' '; - *line_end++ = '4'; - } -#endif - *line_end++ = '\n'; - len = line_end - line_directive_buf; - check_expand (op, len + 1); - if (op->bufp > op->buf && op->bufp[-1] != '\n') - *op->bufp++ = '\n'; - bcopy ((char *) line_directive_buf, (char *) op->bufp, len); - op->bufp += len; - op->lineno = ip->lineno; -} - -/* This structure represents one parsed argument in a macro call. - `raw' points to the argument text as written (`raw_length' is its length). - `expanded' points to the argument's macro-expansion - (its length is `expand_length'). - `stringified_length' is the length the argument would have - if stringified. - `use_count' is the number of times this macro arg is substituted - into the macro. If the actual use count exceeds 10, - the value stored is 10. - `free1' and `free2', if nonzero, point to blocks to be freed - when the macro argument data is no longer needed. */ - -struct argdata { - U_CHAR *raw, *expanded; - int raw_length, expand_length; - int stringified_length; - U_CHAR *free1, *free2; - char newlines; - char use_count; -}; - -/* Expand a macro call. - HP points to the symbol that is the macro being called. - Put the result of expansion onto the input stack - so that subsequent input by our caller will use it. - - If macro wants arguments, caller has already verified that - an argument list follows; arguments come from the input stack. */ - -static void -macroexpand (hp, op) - HASHNODE *hp; - FILE_BUF *op; -{ - int nargs; - DEFINITION *defn = hp->value.defn; - register U_CHAR *xbuf; - int xbuf_len; - int start_line = instack[indepth].lineno; - int rest_args, rest_zero; - - CHECK_DEPTH (return;); - - /* it might not actually be a macro. */ - if (hp->type != T_MACRO) { - special_symbol (hp, op); - return; - } - - /* This macro is being used inside a #if, which means it must be */ - /* recorded as a precondition. */ - if (pcp_inside_if && pcp_outfile && defn->predefined) - dump_single_macro (hp, pcp_outfile); - - nargs = defn->nargs; - - if (nargs >= 0) { - register int i; - struct argdata *args; - int parse_error = 0; - - args = (struct argdata *) alloca ((nargs + 1) * sizeof (struct argdata)); - - for (i = 0; i < nargs; i++) { - args[i].raw = (U_CHAR *) ""; - args[i].expanded = 0; - args[i].raw_length = args[i].expand_length - = args[i].stringified_length = 0; - args[i].free1 = args[i].free2 = 0; - args[i].use_count = 0; - } - - /* Parse all the macro args that are supplied. I counts them. - The first NARGS args are stored in ARGS. - The rest are discarded. - If rest_args is set then we assume macarg absorbed the rest of the args. - */ - i = 0; - rest_args = 0; - do { - /* Discard the open-parenthesis or comma before the next arg. */ - ++instack[indepth].bufp; - if (rest_args) - continue; - if (i < nargs || (nargs == 0 && i == 0)) { - /* If we are working on last arg which absorbs rest of args... */ - if (i == nargs - 1 && defn->rest_args) - rest_args = 1; - parse_error = macarg (&args[i], rest_args); - } - else - parse_error = macarg (NULL_PTR, 0); - if (parse_error) { - error_with_line (line_for_error (start_line), - "unterminated macro call"); - break; - } - i++; - } while (*instack[indepth].bufp != ')'); - - /* If we got one arg but it was just whitespace, call that 0 args. */ - if (i == 1) { - register U_CHAR *bp = args[0].raw; - register U_CHAR *lim = bp + args[0].raw_length; - /* cpp.texi says for foo ( ) we provide one argument. - However, if foo wants just 0 arguments, treat this as 0. */ - if (nargs == 0) - while (bp != lim && is_space[*bp]) bp++; - if (bp == lim) - i = 0; - } - - /* Don't output an error message if we have already output one for - a parse error above. */ - rest_zero = 0; - if (nargs == 0 && i > 0) { - if (! parse_error) - error ("arguments given to macro `%s'", hp->name); - } else if (i < nargs) { - /* traditional C allows foo() if foo wants one argument. */ - if (nargs == 1 && i == 0 && traditional) - ; - /* the rest args token is allowed to absorb 0 tokens */ - else if (i == nargs - 1 && defn->rest_args) - rest_zero = 1; - else if (parse_error) - ; - else if (i == 0) - error ("macro `%s' used without args", hp->name); - else if (i == 1) - error ("macro `%s' used with just one arg", hp->name); - else - error ("macro `%s' used with only %d args", hp->name, i); - } else if (i > nargs) { - if (! parse_error) - error ("macro `%s' used with too many (%d) args", hp->name, i); - } - - /* Swallow the closeparen. */ - ++instack[indepth].bufp; - - /* If macro wants zero args, we parsed the arglist for checking only. - Read directly from the macro definition. */ - if (nargs == 0) { - xbuf = defn->expansion; - xbuf_len = defn->length; - } else { - register U_CHAR *exp = defn->expansion; - register int offset; /* offset in expansion, - copied a piece at a time */ - register int totlen; /* total amount of exp buffer filled so far */ - - register struct reflist *ap, *last_ap; - - /* Macro really takes args. Compute the expansion of this call. */ - - /* Compute length in characters of the macro's expansion. - Also count number of times each arg is used. */ - xbuf_len = defn->length; - for (ap = defn->pattern; ap != NULL; ap = ap->next) { - if (ap->stringify) - xbuf_len += args[ap->argno].stringified_length; - else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional) - /* Add 4 for two newline-space markers to prevent - token concatenation. */ - xbuf_len += args[ap->argno].raw_length + 4; - else { - /* We have an ordinary (expanded) occurrence of the arg. - So compute its expansion, if we have not already. */ - if (args[ap->argno].expanded == 0) { - FILE_BUF obuf; - obuf = expand_to_temp_buffer (args[ap->argno].raw, - args[ap->argno].raw + args[ap->argno].raw_length, - 1, 0); - - args[ap->argno].expanded = obuf.buf; - args[ap->argno].expand_length = obuf.length; - args[ap->argno].free2 = obuf.buf; - } - - /* Add 4 for two newline-space markers to prevent - token concatenation. */ - xbuf_len += args[ap->argno].expand_length + 4; - } - if (args[ap->argno].use_count < 10) - args[ap->argno].use_count++; - } - - xbuf = (U_CHAR *) xmalloc (xbuf_len + 1); - - /* Generate in XBUF the complete expansion - with arguments substituted in. - TOTLEN is the total size generated so far. - OFFSET is the index in the definition - of where we are copying from. */ - offset = totlen = 0; - for (last_ap = NULL, ap = defn->pattern; ap != NULL; - last_ap = ap, ap = ap->next) { - register struct argdata *arg = &args[ap->argno]; - int count_before = totlen; - - /* Add chars to XBUF. */ - for (i = 0; i < ap->nchars; i++, offset++) - xbuf[totlen++] = exp[offset]; - - /* If followed by an empty rest arg with concatenation, - delete the last run of nonwhite chars. */ - if (rest_zero && totlen > count_before - && ((ap->rest_args && ap->raw_before != 0) - || (last_ap != NULL && last_ap->rest_args - && last_ap->raw_after != 0))) { - /* Delete final whitespace. */ - while (totlen > count_before && is_space[xbuf[totlen - 1]]) { - totlen--; - } - - /* Delete the nonwhites before them. */ - while (totlen > count_before && ! is_space[xbuf[totlen - 1]]) { - totlen--; - } - } - - if (ap->stringify != 0) { - int arglen = arg->raw_length; - int escaped = 0; - int in_string = 0; - int c; - i = 0; - while (i < arglen - && (c = arg->raw[i], is_space[c])) - i++; - while (i < arglen - && (c = arg->raw[arglen - 1], is_space[c])) - arglen--; - if (!traditional) - xbuf[totlen++] = '\"'; /* insert beginning quote */ - for (; i < arglen; i++) { - c = arg->raw[i]; - - if (! in_string) { - /* Special markers Newline Space - generate nothing for a stringified argument. */ - if (c == '\n' && arg->raw[i+1] != '\n') { - i++; - continue; - } - - /* Internal sequences of whitespace are replaced by one space - except within an string or char token. */ - if (c == '\n' ? arg->raw[i+1] == '\n' : is_space[c]) { - while (1) { - /* Note that Newline Space does occur within whitespace - sequences; consider it part of the sequence. */ - if (c == '\n' && is_space[arg->raw[i+1]]) - i += 2; - else if (c != '\n' && is_space[c]) - i++; - else break; - c = arg->raw[i]; - } - i--; - c = ' '; - } - } - - if (escaped) - escaped = 0; - else { - if (c == '\\') - escaped = 1; - else if (in_string) { - if (c == in_string) - in_string = 0; - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (arg->raw + i, arglen - i); - if (length > 1) - { - bcopy (arg->raw + i, xbuf + totlen, length); - i += length - 1; - totlen += length; - continue; - } -#endif - } - } else if (c == '\"' || c == '\'') - in_string = c; - } - - /* Escape these chars */ - if (c == '\"' || (in_string && c == '\\')) - xbuf[totlen++] = '\\'; - /* We used to output e.g. \008 for control characters here, - but this doesn't conform to the C Standard. - Just output the characters as-is. */ - xbuf[totlen++] = c; - } - if (!traditional) - xbuf[totlen++] = '\"'; /* insert ending quote */ - } else if (ap->raw_before != 0 || ap->raw_after != 0 || traditional) { - U_CHAR *p1 = arg->raw; - U_CHAR *l1 = p1 + arg->raw_length; - if (ap->raw_before != 0) { - while (p1 != l1 && is_space[*p1]) p1++; - while (p1 != l1 && is_idchar[*p1]) - xbuf[totlen++] = *p1++; - /* Delete any no-reexpansion marker that follows - an identifier at the beginning of the argument - if the argument is concatenated with what precedes it. */ - if (p1[0] == '\n' && p1[1] == '-') - p1 += 2; - } else if (!traditional) { - /* Ordinary expanded use of the argument. - Put in newline-space markers to prevent token pasting. */ - xbuf[totlen++] = '\n'; - xbuf[totlen++] = ' '; - } - if (ap->raw_after != 0) { - /* Arg is concatenated after: delete trailing whitespace, - whitespace markers, and no-reexpansion markers. */ - while (p1 != l1) { - if (is_space[l1[-1]]) l1--; - else if (l1[-1] == '-') { - U_CHAR *p2 = l1 - 1; - /* If a `-' is preceded by an odd number of newlines then it - and the last newline are a no-reexpansion marker. */ - while (p2 != p1 && p2[-1] == '\n') p2--; - if ((l1 - 1 - p2) & 1) { - l1 -= 2; - } - else break; - } - else break; - } - } - - bcopy ((char *) p1, (char *) (xbuf + totlen), l1 - p1); - totlen += l1 - p1; - if (!traditional && ap->raw_after == 0) { - /* Ordinary expanded use of the argument. - Put in newline-space markers to prevent token pasting. */ - xbuf[totlen++] = '\n'; - xbuf[totlen++] = ' '; - } - } else { - /* Ordinary expanded use of the argument. - Put in newline-space markers to prevent token pasting. */ - if (!traditional) { - xbuf[totlen++] = '\n'; - xbuf[totlen++] = ' '; - } - bcopy ((char *) arg->expanded, (char *) (xbuf + totlen), - arg->expand_length); - totlen += arg->expand_length; - if (!traditional) { - xbuf[totlen++] = '\n'; - xbuf[totlen++] = ' '; - } - /* If a macro argument with newlines is used multiple times, - then only expand the newlines once. This avoids creating output - lines which don't correspond to any input line, which confuses - gdb and gcov. */ - if (arg->use_count > 1 && arg->newlines > 0) { - /* Don't bother doing change_newlines for subsequent - uses of arg. */ - arg->use_count = 1; - arg->expand_length - = change_newlines (arg->expanded, arg->expand_length); - } - } - - if (totlen > xbuf_len) - abort (); - } - - /* If there is anything left of the definition after handling - the arg list, copy that in too. */ - - for (i = offset; i < defn->length; i++) { - /* if we've reached the end of the macro */ - if (exp[i] == ')') - rest_zero = 0; - if (! (rest_zero && last_ap != NULL && last_ap->rest_args - && last_ap->raw_after != 0)) - xbuf[totlen++] = exp[i]; - } - - xbuf[totlen] = 0; - xbuf_len = totlen; - - for (i = 0; i < nargs; i++) { - if (args[i].free1 != 0) - free (args[i].free1); - if (args[i].free2 != 0) - free (args[i].free2); - } - } - } else { - xbuf = defn->expansion; - xbuf_len = defn->length; - } - - /* Now put the expansion on the input stack - so our caller will commence reading from it. */ - { - register FILE_BUF *ip2; - - ip2 = &instack[++indepth]; - - ip2->fname = 0; - ip2->nominal_fname = 0; - ip2->nominal_fname_len = 0; - ip2->inc = 0; - /* This may not be exactly correct, but will give much better error - messages for nested macro calls than using a line number of zero. */ - ip2->lineno = start_line; - ip2->buf = xbuf; - ip2->length = xbuf_len; - ip2->bufp = xbuf; - ip2->free_ptr = (nargs > 0) ? xbuf : 0; - ip2->macro = hp; - ip2->if_stack = if_stack; - ip2->system_header_p = 0; - - /* Recursive macro use sometimes works traditionally. - #define foo(x,y) bar (x (y,0), y) - foo (foo, baz) */ - - if (!traditional) - hp->type = T_DISABLED; - } -} - -/* Parse a macro argument and store the info on it into *ARGPTR. - REST_ARGS is passed to macarg1 to make it absorb the rest of the args. - Return nonzero to indicate a syntax error. */ - -static int -macarg (argptr, rest_args) - register struct argdata *argptr; - int rest_args; -{ - FILE_BUF *ip = &instack[indepth]; - int paren = 0; - int newlines = 0; - int comments = 0; - int result = 0; - - /* Try to parse as much of the argument as exists at this - input stack level. */ - U_CHAR *bp = macarg1 (ip->bufp, ip->buf + ip->length, ip->macro, - &paren, &newlines, &comments, rest_args); - - /* If we find the end of the argument at this level, - set up *ARGPTR to point at it in the input stack. */ - if (!(ip->fname != 0 && (newlines != 0 || comments != 0)) - && bp != ip->buf + ip->length) { - if (argptr != 0) { - argptr->raw = ip->bufp; - argptr->raw_length = bp - ip->bufp; - argptr->newlines = newlines; - } - ip->bufp = bp; - } else { - /* This input stack level ends before the macro argument does. - We must pop levels and keep parsing. - Therefore, we must allocate a temporary buffer and copy - the macro argument into it. */ - int bufsize = bp - ip->bufp; - int extra = newlines; - U_CHAR *buffer = (U_CHAR *) xmalloc (bufsize + extra + 1); - int final_start = 0; - - bcopy ((char *) ip->bufp, (char *) buffer, bufsize); - ip->bufp = bp; - ip->lineno += newlines; - - while (bp == ip->buf + ip->length) { - if (instack[indepth].macro == 0) { - result = 1; - break; - } - ip->macro->type = T_MACRO; - if (ip->free_ptr) - free (ip->free_ptr); - ip = &instack[--indepth]; - newlines = 0; - comments = 0; - bp = macarg1 (ip->bufp, ip->buf + ip->length, ip->macro, &paren, - &newlines, &comments, rest_args); - final_start = bufsize; - bufsize += bp - ip->bufp; - extra += newlines; - buffer = (U_CHAR *) xrealloc (buffer, bufsize + extra + 1); - bcopy ((char *) ip->bufp, (char *) (buffer + bufsize - (bp - ip->bufp)), - bp - ip->bufp); - ip->bufp = bp; - ip->lineno += newlines; - } - - /* Now, if arg is actually wanted, record its raw form, - discarding comments and duplicating newlines in whatever - part of it did not come from a macro expansion. - EXTRA space has been preallocated for duplicating the newlines. - FINAL_START is the index of the start of that part. */ - if (argptr != 0) { - argptr->raw = buffer; - argptr->raw_length = bufsize; - argptr->free1 = buffer; - argptr->newlines = newlines; - if ((newlines || comments) && ip->fname != 0) - argptr->raw_length - = final_start + - discard_comments (argptr->raw + final_start, - argptr->raw_length - final_start, - newlines); - argptr->raw[argptr->raw_length] = 0; - if (argptr->raw_length > bufsize + extra) - abort (); - } - } - - /* If we are not discarding this argument, - macroexpand it and compute its length as stringified. - All this info goes into *ARGPTR. */ - - if (argptr != 0) { - register U_CHAR *buf, *lim; - register int totlen; - - buf = argptr->raw; - lim = buf + argptr->raw_length; - - while (buf != lim && is_space[*buf]) - buf++; - while (buf != lim && is_space[lim[-1]]) - lim--; - totlen = traditional ? 0 : 2; /* Count opening and closing quote. */ - while (buf != lim) { - register U_CHAR c = *buf++; - totlen++; - /* Internal sequences of whitespace are replaced by one space - in most cases, but not always. So count all the whitespace - in case we need to keep it all. */ -#if 0 - if (is_space[c]) - SKIP_ALL_WHITE_SPACE (buf); - else -#endif - if (c == '\"' || c == '\\') /* escape these chars */ - totlen++; - } - argptr->stringified_length = totlen; - } - return result; -} - -/* Scan text from START (inclusive) up to LIMIT (exclusive), - taken from the expansion of MACRO, - counting parens in *DEPTHPTR, - and return if reach LIMIT - or before a `)' that would make *DEPTHPTR negative - or before a comma when *DEPTHPTR is zero. - Single and double quotes are matched and termination - is inhibited within them. Comments also inhibit it. - Value returned is pointer to stopping place. - - Increment *NEWLINES each time a newline is passed. - REST_ARGS notifies macarg1 that it should absorb the rest of the args. - Set *COMMENTS to 1 if a comment is seen. */ - -static U_CHAR * -macarg1 (start, limit, macro, depthptr, newlines, comments, rest_args) - U_CHAR *start; - register U_CHAR *limit; - struct hashnode *macro; - int *depthptr, *newlines, *comments; - int rest_args; -{ - register U_CHAR *bp = start; - - while (bp < limit) { - switch (*bp) { - case '(': - (*depthptr)++; - break; - case ')': - if (--(*depthptr) < 0) - return bp; - break; - case '\\': - /* Traditionally, backslash makes following char not special. */ - if (traditional && bp + 1 < limit && bp[1] != '\n') - bp++; - break; - case '\n': - ++*newlines; - break; - case '/': - if (macro) - break; - if (bp[1] == '\\' && bp[2] == '\n') - newline_fix (bp + 1); - if (bp[1] == '*') { - *comments = 1; - for (bp += 2; bp < limit; bp++) { - if (*bp == '\n') - ++*newlines; - else if (*bp == '*') { - if (bp[-1] == '/' && warn_comments) - warning ("`/*' within comment"); - if (bp[1] == '\\' && bp[2] == '\n') - newline_fix (bp + 1); - if (bp[1] == '/') { - bp++; - break; - } - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (bp, limit - bp); - if (length > 1) - bp += (length - 1); -#endif - } - } - } else if (bp[1] == '/' && cplusplus_comments) { - *comments = 1; - for (bp += 2; bp < limit; bp++) { - if (*bp == '\n') { - ++*newlines; - break; - } - if (*bp == '\\' && bp + 1 < limit && bp[1] == '\n') - { - ++*newlines; - if (warn_comments) - warning ("multiline `//' comment"); - ++bp; - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (bp, limit - bp); - if (length > 1) - bp += (length - 1); -#endif - } - } - } - break; - case '\'': - case '\"': - { - int quotec; - for (quotec = *bp++; bp + 1 < limit && *bp != quotec; bp++) { - if (*bp == '\\') { - bp++; - if (*bp == '\n') - ++*newlines; - if (!macro) { - while (*bp == '\\' && bp[1] == '\n') { - bp += 2; - ++*newlines; - } - } - } else if (*bp == '\n') { - ++*newlines; - if (quotec == '\'') - break; - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - length = local_mblen (bp, limit - bp); - if (length > 1) - bp += (length - 1); -#endif - } - } - } - break; - case ',': - /* if we've returned to lowest level and we aren't absorbing all args */ - if ((*depthptr) == 0 && rest_args == 0) - return bp; - break; - } - bp++; - } - - return bp; -} - -/* Discard comments and duplicate newlines - in the string of length LENGTH at START, - except inside of string constants. - The string is copied into itself with its beginning staying fixed. - - NEWLINES is the number of newlines that must be duplicated. - We assume that that much extra space is available past the end - of the string. */ - -static int -discard_comments (start, length, newlines) - U_CHAR *start; - int length; - int newlines; -{ - register U_CHAR *ibp; - register U_CHAR *obp; - register U_CHAR *limit; - register int c; - - /* If we have newlines to duplicate, copy everything - that many characters up. Then, in the second part, - we will have room to insert the newlines - while copying down. - NEWLINES may actually be too large, because it counts - newlines in string constants, and we don't duplicate those. - But that does no harm. */ - if (newlines > 0) { - ibp = start + length; - obp = ibp + newlines; - limit = start; - while (limit != ibp) - *--obp = *--ibp; - } - - ibp = start + newlines; - limit = start + length + newlines; - obp = start; - - while (ibp < limit) { - *obp++ = c = *ibp++; - switch (c) { - case '\n': - /* Duplicate the newline. */ - *obp++ = '\n'; - break; - - case '\\': - if (*ibp == '\n') { - obp--; - ibp++; - } - break; - - case '/': - if (*ibp == '\\' && ibp[1] == '\n') - newline_fix (ibp); - /* Delete any comment. */ - if (cplusplus_comments && ibp[0] == '/') { - /* Comments are equivalent to spaces. */ - obp[-1] = ' '; - ibp++; - while (ibp < limit) - { - if (*ibp == '\n') - break; - if (*ibp == '\\' && ibp + 1 < limit && ibp[1] == '\n') - ibp++; - else - { -#ifdef MULTIBYTE_CHARS - int length = local_mblen (ibp, limit - ibp); - if (length > 1) - ibp += (length - 1); -#endif - } - ibp++; - } - break; - } - if (ibp[0] != '*' || ibp + 1 >= limit) - break; - /* Comments are equivalent to spaces. - For -traditional, a comment is equivalent to nothing. */ - if (traditional) - obp--; - else - obp[-1] = ' '; - while (++ibp < limit) { - if (ibp[0] == '*') { - if (ibp[1] == '\\' && ibp[2] == '\n') - newline_fix (ibp + 1); - if (ibp[1] == '/') { - ibp += 2; - break; - } - } - else - { -#ifdef MULTIBYTE_CHARS - int length = local_mblen (ibp, limit - ibp); - if (length > 1) - ibp += (length - 1); -#endif - } - } - break; - - case '\'': - case '\"': - /* Notice and skip strings, so that we don't - think that comments start inside them, - and so we don't duplicate newlines in them. */ - { - int quotec = c; - while (ibp < limit) { - *obp++ = c = *ibp++; - if (c == quotec) - break; - if (c == '\n') - { - if (quotec == '\'') - break; - } - else if (c == '\\') { - if (ibp < limit && *ibp == '\n') { - ibp++; - obp--; - } else { - while (*ibp == '\\' && ibp[1] == '\n') - ibp += 2; - if (ibp < limit) - *obp++ = *ibp++; - } - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - ibp--; - length = local_mblen (ibp, limit - ibp); - if (length > 1) - { - obp--; - bcopy (ibp, obp, length); - ibp += length; - obp += length; - } - else - ibp++; -#endif - } - } - } - break; - } - } - - return obp - start; -} - -/* Turn newlines to spaces in the string of length LENGTH at START, - except inside of string constants. - The string is copied into itself with its beginning staying fixed. */ - -static int -change_newlines (start, length) - U_CHAR *start; - int length; -{ - register U_CHAR *ibp; - register U_CHAR *obp; - register U_CHAR *limit; - register int c; - - ibp = start; - limit = start + length; - obp = start; - - while (ibp < limit) { - *obp++ = c = *ibp++; - switch (c) { - case '\n': - /* If this is a NEWLINE NEWLINE, then this is a real newline in the - string. Skip past the newline and its duplicate. - Put a space in the output. */ - if (*ibp == '\n') - { - ibp++; - obp--; - *obp++ = ' '; - } - break; - - case '\'': - case '\"': - /* Notice and skip strings, so that we don't delete newlines in them. */ - { - int quotec = c; - while (ibp < limit) { - *obp++ = c = *ibp++; - if (c == quotec) - break; - else if (c == '\\' && ibp < limit && *ibp == '\n') - *obp++ = *ibp++; - else if (c == '\n') - { - if (quotec == '\'') - break; - } - else - { -#ifdef MULTIBYTE_CHARS - int length; - ibp--; - length = local_mblen (ibp, limit - ibp); - if (length > 1) - { - obp--; - bcopy (ibp, obp, length); - ibp += length; - obp += length; - } - else - ibp++; -#endif - } - } - } - break; - } - } - - return obp - start; -} - -/* my_strerror - return the descriptive text associated with an - `errno' code. */ - -static char * -my_strerror (errnum) - int errnum; -{ - char *result; - -#ifndef VMS -#ifndef HAVE_STRERROR - result = (char *) ((errnum < sys_nerr) ? sys_errlist[errnum] : 0); -#else - result = strerror (errnum); -#endif -#else /* VMS */ - /* VAXCRTL's strerror() takes an optional second argument, which only - matters when the first argument is EVMSERR. However, it's simplest - just to pass it unconditionally. `vaxc$errno' is declared in - , and maintained by the library in parallel with `errno'. - We assume that caller's `errnum' either matches the last setting of - `errno' by the library or else does not have the value `EVMSERR'. */ - - result = strerror (errnum, vaxc$errno); -#endif - - if (!result) - result = "errno = ?"; - - return result; -} - -/* notice - output message to stderr */ - -static void -notice VPROTO ((const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (args, const char *); -#endif - - vnotice (msgid, args); - va_end (args); -} - -static void -vnotice (msgid, args) - const char *msgid; - va_list args; -{ - vfprintf (stderr, _(msgid), args); -} - -/* error - print error message and increment count of errors. */ - -void -error VPROTO ((const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (args, const char *); -#endif - - verror (msgid, args); - va_end (args); -} - -void -verror (msgid, args) - const char *msgid; - va_list args; -{ - int i; - FILE_BUF *ip = NULL; - - print_containing_files (); - - for (i = indepth; i >= 0; i--) - if (instack[i].fname != NULL) { - ip = &instack[i]; - break; - } - - if (ip != NULL) { - eprint_string (ip->nominal_fname, ip->nominal_fname_len); - fprintf (stderr, ":%d: ", ip->lineno); - } - vnotice (msgid, args); - fprintf (stderr, "\n"); - errors++; -} - -/* Error including a message from `errno'. */ - -static void -error_from_errno (name) - char *name; -{ - int e = errno; - int i; - FILE_BUF *ip = NULL; - - print_containing_files (); - - for (i = indepth; i >= 0; i--) - if (instack[i].fname != NULL) { - ip = &instack[i]; - break; - } - - if (ip != NULL) { - eprint_string (ip->nominal_fname, ip->nominal_fname_len); - fprintf (stderr, ":%d: ", ip->lineno); - } - - fprintf (stderr, "%s: %s\n", name, my_strerror (e)); - - errors++; -} - -/* Print error message but don't count it. */ - -void -warning VPROTO ((const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (args, const char *); -#endif - - vwarning (msgid, args); - va_end (args); -} - -static void -vwarning (msgid, args) - const char *msgid; - va_list args; -{ - int i; - FILE_BUF *ip = NULL; - - if (inhibit_warnings) - return; - - if (warnings_are_errors) - errors++; - - print_containing_files (); - - for (i = indepth; i >= 0; i--) - if (instack[i].fname != NULL) { - ip = &instack[i]; - break; - } - - if (ip != NULL) { - eprint_string (ip->nominal_fname, ip->nominal_fname_len); - fprintf (stderr, ":%d: ", ip->lineno); - } - notice ("warning: "); - vnotice (msgid, args); - fprintf (stderr, "\n"); -} - -static void -error_with_line VPROTO ((int line, const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - int line; - const char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - line = va_arg (args, int); - msgid = va_arg (args, const char *); -#endif - - verror_with_line (line, msgid, args); - va_end (args); -} - - -static void -verror_with_line (line, msgid, args) - int line; - const char *msgid; - va_list args; -{ - int i; - FILE_BUF *ip = NULL; - - print_containing_files (); - - for (i = indepth; i >= 0; i--) - if (instack[i].fname != NULL) { - ip = &instack[i]; - break; - } - - if (ip != NULL) { - eprint_string (ip->nominal_fname, ip->nominal_fname_len); - fprintf (stderr, ":%d: ", line); - } - vnotice (msgid, args); - fprintf (stderr, "\n"); - errors++; -} - -static void -warning_with_line VPROTO ((int line, const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - int line; - const char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - line = va_arg (args, int); - msgid = va_arg (args, const char *); -#endif - - vwarning_with_line (line, msgid, args); - va_end (args); -} - -static void -vwarning_with_line (line, msgid, args) - int line; - const char *msgid; - va_list args; -{ - int i; - FILE_BUF *ip = NULL; - - if (inhibit_warnings) - return; - - if (warnings_are_errors) - errors++; - - print_containing_files (); - - for (i = indepth; i >= 0; i--) - if (instack[i].fname != NULL) { - ip = &instack[i]; - break; - } - - if (ip != NULL) { - eprint_string (ip->nominal_fname, ip->nominal_fname_len); - fprintf (stderr, line ? ":%d: " : ": ", line); - } - notice ("warning: "); - vnotice (msgid, args); - fprintf (stderr, "\n"); -} - -/* Print an error message and maybe count it. */ - -void -pedwarn VPROTO ((const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (args, const char *); -#endif - - if (pedantic_errors) - verror (msgid, args); - else - vwarning (msgid, args); - va_end (args); -} - -void -pedwarn_with_line VPROTO ((int line, const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - int line; - const char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - line = va_arg (args, int); - msgid = va_arg (args, const char *); -#endif - - if (pedantic_errors) - verror_with_line (line, msgid, args); - else - vwarning_with_line (line, msgid, args); - va_end (args); -} - -/* Report a warning (or an error if pedantic_errors) - giving specified file name and line number, not current. */ - -static void -pedwarn_with_file_and_line VPROTO ((const char *file, size_t file_len, int line, - const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char *file; - size_t file_len; - int line; - const char * msgid; -#endif - va_list args; - - if (!pedantic_errors && inhibit_warnings) - return; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - file = va_arg (args, const char *); - file_len = va_arg (args, size_t); - line = va_arg (args, int); - msgid = va_arg (args, const char *); -#endif - - if (file) { - eprint_string (file, file_len); - fprintf (stderr, ":%d: ", line); - } - if (pedantic_errors) - errors++; - if (!pedantic_errors) - notice ("warning: "); - vnotice (msgid, args); - va_end (args); - fprintf (stderr, "\n"); -} - -static void -pedwarn_strange_white_space (ch) - int ch; -{ - switch (ch) - { - case '\f': pedwarn ("formfeed in preprocessing directive"); break; - case '\r': pedwarn ("carriage return in preprocessing directive"); break; - case '\v': pedwarn ("vertical tab in preprocessing directive"); break; - default: abort (); - } -} - -/* Print the file names and line numbers of the #include - directives which led to the current file. */ - -static void -print_containing_files () -{ - FILE_BUF *ip = NULL; - int i; - int first = 1; - - /* If stack of files hasn't changed since we last printed - this info, don't repeat it. */ - if (last_error_tick == input_file_stack_tick) - return; - - for (i = indepth; i >= 0; i--) - if (instack[i].fname != NULL) { - ip = &instack[i]; - break; - } - - /* Give up if we don't find a source file. */ - if (ip == NULL) - return; - - /* Find the other, outer source files. */ - for (i--; i >= 0; i--) - if (instack[i].fname != NULL) { - ip = &instack[i]; - if (first) { - first = 0; - notice ( "In file included from "); - } else { - notice (",\n from "); - } - - eprint_string (ip->nominal_fname, ip->nominal_fname_len); - fprintf (stderr, ":%d", ip->lineno); - } - if (! first) - fprintf (stderr, ":\n"); - - /* Record we have printed the status as of this time. */ - last_error_tick = input_file_stack_tick; -} - -/* Return the line at which an error occurred. - The error is not necessarily associated with the current spot - in the input stack, so LINE says where. LINE will have been - copied from ip->lineno for the current input level. - If the current level is for a file, we return LINE. - But if the current level is not for a file, LINE is meaningless. - In that case, we return the lineno of the innermost file. */ - -static int -line_for_error (line) - int line; -{ - int i; - int line1 = line; - - for (i = indepth; i >= 0; ) { - if (instack[i].fname != 0) - return line1; - i--; - if (i < 0) - return 0; - line1 = instack[i].lineno; - } - abort (); - /*NOTREACHED*/ - return 0; -} - -/* - * If OBUF doesn't have NEEDED bytes after OPTR, make it bigger. - * - * As things stand, nothing is ever placed in the output buffer to be - * removed again except when it's KNOWN to be part of an identifier, - * so flushing and moving down everything left, instead of expanding, - * should work ok. - */ - -/* You might think void was cleaner for the return type, - but that would get type mismatch in check_expand in strict ANSI. */ - -static int -grow_outbuf (obuf, needed) - register FILE_BUF *obuf; - register int needed; -{ - register U_CHAR *p; - int minsize; - - if (obuf->length - (obuf->bufp - obuf->buf) > needed) - return 0; - - /* Make it at least twice as big as it is now. */ - obuf->length *= 2; - /* Make it have at least 150% of the free space we will need. */ - minsize = (3 * needed) / 2 + (obuf->bufp - obuf->buf); - if (minsize > obuf->length) - obuf->length = minsize; - - if ((p = (U_CHAR *) xrealloc (obuf->buf, obuf->length)) == NULL) - memory_full (); - - obuf->bufp = p + (obuf->bufp - obuf->buf); - obuf->buf = p; - - return 0; -} - -/* Symbol table for macro names and special symbols */ - -/* - * install a name in the main hash table, even if it is already there. - * name stops with first non alphanumeric, except leading '#'. - * caller must check against redefinition if that is desired. - * delete_macro () removes things installed by install () in fifo order. - * this is important because of the `defined' special symbol used - * in #if, and also if pushdef/popdef directives are ever implemented. - * - * If LEN is >= 0, it is the length of the name. - * Otherwise, compute the length by scanning the entire name. - * - * If HASH is >= 0, it is the precomputed hash code. - * Otherwise, compute the hash code. - */ - -static HASHNODE * -install (name, len, type, value, hash) - U_CHAR *name; - int len; - enum node_type type; - char *value; - int hash; -{ - register HASHNODE *hp; - register int i, bucket; - register U_CHAR *p, *q; - - if (len < 0) { - p = name; - while (is_idchar[*p]) - p++; - len = p - name; - } - - if (hash < 0) - hash = hashf (name, len, HASHSIZE); - - i = sizeof (HASHNODE) + len + 1; - hp = (HASHNODE *) xmalloc (i); - bucket = hash; - hp->bucket_hdr = &hashtab[bucket]; - hp->next = hashtab[bucket]; - hashtab[bucket] = hp; - hp->prev = NULL; - if (hp->next != NULL) - hp->next->prev = hp; - hp->type = type; - hp->length = len; - hp->value.cpval = value; - hp->name = ((U_CHAR *) hp) + sizeof (HASHNODE); - p = hp->name; - q = name; - for (i = 0; i < len; i++) - *p++ = *q++; - hp->name[len] = 0; - return hp; -} - -/* - * find the most recent hash node for name "name" (ending with first - * non-identifier char) installed by install - * - * If LEN is >= 0, it is the length of the name. - * Otherwise, compute the length by scanning the entire name. - * - * If HASH is >= 0, it is the precomputed hash code. - * Otherwise, compute the hash code. - */ - -HASHNODE * -lookup (name, len, hash) - U_CHAR *name; - int len; - int hash; -{ - register U_CHAR *bp; - register HASHNODE *bucket; - - if (len < 0) { - for (bp = name; is_idchar[*bp]; bp++) ; - len = bp - name; - } - - if (hash < 0) - hash = hashf (name, len, HASHSIZE); - - bucket = hashtab[hash]; - while (bucket) { - if (bucket->length == len && bcmp (bucket->name, name, len) == 0) - return bucket; - bucket = bucket->next; - } - return NULL; -} - -/* - * Delete a hash node. Some weirdness to free junk from macros. - * More such weirdness will have to be added if you define more hash - * types that need it. - */ - -/* Note that the DEFINITION of a macro is removed from the hash table - but its storage is not freed. This would be a storage leak - except that it is not reasonable to keep undefining and redefining - large numbers of macros many times. - In any case, this is necessary, because a macro can be #undef'd - in the middle of reading the arguments to a call to it. - If #undef freed the DEFINITION, that would crash. */ - -static void -delete_macro (hp) - HASHNODE *hp; -{ - - if (hp->prev != NULL) - hp->prev->next = hp->next; - if (hp->next != NULL) - hp->next->prev = hp->prev; - - /* Make sure that the bucket chain header that the deleted guy was - on points to the right thing afterwards. */ - if (hp == *hp->bucket_hdr) - *hp->bucket_hdr = hp->next; - -#if 0 - if (hp->type == T_MACRO) { - DEFINITION *d = hp->value.defn; - struct reflist *ap, *nextap; - - for (ap = d->pattern; ap != NULL; ap = nextap) { - nextap = ap->next; - free (ap); - } - free (d); - } -#endif - free (hp); -} - -/* - * return hash function on name. must be compatible with the one - * computed a step at a time, elsewhere - */ - -static int -hashf (name, len, hashsize) - register U_CHAR *name; - register int len; - int hashsize; -{ - register int r = 0; - - while (len--) - r = HASHSTEP (r, *name++); - - return MAKE_POS (r) % hashsize; -} - - -/* Dump the definition of a single macro HP to OF. */ - -static void -dump_single_macro (hp, of) - register HASHNODE *hp; - FILE *of; -{ - register DEFINITION *defn = hp->value.defn; - struct reflist *ap; - int offset; - int concat; - - - /* Print the definition of the macro HP. */ - - fprintf (of, "#define %s", hp->name); - - if (defn->nargs >= 0) { - int i; - - fprintf (of, "("); - for (i = 0; i < defn->nargs; i++) { - dump_arg_n (defn, i, of); - if (i + 1 < defn->nargs) - fprintf (of, ", "); - } - fprintf (of, ")"); - } - - fprintf (of, " "); - - offset = 0; - concat = 0; - for (ap = defn->pattern; ap != NULL; ap = ap->next) { - dump_defn_1 (defn->expansion, offset, ap->nchars, of); - offset += ap->nchars; - if (!traditional) { - if (ap->nchars != 0) - concat = 0; - if (ap->stringify) { - switch (ap->stringify) { - case SHARP_TOKEN: fprintf (of, "#"); break; - case WHITE_SHARP_TOKEN: fprintf (of, "# "); break; - case PERCENT_COLON_TOKEN: fprintf (of, "%%:"); break; - case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%: "); break; - default: abort (); - } - } - if (ap->raw_before != 0) { - if (concat) { - switch (ap->raw_before) { - case WHITE_SHARP_TOKEN: - case WHITE_PERCENT_COLON_TOKEN: - fprintf (of, " "); - break; - default: - break; - } - } else { - switch (ap->raw_before) { - case SHARP_TOKEN: fprintf (of, "##"); break; - case WHITE_SHARP_TOKEN: fprintf (of, "## "); break; - case PERCENT_COLON_TOKEN: fprintf (of, "%%:%%:"); break; - case WHITE_PERCENT_COLON_TOKEN: fprintf (of, "%%:%%: "); break; - default: abort (); - } - } - } - concat = 0; - } - dump_arg_n (defn, ap->argno, of); - if (!traditional && ap->raw_after != 0) { - switch (ap->raw_after) { - case SHARP_TOKEN: fprintf (of, "##"); break; - case WHITE_SHARP_TOKEN: fprintf (of, " ##"); break; - case PERCENT_COLON_TOKEN: fprintf (of, "%%:%%:"); break; - case WHITE_PERCENT_COLON_TOKEN: fprintf (of, " %%:%%:"); break; - default: abort (); - } - concat = 1; - } - } - dump_defn_1 (defn->expansion, offset, defn->length - offset, of); - fprintf (of, "\n"); -} - -/* Dump all macro definitions as #defines to stdout. */ - -static void -dump_all_macros () -{ - int bucket; - - for (bucket = 0; bucket < HASHSIZE; bucket++) { - register HASHNODE *hp; - - for (hp = hashtab[bucket]; hp; hp= hp->next) { - if (hp->type == T_MACRO) - dump_single_macro (hp, stdout); - } - } -} - -/* Output to OF a substring of a macro definition. - BASE is the beginning of the definition. - Output characters START thru LENGTH. - Unless traditional, discard newlines outside of strings, thus - converting funny-space markers to ordinary spaces. */ - -static void -dump_defn_1 (base, start, length, of) - U_CHAR *base; - int start; - int length; - FILE *of; -{ - U_CHAR *p = base + start; - U_CHAR *limit = base + start + length; - - if (traditional) - fwrite (p, sizeof (*p), length, of); - else { - while (p < limit) { - if (*p == '\"' || *p =='\'') { - U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR, - NULL_PTR, NULL_PTR); - fwrite (p, sizeof (*p), p1 - p, of); - p = p1; - } else { - if (*p != '\n') - putc (*p, of); - p++; - } - } - } -} - -/* Print the name of argument number ARGNUM of macro definition DEFN - to OF. - Recall that DEFN->args.argnames contains all the arg names - concatenated in reverse order with comma-space in between. */ - -static void -dump_arg_n (defn, argnum, of) - DEFINITION *defn; - int argnum; - FILE *of; -{ - register U_CHAR *p = defn->args.argnames; - while (argnum + 1 < defn->nargs) { - p = (U_CHAR *) index ((char *) p, ' ') + 1; - argnum++; - } - - while (*p && *p != ',') { - putc (*p, of); - p++; - } -} - -/* Initialize syntactic classifications of characters. */ - -static void -initialize_char_syntax () -{ - register int i; - - /* - * Set up is_idchar and is_idstart tables. These should be - * faster than saying (is_alpha (c) || c == '_'), etc. - * Set up these things before calling any routines tthat - * refer to them. - */ - for (i = 'a'; i <= 'z'; i++) { - is_idchar[i - 'a' + 'A'] = 1; - is_idchar[i] = 1; - is_idstart[i - 'a' + 'A'] = 1; - is_idstart[i] = 1; - } - for (i = '0'; i <= '9'; i++) - is_idchar[i] = 1; - is_idchar['_'] = 1; - is_idstart['_'] = 1; - is_idchar['$'] = 1; - is_idstart['$'] = 1; - - /* horizontal space table */ - is_hor_space[' '] = 1; - is_hor_space['\t'] = 1; - is_hor_space['\v'] = 1; - is_hor_space['\f'] = 1; - is_hor_space['\r'] = 1; - - is_space[' '] = 1; - is_space['\t'] = 1; - is_space['\v'] = 1; - is_space['\f'] = 1; - is_space['\n'] = 1; - is_space['\r'] = 1; -} - -/* Initialize the built-in macros. */ - -static void -initialize_builtins (inp, outp) - FILE_BUF *inp; - FILE_BUF *outp; -{ - install ((U_CHAR *) "__LINE__", -1, T_SPECLINE, NULL_PTR, -1); - install ((U_CHAR *) "__DATE__", -1, T_DATE, NULL_PTR, -1); - install ((U_CHAR *) "__FILE__", -1, T_FILE, NULL_PTR, -1); - install ((U_CHAR *) "__BASE_FILE__", -1, T_BASE_FILE, NULL_PTR, -1); - install ((U_CHAR *) "__INCLUDE_LEVEL__", -1, T_INCLUDE_LEVEL, NULL_PTR, -1); - install ((U_CHAR *) "__VERSION__", -1, T_VERSION, NULL_PTR, -1); -#ifndef NO_BUILTIN_SIZE_TYPE - install ((U_CHAR *) "__SIZE_TYPE__", -1, T_SIZE_TYPE, NULL_PTR, -1); -#endif -#ifndef NO_BUILTIN_PTRDIFF_TYPE - install ((U_CHAR *) "__PTRDIFF_TYPE__ ", -1, T_PTRDIFF_TYPE, NULL_PTR, -1); -#endif - install ((U_CHAR *) "__WCHAR_TYPE__", -1, T_WCHAR_TYPE, NULL_PTR, -1); - install ((U_CHAR *) "__USER_LABEL_PREFIX__", -1, T_USER_LABEL_PREFIX_TYPE, - NULL_PTR, -1); - install ((U_CHAR *) "__REGISTER_PREFIX__", -1, T_REGISTER_PREFIX_TYPE, - NULL_PTR, -1); - install ((U_CHAR *) "__IMMEDIATE_PREFIX__", -1, T_IMMEDIATE_PREFIX_TYPE, - NULL_PTR, -1); - install ((U_CHAR *) "__TIME__", -1, T_TIME, NULL_PTR, -1); - if (!traditional) { - install ((U_CHAR *) "__STDC__", -1, T_CONST, "1", -1); - install ((U_CHAR *) "__STDC_VERSION__", -1, T_CONST, "199409L", -1); - } -/* This is supplied using a -D by the compiler driver - so that it is present only when truly compiling with GNU C. */ -/* install ((U_CHAR *) "__GNUC__", -1, T_CONST, "2", -1); */ - install ((U_CHAR *) "__HAVE_BUILTIN_SETJMP__", -1, T_CONST, "1", -1); - - if (debug_output) - { - char directive[2048]; - U_CHAR *udirective = (U_CHAR *) directive; - register struct directive *dp = &directive_table[0]; - struct tm *timebuf = timestamp (); - - sprintf (directive, " __BASE_FILE__ \"%s\"\n", - instack[0].nominal_fname); - output_line_directive (inp, outp, 0, same_file); - pass_thru_directive (udirective, &udirective[strlen (directive)], - outp, dp); - - sprintf (directive, " __VERSION__ \"%s\"\n", version_string); - output_line_directive (inp, outp, 0, same_file); - pass_thru_directive (udirective, &udirective[strlen (directive)], - outp, dp); - -#ifndef NO_BUILTIN_SIZE_TYPE - sprintf (directive, " __SIZE_TYPE__ %s\n", SIZE_TYPE); - output_line_directive (inp, outp, 0, same_file); - pass_thru_directive (udirective, &udirective[strlen (directive)], - outp, dp); -#endif - -#ifndef NO_BUILTIN_PTRDIFF_TYPE - sprintf (directive, " __PTRDIFF_TYPE__ %s\n", PTRDIFF_TYPE); - output_line_directive (inp, outp, 0, same_file); - pass_thru_directive (udirective, &udirective[strlen (directive)], - outp, dp); -#endif - - sprintf (directive, " __WCHAR_TYPE__ %s\n", wchar_type); - output_line_directive (inp, outp, 0, same_file); - pass_thru_directive (udirective, &udirective[strlen (directive)], - outp, dp); - - sprintf (directive, " __DATE__ \"%s %2d %4d\"\n", - monthnames[timebuf->tm_mon], - timebuf->tm_mday, timebuf->tm_year + 1900); - output_line_directive (inp, outp, 0, same_file); - pass_thru_directive (udirective, &udirective[strlen (directive)], - outp, dp); - - sprintf (directive, " __TIME__ \"%02d:%02d:%02d\"\n", - timebuf->tm_hour, timebuf->tm_min, timebuf->tm_sec); - output_line_directive (inp, outp, 0, same_file); - pass_thru_directive (udirective, &udirective[strlen (directive)], - outp, dp); - - if (!traditional) - { - sprintf (directive, " __STDC__ 1"); - output_line_directive (inp, outp, 0, same_file); - pass_thru_directive (udirective, &udirective[strlen (directive)], - outp, dp); - } - if (objc) - { - sprintf (directive, " __OBJC__ 1"); - output_line_directive (inp, outp, 0, same_file); - pass_thru_directive (udirective, &udirective[strlen (directive)], - outp, dp); - } - } -} - -/* - * process a given definition string, for initialization - * If STR is just an identifier, define it with value 1. - * If STR has anything after the identifier, then it should - * be identifier=definition. - */ - -static void -make_definition (str) - char *str; -{ - FILE_BUF *ip; - struct directive *kt; - U_CHAR *buf, *p; - - p = buf = (U_CHAR *) str; - if (!is_idstart[*p]) { - error ("malformed option `-D %s'", str); - return; - } - while (is_idchar[*++p]) - ; - if (*p == '(') { - while (is_idchar[*++p] || *p == ',' || is_hor_space[*p]) - ; - if (*p++ != ')') - p = (U_CHAR *) str; /* Error */ - } - if (*p == 0) { - buf = (U_CHAR *) alloca (p - buf + 4); - strcpy ((char *)buf, str); - strcat ((char *)buf, " 1"); - } else if (*p != '=') { - error ("malformed option `-D %s'", str); - return; - } else { - U_CHAR *q; - /* Copy the entire option so we can modify it. */ - buf = (U_CHAR *) alloca (2 * strlen (str) + 1); - strncpy ((char *) buf, str, p - (U_CHAR *) str); - /* Change the = to a space. */ - buf[p - (U_CHAR *) str] = ' '; - /* Scan for any backslash-newline and remove it. */ - p++; - q = &buf[p - (U_CHAR *) str]; - while (*p) { - if (*p == '\"' || *p == '\'') { - int unterminated = 0; - U_CHAR *p1 = skip_quoted_string (p, p + strlen ((char *) p), 0, - NULL_PTR, NULL_PTR, &unterminated); - if (unterminated) - return; - while (p != p1) - *q++ = *p++; - } else if (*p == '\\' && p[1] == '\n') - p += 2; - /* Change newline chars into newline-markers. */ - else if (*p == '\n') - { - *q++ = '\n'; - *q++ = '\n'; - p++; - } - else - *q++ = *p++; - } - *q = 0; - } - - ip = &instack[++indepth]; - ip->nominal_fname = ip->fname = "*Initialization*"; - ip->nominal_fname_len = strlen (ip->nominal_fname); - - ip->buf = ip->bufp = buf; - ip->length = strlen ((char *) buf); - ip->lineno = 1; - ip->macro = 0; - ip->free_ptr = 0; - ip->if_stack = if_stack; - ip->system_header_p = 0; - - for (kt = directive_table; kt->type != T_DEFINE; kt++) - ; - - /* Pass NULL instead of OP, since this is a "predefined" macro. */ - do_define (buf, buf + strlen ((char *) buf), NULL_PTR, kt); - --indepth; -} - -/* JF, this does the work for the -U option */ - -static void -make_undef (str, op) - char *str; - FILE_BUF *op; -{ - FILE_BUF *ip; - struct directive *kt; - - ip = &instack[++indepth]; - ip->nominal_fname = ip->fname = "*undef*"; - ip->nominal_fname_len = strlen (ip->nominal_fname); - - ip->buf = ip->bufp = (U_CHAR *) str; - ip->length = strlen (str); - ip->lineno = 1; - ip->macro = 0; - ip->free_ptr = 0; - ip->if_stack = if_stack; - ip->system_header_p = 0; - - for (kt = directive_table; kt->type != T_UNDEF; kt++) - ; - - do_undef ((U_CHAR *) str, (U_CHAR *) str + strlen (str), op, kt); - --indepth; -} - -/* Process the string STR as if it appeared as the body of a #assert. - OPTION is the option name for which STR was the argument. */ - -static void -make_assertion (option, str) - const char *option; - const char *str; -{ - FILE_BUF *ip; - struct directive *kt; - U_CHAR *buf, *p, *q; - - /* Copy the entire option so we can modify it. */ - buf = (U_CHAR *) alloca (strlen (str) + 1); - strcpy ((char *) buf, str); - /* Scan for any backslash-newline and remove it. */ - p = q = buf; - while (*p) { - if (*p == '\\' && p[1] == '\n') - p += 2; - else - *q++ = *p++; - } - *q = 0; - - p = buf; - if (!is_idstart[*p]) { - error ("malformed option `%s %s'", option, str); - return; - } - while (is_idchar[*++p]) - ; - SKIP_WHITE_SPACE (p); - if (! (*p == 0 || *p == '(')) { - error ("malformed option `%s %s'", option, str); - return; - } - - ip = &instack[++indepth]; - ip->nominal_fname = ip->fname = "*Initialization*"; - ip->nominal_fname_len = strlen (ip->nominal_fname); - - ip->buf = ip->bufp = buf; - ip->length = strlen ((char *) buf); - ip->lineno = 1; - ip->macro = 0; - ip->free_ptr = 0; - ip->if_stack = if_stack; - ip->system_header_p = 0; - - for (kt = directive_table; kt->type != T_ASSERT; kt++) - ; - - /* Pass NULL as output ptr to do_define since we KNOW it never does - any output.... */ - do_assert (buf, buf + strlen ((char *) buf) , NULL_PTR, kt); - --indepth; -} - -/* The previous include prefix, if any, is PREV_FILE_NAME. - Translate any pathnames with COMPONENT. - Allocate a new include prefix whose name is the - simplified concatenation of PREFIX and NAME, - with a trailing / added if needed. - But return 0 if the include prefix should be ignored, - e.g. because it is a duplicate of PREV_FILE_NAME. */ - -static struct file_name_list * -new_include_prefix (prev_file_name, component, prefix, name) - struct file_name_list *prev_file_name; - const char *component; - const char *prefix; - const char *name; -{ - if (name == 0) - fatal ("Directory name missing after command line option"); - - if (*name == 0) - /* Ignore the empty string. */ - return 0; - - prefix = update_path (prefix, component); - name = update_path (name, component); - - { - struct file_name_list *dir - = ((struct file_name_list *) - xmalloc (sizeof (struct file_name_list) - + strlen (prefix) + strlen (name) + 2)); - size_t len; - strcpy (dir->fname, prefix); - strcat (dir->fname, name); - len = simplify_filename (dir->fname); - - /* Convert directory name to a prefix. */ - if (len && dir->fname[len - 1] != DIR_SEPARATOR) { - if (len == 1 && dir->fname[len - 1] == '.') - len = 0; - else -#ifdef VMS - /* must be '/', hack_vms_include_specification triggers on it. */ - dir->fname[len++] = '/'; -#else - dir->fname[len++] = DIR_SEPARATOR; -#endif - dir->fname[len] = 0; - } - - /* Ignore a directory whose name matches the previous one. */ - if (prev_file_name && !strcmp (prev_file_name->fname, dir->fname)) { - /* But treat `-Idir -I- -Idir' as `-I- -Idir'. */ - if (!first_bracket_include) - first_bracket_include = prev_file_name; - free (dir); - return 0; - } - -#ifndef VMS - /* VMS can't stat dir prefixes, so skip these optimizations in VMS. */ - - /* Add a trailing "." if there is a filename. This increases the number - of systems that can stat directories. We remove it below. */ - if (len != 0) - { - dir->fname[len] = '.'; - dir->fname[len + 1] = 0; - } - - /* Ignore a nonexistent directory. */ - if (stat (len ? dir->fname : ".", &dir->st) != 0) { - if (errno != ENOENT && errno != ENOTDIR) - error_from_errno (dir->fname); - free (dir); - return 0; - } - - if (len != 0) - dir->fname[len] = 0; - - /* Ignore a directory whose identity matches the previous one. */ - if (prev_file_name - && INO_T_EQ (prev_file_name->st.st_ino, dir->st.st_ino) - && prev_file_name->st.st_dev == dir->st.st_dev) { - /* But treat `-Idir -I- -Idir' as `-I- -Idir'. */ - if (!first_bracket_include) - first_bracket_include = prev_file_name; - free (dir); - return 0; - } -#endif /* ! VMS */ - - dir->next = 0; - dir->c_system_include_path = 0; - dir->got_name_map = 0; - - return dir; - } -} - -/* Append a chain of `struct file_name_list's - to the end of the main include chain. - FIRST is the beginning of the chain to append, and LAST is the end. */ - -static void -append_include_chain (first, last) - struct file_name_list *first, *last; -{ - struct file_name_list *dir; - - if (!first || !last) - return; - - if (include == 0) - include = first; - else - last_include->next = first; - - if (first_bracket_include == 0) - first_bracket_include = first; - - for (dir = first; ; dir = dir->next) { - int len = strlen (dir->fname) + INCLUDE_LEN_FUDGE; - if (len > max_include_len) - max_include_len = len; - if (dir == last) - break; - } - - last->next = NULL; - last_include = last; -} - -/* Place into DST a representation of the file named SRC that is suitable - for `make'. Do not null-terminate DST. Return its length. */ -static int -quote_string_for_make (dst, src) - char *dst; - const char *src; -{ - const char *p = src; - int i = 0; - for (;;) - { - char c = *p++; - switch (c) - { - case '\0': - case ' ': - case '\t': - { - /* GNU make uses a weird quoting scheme for white space. - A space or tab preceded by 2N+1 backslashes represents - N backslashes followed by space; a space or tab - preceded by 2N backslashes represents N backslashes at - the end of a file name; and backslashes in other - contexts should not be doubled. */ - const char *q; - for (q = p - 1; src < q && q[-1] == '\\'; q--) - { - if (dst) - dst[i] = '\\'; - i++; - } - } - if (!c) - return i; - if (dst) - dst[i] = '\\'; - i++; - goto ordinary_char; - - case '$': - if (dst) - dst[i] = c; - i++; - /* Fall through. This can mishandle things like "$(" but - there's no easy fix. */ - default: - ordinary_char: - /* This can mishandle characters in the string "\0\n%*?[\\~"; - exactly which chars are mishandled depends on the `make' version. - We know of no portable solution for this; - even GNU make 3.76.1 doesn't solve the problem entirely. - (Also, '\0' is mishandled due to our calling conventions.) */ - if (dst) - dst[i] = c; - i++; - break; - } - } -} - - -/* Add output to `deps_buffer' for the -M switch. - STRING points to the text to be output. - SPACER is ':' for targets, ' ' for dependencies. */ - -static void -deps_output (string, spacer) - const char *string; - int spacer; -{ - int size = quote_string_for_make ((char *) 0, string); - - if (size == 0) - return; - -#ifndef MAX_OUTPUT_COLUMNS -#define MAX_OUTPUT_COLUMNS 72 -#endif - if (MAX_OUTPUT_COLUMNS - 1 /*spacer*/ - 2 /*` \'*/ < deps_column + size - && 1 < deps_column) { - bcopy (" \\\n ", &deps_buffer[deps_size], 4); - deps_size += 4; - deps_column = 1; - if (spacer == ' ') - spacer = 0; - } - - if (deps_size + 2 * size + 8 > deps_allocated_size) { - deps_allocated_size = (deps_size + 2 * size + 50) * 2; - deps_buffer = xrealloc (deps_buffer, deps_allocated_size); - } - if (spacer == ' ') { - deps_buffer[deps_size++] = ' '; - deps_column++; - } - quote_string_for_make (&deps_buffer[deps_size], string); - deps_size += size; - deps_column += size; - if (spacer == ':') { - deps_buffer[deps_size++] = ':'; - deps_column++; - } - deps_buffer[deps_size] = 0; -} - -void -fatal VPROTO ((const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char * msgid; -#endif - va_list args; - - fprintf (stderr, "%s: ", progname); - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (args, const char *); -#endif - vnotice (msgid, args); - va_end (args); - fprintf (stderr, "\n"); - exit (FATAL_EXIT_CODE); -} - -/* More 'friendly' abort that prints the line and file. - config.h can #define abort fancy_abort if you like that sort of thing. */ - -void -fancy_abort () -{ - fatal ("Internal gcc abort."); -} - -static void -perror_with_name (name) - char *name; -{ - fprintf (stderr, "%s: %s: %s\n", progname, name, my_strerror (errno)); - errors++; -} - -static void -pfatal_with_name (name) - char *name; -{ - perror_with_name (name); -#ifdef VMS - exit (vaxc$errno); -#else - exit (FATAL_EXIT_CODE); -#endif -} - -/* Handler for SIGPIPE. */ - -static void -pipe_closed (signo) - /* If this is missing, some compilers complain. */ - int signo ATTRIBUTE_UNUSED; -{ - fatal ("output pipe has been closed"); -} - -static void -memory_full () -{ - fatal ("Memory exhausted."); -} - -PTR -xmalloc (size) - size_t size; -{ - register PTR ptr = (PTR) malloc (size); - if (!ptr) - memory_full (); - return ptr; -} - -PTR -xrealloc (old, size) - PTR old; - size_t size; -{ - register PTR ptr; - if (old) - ptr = (PTR) realloc (old, size); - else - ptr = (PTR) malloc (size); - if (!ptr) - memory_full (); - return ptr; -} - -PTR -xcalloc (number, size) - size_t number, size; -{ - register size_t total = number * size; - register PTR ptr = (PTR) malloc (total); - if (!ptr) - memory_full (); - bzero (ptr, total); - return ptr; -} - -char * -xstrdup (input) - const char *input; -{ - register size_t len = strlen (input) + 1; - register char *output = xmalloc (len); - memcpy (output, input, len); - return output; -} - -#ifdef VMS - -/* Under VMS we need to fix up the "include" specification filename. - - Rules for possible conversions - - fullname tried paths - - name name - ./dir/name [.dir]name - /dir/name dir:name - /name [000000]name, name - dir/name dir:[000000]name, dir:name, dir/name - dir1/dir2/name dir1:[dir2]name, dir1:[000000.dir2]name - path:/name path:[000000]name, path:name - path:/dir/name path:[000000.dir]name, path:[dir]name - path:dir/name path:[dir]name - [path]:[dir]name [path.dir]name - path/[dir]name [path.dir]name - - The path:/name input is constructed when expanding <> includes. - - return 1 if name was changed, 0 else. */ - -static int -hack_vms_include_specification (fullname, vaxc_include) - char *fullname; - int vaxc_include; -{ - register char *basename, *unixname, *local_ptr, *first_slash; - int f, check_filename_before_returning, must_revert; - char Local[512]; - - check_filename_before_returning = 0; - must_revert = 0; - /* See if we can find a 1st slash. If not, there's no path information. */ - first_slash = index (fullname, '/'); - if (first_slash == 0) - return 0; /* Nothing to do!!! */ - - /* construct device spec if none given. */ - - if (index (fullname, ':') == 0) - { - - /* If fullname has a slash, take it as device spec. */ - - if (first_slash == fullname) - { - first_slash = index (fullname+1, '/'); /* 2nd slash ? */ - if (first_slash) - *first_slash = ':'; /* make device spec */ - for (basename = fullname; *basename != 0; basename++) - *basename = *(basename+1); /* remove leading slash */ - } - else if ((first_slash[-1] != '.') /* keep ':/', './' */ - && (first_slash[-1] != ':') - && (first_slash[-1] != ']')) /* or a vms path */ - { - *first_slash = ':'; - } - else if ((first_slash[1] == '[') /* skip './' in './[dir' */ - && (first_slash[-1] == '.')) - fullname += 2; - } - - /* Get part after first ':' (basename[-1] == ':') - or last '/' (basename[-1] == '/'). */ - - basename = base_name (fullname); - - /* - * Check if we have a vax-c style '#include filename' - * and add the missing .h - */ - - if (vaxc_include && !index (basename,'.')) - strcat (basename, ".h"); - - local_ptr = Local; /* initialize */ - - /* We are trying to do a number of things here. First of all, we are - trying to hammer the filenames into a standard format, such that later - processing can handle them. - - If the file name contains something like [dir.], then it recognizes this - as a root, and strips the ".]". Later processing will add whatever is - needed to get things working properly. - - If no device is specified, then the first directory name is taken to be - a device name (or a rooted logical). */ - - /* Point to the UNIX filename part (which needs to be fixed!) - but skip vms path information. - [basename != fullname since first_slash != 0]. */ - - if ((basename[-1] == ':') /* vms path spec. */ - || (basename[-1] == ']') - || (basename[-1] == '>')) - unixname = basename; - else - unixname = fullname; - - if (*unixname == '/') - unixname++; - - /* If the directory spec is not rooted, we can just copy - the UNIX filename part and we are done. */ - - if (((basename - fullname) > 1) - && ( (basename[-1] == ']') - || (basename[-1] == '>'))) - { - if (basename[-2] != '.') - { - - /* The VMS part ends in a `]', and the preceding character is not a `.'. - -> PATH]:/name (basename = '/name', unixname = 'name') - We strip the `]', and then splice the two parts of the name in the - usual way. Given the default locations for include files in cccp.c, - we will only use this code if the user specifies alternate locations - with the /include (-I) switch on the command line. */ - - basename -= 1; /* Strip "]" */ - unixname--; /* backspace */ - } - else - { - - /* The VMS part has a ".]" at the end, and this will not do. Later - processing will add a second directory spec, and this would be a syntax - error. Thus we strip the ".]", and thus merge the directory specs. - We also backspace unixname, so that it points to a '/'. This inhibits the - generation of the 000000 root directory spec (which does not belong here - in this case). */ - - basename -= 2; /* Strip ".]" */ - unixname--; /* backspace */ - } - } - - else - - { - - /* We drop in here if there is no VMS style directory specification yet. - If there is no device specification either, we make the first dir a - device and try that. If we do not do this, then we will be essentially - searching the users default directory (as if they did a #include "asdf.h"). - - Then all we need to do is to push a '[' into the output string. Later - processing will fill this in, and close the bracket. */ - - if ((unixname != fullname) /* vms path spec found. */ - && (basename[-1] != ':')) - *local_ptr++ = ':'; /* dev not in spec. take first dir */ - - *local_ptr++ = '['; /* Open the directory specification */ - } - - if (unixname == fullname) /* no vms dir spec. */ - { - must_revert = 1; - if ((first_slash != 0) /* unix dir spec. */ - && (*unixname != '/') /* not beginning with '/' */ - && (*unixname != '.')) /* or './' or '../' */ - *local_ptr++ = '.'; /* dir is local ! */ - } - - /* at this point we assume that we have the device spec, and (at least - the opening "[" for a directory specification. We may have directories - specified already. - - If there are no other slashes then the filename will be - in the "root" directory. Otherwise, we need to add - directory specifications. */ - - if (index (unixname, '/') == 0) - { - /* if no directories specified yet and none are following. */ - if (local_ptr[-1] == '[') - { - /* Just add "000000]" as the directory string */ - strcpy (local_ptr, "000000]"); - local_ptr += strlen (local_ptr); - check_filename_before_returning = 1; /* we might need to fool with this later */ - } - } - else - { - - /* As long as there are still subdirectories to add, do them. */ - while (index (unixname, '/') != 0) - { - /* If this token is "." we can ignore it - if it's not at the beginning of a path. */ - if ((unixname[0] == '.') && (unixname[1] == '/')) - { - /* remove it at beginning of path. */ - if ( ((unixname == fullname) /* no device spec */ - && (fullname+2 != basename)) /* starts with ./ */ - /* or */ - || ((basename[-1] == ':') /* device spec */ - && (unixname-1 == basename))) /* and ./ afterwards */ - *local_ptr++ = '.'; /* make '[.' start of path. */ - unixname += 2; - continue; - } - - /* Add a subdirectory spec. Do not duplicate "." */ - if ( local_ptr[-1] != '.' - && local_ptr[-1] != '[' - && local_ptr[-1] != '<') - *local_ptr++ = '.'; - - /* If this is ".." then the spec becomes "-" */ - if ( (unixname[0] == '.') - && (unixname[1] == '.') - && (unixname[2] == '/')) - { - /* Add "-" and skip the ".." */ - if ((local_ptr[-1] == '.') - && (local_ptr[-2] == '[')) - local_ptr--; /* prevent [.- */ - *local_ptr++ = '-'; - unixname += 3; - continue; - } - - /* Copy the subdirectory */ - while (*unixname != '/') - *local_ptr++= *unixname++; - - unixname++; /* Skip the "/" */ - } - - /* Close the directory specification */ - if (local_ptr[-1] == '.') /* no trailing periods */ - local_ptr--; - - if (local_ptr[-1] == '[') /* no dir needed */ - local_ptr--; - else - *local_ptr++ = ']'; - } - - /* Now add the filename. */ - - while (*unixname) - *local_ptr++ = *unixname++; - *local_ptr = 0; - - /* Now append it to the original VMS spec. */ - - strcpy ((must_revert==1)?fullname:basename, Local); - - /* If we put a [000000] in the filename, try to open it first. If this fails, - remove the [000000], and return that name. This provides flexibility - to the user in that they can use both rooted and non-rooted logical names - to point to the location of the file. */ - - if (check_filename_before_returning) - { - f = open (fullname, O_RDONLY, 0666); - if (f >= 0) - { - /* The file name is OK as it is, so return it as is. */ - close (f); - return 1; - } - - /* The filename did not work. Try to remove the [000000] from the name, - and return it. */ - - basename = index (fullname, '['); - local_ptr = index (fullname, ']') + 1; - strcpy (basename, local_ptr); /* this gets rid of it */ - - } - - return 1; -} -#endif /* VMS */ - -#ifdef VMS - -/* The following wrapper functions supply additional arguments to the VMS - I/O routines to optimize performance with file handling. The arguments - are: - "mbc=16" - Set multi-block count to 16 (use a 8192 byte buffer). - "deq=64" - When extending the file, extend it in chunks of 32Kbytes. - "fop=tef"- Truncate unused portions of file when closing file. - "shr=nil"- Disallow file sharing while file is open. */ - -static FILE * -VMS_freopen (fname, type, oldfile) - char *fname; - char *type; - FILE *oldfile; -{ -#undef freopen /* Get back the real freopen routine. */ - if (strcmp (type, "w") == 0) - return freopen (fname, type, oldfile, - "mbc=16", "deq=64", "fop=tef", "shr=nil"); - return freopen (fname, type, oldfile, "mbc=16"); -} - -static FILE * -VMS_fopen (fname, type) - char *fname; - char *type; -{ -#undef fopen /* Get back the real fopen routine. */ - /* The gcc-vms-1.42 distribution's header files prototype fopen with two - fixed arguments, which matches ANSI's specification but not VAXCRTL's - pre-ANSI implementation. This hack circumvents the mismatch problem. */ - FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen; - - if (*type == 'w') - return (*vmslib_fopen) (fname, type, "mbc=32", - "deq=64", "fop=tef", "shr=nil"); - else - return (*vmslib_fopen) (fname, type, "mbc=32"); -} - -static int -VMS_open (fname, flags, prot) - char *fname; - int flags; - int prot; -{ -#undef open /* Get back the real open routine. */ - return open (fname, flags, prot, "mbc=16", "deq=64", "fop=tef"); -} - -/* more VMS hackery */ -#include -#include - -extern unsigned long SYS$PARSE(), SYS$SEARCH(); - -/* Work around another library bug. If a file is located via a searchlist, - and if the device it's on is not the same device as the one specified - in the first element of that searchlist, then both stat() and fstat() - will fail to return info about it. `errno' will be set to EVMSERR, and - `vaxc$errno' will be set to SS$_NORMAL due yet another bug in stat()! - We can get around this by fully parsing the filename and then passing - that absolute name to stat(). - - Without this fix, we can end up failing to find header files, which is - bad enough, but then compounding the problem by reporting the reason for - failure as "normal successful completion." */ - -#undef fstat /* Get back to the library version. */ - -static int -VMS_fstat (fd, statbuf) - int fd; - struct stat *statbuf; -{ - int result = fstat (fd, statbuf); - - if (result < 0) - { - FILE *fp; - char nambuf[NAM$C_MAXRSS+1]; - - if ((fp = fdopen (fd, "r")) != 0 && fgetname (fp, nambuf) != 0) - result = VMS_stat (nambuf, statbuf); - /* No fclose(fp) here; that would close(fd) as well. */ - } - - return result; -} - -static int -VMS_stat (name, statbuf) - const char *name; - struct stat *statbuf; -{ - int result = stat (name, statbuf); - - if (result < 0) - { - struct FAB fab; - struct NAM nam; - char exp_nam[NAM$C_MAXRSS+1], /* expanded name buffer for SYS$PARSE */ - res_nam[NAM$C_MAXRSS+1]; /* resultant name buffer for SYS$SEARCH */ - - fab = cc$rms_fab; - fab.fab$l_fna = (char *) name; - fab.fab$b_fns = (unsigned char) strlen (name); - fab.fab$l_nam = (void *) &nam; - nam = cc$rms_nam; - nam.nam$l_esa = exp_nam, nam.nam$b_ess = sizeof exp_nam - 1; - nam.nam$l_rsa = res_nam, nam.nam$b_rss = sizeof res_nam - 1; - nam.nam$b_nop = NAM$M_PWD | NAM$M_NOCONCEAL; - if (SYS$PARSE (&fab) & 1) - { - if (SYS$SEARCH (&fab) & 1) - { - res_nam[nam.nam$b_rsl] = '\0'; - result = stat (res_nam, statbuf); - } - /* Clean up searchlist context cached by the system. */ - nam.nam$b_nop = NAM$M_SYNCHK; - fab.fab$l_fna = 0, fab.fab$b_fns = 0; - (void) SYS$PARSE (&fab); - } - } - - return result; -} -#endif /* VMS */ diff --git a/contrib/gcc/cexp.y b/contrib/gcc/cexp.y deleted file mode 100644 index 9364ac3a8a03..000000000000 --- a/contrib/gcc/cexp.y +++ /dev/null @@ -1,1222 +0,0 @@ -/* Parse C expressions for CCCP. - Copyright (C) 1987, 92, 94-98, 1999 Free Software Foundation. - -This program 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. - -This program 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. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. - - In other words, you are welcome to use, share and improve this program. - You are forbidden to forbid anyone else to use, share and improve - what you give them. Help stamp out software-hoarding! - - Adapted from expread.y of GDB by Paul Rubin, July 1986. */ - -/* Parse a C expression from text in a string */ - -%{ -#include "config.h" - -#include "system.h" -#include "intl.h" -#include -/* #define YYDEBUG 1 */ - -#ifdef MULTIBYTE_CHARS -#include "mbchar.h" -#include -#endif /* MULTIBYTE_CHARS */ - -typedef unsigned char U_CHAR; - -/* This is used for communicating lists of keywords with cccp.c. */ -struct arglist { - struct arglist *next; - U_CHAR *name; - int length; - int argno; -}; - -HOST_WIDEST_INT parse_c_expression PROTO((char *, int)); - -static int yylex PROTO((void)); -static void yyerror PVPROTO((const char *, ...)) - ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; -static HOST_WIDEST_INT expression_value; -#ifdef TEST_EXP_READER -static int expression_signedp; -#endif - -static jmp_buf parse_return_error; - -/* Nonzero means count most punctuation as part of a name. */ -static int keyword_parsing = 0; - -/* Nonzero means do not evaluate this expression. - This is a count, since unevaluated expressions can nest. */ -static int skip_evaluation; - -/* Nonzero means warn if undefined identifiers are evaluated. */ -static int warn_undef; - -/* some external tables of character types */ -extern unsigned char is_idstart[], is_idchar[], is_space[]; - -/* Flag for -pedantic. */ -extern int pedantic; - -/* Flag for -traditional. */ -extern int traditional; - -/* Flag for -lang-c89. */ -extern int c89; - -#ifndef CHAR_TYPE_SIZE -#define CHAR_TYPE_SIZE BITS_PER_UNIT -#endif - -#ifndef INT_TYPE_SIZE -#define INT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE INT_TYPE_SIZE -#endif - -#ifndef MAX_CHAR_TYPE_SIZE -#define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE -#endif - -#ifndef MAX_INT_TYPE_SIZE -#define MAX_INT_TYPE_SIZE INT_TYPE_SIZE -#endif - -#ifndef MAX_LONG_TYPE_SIZE -#define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE -#endif - -#ifndef MAX_WCHAR_TYPE_SIZE -#define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE -#endif - -#define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \ - ? (~ (~ (HOST_WIDEST_INT) 0 << MAX_CHAR_TYPE_SIZE)) \ - : ~ (HOST_WIDEST_INT) 0) - -#define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \ - ? ~ (~ (HOST_WIDEST_INT) 0 << MAX_WCHAR_TYPE_SIZE) \ - : ~ (HOST_WIDEST_INT) 0) - -/* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow. - Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1. - Suppose SIGNEDP is negative if the result is signed, zero if unsigned. - Then this yields nonzero if overflow occurred during the addition. - Overflow occurs if A and B have the same sign, but A and SUM differ in sign, - and SIGNEDP is negative. - Use `^' to test whether signs differ, and `< 0' to isolate the sign. */ -#define overflow_sum_sign(a, b, sum, signedp) \ - ((~((a) ^ (b)) & ((a) ^ (sum)) & (signedp)) < 0) - -struct constant; - -HOST_WIDEST_INT parse_escape PROTO((char **, HOST_WIDEST_INT)); -int check_assertion PROTO((U_CHAR *, int, int, struct arglist *)); -struct hashnode *lookup PROTO((U_CHAR *, int, int)); -void error PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; -void verror PROTO((const char *, va_list)); -void pedwarn PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; -void warning PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; - -static int parse_number PROTO((int)); -static HOST_WIDEST_INT left_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT)); -static HOST_WIDEST_INT right_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT)); -static void integer_overflow PROTO((void)); - -/* `signedp' values */ -#define SIGNED (~0) -#define UNSIGNED 0 -%} - -%union { - struct constant {HOST_WIDEST_INT value; int signedp;} integer; - struct name {U_CHAR *address; int length;} name; - struct arglist *keywords; -} - -%type exp exp1 start -%type keywords -%token INT CHAR -%token NAME -%token ERROR - -%right '?' ':' -%left ',' -%left OR -%left AND -%left '|' -%left '^' -%left '&' -%left EQUAL NOTEQUAL -%left '<' '>' LEQ GEQ -%left LSH RSH -%left '+' '-' -%left '*' '/' '%' -%right UNARY - -/* %expect 40 */ - -%% - -start : exp1 - { - expression_value = $1.value; -#ifdef TEST_EXP_READER - expression_signedp = $1.signedp; -#endif - } - ; - -/* Expressions, including the comma operator. */ -exp1 : exp - | exp1 ',' exp - { if (pedantic) - pedwarn ("comma operator in operand of `#if'"); - $$ = $3; } - ; - -/* Expressions, not including the comma operator. */ -exp : '-' exp %prec UNARY - { $$.value = - $2.value; - $$.signedp = $2.signedp; - if (($$.value & $2.value & $$.signedp) < 0) - integer_overflow (); } - | '!' exp %prec UNARY - { $$.value = ! $2.value; - $$.signedp = SIGNED; } - | '+' exp %prec UNARY - { $$ = $2; } - | '~' exp %prec UNARY - { $$.value = ~ $2.value; - $$.signedp = $2.signedp; } - | '#' NAME - { $$.value = check_assertion ($2.address, $2.length, - 0, NULL_PTR); - $$.signedp = SIGNED; } - | '#' NAME - { keyword_parsing = 1; } - '(' keywords ')' - { $$.value = check_assertion ($2.address, $2.length, - 1, $5); - keyword_parsing = 0; - $$.signedp = SIGNED; } - | '(' exp1 ')' - { $$ = $2; } - ; - -/* Binary operators in order of decreasing precedence. */ -exp : exp '*' exp - { $$.signedp = $1.signedp & $3.signedp; - if ($$.signedp) - { - $$.value = $1.value * $3.value; - if ($1.value - && ($$.value / $1.value != $3.value - || ($$.value & $1.value & $3.value) < 0)) - integer_overflow (); - } - else - $$.value = ((unsigned HOST_WIDEST_INT) $1.value - * $3.value); } - | exp '/' exp - { if ($3.value == 0) - { - if (!skip_evaluation) - error ("division by zero in #if"); - $3.value = 1; - } - $$.signedp = $1.signedp & $3.signedp; - if ($$.signedp) - { - $$.value = $1.value / $3.value; - if (($$.value & $1.value & $3.value) < 0) - integer_overflow (); - } - else - $$.value = ((unsigned HOST_WIDEST_INT) $1.value - / $3.value); } - | exp '%' exp - { if ($3.value == 0) - { - if (!skip_evaluation) - error ("division by zero in #if"); - $3.value = 1; - } - $$.signedp = $1.signedp & $3.signedp; - if ($$.signedp) - $$.value = $1.value % $3.value; - else - $$.value = ((unsigned HOST_WIDEST_INT) $1.value - % $3.value); } - | exp '+' exp - { $$.value = $1.value + $3.value; - $$.signedp = $1.signedp & $3.signedp; - if (overflow_sum_sign ($1.value, $3.value, - $$.value, $$.signedp)) - integer_overflow (); } - | exp '-' exp - { $$.value = $1.value - $3.value; - $$.signedp = $1.signedp & $3.signedp; - if (overflow_sum_sign ($$.value, $3.value, - $1.value, $$.signedp)) - integer_overflow (); } - | exp LSH exp - { $$.signedp = $1.signedp; - if (($3.value & $3.signedp) < 0) - $$.value = right_shift (&$1, -$3.value); - else - $$.value = left_shift (&$1, $3.value); } - | exp RSH exp - { $$.signedp = $1.signedp; - if (($3.value & $3.signedp) < 0) - $$.value = left_shift (&$1, -$3.value); - else - $$.value = right_shift (&$1, $3.value); } - | exp EQUAL exp - { $$.value = ($1.value == $3.value); - $$.signedp = SIGNED; } - | exp NOTEQUAL exp - { $$.value = ($1.value != $3.value); - $$.signedp = SIGNED; } - | exp LEQ exp - { $$.signedp = SIGNED; - if ($1.signedp & $3.signedp) - $$.value = $1.value <= $3.value; - else - $$.value = ((unsigned HOST_WIDEST_INT) $1.value - <= $3.value); } - | exp GEQ exp - { $$.signedp = SIGNED; - if ($1.signedp & $3.signedp) - $$.value = $1.value >= $3.value; - else - $$.value = ((unsigned HOST_WIDEST_INT) $1.value - >= $3.value); } - | exp '<' exp - { $$.signedp = SIGNED; - if ($1.signedp & $3.signedp) - $$.value = $1.value < $3.value; - else - $$.value = ((unsigned HOST_WIDEST_INT) $1.value - < $3.value); } - | exp '>' exp - { $$.signedp = SIGNED; - if ($1.signedp & $3.signedp) - $$.value = $1.value > $3.value; - else - $$.value = ((unsigned HOST_WIDEST_INT) $1.value - > $3.value); } - | exp '&' exp - { $$.value = $1.value & $3.value; - $$.signedp = $1.signedp & $3.signedp; } - | exp '^' exp - { $$.value = $1.value ^ $3.value; - $$.signedp = $1.signedp & $3.signedp; } - | exp '|' exp - { $$.value = $1.value | $3.value; - $$.signedp = $1.signedp & $3.signedp; } - | exp AND - { skip_evaluation += !$1.value; } - exp - { skip_evaluation -= !$1.value; - $$.value = ($1.value && $4.value); - $$.signedp = SIGNED; } - | exp OR - { skip_evaluation += !!$1.value; } - exp - { skip_evaluation -= !!$1.value; - $$.value = ($1.value || $4.value); - $$.signedp = SIGNED; } - | exp '?' - { skip_evaluation += !$1.value; } - exp ':' - { skip_evaluation += !!$1.value - !$1.value; } - exp - { skip_evaluation -= !!$1.value; - $$.value = $1.value ? $4.value : $7.value; - $$.signedp = $4.signedp & $7.signedp; } - | INT - { $$ = yylval.integer; } - | CHAR - { $$ = yylval.integer; } - | NAME - { if (warn_undef && !skip_evaluation) - warning ("`%.*s' is not defined", - $1.length, $1.address); - $$.value = 0; - $$.signedp = SIGNED; } - ; - -keywords : - { $$ = 0; } - | '(' keywords ')' keywords - { struct arglist *temp; - $$ = (struct arglist *) xmalloc (sizeof (struct arglist)); - $$->next = $2; - $$->name = (U_CHAR *) "("; - $$->length = 1; - temp = $$; - while (temp != 0 && temp->next != 0) - temp = temp->next; - temp->next = (struct arglist *) xmalloc (sizeof (struct arglist)); - temp->next->next = $4; - temp->next->name = (U_CHAR *) ")"; - temp->next->length = 1; } - | NAME keywords - { $$ = (struct arglist *) xmalloc (sizeof (struct arglist)); - $$->name = $1.address; - $$->length = $1.length; - $$->next = $2; } - ; -%% - -/* During parsing of a C expression, the pointer to the next character - is in this variable. */ - -static char *lexptr; - -/* Take care of parsing a number (anything that starts with a digit). - Set yylval and return the token type; update lexptr. - LEN is the number of characters in it. */ - -/* maybe needs to actually deal with floating point numbers */ - -static int -parse_number (olen) - int olen; -{ - register char *p = lexptr; - register int c; - register unsigned HOST_WIDEST_INT n = 0, nd, max_over_base; - register int base = 10; - register int len = olen; - register int overflow = 0; - register int digit, largest_digit = 0; - int spec_long = 0; - - yylval.integer.signedp = SIGNED; - - if (*p == '0') { - base = 8; - if (len >= 3 && (p[1] == 'x' || p[1] == 'X')) { - p += 2; - base = 16; - len -= 2; - } - } - - max_over_base = (unsigned HOST_WIDEST_INT) -1 / base; - - for (; len > 0; len--) { - c = *p++; - - if (c >= '0' && c <= '9') - digit = c - '0'; - else if (base == 16 && c >= 'a' && c <= 'f') - digit = c - 'a' + 10; - else if (base == 16 && c >= 'A' && c <= 'F') - digit = c - 'A' + 10; - else { - /* `l' means long, and `u' means unsigned. */ - while (1) { - if (c == 'l' || c == 'L') - { - if (!pedantic < spec_long) - yyerror ("too many `l's in integer constant"); - spec_long++; - } - else if (c == 'u' || c == 'U') - { - if (! yylval.integer.signedp) - yyerror ("two `u's in integer constant"); - yylval.integer.signedp = UNSIGNED; - } - else { - if (c == '.' || c == 'e' || c == 'E' || c == 'p' || c == 'P') - yyerror ("Floating point numbers not allowed in #if expressions"); - else - yyerror ("missing white space after number `%.*s'", - (int) (p - lexptr - 1), lexptr); - } - - if (--len == 0) - break; - c = *p++; - } - /* Don't look for any more digits after the suffixes. */ - break; - } - if (largest_digit < digit) - largest_digit = digit; - nd = n * base + digit; - overflow |= (max_over_base < n) | (nd < n); - n = nd; - } - - if (base <= largest_digit) - pedwarn ("integer constant contains digits beyond the radix"); - - if (overflow) - pedwarn ("integer constant out of range"); - - /* If too big to be signed, consider it unsigned. */ - if (((HOST_WIDEST_INT) n & yylval.integer.signedp) < 0) - { - if (base == 10) - warning ("integer constant is so large that it is unsigned"); - yylval.integer.signedp = UNSIGNED; - } - - lexptr = p; - yylval.integer.value = n; - return INT; -} - -struct token { - const char *operator; - int token; -}; - -static struct token tokentab2[] = { - {"&&", AND}, - {"||", OR}, - {"<<", LSH}, - {">>", RSH}, - {"==", EQUAL}, - {"!=", NOTEQUAL}, - {"<=", LEQ}, - {">=", GEQ}, - {"++", ERROR}, - {"--", ERROR}, - {NULL, ERROR} -}; - -/* Read one token, getting characters through lexptr. */ - -static int -yylex () -{ - register int c; - register int namelen; - register unsigned char *tokstart; - register struct token *toktab; - int wide_flag; - HOST_WIDEST_INT mask; - - retry: - - tokstart = (unsigned char *) lexptr; - c = *tokstart; - /* See if it is a special token of length 2. */ - if (! keyword_parsing) - for (toktab = tokentab2; toktab->operator != NULL; toktab++) - if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) { - lexptr += 2; - if (toktab->token == ERROR) - yyerror ("`%s' not allowed in operand of `#if'", toktab->operator); - return toktab->token; - } - - switch (c) { - case '\n': - return 0; - - case ' ': - case '\t': - case '\r': - lexptr++; - goto retry; - - case 'L': - /* Capital L may start a wide-string or wide-character constant. */ - if (lexptr[1] == '\'') - { - lexptr++; - wide_flag = 1; - mask = MAX_WCHAR_TYPE_MASK; - goto char_constant; - } - if (lexptr[1] == '"') - { - lexptr++; - wide_flag = 1; - mask = MAX_WCHAR_TYPE_MASK; - goto string_constant; - } - break; - - case '\'': - wide_flag = 0; - mask = MAX_CHAR_TYPE_MASK; - char_constant: - lexptr++; - if (keyword_parsing) { - char *start_ptr = lexptr - 1; - while (1) { - c = *lexptr++; - if (c == '\\') - c = parse_escape (&lexptr, mask); - else if (c == '\'') - break; - } - yylval.name.address = tokstart; - yylval.name.length = lexptr - start_ptr; - return NAME; - } - - /* This code for reading a character constant - handles multicharacter constants and wide characters. - It is mostly copied from c-lex.c. */ - { - register HOST_WIDEST_INT result = 0; - register int num_chars = 0; - int chars_seen = 0; - unsigned width = MAX_CHAR_TYPE_SIZE; - int max_chars; -#ifdef MULTIBYTE_CHARS - int longest_char = local_mb_cur_max (); - char *token_buffer = (char *) alloca (longest_char); - (void) local_mbtowc (NULL_PTR, NULL_PTR, 0); -#endif - - max_chars = MAX_LONG_TYPE_SIZE / width; - if (wide_flag) - width = MAX_WCHAR_TYPE_SIZE; - - while (1) - { - c = *lexptr++; - - if (c == '\'' || c == EOF) - break; - - ++chars_seen; - if (c == '\\') - { - c = parse_escape (&lexptr, mask); - } - else - { -#ifdef MULTIBYTE_CHARS - wchar_t wc; - int i; - int char_len = -1; - for (i = 1; i <= longest_char; ++i) - { - token_buffer[i - 1] = c; - char_len = local_mbtowc (& wc, token_buffer, i); - if (char_len != -1) - break; - c = *lexptr++; - } - if (char_len > 1) - { - /* mbtowc sometimes needs an extra char before accepting */ - if (char_len < i) - lexptr--; - if (! wide_flag) - { - /* Merge character into result; ignore excess chars. */ - for (i = 1; i <= char_len; ++i) - { - if (i > max_chars) - break; - if (width < HOST_BITS_PER_INT) - result = (result << width) - | (token_buffer[i - 1] - & ((1 << width) - 1)); - else - result = token_buffer[i - 1]; - } - num_chars += char_len; - continue; - } - } - else - { - if (char_len == -1) - warning ("Ignoring invalid multibyte character"); - } - if (wide_flag) - c = wc; -#endif /* ! MULTIBYTE_CHARS */ - } - - if (wide_flag) - { - if (chars_seen == 1) /* only keep the first one */ - result = c; - continue; - } - - /* Merge character into result; ignore excess chars. */ - num_chars++; - if (num_chars <= max_chars) - { - if (width < HOST_BITS_PER_INT) - result = (result << width) | (c & ((1 << width) - 1)); - else - result = c; - } - } - - if (c != '\'') - error ("malformatted character constant"); - else if (chars_seen == 0) - error ("empty character constant"); - else if (num_chars > max_chars) - { - num_chars = max_chars; - error ("character constant too long"); - } - else if (chars_seen != 1 && ! traditional) - warning ("multi-character character constant"); - - /* If char type is signed, sign-extend the constant. */ - if (! wide_flag) - { - int num_bits = num_chars * width; - if (num_bits == 0) - /* We already got an error; avoid invalid shift. */ - yylval.integer.value = 0; - else if (lookup ((U_CHAR *) "__CHAR_UNSIGNED__", - sizeof ("__CHAR_UNSIGNED__") - 1, -1) - || ((result >> (num_bits - 1)) & 1) == 0) - yylval.integer.value - = result & (~ (unsigned HOST_WIDEST_INT) 0 - >> (HOST_BITS_PER_WIDEST_INT - num_bits)); - else - yylval.integer.value - = result | ~(~ (unsigned HOST_WIDEST_INT) 0 - >> (HOST_BITS_PER_WIDEST_INT - num_bits)); - } - else - { - yylval.integer.value = result; - } - } - - /* This is always a signed type. */ - yylval.integer.signedp = SIGNED; - - return CHAR; - - /* some of these chars are invalid in constant expressions; - maybe do something about them later */ - case '/': - case '+': - case '-': - case '*': - case '%': - case '|': - case '&': - case '^': - case '~': - case '!': - case '@': - case '<': - case '>': - case '[': - case ']': - case '.': - case '?': - case ':': - case '=': - case '{': - case '}': - case ',': - case '#': - if (keyword_parsing) - break; - case '(': - case ')': - lexptr++; - return c; - - case '"': - mask = MAX_CHAR_TYPE_MASK; - string_constant: - if (keyword_parsing) { - char *start_ptr = lexptr; - lexptr++; - while (1) { - c = *lexptr++; - if (c == '\\') - c = parse_escape (&lexptr, mask); - else if (c == '"') - break; - } - yylval.name.address = tokstart; - yylval.name.length = lexptr - start_ptr; - return NAME; - } - yyerror ("string constants not allowed in #if expressions"); - return ERROR; - } - - if (c >= '0' && c <= '9' && !keyword_parsing) { - /* It's a number */ - for (namelen = 1; ; namelen++) { - int d = tokstart[namelen]; - if (! ((is_idchar[d] || d == '.') - || ((d == '-' || d == '+') - && (c == 'e' || c == 'E' - || ((c == 'p' || c == 'P') && ! c89)) - && ! traditional))) - break; - c = d; - } - return parse_number (namelen); - } - - /* It is a name. See how long it is. */ - - if (keyword_parsing) { - for (namelen = 0;; namelen++) { - if (is_space[tokstart[namelen]]) - break; - if (tokstart[namelen] == '(' || tokstart[namelen] == ')') - break; - if (tokstart[namelen] == '"' || tokstart[namelen] == '\'') - break; - } - } else { - if (!is_idstart[c]) { - yyerror ("Invalid token in expression"); - return ERROR; - } - - for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++) - ; - } - - lexptr += namelen; - yylval.name.address = tokstart; - yylval.name.length = namelen; - return NAME; -} - - -/* Parse a C escape sequence. STRING_PTR points to a variable - containing a pointer to the string to parse. That pointer - is updated past the characters we use. The value of the - escape sequence is returned. - - RESULT_MASK is used to mask out the result; - an error is reported if bits are lost thereby. - - A negative value means the sequence \ newline was seen, - which is supposed to be equivalent to nothing at all. - - If \ is followed by a null character, we return a negative - value and leave the string pointer pointing at the null character. - - If \ is followed by 000, we return 0 and leave the string pointer - after the zeros. A value of 0 does not mean end of string. */ - -HOST_WIDEST_INT -parse_escape (string_ptr, result_mask) - char **string_ptr; - HOST_WIDEST_INT result_mask; -{ - register int c = *(*string_ptr)++; - switch (c) - { - case 'a': - return TARGET_BELL; - case 'b': - return TARGET_BS; - case 'e': - case 'E': - if (pedantic) - pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c); - return 033; - case 'f': - return TARGET_FF; - case 'n': - return TARGET_NEWLINE; - case 'r': - return TARGET_CR; - case 't': - return TARGET_TAB; - case 'v': - return TARGET_VT; - case '\n': - return -2; - case 0: - (*string_ptr)--; - return 0; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - { - register HOST_WIDEST_INT i = c - '0'; - register int count = 0; - while (++count < 3) - { - c = *(*string_ptr)++; - if (c >= '0' && c <= '7') - i = (i << 3) + c - '0'; - else - { - (*string_ptr)--; - break; - } - } - if (i != (i & result_mask)) - { - i &= result_mask; - pedwarn ("octal escape sequence out of range"); - } - return i; - } - case 'x': - { - register unsigned HOST_WIDEST_INT i = 0, overflow = 0; - register int digits_found = 0, digit; - for (;;) - { - c = *(*string_ptr)++; - if (c >= '0' && c <= '9') - digit = c - '0'; - else if (c >= 'a' && c <= 'f') - digit = c - 'a' + 10; - else if (c >= 'A' && c <= 'F') - digit = c - 'A' + 10; - else - { - (*string_ptr)--; - break; - } - overflow |= i ^ (i << 4 >> 4); - i = (i << 4) + digit; - digits_found = 1; - } - if (!digits_found) - yyerror ("\\x used with no following hex digits"); - if (overflow | (i != (i & result_mask))) - { - i &= result_mask; - pedwarn ("hex escape sequence out of range"); - } - return i; - } - default: - return c; - } -} - -static void -integer_overflow () -{ - if (!skip_evaluation && pedantic) - pedwarn ("integer overflow in preprocessor expression"); -} - -static HOST_WIDEST_INT -left_shift (a, b) - struct constant *a; - unsigned HOST_WIDEST_INT b; -{ - /* It's unclear from the C standard whether shifts can overflow. - The following code ignores overflow; perhaps a C standard - interpretation ruling is needed. */ - if (b >= HOST_BITS_PER_WIDEST_INT) - return 0; - else - return (unsigned HOST_WIDEST_INT) a->value << b; -} - -static HOST_WIDEST_INT -right_shift (a, b) - struct constant *a; - unsigned HOST_WIDEST_INT b; -{ - if (b >= HOST_BITS_PER_WIDEST_INT) - return a->signedp ? a->value >> (HOST_BITS_PER_WIDEST_INT - 1) : 0; - else if (a->signedp) - return a->value >> b; - else - return (unsigned HOST_WIDEST_INT) a->value >> b; -} - -/* This page contains the entry point to this file. */ - -/* Parse STRING as an expression, and complain if this fails - to use up all of the contents of STRING. - STRING may contain '\0' bytes; it is terminated by the first '\n' - outside a string constant, so that we can diagnose '\0' properly. - If WARN_UNDEFINED is nonzero, warn if undefined identifiers are evaluated. - We do not support C comments. They should be removed before - this function is called. */ - -HOST_WIDEST_INT -parse_c_expression (string, warn_undefined) - char *string; - int warn_undefined; -{ - lexptr = string; - warn_undef = warn_undefined; - - /* if there is some sort of scanning error, just return 0 and assume - the parsing routine has printed an error message somewhere. - there is surely a better thing to do than this. */ - if (setjmp (parse_return_error)) - return 0; - - if (yyparse () != 0) - abort (); - - if (*lexptr != '\n') - error ("Junk after end of expression."); - - return expression_value; /* set by yyparse () */ -} - -static void -yyerror VPROTO ((const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (args, const char *); -#endif - - verror (msgid, args); - va_end (args); - skip_evaluation = 0; - longjmp (parse_return_error, 1); -} - - -#ifdef TEST_EXP_READER - -#if YYDEBUG -extern int yydebug; -#endif - -int pedantic; -int traditional; -int c89; - -int main PROTO((int, char **)); -static void initialize_random_junk PROTO((void)); -static void print_unsigned_host_widest_int PROTO((unsigned HOST_WIDEST_INT)); - -/* Main program for testing purposes. */ -int -main (argc, argv) - int argc; - char **argv; -{ - int n, c; - char buf[1024]; - unsigned HOST_WIDEST_INT u; - - pedantic = 1 < argc; - traditional = 2 < argc; - c89 = 3 < argc; -#if YYDEBUG - yydebug = 4 < argc; -#endif - initialize_random_junk (); - - for (;;) { - printf ("enter expression: "); - n = 0; - while ((buf[n] = c = getchar ()) != '\n' && c != EOF) - n++; - if (c == EOF) - break; - parse_c_expression (buf, 1); - printf ("parser returned "); - u = (unsigned HOST_WIDEST_INT) expression_value; - if (expression_value < 0 && expression_signedp) { - u = -u; - printf ("-"); - } - if (u == 0) - printf ("0"); - else - print_unsigned_host_widest_int (u); - if (! expression_signedp) - printf("u"); - printf ("\n"); - } - - return 0; -} - -static void -print_unsigned_host_widest_int (u) - unsigned HOST_WIDEST_INT u; -{ - if (u) { - print_unsigned_host_widest_int (u / 10); - putchar ('0' + (int) (u % 10)); - } -} - -/* table to tell if char can be part of a C identifier. */ -unsigned char is_idchar[256]; -/* table to tell if char can be first char of a c identifier. */ -unsigned char is_idstart[256]; -/* table to tell if c is horizontal or vertical space. */ -unsigned char is_space[256]; - -/* - * initialize random junk in the hash table and maybe other places - */ -static void -initialize_random_junk () -{ - register int i; - - /* - * Set up is_idchar and is_idstart tables. These should be - * faster than saying (is_alpha (c) || c == '_'), etc. - * Must do set up these things before calling any routines tthat - * refer to them. - */ - for (i = 'a'; i <= 'z'; i++) { - ++is_idchar[i - 'a' + 'A']; - ++is_idchar[i]; - ++is_idstart[i - 'a' + 'A']; - ++is_idstart[i]; - } - for (i = '0'; i <= '9'; i++) - ++is_idchar[i]; - ++is_idchar['_']; - ++is_idstart['_']; - ++is_idchar['$']; - ++is_idstart['$']; - - ++is_space[' ']; - ++is_space['\t']; - ++is_space['\v']; - ++is_space['\f']; - ++is_space['\n']; - ++is_space['\r']; -} - -void -error VPROTO ((char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (args, char *); -#endif - - fprintf (stderr, "error: "); - vfprintf (stderr, _(msgid), args); - fprintf (stderr, "\n"); - va_end (args); -} - -void -pedwarn VPROTO ((char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (args, char *); -#endif - - fprintf (stderr, "pedwarn: "); - vfprintf (stderr, _(msgid), args); - fprintf (stderr, "\n"); - va_end (args); -} - -void -warning VPROTO ((char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - char * msgid; -#endif - va_list args; - - VA_START (args, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (args, char *); -#endif - - fprintf (stderr, "warning: "); - vfprintf (stderr, _(msgid), args); - fprintf (stderr, "\n"); - va_end (args); -} - - -int -check_assertion (name, sym_length, tokens_specified, tokens) - U_CHAR *name; - int sym_length; - int tokens_specified; - struct arglist *tokens; -{ - return 0; -} - -struct hashnode * -lookup (name, len, hash) - U_CHAR *name; - int len; - int hash; -{ - return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1); -} - -PTR -xmalloc (size) - size_t size; -{ - return (PTR) malloc (size); -} -#endif diff --git a/contrib/gcc/choose-temp.c b/contrib/gcc/choose-temp.c deleted file mode 100644 index b1007bb546bd..000000000000 --- a/contrib/gcc/choose-temp.c +++ /dev/null @@ -1,203 +0,0 @@ -/* Utility to pick a temporary filename prefix. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file exports two functions: choose_temp_base and make_temp_file. */ - -/* This file lives in at least two places: libiberty and gcc. - Don't change one without the other. */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include /* May get P_tmpdir. */ -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_SYS_FILE_H -#include /* May get R_OK, etc. on some systems. */ -#endif - -#ifndef R_OK -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 -#endif - -#include "libiberty.h" -extern int mkstemps (); - -#ifndef IN_GCC -#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN)) -#define DIR_SEPARATOR '\\' -#endif -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -/* On MSDOS, write temp files in current dir - because there's no place else we can expect to use. */ -/* ??? Although the current directory is tried as a last resort, - this is left in so that on MSDOS it is preferred to /tmp on the - off chance that someone requires this, since that was the previous - behaviour. */ -#ifdef __MSDOS__ -#ifndef P_tmpdir -#define P_tmpdir "." -#endif -#endif - -/* Name of temporary file. - mktemp requires 6 trailing X's. */ -#define TEMP_FILE "ccXXXXXX" - -/* Subroutine of choose_temp_base. - If BASE is non-NULL, return it. - Otherwise it checks if DIR is a usable directory. - If success, DIR is returned. - Otherwise NULL is returned. */ - -static char * -try (dir, base) - char *dir, *base; -{ - if (base != 0) - return base; - if (dir != 0 - && access (dir, R_OK | W_OK | X_OK) == 0) - return dir; - return 0; -} - -/* Return a prefix for temporary file names or NULL if unable to find one. - The current directory is chosen if all else fails so the program is - exited if a temporary directory can't be found (mktemp fails). - The buffer for the result is obtained with xmalloc. - - This function is provided for backwards compatability only. It use - is not recommended. */ - -char * -choose_temp_base () -{ - char *base = 0; - char *temp_filename; - int len; - static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 }; - static char usrtmp[] = { DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 }; - - base = try (getenv ("TMPDIR"), base); - base = try (getenv ("TMP"), base); - base = try (getenv ("TEMP"), base); - -#ifdef P_tmpdir - base = try (P_tmpdir, base); -#endif - - /* Try /usr/tmp, then /tmp. */ - base = try (usrtmp, base); - base = try (tmp, base); - - /* If all else fails, use the current directory! */ - if (base == 0) - base = "."; - - len = strlen (base); - temp_filename = xmalloc (len + 1 /*DIR_SEPARATOR*/ - + strlen (TEMP_FILE) + 1); - strcpy (temp_filename, base); - - if (len != 0 - && temp_filename[len-1] != '/' - && temp_filename[len-1] != DIR_SEPARATOR) - temp_filename[len++] = DIR_SEPARATOR; - strcpy (temp_filename + len, TEMP_FILE); - - mktemp (temp_filename); - if (strlen (temp_filename) == 0) - abort (); - return temp_filename; -} -/* Return a temporary file name (as a string) or NULL if unable to create - one. */ - -char * -make_temp_file (suffix) - char *suffix; -{ - char *base = 0; - char *temp_filename; - int base_len, suffix_len; - int fd; - static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 }; - static char usrtmp[] = { DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 }; - - base = try (getenv ("TMPDIR"), base); - base = try (getenv ("TMP"), base); - base = try (getenv ("TEMP"), base); - -#ifdef P_tmpdir - base = try (P_tmpdir, base); -#endif - - /* Try /usr/tmp, then /tmp. */ - base = try (usrtmp, base); - base = try (tmp, base); - - /* If all else fails, use the current directory! */ - if (base == 0) - base = "."; - - base_len = strlen (base); - - if (suffix) - suffix_len = strlen (suffix); - else - suffix_len = 0; - - temp_filename = xmalloc (base_len + 1 /*DIR_SEPARATOR*/ - + strlen (TEMP_FILE) - + suffix_len + 1); - strcpy (temp_filename, base); - - if (base_len != 0 - && temp_filename[base_len-1] != '/' - && temp_filename[base_len-1] != DIR_SEPARATOR) - temp_filename[base_len++] = DIR_SEPARATOR; - strcpy (temp_filename + base_len, TEMP_FILE); - - if (suffix) - strcat (temp_filename, suffix); - - fd = mkstemps (temp_filename, suffix_len); - /* If mkstemps failed, then something bad is happening. Maybe we should - issue a message about a possible security attack in progress? */ - if (fd == -1) - abort (); - /* Similarly if we can not close the file. */ - if (close (fd)) - abort (); - return temp_filename; -} diff --git a/contrib/gcc/collect2.c b/contrib/gcc/collect2.c deleted file mode 100644 index e5d6452e19cb..000000000000 --- a/contrib/gcc/collect2.c +++ /dev/null @@ -1,3804 +0,0 @@ -/* Collect static initialization info into data structures that can be - traversed by C++ initialization and finalization routines. - Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc. - Contributed by Chris Smith (csmith@convex.com). - Heavily modified by Michael Meissner (meissner@cygnus.com), - Per Bothner (bothner@cygnus.com), and John Gilmore (gnu@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Build tables of static constructors and destructors and run ld. */ - -#include "config.h" -#include "system.h" -#include - -#ifdef vfork /* Autoconf may define this to fork for us. */ -# define VFORK_STRING "fork" -#else -# define VFORK_STRING "vfork" -#endif -#ifdef HAVE_VFORK_H -#include -#endif -#ifdef VMS -#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \ - lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1) -#endif /* VMS */ - -#define COLLECT - -#include "collect2.h" -#include "demangle.h" -#include "obstack.h" -#include "intl.h" - -/* Obstack allocation and deallocation routines. */ -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -extern char *make_temp_file PROTO ((char *)); - -/* On certain systems, we have code that works by scanning the object file - directly. But this code uses system-specific header files and library - functions, so turn it off in a cross-compiler. Likewise, the names of - the utilities are not correct for a cross-compiler; we have to hope that - cross-versions are in the proper directories. */ - -#ifdef CROSS_COMPILE -#undef SUNOS4_SHARED_LIBRARIES -#undef OBJECT_FORMAT_COFF -#undef OBJECT_FORMAT_ROSE -#undef MD_EXEC_PREFIX -#undef REAL_LD_FILE_NAME -#undef REAL_NM_FILE_NAME -#undef REAL_STRIP_FILE_NAME -#endif - -/* If we cannot use a special method, use the ordinary one: - run nm to find what symbols are present. - In a cross-compiler, this means you need a cross nm, - but that is not quite as unpleasant as special headers. */ - -#if !defined (OBJECT_FORMAT_COFF) && !defined (OBJECT_FORMAT_ROSE) -#define OBJECT_FORMAT_NONE -#endif - -#ifdef OBJECT_FORMAT_COFF - -#include -#include - -#ifdef UMAX -#include -#endif - -/* Many versions of ldfcn.h define these. */ -#ifdef FREAD -#undef FREAD -#undef FWRITE -#endif - -#include - -/* Some systems have an ISCOFF macro, but others do not. In some cases - the macro may be wrong. MY_ISCOFF is defined in tm.h files for machines - that either do not have an ISCOFF macro in /usr/include or for those - where it is wrong. */ - -#ifndef MY_ISCOFF -#define MY_ISCOFF(X) ISCOFF (X) -#endif - -#endif /* OBJECT_FORMAT_COFF */ - -#ifdef OBJECT_FORMAT_ROSE - -#ifdef _OSF_SOURCE -#define USE_MMAP -#endif - -#ifdef USE_MMAP -#include -#endif - -#include -#include -#include -#include -#include - -#endif /* OBJECT_FORMAT_ROSE */ - -#ifdef OBJECT_FORMAT_NONE - -/* Default flags to pass to nm. */ -#ifndef NM_FLAGS -#define NM_FLAGS "-n" -#endif - -#endif /* OBJECT_FORMAT_NONE */ - -/* Some systems use __main in a way incompatible with its use in gcc, in these - cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to - give the same symbol without quotes for an alternative entry point. You - must define both, or neither. */ -#ifndef NAME__MAIN -#define NAME__MAIN "__main" -#define SYMBOL__MAIN __main -#endif - -/* This must match tree.h. */ -#define DEFAULT_INIT_PRIORITY 65535 - -#if defined (LDD_SUFFIX) || SUNOS4_SHARED_LIBRARIES -#define SCAN_LIBRARIES -#endif - -#ifdef USE_COLLECT2 -int do_collecting = 1; -#else -int do_collecting = 0; -#endif - -/* Linked lists of constructor and destructor names. */ - -struct id -{ - struct id *next; - int sequence; - char name[1]; -}; - -struct head -{ - struct id *first; - struct id *last; - int number; -}; - -/* Enumeration giving which pass this is for scanning the program file. */ - -enum pass { - PASS_FIRST, /* without constructors */ - PASS_OBJ, /* individual objects */ - PASS_LIB, /* looking for shared libraries */ - PASS_SECOND /* with constructors linked in */ -}; - -extern char *version_string; - -int vflag; /* true if -v */ -static int rflag; /* true if -r */ -static int strip_flag; /* true if -s */ -#ifdef COLLECT_EXPORT_LIST -static int export_flag; /* true if -bE */ -static int aix64_flag; /* true if -b64 */ -#endif - -int debug; /* true if -debug */ - -static int shared_obj; /* true if -shared */ - -static char *c_file; /* .c for constructor/destructor list. */ -static char *o_file; /* .o for constructor/destructor list. */ -#ifdef COLLECT_EXPORT_LIST -static char *export_file; /* .x for AIX export list. */ -static char *import_file; /* .p for AIX import list. */ -#endif -char *ldout; /* File for ld errors. */ -static char *output_file; /* Output file for ld. */ -static char *nm_file_name; /* pathname of nm */ -#ifdef LDD_SUFFIX -static char *ldd_file_name; /* pathname of ldd (or equivalent) */ -#endif -static char *strip_file_name; /* pathname of strip */ -char *c_file_name; /* pathname of gcc */ -static char *initname, *fininame; /* names of init and fini funcs */ - -static struct head constructors; /* list of constructors found */ -static struct head destructors; /* list of destructors found */ -#ifdef COLLECT_EXPORT_LIST -static struct head exports; /* list of exported symbols */ -static struct head imports; /* list of imported symbols */ -static struct head undefined; /* list of undefined symbols */ -#endif -static struct head frame_tables; /* list of frame unwind info tables */ - -struct obstack temporary_obstack; -struct obstack permanent_obstack; -char * temporary_firstobj; - -/* Holds the return value of pexecute. */ -int pexecute_pid; - -/* Defined in the automatically-generated underscore.c. */ -extern int prepends_underscore; - -extern FILE *fdopen (); - -#ifndef GET_ENV_PATH_LIST -#define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0) -#endif - -/* Structure to hold all the directories in which to search for files to - execute. */ - -struct prefix_list -{ - char *prefix; /* String to prepend to the path. */ - struct prefix_list *next; /* Next in linked list. */ -}; - -struct path_prefix -{ - struct prefix_list *plist; /* List of prefixes to try */ - int max_len; /* Max length of a prefix in PLIST */ - char *name; /* Name of this list (used in config stuff) */ -}; - -#ifdef COLLECT_EXPORT_LIST -/* Lists to keep libraries to be scanned for global constructors/destructors. */ -static struct head libs; /* list of libraries */ -static struct path_prefix cmdline_lib_dirs; /* directories specified with -L */ -static struct path_prefix libpath_lib_dirs; /* directories in LIBPATH */ -static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs, - &libpath_lib_dirs, NULL}; -static char *libexts[3] = {"a", "so", NULL}; /* possible library extentions */ -#endif - -void error PVPROTO((const char *, ...)) ATTRIBUTE_PRINTF_1; -void fatal PVPROTO((const char *, ...)) - ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; -void fatal_perror PVPROTO((const char *, ...)) - ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; -static char *my_strerror PROTO((int)); -static const char *my_strsignal PROTO((int)); -static void handler PROTO((int)); -static int is_ctor_dtor PROTO((char *)); -static char *find_a_file PROTO((struct path_prefix *, char *)); -static void add_prefix PROTO((struct path_prefix *, char *)); -static void prefix_from_env PROTO((char *, struct path_prefix *)); -static void prefix_from_string PROTO((char *, struct path_prefix *)); -static void do_wait PROTO((char *)); -static void fork_execute PROTO((char *, char **)); -static void maybe_unlink PROTO((char *)); -static void add_to_list PROTO((struct head *, char *)); -static int extract_init_priority PROTO((char *)); -static void sort_ids PROTO((struct head *)); -static void write_list PROTO((FILE *, char *, struct id *)); -#ifdef COLLECT_EXPORT_LIST -static void dump_list PROTO((FILE *, char *, struct id *)); -#endif -#if 0 -static void dump_prefix_list PROTO((FILE *, char *, struct prefix_list *)); -#endif -static void write_list_with_asm PROTO((FILE *, char *, struct id *)); -static void write_c_file PROTO((FILE *, char *)); -static void scan_prog_file PROTO((char *, enum pass)); -#ifdef SCAN_LIBRARIES -static void scan_libraries PROTO((char *)); -#endif -#ifdef COLLECT_EXPORT_LIST -static int is_in_list PROTO((char *, struct id *)); -static void write_export_file PROTO((FILE *)); -static void write_import_file PROTO((FILE *)); -static char *resolve_lib_name PROTO((char *)); -static int use_import_list PROTO((char *)); -static int ignore_library PROTO((char *)); -#endif - -#ifdef NO_DUP2 -int -dup2 (oldfd, newfd) - int oldfd; - int newfd; -{ - int fdtmp[256]; - int fdx = 0; - int fd; - - if (oldfd == newfd) - return oldfd; - close (newfd); - while ((fd = dup (oldfd)) != newfd && fd >= 0) /* good enough for low fd's */ - fdtmp[fdx++] = fd; - while (fdx > 0) - close (fdtmp[--fdx]); - - return fd; -} -#endif - -static char * -my_strerror (e) - int e; -{ - -#ifdef HAVE_STRERROR - return strerror (e); - -#else - - if (!e) - return ""; - - if (e > 0 && e < sys_nerr) - return sys_errlist[e]; - - return "errno = ?"; -#endif -} - -static const char * -my_strsignal (s) - int s; -{ -#ifdef HAVE_STRSIGNAL - return strsignal (s); -#else - if (s >= 0 && s < NSIG) - { -# ifdef NO_SYS_SIGLIST - static char buffer[30]; - - sprintf (buffer, "Unknown signal %d", s); - return buffer; -# else - return sys_siglist[s]; -# endif - } - else - return NULL; -#endif /* HAVE_STRSIGNAL */ -} - -/* Delete tempfiles and exit function. */ - -void -collect_exit (status) - int status; -{ - if (c_file != 0 && c_file[0]) - maybe_unlink (c_file); - - if (o_file != 0 && o_file[0]) - maybe_unlink (o_file); - -#ifdef COLLECT_EXPORT_LIST - if (export_file != 0 && export_file[0]) - maybe_unlink (export_file); - - if (import_file != 0 && import_file[0]) - maybe_unlink (import_file); -#endif - - if (ldout != 0 && ldout[0]) - { - dump_file (ldout); - maybe_unlink (ldout); - } - - if (status != 0 && output_file != 0 && output_file[0]) - maybe_unlink (output_file); - - exit (status); -} - - -/* Notify user of a non-error. */ -void -notice VPROTO((char *msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - char *msgid; -#endif - va_list ap; - - VA_START (ap, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (ap, char *); -#endif - - vfprintf (stderr, _(msgid), ap); - va_end (ap); -} - -/* Die when sys call fails. */ - -void -fatal_perror VPROTO((const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char *msgid; -#endif - int e = errno; - va_list ap; - - VA_START (ap, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (ap, const char *); -#endif - - fprintf (stderr, "collect2: "); - vfprintf (stderr, _(msgid), ap); - fprintf (stderr, ": %s\n", my_strerror (e)); - va_end (ap); - - collect_exit (FATAL_EXIT_CODE); -} - -/* Just die. */ - -void -fatal VPROTO((const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char *msgid; -#endif - va_list ap; - - VA_START (ap, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (ap, const char *); -#endif - - fprintf (stderr, "collect2: "); - vfprintf (stderr, _(msgid), ap); - fprintf (stderr, "\n"); - va_end (ap); - - collect_exit (FATAL_EXIT_CODE); -} - -/* Write error message. */ - -void -error VPROTO((const char * msgid, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char * msgid; -#endif - va_list ap; - - VA_START (ap, msgid); - -#ifndef ANSI_PROTOTYPES - msgid = va_arg (ap, const char *); -#endif - - fprintf (stderr, "collect2: "); - vfprintf (stderr, _(msgid), ap); - fprintf (stderr, "\n"); - va_end(ap); -} - -/* In case obstack is linked in, and abort is defined to fancy_abort, - provide a default entry. */ - -void -fancy_abort () -{ - fatal ("internal error"); -} - -static void -handler (signo) - int signo; -{ - if (c_file != 0 && c_file[0]) - maybe_unlink (c_file); - - if (o_file != 0 && o_file[0]) - maybe_unlink (o_file); - - if (ldout != 0 && ldout[0]) - maybe_unlink (ldout); - -#ifdef COLLECT_EXPORT_LIST - if (export_file != 0 && export_file[0]) - maybe_unlink (export_file); - - if (import_file != 0 && import_file[0]) - maybe_unlink (import_file); -#endif - - signal (signo, SIG_DFL); - kill (getpid (), signo); -} - - -PTR -xcalloc (size1, size2) - size_t size1, size2; -{ - PTR ptr = (PTR) calloc (size1, size2); - if (!ptr) - fatal ("out of memory"); - return ptr; -} - -PTR -xmalloc (size) - size_t size; -{ - PTR ptr = (PTR) malloc (size); - if (!ptr) - fatal ("out of memory"); - return ptr; -} - -PTR -xrealloc (old, size) - PTR old; - size_t size; -{ - register PTR ptr; - if (old) - ptr = (PTR) realloc (old, size); - else - ptr = (PTR) malloc (size); - if (ptr == 0) - fatal ("virtual memory exhausted"); - return ptr; -} - -int -file_exists (name) - char *name; -{ - return access (name, R_OK) == 0; -} - -/* Make a copy of a string INPUT with size SIZE. */ - -char * -xstrdup (input) - const char *input; -{ - register size_t len = strlen (input) + 1; - register char *output = xmalloc (len); - memcpy (output, input, len); - return output; -} - -/* Parse a reasonable subset of shell quoting syntax. */ - -static char * -extract_string (pp) - char **pp; -{ - char *p = *pp; - int backquote = 0; - int inside = 0; - - for (;;) - { - char c = *p; - if (c == '\0') - break; - ++p; - if (backquote) - obstack_1grow (&temporary_obstack, c); - else if (! inside && c == ' ') - break; - else if (! inside && c == '\\') - backquote = 1; - else if (c == '\'') - inside = !inside; - else - obstack_1grow (&temporary_obstack, c); - } - - obstack_1grow (&temporary_obstack, '\0'); - *pp = p; - return obstack_finish (&temporary_obstack); -} - -void -dump_file (name) - char *name; -{ - FILE *stream = fopen (name, "r"); - int no_demangle = !! getenv ("COLLECT_NO_DEMANGLE"); - - if (stream == 0) - return; - while (1) - { - int c; - while (c = getc (stream), - c != EOF && (ISALNUM (c) || c == '_' || c == '$' || c == '.')) - obstack_1grow (&temporary_obstack, c); - if (obstack_object_size (&temporary_obstack) > 0) - { - char *word, *p, *result; - obstack_1grow (&temporary_obstack, '\0'); - word = obstack_finish (&temporary_obstack); - - if (*word == '.') - ++word, putc ('.', stderr); - p = word; - if (*p == '_' && prepends_underscore) - ++p; - - if (no_demangle) - result = 0; - else - result = cplus_demangle (p, DMGL_PARAMS | DMGL_ANSI); - - if (result) - { - int diff; - fputs (result, stderr); - - diff = strlen (word) - strlen (result); - while (diff > 0) - --diff, putc (' ', stderr); - while (diff < 0 && c == ' ') - ++diff, c = getc (stream); - - free (result); - } - else - fputs (word, stderr); - - fflush (stderr); - obstack_free (&temporary_obstack, temporary_firstobj); - } - if (c == EOF) - break; - putc (c, stderr); - } - fclose (stream); -} - -/* Decide whether the given symbol is: - a constructor (1), a destructor (2), or neither (0). */ - -static int -is_ctor_dtor (s) - char *s; -{ - struct names { char *name; int len; int ret; int two_underscores; }; - - register struct names *p; - register int ch; - register char *orig_s = s; - - static struct names special[] = { -#ifdef NO_DOLLAR_IN_LABEL -#ifdef NO_DOT_IN_LABEL - { "GLOBAL__I_", sizeof ("GLOBAL__I_")-1, 1, 0 }, - { "GLOBAL__D_", sizeof ("GLOBAL__D_")-1, 2, 0 }, - { "GLOBAL__F_", sizeof ("GLOBAL__F_")-1, 5, 0 }, -#else - { "GLOBAL_.I.", sizeof ("GLOBAL_.I.")-1, 1, 0 }, - { "GLOBAL_.D.", sizeof ("GLOBAL_.D.")-1, 2, 0 }, - { "GLOBAL_.F.", sizeof ("GLOBAL_.F.")-1, 5, 0 }, -#endif -#else - { "GLOBAL_$I$", sizeof ("GLOBAL_$I$")-1, 1, 0 }, - { "GLOBAL_$D$", sizeof ("GLOBAL_$D$")-1, 2, 0 }, - { "GLOBAL_$F$", sizeof ("GLOBAL_$F$")-1, 5, 0 }, -#endif - { "GLOBAL__FI_", sizeof ("GLOBAL__FI_")-1, 3, 0 }, - { "GLOBAL__FD_", sizeof ("GLOBAL__FD_")-1, 4, 0 }, -#ifdef CFRONT_LOSSAGE /* Do not collect cfront initialization functions. - cfront has its own linker procedure to collect them; - if collect2 gets them too, they get collected twice - when the cfront procedure is run and the compiler used - for linking happens to be GCC. */ - { "sti__", sizeof ("sti__")-1, 1, 1 }, - { "std__", sizeof ("std__")-1, 2, 1 }, -#endif /* CFRONT_LOSSAGE */ - { NULL, 0, 0, 0 } - }; - - while ((ch = *s) == '_') - ++s; - - if (s == orig_s) - return 0; - - for (p = &special[0]; p->len > 0; p++) - { - if (ch == p->name[0] - && (!p->two_underscores || ((s - orig_s) >= 2)) - && strncmp(s, p->name, p->len) == 0) - { - return p->ret; - } - } - return 0; -} - -/* Routine to add variables to the environment. */ - -#ifndef HAVE_PUTENV - -int -putenv (str) - char *str; -{ -#ifndef VMS /* nor about VMS */ - - extern char **environ; - char **old_environ = environ; - char **envp; - int num_envs = 0; - int name_len = 1; - char *p = str; - int ch; - - while ((ch = *p++) != '\0' && ch != '=') - name_len++; - - if (!ch) - abort (); - - /* Search for replacing an existing environment variable, and - count the number of total environment variables. */ - for (envp = old_environ; *envp; envp++) - { - num_envs++; - if (!strncmp (str, *envp, name_len)) - { - *envp = str; - return 0; - } - } - - /* Add a new environment variable */ - environ = (char **) xmalloc (sizeof (char *) * (num_envs+2)); - *environ = str; - bcopy ((char *) old_environ, (char *) (environ + 1), - sizeof (char *) * (num_envs+1)); - - return 0; -#endif /* VMS */ -} - -#endif /* HAVE_PUTENV */ - -/* By default, colon separates directories in a path. */ -#ifndef PATH_SEPARATOR -#define PATH_SEPARATOR ':' -#endif - -/* We maintain two prefix lists: one from COMPILER_PATH environment variable - and one from the PATH variable. */ - -static struct path_prefix cpath, path; - -#ifdef CROSS_COMPILE -/* This is the name of the target machine. We use it to form the name - of the files to execute. */ - -static char *target_machine = TARGET_MACHINE; -#endif - -/* Search for NAME using prefix list PPREFIX. We only look for executable - files. - - Return 0 if not found, otherwise return its name, allocated with malloc. */ - -static char * -find_a_file (pprefix, name) - struct path_prefix *pprefix; - char *name; -{ - char *temp; - struct prefix_list *pl; - int len = pprefix->max_len + strlen (name) + 1; - - if (debug) - fprintf (stderr, "Looking for '%s'\n", name); - -#ifdef EXECUTABLE_SUFFIX - len += strlen (EXECUTABLE_SUFFIX); -#endif - - temp = xmalloc (len); - - /* Determine the filename to execute (special case for absolute paths). */ - - if (*name == '/' -#ifdef HAVE_DOS_BASED_FILE_SYSTEM - || (*name && name[1] == ':') -#endif - ) - { - if (access (name, X_OK) == 0) - { - strcpy (temp, name); - - if (debug) - fprintf (stderr, " - found: absolute path\n"); - - return temp; - } - -#ifdef EXECUTABLE_SUFFIX - /* Some systems have a suffix for executable files. - So try appending that. */ - strcpy (temp, name); - strcat (temp, EXECUTABLE_SUFFIX); - - if (access (temp, X_OK) == 0) - return temp; -#endif - - if (debug) - fprintf (stderr, " - failed to locate using absolute path\n"); - } - else - for (pl = pprefix->plist; pl; pl = pl->next) - { - strcpy (temp, pl->prefix); - strcat (temp, name); - - if (access (temp, X_OK) == 0) - return temp; - -#ifdef EXECUTABLE_SUFFIX - /* Some systems have a suffix for executable files. - So try appending that. */ - strcat (temp, EXECUTABLE_SUFFIX); - - if (access (temp, X_OK) == 0) - return temp; -#endif - } - - if (debug && pprefix->plist == NULL) - fprintf (stderr, " - failed: no entries in prefix list\n"); - - free (temp); - return 0; -} - -/* Add an entry for PREFIX to prefix list PPREFIX. */ - -static void -add_prefix (pprefix, prefix) - struct path_prefix *pprefix; - char *prefix; -{ - struct prefix_list *pl, **prev; - int len; - - if (pprefix->plist) - { - for (pl = pprefix->plist; pl->next; pl = pl->next) - ; - prev = &pl->next; - } - else - prev = &pprefix->plist; - - /* Keep track of the longest prefix */ - - len = strlen (prefix); - if (len > pprefix->max_len) - pprefix->max_len = len; - - pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list)); - pl->prefix = xstrdup (prefix); - - if (*prev) - pl->next = *prev; - else - pl->next = (struct prefix_list *) 0; - *prev = pl; -} - -/* Take the value of the environment variable ENV, break it into a path, and - add of the entries to PPREFIX. */ - -static void -prefix_from_env (env, pprefix) - char *env; - struct path_prefix *pprefix; -{ - char *p; - GET_ENV_PATH_LIST (p, env); - - if (p) - prefix_from_string (p, pprefix); -} - -static void -prefix_from_string (p, pprefix) - char *p; - struct path_prefix *pprefix; -{ - char *startp, *endp; - char *nstore = (char *) xmalloc (strlen (p) + 3); - - if (debug) - fprintf (stderr, "Convert string '%s' into prefixes, separator = '%c'\n", p, PATH_SEPARATOR); - - startp = endp = p; - while (1) - { - if (*endp == PATH_SEPARATOR || *endp == 0) - { - strncpy (nstore, startp, endp-startp); - if (endp == startp) - { - strcpy (nstore, "./"); - } - else if (endp[-1] != '/') - { - nstore[endp-startp] = '/'; - nstore[endp-startp+1] = 0; - } - else - nstore[endp-startp] = 0; - - if (debug) - fprintf (stderr, " - add prefix: %s\n", nstore); - - add_prefix (pprefix, nstore); - if (*endp == 0) - break; - endp = startp = endp + 1; - } - else - endp++; - } -} - -/* Main program. */ - -int -main (argc, argv) - int argc; - char *argv[]; -{ - char *ld_suffix = "ld"; - char *full_ld_suffix = ld_suffix; - char *real_ld_suffix = "real-ld"; - char *collect_ld_suffix = "collect-ld"; - char *nm_suffix = "nm"; - char *full_nm_suffix = nm_suffix; - char *gnm_suffix = "gnm"; - char *full_gnm_suffix = gnm_suffix; -#ifdef LDD_SUFFIX - char *ldd_suffix = LDD_SUFFIX; - char *full_ldd_suffix = ldd_suffix; -#endif - char *strip_suffix = "strip"; - char *full_strip_suffix = strip_suffix; - char *gstrip_suffix = "gstrip"; - char *full_gstrip_suffix = gstrip_suffix; - char *arg; - FILE *outf; -#ifdef COLLECT_EXPORT_LIST - FILE *exportf; - FILE *importf; -#endif - char *ld_file_name; - char *p; - char **c_argv; - char **c_ptr; - char **ld1_argv; - char **ld1; - char **ld2_argv; - char **ld2; - char **object_lst; - char **object; - int first_file; - int num_c_args = argc+9; - -#if defined (COLLECT2_HOST_INITIALIZATION) - /* Perform system dependant initialization, if neccessary. */ - COLLECT2_HOST_INITIALIZATION; -#endif - -#ifdef HAVE_LC_MESSAGES - setlocale (LC_MESSAGES, ""); -#endif - (void) bindtextdomain (PACKAGE, localedir); - (void) textdomain (PACKAGE); - - /* Do not invoke xcalloc before this point, since locale needs to be - set first, in case a diagnostic is issued. */ - - ld1 = ld1_argv = (char **) xcalloc (sizeof (char *), argc+3); - ld2 = ld2_argv = (char **) xcalloc (sizeof (char *), argc+6); - object = object_lst = (char **) xcalloc (sizeof (char *), argc); - -#ifdef DEBUG - debug = 1; -#endif - - /* Parse command line early for instances of -debug. This allows - the debug flag to be set before functions like find_a_file() - are called. */ - { - int i; - - for (i = 1; argv[i] != NULL; i ++) - if (! strcmp (argv[i], "-debug")) - debug = 1; - vflag = debug; - } - -#ifndef DEFAULT_A_OUT_NAME - output_file = "a.out"; -#else - output_file = DEFAULT_A_OUT_NAME; -#endif - - obstack_begin (&temporary_obstack, 0); - obstack_begin (&permanent_obstack, 0); - temporary_firstobj = (char *) obstack_alloc (&temporary_obstack, 0); - - current_demangling_style = gnu_demangling; - p = getenv ("COLLECT_GCC_OPTIONS"); - while (p && *p) - { - char *q = extract_string (&p); - if (*q == '-' && (q[1] == 'm' || q[1] == 'f')) - num_c_args++; - } - obstack_free (&temporary_obstack, temporary_firstobj); - ++num_c_args; - - c_ptr = c_argv = (char **) xcalloc (sizeof (char *), num_c_args); - - if (argc < 2) - fatal ("no arguments"); - -#ifdef SIGQUIT - if (signal (SIGQUIT, SIG_IGN) != SIG_IGN) - signal (SIGQUIT, handler); -#endif - if (signal (SIGINT, SIG_IGN) != SIG_IGN) - signal (SIGINT, handler); -#ifdef SIGALRM - if (signal (SIGALRM, SIG_IGN) != SIG_IGN) - signal (SIGALRM, handler); -#endif -#ifdef SIGHUP - if (signal (SIGHUP, SIG_IGN) != SIG_IGN) - signal (SIGHUP, handler); -#endif - if (signal (SIGSEGV, SIG_IGN) != SIG_IGN) - signal (SIGSEGV, handler); -#ifdef SIGBUS - if (signal (SIGBUS, SIG_IGN) != SIG_IGN) - signal (SIGBUS, handler); -#endif - - /* Extract COMPILER_PATH and PATH into our prefix list. */ - prefix_from_env ("COMPILER_PATH", &cpath); - prefix_from_env ("PATH", &path); - -#ifdef CROSS_COMPILE - /* If we look for a program in the compiler directories, we just use - the short name, since these directories are already system-specific. - But it we look for a program in the system directories, we need to - qualify the program name with the target machine. */ - - full_ld_suffix - = xcalloc (strlen (ld_suffix) + strlen (target_machine) + 2, 1); - strcpy (full_ld_suffix, target_machine); - strcat (full_ld_suffix, "-"); - strcat (full_ld_suffix, ld_suffix); - -#if 0 - full_gld_suffix - = xcalloc (strlen (gld_suffix) + strlen (target_machine) + 2, 1); - strcpy (full_gld_suffix, target_machine); - strcat (full_gld_suffix, "-"); - strcat (full_gld_suffix, gld_suffix); -#endif - - full_nm_suffix - = xcalloc (strlen (nm_suffix) + strlen (target_machine) + 2, 1); - strcpy (full_nm_suffix, target_machine); - strcat (full_nm_suffix, "-"); - strcat (full_nm_suffix, nm_suffix); - - full_gnm_suffix - = xcalloc (strlen (gnm_suffix) + strlen (target_machine) + 2, 1); - strcpy (full_gnm_suffix, target_machine); - strcat (full_gnm_suffix, "-"); - strcat (full_gnm_suffix, gnm_suffix); - -#ifdef LDD_SUFFIX - full_ldd_suffix - = xcalloc (strlen (ldd_suffix) + strlen (target_machine) + 2, 1); - strcpy (full_ldd_suffix, target_machine); - strcat (full_ldd_suffix, "-"); - strcat (full_ldd_suffix, ldd_suffix); -#endif - - full_strip_suffix - = xcalloc (strlen (strip_suffix) + strlen (target_machine) + 2, 1); - strcpy (full_strip_suffix, target_machine); - strcat (full_strip_suffix, "-"); - strcat (full_strip_suffix, strip_suffix); - - full_gstrip_suffix - = xcalloc (strlen (gstrip_suffix) + strlen (target_machine) + 2, 1); - strcpy (full_gstrip_suffix, target_machine); - strcat (full_gstrip_suffix, "-"); - strcat (full_gstrip_suffix, gstrip_suffix); -#endif /* CROSS_COMPILE */ - - /* Try to discover a valid linker/nm/strip to use. */ - - /* Maybe we know the right file to use (if not cross). */ - ld_file_name = 0; -#ifdef DEFAULT_LINKER - if (access (DEFAULT_LINKER, X_OK) == 0) - ld_file_name = DEFAULT_LINKER; - if (ld_file_name == 0) -#endif -#ifdef REAL_LD_FILE_NAME - ld_file_name = find_a_file (&path, REAL_LD_FILE_NAME); - if (ld_file_name == 0) -#endif - /* Search the (target-specific) compiler dirs for ld'. */ - ld_file_name = find_a_file (&cpath, real_ld_suffix); - /* Likewise for `collect-ld'. */ - if (ld_file_name == 0) - ld_file_name = find_a_file (&cpath, collect_ld_suffix); - /* Search the compiler directories for `ld'. We have protection against - recursive calls in find_a_file. */ - if (ld_file_name == 0) - ld_file_name = find_a_file (&cpath, ld_suffix); - /* Search the ordinary system bin directories - for `ld' (if native linking) or `TARGET-ld' (if cross). */ - if (ld_file_name == 0) - ld_file_name = find_a_file (&path, full_ld_suffix); - -#ifdef REAL_NM_FILE_NAME - nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME); - if (nm_file_name == 0) -#endif - nm_file_name = find_a_file (&cpath, gnm_suffix); - if (nm_file_name == 0) - nm_file_name = find_a_file (&path, full_gnm_suffix); - if (nm_file_name == 0) - nm_file_name = find_a_file (&cpath, nm_suffix); - if (nm_file_name == 0) - nm_file_name = find_a_file (&path, full_nm_suffix); - -#ifdef LDD_SUFFIX - ldd_file_name = find_a_file (&cpath, ldd_suffix); - if (ldd_file_name == 0) - ldd_file_name = find_a_file (&path, full_ldd_suffix); -#endif - -#ifdef REAL_STRIP_FILE_NAME - strip_file_name = find_a_file (&path, REAL_STRIP_FILE_NAME); - if (strip_file_name == 0) -#endif - strip_file_name = find_a_file (&cpath, gstrip_suffix); - if (strip_file_name == 0) - strip_file_name = find_a_file (&path, full_gstrip_suffix); - if (strip_file_name == 0) - strip_file_name = find_a_file (&cpath, strip_suffix); - if (strip_file_name == 0) - strip_file_name = find_a_file (&path, full_strip_suffix); - - /* Determine the full path name of the C compiler to use. */ - c_file_name = getenv ("COLLECT_GCC"); - if (c_file_name == 0) - { -#ifdef CROSS_COMPILE - c_file_name = xcalloc (sizeof ("gcc-") + strlen (target_machine) + 1, 1); - strcpy (c_file_name, target_machine); - strcat (c_file_name, "-gcc"); -#else - c_file_name = "gcc"; -#endif - } - - p = find_a_file (&cpath, c_file_name); - - /* Here it should be safe to use the system search path since we should have - already qualified the name of the compiler when it is needed. */ - if (p == 0) - p = find_a_file (&path, c_file_name); - - if (p) - c_file_name = p; - - *ld1++ = *ld2++ = ld_file_name; - - /* Make temp file names. */ - c_file = make_temp_file (".c"); - o_file = make_temp_file (".o"); -#ifdef COLLECT_EXPORT_LIST - export_file = make_temp_file (".x"); - import_file = make_temp_file (".p"); -#endif - ldout = make_temp_file (".ld"); - *c_ptr++ = c_file_name; - *c_ptr++ = "-x"; - *c_ptr++ = "c"; - *c_ptr++ = "-c"; - *c_ptr++ = "-o"; - *c_ptr++ = o_file; - -#ifdef COLLECT_EXPORT_LIST - /* Generate a list of directories from LIBPATH. */ - prefix_from_env ("LIBPATH", &libpath_lib_dirs); - /* Add to this list also two standard directories where - AIX loader always searches for libraries. */ - add_prefix (&libpath_lib_dirs, "/lib"); - add_prefix (&libpath_lib_dirs, "/usr/lib"); -#endif - - /* Get any options that the upper GCC wants to pass to the sub-GCC. - - AIX support needs to know if -shared has been specified before - parsing commandline arguments. */ - - p = getenv ("COLLECT_GCC_OPTIONS"); - while (p && *p) - { - char *q = extract_string (&p); - if (*q == '-' && (q[1] == 'm' || q[1] == 'f')) - *c_ptr++ = obstack_copy0 (&permanent_obstack, q, strlen (q)); - if (strcmp (q, "-EL") == 0 || strcmp (q, "-EB") == 0) - *c_ptr++ = obstack_copy0 (&permanent_obstack, q, strlen (q)); - if (strncmp (q, "-shared", sizeof ("-shared") - 1) == 0) - shared_obj = 1; - } - obstack_free (&temporary_obstack, temporary_firstobj); - *c_ptr++ = "-fno-exceptions"; - - /* !!! When GCC calls collect2, - it does not know whether it is calling collect2 or ld. - So collect2 cannot meaningfully understand any options - except those ld understands. - If you propose to make GCC pass some other option, - just imagine what will happen if ld is really ld!!! */ - - /* Parse arguments. Remember output file spec, pass the rest to ld. */ - /* After the first file, put in the c++ rt0. */ - - first_file = 1; - while ((arg = *++argv) != (char *) 0) - { - *ld1++ = *ld2++ = arg; - - if (arg[0] == '-') - { - switch (arg[1]) - { -#ifdef COLLECT_EXPORT_LIST - /* We want to disable automatic exports on AIX when user - explicitly puts an export list in command line */ - case 'b': - if (arg[2] == 'E' || strncmp (&arg[2], "export", 6) == 0) - export_flag = 1; - else if (arg[2] == '6' && arg[3] == '4') - aix64_flag = 1; - break; -#endif - - case 'd': - if (!strcmp (arg, "-debug")) - { - /* Already parsed. */ - ld1--; - ld2--; - } - break; - - case 'l': - if (first_file) - { - /* place o_file BEFORE this argument! */ - first_file = 0; - ld2--; - *ld2++ = o_file; - *ld2++ = arg; - } -#ifdef COLLECT_EXPORT_LIST - { - /* Resolving full library name. */ - char *s = resolve_lib_name (arg+2); - - /* If we will use an import list for this library, - we should exclude it from ld args. */ - if (use_import_list (s)) - { - ld1--; - ld2--; - } - - /* Saving a full library name. */ - add_to_list (&libs, s); - } -#endif - break; - -#ifdef COLLECT_EXPORT_LIST - /* Saving directories where to search for libraries. */ - case 'L': - add_prefix (&cmdline_lib_dirs, arg+2); - break; -#endif - - case 'o': - if (arg[2] == '\0') - output_file = *ld1++ = *ld2++ = *++argv; - else - output_file = &arg[2]; - break; - - case 'r': - if (arg[2] == '\0') - rflag = 1; - break; - - case 's': - if (arg[2] == '\0' && do_collecting) - { - /* We must strip after the nm run, otherwise C++ linking - will not work. Thus we strip in the second ld run, or - else with strip if there is no second ld run. */ - strip_flag = 1; - ld1--; - } - break; - - case 'v': - if (arg[2] == '\0') - vflag = 1; - break; - } - } - else if ((p = rindex (arg, '.')) != (char *) 0 - && (strcmp (p, ".o") == 0 || strcmp (p, ".a") == 0 - || strcmp (p, ".so") == 0)) - { - if (first_file) - { - first_file = 0; - if (p[1] == 'o') - *ld2++ = o_file; - else - { - /* place o_file BEFORE this argument! */ - ld2--; - *ld2++ = o_file; - *ld2++ = arg; - } - } - if (p[1] == 'o') - *object++ = arg; -#ifdef COLLECT_EXPORT_LIST - /* libraries can be specified directly, i.e. without -l flag. */ - else - { - /* If we will use an import list for this library, - we should exclude it from ld args. */ - if (use_import_list (arg)) - { - ld1--; - ld2--; - } - - /* Saving a full library name. */ - add_to_list (&libs, arg); - } -#endif - } - } - -#ifdef COLLECT_EXPORT_LIST - /* This is added only for debugging purposes. */ - if (debug) - { - fprintf (stderr, "List of libraries:\n"); - dump_list (stderr, "\t", libs.first); - } - - /* The AIX linker will discard static constructors in object files if - nothing else in the file is referenced, so look at them first. */ - { - char **export_object_lst = object_lst; - while (export_object_lst < object) - scan_prog_file (*export_object_lst++, PASS_OBJ); - } - { - struct id *list = libs.first; - for (; list; list = list->next) - scan_prog_file (list->name, PASS_FIRST); - } - { - char *buf1 = alloca (strlen (export_file) + 5); - char *buf2 = alloca (strlen (import_file) + 5); - sprintf (buf1, "-bE:%s", export_file); - sprintf (buf2, "-bI:%s", import_file); - *ld1++ = buf1; - *ld2++ = buf1; - *ld1++ = buf2; - *ld2++ = buf2; - exportf = fopen (export_file, "w"); - if (exportf == (FILE *) 0) - fatal_perror ("fopen %s", export_file); - write_export_file (exportf); - if (fclose (exportf)) - fatal_perror ("fclose %s", export_file); - importf = fopen (import_file, "w"); - if (importf == (FILE *) 0) - fatal_perror ("%s", import_file); - write_import_file (importf); - if (fclose (importf)) - fatal_perror ("fclose %s", import_file); - } -#endif - - *c_ptr++ = c_file; - *object = *c_ptr = *ld1 = (char *) 0; - - if (vflag) - { - notice ("collect2 version %s", version_string); -#ifdef TARGET_VERSION - TARGET_VERSION; -#endif - fprintf (stderr, "\n"); - } - - if (debug) - { - char *ptr; - fprintf (stderr, "ld_file_name = %s\n", - (ld_file_name ? ld_file_name : "not found")); - fprintf (stderr, "c_file_name = %s\n", - (c_file_name ? c_file_name : "not found")); - fprintf (stderr, "nm_file_name = %s\n", - (nm_file_name ? nm_file_name : "not found")); -#ifdef LDD_SUFFIX - fprintf (stderr, "ldd_file_name = %s\n", - (ldd_file_name ? ldd_file_name : "not found")); -#endif - fprintf (stderr, "strip_file_name = %s\n", - (strip_file_name ? strip_file_name : "not found")); - fprintf (stderr, "c_file = %s\n", - (c_file ? c_file : "not found")); - fprintf (stderr, "o_file = %s\n", - (o_file ? o_file : "not found")); - - ptr = getenv ("COLLECT_GCC_OPTIONS"); - if (ptr) - fprintf (stderr, "COLLECT_GCC_OPTIONS = %s\n", ptr); - - ptr = getenv ("COLLECT_GCC"); - if (ptr) - fprintf (stderr, "COLLECT_GCC = %s\n", ptr); - - ptr = getenv ("COMPILER_PATH"); - if (ptr) - fprintf (stderr, "COMPILER_PATH = %s\n", ptr); - - ptr = getenv ("LIBRARY_PATH"); - if (ptr) - fprintf (stderr, "LIBRARY_PATH = %s\n", ptr); - - fprintf (stderr, "\n"); - } - - /* Load the program, searching all libraries and attempting to provide - undefined symbols from repository information. */ - - /* On AIX we do this later. */ -#ifndef COLLECT_EXPORT_LIST - do_tlink (ld1_argv, object_lst); -#endif - - /* If -r or they will be run via some other method, do not build the - constructor or destructor list, just return now. */ - if (rflag -#ifndef COLLECT_EXPORT_LIST - || ! do_collecting -#endif - ) - { -#ifdef COLLECT_EXPORT_LIST - /* Do the link we avoided above if we are exiting. */ - do_tlink (ld1_argv, object_lst); - - /* But make sure we delete the export file we may have created. */ - if (export_file != 0 && export_file[0]) - maybe_unlink (export_file); - if (import_file != 0 && import_file[0]) - maybe_unlink (import_file); -#endif - maybe_unlink (c_file); - maybe_unlink (o_file); - return 0; - } - - /* Examine the namelist with nm and search it for static constructors - and destructors to call. - Write the constructor and destructor tables to a .s file and reload. */ - - /* On AIX we already done scanning for global constructors/destructors. */ -#ifndef COLLECT_EXPORT_LIST - scan_prog_file (output_file, PASS_FIRST); -#endif - -#ifdef SCAN_LIBRARIES - scan_libraries (output_file); -#endif - - if (debug) - { - notice ("%d constructor(s) found\n", constructors.number); - notice ("%d destructor(s) found\n", destructors.number); - notice ("%d frame table(s) found\n", frame_tables.number); - } - - if (constructors.number == 0 && destructors.number == 0 - && frame_tables.number == 0 -#if defined (SCAN_LIBRARIES) || defined (COLLECT_EXPORT_LIST) - /* If we will be running these functions ourselves, we want to emit - stubs into the shared library so that we do not have to relink - dependent programs when we add static objects. */ - && ! shared_obj -#endif - ) - { -#ifdef COLLECT_EXPORT_LIST - /* Doing tlink without additional code generation */ - do_tlink (ld1_argv, object_lst); -#endif - /* Strip now if it was requested on the command line. */ - if (strip_flag) - { - char **strip_argv = (char **) xcalloc (sizeof (char *), 3); - strip_argv[0] = strip_file_name; - strip_argv[1] = output_file; - strip_argv[2] = (char *) 0; - fork_execute ("strip", strip_argv); - } - -#ifdef COLLECT_EXPORT_LIST - maybe_unlink (export_file); - maybe_unlink (import_file); -#endif - maybe_unlink (c_file); - maybe_unlink (o_file); - return 0; - } - - /* Sort ctor and dtor lists by priority. */ - sort_ids (&constructors); - sort_ids (&destructors); - - maybe_unlink(output_file); - outf = fopen (c_file, "w"); - if (outf == (FILE *) 0) - fatal_perror ("fopen %s", c_file); - - write_c_file (outf, c_file); - - if (fclose (outf)) - fatal_perror ("fclose %s", c_file); - - /* Tell the linker that we have initializer and finalizer functions. */ -#ifdef LD_INIT_SWITCH - *ld2++ = LD_INIT_SWITCH; - *ld2++ = initname; - *ld2++ = LD_FINI_SWITCH; - *ld2++ = fininame; -#endif - *ld2 = (char*) 0; - -#ifdef COLLECT_EXPORT_LIST - if (shared_obj) - { - add_to_list (&exports, initname); - add_to_list (&exports, fininame); - add_to_list (&exports, "_GLOBAL__DI"); - add_to_list (&exports, "_GLOBAL__DD"); - exportf = fopen (export_file, "w"); - if (exportf == (FILE *) 0) - fatal_perror ("fopen %s", export_file); - write_export_file (exportf); - if (fclose (exportf)) - fatal_perror ("fclose %s", export_file); - } -#endif - - if (debug) - { - fprintf (stderr, "\n========== output_file = %s, c_file = %s\n", - output_file, c_file); - write_c_file (stderr, "stderr"); - fprintf (stderr, "========== end of c_file\n\n"); -#ifdef COLLECT_EXPORT_LIST - fprintf (stderr, "\n========== export_file = %s\n", export_file); - write_export_file (stderr); - fprintf (stderr, "========== end of export_file\n\n"); -#endif - } - - /* Assemble the constructor and destructor tables. - Link the tables in with the rest of the program. */ - - fork_execute ("gcc", c_argv); -#ifdef COLLECT_EXPORT_LIST - /* On AIX we must call tlink because of possible templates resolution */ - do_tlink (ld2_argv, object_lst); -#else - /* Otherwise, simply call ld because tlink is already done */ - fork_execute ("ld", ld2_argv); - - /* Let scan_prog_file do any final mods (OSF/rose needs this for - constructors/destructors in shared libraries. */ - scan_prog_file (output_file, PASS_SECOND); -#endif - - maybe_unlink (c_file); - maybe_unlink (o_file); - -#ifdef COLLECT_EXPORT_LIST - maybe_unlink (export_file); - maybe_unlink (import_file); -#endif - - return 0; -} - - -/* Wait for a process to finish, and exit if a non-zero status is found. */ - -int -collect_wait (prog) - char *prog; -{ - int status; - - pwait (pexecute_pid, &status, 0); - if (status) - { - if (WIFSIGNALED (status)) - { - int sig = WTERMSIG (status); - error ((status & 0200 - ? "%s terminated with signal %d [%s]" - : "%s terminated with signal %d [%s], core dumped"), - prog, - sig, - my_strsignal(sig)); - collect_exit (FATAL_EXIT_CODE); - } - - if (WIFEXITED (status)) - return WEXITSTATUS (status); - } - return 0; -} - -static void -do_wait (prog) - char *prog; -{ - int ret = collect_wait (prog); - if (ret != 0) - { - error ("%s returned %d exit status", prog, ret); - collect_exit (ret); - } -} - - -/* Execute a program, and wait for the reply. */ - -void -collect_execute (prog, argv, redir) - char *prog; - char **argv; - char *redir; -{ - char *errmsg_fmt; - char *errmsg_arg; - int redir_handle = -1; - int stdout_save = -1; - int stderr_save = -1; - - if (vflag || debug) - { - char **p_argv; - char *str; - - if (argv[0]) - fprintf (stderr, "%s", argv[0]); - else - notice ("[cannot find %s]", prog); - - for (p_argv = &argv[1]; (str = *p_argv) != (char *) 0; p_argv++) - fprintf (stderr, " %s", str); - - fprintf (stderr, "\n"); - } - - fflush (stdout); - fflush (stderr); - - /* If we cannot find a program we need, complain error. Do this here - since we might not end up needing something that we could not find. */ - - if (argv[0] == 0) - fatal ("cannot find `%s'", prog); - - if (redir) - { - /* Open response file. */ - redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT); - - /* Duplicate the stdout and stderr file handles - so they can be restored later. */ - stdout_save = dup (STDOUT_FILENO); - if (stdout_save == -1) - fatal_perror ("redirecting stdout: %s", redir); - stderr_save = dup (STDERR_FILENO); - if (stderr_save == -1) - fatal_perror ("redirecting stdout: %s", redir); - - /* Redirect stdout & stderr to our response file. */ - dup2 (redir_handle, STDOUT_FILENO); - dup2 (redir_handle, STDERR_FILENO); - } - - pexecute_pid = pexecute (argv[0], argv, argv[0], NULL, - &errmsg_fmt, &errmsg_arg, - (PEXECUTE_FIRST | PEXECUTE_LAST | PEXECUTE_SEARCH)); - - if (redir) - { - /* Restore stdout and stderr to their previous settings. */ - dup2 (stdout_save, STDOUT_FILENO); - dup2 (stderr_save, STDERR_FILENO); - - /* Close reponse file. */ - close (redir_handle); - } - - if (pexecute_pid == -1) - fatal_perror (errmsg_fmt, errmsg_arg); -} - -static void -fork_execute (prog, argv) - char *prog; - char **argv; -{ - collect_execute (prog, argv, NULL); - do_wait (prog); -} - -/* Unlink a file unless we are debugging. */ - -static void -maybe_unlink (file) - char *file; -{ - if (!debug) - unlink (file); - else - notice ("[Leaving %s]\n", file); -} - - -static long sequence_number = 0; - -/* Add a name to a linked list. */ - -static void -add_to_list (head_ptr, name) - struct head *head_ptr; - char *name; -{ - struct id *newid - = (struct id *) xcalloc (sizeof (struct id) + strlen (name), 1); - struct id *p; - strcpy (newid->name, name); - - if (head_ptr->first) - head_ptr->last->next = newid; - else - head_ptr->first = newid; - - /* Check for duplicate symbols. */ - for (p = head_ptr->first; - strcmp (name, p->name) != 0; - p = p->next) - ; - if (p != newid) - { - head_ptr->last->next = 0; - free (newid); - return; - } - - newid->sequence = ++sequence_number; - head_ptr->last = newid; - head_ptr->number++; -} - -/* Grab the init priority number from an init function name that - looks like "_GLOBAL_.I.12345.foo". */ - -static int -extract_init_priority (name) - char *name; -{ - int pos = 0, pri; - - while (name[pos] == '_') - ++pos; - pos += 10; /* strlen ("GLOBAL__X_") */ - - /* Extract init_p number from ctor/dtor name. */ - pri = atoi (name + pos); - return pri ? pri : DEFAULT_INIT_PRIORITY; -} - -/* Insertion sort the ids from ctor/dtor list HEAD_PTR in descending order. - ctors will be run from right to left, dtors from left to right. */ - -static void -sort_ids (head_ptr) - struct head *head_ptr; -{ - /* id holds the current element to insert. id_next holds the next - element to insert. id_ptr iterates through the already sorted elements - looking for the place to insert id. */ - struct id *id, *id_next, **id_ptr; - - id = head_ptr->first; - - /* We don't have any sorted elements yet. */ - head_ptr->first = NULL; - - for (; id; id = id_next) - { - id_next = id->next; - id->sequence = extract_init_priority (id->name); - - for (id_ptr = &(head_ptr->first); ; id_ptr = &((*id_ptr)->next)) - if (*id_ptr == NULL - /* If the sequence numbers are the same, we put the id from the - file later on the command line later in the list. */ - || id->sequence > (*id_ptr)->sequence - /* Hack: do lexical compare, too. - || (id->sequence == (*id_ptr)->sequence - && strcmp (id->name, (*id_ptr)->name) > 0) */ - ) - { - id->next = *id_ptr; - *id_ptr = id; - break; - } - } - - /* Now set the sequence numbers properly so write_c_file works. */ - for (id = head_ptr->first; id; id = id->next) - id->sequence = ++sequence_number; -} - -/* Write: `prefix', the names on list LIST, `suffix'. */ - -static void -write_list (stream, prefix, list) - FILE *stream; - char *prefix; - struct id *list; -{ - while (list) - { - fprintf (stream, "%sx%d,\n", prefix, list->sequence); - list = list->next; - } -} - -#ifdef COLLECT_EXPORT_LIST -/* This function is really used only on AIX, but may be useful. */ -static int -is_in_list (prefix, list) - char *prefix; - struct id *list; -{ - while (list) - { - if (!strcmp (prefix, list->name)) return 1; - list = list->next; - } - return 0; -} -#endif - -/* Added for debugging purpose. */ -#ifdef COLLECT_EXPORT_LIST -static void -dump_list (stream, prefix, list) - FILE *stream; - char *prefix; - struct id *list; -{ - while (list) - { - fprintf (stream, "%s%s,\n", prefix, list->name); - list = list->next; - } -} -#endif - -#if 0 -static void -dump_prefix_list (stream, prefix, list) - FILE *stream; - char *prefix; - struct prefix_list *list; -{ - while (list) - { - fprintf (stream, "%s%s,\n", prefix, list->prefix); - list = list->next; - } -} -#endif - -static void -write_list_with_asm (stream, prefix, list) - FILE *stream; - char *prefix; - struct id *list; -{ - while (list) - { - fprintf (stream, "%sx%d __asm__ (\"%s\");\n", - prefix, list->sequence, list->name); - list = list->next; - } -} - -/* Write out the constructor and destructor tables statically (for a shared - object), along with the functions to execute them. */ - -static void -write_c_file_stat (stream, name) - FILE *stream; - char *name; -{ - char *prefix, *p, *q; - int frames = (frame_tables.number > 0); - - /* Figure out name of output_file, stripping off .so version. */ - p = rindex (output_file, '/'); - if (p == 0) - p = (char *) output_file; - else - p++; - q = p; - while (q) - { - q = index (q,'.'); - if (q == 0) - { - q = p + strlen (p); - break; - } - else - { - if (strncmp (q, ".so", 3) == 0) - { - q += 3; - break; - } - else - q++; - } - } - /* q points to null at end of the string (or . of the .so version) */ - prefix = xmalloc (q - p + 1); - strncpy (prefix, p, q - p); - prefix[q - p] = 0; - for (q = prefix; *q; q++) - if (!ISALNUM ((unsigned char)*q)) - *q = '_'; - if (debug) - notice ("\nwrite_c_file - output name is %s, prefix is %s\n", - output_file, prefix); - -#define INIT_NAME_FORMAT "_GLOBAL__FI_%s" - initname = xmalloc (strlen (prefix) + sizeof (INIT_NAME_FORMAT) - 2); - sprintf (initname, INIT_NAME_FORMAT, prefix); - -#define FINI_NAME_FORMAT "_GLOBAL__FD_%s" - fininame = xmalloc (strlen (prefix) + sizeof (FINI_NAME_FORMAT) - 2); - sprintf (fininame, FINI_NAME_FORMAT, prefix); - - free (prefix); - - /* Write the tables as C code */ - - fprintf (stream, "static int count;\n"); - fprintf (stream, "typedef void entry_pt();\n"); - write_list_with_asm (stream, "extern entry_pt ", constructors.first); - - if (frames) - { - write_list_with_asm (stream, "extern void *", frame_tables.first); - - fprintf (stream, "\tstatic void *frame_table[] = {\n"); - write_list (stream, "\t\t&", frame_tables.first); - fprintf (stream, "\t0\n};\n"); - - /* This must match what's in frame.h. */ - fprintf (stream, "struct object {\n"); - fprintf (stream, " void *pc_begin;\n"); - fprintf (stream, " void *pc_end;\n"); - fprintf (stream, " void *fde_begin;\n"); - fprintf (stream, " void *fde_array;\n"); - fprintf (stream, " __SIZE_TYPE__ count;\n"); - fprintf (stream, " struct object *next;\n"); - fprintf (stream, "};\n"); - - fprintf (stream, "extern void __register_frame_info_table (void *, struct object *);\n"); - fprintf (stream, "extern void *__deregister_frame_info (void *);\n"); - - fprintf (stream, "static void reg_frame () {\n"); - fprintf (stream, "\tstatic struct object ob;\n"); - fprintf (stream, "\t__register_frame_info_table (frame_table, &ob);\n"); - fprintf (stream, "\t}\n"); - - fprintf (stream, "static void dereg_frame () {\n"); - fprintf (stream, "\t__deregister_frame_info (frame_table);\n"); - fprintf (stream, "\t}\n"); - } - - fprintf (stream, "void %s() {\n", initname); - if (constructors.number > 0 || frames) - { - fprintf (stream, "\tstatic entry_pt *ctors[] = {\n"); - write_list (stream, "\t\t", constructors.first); - if (frames) - fprintf (stream, "\treg_frame,\n"); - fprintf (stream, "\t};\n"); - fprintf (stream, "\tentry_pt **p;\n"); - fprintf (stream, "\tif (count++ != 0) return;\n"); - fprintf (stream, "\tp = ctors + %d;\n", constructors.number + frames); - fprintf (stream, "\twhile (p > ctors) (*--p)();\n"); - } - else - fprintf (stream, "\t++count;\n"); - fprintf (stream, "}\n"); - write_list_with_asm (stream, "extern entry_pt ", destructors.first); - fprintf (stream, "void %s() {\n", fininame); - if (destructors.number > 0 || frames) - { - fprintf (stream, "\tstatic entry_pt *dtors[] = {\n"); - write_list (stream, "\t\t", destructors.first); - if (frames) - fprintf (stream, "\tdereg_frame,\n"); - fprintf (stream, "\t};\n"); - fprintf (stream, "\tentry_pt **p;\n"); - fprintf (stream, "\tif (--count != 0) return;\n"); - fprintf (stream, "\tp = dtors;\n"); - fprintf (stream, "\twhile (p < dtors + %d) (*p++)();\n", - destructors.number + frames); - } - fprintf (stream, "}\n"); - - if (shared_obj) - { - fprintf (stream, "void _GLOBAL__DI() {\n\t%s();\n}\n", initname); - fprintf (stream, "void _GLOBAL__DD() {\n\t%s();\n}\n", fininame); - } -} - -/* Write the constructor/destructor tables. */ - -#ifndef LD_INIT_SWITCH -static void -write_c_file_glob (stream, name) - FILE *stream; - char *name; -{ - /* Write the tables as C code */ - - int frames = (frame_tables.number > 0); - - fprintf (stream, "typedef void entry_pt();\n\n"); - - write_list_with_asm (stream, "extern entry_pt ", constructors.first); - - if (frames) - { - write_list_with_asm (stream, "extern void *", frame_tables.first); - - fprintf (stream, "\tstatic void *frame_table[] = {\n"); - write_list (stream, "\t\t&", frame_tables.first); - fprintf (stream, "\t0\n};\n"); - - /* This must match what's in frame.h. */ - fprintf (stream, "struct object {\n"); - fprintf (stream, " void *pc_begin;\n"); - fprintf (stream, " void *pc_end;\n"); - fprintf (stream, " void *fde_begin;\n"); - fprintf (stream, " void *fde_array;\n"); - fprintf (stream, " __SIZE_TYPE__ count;\n"); - fprintf (stream, " struct object *next;\n"); - fprintf (stream, "};\n"); - - fprintf (stream, "extern void __register_frame_info_table (void *, struct object *);\n"); - fprintf (stream, "extern void *__deregister_frame_info (void *);\n"); - - fprintf (stream, "static void reg_frame () {\n"); - fprintf (stream, "\tstatic struct object ob;\n"); - fprintf (stream, "\t__register_frame_info_table (frame_table, &ob);\n"); - fprintf (stream, "\t}\n"); - - fprintf (stream, "static void dereg_frame () {\n"); - fprintf (stream, "\t__deregister_frame_info (frame_table);\n"); - fprintf (stream, "\t}\n"); - } - - fprintf (stream, "\nentry_pt * __CTOR_LIST__[] = {\n"); - fprintf (stream, "\t(entry_pt *) %d,\n", constructors.number + frames); - write_list (stream, "\t", constructors.first); - if (frames) - fprintf (stream, "\treg_frame,\n"); - fprintf (stream, "\t0\n};\n\n"); - - write_list_with_asm (stream, "extern entry_pt ", destructors.first); - - fprintf (stream, "\nentry_pt * __DTOR_LIST__[] = {\n"); - fprintf (stream, "\t(entry_pt *) %d,\n", destructors.number + frames); - write_list (stream, "\t", destructors.first); - if (frames) - fprintf (stream, "\tdereg_frame,\n"); - fprintf (stream, "\t0\n};\n\n"); - - fprintf (stream, "extern entry_pt %s;\n", NAME__MAIN); - fprintf (stream, "entry_pt *__main_reference = %s;\n\n", NAME__MAIN); -} -#endif /* ! LD_INIT_SWITCH */ - -static void -write_c_file (stream, name) - FILE *stream; - char *name; -{ - fprintf (stream, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n"); -#ifndef LD_INIT_SWITCH - if (! shared_obj) - write_c_file_glob (stream, name); - else -#endif - write_c_file_stat (stream, name); - fprintf (stream, "#ifdef __cplusplus\n}\n#endif\n"); -} - -#ifdef COLLECT_EXPORT_LIST -static void -write_export_file (stream) - FILE *stream; -{ - struct id *list = exports.first; - for (; list; list = list->next) - fprintf (stream, "%s\n", list->name); -} - -static void -write_import_file (stream) - FILE *stream; -{ - struct id *list = imports.first; - fprintf (stream, "%s\n", "#! ."); - for (; list; list = list->next) - fprintf (stream, "%s\n", list->name); -} -#endif - -#ifdef OBJECT_FORMAT_NONE - -/* Generic version to scan the name list of the loaded program for - the symbols g++ uses for static constructors and destructors. - - The constructor table begins at __CTOR_LIST__ and contains a count - of the number of pointers (or -1 if the constructors are built in a - separate section by the linker), followed by the pointers to the - constructor functions, terminated with a null pointer. The - destructor table has the same format, and begins at __DTOR_LIST__. */ - -static void -scan_prog_file (prog_name, which_pass) - char *prog_name; - enum pass which_pass; -{ - void (*int_handler) (); - void (*quit_handler) (); - char *nm_argv[4]; - int pid; - int argc = 0; - int pipe_fd[2]; - char *p, buf[1024]; - FILE *inf; - - if (which_pass == PASS_SECOND) - return; - - /* If we do not have an `nm', complain. */ - if (nm_file_name == 0) - fatal ("cannot find `nm'"); - - nm_argv[argc++] = nm_file_name; - if (NM_FLAGS[0] != '\0') - nm_argv[argc++] = NM_FLAGS; - - nm_argv[argc++] = prog_name; - nm_argv[argc++] = (char *) 0; - - if (pipe (pipe_fd) < 0) - fatal_perror ("pipe"); - - inf = fdopen (pipe_fd[0], "r"); - if (inf == (FILE *) 0) - fatal_perror ("fdopen"); - - /* Trace if needed. */ - if (vflag) - { - char **p_argv; - char *str; - - for (p_argv = &nm_argv[0]; (str = *p_argv) != (char *) 0; p_argv++) - fprintf (stderr, " %s", str); - - fprintf (stderr, "\n"); - } - - fflush (stdout); - fflush (stderr); - - /* Spawn child nm on pipe */ - pid = vfork (); - if (pid == -1) - fatal_perror (VFORK_STRING); - - if (pid == 0) /* child context */ - { - /* setup stdout */ - if (dup2 (pipe_fd[1], 1) < 0) - fatal_perror ("dup2 %d 1", pipe_fd[1]); - - if (close (pipe_fd[0]) < 0) - fatal_perror ("close %d", pipe_fd[0]); - - if (close (pipe_fd[1]) < 0) - fatal_perror ("close %d", pipe_fd[1]); - - execv (nm_file_name, nm_argv); - fatal_perror ("execvp %s", nm_file_name); - } - - /* Parent context from here on. */ - int_handler = (void (*) ())signal (SIGINT, SIG_IGN); -#ifdef SIGQUIT - quit_handler = (void (*) ())signal (SIGQUIT, SIG_IGN); -#endif - - if (close (pipe_fd[1]) < 0) - fatal_perror ("close %d", pipe_fd[1]); - - if (debug) - fprintf (stderr, "\nnm output with constructors/destructors.\n"); - - /* Read each line of nm output. */ - while (fgets (buf, sizeof buf, inf) != (char *) 0) - { - int ch, ch2; - char *name, *end; - - /* If it contains a constructor or destructor name, add the name - to the appropriate list. */ - - for (p = buf; (ch = *p) != '\0' && ch != '\n' && ch != '_'; p++) - if (ch == ' ' && p[1] == 'U' && p[2] == ' ') - break; - - if (ch != '_') - continue; - - name = p; - /* Find the end of the symbol name. - Do not include `|', because Encore nm can tack that on the end. */ - for (end = p; (ch2 = *end) != '\0' && !ISSPACE (ch2) && ch2 != '|'; - end++) - continue; - - - *end = '\0'; - switch (is_ctor_dtor (name)) - { - case 1: - if (which_pass != PASS_LIB) - add_to_list (&constructors, name); - break; - - case 2: - if (which_pass != PASS_LIB) - add_to_list (&destructors, name); - break; - - case 3: - if (which_pass != PASS_LIB) - fatal ("init function found in object %s", prog_name); -#ifndef LD_INIT_SWITCH - add_to_list (&constructors, name); -#endif - break; - - case 4: - if (which_pass != PASS_LIB) - fatal ("fini function found in object %s", prog_name); -#ifndef LD_FINI_SWITCH - add_to_list (&destructors, name); -#endif - break; - - case 5: - if (which_pass != PASS_LIB) - add_to_list (&frame_tables, name); - break; - - default: /* not a constructor or destructor */ - continue; - } - - if (debug) - fprintf (stderr, "\t%s\n", buf); - } - - if (debug) - fprintf (stderr, "\n"); - - if (fclose (inf) != 0) - fatal_perror ("fclose"); - - do_wait (nm_file_name); - - signal (SIGINT, int_handler); -#ifdef SIGQUIT - signal (SIGQUIT, quit_handler); -#endif -} - -#if SUNOS4_SHARED_LIBRARIES - -/* Routines to scan the SunOS 4 _DYNAMIC structure to find shared libraries - that the output file depends upon and their initialization/finalization - routines, if any. */ - -#include -#include -#include -#include -#include -#include -#include - -/* pointers to the object file */ -unsigned object; /* address of memory mapped file */ -unsigned objsize; /* size of memory mapped to file */ -char * code; /* pointer to code segment */ -char * data; /* pointer to data segment */ -struct nlist *symtab; /* pointer to symbol table */ -struct link_dynamic *ld; -struct link_dynamic_2 *ld_2; -struct head libraries; - -/* Map the file indicated by NAME into memory and store its address. */ - -static void -mapfile (name) - char *name; -{ - int fp; - struct stat s; - if ((fp = open (name, O_RDONLY)) == -1) - fatal ("unable to open file '%s'", name); - if (fstat (fp, &s) == -1) - fatal ("unable to stat file '%s'", name); - - objsize = s.st_size; - object = (unsigned) mmap (0, objsize, PROT_READ|PROT_WRITE, MAP_PRIVATE, - fp, 0); - if (object == -1) - fatal ("unable to mmap file '%s'", name); - - close (fp); -} - -/* Helpers for locatelib. */ - -static char *libname; - -static int -libselect (d) - struct direct *d; -{ - return (strncmp (libname, d->d_name, strlen (libname)) == 0); -} - -/* If one file has an additional numeric extension past LIBNAME, then put - that one first in the sort. If both files have additional numeric - extensions, then put the one with the higher number first in the sort. - - We must verify that the extension is numeric, because Sun saves the - original versions of patched libraries with a .FCS extension. Files with - invalid extensions must go last in the sort, so that they will not be used. */ - -static int -libcompare (d1, d2) - struct direct **d1, **d2; -{ - int i1, i2 = strlen (libname); - char *e1 = (*d1)->d_name + i2; - char *e2 = (*d2)->d_name + i2; - - while (*e1 && *e2 && *e1 == '.' && *e2 == '.' - && e1[1] && ISDIGIT (e1[1]) && e2[1] && ISDIGIT (e2[1])) - { - ++e1; - ++e2; - i1 = strtol (e1, &e1, 10); - i2 = strtol (e2, &e2, 10); - if (i1 != i2) - return i1 - i2; - } - - if (*e1) - { - /* It has a valid numeric extension, prefer this one. */ - if (*e1 == '.' && e1[1] && ISDIGIT (e1[1])) - return 1; - /* It has a invalid numeric extension, must prefer the other one. */ - else - return -1; - } - else if (*e2) - { - /* It has a valid numeric extension, prefer this one. */ - if (*e2 == '.' && e2[1] && ISDIGIT (e2[1])) - return -1; - /* It has a invalid numeric extension, must prefer the other one. */ - else - return 1; - } - else - return 0; -} - -/* Given the name NAME of a dynamic dependency, find its pathname and add - it to the list of libraries. */ - -static void -locatelib (name) - char *name; -{ - static char **l; - static int cnt; - char buf[MAXPATHLEN]; - char *p, *q; - char **pp; - - if (l == 0) - { - char *ld_rules; - char *ldr = 0; - /* counting elements in array, need 1 extra for null */ - cnt = 1; - ld_rules = (char *) (ld_2->ld_rules + code); - if (ld_rules) - { - cnt++; - for (; *ld_rules != 0; ld_rules++) - if (*ld_rules == ':') - cnt++; - ld_rules = (char *) (ld_2->ld_rules + code); - ldr = (char *) malloc (strlen (ld_rules) + 1); - strcpy (ldr, ld_rules); - } - p = getenv ("LD_LIBRARY_PATH"); - q = 0; - if (p) - { - cnt++; - for (q = p ; *q != 0; q++) - if (*q == ':') - cnt++; - q = (char *) malloc (strlen (p) + 1); - strcpy (q, p); - } - l = (char **) malloc ((cnt + 3) * sizeof (char *)); - pp = l; - if (ldr) - { - *pp++ = ldr; - for (; *ldr != 0; ldr++) - if (*ldr == ':') - { - *ldr++ = 0; - *pp++ = ldr; - } - } - if (q) - { - *pp++ = q; - for (; *q != 0; q++) - if (*q == ':') - { - *q++ = 0; - *pp++ = q; - } - } - /* built in directories are /lib, /usr/lib, and /usr/local/lib */ - *pp++ = "/lib"; - *pp++ = "/usr/lib"; - *pp++ = "/usr/local/lib"; - *pp = 0; - } - libname = name; - for (pp = l; *pp != 0 ; pp++) - { - struct direct **namelist; - int entries; - if ((entries = scandir (*pp, &namelist, libselect, libcompare)) > 0) - { - sprintf (buf, "%s/%s", *pp, namelist[entries - 1]->d_name); - add_to_list (&libraries, buf); - if (debug) - fprintf (stderr, "%s\n", buf); - break; - } - } - if (*pp == 0) - { - if (debug) - notice ("not found\n"); - else - fatal ("dynamic dependency %s not found", name); - } -} - -/* Scan the _DYNAMIC structure of the output file to find shared libraries - that it depends upon and any constructors or destructors they contain. */ - -static void -scan_libraries (prog_name) - char *prog_name; -{ - struct exec *header; - char *base; - struct link_object *lo; - char buff[MAXPATHLEN]; - struct id *list; - - mapfile (prog_name); - header = (struct exec *)object; - if (N_BADMAG (*header)) - fatal ("bad magic number in file '%s'", prog_name); - if (header->a_dynamic == 0) - return; - - code = (char *) (N_TXTOFF (*header) + (long) header); - data = (char *) (N_DATOFF (*header) + (long) header); - symtab = (struct nlist *) (N_SYMOFF (*header) + (long) header); - - if (header->a_magic == ZMAGIC && header->a_entry == 0x20) - { - /* shared object */ - ld = (struct link_dynamic *) (symtab->n_value + code); - base = code; - } - else - { - /* executable */ - ld = (struct link_dynamic *) data; - base = code-PAGSIZ; - } - - if (debug) - notice ("dynamic dependencies.\n"); - - ld_2 = (struct link_dynamic_2 *) ((long) ld->ld_un.ld_2 + (long)base); - for (lo = (struct link_object *) ld_2->ld_need; lo; - lo = (struct link_object *) lo->lo_next) - { - char *name; - lo = (struct link_object *) ((long) lo + code); - name = (char *) (code + lo->lo_name); - if (lo->lo_library) - { - if (debug) - fprintf (stderr, "\t-l%s.%d => ", name, lo->lo_major); - sprintf (buff, "lib%s.so.%d.%d", name, lo->lo_major, lo->lo_minor); - locatelib (buff); - } - else - { - if (debug) - fprintf (stderr, "\t%s\n", name); - add_to_list (&libraries, name); - } - } - - if (debug) - fprintf (stderr, "\n"); - - /* now iterate through the library list adding their symbols to - the list. */ - for (list = libraries.first; list; list = list->next) - scan_prog_file (list->name, PASS_LIB); -} - -#else /* SUNOS4_SHARED_LIBRARIES */ -#ifdef LDD_SUFFIX - -/* Use the List Dynamic Dependencies program to find shared libraries that - the output file depends upon and their initialization/finalization - routines, if any. */ - -static void -scan_libraries (prog_name) - char *prog_name; -{ - static struct head libraries; /* list of shared libraries found */ - struct id *list; - void (*int_handler) (); - void (*quit_handler) (); - char *ldd_argv[4]; - int pid; - int argc = 0; - int pipe_fd[2]; - char buf[1024]; - FILE *inf; - - /* If we do not have an `ldd', complain. */ - if (ldd_file_name == 0) - { - error ("cannot find `ldd'"); - return; - } - - ldd_argv[argc++] = ldd_file_name; - ldd_argv[argc++] = prog_name; - ldd_argv[argc++] = (char *) 0; - - if (pipe (pipe_fd) < 0) - fatal_perror ("pipe"); - - inf = fdopen (pipe_fd[0], "r"); - if (inf == (FILE *) 0) - fatal_perror ("fdopen"); - - /* Trace if needed. */ - if (vflag) - { - char **p_argv; - char *str; - - for (p_argv = &ldd_argv[0]; (str = *p_argv) != (char *) 0; p_argv++) - fprintf (stderr, " %s", str); - - fprintf (stderr, "\n"); - } - - fflush (stdout); - fflush (stderr); - - /* Spawn child ldd on pipe */ - pid = vfork (); - if (pid == -1) - fatal_perror (VFORK_STRING); - - if (pid == 0) /* child context */ - { - /* setup stdout */ - if (dup2 (pipe_fd[1], 1) < 0) - fatal_perror ("dup2 %d 1", pipe_fd[1]); - - if (close (pipe_fd[0]) < 0) - fatal_perror ("close %d", pipe_fd[0]); - - if (close (pipe_fd[1]) < 0) - fatal_perror ("close %d", pipe_fd[1]); - - execv (ldd_file_name, ldd_argv); - fatal_perror ("execv %s", ldd_file_name); - } - - /* Parent context from here on. */ - int_handler = (void (*) ()) signal (SIGINT, SIG_IGN); -#ifdef SIGQUIT - quit_handler = (void (*) ()) signal (SIGQUIT, SIG_IGN); -#endif - - if (close (pipe_fd[1]) < 0) - fatal_perror ("close %d", pipe_fd[1]); - - if (debug) - notice ("\nldd output with constructors/destructors.\n"); - - /* Read each line of ldd output. */ - while (fgets (buf, sizeof buf, inf) != (char *) 0) - { - int ch, ch2; - char *name, *end, *p = buf; - - /* Extract names of libraries and add to list. */ - PARSE_LDD_OUTPUT (p); - if (p == 0) - continue; - - name = p; - if (strncmp (name, "not found", sizeof ("not found") - 1) == 0) - fatal ("dynamic dependency %s not found", buf); - - /* Find the end of the symbol name. */ - for (end = p; - (ch2 = *end) != '\0' && ch2 != '\n' && !ISSPACE (ch2) && ch2 != '|'; - end++) - continue; - *end = '\0'; - - if (access (name, R_OK) == 0) - add_to_list (&libraries, name); - else - fatal ("unable to open dynamic dependency '%s'", buf); - - if (debug) - fprintf (stderr, "\t%s\n", buf); - } - if (debug) - fprintf (stderr, "\n"); - - if (fclose (inf) != 0) - fatal_perror ("fclose"); - - do_wait (ldd_file_name); - - signal (SIGINT, int_handler); -#ifdef SIGQUIT - signal (SIGQUIT, quit_handler); -#endif - - /* now iterate through the library list adding their symbols to - the list. */ - for (list = libraries.first; list; list = list->next) - scan_prog_file (list->name, PASS_LIB); -} - -#endif /* LDD_SUFFIX */ -#endif /* SUNOS4_SHARED_LIBRARIES */ - -#endif /* OBJECT_FORMAT_NONE */ - - -/* - * COFF specific stuff. - */ - -#ifdef OBJECT_FORMAT_COFF - -#if defined(EXTENDED_COFF) -# define GCC_SYMBOLS(X) (SYMHEADER(X).isymMax + SYMHEADER(X).iextMax) -# define GCC_SYMENT SYMR -# define GCC_OK_SYMBOL(X) ((X).st == stProc || (X).st == stGlobal) -# define GCC_SYMINC(X) (1) -# define GCC_SYMZERO(X) (SYMHEADER(X).isymMax) -# define GCC_CHECK_HDR(X) (PSYMTAB(X) != 0) -#else -# define GCC_SYMBOLS(X) (HEADER(ldptr).f_nsyms) -# define GCC_SYMENT SYMENT -# define GCC_OK_SYMBOL(X) \ - (((X).n_sclass == C_EXT) && \ - ((X).n_scnum > N_UNDEF) && \ - (((X).n_type & N_TMASK) == (DT_NON << N_BTSHFT) || \ - ((X).n_type & N_TMASK) == (DT_FCN << N_BTSHFT))) -# define GCC_UNDEF_SYMBOL(X) \ - (((X).n_sclass == C_EXT) && ((X).n_scnum == N_UNDEF)) -# define GCC_SYMINC(X) ((X).n_numaux+1) -# define GCC_SYMZERO(X) 0 -# define GCC_CHECK_HDR(X) \ - ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \ - || (HEADER (X).f_magic == 0757 && aix64_flag)) -#endif - -extern char *ldgetname (); - -/* COFF version to scan the name list of the loaded program for - the symbols g++ uses for static constructors and destructors. - - The constructor table begins at __CTOR_LIST__ and contains a count - of the number of pointers (or -1 if the constructors are built in a - separate section by the linker), followed by the pointers to the - constructor functions, terminated with a null pointer. The - destructor table has the same format, and begins at __DTOR_LIST__. */ - -static void -scan_prog_file (prog_name, which_pass) - char *prog_name; - enum pass which_pass; -{ - LDFILE *ldptr = NULL; - int sym_index, sym_count; - int is_shared = 0; -#ifdef COLLECT_EXPORT_LIST - /* Should we generate an import list for given prog_name? */ - int import_flag = (which_pass == PASS_OBJ ? 0 : use_import_list (prog_name)); -#endif - - if (which_pass != PASS_FIRST && which_pass != PASS_OBJ) - return; - -#ifdef COLLECT_EXPORT_LIST - /* We do not need scanning for some standard C libraries. */ - if (which_pass == PASS_FIRST && ignore_library (prog_name)) - return; - - /* On AIX we have a loop, because there is not much difference - between an object and an archive. This trick allows us to - eliminate scan_libraries() function. */ - do - { -#endif - if ((ldptr = ldopen (prog_name, ldptr)) != NULL) - { - if (! MY_ISCOFF (HEADER (ldptr).f_magic)) - fatal ("%s: not a COFF file", prog_name); - - if (GCC_CHECK_HDR (ldptr)) - { - sym_count = GCC_SYMBOLS (ldptr); - sym_index = GCC_SYMZERO (ldptr); - -#ifdef COLLECT_EXPORT_LIST - /* Is current archive member a shared object? */ - is_shared = HEADER (ldptr).f_flags & F_SHROBJ; -#endif - - while (sym_index < sym_count) - { - GCC_SYMENT symbol; - - if (ldtbread (ldptr, sym_index, &symbol) <= 0) - break; - sym_index += GCC_SYMINC (symbol); - - if (GCC_OK_SYMBOL (symbol)) - { - char *name; - - if ((name = ldgetname (ldptr, &symbol)) == NULL) - continue; /* should never happen */ - -#ifdef XCOFF_DEBUGGING_INFO - /* All AIX function names have a duplicate entry - beginning with a dot. */ - if (*name == '.') - ++name; -#endif - - switch (is_ctor_dtor (name)) - { - case 1: - if (! is_shared) add_to_list (&constructors, name); -#ifdef COLLECT_EXPORT_LIST - if (which_pass == PASS_OBJ) - add_to_list (&exports, name); - /* If this symbol was undefined and we are building - an import list, we should add a symbol to this - list. */ - else - if (import_flag - && is_in_list (name, undefined.first)) - add_to_list (&imports, name); -#endif - break; - - case 2: - if (! is_shared) add_to_list (&destructors, name); -#ifdef COLLECT_EXPORT_LIST - if (which_pass == PASS_OBJ) - add_to_list (&exports, name); - /* If this symbol was undefined and we are building - an import list, we should add a symbol to this - list. */ - else - if (import_flag - && is_in_list (name, undefined.first)) - add_to_list (&imports, name); -#endif - break; - -#ifdef COLLECT_EXPORT_LIST - case 3: - if (is_shared) - add_to_list (&constructors, name); - break; - - case 4: - if (is_shared) - add_to_list (&destructors, name); - break; -#endif - - case 5: - if (! is_shared) - add_to_list (&frame_tables, name); - break; - - default: /* not a constructor or destructor */ -#ifdef COLLECT_EXPORT_LIST - /* If we are building a shared object on AIX we need - to explicitly export all global symbols or add - them to import list. */ - if (shared_obj) - { - if (which_pass == PASS_OBJ && (! export_flag)) - add_to_list (&exports, name); - else if (! is_shared && which_pass == PASS_FIRST - && import_flag - && is_in_list(name, undefined.first)) - add_to_list (&imports, name); - } -#endif - continue; - } - -#if !defined(EXTENDED_COFF) - if (debug) - fprintf (stderr, "\tsec=%d class=%d type=%s%o %s\n", - symbol.n_scnum, symbol.n_sclass, - (symbol.n_type ? "0" : ""), symbol.n_type, - name); -#else - if (debug) - fprintf (stderr, - "\tiss = %5d, value = %5ld, index = %5d, name = %s\n", - symbol.iss, (long) symbol.value, symbol.index, name); -#endif - } -#ifdef COLLECT_EXPORT_LIST - /* If we are building a shared object we should collect - information about undefined symbols for later - import list generation. */ - else if (shared_obj && GCC_UNDEF_SYMBOL (symbol)) - { - char *name; - - if ((name = ldgetname (ldptr, &symbol)) == NULL) - continue; /* should never happen */ - - /* All AIX function names have a duplicate entry - beginning with a dot. */ - if (*name == '.') - ++name; - add_to_list (&undefined, name); - } -#endif - } - } -#ifdef COLLECT_EXPORT_LIST - else - { - /* If archive contains both 32-bit and 64-bit objects, - we want to skip objects in other mode so mismatch normal. */ - if (debug) - fprintf (stderr, "%s : magic=%o aix64=%d mismatch\n", - prog_name, HEADER (ldptr).f_magic, aix64_flag); - } -#endif - } - else - { - fatal ("%s: cannot open as COFF file", prog_name); - } -#ifdef COLLECT_EXPORT_LIST - /* On AIX loop continues while there are more members in archive. */ - } - while (ldclose (ldptr) == FAILURE); -#else - /* Otherwise we simply close ldptr. */ - (void) ldclose(ldptr); -#endif -} - - -#ifdef COLLECT_EXPORT_LIST - -/* This new function is used to decide whether we should - generate import list for an object or to use it directly. */ -static int -use_import_list (prog_name) - char *prog_name; -{ - char *p; - - /* If we do not build a shared object then import list should not be used. */ - if (! shared_obj) return 0; - - /* Currently we check only for libgcc, but this can be changed in future. */ - p = strstr (prog_name, "libgcc.a"); - if (p != 0 && (strlen (p) == sizeof ("libgcc.a") - 1)) - return 1; - return 0; -} - -/* Given a library name without "lib" prefix, this function - returns a full library name including a path. */ -static char * -resolve_lib_name (name) - char *name; -{ - char *lib_buf; - int i, j, l = 0; - - for (i = 0; libpaths[i]; i++) - if (libpaths[i]->max_len > l) - l = libpaths[i]->max_len; - - lib_buf = xmalloc (l + strlen(name) + 10); - - for (i = 0; libpaths[i]; i++) - { - struct prefix_list *list = libpaths[i]->plist; - for (; list; list = list->next) - { - for (j = 0; libexts[j]; j++) - { - /* The following lines are needed because path_prefix list - may contain directories both with trailing '/' and - without it. */ - char *p = ""; - if (list->prefix[strlen(list->prefix)-1] != '/') - p = "/"; - sprintf (lib_buf, "%s%slib%s.%s", - list->prefix, p, name, libexts[j]); -if (debug) fprintf (stderr, "searching for: %s\n", lib_buf); - if (file_exists (lib_buf)) - { -if (debug) fprintf (stderr, "found: %s\n", lib_buf); - return (lib_buf); - } - } - } - } - if (debug) - fprintf (stderr, "not found\n"); - else - fatal ("Library lib%s not found", name); - return (NULL); -} - -/* Array of standard AIX libraries which should not - be scanned for ctors/dtors. */ -static char* aix_std_libs[] = { - "/unix", - "/lib/libc.a", - "/lib/libc_r.a", - "/usr/lib/libc.a", - "/usr/lib/libc_r.a", - "/usr/lib/threads/libc.a", - "/usr/ccs/lib/libc.a", - "/usr/ccs/lib/libc_r.a", - NULL -}; - -/* This function checks the filename and returns 1 - if this name matches the location of a standard AIX library. */ -static int -ignore_library (name) - char *name; -{ - char **p = &aix_std_libs[0]; - while (*p++ != NULL) - if (! strcmp (name, *p)) return 1; - return 0; -} - -#endif - -#endif /* OBJECT_FORMAT_COFF */ - - -/* - * OSF/rose specific stuff. - */ - -#ifdef OBJECT_FORMAT_ROSE - -/* Union of the various load commands */ - -typedef union load_union -{ - ldc_header_t hdr; /* common header */ - load_cmd_map_command_t map; /* map indexing other load cmds */ - interpreter_command_t iprtr; /* interpreter pathname */ - strings_command_t str; /* load commands strings section */ - region_command_t region; /* region load command */ - reloc_command_t reloc; /* relocation section */ - package_command_t pkg; /* package load command */ - symbols_command_t sym; /* symbol sections */ - entry_command_t ent; /* program start section */ - gen_info_command_t info; /* object information */ - func_table_command_t func; /* function constructors/destructors */ -} load_union_t; - -/* Structure to point to load command and data section in memory. */ - -typedef struct load_all -{ - load_union_t *load; /* load command */ - char *section; /* pointer to section */ -} load_all_t; - -/* Structure to contain information about a file mapped into memory. */ - -struct file_info -{ - char *start; /* start of map */ - char *name; /* filename */ - long size; /* size of the file */ - long rounded_size; /* size rounded to page boundary */ - int fd; /* file descriptor */ - int rw; /* != 0 if opened read/write */ - int use_mmap; /* != 0 if mmap'ed */ -}; - -extern int decode_mach_o_hdr (); -extern int encode_mach_o_hdr (); - -static void add_func_table PROTO((mo_header_t *, load_all_t *, - symbol_info_t *, int)); -static void print_header PROTO((mo_header_t *)); -static void print_load_command PROTO((load_union_t *, size_t, int)); -static void bad_header PROTO((int)); -static struct file_info *read_file PROTO((char *, int, int)); -static void end_file PROTO((struct file_info *)); - -/* OSF/rose specific version to scan the name list of the loaded - program for the symbols g++ uses for static constructors and - destructors. - - The constructor table begins at __CTOR_LIST__ and contains a count - of the number of pointers (or -1 if the constructors are built in a - separate section by the linker), followed by the pointers to the - constructor functions, terminated with a null pointer. The - destructor table has the same format, and begins at __DTOR_LIST__. */ - -static void -scan_prog_file (prog_name, which_pass) - char *prog_name; - enum pass which_pass; -{ - char *obj; - mo_header_t hdr; - load_all_t *load_array; - load_all_t *load_end; - load_all_t *load_cmd; - int symbol_load_cmds; - off_t offset; - int i; - int num_syms; - int status; - char *str_sect; - struct file_info *obj_file; - int prog_fd; - mo_lcid_t cmd_strings = -1; - symbol_info_t *main_sym = 0; - int rw = (which_pass != PASS_FIRST); - - prog_fd = open (prog_name, (rw) ? O_RDWR : O_RDONLY); - if (prog_fd < 0) - fatal_perror ("open %s", prog_name); - - obj_file = read_file (prog_name, prog_fd, rw); - obj = obj_file->start; - - status = decode_mach_o_hdr (obj, MO_SIZEOF_RAW_HDR, MOH_HEADER_VERSION, &hdr); - if (status != MO_HDR_CONV_SUCCESS) - bad_header (status); - - - /* Do some basic sanity checks. Note we explicitly use the big endian magic number, - since the hardware will automatically swap bytes for us on loading little endian - integers. */ - -#ifndef CROSS_COMPILE - if (hdr.moh_magic != MOH_MAGIC_MSB - || hdr.moh_header_version != MOH_HEADER_VERSION - || hdr.moh_byte_order != OUR_BYTE_ORDER - || hdr.moh_data_rep_id != OUR_DATA_REP_ID - || hdr.moh_cpu_type != OUR_CPU_TYPE - || hdr.moh_cpu_subtype != OUR_CPU_SUBTYPE - || hdr.moh_vendor_type != OUR_VENDOR_TYPE) - { - fatal ("incompatibilities between object file & expected values"); - } -#endif - - if (debug) - print_header (&hdr); - - offset = hdr.moh_first_cmd_off; - load_end = load_array - = (load_all_t *) xcalloc (sizeof (load_all_t), hdr.moh_n_load_cmds + 2); - - /* Build array of load commands, calculating the offsets */ - for (i = 0; i < hdr.moh_n_load_cmds; i++) - { - load_union_t *load_hdr; /* load command header */ - - load_cmd = load_end++; - load_hdr = (load_union_t *) (obj + offset); - - /* If modifying the program file, copy the header. */ - if (rw) - { - load_union_t *ptr = (load_union_t *) xmalloc (load_hdr->hdr.ldci_cmd_size); - bcopy ((char *)load_hdr, (char *)ptr, load_hdr->hdr.ldci_cmd_size); - load_hdr = ptr; - - /* null out old command map, because we will rewrite at the end. */ - if (ptr->hdr.ldci_cmd_type == LDC_CMD_MAP) - { - cmd_strings = ptr->map.lcm_ld_cmd_strings; - ptr->hdr.ldci_cmd_type = LDC_UNDEFINED; - } - } - - load_cmd->load = load_hdr; - if (load_hdr->hdr.ldci_section_off > 0) - load_cmd->section = obj + load_hdr->hdr.ldci_section_off; - - if (debug) - print_load_command (load_hdr, offset, i); - - offset += load_hdr->hdr.ldci_cmd_size; - } - - /* If the last command is the load command map and is not undefined, - decrement the count of load commands. */ - if (rw && load_end[-1].load->hdr.ldci_cmd_type == LDC_UNDEFINED) - { - load_end--; - hdr.moh_n_load_cmds--; - } - - /* Go through and process each symbol table section. */ - symbol_load_cmds = 0; - for (load_cmd = load_array; load_cmd < load_end; load_cmd++) - { - load_union_t *load_hdr = load_cmd->load; - - if (load_hdr->hdr.ldci_cmd_type == LDC_SYMBOLS) - { - symbol_load_cmds++; - - if (debug) - { - char *kind = "unknown"; - - switch (load_hdr->sym.symc_kind) - { - case SYMC_IMPORTS: kind = "imports"; break; - case SYMC_DEFINED_SYMBOLS: kind = "defined"; break; - case SYMC_STABS: kind = "stabs"; break; - } - - notice ("\nProcessing symbol table #%d, offset = 0x%.8lx, kind = %s\n", - symbol_load_cmds, load_hdr->hdr.ldci_section_off, kind); - } - - if (load_hdr->sym.symc_kind != SYMC_DEFINED_SYMBOLS) - continue; - - str_sect = load_array[load_hdr->sym.symc_strings_section].section; - if (str_sect == (char *) 0) - fatal ("string section missing"); - - if (load_cmd->section == (char *) 0) - fatal ("section pointer missing"); - - num_syms = load_hdr->sym.symc_nentries; - for (i = 0; i < num_syms; i++) - { - symbol_info_t *sym = ((symbol_info_t *) load_cmd->section) + i; - char *name = sym->si_name.symbol_name + str_sect; - - if (name[0] != '_') - continue; - - if (rw) - { - char *n = name + strlen (name) - strlen (NAME__MAIN); - - if ((n - name) < 0 || strcmp (n, NAME__MAIN)) - continue; - while (n != name) - if (*--n != '_') - continue; - - main_sym = sym; - } - else - { - switch (is_ctor_dtor (name)) - { - case 1: - add_to_list (&constructors, name); - break; - - case 2: - add_to_list (&destructors, name); - break; - - default: /* not a constructor or destructor */ - continue; - } - } - - if (debug) - fprintf (stderr, "\ttype = 0x%.4x, sc = 0x%.2x, flags = 0x%.8x, name = %.30s\n", - sym->si_type, sym->si_sc_type, sym->si_flags, name); - } - } - } - - if (symbol_load_cmds == 0) - fatal ("no symbol table found"); - - /* Update the program file now, rewrite header and load commands. At present, - we assume that there is enough space after the last load command to insert - one more. Since the first section written out is page aligned, and the - number of load commands is small, this is ok for the present. */ - - if (rw) - { - load_union_t *load_map; - size_t size; - - if (cmd_strings == -1) - fatal ("no cmd_strings found"); - - /* Add __main to initializer list. - If we are building a program instead of a shared library, do not - do anything, since in the current version, you cannot do mallocs - and such in the constructors. */ - - if (main_sym != (symbol_info_t *) 0 - && ((hdr.moh_flags & MOH_EXECABLE_F) == 0)) - add_func_table (&hdr, load_array, main_sym, FNTC_INITIALIZATION); - - if (debug) - notice ("\nUpdating header and load commands.\n\n"); - - hdr.moh_n_load_cmds++; - size = sizeof (load_cmd_map_command_t) + (sizeof (mo_offset_t) * (hdr.moh_n_load_cmds - 1)); - - /* Create new load command map. */ - if (debug) - notice ("load command map, %d cmds, new size %ld.\n", - (int) hdr.moh_n_load_cmds, (long) size); - - load_map = (load_union_t *) xcalloc (1, size); - load_map->map.ldc_header.ldci_cmd_type = LDC_CMD_MAP; - load_map->map.ldc_header.ldci_cmd_size = size; - load_map->map.lcm_ld_cmd_strings = cmd_strings; - load_map->map.lcm_nentries = hdr.moh_n_load_cmds; - load_array[hdr.moh_n_load_cmds-1].load = load_map; - - offset = hdr.moh_first_cmd_off; - for (i = 0; i < hdr.moh_n_load_cmds; i++) - { - load_map->map.lcm_map[i] = offset; - if (load_array[i].load->hdr.ldci_cmd_type == LDC_CMD_MAP) - hdr.moh_load_map_cmd_off = offset; - - offset += load_array[i].load->hdr.ldci_cmd_size; - } - - hdr.moh_sizeofcmds = offset - MO_SIZEOF_RAW_HDR; - - if (debug) - print_header (&hdr); - - /* Write header */ - status = encode_mach_o_hdr (&hdr, obj, MO_SIZEOF_RAW_HDR); - if (status != MO_HDR_CONV_SUCCESS) - bad_header (status); - - if (debug) - notice ("writing load commands.\n\n"); - - /* Write load commands */ - offset = hdr.moh_first_cmd_off; - for (i = 0; i < hdr.moh_n_load_cmds; i++) - { - load_union_t *load_hdr = load_array[i].load; - size_t size = load_hdr->hdr.ldci_cmd_size; - - if (debug) - print_load_command (load_hdr, offset, i); - - bcopy ((char *) load_hdr, (char *) (obj + offset), size); - offset += size; - } - } - - end_file (obj_file); - - if (close (prog_fd)) - fatal_perror ("close %s", prog_name); - - if (debug) - fprintf (stderr, "\n"); -} - - -/* Add a function table to the load commands to call a function - on initiation or termination of the process. */ - -static void -add_func_table (hdr_p, load_array, sym, type) - mo_header_t *hdr_p; /* pointer to global header */ - load_all_t *load_array; /* array of ptrs to load cmds */ - symbol_info_t *sym; /* pointer to symbol entry */ - int type; /* fntc_type value */ -{ - /* Add a new load command. */ - int num_cmds = ++hdr_p->moh_n_load_cmds; - int load_index = num_cmds - 1; - size_t size = sizeof (func_table_command_t) + sizeof (mo_addr_t); - load_union_t *ptr = xcalloc (1, size); - load_all_t *load_cmd; - int i; - - /* Set the unresolved address bit in the header to force the loader to be - used, since kernel exec does not call the initialization functions. */ - hdr_p->moh_flags |= MOH_UNRESOLVED_F; - - load_cmd = &load_array[load_index]; - load_cmd->load = ptr; - load_cmd->section = (char *) 0; - - /* Fill in func table load command. */ - ptr->func.ldc_header.ldci_cmd_type = LDC_FUNC_TABLE; - ptr->func.ldc_header.ldci_cmd_size = size; - ptr->func.ldc_header.ldci_section_off = 0; - ptr->func.ldc_header.ldci_section_len = 0; - ptr->func.fntc_type = type; - ptr->func.fntc_nentries = 1; - - /* copy address, turn it from abs. address to (region,offset) if necessary. */ - /* Is the symbol already expressed as (region, offset)? */ - if ((sym->si_flags & SI_ABSOLUTE_VALUE_F) == 0) - { - ptr->func.fntc_entry_loc[i].adr_lcid = sym->si_value.def_val.adr_lcid; - ptr->func.fntc_entry_loc[i].adr_sctoff = sym->si_value.def_val.adr_sctoff; - } - - /* If not, figure out which region it's in. */ - else - { - mo_vm_addr_t addr = sym->si_value.abs_val; - int found = 0; - - for (i = 0; i < load_index; i++) - { - if (load_array[i].load->hdr.ldci_cmd_type == LDC_REGION) - { - region_command_t *region_ptr = &load_array[i].load->region; - - if ((region_ptr->regc_flags & REG_ABS_ADDR_F) != 0 - && addr >= region_ptr->regc_addr.vm_addr - && addr <= region_ptr->regc_addr.vm_addr + region_ptr->regc_vm_size) - { - ptr->func.fntc_entry_loc[0].adr_lcid = i; - ptr->func.fntc_entry_loc[0].adr_sctoff = addr - region_ptr->regc_addr.vm_addr; - found++; - break; - } - } - } - - if (!found) - fatal ("could not convert 0x%l.8x into a region", addr); - } - - if (debug) - notice ("%s function, region %d, offset = %ld (0x%.8lx)\n", - type == FNTC_INITIALIZATION ? "init" : "term", - (int) ptr->func.fntc_entry_loc[i].adr_lcid, - (long) ptr->func.fntc_entry_loc[i].adr_sctoff, - (long) ptr->func.fntc_entry_loc[i].adr_sctoff); - -} - - -/* Print the global header for an OSF/rose object. */ - -static void -print_header (hdr_ptr) - mo_header_t *hdr_ptr; -{ - fprintf (stderr, "\nglobal header:\n"); - fprintf (stderr, "\tmoh_magic = 0x%.8lx\n", hdr_ptr->moh_magic); - fprintf (stderr, "\tmoh_major_version = %d\n", (int)hdr_ptr->moh_major_version); - fprintf (stderr, "\tmoh_minor_version = %d\n", (int)hdr_ptr->moh_minor_version); - fprintf (stderr, "\tmoh_header_version = %d\n", (int)hdr_ptr->moh_header_version); - fprintf (stderr, "\tmoh_max_page_size = %d\n", (int)hdr_ptr->moh_max_page_size); - fprintf (stderr, "\tmoh_byte_order = %d\n", (int)hdr_ptr->moh_byte_order); - fprintf (stderr, "\tmoh_data_rep_id = %d\n", (int)hdr_ptr->moh_data_rep_id); - fprintf (stderr, "\tmoh_cpu_type = %d\n", (int)hdr_ptr->moh_cpu_type); - fprintf (stderr, "\tmoh_cpu_subtype = %d\n", (int)hdr_ptr->moh_cpu_subtype); - fprintf (stderr, "\tmoh_vendor_type = %d\n", (int)hdr_ptr->moh_vendor_type); - fprintf (stderr, "\tmoh_load_map_cmd_off = %d\n", (int)hdr_ptr->moh_load_map_cmd_off); - fprintf (stderr, "\tmoh_first_cmd_off = %d\n", (int)hdr_ptr->moh_first_cmd_off); - fprintf (stderr, "\tmoh_sizeofcmds = %d\n", (int)hdr_ptr->moh_sizeofcmds); - fprintf (stderr, "\tmon_n_load_cmds = %d\n", (int)hdr_ptr->moh_n_load_cmds); - fprintf (stderr, "\tmoh_flags = 0x%.8lx", (long)hdr_ptr->moh_flags); - - if (hdr_ptr->moh_flags & MOH_RELOCATABLE_F) - fprintf (stderr, ", relocatable"); - - if (hdr_ptr->moh_flags & MOH_LINKABLE_F) - fprintf (stderr, ", linkable"); - - if (hdr_ptr->moh_flags & MOH_EXECABLE_F) - fprintf (stderr, ", execable"); - - if (hdr_ptr->moh_flags & MOH_EXECUTABLE_F) - fprintf (stderr, ", executable"); - - if (hdr_ptr->moh_flags & MOH_UNRESOLVED_F) - fprintf (stderr, ", unresolved"); - - fprintf (stderr, "\n\n"); - return; -} - - -/* Print a short summary of a load command. */ - -static void -print_load_command (load_hdr, offset, number) - load_union_t *load_hdr; - size_t offset; - int number; -{ - mo_long_t type = load_hdr->hdr.ldci_cmd_type; - char *type_str = (char *) 0; - - switch (type) - { - case LDC_UNDEFINED: type_str = "UNDEFINED"; break; - case LDC_CMD_MAP: type_str = "CMD_MAP"; break; - case LDC_INTERPRETER: type_str = "INTERPRETER"; break; - case LDC_STRINGS: type_str = "STRINGS"; break; - case LDC_REGION: type_str = "REGION"; break; - case LDC_RELOC: type_str = "RELOC"; break; - case LDC_PACKAGE: type_str = "PACKAGE"; break; - case LDC_SYMBOLS: type_str = "SYMBOLS"; break; - case LDC_ENTRY: type_str = "ENTRY"; break; - case LDC_FUNC_TABLE: type_str = "FUNC_TABLE"; break; - case LDC_GEN_INFO: type_str = "GEN_INFO"; break; - } - - fprintf (stderr, - "cmd %2d, sz: 0x%.2lx, coff: 0x%.3lx, doff: 0x%.6lx, dlen: 0x%.6lx", - number, - (long) load_hdr->hdr.ldci_cmd_size, - (long) offset, - (long) load_hdr->hdr.ldci_section_off, - (long) load_hdr->hdr.ldci_section_len); - - if (type_str == (char *) 0) - fprintf (stderr, ", ty: unknown (%ld)\n", (long) type); - - else if (type != LDC_REGION) - fprintf (stderr, ", ty: %s\n", type_str); - - else - { - char *region = ""; - switch (load_hdr->region.regc_usage_type) - { - case REG_TEXT_T: region = ", .text"; break; - case REG_DATA_T: region = ", .data"; break; - case REG_BSS_T: region = ", .bss"; break; - case REG_GLUE_T: region = ", .glue"; break; -#if defined (REG_RDATA_T) && defined (REG_SDATA_T) && defined (REG_SBSS_T) /*mips*/ - case REG_RDATA_T: region = ", .rdata"; break; - case REG_SDATA_T: region = ", .sdata"; break; - case REG_SBSS_T: region = ", .sbss"; break; -#endif - } - - fprintf (stderr, ", ty: %s, vaddr: 0x%.8lx, vlen: 0x%.6lx%s\n", - type_str, - (long) load_hdr->region.regc_vm_addr, - (long) load_hdr->region.regc_vm_size, - region); - } - - return; -} - - -/* Fatal error when {en,de}code_mach_o_header fails. */ - -static void -bad_header (status) - int status; -{ - switch (status) - { - case MO_ERROR_BAD_MAGIC: fatal ("bad magic number"); - case MO_ERROR_BAD_HDR_VERS: fatal ("bad header version"); - case MO_ERROR_BAD_RAW_HDR_VERS: fatal ("bad raw header version"); - case MO_ERROR_BUF2SML: fatal ("raw header buffer too small"); - case MO_ERROR_OLD_RAW_HDR_FILE: fatal ("old raw header file"); - case MO_ERROR_UNSUPPORTED_VERS: fatal ("unsupported version"); - default: - fatal ("unknown {de,en}code_mach_o_hdr return value %d", status); - } -} - - -/* Read a file into a memory buffer. */ - -static struct file_info * -read_file (name, fd, rw) - char *name; /* filename */ - int fd; /* file descriptor */ - int rw; /* read/write */ -{ - struct stat stat_pkt; - struct file_info *p = (struct file_info *) xcalloc (sizeof (struct file_info), 1); -#ifdef USE_MMAP - static int page_size; -#endif - - if (fstat (fd, &stat_pkt) < 0) - fatal_perror ("fstat %s", name); - - p->name = name; - p->size = stat_pkt.st_size; - p->rounded_size = stat_pkt.st_size; - p->fd = fd; - p->rw = rw; - -#ifdef USE_MMAP - if (debug) - fprintf (stderr, "mmap %s, %s\n", name, (rw) ? "read/write" : "read-only"); - - if (page_size == 0) - page_size = sysconf (_SC_PAGE_SIZE); - - p->rounded_size = ((p->size + page_size - 1) / page_size) * page_size; - p->start = mmap ((caddr_t) 0, - (rw) ? p->rounded_size : p->size, - (rw) ? (PROT_READ | PROT_WRITE) : PROT_READ, - MAP_FILE | MAP_VARIABLE | MAP_SHARED, - fd, - 0L); - - if (p->start != (char *) 0 && p->start != (char *) -1) - p->use_mmap = 1; - - else -#endif /* USE_MMAP */ - { - long len; - - if (debug) - fprintf (stderr, "read %s\n", name); - - p->use_mmap = 0; - p->start = xmalloc (p->size); - if (lseek (fd, 0L, SEEK_SET) < 0) - fatal_perror ("lseek %s 0", name); - - len = read (fd, p->start, p->size); - if (len < 0) - fatal_perror ("read %s", name); - - if (len != p->size) - fatal ("read %ld bytes, expected %ld, from %s", len, p->size, name); - } - - return p; -} - -/* Do anything necessary to write a file back from memory. */ - -static void -end_file (ptr) - struct file_info *ptr; /* file information block */ -{ -#ifdef USE_MMAP - if (ptr->use_mmap) - { - if (ptr->rw) - { - if (debug) - fprintf (stderr, "msync %s\n", ptr->name); - - if (msync (ptr->start, ptr->rounded_size, MS_ASYNC)) - fatal_perror ("msync %s", ptr->name); - } - - if (debug) - fprintf (stderr, "munmap %s\n", ptr->name); - - if (munmap (ptr->start, ptr->size)) - fatal_perror ("munmap %s", ptr->name); - } - else -#endif /* USE_MMAP */ - { - if (ptr->rw) - { - long len; - - if (debug) - fprintf (stderr, "write %s\n", ptr->name); - - if (lseek (ptr->fd, 0L, SEEK_SET) < 0) - fatal_perror ("lseek %s 0", ptr->name); - - len = write (ptr->fd, ptr->start, ptr->size); - if (len < 0) - fatal_perror ("write %s", ptr->name); - - if (len != ptr->size) - fatal ("wrote %ld bytes, expected %ld, to %s", len, ptr->size, ptr->name); - } - - free (ptr->start); - } - - free (ptr); -} - -#endif /* OBJECT_FORMAT_ROSE */ diff --git a/contrib/gcc/collect2.h b/contrib/gcc/collect2.h deleted file mode 100644 index 04844bcd3626..000000000000 --- a/contrib/gcc/collect2.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Header file for collect/tlink routines. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef __COLLECT2_H__ -#define __COLLECT2_H__ - -extern void do_tlink PARAMS ((char **, char **)); - -extern void collect_execute PARAMS ((char *, char **, char *)); - -extern void collect_exit PARAMS ((int)) ATTRIBUTE_NORETURN; - -extern int collect_wait PARAMS ((char *)); - -extern void dump_file PARAMS ((char *)); - -extern int file_exists PARAMS ((char *)); - -#endif /* ! __COLLECT2_H__ */ diff --git a/contrib/gcc/combine.c b/contrib/gcc/combine.c deleted file mode 100644 index 57b2e8619bc6..000000000000 --- a/contrib/gcc/combine.c +++ /dev/null @@ -1,11991 +0,0 @@ -/* Optimize by combining instructions for GNU compiler. - Copyright (C) 1987, 88, 92-98, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* This module is essentially the "combiner" phase of the U. of Arizona - Portable Optimizer, but redone to work on our list-structured - representation for RTL instead of their string representation. - - The LOG_LINKS of each insn identify the most recent assignment - to each REG used in the insn. It is a list of previous insns, - each of which contains a SET for a REG that is used in this insn - and not used or set in between. LOG_LINKs never cross basic blocks. - They were set up by the preceding pass (lifetime analysis). - - We try to combine each pair of insns joined by a logical link. - We also try to combine triples of insns A, B and C when - C has a link back to B and B has a link back to A. - - LOG_LINKS does not have links for use of the CC0. They don't - need to, because the insn that sets the CC0 is always immediately - before the insn that tests it. So we always regard a branch - insn as having a logical link to the preceding insn. The same is true - for an insn explicitly using CC0. - - We check (with use_crosses_set_p) to avoid combining in such a way - as to move a computation to a place where its value would be different. - - Combination is done by mathematically substituting the previous - insn(s) values for the regs they set into the expressions in - the later insns that refer to these regs. If the result is a valid insn - for our target machine, according to the machine description, - we install it, delete the earlier insns, and update the data flow - information (LOG_LINKS and REG_NOTES) for what we did. - - There are a few exceptions where the dataflow information created by - flow.c aren't completely updated: - - - reg_live_length is not updated - - reg_n_refs is not adjusted in the rare case when a register is - no longer required in a computation - - there are extremely rare cases (see distribute_regnotes) when a - REG_DEAD note is lost - - a LOG_LINKS entry that refers to an insn with multiple SETs may be - removed because there is no way to know which register it was - linking - - To simplify substitution, we combine only when the earlier insn(s) - consist of only a single assignment. To simplify updating afterward, - we never combine when a subroutine call appears in the middle. - - Since we do not represent assignments to CC0 explicitly except when that - is all an insn does, there is no LOG_LINKS entry in an insn that uses - the condition code for the insn that set the condition code. - Fortunately, these two insns must be consecutive. - Therefore, every JUMP_INSN is taken to have an implicit logical link - to the preceding insn. This is not quite right, since non-jumps can - also use the condition code; but in practice such insns would not - combine anyway. */ - -#include "config.h" -#include "system.h" -#include "rtl.h" /* stdio.h must precede rtl.h for FFS. */ -#include "flags.h" -#include "regs.h" -#include "hard-reg-set.h" -#include "basic-block.h" -#include "insn-config.h" -/* Include expr.h after insn-config.h so we get HAVE_conditional_move. */ -#include "expr.h" -#include "insn-flags.h" -#include "insn-codes.h" -#include "insn-attr.h" -#include "recog.h" -#include "real.h" -#include "toplev.h" - -/* It is not safe to use ordinary gen_lowpart in combine. - Use gen_lowpart_for_combine instead. See comments there. */ -#define gen_lowpart dont_use_gen_lowpart_you_dummy - -/* Number of attempts to combine instructions in this function. */ - -static int combine_attempts; - -/* Number of attempts that got as far as substitution in this function. */ - -static int combine_merges; - -/* Number of instructions combined with added SETs in this function. */ - -static int combine_extras; - -/* Number of instructions combined in this function. */ - -static int combine_successes; - -/* Totals over entire compilation. */ - -static int total_attempts, total_merges, total_extras, total_successes; - -/* Define a default value for REVERSIBLE_CC_MODE. - We can never assume that a condition code mode is safe to reverse unless - the md tells us so. */ -#ifndef REVERSIBLE_CC_MODE -#define REVERSIBLE_CC_MODE(MODE) 0 -#endif - -/* Vector mapping INSN_UIDs to cuids. - The cuids are like uids but increase monotonically always. - Combine always uses cuids so that it can compare them. - But actually renumbering the uids, which we used to do, - proves to be a bad idea because it makes it hard to compare - the dumps produced by earlier passes with those from later passes. */ - -static int *uid_cuid; -static int max_uid_cuid; - -/* Get the cuid of an insn. */ - -#define INSN_CUID(INSN) \ -(INSN_UID (INSN) > max_uid_cuid ? insn_cuid (INSN) : uid_cuid[INSN_UID (INSN)]) - -/* Maximum register number, which is the size of the tables below. */ - -static int combine_max_regno; - -/* Record last point of death of (hard or pseudo) register n. */ - -static rtx *reg_last_death; - -/* Record last point of modification of (hard or pseudo) register n. */ - -static rtx *reg_last_set; - -/* Record the cuid of the last insn that invalidated memory - (anything that writes memory, and subroutine calls, but not pushes). */ - -static int mem_last_set; - -/* Record the cuid of the last CALL_INSN - so we can tell whether a potential combination crosses any calls. */ - -static int last_call_cuid; - -/* When `subst' is called, this is the insn that is being modified - (by combining in a previous insn). The PATTERN of this insn - is still the old pattern partially modified and it should not be - looked at, but this may be used to examine the successors of the insn - to judge whether a simplification is valid. */ - -static rtx subst_insn; - -/* This is an insn that belongs before subst_insn, but is not currently - on the insn chain. */ - -static rtx subst_prev_insn; - -/* This is the lowest CUID that `subst' is currently dealing with. - get_last_value will not return a value if the register was set at or - after this CUID. If not for this mechanism, we could get confused if - I2 or I1 in try_combine were an insn that used the old value of a register - to obtain a new value. In that case, we might erroneously get the - new value of the register when we wanted the old one. */ - -static int subst_low_cuid; - -/* This contains any hard registers that are used in newpat; reg_dead_at_p - must consider all these registers to be always live. */ - -static HARD_REG_SET newpat_used_regs; - -/* This is an insn to which a LOG_LINKS entry has been added. If this - insn is the earlier than I2 or I3, combine should rescan starting at - that location. */ - -static rtx added_links_insn; - -/* Basic block number of the block in which we are performing combines. */ -static int this_basic_block; - -/* The next group of arrays allows the recording of the last value assigned - to (hard or pseudo) register n. We use this information to see if a - operation being processed is redundant given a prior operation performed - on the register. For example, an `and' with a constant is redundant if - all the zero bits are already known to be turned off. - - We use an approach similar to that used by cse, but change it in the - following ways: - - (1) We do not want to reinitialize at each label. - (2) It is useful, but not critical, to know the actual value assigned - to a register. Often just its form is helpful. - - Therefore, we maintain the following arrays: - - reg_last_set_value the last value assigned - reg_last_set_label records the value of label_tick when the - register was assigned - reg_last_set_table_tick records the value of label_tick when a - value using the register is assigned - reg_last_set_invalid set to non-zero when it is not valid - to use the value of this register in some - register's value - - To understand the usage of these tables, it is important to understand - the distinction between the value in reg_last_set_value being valid - and the register being validly contained in some other expression in the - table. - - Entry I in reg_last_set_value is valid if it is non-zero, and either - reg_n_sets[i] is 1 or reg_last_set_label[i] == label_tick. - - Register I may validly appear in any expression returned for the value - of another register if reg_n_sets[i] is 1. It may also appear in the - value for register J if reg_last_set_label[i] < reg_last_set_label[j] or - reg_last_set_invalid[j] is zero. - - If an expression is found in the table containing a register which may - not validly appear in an expression, the register is replaced by - something that won't match, (clobber (const_int 0)). - - reg_last_set_invalid[i] is set non-zero when register I is being assigned - to and reg_last_set_table_tick[i] == label_tick. */ - -/* Record last value assigned to (hard or pseudo) register n. */ - -static rtx *reg_last_set_value; - -/* Record the value of label_tick when the value for register n is placed in - reg_last_set_value[n]. */ - -static int *reg_last_set_label; - -/* Record the value of label_tick when an expression involving register n - is placed in reg_last_set_value. */ - -static int *reg_last_set_table_tick; - -/* Set non-zero if references to register n in expressions should not be - used. */ - -static char *reg_last_set_invalid; - -/* Incremented for each label. */ - -static int label_tick; - -/* Some registers that are set more than once and used in more than one - basic block are nevertheless always set in similar ways. For example, - a QImode register may be loaded from memory in two places on a machine - where byte loads zero extend. - - We record in the following array what we know about the nonzero - bits of a register, specifically which bits are known to be zero. - - If an entry is zero, it means that we don't know anything special. */ - -static unsigned HOST_WIDE_INT *reg_nonzero_bits; - -/* Mode used to compute significance in reg_nonzero_bits. It is the largest - integer mode that can fit in HOST_BITS_PER_WIDE_INT. */ - -static enum machine_mode nonzero_bits_mode; - -/* Nonzero if we know that a register has some leading bits that are always - equal to the sign bit. */ - -static char *reg_sign_bit_copies; - -/* Nonzero when reg_nonzero_bits and reg_sign_bit_copies can be safely used. - It is zero while computing them and after combine has completed. This - former test prevents propagating values based on previously set values, - which can be incorrect if a variable is modified in a loop. */ - -static int nonzero_sign_valid; - -/* These arrays are maintained in parallel with reg_last_set_value - and are used to store the mode in which the register was last set, - the bits that were known to be zero when it was last set, and the - number of sign bits copies it was known to have when it was last set. */ - -static enum machine_mode *reg_last_set_mode; -static unsigned HOST_WIDE_INT *reg_last_set_nonzero_bits; -static char *reg_last_set_sign_bit_copies; - -/* Record one modification to rtl structure - to be undone by storing old_contents into *where. - is_int is 1 if the contents are an int. */ - -struct undo -{ - struct undo *next; - int is_int; - union {rtx r; int i;} old_contents; - union {rtx *r; int *i;} where; -}; - -/* Record a bunch of changes to be undone, up to MAX_UNDO of them. - num_undo says how many are currently recorded. - - storage is nonzero if we must undo the allocation of new storage. - The value of storage is what to pass to obfree. - - other_insn is nonzero if we have modified some other insn in the process - of working on subst_insn. It must be verified too. - - previous_undos is the value of undobuf.undos when we started processing - this substitution. This will prevent gen_rtx_combine from re-used a piece - from the previous expression. Doing so can produce circular rtl - structures. */ - -struct undobuf -{ - char *storage; - struct undo *undos; - struct undo *frees; - struct undo *previous_undos; - rtx other_insn; -}; - -static struct undobuf undobuf; - -/* Substitute NEWVAL, an rtx expression, into INTO, a place in some - insn. The substitution can be undone by undo_all. If INTO is already - set to NEWVAL, do not record this change. Because computing NEWVAL might - also call SUBST, we have to compute it before we put anything into - the undo table. */ - -#define SUBST(INTO, NEWVAL) \ - do { rtx _new = (NEWVAL); \ - struct undo *_buf; \ - \ - if (undobuf.frees) \ - _buf = undobuf.frees, undobuf.frees = _buf->next; \ - else \ - _buf = (struct undo *) xmalloc (sizeof (struct undo)); \ - \ - _buf->is_int = 0; \ - _buf->where.r = &INTO; \ - _buf->old_contents.r = INTO; \ - INTO = _new; \ - if (_buf->old_contents.r == INTO) \ - _buf->next = undobuf.frees, undobuf.frees = _buf; \ - else \ - _buf->next = undobuf.undos, undobuf.undos = _buf; \ - } while (0) - -/* Similar to SUBST, but NEWVAL is an int expression. Note that substitution - for the value of a HOST_WIDE_INT value (including CONST_INT) is - not safe. */ - -#define SUBST_INT(INTO, NEWVAL) \ - do { struct undo *_buf; \ - \ - if (undobuf.frees) \ - _buf = undobuf.frees, undobuf.frees = _buf->next; \ - else \ - _buf = (struct undo *) xmalloc (sizeof (struct undo)); \ - \ - _buf->is_int = 1; \ - _buf->where.i = (int *) &INTO; \ - _buf->old_contents.i = INTO; \ - INTO = NEWVAL; \ - if (_buf->old_contents.i == INTO) \ - _buf->next = undobuf.frees, undobuf.frees = _buf; \ - else \ - _buf->next = undobuf.undos, undobuf.undos = _buf; \ - } while (0) - -/* Number of times the pseudo being substituted for - was found and replaced. */ - -static int n_occurrences; - -static void init_reg_last_arrays PROTO((void)); -static void setup_incoming_promotions PROTO((void)); -static void set_nonzero_bits_and_sign_copies PROTO((rtx, rtx)); -static int can_combine_p PROTO((rtx, rtx, rtx, rtx, rtx *, rtx *)); -static int sets_function_arg_p PROTO((rtx)); -static int combinable_i3pat PROTO((rtx, rtx *, rtx, rtx, int, rtx *)); -static rtx try_combine PROTO((rtx, rtx, rtx)); -static void undo_all PROTO((void)); -static rtx *find_split_point PROTO((rtx *, rtx)); -static rtx subst PROTO((rtx, rtx, rtx, int, int)); -static rtx simplify_rtx PROTO((rtx, enum machine_mode, int, int)); -static rtx simplify_if_then_else PROTO((rtx)); -static rtx simplify_set PROTO((rtx)); -static rtx simplify_logical PROTO((rtx, int)); -static rtx expand_compound_operation PROTO((rtx)); -static rtx expand_field_assignment PROTO((rtx)); -static rtx make_extraction PROTO((enum machine_mode, rtx, int, rtx, int, - int, int, int)); -static rtx extract_left_shift PROTO((rtx, int)); -static rtx make_compound_operation PROTO((rtx, enum rtx_code)); -static int get_pos_from_mask PROTO((unsigned HOST_WIDE_INT, int *)); -static rtx force_to_mode PROTO((rtx, enum machine_mode, - unsigned HOST_WIDE_INT, rtx, int)); -static rtx if_then_else_cond PROTO((rtx, rtx *, rtx *)); -static rtx known_cond PROTO((rtx, enum rtx_code, rtx, rtx)); -static int rtx_equal_for_field_assignment_p PROTO((rtx, rtx)); -static rtx make_field_assignment PROTO((rtx)); -static rtx apply_distributive_law PROTO((rtx)); -static rtx simplify_and_const_int PROTO((rtx, enum machine_mode, rtx, - unsigned HOST_WIDE_INT)); -static unsigned HOST_WIDE_INT nonzero_bits PROTO((rtx, enum machine_mode)); -static int num_sign_bit_copies PROTO((rtx, enum machine_mode)); -static int merge_outer_ops PROTO((enum rtx_code *, HOST_WIDE_INT *, - enum rtx_code, HOST_WIDE_INT, - enum machine_mode, int *)); -static rtx simplify_shift_const PROTO((rtx, enum rtx_code, enum machine_mode, - rtx, int)); -static int recog_for_combine PROTO((rtx *, rtx, rtx *)); -static rtx gen_lowpart_for_combine PROTO((enum machine_mode, rtx)); -static rtx gen_rtx_combine PVPROTO((enum rtx_code code, enum machine_mode mode, - ...)); -static rtx gen_binary PROTO((enum rtx_code, enum machine_mode, - rtx, rtx)); -static rtx gen_unary PROTO((enum rtx_code, enum machine_mode, - enum machine_mode, rtx)); -static enum rtx_code simplify_comparison PROTO((enum rtx_code, rtx *, rtx *)); -static int reversible_comparison_p PROTO((rtx)); -static void update_table_tick PROTO((rtx)); -static void record_value_for_reg PROTO((rtx, rtx, rtx)); -static void record_dead_and_set_regs_1 PROTO((rtx, rtx)); -static void record_dead_and_set_regs PROTO((rtx)); -static int get_last_value_validate PROTO((rtx *, rtx, int, int)); -static rtx get_last_value PROTO((rtx)); -static int use_crosses_set_p PROTO((rtx, int)); -static void reg_dead_at_p_1 PROTO((rtx, rtx)); -static int reg_dead_at_p PROTO((rtx, rtx)); -static void move_deaths PROTO((rtx, rtx, int, rtx, rtx *)); -static int reg_bitfield_target_p PROTO((rtx, rtx)); -static void distribute_notes PROTO((rtx, rtx, rtx, rtx, rtx, rtx)); -static void distribute_links PROTO((rtx)); -static void mark_used_regs_combine PROTO((rtx)); -static int insn_cuid PROTO((rtx)); - -/* Main entry point for combiner. F is the first insn of the function. - NREGS is the first unused pseudo-reg number. */ - -void -combine_instructions (f, nregs) - rtx f; - int nregs; -{ - register rtx insn, next; -#ifdef HAVE_cc0 - register rtx prev; -#endif - register int i; - register rtx links, nextlinks; - - combine_attempts = 0; - combine_merges = 0; - combine_extras = 0; - combine_successes = 0; - undobuf.undos = undobuf.previous_undos = 0; - - combine_max_regno = nregs; - - reg_nonzero_bits - = (unsigned HOST_WIDE_INT *) alloca (nregs * sizeof (HOST_WIDE_INT)); - reg_sign_bit_copies = (char *) alloca (nregs * sizeof (char)); - - bzero ((char *) reg_nonzero_bits, nregs * sizeof (HOST_WIDE_INT)); - bzero (reg_sign_bit_copies, nregs * sizeof (char)); - - reg_last_death = (rtx *) alloca (nregs * sizeof (rtx)); - reg_last_set = (rtx *) alloca (nregs * sizeof (rtx)); - reg_last_set_value = (rtx *) alloca (nregs * sizeof (rtx)); - reg_last_set_table_tick = (int *) alloca (nregs * sizeof (int)); - reg_last_set_label = (int *) alloca (nregs * sizeof (int)); - reg_last_set_invalid = (char *) alloca (nregs * sizeof (char)); - reg_last_set_mode - = (enum machine_mode *) alloca (nregs * sizeof (enum machine_mode)); - reg_last_set_nonzero_bits - = (unsigned HOST_WIDE_INT *) alloca (nregs * sizeof (HOST_WIDE_INT)); - reg_last_set_sign_bit_copies - = (char *) alloca (nregs * sizeof (char)); - - init_reg_last_arrays (); - - init_recog_no_volatile (); - - /* Compute maximum uid value so uid_cuid can be allocated. */ - - for (insn = f, i = 0; insn; insn = NEXT_INSN (insn)) - if (INSN_UID (insn) > i) - i = INSN_UID (insn); - - uid_cuid = (int *) alloca ((i + 1) * sizeof (int)); - max_uid_cuid = i; - - nonzero_bits_mode = mode_for_size (HOST_BITS_PER_WIDE_INT, MODE_INT, 0); - - /* Don't use reg_nonzero_bits when computing it. This can cause problems - when, for example, we have j <<= 1 in a loop. */ - - nonzero_sign_valid = 0; - - /* Compute the mapping from uids to cuids. - Cuids are numbers assigned to insns, like uids, - except that cuids increase monotonically through the code. - - Scan all SETs and see if we can deduce anything about what - bits are known to be zero for some registers and how many copies - of the sign bit are known to exist for those registers. - - Also set any known values so that we can use it while searching - for what bits are known to be set. */ - - label_tick = 1; - - /* We need to initialize it here, because record_dead_and_set_regs may call - get_last_value. */ - subst_prev_insn = NULL_RTX; - - setup_incoming_promotions (); - - for (insn = f, i = 0; insn; insn = NEXT_INSN (insn)) - { - uid_cuid[INSN_UID (insn)] = ++i; - subst_low_cuid = i; - subst_insn = insn; - - if (GET_RTX_CLASS (GET_CODE (insn)) == 'i') - { - note_stores (PATTERN (insn), set_nonzero_bits_and_sign_copies); - record_dead_and_set_regs (insn); - -#ifdef AUTO_INC_DEC - for (links = REG_NOTES (insn); links; links = XEXP (links, 1)) - if (REG_NOTE_KIND (links) == REG_INC) - set_nonzero_bits_and_sign_copies (XEXP (links, 0), NULL_RTX); -#endif - } - - if (GET_CODE (insn) == CODE_LABEL) - label_tick++; - } - - nonzero_sign_valid = 1; - - /* Now scan all the insns in forward order. */ - - this_basic_block = -1; - label_tick = 1; - last_call_cuid = 0; - mem_last_set = 0; - init_reg_last_arrays (); - setup_incoming_promotions (); - - for (insn = f; insn; insn = next ? next : NEXT_INSN (insn)) - { - next = 0; - - /* If INSN starts a new basic block, update our basic block number. */ - if (this_basic_block + 1 < n_basic_blocks - && BLOCK_HEAD (this_basic_block + 1) == insn) - this_basic_block++; - - if (GET_CODE (insn) == CODE_LABEL) - label_tick++; - - else if (GET_RTX_CLASS (GET_CODE (insn)) == 'i') - { - /* Try this insn with each insn it links back to. */ - - for (links = LOG_LINKS (insn); links; links = XEXP (links, 1)) - if ((next = try_combine (insn, XEXP (links, 0), NULL_RTX)) != 0) - goto retry; - - /* Try each sequence of three linked insns ending with this one. */ - - for (links = LOG_LINKS (insn); links; links = XEXP (links, 1)) - for (nextlinks = LOG_LINKS (XEXP (links, 0)); nextlinks; - nextlinks = XEXP (nextlinks, 1)) - if ((next = try_combine (insn, XEXP (links, 0), - XEXP (nextlinks, 0))) != 0) - goto retry; - -#ifdef HAVE_cc0 - /* Try to combine a jump insn that uses CC0 - with a preceding insn that sets CC0, and maybe with its - logical predecessor as well. - This is how we make decrement-and-branch insns. - We need this special code because data flow connections - via CC0 do not get entered in LOG_LINKS. */ - - if (GET_CODE (insn) == JUMP_INSN - && (prev = prev_nonnote_insn (insn)) != 0 - && GET_CODE (prev) == INSN - && sets_cc0_p (PATTERN (prev))) - { - if ((next = try_combine (insn, prev, NULL_RTX)) != 0) - goto retry; - - for (nextlinks = LOG_LINKS (prev); nextlinks; - nextlinks = XEXP (nextlinks, 1)) - if ((next = try_combine (insn, prev, - XEXP (nextlinks, 0))) != 0) - goto retry; - } - - /* Do the same for an insn that explicitly references CC0. */ - if (GET_CODE (insn) == INSN - && (prev = prev_nonnote_insn (insn)) != 0 - && GET_CODE (prev) == INSN - && sets_cc0_p (PATTERN (prev)) - && GET_CODE (PATTERN (insn)) == SET - && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (insn)))) - { - if ((next = try_combine (insn, prev, NULL_RTX)) != 0) - goto retry; - - for (nextlinks = LOG_LINKS (prev); nextlinks; - nextlinks = XEXP (nextlinks, 1)) - if ((next = try_combine (insn, prev, - XEXP (nextlinks, 0))) != 0) - goto retry; - } - - /* Finally, see if any of the insns that this insn links to - explicitly references CC0. If so, try this insn, that insn, - and its predecessor if it sets CC0. */ - for (links = LOG_LINKS (insn); links; links = XEXP (links, 1)) - if (GET_CODE (XEXP (links, 0)) == INSN - && GET_CODE (PATTERN (XEXP (links, 0))) == SET - && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (XEXP (links, 0)))) - && (prev = prev_nonnote_insn (XEXP (links, 0))) != 0 - && GET_CODE (prev) == INSN - && sets_cc0_p (PATTERN (prev)) - && (next = try_combine (insn, XEXP (links, 0), prev)) != 0) - goto retry; -#endif - - /* Try combining an insn with two different insns whose results it - uses. */ - for (links = LOG_LINKS (insn); links; links = XEXP (links, 1)) - for (nextlinks = XEXP (links, 1); nextlinks; - nextlinks = XEXP (nextlinks, 1)) - if ((next = try_combine (insn, XEXP (links, 0), - XEXP (nextlinks, 0))) != 0) - goto retry; - - if (GET_CODE (insn) != NOTE) - record_dead_and_set_regs (insn); - - retry: - ; - } - } - - total_attempts += combine_attempts; - total_merges += combine_merges; - total_extras += combine_extras; - total_successes += combine_successes; - - nonzero_sign_valid = 0; - - /* Make recognizer allow volatile MEMs again. */ - init_recog (); -} - -/* Wipe the reg_last_xxx arrays in preparation for another pass. */ - -static void -init_reg_last_arrays () -{ - int nregs = combine_max_regno; - - bzero ((char *) reg_last_death, nregs * sizeof (rtx)); - bzero ((char *) reg_last_set, nregs * sizeof (rtx)); - bzero ((char *) reg_last_set_value, nregs * sizeof (rtx)); - bzero ((char *) reg_last_set_table_tick, nregs * sizeof (int)); - bzero ((char *) reg_last_set_label, nregs * sizeof (int)); - bzero (reg_last_set_invalid, nregs * sizeof (char)); - bzero ((char *) reg_last_set_mode, nregs * sizeof (enum machine_mode)); - bzero ((char *) reg_last_set_nonzero_bits, nregs * sizeof (HOST_WIDE_INT)); - bzero (reg_last_set_sign_bit_copies, nregs * sizeof (char)); -} - -/* Set up any promoted values for incoming argument registers. */ - -static void -setup_incoming_promotions () -{ -#ifdef PROMOTE_FUNCTION_ARGS - int regno; - rtx reg; - enum machine_mode mode; - int unsignedp; - rtx first = get_insns (); - - for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) - if (FUNCTION_ARG_REGNO_P (regno) - && (reg = promoted_input_arg (regno, &mode, &unsignedp)) != 0) - { - record_value_for_reg - (reg, first, gen_rtx_fmt_e ((unsignedp ? ZERO_EXTEND - : SIGN_EXTEND), - GET_MODE (reg), - gen_rtx_CLOBBER (mode, const0_rtx))); - } -#endif -} - -/* Called via note_stores. If X is a pseudo that is narrower than - HOST_BITS_PER_WIDE_INT and is being set, record what bits are known zero. - - If we are setting only a portion of X and we can't figure out what - portion, assume all bits will be used since we don't know what will - be happening. - - Similarly, set how many bits of X are known to be copies of the sign bit - at all locations in the function. This is the smallest number implied - by any set of X. */ - -static void -set_nonzero_bits_and_sign_copies (x, set) - rtx x; - rtx set; -{ - int num; - - if (GET_CODE (x) == REG - && REGNO (x) >= FIRST_PSEUDO_REGISTER - /* If this register is undefined at the start of the file, we can't - say what its contents were. */ - && ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, REGNO (x)) - && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT) - { - if (set == 0 || GET_CODE (set) == CLOBBER) - { - reg_nonzero_bits[REGNO (x)] = GET_MODE_MASK (GET_MODE (x)); - reg_sign_bit_copies[REGNO (x)] = 1; - return; - } - - /* If this is a complex assignment, see if we can convert it into a - simple assignment. */ - set = expand_field_assignment (set); - - /* If this is a simple assignment, or we have a paradoxical SUBREG, - set what we know about X. */ - - if (SET_DEST (set) == x - || (GET_CODE (SET_DEST (set)) == SUBREG - && (GET_MODE_SIZE (GET_MODE (SET_DEST (set))) - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (set))))) - && SUBREG_REG (SET_DEST (set)) == x)) - { - rtx src = SET_SRC (set); - -#ifdef SHORT_IMMEDIATES_SIGN_EXTEND - /* If X is narrower than a word and SRC is a non-negative - constant that would appear negative in the mode of X, - sign-extend it for use in reg_nonzero_bits because some - machines (maybe most) will actually do the sign-extension - and this is the conservative approach. - - ??? For 2.5, try to tighten up the MD files in this regard - instead of this kludge. */ - - if (GET_MODE_BITSIZE (GET_MODE (x)) < BITS_PER_WORD - && GET_CODE (src) == CONST_INT - && INTVAL (src) > 0 - && 0 != (INTVAL (src) - & ((HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (GET_MODE (x)) - 1)))) - src = GEN_INT (INTVAL (src) - | ((HOST_WIDE_INT) (-1) - << GET_MODE_BITSIZE (GET_MODE (x)))); -#endif - - reg_nonzero_bits[REGNO (x)] - |= nonzero_bits (src, nonzero_bits_mode); - num = num_sign_bit_copies (SET_SRC (set), GET_MODE (x)); - if (reg_sign_bit_copies[REGNO (x)] == 0 - || reg_sign_bit_copies[REGNO (x)] > num) - reg_sign_bit_copies[REGNO (x)] = num; - } - else - { - reg_nonzero_bits[REGNO (x)] = GET_MODE_MASK (GET_MODE (x)); - reg_sign_bit_copies[REGNO (x)] = 1; - } - } -} - -/* See if INSN can be combined into I3. PRED and SUCC are optionally - insns that were previously combined into I3 or that will be combined - into the merger of INSN and I3. - - Return 0 if the combination is not allowed for any reason. - - If the combination is allowed, *PDEST will be set to the single - destination of INSN and *PSRC to the single source, and this function - will return 1. */ - -static int -can_combine_p (insn, i3, pred, succ, pdest, psrc) - rtx insn; - rtx i3; - rtx pred ATTRIBUTE_UNUSED; - rtx succ; - rtx *pdest, *psrc; -{ - int i; - rtx set = 0, src, dest; - rtx p; -#ifdef AUTO_INC_DEC - rtx link; -#endif - int all_adjacent = (succ ? (next_active_insn (insn) == succ - && next_active_insn (succ) == i3) - : next_active_insn (insn) == i3); - - /* Can combine only if previous insn is a SET of a REG, a SUBREG or CC0. - or a PARALLEL consisting of such a SET and CLOBBERs. - - If INSN has CLOBBER parallel parts, ignore them for our processing. - By definition, these happen during the execution of the insn. When it - is merged with another insn, all bets are off. If they are, in fact, - needed and aren't also supplied in I3, they may be added by - recog_for_combine. Otherwise, it won't match. - - We can also ignore a SET whose SET_DEST is mentioned in a REG_UNUSED - note. - - Get the source and destination of INSN. If more than one, can't - combine. */ - - if (GET_CODE (PATTERN (insn)) == SET) - set = PATTERN (insn); - else if (GET_CODE (PATTERN (insn)) == PARALLEL - && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == SET) - { - for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++) - { - rtx elt = XVECEXP (PATTERN (insn), 0, i); - - switch (GET_CODE (elt)) - { - /* This is important to combine floating point insns - for the SH4 port. */ - case USE: - /* Combining an isolated USE doesn't make sense. - We depend here on combinable_i3_pat to reject them. */ - /* The code below this loop only verifies that the inputs of - the SET in INSN do not change. We call reg_set_between_p - to verify that the REG in the USE does not change betweeen - I3 and INSN. - If the USE in INSN was for a pseudo register, the matching - insn pattern will likely match any register; combining this - with any other USE would only be safe if we knew that the - used registers have identical values, or if there was - something to tell them apart, e.g. different modes. For - now, we forgo such compilcated tests and simply disallow - combining of USES of pseudo registers with any other USE. */ - if (GET_CODE (XEXP (elt, 0)) == REG - && GET_CODE (PATTERN (i3)) == PARALLEL) - { - rtx i3pat = PATTERN (i3); - int i = XVECLEN (i3pat, 0) - 1; - int regno = REGNO (XEXP (elt, 0)); - do - { - rtx i3elt = XVECEXP (i3pat, 0, i); - if (GET_CODE (i3elt) == USE - && GET_CODE (XEXP (i3elt, 0)) == REG - && (REGNO (XEXP (i3elt, 0)) == regno - ? reg_set_between_p (XEXP (elt, 0), - PREV_INSN (insn), i3) - : regno >= FIRST_PSEUDO_REGISTER)) - return 0; - } - while (--i >= 0); - } - break; - - /* We can ignore CLOBBERs. */ - case CLOBBER: - break; - - case SET: - /* Ignore SETs whose result isn't used but not those that - have side-effects. */ - if (find_reg_note (insn, REG_UNUSED, SET_DEST (elt)) - && ! side_effects_p (elt)) - break; - - /* If we have already found a SET, this is a second one and - so we cannot combine with this insn. */ - if (set) - return 0; - - set = elt; - break; - - default: - /* Anything else means we can't combine. */ - return 0; - } - } - - if (set == 0 - /* If SET_SRC is an ASM_OPERANDS we can't throw away these CLOBBERs, - so don't do anything with it. */ - || GET_CODE (SET_SRC (set)) == ASM_OPERANDS) - return 0; - } - else - return 0; - - if (set == 0) - return 0; - - set = expand_field_assignment (set); - src = SET_SRC (set), dest = SET_DEST (set); - - /* Don't eliminate a store in the stack pointer. */ - if (dest == stack_pointer_rtx - /* If we couldn't eliminate a field assignment, we can't combine. */ - || GET_CODE (dest) == ZERO_EXTRACT || GET_CODE (dest) == STRICT_LOW_PART - /* Don't combine with an insn that sets a register to itself if it has - a REG_EQUAL note. This may be part of a REG_NO_CONFLICT sequence. */ - || (rtx_equal_p (src, dest) && find_reg_note (insn, REG_EQUAL, NULL_RTX)) - /* Can't merge a function call. */ - || GET_CODE (src) == CALL - /* Don't eliminate a function call argument. */ - || (GET_CODE (i3) == CALL_INSN - && (find_reg_fusage (i3, USE, dest) - || (GET_CODE (dest) == REG - && REGNO (dest) < FIRST_PSEUDO_REGISTER - && global_regs[REGNO (dest)]))) - /* Don't substitute into an incremented register. */ - || FIND_REG_INC_NOTE (i3, dest) - || (succ && FIND_REG_INC_NOTE (succ, dest)) -#if 0 - /* Don't combine the end of a libcall into anything. */ - /* ??? This gives worse code, and appears to be unnecessary, since no - pass after flow uses REG_LIBCALL/REG_RETVAL notes. Local-alloc does - use REG_RETVAL notes for noconflict blocks, but other code here - makes sure that those insns don't disappear. */ - || find_reg_note (insn, REG_RETVAL, NULL_RTX) -#endif - /* Make sure that DEST is not used after SUCC but before I3. */ - || (succ && ! all_adjacent - && reg_used_between_p (dest, succ, i3)) - /* Make sure that the value that is to be substituted for the register - does not use any registers whose values alter in between. However, - If the insns are adjacent, a use can't cross a set even though we - think it might (this can happen for a sequence of insns each setting - the same destination; reg_last_set of that register might point to - a NOTE). If INSN has a REG_EQUIV note, the register is always - equivalent to the memory so the substitution is valid even if there - are intervening stores. Also, don't move a volatile asm or - UNSPEC_VOLATILE across any other insns. */ - || (! all_adjacent - && (((GET_CODE (src) != MEM - || ! find_reg_note (insn, REG_EQUIV, src)) - && use_crosses_set_p (src, INSN_CUID (insn))) - || (GET_CODE (src) == ASM_OPERANDS && MEM_VOLATILE_P (src)) - || GET_CODE (src) == UNSPEC_VOLATILE)) - /* If there is a REG_NO_CONFLICT note for DEST in I3 or SUCC, we get - better register allocation by not doing the combine. */ - || find_reg_note (i3, REG_NO_CONFLICT, dest) - || (succ && find_reg_note (succ, REG_NO_CONFLICT, dest)) - /* Don't combine across a CALL_INSN, because that would possibly - change whether the life span of some REGs crosses calls or not, - and it is a pain to update that information. - Exception: if source is a constant, moving it later can't hurt. - Accept that special case, because it helps -fforce-addr a lot. */ - || (INSN_CUID (insn) < last_call_cuid && ! CONSTANT_P (src))) - return 0; - - /* DEST must either be a REG or CC0. */ - if (GET_CODE (dest) == REG) - { - /* If register alignment is being enforced for multi-word items in all - cases except for parameters, it is possible to have a register copy - insn referencing a hard register that is not allowed to contain the - mode being copied and which would not be valid as an operand of most - insns. Eliminate this problem by not combining with such an insn. - - Also, on some machines we don't want to extend the life of a hard - register. - - This is the same test done in can_combine except that we don't test - if SRC is a CALL operation to permit a hard register with - SMALL_REGISTER_CLASSES, and that we have to take all_adjacent - into account. */ - - if (GET_CODE (src) == REG - && ((REGNO (dest) < FIRST_PSEUDO_REGISTER - && ! HARD_REGNO_MODE_OK (REGNO (dest), GET_MODE (dest))) - /* Don't extend the life of a hard register unless it is - user variable (if we have few registers) or it can't - fit into the desired register (meaning something special - is going on). - Also avoid substituting a return register into I3, because - reload can't handle a conflict with constraints of other - inputs. */ - || (REGNO (src) < FIRST_PSEUDO_REGISTER - && (! HARD_REGNO_MODE_OK (REGNO (src), GET_MODE (src)) - || (SMALL_REGISTER_CLASSES - && ((! all_adjacent && ! REG_USERVAR_P (src)) - || (FUNCTION_VALUE_REGNO_P (REGNO (src)) - && ! REG_USERVAR_P (src)))))))) - return 0; - } - else if (GET_CODE (dest) != CC0) - return 0; - - /* Don't substitute for a register intended as a clobberable operand. - Similarly, don't substitute an expression containing a register that - will be clobbered in I3. */ - if (GET_CODE (PATTERN (i3)) == PARALLEL) - for (i = XVECLEN (PATTERN (i3), 0) - 1; i >= 0; i--) - if (GET_CODE (XVECEXP (PATTERN (i3), 0, i)) == CLOBBER - && (reg_overlap_mentioned_p (XEXP (XVECEXP (PATTERN (i3), 0, i), 0), - src) - || rtx_equal_p (XEXP (XVECEXP (PATTERN (i3), 0, i), 0), dest))) - return 0; - - /* If INSN contains anything volatile, or is an `asm' (whether volatile - or not), reject, unless nothing volatile comes between it and I3 */ - - if (GET_CODE (src) == ASM_OPERANDS || volatile_refs_p (src)) - { - /* Make sure succ doesn't contain a volatile reference. */ - if (succ != 0 && volatile_refs_p (PATTERN (succ))) - return 0; - - for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p)) - if (GET_RTX_CLASS (GET_CODE (p)) == 'i' - && p != succ && volatile_refs_p (PATTERN (p))) - return 0; - } - - /* If INSN is an asm, and DEST is a hard register, reject, since it has - to be an explicit register variable, and was chosen for a reason. */ - - if (GET_CODE (src) == ASM_OPERANDS - && GET_CODE (dest) == REG && REGNO (dest) < FIRST_PSEUDO_REGISTER) - return 0; - - /* If there are any volatile insns between INSN and I3, reject, because - they might affect machine state. */ - - for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p)) - if (GET_RTX_CLASS (GET_CODE (p)) == 'i' - && p != succ && volatile_insn_p (PATTERN (p))) - return 0; - - /* If INSN or I2 contains an autoincrement or autodecrement, - make sure that register is not used between there and I3, - and not already used in I3 either. - Also insist that I3 not be a jump; if it were one - and the incremented register were spilled, we would lose. */ - -#ifdef AUTO_INC_DEC - for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) - if (REG_NOTE_KIND (link) == REG_INC - && (GET_CODE (i3) == JUMP_INSN - || reg_used_between_p (XEXP (link, 0), insn, i3) - || reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i3)))) - return 0; -#endif - -#ifdef HAVE_cc0 - /* Don't combine an insn that follows a CC0-setting insn. - An insn that uses CC0 must not be separated from the one that sets it. - We do, however, allow I2 to follow a CC0-setting insn if that insn - is passed as I1; in that case it will be deleted also. - We also allow combining in this case if all the insns are adjacent - because that would leave the two CC0 insns adjacent as well. - It would be more logical to test whether CC0 occurs inside I1 or I2, - but that would be much slower, and this ought to be equivalent. */ - - p = prev_nonnote_insn (insn); - if (p && p != pred && GET_CODE (p) == INSN && sets_cc0_p (PATTERN (p)) - && ! all_adjacent) - return 0; -#endif - - /* If we get here, we have passed all the tests and the combination is - to be allowed. */ - - *pdest = dest; - *psrc = src; - - return 1; -} - -/* Check if PAT is an insn - or a part of it - used to set up an - argument for a function in a hard register. */ - -static int -sets_function_arg_p (pat) - rtx pat; -{ - int i; - rtx inner_dest; - - switch (GET_CODE (pat)) - { - case INSN: - return sets_function_arg_p (PATTERN (pat)); - - case PARALLEL: - for (i = XVECLEN (pat, 0); --i >= 0;) - if (sets_function_arg_p (XVECEXP (pat, 0, i))) - return 1; - - break; - - case SET: - inner_dest = SET_DEST (pat); - while (GET_CODE (inner_dest) == STRICT_LOW_PART - || GET_CODE (inner_dest) == SUBREG - || GET_CODE (inner_dest) == ZERO_EXTRACT) - inner_dest = XEXP (inner_dest, 0); - - return (GET_CODE (inner_dest) == REG - && REGNO (inner_dest) < FIRST_PSEUDO_REGISTER - && FUNCTION_ARG_REGNO_P (REGNO (inner_dest))); - - default: - break; - } - - return 0; -} - -/* LOC is the location within I3 that contains its pattern or the component - of a PARALLEL of the pattern. We validate that it is valid for combining. - - One problem is if I3 modifies its output, as opposed to replacing it - entirely, we can't allow the output to contain I2DEST or I1DEST as doing - so would produce an insn that is not equivalent to the original insns. - - Consider: - - (set (reg:DI 101) (reg:DI 100)) - (set (subreg:SI (reg:DI 101) 0) ) - - This is NOT equivalent to: - - (parallel [(set (subreg:SI (reg:DI 100) 0) ) - (set (reg:DI 101) (reg:DI 100))]) - - Not only does this modify 100 (in which case it might still be valid - if 100 were dead in I2), it sets 101 to the ORIGINAL value of 100. - - We can also run into a problem if I2 sets a register that I1 - uses and I1 gets directly substituted into I3 (not via I2). In that - case, we would be getting the wrong value of I2DEST into I3, so we - must reject the combination. This case occurs when I2 and I1 both - feed into I3, rather than when I1 feeds into I2, which feeds into I3. - If I1_NOT_IN_SRC is non-zero, it means that finding I1 in the source - of a SET must prevent combination from occurring. - - On machines where SMALL_REGISTER_CLASSES is non-zero, we don't combine - if the destination of a SET is a hard register that isn't a user - variable. - - Before doing the above check, we first try to expand a field assignment - into a set of logical operations. - - If PI3_DEST_KILLED is non-zero, it is a pointer to a location in which - we place a register that is both set and used within I3. If more than one - such register is detected, we fail. - - Return 1 if the combination is valid, zero otherwise. */ - -static int -combinable_i3pat (i3, loc, i2dest, i1dest, i1_not_in_src, pi3dest_killed) - rtx i3; - rtx *loc; - rtx i2dest; - rtx i1dest; - int i1_not_in_src; - rtx *pi3dest_killed; -{ - rtx x = *loc; - - if (GET_CODE (x) == SET) - { - rtx set = expand_field_assignment (x); - rtx dest = SET_DEST (set); - rtx src = SET_SRC (set); - rtx inner_dest = dest; - -#if 0 - rtx inner_src = src; -#endif - - SUBST (*loc, set); - - while (GET_CODE (inner_dest) == STRICT_LOW_PART - || GET_CODE (inner_dest) == SUBREG - || GET_CODE (inner_dest) == ZERO_EXTRACT) - inner_dest = XEXP (inner_dest, 0); - - /* We probably don't need this any more now that LIMIT_RELOAD_CLASS - was added. */ -#if 0 - while (GET_CODE (inner_src) == STRICT_LOW_PART - || GET_CODE (inner_src) == SUBREG - || GET_CODE (inner_src) == ZERO_EXTRACT) - inner_src = XEXP (inner_src, 0); - - /* If it is better that two different modes keep two different pseudos, - avoid combining them. This avoids producing the following pattern - on a 386: - (set (subreg:SI (reg/v:QI 21) 0) - (lshiftrt:SI (reg/v:SI 20) - (const_int 24))) - If that were made, reload could not handle the pair of - reg 20/21, since it would try to get any GENERAL_REGS - but some of them don't handle QImode. */ - - if (rtx_equal_p (inner_src, i2dest) - && GET_CODE (inner_dest) == REG - && ! MODES_TIEABLE_P (GET_MODE (i2dest), GET_MODE (inner_dest))) - return 0; -#endif - - /* Check for the case where I3 modifies its output, as - discussed above. */ - if ((inner_dest != dest - && (reg_overlap_mentioned_p (i2dest, inner_dest) - || (i1dest && reg_overlap_mentioned_p (i1dest, inner_dest)))) - - /* This is the same test done in can_combine_p except that we - allow a hard register with SMALL_REGISTER_CLASSES if SRC is a - CALL operation. Moreover, we can't test all_adjacent; we don't - have to, since this instruction will stay in place, thus we are - not considering increasing the lifetime of INNER_DEST. - - Also, if this insn sets a function argument, combining it with - something that might need a spill could clobber a previous - function argument; the all_adjacent test in can_combine_p also - checks this; here, we do a more specific test for this case. */ - - || (GET_CODE (inner_dest) == REG - && REGNO (inner_dest) < FIRST_PSEUDO_REGISTER - && (! HARD_REGNO_MODE_OK (REGNO (inner_dest), - GET_MODE (inner_dest)) - || (SMALL_REGISTER_CLASSES && GET_CODE (src) != CALL - && ! REG_USERVAR_P (inner_dest) - && (FUNCTION_VALUE_REGNO_P (REGNO (inner_dest)) - || (FUNCTION_ARG_REGNO_P (REGNO (inner_dest)) - && i3 != 0 - && sets_function_arg_p (prev_nonnote_insn (i3))))))) - || (i1_not_in_src && reg_overlap_mentioned_p (i1dest, src))) - return 0; - - /* If DEST is used in I3, it is being killed in this insn, - so record that for later. - Never add REG_DEAD notes for the FRAME_POINTER_REGNUM or the - STACK_POINTER_REGNUM, since these are always considered to be - live. Similarly for ARG_POINTER_REGNUM if it is fixed. */ - if (pi3dest_killed && GET_CODE (dest) == REG - && reg_referenced_p (dest, PATTERN (i3)) - && REGNO (dest) != FRAME_POINTER_REGNUM -#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM - && REGNO (dest) != HARD_FRAME_POINTER_REGNUM -#endif -#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM - && (REGNO (dest) != ARG_POINTER_REGNUM - || ! fixed_regs [REGNO (dest)]) -#endif - && REGNO (dest) != STACK_POINTER_REGNUM) - { - if (*pi3dest_killed) - return 0; - - *pi3dest_killed = dest; - } - } - - else if (GET_CODE (x) == PARALLEL) - { - int i; - - for (i = 0; i < XVECLEN (x, 0); i++) - if (! combinable_i3pat (i3, &XVECEXP (x, 0, i), i2dest, i1dest, - i1_not_in_src, pi3dest_killed)) - return 0; - } - - return 1; -} - -/* Try to combine the insns I1 and I2 into I3. - Here I1 and I2 appear earlier than I3. - I1 can be zero; then we combine just I2 into I3. - - It we are combining three insns and the resulting insn is not recognized, - try splitting it into two insns. If that happens, I2 and I3 are retained - and I1 is pseudo-deleted by turning it into a NOTE. Otherwise, I1 and I2 - are pseudo-deleted. - - Return 0 if the combination does not work. Then nothing is changed. - If we did the combination, return the insn at which combine should - resume scanning. */ - -static rtx -try_combine (i3, i2, i1) - register rtx i3, i2, i1; -{ - /* New patterns for I3 and I3, respectively. */ - rtx newpat, newi2pat = 0; - /* Indicates need to preserve SET in I1 or I2 in I3 if it is not dead. */ - int added_sets_1, added_sets_2; - /* Total number of SETs to put into I3. */ - int total_sets; - /* Nonzero is I2's body now appears in I3. */ - int i2_is_used; - /* INSN_CODEs for new I3, new I2, and user of condition code. */ - int insn_code_number, i2_code_number, other_code_number; - /* Contains I3 if the destination of I3 is used in its source, which means - that the old life of I3 is being killed. If that usage is placed into - I2 and not in I3, a REG_DEAD note must be made. */ - rtx i3dest_killed = 0; - /* SET_DEST and SET_SRC of I2 and I1. */ - rtx i2dest, i2src, i1dest = 0, i1src = 0; - /* PATTERN (I2), or a copy of it in certain cases. */ - rtx i2pat; - /* Indicates if I2DEST or I1DEST is in I2SRC or I1_SRC. */ - int i2dest_in_i2src = 0, i1dest_in_i1src = 0, i2dest_in_i1src = 0; - int i1_feeds_i3 = 0; - /* Notes that must be added to REG_NOTES in I3 and I2. */ - rtx new_i3_notes, new_i2_notes; - /* Notes that we substituted I3 into I2 instead of the normal case. */ - int i3_subst_into_i2 = 0; - /* Notes that I1, I2 or I3 is a MULT operation. */ - int have_mult = 0; - - int maxreg; - rtx temp; - register rtx link; - int i; - - /* If any of I1, I2, and I3 isn't really an insn, we can't do anything. - This can occur when flow deletes an insn that it has merged into an - auto-increment address. We also can't do anything if I3 has a - REG_LIBCALL note since we don't want to disrupt the contiguity of a - libcall. */ - - if (GET_RTX_CLASS (GET_CODE (i3)) != 'i' - || GET_RTX_CLASS (GET_CODE (i2)) != 'i' - || (i1 && GET_RTX_CLASS (GET_CODE (i1)) != 'i') -#if 0 - /* ??? This gives worse code, and appears to be unnecessary, since no - pass after flow uses REG_LIBCALL/REG_RETVAL notes. */ - || find_reg_note (i3, REG_LIBCALL, NULL_RTX) -#endif -) - return 0; - - combine_attempts++; - - undobuf.undos = undobuf.previous_undos = 0; - undobuf.other_insn = 0; - - /* Save the current high-water-mark so we can free storage if we didn't - accept this combination. */ - undobuf.storage = (char *) oballoc (0); - - /* Reset the hard register usage information. */ - CLEAR_HARD_REG_SET (newpat_used_regs); - - /* If I1 and I2 both feed I3, they can be in any order. To simplify the - code below, set I1 to be the earlier of the two insns. */ - if (i1 && INSN_CUID (i1) > INSN_CUID (i2)) - temp = i1, i1 = i2, i2 = temp; - - added_links_insn = 0; - - /* First check for one important special-case that the code below will - not handle. Namely, the case where I1 is zero, I2 has multiple sets, - and I3 is a SET whose SET_SRC is a SET_DEST in I2. In that case, - we may be able to replace that destination with the destination of I3. - This occurs in the common code where we compute both a quotient and - remainder into a structure, in which case we want to do the computation - directly into the structure to avoid register-register copies. - - We make very conservative checks below and only try to handle the - most common cases of this. For example, we only handle the case - where I2 and I3 are adjacent to avoid making difficult register - usage tests. */ - - if (i1 == 0 && GET_CODE (i3) == INSN && GET_CODE (PATTERN (i3)) == SET - && GET_CODE (SET_SRC (PATTERN (i3))) == REG - && REGNO (SET_SRC (PATTERN (i3))) >= FIRST_PSEUDO_REGISTER - && (! SMALL_REGISTER_CLASSES - || (GET_CODE (SET_DEST (PATTERN (i3))) != REG - || REGNO (SET_DEST (PATTERN (i3))) >= FIRST_PSEUDO_REGISTER - || REG_USERVAR_P (SET_DEST (PATTERN (i3))))) - && find_reg_note (i3, REG_DEAD, SET_SRC (PATTERN (i3))) - && GET_CODE (PATTERN (i2)) == PARALLEL - && ! side_effects_p (SET_DEST (PATTERN (i3))) - /* If the dest of I3 is a ZERO_EXTRACT or STRICT_LOW_PART, the code - below would need to check what is inside (and reg_overlap_mentioned_p - doesn't support those codes anyway). Don't allow those destinations; - the resulting insn isn't likely to be recognized anyway. */ - && GET_CODE (SET_DEST (PATTERN (i3))) != ZERO_EXTRACT - && GET_CODE (SET_DEST (PATTERN (i3))) != STRICT_LOW_PART - && ! reg_overlap_mentioned_p (SET_SRC (PATTERN (i3)), - SET_DEST (PATTERN (i3))) - && next_real_insn (i2) == i3) - { - rtx p2 = PATTERN (i2); - - /* Make sure that the destination of I3, - which we are going to substitute into one output of I2, - is not used within another output of I2. We must avoid making this: - (parallel [(set (mem (reg 69)) ...) - (set (reg 69) ...)]) - which is not well-defined as to order of actions. - (Besides, reload can't handle output reloads for this.) - - The problem can also happen if the dest of I3 is a memory ref, - if another dest in I2 is an indirect memory ref. */ - for (i = 0; i < XVECLEN (p2, 0); i++) - if ((GET_CODE (XVECEXP (p2, 0, i)) == SET - || GET_CODE (XVECEXP (p2, 0, i)) == CLOBBER) - && reg_overlap_mentioned_p (SET_DEST (PATTERN (i3)), - SET_DEST (XVECEXP (p2, 0, i)))) - break; - - if (i == XVECLEN (p2, 0)) - for (i = 0; i < XVECLEN (p2, 0); i++) - if (SET_DEST (XVECEXP (p2, 0, i)) == SET_SRC (PATTERN (i3))) - { - combine_merges++; - - subst_insn = i3; - subst_low_cuid = INSN_CUID (i2); - - added_sets_2 = added_sets_1 = 0; - i2dest = SET_SRC (PATTERN (i3)); - - /* Replace the dest in I2 with our dest and make the resulting - insn the new pattern for I3. Then skip to where we - validate the pattern. Everything was set up above. */ - SUBST (SET_DEST (XVECEXP (p2, 0, i)), - SET_DEST (PATTERN (i3))); - - newpat = p2; - i3_subst_into_i2 = 1; - goto validate_replacement; - } - } - -#ifndef HAVE_cc0 - /* If we have no I1 and I2 looks like: - (parallel [(set (reg:CC X) (compare:CC OP (const_int 0))) - (set Y OP)]) - make up a dummy I1 that is - (set Y OP) - and change I2 to be - (set (reg:CC X) (compare:CC Y (const_int 0))) - - (We can ignore any trailing CLOBBERs.) - - This undoes a previous combination and allows us to match a branch-and- - decrement insn. */ - - if (i1 == 0 && GET_CODE (PATTERN (i2)) == PARALLEL - && XVECLEN (PATTERN (i2), 0) >= 2 - && GET_CODE (XVECEXP (PATTERN (i2), 0, 0)) == SET - && (GET_MODE_CLASS (GET_MODE (SET_DEST (XVECEXP (PATTERN (i2), 0, 0)))) - == MODE_CC) - && GET_CODE (SET_SRC (XVECEXP (PATTERN (i2), 0, 0))) == COMPARE - && XEXP (SET_SRC (XVECEXP (PATTERN (i2), 0, 0)), 1) == const0_rtx - && GET_CODE (XVECEXP (PATTERN (i2), 0, 1)) == SET - && GET_CODE (SET_DEST (XVECEXP (PATTERN (i2), 0, 1))) == REG - && rtx_equal_p (XEXP (SET_SRC (XVECEXP (PATTERN (i2), 0, 0)), 0), - SET_SRC (XVECEXP (PATTERN (i2), 0, 1)))) - { - for (i = XVECLEN (PATTERN (i2), 0) - 1; i >= 2; i--) - if (GET_CODE (XVECEXP (PATTERN (i2), 0, i)) != CLOBBER) - break; - - if (i == 1) - { - /* We make I1 with the same INSN_UID as I2. This gives it - the same INSN_CUID for value tracking. Our fake I1 will - never appear in the insn stream so giving it the same INSN_UID - as I2 will not cause a problem. */ - - subst_prev_insn = i1 - = gen_rtx_INSN (VOIDmode, INSN_UID (i2), NULL_RTX, i2, - XVECEXP (PATTERN (i2), 0, 1), -1, NULL_RTX, - NULL_RTX); - - SUBST (PATTERN (i2), XVECEXP (PATTERN (i2), 0, 0)); - SUBST (XEXP (SET_SRC (PATTERN (i2)), 0), - SET_DEST (PATTERN (i1))); - } - } -#endif - - /* Verify that I2 and I1 are valid for combining. */ - if (! can_combine_p (i2, i3, i1, NULL_RTX, &i2dest, &i2src) - || (i1 && ! can_combine_p (i1, i3, NULL_RTX, i2, &i1dest, &i1src))) - { - undo_all (); - return 0; - } - - /* Record whether I2DEST is used in I2SRC and similarly for the other - cases. Knowing this will help in register status updating below. */ - i2dest_in_i2src = reg_overlap_mentioned_p (i2dest, i2src); - i1dest_in_i1src = i1 && reg_overlap_mentioned_p (i1dest, i1src); - i2dest_in_i1src = i1 && reg_overlap_mentioned_p (i2dest, i1src); - - /* See if I1 directly feeds into I3. It does if I1DEST is not used - in I2SRC. */ - i1_feeds_i3 = i1 && ! reg_overlap_mentioned_p (i1dest, i2src); - - /* Ensure that I3's pattern can be the destination of combines. */ - if (! combinable_i3pat (i3, &PATTERN (i3), i2dest, i1dest, - i1 && i2dest_in_i1src && i1_feeds_i3, - &i3dest_killed)) - { - undo_all (); - return 0; - } - - /* See if any of the insns is a MULT operation. Unless one is, we will - reject a combination that is, since it must be slower. Be conservative - here. */ - if (GET_CODE (i2src) == MULT - || (i1 != 0 && GET_CODE (i1src) == MULT) - || (GET_CODE (PATTERN (i3)) == SET - && GET_CODE (SET_SRC (PATTERN (i3))) == MULT)) - have_mult = 1; - - /* If I3 has an inc, then give up if I1 or I2 uses the reg that is inc'd. - We used to do this EXCEPT in one case: I3 has a post-inc in an - output operand. However, that exception can give rise to insns like - mov r3,(r3)+ - which is a famous insn on the PDP-11 where the value of r3 used as the - source was model-dependent. Avoid this sort of thing. */ - -#if 0 - if (!(GET_CODE (PATTERN (i3)) == SET - && GET_CODE (SET_SRC (PATTERN (i3))) == REG - && GET_CODE (SET_DEST (PATTERN (i3))) == MEM - && (GET_CODE (XEXP (SET_DEST (PATTERN (i3)), 0)) == POST_INC - || GET_CODE (XEXP (SET_DEST (PATTERN (i3)), 0)) == POST_DEC))) - /* It's not the exception. */ -#endif -#ifdef AUTO_INC_DEC - for (link = REG_NOTES (i3); link; link = XEXP (link, 1)) - if (REG_NOTE_KIND (link) == REG_INC - && (reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i2)) - || (i1 != 0 - && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i1))))) - { - undo_all (); - return 0; - } -#endif - - /* See if the SETs in I1 or I2 need to be kept around in the merged - instruction: whenever the value set there is still needed past I3. - For the SETs in I2, this is easy: we see if I2DEST dies or is set in I3. - - For the SET in I1, we have two cases: If I1 and I2 independently - feed into I3, the set in I1 needs to be kept around if I1DEST dies - or is set in I3. Otherwise (if I1 feeds I2 which feeds I3), the set - in I1 needs to be kept around unless I1DEST dies or is set in either - I2 or I3. We can distinguish these cases by seeing if I2SRC mentions - I1DEST. If so, we know I1 feeds into I2. */ - - added_sets_2 = ! dead_or_set_p (i3, i2dest); - - added_sets_1 - = i1 && ! (i1_feeds_i3 ? dead_or_set_p (i3, i1dest) - : (dead_or_set_p (i3, i1dest) || dead_or_set_p (i2, i1dest))); - - /* If the set in I2 needs to be kept around, we must make a copy of - PATTERN (I2), so that when we substitute I1SRC for I1DEST in - PATTERN (I2), we are only substituting for the original I1DEST, not into - an already-substituted copy. This also prevents making self-referential - rtx. If I2 is a PARALLEL, we just need the piece that assigns I2SRC to - I2DEST. */ - - i2pat = (GET_CODE (PATTERN (i2)) == PARALLEL - ? gen_rtx_SET (VOIDmode, i2dest, i2src) - : PATTERN (i2)); - - if (added_sets_2) - i2pat = copy_rtx (i2pat); - - combine_merges++; - - /* Substitute in the latest insn for the regs set by the earlier ones. */ - - maxreg = max_reg_num (); - - subst_insn = i3; - - /* It is possible that the source of I2 or I1 may be performing an - unneeded operation, such as a ZERO_EXTEND of something that is known - to have the high part zero. Handle that case by letting subst look at - the innermost one of them. - - Another way to do this would be to have a function that tries to - simplify a single insn instead of merging two or more insns. We don't - do this because of the potential of infinite loops and because - of the potential extra memory required. However, doing it the way - we are is a bit of a kludge and doesn't catch all cases. - - But only do this if -fexpensive-optimizations since it slows things down - and doesn't usually win. */ - - if (flag_expensive_optimizations) - { - /* Pass pc_rtx so no substitutions are done, just simplifications. - The cases that we are interested in here do not involve the few - cases were is_replaced is checked. */ - if (i1) - { - subst_low_cuid = INSN_CUID (i1); - i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0); - } - else - { - subst_low_cuid = INSN_CUID (i2); - i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0); - } - - undobuf.previous_undos = undobuf.undos; - } - -#ifndef HAVE_cc0 - /* Many machines that don't use CC0 have insns that can both perform an - arithmetic operation and set the condition code. These operations will - be represented as a PARALLEL with the first element of the vector - being a COMPARE of an arithmetic operation with the constant zero. - The second element of the vector will set some pseudo to the result - of the same arithmetic operation. If we simplify the COMPARE, we won't - match such a pattern and so will generate an extra insn. Here we test - for this case, where both the comparison and the operation result are - needed, and make the PARALLEL by just replacing I2DEST in I3SRC with - I2SRC. Later we will make the PARALLEL that contains I2. */ - - if (i1 == 0 && added_sets_2 && GET_CODE (PATTERN (i3)) == SET - && GET_CODE (SET_SRC (PATTERN (i3))) == COMPARE - && XEXP (SET_SRC (PATTERN (i3)), 1) == const0_rtx - && rtx_equal_p (XEXP (SET_SRC (PATTERN (i3)), 0), i2dest)) - { -#ifdef EXTRA_CC_MODES - rtx *cc_use; - enum machine_mode compare_mode; -#endif - - newpat = PATTERN (i3); - SUBST (XEXP (SET_SRC (newpat), 0), i2src); - - i2_is_used = 1; - -#ifdef EXTRA_CC_MODES - /* See if a COMPARE with the operand we substituted in should be done - with the mode that is currently being used. If not, do the same - processing we do in `subst' for a SET; namely, if the destination - is used only once, try to replace it with a register of the proper - mode and also replace the COMPARE. */ - if (undobuf.other_insn == 0 - && (cc_use = find_single_use (SET_DEST (newpat), i3, - &undobuf.other_insn)) - && ((compare_mode = SELECT_CC_MODE (GET_CODE (*cc_use), - i2src, const0_rtx)) - != GET_MODE (SET_DEST (newpat)))) - { - int regno = REGNO (SET_DEST (newpat)); - rtx new_dest = gen_rtx_REG (compare_mode, regno); - - if (regno < FIRST_PSEUDO_REGISTER - || (REG_N_SETS (regno) == 1 && ! added_sets_2 - && ! REG_USERVAR_P (SET_DEST (newpat)))) - { - if (regno >= FIRST_PSEUDO_REGISTER) - SUBST (regno_reg_rtx[regno], new_dest); - - SUBST (SET_DEST (newpat), new_dest); - SUBST (XEXP (*cc_use, 0), new_dest); - SUBST (SET_SRC (newpat), - gen_rtx_combine (COMPARE, compare_mode, - i2src, const0_rtx)); - } - else - undobuf.other_insn = 0; - } -#endif - } - else -#endif - { - n_occurrences = 0; /* `subst' counts here */ - - /* If I1 feeds into I2 (not into I3) and I1DEST is in I1SRC, we - need to make a unique copy of I2SRC each time we substitute it - to avoid self-referential rtl. */ - - subst_low_cuid = INSN_CUID (i2); - newpat = subst (PATTERN (i3), i2dest, i2src, 0, - ! i1_feeds_i3 && i1dest_in_i1src); - undobuf.previous_undos = undobuf.undos; - - /* Record whether i2's body now appears within i3's body. */ - i2_is_used = n_occurrences; - } - - /* If we already got a failure, don't try to do more. Otherwise, - try to substitute in I1 if we have it. */ - - if (i1 && GET_CODE (newpat) != CLOBBER) - { - /* Before we can do this substitution, we must redo the test done - above (see detailed comments there) that ensures that I1DEST - isn't mentioned in any SETs in NEWPAT that are field assignments. */ - - if (! combinable_i3pat (NULL_RTX, &newpat, i1dest, NULL_RTX, - 0, NULL_PTR)) - { - undo_all (); - return 0; - } - - n_occurrences = 0; - subst_low_cuid = INSN_CUID (i1); - newpat = subst (newpat, i1dest, i1src, 0, 0); - undobuf.previous_undos = undobuf.undos; - } - - /* Fail if an autoincrement side-effect has been duplicated. Be careful - to count all the ways that I2SRC and I1SRC can be used. */ - if ((FIND_REG_INC_NOTE (i2, NULL_RTX) != 0 - && i2_is_used + added_sets_2 > 1) - || (i1 != 0 && FIND_REG_INC_NOTE (i1, NULL_RTX) != 0 - && (n_occurrences + added_sets_1 + (added_sets_2 && ! i1_feeds_i3) - > 1)) - /* Fail if we tried to make a new register (we used to abort, but there's - really no reason to). */ - || max_reg_num () != maxreg - /* Fail if we couldn't do something and have a CLOBBER. */ - || GET_CODE (newpat) == CLOBBER - /* Fail if this new pattern is a MULT and we didn't have one before - at the outer level. */ - || (GET_CODE (newpat) == SET && GET_CODE (SET_SRC (newpat)) == MULT - && ! have_mult)) - { - undo_all (); - return 0; - } - - /* If the actions of the earlier insns must be kept - in addition to substituting them into the latest one, - we must make a new PARALLEL for the latest insn - to hold additional the SETs. */ - - if (added_sets_1 || added_sets_2) - { - combine_extras++; - - if (GET_CODE (newpat) == PARALLEL) - { - rtvec old = XVEC (newpat, 0); - total_sets = XVECLEN (newpat, 0) + added_sets_1 + added_sets_2; - newpat = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (total_sets)); - bcopy ((char *) &old->elem[0], (char *) XVEC (newpat, 0)->elem, - sizeof (old->elem[0]) * old->num_elem); - } - else - { - rtx old = newpat; - total_sets = 1 + added_sets_1 + added_sets_2; - newpat = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (total_sets)); - XVECEXP (newpat, 0, 0) = old; - } - - if (added_sets_1) - XVECEXP (newpat, 0, --total_sets) - = (GET_CODE (PATTERN (i1)) == PARALLEL - ? gen_rtx_SET (VOIDmode, i1dest, i1src) : PATTERN (i1)); - - if (added_sets_2) - { - /* If there is no I1, use I2's body as is. We used to also not do - the subst call below if I2 was substituted into I3, - but that could lose a simplification. */ - if (i1 == 0) - XVECEXP (newpat, 0, --total_sets) = i2pat; - else - /* See comment where i2pat is assigned. */ - XVECEXP (newpat, 0, --total_sets) - = subst (i2pat, i1dest, i1src, 0, 0); - } - } - - /* We come here when we are replacing a destination in I2 with the - destination of I3. */ - validate_replacement: - - /* Note which hard regs this insn has as inputs. */ - mark_used_regs_combine (newpat); - - /* Is the result of combination a valid instruction? */ - insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); - - /* If the result isn't valid, see if it is a PARALLEL of two SETs where - the second SET's destination is a register that is unused. In that case, - we just need the first SET. This can occur when simplifying a divmod - insn. We *must* test for this case here because the code below that - splits two independent SETs doesn't handle this case correctly when it - updates the register status. Also check the case where the first - SET's destination is unused. That would not cause incorrect code, but - does cause an unneeded insn to remain. */ - - if (insn_code_number < 0 && GET_CODE (newpat) == PARALLEL - && XVECLEN (newpat, 0) == 2 - && GET_CODE (XVECEXP (newpat, 0, 0)) == SET - && GET_CODE (XVECEXP (newpat, 0, 1)) == SET - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) == REG - && find_reg_note (i3, REG_UNUSED, SET_DEST (XVECEXP (newpat, 0, 1))) - && ! side_effects_p (SET_SRC (XVECEXP (newpat, 0, 1))) - && asm_noperands (newpat) < 0) - { - newpat = XVECEXP (newpat, 0, 0); - insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); - } - - else if (insn_code_number < 0 && GET_CODE (newpat) == PARALLEL - && XVECLEN (newpat, 0) == 2 - && GET_CODE (XVECEXP (newpat, 0, 0)) == SET - && GET_CODE (XVECEXP (newpat, 0, 1)) == SET - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) == REG - && find_reg_note (i3, REG_UNUSED, SET_DEST (XVECEXP (newpat, 0, 0))) - && ! side_effects_p (SET_SRC (XVECEXP (newpat, 0, 0))) - && asm_noperands (newpat) < 0) - { - newpat = XVECEXP (newpat, 0, 1); - insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); - } - - /* If we were combining three insns and the result is a simple SET - with no ASM_OPERANDS that wasn't recognized, try to split it into two - insns. There are two ways to do this. It can be split using a - machine-specific method (like when you have an addition of a large - constant) or by combine in the function find_split_point. */ - - if (i1 && insn_code_number < 0 && GET_CODE (newpat) == SET - && asm_noperands (newpat) < 0) - { - rtx m_split, *split; - rtx ni2dest = i2dest; - - /* See if the MD file can split NEWPAT. If it can't, see if letting it - use I2DEST as a scratch register will help. In the latter case, - convert I2DEST to the mode of the source of NEWPAT if we can. */ - - m_split = split_insns (newpat, i3); - - /* We can only use I2DEST as a scratch reg if it doesn't overlap any - inputs of NEWPAT. */ - - /* ??? If I2DEST is not safe, and I1DEST exists, then it would be - possible to try that as a scratch reg. This would require adding - more code to make it work though. */ - - if (m_split == 0 && ! reg_overlap_mentioned_p (ni2dest, newpat)) - { - /* If I2DEST is a hard register or the only use of a pseudo, - we can change its mode. */ - if (GET_MODE (SET_DEST (newpat)) != GET_MODE (i2dest) - && GET_MODE (SET_DEST (newpat)) != VOIDmode - && GET_CODE (i2dest) == REG - && (REGNO (i2dest) < FIRST_PSEUDO_REGISTER - || (REG_N_SETS (REGNO (i2dest)) == 1 && ! added_sets_2 - && ! REG_USERVAR_P (i2dest)))) - ni2dest = gen_rtx_REG (GET_MODE (SET_DEST (newpat)), - REGNO (i2dest)); - - m_split = split_insns - (gen_rtx_PARALLEL (VOIDmode, - gen_rtvec (2, newpat, - gen_rtx_CLOBBER (VOIDmode, - ni2dest))), - i3); - } - - if (m_split && GET_CODE (m_split) == SEQUENCE - && XVECLEN (m_split, 0) == 2 - && (next_real_insn (i2) == i3 - || ! use_crosses_set_p (PATTERN (XVECEXP (m_split, 0, 0)), - INSN_CUID (i2)))) - { - rtx i2set, i3set; - rtx newi3pat = PATTERN (XVECEXP (m_split, 0, 1)); - newi2pat = PATTERN (XVECEXP (m_split, 0, 0)); - - i3set = single_set (XVECEXP (m_split, 0, 1)); - i2set = single_set (XVECEXP (m_split, 0, 0)); - - /* In case we changed the mode of I2DEST, replace it in the - pseudo-register table here. We can't do it above in case this - code doesn't get executed and we do a split the other way. */ - - if (REGNO (i2dest) >= FIRST_PSEUDO_REGISTER) - SUBST (regno_reg_rtx[REGNO (i2dest)], ni2dest); - - i2_code_number = recog_for_combine (&newi2pat, i2, &new_i2_notes); - - /* If I2 or I3 has multiple SETs, we won't know how to track - register status, so don't use these insns. If I2's destination - is used between I2 and I3, we also can't use these insns. */ - - if (i2_code_number >= 0 && i2set && i3set - && (next_real_insn (i2) == i3 - || ! reg_used_between_p (SET_DEST (i2set), i2, i3))) - insn_code_number = recog_for_combine (&newi3pat, i3, - &new_i3_notes); - if (insn_code_number >= 0) - newpat = newi3pat; - - /* It is possible that both insns now set the destination of I3. - If so, we must show an extra use of it. */ - - if (insn_code_number >= 0) - { - rtx new_i3_dest = SET_DEST (i3set); - rtx new_i2_dest = SET_DEST (i2set); - - while (GET_CODE (new_i3_dest) == ZERO_EXTRACT - || GET_CODE (new_i3_dest) == STRICT_LOW_PART - || GET_CODE (new_i3_dest) == SUBREG) - new_i3_dest = XEXP (new_i3_dest, 0); - - while (GET_CODE (new_i2_dest) == ZERO_EXTRACT - || GET_CODE (new_i2_dest) == STRICT_LOW_PART - || GET_CODE (new_i2_dest) == SUBREG) - new_i2_dest = XEXP (new_i2_dest, 0); - - if (GET_CODE (new_i3_dest) == REG - && GET_CODE (new_i2_dest) == REG - && REGNO (new_i3_dest) == REGNO (new_i2_dest)) - REG_N_SETS (REGNO (new_i2_dest))++; - } - } - - /* If we can split it and use I2DEST, go ahead and see if that - helps things be recognized. Verify that none of the registers - are set between I2 and I3. */ - if (insn_code_number < 0 && (split = find_split_point (&newpat, i3)) != 0 -#ifdef HAVE_cc0 - && GET_CODE (i2dest) == REG -#endif - /* We need I2DEST in the proper mode. If it is a hard register - or the only use of a pseudo, we can change its mode. */ - && (GET_MODE (*split) == GET_MODE (i2dest) - || GET_MODE (*split) == VOIDmode - || REGNO (i2dest) < FIRST_PSEUDO_REGISTER - || (REG_N_SETS (REGNO (i2dest)) == 1 && ! added_sets_2 - && ! REG_USERVAR_P (i2dest))) - && (next_real_insn (i2) == i3 - || ! use_crosses_set_p (*split, INSN_CUID (i2))) - /* We can't overwrite I2DEST if its value is still used by - NEWPAT. */ - && ! reg_referenced_p (i2dest, newpat)) - { - rtx newdest = i2dest; - enum rtx_code split_code = GET_CODE (*split); - enum machine_mode split_mode = GET_MODE (*split); - - /* Get NEWDEST as a register in the proper mode. We have already - validated that we can do this. */ - if (GET_MODE (i2dest) != split_mode && split_mode != VOIDmode) - { - newdest = gen_rtx_REG (split_mode, REGNO (i2dest)); - - if (REGNO (i2dest) >= FIRST_PSEUDO_REGISTER) - SUBST (regno_reg_rtx[REGNO (i2dest)], newdest); - } - - /* If *SPLIT is a (mult FOO (const_int pow2)), convert it to - an ASHIFT. This can occur if it was inside a PLUS and hence - appeared to be a memory address. This is a kludge. */ - if (split_code == MULT - && GET_CODE (XEXP (*split, 1)) == CONST_INT - && (i = exact_log2 (INTVAL (XEXP (*split, 1)))) >= 0) - { - SUBST (*split, gen_rtx_combine (ASHIFT, split_mode, - XEXP (*split, 0), GEN_INT (i))); - /* Update split_code because we may not have a multiply - anymore. */ - split_code = GET_CODE (*split); - } - -#ifdef INSN_SCHEDULING - /* If *SPLIT is a paradoxical SUBREG, when we split it, it should - be written as a ZERO_EXTEND. */ - if (split_code == SUBREG && GET_CODE (SUBREG_REG (*split)) == MEM) - SUBST (*split, gen_rtx_combine (ZERO_EXTEND, split_mode, - XEXP (*split, 0))); -#endif - - newi2pat = gen_rtx_combine (SET, VOIDmode, newdest, *split); - SUBST (*split, newdest); - i2_code_number = recog_for_combine (&newi2pat, i2, &new_i2_notes); - - /* If the split point was a MULT and we didn't have one before, - don't use one now. */ - if (i2_code_number >= 0 && ! (split_code == MULT && ! have_mult)) - insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); - } - } - - /* Check for a case where we loaded from memory in a narrow mode and - then sign extended it, but we need both registers. In that case, - we have a PARALLEL with both loads from the same memory location. - We can split this into a load from memory followed by a register-register - copy. This saves at least one insn, more if register allocation can - eliminate the copy. - - We cannot do this if the destination of the second assignment is - a register that we have already assumed is zero-extended. Similarly - for a SUBREG of such a register. */ - - else if (i1 && insn_code_number < 0 && asm_noperands (newpat) < 0 - && GET_CODE (newpat) == PARALLEL - && XVECLEN (newpat, 0) == 2 - && GET_CODE (XVECEXP (newpat, 0, 0)) == SET - && GET_CODE (SET_SRC (XVECEXP (newpat, 0, 0))) == SIGN_EXTEND - && GET_CODE (XVECEXP (newpat, 0, 1)) == SET - && rtx_equal_p (SET_SRC (XVECEXP (newpat, 0, 1)), - XEXP (SET_SRC (XVECEXP (newpat, 0, 0)), 0)) - && ! use_crosses_set_p (SET_SRC (XVECEXP (newpat, 0, 1)), - INSN_CUID (i2)) - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != ZERO_EXTRACT - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != STRICT_LOW_PART - && ! (temp = SET_DEST (XVECEXP (newpat, 0, 1)), - (GET_CODE (temp) == REG - && reg_nonzero_bits[REGNO (temp)] != 0 - && GET_MODE_BITSIZE (GET_MODE (temp)) < BITS_PER_WORD - && GET_MODE_BITSIZE (GET_MODE (temp)) < HOST_BITS_PER_INT - && (reg_nonzero_bits[REGNO (temp)] - != GET_MODE_MASK (word_mode)))) - && ! (GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) == SUBREG - && (temp = SUBREG_REG (SET_DEST (XVECEXP (newpat, 0, 1))), - (GET_CODE (temp) == REG - && reg_nonzero_bits[REGNO (temp)] != 0 - && GET_MODE_BITSIZE (GET_MODE (temp)) < BITS_PER_WORD - && GET_MODE_BITSIZE (GET_MODE (temp)) < HOST_BITS_PER_INT - && (reg_nonzero_bits[REGNO (temp)] - != GET_MODE_MASK (word_mode))))) - && ! reg_overlap_mentioned_p (SET_DEST (XVECEXP (newpat, 0, 1)), - SET_SRC (XVECEXP (newpat, 0, 1))) - && ! find_reg_note (i3, REG_UNUSED, - SET_DEST (XVECEXP (newpat, 0, 0)))) - { - rtx ni2dest; - - newi2pat = XVECEXP (newpat, 0, 0); - ni2dest = SET_DEST (XVECEXP (newpat, 0, 0)); - newpat = XVECEXP (newpat, 0, 1); - SUBST (SET_SRC (newpat), - gen_lowpart_for_combine (GET_MODE (SET_SRC (newpat)), ni2dest)); - i2_code_number = recog_for_combine (&newi2pat, i2, &new_i2_notes); - - if (i2_code_number >= 0) - insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); - - if (insn_code_number >= 0) - { - rtx insn; - rtx link; - - /* If we will be able to accept this, we have made a change to the - destination of I3. This can invalidate a LOG_LINKS pointing - to I3. No other part of combine.c makes such a transformation. - - The new I3 will have a destination that was previously the - destination of I1 or I2 and which was used in i2 or I3. Call - distribute_links to make a LOG_LINK from the next use of - that destination. */ - - PATTERN (i3) = newpat; - distribute_links (gen_rtx_INSN_LIST (VOIDmode, i3, NULL_RTX)); - - /* I3 now uses what used to be its destination and which is - now I2's destination. That means we need a LOG_LINK from - I3 to I2. But we used to have one, so we still will. - - However, some later insn might be using I2's dest and have - a LOG_LINK pointing at I3. We must remove this link. - The simplest way to remove the link is to point it at I1, - which we know will be a NOTE. */ - - for (insn = NEXT_INSN (i3); - insn && (this_basic_block == n_basic_blocks - 1 - || insn != BLOCK_HEAD (this_basic_block + 1)); - insn = NEXT_INSN (insn)) - { - if (GET_RTX_CLASS (GET_CODE (insn)) == 'i' - && reg_referenced_p (ni2dest, PATTERN (insn))) - { - for (link = LOG_LINKS (insn); link; - link = XEXP (link, 1)) - if (XEXP (link, 0) == i3) - XEXP (link, 0) = i1; - - break; - } - } - } - } - - /* Similarly, check for a case where we have a PARALLEL of two independent - SETs but we started with three insns. In this case, we can do the sets - as two separate insns. This case occurs when some SET allows two - other insns to combine, but the destination of that SET is still live. */ - - else if (i1 && insn_code_number < 0 && asm_noperands (newpat) < 0 - && GET_CODE (newpat) == PARALLEL - && XVECLEN (newpat, 0) == 2 - && GET_CODE (XVECEXP (newpat, 0, 0)) == SET - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) != ZERO_EXTRACT - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) != STRICT_LOW_PART - && GET_CODE (XVECEXP (newpat, 0, 1)) == SET - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != ZERO_EXTRACT - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != STRICT_LOW_PART - && ! use_crosses_set_p (SET_SRC (XVECEXP (newpat, 0, 1)), - INSN_CUID (i2)) - /* Don't pass sets with (USE (MEM ...)) dests to the following. */ - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 1))) != USE - && GET_CODE (SET_DEST (XVECEXP (newpat, 0, 0))) != USE - && ! reg_referenced_p (SET_DEST (XVECEXP (newpat, 0, 1)), - XVECEXP (newpat, 0, 0)) - && ! reg_referenced_p (SET_DEST (XVECEXP (newpat, 0, 0)), - XVECEXP (newpat, 0, 1))) - { - /* Normally, it doesn't matter which of the two is done first, - but it does if one references cc0. In that case, it has to - be first. */ -#ifdef HAVE_cc0 - if (reg_referenced_p (cc0_rtx, XVECEXP (newpat, 0, 0))) - { - newi2pat = XVECEXP (newpat, 0, 0); - newpat = XVECEXP (newpat, 0, 1); - } - else -#endif - { - newi2pat = XVECEXP (newpat, 0, 1); - newpat = XVECEXP (newpat, 0, 0); - } - - i2_code_number = recog_for_combine (&newi2pat, i2, &new_i2_notes); - - if (i2_code_number >= 0) - insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); - } - - /* If it still isn't recognized, fail and change things back the way they - were. */ - if ((insn_code_number < 0 - /* Is the result a reasonable ASM_OPERANDS? */ - && (! check_asm_operands (newpat) || added_sets_1 || added_sets_2))) - { - undo_all (); - return 0; - } - - /* If we had to change another insn, make sure it is valid also. */ - if (undobuf.other_insn) - { - rtx other_pat = PATTERN (undobuf.other_insn); - rtx new_other_notes; - rtx note, next; - - CLEAR_HARD_REG_SET (newpat_used_regs); - - other_code_number = recog_for_combine (&other_pat, undobuf.other_insn, - &new_other_notes); - - if (other_code_number < 0 && ! check_asm_operands (other_pat)) - { - undo_all (); - return 0; - } - - PATTERN (undobuf.other_insn) = other_pat; - - /* If any of the notes in OTHER_INSN were REG_UNUSED, ensure that they - are still valid. Then add any non-duplicate notes added by - recog_for_combine. */ - for (note = REG_NOTES (undobuf.other_insn); note; note = next) - { - next = XEXP (note, 1); - - if (REG_NOTE_KIND (note) == REG_UNUSED - && ! reg_set_p (XEXP (note, 0), PATTERN (undobuf.other_insn))) - { - if (GET_CODE (XEXP (note, 0)) == REG) - REG_N_DEATHS (REGNO (XEXP (note, 0)))--; - - remove_note (undobuf.other_insn, note); - } - } - - for (note = new_other_notes; note; note = XEXP (note, 1)) - if (GET_CODE (XEXP (note, 0)) == REG) - REG_N_DEATHS (REGNO (XEXP (note, 0)))++; - - distribute_notes (new_other_notes, undobuf.other_insn, - undobuf.other_insn, NULL_RTX, NULL_RTX, NULL_RTX); - } - - /* We now know that we can do this combination. Merge the insns and - update the status of registers and LOG_LINKS. */ - - { - rtx i3notes, i2notes, i1notes = 0; - rtx i3links, i2links, i1links = 0; - rtx midnotes = 0; - register int regno; - /* Compute which registers we expect to eliminate. newi2pat may be setting - either i3dest or i2dest, so we must check it. Also, i1dest may be the - same as i3dest, in which case newi2pat may be setting i1dest. */ - rtx elim_i2 = ((newi2pat && reg_set_p (i2dest, newi2pat)) - || i2dest_in_i2src || i2dest_in_i1src - ? 0 : i2dest); - rtx elim_i1 = (i1 == 0 || i1dest_in_i1src - || (newi2pat && reg_set_p (i1dest, newi2pat)) - ? 0 : i1dest); - - /* Get the old REG_NOTES and LOG_LINKS from all our insns and - clear them. */ - i3notes = REG_NOTES (i3), i3links = LOG_LINKS (i3); - i2notes = REG_NOTES (i2), i2links = LOG_LINKS (i2); - if (i1) - i1notes = REG_NOTES (i1), i1links = LOG_LINKS (i1); - - /* Ensure that we do not have something that should not be shared but - occurs multiple times in the new insns. Check this by first - resetting all the `used' flags and then copying anything is shared. */ - - reset_used_flags (i3notes); - reset_used_flags (i2notes); - reset_used_flags (i1notes); - reset_used_flags (newpat); - reset_used_flags (newi2pat); - if (undobuf.other_insn) - reset_used_flags (PATTERN (undobuf.other_insn)); - - i3notes = copy_rtx_if_shared (i3notes); - i2notes = copy_rtx_if_shared (i2notes); - i1notes = copy_rtx_if_shared (i1notes); - newpat = copy_rtx_if_shared (newpat); - newi2pat = copy_rtx_if_shared (newi2pat); - if (undobuf.other_insn) - reset_used_flags (PATTERN (undobuf.other_insn)); - - INSN_CODE (i3) = insn_code_number; - PATTERN (i3) = newpat; - if (undobuf.other_insn) - INSN_CODE (undobuf.other_insn) = other_code_number; - - /* We had one special case above where I2 had more than one set and - we replaced a destination of one of those sets with the destination - of I3. In that case, we have to update LOG_LINKS of insns later - in this basic block. Note that this (expensive) case is rare. - - Also, in this case, we must pretend that all REG_NOTEs for I2 - actually came from I3, so that REG_UNUSED notes from I2 will be - properly handled. */ - - if (i3_subst_into_i2) - { - for (i = 0; i < XVECLEN (PATTERN (i2), 0); i++) - if (GET_CODE (SET_DEST (XVECEXP (PATTERN (i2), 0, i))) == REG - && SET_DEST (XVECEXP (PATTERN (i2), 0, i)) != i2dest - && ! find_reg_note (i2, REG_UNUSED, - SET_DEST (XVECEXP (PATTERN (i2), 0, i)))) - for (temp = NEXT_INSN (i2); - temp && (this_basic_block == n_basic_blocks - 1 - || BLOCK_HEAD (this_basic_block) != temp); - temp = NEXT_INSN (temp)) - if (temp != i3 && GET_RTX_CLASS (GET_CODE (temp)) == 'i') - for (link = LOG_LINKS (temp); link; link = XEXP (link, 1)) - if (XEXP (link, 0) == i2) - XEXP (link, 0) = i3; - - if (i3notes) - { - rtx link = i3notes; - while (XEXP (link, 1)) - link = XEXP (link, 1); - XEXP (link, 1) = i2notes; - } - else - i3notes = i2notes; - i2notes = 0; - } - - LOG_LINKS (i3) = 0; - REG_NOTES (i3) = 0; - LOG_LINKS (i2) = 0; - REG_NOTES (i2) = 0; - - if (newi2pat) - { - INSN_CODE (i2) = i2_code_number; - PATTERN (i2) = newi2pat; - } - else - { - PUT_CODE (i2, NOTE); - NOTE_LINE_NUMBER (i2) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (i2) = 0; - } - - if (i1) - { - LOG_LINKS (i1) = 0; - REG_NOTES (i1) = 0; - PUT_CODE (i1, NOTE); - NOTE_LINE_NUMBER (i1) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (i1) = 0; - } - - /* Get death notes for everything that is now used in either I3 or - I2 and used to die in a previous insn. If we built two new - patterns, move from I1 to I2 then I2 to I3 so that we get the - proper movement on registers that I2 modifies. */ - - if (newi2pat) - { - move_deaths (newi2pat, NULL_RTX, INSN_CUID (i1), i2, &midnotes); - move_deaths (newpat, newi2pat, INSN_CUID (i1), i3, &midnotes); - } - else - move_deaths (newpat, NULL_RTX, i1 ? INSN_CUID (i1) : INSN_CUID (i2), - i3, &midnotes); - - /* Distribute all the LOG_LINKS and REG_NOTES from I1, I2, and I3. */ - if (i3notes) - distribute_notes (i3notes, i3, i3, newi2pat ? i2 : NULL_RTX, - elim_i2, elim_i1); - if (i2notes) - distribute_notes (i2notes, i2, i3, newi2pat ? i2 : NULL_RTX, - elim_i2, elim_i1); - if (i1notes) - distribute_notes (i1notes, i1, i3, newi2pat ? i2 : NULL_RTX, - elim_i2, elim_i1); - if (midnotes) - distribute_notes (midnotes, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX, - elim_i2, elim_i1); - - /* Distribute any notes added to I2 or I3 by recog_for_combine. We - know these are REG_UNUSED and want them to go to the desired insn, - so we always pass it as i3. We have not counted the notes in - reg_n_deaths yet, so we need to do so now. */ - - if (newi2pat && new_i2_notes) - { - for (temp = new_i2_notes; temp; temp = XEXP (temp, 1)) - if (GET_CODE (XEXP (temp, 0)) == REG) - REG_N_DEATHS (REGNO (XEXP (temp, 0)))++; - - distribute_notes (new_i2_notes, i2, i2, NULL_RTX, NULL_RTX, NULL_RTX); - } - - if (new_i3_notes) - { - for (temp = new_i3_notes; temp; temp = XEXP (temp, 1)) - if (GET_CODE (XEXP (temp, 0)) == REG) - REG_N_DEATHS (REGNO (XEXP (temp, 0)))++; - - distribute_notes (new_i3_notes, i3, i3, NULL_RTX, NULL_RTX, NULL_RTX); - } - - /* If I3DEST was used in I3SRC, it really died in I3. We may need to - put a REG_DEAD note for it somewhere. If NEWI2PAT exists and sets - I3DEST, the death must be somewhere before I2, not I3. If we passed I3 - in that case, it might delete I2. Similarly for I2 and I1. - Show an additional death due to the REG_DEAD note we make here. If - we discard it in distribute_notes, we will decrement it again. */ - - if (i3dest_killed) - { - if (GET_CODE (i3dest_killed) == REG) - REG_N_DEATHS (REGNO (i3dest_killed))++; - - if (newi2pat && reg_set_p (i3dest_killed, newi2pat)) - distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i3dest_killed, - NULL_RTX), - NULL_RTX, i2, NULL_RTX, elim_i2, elim_i1); - else - distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i3dest_killed, - NULL_RTX), - NULL_RTX, i3, newi2pat ? i2 : NULL_RTX, - elim_i2, elim_i1); - } - - if (i2dest_in_i2src) - { - if (GET_CODE (i2dest) == REG) - REG_N_DEATHS (REGNO (i2dest))++; - - if (newi2pat && reg_set_p (i2dest, newi2pat)) - distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i2dest, NULL_RTX), - NULL_RTX, i2, NULL_RTX, NULL_RTX, NULL_RTX); - else - distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i2dest, NULL_RTX), - NULL_RTX, i3, newi2pat ? i2 : NULL_RTX, - NULL_RTX, NULL_RTX); - } - - if (i1dest_in_i1src) - { - if (GET_CODE (i1dest) == REG) - REG_N_DEATHS (REGNO (i1dest))++; - - if (newi2pat && reg_set_p (i1dest, newi2pat)) - distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i1dest, NULL_RTX), - NULL_RTX, i2, NULL_RTX, NULL_RTX, NULL_RTX); - else - distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i1dest, NULL_RTX), - NULL_RTX, i3, newi2pat ? i2 : NULL_RTX, - NULL_RTX, NULL_RTX); - } - - distribute_links (i3links); - distribute_links (i2links); - distribute_links (i1links); - - if (GET_CODE (i2dest) == REG) - { - rtx link; - rtx i2_insn = 0, i2_val = 0, set; - - /* The insn that used to set this register doesn't exist, and - this life of the register may not exist either. See if one of - I3's links points to an insn that sets I2DEST. If it does, - that is now the last known value for I2DEST. If we don't update - this and I2 set the register to a value that depended on its old - contents, we will get confused. If this insn is used, thing - will be set correctly in combine_instructions. */ - - for (link = LOG_LINKS (i3); link; link = XEXP (link, 1)) - if ((set = single_set (XEXP (link, 0))) != 0 - && rtx_equal_p (i2dest, SET_DEST (set))) - i2_insn = XEXP (link, 0), i2_val = SET_SRC (set); - - record_value_for_reg (i2dest, i2_insn, i2_val); - - /* If the reg formerly set in I2 died only once and that was in I3, - zero its use count so it won't make `reload' do any work. */ - if (! added_sets_2 - && (newi2pat == 0 || ! reg_mentioned_p (i2dest, newi2pat)) - && ! i2dest_in_i2src) - { - regno = REGNO (i2dest); - REG_N_SETS (regno)--; - if (REG_N_SETS (regno) == 0 - && ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, - regno)) - REG_N_REFS (regno) = 0; - } - } - - if (i1 && GET_CODE (i1dest) == REG) - { - rtx link; - rtx i1_insn = 0, i1_val = 0, set; - - for (link = LOG_LINKS (i3); link; link = XEXP (link, 1)) - if ((set = single_set (XEXP (link, 0))) != 0 - && rtx_equal_p (i1dest, SET_DEST (set))) - i1_insn = XEXP (link, 0), i1_val = SET_SRC (set); - - record_value_for_reg (i1dest, i1_insn, i1_val); - - regno = REGNO (i1dest); - if (! added_sets_1 && ! i1dest_in_i1src) - { - REG_N_SETS (regno)--; - if (REG_N_SETS (regno) == 0 - && ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, - regno)) - REG_N_REFS (regno) = 0; - } - } - - /* Update reg_nonzero_bits et al for any changes that may have been made - to this insn. */ - - note_stores (newpat, set_nonzero_bits_and_sign_copies); - if (newi2pat) - note_stores (newi2pat, set_nonzero_bits_and_sign_copies); - - /* If I3 is now an unconditional jump, ensure that it has a - BARRIER following it since it may have initially been a - conditional jump. It may also be the last nonnote insn. */ - - if ((GET_CODE (newpat) == RETURN || simplejump_p (i3)) - && ((temp = next_nonnote_insn (i3)) == NULL_RTX - || GET_CODE (temp) != BARRIER)) - emit_barrier_after (i3); - } - - combine_successes++; - - /* Clear this here, so that subsequent get_last_value calls are not - affected. */ - subst_prev_insn = NULL_RTX; - - if (added_links_insn - && (newi2pat == 0 || INSN_CUID (added_links_insn) < INSN_CUID (i2)) - && INSN_CUID (added_links_insn) < INSN_CUID (i3)) - return added_links_insn; - else - return newi2pat ? i2 : i3; -} - -/* Undo all the modifications recorded in undobuf. */ - -static void -undo_all () -{ - struct undo *undo, *next; - - for (undo = undobuf.undos; undo; undo = next) - { - next = undo->next; - if (undo->is_int) - *undo->where.i = undo->old_contents.i; - else - *undo->where.r = undo->old_contents.r; - - undo->next = undobuf.frees; - undobuf.frees = undo; - } - - obfree (undobuf.storage); - undobuf.undos = undobuf.previous_undos = 0; - - /* Clear this here, so that subsequent get_last_value calls are not - affected. */ - subst_prev_insn = NULL_RTX; -} - -/* Find the innermost point within the rtx at LOC, possibly LOC itself, - where we have an arithmetic expression and return that point. LOC will - be inside INSN. - - try_combine will call this function to see if an insn can be split into - two insns. */ - -static rtx * -find_split_point (loc, insn) - rtx *loc; - rtx insn; -{ - rtx x = *loc; - enum rtx_code code = GET_CODE (x); - rtx *split; - int len = 0, pos, unsignedp; - rtx inner; - - /* First special-case some codes. */ - switch (code) - { - case SUBREG: -#ifdef INSN_SCHEDULING - /* If we are making a paradoxical SUBREG invalid, it becomes a split - point. */ - if (GET_CODE (SUBREG_REG (x)) == MEM) - return loc; -#endif - return find_split_point (&SUBREG_REG (x), insn); - - case MEM: -#ifdef HAVE_lo_sum - /* If we have (mem (const ..)) or (mem (symbol_ref ...)), split it - using LO_SUM and HIGH. */ - if (GET_CODE (XEXP (x, 0)) == CONST - || GET_CODE (XEXP (x, 0)) == SYMBOL_REF) - { - SUBST (XEXP (x, 0), - gen_rtx_combine (LO_SUM, Pmode, - gen_rtx_combine (HIGH, Pmode, XEXP (x, 0)), - XEXP (x, 0))); - return &XEXP (XEXP (x, 0), 0); - } -#endif - - /* If we have a PLUS whose second operand is a constant and the - address is not valid, perhaps will can split it up using - the machine-specific way to split large constants. We use - the first pseudo-reg (one of the virtual regs) as a placeholder; - it will not remain in the result. */ - if (GET_CODE (XEXP (x, 0)) == PLUS - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && ! memory_address_p (GET_MODE (x), XEXP (x, 0))) - { - rtx reg = regno_reg_rtx[FIRST_PSEUDO_REGISTER]; - rtx seq = split_insns (gen_rtx_SET (VOIDmode, reg, XEXP (x, 0)), - subst_insn); - - /* This should have produced two insns, each of which sets our - placeholder. If the source of the second is a valid address, - we can make put both sources together and make a split point - in the middle. */ - - if (seq && XVECLEN (seq, 0) == 2 - && GET_CODE (XVECEXP (seq, 0, 0)) == INSN - && GET_CODE (PATTERN (XVECEXP (seq, 0, 0))) == SET - && SET_DEST (PATTERN (XVECEXP (seq, 0, 0))) == reg - && ! reg_mentioned_p (reg, - SET_SRC (PATTERN (XVECEXP (seq, 0, 0)))) - && GET_CODE (XVECEXP (seq, 0, 1)) == INSN - && GET_CODE (PATTERN (XVECEXP (seq, 0, 1))) == SET - && SET_DEST (PATTERN (XVECEXP (seq, 0, 1))) == reg - && memory_address_p (GET_MODE (x), - SET_SRC (PATTERN (XVECEXP (seq, 0, 1))))) - { - rtx src1 = SET_SRC (PATTERN (XVECEXP (seq, 0, 0))); - rtx src2 = SET_SRC (PATTERN (XVECEXP (seq, 0, 1))); - - /* Replace the placeholder in SRC2 with SRC1. If we can - find where in SRC2 it was placed, that can become our - split point and we can replace this address with SRC2. - Just try two obvious places. */ - - src2 = replace_rtx (src2, reg, src1); - split = 0; - if (XEXP (src2, 0) == src1) - split = &XEXP (src2, 0); - else if (GET_RTX_FORMAT (GET_CODE (XEXP (src2, 0)))[0] == 'e' - && XEXP (XEXP (src2, 0), 0) == src1) - split = &XEXP (XEXP (src2, 0), 0); - - if (split) - { - SUBST (XEXP (x, 0), src2); - return split; - } - } - - /* If that didn't work, perhaps the first operand is complex and - needs to be computed separately, so make a split point there. - This will occur on machines that just support REG + CONST - and have a constant moved through some previous computation. */ - - else if (GET_RTX_CLASS (GET_CODE (XEXP (XEXP (x, 0), 0))) != 'o' - && ! (GET_CODE (XEXP (XEXP (x, 0), 0)) == SUBREG - && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (XEXP (x, 0), 0)))) - == 'o'))) - return &XEXP (XEXP (x, 0), 0); - } - break; - - case SET: -#ifdef HAVE_cc0 - /* If SET_DEST is CC0 and SET_SRC is not an operand, a COMPARE, or a - ZERO_EXTRACT, the most likely reason why this doesn't match is that - we need to put the operand into a register. So split at that - point. */ - - if (SET_DEST (x) == cc0_rtx - && GET_CODE (SET_SRC (x)) != COMPARE - && GET_CODE (SET_SRC (x)) != ZERO_EXTRACT - && GET_RTX_CLASS (GET_CODE (SET_SRC (x))) != 'o' - && ! (GET_CODE (SET_SRC (x)) == SUBREG - && GET_RTX_CLASS (GET_CODE (SUBREG_REG (SET_SRC (x)))) == 'o')) - return &SET_SRC (x); -#endif - - /* See if we can split SET_SRC as it stands. */ - split = find_split_point (&SET_SRC (x), insn); - if (split && split != &SET_SRC (x)) - return split; - - /* See if we can split SET_DEST as it stands. */ - split = find_split_point (&SET_DEST (x), insn); - if (split && split != &SET_DEST (x)) - return split; - - /* See if this is a bitfield assignment with everything constant. If - so, this is an IOR of an AND, so split it into that. */ - if (GET_CODE (SET_DEST (x)) == ZERO_EXTRACT - && (GET_MODE_BITSIZE (GET_MODE (XEXP (SET_DEST (x), 0))) - <= HOST_BITS_PER_WIDE_INT) - && GET_CODE (XEXP (SET_DEST (x), 1)) == CONST_INT - && GET_CODE (XEXP (SET_DEST (x), 2)) == CONST_INT - && GET_CODE (SET_SRC (x)) == CONST_INT - && ((INTVAL (XEXP (SET_DEST (x), 1)) - + INTVAL (XEXP (SET_DEST (x), 2))) - <= GET_MODE_BITSIZE (GET_MODE (XEXP (SET_DEST (x), 0)))) - && ! side_effects_p (XEXP (SET_DEST (x), 0))) - { - int pos = INTVAL (XEXP (SET_DEST (x), 2)); - int len = INTVAL (XEXP (SET_DEST (x), 1)); - int src = INTVAL (SET_SRC (x)); - rtx dest = XEXP (SET_DEST (x), 0); - enum machine_mode mode = GET_MODE (dest); - unsigned HOST_WIDE_INT mask = ((HOST_WIDE_INT) 1 << len) - 1; - - if (BITS_BIG_ENDIAN) - pos = GET_MODE_BITSIZE (mode) - len - pos; - - if ((unsigned HOST_WIDE_INT) src == mask) - SUBST (SET_SRC (x), - gen_binary (IOR, mode, dest, GEN_INT (src << pos))); - else - SUBST (SET_SRC (x), - gen_binary (IOR, mode, - gen_binary (AND, mode, dest, - GEN_INT (~ (mask << pos) - & GET_MODE_MASK (mode))), - GEN_INT (src << pos))); - - SUBST (SET_DEST (x), dest); - - split = find_split_point (&SET_SRC (x), insn); - if (split && split != &SET_SRC (x)) - return split; - } - - /* Otherwise, see if this is an operation that we can split into two. - If so, try to split that. */ - code = GET_CODE (SET_SRC (x)); - - switch (code) - { - case AND: - /* If we are AND'ing with a large constant that is only a single - bit and the result is only being used in a context where we - need to know if it is zero or non-zero, replace it with a bit - extraction. This will avoid the large constant, which might - have taken more than one insn to make. If the constant were - not a valid argument to the AND but took only one insn to make, - this is no worse, but if it took more than one insn, it will - be better. */ - - if (GET_CODE (XEXP (SET_SRC (x), 1)) == CONST_INT - && GET_CODE (XEXP (SET_SRC (x), 0)) == REG - && (pos = exact_log2 (INTVAL (XEXP (SET_SRC (x), 1)))) >= 7 - && GET_CODE (SET_DEST (x)) == REG - && (split = find_single_use (SET_DEST (x), insn, NULL_PTR)) != 0 - && (GET_CODE (*split) == EQ || GET_CODE (*split) == NE) - && XEXP (*split, 0) == SET_DEST (x) - && XEXP (*split, 1) == const0_rtx) - { - rtx extraction = make_extraction (GET_MODE (SET_DEST (x)), - XEXP (SET_SRC (x), 0), - pos, NULL_RTX, 1, 1, 0, 0); - if (extraction != 0) - { - SUBST (SET_SRC (x), extraction); - return find_split_point (loc, insn); - } - } - break; - - case NE: - /* if STORE_FLAG_VALUE is -1, this is (NE X 0) and only one bit of X - is known to be on, this can be converted into a NEG of a shift. */ - if (STORE_FLAG_VALUE == -1 && XEXP (SET_SRC (x), 1) == const0_rtx - && GET_MODE (SET_SRC (x)) == GET_MODE (XEXP (SET_SRC (x), 0)) - && 1 <= (pos = exact_log2 - (nonzero_bits (XEXP (SET_SRC (x), 0), - GET_MODE (XEXP (SET_SRC (x), 0)))))) - { - enum machine_mode mode = GET_MODE (XEXP (SET_SRC (x), 0)); - - SUBST (SET_SRC (x), - gen_rtx_combine (NEG, mode, - gen_rtx_combine (LSHIFTRT, mode, - XEXP (SET_SRC (x), 0), - GEN_INT (pos)))); - - split = find_split_point (&SET_SRC (x), insn); - if (split && split != &SET_SRC (x)) - return split; - } - break; - - case SIGN_EXTEND: - inner = XEXP (SET_SRC (x), 0); - - /* We can't optimize if either mode is a partial integer - mode as we don't know how many bits are significant - in those modes. */ - if (GET_MODE_CLASS (GET_MODE (inner)) == MODE_PARTIAL_INT - || GET_MODE_CLASS (GET_MODE (SET_SRC (x))) == MODE_PARTIAL_INT) - break; - - pos = 0; - len = GET_MODE_BITSIZE (GET_MODE (inner)); - unsignedp = 0; - break; - - case SIGN_EXTRACT: - case ZERO_EXTRACT: - if (GET_CODE (XEXP (SET_SRC (x), 1)) == CONST_INT - && GET_CODE (XEXP (SET_SRC (x), 2)) == CONST_INT) - { - inner = XEXP (SET_SRC (x), 0); - len = INTVAL (XEXP (SET_SRC (x), 1)); - pos = INTVAL (XEXP (SET_SRC (x), 2)); - - if (BITS_BIG_ENDIAN) - pos = GET_MODE_BITSIZE (GET_MODE (inner)) - len - pos; - unsignedp = (code == ZERO_EXTRACT); - } - break; - - default: - break; - } - - if (len && pos >= 0 && pos + len <= GET_MODE_BITSIZE (GET_MODE (inner))) - { - enum machine_mode mode = GET_MODE (SET_SRC (x)); - - /* For unsigned, we have a choice of a shift followed by an - AND or two shifts. Use two shifts for field sizes where the - constant might be too large. We assume here that we can - always at least get 8-bit constants in an AND insn, which is - true for every current RISC. */ - - if (unsignedp && len <= 8) - { - SUBST (SET_SRC (x), - gen_rtx_combine - (AND, mode, - gen_rtx_combine (LSHIFTRT, mode, - gen_lowpart_for_combine (mode, inner), - GEN_INT (pos)), - GEN_INT (((HOST_WIDE_INT) 1 << len) - 1))); - - split = find_split_point (&SET_SRC (x), insn); - if (split && split != &SET_SRC (x)) - return split; - } - else - { - SUBST (SET_SRC (x), - gen_rtx_combine - (unsignedp ? LSHIFTRT : ASHIFTRT, mode, - gen_rtx_combine (ASHIFT, mode, - gen_lowpart_for_combine (mode, inner), - GEN_INT (GET_MODE_BITSIZE (mode) - - len - pos)), - GEN_INT (GET_MODE_BITSIZE (mode) - len))); - - split = find_split_point (&SET_SRC (x), insn); - if (split && split != &SET_SRC (x)) - return split; - } - } - - /* See if this is a simple operation with a constant as the second - operand. It might be that this constant is out of range and hence - could be used as a split point. */ - if ((GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '2' - || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == 'c' - || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '<') - && CONSTANT_P (XEXP (SET_SRC (x), 1)) - && (GET_RTX_CLASS (GET_CODE (XEXP (SET_SRC (x), 0))) == 'o' - || (GET_CODE (XEXP (SET_SRC (x), 0)) == SUBREG - && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (SET_SRC (x), 0)))) - == 'o')))) - return &XEXP (SET_SRC (x), 1); - - /* Finally, see if this is a simple operation with its first operand - not in a register. The operation might require this operand in a - register, so return it as a split point. We can always do this - because if the first operand were another operation, we would have - already found it as a split point. */ - if ((GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '2' - || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == 'c' - || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '<' - || GET_RTX_CLASS (GET_CODE (SET_SRC (x))) == '1') - && ! register_operand (XEXP (SET_SRC (x), 0), VOIDmode)) - return &XEXP (SET_SRC (x), 0); - - return 0; - - case AND: - case IOR: - /* We write NOR as (and (not A) (not B)), but if we don't have a NOR, - it is better to write this as (not (ior A B)) so we can split it. - Similarly for IOR. */ - if (GET_CODE (XEXP (x, 0)) == NOT && GET_CODE (XEXP (x, 1)) == NOT) - { - SUBST (*loc, - gen_rtx_combine (NOT, GET_MODE (x), - gen_rtx_combine (code == IOR ? AND : IOR, - GET_MODE (x), - XEXP (XEXP (x, 0), 0), - XEXP (XEXP (x, 1), 0)))); - return find_split_point (loc, insn); - } - - /* Many RISC machines have a large set of logical insns. If the - second operand is a NOT, put it first so we will try to split the - other operand first. */ - if (GET_CODE (XEXP (x, 1)) == NOT) - { - rtx tem = XEXP (x, 0); - SUBST (XEXP (x, 0), XEXP (x, 1)); - SUBST (XEXP (x, 1), tem); - } - break; - - default: - break; - } - - /* Otherwise, select our actions depending on our rtx class. */ - switch (GET_RTX_CLASS (code)) - { - case 'b': /* This is ZERO_EXTRACT and SIGN_EXTRACT. */ - case '3': - split = find_split_point (&XEXP (x, 2), insn); - if (split) - return split; - /* ... fall through ... */ - case '2': - case 'c': - case '<': - split = find_split_point (&XEXP (x, 1), insn); - if (split) - return split; - /* ... fall through ... */ - case '1': - /* Some machines have (and (shift ...) ...) insns. If X is not - an AND, but XEXP (X, 0) is, use it as our split point. */ - if (GET_CODE (x) != AND && GET_CODE (XEXP (x, 0)) == AND) - return &XEXP (x, 0); - - split = find_split_point (&XEXP (x, 0), insn); - if (split) - return split; - return loc; - } - - /* Otherwise, we don't have a split point. */ - return 0; -} - -/* Throughout X, replace FROM with TO, and return the result. - The result is TO if X is FROM; - otherwise the result is X, but its contents may have been modified. - If they were modified, a record was made in undobuf so that - undo_all will (among other things) return X to its original state. - - If the number of changes necessary is too much to record to undo, - the excess changes are not made, so the result is invalid. - The changes already made can still be undone. - undobuf.num_undo is incremented for such changes, so by testing that - the caller can tell whether the result is valid. - - `n_occurrences' is incremented each time FROM is replaced. - - IN_DEST is non-zero if we are processing the SET_DEST of a SET. - - UNIQUE_COPY is non-zero if each substitution must be unique. We do this - by copying if `n_occurrences' is non-zero. */ - -static rtx -subst (x, from, to, in_dest, unique_copy) - register rtx x, from, to; - int in_dest; - int unique_copy; -{ - register enum rtx_code code = GET_CODE (x); - enum machine_mode op0_mode = VOIDmode; - register char *fmt; - register int len, i; - rtx new; - -/* Two expressions are equal if they are identical copies of a shared - RTX or if they are both registers with the same register number - and mode. */ - -#define COMBINE_RTX_EQUAL_P(X,Y) \ - ((X) == (Y) \ - || (GET_CODE (X) == REG && GET_CODE (Y) == REG \ - && REGNO (X) == REGNO (Y) && GET_MODE (X) == GET_MODE (Y))) - - if (! in_dest && COMBINE_RTX_EQUAL_P (x, from)) - { - n_occurrences++; - return (unique_copy && n_occurrences > 1 ? copy_rtx (to) : to); - } - - /* If X and FROM are the same register but different modes, they will - not have been seen as equal above. However, flow.c will make a - LOG_LINKS entry for that case. If we do nothing, we will try to - rerecognize our original insn and, when it succeeds, we will - delete the feeding insn, which is incorrect. - - So force this insn not to match in this (rare) case. */ - if (! in_dest && code == REG && GET_CODE (from) == REG - && REGNO (x) == REGNO (from)) - return gen_rtx_CLOBBER (GET_MODE (x), const0_rtx); - - /* If this is an object, we are done unless it is a MEM or LO_SUM, both - of which may contain things that can be combined. */ - if (code != MEM && code != LO_SUM && GET_RTX_CLASS (code) == 'o') - return x; - - /* It is possible to have a subexpression appear twice in the insn. - Suppose that FROM is a register that appears within TO. - Then, after that subexpression has been scanned once by `subst', - the second time it is scanned, TO may be found. If we were - to scan TO here, we would find FROM within it and create a - self-referent rtl structure which is completely wrong. */ - if (COMBINE_RTX_EQUAL_P (x, to)) - return to; - - /* Parallel asm_operands need special attention because all of the - inputs are shared across the arms. Furthermore, unsharing the - rtl results in recognition failures. Failure to handle this case - specially can result in circular rtl. - - Solve this by doing a normal pass across the first entry of the - parallel, and only processing the SET_DESTs of the subsequent - entries. Ug. */ - - if (code == PARALLEL - && GET_CODE (XVECEXP (x, 0, 0)) == SET - && GET_CODE (SET_SRC (XVECEXP (x, 0, 0))) == ASM_OPERANDS) - { - new = subst (XVECEXP (x, 0, 0), from, to, 0, unique_copy); - - /* If this substitution failed, this whole thing fails. */ - if (GET_CODE (new) == CLOBBER - && XEXP (new, 0) == const0_rtx) - return new; - - SUBST (XVECEXP (x, 0, 0), new); - - for (i = XVECLEN (x, 0) - 1; i >= 1; i--) - { - rtx dest = SET_DEST (XVECEXP (x, 0, i)); - - if (GET_CODE (dest) != REG - && GET_CODE (dest) != CC0 - && GET_CODE (dest) != PC) - { - new = subst (dest, from, to, 0, unique_copy); - - /* If this substitution failed, this whole thing fails. */ - if (GET_CODE (new) == CLOBBER - && XEXP (new, 0) == const0_rtx) - return new; - - SUBST (SET_DEST (XVECEXP (x, 0, i)), new); - } - } - } - else - { - len = GET_RTX_LENGTH (code); - fmt = GET_RTX_FORMAT (code); - - /* We don't need to process a SET_DEST that is a register, CC0, - or PC, so set up to skip this common case. All other cases - where we want to suppress replacing something inside a - SET_SRC are handled via the IN_DEST operand. */ - if (code == SET - && (GET_CODE (SET_DEST (x)) == REG - || GET_CODE (SET_DEST (x)) == CC0 - || GET_CODE (SET_DEST (x)) == PC)) - fmt = "ie"; - - /* Get the mode of operand 0 in case X is now a SIGN_EXTEND of a - constant. */ - if (fmt[0] == 'e') - op0_mode = GET_MODE (XEXP (x, 0)); - - for (i = 0; i < len; i++) - { - if (fmt[i] == 'E') - { - register int j; - for (j = XVECLEN (x, i) - 1; j >= 0; j--) - { - if (COMBINE_RTX_EQUAL_P (XVECEXP (x, i, j), from)) - { - new = (unique_copy && n_occurrences - ? copy_rtx (to) : to); - n_occurrences++; - } - else - { - new = subst (XVECEXP (x, i, j), from, to, 0, - unique_copy); - - /* If this substitution failed, this whole thing - fails. */ - if (GET_CODE (new) == CLOBBER - && XEXP (new, 0) == const0_rtx) - return new; - } - - SUBST (XVECEXP (x, i, j), new); - } - } - else if (fmt[i] == 'e') - { - if (COMBINE_RTX_EQUAL_P (XEXP (x, i), from)) - { - /* In general, don't install a subreg involving two - modes not tieable. It can worsen register - allocation, and can even make invalid reload - insns, since the reg inside may need to be copied - from in the outside mode, and that may be invalid - if it is an fp reg copied in integer mode. - - We allow two exceptions to this: It is valid if - it is inside another SUBREG and the mode of that - SUBREG and the mode of the inside of TO is - tieable and it is valid if X is a SET that copies - FROM to CC0. */ - - if (GET_CODE (to) == SUBREG - && ! MODES_TIEABLE_P (GET_MODE (to), - GET_MODE (SUBREG_REG (to))) - && ! (code == SUBREG - && MODES_TIEABLE_P (GET_MODE (x), - GET_MODE (SUBREG_REG (to)))) -#ifdef HAVE_cc0 - && ! (code == SET && i == 1 && XEXP (x, 0) == cc0_rtx) -#endif - ) - return gen_rtx_CLOBBER (VOIDmode, const0_rtx); - - new = (unique_copy && n_occurrences ? copy_rtx (to) : to); - n_occurrences++; - } - else - /* If we are in a SET_DEST, suppress most cases unless we - have gone inside a MEM, in which case we want to - simplify the address. We assume here that things that - are actually part of the destination have their inner - parts in the first expression. This is true for SUBREG, - STRICT_LOW_PART, and ZERO_EXTRACT, which are the only - things aside from REG and MEM that should appear in a - SET_DEST. */ - new = subst (XEXP (x, i), from, to, - (((in_dest - && (code == SUBREG || code == STRICT_LOW_PART - || code == ZERO_EXTRACT)) - || code == SET) - && i == 0), unique_copy); - - /* If we found that we will have to reject this combination, - indicate that by returning the CLOBBER ourselves, rather than - an expression containing it. This will speed things up as - well as prevent accidents where two CLOBBERs are considered - to be equal, thus producing an incorrect simplification. */ - - if (GET_CODE (new) == CLOBBER && XEXP (new, 0) == const0_rtx) - return new; - - SUBST (XEXP (x, i), new); - } - } - } - - /* Try to simplify X. If the simplification changed the code, it is likely - that further simplification will help, so loop, but limit the number - of repetitions that will be performed. */ - - for (i = 0; i < 4; i++) - { - /* If X is sufficiently simple, don't bother trying to do anything - with it. */ - if (code != CONST_INT && code != REG && code != CLOBBER) - x = simplify_rtx (x, op0_mode, i == 3, in_dest); - - if (GET_CODE (x) == code) - break; - - code = GET_CODE (x); - - /* We no longer know the original mode of operand 0 since we - have changed the form of X) */ - op0_mode = VOIDmode; - } - - return x; -} - -/* Simplify X, a piece of RTL. We just operate on the expression at the - outer level; call `subst' to simplify recursively. Return the new - expression. - - OP0_MODE is the original mode of XEXP (x, 0); LAST is nonzero if this - will be the iteration even if an expression with a code different from - X is returned; IN_DEST is nonzero if we are inside a SET_DEST. */ - -static rtx -simplify_rtx (x, op0_mode, last, in_dest) - rtx x; - enum machine_mode op0_mode; - int last; - int in_dest; -{ - enum rtx_code code = GET_CODE (x); - enum machine_mode mode = GET_MODE (x); - rtx temp; - int i; - - /* If this is a commutative operation, put a constant last and a complex - expression first. We don't need to do this for comparisons here. */ - if (GET_RTX_CLASS (code) == 'c' - && ((CONSTANT_P (XEXP (x, 0)) && GET_CODE (XEXP (x, 1)) != CONST_INT) - || (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == 'o' - && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o') - || (GET_CODE (XEXP (x, 0)) == SUBREG - && GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) == 'o' - && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o'))) - { - temp = XEXP (x, 0); - SUBST (XEXP (x, 0), XEXP (x, 1)); - SUBST (XEXP (x, 1), temp); - } - - /* If this is a PLUS, MINUS, or MULT, and the first operand is the - sign extension of a PLUS with a constant, reverse the order of the sign - extension and the addition. Note that this not the same as the original - code, but overflow is undefined for signed values. Also note that the - PLUS will have been partially moved "inside" the sign-extension, so that - the first operand of X will really look like: - (ashiftrt (plus (ashift A C4) C5) C4). - We convert this to - (plus (ashiftrt (ashift A C4) C2) C4) - and replace the first operand of X with that expression. Later parts - of this function may simplify the expression further. - - For example, if we start with (mult (sign_extend (plus A C1)) C2), - we swap the SIGN_EXTEND and PLUS. Later code will apply the - distributive law to produce (plus (mult (sign_extend X) C1) C3). - - We do this to simplify address expressions. */ - - if ((code == PLUS || code == MINUS || code == MULT) - && GET_CODE (XEXP (x, 0)) == ASHIFTRT - && GET_CODE (XEXP (XEXP (x, 0), 0)) == PLUS - && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == ASHIFT - && GET_CODE (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 1)) == CONST_INT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 1) == XEXP (XEXP (x, 0), 1) - && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == CONST_INT - && (temp = simplify_binary_operation (ASHIFTRT, mode, - XEXP (XEXP (XEXP (x, 0), 0), 1), - XEXP (XEXP (x, 0), 1))) != 0) - { - rtx new - = simplify_shift_const (NULL_RTX, ASHIFT, mode, - XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 0), - INTVAL (XEXP (XEXP (x, 0), 1))); - - new = simplify_shift_const (NULL_RTX, ASHIFTRT, mode, new, - INTVAL (XEXP (XEXP (x, 0), 1))); - - SUBST (XEXP (x, 0), gen_binary (PLUS, mode, new, temp)); - } - - /* If this is a simple operation applied to an IF_THEN_ELSE, try - applying it to the arms of the IF_THEN_ELSE. This often simplifies - things. Check for cases where both arms are testing the same - condition. - - Don't do anything if all operands are very simple. */ - - if (((GET_RTX_CLASS (code) == '2' || GET_RTX_CLASS (code) == 'c' - || GET_RTX_CLASS (code) == '<') - && ((GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) != 'o' - && ! (GET_CODE (XEXP (x, 0)) == SUBREG - && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) - == 'o'))) - || (GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o' - && ! (GET_CODE (XEXP (x, 1)) == SUBREG - && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 1)))) - == 'o'))))) - || (GET_RTX_CLASS (code) == '1' - && ((GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) != 'o' - && ! (GET_CODE (XEXP (x, 0)) == SUBREG - && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) - == 'o')))))) - { - rtx cond, true, false; - - cond = if_then_else_cond (x, &true, &false); - if (cond != 0 - /* If everything is a comparison, what we have is highly unlikely - to be simpler, so don't use it. */ - && ! (GET_RTX_CLASS (code) == '<' - && (GET_RTX_CLASS (GET_CODE (true)) == '<' - || GET_RTX_CLASS (GET_CODE (false)) == '<'))) - { - rtx cop1 = const0_rtx; - enum rtx_code cond_code = simplify_comparison (NE, &cond, &cop1); - - if (cond_code == NE && GET_RTX_CLASS (GET_CODE (cond)) == '<') - return x; - - /* Simplify the alternative arms; this may collapse the true and - false arms to store-flag values. */ - true = subst (true, pc_rtx, pc_rtx, 0, 0); - false = subst (false, pc_rtx, pc_rtx, 0, 0); - - /* Restarting if we generate a store-flag expression will cause - us to loop. Just drop through in this case. */ - - /* If the result values are STORE_FLAG_VALUE and zero, we can - just make the comparison operation. */ - if (true == const_true_rtx && false == const0_rtx) - x = gen_binary (cond_code, mode, cond, cop1); - else if (true == const0_rtx && false == const_true_rtx) - x = gen_binary (reverse_condition (cond_code), mode, cond, cop1); - - /* Likewise, we can make the negate of a comparison operation - if the result values are - STORE_FLAG_VALUE and zero. */ - else if (GET_CODE (true) == CONST_INT - && INTVAL (true) == - STORE_FLAG_VALUE - && false == const0_rtx) - x = gen_unary (NEG, mode, mode, - gen_binary (cond_code, mode, cond, cop1)); - else if (GET_CODE (false) == CONST_INT - && INTVAL (false) == - STORE_FLAG_VALUE - && true == const0_rtx) - x = gen_unary (NEG, mode, mode, - gen_binary (reverse_condition (cond_code), - mode, cond, cop1)); - else - return gen_rtx_IF_THEN_ELSE (mode, - gen_binary (cond_code, VOIDmode, - cond, cop1), - true, false); - - code = GET_CODE (x); - op0_mode = VOIDmode; - } - } - - /* Try to fold this expression in case we have constants that weren't - present before. */ - temp = 0; - switch (GET_RTX_CLASS (code)) - { - case '1': - temp = simplify_unary_operation (code, mode, XEXP (x, 0), op0_mode); - break; - case '<': - temp = simplify_relational_operation (code, op0_mode, - XEXP (x, 0), XEXP (x, 1)); -#ifdef FLOAT_STORE_FLAG_VALUE - if (temp != 0 && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) - temp = ((temp == const0_rtx) ? CONST0_RTX (GET_MODE (x)) - : immed_real_const_1 (FLOAT_STORE_FLAG_VALUE, GET_MODE (x))); -#endif - break; - case 'c': - case '2': - temp = simplify_binary_operation (code, mode, XEXP (x, 0), XEXP (x, 1)); - break; - case 'b': - case '3': - temp = simplify_ternary_operation (code, mode, op0_mode, XEXP (x, 0), - XEXP (x, 1), XEXP (x, 2)); - break; - } - - if (temp) - x = temp, code = GET_CODE (temp); - - /* First see if we can apply the inverse distributive law. */ - if (code == PLUS || code == MINUS - || code == AND || code == IOR || code == XOR) - { - x = apply_distributive_law (x); - code = GET_CODE (x); - } - - /* If CODE is an associative operation not otherwise handled, see if we - can associate some operands. This can win if they are constants or - if they are logically related (i.e. (a & b) & a. */ - if ((code == PLUS || code == MINUS - || code == MULT || code == AND || code == IOR || code == XOR - || code == DIV || code == UDIV - || code == SMAX || code == SMIN || code == UMAX || code == UMIN) - && INTEGRAL_MODE_P (mode)) - { - if (GET_CODE (XEXP (x, 0)) == code) - { - rtx other = XEXP (XEXP (x, 0), 0); - rtx inner_op0 = XEXP (XEXP (x, 0), 1); - rtx inner_op1 = XEXP (x, 1); - rtx inner; - - /* Make sure we pass the constant operand if any as the second - one if this is a commutative operation. */ - if (CONSTANT_P (inner_op0) && GET_RTX_CLASS (code) == 'c') - { - rtx tem = inner_op0; - inner_op0 = inner_op1; - inner_op1 = tem; - } - inner = simplify_binary_operation (code == MINUS ? PLUS - : code == DIV ? MULT - : code == UDIV ? MULT - : code, - mode, inner_op0, inner_op1); - - /* For commutative operations, try the other pair if that one - didn't simplify. */ - if (inner == 0 && GET_RTX_CLASS (code) == 'c') - { - other = XEXP (XEXP (x, 0), 1); - inner = simplify_binary_operation (code, mode, - XEXP (XEXP (x, 0), 0), - XEXP (x, 1)); - } - - if (inner) - return gen_binary (code, mode, other, inner); - } - } - - /* A little bit of algebraic simplification here. */ - switch (code) - { - case MEM: - /* Ensure that our address has any ASHIFTs converted to MULT in case - address-recognizing predicates are called later. */ - temp = make_compound_operation (XEXP (x, 0), MEM); - SUBST (XEXP (x, 0), temp); - break; - - case SUBREG: - /* (subreg:A (mem:B X) N) becomes a modified MEM unless the SUBREG - is paradoxical. If we can't do that safely, then it becomes - something nonsensical so that this combination won't take place. */ - - if (GET_CODE (SUBREG_REG (x)) == MEM - && (GET_MODE_SIZE (mode) - <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))) - { - rtx inner = SUBREG_REG (x); - int endian_offset = 0; - /* Don't change the mode of the MEM - if that would change the meaning of the address. */ - if (MEM_VOLATILE_P (SUBREG_REG (x)) - || mode_dependent_address_p (XEXP (inner, 0))) - return gen_rtx_CLOBBER (mode, const0_rtx); - - if (BYTES_BIG_ENDIAN) - { - if (GET_MODE_SIZE (mode) < UNITS_PER_WORD) - endian_offset += UNITS_PER_WORD - GET_MODE_SIZE (mode); - if (GET_MODE_SIZE (GET_MODE (inner)) < UNITS_PER_WORD) - endian_offset -= (UNITS_PER_WORD - - GET_MODE_SIZE (GET_MODE (inner))); - } - /* Note if the plus_constant doesn't make a valid address - then this combination won't be accepted. */ - x = gen_rtx_MEM (mode, - plus_constant (XEXP (inner, 0), - (SUBREG_WORD (x) * UNITS_PER_WORD - + endian_offset))); - RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (inner); - MEM_COPY_ATTRIBUTES (x, inner); - return x; - } - - /* If we are in a SET_DEST, these other cases can't apply. */ - if (in_dest) - return x; - - /* Changing mode twice with SUBREG => just change it once, - or not at all if changing back to starting mode. */ - if (GET_CODE (SUBREG_REG (x)) == SUBREG) - { - if (mode == GET_MODE (SUBREG_REG (SUBREG_REG (x))) - && SUBREG_WORD (x) == 0 && SUBREG_WORD (SUBREG_REG (x)) == 0) - return SUBREG_REG (SUBREG_REG (x)); - - SUBST_INT (SUBREG_WORD (x), - SUBREG_WORD (x) + SUBREG_WORD (SUBREG_REG (x))); - SUBST (SUBREG_REG (x), SUBREG_REG (SUBREG_REG (x))); - } - - /* SUBREG of a hard register => just change the register number - and/or mode. If the hard register is not valid in that mode, - suppress this combination. If the hard register is the stack, - frame, or argument pointer, leave this as a SUBREG. */ - - if (GET_CODE (SUBREG_REG (x)) == REG - && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER - && REGNO (SUBREG_REG (x)) != FRAME_POINTER_REGNUM -#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM - && REGNO (SUBREG_REG (x)) != HARD_FRAME_POINTER_REGNUM -#endif -#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM - && REGNO (SUBREG_REG (x)) != ARG_POINTER_REGNUM -#endif - && REGNO (SUBREG_REG (x)) != STACK_POINTER_REGNUM) - { - if (HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (x)) + SUBREG_WORD (x), - mode)) - return gen_rtx_REG (mode, - REGNO (SUBREG_REG (x)) + SUBREG_WORD (x)); - else - return gen_rtx_CLOBBER (mode, const0_rtx); - } - - /* For a constant, try to pick up the part we want. Handle a full - word and low-order part. Only do this if we are narrowing - the constant; if it is being widened, we have no idea what - the extra bits will have been set to. */ - - if (CONSTANT_P (SUBREG_REG (x)) && op0_mode != VOIDmode - && GET_MODE_SIZE (mode) == UNITS_PER_WORD - && GET_MODE_SIZE (op0_mode) > UNITS_PER_WORD - && GET_MODE_CLASS (mode) == MODE_INT) - { - temp = operand_subword (SUBREG_REG (x), SUBREG_WORD (x), - 0, op0_mode); - if (temp) - return temp; - } - - /* If we want a subreg of a constant, at offset 0, - take the low bits. On a little-endian machine, that's - always valid. On a big-endian machine, it's valid - only if the constant's mode fits in one word. Note that we - cannot use subreg_lowpart_p since SUBREG_REG may be VOIDmode. */ - if (CONSTANT_P (SUBREG_REG (x)) - && ((GET_MODE_SIZE (op0_mode) <= UNITS_PER_WORD - || ! WORDS_BIG_ENDIAN) - ? SUBREG_WORD (x) == 0 - : (SUBREG_WORD (x) - == ((GET_MODE_SIZE (op0_mode) - - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD)) - / UNITS_PER_WORD))) - && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (op0_mode) - && (! WORDS_BIG_ENDIAN - || GET_MODE_BITSIZE (op0_mode) <= BITS_PER_WORD)) - return gen_lowpart_for_combine (mode, SUBREG_REG (x)); - - /* A paradoxical SUBREG of a VOIDmode constant is the same constant, - since we are saying that the high bits don't matter. */ - if (CONSTANT_P (SUBREG_REG (x)) && GET_MODE (SUBREG_REG (x)) == VOIDmode - && GET_MODE_SIZE (mode) > GET_MODE_SIZE (op0_mode)) - return SUBREG_REG (x); - - /* Note that we cannot do any narrowing for non-constants since - we might have been counting on using the fact that some bits were - zero. We now do this in the SET. */ - - break; - - case NOT: - /* (not (plus X -1)) can become (neg X). */ - if (GET_CODE (XEXP (x, 0)) == PLUS - && XEXP (XEXP (x, 0), 1) == constm1_rtx) - return gen_rtx_combine (NEG, mode, XEXP (XEXP (x, 0), 0)); - - /* Similarly, (not (neg X)) is (plus X -1). */ - if (GET_CODE (XEXP (x, 0)) == NEG) - return gen_rtx_combine (PLUS, mode, XEXP (XEXP (x, 0), 0), - constm1_rtx); - - /* (not (xor X C)) for C constant is (xor X D) with D = ~ C. */ - if (GET_CODE (XEXP (x, 0)) == XOR - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && (temp = simplify_unary_operation (NOT, mode, - XEXP (XEXP (x, 0), 1), - mode)) != 0) - return gen_binary (XOR, mode, XEXP (XEXP (x, 0), 0), temp); - - /* (not (ashift 1 X)) is (rotate ~1 X). We used to do this for operands - other than 1, but that is not valid. We could do a similar - simplification for (not (lshiftrt C X)) where C is just the sign bit, - but this doesn't seem common enough to bother with. */ - if (GET_CODE (XEXP (x, 0)) == ASHIFT - && XEXP (XEXP (x, 0), 0) == const1_rtx) - return gen_rtx_ROTATE (mode, gen_unary (NOT, mode, mode, const1_rtx), - XEXP (XEXP (x, 0), 1)); - - if (GET_CODE (XEXP (x, 0)) == SUBREG - && subreg_lowpart_p (XEXP (x, 0)) - && (GET_MODE_SIZE (GET_MODE (XEXP (x, 0))) - < GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (x, 0))))) - && GET_CODE (SUBREG_REG (XEXP (x, 0))) == ASHIFT - && XEXP (SUBREG_REG (XEXP (x, 0)), 0) == const1_rtx) - { - enum machine_mode inner_mode = GET_MODE (SUBREG_REG (XEXP (x, 0))); - - x = gen_rtx_ROTATE (inner_mode, - gen_unary (NOT, inner_mode, inner_mode, - const1_rtx), - XEXP (SUBREG_REG (XEXP (x, 0)), 1)); - return gen_lowpart_for_combine (mode, x); - } - - /* If STORE_FLAG_VALUE is -1, (not (comparison foo bar)) can be done by - reversing the comparison code if valid. */ - if (STORE_FLAG_VALUE == -1 - && GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<' - && reversible_comparison_p (XEXP (x, 0))) - return gen_rtx_combine (reverse_condition (GET_CODE (XEXP (x, 0))), - mode, XEXP (XEXP (x, 0), 0), - XEXP (XEXP (x, 0), 1)); - - /* (ashiftrt foo C) where C is the number of bits in FOO minus 1 - is (lt foo (const_int 0)) if STORE_FLAG_VALUE is -1, so we can - perform the above simplification. */ - - if (STORE_FLAG_VALUE == -1 - && XEXP (x, 1) == const1_rtx - && GET_CODE (XEXP (x, 0)) == ASHIFTRT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && INTVAL (XEXP (XEXP (x, 0), 1)) == GET_MODE_BITSIZE (mode) - 1) - return gen_rtx_combine (GE, mode, XEXP (XEXP (x, 0), 0), const0_rtx); - - /* Apply De Morgan's laws to reduce number of patterns for machines - with negating logical insns (and-not, nand, etc.). If result has - only one NOT, put it first, since that is how the patterns are - coded. */ - - if (GET_CODE (XEXP (x, 0)) == IOR || GET_CODE (XEXP (x, 0)) == AND) - { - rtx in1 = XEXP (XEXP (x, 0), 0), in2 = XEXP (XEXP (x, 0), 1); - - if (GET_CODE (in1) == NOT) - in1 = XEXP (in1, 0); - else - in1 = gen_rtx_combine (NOT, GET_MODE (in1), in1); - - if (GET_CODE (in2) == NOT) - in2 = XEXP (in2, 0); - else if (GET_CODE (in2) == CONST_INT - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT) - in2 = GEN_INT (GET_MODE_MASK (mode) & ~ INTVAL (in2)); - else - in2 = gen_rtx_combine (NOT, GET_MODE (in2), in2); - - if (GET_CODE (in2) == NOT) - { - rtx tem = in2; - in2 = in1; in1 = tem; - } - - return gen_rtx_combine (GET_CODE (XEXP (x, 0)) == IOR ? AND : IOR, - mode, in1, in2); - } - break; - - case NEG: - /* (neg (plus X 1)) can become (not X). */ - if (GET_CODE (XEXP (x, 0)) == PLUS - && XEXP (XEXP (x, 0), 1) == const1_rtx) - return gen_rtx_combine (NOT, mode, XEXP (XEXP (x, 0), 0)); - - /* Similarly, (neg (not X)) is (plus X 1). */ - if (GET_CODE (XEXP (x, 0)) == NOT) - return plus_constant (XEXP (XEXP (x, 0), 0), 1); - - /* (neg (minus X Y)) can become (minus Y X). */ - if (GET_CODE (XEXP (x, 0)) == MINUS - && (! FLOAT_MODE_P (mode) - /* x-y != -(y-x) with IEEE floating point. */ - || TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT - || flag_fast_math)) - return gen_binary (MINUS, mode, XEXP (XEXP (x, 0), 1), - XEXP (XEXP (x, 0), 0)); - - /* (neg (xor A 1)) is (plus A -1) if A is known to be either 0 or 1. */ - if (GET_CODE (XEXP (x, 0)) == XOR && XEXP (XEXP (x, 0), 1) == const1_rtx - && nonzero_bits (XEXP (XEXP (x, 0), 0), mode) == 1) - return gen_binary (PLUS, mode, XEXP (XEXP (x, 0), 0), constm1_rtx); - - /* NEG commutes with ASHIFT since it is multiplication. Only do this - if we can then eliminate the NEG (e.g., - if the operand is a constant). */ - - if (GET_CODE (XEXP (x, 0)) == ASHIFT) - { - temp = simplify_unary_operation (NEG, mode, - XEXP (XEXP (x, 0), 0), mode); - if (temp) - { - SUBST (XEXP (XEXP (x, 0), 0), temp); - return XEXP (x, 0); - } - } - - temp = expand_compound_operation (XEXP (x, 0)); - - /* For C equal to the width of MODE minus 1, (neg (ashiftrt X C)) can be - replaced by (lshiftrt X C). This will convert - (neg (sign_extract X 1 Y)) to (zero_extract X 1 Y). */ - - if (GET_CODE (temp) == ASHIFTRT - && GET_CODE (XEXP (temp, 1)) == CONST_INT - && INTVAL (XEXP (temp, 1)) == GET_MODE_BITSIZE (mode) - 1) - return simplify_shift_const (temp, LSHIFTRT, mode, XEXP (temp, 0), - INTVAL (XEXP (temp, 1))); - - /* If X has only a single bit that might be nonzero, say, bit I, convert - (neg X) to (ashiftrt (ashift X C-I) C-I) where C is the bitsize of - MODE minus 1. This will convert (neg (zero_extract X 1 Y)) to - (sign_extract X 1 Y). But only do this if TEMP isn't a register - or a SUBREG of one since we'd be making the expression more - complex if it was just a register. */ - - if (GET_CODE (temp) != REG - && ! (GET_CODE (temp) == SUBREG - && GET_CODE (SUBREG_REG (temp)) == REG) - && (i = exact_log2 (nonzero_bits (temp, mode))) >= 0) - { - rtx temp1 = simplify_shift_const - (NULL_RTX, ASHIFTRT, mode, - simplify_shift_const (NULL_RTX, ASHIFT, mode, temp, - GET_MODE_BITSIZE (mode) - 1 - i), - GET_MODE_BITSIZE (mode) - 1 - i); - - /* If all we did was surround TEMP with the two shifts, we - haven't improved anything, so don't use it. Otherwise, - we are better off with TEMP1. */ - if (GET_CODE (temp1) != ASHIFTRT - || GET_CODE (XEXP (temp1, 0)) != ASHIFT - || XEXP (XEXP (temp1, 0), 0) != temp) - return temp1; - } - break; - - case TRUNCATE: - /* We can't handle truncation to a partial integer mode here - because we don't know the real bitsize of the partial - integer mode. */ - if (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT) - break; - - if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode), - GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))))) - SUBST (XEXP (x, 0), - force_to_mode (XEXP (x, 0), GET_MODE (XEXP (x, 0)), - GET_MODE_MASK (mode), NULL_RTX, 0)); - - /* (truncate:SI ({sign,zero}_extend:DI foo:SI)) == foo:SI. */ - if ((GET_CODE (XEXP (x, 0)) == SIGN_EXTEND - || GET_CODE (XEXP (x, 0)) == ZERO_EXTEND) - && GET_MODE (XEXP (XEXP (x, 0), 0)) == mode) - return XEXP (XEXP (x, 0), 0); - - /* (truncate:SI (OP:DI ({sign,zero}_extend:DI foo:SI))) is - (OP:SI foo:SI) if OP is NEG or ABS. */ - if ((GET_CODE (XEXP (x, 0)) == ABS - || GET_CODE (XEXP (x, 0)) == NEG) - && (GET_CODE (XEXP (XEXP (x, 0), 0)) == SIGN_EXTEND - || GET_CODE (XEXP (XEXP (x, 0), 0)) == ZERO_EXTEND) - && GET_MODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == mode) - return gen_unary (GET_CODE (XEXP (x, 0)), mode, mode, - XEXP (XEXP (XEXP (x, 0), 0), 0)); - - /* (truncate:SI (subreg:DI (truncate:SI X) 0)) is - (truncate:SI x). */ - if (GET_CODE (XEXP (x, 0)) == SUBREG - && GET_CODE (SUBREG_REG (XEXP (x, 0))) == TRUNCATE - && subreg_lowpart_p (XEXP (x, 0))) - return SUBREG_REG (XEXP (x, 0)); - - /* If we know that the value is already truncated, we can - replace the TRUNCATE with a SUBREG if TRULY_NOOP_TRUNCATION is - nonzero for the corresponding modes. */ - if (TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode), - GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))) - && num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0))) - >= GET_MODE_BITSIZE (mode) + 1) - return gen_lowpart_for_combine (mode, XEXP (x, 0)); - - /* A truncate of a comparison can be replaced with a subreg if - STORE_FLAG_VALUE permits. This is like the previous test, - but it works even if the comparison is done in a mode larger - than HOST_BITS_PER_WIDE_INT. */ - if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<' - && ((HOST_WIDE_INT) STORE_FLAG_VALUE &~ GET_MODE_MASK (mode)) == 0) - return gen_lowpart_for_combine (mode, XEXP (x, 0)); - - /* Similarly, a truncate of a register whose value is a - comparison can be replaced with a subreg if STORE_FLAG_VALUE - permits. */ - if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && ((HOST_WIDE_INT) STORE_FLAG_VALUE &~ GET_MODE_MASK (mode)) == 0 - && (temp = get_last_value (XEXP (x, 0))) - && GET_RTX_CLASS (GET_CODE (temp)) == '<') - return gen_lowpart_for_combine (mode, XEXP (x, 0)); - - break; - - case FLOAT_TRUNCATE: - /* (float_truncate:SF (float_extend:DF foo:SF)) = foo:SF. */ - if (GET_CODE (XEXP (x, 0)) == FLOAT_EXTEND - && GET_MODE (XEXP (XEXP (x, 0), 0)) == mode) - return XEXP (XEXP (x, 0), 0); - - /* (float_truncate:SF (OP:DF (float_extend:DF foo:sf))) is - (OP:SF foo:SF) if OP is NEG or ABS. */ - if ((GET_CODE (XEXP (x, 0)) == ABS - || GET_CODE (XEXP (x, 0)) == NEG) - && GET_CODE (XEXP (XEXP (x, 0), 0)) == FLOAT_EXTEND - && GET_MODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == mode) - return gen_unary (GET_CODE (XEXP (x, 0)), mode, mode, - XEXP (XEXP (XEXP (x, 0), 0), 0)); - - /* (float_truncate:SF (subreg:DF (float_truncate:SF X) 0)) - is (float_truncate:SF x). */ - if (GET_CODE (XEXP (x, 0)) == SUBREG - && subreg_lowpart_p (XEXP (x, 0)) - && GET_CODE (SUBREG_REG (XEXP (x, 0))) == FLOAT_TRUNCATE) - return SUBREG_REG (XEXP (x, 0)); - break; - -#ifdef HAVE_cc0 - case COMPARE: - /* Convert (compare FOO (const_int 0)) to FOO unless we aren't - using cc0, in which case we want to leave it as a COMPARE - so we can distinguish it from a register-register-copy. */ - if (XEXP (x, 1) == const0_rtx) - return XEXP (x, 0); - - /* In IEEE floating point, x-0 is not the same as x. */ - if ((TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT - || ! FLOAT_MODE_P (GET_MODE (XEXP (x, 0))) - || flag_fast_math) - && XEXP (x, 1) == CONST0_RTX (GET_MODE (XEXP (x, 0)))) - return XEXP (x, 0); - break; -#endif - - case CONST: - /* (const (const X)) can become (const X). Do it this way rather than - returning the inner CONST since CONST can be shared with a - REG_EQUAL note. */ - if (GET_CODE (XEXP (x, 0)) == CONST) - SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0)); - break; - -#ifdef HAVE_lo_sum - case LO_SUM: - /* Convert (lo_sum (high FOO) FOO) to FOO. This is necessary so we - can add in an offset. find_split_point will split this address up - again if it doesn't match. */ - if (GET_CODE (XEXP (x, 0)) == HIGH - && rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1))) - return XEXP (x, 1); - break; -#endif - - case PLUS: - /* If we have (plus (plus (A const) B)), associate it so that CONST is - outermost. That's because that's the way indexed addresses are - supposed to appear. This code used to check many more cases, but - they are now checked elsewhere. */ - if (GET_CODE (XEXP (x, 0)) == PLUS - && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1))) - return gen_binary (PLUS, mode, - gen_binary (PLUS, mode, XEXP (XEXP (x, 0), 0), - XEXP (x, 1)), - XEXP (XEXP (x, 0), 1)); - - /* (plus (xor (and (const_int pow2 - 1)) ) <-c>) - when c is (const_int (pow2 + 1) / 2) is a sign extension of a - bit-field and can be replaced by either a sign_extend or a - sign_extract. The `and' may be a zero_extend. */ - if (GET_CODE (XEXP (x, 0)) == XOR - && GET_CODE (XEXP (x, 1)) == CONST_INT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) == - INTVAL (XEXP (XEXP (x, 0), 1)) - && (i = exact_log2 (INTVAL (XEXP (XEXP (x, 0), 1)))) >= 0 - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && ((GET_CODE (XEXP (XEXP (x, 0), 0)) == AND - && GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 1)) == CONST_INT - && (INTVAL (XEXP (XEXP (XEXP (x, 0), 0), 1)) - == ((HOST_WIDE_INT) 1 << (i + 1)) - 1)) - || (GET_CODE (XEXP (XEXP (x, 0), 0)) == ZERO_EXTEND - && (GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (XEXP (x, 0), 0), 0))) - == i + 1)))) - return simplify_shift_const - (NULL_RTX, ASHIFTRT, mode, - simplify_shift_const (NULL_RTX, ASHIFT, mode, - XEXP (XEXP (XEXP (x, 0), 0), 0), - GET_MODE_BITSIZE (mode) - (i + 1)), - GET_MODE_BITSIZE (mode) - (i + 1)); - - /* (plus (comparison A B) C) can become (neg (rev-comp A B)) if - C is 1 and STORE_FLAG_VALUE is -1 or if C is -1 and STORE_FLAG_VALUE - is 1. This produces better code than the alternative immediately - below. */ - if (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<' - && reversible_comparison_p (XEXP (x, 0)) - && ((STORE_FLAG_VALUE == -1 && XEXP (x, 1) == const1_rtx) - || (STORE_FLAG_VALUE == 1 && XEXP (x, 1) == constm1_rtx))) - return - gen_unary (NEG, mode, mode, - gen_binary (reverse_condition (GET_CODE (XEXP (x, 0))), - mode, XEXP (XEXP (x, 0), 0), - XEXP (XEXP (x, 0), 1))); - - /* If only the low-order bit of X is possibly nonzero, (plus x -1) - can become (ashiftrt (ashift (xor x 1) C) C) where C is - the bitsize of the mode - 1. This allows simplification of - "a = (b & 8) == 0;" */ - if (XEXP (x, 1) == constm1_rtx - && GET_CODE (XEXP (x, 0)) != REG - && ! (GET_CODE (XEXP (x,0)) == SUBREG - && GET_CODE (SUBREG_REG (XEXP (x, 0))) == REG) - && nonzero_bits (XEXP (x, 0), mode) == 1) - return simplify_shift_const (NULL_RTX, ASHIFTRT, mode, - simplify_shift_const (NULL_RTX, ASHIFT, mode, - gen_rtx_combine (XOR, mode, - XEXP (x, 0), const1_rtx), - GET_MODE_BITSIZE (mode) - 1), - GET_MODE_BITSIZE (mode) - 1); - - /* If we are adding two things that have no bits in common, convert - the addition into an IOR. This will often be further simplified, - for example in cases like ((a & 1) + (a & 2)), which can - become a & 3. */ - - if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (XEXP (x, 0), mode) - & nonzero_bits (XEXP (x, 1), mode)) == 0) - return gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1)); - break; - - case MINUS: - /* If STORE_FLAG_VALUE is 1, (minus 1 (comparison foo bar)) can be done - by reversing the comparison code if valid. */ - if (STORE_FLAG_VALUE == 1 - && XEXP (x, 0) == const1_rtx - && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) == '<' - && reversible_comparison_p (XEXP (x, 1))) - return gen_binary (reverse_condition (GET_CODE (XEXP (x, 1))), - mode, XEXP (XEXP (x, 1), 0), - XEXP (XEXP (x, 1), 1)); - - /* (minus (and (const_int -pow2))) becomes - (and (const_int pow2-1)) */ - if (GET_CODE (XEXP (x, 1)) == AND - && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT - && exact_log2 (- INTVAL (XEXP (XEXP (x, 1), 1))) >= 0 - && rtx_equal_p (XEXP (XEXP (x, 1), 0), XEXP (x, 0))) - return simplify_and_const_int (NULL_RTX, mode, XEXP (x, 0), - - INTVAL (XEXP (XEXP (x, 1), 1)) - 1); - - /* Canonicalize (minus A (plus B C)) to (minus (minus A B) C) for - integers. */ - if (GET_CODE (XEXP (x, 1)) == PLUS && INTEGRAL_MODE_P (mode)) - return gen_binary (MINUS, mode, - gen_binary (MINUS, mode, XEXP (x, 0), - XEXP (XEXP (x, 1), 0)), - XEXP (XEXP (x, 1), 1)); - break; - - case MULT: - /* If we have (mult (plus A B) C), apply the distributive law and then - the inverse distributive law to see if things simplify. This - occurs mostly in addresses, often when unrolling loops. */ - - if (GET_CODE (XEXP (x, 0)) == PLUS) - { - x = apply_distributive_law - (gen_binary (PLUS, mode, - gen_binary (MULT, mode, - XEXP (XEXP (x, 0), 0), XEXP (x, 1)), - gen_binary (MULT, mode, - XEXP (XEXP (x, 0), 1), XEXP (x, 1)))); - - if (GET_CODE (x) != MULT) - return x; - } - break; - - case UDIV: - /* If this is a divide by a power of two, treat it as a shift if - its first operand is a shift. */ - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && (i = exact_log2 (INTVAL (XEXP (x, 1)))) >= 0 - && (GET_CODE (XEXP (x, 0)) == ASHIFT - || GET_CODE (XEXP (x, 0)) == LSHIFTRT - || GET_CODE (XEXP (x, 0)) == ASHIFTRT - || GET_CODE (XEXP (x, 0)) == ROTATE - || GET_CODE (XEXP (x, 0)) == ROTATERT)) - return simplify_shift_const (NULL_RTX, LSHIFTRT, mode, XEXP (x, 0), i); - break; - - case EQ: case NE: - case GT: case GTU: case GE: case GEU: - case LT: case LTU: case LE: case LEU: - /* If the first operand is a condition code, we can't do anything - with it. */ - if (GET_CODE (XEXP (x, 0)) == COMPARE - || (GET_MODE_CLASS (GET_MODE (XEXP (x, 0))) != MODE_CC -#ifdef HAVE_cc0 - && XEXP (x, 0) != cc0_rtx -#endif - )) - { - rtx op0 = XEXP (x, 0); - rtx op1 = XEXP (x, 1); - enum rtx_code new_code; - - if (GET_CODE (op0) == COMPARE) - op1 = XEXP (op0, 1), op0 = XEXP (op0, 0); - - /* Simplify our comparison, if possible. */ - new_code = simplify_comparison (code, &op0, &op1); - - /* If STORE_FLAG_VALUE is 1, we can convert (ne x 0) to simply X - if only the low-order bit is possibly nonzero in X (such as when - X is a ZERO_EXTRACT of one bit). Similarly, we can convert EQ to - (xor X 1) or (minus 1 X); we use the former. Finally, if X is - known to be either 0 or -1, NE becomes a NEG and EQ becomes - (plus X 1). - - Remove any ZERO_EXTRACT we made when thinking this was a - comparison. It may now be simpler to use, e.g., an AND. If a - ZERO_EXTRACT is indeed appropriate, it will be placed back by - the call to make_compound_operation in the SET case. */ - - if (STORE_FLAG_VALUE == 1 - && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx && nonzero_bits (op0, mode) == 1) - return gen_lowpart_for_combine (mode, - expand_compound_operation (op0)); - - else if (STORE_FLAG_VALUE == 1 - && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx - && (num_sign_bit_copies (op0, mode) - == GET_MODE_BITSIZE (mode))) - { - op0 = expand_compound_operation (op0); - return gen_unary (NEG, mode, mode, - gen_lowpart_for_combine (mode, op0)); - } - - else if (STORE_FLAG_VALUE == 1 - && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx - && nonzero_bits (op0, mode) == 1) - { - op0 = expand_compound_operation (op0); - return gen_binary (XOR, mode, - gen_lowpart_for_combine (mode, op0), - const1_rtx); - } - - else if (STORE_FLAG_VALUE == 1 - && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx - && (num_sign_bit_copies (op0, mode) - == GET_MODE_BITSIZE (mode))) - { - op0 = expand_compound_operation (op0); - return plus_constant (gen_lowpart_for_combine (mode, op0), 1); - } - - /* If STORE_FLAG_VALUE is -1, we have cases similar to - those above. */ - if (STORE_FLAG_VALUE == -1 - && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx - && (num_sign_bit_copies (op0, mode) - == GET_MODE_BITSIZE (mode))) - return gen_lowpart_for_combine (mode, - expand_compound_operation (op0)); - - else if (STORE_FLAG_VALUE == -1 - && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx - && nonzero_bits (op0, mode) == 1) - { - op0 = expand_compound_operation (op0); - return gen_unary (NEG, mode, mode, - gen_lowpart_for_combine (mode, op0)); - } - - else if (STORE_FLAG_VALUE == -1 - && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx - && (num_sign_bit_copies (op0, mode) - == GET_MODE_BITSIZE (mode))) - { - op0 = expand_compound_operation (op0); - return gen_unary (NOT, mode, mode, - gen_lowpart_for_combine (mode, op0)); - } - - /* If X is 0/1, (eq X 0) is X-1. */ - else if (STORE_FLAG_VALUE == -1 - && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT - && op1 == const0_rtx - && nonzero_bits (op0, mode) == 1) - { - op0 = expand_compound_operation (op0); - return plus_constant (gen_lowpart_for_combine (mode, op0), -1); - } - - /* If STORE_FLAG_VALUE says to just test the sign bit and X has just - one bit that might be nonzero, we can convert (ne x 0) to - (ashift x c) where C puts the bit in the sign bit. Remove any - AND with STORE_FLAG_VALUE when we are done, since we are only - going to test the sign bit. */ - if (new_code == NE && GET_MODE_CLASS (mode) == MODE_INT - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && ((STORE_FLAG_VALUE & GET_MODE_MASK (mode)) - == (unsigned HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE(mode)-1)) - && op1 == const0_rtx - && mode == GET_MODE (op0) - && (i = exact_log2 (nonzero_bits (op0, mode))) >= 0) - { - x = simplify_shift_const (NULL_RTX, ASHIFT, mode, - expand_compound_operation (op0), - GET_MODE_BITSIZE (mode) - 1 - i); - if (GET_CODE (x) == AND && XEXP (x, 1) == const_true_rtx) - return XEXP (x, 0); - else - return x; - } - - /* If the code changed, return a whole new comparison. */ - if (new_code != code) - return gen_rtx_combine (new_code, mode, op0, op1); - - /* Otherwise, keep this operation, but maybe change its operands. - This also converts (ne (compare FOO BAR) 0) to (ne FOO BAR). */ - SUBST (XEXP (x, 0), op0); - SUBST (XEXP (x, 1), op1); - } - break; - - case IF_THEN_ELSE: - return simplify_if_then_else (x); - - case ZERO_EXTRACT: - case SIGN_EXTRACT: - case ZERO_EXTEND: - case SIGN_EXTEND: - /* If we are processing SET_DEST, we are done. */ - if (in_dest) - return x; - - return expand_compound_operation (x); - - case SET: - return simplify_set (x); - - case AND: - case IOR: - case XOR: - return simplify_logical (x, last); - - case ABS: - /* (abs (neg )) -> (abs ) */ - if (GET_CODE (XEXP (x, 0)) == NEG) - SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0)); - - /* If the mode of the operand is VOIDmode (i.e. if it is ASM_OPERANDS), - do nothing. */ - if (GET_MODE (XEXP (x, 0)) == VOIDmode) - break; - - /* If operand is something known to be positive, ignore the ABS. */ - if (GET_CODE (XEXP (x, 0)) == FFS || GET_CODE (XEXP (x, 0)) == ABS - || ((GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - <= HOST_BITS_PER_WIDE_INT) - && ((nonzero_bits (XEXP (x, 0), GET_MODE (XEXP (x, 0))) - & ((HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - 1))) - == 0))) - return XEXP (x, 0); - - - /* If operand is known to be only -1 or 0, convert ABS to NEG. */ - if (num_sign_bit_copies (XEXP (x, 0), mode) == GET_MODE_BITSIZE (mode)) - return gen_rtx_combine (NEG, mode, XEXP (x, 0)); - - break; - - case FFS: - /* (ffs (*_extend )) = (ffs ) */ - if (GET_CODE (XEXP (x, 0)) == SIGN_EXTEND - || GET_CODE (XEXP (x, 0)) == ZERO_EXTEND) - SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0)); - break; - - case FLOAT: - /* (float (sign_extend )) = (float ). */ - if (GET_CODE (XEXP (x, 0)) == SIGN_EXTEND) - SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0)); - break; - - case ASHIFT: - case LSHIFTRT: - case ASHIFTRT: - case ROTATE: - case ROTATERT: - /* If this is a shift by a constant amount, simplify it. */ - if (GET_CODE (XEXP (x, 1)) == CONST_INT) - return simplify_shift_const (x, code, mode, XEXP (x, 0), - INTVAL (XEXP (x, 1))); - -#ifdef SHIFT_COUNT_TRUNCATED - else if (SHIFT_COUNT_TRUNCATED && GET_CODE (XEXP (x, 1)) != REG) - SUBST (XEXP (x, 1), - force_to_mode (XEXP (x, 1), GET_MODE (x), - ((HOST_WIDE_INT) 1 - << exact_log2 (GET_MODE_BITSIZE (GET_MODE (x)))) - - 1, - NULL_RTX, 0)); -#endif - - break; - - default: - break; - } - - return x; -} - -/* Simplify X, an IF_THEN_ELSE expression. Return the new expression. */ - -static rtx -simplify_if_then_else (x) - rtx x; -{ - enum machine_mode mode = GET_MODE (x); - rtx cond = XEXP (x, 0); - rtx true = XEXP (x, 1); - rtx false = XEXP (x, 2); - enum rtx_code true_code = GET_CODE (cond); - int comparison_p = GET_RTX_CLASS (true_code) == '<'; - rtx temp; - int i; - - /* Simplify storing of the truth value. */ - if (comparison_p && true == const_true_rtx && false == const0_rtx) - return gen_binary (true_code, mode, XEXP (cond, 0), XEXP (cond, 1)); - - /* Also when the truth value has to be reversed. */ - if (comparison_p && reversible_comparison_p (cond) - && true == const0_rtx && false == const_true_rtx) - return gen_binary (reverse_condition (true_code), - mode, XEXP (cond, 0), XEXP (cond, 1)); - - /* Sometimes we can simplify the arm of an IF_THEN_ELSE if a register used - in it is being compared against certain values. Get the true and false - comparisons and see if that says anything about the value of each arm. */ - - if (comparison_p && reversible_comparison_p (cond) - && GET_CODE (XEXP (cond, 0)) == REG) - { - HOST_WIDE_INT nzb; - rtx from = XEXP (cond, 0); - enum rtx_code false_code = reverse_condition (true_code); - rtx true_val = XEXP (cond, 1); - rtx false_val = true_val; - int swapped = 0; - - /* If FALSE_CODE is EQ, swap the codes and arms. */ - - if (false_code == EQ) - { - swapped = 1, true_code = EQ, false_code = NE; - temp = true, true = false, false = temp; - } - - /* If we are comparing against zero and the expression being tested has - only a single bit that might be nonzero, that is its value when it is - not equal to zero. Similarly if it is known to be -1 or 0. */ - - if (true_code == EQ && true_val == const0_rtx - && exact_log2 (nzb = nonzero_bits (from, GET_MODE (from))) >= 0) - false_code = EQ, false_val = GEN_INT (nzb); - else if (true_code == EQ && true_val == const0_rtx - && (num_sign_bit_copies (from, GET_MODE (from)) - == GET_MODE_BITSIZE (GET_MODE (from)))) - false_code = EQ, false_val = constm1_rtx; - - /* Now simplify an arm if we know the value of the register in the - branch and it is used in the arm. Be careful due to the potential - of locally-shared RTL. */ - - if (reg_mentioned_p (from, true)) - true = subst (known_cond (copy_rtx (true), true_code, from, true_val), - pc_rtx, pc_rtx, 0, 0); - if (reg_mentioned_p (from, false)) - false = subst (known_cond (copy_rtx (false), false_code, - from, false_val), - pc_rtx, pc_rtx, 0, 0); - - SUBST (XEXP (x, 1), swapped ? false : true); - SUBST (XEXP (x, 2), swapped ? true : false); - - true = XEXP (x, 1), false = XEXP (x, 2), true_code = GET_CODE (cond); - } - - /* If we have (if_then_else FOO (pc) (label_ref BAR)) and FOO can be - reversed, do so to avoid needing two sets of patterns for - subtract-and-branch insns. Similarly if we have a constant in the true - arm, the false arm is the same as the first operand of the comparison, or - the false arm is more complicated than the true arm. */ - - if (comparison_p && reversible_comparison_p (cond) - && (true == pc_rtx - || (CONSTANT_P (true) - && GET_CODE (false) != CONST_INT && false != pc_rtx) - || true == const0_rtx - || (GET_RTX_CLASS (GET_CODE (true)) == 'o' - && GET_RTX_CLASS (GET_CODE (false)) != 'o') - || (GET_CODE (true) == SUBREG - && GET_RTX_CLASS (GET_CODE (SUBREG_REG (true))) == 'o' - && GET_RTX_CLASS (GET_CODE (false)) != 'o') - || reg_mentioned_p (true, false) - || rtx_equal_p (false, XEXP (cond, 0)))) - { - true_code = reverse_condition (true_code); - SUBST (XEXP (x, 0), - gen_binary (true_code, GET_MODE (cond), XEXP (cond, 0), - XEXP (cond, 1))); - - SUBST (XEXP (x, 1), false); - SUBST (XEXP (x, 2), true); - - temp = true, true = false, false = temp, cond = XEXP (x, 0); - - /* It is possible that the conditional has been simplified out. */ - true_code = GET_CODE (cond); - comparison_p = GET_RTX_CLASS (true_code) == '<'; - } - - /* If the two arms are identical, we don't need the comparison. */ - - if (rtx_equal_p (true, false) && ! side_effects_p (cond)) - return true; - - /* Convert a == b ? b : a to "a". */ - if (true_code == EQ && ! side_effects_p (cond) - && rtx_equal_p (XEXP (cond, 0), false) - && rtx_equal_p (XEXP (cond, 1), true)) - return false; - else if (true_code == NE && ! side_effects_p (cond) - && rtx_equal_p (XEXP (cond, 0), true) - && rtx_equal_p (XEXP (cond, 1), false)) - return true; - - /* Look for cases where we have (abs x) or (neg (abs X)). */ - - if (GET_MODE_CLASS (mode) == MODE_INT - && GET_CODE (false) == NEG - && rtx_equal_p (true, XEXP (false, 0)) - && comparison_p - && rtx_equal_p (true, XEXP (cond, 0)) - && ! side_effects_p (true)) - switch (true_code) - { - case GT: - case GE: - return gen_unary (ABS, mode, mode, true); - case LT: - case LE: - return gen_unary (NEG, mode, mode, gen_unary (ABS, mode, mode, true)); - default: - break; - } - - /* Look for MIN or MAX. */ - - if ((! FLOAT_MODE_P (mode) || flag_fast_math) - && comparison_p - && rtx_equal_p (XEXP (cond, 0), true) - && rtx_equal_p (XEXP (cond, 1), false) - && ! side_effects_p (cond)) - switch (true_code) - { - case GE: - case GT: - return gen_binary (SMAX, mode, true, false); - case LE: - case LT: - return gen_binary (SMIN, mode, true, false); - case GEU: - case GTU: - return gen_binary (UMAX, mode, true, false); - case LEU: - case LTU: - return gen_binary (UMIN, mode, true, false); - default: - break; - } - - /* If we have (if_then_else COND (OP Z C1) Z) and OP is an identity when its - second operand is zero, this can be done as (OP Z (mult COND C2)) where - C2 = C1 * STORE_FLAG_VALUE. Similarly if OP has an outer ZERO_EXTEND or - SIGN_EXTEND as long as Z is already extended (so we don't destroy it). - We can do this kind of thing in some cases when STORE_FLAG_VALUE is - neither 1 or -1, but it isn't worth checking for. */ - - if ((STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1) - && comparison_p && mode != VOIDmode && ! side_effects_p (x)) - { - rtx t = make_compound_operation (true, SET); - rtx f = make_compound_operation (false, SET); - rtx cond_op0 = XEXP (cond, 0); - rtx cond_op1 = XEXP (cond, 1); - enum rtx_code op, extend_op = NIL; - enum machine_mode m = mode; - rtx z = 0, c1; - - if ((GET_CODE (t) == PLUS || GET_CODE (t) == MINUS - || GET_CODE (t) == IOR || GET_CODE (t) == XOR - || GET_CODE (t) == ASHIFT - || GET_CODE (t) == LSHIFTRT || GET_CODE (t) == ASHIFTRT) - && rtx_equal_p (XEXP (t, 0), f)) - c1 = XEXP (t, 1), op = GET_CODE (t), z = f; - - /* If an identity-zero op is commutative, check whether there - would be a match if we swapped the operands. */ - else if ((GET_CODE (t) == PLUS || GET_CODE (t) == IOR - || GET_CODE (t) == XOR) - && rtx_equal_p (XEXP (t, 1), f)) - c1 = XEXP (t, 0), op = GET_CODE (t), z = f; - else if (GET_CODE (t) == SIGN_EXTEND - && (GET_CODE (XEXP (t, 0)) == PLUS - || GET_CODE (XEXP (t, 0)) == MINUS - || GET_CODE (XEXP (t, 0)) == IOR - || GET_CODE (XEXP (t, 0)) == XOR - || GET_CODE (XEXP (t, 0)) == ASHIFT - || GET_CODE (XEXP (t, 0)) == LSHIFTRT - || GET_CODE (XEXP (t, 0)) == ASHIFTRT) - && GET_CODE (XEXP (XEXP (t, 0), 0)) == SUBREG - && subreg_lowpart_p (XEXP (XEXP (t, 0), 0)) - && rtx_equal_p (SUBREG_REG (XEXP (XEXP (t, 0), 0)), f) - && (num_sign_bit_copies (f, GET_MODE (f)) - > (GET_MODE_BITSIZE (mode) - - GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (t, 0), 0)))))) - { - c1 = XEXP (XEXP (t, 0), 1); z = f; op = GET_CODE (XEXP (t, 0)); - extend_op = SIGN_EXTEND; - m = GET_MODE (XEXP (t, 0)); - } - else if (GET_CODE (t) == SIGN_EXTEND - && (GET_CODE (XEXP (t, 0)) == PLUS - || GET_CODE (XEXP (t, 0)) == IOR - || GET_CODE (XEXP (t, 0)) == XOR) - && GET_CODE (XEXP (XEXP (t, 0), 1)) == SUBREG - && subreg_lowpart_p (XEXP (XEXP (t, 0), 1)) - && rtx_equal_p (SUBREG_REG (XEXP (XEXP (t, 0), 1)), f) - && (num_sign_bit_copies (f, GET_MODE (f)) - > (GET_MODE_BITSIZE (mode) - - GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (t, 0), 1)))))) - { - c1 = XEXP (XEXP (t, 0), 0); z = f; op = GET_CODE (XEXP (t, 0)); - extend_op = SIGN_EXTEND; - m = GET_MODE (XEXP (t, 0)); - } - else if (GET_CODE (t) == ZERO_EXTEND - && (GET_CODE (XEXP (t, 0)) == PLUS - || GET_CODE (XEXP (t, 0)) == MINUS - || GET_CODE (XEXP (t, 0)) == IOR - || GET_CODE (XEXP (t, 0)) == XOR - || GET_CODE (XEXP (t, 0)) == ASHIFT - || GET_CODE (XEXP (t, 0)) == LSHIFTRT - || GET_CODE (XEXP (t, 0)) == ASHIFTRT) - && GET_CODE (XEXP (XEXP (t, 0), 0)) == SUBREG - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && subreg_lowpart_p (XEXP (XEXP (t, 0), 0)) - && rtx_equal_p (SUBREG_REG (XEXP (XEXP (t, 0), 0)), f) - && ((nonzero_bits (f, GET_MODE (f)) - & ~ GET_MODE_MASK (GET_MODE (XEXP (XEXP (t, 0), 0)))) - == 0)) - { - c1 = XEXP (XEXP (t, 0), 1); z = f; op = GET_CODE (XEXP (t, 0)); - extend_op = ZERO_EXTEND; - m = GET_MODE (XEXP (t, 0)); - } - else if (GET_CODE (t) == ZERO_EXTEND - && (GET_CODE (XEXP (t, 0)) == PLUS - || GET_CODE (XEXP (t, 0)) == IOR - || GET_CODE (XEXP (t, 0)) == XOR) - && GET_CODE (XEXP (XEXP (t, 0), 1)) == SUBREG - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && subreg_lowpart_p (XEXP (XEXP (t, 0), 1)) - && rtx_equal_p (SUBREG_REG (XEXP (XEXP (t, 0), 1)), f) - && ((nonzero_bits (f, GET_MODE (f)) - & ~ GET_MODE_MASK (GET_MODE (XEXP (XEXP (t, 0), 1)))) - == 0)) - { - c1 = XEXP (XEXP (t, 0), 0); z = f; op = GET_CODE (XEXP (t, 0)); - extend_op = ZERO_EXTEND; - m = GET_MODE (XEXP (t, 0)); - } - - if (z) - { - temp = subst (gen_binary (true_code, m, cond_op0, cond_op1), - pc_rtx, pc_rtx, 0, 0); - temp = gen_binary (MULT, m, temp, - gen_binary (MULT, m, c1, const_true_rtx)); - temp = subst (temp, pc_rtx, pc_rtx, 0, 0); - temp = gen_binary (op, m, gen_lowpart_for_combine (m, z), temp); - - if (extend_op != NIL) - temp = gen_unary (extend_op, mode, m, temp); - - return temp; - } - } - - /* If we have (if_then_else (ne A 0) C1 0) and either A is known to be 0 or - 1 and C1 is a single bit or A is known to be 0 or -1 and C1 is the - negation of a single bit, we can convert this operation to a shift. We - can actually do this more generally, but it doesn't seem worth it. */ - - if (true_code == NE && XEXP (cond, 1) == const0_rtx - && false == const0_rtx && GET_CODE (true) == CONST_INT - && ((1 == nonzero_bits (XEXP (cond, 0), mode) - && (i = exact_log2 (INTVAL (true))) >= 0) - || ((num_sign_bit_copies (XEXP (cond, 0), mode) - == GET_MODE_BITSIZE (mode)) - && (i = exact_log2 (- INTVAL (true))) >= 0))) - return - simplify_shift_const (NULL_RTX, ASHIFT, mode, - gen_lowpart_for_combine (mode, XEXP (cond, 0)), i); - - return x; -} - -/* Simplify X, a SET expression. Return the new expression. */ - -static rtx -simplify_set (x) - rtx x; -{ - rtx src = SET_SRC (x); - rtx dest = SET_DEST (x); - enum machine_mode mode - = GET_MODE (src) != VOIDmode ? GET_MODE (src) : GET_MODE (dest); - rtx other_insn; - rtx *cc_use; - - /* (set (pc) (return)) gets written as (return). */ - if (GET_CODE (dest) == PC && GET_CODE (src) == RETURN) - return src; - - /* Now that we know for sure which bits of SRC we are using, see if we can - simplify the expression for the object knowing that we only need the - low-order bits. */ - - if (GET_MODE_CLASS (mode) == MODE_INT) - src = force_to_mode (src, mode, GET_MODE_MASK (mode), NULL_RTX, 0); - - /* If we are setting CC0 or if the source is a COMPARE, look for the use of - the comparison result and try to simplify it unless we already have used - undobuf.other_insn. */ - if ((GET_CODE (src) == COMPARE -#ifdef HAVE_cc0 - || dest == cc0_rtx -#endif - ) - && (cc_use = find_single_use (dest, subst_insn, &other_insn)) != 0 - && (undobuf.other_insn == 0 || other_insn == undobuf.other_insn) - && GET_RTX_CLASS (GET_CODE (*cc_use)) == '<' - && rtx_equal_p (XEXP (*cc_use, 0), dest)) - { - enum rtx_code old_code = GET_CODE (*cc_use); - enum rtx_code new_code; - rtx op0, op1; - int other_changed = 0; - enum machine_mode compare_mode = GET_MODE (dest); - - if (GET_CODE (src) == COMPARE) - op0 = XEXP (src, 0), op1 = XEXP (src, 1); - else - op0 = src, op1 = const0_rtx; - - /* Simplify our comparison, if possible. */ - new_code = simplify_comparison (old_code, &op0, &op1); - -#ifdef EXTRA_CC_MODES - /* If this machine has CC modes other than CCmode, check to see if we - need to use a different CC mode here. */ - compare_mode = SELECT_CC_MODE (new_code, op0, op1); -#endif /* EXTRA_CC_MODES */ - -#if !defined (HAVE_cc0) && defined (EXTRA_CC_MODES) - /* If the mode changed, we have to change SET_DEST, the mode in the - compare, and the mode in the place SET_DEST is used. If SET_DEST is - a hard register, just build new versions with the proper mode. If it - is a pseudo, we lose unless it is only time we set the pseudo, in - which case we can safely change its mode. */ - if (compare_mode != GET_MODE (dest)) - { - int regno = REGNO (dest); - rtx new_dest = gen_rtx_REG (compare_mode, regno); - - if (regno < FIRST_PSEUDO_REGISTER - || (REG_N_SETS (regno) == 1 && ! REG_USERVAR_P (dest))) - { - if (regno >= FIRST_PSEUDO_REGISTER) - SUBST (regno_reg_rtx[regno], new_dest); - - SUBST (SET_DEST (x), new_dest); - SUBST (XEXP (*cc_use, 0), new_dest); - other_changed = 1; - - dest = new_dest; - } - } -#endif - - /* If the code changed, we have to build a new comparison in - undobuf.other_insn. */ - if (new_code != old_code) - { - unsigned HOST_WIDE_INT mask; - - SUBST (*cc_use, gen_rtx_combine (new_code, GET_MODE (*cc_use), - dest, const0_rtx)); - - /* If the only change we made was to change an EQ into an NE or - vice versa, OP0 has only one bit that might be nonzero, and OP1 - is zero, check if changing the user of the condition code will - produce a valid insn. If it won't, we can keep the original code - in that insn by surrounding our operation with an XOR. */ - - if (((old_code == NE && new_code == EQ) - || (old_code == EQ && new_code == NE)) - && ! other_changed && op1 == const0_rtx - && GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT - && exact_log2 (mask = nonzero_bits (op0, GET_MODE (op0))) >= 0) - { - rtx pat = PATTERN (other_insn), note = 0; - - if ((recog_for_combine (&pat, other_insn, ¬e) < 0 - && ! check_asm_operands (pat))) - { - PUT_CODE (*cc_use, old_code); - other_insn = 0; - - op0 = gen_binary (XOR, GET_MODE (op0), op0, GEN_INT (mask)); - } - } - - other_changed = 1; - } - - if (other_changed) - undobuf.other_insn = other_insn; - -#ifdef HAVE_cc0 - /* If we are now comparing against zero, change our source if - needed. If we do not use cc0, we always have a COMPARE. */ - if (op1 == const0_rtx && dest == cc0_rtx) - { - SUBST (SET_SRC (x), op0); - src = op0; - } - else -#endif - - /* Otherwise, if we didn't previously have a COMPARE in the - correct mode, we need one. */ - if (GET_CODE (src) != COMPARE || GET_MODE (src) != compare_mode) - { - SUBST (SET_SRC (x), - gen_rtx_combine (COMPARE, compare_mode, op0, op1)); - src = SET_SRC (x); - } - else - { - /* Otherwise, update the COMPARE if needed. */ - SUBST (XEXP (src, 0), op0); - SUBST (XEXP (src, 1), op1); - } - } - else - { - /* Get SET_SRC in a form where we have placed back any - compound expressions. Then do the checks below. */ - src = make_compound_operation (src, SET); - SUBST (SET_SRC (x), src); - } - - /* If we have (set x (subreg:m1 (op:m2 ...) 0)) with OP being some operation, - and X being a REG or (subreg (reg)), we may be able to convert this to - (set (subreg:m2 x) (op)). - - We can always do this if M1 is narrower than M2 because that means that - we only care about the low bits of the result. - - However, on machines without WORD_REGISTER_OPERATIONS defined, we cannot - perform a narrower operation than requested since the high-order bits will - be undefined. On machine where it is defined, this transformation is safe - as long as M1 and M2 have the same number of words. */ - - if (GET_CODE (src) == SUBREG && subreg_lowpart_p (src) - && GET_RTX_CLASS (GET_CODE (SUBREG_REG (src))) != 'o' - && (((GET_MODE_SIZE (GET_MODE (src)) + (UNITS_PER_WORD - 1)) - / UNITS_PER_WORD) - == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (src))) - + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)) -#ifndef WORD_REGISTER_OPERATIONS - && (GET_MODE_SIZE (GET_MODE (src)) - < GET_MODE_SIZE (GET_MODE (SUBREG_REG (src)))) -#endif -#ifdef CLASS_CANNOT_CHANGE_SIZE - && ! (GET_CODE (dest) == REG && REGNO (dest) < FIRST_PSEUDO_REGISTER - && (TEST_HARD_REG_BIT - (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE], - REGNO (dest))) - && (GET_MODE_SIZE (GET_MODE (src)) - != GET_MODE_SIZE (GET_MODE (SUBREG_REG (src))))) -#endif - && (GET_CODE (dest) == REG - || (GET_CODE (dest) == SUBREG - && GET_CODE (SUBREG_REG (dest)) == REG))) - { - SUBST (SET_DEST (x), - gen_lowpart_for_combine (GET_MODE (SUBREG_REG (src)), - dest)); - SUBST (SET_SRC (x), SUBREG_REG (src)); - - src = SET_SRC (x), dest = SET_DEST (x); - } - -#ifdef LOAD_EXTEND_OP - /* If we have (set FOO (subreg:M (mem:N BAR) 0)) with M wider than N, this - would require a paradoxical subreg. Replace the subreg with a - zero_extend to avoid the reload that would otherwise be required. */ - - if (GET_CODE (src) == SUBREG && subreg_lowpart_p (src) - && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (src))) != NIL - && SUBREG_WORD (src) == 0 - && (GET_MODE_SIZE (GET_MODE (src)) - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (src)))) - && GET_CODE (SUBREG_REG (src)) == MEM) - { - SUBST (SET_SRC (x), - gen_rtx_combine (LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (src))), - GET_MODE (src), XEXP (src, 0))); - - src = SET_SRC (x); - } -#endif - - /* If we don't have a conditional move, SET_SRC is an IF_THEN_ELSE, and we - are comparing an item known to be 0 or -1 against 0, use a logical - operation instead. Check for one of the arms being an IOR of the other - arm with some value. We compute three terms to be IOR'ed together. In - practice, at most two will be nonzero. Then we do the IOR's. */ - - if (GET_CODE (dest) != PC - && GET_CODE (src) == IF_THEN_ELSE - && GET_MODE_CLASS (GET_MODE (src)) == MODE_INT - && (GET_CODE (XEXP (src, 0)) == EQ || GET_CODE (XEXP (src, 0)) == NE) - && XEXP (XEXP (src, 0), 1) == const0_rtx - && GET_MODE (src) == GET_MODE (XEXP (XEXP (src, 0), 0)) -#ifdef HAVE_conditional_move - && ! can_conditionally_move_p (GET_MODE (src)) -#endif - && (num_sign_bit_copies (XEXP (XEXP (src, 0), 0), - GET_MODE (XEXP (XEXP (src, 0), 0))) - == GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (src, 0), 0)))) - && ! side_effects_p (src)) - { - rtx true = (GET_CODE (XEXP (src, 0)) == NE - ? XEXP (src, 1) : XEXP (src, 2)); - rtx false = (GET_CODE (XEXP (src, 0)) == NE - ? XEXP (src, 2) : XEXP (src, 1)); - rtx term1 = const0_rtx, term2, term3; - - if (GET_CODE (true) == IOR && rtx_equal_p (XEXP (true, 0), false)) - term1 = false, true = XEXP (true, 1), false = const0_rtx; - else if (GET_CODE (true) == IOR - && rtx_equal_p (XEXP (true, 1), false)) - term1 = false, true = XEXP (true, 0), false = const0_rtx; - else if (GET_CODE (false) == IOR - && rtx_equal_p (XEXP (false, 0), true)) - term1 = true, false = XEXP (false, 1), true = const0_rtx; - else if (GET_CODE (false) == IOR - && rtx_equal_p (XEXP (false, 1), true)) - term1 = true, false = XEXP (false, 0), true = const0_rtx; - - term2 = gen_binary (AND, GET_MODE (src), XEXP (XEXP (src, 0), 0), true); - term3 = gen_binary (AND, GET_MODE (src), - gen_unary (NOT, GET_MODE (src), GET_MODE (src), - XEXP (XEXP (src, 0), 0)), - false); - - SUBST (SET_SRC (x), - gen_binary (IOR, GET_MODE (src), - gen_binary (IOR, GET_MODE (src), term1, term2), - term3)); - - src = SET_SRC (x); - } - - /* If either SRC or DEST is a CLOBBER of (const_int 0), make this - whole thing fail. */ - if (GET_CODE (src) == CLOBBER && XEXP (src, 0) == const0_rtx) - return src; - else if (GET_CODE (dest) == CLOBBER && XEXP (dest, 0) == const0_rtx) - return dest; - else - /* Convert this into a field assignment operation, if possible. */ - return make_field_assignment (x); -} - -/* Simplify, X, and AND, IOR, or XOR operation, and return the simplified - result. LAST is nonzero if this is the last retry. */ - -static rtx -simplify_logical (x, last) - rtx x; - int last; -{ - enum machine_mode mode = GET_MODE (x); - rtx op0 = XEXP (x, 0); - rtx op1 = XEXP (x, 1); - - switch (GET_CODE (x)) - { - case AND: - /* Convert (A ^ B) & A to A & (~ B) since the latter is often a single - insn (and may simplify more). */ - if (GET_CODE (op0) == XOR - && rtx_equal_p (XEXP (op0, 0), op1) - && ! side_effects_p (op1)) - x = gen_binary (AND, mode, - gen_unary (NOT, mode, mode, XEXP (op0, 1)), op1); - - if (GET_CODE (op0) == XOR - && rtx_equal_p (XEXP (op0, 1), op1) - && ! side_effects_p (op1)) - x = gen_binary (AND, mode, - gen_unary (NOT, mode, mode, XEXP (op0, 0)), op1); - - /* Similarly for (~ (A ^ B)) & A. */ - if (GET_CODE (op0) == NOT - && GET_CODE (XEXP (op0, 0)) == XOR - && rtx_equal_p (XEXP (XEXP (op0, 0), 0), op1) - && ! side_effects_p (op1)) - x = gen_binary (AND, mode, XEXP (XEXP (op0, 0), 1), op1); - - if (GET_CODE (op0) == NOT - && GET_CODE (XEXP (op0, 0)) == XOR - && rtx_equal_p (XEXP (XEXP (op0, 0), 1), op1) - && ! side_effects_p (op1)) - x = gen_binary (AND, mode, XEXP (XEXP (op0, 0), 0), op1); - - if (GET_CODE (op1) == CONST_INT) - { - x = simplify_and_const_int (x, mode, op0, INTVAL (op1)); - - /* If we have (ior (and (X C1) C2)) and the next restart would be - the last, simplify this by making C1 as small as possible - and then exit. */ - if (last - && GET_CODE (x) == IOR && GET_CODE (op0) == AND - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && GET_CODE (op1) == CONST_INT) - return gen_binary (IOR, mode, - gen_binary (AND, mode, XEXP (op0, 0), - GEN_INT (INTVAL (XEXP (op0, 1)) - & ~ INTVAL (op1))), op1); - - if (GET_CODE (x) != AND) - return x; - - if (GET_RTX_CLASS (GET_CODE (x)) == 'c' - || GET_RTX_CLASS (GET_CODE (x)) == '2') - op0 = XEXP (x, 0), op1 = XEXP (x, 1); - } - - /* Convert (A | B) & A to A. */ - if (GET_CODE (op0) == IOR - && (rtx_equal_p (XEXP (op0, 0), op1) - || rtx_equal_p (XEXP (op0, 1), op1)) - && ! side_effects_p (XEXP (op0, 0)) - && ! side_effects_p (XEXP (op0, 1))) - return op1; - - /* In the following group of tests (and those in case IOR below), - we start with some combination of logical operations and apply - the distributive law followed by the inverse distributive law. - Most of the time, this results in no change. However, if some of - the operands are the same or inverses of each other, simplifications - will result. - - For example, (and (ior A B) (not B)) can occur as the result of - expanding a bit field assignment. When we apply the distributive - law to this, we get (ior (and (A (not B))) (and (B (not B)))), - which then simplifies to (and (A (not B))). - - If we have (and (ior A B) C), apply the distributive law and then - the inverse distributive law to see if things simplify. */ - - if (GET_CODE (op0) == IOR || GET_CODE (op0) == XOR) - { - x = apply_distributive_law - (gen_binary (GET_CODE (op0), mode, - gen_binary (AND, mode, XEXP (op0, 0), op1), - gen_binary (AND, mode, XEXP (op0, 1), op1))); - if (GET_CODE (x) != AND) - return x; - } - - if (GET_CODE (op1) == IOR || GET_CODE (op1) == XOR) - return apply_distributive_law - (gen_binary (GET_CODE (op1), mode, - gen_binary (AND, mode, XEXP (op1, 0), op0), - gen_binary (AND, mode, XEXP (op1, 1), op0))); - - /* Similarly, taking advantage of the fact that - (and (not A) (xor B C)) == (xor (ior A B) (ior A C)) */ - - if (GET_CODE (op0) == NOT && GET_CODE (op1) == XOR) - return apply_distributive_law - (gen_binary (XOR, mode, - gen_binary (IOR, mode, XEXP (op0, 0), XEXP (op1, 0)), - gen_binary (IOR, mode, XEXP (op0, 0), XEXP (op1, 1)))); - - else if (GET_CODE (op1) == NOT && GET_CODE (op0) == XOR) - return apply_distributive_law - (gen_binary (XOR, mode, - gen_binary (IOR, mode, XEXP (op1, 0), XEXP (op0, 0)), - gen_binary (IOR, mode, XEXP (op1, 0), XEXP (op0, 1)))); - break; - - case IOR: - /* (ior A C) is C if all bits of A that might be nonzero are on in C. */ - if (GET_CODE (op1) == CONST_INT - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (op0, mode) & ~ INTVAL (op1)) == 0) - return op1; - - /* Convert (A & B) | A to A. */ - if (GET_CODE (op0) == AND - && (rtx_equal_p (XEXP (op0, 0), op1) - || rtx_equal_p (XEXP (op0, 1), op1)) - && ! side_effects_p (XEXP (op0, 0)) - && ! side_effects_p (XEXP (op0, 1))) - return op1; - - /* If we have (ior (and A B) C), apply the distributive law and then - the inverse distributive law to see if things simplify. */ - - if (GET_CODE (op0) == AND) - { - x = apply_distributive_law - (gen_binary (AND, mode, - gen_binary (IOR, mode, XEXP (op0, 0), op1), - gen_binary (IOR, mode, XEXP (op0, 1), op1))); - - if (GET_CODE (x) != IOR) - return x; - } - - if (GET_CODE (op1) == AND) - { - x = apply_distributive_law - (gen_binary (AND, mode, - gen_binary (IOR, mode, XEXP (op1, 0), op0), - gen_binary (IOR, mode, XEXP (op1, 1), op0))); - - if (GET_CODE (x) != IOR) - return x; - } - - /* Convert (ior (ashift A CX) (lshiftrt A CY)) where CX+CY equals the - mode size to (rotate A CX). */ - - if (((GET_CODE (op0) == ASHIFT && GET_CODE (op1) == LSHIFTRT) - || (GET_CODE (op1) == ASHIFT && GET_CODE (op0) == LSHIFTRT)) - && rtx_equal_p (XEXP (op0, 0), XEXP (op1, 0)) - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && GET_CODE (XEXP (op1, 1)) == CONST_INT - && (INTVAL (XEXP (op0, 1)) + INTVAL (XEXP (op1, 1)) - == GET_MODE_BITSIZE (mode))) - return gen_rtx_ROTATE (mode, XEXP (op0, 0), - (GET_CODE (op0) == ASHIFT - ? XEXP (op0, 1) : XEXP (op1, 1))); - - /* If OP0 is (ashiftrt (plus ...) C), it might actually be - a (sign_extend (plus ...)). If so, OP1 is a CONST_INT, and the PLUS - does not affect any of the bits in OP1, it can really be done - as a PLUS and we can associate. We do this by seeing if OP1 - can be safely shifted left C bits. */ - if (GET_CODE (op1) == CONST_INT && GET_CODE (op0) == ASHIFTRT - && GET_CODE (XEXP (op0, 0)) == PLUS - && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT) - { - int count = INTVAL (XEXP (op0, 1)); - HOST_WIDE_INT mask = INTVAL (op1) << count; - - if (mask >> count == INTVAL (op1) - && (mask & nonzero_bits (XEXP (op0, 0), mode)) == 0) - { - SUBST (XEXP (XEXP (op0, 0), 1), - GEN_INT (INTVAL (XEXP (XEXP (op0, 0), 1)) | mask)); - return op0; - } - } - break; - - case XOR: - /* Convert (XOR (NOT x) (NOT y)) to (XOR x y). - Also convert (XOR (NOT x) y) to (NOT (XOR x y)), similarly for - (NOT y). */ - { - int num_negated = 0; - - if (GET_CODE (op0) == NOT) - num_negated++, op0 = XEXP (op0, 0); - if (GET_CODE (op1) == NOT) - num_negated++, op1 = XEXP (op1, 0); - - if (num_negated == 2) - { - SUBST (XEXP (x, 0), op0); - SUBST (XEXP (x, 1), op1); - } - else if (num_negated == 1) - return gen_unary (NOT, mode, mode, gen_binary (XOR, mode, op0, op1)); - } - - /* Convert (xor (and A B) B) to (and (not A) B). The latter may - correspond to a machine insn or result in further simplifications - if B is a constant. */ - - if (GET_CODE (op0) == AND - && rtx_equal_p (XEXP (op0, 1), op1) - && ! side_effects_p (op1)) - return gen_binary (AND, mode, - gen_unary (NOT, mode, mode, XEXP (op0, 0)), - op1); - - else if (GET_CODE (op0) == AND - && rtx_equal_p (XEXP (op0, 0), op1) - && ! side_effects_p (op1)) - return gen_binary (AND, mode, - gen_unary (NOT, mode, mode, XEXP (op0, 1)), - op1); - - /* (xor (comparison foo bar) (const_int 1)) can become the reversed - comparison if STORE_FLAG_VALUE is 1. */ - if (STORE_FLAG_VALUE == 1 - && op1 == const1_rtx - && GET_RTX_CLASS (GET_CODE (op0)) == '<' - && reversible_comparison_p (op0)) - return gen_rtx_combine (reverse_condition (GET_CODE (op0)), - mode, XEXP (op0, 0), XEXP (op0, 1)); - - /* (lshiftrt foo C) where C is the number of bits in FOO minus 1 - is (lt foo (const_int 0)), so we can perform the above - simplification if STORE_FLAG_VALUE is 1. */ - - if (STORE_FLAG_VALUE == 1 - && op1 == const1_rtx - && GET_CODE (op0) == LSHIFTRT - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && INTVAL (XEXP (op0, 1)) == GET_MODE_BITSIZE (mode) - 1) - return gen_rtx_combine (GE, mode, XEXP (op0, 0), const0_rtx); - - /* (xor (comparison foo bar) (const_int sign-bit)) - when STORE_FLAG_VALUE is the sign bit. */ - if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && ((STORE_FLAG_VALUE & GET_MODE_MASK (mode)) - == (unsigned HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (mode) - 1)) - && op1 == const_true_rtx - && GET_RTX_CLASS (GET_CODE (op0)) == '<' - && reversible_comparison_p (op0)) - return gen_rtx_combine (reverse_condition (GET_CODE (op0)), - mode, XEXP (op0, 0), XEXP (op0, 1)); - break; - - default: - abort (); - } - - return x; -} - -/* We consider ZERO_EXTRACT, SIGN_EXTRACT, and SIGN_EXTEND as "compound - operations" because they can be replaced with two more basic operations. - ZERO_EXTEND is also considered "compound" because it can be replaced with - an AND operation, which is simpler, though only one operation. - - The function expand_compound_operation is called with an rtx expression - and will convert it to the appropriate shifts and AND operations, - simplifying at each stage. - - The function make_compound_operation is called to convert an expression - consisting of shifts and ANDs into the equivalent compound expression. - It is the inverse of this function, loosely speaking. */ - -static rtx -expand_compound_operation (x) - rtx x; -{ - int pos = 0, len; - int unsignedp = 0; - int modewidth; - rtx tem; - - switch (GET_CODE (x)) - { - case ZERO_EXTEND: - unsignedp = 1; - case SIGN_EXTEND: - /* We can't necessarily use a const_int for a multiword mode; - it depends on implicitly extending the value. - Since we don't know the right way to extend it, - we can't tell whether the implicit way is right. - - Even for a mode that is no wider than a const_int, - we can't win, because we need to sign extend one of its bits through - the rest of it, and we don't know which bit. */ - if (GET_CODE (XEXP (x, 0)) == CONST_INT) - return x; - - /* Return if (subreg:MODE FROM 0) is not a safe replacement for - (zero_extend:MODE FROM) or (sign_extend:MODE FROM). It is for any MEM - because (SUBREG (MEM...)) is guaranteed to cause the MEM to be - reloaded. If not for that, MEM's would very rarely be safe. - - Reject MODEs bigger than a word, because we might not be able - to reference a two-register group starting with an arbitrary register - (and currently gen_lowpart might crash for a SUBREG). */ - - if (GET_MODE_SIZE (GET_MODE (XEXP (x, 0))) > UNITS_PER_WORD) - return x; - - len = GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))); - /* If the inner object has VOIDmode (the only way this can happen - is if it is a ASM_OPERANDS), we can't do anything since we don't - know how much masking to do. */ - if (len == 0) - return x; - - break; - - case ZERO_EXTRACT: - unsignedp = 1; - case SIGN_EXTRACT: - /* If the operand is a CLOBBER, just return it. */ - if (GET_CODE (XEXP (x, 0)) == CLOBBER) - return XEXP (x, 0); - - if (GET_CODE (XEXP (x, 1)) != CONST_INT - || GET_CODE (XEXP (x, 2)) != CONST_INT - || GET_MODE (XEXP (x, 0)) == VOIDmode) - return x; - - len = INTVAL (XEXP (x, 1)); - pos = INTVAL (XEXP (x, 2)); - - /* If this goes outside the object being extracted, replace the object - with a (use (mem ...)) construct that only combine understands - and is used only for this purpose. */ - if (len + pos > GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))) - SUBST (XEXP (x, 0), gen_rtx_USE (GET_MODE (x), XEXP (x, 0))); - - if (BITS_BIG_ENDIAN) - pos = GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - len - pos; - - break; - - default: - return x; - } - - /* We can optimize some special cases of ZERO_EXTEND. */ - if (GET_CODE (x) == ZERO_EXTEND) - { - /* (zero_extend:DI (truncate:SI foo:DI)) is just foo:DI if we - know that the last value didn't have any inappropriate bits - set. */ - if (GET_CODE (XEXP (x, 0)) == TRUNCATE - && GET_MODE (XEXP (XEXP (x, 0), 0)) == GET_MODE (x) - && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (XEXP (XEXP (x, 0), 0), GET_MODE (x)) - & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0) - return XEXP (XEXP (x, 0), 0); - - /* Likewise for (zero_extend:DI (subreg:SI foo:DI 0)). */ - if (GET_CODE (XEXP (x, 0)) == SUBREG - && GET_MODE (SUBREG_REG (XEXP (x, 0))) == GET_MODE (x) - && subreg_lowpart_p (XEXP (x, 0)) - && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (SUBREG_REG (XEXP (x, 0)), GET_MODE (x)) - & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0) - return SUBREG_REG (XEXP (x, 0)); - - /* (zero_extend:DI (truncate:SI foo:DI)) is just foo:DI when foo - is a comparison and STORE_FLAG_VALUE permits. This is like - the first case, but it works even when GET_MODE (x) is larger - than HOST_WIDE_INT. */ - if (GET_CODE (XEXP (x, 0)) == TRUNCATE - && GET_MODE (XEXP (XEXP (x, 0), 0)) == GET_MODE (x) - && GET_RTX_CLASS (GET_CODE (XEXP (XEXP (x, 0), 0))) == '<' - && (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - <= HOST_BITS_PER_WIDE_INT) - && ((HOST_WIDE_INT) STORE_FLAG_VALUE - & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0) - return XEXP (XEXP (x, 0), 0); - - /* Likewise for (zero_extend:DI (subreg:SI foo:DI 0)). */ - if (GET_CODE (XEXP (x, 0)) == SUBREG - && GET_MODE (SUBREG_REG (XEXP (x, 0))) == GET_MODE (x) - && subreg_lowpart_p (XEXP (x, 0)) - && GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) == '<' - && (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - <= HOST_BITS_PER_WIDE_INT) - && ((HOST_WIDE_INT) STORE_FLAG_VALUE - & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0) - return SUBREG_REG (XEXP (x, 0)); - - /* If sign extension is cheaper than zero extension, then use it - if we know that no extraneous bits are set, and that the high - bit is not set. */ - if (flag_expensive_optimizations - && ((GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT - && ((nonzero_bits (XEXP (x, 0), GET_MODE (x)) - & ~ (((unsigned HOST_WIDE_INT) - GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) - >> 1)) - == 0)) - || (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == '<' - && (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - <= HOST_BITS_PER_WIDE_INT) - && (((HOST_WIDE_INT) STORE_FLAG_VALUE - & ~ (((unsigned HOST_WIDE_INT) - GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) - >> 1)) - == 0)))) - { - rtx temp = gen_rtx_SIGN_EXTEND (GET_MODE (x), XEXP (x, 0)); - - if (rtx_cost (temp, SET) < rtx_cost (x, SET)) - return expand_compound_operation (temp); - } - } - - /* If we reach here, we want to return a pair of shifts. The inner - shift is a left shift of BITSIZE - POS - LEN bits. The outer - shift is a right shift of BITSIZE - LEN bits. It is arithmetic or - logical depending on the value of UNSIGNEDP. - - If this was a ZERO_EXTEND or ZERO_EXTRACT, this pair of shifts will be - converted into an AND of a shift. - - We must check for the case where the left shift would have a negative - count. This can happen in a case like (x >> 31) & 255 on machines - that can't shift by a constant. On those machines, we would first - combine the shift with the AND to produce a variable-position - extraction. Then the constant of 31 would be substituted in to produce - a such a position. */ - - modewidth = GET_MODE_BITSIZE (GET_MODE (x)); - if (modewidth >= pos - len) - tem = simplify_shift_const (NULL_RTX, unsignedp ? LSHIFTRT : ASHIFTRT, - GET_MODE (x), - simplify_shift_const (NULL_RTX, ASHIFT, - GET_MODE (x), - XEXP (x, 0), - modewidth - pos - len), - modewidth - len); - - else if (unsignedp && len < HOST_BITS_PER_WIDE_INT) - tem = simplify_and_const_int (NULL_RTX, GET_MODE (x), - simplify_shift_const (NULL_RTX, LSHIFTRT, - GET_MODE (x), - XEXP (x, 0), pos), - ((HOST_WIDE_INT) 1 << len) - 1); - else - /* Any other cases we can't handle. */ - return x; - - - /* If we couldn't do this for some reason, return the original - expression. */ - if (GET_CODE (tem) == CLOBBER) - return x; - - return tem; -} - -/* X is a SET which contains an assignment of one object into - a part of another (such as a bit-field assignment, STRICT_LOW_PART, - or certain SUBREGS). If possible, convert it into a series of - logical operations. - - We half-heartedly support variable positions, but do not at all - support variable lengths. */ - -static rtx -expand_field_assignment (x) - rtx x; -{ - rtx inner; - rtx pos; /* Always counts from low bit. */ - int len; - rtx mask; - enum machine_mode compute_mode; - - /* Loop until we find something we can't simplify. */ - while (1) - { - if (GET_CODE (SET_DEST (x)) == STRICT_LOW_PART - && GET_CODE (XEXP (SET_DEST (x), 0)) == SUBREG) - { - inner = SUBREG_REG (XEXP (SET_DEST (x), 0)); - len = GET_MODE_BITSIZE (GET_MODE (XEXP (SET_DEST (x), 0))); - pos = GEN_INT (BITS_PER_WORD * SUBREG_WORD (XEXP (SET_DEST (x), 0))); - } - else if (GET_CODE (SET_DEST (x)) == ZERO_EXTRACT - && GET_CODE (XEXP (SET_DEST (x), 1)) == CONST_INT) - { - inner = XEXP (SET_DEST (x), 0); - len = INTVAL (XEXP (SET_DEST (x), 1)); - pos = XEXP (SET_DEST (x), 2); - - /* If the position is constant and spans the width of INNER, - surround INNER with a USE to indicate this. */ - if (GET_CODE (pos) == CONST_INT - && INTVAL (pos) + len > GET_MODE_BITSIZE (GET_MODE (inner))) - inner = gen_rtx_USE (GET_MODE (SET_DEST (x)), inner); - - if (BITS_BIG_ENDIAN) - { - if (GET_CODE (pos) == CONST_INT) - pos = GEN_INT (GET_MODE_BITSIZE (GET_MODE (inner)) - len - - INTVAL (pos)); - else if (GET_CODE (pos) == MINUS - && GET_CODE (XEXP (pos, 1)) == CONST_INT - && (INTVAL (XEXP (pos, 1)) - == GET_MODE_BITSIZE (GET_MODE (inner)) - len)) - /* If position is ADJUST - X, new position is X. */ - pos = XEXP (pos, 0); - else - pos = gen_binary (MINUS, GET_MODE (pos), - GEN_INT (GET_MODE_BITSIZE (GET_MODE (inner)) - - len), - pos); - } - } - - /* A SUBREG between two modes that occupy the same numbers of words - can be done by moving the SUBREG to the source. */ - else if (GET_CODE (SET_DEST (x)) == SUBREG - && (((GET_MODE_SIZE (GET_MODE (SET_DEST (x))) - + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD) - == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (x)))) - + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD))) - { - x = gen_rtx_SET (VOIDmode, SUBREG_REG (SET_DEST (x)), - gen_lowpart_for_combine (GET_MODE (SUBREG_REG (SET_DEST (x))), - SET_SRC (x))); - continue; - } - else - break; - - while (GET_CODE (inner) == SUBREG && subreg_lowpart_p (inner)) - inner = SUBREG_REG (inner); - - compute_mode = GET_MODE (inner); - - /* Don't attempt bitwise arithmetic on non-integral modes. */ - if (! INTEGRAL_MODE_P (compute_mode)) - { - enum machine_mode imode; - - /* Something is probably seriously wrong if this matches. */ - if (! FLOAT_MODE_P (compute_mode)) - break; - - /* Try to find an integral mode to pun with. */ - imode = mode_for_size (GET_MODE_BITSIZE (compute_mode), MODE_INT, 0); - if (imode == BLKmode) - break; - - compute_mode = imode; - inner = gen_lowpart_for_combine (imode, inner); - } - - /* Compute a mask of LEN bits, if we can do this on the host machine. */ - if (len < HOST_BITS_PER_WIDE_INT) - mask = GEN_INT (((HOST_WIDE_INT) 1 << len) - 1); - else - break; - - /* Now compute the equivalent expression. Make a copy of INNER - for the SET_DEST in case it is a MEM into which we will substitute; - we don't want shared RTL in that case. */ - x = gen_rtx_SET (VOIDmode, copy_rtx (inner), - gen_binary (IOR, compute_mode, - gen_binary (AND, compute_mode, - gen_unary (NOT, compute_mode, - compute_mode, - gen_binary (ASHIFT, - compute_mode, - mask, pos)), - inner), - gen_binary (ASHIFT, compute_mode, - gen_binary (AND, compute_mode, - gen_lowpart_for_combine - (compute_mode, - SET_SRC (x)), - mask), - pos))); - } - - return x; -} - -/* Return an RTX for a reference to LEN bits of INNER. If POS_RTX is nonzero, - it is an RTX that represents a variable starting position; otherwise, - POS is the (constant) starting bit position (counted from the LSB). - - INNER may be a USE. This will occur when we started with a bitfield - that went outside the boundary of the object in memory, which is - allowed on most machines. To isolate this case, we produce a USE - whose mode is wide enough and surround the MEM with it. The only - code that understands the USE is this routine. If it is not removed, - it will cause the resulting insn not to match. - - UNSIGNEDP is non-zero for an unsigned reference and zero for a - signed reference. - - IN_DEST is non-zero if this is a reference in the destination of a - SET. This is used when a ZERO_ or SIGN_EXTRACT isn't needed. If non-zero, - a STRICT_LOW_PART will be used, if zero, ZERO_EXTEND or SIGN_EXTEND will - be used. - - IN_COMPARE is non-zero if we are in a COMPARE. This means that a - ZERO_EXTRACT should be built even for bits starting at bit 0. - - MODE is the desired mode of the result (if IN_DEST == 0). - - The result is an RTX for the extraction or NULL_RTX if the target - can't handle it. */ - -static rtx -make_extraction (mode, inner, pos, pos_rtx, len, - unsignedp, in_dest, in_compare) - enum machine_mode mode; - rtx inner; - int pos; - rtx pos_rtx; - int len; - int unsignedp; - int in_dest, in_compare; -{ - /* This mode describes the size of the storage area - to fetch the overall value from. Within that, we - ignore the POS lowest bits, etc. */ - enum machine_mode is_mode = GET_MODE (inner); - enum machine_mode inner_mode; - enum machine_mode wanted_inner_mode = byte_mode; - enum machine_mode wanted_inner_reg_mode = word_mode; - enum machine_mode pos_mode = word_mode; - enum machine_mode extraction_mode = word_mode; - enum machine_mode tmode = mode_for_size (len, MODE_INT, 1); - int spans_byte = 0; - rtx new = 0; - rtx orig_pos_rtx = pos_rtx; - int orig_pos; - - /* Get some information about INNER and get the innermost object. */ - if (GET_CODE (inner) == USE) - /* (use:SI (mem:QI foo)) stands for (mem:SI foo). */ - /* We don't need to adjust the position because we set up the USE - to pretend that it was a full-word object. */ - spans_byte = 1, inner = XEXP (inner, 0); - else if (GET_CODE (inner) == SUBREG && subreg_lowpart_p (inner)) - { - /* If going from (subreg:SI (mem:QI ...)) to (mem:QI ...), - consider just the QI as the memory to extract from. - The subreg adds or removes high bits; its mode is - irrelevant to the meaning of this extraction, - since POS and LEN count from the lsb. */ - if (GET_CODE (SUBREG_REG (inner)) == MEM) - is_mode = GET_MODE (SUBREG_REG (inner)); - inner = SUBREG_REG (inner); - } - - inner_mode = GET_MODE (inner); - - if (pos_rtx && GET_CODE (pos_rtx) == CONST_INT) - pos = INTVAL (pos_rtx), pos_rtx = 0; - - /* See if this can be done without an extraction. We never can if the - width of the field is not the same as that of some integer mode. For - registers, we can only avoid the extraction if the position is at the - low-order bit and this is either not in the destination or we have the - appropriate STRICT_LOW_PART operation available. - - For MEM, we can avoid an extract if the field starts on an appropriate - boundary and we can change the mode of the memory reference. However, - we cannot directly access the MEM if we have a USE and the underlying - MEM is not TMODE. This combination means that MEM was being used in a - context where bits outside its mode were being referenced; that is only - valid in bit-field insns. */ - - if (tmode != BLKmode - && ! (spans_byte && inner_mode != tmode) - && ((pos_rtx == 0 && (pos % BITS_PER_WORD) == 0 - && GET_CODE (inner) != MEM - && (! in_dest - || (GET_CODE (inner) == REG - && (movstrict_optab->handlers[(int) tmode].insn_code - != CODE_FOR_nothing)))) - || (GET_CODE (inner) == MEM && pos_rtx == 0 - && (pos - % (STRICT_ALIGNMENT ? GET_MODE_ALIGNMENT (tmode) - : BITS_PER_UNIT)) == 0 - /* We can't do this if we are widening INNER_MODE (it - may not be aligned, for one thing). */ - && GET_MODE_BITSIZE (inner_mode) >= GET_MODE_BITSIZE (tmode) - && (inner_mode == tmode - || (! mode_dependent_address_p (XEXP (inner, 0)) - && ! MEM_VOLATILE_P (inner)))))) - { - /* If INNER is a MEM, make a new MEM that encompasses just the desired - field. If the original and current mode are the same, we need not - adjust the offset. Otherwise, we do if bytes big endian. - - If INNER is not a MEM, get a piece consisting of just the field - of interest (in this case POS % BITS_PER_WORD must be 0). */ - - if (GET_CODE (inner) == MEM) - { - int offset; - /* POS counts from lsb, but make OFFSET count in memory order. */ - if (BYTES_BIG_ENDIAN) - offset = (GET_MODE_BITSIZE (is_mode) - len - pos) / BITS_PER_UNIT; - else - offset = pos / BITS_PER_UNIT; - - new = gen_rtx_MEM (tmode, plus_constant (XEXP (inner, 0), offset)); - RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (inner); - MEM_COPY_ATTRIBUTES (new, inner); - } - else if (GET_CODE (inner) == REG) - { - /* We can't call gen_lowpart_for_combine here since we always want - a SUBREG and it would sometimes return a new hard register. */ - if (tmode != inner_mode) - new = gen_rtx_SUBREG (tmode, inner, - (WORDS_BIG_ENDIAN - && GET_MODE_SIZE (inner_mode) > UNITS_PER_WORD - ? (((GET_MODE_SIZE (inner_mode) - - GET_MODE_SIZE (tmode)) - / UNITS_PER_WORD) - - pos / BITS_PER_WORD) - : pos / BITS_PER_WORD)); - else - new = inner; - } - else - new = force_to_mode (inner, tmode, - len >= HOST_BITS_PER_WIDE_INT - ? GET_MODE_MASK (tmode) - : ((HOST_WIDE_INT) 1 << len) - 1, - NULL_RTX, 0); - - /* If this extraction is going into the destination of a SET, - make a STRICT_LOW_PART unless we made a MEM. */ - - if (in_dest) - return (GET_CODE (new) == MEM ? new - : (GET_CODE (new) != SUBREG - ? gen_rtx_CLOBBER (tmode, const0_rtx) - : gen_rtx_combine (STRICT_LOW_PART, VOIDmode, new))); - - /* Otherwise, sign- or zero-extend unless we already are in the - proper mode. */ - - return (mode == tmode ? new - : gen_rtx_combine (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, - mode, new)); - } - - /* Unless this is a COMPARE or we have a funny memory reference, - don't do anything with zero-extending field extracts starting at - the low-order bit since they are simple AND operations. */ - if (pos_rtx == 0 && pos == 0 && ! in_dest - && ! in_compare && ! spans_byte && unsignedp) - return 0; - - /* Unless we are allowed to span bytes, reject this if we would be - spanning bytes or if the position is not a constant and the length - is not 1. In all other cases, we would only be going outside - out object in cases when an original shift would have been - undefined. */ - if (! spans_byte - && ((pos_rtx == 0 && pos + len > GET_MODE_BITSIZE (is_mode)) - || (pos_rtx != 0 && len != 1))) - return 0; - - /* Get the mode to use should INNER not be a MEM, the mode for the position, - and the mode for the result. */ -#ifdef HAVE_insv - if (in_dest) - { - wanted_inner_reg_mode - = (insn_operand_mode[(int) CODE_FOR_insv][0] == VOIDmode - ? word_mode - : insn_operand_mode[(int) CODE_FOR_insv][0]); - pos_mode = (insn_operand_mode[(int) CODE_FOR_insv][2] == VOIDmode - ? word_mode : insn_operand_mode[(int) CODE_FOR_insv][2]); - extraction_mode = (insn_operand_mode[(int) CODE_FOR_insv][3] == VOIDmode - ? word_mode - : insn_operand_mode[(int) CODE_FOR_insv][3]); - } -#endif - -#ifdef HAVE_extzv - if (! in_dest && unsignedp) - { - wanted_inner_reg_mode - = (insn_operand_mode[(int) CODE_FOR_extzv][1] == VOIDmode - ? word_mode - : insn_operand_mode[(int) CODE_FOR_extzv][1]); - pos_mode = (insn_operand_mode[(int) CODE_FOR_extzv][3] == VOIDmode - ? word_mode : insn_operand_mode[(int) CODE_FOR_extzv][3]); - extraction_mode = (insn_operand_mode[(int) CODE_FOR_extzv][0] == VOIDmode - ? word_mode - : insn_operand_mode[(int) CODE_FOR_extzv][0]); - } -#endif - -#ifdef HAVE_extv - if (! in_dest && ! unsignedp) - { - wanted_inner_reg_mode - = (insn_operand_mode[(int) CODE_FOR_extv][1] == VOIDmode - ? word_mode - : insn_operand_mode[(int) CODE_FOR_extv][1]); - pos_mode = (insn_operand_mode[(int) CODE_FOR_extv][3] == VOIDmode - ? word_mode : insn_operand_mode[(int) CODE_FOR_extv][3]); - extraction_mode = (insn_operand_mode[(int) CODE_FOR_extv][0] == VOIDmode - ? word_mode - : insn_operand_mode[(int) CODE_FOR_extv][0]); - } -#endif - - /* Never narrow an object, since that might not be safe. */ - - if (mode != VOIDmode - && GET_MODE_SIZE (extraction_mode) < GET_MODE_SIZE (mode)) - extraction_mode = mode; - - if (pos_rtx && GET_MODE (pos_rtx) != VOIDmode - && GET_MODE_SIZE (pos_mode) < GET_MODE_SIZE (GET_MODE (pos_rtx))) - pos_mode = GET_MODE (pos_rtx); - - /* If this is not from memory, the desired mode is wanted_inner_reg_mode; - if we have to change the mode of memory and cannot, the desired mode is - EXTRACTION_MODE. */ - if (GET_CODE (inner) != MEM) - wanted_inner_mode = wanted_inner_reg_mode; - else if (inner_mode != wanted_inner_mode - && (mode_dependent_address_p (XEXP (inner, 0)) - || MEM_VOLATILE_P (inner))) - wanted_inner_mode = extraction_mode; - - orig_pos = pos; - - if (BITS_BIG_ENDIAN) - { - /* POS is passed as if BITS_BIG_ENDIAN == 0, so we need to convert it to - BITS_BIG_ENDIAN style. If position is constant, compute new - position. Otherwise, build subtraction. - Note that POS is relative to the mode of the original argument. - If it's a MEM we need to recompute POS relative to that. - However, if we're extracting from (or inserting into) a register, - we want to recompute POS relative to wanted_inner_mode. */ - int width = (GET_CODE (inner) == MEM - ? GET_MODE_BITSIZE (is_mode) - : GET_MODE_BITSIZE (wanted_inner_mode)); - - if (pos_rtx == 0) - pos = width - len - pos; - else - pos_rtx - = gen_rtx_combine (MINUS, GET_MODE (pos_rtx), - GEN_INT (width - len), pos_rtx); - /* POS may be less than 0 now, but we check for that below. - Note that it can only be less than 0 if GET_CODE (inner) != MEM. */ - } - - /* If INNER has a wider mode, make it smaller. If this is a constant - extract, try to adjust the byte to point to the byte containing - the value. */ - if (wanted_inner_mode != VOIDmode - && GET_MODE_SIZE (wanted_inner_mode) < GET_MODE_SIZE (is_mode) - && ((GET_CODE (inner) == MEM - && (inner_mode == wanted_inner_mode - || (! mode_dependent_address_p (XEXP (inner, 0)) - && ! MEM_VOLATILE_P (inner)))))) - { - int offset = 0; - - /* The computations below will be correct if the machine is big - endian in both bits and bytes or little endian in bits and bytes. - If it is mixed, we must adjust. */ - - /* If bytes are big endian and we had a paradoxical SUBREG, we must - adjust OFFSET to compensate. */ - if (BYTES_BIG_ENDIAN - && ! spans_byte - && GET_MODE_SIZE (inner_mode) < GET_MODE_SIZE (is_mode)) - offset -= GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (inner_mode); - - /* If this is a constant position, we can move to the desired byte. */ - if (pos_rtx == 0) - { - offset += pos / BITS_PER_UNIT; - pos %= GET_MODE_BITSIZE (wanted_inner_mode); - } - - if (BYTES_BIG_ENDIAN != BITS_BIG_ENDIAN - && ! spans_byte - && is_mode != wanted_inner_mode) - offset = (GET_MODE_SIZE (is_mode) - - GET_MODE_SIZE (wanted_inner_mode) - offset); - - if (offset != 0 || inner_mode != wanted_inner_mode) - { - rtx newmem = gen_rtx_MEM (wanted_inner_mode, - plus_constant (XEXP (inner, 0), offset)); - RTX_UNCHANGING_P (newmem) = RTX_UNCHANGING_P (inner); - MEM_COPY_ATTRIBUTES (newmem, inner); - inner = newmem; - } - } - - /* If INNER is not memory, we can always get it into the proper mode. If we - are changing its mode, POS must be a constant and smaller than the size - of the new mode. */ - else if (GET_CODE (inner) != MEM) - { - if (GET_MODE (inner) != wanted_inner_mode - && (pos_rtx != 0 - || orig_pos + len > GET_MODE_BITSIZE (wanted_inner_mode))) - return 0; - - inner = force_to_mode (inner, wanted_inner_mode, - pos_rtx - || len + orig_pos >= HOST_BITS_PER_WIDE_INT - ? GET_MODE_MASK (wanted_inner_mode) - : (((HOST_WIDE_INT) 1 << len) - 1) << orig_pos, - NULL_RTX, 0); - } - - /* Adjust mode of POS_RTX, if needed. If we want a wider mode, we - have to zero extend. Otherwise, we can just use a SUBREG. */ - if (pos_rtx != 0 - && GET_MODE_SIZE (pos_mode) > GET_MODE_SIZE (GET_MODE (pos_rtx))) - pos_rtx = gen_rtx_combine (ZERO_EXTEND, pos_mode, pos_rtx); - else if (pos_rtx != 0 - && GET_MODE_SIZE (pos_mode) < GET_MODE_SIZE (GET_MODE (pos_rtx))) - pos_rtx = gen_lowpart_for_combine (pos_mode, pos_rtx); - - /* Make POS_RTX unless we already have it and it is correct. If we don't - have a POS_RTX but we do have an ORIG_POS_RTX, the latter must - be a CONST_INT. */ - if (pos_rtx == 0 && orig_pos_rtx != 0 && INTVAL (orig_pos_rtx) == pos) - pos_rtx = orig_pos_rtx; - - else if (pos_rtx == 0) - pos_rtx = GEN_INT (pos); - - /* Make the required operation. See if we can use existing rtx. */ - new = gen_rtx_combine (unsignedp ? ZERO_EXTRACT : SIGN_EXTRACT, - extraction_mode, inner, GEN_INT (len), pos_rtx); - if (! in_dest) - new = gen_lowpart_for_combine (mode, new); - - return new; -} - -/* See if X contains an ASHIFT of COUNT or more bits that can be commuted - with any other operations in X. Return X without that shift if so. */ - -static rtx -extract_left_shift (x, count) - rtx x; - int count; -{ - enum rtx_code code = GET_CODE (x); - enum machine_mode mode = GET_MODE (x); - rtx tem; - - switch (code) - { - case ASHIFT: - /* This is the shift itself. If it is wide enough, we will return - either the value being shifted if the shift count is equal to - COUNT or a shift for the difference. */ - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) >= count) - return simplify_shift_const (NULL_RTX, ASHIFT, mode, XEXP (x, 0), - INTVAL (XEXP (x, 1)) - count); - break; - - case NEG: case NOT: - if ((tem = extract_left_shift (XEXP (x, 0), count)) != 0) - return gen_unary (code, mode, mode, tem); - - break; - - case PLUS: case IOR: case XOR: case AND: - /* If we can safely shift this constant and we find the inner shift, - make a new operation. */ - if (GET_CODE (XEXP (x,1)) == CONST_INT - && (INTVAL (XEXP (x, 1)) & ((((HOST_WIDE_INT) 1 << count)) - 1)) == 0 - && (tem = extract_left_shift (XEXP (x, 0), count)) != 0) - return gen_binary (code, mode, tem, - GEN_INT (INTVAL (XEXP (x, 1)) >> count)); - - break; - - default: - break; - } - - return 0; -} - -/* Look at the expression rooted at X. Look for expressions - equivalent to ZERO_EXTRACT, SIGN_EXTRACT, ZERO_EXTEND, SIGN_EXTEND. - Form these expressions. - - Return the new rtx, usually just X. - - Also, for machines like the Vax that don't have logical shift insns, - try to convert logical to arithmetic shift operations in cases where - they are equivalent. This undoes the canonicalizations to logical - shifts done elsewhere. - - We try, as much as possible, to re-use rtl expressions to save memory. - - IN_CODE says what kind of expression we are processing. Normally, it is - SET. In a memory address (inside a MEM, PLUS or minus, the latter two - being kludges), it is MEM. When processing the arguments of a comparison - or a COMPARE against zero, it is COMPARE. */ - -static rtx -make_compound_operation (x, in_code) - rtx x; - enum rtx_code in_code; -{ - enum rtx_code code = GET_CODE (x); - enum machine_mode mode = GET_MODE (x); - int mode_width = GET_MODE_BITSIZE (mode); - rtx rhs, lhs; - enum rtx_code next_code; - int i; - rtx new = 0; - rtx tem; - char *fmt; - - /* Select the code to be used in recursive calls. Once we are inside an - address, we stay there. If we have a comparison, set to COMPARE, - but once inside, go back to our default of SET. */ - - next_code = (code == MEM || code == PLUS || code == MINUS ? MEM - : ((code == COMPARE || GET_RTX_CLASS (code) == '<') - && XEXP (x, 1) == const0_rtx) ? COMPARE - : in_code == COMPARE ? SET : in_code); - - /* Process depending on the code of this operation. If NEW is set - non-zero, it will be returned. */ - - switch (code) - { - case ASHIFT: - /* Convert shifts by constants into multiplications if inside - an address. */ - if (in_code == MEM && GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT - && INTVAL (XEXP (x, 1)) >= 0) - { - new = make_compound_operation (XEXP (x, 0), next_code); - new = gen_rtx_combine (MULT, mode, new, - GEN_INT ((HOST_WIDE_INT) 1 - << INTVAL (XEXP (x, 1)))); - } - break; - - case AND: - /* If the second operand is not a constant, we can't do anything - with it. */ - if (GET_CODE (XEXP (x, 1)) != CONST_INT) - break; - - /* If the constant is a power of two minus one and the first operand - is a logical right shift, make an extraction. */ - if (GET_CODE (XEXP (x, 0)) == LSHIFTRT - && (i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0) - { - new = make_compound_operation (XEXP (XEXP (x, 0), 0), next_code); - new = make_extraction (mode, new, 0, XEXP (XEXP (x, 0), 1), i, 1, - 0, in_code == COMPARE); - } - - /* Same as previous, but for (subreg (lshiftrt ...)) in first op. */ - else if (GET_CODE (XEXP (x, 0)) == SUBREG - && subreg_lowpart_p (XEXP (x, 0)) - && GET_CODE (SUBREG_REG (XEXP (x, 0))) == LSHIFTRT - && (i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0) - { - new = make_compound_operation (XEXP (SUBREG_REG (XEXP (x, 0)), 0), - next_code); - new = make_extraction (GET_MODE (SUBREG_REG (XEXP (x, 0))), new, 0, - XEXP (SUBREG_REG (XEXP (x, 0)), 1), i, 1, - 0, in_code == COMPARE); - } - /* Same as previous, but for (xor/ior (lshiftrt...) (lshiftrt...)). */ - else if ((GET_CODE (XEXP (x, 0)) == XOR - || GET_CODE (XEXP (x, 0)) == IOR) - && GET_CODE (XEXP (XEXP (x, 0), 0)) == LSHIFTRT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == LSHIFTRT - && (i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0) - { - /* Apply the distributive law, and then try to make extractions. */ - new = gen_rtx_combine (GET_CODE (XEXP (x, 0)), mode, - gen_rtx_AND (mode, XEXP (XEXP (x, 0), 0), - XEXP (x, 1)), - gen_rtx_AND (mode, XEXP (XEXP (x, 0), 1), - XEXP (x, 1))); - new = make_compound_operation (new, in_code); - } - - /* If we are have (and (rotate X C) M) and C is larger than the number - of bits in M, this is an extraction. */ - - else if (GET_CODE (XEXP (x, 0)) == ROTATE - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && (i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0 - && i <= INTVAL (XEXP (XEXP (x, 0), 1))) - { - new = make_compound_operation (XEXP (XEXP (x, 0), 0), next_code); - new = make_extraction (mode, new, - (GET_MODE_BITSIZE (mode) - - INTVAL (XEXP (XEXP (x, 0), 1))), - NULL_RTX, i, 1, 0, in_code == COMPARE); - } - - /* On machines without logical shifts, if the operand of the AND is - a logical shift and our mask turns off all the propagated sign - bits, we can replace the logical shift with an arithmetic shift. */ - else if (ashr_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing - && (lshr_optab->handlers[(int) mode].insn_code - == CODE_FOR_nothing) - && GET_CODE (XEXP (x, 0)) == LSHIFTRT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && INTVAL (XEXP (XEXP (x, 0), 1)) >= 0 - && INTVAL (XEXP (XEXP (x, 0), 1)) < HOST_BITS_PER_WIDE_INT - && mode_width <= HOST_BITS_PER_WIDE_INT) - { - unsigned HOST_WIDE_INT mask = GET_MODE_MASK (mode); - - mask >>= INTVAL (XEXP (XEXP (x, 0), 1)); - if ((INTVAL (XEXP (x, 1)) & ~mask) == 0) - SUBST (XEXP (x, 0), - gen_rtx_combine (ASHIFTRT, mode, - make_compound_operation (XEXP (XEXP (x, 0), 0), - next_code), - XEXP (XEXP (x, 0), 1))); - } - - /* If the constant is one less than a power of two, this might be - representable by an extraction even if no shift is present. - If it doesn't end up being a ZERO_EXTEND, we will ignore it unless - we are in a COMPARE. */ - else if ((i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0) - new = make_extraction (mode, - make_compound_operation (XEXP (x, 0), - next_code), - 0, NULL_RTX, i, 1, 0, in_code == COMPARE); - - /* If we are in a comparison and this is an AND with a power of two, - convert this into the appropriate bit extract. */ - else if (in_code == COMPARE - && (i = exact_log2 (INTVAL (XEXP (x, 1)))) >= 0) - new = make_extraction (mode, - make_compound_operation (XEXP (x, 0), - next_code), - i, NULL_RTX, 1, 1, 0, 1); - - break; - - case LSHIFTRT: - /* If the sign bit is known to be zero, replace this with an - arithmetic shift. */ - if (ashr_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing - && lshr_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing - && mode_width <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (XEXP (x, 0), mode) & (1 << (mode_width - 1))) == 0) - { - new = gen_rtx_combine (ASHIFTRT, mode, - make_compound_operation (XEXP (x, 0), - next_code), - XEXP (x, 1)); - break; - } - - /* ... fall through ... */ - - case ASHIFTRT: - lhs = XEXP (x, 0); - rhs = XEXP (x, 1); - - /* If we have (ashiftrt (ashift foo C1) C2) with C2 >= C1, - this is a SIGN_EXTRACT. */ - if (GET_CODE (rhs) == CONST_INT - && GET_CODE (lhs) == ASHIFT - && GET_CODE (XEXP (lhs, 1)) == CONST_INT - && INTVAL (rhs) >= INTVAL (XEXP (lhs, 1))) - { - new = make_compound_operation (XEXP (lhs, 0), next_code); - new = make_extraction (mode, new, - INTVAL (rhs) - INTVAL (XEXP (lhs, 1)), - NULL_RTX, mode_width - INTVAL (rhs), - code == LSHIFTRT, 0, in_code == COMPARE); - } - - /* See if we have operations between an ASHIFTRT and an ASHIFT. - If so, try to merge the shifts into a SIGN_EXTEND. We could - also do this for some cases of SIGN_EXTRACT, but it doesn't - seem worth the effort; the case checked for occurs on Alpha. */ - - if (GET_RTX_CLASS (GET_CODE (lhs)) != 'o' - && ! (GET_CODE (lhs) == SUBREG - && (GET_RTX_CLASS (GET_CODE (SUBREG_REG (lhs))) == 'o')) - && GET_CODE (rhs) == CONST_INT - && INTVAL (rhs) < HOST_BITS_PER_WIDE_INT - && (new = extract_left_shift (lhs, INTVAL (rhs))) != 0) - new = make_extraction (mode, make_compound_operation (new, next_code), - 0, NULL_RTX, mode_width - INTVAL (rhs), - code == LSHIFTRT, 0, in_code == COMPARE); - - break; - - case SUBREG: - /* Call ourselves recursively on the inner expression. If we are - narrowing the object and it has a different RTL code from - what it originally did, do this SUBREG as a force_to_mode. */ - - tem = make_compound_operation (SUBREG_REG (x), in_code); - if (GET_CODE (tem) != GET_CODE (SUBREG_REG (x)) - && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (tem)) - && subreg_lowpart_p (x)) - { - rtx newer = force_to_mode (tem, mode, - GET_MODE_MASK (mode), NULL_RTX, 0); - - /* If we have something other than a SUBREG, we might have - done an expansion, so rerun outselves. */ - if (GET_CODE (newer) != SUBREG) - newer = make_compound_operation (newer, in_code); - - return newer; - } - - /* If this is a paradoxical subreg, and the new code is a sign or - zero extension, omit the subreg and widen the extension. If it - is a regular subreg, we can still get rid of the subreg by not - widening so much, or in fact removing the extension entirely. */ - if ((GET_CODE (tem) == SIGN_EXTEND - || GET_CODE (tem) == ZERO_EXTEND) - && subreg_lowpart_p (x)) - { - if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (tem)) - || (GET_MODE_SIZE (mode) > - GET_MODE_SIZE (GET_MODE (XEXP (tem, 0))))) - tem = gen_rtx_combine (GET_CODE (tem), mode, XEXP (tem, 0)); - else - tem = gen_lowpart_for_combine (mode, XEXP (tem, 0)); - return tem; - } - break; - - default: - break; - } - - if (new) - { - x = gen_lowpart_for_combine (mode, new); - code = GET_CODE (x); - } - - /* Now recursively process each operand of this operation. */ - fmt = GET_RTX_FORMAT (code); - for (i = 0; i < GET_RTX_LENGTH (code); i++) - if (fmt[i] == 'e') - { - new = make_compound_operation (XEXP (x, i), next_code); - SUBST (XEXP (x, i), new); - } - - return x; -} - -/* Given M see if it is a value that would select a field of bits - within an item, but not the entire word. Return -1 if not. - Otherwise, return the starting position of the field, where 0 is the - low-order bit. - - *PLEN is set to the length of the field. */ - -static int -get_pos_from_mask (m, plen) - unsigned HOST_WIDE_INT m; - int *plen; -{ - /* Get the bit number of the first 1 bit from the right, -1 if none. */ - int pos = exact_log2 (m & - m); - - if (pos < 0) - return -1; - - /* Now shift off the low-order zero bits and see if we have a power of - two minus 1. */ - *plen = exact_log2 ((m >> pos) + 1); - - if (*plen <= 0) - return -1; - - return pos; -} - -/* See if X can be simplified knowing that we will only refer to it in - MODE and will only refer to those bits that are nonzero in MASK. - If other bits are being computed or if masking operations are done - that select a superset of the bits in MASK, they can sometimes be - ignored. - - Return a possibly simplified expression, but always convert X to - MODE. If X is a CONST_INT, AND the CONST_INT with MASK. - - Also, if REG is non-zero and X is a register equal in value to REG, - replace X with REG. - - If JUST_SELECT is nonzero, don't optimize by noticing that bits in MASK - are all off in X. This is used when X will be complemented, by either - NOT, NEG, or XOR. */ - -static rtx -force_to_mode (x, mode, mask, reg, just_select) - rtx x; - enum machine_mode mode; - unsigned HOST_WIDE_INT mask; - rtx reg; - int just_select; -{ - enum rtx_code code = GET_CODE (x); - int next_select = just_select || code == XOR || code == NOT || code == NEG; - enum machine_mode op_mode; - unsigned HOST_WIDE_INT fuller_mask, nonzero; - rtx op0, op1, temp; - - /* If this is a CALL or ASM_OPERANDS, don't do anything. Some of the - code below will do the wrong thing since the mode of such an - expression is VOIDmode. - - Also do nothing if X is a CLOBBER; this can happen if X was - the return value from a call to gen_lowpart_for_combine. */ - if (code == CALL || code == ASM_OPERANDS || code == CLOBBER) - return x; - - /* We want to perform the operation is its present mode unless we know - that the operation is valid in MODE, in which case we do the operation - in MODE. */ - op_mode = ((GET_MODE_CLASS (mode) == GET_MODE_CLASS (GET_MODE (x)) - && code_to_optab[(int) code] != 0 - && (code_to_optab[(int) code]->handlers[(int) mode].insn_code - != CODE_FOR_nothing)) - ? mode : GET_MODE (x)); - - /* It is not valid to do a right-shift in a narrower mode - than the one it came in with. */ - if ((code == LSHIFTRT || code == ASHIFTRT) - && GET_MODE_BITSIZE (mode) < GET_MODE_BITSIZE (GET_MODE (x))) - op_mode = GET_MODE (x); - - /* Truncate MASK to fit OP_MODE. */ - if (op_mode) - mask &= GET_MODE_MASK (op_mode); - - /* When we have an arithmetic operation, or a shift whose count we - do not know, we need to assume that all bit the up to the highest-order - bit in MASK will be needed. This is how we form such a mask. */ - if (op_mode) - fuller_mask = (GET_MODE_BITSIZE (op_mode) >= HOST_BITS_PER_WIDE_INT - ? GET_MODE_MASK (op_mode) - : ((HOST_WIDE_INT) 1 << (floor_log2 (mask) + 1)) - 1); - else - fuller_mask = ~ (HOST_WIDE_INT) 0; - - /* Determine what bits of X are guaranteed to be (non)zero. */ - nonzero = nonzero_bits (x, mode); - - /* If none of the bits in X are needed, return a zero. */ - if (! just_select && (nonzero & mask) == 0) - return const0_rtx; - - /* If X is a CONST_INT, return a new one. Do this here since the - test below will fail. */ - if (GET_CODE (x) == CONST_INT) - { - HOST_WIDE_INT cval = INTVAL (x) & mask; - int width = GET_MODE_BITSIZE (mode); - - /* If MODE is narrower that HOST_WIDE_INT and CVAL is a negative - number, sign extend it. */ - if (width > 0 && width < HOST_BITS_PER_WIDE_INT - && (cval & ((HOST_WIDE_INT) 1 << (width - 1))) != 0) - cval |= (HOST_WIDE_INT) -1 << width; - - return GEN_INT (cval); - } - - /* If X is narrower than MODE and we want all the bits in X's mode, just - get X in the proper mode. */ - if (GET_MODE_SIZE (GET_MODE (x)) < GET_MODE_SIZE (mode) - && (GET_MODE_MASK (GET_MODE (x)) & ~ mask) == 0) - return gen_lowpart_for_combine (mode, x); - - /* If we aren't changing the mode, X is not a SUBREG, and all zero bits in - MASK are already known to be zero in X, we need not do anything. */ - if (GET_MODE (x) == mode && code != SUBREG && (~ mask & nonzero) == 0) - return x; - - switch (code) - { - case CLOBBER: - /* If X is a (clobber (const_int)), return it since we know we are - generating something that won't match. */ - return x; - - case USE: - /* X is a (use (mem ..)) that was made from a bit-field extraction that - spanned the boundary of the MEM. If we are now masking so it is - within that boundary, we don't need the USE any more. */ - if (! BITS_BIG_ENDIAN - && (mask & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))) == 0) - return force_to_mode (XEXP (x, 0), mode, mask, reg, next_select); - break; - - case SIGN_EXTEND: - case ZERO_EXTEND: - case ZERO_EXTRACT: - case SIGN_EXTRACT: - x = expand_compound_operation (x); - if (GET_CODE (x) != code) - return force_to_mode (x, mode, mask, reg, next_select); - break; - - case REG: - if (reg != 0 && (rtx_equal_p (get_last_value (reg), x) - || rtx_equal_p (reg, get_last_value (x)))) - x = reg; - break; - - case SUBREG: - if (subreg_lowpart_p (x) - /* We can ignore the effect of this SUBREG if it narrows the mode or - if the constant masks to zero all the bits the mode doesn't - have. */ - && ((GET_MODE_SIZE (GET_MODE (x)) - < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) - || (0 == (mask - & GET_MODE_MASK (GET_MODE (x)) - & ~ GET_MODE_MASK (GET_MODE (SUBREG_REG (x))))))) - return force_to_mode (SUBREG_REG (x), mode, mask, reg, next_select); - break; - - case AND: - /* If this is an AND with a constant, convert it into an AND - whose constant is the AND of that constant with MASK. If it - remains an AND of MASK, delete it since it is redundant. */ - - if (GET_CODE (XEXP (x, 1)) == CONST_INT) - { - x = simplify_and_const_int (x, op_mode, XEXP (x, 0), - mask & INTVAL (XEXP (x, 1))); - - /* If X is still an AND, see if it is an AND with a mask that - is just some low-order bits. If so, and it is MASK, we don't - need it. */ - - if (GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (XEXP (x, 1)) == mask) - x = XEXP (x, 0); - - /* If it remains an AND, try making another AND with the bits - in the mode mask that aren't in MASK turned on. If the - constant in the AND is wide enough, this might make a - cheaper constant. */ - - if (GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT - && GET_MODE_MASK (GET_MODE (x)) != mask - && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT) - { - HOST_WIDE_INT cval = (INTVAL (XEXP (x, 1)) - | (GET_MODE_MASK (GET_MODE (x)) & ~ mask)); - int width = GET_MODE_BITSIZE (GET_MODE (x)); - rtx y; - - /* If MODE is narrower that HOST_WIDE_INT and CVAL is a negative - number, sign extend it. */ - if (width > 0 && width < HOST_BITS_PER_WIDE_INT - && (cval & ((HOST_WIDE_INT) 1 << (width - 1))) != 0) - cval |= (HOST_WIDE_INT) -1 << width; - - y = gen_binary (AND, GET_MODE (x), XEXP (x, 0), GEN_INT (cval)); - if (rtx_cost (y, SET) < rtx_cost (x, SET)) - x = y; - } - - break; - } - - goto binop; - - case PLUS: - /* In (and (plus FOO C1) M), if M is a mask that just turns off - low-order bits (as in an alignment operation) and FOO is already - aligned to that boundary, mask C1 to that boundary as well. - This may eliminate that PLUS and, later, the AND. */ - - { - int width = GET_MODE_BITSIZE (mode); - unsigned HOST_WIDE_INT smask = mask; - - /* If MODE is narrower than HOST_WIDE_INT and mask is a negative - number, sign extend it. */ - - if (width < HOST_BITS_PER_WIDE_INT - && (smask & ((HOST_WIDE_INT) 1 << (width - 1))) != 0) - smask |= (HOST_WIDE_INT) -1 << width; - - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && exact_log2 (- smask) >= 0) - { -#ifdef STACK_BIAS - if (STACK_BIAS - && (XEXP (x, 0) == stack_pointer_rtx - || XEXP (x, 0) == frame_pointer_rtx)) - { - int sp_alignment = STACK_BOUNDARY / BITS_PER_UNIT; - unsigned HOST_WIDE_INT sp_mask = GET_MODE_MASK (mode); - - sp_mask &= ~ (sp_alignment - 1); - if ((sp_mask & ~ smask) == 0 - && ((INTVAL (XEXP (x, 1)) - STACK_BIAS) & ~ smask) != 0) - return force_to_mode (plus_constant (XEXP (x, 0), - ((INTVAL (XEXP (x, 1)) - - STACK_BIAS) & smask) - + STACK_BIAS), - mode, smask, reg, next_select); - } -#endif - if ((nonzero_bits (XEXP (x, 0), mode) & ~ smask) == 0 - && (INTVAL (XEXP (x, 1)) & ~ smask) != 0) - return force_to_mode (plus_constant (XEXP (x, 0), - (INTVAL (XEXP (x, 1)) - & smask)), - mode, smask, reg, next_select); - } - } - - /* ... fall through ... */ - - case MINUS: - case MULT: - /* For PLUS, MINUS and MULT, we need any bits less significant than the - most significant bit in MASK since carries from those bits will - affect the bits we are interested in. */ - mask = fuller_mask; - goto binop; - - case IOR: - case XOR: - /* If X is (ior (lshiftrt FOO C1) C2), try to commute the IOR and - LSHIFTRT so we end up with an (and (lshiftrt (ior ...) ...) ...) - operation which may be a bitfield extraction. Ensure that the - constant we form is not wider than the mode of X. */ - - if (GET_CODE (XEXP (x, 0)) == LSHIFTRT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && INTVAL (XEXP (XEXP (x, 0), 1)) >= 0 - && INTVAL (XEXP (XEXP (x, 0), 1)) < HOST_BITS_PER_WIDE_INT - && GET_CODE (XEXP (x, 1)) == CONST_INT - && ((INTVAL (XEXP (XEXP (x, 0), 1)) - + floor_log2 (INTVAL (XEXP (x, 1)))) - < GET_MODE_BITSIZE (GET_MODE (x))) - && (INTVAL (XEXP (x, 1)) - & ~ nonzero_bits (XEXP (x, 0), GET_MODE (x))) == 0) - { - temp = GEN_INT ((INTVAL (XEXP (x, 1)) & mask) - << INTVAL (XEXP (XEXP (x, 0), 1))); - temp = gen_binary (GET_CODE (x), GET_MODE (x), - XEXP (XEXP (x, 0), 0), temp); - x = gen_binary (LSHIFTRT, GET_MODE (x), temp, - XEXP (XEXP (x, 0), 1)); - return force_to_mode (x, mode, mask, reg, next_select); - } - - binop: - /* For most binary operations, just propagate into the operation and - change the mode if we have an operation of that mode. */ - - op0 = gen_lowpart_for_combine (op_mode, - force_to_mode (XEXP (x, 0), mode, mask, - reg, next_select)); - op1 = gen_lowpart_for_combine (op_mode, - force_to_mode (XEXP (x, 1), mode, mask, - reg, next_select)); - - /* If OP1 is a CONST_INT and X is an IOR or XOR, clear bits outside - MASK since OP1 might have been sign-extended but we never want - to turn on extra bits, since combine might have previously relied - on them being off. */ - if (GET_CODE (op1) == CONST_INT && (code == IOR || code == XOR) - && (INTVAL (op1) & mask) != 0) - op1 = GEN_INT (INTVAL (op1) & mask); - - if (op_mode != GET_MODE (x) || op0 != XEXP (x, 0) || op1 != XEXP (x, 1)) - x = gen_binary (code, op_mode, op0, op1); - break; - - case ASHIFT: - /* For left shifts, do the same, but just for the first operand. - However, we cannot do anything with shifts where we cannot - guarantee that the counts are smaller than the size of the mode - because such a count will have a different meaning in a - wider mode. */ - - if (! (GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) >= 0 - && INTVAL (XEXP (x, 1)) < GET_MODE_BITSIZE (mode)) - && ! (GET_MODE (XEXP (x, 1)) != VOIDmode - && (nonzero_bits (XEXP (x, 1), GET_MODE (XEXP (x, 1))) - < (unsigned HOST_WIDE_INT) GET_MODE_BITSIZE (mode)))) - break; - - /* If the shift count is a constant and we can do arithmetic in - the mode of the shift, refine which bits we need. Otherwise, use the - conservative form of the mask. */ - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) >= 0 - && INTVAL (XEXP (x, 1)) < GET_MODE_BITSIZE (op_mode) - && GET_MODE_BITSIZE (op_mode) <= HOST_BITS_PER_WIDE_INT) - mask >>= INTVAL (XEXP (x, 1)); - else - mask = fuller_mask; - - op0 = gen_lowpart_for_combine (op_mode, - force_to_mode (XEXP (x, 0), op_mode, - mask, reg, next_select)); - - if (op_mode != GET_MODE (x) || op0 != XEXP (x, 0)) - x = gen_binary (code, op_mode, op0, XEXP (x, 1)); - break; - - case LSHIFTRT: - /* Here we can only do something if the shift count is a constant, - this shift constant is valid for the host, and we can do arithmetic - in OP_MODE. */ - - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT - && GET_MODE_BITSIZE (op_mode) <= HOST_BITS_PER_WIDE_INT) - { - rtx inner = XEXP (x, 0); - - /* Select the mask of the bits we need for the shift operand. */ - mask <<= INTVAL (XEXP (x, 1)); - - /* We can only change the mode of the shift if we can do arithmetic - in the mode of the shift and MASK is no wider than the width of - OP_MODE. */ - if (GET_MODE_BITSIZE (op_mode) > HOST_BITS_PER_WIDE_INT - || (mask & ~ GET_MODE_MASK (op_mode)) != 0) - op_mode = GET_MODE (x); - - inner = force_to_mode (inner, op_mode, mask, reg, next_select); - - if (GET_MODE (x) != op_mode || inner != XEXP (x, 0)) - x = gen_binary (LSHIFTRT, op_mode, inner, XEXP (x, 1)); - } - - /* If we have (and (lshiftrt FOO C1) C2) where the combination of the - shift and AND produces only copies of the sign bit (C2 is one less - than a power of two), we can do this with just a shift. */ - - if (GET_CODE (x) == LSHIFTRT - && GET_CODE (XEXP (x, 1)) == CONST_INT - && ((INTVAL (XEXP (x, 1)) - + num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0)))) - >= GET_MODE_BITSIZE (GET_MODE (x))) - && exact_log2 (mask + 1) >= 0 - && (num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0))) - >= exact_log2 (mask + 1))) - x = gen_binary (LSHIFTRT, GET_MODE (x), XEXP (x, 0), - GEN_INT (GET_MODE_BITSIZE (GET_MODE (x)) - - exact_log2 (mask + 1))); - break; - - case ASHIFTRT: - /* If we are just looking for the sign bit, we don't need this shift at - all, even if it has a variable count. */ - if (GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT - && (mask == ((unsigned HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (GET_MODE (x)) - 1)))) - return force_to_mode (XEXP (x, 0), mode, mask, reg, next_select); - - /* If this is a shift by a constant, get a mask that contains those bits - that are not copies of the sign bit. We then have two cases: If - MASK only includes those bits, this can be a logical shift, which may - allow simplifications. If MASK is a single-bit field not within - those bits, we are requesting a copy of the sign bit and hence can - shift the sign bit to the appropriate location. */ - - if (GET_CODE (XEXP (x, 1)) == CONST_INT && INTVAL (XEXP (x, 1)) >= 0 - && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT) - { - int i = -1; - - /* If the considered data is wider then HOST_WIDE_INT, we can't - represent a mask for all its bits in a single scalar. - But we only care about the lower bits, so calculate these. */ - - if (GET_MODE_BITSIZE (GET_MODE (x)) > HOST_BITS_PER_WIDE_INT) - { - nonzero = ~ (HOST_WIDE_INT) 0; - - /* GET_MODE_BITSIZE (GET_MODE (x)) - INTVAL (XEXP (x, 1)) - is the number of bits a full-width mask would have set. - We need only shift if these are fewer than nonzero can - hold. If not, we must keep all bits set in nonzero. */ - - if (GET_MODE_BITSIZE (GET_MODE (x)) - INTVAL (XEXP (x, 1)) - < HOST_BITS_PER_WIDE_INT) - nonzero >>= INTVAL (XEXP (x, 1)) - + HOST_BITS_PER_WIDE_INT - - GET_MODE_BITSIZE (GET_MODE (x)) ; - } - else - { - nonzero = GET_MODE_MASK (GET_MODE (x)); - nonzero >>= INTVAL (XEXP (x, 1)); - } - - if ((mask & ~ nonzero) == 0 - || (i = exact_log2 (mask)) >= 0) - { - x = simplify_shift_const - (x, LSHIFTRT, GET_MODE (x), XEXP (x, 0), - i < 0 ? INTVAL (XEXP (x, 1)) - : GET_MODE_BITSIZE (GET_MODE (x)) - 1 - i); - - if (GET_CODE (x) != ASHIFTRT) - return force_to_mode (x, mode, mask, reg, next_select); - } - } - - /* If MASK is 1, convert this to a LSHIFTRT. This can be done - even if the shift count isn't a constant. */ - if (mask == 1) - x = gen_binary (LSHIFTRT, GET_MODE (x), XEXP (x, 0), XEXP (x, 1)); - - /* If this is a sign-extension operation that just affects bits - we don't care about, remove it. Be sure the call above returned - something that is still a shift. */ - - if ((GET_CODE (x) == LSHIFTRT || GET_CODE (x) == ASHIFTRT) - && GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) >= 0 - && (INTVAL (XEXP (x, 1)) - <= GET_MODE_BITSIZE (GET_MODE (x)) - (floor_log2 (mask) + 1)) - && GET_CODE (XEXP (x, 0)) == ASHIFT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && INTVAL (XEXP (XEXP (x, 0), 1)) == INTVAL (XEXP (x, 1))) - return force_to_mode (XEXP (XEXP (x, 0), 0), mode, mask, - reg, next_select); - - break; - - case ROTATE: - case ROTATERT: - /* If the shift count is constant and we can do computations - in the mode of X, compute where the bits we care about are. - Otherwise, we can't do anything. Don't change the mode of - the shift or propagate MODE into the shift, though. */ - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) >= 0) - { - temp = simplify_binary_operation (code == ROTATE ? ROTATERT : ROTATE, - GET_MODE (x), GEN_INT (mask), - XEXP (x, 1)); - if (temp && GET_CODE(temp) == CONST_INT) - SUBST (XEXP (x, 0), - force_to_mode (XEXP (x, 0), GET_MODE (x), - INTVAL (temp), reg, next_select)); - } - break; - - case NEG: - /* If we just want the low-order bit, the NEG isn't needed since it - won't change the low-order bit. */ - if (mask == 1) - return force_to_mode (XEXP (x, 0), mode, mask, reg, just_select); - - /* We need any bits less significant than the most significant bit in - MASK since carries from those bits will affect the bits we are - interested in. */ - mask = fuller_mask; - goto unop; - - case NOT: - /* (not FOO) is (xor FOO CONST), so if FOO is an LSHIFTRT, we can do the - same as the XOR case above. Ensure that the constant we form is not - wider than the mode of X. */ - - if (GET_CODE (XEXP (x, 0)) == LSHIFTRT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && INTVAL (XEXP (XEXP (x, 0), 1)) >= 0 - && (INTVAL (XEXP (XEXP (x, 0), 1)) + floor_log2 (mask) - < GET_MODE_BITSIZE (GET_MODE (x))) - && INTVAL (XEXP (XEXP (x, 0), 1)) < HOST_BITS_PER_WIDE_INT) - { - temp = GEN_INT (mask << INTVAL (XEXP (XEXP (x, 0), 1))); - temp = gen_binary (XOR, GET_MODE (x), XEXP (XEXP (x, 0), 0), temp); - x = gen_binary (LSHIFTRT, GET_MODE (x), temp, XEXP (XEXP (x, 0), 1)); - - return force_to_mode (x, mode, mask, reg, next_select); - } - - /* (and (not FOO) CONST) is (not (or FOO (not CONST))), so we must - use the full mask inside the NOT. */ - mask = fuller_mask; - - unop: - op0 = gen_lowpart_for_combine (op_mode, - force_to_mode (XEXP (x, 0), mode, mask, - reg, next_select)); - if (op_mode != GET_MODE (x) || op0 != XEXP (x, 0)) - x = gen_unary (code, op_mode, op_mode, op0); - break; - - case NE: - /* (and (ne FOO 0) CONST) can be (and FOO CONST) if CONST is included - in STORE_FLAG_VALUE and FOO has a single bit that might be nonzero, - which is equal to STORE_FLAG_VALUE. */ - if ((mask & ~ STORE_FLAG_VALUE) == 0 && XEXP (x, 1) == const0_rtx - && exact_log2 (nonzero_bits (XEXP (x, 0), mode)) >= 0 - && nonzero_bits (XEXP (x, 0), mode) == STORE_FLAG_VALUE) - return force_to_mode (XEXP (x, 0), mode, mask, reg, next_select); - - break; - - case IF_THEN_ELSE: - /* We have no way of knowing if the IF_THEN_ELSE can itself be - written in a narrower mode. We play it safe and do not do so. */ - - SUBST (XEXP (x, 1), - gen_lowpart_for_combine (GET_MODE (x), - force_to_mode (XEXP (x, 1), mode, - mask, reg, next_select))); - SUBST (XEXP (x, 2), - gen_lowpart_for_combine (GET_MODE (x), - force_to_mode (XEXP (x, 2), mode, - mask, reg,next_select))); - break; - - default: - break; - } - - /* Ensure we return a value of the proper mode. */ - return gen_lowpart_for_combine (mode, x); -} - -/* Return nonzero if X is an expression that has one of two values depending on - whether some other value is zero or nonzero. In that case, we return the - value that is being tested, *PTRUE is set to the value if the rtx being - returned has a nonzero value, and *PFALSE is set to the other alternative. - - If we return zero, we set *PTRUE and *PFALSE to X. */ - -static rtx -if_then_else_cond (x, ptrue, pfalse) - rtx x; - rtx *ptrue, *pfalse; -{ - enum machine_mode mode = GET_MODE (x); - enum rtx_code code = GET_CODE (x); - int size = GET_MODE_BITSIZE (mode); - rtx cond0, cond1, true0, true1, false0, false1; - unsigned HOST_WIDE_INT nz; - - /* If this is a unary operation whose operand has one of two values, apply - our opcode to compute those values. */ - if (GET_RTX_CLASS (code) == '1' - && (cond0 = if_then_else_cond (XEXP (x, 0), &true0, &false0)) != 0) - { - *ptrue = gen_unary (code, mode, GET_MODE (XEXP (x, 0)), true0); - *pfalse = gen_unary (code, mode, GET_MODE (XEXP (x, 0)), false0); - return cond0; - } - - /* If this is a COMPARE, do nothing, since the IF_THEN_ELSE we would - make can't possibly match and would suppress other optimizations. */ - else if (code == COMPARE) - ; - - /* If this is a binary operation, see if either side has only one of two - values. If either one does or if both do and they are conditional on - the same value, compute the new true and false values. */ - else if (GET_RTX_CLASS (code) == 'c' || GET_RTX_CLASS (code) == '2' - || GET_RTX_CLASS (code) == '<') - { - cond0 = if_then_else_cond (XEXP (x, 0), &true0, &false0); - cond1 = if_then_else_cond (XEXP (x, 1), &true1, &false1); - - if ((cond0 != 0 || cond1 != 0) - && ! (cond0 != 0 && cond1 != 0 && ! rtx_equal_p (cond0, cond1))) - { - /* If if_then_else_cond returned zero, then true/false are the - same rtl. We must copy one of them to prevent invalid rtl - sharing. */ - if (cond0 == 0) - true0 = copy_rtx (true0); - else if (cond1 == 0) - true1 = copy_rtx (true1); - - *ptrue = gen_binary (code, mode, true0, true1); - *pfalse = gen_binary (code, mode, false0, false1); - return cond0 ? cond0 : cond1; - } - - /* See if we have PLUS, IOR, XOR, MINUS or UMAX, where one of the - operands is zero when the other is non-zero, and vice-versa, - and STORE_FLAG_VALUE is 1 or -1. */ - - if ((STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1) - && (code == PLUS || code == IOR || code == XOR || code == MINUS - || code == UMAX) - && GET_CODE (XEXP (x, 0)) == MULT && GET_CODE (XEXP (x, 1)) == MULT) - { - rtx op0 = XEXP (XEXP (x, 0), 1); - rtx op1 = XEXP (XEXP (x, 1), 1); - - cond0 = XEXP (XEXP (x, 0), 0); - cond1 = XEXP (XEXP (x, 1), 0); - - if (GET_RTX_CLASS (GET_CODE (cond0)) == '<' - && GET_RTX_CLASS (GET_CODE (cond1)) == '<' - && reversible_comparison_p (cond1) - && ((GET_CODE (cond0) == reverse_condition (GET_CODE (cond1)) - && rtx_equal_p (XEXP (cond0, 0), XEXP (cond1, 0)) - && rtx_equal_p (XEXP (cond0, 1), XEXP (cond1, 1))) - || ((swap_condition (GET_CODE (cond0)) - == reverse_condition (GET_CODE (cond1))) - && rtx_equal_p (XEXP (cond0, 0), XEXP (cond1, 1)) - && rtx_equal_p (XEXP (cond0, 1), XEXP (cond1, 0)))) - && ! side_effects_p (x)) - { - *ptrue = gen_binary (MULT, mode, op0, const_true_rtx); - *pfalse = gen_binary (MULT, mode, - (code == MINUS - ? gen_unary (NEG, mode, mode, op1) : op1), - const_true_rtx); - return cond0; - } - } - - /* Similarly for MULT, AND and UMIN, execpt that for these the result - is always zero. */ - if ((STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1) - && (code == MULT || code == AND || code == UMIN) - && GET_CODE (XEXP (x, 0)) == MULT && GET_CODE (XEXP (x, 1)) == MULT) - { - cond0 = XEXP (XEXP (x, 0), 0); - cond1 = XEXP (XEXP (x, 1), 0); - - if (GET_RTX_CLASS (GET_CODE (cond0)) == '<' - && GET_RTX_CLASS (GET_CODE (cond1)) == '<' - && reversible_comparison_p (cond1) - && ((GET_CODE (cond0) == reverse_condition (GET_CODE (cond1)) - && rtx_equal_p (XEXP (cond0, 0), XEXP (cond1, 0)) - && rtx_equal_p (XEXP (cond0, 1), XEXP (cond1, 1))) - || ((swap_condition (GET_CODE (cond0)) - == reverse_condition (GET_CODE (cond1))) - && rtx_equal_p (XEXP (cond0, 0), XEXP (cond1, 1)) - && rtx_equal_p (XEXP (cond0, 1), XEXP (cond1, 0)))) - && ! side_effects_p (x)) - { - *ptrue = *pfalse = const0_rtx; - return cond0; - } - } - } - - else if (code == IF_THEN_ELSE) - { - /* If we have IF_THEN_ELSE already, extract the condition and - canonicalize it if it is NE or EQ. */ - cond0 = XEXP (x, 0); - *ptrue = XEXP (x, 1), *pfalse = XEXP (x, 2); - if (GET_CODE (cond0) == NE && XEXP (cond0, 1) == const0_rtx) - return XEXP (cond0, 0); - else if (GET_CODE (cond0) == EQ && XEXP (cond0, 1) == const0_rtx) - { - *ptrue = XEXP (x, 2), *pfalse = XEXP (x, 1); - return XEXP (cond0, 0); - } - else - return cond0; - } - - /* If X is a normal SUBREG with both inner and outer modes integral, - we can narrow both the true and false values of the inner expression, - if there is a condition. */ - else if (code == SUBREG && GET_MODE_CLASS (mode) == MODE_INT - && GET_MODE_CLASS (GET_MODE (SUBREG_REG (x))) == MODE_INT - && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) - && 0 != (cond0 = if_then_else_cond (SUBREG_REG (x), - &true0, &false0))) - { - *ptrue = force_to_mode (true0, mode, GET_MODE_MASK (mode), NULL_RTX, 0); - *pfalse - = force_to_mode (false0, mode, GET_MODE_MASK (mode), NULL_RTX, 0); - - return cond0; - } - - /* If X is a constant, this isn't special and will cause confusions - if we treat it as such. Likewise if it is equivalent to a constant. */ - else if (CONSTANT_P (x) - || ((cond0 = get_last_value (x)) != 0 && CONSTANT_P (cond0))) - ; - - /* If X is known to be either 0 or -1, those are the true and - false values when testing X. */ - else if (num_sign_bit_copies (x, mode) == size) - { - *ptrue = constm1_rtx, *pfalse = const0_rtx; - return x; - } - - /* Likewise for 0 or a single bit. */ - else if (exact_log2 (nz = nonzero_bits (x, mode)) >= 0) - { - *ptrue = GEN_INT (nz), *pfalse = const0_rtx; - return x; - } - - /* Otherwise fail; show no condition with true and false values the same. */ - *ptrue = *pfalse = x; - return 0; -} - -/* Return the value of expression X given the fact that condition COND - is known to be true when applied to REG as its first operand and VAL - as its second. X is known to not be shared and so can be modified in - place. - - We only handle the simplest cases, and specifically those cases that - arise with IF_THEN_ELSE expressions. */ - -static rtx -known_cond (x, cond, reg, val) - rtx x; - enum rtx_code cond; - rtx reg, val; -{ - enum rtx_code code = GET_CODE (x); - rtx temp; - char *fmt; - int i, j; - - if (side_effects_p (x)) - return x; - - if (cond == EQ && rtx_equal_p (x, reg)) - return val; - - /* If X is (abs REG) and we know something about REG's relationship - with zero, we may be able to simplify this. */ - - if (code == ABS && rtx_equal_p (XEXP (x, 0), reg) && val == const0_rtx) - switch (cond) - { - case GE: case GT: case EQ: - return XEXP (x, 0); - case LT: case LE: - return gen_unary (NEG, GET_MODE (XEXP (x, 0)), GET_MODE (XEXP (x, 0)), - XEXP (x, 0)); - default: - break; - } - - /* The only other cases we handle are MIN, MAX, and comparisons if the - operands are the same as REG and VAL. */ - - else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == 'c') - { - if (rtx_equal_p (XEXP (x, 0), val)) - cond = swap_condition (cond), temp = val, val = reg, reg = temp; - - if (rtx_equal_p (XEXP (x, 0), reg) && rtx_equal_p (XEXP (x, 1), val)) - { - if (GET_RTX_CLASS (code) == '<') - return (comparison_dominates_p (cond, code) ? const_true_rtx - : (comparison_dominates_p (cond, - reverse_condition (code)) - ? const0_rtx : x)); - - else if (code == SMAX || code == SMIN - || code == UMIN || code == UMAX) - { - int unsignedp = (code == UMIN || code == UMAX); - - if (code == SMAX || code == UMAX) - cond = reverse_condition (cond); - - switch (cond) - { - case GE: case GT: - return unsignedp ? x : XEXP (x, 1); - case LE: case LT: - return unsignedp ? x : XEXP (x, 0); - case GEU: case GTU: - return unsignedp ? XEXP (x, 1) : x; - case LEU: case LTU: - return unsignedp ? XEXP (x, 0) : x; - default: - break; - } - } - } - } - - fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - { - if (fmt[i] == 'e') - SUBST (XEXP (x, i), known_cond (XEXP (x, i), cond, reg, val)); - else if (fmt[i] == 'E') - for (j = XVECLEN (x, i) - 1; j >= 0; j--) - SUBST (XVECEXP (x, i, j), known_cond (XVECEXP (x, i, j), - cond, reg, val)); - } - - return x; -} - -/* See if X and Y are equal for the purposes of seeing if we can rewrite an - assignment as a field assignment. */ - -static int -rtx_equal_for_field_assignment_p (x, y) - rtx x; - rtx y; -{ - if (x == y || rtx_equal_p (x, y)) - return 1; - - if (x == 0 || y == 0 || GET_MODE (x) != GET_MODE (y)) - return 0; - - /* Check for a paradoxical SUBREG of a MEM compared with the MEM. - Note that all SUBREGs of MEM are paradoxical; otherwise they - would have been rewritten. */ - if (GET_CODE (x) == MEM && GET_CODE (y) == SUBREG - && GET_CODE (SUBREG_REG (y)) == MEM - && rtx_equal_p (SUBREG_REG (y), - gen_lowpart_for_combine (GET_MODE (SUBREG_REG (y)), x))) - return 1; - - if (GET_CODE (y) == MEM && GET_CODE (x) == SUBREG - && GET_CODE (SUBREG_REG (x)) == MEM - && rtx_equal_p (SUBREG_REG (x), - gen_lowpart_for_combine (GET_MODE (SUBREG_REG (x)), y))) - return 1; - - /* We used to see if get_last_value of X and Y were the same but that's - not correct. In one direction, we'll cause the assignment to have - the wrong destination and in the case, we'll import a register into this - insn that might have already have been dead. So fail if none of the - above cases are true. */ - return 0; -} - -/* See if X, a SET operation, can be rewritten as a bit-field assignment. - Return that assignment if so. - - We only handle the most common cases. */ - -static rtx -make_field_assignment (x) - rtx x; -{ - rtx dest = SET_DEST (x); - rtx src = SET_SRC (x); - rtx assign; - rtx rhs, lhs; - HOST_WIDE_INT c1; - int pos, len; - rtx other; - enum machine_mode mode; - - /* If SRC was (and (not (ashift (const_int 1) POS)) DEST), this is - a clear of a one-bit field. We will have changed it to - (and (rotate (const_int -2) POS) DEST), so check for that. Also check - for a SUBREG. */ - - if (GET_CODE (src) == AND && GET_CODE (XEXP (src, 0)) == ROTATE - && GET_CODE (XEXP (XEXP (src, 0), 0)) == CONST_INT - && INTVAL (XEXP (XEXP (src, 0), 0)) == -2 - && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1))) - { - assign = make_extraction (VOIDmode, dest, 0, XEXP (XEXP (src, 0), 1), - 1, 1, 1, 0); - if (assign != 0) - return gen_rtx_SET (VOIDmode, assign, const0_rtx); - return x; - } - - else if (GET_CODE (src) == AND && GET_CODE (XEXP (src, 0)) == SUBREG - && subreg_lowpart_p (XEXP (src, 0)) - && (GET_MODE_SIZE (GET_MODE (XEXP (src, 0))) - < GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (src, 0))))) - && GET_CODE (SUBREG_REG (XEXP (src, 0))) == ROTATE - && INTVAL (XEXP (SUBREG_REG (XEXP (src, 0)), 0)) == -2 - && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1))) - { - assign = make_extraction (VOIDmode, dest, 0, - XEXP (SUBREG_REG (XEXP (src, 0)), 1), - 1, 1, 1, 0); - if (assign != 0) - return gen_rtx_SET (VOIDmode, assign, const0_rtx); - return x; - } - - /* If SRC is (ior (ashift (const_int 1) POS) DEST), this is a set of a - one-bit field. */ - else if (GET_CODE (src) == IOR && GET_CODE (XEXP (src, 0)) == ASHIFT - && XEXP (XEXP (src, 0), 0) == const1_rtx - && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1))) - { - assign = make_extraction (VOIDmode, dest, 0, XEXP (XEXP (src, 0), 1), - 1, 1, 1, 0); - if (assign != 0) - return gen_rtx_SET (VOIDmode, assign, const1_rtx); - return x; - } - - /* The other case we handle is assignments into a constant-position - field. They look like (ior/xor (and DEST C1) OTHER). If C1 represents - a mask that has all one bits except for a group of zero bits and - OTHER is known to have zeros where C1 has ones, this is such an - assignment. Compute the position and length from C1. Shift OTHER - to the appropriate position, force it to the required mode, and - make the extraction. Check for the AND in both operands. */ - - if (GET_CODE (src) != IOR && GET_CODE (src) != XOR) - return x; - - rhs = expand_compound_operation (XEXP (src, 0)); - lhs = expand_compound_operation (XEXP (src, 1)); - - if (GET_CODE (rhs) == AND - && GET_CODE (XEXP (rhs, 1)) == CONST_INT - && rtx_equal_for_field_assignment_p (XEXP (rhs, 0), dest)) - c1 = INTVAL (XEXP (rhs, 1)), other = lhs; - else if (GET_CODE (lhs) == AND - && GET_CODE (XEXP (lhs, 1)) == CONST_INT - && rtx_equal_for_field_assignment_p (XEXP (lhs, 0), dest)) - c1 = INTVAL (XEXP (lhs, 1)), other = rhs; - else - return x; - - pos = get_pos_from_mask ((~ c1) & GET_MODE_MASK (GET_MODE (dest)), &len); - if (pos < 0 || pos + len > GET_MODE_BITSIZE (GET_MODE (dest)) - || GET_MODE_BITSIZE (GET_MODE (dest)) > HOST_BITS_PER_WIDE_INT - || (c1 & nonzero_bits (other, GET_MODE (dest))) != 0) - return x; - - assign = make_extraction (VOIDmode, dest, pos, NULL_RTX, len, 1, 1, 0); - if (assign == 0) - return x; - - /* The mode to use for the source is the mode of the assignment, or of - what is inside a possible STRICT_LOW_PART. */ - mode = (GET_CODE (assign) == STRICT_LOW_PART - ? GET_MODE (XEXP (assign, 0)) : GET_MODE (assign)); - - /* Shift OTHER right POS places and make it the source, restricting it - to the proper length and mode. */ - - src = force_to_mode (simplify_shift_const (NULL_RTX, LSHIFTRT, - GET_MODE (src), other, pos), - mode, - GET_MODE_BITSIZE (mode) >= HOST_BITS_PER_WIDE_INT - ? GET_MODE_MASK (mode) - : ((HOST_WIDE_INT) 1 << len) - 1, - dest, 0); - - return gen_rtx_combine (SET, VOIDmode, assign, src); -} - -/* See if X is of the form (+ (* a c) (* b c)) and convert to (* (+ a b) c) - if so. */ - -static rtx -apply_distributive_law (x) - rtx x; -{ - enum rtx_code code = GET_CODE (x); - rtx lhs, rhs, other; - rtx tem; - enum rtx_code inner_code; - - /* Distributivity is not true for floating point. - It can change the value. So don't do it. - -- rms and moshier@world.std.com. */ - if (FLOAT_MODE_P (GET_MODE (x))) - return x; - - /* The outer operation can only be one of the following: */ - if (code != IOR && code != AND && code != XOR - && code != PLUS && code != MINUS) - return x; - - lhs = XEXP (x, 0), rhs = XEXP (x, 1); - - /* If either operand is a primitive we can't do anything, so get out - fast. */ - if (GET_RTX_CLASS (GET_CODE (lhs)) == 'o' - || GET_RTX_CLASS (GET_CODE (rhs)) == 'o') - return x; - - lhs = expand_compound_operation (lhs); - rhs = expand_compound_operation (rhs); - inner_code = GET_CODE (lhs); - if (inner_code != GET_CODE (rhs)) - return x; - - /* See if the inner and outer operations distribute. */ - switch (inner_code) - { - case LSHIFTRT: - case ASHIFTRT: - case AND: - case IOR: - /* These all distribute except over PLUS. */ - if (code == PLUS || code == MINUS) - return x; - break; - - case MULT: - if (code != PLUS && code != MINUS) - return x; - break; - - case ASHIFT: - /* This is also a multiply, so it distributes over everything. */ - break; - - case SUBREG: - /* Non-paradoxical SUBREGs distributes over all operations, provided - the inner modes and word numbers are the same, this is an extraction - of a low-order part, we don't convert an fp operation to int or - vice versa, and we would not be converting a single-word - operation into a multi-word operation. The latter test is not - required, but it prevents generating unneeded multi-word operations. - Some of the previous tests are redundant given the latter test, but - are retained because they are required for correctness. - - We produce the result slightly differently in this case. */ - - if (GET_MODE (SUBREG_REG (lhs)) != GET_MODE (SUBREG_REG (rhs)) - || SUBREG_WORD (lhs) != SUBREG_WORD (rhs) - || ! subreg_lowpart_p (lhs) - || (GET_MODE_CLASS (GET_MODE (lhs)) - != GET_MODE_CLASS (GET_MODE (SUBREG_REG (lhs)))) - || (GET_MODE_SIZE (GET_MODE (lhs)) - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (lhs)))) - || GET_MODE_SIZE (GET_MODE (SUBREG_REG (lhs))) > UNITS_PER_WORD) - return x; - - tem = gen_binary (code, GET_MODE (SUBREG_REG (lhs)), - SUBREG_REG (lhs), SUBREG_REG (rhs)); - return gen_lowpart_for_combine (GET_MODE (x), tem); - - default: - return x; - } - - /* Set LHS and RHS to the inner operands (A and B in the example - above) and set OTHER to the common operand (C in the example). - These is only one way to do this unless the inner operation is - commutative. */ - if (GET_RTX_CLASS (inner_code) == 'c' - && rtx_equal_p (XEXP (lhs, 0), XEXP (rhs, 0))) - other = XEXP (lhs, 0), lhs = XEXP (lhs, 1), rhs = XEXP (rhs, 1); - else if (GET_RTX_CLASS (inner_code) == 'c' - && rtx_equal_p (XEXP (lhs, 0), XEXP (rhs, 1))) - other = XEXP (lhs, 0), lhs = XEXP (lhs, 1), rhs = XEXP (rhs, 0); - else if (GET_RTX_CLASS (inner_code) == 'c' - && rtx_equal_p (XEXP (lhs, 1), XEXP (rhs, 0))) - other = XEXP (lhs, 1), lhs = XEXP (lhs, 0), rhs = XEXP (rhs, 1); - else if (rtx_equal_p (XEXP (lhs, 1), XEXP (rhs, 1))) - other = XEXP (lhs, 1), lhs = XEXP (lhs, 0), rhs = XEXP (rhs, 0); - else - return x; - - /* Form the new inner operation, seeing if it simplifies first. */ - tem = gen_binary (code, GET_MODE (x), lhs, rhs); - - /* There is one exception to the general way of distributing: - (a ^ b) | (a ^ c) -> (~a) & (b ^ c) */ - if (code == XOR && inner_code == IOR) - { - inner_code = AND; - other = gen_unary (NOT, GET_MODE (x), GET_MODE (x), other); - } - - /* We may be able to continuing distributing the result, so call - ourselves recursively on the inner operation before forming the - outer operation, which we return. */ - return gen_binary (inner_code, GET_MODE (x), - apply_distributive_law (tem), other); -} - -/* We have X, a logical `and' of VAROP with the constant CONSTOP, to be done - in MODE. - - Return an equivalent form, if different from X. Otherwise, return X. If - X is zero, we are to always construct the equivalent form. */ - -static rtx -simplify_and_const_int (x, mode, varop, constop) - rtx x; - enum machine_mode mode; - rtx varop; - unsigned HOST_WIDE_INT constop; -{ - unsigned HOST_WIDE_INT nonzero; - int width = GET_MODE_BITSIZE (mode); - int i; - - /* Simplify VAROP knowing that we will be only looking at some of the - bits in it. */ - varop = force_to_mode (varop, mode, constop, NULL_RTX, 0); - - /* If VAROP is a CLOBBER, we will fail so return it; if it is a - CONST_INT, we are done. */ - if (GET_CODE (varop) == CLOBBER || GET_CODE (varop) == CONST_INT) - return varop; - - /* See what bits may be nonzero in VAROP. Unlike the general case of - a call to nonzero_bits, here we don't care about bits outside - MODE. */ - - nonzero = nonzero_bits (varop, mode) & GET_MODE_MASK (mode); - - /* If this would be an entire word for the target, but is not for - the host, then sign-extend on the host so that the number will look - the same way on the host that it would on the target. - - For example, when building a 64 bit alpha hosted 32 bit sparc - targeted compiler, then we want the 32 bit unsigned value -1 to be - represented as a 64 bit value -1, and not as 0x00000000ffffffff. - The later confuses the sparc backend. */ - - if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width - && (nonzero & ((HOST_WIDE_INT) 1 << (width - 1)))) - nonzero |= ((HOST_WIDE_INT) (-1) << width); - - /* Turn off all bits in the constant that are known to already be zero. - Thus, if the AND isn't needed at all, we will have CONSTOP == NONZERO_BITS - which is tested below. */ - - constop &= nonzero; - - /* If we don't have any bits left, return zero. */ - if (constop == 0) - return const0_rtx; - - /* If VAROP is a NEG of something known to be zero or 1 and CONSTOP is - a power of two, we can replace this with a ASHIFT. */ - if (GET_CODE (varop) == NEG && nonzero_bits (XEXP (varop, 0), mode) == 1 - && (i = exact_log2 (constop)) >= 0) - return simplify_shift_const (NULL_RTX, ASHIFT, mode, XEXP (varop, 0), i); - - /* If VAROP is an IOR or XOR, apply the AND to both branches of the IOR - or XOR, then try to apply the distributive law. This may eliminate - operations if either branch can be simplified because of the AND. - It may also make some cases more complex, but those cases probably - won't match a pattern either with or without this. */ - - if (GET_CODE (varop) == IOR || GET_CODE (varop) == XOR) - return - gen_lowpart_for_combine - (mode, - apply_distributive_law - (gen_binary (GET_CODE (varop), GET_MODE (varop), - simplify_and_const_int (NULL_RTX, GET_MODE (varop), - XEXP (varop, 0), constop), - simplify_and_const_int (NULL_RTX, GET_MODE (varop), - XEXP (varop, 1), constop)))); - - /* Get VAROP in MODE. Try to get a SUBREG if not. Don't make a new SUBREG - if we already had one (just check for the simplest cases). */ - if (x && GET_CODE (XEXP (x, 0)) == SUBREG - && GET_MODE (XEXP (x, 0)) == mode - && SUBREG_REG (XEXP (x, 0)) == varop) - varop = XEXP (x, 0); - else - varop = gen_lowpart_for_combine (mode, varop); - - /* If we can't make the SUBREG, try to return what we were given. */ - if (GET_CODE (varop) == CLOBBER) - return x ? x : varop; - - /* If we are only masking insignificant bits, return VAROP. */ - if (constop == nonzero) - x = varop; - - /* Otherwise, return an AND. See how much, if any, of X we can use. */ - else if (x == 0 || GET_CODE (x) != AND || GET_MODE (x) != mode) - x = gen_binary (AND, mode, varop, GEN_INT (constop)); - - else - { - if (GET_CODE (XEXP (x, 1)) != CONST_INT - || (unsigned HOST_WIDE_INT) INTVAL (XEXP (x, 1)) != constop) - SUBST (XEXP (x, 1), GEN_INT (constop)); - - SUBST (XEXP (x, 0), varop); - } - - return x; -} - -/* We let num_sign_bit_copies recur into nonzero_bits as that is useful. - We don't let nonzero_bits recur into num_sign_bit_copies, because that - is less useful. We can't allow both, because that results in exponential - run time recursion. There is a nullstone testcase that triggered - this. This macro avoids accidental uses of num_sign_bit_copies. */ -#define num_sign_bit_copies() - -/* Given an expression, X, compute which bits in X can be non-zero. - We don't care about bits outside of those defined in MODE. - - For most X this is simply GET_MODE_MASK (GET_MODE (MODE)), but if X is - a shift, AND, or zero_extract, we can do better. */ - -static unsigned HOST_WIDE_INT -nonzero_bits (x, mode) - rtx x; - enum machine_mode mode; -{ - unsigned HOST_WIDE_INT nonzero = GET_MODE_MASK (mode); - unsigned HOST_WIDE_INT inner_nz; - enum rtx_code code; - int mode_width = GET_MODE_BITSIZE (mode); - rtx tem; - - /* For floating-point values, assume all bits are needed. */ - if (FLOAT_MODE_P (GET_MODE (x)) || FLOAT_MODE_P (mode)) - return nonzero; - - /* If X is wider than MODE, use its mode instead. */ - if (GET_MODE_BITSIZE (GET_MODE (x)) > mode_width) - { - mode = GET_MODE (x); - nonzero = GET_MODE_MASK (mode); - mode_width = GET_MODE_BITSIZE (mode); - } - - if (mode_width > HOST_BITS_PER_WIDE_INT) - /* Our only callers in this case look for single bit values. So - just return the mode mask. Those tests will then be false. */ - return nonzero; - -#ifndef WORD_REGISTER_OPERATIONS - /* If MODE is wider than X, but both are a single word for both the host - and target machines, we can compute this from which bits of the - object might be nonzero in its own mode, taking into account the fact - that on many CISC machines, accessing an object in a wider mode - causes the high-order bits to become undefined. So they are - not known to be zero. */ - - if (GET_MODE (x) != VOIDmode && GET_MODE (x) != mode - && GET_MODE_BITSIZE (GET_MODE (x)) <= BITS_PER_WORD - && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT - && GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (GET_MODE (x))) - { - nonzero &= nonzero_bits (x, GET_MODE (x)); - nonzero |= GET_MODE_MASK (mode) & ~ GET_MODE_MASK (GET_MODE (x)); - return nonzero; - } -#endif - - code = GET_CODE (x); - switch (code) - { - case REG: -#ifdef POINTERS_EXTEND_UNSIGNED - /* If pointers extend unsigned and this is a pointer in Pmode, say that - all the bits above ptr_mode are known to be zero. */ - if (POINTERS_EXTEND_UNSIGNED && GET_MODE (x) == Pmode - && REGNO_POINTER_FLAG (REGNO (x))) - nonzero &= GET_MODE_MASK (ptr_mode); -#endif - -#ifdef STACK_BOUNDARY - /* If this is the stack pointer, we may know something about its - alignment. If PUSH_ROUNDING is defined, it is possible for the - stack to be momentarily aligned only to that amount, so we pick - the least alignment. */ - - /* We can't check for arg_pointer_rtx here, because it is not - guaranteed to have as much alignment as the stack pointer. - In particular, in the Irix6 n64 ABI, the stack has 128 bit - alignment but the argument pointer has only 64 bit alignment. */ - - if ((x == frame_pointer_rtx - || x == stack_pointer_rtx - || x == hard_frame_pointer_rtx - || (REGNO (x) >= FIRST_VIRTUAL_REGISTER - && REGNO (x) <= LAST_VIRTUAL_REGISTER)) -#ifdef STACK_BIAS - && !STACK_BIAS -#endif - ) - { - int sp_alignment = STACK_BOUNDARY / BITS_PER_UNIT; - -#ifdef PUSH_ROUNDING - if (REGNO (x) == STACK_POINTER_REGNUM) - sp_alignment = MIN (PUSH_ROUNDING (1), sp_alignment); -#endif - - /* We must return here, otherwise we may get a worse result from - one of the choices below. There is nothing useful below as - far as the stack pointer is concerned. */ - return nonzero &= ~ (sp_alignment - 1); - } -#endif - - /* If X is a register whose nonzero bits value is current, use it. - Otherwise, if X is a register whose value we can find, use that - value. Otherwise, use the previously-computed global nonzero bits - for this register. */ - - if (reg_last_set_value[REGNO (x)] != 0 - && reg_last_set_mode[REGNO (x)] == mode - && (REG_N_SETS (REGNO (x)) == 1 - || reg_last_set_label[REGNO (x)] == label_tick) - && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid) - return reg_last_set_nonzero_bits[REGNO (x)]; - - tem = get_last_value (x); - - if (tem) - { -#ifdef SHORT_IMMEDIATES_SIGN_EXTEND - /* If X is narrower than MODE and TEM is a non-negative - constant that would appear negative in the mode of X, - sign-extend it for use in reg_nonzero_bits because some - machines (maybe most) will actually do the sign-extension - and this is the conservative approach. - - ??? For 2.5, try to tighten up the MD files in this regard - instead of this kludge. */ - - if (GET_MODE_BITSIZE (GET_MODE (x)) < mode_width - && GET_CODE (tem) == CONST_INT - && INTVAL (tem) > 0 - && 0 != (INTVAL (tem) - & ((HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (GET_MODE (x)) - 1)))) - tem = GEN_INT (INTVAL (tem) - | ((HOST_WIDE_INT) (-1) - << GET_MODE_BITSIZE (GET_MODE (x)))); -#endif - return nonzero_bits (tem, mode); - } - else if (nonzero_sign_valid && reg_nonzero_bits[REGNO (x)]) - return reg_nonzero_bits[REGNO (x)] & nonzero; - else - return nonzero; - - case CONST_INT: -#ifdef SHORT_IMMEDIATES_SIGN_EXTEND - /* If X is negative in MODE, sign-extend the value. */ - if (INTVAL (x) > 0 && mode_width < BITS_PER_WORD - && 0 != (INTVAL (x) & ((HOST_WIDE_INT) 1 << (mode_width - 1)))) - return (INTVAL (x) | ((HOST_WIDE_INT) (-1) << mode_width)); -#endif - - return INTVAL (x); - - case MEM: -#ifdef LOAD_EXTEND_OP - /* In many, if not most, RISC machines, reading a byte from memory - zeros the rest of the register. Noticing that fact saves a lot - of extra zero-extends. */ - if (LOAD_EXTEND_OP (GET_MODE (x)) == ZERO_EXTEND) - nonzero &= GET_MODE_MASK (GET_MODE (x)); -#endif - break; - - case EQ: case NE: - case GT: case GTU: - case LT: case LTU: - case GE: case GEU: - case LE: case LEU: - - /* If this produces an integer result, we know which bits are set. - Code here used to clear bits outside the mode of X, but that is - now done above. */ - - if (GET_MODE_CLASS (mode) == MODE_INT - && mode_width <= HOST_BITS_PER_WIDE_INT) - nonzero = STORE_FLAG_VALUE; - break; - - case NEG: -#if 0 - /* Disabled to avoid exponential mutual recursion between nonzero_bits - and num_sign_bit_copies. */ - if (num_sign_bit_copies (XEXP (x, 0), GET_MODE (x)) - == GET_MODE_BITSIZE (GET_MODE (x))) - nonzero = 1; -#endif - - if (GET_MODE_SIZE (GET_MODE (x)) < mode_width) - nonzero |= (GET_MODE_MASK (mode) & ~ GET_MODE_MASK (GET_MODE (x))); - break; - - case ABS: -#if 0 - /* Disabled to avoid exponential mutual recursion between nonzero_bits - and num_sign_bit_copies. */ - if (num_sign_bit_copies (XEXP (x, 0), GET_MODE (x)) - == GET_MODE_BITSIZE (GET_MODE (x))) - nonzero = 1; -#endif - break; - - case TRUNCATE: - nonzero &= (nonzero_bits (XEXP (x, 0), mode) & GET_MODE_MASK (mode)); - break; - - case ZERO_EXTEND: - nonzero &= nonzero_bits (XEXP (x, 0), mode); - if (GET_MODE (XEXP (x, 0)) != VOIDmode) - nonzero &= GET_MODE_MASK (GET_MODE (XEXP (x, 0))); - break; - - case SIGN_EXTEND: - /* If the sign bit is known clear, this is the same as ZERO_EXTEND. - Otherwise, show all the bits in the outer mode but not the inner - may be non-zero. */ - inner_nz = nonzero_bits (XEXP (x, 0), mode); - if (GET_MODE (XEXP (x, 0)) != VOIDmode) - { - inner_nz &= GET_MODE_MASK (GET_MODE (XEXP (x, 0))); - if (inner_nz - & (((HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - 1)))) - inner_nz |= (GET_MODE_MASK (mode) - & ~ GET_MODE_MASK (GET_MODE (XEXP (x, 0)))); - } - - nonzero &= inner_nz; - break; - - case AND: - nonzero &= (nonzero_bits (XEXP (x, 0), mode) - & nonzero_bits (XEXP (x, 1), mode)); - break; - - case XOR: case IOR: - case UMIN: case UMAX: case SMIN: case SMAX: - nonzero &= (nonzero_bits (XEXP (x, 0), mode) - | nonzero_bits (XEXP (x, 1), mode)); - break; - - case PLUS: case MINUS: - case MULT: - case DIV: case UDIV: - case MOD: case UMOD: - /* We can apply the rules of arithmetic to compute the number of - high- and low-order zero bits of these operations. We start by - computing the width (position of the highest-order non-zero bit) - and the number of low-order zero bits for each value. */ - { - unsigned HOST_WIDE_INT nz0 = nonzero_bits (XEXP (x, 0), mode); - unsigned HOST_WIDE_INT nz1 = nonzero_bits (XEXP (x, 1), mode); - int width0 = floor_log2 (nz0) + 1; - int width1 = floor_log2 (nz1) + 1; - int low0 = floor_log2 (nz0 & -nz0); - int low1 = floor_log2 (nz1 & -nz1); - HOST_WIDE_INT op0_maybe_minusp - = (nz0 & ((HOST_WIDE_INT) 1 << (mode_width - 1))); - HOST_WIDE_INT op1_maybe_minusp - = (nz1 & ((HOST_WIDE_INT) 1 << (mode_width - 1))); - int result_width = mode_width; - int result_low = 0; - - switch (code) - { - case PLUS: -#ifdef STACK_BIAS - if (STACK_BIAS - && (XEXP (x, 0) == stack_pointer_rtx - || XEXP (x, 0) == frame_pointer_rtx) - && GET_CODE (XEXP (x, 1)) == CONST_INT) - { - int sp_alignment = STACK_BOUNDARY / BITS_PER_UNIT; - - nz0 = (GET_MODE_MASK (mode) & ~ (sp_alignment - 1)); - nz1 = INTVAL (XEXP (x, 1)) - STACK_BIAS; - width0 = floor_log2 (nz0) + 1; - width1 = floor_log2 (nz1) + 1; - low0 = floor_log2 (nz0 & -nz0); - low1 = floor_log2 (nz1 & -nz1); - } -#endif - result_width = MAX (width0, width1) + 1; - result_low = MIN (low0, low1); - break; - case MINUS: - result_low = MIN (low0, low1); - break; - case MULT: - result_width = width0 + width1; - result_low = low0 + low1; - break; - case DIV: - if (! op0_maybe_minusp && ! op1_maybe_minusp) - result_width = width0; - break; - case UDIV: - result_width = width0; - break; - case MOD: - if (! op0_maybe_minusp && ! op1_maybe_minusp) - result_width = MIN (width0, width1); - result_low = MIN (low0, low1); - break; - case UMOD: - result_width = MIN (width0, width1); - result_low = MIN (low0, low1); - break; - default: - abort (); - } - - if (result_width < mode_width) - nonzero &= ((HOST_WIDE_INT) 1 << result_width) - 1; - - if (result_low > 0) - nonzero &= ~ (((HOST_WIDE_INT) 1 << result_low) - 1); - } - break; - - case ZERO_EXTRACT: - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT) - nonzero &= ((HOST_WIDE_INT) 1 << INTVAL (XEXP (x, 1))) - 1; - break; - - case SUBREG: - /* If this is a SUBREG formed for a promoted variable that has - been zero-extended, we know that at least the high-order bits - are zero, though others might be too. */ - - if (SUBREG_PROMOTED_VAR_P (x) && SUBREG_PROMOTED_UNSIGNED_P (x)) - nonzero = (GET_MODE_MASK (GET_MODE (x)) - & nonzero_bits (SUBREG_REG (x), GET_MODE (x))); - - /* If the inner mode is a single word for both the host and target - machines, we can compute this from which bits of the inner - object might be nonzero. */ - if (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) <= BITS_PER_WORD - && (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) - <= HOST_BITS_PER_WIDE_INT)) - { - nonzero &= nonzero_bits (SUBREG_REG (x), mode); - -#if defined (WORD_REGISTER_OPERATIONS) && defined (LOAD_EXTEND_OP) - /* If this is a typical RISC machine, we only have to worry - about the way loads are extended. */ - if (LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) == SIGN_EXTEND - ? (nonzero - & (1L << (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) - 1))) - : LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) != ZERO_EXTEND) -#endif - { - /* On many CISC machines, accessing an object in a wider mode - causes the high-order bits to become undefined. So they are - not known to be zero. */ - if (GET_MODE_SIZE (GET_MODE (x)) - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) - nonzero |= (GET_MODE_MASK (GET_MODE (x)) - & ~ GET_MODE_MASK (GET_MODE (SUBREG_REG (x)))); - } - } - break; - - case ASHIFTRT: - case LSHIFTRT: - case ASHIFT: - case ROTATE: - /* The nonzero bits are in two classes: any bits within MODE - that aren't in GET_MODE (x) are always significant. The rest of the - nonzero bits are those that are significant in the operand of - the shift when shifted the appropriate number of bits. This - shows that high-order bits are cleared by the right shift and - low-order bits by left shifts. */ - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) >= 0 - && INTVAL (XEXP (x, 1)) < HOST_BITS_PER_WIDE_INT) - { - enum machine_mode inner_mode = GET_MODE (x); - int width = GET_MODE_BITSIZE (inner_mode); - int count = INTVAL (XEXP (x, 1)); - unsigned HOST_WIDE_INT mode_mask = GET_MODE_MASK (inner_mode); - unsigned HOST_WIDE_INT op_nonzero = nonzero_bits (XEXP (x, 0), mode); - unsigned HOST_WIDE_INT inner = op_nonzero & mode_mask; - unsigned HOST_WIDE_INT outer = 0; - - if (mode_width > width) - outer = (op_nonzero & nonzero & ~ mode_mask); - - if (code == LSHIFTRT) - inner >>= count; - else if (code == ASHIFTRT) - { - inner >>= count; - - /* If the sign bit may have been nonzero before the shift, we - need to mark all the places it could have been copied to - by the shift as possibly nonzero. */ - if (inner & ((HOST_WIDE_INT) 1 << (width - 1 - count))) - inner |= (((HOST_WIDE_INT) 1 << count) - 1) << (width - count); - } - else if (code == ASHIFT) - inner <<= count; - else - inner = ((inner << (count % width) - | (inner >> (width - (count % width)))) & mode_mask); - - nonzero &= (outer | inner); - } - break; - - case FFS: - /* This is at most the number of bits in the mode. */ - nonzero = ((HOST_WIDE_INT) 1 << (floor_log2 (mode_width) + 1)) - 1; - break; - - case IF_THEN_ELSE: - nonzero &= (nonzero_bits (XEXP (x, 1), mode) - | nonzero_bits (XEXP (x, 2), mode)); - break; - - default: - break; - } - - return nonzero; -} - -/* See the macro definition above. */ -#undef num_sign_bit_copies - -/* Return the number of bits at the high-order end of X that are known to - be equal to the sign bit. X will be used in mode MODE; if MODE is - VOIDmode, X will be used in its own mode. The returned value will always - be between 1 and the number of bits in MODE. */ - -static int -num_sign_bit_copies (x, mode) - rtx x; - enum machine_mode mode; -{ - enum rtx_code code = GET_CODE (x); - int bitwidth; - int num0, num1, result; - unsigned HOST_WIDE_INT nonzero; - rtx tem; - - /* If we weren't given a mode, use the mode of X. If the mode is still - VOIDmode, we don't know anything. Likewise if one of the modes is - floating-point. */ - - if (mode == VOIDmode) - mode = GET_MODE (x); - - if (mode == VOIDmode || FLOAT_MODE_P (mode) || FLOAT_MODE_P (GET_MODE (x))) - return 1; - - bitwidth = GET_MODE_BITSIZE (mode); - - /* For a smaller object, just ignore the high bits. */ - if (bitwidth < GET_MODE_BITSIZE (GET_MODE (x))) - return MAX (1, (num_sign_bit_copies (x, GET_MODE (x)) - - (GET_MODE_BITSIZE (GET_MODE (x)) - bitwidth))); - - if (GET_MODE (x) != VOIDmode && bitwidth > GET_MODE_BITSIZE (GET_MODE (x))) - { -#ifndef WORD_REGISTER_OPERATIONS - /* If this machine does not do all register operations on the entire - register and MODE is wider than the mode of X, we can say nothing - at all about the high-order bits. */ - return 1; -#else - /* Likewise on machines that do, if the mode of the object is smaller - than a word and loads of that size don't sign extend, we can say - nothing about the high order bits. */ - if (GET_MODE_BITSIZE (GET_MODE (x)) < BITS_PER_WORD -#ifdef LOAD_EXTEND_OP - && LOAD_EXTEND_OP (GET_MODE (x)) != SIGN_EXTEND -#endif - ) - return 1; -#endif - } - - switch (code) - { - case REG: - -#ifdef POINTERS_EXTEND_UNSIGNED - /* If pointers extend signed and this is a pointer in Pmode, say that - all the bits above ptr_mode are known to be sign bit copies. */ - if (! POINTERS_EXTEND_UNSIGNED && GET_MODE (x) == Pmode && mode == Pmode - && REGNO_POINTER_FLAG (REGNO (x))) - return GET_MODE_BITSIZE (Pmode) - GET_MODE_BITSIZE (ptr_mode) + 1; -#endif - - if (reg_last_set_value[REGNO (x)] != 0 - && reg_last_set_mode[REGNO (x)] == mode - && (REG_N_SETS (REGNO (x)) == 1 - || reg_last_set_label[REGNO (x)] == label_tick) - && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid) - return reg_last_set_sign_bit_copies[REGNO (x)]; - - tem = get_last_value (x); - if (tem != 0) - return num_sign_bit_copies (tem, mode); - - if (nonzero_sign_valid && reg_sign_bit_copies[REGNO (x)] != 0) - return reg_sign_bit_copies[REGNO (x)]; - break; - - case MEM: -#ifdef LOAD_EXTEND_OP - /* Some RISC machines sign-extend all loads of smaller than a word. */ - if (LOAD_EXTEND_OP (GET_MODE (x)) == SIGN_EXTEND) - return MAX (1, bitwidth - GET_MODE_BITSIZE (GET_MODE (x)) + 1); -#endif - break; - - case CONST_INT: - /* If the constant is negative, take its 1's complement and remask. - Then see how many zero bits we have. */ - nonzero = INTVAL (x) & GET_MODE_MASK (mode); - if (bitwidth <= HOST_BITS_PER_WIDE_INT - && (nonzero & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0) - nonzero = (~ nonzero) & GET_MODE_MASK (mode); - - return (nonzero == 0 ? bitwidth : bitwidth - floor_log2 (nonzero) - 1); - - case SUBREG: - /* If this is a SUBREG for a promoted object that is sign-extended - and we are looking at it in a wider mode, we know that at least the - high-order bits are known to be sign bit copies. */ - - if (SUBREG_PROMOTED_VAR_P (x) && ! SUBREG_PROMOTED_UNSIGNED_P (x)) - return MAX (bitwidth - GET_MODE_BITSIZE (GET_MODE (x)) + 1, - num_sign_bit_copies (SUBREG_REG (x), mode)); - - /* For a smaller object, just ignore the high bits. */ - if (bitwidth <= GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x)))) - { - num0 = num_sign_bit_copies (SUBREG_REG (x), VOIDmode); - return MAX (1, (num0 - - (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) - - bitwidth))); - } - -#ifdef WORD_REGISTER_OPERATIONS -#ifdef LOAD_EXTEND_OP - /* For paradoxical SUBREGs on machines where all register operations - affect the entire register, just look inside. Note that we are - passing MODE to the recursive call, so the number of sign bit copies - will remain relative to that mode, not the inner mode. */ - - /* This works only if loads sign extend. Otherwise, if we get a - reload for the inner part, it may be loaded from the stack, and - then we lose all sign bit copies that existed before the store - to the stack. */ - - if ((GET_MODE_SIZE (GET_MODE (x)) - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) - && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) == SIGN_EXTEND) - return num_sign_bit_copies (SUBREG_REG (x), mode); -#endif -#endif - break; - - case SIGN_EXTRACT: - if (GET_CODE (XEXP (x, 1)) == CONST_INT) - return MAX (1, bitwidth - INTVAL (XEXP (x, 1))); - break; - - case SIGN_EXTEND: - return (bitwidth - GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - + num_sign_bit_copies (XEXP (x, 0), VOIDmode)); - - case TRUNCATE: - /* For a smaller object, just ignore the high bits. */ - num0 = num_sign_bit_copies (XEXP (x, 0), VOIDmode); - return MAX (1, (num0 - (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - - bitwidth))); - - case NOT: - return num_sign_bit_copies (XEXP (x, 0), mode); - - case ROTATE: case ROTATERT: - /* If we are rotating left by a number of bits less than the number - of sign bit copies, we can just subtract that amount from the - number. */ - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) >= 0 && INTVAL (XEXP (x, 1)) < bitwidth) - { - num0 = num_sign_bit_copies (XEXP (x, 0), mode); - return MAX (1, num0 - (code == ROTATE ? INTVAL (XEXP (x, 1)) - : bitwidth - INTVAL (XEXP (x, 1)))); - } - break; - - case NEG: - /* In general, this subtracts one sign bit copy. But if the value - is known to be positive, the number of sign bit copies is the - same as that of the input. Finally, if the input has just one bit - that might be nonzero, all the bits are copies of the sign bit. */ - num0 = num_sign_bit_copies (XEXP (x, 0), mode); - if (bitwidth > HOST_BITS_PER_WIDE_INT) - return num0 > 1 ? num0 - 1 : 1; - - nonzero = nonzero_bits (XEXP (x, 0), mode); - if (nonzero == 1) - return bitwidth; - - if (num0 > 1 - && (((HOST_WIDE_INT) 1 << (bitwidth - 1)) & nonzero)) - num0--; - - return num0; - - case IOR: case AND: case XOR: - case SMIN: case SMAX: case UMIN: case UMAX: - /* Logical operations will preserve the number of sign-bit copies. - MIN and MAX operations always return one of the operands. */ - num0 = num_sign_bit_copies (XEXP (x, 0), mode); - num1 = num_sign_bit_copies (XEXP (x, 1), mode); - return MIN (num0, num1); - - case PLUS: case MINUS: - /* For addition and subtraction, we can have a 1-bit carry. However, - if we are subtracting 1 from a positive number, there will not - be such a carry. Furthermore, if the positive number is known to - be 0 or 1, we know the result is either -1 or 0. */ - - if (code == PLUS && XEXP (x, 1) == constm1_rtx - && bitwidth <= HOST_BITS_PER_WIDE_INT) - { - nonzero = nonzero_bits (XEXP (x, 0), mode); - if ((((HOST_WIDE_INT) 1 << (bitwidth - 1)) & nonzero) == 0) - return (nonzero == 1 || nonzero == 0 ? bitwidth - : bitwidth - floor_log2 (nonzero) - 1); - } - - num0 = num_sign_bit_copies (XEXP (x, 0), mode); - num1 = num_sign_bit_copies (XEXP (x, 1), mode); - return MAX (1, MIN (num0, num1) - 1); - - case MULT: - /* The number of bits of the product is the sum of the number of - bits of both terms. However, unless one of the terms if known - to be positive, we must allow for an additional bit since negating - a negative number can remove one sign bit copy. */ - - num0 = num_sign_bit_copies (XEXP (x, 0), mode); - num1 = num_sign_bit_copies (XEXP (x, 1), mode); - - result = bitwidth - (bitwidth - num0) - (bitwidth - num1); - if (result > 0 - && (bitwidth > HOST_BITS_PER_WIDE_INT - || (((nonzero_bits (XEXP (x, 0), mode) - & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0) - && ((nonzero_bits (XEXP (x, 1), mode) - & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)))) - result--; - - return MAX (1, result); - - case UDIV: - /* The result must be <= the first operand. If the first operand - has the high bit set, we know nothing about the number of sign - bit copies. */ - if (bitwidth > HOST_BITS_PER_WIDE_INT) - return 1; - else if ((nonzero_bits (XEXP (x, 0), mode) - & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0) - return 1; - else - return num_sign_bit_copies (XEXP (x, 0), mode); - - case UMOD: - /* The result must be <= the scond operand. */ - return num_sign_bit_copies (XEXP (x, 1), mode); - - case DIV: - /* Similar to unsigned division, except that we have to worry about - the case where the divisor is negative, in which case we have - to add 1. */ - result = num_sign_bit_copies (XEXP (x, 0), mode); - if (result > 1 - && (bitwidth > HOST_BITS_PER_WIDE_INT - || (nonzero_bits (XEXP (x, 1), mode) - & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)) - result--; - - return result; - - case MOD: - result = num_sign_bit_copies (XEXP (x, 1), mode); - if (result > 1 - && (bitwidth > HOST_BITS_PER_WIDE_INT - || (nonzero_bits (XEXP (x, 1), mode) - & ((HOST_WIDE_INT) 1 << (bitwidth - 1))) != 0)) - result--; - - return result; - - case ASHIFTRT: - /* Shifts by a constant add to the number of bits equal to the - sign bit. */ - num0 = num_sign_bit_copies (XEXP (x, 0), mode); - if (GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) > 0) - num0 = MIN (bitwidth, num0 + INTVAL (XEXP (x, 1))); - - return num0; - - case ASHIFT: - /* Left shifts destroy copies. */ - if (GET_CODE (XEXP (x, 1)) != CONST_INT - || INTVAL (XEXP (x, 1)) < 0 - || INTVAL (XEXP (x, 1)) >= bitwidth) - return 1; - - num0 = num_sign_bit_copies (XEXP (x, 0), mode); - return MAX (1, num0 - INTVAL (XEXP (x, 1))); - - case IF_THEN_ELSE: - num0 = num_sign_bit_copies (XEXP (x, 1), mode); - num1 = num_sign_bit_copies (XEXP (x, 2), mode); - return MIN (num0, num1); - - case EQ: case NE: case GE: case GT: case LE: case LT: - case GEU: case GTU: case LEU: case LTU: - if (STORE_FLAG_VALUE == -1) - return bitwidth; - break; - - default: - break; - } - - /* If we haven't been able to figure it out by one of the above rules, - see if some of the high-order bits are known to be zero. If so, - count those bits and return one less than that amount. If we can't - safely compute the mask for this mode, always return BITWIDTH. */ - - if (bitwidth > HOST_BITS_PER_WIDE_INT) - return 1; - - nonzero = nonzero_bits (x, mode); - return (nonzero & ((HOST_WIDE_INT) 1 << (bitwidth - 1)) - ? 1 : bitwidth - floor_log2 (nonzero) - 1); -} - -/* Return the number of "extended" bits there are in X, when interpreted - as a quantity in MODE whose signedness is indicated by UNSIGNEDP. For - unsigned quantities, this is the number of high-order zero bits. - For signed quantities, this is the number of copies of the sign bit - minus 1. In both case, this function returns the number of "spare" - bits. For example, if two quantities for which this function returns - at least 1 are added, the addition is known not to overflow. - - This function will always return 0 unless called during combine, which - implies that it must be called from a define_split. */ - -int -extended_count (x, mode, unsignedp) - rtx x; - enum machine_mode mode; - int unsignedp; -{ - if (nonzero_sign_valid == 0) - return 0; - - return (unsignedp - ? (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && (GET_MODE_BITSIZE (mode) - 1 - - floor_log2 (nonzero_bits (x, mode)))) - : num_sign_bit_copies (x, mode) - 1); -} - -/* This function is called from `simplify_shift_const' to merge two - outer operations. Specifically, we have already found that we need - to perform operation *POP0 with constant *PCONST0 at the outermost - position. We would now like to also perform OP1 with constant CONST1 - (with *POP0 being done last). - - Return 1 if we can do the operation and update *POP0 and *PCONST0 with - the resulting operation. *PCOMP_P is set to 1 if we would need to - complement the innermost operand, otherwise it is unchanged. - - MODE is the mode in which the operation will be done. No bits outside - the width of this mode matter. It is assumed that the width of this mode - is smaller than or equal to HOST_BITS_PER_WIDE_INT. - - If *POP0 or OP1 are NIL, it means no operation is required. Only NEG, PLUS, - IOR, XOR, and AND are supported. We may set *POP0 to SET if the proper - result is simply *PCONST0. - - If the resulting operation cannot be expressed as one operation, we - return 0 and do not change *POP0, *PCONST0, and *PCOMP_P. */ - -static int -merge_outer_ops (pop0, pconst0, op1, const1, mode, pcomp_p) - enum rtx_code *pop0; - HOST_WIDE_INT *pconst0; - enum rtx_code op1; - HOST_WIDE_INT const1; - enum machine_mode mode; - int *pcomp_p; -{ - enum rtx_code op0 = *pop0; - HOST_WIDE_INT const0 = *pconst0; - int width = GET_MODE_BITSIZE (mode); - - const0 &= GET_MODE_MASK (mode); - const1 &= GET_MODE_MASK (mode); - - /* If OP0 is an AND, clear unimportant bits in CONST1. */ - if (op0 == AND) - const1 &= const0; - - /* If OP0 or OP1 is NIL, this is easy. Similarly if they are the same or - if OP0 is SET. */ - - if (op1 == NIL || op0 == SET) - return 1; - - else if (op0 == NIL) - op0 = op1, const0 = const1; - - else if (op0 == op1) - { - switch (op0) - { - case AND: - const0 &= const1; - break; - case IOR: - const0 |= const1; - break; - case XOR: - const0 ^= const1; - break; - case PLUS: - const0 += const1; - break; - case NEG: - op0 = NIL; - break; - default: - break; - } - } - - /* Otherwise, if either is a PLUS or NEG, we can't do anything. */ - else if (op0 == PLUS || op1 == PLUS || op0 == NEG || op1 == NEG) - return 0; - - /* If the two constants aren't the same, we can't do anything. The - remaining six cases can all be done. */ - else if (const0 != const1) - return 0; - - else - switch (op0) - { - case IOR: - if (op1 == AND) - /* (a & b) | b == b */ - op0 = SET; - else /* op1 == XOR */ - /* (a ^ b) | b == a | b */ - {;} - break; - - case XOR: - if (op1 == AND) - /* (a & b) ^ b == (~a) & b */ - op0 = AND, *pcomp_p = 1; - else /* op1 == IOR */ - /* (a | b) ^ b == a & ~b */ - op0 = AND, *pconst0 = ~ const0; - break; - - case AND: - if (op1 == IOR) - /* (a | b) & b == b */ - op0 = SET; - else /* op1 == XOR */ - /* (a ^ b) & b) == (~a) & b */ - *pcomp_p = 1; - break; - default: - break; - } - - /* Check for NO-OP cases. */ - const0 &= GET_MODE_MASK (mode); - if (const0 == 0 - && (op0 == IOR || op0 == XOR || op0 == PLUS)) - op0 = NIL; - else if (const0 == 0 && op0 == AND) - op0 = SET; - else if ((unsigned HOST_WIDE_INT) const0 == GET_MODE_MASK (mode) - && op0 == AND) - op0 = NIL; - - /* If this would be an entire word for the target, but is not for - the host, then sign-extend on the host so that the number will look - the same way on the host that it would on the target. - - For example, when building a 64 bit alpha hosted 32 bit sparc - targeted compiler, then we want the 32 bit unsigned value -1 to be - represented as a 64 bit value -1, and not as 0x00000000ffffffff. - The later confuses the sparc backend. */ - - if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width - && (const0 & ((HOST_WIDE_INT) 1 << (width - 1)))) - const0 |= ((HOST_WIDE_INT) (-1) << width); - - *pop0 = op0; - *pconst0 = const0; - - return 1; -} - -/* Simplify a shift of VAROP by COUNT bits. CODE says what kind of shift. - The result of the shift is RESULT_MODE. X, if non-zero, is an expression - that we started with. - - The shift is normally computed in the widest mode we find in VAROP, as - long as it isn't a different number of words than RESULT_MODE. Exceptions - are ASHIFTRT and ROTATE, which are always done in their original mode, */ - -static rtx -simplify_shift_const (x, code, result_mode, varop, count) - rtx x; - enum rtx_code code; - enum machine_mode result_mode; - rtx varop; - int count; -{ - enum rtx_code orig_code = code; - int orig_count = count; - enum machine_mode mode = result_mode; - enum machine_mode shift_mode, tmode; - int mode_words - = (GET_MODE_SIZE (mode) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD; - /* We form (outer_op (code varop count) (outer_const)). */ - enum rtx_code outer_op = NIL; - HOST_WIDE_INT outer_const = 0; - rtx const_rtx; - int complement_p = 0; - rtx new; - - /* If we were given an invalid count, don't do anything except exactly - what was requested. */ - - if (count < 0 || count > GET_MODE_BITSIZE (mode)) - { - if (x) - return x; - - return gen_rtx_fmt_ee (code, mode, varop, GEN_INT (count)); - } - - /* Unless one of the branches of the `if' in this loop does a `continue', - we will `break' the loop after the `if'. */ - - while (count != 0) - { - /* If we have an operand of (clobber (const_int 0)), just return that - value. */ - if (GET_CODE (varop) == CLOBBER) - return varop; - - /* If we discovered we had to complement VAROP, leave. Making a NOT - here would cause an infinite loop. */ - if (complement_p) - break; - - /* Convert ROTATERT to ROTATE. */ - if (code == ROTATERT) - code = ROTATE, count = GET_MODE_BITSIZE (result_mode) - count; - - /* We need to determine what mode we will do the shift in. If the - shift is a right shift or a ROTATE, we must always do it in the mode - it was originally done in. Otherwise, we can do it in MODE, the - widest mode encountered. */ - shift_mode - = (code == ASHIFTRT || code == LSHIFTRT || code == ROTATE - ? result_mode : mode); - - /* Handle cases where the count is greater than the size of the mode - minus 1. For ASHIFT, use the size minus one as the count (this can - occur when simplifying (lshiftrt (ashiftrt ..))). For rotates, - take the count modulo the size. For other shifts, the result is - zero. - - Since these shifts are being produced by the compiler by combining - multiple operations, each of which are defined, we know what the - result is supposed to be. */ - - if (count > GET_MODE_BITSIZE (shift_mode) - 1) - { - if (code == ASHIFTRT) - count = GET_MODE_BITSIZE (shift_mode) - 1; - else if (code == ROTATE || code == ROTATERT) - count %= GET_MODE_BITSIZE (shift_mode); - else - { - /* We can't simply return zero because there may be an - outer op. */ - varop = const0_rtx; - count = 0; - break; - } - } - - /* Negative counts are invalid and should not have been made (a - programmer-specified negative count should have been handled - above). */ - else if (count < 0) - abort (); - - /* An arithmetic right shift of a quantity known to be -1 or 0 - is a no-op. */ - if (code == ASHIFTRT - && (num_sign_bit_copies (varop, shift_mode) - == GET_MODE_BITSIZE (shift_mode))) - { - count = 0; - break; - } - - /* If we are doing an arithmetic right shift and discarding all but - the sign bit copies, this is equivalent to doing a shift by the - bitsize minus one. Convert it into that shift because it will often - allow other simplifications. */ - - if (code == ASHIFTRT - && (count + num_sign_bit_copies (varop, shift_mode) - >= GET_MODE_BITSIZE (shift_mode))) - count = GET_MODE_BITSIZE (shift_mode) - 1; - - /* We simplify the tests below and elsewhere by converting - ASHIFTRT to LSHIFTRT if we know the sign bit is clear. - `make_compound_operation' will convert it to a ASHIFTRT for - those machines (such as Vax) that don't have a LSHIFTRT. */ - if (GET_MODE_BITSIZE (shift_mode) <= HOST_BITS_PER_WIDE_INT - && code == ASHIFTRT - && ((nonzero_bits (varop, shift_mode) - & ((HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (shift_mode) - 1))) - == 0)) - code = LSHIFTRT; - - switch (GET_CODE (varop)) - { - case SIGN_EXTEND: - case ZERO_EXTEND: - case SIGN_EXTRACT: - case ZERO_EXTRACT: - new = expand_compound_operation (varop); - if (new != varop) - { - varop = new; - continue; - } - break; - - case MEM: - /* If we have (xshiftrt (mem ...) C) and C is MODE_WIDTH - minus the width of a smaller mode, we can do this with a - SIGN_EXTEND or ZERO_EXTEND from the narrower memory location. */ - if ((code == ASHIFTRT || code == LSHIFTRT) - && ! mode_dependent_address_p (XEXP (varop, 0)) - && ! MEM_VOLATILE_P (varop) - && (tmode = mode_for_size (GET_MODE_BITSIZE (mode) - count, - MODE_INT, 1)) != BLKmode) - { - if (BYTES_BIG_ENDIAN) - new = gen_rtx_MEM (tmode, XEXP (varop, 0)); - else - new = gen_rtx_MEM (tmode, - plus_constant (XEXP (varop, 0), - count / BITS_PER_UNIT)); - RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (varop); - MEM_COPY_ATTRIBUTES (new, varop); - varop = gen_rtx_combine (code == ASHIFTRT ? SIGN_EXTEND - : ZERO_EXTEND, mode, new); - count = 0; - continue; - } - break; - - case USE: - /* Similar to the case above, except that we can only do this if - the resulting mode is the same as that of the underlying - MEM and adjust the address depending on the *bits* endianness - because of the way that bit-field extract insns are defined. */ - if ((code == ASHIFTRT || code == LSHIFTRT) - && (tmode = mode_for_size (GET_MODE_BITSIZE (mode) - count, - MODE_INT, 1)) != BLKmode - && tmode == GET_MODE (XEXP (varop, 0))) - { - if (BITS_BIG_ENDIAN) - new = XEXP (varop, 0); - else - { - new = copy_rtx (XEXP (varop, 0)); - SUBST (XEXP (new, 0), - plus_constant (XEXP (new, 0), - count / BITS_PER_UNIT)); - } - - varop = gen_rtx_combine (code == ASHIFTRT ? SIGN_EXTEND - : ZERO_EXTEND, mode, new); - count = 0; - continue; - } - break; - - case SUBREG: - /* If VAROP is a SUBREG, strip it as long as the inner operand has - the same number of words as what we've seen so far. Then store - the widest mode in MODE. */ - if (subreg_lowpart_p (varop) - && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (varop))) - > GET_MODE_SIZE (GET_MODE (varop))) - && (((GET_MODE_SIZE (GET_MODE (SUBREG_REG (varop))) - + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD) - == mode_words)) - { - varop = SUBREG_REG (varop); - if (GET_MODE_SIZE (GET_MODE (varop)) > GET_MODE_SIZE (mode)) - mode = GET_MODE (varop); - continue; - } - break; - - case MULT: - /* Some machines use MULT instead of ASHIFT because MULT - is cheaper. But it is still better on those machines to - merge two shifts into one. */ - if (GET_CODE (XEXP (varop, 1)) == CONST_INT - && exact_log2 (INTVAL (XEXP (varop, 1))) >= 0) - { - varop = gen_binary (ASHIFT, GET_MODE (varop), XEXP (varop, 0), - GEN_INT (exact_log2 (INTVAL (XEXP (varop, 1)))));; - continue; - } - break; - - case UDIV: - /* Similar, for when divides are cheaper. */ - if (GET_CODE (XEXP (varop, 1)) == CONST_INT - && exact_log2 (INTVAL (XEXP (varop, 1))) >= 0) - { - varop = gen_binary (LSHIFTRT, GET_MODE (varop), XEXP (varop, 0), - GEN_INT (exact_log2 (INTVAL (XEXP (varop, 1))))); - continue; - } - break; - - case ASHIFTRT: - /* If we are extracting just the sign bit of an arithmetic right - shift, that shift is not needed. */ - if (code == LSHIFTRT && count == GET_MODE_BITSIZE (result_mode) - 1) - { - varop = XEXP (varop, 0); - continue; - } - - /* ... fall through ... */ - - case LSHIFTRT: - case ASHIFT: - case ROTATE: - /* Here we have two nested shifts. The result is usually the - AND of a new shift with a mask. We compute the result below. */ - if (GET_CODE (XEXP (varop, 1)) == CONST_INT - && INTVAL (XEXP (varop, 1)) >= 0 - && INTVAL (XEXP (varop, 1)) < GET_MODE_BITSIZE (GET_MODE (varop)) - && GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT) - { - enum rtx_code first_code = GET_CODE (varop); - int first_count = INTVAL (XEXP (varop, 1)); - unsigned HOST_WIDE_INT mask; - rtx mask_rtx; - - /* We have one common special case. We can't do any merging if - the inner code is an ASHIFTRT of a smaller mode. However, if - we have (ashift:M1 (subreg:M1 (ashiftrt:M2 FOO C1) 0) C2) - with C2 == GET_MODE_BITSIZE (M1) - GET_MODE_BITSIZE (M2), - we can convert it to - (ashiftrt:M1 (ashift:M1 (and:M1 (subreg:M1 FOO 0 C2) C3) C1). - This simplifies certain SIGN_EXTEND operations. */ - if (code == ASHIFT && first_code == ASHIFTRT - && (GET_MODE_BITSIZE (result_mode) - - GET_MODE_BITSIZE (GET_MODE (varop))) == count) - { - /* C3 has the low-order C1 bits zero. */ - - mask = (GET_MODE_MASK (mode) - & ~ (((HOST_WIDE_INT) 1 << first_count) - 1)); - - varop = simplify_and_const_int (NULL_RTX, result_mode, - XEXP (varop, 0), mask); - varop = simplify_shift_const (NULL_RTX, ASHIFT, result_mode, - varop, count); - count = first_count; - code = ASHIFTRT; - continue; - } - - /* If this was (ashiftrt (ashift foo C1) C2) and FOO has more - than C1 high-order bits equal to the sign bit, we can convert - this to either an ASHIFT or a ASHIFTRT depending on the - two counts. - - We cannot do this if VAROP's mode is not SHIFT_MODE. */ - - if (code == ASHIFTRT && first_code == ASHIFT - && GET_MODE (varop) == shift_mode - && (num_sign_bit_copies (XEXP (varop, 0), shift_mode) - > first_count)) - { - count -= first_count; - if (count < 0) - count = - count, code = ASHIFT; - varop = XEXP (varop, 0); - continue; - } - - /* There are some cases we can't do. If CODE is ASHIFTRT, - we can only do this if FIRST_CODE is also ASHIFTRT. - - We can't do the case when CODE is ROTATE and FIRST_CODE is - ASHIFTRT. - - If the mode of this shift is not the mode of the outer shift, - we can't do this if either shift is a right shift or ROTATE. - - Finally, we can't do any of these if the mode is too wide - unless the codes are the same. - - Handle the case where the shift codes are the same - first. */ - - if (code == first_code) - { - if (GET_MODE (varop) != result_mode - && (code == ASHIFTRT || code == LSHIFTRT - || code == ROTATE)) - break; - - count += first_count; - varop = XEXP (varop, 0); - continue; - } - - if (code == ASHIFTRT - || (code == ROTATE && first_code == ASHIFTRT) - || GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT - || (GET_MODE (varop) != result_mode - && (first_code == ASHIFTRT || first_code == LSHIFTRT - || first_code == ROTATE - || code == ROTATE))) - break; - - /* To compute the mask to apply after the shift, shift the - nonzero bits of the inner shift the same way the - outer shift will. */ - - mask_rtx = GEN_INT (nonzero_bits (varop, GET_MODE (varop))); - - mask_rtx - = simplify_binary_operation (code, result_mode, mask_rtx, - GEN_INT (count)); - - /* Give up if we can't compute an outer operation to use. */ - if (mask_rtx == 0 - || GET_CODE (mask_rtx) != CONST_INT - || ! merge_outer_ops (&outer_op, &outer_const, AND, - INTVAL (mask_rtx), - result_mode, &complement_p)) - break; - - /* If the shifts are in the same direction, we add the - counts. Otherwise, we subtract them. */ - if ((code == ASHIFTRT || code == LSHIFTRT) - == (first_code == ASHIFTRT || first_code == LSHIFTRT)) - count += first_count; - else - count -= first_count; - - /* If COUNT is positive, the new shift is usually CODE, - except for the two exceptions below, in which case it is - FIRST_CODE. If the count is negative, FIRST_CODE should - always be used */ - if (count > 0 - && ((first_code == ROTATE && code == ASHIFT) - || (first_code == ASHIFTRT && code == LSHIFTRT))) - code = first_code; - else if (count < 0) - code = first_code, count = - count; - - varop = XEXP (varop, 0); - continue; - } - - /* If we have (A << B << C) for any shift, we can convert this to - (A << C << B). This wins if A is a constant. Only try this if - B is not a constant. */ - - else if (GET_CODE (varop) == code - && GET_CODE (XEXP (varop, 1)) != CONST_INT - && 0 != (new - = simplify_binary_operation (code, mode, - XEXP (varop, 0), - GEN_INT (count)))) - { - varop = gen_rtx_combine (code, mode, new, XEXP (varop, 1)); - count = 0; - continue; - } - break; - - case NOT: - /* Make this fit the case below. */ - varop = gen_rtx_combine (XOR, mode, XEXP (varop, 0), - GEN_INT (GET_MODE_MASK (mode))); - continue; - - case IOR: - case AND: - case XOR: - /* If we have (xshiftrt (ior (plus X (const_int -1)) X) C) - with C the size of VAROP - 1 and the shift is logical if - STORE_FLAG_VALUE is 1 and arithmetic if STORE_FLAG_VALUE is -1, - we have an (le X 0) operation. If we have an arithmetic shift - and STORE_FLAG_VALUE is 1 or we have a logical shift with - STORE_FLAG_VALUE of -1, we have a (neg (le X 0)) operation. */ - - if (GET_CODE (varop) == IOR && GET_CODE (XEXP (varop, 0)) == PLUS - && XEXP (XEXP (varop, 0), 1) == constm1_rtx - && (STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1) - && (code == LSHIFTRT || code == ASHIFTRT) - && count == GET_MODE_BITSIZE (GET_MODE (varop)) - 1 - && rtx_equal_p (XEXP (XEXP (varop, 0), 0), XEXP (varop, 1))) - { - count = 0; - varop = gen_rtx_combine (LE, GET_MODE (varop), XEXP (varop, 1), - const0_rtx); - - if (STORE_FLAG_VALUE == 1 ? code == ASHIFTRT : code == LSHIFTRT) - varop = gen_rtx_combine (NEG, GET_MODE (varop), varop); - - continue; - } - - /* If we have (shift (logical)), move the logical to the outside - to allow it to possibly combine with another logical and the - shift to combine with another shift. This also canonicalizes to - what a ZERO_EXTRACT looks like. Also, some machines have - (and (shift)) insns. */ - - if (GET_CODE (XEXP (varop, 1)) == CONST_INT - && (new = simplify_binary_operation (code, result_mode, - XEXP (varop, 1), - GEN_INT (count))) != 0 - && GET_CODE(new) == CONST_INT - && merge_outer_ops (&outer_op, &outer_const, GET_CODE (varop), - INTVAL (new), result_mode, &complement_p)) - { - varop = XEXP (varop, 0); - continue; - } - - /* If we can't do that, try to simplify the shift in each arm of the - logical expression, make a new logical expression, and apply - the inverse distributive law. */ - { - rtx lhs = simplify_shift_const (NULL_RTX, code, shift_mode, - XEXP (varop, 0), count); - rtx rhs = simplify_shift_const (NULL_RTX, code, shift_mode, - XEXP (varop, 1), count); - - varop = gen_binary (GET_CODE (varop), shift_mode, lhs, rhs); - varop = apply_distributive_law (varop); - - count = 0; - } - break; - - case EQ: - /* convert (lshiftrt (eq FOO 0) C) to (xor FOO 1) if STORE_FLAG_VALUE - says that the sign bit can be tested, FOO has mode MODE, C is - GET_MODE_BITSIZE (MODE) - 1, and FOO has only its low-order bit - that may be nonzero. */ - if (code == LSHIFTRT - && XEXP (varop, 1) == const0_rtx - && GET_MODE (XEXP (varop, 0)) == result_mode - && count == GET_MODE_BITSIZE (result_mode) - 1 - && GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT - && ((STORE_FLAG_VALUE - & ((HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (result_mode) - 1)))) - && nonzero_bits (XEXP (varop, 0), result_mode) == 1 - && merge_outer_ops (&outer_op, &outer_const, XOR, - (HOST_WIDE_INT) 1, result_mode, - &complement_p)) - { - varop = XEXP (varop, 0); - count = 0; - continue; - } - break; - - case NEG: - /* (lshiftrt (neg A) C) where A is either 0 or 1 and C is one less - than the number of bits in the mode is equivalent to A. */ - if (code == LSHIFTRT && count == GET_MODE_BITSIZE (result_mode) - 1 - && nonzero_bits (XEXP (varop, 0), result_mode) == 1) - { - varop = XEXP (varop, 0); - count = 0; - continue; - } - - /* NEG commutes with ASHIFT since it is multiplication. Move the - NEG outside to allow shifts to combine. */ - if (code == ASHIFT - && merge_outer_ops (&outer_op, &outer_const, NEG, - (HOST_WIDE_INT) 0, result_mode, - &complement_p)) - { - varop = XEXP (varop, 0); - continue; - } - break; - - case PLUS: - /* (lshiftrt (plus A -1) C) where A is either 0 or 1 and C - is one less than the number of bits in the mode is - equivalent to (xor A 1). */ - if (code == LSHIFTRT && count == GET_MODE_BITSIZE (result_mode) - 1 - && XEXP (varop, 1) == constm1_rtx - && nonzero_bits (XEXP (varop, 0), result_mode) == 1 - && merge_outer_ops (&outer_op, &outer_const, XOR, - (HOST_WIDE_INT) 1, result_mode, - &complement_p)) - { - count = 0; - varop = XEXP (varop, 0); - continue; - } - - /* If we have (xshiftrt (plus FOO BAR) C), and the only bits - that might be nonzero in BAR are those being shifted out and those - bits are known zero in FOO, we can replace the PLUS with FOO. - Similarly in the other operand order. This code occurs when - we are computing the size of a variable-size array. */ - - if ((code == ASHIFTRT || code == LSHIFTRT) - && count < HOST_BITS_PER_WIDE_INT - && nonzero_bits (XEXP (varop, 1), result_mode) >> count == 0 - && (nonzero_bits (XEXP (varop, 1), result_mode) - & nonzero_bits (XEXP (varop, 0), result_mode)) == 0) - { - varop = XEXP (varop, 0); - continue; - } - else if ((code == ASHIFTRT || code == LSHIFTRT) - && count < HOST_BITS_PER_WIDE_INT - && GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT - && 0 == (nonzero_bits (XEXP (varop, 0), result_mode) - >> count) - && 0 == (nonzero_bits (XEXP (varop, 0), result_mode) - & nonzero_bits (XEXP (varop, 1), - result_mode))) - { - varop = XEXP (varop, 1); - continue; - } - - /* (ashift (plus foo C) N) is (plus (ashift foo N) C'). */ - if (code == ASHIFT - && GET_CODE (XEXP (varop, 1)) == CONST_INT - && (new = simplify_binary_operation (ASHIFT, result_mode, - XEXP (varop, 1), - GEN_INT (count))) != 0 - && GET_CODE(new) == CONST_INT - && merge_outer_ops (&outer_op, &outer_const, PLUS, - INTVAL (new), result_mode, &complement_p)) - { - varop = XEXP (varop, 0); - continue; - } - break; - - case MINUS: - /* If we have (xshiftrt (minus (ashiftrt X C)) X) C) - with C the size of VAROP - 1 and the shift is logical if - STORE_FLAG_VALUE is 1 and arithmetic if STORE_FLAG_VALUE is -1, - we have a (gt X 0) operation. If the shift is arithmetic with - STORE_FLAG_VALUE of 1 or logical with STORE_FLAG_VALUE == -1, - we have a (neg (gt X 0)) operation. */ - - if ((STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1) - && GET_CODE (XEXP (varop, 0)) == ASHIFTRT - && count == GET_MODE_BITSIZE (GET_MODE (varop)) - 1 - && (code == LSHIFTRT || code == ASHIFTRT) - && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT - && INTVAL (XEXP (XEXP (varop, 0), 1)) == count - && rtx_equal_p (XEXP (XEXP (varop, 0), 0), XEXP (varop, 1))) - { - count = 0; - varop = gen_rtx_combine (GT, GET_MODE (varop), XEXP (varop, 1), - const0_rtx); - - if (STORE_FLAG_VALUE == 1 ? code == ASHIFTRT : code == LSHIFTRT) - varop = gen_rtx_combine (NEG, GET_MODE (varop), varop); - - continue; - } - break; - - case TRUNCATE: - /* Change (lshiftrt (truncate (lshiftrt))) to (truncate (lshiftrt)) - if the truncate does not affect the value. */ - if (code == LSHIFTRT - && GET_CODE (XEXP (varop, 0)) == LSHIFTRT - && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT - && (INTVAL (XEXP (XEXP (varop, 0), 1)) - >= (GET_MODE_BITSIZE (GET_MODE (XEXP (varop, 0))) - - GET_MODE_BITSIZE (GET_MODE (varop))))) - { - rtx varop_inner = XEXP (varop, 0); - - varop_inner = gen_rtx_combine (LSHIFTRT, - GET_MODE (varop_inner), - XEXP (varop_inner, 0), - GEN_INT (count + INTVAL (XEXP (varop_inner, 1)))); - varop = gen_rtx_combine (TRUNCATE, GET_MODE (varop), - varop_inner); - count = 0; - continue; - } - break; - - default: - break; - } - - break; - } - - /* We need to determine what mode to do the shift in. If the shift is - a right shift or ROTATE, we must always do it in the mode it was - originally done in. Otherwise, we can do it in MODE, the widest mode - encountered. The code we care about is that of the shift that will - actually be done, not the shift that was originally requested. */ - shift_mode - = (code == ASHIFTRT || code == LSHIFTRT || code == ROTATE - ? result_mode : mode); - - /* We have now finished analyzing the shift. The result should be - a shift of type CODE with SHIFT_MODE shifting VAROP COUNT places. If - OUTER_OP is non-NIL, it is an operation that needs to be applied - to the result of the shift. OUTER_CONST is the relevant constant, - but we must turn off all bits turned off in the shift. - - If we were passed a value for X, see if we can use any pieces of - it. If not, make new rtx. */ - - if (x && GET_RTX_CLASS (GET_CODE (x)) == '2' - && GET_CODE (XEXP (x, 1)) == CONST_INT - && INTVAL (XEXP (x, 1)) == count) - const_rtx = XEXP (x, 1); - else - const_rtx = GEN_INT (count); - - if (x && GET_CODE (XEXP (x, 0)) == SUBREG - && GET_MODE (XEXP (x, 0)) == shift_mode - && SUBREG_REG (XEXP (x, 0)) == varop) - varop = XEXP (x, 0); - else if (GET_MODE (varop) != shift_mode) - varop = gen_lowpart_for_combine (shift_mode, varop); - - /* If we can't make the SUBREG, try to return what we were given. */ - if (GET_CODE (varop) == CLOBBER) - return x ? x : varop; - - new = simplify_binary_operation (code, shift_mode, varop, const_rtx); - if (new != 0) - x = new; - else - { - if (x == 0 || GET_CODE (x) != code || GET_MODE (x) != shift_mode) - x = gen_rtx_combine (code, shift_mode, varop, const_rtx); - - SUBST (XEXP (x, 0), varop); - SUBST (XEXP (x, 1), const_rtx); - } - - /* If we have an outer operation and we just made a shift, it is - possible that we could have simplified the shift were it not - for the outer operation. So try to do the simplification - recursively. */ - - if (outer_op != NIL && GET_CODE (x) == code - && GET_CODE (XEXP (x, 1)) == CONST_INT) - x = simplify_shift_const (x, code, shift_mode, XEXP (x, 0), - INTVAL (XEXP (x, 1))); - - /* If we were doing a LSHIFTRT in a wider mode than it was originally, - turn off all the bits that the shift would have turned off. */ - if (orig_code == LSHIFTRT && result_mode != shift_mode) - x = simplify_and_const_int (NULL_RTX, shift_mode, x, - GET_MODE_MASK (result_mode) >> orig_count); - - /* Do the remainder of the processing in RESULT_MODE. */ - x = gen_lowpart_for_combine (result_mode, x); - - /* If COMPLEMENT_P is set, we have to complement X before doing the outer - operation. */ - if (complement_p) - x = gen_unary (NOT, result_mode, result_mode, x); - - if (outer_op != NIL) - { - if (GET_MODE_BITSIZE (result_mode) < HOST_BITS_PER_WIDE_INT) - { - int width = GET_MODE_BITSIZE (result_mode); - - outer_const &= GET_MODE_MASK (result_mode); - - /* If this would be an entire word for the target, but is not for - the host, then sign-extend on the host so that the number will - look the same way on the host that it would on the target. - - For example, when building a 64 bit alpha hosted 32 bit sparc - targeted compiler, then we want the 32 bit unsigned value -1 to be - represented as a 64 bit value -1, and not as 0x00000000ffffffff. - The later confuses the sparc backend. */ - - if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT && BITS_PER_WORD == width - && (outer_const & ((HOST_WIDE_INT) 1 << (width - 1)))) - outer_const |= ((HOST_WIDE_INT) (-1) << width); - } - - if (outer_op == AND) - x = simplify_and_const_int (NULL_RTX, result_mode, x, outer_const); - else if (outer_op == SET) - /* This means that we have determined that the result is - equivalent to a constant. This should be rare. */ - x = GEN_INT (outer_const); - else if (GET_RTX_CLASS (outer_op) == '1') - x = gen_unary (outer_op, result_mode, result_mode, x); - else - x = gen_binary (outer_op, result_mode, x, GEN_INT (outer_const)); - } - - return x; -} - -/* Like recog, but we receive the address of a pointer to a new pattern. - We try to match the rtx that the pointer points to. - If that fails, we may try to modify or replace the pattern, - storing the replacement into the same pointer object. - - Modifications include deletion or addition of CLOBBERs. - - PNOTES is a pointer to a location where any REG_UNUSED notes added for - the CLOBBERs are placed. - - The value is the final insn code from the pattern ultimately matched, - or -1. */ - -static int -recog_for_combine (pnewpat, insn, pnotes) - rtx *pnewpat; - rtx insn; - rtx *pnotes; -{ - register rtx pat = *pnewpat; - int insn_code_number; - int num_clobbers_to_add = 0; - int i; - rtx notes = 0; - - /* If PAT is a PARALLEL, check to see if it contains the CLOBBER - we use to indicate that something didn't match. If we find such a - thing, force rejection. */ - if (GET_CODE (pat) == PARALLEL) - for (i = XVECLEN (pat, 0) - 1; i >= 0; i--) - if (GET_CODE (XVECEXP (pat, 0, i)) == CLOBBER - && XEXP (XVECEXP (pat, 0, i), 0) == const0_rtx) - return -1; - - /* Is the result of combination a valid instruction? */ - insn_code_number = recog (pat, insn, &num_clobbers_to_add); - - /* If it isn't, there is the possibility that we previously had an insn - that clobbered some register as a side effect, but the combined - insn doesn't need to do that. So try once more without the clobbers - unless this represents an ASM insn. */ - - if (insn_code_number < 0 && ! check_asm_operands (pat) - && GET_CODE (pat) == PARALLEL) - { - int pos; - - for (pos = 0, i = 0; i < XVECLEN (pat, 0); i++) - if (GET_CODE (XVECEXP (pat, 0, i)) != CLOBBER) - { - if (i != pos) - SUBST (XVECEXP (pat, 0, pos), XVECEXP (pat, 0, i)); - pos++; - } - - SUBST_INT (XVECLEN (pat, 0), pos); - - if (pos == 1) - pat = XVECEXP (pat, 0, 0); - - insn_code_number = recog (pat, insn, &num_clobbers_to_add); - } - - /* If we had any clobbers to add, make a new pattern than contains - them. Then check to make sure that all of them are dead. */ - if (num_clobbers_to_add) - { - rtx newpat = gen_rtx_PARALLEL (VOIDmode, - gen_rtvec (GET_CODE (pat) == PARALLEL - ? XVECLEN (pat, 0) + num_clobbers_to_add - : num_clobbers_to_add + 1)); - - if (GET_CODE (pat) == PARALLEL) - for (i = 0; i < XVECLEN (pat, 0); i++) - XVECEXP (newpat, 0, i) = XVECEXP (pat, 0, i); - else - XVECEXP (newpat, 0, 0) = pat; - - add_clobbers (newpat, insn_code_number); - - for (i = XVECLEN (newpat, 0) - num_clobbers_to_add; - i < XVECLEN (newpat, 0); i++) - { - if (GET_CODE (XEXP (XVECEXP (newpat, 0, i), 0)) == REG - && ! reg_dead_at_p (XEXP (XVECEXP (newpat, 0, i), 0), insn)) - return -1; - notes = gen_rtx_EXPR_LIST (REG_UNUSED, - XEXP (XVECEXP (newpat, 0, i), 0), notes); - } - pat = newpat; - } - - *pnewpat = pat; - *pnotes = notes; - - return insn_code_number; -} - -/* Like gen_lowpart but for use by combine. In combine it is not possible - to create any new pseudoregs. However, it is safe to create - invalid memory addresses, because combine will try to recognize - them and all they will do is make the combine attempt fail. - - If for some reason this cannot do its job, an rtx - (clobber (const_int 0)) is returned. - An insn containing that will not be recognized. */ - -#undef gen_lowpart - -static rtx -gen_lowpart_for_combine (mode, x) - enum machine_mode mode; - register rtx x; -{ - rtx result; - - if (GET_MODE (x) == mode) - return x; - - /* We can only support MODE being wider than a word if X is a - constant integer or has a mode the same size. */ - - if (GET_MODE_SIZE (mode) > UNITS_PER_WORD - && ! ((GET_MODE (x) == VOIDmode - && (GET_CODE (x) == CONST_INT - || GET_CODE (x) == CONST_DOUBLE)) - || GET_MODE_SIZE (GET_MODE (x)) == GET_MODE_SIZE (mode))) - return gen_rtx_CLOBBER (GET_MODE (x), const0_rtx); - - /* X might be a paradoxical (subreg (mem)). In that case, gen_lowpart - won't know what to do. So we will strip off the SUBREG here and - process normally. */ - if (GET_CODE (x) == SUBREG && GET_CODE (SUBREG_REG (x)) == MEM) - { - x = SUBREG_REG (x); - if (GET_MODE (x) == mode) - return x; - } - - result = gen_lowpart_common (mode, x); - if (result != 0 - && GET_CODE (result) == SUBREG - && GET_CODE (SUBREG_REG (result)) == REG - && REGNO (SUBREG_REG (result)) >= FIRST_PSEUDO_REGISTER - && (GET_MODE_SIZE (GET_MODE (result)) - != GET_MODE_SIZE (GET_MODE (SUBREG_REG (result))))) - REG_CHANGES_SIZE (REGNO (SUBREG_REG (result))) = 1; - - if (result) - return result; - - if (GET_CODE (x) == MEM) - { - register int offset = 0; - rtx new; - - /* Refuse to work on a volatile memory ref or one with a mode-dependent - address. */ - if (MEM_VOLATILE_P (x) || mode_dependent_address_p (XEXP (x, 0))) - return gen_rtx_CLOBBER (GET_MODE (x), const0_rtx); - - /* If we want to refer to something bigger than the original memref, - generate a perverse subreg instead. That will force a reload - of the original memref X. */ - if (GET_MODE_SIZE (GET_MODE (x)) < GET_MODE_SIZE (mode)) - return gen_rtx_SUBREG (mode, x, 0); - - if (WORDS_BIG_ENDIAN) - offset = (MAX (GET_MODE_SIZE (GET_MODE (x)), UNITS_PER_WORD) - - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD)); - if (BYTES_BIG_ENDIAN) - { - /* Adjust the address so that the address-after-the-data is - unchanged. */ - offset -= (MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode)) - - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x)))); - } - new = gen_rtx_MEM (mode, plus_constant (XEXP (x, 0), offset)); - RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (x); - MEM_COPY_ATTRIBUTES (new, x); - return new; - } - - /* If X is a comparison operator, rewrite it in a new mode. This - probably won't match, but may allow further simplifications. */ - else if (GET_RTX_CLASS (GET_CODE (x)) == '<') - return gen_rtx_combine (GET_CODE (x), mode, XEXP (x, 0), XEXP (x, 1)); - - /* If we couldn't simplify X any other way, just enclose it in a - SUBREG. Normally, this SUBREG won't match, but some patterns may - include an explicit SUBREG or we may simplify it further in combine. */ - else - { - int word = 0; - - if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD) - word = ((GET_MODE_SIZE (GET_MODE (x)) - - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD)) - / UNITS_PER_WORD); - return gen_rtx_SUBREG (mode, x, word); - } -} - -/* Make an rtx expression. This is a subset of gen_rtx and only supports - expressions of 1, 2, or 3 operands, each of which are rtx expressions. - - If the identical expression was previously in the insn (in the undobuf), - it will be returned. Only if it is not found will a new expression - be made. */ - -/*VARARGS2*/ -static rtx -gen_rtx_combine VPROTO((enum rtx_code code, enum machine_mode mode, ...)) -{ -#ifndef ANSI_PROTOTYPES - enum rtx_code code; - enum machine_mode mode; -#endif - va_list p; - int n_args; - rtx args[3]; - int j; - char *fmt; - rtx rt; - struct undo *undo; - - VA_START (p, mode); - -#ifndef ANSI_PROTOTYPES - code = va_arg (p, enum rtx_code); - mode = va_arg (p, enum machine_mode); -#endif - - n_args = GET_RTX_LENGTH (code); - fmt = GET_RTX_FORMAT (code); - - if (n_args == 0 || n_args > 3) - abort (); - - /* Get each arg and verify that it is supposed to be an expression. */ - for (j = 0; j < n_args; j++) - { - if (*fmt++ != 'e') - abort (); - - args[j] = va_arg (p, rtx); - } - - /* See if this is in undobuf. Be sure we don't use objects that came - from another insn; this could produce circular rtl structures. */ - - for (undo = undobuf.undos; undo != undobuf.previous_undos; undo = undo->next) - if (!undo->is_int - && GET_CODE (undo->old_contents.r) == code - && GET_MODE (undo->old_contents.r) == mode) - { - for (j = 0; j < n_args; j++) - if (XEXP (undo->old_contents.r, j) != args[j]) - break; - - if (j == n_args) - return undo->old_contents.r; - } - - /* Otherwise make a new rtx. We know we have 1, 2, or 3 args. - Use rtx_alloc instead of gen_rtx because it's faster on RISC. */ - rt = rtx_alloc (code); - PUT_MODE (rt, mode); - XEXP (rt, 0) = args[0]; - if (n_args > 1) - { - XEXP (rt, 1) = args[1]; - if (n_args > 2) - XEXP (rt, 2) = args[2]; - } - return rt; -} - -/* These routines make binary and unary operations by first seeing if they - fold; if not, a new expression is allocated. */ - -static rtx -gen_binary (code, mode, op0, op1) - enum rtx_code code; - enum machine_mode mode; - rtx op0, op1; -{ - rtx result; - rtx tem; - - if (GET_RTX_CLASS (code) == 'c' - && (GET_CODE (op0) == CONST_INT - || (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT))) - tem = op0, op0 = op1, op1 = tem; - - if (GET_RTX_CLASS (code) == '<') - { - enum machine_mode op_mode = GET_MODE (op0); - - /* Strip the COMPARE from (REL_OP (compare X Y) 0) to get - just (REL_OP X Y). */ - if (GET_CODE (op0) == COMPARE && op1 == const0_rtx) - { - op1 = XEXP (op0, 1); - op0 = XEXP (op0, 0); - op_mode = GET_MODE (op0); - } - - if (op_mode == VOIDmode) - op_mode = GET_MODE (op1); - result = simplify_relational_operation (code, op_mode, op0, op1); - } - else - result = simplify_binary_operation (code, mode, op0, op1); - - if (result) - return result; - - /* Put complex operands first and constants second. */ - if (GET_RTX_CLASS (code) == 'c' - && ((CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT) - || (GET_RTX_CLASS (GET_CODE (op0)) == 'o' - && GET_RTX_CLASS (GET_CODE (op1)) != 'o') - || (GET_CODE (op0) == SUBREG - && GET_RTX_CLASS (GET_CODE (SUBREG_REG (op0))) == 'o' - && GET_RTX_CLASS (GET_CODE (op1)) != 'o'))) - return gen_rtx_combine (code, mode, op1, op0); - - /* If we are turning off bits already known off in OP0, we need not do - an AND. */ - else if (code == AND && GET_CODE (op1) == CONST_INT - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (op0, mode) & ~ INTVAL (op1)) == 0) - return op0; - - return gen_rtx_combine (code, mode, op0, op1); -} - -static rtx -gen_unary (code, mode, op0_mode, op0) - enum rtx_code code; - enum machine_mode mode, op0_mode; - rtx op0; -{ - rtx result = simplify_unary_operation (code, mode, op0, op0_mode); - - if (result) - return result; - - return gen_rtx_combine (code, mode, op0); -} - -/* Simplify a comparison between *POP0 and *POP1 where CODE is the - comparison code that will be tested. - - The result is a possibly different comparison code to use. *POP0 and - *POP1 may be updated. - - It is possible that we might detect that a comparison is either always - true or always false. However, we do not perform general constant - folding in combine, so this knowledge isn't useful. Such tautologies - should have been detected earlier. Hence we ignore all such cases. */ - -static enum rtx_code -simplify_comparison (code, pop0, pop1) - enum rtx_code code; - rtx *pop0; - rtx *pop1; -{ - rtx op0 = *pop0; - rtx op1 = *pop1; - rtx tem, tem1; - int i; - enum machine_mode mode, tmode; - - /* Try a few ways of applying the same transformation to both operands. */ - while (1) - { -#ifndef WORD_REGISTER_OPERATIONS - /* The test below this one won't handle SIGN_EXTENDs on these machines, - so check specially. */ - if (code != GTU && code != GEU && code != LTU && code != LEU - && GET_CODE (op0) == ASHIFTRT && GET_CODE (op1) == ASHIFTRT - && GET_CODE (XEXP (op0, 0)) == ASHIFT - && GET_CODE (XEXP (op1, 0)) == ASHIFT - && GET_CODE (XEXP (XEXP (op0, 0), 0)) == SUBREG - && GET_CODE (XEXP (XEXP (op1, 0), 0)) == SUBREG - && (GET_MODE (SUBREG_REG (XEXP (XEXP (op0, 0), 0))) - == GET_MODE (SUBREG_REG (XEXP (XEXP (op1, 0), 0)))) - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && GET_CODE (XEXP (op1, 1)) == CONST_INT - && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT - && GET_CODE (XEXP (XEXP (op1, 0), 1)) == CONST_INT - && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (op1, 1)) - && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (XEXP (op0, 0), 1)) - && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (XEXP (op1, 0), 1)) - && (INTVAL (XEXP (op0, 1)) - == (GET_MODE_BITSIZE (GET_MODE (op0)) - - (GET_MODE_BITSIZE - (GET_MODE (SUBREG_REG (XEXP (XEXP (op0, 0), 0)))))))) - { - op0 = SUBREG_REG (XEXP (XEXP (op0, 0), 0)); - op1 = SUBREG_REG (XEXP (XEXP (op1, 0), 0)); - } -#endif - - /* If both operands are the same constant shift, see if we can ignore the - shift. We can if the shift is a rotate or if the bits shifted out of - this shift are known to be zero for both inputs and if the type of - comparison is compatible with the shift. */ - if (GET_CODE (op0) == GET_CODE (op1) - && GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT - && ((GET_CODE (op0) == ROTATE && (code == NE || code == EQ)) - || ((GET_CODE (op0) == LSHIFTRT || GET_CODE (op0) == ASHIFT) - && (code != GT && code != LT && code != GE && code != LE)) - || (GET_CODE (op0) == ASHIFTRT - && (code != GTU && code != LTU - && code != GEU && code != GEU))) - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && INTVAL (XEXP (op0, 1)) >= 0 - && INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT - && XEXP (op0, 1) == XEXP (op1, 1)) - { - enum machine_mode mode = GET_MODE (op0); - unsigned HOST_WIDE_INT mask = GET_MODE_MASK (mode); - int shift_count = INTVAL (XEXP (op0, 1)); - - if (GET_CODE (op0) == LSHIFTRT || GET_CODE (op0) == ASHIFTRT) - mask &= (mask >> shift_count) << shift_count; - else if (GET_CODE (op0) == ASHIFT) - mask = (mask & (mask << shift_count)) >> shift_count; - - if ((nonzero_bits (XEXP (op0, 0), mode) & ~ mask) == 0 - && (nonzero_bits (XEXP (op1, 0), mode) & ~ mask) == 0) - op0 = XEXP (op0, 0), op1 = XEXP (op1, 0); - else - break; - } - - /* If both operands are AND's of a paradoxical SUBREG by constant, the - SUBREGs are of the same mode, and, in both cases, the AND would - be redundant if the comparison was done in the narrower mode, - do the comparison in the narrower mode (e.g., we are AND'ing with 1 - and the operand's possibly nonzero bits are 0xffffff01; in that case - if we only care about QImode, we don't need the AND). This case - occurs if the output mode of an scc insn is not SImode and - STORE_FLAG_VALUE == 1 (e.g., the 386). - - Similarly, check for a case where the AND's are ZERO_EXTEND - operations from some narrower mode even though a SUBREG is not - present. */ - - else if (GET_CODE (op0) == AND && GET_CODE (op1) == AND - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && GET_CODE (XEXP (op1, 1)) == CONST_INT) - { - rtx inner_op0 = XEXP (op0, 0); - rtx inner_op1 = XEXP (op1, 0); - HOST_WIDE_INT c0 = INTVAL (XEXP (op0, 1)); - HOST_WIDE_INT c1 = INTVAL (XEXP (op1, 1)); - int changed = 0; - - if (GET_CODE (inner_op0) == SUBREG && GET_CODE (inner_op1) == SUBREG - && (GET_MODE_SIZE (GET_MODE (inner_op0)) - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (inner_op0)))) - && (GET_MODE (SUBREG_REG (inner_op0)) - == GET_MODE (SUBREG_REG (inner_op1))) - && (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (inner_op0))) - <= HOST_BITS_PER_WIDE_INT) - && (0 == ((~c0) & nonzero_bits (SUBREG_REG (inner_op0), - GET_MODE (SUBREG_REG (inner_op0))))) - && (0 == ((~c1) & nonzero_bits (SUBREG_REG (inner_op1), - GET_MODE (SUBREG_REG (inner_op1)))))) - { - op0 = SUBREG_REG (inner_op0); - op1 = SUBREG_REG (inner_op1); - - /* The resulting comparison is always unsigned since we masked - off the original sign bit. */ - code = unsigned_condition (code); - - changed = 1; - } - - else if (c0 == c1) - for (tmode = GET_CLASS_NARROWEST_MODE - (GET_MODE_CLASS (GET_MODE (op0))); - tmode != GET_MODE (op0); tmode = GET_MODE_WIDER_MODE (tmode)) - if ((unsigned HOST_WIDE_INT) c0 == GET_MODE_MASK (tmode)) - { - op0 = gen_lowpart_for_combine (tmode, inner_op0); - op1 = gen_lowpart_for_combine (tmode, inner_op1); - code = unsigned_condition (code); - changed = 1; - break; - } - - if (! changed) - break; - } - - /* If both operands are NOT, we can strip off the outer operation - and adjust the comparison code for swapped operands; similarly for - NEG, except that this must be an equality comparison. */ - else if ((GET_CODE (op0) == NOT && GET_CODE (op1) == NOT) - || (GET_CODE (op0) == NEG && GET_CODE (op1) == NEG - && (code == EQ || code == NE))) - op0 = XEXP (op0, 0), op1 = XEXP (op1, 0), code = swap_condition (code); - - else - break; - } - - /* If the first operand is a constant, swap the operands and adjust the - comparison code appropriately, but don't do this if the second operand - is already a constant integer. */ - if (CONSTANT_P (op0) && GET_CODE (op1) != CONST_INT) - { - tem = op0, op0 = op1, op1 = tem; - code = swap_condition (code); - } - - /* We now enter a loop during which we will try to simplify the comparison. - For the most part, we only are concerned with comparisons with zero, - but some things may really be comparisons with zero but not start - out looking that way. */ - - while (GET_CODE (op1) == CONST_INT) - { - enum machine_mode mode = GET_MODE (op0); - int mode_width = GET_MODE_BITSIZE (mode); - unsigned HOST_WIDE_INT mask = GET_MODE_MASK (mode); - int equality_comparison_p; - int sign_bit_comparison_p; - int unsigned_comparison_p; - HOST_WIDE_INT const_op; - - /* We only want to handle integral modes. This catches VOIDmode, - CCmode, and the floating-point modes. An exception is that we - can handle VOIDmode if OP0 is a COMPARE or a comparison - operation. */ - - if (GET_MODE_CLASS (mode) != MODE_INT - && ! (mode == VOIDmode - && (GET_CODE (op0) == COMPARE - || GET_RTX_CLASS (GET_CODE (op0)) == '<'))) - break; - - /* Get the constant we are comparing against and turn off all bits - not on in our mode. */ - const_op = INTVAL (op1); - if (mode_width <= HOST_BITS_PER_WIDE_INT) - const_op &= mask; - - /* If we are comparing against a constant power of two and the value - being compared can only have that single bit nonzero (e.g., it was - `and'ed with that bit), we can replace this with a comparison - with zero. */ - if (const_op - && (code == EQ || code == NE || code == GE || code == GEU - || code == LT || code == LTU) - && mode_width <= HOST_BITS_PER_WIDE_INT - && exact_log2 (const_op) >= 0 - && nonzero_bits (op0, mode) == (unsigned HOST_WIDE_INT) const_op) - { - code = (code == EQ || code == GE || code == GEU ? NE : EQ); - op1 = const0_rtx, const_op = 0; - } - - /* Similarly, if we are comparing a value known to be either -1 or - 0 with -1, change it to the opposite comparison against zero. */ - - if (const_op == -1 - && (code == EQ || code == NE || code == GT || code == LE - || code == GEU || code == LTU) - && num_sign_bit_copies (op0, mode) == mode_width) - { - code = (code == EQ || code == LE || code == GEU ? NE : EQ); - op1 = const0_rtx, const_op = 0; - } - - /* Do some canonicalizations based on the comparison code. We prefer - comparisons against zero and then prefer equality comparisons. - If we can reduce the size of a constant, we will do that too. */ - - switch (code) - { - case LT: - /* < C is equivalent to <= (C - 1) */ - if (const_op > 0) - { - const_op -= 1; - op1 = GEN_INT (const_op); - code = LE; - /* ... fall through to LE case below. */ - } - else - break; - - case LE: - /* <= C is equivalent to < (C + 1); we do this for C < 0 */ - if (const_op < 0) - { - const_op += 1; - op1 = GEN_INT (const_op); - code = LT; - } - - /* If we are doing a <= 0 comparison on a value known to have - a zero sign bit, we can replace this with == 0. */ - else if (const_op == 0 - && mode_width <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (op0, mode) - & ((HOST_WIDE_INT) 1 << (mode_width - 1))) == 0) - code = EQ; - break; - - case GE: - /* >= C is equivalent to > (C - 1). */ - if (const_op > 0) - { - const_op -= 1; - op1 = GEN_INT (const_op); - code = GT; - /* ... fall through to GT below. */ - } - else - break; - - case GT: - /* > C is equivalent to >= (C + 1); we do this for C < 0*/ - if (const_op < 0) - { - const_op += 1; - op1 = GEN_INT (const_op); - code = GE; - } - - /* If we are doing a > 0 comparison on a value known to have - a zero sign bit, we can replace this with != 0. */ - else if (const_op == 0 - && mode_width <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (op0, mode) - & ((HOST_WIDE_INT) 1 << (mode_width - 1))) == 0) - code = NE; - break; - - case LTU: - /* < C is equivalent to <= (C - 1). */ - if (const_op > 0) - { - const_op -= 1; - op1 = GEN_INT (const_op); - code = LEU; - /* ... fall through ... */ - } - - /* (unsigned) < 0x80000000 is equivalent to >= 0. */ - else if ((mode_width <= HOST_BITS_PER_WIDE_INT) - && (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1))) - { - const_op = 0, op1 = const0_rtx; - code = GE; - break; - } - else - break; - - case LEU: - /* unsigned <= 0 is equivalent to == 0 */ - if (const_op == 0) - code = EQ; - - /* (unsigned) <= 0x7fffffff is equivalent to >= 0. */ - else if ((mode_width <= HOST_BITS_PER_WIDE_INT) - && (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1)) - { - const_op = 0, op1 = const0_rtx; - code = GE; - } - break; - - case GEU: - /* >= C is equivalent to < (C - 1). */ - if (const_op > 1) - { - const_op -= 1; - op1 = GEN_INT (const_op); - code = GTU; - /* ... fall through ... */ - } - - /* (unsigned) >= 0x80000000 is equivalent to < 0. */ - else if ((mode_width <= HOST_BITS_PER_WIDE_INT) - && (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1))) - { - const_op = 0, op1 = const0_rtx; - code = LT; - break; - } - else - break; - - case GTU: - /* unsigned > 0 is equivalent to != 0 */ - if (const_op == 0) - code = NE; - - /* (unsigned) > 0x7fffffff is equivalent to < 0. */ - else if ((mode_width <= HOST_BITS_PER_WIDE_INT) - && (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1)) - { - const_op = 0, op1 = const0_rtx; - code = LT; - } - break; - - default: - break; - } - - /* Compute some predicates to simplify code below. */ - - equality_comparison_p = (code == EQ || code == NE); - sign_bit_comparison_p = ((code == LT || code == GE) && const_op == 0); - unsigned_comparison_p = (code == LTU || code == LEU || code == GTU - || code == LEU); - - /* If this is a sign bit comparison and we can do arithmetic in - MODE, say that we will only be needing the sign bit of OP0. */ - if (sign_bit_comparison_p - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT) - op0 = force_to_mode (op0, mode, - ((HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (mode) - 1)), - NULL_RTX, 0); - - /* Now try cases based on the opcode of OP0. If none of the cases - does a "continue", we exit this loop immediately after the - switch. */ - - switch (GET_CODE (op0)) - { - case ZERO_EXTRACT: - /* If we are extracting a single bit from a variable position in - a constant that has only a single bit set and are comparing it - with zero, we can convert this into an equality comparison - between the position and the location of the single bit. */ - - if (GET_CODE (XEXP (op0, 0)) == CONST_INT - && XEXP (op0, 1) == const1_rtx - && equality_comparison_p && const_op == 0 - && (i = exact_log2 (INTVAL (XEXP (op0, 0)))) >= 0) - { - if (BITS_BIG_ENDIAN) - { -#ifdef HAVE_extzv - mode = insn_operand_mode[(int) CODE_FOR_extzv][1]; - if (mode == VOIDmode) - mode = word_mode; - i = (GET_MODE_BITSIZE (mode) - 1 - i); -#else - i = BITS_PER_WORD - 1 - i; -#endif - } - - op0 = XEXP (op0, 2); - op1 = GEN_INT (i); - const_op = i; - - /* Result is nonzero iff shift count is equal to I. */ - code = reverse_condition (code); - continue; - } - - /* ... fall through ... */ - - case SIGN_EXTRACT: - tem = expand_compound_operation (op0); - if (tem != op0) - { - op0 = tem; - continue; - } - break; - - case NOT: - /* If testing for equality, we can take the NOT of the constant. */ - if (equality_comparison_p - && (tem = simplify_unary_operation (NOT, mode, op1, mode)) != 0) - { - op0 = XEXP (op0, 0); - op1 = tem; - continue; - } - - /* If just looking at the sign bit, reverse the sense of the - comparison. */ - if (sign_bit_comparison_p) - { - op0 = XEXP (op0, 0); - code = (code == GE ? LT : GE); - continue; - } - break; - - case NEG: - /* If testing for equality, we can take the NEG of the constant. */ - if (equality_comparison_p - && (tem = simplify_unary_operation (NEG, mode, op1, mode)) != 0) - { - op0 = XEXP (op0, 0); - op1 = tem; - continue; - } - - /* The remaining cases only apply to comparisons with zero. */ - if (const_op != 0) - break; - - /* When X is ABS or is known positive, - (neg X) is < 0 if and only if X != 0. */ - - if (sign_bit_comparison_p - && (GET_CODE (XEXP (op0, 0)) == ABS - || (mode_width <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (XEXP (op0, 0), mode) - & ((HOST_WIDE_INT) 1 << (mode_width - 1))) == 0))) - { - op0 = XEXP (op0, 0); - code = (code == LT ? NE : EQ); - continue; - } - - /* If we have NEG of something whose two high-order bits are the - same, we know that "(-a) < 0" is equivalent to "a > 0". */ - if (num_sign_bit_copies (op0, mode) >= 2) - { - op0 = XEXP (op0, 0); - code = swap_condition (code); - continue; - } - break; - - case ROTATE: - /* If we are testing equality and our count is a constant, we - can perform the inverse operation on our RHS. */ - if (equality_comparison_p && GET_CODE (XEXP (op0, 1)) == CONST_INT - && (tem = simplify_binary_operation (ROTATERT, mode, - op1, XEXP (op0, 1))) != 0) - { - op0 = XEXP (op0, 0); - op1 = tem; - continue; - } - - /* If we are doing a < 0 or >= 0 comparison, it means we are testing - a particular bit. Convert it to an AND of a constant of that - bit. This will be converted into a ZERO_EXTRACT. */ - if (const_op == 0 && sign_bit_comparison_p - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && mode_width <= HOST_BITS_PER_WIDE_INT) - { - op0 = simplify_and_const_int (NULL_RTX, mode, XEXP (op0, 0), - ((HOST_WIDE_INT) 1 - << (mode_width - 1 - - INTVAL (XEXP (op0, 1))))); - code = (code == LT ? NE : EQ); - continue; - } - - /* ... fall through ... */ - - case ABS: - /* ABS is ignorable inside an equality comparison with zero. */ - if (const_op == 0 && equality_comparison_p) - { - op0 = XEXP (op0, 0); - continue; - } - break; - - - case SIGN_EXTEND: - /* Can simplify (compare (zero/sign_extend FOO) CONST) - to (compare FOO CONST) if CONST fits in FOO's mode and we - are either testing inequality or have an unsigned comparison - with ZERO_EXTEND or a signed comparison with SIGN_EXTEND. */ - if (! unsigned_comparison_p - && (GET_MODE_BITSIZE (GET_MODE (XEXP (op0, 0))) - <= HOST_BITS_PER_WIDE_INT) - && ((unsigned HOST_WIDE_INT) const_op - < (((unsigned HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (GET_MODE (XEXP (op0, 0))) - 1))))) - { - op0 = XEXP (op0, 0); - continue; - } - break; - - case SUBREG: - /* Check for the case where we are comparing A - C1 with C2, - both constants are smaller than 1/2 the maximum positive - value in MODE, and the comparison is equality or unsigned. - In that case, if A is either zero-extended to MODE or has - sufficient sign bits so that the high-order bit in MODE - is a copy of the sign in the inner mode, we can prove that it is - safe to do the operation in the wider mode. This simplifies - many range checks. */ - - if (mode_width <= HOST_BITS_PER_WIDE_INT - && subreg_lowpart_p (op0) - && GET_CODE (SUBREG_REG (op0)) == PLUS - && GET_CODE (XEXP (SUBREG_REG (op0), 1)) == CONST_INT - && INTVAL (XEXP (SUBREG_REG (op0), 1)) < 0 - && (- INTVAL (XEXP (SUBREG_REG (op0), 1)) - < (HOST_WIDE_INT)(GET_MODE_MASK (mode) / 2)) - && (unsigned HOST_WIDE_INT) const_op < GET_MODE_MASK (mode) / 2 - && (0 == (nonzero_bits (XEXP (SUBREG_REG (op0), 0), - GET_MODE (SUBREG_REG (op0))) - & ~ GET_MODE_MASK (mode)) - || (num_sign_bit_copies (XEXP (SUBREG_REG (op0), 0), - GET_MODE (SUBREG_REG (op0))) - > (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0))) - - GET_MODE_BITSIZE (mode))))) - { - op0 = SUBREG_REG (op0); - continue; - } - - /* If the inner mode is narrower and we are extracting the low part, - we can treat the SUBREG as if it were a ZERO_EXTEND. */ - if (subreg_lowpart_p (op0) - && GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0))) < mode_width) - /* Fall through */ ; - else - break; - - /* ... fall through ... */ - - case ZERO_EXTEND: - if ((unsigned_comparison_p || equality_comparison_p) - && (GET_MODE_BITSIZE (GET_MODE (XEXP (op0, 0))) - <= HOST_BITS_PER_WIDE_INT) - && ((unsigned HOST_WIDE_INT) const_op - < GET_MODE_MASK (GET_MODE (XEXP (op0, 0))))) - { - op0 = XEXP (op0, 0); - continue; - } - break; - - case PLUS: - /* (eq (plus X A) B) -> (eq X (minus B A)). We can only do - this for equality comparisons due to pathological cases involving - overflows. */ - if (equality_comparison_p - && 0 != (tem = simplify_binary_operation (MINUS, mode, - op1, XEXP (op0, 1)))) - { - op0 = XEXP (op0, 0); - op1 = tem; - continue; - } - - /* (plus (abs X) (const_int -1)) is < 0 if and only if X == 0. */ - if (const_op == 0 && XEXP (op0, 1) == constm1_rtx - && GET_CODE (XEXP (op0, 0)) == ABS && sign_bit_comparison_p) - { - op0 = XEXP (XEXP (op0, 0), 0); - code = (code == LT ? EQ : NE); - continue; - } - break; - - case MINUS: - /* (eq (minus A B) C) -> (eq A (plus B C)) or - (eq B (minus A C)), whichever simplifies. We can only do - this for equality comparisons due to pathological cases involving - overflows. */ - if (equality_comparison_p - && 0 != (tem = simplify_binary_operation (PLUS, mode, - XEXP (op0, 1), op1))) - { - op0 = XEXP (op0, 0); - op1 = tem; - continue; - } - - if (equality_comparison_p - && 0 != (tem = simplify_binary_operation (MINUS, mode, - XEXP (op0, 0), op1))) - { - op0 = XEXP (op0, 1); - op1 = tem; - continue; - } - - /* The sign bit of (minus (ashiftrt X C) X), where C is the number - of bits in X minus 1, is one iff X > 0. */ - if (sign_bit_comparison_p && GET_CODE (XEXP (op0, 0)) == ASHIFTRT - && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT - && INTVAL (XEXP (XEXP (op0, 0), 1)) == mode_width - 1 - && rtx_equal_p (XEXP (XEXP (op0, 0), 0), XEXP (op0, 1))) - { - op0 = XEXP (op0, 1); - code = (code == GE ? LE : GT); - continue; - } - break; - - case XOR: - /* (eq (xor A B) C) -> (eq A (xor B C)). This is a simplification - if C is zero or B is a constant. */ - if (equality_comparison_p - && 0 != (tem = simplify_binary_operation (XOR, mode, - XEXP (op0, 1), op1))) - { - op0 = XEXP (op0, 0); - op1 = tem; - continue; - } - break; - - case EQ: case NE: - case LT: case LTU: case LE: case LEU: - case GT: case GTU: case GE: case GEU: - /* We can't do anything if OP0 is a condition code value, rather - than an actual data value. */ - if (const_op != 0 -#ifdef HAVE_cc0 - || XEXP (op0, 0) == cc0_rtx -#endif - || GET_MODE_CLASS (GET_MODE (XEXP (op0, 0))) == MODE_CC) - break; - - /* Get the two operands being compared. */ - if (GET_CODE (XEXP (op0, 0)) == COMPARE) - tem = XEXP (XEXP (op0, 0), 0), tem1 = XEXP (XEXP (op0, 0), 1); - else - tem = XEXP (op0, 0), tem1 = XEXP (op0, 1); - - /* Check for the cases where we simply want the result of the - earlier test or the opposite of that result. */ - if (code == NE - || (code == EQ && reversible_comparison_p (op0)) - || (GET_MODE_BITSIZE (GET_MODE (op0)) <= HOST_BITS_PER_WIDE_INT - && GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT - && (STORE_FLAG_VALUE - & (((HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (GET_MODE (op0)) - 1)))) - && (code == LT - || (code == GE && reversible_comparison_p (op0))))) - { - code = (code == LT || code == NE - ? GET_CODE (op0) : reverse_condition (GET_CODE (op0))); - op0 = tem, op1 = tem1; - continue; - } - break; - - case IOR: - /* The sign bit of (ior (plus X (const_int -1)) X) is non-zero - iff X <= 0. */ - if (sign_bit_comparison_p && GET_CODE (XEXP (op0, 0)) == PLUS - && XEXP (XEXP (op0, 0), 1) == constm1_rtx - && rtx_equal_p (XEXP (XEXP (op0, 0), 0), XEXP (op0, 1))) - { - op0 = XEXP (op0, 1); - code = (code == GE ? GT : LE); - continue; - } - break; - - case AND: - /* Convert (and (xshift 1 X) Y) to (and (lshiftrt Y X) 1). This - will be converted to a ZERO_EXTRACT later. */ - if (const_op == 0 && equality_comparison_p - && GET_CODE (XEXP (op0, 0)) == ASHIFT - && XEXP (XEXP (op0, 0), 0) == const1_rtx) - { - op0 = simplify_and_const_int - (op0, mode, gen_rtx_combine (LSHIFTRT, mode, - XEXP (op0, 1), - XEXP (XEXP (op0, 0), 1)), - (HOST_WIDE_INT) 1); - continue; - } - - /* If we are comparing (and (lshiftrt X C1) C2) for equality with - zero and X is a comparison and C1 and C2 describe only bits set - in STORE_FLAG_VALUE, we can compare with X. */ - if (const_op == 0 && equality_comparison_p - && mode_width <= HOST_BITS_PER_WIDE_INT - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && GET_CODE (XEXP (op0, 0)) == LSHIFTRT - && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT - && INTVAL (XEXP (XEXP (op0, 0), 1)) >= 0 - && INTVAL (XEXP (XEXP (op0, 0), 1)) < HOST_BITS_PER_WIDE_INT) - { - mask = ((INTVAL (XEXP (op0, 1)) & GET_MODE_MASK (mode)) - << INTVAL (XEXP (XEXP (op0, 0), 1))); - if ((~ STORE_FLAG_VALUE & mask) == 0 - && (GET_RTX_CLASS (GET_CODE (XEXP (XEXP (op0, 0), 0))) == '<' - || ((tem = get_last_value (XEXP (XEXP (op0, 0), 0))) != 0 - && GET_RTX_CLASS (GET_CODE (tem)) == '<'))) - { - op0 = XEXP (XEXP (op0, 0), 0); - continue; - } - } - - /* If we are doing an equality comparison of an AND of a bit equal - to the sign bit, replace this with a LT or GE comparison of - the underlying value. */ - if (equality_comparison_p - && const_op == 0 - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && mode_width <= HOST_BITS_PER_WIDE_INT - && ((INTVAL (XEXP (op0, 1)) & GET_MODE_MASK (mode)) - == (unsigned HOST_WIDE_INT) 1 << (mode_width - 1))) - { - op0 = XEXP (op0, 0); - code = (code == EQ ? GE : LT); - continue; - } - - /* If this AND operation is really a ZERO_EXTEND from a narrower - mode, the constant fits within that mode, and this is either an - equality or unsigned comparison, try to do this comparison in - the narrower mode. */ - if ((equality_comparison_p || unsigned_comparison_p) - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && (i = exact_log2 ((INTVAL (XEXP (op0, 1)) - & GET_MODE_MASK (mode)) - + 1)) >= 0 - && const_op >> i == 0 - && (tmode = mode_for_size (i, MODE_INT, 1)) != BLKmode) - { - op0 = gen_lowpart_for_combine (tmode, XEXP (op0, 0)); - continue; - } - - /* If this is (and:M1 (subreg:M2 X 0) (const_int C1)) where C1 fits - in both M1 and M2 and the SUBREG is either paradoxical or - represents the low part, permute the SUBREG and the AND and - try again. */ - if (GET_CODE (XEXP (op0, 0)) == SUBREG - && ((mode_width - >= GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (XEXP (op0, 0))))) -#ifdef WORD_REGISTER_OPERATIONS - || subreg_lowpart_p (XEXP (op0, 0)) -#endif - ) -#ifndef WORD_REGISTER_OPERATIONS - /* It is unsafe to commute the AND into the SUBREG if the SUBREG - is paradoxical and WORD_REGISTER_OPERATIONS is not defined. - As originally written the upper bits have a defined value - due to the AND operation. However, if we commute the AND - inside the SUBREG then they no longer have defined values - and the meaning of the code has been changed. */ - && (GET_MODE_SIZE (GET_MODE (XEXP (op0, 0))) - <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (op0, 0))))) -#endif - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && mode_width <= HOST_BITS_PER_WIDE_INT - && (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (XEXP (op0, 0)))) - <= HOST_BITS_PER_WIDE_INT) - && (INTVAL (XEXP (op0, 1)) & ~ mask) == 0 - && 0 == (~ GET_MODE_MASK (GET_MODE (SUBREG_REG (XEXP (op0, 0)))) - & INTVAL (XEXP (op0, 1))) - && (unsigned HOST_WIDE_INT) INTVAL (XEXP (op0, 1)) != mask - && ((unsigned HOST_WIDE_INT) INTVAL (XEXP (op0, 1)) - != GET_MODE_MASK (GET_MODE (SUBREG_REG (XEXP (op0, 0)))))) - - { - op0 - = gen_lowpart_for_combine - (mode, - gen_binary (AND, GET_MODE (SUBREG_REG (XEXP (op0, 0))), - SUBREG_REG (XEXP (op0, 0)), XEXP (op0, 1))); - continue; - } - - break; - - case ASHIFT: - /* If we have (compare (ashift FOO N) (const_int C)) and - the high order N bits of FOO (N+1 if an inequality comparison) - are known to be zero, we can do this by comparing FOO with C - shifted right N bits so long as the low-order N bits of C are - zero. */ - if (GET_CODE (XEXP (op0, 1)) == CONST_INT - && INTVAL (XEXP (op0, 1)) >= 0 - && ((INTVAL (XEXP (op0, 1)) + ! equality_comparison_p) - < HOST_BITS_PER_WIDE_INT) - && ((const_op - & (((HOST_WIDE_INT) 1 << INTVAL (XEXP (op0, 1))) - 1)) == 0) - && mode_width <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (XEXP (op0, 0), mode) - & ~ (mask >> (INTVAL (XEXP (op0, 1)) - + ! equality_comparison_p))) == 0) - { - const_op >>= INTVAL (XEXP (op0, 1)); - op1 = GEN_INT (const_op); - op0 = XEXP (op0, 0); - continue; - } - - /* If we are doing a sign bit comparison, it means we are testing - a particular bit. Convert it to the appropriate AND. */ - if (sign_bit_comparison_p && GET_CODE (XEXP (op0, 1)) == CONST_INT - && mode_width <= HOST_BITS_PER_WIDE_INT) - { - op0 = simplify_and_const_int (NULL_RTX, mode, XEXP (op0, 0), - ((HOST_WIDE_INT) 1 - << (mode_width - 1 - - INTVAL (XEXP (op0, 1))))); - code = (code == LT ? NE : EQ); - continue; - } - - /* If this an equality comparison with zero and we are shifting - the low bit to the sign bit, we can convert this to an AND of the - low-order bit. */ - if (const_op == 0 && equality_comparison_p - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && INTVAL (XEXP (op0, 1)) == mode_width - 1) - { - op0 = simplify_and_const_int (NULL_RTX, mode, XEXP (op0, 0), - (HOST_WIDE_INT) 1); - continue; - } - break; - - case ASHIFTRT: - /* If this is an equality comparison with zero, we can do this - as a logical shift, which might be much simpler. */ - if (equality_comparison_p && const_op == 0 - && GET_CODE (XEXP (op0, 1)) == CONST_INT) - { - op0 = simplify_shift_const (NULL_RTX, LSHIFTRT, mode, - XEXP (op0, 0), - INTVAL (XEXP (op0, 1))); - continue; - } - - /* If OP0 is a sign extension and CODE is not an unsigned comparison, - do the comparison in a narrower mode. */ - if (! unsigned_comparison_p - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && GET_CODE (XEXP (op0, 0)) == ASHIFT - && XEXP (op0, 1) == XEXP (XEXP (op0, 0), 1) - && (tmode = mode_for_size (mode_width - INTVAL (XEXP (op0, 1)), - MODE_INT, 1)) != BLKmode - && ((unsigned HOST_WIDE_INT) const_op <= GET_MODE_MASK (tmode) - || ((unsigned HOST_WIDE_INT) - const_op - <= GET_MODE_MASK (tmode)))) - { - op0 = gen_lowpart_for_combine (tmode, XEXP (XEXP (op0, 0), 0)); - continue; - } - - /* ... fall through ... */ - case LSHIFTRT: - /* If we have (compare (xshiftrt FOO N) (const_int C)) and - the low order N bits of FOO are known to be zero, we can do this - by comparing FOO with C shifted left N bits so long as no - overflow occurs. */ - if (GET_CODE (XEXP (op0, 1)) == CONST_INT - && INTVAL (XEXP (op0, 1)) >= 0 - && INTVAL (XEXP (op0, 1)) < HOST_BITS_PER_WIDE_INT - && mode_width <= HOST_BITS_PER_WIDE_INT - && (nonzero_bits (XEXP (op0, 0), mode) - & (((HOST_WIDE_INT) 1 << INTVAL (XEXP (op0, 1))) - 1)) == 0 - && (const_op == 0 - || (floor_log2 (const_op) + INTVAL (XEXP (op0, 1)) - < mode_width))) - { - const_op <<= INTVAL (XEXP (op0, 1)); - op1 = GEN_INT (const_op); - op0 = XEXP (op0, 0); - continue; - } - - /* If we are using this shift to extract just the sign bit, we - can replace this with an LT or GE comparison. */ - if (const_op == 0 - && (equality_comparison_p || sign_bit_comparison_p) - && GET_CODE (XEXP (op0, 1)) == CONST_INT - && INTVAL (XEXP (op0, 1)) == mode_width - 1) - { - op0 = XEXP (op0, 0); - code = (code == NE || code == GT ? LT : GE); - continue; - } - break; - - default: - break; - } - - break; - } - - /* Now make any compound operations involved in this comparison. Then, - check for an outmost SUBREG on OP0 that is not doing anything or is - paradoxical. The latter case can only occur when it is known that the - "extra" bits will be zero. Therefore, it is safe to remove the SUBREG. - We can never remove a SUBREG for a non-equality comparison because the - sign bit is in a different place in the underlying object. */ - - op0 = make_compound_operation (op0, op1 == const0_rtx ? COMPARE : SET); - op1 = make_compound_operation (op1, SET); - - if (GET_CODE (op0) == SUBREG && subreg_lowpart_p (op0) - && GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT - && (code == NE || code == EQ) - && ((GET_MODE_SIZE (GET_MODE (op0)) - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0)))))) - { - op0 = SUBREG_REG (op0); - op1 = gen_lowpart_for_combine (GET_MODE (op0), op1); - } - - else if (GET_CODE (op0) == SUBREG && subreg_lowpart_p (op0) - && GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT - && (code == NE || code == EQ) - && (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0))) - <= HOST_BITS_PER_WIDE_INT) - && (nonzero_bits (SUBREG_REG (op0), GET_MODE (SUBREG_REG (op0))) - & ~ GET_MODE_MASK (GET_MODE (op0))) == 0 - && (tem = gen_lowpart_for_combine (GET_MODE (SUBREG_REG (op0)), - op1), - (nonzero_bits (tem, GET_MODE (SUBREG_REG (op0))) - & ~ GET_MODE_MASK (GET_MODE (op0))) == 0)) - op0 = SUBREG_REG (op0), op1 = tem; - - /* We now do the opposite procedure: Some machines don't have compare - insns in all modes. If OP0's mode is an integer mode smaller than a - word and we can't do a compare in that mode, see if there is a larger - mode for which we can do the compare. There are a number of cases in - which we can use the wider mode. */ - - mode = GET_MODE (op0); - if (mode != VOIDmode && GET_MODE_CLASS (mode) == MODE_INT - && GET_MODE_SIZE (mode) < UNITS_PER_WORD - && cmp_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing) - for (tmode = GET_MODE_WIDER_MODE (mode); - (tmode != VOIDmode - && GET_MODE_BITSIZE (tmode) <= HOST_BITS_PER_WIDE_INT); - tmode = GET_MODE_WIDER_MODE (tmode)) - if (cmp_optab->handlers[(int) tmode].insn_code != CODE_FOR_nothing) - { - /* If the only nonzero bits in OP0 and OP1 are those in the - narrower mode and this is an equality or unsigned comparison, - we can use the wider mode. Similarly for sign-extended - values, in which case it is true for all comparisons. */ - if (((code == EQ || code == NE - || code == GEU || code == GTU || code == LEU || code == LTU) - && (nonzero_bits (op0, tmode) & ~ GET_MODE_MASK (mode)) == 0 - && (nonzero_bits (op1, tmode) & ~ GET_MODE_MASK (mode)) == 0) - || ((num_sign_bit_copies (op0, tmode) - > GET_MODE_BITSIZE (tmode) - GET_MODE_BITSIZE (mode)) - && (num_sign_bit_copies (op1, tmode) - > GET_MODE_BITSIZE (tmode) - GET_MODE_BITSIZE (mode)))) - { - op0 = gen_lowpart_for_combine (tmode, op0); - op1 = gen_lowpart_for_combine (tmode, op1); - break; - } - - /* If this is a test for negative, we can make an explicit - test of the sign bit. */ - - if (op1 == const0_rtx && (code == LT || code == GE) - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT) - { - op0 = gen_binary (AND, tmode, - gen_lowpart_for_combine (tmode, op0), - GEN_INT ((HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (mode) - 1))); - code = (code == LT) ? NE : EQ; - break; - } - } - -#ifdef CANONICALIZE_COMPARISON - /* If this machine only supports a subset of valid comparisons, see if we - can convert an unsupported one into a supported one. */ - CANONICALIZE_COMPARISON (code, op0, op1); -#endif - - *pop0 = op0; - *pop1 = op1; - - return code; -} - -/* Return 1 if we know that X, a comparison operation, is not operating - on a floating-point value or is EQ or NE, meaning that we can safely - reverse it. */ - -static int -reversible_comparison_p (x) - rtx x; -{ - if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT - || flag_fast_math - || GET_CODE (x) == NE || GET_CODE (x) == EQ) - return 1; - - switch (GET_MODE_CLASS (GET_MODE (XEXP (x, 0)))) - { - case MODE_INT: - case MODE_PARTIAL_INT: - case MODE_COMPLEX_INT: - return 1; - - case MODE_CC: - /* If the mode of the condition codes tells us that this is safe, - we need look no further. */ - if (REVERSIBLE_CC_MODE (GET_MODE (XEXP (x, 0)))) - return 1; - - /* Otherwise try and find where the condition codes were last set and - use that. */ - x = get_last_value (XEXP (x, 0)); - return (x && GET_CODE (x) == COMPARE - && ! FLOAT_MODE_P (GET_MODE (XEXP (x, 0)))); - - default: - return 0; - } -} - -/* Utility function for following routine. Called when X is part of a value - being stored into reg_last_set_value. Sets reg_last_set_table_tick - for each register mentioned. Similar to mention_regs in cse.c */ - -static void -update_table_tick (x) - rtx x; -{ - register enum rtx_code code = GET_CODE (x); - register char *fmt = GET_RTX_FORMAT (code); - register int i; - - if (code == REG) - { - int regno = REGNO (x); - int endregno = regno + (regno < FIRST_PSEUDO_REGISTER - ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1); - - for (i = regno; i < endregno; i++) - reg_last_set_table_tick[i] = label_tick; - - return; - } - - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - /* Note that we can't have an "E" in values stored; see - get_last_value_validate. */ - if (fmt[i] == 'e') - update_table_tick (XEXP (x, i)); -} - -/* Record that REG is set to VALUE in insn INSN. If VALUE is zero, we - are saying that the register is clobbered and we no longer know its - value. If INSN is zero, don't update reg_last_set; this is only permitted - with VALUE also zero and is used to invalidate the register. */ - -static void -record_value_for_reg (reg, insn, value) - rtx reg; - rtx insn; - rtx value; -{ - int regno = REGNO (reg); - int endregno = regno + (regno < FIRST_PSEUDO_REGISTER - ? HARD_REGNO_NREGS (regno, GET_MODE (reg)) : 1); - int i; - - /* If VALUE contains REG and we have a previous value for REG, substitute - the previous value. */ - if (value && insn && reg_overlap_mentioned_p (reg, value)) - { - rtx tem; - - /* Set things up so get_last_value is allowed to see anything set up to - our insn. */ - subst_low_cuid = INSN_CUID (insn); - tem = get_last_value (reg); - - if (tem) - value = replace_rtx (copy_rtx (value), reg, tem); - } - - /* For each register modified, show we don't know its value, that - we don't know about its bitwise content, that its value has been - updated, and that we don't know the location of the death of the - register. */ - for (i = regno; i < endregno; i ++) - { - if (insn) - reg_last_set[i] = insn; - reg_last_set_value[i] = 0; - reg_last_set_mode[i] = 0; - reg_last_set_nonzero_bits[i] = 0; - reg_last_set_sign_bit_copies[i] = 0; - reg_last_death[i] = 0; - } - - /* Mark registers that are being referenced in this value. */ - if (value) - update_table_tick (value); - - /* Now update the status of each register being set. - If someone is using this register in this block, set this register - to invalid since we will get confused between the two lives in this - basic block. This makes using this register always invalid. In cse, we - scan the table to invalidate all entries using this register, but this - is too much work for us. */ - - for (i = regno; i < endregno; i++) - { - reg_last_set_label[i] = label_tick; - if (value && reg_last_set_table_tick[i] == label_tick) - reg_last_set_invalid[i] = 1; - else - reg_last_set_invalid[i] = 0; - } - - /* The value being assigned might refer to X (like in "x++;"). In that - case, we must replace it with (clobber (const_int 0)) to prevent - infinite loops. */ - if (value && ! get_last_value_validate (&value, insn, - reg_last_set_label[regno], 0)) - { - value = copy_rtx (value); - if (! get_last_value_validate (&value, insn, - reg_last_set_label[regno], 1)) - value = 0; - } - - /* For the main register being modified, update the value, the mode, the - nonzero bits, and the number of sign bit copies. */ - - reg_last_set_value[regno] = value; - - if (value) - { - subst_low_cuid = INSN_CUID (insn); - reg_last_set_mode[regno] = GET_MODE (reg); - reg_last_set_nonzero_bits[regno] = nonzero_bits (value, GET_MODE (reg)); - reg_last_set_sign_bit_copies[regno] - = num_sign_bit_copies (value, GET_MODE (reg)); - } -} - -/* Used for communication between the following two routines. */ -static rtx record_dead_insn; - -/* Called via note_stores from record_dead_and_set_regs to handle one - SET or CLOBBER in an insn. */ - -static void -record_dead_and_set_regs_1 (dest, setter) - rtx dest, setter; -{ - if (GET_CODE (dest) == SUBREG) - dest = SUBREG_REG (dest); - - if (GET_CODE (dest) == REG) - { - /* If we are setting the whole register, we know its value. Otherwise - show that we don't know the value. We can handle SUBREG in - some cases. */ - if (GET_CODE (setter) == SET && dest == SET_DEST (setter)) - record_value_for_reg (dest, record_dead_insn, SET_SRC (setter)); - else if (GET_CODE (setter) == SET - && GET_CODE (SET_DEST (setter)) == SUBREG - && SUBREG_REG (SET_DEST (setter)) == dest - && GET_MODE_BITSIZE (GET_MODE (dest)) <= BITS_PER_WORD - && subreg_lowpart_p (SET_DEST (setter))) - record_value_for_reg (dest, record_dead_insn, - gen_lowpart_for_combine (GET_MODE (dest), - SET_SRC (setter))); - else - record_value_for_reg (dest, record_dead_insn, NULL_RTX); - } - else if (GET_CODE (dest) == MEM - /* Ignore pushes, they clobber nothing. */ - && ! push_operand (dest, GET_MODE (dest))) - mem_last_set = INSN_CUID (record_dead_insn); -} - -/* Update the records of when each REG was most recently set or killed - for the things done by INSN. This is the last thing done in processing - INSN in the combiner loop. - - We update reg_last_set, reg_last_set_value, reg_last_set_mode, - reg_last_set_nonzero_bits, reg_last_set_sign_bit_copies, reg_last_death, - and also the similar information mem_last_set (which insn most recently - modified memory) and last_call_cuid (which insn was the most recent - subroutine call). */ - -static void -record_dead_and_set_regs (insn) - rtx insn; -{ - register rtx link; - int i; - - for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) - { - if (REG_NOTE_KIND (link) == REG_DEAD - && GET_CODE (XEXP (link, 0)) == REG) - { - int regno = REGNO (XEXP (link, 0)); - int endregno - = regno + (regno < FIRST_PSEUDO_REGISTER - ? HARD_REGNO_NREGS (regno, GET_MODE (XEXP (link, 0))) - : 1); - - for (i = regno; i < endregno; i++) - reg_last_death[i] = insn; - } - else if (REG_NOTE_KIND (link) == REG_INC) - record_value_for_reg (XEXP (link, 0), insn, NULL_RTX); - } - - if (GET_CODE (insn) == CALL_INSN) - { - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (call_used_regs[i]) - { - reg_last_set_value[i] = 0; - reg_last_set_mode[i] = 0; - reg_last_set_nonzero_bits[i] = 0; - reg_last_set_sign_bit_copies[i] = 0; - reg_last_death[i] = 0; - } - - last_call_cuid = mem_last_set = INSN_CUID (insn); - } - - record_dead_insn = insn; - note_stores (PATTERN (insn), record_dead_and_set_regs_1); -} - -/* Utility routine for the following function. Verify that all the registers - mentioned in *LOC are valid when *LOC was part of a value set when - label_tick == TICK. Return 0 if some are not. - - If REPLACE is non-zero, replace the invalid reference with - (clobber (const_int 0)) and return 1. This replacement is useful because - we often can get useful information about the form of a value (e.g., if - it was produced by a shift that always produces -1 or 0) even though - we don't know exactly what registers it was produced from. */ - -static int -get_last_value_validate (loc, insn, tick, replace) - rtx *loc; - rtx insn; - int tick; - int replace; -{ - rtx x = *loc; - char *fmt = GET_RTX_FORMAT (GET_CODE (x)); - int len = GET_RTX_LENGTH (GET_CODE (x)); - int i; - - if (GET_CODE (x) == REG) - { - int regno = REGNO (x); - int endregno = regno + (regno < FIRST_PSEUDO_REGISTER - ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1); - int j; - - for (j = regno; j < endregno; j++) - if (reg_last_set_invalid[j] - /* If this is a pseudo-register that was only set once, it is - always valid. */ - || (! (regno >= FIRST_PSEUDO_REGISTER && REG_N_SETS (regno) == 1) - && reg_last_set_label[j] > tick)) - { - if (replace) - *loc = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx); - return replace; - } - - return 1; - } - /* If this is a memory reference, make sure that there were - no stores after it that might have clobbered the value. We don't - have alias info, so we assume any store invalidates it. */ - else if (GET_CODE (x) == MEM && ! RTX_UNCHANGING_P (x) - && INSN_CUID (insn) <= mem_last_set) - { - if (replace) - *loc = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx); - return replace; - } - - for (i = 0; i < len; i++) - if ((fmt[i] == 'e' - && get_last_value_validate (&XEXP (x, i), insn, tick, replace) == 0) - /* Don't bother with these. They shouldn't occur anyway. */ - || fmt[i] == 'E') - return 0; - - /* If we haven't found a reason for it to be invalid, it is valid. */ - return 1; -} - -/* Get the last value assigned to X, if known. Some registers - in the value may be replaced with (clobber (const_int 0)) if their value - is known longer known reliably. */ - -static rtx -get_last_value (x) - rtx x; -{ - int regno; - rtx value; - - /* If this is a non-paradoxical SUBREG, get the value of its operand and - then convert it to the desired mode. If this is a paradoxical SUBREG, - we cannot predict what values the "extra" bits might have. */ - if (GET_CODE (x) == SUBREG - && subreg_lowpart_p (x) - && (GET_MODE_SIZE (GET_MODE (x)) - <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) - && (value = get_last_value (SUBREG_REG (x))) != 0) - return gen_lowpart_for_combine (GET_MODE (x), value); - - if (GET_CODE (x) != REG) - return 0; - - regno = REGNO (x); - value = reg_last_set_value[regno]; - - /* If we don't have a value or if it isn't for this basic block, - return 0. */ - - if (value == 0 - || (REG_N_SETS (regno) != 1 - && reg_last_set_label[regno] != label_tick)) - return 0; - - /* If the value was set in a later insn than the ones we are processing, - we can't use it even if the register was only set once. */ - if (INSN_CUID (reg_last_set[regno]) >= subst_low_cuid) - return 0; - - /* If the value has all its registers valid, return it. */ - if (get_last_value_validate (&value, reg_last_set[regno], - reg_last_set_label[regno], 0)) - return value; - - /* Otherwise, make a copy and replace any invalid register with - (clobber (const_int 0)). If that fails for some reason, return 0. */ - - value = copy_rtx (value); - if (get_last_value_validate (&value, reg_last_set[regno], - reg_last_set_label[regno], 1)) - return value; - - return 0; -} - -/* Return nonzero if expression X refers to a REG or to memory - that is set in an instruction more recent than FROM_CUID. */ - -static int -use_crosses_set_p (x, from_cuid) - register rtx x; - int from_cuid; -{ - register char *fmt; - register int i; - register enum rtx_code code = GET_CODE (x); - - if (code == REG) - { - register int regno = REGNO (x); - int endreg = regno + (regno < FIRST_PSEUDO_REGISTER - ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1); - -#ifdef PUSH_ROUNDING - /* Don't allow uses of the stack pointer to be moved, - because we don't know whether the move crosses a push insn. */ - if (regno == STACK_POINTER_REGNUM) - return 1; -#endif - for (;regno < endreg; regno++) - if (reg_last_set[regno] - && INSN_CUID (reg_last_set[regno]) > from_cuid) - return 1; - return 0; - } - - if (code == MEM && mem_last_set > from_cuid) - return 1; - - fmt = GET_RTX_FORMAT (code); - - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - { - if (fmt[i] == 'E') - { - register int j; - for (j = XVECLEN (x, i) - 1; j >= 0; j--) - if (use_crosses_set_p (XVECEXP (x, i, j), from_cuid)) - return 1; - } - else if (fmt[i] == 'e' - && use_crosses_set_p (XEXP (x, i), from_cuid)) - return 1; - } - return 0; -} - -/* Define three variables used for communication between the following - routines. */ - -static int reg_dead_regno, reg_dead_endregno; -static int reg_dead_flag; - -/* Function called via note_stores from reg_dead_at_p. - - If DEST is within [reg_dead_regno, reg_dead_endregno), set - reg_dead_flag to 1 if X is a CLOBBER and to -1 it is a SET. */ - -static void -reg_dead_at_p_1 (dest, x) - rtx dest; - rtx x; -{ - int regno, endregno; - - if (GET_CODE (dest) != REG) - return; - - regno = REGNO (dest); - endregno = regno + (regno < FIRST_PSEUDO_REGISTER - ? HARD_REGNO_NREGS (regno, GET_MODE (dest)) : 1); - - if (reg_dead_endregno > regno && reg_dead_regno < endregno) - reg_dead_flag = (GET_CODE (x) == CLOBBER) ? 1 : -1; -} - -/* Return non-zero if REG is known to be dead at INSN. - - We scan backwards from INSN. If we hit a REG_DEAD note or a CLOBBER - referencing REG, it is dead. If we hit a SET referencing REG, it is - live. Otherwise, see if it is live or dead at the start of the basic - block we are in. Hard regs marked as being live in NEWPAT_USED_REGS - must be assumed to be always live. */ - -static int -reg_dead_at_p (reg, insn) - rtx reg; - rtx insn; -{ - int block, i; - - /* Set variables for reg_dead_at_p_1. */ - reg_dead_regno = REGNO (reg); - reg_dead_endregno = reg_dead_regno + (reg_dead_regno < FIRST_PSEUDO_REGISTER - ? HARD_REGNO_NREGS (reg_dead_regno, - GET_MODE (reg)) - : 1); - - reg_dead_flag = 0; - - /* Check that reg isn't mentioned in NEWPAT_USED_REGS. */ - if (reg_dead_regno < FIRST_PSEUDO_REGISTER) - { - for (i = reg_dead_regno; i < reg_dead_endregno; i++) - if (TEST_HARD_REG_BIT (newpat_used_regs, i)) - return 0; - } - - /* Scan backwards until we find a REG_DEAD note, SET, CLOBBER, label, or - beginning of function. */ - for (; insn && GET_CODE (insn) != CODE_LABEL && GET_CODE (insn) != BARRIER; - insn = prev_nonnote_insn (insn)) - { - note_stores (PATTERN (insn), reg_dead_at_p_1); - if (reg_dead_flag) - return reg_dead_flag == 1 ? 1 : 0; - - if (find_regno_note (insn, REG_DEAD, reg_dead_regno)) - return 1; - } - - /* Get the basic block number that we were in. */ - if (insn == 0) - block = 0; - else - { - for (block = 0; block < n_basic_blocks; block++) - if (insn == BLOCK_HEAD (block)) - break; - - if (block == n_basic_blocks) - return 0; - } - - for (i = reg_dead_regno; i < reg_dead_endregno; i++) - if (REGNO_REG_SET_P (BASIC_BLOCK (block)->global_live_at_start, i)) - return 0; - - return 1; -} - -/* Note hard registers in X that are used. This code is similar to - that in flow.c, but much simpler since we don't care about pseudos. */ - -static void -mark_used_regs_combine (x) - rtx x; -{ - register RTX_CODE code = GET_CODE (x); - register int regno; - int i; - - switch (code) - { - case LABEL_REF: - case SYMBOL_REF: - case CONST_INT: - case CONST: - case CONST_DOUBLE: - case PC: - case ADDR_VEC: - case ADDR_DIFF_VEC: - case ASM_INPUT: -#ifdef HAVE_cc0 - /* CC0 must die in the insn after it is set, so we don't need to take - special note of it here. */ - case CC0: -#endif - return; - - case CLOBBER: - /* If we are clobbering a MEM, mark any hard registers inside the - address as used. */ - if (GET_CODE (XEXP (x, 0)) == MEM) - mark_used_regs_combine (XEXP (XEXP (x, 0), 0)); - return; - - case REG: - regno = REGNO (x); - /* A hard reg in a wide mode may really be multiple registers. - If so, mark all of them just like the first. */ - if (regno < FIRST_PSEUDO_REGISTER) - { - /* None of this applies to the stack, frame or arg pointers */ - if (regno == STACK_POINTER_REGNUM -#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM - || regno == HARD_FRAME_POINTER_REGNUM -#endif -#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM - || (regno == ARG_POINTER_REGNUM && fixed_regs[regno]) -#endif - || regno == FRAME_POINTER_REGNUM) - return; - - i = HARD_REGNO_NREGS (regno, GET_MODE (x)); - while (i-- > 0) - SET_HARD_REG_BIT (newpat_used_regs, regno + i); - } - return; - - case SET: - { - /* If setting a MEM, or a SUBREG of a MEM, then note any hard regs in - the address. */ - register rtx testreg = SET_DEST (x); - - while (GET_CODE (testreg) == SUBREG - || GET_CODE (testreg) == ZERO_EXTRACT - || GET_CODE (testreg) == SIGN_EXTRACT - || GET_CODE (testreg) == STRICT_LOW_PART) - testreg = XEXP (testreg, 0); - - if (GET_CODE (testreg) == MEM) - mark_used_regs_combine (XEXP (testreg, 0)); - - mark_used_regs_combine (SET_SRC (x)); - } - return; - - default: - break; - } - - /* Recursively scan the operands of this expression. */ - - { - register char *fmt = GET_RTX_FORMAT (code); - - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - { - if (fmt[i] == 'e') - mark_used_regs_combine (XEXP (x, i)); - else if (fmt[i] == 'E') - { - register int j; - - for (j = 0; j < XVECLEN (x, i); j++) - mark_used_regs_combine (XVECEXP (x, i, j)); - } - } - } -} - - -/* Remove register number REGNO from the dead registers list of INSN. - - Return the note used to record the death, if there was one. */ - -rtx -remove_death (regno, insn) - int regno; - rtx insn; -{ - register rtx note = find_regno_note (insn, REG_DEAD, regno); - - if (note) - { - REG_N_DEATHS (regno)--; - remove_note (insn, note); - } - - return note; -} - -/* For each register (hardware or pseudo) used within expression X, if its - death is in an instruction with cuid between FROM_CUID (inclusive) and - TO_INSN (exclusive), put a REG_DEAD note for that register in the - list headed by PNOTES. - - That said, don't move registers killed by maybe_kill_insn. - - This is done when X is being merged by combination into TO_INSN. These - notes will then be distributed as needed. */ - -static void -move_deaths (x, maybe_kill_insn, from_cuid, to_insn, pnotes) - rtx x; - rtx maybe_kill_insn; - int from_cuid; - rtx to_insn; - rtx *pnotes; -{ - register char *fmt; - register int len, i; - register enum rtx_code code = GET_CODE (x); - - if (code == REG) - { - register int regno = REGNO (x); - register rtx where_dead = reg_last_death[regno]; - register rtx before_dead, after_dead; - - /* Don't move the register if it gets killed in between from and to */ - if (maybe_kill_insn && reg_set_p (x, maybe_kill_insn) - && !reg_referenced_p (x, maybe_kill_insn)) - return; - - /* WHERE_DEAD could be a USE insn made by combine, so first we - make sure that we have insns with valid INSN_CUID values. */ - before_dead = where_dead; - while (before_dead && INSN_UID (before_dead) > max_uid_cuid) - before_dead = PREV_INSN (before_dead); - after_dead = where_dead; - while (after_dead && INSN_UID (after_dead) > max_uid_cuid) - after_dead = NEXT_INSN (after_dead); - - if (before_dead && after_dead - && INSN_CUID (before_dead) >= from_cuid - && (INSN_CUID (after_dead) < INSN_CUID (to_insn) - || (where_dead != after_dead - && INSN_CUID (after_dead) == INSN_CUID (to_insn)))) - { - rtx note = remove_death (regno, where_dead); - - /* It is possible for the call above to return 0. This can occur - when reg_last_death points to I2 or I1 that we combined with. - In that case make a new note. - - We must also check for the case where X is a hard register - and NOTE is a death note for a range of hard registers - including X. In that case, we must put REG_DEAD notes for - the remaining registers in place of NOTE. */ - - if (note != 0 && regno < FIRST_PSEUDO_REGISTER - && (GET_MODE_SIZE (GET_MODE (XEXP (note, 0))) - > GET_MODE_SIZE (GET_MODE (x)))) - { - int deadregno = REGNO (XEXP (note, 0)); - int deadend - = (deadregno + HARD_REGNO_NREGS (deadregno, - GET_MODE (XEXP (note, 0)))); - int ourend = regno + HARD_REGNO_NREGS (regno, GET_MODE (x)); - int i; - - for (i = deadregno; i < deadend; i++) - if (i < regno || i >= ourend) - REG_NOTES (where_dead) - = gen_rtx_EXPR_LIST (REG_DEAD, - gen_rtx_REG (reg_raw_mode[i], i), - REG_NOTES (where_dead)); - } - /* If we didn't find any note, or if we found a REG_DEAD note that - covers only part of the given reg, and we have a multi-reg hard - register, then to be safe we must check for REG_DEAD notes - for each register other than the first. They could have - their own REG_DEAD notes lying around. */ - else if ((note == 0 - || (note != 0 - && (GET_MODE_SIZE (GET_MODE (XEXP (note, 0))) - < GET_MODE_SIZE (GET_MODE (x))))) - && regno < FIRST_PSEUDO_REGISTER - && HARD_REGNO_NREGS (regno, GET_MODE (x)) > 1) - { - int ourend = regno + HARD_REGNO_NREGS (regno, GET_MODE (x)); - int i, offset; - rtx oldnotes = 0; - - if (note) - offset = HARD_REGNO_NREGS (regno, GET_MODE (XEXP (note, 0))); - else - offset = 1; - - for (i = regno + offset; i < ourend; i++) - move_deaths (gen_rtx_REG (reg_raw_mode[i], i), - maybe_kill_insn, from_cuid, to_insn, &oldnotes); - } - - if (note != 0 && GET_MODE (XEXP (note, 0)) == GET_MODE (x)) - { - XEXP (note, 1) = *pnotes; - *pnotes = note; - } - else - *pnotes = gen_rtx_EXPR_LIST (REG_DEAD, x, *pnotes); - - REG_N_DEATHS (regno)++; - } - - return; - } - - else if (GET_CODE (x) == SET) - { - rtx dest = SET_DEST (x); - - move_deaths (SET_SRC (x), maybe_kill_insn, from_cuid, to_insn, pnotes); - - /* In the case of a ZERO_EXTRACT, a STRICT_LOW_PART, or a SUBREG - that accesses one word of a multi-word item, some - piece of everything register in the expression is used by - this insn, so remove any old death. */ - - if (GET_CODE (dest) == ZERO_EXTRACT - || GET_CODE (dest) == STRICT_LOW_PART - || (GET_CODE (dest) == SUBREG - && (((GET_MODE_SIZE (GET_MODE (dest)) - + UNITS_PER_WORD - 1) / UNITS_PER_WORD) - == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))) - + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))) - { - move_deaths (dest, maybe_kill_insn, from_cuid, to_insn, pnotes); - return; - } - - /* If this is some other SUBREG, we know it replaces the entire - value, so use that as the destination. */ - if (GET_CODE (dest) == SUBREG) - dest = SUBREG_REG (dest); - - /* If this is a MEM, adjust deaths of anything used in the address. - For a REG (the only other possibility), the entire value is - being replaced so the old value is not used in this insn. */ - - if (GET_CODE (dest) == MEM) - move_deaths (XEXP (dest, 0), maybe_kill_insn, from_cuid, - to_insn, pnotes); - return; - } - - else if (GET_CODE (x) == CLOBBER) - return; - - len = GET_RTX_LENGTH (code); - fmt = GET_RTX_FORMAT (code); - - for (i = 0; i < len; i++) - { - if (fmt[i] == 'E') - { - register int j; - for (j = XVECLEN (x, i) - 1; j >= 0; j--) - move_deaths (XVECEXP (x, i, j), maybe_kill_insn, from_cuid, - to_insn, pnotes); - } - else if (fmt[i] == 'e') - move_deaths (XEXP (x, i), maybe_kill_insn, from_cuid, to_insn, pnotes); - } -} - -/* Return 1 if X is the target of a bit-field assignment in BODY, the - pattern of an insn. X must be a REG. */ - -static int -reg_bitfield_target_p (x, body) - rtx x; - rtx body; -{ - int i; - - if (GET_CODE (body) == SET) - { - rtx dest = SET_DEST (body); - rtx target; - int regno, tregno, endregno, endtregno; - - if (GET_CODE (dest) == ZERO_EXTRACT) - target = XEXP (dest, 0); - else if (GET_CODE (dest) == STRICT_LOW_PART) - target = SUBREG_REG (XEXP (dest, 0)); - else - return 0; - - if (GET_CODE (target) == SUBREG) - target = SUBREG_REG (target); - - if (GET_CODE (target) != REG) - return 0; - - tregno = REGNO (target), regno = REGNO (x); - if (tregno >= FIRST_PSEUDO_REGISTER || regno >= FIRST_PSEUDO_REGISTER) - return target == x; - - endtregno = tregno + HARD_REGNO_NREGS (tregno, GET_MODE (target)); - endregno = regno + HARD_REGNO_NREGS (regno, GET_MODE (x)); - - return endregno > tregno && regno < endtregno; - } - - else if (GET_CODE (body) == PARALLEL) - for (i = XVECLEN (body, 0) - 1; i >= 0; i--) - if (reg_bitfield_target_p (x, XVECEXP (body, 0, i))) - return 1; - - return 0; -} - -/* Given a chain of REG_NOTES originally from FROM_INSN, try to place them - as appropriate. I3 and I2 are the insns resulting from the combination - insns including FROM (I2 may be zero). - - ELIM_I2 and ELIM_I1 are either zero or registers that we know will - not need REG_DEAD notes because they are being substituted for. This - saves searching in the most common cases. - - Each note in the list is either ignored or placed on some insns, depending - on the type of note. */ - -static void -distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1) - rtx notes; - rtx from_insn; - rtx i3, i2; - rtx elim_i2, elim_i1; -{ - rtx note, next_note; - rtx tem; - - for (note = notes; note; note = next_note) - { - rtx place = 0, place2 = 0; - - /* If this NOTE references a pseudo register, ensure it references - the latest copy of that register. */ - if (XEXP (note, 0) && GET_CODE (XEXP (note, 0)) == REG - && REGNO (XEXP (note, 0)) >= FIRST_PSEUDO_REGISTER) - XEXP (note, 0) = regno_reg_rtx[REGNO (XEXP (note, 0))]; - - next_note = XEXP (note, 1); - switch (REG_NOTE_KIND (note)) - { - case REG_BR_PROB: - case REG_EXEC_COUNT: - /* Doesn't matter much where we put this, as long as it's somewhere. - It is preferable to keep these notes on branches, which is most - likely to be i3. */ - place = i3; - break; - - case REG_EH_REGION: - /* This note must remain with the call. It should not be possible - for both I2 and I3 to be a call. */ - if (GET_CODE (i3) == CALL_INSN) - place = i3; - else if (i2 && GET_CODE (i2) == CALL_INSN) - place = i2; - else - abort (); - break; - - case REG_UNUSED: - /* Any clobbers for i3 may still exist, and so we must process - REG_UNUSED notes from that insn. - - Any clobbers from i2 or i1 can only exist if they were added by - recog_for_combine. In that case, recog_for_combine created the - necessary REG_UNUSED notes. Trying to keep any original - REG_UNUSED notes from these insns can cause incorrect output - if it is for the same register as the original i3 dest. - In that case, we will notice that the register is set in i3, - and then add a REG_UNUSED note for the destination of i3, which - is wrong. However, it is possible to have REG_UNUSED notes from - i2 or i1 for register which were both used and clobbered, so - we keep notes from i2 or i1 if they will turn into REG_DEAD - notes. */ - - /* If this register is set or clobbered in I3, put the note there - unless there is one already. */ - if (reg_set_p (XEXP (note, 0), PATTERN (i3))) - { - if (from_insn != i3) - break; - - if (! (GET_CODE (XEXP (note, 0)) == REG - ? find_regno_note (i3, REG_UNUSED, REGNO (XEXP (note, 0))) - : find_reg_note (i3, REG_UNUSED, XEXP (note, 0)))) - place = i3; - } - /* Otherwise, if this register is used by I3, then this register - now dies here, so we must put a REG_DEAD note here unless there - is one already. */ - else if (reg_referenced_p (XEXP (note, 0), PATTERN (i3)) - && ! (GET_CODE (XEXP (note, 0)) == REG - ? find_regno_note (i3, REG_DEAD, REGNO (XEXP (note, 0))) - : find_reg_note (i3, REG_DEAD, XEXP (note, 0)))) - { - PUT_REG_NOTE_KIND (note, REG_DEAD); - place = i3; - } - break; - - case REG_EQUAL: - case REG_EQUIV: - case REG_NONNEG: - case REG_NOALIAS: - /* These notes say something about results of an insn. We can - only support them if they used to be on I3 in which case they - remain on I3. Otherwise they are ignored. - - If the note refers to an expression that is not a constant, we - must also ignore the note since we cannot tell whether the - equivalence is still true. It might be possible to do - slightly better than this (we only have a problem if I2DEST - or I1DEST is present in the expression), but it doesn't - seem worth the trouble. */ - - if (from_insn == i3 - && (XEXP (note, 0) == 0 || CONSTANT_P (XEXP (note, 0)))) - place = i3; - break; - - case REG_INC: - case REG_NO_CONFLICT: - /* These notes say something about how a register is used. They must - be present on any use of the register in I2 or I3. */ - if (reg_mentioned_p (XEXP (note, 0), PATTERN (i3))) - place = i3; - - if (i2 && reg_mentioned_p (XEXP (note, 0), PATTERN (i2))) - { - if (place) - place2 = i2; - else - place = i2; - } - break; - - case REG_LABEL: - /* This can show up in several ways -- either directly in the - pattern, or hidden off in the constant pool with (or without?) - a REG_EQUAL note. */ - /* ??? Ignore the without-reg_equal-note problem for now. */ - if (reg_mentioned_p (XEXP (note, 0), PATTERN (i3)) - || ((tem = find_reg_note (i3, REG_EQUAL, NULL_RTX)) - && GET_CODE (XEXP (tem, 0)) == LABEL_REF - && XEXP (XEXP (tem, 0), 0) == XEXP (note, 0))) - place = i3; - - if (i2 - && (reg_mentioned_p (XEXP (note, 0), PATTERN (i2)) - || ((tem = find_reg_note (i2, REG_EQUAL, NULL_RTX)) - && GET_CODE (XEXP (tem, 0)) == LABEL_REF - && XEXP (XEXP (tem, 0), 0) == XEXP (note, 0)))) - { - if (place) - place2 = i2; - else - place = i2; - } - break; - - case REG_WAS_0: - /* It is too much trouble to try to see if this note is still - correct in all situations. It is better to simply delete it. */ - break; - - case REG_RETVAL: - /* If the insn previously containing this note still exists, - put it back where it was. Otherwise move it to the previous - insn. Adjust the corresponding REG_LIBCALL note. */ - if (GET_CODE (from_insn) != NOTE) - place = from_insn; - else - { - tem = find_reg_note (XEXP (note, 0), REG_LIBCALL, NULL_RTX); - place = prev_real_insn (from_insn); - if (tem && place) - XEXP (tem, 0) = place; - } - break; - - case REG_LIBCALL: - /* This is handled similarly to REG_RETVAL. */ - if (GET_CODE (from_insn) != NOTE) - place = from_insn; - else - { - tem = find_reg_note (XEXP (note, 0), REG_RETVAL, NULL_RTX); - place = next_real_insn (from_insn); - if (tem && place) - XEXP (tem, 0) = place; - } - break; - - case REG_DEAD: - /* If the register is used as an input in I3, it dies there. - Similarly for I2, if it is non-zero and adjacent to I3. - - If the register is not used as an input in either I3 or I2 - and it is not one of the registers we were supposed to eliminate, - there are two possibilities. We might have a non-adjacent I2 - or we might have somehow eliminated an additional register - from a computation. For example, we might have had A & B where - we discover that B will always be zero. In this case we will - eliminate the reference to A. - - In both cases, we must search to see if we can find a previous - use of A and put the death note there. */ - - if (from_insn - && GET_CODE (from_insn) == CALL_INSN - && find_reg_fusage (from_insn, USE, XEXP (note, 0))) - place = from_insn; - else if (reg_referenced_p (XEXP (note, 0), PATTERN (i3))) - place = i3; - else if (i2 != 0 && next_nonnote_insn (i2) == i3 - && reg_referenced_p (XEXP (note, 0), PATTERN (i2))) - place = i2; - - if (XEXP (note, 0) == elim_i2 || XEXP (note, 0) == elim_i1) - break; - - /* If the register is used in both I2 and I3 and it dies in I3, - we might have added another reference to it. If reg_n_refs - was 2, bump it to 3. This has to be correct since the - register must have been set somewhere. The reason this is - done is because local-alloc.c treats 2 references as a - special case. */ - - if (place == i3 && i2 != 0 && GET_CODE (XEXP (note, 0)) == REG - && REG_N_REFS (REGNO (XEXP (note, 0)))== 2 - && reg_referenced_p (XEXP (note, 0), PATTERN (i2))) - REG_N_REFS (REGNO (XEXP (note, 0))) = 3; - - if (place == 0) - { - for (tem = prev_nonnote_insn (i3); - place == 0 && tem - && (GET_CODE (tem) == INSN || GET_CODE (tem) == CALL_INSN); - tem = prev_nonnote_insn (tem)) - { - /* If the register is being set at TEM, see if that is all - TEM is doing. If so, delete TEM. Otherwise, make this - into a REG_UNUSED note instead. */ - if (reg_set_p (XEXP (note, 0), PATTERN (tem))) - { - rtx set = single_set (tem); - rtx inner_dest = 0; -#ifdef HAVE_cc0 - rtx cc0_setter = NULL_RTX; -#endif - - if (set != 0) - for (inner_dest = SET_DEST (set); - GET_CODE (inner_dest) == STRICT_LOW_PART - || GET_CODE (inner_dest) == SUBREG - || GET_CODE (inner_dest) == ZERO_EXTRACT; - inner_dest = XEXP (inner_dest, 0)) - ; - - /* Verify that it was the set, and not a clobber that - modified the register. - - CC0 targets must be careful to maintain setter/user - pairs. If we cannot delete the setter due to side - effects, mark the user with an UNUSED note instead - of deleting it. */ - - if (set != 0 && ! side_effects_p (SET_SRC (set)) - && rtx_equal_p (XEXP (note, 0), inner_dest) -#ifdef HAVE_cc0 - && (! reg_mentioned_p (cc0_rtx, SET_SRC (set)) - || ((cc0_setter = prev_cc0_setter (tem)) != NULL - && sets_cc0_p (PATTERN (cc0_setter)) > 0)) -#endif - ) - { - /* Move the notes and links of TEM elsewhere. - This might delete other dead insns recursively. - First set the pattern to something that won't use - any register. */ - - PATTERN (tem) = pc_rtx; - - distribute_notes (REG_NOTES (tem), tem, tem, - NULL_RTX, NULL_RTX, NULL_RTX); - distribute_links (LOG_LINKS (tem)); - - PUT_CODE (tem, NOTE); - NOTE_LINE_NUMBER (tem) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (tem) = 0; - -#ifdef HAVE_cc0 - /* Delete the setter too. */ - if (cc0_setter) - { - PATTERN (cc0_setter) = pc_rtx; - - distribute_notes (REG_NOTES (cc0_setter), - cc0_setter, cc0_setter, - NULL_RTX, NULL_RTX, NULL_RTX); - distribute_links (LOG_LINKS (cc0_setter)); - - PUT_CODE (cc0_setter, NOTE); - NOTE_LINE_NUMBER (cc0_setter) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (cc0_setter) = 0; - } -#endif - } - /* If the register is both set and used here, put the - REG_DEAD note here, but place a REG_UNUSED note - here too unless there already is one. */ - else if (reg_referenced_p (XEXP (note, 0), - PATTERN (tem))) - { - place = tem; - - if (! find_regno_note (tem, REG_UNUSED, - REGNO (XEXP (note, 0)))) - REG_NOTES (tem) - = gen_rtx_EXPR_LIST (REG_UNUSED, - XEXP (note, 0), - REG_NOTES (tem)); - } - else - { - PUT_REG_NOTE_KIND (note, REG_UNUSED); - - /* If there isn't already a REG_UNUSED note, put one - here. */ - if (! find_regno_note (tem, REG_UNUSED, - REGNO (XEXP (note, 0)))) - place = tem; - break; - } - } - else if (reg_referenced_p (XEXP (note, 0), PATTERN (tem)) - || (GET_CODE (tem) == CALL_INSN - && find_reg_fusage (tem, USE, XEXP (note, 0)))) - { - place = tem; - - /* If we are doing a 3->2 combination, and we have a - register which formerly died in i3 and was not used - by i2, which now no longer dies in i3 and is used in - i2 but does not die in i2, and place is between i2 - and i3, then we may need to move a link from place to - i2. */ - if (i2 && INSN_UID (place) <= max_uid_cuid - && INSN_CUID (place) > INSN_CUID (i2) - && from_insn && INSN_CUID (from_insn) > INSN_CUID (i2) - && reg_referenced_p (XEXP (note, 0), PATTERN (i2))) - { - rtx links = LOG_LINKS (place); - LOG_LINKS (place) = 0; - distribute_links (links); - } - break; - } - } - - /* If we haven't found an insn for the death note and it - is still a REG_DEAD note, but we have hit a CODE_LABEL, - insert a USE insn for the register at that label and - put the death node there. This prevents problems with - call-state tracking in caller-save.c. */ - if (REG_NOTE_KIND (note) == REG_DEAD && place == 0 && tem != 0) - { - place - = emit_insn_after (gen_rtx_USE (VOIDmode, XEXP (note, 0)), - tem); - - /* If this insn was emitted between blocks, then update - BLOCK_HEAD of the current block to include it. */ - if (BLOCK_END (this_basic_block - 1) == tem) - BLOCK_HEAD (this_basic_block) = place; - } - } - - /* If the register is set or already dead at PLACE, we needn't do - anything with this note if it is still a REG_DEAD note. - We can here if it is set at all, not if is it totally replace, - which is what `dead_or_set_p' checks, so also check for it being - set partially. */ - - - if (place && REG_NOTE_KIND (note) == REG_DEAD) - { - int regno = REGNO (XEXP (note, 0)); - - if (dead_or_set_p (place, XEXP (note, 0)) - || reg_bitfield_target_p (XEXP (note, 0), PATTERN (place))) - { - /* Unless the register previously died in PLACE, clear - reg_last_death. [I no longer understand why this is - being done.] */ - if (reg_last_death[regno] != place) - reg_last_death[regno] = 0; - place = 0; - } - else - reg_last_death[regno] = place; - - /* If this is a death note for a hard reg that is occupying - multiple registers, ensure that we are still using all - parts of the object. If we find a piece of the object - that is unused, we must add a USE for that piece before - PLACE and put the appropriate REG_DEAD note on it. - - An alternative would be to put a REG_UNUSED for the pieces - on the insn that set the register, but that can't be done if - it is not in the same block. It is simpler, though less - efficient, to add the USE insns. */ - - if (place && regno < FIRST_PSEUDO_REGISTER - && HARD_REGNO_NREGS (regno, GET_MODE (XEXP (note, 0))) > 1) - { - int endregno - = regno + HARD_REGNO_NREGS (regno, - GET_MODE (XEXP (note, 0))); - int all_used = 1; - int i; - - for (i = regno; i < endregno; i++) - if (! refers_to_regno_p (i, i + 1, PATTERN (place), 0) - && ! find_regno_fusage (place, USE, i)) - { - rtx piece = gen_rtx_REG (reg_raw_mode[i], i); - rtx p; - - /* See if we already placed a USE note for this - register in front of PLACE. */ - for (p = place; - GET_CODE (PREV_INSN (p)) == INSN - && GET_CODE (PATTERN (PREV_INSN (p))) == USE; - p = PREV_INSN (p)) - if (rtx_equal_p (piece, - XEXP (PATTERN (PREV_INSN (p)), 0))) - { - p = 0; - break; - } - - if (p) - { - rtx use_insn - = emit_insn_before (gen_rtx_USE (VOIDmode, - piece), - p); - REG_NOTES (use_insn) - = gen_rtx_EXPR_LIST (REG_DEAD, piece, - REG_NOTES (use_insn)); - } - - all_used = 0; - } - - /* Check for the case where the register dying partially - overlaps the register set by this insn. */ - if (all_used) - for (i = regno; i < endregno; i++) - if (dead_or_set_regno_p (place, i)) - { - all_used = 0; - break; - } - - if (! all_used) - { - /* Put only REG_DEAD notes for pieces that are - still used and that are not already dead or set. */ - - for (i = regno; i < endregno; i++) - { - rtx piece = gen_rtx_REG (reg_raw_mode[i], i); - - if ((reg_referenced_p (piece, PATTERN (place)) - || (GET_CODE (place) == CALL_INSN - && find_reg_fusage (place, USE, piece))) - && ! dead_or_set_p (place, piece) - && ! reg_bitfield_target_p (piece, - PATTERN (place))) - REG_NOTES (place) - = gen_rtx_EXPR_LIST (REG_DEAD, - piece, REG_NOTES (place)); - } - - place = 0; - } - } - } - break; - - default: - /* Any other notes should not be present at this point in the - compilation. */ - abort (); - } - - if (place) - { - XEXP (note, 1) = REG_NOTES (place); - REG_NOTES (place) = note; - } - else if ((REG_NOTE_KIND (note) == REG_DEAD - || REG_NOTE_KIND (note) == REG_UNUSED) - && GET_CODE (XEXP (note, 0)) == REG) - REG_N_DEATHS (REGNO (XEXP (note, 0)))--; - - if (place2) - { - if ((REG_NOTE_KIND (note) == REG_DEAD - || REG_NOTE_KIND (note) == REG_UNUSED) - && GET_CODE (XEXP (note, 0)) == REG) - REG_N_DEATHS (REGNO (XEXP (note, 0)))++; - - REG_NOTES (place2) = gen_rtx_fmt_ee (GET_CODE (note), - REG_NOTE_KIND (note), - XEXP (note, 0), - REG_NOTES (place2)); - } - } -} - -/* Similarly to above, distribute the LOG_LINKS that used to be present on - I3, I2, and I1 to new locations. This is also called in one case to - add a link pointing at I3 when I3's destination is changed. */ - -static void -distribute_links (links) - rtx links; -{ - rtx link, next_link; - - for (link = links; link; link = next_link) - { - rtx place = 0; - rtx insn; - rtx set, reg; - - next_link = XEXP (link, 1); - - /* If the insn that this link points to is a NOTE or isn't a single - set, ignore it. In the latter case, it isn't clear what we - can do other than ignore the link, since we can't tell which - register it was for. Such links wouldn't be used by combine - anyway. - - It is not possible for the destination of the target of the link to - have been changed by combine. The only potential of this is if we - replace I3, I2, and I1 by I3 and I2. But in that case the - destination of I2 also remains unchanged. */ - - if (GET_CODE (XEXP (link, 0)) == NOTE - || (set = single_set (XEXP (link, 0))) == 0) - continue; - - reg = SET_DEST (set); - while (GET_CODE (reg) == SUBREG || GET_CODE (reg) == ZERO_EXTRACT - || GET_CODE (reg) == SIGN_EXTRACT - || GET_CODE (reg) == STRICT_LOW_PART) - reg = XEXP (reg, 0); - - /* A LOG_LINK is defined as being placed on the first insn that uses - a register and points to the insn that sets the register. Start - searching at the next insn after the target of the link and stop - when we reach a set of the register or the end of the basic block. - - Note that this correctly handles the link that used to point from - I3 to I2. Also note that not much searching is typically done here - since most links don't point very far away. */ - - for (insn = NEXT_INSN (XEXP (link, 0)); - (insn && (this_basic_block == n_basic_blocks - 1 - || BLOCK_HEAD (this_basic_block + 1) != insn)); - insn = NEXT_INSN (insn)) - if (GET_RTX_CLASS (GET_CODE (insn)) == 'i' - && reg_overlap_mentioned_p (reg, PATTERN (insn))) - { - if (reg_referenced_p (reg, PATTERN (insn))) - place = insn; - break; - } - else if (GET_CODE (insn) == CALL_INSN - && find_reg_fusage (insn, USE, reg)) - { - place = insn; - break; - } - - /* If we found a place to put the link, place it there unless there - is already a link to the same insn as LINK at that point. */ - - if (place) - { - rtx link2; - - for (link2 = LOG_LINKS (place); link2; link2 = XEXP (link2, 1)) - if (XEXP (link2, 0) == XEXP (link, 0)) - break; - - if (link2 == 0) - { - XEXP (link, 1) = LOG_LINKS (place); - LOG_LINKS (place) = link; - - /* Set added_links_insn to the earliest insn we added a - link to. */ - if (added_links_insn == 0 - || INSN_CUID (added_links_insn) > INSN_CUID (place)) - added_links_insn = place; - } - } - } -} - -/* Compute INSN_CUID for INSN, which is an insn made by combine. */ - -static int -insn_cuid (insn) - rtx insn; -{ - while (insn != 0 && INSN_UID (insn) > max_uid_cuid - && GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == USE) - insn = NEXT_INSN (insn); - - if (INSN_UID (insn) > max_uid_cuid) - abort (); - - return INSN_CUID (insn); -} - -void -dump_combine_stats (file) - FILE *file; -{ - fnotice - (file, - ";; Combiner statistics: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n\n", - combine_attempts, combine_merges, combine_extras, combine_successes); -} - -void -dump_combine_total_stats (file) - FILE *file; -{ - fnotice - (file, - "\n;; Combiner totals: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n", - total_attempts, total_merges, total_extras, total_successes); -} diff --git a/contrib/gcc/conditions.h b/contrib/gcc/conditions.h deleted file mode 100644 index 80d604790cc9..000000000000 --- a/contrib/gcc/conditions.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Definitions for condition code handling in final.c and output routines. - Copyright (C) 1987 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* None of the things in the files exist if we don't use CC0. */ - -#ifdef HAVE_cc0 - -/* The variable cc_status says how to interpret the condition code. - It is set by output routines for an instruction that sets the cc's - and examined by output routines for jump instructions. - - cc_status contains two components named `value1' and `value2' - that record two equivalent expressions for the values that the - condition codes were set from. (Either or both may be null if - there is no useful expression to record.) These fields are - used for eliminating redundant test and compare instructions - in the cases where the condition codes were already set by the - previous instruction. - - cc_status.flags contains flags which say that the condition codes - were set in a nonstandard manner. The output of jump instructions - uses these flags to compensate and produce the standard result - with the nonstandard condition codes. Standard flags are defined here. - The tm.h file can also define other machine-dependent flags. - - cc_status also contains a machine-dependent component `mdep' - whose type, `CC_STATUS_MDEP', may be defined as a macro in the - tm.h file. */ - -#ifndef CC_STATUS_MDEP -#define CC_STATUS_MDEP int -#endif - -#ifndef CC_STATUS_MDEP_INIT -#define CC_STATUS_MDEP_INIT 0 -#endif - -typedef struct {int flags; rtx value1, value2; CC_STATUS_MDEP mdep;} CC_STATUS; - -/* While outputting an insn as assembler code, - this is the status BEFORE that insn. */ -extern CC_STATUS cc_prev_status; - -/* While outputting an insn as assembler code, - this is being altered to the status AFTER that insn. */ -extern CC_STATUS cc_status; - -/* These are the machine-independent flags: */ - -/* Set if the sign of the cc value is inverted: - output a following jump-if-less as a jump-if-greater, etc. */ -#define CC_REVERSED 1 - -/* This bit means that the current setting of the N bit is bogus - and conditional jumps should use the Z bit in its place. - This state obtains when an extraction of a signed single-bit field - or an arithmetic shift right of a byte by 7 bits - is turned into a btst, because btst does not set the N bit. */ -#define CC_NOT_POSITIVE 2 - -/* This bit means that the current setting of the N bit is bogus - and conditional jumps should pretend that the N bit is clear. - Used after extraction of an unsigned bit - or logical shift right of a byte by 7 bits is turned into a btst. - The btst does not alter the N bit, but the result of that shift - or extract is never negative. */ -#define CC_NOT_NEGATIVE 4 - -/* This bit means that the current setting of the overflow flag - is bogus and conditional jumps should pretend there is no overflow. */ -/* ??? Note that for most targets this macro is misnamed as it applies - to the carry flag, not the overflow flag. */ -#define CC_NO_OVERFLOW 010 - -/* This bit means that what ought to be in the Z bit - should be tested as the complement of the N bit. */ -#define CC_Z_IN_NOT_N 020 - -/* This bit means that what ought to be in the Z bit - should be tested as the N bit. */ -#define CC_Z_IN_N 040 - -/* Nonzero if we must invert the sense of the following branch, i.e. - change EQ to NE. This is not safe for IEEE floating point operations! - It is intended for use only when a combination of arithmetic - or logical insns can leave the condition codes set in a fortuitous - (though inverted) state. */ -#define CC_INVERTED 0100 - -/* Nonzero if we must convert signed condition operators to unsigned. - This is only used by machine description files. */ -#define CC_NOT_SIGNED 0200 - -/* This is how to initialize the variable cc_status. - final does this at appropriate moments. */ - -#define CC_STATUS_INIT \ - (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0, \ - CC_STATUS_MDEP_INIT) - -#endif diff --git a/contrib/gcc/config.guess b/contrib/gcc/config.guess deleted file mode 100755 index fd7602dabd9a..000000000000 --- a/contrib/gcc/config.guess +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Use the top-level config.guess so that we don't have two of them. -guesssys=`echo $0 | sed 's|config.guess|../config.guess|'` -exec ${guesssys} "$@" diff --git a/contrib/gcc/config.in b/contrib/gcc/config.in deleted file mode 100644 index c804a2b682e7..000000000000 --- a/contrib/gcc/config.in +++ /dev/null @@ -1,366 +0,0 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ -/* Define if you can safely include both and . */ -#undef STRING_WITH_STRINGS - -/* Define if printf supports "%p". */ -#undef HAVE_PRINTF_PTR - -/* Define if you want expensive run-time checks. */ -#undef ENABLE_CHECKING - -/* Define to 1 if NLS is requested. */ -#undef ENABLE_NLS - -/* Define as 1 if you have catgets and don't want to use GNU gettext. */ -#undef HAVE_CATGETS - -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT - -/* Define if your cpp understands the stringify operator. */ -#undef HAVE_CPP_STRINGIFY - -/* Define if your compiler understands volatile. */ -#undef HAVE_VOLATILE - -/* Define if your assembler supports specifying the maximum number - of bytes to skip when using the GAS .p2align command. */ -#undef HAVE_GAS_MAX_SKIP_P2ALIGN - -/* Define if your assembler supports .balign and .p2align. */ -#undef HAVE_GAS_BALIGN_AND_P2ALIGN - -/* Define if your assembler supports .subsection and .subsection -1 starts - emitting at the beginning of your section */ -#undef HAVE_GAS_SUBSECTION_ORDERING - -/* Define if your assembler uses the old HImode fild and fist notation. */ -#undef HAVE_GAS_FILDS_FISTS - -/* Define if you have a working header file. */ -#undef HAVE_INTTYPES_H - -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Define as 1 if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Whether malloc must be declared even if is included. */ -#undef NEED_DECLARATION_MALLOC - -/* Whether realloc must be declared even if is included. */ -#undef NEED_DECLARATION_REALLOC - -/* Whether calloc must be declared even if is included. */ -#undef NEED_DECLARATION_CALLOC - -/* Whether free must be declared even if is included. */ -#undef NEED_DECLARATION_FREE - -/* Whether bcopy must be declared even if is included. */ -#undef NEED_DECLARATION_BCOPY - -/* Whether bcmp must be declared even if is included. */ -#undef NEED_DECLARATION_BCMP - -/* Whether bzero must be declared even if is included. */ -#undef NEED_DECLARATION_BZERO - -/* Whether index must be declared even if is included. */ -#undef NEED_DECLARATION_INDEX - -/* Whether rindex must be declared even if is included. */ -#undef NEED_DECLARATION_RINDEX - -/* Whether getenv must be declared even if is included. */ -#undef NEED_DECLARATION_GETENV - -/* Whether atol must be declared even if is included. */ -#undef NEED_DECLARATION_ATOL - -/* Whether atof must be declared even if is included. */ -#undef NEED_DECLARATION_ATOF - -/* Whether sbrk must be declared even if is included. */ -#undef NEED_DECLARATION_SBRK - -/* Whether abort must be declared even if is included. */ -#undef NEED_DECLARATION_ABORT - -/* Whether strerror must be declared even if is included. */ -#undef NEED_DECLARATION_STRERROR - -/* Whether strsignal must be declared even if is included. */ -#undef NEED_DECLARATION_STRSIGNAL - -/* Whether strstr must be declared even if is included. */ -#undef NEED_DECLARATION_STRSTR - -/* Whether getcwd must be declared even if is included. */ -#undef NEED_DECLARATION_GETCWD - -/* Whether getwd must be declared even if is included. */ -#undef NEED_DECLARATION_GETWD - -/* Whether getrlimit must be declared even if is included. */ -#undef NEED_DECLARATION_GETRLIMIT - -/* Whether setrlimit must be declared even if is included. */ -#undef NEED_DECLARATION_SETRLIMIT - -/* Whether putc_unlocked must be declared even if is included. */ -#undef NEED_DECLARATION_PUTC_UNLOCKED - -/* Whether fputs_unlocked must be declared even if is included. */ -#undef NEED_DECLARATION_FPUTS_UNLOCKED - -/* Define to enable the use of a default assembler. */ -#undef DEFAULT_ASSEMBLER - -/* Define to enable the use of a default linker. */ -#undef DEFAULT_LINKER - -/* Define if host mkdir takes a single argument. */ -#undef MKDIR_TAKES_ONE_ARG - -/* Define to the name of the distribution. */ -#undef PACKAGE - -/* Define to the version of the distribution. */ -#undef VERSION - -/* Define if using alloca.c. */ -#undef C_ALLOCA - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -#undef CRAY_STACKSEG_END - -/* Define if you have alloca, as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define if you have and it should be used (not on Ultrix). */ -#undef HAVE_ALLOCA_H - -/* Define if you don't have vprintf but do have _doprnt. */ -#undef HAVE_DOPRNT - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define if you have that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define if you have . */ -#undef HAVE_VFORK_H - -/* Define if you have the vprintf function. */ -#undef HAVE_VPRINTF - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define to `long' if doesn't define. */ -#undef off_t - -/* Define to `int' if doesn't define. */ -#undef pid_t - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if `sys_siglist' is declared by . */ -#undef SYS_SIGLIST_DECLARED - -/* Define if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define vfork as fork if vfork does not work. */ -#undef vfork - -/* Define if you have the __argz_count function. */ -#undef HAVE___ARGZ_COUNT - -/* Define if you have the __argz_next function. */ -#undef HAVE___ARGZ_NEXT - -/* Define if you have the __argz_stringify function. */ -#undef HAVE___ARGZ_STRINGIFY - -/* Define if you have the atoll function. */ -#undef HAVE_ATOLL - -/* Define if you have the atoq function. */ -#undef HAVE_ATOQ - -/* Define if you have the bcmp function. */ -#undef HAVE_BCMP - -/* Define if you have the bcopy function. */ -#undef HAVE_BCOPY - -/* Define if you have the bsearch function. */ -#undef HAVE_BSEARCH - -/* Define if you have the bzero function. */ -#undef HAVE_BZERO - -/* Define if you have the dcgettext function. */ -#undef HAVE_DCGETTEXT - -/* Define if you have the fputc_unlocked function. */ -#undef HAVE_FPUTC_UNLOCKED - -/* Define if you have the fputs_unlocked function. */ -#undef HAVE_FPUTS_UNLOCKED - -/* Define if you have the getcwd function. */ -#undef HAVE_GETCWD - -/* Define if you have the getpagesize function. */ -#undef HAVE_GETPAGESIZE - -/* Define if you have the getrlimit function. */ -#undef HAVE_GETRLIMIT - -/* Define if you have the gettimeofday function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define if you have the index function. */ -#undef HAVE_INDEX - -/* Define if you have the isascii function. */ -#undef HAVE_ISASCII - -/* Define if you have the kill function. */ -#undef HAVE_KILL - -/* Define if you have the munmap function. */ -#undef HAVE_MUNMAP - -/* Define if you have the popen function. */ -#undef HAVE_POPEN - -/* Define if you have the putc_unlocked function. */ -#undef HAVE_PUTC_UNLOCKED - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* Define if you have the rindex function. */ -#undef HAVE_RINDEX - -/* Define if you have the setenv function. */ -#undef HAVE_SETENV - -/* Define if you have the setlocale function. */ -#undef HAVE_SETLOCALE - -/* Define if you have the setrlimit function. */ -#undef HAVE_SETRLIMIT - -/* Define if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP - -/* Define if you have the strchr function. */ -#undef HAVE_STRCHR - -/* Define if you have the strdup function. */ -#undef HAVE_STRDUP - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR - -/* Define if you have the strrchr function. */ -#undef HAVE_STRRCHR - -/* Define if you have the strsignal function. */ -#undef HAVE_STRSIGNAL - -/* Define if you have the strtoul function. */ -#undef HAVE_STRTOUL - -/* Define if you have the sysconf function. */ -#undef HAVE_SYSCONF - -/* Define if you have the header file. */ -#undef HAVE_ARGZ_H - -/* Define if you have the header file. */ -#undef HAVE_DIRECT_H - -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the header file. */ -#undef HAVE_MALLOC_H - -/* Define if you have the header file. */ -#undef HAVE_NL_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_STAB_H - -/* Define if you have the header file. */ -#undef HAVE_STDDEF_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIMES_H - -/* Define if you have the header file. */ -#undef HAVE_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the i library (-li). */ -#undef HAVE_LIBI diff --git a/contrib/gcc/config.sub b/contrib/gcc/config.sub deleted file mode 100755 index b491c9f5ce05..000000000000 --- a/contrib/gcc/config.sub +++ /dev/null @@ -1,976 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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 of the License, or -# (at your option) any later version. -# -# This program 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi - -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - linux-gnu*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) - os= - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 \ - | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ - | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el \ - | sparc | sparclet | sparclite | sparc64 | v850) - basic_machine=$basic_machine-unknown - ;; - thumb | thumbel) - basic_machine=$basic_machine-unknown - ;; - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \ - | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-cbm - ;; - amigaos | amigados) - basic_machine=m68k-cbm - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-cbm - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [ctj]90-cray) - basic_machine=c90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9] ) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9] ) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9] ) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | \ - hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893 ) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679] ) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - os=-mvs - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i[34567]86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i[34567]86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i[34567]86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - miniframe) - basic_machine=m68000-convergent - ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - np1) - basic_machine=np1-gould - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | nexen) - basic_machine=i586-pc - ;; - pentiumpro | p6 | k6 | 6x86) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | nexen-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | k6-* | 6x86-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=rs6000-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sparc) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* ) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -ctix* | -uts*) - os=-sysv - ;; - -ns2 ) - os=-nextstep2 - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -xenix) - os=-xenix - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-semi) - os=-aout - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-ibm) - os=-aix - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f301-fujitsu) - os=-uxpv - ;; - *-be) - os=-beos - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -hpux*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -beos*) - vendor=be - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os diff --git a/contrib/gcc/config/README b/contrib/gcc/config/README deleted file mode 100644 index 60328ec5b825..000000000000 --- a/contrib/gcc/config/README +++ /dev/null @@ -1,5 +0,0 @@ -This directory contains machine-specific files for the GNU C compiler. -It has a subdirectory for each basic CPU type. -The only files in this directory itself -are some .h files that pertain to particular operating systems -and are used for more than one CPU type. diff --git a/contrib/gcc/config/alpha/alpha-interix.h b/contrib/gcc/config/alpha/alpha-interix.h deleted file mode 100644 index 668fe9397af5..000000000000 --- a/contrib/gcc/config/alpha/alpha-interix.h +++ /dev/null @@ -1,252 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha - running Windows/NT. - Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc. - - Donn Terry, Softway Systems, Inc. - From code - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* cpp handles __STDC__ */ -/* The three "Alpha" defines on the first such line are from the CLAXP spec */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES " \ - -D__INTERIX \ - -D__OPENNT \ - -D__Alpha_AXP -D_M_ALPHA -D_ALPHA_ \ - -D__alpha -D__alpha__\ - -D__stdcall= \ - -D__cdecl= \ - -Asystem(unix) -Asystem(interix) -Asystem(interix) -Acpu(alpha) -Amachine(alpha)" - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "\ --remap \ -%{posix:-D_POSIX_SOURCE} \ --idirafter %$INTERIX_ROOT/usr/include" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (alpha Interix)"); - -/* alpha.h sets this, but it doesn't apply to us */ -#undef OBJECT_FORMAT_ECOFF -#undef OBJECT_FORMAT_COFF - -/* LINK_SPEC */ - -/* MD_STARTFILE_PREFIX */ - -/* ASM_OUTPUT_LOOP_ALIGN; ASM_OUTPUT_ALIGN_CODE */ - -/* Codegen macro overrides for NT internal conventions */ - -/* the below are ecoff specific... we don't need them, so - undef them (they'll get a default later) */ - -#undef PUT_SDB_BLOCK_START -#undef PUT_SDB_BLOCK_END - -/* the following are OSF linker (not gld) specific... we don't want them */ -#undef HAS_INIT_SECTION -#undef LD_INIT_SWITCH -#undef LD_FINI_SWITCH - - -/* The following are needed for C++, but also needed for profiling */ - -/* Support const sections and the ctors and dtors sections for g++. - Note that there appears to be two different ways to support const - sections at the moment. You can either #define the symbol - READONLY_DATA_SECTION (giving it some code which switches to the - readonly data section) or else you can #define the symbols - EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and - SELECT_RTX_SECTION. We do both here just to be on the safe side. */ - -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP ".rdata" - -/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. - - Note that we want to give these sections the SHF_WRITE attribute - because these sections will actually contain data (i.e. tables of - addresses of functions in the current root executable or shared library - file) and, in the case of a shared library, the relocatable addresses - will have to be properly resolved/relocated (and then written into) by - the dynamic linker when it actually attaches the given shared library - to the executing process. (Note that on SVR4, you may wish to use the - `-z text' option to the ELF linker, when building a shared library, as - an additional check that you are doing everything right. But if you do - use the `-z text' option when building a shared library, you will get - errors unless the .ctors and .dtors sections are marked as writable - via the SHF_WRITE attribute.) */ - -#define CTORS_SECTION_ASM_OP ".ctors" -#define DTORS_SECTION_ASM_OP ".dtors" - -/* A default list of other sections which we might be "in" at any given - time. For targets that use additional sections (e.g. .tdesc) you - should override this definition in the target-specific file which - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_ctors, in_dtors - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION - -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION() const_section () - -extern void text_section (); - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -#define INT_ASM_OP ".long" - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* The linker will take care of this, and having them causes problems with - ld -r (specifically -rU). */ -#define CTOR_LISTS_DEFINED_EXTERNALLY 1 - -#define SET_ASM_OP ".set" -/* Output a definition (implements alias) */ -#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ -do \ -{ \ - fprintf ((FILE), "\t"); \ - assemble_name (FILE, LABEL1); \ - fprintf (FILE, "="); \ - assemble_name (FILE, LABEL2); \ - fprintf (FILE, "\n"); \ - } \ -while (0) - -/* We use the defaults, so undef the null definitions */ -#undef PUT_SDB_FUNCTION_START -#undef PUT_SDB_FUNCTION_END -#undef PUT_SDB_EPILOGUE_END - -#define HOST_PTR_PRINTF "%p" -#define HOST_PTR_AS_INT unsigned long - -#define PCC_BITFIELD_TYPE_MATTERS 1 -#define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec) -#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec) - -/* DWARF2 Unwinding doesn't work with exception handling yet. */ -#undef DWARF2_UNWIND_INFO - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -/* The definition of this macro implies that there are cases where - a scalar value cannot be returned in registers. - - On NT (according to the spec) anything except strings/array that fits - in 64 bits is returned in the registers (this appears to differ from - the rest of the Alpha family). */ - -#undef RETURN_IN_MEMORY -#define RETURN_IN_MEMORY(TYPE) \ - (TREE_CODE (TYPE) == ARRAY_TYPE || int_size_in_bytes(TYPE) > 8) - -#define ASM_LOAD_ADDR(loc, reg) " lda " #reg "," #loc "\n" - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ -{ \ - alpha_write_verstamp (FILE); \ - fprintf (FILE, "\t.set noreorder\n"); \ - fprintf (FILE, "\t.set volatile\n"); \ - fprintf (FILE, "\t.set noat\n"); \ - fprintf (FILE, "\t.globl\t__fltused\n"); \ - ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ -} - -/* The current Interix assembler (consistent with the DEC documentation) - uses a=b NOT .set a,b; .set is for assembler options. */ -#undef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL -#define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(FILE, SY, HI, LO) \ - do { \ - assemble_name (FILE, SY); \ - fputc ('=', FILE); \ - assemble_name (FILE, HI); \ - fputc ('-', FILE); \ - assemble_name (FILE, LO); \ - } while (0) diff --git a/contrib/gcc/config/alpha/alpha.c b/contrib/gcc/config/alpha/alpha.c deleted file mode 100644 index 2d62693d76bd..000000000000 --- a/contrib/gcc/config/alpha/alpha.c +++ /dev/null @@ -1,5280 +0,0 @@ -/* Subroutines used for code generation on the DEC Alpha. - Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "regs.h" -#include "hard-reg-set.h" -#include "real.h" -#include "insn-config.h" -#include "conditions.h" -#include "insn-flags.h" -#include "output.h" -#include "insn-attr.h" -#include "flags.h" -#include "recog.h" -#include "reload.h" -#include "tree.h" -#include "expr.h" -#include "obstack.h" -#include "except.h" -#include "function.h" -#include "toplev.h" - -/* External data. */ -extern char *version_string; -extern int rtx_equal_function_value_matters; - -/* Specify which cpu to schedule for. */ - -enum processor_type alpha_cpu; -static const char * const alpha_cpu_name[] = -{ - "ev4", "ev5", "ev6" -}; - -/* Specify how accurate floating-point traps need to be. */ - -enum alpha_trap_precision alpha_tp; - -/* Specify the floating-point rounding mode. */ - -enum alpha_fp_rounding_mode alpha_fprm; - -/* Specify which things cause traps. */ - -enum alpha_fp_trap_mode alpha_fptm; - -/* Strings decoded into the above options. */ - -const char *alpha_cpu_string; /* -mcpu= */ -const char *alpha_tp_string; /* -mtrap-precision=[p|s|i] */ -const char *alpha_fprm_string; /* -mfp-rounding-mode=[n|m|c|d] */ -const char *alpha_fptm_string; /* -mfp-trap-mode=[n|u|su|sui] */ -const char *alpha_mlat_string; /* -mmemory-latency= */ - -/* Save information from a "cmpxx" operation until the branch or scc is - emitted. */ - -rtx alpha_compare_op0, alpha_compare_op1; -int alpha_compare_fp_p; - -/* Define the information needed to modify the epilogue for EH. */ - -rtx alpha_eh_epilogue_sp_ofs; - -/* Non-zero if inside of a function, because the Alpha asm can't - handle .files inside of functions. */ - -static int inside_function = FALSE; - -/* If non-null, this rtx holds the return address for the function. */ - -static rtx alpha_return_addr_rtx; - -/* The number of cycles of latency we should assume on memory reads. */ - -int alpha_memory_latency = 3; - -/* Whether the function needs the GP. */ - -static int alpha_function_needs_gp; - -/* The alias set for prologue/epilogue register save/restore. */ - -static int alpha_sr_alias_set; - -/* Declarations of static functions. */ -static void alpha_set_memflags_1 - PROTO((rtx, int, int, int)); -static rtx alpha_emit_set_const_1 - PROTO((rtx, enum machine_mode, HOST_WIDE_INT, int)); -static void alpha_expand_unaligned_load_words - PROTO((rtx *out_regs, rtx smem, HOST_WIDE_INT words, HOST_WIDE_INT ofs)); -static void alpha_expand_unaligned_store_words - PROTO((rtx *out_regs, rtx smem, HOST_WIDE_INT words, HOST_WIDE_INT ofs)); -static void alpha_sa_mask - PROTO((unsigned long *imaskP, unsigned long *fmaskP)); -static int alpha_does_function_need_gp - PROTO((void)); - - -/* Get the number of args of a function in one of two ways. */ -#ifdef OPEN_VMS -#define NUM_ARGS current_function_args_info.num_args -#else -#define NUM_ARGS current_function_args_info -#endif - -#define REG_PV 27 -#define REG_RA 26 - -/* Parse target option strings. */ - -void -override_options () -{ - alpha_tp = ALPHA_TP_PROG; - alpha_fprm = ALPHA_FPRM_NORM; - alpha_fptm = ALPHA_FPTM_N; - - if (TARGET_IEEE) - { - alpha_tp = ALPHA_TP_INSN; - alpha_fptm = ALPHA_FPTM_SU; - } - - if (TARGET_IEEE_WITH_INEXACT) - { - alpha_tp = ALPHA_TP_INSN; - alpha_fptm = ALPHA_FPTM_SUI; - } - - if (alpha_tp_string) - { - if (! strcmp (alpha_tp_string, "p")) - alpha_tp = ALPHA_TP_PROG; - else if (! strcmp (alpha_tp_string, "f")) - alpha_tp = ALPHA_TP_FUNC; - else if (! strcmp (alpha_tp_string, "i")) - alpha_tp = ALPHA_TP_INSN; - else - error ("bad value `%s' for -mtrap-precision switch", alpha_tp_string); - } - - if (alpha_fprm_string) - { - if (! strcmp (alpha_fprm_string, "n")) - alpha_fprm = ALPHA_FPRM_NORM; - else if (! strcmp (alpha_fprm_string, "m")) - alpha_fprm = ALPHA_FPRM_MINF; - else if (! strcmp (alpha_fprm_string, "c")) - alpha_fprm = ALPHA_FPRM_CHOP; - else if (! strcmp (alpha_fprm_string,"d")) - alpha_fprm = ALPHA_FPRM_DYN; - else - error ("bad value `%s' for -mfp-rounding-mode switch", - alpha_fprm_string); - } - - if (alpha_fptm_string) - { - if (strcmp (alpha_fptm_string, "n") == 0) - alpha_fptm = ALPHA_FPTM_N; - else if (strcmp (alpha_fptm_string, "u") == 0) - alpha_fptm = ALPHA_FPTM_U; - else if (strcmp (alpha_fptm_string, "su") == 0) - alpha_fptm = ALPHA_FPTM_SU; - else if (strcmp (alpha_fptm_string, "sui") == 0) - alpha_fptm = ALPHA_FPTM_SUI; - else - error ("bad value `%s' for -mfp-trap-mode switch", alpha_fptm_string); - } - - alpha_cpu - = TARGET_CPU_DEFAULT & MASK_CPU_EV6 ? PROCESSOR_EV6 - : (TARGET_CPU_DEFAULT & MASK_CPU_EV5 ? PROCESSOR_EV5 : PROCESSOR_EV4); - - if (alpha_cpu_string) - { - if (! strcmp (alpha_cpu_string, "ev4") - || ! strcmp (alpha_cpu_string, "21064")) - { - alpha_cpu = PROCESSOR_EV4; - target_flags &= ~ (MASK_BWX | MASK_MAX | MASK_FIX | MASK_CIX); - } - else if (! strcmp (alpha_cpu_string, "ev5") - || ! strcmp (alpha_cpu_string, "21164")) - { - alpha_cpu = PROCESSOR_EV5; - target_flags &= ~ (MASK_BWX | MASK_MAX | MASK_FIX | MASK_CIX); - } - else if (! strcmp (alpha_cpu_string, "ev56") - || ! strcmp (alpha_cpu_string, "21164a")) - { - alpha_cpu = PROCESSOR_EV5; - target_flags |= MASK_BWX; - target_flags &= ~ (MASK_MAX | MASK_FIX | MASK_CIX); - } - else if (! strcmp (alpha_cpu_string, "pca56") - || ! strcmp (alpha_cpu_string, "21164PC") - || ! strcmp (alpha_cpu_string, "21164pc")) - { - alpha_cpu = PROCESSOR_EV5; - target_flags |= MASK_BWX | MASK_MAX; - target_flags &= ~ (MASK_FIX | MASK_CIX); - } - else if (! strcmp (alpha_cpu_string, "ev6") - || ! strcmp (alpha_cpu_string, "21264")) - { - alpha_cpu = PROCESSOR_EV6; - target_flags |= MASK_BWX | MASK_MAX | MASK_FIX; - target_flags &= ~ (MASK_CIX); - } - else - error ("bad value `%s' for -mcpu switch", alpha_cpu_string); - } - - /* Do some sanity checks on the above options. */ - - if ((alpha_fptm == ALPHA_FPTM_SU || alpha_fptm == ALPHA_FPTM_SUI) - && alpha_tp != ALPHA_TP_INSN && alpha_cpu != PROCESSOR_EV6) - { - warning ("fp software completion requires -mtrap-precision=i"); - alpha_tp = ALPHA_TP_INSN; - } - - if (TARGET_FLOAT_VAX) - { - if (alpha_fprm == ALPHA_FPRM_MINF || alpha_fprm == ALPHA_FPRM_DYN) - { - warning ("rounding mode not supported for VAX floats"); - alpha_fprm = ALPHA_FPRM_NORM; - } - if (alpha_fptm == ALPHA_FPTM_SUI) - { - warning ("trap mode not supported for VAX floats"); - alpha_fptm = ALPHA_FPTM_SU; - } - } - - { - char *end; - int lat; - - if (!alpha_mlat_string) - alpha_mlat_string = "L1"; - - if (ISDIGIT ((unsigned char)alpha_mlat_string[0]) - && (lat = strtol (alpha_mlat_string, &end, 10), *end == '\0')) - ; - else if ((alpha_mlat_string[0] == 'L' || alpha_mlat_string[0] == 'l') - && ISDIGIT ((unsigned char)alpha_mlat_string[1]) - && alpha_mlat_string[2] == '\0') - { - static int const cache_latency[][4] = - { - { 3, 30, -1 }, /* ev4 -- Bcache is a guess */ - { 2, 12, 38 }, /* ev5 -- Bcache from PC164 LMbench numbers */ - { 3, 13, -1 }, /* ev6 -- Ho hum, doesn't exist yet */ - }; - - lat = alpha_mlat_string[1] - '0'; - if (lat < 0 || lat > 3 || cache_latency[alpha_cpu][lat-1] == -1) - { - warning ("L%d cache latency unknown for %s", - lat, alpha_cpu_name[alpha_cpu]); - lat = 3; - } - else - lat = cache_latency[alpha_cpu][lat-1]; - } - else if (! strcmp (alpha_mlat_string, "main")) - { - /* Most current memories have about 370ns latency. This is - a reasonable guess for a fast cpu. */ - lat = 150; - } - else - { - warning ("bad value `%s' for -mmemory-latency", alpha_mlat_string); - lat = 3; - } - - alpha_memory_latency = lat; - } - - /* Default the definition of "small data" to 8 bytes. */ - if (!g_switch_set) - g_switch_value = 8; - - /* Acquire a unique set number for our register saves and restores. */ - alpha_sr_alias_set = new_alias_set (); -} - -/* Returns 1 if VALUE is a mask that contains full bytes of zero or ones. */ - -int -zap_mask (value) - HOST_WIDE_INT value; -{ - int i; - - for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; - i++, value >>= 8) - if ((value & 0xff) != 0 && (value & 0xff) != 0xff) - return 0; - - return 1; -} - -/* Returns 1 if OP is either the constant zero or a register. If a - register, it must be in the proper mode unless MODE is VOIDmode. */ - -int -reg_or_0_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - return op == const0_rtx || register_operand (op, mode); -} - -/* Return 1 if OP is a constant in the range of 0-63 (for a shift) or - any register. */ - -int -reg_or_6bit_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - return ((GET_CODE (op) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (op) < 64) - || register_operand (op, mode)); -} - - -/* Return 1 if OP is an 8-bit constant or any register. */ - -int -reg_or_8bit_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - return ((GET_CODE (op) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (op) < 0x100) - || register_operand (op, mode)); -} - -/* Return 1 if OP is an 8-bit constant. */ - -int -cint8_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return ((GET_CODE (op) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (op) < 0x100)); -} - -/* Return 1 if the operand is a valid second operand to an add insn. */ - -int -add_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - if (GET_CODE (op) == CONST_INT) - /* Constraints I, J, O and P are covered by K. */ - return (CONST_OK_FOR_LETTER_P (INTVAL (op), 'K') - || CONST_OK_FOR_LETTER_P (INTVAL (op), 'L')); - - return register_operand (op, mode); -} - -/* Return 1 if the operand is a valid second operand to a sign-extending - add insn. */ - -int -sext_add_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - if (GET_CODE (op) == CONST_INT) - return (CONST_OK_FOR_LETTER_P (INTVAL (op), 'I') - || CONST_OK_FOR_LETTER_P (INTVAL (op), 'O')); - - return register_operand (op, mode); -} - -/* Return 1 if OP is the constant 4 or 8. */ - -int -const48_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == CONST_INT - && (INTVAL (op) == 4 || INTVAL (op) == 8)); -} - -/* Return 1 if OP is a valid first operand to an AND insn. */ - -int -and_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode) - return (zap_mask (CONST_DOUBLE_LOW (op)) - && zap_mask (CONST_DOUBLE_HIGH (op))); - - if (GET_CODE (op) == CONST_INT) - return ((unsigned HOST_WIDE_INT) INTVAL (op) < 0x100 - || (unsigned HOST_WIDE_INT) ~ INTVAL (op) < 0x100 - || zap_mask (INTVAL (op))); - - return register_operand (op, mode); -} - -/* Return 1 if OP is a valid first operand to an IOR or XOR insn. */ - -int -or_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - if (GET_CODE (op) == CONST_INT) - return ((unsigned HOST_WIDE_INT) INTVAL (op) < 0x100 - || (unsigned HOST_WIDE_INT) ~ INTVAL (op) < 0x100); - - return register_operand (op, mode); -} - -/* Return 1 if OP is a constant that is the width, in bits, of an integral - mode smaller than DImode. */ - -int -mode_width_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == CONST_INT - && (INTVAL (op) == 8 || INTVAL (op) == 16 - || INTVAL (op) == 32 || INTVAL (op) == 64)); -} - -/* Return 1 if OP is a constant that is the width of an integral machine mode - smaller than an integer. */ - -int -mode_mask_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ -#if HOST_BITS_PER_WIDE_INT == 32 - if (GET_CODE (op) == CONST_DOUBLE) - return (CONST_DOUBLE_LOW (op) == -1 - && (CONST_DOUBLE_HIGH (op) == -1 - || CONST_DOUBLE_HIGH (op) == 0)); -#else - if (GET_CODE (op) == CONST_DOUBLE) - return (CONST_DOUBLE_LOW (op) == -1 && CONST_DOUBLE_HIGH (op) == 0); -#endif - - return (GET_CODE (op) == CONST_INT - && (INTVAL (op) == 0xff - || INTVAL (op) == 0xffff - || INTVAL (op) == (HOST_WIDE_INT)0xffffffff -#if HOST_BITS_PER_WIDE_INT == 64 - || INTVAL (op) == -1 -#endif - )); -} - -/* Return 1 if OP is a multiple of 8 less than 64. */ - -int -mul8_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (op) < 64 - && (INTVAL (op) & 7) == 0); -} - -/* Return 1 if OP is the constant zero in floating-point. */ - -int -fp0_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - return (GET_MODE (op) == mode - && GET_MODE_CLASS (mode) == MODE_FLOAT && op == CONST0_RTX (mode)); -} - -/* Return 1 if OP is the floating-point constant zero or a register. */ - -int -reg_or_fp0_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - return fp0_operand (op, mode) || register_operand (op, mode); -} - -/* Return 1 if OP is a hard floating-point register. */ - -int -hard_fp_register_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - return ((GET_CODE (op) == REG && REGNO_REG_CLASS (REGNO (op)) == FLOAT_REGS) - || (GET_CODE (op) == SUBREG - && hard_fp_register_operand (SUBREG_REG (op), mode))); -} - -/* Return 1 if OP is a register or a constant integer. */ - - -int -reg_or_cint_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - return (GET_CODE (op) == CONST_INT - || register_operand (op, mode)); -} - -/* Return 1 if OP is something that can be reloaded into a register; - if it is a MEM, it need not be valid. */ - -int -some_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) - return 0; - - switch (GET_CODE (op)) - { - case REG: case MEM: case CONST_DOUBLE: case CONST_INT: case LABEL_REF: - case SYMBOL_REF: case CONST: - return 1; - - case SUBREG: - return some_operand (SUBREG_REG (op), VOIDmode); - - default: - break; - } - - return 0; -} - -/* Return 1 if OP is a valid operand for the source of a move insn. */ - -int -input_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) - return 0; - - if (GET_MODE_CLASS (mode) == MODE_FLOAT && GET_MODE (op) != mode) - return 0; - - switch (GET_CODE (op)) - { - case LABEL_REF: - case SYMBOL_REF: - case CONST: - /* This handles both the Windows/NT and OSF cases. */ - return mode == ptr_mode || mode == DImode; - - case REG: - return 1; - - case SUBREG: - if (register_operand (op, mode)) - return 1; - /* ... fall through ... */ - case MEM: - return ((TARGET_BWX || (mode != HImode && mode != QImode)) - && general_operand (op, mode)); - - case CONST_DOUBLE: - return GET_MODE_CLASS (mode) == MODE_FLOAT && op == CONST0_RTX (mode); - - case CONST_INT: - return mode == QImode || mode == HImode || add_operand (op, mode); - - case CONSTANT_P_RTX: - return 1; - - default: - break; - } - - return 0; -} - -/* Return 1 if OP is a SYMBOL_REF for a function known to be in this - file. */ - -int -current_file_function_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == SYMBOL_REF - && ! profile_flag && ! profile_block_flag - && (SYMBOL_REF_FLAG (op) - || op == XEXP (DECL_RTL (current_function_decl), 0))); -} - -/* Return 1 if OP is a valid operand for the MEM of a CALL insn. */ - -int -call_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - if (mode != Pmode) - return 0; - - return (GET_CODE (op) == SYMBOL_REF - || (GET_CODE (op) == REG - && (TARGET_OPEN_VMS || TARGET_WINDOWS_NT || REGNO (op) == 27))); -} - -/* Return 1 if OP is a valid Alpha comparison operator. Here we know which - comparisons are valid in which insn. */ - -int -alpha_comparison_operator (op, mode) - register rtx op; - enum machine_mode mode; -{ - enum rtx_code code = GET_CODE (op); - - if (mode != GET_MODE (op) || GET_RTX_CLASS (code) != '<') - return 0; - - return (code == EQ || code == LE || code == LT - || (mode == DImode && (code == LEU || code == LTU))); -} - -/* Return 1 if OP is a valid Alpha swapped comparison operator. */ - -int -alpha_swapped_comparison_operator (op, mode) - register rtx op; - enum machine_mode mode; -{ - enum rtx_code code = GET_CODE (op); - - if (mode != GET_MODE (op) || GET_RTX_CLASS (code) != '<') - return 0; - - code = swap_condition (code); - return (code == EQ || code == LE || code == LT - || (mode == DImode && (code == LEU || code == LTU))); -} - -/* Return 1 if OP is a signed comparison operation. */ - -int -signed_comparison_operator (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - switch (GET_CODE (op)) - { - case EQ: case NE: case LE: case LT: case GE: case GT: - return 1; - - default: - break; - } - - return 0; -} - -/* Return 1 if this is a divide or modulus operator. */ - -int -divmod_operator (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - switch (GET_CODE (op)) - { - case DIV: case MOD: case UDIV: case UMOD: - return 1; - - default: - break; - } - - return 0; -} - -/* Return 1 if this memory address is a known aligned register plus - a constant. It must be a valid address. This means that we can do - this as an aligned reference plus some offset. - - Take into account what reload will do. */ - -int -aligned_memory_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - rtx base; - - if (reload_in_progress) - { - rtx tmp = op; - if (GET_CODE (tmp) == SUBREG) - tmp = SUBREG_REG (tmp); - if (GET_CODE (tmp) == REG - && REGNO (tmp) >= FIRST_PSEUDO_REGISTER) - { - op = reg_equiv_memory_loc[REGNO (tmp)]; - if (op == 0) - return 0; - } - } - - if (GET_CODE (op) != MEM - || GET_MODE (op) != mode) - return 0; - op = XEXP (op, 0); - - /* LEGITIMIZE_RELOAD_ADDRESS creates (plus (plus reg const_hi) const_lo) - sorts of constructs. Dig for the real base register. */ - if (reload_in_progress - && GET_CODE (op) == PLUS - && GET_CODE (XEXP (op, 0)) == PLUS) - base = XEXP (XEXP (op, 0), 0); - else - { - if (! memory_address_p (mode, op)) - return 0; - base = (GET_CODE (op) == PLUS ? XEXP (op, 0) : op); - } - - return (GET_CODE (base) == REG - && REGNO_POINTER_ALIGN (REGNO (base)) >= 4); -} - -/* Similar, but return 1 if OP is a MEM which is not alignable. */ - -int -unaligned_memory_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - rtx base; - - if (reload_in_progress) - { - rtx tmp = op; - if (GET_CODE (tmp) == SUBREG) - tmp = SUBREG_REG (tmp); - if (GET_CODE (tmp) == REG - && REGNO (tmp) >= FIRST_PSEUDO_REGISTER) - { - op = reg_equiv_memory_loc[REGNO (tmp)]; - if (op == 0) - return 0; - } - } - - if (GET_CODE (op) != MEM - || GET_MODE (op) != mode) - return 0; - op = XEXP (op, 0); - - /* LEGITIMIZE_RELOAD_ADDRESS creates (plus (plus reg const_hi) const_lo) - sorts of constructs. Dig for the real base register. */ - if (reload_in_progress - && GET_CODE (op) == PLUS - && GET_CODE (XEXP (op, 0)) == PLUS) - base = XEXP (XEXP (op, 0), 0); - else - { - if (! memory_address_p (mode, op)) - return 0; - base = (GET_CODE (op) == PLUS ? XEXP (op, 0) : op); - } - - return (GET_CODE (base) == REG - && REGNO_POINTER_ALIGN (REGNO (base)) < 4); -} - -/* Return 1 if OP is either a register or an unaligned memory location. */ - -int -reg_or_unaligned_mem_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return register_operand (op, mode) || unaligned_memory_operand (op, mode); -} - -/* Return 1 if OP is any memory location. During reload a pseudo matches. */ - -int -any_memory_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == MEM - || (GET_CODE (op) == SUBREG && GET_CODE (SUBREG_REG (op)) == REG) - || (reload_in_progress && GET_CODE (op) == REG - && REGNO (op) >= FIRST_PSEUDO_REGISTER) - || (reload_in_progress && GET_CODE (op) == SUBREG - && GET_CODE (SUBREG_REG (op)) == REG - && REGNO (SUBREG_REG (op)) >= FIRST_PSEUDO_REGISTER)); -} - -/* Returns 1 if OP is not an eliminable register. - - This exists to cure a pathological abort in the s8addq (et al) patterns, - - long foo () { long t; bar(); return (long) &t * 26107; } - - which run afoul of a hack in reload to cure a (presumably) similar - problem with lea-type instructions on other targets. But there is - one of us and many of them, so work around the problem by selectively - preventing combine from making the optimization. */ - -int -reg_not_elim_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - rtx inner = op; - if (GET_CODE (op) == SUBREG) - inner = SUBREG_REG (op); - if (inner == frame_pointer_rtx || inner == arg_pointer_rtx) - return 0; - - return register_operand (op, mode); -} - -/* Return 1 is OP is a memory location that is not a reference (using - an AND) to an unaligned location. Take into account what reload - will do. */ - -int -normal_memory_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - if (reload_in_progress) - { - rtx tmp = op; - if (GET_CODE (tmp) == SUBREG) - tmp = SUBREG_REG (tmp); - if (GET_CODE (tmp) == REG - && REGNO (tmp) >= FIRST_PSEUDO_REGISTER) - { - op = reg_equiv_memory_loc[REGNO (tmp)]; - - /* This may not have been assigned an equivalent address if it will - be eliminated. In that case, it doesn't matter what we do. */ - if (op == 0) - return 1; - } - } - - return GET_CODE (op) == MEM && GET_CODE (XEXP (op, 0)) != AND; -} - -/* Accept a register, but not a subreg of any kind. This allows us to - avoid pathological cases in reload wrt data movement common in - int->fp conversion. */ - -int -reg_no_subreg_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - if (GET_CODE (op) == SUBREG) - return 0; - return register_operand (op, mode); -} - -/* Return 1 if this function can directly return via $26. */ - -int -direct_return () -{ - return (! TARGET_OPEN_VMS && reload_completed && alpha_sa_size () == 0 - && get_frame_size () == 0 - && current_function_outgoing_args_size == 0 - && current_function_pretend_args_size == 0); -} - -/* REF is an alignable memory location. Place an aligned SImode - reference into *PALIGNED_MEM and the number of bits to shift into - *PBITNUM. SCRATCH is a free register for use in reloading out - of range stack slots. */ - -void -get_aligned_mem (ref, paligned_mem, pbitnum) - rtx ref; - rtx *paligned_mem, *pbitnum; -{ - rtx base; - HOST_WIDE_INT offset = 0; - - if (GET_CODE (ref) != MEM) - abort (); - - if (reload_in_progress - && ! memory_address_p (GET_MODE (ref), XEXP (ref, 0))) - { - base = find_replacement (&XEXP (ref, 0)); - - if (! memory_address_p (GET_MODE (ref), base)) - abort (); - } - else - { - base = XEXP (ref, 0); - } - - if (GET_CODE (base) == PLUS) - offset += INTVAL (XEXP (base, 1)), base = XEXP (base, 0); - - *paligned_mem = gen_rtx_MEM (SImode, plus_constant (base, offset & ~3)); - MEM_COPY_ATTRIBUTES (*paligned_mem, ref); - RTX_UNCHANGING_P (*paligned_mem) = RTX_UNCHANGING_P (ref); - - /* Sadly, we cannot use alias sets here because we may overlap other - data in a different alias set. */ - /* MEM_ALIAS_SET (*paligned_mem) = MEM_ALIAS_SET (ref); */ - - *pbitnum = GEN_INT ((offset & 3) * 8); -} - -/* Similar, but just get the address. Handle the two reload cases. - Add EXTRA_OFFSET to the address we return. */ - -rtx -get_unaligned_address (ref, extra_offset) - rtx ref; - int extra_offset; -{ - rtx base; - HOST_WIDE_INT offset = 0; - - if (GET_CODE (ref) != MEM) - abort (); - - if (reload_in_progress - && ! memory_address_p (GET_MODE (ref), XEXP (ref, 0))) - { - base = find_replacement (&XEXP (ref, 0)); - - if (! memory_address_p (GET_MODE (ref), base)) - abort (); - } - else - { - base = XEXP (ref, 0); - } - - if (GET_CODE (base) == PLUS) - offset += INTVAL (XEXP (base, 1)), base = XEXP (base, 0); - - return plus_constant (base, offset + extra_offset); -} - -/* Subfunction of the following function. Update the flags of any MEM - found in part of X. */ - -static void -alpha_set_memflags_1 (x, in_struct_p, volatile_p, unchanging_p) - rtx x; - int in_struct_p, volatile_p, unchanging_p; -{ - int i; - - switch (GET_CODE (x)) - { - case SEQUENCE: - case PARALLEL: - for (i = XVECLEN (x, 0) - 1; i >= 0; i--) - alpha_set_memflags_1 (XVECEXP (x, 0, i), in_struct_p, volatile_p, - unchanging_p); - break; - - case INSN: - alpha_set_memflags_1 (PATTERN (x), in_struct_p, volatile_p, - unchanging_p); - break; - - case SET: - alpha_set_memflags_1 (SET_DEST (x), in_struct_p, volatile_p, - unchanging_p); - alpha_set_memflags_1 (SET_SRC (x), in_struct_p, volatile_p, - unchanging_p); - break; - - case MEM: - MEM_IN_STRUCT_P (x) = in_struct_p; - MEM_VOLATILE_P (x) = volatile_p; - RTX_UNCHANGING_P (x) = unchanging_p; - /* Sadly, we cannot use alias sets because the extra aliasing - produced by the AND interferes. Given that two-byte quantities - are the only thing we would be able to differentiate anyway, - there does not seem to be any point in convoluting the early - out of the alias check. */ - /* MEM_ALIAS_SET (x) = alias_set; */ - break; - - default: - break; - } -} - -/* Given INSN, which is either an INSN or a SEQUENCE generated to - perform a memory operation, look for any MEMs in either a SET_DEST or - a SET_SRC and copy the in-struct, unchanging, and volatile flags from - REF into each of the MEMs found. If REF is not a MEM, don't do - anything. */ - -void -alpha_set_memflags (insn, ref) - rtx insn; - rtx ref; -{ - int in_struct_p, volatile_p, unchanging_p; - - if (GET_CODE (ref) != MEM) - return; - - in_struct_p = MEM_IN_STRUCT_P (ref); - volatile_p = MEM_VOLATILE_P (ref); - unchanging_p = RTX_UNCHANGING_P (ref); - - /* This is only called from alpha.md, after having had something - generated from one of the insn patterns. So if everything is - zero, the pattern is already up-to-date. */ - if (! in_struct_p && ! volatile_p && ! unchanging_p) - return; - - alpha_set_memflags_1 (insn, in_struct_p, volatile_p, unchanging_p); -} - -/* Try to output insns to set TARGET equal to the constant C if it can be - done in less than N insns. Do all computations in MODE. Returns the place - where the output has been placed if it can be done and the insns have been - emitted. If it would take more than N insns, zero is returned and no - insns and emitted. */ - -rtx -alpha_emit_set_const (target, mode, c, n) - rtx target; - enum machine_mode mode; - HOST_WIDE_INT c; - int n; -{ - rtx pat; - int i; - - /* Try 1 insn, then 2, then up to N. */ - for (i = 1; i <= n; i++) - if ((pat = alpha_emit_set_const_1 (target, mode, c, i)) != 0) - return pat; - - return 0; -} - -/* Internal routine for the above to check for N or below insns. */ - -static rtx -alpha_emit_set_const_1 (target, mode, c, n) - rtx target; - enum machine_mode mode; - HOST_WIDE_INT c; - int n; -{ - HOST_WIDE_INT new = c; - int i, bits; - /* Use a pseudo if highly optimizing and still generating RTL. */ - rtx subtarget - = (flag_expensive_optimizations && rtx_equal_function_value_matters - ? 0 : target); - rtx temp; - -#if HOST_BITS_PER_WIDE_INT == 64 - /* We are only called for SImode and DImode. If this is SImode, ensure that - we are sign extended to a full word. This does not make any sense when - cross-compiling on a narrow machine. */ - - if (mode == SImode) - c = (c & 0xffffffff) - 2 * (c & 0x80000000); -#endif - - /* If this is a sign-extended 32-bit constant, we can do this in at most - three insns, so do it if we have enough insns left. We always have - a sign-extended 32-bit constant when compiling on a narrow machine. */ - - if (HOST_BITS_PER_WIDE_INT != 64 - || c >> 31 == -1 || c >> 31 == 0) - { - HOST_WIDE_INT low = (c & 0xffff) - 2 * (c & 0x8000); - HOST_WIDE_INT tmp1 = c - low; - HOST_WIDE_INT high - = ((tmp1 >> 16) & 0xffff) - 2 * ((tmp1 >> 16) & 0x8000); - HOST_WIDE_INT extra = 0; - - /* If HIGH will be interpreted as negative but the constant is - positive, we must adjust it to do two ldha insns. */ - - if ((high & 0x8000) != 0 && c >= 0) - { - extra = 0x4000; - tmp1 -= 0x40000000; - high = ((tmp1 >> 16) & 0xffff) - 2 * ((tmp1 >> 16) & 0x8000); - } - - if (c == low || (low == 0 && extra == 0)) - { - /* We used to use copy_to_suggested_reg (GEN_INT (c), target, mode) - but that meant that we can't handle INT_MIN on 32-bit machines - (like NT/Alpha), because we recurse indefinitely through - emit_move_insn to gen_movdi. So instead, since we know exactly - what we want, create it explicitly. */ - - if (target == NULL) - target = gen_reg_rtx (mode); - emit_insn (gen_rtx_SET (VOIDmode, target, GEN_INT (c))); - return target; - } - else if (n >= 2 + (extra != 0)) - { - temp = copy_to_suggested_reg (GEN_INT (low), subtarget, mode); - - if (extra != 0) - temp = expand_binop (mode, add_optab, temp, GEN_INT (extra << 16), - subtarget, 0, OPTAB_WIDEN); - - return expand_binop (mode, add_optab, temp, GEN_INT (high << 16), - target, 0, OPTAB_WIDEN); - } - } - - /* If we couldn't do it that way, try some other methods. But if we have - no instructions left, don't bother. Likewise, if this is SImode and - we can't make pseudos, we can't do anything since the expand_binop - and expand_unop calls will widen and try to make pseudos. */ - - if (n == 1 - || (mode == SImode && ! rtx_equal_function_value_matters)) - return 0; - -#if HOST_BITS_PER_WIDE_INT == 64 - /* First, see if can load a value into the target that is the same as the - constant except that all bytes that are 0 are changed to be 0xff. If we - can, then we can do a ZAPNOT to obtain the desired constant. */ - - for (i = 0; i < 64; i += 8) - if ((new & ((HOST_WIDE_INT) 0xff << i)) == 0) - new |= (HOST_WIDE_INT) 0xff << i; - - /* We are only called for SImode and DImode. If this is SImode, ensure that - we are sign extended to a full word. */ - - if (mode == SImode) - new = (new & 0xffffffff) - 2 * (new & 0x80000000); - - if (new != c - && (temp = alpha_emit_set_const (subtarget, mode, new, n - 1)) != 0) - return expand_binop (mode, and_optab, temp, GEN_INT (c | ~ new), - target, 0, OPTAB_WIDEN); -#endif - - /* Next, see if we can load a related constant and then shift and possibly - negate it to get the constant we want. Try this once each increasing - numbers of insns. */ - - for (i = 1; i < n; i++) - { - /* First try complementing. */ - if ((temp = alpha_emit_set_const (subtarget, mode, ~ c, i)) != 0) - return expand_unop (mode, one_cmpl_optab, temp, target, 0); - - /* Next try to form a constant and do a left shift. We can do this - if some low-order bits are zero; the exact_log2 call below tells - us that information. The bits we are shifting out could be any - value, but here we'll just try the 0- and sign-extended forms of - the constant. To try to increase the chance of having the same - constant in more than one insn, start at the highest number of - bits to shift, but try all possibilities in case a ZAPNOT will - be useful. */ - - if ((bits = exact_log2 (c & - c)) > 0) - for (; bits > 0; bits--) - if ((temp = (alpha_emit_set_const - (subtarget, mode, - (unsigned HOST_WIDE_INT) (c >> bits), i))) != 0 - || ((temp = (alpha_emit_set_const - (subtarget, mode, - ((unsigned HOST_WIDE_INT) c) >> bits, i))) - != 0)) - return expand_binop (mode, ashl_optab, temp, GEN_INT (bits), - target, 0, OPTAB_WIDEN); - - /* Now try high-order zero bits. Here we try the shifted-in bits as - all zero and all ones. Be careful to avoid shifting outside the - mode and to avoid shifting outside the host wide int size. */ - /* On narrow hosts, don't shift a 1 into the high bit, since we'll - confuse the recursive call and set all of the high 32 bits. */ - - if ((bits = (MIN (HOST_BITS_PER_WIDE_INT, GET_MODE_SIZE (mode) * 8) - - floor_log2 (c) - 1 - (HOST_BITS_PER_WIDE_INT < 64))) > 0) - for (; bits > 0; bits--) - if ((temp = alpha_emit_set_const (subtarget, mode, - c << bits, i)) != 0 - || ((temp = (alpha_emit_set_const - (subtarget, mode, - ((c << bits) | (((HOST_WIDE_INT) 1 << bits) - 1)), - i))) - != 0)) - return expand_binop (mode, lshr_optab, temp, GEN_INT (bits), - target, 1, OPTAB_WIDEN); - - /* Now try high-order 1 bits. We get that with a sign-extension. - But one bit isn't enough here. Be careful to avoid shifting outside - the mode and to avoid shifting outside the host wide int size. */ - - if ((bits = (MIN (HOST_BITS_PER_WIDE_INT, GET_MODE_SIZE (mode) * 8) - - floor_log2 (~ c) - 2)) > 0) - for (; bits > 0; bits--) - if ((temp = alpha_emit_set_const (subtarget, mode, - c << bits, i)) != 0 - || ((temp = (alpha_emit_set_const - (subtarget, mode, - ((c << bits) | (((HOST_WIDE_INT) 1 << bits) - 1)), - i))) - != 0)) - return expand_binop (mode, ashr_optab, temp, GEN_INT (bits), - target, 0, OPTAB_WIDEN); - } - - return 0; -} - -/* Having failed to find a 3 insn sequence in alpha_emit_set_const, - fall back to a straight forward decomposition. We do this to avoid - exponential run times encountered when looking for longer sequences - with alpha_emit_set_const. */ - -rtx -alpha_emit_set_long_const (target, c1, c2) - rtx target; - HOST_WIDE_INT c1, c2; -{ - HOST_WIDE_INT d1, d2, d3, d4; - - /* Decompose the entire word */ -#if HOST_BITS_PER_WIDE_INT >= 64 - if (c2 != -(c1 < 0)) - abort (); - d1 = ((c1 & 0xffff) ^ 0x8000) - 0x8000; - c1 -= d1; - d2 = ((c1 & 0xffffffff) ^ 0x80000000) - 0x80000000; - c1 = (c1 - d2) >> 32; - d3 = ((c1 & 0xffff) ^ 0x8000) - 0x8000; - c1 -= d3; - d4 = ((c1 & 0xffffffff) ^ 0x80000000) - 0x80000000; - if (c1 != d4) - abort (); -#else - d1 = ((c1 & 0xffff) ^ 0x8000) - 0x8000; - c1 -= d1; - d2 = ((c1 & 0xffffffff) ^ 0x80000000) - 0x80000000; - if (c1 != d2) - abort (); - c2 += (d2 < 0); - d3 = ((c2 & 0xffff) ^ 0x8000) - 0x8000; - c2 -= d3; - d4 = ((c2 & 0xffffffff) ^ 0x80000000) - 0x80000000; - if (c2 != d4) - abort (); -#endif - - /* Construct the high word */ - if (d4) - { - emit_move_insn (target, GEN_INT (d4)); - if (d3) - emit_move_insn (target, gen_rtx_PLUS (DImode, target, GEN_INT (d3))); - } - else - emit_move_insn (target, GEN_INT (d3)); - - /* Shift it into place */ - emit_move_insn (target, gen_rtx_ASHIFT (DImode, target, GEN_INT (32))); - - /* Add in the low bits. */ - if (d2) - emit_move_insn (target, gen_rtx_PLUS (DImode, target, GEN_INT (d2))); - if (d1) - emit_move_insn (target, gen_rtx_PLUS (DImode, target, GEN_INT (d1))); - - return target; -} - -/* Generate the comparison for a conditional branch. */ - -rtx -alpha_emit_conditional_branch (code) - enum rtx_code code; -{ - enum rtx_code cmp_code, branch_code; - enum machine_mode cmp_mode, branch_mode = VOIDmode; - rtx op0 = alpha_compare_op0, op1 = alpha_compare_op1; - rtx tem; - - /* The general case: fold the comparison code to the types of compares - that we have, choosing the branch as necessary. */ - switch (code) - { - case EQ: case LE: case LT: case LEU: case LTU: - /* We have these compares: */ - cmp_code = code, branch_code = NE; - break; - - case NE: - /* This must be reversed. */ - cmp_code = EQ, branch_code = EQ; - break; - - case GE: case GT: case GEU: case GTU: - /* For FP, we swap them, for INT, we reverse them. */ - if (alpha_compare_fp_p) - { - cmp_code = swap_condition (code); - branch_code = NE; - tem = op0, op0 = op1, op1 = tem; - } - else - { - cmp_code = reverse_condition (code); - branch_code = EQ; - } - break; - - default: - abort (); - } - - if (alpha_compare_fp_p) - { - cmp_mode = DFmode; - if (flag_fast_math) - { - /* When we are not as concerned about non-finite values, and we - are comparing against zero, we can branch directly. */ - if (op1 == CONST0_RTX (DFmode)) - cmp_code = NIL, branch_code = code; - else if (op0 == CONST0_RTX (DFmode)) - { - /* Undo the swap we probably did just above. */ - tem = op0, op0 = op1, op1 = tem; - branch_code = swap_condition (cmp_code); - cmp_code = NIL; - } - } - else - { - /* ??? We mark the the branch mode to be CCmode to prevent the - compare and branch from being combined, since the compare - insn follows IEEE rules that the branch does not. */ - branch_mode = CCmode; - } - } - else - { - cmp_mode = DImode; - - /* The following optimizations are only for signed compares. */ - if (code != LEU && code != LTU && code != GEU && code != GTU) - { - /* Whee. Compare and branch against 0 directly. */ - if (op1 == const0_rtx) - cmp_code = NIL, branch_code = code; - - /* We want to use cmpcc/bcc when we can, since there is a zero delay - bypass between logicals and br/cmov on EV5. But we don't want to - force valid immediate constants into registers needlessly. */ - else if (GET_CODE (op1) == CONST_INT) - { - HOST_WIDE_INT v = INTVAL (op1), n = -v; - - if (! CONST_OK_FOR_LETTER_P (v, 'I') - && (CONST_OK_FOR_LETTER_P (n, 'K') - || CONST_OK_FOR_LETTER_P (n, 'L'))) - { - cmp_code = PLUS, branch_code = code; - op1 = GEN_INT (n); - } - } - } - } - - /* Force op0 into a register. */ - if (GET_CODE (op0) != REG) - op0 = force_reg (cmp_mode, op0); - - /* Emit an initial compare instruction, if necessary. */ - tem = op0; - if (cmp_code != NIL) - { - tem = gen_reg_rtx (cmp_mode); - emit_move_insn (tem, gen_rtx_fmt_ee (cmp_code, cmp_mode, op0, op1)); - } - - /* Return the branch comparison. */ - return gen_rtx_fmt_ee (branch_code, branch_mode, tem, CONST0_RTX (cmp_mode)); -} - - -/* Rewrite a comparison against zero CMP of the form - (CODE (cc0) (const_int 0)) so it can be written validly in - a conditional move (if_then_else CMP ...). - If both of the operands that set cc0 are non-zero we must emit - an insn to perform the compare (it can't be done within - the conditional move). */ -rtx -alpha_emit_conditional_move (cmp, mode) - rtx cmp; - enum machine_mode mode; -{ - enum rtx_code code = GET_CODE (cmp); - enum rtx_code cmov_code = NE; - rtx op0 = alpha_compare_op0; - rtx op1 = alpha_compare_op1; - enum machine_mode cmp_mode - = (GET_MODE (op0) == VOIDmode ? DImode : GET_MODE (op0)); - enum machine_mode cmp_op_mode = alpha_compare_fp_p ? DFmode : DImode; - enum machine_mode cmov_mode = VOIDmode; - rtx tem; - - if (alpha_compare_fp_p != FLOAT_MODE_P (mode)) - return 0; - - /* We may be able to use a conditional move directly. - This avoids emitting spurious compares. */ - if (signed_comparison_operator (cmp, cmp_op_mode) - && (!alpha_compare_fp_p || flag_fast_math) - && (op0 == CONST0_RTX (cmp_mode) || op1 == CONST0_RTX (cmp_mode))) - return gen_rtx_fmt_ee (code, VOIDmode, op0, op1); - - /* We can't put the comparison insides a conditional move; - emit a compare instruction and put that inside the - conditional move. Make sure we emit only comparisons we have; - swap or reverse as necessary. */ - - switch (code) - { - case EQ: case LE: case LT: case LEU: case LTU: - /* We have these compares: */ - break; - - case NE: - /* This must be reversed. */ - code = reverse_condition (code); - cmov_code = EQ; - break; - - case GE: case GT: case GEU: case GTU: - /* These must be swapped. Make sure the new first operand is in - a register. */ - code = swap_condition (code); - tem = op0, op0 = op1, op1 = tem; - op0 = force_reg (cmp_mode, op0); - break; - - default: - abort (); - } - - /* ??? We mark the branch mode to be CCmode to prevent the compare - and cmov from being combined, since the compare insn follows IEEE - rules that the cmov does not. */ - if (alpha_compare_fp_p && !flag_fast_math) - cmov_mode = CCmode; - - tem = gen_reg_rtx (cmp_op_mode); - emit_move_insn (tem, gen_rtx_fmt_ee (code, cmp_op_mode, op0, op1)); - return gen_rtx_fmt_ee (cmov_code, cmov_mode, tem, CONST0_RTX (cmp_op_mode)); -} - -/* Use ext[wlq][lh] as the Architecture Handbook describes for extracting - unaligned data: - - unsigned: signed: - word: ldq_u r1,X(r11) ldq_u r1,X(r11) - ldq_u r2,X+1(r11) ldq_u r2,X+1(r11) - lda r3,X(r11) lda r3,X+2(r11) - extwl r1,r3,r1 extql r1,r3,r1 - extwh r2,r3,r2 extqh r2,r3,r2 - or r1.r2.r1 or r1,r2,r1 - sra r1,48,r1 - - long: ldq_u r1,X(r11) ldq_u r1,X(r11) - ldq_u r2,X+3(r11) ldq_u r2,X+3(r11) - lda r3,X(r11) lda r3,X(r11) - extll r1,r3,r1 extll r1,r3,r1 - extlh r2,r3,r2 extlh r2,r3,r2 - or r1.r2.r1 addl r1,r2,r1 - - quad: ldq_u r1,X(r11) - ldq_u r2,X+7(r11) - lda r3,X(r11) - extql r1,r3,r1 - extqh r2,r3,r2 - or r1.r2.r1 -*/ - -void -alpha_expand_unaligned_load (tgt, mem, size, ofs, sign) - rtx tgt, mem; - HOST_WIDE_INT size, ofs; - int sign; -{ - rtx meml, memh, addr, extl, exth; - enum machine_mode mode; - - meml = gen_reg_rtx (DImode); - memh = gen_reg_rtx (DImode); - addr = gen_reg_rtx (DImode); - extl = gen_reg_rtx (DImode); - exth = gen_reg_rtx (DImode); - - emit_move_insn (meml, - change_address (mem, DImode, - gen_rtx_AND (DImode, - plus_constant (XEXP (mem, 0), - ofs), - GEN_INT (-8)))); - - emit_move_insn (memh, - change_address (mem, DImode, - gen_rtx_AND (DImode, - plus_constant (XEXP (mem, 0), - ofs + size - 1), - GEN_INT (-8)))); - - if (sign && size == 2) - { - emit_move_insn (addr, plus_constant (XEXP (mem, 0), ofs+2)); - - emit_insn (gen_extxl (extl, meml, GEN_INT (64), addr)); - emit_insn (gen_extqh (exth, memh, addr)); - - /* We must use tgt here for the target. Alpha-vms port fails if we use - addr for the target, because addr is marked as a pointer and combine - knows that pointers are always sign-extended 32 bit values. */ - addr = expand_binop (DImode, ior_optab, extl, exth, tgt, 1, OPTAB_WIDEN); - addr = expand_binop (DImode, ashr_optab, addr, GEN_INT (48), - addr, 1, OPTAB_WIDEN); - } - else - { - emit_move_insn (addr, plus_constant (XEXP (mem, 0), ofs)); - emit_insn (gen_extxl (extl, meml, GEN_INT (size*8), addr)); - switch (size) - { - case 2: - emit_insn (gen_extwh (exth, memh, addr)); - mode = HImode; - break; - - case 4: - emit_insn (gen_extlh (exth, memh, addr)); - mode = SImode; - break; - - case 8: - emit_insn (gen_extqh (exth, memh, addr)); - mode = DImode; - break; - default: - abort(); - } - - addr = expand_binop (mode, ior_optab, gen_lowpart (mode, extl), - gen_lowpart (mode, exth), gen_lowpart (mode, tgt), - sign, OPTAB_WIDEN); - } - - if (addr != tgt) - emit_move_insn (tgt, gen_lowpart(GET_MODE (tgt), addr)); -} - -/* Similarly, use ins and msk instructions to perform unaligned stores. */ - -void -alpha_expand_unaligned_store (dst, src, size, ofs) - rtx dst, src; - HOST_WIDE_INT size, ofs; -{ - rtx dstl, dsth, addr, insl, insh, meml, memh; - - dstl = gen_reg_rtx (DImode); - dsth = gen_reg_rtx (DImode); - insl = gen_reg_rtx (DImode); - insh = gen_reg_rtx (DImode); - - meml = change_address (dst, DImode, - gen_rtx_AND (DImode, - plus_constant (XEXP (dst, 0), ofs), - GEN_INT (-8))); - memh = change_address (dst, DImode, - gen_rtx_AND (DImode, - plus_constant (XEXP (dst, 0), - ofs+size-1), - GEN_INT (-8))); - - emit_move_insn (dsth, memh); - emit_move_insn (dstl, meml); - addr = copy_addr_to_reg (plus_constant (XEXP (dst, 0), ofs)); - - if (src != const0_rtx) - { - emit_insn (gen_insxh (insh, gen_lowpart (DImode, src), - GEN_INT (size*8), addr)); - - switch (size) - { - case 2: - emit_insn (gen_inswl (insl, gen_lowpart (HImode, src), addr)); - break; - case 4: - emit_insn (gen_insll (insl, gen_lowpart (SImode, src), addr)); - break; - case 8: - emit_insn (gen_insql (insl, src, addr)); - break; - } - } - - emit_insn (gen_mskxh (dsth, dsth, GEN_INT (size*8), addr)); - - switch (size) - { - case 2: - emit_insn (gen_mskxl (dstl, dstl, GEN_INT (0xffff), addr)); - break; - case 4: - emit_insn (gen_mskxl (dstl, dstl, GEN_INT (0xffffffff), addr)); - break; - case 8: - { -#if HOST_BITS_PER_WIDE_INT == 32 - rtx msk = immed_double_const (0xffffffff, 0xffffffff, DImode); -#else - rtx msk = immed_double_const (0xffffffffffffffff, 0, DImode); -#endif - emit_insn (gen_mskxl (dstl, dstl, msk, addr)); - } - break; - } - - if (src != const0_rtx) - { - dsth = expand_binop (DImode, ior_optab, insh, dsth, dsth, 0, OPTAB_WIDEN); - dstl = expand_binop (DImode, ior_optab, insl, dstl, dstl, 0, OPTAB_WIDEN); - } - - /* Must store high before low for degenerate case of aligned. */ - emit_move_insn (memh, dsth); - emit_move_insn (meml, dstl); -} - -/* The block move code tries to maximize speed by separating loads and - stores at the expense of register pressure: we load all of the data - before we store it back out. There are two secondary effects worth - mentioning, that this speeds copying to/from aligned and unaligned - buffers, and that it makes the code significantly easier to write. */ - -#define MAX_MOVE_WORDS 8 - -/* Load an integral number of consecutive unaligned quadwords. */ - -static void -alpha_expand_unaligned_load_words (out_regs, smem, words, ofs) - rtx *out_regs; - rtx smem; - HOST_WIDE_INT words, ofs; -{ - rtx const im8 = GEN_INT (-8); - rtx const i64 = GEN_INT (64); - rtx ext_tmps[MAX_MOVE_WORDS], data_regs[MAX_MOVE_WORDS+1]; - rtx sreg, areg; - HOST_WIDE_INT i; - - /* Generate all the tmp registers we need. */ - for (i = 0; i < words; ++i) - { - data_regs[i] = out_regs[i]; - ext_tmps[i] = gen_reg_rtx (DImode); - } - data_regs[words] = gen_reg_rtx (DImode); - - if (ofs != 0) - smem = change_address (smem, GET_MODE (smem), - plus_constant (XEXP (smem, 0), ofs)); - - /* Load up all of the source data. */ - for (i = 0; i < words; ++i) - { - emit_move_insn (data_regs[i], - change_address (smem, DImode, - gen_rtx_AND (DImode, - plus_constant (XEXP(smem,0), - 8*i), - im8))); - } - emit_move_insn (data_regs[words], - change_address (smem, DImode, - gen_rtx_AND (DImode, - plus_constant (XEXP(smem,0), - 8*words - 1), - im8))); - - /* Extract the half-word fragments. Unfortunately DEC decided to make - extxh with offset zero a noop instead of zeroing the register, so - we must take care of that edge condition ourselves with cmov. */ - - sreg = copy_addr_to_reg (XEXP (smem, 0)); - areg = expand_binop (DImode, and_optab, sreg, GEN_INT (7), NULL, - 1, OPTAB_WIDEN); - for (i = 0; i < words; ++i) - { - emit_insn (gen_extxl (data_regs[i], data_regs[i], i64, sreg)); - - emit_insn (gen_extqh (ext_tmps[i], data_regs[i+1], sreg)); - emit_insn (gen_rtx_SET (VOIDmode, ext_tmps[i], - gen_rtx_IF_THEN_ELSE (DImode, - gen_rtx_EQ (DImode, areg, - const0_rtx), - const0_rtx, ext_tmps[i]))); - } - - /* Merge the half-words into whole words. */ - for (i = 0; i < words; ++i) - { - out_regs[i] = expand_binop (DImode, ior_optab, data_regs[i], - ext_tmps[i], data_regs[i], 1, OPTAB_WIDEN); - } -} - -/* Store an integral number of consecutive unaligned quadwords. DATA_REGS - may be NULL to store zeros. */ - -static void -alpha_expand_unaligned_store_words (data_regs, dmem, words, ofs) - rtx *data_regs; - rtx dmem; - HOST_WIDE_INT words, ofs; -{ - rtx const im8 = GEN_INT (-8); - rtx const i64 = GEN_INT (64); -#if HOST_BITS_PER_WIDE_INT == 32 - rtx const im1 = immed_double_const (0xffffffff, 0xffffffff, DImode); -#else - rtx const im1 = immed_double_const (0xffffffffffffffff, 0, DImode); -#endif - rtx ins_tmps[MAX_MOVE_WORDS]; - rtx st_tmp_1, st_tmp_2, dreg; - rtx st_addr_1, st_addr_2; - HOST_WIDE_INT i; - - /* Generate all the tmp registers we need. */ - if (data_regs != NULL) - for (i = 0; i < words; ++i) - ins_tmps[i] = gen_reg_rtx(DImode); - st_tmp_1 = gen_reg_rtx(DImode); - st_tmp_2 = gen_reg_rtx(DImode); - - if (ofs != 0) - dmem = change_address (dmem, GET_MODE (dmem), - plus_constant (XEXP (dmem, 0), ofs)); - - - st_addr_2 = change_address (dmem, DImode, - gen_rtx_AND (DImode, - plus_constant (XEXP(dmem,0), - words*8 - 1), - im8)); - st_addr_1 = change_address (dmem, DImode, - gen_rtx_AND (DImode, - XEXP (dmem, 0), - im8)); - - /* Load up the destination end bits. */ - emit_move_insn (st_tmp_2, st_addr_2); - emit_move_insn (st_tmp_1, st_addr_1); - - /* Shift the input data into place. */ - dreg = copy_addr_to_reg (XEXP (dmem, 0)); - if (data_regs != NULL) - { - for (i = words-1; i >= 0; --i) - { - emit_insn (gen_insxh (ins_tmps[i], data_regs[i], i64, dreg)); - emit_insn (gen_insql (data_regs[i], data_regs[i], dreg)); - } - for (i = words-1; i > 0; --i) - { - ins_tmps[i-1] = expand_binop (DImode, ior_optab, data_regs[i], - ins_tmps[i-1], ins_tmps[i-1], 1, - OPTAB_WIDEN); - } - } - - /* Split and merge the ends with the destination data. */ - emit_insn (gen_mskxh (st_tmp_2, st_tmp_2, i64, dreg)); - emit_insn (gen_mskxl (st_tmp_1, st_tmp_1, im1, dreg)); - - if (data_regs != NULL) - { - st_tmp_2 = expand_binop (DImode, ior_optab, st_tmp_2, ins_tmps[words-1], - st_tmp_2, 1, OPTAB_WIDEN); - st_tmp_1 = expand_binop (DImode, ior_optab, st_tmp_1, data_regs[0], - st_tmp_1, 1, OPTAB_WIDEN); - } - - /* Store it all. */ - emit_move_insn (st_addr_2, st_tmp_2); - for (i = words-1; i > 0; --i) - { - emit_move_insn (change_address (dmem, DImode, - gen_rtx_AND (DImode, - plus_constant(XEXP (dmem,0), - i*8), - im8)), - data_regs ? ins_tmps[i-1] : const0_rtx); - } - emit_move_insn (st_addr_1, st_tmp_1); -} - - -/* Expand string/block move operations. - - operands[0] is the pointer to the destination. - operands[1] is the pointer to the source. - operands[2] is the number of bytes to move. - operands[3] is the alignment. */ - -int -alpha_expand_block_move (operands) - rtx operands[]; -{ - rtx bytes_rtx = operands[2]; - rtx align_rtx = operands[3]; - HOST_WIDE_INT orig_bytes = INTVAL (bytes_rtx); - HOST_WIDE_INT bytes = orig_bytes; - HOST_WIDE_INT src_align = INTVAL (align_rtx); - HOST_WIDE_INT dst_align = src_align; - rtx orig_src = operands[1]; - rtx orig_dst = operands[0]; - rtx data_regs[2*MAX_MOVE_WORDS+16]; - rtx tmp; - int i, words, ofs, nregs = 0; - - if (bytes <= 0) - return 1; - if (bytes > MAX_MOVE_WORDS*8) - return 0; - - /* Look for additional alignment information from recorded register info. */ - - tmp = XEXP (orig_src, 0); - if (GET_CODE (tmp) == REG) - { - if (REGNO_POINTER_ALIGN (REGNO (tmp)) > src_align) - src_align = REGNO_POINTER_ALIGN (REGNO (tmp)); - } - else if (GET_CODE (tmp) == PLUS - && GET_CODE (XEXP (tmp, 0)) == REG - && GET_CODE (XEXP (tmp, 1)) == CONST_INT) - { - HOST_WIDE_INT c = INTVAL (XEXP (tmp, 1)); - int a = REGNO_POINTER_ALIGN (REGNO (XEXP (tmp, 0))); - - if (a > src_align) - { - if (a >= 8 && c % 8 == 0) - src_align = 8; - else if (a >= 4 && c % 4 == 0) - src_align = 4; - else if (a >= 2 && c % 2 == 0) - src_align = 2; - } - } - - tmp = XEXP (orig_dst, 0); - if (GET_CODE (tmp) == REG) - { - if (REGNO_POINTER_ALIGN (REGNO (tmp)) > dst_align) - dst_align = REGNO_POINTER_ALIGN (REGNO (tmp)); - } - else if (GET_CODE (tmp) == PLUS - && GET_CODE (XEXP (tmp, 0)) == REG - && GET_CODE (XEXP (tmp, 1)) == CONST_INT) - { - HOST_WIDE_INT c = INTVAL (XEXP (tmp, 1)); - int a = REGNO_POINTER_ALIGN (REGNO (XEXP (tmp, 0))); - - if (a > dst_align) - { - if (a >= 8 && c % 8 == 0) - dst_align = 8; - else if (a >= 4 && c % 4 == 0) - dst_align = 4; - else if (a >= 2 && c % 2 == 0) - dst_align = 2; - } - } - - /* - * Load the entire block into registers. - */ - - if (GET_CODE (XEXP (orig_src, 0)) == ADDRESSOF) - { - enum machine_mode mode; - tmp = XEXP (XEXP (orig_src, 0), 0); - - /* Don't use the existing register if we're reading more than - is held in the register. Nor if there is not a mode that - handles the exact size. */ - mode = mode_for_size (bytes * BITS_PER_UNIT, MODE_INT, 1); - if (mode != BLKmode - && GET_MODE_SIZE (GET_MODE (tmp)) >= bytes) - { - if (mode == TImode) - { - data_regs[nregs] = gen_lowpart (DImode, tmp); - data_regs[nregs+1] = gen_highpart (DImode, tmp); - nregs += 2; - } - else - data_regs[nregs++] = gen_lowpart (mode, tmp); - goto src_done; - } - - /* No appropriate mode; fall back on memory. */ - orig_src = change_address (orig_src, GET_MODE (orig_src), - copy_addr_to_reg (XEXP (orig_src, 0))); - } - - ofs = 0; - if (src_align >= 8 && bytes >= 8) - { - words = bytes / 8; - - for (i = 0; i < words; ++i) - data_regs[nregs+i] = gen_reg_rtx(DImode); - - for (i = 0; i < words; ++i) - { - emit_move_insn (data_regs[nregs+i], - change_address (orig_src, DImode, - plus_constant (XEXP (orig_src, 0), - ofs + i*8))); - } - - nregs += words; - bytes -= words * 8; - ofs += words * 8; - } - if (src_align >= 4 && bytes >= 4) - { - words = bytes / 4; - - for (i = 0; i < words; ++i) - data_regs[nregs+i] = gen_reg_rtx(SImode); - - for (i = 0; i < words; ++i) - { - emit_move_insn (data_regs[nregs+i], - change_address (orig_src, SImode, - plus_constant (XEXP (orig_src, 0), - ofs + i*4))); - } - - nregs += words; - bytes -= words * 4; - ofs += words * 4; - } - if (bytes >= 16) - { - words = bytes / 8; - - for (i = 0; i < words+1; ++i) - data_regs[nregs+i] = gen_reg_rtx(DImode); - - alpha_expand_unaligned_load_words (data_regs + nregs, orig_src, - words, ofs); - - nregs += words; - bytes -= words * 8; - ofs += words * 8; - } - if (!TARGET_BWX && bytes >= 8) - { - data_regs[nregs++] = tmp = gen_reg_rtx (DImode); - alpha_expand_unaligned_load (tmp, orig_src, 8, ofs, 0); - bytes -= 8; - ofs += 8; - } - if (!TARGET_BWX && bytes >= 4) - { - data_regs[nregs++] = tmp = gen_reg_rtx (SImode); - alpha_expand_unaligned_load (tmp, orig_src, 4, ofs, 0); - bytes -= 4; - ofs += 4; - } - if (bytes >= 2) - { - if (src_align >= 2) - { - do { - data_regs[nregs++] = tmp = gen_reg_rtx (HImode); - emit_move_insn (tmp, - change_address (orig_src, HImode, - plus_constant (XEXP (orig_src, 0), - ofs))); - bytes -= 2; - ofs += 2; - } while (bytes >= 2); - } - else if (!TARGET_BWX) - { - data_regs[nregs++] = tmp = gen_reg_rtx (HImode); - alpha_expand_unaligned_load (tmp, orig_src, 2, ofs, 0); - bytes -= 2; - ofs += 2; - } - } - while (bytes > 0) - { - data_regs[nregs++] = tmp = gen_reg_rtx (QImode); - emit_move_insn (tmp, - change_address (orig_src, QImode, - plus_constant (XEXP (orig_src, 0), - ofs))); - bytes -= 1; - ofs += 1; - } - src_done: - - if (nregs > (int)(sizeof(data_regs)/sizeof(*data_regs))) - abort(); - - /* - * Now save it back out again. - */ - - i = 0, ofs = 0; - - if (GET_CODE (XEXP (orig_dst, 0)) == ADDRESSOF) - { - enum machine_mode mode; - tmp = XEXP (XEXP (orig_dst, 0), 0); - - mode = mode_for_size (orig_bytes * BITS_PER_UNIT, MODE_INT, 1); - if (GET_MODE (tmp) == mode) - { - if (nregs == 1) - { - emit_move_insn (tmp, data_regs[0]); - i = 1; - goto dst_done; - } - else if (nregs == 2 && mode == TImode) - { - /* Undo the subregging done above when copying between - two TImode registers. */ - if (GET_CODE (data_regs[0]) == SUBREG - && GET_MODE (SUBREG_REG (data_regs[0])) == TImode) - { - emit_move_insn (tmp, SUBREG_REG (data_regs[0])); - } - else - { - rtx seq; - - start_sequence (); - emit_move_insn (gen_lowpart (DImode, tmp), data_regs[0]); - emit_move_insn (gen_highpart (DImode, tmp), data_regs[1]); - seq = get_insns (); - end_sequence (); - - emit_no_conflict_block (seq, tmp, data_regs[0], - data_regs[1], NULL_RTX); - } - - i = 2; - goto dst_done; - } - } - - /* ??? If nregs > 1, consider reconstructing the word in regs. */ - /* ??? Optimize mode < dst_mode with strict_low_part. */ - - /* No appropriate mode; fall back on memory. We can speed things - up by recognizing extra alignment information. */ - orig_dst = change_address (orig_dst, GET_MODE (orig_dst), - copy_addr_to_reg (XEXP (orig_dst, 0))); - dst_align = GET_MODE_SIZE (GET_MODE (tmp)); - } - - /* Write out the data in whatever chunks reading the source allowed. */ - if (dst_align >= 8) - { - while (i < nregs && GET_MODE (data_regs[i]) == DImode) - { - emit_move_insn (change_address (orig_dst, DImode, - plus_constant (XEXP (orig_dst, 0), - ofs)), - data_regs[i]); - ofs += 8; - i++; - } - } - if (dst_align >= 4) - { - /* If the source has remaining DImode regs, write them out in - two pieces. */ - while (i < nregs && GET_MODE (data_regs[i]) == DImode) - { - tmp = expand_binop (DImode, lshr_optab, data_regs[i], GEN_INT (32), - NULL_RTX, 1, OPTAB_WIDEN); - - emit_move_insn (change_address (orig_dst, SImode, - plus_constant (XEXP (orig_dst, 0), - ofs)), - gen_lowpart (SImode, data_regs[i])); - emit_move_insn (change_address (orig_dst, SImode, - plus_constant (XEXP (orig_dst, 0), - ofs+4)), - gen_lowpart (SImode, tmp)); - ofs += 8; - i++; - } - - while (i < nregs && GET_MODE (data_regs[i]) == SImode) - { - emit_move_insn (change_address(orig_dst, SImode, - plus_constant (XEXP (orig_dst, 0), - ofs)), - data_regs[i]); - ofs += 4; - i++; - } - } - if (i < nregs && GET_MODE (data_regs[i]) == DImode) - { - /* Write out a remaining block of words using unaligned methods. */ - - for (words = 1; i+words < nregs ; ++words) - if (GET_MODE (data_regs[i+words]) != DImode) - break; - - if (words == 1) - alpha_expand_unaligned_store (orig_dst, data_regs[i], 8, ofs); - else - alpha_expand_unaligned_store_words (data_regs+i, orig_dst, words, ofs); - - i += words; - ofs += words * 8; - } - - /* Due to the above, this won't be aligned. */ - /* ??? If we have more than one of these, consider constructing full - words in registers and using alpha_expand_unaligned_store_words. */ - while (i < nregs && GET_MODE (data_regs[i]) == SImode) - { - alpha_expand_unaligned_store (orig_dst, data_regs[i], 4, ofs); - ofs += 4; - i++; - } - - if (dst_align >= 2) - while (i < nregs && GET_MODE (data_regs[i]) == HImode) - { - emit_move_insn (change_address (orig_dst, HImode, - plus_constant (XEXP (orig_dst, 0), - ofs)), - data_regs[i]); - i++; - ofs += 2; - } - else - while (i < nregs && GET_MODE (data_regs[i]) == HImode) - { - alpha_expand_unaligned_store (orig_dst, data_regs[i], 2, ofs); - i++; - ofs += 2; - } - while (i < nregs && GET_MODE (data_regs[i]) == QImode) - { - emit_move_insn (change_address (orig_dst, QImode, - plus_constant (XEXP (orig_dst, 0), - ofs)), - data_regs[i]); - i++; - ofs += 1; - } - dst_done: - - if (i != nregs) - abort(); - - return 1; -} - -int -alpha_expand_block_clear (operands) - rtx operands[]; -{ - rtx bytes_rtx = operands[1]; - rtx align_rtx = operands[2]; - HOST_WIDE_INT bytes = INTVAL (bytes_rtx); - HOST_WIDE_INT align = INTVAL (align_rtx); - rtx orig_dst = operands[0]; - rtx tmp; - HOST_WIDE_INT i, words, ofs = 0; - - if (bytes <= 0) - return 1; - if (bytes > MAX_MOVE_WORDS*8) - return 0; - - /* Look for stricter alignment. */ - - tmp = XEXP (orig_dst, 0); - if (GET_CODE (tmp) == REG) - { - if (REGNO_POINTER_ALIGN (REGNO (tmp)) > align) - align = REGNO_POINTER_ALIGN (REGNO (tmp)); - } - else if (GET_CODE (tmp) == PLUS - && GET_CODE (XEXP (tmp, 0)) == REG - && GET_CODE (XEXP (tmp, 1)) == CONST_INT) - { - HOST_WIDE_INT c = INTVAL (XEXP (tmp, 1)); - int a = REGNO_POINTER_ALIGN (REGNO (XEXP (tmp, 0))); - - if (a > align) - { - if (a >= 8 && c % 8 == 0) - align = 8; - else if (a >= 4 && c % 4 == 0) - align = 4; - else if (a >= 2 && c % 2 == 0) - align = 2; - } - } - else if (GET_CODE (tmp) == ADDRESSOF) - { - enum machine_mode mode; - - mode = mode_for_size (bytes * BITS_PER_UNIT, MODE_INT, 1); - if (GET_MODE (XEXP (tmp, 0)) == mode) - { - emit_move_insn (XEXP (tmp, 0), const0_rtx); - return 1; - } - - /* No appropriate mode; fall back on memory. */ - orig_dst = change_address (orig_dst, GET_MODE (orig_dst), - copy_addr_to_reg (tmp)); - align = GET_MODE_SIZE (GET_MODE (XEXP (tmp, 0))); - } - - /* Handle a block of contiguous words first. */ - - if (align >= 8 && bytes >= 8) - { - words = bytes / 8; - - for (i = 0; i < words; ++i) - { - emit_move_insn (change_address(orig_dst, DImode, - plus_constant (XEXP (orig_dst, 0), - ofs + i*8)), - const0_rtx); - } - - bytes -= words * 8; - ofs += words * 8; - } - if (align >= 4 && bytes >= 4) - { - words = bytes / 4; - - for (i = 0; i < words; ++i) - { - emit_move_insn (change_address (orig_dst, SImode, - plus_constant (XEXP (orig_dst, 0), - ofs + i*4)), - const0_rtx); - } - - bytes -= words * 4; - ofs += words * 4; - } - if (bytes >= 16) - { - words = bytes / 8; - - alpha_expand_unaligned_store_words (NULL, orig_dst, words, ofs); - - bytes -= words * 8; - ofs += words * 8; - } - - /* Next clean up any trailing pieces. We know from the contiguous - block move that there are no aligned SImode or DImode hunks left. */ - - if (!TARGET_BWX && bytes >= 8) - { - alpha_expand_unaligned_store (orig_dst, const0_rtx, 8, ofs); - bytes -= 8; - ofs += 8; - } - if (!TARGET_BWX && bytes >= 4) - { - alpha_expand_unaligned_store (orig_dst, const0_rtx, 4, ofs); - bytes -= 4; - ofs += 4; - } - if (bytes >= 2) - { - if (align >= 2) - { - do { - emit_move_insn (change_address (orig_dst, HImode, - plus_constant (XEXP (orig_dst, 0), - ofs)), - const0_rtx); - bytes -= 2; - ofs += 2; - } while (bytes >= 2); - } - else if (!TARGET_BWX) - { - alpha_expand_unaligned_store (orig_dst, const0_rtx, 2, ofs); - bytes -= 2; - ofs += 2; - } - } - while (bytes > 0) - { - emit_move_insn (change_address (orig_dst, QImode, - plus_constant (XEXP (orig_dst, 0), - ofs)), - const0_rtx); - bytes -= 1; - ofs += 1; - } - - return 1; -} - - -/* Adjust the cost of a scheduling dependency. Return the new cost of - a dependency LINK or INSN on DEP_INSN. COST is the current cost. */ - -int -alpha_adjust_cost (insn, link, dep_insn, cost) - rtx insn; - rtx link; - rtx dep_insn; - int cost; -{ - rtx set, set_src; - enum attr_type insn_type, dep_insn_type; - - /* If the dependence is an anti-dependence, there is no cost. For an - output dependence, there is sometimes a cost, but it doesn't seem - worth handling those few cases. */ - - if (REG_NOTE_KIND (link) != 0) - return 0; - - /* If we can't recognize the insns, we can't really do anything. */ - if (recog_memoized (insn) < 0 || recog_memoized (dep_insn) < 0) - return cost; - - insn_type = get_attr_type (insn); - dep_insn_type = get_attr_type (dep_insn); - - /* Bring in the user-defined memory latency. */ - if (dep_insn_type == TYPE_ILD - || dep_insn_type == TYPE_FLD - || dep_insn_type == TYPE_LDSYM) - cost += alpha_memory_latency-1; - - switch (alpha_cpu) - { - case PROCESSOR_EV4: - /* On EV4, if INSN is a store insn and DEP_INSN is setting the data - being stored, we can sometimes lower the cost. */ - - if ((insn_type == TYPE_IST || insn_type == TYPE_FST) - && (set = single_set (dep_insn)) != 0 - && GET_CODE (PATTERN (insn)) == SET - && rtx_equal_p (SET_DEST (set), SET_SRC (PATTERN (insn)))) - { - switch (dep_insn_type) - { - case TYPE_ILD: - case TYPE_FLD: - /* No savings here. */ - return cost; - - case TYPE_IMUL: - /* In these cases, we save one cycle. */ - return cost - 1; - - default: - /* In all other cases, we save two cycles. */ - return MAX (0, cost - 2); - } - } - - /* Another case that needs adjustment is an arithmetic or logical - operation. It's cost is usually one cycle, but we default it to - two in the MD file. The only case that it is actually two is - for the address in loads, stores, and jumps. */ - - if (dep_insn_type == TYPE_IADD || dep_insn_type == TYPE_ILOG) - { - switch (insn_type) - { - case TYPE_ILD: - case TYPE_IST: - case TYPE_FLD: - case TYPE_FST: - case TYPE_JSR: - return cost; - default: - return 1; - } - } - - /* The final case is when a compare feeds into an integer branch; - the cost is only one cycle in that case. */ - - if (dep_insn_type == TYPE_ICMP && insn_type == TYPE_IBR) - return 1; - break; - - case PROCESSOR_EV5: - /* And the lord DEC saith: "A special bypass provides an effective - latency of 0 cycles for an ICMP or ILOG insn producing the test - operand of an IBR or ICMOV insn." */ - - if ((dep_insn_type == TYPE_ICMP || dep_insn_type == TYPE_ILOG) - && (set = single_set (dep_insn)) != 0) - { - /* A branch only has one input. This must be it. */ - if (insn_type == TYPE_IBR) - return 0; - /* A conditional move has three, make sure it is the test. */ - if (insn_type == TYPE_ICMOV - && GET_CODE (set_src = PATTERN (insn)) == SET - && GET_CODE (set_src = SET_SRC (set_src)) == IF_THEN_ELSE - && rtx_equal_p (SET_DEST (set), XEXP (set_src, 0))) - return 0; - } - - /* "The multiplier is unable to receive data from IEU bypass paths. - The instruction issues at the expected time, but its latency is - increased by the time it takes for the input data to become - available to the multiplier" -- which happens in pipeline stage - six, when results are comitted to the register file. */ - - if (insn_type == TYPE_IMUL) - { - switch (dep_insn_type) - { - /* These insns produce their results in pipeline stage five. */ - case TYPE_ILD: - case TYPE_ICMOV: - case TYPE_IMUL: - case TYPE_MVI: - return cost + 1; - - /* Other integer insns produce results in pipeline stage four. */ - default: - return cost + 2; - } - } - break; - - case PROCESSOR_EV6: - /* There is additional latency to move the result of (most) FP - operations anywhere but the FP register file. */ - - if ((insn_type == TYPE_FST || insn_type == TYPE_FTOI) - && (dep_insn_type == TYPE_FADD || - dep_insn_type == TYPE_FMUL || - dep_insn_type == TYPE_FCMOV)) - return cost + 2; - - break; - } - - /* Otherwise, return the default cost. */ - return cost; -} - -/* Functions to save and restore alpha_return_addr_rtx. */ - -struct machine_function -{ - rtx ra_rtx; -}; - -static void -alpha_save_machine_status (p) - struct function *p; -{ - struct machine_function *machine = - (struct machine_function *) xmalloc (sizeof (struct machine_function)); - - p->machine = machine; - machine->ra_rtx = alpha_return_addr_rtx; -} - -static void -alpha_restore_machine_status (p) - struct function *p; -{ - struct machine_function *machine = p->machine; - - alpha_return_addr_rtx = machine->ra_rtx; - - free (machine); - p->machine = (struct machine_function *)0; -} - -/* Do anything needed before RTL is emitted for each function. */ - -void -alpha_init_expanders () -{ - alpha_return_addr_rtx = NULL_RTX; - alpha_eh_epilogue_sp_ofs = NULL_RTX; - - /* Arrange to save and restore machine status around nested functions. */ - save_machine_status = alpha_save_machine_status; - restore_machine_status = alpha_restore_machine_status; -} - -/* Start the ball rolling with RETURN_ADDR_RTX. */ - -rtx -alpha_return_addr (count, frame) - int count; - rtx frame ATTRIBUTE_UNUSED; -{ - rtx init; - - if (count != 0) - return const0_rtx; - - if (alpha_return_addr_rtx) - return alpha_return_addr_rtx; - - /* No rtx yet. Invent one, and initialize it from $26 in the prologue. */ - alpha_return_addr_rtx = gen_reg_rtx (Pmode); - init = gen_rtx_SET (VOIDmode, alpha_return_addr_rtx, - gen_rtx_REG (Pmode, REG_RA)); - - /* Emit the insn to the prologue with the other argument copies. */ - push_topmost_sequence (); - emit_insn_after (init, get_insns ()); - pop_topmost_sequence (); - - return alpha_return_addr_rtx; -} - -static int -alpha_ra_ever_killed () -{ - rtx top; - -#ifdef ASM_OUTPUT_MI_THUNK - if (current_function_is_thunk) - return 0; -#endif - if (!alpha_return_addr_rtx) - return regs_ever_live[REG_RA]; - - push_topmost_sequence (); - top = get_insns (); - pop_topmost_sequence (); - - return reg_set_between_p (gen_rtx_REG (Pmode, REG_RA), top, NULL_RTX); -} - - -/* Print an operand. Recognize special options, documented below. */ - -void -print_operand (file, x, code) - FILE *file; - rtx x; - char code; -{ - int i; - - switch (code) - { - case '&': - /* Generates fp-rounding mode suffix: nothing for normal, 'c' for - chopped, 'm' for minus-infinity, and 'd' for dynamic rounding - mode. alpha_fprm controls which suffix is generated. */ - switch (alpha_fprm) - { - case ALPHA_FPRM_NORM: - break; - case ALPHA_FPRM_MINF: - fputc ('m', file); - break; - case ALPHA_FPRM_CHOP: - fputc ('c', file); - break; - case ALPHA_FPRM_DYN: - fputc ('d', file); - break; - } - break; - - case '\'': - /* Generates trap-mode suffix for instructions that accept the su - suffix only (cmpt et al). */ - if (alpha_tp == ALPHA_TP_INSN) - fputs ("su", file); - break; - - case '`': - /* Generates trap-mode suffix for instructions that accept the - v and sv suffix. The only instruction that needs this is cvtql. */ - switch (alpha_fptm) - { - case ALPHA_FPTM_N: - break; - case ALPHA_FPTM_U: - fputs ("v", file); - break; - case ALPHA_FPTM_SU: - case ALPHA_FPTM_SUI: - fputs ("sv", file); - break; - } - break; - - case '(': - /* Generates trap-mode suffix for instructions that accept the - v, sv, and svi suffix. The only instruction that needs this - is cvttq. */ - switch (alpha_fptm) - { - case ALPHA_FPTM_N: - break; - case ALPHA_FPTM_U: - fputs ("v", file); - break; - case ALPHA_FPTM_SU: - fputs ("sv", file); - break; - case ALPHA_FPTM_SUI: - fputs ("svi", file); - break; - } - break; - - case ')': - /* Generates trap-mode suffix for instructions that accept the u, su, - and sui suffix. This is the bulk of the IEEE floating point - instructions (addt et al). */ - switch (alpha_fptm) - { - case ALPHA_FPTM_N: - break; - case ALPHA_FPTM_U: - fputc ('u', file); - break; - case ALPHA_FPTM_SU: - fputs ("su", file); - break; - case ALPHA_FPTM_SUI: - fputs ("sui", file); - break; - } - break; - - case '+': - /* Generates trap-mode suffix for instructions that accept the sui - suffix (cvtqt and cvtqs). */ - switch (alpha_fptm) - { - case ALPHA_FPTM_N: - case ALPHA_FPTM_U: - case ALPHA_FPTM_SU: /* cvtqt/cvtqs can't cause underflow */ - break; - case ALPHA_FPTM_SUI: - fputs ("sui", file); - break; - } - break; - - case ',': - /* Generates single precision instruction suffix. */ - fprintf (file, "%c", (TARGET_FLOAT_VAX ? 'f' : 's')); - break; - - case '-': - /* Generates double precision instruction suffix. */ - fprintf (file, "%c", (TARGET_FLOAT_VAX ? 'g' : 't')); - break; - - case 'r': - /* If this operand is the constant zero, write it as "$31". */ - if (GET_CODE (x) == REG) - fprintf (file, "%s", reg_names[REGNO (x)]); - else if (x == CONST0_RTX (GET_MODE (x))) - fprintf (file, "$31"); - else - output_operand_lossage ("invalid %%r value"); - - break; - - case 'R': - /* Similar, but for floating-point. */ - if (GET_CODE (x) == REG) - fprintf (file, "%s", reg_names[REGNO (x)]); - else if (x == CONST0_RTX (GET_MODE (x))) - fprintf (file, "$f31"); - else - output_operand_lossage ("invalid %%R value"); - - break; - - case 'N': - /* Write the 1's complement of a constant. */ - if (GET_CODE (x) != CONST_INT) - output_operand_lossage ("invalid %%N value"); - - fprintf (file, HOST_WIDE_INT_PRINT_DEC, ~ INTVAL (x)); - break; - - case 'P': - /* Write 1 << C, for a constant C. */ - if (GET_CODE (x) != CONST_INT) - output_operand_lossage ("invalid %%P value"); - - fprintf (file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) 1 << INTVAL (x)); - break; - - case 'h': - /* Write the high-order 16 bits of a constant, sign-extended. */ - if (GET_CODE (x) != CONST_INT) - output_operand_lossage ("invalid %%h value"); - - fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) >> 16); - break; - - case 'L': - /* Write the low-order 16 bits of a constant, sign-extended. */ - if (GET_CODE (x) != CONST_INT) - output_operand_lossage ("invalid %%L value"); - - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - (INTVAL (x) & 0xffff) - 2 * (INTVAL (x) & 0x8000)); - break; - - case 'm': - /* Write mask for ZAP insn. */ - if (GET_CODE (x) == CONST_DOUBLE) - { - HOST_WIDE_INT mask = 0; - HOST_WIDE_INT value; - - value = CONST_DOUBLE_LOW (x); - for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; - i++, value >>= 8) - if (value & 0xff) - mask |= (1 << i); - - value = CONST_DOUBLE_HIGH (x); - for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; - i++, value >>= 8) - if (value & 0xff) - mask |= (1 << (i + sizeof (int))); - - fprintf (file, HOST_WIDE_INT_PRINT_DEC, mask & 0xff); - } - - else if (GET_CODE (x) == CONST_INT) - { - HOST_WIDE_INT mask = 0, value = INTVAL (x); - - for (i = 0; i < 8; i++, value >>= 8) - if (value & 0xff) - mask |= (1 << i); - - fprintf (file, HOST_WIDE_INT_PRINT_DEC, mask); - } - else - output_operand_lossage ("invalid %%m value"); - break; - - case 'M': - /* 'b', 'w', 'l', or 'q' as the value of the constant. */ - if (GET_CODE (x) != CONST_INT - || (INTVAL (x) != 8 && INTVAL (x) != 16 - && INTVAL (x) != 32 && INTVAL (x) != 64)) - output_operand_lossage ("invalid %%M value"); - - fprintf (file, "%s", - (INTVAL (x) == 8 ? "b" - : INTVAL (x) == 16 ? "w" - : INTVAL (x) == 32 ? "l" - : "q")); - break; - - case 'U': - /* Similar, except do it from the mask. */ - if (GET_CODE (x) == CONST_INT && INTVAL (x) == 0xff) - fprintf (file, "b"); - else if (GET_CODE (x) == CONST_INT && INTVAL (x) == 0xffff) - fprintf (file, "w"); - else if (GET_CODE (x) == CONST_INT && INTVAL (x) == 0xffffffff) - fprintf (file, "l"); -#if HOST_BITS_PER_WIDE_INT == 32 - else if (GET_CODE (x) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (x) == 0 - && CONST_DOUBLE_LOW (x) == -1) - fprintf (file, "l"); - else if (GET_CODE (x) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (x) == -1 - && CONST_DOUBLE_LOW (x) == -1) - fprintf (file, "q"); -#else - else if (GET_CODE (x) == CONST_INT && INTVAL (x) == -1) - fprintf (file, "q"); - else if (GET_CODE (x) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (x) == 0 - && CONST_DOUBLE_LOW (x) == -1) - fprintf (file, "q"); -#endif - else - output_operand_lossage ("invalid %%U value"); - break; - - case 's': - /* Write the constant value divided by 8. */ - if (GET_CODE (x) != CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (x) >= 64 - && (INTVAL (x) & 7) != 8) - output_operand_lossage ("invalid %%s value"); - - fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x) / 8); - break; - - case 'S': - /* Same, except compute (64 - c) / 8 */ - - if (GET_CODE (x) != CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (x) >= 64 - && (INTVAL (x) & 7) != 8) - output_operand_lossage ("invalid %%s value"); - - fprintf (file, HOST_WIDE_INT_PRINT_DEC, (64 - INTVAL (x)) / 8); - break; - - case 'C': case 'D': case 'c': case 'd': - /* Write out comparison name. */ - { - enum rtx_code c = GET_CODE (x); - - if (GET_RTX_CLASS (c) != '<') - output_operand_lossage ("invalid %%C value"); - - if (code == 'D') - c = reverse_condition (c); - else if (code == 'c') - c = swap_condition (c); - else if (code == 'd') - c = swap_condition (reverse_condition (c)); - - if (c == LEU) - fprintf (file, "ule"); - else if (c == LTU) - fprintf (file, "ult"); - else - fprintf (file, "%s", GET_RTX_NAME (c)); - } - break; - - case 'E': - /* Write the divide or modulus operator. */ - switch (GET_CODE (x)) - { - case DIV: - fprintf (file, "div%s", GET_MODE (x) == SImode ? "l" : "q"); - break; - case UDIV: - fprintf (file, "div%su", GET_MODE (x) == SImode ? "l" : "q"); - break; - case MOD: - fprintf (file, "rem%s", GET_MODE (x) == SImode ? "l" : "q"); - break; - case UMOD: - fprintf (file, "rem%su", GET_MODE (x) == SImode ? "l" : "q"); - break; - default: - output_operand_lossage ("invalid %%E value"); - break; - } - break; - - case 'A': - /* Write "_u" for unaligned access. */ - if (GET_CODE (x) == MEM && GET_CODE (XEXP (x, 0)) == AND) - fprintf (file, "_u"); - break; - - case 0: - if (GET_CODE (x) == REG) - fprintf (file, "%s", reg_names[REGNO (x)]); - else if (GET_CODE (x) == MEM) - output_address (XEXP (x, 0)); - else - output_addr_const (file, x); - break; - - default: - output_operand_lossage ("invalid %%xn code"); - } -} - -void -print_operand_address (file, addr) - FILE *file; - rtx addr; -{ - int basereg = 31; - HOST_WIDE_INT offset = 0; - - if (GET_CODE (addr) == AND) - addr = XEXP (addr, 0); - - if (GET_CODE (addr) == PLUS - && GET_CODE (XEXP (addr, 1)) == CONST_INT) - { - offset = INTVAL (XEXP (addr, 1)); - addr = XEXP (addr, 0); - } - if (GET_CODE (addr) == REG) - basereg = REGNO (addr); - else if (GET_CODE (addr) == SUBREG - && GET_CODE (SUBREG_REG (addr)) == REG) - basereg = REGNO (SUBREG_REG (addr)) + SUBREG_WORD (addr); - else if (GET_CODE (addr) == CONST_INT) - offset = INTVAL (addr); - else - abort (); - - fprintf (file, HOST_WIDE_INT_PRINT_DEC, offset); - fprintf (file, "($%d)", basereg); -} - -/* Emit RTL insns to initialize the variable parts of a trampoline at - TRAMP. FNADDR is an RTX for the address of the function's pure - code. CXT is an RTX for the static chain value for the function. - - The three offset parameters are for the individual template's - layout. A JMPOFS < 0 indicates that the trampoline does not - contain instructions at all. - - We assume here that a function will be called many more times than - its address is taken (e.g., it might be passed to qsort), so we - take the trouble to initialize the "hint" field in the JMP insn. - Note that the hint field is PC (new) + 4 * bits 13:0. */ - -void -alpha_initialize_trampoline (tramp, fnaddr, cxt, fnofs, cxtofs, jmpofs) - rtx tramp, fnaddr, cxt; - int fnofs, cxtofs, jmpofs; -{ - rtx temp, temp1, addr; - /* VMS really uses DImode pointers in memory at this point. */ - enum machine_mode mode = TARGET_OPEN_VMS ? Pmode : ptr_mode; - -#ifdef POINTERS_EXTEND_UNSIGNED - fnaddr = convert_memory_address (mode, fnaddr); - cxt = convert_memory_address (mode, cxt); -#endif - - /* Store function address and CXT. */ - addr = memory_address (mode, plus_constant (tramp, fnofs)); - emit_move_insn (gen_rtx (MEM, mode, addr), fnaddr); - addr = memory_address (mode, plus_constant (tramp, cxtofs)); - emit_move_insn (gen_rtx (MEM, mode, addr), cxt); - - /* This has been disabled since the hint only has a 32k range, and in - no existing OS is the stack within 32k of the text segment. */ - if (0 && jmpofs >= 0) - { - /* Compute hint value. */ - temp = force_operand (plus_constant (tramp, jmpofs+4), NULL_RTX); - temp = expand_binop (DImode, sub_optab, fnaddr, temp, temp, 1, - OPTAB_WIDEN); - temp = expand_shift (RSHIFT_EXPR, Pmode, temp, - build_int_2 (2, 0), NULL_RTX, 1); - temp = expand_and (gen_lowpart (SImode, temp), GEN_INT (0x3fff), 0); - - /* Merge in the hint. */ - addr = memory_address (SImode, plus_constant (tramp, jmpofs)); - temp1 = force_reg (SImode, gen_rtx (MEM, SImode, addr)); - temp1 = expand_and (temp1, GEN_INT (0xffffc000), NULL_RTX); - temp1 = expand_binop (SImode, ior_optab, temp1, temp, temp1, 1, - OPTAB_WIDEN); - emit_move_insn (gen_rtx (MEM, SImode, addr), temp1); - } - -#ifdef TRANSFER_FROM_TRAMPOLINE - emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__enable_execute_stack"), - 0, VOIDmode, 1, addr, Pmode); -#endif - - if (jmpofs >= 0) - emit_insn (gen_imb ()); -} - -/* Do what is necessary for `va_start'. The argument is ignored; - We look at the current function to determine if stdarg or varargs - is used and fill in an initial va_list. A pointer to this constructor - is returned. */ - -struct rtx_def * -alpha_builtin_saveregs (arglist) - tree arglist ATTRIBUTE_UNUSED; -{ - rtx block, addr, dest, argsize; - tree fntype = TREE_TYPE (current_function_decl); - int stdarg = (TYPE_ARG_TYPES (fntype) != 0 - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - != void_type_node)); - - /* Compute the current position into the args, taking into account - both registers and memory. Both of these are already included in - NUM_ARGS. */ - - argsize = GEN_INT (NUM_ARGS * UNITS_PER_WORD); - - /* For Unix, SETUP_INCOMING_VARARGS moves the starting address base up by 48, - storing fp arg registers in the first 48 bytes, and the integer arg - registers in the next 48 bytes. This is only done, however, if any - integer registers need to be stored. - - If no integer registers need be stored, then we must subtract 48 in - order to account for the integer arg registers which are counted in - argsize above, but which are not actually stored on the stack. */ - - if (TARGET_OPEN_VMS) - addr = plus_constant (virtual_incoming_args_rtx, - NUM_ARGS <= 5 + stdarg - ? UNITS_PER_WORD : - 6 * UNITS_PER_WORD); - else - addr = (NUM_ARGS <= 5 + stdarg - ? plus_constant (virtual_incoming_args_rtx, - 6 * UNITS_PER_WORD) - : plus_constant (virtual_incoming_args_rtx, - - (6 * UNITS_PER_WORD))); - - /* For VMS, we include the argsize, while on Unix, it's handled as - a separate field. */ - if (TARGET_OPEN_VMS) - addr = plus_constant (addr, INTVAL (argsize)); - - addr = force_operand (addr, NULL_RTX); - -#ifdef POINTERS_EXTEND_UNSIGNED - addr = convert_memory_address (ptr_mode, addr); -#endif - - if (TARGET_OPEN_VMS) - return addr; - else - { - /* Allocate the va_list constructor */ - block = assign_stack_local (BLKmode, 2 * UNITS_PER_WORD, BITS_PER_WORD); - RTX_UNCHANGING_P (block) = 1; - RTX_UNCHANGING_P (XEXP (block, 0)) = 1; - - /* Store the address of the first integer register in the __base - member. */ - - dest = change_address (block, ptr_mode, XEXP (block, 0)); - emit_move_insn (dest, addr); - - if (current_function_check_memory_usage) - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, - dest, ptr_mode, - GEN_INT (GET_MODE_SIZE (ptr_mode)), - TYPE_MODE (sizetype), - GEN_INT (MEMORY_USE_RW), - TYPE_MODE (integer_type_node)); - - /* Store the argsize as the __va_offset member. */ - dest = change_address (block, TYPE_MODE (integer_type_node), - plus_constant (XEXP (block, 0), - POINTER_SIZE/BITS_PER_UNIT)); - emit_move_insn (dest, argsize); - - if (current_function_check_memory_usage) - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, - dest, ptr_mode, - GEN_INT (GET_MODE_SIZE - (TYPE_MODE (integer_type_node))), - TYPE_MODE (sizetype), - GEN_INT (MEMORY_USE_RW), - TYPE_MODE (integer_type_node)); - - /* Return the address of the va_list constructor, but don't put it in a - register. Doing so would fail when not optimizing and produce worse - code when optimizing. */ - return XEXP (block, 0); - } -} - -/* This page contains routines that are used to determine what the function - prologue and epilogue code will do and write them out. */ - -/* Compute the size of the save area in the stack. */ - -/* These variables are used for communication between the following functions. - They indicate various things about the current function being compiled - that are used to tell what kind of prologue, epilogue and procedure - descriptior to generate. */ - -/* Nonzero if we need a stack procedure. */ -static int vms_is_stack_procedure; - -/* Register number (either FP or SP) that is used to unwind the frame. */ -static int vms_unwind_regno; - -/* Register number used to save FP. We need not have one for RA since - we don't modify it for register procedures. This is only defined - for register frame procedures. */ -static int vms_save_fp_regno; - -/* Register number used to reference objects off our PV. */ -static int vms_base_regno; - -/* Compute register masks for saved registers. */ - -static void -alpha_sa_mask (imaskP, fmaskP) - unsigned long *imaskP; - unsigned long *fmaskP; -{ - unsigned long imask = 0; - unsigned long fmask = 0; - int i; - -#ifdef ASM_OUTPUT_MI_THUNK - if (!current_function_is_thunk) -#endif - { - if (TARGET_OPEN_VMS && vms_is_stack_procedure) - imask |= (1L << HARD_FRAME_POINTER_REGNUM); - - /* One for every register we have to save. */ - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (! fixed_regs[i] && ! call_used_regs[i] - && regs_ever_live[i] && i != REG_RA) - { - if (i < 32) - imask |= (1L << i); - else - fmask |= (1L << (i - 32)); - } - - if (imask || fmask || alpha_ra_ever_killed ()) - imask |= (1L << REG_RA); - } - - *imaskP = imask; - *fmaskP = fmask; -} - -int -alpha_sa_size () -{ - int sa_size = 0; - int i; - -#ifdef ASM_OUTPUT_MI_THUNK - if (current_function_is_thunk) - sa_size = 0; - else -#endif - { - /* One for every register we have to save. */ - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (! fixed_regs[i] && ! call_used_regs[i] - && regs_ever_live[i] && i != REG_RA) - sa_size++; - } - - if (TARGET_OPEN_VMS) - { - /* Start by assuming we can use a register procedure if we don't - make any calls (REG_RA not used) or need to save any - registers and a stack procedure if we do. */ - vms_is_stack_procedure = sa_size != 0 || alpha_ra_ever_killed (); - - /* Decide whether to refer to objects off our PV via FP or PV. - If we need FP for something else or if we receive a nonlocal - goto (which expects PV to contain the value), we must use PV. - Otherwise, start by assuming we can use FP. */ - vms_base_regno = (frame_pointer_needed - || current_function_has_nonlocal_label - || vms_is_stack_procedure - || current_function_outgoing_args_size - ? REG_PV : HARD_FRAME_POINTER_REGNUM); - - /* If we want to copy PV into FP, we need to find some register - in which to save FP. */ - - vms_save_fp_regno = -1; - if (vms_base_regno == HARD_FRAME_POINTER_REGNUM) - for (i = 0; i < 32; i++) - if (! fixed_regs[i] && call_used_regs[i] && ! regs_ever_live[i]) - vms_save_fp_regno = i; - - if (vms_save_fp_regno == -1) - vms_base_regno = REG_PV, vms_is_stack_procedure = 1; - - /* Stack unwinding should be done via FP unless we use it for PV. */ - vms_unwind_regno = (vms_base_regno == REG_PV - ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM); - - /* If this is a stack procedure, allow space for saving FP and RA. */ - if (vms_is_stack_procedure) - sa_size += 2; - } - else - { - /* If some registers were saved but not RA, RA must also be saved, - so leave space for it. */ - if (sa_size != 0 || alpha_ra_ever_killed ()) - sa_size++; - - /* Our size must be even (multiple of 16 bytes). */ - if (sa_size & 1) - sa_size++; - } - - return sa_size * 8; -} - -int -alpha_pv_save_size () -{ - alpha_sa_size (); - return vms_is_stack_procedure ? 8 : 0; -} - -int -alpha_using_fp () -{ - alpha_sa_size (); - return vms_unwind_regno == HARD_FRAME_POINTER_REGNUM; -} - -int -vms_valid_decl_attribute_p (decl, attributes, identifier, args) - tree decl ATTRIBUTE_UNUSED; - tree attributes ATTRIBUTE_UNUSED; - tree identifier; - tree args; -{ - if (is_attribute_p ("overlaid", identifier)) - return (args == NULL_TREE); - return 0; -} - -static int -alpha_does_function_need_gp () -{ - rtx insn; - - /* We never need a GP for Windows/NT or VMS. */ - if (TARGET_WINDOWS_NT || TARGET_OPEN_VMS) - return 0; - -#ifdef TARGET_PROFILING_NEEDS_GP - if (profile_flag) - return 1; -#endif - -#ifdef ASM_OUTPUT_MI_THUNK - if (current_function_is_thunk) - return 1; -#endif - - /* If we need a GP (we have a LDSYM insn or a CALL_INSN), load it first. - Even if we are a static function, we still need to do this in case - our address is taken and passed to something like qsort. */ - - push_topmost_sequence (); - insn = get_insns (); - pop_topmost_sequence (); - - for (; insn; insn = NEXT_INSN (insn)) - if (GET_RTX_CLASS (GET_CODE (insn)) == 'i' - && GET_CODE (PATTERN (insn)) != USE - && GET_CODE (PATTERN (insn)) != CLOBBER) - { - enum attr_type type = get_attr_type (insn); - if (type == TYPE_LDSYM || type == TYPE_JSR) - return 1; - } - - return 0; -} - -/* Write a version stamp. Don't write anything if we are running as a - cross-compiler. Otherwise, use the versions in /usr/include/stamp.h. */ - -#ifdef HAVE_STAMP_H -#include -#endif - -void -alpha_write_verstamp (file) - FILE *file ATTRIBUTE_UNUSED; -{ -#ifdef MS_STAMP - fprintf (file, "\t.verstamp %d %d\n", MS_STAMP, LS_STAMP); -#endif -} - -/* Helper function to set RTX_FRAME_RELATED_P on instructions, including - sequences. */ - -static rtx -set_frame_related_p () -{ - rtx seq = gen_sequence (); - end_sequence (); - - if (GET_CODE (seq) == SEQUENCE) - { - int i = XVECLEN (seq, 0); - while (--i >= 0) - RTX_FRAME_RELATED_P (XVECEXP (seq, 0, i)) = 1; - return emit_insn (seq); - } - else - { - seq = emit_insn (seq); - RTX_FRAME_RELATED_P (seq) = 1; - return seq; - } -} - -#define FRP(exp) (start_sequence (), exp, set_frame_related_p ()) - -/* Write function prologue. */ - -/* On vms we have two kinds of functions: - - - stack frame (PROC_STACK) - these are 'normal' functions with local vars and which are - calling other functions - - register frame (PROC_REGISTER) - keeps all data in registers, needs no stack - - We must pass this to the assembler so it can generate the - proper pdsc (procedure descriptor) - This is done with the '.pdesc' command. - - On not-vms, we don't really differentiate between the two, as we can - simply allocate stack without saving registers. */ - -void -alpha_expand_prologue () -{ - /* Registers to save. */ - unsigned long imask = 0; - unsigned long fmask = 0; - /* Stack space needed for pushing registers clobbered by us. */ - HOST_WIDE_INT sa_size; - /* Complete stack size needed. */ - HOST_WIDE_INT frame_size; - /* Offset from base reg to register save area. */ - HOST_WIDE_INT reg_offset; - rtx sa_reg, mem; - int i; - - sa_size = alpha_sa_size (); - - frame_size = get_frame_size (); - if (TARGET_OPEN_VMS) - frame_size = ALPHA_ROUND (sa_size - + (vms_is_stack_procedure ? 8 : 0) - + frame_size - + current_function_pretend_args_size); - else - frame_size = (ALPHA_ROUND (current_function_outgoing_args_size) - + sa_size - + ALPHA_ROUND (frame_size - + current_function_pretend_args_size)); - - if (TARGET_OPEN_VMS) - reg_offset = 8; - else - reg_offset = ALPHA_ROUND (current_function_outgoing_args_size); - - alpha_sa_mask (&imask, &fmask); - - /* Adjust the stack by the frame size. If the frame size is > 4096 - bytes, we need to be sure we probe somewhere in the first and last - 4096 bytes (we can probably get away without the latter test) and - every 8192 bytes in between. If the frame size is > 32768, we - do this in a loop. Otherwise, we generate the explicit probe - instructions. - - Note that we are only allowed to adjust sp once in the prologue. */ - - if (frame_size <= 32768) - { - if (frame_size > 4096) - { - int probed = 4096; - - do - emit_insn (gen_probe_stack (GEN_INT (-probed))); - while ((probed += 8192) < frame_size); - - /* We only have to do this probe if we aren't saving registers. */ - if (sa_size == 0 && probed + 4096 < frame_size) - emit_insn (gen_probe_stack (GEN_INT (-frame_size))); - } - - if (frame_size != 0) - { - FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx, - GEN_INT (-frame_size)))); - } - } - else - { - /* Here we generate code to set R22 to SP + 4096 and set R23 to the - number of 8192 byte blocks to probe. We then probe each block - in the loop and then set SP to the proper location. If the - amount remaining is > 4096, we have to do one more probe if we - are not saving any registers. */ - - HOST_WIDE_INT blocks = (frame_size + 4096) / 8192; - HOST_WIDE_INT leftover = frame_size + 4096 - blocks * 8192; - rtx ptr = gen_rtx_REG (DImode, 22); - rtx count = gen_rtx_REG (DImode, 23); - rtx seq; - - emit_move_insn (count, GEN_INT (blocks)); - emit_insn (gen_adddi3 (ptr, stack_pointer_rtx, GEN_INT (4096))); - - /* Because of the difficulty in emitting a new basic block this - late in the compilation, generate the loop as a single insn. */ - emit_insn (gen_prologue_stack_probe_loop (count, ptr)); - - if (leftover > 4096 && sa_size == 0) - { - rtx last = gen_rtx_MEM (DImode, plus_constant (ptr, -leftover)); - MEM_VOLATILE_P (last) = 1; - emit_move_insn (last, const0_rtx); - } - - if (TARGET_WINDOWS_NT) - { - /* For NT stack unwind (done by 'reverse execution'), it's - not OK to take the result of a loop, even though the value - is already in ptr, so we reload it via a single operation - and subtract it to sp. - - Yes, that's correct -- we have to reload the whole constant - into a temporary via ldah+lda then subtract from sp. To - ensure we get ldah+lda, we use a special pattern. */ - - HOST_WIDE_INT lo, hi; - lo = ((frame_size & 0xffff) ^ 0x8000) - 0x8000; - hi = frame_size - lo; - - emit_move_insn (ptr, GEN_INT (hi)); - emit_insn (gen_nt_lda (ptr, GEN_INT (lo))); - seq = emit_insn (gen_subdi3 (stack_pointer_rtx, stack_pointer_rtx, - ptr)); - } - else - { - seq = emit_insn (gen_adddi3 (stack_pointer_rtx, ptr, - GEN_INT (-leftover))); - } - - /* This alternative is special, because the DWARF code cannot - possibly intuit through the loop above. So we invent this - note it looks at instead. */ - RTX_FRAME_RELATED_P (seq) = 1; - REG_NOTES (seq) - = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, - gen_rtx_SET (VOIDmode, stack_pointer_rtx, - gen_rtx_PLUS (Pmode, stack_pointer_rtx, - GEN_INT (-frame_size))), - REG_NOTES (seq)); - } - - /* Cope with very large offsets to the register save area. */ - sa_reg = stack_pointer_rtx; - if (reg_offset + sa_size > 0x8000) - { - int low = ((reg_offset & 0xffff) ^ 0x8000) - 0x8000; - HOST_WIDE_INT bias; - - if (low + sa_size <= 0x8000) - bias = reg_offset - low, reg_offset = low; - else - bias = reg_offset, reg_offset = 0; - - sa_reg = gen_rtx_REG (DImode, 24); - FRP (emit_insn (gen_adddi3 (sa_reg, stack_pointer_rtx, GEN_INT (bias)))); - } - - /* Save regs in stack order. Beginning with VMS PV. */ - if (TARGET_OPEN_VMS && vms_is_stack_procedure) - { - mem = gen_rtx_MEM (DImode, stack_pointer_rtx); - MEM_ALIAS_SET (mem) = alpha_sr_alias_set; - FRP (emit_move_insn (mem, gen_rtx_REG (DImode, REG_PV))); - } - - /* Save register RA next. */ - if (imask & (1L << REG_RA)) - { - mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); - MEM_ALIAS_SET (mem) = alpha_sr_alias_set; - FRP (emit_move_insn (mem, gen_rtx_REG (DImode, REG_RA))); - imask &= ~(1L << REG_RA); - reg_offset += 8; - } - - /* Now save any other registers required to be saved. */ - for (i = 0; i < 32; i++) - if (imask & (1L << i)) - { - mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); - MEM_ALIAS_SET (mem) = alpha_sr_alias_set; - FRP (emit_move_insn (mem, gen_rtx_REG (DImode, i))); - reg_offset += 8; - } - - for (i = 0; i < 32; i++) - if (fmask & (1L << i)) - { - mem = gen_rtx_MEM (DFmode, plus_constant (sa_reg, reg_offset)); - MEM_ALIAS_SET (mem) = alpha_sr_alias_set; - FRP (emit_move_insn (mem, gen_rtx_REG (DFmode, i+32))); - reg_offset += 8; - } - - if (TARGET_OPEN_VMS) - { - if (!vms_is_stack_procedure) - { - /* Register frame procedures fave the fp. */ - FRP (emit_move_insn (gen_rtx_REG (DImode, vms_save_fp_regno), - hard_frame_pointer_rtx)); - } - - if (vms_base_regno != REG_PV) - FRP (emit_move_insn (gen_rtx_REG (DImode, vms_base_regno), - gen_rtx_REG (DImode, REG_PV))); - - if (vms_unwind_regno == HARD_FRAME_POINTER_REGNUM) - { - FRP (emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx)); - } - - /* If we have to allocate space for outgoing args, do it now. */ - if (current_function_outgoing_args_size != 0) - { - FRP (emit_move_insn (stack_pointer_rtx, - plus_constant (hard_frame_pointer_rtx, - - ALPHA_ROUND (current_function_outgoing_args_size)))); - } - } - else - { - /* If we need a frame pointer, set it from the stack pointer. */ - if (frame_pointer_needed) - { - if (TARGET_CAN_FAULT_IN_PROLOGUE) - FRP (emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx)); - else - { - /* This must always be the last instruction in the - prologue, thus we emit a special move + clobber. */ - FRP (emit_insn (gen_init_fp (hard_frame_pointer_rtx, - stack_pointer_rtx, sa_reg))); - } - } - } - - /* The ABIs for VMS and OSF/1 say that while we can schedule insns into - the prologue, for exception handling reasons, we cannot do this for - any insn that might fault. We could prevent this for mems with a - (clobber:BLK (scratch)), but this doesn't work for fp insns. So we - have to prevent all such scheduling with a blockage. - - Linux, on the other hand, never bothered to implement OSF/1's - exception handling, and so doesn't care about such things. Anyone - planning to use dwarf2 frame-unwind info can also omit the blockage. */ - - if (! TARGET_CAN_FAULT_IN_PROLOGUE) - emit_insn (gen_blockage ()); -} - -/* Output the textual info surrounding the prologue. */ - -void -alpha_start_function (file, fnname, decl) - FILE *file; - char *fnname; - tree decl ATTRIBUTE_UNUSED; -{ - unsigned long imask = 0; - unsigned long fmask = 0; - /* Stack space needed for pushing registers clobbered by us. */ - HOST_WIDE_INT sa_size; - /* Complete stack size needed. */ - HOST_WIDE_INT frame_size; - /* Offset from base reg to register save area. */ - HOST_WIDE_INT reg_offset; - char *entry_label = (char *) alloca (strlen (fnname) + 6); - int i; - - sa_size = alpha_sa_size (); - - frame_size = get_frame_size (); - if (TARGET_OPEN_VMS) - frame_size = ALPHA_ROUND (sa_size - + (vms_is_stack_procedure ? 8 : 0) - + frame_size - + current_function_pretend_args_size); - else - frame_size = (ALPHA_ROUND (current_function_outgoing_args_size) - + sa_size - + ALPHA_ROUND (frame_size - + current_function_pretend_args_size)); - - if (TARGET_OPEN_VMS) - reg_offset = 8; - else - reg_offset = ALPHA_ROUND (current_function_outgoing_args_size); - - alpha_sa_mask (&imask, &fmask); - - /* Ecoff can handle multiple .file directives, so put out file and lineno. - We have to do that before the .ent directive as we cannot switch - files within procedures with native ecoff because line numbers are - linked to procedure descriptors. - Outputting the lineno helps debugging of one line functions as they - would otherwise get no line number at all. Please note that we would - like to put out last_linenum from final.c, but it is not accessible. */ - - if (write_symbols == SDB_DEBUG) - { - ASM_OUTPUT_SOURCE_FILENAME (file, - DECL_SOURCE_FILE (current_function_decl)); - if (debug_info_level != DINFO_LEVEL_TERSE) - ASM_OUTPUT_SOURCE_LINE (file, - DECL_SOURCE_LINE (current_function_decl)); - } - - /* Issue function start and label. */ - if (TARGET_OPEN_VMS || !flag_inhibit_size_directive) - { - fputs ("\t.ent ", file); - assemble_name (file, fnname); - putc ('\n', file); - } - - strcpy (entry_label, fnname); - if (TARGET_OPEN_VMS) - strcat (entry_label, "..en"); - ASM_OUTPUT_LABEL (file, entry_label); - inside_function = TRUE; - - if (TARGET_OPEN_VMS) - fprintf (file, "\t.base $%d\n", vms_base_regno); - - if (!TARGET_OPEN_VMS && TARGET_IEEE_CONFORMANT - && !flag_inhibit_size_directive) - { - /* Set flags in procedure descriptor to request IEEE-conformant - math-library routines. The value we set it to is PDSC_EXC_IEEE - (/usr/include/pdsc.h). */ - fputs ("\t.eflag 48\n", file); - } - - /* Set up offsets to alpha virtual arg/local debugging pointer. */ - alpha_auto_offset = -frame_size + current_function_pretend_args_size; - alpha_arg_offset = -frame_size + 48; - - /* Describe our frame. If the frame size is larger than an integer, - print it as zero to avoid an assembler error. We won't be - properly describing such a frame, but that's the best we can do. */ - if (TARGET_OPEN_VMS) - { - fprintf (file, "\t.frame $%d,", vms_unwind_regno); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - frame_size >= (1l << 31) ? 0 : frame_size); - fputs (",$26,", file); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, reg_offset); - fputs ("\n", file); - } - else if (!flag_inhibit_size_directive) - { - fprintf (file, "\t.frame $%d,", - (frame_pointer_needed - ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM)); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - frame_size >= (1l << 31) ? 0 : frame_size); - fprintf (file, ",$26,%d\n", current_function_pretend_args_size); - } - - /* Describe which registers were spilled. */ - if (TARGET_OPEN_VMS) - { - if (imask) - /* ??? Does VMS care if mask contains ra? The old code did'nt - set it, so I don't here. */ - fprintf (file, "\t.mask 0x%lx,0\n", imask & ~(1L << REG_RA)); - if (fmask) - fprintf (file, "\t.fmask 0x%lx,0\n", fmask); - if (!vms_is_stack_procedure) - fprintf (file, "\t.fp_save $%d\n", vms_save_fp_regno); - } - else if (!flag_inhibit_size_directive) - { - if (imask) - { - fprintf (file, "\t.mask 0x%lx,", imask); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - frame_size >= (1l << 31) ? 0 : reg_offset - frame_size); - putc ('\n', file); - - for (i = 0; i < 32; ++i) - if (imask & (1L << i)) - reg_offset += 8; - } - - if (fmask) - { - fprintf (file, "\t.fmask 0x%lx,", fmask); - fprintf (file, HOST_WIDE_INT_PRINT_DEC, - frame_size >= (1l << 31) ? 0 : reg_offset - frame_size); - putc ('\n', file); - } - } - - /* Emit GP related things. It is rather unfortunate about the alignment - issues surrounding a CODE_LABEL that forces us to do the label in - plain text. */ - if (!TARGET_OPEN_VMS && !TARGET_WINDOWS_NT) - { - alpha_function_needs_gp = alpha_does_function_need_gp (); - if (alpha_function_needs_gp) - fputs ("\tldgp $29,0($27)\n", file); - - putc ('$', file); - assemble_name (file, fnname); - fputs ("..ng:\n", file); - } - -#ifdef OPEN_VMS - /* Ifdef'ed cause readonly_section and link_section are only - available then. */ - readonly_section (); - fprintf (file, "\t.align 3\n"); - assemble_name (file, fnname); fputs ("..na:\n", file); - fputs ("\t.ascii \"", file); - assemble_name (file, fnname); - fputs ("\\0\"\n", file); - - link_section (); - fprintf (file, "\t.align 3\n"); - fputs ("\t.name ", file); - assemble_name (file, fnname); - fputs ("..na\n", file); - ASM_OUTPUT_LABEL (file, fnname); - fprintf (file, "\t.pdesc "); - assemble_name (file, fnname); - fprintf (file, "..en,%s\n", vms_is_stack_procedure ? "stack" : "reg"); - alpha_need_linkage (fnname, 1); - text_section (); -#endif -} - -/* Emit the .prologue note at the scheduled end of the prologue. */ - -void -output_end_prologue (file) - FILE *file; -{ - if (TARGET_OPEN_VMS) - fputs ("\t.prologue\n", file); - else if (TARGET_WINDOWS_NT) - fputs ("\t.prologue 0\n", file); - else if (!flag_inhibit_size_directive) - fprintf (file, "\t.prologue %d\n", alpha_function_needs_gp); -} - -/* Write function epilogue. */ - -/* ??? At some point we will want to support full unwind, and so will - need to mark the epilogue as well. At the moment, we just confuse - dwarf2out. */ -#undef FRP -#define FRP(exp) exp - -void -alpha_expand_epilogue () -{ - /* Registers to save. */ - unsigned long imask = 0; - unsigned long fmask = 0; - /* Stack space needed for pushing registers clobbered by us. */ - HOST_WIDE_INT sa_size; - /* Complete stack size needed. */ - HOST_WIDE_INT frame_size; - /* Offset from base reg to register save area. */ - HOST_WIDE_INT reg_offset; - int fp_is_frame_pointer, fp_offset; - rtx sa_reg, sa_reg_exp = NULL; - rtx sp_adj1, sp_adj2, mem; - int i; - - sa_size = alpha_sa_size (); - - frame_size = get_frame_size (); - if (TARGET_OPEN_VMS) - frame_size = ALPHA_ROUND (sa_size - + (vms_is_stack_procedure ? 8 : 0) - + frame_size - + current_function_pretend_args_size); - else - frame_size = (ALPHA_ROUND (current_function_outgoing_args_size) - + sa_size - + ALPHA_ROUND (frame_size - + current_function_pretend_args_size)); - - if (TARGET_OPEN_VMS) - reg_offset = 8; - else - reg_offset = ALPHA_ROUND (current_function_outgoing_args_size); - - alpha_sa_mask (&imask, &fmask); - - fp_is_frame_pointer = ((TARGET_OPEN_VMS && vms_is_stack_procedure) - || (!TARGET_OPEN_VMS && frame_pointer_needed)); - - if (sa_size) - { - /* If we have a frame pointer, restore SP from it. */ - if ((TARGET_OPEN_VMS - && vms_unwind_regno == HARD_FRAME_POINTER_REGNUM) - || (!TARGET_OPEN_VMS && frame_pointer_needed)) - { - FRP (emit_move_insn (stack_pointer_rtx, hard_frame_pointer_rtx)); - } - - /* Cope with very large offsets to the register save area. */ - sa_reg = stack_pointer_rtx; - if (reg_offset + sa_size > 0x8000) - { - int low = ((reg_offset & 0xffff) ^ 0x8000) - 0x8000; - HOST_WIDE_INT bias; - - if (low + sa_size <= 0x8000) - bias = reg_offset - low, reg_offset = low; - else - bias = reg_offset, reg_offset = 0; - - sa_reg = gen_rtx_REG (DImode, 22); - sa_reg_exp = plus_constant (stack_pointer_rtx, bias); - - FRP (emit_move_insn (sa_reg, sa_reg_exp)); - } - - /* Restore registers in order, excepting a true frame pointer. */ - - if (! alpha_eh_epilogue_sp_ofs) - { - mem = gen_rtx_MEM (DImode, plus_constant(sa_reg, reg_offset)); - MEM_ALIAS_SET (mem) = alpha_sr_alias_set; - FRP (emit_move_insn (gen_rtx_REG (DImode, REG_RA), mem)); - } - reg_offset += 8; - imask &= ~(1L << REG_RA); - - for (i = 0; i < 32; ++i) - if (imask & (1L << i)) - { - if (i == HARD_FRAME_POINTER_REGNUM && fp_is_frame_pointer) - fp_offset = reg_offset; - else - { - mem = gen_rtx_MEM (DImode, plus_constant(sa_reg, reg_offset)); - MEM_ALIAS_SET (mem) = alpha_sr_alias_set; - FRP (emit_move_insn (gen_rtx_REG (DImode, i), mem)); - } - reg_offset += 8; - } - - for (i = 0; i < 32; ++i) - if (fmask & (1L << i)) - { - mem = gen_rtx_MEM (DFmode, plus_constant(sa_reg, reg_offset)); - MEM_ALIAS_SET (mem) = alpha_sr_alias_set; - FRP (emit_move_insn (gen_rtx_REG (DFmode, i+32), mem)); - reg_offset += 8; - } - } - - if (frame_size || alpha_eh_epilogue_sp_ofs) - { - sp_adj1 = stack_pointer_rtx; - - if (alpha_eh_epilogue_sp_ofs) - { - sp_adj1 = gen_rtx_REG (DImode, 23); - emit_move_insn (sp_adj1, - gen_rtx_PLUS (Pmode, stack_pointer_rtx, - alpha_eh_epilogue_sp_ofs)); - } - - /* If the stack size is large, begin computation into a temporary - register so as not to interfere with a potential fp restore, - which must be consecutive with an SP restore. */ - if (frame_size < 32768) - sp_adj2 = GEN_INT (frame_size); - else if (frame_size < 0x40007fffL) - { - int low = ((frame_size & 0xffff) ^ 0x8000) - 0x8000; - - sp_adj2 = plus_constant (sp_adj1, frame_size - low); - if (sa_reg_exp && rtx_equal_p (sa_reg_exp, sp_adj2)) - sp_adj1 = sa_reg; - else - { - sp_adj1 = gen_rtx_REG (DImode, 23); - FRP (emit_move_insn (sp_adj1, sp_adj2)); - } - sp_adj2 = GEN_INT (low); - } - else - { - rtx tmp = gen_rtx_REG (DImode, 23); - FRP (sp_adj2 = alpha_emit_set_const (tmp, DImode, frame_size, 3)); - if (!sp_adj2) - { - /* We can't drop new things to memory this late, afaik, - so build it up by pieces. */ - FRP (sp_adj2 = alpha_emit_set_long_const (tmp, frame_size, - -(frame_size < 0))); - if (!sp_adj2) - abort (); - } - } - - /* From now on, things must be in order. So emit blockages. */ - - /* Restore the frame pointer. */ - if (fp_is_frame_pointer) - { - emit_insn (gen_blockage ()); - mem = gen_rtx_MEM (DImode, plus_constant(sa_reg, fp_offset)); - MEM_ALIAS_SET (mem) = alpha_sr_alias_set; - FRP (emit_move_insn (hard_frame_pointer_rtx, mem)); - } - else if (TARGET_OPEN_VMS) - { - emit_insn (gen_blockage ()); - FRP (emit_move_insn (hard_frame_pointer_rtx, - gen_rtx_REG (DImode, vms_save_fp_regno))); - } - - /* Restore the stack pointer. */ - emit_insn (gen_blockage ()); - FRP (emit_move_insn (stack_pointer_rtx, - gen_rtx_PLUS (DImode, sp_adj1, sp_adj2))); - } - else - { - if (TARGET_OPEN_VMS && !vms_is_stack_procedure) - { - emit_insn (gen_blockage ()); - FRP (emit_move_insn (hard_frame_pointer_rtx, - gen_rtx_REG (DImode, vms_save_fp_regno))); - } - } - - /* Return. */ - emit_jump_insn (gen_return_internal ()); -} - -/* Output the rest of the textual info surrounding the epilogue. */ - -void -alpha_end_function (file, fnname, decl) - FILE *file; - char *fnname; - tree decl ATTRIBUTE_UNUSED; -{ - /* End the function. */ - if (!flag_inhibit_size_directive) - { - fputs ("\t.end ", file); - assemble_name (file, fnname); - putc ('\n', file); - } - inside_function = FALSE; - - /* Show that we know this function if it is called again. - - Don't do this for global functions in object files destined for a - shared library because the function may be overridden by the application - or other libraries. Similarly, don't do this for weak functions. */ - - if (!DECL_WEAK (current_function_decl) - && (!flag_pic || !TREE_PUBLIC (current_function_decl))) - SYMBOL_REF_FLAG (XEXP (DECL_RTL (current_function_decl), 0)) = 1; -} - -/* Debugging support. */ - -#include "gstab.h" - -/* Count the number of sdb related labels are generated (to find block - start and end boundaries). */ - -int sdb_label_count = 0; - -/* Next label # for each statement. */ - -static int sym_lineno = 0; - -/* Count the number of .file directives, so that .loc is up to date. */ - -static int num_source_filenames = 0; - -/* Name of the file containing the current function. */ - -static const char *current_function_file = ""; - -/* Offsets to alpha virtual arg/local debugging pointers. */ - -long alpha_arg_offset; -long alpha_auto_offset; - -/* Emit a new filename to a stream. */ - -void -alpha_output_filename (stream, name) - FILE *stream; - char *name; -{ - static int first_time = TRUE; - char ltext_label_name[100]; - - if (first_time) - { - first_time = FALSE; - ++num_source_filenames; - current_function_file = name; - fprintf (stream, "\t.file\t%d ", num_source_filenames); - output_quoted_string (stream, name); - fprintf (stream, "\n"); - if (!TARGET_GAS && write_symbols == DBX_DEBUG) - fprintf (stream, "\t#@stabs\n"); - } - - else if (write_symbols == DBX_DEBUG) - { - ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0); - fprintf (stream, "%s ", ASM_STABS_OP); - output_quoted_string (stream, name); - fprintf (stream, ",%d,0,0,%s\n", N_SOL, <ext_label_name[1]); - } - - else if (name != current_function_file - && strcmp (name, current_function_file) != 0) - { - if (inside_function && ! TARGET_GAS) - fprintf (stream, "\t#.file\t%d ", num_source_filenames); - else - { - ++num_source_filenames; - current_function_file = name; - fprintf (stream, "\t.file\t%d ", num_source_filenames); - } - - output_quoted_string (stream, name); - fprintf (stream, "\n"); - } -} - -/* Emit a linenumber to a stream. */ - -void -alpha_output_lineno (stream, line) - FILE *stream; - int line; -{ - if (write_symbols == DBX_DEBUG) - { - /* mips-tfile doesn't understand .stabd directives. */ - ++sym_lineno; - fprintf (stream, "$LM%d:\n\t%s %d,0,%d,$LM%d\n", - sym_lineno, ASM_STABN_OP, N_SLINE, line, sym_lineno); - } - else - fprintf (stream, "\n\t.loc\t%d %d\n", num_source_filenames, line); -} - -/* Structure to show the current status of registers and memory. */ - -struct shadow_summary -{ - struct { - unsigned long i : 31; /* Mask of int regs */ - unsigned long fp : 31; /* Mask of fp regs */ - unsigned long mem : 1; /* mem == imem | fpmem */ - } used, defd; -}; - -static void summarize_insn PROTO((rtx, struct shadow_summary *, int)); -static void alpha_handle_trap_shadows PROTO((rtx)); - -/* Summary the effects of expression X on the machine. Update SUM, a pointer - to the summary structure. SET is nonzero if the insn is setting the - object, otherwise zero. */ - -static void -summarize_insn (x, sum, set) - rtx x; - struct shadow_summary *sum; - int set; -{ - char *format_ptr; - int i, j; - - if (x == 0) - return; - - switch (GET_CODE (x)) - { - /* ??? Note that this case would be incorrect if the Alpha had a - ZERO_EXTRACT in SET_DEST. */ - case SET: - summarize_insn (SET_SRC (x), sum, 0); - summarize_insn (SET_DEST (x), sum, 1); - break; - - case CLOBBER: - summarize_insn (XEXP (x, 0), sum, 1); - break; - - case USE: - summarize_insn (XEXP (x, 0), sum, 0); - break; - - case ASM_OPERANDS: - for (i = ASM_OPERANDS_INPUT_LENGTH (x) - 1; i >= 0; i--) - summarize_insn (ASM_OPERANDS_INPUT (x, i), sum, 0); - break; - - case PARALLEL: - for (i = XVECLEN (x, 0) - 1; i >= 0; i--) - summarize_insn (XVECEXP (x, 0, i), sum, 0); - break; - - case SUBREG: - summarize_insn (SUBREG_REG (x), sum, 0); - break; - - case REG: - { - int regno = REGNO (x); - unsigned long mask = 1UL << (regno % 32); - - if (regno == 31 || regno == 63) - break; - - if (set) - { - if (regno < 32) - sum->defd.i |= mask; - else - sum->defd.fp |= mask; - } - else - { - if (regno < 32) - sum->used.i |= mask; - else - sum->used.fp |= mask; - } - } - break; - - case MEM: - if (set) - sum->defd.mem = 1; - else - sum->used.mem = 1; - - /* Find the regs used in memory address computation: */ - summarize_insn (XEXP (x, 0), sum, 0); - break; - - case CONST_INT: case CONST_DOUBLE: - case SYMBOL_REF: case LABEL_REF: case CONST: - break; - - /* Handle common unary and binary ops for efficiency. */ - case COMPARE: case PLUS: case MINUS: case MULT: case DIV: - case MOD: case UDIV: case UMOD: case AND: case IOR: - case XOR: case ASHIFT: case ROTATE: case ASHIFTRT: case LSHIFTRT: - case ROTATERT: case SMIN: case SMAX: case UMIN: case UMAX: - case NE: case EQ: case GE: case GT: case LE: - case LT: case GEU: case GTU: case LEU: case LTU: - summarize_insn (XEXP (x, 0), sum, 0); - summarize_insn (XEXP (x, 1), sum, 0); - break; - - case NEG: case NOT: case SIGN_EXTEND: case ZERO_EXTEND: - case TRUNCATE: case FLOAT_EXTEND: case FLOAT_TRUNCATE: case FLOAT: - case FIX: case UNSIGNED_FLOAT: case UNSIGNED_FIX: case ABS: - case SQRT: case FFS: - summarize_insn (XEXP (x, 0), sum, 0); - break; - - default: - format_ptr = GET_RTX_FORMAT (GET_CODE (x)); - for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--) - switch (format_ptr[i]) - { - case 'e': - summarize_insn (XEXP (x, i), sum, 0); - break; - - case 'E': - for (j = XVECLEN (x, i) - 1; j >= 0; j--) - summarize_insn (XVECEXP (x, i, j), sum, 0); - break; - - case 'i': - break; - - default: - abort (); - } - } -} - -/* Ensure a sufficient number of `trapb' insns are in the code when - the user requests code with a trap precision of functions or - instructions. - - In naive mode, when the user requests a trap-precision of - "instruction", a trapb is needed after every instruction that may - generate a trap. This ensures that the code is resumption safe but - it is also slow. - - When optimizations are turned on, we delay issuing a trapb as long - as possible. In this context, a trap shadow is the sequence of - instructions that starts with a (potentially) trap generating - instruction and extends to the next trapb or call_pal instruction - (but GCC never generates call_pal by itself). We can delay (and - therefore sometimes omit) a trapb subject to the following - conditions: - - (a) On entry to the trap shadow, if any Alpha register or memory - location contains a value that is used as an operand value by some - instruction in the trap shadow (live on entry), then no instruction - in the trap shadow may modify the register or memory location. - - (b) Within the trap shadow, the computation of the base register - for a memory load or store instruction may not involve using the - result of an instruction that might generate an UNPREDICTABLE - result. - - (c) Within the trap shadow, no register may be used more than once - as a destination register. (This is to make life easier for the - trap-handler.) - - (d) The trap shadow may not include any branch instructions. */ - -static void -alpha_handle_trap_shadows (insns) - rtx insns; -{ - struct shadow_summary shadow; - int trap_pending, exception_nesting; - rtx i, n; - - trap_pending = 0; - exception_nesting = 0; - shadow.used.i = 0; - shadow.used.fp = 0; - shadow.used.mem = 0; - shadow.defd = shadow.used; - - for (i = insns; i ; i = NEXT_INSN (i)) - { - if (GET_CODE (i) == NOTE) - { - switch (NOTE_LINE_NUMBER (i)) - { - case NOTE_INSN_EH_REGION_BEG: - exception_nesting++; - if (trap_pending) - goto close_shadow; - break; - - case NOTE_INSN_EH_REGION_END: - exception_nesting--; - if (trap_pending) - goto close_shadow; - break; - - case NOTE_INSN_EPILOGUE_BEG: - if (trap_pending && alpha_tp >= ALPHA_TP_FUNC) - goto close_shadow; - break; - } - } - else if (trap_pending) - { - if (alpha_tp == ALPHA_TP_FUNC) - { - if (GET_CODE (i) == JUMP_INSN - && GET_CODE (PATTERN (i)) == RETURN) - goto close_shadow; - } - else if (alpha_tp == ALPHA_TP_INSN) - { - if (optimize > 0) - { - struct shadow_summary sum; - - sum.used.i = 0; - sum.used.fp = 0; - sum.used.mem = 0; - sum.defd = sum.used; - - switch (GET_CODE (i)) - { - case INSN: - /* Annoyingly, get_attr_trap will abort on these. */ - if (GET_CODE (PATTERN (i)) == USE - || GET_CODE (PATTERN (i)) == CLOBBER) - break; - - summarize_insn (PATTERN (i), &sum, 0); - - if ((sum.defd.i & shadow.defd.i) - || (sum.defd.fp & shadow.defd.fp)) - { - /* (c) would be violated */ - goto close_shadow; - } - - /* Combine shadow with summary of current insn: */ - shadow.used.i |= sum.used.i; - shadow.used.fp |= sum.used.fp; - shadow.used.mem |= sum.used.mem; - shadow.defd.i |= sum.defd.i; - shadow.defd.fp |= sum.defd.fp; - shadow.defd.mem |= sum.defd.mem; - - if ((sum.defd.i & shadow.used.i) - || (sum.defd.fp & shadow.used.fp) - || (sum.defd.mem & shadow.used.mem)) - { - /* (a) would be violated (also takes care of (b)) */ - if (get_attr_trap (i) == TRAP_YES - && ((sum.defd.i & sum.used.i) - || (sum.defd.fp & sum.used.fp))) - abort (); - - goto close_shadow; - } - break; - - case JUMP_INSN: - case CALL_INSN: - case CODE_LABEL: - goto close_shadow; - - default: - abort (); - } - } - else - { - close_shadow: - n = emit_insn_before (gen_trapb (), i); - PUT_MODE (n, TImode); - PUT_MODE (i, TImode); - trap_pending = 0; - shadow.used.i = 0; - shadow.used.fp = 0; - shadow.used.mem = 0; - shadow.defd = shadow.used; - } - } - } - - if ((exception_nesting > 0 || alpha_tp >= ALPHA_TP_FUNC) - && GET_CODE (i) == INSN - && GET_CODE (PATTERN (i)) != USE - && GET_CODE (PATTERN (i)) != CLOBBER - && get_attr_trap (i) == TRAP_YES) - { - if (optimize && !trap_pending) - summarize_insn (PATTERN (i), &shadow, 0); - trap_pending = 1; - } - } -} - -#ifdef HAIFA -/* Alpha can only issue instruction groups simultaneously if they are - suitibly aligned. This is very processor-specific. */ - -enum alphaev4_pipe { - EV4_STOP = 0, - EV4_IB0 = 1, - EV4_IB1 = 2, - EV4_IBX = 4 -}; - -enum alphaev5_pipe { - EV5_STOP = 0, - EV5_NONE = 1, - EV5_E01 = 2, - EV5_E0 = 4, - EV5_E1 = 8, - EV5_FAM = 16, - EV5_FA = 32, - EV5_FM = 64 -}; - -static enum alphaev4_pipe alphaev4_insn_pipe PROTO((rtx)); -static enum alphaev5_pipe alphaev5_insn_pipe PROTO((rtx)); -static rtx alphaev4_next_group PROTO((rtx, int*, int*)); -static rtx alphaev5_next_group PROTO((rtx, int*, int*)); -static rtx alphaev4_next_nop PROTO((int*)); -static rtx alphaev5_next_nop PROTO((int*)); - -static void alpha_align_insns - PROTO((rtx, int, rtx (*)(rtx, int*, int*), rtx (*)(int*), int)); - -static enum alphaev4_pipe -alphaev4_insn_pipe (insn) - rtx insn; -{ - if (recog_memoized (insn) < 0) - return EV4_STOP; - if (get_attr_length (insn) != 4) - return EV4_STOP; - - switch (get_attr_type (insn)) - { - case TYPE_ILD: - case TYPE_FLD: - return EV4_IBX; - - case TYPE_LDSYM: - case TYPE_IADD: - case TYPE_ILOG: - case TYPE_ICMOV: - case TYPE_ICMP: - case TYPE_IST: - case TYPE_FST: - case TYPE_SHIFT: - case TYPE_IMUL: - case TYPE_FBR: - return EV4_IB0; - - case TYPE_MISC: - case TYPE_IBR: - case TYPE_JSR: - case TYPE_FCPYS: - case TYPE_FCMOV: - case TYPE_FADD: - case TYPE_FDIV: - case TYPE_FMUL: - return EV4_IB1; - - default: - abort(); - } -} - -static enum alphaev5_pipe -alphaev5_insn_pipe (insn) - rtx insn; -{ - if (recog_memoized (insn) < 0) - return EV5_STOP; - if (get_attr_length (insn) != 4) - return EV5_STOP; - - switch (get_attr_type (insn)) - { - case TYPE_ILD: - case TYPE_FLD: - case TYPE_LDSYM: - case TYPE_IADD: - case TYPE_ILOG: - case TYPE_ICMOV: - case TYPE_ICMP: - return EV5_E01; - - case TYPE_IST: - case TYPE_FST: - case TYPE_SHIFT: - case TYPE_IMUL: - case TYPE_MISC: - case TYPE_MVI: - return EV5_E0; - - case TYPE_IBR: - case TYPE_JSR: - return EV5_E1; - - case TYPE_FCPYS: - return EV5_FAM; - - case TYPE_FBR: - case TYPE_FCMOV: - case TYPE_FADD: - case TYPE_FDIV: - return EV5_FA; - - case TYPE_FMUL: - return EV5_FM; - - default: - abort(); - } -} - -/* IN_USE is a mask of the slots currently filled within the insn group. - The mask bits come from alphaev4_pipe above. If EV4_IBX is set, then - the insn in EV4_IB0 can be swapped by the hardware into EV4_IB1. - - LEN is, of course, the length of the group in bytes. */ - -static rtx -alphaev4_next_group (insn, pin_use, plen) - rtx insn; - int *pin_use, *plen; -{ - int len, in_use; - - len = in_use = 0; - - if (GET_RTX_CLASS (GET_CODE (insn)) != 'i' - || GET_CODE (PATTERN (insn)) == CLOBBER - || GET_CODE (PATTERN (insn)) == USE) - goto next_and_done; - - while (1) - { - enum alphaev4_pipe pipe; - - pipe = alphaev4_insn_pipe (insn); - switch (pipe) - { - case EV4_STOP: - /* Force complex instructions to start new groups. */ - if (in_use) - goto done; - - /* If this is a completely unrecognized insn, its an asm. - We don't know how long it is, so record length as -1 to - signal a needed realignment. */ - if (recog_memoized (insn) < 0) - len = -1; - else - len = get_attr_length (insn); - goto next_and_done; - - case EV4_IBX: - if (in_use & EV4_IB0) - { - if (in_use & EV4_IB1) - goto done; - in_use |= EV4_IB1; - } - else - in_use |= EV4_IB0 | EV4_IBX; - break; - - case EV4_IB0: - if (in_use & EV4_IB0) - { - if (!(in_use & EV4_IBX) || (in_use & EV4_IB1)) - goto done; - in_use |= EV4_IB1; - } - in_use |= EV4_IB0; - break; - - case EV4_IB1: - if (in_use & EV4_IB1) - goto done; - in_use |= EV4_IB1; - break; - - default: - abort(); - } - len += 4; - - /* Haifa doesn't do well scheduling branches. */ - if (GET_CODE (insn) == JUMP_INSN) - goto next_and_done; - - next: - insn = next_nonnote_insn (insn); - - if (!insn || GET_RTX_CLASS (GET_CODE (insn)) != 'i') - goto done; - - /* Let Haifa tell us where it thinks insn group boundaries are. */ - if (GET_MODE (insn) == TImode) - goto done; - - if (GET_CODE (insn) == CLOBBER || GET_CODE (insn) == USE) - goto next; - } - - next_and_done: - insn = next_nonnote_insn (insn); - - done: - *plen = len; - *pin_use = in_use; - return insn; -} - -/* IN_USE is a mask of the slots currently filled within the insn group. - The mask bits come from alphaev5_pipe above. If EV5_E01 is set, then - the insn in EV5_E0 can be swapped by the hardware into EV5_E1. - - LEN is, of course, the length of the group in bytes. */ - -static rtx -alphaev5_next_group (insn, pin_use, plen) - rtx insn; - int *pin_use, *plen; -{ - int len, in_use; - - len = in_use = 0; - - if (GET_RTX_CLASS (GET_CODE (insn)) != 'i' - || GET_CODE (PATTERN (insn)) == CLOBBER - || GET_CODE (PATTERN (insn)) == USE) - goto next_and_done; - - while (1) - { - enum alphaev5_pipe pipe; - - pipe = alphaev5_insn_pipe (insn); - switch (pipe) - { - case EV5_STOP: - /* Force complex instructions to start new groups. */ - if (in_use) - goto done; - - /* If this is a completely unrecognized insn, its an asm. - We don't know how long it is, so record length as -1 to - signal a needed realignment. */ - if (recog_memoized (insn) < 0) - len = -1; - else - len = get_attr_length (insn); - goto next_and_done; - - /* ??? Most of the places below, we would like to abort, as - it would indicate an error either in Haifa, or in the - scheduling description. Unfortunately, Haifa never - schedules the last instruction of the BB, so we don't - have an accurate TI bit to go off. */ - case EV5_E01: - if (in_use & EV5_E0) - { - if (in_use & EV5_E1) - goto done; - in_use |= EV5_E1; - } - else - in_use |= EV5_E0 | EV5_E01; - break; - - case EV5_E0: - if (in_use & EV5_E0) - { - if (!(in_use & EV5_E01) || (in_use & EV5_E1)) - goto done; - in_use |= EV5_E1; - } - in_use |= EV5_E0; - break; - - case EV5_E1: - if (in_use & EV5_E1) - goto done; - in_use |= EV5_E1; - break; - - case EV5_FAM: - if (in_use & EV5_FA) - { - if (in_use & EV5_FM) - goto done; - in_use |= EV5_FM; - } - else - in_use |= EV5_FA | EV5_FAM; - break; - - case EV5_FA: - if (in_use & EV5_FA) - goto done; - in_use |= EV5_FA; - break; - - case EV5_FM: - if (in_use & EV5_FM) - goto done; - in_use |= EV5_FM; - break; - - case EV5_NONE: - break; - - default: - abort(); - } - len += 4; - - /* Haifa doesn't do well scheduling branches. */ - /* ??? If this is predicted not-taken, slotting continues, except - that no more IBR, FBR, or JSR insns may be slotted. */ - if (GET_CODE (insn) == JUMP_INSN) - goto next_and_done; - - next: - insn = next_nonnote_insn (insn); - - if (!insn || GET_RTX_CLASS (GET_CODE (insn)) != 'i') - goto done; - - /* Let Haifa tell us where it thinks insn group boundaries are. */ - if (GET_MODE (insn) == TImode) - goto done; - - if (GET_CODE (insn) == CLOBBER || GET_CODE (insn) == USE) - goto next; - } - - next_and_done: - insn = next_nonnote_insn (insn); - - done: - *plen = len; - *pin_use = in_use; - return insn; -} - -static rtx -alphaev4_next_nop (pin_use) - int *pin_use; -{ - int in_use = *pin_use; - rtx nop; - - if (!(in_use & EV4_IB0)) - { - in_use |= EV4_IB0; - nop = gen_nop (); - } - else if ((in_use & (EV4_IBX|EV4_IB1)) == EV4_IBX) - { - in_use |= EV4_IB1; - nop = gen_nop (); - } - else if (TARGET_FP && !(in_use & EV4_IB1)) - { - in_use |= EV4_IB1; - nop = gen_fnop (); - } - else - nop = gen_unop (); - - *pin_use = in_use; - return nop; -} - -static rtx -alphaev5_next_nop (pin_use) - int *pin_use; -{ - int in_use = *pin_use; - rtx nop; - - if (!(in_use & EV5_E1)) - { - in_use |= EV5_E1; - nop = gen_nop (); - } - else if (TARGET_FP && !(in_use & EV5_FA)) - { - in_use |= EV5_FA; - nop = gen_fnop (); - } - else if (TARGET_FP && !(in_use & EV5_FM)) - { - in_use |= EV5_FM; - nop = gen_fnop (); - } - else - nop = gen_unop (); - - *pin_use = in_use; - return nop; -} - -/* The instruction group alignment main loop. */ - -static void -alpha_align_insns (insns, max_align, next_group, next_nop, gp_in_use) - rtx insns; - int max_align; - rtx (*next_group) PROTO((rtx, int*, int*)); - rtx (*next_nop) PROTO((int*)); - int gp_in_use; -{ - /* ALIGN is the known alignment for the insn group. */ - int align; - /* OFS is the offset of the current insn in the insn group. */ - int ofs; - int prev_in_use, in_use, len; - rtx i, next; - - /* Let shorten branches care for assigning alignments to code labels. */ - shorten_branches (insns); - - align = (FUNCTION_BOUNDARY/BITS_PER_UNIT < max_align - ? FUNCTION_BOUNDARY/BITS_PER_UNIT : max_align); - - /* Account for the initial GP load, which happens before the scheduled - prologue we emitted as RTL. */ - ofs = prev_in_use = 0; - if (alpha_does_function_need_gp()) - { - ofs = 8 & (align - 1); - prev_in_use = gp_in_use; - } - - i = insns; - if (GET_CODE (i) == NOTE) - i = next_nonnote_insn (i); - - while (i) - { - next = (*next_group)(i, &in_use, &len); - - /* When we see a label, resync alignment etc. */ - if (GET_CODE (i) == CODE_LABEL) - { - int new_align = 1 << label_to_alignment (i); - if (new_align >= align) - { - align = new_align < max_align ? new_align : max_align; - ofs = 0; - } - else if (ofs & (new_align-1)) - ofs = (ofs | (new_align-1)) + 1; - if (len != 0) - abort(); - } - - /* Handle complex instructions special. */ - else if (in_use == 0) - { - /* Asms will have length < 0. This is a signal that we have - lost alignment knowledge. Assume, however, that the asm - will not mis-align instructions. */ - if (len < 0) - { - ofs = 0; - align = 4; - len = 0; - } - } - - /* If the known alignment is smaller than the recognized insn group, - realign the output. */ - else if (align < len) - { - int new_log_align = len > 8 ? 4 : 3; - rtx where; - - where = prev_nonnote_insn (i); - if (!where || GET_CODE (where) != CODE_LABEL) - where = i; - - emit_insn_before (gen_realign (GEN_INT (new_log_align)), where); - align = 1 << new_log_align; - ofs = 0; - } - - /* If the group won't fit in the same INT16 as the previous, - we need to add padding to keep the group together. Rather - than simply leaving the insn filling to the assembler, we - can make use of the knowledge of what sorts of instructions - were issued in the previous group to make sure that all of - the added nops are really free. */ - else if (ofs + len > align) - { - int nop_count = (align - ofs) / 4; - rtx where; - - /* Insert nops before labels and branches to truely merge the - execution of the nops with the previous instruction group. */ - where = prev_nonnote_insn (i); - if (where) - { - if (GET_CODE (where) == CODE_LABEL) - { - rtx where2 = prev_nonnote_insn (where); - if (where2 && GET_CODE (where2) == JUMP_INSN) - where = where2; - } - else if (GET_CODE (where) != JUMP_INSN) - where = i; - } - else - where = i; - - do - emit_insn_before ((*next_nop)(&prev_in_use), where); - while (--nop_count); - ofs = 0; - } - - ofs = (ofs + len) & (align - 1); - prev_in_use = in_use; - i = next; - } -} -#endif /* HAIFA */ - -/* Machine dependant reorg pass. */ - -void -alpha_reorg (insns) - rtx insns; -{ - if (alpha_tp != ALPHA_TP_PROG || flag_exceptions) - alpha_handle_trap_shadows (insns); - -#ifdef HAIFA - /* Due to the number of extra trapb insns, don't bother fixing up - alignment when trap precision is instruction. Moreover, we can - only do our job when sched2 is run and Haifa is our scheduler. */ - if (optimize && !optimize_size - && alpha_tp != ALPHA_TP_INSN - && flag_schedule_insns_after_reload) - { - if (alpha_cpu == PROCESSOR_EV4) - alpha_align_insns (insns, 8, alphaev4_next_group, - alphaev4_next_nop, EV4_IB0); - else if (alpha_cpu == PROCESSOR_EV5) - alpha_align_insns (insns, 16, alphaev5_next_group, - alphaev5_next_nop, EV5_E01 | EV5_E0); - } -#endif -} - - -/* Check a floating-point value for validity for a particular machine mode. */ - -static char * const float_strings[] = -{ - /* These are for FLOAT_VAX. */ - "1.70141173319264430e+38", /* 2^127 (2^24 - 1) / 2^24 */ - "-1.70141173319264430e+38", - "2.93873587705571877e-39", /* 2^-128 */ - "-2.93873587705571877e-39", - /* These are for the default broken IEEE mode, which traps - on infinity or denormal numbers. */ - "3.402823466385288598117e+38", /* 2^128 (1 - 2^-24) */ - "-3.402823466385288598117e+38", - "1.1754943508222875079687e-38", /* 2^-126 */ - "-1.1754943508222875079687e-38", -}; - -static REAL_VALUE_TYPE float_values[8]; -static int inited_float_values = 0; - -int -check_float_value (mode, d, overflow) - enum machine_mode mode; - REAL_VALUE_TYPE *d; - int overflow ATTRIBUTE_UNUSED; -{ - - if (TARGET_IEEE || TARGET_IEEE_CONFORMANT || TARGET_IEEE_WITH_INEXACT) - return 0; - - if (inited_float_values == 0) - { - int i; - for (i = 0; i < 8; i++) - float_values[i] = REAL_VALUE_ATOF (float_strings[i], DFmode); - - inited_float_values = 1; - } - - if (mode == SFmode) - { - REAL_VALUE_TYPE r; - REAL_VALUE_TYPE *fvptr; - - if (TARGET_FLOAT_VAX) - fvptr = &float_values[0]; - else - fvptr = &float_values[4]; - - bcopy ((char *) d, (char *) &r, sizeof (REAL_VALUE_TYPE)); - if (REAL_VALUES_LESS (fvptr[0], r)) - { - bcopy ((char *) &fvptr[0], (char *) d, - sizeof (REAL_VALUE_TYPE)); - return 1; - } - else if (REAL_VALUES_LESS (r, fvptr[1])) - { - bcopy ((char *) &fvptr[1], (char *) d, - sizeof (REAL_VALUE_TYPE)); - return 1; - } - else if (REAL_VALUES_LESS (dconst0, r) - && REAL_VALUES_LESS (r, fvptr[2])) - { - bcopy ((char *) &dconst0, (char *) d, sizeof (REAL_VALUE_TYPE)); - return 1; - } - else if (REAL_VALUES_LESS (r, dconst0) - && REAL_VALUES_LESS (fvptr[3], r)) - { - bcopy ((char *) &dconst0, (char *) d, sizeof (REAL_VALUE_TYPE)); - return 1; - } - } - - return 0; -} - -#if OPEN_VMS - -/* Return the VMS argument type corresponding to MODE. */ - -enum avms_arg_type -alpha_arg_type (mode) - enum machine_mode mode; -{ - switch (mode) - { - case SFmode: - return TARGET_FLOAT_VAX ? FF : FS; - case DFmode: - return TARGET_FLOAT_VAX ? FD : FT; - default: - return I64; - } -} - -/* Return an rtx for an integer representing the VMS Argument Information - register value. */ - -struct rtx_def * -alpha_arg_info_reg_val (cum) - CUMULATIVE_ARGS cum; -{ - unsigned HOST_WIDE_INT regval = cum.num_args; - int i; - - for (i = 0; i < 6; i++) - regval |= ((int) cum.atypes[i]) << (i * 3 + 8); - - return GEN_INT (regval); -} - -/* Structure to collect function names for final output - in link section. */ - -enum links_kind {KIND_UNUSED, KIND_LOCAL, KIND_EXTERN}; - - -struct alpha_links { - struct alpha_links *next; - char *name; - enum links_kind kind; -}; - -static struct alpha_links *alpha_links_base = 0; - -/* Make (or fake) .linkage entry for function call. - - IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */ - -void -alpha_need_linkage (name, is_local) - char *name; - int is_local; -{ - rtx x; - struct alpha_links *lptr, *nptr; - - if (name[0] == '*') - name++; - - /* Is this name already defined ? */ - - for (lptr = alpha_links_base; lptr; lptr = lptr->next) - if (strcmp (lptr->name, name) == 0) - { - if (is_local) - { - /* Defined here but external assumed. */ - if (lptr->kind == KIND_EXTERN) - lptr->kind = KIND_LOCAL; - } - else - { - /* Used here but unused assumed. */ - if (lptr->kind == KIND_UNUSED) - lptr->kind = KIND_LOCAL; - } - return; - } - - nptr = (struct alpha_links *) xmalloc (sizeof (struct alpha_links)); - nptr->next = alpha_links_base; - nptr->name = xstrdup (name); - - /* Assume external if no definition. */ - nptr->kind = (is_local ? KIND_UNUSED : KIND_EXTERN); - - /* Ensure we have an IDENTIFIER so assemble_name can mark is used. */ - get_identifier (name); - - alpha_links_base = nptr; - - return; -} - - -void -alpha_write_linkage (stream) - FILE *stream; -{ - struct alpha_links *lptr, *nptr; - - readonly_section (); - - fprintf (stream, "\t.align 3\n"); - - for (lptr = alpha_links_base; lptr; lptr = nptr) - { - nptr = lptr->next; - - if (lptr->kind == KIND_UNUSED - || ! TREE_SYMBOL_REFERENCED (get_identifier (lptr->name))) - continue; - - fprintf (stream, "$%s..lk:\n", lptr->name); - if (lptr->kind == KIND_LOCAL) - { - /* Local and used, build linkage pair. */ - fprintf (stream, "\t.quad %s..en\n", lptr->name); - fprintf (stream, "\t.quad %s\n", lptr->name); - } - else - /* External and used, request linkage pair. */ - fprintf (stream, "\t.linkage %s\n", lptr->name); - } -} - -#else - -void -alpha_need_linkage (name, is_local) - char *name ATTRIBUTE_UNUSED; - int is_local ATTRIBUTE_UNUSED; -{ -} - -#endif /* OPEN_VMS */ diff --git a/contrib/gcc/config/alpha/alpha.h b/contrib/gcc/config/alpha/alpha.h deleted file mode 100644 index e9c3f6d2f684..000000000000 --- a/contrib/gcc/config/alpha/alpha.h +++ /dev/null @@ -1,2550 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha. - Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Write out the correct language type definition for the header files. - Unless we have assembler language, write out the symbols for C. */ -#define CPP_SPEC "\ -%{!undef:\ -%{.S:-D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY }}\ -%{.cc|.cxx|.C:-D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus }\ -%{.m:-D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C }\ -%{!.S:%{!.cc:%{!.cxx:%{!.C:%{!.m:-D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C }}}}}}\ -%{mieee:-D_IEEE_FP }\ -%{mieee-with-inexact:-D_IEEE_FP -D_IEEE_FP_INEXACT }}\ -%(cpp_cpu) %(cpp_subtarget)" - -#ifndef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "" -#endif - -/* Set the spec to use for signed char. The default tests the above macro - but DEC's compiler can't handle the conditional in a "constant" - operand. */ - -#define SIGNED_CHAR_SPEC "%{funsigned-char:-D__CHAR_UNSIGNED__}" - -#define WORD_SWITCH_TAKES_ARG(STR) \ - (!strcmp (STR, "rpath") || !strcmp (STR, "include") \ - || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \ - || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \ - || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \ - || !strcmp (STR, "isystem")) - -/* Print subsidiary information on the compiler version in use. */ -#define TARGET_VERSION - -/* Run-time compilation parameters selecting different hardware subsets. */ - -/* Which processor to schedule for. The cpu attribute defines a list that - mirrors this list, so changes to alpha.md must be made at the same time. */ - -enum processor_type - {PROCESSOR_EV4, /* 2106[46]{a,} */ - PROCESSOR_EV5, /* 21164{a,pc,} */ - PROCESSOR_EV6}; /* 21264 */ - -extern enum processor_type alpha_cpu; - -enum alpha_trap_precision -{ - ALPHA_TP_PROG, /* No precision (default). */ - ALPHA_TP_FUNC, /* Trap contained within originating function. */ - ALPHA_TP_INSN /* Instruction accuracy and code is resumption safe. */ -}; - -enum alpha_fp_rounding_mode -{ - ALPHA_FPRM_NORM, /* Normal rounding mode. */ - ALPHA_FPRM_MINF, /* Round towards minus-infinity. */ - ALPHA_FPRM_CHOP, /* Chopped rounding mode (towards 0). */ - ALPHA_FPRM_DYN /* Dynamic rounding mode. */ -}; - -enum alpha_fp_trap_mode -{ - ALPHA_FPTM_N, /* Normal trap mode. */ - ALPHA_FPTM_U, /* Underflow traps enabled. */ - ALPHA_FPTM_SU, /* Software completion, w/underflow traps */ - ALPHA_FPTM_SUI /* Software completion, w/underflow & inexact traps */ -}; - -extern int target_flags; - -extern enum alpha_trap_precision alpha_tp; -extern enum alpha_fp_rounding_mode alpha_fprm; -extern enum alpha_fp_trap_mode alpha_fptm; - -/* This means that floating-point support exists in the target implementation - of the Alpha architecture. This is usually the default. */ -#define MASK_FP (1 << 0) -#define TARGET_FP (target_flags & MASK_FP) - -/* This means that floating-point registers are allowed to be used. Note - that Alpha implementations without FP operations are required to - provide the FP registers. */ - -#define MASK_FPREGS (1 << 1) -#define TARGET_FPREGS (target_flags & MASK_FPREGS) - -/* This means that gas is used to process the assembler file. */ - -#define MASK_GAS (1 << 2) -#define TARGET_GAS (target_flags & MASK_GAS) - -/* This means that we should mark procedures as IEEE conformant. */ - -#define MASK_IEEE_CONFORMANT (1 << 3) -#define TARGET_IEEE_CONFORMANT (target_flags & MASK_IEEE_CONFORMANT) - -/* This means we should be IEEE-compliant except for inexact. */ - -#define MASK_IEEE (1 << 4) -#define TARGET_IEEE (target_flags & MASK_IEEE) - -/* This means we should be fully IEEE-compliant. */ - -#define MASK_IEEE_WITH_INEXACT (1 << 5) -#define TARGET_IEEE_WITH_INEXACT (target_flags & MASK_IEEE_WITH_INEXACT) - -/* This means we must construct all constants rather than emitting - them as literal data. */ - -#define MASK_BUILD_CONSTANTS (1 << 6) -#define TARGET_BUILD_CONSTANTS (target_flags & MASK_BUILD_CONSTANTS) - -/* This means we handle floating points in VAX F- (float) - or G- (double) Format. */ - -#define MASK_FLOAT_VAX (1 << 7) -#define TARGET_FLOAT_VAX (target_flags & MASK_FLOAT_VAX) - -/* This means that the processor has byte and half word loads and stores - (the BWX extension). */ - -#define MASK_BWX (1 << 8) -#define TARGET_BWX (target_flags & MASK_BWX) - -/* This means that the processor has the MAX extension. */ -#define MASK_MAX (1 << 9) -#define TARGET_MAX (target_flags & MASK_MAX) - -/* This means that the processor has the FIX extension. */ -#define MASK_FIX (1 << 10) -#define TARGET_FIX (target_flags & MASK_FIX) - -/* This means that the processor has the CIX extension. */ -#define MASK_CIX (1 << 11) -#define TARGET_CIX (target_flags & MASK_CIX) - -/* This means that the processor is an EV5, EV56, or PCA56. This is defined - only in TARGET_CPU_DEFAULT. */ -#define MASK_CPU_EV5 (1 << 28) - -/* Likewise for EV6. */ -#define MASK_CPU_EV6 (1 << 29) - -/* This means we support the .arch directive in the assembler. Only - defined in TARGET_CPU_DEFAULT. */ -#define MASK_SUPPORT_ARCH (1 << 30) -#define TARGET_SUPPORT_ARCH (target_flags & MASK_SUPPORT_ARCH) - -/* These are for target os support and cannot be changed at runtime. */ -#ifndef TARGET_WINDOWS_NT -#define TARGET_WINDOWS_NT 0 -#endif -#ifndef TARGET_OPEN_VMS -#define TARGET_OPEN_VMS 0 -#endif - -#ifndef TARGET_AS_CAN_SUBTRACT_LABELS -#define TARGET_AS_CAN_SUBTRACT_LABELS TARGET_GAS -#endif -#ifndef TARGET_CAN_FAULT_IN_PROLOGUE -#define TARGET_CAN_FAULT_IN_PROLOGUE 0 -#endif - -/* Macro to define tables used to set the flags. - This is a list in braces of pairs in braces, - each pair being { "NAME", VALUE } - where VALUE is the bits to set or minus the bits to clear. - An empty string NAME is used to identify the default VALUE. */ - -#define TARGET_SWITCHES \ - { {"no-soft-float", MASK_FP, "Use hardware fp"}, \ - {"soft-float", - MASK_FP, "Do not use hardware fp"}, \ - {"fp-regs", MASK_FPREGS, "Use fp registers"}, \ - {"no-fp-regs", - (MASK_FP|MASK_FPREGS), "Do not use fp registers"}, \ - {"alpha-as", -MASK_GAS, "Do not assume GAS"}, \ - {"gas", MASK_GAS, "Assume GAS"}, \ - {"ieee-conformant", MASK_IEEE_CONFORMANT, \ - "Request IEEE-conformant math library routines (OSF/1)"}, \ - {"ieee", MASK_IEEE|MASK_IEEE_CONFORMANT, \ - "Emit IEEE-conformant code, without inexact exceptions"}, \ - {"ieee-with-inexact", MASK_IEEE_WITH_INEXACT|MASK_IEEE_CONFORMANT, \ - "Emit IEEE-conformant code, with inexact exceptions"}, \ - {"build-constants", MASK_BUILD_CONSTANTS, \ - "Do not emit complex integer constants to read-only memory"}, \ - {"float-vax", MASK_FLOAT_VAX, "Use VAX fp"}, \ - {"float-ieee", -MASK_FLOAT_VAX, "Do not use VAX fp"}, \ - {"bwx", MASK_BWX, "Emit code for the byte/word ISA extension"}, \ - {"no-bwx", -MASK_BWX, ""}, \ - {"max", MASK_MAX, "Emit code for the motion video ISA extension"}, \ - {"no-max", -MASK_MAX, ""}, \ - {"fix", MASK_FIX, "Emit code for the fp move and sqrt ISA extension"}, \ - {"no-fix", -MASK_FIX, ""}, \ - {"cix", MASK_CIX, "Emit code for the counting ISA extension"}, \ - {"no-cix", -MASK_CIX, ""}, \ - {"", TARGET_DEFAULT | TARGET_CPU_DEFAULT, ""} } - -#define TARGET_DEFAULT MASK_FP|MASK_FPREGS - -#ifndef TARGET_CPU_DEFAULT -#define TARGET_CPU_DEFAULT 0 -#endif - -/* This macro is similar to `TARGET_SWITCHES' but defines names of - command options that have values. Its definition is an initializer - with a subgrouping for each command option. - - Each subgrouping contains a string constant, that defines the fixed - part of the option name, and the address of a variable. The - variable, type `char *', is set to the variable part of the given - option if the fixed part matches. The actual option name is made - by appending `-m' to the specified name. - - Here is an example which defines `-mshort-data-NUMBER'. If the - given option is `-mshort-data-512', the variable `m88k_short_data' - will be set to the string `"512"'. - - extern char *m88k_short_data; - #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */ - -extern const char *alpha_cpu_string; /* For -mcpu= */ -extern const char *alpha_fprm_string; /* For -mfp-rounding-mode=[n|m|c|d] */ -extern const char *alpha_fptm_string; /* For -mfp-trap-mode=[n|u|su|sui] */ -extern const char *alpha_tp_string; /* For -mtrap-precision=[p|f|i] */ -extern const char *alpha_mlat_string; /* For -mmemory-latency= */ - -#define TARGET_OPTIONS \ -{ \ - {"cpu=", &alpha_cpu_string, \ - "Generate code for a given CPU"}, \ - {"fp-rounding-mode=", &alpha_fprm_string, \ - "Control the generated fp rounding mode"}, \ - {"fp-trap-mode=", &alpha_fptm_string, \ - "Control the IEEE trap mode"}, \ - {"trap-precision=", &alpha_tp_string, \ - "Control the precision given to fp exceptions"}, \ - {"memory-latency=", &alpha_mlat_string, \ - "Tune expected memory latency"}, \ -} - -/* Attempt to describe CPU characteristics to the preprocessor. */ - -/* Corresponding to amask... */ -#define CPP_AM_BWX_SPEC "-D__alpha_bwx__ -Acpu(bwx)" -#define CPP_AM_MAX_SPEC "-D__alpha_max__ -Acpu(max)" -#define CPP_AM_FIX_SPEC "-D__alpha_fix__ -Acpu(fix)" -#define CPP_AM_CIX_SPEC "-D__alpha_cix__ -Acpu(cix)" - -/* Corresponding to implver... */ -#define CPP_IM_EV4_SPEC "-D__alpha_ev4__ -Acpu(ev4)" -#define CPP_IM_EV5_SPEC "-D__alpha_ev5__ -Acpu(ev5)" -#define CPP_IM_EV6_SPEC "-D__alpha_ev6__ -Acpu(ev6)" - -/* Common combinations. */ -#define CPP_CPU_EV4_SPEC "%(cpp_im_ev4)" -#define CPP_CPU_EV5_SPEC "%(cpp_im_ev5)" -#define CPP_CPU_EV56_SPEC "%(cpp_im_ev5) %(cpp_am_bwx)" -#define CPP_CPU_PCA56_SPEC "%(cpp_im_ev5) %(cpp_am_bwx) %(cpp_am_max)" -#define CPP_CPU_EV6_SPEC "%(cpp_im_ev6) %(cpp_am_bwx) %(cpp_am_max) %(cpp_am_fix)" - -#ifndef CPP_CPU_DEFAULT_SPEC -# if TARGET_CPU_DEFAULT & MASK_CPU_EV6 -# define CPP_CPU_DEFAULT_SPEC CPP_CPU_EV6_SPEC -# else -# if TARGET_CPU_DEFAULT & MASK_CPU_EV5 -# if TARGET_CPU_DEFAULT & MASK_MAX -# define CPP_CPU_DEFAULT_SPEC CPP_CPU_PCA56_SPEC -# else -# if TARGET_CPU_DEFAULT & MASK_BWX -# define CPP_CPU_DEFAULT_SPEC CPP_CPU_EV56_SPEC -# else -# define CPP_CPU_DEFAULT_SPEC CPP_CPU_EV5_SPEC -# endif -# endif -# else -# define CPP_CPU_DEFAULT_SPEC CPP_CPU_EV4_SPEC -# endif -# endif -#endif /* CPP_CPU_DEFAULT_SPEC */ - -#ifndef CPP_CPU_SPEC -#define CPP_CPU_SPEC "\ -%{!undef:-Acpu(alpha) -Amachine(alpha) -D__alpha -D__alpha__ \ -%{mcpu=ev4|mcpu=21064:%(cpp_cpu_ev4) }\ -%{mcpu=ev5|mcpu=21164:%(cpp_cpu_ev5) }\ -%{mcpu=ev56|mcpu=21164a:%(cpp_cpu_ev56) }\ -%{mcpu=pca56|mcpu=21164pc|mcpu=21164PC:%(cpp_cpu_pca56) }\ -%{mcpu=ev6|mcpu=21264:%(cpp_cpu_ev6) }\ -%{!mcpu*:%(cpp_cpu_default) }}" -#endif - -/* This macro defines names of additional specifications to put in the - specs that can be used in various specifications like CC1_SPEC. Its - definition is an initializer with a subgrouping for each command option. - - Each subgrouping contains a string constant, that defines the - specification name, and a string constant that used by the GNU CC driver - program. - - Do not define this macro if it does not need to do anything. */ - -#ifndef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS -#endif - -#define EXTRA_SPECS \ - { "cpp_am_bwx", CPP_AM_BWX_SPEC }, \ - { "cpp_am_max", CPP_AM_MAX_SPEC }, \ - { "cpp_am_fix", CPP_AM_FIX_SPEC }, \ - { "cpp_am_cix", CPP_AM_CIX_SPEC }, \ - { "cpp_im_ev4", CPP_IM_EV4_SPEC }, \ - { "cpp_im_ev5", CPP_IM_EV5_SPEC }, \ - { "cpp_im_ev6", CPP_IM_EV6_SPEC }, \ - { "cpp_cpu_ev4", CPP_CPU_EV4_SPEC }, \ - { "cpp_cpu_ev5", CPP_CPU_EV5_SPEC }, \ - { "cpp_cpu_ev56", CPP_CPU_EV56_SPEC }, \ - { "cpp_cpu_pca56", CPP_CPU_PCA56_SPEC }, \ - { "cpp_cpu_ev6", CPP_CPU_EV6_SPEC }, \ - { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \ - { "cpp_cpu", CPP_CPU_SPEC }, \ - { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \ - SUBTARGET_EXTRA_SPECS - - -/* Sometimes certain combinations of command options do not make sense - on a particular target machine. You can define a macro - `OVERRIDE_OPTIONS' to take account of this. This macro, if - defined, is executed once just after all the command options have - been parsed. - - On the Alpha, it is used to translate target-option strings into - numeric values. */ - -extern void override_options (); -#define OVERRIDE_OPTIONS override_options () - - -/* Define this macro to change register usage conditional on target flags. - - On the Alpha, we use this to disable the floating-point registers when - they don't exist. */ - -#define CONDITIONAL_REGISTER_USAGE \ - if (! TARGET_FPREGS) \ - for (i = 32; i < 63; i++) \ - fixed_regs[i] = call_used_regs[i] = 1; - -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP - -/* target machine storage layout */ - -/* Define to enable software floating point emulation. */ -#define REAL_ARITHMETIC - -/* The following #defines are used when compiling the routines in - libgcc1.c. Since the Alpha calling conventions require single - precision floats to be passed in the floating-point registers - (rather than in the general registers) we have to build the - libgcc1.c routines in such a way that they know the actual types - of their formal arguments and the actual types of their return - values. Otherwise, gcc will generate calls to the libgcc1.c - routines, passing arguments in the floating-point registers, - but the libgcc1.c routines will expect their arguments on the - stack (where the Alpha calling conventions require structs & - unions to be passed). */ - -#define FLOAT_VALUE_TYPE double -#define INTIFY(FLOATVAL) (FLOATVAL) -#define FLOATIFY(INTVAL) (INTVAL) -#define FLOAT_ARG_TYPE double - -/* Define the size of `int'. The default is the same as the word size. */ -#define INT_TYPE_SIZE 32 - -/* Define the size of `long long'. The default is the twice the word size. */ -#define LONG_LONG_TYPE_SIZE 64 - -/* The two floating-point formats we support are S-floating, which is - 4 bytes, and T-floating, which is 8 bytes. `float' is S and `double' - and `long double' are T. */ - -#define FLOAT_TYPE_SIZE 32 -#define DOUBLE_TYPE_SIZE 64 -#define LONG_DOUBLE_TYPE_SIZE 64 - -#define WCHAR_TYPE "unsigned int" -#define WCHAR_TYPE_SIZE 32 - -/* Define this macro if it is advisable to hold scalars in registers - in a wider mode than that declared by the program. In such cases, - the value is constrained to be within the bounds of the declared - type, but kept valid in the wider mode. The signedness of the - extension may differ from that of the type. - - For Alpha, we always store objects in a full register. 32-bit objects - are always sign-extended, but smaller objects retain their signedness. */ - -#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \ - if (GET_MODE_CLASS (MODE) == MODE_INT \ - && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ - { \ - if ((MODE) == SImode) \ - (UNSIGNEDP) = 0; \ - (MODE) = DImode; \ - } - -/* Define this if function arguments should also be promoted using the above - procedure. */ - -#define PROMOTE_FUNCTION_ARGS - -/* Likewise, if the function return value is promoted. */ - -#define PROMOTE_FUNCTION_RETURN - -/* Define this if most significant bit is lowest numbered - in instructions that operate on numbered bit-fields. - - There are no such instructions on the Alpha, but the documentation - is little endian. */ -#define BITS_BIG_ENDIAN 0 - -/* Define this if most significant byte of a word is the lowest numbered. - This is false on the Alpha. */ -#define BYTES_BIG_ENDIAN 0 - -/* Define this if most significant word of a multiword number is lowest - numbered. - - For Alpha we can decide arbitrarily since there are no machine instructions - for them. Might as well be consistent with bytes. */ -#define WORDS_BIG_ENDIAN 0 - -/* number of bits in an addressable storage unit */ -#define BITS_PER_UNIT 8 - -/* Width in bits of a "word", which is the contents of a machine register. - Note that this is not necessarily the width of data type `int'; - if using 16-bit ints on a 68000, this would still be 32. - But on a machine with 16-bit registers, this would be 16. */ -#define BITS_PER_WORD 64 - -/* Width of a word, in units (bytes). */ -#define UNITS_PER_WORD 8 - -/* Width in bits of a pointer. - See also the macro `Pmode' defined below. */ -#define POINTER_SIZE 64 - -/* Allocation boundary (in *bits*) for storing arguments in argument list. */ -#define PARM_BOUNDARY 64 - -/* Boundary (in *bits*) on which stack pointer should be aligned. */ -#define STACK_BOUNDARY 64 - -/* Allocation boundary (in *bits*) for the code of a function. */ -#define FUNCTION_BOUNDARY 256 - -/* Alignment of field after `int : 0' in a structure. */ -#define EMPTY_FIELD_BOUNDARY 64 - -/* Every structure's size must be a multiple of this. */ -#define STRUCTURE_SIZE_BOUNDARY 8 - -/* A bitfield declared as `int' forces `int' alignment for the struct. */ -#define PCC_BITFIELD_TYPE_MATTERS 1 - -/* Align loop starts for optimal branching. - - ??? Kludge this and the next macro for the moment by not doing anything if - we don't optimize and also if we are writing ECOFF symbols to work around - a bug in DEC's assembler. */ - -#define LOOP_ALIGN(LABEL) \ - (optimize > 0 && write_symbols != SDB_DEBUG ? 4 : 0) - -/* This is how to align an instruction for optimal branching. On - Alpha we'll get better performance by aligning on an octaword - boundary. */ - -#define LABEL_ALIGN_AFTER_BARRIER(FILE) \ - (optimize > 0 && write_symbols != SDB_DEBUG ? 4 : 0) - -/* No data type wants to be aligned rounder than this. */ -#define BIGGEST_ALIGNMENT 64 - -/* For atomic access to objects, must have at least 32-bit alignment - unless the machine has byte operations. */ -#define MINIMUM_ATOMIC_ALIGNMENT (TARGET_BWX ? 8 : 32) - -/* Align all constants and variables to at least a word boundary so - we can pick up pieces of them faster. */ -/* ??? Only if block-move stuff knows about different source/destination - alignment. */ -#if 0 -#define CONSTANT_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD) -#define DATA_ALIGNMENT(EXP, ALIGN) MAX ((ALIGN), BITS_PER_WORD) -#endif - -/* Set this non-zero if move instructions will actually fail to work - when given unaligned data. - - Since we get an error message when we do one, call them invalid. */ - -#define STRICT_ALIGNMENT 1 - -/* Set this non-zero if unaligned move instructions are extremely slow. - - On the Alpha, they trap. */ - -#define SLOW_UNALIGNED_ACCESS 1 - -/* Standard register usage. */ - -/* Number of actual hardware registers. - The hardware registers are assigned numbers for the compiler - from 0 to just below FIRST_PSEUDO_REGISTER. - All registers that the compiler knows about must be given numbers, - even those that are not normally considered general registers. - - We define all 32 integer registers, even though $31 is always zero, - and all 32 floating-point registers, even though $f31 is also - always zero. We do not bother defining the FP status register and - there are no other registers. - - Since $31 is always zero, we will use register number 31 as the - argument pointer. It will never appear in the generated code - because we will always be eliminating it in favor of the stack - pointer or hardware frame pointer. - - Likewise, we use $f31 for the frame pointer, which will always - be eliminated in favor of the hardware frame pointer or the - stack pointer. */ - -#define FIRST_PSEUDO_REGISTER 64 - -/* 1 for registers that have pervasive standard uses - and are not available for the register allocator. */ - -#define FIXED_REGISTERS \ - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } - -/* 1 for registers not available across function calls. - These must include the FIXED_REGISTERS and also any - registers that can be used without being saved. - The latter must include the registers where values are returned - and the register where structure-value addresses are passed. - Aside from that, you can include as many other registers as you like. */ -#define CALL_USED_REGISTERS \ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, \ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, \ - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } - -/* List the order in which to allocate registers. Each register must be - listed once, even those in FIXED_REGISTERS. - - We allocate in the following order: - $f10-$f15 (nonsaved floating-point register) - $f22-$f30 (likewise) - $f21-$f16 (likewise, but input args) - $f0 (nonsaved, but return value) - $f1 (nonsaved, but immediate before saved) - $f2-$f9 (saved floating-point registers) - $1-$8 (nonsaved integer registers) - $22-$25 (likewise) - $28 (likewise) - $0 (likewise, but return value) - $21-$16 (likewise, but input args) - $27 (procedure value in OSF, nonsaved in NT) - $9-$14 (saved integer registers) - $26 (return PC) - $15 (frame pointer) - $29 (global pointer) - $30, $31, $f31 (stack pointer and always zero/ap & fp) */ - -#define REG_ALLOC_ORDER \ - {42, 43, 44, 45, 46, 47, \ - 54, 55, 56, 57, 58, 59, 60, 61, 62, \ - 53, 52, 51, 50, 49, 48, \ - 32, 33, \ - 34, 35, 36, 37, 38, 39, 40, 41, \ - 1, 2, 3, 4, 5, 6, 7, 8, \ - 22, 23, 24, 25, \ - 28, \ - 0, \ - 21, 20, 19, 18, 17, 16, \ - 27, \ - 9, 10, 11, 12, 13, 14, \ - 26, \ - 15, \ - 29, \ - 30, 31, 63 } - -/* Return number of consecutive hard regs needed starting at reg REGNO - to hold something of mode MODE. - This is ordinarily the length in words of a value of mode MODE - but can be less for certain modes in special long registers. */ - -#define HARD_REGNO_NREGS(REGNO, MODE) \ - ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) - -/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. - On Alpha, the integer registers can hold any mode. The floating-point - registers can hold 32-bit and 64-bit integers as well, but not 16-bit - or 8-bit values. */ - -#define HARD_REGNO_MODE_OK(REGNO, MODE) \ - ((REGNO) >= 32 && (REGNO) <= 62 \ - ? GET_MODE_UNIT_SIZE (MODE) == 8 || GET_MODE_UNIT_SIZE (MODE) == 4 \ - : 1) - -/* A C expression that is nonzero if a value of mode - MODE1 is accessible in mode MODE2 without copying. - - This asymmetric test is true when MODE1 could be put - in an FP register but MODE2 could not. */ - -#define MODES_TIEABLE_P(MODE1, MODE2) \ - (HARD_REGNO_MODE_OK (32, (MODE1)) \ - ? HARD_REGNO_MODE_OK (32, (MODE2)) \ - : 1) - -/* Specify the registers used for certain standard purposes. - The values of these macros are register numbers. */ - -/* Alpha pc isn't overloaded on a register that the compiler knows about. */ -/* #define PC_REGNUM */ - -/* Register to use for pushing function arguments. */ -#define STACK_POINTER_REGNUM 30 - -/* Base register for access to local variables of the function. */ -#define HARD_FRAME_POINTER_REGNUM 15 - -/* Value should be nonzero if functions must have frame pointers. - Zero means the frame pointer need not be set up (and parms - may be accessed via the stack pointer) in functions that seem suitable. - This is computed in `reload', in reload1.c. */ -#define FRAME_POINTER_REQUIRED 0 - -/* Base register for access to arguments of the function. */ -#define ARG_POINTER_REGNUM 31 - -/* Base register for access to local variables of function. */ -#define FRAME_POINTER_REGNUM 63 - -/* Register in which static-chain is passed to a function. - - For the Alpha, this is based on an example; the calling sequence - doesn't seem to specify this. */ -#define STATIC_CHAIN_REGNUM 1 - -/* Register in which address to store a structure value - arrives in the function. On the Alpha, the address is passed - as a hidden argument. */ -#define STRUCT_VALUE 0 - -/* Define the classes of registers for register constraints in the - machine description. Also define ranges of constants. - - One of the classes must always be named ALL_REGS and include all hard regs. - If there is more than one class, another class must be named NO_REGS - and contain no registers. - - The name GENERAL_REGS must be the name of a class (or an alias for - another name such as ALL_REGS). This is the class of registers - that is allowed by "g" or "r" in a register constraint. - Also, registers outside this class are allocated only when - instructions express preferences for them. - - The classes must be numbered in nondecreasing order; that is, - a larger-numbered class must never be contained completely - in a smaller-numbered class. - - For any two classes, it is very desirable that there be another - class that represents their union. */ - -enum reg_class { NO_REGS, GENERAL_REGS, FLOAT_REGS, ALL_REGS, - LIM_REG_CLASSES }; - -#define N_REG_CLASSES (int) LIM_REG_CLASSES - -/* Give names of register classes as strings for dump file. */ - -#define REG_CLASS_NAMES \ - {"NO_REGS", "GENERAL_REGS", "FLOAT_REGS", "ALL_REGS" } - -/* Define which registers fit in which classes. - This is an initializer for a vector of HARD_REG_SET - of length N_REG_CLASSES. */ - -#define REG_CLASS_CONTENTS \ - { {0, 0}, {~0, 0x80000000}, {0, 0x7fffffff}, {~0, ~0} } - -/* The same information, inverted: - Return the class number of the smallest class containing - reg number REGNO. This could be a conditional expression - or could index an array. */ - -#define REGNO_REG_CLASS(REGNO) \ - ((REGNO) >= 32 && (REGNO) <= 62 ? FLOAT_REGS : GENERAL_REGS) - -/* The class value for index registers, and the one for base regs. */ -#define INDEX_REG_CLASS NO_REGS -#define BASE_REG_CLASS GENERAL_REGS - -/* Get reg_class from a letter such as appears in the machine description. */ - -#define REG_CLASS_FROM_LETTER(C) \ - ((C) == 'f' ? FLOAT_REGS : NO_REGS) - -/* Define this macro to change register usage conditional on target flags. */ -/* #define CONDITIONAL_REGISTER_USAGE */ - -/* The letters I, J, K, L, M, N, O, and P in a register constraint string - can be used to stand for particular ranges of immediate operands. - This macro defines what the ranges are. - C is the letter, and VALUE is a constant value. - Return 1 if VALUE is in the range specified by C. - - For Alpha: - `I' is used for the range of constants most insns can contain. - `J' is the constant zero. - `K' is used for the constant in an LDA insn. - `L' is used for the constant in a LDAH insn. - `M' is used for the constants that can be AND'ed with using a ZAP insn. - `N' is used for complemented 8-bit constants. - `O' is used for negated 8-bit constants. - `P' is used for the constants 1, 2 and 3. */ - -#define CONST_OK_FOR_LETTER_P(VALUE, C) \ - ((C) == 'I' ? (unsigned HOST_WIDE_INT) (VALUE) < 0x100 \ - : (C) == 'J' ? (VALUE) == 0 \ - : (C) == 'K' ? (unsigned HOST_WIDE_INT) ((VALUE) + 0x8000) < 0x10000 \ - : (C) == 'L' ? (((VALUE) & 0xffff) == 0 \ - && (((VALUE)) >> 31 == -1 || (VALUE) >> 31 == 0)) \ - : (C) == 'M' ? zap_mask (VALUE) \ - : (C) == 'N' ? (unsigned HOST_WIDE_INT) (~ (VALUE)) < 0x100 \ - : (C) == 'O' ? (unsigned HOST_WIDE_INT) (- (VALUE)) < 0x100 \ - : (C) == 'P' ? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 3 \ - : 0) - -/* Similar, but for floating or large integer constants, and defining letters - G and H. Here VALUE is the CONST_DOUBLE rtx itself. - - For Alpha, `G' is the floating-point constant zero. `H' is a CONST_DOUBLE - that is the operand of a ZAP insn. */ - -#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ - ((C) == 'G' ? (GET_MODE_CLASS (GET_MODE (VALUE)) == MODE_FLOAT \ - && (VALUE) == CONST0_RTX (GET_MODE (VALUE))) \ - : (C) == 'H' ? (GET_MODE (VALUE) == VOIDmode \ - && zap_mask (CONST_DOUBLE_LOW (VALUE)) \ - && zap_mask (CONST_DOUBLE_HIGH (VALUE))) \ - : 0) - -/* Optional extra constraints for this machine. - - For the Alpha, `Q' means that this is a memory operand but not a - reference to an unaligned location. - - `R' is a SYMBOL_REF that has SYMBOL_REF_FLAG set or is the current - function. - - 'S' is a 6-bit constant (valid for a shift insn). */ - -#define EXTRA_CONSTRAINT(OP, C) \ - ((C) == 'Q' ? normal_memory_operand (OP, VOIDmode) \ - : (C) == 'R' ? current_file_function_operand (OP, Pmode) \ - : (C) == 'S' ? (GET_CODE (OP) == CONST_INT \ - && (unsigned HOST_WIDE_INT) INTVAL (OP) < 64) \ - : 0) -extern int normal_memory_operand (); - -/* Given an rtx X being reloaded into a reg required to be - in class CLASS, return the class of reg to actually use. - In general this is just CLASS; but on some machines - in some cases it is preferable to use a more restrictive class. - - On the Alpha, all constants except zero go into a floating-point - register via memory. */ - -#define PREFERRED_RELOAD_CLASS(X, CLASS) \ - (CONSTANT_P (X) && (X) != const0_rtx && (X) != CONST0_RTX (GET_MODE (X)) \ - ? ((CLASS) == FLOAT_REGS || (CLASS) == NO_REGS ? NO_REGS : GENERAL_REGS)\ - : (CLASS)) - -/* Loading and storing HImode or QImode values to and from memory - usually requires a scratch register. The exceptions are loading - QImode and HImode from an aligned address to a general register - unless byte instructions are permitted. - We also cannot load an unaligned address or a paradoxical SUBREG into an - FP register. */ - -#define SECONDARY_INPUT_RELOAD_CLASS(CLASS,MODE,IN) \ -(((GET_CODE (IN) == MEM \ - || (GET_CODE (IN) == REG && REGNO (IN) >= FIRST_PSEUDO_REGISTER) \ - || (GET_CODE (IN) == SUBREG \ - && (GET_CODE (SUBREG_REG (IN)) == MEM \ - || (GET_CODE (SUBREG_REG (IN)) == REG \ - && REGNO (SUBREG_REG (IN)) >= FIRST_PSEUDO_REGISTER)))) \ - && (((CLASS) == FLOAT_REGS \ - && ((MODE) == SImode || (MODE) == HImode || (MODE) == QImode)) \ - || (((MODE) == QImode || (MODE) == HImode) \ - && ! TARGET_BWX && ! aligned_memory_operand (IN, MODE)))) \ - ? GENERAL_REGS \ - : ((CLASS) == FLOAT_REGS && GET_CODE (IN) == MEM \ - && GET_CODE (XEXP (IN, 0)) == AND) ? GENERAL_REGS \ - : ((CLASS) == FLOAT_REGS && GET_CODE (IN) == SUBREG \ - && (GET_MODE_SIZE (GET_MODE (IN)) \ - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (IN))))) ? GENERAL_REGS \ - : NO_REGS) - -#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS,MODE,OUT) \ -(((GET_CODE (OUT) == MEM \ - || (GET_CODE (OUT) == REG && REGNO (OUT) >= FIRST_PSEUDO_REGISTER) \ - || (GET_CODE (OUT) == SUBREG \ - && (GET_CODE (SUBREG_REG (OUT)) == MEM \ - || (GET_CODE (SUBREG_REG (OUT)) == REG \ - && REGNO (SUBREG_REG (OUT)) >= FIRST_PSEUDO_REGISTER)))) \ - && ((((MODE) == HImode || (MODE) == QImode) \ - && (! TARGET_BWX || (CLASS) == FLOAT_REGS)) \ - || ((MODE) == SImode && (CLASS) == FLOAT_REGS))) \ - ? GENERAL_REGS \ - : ((CLASS) == FLOAT_REGS && GET_CODE (OUT) == MEM \ - && GET_CODE (XEXP (OUT, 0)) == AND) ? GENERAL_REGS \ - : ((CLASS) == FLOAT_REGS && GET_CODE (OUT) == SUBREG \ - && (GET_MODE_SIZE (GET_MODE (OUT)) \ - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (OUT))))) ? GENERAL_REGS \ - : NO_REGS) - -/* If we are copying between general and FP registers, we need a memory - location unless the FIX extension is available. */ - -#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \ - (! TARGET_FIX && (CLASS1) != (CLASS2)) - -/* Specify the mode to be used for memory when a secondary memory - location is needed. If MODE is floating-point, use it. Otherwise, - widen to a word like the default. This is needed because we always - store integers in FP registers in quadword format. This whole - area is very tricky! */ -#define SECONDARY_MEMORY_NEEDED_MODE(MODE) \ - (GET_MODE_CLASS (MODE) == MODE_FLOAT ? (MODE) \ - : GET_MODE_SIZE (MODE) >= 4 ? (MODE) \ - : mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0)) - -/* Return the maximum number of consecutive registers - needed to represent mode MODE in a register of class CLASS. */ - -#define CLASS_MAX_NREGS(CLASS, MODE) \ - ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) - -/* If defined, gives a class of registers that cannot be used as the - operand of a SUBREG that changes the size of the object. */ - -#define CLASS_CANNOT_CHANGE_SIZE FLOAT_REGS - -/* Define the cost of moving between registers of various classes. Moving - between FLOAT_REGS and anything else except float regs is expensive. - In fact, we make it quite expensive because we really don't want to - do these moves unless it is clearly worth it. Optimizations may - reduce the impact of not being able to allocate a pseudo to a - hard register. */ - -#define REGISTER_MOVE_COST(CLASS1, CLASS2) \ - (((CLASS1) == FLOAT_REGS) == ((CLASS2) == FLOAT_REGS) \ - ? 2 \ - : TARGET_FIX ? 3 : 4+2*alpha_memory_latency) - -/* A C expressions returning the cost of moving data of MODE from a register to - or from memory. - - On the Alpha, bump this up a bit. */ - -extern int alpha_memory_latency; -#define MEMORY_MOVE_COST(MODE,CLASS,IN) (2*alpha_memory_latency) - -/* Provide the cost of a branch. Exact meaning under development. */ -#define BRANCH_COST 5 - -/* Adjust the cost of dependencies. */ - -#define ADJUST_COST(INSN,LINK,DEP,COST) \ - (COST) = alpha_adjust_cost (INSN, LINK, DEP, COST) - -/* Stack layout; function entry, exit and calling. */ - -/* Define this if pushing a word on the stack - makes the stack pointer a smaller address. */ -#define STACK_GROWS_DOWNWARD - -/* Define this if the nominal address of the stack frame - is at the high-address end of the local variables; - that is, each additional local variable allocated - goes at a more negative offset in the frame. */ -/* #define FRAME_GROWS_DOWNWARD */ - -/* Offset within stack frame to start allocating local variables at. - If FRAME_GROWS_DOWNWARD, this is the offset to the END of the - first local allocated. Otherwise, it is the offset to the BEGINNING - of the first local allocated. */ - -#define STARTING_FRAME_OFFSET 0 - -/* If we generate an insn to push BYTES bytes, - this says how many the stack pointer really advances by. - On Alpha, don't define this because there are no push insns. */ -/* #define PUSH_ROUNDING(BYTES) */ - -/* Define this to be nonzero if stack checking is built into the ABI. */ -#define STACK_CHECK_BUILTIN 1 - -/* Define this if the maximum size of all the outgoing args is to be - accumulated and pushed during the prologue. The amount can be - found in the variable current_function_outgoing_args_size. */ -#define ACCUMULATE_OUTGOING_ARGS - -/* Offset of first parameter from the argument pointer register value. */ - -#define FIRST_PARM_OFFSET(FNDECL) 0 - -/* Definitions for register eliminations. - - We have two registers that can be eliminated on the Alpha. First, the - frame pointer register can often be eliminated in favor of the stack - pointer register. Secondly, the argument pointer register can always be - eliminated; it is replaced with either the stack or frame pointer. */ - -/* This is an array of structures. Each structure initializes one pair - of eliminable registers. The "from" register number is given first, - followed by "to". Eliminations of the same "from" register are listed - in order of preference. */ - -#define ELIMINABLE_REGS \ -{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ - { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ - { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ - { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} - -/* Given FROM and TO register numbers, say whether this elimination is allowed. - Frame pointer elimination is automatically handled. - - All eliminations are valid since the cases where FP can't be - eliminated are already handled. */ - -#define CAN_ELIMINATE(FROM, TO) 1 - -/* Round up to a multiple of 16 bytes. */ -#define ALPHA_ROUND(X) (((X) + 15) & ~ 15) - -/* Define the offset between two registers, one to be eliminated, and the other - its replacement, at the start of a routine. */ -#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ -{ if ((FROM) == FRAME_POINTER_REGNUM) \ - (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \ - + alpha_sa_size ()); \ - else if ((FROM) == ARG_POINTER_REGNUM) \ - (OFFSET) = (ALPHA_ROUND (current_function_outgoing_args_size) \ - + alpha_sa_size () \ - + (ALPHA_ROUND (get_frame_size () \ - + current_function_pretend_args_size) \ - - current_function_pretend_args_size)); \ -} - -/* Define this if stack space is still allocated for a parameter passed - in a register. */ -/* #define REG_PARM_STACK_SPACE */ - -/* Value is the number of bytes of arguments automatically - popped when returning from a subroutine call. - FUNDECL is the declaration node of the function (as a tree), - FUNTYPE is the data type of the function (as a tree), - or for a library call it is an identifier node for the subroutine name. - SIZE is the number of bytes of arguments passed on the stack. */ - -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 - -/* Define how to find the value returned by a function. - VALTYPE is the data type of the value (as a tree). - If the precise function being called is known, FUNC is its FUNCTION_DECL; - otherwise, FUNC is 0. - - On Alpha the value is found in $0 for integer functions and - $f0 for floating-point functions. */ - -#define FUNCTION_VALUE(VALTYPE, FUNC) \ - gen_rtx_REG (((INTEGRAL_TYPE_P (VALTYPE) \ - && TYPE_PRECISION (VALTYPE) < BITS_PER_WORD) \ - || POINTER_TYPE_P (VALTYPE)) \ - ? word_mode : TYPE_MODE (VALTYPE), \ - ((TARGET_FPREGS \ - && (TREE_CODE (VALTYPE) == REAL_TYPE \ - || TREE_CODE (VALTYPE) == COMPLEX_TYPE)) \ - ? 32 : 0)) - -/* Define how to find the value returned by a library function - assuming the value has mode MODE. */ - -#define LIBCALL_VALUE(MODE) \ - gen_rtx_REG (MODE, \ - (TARGET_FPREGS \ - && (GET_MODE_CLASS (MODE) == MODE_FLOAT \ - || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \ - ? 32 : 0)) - -/* The definition of this macro implies that there are cases where - a scalar value cannot be returned in registers. - - For the Alpha, any structure or union type is returned in memory, as - are integers whose size is larger than 64 bits. */ - -#define RETURN_IN_MEMORY(TYPE) \ - (TYPE_MODE (TYPE) == BLKmode \ - || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_PRECISION (TYPE) > 64)) - -/* 1 if N is a possible register number for a function value - as seen by the caller. */ - -#define FUNCTION_VALUE_REGNO_P(N) \ - ((N) == 0 || (N) == 1 || (N) == 32 || (N) == 33) - -/* 1 if N is a possible register number for function argument passing. - On Alpha, these are $16-$21 and $f16-$f21. */ - -#define FUNCTION_ARG_REGNO_P(N) \ - (((N) >= 16 && (N) <= 21) || ((N) >= 16 + 32 && (N) <= 21 + 32)) - -/* Define a data type for recording info about an argument list - during the scan of that argument list. This data type should - hold all necessary information about the function itself - and about the args processed so far, enough to enable macros - such as FUNCTION_ARG to determine where the next arg should go. - - On Alpha, this is a single integer, which is a number of words - of arguments scanned so far. - Thus 6 or more means all following args should go on the stack. */ - -#define CUMULATIVE_ARGS int - -/* Initialize a variable CUM of type CUMULATIVE_ARGS - for a call to a function whose data type is FNTYPE. - For a library call, FNTYPE is 0. */ - -#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) (CUM) = 0 - -/* Define intermediate macro to compute the size (in registers) of an argument - for the Alpha. */ - -#define ALPHA_ARG_SIZE(MODE, TYPE, NAMED) \ -((MODE) != BLKmode \ - ? (GET_MODE_SIZE (MODE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD \ - : (int_size_in_bytes (TYPE) + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD) - -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ - -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - if (MUST_PASS_IN_STACK (MODE, TYPE)) \ - (CUM) = 6; \ - else \ - (CUM) += ALPHA_ARG_SIZE (MODE, TYPE, NAMED) - -/* Determine where to put an argument to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - MODE is the argument's machine mode. - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). - - On Alpha the first 6 words of args are normally in registers - and the rest are pushed. */ - -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ -((CUM) < 6 && ! MUST_PASS_IN_STACK (MODE, TYPE) \ - ? gen_rtx(REG, (MODE), \ - (CUM) + 16 + ((TARGET_FPREGS \ - && (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \ - || GET_MODE_CLASS (MODE) == MODE_FLOAT)) \ - * 32)) \ - : 0) - -/* Specify the padding direction of arguments. - - On the Alpha, we must pad upwards in order to be able to pass args in - registers. */ - -#define FUNCTION_ARG_PADDING(MODE, TYPE) upward - -/* For an arg passed partly in registers and partly in memory, - this is the number of registers used. - For args passed entirely in registers or entirely in memory, zero. */ - -#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ -((CUM) < 6 && 6 < (CUM) + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \ - ? 6 - (CUM) : 0) - -/* Perform any needed actions needed for a function that is receiving a - variable number of arguments. - - CUM is as above. - - MODE and TYPE are the mode and type of the current parameter. - - PRETEND_SIZE is a variable that should be set to the amount of stack - that must be pushed by the prolog to pretend that our caller pushed - it. - - Normally, this macro will push all remaining incoming registers on the - stack and set PRETEND_SIZE to the length of the registers pushed. - - On the Alpha, we allocate space for all 12 arg registers, but only - push those that are remaining. - - However, if NO registers need to be saved, don't allocate any space. - This is not only because we won't need the space, but because AP includes - the current_pretend_args_size and we don't want to mess up any - ap-relative addresses already made. - - If we are not to use the floating-point registers, save the integer - registers where we would put the floating-point registers. This is - not the most efficient way to implement varargs with just one register - class, but it isn't worth doing anything more efficient in this rare - case. */ - - -#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ -{ if ((CUM) < 6) \ - { \ - if (! (NO_RTL)) \ - { \ - move_block_from_reg \ - (16 + CUM, \ - gen_rtx (MEM, BLKmode, \ - plus_constant (virtual_incoming_args_rtx, \ - ((CUM) + 6)* UNITS_PER_WORD)), \ - 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \ - move_block_from_reg \ - (16 + (TARGET_FPREGS ? 32 : 0) + CUM, \ - gen_rtx (MEM, BLKmode, \ - plus_constant (virtual_incoming_args_rtx, \ - (CUM) * UNITS_PER_WORD)), \ - 6 - (CUM), (6 - (CUM)) * UNITS_PER_WORD); \ - emit_insn (gen_blockage ()); \ - } \ - PRETEND_SIZE = 12 * UNITS_PER_WORD; \ - } \ -} - -/* Try to output insns to set TARGET equal to the constant C if it can be - done in less than N insns. Do all computations in MODE. Returns the place - where the output has been placed if it can be done and the insns have been - emitted. If it would take more than N insns, zero is returned and no - insns and emitted. */ -extern struct rtx_def *alpha_emit_set_const (); -extern struct rtx_def *alpha_emit_set_long_const (); -extern struct rtx_def *alpha_emit_conditional_branch (); -extern struct rtx_def *alpha_emit_conditional_move (); - -/* Generate necessary RTL for __builtin_saveregs(). - ARGLIST is the argument list; see expr.c. */ -extern struct rtx_def *alpha_builtin_saveregs (); -#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) alpha_builtin_saveregs (ARGLIST) - -/* Define the information needed to generate branch and scc insns. This is - stored from the compare operation. Note that we can't use "rtx" here - since it hasn't been defined! */ - -extern struct rtx_def *alpha_compare_op0, *alpha_compare_op1; -extern int alpha_compare_fp_p; - -/* Define the information needed to modify the epilogue for EH. */ - -extern struct rtx_def *alpha_eh_epilogue_sp_ofs; - -/* Make (or fake) .linkage entry for function call. - IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */ -extern void alpha_need_linkage (); - -/* This macro defines the start of an assembly comment. */ - -#define ASM_COMMENT_START " #" - -/* This macro produces the initial definition of a function. */ - -#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ - alpha_start_function(FILE,NAME,DECL); -extern void alpha_start_function (); - -/* This macro closes up a function definition for the assembler. */ - -#define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \ - alpha_end_function(FILE,NAME,DECL) -extern void alpha_end_function (); - -/* This macro notes the end of the prologue. */ - -#define FUNCTION_END_PROLOGUE(FILE) output_end_prologue (FILE) -extern void output_end_prologue (); - -/* Output any profiling code before the prologue. */ - -#define PROFILE_BEFORE_PROLOGUE 1 - -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. Under OSF/1, profiling is enabled - by simply passing -pg to the assembler and linker. */ - -#define FUNCTION_PROFILER(FILE, LABELNO) - -/* Output assembler code to FILE to initialize this source file's - basic block profiling info, if that has not already been done. - This assumes that __bb_init_func doesn't garble a1-a5. */ - -#define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ - do { \ - ASM_OUTPUT_REG_PUSH (FILE, 16); \ - fputs ("\tlda $16,$PBX32\n", (FILE)); \ - fputs ("\tldq $26,0($16)\n", (FILE)); \ - fputs ("\tbne $26,1f\n", (FILE)); \ - fputs ("\tlda $27,__bb_init_func\n", (FILE)); \ - fputs ("\tjsr $26,($27),__bb_init_func\n", (FILE)); \ - fputs ("\tldgp $29,0($26)\n", (FILE)); \ - fputs ("1:\n", (FILE)); \ - ASM_OUTPUT_REG_POP (FILE, 16); \ - } while (0); - -/* Output assembler code to FILE to increment the entry-count for - the BLOCKNO'th basic block in this source file. */ - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ - do { \ - int blockn = (BLOCKNO); \ - fputs ("\tsubq $30,16,$30\n", (FILE)); \ - fputs ("\tstq $26,0($30)\n", (FILE)); \ - fputs ("\tstq $27,8($30)\n", (FILE)); \ - fputs ("\tlda $26,$PBX34\n", (FILE)); \ - fprintf ((FILE), "\tldq $27,%d($26)\n", 8*blockn); \ - fputs ("\taddq $27,1,$27\n", (FILE)); \ - fprintf ((FILE), "\tstq $27,%d($26)\n", 8*blockn); \ - fputs ("\tldq $26,0($30)\n", (FILE)); \ - fputs ("\tldq $27,8($30)\n", (FILE)); \ - fputs ("\taddq $30,16,$30\n", (FILE)); \ - } while (0) - - -/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, - the stack pointer does not matter. The value is tested only in - functions that have frame pointers. - No definition is equivalent to always zero. */ - -#define EXIT_IGNORE_STACK 1 - -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. - - The trampoline should set the static chain pointer to value placed - into the trampoline and should branch to the specified routine. - Note that $27 has been set to the address of the trampoline, so we can - use it for addressability of the two data items. Trampolines are always - aligned to FUNCTION_BOUNDARY, which is 64 bits. */ - -#define TRAMPOLINE_TEMPLATE(FILE) \ -do { \ - fprintf (FILE, "\tldq $1,24($27)\n"); \ - fprintf (FILE, "\tldq $27,16($27)\n"); \ - fprintf (FILE, "\tjmp $31,($27),0\n"); \ - fprintf (FILE, "\tnop\n"); \ - fprintf (FILE, "\t.quad 0,0\n"); \ -} while (0) - -/* Section in which to place the trampoline. On Alpha, instructions - may only be placed in a text segment. */ - -#define TRAMPOLINE_SECTION text_section - -/* Length in units of the trampoline for entering a nested function. */ - -#define TRAMPOLINE_SIZE 32 - -/* Emit RTL insns to initialize the variable parts of a trampoline. - FNADDR is an RTX for the address of the function's pure code. - CXT is an RTX for the static chain value for the function. */ - -#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ - alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, 8) -extern void alpha_initialize_trampoline (); - -/* A C expression whose value is RTL representing the value of the return - address for the frame COUNT steps up from the current frame. - FRAMEADDR is the frame pointer of the COUNT frame, or the frame pointer of - the COUNT-1 frame if RETURN_ADDR_IN_PREVIOUS_FRAME is defined. */ - -#define RETURN_ADDR_RTX alpha_return_addr -extern struct rtx_def *alpha_return_addr (); - -/* Before the prologue, RA lives in $26. */ -#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26) - -/* Initialize data used by insn expanders. This is called from insn_emit, - once for every function before code is generated. */ - -#define INIT_EXPANDERS alpha_init_expanders () -extern void alpha_init_expanders (); - -/* Addressing modes, and classification of registers for them. */ - -/* #define HAVE_POST_INCREMENT 0 */ -/* #define HAVE_POST_DECREMENT 0 */ - -/* #define HAVE_PRE_DECREMENT 0 */ -/* #define HAVE_PRE_INCREMENT 0 */ - -/* Macros to check register numbers against specific register classes. */ - -/* These assume that REGNO is a hard or pseudo reg number. - They give nonzero only if REGNO is a hard reg of the suitable class - or a pseudo reg currently allocated to a suitable hard reg. - Since they use reg_renumber, they are safe only once reg_renumber - has been allocated, which happens in local-alloc.c. */ - -#define REGNO_OK_FOR_INDEX_P(REGNO) 0 -#define REGNO_OK_FOR_BASE_P(REGNO) \ -((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32 \ - || (REGNO) == 63 || reg_renumber[REGNO] == 63) - -/* Maximum number of registers that can appear in a valid memory address. */ -#define MAX_REGS_PER_ADDRESS 1 - -/* Recognize any constant value that is a valid address. For the Alpha, - there are only constants none since we want to use LDA to load any - symbolic addresses into registers. */ - -#define CONSTANT_ADDRESS_P(X) \ - (GET_CODE (X) == CONST_INT \ - && (unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000) - -/* Include all constant integers and constant doubles, but not - floating-point, except for floating-point zero. */ - -#define LEGITIMATE_CONSTANT_P(X) \ - (GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \ - || (X) == CONST0_RTX (GET_MODE (X))) - -/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx - and check its validity for a certain class. - We have two alternate definitions for each of them. - The usual definition accepts all pseudo regs; the other rejects - them unless they have been allocated suitable hard regs. - The symbol REG_OK_STRICT causes the latter definition to be used. - - Most source files want to accept pseudo regs in the hope that - they will get allocated to the class that the insn wants them to be in. - Source files for reload pass need to be strict. - After reload, it makes no difference, since pseudo regs have - been eliminated by then. */ - -#ifndef REG_OK_STRICT - -/* Nonzero if X is a hard reg that can be used as an index - or if it is a pseudo reg. */ -#define REG_OK_FOR_INDEX_P(X) 0 - -/* Nonzero if X is a hard reg that can be used as a base reg - or if it is a pseudo reg. */ -#define REG_OK_FOR_BASE_P(X) \ - (REGNO (X) < 32 || REGNO (X) == 63 || REGNO (X) >= FIRST_PSEUDO_REGISTER) - -/* ??? Nonzero if X is the frame pointer, or some virtual register - that may eliminate to the frame pointer. These will be allowed to - have offsets greater than 32K. This is done because register - elimination offsets will change the hi/lo split, and if we split - before reload, we will require additional instructions. */ -#define REG_OK_FP_BASE_P(X) \ - (REGNO (X) == 31 || REGNO (X) == 63 \ - || (REGNO (X) >= FIRST_PSEUDO_REGISTER \ - && REGNO (X) < LAST_VIRTUAL_REGISTER)) - -#else - -/* Nonzero if X is a hard reg that can be used as an index. */ -#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) - -/* Nonzero if X is a hard reg that can be used as a base reg. */ -#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) - -#define REG_OK_FP_BASE_P(X) 0 - -#endif - -/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression - that is a valid memory address for an instruction. - The MODE argument is the machine mode for the MEM expression - that wants to use this address. - - For Alpha, we have either a constant address or the sum of a register - and a constant address, or just a register. For DImode, any of those - forms can be surrounded with an AND that clear the low-order three bits; - this is an "unaligned" access. - - First define the basic valid address. */ - -#define GO_IF_LEGITIMATE_SIMPLE_ADDRESS(MODE, X, ADDR) \ -{ \ - rtx tmp = (X); \ - if (GET_CODE (tmp) == SUBREG \ - && (GET_MODE_SIZE (GET_MODE (tmp)) \ - < GET_MODE_SIZE (GET_MODE (SUBREG_REG (tmp))))) \ - tmp = SUBREG_REG (tmp); \ - if (REG_P (tmp) && REG_OK_FOR_BASE_P (tmp)) \ - goto ADDR; \ - if (CONSTANT_ADDRESS_P (X)) \ - goto ADDR; \ - if (GET_CODE (X) == PLUS) \ - { \ - tmp = XEXP (X, 0); \ - if (GET_CODE (tmp) == SUBREG \ - && (GET_MODE_SIZE (GET_MODE (tmp)) \ - < GET_MODE_SIZE (GET_MODE (SUBREG_REG (tmp))))) \ - tmp = SUBREG_REG (tmp); \ - if (REG_P (tmp)) \ - { \ - if (REG_OK_FP_BASE_P (tmp) \ - && GET_CODE (XEXP (X, 1)) == CONST_INT) \ - goto ADDR; \ - if (REG_OK_FOR_BASE_P (tmp) \ - && CONSTANT_ADDRESS_P (XEXP (X, 1))) \ - goto ADDR; \ - } \ - } \ -} - -/* Now accept the simple address, or, for DImode only, an AND of a simple - address that turns off the low three bits. */ - -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ GO_IF_LEGITIMATE_SIMPLE_ADDRESS (MODE, X, ADDR); \ - if ((MODE) == DImode \ - && GET_CODE (X) == AND \ - && GET_CODE (XEXP (X, 1)) == CONST_INT \ - && INTVAL (XEXP (X, 1)) == -8) \ - GO_IF_LEGITIMATE_SIMPLE_ADDRESS (MODE, XEXP (X, 0), ADDR); \ -} - -/* Try machine-dependent ways of modifying an illegitimate address - to be legitimate. If we find one, return the new, valid address. - This macro is used in only one place: `memory_address' in explow.c. - - OLDX is the address as it was before break_out_memory_refs was called. - In some cases it is useful to look at this to decide what needs to be done. - - MODE and WIN are passed so that this macro can use - GO_IF_LEGITIMATE_ADDRESS. - - It is always safe for this macro to do nothing. It exists to recognize - opportunities to optimize the output. - - For the Alpha, there are three cases we handle: - - (1) If the address is (plus reg const_int) and the CONST_INT is not a - valid offset, compute the high part of the constant and add it to the - register. Then our address is (plus temp low-part-const). - (2) If the address is (const (plus FOO const_int)), find the low-order - part of the CONST_INT. Then load FOO plus any high-order part of the - CONST_INT into a register. Our address is (plus reg low-part-const). - This is done to reduce the number of GOT entries. - (3) If we have a (plus reg const), emit the load as in (2), then add - the two registers, and finally generate (plus reg low-part-const) as - our address. */ - -#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \ -{ if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \ - && GET_CODE (XEXP (X, 1)) == CONST_INT \ - && ! CONSTANT_ADDRESS_P (XEXP (X, 1))) \ - { \ - HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \ - HOST_WIDE_INT lowpart = (val & 0xffff) - 2 * (val & 0x8000); \ - HOST_WIDE_INT highpart = val - lowpart; \ - rtx high = GEN_INT (highpart); \ - rtx temp = expand_binop (Pmode, add_optab, XEXP (x, 0), \ - high, NULL_RTX, 1, OPTAB_LIB_WIDEN); \ - \ - (X) = plus_constant (temp, lowpart); \ - goto WIN; \ - } \ - else if (GET_CODE (X) == CONST \ - && GET_CODE (XEXP (X, 0)) == PLUS \ - && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT) \ - { \ - HOST_WIDE_INT val = INTVAL (XEXP (XEXP (X, 0), 1)); \ - HOST_WIDE_INT lowpart = (val & 0xffff) - 2 * (val & 0x8000); \ - HOST_WIDE_INT highpart = val - lowpart; \ - rtx high = XEXP (XEXP (X, 0), 0); \ - \ - if (highpart) \ - high = plus_constant (high, highpart); \ - \ - (X) = plus_constant (force_reg (Pmode, high), lowpart); \ - goto WIN; \ - } \ - else if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \ - && GET_CODE (XEXP (X, 1)) == CONST \ - && GET_CODE (XEXP (XEXP (X, 1), 0)) == PLUS \ - && GET_CODE (XEXP (XEXP (XEXP (X, 1), 0), 1)) == CONST_INT) \ - { \ - HOST_WIDE_INT val = INTVAL (XEXP (XEXP (XEXP (X, 1), 0), 1)); \ - HOST_WIDE_INT lowpart = (val & 0xffff) - 2 * (val & 0x8000); \ - HOST_WIDE_INT highpart = val - lowpart; \ - rtx high = XEXP (XEXP (XEXP (X, 1), 0), 0); \ - \ - if (highpart) \ - high = plus_constant (high, highpart); \ - \ - high = expand_binop (Pmode, add_optab, XEXP (X, 0), \ - force_reg (Pmode, high), \ - high, 1, OPTAB_LIB_WIDEN); \ - (X) = plus_constant (high, lowpart); \ - goto WIN; \ - } \ -} - -/* Try a machine-dependent way of reloading an illegitimate address - operand. If we find one, push the reload and jump to WIN. This - macro is used in only one place: `find_reloads_address' in reload.c. - - For the Alpha, we wish to handle large displacements off a base - register by splitting the addend across an ldah and the mem insn. - This cuts number of extra insns needed from 3 to 1. */ - -#define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_LEVELS,WIN) \ -do { \ - /* We must recognize output that we have already generated ourselves. */ \ - if (GET_CODE (X) == PLUS \ - && GET_CODE (XEXP (X, 0)) == PLUS \ - && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \ - && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \ - && GET_CODE (XEXP (X, 1)) == CONST_INT) \ - { \ - push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL_PTR, \ - BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \ - OPNUM, TYPE); \ - goto WIN; \ - } \ - if (GET_CODE (X) == PLUS \ - && GET_CODE (XEXP (X, 0)) == REG \ - && REGNO (XEXP (X, 0)) < FIRST_PSEUDO_REGISTER \ - && REG_MODE_OK_FOR_BASE_P (XEXP (X, 0), MODE) \ - && GET_CODE (XEXP (X, 1)) == CONST_INT) \ - { \ - HOST_WIDE_INT val = INTVAL (XEXP (X, 1)); \ - HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000; \ - HOST_WIDE_INT high \ - = (((val - low) & 0xffffffff) ^ 0x80000000) - 0x80000000; \ - \ - /* Check for 32-bit overflow. */ \ - if (high + low != val) \ - break; \ - \ - /* Reload the high part into a base reg; leave the low part \ - in the mem directly. */ \ - \ - X = gen_rtx_PLUS (GET_MODE (X), \ - gen_rtx_PLUS (GET_MODE (X), XEXP (X, 0), \ - GEN_INT (high)), \ - GEN_INT (low)); \ - \ - push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL_PTR, \ - BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \ - OPNUM, TYPE); \ - goto WIN; \ - } \ -} while (0) - -/* Go to LABEL if ADDR (a legitimate address expression) - has an effect that depends on the machine mode it is used for. - On the Alpha this is true only for the unaligned modes. We can - simplify this test since we know that the address must be valid. */ - -#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \ -{ if (GET_CODE (ADDR) == AND) goto LABEL; } - -/* Compute the cost of an address. For the Alpha, all valid addresses are - the same cost. */ - -#define ADDRESS_COST(X) 0 - -/* Machine-dependent reorg pass. */ -#define MACHINE_DEPENDENT_REORG(X) alpha_reorg(X) - -/* Specify the machine mode that this machine uses - for the index in the tablejump instruction. */ -#define CASE_VECTOR_MODE SImode - -/* Define as C expression which evaluates to nonzero if the tablejump - instruction expects the table to contain offsets from the address of the - table. - - Do not define this if the table should contain absolute addresses. - On the Alpha, the table is really GP-relative, not relative to the PC - of the table, but we pretend that it is PC-relative; this should be OK, - but we should try to find some better way sometime. */ -#define CASE_VECTOR_PC_RELATIVE 1 - -/* Specify the tree operation to be used to convert reals to integers. */ -#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR - -/* This is the kind of divide that is easiest to do in the general case. */ -#define EASY_DIV_EXPR TRUNC_DIV_EXPR - -/* Define this as 1 if `char' should by default be signed; else as 0. */ -#define DEFAULT_SIGNED_CHAR 1 - -/* This flag, if defined, says the same insns that convert to a signed fixnum - also convert validly to an unsigned one. - - We actually lie a bit here as overflow conditions are different. But - they aren't being checked anyway. */ - -#define FIXUNS_TRUNC_LIKE_FIX_TRUNC - -/* Max number of bytes we can move to or from memory - in one reasonably fast instruction. */ - -#define MOVE_MAX 8 - -/* If a memory-to-memory move would take MOVE_RATIO or more simple - move-instruction pairs, we will do a movstr or libcall instead. - - Without byte/word accesses, we want no more than four instructions; - with, several single byte accesses are better. */ - -#define MOVE_RATIO (TARGET_BWX ? 7 : 2) - -/* Largest number of bytes of an object that can be placed in a register. - On the Alpha we have plenty of registers, so use TImode. */ -#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (TImode) - -/* Nonzero if access to memory by bytes is no faster than for words. - Also non-zero if doing byte operations (specifically shifts) in registers - is undesirable. - - On the Alpha, we want to not use the byte operation and instead use - masking operations to access fields; these will save instructions. */ - -#define SLOW_BYTE_ACCESS 1 - -/* Define if operations between registers always perform the operation - on the full register even if a narrower mode is specified. */ -#define WORD_REGISTER_OPERATIONS - -/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD - will either zero-extend or sign-extend. The value of this macro should - be the code that says which one of the two operations is implicitly - done, NIL if none. */ -#define LOAD_EXTEND_OP(MODE) ((MODE) == SImode ? SIGN_EXTEND : ZERO_EXTEND) - -/* Define if loading short immediate values into registers sign extends. */ -#define SHORT_IMMEDIATES_SIGN_EXTEND - -/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits - is done just by pretending it is already truncated. */ -#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 - -/* We assume that the store-condition-codes instructions store 0 for false - and some other value for true. This is the value stored for true. */ - -#define STORE_FLAG_VALUE 1 - -/* Define the value returned by a floating-point comparison instruction. */ - -#define FLOAT_STORE_FLAG_VALUE (TARGET_FLOAT_VAX ? 0.5 : 2.0) - -/* Canonicalize a comparison from one we don't have to one we do have. */ - -#define CANONICALIZE_COMPARISON(CODE,OP0,OP1) \ - do { \ - if (((CODE) == GE || (CODE) == GT || (CODE) == GEU || (CODE) == GTU) \ - && (GET_CODE (OP1) == REG || (OP1) == const0_rtx)) \ - { \ - rtx tem = (OP0); \ - (OP0) = (OP1); \ - (OP1) = tem; \ - (CODE) = swap_condition (CODE); \ - } \ - if (((CODE) == LT || (CODE) == LTU) \ - && GET_CODE (OP1) == CONST_INT && INTVAL (OP1) == 256) \ - { \ - (CODE) = (CODE) == LT ? LE : LEU; \ - (OP1) = GEN_INT (255); \ - } \ - } while (0) - -/* Specify the machine mode that pointers have. - After generation of rtl, the compiler makes no further distinction - between pointers and any other objects of this machine mode. */ -#define Pmode DImode - -/* Mode of a function address in a call instruction (for indexing purposes). */ - -#define FUNCTION_MODE Pmode - -/* Define this if addresses of constant functions - shouldn't be put through pseudo regs where they can be cse'd. - Desirable on machines where ordinary constants are expensive - but a CALL with constant address is cheap. - - We define this on the Alpha so that gen_call and gen_call_value - get to see the SYMBOL_REF (for the hint field of the jsr). It will - then copy it into a register, thus actually letting the address be - cse'ed. */ - -#define NO_FUNCTION_CSE - -/* Define this to be nonzero if shift instructions ignore all but the low-order - few bits. */ -#define SHIFT_COUNT_TRUNCATED 1 - -/* Use atexit for static constructors/destructors, instead of defining - our own exit function. */ -#define HAVE_ATEXIT - -/* The EV4 is dual issue; EV5/EV6 are quad issue. */ -#define ISSUE_RATE (alpha_cpu == PROCESSOR_EV4 ? 2 : 4) - -/* Describe the fact that MULTI instructions are multiple instructions - and so to assume they don't pair with anything. */ -#define MD_SCHED_VARIABLE_ISSUE(DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE) \ - if (recog_memoized (INSN) < 0 || get_attr_type (INSN) == TYPE_MULTI) \ - (CAN_ISSUE_MORE) = 0 - -/* Compute the cost of computing a constant rtl expression RTX - whose rtx-code is CODE. The body of this macro is a portion - of a switch statement. If the code is computed here, - return it with a return statement. Otherwise, break from the switch. - - If this is an 8-bit constant, return zero since it can be used - nearly anywhere with no cost. If it is a valid operand for an - ADD or AND, likewise return 0 if we know it will be used in that - context. Otherwise, return 2 since it might be used there later. - All other constants take at least two insns. */ - -#define CONST_COSTS(RTX,CODE,OUTER_CODE) \ - case CONST_INT: \ - if (INTVAL (RTX) >= 0 && INTVAL (RTX) < 256) \ - return 0; \ - case CONST_DOUBLE: \ - if ((RTX) == CONST0_RTX (GET_MODE (RTX))) \ - return 0; \ - else if (((OUTER_CODE) == PLUS && add_operand (RTX, VOIDmode)) \ - || ((OUTER_CODE) == AND && and_operand (RTX, VOIDmode))) \ - return 0; \ - else if (add_operand (RTX, VOIDmode) || and_operand (RTX, VOIDmode)) \ - return 2; \ - else \ - return COSTS_N_INSNS (2); \ - case CONST: \ - case SYMBOL_REF: \ - case LABEL_REF: \ - switch (alpha_cpu) \ - { \ - case PROCESSOR_EV4: \ - return COSTS_N_INSNS (3); \ - case PROCESSOR_EV5: \ - case PROCESSOR_EV6: \ - return COSTS_N_INSNS (2); \ - default: abort(); \ - } - -/* Provide the costs of a rtl expression. This is in the body of a - switch on CODE. */ - -#define RTX_COSTS(X,CODE,OUTER_CODE) \ - case PLUS: case MINUS: \ - if (FLOAT_MODE_P (GET_MODE (X))) \ - switch (alpha_cpu) \ - { \ - case PROCESSOR_EV4: \ - return COSTS_N_INSNS (6); \ - case PROCESSOR_EV5: \ - case PROCESSOR_EV6: \ - return COSTS_N_INSNS (4); \ - default: abort(); \ - } \ - else if (GET_CODE (XEXP (X, 0)) == MULT \ - && const48_operand (XEXP (XEXP (X, 0), 1), VOIDmode)) \ - return (2 + rtx_cost (XEXP (XEXP (X, 0), 0), OUTER_CODE) \ - + rtx_cost (XEXP (X, 1), OUTER_CODE)); \ - break; \ - case MULT: \ - switch (alpha_cpu) \ - { \ - case PROCESSOR_EV4: \ - if (FLOAT_MODE_P (GET_MODE (X))) \ - return COSTS_N_INSNS (6); \ - return COSTS_N_INSNS (23); \ - case PROCESSOR_EV5: \ - if (FLOAT_MODE_P (GET_MODE (X))) \ - return COSTS_N_INSNS (4); \ - else if (GET_MODE (X) == DImode) \ - return COSTS_N_INSNS (12); \ - else \ - return COSTS_N_INSNS (8); \ - case PROCESSOR_EV6: \ - if (FLOAT_MODE_P (GET_MODE (X))) \ - return COSTS_N_INSNS (4); \ - else \ - return COSTS_N_INSNS (7); \ - default: abort(); \ - } \ - case ASHIFT: \ - if (GET_CODE (XEXP (X, 1)) == CONST_INT \ - && INTVAL (XEXP (X, 1)) <= 3) \ - break; \ - /* ... fall through ... */ \ - case ASHIFTRT: case LSHIFTRT: \ - switch (alpha_cpu) \ - { \ - case PROCESSOR_EV4: \ - return COSTS_N_INSNS (2); \ - case PROCESSOR_EV5: \ - case PROCESSOR_EV6: \ - return COSTS_N_INSNS (1); \ - default: abort(); \ - } \ - case IF_THEN_ELSE: \ - switch (alpha_cpu) \ - { \ - case PROCESSOR_EV4: \ - case PROCESSOR_EV6: \ - return COSTS_N_INSNS (2); \ - case PROCESSOR_EV5: \ - return COSTS_N_INSNS (1); \ - default: abort(); \ - } \ - case DIV: case UDIV: case MOD: case UMOD: \ - switch (alpha_cpu) \ - { \ - case PROCESSOR_EV4: \ - if (GET_MODE (X) == SFmode) \ - return COSTS_N_INSNS (34); \ - else if (GET_MODE (X) == DFmode) \ - return COSTS_N_INSNS (63); \ - else \ - return COSTS_N_INSNS (70); \ - case PROCESSOR_EV5: \ - if (GET_MODE (X) == SFmode) \ - return COSTS_N_INSNS (15); \ - else if (GET_MODE (X) == DFmode) \ - return COSTS_N_INSNS (22); \ - else \ - return COSTS_N_INSNS (70); /* ??? */ \ - case PROCESSOR_EV6: \ - if (GET_MODE (X) == SFmode) \ - return COSTS_N_INSNS (12); \ - else if (GET_MODE (X) == DFmode) \ - return COSTS_N_INSNS (15); \ - else \ - return COSTS_N_INSNS (70); /* ??? */ \ - default: abort(); \ - } \ - case MEM: \ - switch (alpha_cpu) \ - { \ - case PROCESSOR_EV4: \ - case PROCESSOR_EV6: \ - return COSTS_N_INSNS (3); \ - case PROCESSOR_EV5: \ - return COSTS_N_INSNS (2); \ - default: abort(); \ - } \ - case NEG: case ABS: \ - if (! FLOAT_MODE_P (GET_MODE (X))) \ - break; \ - /* ... fall through ... */ \ - case FLOAT: case UNSIGNED_FLOAT: case FIX: case UNSIGNED_FIX: \ - case FLOAT_EXTEND: case FLOAT_TRUNCATE: \ - switch (alpha_cpu) \ - { \ - case PROCESSOR_EV4: \ - return COSTS_N_INSNS (6); \ - case PROCESSOR_EV5: \ - case PROCESSOR_EV6: \ - return COSTS_N_INSNS (4); \ - default: abort(); \ - } - -/* Control the assembler format that we output. */ - -/* We don't emit these labels, so as to avoid getting linker errors about - missing exception handling info. If we emit a gcc_compiled. label into - text, and the file has no code, then the DEC assembler gives us a zero - sized text section with no associated exception handling info. The - DEC linker sees this text section, and gives a warning saying that - the exception handling info is missing. */ -#define ASM_IDENTIFY_GCC(x) -#define ASM_IDENTIFY_LANGUAGE(x) - -/* Output to assembler file text saying following lines - may contain character constants, extra white space, comments, etc. */ - -#define ASM_APP_ON "" - -/* Output to assembler file text saying following lines - no longer contain unusual constructs. */ - -#define ASM_APP_OFF "" - -#define TEXT_SECTION_ASM_OP ".text" - -/* Output before read-only data. */ - -#define READONLY_DATA_SECTION_ASM_OP ".rdata" - -/* Output before writable data. */ - -#define DATA_SECTION_ASM_OP ".data" - -/* Define an extra section for read-only data, a routine to enter it, and - indicate that it is for read-only data. - - The first time we enter the readonly data section for a file, we write - eight bytes of zero. This works around a bug in DEC's assembler in - some versions of OSF/1 V3.x. */ - -#define EXTRA_SECTIONS readonly_data - -#define EXTRA_SECTION_FUNCTIONS \ -void \ -literal_section () \ -{ \ - if (in_section != readonly_data) \ - { \ - static int firsttime = 1; \ - \ - fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \ - if (firsttime) \ - { \ - firsttime = 0; \ - ASM_OUTPUT_DOUBLE_INT (asm_out_file, const0_rtx); \ - } \ - \ - in_section = readonly_data; \ - } \ -} \ - -#define READONLY_DATA_SECTION literal_section - -/* If we are referencing a function that is static, make the SYMBOL_REF - special. We use this to see indicate we can branch to this function - without setting PV or restoring GP. */ - -#define ENCODE_SECTION_INFO(DECL) \ - if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; - -/* How to refer to registers in assembler output. - This sequence is indexed by compiler's hard-register-number (see above). */ - -#define REGISTER_NAMES \ -{"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ - "$9", "$10", "$11", "$12", "$13", "$14", "$15", \ - "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", \ - "$24", "$25", "$26", "$27", "$28", "$29", "$30", "AP", \ - "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", \ - "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", \ - "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",\ - "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "FP"} - -/* How to renumber registers for dbx and gdb. */ - -#define DBX_REGISTER_NUMBER(REGNO) (REGNO) - -/* This is how to output the definition of a user-level label named NAME, - such as the label on a static function or variable NAME. */ - -#define ASM_OUTPUT_LABEL(FILE,NAME) \ - do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) - -/* This is how to output a command to make the user-level label named NAME - defined for reference from other files. */ - -#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ - do { fputs ("\t.globl ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) - -/* The prefix to add to user-visible assembler symbols. */ - -#define USER_LABEL_PREFIX "" - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, "$%s%d:\n", PREFIX, NUM) - -/* This is how to output a label for a jump table. Arguments are the same as - for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is - passed. */ - -#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \ -{ ASM_OUTPUT_ALIGN (FILE, 2); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); } - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf ((LABEL), "*$%s%ld", (PREFIX), (long)(NUM)) - -/* Check a floating-point value for validity for a particular machine mode. */ - -#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \ - ((OVERFLOW) = check_float_value (MODE, &D, OVERFLOW)) - -/* This is how to output an assembler line defining a `double' constant. */ - -#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ - { \ - if (REAL_VALUE_ISINF (VALUE) \ - || REAL_VALUE_ISNAN (VALUE) \ - || REAL_VALUE_MINUS_ZERO (VALUE)) \ - { \ - long t[2]; \ - REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \ - fprintf (FILE, "\t.quad 0x%lx%08lx\n", \ - t[1] & 0xffffffff, t[0] & 0xffffffff); \ - } \ - else \ - { \ - char str[30]; \ - REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str); \ - fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'g':'t', str); \ - } \ - } - -/* This is how to output an assembler line defining a `float' constant. */ - -#define ASM_OUTPUT_FLOAT(FILE,VALUE) \ - do { \ - long t; \ - REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \ - fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \ -} while (0) - -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.long "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line defining a `long' constant. */ - -#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ -( fprintf (FILE, "\t.quad "), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ - fprintf (FILE, "\t.word %d\n", \ - (int)(GET_CODE (VALUE) == CONST_INT \ - ? INTVAL (VALUE) & 0xffff : (abort (), 0))) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ - fprintf (FILE, "\t.byte %d\n", \ - (int)(GET_CODE (VALUE) == CONST_INT \ - ? INTVAL (VALUE) & 0xff : (abort (), 0))) - -/* We use the default ASCII-output routine, except that we don't write more - than 50 characters since the assembler doesn't support very long lines. */ - -#define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \ - do { \ - FILE *_hide_asm_out_file = (MYFILE); \ - unsigned char *_hide_p = (unsigned char *) (MYSTRING); \ - int _hide_thissize = (MYLENGTH); \ - int _size_so_far = 0; \ - { \ - FILE *asm_out_file = _hide_asm_out_file; \ - unsigned char *p = _hide_p; \ - int thissize = _hide_thissize; \ - int i; \ - fprintf (asm_out_file, "\t.ascii \""); \ - \ - for (i = 0; i < thissize; i++) \ - { \ - register int c = p[i]; \ - \ - if (_size_so_far ++ > 50 && i < thissize - 4) \ - _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \ - \ - if (c == '\"' || c == '\\') \ - putc ('\\', asm_out_file); \ - if (c >= ' ' && c < 0177) \ - putc (c, asm_out_file); \ - else \ - { \ - fprintf (asm_out_file, "\\%o", c); \ - /* After an octal-escape, if a digit follows, \ - terminate one string constant and start another. \ - The Vax assembler fails to stop reading the escape \ - after three digits, so this is the only way we \ - can get it to parse the data properly. */ \ - if (i < thissize - 1 \ - && p[i + 1] >= '0' && p[i + 1] <= '9') \ - _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \""); \ - } \ - } \ - fprintf (asm_out_file, "\"\n"); \ - } \ - } \ - while (0) - -/* To get unaligned data, we have to turn off auto alignment. */ -#define UNALIGNED_SHORT_ASM_OP ".align 0\n\t.word" -#define UNALIGNED_INT_ASM_OP ".align 0\n\t.long" -#define UNALIGNED_DOUBLE_INT_ASM_OP ".align 0\n\t.quad" - -/* This is how to output an insn to push a register on the stack. - It need not be very fast code. */ - -#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ - fprintf (FILE, "\tsubq $30,8,$30\n\tst%s $%s%d,0($30)\n", \ - (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \ - (REGNO) & 31); - -/* This is how to output an insn to pop a register from the stack. - It need not be very fast code. */ - -#define ASM_OUTPUT_REG_POP(FILE,REGNO) \ - fprintf (FILE, "\tld%s $%s%d,0($30)\n\taddq $30,8,$30\n", \ - (REGNO) > 32 ? "t" : "q", (REGNO) > 32 ? "f" : "", \ - (REGNO) & 31); - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t.byte 0x%x\n", (int) ((VALUE) & 0xff)) - -/* This is how to output an element of a case-vector that is absolute. - (Alpha does not use such vectors, but we must define this macro anyway.) */ - -#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) abort () - -/* This is how to output an element of a case-vector that is relative. */ - -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.%s $L%d\n", TARGET_WINDOWS_NT ? "long" : "gprel32", \ - (VALUE)) - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG) != 0) \ - fprintf (FILE, "\t.align %d\n", LOG); - -/* This is how to advance the location counter by SIZE bytes. */ - -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t.space %d\n", (SIZE)) - -/* This says how to output an assembler line - to define a global common symbol. */ - -#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ -( fputs ("\t.comm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%d\n", (SIZE))) - -/* This says how to output an assembler line - to define a local common symbol. */ - -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \ -( fputs ("\t.lcomm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%d\n", (SIZE))) - -/* Store in OUTPUT a string (made with alloca) containing - an assembler-name for a local static variable named NAME. - LABELNO is an integer which is different for each call. */ - -#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ -( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ - sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) - -/* Define the parentheses used to group arithmetic operations - in assembler code. */ - -#define ASM_OPEN_PAREN "(" -#define ASM_CLOSE_PAREN ")" - -/* Output code to add DELTA to the first argument, and then jump to FUNCTION. - Used for C++ multiple inheritance. */ - -#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ -do { \ - char *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \ - int reg; \ - \ - /* Mark end of prologue. */ \ - output_end_prologue (FILE); \ - \ - /* Rely on the assembler to macro expand a large delta. */ \ - reg = aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? 17 : 16; \ - fprintf (FILE, "\tlda $%d,%ld($%d)\n", reg, (long)(DELTA), reg); \ - \ - if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0))) \ - { \ - fprintf (FILE, "\tbr $31,$"); \ - assemble_name (FILE, fn_name); \ - fprintf (FILE, "..ng\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tjmp $31,"); \ - assemble_name (FILE, fn_name); \ - fputc ('\n', FILE); \ - } \ -} while (0) - - -/* Define results of standard character escape sequences. */ -#define TARGET_BELL 007 -#define TARGET_BS 010 -#define TARGET_TAB 011 -#define TARGET_NEWLINE 012 -#define TARGET_VT 013 -#define TARGET_FF 014 -#define TARGET_CR 015 - -/* Print operand X (an rtx) in assembler syntax to file FILE. - CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. - For `%' followed by punctuation, CODE is the punctuation and X is null. */ - -#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) - -/* Determine which codes are valid without a following integer. These must - not be alphabetic (the characters are chosen so that - PRINT_OPERAND_PUNCT_VALID_P translates into a simple range change when - using ASCII). - - & Generates fp-rounding mode suffix: nothing for normal, 'c' for - chopped, 'm' for minus-infinity, and 'd' for dynamic rounding - mode. alpha_fprm controls which suffix is generated. - - ' Generates trap-mode suffix for instructions that accept the - su suffix only (cmpt et al). - - ` Generates trap-mode suffix for instructions that accept the - v and sv suffix. The only instruction that needs this is cvtql. - - ( Generates trap-mode suffix for instructions that accept the - v, sv, and svi suffix. The only instruction that needs this - is cvttq. - - ) Generates trap-mode suffix for instructions that accept the - u, su, and sui suffix. This is the bulk of the IEEE floating - point instructions (addt et al). - - + Generates trap-mode suffix for instructions that accept the - sui suffix (cvtqt and cvtqs). - - , Generates single precision suffix for floating point - instructions (s for IEEE, f for VAX) - - - Generates double precision suffix for floating point - instructions (t for IEEE, g for VAX) - */ - -#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ - ((CODE) == '&' || (CODE) == '`' || (CODE) == '\'' || (CODE) == '(' \ - || (CODE) == ')' || (CODE) == '+' || (CODE) == ',' || (CODE) == '-') - -/* Print a memory address as an operand to reference that memory location. */ - -#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ - print_operand_address((FILE), (ADDR)) - -/* Define the codes that are matched by predicates in alpha.c. */ - -#define PREDICATE_CODES \ - {"reg_or_0_operand", {SUBREG, REG, CONST_INT}}, \ - {"reg_or_6bit_operand", {SUBREG, REG, CONST_INT}}, \ - {"reg_or_8bit_operand", {SUBREG, REG, CONST_INT}}, \ - {"cint8_operand", {CONST_INT}}, \ - {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, \ - {"add_operand", {SUBREG, REG, CONST_INT}}, \ - {"sext_add_operand", {SUBREG, REG, CONST_INT}}, \ - {"const48_operand", {CONST_INT}}, \ - {"and_operand", {SUBREG, REG, CONST_INT}}, \ - {"or_operand", {SUBREG, REG, CONST_INT}}, \ - {"mode_mask_operand", {CONST_INT}}, \ - {"mul8_operand", {CONST_INT}}, \ - {"mode_width_operand", {CONST_INT}}, \ - {"reg_or_fp0_operand", {SUBREG, REG, CONST_DOUBLE}}, \ - {"alpha_comparison_operator", {EQ, LE, LT, LEU, LTU}}, \ - {"alpha_swapped_comparison_operator", {EQ, GE, GT, GEU, GTU}}, \ - {"signed_comparison_operator", {EQ, NE, LE, LT, GE, GT}}, \ - {"divmod_operator", {DIV, MOD, UDIV, UMOD}}, \ - {"fp0_operand", {CONST_DOUBLE}}, \ - {"current_file_function_operand", {SYMBOL_REF}}, \ - {"call_operand", {REG, SYMBOL_REF}}, \ - {"input_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \ - SYMBOL_REF, CONST, LABEL_REF}}, \ - {"some_operand", {SUBREG, REG, MEM, CONST_INT, CONST_DOUBLE, \ - SYMBOL_REF, CONST, LABEL_REF}}, \ - {"aligned_memory_operand", {MEM}}, \ - {"unaligned_memory_operand", {MEM}}, \ - {"reg_or_unaligned_mem_operand", {SUBREG, REG, MEM}}, \ - {"any_memory_operand", {MEM}}, \ - {"hard_fp_register_operand", {SUBREG, REG}}, \ - {"reg_not_elim_operand", {SUBREG, REG}}, \ - {"reg_no_subreg_operand", {REG}}, - -/* Tell collect that the object format is ECOFF. */ -#define OBJECT_FORMAT_COFF -#define EXTENDED_COFF - -/* If we use NM, pass -g to it so it only lists globals. */ -#define NM_FLAGS "-pg" - -/* Definitions for debugging. */ - -#define SDB_DEBUGGING_INFO /* generate info for mips-tfile */ -#define DBX_DEBUGGING_INFO /* generate embedded stabs */ -#define MIPS_DEBUGGING_INFO /* MIPS specific debugging info */ - -#ifndef PREFERRED_DEBUGGING_TYPE /* assume SDB_DEBUGGING_INFO */ -#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG -#endif - - -/* Correct the offset of automatic variables and arguments. Note that - the Alpha debug format wants all automatic variables and arguments - to be in terms of two different offsets from the virtual frame pointer, - which is the stack pointer before any adjustment in the function. - The offset for the argument pointer is fixed for the native compiler, - it is either zero (for the no arguments case) or large enough to hold - all argument registers. - The offset for the auto pointer is the fourth argument to the .frame - directive (local_offset). - To stay compatible with the native tools we use the same offsets - from the virtual frame pointer and adjust the debugger arg/auto offsets - accordingly. These debugger offsets are set up in output_prolog. */ - -extern long alpha_arg_offset; -extern long alpha_auto_offset; -#define DEBUGGER_AUTO_OFFSET(X) \ - ((GET_CODE (X) == PLUS ? INTVAL (XEXP (X, 1)) : 0) + alpha_auto_offset) -#define DEBUGGER_ARG_OFFSET(OFFSET, X) (OFFSET + alpha_arg_offset) - - -#define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \ - alpha_output_lineno (STREAM, LINE) -extern void alpha_output_lineno (); - -#define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \ - alpha_output_filename (STREAM, NAME) -extern void alpha_output_filename (); - -/* mips-tfile.c limits us to strings of one page. We must underestimate this - number, because the real length runs past this up to the next - continuation point. This is really a dbxout.c bug. */ -#define DBX_CONTIN_LENGTH 3000 - -/* By default, turn on GDB extensions. */ -#define DEFAULT_GDB_EXTENSIONS 1 - -/* Stabs-in-ECOFF can't handle dbxout_function_end(). */ -#define NO_DBX_FUNCTION_END 1 - -/* If we are smuggling stabs through the ALPHA ECOFF object - format, put a comment in front of the .stab operation so - that the ALPHA assembler does not choke. The mips-tfile program - will correctly put the stab into the object file. */ - -#define ASM_STABS_OP ((TARGET_GAS) ? ".stabs" : " #.stabs") -#define ASM_STABN_OP ((TARGET_GAS) ? ".stabn" : " #.stabn") -#define ASM_STABD_OP ((TARGET_GAS) ? ".stabd" : " #.stabd") - -/* Forward references to tags are allowed. */ -#define SDB_ALLOW_FORWARD_REFERENCES - -/* Unknown tags are also allowed. */ -#define SDB_ALLOW_UNKNOWN_REFERENCES - -#define PUT_SDB_DEF(a) \ -do { \ - fprintf (asm_out_file, "\t%s.def\t", \ - (TARGET_GAS) ? "" : "#"); \ - ASM_OUTPUT_LABELREF (asm_out_file, a); \ - fputc (';', asm_out_file); \ -} while (0) - -#define PUT_SDB_PLAIN_DEF(a) \ -do { \ - fprintf (asm_out_file, "\t%s.def\t.%s;", \ - (TARGET_GAS) ? "" : "#", (a)); \ -} while (0) - -#define PUT_SDB_TYPE(a) \ -do { \ - fprintf (asm_out_file, "\t.type\t0x%x;", (a)); \ -} while (0) - -/* For block start and end, we create labels, so that - later we can figure out where the correct offset is. - The normal .ent/.end serve well enough for functions, - so those are just commented out. */ - -extern int sdb_label_count; /* block start/end next label # */ - -#define PUT_SDB_BLOCK_START(LINE) \ -do { \ - fprintf (asm_out_file, \ - "$Lb%d:\n\t%s.begin\t$Lb%d\t%d\n", \ - sdb_label_count, \ - (TARGET_GAS) ? "" : "#", \ - sdb_label_count, \ - (LINE)); \ - sdb_label_count++; \ -} while (0) - -#define PUT_SDB_BLOCK_END(LINE) \ -do { \ - fprintf (asm_out_file, \ - "$Le%d:\n\t%s.bend\t$Le%d\t%d\n", \ - sdb_label_count, \ - (TARGET_GAS) ? "" : "#", \ - sdb_label_count, \ - (LINE)); \ - sdb_label_count++; \ -} while (0) - -#define PUT_SDB_FUNCTION_START(LINE) - -#define PUT_SDB_FUNCTION_END(LINE) - -#define PUT_SDB_EPILOGUE_END(NAME) ((void)(NAME)) - -/* Macros for mips-tfile.c to encapsulate stabs in ECOFF, and for - mips-tdump.c to print them out. - - These must match the corresponding definitions in gdb/mipsread.c. - Unfortunately, gcc and gdb do not currently share any directories. */ - -#define CODE_MASK 0x8F300 -#define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK) -#define MIPS_MARK_STAB(code) ((code)+CODE_MASK) -#define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK) - -/* Override some mips-tfile definitions. */ - -#define SHASH_SIZE 511 -#define THASH_SIZE 55 - -/* Align ecoff symbol tables to avoid OSF1/1.3 nm complaints. */ - -#define ALIGN_SYMTABLE_OFFSET(OFFSET) (((OFFSET) + 7) & ~7) - -/* The linker will stick __main into the .init section. */ -#define HAS_INIT_SECTION -#define LD_INIT_SWITCH "-init" -#define LD_FINI_SWITCH "-fini" - -/* The system headers under Alpha systems are generally C++-aware. */ -#define NO_IMPLICIT_EXTERN_C - -/* Prototypes for alpha.c functions used in the md file & elsewhere. */ -extern struct rtx_def *get_unaligned_address (); -extern void alpha_write_verstamp (); -extern void alpha_reorg (); -extern int check_float_value (); -extern int direct_return (); -extern int const48_operand (); -extern int add_operand (); -extern int and_operand (); -extern int unaligned_memory_operand (); -extern int zap_mask (); -extern int current_file_function_operand (); -extern int alpha_sa_size (); -extern int alpha_adjust_cost (); -extern void print_operand (); -extern void print_operand_address (); -extern int reg_or_0_operand (); -extern int reg_or_8bit_operand (); -extern int mul8_operand (); -extern int reg_or_6bit_operand (); -extern int alpha_comparison_operator (); -extern int alpha_swapped_comparison_operator (); -extern int sext_add_operand (); -extern int cint8_operand (); -extern int mode_mask_operand (); -extern int or_operand (); -extern int mode_width_operand (); -extern int reg_or_fp0_operand (); -extern int signed_comparison_operator (); -extern int fp0_operand (); -extern int some_operand (); -extern int input_operand (); -extern int divmod_operator (); -extern int call_operand (); -extern int reg_or_cint_operand (); -extern int hard_fp_register_operand (); -extern int reg_not_elim_operand (); -extern void alpha_set_memflags (); -extern int aligned_memory_operand (); -extern void get_aligned_mem (); -extern void alpha_expand_unaligned_load (); -extern void alpha_expand_unaligned_store (); -extern int alpha_expand_block_move (); -extern int alpha_expand_block_clear (); -extern void alpha_expand_prologue (); -extern void alpha_expand_epilogue (); diff --git a/contrib/gcc/config/alpha/alpha.md b/contrib/gcc/config/alpha/alpha.md deleted file mode 100644 index 6d075e99904a..000000000000 --- a/contrib/gcc/config/alpha/alpha.md +++ /dev/null @@ -1,5415 +0,0 @@ -;; Machine description for DEC Alpha for GNU C compiler -;; Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc. -;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - -;; This file is part of GNU CC. - -;; GNU CC 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. - -;; GNU CC 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. - -;; You should have received a copy of the GNU General Public License -;; along with GNU CC; see the file COPYING. If not, write to -;; the Free Software Foundation, 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;- See file "rtl.def" for documentation on define_insn, match_*, et. al. - -;; Uses of UNSPEC in this file: -;; -;; 0 arg_home -;; 1 cttz -;; 2 insxh -;; 3 mskxh -;; 4 cvtlq -;; 5 cvtql -;; 6 nt_lda -;; -;; UNSPEC_VOLATILE: -;; -;; 0 imb -;; 1 blockage -;; 2 builtin_setjmp_receiver -;; 3 builtin_longjmp -;; 4 trapb -;; 5 prologue_stack_probe_loop -;; 6 realign -;; 7 exception_receiver - -;; Processor type -- this attribute must exactly match the processor_type -;; enumeration in alpha.h. - -(define_attr "cpu" "ev4,ev5,ev6" - (const (symbol_ref "alpha_cpu"))) - -;; Define an insn type attribute. This is used in function unit delay -;; computations, among other purposes. For the most part, we use the names -;; defined in the EV4 documentation, but add a few that we have to know about -;; separately. - -(define_attr "type" - "ild,fld,ldsym,ist,fst,ibr,fbr,jsr,iadd,ilog,shift,icmov,fcmov,icmp,imul,fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi" - (const_string "iadd")) - -;; Describe a user's asm statement. -(define_asm_attributes - [(set_attr "type" "multi")]) - -;; Define the operand size an insn operates on. Used primarily by mul -;; and div operations that have size dependant timings. - -(define_attr "opsize" "si,di,udi" (const_string "di")) - -;; The TRAP_TYPE attribute marks instructions that may generate traps -;; (which are imprecise and may need a trapb if software completion -;; is desired). - -(define_attr "trap" "no,yes" (const_string "no")) - -;; The length of an instruction sequence in bytes. - -(define_attr "length" "" (const_int 4)) - -;; On EV4 there are two classes of resources to consider: resources needed -;; to issue, and resources needed to execute. IBUS[01] are in the first -;; category. ABOX, BBOX, EBOX, FBOX, IMUL & FDIV make up the second. -;; (There are a few other register-like resources, but ...) - -; First, describe all of the issue constraints with single cycle delays. -; All insns need a bus, but all except loads require one or the other. -(define_function_unit "ev4_ibus0" 1 0 - (and (eq_attr "cpu" "ev4") - (eq_attr "type" "fst,fbr,iadd,imul,ilog,shift,icmov,icmp")) - 1 1) - -(define_function_unit "ev4_ibus1" 1 0 - (and (eq_attr "cpu" "ev4") - (eq_attr "type" "ist,ibr,jsr,fadd,fcmov,fcpys,fmul,fdiv,misc")) - 1 1) - -; Memory delivers its result in three cycles. Actually return one and -; take care of this in adjust_cost, since we want to handle user-defined -; memory latencies. -(define_function_unit "ev4_abox" 1 0 - (and (eq_attr "cpu" "ev4") - (eq_attr "type" "ild,fld,ldsym,ist,fst")) - 1 1) - -; Branches have no delay cost, but do tie up the unit for two cycles. -(define_function_unit "ev4_bbox" 1 1 - (and (eq_attr "cpu" "ev4") - (eq_attr "type" "ibr,fbr,jsr")) - 2 2) - -; Arithmetic insns are normally have their results available after -; two cycles. There are a number of exceptions. They are encoded in -; ADJUST_COST. Some of the other insns have similar exceptions. -(define_function_unit "ev4_ebox" 1 0 - (and (eq_attr "cpu" "ev4") - (eq_attr "type" "iadd,ilog,shift,icmov,icmp,misc")) - 2 1) - -(define_function_unit "imul" 1 0 - (and (eq_attr "cpu" "ev4") - (and (eq_attr "type" "imul") - (eq_attr "opsize" "si"))) - 21 19) - -(define_function_unit "imul" 1 0 - (and (eq_attr "cpu" "ev4") - (and (eq_attr "type" "imul") - (eq_attr "opsize" "!si"))) - 23 21) - -(define_function_unit "ev4_fbox" 1 0 - (and (eq_attr "cpu" "ev4") - (eq_attr "type" "fadd,fmul,fcpys,fcmov")) - 6 1) - -(define_function_unit "fdiv" 1 0 - (and (eq_attr "cpu" "ev4") - (and (eq_attr "type" "fdiv") - (eq_attr "opsize" "si"))) - 34 30) - -(define_function_unit "fdiv" 1 0 - (and (eq_attr "cpu" "ev4") - (and (eq_attr "type" "fdiv") - (eq_attr "opsize" "di"))) - 63 59) - -;; EV5 scheduling. EV5 can issue 4 insns per clock. -;; -;; EV5 has two asymetric integer units. Model this with E0 & E1 along -;; with the combined resource EBOX. - -(define_function_unit "ev5_ebox" 2 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv")) - 1 1) - -; Memory takes at least 2 clocks. Return one from here and fix up with -; user-defined latencies in adjust_cost. -(define_function_unit "ev5_ebox" 2 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "ild,fld,ldsym")) - 1 1) - -; Loads can dual issue with one another, but loads and stores do not mix. -(define_function_unit "ev5_e0" 1 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "ild,fld,ldsym")) - 1 1 - [(eq_attr "type" "ist,fst")]) - -; Stores, shifts, multiplies can only issue to E0 -(define_function_unit "ev5_e0" 1 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "ist,fst,shift,imul")) - 1 1) - -; Motion video insns also issue only to E0, and take two ticks. -(define_function_unit "ev5_e0" 1 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "mvi")) - 2 1) - -; Conditional moves always take 2 ticks. -(define_function_unit "ev5_ebox" 2 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "icmov")) - 2 1) - -; Branches can only issue to E1 -(define_function_unit "ev5_e1" 1 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "ibr,jsr")) - 1 1) - -; Multiplies also use the integer multiplier. -; ??? How to: "No instruction can be issued to pipe E0 exactly two -; cycles before an integer multiplication completes." -(define_function_unit "imul" 1 0 - (and (eq_attr "cpu" "ev5") - (and (eq_attr "type" "imul") - (eq_attr "opsize" "si"))) - 8 4) - -(define_function_unit "imul" 1 0 - (and (eq_attr "cpu" "ev5") - (and (eq_attr "type" "imul") - (eq_attr "opsize" "di"))) - 12 8) - -(define_function_unit "imul" 1 0 - (and (eq_attr "cpu" "ev5") - (and (eq_attr "type" "imul") - (eq_attr "opsize" "udi"))) - 14 8) - -;; Similarly for the FPU we have two asymetric units. But fcpys can issue -;; on either so we have to play the game again. - -(define_function_unit "ev5_fbox" 2 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "fadd,fcmov,fmul,fcpys,fbr,fdiv")) - 4 1) - -(define_function_unit "ev5_fm" 1 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "fmul")) - 4 1) - -; Add and cmov as you would expect; fbr never produces a result; -; fdiv issues through fa to the divider, -(define_function_unit "ev5_fa" 1 0 - (and (eq_attr "cpu" "ev5") - (eq_attr "type" "fadd,fcmov,fbr,fdiv")) - 4 1) - -; ??? How to: "No instruction can be issued to pipe FA exactly five -; cycles before a floating point divide completes." -(define_function_unit "fdiv" 1 0 - (and (eq_attr "cpu" "ev5") - (and (eq_attr "type" "fdiv") - (eq_attr "opsize" "si"))) - 15 15) ; 15 to 31 data dependant - -(define_function_unit "fdiv" 1 0 - (and (eq_attr "cpu" "ev5") - (and (eq_attr "type" "fdiv") - (eq_attr "opsize" "di"))) - 22 22) ; 22 to 60 data dependant - -;; EV6 scheduling. EV6 can issue 4 insns per clock. -;; -;; EV6 has two symmetric pairs ("clusters") of two asymetric integer units -;; ("upper" and "lower"), yielding pipe names U0, U1, L0, L1. - -;; Conditional moves decompose into two independant primitives, each -;; taking one cycle. Since ev6 is out-of-order, we can't see anything -;; but two cycles. -(define_function_unit "ev6_ebox" 4 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "icmov")) - 2 1) - -(define_function_unit "ev6_ebox" 4 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv,fsqrt")) - 1 1) - -;; Integer loads take at least 3 clocks, and only issue to lower units. -;; Return one from here and fix up with user-defined latencies in adjust_cost. -(define_function_unit "ev6_l" 2 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "ild,ldsym,ist,fst")) - 1 1) - -;; FP loads take at least 4 clocks. Return two from here... -(define_function_unit "ev6_l" 2 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "fld")) - 2 1) - -;; Motion video insns also issue only to U0, and take three ticks. -(define_function_unit "ev6_u0" 1 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "mvi")) - 3 1) - -(define_function_unit "ev6_u" 2 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "mvi")) - 3 1) - -;; Shifts issue to either upper pipe. -(define_function_unit "ev6_u" 2 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "shift")) - 1 1) - -;; Multiplies issue only to U1, and all take 7 ticks. -;; Rather than create a new function unit just for U1, reuse IMUL -(define_function_unit "imul" 1 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "imul")) - 7 1) - -(define_function_unit "ev6_u" 2 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "imul")) - 7 1) - -;; Branches issue to either upper pipe -(define_function_unit "ev6_u" 2 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "ibr")) - 3 1) - -;; Calls only issue to L0. -(define_function_unit "ev6_l0" 1 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "jsr")) - 1 1) - -(define_function_unit "ev6_l" 2 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "jsr")) - 1 1) - -;; Ftoi/itof only issue to lower pipes -(define_function_unit "ev6_l" 2 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "ftoi")) - 3 1) - -(define_function_unit "ev6_l" 2 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "itof")) - 4 1) - -;; For the FPU we are very similar to EV5, except there's no insn that -;; can issue to fm & fa, so we get to leave that out. - -(define_function_unit "ev6_fm" 1 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "fmul")) - 4 1) - -(define_function_unit "ev6_fa" 1 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "fadd,fcpys,fbr,fdiv,fsqrt")) - 4 1) - -(define_function_unit "ev6_fa" 1 0 - (and (eq_attr "cpu" "ev6") - (eq_attr "type" "fcmov")) - 8 1) - -(define_function_unit "fdiv" 1 0 - (and (eq_attr "cpu" "ev6") - (and (eq_attr "type" "fdiv") - (eq_attr "opsize" "si"))) - 12 10) - -(define_function_unit "fdiv" 1 0 - (and (eq_attr "cpu" "ev6") - (and (eq_attr "type" "fdiv") - (eq_attr "opsize" "di"))) - 15 13) - -(define_function_unit "fsqrt" 1 0 - (and (eq_attr "cpu" "ev6") - (and (eq_attr "type" "fsqrt") - (eq_attr "opsize" "si"))) - 16 14) - -(define_function_unit "fsqrt" 1 0 - (and (eq_attr "cpu" "ev6") - (and (eq_attr "type" "fsqrt") - (eq_attr "opsize" "di"))) - 32 30) - -; ??? The FPU communicates with memory and the integer register file -; via two fp store units. We need a slot in the fst immediately, and -; a slot in LOW after the operand data is ready. At which point the -; data may be moved either to the store queue or the integer register -; file and the insn retired. - - -;; First define the arithmetic insns. Note that the 32-bit forms also -;; sign-extend. - -;; Handle 32-64 bit extension from memory to a floating point register -;; specially, since this ocurrs frequently in int->double conversions. -;; This is done with a define_split after reload converting the plain -;; sign-extension into a load+unspec, which of course results in lds+cvtlq. -;; -;; Note that while we must retain the =f case in the insn for reload's -;; benefit, it should be eliminated after reload, so we should never emit -;; code for that case. But we don't reject the possibility. - -(define_insn "extendsidi2" - [(set (match_operand:DI 0 "register_operand" "=r,r,?f") - (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))] - "" - "@ - addl %1,$31,%0 - ldl %0,%1 - lds %0,%1\;cvtlq %0,%0" - [(set_attr "type" "iadd,ild,fld") - (set_attr "length" "*,*,8")]) - -;; Due to issues with CLASS_CANNOT_CHANGE_SIZE, we cannot use a subreg here. -(define_split - [(set (match_operand:DI 0 "hard_fp_register_operand" "") - (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))] - "reload_completed" - [(set (match_dup 2) (match_dup 1)) - (set (match_dup 0) (unspec:DI [(match_dup 2)] 4))] - "operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=f") - (unspec:DI [(match_operand:SI 1 "register_operand" "f")] 4))] - "" - "cvtlq %1,%0" - [(set_attr "type" "fadd")]) - -;; Do addsi3 the way expand_binop would do if we didn't have one. This -;; generates better code. We have the anonymous addsi3 pattern below in -;; case combine wants to make it. -(define_expand "addsi3" - [(set (match_operand:SI 0 "register_operand" "") - (plus:SI (match_operand:SI 1 "reg_or_0_operand" "") - (match_operand:SI 2 "add_operand" "")))] - "" - " -{ - if (optimize) - { - rtx op1 = gen_lowpart (DImode, operands[1]); - rtx op2 = gen_lowpart (DImode, operands[2]); - - if (! cse_not_expected) - { - rtx tmp = gen_reg_rtx (DImode); - emit_insn (gen_adddi3 (tmp, op1, op2)); - emit_move_insn (gen_lowpart (DImode, operands[0]), tmp); - } - else - emit_insn (gen_adddi3 (gen_lowpart (DImode, operands[0]), op1, op2)); - DONE; - } -}") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r,r,r,r") - (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ") - (match_operand:SI 2 "add_operand" "rI,O,K,L")))] - "" - "@ - addl %r1,%2,%0 - subl %r1,%n2,%0 - lda %0,%2(%r1) - ldah %0,%h2(%r1)") - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (plus:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "const_int_operand" "")))] - "! add_operand (operands[2], SImode)" - [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3))) - (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))] - " -{ - HOST_WIDE_INT val = INTVAL (operands[2]); - HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000); - HOST_WIDE_INT rest = val - low; - - operands[3] = GEN_INT (rest); - operands[4] = GEN_INT (low); -}") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (sign_extend:DI - (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ") - (match_operand:SI 2 "sext_add_operand" "rI,O"))))] - "" - "@ - addl %r1,%2,%0 - subl %r1,%n2,%0") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (sign_extend:DI - (plus:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "const_int_operand" "")))) - (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))] - "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0 - && INTVAL (operands[2]) % 4 == 0" - [(set (match_dup 3) (match_dup 4)) - (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3) - (match_dup 5)) - (match_dup 1))))] - " -{ - HOST_WIDE_INT val = INTVAL (operands[2]) / 4; - int mult = 4; - - if (val % 2 == 0) - val /= 2, mult = 8; - - operands[4] = GEN_INT (val); - operands[5] = GEN_INT (mult); -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (sign_extend:DI - (plus:SI (match_operator:SI 1 "comparison_operator" - [(match_operand 2 "" "") - (match_operand 3 "" "")]) - (match_operand:SI 4 "add_operand" "")))) - (clobber (match_operand:DI 5 "register_operand" ""))] - "" - [(set (match_dup 5) (match_dup 6)) - (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))] - " -{ - operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode, - operands[2], operands[3]); - operands[7] = gen_lowpart (SImode, operands[5]); -}") - -(define_insn "adddi3" - [(set (match_operand:DI 0 "register_operand" "=r,r,r,r") - (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ") - (match_operand:DI 2 "add_operand" "rI,O,K,L")))] - "" - "* -{ - const char * const pattern[4] = { - \"addq %r1,%2,%0\", - \"subq %r1,%n2,%0\", - \"lda %0,%2(%r1)\", - \"ldah %0,%h2(%r1)\" - }; - - /* The NT stack unwind code can't handle a subq to adjust the stack - (that's a bug, but not one we can do anything about). As of NT4.0 SP3, - the exception handling code will loop if a subq is used and an - exception occurs. - - The 19980616 change to emit prologues as RTL also confused some - versions of GDB, which also interprets prologues. This has been - fixed as of GDB 4.18, but it does not harm to unconditionally - use lda here. */ - - int which = which_alternative; - - if (operands[0] == stack_pointer_rtx - && GET_CODE (operands[2]) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K')) - which = 2; - - return pattern[which]; -}") - -;; ??? Allow large constants when basing off the frame pointer or some -;; virtual register that may eliminate to the frame pointer. This is -;; done because register elimination offsets will change the hi/lo split, -;; and if we split before reload, we will require additional instructions. - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r") - (match_operand:DI 2 "const_int_operand" "n")))] - "REG_OK_FP_BASE_P (operands[1])" - "#") - -;; Don't do this if we are adjusting SP since we don't want to do it -;; in two steps. Don't split FP sources for the reason listed above. -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (plus:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "const_int_operand" "")))] - "! add_operand (operands[2], DImode) - && operands[0] != stack_pointer_rtx - && operands[1] != frame_pointer_rtx - && operands[1] != arg_pointer_rtx" - [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3))) - (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))] - " -{ - HOST_WIDE_INT val = INTVAL (operands[2]); - HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000); - HOST_WIDE_INT rest = val - low; - - operands[3] = GEN_INT (rest); - operands[4] = GEN_INT (low); -}") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r") - (match_operand:SI 2 "const48_operand" "I,I")) - (match_operand:SI 3 "sext_add_operand" "rI,O")))] - "" - "@ - s%2addl %1,%3,%0 - s%2subl %1,%n3,%0") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (sign_extend:DI - (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r") - (match_operand:SI 2 "const48_operand" "I,I")) - (match_operand:SI 3 "sext_add_operand" "rI,O"))))] - "" - "@ - s%2addl %1,%3,%0 - s%2subl %1,%n3,%0") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (sign_extend:DI - (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator" - [(match_operand 2 "" "") - (match_operand 3 "" "")]) - (match_operand:SI 4 "const48_operand" "")) - (match_operand:SI 5 "add_operand" "")))) - (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))] - "" - [(set (match_dup 6) (match_dup 7)) - (set (match_dup 0) - (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4)) - (match_dup 5))))] - " -{ - operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode, - operands[2], operands[3]); - operands[8] = gen_lowpart (SImode, operands[6]); -}") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r") - (match_operand:DI 2 "const48_operand" "I,I")) - (match_operand:DI 3 "sext_add_operand" "rI,O")))] - "" - "@ - s%2addq %1,%3,%0 - s%2subq %1,%n3,%0") - -;; These variants of the above insns can occur if the third operand -;; is the frame pointer. This is a kludge, but there doesn't -;; seem to be a way around it. Only recognize them while reloading. - -(define_insn "" - [(set (match_operand:DI 0 "some_operand" "=&r") - (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r") - (match_operand:DI 2 "some_operand" "r")) - (match_operand:DI 3 "some_operand" "rIOKL")))] - "reload_in_progress" - "#") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "register_operand" "")) - (match_operand:DI 3 "add_operand" "")))] - "reload_completed" - [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2))) - (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))] - "") - -(define_insn "" - [(set (match_operand:SI 0 "some_operand" "=&r") - (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ") - (match_operand:SI 2 "const48_operand" "I")) - (match_operand:SI 3 "some_operand" "r")) - (match_operand:SI 4 "some_operand" "rIOKL")))] - "reload_in_progress" - "#") - -(define_split - [(set (match_operand:SI 0 "register_operand" "r") - (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "") - (match_operand:SI 2 "const48_operand" "")) - (match_operand:SI 3 "register_operand" "")) - (match_operand:SI 4 "add_operand" "rIOKL")))] - "reload_completed" - [(set (match_dup 0) - (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3))) - (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))] - "") - -(define_insn "" - [(set (match_operand:DI 0 "some_operand" "=&r") - (sign_extend:DI - (plus:SI (plus:SI - (mult:SI (match_operand:SI 1 "some_operand" "rJ") - (match_operand:SI 2 "const48_operand" "I")) - (match_operand:SI 3 "some_operand" "r")) - (match_operand:SI 4 "some_operand" "rIOKL"))))] - "reload_in_progress" - "#") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (sign_extend:DI - (plus:SI (plus:SI - (mult:SI (match_operand:SI 1 "reg_or_0_operand" "") - (match_operand:SI 2 "const48_operand" "")) - (match_operand:SI 3 "register_operand" "")) - (match_operand:SI 4 "add_operand" ""))))] - "reload_completed" - [(set (match_dup 5) - (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3))) - (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))] - "operands[5] = gen_lowpart (SImode, operands[0]);") - -(define_insn "" - [(set (match_operand:DI 0 "some_operand" "=&r") - (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ") - (match_operand:DI 2 "const48_operand" "I")) - (match_operand:DI 3 "some_operand" "r")) - (match_operand:DI 4 "some_operand" "rIOKL")))] - "reload_in_progress" - "#") - -(define_split - [(set (match_operand:DI 0 "register_operand" "=") - (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "") - (match_operand:DI 2 "const48_operand" "")) - (match_operand:DI 3 "register_operand" "")) - (match_operand:DI 4 "add_operand" "")))] - "reload_completed" - [(set (match_dup 0) - (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3))) - (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))] - "") - -(define_insn "negsi2" - [(set (match_operand:SI 0 "register_operand" "=r") - (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))] - "" - "subl $31,%1,%0") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (sign_extend:DI (neg:SI - (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))] - "" - "subl $31,%1,%0") - -(define_insn "negdi2" - [(set (match_operand:DI 0 "register_operand" "=r") - (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))] - "" - "subq $31,%1,%0") - -(define_expand "subsi3" - [(set (match_operand:SI 0 "register_operand" "") - (minus:SI (match_operand:SI 1 "reg_or_0_operand" "") - (match_operand:SI 2 "reg_or_8bit_operand" "")))] - "" - " -{ - if (optimize) - { - rtx op1 = gen_lowpart (DImode, operands[1]); - rtx op2 = gen_lowpart (DImode, operands[2]); - - if (! cse_not_expected) - { - rtx tmp = gen_reg_rtx (DImode); - emit_insn (gen_subdi3 (tmp, op1, op2)); - emit_move_insn (gen_lowpart (DImode, operands[0]), tmp); - } - else - emit_insn (gen_subdi3 (gen_lowpart (DImode, operands[0]), op1, op2)); - DONE; - } -} ") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") - (match_operand:SI 2 "reg_or_8bit_operand" "rI")))] - "" - "subl %r1,%2,%0") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") - (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))] - "" - "subl %r1,%2,%0") - -(define_insn "subdi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (match_operand:DI 2 "reg_or_8bit_operand" "rI")))] - "" - "subq %r1,%2,%0") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r") - (match_operand:SI 2 "const48_operand" "I")) - (match_operand:SI 3 "reg_or_8bit_operand" "rI")))] - "" - "s%2subl %1,%3,%0") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (sign_extend:DI - (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r") - (match_operand:SI 2 "const48_operand" "I")) - (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))] - "" - "s%2subl %1,%3,%0") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r") - (match_operand:DI 2 "const48_operand" "I")) - (match_operand:DI 3 "reg_or_8bit_operand" "rI")))] - "" - "s%2subq %1,%3,%0") - -(define_insn "mulsi3" - [(set (match_operand:SI 0 "register_operand" "=r") - (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ") - (match_operand:SI 2 "reg_or_8bit_operand" "rI")))] - "" - "mull %r1,%2,%0" - [(set_attr "type" "imul") - (set_attr "opsize" "si")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (sign_extend:DI - (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ") - (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))] - "" - "mull %r1,%2,%0" - [(set_attr "type" "imul") - (set_attr "opsize" "si")]) - -(define_insn "muldi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ") - (match_operand:DI 2 "reg_or_8bit_operand" "rI")))] - "" - "mulq %r1,%2,%0" - [(set_attr "type" "imul")]) - -(define_insn "umuldi3_highpart" - [(set (match_operand:DI 0 "register_operand" "=r") - (truncate:DI - (lshiftrt:TI - (mult:TI (zero_extend:TI - (match_operand:DI 1 "reg_or_0_operand" "%rJ")) - (zero_extend:TI - (match_operand:DI 2 "reg_or_8bit_operand" "rI"))) - (const_int 64))))] - "" - "umulh %r1,%2,%0" - [(set_attr "type" "imul") - (set_attr "opsize" "udi")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (truncate:DI - (lshiftrt:TI - (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r")) - (match_operand:TI 2 "cint8_operand" "I")) - (const_int 64))))] - "" - "umulh %1,%2,%0" - [(set_attr "type" "imul") - (set_attr "opsize" "udi")]) - -;; The divide and remainder operations always take their inputs from -;; r24 and r25, put their output in r27, and clobber r23 and r28. - -;; ??? Force sign-extension here because some versions of OSF/1 don't -;; do the right thing if the inputs are not properly sign-extended. -;; But Linux, for instance, does not have this problem. Is it worth -;; the complication here to eliminate the sign extension? -;; Interix/NT has the same sign-extension problem. - -(define_expand "divsi3" - [(set (reg:DI 24) - (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" ""))) - (set (reg:DI 25) - (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" ""))) - (parallel [(set (reg:DI 27) - (sign_extend:DI (div:SI (reg:DI 24) (reg:DI 25)))) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))]) - (set (match_operand:SI 0 "general_operand" "") - (subreg:SI (reg:DI 27) 0))] - "!TARGET_OPEN_VMS" - "") - -(define_expand "udivsi3" - [(set (reg:DI 24) - (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" ""))) - (set (reg:DI 25) - (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" ""))) - (parallel [(set (reg:DI 27) - (sign_extend:DI (udiv:SI (reg:DI 24) (reg:DI 25)))) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))]) - (set (match_operand:SI 0 "general_operand" "") - (subreg:SI (reg:DI 27) 0))] - "!TARGET_OPEN_VMS" - "") - -(define_expand "modsi3" - [(set (reg:DI 24) - (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" ""))) - (set (reg:DI 25) - (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" ""))) - (parallel [(set (reg:DI 27) - (sign_extend:DI (mod:SI (reg:DI 24) (reg:DI 25)))) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))]) - (set (match_operand:SI 0 "general_operand" "") - (subreg:SI (reg:DI 27) 0))] - "!TARGET_OPEN_VMS" - "") - -(define_expand "umodsi3" - [(set (reg:DI 24) - (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" ""))) - (set (reg:DI 25) - (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" ""))) - (parallel [(set (reg:DI 27) - (sign_extend:DI (umod:SI (reg:DI 24) (reg:DI 25)))) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))]) - (set (match_operand:SI 0 "general_operand" "") - (subreg:SI (reg:DI 27) 0))] - "!TARGET_OPEN_VMS" - "") - -(define_expand "divdi3" - [(set (reg:DI 24) (match_operand:DI 1 "input_operand" "")) - (set (reg:DI 25) (match_operand:DI 2 "input_operand" "")) - (parallel [(set (reg:DI 27) - (div:DI (reg:DI 24) - (reg:DI 25))) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))]) - (set (match_operand:DI 0 "general_operand" "") - (reg:DI 27))] - "!TARGET_OPEN_VMS" - "") - -(define_expand "udivdi3" - [(set (reg:DI 24) (match_operand:DI 1 "input_operand" "")) - (set (reg:DI 25) (match_operand:DI 2 "input_operand" "")) - (parallel [(set (reg:DI 27) - (udiv:DI (reg:DI 24) - (reg:DI 25))) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))]) - (set (match_operand:DI 0 "general_operand" "") - (reg:DI 27))] - "!TARGET_OPEN_VMS" - "") - -(define_expand "moddi3" - [(set (reg:DI 24) (match_operand:DI 1 "input_operand" "")) - (set (reg:DI 25) (match_operand:DI 2 "input_operand" "")) - (parallel [(set (reg:DI 27) - (mod:DI (reg:DI 24) - (reg:DI 25))) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))]) - (set (match_operand:DI 0 "general_operand" "") - (reg:DI 27))] - "!TARGET_OPEN_VMS" - "") - -(define_expand "umoddi3" - [(set (reg:DI 24) (match_operand:DI 1 "input_operand" "")) - (set (reg:DI 25) (match_operand:DI 2 "input_operand" "")) - (parallel [(set (reg:DI 27) - (umod:DI (reg:DI 24) - (reg:DI 25))) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))]) - (set (match_operand:DI 0 "general_operand" "") - (reg:DI 27))] - "!TARGET_OPEN_VMS" - "") - -;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as -;; expanded by the assembler. -(define_insn "" - [(set (reg:DI 27) - (sign_extend:DI (match_operator:SI 1 "divmod_operator" - [(reg:DI 24) (reg:DI 25)]))) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))] - "!TARGET_OPEN_VMS" - "%E1 $24,$25,$27" - [(set_attr "type" "jsr") - (set_attr "length" "8")]) - -(define_insn "" - [(set (reg:DI 27) - (match_operator:DI 1 "divmod_operator" - [(reg:DI 24) (reg:DI 25)])) - (clobber (reg:DI 23)) - (clobber (reg:DI 28))] - "!TARGET_OPEN_VMS" - "%E1 $24,$25,$27" - [(set_attr "type" "jsr") - (set_attr "length" "8")]) - -;; Next are the basic logical operations. These only exist in DImode. - -(define_insn "anddi3" - [(set (match_operand:DI 0 "register_operand" "=r,r,r") - (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ") - (match_operand:DI 2 "and_operand" "rI,N,MH")))] - "" - "@ - and %r1,%2,%0 - bic %r1,%N2,%0 - zapnot %r1,%m2,%0" - [(set_attr "type" "ilog,ilog,shift")]) - -;; There are times when we can split an AND into two AND insns. This occurs -;; when we can first clear any bytes and then clear anything else. For -;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07". -;; Only do this when running on 64-bit host since the computations are -;; too messy otherwise. - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (and:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "const_int_operand" "")))] - "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)" - [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3))) - (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))] - " -{ - unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]); - unsigned HOST_WIDE_INT mask2 = mask1; - int i; - - /* For each byte that isn't all zeros, make it all ones. */ - for (i = 0; i < 64; i += 8) - if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0) - mask1 |= (HOST_WIDE_INT) 0xff << i; - - /* Now turn on any bits we've just turned off. */ - mask2 |= ~ mask1; - - operands[3] = GEN_INT (mask1); - operands[4] = GEN_INT (mask2); -}") - -(define_insn "zero_extendqihi2" - [(set (match_operand:HI 0 "register_operand" "=r") - (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))] - "" - "and %1,0xff,%0" - [(set_attr "type" "ilog")]) - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] - "TARGET_BWX" - "@ - and %1,0xff,%0 - ldbu %0,%1" - [(set_attr "type" "ilog,ild")]) - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r") - (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))] - "! TARGET_BWX" - "and %1,0xff,%0" - [(set_attr "type" "ilog")]) - -(define_expand "zero_extendqisi2" - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:QI 1 "register_operand" "")))] - "" - "") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] - "TARGET_BWX" - "@ - and %1,0xff,%0 - ldbu %0,%1" - [(set_attr "type" "ilog,ild")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))] - "! TARGET_BWX" - "and %1,0xff,%0" - [(set_attr "type" "ilog")]) - -(define_expand "zero_extendqidi2" - [(set (match_operand:DI 0 "register_operand" "") - (zero_extend:DI (match_operand:QI 1 "register_operand" "")))] - "" - "") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] - "TARGET_BWX" - "@ - zapnot %1,3,%0 - ldwu %0,%1" - [(set_attr "type" "shift,ild")]) - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r") - (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))] - "! TARGET_BWX" - "zapnot %1,3,%0" - [(set_attr "type" "shift")]) - -(define_expand "zero_extendhisi2" - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:HI 1 "register_operand" "")))] - "" - "") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] - "TARGET_BWX" - "@ - zapnot %1,3,%0 - ldwu %0,%1" - [(set_attr "type" "shift,ild")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))] - "" - "zapnot %1,3,%0" - [(set_attr "type" "shift")]) - -(define_expand "zero_extendhidi2" - [(set (match_operand:DI 0 "register_operand" "") - (zero_extend:DI (match_operand:HI 1 "register_operand" "")))] - "" - "") - -(define_insn "zero_extendsidi2" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))] - "" - "zapnot %1,15,%0" - [(set_attr "type" "shift")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")) - (match_operand:DI 2 "reg_or_0_operand" "rJ")))] - "" - "bic %r2,%1,%0" - [(set_attr "type" "ilog")]) - -(define_insn "iordi3" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ") - (match_operand:DI 2 "or_operand" "rI,N")))] - "" - "@ - bis %r1,%2,%0 - ornot %r1,%N2,%0" - [(set_attr "type" "ilog")]) - -(define_insn "one_cmpldi2" - [(set (match_operand:DI 0 "register_operand" "=r") - (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))] - "" - "ornot $31,%1,%0" - [(set_attr "type" "ilog")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")) - (match_operand:DI 2 "reg_or_0_operand" "rJ")))] - "" - "ornot %r2,%1,%0" - [(set_attr "type" "ilog")]) - -(define_insn "xordi3" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ") - (match_operand:DI 2 "or_operand" "rI,N")))] - "" - "@ - xor %r1,%2,%0 - eqv %r1,%N2,%0" - [(set_attr "type" "ilog")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ") - (match_operand:DI 2 "register_operand" "rI"))))] - "" - "eqv %r1,%2,%0" - [(set_attr "type" "ilog")]) - -;; Handle the FFS insn iff we support CIX. -;; -;; These didn't make it into EV6 pass 2 as planned. Instead they -;; cropped cttz/ctlz/ctpop from the old CIX and renamed it FIX for -;; "Square Root and Floating Point Convert Extension". -;; -;; I'm assured that these insns will make it into EV67 (first pass -;; due Summer 1999), presumably with a new AMASK bit, and presumably -;; will still be named CIX. - -(define_expand "ffsdi2" - [(set (match_dup 2) - (unspec [(match_operand:DI 1 "register_operand" "")] 1)) - (set (match_dup 3) - (plus:DI (match_dup 2) (const_int 1))) - (set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (eq (match_dup 1) (const_int 0)) - (const_int 0) (match_dup 3)))] - "TARGET_CIX" - " -{ - operands[2] = gen_reg_rtx (DImode); - operands[3] = gen_reg_rtx (DImode); -}") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (unspec [(match_operand:DI 1 "register_operand" "r")] 1))] - "TARGET_CIX" - "cttz %1,%0" - ; EV6 calls all mvi and cttz/ctlz/popc class imisc, so just - ; reuse the existing type name. - [(set_attr "type" "mvi")]) - -;; Next come the shifts and the various extract and insert operations. - -(define_insn "ashldi3" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ") - (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))] - "" - "* -{ - switch (which_alternative) - { - case 0: - if (operands[2] == const1_rtx) - return \"addq %r1,%r1,%0\"; - else - return \"s%P2addq %r1,0,%0\"; - case 1: - return \"sll %r1,%2,%0\"; - default: - abort(); - } -}" - [(set_attr "type" "iadd,shift")]) - -;; ??? The following pattern is made by combine, but earlier phases -;; (specifically flow) can't handle it. This occurs in jump.c. Deal -;; with this in a better way at some point. -;;(define_insn "" -;; [(set (match_operand:DI 0 "register_operand" "=r") -;; (sign_extend:DI -;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") -;; (match_operand:DI 2 "const_int_operand" "P")) -;; 0)))] -;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3" -;; "* -;;{ -;; if (operands[2] == const1_rtx) -;; return \"addl %r1,%r1,%0\"; -;; else -;; return \"s%P2addl %r1,0,%0\"; -;; }" -;; [(set_attr "type" "iadd")]) - -(define_insn "lshrdi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (match_operand:DI 2 "reg_or_6bit_operand" "rS")))] - "" - "srl %r1,%2,%0" - [(set_attr "type" "shift")]) - -(define_insn "ashrdi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (match_operand:DI 2 "reg_or_6bit_operand" "rS")))] - "" - "sra %r1,%2,%0" - [(set_attr "type" "shift")]) - -(define_expand "extendqihi2" - [(set (match_dup 2) - (ashift:DI (match_operand:QI 1 "some_operand" "") - (const_int 56))) - (set (match_operand:HI 0 "register_operand" "") - (ashiftrt:DI (match_dup 2) - (const_int 56)))] - "" - " -{ - if (TARGET_BWX) - { - emit_insn (gen_extendqihi2x (operands[0], - force_reg (QImode, operands[1]))); - DONE; - } - - /* If we have an unaligned MEM, extend to DImode (which we do - specially) and then copy to the result. */ - if (unaligned_memory_operand (operands[1], HImode)) - { - rtx temp = gen_reg_rtx (DImode); - - emit_insn (gen_extendqidi2 (temp, operands[1])); - emit_move_insn (operands[0], gen_lowpart (HImode, temp)); - DONE; - } - - operands[0] = gen_lowpart (DImode, operands[0]); - operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1])); - operands[2] = gen_reg_rtx (DImode); -}") - -(define_insn "extendqidi2x" - [(set (match_operand:DI 0 "register_operand" "=r") - (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))] - "TARGET_BWX" - "sextb %1,%0" - [(set_attr "type" "shift")]) - -(define_insn "extendhidi2x" - [(set (match_operand:DI 0 "register_operand" "=r") - (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))] - "TARGET_BWX" - "sextw %1,%0" - [(set_attr "type" "shift")]) - -(define_insn "extendqisi2x" - [(set (match_operand:SI 0 "register_operand" "=r") - (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))] - "TARGET_BWX" - "sextb %1,%0" - [(set_attr "type" "shift")]) - -(define_insn "extendhisi2x" - [(set (match_operand:SI 0 "register_operand" "=r") - (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))] - "TARGET_BWX" - "sextw %1,%0" - [(set_attr "type" "shift")]) - -(define_insn "extendqihi2x" - [(set (match_operand:HI 0 "register_operand" "=r") - (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))] - "TARGET_BWX" - "sextb %1,%0" - [(set_attr "type" "shift")]) - -(define_expand "extendqisi2" - [(set (match_dup 2) - (ashift:DI (match_operand:QI 1 "some_operand" "") - (const_int 56))) - (set (match_operand:SI 0 "register_operand" "") - (ashiftrt:DI (match_dup 2) - (const_int 56)))] - "" - " -{ - if (TARGET_BWX) - { - emit_insn (gen_extendqisi2x (operands[0], - force_reg (QImode, operands[1]))); - DONE; - } - - /* If we have an unaligned MEM, extend to a DImode form of - the result (which we do specially). */ - if (unaligned_memory_operand (operands[1], QImode)) - { - rtx temp = gen_reg_rtx (DImode); - - emit_insn (gen_extendqidi2 (temp, operands[1])); - emit_move_insn (operands[0], gen_lowpart (SImode, temp)); - DONE; - } - - operands[0] = gen_lowpart (DImode, operands[0]); - operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1])); - operands[2] = gen_reg_rtx (DImode); -}") - -(define_expand "extendqidi2" - [(set (match_dup 2) - (ashift:DI (match_operand:QI 1 "some_operand" "") - (const_int 56))) - (set (match_operand:DI 0 "register_operand" "") - (ashiftrt:DI (match_dup 2) - (const_int 56)))] - "" - " -{ - if (TARGET_BWX) - { - emit_insn (gen_extendqidi2x (operands[0], - force_reg (QImode, operands[1]))); - DONE; - } - - if (unaligned_memory_operand (operands[1], QImode)) - { - rtx seq - = gen_unaligned_extendqidi (operands[0], - get_unaligned_address (operands[1], 1)); - - alpha_set_memflags (seq, operands[1]); - emit_insn (seq); - DONE; - } - - operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1])); - operands[2] = gen_reg_rtx (DImode); -}") - -(define_expand "extendhisi2" - [(set (match_dup 2) - (ashift:DI (match_operand:HI 1 "some_operand" "") - (const_int 48))) - (set (match_operand:SI 0 "register_operand" "") - (ashiftrt:DI (match_dup 2) - (const_int 48)))] - "" - " -{ - if (TARGET_BWX) - { - emit_insn (gen_extendhisi2x (operands[0], - force_reg (HImode, operands[1]))); - DONE; - } - - /* If we have an unaligned MEM, extend to a DImode form of - the result (which we do specially). */ - if (unaligned_memory_operand (operands[1], HImode)) - { - rtx temp = gen_reg_rtx (DImode); - - emit_insn (gen_extendhidi2 (temp, operands[1])); - emit_move_insn (operands[0], gen_lowpart (SImode, temp)); - DONE; - } - - operands[0] = gen_lowpart (DImode, operands[0]); - operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1])); - operands[2] = gen_reg_rtx (DImode); -}") - -(define_expand "extendhidi2" - [(set (match_dup 2) - (ashift:DI (match_operand:HI 1 "some_operand" "") - (const_int 48))) - (set (match_operand:DI 0 "register_operand" "") - (ashiftrt:DI (match_dup 2) - (const_int 48)))] - "" - " -{ - if (TARGET_BWX) - { - emit_insn (gen_extendhidi2x (operands[0], - force_reg (HImode, operands[1]))); - DONE; - } - - if (unaligned_memory_operand (operands[1], HImode)) - { - rtx seq - = gen_unaligned_extendhidi (operands[0], - get_unaligned_address (operands[1], 2)); - - alpha_set_memflags (seq, operands[1]); - emit_insn (seq); - DONE; - } - - operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1])); - operands[2] = gen_reg_rtx (DImode); -}") - -;; Here's how we sign extend an unaligned byte and halfword. Doing this -;; as a pattern saves one instruction. The code is similar to that for -;; the unaligned loads (see below). -;; -;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result. -(define_expand "unaligned_extendqidi" - [(set (match_dup 2) (match_operand:DI 1 "address_operand" "")) - (set (match_dup 3) - (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1)) - (const_int -8)))) - (set (match_dup 4) - (ashift:DI (match_dup 3) - (minus:DI (const_int 56) - (ashift:DI - (and:DI (plus:DI (match_dup 2) (const_int -1)) - (const_int 7)) - (const_int 3))))) - (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0) - (ashiftrt:DI (match_dup 4) (const_int 56)))] - "" - " -{ operands[2] = gen_reg_rtx (DImode); - operands[3] = gen_reg_rtx (DImode); - operands[4] = gen_reg_rtx (DImode); -}") - -(define_expand "unaligned_extendhidi" - [(set (match_dup 2) (match_operand:DI 1 "address_operand" "")) - (set (match_dup 3) - (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2)) - (const_int -8)))) - (set (match_dup 4) - (ashift:DI (match_dup 3) - (minus:DI (const_int 56) - (ashift:DI - (and:DI (plus:DI (match_dup 2) (const_int -1)) - (const_int 7)) - (const_int 3))))) - (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0) - (ashiftrt:DI (match_dup 4) (const_int 48)))] - "" - " -{ operands[2] = gen_reg_rtx (DImode); - operands[3] = gen_reg_rtx (DImode); - operands[4] = gen_reg_rtx (DImode); -}") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (match_operand:DI 2 "mode_width_operand" "n") - (match_operand:DI 3 "mul8_operand" "I")))] - "" - "ext%M2l %r1,%s3,%0" - [(set_attr "type" "shift")]) - -(define_insn "extxl" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (match_operand:DI 2 "mode_width_operand" "n") - (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI") - (const_int 3))))] - "" - "ext%M2l %r1,%3,%0" - [(set_attr "type" "shift")]) - -;; Combine has some strange notion of preserving existing undefined behaviour -;; in shifts larger than a word size. So capture these patterns that it -;; should have turned into zero_extracts. - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (and (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") - (const_int 3))) - (match_operand:DI 3 "mode_mask_operand" "n")))] - "" - "ext%U3l %1,%2,%0" - [(set_attr "type" "shift")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") - (const_int 3))))] - "" - "extql %1,%2,%0" - [(set_attr "type" "shift")]) - -(define_insn "extqh" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI - (match_operand:DI 1 "reg_or_0_operand" "rJ") - (minus:DI (const_int 56) - (ashift:DI - (and:DI - (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") - (const_int -1)) - (const_int 7)) - (const_int 3)))))] - "" - "extqh %r1,%2,%0" - [(set_attr "type" "shift")]) - -(define_insn "extlh" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI - (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (const_int 2147483647)) - (minus:DI (const_int 56) - (ashift:DI - (and:DI - (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") - (const_int -1)) - (const_int 7)) - (const_int 3)))))] - "" - "extlh %r1,%2,%0" - [(set_attr "type" "shift")]) - -(define_insn "extwh" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI - (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (const_int 65535)) - (minus:DI (const_int 56) - (ashift:DI - (and:DI - (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") - (const_int -1)) - (const_int 7)) - (const_int 3)))))] - "" - "extwh %r1,%2,%0" - [(set_attr "type" "shift")]) - -;; This converts an extXl into an extXh with an appropriate adjustment -;; to the address calculation. - -;;(define_split -;; [(set (match_operand:DI 0 "register_operand" "") -;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "") -;; (match_operand:DI 2 "mode_width_operand" "") -;; (ashift:DI (match_operand:DI 3 "" "") -;; (const_int 3))) -;; (match_operand:DI 4 "const_int_operand" ""))) -;; (clobber (match_operand:DI 5 "register_operand" ""))] -;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])" -;; [(set (match_dup 5) (match_dup 6)) -;; (set (match_dup 0) -;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2) -;; (ashift:DI (plus:DI (match_dup 5) -;; (match_dup 7)) -;; (const_int 3))) -;; (match_dup 4)))] -;; " -;;{ -;; operands[6] = plus_constant (operands[3], -;; INTVAL (operands[2]) / BITS_PER_UNIT); -;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT); -;;}") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r")) - (match_operand:DI 2 "mul8_operand" "I")))] - "" - "insbl %1,%s2,%0" - [(set_attr "type" "shift")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r")) - (match_operand:DI 2 "mul8_operand" "I")))] - "" - "inswl %1,%s2,%0" - [(set_attr "type" "shift")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) - (match_operand:DI 2 "mul8_operand" "I")))] - "" - "insll %1,%s2,%0" - [(set_attr "type" "shift")]) - -(define_insn "insbl" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r")) - (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") - (const_int 3))))] - "" - "insbl %1,%2,%0" - [(set_attr "type" "shift")]) - -(define_insn "inswl" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r")) - (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") - (const_int 3))))] - "" - "inswl %1,%2,%0" - [(set_attr "type" "shift")]) - -(define_insn "insll" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) - (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") - (const_int 3))))] - "" - "insll %1,%2,%0" - [(set_attr "type" "shift")]) - -(define_insn "insql" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (match_operand:DI 1 "register_operand" "r") - (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI") - (const_int 3))))] - "" - "insql %1,%2,%0" - [(set_attr "type" "shift")]) - -;; Combine has this sometimes habit of moving the and outside of the -;; shift, making life more interesting. - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "mul8_operand" "I")) - (match_operand:DI 3 "immediate_operand" "i")))] - "HOST_BITS_PER_WIDE_INT == 64 - && GET_CODE (operands[3]) == CONST_INT - && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2]) - == (unsigned HOST_WIDE_INT) INTVAL (operands[3])) - || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2]) - == (unsigned HOST_WIDE_INT) INTVAL (operands[3])) - || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2]) - == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))" - "* -{ -#if HOST_BITS_PER_WIDE_INT == 64 - if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2]) - == (unsigned HOST_WIDE_INT) INTVAL (operands[3])) - return \"insbl %1,%s2,%0\"; - if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2]) - == (unsigned HOST_WIDE_INT) INTVAL (operands[3])) - return \"inswl %1,%s2,%0\"; - if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2]) - == (unsigned HOST_WIDE_INT) INTVAL (operands[3])) - return \"insll %1,%s2,%0\"; -#endif - abort(); -}" - [(set_attr "type" "shift")]) - -;; We do not include the insXh insns because they are complex to express -;; and it does not appear that we would ever want to generate them. -;; -;; Since we need them for block moves, though, cop out and use unspec. - -(define_insn "insxh" - [(set (match_operand:DI 0 "register_operand" "=r") - (unspec [(match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "mode_width_operand" "n") - (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 2))] - "" - "ins%M2h %1,%3,%0" - [(set_attr "type" "shift")]) - -(define_insn "mskxl" - [(set (match_operand:DI 0 "register_operand" "=r") - (and:DI (not:DI (ashift:DI - (match_operand:DI 2 "mode_mask_operand" "n") - (ashift:DI - (match_operand:DI 3 "reg_or_8bit_operand" "rI") - (const_int 3)))) - (match_operand:DI 1 "reg_or_0_operand" "rJ")))] - "" - "msk%U2l %r1,%3,%0" - [(set_attr "type" "shift")]) - -;; We do not include the mskXh insns because it does not appear we would -;; ever generate one. -;; -;; Again, we do for block moves and we use unspec again. - -(define_insn "mskxh" - [(set (match_operand:DI 0 "register_operand" "=r") - (unspec [(match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "mode_width_operand" "n") - (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 3))] - "" - "msk%M2h %1,%3,%0" - [(set_attr "type" "shift")]) - -;; Floating-point operations. All the double-precision insns can extend -;; from single, so indicate that. The exception are the ones that simply -;; play with the sign bits; it's not clear what to do there. - -(define_insn "abssf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "cpys $f31,%R1,%0" - [(set_attr "type" "fcpys")]) - -(define_insn "absdf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "cpys $f31,%R1,%0" - [(set_attr "type" "fcpys")]) - -(define_insn "negsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "cpysn %R1,%R1,%0" - [(set_attr "type" "fadd")]) - -(define_insn "negdf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "cpysn %R1,%R1,%0" - [(set_attr "type" "fadd")]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=&f") - (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG") - (match_operand:SF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "add%,%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "addsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG") - (match_operand:SF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "add%,%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG") - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "add%-%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "adddf3" - [(set (match_operand:DF 0 "register_operand" "=f") - (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG") - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "add%-%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (plus:DF (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "fG")) - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "add%-%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (plus:DF (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "%fG")) - (float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "add%-%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -;; Define conversion operators between DFmode and SImode, using the cvtql -;; instruction. To allow combine et al to do useful things, we keep the -;; operation as a unit until after reload, at which point we split the -;; instructions. -;; -;; Note that we (attempt to) only consider this optimization when the -;; ultimate destination is memory. If we will be doing further integer -;; processing, it is cheaper to do the truncation in the int regs. - -(define_insn "*cvtql" - [(set (match_operand:SI 0 "register_operand" "=f") - (unspec:SI [(match_operand:DI 1 "reg_or_fp0_operand" "fG")] 5))] - "TARGET_FP" - "cvtql%` %R1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_split - [(set (match_operand:SI 0 "memory_operand" "") - (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0)) - (clobber (match_scratch:DI 2 "")) - (clobber (match_scratch:SI 3 ""))] - "TARGET_FP && reload_completed" - [(set (match_dup 2) (fix:DI (match_dup 1))) - (set (match_dup 3) (unspec:SI [(match_dup 2)] 5)) - (set (match_dup 0) (match_dup 3))] - "") - -(define_split - [(set (match_operand:SI 0 "memory_operand" "") - (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0)) - (clobber (match_scratch:DI 2 ""))] - "TARGET_FP && reload_completed" - [(set (match_dup 2) (fix:DI (match_dup 1))) - (set (match_dup 3) (unspec:SI [(match_dup 2)] 5)) - (set (match_dup 0) (match_dup 3))] - ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG. - "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));") - -(define_insn "" - [(set (match_operand:SI 0 "memory_operand" "=m") - (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0)) - (clobber (match_scratch:DI 2 "=&f")) - (clobber (match_scratch:SI 3 "=&f"))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "#" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:SI 0 "memory_operand" "=m") - (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0)) - (clobber (match_scratch:DI 2 "=f"))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "#" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f") - (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cvt%-q%(c %R1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "fix_truncdfdi2" - [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f") - (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "cvt%-q%(c %R1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -;; Likewise between SFmode and SImode. - -(define_split - [(set (match_operand:SI 0 "memory_operand" "") - (subreg:SI (fix:DI (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0)) - (clobber (match_scratch:DI 2 "")) - (clobber (match_scratch:SI 3 ""))] - "TARGET_FP && reload_completed" - [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1)))) - (set (match_dup 3) (unspec:SI [(match_dup 2)] 5)) - (set (match_dup 0) (match_dup 3))] - "") - -(define_split - [(set (match_operand:SI 0 "memory_operand" "") - (subreg:SI (fix:DI (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0)) - (clobber (match_scratch:DI 2 ""))] - "TARGET_FP && reload_completed" - [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1)))) - (set (match_dup 3) (unspec:SI [(match_dup 2)] 5)) - (set (match_dup 0) (match_dup 3))] - ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG. - "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));") - -(define_insn "" - [(set (match_operand:SI 0 "memory_operand" "=m") - (subreg:SI (fix:DI (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0)) - (clobber (match_scratch:DI 2 "=&f")) - (clobber (match_scratch:SI 3 "=&f"))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "#" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:SI 0 "memory_operand" "=m") - (subreg:SI (fix:DI (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0)) - (clobber (match_scratch:DI 2 "=f"))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "#" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f") - (fix:DI (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cvt%-q%(c %R1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "fix_truncsfdi2" - [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f") - (fix:DI (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))] - "TARGET_FP" - "cvt%-q%(c %R1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=&f") - (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cvtq%,%+%& %1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "floatdisf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))] - "TARGET_FP" - "cvtq%,%+%& %1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cvtq%-%+%& %1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "floatdidf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))] - "TARGET_FP" - "cvtq%-%+%& %1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_expand "extendsfdf2" - [(use (match_operand:DF 0 "register_operand" "")) - (use (match_operand:SF 1 "nonimmediate_operand" ""))] - "TARGET_FP" -" -{ - if (alpha_tp == ALPHA_TP_INSN) - emit_insn (gen_extendsfdf2_tp (operands[0], - force_reg (SFmode, operands[1]))); - else - emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1])); - - DONE; -}") -;; FIXME -(define_insn "extendsfdf2_tp" - [(set (match_operand:DF 0 "register_operand" "=&f") - (float_extend:DF (match_operand:SF 1 "register_operand" "f")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cvtsts %1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "extendsfdf2_no_tp" - [(set (match_operand:DF 0 "register_operand" "=f,f,m") - (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "@ - fmov %1,%0 - ld%, %0,%1 - st%- %1,%0" - [(set_attr "type" "fcpys,fld,fst") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=&f") - (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cvt%-%,%)%& %R1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "truncdfsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "cvt%-%,%)%& %R1,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=&f") - (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG") - (match_operand:SF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "div%,%)%& %R1,%R2,%0" - [(set_attr "type" "fdiv") - (set_attr "opsize" "si") - (set_attr "trap" "yes")]) - -(define_insn "divsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG") - (match_operand:SF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "div%,%)%& %R1,%R2,%0" - [(set_attr "type" "fdiv") - (set_attr "opsize" "si") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG") - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "div%-%)%& %R1,%R2,%0" - [(set_attr "type" "fdiv") - (set_attr "trap" "yes")]) - -(define_insn "divdf3" - [(set (match_operand:DF 0 "register_operand" "=f") - (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG") - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "div%-%)%& %R1,%R2,%0" - [(set_attr "type" "fdiv") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG")) - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "div%-%)%& %R1,%R2,%0" - [(set_attr "type" "fdiv") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG") - (float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "div%-%)%& %R1,%R2,%0" - [(set_attr "type" "fdiv") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG")) - (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "div%-%)%& %R1,%R2,%0" - [(set_attr "type" "fdiv") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=&f") - (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG") - (match_operand:SF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "mul%,%)%& %R1,%R2,%0" - [(set_attr "type" "fmul") - (set_attr "trap" "yes")]) - -(define_insn "mulsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG") - (match_operand:SF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "mul%,%)%& %R1,%R2,%0" - [(set_attr "type" "fmul") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG") - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "mul%-%)%& %R1,%R2,%0" - [(set_attr "type" "fmul") - (set_attr "trap" "yes")]) - -(define_insn "muldf3" - [(set (match_operand:DF 0 "register_operand" "=f") - (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG") - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "mul%-%)%& %R1,%R2,%0" - [(set_attr "type" "fmul") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (mult:DF (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "fG")) - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "mul%-%)%& %R1,%R2,%0" - [(set_attr "type" "fmul") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (mult:DF (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "%fG")) - (float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "mul%-%)%& %R1,%R2,%0" - [(set_attr "type" "fmul") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=&f") - (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG") - (match_operand:SF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "sub%,%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "subsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG") - (match_operand:SF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "sub%,%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG") - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "sub%-%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "subdf3" - [(set (match_operand:DF 0 "register_operand" "=f") - (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG") - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP" - "sub%-%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (minus:DF (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "fG")) - (match_operand:DF 2 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "sub%-%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG") - (float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "sub%-%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (minus:DF (float_extend:DF - (match_operand:SF 1 "reg_or_fp0_operand" "fG")) - (float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "sub%-%)%& %R1,%R2,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=&f") - (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && TARGET_FIX && alpha_tp == ALPHA_TP_INSN" - "sqrt%,%)%& %R1,%0" - [(set_attr "type" "fsqrt") - (set_attr "opsize" "si") - (set_attr "trap" "yes")]) - -(define_insn "sqrtsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && TARGET_FIX" - "sqrt%,%)%& %R1,%0" - [(set_attr "type" "fsqrt") - (set_attr "opsize" "si") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && TARGET_FIX && alpha_tp == ALPHA_TP_INSN" - "sqrt%-%)%& %R1,%0" - [(set_attr "type" "fsqrt") - (set_attr "trap" "yes")]) - -(define_insn "sqrtdf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))] - "TARGET_FP && TARGET_FIX" - "sqrt%-%)%& %1,%0" - [(set_attr "type" "fsqrt") - (set_attr "trap" "yes")]) - -;; Next are all the integer comparisons, and conditional moves and branches -;; and some of the related define_expand's and define_split's. - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (match_operator:DI 1 "alpha_comparison_operator" - [(match_operand:DI 2 "reg_or_0_operand" "rJ") - (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))] - "" - "cmp%C1 %r2,%3,%0" - [(set_attr "type" "icmp")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (match_operator:DI 1 "alpha_swapped_comparison_operator" - [(match_operand:DI 2 "reg_or_8bit_operand" "rI") - (match_operand:DI 3 "reg_or_0_operand" "rJ")]))] - "" - "cmp%c1 %r3,%2,%0" - [(set_attr "type" "icmp")]) - -;; This pattern exists so conditional moves of SImode values are handled. -;; Comparisons are still done in DImode though. - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r,r,r,r") - (if_then_else:SI - (match_operator 2 "signed_comparison_operator" - [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J") - (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")]) - (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0") - (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))] - "operands[3] == const0_rtx || operands[4] == const0_rtx" - "@ - cmov%C2 %r3,%1,%0 - cmov%D2 %r3,%5,%0 - cmov%c2 %r4,%1,%0 - cmov%d2 %r4,%5,%0" - [(set_attr "type" "icmov")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r,r,r,r") - (if_then_else:DI - (match_operator 2 "signed_comparison_operator" - [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J") - (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")]) - (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0") - (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))] - "operands[3] == const0_rtx || operands[4] == const0_rtx" - "@ - cmov%C2 %r3,%1,%0 - cmov%D2 %r3,%5,%0 - cmov%c2 %r4,%1,%0 - cmov%d2 %r4,%5,%0" - [(set_attr "type" "icmov")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (if_then_else:DI - (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ") - (const_int 1) - (const_int 0)) - (const_int 0)) - (match_operand:DI 1 "reg_or_8bit_operand" "rI,0") - (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))] - "" - "@ - cmovlbc %r2,%1,%0 - cmovlbs %r2,%3,%0" - [(set_attr "type" "icmov")]) - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (if_then_else:DI - (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ") - (const_int 1) - (const_int 0)) - (const_int 0)) - (match_operand:DI 1 "reg_or_8bit_operand" "rI,0") - (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))] - "" - "@ - cmovlbs %r2,%1,%0 - cmovlbc %r2,%3,%0" - [(set_attr "type" "icmov")]) - -;; For ABS, we have two choices, depending on whether the input and output -;; registers are the same or not. -(define_expand "absdi2" - [(set (match_operand:DI 0 "register_operand" "") - (abs:DI (match_operand:DI 1 "register_operand" "")))] - "" - " -{ if (rtx_equal_p (operands[0], operands[1])) - emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode))); - else - emit_insn (gen_absdi2_diff (operands[0], operands[1])); - - DONE; -}") - -(define_expand "absdi2_same" - [(set (match_operand:DI 1 "register_operand" "") - (neg:DI (match_operand:DI 0 "register_operand" ""))) - (set (match_dup 0) - (if_then_else:DI (ge (match_dup 0) (const_int 0)) - (match_dup 0) - (match_dup 1)))] - "" - "") - -(define_expand "absdi2_diff" - [(set (match_operand:DI 0 "register_operand" "") - (neg:DI (match_operand:DI 1 "register_operand" ""))) - (set (match_dup 0) - (if_then_else:DI (lt (match_dup 1) (const_int 0)) - (match_dup 0) - (match_dup 1)))] - "" - "") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (abs:DI (match_dup 0))) - (clobber (match_operand:DI 2 "register_operand" ""))] - "" - [(set (match_dup 1) (neg:DI (match_dup 0))) - (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0)) - (match_dup 0) (match_dup 1)))] - "") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (abs:DI (match_operand:DI 1 "register_operand" "")))] - "! rtx_equal_p (operands[0], operands[1])" - [(set (match_dup 0) (neg:DI (match_dup 1))) - (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0)) - (match_dup 0) (match_dup 1)))] - "") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (neg:DI (abs:DI (match_dup 0)))) - (clobber (match_operand:DI 2 "register_operand" ""))] - "" - [(set (match_dup 1) (neg:DI (match_dup 0))) - (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0)) - (match_dup 0) (match_dup 1)))] - "") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))] - "! rtx_equal_p (operands[0], operands[1])" - [(set (match_dup 0) (neg:DI (match_dup 1))) - (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0)) - (match_dup 0) (match_dup 1)))] - "") - -(define_insn "sminqi3" - [(set (match_operand:QI 0 "register_operand" "=r") - (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ") - (match_operand:QI 2 "reg_or_8bit_operand" "rI")))] - "TARGET_MAX" - "minsb8 %r1,%2,%0" - [(set_attr "type" "mvi")]) - -(define_insn "uminqi3" - [(set (match_operand:QI 0 "register_operand" "=r") - (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ") - (match_operand:QI 2 "reg_or_8bit_operand" "rI")))] - "TARGET_MAX" - "minub8 %r1,%2,%0" - [(set_attr "type" "mvi")]) - -(define_insn "smaxqi3" - [(set (match_operand:QI 0 "register_operand" "=r") - (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ") - (match_operand:QI 2 "reg_or_8bit_operand" "rI")))] - "TARGET_MAX" - "maxsb8 %r1,%2,%0" - [(set_attr "type" "mvi")]) - -(define_insn "umaxqi3" - [(set (match_operand:QI 0 "register_operand" "=r") - (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ") - (match_operand:QI 2 "reg_or_8bit_operand" "rI")))] - "TARGET_MAX" - "maxub8 %r1,%2,%0" - [(set_attr "type" "mvi")]) - -(define_insn "sminhi3" - [(set (match_operand:HI 0 "register_operand" "=r") - (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ") - (match_operand:HI 2 "reg_or_8bit_operand" "rI")))] - "TARGET_MAX" - "minsw4 %r1,%2,%0" - [(set_attr "type" "mvi")]) - -(define_insn "uminhi3" - [(set (match_operand:HI 0 "register_operand" "=r") - (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ") - (match_operand:HI 2 "reg_or_8bit_operand" "rI")))] - "TARGET_MAX" - "minuw4 %r1,%2,%0" - [(set_attr "type" "mvi")]) - -(define_insn "smaxhi3" - [(set (match_operand:HI 0 "register_operand" "=r") - (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ") - (match_operand:HI 2 "reg_or_8bit_operand" "rI")))] - "TARGET_MAX" - "maxsw4 %r1,%2,%0" - [(set_attr "type" "mvi")]) - -(define_insn "umaxhi3" - [(set (match_operand:HI 0 "register_operand" "=r") - (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ") - (match_operand:HI 2 "reg_or_8bit_operand" "rI")))] - "TARGET_MAX" - "maxuw4 %r1,%2,%0" - [(set_attr "type" "shift")]) - -(define_expand "smaxdi3" - [(set (match_dup 3) - (le:DI (match_operand:DI 1 "reg_or_0_operand" "") - (match_operand:DI 2 "reg_or_8bit_operand" ""))) - (set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (eq (match_dup 3) (const_int 0)) - (match_dup 1) (match_dup 2)))] - "" - " -{ operands[3] = gen_reg_rtx (DImode); -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (smax:DI (match_operand:DI 1 "reg_or_0_operand" "") - (match_operand:DI 2 "reg_or_8bit_operand" ""))) - (clobber (match_operand:DI 3 "register_operand" ""))] - "operands[2] != const0_rtx" - [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2))) - (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0)) - (match_dup 1) (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (smax:DI (match_operand:DI 1 "register_operand" "0") - (const_int 0)))] - "" - "cmovlt %0,0,%0" - [(set_attr "type" "icmov")]) - -(define_expand "smindi3" - [(set (match_dup 3) - (lt:DI (match_operand:DI 1 "reg_or_0_operand" "") - (match_operand:DI 2 "reg_or_8bit_operand" ""))) - (set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (ne (match_dup 3) (const_int 0)) - (match_dup 1) (match_dup 2)))] - "" - " -{ operands[3] = gen_reg_rtx (DImode); -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (smin:DI (match_operand:DI 1 "reg_or_0_operand" "") - (match_operand:DI 2 "reg_or_8bit_operand" ""))) - (clobber (match_operand:DI 3 "register_operand" ""))] - "operands[2] != const0_rtx" - [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2))) - (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0)) - (match_dup 1) (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (smin:DI (match_operand:DI 1 "register_operand" "0") - (const_int 0)))] - "" - "cmovgt %0,0,%0" - [(set_attr "type" "icmov")]) - -(define_expand "umaxdi3" - [(set (match_dup 3) - (leu:DI (match_operand:DI 1 "reg_or_0_operand" "") - (match_operand:DI 2 "reg_or_8bit_operand" ""))) - (set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (eq (match_dup 3) (const_int 0)) - (match_dup 1) (match_dup 2)))] - "" - " -{ operands[3] = gen_reg_rtx (DImode); -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (umax:DI (match_operand:DI 1 "reg_or_0_operand" "") - (match_operand:DI 2 "reg_or_8bit_operand" ""))) - (clobber (match_operand:DI 3 "register_operand" ""))] - "operands[2] != const0_rtx" - [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2))) - (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0)) - (match_dup 1) (match_dup 2)))] - "") - -(define_expand "umindi3" - [(set (match_dup 3) - (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "") - (match_operand:DI 2 "reg_or_8bit_operand" ""))) - (set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (ne (match_dup 3) (const_int 0)) - (match_dup 1) (match_dup 2)))] - "" - " -{ operands[3] = gen_reg_rtx (DImode); -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (umin:DI (match_operand:DI 1 "reg_or_0_operand" "") - (match_operand:DI 2 "reg_or_8bit_operand" ""))) - (clobber (match_operand:DI 3 "register_operand" ""))] - "operands[2] != const0_rtx" - [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2))) - (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0)) - (match_dup 1) (match_dup 2)))] - "") - -(define_insn "" - [(set (pc) - (if_then_else - (match_operator 1 "signed_comparison_operator" - [(match_operand:DI 2 "reg_or_0_operand" "rJ") - (const_int 0)]) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "b%C1 %r2,%0" - [(set_attr "type" "ibr")]) - -(define_insn "" - [(set (pc) - (if_then_else - (match_operator 1 "signed_comparison_operator" - [(const_int 0) - (match_operand:DI 2 "register_operand" "r")]) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "b%c1 %2,%0" - [(set_attr "type" "ibr")]) - -(define_insn "" - [(set (pc) - (if_then_else - (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (const_int 1) - (const_int 0)) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "blbs %r1,%0" - [(set_attr "type" "ibr")]) - -(define_insn "" - [(set (pc) - (if_then_else - (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ") - (const_int 1) - (const_int 0)) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "blbc %r1,%0" - [(set_attr "type" "ibr")]) - -(define_split - [(parallel - [(set (pc) - (if_then_else - (match_operator 1 "comparison_operator" - [(zero_extract:DI (match_operand:DI 2 "register_operand" "") - (const_int 1) - (match_operand:DI 3 "const_int_operand" "")) - (const_int 0)]) - (label_ref (match_operand 0 "" "")) - (pc))) - (clobber (match_operand:DI 4 "register_operand" ""))])] - "INTVAL (operands[3]) != 0" - [(set (match_dup 4) - (lshiftrt:DI (match_dup 2) (match_dup 3))) - (set (pc) - (if_then_else (match_op_dup 1 - [(zero_extract:DI (match_dup 4) - (const_int 1) - (const_int 0)) - (const_int 0)]) - (label_ref (match_dup 0)) - (pc)))] - "") - -;; The following are the corresponding floating-point insns. Recall -;; we need to have variants that expand the arguments from SF mode -;; to DFmode. - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (match_operator:DF 1 "alpha_comparison_operator" - [(match_operand:DF 2 "reg_or_fp0_operand" "fG") - (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cmp%-%C1%' %R2,%R3,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (match_operator:DF 1 "alpha_comparison_operator" - [(match_operand:DF 2 "reg_or_fp0_operand" "fG") - (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "cmp%-%C1%' %R2,%R3,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (match_operator:DF 1 "alpha_comparison_operator" - [(float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG")) - (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cmp%-%C1%' %R2,%R3,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (match_operator:DF 1 "alpha_comparison_operator" - [(float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG")) - (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "cmp%-%C1%' %R2,%R3,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (match_operator:DF 1 "alpha_comparison_operator" - [(match_operand:DF 2 "reg_or_fp0_operand" "fG") - (float_extend:DF - (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cmp%-%C1%' %R2,%R3,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (match_operator:DF 1 "alpha_comparison_operator" - [(match_operand:DF 2 "reg_or_fp0_operand" "fG") - (float_extend:DF - (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "cmp%-%C1%' %R2,%R3,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=&f") - (match_operator:DF 1 "alpha_comparison_operator" - [(float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG")) - (float_extend:DF - (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))] - "TARGET_FP && alpha_tp == ALPHA_TP_INSN" - "cmp%-%C1%' %R2,%R3,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (match_operator:DF 1 "alpha_comparison_operator" - [(float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG")) - (float_extend:DF - (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))] - "TARGET_FP && alpha_tp != ALPHA_TP_INSN" - "cmp%-%C1%' %R2,%R3,%0" - [(set_attr "type" "fadd") - (set_attr "trap" "yes")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (if_then_else:DF - (match_operator 3 "signed_comparison_operator" - [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG") - (match_operand:DF 2 "fp0_operand" "G,G")]) - (match_operand:DF 1 "reg_or_fp0_operand" "fG,0") - (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))] - "TARGET_FP" - "@ - fcmov%C3 %R4,%R1,%0 - fcmov%D3 %R4,%R5,%0" - [(set_attr "type" "fcmov")]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f,f") - (if_then_else:SF - (match_operator 3 "signed_comparison_operator" - [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG") - (match_operand:DF 2 "fp0_operand" "G,G")]) - (match_operand:SF 1 "reg_or_fp0_operand" "fG,0") - (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))] - "TARGET_FP" - "@ - fcmov%C3 %R4,%R1,%0 - fcmov%D3 %R4,%R5,%0" - [(set_attr "type" "fcmov")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (if_then_else:DF - (match_operator 3 "signed_comparison_operator" - [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG") - (match_operand:DF 2 "fp0_operand" "G,G")]) - (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")) - (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))] - "TARGET_FP" - "@ - fcmov%C3 %R4,%R1,%0 - fcmov%D3 %R4,%R5,%0" - [(set_attr "type" "fcmov")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (if_then_else:DF - (match_operator 3 "signed_comparison_operator" - [(float_extend:DF - (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG")) - (match_operand:DF 2 "fp0_operand" "G,G")]) - (match_operand:DF 1 "reg_or_fp0_operand" "fG,0") - (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))] - "TARGET_FP" - "@ - fcmov%C3 %R4,%R1,%0 - fcmov%D3 %R4,%R5,%0" - [(set_attr "type" "fcmov")]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f,f") - (if_then_else:SF - (match_operator 3 "signed_comparison_operator" - [(float_extend:DF - (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG")) - (match_operand:DF 2 "fp0_operand" "G,G")]) - (match_operand:SF 1 "reg_or_fp0_operand" "fG,0") - (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))] - "TARGET_FP" - "@ - fcmov%C3 %R4,%R1,%0 - fcmov%D3 %R4,%R5,%0" - [(set_attr "type" "fcmov")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (if_then_else:DF - (match_operator 3 "signed_comparison_operator" - [(float_extend:DF - (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG")) - (match_operand:DF 2 "fp0_operand" "G,G")]) - (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")) - (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))] - "TARGET_FP" - "@ - fcmov%C3 %R4,%R1,%0 - fcmov%D3 %R4,%R5,%0" - [(set_attr "type" "fcmov")]) - -(define_expand "maxdf3" - [(set (match_dup 3) - (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "") - (match_operand:DF 2 "reg_or_fp0_operand" ""))) - (set (match_operand:DF 0 "register_operand" "") - (if_then_else:DF (eq (match_dup 3) (match_dup 4)) - (match_dup 1) (match_dup 2)))] - "TARGET_FP" - " -{ operands[3] = gen_reg_rtx (DFmode); - operands[4] = CONST0_RTX (DFmode); -}") - -(define_expand "mindf3" - [(set (match_dup 3) - (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "") - (match_operand:DF 2 "reg_or_fp0_operand" ""))) - (set (match_operand:DF 0 "register_operand" "") - (if_then_else:DF (ne (match_dup 3) (match_dup 4)) - (match_dup 1) (match_dup 2)))] - "TARGET_FP" - " -{ operands[3] = gen_reg_rtx (DFmode); - operands[4] = CONST0_RTX (DFmode); -}") - -(define_expand "maxsf3" - [(set (match_dup 3) - (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "")) - (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "")))) - (set (match_operand:SF 0 "register_operand" "") - (if_then_else:SF (eq (match_dup 3) (match_dup 4)) - (match_dup 1) (match_dup 2)))] - "TARGET_FP" - " -{ operands[3] = gen_reg_rtx (DFmode); - operands[4] = CONST0_RTX (DFmode); -}") - -(define_expand "minsf3" - [(set (match_dup 3) - (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "")) - (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "")))) - (set (match_operand:SF 0 "register_operand" "") - (if_then_else:SF (ne (match_dup 3) (match_dup 4)) - (match_dup 1) (match_dup 2)))] - "TARGET_FP" - " -{ operands[3] = gen_reg_rtx (DFmode); - operands[4] = CONST0_RTX (DFmode); -}") - -(define_insn "" - [(set (pc) - (if_then_else - (match_operator 1 "signed_comparison_operator" - [(match_operand:DF 2 "reg_or_fp0_operand" "fG") - (match_operand:DF 3 "fp0_operand" "G")]) - (label_ref (match_operand 0 "" "")) - (pc)))] - "TARGET_FP" - "fb%C1 %R2,%0" - [(set_attr "type" "fbr")]) - -(define_insn "" - [(set (pc) - (if_then_else - (match_operator 1 "signed_comparison_operator" - [(float_extend:DF - (match_operand:SF 2 "reg_or_fp0_operand" "fG")) - (match_operand:DF 3 "fp0_operand" "G")]) - (label_ref (match_operand 0 "" "")) - (pc)))] - "TARGET_FP" - "fb%C1 %R2,%0" - [(set_attr "type" "fbr")]) - -;; These are the main define_expand's used to make conditional branches -;; and compares. - -(define_expand "cmpdf" - [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "") - (match_operand:DF 1 "reg_or_fp0_operand" "")))] - "TARGET_FP" - " -{ - alpha_compare_op0 = operands[0]; - alpha_compare_op1 = operands[1]; - alpha_compare_fp_p = 1; - DONE; -}") - -(define_expand "cmpdi" - [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "") - (match_operand:DI 1 "reg_or_8bit_operand" "")))] - "" - " -{ - alpha_compare_op0 = operands[0]; - alpha_compare_op1 = operands[1]; - alpha_compare_fp_p = 0; - DONE; -}") - -(define_expand "beq" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (EQ); }") - -(define_expand "bne" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (NE); }") - -(define_expand "blt" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (LT); }") - -(define_expand "ble" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (LE); }") - -(define_expand "bgt" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (GT); }") - -(define_expand "bge" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (GE); }") - -(define_expand "bltu" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (LTU); }") - -(define_expand "bleu" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (LEU); }") - -(define_expand "bgtu" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (GTU); }") - -(define_expand "bgeu" - [(set (pc) - (if_then_else (match_dup 1) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "{ operands[1] = alpha_emit_conditional_branch (GEU); }") - -(define_expand "seq" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1); -}") - -(define_expand "sne" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1)) - (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1); -}") - -(define_expand "slt" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_LT (DImode, alpha_compare_op0, alpha_compare_op1); -}") - -(define_expand "sle" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_LE (DImode, alpha_compare_op0, alpha_compare_op1); -}") - -(define_expand "sgt" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_LT (DImode, force_reg (DImode, alpha_compare_op1), - alpha_compare_op0); -}") - -(define_expand "sge" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_LE (DImode, force_reg (DImode, alpha_compare_op1), - alpha_compare_op0); -}") - -(define_expand "sltu" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_LTU (DImode, alpha_compare_op0, alpha_compare_op1); -}") - -(define_expand "sleu" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_LEU (DImode, alpha_compare_op0, alpha_compare_op1); -}") - -(define_expand "sgtu" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_LTU (DImode, force_reg (DImode, alpha_compare_op1), - alpha_compare_op0); -}") - -(define_expand "sgeu" - [(set (match_operand:DI 0 "register_operand" "") - (match_dup 1))] - "" - " -{ - if (alpha_compare_fp_p) - FAIL; - - operands[1] = gen_rtx_LEU (DImode, force_reg (DImode, alpha_compare_op1), - alpha_compare_op0); -}") - -;; These are the main define_expand's used to make conditional moves. - -(define_expand "movsicc" - [(set (match_operand:SI 0 "register_operand" "") - (if_then_else:SI (match_operand 1 "comparison_operator" "") - (match_operand:SI 2 "reg_or_8bit_operand" "") - (match_operand:SI 3 "reg_or_8bit_operand" "")))] - "" - " -{ - if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0) - FAIL; -}") - -(define_expand "movdicc" - [(set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (match_operand 1 "comparison_operator" "") - (match_operand:DI 2 "reg_or_8bit_operand" "") - (match_operand:DI 3 "reg_or_8bit_operand" "")))] - "" - " -{ - if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0) - FAIL; -}") - -(define_expand "movsfcc" - [(set (match_operand:SF 0 "register_operand" "") - (if_then_else:SF (match_operand 1 "comparison_operator" "") - (match_operand:SF 2 "reg_or_8bit_operand" "") - (match_operand:SF 3 "reg_or_8bit_operand" "")))] - "" - " -{ - if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0) - FAIL; -}") - -(define_expand "movdfcc" - [(set (match_operand:DF 0 "register_operand" "") - (if_then_else:DF (match_operand 1 "comparison_operator" "") - (match_operand:DF 2 "reg_or_8bit_operand" "") - (match_operand:DF 3 "reg_or_8bit_operand" "")))] - "" - " -{ - if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0) - FAIL; -}") - -;; These define_split definitions are used in cases when comparisons have -;; not be stated in the correct way and we need to reverse the second -;; comparison. For example, x >= 7 has to be done as x < 6 with the -;; comparison that tests the result being reversed. We have one define_split -;; for each use of a comparison. They do not match valid insns and need -;; not generate valid insns. -;; -;; We can also handle equality comparisons (and inequality comparisons in -;; cases where the resulting add cannot overflow) by doing an add followed by -;; a comparison with zero. This is faster since the addition takes one -;; less cycle than a compare when feeding into a conditional move. -;; For this case, we also have an SImode pattern since we can merge the add -;; and sign extend and the order doesn't matter. -;; -;; We do not do this for floating-point, since it isn't clear how the "wrong" -;; operation could have been generated. - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI - (match_operator 1 "comparison_operator" - [(match_operand:DI 2 "reg_or_0_operand" "") - (match_operand:DI 3 "reg_or_cint_operand" "")]) - (match_operand:DI 4 "reg_or_cint_operand" "") - (match_operand:DI 5 "reg_or_cint_operand" ""))) - (clobber (match_operand:DI 6 "register_operand" ""))] - "operands[3] != const0_rtx" - [(set (match_dup 6) (match_dup 7)) - (set (match_dup 0) - (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))] - " -{ enum rtx_code code = GET_CODE (operands[1]); - int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU); - - /* If we are comparing for equality with a constant and that constant - appears in the arm when the register equals the constant, use the - register since that is more likely to match (and to produce better code - if both would). */ - - if (code == EQ && GET_CODE (operands[3]) == CONST_INT - && rtx_equal_p (operands[4], operands[3])) - operands[4] = operands[2]; - - else if (code == NE && GET_CODE (operands[3]) == CONST_INT - && rtx_equal_p (operands[5], operands[3])) - operands[5] = operands[2]; - - if (code == NE || code == EQ - || (extended_count (operands[2], DImode, unsignedp) >= 1 - && extended_count (operands[3], DImode, unsignedp) >= 1)) - { - if (GET_CODE (operands[3]) == CONST_INT) - operands[7] = gen_rtx_PLUS (DImode, operands[2], - GEN_INT (- INTVAL (operands[3]))); - else - operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]); - - operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx); - } - - else if (code == EQ || code == LE || code == LT - || code == LEU || code == LTU) - { - operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]); - operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx); - } - else - { - operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode, - operands[2], operands[3]); - operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx); - } -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI - (match_operator 1 "comparison_operator" - [(match_operand:SI 2 "reg_or_0_operand" "") - (match_operand:SI 3 "reg_or_cint_operand" "")]) - (match_operand:DI 4 "reg_or_8bit_operand" "") - (match_operand:DI 5 "reg_or_8bit_operand" ""))) - (clobber (match_operand:DI 6 "register_operand" ""))] - "operands[3] != const0_rtx - && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)" - [(set (match_dup 6) (match_dup 7)) - (set (match_dup 0) - (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))] - " -{ enum rtx_code code = GET_CODE (operands[1]); - int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU); - rtx tem; - - if ((code != NE && code != EQ - && ! (extended_count (operands[2], DImode, unsignedp) >= 1 - && extended_count (operands[3], DImode, unsignedp) >= 1))) - FAIL; - - if (GET_CODE (operands[3]) == CONST_INT) - tem = gen_rtx_PLUS (SImode, operands[2], - GEN_INT (- INTVAL (operands[3]))); - else - tem = gen_rtx_MINUS (SImode, operands[2], operands[3]); - - operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem); - operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode, - operands[6], const0_rtx); -}") - -(define_split - [(set (pc) - (if_then_else - (match_operator 1 "comparison_operator" - [(match_operand:DI 2 "reg_or_0_operand" "") - (match_operand:DI 3 "reg_or_cint_operand" "")]) - (label_ref (match_operand 0 "" "")) - (pc))) - (clobber (match_operand:DI 4 "register_operand" ""))] - "operands[3] != const0_rtx" - [(set (match_dup 4) (match_dup 5)) - (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))] - " -{ enum rtx_code code = GET_CODE (operands[1]); - int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU); - - if (code == NE || code == EQ - || (extended_count (operands[2], DImode, unsignedp) >= 1 - && extended_count (operands[3], DImode, unsignedp) >= 1)) - { - if (GET_CODE (operands[3]) == CONST_INT) - operands[5] = gen_rtx_PLUS (DImode, operands[2], - GEN_INT (- INTVAL (operands[3]))); - else - operands[5] = gen_rtx_MINUS (DImode, operands[2], operands[3]); - - operands[6] = gen_rtx_fmt_ee (code, VOIDmode, operands[4], const0_rtx); - } - - else if (code == EQ || code == LE || code == LT - || code == LEU || code == LTU) - { - operands[5] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]); - operands[6] = gen_rtx_NE (VOIDmode, operands[4], const0_rtx); - } - else - { - operands[5] = gen_rtx_fmt_ee (reverse_condition (code), DImode, - operands[2], operands[3]); - operands[6] = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx); - } -}") - -(define_split - [(set (pc) - (if_then_else - (match_operator 1 "comparison_operator" - [(match_operand:SI 2 "reg_or_0_operand" "") - (match_operand:SI 3 "const_int_operand" "")]) - (label_ref (match_operand 0 "" "")) - (pc))) - (clobber (match_operand:DI 4 "register_operand" ""))] - "operands[3] != const0_rtx - && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)" - [(set (match_dup 4) (match_dup 5)) - (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))] - " -{ rtx tem; - - if (GET_CODE (operands[3]) == CONST_INT) - tem = gen_rtx_PLUS (SImode, operands[2], - GEN_INT (- INTVAL (operands[3]))); - else - tem = gen_rtx_MINUS (SImode, operands[2], operands[3]); - - operands[5] = gen_rtx_SIGN_EXTEND (DImode, tem); - operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode, - operands[4], const0_rtx); -}") - -;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0". -;; This eliminates one, and sometimes two, insns when the AND can be done -;; with a ZAP. -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (match_operator 1 "comparison_operator" - [(match_operand:DI 2 "register_operand" "") - (match_operand:DI 3 "const_int_operand" "")])) - (clobber (match_operand:DI 4 "register_operand" ""))] - "exact_log2 (INTVAL (operands[3]) + 1) >= 0 - && (GET_CODE (operands[1]) == GTU - || GET_CODE (operands[1]) == LEU - || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE) - && extended_count (operands[2], DImode, 1) > 0))" - [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5))) - (set (match_dup 0) (match_dup 6))] - " -{ - operands[5] = GEN_INT (~ INTVAL (operands[3])); - operands[6] = gen_rtx_fmt_ee (((GET_CODE (operands[1]) == GTU - || GET_CODE (operands[1]) == GT) - ? NE : EQ), - DImode, operands[4], const0_rtx); -}") - -;; Here are the CALL and unconditional branch insns. Calls on NT and OSF -;; work differently, so we have different patterns for each. - -(define_expand "call" - [(use (match_operand:DI 0 "" "")) - (use (match_operand 1 "" "")) - (use (match_operand 2 "" "")) - (use (match_operand 3 "" ""))] - "" - " -{ if (TARGET_WINDOWS_NT) - emit_call_insn (gen_call_nt (operands[0], operands[1])); - else if (TARGET_OPEN_VMS) - emit_call_insn (gen_call_vms (operands[0], operands[2])); - else - emit_call_insn (gen_call_osf (operands[0], operands[1])); - - DONE; -}") - -(define_expand "call_osf" - [(parallel [(call (mem:DI (match_operand 0 "" "")) - (match_operand 1 "" "")) - (clobber (reg:DI 27)) - (clobber (reg:DI 26))])] - "" - " -{ if (GET_CODE (operands[0]) != MEM) - abort (); - - operands[0] = XEXP (operands[0], 0); - - if (GET_CODE (operands[0]) != SYMBOL_REF - && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27)) - { - rtx tem = gen_rtx_REG (DImode, 27); - emit_move_insn (tem, operands[0]); - operands[0] = tem; - } -}") - -(define_expand "call_nt" - [(parallel [(call (mem:DI (match_operand 0 "" "")) - (match_operand 1 "" "")) - (clobber (reg:DI 26))])] - "" - " -{ if (GET_CODE (operands[0]) != MEM) - abort (); - - operands[0] = XEXP (operands[0], 0); - if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG) - operands[0] = force_reg (DImode, operands[0]); -}") - -;; -;; call openvms/alpha -;; op 0: symbol ref for called function -;; op 1: next_arg_reg (argument information value for R25) -;; -(define_expand "call_vms" - [(parallel [(call (mem:DI (match_operand 0 "" "")) - (match_operand 1 "" "")) - (use (match_dup 2)) - (use (reg:DI 25)) - (use (reg:DI 26)) - (clobber (reg:DI 27))])] - "" - " -{ if (GET_CODE (operands[0]) != MEM) - abort (); - - operands[0] = XEXP (operands[0], 0); - - /* Always load AI with argument information, then handle symbolic and - indirect call differently. Load RA and set operands[2] to PV in - both cases. */ - - emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]); - if (GET_CODE (operands[0]) == SYMBOL_REF) - { - extern char *savealloc (); - char *linksym, *symbol = XSTR (operands[0], 0); - rtx linkage; - - if (*symbol == '*') - symbol++; - linksym = savealloc (strlen (symbol) + 6); - - alpha_need_linkage (symbol, 0); - - linksym[0] = '$'; - strcpy (linksym+1, symbol); - strcat (linksym, \"..lk\"); - linkage = gen_rtx_SYMBOL_REF (Pmode, linksym); - - emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage)); - - operands[2] - = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8))); - } - else - { - emit_move_insn (gen_rtx_REG (Pmode, 26), - gen_rtx_MEM (Pmode, plus_constant (operands[0], 8))); - - operands[2] = operands[0]; - } - -}") - -(define_expand "call_value" - [(use (match_operand 0 "" "")) - (use (match_operand:DI 1 "" "")) - (use (match_operand 2 "" "")) - (use (match_operand 3 "" "")) - (use (match_operand 4 "" ""))] - "" - " -{ if (TARGET_WINDOWS_NT) - emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2])); - else if (TARGET_OPEN_VMS) - emit_call_insn (gen_call_value_vms (operands[0], operands[1], - operands[3])); - else - emit_call_insn (gen_call_value_osf (operands[0], operands[1], - operands[2])); - DONE; -}") - -(define_expand "call_value_osf" - [(parallel [(set (match_operand 0 "" "") - (call (mem:DI (match_operand 1 "" "")) - (match_operand 2 "" ""))) - (clobber (reg:DI 27)) - (clobber (reg:DI 26))])] - "" - " -{ if (GET_CODE (operands[1]) != MEM) - abort (); - - operands[1] = XEXP (operands[1], 0); - - if (GET_CODE (operands[1]) != SYMBOL_REF - && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27)) - { - rtx tem = gen_rtx_REG (DImode, 27); - emit_move_insn (tem, operands[1]); - operands[1] = tem; - } -}") - -(define_expand "call_value_nt" - [(parallel [(set (match_operand 0 "" "") - (call (mem:DI (match_operand 1 "" "")) - (match_operand 2 "" ""))) - (clobber (reg:DI 26))])] - "" - " -{ if (GET_CODE (operands[1]) != MEM) - abort (); - - operands[1] = XEXP (operands[1], 0); - if (GET_CODE (operands[1]) != SYMBOL_REF && GET_CODE (operands[1]) != REG) - operands[1] = force_reg (DImode, operands[1]); -}") - -(define_expand "call_value_vms" - [(parallel [(set (match_operand 0 "" "") - (call (mem:DI (match_operand:DI 1 "" "")) - (match_operand 2 "" ""))) - (use (match_dup 3)) - (use (reg:DI 25)) - (use (reg:DI 26)) - (clobber (reg:DI 27))])] - "" - " -{ if (GET_CODE (operands[1]) != MEM) - abort (); - - operands[1] = XEXP (operands[1], 0); - - /* Always load AI with argument information, then handle symbolic and - indirect call differently. Load RA and set operands[3] to PV in - both cases. */ - - emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]); - if (GET_CODE (operands[1]) == SYMBOL_REF) - { - extern char *savealloc (); - char *linksym, *symbol = XSTR (operands[1], 0); - rtx linkage; - - if (*symbol == '*') - symbol++; - linksym = savealloc (strlen (symbol) + 6); - - alpha_need_linkage (symbol, 0); - linksym[0] = '$'; - strcpy (linksym+1, symbol); - strcat (linksym, \"..lk\"); - linkage = gen_rtx_SYMBOL_REF (Pmode, linksym); - - emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage)); - - operands[3] - = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8))); - } - else - { - emit_move_insn (gen_rtx_REG (Pmode, 26), - gen_rtx_MEM (Pmode, plus_constant (operands[1], 8))); - - operands[3] = operands[1]; - } -}") - -(define_insn "" - [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i")) - (match_operand 1 "" "")) - (clobber (reg:DI 27)) - (clobber (reg:DI 26))] - "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS" - "@ - jsr $26,($27),0\;ldgp $29,0($26) - bsr $26,$%0..ng - jsr $26,%0\;ldgp $29,0($26)" - [(set_attr "type" "jsr") - (set_attr "length" "12,*,16")]) - -(define_insn "" - [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i")) - (match_operand 1 "" "")) - (clobber (reg:DI 26))] - "TARGET_WINDOWS_NT" - "@ - jsr $26,(%0) - bsr $26,%0 - jsr $26,%0" - [(set_attr "type" "jsr") - (set_attr "length" "*,*,12")]) - -(define_insn "" - [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i")) - (match_operand 1 "" "")) - (use (match_operand:DI 2 "general_operand" "r,m")) - (use (reg:DI 25)) - (use (reg:DI 26)) - (clobber (reg:DI 27))] - "TARGET_OPEN_VMS" - "@ - mov %2,$27\;jsr $26,0\;ldq $27,0($29) - ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)" - [(set_attr "type" "jsr") - (set_attr "length" "12,16")]) - -(define_insn "" - [(set (match_operand 0 "register_operand" "=rf,rf,rf") - (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i")) - (match_operand 2 "" ""))) - (clobber (reg:DI 27)) - (clobber (reg:DI 26))] - "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS" - "@ - jsr $26,($27),0\;ldgp $29,0($26) - bsr $26,$%1..ng - jsr $26,%1\;ldgp $29,0($26)" - [(set_attr "type" "jsr") - (set_attr "length" "12,*,16")]) - -(define_insn "" - [(set (match_operand 0 "register_operand" "=rf,rf,rf") - (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i")) - (match_operand 2 "" ""))) - (clobber (reg:DI 26))] - "TARGET_WINDOWS_NT" - "@ - jsr $26,(%1) - bsr $26,%1 - jsr $26,%1" - [(set_attr "type" "jsr") - (set_attr "length" "*,*,12")]) - -(define_insn "" - [(set (match_operand 0 "register_operand" "") - (call (mem:DI (match_operand:DI 1 "call_operand" "r,i")) - (match_operand 2 "" ""))) - (use (match_operand:DI 3 "general_operand" "r,m")) - (use (reg:DI 25)) - (use (reg:DI 26)) - (clobber (reg:DI 27))] - "TARGET_OPEN_VMS" - "@ - mov %3,$27\;jsr $26,0\;ldq $27,0($29) - ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)" - [(set_attr "type" "jsr") - (set_attr "length" "12,16")]) - -;; Call subroutine returning any type. - -(define_expand "untyped_call" - [(parallel [(call (match_operand 0 "" "") - (const_int 0)) - (match_operand 1 "" "") - (match_operand 2 "" "")])] - "" - " -{ - int i; - - emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx)); - - for (i = 0; i < XVECLEN (operands[2], 0); i++) - { - rtx set = XVECEXP (operands[2], 0, i); - emit_move_insn (SET_DEST (set), SET_SRC (set)); - } - - /* The optimizer does not know that the call sets the function value - registers we stored in the result block. We avoid problems by - claiming that all hard registers are used and clobbered at this - point. */ - emit_insn (gen_blockage ()); - - DONE; -}") - -;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and -;; all of memory. This blocks insns from being moved across this point. - -(define_insn "blockage" - [(unspec_volatile [(const_int 0)] 1)] - "" - "" - [(set_attr "length" "0")]) - -(define_insn "jump" - [(set (pc) - (label_ref (match_operand 0 "" "")))] - "" - "br $31,%l0" - [(set_attr "type" "ibr")]) - -(define_insn "return" - [(return)] - "direct_return ()" - "ret $31,($26),1" - [(set_attr "type" "ibr")]) - -;; Use a different pattern for functions which have non-trivial -;; epilogues so as not to confuse jump and reorg. -(define_insn "return_internal" - [(use (reg:DI 26)) - (return)] - "" - "ret $31,($26),1" - [(set_attr "type" "ibr")]) - -(define_insn "indirect_jump" - [(set (pc) (match_operand:DI 0 "register_operand" "r"))] - "" - "jmp $31,(%0),0" - [(set_attr "type" "ibr")]) - -(define_expand "tablejump" - [(use (match_operand:SI 0 "register_operand" "")) - (use (match_operand:SI 1 "" ""))] - "" - " -{ - if (TARGET_WINDOWS_NT) - emit_jump_insn (gen_tablejump_nt (operands[0], operands[1])); - else if (TARGET_OPEN_VMS) - emit_jump_insn (gen_tablejump_vms (operands[0], operands[1])); - else - emit_jump_insn (gen_tablejump_osf (operands[0], operands[1])); - - DONE; -}") - -(define_expand "tablejump_osf" - [(set (match_dup 3) - (sign_extend:DI (match_operand:SI 0 "register_operand" ""))) - (parallel [(set (pc) - (plus:DI (match_dup 3) - (label_ref:DI (match_operand 1 "" "")))) - (clobber (match_scratch:DI 2 "=r"))])] - "" - " -{ operands[3] = gen_reg_rtx (DImode); }") - -(define_expand "tablejump_nt" - [(set (match_dup 3) - (sign_extend:DI (match_operand:SI 0 "register_operand" ""))) - (parallel [(set (pc) - (match_dup 3)) - (use (label_ref (match_operand 1 "" "")))])] - "" - " -{ operands[3] = gen_reg_rtx (DImode); }") - -;; -;; tablejump, openVMS way -;; op 0: offset -;; op 1: label preceding jump-table -;; -(define_expand "tablejump_vms" - [(set (match_dup 2) - (match_operand:DI 0 "register_operand" "")) - (set (pc) - (plus:DI (match_dup 2) - (label_ref:DI (match_operand 1 "" ""))))] - "" - " -{ operands[2] = gen_reg_rtx (DImode); }") - -(define_insn "" - [(set (pc) - (plus:DI (match_operand:DI 0 "register_operand" "r") - (label_ref:DI (match_operand 1 "" "")))) - (clobber (match_scratch:DI 2 "=r"))] - "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && next_active_insn (insn) != 0 - && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC - && PREV_INSN (next_active_insn (insn)) == operands[1]" - "* -{ rtx best_label = 0; - rtx jump_table_insn = next_active_insn (operands[1]); - - if (GET_CODE (jump_table_insn) == JUMP_INSN - && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC) - { - rtx jump_table = PATTERN (jump_table_insn); - int n_labels = XVECLEN (jump_table, 1); - int best_count = -1; - int i, j; - - for (i = 0; i < n_labels; i++) - { - int count = 1; - - for (j = i + 1; j < n_labels; j++) - if (XEXP (XVECEXP (jump_table, 1, i), 0) - == XEXP (XVECEXP (jump_table, 1, j), 0)) - count++; - - if (count > best_count) - best_count = count, best_label = XVECEXP (jump_table, 1, i); - } - } - - if (best_label) - { - operands[3] = best_label; - return \"addq %0,$29,%2\;jmp $31,(%2),%3\"; - } - else - return \"addq %0,$29,%2\;jmp $31,(%2),0\"; -}" - [(set_attr "type" "ibr") - (set_attr "length" "8")]) - -(define_insn "" - [(set (pc) - (match_operand:DI 0 "register_operand" "r")) - (use (label_ref (match_operand 1 "" "")))] - "TARGET_WINDOWS_NT && next_active_insn (insn) != 0 - && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC - && PREV_INSN (next_active_insn (insn)) == operands[1]" - "* -{ rtx best_label = 0; - rtx jump_table_insn = next_active_insn (operands[1]); - - if (GET_CODE (jump_table_insn) == JUMP_INSN - && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC) - { - rtx jump_table = PATTERN (jump_table_insn); - int n_labels = XVECLEN (jump_table, 1); - int best_count = -1; - int i, j; - - for (i = 0; i < n_labels; i++) - { - int count = 1; - - for (j = i + 1; j < n_labels; j++) - if (XEXP (XVECEXP (jump_table, 1, i), 0) - == XEXP (XVECEXP (jump_table, 1, j), 0)) - count++; - - if (count > best_count) - best_count = count, best_label = XVECEXP (jump_table, 1, i); - } - } - - if (best_label) - { - operands[2] = best_label; - return \"jmp $31,(%0),%2\"; - } - else - return \"jmp $31,(%0),0\"; -}" - [(set_attr "type" "ibr")]) - -;; -;; op 0 is table offset -;; op 1 is table label -;; - -(define_insn "" - [(set (pc) - (plus:DI (match_operand 0 "register_operand" "r") - (label_ref (match_operand 1 "" ""))))] - "TARGET_OPEN_VMS" - "jmp $31,(%0),0" - [(set_attr "type" "ibr")]) - -;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't -;; want to have to include pal.h in our .s file. -;; -;; Technically the type for call_pal is jsr, but we use that for determining -;; if we need a GP. Use ibr instead since it has the same EV5 scheduling -;; characteristics. -(define_insn "imb" - [(unspec_volatile [(const_int 0)] 0)] - "" - "call_pal 0x86" - [(set_attr "type" "ibr")]) - -;; Finally, we have the basic data motion insns. The byte and word insns -;; are done via define_expand. Start with the floating-point insns, since -;; they are simpler. - -(define_insn "" - [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,r,r,m,m") - (match_operand:SF 1 "input_operand" "fG,m,rG,m,fG,r"))] - "! TARGET_FIX - && (register_operand (operands[0], SFmode) - || reg_or_fp0_operand (operands[1], SFmode))" - "@ - fmov %R1,%0 - ld%, %0,%1 - mov %r1,%0 - ldl %0,%1 - st%, %R1,%0 - stl %r1,%0" - [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")]) - -(define_insn "" - [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,r,r,m,m,f,*r") - (match_operand:SF 1 "input_operand" "fG,m,rG,m,fG,r,r,*f"))] - "TARGET_FIX - && (register_operand (operands[0], SFmode) - || reg_or_fp0_operand (operands[1], SFmode))" - "@ - fmov %R1,%0 - ld%, %0,%1 - mov %r1,%0 - ldl %0,%1 - st%, %R1,%0 - stl %r1,%0 - itofs %1,%0 - ftois %1,%0" - [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")]) - -(define_insn "" - [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,r,r,m,m") - (match_operand:DF 1 "input_operand" "fG,m,rG,m,fG,r"))] - "! TARGET_FIX - && (register_operand (operands[0], DFmode) - || reg_or_fp0_operand (operands[1], DFmode))" - "@ - fmov %R1,%0 - ld%- %0,%1 - mov %r1,%0 - ldq %0,%1 - st%- %R1,%0 - stq %r1,%0" - [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")]) - -(define_insn "" - [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,r,r,m,m,f,*r") - (match_operand:DF 1 "input_operand" "fG,m,rG,m,fG,r,r,*f"))] - "TARGET_FIX - && (register_operand (operands[0], DFmode) - || reg_or_fp0_operand (operands[1], DFmode))" - "@ - fmov %R1,%0 - ld%- %0,%1 - mov %r1,%0 - ldq %0,%1 - st%- %R1,%0 - stq %r1,%0 - itoft %1,%0 - ftoit %1,%0" - [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")]) - -(define_expand "movsf" - [(set (match_operand:SF 0 "nonimmediate_operand" "") - (match_operand:SF 1 "general_operand" ""))] - "" - " -{ - if (GET_CODE (operands[0]) == MEM - && ! reg_or_fp0_operand (operands[1], SFmode)) - operands[1] = force_reg (SFmode, operands[1]); -}") - -(define_expand "movdf" - [(set (match_operand:DF 0 "nonimmediate_operand" "") - (match_operand:DF 1 "general_operand" ""))] - "" - " -{ - if (GET_CODE (operands[0]) == MEM - && ! reg_or_fp0_operand (operands[1], DFmode)) - operands[1] = force_reg (DFmode, operands[1]); -}") - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,f,f,m") - (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,fJ,m,f"))] - "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && ! TARGET_FIX - && (register_operand (operands[0], SImode) - || reg_or_0_operand (operands[1], SImode))" - "@ - mov %r1,%0 - lda %0,%1 - ldah %0,%h1 - ldl %0,%1 - stl %r1,%0 - fmov %R1,%0 - ld%, %0,%1 - st%, %R1,%0" - [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst")]) - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,f,f,m,r,*f") - (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,fJ,m,f,f,*r"))] - "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && TARGET_FIX - && (register_operand (operands[0], SImode) - || reg_or_0_operand (operands[1], SImode))" - "@ - mov %r1,%0 - lda %0,%1 - ldah %0,%h1 - ldl %0,%1 - stl %r1,%0 - fmov %R1,%0 - ld%, %0,%1 - st%, %R1,%0 - ftois %1,%0 - itofs %1,%0" - [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst,ftoi,itof")]) - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f,m") - (match_operand:SI 1 "input_operand" "rJ,K,L,s,m,rJ,fJ,m,f"))] - "(TARGET_WINDOWS_NT || TARGET_OPEN_VMS) - && (register_operand (operands[0], SImode) - || reg_or_0_operand (operands[1], SImode))" - "@ - mov %1,%0 - lda %0,%1 - ldah %0,%h1 - lda %0,%1 - ldl %0,%1 - stl %r1,%0 - fmov %R1,%0 - ld%, %0,%1 - st%, %R1,%0" - [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")]) - -(define_insn "" - [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,f") - (match_operand:HI 1 "input_operand" "rJ,n,fJ"))] - "! TARGET_BWX - && (register_operand (operands[0], HImode) - || register_operand (operands[1], HImode))" - "@ - mov %r1,%0 - lda %0,%L1 - fmov %R1,%0" - [(set_attr "type" "ilog,iadd,fcpys")]) - -(define_insn "" - [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m,f") - (match_operand:HI 1 "input_operand" "rJ,n,m,rJ,fJ"))] - "TARGET_BWX - && (register_operand (operands[0], HImode) - || reg_or_0_operand (operands[1], HImode))" - "@ - mov %r1,%0 - lda %0,%L1 - ldwu %0,%1 - stw %r1,%0 - fmov %R1,%0" - [(set_attr "type" "ilog,iadd,ild,ist,fcpys")]) - -(define_insn "" - [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,f") - (match_operand:QI 1 "input_operand" "rJ,n,fJ"))] - "! TARGET_BWX - && (register_operand (operands[0], QImode) - || register_operand (operands[1], QImode))" - "@ - mov %r1,%0 - lda %0,%L1 - fmov %R1,%0" - [(set_attr "type" "ilog,iadd,fcpys")]) - -(define_insn "" - [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m,f") - (match_operand:QI 1 "input_operand" "rJ,n,m,rJ,fJ"))] - "TARGET_BWX - && (register_operand (operands[0], QImode) - || reg_or_0_operand (operands[1], QImode))" - "@ - mov %r1,%0 - lda %0,%L1 - ldbu %0,%1 - stb %r1,%0 - fmov %R1,%0" - [(set_attr "type" "ilog,iadd,ild,ist,fcpys")]) - -;; We do two major things here: handle mem->mem and construct long -;; constants. - -(define_expand "movsi" - [(set (match_operand:SI 0 "general_operand" "") - (match_operand:SI 1 "general_operand" ""))] - "" - " -{ - if (GET_CODE (operands[0]) == MEM - && ! reg_or_0_operand (operands[1], SImode)) - operands[1] = force_reg (SImode, operands[1]); - - if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode)) - ; - else if (GET_CODE (operands[1]) == CONST_INT) - { - operands[1] - = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3); - if (rtx_equal_p (operands[0], operands[1])) - DONE; - } -}") - -;; Split a load of a large constant into the appropriate two-insn -;; sequence. - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (match_operand:SI 1 "const_int_operand" ""))] - "! add_operand (operands[1], SImode)" - [(set (match_dup 0) (match_dup 2)) - (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))] - " -{ rtx tem - = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2); - - if (tem == operands[0]) - DONE; - else - FAIL; -}") - -(define_insn "" - [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,m,f,f,Q") - (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,fJ,Q,f"))] - "! TARGET_FIX - && (register_operand (operands[0], DImode) - || reg_or_0_operand (operands[1], DImode))" - "@ - mov %r1,%0 - lda %0,%1 - ldah %0,%h1 - lda %0,%1 - ldq%A1 %0,%1 - stq%A0 %r1,%0 - fmov %R1,%0 - ldt %0,%1 - stt %R1,%0" - [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")]) - -(define_insn "" - [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,m,f,f,Q,r,*f") - (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,fJ,Q,f,f,*r"))] - "TARGET_FIX - && (register_operand (operands[0], DImode) - || reg_or_0_operand (operands[1], DImode))" - "@ - mov %r1,%0 - lda %0,%1 - ldah %0,%h1 - lda %0,%1 - ldq%A1 %0,%1 - stq%A0 %r1,%0 - fmov %R1,%0 - ldt %0,%1 - stt %R1,%0 - ftoit %1,%0 - itoft %1,%0" - [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")]) - -;; We do three major things here: handle mem->mem, put 64-bit constants in -;; memory, and construct long 32-bit constants. - -(define_expand "movdi" - [(set (match_operand:DI 0 "general_operand" "") - (match_operand:DI 1 "general_operand" ""))] - "" - " -{ - rtx tem; - - if (GET_CODE (operands[0]) == MEM - && ! reg_or_0_operand (operands[1], DImode)) - operands[1] = force_reg (DImode, operands[1]); - - if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode)) - ; - else if (GET_CODE (operands[1]) == CONST_INT - && (tem = alpha_emit_set_const (operands[0], DImode, - INTVAL (operands[1]), 3)) != 0) - { - if (rtx_equal_p (tem, operands[0])) - DONE; - else - operands[1] = tem; - } - else if (CONSTANT_P (operands[1])) - { - if (TARGET_BUILD_CONSTANTS) - { - HOST_WIDE_INT i0, i1; - - if (GET_CODE (operands[1]) == CONST_INT) - { - i0 = INTVAL (operands[1]); - i1 = -(i0 < 0); - } - else if (GET_CODE (operands[1]) == CONST_DOUBLE) - { -#if HOST_BITS_PER_WIDE_INT >= 64 - i0 = CONST_DOUBLE_LOW (operands[1]); - i1 = -(i0 < 0); -#else - i0 = CONST_DOUBLE_LOW (operands[1]); - i1 = CONST_DOUBLE_HIGH (operands[1]); -#endif - } - else - abort(); - - tem = alpha_emit_set_long_const (operands[0], i0, i1); - if (rtx_equal_p (tem, operands[0])) - DONE; - else - operands[1] = tem; - } - else - { - operands[1] = force_const_mem (DImode, operands[1]); - if (reload_in_progress) - { - emit_move_insn (operands[0], XEXP (operands[1], 0)); - operands[1] = copy_rtx (operands[1]); - XEXP (operands[1], 0) = operands[0]; - } - else - operands[1] = validize_mem (operands[1]); - } - } - else - abort (); -}") - -;; Split a load of a large constant into the appropriate two-insn -;; sequence. - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (match_operand:DI 1 "const_int_operand" ""))] - "! add_operand (operands[1], DImode)" - [(set (match_dup 0) (match_dup 2)) - (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))] - " -{ rtx tem - = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2); - - if (tem == operands[0]) - DONE; - else - FAIL; -}") - -;; These are the partial-word cases. -;; -;; First we have the code to load an aligned word. Operand 0 is the register -;; in which to place the result. It's mode is QImode or HImode. Operand 1 -;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the -;; number of bits within the word that the value is. Operand 3 is an SImode -;; scratch register. If operand 0 is a hard register, operand 3 may be the -;; same register. It is allowed to conflict with operand 1 as well. - -(define_expand "aligned_loadqi" - [(set (match_operand:SI 3 "register_operand" "") - (match_operand:SI 1 "memory_operand" "")) - (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0) - (zero_extract:DI (subreg:DI (match_dup 3) 0) - (const_int 8) - (match_operand:DI 2 "const_int_operand" "")))] - - "" - "") - -(define_expand "aligned_loadhi" - [(set (match_operand:SI 3 "register_operand" "") - (match_operand:SI 1 "memory_operand" "")) - (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0) - (zero_extract:DI (subreg:DI (match_dup 3) 0) - (const_int 16) - (match_operand:DI 2 "const_int_operand" "")))] - - "" - "") - -;; Similar for unaligned loads, where we use the sequence from the -;; Alpha Architecture manual. -;; -;; Operand 1 is the address. Operands 2 and 3 are temporaries, where -;; operand 3 can overlap the input and output registers. - -(define_expand "unaligned_loadqi" - [(set (match_operand:DI 2 "register_operand" "") - (mem:DI (and:DI (match_operand:DI 1 "address_operand" "") - (const_int -8)))) - (set (match_operand:DI 3 "register_operand" "") - (match_dup 1)) - (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0) - (zero_extract:DI (match_dup 2) - (const_int 8) - (ashift:DI (match_dup 3) (const_int 3))))] - "" - "") - -(define_expand "unaligned_loadhi" - [(set (match_operand:DI 2 "register_operand" "") - (mem:DI (and:DI (match_operand:DI 1 "address_operand" "") - (const_int -8)))) - (set (match_operand:DI 3 "register_operand" "") - (match_dup 1)) - (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0) - (zero_extract:DI (match_dup 2) - (const_int 16) - (ashift:DI (match_dup 3) (const_int 3))))] - "" - "") - -;; Storing an aligned byte or word requires two temporaries. Operand 0 is the -;; aligned SImode MEM. Operand 1 is the register containing the -;; byte or word to store. Operand 2 is the number of bits within the word that -;; the value should be placed. Operands 3 and 4 are SImode temporaries. - -(define_expand "aligned_store" - [(set (match_operand:SI 3 "register_operand" "") - (match_operand:SI 0 "memory_operand" "")) - (set (subreg:DI (match_dup 3) 0) - (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5))) - (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0) - (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" "")) - (match_operand:DI 2 "const_int_operand" ""))) - (set (subreg:DI (match_dup 4) 0) - (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0))) - (set (match_dup 0) (match_dup 4))] - "" - " -{ operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1])) - << INTVAL (operands[2]))); -}") - -;; For the unaligned byte and halfword cases, we use code similar to that -;; in the ;; Architecture book, but reordered to lower the number of registers -;; required. Operand 0 is the address. Operand 1 is the data to store. -;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may -;; be the same temporary, if desired. If the address is in a register, -;; operand 2 can be that register. - -(define_expand "unaligned_storeqi" - [(set (match_operand:DI 3 "register_operand" "") - (mem:DI (and:DI (match_operand:DI 0 "address_operand" "") - (const_int -8)))) - (set (match_operand:DI 2 "register_operand" "") - (match_dup 0)) - (set (match_dup 3) - (and:DI (not:DI (ashift:DI (const_int 255) - (ashift:DI (match_dup 2) (const_int 3)))) - (match_dup 3))) - (set (match_operand:DI 4 "register_operand" "") - (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "")) - (ashift:DI (match_dup 2) (const_int 3)))) - (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3))) - (set (mem:DI (and:DI (match_dup 0) (const_int -8))) - (match_dup 4))] - "" - "") - -(define_expand "unaligned_storehi" - [(set (match_operand:DI 3 "register_operand" "") - (mem:DI (and:DI (match_operand:DI 0 "address_operand" "") - (const_int -8)))) - (set (match_operand:DI 2 "register_operand" "") - (match_dup 0)) - (set (match_dup 3) - (and:DI (not:DI (ashift:DI (const_int 65535) - (ashift:DI (match_dup 2) (const_int 3)))) - (match_dup 3))) - (set (match_operand:DI 4 "register_operand" "") - (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "")) - (ashift:DI (match_dup 2) (const_int 3)))) - (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3))) - (set (mem:DI (and:DI (match_dup 0) (const_int -8))) - (match_dup 4))] - "" - "") - -;; Here are the define_expand's for QI and HI moves that use the above -;; patterns. We have the normal sets, plus the ones that need scratch -;; registers for reload. - -(define_expand "movqi" - [(set (match_operand:QI 0 "general_operand" "") - (match_operand:QI 1 "general_operand" ""))] - "" - " -{ - if (TARGET_BWX) - { - if (GET_CODE (operands[0]) == MEM - && ! reg_or_0_operand (operands[1], QImode)) - operands[1] = force_reg (QImode, operands[1]); - - if (GET_CODE (operands[1]) == CONST_INT - && ! input_operand (operands[1], QImode)) - { - operands[1] = alpha_emit_set_const (operands[0], QImode, - INTVAL (operands[1]), 3); - - if (rtx_equal_p (operands[0], operands[1])) - DONE; - } - - goto def; - } - - /* If the output is not a register, the input must be. */ - if (GET_CODE (operands[0]) == MEM) - operands[1] = force_reg (QImode, operands[1]); - - /* Handle four memory cases, unaligned and aligned for either the input - or the output. The only case where we can be called during reload is - for aligned loads; all other cases require temporaries. */ - - if (GET_CODE (operands[1]) == MEM - || (GET_CODE (operands[1]) == SUBREG - && GET_CODE (SUBREG_REG (operands[1])) == MEM) - || (reload_in_progress && GET_CODE (operands[1]) == REG - && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER) - || (reload_in_progress && GET_CODE (operands[1]) == SUBREG - && GET_CODE (SUBREG_REG (operands[1])) == REG - && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER)) - { - if (aligned_memory_operand (operands[1], QImode)) - { - if (reload_in_progress) - { - emit_insn (gen_reload_inqi_help - (operands[0], operands[1], - gen_rtx_REG (SImode, REGNO (operands[0])))); - } - else - { - rtx aligned_mem, bitnum; - rtx scratch = gen_reg_rtx (SImode); - - get_aligned_mem (operands[1], &aligned_mem, &bitnum); - - emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum, - scratch)); - } - } - else - { - /* Don't pass these as parameters since that makes the generated - code depend on parameter evaluation order which will cause - bootstrap failures. */ - - rtx temp1 = gen_reg_rtx (DImode); - rtx temp2 = gen_reg_rtx (DImode); - rtx seq - = gen_unaligned_loadqi (operands[0], - get_unaligned_address (operands[1], 0), - temp1, temp2); - - alpha_set_memflags (seq, operands[1]); - emit_insn (seq); - } - - DONE; - } - - else if (GET_CODE (operands[0]) == MEM - || (GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == MEM) - || (reload_in_progress && GET_CODE (operands[0]) == REG - && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER) - || (reload_in_progress && GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == REG - && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)) - { - if (aligned_memory_operand (operands[0], QImode)) - { - rtx aligned_mem, bitnum; - rtx temp1 = gen_reg_rtx (SImode); - rtx temp2 = gen_reg_rtx (SImode); - - get_aligned_mem (operands[0], &aligned_mem, &bitnum); - - emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum, - temp1, temp2)); - } - else - { - rtx temp1 = gen_reg_rtx (DImode); - rtx temp2 = gen_reg_rtx (DImode); - rtx temp3 = gen_reg_rtx (DImode); - rtx seq - = gen_unaligned_storeqi (get_unaligned_address (operands[0], 0), - operands[1], temp1, temp2, temp3); - - alpha_set_memflags (seq, operands[0]); - emit_insn (seq); - } - DONE; - } - def:; -}") - -(define_expand "movhi" - [(set (match_operand:HI 0 "general_operand" "") - (match_operand:HI 1 "general_operand" ""))] - "" - " -{ - if (TARGET_BWX) - { - if (GET_CODE (operands[0]) == MEM - && ! reg_or_0_operand (operands[1], HImode)) - operands[1] = force_reg (HImode, operands[1]); - - if (GET_CODE (operands[1]) == CONST_INT - && ! input_operand (operands[1], HImode)) - { - operands[1] = alpha_emit_set_const (operands[0], HImode, - INTVAL (operands[1]), 3); - - if (rtx_equal_p (operands[0], operands[1])) - DONE; - } - - goto def; - } - - /* If the output is not a register, the input must be. */ - if (GET_CODE (operands[0]) == MEM) - operands[1] = force_reg (HImode, operands[1]); - - /* Handle four memory cases, unaligned and aligned for either the input - or the output. The only case where we can be called during reload is - for aligned loads; all other cases require temporaries. */ - - if (GET_CODE (operands[1]) == MEM - || (GET_CODE (operands[1]) == SUBREG - && GET_CODE (SUBREG_REG (operands[1])) == MEM) - || (reload_in_progress && GET_CODE (operands[1]) == REG - && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER) - || (reload_in_progress && GET_CODE (operands[1]) == SUBREG - && GET_CODE (SUBREG_REG (operands[1])) == REG - && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER)) - { - if (aligned_memory_operand (operands[1], HImode)) - { - if (reload_in_progress) - { - emit_insn (gen_reload_inhi_help - (operands[0], operands[1], - gen_rtx_REG (SImode, REGNO (operands[0])))); - } - else - { - rtx aligned_mem, bitnum; - rtx scratch = gen_reg_rtx (SImode); - - get_aligned_mem (operands[1], &aligned_mem, &bitnum); - - emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum, - scratch)); - } - } - else - { - /* Don't pass these as parameters since that makes the generated - code depend on parameter evaluation order which will cause - bootstrap failures. */ - - rtx temp1 = gen_reg_rtx (DImode); - rtx temp2 = gen_reg_rtx (DImode); - rtx seq - = gen_unaligned_loadhi (operands[0], - get_unaligned_address (operands[1], 0), - temp1, temp2); - - alpha_set_memflags (seq, operands[1]); - emit_insn (seq); - } - - DONE; - } - - else if (GET_CODE (operands[0]) == MEM - || (GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == MEM) - || (reload_in_progress && GET_CODE (operands[0]) == REG - && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER) - || (reload_in_progress && GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == REG - && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)) - { - if (aligned_memory_operand (operands[0], HImode)) - { - rtx aligned_mem, bitnum; - rtx temp1 = gen_reg_rtx (SImode); - rtx temp2 = gen_reg_rtx (SImode); - - get_aligned_mem (operands[0], &aligned_mem, &bitnum); - - emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum, - temp1, temp2)); - } - else - { - rtx temp1 = gen_reg_rtx (DImode); - rtx temp2 = gen_reg_rtx (DImode); - rtx temp3 = gen_reg_rtx (DImode); - rtx seq - = gen_unaligned_storehi (get_unaligned_address (operands[0], 0), - operands[1], temp1, temp2, temp3); - - alpha_set_memflags (seq, operands[0]); - emit_insn (seq); - } - - DONE; - } - def:; -}") - -;; Here are the versions for reload. Note that in the unaligned cases -;; we know that the operand must not be a pseudo-register because stack -;; slots are always aligned references. - -(define_expand "reload_inqi" - [(parallel [(match_operand:QI 0 "register_operand" "=r") - (match_operand:QI 1 "any_memory_operand" "m") - (match_operand:TI 2 "register_operand" "=&r")])] - "! TARGET_BWX" - " -{ - rtx scratch, seq; - - if (GET_CODE (operands[1]) != MEM) - abort (); - - if (aligned_memory_operand (operands[1], QImode)) - { - seq = gen_reload_inqi_help (operands[0], operands[1], - gen_rtx_REG (SImode, REGNO (operands[2]))); - } - else - { - rtx addr; - - /* It is possible that one of the registers we got for operands[2] - might coincide with that of operands[0] (which is why we made - it TImode). Pick the other one to use as our scratch. */ - if (REGNO (operands[0]) == REGNO (operands[2])) - scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1); - else - scratch = gen_rtx_REG (DImode, REGNO (operands[2])); - - addr = get_unaligned_address (operands[1], 0); - seq = gen_unaligned_loadqi (operands[0], addr, scratch, - gen_rtx_REG (DImode, REGNO (operands[0]))); - alpha_set_memflags (seq, operands[1]); - } - emit_insn (seq); - DONE; -}") - -(define_expand "reload_inhi" - [(parallel [(match_operand:HI 0 "register_operand" "=r") - (match_operand:HI 1 "any_memory_operand" "m") - (match_operand:TI 2 "register_operand" "=&r")])] - "! TARGET_BWX" - " -{ - rtx scratch, seq; - - if (GET_CODE (operands[1]) != MEM) - abort (); - - if (aligned_memory_operand (operands[1], HImode)) - { - seq = gen_reload_inhi_help (operands[0], operands[1], - gen_rtx_REG (SImode, REGNO (operands[2]))); - } - else - { - rtx addr; - - /* It is possible that one of the registers we got for operands[2] - might coincide with that of operands[0] (which is why we made - it TImode). Pick the other one to use as our scratch. */ - if (REGNO (operands[0]) == REGNO (operands[2])) - scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1); - else - scratch = gen_rtx_REG (DImode, REGNO (operands[2])); - - addr = get_unaligned_address (operands[1], 0); - seq = gen_unaligned_loadhi (operands[0], addr, scratch, - gen_rtx_REG (DImode, REGNO (operands[0]))); - alpha_set_memflags (seq, operands[1]); - } - emit_insn (seq); - DONE; -}") - -(define_expand "reload_outqi" - [(parallel [(match_operand:QI 0 "any_memory_operand" "=m") - (match_operand:QI 1 "register_operand" "r") - (match_operand:TI 2 "register_operand" "=&r")])] - "! TARGET_BWX" - " -{ - if (GET_CODE (operands[0]) != MEM) - abort (); - - if (aligned_memory_operand (operands[0], QImode)) - { - emit_insn (gen_reload_outqi_help - (operands[0], operands[1], - gen_rtx_REG (SImode, REGNO (operands[2])), - gen_rtx_REG (SImode, REGNO (operands[2]) + 1))); - } - else - { - rtx addr = get_unaligned_address (operands[0], 0); - rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2])); - rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1); - rtx scratch3 = scratch1; - rtx seq; - - if (GET_CODE (addr) == REG) - scratch1 = addr; - - seq = gen_unaligned_storeqi (addr, operands[1], scratch1, - scratch2, scratch3); - alpha_set_memflags (seq, operands[0]); - emit_insn (seq); - } - DONE; -}") - -(define_expand "reload_outhi" - [(parallel [(match_operand:HI 0 "any_memory_operand" "=m") - (match_operand:HI 1 "register_operand" "r") - (match_operand:TI 2 "register_operand" "=&r")])] - "! TARGET_BWX" - " -{ - if (GET_CODE (operands[0]) != MEM) - abort (); - - if (aligned_memory_operand (operands[0], HImode)) - { - emit_insn (gen_reload_outhi_help - (operands[0], operands[1], - gen_rtx_REG (SImode, REGNO (operands[2])), - gen_rtx_REG (SImode, REGNO (operands[2]) + 1))); - } - else - { - rtx addr = get_unaligned_address (operands[0], 0); - rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2])); - rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1); - rtx scratch3 = scratch1; - rtx seq; - - if (GET_CODE (addr) == REG) - scratch1 = addr; - - seq = gen_unaligned_storehi (addr, operands[1], scratch1, - scratch2, scratch3); - alpha_set_memflags (seq, operands[0]); - emit_insn (seq); - } - DONE; -}") - -;; Helpers for the above. The way reload is structured, we can't -;; always get a proper address for a stack slot during reload_foo -;; expansion, so we must delay our address manipulations until after. - -(define_insn "reload_inqi_help" - [(set (match_operand:QI 0 "register_operand" "r") - (match_operand:QI 1 "memory_operand" "m")) - (clobber (match_operand:SI 2 "register_operand" "r"))] - "! TARGET_BWX && (reload_in_progress || reload_completed)" - "#") - -(define_insn "reload_inhi_help" - [(set (match_operand:HI 0 "register_operand" "r") - (match_operand:HI 1 "memory_operand" "m")) - (clobber (match_operand:SI 2 "register_operand" "r"))] - "! TARGET_BWX && (reload_in_progress || reload_completed)" - "#") - -(define_insn "reload_outqi_help" - [(set (match_operand:QI 0 "memory_operand" "m") - (match_operand:QI 1 "register_operand" "r")) - (clobber (match_operand:SI 2 "register_operand" "r")) - (clobber (match_operand:SI 3 "register_operand" "r"))] - "! TARGET_BWX && (reload_in_progress || reload_completed)" - "#") - -(define_insn "reload_outhi_help" - [(set (match_operand:HI 0 "memory_operand" "m") - (match_operand:HI 1 "register_operand" "r")) - (clobber (match_operand:SI 2 "register_operand" "r")) - (clobber (match_operand:SI 3 "register_operand" "r"))] - "! TARGET_BWX && (reload_in_progress || reload_completed)" - "#") - -(define_split - [(set (match_operand:QI 0 "register_operand" "r") - (match_operand:QI 1 "memory_operand" "m")) - (clobber (match_operand:SI 2 "register_operand" "r"))] - "! TARGET_BWX && reload_completed" - [(const_int 0)] - " -{ - rtx aligned_mem, bitnum; - get_aligned_mem (operands[1], &aligned_mem, &bitnum); - emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum, - operands[2])); - DONE; -}") - -(define_split - [(set (match_operand:HI 0 "register_operand" "r") - (match_operand:HI 1 "memory_operand" "m")) - (clobber (match_operand:SI 2 "register_operand" "r"))] - "! TARGET_BWX && reload_completed" - [(const_int 0)] - " -{ - rtx aligned_mem, bitnum; - get_aligned_mem (operands[1], &aligned_mem, &bitnum); - emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum, - operands[2])); - DONE; -}") - -(define_split - [(set (match_operand:QI 0 "memory_operand" "m") - (match_operand:QI 1 "register_operand" "r")) - (clobber (match_operand:SI 2 "register_operand" "r")) - (clobber (match_operand:SI 3 "register_operand" "r"))] - "! TARGET_BWX && reload_completed" - [(const_int 0)] - " -{ - rtx aligned_mem, bitnum; - get_aligned_mem (operands[0], &aligned_mem, &bitnum); - emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum, - operands[2], operands[3])); - DONE; -}") - -(define_split - [(set (match_operand:HI 0 "memory_operand" "m") - (match_operand:HI 1 "register_operand" "r")) - (clobber (match_operand:SI 2 "register_operand" "r")) - (clobber (match_operand:SI 3 "register_operand" "r"))] - "! TARGET_BWX && reload_completed" - [(const_int 0)] - " -{ - rtx aligned_mem, bitnum; - get_aligned_mem (operands[0], &aligned_mem, &bitnum); - emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum, - operands[2], operands[3])); - DONE; -}") - -;; Bit field extract patterns which use ext[wlq][lh] - -(define_expand "extv" - [(set (match_operand:DI 0 "register_operand" "") - (sign_extract:DI (match_operand:QI 1 "memory_operand" "") - (match_operand:DI 2 "immediate_operand" "") - (match_operand:DI 3 "immediate_operand" "")))] - "" - " -{ - /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */ - if (INTVAL (operands[3]) % 8 != 0 - || (INTVAL (operands[2]) != 16 - && INTVAL (operands[2]) != 32 - && INTVAL (operands[2]) != 64)) - FAIL; - - /* From mips.md: extract_bit_field doesn't verify that our source - matches the predicate, so we force it to be a MEM here. */ - if (GET_CODE (operands[1]) != MEM) - FAIL; - - alpha_expand_unaligned_load (operands[0], operands[1], - INTVAL (operands[2]) / 8, - INTVAL (operands[3]) / 8, 1); - DONE; -}") - -(define_expand "extzv" - [(set (match_operand:DI 0 "register_operand" "") - (zero_extract:DI (match_operand:DI 1 "general_operand" "") - (match_operand:DI 2 "immediate_operand" "") - (match_operand:DI 3 "immediate_operand" "")))] - "" - " -{ - /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */ - if (INTVAL (operands[3]) % 8 != 0 - || (INTVAL (operands[2]) != 8 - && INTVAL (operands[2]) != 16 - && INTVAL (operands[2]) != 32 - && INTVAL (operands[2]) != 64)) - FAIL; - - if (GET_CODE (operands[1]) == MEM) - { - /* Fail 8 bit fields, falling back on a simple byte load. */ - if (INTVAL (operands[2]) == 8) - FAIL; - - alpha_expand_unaligned_load (operands[0], operands[1], - INTVAL (operands[2]) / 8, - INTVAL (operands[3]) / 8, 0); - DONE; - } -}") - -(define_expand "insv" - [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "") - (match_operand:DI 1 "immediate_operand" "") - (match_operand:DI 2 "immediate_operand" "")) - (match_operand:DI 3 "register_operand" ""))] - "" - " -{ - /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */ - if (INTVAL (operands[2]) % 8 != 0 - || (INTVAL (operands[1]) != 16 - && INTVAL (operands[1]) != 32 - && INTVAL (operands[1]) != 64)) - FAIL; - - /* From mips.md: store_bit_field doesn't verify that our source - matches the predicate, so we force it to be a MEM here. */ - if (GET_CODE (operands[0]) != MEM) - FAIL; - - alpha_expand_unaligned_store (operands[0], operands[3], - INTVAL (operands[1]) / 8, - INTVAL (operands[2]) / 8); - DONE; -}") - - - -;; Block move/clear, see alpha.c for more details. -;; Argument 0 is the destination -;; Argument 1 is the source -;; Argument 2 is the length -;; Argument 3 is the alignment - -(define_expand "movstrqi" - [(parallel [(set (match_operand:BLK 0 "general_operand" "") - (match_operand:BLK 1 "general_operand" "")) - (use (match_operand:DI 2 "immediate_operand" "")) - (use (match_operand:DI 3 "immediate_operand" ""))])] - "" - " -{ - if (alpha_expand_block_move (operands)) - DONE; - else - FAIL; -}") - -(define_expand "clrstrqi" - [(parallel [(set (match_operand:BLK 0 "general_operand" "") - (const_int 0)) - (use (match_operand:DI 1 "immediate_operand" "")) - (use (match_operand:DI 2 "immediate_operand" ""))])] - "" - " -{ - if (alpha_expand_block_clear (operands)) - DONE; - else - FAIL; -}") - -;; Subroutine of stack space allocation. Perform a stack probe. -(define_expand "probe_stack" - [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))] - "" - " -{ - operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx, - INTVAL (operands[0]))); - MEM_VOLATILE_P (operands[1]) = 1; - - operands[0] = const0_rtx; -}") - -;; This is how we allocate stack space. If we are allocating a -;; constant amount of space and we know it is less than 4096 -;; bytes, we need do nothing. -;; -;; If it is more than 4096 bytes, we need to probe the stack -;; periodically. -(define_expand "allocate_stack" - [(set (reg:DI 30) - (plus:DI (reg:DI 30) - (match_operand:DI 1 "reg_or_cint_operand" ""))) - (set (match_operand:DI 0 "register_operand" "=r") - (match_dup 2))] - "" - " -{ - if (GET_CODE (operands[1]) == CONST_INT - && INTVAL (operands[1]) < 32768) - { - if (INTVAL (operands[1]) >= 4096) - { - /* We do this the same way as in the prologue and generate explicit - probes. Then we update the stack by the constant. */ - - int probed = 4096; - - emit_insn (gen_probe_stack (GEN_INT (- probed))); - while (probed + 8192 < INTVAL (operands[1])) - emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192)))); - - if (probed + 4096 < INTVAL (operands[1])) - emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1])))); - } - - operands[1] = GEN_INT (- INTVAL (operands[1])); - operands[2] = virtual_stack_dynamic_rtx; - } - else - { - rtx out_label = 0; - rtx loop_label = gen_label_rtx (); - rtx want = gen_reg_rtx (Pmode); - rtx tmp = gen_reg_rtx (Pmode); - rtx memref; - - emit_insn (gen_subdi3 (want, stack_pointer_rtx, - force_reg (Pmode, operands[1]))); - emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096))); - - if (GET_CODE (operands[1]) != CONST_INT) - { - out_label = gen_label_rtx (); - emit_insn (gen_cmpdi (want, tmp)); - emit_jump_insn (gen_bgeu (out_label)); - } - - emit_label (loop_label); - memref = gen_rtx_MEM (DImode, tmp); - MEM_VOLATILE_P (memref) = 1; - emit_move_insn (memref, const0_rtx); - emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192))); - emit_insn (gen_cmpdi (tmp, want)); - emit_jump_insn (gen_bgtu (loop_label)); - if (obey_regdecls) - gen_rtx_USE (VOIDmode, tmp); - - memref = gen_rtx_MEM (DImode, want); - MEM_VOLATILE_P (memref) = 1; - emit_move_insn (memref, const0_rtx); - - if (out_label) - emit_label (out_label); - - emit_move_insn (stack_pointer_rtx, want); - emit_move_insn (operands[0], virtual_stack_dynamic_rtx); - DONE; - } -}") - -;; This is used by alpha_expand_prolog to do the same thing as above, -;; except we cannot at that time generate new basic blocks, so we hide -;; the loop in this one insn. - -(define_insn "prologue_stack_probe_loop" - [(unspec_volatile [(match_operand 0 "register_operand" "r") - (match_operand 1 "register_operand" "r")] 5)] - "" - "* -{ - operands[2] = gen_label_rtx (); - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", - CODE_LABEL_NUMBER (operands[2])); - - return \"stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2\"; -}" - [(set_attr "length" "16") - (set_attr "type" "multi")]) - -(define_expand "prologue" - [(clobber (const_int 0))] - "" - "alpha_expand_prologue (); DONE;") - -(define_insn "init_fp" - [(set (match_operand:DI 0 "register_operand" "r") - (match_operand:DI 1 "register_operand" "r")) - (clobber (mem:BLK (match_operand:DI 2 "register_operand" "r")))] - "" - "mov %1,%0") - -(define_expand "epilogue" - [(clobber (const_int 0))] - "" - "alpha_expand_epilogue (); DONE;") - -(define_expand "eh_epilogue" - [(use (match_operand:DI 0 "register_operand" "r")) - (use (match_operand:DI 1 "register_operand" "r")) - (use (match_operand:DI 2 "register_operand" "r"))] - "! TARGET_OPEN_VMS" - " -{ - alpha_eh_epilogue_sp_ofs = operands[1]; - if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 26) - { - rtx ra = gen_rtx_REG (Pmode, 26); - emit_move_insn (ra, operands[2]); - operands[2] = ra; - } -}") - -;; In creating a large stack frame, NT _must_ use ldah+lda to load -;; the frame size into a register. We use this pattern to ensure -;; we get lda instead of addq. -(define_insn "nt_lda" - [(set (match_operand:DI 0 "register_operand" "r") - (unspec:DI [(match_dup 0) - (match_operand:DI 1 "const_int_operand" "n")] 6))] - "" - "lda %0,%1(%0)") - -(define_expand "builtin_longjmp" - [(unspec_volatile [(match_operand 0 "register_operand" "r")] 3)] - "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT" - " -{ - /* The elements of the buffer are, in order: */ - rtx fp = gen_rtx_MEM (Pmode, operands[0]); - rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)); - rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16)); - rtx pv = gen_rtx_REG (Pmode, 27); - - /* This bit is the same as expand_builtin_longjmp. */ - emit_move_insn (hard_frame_pointer_rtx, fp); - emit_move_insn (pv, lab); - emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX); - emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx)); - emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx)); - - /* Load the label we are jumping through into $27 so that we know - where to look for it when we get back to setjmp's function for - restoring the gp. */ - emit_indirect_jump (pv); - DONE; -}") - -(define_insn "builtin_setjmp_receiver" - [(unspec_volatile [(label_ref (match_operand 0 "" ""))] 2)] - "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT && TARGET_AS_CAN_SUBTRACT_LABELS" - "\\n$LSJ%=:\;ldgp $29,$LSJ%=-%l0($27)" - [(set_attr "length" "8") - (set_attr "type" "multi")]) - -(define_insn "" - [(unspec_volatile [(label_ref (match_operand 0 "" ""))] 2)] - "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT" - "br $29,$LSJ%=\\n$LSJ%=:\;ldgp $29,0($29)" - [(set_attr "length" "12") - (set_attr "type" "multi")]) - -(define_insn "exception_receiver" - [(unspec_volatile [(const_int 0)] 7)] - "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT" - "br $29,$LSJ%=\\n$LSJ%=:\;ldgp $29,0($29)" - [(set_attr "length" "12") - (set_attr "type" "multi")]) - -(define_expand "nonlocal_goto_receiver" - [(unspec_volatile [(const_int 0)] 1) - (set (reg:DI 27) (mem:DI (reg:DI 29))) - (unspec_volatile [(const_int 0)] 1) - (use (reg:DI 27))] - "TARGET_OPEN_VMS" - "") - -(define_insn "arg_home" - [(unspec [(const_int 0)] 0) - (use (reg:DI 1)) - (use (reg:DI 25)) - (use (reg:DI 16)) - (use (reg:DI 17)) - (use (reg:DI 18)) - (use (reg:DI 19)) - (use (reg:DI 20)) - (use (reg:DI 21)) - (use (reg:DI 48)) - (use (reg:DI 49)) - (use (reg:DI 50)) - (use (reg:DI 51)) - (use (reg:DI 52)) - (use (reg:DI 53)) - (clobber (mem:BLK (const_int 0))) - (clobber (reg:DI 24)) - (clobber (reg:DI 25)) - (clobber (reg:DI 0))] - "TARGET_OPEN_VMS" - "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS" - [(set_attr "length" "16") - (set_attr "type" "multi")]) - -;; Close the trap shadow of preceeding instructions. This is generated -;; by alpha_reorg. - -(define_insn "trapb" - [(unspec_volatile [(const_int 0)] 4)] - "" - "trapb" - [(set_attr "type" "misc")]) - -;; No-op instructions used by machine-dependant reorg to preserve -;; alignment for instruction issue. - -(define_insn "nop" - [(const_int 0)] - "" - "nop" - [(set_attr "type" "ilog")]) - -(define_insn "fnop" - [(const_int 1)] - "TARGET_FP" - "fnop" - [(set_attr "type" "fcpys")]) - -(define_insn "unop" - [(const_int 2)] - "" - "unop") - -(define_insn "realign" - [(unspec_volatile [(match_operand 0 "immediate_operand" "i")] 6)] - "" - ".align %0 #realign") - -;; Peepholes go at the end. - -;; Optimize sign-extension of SImode loads. This shows up in the wake of -;; reload when converting fp->int. -;; -;; ??? What to do now that we actually care about the packing and -;; alignment of instructions? Perhaps reload can be enlightened, or -;; the peephole pass moved up after reload but before sched2? -; -;(define_peephole -; [(set (match_operand:SI 0 "register_operand" "=r") -; (match_operand:SI 1 "memory_operand" "m")) -; (set (match_operand:DI 2 "register_operand" "=r") -; (sign_extend:DI (match_dup 0)))] -; "dead_or_set_p (insn, operands[0])" -; "ldl %2,%1") -; -;(define_peephole -; [(set (match_operand:SI 0 "register_operand" "=r") -; (match_operand:SI 1 "hard_fp_register_operand" "f")) -; (set (match_operand:DI 2 "register_operand" "=r") -; (sign_extend:DI (match_dup 0)))] -; "TARGET_FIX && dead_or_set_p (insn, operands[0])" -; "ftois %1,%2") diff --git a/contrib/gcc/config/alpha/alpha32.h b/contrib/gcc/config/alpha/alpha32.h deleted file mode 100644 index 3cbcfe1f4997..000000000000 --- a/contrib/gcc/config/alpha/alpha32.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha - running Windows/NT. - Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc. - - Derived from code - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - - Donn Terry, Softway Systems, Inc. - - This file contains the code-generation stuff common to the 32-bit - versions of the DEC/Compaq Alpha architecture. It is shared by - Interix and NT/Win32 ports. It should not contain compile-time - or run-time dependent environment values (such as compiler options - or anything containing a file or pathname.) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef TARGET_WINDOWS_NT -#define TARGET_WINDOWS_NT 1 - -/* WinNT (and thus Interix) use unsigned int */ -#define SIZE_TYPE "unsigned int" - -/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */ -#undef POINTER_SIZE -#define POINTER_SIZE 32 -#define POINTERS_EXTEND_UNSIGNED 0 - -/* We don't change Pmode to the "obvious" SI mode... the above appears - to affect the in-memory size; we want the registers to stay DImode - to match the md file */ - -/* "long" is 32 bits. */ -#undef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE 32 - - -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. - - The trampoline should set the static chain pointer to value placed - into the trampoline and should branch to the specified routine. */ - -#undef TRAMPOLINE_TEMPLATE -#define TRAMPOLINE_TEMPLATE(FILE) \ -{ \ - fprintf (FILE, "\tbr $27,$LTRAMPP\n"); \ - fprintf (FILE, "$LTRAMPP:\n\tldl $1,12($27)\n"); \ - fprintf (FILE, "\tldl $27,16($27)\n"); \ - fprintf (FILE, "\tjmp $31,($27),0\n"); \ - fprintf (FILE, "\t.long 0,0\n"); \ -} - -/* Length in units of the trampoline for entering a nested function. */ - -#undef TRAMPOLINE_SIZE -#define TRAMPOLINE_SIZE 24 - -/* Emit RTL insns to initialize the variable parts of a trampoline. - FNADDR is an RTX for the address of the function's pure code. - CXT is an RTX for the static chain value for the function. */ - -#undef INITIALIZE_TRAMPOLINE -#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ - alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 20, 16, 12) - -/* Output code to add DELTA to the first argument, and then jump to FUNCTION. - Used for C++ multiple inheritance. */ - -#undef ASM_OUTPUT_MI_THUNK -#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ -do { \ - char *op, *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \ - int reg; \ - \ - /* Mark end of prologue. */ \ - output_end_prologue (FILE); \ - \ - /* Rely on the assembler to macro expand a large delta. */ \ - reg = aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? 17 : 16; \ - fprintf (FILE, "\tlda $%d,%ld($%d)\n", reg, (long)(DELTA), reg); \ - \ - op = "jsr"; \ - if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0))) \ - op = "br"; \ - fprintf (FILE, "\t%s $31,", op); \ - assemble_name (FILE, fn_name); \ - fputc ('\n', FILE); \ -} while (0) diff --git a/contrib/gcc/config/alpha/crtbegin.asm b/contrib/gcc/config/alpha/crtbegin.asm deleted file mode 100644 index f954f1ab0d3e..000000000000 --- a/contrib/gcc/config/alpha/crtbegin.asm +++ /dev/null @@ -1,192 +0,0 @@ - # Copyright (C) 1996, 1998 Free Software Foundation, Inc. - # Contributed by Richard Henderson (rth@tamu.edu) - # - # This file 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. - # - # In addition to the permissions in the GNU General Public License, the - # Free Software Foundation gives you unlimited permission to link the - # compiled version of this file with other programs, and to distribute - # those programs without any restriction coming from the use of this - # file. (The General Public License restrictions do apply in other - # respects; for example, they cover modification of the file, and - # distribution when not linked into another program.) - # - # This file 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. - # - # You should have received a copy of the GNU General Public License - # along with this program; see the file COPYING. If not, write to - # the Free Software Foundation, 59 Temple Place - Suite 330, - # Boston, MA 02111-1307, USA. - # - # As a special exception, if you link this library with files - # compiled with GCC to produce an executable, this does not cause - # the resulting executable to be covered by the GNU General Public License. - # This exception does not however invalidate any other reasons why - # the executable file might be covered by the GNU General Public License. - - # - # Heads of the constructor/destructor lists. - # - - # The __*TOR_LIST__ symbols are not global because when this file is used - # in a shared library, we do not want the symbol to fall over to the - # application's lists. - -.section .ctors,"aw" - - .align 3 -__CTOR_LIST__: - .quad -1 - -.section .dtors,"aw" - - .align 3 -__DTOR_LIST__: - .quad -1 - -.section .eh_frame,"aw" -__EH_FRAME_BEGIN__: - - # - # Fragment of the ELF _fini routine that invokes our dtor cleanup. - # - -.section .fini,"ax" - - # Since the bits of the _fini function are spread across many - # object files, each potentially with its own GP, we must - # assume we need to load ours. Further, our .fini section - # can easily be more than 4MB away from our .text bits so we - # can't use bsr. - - br $29,1f -1: ldgp $29,0($29) - jsr $26,__do_global_dtors_aux - - # Ideally this call would go in crtend.o, except that we can't - # get hold of __EH_FRAME_BEGIN__ there. - - jsr $26,__do_frame_takedown - - # Must match the alignment we got from crti.o else we get - # zero-filled holes in our _fini function and then SIGILL. - .align 3 - - # - # Fragment of the ELF _init routine that sets up the frame info. - # - -.section .init,"ax" - br $29,1f -1: ldgp $29,0($29) - jsr $26,__do_frame_setup - .align 3 - - # - # Invoke our destructors in order. - # - -.data - - # Support recursive calls to exit. -$ptr: .quad __DTOR_LIST__ - -.text - - .align 3 - .ent __do_global_dtors_aux - -__do_global_dtors_aux: - lda $30,-16($30) - .frame $30,16,$26,0 - stq $9,8($30) - stq $26,0($30) - .mask 0x4000200,-16 - .prologue 0 - - lda $9,$ptr - br 1f -0: stq $1,0($9) - jsr $26,($27) -1: ldq $1,0($9) - ldq $27,8($1) - addq $1,8,$1 - bne $27,0b - - ldq $26,0($30) - ldq $9,8($30) - lda $30,16($30) - ret - - .end __do_global_dtors_aux - - # - # Install our frame info. - # - - # ??? How can we rationally keep this size correct? - -.section .bss - .type $object,@object - .align 3 -$object: - .zero 48 - .size $object, 48 - -.text - - .align 3 - .ent __do_frame_setup - -__do_frame_setup: - ldgp $29,0($27) - lda $30,-16($30) - .frame $30,16,$26,0 - stq $26,0($30) - .mask 0x4000000,-16 - .prologue 1 - - lda $1,__register_frame_info - beq $1,0f - lda $16,__EH_FRAME_BEGIN__ - lda $17,$object - jsr $26,__register_frame_info - ldq $26,0($30) -0: lda $30,16($30) - ret - - .end __do_frame_setup - - # - # Remove our frame info. - # - - .align 3 - .ent __do_frame_takedown - -__do_frame_takedown: - ldgp $29,0($27) - lda $30,-16($30) - .frame $30,16,$26,0 - stq $26,0($30) - .mask 0x4000000,-16 - .prologue 1 - - lda $1,__deregister_frame_info - beq $1,0f - lda $16,__EH_FRAME_BEGIN__ - jsr $26,__deregister_frame_info - ldq $26,0($30) -0: lda $30,16($30) - ret - - .end __do_frame_takedown - -.weak __register_frame_info -.weak __deregister_frame_info diff --git a/contrib/gcc/config/alpha/crtend.asm b/contrib/gcc/config/alpha/crtend.asm deleted file mode 100644 index 4a0cc5e9f612..000000000000 --- a/contrib/gcc/config/alpha/crtend.asm +++ /dev/null @@ -1,108 +0,0 @@ - # Copyright (C) 1996 Free Software Foundation, Inc. - # Contributed by Richard Henderson (rth@tamu.edu) - # - # This file 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. - # - # In addition to the permissions in the GNU General Public License, the - # Free Software Foundation gives you unlimited permission to link the - # compiled version of this file with other programs, and to distribute - # those programs without any restriction coming from the use of this - # file. (The General Public License restrictions do apply in other - # respects; for example, they cover modification of the file, and - # distribution when not linked into another program.) - # - # This file 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. - # - # You should have received a copy of the GNU General Public License - # along with this program; see the file COPYING. If not, write to - # the Free Software Foundation, 59 Temple Place - Suite 330, - # Boston, MA 02111-1307, USA. - # - # As a special exception, if you link this library with files - # compiled with GCC to produce an executable, this does not cause - # the resulting executable to be covered by the GNU General Public License. - # This exception does not however invalidate any other reasons why - # the executable file might be covered by the GNU General Public License. - - # - # Tails of the constructor/destructor lists. - # - - # The __*TOR_END__ symbols are not global because when this file is used - # in a shared library, we do not want the symbol to fall over to the - # application's lists. - -.section .ctors,"aw" - - .align 3 -__CTOR_END__: - .quad 0 - -.section .dtors,"aw" - - .align 3 -__DTOR_END__: - .quad 0 - -.section .eh_frame,"aw" -__FRAME_END__: - .quad 0 - - # - # Fragment of the ELF _init routine that invokes our ctor startup - # - -.section .init,"ax" - - # Since the bits of the _init function are spread across many - # object files, each potentially with its own GP, we must - # assume we need to load ours. Further, our .init section - # can easily be more than 4MB away from our .text bits so we - # can't use bsr. - - br $29,1f -1: ldgp $29,0($29) - jsr $26,__do_global_ctors_aux - - # Must match the alignment we got from crti.o else we get - # zero-filled holes in our _init function and thense SIGILL. - .align 3 - - # - # Invoke our destructors in order. - # - -.text - - .align 3 - .ent __do_global_ctors_aux - -__do_global_ctors_aux: - ldgp $29,0($27) - lda $30,-16($30) - .frame $30,16,$26,0 - stq $9,8($30) - stq $26,0($30) - .mask 0x4000200,-16 - .prologue 1 - - lda $9,__CTOR_END__ - br 1f -0: jsr $26,($27) -1: ldq $27,-8($9) - subq $9,8,$9 - not $27,$0 - bne $0,0b - - ldq $26,0($30) - ldq $9,8($30) - lda $30,16($30) - ret - - .end __do_global_ctors_aux diff --git a/contrib/gcc/config/alpha/elf.h b/contrib/gcc/config/alpha/elf.h deleted file mode 100644 index 6cea3da5d5b4..000000000000 --- a/contrib/gcc/config/alpha/elf.h +++ /dev/null @@ -1,534 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF. - Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - Contributed by Richard Henderson (rth@tamu.edu). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef OBJECT_FORMAT_COFF -#undef EXTENDED_COFF -#define OBJECT_FORMAT_ELF - -#define DBX_DEBUGGING_INFO -#define DWARF2_DEBUGGING_INFO - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#undef ASM_FINAL_SPEC - -#undef CC1_SPEC -#define CC1_SPEC "%{G*}" - -#undef ASM_SPEC -#define ASM_SPEC "%{G*} %{relax:-relax} %{gdwarf*:-no-mdebug}" - -#undef LINK_SPEC -#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ - %{O*:-O3} %{!O*:-O1} \ - %{shared:-shared} \ - %{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker %(elf_dynamic_linker)}} \ - %{static:-static}}" - -/* Output at beginning of assembler file. */ -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ -do { \ - if (write_symbols != DWARF2_DEBUG) \ - { \ - alpha_write_verstamp (FILE); \ - output_file_directive (FILE, main_input_filename); \ - } \ - fprintf (FILE, "\t.set noat\n"); \ - fprintf (FILE, "\t.set noreorder\n"); \ - if (TARGET_BWX | TARGET_MAX | TARGET_FIX | TARGET_CIX) \ - { \ - fprintf (FILE, "\t.arch %s\n", \ - (alpha_cpu == PROCESSOR_EV6 ? "ev6" \ - : TARGET_MAX ? "pca56" : "ev56")); \ - } \ -} while (0) - -extern void output_file_directive (); - -/* Attach a special .ident directive to the end of the file to identify - the version of GCC which compiled this code. The format of the - .ident string is patterned after the ones produced by native svr4 - C compilers. */ - -#define IDENT_ASM_OP ".ident" - -#ifdef IDENTIFY_WITH_IDENT -#define ASM_IDENTIFY_GCC(FILE) /* nothing */ -#define ASM_IDENTIFY_LANGUAGE(FILE) \ - fprintf(FILE, "\t%s \"GCC (%s) %s\"\n", IDENT_ASM_OP, \ - lang_identify(), version_string) -#else -#define ASM_FILE_END(FILE) \ -do { \ - if (!flag_no_ident) \ - fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \ - IDENT_ASM_OP, version_string); \ - } while (0) -#endif - -/* Allow #sccs in preprocessor. */ -#define SCCS_DIRECTIVE - -/* Output #ident as a .ident. */ -#define ASM_OUTPUT_IDENT(FILE, NAME) \ - fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); - -/* This is how to allocate empty space in some section. The .zero - pseudo-op is used for this on most svr4 assemblers. */ - -#define SKIP_ASM_OP ".zero" - -#undef ASM_OUTPUT_SKIP -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE)) - -/* Output the label which precedes a jumptable. Note that for all svr4 - systems where we actually generate jumptables (which is to say every - svr4 target except i386, where we use casesi instead) we put the jump- - tables into the .rodata section and since other stuff could have been - put into the .rodata section prior to any given jumptable, we have to - make sure that the location counter for the .rodata section gets pro- - perly re-aligned prior to the actual beginning of the jump table. */ - -#define ALIGN_ASM_OP ".align" - -#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL -#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ - ASM_OUTPUT_ALIGN ((FILE), 2); -#endif - -#undef ASM_OUTPUT_CASE_LABEL -#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ - do { \ - ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \ - } while (0) - -/* The standard SVR4 assembler seems to require that certain builtin - library routines (e.g. .udiv) be explicitly declared as .globl - in each assembly file where they are referenced. */ - -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ - ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) - -/* This says how to output assembler code to declare an - uninitialized external linkage data object. Under SVR4, - the linker seems to want the alignment of data objects - to depend on their types. We do exactly that here. */ - -#define COMMON_ASM_OP ".comm" - -#undef ASM_OUTPUT_ALIGNED_COMMON -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ -} while (0) - -/* This says how to output assembler code to declare an - uninitialized internal linkage data object. Under SVR4, - the linker seems to want the alignment of data objects - to depend on their types. We do exactly that here. */ - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - if ((SIZE) <= g_switch_value) \ - sbss_section(); \ - else \ - bss_section(); \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', FILE); \ - if (!flag_inhibit_size_directive) \ - { \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", (SIZE)); \ - } \ - ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - ASM_OUTPUT_SKIP((FILE), (SIZE)); \ -} while (0) - -/* This is the pseudo-op used to generate a 64-bit word of data with a - specific value in some section. */ - -#define INT_ASM_OP ".quad" - -/* Biggest alignment supported by the object file format of this - machine. Use this macro to limit the alignment which can be - specified using the `__attribute__ ((aligned (N)))' construct. If - not defined, the default value is `BIGGEST_ALIGNMENT'. - - This value is really 2^63. Since gcc figures the alignment in bits, - we could only potentially get to 2^60 on suitible hosts. Due to other - considerations in varasm, we must restrict this to what fits in an int. */ - -#define MAX_OFILE_ALIGNMENT \ - (1 << (HOST_BITS_PER_INT < 64 ? HOST_BITS_PER_INT - 2 : 62)) - -/* This is the pseudo-op used to generate a contiguous sequence of byte - values from a double-quoted string WITHOUT HAVING A TERMINATING NUL - AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ - -#undef ASCII_DATA_ASM_OP -#define ASCII_DATA_ASM_OP ".ascii" - -/* Support const sections and the ctors and dtors sections for g++. - Note that there appears to be two different ways to support const - sections at the moment. You can either #define the symbol - READONLY_DATA_SECTION (giving it some code which switches to the - readonly data section) or else you can #define the symbols - EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and - SELECT_RTX_SECTION. We do both here just to be on the safe side. */ - -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP ".section\t.rodata" - -/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. - - Note that we want to give these sections the SHF_WRITE attribute - because these sections will actually contain data (i.e. tables of - addresses of functions in the current root executable or shared library - file) and, in the case of a shared library, the relocatable addresses - will have to be properly resolved/relocated (and then written into) by - the dynamic linker when it actually attaches the given shared library - to the executing process. (Note that on SVR4, you may wish to use the - `-z text' option to the ELF linker, when building a shared library, as - an additional check that you are doing everything right. But if you do - use the `-z text' option when building a shared library, you will get - errors unless the .ctors and .dtors sections are marked as writable - via the SHF_WRITE attribute.) */ - -#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\"" -#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\"" - -/* Handle the small data sections. */ -#define BSS_SECTION_ASM_OP ".section\t.bss" -#define SBSS_SECTION_ASM_OP ".section\t.sbss,\"aw\"" -#define SDATA_SECTION_ASM_OP ".section\t.sdata,\"aw\"" - -/* On svr4, we *do* have support for the .init and .fini sections, and we - can put stuff in there to be executed before and after `main'. We let - crtstuff.c and other files know this by defining the following symbols. - The definitions say how to change sections to the .init and .fini - sections. This is the same for all known svr4 assemblers. */ - -#define INIT_SECTION_ASM_OP ".section\t.init" -#define FINI_SECTION_ASM_OP ".section\t.fini" - -/* A default list of other sections which we might be "in" at any given - time. For targets that use additional sections (e.g. .tdesc) you - should override this definition in the target-specific file which - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_sbss, in_sdata - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - SECTION_FUNCTION_TEMPLATE(ctors_section, in_ctors, CTORS_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(dtors_section, in_dtors, DTORS_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) - -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION() const_section () - -extern void text_section (); - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - -#define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \ -void FN () \ -{ \ - if (in_section != ENUM) \ - { \ - fprintf (asm_out_file, "%s\n", OP); \ - in_section = ENUM; \ - } \ -} - - -/* Switch into a generic section. - This is currently only used to support section attributes. - - We make the section read-only and executable for a function decl, - read-only for a const data decl, and writable for a non-const data decl. */ -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ - fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \ - (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \ - (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw") - - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement or statements to switch to the appropriate - section for output of DECL. DECL is either a `VAR_DECL' node - or a constant of some sort. RELOC indicates whether forming - the initial value of DECL requires link-time relocations. */ - -#define SELECT_SECTION(DECL,RELOC) \ -{ \ - if (TREE_CODE (DECL) == STRING_CST) \ - { \ - if (! flag_writable_strings) \ - const_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (DECL) == VAR_DECL) \ - { \ - if ((flag_pic && RELOC) \ - || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ - || !DECL_INITIAL (DECL) \ - || (DECL_INITIAL (DECL) != error_mark_node \ - && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ - { \ - int size = int_size_in_bytes (TREE_TYPE (DECL)); \ - if (size >= 0 && size <= g_switch_value) \ - sdata_section (); \ - else \ - data_section (); \ - } \ - else \ - const_section (); \ - } \ - else \ - const_section (); \ -} - -/* A C statement or statements to switch to the appropriate - section for output of RTX in mode MODE. RTX is some kind - of constant in RTL. The argument MODE is redundant except - in the case of a `const_int' rtx. Currently, these always - go into the const section. */ - -#undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX) const_section() - -/* Define the strings used for the special svr4 .type and .size directives. - These strings generally do not vary from one system running svr4 to - another, but if a given system (e.g. m88k running svr) needs to use - different pseudo-op names for these, they may be overridden in the - file which includes this one. */ - -#define TYPE_ASM_OP ".type" -#define SIZE_ASM_OP ".size" - -/* This is how we tell the assembler that a symbol is weak. */ - -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -/* This is how we tell the assembler that two symbols have the same value. */ - -#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \ - do { assemble_name(FILE, NAME1); \ - fputs(" = ", FILE); \ - assemble_name(FILE, NAME2); \ - fputc('\n', FILE); } while (0) - -/* The following macro defines the format used to output the second - operand of the .type assembler directive. Different svr4 assemblers - expect various different forms for this operand. The one given here - is just a default. You may need to override it in your machine- - specific tm.h file (depending upon the particulars of your assembler). */ - -#define TYPE_OPERAND_FMT "@%s" - -/* Write the extra assembler code needed to declare a function's result. - Most svr4 assemblers don't require any special declaration of the - result value, but there are exceptions. */ - -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -/* These macros generate the special .type and .size directives which - are used to set the corresponding fields of the linker symbol table - entries in an ELF object file under SVR4. These macros also output - the starting labels for the relevant functions/objects. */ - -/* Write the extra assembler code needed to declare an object properly. */ - -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', FILE); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Output the size directive for a decl in rest_of_decl_compilation - in the case where we did not do so before the initializer. - Once we find the error_mark_node, we know that the value of - size_directive_output was set - by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ - -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - putc (',', FILE); \ - fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \ - int_size_in_bytes (TREE_TYPE (DECL))); \ - putc ('\n', FILE); \ - } \ -} while (0) - -/* A table of bytes codes used by the ASM_OUTPUT_ASCII and - ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table - corresponds to a particular byte value [0..255]. For any - given byte value, if the value in the corresponding table - position is zero, the given character can be output directly. - If the table value is 1, the byte must be output as a \ooo - octal escape. If the tables value is anything else, then the - byte value should be output as a \ followed by the value - in the table. Note that we can use standard UN*X escape - sequences for many control characters, but we don't use - \a to represent BEL because some svr4 assemblers (e.g. on - the i386) don't know about that. Also, we don't use \v - since some versions of gas, such as 2.2 did not accept it. */ - -#define ESCAPES \ -"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" - -/* Some svr4 assemblers have a limit on the number of characters which - can appear in the operand of a .string directive. If your assembler - has such a limitation, you should define STRING_LIMIT to reflect that - limit. Note that at least some svr4 assemblers have a limit on the - actual number of bytes in the double-quoted string, and that they - count each character in an escape sequence as one byte. Thus, an - escape sequence like \377 would count as four bytes. - - If your target assembler doesn't support the .string directive, you - should define this to zero. */ - -#define STRING_LIMIT ((unsigned) 256) -#define STRING_ASM_OP ".string" - -/* GAS is the only Alpha/ELF assembler. */ -#undef TARGET_GAS -#define TARGET_GAS (1) - -/* Provide a STARTFILE_SPEC appropriate for ELF. Here we add the - (even more) magical crtbegin.o file which provides part of the - support for getting C++ file-scope static object constructed before - entering `main'. - - Don't bother seeing crtstuff.c -- there is absolutely no hope of - getting that file to understand multiple GPs. GNU Libc provides a - hand-coded version that is used on Linux; it could be copied here - if there is ever a need. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ - crti.o%s crtbegin.o%s" - -/* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the - magical crtend.o file which provides part of the support for - getting C++ file-scope static object constructed before entering - `main', followed by a normal ELF "finalizer" file, `crtn.o'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "crtend.o%s crtn.o%s" - -/* We support #pragma. */ -#define HANDLE_SYSV_PRAGMA - -/* Undo the auto-alignment stuff from alpha.h. ELF has unaligned data - pseudos natively. */ -#undef UNALIGNED_SHORT_ASM_OP -#undef UNALIGNED_INT_ASM_OP -#undef UNALIGNED_DOUBLE_INT_ASM_OP diff --git a/contrib/gcc/config/alpha/freebsd.h b/contrib/gcc/config/alpha/freebsd.h deleted file mode 100644 index 24567a6d065c..000000000000 --- a/contrib/gcc/config/alpha/freebsd.h +++ /dev/null @@ -1,103 +0,0 @@ -/* XXX */ -/* - * This file was derived from source obtained from NetBSD/Alpha which - * is publicly available for ftp. The patch was developed by cgd@netbsd.org - * during the time he worked at CMU. He claims that CMU own this patch - * to gcc and that they have not (and will not) release the patch for - * incorporation in FSF sources. We are supposedly able to use the patch, - * but we are not allowed to forward it back to FSF for inclusion in - * their source releases. - * - * This all has me (jb@freebsd.org) confused because (a) I see no copyright - * messages that tell me that use is restricted; and (b) I expected that - * the patch was originally developed from other files which are subject - * to GPL. - * - * Use of this file is restricted until its CMU ownership is tested. - */ - -#include "alpha/alpha.h" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 - -/* FreeBSD-specific things: */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__FreeBSD__ -D__alpha__ -D__alpha" - -/* Look for the include files in the system-defined places. */ - -#undef GPLUSPLUS_INCLUDE_DIR -#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" - -#undef GCC_INCLUDE_DIR -#define GCC_INCLUDE_DIR "/usr/include" - -#undef INCLUDE_DEFAULTS -#define INCLUDE_DEFAULTS \ - { \ - { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \ - { GCC_INCLUDE_DIR, 0, 0 }, \ - { 0, 0, 0 } \ - } - - -/* Under FreeBSD, the normal location of the `ld' and `as' programs is the - /usr/bin directory. */ - -#undef MD_EXEC_PREFIX -#define MD_EXEC_PREFIX "/usr/bin/" - -/* Under FreeBSD, the normal location of the various *crt*.o files is the - /usr/lib directory. */ - -#undef MD_STARTFILE_PREFIX -#define MD_STARTFILE_PREFIX "/usr/lib/" - - -/* Provide a CPP_SPEC appropriate for FreeBSD. Current we just deal with - the GCC option `-posix'. */ - -#undef CPP_SPEC -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}" - -/* Provide an ASM_SPEC appropriate for FreeBSD. */ - -#undef ASM_SPEC -#define ASM_SPEC " %|" - -#undef ASM_FINAL_SPEC - -/* Provide a LIB_SPEC appropriate for FreeBSD. Just select the appropriate - libc, depending on whether we're doing profiling. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{!shared:%{!pg:%{!pthread:-lc}%{pthread:-lpthread -lc}}%{pg:%{!pthread:-lc_p}%{pthread:-lpthread_p -lc_p}}}" - -/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support - for the special GCC options -static, -assert, and -nostdlib. */ - -#undef LINK_SPEC -#define LINK_SPEC \ - "%{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{static:-Bstatic} %{assert*}" - -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. Under FreeBSD/Alpha, the assembler does - nothing special with -pg. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ - fputs ("\tjsr $28,_mcount\n", (FILE)); /* at */ - -/* Show that we need a GP when profiling. */ -#define TARGET_PROFILING_NEEDS_GP - -#define bsd4_4 -#undef HAS_INIT_SECTION - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG diff --git a/contrib/gcc/config/alpha/gdb-osf12.h b/contrib/gcc/config/alpha/gdb-osf12.h deleted file mode 100644 index 98c289714017..000000000000 --- a/contrib/gcc/config/alpha/gdb-osf12.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha, using - encapsulated stabs and OSF V1.2. - Copyright (C) 1994 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "alpha/osf12.h" - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG diff --git a/contrib/gcc/config/alpha/gdb-osf2.h b/contrib/gcc/config/alpha/gdb-osf2.h deleted file mode 100644 index 5ddb7981b34d..000000000000 --- a/contrib/gcc/config/alpha/gdb-osf2.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha, using - encapsulated stabs. - Copyright (C) 1992, 1993 Free Software Foundation, Inc. - Contributed by Peter Schauer (pes@regent.e-technik.tu-muenchen.de). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "alpha/osf2.h" - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG diff --git a/contrib/gcc/config/alpha/gdb.h b/contrib/gcc/config/alpha/gdb.h deleted file mode 100644 index ecdbe40a9a45..000000000000 --- a/contrib/gcc/config/alpha/gdb.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha, using - encapsulated stabs. - Copyright (C) 1992, 1993 Free Software Foundation, Inc. - Contributed by Peter Schauer (pes@regent.e-technik.tu-muenchen.de). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "alpha/alpha.h" - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG diff --git a/contrib/gcc/config/alpha/lib1funcs.asm b/contrib/gcc/config/alpha/lib1funcs.asm deleted file mode 100644 index e63180ade916..000000000000 --- a/contrib/gcc/config/alpha/lib1funcs.asm +++ /dev/null @@ -1,325 +0,0 @@ -/* DEC Alpha division and remainder support. - Copyright (C) 1994, 1999 Free Software Foundation, Inc. - -This file 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. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file with other programs, and to distribute -those programs without any restriction coming from the use of this -file. (The General Public License restrictions do apply in other -respects; for example, they cover modification of the file, and -distribution when not linked into another program.) - -This file 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. - -You should have received a copy of the GNU General Public License -along with this program; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* As a special exception, if you link this library with other files, - some of which are compiled with GCC, to produce an executable, - this library does not by itself cause the resulting executable - to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -/* This had to be written in assembler because the division functions - use a non-standard calling convention. - - This file provides an implementation of __divqu, __divq, __divlu, - __divl, __remqu, __remq, __remlu and __reml. CPP macros control - the exact operation. - - Operation performed: $27 := $24 o $25, clobber $28, return address to - caller in $23, where o one of the operations. - - The following macros need to be defined: - - SIZE, the number of bits, 32 or 64. - - TYPE, either UNSIGNED or SIGNED - - OPERATION, either DIVISION or REMAINDER - - SPECIAL_CALLING_CONVENTION, 0 or 1. It is useful for debugging to - define this to 0. That removes the `__' prefix to make the function - name not collide with the existing libc.a names, and uses the - standard Alpha procedure calling convention. -*/ - -#ifndef SPECIAL_CALLING_CONVENTION -#define SPECIAL_CALLING_CONVENTION 1 -#endif - -#ifdef L_divl -#if SPECIAL_CALLING_CONVENTION -#define FUNCTION_NAME __divl -#else -#define FUNCTION_NAME divl -#endif -#define SIZE 32 -#define TYPE SIGNED -#define OPERATION DIVISION -#endif - -#ifdef L_divlu -#if SPECIAL_CALLING_CONVENTION -#define FUNCTION_NAME __divlu -#else -#define FUNCTION_NAME divlu -#endif -#define SIZE 32 -#define TYPE UNSIGNED -#define OPERATION DIVISION -#endif - -#ifdef L_divq -#if SPECIAL_CALLING_CONVENTION -#define FUNCTION_NAME __divq -#else -#define FUNCTION_NAME divq -#endif -#define SIZE 64 -#define TYPE SIGNED -#define OPERATION DIVISION -#endif - -#ifdef L_divqu -#if SPECIAL_CALLING_CONVENTION -#define FUNCTION_NAME __divqu -#else -#define FUNCTION_NAME divqu -#endif -#define SIZE 64 -#define TYPE UNSIGNED -#define OPERATION DIVISION -#endif - -#ifdef L_reml -#if SPECIAL_CALLING_CONVENTION -#define FUNCTION_NAME __reml -#else -#define FUNCTION_NAME reml -#endif -#define SIZE 32 -#define TYPE SIGNED -#define OPERATION REMAINDER -#endif - -#ifdef L_remlu -#if SPECIAL_CALLING_CONVENTION -#define FUNCTION_NAME __remlu -#else -#define FUNCTION_NAME remlu -#endif -#define SIZE 32 -#define TYPE UNSIGNED -#define OPERATION REMAINDER -#endif - -#ifdef L_remq -#if SPECIAL_CALLING_CONVENTION -#define FUNCTION_NAME __remq -#else -#define FUNCTION_NAME remq -#endif -#define SIZE 64 -#define TYPE SIGNED -#define OPERATION REMAINDER -#endif - -#ifdef L_remqu -#if SPECIAL_CALLING_CONVENTION -#define FUNCTION_NAME __remqu -#else -#define FUNCTION_NAME remqu -#endif -#define SIZE 64 -#define TYPE UNSIGNED -#define OPERATION REMAINDER -#endif - -#define tmp0 $3 -#define tmp1 $28 -#define cnt $1 -#define result_sign $2 - -#if SPECIAL_CALLING_CONVENTION -#define N $24 -#define D $25 -#define Q RETREG -#define RETREG $27 -#else -#define N $16 -#define D $17 -#define Q RETREG -#define RETREG $0 -#endif - -/* Misc symbols to make alpha assembler easier to read. */ -#define zero $31 -#define sp $30 - -/* Symbols to make interface nicer. */ -#define UNSIGNED 0 -#define SIGNED 1 -#define DIVISION 0 -#define REMAINDER 1 - - .set noreorder - .set noat -.text - .align 3 - .globl FUNCTION_NAME - .ent FUNCTION_NAME -FUNCTION_NAME: - - .frame $30,0,$26,0 - .prologue 0 - -/* Under the special calling convention, we have to preserve all register - values but $23 and $28. */ -#if SPECIAL_CALLING_CONVENTION - lda sp,-64(sp) -#if OPERATION == DIVISION - stq N,0(sp) -#endif - stq D,8(sp) - stq cnt,16(sp) - stq result_sign,24(sp) - stq tmp0,32(sp) -#endif - -/* If we are computing the remainder, move N to the register that is used - for the return value, and redefine what register is used for N. */ -#if OPERATION == REMAINDER - bis N,N,RETREG -#undef N -#define N RETREG -#endif - -/* Perform conversion from 32 bit types to 64 bit types. */ -#if SIZE == 32 -#if TYPE == SIGNED - /* If there are problems with the signed case, add these instructions. - The caller should already have done this. - addl N,0,N # sign extend N - addl D,0,D # sign extend D - */ -#else /* UNSIGNED */ - zap N,0xf0,N # zero extend N (caller required to sign extend) - zap D,0xf0,D # zero extend D -#endif -#endif - -/* Check for divide by zero. */ - bne D,$34 - lda $16,-2(zero) - call_pal 0xaa -$34: - -#if TYPE == SIGNED -#if OPERATION == DIVISION - xor N,D,result_sign -#else - bis N,N,result_sign -#endif -/* Get the absolute values of N and D. */ - subq zero,N,tmp0 - cmovlt N,tmp0,N - subq zero,D,tmp0 - cmovlt D,tmp0,D -#endif - -/* Compute CNT = ceil(log2(N)) - ceil(log2(D)). This is the number of - divide iterations we will have to perform. Should you wish to optimize - this, check a few bits at a time, preferably using zap/zapnot. Be - careful though, this code runs fast fro the most common cases, when the - quotient is small. */ - bge N,$35 - bis zero,1,cnt - blt D,$40 - .align 3 -$39: addq D,D,D - addl cnt,1,cnt - bge D,$39 - br zero,$40 -$35: cmpult N,D,tmp0 - bis zero,zero,cnt - bne tmp0,$42 - .align 3 -$44: addq D,D,D - cmpult N,D,tmp0 - addl cnt,1,cnt - beq tmp0,$44 -$42: srl D,1,D -$40: - subl cnt,1,cnt - - -/* Actual divide. Could be optimized with unrolling. */ -#if OPERATION == DIVISION - bis zero,zero,Q -#endif - blt cnt,$46 - .align 3 -$49: cmpule D,N,tmp1 - subq N,D,tmp0 - srl D,1,D - subl cnt,1,cnt - cmovne tmp1,tmp0,N -#if OPERATION == DIVISION - addq Q,Q,Q - bis Q,tmp1,Q -#endif - bge cnt,$49 -$46: - - -/* The result is now in RETREG. NOTE! It was written to RETREG using - either N or Q as a synonym! */ - - -/* Change the sign of the result as needed. */ -#if TYPE == SIGNED - subq zero,RETREG,tmp0 - cmovlt result_sign,tmp0,RETREG -#endif - - -/* Restore clobbered registers. */ -#if SPECIAL_CALLING_CONVENTION -#if OPERATION == DIVISION - ldq N,0(sp) -#endif - ldq D,8(sp) - ldq cnt,16(sp) - ldq result_sign,24(sp) - ldq tmp0,32(sp) - - lda sp,64(sp) -#endif - - -/* Sign extend an *unsigned* 32 bit result, as required by the Alpha - conventions. */ -#if TYPE == UNSIGNED && SIZE == 32 - /* This could be avoided by adding some CPP hair to the divide loop. - It is probably not worth the added complexity. */ - addl RETREG,0,RETREG -#endif - - -#if SPECIAL_CALLING_CONVENTION - ret zero,($23),1 -#else - ret zero,($26),1 -#endif - .end FUNCTION_NAME diff --git a/contrib/gcc/config/alpha/linux-ecoff.h b/contrib/gcc/config/alpha/linux-ecoff.h deleted file mode 100644 index 824d0280fce5..000000000000 --- a/contrib/gcc/config/alpha/linux-ecoff.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Definitions of target machine for GNU compiler - for Alpha Linux-based GNU systems using ECOFF. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Bob Manson. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (Alpha GNU/Linux for ECOFF)"); - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "-D__ECOFF__" - -#undef LINK_SPEC -#define LINK_SPEC "-G 8 %{O*:-O3} %{!O*:-O1}" - -/* stabs get slurped by the assembler into a queer ecoff format. */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* We support #pragma. */ -#define HANDLE_SYSV_PRAGMA diff --git a/contrib/gcc/config/alpha/linux-elf.h b/contrib/gcc/config/alpha/linux-elf.h deleted file mode 100644 index 50bf2307d5b1..000000000000 --- a/contrib/gcc/config/alpha/linux-elf.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Definitions of target machine for GNU compiler - for Alpha Linux-based GNU systems using ELF. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Richard Henderson. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (Alpha GNU/Linux for ELF)"); - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ -{ "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, - -#undef SUB_CPP_PREDEFINES -#define SUB_CPP_PREDEFINES "-D__ELF__" - -#ifdef USE_GNULIBC_1 -#define ELF_DYNAMIC_LINKER "/lib/ld.so.1" -#else -#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2" -#endif - -#ifndef USE_GNULIBC_1 -#undef DEFAULT_VTABLE_THUNKS -#define DEFAULT_VTABLE_THUNKS 2 -#endif - -#ifndef USE_GNULIBC_1 -#undef LIB_SPEC -#define LIB_SPEC \ -"%{shared:-lc}%{!shared:%{pthread:-lpthread }%{profile:-lc_p}%{!profile:-lc}} " -#endif diff --git a/contrib/gcc/config/alpha/linux.h b/contrib/gcc/config/alpha/linux.h deleted file mode 100644 index b8eb9e915e44..000000000000 --- a/contrib/gcc/config/alpha/linux.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Definitions of target machine for GNU compiler, - for Alpha Linux-based GNU systems. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Richard Henderson. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_FP | MASK_FPREGS | MASK_GAS) - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES \ -"-Dlinux -Dunix -Asystem(linux) -D_LONGLONG -D__alpha__ " \ -SUB_CPP_PREDEFINES - -#undef LIB_SPEC -#define LIB_SPEC "%{pg:-lgmon} %{pg:-lc_p} %{!pg:-lc}" - -/* Generate calls to memcpy, etc., not bcopy, etc. */ -#define TARGET_MEM_FUNCTIONS 1 - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ - fputs ("\tlda $28,_mcount\n\tjsr $28,($28),_mcount\n", (FILE)) - -/* Show that we need a GP when profiling. */ -#define TARGET_PROFILING_NEEDS_GP 1 - -/* Don't care about faults in the prologue. */ -#undef TARGET_CAN_FAULT_IN_PROLOGUE -#define TARGET_CAN_FAULT_IN_PROLOGUE 1 diff --git a/contrib/gcc/config/alpha/netbsd-elf.h b/contrib/gcc/config/alpha/netbsd-elf.h deleted file mode 100644 index 6e4f4daf62b2..000000000000 --- a/contrib/gcc/config/alpha/netbsd-elf.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Definitions of target machine for GNU compiler - for Alpha NetBSD systems using ELF. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (Alpha NetBSD/ELF)"); - -#undef SUB_CPP_PREDEFINES -#define SUB_CPP_PREDEFINES "-D__ELF__" - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ -{ "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, - -#define ELF_DYNAMIC_LINKER "/usr/libexec/ld.elf_so" diff --git a/contrib/gcc/config/alpha/netbsd.h b/contrib/gcc/config/alpha/netbsd.h deleted file mode 100644 index 51890643f88e..000000000000 --- a/contrib/gcc/config/alpha/netbsd.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Definitions of target machine for GNU compiler, - for Alpha NetBSD systems. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_FP | MASK_FPREGS | MASK_GAS) - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D_LONGLONG -Dnetbsd -Dunix " SUB_CPP_PREDEFINES - -#undef LIB_SPEC -#define LIB_SPEC "%{pg:-lgmon} %{pg:-lc_p} %{!pg:-lc}" - -/* Generate calls to memcpy, etc., not bcopy, etc. */ -#define TARGET_MEM_FUNCTIONS - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ - fputs ("\tlda $28,_mcount\n\tjsr $28,($28),_mcount\n", (FILE)) - -/* Show that we need a GP when profiling. */ -#define TARGET_PROFILING_NEEDS_GP diff --git a/contrib/gcc/config/alpha/openbsd.h b/contrib/gcc/config/alpha/openbsd.h deleted file mode 100644 index 60591d554f56..000000000000 --- a/contrib/gcc/config/alpha/openbsd.h +++ /dev/null @@ -1,126 +0,0 @@ -/* Configuration file for an alpha OpenBSD target. - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* We settle for little endian for now. */ -#define TARGET_ENDIAN_DEFAULT 0 - -#include - -#define OBSD_NO_DYNAMIC_LIBRARIES -#define OBSD_HAS_DECLARE_FUNCTION_NAME -#define OBSD_HAS_DECLARE_FUNCTION_SIZE -#define OBSD_HAS_DECLARE_OBJECT - -/* alpha ecoff supports only weak aliases, see below. */ -#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS (FILE,NAME,0) - -#include - -/* Controlling the compilation driver. */ - -/* alpha needs __start. */ -#undef LINK_SPEC -#define LINK_SPEC \ - "%{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{assert*}" - -/* run-time target specifications */ -#define CPP_PREDEFINES "-D__unix__ -D__ANSI_COMPAT -Asystem(unix) \ --D__OpenBSD__ -D__alpha__ -D__alpha" - -/* Layout of source language data types. */ - -/* This must agree with */ -#undef SIZE_TYPE -#define SIZE_TYPE "long unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "long int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 - - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#define LOCAL_LABEL_PREFIX "." - -/* We don't have an init section yet. */ -#undef HAS_INIT_SECTION - -/* collect2 support (assembler format: macros for initialization). */ - -/* Don't tell collect2 we use COFF as we don't have (yet ?) a dynamic ld - library with the proper functions to handle this -> collect2 will - default to using nm. */ -#undef OBJECT_FORMAT_COFF -#undef EXTENDED_COFF - -/* Assembler format: exception region output. */ - -/* All configurations that don't use elf must be explicit about not using - dwarf unwind information. egcs doesn't try too hard to check internal - configuration files... */ -#ifdef INCOMING_RETURN_ADDR_RTX -#undef DWARF2_UNWIND_INFO -#define DWARF2_UNWIND_INFO 0 -#endif - -/* Assembler format: file framework. */ - -/* Taken from alpha/osf.h. This used to be common to all alpha - configurations, but elf has departed from it. - Check alpha/alpha.h, alpha/osf.h for it when egcs is upgraded. */ -#ifndef ASM_FILE_START -#define ASM_FILE_START(FILE) \ -{ \ - alpha_write_verstamp (FILE); \ - fprintf (FILE, "\t.set noreorder\n"); \ - fprintf (FILE, "\t.set volatile\n"); \ - fprintf (FILE, "\t.set noat\n"); \ - if (TARGET_SUPPORT_ARCH) \ - fprintf (FILE, "\t.arch %s\n", \ - alpha_cpu == PROCESSOR_EV6 ? "ev6" \ - : (alpha_cpu == PROCESSOR_EV5 \ - ? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \ - : "ev4")); \ - \ - ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ -} -#endif - -/* Assembler format: label output. */ - -#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \ - do { \ - fputs ("\t.weakext\t", FILE); \ - assemble_name (FILE, NAME); \ - if (VALUE) \ - { \ - fputs (" , ", FILE); \ - assemble_name (FILE, VALUE); \ - } \ - fputc ('\n', FILE); \ - } while (0) - - diff --git a/contrib/gcc/config/alpha/osf.h b/contrib/gcc/config/alpha/osf.h deleted file mode 100644 index 5054444a7599..000000000000 --- a/contrib/gcc/config/alpha/osf.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha on OSF/1. - Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As of OSF 4.0, as can subtract adjacent labels. */ - -#undef TARGET_AS_CAN_SUBTRACT_LABELS -#define TARGET_AS_CAN_SUBTRACT_LABELS 1 - -/* Names to predefine in the preprocessor for this target machine. */ - -#define CPP_PREDEFINES "\ --Dunix -D__osf__ -D_LONGLONG -DSYSTYPE_BSD \ --D_SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4)" - -/* Accept DEC C flags for multithreaded programs. We use _PTHREAD_USE_D4 - instead of PTHREAD_USE_D4 since both have the same effect and the former - doesn't invade the users' namespace. */ - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC \ -"%{pthread|threads:-D_REENTRANT} %{threads:-D_PTHREAD_USE_D4}" - -/* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */ - -#define LIB_SPEC \ -"%{p|pg:-lprof1%{pthread|threads:_r} -lpdf} %{a:-lprof2} \ - %{threads: -lpthreads} %{pthread|threads: -lpthread -lmach -lexc} -lc" - -/* Pass "-G 8" to ld because Alpha's CC does. Pass -O3 if we are - optimizing, -O1 if we are not. Pass -shared, -non_shared or - -call_shared as appropriate. Also pass -pg. */ -#define LINK_SPEC \ - "-G 8 %{O*:-O3} %{!O*:-O1} %{static:-non_shared} \ - %{!static:%{shared:-shared} %{!shared:-call_shared}} %{pg} %{taso} \ - %{rpath*}" - -#define STARTFILE_SPEC \ - "%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}" - -#define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/" - -#define ASM_FILE_START(FILE) \ -{ \ - alpha_write_verstamp (FILE); \ - fprintf (FILE, "\t.set noreorder\n"); \ - fprintf (FILE, "\t.set volatile\n"); \ - fprintf (FILE, "\t.set noat\n"); \ - if (TARGET_SUPPORT_ARCH) \ - fprintf (FILE, "\t.arch %s\n", \ - alpha_cpu == PROCESSOR_EV6 ? "ev6" \ - : (alpha_cpu == PROCESSOR_EV5 \ - ? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \ - : "ev4")); \ - \ - ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ -} - -/* No point in running CPP on our assembler output. */ -#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GAS) != 0 -/* Don't pass -g to GNU as, because some versions don't accept this option. */ -#define ASM_SPEC "%{malpha-as:-g} -nocpp %{pg}" -#else -/* In OSF/1 v3.2c, the assembler by default does not output file names which - causes mips-tfile to fail. Passing -g to the assembler fixes this problem. - ??? Strictly speaking, we need -g only if the user specifies -g. Passing - it always means that we get slightly larger than necessary object files - if the user does not specify -g. If we don't pass -g, then mips-tfile - will need to be fixed to work in this case. Pass -O0 since some - optimization are broken and don't help us anyway. */ -#define ASM_SPEC "%{!mgas:-g} -nocpp %{pg} -O0" -#endif - -/* Specify to run a post-processor, mips-tfile after the assembler - has run to stuff the ecoff debug information into the object file. - This is needed because the Alpha assembler provides no way - of specifying such information in the assembly file. */ - -#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GAS) != 0 - -#define ASM_FINAL_SPEC "\ -%{malpha-as: %{!mno-mips-tfile: \ - \n mips-tfile %{v*: -v} \ - %{K: -I %b.o~} \ - %{!K: %{save-temps: -I %b.o~}} \ - %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \ - %{.s:%i} %{!.s:%g.s}}}" - -#else -#define ASM_FINAL_SPEC "\ -%{!mgas: %{!mno-mips-tfile: \ - \n mips-tfile %{v*: -v} \ - %{K: -I %b.o~} \ - %{!K: %{save-temps: -I %b.o~}} \ - %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \ - %{.s:%i} %{!.s:%g.s}}}" - -#endif - -/* Indicate that we have a stamp.h to use. */ -#ifndef CROSS_COMPILE -#define HAVE_STAMP_H 1 -#endif - -/* Attempt to turn on access permissions for the stack. */ - -#define TRANSFER_FROM_TRAMPOLINE \ -void \ -__enable_execute_stack (addr) \ - void *addr; \ -{ \ - long size = getpagesize (); \ - long mask = ~(size-1); \ - char *page = (char *) (((long) addr) & mask); \ - char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ - \ - /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ - if (mprotect (page, end - page, 7) < 0) \ - perror ("mprotect of trampoline code"); \ -} diff --git a/contrib/gcc/config/alpha/osf12.h b/contrib/gcc/config/alpha/osf12.h deleted file mode 100644 index 87e21111f4dc..000000000000 --- a/contrib/gcc/config/alpha/osf12.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha. - Copyright (C) 1992, 1993, 1995, 1996 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@nyu.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* In OSF 1.2, there is a linker bug that prevents use of -O3 to - the linker. */ - -#undef LINK_SPEC -#define LINK_SPEC \ - "-G 8 -O1 %{static:-non_shared} %{rpath*} \ - %{!static:%{shared:-shared} %{!shared:-call_shared}} %{taso}" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "short unsigned int" -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 16 diff --git a/contrib/gcc/config/alpha/osf2.h b/contrib/gcc/config/alpha/osf2.h deleted file mode 100644 index 169af5a01c97..000000000000 --- a/contrib/gcc/config/alpha/osf2.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha. - Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "alpha/alpha.h" - -/* In OSF 2.0, the size of wchar_t was changed from short unsigned - to unsigned int. */ - -#undef WCHAR_TYPE -#define WCHAR_TYPE "unsigned int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 diff --git a/contrib/gcc/config/alpha/osf2or3.h b/contrib/gcc/config/alpha/osf2or3.h deleted file mode 100644 index 5abdb0e98b13..000000000000 --- a/contrib/gcc/config/alpha/osf2or3.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha, osf[23]. - Copyright (C) 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* In OSF 2 or 3, linking with -lprof1 doesn't require -lpdf. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} %{a:-lprof2} -lc" - -/* As of OSF 3.2, as still can't subtract adjacent labels. */ - -#undef TARGET_AS_CAN_SUBTRACT_LABELS -#define TARGET_AS_CAN_SUBTRACT_LABELS 0 - diff --git a/contrib/gcc/config/alpha/t-crtbe b/contrib/gcc/config/alpha/t-crtbe deleted file mode 100644 index 5e82b923c720..000000000000 --- a/contrib/gcc/config/alpha/t-crtbe +++ /dev/null @@ -1,9 +0,0 @@ -# Effectively disable the crtbegin/end rules using crtstuff.c -T = disable - -# Assemble startup files. -crtbegin.o: $(srcdir)/config/alpha/crtbegin.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crtbegin.o -x assembler $(srcdir)/config/alpha/crtbegin.asm - -crtend.o: $(srcdir)/config/alpha/crtend.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crtend.o -x assembler $(srcdir)/config/alpha/crtend.asm diff --git a/contrib/gcc/config/alpha/t-ieee b/contrib/gcc/config/alpha/t-ieee deleted file mode 100644 index a1f93db1b2d0..000000000000 --- a/contrib/gcc/config/alpha/t-ieee +++ /dev/null @@ -1,6 +0,0 @@ -# All alphas get an IEEE complaint set of libraries. -MULTILIB_OPTIONS = mieee -MULTILIB_DIRNAMES = ieee - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/alpha/t-interix b/contrib/gcc/config/alpha/t-interix deleted file mode 100644 index d6d80e9c085e..000000000000 --- a/contrib/gcc/config/alpha/t-interix +++ /dev/null @@ -1,16 +0,0 @@ -# t-interix - -# System headers will track gcc's needs. -# Even LANG_EXTRA_HEADERS may be temporary. -USER_H=$(LANG_EXTRA_HEADERS) - -# We don't want this one either. -INSTALL_ASSERT_H= - - - -CROSS_LIBGCC1 = libgcc1-asm.a -LIBGCC1 = libgcc1-asm.a - -LIB1ASMSRC = alpha/lib1funcs.asm -LIB1ASMFUNCS = _divqu _divq _divlu _divl _remqu _remq _remlu _reml diff --git a/contrib/gcc/config/alpha/t-vms b/contrib/gcc/config/alpha/t-vms deleted file mode 100644 index 12ac24098ce7..000000000000 --- a/contrib/gcc/config/alpha/t-vms +++ /dev/null @@ -1,6 +0,0 @@ -# Do not build libgcc1. -LIBGCC1 = -CROSS_LIBGCC1 = - -LIB2FUNCS_EXTRA = tramp.s - diff --git a/contrib/gcc/config/alpha/va_list.h b/contrib/gcc/config/alpha/va_list.h deleted file mode 100644 index c9ab2b0b50e2..000000000000 --- a/contrib/gcc/config/alpha/va_list.h +++ /dev/null @@ -1,16 +0,0 @@ -/* A replacement for Digital Unix's . */ - -#include - -#if !defined(_VA_LIST) && !defined(_HIDDEN_VA_LIST) -#define _VA_LIST -typedef __gnuc_va_list va_list; - -#elif defined(_HIDDEN_VA_LIST) && !defined(_HIDDEN_VA_LIST_DONE) -#define _HIDDEN_VA_LIST_DONE -typedef __gnuc_va_list __va_list; - -#elif defined(_HIDDEN_VA_LIST) && defined(_VA_LIST) -#undef _HIDDEN_VA_LIST - -#endif diff --git a/contrib/gcc/config/alpha/vms-tramp.asm b/contrib/gcc/config/alpha/vms-tramp.asm deleted file mode 100644 index fce9ec539cad..000000000000 --- a/contrib/gcc/config/alpha/vms-tramp.asm +++ /dev/null @@ -1,22 +0,0 @@ -;# New Alpha OpenVMS trampoline -;# - .set noreorder - .set volatile - .set noat - .file 1 "tramp.s" -.text - .align 3 - .globl __tramp - .ent __tramp -__tramp..en: - -.link - .align 3 -__tramp: - .pdesc __tramp..en,null -.text - ldq $1,24($27) - ldq $27,16($27) - ldq $28,8($27) - jmp $31,($28),0 - .end __tramp diff --git a/contrib/gcc/config/alpha/vms.h b/contrib/gcc/config/alpha/vms.h deleted file mode 100644 index 44388b2cf33d..000000000000 --- a/contrib/gcc/config/alpha/vms.h +++ /dev/null @@ -1,506 +0,0 @@ -/* Output variables, constants and external declarations, for GNU compiler. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define OPEN_VMS 1 - -/* This enables certain macros in alpha.h, which will make an indirect - reference to an external symbol an invalid address. This needs to be - defined before we include alpha.h, since it determines which macros - are used for GO_IF_*. */ - -#define NO_EXTERNAL_INDIRECT_ADDRESS - -#include "alpha/alpha.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES \ -"-D__ALPHA -Dvms -DVMS -D__vms__ -D__VMS__ -Asystem(vms)" - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "\ -%{mfloat-ieee:-D__IEEE_FLOAT} \ -%{mfloat-vax:-D__G_FLOAT} \ -%{!mfloat-vax:-D__IEEE_FLOAT}" - -/* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */ - -#define LIB_SPEC "%{p:-lprof1 -lpdf} %{pg:-lprof1 -lpdf} %{a:-lprof2} -lc" - -/* Pass "-G 8" to ld because Alpha's CC does. Pass -O3 if we are - optimizing, -O1 if we are not. Pass -shared, -non_shared or - -call_shared as appropriate. Also pass -pg. */ -#define LINK_SPEC \ - "-G 8 %{O*:-O3} %{!O*:-O1} %{static:-non_shared} \ - %{!static:%{shared:-shared} %{!shared:-call_shared}} %{pg} %{taso} \ - %{rpath*}" - -/* We allow $'s in identifiers unless -ansi is used .. */ - -#define DOLLARS_IN_IDENTIFIERS 2 - -/* These match the definitions used in DECCRTL, the VMS C run-time library - -#define SIZE_TYPE "unsigned int" -#define PTRDIFF_TYPE "int" -*/ - -/* Use memcpy for structure copying, and so forth. */ -#define TARGET_MEM_FUNCTIONS - -/* By default, allow $ to be part of an identifier. */ -#define DOLLARS_IN_IDENTIFIERS 2 - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS) -#undef TARGET_OPEN_VMS -#define TARGET_OPEN_VMS 1 - -#undef TARGET_NAME -#define TARGET_NAME "OpenVMS/Alpha" -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME); - -/* The structure return address arrives as an "argument" on VMS. */ -#undef STRUCT_VALUE_REGNUM -#define STRUCT_VALUE 0 -#undef PCC_STATIC_STRUCT_RETURN - -/* no floating emulation. */ -#undef REAL_ARITHMETIC - -/* "long" is 32 bits. */ -#undef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE 32 - -/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */ -#undef POINTER_SIZE -#define POINTER_SIZE 32 -#define POINTERS_EXTEND_UNSIGNED 0 - -#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */ - -#undef FIXED_REGISTERS -#define FIXED_REGISTERS \ - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } - -#undef CALL_USED_REGISTERS -#define CALL_USED_REGISTERS \ - {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } - -#undef HARD_FRAME_POINTER_REGNUM -#define HARD_FRAME_POINTER_REGNUM 29 - -#undef CAN_ELIMINATE -#define CAN_ELIMINATE(FROM, TO) \ -((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ()) - -#undef INITIAL_ELIMINATION_OFFSET -#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ -{ if ((FROM) == FRAME_POINTER_REGNUM) \ - (OFFSET) = alpha_sa_size () + alpha_pv_save_size (); \ - else if ((FROM) == ARG_POINTER_REGNUM) \ - (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size () \ - + get_frame_size () \ - + current_function_pretend_args_size) \ - - current_function_pretend_args_size); \ - if ((TO) == STACK_POINTER_REGNUM) \ - (OFFSET) += ALPHA_ROUND (current_function_outgoing_args_size); \ -} - -/* Define a data type for recording info about an argument list - during the scan of that argument list. This data type should - hold all necessary information about the function itself - and about the args processed so far, enough to enable macros - such as FUNCTION_ARG to determine where the next arg should go. - - On Alpha/VMS, this is a structure that contains the number of - arguments and, for each argument, the datatype of that argument. - - The number of arguments is a number of words of arguments scanned so far. - Thus 6 or more means all following args should go on the stack. */ - -enum avms_arg_type {I64, FF, FD, FG, FS, FT}; -typedef struct {char num_args; enum avms_arg_type atypes[6];} avms_arg_info; - -#undef CUMULATIVE_ARGS -#define CUMULATIVE_ARGS avms_arg_info - -/* Initialize a variable CUM of type CUMULATIVE_ARGS - for a call to a function whose data type is FNTYPE. - For a library call, FNTYPE is 0. */ - -#undef INIT_CUMULATIVE_ARGS -#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ - (CUM).num_args = 0; \ - (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \ - (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64; - -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ - -extern enum avms_arg_type alpha_arg_type (); - -/* Determine where to put an argument to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - MODE is the argument's machine mode (or VOIDmode for no more args). - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). - - On Alpha the first 6 words of args are normally in registers - and the rest are pushed. */ - -extern struct rtx_def *alpha_arg_info_reg_val (); -#undef FUNCTION_ARG -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ -((MODE) == VOIDmode ? alpha_arg_info_reg_val (CUM) \ - : ((CUM.num_args) < 6 && ! MUST_PASS_IN_STACK (MODE, TYPE) \ - ? gen_rtx(REG, (MODE), \ - ((CUM).num_args + 16 \ - + ((TARGET_FPREGS \ - && (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \ - || GET_MODE_CLASS (MODE) == MODE_FLOAT)) \ - * 32))) \ - : 0)) - -#undef FUNCTION_ARG_ADVANCE -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - if (MUST_PASS_IN_STACK (MODE, TYPE)) \ - (CUM).num_args += 6; \ - else \ - { \ - if ((CUM).num_args < 6) \ - (CUM).atypes[(CUM).num_args] = alpha_arg_type (MODE); \ - \ - (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \ - } - -/* For an arg passed partly in registers and partly in memory, - this is the number of registers used. - For args passed entirely in registers or entirely in memory, zero. */ - -#undef FUNCTION_ARG_PARTIAL_NREGS -#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ -((CUM).num_args < 6 && 6 < (CUM).num_args \ - + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \ - ? 6 - (CUM).num_args : 0) - -/* Perform any needed actions needed for a function that is receiving a - variable number of arguments. - - CUM is as for INIT_CUMULATIVE_ARGS. - - MODE and TYPE are the mode and type of the current parameter. - - PRETEND_SIZE is a variable that should be set to the amount of stack - that must be pushed by the prolog to pretend that our caller pushed - it. - - Normally, this macro will push all remaining incoming registers on the - stack and set PRETEND_SIZE to the length of the registers pushed. - - For VMS, we allocate space for all 6 arg registers plus a count. - - However, if NO registers need to be saved, don't allocate any space. - This is not only because we won't need the space, but because AP includes - the current_pretend_args_size and we don't want to mess up any - ap-relative addresses already made. */ - -#undef SETUP_INCOMING_VARARGS -#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ -{ if ((CUM).num_args < 6) \ - { \ - if (! (NO_RTL)) \ - { \ - emit_move_insn (gen_rtx (REG, DImode, 1), \ - virtual_incoming_args_rtx); \ - emit_insn (gen_arg_home ()); \ - } \ - \ - PRETEND_SIZE = 7 * UNITS_PER_WORD; \ - } \ -} - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ -{ \ - alpha_write_verstamp (FILE); \ - fprintf (FILE, "\t.set noreorder\n"); \ - fprintf (FILE, "\t.set volatile\n"); \ - ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ -} - -#undef ASM_OUTPUT_FLOAT -#define ASM_OUTPUT_FLOAT(FILE,VALUE) \ - { \ - if (REAL_VALUE_ISINF (VALUE) \ - || REAL_VALUE_ISNAN (VALUE) \ - || REAL_VALUE_MINUS_ZERO (VALUE)) \ - { \ - long t; \ - REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \ - fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \ - } \ - else \ - { \ - char str[30]; \ - REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \ - fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \ - } \ - } - -#define LINK_SECTION_ASM_OP ".link" -#define READONLY_SECTION_ASM_OP ".rdata" -#define LITERALS_SECTION_ASM_OP ".literals" -#define CTORS_SECTION_ASM_OP ".ctors" -#define DTORS_SECTION_ASM_OP ".dtors" - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_link, in_rdata, in_literals, in_ctors, in_dtors - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ -void \ -readonly_section () \ -{ \ - if (in_section != in_rdata) \ - { \ - fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \ - in_section = in_rdata; \ - } \ -} \ -void \ -link_section () \ -{ \ - if (in_section != in_link) \ - { \ - fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \ - in_section = in_link; \ - } \ -} \ -void \ -literals_section () \ -{ \ - if (in_section != in_literals) \ - { \ - fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \ - in_section = in_literals; \ - } \ -} \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) abort () - -#undef ASM_OUTPUT_ADDR_VEC_ELT -#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ - fprintf (FILE, "\t.quad $L%d\n", (VALUE)) - -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION readonly_section - -#define ASM_FILE_END(FILE) alpha_write_linkage (FILE); - -#undef CASE_VECTOR_MODE -#define CASE_VECTOR_MODE DImode -#undef CASE_VECTOR_PC_RELATIVE - -#undef ASM_OUTPUT_CASE_LABEL -#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \ -{ ASM_OUTPUT_ALIGN (FILE, 3); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); } - -/* This says how to output assembler code to declare an - uninitialized external linkage data object. */ - -#define COMMON_ASM_OP ".comm" - -#undef ASM_OUTPUT_ALIGNED_COMMON -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ -} while (0) - -#define NO_MD_PROTOTYPES - -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. - - The trampoline should set the static chain pointer to value placed - into the trampoline and should branch to the specified routine. - Note that $27 has been set to the address of the trampoline, so we can - use it for addressability of the two data items. Trampolines are always - aligned to FUNCTION_BOUNDARY, which is 64 bits. */ - -#undef TRAMPOLINE_TEMPLATE -#define TRAMPOLINE_TEMPLATE(FILE) \ -{ \ - fprintf (FILE, "\t.quad 0\n"); \ - fprintf (FILE, "\t.linkage __tramp\n"); \ - fprintf (FILE, "\t.quad 0\n"); \ -} - -/* Length in units of the trampoline for entering a nested function. */ - -#undef TRAMPOLINE_SIZE -#define TRAMPOLINE_SIZE 32 - -/* Emit RTL insns to initialize the variable parts of a trampoline. - FNADDR is an RTX for the address of the function's pure code. - CXT is an RTX for the static chain value for the function. */ - -#undef INITIALIZE_TRAMPOLINE -#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ - alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, -1) - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t.quad "); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t.quad "); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \ - (vms_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS)) -extern int vms_valid_decl_attribute_p (); - -#undef SDB_DEBUGGING_INFO -#undef MIPS_DEBUGGING_INFO -#undef DBX_DEBUGGING_INFO - -#define DWARF2_DEBUGGING_INFO - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - fprintf (FILE, "\t.align %d\n", LOG); - -#define ASM_OUTPUT_SECTION(FILE,SECTION) \ - (strcmp (SECTION, ".text") == 0) \ - ? text_section () \ - : named_section (NULL_TREE, SECTION, 0), \ - ASM_OUTPUT_ALIGN (FILE, 0) \ - -#define ASM_OUTPUT_SECTION_NAME(FILE,DECL,NAME,RELOC) \ - do \ - { \ - char *flags; \ - int ovr = 0; \ - if (DECL && DECL_MACHINE_ATTRIBUTES (DECL) \ - && lookup_attribute \ - ("overlaid", DECL_MACHINE_ATTRIBUTES (DECL))) \ - flags = ",OVR", ovr = 1; \ - else if (strncmp (NAME,".debug", 6) == 0) \ - flags = ",NOWRT"; \ - else \ - flags = ""; \ - fputc ('\n', (FILE)); \ - fprintf (FILE, ".section\t%s%s\n", NAME, flags); \ - if (ovr) \ - (NAME) = ""; \ - } while (0) - -#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ - do { literals_section(); \ - fprintf ((FILE), "\t"); \ - assemble_name (FILE, LABEL1); \ - fprintf (FILE, " = "); \ - assemble_name (FILE, LABEL2); \ - fprintf (FILE, "\n"); \ - } while (0) - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG - -#undef ASM_FORMAT_PRIVATE_NAME -#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ -( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \ - sprintf ((OUTPUT), "%s___%d", (NAME), (LABELNO))) - -/* ??? VMS uses different linkage. */ -#undef ASM_OUTPUT_MI_THUNK - -#undef ASM_SPEC -#undef ASM_FINAL_SPEC -#undef LINK_SPEC -#undef STARTFILE_SPEC -#define ASM_SPEC "-nocpp %{pg}" -#define LINK_SPEC "%{g3:-g3} %{g0:-g0} %{shared:-shared} %{v:-v}" - -/* Define the names of the division and modulus functions. */ -#define DIVSI3_LIBCALL "OTS$DIV_I" -#define DIVDI3_LIBCALL "OTS$DIV_L" -#define UDIVSI3_LIBCALL "OTS$DIV_UI" -#define UDIVDI3_LIBCALL "OTS$DIV_UL" -#define MODSI3_LIBCALL "OTS$REM_I" -#define MODDI3_LIBCALL "OTS$REM_L" -#define UMODSI3_LIBCALL "OTS$REM_UI" -#define UMODDI3_LIBCALL "OTS$REM_UL" - -#define DIR_SEPARATOR ']' - -#define PREFIX "GNU_ROOT:" diff --git a/contrib/gcc/config/alpha/vxworks.h b/contrib/gcc/config/alpha/vxworks.h deleted file mode 100644 index 7ef1feeb8028..000000000000 --- a/contrib/gcc/config/alpha/vxworks.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Definitions of target machine for GNU compiler. Vxworks Alpha version. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file just exists to give specs for the Alpha running on VxWorks. */ - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "\ -%{mvxsim:-DCPU=SIMALPHADUNIX} \ -%{!mvxsim: %{!mcpu*|mcpu=21064:-DCPU=21064} %{mcpu=21164:-DCPU=21164}} \ -%{posix: -D_POSIX_SOURCE}" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "\ --D__vxworks -D__alpha_vxworks -Asystem(vxworks) \ --Asystem(embedded) -D_LONGLONG" - -/* VxWorks does all the library stuff itself. */ - -#undef LIB_SPEC -#define LIB_SPEC "" - -/* VxWorks uses object files, not loadable images. Make linker just combine - objects. Also show using 32 bit mode and set start of text to 0. */ - -#undef LINK_SPEC -#define LINK_SPEC "-r -taso -T 0" - -/* VxWorks provides the functionality of crt0.o and friends itself. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "" diff --git a/contrib/gcc/config/alpha/x-alpha b/contrib/gcc/config/alpha/x-alpha deleted file mode 100644 index 9686ab96472a..000000000000 --- a/contrib/gcc/config/alpha/x-alpha +++ /dev/null @@ -1,2 +0,0 @@ -CLIB=-lmld -EXTRA_HEADERS = $(srcdir)/config/alpha/va_list.h diff --git a/contrib/gcc/config/alpha/xm-alpha-interix.h b/contrib/gcc/config/alpha/xm-alpha-interix.h deleted file mode 100644 index 02c53b814129..000000000000 --- a/contrib/gcc/config/alpha/xm-alpha-interix.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Configuration for GNU compiler - for an DEC/Compaq Alpha - Copyright (C) 1999 Free Software Foundation, Inc. - Donn Terry, Softway Systems, Inc. - derived from code by Douglas B. Rupp (drupp@cs.washington.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include - -#undef HOST_BITS_PER_LONG -#define HOST_BITS_PER_LONG 32 - -#define HOST_BITS_PER_WIDE_INT 64 -#ifdef __GNUC__ -# define HOST_WIDE_INT long long -#else -# define HOST_WIDE_INT __int64 -#endif - - -#define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG -#ifdef __GNUC__ -# define HOST_WIDEST_INT long long -#else -# define HOST_WIDEST_INT __int64 -#endif -#define HOST_WIDEST_INT_PRINT_DEC "%lld" -#define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu" -#define HOST_WIDEST_INT_PRINT_HEX "0x%llx" diff --git a/contrib/gcc/config/alpha/xm-alpha.h b/contrib/gcc/config/alpha/xm-alpha.h deleted file mode 100644 index c04844fdacde..000000000000 --- a/contrib/gcc/config/alpha/xm-alpha.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Configuration for GNU C-compiler for DEC Alpha. - Copyright (C) 1990, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* #defines that need visibility everywhere. */ -#define FALSE 0 -#define TRUE 1 - -/* This describes the machine the compiler is hosted on. */ -#define HOST_BITS_PER_CHAR 8 -#define HOST_BITS_PER_SHORT 16 -#define HOST_BITS_PER_INT 32 -#define HOST_BITS_PER_LONG 64 -#define HOST_BITS_PER_LONGLONG 64 - -/* #define HOST_WORDS_BIG_ENDIAN */ - -/* target machine dependencies. - tm.h is a symbolic link to the actual target specific file. */ -#include "tm.h" - -/* Arguments to use with `exit'. */ -#define SUCCESS_EXIT_CODE 0 -#define FATAL_EXIT_CODE 33 - -/* If compiled with GNU C, use the builtin alloca. */ -#ifndef alloca -#if defined(__GNUC__) && !defined(USE_C_ALLOCA) -#define alloca __builtin_alloca -#else -#if !defined(_WIN32) && !defined(USE_C_ALLOCA) && !defined(OPEN_VMS) && !defined(__INTERIX) -#include -#else -extern void *alloca (); -#endif -#endif -#endif - -/* The host compiler has problems with enum bitfields since it makes - them signed so we can't fit all our codes in. */ - -#ifndef __GNUC__ -#define ONLY_INT_FIELDS -#endif - -/* Declare some functions needed for this machine. We don't want to - include these in the sources since other machines might define them - differently. */ - -extern void *malloc (), *realloc (), *calloc (); - -#ifndef inhibit_libc -#include "string.h" -#endif - -/* OSF/1 is POSIX.1 compliant. */ - -#define POSIX diff --git a/contrib/gcc/config/alpha/xm-openbsd.h b/contrib/gcc/config/alpha/xm-openbsd.h deleted file mode 100644 index 50f436695a71..000000000000 --- a/contrib/gcc/config/alpha/xm-openbsd.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Configuration file for an host running alpha OpenBSD. - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include - diff --git a/contrib/gcc/config/alpha/xm-vms.h b/contrib/gcc/config/alpha/xm-vms.h deleted file mode 100644 index 472a225672be..000000000000 --- a/contrib/gcc/config/alpha/xm-vms.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Configuration for GNU C-compiler for openVMS/Alpha. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Klaus Kaempf (kkaempf@progis.de). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* If compiling with DECC, need to fix problem with - which defines a macro called FILE_TYPE that breaks "tree.h". - Fortunately it uses #ifndef to suppress multiple inclusions. - Three possible cases: - 1) has already been included -- ours will be no-op; - 2) will be included after us -- "theirs" will be no-op; - 3) isn't needed -- including it here shouldn't hurt. - In all three cases, the problem macro will be removed here. */ - -#include -#include -#include -#ifdef __DECC -#undef FILE_TYPE -#endif - -#undef HOST_BITS_PER_LONG -#define HOST_BITS_PER_LONG 32 - -#define HOST_WIDE_INT long long -#define HOST_BITS_PER_WIDE_INT 64 - -#undef SUCCESS_EXIT_CODE -#define SUCCESS_EXIT_CODE 1 -#undef FATAL_EXIT_CODE -#define FATAL_EXIT_CODE (44 | 0x10000000) /* Abort, and no DCL message. */ - -/* A couple of conditionals for execution machine are controlled here. */ -#ifndef VMS -#define VMS -#endif - -#define GCC_INCLUDE_DIR "" -/* Specify the list of include file directories. */ -#define INCLUDE_DEFAULTS \ -{ \ - { "GNU_GXX_INCLUDE:", "G++", 1, 1 }, \ - { "GNU_CC_INCLUDE:", "GCC", 0, 0 }, \ - { ".", 0, 0, 1 }, \ - { 0, 0, 0, 0 } \ -} - -/* Define a local equivalent (sort of) for unlink */ -#define unlink remove - -#define NEED_ATEXIT -#define HAVE_VPRINTF -#define HAVE_PUTENV -#define HAVE_STRERROR -#define HAVE_ATOLL - -#define NO_SYS_PARAMS_H /* Don't have */ -#define USE_C_ALLOCA /* Using alloca.c */ - -#define HAVE_FCNTL_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_UNISTD_H 1 -#define HAVE_STRING_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_STDDEF_H 1 -#define HAVE_TIME_H 1 -#define STDC_HEADERS 1 -#define HAVE_CPP_STRINGIFY 1 - -#if __STDC__ -extern void *alloca (size_t); -#else -extern char *alloca (unsigned int); -#endif - -#define OBJECT_SUFFIX ".obj" -#define EXECUTABLE_SUFFIX ".exe" diff --git a/contrib/gcc/config/aoutos.h b/contrib/gcc/config/aoutos.h deleted file mode 100644 index 6f4e2623c64a..000000000000 --- a/contrib/gcc/config/aoutos.h +++ /dev/null @@ -1,41 +0,0 @@ -/* aoutos.h -- operating system specific defines to be used when - targeting GCC for some system that uses a.out file format. - Copyright (C) 1992 Free Software Foundation, Inc. - - Written by Ron Guilmette (rfg@netcom.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* To use this file, make up a file with a name like: - - ?????aout.h - - where ????? is replaced by the name of the basic hardware that you - are targeting for. Then, in the file ?????aout.h, put something - like: - - #include "?????.h" - #include "aoutos.h" - - followed by any really system-specific defines (or overrides of - defines) which you find that you need. Now, modify the configure - or configure.in script to properly use the new ?????aout.h file - when configuring for the system. */ - -/* Define a symbol indicating that we are using aoutos.h. */ -#define USING_AOUTOS_H diff --git a/contrib/gcc/config/dbx.h b/contrib/gcc/config/dbx.h deleted file mode 100644 index c5cd3b5f2d0f..000000000000 --- a/contrib/gcc/config/dbx.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Prefer DBX (stabs) debugging information. - Copyright (C) 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file causes gcc to prefer using DBX (stabs) debugging - information. The configure script will add a #include of this file - to tm.h when --with-stabs is used for certain targets. */ - -#ifndef DBX_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO -#endif - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG diff --git a/contrib/gcc/config/dbxcoff.h b/contrib/gcc/config/dbxcoff.h deleted file mode 100644 index 1d5b448879f6..000000000000 --- a/contrib/gcc/config/dbxcoff.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Definitions needed when using stabs embedded in COFF sections. - Copyright (C) 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file may be included by any COFF target which wishes to - support -gstabs generating stabs in sections, as produced by gas - and understood by gdb. */ - -/* Output DBX (stabs) debugging information if doing -gstabs. */ - -#undef DBX_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO - -/* Generate SDB debugging information by default. */ - -#ifndef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG -#endif - -/* Be function-relative for block and source line stab directives. */ - -#undef DBX_BLOCKS_FUNCTION_RELATIVE -#define DBX_BLOCKS_FUNCTION_RELATIVE 1 - -/* but, to make this work, functions must appear prior to line info. */ - -#undef DBX_FUNCTION_FIRST -#define DBX_FUNCTION_FIRST - -/* Generate a blank trailing N_SO to mark the end of the .o file, since - we can't depend upon the linker to mark .o file boundaries with - embedded stabs. */ - -#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END -#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ - asm_fprintf (FILE, \ - "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", N_SO) - -/* Like block addresses, stabs line numbers are relative to the - current function. */ - -#undef ASM_OUTPUT_SOURCE_LINE -#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \ -{ if (write_symbols == SDB_DEBUG) { \ - fprintf ((FILE), "\t.ln\t%d\n", \ - ((sdb_begin_function_line > -1) \ - ? (LINE) - sdb_begin_function_line : 1)); \ - } else if (write_symbols == DBX_DEBUG) { \ - static int sym_lineno = 1; \ - char buffer[256]; \ - ASM_GENERATE_INTERNAL_LABEL (buffer, "LM", sym_lineno); \ - fprintf (FILE, ".stabn 68,0,%d,", LINE); \ - assemble_name (FILE, buffer); \ - putc ('-', FILE); \ - assemble_name (FILE, \ - XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ - putc ('\n', FILE); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "LM", sym_lineno); \ - sym_lineno++; \ - } } - -/* When generating stabs debugging, use N_BINCL entries. */ - -#undef DBX_USE_BINCL -#define DBX_USE_BINCL - -/* There is no limit to the length of stabs strings. */ - -#ifndef DBX_CONTIN_LENGTH -#define DBX_CONTIN_LENGTH 0 -#endif diff --git a/contrib/gcc/config/dbxelf.h b/contrib/gcc/config/dbxelf.h deleted file mode 100644 index 3971bc1c9dca..000000000000 --- a/contrib/gcc/config/dbxelf.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Definitions needed when using stabs embedded in ELF sections. - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file may be included by any ELF target which wishes to - support -gstabs generating stabs in sections, as produced by gas - and understood by gdb. */ - -#ifndef __DBX_ELF_H -#define __DBX_ELF_H - -/* Output DBX (stabs) debugging information if doing -gstabs. */ - -#undef DBX_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO - -/* Make LBRAC and RBRAC addresses relative to the start of the - function. The native Solaris stabs debugging format works this - way, gdb expects it, and it reduces the number of relocation - entries... */ - -#undef DBX_BLOCKS_FUNCTION_RELATIVE -#define DBX_BLOCKS_FUNCTION_RELATIVE 1 - -/* ... but, to make this work, functions must appear prior to line info. */ - -#undef DBX_FUNCTION_FIRST -#define DBX_FUNCTION_FIRST - -/* When generating stabs debugging, use N_BINCL entries. */ - -#undef DBX_USE_BINCL -#define DBX_USE_BINCL - -/* There is no limit to the length of stabs strings. */ - -#ifndef DBX_CONTIN_LENGTH -#define DBX_CONTIN_LENGTH 0 -#endif - -/* When using stabs, gcc2_compiled must be a stabs entry, not an - ordinary symbol, or gdb won't see it. Furthermore, since gdb reads - the input piecemeal, starting with each N_SO, it's a lot easier if - the gcc2 flag symbol is *after* the N_SO rather than before it. So - we emit an N_OPT stab there. */ - -#define ASM_IDENTIFY_GCC(FILE) \ -do \ - { \ - if (write_symbols != DBX_DEBUG) \ - fputs ("gcc2_compiled.:\n", FILE); \ - } \ -while (0) - -#define ASM_IDENTIFY_GCC_AFTER_SOURCE(FILE) \ -do \ - { \ - if (write_symbols == DBX_DEBUG) \ - fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \ - } \ -while (0) - -/* Like block addresses, stabs line numbers are relative to the - current function. */ - -#undef ASM_OUTPUT_SOURCE_LINE -#define ASM_OUTPUT_SOURCE_LINE(FILE, LINE) \ -do \ - { \ - static int sym_lineno = 1; \ - char temp[256]; \ - ASM_GENERATE_INTERNAL_LABEL (temp, "LM", sym_lineno); \ - fprintf (FILE, ".stabn 68,0,%d,", LINE); \ - assemble_name (FILE, temp); \ - putc ('-', FILE); \ - assemble_name (FILE, \ - XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\ - putc ('\n', FILE); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "LM", sym_lineno); \ - sym_lineno += 1; \ - } \ -while (0) - -/* Generate a blank trailing N_SO to mark the end of the .o file, since - we can't depend upon the linker to mark .o file boundaries with - embedded stabs. */ - -#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END -#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ - asm_fprintf (FILE, \ - "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", N_SO) - -#endif /* __DBX_ELF_H */ diff --git a/contrib/gcc/config/elfos.h b/contrib/gcc/config/elfos.h deleted file mode 100644 index d48261591981..000000000000 --- a/contrib/gcc/config/elfos.h +++ /dev/null @@ -1,705 +0,0 @@ -/* elfos.h -- operating system specific defines to be used when - targeting GCC for some generic ELF system - Copyright (C) 1991, 1994, 1995, 1999, 2000 Free Software Foundation, Inc. - Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* For the sake of libgcc2.c, indicate target supports atexit. */ -#define HAVE_ATEXIT - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared: \ - %{!symbolic: \ - %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\ - crtbegin.o%s" - -/* Attach a special .ident directive to the end of the file to identify - the version of GCC which compiled this code. The format of the - .ident string is patterned after the ones produced by native svr4 - C compilers. */ - -#define IDENT_ASM_OP ".ident" - -#define ASM_FILE_END(FILE) \ -do { \ - if (!flag_no_ident) \ - fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \ - IDENT_ASM_OP, version_string); \ - } while (0) - -/* Output #ident as a .ident. */ - -#define ASM_OUTPUT_IDENT(FILE, NAME) \ - fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); - -/* Use periods rather than dollar signs in special g++ assembler names. */ - -#define NO_DOLLAR_IN_LABEL - -/* Writing `int' for a bitfield forces int alignment for the structure. */ - -#define PCC_BITFIELD_TYPE_MATTERS 1 - -/* Implicit library calls should use memcpy, not bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS - -/* Handle #pragma weak and #pragma pack. */ - -#define HANDLE_SYSV_PRAGMA - -/* System V Release 4 uses DWARF debugging info. */ - -#define DWARF_DEBUGGING_INFO - -/* All ELF targets can support DWARF-2. */ - -#define DWARF2_DEBUGGING_INFO - -/* Also allow them to support STABS debugging. */ - -#include "dbxelf.h" - -/* The GNU tools operate better with stabs. Since we don't have - any native tools to be compatible with, default to stabs. */ - -#ifndef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG -#endif - -#undef ASM_BYTE_OP -#define ASM_BYTE_OP ".byte" - -#undef SET_ASM_OP -#define SET_ASM_OP ".set" - -/* This is how to begin an assembly language file. Most svr4 assemblers want - at least a .file directive to come first, and some want to see a .version - directive come right after that. Here we just establish a default - which generates only the .file directive. If you need a .version - directive for any specific target, you should override this definition - in the target-specific file which includes this one. */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - output_file_directive ((FILE), main_input_filename) - -/* This is how to allocate empty space in some section. The .zero - pseudo-op is used for this on most svr4 assemblers. */ - -#define SKIP_ASM_OP ".zero" - -#undef ASM_OUTPUT_SKIP -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE)) - -/* This is how to output a reference to a user-level label named NAME. - `assemble_name' uses this. - - For System V Release 4 the convention is *not* to prepend a leading - underscore onto user-level symbol names. */ - -#undef ASM_OUTPUT_LABELREF -#define ASM_OUTPUT_LABELREF(FILE,NAME) fprintf (FILE, "%s", NAME) - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - - For most svr4 systems, the convention is that any symbol which begins - with a period is not put into the linker symbol table by the assembler. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \ -do { \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \ -} while (0) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. - - For most svr4 systems, the convention is that any symbol which begins - with a period is not put into the linker symbol table by the assembler. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ -do { \ - sprintf (LABEL, "*.%s%d", PREFIX, NUM); \ -} while (0) - -/* Output the label which precedes a jumptable. Note that for all svr4 - systems where we actually generate jumptables (which is to say every - svr4 target except i386, where we use casesi instead) we put the jump- - tables into the .rodata section and since other stuff could have been - put into the .rodata section prior to any given jumptable, we have to - make sure that the location counter for the .rodata section gets pro- - perly re-aligned prior to the actual beginning of the jump table. */ - -#define ALIGN_ASM_OP ".align" - -#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL -#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ - ASM_OUTPUT_ALIGN ((FILE), 2); -#endif - -#undef ASM_OUTPUT_CASE_LABEL -#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ - do { \ - ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \ - } while (0) - -/* The standard SVR4 assembler seems to require that certain builtin - library routines (e.g. .udiv) be explicitly declared as .globl - in each assembly file where they are referenced. */ - -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ - ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) - -/* This says how to output assembler code to declare an - uninitialized external linkage data object. Under SVR4, - the linker seems to want the alignment of data objects - to depend on their types. We do exactly that here. */ - -#define COMMON_ASM_OP ".comm" - -#undef ASM_OUTPUT_ALIGNED_COMMON -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ -} while (0) - -/* This says how to output assembler code to declare an - uninitialized internal linkage data object. Under SVR4, - the linker seems to want the alignment of data objects - to depend on their types. We do exactly that here. */ - -#define LOCAL_ASM_OP ".local" - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), "\n"); \ - ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ -} while (0) - -/* This is the pseudo-op used to generate a 32-bit word of data with a - specific value in some section. This is the same for all known svr4 - assemblers. */ - -#define INT_ASM_OP ".long" - -/* This is the pseudo-op used to generate a contiguous sequence of byte - values from a double-quoted string WITHOUT HAVING A TERMINATING NUL - AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ - -#undef ASCII_DATA_ASM_OP -#define ASCII_DATA_ASM_OP ".ascii" - -/* Support const sections and the ctors and dtors sections for g++. - Note that there appears to be two different ways to support const - sections at the moment. You can either #define the symbol - READONLY_DATA_SECTION (giving it some code which switches to the - readonly data section) or else you can #define the symbols - EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and - SELECT_RTX_SECTION. We do both here just to be on the safe side. */ - -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP ".section\t.rodata" - -/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. - - Note that we want to give these sections the SHF_WRITE attribute - because these sections will actually contain data (i.e. tables of - addresses of functions in the current root executable or shared library - file) and, in the case of a shared library, the relocatable addresses - will have to be properly resolved/relocated (and then written into) by - the dynamic linker when it actually attaches the given shared library - to the executing process. (Note that on SVR4, you may wish to use the - `-z text' option to the ELF linker, when building a shared library, as - an additional check that you are doing everything right. But if you do - use the `-z text' option when building a shared library, you will get - errors unless the .ctors and .dtors sections are marked as writable - via the SHF_WRITE attribute.) */ - -#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\"" -#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\"" - -/* On svr4, we *do* have support for the .init and .fini sections, and we - can put stuff in there to be executed before and after `main'. We let - crtstuff.c and other files know this by defining the following symbols. - The definitions say how to change sections to the .init and .fini - sections. This is the same for all known svr4 assemblers. */ - -#define INIT_SECTION_ASM_OP ".section\t.init" -#define FINI_SECTION_ASM_OP ".section\t.fini" - -/* A default list of other sections which we might be "in" at any given - time. For targets that use additional sections (e.g. .tdesc) you - should override this definition in the target-specific file which - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_ctors, in_dtors - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION - -#define READONLY_DATA_SECTION() const_section () - -extern void text_section (); - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -/* Switch into a generic section. - This is currently only used to support section attributes. */ - -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ -do { \ - static struct section_info \ - { \ - struct section_info *next; \ - char *name; \ - enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ - } *sections; \ - struct section_info *s; \ - char *mode; \ - enum sect_enum type; \ - \ - for (s = sections; s; s = s->next) \ - if (!strcmp (NAME, s->name)) \ - break; \ - \ - if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ - type = SECT_EXEC, mode = "ax"; \ - else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ - type = SECT_RO, mode = "a"; \ - else \ - type = SECT_RW, mode = "aw"; \ - \ - if (s == 0) \ - { \ - s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ - s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ - strcpy (s->name, NAME); \ - s->type = type; \ - s->next = sections; \ - sections = s; \ - fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, mode); \ - } \ - else \ - { \ - if (DECL && s->type != type) \ - error_with_decl (DECL, "%s causes a section type conflict"); \ - \ - fprintf (FILE, ".section\t%s\n", NAME); \ - } \ -} while (0) - -#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) -#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL)) -#define UNIQUE_SECTION(DECL,RELOC) \ -do { \ - int len; \ - char *name, *string, *prefix; \ - \ - name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ - \ - if (! DECL_ONE_ONLY (DECL)) \ - { \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ - prefix = ".text."; \ - else if (DECL_READONLY_SECTION (DECL, RELOC)) \ - prefix = ".rodata."; \ - else \ - prefix = ".data."; \ - } \ - else if (TREE_CODE (DECL) == FUNCTION_DECL) \ - prefix = ".gnu.linkonce.t."; \ - else if (DECL_READONLY_SECTION (DECL, RELOC)) \ - prefix = ".gnu.linkonce.r."; \ - else \ - prefix = ".gnu.linkonce.d."; \ - \ - len = strlen (name) + strlen (prefix); \ - string = alloca (len + 1); \ - sprintf (string, "%s%s", prefix, name); \ - \ - DECL_SECTION_NAME (DECL) = build_string (len, string); \ -} while (0) -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement or statements to switch to the appropriate - section for output of DECL. DECL is either a `VAR_DECL' node - or a constant of some sort. RELOC indicates whether forming - the initial value of DECL requires link-time relocations. */ - -#define SELECT_SECTION(DECL,RELOC) \ -{ \ - if (TREE_CODE (DECL) == STRING_CST) \ - { \ - if (! flag_writable_strings) \ - const_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (DECL) == VAR_DECL \ - || TREE_CODE (DECL) == CONSTRUCTOR) \ - { \ - if ((flag_pic && RELOC) \ - || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ - || !DECL_INITIAL (DECL) \ - || (DECL_INITIAL (DECL) != error_mark_node \ - && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ - data_section (); \ - else \ - const_section (); \ - } \ - else \ - const_section (); \ -} - -/* A C statement or statements to switch to the appropriate - section for output of RTX in mode MODE. RTX is some kind - of constant in RTL. The argument MODE is redundant except - in the case of a `const_int' rtx. Currently, these always - go into the const section. */ - -#undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX) const_section() - -/* Define the strings used for the special svr4 .type and .size directives. - These strings generally do not vary from one system running svr4 to - another, but if a given system (e.g. m88k running svr) needs to use - different pseudo-op names for these, they may be overridden in the - file which includes this one. */ - -#define TYPE_ASM_OP ".type" -#define SIZE_ASM_OP ".size" - -/* This is how we tell the assembler that a symbol is weak. */ - -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -/* The following macro defines the format used to output the second - operand of the .type assembler directive. Different svr4 assemblers - expect various different forms for this operand. The one given here - is just a default. You may need to override it in your machine- - specific tm.h file (depending upon the particulars of your assembler). */ - -#define TYPE_OPERAND_FMT "@%s" - -/* Write the extra assembler code needed to declare a function's result. - Most svr4 assemblers don't require any special declaration of the - result value, but there are exceptions. */ - -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -/* These macros generate the special .type and .size directives which - are used to set the corresponding fields of the linker symbol table - entries in an ELF object file under SVR4. These macros also output - the starting labels for the relevant functions/objects. */ - -/* Write the extra assembler code needed to declare a function properly. - Some svr4 assemblers need to also have something extra said about the - function's return value. We allow for that here. */ - -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', FILE); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Write the extra assembler code needed to declare an object properly. */ - -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', FILE); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Output the size directive for a decl in rest_of_decl_compilation - in the case where we did not do so before the initializer. - Once we find the error_mark_node, we know that the value of - size_directive_output was set - by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ - -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - } while (0) - -/* This is how to declare the size of a function. */ - -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - { \ - char label[256]; \ - static int labelno; \ - labelno++; \ - ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, (FNAME)); \ - fprintf (FILE, ","); \ - assemble_name (FILE, label); \ - fprintf (FILE, "-"); \ - assemble_name (FILE, (FNAME)); \ - putc ('\n', FILE); \ - } \ - } while (0) - -/* A table of bytes codes used by the ASM_OUTPUT_ASCII and - ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table - corresponds to a particular byte value [0..255]. For any - given byte value, if the value in the corresponding table - position is zero, the given character can be output directly. - If the table value is 1, the byte must be output as a \ooo - octal escape. If the tables value is anything else, then the - byte value should be output as a \ followed by the value - in the table. Note that we can use standard UN*X escape - sequences for many control characters, but we don't use - \a to represent BEL because some svr4 assemblers (e.g. on - the i386) don't know about that. Also, we don't use \v - since some versions of gas, such as 2.2 did not accept it. */ - -#define ESCAPES \ -"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" - -/* Some svr4 assemblers have a limit on the number of characters which - can appear in the operand of a .string directive. If your assembler - has such a limitation, you should define STRING_LIMIT to reflect that - limit. Note that at least some svr4 assemblers have a limit on the - actual number of bytes in the double-quoted string, and that they - count each character in an escape sequence as one byte. Thus, an - escape sequence like \377 would count as four bytes. - - If your target assembler doesn't support the .string directive, you - should define this to zero. -*/ - -#define STRING_LIMIT ((unsigned) 256) - -#define STRING_ASM_OP ".string" - -/* The routine used to output NUL terminated strings. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable, especially for targets like the i386 - (where the only alternative is to output character sequences as - comma separated lists of numbers). */ - -#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ - do \ - { \ - register unsigned char *_limited_str = (unsigned char *) (STR); \ - register unsigned ch; \ - fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ - for (; ch = *_limited_str; _limited_str++) \ - { \ - register int escape; \ - switch (escape = ESCAPES[ch]) \ - { \ - case 0: \ - putc (ch, (FILE)); \ - break; \ - case 1: \ - fprintf ((FILE), "\\%03o", ch); \ - break; \ - default: \ - putc ('\\', (FILE)); \ - putc (escape, (FILE)); \ - break; \ - } \ - } \ - fprintf ((FILE), "\"\n"); \ - } \ - while (0) - -/* The routine used to output sequences of byte values. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable. Note that if we find subparts of the - character sequence which end with NUL (and which are shorter than - STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ - -#undef ASM_OUTPUT_ASCII -#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ - do \ - { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ - register unsigned bytes_in_chunk = 0; \ - for (; _ascii_bytes < limit; _ascii_bytes++) \ - { \ - register unsigned char *p; \ - if (bytes_in_chunk >= 60) \ - { \ - fprintf ((FILE), "\"\n"); \ - bytes_in_chunk = 0; \ - } \ - for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ - continue; \ - if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ - { \ - if (bytes_in_chunk > 0) \ - { \ - fprintf ((FILE), "\"\n"); \ - bytes_in_chunk = 0; \ - } \ - ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ - _ascii_bytes = p; \ - } \ - else \ - { \ - register int escape; \ - register unsigned ch; \ - if (bytes_in_chunk == 0) \ - fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP); \ - switch (escape = ESCAPES[ch = *_ascii_bytes]) \ - { \ - case 0: \ - putc (ch, (FILE)); \ - bytes_in_chunk++; \ - break; \ - case 1: \ - fprintf ((FILE), "\\%03o", ch); \ - bytes_in_chunk += 4; \ - break; \ - default: \ - putc ('\\', (FILE)); \ - putc (escape, (FILE)); \ - bytes_in_chunk += 2; \ - break; \ - } \ - } \ - } \ - if (bytes_in_chunk > 0) \ - fprintf ((FILE), "\"\n"); \ - } \ - while (0) - -/* All SVR4 targets use the ELF object file format. */ -#define OBJECT_FORMAT_ELF diff --git a/contrib/gcc/config/float-i128.h b/contrib/gcc/config/float-i128.h deleted file mode 100644 index 6a9dd48b1a30..000000000000 --- a/contrib/gcc/config/float-i128.h +++ /dev/null @@ -1,96 +0,0 @@ -/* float.h for target with IEEE 32, 64 and 128 bit floating point formats */ -#ifndef _FLOAT_H_ -#define _FLOAT_H_ -/* Produced by enquire version 4.3, CWI, Amsterdam */ - - /* Radix of exponent representation */ -#undef FLT_RADIX -#define FLT_RADIX 2 - /* Number of base-FLT_RADIX digits in the significand of a float */ -#undef FLT_MANT_DIG -#define FLT_MANT_DIG 24 - /* Number of decimal digits of precision in a float */ -#undef FLT_DIG -#define FLT_DIG 6 - /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */ -#undef FLT_ROUNDS -#define FLT_ROUNDS 1 - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#undef FLT_EPSILON -#define FLT_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#undef FLT_MIN_EXP -#define FLT_MIN_EXP (-125) - /* Minimum normalised float */ -#undef FLT_MIN -#define FLT_MIN 1.17549435e-38F - /* Minimum int x such that 10**x is a normalised float */ -#undef FLT_MIN_10_EXP -#define FLT_MIN_10_EXP (-37) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#undef FLT_MAX_EXP -#define FLT_MAX_EXP 128 - /* Maximum float */ -#undef FLT_MAX -#define FLT_MAX 3.40282347e+38F - /* Maximum int x such that 10**x is a representable float */ -#undef FLT_MAX_10_EXP -#define FLT_MAX_10_EXP 38 - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#undef DBL_MANT_DIG -#define DBL_MANT_DIG 53 - /* Number of decimal digits of precision in a double */ -#undef DBL_DIG -#define DBL_DIG 15 - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#undef DBL_EPSILON -#define DBL_EPSILON 2.2204460492503131e-16 - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#undef DBL_MIN_EXP -#define DBL_MIN_EXP (-1021) - /* Minimum normalised double */ -#undef DBL_MIN -#define DBL_MIN 2.2250738585072014e-308 - /* Minimum int x such that 10**x is a normalised double */ -#undef DBL_MIN_10_EXP -#define DBL_MIN_10_EXP (-307) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#undef DBL_MAX_EXP -#define DBL_MAX_EXP 1024 - /* Maximum double */ -#undef DBL_MAX -#define DBL_MAX 1.7976931348623157e+308 - /* Maximum int x such that 10**x is a representable double */ -#undef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 308 - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#undef LDBL_MANT_DIG -#define LDBL_MANT_DIG 113 - /* Number of decimal digits of precision in a long double */ -#undef LDBL_DIG -#define LDBL_DIG 33 - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#undef LDBL_EPSILON -#define LDBL_EPSILON 1.925929944387235853055977942584927319E-34L - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#undef LDBL_MIN_EXP -#define LDBL_MIN_EXP (-16381) - /* Minimum normalised long double */ -#undef LDBL_MIN -#define LDBL_MIN 3.362103143112093506262677817321752603E-4932L - /* Minimum int x such that 10**x is a normalised long double */ -#undef LDBL_MIN_10_EXP -#define LDBL_MIN_10_EXP (-4931) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#undef LDBL_MAX_EXP -#define LDBL_MAX_EXP 16384 - /* Maximum long double */ -#undef LDBL_MAX -#define LDBL_MAX 1.189731495357231765085759326628007016E+4932L - /* Maximum int x such that 10**x is a representable long double */ -#undef LDBL_MAX_10_EXP -#define LDBL_MAX_10_EXP 4932 - -#endif /* _FLOAT_H_ */ diff --git a/contrib/gcc/config/float-i32.h b/contrib/gcc/config/float-i32.h deleted file mode 100644 index c834926b0857..000000000000 --- a/contrib/gcc/config/float-i32.h +++ /dev/null @@ -1,96 +0,0 @@ -/* float.h for target with only IEEE 32 bit floating point format */ -#ifndef _FLOAT_H_ -#define _FLOAT_H_ -/* Produced by enquire version 4.3, CWI, Amsterdam */ - - /* Radix of exponent representation */ -#undef FLT_RADIX -#define FLT_RADIX 2 - /* Number of base-FLT_RADIX digits in the significand of a float */ -#undef FLT_MANT_DIG -#define FLT_MANT_DIG 24 - /* Number of decimal digits of precision in a float */ -#undef FLT_DIG -#define FLT_DIG 6 - /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */ -#undef FLT_ROUNDS -#define FLT_ROUNDS 1 - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#undef FLT_EPSILON -#define FLT_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#undef FLT_MIN_EXP -#define FLT_MIN_EXP (-125) - /* Minimum normalised float */ -#undef FLT_MIN -#define FLT_MIN 1.17549435e-38F - /* Minimum int x such that 10**x is a normalised float */ -#undef FLT_MIN_10_EXP -#define FLT_MIN_10_EXP (-37) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#undef FLT_MAX_EXP -#define FLT_MAX_EXP 128 - /* Maximum float */ -#undef FLT_MAX -#define FLT_MAX 3.40282347e+38F - /* Maximum int x such that 10**x is a representable float */ -#undef FLT_MAX_10_EXP -#define FLT_MAX_10_EXP 38 - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#undef DBL_MANT_DIG -#define DBL_MANT_DIG 24 - /* Number of decimal digits of precision in a double */ -#undef DBL_DIG -#define DBL_DIG 6 - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#undef DBL_EPSILON -#define DBL_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#undef DBL_MIN_EXP -#define DBL_MIN_EXP (-125) - /* Minimum normalised double */ -#undef DBL_MIN -#define DBL_MIN 1.17549435e-38F - /* Minimum int x such that 10**x is a normalised double */ -#undef DBL_MIN_10_EXP -#define DBL_MIN_10_EXP (-37) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#undef DBL_MAX_EXP -#define DBL_MAX_EXP 128 - /* Maximum double */ -#undef DBL_MAX -#define DBL_MAX 3.40282347e+38F - /* Maximum int x such that 10**x is a representable double */ -#undef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 38 - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#undef LDBL_MANT_DIG -#define LDBL_MANT_DIG 24 - /* Number of decimal digits of precision in a long double */ -#undef LDBL_DIG -#define LDBL_DIG 6 - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#undef LDBL_EPSILON -#define LDBL_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#undef LDBL_MIN_EXP -#define LDBL_MIN_EXP (-125) - /* Minimum normalised long double */ -#undef LDBL_MIN -#define LDBL_MIN 1.17549435e-38F - /* Minimum int x such that 10**x is a normalised long double */ -#undef LDBL_MIN_10_EXP -#define LDBL_MIN_10_EXP (-37) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#undef LDBL_MAX_EXP -#define LDBL_MAX_EXP 128 - /* Maximum long double */ -#undef LDBL_MAX -#define LDBL_MAX 3.40282347e+38F - /* Maximum int x such that 10**x is a representable long double */ -#undef LDBL_MAX_10_EXP -#define LDBL_MAX_10_EXP 38 - -#endif /* _FLOAT_H_ */ diff --git a/contrib/gcc/config/float-i386.h b/contrib/gcc/config/float-i386.h deleted file mode 100644 index 2d14f702c56c..000000000000 --- a/contrib/gcc/config/float-i386.h +++ /dev/null @@ -1,104 +0,0 @@ -/* float.h for target with IEEE 32/64 bit and Intel 386 style 80 bit - floating point formats */ -#ifndef _FLOAT_H_ -#define _FLOAT_H_ -/* Produced by enquire version 4.3, CWI, Amsterdam */ - - /* Radix of exponent representation */ -#undef FLT_RADIX -#define FLT_RADIX 2 - /* Number of base-FLT_RADIX digits in the significand of a float */ -#undef FLT_MANT_DIG -#define FLT_MANT_DIG 24 - /* Number of decimal digits of precision in a float */ -#undef FLT_DIG -#define FLT_DIG 6 - /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */ -#undef FLT_ROUNDS -#define FLT_ROUNDS 1 - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#undef FLT_EPSILON -#define FLT_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#undef FLT_MIN_EXP -#define FLT_MIN_EXP (-125) - /* Minimum normalised float */ -#undef FLT_MIN -#define FLT_MIN 1.17549435e-38F - /* Minimum int x such that 10**x is a normalised float */ -#undef FLT_MIN_10_EXP -#define FLT_MIN_10_EXP (-37) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#undef FLT_MAX_EXP -#define FLT_MAX_EXP 128 - /* Maximum float */ -#undef FLT_MAX -#define FLT_MAX 3.40282347e+38F - /* Maximum int x such that 10**x is a representable float */ -#undef FLT_MAX_10_EXP -#define FLT_MAX_10_EXP 38 - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#undef DBL_MANT_DIG -#define DBL_MANT_DIG 53 - /* Number of decimal digits of precision in a double */ -#undef DBL_DIG -#define DBL_DIG 15 - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#undef DBL_EPSILON -#define DBL_EPSILON 2.2204460492503131e-16 - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#undef DBL_MIN_EXP -#define DBL_MIN_EXP (-1021) - /* Minimum normalised double */ -#undef DBL_MIN -#define DBL_MIN 2.2250738585072014e-308 - /* Minimum int x such that 10**x is a normalised double */ -#undef DBL_MIN_10_EXP -#define DBL_MIN_10_EXP (-307) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#undef DBL_MAX_EXP -#define DBL_MAX_EXP 1024 - /* Maximum double */ -#undef DBL_MAX -#define DBL_MAX 1.7976931348623157e+308 - /* Maximum int x such that 10**x is a representable double */ -#undef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 308 - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#undef LDBL_MANT_DIG -#define LDBL_MANT_DIG 64 - /* Number of decimal digits of precision in a long double */ -#undef LDBL_DIG -#define LDBL_DIG 18 - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#undef LDBL_EPSILON -#ifndef __LDBL_UNION__ -#define __LDBL_UNION__ -union __convert_long_double { - unsigned __convert_long_double_i[4]; - long double __convert_long_double_d; -}; -#endif -#define LDBL_EPSILON (__extension__ ((union __convert_long_double) {__convert_long_double_i: {0x0, 0x80000000, 0x3fc0, 0x0}}).__convert_long_double_d) - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#undef LDBL_MIN_EXP -#define LDBL_MIN_EXP (-16381) - /* Minimum normalised long double */ -#undef LDBL_MIN -#define LDBL_MIN (__extension__ ((union __convert_long_double) {__convert_long_double_i: {0x0, 0x80000000, 0x1, 0x0}}).__convert_long_double_d) - /* Minimum int x such that 10**x is a normalised long double */ -#undef LDBL_MIN_10_EXP -#define LDBL_MIN_10_EXP (-4931) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#undef LDBL_MAX_EXP -#define LDBL_MAX_EXP 16384 - /* Maximum long double */ -#undef LDBL_MAX -#define LDBL_MAX (__extension__ ((union __convert_long_double) {__convert_long_double_i: {0xffffffff, 0xffffffff, 0x107ffe, 0x0}}).__convert_long_double_d) - /* Maximum int x such that 10**x is a representable long double */ -#undef LDBL_MAX_10_EXP -#define LDBL_MAX_10_EXP 4932 - -#endif /* _FLOAT_H___ */ diff --git a/contrib/gcc/config/float-i64.h b/contrib/gcc/config/float-i64.h deleted file mode 100644 index 7dbe4e92a10e..000000000000 --- a/contrib/gcc/config/float-i64.h +++ /dev/null @@ -1,96 +0,0 @@ -/* float.h for target with IEEE 32 bit and 64 bit floating point formats */ -#ifndef _FLOAT_H_ -#define _FLOAT_H_ -/* Produced by enquire version 4.3, CWI, Amsterdam */ - - /* Radix of exponent representation */ -#undef FLT_RADIX -#define FLT_RADIX 2 - /* Number of base-FLT_RADIX digits in the significand of a float */ -#undef FLT_MANT_DIG -#define FLT_MANT_DIG 24 - /* Number of decimal digits of precision in a float */ -#undef FLT_DIG -#define FLT_DIG 6 - /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */ -#undef FLT_ROUNDS -#define FLT_ROUNDS 1 - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#undef FLT_EPSILON -#define FLT_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#undef FLT_MIN_EXP -#define FLT_MIN_EXP (-125) - /* Minimum normalised float */ -#undef FLT_MIN -#define FLT_MIN 1.17549435e-38F - /* Minimum int x such that 10**x is a normalised float */ -#undef FLT_MIN_10_EXP -#define FLT_MIN_10_EXP (-37) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#undef FLT_MAX_EXP -#define FLT_MAX_EXP 128 - /* Maximum float */ -#undef FLT_MAX -#define FLT_MAX 3.40282347e+38F - /* Maximum int x such that 10**x is a representable float */ -#undef FLT_MAX_10_EXP -#define FLT_MAX_10_EXP 38 - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#undef DBL_MANT_DIG -#define DBL_MANT_DIG 53 - /* Number of decimal digits of precision in a double */ -#undef DBL_DIG -#define DBL_DIG 15 - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#undef DBL_EPSILON -#define DBL_EPSILON 2.2204460492503131e-16 - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#undef DBL_MIN_EXP -#define DBL_MIN_EXP (-1021) - /* Minimum normalised double */ -#undef DBL_MIN -#define DBL_MIN 2.2250738585072014e-308 - /* Minimum int x such that 10**x is a normalised double */ -#undef DBL_MIN_10_EXP -#define DBL_MIN_10_EXP (-307) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#undef DBL_MAX_EXP -#define DBL_MAX_EXP 1024 - /* Maximum double */ -#undef DBL_MAX -#define DBL_MAX 1.7976931348623157e+308 - /* Maximum int x such that 10**x is a representable double */ -#undef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 308 - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#undef LDBL_MANT_DIG -#define LDBL_MANT_DIG 53 - /* Number of decimal digits of precision in a long double */ -#undef LDBL_DIG -#define LDBL_DIG 15 - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#undef LDBL_EPSILON -#define LDBL_EPSILON 2.2204460492503131e-16L - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#undef LDBL_MIN_EXP -#define LDBL_MIN_EXP (-1021) - /* Minimum normalised long double */ -#undef LDBL_MIN -#define LDBL_MIN 2.2250738585072014e-308L - /* Minimum int x such that 10**x is a normalised long double */ -#undef LDBL_MIN_10_EXP -#define LDBL_MIN_10_EXP (-307) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#undef LDBL_MAX_EXP -#define LDBL_MAX_EXP 1024 - /* Maximum long double */ -#undef LDBL_MAX -#define LDBL_MAX 1.7976931348623157e+308L - /* Maximum int x such that 10**x is a representable long double */ -#undef LDBL_MAX_10_EXP -#define LDBL_MAX_10_EXP 308 - -#endif /* _FLOAT_H_ */ diff --git a/contrib/gcc/config/float-m68k.h b/contrib/gcc/config/float-m68k.h deleted file mode 100644 index b36d447cb877..000000000000 --- a/contrib/gcc/config/float-m68k.h +++ /dev/null @@ -1,97 +0,0 @@ -/* float.h for target with IEEE 32 bit and 64 bit and Motorola style 96 bit - floating point formats */ -#ifndef _FLOAT_H_ -#define _FLOAT_H_ -/* Produced by enquire version 4.3, CWI, Amsterdam */ - - /* Radix of exponent representation */ -#undef FLT_RADIX -#define FLT_RADIX 2 - /* Number of base-FLT_RADIX digits in the significand of a float */ -#undef FLT_MANT_DIG -#define FLT_MANT_DIG 24 - /* Number of decimal digits of precision in a float */ -#undef FLT_DIG -#define FLT_DIG 6 - /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */ -#undef FLT_ROUNDS -#define FLT_ROUNDS 1 - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#undef FLT_EPSILON -#define FLT_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#undef FLT_MIN_EXP -#define FLT_MIN_EXP (-125) - /* Minimum normalised float */ -#undef FLT_MIN -#define FLT_MIN 1.17549435e-38F - /* Minimum int x such that 10**x is a normalised float */ -#undef FLT_MIN_10_EXP -#define FLT_MIN_10_EXP (-37) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#undef FLT_MAX_EXP -#define FLT_MAX_EXP 128 - /* Maximum float */ -#undef FLT_MAX -#define FLT_MAX 3.40282347e+38F - /* Maximum int x such that 10**x is a representable float */ -#undef FLT_MAX_10_EXP -#define FLT_MAX_10_EXP 38 - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#undef DBL_MANT_DIG -#define DBL_MANT_DIG 53 - /* Number of decimal digits of precision in a double */ -#undef DBL_DIG -#define DBL_DIG 15 - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#undef DBL_EPSILON -#define DBL_EPSILON 2.2204460492503131e-16 - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#undef DBL_MIN_EXP -#define DBL_MIN_EXP (-1021) - /* Minimum normalised double */ -#undef DBL_MIN -#define DBL_MIN 2.2250738585072014e-308 - /* Minimum int x such that 10**x is a normalised double */ -#undef DBL_MIN_10_EXP -#define DBL_MIN_10_EXP (-307) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#undef DBL_MAX_EXP -#define DBL_MAX_EXP 1024 - /* Maximum double */ -#undef DBL_MAX -#define DBL_MAX 1.7976931348623157e+308 - /* Maximum int x such that 10**x is a representable double */ -#undef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 308 - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#undef LDBL_MANT_DIG -#define LDBL_MANT_DIG 64 - /* Number of decimal digits of precision in a long double */ -#undef LDBL_DIG -#define LDBL_DIG 18 - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#undef LDBL_EPSILON -#define LDBL_EPSILON 1.08420217248550443401e-19L - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#undef LDBL_MIN_EXP -#define LDBL_MIN_EXP (-16382) - /* Minimum normalised long double */ -#undef LDBL_MIN -#define LDBL_MIN 1.68105157155604675313e-4932L - /* Minimum int x such that 10**x is a normalised long double */ -#undef LDBL_MIN_10_EXP -#define LDBL_MIN_10_EXP (-4931) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#undef LDBL_MAX_EXP -#define LDBL_MAX_EXP 16384 - /* Maximum long double */ -#undef LDBL_MAX -#define LDBL_MAX 1.18973149535723176502e+4932L - /* Maximum int x such that 10**x is a representable long double */ -#undef LDBL_MAX_10_EXP -#define LDBL_MAX_10_EXP 4932 - -#endif /* _FLOAT_H_ */ diff --git a/contrib/gcc/config/float-sh.h b/contrib/gcc/config/float-sh.h deleted file mode 100644 index 446692428c2e..000000000000 --- a/contrib/gcc/config/float-sh.h +++ /dev/null @@ -1,130 +0,0 @@ -/* float.h for target sh3e with optional IEEE 32 bit double format */ -#ifndef _FLOAT_H_ -#define _FLOAT_H_ -/* Produced by enquire version 4.3, CWI, Amsterdam */ - - /* Radix of exponent representation */ -#undef FLT_RADIX -#define FLT_RADIX 2 - /* Number of base-FLT_RADIX digits in the significand of a float */ -#undef FLT_MANT_DIG -#define FLT_MANT_DIG 24 - /* Number of decimal digits of precision in a float */ -#undef FLT_DIG -#define FLT_DIG 6 - /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */ -#undef FLT_ROUNDS -#define FLT_ROUNDS 1 - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#undef FLT_EPSILON -#define FLT_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#undef FLT_MIN_EXP -#define FLT_MIN_EXP (-125) - /* Minimum normalised float */ -#undef FLT_MIN -#define FLT_MIN 1.17549435e-38F - /* Minimum int x such that 10**x is a normalised float */ -#undef FLT_MIN_10_EXP -#define FLT_MIN_10_EXP (-37) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#undef FLT_MAX_EXP -#define FLT_MAX_EXP 128 - /* Maximum float */ -#undef FLT_MAX -#define FLT_MAX 3.40282347e+38F - /* Maximum int x such that 10**x is a representable float */ -#undef FLT_MAX_10_EXP -#define FLT_MAX_10_EXP 38 - -#if defined (__SH3E__) || defined (__SH4_SINGLE_ONLY__) - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#undef DBL_MANT_DIG -#define DBL_MANT_DIG 24 - /* Number of decimal digits of precision in a double */ -#undef DBL_DIG -#define DBL_DIG 6 - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#undef DBL_EPSILON -#define DBL_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#undef DBL_MIN_EXP -#define DBL_MIN_EXP (-125) - /* Minimum normalised double */ -#undef DBL_MIN -#define DBL_MIN 1.17549435e-38F - /* Minimum int x such that 10**x is a normalised double */ -#undef DBL_MIN_10_EXP -#define DBL_MIN_10_EXP (-37) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#undef DBL_MAX_EXP -#define DBL_MAX_EXP 128 - /* Maximum double */ -#undef DBL_MAX -#define DBL_MAX 3.40282347e+38F - /* Maximum int x such that 10**x is a representable double */ -#undef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 38 - -#else - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#undef DBL_MANT_DIG -#define DBL_MANT_DIG 53 - /* Number of decimal digits of precision in a double */ -#undef DBL_DIG -#define DBL_DIG 15 - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#undef DBL_EPSILON -#define DBL_EPSILON 2.2204460492503131e-16 - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#undef DBL_MIN_EXP -#define DBL_MIN_EXP (-1021) - /* Minimum normalised double */ -#undef DBL_MIN -#define DBL_MIN 2.2250738585072014e-308 - /* Minimum int x such that 10**x is a normalised double */ -#undef DBL_MIN_10_EXP -#define DBL_MIN_10_EXP (-307) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#undef DBL_MAX_EXP -#define DBL_MAX_EXP 1024 - /* Maximum double */ -#undef DBL_MAX -#define DBL_MAX 1.7976931348623157e+308 - /* Maximum int x such that 10**x is a representable double */ -#undef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 308 - -#endif - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#undef LDBL_MANT_DIG -#define LDBL_MANT_DIG 53 - /* Number of decimal digits of precision in a long double */ -#undef LDBL_DIG -#define LDBL_DIG 15 - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#undef LDBL_EPSILON -#define LDBL_EPSILON 2.2204460492503131e-16 - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#undef LDBL_MIN_EXP -#define LDBL_MIN_EXP (-1021) - /* Minimum normalised long double */ -#undef LDBL_MIN -#define LDBL_MIN 2.2250738585072014e-308 - /* Minimum int x such that 10**x is a normalised long double */ -#undef LDBL_MIN_10_EXP -#define LDBL_MIN_10_EXP (-307) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#undef LDBL_MAX_EXP -#define LDBL_MAX_EXP 1024 - /* Maximum long double */ -#undef LDBL_MAX -#define LDBL_MAX 1.7976931348623157e+308 - /* Maximum int x such that 10**x is a representable long double */ -#undef LDBL_MAX_10_EXP -#define LDBL_MAX_10_EXP 308 - -#endif /* _FLOAT_H_ */ diff --git a/contrib/gcc/config/float-vax.h b/contrib/gcc/config/float-vax.h deleted file mode 100644 index 3c87f795ef2d..000000000000 --- a/contrib/gcc/config/float-vax.h +++ /dev/null @@ -1,96 +0,0 @@ -/* float.h for target with VAX floating point formats */ -#ifndef _FLOAT_H_ -#define _FLOAT_H_ -/* Produced by enquire version 4.3, CWI, Amsterdam */ - - /* Radix of exponent representation */ -#undef FLT_RADIX -#define FLT_RADIX 2 - /* Number of base-FLT_RADIX digits in the significand of a float */ -#undef FLT_MANT_DIG -#define FLT_MANT_DIG 24 - /* Number of decimal digits of precision in a float */ -#undef FLT_DIG -#define FLT_DIG 6 - /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */ -#undef FLT_ROUNDS -#define FLT_ROUNDS 1 - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#undef FLT_EPSILON -#define FLT_EPSILON 1.19209290e-07F - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#undef FLT_MIN_EXP -#define FLT_MIN_EXP (-127) - /* Minimum normalised float */ -#undef FLT_MIN -#define FLT_MIN 2.93873588e-39F - /* Minimum int x such that 10**x is a normalised float */ -#undef FLT_MIN_10_EXP -#define FLT_MIN_10_EXP (-38) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#undef FLT_MAX_EXP -#define FLT_MAX_EXP 127 - /* Maximum float */ -#undef FLT_MAX -#define FLT_MAX 1.70141173e+38F - /* Maximum int x such that 10**x is a representable float */ -#undef FLT_MAX_10_EXP -#define FLT_MAX_10_EXP 38 - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#undef DBL_MANT_DIG -#define DBL_MANT_DIG 56 - /* Number of decimal digits of precision in a double */ -#undef DBL_DIG -#define DBL_DIG 16 - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#undef DBL_EPSILON -#define DBL_EPSILON 2.77555756156289135e-17 - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#undef DBL_MIN_EXP -#define DBL_MIN_EXP (-127) - /* Minimum normalised double */ -#undef DBL_MIN -#define DBL_MIN 2.93873587705571877e-39 - /* Minimum int x such that 10**x is a normalised double */ -#undef DBL_MIN_10_EXP -#define DBL_MIN_10_EXP (-38) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#undef DBL_MAX_EXP -#define DBL_MAX_EXP 127 - /* Maximum double */ -#undef DBL_MAX -#define DBL_MAX 1.70141183460469229e+38 - /* Maximum int x such that 10**x is a representable double */ -#undef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 38 - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#undef LDBL_MANT_DIG -#define LDBL_MANT_DIG 56 - /* Number of decimal digits of precision in a long double */ -#undef LDBL_DIG -#define LDBL_DIG 16 - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#undef LDBL_EPSILON -#define LDBL_EPSILON 2.77555756156289135e-17 - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#undef LDBL_MIN_EXP -#define LDBL_MIN_EXP (-127) - /* Minimum normalised long double */ -#undef LDBL_MIN -#define LDBL_MIN 2.93873587705571877e-39 - /* Minimum int x such that 10**x is a normalised long double */ -#undef LDBL_MIN_10_EXP -#define LDBL_MIN_10_EXP (-38) - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#undef LDBL_MAX_EXP -#define LDBL_MAX_EXP 127 - /* Maximum long double */ -#undef LDBL_MAX -#define LDBL_MAX 1.70141183460469229e+38 - /* Maximum int x such that 10**x is a representable long double */ -#undef LDBL_MAX_10_EXP -#define LDBL_MAX_10_EXP 38 - -#endif /* _FLOAT_H_ */ diff --git a/contrib/gcc/config/fp-bit.c b/contrib/gcc/config/fp-bit.c deleted file mode 100644 index 6b8bd703f7ea..000000000000 --- a/contrib/gcc/config/fp-bit.c +++ /dev/null @@ -1,1507 +0,0 @@ -/* This is a software floating point library which can be used instead of - the floating point routines in libgcc1.c for targets without hardware - floating point. - Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - -This file 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. - -In addition to the permissions in the GNU General Public License, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file with other programs, and to distribute -those programs without any restriction coming from the use of this -file. (The General Public License restrictions do apply in other -respects; for example, they cover modification of the file, and -distribution when not linked into another program.) - -This file 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. - -You should have received a copy of the GNU General Public License -along with this program; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with other files, - some of which are compiled with GCC, to produce an executable, - this library does not by itself cause the resulting executable - to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -/* This implements IEEE 754 format arithmetic, but does not provide a - mechanism for setting the rounding mode, or for generating or handling - exceptions. - - The original code by Steve Chamberlain, hacked by Mark Eichin and Jim - Wilson, all of Cygnus Support. */ - -/* The intended way to use this file is to make two copies, add `#define FLOAT' - to one copy, then compile both copies and add them to libgcc.a. */ - -/* Defining FINE_GRAINED_LIBRARIES allows one to select which routines - from this file are compiled via additional -D options. - - This avoids the need to pull in the entire fp emulation library - when only a small number of functions are needed. - - If FINE_GRAINED_LIBRARIES is not defined, then compile every - suitable routine. */ -#ifndef FINE_GRAINED_LIBRARIES -#define L_pack_df -#define L_unpack_df -#define L_pack_sf -#define L_unpack_sf -#define L_addsub_sf -#define L_addsub_df -#define L_mul_sf -#define L_mul_df -#define L_div_sf -#define L_div_df -#define L_fpcmp_parts_sf -#define L_fpcmp_parts_df -#define L_compare_sf -#define L_compare_df -#define L_eq_sf -#define L_eq_df -#define L_ne_sf -#define L_ne_df -#define L_gt_sf -#define L_gt_df -#define L_ge_sf -#define L_ge_df -#define L_lt_sf -#define L_lt_df -#define L_le_sf -#define L_le_df -#define L_si_to_sf -#define L_si_to_df -#define L_sf_to_si -#define L_df_to_si -#define L_f_to_usi -#define L_df_to_usi -#define L_negate_sf -#define L_negate_df -#define L_make_sf -#define L_make_df -#define L_sf_to_df -#define L_df_to_sf -#endif - -/* The following macros can be defined to change the behaviour of this file: - FLOAT: Implement a `float', aka SFmode, fp library. If this is not - defined, then this file implements a `double', aka DFmode, fp library. - FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e. - don't include float->double conversion which requires the double library. - This is useful only for machines which can't support doubles, e.g. some - 8-bit processors. - CMPtype: Specify the type that floating point compares should return. - This defaults to SItype, aka int. - US_SOFTWARE_GOFAST: This makes all entry points use the same names as the - US Software goFast library. If this is not defined, the entry points use - the same names as libgcc1.c. - _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding - two integers to the FLO_union_type. - NO_NANS: Disable nan and infinity handling - SMALL_MACHINE: Useful when operations on QIs and HIs are faster - than on an SI */ - -/* We don't currently support extended floats (long doubles) on machines - without hardware to deal with them. - - These stubs are just to keep the linker from complaining about unresolved - references which can be pulled in from libio & libstdc++, even if the - user isn't using long doubles. However, they may generate an unresolved - external to abort if abort is not used by the function, and the stubs - are referenced from within libc, since libgcc goes before and after the - system library. */ - -#ifdef EXTENDED_FLOAT_STUBS -__truncxfsf2 (){ abort(); } -__extendsfxf2 (){ abort(); } -__addxf3 (){ abort(); } -__divxf3 (){ abort(); } -__eqxf2 (){ abort(); } -__extenddfxf2 (){ abort(); } -__gtxf2 (){ abort(); } -__lexf2 (){ abort(); } -__ltxf2 (){ abort(); } -__mulxf3 (){ abort(); } -__negxf2 (){ abort(); } -__nexf2 (){ abort(); } -__subxf3 (){ abort(); } -__truncxfdf2 (){ abort(); } - -__trunctfsf2 (){ abort(); } -__extendsftf2 (){ abort(); } -__addtf3 (){ abort(); } -__divtf3 (){ abort(); } -__eqtf2 (){ abort(); } -__extenddftf2 (){ abort(); } -__gttf2 (){ abort(); } -__letf2 (){ abort(); } -__lttf2 (){ abort(); } -__multf3 (){ abort(); } -__negtf2 (){ abort(); } -__netf2 (){ abort(); } -__subtf3 (){ abort(); } -__trunctfdf2 (){ abort(); } -__gexf2 (){ abort(); } -__fixxfsi (){ abort(); } -__floatsixf (){ abort(); } -#else /* !EXTENDED_FLOAT_STUBS, rest of file */ - - -typedef float SFtype __attribute__ ((mode (SF))); -typedef float DFtype __attribute__ ((mode (DF))); - -typedef int HItype __attribute__ ((mode (HI))); -typedef int SItype __attribute__ ((mode (SI))); -typedef int DItype __attribute__ ((mode (DI))); - -/* The type of the result of a fp compare */ -#ifndef CMPtype -#define CMPtype SItype -#endif - -typedef unsigned int UHItype __attribute__ ((mode (HI))); -typedef unsigned int USItype __attribute__ ((mode (SI))); -typedef unsigned int UDItype __attribute__ ((mode (DI))); - -#define MAX_SI_INT ((SItype) ((unsigned) (~0)>>1)) -#define MAX_USI_INT ((USItype) ~0) - - -#ifdef FLOAT_ONLY -#define NO_DI_MODE -#endif - -#ifdef FLOAT -# define NGARDS 7L -# define GARDROUND 0x3f -# define GARDMASK 0x7f -# define GARDMSB 0x40 -# define EXPBITS 8 -# define EXPBIAS 127 -# define FRACBITS 23 -# define EXPMAX (0xff) -# define QUIET_NAN 0x100000L -# define FRAC_NBITS 32 -# define FRACHIGH 0x80000000L -# define FRACHIGH2 0xc0000000L -# define pack_d __pack_f -# define unpack_d __unpack_f -# define __fpcmp_parts __fpcmp_parts_f - typedef USItype fractype; - typedef UHItype halffractype; - typedef SFtype FLO_type; - typedef SItype intfrac; - -#else -# define PREFIXFPDP dp -# define PREFIXSFDF df -# define NGARDS 8L -# define GARDROUND 0x7f -# define GARDMASK 0xff -# define GARDMSB 0x80 -# define EXPBITS 11 -# define EXPBIAS 1023 -# define FRACBITS 52 -# define EXPMAX (0x7ff) -# define QUIET_NAN 0x8000000000000LL -# define FRAC_NBITS 64 -# define FRACHIGH 0x8000000000000000LL -# define FRACHIGH2 0xc000000000000000LL -# define pack_d __pack_d -# define unpack_d __unpack_d -# define __fpcmp_parts __fpcmp_parts_d - typedef UDItype fractype; - typedef USItype halffractype; - typedef DFtype FLO_type; - typedef DItype intfrac; -#endif - -#ifdef US_SOFTWARE_GOFAST -# ifdef FLOAT -# define add fpadd -# define sub fpsub -# define multiply fpmul -# define divide fpdiv -# define compare fpcmp -# define si_to_float sitofp -# define float_to_si fptosi -# define float_to_usi fptoui -# define negate __negsf2 -# define sf_to_df fptodp -# define dptofp dptofp -#else -# define add dpadd -# define sub dpsub -# define multiply dpmul -# define divide dpdiv -# define compare dpcmp -# define si_to_float litodp -# define float_to_si dptoli -# define float_to_usi dptoul -# define negate __negdf2 -# define df_to_sf dptofp -#endif -#else -# ifdef FLOAT -# define add __addsf3 -# define sub __subsf3 -# define multiply __mulsf3 -# define divide __divsf3 -# define compare __cmpsf2 -# define _eq_f2 __eqsf2 -# define _ne_f2 __nesf2 -# define _gt_f2 __gtsf2 -# define _ge_f2 __gesf2 -# define _lt_f2 __ltsf2 -# define _le_f2 __lesf2 -# define si_to_float __floatsisf -# define float_to_si __fixsfsi -# define float_to_usi __fixunssfsi -# define negate __negsf2 -# define sf_to_df __extendsfdf2 -#else -# define add __adddf3 -# define sub __subdf3 -# define multiply __muldf3 -# define divide __divdf3 -# define compare __cmpdf2 -# define _eq_f2 __eqdf2 -# define _ne_f2 __nedf2 -# define _gt_f2 __gtdf2 -# define _ge_f2 __gedf2 -# define _lt_f2 __ltdf2 -# define _le_f2 __ledf2 -# define si_to_float __floatsidf -# define float_to_si __fixdfsi -# define float_to_usi __fixunsdfsi -# define negate __negdf2 -# define df_to_sf __truncdfsf2 -# endif -#endif - - -#ifndef INLINE -#define INLINE __inline__ -#endif - -/* Preserve the sticky-bit when shifting fractions to the right. */ -#define LSHIFT(a) { a = (a & 1) | (a >> 1); } - -/* numeric parameters */ -/* F_D_BITOFF is the number of bits offset between the MSB of the mantissa - of a float and of a double. Assumes there are only two float types. - (double::FRAC_BITS+double::NGARDS-(float::FRAC_BITS-float::NGARDS)) - */ -#define F_D_BITOFF (52+8-(23+7)) - - -#define NORMAL_EXPMIN (-(EXPBIAS)+1) -#define IMPLICIT_1 (1LL<<(FRACBITS+NGARDS)) -#define IMPLICIT_2 (1LL<<(FRACBITS+1+NGARDS)) - -/* common types */ - -typedef enum -{ - CLASS_SNAN, - CLASS_QNAN, - CLASS_ZERO, - CLASS_NUMBER, - CLASS_INFINITY -} fp_class_type; - -typedef struct -{ -#ifdef SMALL_MACHINE - char class; - unsigned char sign; - short normal_exp; -#else - fp_class_type class; - unsigned int sign; - int normal_exp; -#endif - - union - { - fractype ll; - halffractype l[2]; - } fraction; -} fp_number_type; - -typedef union -{ - FLO_type value; - fractype value_raw; - -#ifndef FLOAT - halffractype words[2]; -#endif - -#ifdef FLOAT_BIT_ORDER_MISMATCH - struct - { - fractype fraction:FRACBITS __attribute__ ((packed)); - unsigned int exp:EXPBITS __attribute__ ((packed)); - unsigned int sign:1 __attribute__ ((packed)); - } - bits; -#endif - -#ifdef _DEBUG_BITFLOAT - struct - { - unsigned int sign:1 __attribute__ ((packed)); - unsigned int exp:EXPBITS __attribute__ ((packed)); - fractype fraction:FRACBITS __attribute__ ((packed)); - } - bits_big_endian; - - struct - { - fractype fraction:FRACBITS __attribute__ ((packed)); - unsigned int exp:EXPBITS __attribute__ ((packed)); - unsigned int sign:1 __attribute__ ((packed)); - } - bits_little_endian; -#endif -} -FLO_union_type; - - -/* end of header */ - -/* IEEE "special" number predicates */ - -#ifdef NO_NANS - -#define nan() 0 -#define isnan(x) 0 -#define isinf(x) 0 -#else - -INLINE -static fp_number_type * -nan () -{ - static fp_number_type thenan; - - return &thenan; -} - -INLINE -static int -isnan ( fp_number_type * x) -{ - return x->class == CLASS_SNAN || x->class == CLASS_QNAN; -} - -INLINE -static int -isinf ( fp_number_type * x) -{ - return x->class == CLASS_INFINITY; -} - -#endif - -INLINE -static int -iszero ( fp_number_type * x) -{ - return x->class == CLASS_ZERO; -} - -INLINE -static void -flip_sign ( fp_number_type * x) -{ - x->sign = !x->sign; -} - -extern FLO_type pack_d ( fp_number_type * ); - -#if defined(L_pack_df) || defined(L_pack_sf) -FLO_type -pack_d ( fp_number_type * src) -{ - FLO_union_type dst; - fractype fraction = src->fraction.ll; /* wasn't unsigned before? */ - int sign = src->sign; - int exp = 0; - - if (isnan (src)) - { - exp = EXPMAX; - if (src->class == CLASS_QNAN || 1) - { - fraction |= QUIET_NAN; - } - } - else if (isinf (src)) - { - exp = EXPMAX; - fraction = 0; - } - else if (iszero (src)) - { - exp = 0; - fraction = 0; - } - else if (fraction == 0) - { - exp = 0; - } - else - { - if (src->normal_exp < NORMAL_EXPMIN) - { - /* This number's exponent is too low to fit into the bits - available in the number, so we'll store 0 in the exponent and - shift the fraction to the right to make up for it. */ - - int shift = NORMAL_EXPMIN - src->normal_exp; - - exp = 0; - - if (shift > FRAC_NBITS - NGARDS) - { - /* No point shifting, since it's more that 64 out. */ - fraction = 0; - } - else - { - /* Shift by the value */ - fraction >>= shift; - } - fraction >>= NGARDS; - } - else if (src->normal_exp > EXPBIAS) - { - exp = EXPMAX; - fraction = 0; - } - else - { - exp = src->normal_exp + EXPBIAS; - /* IF the gard bits are the all zero, but the first, then we're - half way between two numbers, choose the one which makes the - lsb of the answer 0. */ - if ((fraction & GARDMASK) == GARDMSB) - { - if (fraction & (1 << NGARDS)) - fraction += GARDROUND + 1; - } - else - { - /* Add a one to the guards to round up */ - fraction += GARDROUND; - } - if (fraction >= IMPLICIT_2) - { - fraction >>= 1; - exp += 1; - } - fraction >>= NGARDS; - } - } - - /* We previously used bitfields to store the number, but this doesn't - handle little/big endian systems conveniently, so use shifts and - masks */ -#ifdef FLOAT_BIT_ORDER_MISMATCH - dst.bits.fraction = fraction; - dst.bits.exp = exp; - dst.bits.sign = sign; -#else - dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1); - dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS; - dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS); -#endif - -#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) - { - halffractype tmp = dst.words[0]; - dst.words[0] = dst.words[1]; - dst.words[1] = tmp; - } -#endif - - return dst.value; -} -#endif - -extern void unpack_d (FLO_union_type *, fp_number_type *); - -#if defined(L_unpack_df) || defined(L_unpack_sf) -void -unpack_d (FLO_union_type * src, fp_number_type * dst) -{ - /* We previously used bitfields to store the number, but this doesn't - handle little/big endian systems conveniently, so use shifts and - masks */ - fractype fraction; - int exp; - int sign; - -#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) - FLO_union_type swapped; - - swapped.words[0] = src->words[1]; - swapped.words[1] = src->words[0]; - src = &swapped; -#endif - -#ifdef FLOAT_BIT_ORDER_MISMATCH - fraction = src->bits.fraction; - exp = src->bits.exp; - sign = src->bits.sign; -#else - fraction = src->value_raw & ((((fractype)1) << FRACBITS) - (fractype)1); - exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1); - sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1; -#endif - - dst->sign = sign; - if (exp == 0) - { - /* Hmm. Looks like 0 */ - if (fraction == 0) - { - /* tastes like zero */ - dst->class = CLASS_ZERO; - } - else - { - /* Zero exponent with non zero fraction - it's denormalized, - so there isn't a leading implicit one - we'll shift it so - it gets one. */ - dst->normal_exp = exp - EXPBIAS + 1; - fraction <<= NGARDS; - - dst->class = CLASS_NUMBER; -#if 1 - while (fraction < IMPLICIT_1) - { - fraction <<= 1; - dst->normal_exp--; - } -#endif - dst->fraction.ll = fraction; - } - } - else if (exp == EXPMAX) - { - /* Huge exponent*/ - if (fraction == 0) - { - /* Attached to a zero fraction - means infinity */ - dst->class = CLASS_INFINITY; - } - else - { - /* Non zero fraction, means nan */ - if (fraction & QUIET_NAN) - { - dst->class = CLASS_QNAN; - } - else - { - dst->class = CLASS_SNAN; - } - /* Keep the fraction part as the nan number */ - dst->fraction.ll = fraction; - } - } - else - { - /* Nothing strange about this number */ - dst->normal_exp = exp - EXPBIAS; - dst->class = CLASS_NUMBER; - dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1; - } -} -#endif - -#if defined(L_addsub_sf) || defined(L_addsub_df) -static fp_number_type * -_fpadd_parts (fp_number_type * a, - fp_number_type * b, - fp_number_type * tmp) -{ - intfrac tfraction; - - /* Put commonly used fields in local variables. */ - int a_normal_exp; - int b_normal_exp; - fractype a_fraction; - fractype b_fraction; - - if (isnan (a)) - { - return a; - } - if (isnan (b)) - { - return b; - } - if (isinf (a)) - { - /* Adding infinities with opposite signs yields a NaN. */ - if (isinf (b) && a->sign != b->sign) - return nan (); - return a; - } - if (isinf (b)) - { - return b; - } - if (iszero (b)) - { - if (iszero (a)) - { - *tmp = *a; - tmp->sign = a->sign & b->sign; - return tmp; - } - return a; - } - if (iszero (a)) - { - return b; - } - - /* Got two numbers. shift the smaller and increment the exponent till - they're the same */ - { - int diff; - - a_normal_exp = a->normal_exp; - b_normal_exp = b->normal_exp; - a_fraction = a->fraction.ll; - b_fraction = b->fraction.ll; - - diff = a_normal_exp - b_normal_exp; - - if (diff < 0) - diff = -diff; - if (diff < FRAC_NBITS) - { - /* ??? This does shifts one bit at a time. Optimize. */ - while (a_normal_exp > b_normal_exp) - { - b_normal_exp++; - LSHIFT (b_fraction); - } - while (b_normal_exp > a_normal_exp) - { - a_normal_exp++; - LSHIFT (a_fraction); - } - } - else - { - /* Somethings's up.. choose the biggest */ - if (a_normal_exp > b_normal_exp) - { - b_normal_exp = a_normal_exp; - b_fraction = 0; - } - else - { - a_normal_exp = b_normal_exp; - a_fraction = 0; - } - } - } - - if (a->sign != b->sign) - { - if (a->sign) - { - tfraction = -a_fraction + b_fraction; - } - else - { - tfraction = a_fraction - b_fraction; - } - if (tfraction >= 0) - { - tmp->sign = 0; - tmp->normal_exp = a_normal_exp; - tmp->fraction.ll = tfraction; - } - else - { - tmp->sign = 1; - tmp->normal_exp = a_normal_exp; - tmp->fraction.ll = -tfraction; - } - /* and renormalize it */ - - while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll) - { - tmp->fraction.ll <<= 1; - tmp->normal_exp--; - } - } - else - { - tmp->sign = a->sign; - tmp->normal_exp = a_normal_exp; - tmp->fraction.ll = a_fraction + b_fraction; - } - tmp->class = CLASS_NUMBER; - /* Now the fraction is added, we have to shift down to renormalize the - number */ - - if (tmp->fraction.ll >= IMPLICIT_2) - { - LSHIFT (tmp->fraction.ll); - tmp->normal_exp++; - } - return tmp; - -} - -FLO_type -add (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - fp_number_type tmp; - fp_number_type *res; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - res = _fpadd_parts (&a, &b, &tmp); - - return pack_d (res); -} - -FLO_type -sub (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - fp_number_type tmp; - fp_number_type *res; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - b.sign ^= 1; - - res = _fpadd_parts (&a, &b, &tmp); - - return pack_d (res); -} -#endif - -#if defined(L_mul_sf) || defined(L_mul_df) -static INLINE fp_number_type * -_fpmul_parts ( fp_number_type * a, - fp_number_type * b, - fp_number_type * tmp) -{ - fractype low = 0; - fractype high = 0; - - if (isnan (a)) - { - a->sign = a->sign != b->sign; - return a; - } - if (isnan (b)) - { - b->sign = a->sign != b->sign; - return b; - } - if (isinf (a)) - { - if (iszero (b)) - return nan (); - a->sign = a->sign != b->sign; - return a; - } - if (isinf (b)) - { - if (iszero (a)) - { - return nan (); - } - b->sign = a->sign != b->sign; - return b; - } - if (iszero (a)) - { - a->sign = a->sign != b->sign; - return a; - } - if (iszero (b)) - { - b->sign = a->sign != b->sign; - return b; - } - - /* Calculate the mantissa by multiplying both 64bit numbers to get a - 128 bit number */ - { -#if defined(NO_DI_MODE) - { - fractype x = a->fraction.ll; - fractype ylow = b->fraction.ll; - fractype yhigh = 0; - int bit; - - /* ??? This does multiplies one bit at a time. Optimize. */ - for (bit = 0; bit < FRAC_NBITS; bit++) - { - int carry; - - if (x & 1) - { - carry = (low += ylow) < ylow; - high += yhigh + carry; - } - yhigh <<= 1; - if (ylow & FRACHIGH) - { - yhigh |= 1; - } - ylow <<= 1; - x >>= 1; - } - } -#elif defined(FLOAT) - { - /* Multiplying two 32 bit numbers to get a 64 bit number on - a machine with DI, so we're safe */ - - DItype answer = (DItype)(a->fraction.ll) * (DItype)(b->fraction.ll); - - high = answer >> 32; - low = answer; - } -#else - /* Doing a 64*64 to 128 */ - { - UDItype nl = a->fraction.ll & 0xffffffff; - UDItype nh = a->fraction.ll >> 32; - UDItype ml = b->fraction.ll & 0xffffffff; - UDItype mh = b->fraction.ll >>32; - UDItype pp_ll = ml * nl; - UDItype pp_hl = mh * nl; - UDItype pp_lh = ml * nh; - UDItype pp_hh = mh * nh; - UDItype res2 = 0; - UDItype res0 = 0; - UDItype ps_hh__ = pp_hl + pp_lh; - if (ps_hh__ < pp_hl) - res2 += 0x100000000LL; - pp_hl = (ps_hh__ << 32) & 0xffffffff00000000LL; - res0 = pp_ll + pp_hl; - if (res0 < pp_ll) - res2++; - res2 += ((ps_hh__ >> 32) & 0xffffffffL) + pp_hh; - high = res2; - low = res0; - } -#endif - } - - tmp->normal_exp = a->normal_exp + b->normal_exp; - tmp->sign = a->sign != b->sign; -#ifdef FLOAT - tmp->normal_exp += 2; /* ??????????????? */ -#else - tmp->normal_exp += 4; /* ??????????????? */ -#endif - while (high >= IMPLICIT_2) - { - tmp->normal_exp++; - if (high & 1) - { - low >>= 1; - low |= FRACHIGH; - } - high >>= 1; - } - while (high < IMPLICIT_1) - { - tmp->normal_exp--; - - high <<= 1; - if (low & FRACHIGH) - high |= 1; - low <<= 1; - } - /* rounding is tricky. if we only round if it won't make us round later. */ -#if 0 - if (low & FRACHIGH2) - { - if (((high & GARDMASK) != GARDMSB) - && (((high + 1) & GARDMASK) == GARDMSB)) - { - /* don't round, it gets done again later. */ - } - else - { - high++; - } - } -#endif - if ((high & GARDMASK) == GARDMSB) - { - if (high & (1 << NGARDS)) - { - /* half way, so round to even */ - high += GARDROUND + 1; - } - else if (low) - { - /* but we really weren't half way */ - high += GARDROUND + 1; - } - } - tmp->fraction.ll = high; - tmp->class = CLASS_NUMBER; - return tmp; -} - -FLO_type -multiply (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - fp_number_type tmp; - fp_number_type *res; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - res = _fpmul_parts (&a, &b, &tmp); - - return pack_d (res); -} -#endif - -#if defined(L_div_sf) || defined(L_div_df) -static INLINE fp_number_type * -_fpdiv_parts (fp_number_type * a, - fp_number_type * b) -{ - fractype bit; - fractype numerator; - fractype denominator; - fractype quotient; - - if (isnan (a)) - { - return a; - } - if (isnan (b)) - { - return b; - } - - a->sign = a->sign ^ b->sign; - - if (isinf (a) || iszero (a)) - { - if (a->class == b->class) - return nan (); - return a; - } - - if (isinf (b)) - { - a->fraction.ll = 0; - a->normal_exp = 0; - return a; - } - if (iszero (b)) - { - a->class = CLASS_INFINITY; - return a; - } - - /* Calculate the mantissa by multiplying both 64bit numbers to get a - 128 bit number */ - { - /* quotient = - ( numerator / denominator) * 2^(numerator exponent - denominator exponent) - */ - - a->normal_exp = a->normal_exp - b->normal_exp; - numerator = a->fraction.ll; - denominator = b->fraction.ll; - - if (numerator < denominator) - { - /* Fraction will be less than 1.0 */ - numerator *= 2; - a->normal_exp--; - } - bit = IMPLICIT_1; - quotient = 0; - /* ??? Does divide one bit at a time. Optimize. */ - while (bit) - { - if (numerator >= denominator) - { - quotient |= bit; - numerator -= denominator; - } - bit >>= 1; - numerator *= 2; - } - - if ((quotient & GARDMASK) == GARDMSB) - { - if (quotient & (1 << NGARDS)) - { - /* half way, so round to even */ - quotient += GARDROUND + 1; - } - else if (numerator) - { - /* but we really weren't half way, more bits exist */ - quotient += GARDROUND + 1; - } - } - - a->fraction.ll = quotient; - return (a); - } -} - -FLO_type -divide (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - fp_number_type *res; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - res = _fpdiv_parts (&a, &b); - - return pack_d (res); -} -#endif - -int __fpcmp_parts (fp_number_type * a, fp_number_type *b); - -#if defined(L_fpcmp_parts_sf) || defined(L_fpcmp_parts_df) -/* according to the demo, fpcmp returns a comparison with 0... thus - a -1 - a==b -> 0 - a>b -> +1 - */ - -int -__fpcmp_parts (fp_number_type * a, fp_number_type * b) -{ -#if 0 - /* either nan -> unordered. Must be checked outside of this routine. */ - if (isnan (a) && isnan (b)) - { - return 1; /* still unordered! */ - } -#endif - - if (isnan (a) || isnan (b)) - { - return 1; /* how to indicate unordered compare? */ - } - if (isinf (a) && isinf (b)) - { - /* +inf > -inf, but +inf != +inf */ - /* b \a| +inf(0)| -inf(1) - ______\+--------+-------- - +inf(0)| a==b(0)| ab(1) | a==b(0) - -------+--------+-------- - So since unordered must be non zero, just line up the columns... - */ - return b->sign - a->sign; - } - /* but not both... */ - if (isinf (a)) - { - return a->sign ? -1 : 1; - } - if (isinf (b)) - { - return b->sign ? 1 : -1; - } - if (iszero (a) && iszero (b)) - { - return 0; - } - if (iszero (a)) - { - return b->sign ? 1 : -1; - } - if (iszero (b)) - { - return a->sign ? -1 : 1; - } - /* now both are "normal". */ - if (a->sign != b->sign) - { - /* opposite signs */ - return a->sign ? -1 : 1; - } - /* same sign; exponents? */ - if (a->normal_exp > b->normal_exp) - { - return a->sign ? -1 : 1; - } - if (a->normal_exp < b->normal_exp) - { - return a->sign ? 1 : -1; - } - /* same exponents; check size. */ - if (a->fraction.ll > b->fraction.ll) - { - return a->sign ? -1 : 1; - } - if (a->fraction.ll < b->fraction.ll) - { - return a->sign ? 1 : -1; - } - /* after all that, they're equal. */ - return 0; -} -#endif - -#if defined(L_compare_sf) || defined(L_compare_df) -CMPtype -compare (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - return __fpcmp_parts (&a, &b); -} -#endif - -#ifndef US_SOFTWARE_GOFAST - -/* These should be optimized for their specific tasks someday. */ - -#if defined(L_eq_sf) || defined(L_eq_df) -CMPtype -_eq_f2 (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - if (isnan (&a) || isnan (&b)) - return 1; /* false, truth == 0 */ - - return __fpcmp_parts (&a, &b) ; -} -#endif - -#if defined(L_ne_sf) || defined(L_ne_df) -CMPtype -_ne_f2 (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - if (isnan (&a) || isnan (&b)) - return 1; /* true, truth != 0 */ - - return __fpcmp_parts (&a, &b) ; -} -#endif - -#if defined(L_gt_sf) || defined(L_gt_df) -CMPtype -_gt_f2 (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - if (isnan (&a) || isnan (&b)) - return -1; /* false, truth > 0 */ - - return __fpcmp_parts (&a, &b); -} -#endif - -#if defined(L_ge_sf) || defined(L_ge_df) -CMPtype -_ge_f2 (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - if (isnan (&a) || isnan (&b)) - return -1; /* false, truth >= 0 */ - return __fpcmp_parts (&a, &b) ; -} -#endif - -#if defined(L_lt_sf) || defined(L_lt_df) -CMPtype -_lt_f2 (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - if (isnan (&a) || isnan (&b)) - return 1; /* false, truth < 0 */ - - return __fpcmp_parts (&a, &b); -} -#endif - -#if defined(L_le_sf) || defined(L_le_df) -CMPtype -_le_f2 (FLO_type arg_a, FLO_type arg_b) -{ - fp_number_type a; - fp_number_type b; - - unpack_d ((FLO_union_type *) & arg_a, &a); - unpack_d ((FLO_union_type *) & arg_b, &b); - - if (isnan (&a) || isnan (&b)) - return 1; /* false, truth <= 0 */ - - return __fpcmp_parts (&a, &b) ; -} -#endif - -#endif /* ! US_SOFTWARE_GOFAST */ - -#if defined(L_si_to_sf) || defined(L_si_to_df) -FLO_type -si_to_float (SItype arg_a) -{ - fp_number_type in; - - in.class = CLASS_NUMBER; - in.sign = arg_a < 0; - if (!arg_a) - { - in.class = CLASS_ZERO; - } - else - { - in.normal_exp = FRACBITS + NGARDS; - if (in.sign) - { - /* Special case for minint, since there is no +ve integer - representation for it */ - if (arg_a == (SItype) 0x80000000) - { - return -2147483648.0; - } - in.fraction.ll = (-arg_a); - } - else - in.fraction.ll = arg_a; - - while (in.fraction.ll < (1LL << (FRACBITS + NGARDS))) - { - in.fraction.ll <<= 1; - in.normal_exp -= 1; - } - } - return pack_d (&in); -} -#endif - -#if defined(L_sf_to_si) || defined(L_df_to_si) -SItype -float_to_si (FLO_type arg_a) -{ - fp_number_type a; - SItype tmp; - - unpack_d ((FLO_union_type *) & arg_a, &a); - if (iszero (&a)) - return 0; - if (isnan (&a)) - return 0; - /* get reasonable MAX_SI_INT... */ - if (isinf (&a)) - return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; - /* it is a number, but a small one */ - if (a.normal_exp < 0) - return 0; - if (a.normal_exp > 30) - return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT; - tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); - return a.sign ? (-tmp) : (tmp); -} -#endif - -#if defined(L_sf_to_usi) || defined(L_df_to_usi) -#ifdef US_SOFTWARE_GOFAST -/* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines, - we also define them for GOFAST because the ones in libgcc2.c have the - wrong names and I'd rather define these here and keep GOFAST CYG-LOC's - out of libgcc2.c. We can't define these here if not GOFAST because then - there'd be duplicate copies. */ - -USItype -float_to_usi (FLO_type arg_a) -{ - fp_number_type a; - - unpack_d ((FLO_union_type *) & arg_a, &a); - if (iszero (&a)) - return 0; - if (isnan (&a)) - return 0; - /* it is a negative number */ - if (a.sign) - return 0; - /* get reasonable MAX_USI_INT... */ - if (isinf (&a)) - return MAX_USI_INT; - /* it is a number, but a small one */ - if (a.normal_exp < 0) - return 0; - if (a.normal_exp > 31) - return MAX_USI_INT; - else if (a.normal_exp > (FRACBITS + NGARDS)) - return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS)); - else - return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); -} -#endif -#endif - -#if defined(L_negate_sf) || defined(L_negate_df) -FLO_type -negate (FLO_type arg_a) -{ - fp_number_type a; - - unpack_d ((FLO_union_type *) & arg_a, &a); - flip_sign (&a); - return pack_d (&a); -} -#endif - -#ifdef FLOAT - -#if defined(L_make_sf) -SFtype -__make_fp(fp_class_type class, - unsigned int sign, - int exp, - USItype frac) -{ - fp_number_type in; - - in.class = class; - in.sign = sign; - in.normal_exp = exp; - in.fraction.ll = frac; - return pack_d (&in); -} -#endif - -#ifndef FLOAT_ONLY - -/* This enables one to build an fp library that supports float but not double. - Otherwise, we would get an undefined reference to __make_dp. - This is needed for some 8-bit ports that can't handle well values that - are 8-bytes in size, so we just don't support double for them at all. */ - -extern DFtype __make_dp (fp_class_type, unsigned int, int, UDItype frac); - -#if defined(L_sf_to_df) -DFtype -sf_to_df (SFtype arg_a) -{ - fp_number_type in; - - unpack_d ((FLO_union_type *) & arg_a, &in); - return __make_dp (in.class, in.sign, in.normal_exp, - ((UDItype) in.fraction.ll) << F_D_BITOFF); -} -#endif - -#endif -#endif - -#ifndef FLOAT - -extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype); - -#if defined(L_make_df) -DFtype -__make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac) -{ - fp_number_type in; - - in.class = class; - in.sign = sign; - in.normal_exp = exp; - in.fraction.ll = frac; - return pack_d (&in); -} -#endif - -#if defined(L_df_to_sf) -SFtype -df_to_sf (DFtype arg_a) -{ - fp_number_type in; - USItype sffrac; - - unpack_d ((FLO_union_type *) & arg_a, &in); - - sffrac = in.fraction.ll >> F_D_BITOFF; - - /* We set the lowest guard bit in SFFRAC if we discarded any non - zero bits. */ - if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0) - sffrac |= 1; - - return __make_fp (in.class, in.sign, in.normal_exp, sffrac); -} -#endif - -#endif -#endif /* !EXTENDED_FLOAT_STUBS */ diff --git a/contrib/gcc/config/freebsd.h b/contrib/gcc/config/freebsd.h deleted file mode 100644 index dc16976d2e61..000000000000 --- a/contrib/gcc/config/freebsd.h +++ /dev/null @@ -1,120 +0,0 @@ -/* Base configuration file for all FreeBSD targets. - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Common FreeBSD configuration. - All FreeBSD architectures should include this file, which will specify - their commonalities. - Adapted from /usr/src/contrib/gcc/config/i386/freebsd.h & - egcs/gcc/config/i386/freebsd-elf.h version by David O'Brien */ - - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -/* This defines which switch letters take arguments. On svr4, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker). We have a slightly different mix. We - have -R (alias --rpath), no -z, --soname (-h), --assert etc. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - ( (CHAR) == 'D' \ - || (CHAR) == 'U' \ - || (CHAR) == 'o' \ - || (CHAR) == 'e' \ - || (CHAR) == 'T' \ - || (CHAR) == 'u' \ - || (CHAR) == 'I' \ - || (CHAR) == 'm' \ - || (CHAR) == 'x' \ - || (CHAR) == 'L' \ - || (CHAR) == 'A' \ - || (CHAR) == 'V' \ - || (CHAR) == 'B' \ - || (CHAR) == 'b' \ - || (CHAR) == 'h' \ - || (CHAR) == 'z' /* ignored by ld */ \ - || (CHAR) == 'R') - -#undef WORD_SWITCH_TAKES_ARG -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - || !strcmp (STR, "rpath") || !strcmp (STR, "rpath-link") \ - || !strcmp (STR, "soname") || !strcmp (STR, "defsym") \ - || !strcmp (STR, "assert") || !strcmp (STR, "dynamic-linker")) - - -#define CPP_FBSD_PREDEFINES "-Dunix -D__ELF__ -D__FreeBSD__=4 -D__FreeBSD_cc_version=400001 -Asystem(unix) -Asystem(FreeBSD)" - - -/* Code generation parameters. */ - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. - (even though the svr4 ABI for the i386 says that records and unions are - returned in memory) */ -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* Ensure we the configuration knows our system correctly so we can link with - libraries compiled with the native cc. */ -#undef NO_DOLLAR_IN_LABEL - - -/* Miscellaneous parameters. */ - -/* Tell libgcc2.c that FreeBSD targets support atexit(3). */ -#define HAVE_ATEXIT - - -/* FREEBSD_NATIVE is defined when gcc is integrated into the FreeBSD - source tree so it can be configured appropriately without using - the GNU configure/build mechanism. */ - -#ifdef FREEBSD_NATIVE - -/* Look for the include files in the system-defined places. */ - -#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" -#define GCC_INCLUDE_DIR "/usr/include" - -/* Now that GCC knows what the include path applies to, put the G++ one first. - C++ can now have include files that override the default C ones. */ -#define INCLUDE_DEFAULTS \ - { \ - { GPLUSPLUS_INCLUDE_DIR, "C++", 1, 1 }, \ - { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ - { 0, 0, 0, 0 } \ - } - -/* Under FreeBSD, the normal location of the compiler back ends is the - /usr/libexec directory. */ - -#define STANDARD_EXEC_PREFIX "/usr/libexec/" -#define TOOLDIR_BASE_PREFIX "/usr/libexec/" - -/* Under FreeBSD, the normal location of the various *crt*.o files is the - /usr/lib directory. */ - -#define STANDARD_STARTFILE_PREFIX "/usr/lib/" - -/* FreeBSD is 4.4BSD derived */ -#define bsd4_4 - -#endif /* FREEBSD_NATIVE */ diff --git a/contrib/gcc/config/gnu.h b/contrib/gcc/config/gnu.h deleted file mode 100644 index d1691646e5aa..000000000000 --- a/contrib/gcc/config/gnu.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Configuration common to all targets running the GNU system. */ - -/* Provide GCC options for standard feature-test macros. */ -#undef CPP_SPEC -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{bsd:-D_BSD_SOURCE}" - -/* Default C library spec. Use -lbsd-compat for gcc -bsd. */ -#undef LIB_SPEC -#define LIB_SPEC "%{bsd:-lbsd-compat} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" - -/* Standard include directory. In GNU, "/usr" is a four-letter word. */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/include" - - -/* We have atexit. */ -#define HAVE_ATEXIT - -/* Implicit library calls should use memcpy, not bcopy, etc. */ -#define TARGET_MEM_FUNCTIONS - -/* The system headers under GNU are C++-aware. */ -#define NO_IMPLICIT_EXTERN_C diff --git a/contrib/gcc/config/gofast.h b/contrib/gcc/config/gofast.h deleted file mode 100644 index 84bea516758d..000000000000 --- a/contrib/gcc/config/gofast.h +++ /dev/null @@ -1,96 +0,0 @@ -/* US Software GOFAST floating point library support. - Copyright (C) 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This is used by fp-bit.c. */ -#define US_SOFTWARE_GOFAST - -/* The US Software GOFAST library requires special optabs support. - There is no negation libcall, and several others have names different - from gcc. This file consolidates the support in one place. - - The basic plan is to leave gcc proper alone and via some hook fix things - after the optabs have been set up. Our main entry point is - INIT_GOFAST_OPTABS. */ - -#define INIT_GOFAST_OPTABS \ - do { \ - GOFAST_CLEAR_NEG_FLOAT_OPTAB; \ - GOFAST_RENAME_LIBCALLS; \ - } while (0) - -#define GOFAST_CLEAR_NEG_FLOAT_OPTAB \ - do { \ - int mode; \ - for (mode = SFmode; (int) mode <= (int) TFmode; \ - mode = (enum machine_mode) ((int) mode + 1)) \ - neg_optab->handlers[(int) mode].libfunc = NULL_RTX; \ - } while (0) - -#define GOFAST_RENAME_LIBCALLS \ - add_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpadd"); \ - add_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpadd"); \ - sub_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpsub"); \ - sub_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpsub"); \ - smul_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpmul"); \ - smul_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpmul"); \ - flodiv_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpdiv"); \ - flodiv_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpdiv"); \ - cmp_optab->handlers[(int) SFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \ - cmp_optab->handlers[(int) DFmode].libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \ -\ - extendsfdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fptodp"); \ - truncdfsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dptofp"); \ -\ - eqsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \ - nesf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \ - gtsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \ - gesf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \ - ltsf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \ - lesf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fpcmp"); \ -\ - eqdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \ - nedf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \ - gtdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \ - gedf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \ - ltdf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \ - ledf2_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dpcmp"); \ -\ - eqxf2_libfunc = NULL_RTX; \ - nexf2_libfunc = NULL_RTX; \ - gtxf2_libfunc = NULL_RTX; \ - gexf2_libfunc = NULL_RTX; \ - ltxf2_libfunc = NULL_RTX; \ - lexf2_libfunc = NULL_RTX; \ -\ - eqtf2_libfunc = NULL_RTX; \ - netf2_libfunc = NULL_RTX; \ - gttf2_libfunc = NULL_RTX; \ - getf2_libfunc = NULL_RTX; \ - lttf2_libfunc = NULL_RTX; \ - letf2_libfunc = NULL_RTX; \ -\ - floatsisf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "sitofp"); \ - floatsidf_libfunc = gen_rtx (SYMBOL_REF, Pmode, "litodp"); \ - fixsfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fptosi"); \ - fixdfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dptoli"); \ - fixunssfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "fptoui"); \ - fixunsdfsi_libfunc = gen_rtx (SYMBOL_REF, Pmode, "dptoul"); \ - -/* End of GOFAST_RENAME_LIBCALLS */ diff --git a/contrib/gcc/config/i386/386bsd.h b/contrib/gcc/config/i386/386bsd.h deleted file mode 100644 index 7962321325c9..000000000000 --- a/contrib/gcc/config/i386/386bsd.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Configuration for an i386 running 386BSD as the target machine. */ - -/* This is tested by i386gas.h. */ -#define YES_UNDERSCORES - -#include "i386/gstabs.h" - -/* Get perform_* macros to build libgcc.a. */ -#include "i386/perform.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Di386 -D____386BSD____ -D__386BSD__ -DBSD_NET2 -Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386)" - -/* Like the default, except no -lg. */ -#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "short unsigned int" - -#define WCHAR_UNSIGNED 1 - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 16 - -/* 386BSD does have atexit. */ - -#define HAVE_ATEXIT - -/* Redefine this to use %eax instead of %edx. */ -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - { \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \ - LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall mcount\n"); \ - } \ -} - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -/* The following macros are stolen from i386v4.h */ -/* These have to be defined to get PIC code correct */ - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ - -#define JUMP_TABLES_IN_TEXT_SECTION 1 - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 diff --git a/contrib/gcc/config/i386/aix386.h b/contrib/gcc/config/i386/aix386.h deleted file mode 100644 index e0498e795953..000000000000 --- a/contrib/gcc/config/i386/aix386.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Definitions for IBM PS2 running AIX/386 with gas. - From: Minh Tran-Le - Copyright (C) 1988 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* - * This configuration file is for gcc with gas-2.x and gnu ld 2.x - * with aix ps/2 1.3.x. - */ - -/* Define USE_GAS if you have the new version of gas that can handle - * multiple segments and .section pseudo op. This will allow gcc to - * use the .init section for g++ ctor/dtor. - * - * If you don't have gas then undefined USE_GAS. You will also have - * to use collect if you want to use g++ - */ -#define USE_GAS - -#include "i386/aix386ng.h" - -/* Use crt1.o as a startup file and crtn.o as a closing file. - And add crtbegin.o and crtend.o for ctors and dtors */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} crtbegin.o%s" -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "crtend.o%s crtn.o%s" - -/* Removed the -K flags because the gnu ld does not handle it */ -#undef LINK_SPEC -#define LINK_SPEC "%{T*} %{z:-lm}" - -/* Define a few machine-specific details of the implementation of - constructors. */ - -#undef INIT_SECTION_ASM_OP -#define INIT_SECTION_ASM_OP ".section .init,\"x\"" - -#define CTOR_LIST_BEGIN \ - asm (INIT_SECTION_ASM_OP); \ - asm ("pushl $0") -#define CTOR_LIST_END CTOR_LIST_BEGIN - -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - init_section (); \ - fprintf (FILE, "\tpushl $"); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) diff --git a/contrib/gcc/config/i386/aix386ng.h b/contrib/gcc/config/i386/aix386ng.h deleted file mode 100644 index 9a8dae632c3a..000000000000 --- a/contrib/gcc/config/i386/aix386ng.h +++ /dev/null @@ -1,140 +0,0 @@ -/* Definitions for IBM PS2 running AIX/386. - Copyright (C) 1988, 1996, 1998 Free Software Foundation, Inc. - Contributed by Minh Tran-Le . - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "i386/i386.h" - -/* Get the generic definitions for system V.3. */ - -#include "svr3.h" - -/* Use the ATT assembler syntax. - This overrides at least one macro (USER_LABEL_PREFIX) from svr3.h. */ - -#include "i386/att.h" - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ - -#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}" -#define ENDFILE_SPEC "crtn.o%s" - -#define LIB_SPEC "%{shlib:-lc_s} -lc" - -/* Special flags for the linker. I don't know what they do. */ - -#define LINK_SPEC "%{K} %{!K:-K} %{T*} %{z:-lm}" - -/* Specify predefined symbols in preprocessor. */ - -#define CPP_PREDEFINES "-Dps2 -Dunix -Asystem(aix)" - -#define CPP_SPEC "%(cpp_cpu) \ - %{posix:-D_POSIX_SOURCE}%{!posix:-DAIX} -D_I386 -D_AIX -D_MBCS" - -/* special flags for the aix assembler to generate the short form for all - qualifying forward reference */ -/* The buggy /bin/as of aix ps/2 1.2.x cannot always handle it. */ -#if 0 -#define ASM_SPEC "-s2" -#endif /* 0 */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { output_file_directive (FILE, main_input_filename); \ - if (optimize) \ - ASM_FILE_START_1 (FILE); \ - else \ - fprintf (FILE, "\t.noopt\n"); \ - } while (0) - -/* This was suggested, but it shouldn't be right for DBX output. -- RMS - #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */ - -/* Writing `int' for a bitfield forces int alignment for the structure. */ - -#define PCC_BITFIELD_TYPE_MATTERS 1 - -#ifndef USE_GAS -/* Don't write a `.optim' pseudo; this assembler - is said to have a bug when .optim is used. */ - -#undef ASM_FILE_START_1 -#define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.noopt\n") -#endif - -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ - fprintf (FILE, "\tleal %sP%d,%%eax\n\tcall mcount\n", LPREFIX, (LABELNO)); - -/* Note that using bss_section here caused errors - in building shared libraries on system V.3. - but AIX 1.2 does not have yet shareable libraries on PS2 */ -#undef ASM_OUTPUT_LOCAL -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ - (bss_section (), \ - ASM_OUTPUT_LABEL ((FILE), (NAME)), \ - fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED))) - - -/* Undef all the .init and .fini section stuff if we are not using gas and - * gnu ld so that we can use collect because the standard /bin/as and /bin/ld - * cannot handle those. - */ -#ifndef USE_GAS -# undef INIT_SECTION_ASM_OP -# undef FINI_SECTION_ASM_OP -# undef CTORS_SECTION_ASM_OP -# undef DTORS_SECTION_ASM_OP -# undef ASM_OUTPUT_CONSTRUCTOR -# undef ASM_OUTPUT_DESTRUCTOR -# undef DO_GLOBAL_CTORS_BODY - -# undef CTOR_LIST_BEGIN -# define CTOR_LIST_BEGIN -# undef CTOR_LIST_END -# define CTOR_LIST_END -# undef DTOR_LIST_BEGIN -# define DTOR_LIST_BEGIN -# undef DTOR_LIST_END -# define DTOR_LIST_END - -# undef CONST_SECTION_FUNCTION -# define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - extern void text_section(); \ - text_section(); \ -} - -# undef EXTRA_SECTION_FUNCTIONS -# define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION - -/* for collect2 */ -# define OBJECT_FORMAT_COFF -# define MY_ISCOFF(magic) \ - ((magic) == I386MAGIC || (magic) == I386SVMAGIC) - -#endif /* !USE_GAS */ diff --git a/contrib/gcc/config/i386/att.h b/contrib/gcc/config/i386/att.h deleted file mode 100644 index e5c2d9c7e994..000000000000 --- a/contrib/gcc/config/i386/att.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Definitions for AT&T assembler syntax for the Intel 80386. - Copyright (C) 1988, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Include common aspects of all 386 Unix assemblers. */ -#include "i386/unix.h" - -#define TARGET_VERSION fprintf (stderr, " (80386, ATT syntax)"); - -/* Define the syntax of instructions and addresses. */ - -/* Prefix for internally generated assembler labels. */ -#define LPREFIX ".L" - -/* Assembler pseudos to introduce constants of various size. */ - -/* #define ASM_BYTE_OP "\t.byte" Now in svr3.h or svr4.h. */ -#define ASM_SHORT "\t.value" -#define ASM_LONG "\t.long" -#define ASM_DOUBLE "\t.double" - -/* How to output an ASCII string constant. */ - -#define ASM_OUTPUT_ASCII(FILE, p, size) \ -do \ -{ int i = 0; \ - while (i < (size)) \ - { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n"); \ - fprintf ((FILE), "%s ", ASM_BYTE_OP); } \ - else fprintf ((FILE), ","); \ - fprintf ((FILE), "0x%x", ((p)[i++] & 0377)) ;} \ - fprintf ((FILE), "\n"); \ -} while (0) - -/* Do use .optim by default on this machine. */ -#undef ASM_FILE_START_1 -#define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n") - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) - -/* This is how to output an assembler line - that says to advance the location counter by SIZE bytes. */ - -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf ((FILE), "\t.set .,.+%u\n", (SIZE)) - -/* Can't use ASM_OUTPUT_SKIP in text section; it doesn't leave 0s. */ - -#define ASM_NO_SKIP_IN_TEXT 1 - -/* Define the syntax of labels and symbol definitions/declarations. */ - -/* This is how to store into the string BUF - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ - sprintf ((BUF), ".%s%d", (PREFIX), (NUMBER)) - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM) - -/* The prefix to add to user-visible assembler symbols. */ - -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "" diff --git a/contrib/gcc/config/i386/bsd.h b/contrib/gcc/config/i386/bsd.h deleted file mode 100644 index 34db79a79d5b..000000000000 --- a/contrib/gcc/config/i386/bsd.h +++ /dev/null @@ -1,128 +0,0 @@ -/* Definitions for BSD assembler syntax for Intel 386 - (actually AT&T syntax for insns and operands, - adapted to BSD conventions for symbol names and debugging.) - Copyright (C) 1988, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Include common aspects of all 386 Unix assemblers. */ -#include "i386/unix.h" - -/* Use the Sequent Symmetry assembler syntax. */ - -#define TARGET_VERSION fprintf (stderr, " (80386, BSD syntax)"); - -/* Define the syntax of pseudo-ops, labels and comments. */ - -/* Prefix for internally generated assembler labels. If we aren't using - underscores, we are using prefix `.'s to identify labels that should - be ignored, as in `i386/gas.h' --karl@cs.umb.edu */ -#ifdef NO_UNDERSCORES -#define LPREFIX ".L" -#else -#define LPREFIX "L" -#endif /* not NO_UNDERSCORES */ - -/* Assembler pseudos to introduce constants of various size. */ - -#define ASM_BYTE_OP "\t.byte" -#define ASM_SHORT "\t.word" -#define ASM_LONG "\t.long" -#define ASM_DOUBLE "\t.double" - -/* Output at beginning of assembler file. - ??? I am skeptical of this -- RMS. */ - -#define ASM_FILE_START(FILE) \ - do { output_file_directive (FILE, main_input_filename); \ - } while (0) - -/* This was suggested, but it shouldn't be right for DBX output. -- RMS - #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */ - - -/* Define the syntax of labels and symbol definitions/declarations. */ - -/* This is how to output an assembler line - that says to advance the location counter by SIZE bytes. */ - -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t.space %u\n", (SIZE)) - -/* Define the syntax of labels and symbol definitions/declarations. */ - -/* This says how to output an assembler line - to define a global common symbol. */ - -#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ -( fputs (".comm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u\n", (ROUNDED))) - -/* This says how to output an assembler line - to define a local common symbol. */ - -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ -( fputs (".lcomm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u\n", (ROUNDED))) - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", (LOG)) - -/* This is how to store into the string BUF - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#ifdef NO_UNDERSCORES -#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ - sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER)) -#else -#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ - sprintf ((BUF), "*%s%d", (PREFIX), (NUMBER)) -#endif - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#ifdef NO_UNDERSCORES -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM) -#else -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, "%s%d:\n", PREFIX, NUM) -#endif - -/* The prefix to add to user-visible assembler symbols. */ - -#ifdef NO_UNDERSCORES -#define USER_LABEL_PREFIX "" -#else -#define USER_LABEL_PREFIX "_" -#endif /* not NO_UNDERSCORES */ - -/* Sequent has some changes in the format of DBX symbols. */ -#define DBX_NO_XREFS 1 - -/* Don't split DBX symbols into continuations. */ -#define DBX_CONTIN_LENGTH 0 diff --git a/contrib/gcc/config/i386/bsd386.h b/contrib/gcc/config/i386/bsd386.h deleted file mode 100644 index c0dcf87cbdd9..000000000000 --- a/contrib/gcc/config/i386/bsd386.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Configuration for an i386 running BSDI's BSD/OS (formerly known as BSD/386) - as the target machine. */ - -#include "i386/386bsd.h" - -/* We exist mostly to add -Dbsdi and such to the predefines. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Di386 -Dbsdi -D__i386__ -D__bsdi__ -D____386BSD____ -D__386BSD__ -DBSD_NET2 -Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386)" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_UNSIGNED -#define WCHAR_UNSIGNED 0 - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 - -/* This is suitable for BSD/OS 3.0; we don't know about earlier releases. */ -#undef ASM_COMMENT_START -#define ASM_COMMENT_START " #" - -/* Until they use ELF or something that handles dwarf2 unwinds - and initialization stuff better. */ -#define DWARF2_UNWIND_INFO 0 - -/* BSD/OS still uses old binutils that don't insert nops by default - when the .align directive demands to insert extra space in the text - segment. */ -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG)) diff --git a/contrib/gcc/config/i386/config-nt.sed b/contrib/gcc/config/i386/config-nt.sed deleted file mode 100644 index 6c86b27e99ce..000000000000 --- a/contrib/gcc/config/i386/config-nt.sed +++ /dev/null @@ -1,38 +0,0 @@ -/^Makefile/,/^ rm -f config.run/d -s/rm -f/del/ -s/|| cp/|| copy/ -/^config.status/,/ fi/d -s/config.status//g -s/\/dev\/null/NUL/g -s/$(srcdir)\/c-parse/c-parse/g -s/$(srcdir)\/c-gperf/c-gperf/g -/^multilib.h/ s/multilib/not-multilib/ -/^target=/ c\ -target=winnt3.5 -/^xmake_file=/ d -/^tmake_file=/ d -/^out_file/ c\ -out_file=config/i386/i386.c -/^out_object_file/ c\ -out_object_file=i386.obj -/^md_file/ c\ -md_file=config/i386/i386.md -/^tm_file/ c\ -tm_file=config/i386/win-nt.h -/^build_xm_file/ c\ -build_xm_file=config/i386/xm-winnt.h -/^host_xm_file/ c\ -host_xm_file=config/i386/xm-winnt.h -/^####target/ i\ -CC = cl \ -CLIB = libc.lib kernel32.lib \ -CFLAGS = -Di386 -DWIN32 -D_WIN32 -D_M_IX86=300 -D_X86_=1 \\\ - -DALMOST_STDC -D_MSC_VER=800 \ -LDFLAGS = -align:0x1000 -subsystem:console -entry:mainCRTStartup \\\ - -stack:1000000,1000 \ -\ -EXTRA_OBJS=winnt.obj \ -winnt.obj: $(srcdir)/config/i386/winnt.c \ -\ $(CC) $(CFLAGS) \\\ -\ -I. -I$(srcdir) -I$(srcdir)/config -c $(srcdir)/config/i386/winnt.c \ - diff --git a/contrib/gcc/config/i386/crtdll.h b/contrib/gcc/config/i386/crtdll.h deleted file mode 100644 index 3202af8cca84..000000000000 --- a/contrib/gcc/config/i386/crtdll.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for - hosting on Windows32, using GNU tools and the Windows32 API Library, - as distinct from winnt.h, which is used to build GCC for use with a - windows style library and tool set and uses the Microsoft tools. - This variant uses CRTDLL.DLL insted of MSVCRTDLL.DLL. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386 -D_WIN32 -DWIN32 -D__WIN32__ \ - -D__MINGW32__=0.2 -DWINNT -D_X86_=1 -D__STDC__=1\ - -D__stdcall=__attribute__((__stdcall__)) \ - -D_stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - -D__declspec(x)=__attribute__((x)) \ - -Asystem(winnt) -Acpu(i386) -Amachine(i386)" - -#undef LIBGCC_SPEC -#define LIBGCC_SPEC "-lmingw32 -lgcc -lmoldname -lcrtdll" - -/* Specify a different entry point when linking a DLL */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{mdll:dllcrt1%O%s} %{!mdll:crt1%O%s}" - diff --git a/contrib/gcc/config/i386/cygwin.asm b/contrib/gcc/config/i386/cygwin.asm deleted file mode 100644 index 4ac4c91a3b18..000000000000 --- a/contrib/gcc/config/i386/cygwin.asm +++ /dev/null @@ -1,32 +0,0 @@ -/* stuff needed for libgcc1 on win32. */ - -#ifdef L_chkstk - - .global ___chkstk - .global __alloca -___chkstk: -__alloca: - pushl %ecx /* save temp */ - movl %esp,%ecx /* get sp */ - addl $0x8,%ecx /* and point to return addr */ - -probe: cmpl $0x1000,%eax /* > 4k ?*/ - jb done - - subl $0x1000,%ecx /* yes, move pointer down 4k*/ - orl $0x0,(%ecx) /* probe there */ - subl $0x1000,%eax /* decrement count */ - jmp probe /* and do it again */ - -done: subl %eax,%ecx - orl $0x0,(%ecx) /* less that 4k, just peek here */ - - movl %esp,%eax - movl %ecx,%esp /* decrement stack */ - - movl (%eax),%ecx /* recover saved temp */ - movl 4(%eax),%eax /* get return address */ - jmp *%eax - - -#endif diff --git a/contrib/gcc/config/i386/cygwin.h b/contrib/gcc/config/i386/cygwin.h deleted file mode 100644 index dbea466bc863..000000000000 --- a/contrib/gcc/config/i386/cygwin.h +++ /dev/null @@ -1,525 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for - hosting on Windows NT 3.x, using a Unix style C library and tools, - as distinct from winnt.h, which is used to build GCC for use with a - windows style library and tool set and uses the Microsoft tools. - Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define YES_UNDERSCORES - -#define DBX_DEBUGGING_INFO -#define SDB_DEBUGGING_INFO -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#include "i386/gas.h" -#include "dbxcoff.h" - -/* Augment TARGET_SWITCHES with the cygwin/no-cygwin options. */ -#define MASK_WIN32 0x40000000 /* Use -lming32 interface */ -#define MASK_CYGWIN 0x20000000 /* Use -lcygwin interface */ -#define MASK_WINDOWS 0x10000000 /* Use windows interface */ -#define MASK_DLL 0x08000000 /* Use dll interface */ -#define MASK_NOP_FUN_DLLIMPORT 0x20000 /* Ignore dllimport for functions */ - -#define TARGET_WIN32 (target_flags & MASK_WIN32) -#define TARGET_CYGWIN (target_flags & MASK_CYGWIN) -#define TARGET_WINDOWS (target_flags & MASK_WINDOWS) -#define TARGET_DLL (target_flags & MASK_DLL) -#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT) - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ -{ "cygwin", MASK_CYGWIN, "Use the Cygwin interface" }, \ -{ "no-cygwin", MASK_WIN32, "Use the Mingw32 interface" }, \ -{ "windows", MASK_WINDOWS, "Create GUI application" }, \ -{ "console", -MASK_WINDOWS, "Create console application" }, \ -{ "dll", MASK_DLL, "Generate code for a DLL" }, \ -{ "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, "Ignore dllimport for functions" }, \ -{ "no-nop-fun-dllimport", -MASK_NOP_FUN_DLLIMPORT, "" }, - - -/* Support the __declspec keyword by turning them into attributes. - We currently only support: dllimport and dllexport. - Note that the current way we do this may result in a collision with - predefined attributes later on. This can be solved by using one attribute, - say __declspec__, and passing args to it. The problem with that approach - is that args are not accumulated: each new appearance would clobber any - existing args. */ - -#ifdef CPP_PREDEFINES -#undef CPP_PREDEFINES -#endif - -#define CPP_PREDEFINES "-Di386 -D_WIN32 \ - -DWINNT -D_X86_=1 -D__STDC__=1\ - -D__stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - -D__declspec(x)=__attribute__((x)) \ - -Asystem(winnt) -Acpu(i386) -Amachine(i386)" - -/* Normally, -lgcc is not needed since everything in it is in the DLL, but we - want to allow things to be added to it when installing new versions of - GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled - by calling the init function from the prologue. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{mdll: %{mno-cygwin:dllcrt1%O%s}} \ - %{!mdll: %{!mno-cygwin:crt0%O%s} \ - %{mno-cygwin:crt1%O%s} %{pg:gcrt0%O%s}}" - -#undef CPP_SPEC -#define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ - %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__} \ - %{mno-cygwin:-iwithprefixbefore \ - ../../../../%(mingw_include_path)/include/mingw32 -D__MINGW32__=0.2}" - -/* This macro defines names of additional specifications to put in the specs - that can be used in various specifications like CC1_SPEC. Its definition - is an initializer with a subgrouping for each command option. - - Each subgrouping contains a string constant, that defines the - specification name, and a string constant that used by the GNU CC driver - program. - - Do not define this macro if it does not need to do anything. */ - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "mingw_include_path", DEFAULT_TARGET_MACHINE } - -/* We have to dynamic link to get to the system DLLs. All of libc, libm and - the Unix stuff is in cygwin.dll. The import library is called - 'libcygwin.a'. For Windows applications, include more libraries, but - always include kernel32. We'd like to specific subsystem windows to - ld, but that doesn't work just yet. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{pg:-lgmon} \ - %{!mno-cygwin:-lcygwin} \ - %{mno-cygwin:-lmingw32 -lmoldname -lcrtdll} \ - %{mwindows:-lgdi32 -lcomdlg32} \ - -luser32 -lkernel32 -ladvapi32 -lshell32" - -#define LINK_SPEC "%{mwindows:--subsystem windows} \ - %{mconsole:--subsystem console} \ - %{mdll:--dll -e _DllMainCRTStartup@12}" - - -#define SIZE_TYPE "unsigned int" -#define PTRDIFF_TYPE "int" -#define WCHAR_UNSIGNED 1 -#define WCHAR_TYPE_SIZE 16 -#define WCHAR_TYPE "short unsigned int" - -#define HAVE_ATEXIT 1 - - -/* Enable parsing of #pragma pack(push,) and #pragma pack(pop). */ -#define HANDLE_PRAGMA_PACK_PUSH_POP 1 - -/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS - is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ -extern int i386_pe_valid_decl_attribute_p (); - -#undef VALID_MACHINE_DECL_ATTRIBUTE -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ - i386_pe_valid_decl_attribute_p (DECL, ATTRIBUTES, IDENTIFIER, ARGS) - -/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS - is a valid machine specific attribute for TYPE. - The attributes in ATTRIBUTES have previously been assigned to TYPE. */ - -#undef VALID_MACHINE_TYPE_ATTRIBUTE -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \ - i386_pe_valid_type_attribute_p (TYPE, ATTRIBUTES, IDENTIFIER, ARGS) -extern int i386_pe_valid_type_attribute_p (); - -extern union tree_node *i386_pe_merge_decl_attributes (); -#define MERGE_MACHINE_DECL_ATTRIBUTES(OLD, NEW) \ - i386_pe_merge_decl_attributes ((OLD), (NEW)) - -/* Used to implement dllexport overriding dllimport semantics. It's also used - to handle vtables - the first pass won't do anything because - DECL_CONTEXT (DECL) will be 0 so i386_pe_dll{ex,im}port_p will return 0. - It's also used to handle dllimport override semantics. */ -#if 0 -#define REDO_SECTION_INFO_P(DECL) \ - ((DECL_MACHINE_ATTRIBUTES (DECL) != NULL_TREE) \ - || (TREE_CODE (DECL) == VAR_DECL && DECL_VIRTUAL_P (DECL))) -#else -#define REDO_SECTION_INFO_P(DECL) 1 -#endif - - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_ctor, in_dtor, in_drectve - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CTOR_SECTION_FUNCTION \ - DTOR_SECTION_FUNCTION \ - DRECTVE_SECTION_FUNCTION \ - SWITCH_TO_SECTION_FUNCTION - -#define CTOR_SECTION_FUNCTION \ -void \ -ctor_section () \ -{ \ - if (in_section != in_ctor) \ - { \ - fprintf (asm_out_file, "\t.section .ctor\n"); \ - in_section = in_ctor; \ - } \ -} - -#define DTOR_SECTION_FUNCTION \ -void \ -dtor_section () \ -{ \ - if (in_section != in_dtor) \ - { \ - fprintf (asm_out_file, "\t.section .dtor\n"); \ - in_section = in_dtor; \ - } \ -} - -#define DRECTVE_SECTION_FUNCTION \ -void \ -drectve_section () \ -{ \ - if (in_section != in_drectve) \ - { \ - fprintf (asm_out_file, "%s\n", "\t.section .drectve\n"); \ - in_section = in_drectve; \ - } \ -} - -/* Switch to SECTION (an `enum in_section'). - - ??? This facility should be provided by GCC proper. - The problem is that we want to temporarily switch sections in - ASM_DECLARE_OBJECT_NAME and then switch back to the original section - afterwards. */ -#define SWITCH_TO_SECTION_FUNCTION \ -void \ -switch_to_section (section, decl) \ - enum in_section section; \ - tree decl; \ -{ \ - switch (section) \ - { \ - case in_text: text_section (); break; \ - case in_data: data_section (); break; \ - case in_named: named_section (decl, NULL, 0); break; \ - case in_ctor: ctor_section (); break; \ - case in_dtor: dtor_section (); break; \ - case in_drectve: drectve_section (); break; \ - default: abort (); break; \ - } \ -} - -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* Don't allow flag_pic to propagate since gas may produce invalid code - otherwise. */ - -#undef SUBTARGET_OVERRIDE_OPTIONS -#define SUBTARGET_OVERRIDE_OPTIONS \ -do { \ - if (flag_pic) \ - { \ - warning ("-f%s ignored for target (all code is position independent)",\ - (flag_pic > 1) ? "PIC" : "pic"); \ - flag_pic = 0; \ - } \ -} while (0) \ - -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - On i386 running Windows NT, modify the assembler name with a suffix - consisting of an atsign (@) followed by string of digits that represents - the number of bytes of arguments passed to the function, if it has the - attribute STDCALL. - - In addition, we must mark dll symbols specially. Definitions of - dllexport'd objects install some info in the .drectve section. - References to dllimport'd objects are fetched indirectly via - _imp__. If both are declared, dllexport overrides. This is also - needed to implement one-only vtables: they go into their own - section and we need to set DECL_SECTION_NAME so we do that here. - Note that we can be called twice on the same decl. */ - -extern void i386_pe_encode_section_info (); - -#ifdef ENCODE_SECTION_INFO -#undef ENCODE_SECTION_INFO -#endif -#define ENCODE_SECTION_INFO(DECL) i386_pe_encode_section_info (DECL) - -/* Utility used only in this file. */ -#define I386_PE_STRIP_ENCODING(SYM_NAME) \ - ((SYM_NAME) + ((SYM_NAME)[0] == '@' ? 3 : 0)) - -/* This macro gets just the user-specified name - out of the string in a SYMBOL_REF. Discard - trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ -#undef STRIP_NAME_ENCODING -#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ -do { \ - char *_p; \ - char *_name = I386_PE_STRIP_ENCODING (SYMBOL_NAME); \ - for (_p = _name; *_p && *_p != '@'; ++_p) \ - ; \ - if (*_p == '@') \ - { \ - int _len = _p - _name; \ - (VAR) = (char *) alloca (_len + 1); \ - strncpy ((VAR), _name, _len); \ - (VAR)[_len] = '\0'; \ - } \ - else \ - (VAR) = _name; \ -} while (0) - - -/* Output a reference to a label. */ -#undef ASM_OUTPUT_LABELREF -#define ASM_OUTPUT_LABELREF(STREAM, NAME) \ - fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, \ - I386_PE_STRIP_ENCODING (NAME)) \ - -/* Output a common block. */ -#undef ASM_OUTPUT_COMMON -#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ -do { \ - if (i386_pe_dllexport_name_p (NAME)) \ - i386_pe_record_exported_symbol (NAME); \ - if (! i386_pe_dllimport_name_p (NAME)) \ - { \ - fprintf ((STREAM), "\t.comm\t"); \ - assemble_name ((STREAM), (NAME)); \ - fprintf ((STREAM), ", %d\t%s %d\n", \ - (ROUNDED), ASM_COMMENT_START, (SIZE)); \ - } \ -} while (0) - -/* Output the label for an initialized variable. */ -#undef ASM_DECLARE_OBJECT_NAME -#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ -do { \ - if (i386_pe_dllexport_name_p (NAME)) \ - i386_pe_record_exported_symbol (NAME); \ - ASM_OUTPUT_LABEL ((STREAM), (NAME)); \ -} while (0) - - -/* Emit code to check the stack when allocating more that 4000 - bytes in one go. */ - -#define CHECK_STACK_LIMIT 4000 - -/* By default, target has a 80387, uses IEEE compatible arithmetic, - and returns float values in the 387 and needs stack probes */ -#undef TARGET_DEFAULT - -#define TARGET_DEFAULT \ - (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE) - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) - -/* Define this macro if in some cases global symbols from one translation - unit may not be bound to undefined symbols in another translation unit - without user intervention. For instance, under Microsoft Windows - symbols must be explicitly imported from shared libraries (DLLs). */ -#define MULTIPLE_SYMBOL_SPACES - -#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL) -extern void i386_pe_unique_section (); -#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC) - -#define SUPPORTS_ONE_ONLY 1 - -/* A C statement to output something to the assembler file to switch to section - NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or - NULL_TREE. Some target formats do not support arbitrary sections. Do not - define this macro in such cases. */ -#undef ASM_OUTPUT_SECTION_NAME -#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \ -do { \ - static struct section_info \ - { \ - struct section_info *next; \ - char *name; \ - enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ - } *sections; \ - struct section_info *s; \ - char *mode; \ - enum sect_enum type; \ - \ - for (s = sections; s; s = s->next) \ - if (!strcmp (NAME, s->name)) \ - break; \ - \ - if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ - type = SECT_EXEC, mode = "x"; \ - else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ - type = SECT_RO, mode = ""; \ - else \ - type = SECT_RW, mode = "w"; \ - \ - if (s == 0) \ - { \ - s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ - s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ - strcpy (s->name, NAME); \ - s->type = type; \ - s->next = sections; \ - sections = s; \ - fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \ - /* Functions may have been compiled at various levels of \ - optimization so we can't use `same_size' here. Instead, \ - have the linker pick one. */ \ - if ((DECL) && DECL_ONE_ONLY (DECL)) \ - fprintf (STREAM, "\t.linkonce %s\n", \ - TREE_CODE (DECL) == FUNCTION_DECL \ - ? "discard" : "same_size"); \ - } \ - else \ - { \ - fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \ - } \ -} while (0) - -/* Write the extra assembler code needed to declare a function - properly. If we are generating SDB debugging information, this - will happen automatically, so we only need to handle other cases. */ -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do \ - { \ - if (i386_pe_dllexport_name_p (NAME)) \ - i386_pe_record_exported_symbol (NAME); \ - if (write_symbols != SDB_DEBUG) \ - i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \ - ASM_OUTPUT_LABEL (FILE, NAME); \ - } \ - while (0) - -/* Add an external function to the list of functions to be declared at - the end of the file. */ -#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ - do \ - { \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ - i386_pe_record_external_function (NAME); \ - } \ - while (0) - -/* Declare the type properly for any external libcall. */ -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ - i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1) - -/* Output function declarations at the end of the file. */ -#define ASM_FILE_END(FILE) \ - i386_pe_asm_file_end (FILE) - -#undef ASM_COMMENT_START -#define ASM_COMMENT_START " #" - -/* DWARF2 Unwinding doesn't work with exception handling yet. */ -#define DWARF2_UNWIND_INFO 0 - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#define SUBTARGET_PROLOGUE \ - if (profile_flag \ - && strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)),\ - "main") == 0) \ - { \ - rtx xops[1]; \ - xops[0] = gen_rtx_MEM (FUNCTION_MODE, \ - gen_rtx (SYMBOL_REF, Pmode, "_monstartup")); \ - if (do_rtl) \ - emit_call_insn (gen_rtx (CALL, VOIDmode, xops[0], const0_rtx)); \ - else \ - output_asm_insn (AS1 (call,%P1), xops); \ - } - -/* External function declarations. */ - -#ifndef PROTO -#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__) -#define PROTO(ARGS) ARGS -#else -#define PROTO(ARGS) () -#endif -#endif - -#ifdef BUFSIZ /* stdio.h has been included, ok to use FILE * */ -#define STDIO_PROTO(ARGS) PROTO(ARGS) -#else -#define STDIO_PROTO(ARGS) () -#endif - -extern void i386_pe_record_external_function PROTO((char *)); -extern void i386_pe_declare_function_type STDIO_PROTO((FILE *, char *, int)); -extern void i386_pe_record_exported_symbol PROTO((char *)); -extern void i386_pe_asm_file_end STDIO_PROTO((FILE *)); - -/* For Win32 ABI compatibility */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* No data type wants to be aligned rounder than this. */ -#undef BIGGEST_ALIGNMENT -#define BIGGEST_ALIGNMENT 128 - -/* A bitfield declared as `int' forces `int' alignment for the struct. */ -#undef PCC_BITFIELDS_TYPE_MATTERS -#define PCC_BITFIELDS_TYPE_MATTERS 0 - -/* Enable alias attribute support. */ -#ifndef SET_ASM_OP -#define SET_ASM_OP "\t.set" -#endif - diff --git a/contrib/gcc/config/i386/dgux.c b/contrib/gcc/config/i386/dgux.c deleted file mode 100644 index 638d1e0f60e6..000000000000 --- a/contrib/gcc/config/i386/dgux.c +++ /dev/null @@ -1,192 +0,0 @@ -/* Subroutines for GNU compiler for Intel 80x86 running DG/ux - Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. - Currently maintained by (gcc@dg-rtp.dg.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include "i386/i386.c" - - -extern char *version_string; - -struct option -{ - char *string; - int *variable; - int on_value; - char *description; -}; - -static int -output_option (file, sep, type, name, indent, pos, max) - FILE *file; - char *sep; - char *type; - char *name; - char *indent; - int pos; - int max; -{ - if (strlen (sep) + strlen (type) + strlen (name) + pos > max) - { - fprintf (file, indent); - return fprintf (file, "%s%s", type, name); - } - return pos + fprintf (file, "%s%s%s", sep, type, name); -} - -static struct { char *name; int value; } m_options[] = TARGET_SWITCHES; - -static void -output_options (file, f_options, f_len, W_options, W_len, - pos, max, sep, indent, term) - FILE *file; - struct option *f_options; - struct option *W_options; - int f_len, W_len; - int pos; - int max; - char *indent; - char *term; -{ - register int j; - - if (optimize) - pos = output_option (file, sep, "-O", "", indent, pos, max); - if (write_symbols != NO_DEBUG) - pos = output_option (file, sep, "-g", "", indent, pos, max); -/* if (flag_traditional) - pos = output_option (file, sep, "-traditional", "", indent, pos, max);*/ - if (profile_flag) - pos = output_option (file, sep, "-p", "", indent, pos, max); - if (profile_block_flag) - pos = output_option (file, sep, "-a", "", indent, pos, max); - - for (j = 0; j < f_len; j++) - if (*f_options[j].variable == f_options[j].on_value) - pos = output_option (file, sep, "-f", f_options[j].string, - indent, pos, max); - - for (j = 0; j < W_len; j++) - if (*W_options[j].variable == W_options[j].on_value) - pos = output_option (file, sep, "-W", W_options[j].string, - indent, pos, max); - - for (j = 0; j < sizeof m_options / sizeof m_options[0]; j++) - if (m_options[j].name[0] != '\0' - && m_options[j].value > 0 - && ((m_options[j].value & target_flags) - == m_options[j].value)) - pos = output_option (file, sep, "-m", m_options[j].name, - indent, pos, max); - - pos = output_option (file, sep, "-mcpu=", ix86_cpu_string, indent, pos, max); - pos = output_option (file, sep, "-march=", ix86_arch_string, indent, pos, max); - fprintf (file, term); -} - -/* Output to FILE the start of the assembler file. */ - -void -output_file_start (file, f_options, f_len, W_options, W_len) - FILE *file; - struct option *f_options; - struct option *W_options; - int f_len, W_len; -{ - register int pos; - - output_file_directive (file, main_input_filename); - fprintf (file, "\t.version\t\"01.01\"\n"); \ - /* Switch to the data section so that the coffsem symbol and the - gcc2_compiled. symbol aren't in the text section. */ - data_section (); - - pos = fprintf (file, "\n// cc1 (%s) arguments:", VERSION_STRING); - output_options (file, f_options, f_len, W_options, W_len, - pos, 75, " ", "\n// ", "\n\n"); - -#ifdef TARGET_IDENTIFY_REVISION - if (TARGET_IDENTIFY_REVISION) - { - char indent[256]; - - time_t now = time ((time_t *)0); - sprintf (indent, "]\"\n\t%s\t \"@(#)%s [", IDENT_ASM_OP, main_input_filename); - fprintf (file, indent+3); - pos = fprintf (file, "gcc %s, %.24s,", VERSION_STRING, ctime (&now)); - output_options (file, f_options, f_len, W_options, W_len, - pos, 150 - strlen (indent), " ", indent, "]\"\n\n"); - } -#endif /* TARGET_IDENTIFY_REVISION */ -} - -#ifndef CROSS_COMPILE -#if defined (_abort_aux) -/* Debugging aid to be registered via `atexit'. See the definition - of abort in dgux.h. */ -void -abort_aux () -{ - extern int insn_; - extern char * file_; - extern int line_; - static int done; - rtx line_note; - - if (done++) - return; - if (file_ || line_) - { - if (write_symbols != NO_DEBUG) - { - for (line_note = (rtx) insn_ ; line_note != 0 ; line_note = PREV_INSN (line_note)) - if (GET_CODE (line_note) == NOTE && NOTE_LINE_NUMBER (line_note) > 0) - break; - if (line_note != 0) - { - error_with_file_and_line (NOTE_SOURCE_FILE (line_note), - NOTE_LINE_NUMBER (line_note), - "Internal gcc abort from %s:%d", - file_ ? file_ : "", line_); - if (insn_ && file_ && strcmp (file_, "toplev.c")) - { - error_with_file_and_line (NOTE_SOURCE_FILE (line_note), - NOTE_LINE_NUMBER (line_note), - "The local variable `insn' has the value:", 0); - debug_rtx ((rtx) insn_); - } - } - } - if (write_symbols == NO_DEBUG || line_note == 0) - { - error ("Internal gcc abort from %s:%d", - file_ ? file_ : "", line_); - if (insn_ && file_ && strcmp (file_, "toplev.c")) - { - error ("The local variable `insn' has the value:", 0); - debug_rtx ((rtx) insn_); - } - } - } -} -#endif -#endif - - diff --git a/contrib/gcc/config/i386/dgux.h b/contrib/gcc/config/i386/dgux.h deleted file mode 100644 index 9e41d6512b86..000000000000 --- a/contrib/gcc/config/i386/dgux.h +++ /dev/null @@ -1,248 +0,0 @@ -/* Target definitions for GNU compiler for Intel 80x86 running DG/ux - Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Currently maintained by gcc@dg-rtp.dg.com. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* for now, we are just like the sysv4 version with a - few hacks -*/ - -#include "i386/sysv4.h" - -#ifndef VERSION_INFO2 -#define VERSION_INFO2 "$Revision: 1.6 $" -#endif - -#ifndef VERSION_STRING -#define VERSION_STRING version_string -#endif - -/* Identify the compiler. */ -/* TARGET_VERSION used by toplev.c VERSION_STRING used by -midentify-revision */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (%s%s, %s)", \ - VERSION_INFO1, VERSION_INFO2, __DATE__) -#undef VERSION_INFO1 -#define VERSION_INFO1 "ix86 DG/ux, " - -/* Augment TARGET_SWITCHES with the MXDB options. */ -#define MASK_STANDARD 0x40000000 /* Retain standard information */ -#define MASK_NOLEGEND 0x20000000 /* Discard legend information */ -#define MASK_EXTERNAL_LEGEND 0x10000000 /* Make external legends */ -#define MASK_IDENTIFY_REVISION 0x08000000 /* Emit 'ident' to .s */ -#define MASK_WARN_PASS_STRUCT 0x04000000 /* Warn when structures are passed */ - -#define TARGET_STANDARD (target_flags & MASK_STANDARD) -#define TARGET_NOLEGEND (target_flags & MASK_NOLEGEND) -#define TARGET_EXTERNAL_LEGEND (target_flags & MASK_EXTERNAL_LEGEND) -#define TARGET_IDENTIFY_REVISION (target_flags & MASK_IDENTIFY_REVISION) -#define TARGET_WARN_PASS_STRUCT (target_flags & MASK_WARN_PASS_STRUCT) - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - { "standard", MASK_STANDARD, "Retain standard MXDB information" }, \ - { "legend", -MASK_NOLEGEND, "Retain legend information" }, \ - { "no-legend", MASK_NOLEGEND, "" }, \ - { "external-legend", MASK_EXTERNAL_LEGEND, "Generate external legend information" }, \ - { "identify-revision", MASK_IDENTIFY_REVISION, "Emit identifying info in .s file" }, \ - { "warn-passed-structs", MASK_WARN_PASS_STRUCT, "Warn when a function arg is a structure" }, - -#undef DWARF_DEBUGGING_INFO -#define DWARF_DEBUGGING_INFO - -/* - allow -gstabs so that those who have gnu-as installed - can debug c++ programs. -*/ -#undef DBX_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO - -#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG - -/* Override svr[34].h. */ -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - output_file_start (FILE, f_options, sizeof f_options / sizeof f_options[0], \ - W_options, sizeof W_options / sizeof W_options[0]) - -/* ix86 abi specified type for wchar_t */ - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - - -/* Some machines may desire to change what optimizations are performed for - various optimization levels. This macro, if defined, is executed once - just after the optimization level is determined and before the remainder - of the command options have been parsed. Values set in this macro are - used as the default values for the other command line options. - - LEVEL is the optimization level specified; 2 if -O2 is specified, - 1 if -O is specified, and 0 if neither is specified. */ - -/* This macro used to store 0 in flag_signed_bitfields. - Not only is that misuse of this macro; the whole idea is wrong. - - The GNU C dialect makes bitfields signed by default, - regardless of machine type. Making any machine inconsistent in this - regard is bad for portability. - - I chose to make bitfields signed by default because this is consistent - with the way ordinary variables are handled: `int' equals `signed int'. - If there is a good reason to prefer making bitfields unsigned by default, - it cannot have anything to do with the choice of machine. - If the reason is good enough, we should change the convention for all machines. - - -- rms, 20 July 1991. */ - -/* - this really should go into dgux-local.h -*/ - -#undef OPTIMIZATION_OPTIONS -#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \ - do { \ - extern int flag_signed_bitfields; \ - flag_signed_bitfields = 0; \ - optimization_options (LEVEL,SIZE); \ - } while (0) - - -/* The normal location of the `ld' and `as' programs */ - -#undef MD_EXEC_PREFIX -#define MD_EXEC_PREFIX "/usr/bin/" - -/* The normal location of the various *crt*.o files is the */ - -#undef MD_STARTFILE_PREFIX -#define MD_STARTFILE_PREFIX "/usr/lib/" - -/* Macros to be automatically defined. - __CLASSIFY_TYPE__ is used in the and header - files with DG/UX revision 5.40 and later. This allows GNU CC to - operate without installing the header files. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386 -D__ix86 -Dunix -DDGUX -D__CLASSIFY_TYPE__=2\ - -Asystem(unix) -Asystem(svr4) -Acpu(i386) -Amachine(i386)" - - /* - If not -ansi, -traditional, or restricting include files to one - specific source target, specify full DG/UX features. - */ -#undef CPP_SPEC -#define CPP_SPEC "%{!ansi:%{!traditional:-D__OPEN_NAMESPACE__}}" - -/* Assembler support (legends for mxdb). */ -#undef ASM_SPEC -#define ASM_SPEC "\ -%{mno-legend:%{mstandard:-Wc,off}}\ -%{g:%{!mno-legend:-Wc,-fix-bb,-s\"%i\"\ -%{traditional:,-lc}%{!traditional:,-lansi-c}\ -%{mstandard:,-keep-std}\ -%{mexternal-legend:,-external}}}" - -/* Override svr4.h. */ - -/* hassey 3/12/94 keep svr4 ASM_FINAL_SPEC allows -pipe to work */ - -/* Linker and library spec's. - -static, -shared, -symbolic, -h* and -z* access AT&T V.4 link options. - -svr4 instructs gcc to place /usr/lib/values-X[cat].o on link the line. - The absence of -msvr4 indicates linking done in a COFF environment and - adds the link script to the link line. In all environments, the first - and last objects are crtbegin.o and crtend.o. - When the -G link option is used (-shared and -symbolic) a final link is - not being done. */ - -#undef LIB_SPEC -#define LIB_SPEC \ -"%{!shared:%{!symbolic:-lc}}" - -#undef LINK_SPEC -#define LINK_SPEC "%{z*} %{h*} %{v:-V} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy} \ - %{symbolic:-Bsymbolic -G -dy} \ - %{pg:-L/usr/lib/libp}%{p:-L/usr/lib/libp}" - -#ifdef CROSS_COMPILE - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared:%{!symbolic:%{pg:gcrt1.o%s} \ - %{!pg:%{p:mcrt1.o%s} \ - %{!p:crt1.o%s}}}} \ - %{pg:gcrti.o%s}%{!pg:crti.o%s} \ - crtbegin.o%s \ - %{ansi:values-Xc.o%s} \ - %{!ansi:%{traditional:values-Xt.o%s} \ - %{!traditional:values-Xa.o%s}}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o}%{!pg:crtn.o%s}" - -#else - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared:%{!symbolic:%{pg:gcrt1.o%s} \ - %{!pg:%{p:/lib/mcrt1.o%s} \ - %{!p:/lib/crt1.o%s}}} \ - %{pg:gcrti.o%s}%{!pg:/lib/crti.o%s}} \ - crtbegin.o%s \ - %{ansi:/lib/values-Xc.o%s} \ - %{!ansi:%{traditional:/lib/values-Xt.o%s} \ - %{!traditional:/lib/values-Xa.o%s}}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o}%{!pg:/lib/crtn.o}" - -#endif /* CROSS_COMPILE */ - -/* The maximum alignment which the object file format can support. - page alignment would seem to be enough */ -#undef MAX_OFILE_ALIGNMENT -#define MAX_OFILE_ALIGNMENT 0x1000 - -/* Must use data section for relocatable constants when pic. */ -#undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX) \ -{ \ - if (flag_pic && symbolic_operand (RTX)) \ - data_section (); \ - else \ - const_section (); \ -} - -/* This supplements FUNCTION_ARG's definition in i386.h to check - TARGET_WARN_PASS_STRUCT */ - -#undef FUNCTION_ARG -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ -((((MODE) == BLKmode && TARGET_WARN_PASS_STRUCT) ? \ - warning ("argument is a structure"),0 : 0), \ - (function_arg (&CUM, MODE, TYPE, NAMED))) - -/* Add .align 1 to avoid .backalign bug in assembler */ -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP ".section\t.rodata\n\t.align 1" diff --git a/contrib/gcc/config/i386/djgpp-rtems.h b/contrib/gcc/config/i386/djgpp-rtems.h deleted file mode 100644 index b355cc5796ab..000000000000 --- a/contrib/gcc/config/i386/djgpp-rtems.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Configuration for an i386 running RTEMS on top of MS-DOS with - DJGPP v2.x. - - Copyright (C) 1996,1999 Free Software Foundation, Inc. - Contributed by Joel Sherrill (joel@OARcorp.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/djgpp.h" - -/* Specify predefined symbols in preprocessor. */ - -#ifdef CPP_PREDEFINES -#undef CPP_PREDEFINES -#endif -#define CPP_PREDEFINES "-Dunix -Di386 -DGO32 -DDJGPP=2 -DMSDOS \ - -Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386) \ - -Asystem(rtems)" - -/* Generate calls to memcpy, memcmp and memset. */ -#ifndef TARGET_MEM_FUNCTIONS -#define TARGET_MEM_FUNCTIONS -#endif - -/* end of i386/djgpp-rtems.h */ - diff --git a/contrib/gcc/config/i386/djgpp.h b/contrib/gcc/config/i386/djgpp.h deleted file mode 100644 index 5727b0a9bbd2..000000000000 --- a/contrib/gcc/config/i386/djgpp.h +++ /dev/null @@ -1,161 +0,0 @@ -/* Configuration for an i386 running MS-DOS with DJGPP. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "dbxcoff.h" - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#define HANDLE_SYSV_PRAGMA - -/* Enable parsing of #pragma pack(push,) and #pragma pack(pop). */ -#define HANDLE_PRAGMA_PACK_PUSH_POP 1 - -#define YES_UNDERSCORES - -#include "i386/gas.h" - -/* Enable alias attribute support. */ -#ifndef SET_ASM_OP -#define SET_ASM_OP "\t.set" -#endif - -/* Search for as.exe and ld.exe in DJGPP's binary directory. */ -#define MD_EXEC_PREFIX "$DJDIR/bin/" - -/* Correctly handle absolute filename detection in cp/xref.c */ -#define FILE_NAME_ABSOLUTE_P(NAME) \ - (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \ - (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':'))) - -#ifdef CPP_PREDEFINES -#undef CPP_PREDEFINES -#endif -#define CPP_PREDEFINES "-Dunix -Di386 -DGO32 -DDJGPP=2 -DMSDOS \ - -Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386)" - -/* We need to override link_command_spec in gcc.c so support -Tdjgpp.djl. - This cannot be done in LINK_SPECS as that LINK_SPECS is processed - before library search directories are known by the linker. - This avoids problems when specs file is not available. An alternate way, - suggested by Robert Hoehne, is to use SUBTARGET_EXTRA_SPECS instead. -*/ - -#undef LINK_COMMAND_SPEC -#define LINK_COMMAND_SPEC \ -"%{!fsyntax-only: \ -%{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ -\t%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\ -\t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ -\t%{static:} %{L*} %D %o\ -\t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\ -\t%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\ -\t-Tdjgpp.djl %{T*}}}}}}}\n\ -%{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}" - -/* Always just link in 'libc.a'. */ -#undef LIB_SPEC -#define LIB_SPEC "-lc" - -/* Pick the right startup code depending on the -pg flag. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}" - -/* Make sure that gcc will not look for .h files in /usr/local/include - unless user explicitly requests it. */ -#undef LOCAL_INCLUDE_DIR - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_ctor, in_dtor - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CTOR_SECTION_FUNCTION \ - DTOR_SECTION_FUNCTION - -#define CTOR_SECTION_FUNCTION \ -void \ -ctor_section () \ -{ \ - if (in_section != in_ctor) \ - { \ - fprintf (asm_out_file, "\t.section .ctor\n"); \ - in_section = in_ctor; \ - } \ -} - -#define DTOR_SECTION_FUNCTION \ -void \ -dtor_section () \ -{ \ - if (in_section != in_dtor) \ - { \ - fprintf (asm_out_file, "\t.section .dtor\n"); \ - in_section = in_dtor; \ - } \ -} - -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* Allow (eg) __attribute__((section "locked")) to work */ -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\ - do { \ - fprintf (FILE, "\t.section %s\n", NAME); \ - } while (0) - -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - output_file_directive (FILE, main_input_filename); \ - } while (0) - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG) - -/* djgpp has atexit (). */ -#undef HAVE_ATEXIT -#define HAVE_ATEXIT - -/* djgpp automatically calls its own version of __main, so don't define one - in libgcc, nor call one in main(). */ -#define HAS_INIT_SECTION diff --git a/contrib/gcc/config/i386/freebsd-aout.h b/contrib/gcc/config/i386/freebsd-aout.h deleted file mode 100644 index 89fe21623a96..000000000000 --- a/contrib/gcc/config/i386/freebsd-aout.h +++ /dev/null @@ -1,247 +0,0 @@ -/* Definitions of target machine for GNU compiler for Intel 80386 - running FreeBSD. - Copyright (C) 1988, 1992, 1994, 1996, 1997 Free Software Foundation, Inc. - Contributed by Poul-Henning Kamp - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This is tested by i386gas.h. */ -#define YES_UNDERSCORES - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#include "i386/gstabs.h" - -/* Get perform_* macros to build libgcc.a. */ -#include "i386/perform.h" - -/* This goes away when the math-emulator is fixed */ -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ - (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387) - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)" - -/* Like the default, except no -lg. */ -#define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}" - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#define WCHAR_UNSIGNED 0 - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -#define HAVE_ATEXIT - -/* Override the default comment-starter of "/". */ - -#undef ASM_COMMENT_START -#define ASM_COMMENT_START "#" - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -/* FreeBSD using a.out does not support DWARF2 unwinding mechanisms. */ -#define DWARF2_UNWIND_INFO 0 - -/* The following macros are stolen from i386v4.h */ -/* These have to be defined to get PIC code correct */ - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ - -#define JUMP_TABLES_IN_TEXT_SECTION 1 - -/* Don't default to pcc-struct-return, because in FreeBSD we prefer the - superior nature of the older gcc way. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* Ensure we the configuration knows our system correctly so we can link with - libraries compiled with the native cc. */ -#undef NO_DOLLAR_IN_LABEL - -/* i386 freebsd still uses old binutils that don't insert nops by default - when the .align directive demands to insert extra space in the text - segment. */ -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG)) - -/* Profiling routines, partially copied from i386/osfrose.h. */ - -/* Redefine this to use %eax instead of %edx. */ -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - { \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n", \ - LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall mcount\n"); \ - } \ -} - -/* - * Some imports from svr4.h in support of shared libraries. - * Currently, we need the DECLARE_OBJECT_SIZE stuff. - */ - -/* Define the strings used for the special svr4 .type and .size directives. - These strings generally do not vary from one system running svr4 to - another, but if a given system (e.g. m88k running svr) needs to use - different pseudo-op names for these, they may be overridden in the - file which includes this one. */ - -#define TYPE_ASM_OP ".type" -#define SIZE_ASM_OP ".size" - -/* The following macro defines the format used to output the second - operand of the .type assembler directive. Different svr4 assemblers - expect various different forms for this operand. The one given here - is just a default. You may need to override it in your machine- - specific tm.h file (depending upon the particulars of your assembler). */ - -#define TYPE_OPERAND_FMT "@%s" - -/* Write the extra assembler code needed to declare a function's result. - Most svr4 assemblers don't require any special declaration of the - result value, but there are exceptions. */ - -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -/* These macros generate the special .type and .size directives which - are used to set the corresponding fields of the linker symbol table - entries in an ELF object file under SVR4. These macros also output - the starting labels for the relevant functions/objects. */ - -/* Write the extra assembler code needed to declare a function properly. - Some svr4 assemblers need to also have something extra said about the - function's return value. We allow for that here. */ - -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', FILE); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Write the extra assembler code needed to declare an object properly. */ - -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', FILE); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Output the size directive for a decl in rest_of_decl_compilation - in the case where we did not do so before the initializer. - Once we find the error_mark_node, we know that the value of - size_directive_output was set - by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ - -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ - } \ - } while (0) - - -/* This is how to declare the size of a function. */ - -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - { \ - char label[256]; \ - static int labelno; \ - labelno++; \ - ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, (FNAME)); \ - fprintf (FILE, ","); \ - assemble_name (FILE, label); \ - fprintf (FILE, "-"); \ - assemble_name (FILE, (FNAME)); \ - putc ('\n', FILE); \ - } \ - } while (0) - -#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k}" -#define LINK_SPEC \ - "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \ - %{shared:-Bshareable} \ - %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \ - %{pg:-Bstatic} %{Z}} \ - %{assert*} %{R*}" - -#define STARTFILE_SPEC \ - "%{shared:c++rt0.o%s} \ - %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}" diff --git a/contrib/gcc/config/i386/freebsd-elf.h b/contrib/gcc/config/i386/freebsd-elf.h deleted file mode 100644 index e97d4ca07bb2..000000000000 --- a/contrib/gcc/config/i386/freebsd-elf.h +++ /dev/null @@ -1,257 +0,0 @@ -/* Definitions for Intel 386 running FreeBSD with ELF format - Copyright (C) 1996 Free Software Foundation, Inc. - Contributed by Eric Youngdale. - Modified for stabs-in-ELF by H.J. Lu. - Adapted from GNU/Linux version by John Polstra. - Continued development by David O'Brien - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); - -/* The svr4 ABI for the i386 says that records and unions are returned - in memory. */ -/* On FreeBSD, we do not. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using - libraries compiled with the native cc, so undef it. */ -#undef NO_DOLLAR_IN_LABEL - -/* Use more efficient ``thunks'' to implement C++ vtables. */ -#undef DEFAULT_VTABLE_THUNKS -#define DEFAULT_VTABLE_THUNKS 1 - -/* Override the default comment-starter of "/". */ -#undef ASM_COMMENT_START -#define ASM_COMMENT_START "#" - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -#undef SET_ASM_OP -#define SET_ASM_OP ".set" - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ -#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) - -/* Use stabs instead of DWARF debug format. */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* Copy this from the svr4 specifications... */ -/* Define the register numbers to be used in Dwarf debugging information. - The SVR4 reference port C compiler uses the following register numbers - in its Dwarf output code: - 0 for %eax (gnu regno = 0) - 1 for %ecx (gnu regno = 2) - 2 for %edx (gnu regno = 1) - 3 for %ebx (gnu regno = 3) - 4 for %esp (gnu regno = 7) - 5 for %ebp (gnu regno = 6) - 6 for %esi (gnu regno = 4) - 7 for %edi (gnu regno = 5) - The following three DWARF register numbers are never generated by - the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4 - believes these numbers have these meanings. - 8 for %eip (no gnu equivalent) - 9 for %eflags (no gnu equivalent) - 10 for %trapno (no gnu equivalent) - It is not at all clear how we should number the FP stack registers - for the x86 architecture. If the version of SDB on x86/svr4 were - a bit less brain dead with respect to floating-point then we would - have a precedent to follow with respect to DWARF register numbers - for x86 FP registers, but the SDB on x86/svr4 is so completely - broken with respect to FP registers that it is hardly worth thinking - of it as something to strive for compatibility with. - The version of x86/svr4 SDB I have at the moment does (partially) - seem to believe that DWARF register number 11 is associated with - the x86 register %st(0), but that's about all. Higher DWARF - register numbers don't seem to be associated with anything in - particular, and even for DWARF regno 11, SDB only seems to under- - stand that it should say that a variable lives in %st(0) (when - asked via an `=' command) if we said it was in DWARF regno 11, - but SDB still prints garbage when asked for the value of the - variable in question (via a `/' command). - (Also note that the labels SDB prints for various FP stack regs - when doing an `x' command are all wrong.) - Note that these problems generally don't affect the native SVR4 - C compiler because it doesn't allow the use of -O with -g and - because when it is *not* optimizing, it allocates a memory - location for each floating-point variable, and the memory - location is what gets described in the DWARF AT_location - attribute for the variable in question. - Regardless of the severe mental illness of the x86/svr4 SDB, we - do something sensible here and we use the following DWARF - register numbers. Note that these are all stack-top-relative - numbers. - 11 for %st(0) (gnu regno = 8) - 12 for %st(1) (gnu regno = 9) - 13 for %st(2) (gnu regno = 10) - 14 for %st(3) (gnu regno = 11) - 15 for %st(4) (gnu regno = 12) - 16 for %st(5) (gnu regno = 13) - 17 for %st(6) (gnu regno = 14) - 18 for %st(7) (gnu regno = 15) -*/ -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ - : (-1)) - -/* Tell final.c that we don't need a label passed to mcount. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - fprintf (FILE, "\tcall *.mcount@GOT(%%ebx)\n"); \ - else \ - fprintf (FILE, "\tcall .mcount\n"); \ -} - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_UNSIGNED -#define WCHAR_UNSIGNED 0 - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" - -/* This defines which switch letters take arguments. On FreeBSD, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker) (comming from svr4). - We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'h' \ - || (CHAR) == 'z' \ - || (CHAR) == 'R') - -/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add - the magical crtbegin.o file (see crtstuff.c) which provides part - of the support for getting C++ file-scope static object constructed - before entering `main'. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ - %{!p:%{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on - the magical crtend.o file (see crtstuff.c) which provides part of - the support for getting C++ file-scope static object constructed - before entering `main', followed by a normal "finalizer" file, - `crtn.o'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" - -/* Provide a LIB_SPEC appropriate for FreeBSD. Just select the appropriate - libc, depending on whether we're doing profiling or need threads support. - (simular to the default, except no -lg, and no -p. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{!shared: \ - %{!pg:%{!pthread:%{!kthread:-lc} \ - %{kthread:-lpthread -lc}} \ - %{pthread:-lc_r}} \ - %{pg:%{!pthread:%{!kthread:-lc_p} \ - %{kthread:-lpthread_p -lc_p}} \ - %{pthread:-lc_r_p}}}" - -/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support - for the special GCC options -static and -shared, which allow us to - link things in one of these three modes by applying the appropriate - combinations of options at link-time. We like to support here for - as many of the other GNU linker options as possible. But I don't - have the time to search for those flags. I am sure how to add - support for -soname shared_object_name. H.J. - - I took out %{v:%{!V:-V}}. It is too much :-(. They can use - -Wl,-V. - - When the -shared link option is used a final link is not being - done. */ - -#undef LINK_SPEC -#define LINK_SPEC "-m elf_i386 \ - %{Wl,*:%*} \ - %{v:-V} \ - %{assert*} %{R*} %{rpath*} %{defsym*} \ - %{shared:-Bshareable %{h*} %{soname*}} \ - %{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \ - %{static:-Bstatic}} \ - %{symbolic:-Bsymbolic}" - -/* A C statement to output to the stdio stream FILE an assembler - command to advance the location counter to a multiple of 1< - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); - -/* The svr4 ABI for the i386 says that records and unions are returned - in memory. */ -/* On FreeBSD, we do not. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using - libraries compiled with the native cc, so undef it. */ -#undef NO_DOLLAR_IN_LABEL - -/* Use more efficient ``thunks'' to implement C++ vtables. */ -#undef DEFAULT_VTABLE_THUNKS -#define DEFAULT_VTABLE_THUNKS 2 - -/* Override the default comment-starter of "/". */ -#undef ASM_COMMENT_START -#define ASM_COMMENT_START "#" - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -#undef SET_ASM_OP -#define SET_ASM_OP ".set" - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ -#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) - -/* Use stabs instead of DWARF debug format. */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* Copy this from the svr4 specifications... */ -/* Define the register numbers to be used in Dwarf debugging information. - The SVR4 reference port C compiler uses the following register numbers - in its Dwarf output code: - 0 for %eax (gnu regno = 0) - 1 for %ecx (gnu regno = 2) - 2 for %edx (gnu regno = 1) - 3 for %ebx (gnu regno = 3) - 4 for %esp (gnu regno = 7) - 5 for %ebp (gnu regno = 6) - 6 for %esi (gnu regno = 4) - 7 for %edi (gnu regno = 5) - The following three DWARF register numbers are never generated by - the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4 - believes these numbers have these meanings. - 8 for %eip (no gnu equivalent) - 9 for %eflags (no gnu equivalent) - 10 for %trapno (no gnu equivalent) - It is not at all clear how we should number the FP stack registers - for the x86 architecture. If the version of SDB on x86/svr4 were - a bit less brain dead with respect to floating-point then we would - have a precedent to follow with respect to DWARF register numbers - for x86 FP registers, but the SDB on x86/svr4 is so completely - broken with respect to FP registers that it is hardly worth thinking - of it as something to strive for compatibility with. - The version of x86/svr4 SDB I have at the moment does (partially) - seem to believe that DWARF register number 11 is associated with - the x86 register %st(0), but that's about all. Higher DWARF - register numbers don't seem to be associated with anything in - particular, and even for DWARF regno 11, SDB only seems to under- - stand that it should say that a variable lives in %st(0) (when - asked via an `=' command) if we said it was in DWARF regno 11, - but SDB still prints garbage when asked for the value of the - variable in question (via a `/' command). - (Also note that the labels SDB prints for various FP stack regs - when doing an `x' command are all wrong.) - Note that these problems generally don't affect the native SVR4 - C compiler because it doesn't allow the use of -O with -g and - because when it is *not* optimizing, it allocates a memory - location for each floating-point variable, and the memory - location is what gets described in the DWARF AT_location - attribute for the variable in question. - Regardless of the severe mental illness of the x86/svr4 SDB, we - do something sensible here and we use the following DWARF - register numbers. Note that these are all stack-top-relative - numbers. - 11 for %st(0) (gnu regno = 8) - 12 for %st(1) (gnu regno = 9) - 13 for %st(2) (gnu regno = 10) - 14 for %st(3) (gnu regno = 11) - 15 for %st(4) (gnu regno = 12) - 16 for %st(5) (gnu regno = 13) - 17 for %st(6) (gnu regno = 14) - 18 for %st(7) (gnu regno = 15) -*/ -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ - : (-1)) - -/* Tell final.c that we don't need a label passed to mcount. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - fprintf (FILE, "\tcall *.mcount@GOT(%%ebx)\n"); \ - else \ - fprintf (FILE, "\tcall .mcount\n"); \ -} - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_UNSIGNED -#define WCHAR_UNSIGNED 0 - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" - -/* This defines which switch letters take arguments. On FreeBSD, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker) (comming from svr4). - We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'h' \ - || (CHAR) == 'z' \ - || (CHAR) == 'R') - -/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add - the magical crtbegin.o file (see crtstuff.c) which provides part - of the support for getting C++ file-scope static object constructed - before entering `main'. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ - %{!p:%{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on - the magical crtend.o file (see crtstuff.c) which provides part of - the support for getting C++ file-scope static object constructed - before entering `main', followed by a normal "finalizer" file, - `crtn.o'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" - -/* Provide a LIB_SPEC appropriate for FreeBSD. Just select the appropriate - libc, depending on whether we're doing profiling or need threads support. - (simular to the default, except no -lg, and no -p. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{!shared: \ - %{!pg:%{!pthread:%{!kthread:-lc} \ - %{kthread:-lpthread -lc}} \ - %{pthread:-lc_r}} \ - %{pg:%{!pthread:%{!kthread:-lc_p} \ - %{kthread:-lpthread_p -lc_p}} \ - %{pthread:-lc_r_p}}}" - -/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support - for the special GCC options -static and -shared, which allow us to - link things in one of these three modes by applying the appropriate - combinations of options at link-time. We like to support here for - as many of the other GNU linker options as possible. But I don't - have the time to search for those flags. I am sure how to add - support for -soname shared_object_name. H.J. - - I took out %{v:%{!V:-V}}. It is too much :-(. They can use - -Wl,-V. - - When the -shared link option is used a final link is not being - done. */ - -#undef LINK_SPEC -#define LINK_SPEC "-m elf_i386 \ - %{Wl,*:%*} \ - %{v:-V} \ - %{assert*} %{R*} %{rpath*} %{defsym*} \ - %{shared:-Bshareable %{h*} %{soname*}} \ - %{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \ - %{static:-Bstatic}} \ - %{symbolic:-Bsymbolic}" - -/* A C statement to output to the stdio stream FILE an assembler - command to advance the location counter to a multiple of 1< - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); - -/* The svr4 ABI for the i386 says that records and unions are returned - in memory. */ -/* On FreeBSD, we do not. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using - libraries compiled with the native cc, so undef it. */ -#undef NO_DOLLAR_IN_LABEL - -/* Use more efficient ``thunks'' to implement C++ vtables. */ -#undef DEFAULT_VTABLE_THUNKS -#define DEFAULT_VTABLE_THUNKS 2 - -/* Override the default comment-starter of "/". */ -#undef ASM_COMMENT_START -#define ASM_COMMENT_START "#" - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -#undef SET_ASM_OP -#define SET_ASM_OP ".set" - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ -#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) - -/* Use stabs instead of DWARF debug format. */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* Copy this from the svr4 specifications... */ -/* Define the register numbers to be used in Dwarf debugging information. - The SVR4 reference port C compiler uses the following register numbers - in its Dwarf output code: - 0 for %eax (gnu regno = 0) - 1 for %ecx (gnu regno = 2) - 2 for %edx (gnu regno = 1) - 3 for %ebx (gnu regno = 3) - 4 for %esp (gnu regno = 7) - 5 for %ebp (gnu regno = 6) - 6 for %esi (gnu regno = 4) - 7 for %edi (gnu regno = 5) - The following three DWARF register numbers are never generated by - the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4 - believes these numbers have these meanings. - 8 for %eip (no gnu equivalent) - 9 for %eflags (no gnu equivalent) - 10 for %trapno (no gnu equivalent) - It is not at all clear how we should number the FP stack registers - for the x86 architecture. If the version of SDB on x86/svr4 were - a bit less brain dead with respect to floating-point then we would - have a precedent to follow with respect to DWARF register numbers - for x86 FP registers, but the SDB on x86/svr4 is so completely - broken with respect to FP registers that it is hardly worth thinking - of it as something to strive for compatibility with. - The version of x86/svr4 SDB I have at the moment does (partially) - seem to believe that DWARF register number 11 is associated with - the x86 register %st(0), but that's about all. Higher DWARF - register numbers don't seem to be associated with anything in - particular, and even for DWARF regno 11, SDB only seems to under- - stand that it should say that a variable lives in %st(0) (when - asked via an `=' command) if we said it was in DWARF regno 11, - but SDB still prints garbage when asked for the value of the - variable in question (via a `/' command). - (Also note that the labels SDB prints for various FP stack regs - when doing an `x' command are all wrong.) - Note that these problems generally don't affect the native SVR4 - C compiler because it doesn't allow the use of -O with -g and - because when it is *not* optimizing, it allocates a memory - location for each floating-point variable, and the memory - location is what gets described in the DWARF AT_location - attribute for the variable in question. - Regardless of the severe mental illness of the x86/svr4 SDB, we - do something sensible here and we use the following DWARF - register numbers. Note that these are all stack-top-relative - numbers. - 11 for %st(0) (gnu regno = 8) - 12 for %st(1) (gnu regno = 9) - 13 for %st(2) (gnu regno = 10) - 14 for %st(3) (gnu regno = 11) - 15 for %st(4) (gnu regno = 12) - 16 for %st(5) (gnu regno = 13) - 17 for %st(6) (gnu regno = 14) - 18 for %st(7) (gnu regno = 15) -*/ -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ - : (-1)) - -/* Tell final.c that we don't need a label passed to mcount. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - fprintf (FILE, "\tcall *.mcount@GOT(%%ebx)\n"); \ - else \ - fprintf (FILE, "\tcall .mcount\n"); \ -} - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_UNSIGNED -#define WCHAR_UNSIGNED 0 - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" - -/* This defines which switch letters take arguments. On FreeBSD, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker) (comming from svr4). - We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'h' \ - || (CHAR) == 'z' \ - || (CHAR) == 'R') - -/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add - the magical crtbegin.o file (see crtstuff.c) which provides part - of the support for getting C++ file-scope static object constructed - before entering `main'. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ - %{!p:%{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on - the magical crtend.o file (see crtstuff.c) which provides part of - the support for getting C++ file-scope static object constructed - before entering `main', followed by a normal "finalizer" file, - `crtn.o'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" - -/* Provide a LIB_SPEC appropriate for FreeBSD. Just select the appropriate - libc, depending on whether we're doing profiling or need threads support. - (simular to the default, except no -lg, and no -p. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{!shared: \ - %{!pg:%{!pthread:%{!kthread:-lc} \ - %{kthread:-lpthread -lc}} \ - %{pthread:-lc_r}} \ - %{pg:%{!pthread:%{!kthread:-lc_p} \ - %{kthread:-lpthread_p -lc_p}} \ - %{pthread:-lc_r_p}}}" - -/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support - for the special GCC options -static and -shared, which allow us to - link things in one of these three modes by applying the appropriate - combinations of options at link-time. We like to support here for - as many of the other GNU linker options as possible. But I don't - have the time to search for those flags. I am sure how to add - support for -soname shared_object_name. H.J. - - I took out %{v:%{!V:-V}}. It is too much :-(. They can use - -Wl,-V. - - When the -shared link option is used a final link is not being - done. */ - -#undef LINK_SPEC -#define LINK_SPEC "-m elf_i386 \ - %{Wl,*:%*} \ - %{v:-V} \ - %{assert*} %{R*} %{rpath*} %{defsym*} \ - %{shared:-Bshareable %{h*} %{soname*}} \ - %{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \ - %{static:-Bstatic}} \ - %{symbolic:-Bsymbolic}" - -/* A C statement to output to the stdio stream FILE an assembler - command to advance the location counter to a multiple of 1<, - * 14/8/96 based on the original gmon.c in GCC and the hacked version - * solaris 2 sparc version (config/sparc/gmon-sol.c) by Mark Eichin. To do - * process profiling on solaris 2.X X86 - * - * It must be used in conjunction with sol2-gc1.asm, which is used to start - * and stop process monitoring. - * - * Differences. - * - * On Solaris 2 _mcount is called by library functions not mcount, so support - * has been added for both. - * - * Also the prototype for profil() is different - * - * Solaris 2 does not seem to have char *minbrk whcih allows the setting of - * the minimum SBRK region so this code has been removed and lets pray malloc - * does not mess it up. - * - * Notes - * - * This code could easily be integrated with the original gmon.c and perhaps - * should be. - */ - -#ifndef lint -static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91"; -#endif /* not lint */ - -#if 0 -#include - -#endif -#ifdef DEBUG -#include -#endif - -#if 0 -#include "i386/gmon.h" -#else - -struct phdr { - char *lpc; - char *hpc; - int ncnt; -}; - - -#define HISTFRACTION 2 -#define HISTCOUNTER unsigned short -#define HASHFRACTION 1 -#define ARCDENSITY 2 -#define MINARCS 50 -#define BASEADDRESS 0x8000000 /* On Solaris 2 X86 all executables start here - and not at 0 */ - -struct tostruct { - char *selfpc; - long count; - unsigned short link; -}; -struct rawarc { - unsigned long raw_frompc; - unsigned long raw_selfpc; - long raw_count; -}; -#define ROUNDDOWN(x,y) (((x)/(y))*(y)) -#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) -#endif - -/* char *minbrk; */ - -#ifdef __alpha -extern char *sbrk (); -#endif - - /* - * froms is actually a bunch of unsigned shorts indexing tos - */ -static int profiling = 3; -static unsigned short *froms; -static struct tostruct *tos = 0; -static long tolimit = 0; -static char *s_lowpc = 0; -static char *s_highpc = 0; -static unsigned long s_textsize = 0; - -static int ssiz; -static char *sbuf; -static int s_scale; - /* see profil(2) where this is describe (incorrectly) */ -#define SCALE_1_TO_1 0x10000L - -#define MSG "No space for profiling buffer(s)\n" - -extern int errno; - -monstartup(lowpc, highpc) - char *lowpc; - char *highpc; -{ - int monsize; - char *buffer; - register int o; - - /* - * round lowpc and highpc to multiples of the density we're using - * so the rest of the scaling (here and in gprof) stays in ints. - */ - lowpc = (char *) - ROUNDDOWN((unsigned)lowpc, HISTFRACTION*sizeof(HISTCOUNTER)); - s_lowpc = lowpc; - highpc = (char *) - ROUNDUP((unsigned)highpc, HISTFRACTION*sizeof(HISTCOUNTER)); - s_highpc = highpc; - s_textsize = highpc - lowpc; - monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr); - buffer = (char *) sbrk( monsize ); - if ( buffer == (char *) -1 ) { - write( 2 , MSG , sizeof(MSG) ); - return; - } - froms = (unsigned short *) sbrk( s_textsize / HASHFRACTION ); - if ( froms == (unsigned short *) -1 ) { - write( 2 , MSG , sizeof(MSG) ); - froms = 0; - return; - } - tolimit = s_textsize * ARCDENSITY / 100; - if ( tolimit < MINARCS ) { - tolimit = MINARCS; - } else if ( tolimit > 65534 ) { - tolimit = 65534; - } - tos = (struct tostruct *) sbrk( tolimit * sizeof( struct tostruct ) ); - if ( tos == (struct tostruct *) -1 ) { - write( 2 , MSG , sizeof(MSG) ); - froms = 0; - tos = 0; - return; - } -/* minbrk = (char *) sbrk(0);*/ - tos[0].link = 0; - sbuf = buffer; - ssiz = monsize; - ( (struct phdr *) buffer ) -> lpc = lowpc; - ( (struct phdr *) buffer ) -> hpc = highpc; - ( (struct phdr *) buffer ) -> ncnt = ssiz; - monsize -= sizeof(struct phdr); - if ( monsize <= 0 ) - return; - o = highpc - lowpc; - if( monsize < o ) -#ifndef hp300 - s_scale = ( (float) monsize / o ) * SCALE_1_TO_1; -#else /* avoid floating point */ - { - int quot = o / monsize; - - if (quot >= 0x10000) - s_scale = 1; - else if (quot >= 0x100) - s_scale = 0x10000 / quot; - else if (o >= 0x800000) - s_scale = 0x1000000 / (o / (monsize >> 8)); - else - s_scale = 0x1000000 / ((o << 8) / monsize); - } -#endif - else - s_scale = SCALE_1_TO_1; - moncontrol(1); -} - -_mcleanup() -{ - int fd; - int fromindex; - int endfrom; - char *frompc; - int toindex; - struct rawarc rawarc; - - moncontrol(0); - fd = creat( "gmon.out" , 0666 ); - if ( fd < 0 ) { - perror( "mcount: gmon.out" ); - return; - } -# ifdef DEBUG - fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz ); -# endif DEBUG - - write( fd , sbuf , ssiz ); - endfrom = s_textsize / (HASHFRACTION * sizeof(*froms)); - for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) { - if ( froms[fromindex] == 0 ) { - continue; - } - frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms)); - for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) { -# ifdef DEBUG - fprintf( stderr , - "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" , - frompc , tos[toindex].selfpc , tos[toindex].count ); -# endif DEBUG - rawarc.raw_frompc = (unsigned long) frompc; - rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc; - rawarc.raw_count = tos[toindex].count; - write( fd , &rawarc , sizeof rawarc ); - } - } - close( fd ); -} - -/* Solaris 2 libraries use _mcount. */ -asm(".globl _mcount; _mcount: jmp internal_mcount"); -/* This is for compatibility with old versions of gcc which used mcount. */ -asm(".globl mcount; mcount: jmp internal_mcount"); - -internal_mcount() -{ - register char *selfpc; - register unsigned short *frompcindex; - register struct tostruct *top; - register struct tostruct *prevtop; - register long toindex; - static char already_setup; - - /* - * find the return address for mcount, - * and the return address for mcount's caller. - */ - - /* selfpc = pc pushed by mcount call. - This identifies the function that was just entered. */ - selfpc = (void *) __builtin_return_address (0); - /* frompcindex = pc in preceding frame. - This identifies the caller of the function just entered. */ - frompcindex = (void *) __builtin_return_address (1); - - if(!already_setup) { - extern etext(); - already_setup = 1; -/* monstartup(0, etext); */ - monstartup(0x08040000, etext); -#ifdef USE_ONEXIT - on_exit(_mcleanup, 0); -#else - atexit(_mcleanup); -#endif - } - /* - * check that we are profiling - * and that we aren't recursively invoked. - */ - if (profiling) { - goto out; - } - profiling++; - /* - * check that frompcindex is a reasonable pc value. - * for example: signal catchers get called from the stack, - * not from text space. too bad. - */ - frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc); - if ((unsigned long)frompcindex > s_textsize) { - goto done; - } - frompcindex = - &froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))]; - toindex = *frompcindex; - if (toindex == 0) { - /* - * first time traversing this arc - */ - toindex = ++tos[0].link; - if (toindex >= tolimit) { - goto overflow; - } - *frompcindex = toindex; - top = &tos[toindex]; - top->selfpc = selfpc; - top->count = 1; - top->link = 0; - goto done; - } - top = &tos[toindex]; - if (top->selfpc == selfpc) { - /* - * arc at front of chain; usual case. - */ - top->count++; - goto done; - } - /* - * have to go looking down chain for it. - * top points to what we are looking at, - * prevtop points to previous top. - * we know it is not at the head of the chain. - */ - for (; /* goto done */; ) { - if (top->link == 0) { - /* - * top is end of the chain and none of the chain - * had top->selfpc == selfpc. - * so we allocate a new tostruct - * and link it to the head of the chain. - */ - toindex = ++tos[0].link; - if (toindex >= tolimit) { - goto overflow; - } - top = &tos[toindex]; - top->selfpc = selfpc; - top->count = 1; - top->link = *frompcindex; - *frompcindex = toindex; - goto done; - } - /* - * otherwise, check the next arc on the chain. - */ - prevtop = top; - top = &tos[top->link]; - if (top->selfpc == selfpc) { - /* - * there it is. - * increment its count - * move it to the head of the chain. - */ - top->count++; - toindex = prevtop->link; - prevtop->link = top->link; - top->link = *frompcindex; - *frompcindex = toindex; - goto done; - } - - } -done: - profiling--; - /* and fall through */ -out: - return; /* normal return restores saved registers */ - -overflow: - profiling++; /* halt further profiling */ -# define TOLIMIT "mcount: tos overflow\n" - write(2, TOLIMIT, sizeof(TOLIMIT)); - goto out; -} - -/* - * Control profiling - * profiling is what mcount checks to see if - * all the data structures are ready. - */ -moncontrol(mode) - int mode; -{ - if (mode) - { - /* start */ - profil((unsigned short *)(sbuf + sizeof(struct phdr)), - ssiz - sizeof(struct phdr), - (int)s_lowpc, s_scale); - - profiling = 0; - } else { - /* stop */ - profil((unsigned short *)0, 0, 0, 0); - profiling = 3; - } -} diff --git a/contrib/gcc/config/i386/gnu.h b/contrib/gcc/config/i386/gnu.h deleted file mode 100644 index cd32b928f668..000000000000 --- a/contrib/gcc/config/i386/gnu.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Configuration for an i386 running GNU with ELF as the target machine. */ - -/* This does it mostly for us. */ -#include - -/* Get machine-independent configuration parameters for the GNU system. */ -#include - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 GNU)"); - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__ELF__ -D__i386__ -DMACH -Asystem(mach) \ - -Dunix -Asystem(unix) -Asystem(posix) -D__GNU__ -Asystem(gnu)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) \ - %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \ - %{posix:-D_POSIX_SOURCE} %{bsd:-D_BSD_SOURCE}" - -#undef CC1_SPEC -#define CC1_SPEC "%(cc1_cpu)" - -#undef LINK_SPEC -#define LINK_SPEC "-m elf_i386 %{shared:-shared} \ - %{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/ld.so}} \ - %{static:-static}}" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{!static: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \ - %{static:crt0.o%s}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" diff --git a/contrib/gcc/config/i386/go32.h b/contrib/gcc/config/i386/go32.h deleted file mode 100644 index dd03cc8a75d1..000000000000 --- a/contrib/gcc/config/i386/go32.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Configuration for an i386 running MS-DOS with djgpp/go32. */ - -#include "dbxcoff.h" - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#define HANDLE_SYSV_PRAGMA - -#define YES_UNDERSCORES - -#include "i386/gas.h" - -#ifdef CPP_PREDEFINES -#undef CPP_PREDEFINES -#endif -#define CPP_PREDEFINES "-Dunix -Di386 -DGO32 -DMSDOS \ - -Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386)" - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_ctor, in_dtor - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CTOR_SECTION_FUNCTION \ - DTOR_SECTION_FUNCTION - -#define CTOR_SECTION_FUNCTION \ -void \ -ctor_section () \ -{ \ - if (in_section != in_ctor) \ - { \ - fprintf (asm_out_file, "\t.section .ctor\n"); \ - in_section = in_ctor; \ - } \ -} - -#define DTOR_SECTION_FUNCTION \ -void \ -dtor_section () \ -{ \ - if (in_section != in_dtor) \ - { \ - fprintf (asm_out_file, "\t.section .dtor\n"); \ - in_section = in_dtor; \ - } \ -} - -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* Allow (eg) __attribute__((section "locked")) to work */ -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\ - do { \ - fprintf (FILE, "\t.section %s\n", NAME); \ - } while (0) - -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ -/* Use the main_input_filename instead of dump_base_name */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - output_file_directive (FILE, main_input_filename); \ - } while (0) - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG) - -/* djgpp has atexit (). */ -#undef HAVE_ATEXIT -#define HAVE_ATEXIT - -/* djgpp automatically calls its own version of __main, so don't define one - in libgcc, nor call one in main(). */ -#define HAS_INIT_SECTION diff --git a/contrib/gcc/config/i386/gstabs.h b/contrib/gcc/config/i386/gstabs.h deleted file mode 100644 index 5f0ae348f158..000000000000 --- a/contrib/gcc/config/i386/gstabs.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "i386/gas.h" - -/* We do not want to output SDB debugging information. */ - -#undef SDB_DEBUGGING_INFO - -/* We want to output DBX debugging information. */ - -#define DBX_DEBUGGING_INFO diff --git a/contrib/gcc/config/i386/i386-aout.h b/contrib/gcc/config/i386/i386-aout.h deleted file mode 100644 index e4be8d5dd157..000000000000 --- a/contrib/gcc/config/i386/i386-aout.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Definitions for "naked" Intel 386 using a.out (or coff encap'd - a.out) object format and stabs debugging info. - - Copyright (C) 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* This is tested by gas.h. */ -#define YES_UNDERSCORES - -#include "i386/gstabs.h" - -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386" - -/* end of i386-aout.h */ diff --git a/contrib/gcc/config/i386/i386-coff.h b/contrib/gcc/config/i386/i386-coff.h deleted file mode 100644 index 2e00b7a89076..000000000000 --- a/contrib/gcc/config/i386/i386-coff.h +++ /dev/null @@ -1,103 +0,0 @@ -/* Definitions for "naked" Intel 386 using coff object format files - and coff debugging info. - - Copyright (C) 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "i386/gas.h" -#include "dbxcoff.h" - -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386" - -/* We want to be able to get DBX debugging information via -gstabs. */ - -#undef DBX_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG - -/* Support the ctors and dtors sections for g++. */ - -#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\"" -#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\"" - -/* A list of other sections which the compiler might be "in" at any - given time. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_ctors, in_dtors - -/* A list of extra section function definitions. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION - -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -#define INT_ASM_OP ".long" - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - - -/* end of i386-coff.h */ diff --git a/contrib/gcc/config/i386/i386-interix.h b/contrib/gcc/config/i386/i386-interix.h deleted file mode 100644 index 8e9f44393ccf..000000000000 --- a/contrib/gcc/config/i386/i386-interix.h +++ /dev/null @@ -1,575 +0,0 @@ -/* Target definitions for GNU compiler for Intel 80386 running Interix - Parts Copyright (C) 1991, 1999 Free Software Foundation, Inc. - - Parts: - by Douglas B. Rupp (drupp@cs.washington.edu). - by Ron Guilmette (rfg@netcom.com). - by Donn Terry (donn@softway.com). - by Mumit Khan (khan@xraylith.wisc.edu). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define YES_UNDERSCORES - -/* YES_UNDERSCORES must preceed gas.h */ -#include -/* The rest must follow. */ - -#define DBX_DEBUGGING_INFO -#define SDB_DEBUGGING_INFO -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#define HANDLE_SYSV_PRAGMA -#undef HANDLE_PRAGMA_WEAK /* until the link format can handle it */ - -/* By default, target has a 80387, uses IEEE compatible arithmetic, - and returns float values in the 387 and needs stack probes - We also align doubles to 64-bits for MSVC default compatability */ -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ - (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE | \ - MASK_ALIGN_DOUBLE) - -#undef TARGET_CPU_DEFAULT -#define TARGET_CPU_DEFAULT 2 /* 486 */ - -#define WCHAR_UNSIGNED 1 -#define WCHAR_TYPE_SIZE 16 -#define WCHAR_TYPE "short unsigned int" - -/* WinNT (and thus Interix) use unsigned int */ -#define SIZE_TYPE "unsigned int" - -#define ASM_LOAD_ADDR(loc, reg) " leal " #loc "," #reg "\n" - -/* For the sake of libgcc2.c, indicate target supports atexit. */ -#define HAVE_ATEXIT - -/* cpp handles __STDC__ */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES " \ - -D__INTERIX \ - -D__OPENNT \ - -D_M_IX86=300 -D_X86_=1 \ - -D__stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - -Asystem(unix) -Asystem(interix) -Asystem(interix) -Acpu(i386) -Amachine(i386)" - -#undef CPP_SPEC -/* Write out the correct language type definition for the header files. - Unless we have assembler language, write out the symbols for C. - cpp_cpu is an Intel specific variant. See i386.h - mieee is an Alpha specific variant. Cross polination a bad idea. - */ -#define CPP_SPEC "\ -%{!.S: -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}} \ -%{.S: -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ -%{.cc: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ -%{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ -%{.C: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ -%{.m: -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C} \ --remap \ -%(cpp_cpu) \ -%{posix:-D_POSIX_SOURCE} \ --idirafter %$INTERIX_ROOT/usr/include" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 Interix)"); - -/* The global __fltused is necessary to cause the printf/scanf routines - for outputting/inputting floating point numbers to be loaded. Since this - is kind of hard to detect, we just do it all the time. */ - -#ifdef ASM_FILE_START -#undef ASM_FILE_START -#endif -#define ASM_FILE_START(FILE) \ - do { fprintf (FILE, "\t.file\t"); \ - output_quoted_string (FILE, dump_base_name); \ - fprintf (FILE, "\n"); \ - fprintf (FILE, ".global\t__fltused\n"); \ - } while (0) - -/* A table of bytes codes used by the ASM_OUTPUT_ASCII and - ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table - corresponds to a particular byte value [0..255]. For any - given byte value, if the value in the corresponding table - position is zero, the given character can be output directly. - If the table value is 1, the byte must be output as a \ooo - octal escape. If the tables value is anything else, then the - byte value should be output as a \ followed by the value - in the table. Note that we can use standard UN*X escape - sequences for many control characters, but we don't use - \a to represent BEL because some svr4 assemblers (e.g. on - the i386) don't know about that. Also, we don't use \v - since some versions of gas, such as 2.2 did not accept it. */ - -#define ESCAPES \ -"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" - -/* Some svr4 assemblers have a limit on the number of characters which - can appear in the operand of a .string directive. If your assembler - has such a limitation, you should define STRING_LIMIT to reflect that - limit. Note that at least some svr4 assemblers have a limit on the - actual number of bytes in the double-quoted string, and that they - count each character in an escape sequence as one byte. Thus, an - escape sequence like \377 would count as four bytes. - - If your target assembler doesn't support the .string directive, you - should define this to zero. -*/ - -#define STRING_LIMIT ((unsigned) 256) - -#define STRING_ASM_OP ".string" - -/* The routine used to output NUL terminated strings. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable, especially for targets like the i386 - (where the only alternative is to output character sequences as - comma separated lists of numbers). */ - -#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ - do \ - { \ - register unsigned char *_limited_str = (unsigned char *) (STR); \ - register unsigned ch; \ - fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ - for (; (ch = *_limited_str); _limited_str++) \ - { \ - register int escape = ESCAPES[ch]; \ - switch (escape) \ - { \ - case 0: \ - putc (ch, (FILE)); \ - break; \ - case 1: \ - fprintf ((FILE), "\\%03o", ch); \ - break; \ - default: \ - putc ('\\', (FILE)); \ - putc (escape, (FILE)); \ - break; \ - } \ - } \ - fprintf ((FILE), "\"\n"); \ - } \ - while (0) - -/* The routine used to output sequences of byte values. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable. Note that if we find subparts of the - character sequence which end with NUL (and which are shorter than - STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ - -#undef ASM_OUTPUT_ASCII -#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ - do \ - { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ - register unsigned bytes_in_chunk = 0; \ - for (; _ascii_bytes < limit; _ascii_bytes++) \ - { \ - register unsigned char *p; \ - if (bytes_in_chunk >= 64) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ - continue; \ - if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ - { \ - if (bytes_in_chunk > 0) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ - _ascii_bytes = p; \ - } \ - else \ - { \ - if (bytes_in_chunk == 0) \ - fprintf ((FILE), "\t.byte\t"); \ - else \ - fputc (',', (FILE)); \ - fprintf ((FILE), "0x%02x", *_ascii_bytes); \ - bytes_in_chunk += 5; \ - } \ - } \ - if (bytes_in_chunk > 0) \ - fprintf ((FILE), "\n"); \ - } \ - while (0) - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. - PE format differs on what PC-relative offsets look like (see - coff_i386_rtype_to_howto), and we need to compensate (by one word) here. */ - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long __GLOBAL_OFFSET_TABLE_+[.-%s%d+4]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ - -#define JUMP_TABLES_IN_TEXT_SECTION 1 - -/* Emit code to check the stack when allocating more that 4000 - bytes in one go. */ - -#define CHECK_STACK_LIMIT 0x1000 - -/* the following are OSF linker (not gld) specific... we don't want them */ -#undef HAS_INIT_SECTION -#undef LD_INIT_SWITCH -#undef LD_FINI_SWITCH - - -/* The following are needed for C++, but also needed for profiling */ - -/* Support const sections and the ctors and dtors sections for g++. - Note that there appears to be two different ways to support const - sections at the moment. You can either #define the symbol - READONLY_DATA_SECTION (giving it some code which switches to the - readonly data section) or else you can #define the symbols - EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and - SELECT_RTX_SECTION. We do both here just to be on the safe side. */ - -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP ".section\t.rdata,\"r\"" - -/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. - - Note that we want to give these sections the SHF_WRITE attribute - because these sections will actually contain data (i.e. tables of - addresses of functions in the current root executable or shared library - file) and, in the case of a shared library, the relocatable addresses - will have to be properly resolved/relocated (and then written into) by - the dynamic linker when it actually attaches the given shared library - to the executing process. (Note that on SVR4, you may wish to use the - `-z text' option to the ELF linker, when building a shared library, as - an additional check that you are doing everything right. But if you do - use the `-z text' option when building a shared library, you will get - errors unless the .ctors and .dtors sections are marked as writable - via the SHF_WRITE attribute.) */ - -#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\"" -#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\"" - -/* A default list of other sections which we might be "in" at any given - time. For targets that use additional sections (e.g. .tdesc) you - should override this definition in the target-specific file which - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_ctors, in_dtors - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION - -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION() const_section () - -extern void text_section (); - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -#if 0 -/* Currently gas chokes on this; that's not too hard to fix, but there's - not a lot of impeteus to do it, either. If it is done, gas will have - to handle long section name escapes (which are defined in the COFF/PE - document as /nnn where nnn is a string table index). The benefit: - section attributes and -ffunction-sections, neither of which seem to - be critical. */ -/* gas may have been fixed? bfd was. */ - -/* Switch into a generic section. - This is currently only used to support section attributes. - - We make the section read-only and executable for a function decl, - read-only for a const data decl, and writable for a non-const data decl. */ -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \ - fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \ - (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \ - (DECL) && TREE_READONLY (DECL) ? "a" : "aw") -#endif - -#define INT_ASM_OP ".long" - -/* The MS compilers take alignment as a number of bytes, so we do as well */ -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG)) - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* The linker will take care of this, and having them causes problems with - ld -r (specifically -rU). */ -#define CTOR_LISTS_DEFINED_EXTERNALLY 1 - -#define SET_ASM_OP ".set" -/* Output a definition (implements alias) */ -#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ -do \ -{ \ - fprintf ((FILE), "\t%s\t", SET_ASM_OP); \ - assemble_name (FILE, LABEL1); \ - fprintf (FILE, ","); \ - assemble_name (FILE, LABEL2); \ - fprintf (FILE, "\n"); \ - } \ -while (0) - -#define HOST_PTR_PRINTF "%p" -#define HOST_PTR_AS_INT unsigned long - -#define PCC_BITFIELD_TYPE_MATTERS 1 -#define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec) -#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec) - -/* The following two flags are usually "off" for i386, because some non-gnu - tools (for the i386) don't handle them. However, we don't have that - problem, so.... */ - -/* Forward references to tags are allowed. */ -#define SDB_ALLOW_FORWARD_REFERENCES - -/* Unknown tags are also allowed. */ -#define SDB_ALLOW_UNKNOWN_REFERENCES - -/* The integer half of this list needs to be constant. However, there's - a lot of disagreement about what the floating point adjustments should - be. We pick one that works with gdb. (The underlying problem is - what to do about the segment registers. Since we have access to them - from /proc, we'll allow them to be accessed in gdb, even tho the - gcc compiler can't generate them. (There's some evidence that - MSVC does, but possibly only for certain special "canned" sequences.) */ - -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+8 \ - : (-1)) - -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - Apply stddef, handle (as yet unimplemented) pic. - - stddef renaming does NOT apply to Alpha. */ - -char *gen_stdcall_suffix (); - -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) \ -do \ - { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ - if (lookup_attribute ("stdcall", \ - TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \ - XEXP (DECL_RTL (DECL), 0) = \ - gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \ - } \ -while (0) - -/* This macro gets just the user-specified name - out of the string in a SYMBOL_REF. Discard - trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ -#undef STRIP_NAME_ENCODING -#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ -do { \ - char *_p; \ - char *_name = SYMBOL_NAME; \ - for (_p = _name; *_p && *_p != '@'; ++_p) \ - ; \ - if (*_p == '@') \ - { \ - int _len = _p - _name; \ - (VAR) = (char *) alloca (_len + 1); \ - strncpy ((VAR), _name, _len); \ - (VAR)[_len] = '\0'; \ - } \ - else \ - (VAR) = _name; \ -} while (0) - -#if 0 -/* Turn this back on when the linker is updated to handle grouped - .data$ sections correctly. See corresponding note in i386/interix.c. - MK. */ - -/* Define this macro if in some cases global symbols from one translation - unit may not be bound to undefined symbols in another translation unit - without user intervention. For instance, under Microsoft Windows - symbols must be explicitly imported from shared libraries (DLLs). */ -#define MULTIPLE_SYMBOL_SPACES - -#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL) -extern void i386_pe_unique_section (); -#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC) - -#define SUPPORTS_ONE_ONLY 1 - -/* A C statement to output something to the assembler file to switch to section - NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or - NULL_TREE. Some target formats do not support arbitrary sections. Do not - define this macro in such cases. */ -#undef ASM_OUTPUT_SECTION_NAME -#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \ -do { \ - static struct section_info \ - { \ - struct section_info *next; \ - char *name; \ - enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ - } *sections; \ - struct section_info *s; \ - char *mode; \ - enum sect_enum type; \ - \ - for (s = sections; s; s = s->next) \ - if (!strcmp (NAME, s->name)) \ - break; \ - \ - if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ - type = SECT_EXEC, mode = "x"; \ - else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ - type = SECT_RO, mode = "r"; \ - else \ - type = SECT_RW, mode = "w"; \ - \ - if (s == 0) \ - { \ - s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ - s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ - strcpy (s->name, NAME); \ - s->type = type; \ - s->next = sections; \ - sections = s; \ - fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \ - /* Functions may have been compiled at various levels of \ - optimization so we can't use `same_size' here. Instead, \ - have the linker pick one. */ \ - if ((DECL) && DECL_ONE_ONLY (DECL)) \ - fprintf (STREAM, "\t.linkonce %s\n", \ - TREE_CODE (DECL) == FUNCTION_DECL \ - ? "discard" : "same_size"); \ - } \ - else \ - { \ - fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \ - } \ -} while (0) - -#endif /* 0 */ - -/* DWARF2 Unwinding doesn't work with exception handling yet. */ -#define DWARF2_UNWIND_INFO 0 - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - diff --git a/contrib/gcc/config/i386/i386.c b/contrib/gcc/config/i386/i386.c deleted file mode 100644 index 0333b194c0fd..000000000000 --- a/contrib/gcc/config/i386/i386.c +++ /dev/null @@ -1,5741 +0,0 @@ -/* Subroutines for insn-output.c for Intel X86. - Copyright (C) 1988, 92, 94-98, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "regs.h" -#include "hard-reg-set.h" -#include "real.h" -#include "insn-config.h" -#include "conditions.h" -#include "insn-flags.h" -#include "output.h" -#include "insn-attr.h" -#include "tree.h" -#include "flags.h" -#include "except.h" -#include "function.h" -#include "recog.h" -#include "expr.h" -#include "toplev.h" - -#ifdef EXTRA_CONSTRAINT -/* If EXTRA_CONSTRAINT is defined, then the 'S' - constraint in REG_CLASS_FROM_LETTER will no longer work, and various - asm statements that need 'S' for class SIREG will break. */ - error EXTRA_CONSTRAINT conflicts with S constraint letter -/* The previous line used to be #error, but some compilers barf - even if the conditional was untrue. */ -#endif - -#ifndef CHECK_STACK_LIMIT -#define CHECK_STACK_LIMIT -1 -#endif - -/* Type of an operand for ix86_{binary,unary}_operator_ok */ -enum reg_mem -{ - reg_p, - mem_p, - imm_p -}; - -/* Processor costs (relative to an add) */ -struct processor_costs i386_cost = { /* 386 specific costs */ - 1, /* cost of an add instruction */ - 1, /* cost of a lea instruction */ - 3, /* variable shift costs */ - 2, /* constant shift costs */ - 6, /* cost of starting a multiply */ - 1, /* cost of multiply per each bit set */ - 23 /* cost of a divide/mod */ -}; - -struct processor_costs i486_cost = { /* 486 specific costs */ - 1, /* cost of an add instruction */ - 1, /* cost of a lea instruction */ - 3, /* variable shift costs */ - 2, /* constant shift costs */ - 12, /* cost of starting a multiply */ - 1, /* cost of multiply per each bit set */ - 40 /* cost of a divide/mod */ -}; - -struct processor_costs pentium_cost = { - 1, /* cost of an add instruction */ - 1, /* cost of a lea instruction */ - 4, /* variable shift costs */ - 1, /* constant shift costs */ - 11, /* cost of starting a multiply */ - 0, /* cost of multiply per each bit set */ - 25 /* cost of a divide/mod */ -}; - -struct processor_costs pentiumpro_cost = { - 1, /* cost of an add instruction */ - 1, /* cost of a lea instruction */ - 3, /* variable shift costs */ - 1, /* constant shift costs */ - 4, /* cost of starting a multiply */ - 0, /* cost of multiply per each bit set */ - 17 /* cost of a divide/mod */ -}; - -/* We use decoding time together with execution time. - To get correct vale add 1 for short decodable, 2 for long decodable - and 4 for vector decodable instruction to execution time and divide - by two (because CPU is able to do two insns at a time). */ - -struct processor_costs k6_cost = { - 1, /* cost of an add instruction */ - 1, /* cost of a lea instruction */ - 1, /* variable shift costs */ - 1, /* constant shift costs */ - 3, /* cost of starting a multiply */ - 0, /* cost of multiply per each bit set */ - 20 /* cost of a divide/mod */ -}; - -struct processor_costs *ix86_cost = &pentium_cost; - -/* Processor feature/optimization bitmasks. */ -#define m_386 (1< */ -char *ix86_arch_string; /* for -march= */ - -/* Register allocation order */ -char *i386_reg_alloc_order; -static char regs_allocated[FIRST_PSEUDO_REGISTER]; - -/* # of registers to use to pass arguments. */ -char *i386_regparm_string; - -/* i386_regparm_string as a number */ -int i386_regparm; - -/* Alignment to use for loops and jumps: */ - -/* Power of two alignment for loops. */ -char *i386_align_loops_string; - -/* Power of two alignment for non-loop jumps. */ -char *i386_align_jumps_string; - -/* Power of two alignment for stack boundary in bytes. */ -char *i386_preferred_stack_boundary_string; - -/* Preferred alignment for stack boundary in bits. */ -int i386_preferred_stack_boundary; - -/* Values 1-5: see jump.c */ -int i386_branch_cost; -char *i386_branch_cost_string; - -/* Power of two alignment for functions. */ -int i386_align_funcs; -char *i386_align_funcs_string; - -/* Power of two alignment for loops. */ -int i386_align_loops; - -/* Power of two alignment for non-loop jumps. */ -int i386_align_jumps; - -/* Sometimes certain combinations of command options do not make - sense on a particular target machine. You can define a macro - `OVERRIDE_OPTIONS' to take account of this. This macro, if - defined, is executed once just after all the command options have - been parsed. - - Don't use this macro to turn on various extra optimizations for - `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ - -void -override_options () -{ - int ch, i, j; - int def_align; - - static struct ptt - { - char *name; /* Canonical processor name. */ - enum processor_type processor; /* Processor type enum value. */ - struct processor_costs *cost; /* Processor costs */ - int target_enable; /* Target flags to enable. */ - int target_disable; /* Target flags to disable. */ - } processor_target_table[] = { - {PROCESSOR_I386_STRING, PROCESSOR_I386, &i386_cost, 0, 0}, - {PROCESSOR_I486_STRING, PROCESSOR_I486, &i486_cost, 0, 0}, - {PROCESSOR_I586_STRING, PROCESSOR_PENTIUM, &pentium_cost, 0, 0}, - {PROCESSOR_PENTIUM_STRING, PROCESSOR_PENTIUM, &pentium_cost, 0, 0}, - {PROCESSOR_I686_STRING, PROCESSOR_PENTIUMPRO, &pentiumpro_cost, 0, 0}, - {PROCESSOR_PENTIUMPRO_STRING, PROCESSOR_PENTIUMPRO, - &pentiumpro_cost, 0, 0}, - {PROCESSOR_K6_STRING, PROCESSOR_K6, &k6_cost, 0, 0} - }; - - int ptt_size = sizeof (processor_target_table) / sizeof (struct ptt); - -#ifdef SUBTARGET_OVERRIDE_OPTIONS - SUBTARGET_OVERRIDE_OPTIONS; -#endif - - /* Validate registers in register allocation order. */ - if (i386_reg_alloc_order) - { - for (i = 0; (ch = i386_reg_alloc_order[i]) != '\0'; i++) - { - int regno = 0; - - switch (ch) - { - case 'a': regno = 0; break; - case 'd': regno = 1; break; - case 'c': regno = 2; break; - case 'b': regno = 3; break; - case 'S': regno = 4; break; - case 'D': regno = 5; break; - case 'B': regno = 6; break; - - default: fatal ("Register '%c' is unknown", ch); - } - - if (regs_allocated[regno]) - fatal ("Register '%c' already specified in allocation order", ch); - - regs_allocated[regno] = 1; - } - } - - if (ix86_arch_string == 0) - { - ix86_arch_string = PROCESSOR_PENTIUM_STRING; - if (ix86_cpu_string == 0) - ix86_cpu_string = PROCESSOR_DEFAULT_STRING; - } - - for (i = 0; i < ptt_size; i++) - if (! strcmp (ix86_arch_string, processor_target_table[i].name)) - { - ix86_arch = processor_target_table[i].processor; - if (ix86_cpu_string == 0) - ix86_cpu_string = processor_target_table[i].name; - break; - } - - if (i == ptt_size) - { - error ("bad value (%s) for -march= switch", ix86_arch_string); - ix86_arch_string = PROCESSOR_PENTIUM_STRING; - ix86_arch = PROCESSOR_DEFAULT; - } - - if (ix86_cpu_string == 0) - ix86_cpu_string = PROCESSOR_DEFAULT_STRING; - - for (j = 0; j < ptt_size; j++) - if (! strcmp (ix86_cpu_string, processor_target_table[j].name)) - { - ix86_cpu = processor_target_table[j].processor; - ix86_cost = processor_target_table[j].cost; - if (i > j && (int) ix86_arch >= (int) PROCESSOR_K6) - error ("-mcpu=%s does not support -march=%s", - ix86_cpu_string, ix86_arch_string); - - target_flags |= processor_target_table[j].target_enable; - target_flags &= ~processor_target_table[j].target_disable; - break; - } - - if (j == ptt_size) - { - error ("bad value (%s) for -mcpu= switch", ix86_cpu_string); - ix86_cpu_string = PROCESSOR_DEFAULT_STRING; - ix86_cpu = PROCESSOR_DEFAULT; - } - - /* Validate -mregparm= value. */ - if (i386_regparm_string) - { - i386_regparm = atoi (i386_regparm_string); - if (i386_regparm < 0 || i386_regparm > REGPARM_MAX) - fatal ("-mregparm=%d is not between 0 and %d", - i386_regparm, REGPARM_MAX); - } - - /* The 486 suffers more from non-aligned cache line fills, and the - larger code size results in a larger cache foot-print and more misses. - The 486 has a 16 byte cache line, pentium and pentiumpro have a 32 byte - cache line. */ - def_align = (TARGET_486) ? 4 : 2; - - /* Validate -malign-loops= value, or provide default. */ -#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN - i386_align_loops = 4; -#else - i386_align_loops = 2; -#endif - if (i386_align_loops_string) - { - i386_align_loops = atoi (i386_align_loops_string); - if (i386_align_loops < 0 || i386_align_loops > MAX_CODE_ALIGN) - fatal ("-malign-loops=%d is not between 0 and %d", - i386_align_loops, MAX_CODE_ALIGN); - } - - /* Validate -malign-jumps= value, or provide default. */ -#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN - i386_align_jumps = 4; -#else - i386_align_jumps = def_align; -#endif - if (i386_align_jumps_string) - { - i386_align_jumps = atoi (i386_align_jumps_string); - if (i386_align_jumps < 0 || i386_align_jumps > MAX_CODE_ALIGN) - fatal ("-malign-jumps=%d is not between 0 and %d", - i386_align_jumps, MAX_CODE_ALIGN); - } - - /* Validate -malign-functions= value, or provide default. */ - i386_align_funcs = def_align; - if (i386_align_funcs_string) - { - i386_align_funcs = atoi (i386_align_funcs_string); - if (i386_align_funcs < 0 || i386_align_funcs > MAX_CODE_ALIGN) - fatal ("-malign-functions=%d is not between 0 and %d", - i386_align_funcs, MAX_CODE_ALIGN); - } - - /* Validate -mpreferred_stack_boundary= value, or provide default. - The default of 128 bits is for Pentium III's SSE __m128. */ - i386_preferred_stack_boundary = 128; - if (i386_preferred_stack_boundary_string) - { - i = atoi (i386_preferred_stack_boundary_string); - if (i < 2 || i > 31) - fatal ("-mpreferred_stack_boundary=%d is not between 2 and 31", i); - i386_preferred_stack_boundary = (1 << i) * BITS_PER_UNIT; - } - - /* Validate -mbranch-cost= value, or provide default. */ - i386_branch_cost = 1; - if (i386_branch_cost_string) - { - i386_branch_cost = atoi (i386_branch_cost_string); - if (i386_branch_cost < 0 || i386_branch_cost > 5) - fatal ("-mbranch-cost=%d is not between 0 and 5", i386_branch_cost); - } - - /* Keep nonleaf frame pointers. */ - if (TARGET_OMIT_LEAF_FRAME_POINTER) - flag_omit_frame_pointer = 1; -} - -/* A C statement (sans semicolon) to choose the order in which to - allocate hard registers for pseudo-registers local to a basic - block. - - Store the desired register order in the array `reg_alloc_order'. - Element 0 should be the register to allocate first; element 1, the - next register; and so on. - - The macro body should not assume anything about the contents of - `reg_alloc_order' before execution of the macro. - - On most machines, it is not necessary to define this macro. */ - -void -order_regs_for_local_alloc () -{ - int i, ch, order; - - /* User specified the register allocation order. */ - - if (i386_reg_alloc_order) - { - for (i = order = 0; (ch = i386_reg_alloc_order[i]) != '\0'; i++) - { - int regno = 0; - - switch (ch) - { - case 'a': regno = 0; break; - case 'd': regno = 1; break; - case 'c': regno = 2; break; - case 'b': regno = 3; break; - case 'S': regno = 4; break; - case 'D': regno = 5; break; - case 'B': regno = 6; break; - } - - reg_alloc_order[order++] = regno; - } - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - { - if (! regs_allocated[i]) - reg_alloc_order[order++] = i; - } - } - - /* If user did not specify a register allocation order, use natural order. */ - else - { - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - reg_alloc_order[i] = i; - } -} - -void -optimization_options (level, size) - int level; - int size ATTRIBUTE_UNUSED; -{ - /* For -O2 and beyond, turn off -fschedule-insns by default. It tends to - make the problem with not enough registers even worse. */ -#ifdef INSN_SCHEDULING - if (level > 1) - flag_schedule_insns = 0; -#endif -} - -/* Sign-extend a 16-bit constant */ - -struct rtx_def * -i386_sext16_if_const (op) - struct rtx_def *op; -{ - if (GET_CODE (op) == CONST_INT) - { - HOST_WIDE_INT val = INTVAL (op); - HOST_WIDE_INT sext_val; - if (val & 0x8000) - sext_val = val | ~0xffff; - else - sext_val = val & 0xffff; - if (sext_val != val) - op = GEN_INT (sext_val); - } - return op; -} - -/* Return nonzero if the rtx is aligned */ - -static int -i386_aligned_reg_p (regno) - int regno; -{ - return (regno == STACK_POINTER_REGNUM - || (! flag_omit_frame_pointer && regno == FRAME_POINTER_REGNUM)); -} - -int -i386_aligned_p (op) - rtx op; -{ - /* Registers and immediate operands are always "aligned". */ - if (GET_CODE (op) != MEM) - return 1; - - /* Don't even try to do any aligned optimizations with volatiles. */ - if (MEM_VOLATILE_P (op)) - return 0; - - /* Get address of memory operand. */ - op = XEXP (op, 0); - - switch (GET_CODE (op)) - { - case CONST_INT: - if (INTVAL (op) & 3) - break; - return 1; - - /* Match "reg + offset" */ - case PLUS: - if (GET_CODE (XEXP (op, 1)) != CONST_INT) - break; - if (INTVAL (XEXP (op, 1)) & 3) - break; - - op = XEXP (op, 0); - if (GET_CODE (op) != REG) - break; - - /* ... fall through ... */ - - case REG: - return i386_aligned_reg_p (REGNO (op)); - - default: - break; - } - - return 0; -} - -/* Return nonzero if INSN looks like it won't compute useful cc bits - as a side effect. This information is only a hint. */ - -int -i386_cc_probably_useless_p (insn) - rtx insn; -{ - return ! next_cc0_user (insn); -} - -/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific - attribute for DECL. The attributes in ATTRIBUTES have previously been - assigned to DECL. */ - -int -i386_valid_decl_attribute_p (decl, attributes, identifier, args) - tree decl ATTRIBUTE_UNUSED; - tree attributes ATTRIBUTE_UNUSED; - tree identifier ATTRIBUTE_UNUSED; - tree args ATTRIBUTE_UNUSED; -{ - return 0; -} - -/* Return nonzero if IDENTIFIER with arguments ARGS is a valid machine specific - attribute for TYPE. The attributes in ATTRIBUTES have previously been - assigned to TYPE. */ - -int -i386_valid_type_attribute_p (type, attributes, identifier, args) - tree type; - tree attributes ATTRIBUTE_UNUSED; - tree identifier; - tree args; -{ - if (TREE_CODE (type) != FUNCTION_TYPE - && TREE_CODE (type) != METHOD_TYPE - && TREE_CODE (type) != FIELD_DECL - && TREE_CODE (type) != TYPE_DECL) - return 0; - - /* Stdcall attribute says callee is responsible for popping arguments - if they are not variable. */ - if (is_attribute_p ("stdcall", identifier)) - return (args == NULL_TREE); - - /* Cdecl attribute says the callee is a normal C declaration. */ - if (is_attribute_p ("cdecl", identifier)) - return (args == NULL_TREE); - - /* Regparm attribute specifies how many integer arguments are to be - passed in registers. */ - if (is_attribute_p ("regparm", identifier)) - { - tree cst; - - if (! args || TREE_CODE (args) != TREE_LIST - || TREE_CHAIN (args) != NULL_TREE - || TREE_VALUE (args) == NULL_TREE) - return 0; - - cst = TREE_VALUE (args); - if (TREE_CODE (cst) != INTEGER_CST) - return 0; - - if (TREE_INT_CST_HIGH (cst) != 0 - || TREE_INT_CST_LOW (cst) < 0 - || TREE_INT_CST_LOW (cst) > REGPARM_MAX) - return 0; - - return 1; - } - - return 0; -} - -/* Return 0 if the attributes for two types are incompatible, 1 if they - are compatible, and 2 if they are nearly compatible (which causes a - warning to be generated). */ - -int -i386_comp_type_attributes (type1, type2) - tree type1; - tree type2; -{ - /* Check for mismatch of non-default calling convention. */ - char *rtdstr = TARGET_RTD ? "cdecl" : "stdcall"; - - if (TREE_CODE (type1) != FUNCTION_TYPE) - return 1; - - /* Check for mismatched return types (cdecl vs stdcall). */ - if (!lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type1)) - != !lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type2))) - return 0; - return 1; -} - - -/* Value is the number of bytes of arguments automatically - popped when returning from a subroutine call. - FUNDECL is the declaration node of the function (as a tree), - FUNTYPE is the data type of the function (as a tree), - or for a library call it is an identifier node for the subroutine name. - SIZE is the number of bytes of arguments passed on the stack. - - On the 80386, the RTD insn may be used to pop them if the number - of args is fixed, but if the number is variable then the caller - must pop them all. RTD can't be used for library calls now - because the library is compiled with the Unix compiler. - Use of RTD is a selectable option, since it is incompatible with - standard Unix calling sequences. If the option is not selected, - the caller must always pop the args. - - The attribute stdcall is equivalent to RTD on a per module basis. */ - -int -i386_return_pops_args (fundecl, funtype, size) - tree fundecl; - tree funtype; - int size; -{ - int rtd = TARGET_RTD && (!fundecl || TREE_CODE (fundecl) != IDENTIFIER_NODE); - - /* Cdecl functions override -mrtd, and never pop the stack. */ - if (! lookup_attribute ("cdecl", TYPE_ATTRIBUTES (funtype))) { - - /* Stdcall functions will pop the stack if not variable args. */ - if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (funtype))) - rtd = 1; - - if (rtd - && (TYPE_ARG_TYPES (funtype) == NULL_TREE - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (funtype))) - == void_type_node))) - return size; - } - - /* Lose any fake structure return argument. */ - if (aggregate_value_p (TREE_TYPE (funtype))) - return GET_MODE_SIZE (Pmode); - - return 0; -} - - -/* Argument support functions. */ - -/* Initialize a variable CUM of type CUMULATIVE_ARGS - for a call to a function whose data type is FNTYPE. - For a library call, FNTYPE is 0. */ - -void -init_cumulative_args (cum, fntype, libname) - CUMULATIVE_ARGS *cum; /* Argument info to initialize */ - tree fntype; /* tree ptr for function decl */ - rtx libname; /* SYMBOL_REF of library name or 0 */ -{ - static CUMULATIVE_ARGS zero_cum; - tree param, next_param; - - if (TARGET_DEBUG_ARG) - { - fprintf (stderr, "\ninit_cumulative_args ("); - if (fntype) - fprintf (stderr, "fntype code = %s, ret code = %s", - tree_code_name[(int) TREE_CODE (fntype)], - tree_code_name[(int) TREE_CODE (TREE_TYPE (fntype))]); - else - fprintf (stderr, "no fntype"); - - if (libname) - fprintf (stderr, ", libname = %s", XSTR (libname, 0)); - } - - *cum = zero_cum; - - /* Set up the number of registers to use for passing arguments. */ - cum->nregs = i386_regparm; - if (fntype) - { - tree attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (fntype)); - - if (attr) - cum->nregs = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr))); - } - - /* Determine if this function has variable arguments. This is - indicated by the last argument being 'void_type_mode' if there - are no variable arguments. If there are variable arguments, then - we won't pass anything in registers */ - - if (cum->nregs) - { - for (param = (fntype) ? TYPE_ARG_TYPES (fntype) : 0; - param != 0; param = next_param) - { - next_param = TREE_CHAIN (param); - if (next_param == 0 && TREE_VALUE (param) != void_type_node) - cum->nregs = 0; - } - } - - if (TARGET_DEBUG_ARG) - fprintf (stderr, ", nregs=%d )\n", cum->nregs); - - return; -} - -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ - -void -function_arg_advance (cum, mode, type, named) - CUMULATIVE_ARGS *cum; /* current arg information */ - enum machine_mode mode; /* current arg mode */ - tree type; /* type of the argument or 0 if lib support */ - int named; /* whether or not the argument was named */ -{ - int bytes - = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode); - int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; - - if (TARGET_DEBUG_ARG) - fprintf (stderr, - "function_adv (sz=%d, wds=%2d, nregs=%d, mode=%s, named=%d)\n\n", - words, cum->words, cum->nregs, GET_MODE_NAME (mode), named); - - cum->words += words; - cum->nregs -= words; - cum->regno += words; - - if (cum->nregs <= 0) - { - cum->nregs = 0; - cum->regno = 0; - } - - return; -} - -/* Define where to put the arguments to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - MODE is the argument's machine mode. - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). */ - -struct rtx_def * -function_arg (cum, mode, type, named) - CUMULATIVE_ARGS *cum; /* current arg information */ - enum machine_mode mode; /* current arg mode */ - tree type; /* type of the argument or 0 if lib support */ - int named; /* != 0 for normal args, == 0 for ... args */ -{ - rtx ret = NULL_RTX; - int bytes - = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode); - int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; - - switch (mode) - { - /* For now, pass fp/complex values on the stack. */ - default: - break; - - case BLKmode: - case DImode: - case SImode: - case HImode: - case QImode: - if (words <= cum->nregs) - ret = gen_rtx_REG (mode, cum->regno); - break; - } - - if (TARGET_DEBUG_ARG) - { - fprintf (stderr, - "function_arg (size=%d, wds=%2d, nregs=%d, mode=%4s, named=%d", - words, cum->words, cum->nregs, GET_MODE_NAME (mode), named); - - if (ret) - fprintf (stderr, ", reg=%%e%s", reg_names[ REGNO(ret) ]); - else - fprintf (stderr, ", stack"); - - fprintf (stderr, " )\n"); - } - - return ret; -} - -/* For an arg passed partly in registers and partly in memory, - this is the number of registers used. - For args passed entirely in registers or entirely in memory, zero. */ - -int -function_arg_partial_nregs (cum, mode, type, named) - CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED; /* current arg information */ - enum machine_mode mode ATTRIBUTE_UNUSED; /* current arg mode */ - tree type ATTRIBUTE_UNUSED; /* type of the argument or 0 if lib support */ - int named ATTRIBUTE_UNUSED; /* != 0 for normal args, == 0 for ... args */ -{ - return 0; -} - -char * -singlemove_string (operands) - rtx *operands; -{ - rtx x; - if (GET_CODE (operands[0]) == MEM - && GET_CODE (x = XEXP (operands[0], 0)) == PRE_DEC) - { - if (XEXP (x, 0) != stack_pointer_rtx) - abort (); - return "push%L1 %1"; - } - else if (GET_CODE (operands[1]) == CONST_DOUBLE) - return output_move_const_single (operands); - else if (GET_CODE (operands[0]) == REG || GET_CODE (operands[1]) == REG) - return AS2 (mov%L0,%1,%0); - else if (CONSTANT_P (operands[1])) - return AS2 (mov%L0,%1,%0); - else - { - output_asm_insn ("push%L1 %1", operands); - return "pop%L0 %0"; - } -} - -/* Output an insn to add the constant N to the register X. */ - -static void -asm_add (n, x) - int n; - rtx x; -{ - rtx xops[2]; - xops[0] = x; - - if (n == -1) - output_asm_insn (AS1 (dec%L0,%0), xops); - else if (n == 1) - output_asm_insn (AS1 (inc%L0,%0), xops); - else if (n < 0 || n == 128) - { - xops[1] = GEN_INT (-n); - output_asm_insn (AS2 (sub%L0,%1,%0), xops); - } - else if (n > 0) - { - xops[1] = GEN_INT (n); - output_asm_insn (AS2 (add%L0,%1,%0), xops); - } -} - -/* Output assembler code to perform a doubleword move insn - with operands OPERANDS. */ - -char * -output_move_double (operands) - rtx *operands; -{ - enum {REGOP, OFFSOP, MEMOP, PUSHOP, POPOP, CNSTOP, RNDOP } optype0, optype1; - rtx latehalf[2]; - rtx middlehalf[2]; - rtx xops[2]; - int dest_overlapped_low = 0; - int size = GET_MODE_SIZE (GET_MODE (operands[0])); - - middlehalf[0] = 0; - middlehalf[1] = 0; - - /* First classify both operands. */ - - if (REG_P (operands[0])) - optype0 = REGOP; - else if (offsettable_memref_p (operands[0])) - optype0 = OFFSOP; - else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC) - optype0 = POPOP; - else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC) - optype0 = PUSHOP; - else if (GET_CODE (operands[0]) == MEM) - optype0 = MEMOP; - else - optype0 = RNDOP; - - if (REG_P (operands[1])) - optype1 = REGOP; - else if (CONSTANT_P (operands[1])) - optype1 = CNSTOP; - else if (offsettable_memref_p (operands[1])) - optype1 = OFFSOP; - else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC) - optype1 = POPOP; - else if (GET_CODE (XEXP (operands[1], 0)) == PRE_DEC) - optype1 = PUSHOP; - else if (GET_CODE (operands[1]) == MEM) - optype1 = MEMOP; - else - optype1 = RNDOP; - - /* Check for the cases that are not supposed to happen - either due to the operand constraints or the fact - that all memory operands on the x86 are offsettable. - Abort if we get one, because generating code for these - cases is painful. */ - - if (optype0 == RNDOP || optype1 == RNDOP - || optype0 == MEMOP || optype1 == MEMOP) - abort (); - - /* If one operand is decrementing and one is incrementing - decrement the former register explicitly - and change that operand into ordinary indexing. */ - - if (optype0 == PUSHOP && optype1 == POPOP) - { - /* ??? Can this ever happen on i386? */ - operands[0] = XEXP (XEXP (operands[0], 0), 0); - asm_add (-size, operands[0]); - if (GET_MODE (operands[1]) == XFmode) - operands[0] = gen_rtx_MEM (XFmode, operands[0]); - else if (GET_MODE (operands[0]) == DFmode) - operands[0] = gen_rtx_MEM (DFmode, operands[0]); - else - operands[0] = gen_rtx_MEM (DImode, operands[0]); - optype0 = OFFSOP; - } - - if (optype0 == POPOP && optype1 == PUSHOP) - { - /* ??? Can this ever happen on i386? */ - operands[1] = XEXP (XEXP (operands[1], 0), 0); - asm_add (-size, operands[1]); - if (GET_MODE (operands[1]) == XFmode) - operands[1] = gen_rtx_MEM (XFmode, operands[1]); - else if (GET_MODE (operands[1]) == DFmode) - operands[1] = gen_rtx_MEM (DFmode, operands[1]); - else - operands[1] = gen_rtx_MEM (DImode, operands[1]); - optype1 = OFFSOP; - } - - /* Ok, we can do one word at a time. - Normally we do the low-numbered word first, - but if either operand is autodecrementing then we - do the high-numbered word first. - - In either case, set up in LATEHALF the operands to use - for the high-numbered word and in some cases alter the - operands in OPERANDS to be suitable for the low-numbered word. */ - - if (size == 12) - { - if (optype0 == REGOP) - { - middlehalf[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); - latehalf[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 2); - } - else if (optype0 == OFFSOP) - { - middlehalf[0] = adj_offsettable_operand (operands[0], 4); - latehalf[0] = adj_offsettable_operand (operands[0], 8); - } - else - { - middlehalf[0] = operands[0]; - latehalf[0] = operands[0]; - } - - if (optype1 == REGOP) - { - middlehalf[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); - latehalf[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2); - } - else if (optype1 == OFFSOP) - { - middlehalf[1] = adj_offsettable_operand (operands[1], 4); - latehalf[1] = adj_offsettable_operand (operands[1], 8); - } - else if (optype1 == CNSTOP) - { - if (GET_CODE (operands[1]) == CONST_DOUBLE) - { - REAL_VALUE_TYPE r; long l[3]; - - REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]); - REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l); - operands[1] = GEN_INT (l[0]); - middlehalf[1] = GEN_INT (l[1]); - latehalf[1] = GEN_INT (l[2]); - } - else if (CONSTANT_P (operands[1])) - /* No non-CONST_DOUBLE constant should ever appear here. */ - abort (); - } - else - { - middlehalf[1] = operands[1]; - latehalf[1] = operands[1]; - } - } - - else - { - /* Size is not 12. */ - - if (optype0 == REGOP) - latehalf[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1); - else if (optype0 == OFFSOP) - latehalf[0] = adj_offsettable_operand (operands[0], 4); - else - latehalf[0] = operands[0]; - - if (optype1 == REGOP) - latehalf[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1); - else if (optype1 == OFFSOP) - latehalf[1] = adj_offsettable_operand (operands[1], 4); - else if (optype1 == CNSTOP) - split_double (operands[1], &operands[1], &latehalf[1]); - else - latehalf[1] = operands[1]; - } - - /* If insn is effectively movd N (sp),-(sp) then we will do the - high word first. We should use the adjusted operand 1 - (which is N+4 (sp) or N+8 (sp)) - for the low word and middle word as well, - to compensate for the first decrement of sp. */ - if (optype0 == PUSHOP - && REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM - && reg_overlap_mentioned_p (stack_pointer_rtx, operands[1])) - middlehalf[1] = operands[1] = latehalf[1]; - - /* For (set (reg:DI N) (mem:DI ... (reg:SI N) ...)), - if the upper part of reg N does not appear in the MEM, arrange to - emit the move late-half first. Otherwise, compute the MEM address - into the upper part of N and use that as a pointer to the memory - operand. */ - if (optype0 == REGOP && optype1 == OFFSOP) - { - if (reg_mentioned_p (operands[0], XEXP (operands[1], 0)) - && reg_mentioned_p (latehalf[0], XEXP (operands[1], 0))) - { - /* If both halves of dest are used in the src memory address, - compute the address into latehalf of dest. */ - compadr: - xops[0] = latehalf[0]; - xops[1] = XEXP (operands[1], 0); - output_asm_insn (AS2 (lea%L0,%a1,%0), xops); - if (GET_MODE (operands[1]) == XFmode) - { - operands[1] = gen_rtx_MEM (XFmode, latehalf[0]); - middlehalf[1] = adj_offsettable_operand (operands[1], size-8); - latehalf[1] = adj_offsettable_operand (operands[1], size-4); - } - else - { - operands[1] = gen_rtx_MEM (DImode, latehalf[0]); - latehalf[1] = adj_offsettable_operand (operands[1], size-4); - } - } - - else if (size == 12 - && reg_mentioned_p (middlehalf[0], XEXP (operands[1], 0))) - { - /* Check for two regs used by both source and dest. */ - if (reg_mentioned_p (operands[0], XEXP (operands[1], 0)) - || reg_mentioned_p (latehalf[0], XEXP (operands[1], 0))) - goto compadr; - - /* Only the middle reg conflicts; simply put it last. */ - output_asm_insn (singlemove_string (operands), operands); - output_asm_insn (singlemove_string (latehalf), latehalf); - output_asm_insn (singlemove_string (middlehalf), middlehalf); - return ""; - } - - else if (reg_mentioned_p (operands[0], XEXP (operands[1], 0))) - /* If the low half of dest is mentioned in the source memory - address, the arrange to emit the move late half first. */ - dest_overlapped_low = 1; - } - - /* If one or both operands autodecrementing, - do the two words, high-numbered first. */ - - /* Likewise, the first move would clobber the source of the second one, - do them in the other order. This happens only for registers; - such overlap can't happen in memory unless the user explicitly - sets it up, and that is an undefined circumstance. */ - -#if 0 - if (optype0 == PUSHOP || optype1 == PUSHOP - || (optype0 == REGOP && optype1 == REGOP - && REGNO (operands[0]) == REGNO (latehalf[1])) - || dest_overlapped_low) -#endif - - if (optype0 == PUSHOP || optype1 == PUSHOP - || (optype0 == REGOP && optype1 == REGOP - && ((middlehalf[1] && REGNO (operands[0]) == REGNO (middlehalf[1])) - || REGNO (operands[0]) == REGNO (latehalf[1]))) - || dest_overlapped_low) - { - /* Do the high-numbered word. */ - output_asm_insn (singlemove_string (latehalf), latehalf); - - if (size == 12) - output_asm_insn (singlemove_string (middlehalf), middlehalf); - - /* Do low-numbered word. */ - return singlemove_string (operands); - } - - /* Normal case: do the two words, low-numbered first. */ - - output_asm_insn (singlemove_string (operands), operands); - - /* Do the middle one of the three words for long double */ - if (size == 12) - output_asm_insn (singlemove_string (middlehalf), middlehalf); - - /* Do the high-numbered word. */ - output_asm_insn (singlemove_string (latehalf), latehalf); - - return ""; -} - -#define MAX_TMPS 2 /* max temporary registers used */ - -/* Output the appropriate code to move push memory on the stack */ - -char * -output_move_pushmem (operands, insn, length, tmp_start, n_operands) - rtx operands[]; - rtx insn; - int length; - int tmp_start; - int n_operands; -{ - struct - { - char *load; - char *push; - rtx xops[2]; - } tmp_info[MAX_TMPS]; - - rtx src = operands[1]; - int max_tmps = 0; - int offset = 0; - int stack_p = reg_overlap_mentioned_p (stack_pointer_rtx, src); - int stack_offset = 0; - int i, num_tmps; - rtx xops[1]; - - if (! offsettable_memref_p (src)) - fatal_insn ("Source is not offsettable", insn); - - if ((length & 3) != 0) - fatal_insn ("Pushing non-word aligned size", insn); - - /* Figure out which temporary registers we have available */ - for (i = tmp_start; i < n_operands; i++) - { - if (GET_CODE (operands[i]) == REG) - { - if (reg_overlap_mentioned_p (operands[i], src)) - continue; - - tmp_info[ max_tmps++ ].xops[1] = operands[i]; - if (max_tmps == MAX_TMPS) - break; - } - } - - if (max_tmps == 0) - for (offset = length - 4; offset >= 0; offset -= 4) - { - xops[0] = adj_offsettable_operand (src, offset + stack_offset); - output_asm_insn (AS1(push%L0,%0), xops); - if (stack_p) - stack_offset += 4; - } - - else - for (offset = length - 4; offset >= 0; ) - { - for (num_tmps = 0; num_tmps < max_tmps && offset >= 0; num_tmps++) - { - tmp_info[num_tmps].load = AS2(mov%L0,%0,%1); - tmp_info[num_tmps].push = AS1(push%L0,%1); - tmp_info[num_tmps].xops[0] - = adj_offsettable_operand (src, offset + stack_offset); - offset -= 4; - } - - for (i = 0; i < num_tmps; i++) - output_asm_insn (tmp_info[i].load, tmp_info[i].xops); - - for (i = 0; i < num_tmps; i++) - output_asm_insn (tmp_info[i].push, tmp_info[i].xops); - - if (stack_p) - stack_offset += 4*num_tmps; - } - - return ""; -} - -int -standard_80387_constant_p (x) - rtx x; -{ -#if ! defined (REAL_IS_NOT_DOUBLE) || defined (REAL_ARITHMETIC) - REAL_VALUE_TYPE d; - jmp_buf handler; - int is0, is1; - - if (setjmp (handler)) - return 0; - - set_float_handler (handler); - REAL_VALUE_FROM_CONST_DOUBLE (d, x); - is0 = REAL_VALUES_EQUAL (d, dconst0) && !REAL_VALUE_MINUS_ZERO (d); - is1 = REAL_VALUES_EQUAL (d, dconst1); - set_float_handler (NULL_PTR); - - if (is0) - return 1; - - if (is1) - return 2; - - /* Note that on the 80387, other constants, such as pi, - are much slower to load as standard constants - than to load from doubles in memory! */ - /* ??? Not true on K6: all constants are equal cost. */ -#endif - - return 0; -} - -char * -output_move_const_single (operands) - rtx *operands; -{ - if (FP_REG_P (operands[0])) - { - int conval = standard_80387_constant_p (operands[1]); - - if (conval == 1) - return "fldz"; - - if (conval == 2) - return "fld1"; - } - - if (GET_CODE (operands[1]) == CONST_DOUBLE) - { - REAL_VALUE_TYPE r; long l; - - if (GET_MODE (operands[1]) == XFmode) - abort (); - - REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]); - REAL_VALUE_TO_TARGET_SINGLE (r, l); - operands[1] = GEN_INT (l); - } - - return singlemove_string (operands); -} - -/* Returns 1 if OP is either a symbol reference or a sum of a symbol - reference and a constant. */ - -int -symbolic_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - switch (GET_CODE (op)) - { - case SYMBOL_REF: - case LABEL_REF: - return 1; - - case CONST: - op = XEXP (op, 0); - return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF - || GET_CODE (XEXP (op, 0)) == LABEL_REF) - && GET_CODE (XEXP (op, 1)) == CONST_INT); - - default: - return 0; - } -} - -/* Return nonzero if OP is a constant shift count small enough to - encode into an lea instruction. */ - -int -small_shift_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == CONST_INT && INTVAL (op) > 0 && INTVAL (op) < 4); -} - -/* Test for a valid operand for a call instruction. - Don't allow the arg pointer register or virtual regs - since they may change into reg + const, which the patterns - can't handle yet. */ - -int -call_insn_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - if (GET_CODE (op) == MEM - && ((CONSTANT_ADDRESS_P (XEXP (op, 0)) - /* This makes a difference for PIC. */ - && general_operand (XEXP (op, 0), Pmode)) - || (GET_CODE (XEXP (op, 0)) == REG - && XEXP (op, 0) != arg_pointer_rtx - && ! (REGNO (XEXP (op, 0)) >= FIRST_PSEUDO_REGISTER - && REGNO (XEXP (op, 0)) <= LAST_VIRTUAL_REGISTER)))) - return 1; - - return 0; -} - -/* Like call_insn_operand but allow (mem (symbol_ref ...)) - even if pic. */ - -int -expander_call_insn_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - if (GET_CODE (op) == MEM - && (CONSTANT_ADDRESS_P (XEXP (op, 0)) - || (GET_CODE (XEXP (op, 0)) == REG - && XEXP (op, 0) != arg_pointer_rtx - && ! (REGNO (XEXP (op, 0)) >= FIRST_PSEUDO_REGISTER - && REGNO (XEXP (op, 0)) <= LAST_VIRTUAL_REGISTER)))) - return 1; - - return 0; -} - -/* Return 1 if OP is a comparison operator that can use the condition code - generated by an arithmetic operation. */ - -int -arithmetic_comparison_operator (op, mode) - register rtx op; - enum machine_mode mode; -{ - enum rtx_code code; - - if (mode != VOIDmode && mode != GET_MODE (op)) - return 0; - - code = GET_CODE (op); - if (GET_RTX_CLASS (code) != '<') - return 0; - - return (code != GT && code != LE); -} - -int -ix86_logical_operator (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return GET_CODE (op) == AND || GET_CODE (op) == IOR || GET_CODE (op) == XOR; -} - - -/* Returns 1 if OP contains a symbol reference */ - -int -symbolic_reference_mentioned_p (op) - rtx op; -{ - register char *fmt; - register int i; - - if (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF) - return 1; - - fmt = GET_RTX_FORMAT (GET_CODE (op)); - for (i = GET_RTX_LENGTH (GET_CODE (op)) - 1; i >= 0; i--) - { - if (fmt[i] == 'E') - { - register int j; - - for (j = XVECLEN (op, i) - 1; j >= 0; j--) - if (symbolic_reference_mentioned_p (XVECEXP (op, i, j))) - return 1; - } - - else if (fmt[i] == 'e' && symbolic_reference_mentioned_p (XEXP (op, i))) - return 1; - } - - return 0; -} - -/* Attempt to expand a binary operator. Make the expansion closer to the - actual machine, then just general_operand, which will allow 3 separate - memory references (one output, two input) in a single insn. Return - whether the insn fails, or succeeds. */ - -int -ix86_expand_binary_operator (code, mode, operands) - enum rtx_code code; - enum machine_mode mode; - rtx operands[]; -{ - int modified; - - /* Recognize = for commutative operators */ - if (GET_RTX_CLASS (code) == 'c' - && (rtx_equal_p (operands[0], operands[2]) - || immediate_operand (operands[1], mode))) - { - rtx temp = operands[1]; - operands[1] = operands[2]; - operands[2] = temp; - } - - /* If optimizing, copy to regs to improve CSE */ - if (TARGET_PSEUDO && optimize - && ((reload_in_progress | reload_completed) == 0)) - { - if (GET_CODE (operands[1]) == MEM - && ! rtx_equal_p (operands[0], operands[1])) - operands[1] = force_reg (GET_MODE (operands[1]), operands[1]); - - if (GET_CODE (operands[2]) == MEM) - operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); - - if (GET_CODE (operands[1]) == CONST_INT && code == MINUS) - { - rtx temp = gen_reg_rtx (GET_MODE (operands[0])); - - emit_move_insn (temp, operands[1]); - operands[1] = temp; - return TRUE; - } - } - - if (!ix86_binary_operator_ok (code, mode, operands)) - { - /* If not optimizing, try to make a valid insn (optimize code - previously did this above to improve chances of CSE) */ - - if ((! TARGET_PSEUDO || !optimize) - && ((reload_in_progress | reload_completed) == 0) - && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)) - { - modified = FALSE; - if (GET_CODE (operands[1]) == MEM - && ! rtx_equal_p (operands[0], operands[1])) - { - operands[1] = force_reg (GET_MODE (operands[1]), operands[1]); - modified = TRUE; - } - - if (GET_CODE (operands[2]) == MEM) - { - operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); - modified = TRUE; - } - - if (GET_CODE (operands[1]) == CONST_INT && code == MINUS) - { - rtx temp = gen_reg_rtx (GET_MODE (operands[0])); - - emit_move_insn (temp, operands[1]); - operands[1] = temp; - return TRUE; - } - - if (modified && ! ix86_binary_operator_ok (code, mode, operands)) - return FALSE; - } - else - return FALSE; - } - - return TRUE; -} - -/* Return TRUE or FALSE depending on whether the binary operator meets the - appropriate constraints. */ - -int -ix86_binary_operator_ok (code, mode, operands) - enum rtx_code code; - enum machine_mode mode ATTRIBUTE_UNUSED; - rtx operands[3]; -{ - return (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM) - && (GET_CODE (operands[1]) != CONST_INT || GET_RTX_CLASS (code) == 'c'); -} - -/* Attempt to expand a unary operator. Make the expansion closer to the - actual machine, then just general_operand, which will allow 2 separate - memory references (one output, one input) in a single insn. Return - whether the insn fails, or succeeds. */ - -int -ix86_expand_unary_operator (code, mode, operands) - enum rtx_code code; - enum machine_mode mode; - rtx operands[]; -{ - /* If optimizing, copy to regs to improve CSE */ - if (TARGET_PSEUDO - && optimize - && ((reload_in_progress | reload_completed) == 0) - && GET_CODE (operands[1]) == MEM) - operands[1] = force_reg (GET_MODE (operands[1]), operands[1]); - - if (! ix86_unary_operator_ok (code, mode, operands)) - { - if ((! TARGET_PSEUDO || optimize == 0) - && ((reload_in_progress | reload_completed) == 0) - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (GET_MODE (operands[1]), operands[1]); - if (! ix86_unary_operator_ok (code, mode, operands)) - return FALSE; - } - else - return FALSE; - } - - return TRUE; -} - -/* Return TRUE or FALSE depending on whether the unary operator meets the - appropriate constraints. */ - -int -ix86_unary_operator_ok (code, mode, operands) - enum rtx_code code ATTRIBUTE_UNUSED; - enum machine_mode mode ATTRIBUTE_UNUSED; - rtx operands[2] ATTRIBUTE_UNUSED; -{ - return TRUE; -} - -static rtx pic_label_rtx; -static char pic_label_name [256]; -static int pic_label_no = 0; - -/* This function generates code for -fpic that loads %ebx with - the return address of the caller and then returns. */ - -void -asm_output_function_prefix (file, name) - FILE *file; - char *name ATTRIBUTE_UNUSED; -{ - rtx xops[2]; - int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table - || current_function_uses_const_pool); - xops[0] = pic_offset_table_rtx; - xops[1] = stack_pointer_rtx; - - /* Deep branch prediction favors having a return for every call. */ - if (pic_reg_used && TARGET_DEEP_BRANCH_PREDICTION) - { - tree prologue_node; - - if (pic_label_rtx == 0) - { - pic_label_rtx = gen_label_rtx (); - ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", pic_label_no++); - LABEL_NAME (pic_label_rtx) = pic_label_name; - } - - prologue_node = make_node (FUNCTION_DECL); - DECL_RESULT (prologue_node) = 0; - - /* This used to call ASM_DECLARE_FUNCTION_NAME() but since it's an - internal (non-global) label that's being emitted, it didn't make - sense to have .type information for local labels. This caused - the SCO OpenServer 5.0.4 ELF assembler grief (why are you giving - me debug info for a label that you're declaring non-global?) this - was changed to call ASM_OUTPUT_LABEL() instead. */ - - - ASM_OUTPUT_LABEL (file, pic_label_name); - output_asm_insn ("movl (%1),%0", xops); - output_asm_insn ("ret", xops); - } -} - -/* Generate the assembly code for function entry. - FILE is an stdio stream to output the code to. - SIZE is an int: how many units of temporary storage to allocate. */ - -void -function_prologue (file, size) - FILE *file ATTRIBUTE_UNUSED; - int size ATTRIBUTE_UNUSED; -{ - if (TARGET_SCHEDULE_PROLOGUE) - { - pic_label_rtx = 0; - return; - } - - ix86_prologue (0); -} - -/* Expand the prologue into a bunch of separate insns. */ - -void -ix86_expand_prologue () -{ - if (! TARGET_SCHEDULE_PROLOGUE) - return; - - ix86_prologue (1); -} - -void -load_pic_register (do_rtl) - int do_rtl; -{ - rtx xops[4]; - - if (TARGET_DEEP_BRANCH_PREDICTION) - { - xops[0] = pic_offset_table_rtx; - if (pic_label_rtx == 0) - { - pic_label_rtx = gen_label_rtx (); - ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", pic_label_no++); - LABEL_NAME (pic_label_rtx) = pic_label_name; - } - - xops[1] = gen_rtx_MEM (QImode, - gen_rtx (SYMBOL_REF, Pmode, - LABEL_NAME (pic_label_rtx))); - - if (do_rtl) - { - emit_insn (gen_prologue_get_pc (xops[0], xops[1])); - emit_insn (gen_prologue_set_got (xops[0], -#ifdef YES_UNDERSCORES - gen_rtx_SYMBOL_REF (Pmode, - "$__GLOBAL_OFFSET_TABLE_"), -#else - gen_rtx_SYMBOL_REF (Pmode, - "$_GLOBAL_OFFSET_TABLE_"), -#endif - xops[1])); - } - else - { - output_asm_insn (AS1 (call,%X1), xops); - output_asm_insn ("addl $%__GLOBAL_OFFSET_TABLE_,%0", xops); - pic_label_rtx = 0; - } - } - - else - { - xops[0] = pic_offset_table_rtx; - xops[1] = gen_label_rtx (); - - if (do_rtl) - { - /* We can't put a raw CODE_LABEL into the RTL, and we can't emit - a new CODE_LABEL after reload, so we need a single pattern to - emit the 3 necessary instructions. */ - emit_insn (gen_prologue_get_pc_and_set_got (xops[0])); - } - else - { - output_asm_insn (AS1 (call,%P1), xops); - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", - CODE_LABEL_NUMBER (xops[1])); - output_asm_insn (AS1 (pop%L0,%0), xops); - output_asm_insn ("addl $%__GLOBAL_OFFSET_TABLE_+[.-%P1],%0", xops); - } - } - - /* When -fpic, we must emit a scheduling barrier, so that the instruction - that restores %ebx (which is PIC_OFFSET_TABLE_REGNUM), does not get - moved before any instruction which implicitly uses the got. */ - - if (do_rtl) - emit_insn (gen_blockage ()); -} - -/* Compute the size of local storage taking into consideration the - desired stack alignment which is to be maintained. Also determine - the number of registers saved below the local storage. */ - -HOST_WIDE_INT -ix86_compute_frame_size (size, nregs_on_stack) - HOST_WIDE_INT size; - int *nregs_on_stack; -{ - int limit; - int nregs; - int regno; - int padding; - int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table - || current_function_uses_const_pool); - HOST_WIDE_INT total_size; - - limit = frame_pointer_needed - ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM; - - nregs = 0; - - for (regno = limit - 1; regno >= 0; regno--) - if ((regs_ever_live[regno] && ! call_used_regs[regno]) - || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used)) - nregs++; - - padding = 0; - total_size = size + (nregs * UNITS_PER_WORD); - -#ifdef PREFERRED_STACK_BOUNDARY - { - int offset; - int preferred_alignment = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT; - - offset = 4; - if (frame_pointer_needed) - offset += UNITS_PER_WORD; - - total_size += offset; - - padding = ((total_size + preferred_alignment - 1) - & -preferred_alignment) - total_size; - - if (padding < (((offset + preferred_alignment - 1) - & -preferred_alignment) - offset)) - padding += preferred_alignment; - - /* Don't bother aligning the stack of a leaf function - which doesn't allocate any stack slots. */ - if (size == 0 && current_function_is_leaf) - padding = 0; - } -#endif - - if (nregs_on_stack) - *nregs_on_stack = nregs; - - return size + padding; -} - -static void -ix86_prologue (do_rtl) - int do_rtl; -{ - register int regno; - int limit; - rtx xops[4]; - int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table - || current_function_uses_const_pool); - HOST_WIDE_INT tsize = ix86_compute_frame_size (get_frame_size (), (int *)0); - rtx insn; - int cfa_offset = INCOMING_FRAME_SP_OFFSET, cfa_store_offset = cfa_offset; - - xops[0] = stack_pointer_rtx; - xops[1] = frame_pointer_rtx; - xops[2] = GEN_INT (tsize); - - if (frame_pointer_needed) - { - if (do_rtl) - { - insn = emit_insn (gen_rtx (SET, VOIDmode, - gen_rtx_MEM (SImode, - gen_rtx (PRE_DEC, SImode, - stack_pointer_rtx)), - frame_pointer_rtx)); - - RTX_FRAME_RELATED_P (insn) = 1; - insn = emit_move_insn (xops[1], xops[0]); - RTX_FRAME_RELATED_P (insn) = 1; - } - - else - { - output_asm_insn ("push%L1 %1", xops); -#ifdef INCOMING_RETURN_ADDR_RTX - if (dwarf2out_do_frame ()) - { - char *l = dwarf2out_cfi_label (); - - cfa_store_offset += 4; - cfa_offset = cfa_store_offset; - dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, cfa_offset); - dwarf2out_reg_save (l, FRAME_POINTER_REGNUM, - cfa_store_offset); - } -#endif - - output_asm_insn (AS2 (mov%L0,%0,%1), xops); -#ifdef INCOMING_RETURN_ADDR_RTX - if (dwarf2out_do_frame ()) - dwarf2out_def_cfa ("", FRAME_POINTER_REGNUM, cfa_offset); -#endif - } - } - - if (tsize == 0) - ; - else if (! TARGET_STACK_PROBE || tsize < CHECK_STACK_LIMIT) - { - if (do_rtl) - { - insn = emit_insn (gen_prologue_set_stack_ptr (xops[2])); - RTX_FRAME_RELATED_P (insn) = 1; - } - else - { - output_asm_insn (AS2 (sub%L0,%2,%0), xops); -#ifdef INCOMING_RETURN_ADDR_RTX - if (dwarf2out_do_frame ()) - { - cfa_store_offset += tsize; - if (! frame_pointer_needed) - { - cfa_offset = cfa_store_offset; - dwarf2out_def_cfa ("", STACK_POINTER_REGNUM, cfa_offset); - } - } -#endif - } - } - else - { - xops[3] = gen_rtx_REG (SImode, 0); - if (do_rtl) - emit_move_insn (xops[3], xops[2]); - else - output_asm_insn (AS2 (mov%L0,%2,%3), xops); - - xops[3] = gen_rtx_MEM (FUNCTION_MODE, - gen_rtx (SYMBOL_REF, Pmode, "_alloca")); - - if (do_rtl) - emit_call_insn (gen_rtx (CALL, VOIDmode, xops[3], const0_rtx)); - else - output_asm_insn (AS1 (call,%P3), xops); - } - - /* Note If use enter it is NOT reversed args. - This one is not reversed from intel!! - I think enter is slower. Also sdb doesn't like it. - But if you want it the code is: - { - xops[3] = const0_rtx; - output_asm_insn ("enter %2,%3", xops); - } - */ - - limit = (frame_pointer_needed ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM); - for (regno = limit - 1; regno >= 0; regno--) - if ((regs_ever_live[regno] && ! call_used_regs[regno]) - || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used)) - { - xops[0] = gen_rtx_REG (SImode, regno); - if (do_rtl) - { - insn = emit_insn (gen_rtx (SET, VOIDmode, - gen_rtx_MEM (SImode, - gen_rtx (PRE_DEC, SImode, - stack_pointer_rtx)), - xops[0])); - - RTX_FRAME_RELATED_P (insn) = 1; - } - else - { - output_asm_insn ("push%L0 %0", xops); -#ifdef INCOMING_RETURN_ADDR_RTX - if (dwarf2out_do_frame ()) - { - char *l = dwarf2out_cfi_label (); - - cfa_store_offset += 4; - if (! frame_pointer_needed) - { - cfa_offset = cfa_store_offset; - dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, cfa_offset); - } - - dwarf2out_reg_save (l, regno, - cfa_store_offset); - } -#endif - } - } - -#ifdef SUBTARGET_PROLOGUE - SUBTARGET_PROLOGUE; -#endif - - if (pic_reg_used) - load_pic_register (do_rtl); - - /* If we are profiling, make sure no instructions are scheduled before - the call to mcount. However, if -fpic, the above call will have - done that. */ - if ((profile_flag || profile_block_flag) - && ! pic_reg_used && do_rtl) - emit_insn (gen_blockage ()); -} - -/* Return 1 if it is appropriate to emit `ret' instructions in the - body of a function. Do this only if the epilogue is simple, needing a - couple of insns. Prior to reloading, we can't tell how many registers - must be saved, so return 0 then. Return 0 if there is no frame - marker to de-allocate. - - If NON_SAVING_SETJMP is defined and true, then it is not possible - for the epilogue to be simple, so return 0. This is a special case - since NON_SAVING_SETJMP will not cause regs_ever_live to change - until final, but jump_optimize may need to know sooner if a - `return' is OK. */ - -int -ix86_can_use_return_insn_p () -{ - int regno; - int nregs = 0; - int reglimit = (frame_pointer_needed - ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM); - int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table - || current_function_uses_const_pool); - -#ifdef NON_SAVING_SETJMP - if (NON_SAVING_SETJMP && current_function_calls_setjmp) - return 0; -#endif - - if (! reload_completed) - return 0; - - for (regno = reglimit - 1; regno >= 0; regno--) - if ((regs_ever_live[regno] && ! call_used_regs[regno]) - || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used)) - nregs++; - - return nregs == 0 || ! frame_pointer_needed; -} - -/* This function generates the assembly code for function exit. - FILE is an stdio stream to output the code to. - SIZE is an int: how many units of temporary storage to deallocate. */ - -void -function_epilogue (file, size) - FILE *file ATTRIBUTE_UNUSED; - int size ATTRIBUTE_UNUSED; -{ - return; -} - -/* Restore function stack, frame, and registers. */ - -void -ix86_expand_epilogue () -{ - ix86_epilogue (1); -} - -static void -ix86_epilogue (do_rtl) - int do_rtl; -{ - register int regno; - register int limit; - int nregs; - rtx xops[3]; - int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table - || current_function_uses_const_pool); - int sp_valid = !frame_pointer_needed || current_function_sp_is_unchanging; - HOST_WIDE_INT offset; - HOST_WIDE_INT tsize = ix86_compute_frame_size (get_frame_size (), &nregs); - - /* sp is often unreliable so we may have to go off the frame pointer. */ - - offset = -(tsize + nregs * UNITS_PER_WORD); - - xops[2] = stack_pointer_rtx; - - /* When -fpic, we must emit a scheduling barrier, so that the instruction - that restores %ebx (which is PIC_OFFSET_TABLE_REGNUM), does not get - moved before any instruction which implicitly uses the got. This - includes any instruction which uses a SYMBOL_REF or a LABEL_REF. - - Alternatively, this could be fixed by making the dependence on the - PIC_OFFSET_TABLE_REGNUM explicit in the RTL. */ - - if (flag_pic || profile_flag || profile_block_flag) - emit_insn (gen_blockage ()); - - /* If we're only restoring one register and sp is not valid then - using a move instruction to restore the register since it's - less work than reloading sp and popping the register. Otherwise, - restore sp (if necessary) and pop the registers. */ - - limit = frame_pointer_needed - ? FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM; - - if (nregs > 1 || sp_valid) - { - if ( !sp_valid ) - { - xops[0] = adj_offsettable_operand (AT_BP (QImode), offset); - if (do_rtl) - emit_insn (gen_movsi_lea (xops[2], XEXP (xops[0], 0))); - else - output_asm_insn (AS2 (lea%L2,%0,%2), xops); - } - - for (regno = 0; regno < limit; regno++) - if ((regs_ever_live[regno] && ! call_used_regs[regno]) - || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used)) - { - xops[0] = gen_rtx_REG (SImode, regno); - - if (do_rtl) - emit_insn (gen_pop (xops[0])); - else - output_asm_insn ("pop%L0 %0", xops); - } - } - - else - for (regno = 0; regno < limit; regno++) - if ((regs_ever_live[regno] && ! call_used_regs[regno]) - || (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used)) - { - xops[0] = gen_rtx_REG (SImode, regno); - xops[1] = adj_offsettable_operand (AT_BP (Pmode), offset); - - if (do_rtl) - emit_move_insn (xops[0], xops[1]); - else - output_asm_insn (AS2 (mov%L0,%1,%0), xops); - - offset += 4; - } - - if (frame_pointer_needed) - { - /* If not an i386, mov & pop is faster than "leave". */ - - if (TARGET_USE_LEAVE) - { - if (do_rtl) - emit_insn (gen_leave()); - else - output_asm_insn ("leave", xops); - } - else - { - xops[0] = frame_pointer_rtx; - xops[1] = stack_pointer_rtx; - - if (do_rtl) - { - emit_insn (gen_epilogue_set_stack_ptr()); - emit_insn (gen_pop (xops[0])); - } - else - { - output_asm_insn (AS2 (mov%L2,%0,%2), xops); - output_asm_insn ("pop%L0 %0", xops); - } - } - } - - else if (tsize) - { - /* Intel's docs say that for 4 or 8 bytes of stack frame one should - use `pop' and not `add'. */ - int use_pop = tsize == 4; - - /* Use two pops only for the Pentium processors. */ - if (tsize == 8 && !TARGET_386 && !TARGET_486) - { - rtx retval = current_function_return_rtx; - - xops[1] = gen_rtx_REG (SImode, 1); /* %edx */ - - /* This case is a bit more complex. Since we cannot pop into - %ecx twice we need a second register. But this is only - available if the return value is not of DImode in which - case the %edx register is not available. */ - use_pop = (retval == NULL - || ! reg_overlap_mentioned_p (xops[1], retval)); - } - - if (use_pop) - { - xops[0] = gen_rtx_REG (SImode, 2); /* %ecx */ - - if (do_rtl) - { - /* We have to prevent the two pops here from being scheduled. - GCC otherwise would try in some situation to put other - instructions in between them which has a bad effect. */ - emit_insn (gen_blockage ()); - emit_insn (gen_pop (xops[0])); - if (tsize == 8) - emit_insn (gen_pop (xops[1])); - } - else - { - output_asm_insn ("pop%L0 %0", xops); - if (tsize == 8) - output_asm_insn ("pop%L1 %1", xops); - } - } - else - { - /* If there is no frame pointer, we must still release the frame. */ - xops[0] = GEN_INT (tsize); - - if (do_rtl) - emit_insn (gen_rtx (SET, VOIDmode, xops[2], - gen_rtx (PLUS, SImode, xops[2], xops[0]))); - else - output_asm_insn (AS2 (add%L2,%0,%2), xops); - } - } - -#ifdef FUNCTION_BLOCK_PROFILER_EXIT - if (profile_block_flag == 2) - { - FUNCTION_BLOCK_PROFILER_EXIT(file); - } -#endif - - if (current_function_pops_args && current_function_args_size) - { - xops[1] = GEN_INT (current_function_pops_args); - - /* i386 can only pop 32K bytes (maybe 64K? Is it signed?). If - asked to pop more, pop return address, do explicit add, and jump - indirectly to the caller. */ - - if (current_function_pops_args >= 32768) - { - /* ??? Which register to use here? */ - xops[0] = gen_rtx_REG (SImode, 2); - - if (do_rtl) - { - emit_insn (gen_pop (xops[0])); - emit_insn (gen_rtx (SET, VOIDmode, xops[2], - gen_rtx (PLUS, SImode, xops[1], xops[2]))); - emit_jump_insn (xops[0]); - } - else - { - output_asm_insn ("pop%L0 %0", xops); - output_asm_insn (AS2 (add%L2,%1,%2), xops); - output_asm_insn ("jmp %*%0", xops); - } - } - else - { - if (do_rtl) - emit_jump_insn (gen_return_pop_internal (xops[1])); - else - output_asm_insn ("ret %1", xops); - } - } - else - { - if (do_rtl) - emit_jump_insn (gen_return_internal ()); - else - output_asm_insn ("ret", xops); - } -} - -/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression - that is a valid memory address for an instruction. - The MODE argument is the machine mode for the MEM expression - that wants to use this address. - - On x86, legitimate addresses are: - base movl (base),reg - displacement movl disp,reg - base + displacement movl disp(base),reg - index + base movl (base,index),reg - (index + base) + displacement movl disp(base,index),reg - index*scale movl (,index,scale),reg - index*scale + disp movl disp(,index,scale),reg - index*scale + base movl (base,index,scale),reg - (index*scale + base) + disp movl disp(base,index,scale),reg - - In each case, scale can be 1, 2, 4, 8. */ - -/* This is exactly the same as print_operand_addr, except that - it recognizes addresses instead of printing them. - - It only recognizes address in canonical form. LEGITIMIZE_ADDRESS should - convert common non-canonical forms to canonical form so that they will - be recognized. */ - -#define ADDR_INVALID(msg,insn) \ -do { \ - if (TARGET_DEBUG_ADDR) \ - { \ - fprintf (stderr, msg); \ - debug_rtx (insn); \ - } \ -} while (0) - -int -legitimate_pic_address_disp_p (disp) - register rtx disp; -{ - if (GET_CODE (disp) != CONST) - return 0; - disp = XEXP (disp, 0); - - if (GET_CODE (disp) == PLUS) - { - if (GET_CODE (XEXP (disp, 1)) != CONST_INT) - return 0; - disp = XEXP (disp, 0); - } - - if (GET_CODE (disp) != UNSPEC - || XVECLEN (disp, 0) != 1) - return 0; - - /* Must be @GOT or @GOTOFF. */ - if (XINT (disp, 1) != 6 - && XINT (disp, 1) != 7) - return 0; - - if (GET_CODE (XVECEXP (disp, 0, 0)) != SYMBOL_REF - && GET_CODE (XVECEXP (disp, 0, 0)) != LABEL_REF) - return 0; - - return 1; -} - -int -legitimate_address_p (mode, addr, strict) - enum machine_mode mode; - register rtx addr; - int strict; -{ - rtx base = NULL_RTX; - rtx indx = NULL_RTX; - rtx scale = NULL_RTX; - rtx disp = NULL_RTX; - - if (TARGET_DEBUG_ADDR) - { - fprintf (stderr, - "\n======\nGO_IF_LEGITIMATE_ADDRESS, mode = %s, strict = %d\n", - GET_MODE_NAME (mode), strict); - - debug_rtx (addr); - } - - if (GET_CODE (addr) == REG || GET_CODE (addr) == SUBREG) - base = addr; - - else if (GET_CODE (addr) == PLUS) - { - rtx op0 = XEXP (addr, 0); - rtx op1 = XEXP (addr, 1); - enum rtx_code code0 = GET_CODE (op0); - enum rtx_code code1 = GET_CODE (op1); - - if (code0 == REG || code0 == SUBREG) - { - if (code1 == REG || code1 == SUBREG) - { - indx = op0; /* index + base */ - base = op1; - } - - else - { - base = op0; /* base + displacement */ - disp = op1; - } - } - - else if (code0 == MULT) - { - indx = XEXP (op0, 0); - scale = XEXP (op0, 1); - - if (code1 == REG || code1 == SUBREG) - base = op1; /* index*scale + base */ - - else - disp = op1; /* index*scale + disp */ - } - - else if (code0 == PLUS && GET_CODE (XEXP (op0, 0)) == MULT) - { - indx = XEXP (XEXP (op0, 0), 0); /* index*scale + base + disp */ - scale = XEXP (XEXP (op0, 0), 1); - base = XEXP (op0, 1); - disp = op1; - } - - else if (code0 == PLUS) - { - indx = XEXP (op0, 0); /* index + base + disp */ - base = XEXP (op0, 1); - disp = op1; - } - - else - { - ADDR_INVALID ("PLUS subcode is not valid.\n", op0); - return FALSE; - } - } - - else if (GET_CODE (addr) == MULT) - { - indx = XEXP (addr, 0); /* index*scale */ - scale = XEXP (addr, 1); - } - - else - disp = addr; /* displacement */ - - /* Allow arg pointer and stack pointer as index if there is not scaling */ - if (base && indx && !scale - && (indx == arg_pointer_rtx || indx == stack_pointer_rtx)) - { - rtx tmp = base; - base = indx; - indx = tmp; - } - - /* Validate base register: - - Don't allow SUBREG's here, it can lead to spill failures when the base - is one word out of a two word structure, which is represented internally - as a DImode int. */ - - if (base) - { - if (GET_CODE (base) != REG) - { - ADDR_INVALID ("Base is not a register.\n", base); - return FALSE; - } - - if (GET_MODE (base) != Pmode) - { - ADDR_INVALID ("Base is not in Pmode.\n", base); - return FALSE; - } - - if ((strict && ! REG_OK_FOR_BASE_STRICT_P (base)) - || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (base))) - { - ADDR_INVALID ("Base is not valid.\n", base); - return FALSE; - } - } - - /* Validate index register: - - Don't allow SUBREG's here, it can lead to spill failures when the index - is one word out of a two word structure, which is represented internally - as a DImode int. */ - if (indx) - { - if (GET_CODE (indx) != REG) - { - ADDR_INVALID ("Index is not a register.\n", indx); - return FALSE; - } - - if (GET_MODE (indx) != Pmode) - { - ADDR_INVALID ("Index is not in Pmode.\n", indx); - return FALSE; - } - - if ((strict && ! REG_OK_FOR_INDEX_STRICT_P (indx)) - || (! strict && ! REG_OK_FOR_INDEX_NONSTRICT_P (indx))) - { - ADDR_INVALID ("Index is not valid.\n", indx); - return FALSE; - } - } - else if (scale) - abort (); /* scale w/o index invalid */ - - /* Validate scale factor: */ - if (scale) - { - HOST_WIDE_INT value; - - if (GET_CODE (scale) != CONST_INT) - { - ADDR_INVALID ("Scale is not valid.\n", scale); - return FALSE; - } - - value = INTVAL (scale); - if (value != 1 && value != 2 && value != 4 && value != 8) - { - ADDR_INVALID ("Scale is not a good multiplier.\n", scale); - return FALSE; - } - } - - /* Validate displacement. */ - if (disp) - { - if (!CONSTANT_ADDRESS_P (disp)) - { - ADDR_INVALID ("Displacement is not valid.\n", disp); - return FALSE; - } - - else if (GET_CODE (disp) == CONST_DOUBLE) - { - ADDR_INVALID ("Displacement is a const_double.\n", disp); - return FALSE; - } - - if (flag_pic && SYMBOLIC_CONST (disp)) - { - if (! legitimate_pic_address_disp_p (disp)) - { - ADDR_INVALID ("Displacement is an invalid PIC construct.\n", - disp); - return FALSE; - } - - if (base != pic_offset_table_rtx - && (indx != pic_offset_table_rtx || scale != NULL_RTX)) - { - ADDR_INVALID ("PIC displacement against invalid base.\n", disp); - return FALSE; - } - } - - else if (HALF_PIC_P ()) - { - if (! HALF_PIC_ADDRESS_P (disp) - || (base != NULL_RTX || indx != NULL_RTX)) - { - ADDR_INVALID ("Displacement is an invalid half-pic reference.\n", - disp); - return FALSE; - } - } - } - - if (TARGET_DEBUG_ADDR) - fprintf (stderr, "Address is valid.\n"); - - /* Everything looks valid, return true */ - return TRUE; -} - -/* Return a legitimate reference for ORIG (an address) using the - register REG. If REG is 0, a new pseudo is generated. - - There are two types of references that must be handled: - - 1. Global data references must load the address from the GOT, via - the PIC reg. An insn is emitted to do this load, and the reg is - returned. - - 2. Static data references, constant pool addresses, and code labels - compute the address as an offset from the GOT, whose base is in - the PIC reg. Static data objects have SYMBOL_REF_FLAG set to - differentiate them from global data objects. The returned - address is the PIC reg + an unspec constant. - - GO_IF_LEGITIMATE_ADDRESS rejects symbolic references unless the PIC - reg also appears in the address. */ - -rtx -legitimize_pic_address (orig, reg) - rtx orig; - rtx reg; -{ - rtx addr = orig; - rtx new = orig; - rtx base; - - if (GET_CODE (addr) == LABEL_REF - || (GET_CODE (addr) == SYMBOL_REF - && (CONSTANT_POOL_ADDRESS_P (addr) - || SYMBOL_REF_FLAG (addr)))) - { - /* This symbol may be referenced via a displacement from the PIC - base address (@GOTOFF). */ - - current_function_uses_pic_offset_table = 1; - new = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, addr), 7); - new = gen_rtx_CONST (VOIDmode, new); - new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new); - - if (reg != 0) - { - emit_move_insn (reg, new); - new = reg; - } - } - else if (GET_CODE (addr) == SYMBOL_REF) - { - /* This symbol must be referenced via a load from the - Global Offset Table (@GOT). */ - - current_function_uses_pic_offset_table = 1; - new = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, addr), 6); - new = gen_rtx_CONST (VOIDmode, new); - new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new); - new = gen_rtx_MEM (Pmode, new); - RTX_UNCHANGING_P (new) = 1; - - if (reg == 0) - reg = gen_reg_rtx (Pmode); - emit_move_insn (reg, new); - new = reg; - } - else - { - if (GET_CODE (addr) == CONST) - { - addr = XEXP (addr, 0); - if (GET_CODE (addr) == UNSPEC) - { - /* Check that the unspec is one of the ones we generate? */ - } - else if (GET_CODE (addr) != PLUS) - abort(); - } - if (GET_CODE (addr) == PLUS) - { - rtx op0 = XEXP (addr, 0), op1 = XEXP (addr, 1); - - /* Check first to see if this is a constant offset from a @GOTOFF - symbol reference. */ - if ((GET_CODE (op0) == LABEL_REF - || (GET_CODE (op0) == SYMBOL_REF - && (CONSTANT_POOL_ADDRESS_P (op0) - || SYMBOL_REF_FLAG (op0)))) - && GET_CODE (op1) == CONST_INT) - { - current_function_uses_pic_offset_table = 1; - new = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, op0), 7); - new = gen_rtx_PLUS (VOIDmode, new, op1); - new = gen_rtx_CONST (VOIDmode, new); - new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new); - - if (reg != 0) - { - emit_move_insn (reg, new); - new = reg; - } - } - else - { - base = legitimize_pic_address (XEXP (addr, 0), reg); - new = legitimize_pic_address (XEXP (addr, 1), - base == reg ? NULL_RTX : reg); - - if (GET_CODE (new) == CONST_INT) - new = plus_constant (base, INTVAL (new)); - else - { - if (GET_CODE (new) == PLUS && CONSTANT_P (XEXP (new, 1))) - { - base = gen_rtx_PLUS (Pmode, base, XEXP (new, 0)); - new = XEXP (new, 1); - } - new = gen_rtx_PLUS (Pmode, base, new); - } - } - } - } - return new; -} - -/* Emit insns to move operands[1] into operands[0]. */ - -void -emit_pic_move (operands, mode) - rtx *operands; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode); - - if (GET_CODE (operands[0]) == MEM && SYMBOLIC_CONST (operands[1])) - operands[1] = force_reg (Pmode, operands[1]); - else - operands[1] = legitimize_pic_address (operands[1], temp); -} - -/* Try machine-dependent ways of modifying an illegitimate address - to be legitimate. If we find one, return the new, valid address. - This macro is used in only one place: `memory_address' in explow.c. - - OLDX is the address as it was before break_out_memory_refs was called. - In some cases it is useful to look at this to decide what needs to be done. - - MODE and WIN are passed so that this macro can use - GO_IF_LEGITIMATE_ADDRESS. - - It is always safe for this macro to do nothing. It exists to recognize - opportunities to optimize the output. - - For the 80386, we handle X+REG by loading X into a register R and - using R+REG. R will go in a general reg and indexing will be used. - However, if REG is a broken-out memory address or multiplication, - nothing needs to be done because REG can certainly go in a general reg. - - When -fpic is used, special handling is needed for symbolic references. - See comments by legitimize_pic_address in i386.c for details. */ - -rtx -legitimize_address (x, oldx, mode) - register rtx x; - register rtx oldx ATTRIBUTE_UNUSED; - enum machine_mode mode; -{ - int changed = 0; - unsigned log; - - if (TARGET_DEBUG_ADDR) - { - fprintf (stderr, "\n==========\nLEGITIMIZE_ADDRESS, mode = %s\n", - GET_MODE_NAME (mode)); - debug_rtx (x); - } - - if (flag_pic && SYMBOLIC_CONST (x)) - return legitimize_pic_address (x, 0); - - /* Canonicalize shifts by 0, 1, 2, 3 into multiply */ - if (GET_CODE (x) == ASHIFT - && GET_CODE (XEXP (x, 1)) == CONST_INT - && (log = (unsigned)exact_log2 (INTVAL (XEXP (x, 1)))) < 4) - { - changed = 1; - x = gen_rtx_MULT (Pmode, force_reg (Pmode, XEXP (x, 0)), - GEN_INT (1 << log)); - } - - if (GET_CODE (x) == PLUS) - { - /* Canonicalize shifts by 0, 1, 2, 3 into multiply. */ - - if (GET_CODE (XEXP (x, 0)) == ASHIFT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && (log = (unsigned)exact_log2 (INTVAL (XEXP (XEXP (x, 0), 1)))) < 4) - { - changed = 1; - XEXP (x, 0) = gen_rtx (MULT, Pmode, - force_reg (Pmode, XEXP (XEXP (x, 0), 0)), - GEN_INT (1 << log)); - } - - if (GET_CODE (XEXP (x, 1)) == ASHIFT - && GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT - && (log = (unsigned)exact_log2 (INTVAL (XEXP (XEXP (x, 1), 1)))) < 4) - { - changed = 1; - XEXP (x, 1) = gen_rtx (MULT, Pmode, - force_reg (Pmode, XEXP (XEXP (x, 1), 0)), - GEN_INT (1 << log)); - } - - /* Put multiply first if it isn't already. */ - if (GET_CODE (XEXP (x, 1)) == MULT) - { - rtx tmp = XEXP (x, 0); - XEXP (x, 0) = XEXP (x, 1); - XEXP (x, 1) = tmp; - changed = 1; - } - - /* Canonicalize (plus (mult (reg) (const)) (plus (reg) (const))) - into (plus (plus (mult (reg) (const)) (reg)) (const)). This can be - created by virtual register instantiation, register elimination, and - similar optimizations. */ - if (GET_CODE (XEXP (x, 0)) == MULT && GET_CODE (XEXP (x, 1)) == PLUS) - { - changed = 1; - x = gen_rtx (PLUS, Pmode, - gen_rtx (PLUS, Pmode, XEXP (x, 0), - XEXP (XEXP (x, 1), 0)), - XEXP (XEXP (x, 1), 1)); - } - - /* Canonicalize - (plus (plus (mult (reg) (const)) (plus (reg) (const))) const) - into (plus (plus (mult (reg) (const)) (reg)) (const)). */ - else if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 0)) == PLUS - && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT - && GET_CODE (XEXP (XEXP (x, 0), 1)) == PLUS - && CONSTANT_P (XEXP (x, 1))) - { - rtx constant; - rtx other = NULL_RTX; - - if (GET_CODE (XEXP (x, 1)) == CONST_INT) - { - constant = XEXP (x, 1); - other = XEXP (XEXP (XEXP (x, 0), 1), 1); - } - else if (GET_CODE (XEXP (XEXP (XEXP (x, 0), 1), 1)) == CONST_INT) - { - constant = XEXP (XEXP (XEXP (x, 0), 1), 1); - other = XEXP (x, 1); - } - else - constant = 0; - - if (constant) - { - changed = 1; - x = gen_rtx (PLUS, Pmode, - gen_rtx (PLUS, Pmode, XEXP (XEXP (x, 0), 0), - XEXP (XEXP (XEXP (x, 0), 1), 0)), - plus_constant (other, INTVAL (constant))); - } - } - - if (changed && legitimate_address_p (mode, x, FALSE)) - return x; - - if (GET_CODE (XEXP (x, 0)) == MULT) - { - changed = 1; - XEXP (x, 0) = force_operand (XEXP (x, 0), 0); - } - - if (GET_CODE (XEXP (x, 1)) == MULT) - { - changed = 1; - XEXP (x, 1) = force_operand (XEXP (x, 1), 0); - } - - if (changed - && GET_CODE (XEXP (x, 1)) == REG - && GET_CODE (XEXP (x, 0)) == REG) - return x; - - if (flag_pic && SYMBOLIC_CONST (XEXP (x, 1))) - { - changed = 1; - x = legitimize_pic_address (x, 0); - } - - if (changed && legitimate_address_p (mode, x, FALSE)) - return x; - - if (GET_CODE (XEXP (x, 0)) == REG) - { - register rtx temp = gen_reg_rtx (Pmode); - register rtx val = force_operand (XEXP (x, 1), temp); - if (val != temp) - emit_move_insn (temp, val); - - XEXP (x, 1) = temp; - return x; - } - - else if (GET_CODE (XEXP (x, 1)) == REG) - { - register rtx temp = gen_reg_rtx (Pmode); - register rtx val = force_operand (XEXP (x, 0), temp); - if (val != temp) - emit_move_insn (temp, val); - - XEXP (x, 0) = temp; - return x; - } - } - - return x; -} - -/* Print an integer constant expression in assembler syntax. Addition - and subtraction are the only arithmetic that may appear in these - expressions. FILE is the stdio stream to write to, X is the rtx, and - CODE is the operand print code from the output string. */ - -static void -output_pic_addr_const (file, x, code) - FILE *file; - rtx x; - int code; -{ - char buf[256]; - - switch (GET_CODE (x)) - { - case PC: - if (flag_pic) - putc ('.', file); - else - abort (); - break; - - case SYMBOL_REF: - assemble_name (file, XSTR (x, 0)); - if (code == 'P' && ! SYMBOL_REF_FLAG (x)) - fputs ("@PLT", file); - break; - - case LABEL_REF: - x = XEXP (x, 0); - /* FALLTHRU */ - case CODE_LABEL: - ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x)); - assemble_name (asm_out_file, buf); - break; - - case CONST_INT: - fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x)); - break; - - case CONST: - /* This used to output parentheses around the expression, - but that does not work on the 386 (either ATT or BSD assembler). */ - output_pic_addr_const (file, XEXP (x, 0), code); - break; - - case CONST_DOUBLE: - if (GET_MODE (x) == VOIDmode) - { - /* We can use %d if the number is <32 bits and positive. */ - if (CONST_DOUBLE_HIGH (x) || CONST_DOUBLE_LOW (x) < 0) - fprintf (file, "0x%lx%08lx", - (unsigned long) CONST_DOUBLE_HIGH (x), - (unsigned long) CONST_DOUBLE_LOW (x)); - else - fprintf (file, HOST_WIDE_INT_PRINT_DEC, CONST_DOUBLE_LOW (x)); - } - else - /* We can't handle floating point constants; - PRINT_OPERAND must handle them. */ - output_operand_lossage ("floating constant misused"); - break; - - case PLUS: - /* Some assemblers need integer constants to appear first. */ - if (GET_CODE (XEXP (x, 0)) == CONST_INT) - { - output_pic_addr_const (file, XEXP (x, 0), code); - fprintf (file, "+"); - output_pic_addr_const (file, XEXP (x, 1), code); - } - else if (GET_CODE (XEXP (x, 1)) == CONST_INT) - { - output_pic_addr_const (file, XEXP (x, 1), code); - fprintf (file, "+"); - output_pic_addr_const (file, XEXP (x, 0), code); - } - else - abort (); - break; - - case MINUS: - output_pic_addr_const (file, XEXP (x, 0), code); - fprintf (file, "-"); - output_pic_addr_const (file, XEXP (x, 1), code); - break; - - case UNSPEC: - if (XVECLEN (x, 0) != 1) - abort (); - output_pic_addr_const (file, XVECEXP (x, 0, 0), code); - switch (XINT (x, 1)) - { - case 6: - fputs ("@GOT", file); - break; - case 7: - fputs ("@GOTOFF", file); - break; - case 8: - fputs ("@PLT", file); - break; - default: - output_operand_lossage ("invalid UNSPEC as operand"); - break; - } - break; - - default: - output_operand_lossage ("invalid expression as operand"); - } -} - -static void -put_jump_code (code, reverse, file) - enum rtx_code code; - int reverse; - FILE *file; -{ - int flags = cc_prev_status.flags; - int ieee = (TARGET_IEEE_FP && (flags & CC_IN_80387) - && !(cc_prev_status.flags & CC_FCOMI)); - const char *suffix; - - if (flags & CC_Z_IN_NOT_C) - switch (code) - { - case EQ: - fputs (reverse ? "c" : "nc", file); - return; - - case NE: - fputs (reverse ? "nc" : "c", file); - return; - - default: - abort (); - } - if (ieee) - { - switch (code) - { - case LE: - suffix = reverse ? "ae" : "b"; - break; - case GT: - case LT: - case GE: - suffix = reverse ? "ne" : "e"; - break; - case EQ: - suffix = reverse ? "ne" : "e"; - break; - case NE: - suffix = reverse ? "e" : "ne"; - break; - default: - abort (); - } - fputs (suffix, file); - return; - } - if (flags & CC_TEST_AX) - abort(); - if ((flags & CC_NO_OVERFLOW) && (code == LE || code == GT)) - abort (); - if (reverse) - code = reverse_condition (code); - switch (code) - { - case EQ: - suffix = "e"; - break; - - case NE: - suffix = "ne"; - break; - - case GT: - suffix = flags & CC_IN_80387 ? "a" : "g"; - break; - - case GTU: - suffix = "a"; - break; - - case LT: - if (flags & CC_NO_OVERFLOW) - suffix = "s"; - else - suffix = flags & CC_IN_80387 ? "b" : "l"; - break; - - case LTU: - suffix = "b"; - break; - - case GE: - if (flags & CC_NO_OVERFLOW) - suffix = "ns"; - else - suffix = flags & CC_IN_80387 ? "ae" : "ge"; - break; - - case GEU: - suffix = "ae"; - break; - - case LE: - suffix = flags & CC_IN_80387 ? "be" : "le"; - break; - - case LEU: - suffix = "be"; - break; - - default: - abort (); - } - fputs (suffix, file); -} - -/* Append the correct conditional move suffix which corresponds to CODE. */ - -static void -put_condition_code (code, reverse_cc, mode, file) - enum rtx_code code; - int reverse_cc; - enum mode_class mode; - FILE * file; -{ - int ieee = (TARGET_IEEE_FP && (cc_prev_status.flags & CC_IN_80387) - && ! (cc_prev_status.flags & CC_FCOMI)); - if (reverse_cc && ! ieee) - code = reverse_condition (code); - - if (mode == MODE_INT) - switch (code) - { - case NE: - if (cc_prev_status.flags & CC_Z_IN_NOT_C) - fputs ("b", file); - else - fputs ("ne", file); - return; - - case EQ: - if (cc_prev_status.flags & CC_Z_IN_NOT_C) - fputs ("ae", file); - else - fputs ("e", file); - return; - - case GE: - if (cc_prev_status.flags & CC_NO_OVERFLOW) - fputs ("ns", file); - else - fputs ("ge", file); - return; - - case GT: - fputs ("g", file); - return; - - case LE: - fputs ("le", file); - return; - - case LT: - if (cc_prev_status.flags & CC_NO_OVERFLOW) - fputs ("s", file); - else - fputs ("l", file); - return; - - case GEU: - fputs ("ae", file); - return; - - case GTU: - fputs ("a", file); - return; - - case LEU: - fputs ("be", file); - return; - - case LTU: - fputs ("b", file); - return; - - default: - output_operand_lossage ("Invalid %%C operand"); - } - - else if (mode == MODE_FLOAT) - switch (code) - { - case NE: - fputs (ieee ? (reverse_cc ? "ne" : "e") : "ne", file); - return; - case EQ: - fputs (ieee ? (reverse_cc ? "ne" : "e") : "e", file); - return; - case GE: - fputs (ieee ? (reverse_cc ? "ne" : "e") : "nb", file); - return; - case GT: - fputs (ieee ? (reverse_cc ? "ne" : "e") : "nbe", file); - return; - case LE: - fputs (ieee ? (reverse_cc ? "nb" : "b") : "be", file); - return; - case LT: - fputs (ieee ? (reverse_cc ? "ne" : "e") : "b", file); - return; - case GEU: - fputs (ieee ? (reverse_cc ? "ne" : "e") : "nb", file); - return; - case GTU: - fputs (ieee ? (reverse_cc ? "ne" : "e") : "nbe", file); - return; - case LEU: - fputs (ieee ? (reverse_cc ? "nb" : "b") : "be", file); - return; - case LTU: - fputs (ieee ? (reverse_cc ? "ne" : "e") : "b", file); - return; - default: - output_operand_lossage ("Invalid %%C operand"); - } -} - -/* Meaning of CODE: - L,W,B,Q,S,T -- print the opcode suffix for specified size of operand. - C -- print opcode suffix for set/cmov insn. - c -- like C, but print reversed condition - F -- print opcode suffix for fcmov insn. - f -- like F, but print reversed condition - D -- print the opcode suffix for a jump - d -- like D, but print reversed condition - R -- print the prefix for register names. - z -- print the opcode suffix for the size of the current operand. - * -- print a star (in certain assembler syntax) - w -- print the operand as if it's a "word" (HImode) even if it isn't. - J -- print the appropriate jump operand. - s -- print a shift double count, followed by the assemblers argument - delimiter. - b -- print the QImode name of the register for the indicated operand. - %b0 would print %al if operands[0] is reg 0. - w -- likewise, print the HImode name of the register. - k -- likewise, print the SImode name of the register. - h -- print the QImode name for a "high" register, either ah, bh, ch or dh. - y -- print "st(0)" instead of "st" as a register. - P -- print as a PIC constant - _ -- output "_" if YES_UNDERSCORES */ - -void -print_operand (file, x, code) - FILE *file; - rtx x; - int code; -{ - if (code) - { - switch (code) - { - case '*': - if (USE_STAR) - putc ('*', file); - return; - - case '_': -#ifdef YES_UNDERSCORES - putc ('_', file); -#endif - return; - - case 'L': - PUT_OP_SIZE (code, 'l', file); - return; - - case 'W': - PUT_OP_SIZE (code, 'w', file); - return; - - case 'B': - PUT_OP_SIZE (code, 'b', file); - return; - - case 'Q': - PUT_OP_SIZE (code, 'l', file); - return; - - case 'S': - PUT_OP_SIZE (code, 's', file); - return; - - case 'T': - PUT_OP_SIZE (code, 't', file); - return; - - case 'z': - /* 387 opcodes don't get size suffixes if the operands are - registers. */ - - if (STACK_REG_P (x)) - return; - - /* this is the size of op from size of operand */ - switch (GET_MODE_SIZE (GET_MODE (x))) - { - case 2: -#ifdef HAVE_GAS_FILDS_FISTS - PUT_OP_SIZE ('W', 's', file); -#endif - return; - - case 4: - if (GET_MODE (x) == SFmode) - { - PUT_OP_SIZE ('S', 's', file); - return; - } - else - PUT_OP_SIZE ('L', 'l', file); - return; - - case 12: - PUT_OP_SIZE ('T', 't', file); - return; - - case 8: - if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT) - { -#ifdef GAS_MNEMONICS - PUT_OP_SIZE ('Q', 'q', file); - return; -#else - PUT_OP_SIZE ('Q', 'l', file); /* Fall through */ -#endif - } - - PUT_OP_SIZE ('Q', 'l', file); - return; - - default: - abort (); - } - - case 'b': - case 'w': - case 'k': - case 'h': - case 'y': - case 'P': - case 'X': - break; - - case 'J': - switch (GET_CODE (x)) - { - /* These conditions are appropriate for testing the result - of an arithmetic operation, not for a compare operation. - Cases GE, LT assume CC_NO_OVERFLOW true. All cases assume - CC_Z_IN_NOT_C false and not floating point. */ - case NE: fputs ("jne", file); return; - case EQ: fputs ("je", file); return; - case GE: fputs ("jns", file); return; - case LT: fputs ("js", file); return; - case GEU: fputs ("jmp", file); return; - case GTU: fputs ("jne", file); return; - case LEU: fputs ("je", file); return; - case LTU: fputs ("#branch never", file); return; - - /* no matching branches for GT nor LE */ - - default: - abort (); - } - - case 's': - if (GET_CODE (x) == CONST_INT || ! SHIFT_DOUBLE_OMITS_COUNT) - { - PRINT_OPERAND (file, x, 0); - fputs (AS2C (,) + 1, file); - } - - return; - - case 'D': - put_jump_code (GET_CODE (x), 0, file); - return; - - case 'd': - put_jump_code (GET_CODE (x), 1, file); - return; - - /* This is used by the conditional move instructions. */ - case 'C': - put_condition_code (GET_CODE (x), 0, MODE_INT, file); - return; - - /* Like above, but reverse condition */ - case 'c': - put_condition_code (GET_CODE (x), 1, MODE_INT, file); return; - - case 'F': - put_condition_code (GET_CODE (x), 0, MODE_FLOAT, file); - return; - - /* Like above, but reverse condition */ - case 'f': - put_condition_code (GET_CODE (x), 1, MODE_FLOAT, file); - return; - - default: - { - char str[50]; - - sprintf (str, "invalid operand code `%c'", code); - output_operand_lossage (str); - } - } - } - - if (GET_CODE (x) == REG) - { - PRINT_REG (x, code, file); - } - - else if (GET_CODE (x) == MEM) - { - PRINT_PTR (x, file); - if (CONSTANT_ADDRESS_P (XEXP (x, 0))) - { - if (flag_pic) - output_pic_addr_const (file, XEXP (x, 0), code); - else - output_addr_const (file, XEXP (x, 0)); - } - else - output_address (XEXP (x, 0)); - } - - else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == SFmode) - { - REAL_VALUE_TYPE r; - long l; - - REAL_VALUE_FROM_CONST_DOUBLE (r, x); - REAL_VALUE_TO_TARGET_SINGLE (r, l); - PRINT_IMMED_PREFIX (file); - fprintf (file, "0x%lx", l); - } - - /* These float cases don't actually occur as immediate operands. */ - else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == DFmode) - { - REAL_VALUE_TYPE r; - char dstr[30]; - - REAL_VALUE_FROM_CONST_DOUBLE (r, x); - REAL_VALUE_TO_DECIMAL (r, "%.22e", dstr); - fprintf (file, "%s", dstr); - } - - else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == XFmode) - { - REAL_VALUE_TYPE r; - char dstr[30]; - - REAL_VALUE_FROM_CONST_DOUBLE (r, x); - REAL_VALUE_TO_DECIMAL (r, "%.22e", dstr); - fprintf (file, "%s", dstr); - } - else - { - if (code != 'P') - { - if (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE) - PRINT_IMMED_PREFIX (file); - else if (GET_CODE (x) == CONST || GET_CODE (x) == SYMBOL_REF - || GET_CODE (x) == LABEL_REF) - PRINT_OFFSET_PREFIX (file); - } - if (flag_pic) - output_pic_addr_const (file, x, code); - else - output_addr_const (file, x); - } -} - -/* Print a memory operand whose address is ADDR. */ - -void -print_operand_address (file, addr) - FILE *file; - register rtx addr; -{ - register rtx reg1, reg2, breg, ireg; - rtx offset; - - switch (GET_CODE (addr)) - { - case REG: - /* ESI addressing makes instruction vector decoded on the K6. We can - avoid this by ESI+0 addressing. */ - if (REGNO_REG_CLASS (REGNO (addr)) == SIREG - && ix86_cpu == PROCESSOR_K6 && !optimize_size) - output_addr_const (file, const0_rtx); - ADDR_BEG (file); - fprintf (file, "%se", RP); - fputs (hi_reg_name[REGNO (addr)], file); - ADDR_END (file); - break; - - case PLUS: - reg1 = 0; - reg2 = 0; - ireg = 0; - breg = 0; - offset = 0; - if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) - { - offset = XEXP (addr, 0); - addr = XEXP (addr, 1); - } - else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) - { - offset = XEXP (addr, 1); - addr = XEXP (addr, 0); - } - - if (GET_CODE (addr) != PLUS) - ; - else if (GET_CODE (XEXP (addr, 0)) == MULT) - reg1 = XEXP (addr, 0), addr = XEXP (addr, 1); - else if (GET_CODE (XEXP (addr, 1)) == MULT) - reg1 = XEXP (addr, 1), addr = XEXP (addr, 0); - else if (GET_CODE (XEXP (addr, 0)) == REG) - reg1 = XEXP (addr, 0), addr = XEXP (addr, 1); - else if (GET_CODE (XEXP (addr, 1)) == REG) - reg1 = XEXP (addr, 1), addr = XEXP (addr, 0); - - if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT) - { - if (reg1 == 0) - reg1 = addr; - else - reg2 = addr; - - addr = 0; - } - - if (offset != 0) - { - if (addr != 0) - abort (); - addr = offset; - } - - if ((reg1 && GET_CODE (reg1) == MULT) - || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) - { - breg = reg2; - ireg = reg1; - } - else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) - { - breg = reg1; - ireg = reg2; - } - - if (ireg != 0 || breg != 0) - { - int scale = 1; - - if (addr != 0) - { - if (flag_pic) - output_pic_addr_const (file, addr, 0); - else if (GET_CODE (addr) == LABEL_REF) - output_asm_label (addr); - else - output_addr_const (file, addr); - } - - if (ireg != 0 && GET_CODE (ireg) == MULT) - { - scale = INTVAL (XEXP (ireg, 1)); - ireg = XEXP (ireg, 0); - } - - /* The stack pointer can only appear as a base register, - never an index register, so exchange the regs if it is wrong. */ - - if (scale == 1 && ireg && REGNO (ireg) == STACK_POINTER_REGNUM) - { - rtx tmp; - - tmp = breg; - breg = ireg; - ireg = tmp; - } - - /* output breg+ireg*scale */ - PRINT_B_I_S (breg, ireg, scale, file); - break; - } - - case MULT: - { - int scale; - - if (GET_CODE (XEXP (addr, 0)) == CONST_INT) - { - scale = INTVAL (XEXP (addr, 0)); - ireg = XEXP (addr, 1); - } - else - { - scale = INTVAL (XEXP (addr, 1)); - ireg = XEXP (addr, 0); - } - - /* (reg,reg,) is shorter than (,reg,2). */ - if (scale == 2) - { - PRINT_B_I_S (ireg, ireg, 1, file); - } - else - { - output_addr_const (file, const0_rtx); - PRINT_B_I_S (NULL_RTX, ireg, scale, file); - } - } - break; - - default: - if (GET_CODE (addr) == CONST_INT - && INTVAL (addr) < 0x8000 - && INTVAL (addr) >= -0x8000) - fprintf (file, "%d", (int) INTVAL (addr)); - else - { - if (flag_pic) - output_pic_addr_const (file, addr, 0); - else - output_addr_const (file, addr); - } - } -} - -/* Set the cc_status for the results of an insn whose pattern is EXP. - On the 80386, we assume that only test and compare insns, as well - as SI, HI, & DI mode ADD, SUB, NEG, AND, IOR, XOR, BSF, ASHIFT, - ASHIFTRT, and LSHIFTRT instructions set the condition codes usefully. - Also, we assume that jumps, moves and sCOND don't affect the condition - codes. All else clobbers the condition codes, by assumption. - - We assume that ALL integer add, minus, etc. instructions effect the - condition codes. This MUST be consistent with i386.md. - - We don't record any float test or compare - the redundant test & - compare check in final.c does not handle stack-like regs correctly. */ - -void -notice_update_cc (exp) - rtx exp; -{ - if (GET_CODE (exp) == SET) - { - /* Jumps do not alter the cc's. */ - if (SET_DEST (exp) == pc_rtx) - return; - - /* Moving register or memory into a register: - it doesn't alter the cc's, but it might invalidate - the RTX's which we remember the cc's came from. - (Note that moving a constant 0 or 1 MAY set the cc's). */ - if (REG_P (SET_DEST (exp)) - && (REG_P (SET_SRC (exp)) || GET_CODE (SET_SRC (exp)) == MEM - || GET_RTX_CLASS (GET_CODE (SET_SRC (exp))) == '<' - || GET_CODE (SET_SRC (exp)) == IF_THEN_ELSE)) - { - if (cc_status.value1 - && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value1)) - cc_status.value1 = 0; - - if (cc_status.value2 - && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2)) - cc_status.value2 = 0; - - return; - } - - /* Moving register into memory doesn't alter the cc's. - It may invalidate the RTX's which we remember the cc's came from. */ - if (GET_CODE (SET_DEST (exp)) == MEM - && (REG_P (SET_SRC (exp)) - || GET_RTX_CLASS (GET_CODE (SET_SRC (exp))) == '<')) - { - if (cc_status.value1 - && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value1)) - cc_status.value1 = 0; - if (cc_status.value2 - && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2)) - cc_status.value2 = 0; - - return; - } - - /* Function calls clobber the cc's. */ - else if (GET_CODE (SET_SRC (exp)) == CALL) - { - CC_STATUS_INIT; - return; - } - - /* Tests and compares set the cc's in predictable ways. */ - else if (SET_DEST (exp) == cc0_rtx) - { - CC_STATUS_INIT; - cc_status.value1 = SET_SRC (exp); - return; - } - - /* Certain instructions effect the condition codes. */ - else if (GET_MODE (SET_SRC (exp)) == SImode - || GET_MODE (SET_SRC (exp)) == HImode - || GET_MODE (SET_SRC (exp)) == QImode) - switch (GET_CODE (SET_SRC (exp))) - { - case ASHIFTRT: case LSHIFTRT: case ASHIFT: - /* Shifts on the 386 don't set the condition codes if the - shift count is zero. */ - if (GET_CODE (XEXP (SET_SRC (exp), 1)) != CONST_INT) - { - CC_STATUS_INIT; - break; - } - - /* We assume that the CONST_INT is non-zero (this rtx would - have been deleted if it were zero. */ - - case PLUS: case MINUS: case NEG: - case AND: case IOR: case XOR: - cc_status.flags = CC_NO_OVERFLOW; - cc_status.value1 = SET_SRC (exp); - cc_status.value2 = SET_DEST (exp); - break; - - /* This is the bsf pattern used by ffs. */ - case UNSPEC: - if (XINT (SET_SRC (exp), 1) == 5) - { - /* Only the Z flag is defined after bsf. */ - cc_status.flags - = CC_NOT_POSITIVE | CC_NOT_NEGATIVE | CC_NO_OVERFLOW; - cc_status.value1 = XVECEXP (SET_SRC (exp), 0, 0); - cc_status.value2 = 0; - break; - } - /* FALLTHRU */ - - default: - CC_STATUS_INIT; - } - else - { - CC_STATUS_INIT; - } - } - else if (GET_CODE (exp) == PARALLEL - && GET_CODE (XVECEXP (exp, 0, 0)) == SET) - { - if (SET_DEST (XVECEXP (exp, 0, 0)) == pc_rtx) - return; - if (SET_DEST (XVECEXP (exp, 0, 0)) == cc0_rtx) - - { - CC_STATUS_INIT; - if (stack_regs_mentioned_p (SET_SRC (XVECEXP (exp, 0, 0)))) - { - cc_status.flags |= CC_IN_80387; - if (TARGET_CMOVE && stack_regs_mentioned_p - (XEXP (SET_SRC (XVECEXP (exp, 0, 0)), 1))) - cc_status.flags |= CC_FCOMI; - } - else - cc_status.value1 = SET_SRC (XVECEXP (exp, 0, 0)); - return; - } - - CC_STATUS_INIT; - } - else - { - CC_STATUS_INIT; - } -} - -/* Split one or more DImode RTL references into pairs of SImode - references. The RTL can be REG, offsettable MEM, integer constant, or - CONST_DOUBLE. "operands" is a pointer to an array of DImode RTL to - split and "num" is its length. lo_half and hi_half are output arrays - that parallel "operands". */ - -void -split_di (operands, num, lo_half, hi_half) - rtx operands[]; - int num; - rtx lo_half[], hi_half[]; -{ - while (num--) - { - rtx op = operands[num]; - if (! reload_completed) - { - lo_half[num] = gen_lowpart (SImode, op); - hi_half[num] = gen_highpart (SImode, op); - } - else if (GET_CODE (op) == REG) - { - lo_half[num] = gen_rtx_REG (SImode, REGNO (op)); - hi_half[num] = gen_rtx_REG (SImode, REGNO (op) + 1); - } - else if (CONSTANT_P (op)) - split_double (op, &lo_half[num], &hi_half[num]); - else if (offsettable_memref_p (op)) - { - rtx lo_addr = XEXP (op, 0); - rtx hi_addr = XEXP (adj_offsettable_operand (op, 4), 0); - lo_half[num] = change_address (op, SImode, lo_addr); - hi_half[num] = change_address (op, SImode, hi_addr); - } - else - abort(); - } -} - -/* Return 1 if this is a valid binary operation on a 387. - OP is the expression matched, and MODE is its mode. */ - -int -binary_387_op (op, mode) - register rtx op; - enum machine_mode mode; -{ - if (mode != VOIDmode && mode != GET_MODE (op)) - return 0; - - switch (GET_CODE (op)) - { - case PLUS: - case MINUS: - case MULT: - case DIV: - return GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT; - - default: - return 0; - } -} - -/* Return 1 if this is a valid shift or rotate operation on a 386. - OP is the expression matched, and MODE is its mode. */ - -int -shift_op (op, mode) - register rtx op; - enum machine_mode mode; -{ - rtx operand = XEXP (op, 0); - - if (mode != VOIDmode && mode != GET_MODE (op)) - return 0; - - if (GET_MODE (operand) != GET_MODE (op) - || GET_MODE_CLASS (GET_MODE (op)) != MODE_INT) - return 0; - - return (GET_CODE (op) == ASHIFT - || GET_CODE (op) == ASHIFTRT - || GET_CODE (op) == LSHIFTRT - || GET_CODE (op) == ROTATE - || GET_CODE (op) == ROTATERT); -} - -/* Return 1 if OP is COMPARE rtx with mode VOIDmode. - MODE is not used. */ - -int -VOIDmode_compare_op (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return GET_CODE (op) == COMPARE && GET_MODE (op) == VOIDmode; -} - -/* Output code to perform a 387 binary operation in INSN, one of PLUS, - MINUS, MULT or DIV. OPERANDS are the insn operands, where operands[3] - is the expression of the binary operation. The output may either be - emitted here, or returned to the caller, like all output_* functions. - - There is no guarantee that the operands are the same mode, as they - might be within FLOAT or FLOAT_EXTEND expressions. */ - -char * -output_387_binary_op (insn, operands) - rtx insn; - rtx *operands; -{ - rtx temp; - char *base_op; - static char buf[100]; - - switch (GET_CODE (operands[3])) - { - case PLUS: - base_op = "fadd"; - break; - - case MINUS: - base_op = "fsub"; - break; - - case MULT: - base_op = "fmul"; - break; - - case DIV: - base_op = "fdiv"; - break; - - default: - abort (); - } - - strcpy (buf, base_op); - - switch (GET_CODE (operands[3])) - { - case MULT: - case PLUS: - if (REG_P (operands[2]) && REGNO (operands[0]) == REGNO (operands[2])) - { - temp = operands[2]; - operands[2] = operands[1]; - operands[1] = temp; - } - - if (GET_CODE (operands[2]) == MEM) - return strcat (buf, AS1 (%z2,%2)); - - if (! STACK_REG_P (operands[1]) || ! STACK_REG_P (operands[2])) - abort (); - - if (find_regno_note (insn, REG_DEAD, REGNO (operands[2]))) - { - if (STACK_TOP_P (operands[0])) - return strcat (buf, AS2 (p,%0,%2)); - else - return strcat (buf, AS2 (p,%2,%0)); - } - - if (STACK_TOP_P (operands[0])) - return strcat (buf, AS2C (%y2,%0)); - else - return strcat (buf, AS2C (%2,%0)); - - case MINUS: - case DIV: - if (GET_CODE (operands[1]) == MEM) - return strcat (buf, AS1 (r%z1,%1)); - - if (GET_CODE (operands[2]) == MEM) - return strcat (buf, AS1 (%z2,%2)); - - if (! STACK_REG_P (operands[1]) || ! STACK_REG_P (operands[2])) - abort (); - - if (find_regno_note (insn, REG_DEAD, REGNO (operands[2]))) - { - if (STACK_TOP_P (operands[0])) - return strcat (buf, AS2 (p,%0,%2)); - else - return strcat (buf, AS2 (rp,%2,%0)); - } - - if (find_regno_note (insn, REG_DEAD, REGNO (operands[1]))) - { - if (STACK_TOP_P (operands[0])) - return strcat (buf, AS2 (rp,%0,%1)); - else - return strcat (buf, AS2 (p,%1,%0)); - } - - if (STACK_TOP_P (operands[0])) - { - if (STACK_TOP_P (operands[1])) - return strcat (buf, AS2C (%y2,%0)); - else - return strcat (buf, AS2 (r,%y1,%0)); - } - else if (STACK_TOP_P (operands[1])) - return strcat (buf, AS2C (%1,%0)); - else - return strcat (buf, AS2 (r,%2,%0)); - - default: - abort (); - } -} - -/* Output code for INSN to convert a float to a signed int. OPERANDS - are the insn operands. The input may be SFmode, DFmode, or XFmode - and the output operand may be SImode or DImode. As a special case, - make sure that the 387 stack top dies if the output mode is DImode, - because the hardware requires this. */ - -char * -output_fix_trunc (insn, operands) - rtx insn; - rtx *operands; -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - rtx xops[2]; - - if (! STACK_TOP_P (operands[1])) - abort (); - - if (GET_MODE (operands[0]) == DImode && ! stack_top_dies) - abort (); - - xops[0] = GEN_INT (0x0c00); - xops[1] = operands[5]; - - output_asm_insn (AS1 (fnstc%W2,%2), operands); - output_asm_insn (AS2 (mov%W5,%2,%w5), operands); - output_asm_insn (AS2 (or%W1,%0,%w1), xops); - output_asm_insn (AS2 (mov%W3,%w5,%3), operands); - output_asm_insn (AS1 (fldc%W3,%3), operands); - - xops[0] = NON_STACK_REG_P (operands[0]) ? operands[4] : operands[0]; - - if (stack_top_dies) - output_asm_insn (AS1 (fistp%z0,%y0), xops); - else - output_asm_insn (AS1 (fist%z0,%y0), xops); - - if (NON_STACK_REG_P (operands[0])) - { - if (GET_MODE (operands[0]) == SImode) - output_asm_insn (AS2 (mov%L0,%4,%0), operands); - else - { - xops[0] = operands[0]; - xops[1] = operands[4]; - output_asm_insn (output_move_double (xops), xops); - } - } - - return AS1 (fldc%W2,%2); -} - -/* Output code for INSN to extend a float. OPERANDS are the insn - operands. The output may be DFmode or XFmode and the input operand - may be SFmode or DFmode. Operands 2 and 3 are scratch memory and - are only necessary if operands 0 or 1 are non-stack registers. */ - -void -output_float_extend (insn, operands) - rtx insn; - rtx *operands; -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - rtx xops[2]; - - if (! STACK_TOP_P (operands[0]) && ! STACK_TOP_P (operands[1])) - abort (); - - if (STACK_TOP_P (operands[0]) && STACK_TOP_P (operands[1]) && stack_top_dies) - return; - - if (STACK_TOP_P (operands[0]) ) - { - if (NON_STACK_REG_P (operands[1])) - { - if (GET_MODE (operands[1]) == SFmode) - output_asm_insn (AS2 (mov%L0,%1,%2), operands); - else - { - xops[0] = operands[2]; - xops[1] = operands[1]; - output_asm_insn (output_move_double (xops), xops); - } - } - - xops[0] = NON_STACK_REG_P (operands[1]) ? operands[2] : operands[1]; - - output_asm_insn (AS1 (fld%z0,%y0), xops); - } - else - { - xops[0] = NON_STACK_REG_P (operands[0]) ? operands[3] : operands[0]; - - if (stack_top_dies - || (GET_CODE (xops[0]) == MEM && GET_MODE (xops[0]) == XFmode)) - { - output_asm_insn (AS1 (fstp%z0,%y0), xops); - if (! stack_top_dies) - output_asm_insn (AS1 (fld%z0,%y0), xops); - } - else - output_asm_insn (AS1 (fst%z0,%y0), xops); - - if (NON_STACK_REG_P (operands[0])) - { - xops[0] = operands[0]; - xops[1] = operands[3]; - output_asm_insn (output_move_double (xops), xops); - } - } -} - -/* Output code for INSN to compare OPERANDS. The two operands might - not have the same mode: one might be within a FLOAT or FLOAT_EXTEND - expression. If the compare is in mode CCFPEQmode, use an opcode that - will not fault if a qNaN is present. */ - -char * -output_float_compare (insn, operands) - rtx insn; - rtx *operands; -{ - int stack_top_dies; - rtx body = XVECEXP (PATTERN (insn), 0, 0); - int unordered_compare = GET_MODE (SET_SRC (body)) == CCFPEQmode; - rtx tmp; - int cc0_set = 1; - int i; - - if (TARGET_CMOVE && STACK_REG_P (operands[1]) - && STACK_REG_P (operands[0])) - { - cc_status.flags |= CC_FCOMI; - cc_prev_status.flags &= ~CC_TEST_AX; - } - - if (! STACK_TOP_P (operands[0])) - { - tmp = operands[0]; - operands[0] = operands[1]; - operands[1] = tmp; - cc_status.flags |= CC_REVERSED; - } - - if (! STACK_TOP_P (operands[0])) - abort (); - - stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - - if (STACK_REG_P (operands[1]) - && stack_top_dies - && find_regno_note (insn, REG_DEAD, REGNO (operands[1])) - && REGNO (operands[1]) == FIRST_STACK_REG + 1) - { - /* If both the top of the 387 stack dies, and the other operand - is also a stack register that dies, then this must be a - `fcompp' float compare */ - - if (unordered_compare) - { - if (cc_status.flags & CC_FCOMI) - { - output_asm_insn (AS2 (fucomip,%y1,%0), operands); - output_asm_insn (AS1 (fstp, %y0), operands); - if (!TARGET_IEEE_FP) - cc0_set = 0; - } - else - output_asm_insn ("fucompp", operands); - } - else - { - if (cc_status.flags & CC_FCOMI) - { - output_asm_insn (AS2 (fcomip, %y1,%0), operands); - output_asm_insn (AS1 (fstp, %y0), operands); - if (!TARGET_IEEE_FP) - cc0_set = 0; - } - else - output_asm_insn ("fcompp", operands); - } - } - else - { - static char buf[100]; - - /* Decide if this is a float compare or an unordered float compare. */ - - if (unordered_compare) - strcpy (buf, (cc_status.flags & CC_FCOMI) ? "fucomi" : "fucom"); - else - strcpy (buf, (cc_status.flags & CC_FCOMI) ? "fcomi" : "fcom"); - - /* Modify the opcode if the 387 stack is to be popped. */ - - if (stack_top_dies) - strcat (buf, "p"); - - if (cc_status.flags & CC_FCOMI) - { - output_asm_insn (strcat (buf, AS2 (%z1,%y1,%0)), operands); - if (!TARGET_IEEE_FP) - cc0_set = 0; - } - else - output_asm_insn (strcat (buf, AS1 (%z1,%y1)), operands); - } - - /* Now retrieve the condition code. */ - if (cc0_set) - { - char *r = output_fp_cc0_set (insn); - if (r[0]) output_asm_insn (r, operands); - } - - - /* We emit fstp instruction after integer comparsions to improve - scheduling. */ - for (i = 0; i < 2 ; i++) - { - if (STACK_REG_P (operands[i]) - && find_regno_note (insn, REG_DEAD, REGNO (operands[i])) - && REGNO (operands[i]) != FIRST_STACK_REG - && (!stack_top_dies || REGNO (operands[i]) != FIRST_STACK_REG + 1)) - { - rtx xexp[2]; - xexp[0] = gen_rtx_REG (DFmode, - REGNO (operands[i]) - (stack_top_dies != 0)); - output_asm_insn (AS1 (fstp, %y0), xexp); - } - } - - return ""; - - -} - -/* Output opcodes to transfer the results of FP compare or test INSN - from the FPU to the CPU flags. If TARGET_IEEE_FP, ensure that if the - result of the compare or test is unordered, no comparison operator - succeeds except NE. Return an output template, if any. */ - -char * -output_fp_cc0_set (insn) - rtx insn; -{ - rtx xops[3]; - rtx next; - enum rtx_code code; - - if (!(cc_status.flags & CC_FCOMI)) - { - xops[0] = gen_rtx_REG (HImode, 0); - output_asm_insn (AS1 (fnsts%W0,%0), xops); - } - - if (! TARGET_IEEE_FP) - { - if (!(cc_status.flags & CC_REVERSED)) - { - next = next_cc0_user (insn); - - if (GET_CODE (PATTERN (next)) == SET - && SET_DEST (PATTERN (next)) == pc_rtx - && GET_CODE (SET_SRC (PATTERN (next))) == IF_THEN_ELSE) - code = GET_CODE (XEXP (SET_SRC (PATTERN (next)), 0)); - else if (GET_CODE (PATTERN (next)) == SET) - code = GET_CODE (SET_SRC (PATTERN (next))); - else - return "sahf"; - - if (code == GT || code == LT || code == EQ || code == NE - || code == LE || code == GE) - { - /* We will test eax directly. */ - cc_status.flags |= CC_TEST_AX; - return ""; - } - } - - return "sahf"; - } - - next = next_cc0_user (insn); - if (next == NULL_RTX) - abort (); - - if (GET_CODE (PATTERN (next)) == SET - && SET_DEST (PATTERN (next)) == pc_rtx - && GET_CODE (SET_SRC (PATTERN (next))) == IF_THEN_ELSE) - code = GET_CODE (XEXP (SET_SRC (PATTERN (next)), 0)); - else if (GET_CODE (PATTERN (next)) == SET) - { - if (GET_CODE (SET_SRC (PATTERN (next))) == IF_THEN_ELSE) - code = GET_CODE (XEXP (SET_SRC (PATTERN (next)), 0)); - else - code = GET_CODE (SET_SRC (PATTERN (next))); - } - - else if (GET_CODE (PATTERN (next)) == PARALLEL - && GET_CODE (XVECEXP (PATTERN (next), 0, 0)) == SET) - { - if (GET_CODE (SET_SRC (XVECEXP (PATTERN (next), 0, 0))) == IF_THEN_ELSE) - code = GET_CODE (XEXP (SET_SRC (XVECEXP (PATTERN (next), 0, 0)), 0)); - else - code = GET_CODE (SET_SRC (XVECEXP (PATTERN (next), 0, 0))); - } - else - abort (); - - if (cc_status.flags & CC_FCOMI) - { - /* It is very tricky. We have to do it right. */ - - xops [0] = gen_rtx_REG (QImode, 0); - - switch (code) - { - case GT: - case GE: - break; - - case LT: - output_asm_insn (AS1 (setb,%b0), xops); - output_asm_insn (AS1 (setp,%h0), xops); - output_asm_insn (AS2 (cmp%B0,%b0,%h0), xops); - break; - - case LE: - output_asm_insn (AS1 (setbe,%b0), xops); - output_asm_insn (AS1 (setnp,%h0), xops); - output_asm_insn (AS2 (xor%B0,%b0,%h0), xops); - break; - - case EQ: - case NE: - output_asm_insn (AS1 (setne,%b0), xops); - output_asm_insn (AS1 (setp,%h0), xops); - output_asm_insn (AS2 (or%B0,%b0,%h0), xops); - break; - - case GTU: - case LTU: - case GEU: - case LEU: - default: - abort (); - } - } - else - { - xops[0] = gen_rtx_REG (QImode, 0); - - switch (code) - { - case GT: - xops[1] = GEN_INT (0x45); - output_asm_insn (AS2 (and%B0,%1,%h0), xops); - /* je label */ - break; - - case LT: - xops[1] = GEN_INT (0x45); - xops[2] = GEN_INT (0x01); - output_asm_insn (AS2 (and%B0,%1,%h0), xops); - output_asm_insn (AS2 (cmp%B0,%2,%h0), xops); - /* je label */ - break; - - case GE: - xops[1] = GEN_INT (0x05); - output_asm_insn (AS2 (and%B0,%1,%h0), xops); - /* je label */ - break; - - case LE: - xops[1] = GEN_INT (0x45); - xops[2] = GEN_INT (0x40); - output_asm_insn (AS2 (and%B0,%1,%h0), xops); - output_asm_insn (AS1 (dec%B0,%h0), xops); - output_asm_insn (AS2 (cmp%B0,%2,%h0), xops); - /* jb label */ - break; - - case EQ: - xops[1] = GEN_INT (0x45); - xops[2] = GEN_INT (0x40); - output_asm_insn (AS2 (and%B0,%1,%h0), xops); - output_asm_insn (AS2 (cmp%B0,%2,%h0), xops); - /* je label */ - break; - - case NE: - xops[1] = GEN_INT (0x44); - xops[2] = GEN_INT (0x40); - output_asm_insn (AS2 (and%B0,%1,%h0), xops); - output_asm_insn (AS2 (xor%B0,%2,%h0), xops); - /* jne label */ - break; - - case GTU: - case LTU: - case GEU: - case LEU: - default: - abort (); - } - } - - return ""; -} - -#define MAX_386_STACK_LOCALS 2 - -static rtx i386_stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS]; - -/* Define the structure for the machine field in struct function. */ -struct machine_function -{ - rtx i386_stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS]; - rtx pic_label_rtx; - char pic_label_name[256]; -}; - -/* Functions to save and restore i386_stack_locals. - These will be called, via pointer variables, - from push_function_context and pop_function_context. */ - -void -save_386_machine_status (p) - struct function *p; -{ - p->machine - = (struct machine_function *) xmalloc (sizeof (struct machine_function)); - bcopy ((char *) i386_stack_locals, (char *) p->machine->i386_stack_locals, - sizeof i386_stack_locals); - p->machine->pic_label_rtx = pic_label_rtx; - bcopy (pic_label_name, p->machine->pic_label_name, 256); -} - -void -restore_386_machine_status (p) - struct function *p; -{ - bcopy ((char *) p->machine->i386_stack_locals, (char *) i386_stack_locals, - sizeof i386_stack_locals); - pic_label_rtx = p->machine->pic_label_rtx; - bcopy (p->machine->pic_label_name, pic_label_name, 256); - free (p->machine); - p->machine = NULL; -} - -/* Clear stack slot assignments remembered from previous functions. - This is called from INIT_EXPANDERS once before RTL is emitted for each - function. */ - -void -clear_386_stack_locals () -{ - enum machine_mode mode; - int n; - - for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE; - mode = (enum machine_mode) ((int) mode + 1)) - for (n = 0; n < MAX_386_STACK_LOCALS; n++) - i386_stack_locals[(int) mode][n] = NULL_RTX; - - pic_label_rtx = NULL_RTX; - bzero (pic_label_name, 256); - /* Arrange to save and restore i386_stack_locals around nested functions. */ - save_machine_status = save_386_machine_status; - restore_machine_status = restore_386_machine_status; -} - -/* Return a MEM corresponding to a stack slot with mode MODE. - Allocate a new slot if necessary. - - The RTL for a function can have several slots available: N is - which slot to use. */ - -rtx -assign_386_stack_local (mode, n) - enum machine_mode mode; - int n; -{ - if (n < 0 || n >= MAX_386_STACK_LOCALS) - abort (); - - if (i386_stack_locals[(int) mode][n] == NULL_RTX) - i386_stack_locals[(int) mode][n] - = assign_stack_local (mode, GET_MODE_SIZE (mode), 0); - - return i386_stack_locals[(int) mode][n]; -} - -int is_mul(op,mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == MULT); -} - -int is_div(op,mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == DIV); -} - -#ifdef NOTYET -/* Create a new copy of an rtx. - Recursively copies the operands of the rtx, - except for those few rtx codes that are sharable. - Doesn't share CONST */ - -rtx -copy_all_rtx (orig) - register rtx orig; -{ - register rtx copy; - register int i, j; - register RTX_CODE code; - register char *format_ptr; - - code = GET_CODE (orig); - - switch (code) - { - case REG: - case QUEUED: - case CONST_INT: - case CONST_DOUBLE: - case SYMBOL_REF: - case CODE_LABEL: - case PC: - case CC0: - case SCRATCH: - /* SCRATCH must be shared because they represent distinct values. */ - return orig; - -#if 0 - case CONST: - /* CONST can be shared if it contains a SYMBOL_REF. If it contains - a LABEL_REF, it isn't sharable. */ - if (GET_CODE (XEXP (orig, 0)) == PLUS - && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF - && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT) - return orig; - break; -#endif - /* A MEM with a constant address is not sharable. The problem is that - the constant address may need to be reloaded. If the mem is shared, - then reloading one copy of this mem will cause all copies to appear - to have been reloaded. */ - } - - copy = rtx_alloc (code); - PUT_MODE (copy, GET_MODE (orig)); - copy->in_struct = orig->in_struct; - copy->volatil = orig->volatil; - copy->unchanging = orig->unchanging; - copy->integrated = orig->integrated; - /* intel1 */ - copy->is_spill_rtx = orig->is_spill_rtx; - - format_ptr = GET_RTX_FORMAT (GET_CODE (copy)); - - for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++) - { - switch (*format_ptr++) - { - case 'e': - XEXP (copy, i) = XEXP (orig, i); - if (XEXP (orig, i) != NULL) - XEXP (copy, i) = copy_rtx (XEXP (orig, i)); - break; - - case '0': - case 'u': - XEXP (copy, i) = XEXP (orig, i); - break; - - case 'E': - case 'V': - XVEC (copy, i) = XVEC (orig, i); - if (XVEC (orig, i) != NULL) - { - XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i)); - for (j = 0; j < XVECLEN (copy, i); j++) - XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j)); - } - break; - - case 'w': - XWINT (copy, i) = XWINT (orig, i); - break; - - case 'i': - XINT (copy, i) = XINT (orig, i); - break; - - case 's': - case 'S': - XSTR (copy, i) = XSTR (orig, i); - break; - - default: - abort (); - } - } - return copy; -} - - -/* Try to rewrite a memory address to make it valid */ - -void -rewrite_address (mem_rtx) - rtx mem_rtx; -{ - rtx index_rtx, base_rtx, offset_rtx, scale_rtx, ret_rtx; - int scale = 1; - int offset_adjust = 0; - int was_only_offset = 0; - rtx mem_addr = XEXP (mem_rtx, 0); - char *storage = oballoc (0); - int in_struct = 0; - int is_spill_rtx = 0; - - in_struct = MEM_IN_STRUCT_P (mem_rtx); - is_spill_rtx = RTX_IS_SPILL_P (mem_rtx); - - if (GET_CODE (mem_addr) == PLUS - && GET_CODE (XEXP (mem_addr, 1)) == PLUS - && GET_CODE (XEXP (XEXP (mem_addr, 1), 0)) == REG) - { - /* This part is utilized by the combiner. */ - ret_rtx - = gen_rtx (PLUS, GET_MODE (mem_addr), - gen_rtx (PLUS, GET_MODE (XEXP (mem_addr, 1)), - XEXP (mem_addr, 0), XEXP (XEXP (mem_addr, 1), 0)), - XEXP (XEXP (mem_addr, 1), 1)); - - if (memory_address_p (GET_MODE (mem_rtx), ret_rtx)) - { - XEXP (mem_rtx, 0) = ret_rtx; - RTX_IS_SPILL_P (ret_rtx) = is_spill_rtx; - return; - } - - obfree (storage); - } - - /* This part is utilized by loop.c. - If the address contains PLUS (reg,const) and this pattern is invalid - in this case - try to rewrite the address to make it valid. */ - storage = oballoc (0); - index_rtx = base_rtx = offset_rtx = NULL; - - /* Find the base index and offset elements of the memory address. */ - if (GET_CODE (mem_addr) == PLUS) - { - if (GET_CODE (XEXP (mem_addr, 0)) == REG) - { - if (GET_CODE (XEXP (mem_addr, 1)) == REG) - base_rtx = XEXP (mem_addr, 1), index_rtx = XEXP (mem_addr, 0); - else - base_rtx = XEXP (mem_addr, 0), offset_rtx = XEXP (mem_addr, 1); - } - - else if (GET_CODE (XEXP (mem_addr, 0)) == MULT) - { - index_rtx = XEXP (mem_addr, 0); - if (GET_CODE (XEXP (mem_addr, 1)) == REG) - base_rtx = XEXP (mem_addr, 1); - else - offset_rtx = XEXP (mem_addr, 1); - } - - else if (GET_CODE (XEXP (mem_addr, 0)) == PLUS) - { - if (GET_CODE (XEXP (XEXP (mem_addr, 0), 0)) == PLUS - && GET_CODE (XEXP (XEXP (XEXP (mem_addr, 0), 0), 0)) == MULT - && (GET_CODE (XEXP (XEXP (XEXP (XEXP (mem_addr, 0), 0), 0), 0)) - == REG) - && (GET_CODE (XEXP (XEXP (XEXP (XEXP (mem_addr, 0), 0), 0), 1)) - == CONST_INT) - && (GET_CODE (XEXP (XEXP (XEXP (mem_addr, 0), 0), 1)) - == CONST_INT) - && GET_CODE (XEXP (XEXP (mem_addr, 0), 1)) == REG - && GET_CODE (XEXP (mem_addr, 1)) == SYMBOL_REF) - { - index_rtx = XEXP (XEXP (XEXP (mem_addr, 0), 0), 0); - offset_rtx = XEXP (mem_addr, 1); - base_rtx = XEXP (XEXP (mem_addr, 0), 1); - offset_adjust = INTVAL (XEXP (XEXP (XEXP (mem_addr, 0), 0), 1)); - } - else - { - offset_rtx = XEXP (mem_addr, 1); - index_rtx = XEXP (XEXP (mem_addr, 0), 0); - base_rtx = XEXP (XEXP (mem_addr, 0), 1); - } - } - - else if (GET_CODE (XEXP (mem_addr, 0)) == CONST_INT) - { - was_only_offset = 1; - index_rtx = NULL; - base_rtx = NULL; - offset_rtx = XEXP (mem_addr, 1); - offset_adjust = INTVAL (XEXP (mem_addr, 0)); - if (offset_adjust == 0) - { - XEXP (mem_rtx, 0) = offset_rtx; - RTX_IS_SPILL_P (XEXP (mem_rtx, 0)) = is_spill_rtx; - return; - } - } - else - { - obfree (storage); - return; - } - } - else if (GET_CODE (mem_addr) == MULT) - index_rtx = mem_addr; - else - { - obfree (storage); - return; - } - - if (index_rtx != 0 && GET_CODE (index_rtx) == MULT) - { - if (GET_CODE (XEXP (index_rtx, 1)) != CONST_INT) - { - obfree (storage); - return; - } - - scale_rtx = XEXP (index_rtx, 1); - scale = INTVAL (scale_rtx); - index_rtx = copy_all_rtx (XEXP (index_rtx, 0)); - } - - /* Now find which of the elements are invalid and try to fix them. */ - if (index_rtx && GET_CODE (index_rtx) == CONST_INT && base_rtx == NULL) - { - offset_adjust = INTVAL (index_rtx) * scale; - - if (offset_rtx != 0 && CONSTANT_P (offset_rtx)) - offset_rtx = plus_constant (offset_rtx, offset_adjust); - else if (offset_rtx == 0) - offset_rtx = const0_rtx; - - RTX_IS_SPILL_P (XEXP (mem_rtx, 0)) = is_spill_rtx; - XEXP (mem_rtx, 0) = offset_rtx; - return; - } - - if (base_rtx && GET_CODE (base_rtx) == PLUS - && GET_CODE (XEXP (base_rtx, 0)) == REG - && GET_CODE (XEXP (base_rtx, 1)) == CONST_INT) - { - offset_adjust += INTVAL (XEXP (base_rtx, 1)); - base_rtx = copy_all_rtx (XEXP (base_rtx, 0)); - } - - else if (base_rtx && GET_CODE (base_rtx) == CONST_INT) - { - offset_adjust += INTVAL (base_rtx); - base_rtx = NULL; - } - - if (index_rtx && GET_CODE (index_rtx) == PLUS - && GET_CODE (XEXP (index_rtx, 0)) == REG - && GET_CODE (XEXP (index_rtx, 1)) == CONST_INT) - { - offset_adjust += INTVAL (XEXP (index_rtx, 1)) * scale; - index_rtx = copy_all_rtx (XEXP (index_rtx, 0)); - } - - if (index_rtx) - { - if (! LEGITIMATE_INDEX_P (index_rtx) - && ! (index_rtx == stack_pointer_rtx && scale == 1 - && base_rtx == NULL)) - { - obfree (storage); - return; - } - } - - if (base_rtx) - { - if (! LEGITIMATE_INDEX_P (base_rtx) && GET_CODE (base_rtx) != REG) - { - obfree (storage); - return; - } - } - - if (offset_adjust != 0) - { - if (offset_rtx != 0 && CONSTANT_P (offset_rtx)) - offset_rtx = plus_constant (offset_rtx, offset_adjust); - else - offset_rtx = const0_rtx; - - if (index_rtx) - { - if (base_rtx) - { - if (scale != 1) - { - ret_rtx = gen_rtx (PLUS, GET_MODE (base_rtx), - gen_rtx (MULT, GET_MODE (index_rtx), - index_rtx, scale_rtx), - base_rtx); - - if (GET_CODE (offset_rtx) != CONST_INT - || INTVAL (offset_rtx) != 0) - ret_rtx = gen_rtx (PLUS, GET_MODE (ret_rtx), - ret_rtx, offset_rtx); - } - else - { - ret_rtx = gen_rtx (PLUS, GET_MODE (index_rtx), - index_rtx, base_rtx); - - if (GET_CODE (offset_rtx) != CONST_INT - || INTVAL (offset_rtx) != 0) - ret_rtx = gen_rtx (PLUS, GET_MODE (ret_rtx), - ret_rtx, offset_rtx); - } - } - else - { - if (scale != 1) - { - ret_rtx = gen_rtx (MULT, GET_MODE (index_rtx), - index_rtx, scale_rtx); - - if (GET_CODE (offset_rtx) != CONST_INT - || INTVAL (offset_rtx) != 0) - ret_rtx = gen_rtx (PLUS, GET_MODE (ret_rtx), - ret_rtx, offset_rtx); - } - else - { - if (GET_CODE (offset_rtx) == CONST_INT - && INTVAL (offset_rtx) == 0) - ret_rtx = index_rtx; - else - ret_rtx = gen_rtx (PLUS, GET_MODE (index_rtx), - index_rtx, offset_rtx); - } - } - } - else - { - if (base_rtx) - { - if (GET_CODE (offset_rtx) == CONST_INT - && INTVAL (offset_rtx) == 0) - ret_rtx = base_rtx; - else - ret_rtx = gen_rtx (PLUS, GET_MODE (base_rtx), base_rtx, - offset_rtx); - } - else if (was_only_offset) - ret_rtx = offset_rtx; - else - { - obfree (storage); - return; - } - } - - XEXP (mem_rtx, 0) = ret_rtx; - RTX_IS_SPILL_P (XEXP (mem_rtx, 0)) = is_spill_rtx; - return; - } - else - { - obfree (storage); - return; - } -} -#endif /* NOTYET */ - -/* Return 1 if the first insn to set cc before INSN also sets the register - REG_RTX; otherwise return 0. */ -int -last_to_set_cc (reg_rtx, insn) - rtx reg_rtx, insn; -{ - rtx prev_insn = PREV_INSN (insn); - - while (prev_insn) - { - if (GET_CODE (prev_insn) == NOTE) - ; - - else if (GET_CODE (prev_insn) == INSN) - { - if (GET_CODE (PATTERN (prev_insn)) != SET) - return (0); - - if (rtx_equal_p (SET_DEST (PATTERN (prev_insn)), reg_rtx)) - { - if (sets_condition_code (SET_SRC (PATTERN (prev_insn)))) - return (1); - - return (0); - } - - else if (! doesnt_set_condition_code (SET_SRC (PATTERN (prev_insn)))) - return (0); - } - - else - return (0); - - prev_insn = PREV_INSN (prev_insn); - } - - return (0); -} - -int -doesnt_set_condition_code (pat) - rtx pat; -{ - switch (GET_CODE (pat)) - { - case MEM: - case REG: - return 1; - - default: - return 0; - - } -} - -int -sets_condition_code (pat) - rtx pat; -{ - switch (GET_CODE (pat)) - { - case PLUS: - case MINUS: - case AND: - case IOR: - case XOR: - case NOT: - case NEG: - case MULT: - case DIV: - case MOD: - case UDIV: - case UMOD: - return 1; - - default: - return (0); - } -} - -int -str_immediate_operand (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - if (GET_CODE (op) == CONST_INT && INTVAL (op) <= 32 && INTVAL (op) >= 0) - return 1; - - return 0; -} - -int -is_fp_insn (insn) - rtx insn; -{ - if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET - && (GET_MODE (SET_DEST (PATTERN (insn))) == DFmode - || GET_MODE (SET_DEST (PATTERN (insn))) == SFmode - || GET_MODE (SET_DEST (PATTERN (insn))) == XFmode)) - return 1; - - return 0; -} - -/* Return 1 if the mode of the SET_DEST of insn is floating point - and it is not an fld or a move from memory to memory. - Otherwise return 0 */ - -int -is_fp_dest (insn) - rtx insn; -{ - if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET - && (GET_MODE (SET_DEST (PATTERN (insn))) == DFmode - || GET_MODE (SET_DEST (PATTERN (insn))) == SFmode - || GET_MODE (SET_DEST (PATTERN (insn))) == XFmode) - && GET_CODE (SET_DEST (PATTERN (insn))) == REG - && REGNO (SET_DEST (PATTERN (insn))) >= FIRST_FLOAT_REG - && GET_CODE (SET_SRC (PATTERN (insn))) != MEM) - return 1; - - return 0; -} - -/* Return 1 if the mode of the SET_DEST of INSN is floating point and is - memory and the source is a register. */ - -int -is_fp_store (insn) - rtx insn; -{ - if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET - && (GET_MODE (SET_DEST (PATTERN (insn))) == DFmode - || GET_MODE (SET_DEST (PATTERN (insn))) == SFmode - || GET_MODE (SET_DEST (PATTERN (insn))) == XFmode) - && GET_CODE (SET_DEST (PATTERN (insn))) == MEM - && GET_CODE (SET_SRC (PATTERN (insn))) == REG) - return 1; - - return 0; -} - -/* Return 1 if DEP_INSN sets a register which INSN uses as a base - or index to reference memory. - otherwise return 0 */ - -int -agi_dependent (insn, dep_insn) - rtx insn, dep_insn; -{ - int push = 0, push_dep = 0; - if (GET_CODE (dep_insn) == INSN - && GET_CODE (PATTERN (dep_insn)) == SET - && GET_CODE (SET_DEST (PATTERN (dep_insn))) == REG - && reg_mentioned_in_mem (SET_DEST (PATTERN (dep_insn)), insn)) - return 1; - - if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SET - && GET_CODE (SET_DEST (PATTERN (insn))) == MEM - && push_operand (SET_DEST (PATTERN (insn)), - GET_MODE (SET_DEST (PATTERN (insn))))) - push = 1; - - if (GET_CODE (dep_insn) == INSN && GET_CODE (PATTERN (dep_insn)) == SET - && GET_CODE (SET_DEST (PATTERN (dep_insn))) == MEM - && push_operand (SET_DEST (PATTERN (dep_insn)), - GET_MODE (SET_DEST (PATTERN (dep_insn))))) - push_dep = 1; - - /* CPUs contain special hardware to allow two pushes. */ - if (push && push_dep) - return 0; - - /* Push operation implicitly change stack pointer causing AGI stalls. */ - if (push_dep && reg_mentioned_in_mem (stack_pointer_rtx, insn)) - return 1; - - /* Push also implicitly read stack pointer. */ - if (push && modified_in_p (stack_pointer_rtx, dep_insn)) - return 1; - - return 0; -} - -/* Return 1 if reg is used in rtl as a base or index for a memory ref - otherwise return 0. */ - -int -reg_mentioned_in_mem (reg, rtl) - rtx reg, rtl; -{ - register char *fmt; - register int i, j; - register enum rtx_code code; - - if (rtl == NULL) - return 0; - - code = GET_CODE (rtl); - - switch (code) - { - case HIGH: - case CONST_INT: - case CONST: - case CONST_DOUBLE: - case SYMBOL_REF: - case LABEL_REF: - case PC: - case CC0: - case SUBREG: - return 0; - default: - break; - } - - if (code == MEM && reg_mentioned_p (reg, rtl)) - return 1; - - fmt = GET_RTX_FORMAT (code); - for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) - { - if (fmt[i] == 'E') - { - for (j = XVECLEN (rtl, i) - 1; j >= 0; j--) - if (reg_mentioned_in_mem (reg, XVECEXP (rtl, i, j))) - return 1; - } - - else if (fmt[i] == 'e' && reg_mentioned_in_mem (reg, XEXP (rtl, i))) - return 1; - } - - return 0; -} - -/* Output the appropriate insns for doing strlen if not just doing repnz; scasb - - operands[0] = result, initialized with the startaddress - operands[1] = alignment of the address. - operands[2] = scratch register, initialized with the startaddress when - not aligned, otherwise undefined - - This is just the body. It needs the initialisations mentioned above and - some address computing at the end. These things are done in i386.md. */ - -char * -output_strlen_unroll (operands) - rtx operands[]; -{ - rtx xops[18]; - - xops[0] = operands[0]; /* Result */ - /* operands[1]; * Alignment */ - xops[1] = operands[2]; /* Scratch */ - xops[2] = GEN_INT (0); - xops[3] = GEN_INT (2); - xops[4] = GEN_INT (3); - xops[5] = GEN_INT (4); - /* xops[6] = gen_label_rtx (); * label when aligned to 3-byte */ - /* xops[7] = gen_label_rtx (); * label when aligned to 2-byte */ - xops[8] = gen_label_rtx (); /* label of main loop */ - - if (TARGET_USE_Q_REG && QI_REG_P (xops[1])) - xops[9] = gen_label_rtx (); /* pentium optimisation */ - - xops[10] = gen_label_rtx (); /* end label 2 */ - xops[11] = gen_label_rtx (); /* end label 1 */ - xops[12] = gen_label_rtx (); /* end label */ - /* xops[13] * Temporary used */ - xops[14] = GEN_INT (0xff); - xops[15] = GEN_INT (0xff00); - xops[16] = GEN_INT (0xff0000); - xops[17] = GEN_INT (0xff000000); - - /* Loop to check 1..3 bytes for null to get an aligned pointer. */ - - /* Is there a known alignment and is it less than 4? */ - if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) < 4) - { - /* Is there a known alignment and is it not 2? */ - if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 2) - { - xops[6] = gen_label_rtx (); /* Label when aligned to 3-byte */ - xops[7] = gen_label_rtx (); /* Label when aligned to 2-byte */ - - /* Leave just the 3 lower bits. - If this is a q-register, then the high part is used later - therefore use andl rather than andb. */ - output_asm_insn (AS2 (and%L1,%4,%1), xops); - - /* Is aligned to 4-byte address when zero */ - output_asm_insn (AS1 (je,%l8), xops); - - /* Side-effect even Parity when %eax == 3 */ - output_asm_insn (AS1 (jp,%6), xops); - - /* Is it aligned to 2 bytes ? */ - if (QI_REG_P (xops[1])) - output_asm_insn (AS2 (cmp%L1,%3,%1), xops); - else - output_asm_insn (AS2 (cmp%L1,%3,%1), xops); - - output_asm_insn (AS1 (je,%7), xops); - } - else - { - /* Since the alignment is 2, we have to check 2 or 0 bytes; - check if is aligned to 4 - byte. */ - output_asm_insn (AS2 (and%L1,%3,%1), xops); - - /* Is aligned to 4-byte address when zero */ - output_asm_insn (AS1 (je,%l8), xops); - } - - xops[13] = gen_rtx_MEM (QImode, xops[0]); - - /* Now compare the bytes; compare with the high part of a q-reg - gives shorter code. */ - if (QI_REG_P (xops[1])) - { - /* Compare the first n unaligned byte on a byte per byte basis. */ - output_asm_insn (AS2 (cmp%B1,%h1,%13), xops); - - /* When zero we reached the end. */ - output_asm_insn (AS1 (je,%l12), xops); - - /* Increment the address. */ - output_asm_insn (AS1 (inc%L0,%0), xops); - - /* Not needed with an alignment of 2 */ - if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 2) - { - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", - CODE_LABEL_NUMBER (xops[7])); - output_asm_insn (AS2 (cmp%B1,%h1,%13), xops); - output_asm_insn (AS1 (je,%l12), xops); - output_asm_insn (AS1 (inc%L0,%0), xops); - - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", - CODE_LABEL_NUMBER (xops[6])); - } - - output_asm_insn (AS2 (cmp%B1,%h1,%13), xops); - } - else - { - output_asm_insn (AS2 (cmp%B13,%2,%13), xops); - output_asm_insn (AS1 (je,%l12), xops); - output_asm_insn (AS1 (inc%L0,%0), xops); - - /* Not needed with an alignment of 2 */ - if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 2) - { - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", - CODE_LABEL_NUMBER (xops[7])); - output_asm_insn (AS2 (cmp%B13,%2,%13), xops); - output_asm_insn (AS1 (je,%l12), xops); - output_asm_insn (AS1 (inc%L0,%0), xops); - - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", - CODE_LABEL_NUMBER (xops[6])); - } - - output_asm_insn (AS2 (cmp%B13,%2,%13), xops); - } - - output_asm_insn (AS1 (je,%l12), xops); - output_asm_insn (AS1 (inc%L0,%0), xops); - } - - /* Generate loop to check 4 bytes at a time. It is not a good idea to - align this loop. It gives only huge programs, but does not help to - speed up. */ - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[8])); - - xops[13] = gen_rtx_MEM (SImode, xops[0]); - output_asm_insn (AS2 (mov%L1,%13,%1), xops); - - if (QI_REG_P (xops[1])) - { - /* On i586 it is faster to combine the hi- and lo- part as - a kind of lookahead. If anding both yields zero, then one - of both *could* be zero, otherwise none of both is zero; - this saves one instruction, on i486 this is slower - tested with P-90, i486DX2-66, AMD486DX2-66 */ - if (TARGET_PENTIUM) - { - output_asm_insn (AS2 (test%B1,%h1,%b1), xops); - output_asm_insn (AS1 (jne,%l9), xops); - } - - /* Check first byte. */ - output_asm_insn (AS2 (test%B1,%b1,%b1), xops); - output_asm_insn (AS1 (je,%l12), xops); - - /* Check second byte. */ - output_asm_insn (AS2 (test%B1,%h1,%h1), xops); - output_asm_insn (AS1 (je,%l11), xops); - - if (TARGET_PENTIUM) - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", - CODE_LABEL_NUMBER (xops[9])); - } - - else - { - /* Check first byte. */ - output_asm_insn (AS2 (test%L1,%14,%1), xops); - output_asm_insn (AS1 (je,%l12), xops); - - /* Check second byte. */ - output_asm_insn (AS2 (test%L1,%15,%1), xops); - output_asm_insn (AS1 (je,%l11), xops); - } - - /* Check third byte. */ - output_asm_insn (AS2 (test%L1,%16,%1), xops); - output_asm_insn (AS1 (je,%l10), xops); - - /* Check fourth byte and increment address. */ - output_asm_insn (AS2 (add%L0,%5,%0), xops); - output_asm_insn (AS2 (test%L1,%17,%1), xops); - output_asm_insn (AS1 (jne,%l8), xops); - - /* Now generate fixups when the compare stops within a 4-byte word. */ - output_asm_insn (AS2 (sub%L0,%4,%0), xops); - - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[10])); - output_asm_insn (AS1 (inc%L0,%0), xops); - - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[11])); - output_asm_insn (AS1 (inc%L0,%0), xops); - - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[12])); - - return ""; -} - -char * -output_fp_conditional_move (which_alternative, operands) - int which_alternative; - rtx operands[]; -{ - enum rtx_code code = GET_CODE (operands[1]); - - /* This should never happen. */ - if (!(cc_prev_status.flags & CC_IN_80387) - && (code == GT || code == LE || code == GE || code == LT)) - abort (); - - switch (which_alternative) - { - case 0: - /* r <- cond ? arg : r */ - output_asm_insn (AS2 (fcmov%F1,%2,%0), operands); - break; - - case 1: - /* r <- cond ? r : arg */ - output_asm_insn (AS2 (fcmov%f1,%3,%0), operands); - break; - - default: - abort (); - } - - return ""; -} - -char * -output_int_conditional_move (which_alternative, operands) - int which_alternative; - rtx operands[]; -{ - enum rtx_code code = GET_CODE (operands[1]); - - /* This is very tricky. We have to do it right. For a code segement - like: - - int foo, bar; - .... - foo = foo - x; - if (foo >= 0) - bar = y; - - final_scan_insn () may delete the insn which sets CC. We have to - tell final_scan_insn () if it should be reinserted. When CODE is - GT or LE, we have to check the CC_NO_OVERFLOW bit and return - NULL_PTR to tell final to reinsert the test insn because the - conditional move cannot be handled properly without it. */ - if ((code == GT || code == LE) - && (cc_prev_status.flags & CC_NO_OVERFLOW)) - return NULL_PTR; - - switch (which_alternative) - { - case 0: - /* r <- cond ? arg : r */ - output_asm_insn (AS2 (cmov%C1,%2,%0), operands); - break; - - case 1: - /* r <- cond ? r : arg */ - output_asm_insn (AS2 (cmov%c1,%3,%0), operands); - break; - - default: - abort (); - } - - return ""; -} - -int -x86_adjust_cost (insn, link, dep_insn, cost) - rtx insn, link, dep_insn; - int cost; -{ - rtx next_inst; - - if (GET_CODE (dep_insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN) - return 0; - - if (GET_CODE (dep_insn) == INSN - && GET_CODE (PATTERN (dep_insn)) == SET - && GET_CODE (SET_DEST (PATTERN (dep_insn))) == REG - && GET_CODE (insn) == INSN - && GET_CODE (PATTERN (insn)) == SET - && !reg_overlap_mentioned_p (SET_DEST (PATTERN (dep_insn)), - SET_SRC (PATTERN (insn)))) - return 0; /* ??? */ - - - switch (ix86_cpu) - { - case PROCESSOR_PENTIUM: - if (cost != 0 && is_fp_insn (insn) && is_fp_insn (dep_insn) - && !is_fp_dest (dep_insn)) - return 0; - - if (agi_dependent (insn, dep_insn)) - return cost ? cost + 1 : 2; - - if (GET_CODE (insn) == INSN - && GET_CODE (PATTERN (insn)) == SET - && SET_DEST (PATTERN (insn)) == cc0_rtx - && (next_inst = next_nonnote_insn (insn)) - && GET_CODE (next_inst) == JUMP_INSN) - /* compare probably paired with jump */ - return 0; - - /* Stores stalls one cycle longer than other insns. */ - if (is_fp_insn (insn) && cost && is_fp_store (dep_insn)) - cost++; - break; - case PROCESSOR_K6: - default: - if (!is_fp_dest (dep_insn)) - { - if(!agi_dependent (insn, dep_insn)) - return 0; - if (TARGET_486) - return 2; - } - else - if (is_fp_store (insn) && is_fp_insn (dep_insn) - && NEXT_INSN (insn) && NEXT_INSN (NEXT_INSN (insn)) - && NEXT_INSN (NEXT_INSN (NEXT_INSN (insn))) - && (GET_CODE (NEXT_INSN (insn)) == INSN) - && (GET_CODE (NEXT_INSN (NEXT_INSN (insn))) == JUMP_INSN) - && (GET_CODE (NEXT_INSN (NEXT_INSN (NEXT_INSN (insn)))) == NOTE) - && (NOTE_LINE_NUMBER (NEXT_INSN (NEXT_INSN (NEXT_INSN (insn)))) - == NOTE_INSN_LOOP_END)) - return 3; - break; - } - - return cost; -} - -/* Output assembly code for a left shift. - - Always use "sal" when shifting a memory operand or for a non constant - shift count. - - When optimizing for size, we know that src == dest, and we should always - use "sal". If src != dest, then copy src to dest and use "sal". - - Pentium and PPro (speed): - - When src == dest, use "add" for a shift counts of one, else use - "sal". If we modeled Pentium AGI stalls and U/V pipelining better we - would want to generate lea for some shifts on the Pentium. - - When src != dest, use "lea" for small shift counts. Otherwise, - copy src to dest and use the normal shifting code. Exception for - TARGET_DOUBLE_WITH_ADD. */ - -char * -output_ashl (insn, operands) - rtx insn, *operands; -{ - /* Handle case where srcreg != dstreg. */ - if (REG_P (operands[0]) && REGNO (operands[0]) != REGNO (operands[1])) - { - if (TARGET_DOUBLE_WITH_ADD && INTVAL (operands[2]) == 1) - switch (GET_MODE (operands[0])) - { - case SImode: - output_asm_insn (AS2 (mov%L0,%1,%0), operands); - return AS2 (add%L0,%1,%0); - case HImode: - output_asm_insn (AS2 (mov%L0,%k1,%k0), operands); - if (i386_cc_probably_useless_p (insn)) - { - CC_STATUS_INIT; - return AS2 (add%L0,%k1,%k0); - } - return AS2 (add%W0,%k1,%k0); - case QImode: - output_asm_insn (AS2 (mov%B0,%1,%0), operands); - return AS2 (add%B0,%1,%0); - default: - abort (); - } - else - { - CC_STATUS_INIT; - - /* This should be extremely rare (impossible?). We can not encode a - shift of the stack pointer using an lea instruction. So copy the - stack pointer into the destination register and use an lea. */ - if (operands[1] == stack_pointer_rtx) - { - output_asm_insn (AS2 (mov%L0,%k1,%k0), operands); - operands[1] = operands[0]; - } - - /* For shifts up to and including 3 bits, use lea. */ - operands[1] = gen_rtx_MULT (SImode, - gen_rtx_REG (SImode, REGNO (operands[1])), - GEN_INT (1 << INTVAL (operands[2]))); - return AS2 (lea%L0,%a1,%k0); - } - } - - /* Source and destination match. */ - - /* Handle variable shift. */ - if (REG_P (operands[2])) - switch (GET_MODE (operands[0])) - { - case SImode: - return AS2 (sal%L0,%b2,%0); - case HImode: - if (REG_P (operands[0]) && i386_cc_probably_useless_p (insn)) - { - CC_STATUS_INIT; - return AS2 (sal%L0,%b2,%k0); - } - else - return AS2 (sal%W0,%b2,%0); - case QImode: - return AS2 (sal%B0,%b2,%0); - default: - abort (); - } - - /* Always perform shift by 1 using an add instruction. */ - if (REG_P (operands[0]) && operands[2] == const1_rtx) - switch (GET_MODE (operands[0])) - { - case SImode: - return AS2 (add%L0,%0,%0); - case HImode: - if (REG_P (operands[0]) && i386_cc_probably_useless_p (insn)) - { - CC_STATUS_INIT; - return AS2 (add%L0,%k0,%k0); - } - else - return AS2 (add%W0,%0,%0); - case QImode: - return AS2 (add%B0,%0,%0); - default: - abort (); - } - -#if 0 - /* ??? Currently disabled. Because our model of Pentium is far from being - exact, this change will need some benchmarking. */ - /* Shift reg by 2 or 3 use an lea instruction for Pentium if this is - insn is expected to issue into the V pipe (the insn's mode will be - TImode for a U pipe, and !TImode for a V pipe instruction). */ - if (! optimize_size - && REG_P (operands[0]) - && GET_CODE (operands[2]) == CONST_INT - && INTVAL (operands[2]) <= 3 - && (int)ix86_cpu == (int)PROCESSOR_PENTIUM - && GET_MODE (insn) != TImode) - { - CC_STATUS_INIT; - operands[1] = gen_rtx_MULT (SImode, gen_rtx_REG (SImode, REGNO (operands[1])), - GEN_INT (1 << INTVAL (operands[2]))); - return AS2 (lea%L0,%a1,%0); - } -#endif - - /* Otherwise use a shift instruction. */ - switch (GET_MODE (operands[0])) - { - case SImode: - return AS2 (sal%L0,%2,%0); - case HImode: - if (REG_P (operands[0]) && i386_cc_probably_useless_p (insn)) - { - CC_STATUS_INIT; - return AS2 (sal%L0,%2,%k0); - } - else - return AS2 (sal%W0,%2,%0); - case QImode: - return AS2 (sal%B0,%2,%0); - default: - abort (); - } -} - -/* Given the memory address ADDR, calculate the length of the address or - the length of just the displacement (controlled by DISP_LENGTH). - - The length returned does not include the one-byte modrm, opcode, - or prefix. */ - -int -memory_address_info (addr, disp_length) - rtx addr; - int disp_length; -{ - rtx base, index, disp, scale; - rtx op0, op1; - int len; - - if (GET_CODE (addr) == PRE_DEC - || GET_CODE (addr) == POST_INC) - return 0; - - /* Register Indirect. */ - if (register_operand (addr, Pmode)) - { - /* Special cases: ebp and esp need the two-byte modrm form. - - We change [ESI] to [ESI+0] on the K6 when not optimizing - for size. */ - if (addr == stack_pointer_rtx - || addr == arg_pointer_rtx - || addr == frame_pointer_rtx - || (REGNO_REG_CLASS (REGNO (addr)) == SIREG - && ix86_cpu == PROCESSOR_K6 && !optimize_size)) - return 1; - else - return 0; - } - - /* Direct Addressing. */ - if (CONSTANT_P (addr)) - return 4; - - index = base = disp = scale = NULL_RTX; - op0 = XEXP (addr, 0); - op1 = XEXP (addr, 1); - - if (GET_CODE (addr) == PLUS) - { - if (register_operand (op0, Pmode)) - { - if (register_operand (op1, Pmode)) - index = op0, base = op1; - else - base = op0, disp = op1; - } - else if (GET_CODE (op0) == MULT) - { - index = XEXP (op0, 0); - scale = XEXP (op0, 1); - if (register_operand (op1, Pmode)) - base = op1; - else - disp = op1; - } - else if (GET_CODE (op0) == PLUS && GET_CODE (XEXP (op0, 0)) == MULT) - { - index = XEXP (XEXP (op0, 0), 0); - scale = XEXP (XEXP (op0, 0), 1); - base = XEXP (op0, 1); - disp = op1; - } - else if (GET_CODE (op0) == PLUS) - { - index = XEXP (op0, 0); - base = XEXP (op0, 1); - disp = op1; - } - else - abort (); - } - else if (GET_CODE (addr) == MULT - /* We're called for lea too, which implements ashift on occasion. */ - || GET_CODE (addr) == ASHIFT) - { - index = XEXP (addr, 0); - scale = XEXP (addr, 1); - } - else - abort (); - - /* Allow arg pointer and stack pointer as index if there is not scaling */ - if (base && index && !scale - && (index == stack_pointer_rtx - || index == arg_pointer_rtx - || index == frame_pointer_rtx)) - { - rtx tmp = base; - base = index; - index = tmp; - } - - /* Special case: ebp cannot be encoded as a base without a displacement. */ - if (base == frame_pointer_rtx && !disp) - disp = const0_rtx; - - /* Scaling can not be encoded without base or displacement. - Except for scale == 1 where we can encode reg + reg instead of reg * 2. */ - if (!base && index - && (!scale || GET_CODE (scale) != CONST_INT || (INTVAL (scale) != 1))) - disp = const0_rtx; - - /* Find the length of the displacement constant. */ - len = 0; - if (disp) - { - if (GET_CODE (disp) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (disp), 'K')) - len = 1; - else - len = 4; - } - - /* An index requires the two-byte modrm form. Not important - if we are computing just length of the displacement. */ - if (index && ! disp_length) - len += 1; - - return len; -} diff --git a/contrib/gcc/config/i386/i386.h b/contrib/gcc/config/i386/i386.h deleted file mode 100644 index 5e27fd800349..000000000000 --- a/contrib/gcc/config/i386/i386.h +++ /dev/null @@ -1,2810 +0,0 @@ -/* Definitions of target machine for GNU compiler for Intel X86 - (386, 486, Pentium). - Copyright (C) 1988, 92, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* The purpose of this file is to define the characteristics of the i386, - independent of assembler syntax or operating system. - - Three other files build on this one to describe a specific assembler syntax: - bsd386.h, att386.h, and sun386.h. - - The actual tm.h file for a particular system should include - this file, and then the file for the appropriate assembler syntax. - - Many macros that specify assembler syntax are omitted entirely from - this file because they really belong in the files for particular - assemblers. These include AS1, AS2, AS3, RP, IP, LPREFIX, L_SIZE, - PUT_OP_SIZE, USE_STAR, ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, - PRINT_B_I_S, and many that start with ASM_ or end in ASM_OP. */ - -/* Names to predefine in the preprocessor for this target machine. */ - -#define I386 1 - -/* Stubs for half-pic support if not OSF/1 reference platform. */ - -#ifndef HALF_PIC_P -#define HALF_PIC_P() 0 -#define HALF_PIC_NUMBER_PTRS 0 -#define HALF_PIC_NUMBER_REFS 0 -#define HALF_PIC_ENCODE(DECL) -#define HALF_PIC_DECLARE(NAME) -#define HALF_PIC_INIT() error ("half-pic init called on systems that don't support it.") -#define HALF_PIC_ADDRESS_P(X) 0 -#define HALF_PIC_PTR(X) X -#define HALF_PIC_FINISH(STREAM) -#endif - -/* Define the specific costs for a given cpu */ - -struct processor_costs { - int add; /* cost of an add instruction */ - int lea; /* cost of a lea instruction */ - int shift_var; /* variable shift costs */ - int shift_const; /* constant shift costs */ - int mult_init; /* cost of starting a multiply */ - int mult_bit; /* cost of multiply per each bit set */ - int divide; /* cost of a divide/mod */ -}; - -extern struct processor_costs *ix86_cost; - -/* Run-time compilation parameters selecting different hardware subsets. */ - -extern int target_flags; - -/* Macros used in the machine description to test the flags. */ - -/* configure can arrange to make this 2, to force a 486. */ -#ifndef TARGET_CPU_DEFAULT -#define TARGET_CPU_DEFAULT 0 -#endif - -/* Masks for the -m switches */ -#define MASK_80387 000000000001 /* Hardware floating point */ -#define MASK_NOTUSED1 000000000002 /* bit not currently used */ -#define MASK_NOTUSED2 000000000004 /* bit not currently used */ -#define MASK_RTD 000000000010 /* Use ret that pops args */ -#define MASK_ALIGN_DOUBLE 000000000020 /* align doubles to 2 word boundary */ -#define MASK_SVR3_SHLIB 000000000040 /* Uninit locals into bss */ -#define MASK_IEEE_FP 000000000100 /* IEEE fp comparisons */ -#define MASK_FLOAT_RETURNS 000000000200 /* Return float in st(0) */ -#define MASK_NO_FANCY_MATH_387 000000000400 /* Disable sin, cos, sqrt */ -#define MASK_OMIT_LEAF_FRAME_POINTER 0x00000800 /* omit leaf frame pointers */ - /* Temporary codegen switches */ -#define MASK_DEBUG_ADDR 000001000000 /* Debug GO_IF_LEGITIMATE_ADDRESS */ -#define MASK_NO_WIDE_MULTIPLY 000002000000 /* Disable 32x32->64 multiplies */ -#define MASK_NO_MOVE 000004000000 /* Don't generate mem->mem */ -#define MASK_NO_PSEUDO 000010000000 /* Move op's args -> pseudos */ -#define MASK_DEBUG_ARG 000020000000 /* Debug function_arg */ -#define MASK_SCHEDULE_PROLOGUE 000040000000 /* Emit prologue as rtl */ -#define MASK_STACK_PROBE 000100000000 /* Enable stack probing */ - -/* Use the floating point instructions */ -#define TARGET_80387 (target_flags & MASK_80387) - -/* Compile using ret insn that pops args. - This will not work unless you use prototypes at least - for all functions that can take varying numbers of args. */ -#define TARGET_RTD (target_flags & MASK_RTD) - -/* Align doubles to a two word boundary. This breaks compatibility with - the published ABI's for structures containing doubles, but produces - faster code on the pentium. */ -#define TARGET_ALIGN_DOUBLE (target_flags & MASK_ALIGN_DOUBLE) - -/* Put uninitialized locals into bss, not data. - Meaningful only on svr3. */ -#define TARGET_SVR3_SHLIB (target_flags & MASK_SVR3_SHLIB) - -/* Use IEEE floating point comparisons. These handle correctly the cases - where the result of a comparison is unordered. Normally SIGFPE is - generated in such cases, in which case this isn't needed. */ -#define TARGET_IEEE_FP (target_flags & MASK_IEEE_FP) - -/* Functions that return a floating point value may return that value - in the 387 FPU or in 386 integer registers. If set, this flag causes - the 387 to be used, which is compatible with most calling conventions. */ -#define TARGET_FLOAT_RETURNS_IN_80387 (target_flags & MASK_FLOAT_RETURNS) - -/* Disable generation of FP sin, cos and sqrt operations for 387. - This is because FreeBSD lacks these in the math-emulator-code */ -#define TARGET_NO_FANCY_MATH_387 (target_flags & MASK_NO_FANCY_MATH_387) - -/* Don't create frame pointers for leaf functions */ -#define TARGET_OMIT_LEAF_FRAME_POINTER (target_flags & MASK_OMIT_LEAF_FRAME_POINTER) - -/* Temporary switches for tuning code generation */ - -/* Disable 32x32->64 bit multiplies that are used for long long multiplies - and division by constants, but sometimes cause reload problems. */ -#define TARGET_NO_WIDE_MULTIPLY (target_flags & MASK_NO_WIDE_MULTIPLY) -#define TARGET_WIDE_MULTIPLY (!TARGET_NO_WIDE_MULTIPLY) - -/* Emit/Don't emit prologue as rtl */ -#define TARGET_SCHEDULE_PROLOGUE (target_flags & MASK_SCHEDULE_PROLOGUE) - -/* Debug GO_IF_LEGITIMATE_ADDRESS */ -#define TARGET_DEBUG_ADDR (target_flags & MASK_DEBUG_ADDR) - -/* Debug FUNCTION_ARG macros */ -#define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG) - -/* Hack macros for tuning code generation */ -#define TARGET_MOVE ((target_flags & MASK_NO_MOVE) == 0) /* Don't generate memory->memory */ -#define TARGET_PSEUDO ((target_flags & MASK_NO_PSEUDO) == 0) /* Move op's args into pseudos */ - -#define TARGET_386 (ix86_cpu == PROCESSOR_I386) -#define TARGET_486 (ix86_cpu == PROCESSOR_I486) -#define TARGET_PENTIUM (ix86_cpu == PROCESSOR_PENTIUM) -#define TARGET_PENTIUMPRO (ix86_cpu == PROCESSOR_PENTIUMPRO) -#define TARGET_K6 (ix86_cpu == PROCESSOR_K6) - -#define CPUMASK (1 << ix86_cpu) -extern const int x86_use_leave, x86_push_memory, x86_zero_extend_with_and; -extern const int x86_use_bit_test, x86_cmove, x86_deep_branch; -extern const int x86_unroll_strlen, x86_use_q_reg, x86_use_any_reg; -extern const int x86_double_with_add; - -#define TARGET_USE_LEAVE (x86_use_leave & CPUMASK) -#define TARGET_PUSH_MEMORY (x86_push_memory & CPUMASK) -#define TARGET_ZERO_EXTEND_WITH_AND (x86_zero_extend_with_and & CPUMASK) -#define TARGET_USE_BIT_TEST (x86_use_bit_test & CPUMASK) -#define TARGET_UNROLL_STRLEN (x86_unroll_strlen & CPUMASK) -#define TARGET_USE_Q_REG (x86_use_q_reg & CPUMASK) -#define TARGET_USE_ANY_REG (x86_use_any_reg & CPUMASK) -#define TARGET_CMOVE (x86_cmove & (1 << ix86_arch)) -#define TARGET_DEEP_BRANCH_PREDICTION (x86_deep_branch & CPUMASK) -#define TARGET_DOUBLE_WITH_ADD (x86_double_with_add & CPUMASK) - -#define TARGET_STACK_PROBE (target_flags & MASK_STACK_PROBE) - -#define TARGET_SWITCHES \ -{ { "80387", MASK_80387, "Use hardware fp" }, \ - { "no-80387", -MASK_80387, "Do not use hardware fp" },\ - { "hard-float", MASK_80387, "Use hardware fp" }, \ - { "soft-float", -MASK_80387, "Do not use hardware fp" },\ - { "no-soft-float", MASK_80387, "Use hardware fp" }, \ - { "386", 0, "Same as -mcpu=i386" }, \ - { "486", 0, "Same as -mcpu=i486" }, \ - { "pentium", 0, "Same as -mcpu=pentium" }, \ - { "pentiumpro", 0, "Same as -mcpu=pentiumpro" }, \ - { "rtd", MASK_RTD, "Alternate calling convention" },\ - { "no-rtd", -MASK_RTD, "Use normal calling convention" },\ - { "align-double", MASK_ALIGN_DOUBLE, "Align some doubles on dword boundary" },\ - { "no-align-double", -MASK_ALIGN_DOUBLE, "Align doubles on word boundary" }, \ - { "svr3-shlib", MASK_SVR3_SHLIB, "Uninitialized locals in .bss" }, \ - { "no-svr3-shlib", -MASK_SVR3_SHLIB, "Uninitialized locals in .data" }, \ - { "ieee-fp", MASK_IEEE_FP, "Use IEEE math for fp comparisons" }, \ - { "no-ieee-fp", -MASK_IEEE_FP, "Do not use IEEE math for fp comparisons" }, \ - { "fp-ret-in-387", MASK_FLOAT_RETURNS, "Return values of functions in FPU registers" }, \ - { "no-fp-ret-in-387", -MASK_FLOAT_RETURNS , "Do not return values of functions in FPU registers"}, \ - { "no-fancy-math-387", MASK_NO_FANCY_MATH_387, "Do not generate sin, cos, sqrt for 387" }, \ - { "fancy-math-387", -MASK_NO_FANCY_MATH_387, "Generate sin, cos, sqrt for FPU"}, \ - { "omit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER, "Omit the frame pointer in leaf functions" }, \ - { "no-omit-leaf-frame-pointer",-MASK_OMIT_LEAF_FRAME_POINTER, "" }, \ - { "no-wide-multiply", MASK_NO_WIDE_MULTIPLY, "multiplies of 32 bits constrained to 32 bits" }, \ - { "wide-multiply", -MASK_NO_WIDE_MULTIPLY, "multiplies of 32 bits are 64 bits" }, \ - { "schedule-prologue", MASK_SCHEDULE_PROLOGUE, "Schedule function prologues" }, \ - { "no-schedule-prologue", -MASK_SCHEDULE_PROLOGUE, "" }, \ - { "debug-addr", MASK_DEBUG_ADDR, 0 /* intentionally undoc */ }, \ - { "no-debug-addr", -MASK_DEBUG_ADDR, 0 /* intentionally undoc */ }, \ - { "move", -MASK_NO_MOVE, "Generate mem-mem moves" }, \ - { "no-move", MASK_NO_MOVE, "Don't generate mem-mem moves" }, \ - { "debug-arg", MASK_DEBUG_ARG, 0 /* intentionally undoc */ }, \ - { "no-debug-arg", -MASK_DEBUG_ARG, 0 /* intentionally undoc */ }, \ - { "stack-arg-probe", MASK_STACK_PROBE, "Enable stack probing" }, \ - { "no-stack-arg-probe", -MASK_STACK_PROBE, "" }, \ - { "windows", 0, 0 /* intentionally undoc */ }, \ - { "dll", 0, 0 /* intentionally undoc */ }, \ - SUBTARGET_SWITCHES \ - { "", MASK_SCHEDULE_PROLOGUE | TARGET_DEFAULT, 0 }} - -/* Which processor to schedule for. The cpu attribute defines a list that - mirrors this list, so changes to i386.md must be made at the same time. */ - -enum processor_type - {PROCESSOR_I386, /* 80386 */ - PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */ - PROCESSOR_PENTIUM, - PROCESSOR_PENTIUMPRO, - PROCESSOR_K6}; - -#define PROCESSOR_I386_STRING "i386" -#define PROCESSOR_I486_STRING "i486" -#define PROCESSOR_I586_STRING "i586" -#define PROCESSOR_PENTIUM_STRING "pentium" -#define PROCESSOR_I686_STRING "i686" -#define PROCESSOR_PENTIUMPRO_STRING "pentiumpro" -#define PROCESSOR_K6_STRING "k6" - -extern enum processor_type ix86_cpu; - -extern int ix86_arch; - -/* Define the default processor. This is overridden by other tm.h files. */ -#define PROCESSOR_DEFAULT (enum processor_type) TARGET_CPU_DEFAULT -#define PROCESSOR_DEFAULT_STRING \ - (PROCESSOR_DEFAULT == PROCESSOR_I486 ? PROCESSOR_I486_STRING \ - : PROCESSOR_DEFAULT == PROCESSOR_PENTIUM ? PROCESSOR_PENTIUM_STRING \ - : PROCESSOR_DEFAULT == PROCESSOR_PENTIUMPRO ? PROCESSOR_PENTIUMPRO_STRING \ - : PROCESSOR_DEFAULT == PROCESSOR_K6 ? PROCESSOR_K6_STRING \ - : PROCESSOR_I386_STRING) - -/* This macro is similar to `TARGET_SWITCHES' but defines names of - command options that have values. Its definition is an - initializer with a subgrouping for each command option. - - Each subgrouping contains a string constant, that defines the - fixed part of the option name, and the address of a variable. The - variable, type `char *', is set to the variable part of the given - option if the fixed part matches. The actual option name is made - by appending `-m' to the specified name. */ -#define TARGET_OPTIONS \ -{ { "cpu=", &ix86_cpu_string, "Schedule code for given CPU"}, \ - { "arch=", &ix86_arch_string, "Generate code for given CPU"}, \ - { "reg-alloc=", &i386_reg_alloc_order, "Control allocation order of integer registers" }, \ - { "regparm=", &i386_regparm_string, "Number of registers used to pass integer arguments" }, \ - { "align-loops=", &i386_align_loops_string, "Loop code aligned to this power of 2" }, \ - { "align-jumps=", &i386_align_jumps_string, "Jump targets are aligned to this power of 2" }, \ - { "align-functions=", &i386_align_funcs_string, "Function starts are aligned to this power of 2" }, \ - { "preferred-stack-boundary=", &i386_preferred_stack_boundary_string, "Attempt to keep stack aligned to this power of 2" }, \ - { "branch-cost=", &i386_branch_cost_string, "Branches are this expensive (1-5, arbitrary units)" }, \ - SUBTARGET_OPTIONS \ -} - -/* Sometimes certain combinations of command options do not make - sense on a particular target machine. You can define a macro - `OVERRIDE_OPTIONS' to take account of this. This macro, if - defined, is executed once just after all the command options have - been parsed. - - Don't use this macro to turn on various extra optimizations for - `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ - -#define OVERRIDE_OPTIONS override_options () - -/* These are meant to be redefined in the host dependent files */ -#define SUBTARGET_SWITCHES -#define SUBTARGET_OPTIONS - -/* Define this to change the optimizations performed by default. */ -#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) optimization_options(LEVEL,SIZE) - -/* Specs for the compiler proper */ - -#ifndef CC1_CPU_SPEC -#define CC1_CPU_SPEC "\ -%{!mcpu*: \ -%{m386:-mcpu=i386 -march=i386} \ -%{m486:-mcpu=i486 -march=i486} \ -%{mpentium:-mcpu=pentium} \ -%{mpentiumpro:-mcpu=pentiumpro}}" -#endif - -#define CPP_486_SPEC "%{!ansi:-Di486} -D__i486 -D__i486__" -#define CPP_586_SPEC "%{!ansi:-Di586 -Dpentium} \ - -D__i586 -D__i586__ -D__pentium -D__pentium__" -#define CPP_K6_SPEC "%{!ansi:-Di586 -Dk6} \ - -D__i586 -D__i586__ -D__k6 -D__k6__" -#define CPP_686_SPEC "%{!ansi:-Di686 -Dpentiumpro} \ - -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__" - -#ifndef CPP_CPU_DEFAULT_SPEC -#if TARGET_CPU_DEFAULT == 1 -#define CPP_CPU_DEFAULT_SPEC "%(cpp_486)" -#endif -#if TARGET_CPU_DEFAULT == 2 -#define CPP_CPU_DEFAULT_SPEC "%(cpp_586)" -#endif -#if TARGET_CPU_DEFAULT == 3 -#define CPP_CPU_DEFAULT_SPEC "%(cpp_686)" -#endif -#if TARGET_CPU_DEFAULT == 4 -#define CPP_CPU_DEFAULT_SPEC "%(cpp_k6)" -#endif -#ifndef CPP_CPU_DEFAULT_SPEC -#define CPP_CPU_DEFAULT_SPEC "" -#endif -#endif /* CPP_CPU_DEFAULT_SPEC */ - -#ifndef CPP_CPU_SPEC -#define CPP_CPU_SPEC "\ --Acpu(i386) -Amachine(i386) \ -%{!ansi:-Di386} -D__i386 -D__i386__ \ -%{mcpu=i486:%(cpp_486)} %{m486:%(cpp_486)} \ -%{mpentium:%(cpp_586)} %{mcpu=pentium:%(cpp_586)} \ -%{mpentiumpro:%(cpp_686)} %{mcpu=pentiumpro:%(cpp_686)} \ -%{mcpu=k6:%(cpp_k6)} \ -%{!mcpu*:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}" -#endif - -#ifndef CC1_SPEC -#define CC1_SPEC "%(cc1_spec) " -#endif - -/* This macro defines names of additional specifications to put in the - specs that can be used in various specifications like CC1_SPEC. Its - definition is an initializer with a subgrouping for each command option. - - Each subgrouping contains a string constant, that defines the - specification name, and a string constant that used by the GNU CC driver - program. - - Do not define this macro if it does not need to do anything. */ - -#ifndef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS -#endif - -#define EXTRA_SPECS \ - { "cpp_486", CPP_486_SPEC}, \ - { "cpp_586", CPP_586_SPEC}, \ - { "cpp_k6", CPP_K6_SPEC}, \ - { "cpp_686", CPP_686_SPEC}, \ - { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \ - { "cpp_cpu", CPP_CPU_SPEC }, \ - { "cc1_cpu", CC1_CPU_SPEC }, \ - SUBTARGET_EXTRA_SPECS - -/* target machine storage layout */ - -/* Define for XFmode extended real floating point support. - This will automatically cause REAL_ARITHMETIC to be defined. */ -#define LONG_DOUBLE_TYPE_SIZE 96 - -/* Define if you don't want extended real, but do want to use the - software floating point emulator for REAL_ARITHMETIC and - decimal <-> binary conversion. */ -/* #define REAL_ARITHMETIC */ - -/* Define this if most significant byte of a word is the lowest numbered. */ -/* That is true on the 80386. */ - -#define BITS_BIG_ENDIAN 0 - -/* Define this if most significant byte of a word is the lowest numbered. */ -/* That is not true on the 80386. */ -#define BYTES_BIG_ENDIAN 0 - -/* Define this if most significant word of a multiword number is the lowest - numbered. */ -/* Not true for 80386 */ -#define WORDS_BIG_ENDIAN 0 - -/* number of bits in an addressable storage unit */ -#define BITS_PER_UNIT 8 - -/* Width in bits of a "word", which is the contents of a machine register. - Note that this is not necessarily the width of data type `int'; - if using 16-bit ints on a 80386, this would still be 32. - But on a machine with 16-bit registers, this would be 16. */ -#define BITS_PER_WORD 32 - -/* Width of a word, in units (bytes). */ -#define UNITS_PER_WORD 4 - -/* Width in bits of a pointer. - See also the macro `Pmode' defined below. */ -#define POINTER_SIZE 32 - -/* Allocation boundary (in *bits*) for storing arguments in argument list. */ -#define PARM_BOUNDARY 32 - -/* Boundary (in *bits*) on which the stack pointer must be aligned. */ -#define STACK_BOUNDARY 32 - -/* Boundary (in *bits*) on which the stack pointer preferrs to be - aligned; the compiler cannot rely on having this alignment. */ -#define PREFERRED_STACK_BOUNDARY i386_preferred_stack_boundary - -/* Allocation boundary (in *bits*) for the code of a function. - For i486, we get better performance by aligning to a cache - line (i.e. 16 byte) boundary. */ -#define FUNCTION_BOUNDARY (1 << (i386_align_funcs + 3)) - -/* Alignment of field after `int : 0' in a structure. */ - -#define EMPTY_FIELD_BOUNDARY 32 - -/* Minimum size in bits of the largest boundary to which any - and all fundamental data types supported by the hardware - might need to be aligned. No data type wants to be aligned - rounder than this. The i386 supports 64-bit floating point - quantities, but these can be aligned on any 32-bit boundary. - The published ABIs say that doubles should be aligned on word - boundaries, but the Pentium gets better performance with them - aligned on 64 bit boundaries. */ -#define BIGGEST_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32) - -/* If defined, a C expression to compute the alignment given to a - constant that is being placed in memory. CONSTANT is the constant - and ALIGN is the alignment that the object would ordinarily have. - The value of this macro is used instead of that alignment to align - the object. - - If this macro is not defined, then ALIGN is used. - - The typical use of this macro is to increase alignment for string - constants to be word aligned so that `strcpy' calls that copy - constants can be done inline. */ - -#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ - (TREE_CODE (EXP) == REAL_CST \ - ? ((TYPE_MODE (TREE_TYPE (EXP)) == DFmode && (ALIGN) < 64) \ - ? 64 \ - : (TYPE_MODE (TREE_TYPE (EXP)) == XFmode && (ALIGN) < 128) \ - ? 128 \ - : (ALIGN)) \ - : TREE_CODE (EXP) == STRING_CST \ - ? ((TREE_STRING_LENGTH (EXP) >= 31 && (ALIGN) < 256) \ - ? 256 \ - : (ALIGN)) \ - : (ALIGN)) - -/* If defined, a C expression to compute the alignment for a static - variable. TYPE is the data type, and ALIGN is the alignment that - the object would ordinarily have. The value of this macro is used - instead of that alignment to align the object. - - If this macro is not defined, then ALIGN is used. - - One use of this macro is to increase alignment of medium-size - data to make it all fit in fewer cache lines. Another is to - cause character arrays to be word-aligned so that `strcpy' calls - that copy constants to character arrays can be done inline. */ - -#define DATA_ALIGNMENT(TYPE, ALIGN) \ - ((AGGREGATE_TYPE_P (TYPE) \ - && TYPE_SIZE (TYPE) \ - && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \ - && (TREE_INT_CST_LOW (TYPE_SIZE (TYPE)) >= 256 \ - || TREE_INT_CST_HIGH (TYPE_SIZE (TYPE))) && (ALIGN) < 256) \ - ? 256 \ - : TREE_CODE (TYPE) == ARRAY_TYPE \ - ? ((TYPE_MODE (TREE_TYPE (TYPE)) == DFmode && (ALIGN) < 64) \ - ? 64 \ - : (TYPE_MODE (TREE_TYPE (TYPE)) == XFmode && (ALIGN) < 128) \ - ? 128 \ - : (ALIGN)) \ - : TREE_CODE (TYPE) == COMPLEX_TYPE \ - ? ((TYPE_MODE (TYPE) == DCmode && (ALIGN) < 64) \ - ? 64 \ - : (TYPE_MODE (TYPE) == XCmode && (ALIGN) < 128) \ - ? 128 \ - : (ALIGN)) \ - : ((TREE_CODE (TYPE) == RECORD_TYPE \ - || TREE_CODE (TYPE) == UNION_TYPE \ - || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \ - && TYPE_FIELDS (TYPE)) \ - ? ((DECL_MODE (TYPE_FIELDS (TYPE)) == DFmode && (ALIGN) < 64) \ - ? 64 \ - : (DECL_MODE (TYPE_FIELDS (TYPE)) == XFmode && (ALIGN) < 128) \ - ? 128 \ - : (ALIGN)) \ - : TREE_CODE (TYPE) == REAL_TYPE \ - ? ((TYPE_MODE (TYPE) == DFmode && (ALIGN) < 64) \ - ? 64 \ - : (TYPE_MODE (TYPE) == XFmode && (ALIGN) < 128) \ - ? 128 \ - : (ALIGN)) \ - : (ALIGN)) - -/* If defined, a C expression to compute the alignment for a local - variable. TYPE is the data type, and ALIGN is the alignment that - the object would ordinarily have. The value of this macro is used - instead of that alignment to align the object. - - If this macro is not defined, then ALIGN is used. - - One use of this macro is to increase alignment of medium-size - data to make it all fit in fewer cache lines. */ - -#define LOCAL_ALIGNMENT(TYPE, ALIGN) \ - (TREE_CODE (TYPE) == ARRAY_TYPE \ - ? ((TYPE_MODE (TREE_TYPE (TYPE)) == DFmode && (ALIGN) < 64) \ - ? 64 \ - : (TYPE_MODE (TREE_TYPE (TYPE)) == XFmode && (ALIGN) < 128) \ - ? 128 \ - : (ALIGN)) \ - : TREE_CODE (TYPE) == COMPLEX_TYPE \ - ? ((TYPE_MODE (TYPE) == DCmode && (ALIGN) < 64) \ - ? 64 \ - : (TYPE_MODE (TYPE) == XCmode && (ALIGN) < 128) \ - ? 128 \ - : (ALIGN)) \ - : ((TREE_CODE (TYPE) == RECORD_TYPE \ - || TREE_CODE (TYPE) == UNION_TYPE \ - || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \ - && TYPE_FIELDS (TYPE)) \ - ? ((DECL_MODE (TYPE_FIELDS (TYPE)) == DFmode && (ALIGN) < 64) \ - ? 64 \ - : (DECL_MODE (TYPE_FIELDS (TYPE)) == XFmode && (ALIGN) < 128) \ - ? 128 \ - : (ALIGN)) \ - : TREE_CODE (TYPE) == REAL_TYPE \ - ? ((TYPE_MODE (TYPE) == DFmode && (ALIGN) < 64) \ - ? 64 \ - : (TYPE_MODE (TYPE) == XFmode && (ALIGN) < 128) \ - ? 128 \ - : (ALIGN)) \ - : (ALIGN)) - -/* Set this non-zero if move instructions will actually fail to work - when given unaligned data. */ -#define STRICT_ALIGNMENT 0 - -/* If bit field type is int, don't let it cross an int, - and give entire struct the alignment of an int. */ -/* Required on the 386 since it doesn't have bitfield insns. */ -#define PCC_BITFIELD_TYPE_MATTERS 1 - -/* Maximum power of 2 that code can be aligned to. */ -#define MAX_CODE_ALIGN 6 /* 64 byte alignment */ - -/* Align loop starts for optimal branching. */ -#define LOOP_ALIGN(LABEL) (i386_align_loops) -#define LOOP_ALIGN_MAX_SKIP (i386_align_loops_string ? 0 : 7) - -/* This is how to align an instruction for optimal branching. - On i486 we'll get better performance by aligning on a - cache line (i.e. 16 byte) boundary. */ -#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (i386_align_jumps) -#define LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP (i386_align_jumps_string ? 0 : 7) - - -/* Standard register usage. */ - -/* This processor has special stack-like registers. See reg-stack.c - for details. */ - -#define STACK_REGS -#define IS_STACK_MODE(mode) (mode==DFmode || mode==SFmode || mode==XFmode) - -/* Number of actual hardware registers. - The hardware registers are assigned numbers for the compiler - from 0 to just below FIRST_PSEUDO_REGISTER. - All registers that the compiler knows about must be given numbers, - even those that are not normally considered general registers. - - In the 80386 we give the 8 general purpose registers the numbers 0-7. - We number the floating point registers 8-15. - Note that registers 0-7 can be accessed as a short or int, - while only 0-3 may be used with byte `mov' instructions. - - Reg 16 does not correspond to any hardware register, but instead - appears in the RTL as an argument pointer prior to reload, and is - eliminated during reloading in favor of either the stack or frame - pointer. */ - -#define FIRST_PSEUDO_REGISTER 17 - -/* 1 for registers that have pervasive standard uses - and are not available for the register allocator. - On the 80386, the stack pointer is such, as is the arg pointer. */ -#define FIXED_REGISTERS \ -/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \ -{ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 } - -/* 1 for registers not available across function calls. - These must include the FIXED_REGISTERS and also any - registers that can be used without being saved. - The latter must include the registers where values are returned - and the register where structure-value addresses are passed. - Aside from that, you can include as many other registers as you like. */ - -#define CALL_USED_REGISTERS \ -/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \ -{ 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } - -/* Order in which to allocate registers. Each register must be - listed once, even those in FIXED_REGISTERS. List frame pointer - late and fixed registers last. Note that, in general, we prefer - registers listed in CALL_USED_REGISTERS, keeping the others - available for storage of persistent values. - - Three different versions of REG_ALLOC_ORDER have been tried: - - If the order is edx, ecx, eax, ... it produces a slightly faster compiler, - but slower code on simple functions returning values in eax. - - If the order is eax, ecx, edx, ... it causes reload to abort when compiling - perl 4.036 due to not being able to create a DImode register (to hold a 2 - word union). - - If the order is eax, edx, ecx, ... it produces better code for simple - functions, and a slightly slower compiler. Users complained about the code - generated by allocating edx first, so restore the 'natural' order of things. */ - -#define REG_ALLOC_ORDER \ -/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \ -{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } - -/* A C statement (sans semicolon) to choose the order in which to - allocate hard registers for pseudo-registers local to a basic - block. - - Store the desired register order in the array `reg_alloc_order'. - Element 0 should be the register to allocate first; element 1, the - next register; and so on. - - The macro body should not assume anything about the contents of - `reg_alloc_order' before execution of the macro. - - On most machines, it is not necessary to define this macro. */ - -#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc () - -/* Macro to conditionally modify fixed_regs/call_used_regs. */ -#define CONDITIONAL_REGISTER_USAGE \ - { \ - if (flag_pic) \ - { \ - fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ - call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ - } \ - if (! TARGET_80387 && ! TARGET_FLOAT_RETURNS_IN_80387) \ - { \ - int i; \ - HARD_REG_SET x; \ - COPY_HARD_REG_SET (x, reg_class_contents[(int)FLOAT_REGS]); \ - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \ - if (TEST_HARD_REG_BIT (x, i)) \ - fixed_regs[i] = call_used_regs[i] = 1; \ - } \ - } - -/* Return number of consecutive hard regs needed starting at reg REGNO - to hold something of mode MODE. - This is ordinarily the length in words of a value of mode MODE - but can be less for certain modes in special long registers. - - Actually there are no two word move instructions for consecutive - registers. And only registers 0-3 may have mov byte instructions - applied to them. - */ - -#define HARD_REGNO_NREGS(REGNO, MODE) \ - (FP_REGNO_P (REGNO) ? 1 \ - : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)) - -/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. - On the 80386, the first 4 cpu registers can hold any mode - while the floating point registers may hold only floating point. - Make it clear that the fp regs could not hold a 16-byte float. */ - -/* The casts to int placate a compiler on a microvax, - for cross-compiler testing. */ - -#define HARD_REGNO_MODE_OK(REGNO, MODE) \ - ((REGNO) < 4 ? 1 \ - : FP_REGNO_P (REGNO) \ - ? (((int) GET_MODE_CLASS (MODE) == (int) MODE_FLOAT \ - || (int) GET_MODE_CLASS (MODE) == (int) MODE_COMPLEX_FLOAT) \ - && GET_MODE_UNIT_SIZE (MODE) <= (LONG_DOUBLE_TYPE_SIZE == 96 ? 12 : 8))\ - : (int) (MODE) != (int) QImode ? 1 \ - : (reload_in_progress | reload_completed) == 1) - -/* Value is 1 if it is a good idea to tie two pseudo registers - when one has mode MODE1 and one has mode MODE2. - If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, - for any hard reg, then this must be 0 for correct output. */ - -#define MODES_TIEABLE_P(MODE1, MODE2) \ - ((MODE1) == (MODE2) \ - || ((MODE1) == SImode && (MODE2) == HImode) \ - || ((MODE1) == HImode && (MODE2) == SImode)) - -/* Specify the registers used for certain standard purposes. - The values of these macros are register numbers. */ - -/* on the 386 the pc register is %eip, and is not usable as a general - register. The ordinary mov instructions won't work */ -/* #define PC_REGNUM */ - -/* Register to use for pushing function arguments. */ -#define STACK_POINTER_REGNUM 7 - -/* Base register for access to local variables of the function. */ -#define FRAME_POINTER_REGNUM 6 - -/* First floating point reg */ -#define FIRST_FLOAT_REG 8 - -/* First & last stack-like regs */ -#define FIRST_STACK_REG FIRST_FLOAT_REG -#define LAST_STACK_REG (FIRST_FLOAT_REG + 7) - -/* Value should be nonzero if functions must have frame pointers. - Zero means the frame pointer need not be set up (and parms - may be accessed via the stack pointer) in functions that seem suitable. - This is computed in `reload', in reload1.c. */ -#define FRAME_POINTER_REQUIRED (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ()) - -/* Base register for access to arguments of the function. */ -#define ARG_POINTER_REGNUM 16 - -/* Register in which static-chain is passed to a function. */ -#define STATIC_CHAIN_REGNUM 2 - -/* Register to hold the addressing base for position independent - code access to data items. */ -#define PIC_OFFSET_TABLE_REGNUM 3 - -/* Register in which address to store a structure value - arrives in the function. On the 386, the prologue - copies this from the stack to register %eax. */ -#define STRUCT_VALUE_INCOMING 0 - -/* Place in which caller passes the structure value address. - 0 means push the value on the stack like an argument. */ -#define STRUCT_VALUE 0 - -/* A C expression which can inhibit the returning of certain function - values in registers, based on the type of value. A nonzero value - says to return the function value in memory, just as large - structures are always returned. Here TYPE will be a C expression - of type `tree', representing the data type of the value. - - Note that values of mode `BLKmode' must be explicitly handled by - this macro. Also, the option `-fpcc-struct-return' takes effect - regardless of this macro. On most systems, it is possible to - leave the macro undefined; this causes a default definition to be - used, whose value is the constant 1 for `BLKmode' values, and 0 - otherwise. - - Do not use this macro to indicate that structures and unions - should always be returned in memory. You should instead use - `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */ - -#define RETURN_IN_MEMORY(TYPE) \ - ((TYPE_MODE (TYPE) == BLKmode) || int_size_in_bytes (TYPE) > 12) - - -/* Define the classes of registers for register constraints in the - machine description. Also define ranges of constants. - - One of the classes must always be named ALL_REGS and include all hard regs. - If there is more than one class, another class must be named NO_REGS - and contain no registers. - - The name GENERAL_REGS must be the name of a class (or an alias for - another name such as ALL_REGS). This is the class of registers - that is allowed by "g" or "r" in a register constraint. - Also, registers outside this class are allocated only when - instructions express preferences for them. - - The classes must be numbered in nondecreasing order; that is, - a larger-numbered class must never be contained completely - in a smaller-numbered class. - - For any two classes, it is very desirable that there be another - class that represents their union. - - It might seem that class BREG is unnecessary, since no useful 386 - opcode needs reg %ebx. But some systems pass args to the OS in ebx, - and the "b" register constraint is useful in asms for syscalls. */ - -enum reg_class -{ - NO_REGS, - AREG, DREG, CREG, BREG, - AD_REGS, /* %eax/%edx for DImode */ - Q_REGS, /* %eax %ebx %ecx %edx */ - SIREG, DIREG, - INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */ - GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */ - FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */ - FLOAT_REGS, - ALL_REGS, LIM_REG_CLASSES -}; - -#define N_REG_CLASSES (int) LIM_REG_CLASSES - -#define FLOAT_CLASS_P(CLASS) (reg_class_subset_p (CLASS, FLOAT_REGS)) - -/* Give names of register classes as strings for dump file. */ - -#define REG_CLASS_NAMES \ -{ "NO_REGS", \ - "AREG", "DREG", "CREG", "BREG", \ - "AD_REGS", \ - "Q_REGS", \ - "SIREG", "DIREG", \ - "INDEX_REGS", \ - "GENERAL_REGS", \ - "FP_TOP_REG", "FP_SECOND_REG", \ - "FLOAT_REGS", \ - "ALL_REGS" } - -/* Define which registers fit in which classes. - This is an initializer for a vector of HARD_REG_SET - of length N_REG_CLASSES. */ - -#define REG_CLASS_CONTENTS \ -{ {0}, \ - {0x1}, {0x2}, {0x4}, {0x8}, /* AREG, DREG, CREG, BREG */ \ - {0x3}, /* AD_REGS */ \ - {0xf}, /* Q_REGS */ \ - {0x10}, {0x20}, /* SIREG, DIREG */ \ - {0x7f}, /* INDEX_REGS */ \ - {0x100ff}, /* GENERAL_REGS */ \ - {0x0100}, {0x0200}, /* FP_TOP_REG, FP_SECOND_REG */ \ - {0xff00}, /* FLOAT_REGS */ \ - {0x1ffff}} - -/* The same information, inverted: - Return the class number of the smallest class containing - reg number REGNO. This could be a conditional expression - or could index an array. */ - -#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO]) - -/* When defined, the compiler allows registers explicitly used in the - rtl to be used as spill registers but prevents the compiler from - extending the lifetime of these registers. */ - -#define SMALL_REGISTER_CLASSES 1 - -#define QI_REG_P(X) \ - (REG_P (X) && REGNO (X) < 4) -#define NON_QI_REG_P(X) \ - (REG_P (X) && REGNO (X) >= 4 && REGNO (X) < FIRST_PSEUDO_REGISTER) - -#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X))) -#define FP_REGNO_P(n) ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) - -#define STACK_REG_P(xop) (REG_P (xop) && \ - REGNO (xop) >= FIRST_STACK_REG && \ - REGNO (xop) <= LAST_STACK_REG) - -#define NON_STACK_REG_P(xop) (REG_P (xop) && ! STACK_REG_P (xop)) - -#define STACK_TOP_P(xop) (REG_P (xop) && REGNO (xop) == FIRST_STACK_REG) - -/* 1 if register REGNO can magically overlap other regs. - Note that nonzero values work only in very special circumstances. */ - -/* #define OVERLAPPING_REGNO_P(REGNO) FP_REGNO_P (REGNO) */ - -/* The class value for index registers, and the one for base regs. */ - -#define INDEX_REG_CLASS INDEX_REGS -#define BASE_REG_CLASS GENERAL_REGS - -/* Get reg_class from a letter such as appears in the machine description. */ - -#define REG_CLASS_FROM_LETTER(C) \ - ((C) == 'r' ? GENERAL_REGS : \ - (C) == 'q' ? Q_REGS : \ - (C) == 'f' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \ - ? FLOAT_REGS \ - : NO_REGS) : \ - (C) == 't' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \ - ? FP_TOP_REG \ - : NO_REGS) : \ - (C) == 'u' ? (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 \ - ? FP_SECOND_REG \ - : NO_REGS) : \ - (C) == 'a' ? AREG : \ - (C) == 'b' ? BREG : \ - (C) == 'c' ? CREG : \ - (C) == 'd' ? DREG : \ - (C) == 'A' ? AD_REGS : \ - (C) == 'D' ? DIREG : \ - (C) == 'S' ? SIREG : NO_REGS) - -/* The letters I, J, K, L and M in a register constraint string - can be used to stand for particular ranges of immediate operands. - This macro defines what the ranges are. - C is the letter, and VALUE is a constant value. - Return 1 if VALUE is in the range specified by C. - - I is for non-DImode shifts. - J is for DImode shifts. - K and L are for an `andsi' optimization. - M is for shifts that can be executed by the "lea" opcode. - */ - -#define CONST_OK_FOR_LETTER_P(VALUE, C) \ - ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 31 : \ - (C) == 'J' ? (VALUE) >= 0 && (VALUE) <= 63 : \ - (C) == 'K' ? (VALUE) == 0xff : \ - (C) == 'L' ? (VALUE) == 0xffff : \ - (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3 : \ - (C) == 'N' ? (VALUE) >= 0 && (VALUE) <= 255 :\ - (C) == 'O' ? (VALUE) >= 0 && (VALUE) <= 32 : \ - 0) - -/* Similar, but for floating constants, and defining letters G and H. - Here VALUE is the CONST_DOUBLE rtx itself. We allow constants even if - TARGET_387 isn't set, because the stack register converter may need to - load 0.0 into the function value register. */ - -#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ - ((C) == 'G' ? standard_80387_constant_p (VALUE) : 0) - -/* Place additional restrictions on the register class to use when it - is necessary to be able to hold a value of mode MODE in a reload - register for which class CLASS would ordinarily be used. */ - -#define LIMIT_RELOAD_CLASS(MODE, CLASS) \ - ((MODE) == QImode && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS) \ - ? Q_REGS : (CLASS)) - -/* Given an rtx X being reloaded into a reg required to be - in class CLASS, return the class of reg to actually use. - In general this is just CLASS; but on some machines - in some cases it is preferable to use a more restrictive class. - On the 80386 series, we prevent floating constants from being - reloaded into floating registers (since no move-insn can do that) - and we ensure that QImodes aren't reloaded into the esi or edi reg. */ - -/* Put float CONST_DOUBLE in the constant pool instead of fp regs. - QImode must go into class Q_REGS. - Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and - movdf to do mem-to-mem moves through integer regs. */ - -#define PREFERRED_RELOAD_CLASS(X,CLASS) \ - (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode \ - ? (standard_80387_constant_p (X) \ - ? reg_class_subset_p (CLASS, FLOAT_REGS) ? CLASS : FLOAT_REGS \ - : NO_REGS) \ - : GET_MODE (X) == QImode && ! reg_class_subset_p (CLASS, Q_REGS) ? Q_REGS \ - : ((CLASS) == ALL_REGS \ - && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) ? GENERAL_REGS \ - : (CLASS)) - -/* If we are copying between general and FP registers, we need a memory - location. */ - -#define SECONDARY_MEMORY_NEEDED(CLASS1,CLASS2,MODE) \ - ((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \ - || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2))) - -/* Return the maximum number of consecutive registers - needed to represent mode MODE in a register of class CLASS. */ -/* On the 80386, this is the size of MODE in words, - except in the FP regs, where a single reg is always enough. */ -#define CLASS_MAX_NREGS(CLASS, MODE) \ - (FLOAT_CLASS_P (CLASS) ? 1 : \ - ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)) - -/* A C expression whose value is nonzero if pseudos that have been - assigned to registers of class CLASS would likely be spilled - because registers of CLASS are needed for spill registers. - - The default value of this macro returns 1 if CLASS has exactly one - register and zero otherwise. On most machines, this default - should be used. Only define this macro to some other expression - if pseudo allocated by `local-alloc.c' end up in memory because - their hard registers were needed for spill registers. If this - macro returns nonzero for those classes, those pseudos will only - be allocated by `global.c', which knows how to reallocate the - pseudo to another register. If there would not be another - register available for reallocation, you should not change the - definition of this macro since the only effect of such a - definition would be to slow down register allocation. */ - -#define CLASS_LIKELY_SPILLED_P(CLASS) \ - (((CLASS) == AREG) \ - || ((CLASS) == DREG) \ - || ((CLASS) == CREG) \ - || ((CLASS) == BREG) \ - || ((CLASS) == AD_REGS) \ - || ((CLASS) == SIREG) \ - || ((CLASS) == DIREG)) - - -/* Stack layout; function entry, exit and calling. */ - -/* Define this if pushing a word on the stack - makes the stack pointer a smaller address. */ -#define STACK_GROWS_DOWNWARD - -/* Define this if the nominal address of the stack frame - is at the high-address end of the local variables; - that is, each additional local variable allocated - goes at a more negative offset in the frame. */ -#define FRAME_GROWS_DOWNWARD - -/* Offset within stack frame to start allocating local variables at. - If FRAME_GROWS_DOWNWARD, this is the offset to the END of the - first local allocated. Otherwise, it is the offset to the BEGINNING - of the first local allocated. */ -#define STARTING_FRAME_OFFSET 0 - -/* If we generate an insn to push BYTES bytes, - this says how many the stack pointer really advances by. - On 386 pushw decrements by exactly 2 no matter what the position was. - On the 386 there is no pushb; we use pushw instead, and this - has the effect of rounding up to 2. */ - -#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & (-2)) - -/* Offset of first parameter from the argument pointer register value. */ -#define FIRST_PARM_OFFSET(FNDECL) 0 - -/* Value is the number of bytes of arguments automatically - popped when returning from a subroutine call. - FUNDECL is the declaration node of the function (as a tree), - FUNTYPE is the data type of the function (as a tree), - or for a library call it is an identifier node for the subroutine name. - SIZE is the number of bytes of arguments passed on the stack. - - On the 80386, the RTD insn may be used to pop them if the number - of args is fixed, but if the number is variable then the caller - must pop them all. RTD can't be used for library calls now - because the library is compiled with the Unix compiler. - Use of RTD is a selectable option, since it is incompatible with - standard Unix calling sequences. If the option is not selected, - the caller must always pop the args. - - The attribute stdcall is equivalent to RTD on a per module basis. */ - -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ - (i386_return_pops_args (FUNDECL, FUNTYPE, SIZE)) - -/* Define how to find the value returned by a function. - VALTYPE is the data type of the value (as a tree). - If the precise function being called is known, FUNC is its FUNCTION_DECL; - otherwise, FUNC is 0. */ -#define FUNCTION_VALUE(VALTYPE, FUNC) \ - gen_rtx_REG (TYPE_MODE (VALTYPE), \ - VALUE_REGNO (TYPE_MODE (VALTYPE))) - -/* Define how to find the value returned by a library function - assuming the value has mode MODE. */ - -#define LIBCALL_VALUE(MODE) \ - gen_rtx_REG (MODE, VALUE_REGNO (MODE)) - -/* Define the size of the result block used for communication between - untyped_call and untyped_return. The block contains a DImode value - followed by the block used by fnsave and frstor. */ - -#define APPLY_RESULT_SIZE (8+108) - -/* 1 if N is a possible register number for function argument passing. */ -#define FUNCTION_ARG_REGNO_P(N) ((N) >= 0 && (N) < REGPARM_MAX) - -/* Define a data type for recording info about an argument list - during the scan of that argument list. This data type should - hold all necessary information about the function itself - and about the args processed so far, enough to enable macros - such as FUNCTION_ARG to determine where the next arg should go. */ - -typedef struct i386_args { - int words; /* # words passed so far */ - int nregs; /* # registers available for passing */ - int regno; /* next available register number */ -} CUMULATIVE_ARGS; - -/* Initialize a variable CUM of type CUMULATIVE_ARGS - for a call to a function whose data type is FNTYPE. - For a library call, FNTYPE is 0. */ - -#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \ - (init_cumulative_args (&CUM, FNTYPE, LIBNAME)) - -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ - -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - (function_arg_advance (&CUM, MODE, TYPE, NAMED)) - -/* Define where to put the arguments to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - MODE is the argument's machine mode. - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). */ - -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - (function_arg (&CUM, MODE, TYPE, NAMED)) - -/* For an arg passed partly in registers and partly in memory, - this is the number of registers used. - For args passed entirely in registers or entirely in memory, zero. */ - -#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ - (function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)) - -/* This macro is invoked just before the start of a function. - It is used here to output code for -fpic that will load the - return address into %ebx. */ - -#undef ASM_OUTPUT_FUNCTION_PREFIX -#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME) \ - asm_output_function_prefix (FILE, FNNAME) - -/* This macro generates the assembly code for function entry. - FILE is a stdio stream to output the code to. - SIZE is an int: how many units of temporary storage to allocate. - Refer to the array `regs_ever_live' to determine which registers - to save; `regs_ever_live[I]' is nonzero if register number I - is ever used in the function. This macro is responsible for - knowing which registers should not be saved even if used. */ - -#define FUNCTION_PROLOGUE(FILE, SIZE) \ - function_prologue (FILE, SIZE) - -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. */ - -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - { \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ - LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall *_mcount@GOT(%%ebx)\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall _mcount\n"); \ - } \ -} - - -/* There are three profiling modes for basic blocks available. - The modes are selected at compile time by using the options - -a or -ax of the gnu compiler. - The variable `profile_block_flag' will be set according to the - selected option. - - profile_block_flag == 0, no option used: - - No profiling done. - - profile_block_flag == 1, -a option used. - - Count frequency of execution of every basic block. - - profile_block_flag == 2, -ax option used. - - Generate code to allow several different profiling modes at run time. - Available modes are: - Produce a trace of all basic blocks. - Count frequency of jump instructions executed. - In every mode it is possible to start profiling upon entering - certain functions and to disable profiling of some other functions. - - The result of basic-block profiling will be written to a file `bb.out'. - If the -ax option is used parameters for the profiling will be read - from file `bb.in'. - -*/ - -/* The following macro shall output assembler code to FILE - to initialize basic-block profiling. - - If profile_block_flag == 2 - - Output code to call the subroutine `__bb_init_trace_func' - and pass two parameters to it. The first parameter is - the address of a block allocated in the object module. - The second parameter is the number of the first basic block - of the function. - - The name of the block is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - The number of the first basic block of the function is - passed to the macro in BLOCK_OR_LABEL. - - If described in a virtual assembler language the code to be - output looks like: - - parameter1 <- LPBX0 - parameter2 <- BLOCK_OR_LABEL - call __bb_init_trace_func - - else if profile_block_flag != 0 - - Output code to call the subroutine `__bb_init_func' - and pass one single parameter to it, which is the same - as the first parameter to `__bb_init_trace_func'. - - The first word of this parameter is a flag which will be nonzero if - the object module has already been initialized. So test this word - first, and do not call `__bb_init_func' if the flag is nonzero. - Note: When profile_block_flag == 2 the test need not be done - but `__bb_init_trace_func' *must* be called. - - BLOCK_OR_LABEL may be used to generate a label number as a - branch destination in case `__bb_init_func' will not be called. - - If described in a virtual assembler language the code to be - output looks like: - - cmp (LPBX0),0 - jne local_label - parameter1 <- LPBX0 - call __bb_init_func -local_label: - -*/ - -#undef FUNCTION_BLOCK_PROFILER -#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \ -do \ - { \ - static int num_func = 0; \ - rtx xops[8]; \ - char block_table[80], false_label[80]; \ - \ - ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); \ - \ - xops[1] = gen_rtx_SYMBOL_REF (VOIDmode, block_table); \ - xops[5] = stack_pointer_rtx; \ - xops[7] = gen_rtx_REG (Pmode, 0); /* eax */ \ - \ - CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; \ - \ - switch (profile_block_flag) \ - { \ - \ - case 2: \ - \ - xops[2] = GEN_INT ((BLOCK_OR_LABEL)); \ - xops[3] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, "__bb_init_trace_func")); \ - xops[6] = GEN_INT (8); \ - \ - output_asm_insn (AS1(push%L2,%2), xops); \ - if (!flag_pic) \ - output_asm_insn (AS1(push%L1,%1), xops); \ - else \ - { \ - output_asm_insn (AS2 (lea%L7,%a1,%7), xops); \ - output_asm_insn (AS1 (push%L7,%7), xops); \ - } \ - \ - output_asm_insn (AS1(call,%P3), xops); \ - output_asm_insn (AS2(add%L0,%6,%5), xops); \ - \ - break; \ - \ - default: \ - \ - ASM_GENERATE_INTERNAL_LABEL (false_label, "LPBZ", num_func); \ - \ - xops[0] = const0_rtx; \ - xops[2] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, false_label)); \ - xops[3] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, "__bb_init_func")); \ - xops[4] = gen_rtx_MEM (Pmode, xops[1]); \ - xops[6] = GEN_INT (4); \ - \ - CONSTANT_POOL_ADDRESS_P (xops[2]) = TRUE; \ - \ - output_asm_insn (AS2(cmp%L4,%0,%4), xops); \ - output_asm_insn (AS1(jne,%2), xops); \ - \ - if (!flag_pic) \ - output_asm_insn (AS1(push%L1,%1), xops); \ - else \ - { \ - output_asm_insn (AS2 (lea%L7,%a1,%7), xops); \ - output_asm_insn (AS1 (push%L7,%7), xops); \ - } \ - \ - output_asm_insn (AS1(call,%P3), xops); \ - output_asm_insn (AS2(add%L0,%6,%5), xops); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "LPBZ", num_func); \ - num_func++; \ - \ - break; \ - \ - } \ - } \ -while (0) - -/* The following macro shall output assembler code to FILE - to increment a counter associated with basic block number BLOCKNO. - - If profile_block_flag == 2 - - Output code to initialize the global structure `__bb' and - call the function `__bb_trace_func' which will increment the - counter. - - `__bb' consists of two words. In the first word the number - of the basic block has to be stored. In the second word - the address of a block allocated in the object module - has to be stored. - - The basic block number is given by BLOCKNO. - - The address of the block is given by the label created with - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - by FUNCTION_BLOCK_PROFILER. - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language the code to be - output looks like: - - move BLOCKNO -> (__bb) - move LPBX0 -> (__bb+4) - call __bb_trace_func - - Note that function `__bb_trace_func' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE - and MACHINE_STATE_RESTORE. The last two macros will be - used in the function `__bb_trace_func', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE. - - else if profile_block_flag != 0 - - Output code to increment the counter directly. - Basic blocks are numbered separately from zero within each - compiled object module. The count associated with block number - BLOCKNO is at index BLOCKNO in an array of words; the name of - this array is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language the code to be - output looks like: - - inc (LPBX2+4*BLOCKNO) - -*/ - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ -do \ - { \ - rtx xops[8], cnt_rtx; \ - char counts[80]; \ - char *block_table = counts; \ - \ - switch (profile_block_flag) \ - { \ - \ - case 2: \ - \ - ASM_GENERATE_INTERNAL_LABEL (block_table, "LPBX", 0); \ - \ - xops[1] = gen_rtx_SYMBOL_REF (VOIDmode, block_table); \ - xops[2] = GEN_INT ((BLOCKNO)); \ - xops[3] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_func")); \ - xops[4] = gen_rtx_SYMBOL_REF (VOIDmode, "__bb"); \ - xops[5] = plus_constant (xops[4], 4); \ - xops[0] = gen_rtx_MEM (SImode, xops[4]); \ - xops[6] = gen_rtx_MEM (SImode, xops[5]); \ - \ - CONSTANT_POOL_ADDRESS_P (xops[1]) = TRUE; \ - \ - fprintf(FILE, "\tpushf\n"); \ - output_asm_insn (AS2(mov%L0,%2,%0), xops); \ - if (flag_pic) \ - { \ - xops[7] = gen_rtx_REG (Pmode, 0); /* eax */ \ - output_asm_insn (AS1(push%L7,%7), xops); \ - output_asm_insn (AS2(lea%L7,%a1,%7), xops); \ - output_asm_insn (AS2(mov%L6,%7,%6), xops); \ - output_asm_insn (AS1(pop%L7,%7), xops); \ - } \ - else \ - output_asm_insn (AS2(mov%L6,%1,%6), xops); \ - output_asm_insn (AS1(call,%P3), xops); \ - fprintf(FILE, "\tpopf\n"); \ - \ - break; \ - \ - default: \ - \ - ASM_GENERATE_INTERNAL_LABEL (counts, "LPBX", 2); \ - cnt_rtx = gen_rtx_SYMBOL_REF (VOIDmode, counts); \ - SYMBOL_REF_FLAG (cnt_rtx) = TRUE; \ - \ - if (BLOCKNO) \ - cnt_rtx = plus_constant (cnt_rtx, (BLOCKNO)*4); \ - \ - if (flag_pic) \ - cnt_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, cnt_rtx); \ - \ - xops[0] = gen_rtx_MEM (SImode, cnt_rtx); \ - output_asm_insn (AS1(inc%L0,%0), xops); \ - \ - break; \ - \ - } \ - } \ -while (0) - -/* The following macro shall output assembler code to FILE - to indicate a return from function during basic-block profiling. - - If profiling_block_flag == 2: - - Output assembler code to call function `__bb_trace_ret'. - - Note that function `__bb_trace_ret' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE_RET - and MACHINE_STATE_RESTORE_RET. The last two macros will be - used in the function `__bb_trace_ret', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE_RET. - - else if profiling_block_flag != 0: - - The macro will not be used, so it need not distinguish - these cases. -*/ - -#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \ -do \ - { \ - rtx xops[1]; \ - \ - xops[0] = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (VOIDmode, "__bb_trace_ret")); \ - \ - output_asm_insn (AS1(call,%P0), xops); \ - \ - } \ -while (0) - -/* The function `__bb_trace_func' is called in every basic block - and is not allowed to change the machine state. Saving (restoring) - the state can either be done in the BLOCK_PROFILER macro, - before calling function (rsp. after returning from function) - `__bb_trace_func', or it can be done inside the function by - defining the macros: - - MACHINE_STATE_SAVE(ID) - MACHINE_STATE_RESTORE(ID) - - In the latter case care must be taken, that the prologue code - of function `__bb_trace_func' does not already change the - state prior to saving it with MACHINE_STATE_SAVE. - - The parameter `ID' is a string identifying a unique macro use. - - On the i386 the initialization code at the begin of - function `__bb_trace_func' contains a `sub' instruction - therefore we handle save and restore of the flag register - in the BLOCK_PROFILER macro. */ - -#define MACHINE_STATE_SAVE(ID) \ - asm (" pushl %eax"); \ - asm (" pushl %ecx"); \ - asm (" pushl %edx"); \ - asm (" pushl %esi"); - -#define MACHINE_STATE_RESTORE(ID) \ - asm (" popl %esi"); \ - asm (" popl %edx"); \ - asm (" popl %ecx"); \ - asm (" popl %eax"); - -/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, - the stack pointer does not matter. The value is tested only in - functions that have frame pointers. - No definition is equivalent to always zero. */ -/* Note on the 386 it might be more efficient not to define this since - we have to restore it ourselves from the frame pointer, in order to - use pop */ - -#define EXIT_IGNORE_STACK 1 - -/* This macro generates the assembly code for function exit, - on machines that need it. If FUNCTION_EPILOGUE is not defined - then individual return instructions are generated for each - return statement. Args are same as for FUNCTION_PROLOGUE. - - The function epilogue should not depend on the current stack pointer! - It should use the frame pointer only. This is mandatory because - of alloca; we also take advantage of it to omit stack adjustments - before returning. - - If the last non-note insn in the function is a BARRIER, then there - is no need to emit a function prologue, because control does not fall - off the end. This happens if the function ends in an "exit" call, or - if a `return' insn is emitted directly into the function. */ - -#if 0 -#define FUNCTION_BEGIN_EPILOGUE(FILE) \ -do { \ - rtx last = get_last_insn (); \ - if (last && GET_CODE (last) == NOTE) \ - last = prev_nonnote_insn (last); \ -/* if (! last || GET_CODE (last) != BARRIER) \ - function_epilogue (FILE, SIZE);*/ \ -} while (0) -#endif - -#define FUNCTION_EPILOGUE(FILE, SIZE) \ - function_epilogue (FILE, SIZE) - -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. */ - -/* On the 386, the trampoline contains two instructions: - mov #STATIC,ecx - jmp FUNCTION - The trampoline is generated entirely at runtime. The operand of JMP - is the address of FUNCTION relative to the instruction following the - JMP (which is 5 bytes long). */ - -/* Length in units of the trampoline for entering a nested function. */ - -#define TRAMPOLINE_SIZE 10 - -/* Emit RTL insns to initialize the variable parts of a trampoline. - FNADDR is an RTX for the address of the function's pure code. - CXT is an RTX for the static chain value for the function. */ - -#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ -{ \ - /* Compute offset from the end of the jmp to the target function. */ \ - rtx disp = expand_binop (SImode, sub_optab, FNADDR, \ - plus_constant (TRAMP, 10), \ - NULL_RTX, 1, OPTAB_DIRECT); \ - emit_move_insn (gen_rtx_MEM (QImode, TRAMP), GEN_INT (0xb9)); \ - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 1)), CXT); \ - emit_move_insn (gen_rtx_MEM (QImode, plus_constant (TRAMP, 5)), GEN_INT (0xe9));\ - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 6)), disp); \ -} - -/* Definitions for register eliminations. - - This is an array of structures. Each structure initializes one pair - of eliminable registers. The "from" register number is given first, - followed by "to". Eliminations of the same "from" register are listed - in order of preference. - - We have two registers that can be eliminated on the i386. First, the - frame pointer register can often be eliminated in favor of the stack - pointer register. Secondly, the argument pointer register can always be - eliminated; it is replaced with either the stack or frame pointer. */ - -#define ELIMINABLE_REGS \ -{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ - { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ - { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} - -/* Given FROM and TO register numbers, say whether this elimination is allowed. - Frame pointer elimination is automatically handled. - - For the i386, if frame pointer elimination is being done, we would like to - convert ap into sp, not fp. - - All other eliminations are valid. */ - -#define CAN_ELIMINATE(FROM, TO) \ - ((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \ - ? ! frame_pointer_needed \ - : 1) - -/* Define the offset between two registers, one to be eliminated, and the other - its replacement, at the start of a routine. */ - -#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ -{ \ - if ((FROM) == ARG_POINTER_REGNUM && (TO) == FRAME_POINTER_REGNUM) \ - (OFFSET) = 8; /* Skip saved PC and previous frame pointer */ \ - else \ - { \ - int nregs; \ - int offset; \ - int preferred_alignment = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT; \ - HOST_WIDE_INT tsize = ix86_compute_frame_size (get_frame_size (), \ - &nregs); \ - \ - (OFFSET) = (tsize + nregs * UNITS_PER_WORD); \ - \ - offset = 4; \ - if (frame_pointer_needed) \ - offset += UNITS_PER_WORD; \ - \ - if ((FROM) == ARG_POINTER_REGNUM) \ - (OFFSET) += offset; \ - else \ - (OFFSET) -= ((offset + preferred_alignment - 1) \ - & -preferred_alignment) - offset; \ - } \ -} - -/* Addressing modes, and classification of registers for them. */ - -/* #define HAVE_POST_INCREMENT 0 */ -/* #define HAVE_POST_DECREMENT 0 */ - -/* #define HAVE_PRE_DECREMENT 0 */ -/* #define HAVE_PRE_INCREMENT 0 */ - -/* Macros to check register numbers against specific register classes. */ - -/* These assume that REGNO is a hard or pseudo reg number. - They give nonzero only if REGNO is a hard reg of the suitable class - or a pseudo reg currently allocated to a suitable hard reg. - Since they use reg_renumber, they are safe only once reg_renumber - has been allocated, which happens in local-alloc.c. */ - -#define REGNO_OK_FOR_INDEX_P(REGNO) \ - ((REGNO) < STACK_POINTER_REGNUM \ - || (unsigned) reg_renumber[REGNO] < STACK_POINTER_REGNUM) - -#define REGNO_OK_FOR_BASE_P(REGNO) \ - ((REGNO) <= STACK_POINTER_REGNUM \ - || (REGNO) == ARG_POINTER_REGNUM \ - || (unsigned) reg_renumber[REGNO] <= STACK_POINTER_REGNUM) - -#define REGNO_OK_FOR_SIREG_P(REGNO) ((REGNO) == 4 || reg_renumber[REGNO] == 4) -#define REGNO_OK_FOR_DIREG_P(REGNO) ((REGNO) == 5 || reg_renumber[REGNO] == 5) - -/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx - and check its validity for a certain class. - We have two alternate definitions for each of them. - The usual definition accepts all pseudo regs; the other rejects - them unless they have been allocated suitable hard regs. - The symbol REG_OK_STRICT causes the latter definition to be used. - - Most source files want to accept pseudo regs in the hope that - they will get allocated to the class that the insn wants them to be in. - Source files for reload pass need to be strict. - After reload, it makes no difference, since pseudo regs have - been eliminated by then. */ - - -/* Non strict versions, pseudos are ok */ -#define REG_OK_FOR_INDEX_NONSTRICT_P(X) \ - (REGNO (X) < STACK_POINTER_REGNUM \ - || REGNO (X) >= FIRST_PSEUDO_REGISTER) - -#define REG_OK_FOR_BASE_NONSTRICT_P(X) \ - (REGNO (X) <= STACK_POINTER_REGNUM \ - || REGNO (X) == ARG_POINTER_REGNUM \ - || REGNO (X) >= FIRST_PSEUDO_REGISTER) - -#define REG_OK_FOR_STRREG_NONSTRICT_P(X) \ - (REGNO (X) == 4 || REGNO (X) == 5 || REGNO (X) >= FIRST_PSEUDO_REGISTER) - -/* Strict versions, hard registers only */ -#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) -#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) -#define REG_OK_FOR_STRREG_STRICT_P(X) \ - (REGNO_OK_FOR_DIREG_P (REGNO (X)) || REGNO_OK_FOR_SIREG_P (REGNO (X))) - -#ifndef REG_OK_STRICT -#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P(X) -#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P(X) -#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_NONSTRICT_P(X) - -#else -#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P(X) -#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P(X) -#define REG_OK_FOR_STRREG_P(X) REG_OK_FOR_STRREG_STRICT_P(X) -#endif - -/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression - that is a valid memory address for an instruction. - The MODE argument is the machine mode for the MEM expression - that wants to use this address. - - The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, - except for CONSTANT_ADDRESS_P which is usually machine-independent. - - See legitimize_pic_address in i386.c for details as to what - constitutes a legitimate address when -fpic is used. */ - -#define MAX_REGS_PER_ADDRESS 2 - -#define CONSTANT_ADDRESS_P(X) \ - (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ - || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST) - -/* Nonzero if the constant value X is a legitimate general operand. - It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ - -#define LEGITIMATE_CONSTANT_P(X) \ - (GET_CODE (X) == CONST_DOUBLE ? standard_80387_constant_p (X) : 1) - -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (legitimate_address_p (MODE, X, 1)) \ - goto ADDR; \ -} - -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (legitimate_address_p (MODE, X, 0)) \ - goto ADDR; \ -} - -#endif - -/* Try machine-dependent ways of modifying an illegitimate address - to be legitimate. If we find one, return the new, valid address. - This macro is used in only one place: `memory_address' in explow.c. - - OLDX is the address as it was before break_out_memory_refs was called. - In some cases it is useful to look at this to decide what needs to be done. - - MODE and WIN are passed so that this macro can use - GO_IF_LEGITIMATE_ADDRESS. - - It is always safe for this macro to do nothing. It exists to recognize - opportunities to optimize the output. - - For the 80386, we handle X+REG by loading X into a register R and - using R+REG. R will go in a general reg and indexing will be used. - However, if REG is a broken-out memory address or multiplication, - nothing needs to be done because REG can certainly go in a general reg. - - When -fpic is used, special handling is needed for symbolic references. - See comments by legitimize_pic_address in i386.c for details. */ - -#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \ -{ \ - (X) = legitimize_address (X, OLDX, MODE); \ - if (memory_address_p (MODE, X)) \ - goto WIN; \ -} - -#define REWRITE_ADDRESS(x) rewrite_address(x) - -/* Nonzero if the constant value X is a legitimate general operand - when generating PIC code. It is given that flag_pic is on and - that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ - -#define LEGITIMATE_PIC_OPERAND_P(X) \ - (! SYMBOLIC_CONST (X) || legitimate_pic_address_disp_p (X)) - -#define SYMBOLIC_CONST(X) \ -(GET_CODE (X) == SYMBOL_REF \ - || GET_CODE (X) == LABEL_REF \ - || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X))) - -/* Go to LABEL if ADDR (a legitimate address expression) - has an effect that depends on the machine mode it is used for. - On the 80386, only postdecrement and postincrement address depend thus - (the amount of decrement or increment being the length of the operand). */ -#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \ - if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == POST_DEC) goto LABEL - -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol - so that we may access it directly in the GOT. */ - -#define ENCODE_SECTION_INFO(DECL) \ -do \ - { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - \ - if (TARGET_DEBUG_ADDR \ - && TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd') \ - { \ - fprintf (stderr, "Encode %s, public = %d\n", \ - IDENTIFIER_POINTER (DECL_NAME (DECL)), \ - TREE_PUBLIC (DECL)); \ - } \ - \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - } \ -while (0) - -/* Initialize data used by insn expanders. This is called from - init_emit, once for each function, before code is generated. - For 386, clear stack slot assignments remembered from previous - functions. */ - -#define INIT_EXPANDERS clear_386_stack_locals () - -/* The `FINALIZE_PIC' macro serves as a hook to emit these special - codes once the function is being compiled into assembly code, but - not before. (It is not done before, because in the case of - compiling an inline function, it would lead to multiple PIC - prologues being included in functions which used inline functions - and were compiled to assembly language.) */ - -#define FINALIZE_PIC \ -do \ - { \ - extern int current_function_uses_pic_offset_table; \ - \ - current_function_uses_pic_offset_table |= profile_flag | profile_block_flag; \ - } \ -while (0) - - -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for DECL. - The attributes in ATTRIBUTES have previously been assigned to DECL. */ - -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \ - (i386_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS)) - -/* If defined, a C expression whose value is nonzero if IDENTIFIER - with arguments ARGS is a valid machine specific attribute for TYPE. - The attributes in ATTRIBUTES have previously been assigned to TYPE. */ - -#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, NAME, ARGS) \ - (i386_valid_type_attribute_p (TYPE, ATTRIBUTES, NAME, ARGS)) - -/* If defined, a C expression whose value is zero if the attributes on - TYPE1 and TYPE2 are incompatible, one if they are compatible, and - two if they are nearly compatible (which causes a warning to be - generated). */ - -#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \ - (i386_comp_type_attributes (TYPE1, TYPE2)) - -/* If defined, a C statement that assigns default attributes to newly - defined TYPE. */ - -/* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */ - -/* Max number of args passed in registers. If this is more than 3, we will - have problems with ebx (register #4), since it is a caller save register and - is also used as the pic register in ELF. So for now, don't allow more than - 3 registers to be passed in registers. */ - -#define REGPARM_MAX 3 - - -/* Specify the machine mode that this machine uses - for the index in the tablejump instruction. */ -#define CASE_VECTOR_MODE Pmode - -/* Define as C expression which evaluates to nonzero if the tablejump - instruction expects the table to contain offsets from the address of the - table. - Do not define this if the table should contain absolute addresses. */ -/* #define CASE_VECTOR_PC_RELATIVE 1 */ - -/* Specify the tree operation to be used to convert reals to integers. - This should be changed to take advantage of fist --wfs ?? - */ -#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR - -/* This is the kind of divide that is easiest to do in the general case. */ -#define EASY_DIV_EXPR TRUNC_DIV_EXPR - -/* Define this as 1 if `char' should by default be signed; else as 0. */ -#define DEFAULT_SIGNED_CHAR 1 - -/* Max number of bytes we can move from memory to memory - in one reasonably fast instruction. */ -#define MOVE_MAX 4 - -/* If a memory-to-memory move would take MOVE_RATIO or more simple - move-instruction pairs, we will do a movstr or libcall instead. - Increasing the value will always make code faster, but eventually - incurs high cost in increased code size. - - If you don't define this, a reasonable default is used. - - Make this large on i386, since the block move is very inefficient with small - blocks, and the hard register needs of the block move require much reload - work. */ - -#define MOVE_RATIO 5 - -/* Define if shifts truncate the shift count - which implies one can omit a sign-extension or zero-extension - of a shift count. */ -/* On i386, shifts do truncate the count. But bit opcodes don't. */ - -/* #define SHIFT_COUNT_TRUNCATED */ - -/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits - is done just by pretending it is already truncated. */ -#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 - -/* We assume that the store-condition-codes instructions store 0 for false - and some other value for true. This is the value stored for true. */ - -#define STORE_FLAG_VALUE 1 - -/* When a prototype says `char' or `short', really pass an `int'. - (The 386 can't easily push less than an int.) */ - -#define PROMOTE_PROTOTYPES - -/* Specify the machine mode that pointers have. - After generation of rtl, the compiler makes no further distinction - between pointers and any other objects of this machine mode. */ -#define Pmode SImode - -/* A function address in a call instruction - is a byte address (for indexing purposes) - so give the MEM rtx a byte's mode. */ -#define FUNCTION_MODE QImode - -/* A part of a C `switch' statement that describes the relative costs - of constant RTL expressions. It must contain `case' labels for - expression codes `const_int', `const', `symbol_ref', `label_ref' - and `const_double'. Each case must ultimately reach a `return' - statement to return the relative cost of the use of that kind of - constant value in an expression. The cost may depend on the - precise value of the constant, which is available for examination - in X, and the rtx code of the expression in which it is contained, - found in OUTER_CODE. - - CODE is the expression code--redundant, since it can be obtained - with `GET_CODE (X)'. */ - -#define CONST_COSTS(RTX,CODE,OUTER_CODE) \ - case CONST_INT: \ - return (unsigned) INTVAL (RTX) < 256 ? 0 : 1; \ - case CONST: \ - case LABEL_REF: \ - case SYMBOL_REF: \ - return flag_pic && SYMBOLIC_CONST (RTX) ? 2 : 1; \ - \ - case CONST_DOUBLE: \ - { \ - int code; \ - if (GET_MODE (RTX) == VOIDmode) \ - return 2; \ - \ - code = standard_80387_constant_p (RTX); \ - return code == 1 ? 0 : \ - code == 2 ? 1 : \ - 2; \ - } - -/* Delete the definition here when TOPLEVEL_COSTS_N_INSNS gets added to cse.c */ -#define TOPLEVEL_COSTS_N_INSNS(N) {total = COSTS_N_INSNS (N); break;} - -/* Like `CONST_COSTS' but applies to nonconstant RTL expressions. - This can be used, for example, to indicate how costly a multiply - instruction is. In writing this macro, you can use the construct - `COSTS_N_INSNS (N)' to specify a cost equal to N fast - instructions. OUTER_CODE is the code of the expression in which X - is contained. - - This macro is optional; do not define it if the default cost - assumptions are adequate for the target machine. */ - -#define RTX_COSTS(X,CODE,OUTER_CODE) \ - case ASHIFT: \ - if (GET_CODE (XEXP (X, 1)) == CONST_INT \ - && GET_MODE (XEXP (X, 0)) == SImode) \ - { \ - HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \ - \ - if (value == 1) \ - return COSTS_N_INSNS (ix86_cost->add) \ - + rtx_cost(XEXP (X, 0), OUTER_CODE); \ - \ - if (value == 2 || value == 3) \ - return COSTS_N_INSNS (ix86_cost->lea) \ - + rtx_cost(XEXP (X, 0), OUTER_CODE); \ - } \ - /* fall through */ \ - \ - case ROTATE: \ - case ASHIFTRT: \ - case LSHIFTRT: \ - case ROTATERT: \ - if (GET_MODE (XEXP (X, 0)) == DImode) \ - { \ - if (GET_CODE (XEXP (X, 1)) == CONST_INT) \ - { \ - if (INTVAL (XEXP (X, 1)) > 32) \ - return COSTS_N_INSNS(ix86_cost->shift_const + 2); \ - return COSTS_N_INSNS(ix86_cost->shift_const * 2); \ - } \ - return ((GET_CODE (XEXP (X, 1)) == AND \ - ? COSTS_N_INSNS(ix86_cost->shift_var * 2) \ - : COSTS_N_INSNS(ix86_cost->shift_var * 6 + 2)) \ - + rtx_cost(XEXP (X, 0), OUTER_CODE)); \ - } \ - return COSTS_N_INSNS (GET_CODE (XEXP (X, 1)) == CONST_INT \ - ? ix86_cost->shift_const \ - : ix86_cost->shift_var) \ - + rtx_cost(XEXP (X, 0), OUTER_CODE); \ - \ - case MULT: \ - if (GET_CODE (XEXP (X, 1)) == CONST_INT) \ - { \ - unsigned HOST_WIDE_INT value = INTVAL (XEXP (X, 1)); \ - int nbits = 0; \ - \ - if (value == 2) \ - return COSTS_N_INSNS (ix86_cost->add) \ - + rtx_cost(XEXP (X, 0), OUTER_CODE); \ - if (value == 4 || value == 8) \ - return COSTS_N_INSNS (ix86_cost->lea) \ - + rtx_cost(XEXP (X, 0), OUTER_CODE); \ - \ - while (value != 0) \ - { \ - nbits++; \ - value >>= 1; \ - } \ - \ - if (nbits == 1) \ - return COSTS_N_INSNS (ix86_cost->shift_const) \ - + rtx_cost(XEXP (X, 0), OUTER_CODE); \ - \ - return COSTS_N_INSNS (ix86_cost->mult_init \ - + nbits * ix86_cost->mult_bit) \ - + rtx_cost(XEXP (X, 0), OUTER_CODE); \ - } \ - \ - else /* This is arbitrary */ \ - TOPLEVEL_COSTS_N_INSNS (ix86_cost->mult_init \ - + 7 * ix86_cost->mult_bit); \ - \ - case DIV: \ - case UDIV: \ - case MOD: \ - case UMOD: \ - TOPLEVEL_COSTS_N_INSNS (ix86_cost->divide); \ - \ - case PLUS: \ - if (GET_CODE (XEXP (X, 0)) == REG \ - && GET_MODE (XEXP (X, 0)) == SImode \ - && GET_CODE (XEXP (X, 1)) == PLUS) \ - return COSTS_N_INSNS (ix86_cost->lea); \ - \ - /* fall through */ \ - case AND: \ - case IOR: \ - case XOR: \ - case MINUS: \ - if (GET_MODE (X) == DImode) \ - return COSTS_N_INSNS (ix86_cost->add) * 2 \ - + (rtx_cost (XEXP (X, 0), OUTER_CODE) \ - << (GET_MODE (XEXP (X, 0)) != DImode)) \ - + (rtx_cost (XEXP (X, 1), OUTER_CODE) \ - << (GET_MODE (XEXP (X, 1)) != DImode)); \ - case NEG: \ - case NOT: \ - if (GET_MODE (X) == DImode) \ - TOPLEVEL_COSTS_N_INSNS (ix86_cost->add * 2) \ - TOPLEVEL_COSTS_N_INSNS (ix86_cost->add) - - -/* An expression giving the cost of an addressing mode that contains - ADDRESS. If not defined, the cost is computed from the ADDRESS - expression and the `CONST_COSTS' values. - - For most CISC machines, the default cost is a good approximation - of the true cost of the addressing mode. However, on RISC - machines, all instructions normally have the same length and - execution time. Hence all addresses will have equal costs. - - In cases where more than one form of an address is known, the form - with the lowest cost will be used. If multiple forms have the - same, lowest, cost, the one that is the most complex will be used. - - For example, suppose an address that is equal to the sum of a - register and a constant is used twice in the same basic block. - When this macro is not defined, the address will be computed in a - register and memory references will be indirect through that - register. On machines where the cost of the addressing mode - containing the sum is no higher than that of a simple indirect - reference, this will produce an additional instruction and - possibly require an additional register. Proper specification of - this macro eliminates this overhead for such machines. - - Similar use of this macro is made in strength reduction of loops. - - ADDRESS need not be valid as an address. In such a case, the cost - is not relevant and can be any value; invalid addresses need not be - assigned a different cost. - - On machines where an address involving more than one register is as - cheap as an address computation involving only one register, - defining `ADDRESS_COST' to reflect this can cause two registers to - be live over a region of code where only one would have been if - `ADDRESS_COST' were not defined in that manner. This effect should - be considered in the definition of this macro. Equivalent costs - should probably only be given to addresses with different numbers - of registers on machines with lots of registers. - - This macro will normally either not be defined or be defined as a - constant. - - For i386, it is better to use a complex address than let gcc copy - the address into a reg and make a new pseudo. But not if the address - requires to two regs - that would mean more pseudos with longer - lifetimes. */ - -#define ADDRESS_COST(RTX) \ - ((CONSTANT_P (RTX) \ - || (GET_CODE (RTX) == PLUS && CONSTANT_P (XEXP (RTX, 1)) \ - && REG_P (XEXP (RTX, 0)))) ? 0 \ - : REG_P (RTX) ? 1 \ - : 2) - -/* A C expression for the cost of moving data of mode M between a - register and memory. A value of 2 is the default; this cost is - relative to those in `REGISTER_MOVE_COST'. - - If moving between registers and memory is more expensive than - between two registers, you should define this macro to express the - relative cost. - - On the i386, copying between floating-point and fixed-point - registers is expensive. */ - -#define REGISTER_MOVE_COST(CLASS1, CLASS2) \ - (((FLOAT_CLASS_P (CLASS1) && ! FLOAT_CLASS_P (CLASS2)) \ - || (! FLOAT_CLASS_P (CLASS1) && FLOAT_CLASS_P (CLASS2))) ? 10 \ - : 2) - - -/* A C expression for the cost of moving data of mode M between a - register and memory. A value of 2 is the default; this cost is - relative to those in `REGISTER_MOVE_COST'. - - If moving between registers and memory is more expensive than - between two registers, you should define this macro to express the - relative cost. */ - -/* #define MEMORY_MOVE_COST(M,C,I) 2 */ - -/* A C expression for the cost of a branch instruction. A value of 1 - is the default; other values are interpreted relative to that. */ - -#define BRANCH_COST i386_branch_cost - -/* Define this macro as a C expression which is nonzero if accessing - less than a word of memory (i.e. a `char' or a `short') is no - faster than accessing a word of memory, i.e., if such access - require more than one instruction or if there is no difference in - cost between byte and (aligned) word loads. - - When this macro is not defined, the compiler will access a field by - finding the smallest containing object; when it is defined, a - fullword load will be used if alignment permits. Unless bytes - accesses are faster than word accesses, using word accesses is - preferable since it may eliminate subsequent memory access if - subsequent accesses occur to other fields in the same word of the - structure, but to different bytes. */ - -#define SLOW_BYTE_ACCESS 0 - -/* Nonzero if access to memory by shorts is slow and undesirable. */ -#define SLOW_SHORT_ACCESS 0 - -/* Define this macro if zero-extension (of a `char' or `short' to an - `int') can be done faster if the destination is a register that is - known to be zero. - - If you define this macro, you must have instruction patterns that - recognize RTL structures like this: - - (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...) - - and likewise for `HImode'. */ - -/* #define SLOW_ZERO_EXTEND */ - -/* Define this macro to be the value 1 if unaligned accesses have a - cost many times greater than aligned accesses, for example if they - are emulated in a trap handler. - - When this macro is non-zero, the compiler will act as if - `STRICT_ALIGNMENT' were non-zero when generating code for block - moves. This can cause significantly more instructions to be - produced. Therefore, do not set this macro non-zero if unaligned - accesses only add a cycle or two to the time for a memory access. - - If the value of this macro is always zero, it need not be defined. */ - -/* #define SLOW_UNALIGNED_ACCESS 0 */ - -/* Define this macro to inhibit strength reduction of memory - addresses. (On some machines, such strength reduction seems to do - harm rather than good.) */ - -/* #define DONT_REDUCE_ADDR */ - -/* Define this macro if it is as good or better to call a constant - function address than to call an address kept in a register. - - Desirable on the 386 because a CALL with a constant address is - faster than one with a register address. */ - -#define NO_FUNCTION_CSE - -/* Define this macro if it is as good or better for a function to call - itself with an explicit address than to call an address kept in a - register. */ - -#define NO_RECURSIVE_FUNCTION_CSE - -/* A C statement (sans semicolon) to update the integer variable COST - based on the relationship between INSN that is dependent on - DEP_INSN through the dependence LINK. The default is to make no - adjustment to COST. This can be used for example to specify to - the scheduler that an output- or anti-dependence does not incur - the same cost as a data-dependence. */ - -#define ADJUST_COST(insn,link,dep_insn,cost) \ - (cost) = x86_adjust_cost(insn, link, dep_insn, cost) - -#define ADJUST_BLOCKAGE(last_insn,insn,blockage) \ -{ \ - if (is_fp_store (last_insn) && is_fp_insn (insn) \ - && NEXT_INSN (last_insn) && NEXT_INSN (NEXT_INSN (last_insn)) \ - && NEXT_INSN (NEXT_INSN (NEXT_INSN (last_insn))) \ - && (GET_CODE (NEXT_INSN (last_insn)) == INSN) \ - && (GET_CODE (NEXT_INSN (NEXT_INSN (last_insn))) == JUMP_INSN) \ - && (GET_CODE (NEXT_INSN (NEXT_INSN (NEXT_INSN (last_insn)))) == NOTE) \ - && (NOTE_LINE_NUMBER (NEXT_INSN (NEXT_INSN (NEXT_INSN (last_insn)))) \ - == NOTE_INSN_LOOP_END)) \ - { \ - (blockage) = 3; \ - } \ -} - -#define ISSUE_RATE ((int)ix86_cpu > (int)PROCESSOR_I486 ? 2 : 1) - - -/* Add any extra modes needed to represent the condition code. - - For the i386, we need separate modes when floating-point equality - comparisons are being done. */ - -#define EXTRA_CC_MODES CCFPEQmode - -/* Define the names for the modes specified above. */ -#define EXTRA_CC_NAMES "CCFPEQ" - -/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, - return the mode to be used for the comparison. - - For floating-point equality comparisons, CCFPEQmode should be used. - VOIDmode should be used in all other cases. */ - -#define SELECT_CC_MODE(OP,X,Y) \ - (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ - && ((OP) == EQ || (OP) == NE) ? CCFPEQmode : VOIDmode) - -/* Define the information needed to generate branch and scc insns. This is - stored from the compare operation. Note that we can't use "rtx" here - since it hasn't been defined! */ - -extern struct rtx_def *(*i386_compare_gen)(), *(*i386_compare_gen_eq)(); - -/* Tell final.c how to eliminate redundant test instructions. */ - -/* Here we define machine-dependent flags and fields in cc_status - (see `conditions.h'). */ - -/* Set if the cc value was actually from the 80387 and - we are testing eax directly (i.e. no sahf) */ -#define CC_TEST_AX 020000 - -/* Set if the cc value is actually in the 80387, so a floating point - conditional branch must be output. */ -#define CC_IN_80387 04000 - -/* Set if the CC value was stored in a nonstandard way, so that - the state of equality is indicated by zero in the carry bit. */ -#define CC_Z_IN_NOT_C 010000 - -/* Set if the CC value was actually from the 80387 and loaded directly - into the eflags instead of via eax/sahf. */ -#define CC_FCOMI 040000 - -/* Store in cc_status the expressions - that the condition codes will describe - after execution of an instruction whose pattern is EXP. - Do not alter them if the instruction would not alter the cc's. */ - -#define NOTICE_UPDATE_CC(EXP, INSN) \ - notice_update_cc((EXP)) - -/* Output a signed jump insn. Use template NORMAL ordinarily, or - FLOAT following a floating point comparison. - Use NO_OV following an arithmetic insn that set the cc's - before a test insn that was deleted. - NO_OV may be zero, meaning final should reinsert the test insn - because the jump cannot be handled properly without it. */ - -#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \ -{ \ - if (cc_prev_status.flags & CC_IN_80387) \ - return FLOAT; \ - if (cc_prev_status.flags & CC_NO_OVERFLOW) \ - return NO_OV; \ - return NORMAL; \ -} - -/* Control the assembler format that we output, to the extent - this does not vary between assemblers. */ - -/* How to refer to registers in assembler output. - This sequence is indexed by compiler's hard-register-number (see above). */ - -/* In order to refer to the first 8 regs as 32 bit regs prefix an "e" - For non floating point regs, the following are the HImode names. - - For float regs, the stack top is sometimes referred to as "%st(0)" - instead of just "%st". PRINT_REG handles this with the "y" code. */ - -#define HI_REGISTER_NAMES \ -{"ax","dx","cx","bx","si","di","bp","sp", \ - "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","" } - -#define REGISTER_NAMES HI_REGISTER_NAMES - -/* Table of additional register names to use in user input. */ - -#define ADDITIONAL_REGISTER_NAMES \ -{ { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 }, \ - { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 }, \ - { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 }, \ - { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 } } - -/* Note we are omitting these since currently I don't know how -to get gcc to use these, since they want the same but different -number as al, and ax. -*/ - -/* note the last four are not really qi_registers, but - the md will have to never output movb into one of them - only a movw . There is no movb into the last four regs */ - -#define QI_REGISTER_NAMES \ -{"al", "dl", "cl", "bl", "si", "di", "bp", "sp",} - -/* These parallel the array above, and can be used to access bits 8:15 - of regs 0 through 3. */ - -#define QI_HIGH_REGISTER_NAMES \ -{"ah", "dh", "ch", "bh", } - -/* How to renumber registers for dbx and gdb. */ - -/* {0,2,1,3,6,7,4,5,12,13,14,15,16,17} */ -#define DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 : \ - (n) == 1 ? 2 : \ - (n) == 2 ? 1 : \ - (n) == 3 ? 3 : \ - (n) == 4 ? 6 : \ - (n) == 5 ? 7 : \ - (n) == 6 ? 4 : \ - (n) == 7 ? 5 : \ - (n) + 4) - -/* Before the prologue, RA is at 0(%esp). */ -#define INCOMING_RETURN_ADDR_RTX \ - gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM)) - -/* After the prologue, RA is at -4(AP) in the current frame. */ -#define RETURN_ADDR_RTX(COUNT, FRAME) \ - ((COUNT) == 0 \ - ? gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, arg_pointer_rtx, GEN_INT(-4)))\ - : gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, (FRAME), GEN_INT(4)))) - -/* PC is dbx register 8; let's use that column for RA. */ -#define DWARF_FRAME_RETURN_COLUMN 8 - -/* Before the prologue, the top of the frame is at 4(%esp). */ -#define INCOMING_FRAME_SP_OFFSET 4 - -/* This is how to output the definition of a user-level label named NAME, - such as the label on a static function or variable NAME. */ - -#define ASM_OUTPUT_LABEL(FILE,NAME) \ - (assemble_name (FILE, NAME), fputs (":\n", FILE)) - -/* This is how to output an assembler line defining a `double' constant. */ - -#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ -do { long l[2]; \ - REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \ - fprintf (FILE, "%s 0x%lx,0x%lx\n", ASM_LONG, l[0], l[1]); \ - } while (0) - -/* This is how to output a `long double' extended real constant. */ - -#undef ASM_OUTPUT_LONG_DOUBLE -#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \ -do { long l[3]; \ - REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \ - fprintf (FILE, "%s 0x%lx,0x%lx,0x%lx\n", ASM_LONG, l[0], l[1], l[2]); \ - } while (0) - -/* This is how to output an assembler line defining a `float' constant. */ - -#define ASM_OUTPUT_FLOAT(FILE,VALUE) \ -do { long l; \ - REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \ - fprintf ((FILE), "%s 0x%lx\n", ASM_LONG, l); \ - } while (0) - -/* Store in OUTPUT a string (made with alloca) containing - an assembler-name for a local static variable named NAME. - LABELNO is an integer which is different for each call. */ - -#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ -( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ - sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) - - - -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "%s ", ASM_LONG), \ - output_addr_const (FILE,(VALUE)), \ - putc('\n',FILE)) - -/* Likewise for `char' and `short' constants. */ -/* is this supposed to do align too?? */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "%s ", ASM_SHORT), \ - output_addr_const (FILE,(VALUE)), \ - putc('\n',FILE)) - -/* -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "%s ", ASM_BYTE_OP), \ - output_addr_const (FILE,(VALUE)), \ - fputs (",", FILE), \ - output_addr_const (FILE,(VALUE)), \ - fputs (" >> 8\n",FILE)) -*/ - - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "%s ", ASM_BYTE_OP), \ - output_addr_const (FILE, (VALUE)), \ - putc ('\n', FILE)) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf ((FILE), "%s 0x%x\n", ASM_BYTE_OP, (VALUE)) - -/* This is how to output an insn to push a register on the stack. - It need not be very fast code. */ - -#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ - fprintf (FILE, "\tpushl %%e%s\n", reg_names[REGNO]) - -/* This is how to output an insn to pop a register from the stack. - It need not be very fast code. */ - -#define ASM_OUTPUT_REG_POP(FILE,REGNO) \ - fprintf (FILE, "\tpopl %%e%s\n", reg_names[REGNO]) - -/* This is how to output an element of a case-vector that is absolute. - */ - -#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ - fprintf (FILE, "%s %s%d\n", ASM_LONG, LPREFIX, VALUE) - -/* This is how to output an element of a case-vector that is relative. - We don't use these on the 386 yet, because the ATT assembler can't do - forward reference the differences. - */ - -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.word %s%d-%s%d\n",LPREFIX, VALUE,LPREFIX, REL) - -/* Define the parentheses used to group arithmetic operations - in assembler code. */ - -#define ASM_OPEN_PAREN "" -#define ASM_CLOSE_PAREN "" - -/* Define results of standard character escape sequences. */ -#define TARGET_BELL 007 -#define TARGET_BS 010 -#define TARGET_TAB 011 -#define TARGET_NEWLINE 012 -#define TARGET_VT 013 -#define TARGET_FF 014 -#define TARGET_CR 015 - -/* Print operand X (an rtx) in assembler syntax to file FILE. - CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. - The CODE z takes the size of operand from the following digit, and - outputs b,w,or l respectively. - - On the 80386, we use several such letters: - f -- float insn (print a CONST_DOUBLE as a float rather than in hex). - L,W,B,Q,S,T -- print the opcode suffix for specified size of operand. - R -- print the prefix for register names. - z -- print the opcode suffix for the size of the current operand. - * -- print a star (in certain assembler syntax) - P -- if PIC, print an @PLT suffix. - X -- don't print any sort of PIC '@' suffix for a symbol. - J -- print jump insn for arithmetic_comparison_operator. - s -- ??? something to do with double shifts. not actually used, afaik. - C -- print a conditional move suffix corresponding to the op code. - c -- likewise, but reverse the condition. - F,f -- likewise, but for floating-point. */ - -#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ - ((CODE) == '*' || (CODE) == '_') - -/* Print the name of a register based on its machine mode and number. - If CODE is 'w', pretend the mode is HImode. - If CODE is 'b', pretend the mode is QImode. - If CODE is 'k', pretend the mode is SImode. - If CODE is 'h', pretend the reg is the `high' byte register. - If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op. */ - -extern char *hi_reg_name[]; -extern char *qi_reg_name[]; -extern char *qi_high_reg_name[]; - -#define PRINT_REG(X, CODE, FILE) \ - do { if (REGNO (X) == ARG_POINTER_REGNUM) \ - abort (); \ - fprintf (FILE, "%s", RP); \ - switch ((CODE == 'w' ? 2 \ - : CODE == 'b' ? 1 \ - : CODE == 'k' ? 4 \ - : CODE == 'y' ? 3 \ - : CODE == 'h' ? 0 \ - : GET_MODE_SIZE (GET_MODE (X)))) \ - { \ - case 3: \ - if (STACK_TOP_P (X)) \ - { \ - fputs ("st(0)", FILE); \ - break; \ - } \ - case 4: \ - case 8: \ - case 12: \ - if (! FP_REG_P (X)) fputs ("e", FILE); \ - case 2: \ - fputs (hi_reg_name[REGNO (X)], FILE); \ - break; \ - case 1: \ - fputs (qi_reg_name[REGNO (X)], FILE); \ - break; \ - case 0: \ - fputs (qi_high_reg_name[REGNO (X)], FILE); \ - break; \ - } \ - } while (0) - -#define PRINT_OPERAND(FILE, X, CODE) \ - print_operand (FILE, X, CODE) - -#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ - print_operand_address (FILE, ADDR) - -/* Print the name of a register for based on its machine mode and number. - This macro is used to print debugging output. - This macro is different from PRINT_REG in that it may be used in - programs that are not linked with aux-output.o. */ - -#define DEBUG_PRINT_REG(X, CODE, FILE) \ - do { static char *hi_name[] = HI_REGISTER_NAMES; \ - static char *qi_name[] = QI_REGISTER_NAMES; \ - fprintf (FILE, "%d %s", REGNO (X), RP); \ - if (REGNO (X) == ARG_POINTER_REGNUM) \ - { fputs ("argp", FILE); break; } \ - if (STACK_TOP_P (X)) \ - { fputs ("st(0)", FILE); break; } \ - if (FP_REG_P (X)) \ - { fputs (hi_name[REGNO(X)], FILE); break; } \ - switch (GET_MODE_SIZE (GET_MODE (X))) \ - { \ - default: \ - fputs ("e", FILE); \ - case 2: \ - fputs (hi_name[REGNO (X)], FILE); \ - break; \ - case 1: \ - fputs (qi_name[REGNO (X)], FILE); \ - break; \ - } \ - } while (0) - -/* Output the prefix for an immediate operand, or for an offset operand. */ -#define PRINT_IMMED_PREFIX(FILE) fputs (IP, (FILE)) -#define PRINT_OFFSET_PREFIX(FILE) fputs (IP, (FILE)) - -/* Routines in libgcc that return floats must return them in an fp reg, - just as other functions do which return such values. - These macros make that happen. */ - -#define FLOAT_VALUE_TYPE float -#define INTIFY(FLOATVAL) FLOATVAL - -/* Nonzero if INSN magically clobbers register REGNO. */ - -/* #define INSN_CLOBBERS_REGNO_P(INSN, REGNO) \ - (FP_REGNO_P (REGNO) \ - && (GET_CODE (INSN) == JUMP_INSN || GET_CODE (INSN) == BARRIER)) -*/ - -/* a letter which is not needed by the normal asm syntax, which - we can use for operand syntax in the extended asm */ - -#define ASM_OPERAND_LETTER '#' -#define RET return "" -#define AT_SP(mode) (gen_rtx_MEM ((mode), stack_pointer_rtx)) - -/* Helper macros to expand a binary/unary operator if needed */ -#define IX86_EXPAND_BINARY_OPERATOR(OP, MODE, OPERANDS) \ -do { \ - if (!ix86_expand_binary_operator (OP, MODE, OPERANDS)) \ - FAIL; \ -} while (0) - -#define IX86_EXPAND_UNARY_OPERATOR(OP, MODE, OPERANDS) \ -do { \ - if (!ix86_expand_unary_operator (OP, MODE, OPERANDS,)) \ - FAIL; \ -} while (0) - - -/* Functions in i386.c */ -extern void override_options (); -extern void order_regs_for_local_alloc (); -extern char *output_strlen_unroll (); -extern struct rtx_def *i386_sext16_if_const (); -extern int i386_aligned_p (); -extern int i386_cc_probably_useless_p (); -extern int i386_valid_decl_attribute_p (); -extern int i386_valid_type_attribute_p (); -extern int i386_return_pops_args (); -extern int i386_comp_type_attributes (); -extern void init_cumulative_args (); -extern void function_arg_advance (); -extern struct rtx_def *function_arg (); -extern int function_arg_partial_nregs (); -extern char *output_strlen_unroll (); -extern char *singlemove_string (); -extern char *output_move_double (); -extern char *output_move_pushmem (); -extern int standard_80387_constant_p (); -extern char *output_move_const_single (); -extern int symbolic_operand (); -extern int call_insn_operand (); -extern int expander_call_insn_operand (); -extern int symbolic_reference_mentioned_p (); -extern int ix86_expand_binary_operator (); -extern int ix86_binary_operator_ok (); -extern int ix86_expand_unary_operator (); -extern int ix86_unary_operator_ok (); -extern void emit_pic_move (); -extern void function_prologue (); -extern int simple_386_epilogue (); -extern void function_epilogue (); -extern int legitimate_address_p (); -extern struct rtx_def *legitimize_pic_address (); -extern struct rtx_def *legitimize_address (); -extern void print_operand (); -extern void print_operand_address (); -extern void notice_update_cc (); -extern void split_di (); -extern int binary_387_op (); -extern int shift_op (); -extern int VOIDmode_compare_op (); -extern char *output_387_binary_op (); -extern char *output_fix_trunc (); -extern void output_float_extend (); -extern char *output_float_compare (); -extern char *output_fp_cc0_set (); -extern void save_386_machine_status (); -extern void restore_386_machine_status (); -extern void clear_386_stack_locals (); -extern struct rtx_def *assign_386_stack_local (); -extern int is_mul (); -extern int is_div (); -extern int last_to_set_cc (); -extern int doesnt_set_condition_code (); -extern int sets_condition_code (); -extern int str_immediate_operand (); -extern int is_fp_insn (); -extern int is_fp_dest (); -extern int is_fp_store (); -extern int agi_dependent (); -extern int reg_mentioned_in_mem (); -extern char *output_int_conditional_move (); -extern char *output_fp_conditional_move (); -extern int ix86_can_use_return_insn_p (); -extern int small_shift_operand (); -extern char *output_ashl (); -extern int memory_address_info (); - -#ifdef NOTYET -extern struct rtx_def *copy_all_rtx (); -extern void rewrite_address (); -#endif - -/* Variables in i386.c */ -extern char *ix86_cpu_string; /* for -mcpu= */ -extern char *ix86_arch_string; /* for -march= */ -extern char *i386_reg_alloc_order; /* register allocation order */ -extern char *i386_regparm_string; /* # registers to use to pass args */ -extern char *i386_align_loops_string; /* power of two alignment for loops */ -extern char *i386_align_jumps_string; /* power of two alignment for non-loop jumps */ -extern char *i386_align_funcs_string; /* power of two alignment for functions */ -extern char *i386_preferred_stack_boundary_string;/* power of two alignment for stack boundary */ -extern char *i386_branch_cost_string; /* values 1-5: see jump.c */ -extern int i386_regparm; /* i386_regparm_string as a number */ -extern int i386_align_loops; /* power of two alignment for loops */ -extern int i386_align_jumps; /* power of two alignment for non-loop jumps */ -extern int i386_align_funcs; /* power of two alignment for functions */ -extern int i386_preferred_stack_boundary; /* preferred stack boundary alignment in bits */ -extern int i386_branch_cost; /* values 1-5: see jump.c */ -extern char *hi_reg_name[]; /* names for 16 bit regs */ -extern char *qi_reg_name[]; /* names for 8 bit regs (low) */ -extern char *qi_high_reg_name[]; /* names for 8 bit regs (high) */ -extern enum reg_class regclass_map[]; /* smalled class containing REGNO */ -extern struct rtx_def *i386_compare_op0; /* operand 0 for comparisons */ -extern struct rtx_def *i386_compare_op1; /* operand 1 for comparisons */ - -/* External variables used */ -extern int optimize; /* optimization level */ -extern int obey_regdecls; /* TRUE if stupid register allocation */ - -/* External functions used */ -extern struct rtx_def *force_operand (); - - -/* -Local variables: -version-control: t -End: -*/ diff --git a/contrib/gcc/config/i386/i386.md b/contrib/gcc/config/i386/i386.md deleted file mode 100644 index b52e2550c4df..000000000000 --- a/contrib/gcc/config/i386/i386.md +++ /dev/null @@ -1,8195 +0,0 @@ -; GCC machine description for Intel X86. -;; Copyright (C) 1988, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. -;; Mostly by William Schelter. - -;; This file is part of GNU CC. - -;; GNU CC 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. - -;; GNU CC 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. - -;; You should have received a copy of the GNU General Public License -;; along with GNU CC; see the file COPYING. If not, write to -;; the Free Software Foundation, 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. */ - -;; The original PO technology requires these to be ordered by speed, -;; so that assigner will pick the fastest. - -;; See file "rtl.def" for documentation on define_insn, match_*, et. al. - -;; Macro #define NOTICE_UPDATE_CC in file i386.h handles condition code -;; updates for most instructions. - -;; Macro REG_CLASS_FROM_LETTER in file i386.h defines the register -;; constraint letters. - -;; the special asm out single letter directives following a '%' are: -;; 'z' mov%z1 would be movl, movw, or movb depending on the mode of -;; operands[1]. -;; 'L' Print the opcode suffix for a 32-bit integer opcode. -;; 'W' Print the opcode suffix for a 16-bit integer opcode. -;; 'B' Print the opcode suffix for an 8-bit integer opcode. -;; 'Q' Print the opcode suffix for a 64-bit float opcode. -;; 'S' Print the opcode suffix for a 32-bit float opcode. -;; 'T' Print the opcode suffix for an 80-bit extended real XFmode float opcode. -;; 'J' Print the appropriate jump operand. - -;; 'b' Print the QImode name of the register for the indicated operand. -;; %b0 would print %al if operands[0] is reg 0. -;; 'w' Likewise, print the HImode name of the register. -;; 'k' Likewise, print the SImode name of the register. -;; 'h' Print the QImode name for a "high" register, either ah, bh, ch or dh. -;; 'y' Print "st(0)" instead of "st" as a register. - -;; UNSPEC usage: -;; 0 This is a `scas' operation. The mode of the UNSPEC is always SImode. -;; operand 0 is the memory address to scan. -;; operand 1 is a register containing the value to scan for. The mode -;; of the scas opcode will be the same as the mode of this operand. -;; operand 2 is the known alignment of operand 0. -;; 1 This is a `sin' operation. The mode of the UNSPEC is MODE_FLOAT. -;; operand 0 is the argument for `sin'. -;; 2 This is a `cos' operation. The mode of the UNSPEC is MODE_FLOAT. -;; operand 0 is the argument for `cos'. -;; 3 This is part of a `stack probe' operation. The mode of the UNSPEC is -;; always SImode. operand 0 is the size of the stack allocation. -;; 4 This is the source of a fake SET of the frame pointer which is used to -;; prevent insns referencing it being scheduled across the initial -;; decrement of the stack pointer. -;; 5 This is a `bsf' operation. -;; 6 This is the @GOT offset of a PIC address. -;; 7 This is the @GOTOFF offset of a PIC address. -;; 8 This is a reference to a symbol's @PLT address. - -;; This shadows the processor_type enumeration, so changes must be made -;; to i386.h at the same time. - -(define_attr "type" - "integer,binary,memory,test,compare,fcompare,idiv,imul,lea,fld,fpop,fpdiv,fpmul" - (const_string "integer")) - -(define_attr "memory" "none,load,store" - (cond [(eq_attr "type" "idiv,lea") - (const_string "none") - - (eq_attr "type" "fld") - (const_string "load") - - (eq_attr "type" "test") - (if_then_else (match_operand 0 "memory_operand" "") - (const_string "load") - (const_string "none")) - - (eq_attr "type" "compare,fcompare") - (if_then_else (ior (match_operand 0 "memory_operand" "") - (match_operand 1 "memory_operand" "")) - (const_string "load") - (const_string "none")) - - (and (eq_attr "type" "integer,memory,fpop") - (match_operand 0 "memory_operand" "")) - (const_string "store") - - (and (eq_attr "type" "integer,memory,fpop") - (match_operand 1 "memory_operand" "")) - (const_string "load") - - (and (eq_attr "type" "binary,imul,fpmul,fpdiv") - (ior (match_operand 1 "memory_operand" "") - (match_operand 2 "memory_operand" ""))) - (const_string "load")] - - (const_string "none"))) - -;; Functional units - -; (define_function_unit NAME MULTIPLICITY SIMULTANEITY -; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST]) - -; pentiumpro has a reservation station with 5 ports -; port 0 has integer, float add, integer divide, float divide, float -; multiply, and shifter units. -; port 1 has integer, and jump units. -; port 2 has the load address generation unit -; ports 3 and 4 have the store address generation units - -; pentium has two integer pipelines, the main u pipe and the secondary v pipe. -; and a float pipeline - -;; Floating point - -(define_function_unit "fp" 1 0 - (and (eq_attr "type" "fpop,fcompare") (eq_attr "cpu" "i386,i486")) - 5 5) - -(define_function_unit "fp" 1 0 - (and (eq_attr "type" "fpop,fcompare") (eq_attr "cpu" "pentium,pentiumpro")) - 3 0) - -(define_function_unit "fp" 1 0 - (and (eq_attr "type" "fpmul") (eq_attr "cpu" "pentium")) - 7 0) - -(define_function_unit "fp" 1 0 - (and (eq_attr "type" "fpmul") (eq_attr "cpu" "pentiumpro")) - 5 0) - -(define_function_unit "fp" 1 0 - (and (eq_attr "type" "idiv") (eq_attr "cpu" "pentiumpro")) - 10 10) - -(define_function_unit "fp" 1 0 - (and (eq_attr "type" "imul") (eq_attr "cpu" "pentiumpro")) - 6 0) - -(define_function_unit "fp" 1 0 - (eq_attr "type" "fpdiv") - 10 10) - -(define_function_unit "fp" 1 0 - (and (eq_attr "type" "fld") (eq_attr "cpu" "!pentiumpro,k6")) - 1 0) - -;; K6 FPU is not pipelined. -(define_function_unit "fp" 1 0 - (and (eq_attr "type" "fpop,fpmul,fcompare") (eq_attr "cpu" "k6")) - 2 2) - -;; i386 and i486 have one integer unit, which need not be modeled - -(define_function_unit "integer" 2 0 - (and (eq_attr "type" "integer,binary,test,compare,lea") (eq_attr "cpu" "pentium,pentiumpro")) - 1 0) - -(define_function_unit "integer" 2 0 - (and (eq_attr "cpu" "k6") - (and (eq_attr "type" "integer,binary,test,compare") - (eq_attr "memory" "!load"))) - 1 0) - -;; Internally, K6 converts REG OP MEM instructions into a load (2 cycles) -;; and a register operation (1 cycle). -(define_function_unit "integer" 2 0 - (and (eq_attr "cpu" "k6") - (and (eq_attr "type" "integer,binary,test,compare") - (eq_attr "memory" "load"))) - 3 0) - -;; Multiplies use one of the integer units -(define_function_unit "integer" 2 0 - (and (eq_attr "cpu" "pentium") (eq_attr "type" "imul")) - 11 11) - -(define_function_unit "integer" 2 0 - (and (eq_attr "cpu" "k6") (eq_attr "type" "imul")) - 2 2) - -(define_function_unit "integer" 2 0 - (and (eq_attr "cpu" "pentium") (eq_attr "type" "idiv")) - 25 25) - -(define_function_unit "integer" 2 0 - (and (eq_attr "cpu" "k6") (eq_attr "type" "idiv")) - 17 17) - -;; Pentium Pro and K6 have a separate load unit. -(define_function_unit "load" 1 0 - (and (eq_attr "cpu" "pentiumpro") (eq_attr "memory" "load")) - 3 0) - -(define_function_unit "load" 1 0 - (and (eq_attr "cpu" "k6") (eq_attr "memory" "load")) - 2 0) - -;; Pentium Pro and K6 have a separate store unit. -(define_function_unit "store" 1 0 - (and (eq_attr "cpu" "pentiumpro,k6") (eq_attr "memory" "store")) - 1 0) - -;; lea executes in the K6 store unit with 1 cycle latency -(define_function_unit "store" 1 0 - (and (eq_attr "cpu" "k6") (eq_attr "type" "lea")) - 1 0) - - -;; "movl MEM,REG / testl REG,REG" is faster on a 486 than "cmpl $0,MEM". -;; But restricting MEM here would mean that gcc could not remove a redundant -;; test in cases like "incl MEM / je TARGET". -;; -;; We don't want to allow a constant operand for test insns because -;; (set (cc0) (const_int foo)) has no mode information. Such insns will -;; be folded while optimizing anyway. - -;; All test insns have expanders that save the operands away without -;; actually generating RTL. The bCOND or sCOND (emitted immediately -;; after the tstM or cmp) will actually emit the tstM or cmpM. - -;; Processor type -- this attribute must exactly match the processor_type -;; enumeration in i386.h. - -(define_attr "cpu" "i386,i486,pentium,pentiumpro,k6" - (const (symbol_ref "ix86_cpu"))) - -(define_insn "tstsi_1" - [(set (cc0) - (match_operand:SI 0 "nonimmediate_operand" "rm"))] - "" - "* -{ - if (REG_P (operands[0])) - return AS2 (test%L0,%0,%0); - - operands[1] = const0_rtx; - return AS2 (cmp%L0,%1,%0); -}" - [(set_attr "type" "test")]) - -(define_expand "tstsi" - [(set (cc0) - (match_operand:SI 0 "nonimmediate_operand" ""))] - "" - " -{ - i386_compare_gen = gen_tstsi_1; - i386_compare_op0 = operands[0]; - i386_compare_op1 = const0_rtx; - DONE; -}") - -(define_insn "tsthi_1" - [(set (cc0) - (match_operand:HI 0 "nonimmediate_operand" "rm"))] - "" - "* -{ - if (REG_P (operands[0])) - return AS2 (test%W0,%0,%0); - - operands[1] = const0_rtx; - return AS2 (cmp%W0,%1,%0); -}" - [(set_attr "type" "test")]) - -(define_expand "tsthi" - [(set (cc0) - (match_operand:HI 0 "nonimmediate_operand" ""))] - "" - " -{ - i386_compare_gen = gen_tsthi_1; - i386_compare_op0 = operands[0]; - i386_compare_op1 = const0_rtx; - DONE; -}") - -(define_insn "tstqi_1" - [(set (cc0) - (match_operand:QI 0 "nonimmediate_operand" "qm"))] - "" - "* -{ - if (REG_P (operands[0])) - return AS2 (test%B0,%0,%0); - - operands[1] = const0_rtx; - return AS2 (cmp%B0,%1,%0); -}" - [(set_attr "type" "test")]) - -(define_expand "tstqi" - [(set (cc0) - (match_operand:QI 0 "nonimmediate_operand" ""))] - "" - " -{ - i386_compare_gen = gen_tstqi_1; - i386_compare_op0 = operands[0]; - i386_compare_op1 = const0_rtx; - DONE; -}") - -(define_insn "tstsf_cc" - [(set (cc0) - (match_operand:SF 0 "register_operand" "f")) - (clobber (match_scratch:HI 1 "=a"))] - "TARGET_80387 && ! TARGET_IEEE_FP" - "* -{ - if (! STACK_TOP_P (operands[0])) - abort (); - - output_asm_insn (\"ftst\", operands); - - if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG)) - output_asm_insn (AS1 (fstp,%y0), operands); - - return output_fp_cc0_set (insn); -}" - [(set_attr "type" "test")]) - -;; Don't generate tstsf if generating IEEE code, since the `ftst' opcode -;; isn't IEEE compliant. - -(define_expand "tstsf" - [(parallel [(set (cc0) - (match_operand:SF 0 "register_operand" "")) - (clobber (match_scratch:HI 1 ""))])] - "TARGET_80387 && ! TARGET_IEEE_FP" - " -{ - i386_compare_gen = gen_tstsf_cc; - i386_compare_op0 = operands[0]; - i386_compare_op1 = const0_rtx; - DONE; -}") - -(define_insn "tstdf_cc" - [(set (cc0) - (match_operand:DF 0 "register_operand" "f")) - (clobber (match_scratch:HI 1 "=a"))] - "TARGET_80387 && ! TARGET_IEEE_FP" - "* -{ - if (! STACK_TOP_P (operands[0])) - abort (); - - output_asm_insn (\"ftst\", operands); - - if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG)) - output_asm_insn (AS1 (fstp,%y0), operands); - - return output_fp_cc0_set (insn); -}" - [(set_attr "type" "test")]) - -;; Don't generate tstdf if generating IEEE code, since the `ftst' opcode -;; isn't IEEE compliant. - -(define_expand "tstdf" - [(parallel [(set (cc0) - (match_operand:DF 0 "register_operand" "")) - (clobber (match_scratch:HI 1 ""))])] - "TARGET_80387 && ! TARGET_IEEE_FP" - " -{ - i386_compare_gen = gen_tstdf_cc; - i386_compare_op0 = operands[0]; - i386_compare_op1 = const0_rtx; - DONE; -}") - -(define_insn "tstxf_cc" - [(set (cc0) - (match_operand:XF 0 "register_operand" "f")) - (clobber (match_scratch:HI 1 "=a"))] - "TARGET_80387 && ! TARGET_IEEE_FP" - "* -{ - if (! STACK_TOP_P (operands[0])) - abort (); - - output_asm_insn (\"ftst\", operands); - - if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG)) - output_asm_insn (AS1 (fstp,%y0), operands); - - return output_fp_cc0_set (insn); -}" - [(set_attr "type" "test")]) - -;; Don't generate tstxf if generating IEEE code, since the `ftst' opcode -;; isn't IEEE compliant. - -(define_expand "tstxf" - [(parallel [(set (cc0) - (match_operand:XF 0 "register_operand" "")) - (clobber (match_scratch:HI 1 ""))])] - "TARGET_80387 && ! TARGET_IEEE_FP" - " -{ - i386_compare_gen = gen_tstxf_cc; - i386_compare_op0 = operands[0]; - i386_compare_op1 = const0_rtx; - DONE; -}") - -;;- compare instructions. See comments above tstM patterns about -;; expansion of these insns. - -(define_insn "cmpsi_1" - [(set (cc0) - (compare (match_operand:SI 0 "nonimmediate_operand" "mr,r") - (match_operand:SI 1 "general_operand" "ri,mr")))] - "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM" - "* return AS2 (cmp%L0,%1,%0);" - [(set_attr "type" "compare")]) - -(define_expand "cmpsi" - [(set (cc0) - (compare (match_operand:SI 0 "nonimmediate_operand" "") - (match_operand:SI 1 "general_operand" "")))] - "" - " -{ - if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) - operands[0] = force_reg (SImode, operands[0]); - - i386_compare_gen = gen_cmpsi_1; - i386_compare_op0 = operands[0]; - i386_compare_op1 = operands[1]; - DONE; -}") - -(define_insn "cmphi_1" - [(set (cc0) - (compare (match_operand:HI 0 "nonimmediate_operand" "mr,r") - (match_operand:HI 1 "general_operand" "ri,mr")))] - "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM" - "* return AS2 (cmp%W0,%1,%0);" - [(set_attr "type" "compare")]) - -(define_expand "cmphi" - [(set (cc0) - (compare (match_operand:HI 0 "nonimmediate_operand" "") - (match_operand:HI 1 "general_operand" "")))] - "" - " -{ - if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) - operands[0] = force_reg (HImode, operands[0]); - - i386_compare_gen = gen_cmphi_1; - i386_compare_op0 = operands[0]; - i386_compare_op1 = operands[1]; - DONE; -}") - -(define_insn "cmpqi_1" - [(set (cc0) - (compare (match_operand:QI 0 "nonimmediate_operand" "q,mq") - (match_operand:QI 1 "general_operand" "qm,nq")))] - "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM" - "* return AS2 (cmp%B0,%1,%0);" - [(set_attr "type" "compare")]) - -(define_expand "cmpqi" - [(set (cc0) - (compare (match_operand:QI 0 "nonimmediate_operand" "") - (match_operand:QI 1 "general_operand" "")))] - "" - " -{ - if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) - operands[0] = force_reg (QImode, operands[0]); - - i386_compare_gen = gen_cmpqi_1; - i386_compare_op0 = operands[0]; - i386_compare_op1 = operands[1]; - DONE; -}") - -;; These implement float point compares. For each of DFmode and -;; SFmode, there is the normal insn, and an insn where the second operand -;; is converted to the desired mode. - -(define_insn "" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(match_operand:XF 0 "register_operand" "f") - (match_operand:XF 1 "register_operand" "f")])) - (clobber (match_scratch:HI 3 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(match_operand:XF 0 "register_operand" "f") - (float_extend:XF - (match_operand:DF 1 "nonimmediate_operand" "fm"))])) - (clobber (match_scratch:HI 3 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(float_extend:XF - (match_operand:DF 0 "nonimmediate_operand" "fm")) - (match_operand:XF 1 "register_operand" "f")])) - (clobber (match_scratch:HI 3 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(match_operand:XF 0 "register_operand" "f") - (float_extend:XF - (match_operand:SF 1 "nonimmediate_operand" "fm"))])) - (clobber (match_scratch:HI 3 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(float_extend:XF - (match_operand:SF 0 "nonimmediate_operand" "fm")) - (match_operand:XF 1 "register_operand" "f")])) - (clobber (match_scratch:HI 3 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (compare:CCFPEQ (match_operand:XF 0 "register_operand" "f") - (match_operand:XF 1 "register_operand" "f"))) - (clobber (match_scratch:HI 2 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(match_operand:DF 0 "nonimmediate_operand" "f,fm") - (match_operand:DF 1 "nonimmediate_operand" "fm,f")])) - (clobber (match_scratch:HI 3 "=a,a"))] - "TARGET_80387 - && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(match_operand:DF 0 "register_operand" "f") - (float_extend:DF - (match_operand:SF 1 "nonimmediate_operand" "fm"))])) - (clobber (match_scratch:HI 3 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(float_extend:DF - (match_operand:SF 0 "nonimmediate_operand" "fm")) - (match_operand:DF 1 "register_operand" "f")])) - (clobber (match_scratch:HI 3 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(float_extend:DF - (match_operand:SF 0 "register_operand" "f")) - (match_operand:DF 1 "nonimmediate_operand" "fm")])) - (clobber (match_scratch:HI 3 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (compare:CCFPEQ (match_operand:DF 0 "register_operand" "f") - (match_operand:DF 1 "register_operand" "f"))) - (clobber (match_scratch:HI 2 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -;; These two insns will never be generated by combine due to the mode of -;; the COMPARE. -;(define_insn "" -; [(set (cc0) -; (compare:CCFPEQ (match_operand:DF 0 "register_operand" "f") -; (float_extend:DF -; (match_operand:SF 1 "register_operand" "f")))) -; (clobber (match_scratch:HI 2 "=a"))] -; "TARGET_80387" -; "* return output_float_compare (insn, operands);") -; -;(define_insn "" -; [(set (cc0) -; (compare:CCFPEQ (float_extend:DF -; (match_operand:SF 0 "register_operand" "f")) -; (match_operand:DF 1 "register_operand" "f"))) -; (clobber (match_scratch:HI 2 "=a"))] -; "TARGET_80387" -; "* return output_float_compare (insn, operands);") - -(define_insn "*cmpsf_cc_1" - [(set (cc0) - (match_operator 2 "VOIDmode_compare_op" - [(match_operand:SF 0 "nonimmediate_operand" "f,fm") - (match_operand:SF 1 "nonimmediate_operand" "fm,f")])) - (clobber (match_scratch:HI 3 "=a,a"))] - "TARGET_80387 - && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_insn "" - [(set (cc0) - (compare:CCFPEQ (match_operand:SF 0 "register_operand" "f") - (match_operand:SF 1 "register_operand" "f"))) - (clobber (match_scratch:HI 2 "=a"))] - "TARGET_80387" - "* return output_float_compare (insn, operands);" - [(set_attr "type" "fcompare")]) - -(define_expand "cmpxf" - [(set (cc0) - (compare (match_operand:XF 0 "register_operand" "") - (match_operand:XF 1 "register_operand" "")))] - "TARGET_80387" - " -{ - i386_compare_gen = gen_cmpxf_cc; - i386_compare_gen_eq = gen_cmpxf_ccfpeq; - i386_compare_op0 = operands[0]; - i386_compare_op1 = operands[1]; - DONE; -}") - -(define_expand "cmpdf" - [(set (cc0) - (compare (match_operand:DF 0 "register_operand" "") - (match_operand:DF 1 "general_operand" "")))] - "TARGET_80387" - " -{ - i386_compare_gen = gen_cmpdf_cc; - i386_compare_gen_eq = gen_cmpdf_ccfpeq; - i386_compare_op0 = operands[0]; - i386_compare_op1 = (immediate_operand (operands[1], DFmode)) - ? copy_to_mode_reg (DFmode, operands[1]) : operands[1]; - DONE; -}") - -(define_expand "cmpsf" - [(set (cc0) - (compare (match_operand:SF 0 "register_operand" "") - (match_operand:SF 1 "general_operand" "")))] - "TARGET_80387" - " -{ - i386_compare_gen = gen_cmpsf_cc; - i386_compare_gen_eq = gen_cmpsf_ccfpeq; - i386_compare_op0 = operands[0]; - i386_compare_op1 = (immediate_operand (operands[1], SFmode)) - ? copy_to_mode_reg (SFmode, operands[1]) : operands[1]; - DONE; -}") - -(define_expand "cmpxf_cc" - [(parallel [(set (cc0) - (compare (match_operand:XF 0 "register_operand" "") - (match_operand:XF 1 "register_operand" ""))) - (clobber (match_scratch:HI 2 ""))])] - "TARGET_80387" - "") - -(define_expand "cmpxf_ccfpeq" - [(parallel [(set (cc0) - (compare:CCFPEQ (match_operand:XF 0 "register_operand" "") - (match_operand:XF 1 "register_operand" ""))) - (clobber (match_scratch:HI 2 ""))])] - "TARGET_80387" - "") - -(define_expand "cmpdf_cc" - [(parallel [(set (cc0) - (compare (match_operand:DF 0 "register_operand" "") - (match_operand:DF 1 "register_operand" ""))) - (clobber (match_scratch:HI 2 ""))])] - "TARGET_80387" - "") - -(define_expand "cmpdf_ccfpeq" - [(parallel [(set (cc0) - (compare:CCFPEQ (match_operand:DF 0 "register_operand" "") - (match_operand:DF 1 "register_operand" ""))) - (clobber (match_scratch:HI 2 ""))])] - "TARGET_80387" - " -{ - if (! register_operand (operands[1], DFmode)) - operands[1] = copy_to_mode_reg (DFmode, operands[1]); -}") - -(define_expand "cmpsf_cc" - [(parallel [(set (cc0) - (compare (match_operand:SF 0 "register_operand" "") - (match_operand:SF 1 "register_operand" ""))) - (clobber (match_scratch:HI 2 ""))])] - "TARGET_80387" - "") - -(define_expand "cmpsf_ccfpeq" - [(parallel [(set (cc0) - (compare:CCFPEQ (match_operand:SF 0 "register_operand" "") - (match_operand:SF 1 "register_operand" ""))) - (clobber (match_scratch:HI 2 ""))])] - "TARGET_80387" - " -{ - if (! register_operand (operands[1], SFmode)) - operands[1] = copy_to_mode_reg (SFmode, operands[1]); -}") - -;; logical compare - -(define_insn "" - [(set (cc0) - (and:SI (match_operand:SI 0 "general_operand" "%ro") - (match_operand:SI 1 "nonmemory_operand" "ri")))] - "" - "* -{ - /* For small integers, we may actually use testb. */ - if (GET_CODE (operands[1]) == CONST_INT - && ! (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])) - && (! REG_P (operands[0]) || QI_REG_P (operands[0])) - /* A Pentium test is pairable only with eax. Not with ah or al. */ - && (! REG_P (operands[0]) || REGNO (operands[0]) || !TARGET_PENTIUM - || optimize_size)) - { - /* We may set the sign bit spuriously. */ - - if ((INTVAL (operands[1]) & ~0xff) == 0) - { - cc_status.flags |= CC_NOT_NEGATIVE; - return AS2 (test%B0,%1,%b0); - } - - if ((INTVAL (operands[1]) & ~0xff00) == 0) - { - cc_status.flags |= CC_NOT_NEGATIVE; - operands[1] = GEN_INT (INTVAL (operands[1]) >> 8); - - if (QI_REG_P (operands[0])) - return AS2 (test%B0,%1,%h0); - else - { - operands[0] = adj_offsettable_operand (operands[0], 1); - return AS2 (test%B0,%1,%b0); - } - } - - if (GET_CODE (operands[0]) == MEM - && (INTVAL (operands[1]) & ~0xff0000) == 0) - { - cc_status.flags |= CC_NOT_NEGATIVE; - operands[1] = GEN_INT (INTVAL (operands[1]) >> 16); - operands[0] = adj_offsettable_operand (operands[0], 2); - return AS2 (test%B0,%1,%b0); - } - - if (GET_CODE (operands[0]) == MEM - && (INTVAL (operands[1]) & ~0xff000000) == 0) - { - operands[1] = GEN_INT ((INTVAL (operands[1]) >> 24) & 0xff); - operands[0] = adj_offsettable_operand (operands[0], 3); - return AS2 (test%B0,%1,%b0); - } - } - - if (CONSTANT_P (operands[1]) || GET_CODE (operands[0]) == MEM) - return AS2 (test%L0,%1,%0); - - return AS2 (test%L1,%0,%1); -}" - [(set_attr "type" "compare")]) - -(define_insn "" - [(set (cc0) - (and:HI (match_operand:HI 0 "general_operand" "%ro") - (match_operand:HI 1 "nonmemory_operand" "ri")))] - "" - "* -{ - if (GET_CODE (operands[1]) == CONST_INT - && ! (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])) - && (! REG_P (operands[0]) || QI_REG_P (operands[0]))) - { - if ((INTVAL (operands[1]) & 0xff00) == 0) - { - /* ??? This might not be necessary. */ - if (INTVAL (operands[1]) & 0xffff0000) - operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff); - - /* We may set the sign bit spuriously. */ - cc_status.flags |= CC_NOT_NEGATIVE; - return AS2 (test%B0,%1,%b0); - } - - if ((INTVAL (operands[1]) & 0xff) == 0) - { - operands[1] = GEN_INT ((INTVAL (operands[1]) >> 8) & 0xff); - - if (QI_REG_P (operands[0])) - return AS2 (test%B0,%1,%h0); - else - { - operands[0] = adj_offsettable_operand (operands[0], 1); - return AS2 (test%B0,%1,%b0); - } - } - } - - /* use 32-bit test instruction if there are no sign issues */ - if (GET_CODE (operands[1]) == CONST_INT - && !(INTVAL (operands[1]) & ~0x7fff) - && i386_aligned_p (operands[0])) - return AS2 (test%L0,%1,%k0); - - if (CONSTANT_P (operands[1]) || GET_CODE (operands[0]) == MEM) - return AS2 (test%W0,%1,%0); - - return AS2 (test%W1,%0,%1); -}" - [(set_attr "type" "compare")]) - -(define_insn "" - [(set (cc0) - (and:QI (match_operand:QI 0 "nonimmediate_operand" "%qm") - (match_operand:QI 1 "nonmemory_operand" "qi")))] - "" - "* -{ - if (CONSTANT_P (operands[1]) || GET_CODE (operands[0]) == MEM) - return AS2 (test%B0,%1,%0); - - return AS2 (test%B1,%0,%1); -}" - [(set_attr "type" "compare")]) - -;; move instructions. -;; There is one for each machine mode, -;; and each is preceded by a corresponding push-insn pattern -;; (since pushes are not general_operands on the 386). - -(define_insn "" - [(set (match_operand:SI 0 "push_operand" "=<") - (match_operand:SI 1 "nonmemory_operand" "rn"))] - "flag_pic" - "* return AS1 (push%L0,%1);" - [(set_attr "memory" "store")]) - -(define_insn "" - [(set (match_operand:SI 0 "push_operand" "=<") - (match_operand:SI 1 "nonmemory_operand" "ri"))] - "!flag_pic" - "* return AS1 (push%L0,%1);" - [(set_attr "memory" "store")]) - -;; On a 386, it is faster to push MEM directly. - -(define_insn "" - [(set (match_operand:SI 0 "push_operand" "=<") - (match_operand:SI 1 "memory_operand" "m"))] - "TARGET_PUSH_MEMORY" - "* return AS1 (push%L0,%1);" - [(set_attr "type" "memory") - (set_attr "memory" "load")]) - -;; General case of fullword move. - -;; If generating PIC code and operands[1] is a symbolic CONST, emit a -;; move to get the address of the symbolic object from the GOT. - -(define_expand "movsi" - [(set (match_operand:SI 0 "general_operand" "") - (match_operand:SI 1 "general_operand" ""))] - "" - " -{ - extern int flag_pic; - - if (flag_pic && SYMBOLIC_CONST (operands[1])) - emit_pic_move (operands, SImode); - - /* Don't generate memory->memory moves, go through a register */ - else if (TARGET_MOVE - && no_new_pseudos == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (SImode, operands[1]); - } -}") - -;; On i486, incl reg is faster than movl $1,reg. - -(define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g,r,r") - (match_operand:SI 1 "general_operand" "rn,i,m"))] - "((!TARGET_MOVE || GET_CODE (operands[0]) != MEM) - || (GET_CODE (operands[1]) != MEM)) - && flag_pic" - "* -{ - rtx link; - - /* K6: mov reg,0 is slightly faster than xor reg,reg but is 3 bytes - longer. */ - if ((ix86_cpu != PROCESSOR_K6 || optimize_size) - && operands[1] == const0_rtx && REG_P (operands[0])) - return AS2 (xor%L0,%0,%0); - - if (operands[1] == const1_rtx - /* PPRO and K6 prefer mov to inc to reduce dependencies. */ - && (optimize_size || (int)ix86_cpu < (int)PROCESSOR_PENTIUMPRO) - && (link = find_reg_note (insn, REG_WAS_0, 0)) - /* Make sure the insn that stored the 0 is still present. */ - && ! INSN_DELETED_P (XEXP (link, 0)) - && GET_CODE (XEXP (link, 0)) != NOTE - /* Make sure cross jumping didn't happen here. */ - && no_labels_between_p (XEXP (link, 0), insn) - /* Make sure the reg hasn't been clobbered. */ - && ! reg_set_between_p (operands[0], XEXP (link, 0), insn)) - /* Fastest way to change a 0 to a 1. */ - return AS1 (inc%L0,%0); - - if (SYMBOLIC_CONST (operands[1])) - return AS2 (lea%L0,%a1,%0); - - return AS2 (mov%L0,%1,%0); -}" - [(set_attr "type" "integer,integer,memory") - (set_attr "memory" "*,*,load")]) - -(define_insn "" - [(set (match_operand:SI 0 "general_operand" "=g,r") - (match_operand:SI 1 "general_operand" "ri,m"))] - "((!TARGET_MOVE || GET_CODE (operands[0]) != MEM) - || (GET_CODE (operands[1]) != MEM)) - && !flag_pic" - "* -{ - rtx link; - - /* Use of xor was disabled for AMD K6 as recommended by the Optimization - Manual. My test shows, that this generally hurts the performance, because - mov is longer and takes longer to decode and decoding is the main - bottleneck of K6 when executing GCC code. */ - - if (operands[1] == const0_rtx && REG_P (operands[0])) - return AS2 (xor%L0,%0,%0); - - if (operands[1] == const1_rtx - /* PPRO and K6 prefer mov to inc to reduce dependencies. */ - && (optimize_size || (int)ix86_cpu < (int)PROCESSOR_PENTIUMPRO) - && (link = find_reg_note (insn, REG_WAS_0, 0)) - /* Make sure the insn that stored the 0 is still present. */ - && ! INSN_DELETED_P (XEXP (link, 0)) - && GET_CODE (XEXP (link, 0)) != NOTE - /* Make sure cross jumping didn't happen here. */ - && no_labels_between_p (XEXP (link, 0), insn) - /* Make sure the reg hasn't been clobbered. */ - && ! reg_set_between_p (operands[0], XEXP (link, 0), insn)) - /* Fastest way to change a 0 to a 1. */ - return AS1 (inc%L0,%0); - - return AS2 (mov%L0,%1,%0); -}" - [(set_attr "type" "integer,memory") - (set_attr "memory" "*,load")]) - -(define_insn "" - [(set (match_operand:HI 0 "push_operand" "=<") - (match_operand:HI 1 "nonmemory_operand" "ri"))] - "" - "* return AS1 (push%W0,%1);" - [(set_attr "type" "memory") - (set_attr "memory" "store")]) - -(define_insn "" - [(set (match_operand:HI 0 "push_operand" "=<") - (match_operand:HI 1 "memory_operand" "m"))] - "TARGET_PUSH_MEMORY" - "* return AS1 (push%W0,%1);" - [(set_attr "type" "memory") - (set_attr "memory" "load")]) - -;; On i486, an incl and movl are both faster than incw and movw. - -(define_expand "movhi" - [(set (match_operand:HI 0 "general_operand" "") - (match_operand:HI 1 "general_operand" ""))] - "" - " -{ - /* Don't generate memory->memory moves, go through a register */ - if (TARGET_MOVE - && no_new_pseudos == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (HImode, operands[1]); - } -}") - -(define_insn "" - [(set (match_operand:HI 0 "general_operand" "=g,r") - (match_operand:HI 1 "general_operand" "ri,m"))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)" - "* -{ - rtx link; - if (REG_P (operands[0]) && operands[1] == const0_rtx) - return AS2 (xor%L0,%k0,%k0); - - if (REG_P (operands[0]) && operands[1] == const1_rtx - /* PPRO and K6 prefer mov to inc to reduce dependencies. */ - && (optimize_size || (int)ix86_cpu < (int)PROCESSOR_PENTIUMPRO) - && (link = find_reg_note (insn, REG_WAS_0, 0)) - /* Make sure the insn that stored the 0 is still present. */ - && ! INSN_DELETED_P (XEXP (link, 0)) - && GET_CODE (XEXP (link, 0)) != NOTE - /* Make sure cross jumping didn't happen here. */ - && no_labels_between_p (XEXP (link, 0), insn) - /* Make sure the reg hasn't been clobbered. */ - && ! reg_set_between_p (operands[0], XEXP (link, 0), insn)) - /* Fastest way to change a 0 to a 1. */ - return AS1 (inc%L0,%k0); - - if (REG_P (operands[0])) - { - if (i386_aligned_p (operands[1])) - { - operands[1] = i386_sext16_if_const (operands[1]); - return AS2 (mov%L0,%k1,%k0); - } - if (! TARGET_ZERO_EXTEND_WITH_AND) - { - /* movzwl is faster than movw on the Pentium Pro, - * although not as fast as an aligned movl. */ -#ifdef INTEL_SYNTAX - return AS2 (movzx,%1,%k0); -#else - return AS2 (movz%W0%L0,%1,%k0); -#endif - } - } - - return AS2 (mov%W0,%1,%0); -}" - [(set_attr "type" "integer,memory") - (set_attr "memory" "*,load")]) - -(define_expand "movstricthi" - [(set (strict_low_part (match_operand:HI 0 "general_operand" "")) - (match_operand:HI 1 "general_operand" ""))] - "" - " -{ - /* Don't generate memory->memory moves, go through a register */ - if (TARGET_MOVE - && no_new_pseudos == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (HImode, operands[1]); - } -}") - -(define_insn "" - [(set (strict_low_part (match_operand:HI 0 "general_operand" "+g,r")) - (match_operand:HI 1 "general_operand" "ri,m"))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)" - "* -{ - rtx link; - - /* Use of xor was disabled for AMD K6 as recommended by the Optimization - Manual. My test shows, that this generally hurts the performance, because - mov is longer and takes longer to decode and decoding is the main - bottleneck of K6 when executing GCC code. */ - - if (operands[1] == const0_rtx && REG_P (operands[0])) - return AS2 (xor%W0,%0,%0); - - if (operands[1] == const1_rtx - /* PPRO and K6 prefer mov to inc to reduce dependencies. */ - && (optimize_size || (int)ix86_cpu < (int)PROCESSOR_PENTIUMPRO) - && (link = find_reg_note (insn, REG_WAS_0, 0)) - /* Make sure the insn that stored the 0 is still present. */ - && ! INSN_DELETED_P (XEXP (link, 0)) - && GET_CODE (XEXP (link, 0)) != NOTE - /* Make sure cross jumping didn't happen here. */ - && no_labels_between_p (XEXP (link, 0), insn) - /* Make sure the reg hasn't been clobbered. */ - && ! reg_set_between_p (operands[0], XEXP (link, 0), insn)) - /* Fastest way to change a 0 to a 1. */ - return AS1 (inc%W0,%0); - - return AS2 (mov%W0,%1,%0); -}" - [(set_attr "type" "integer,memory")]) - -;; emit_push_insn when it calls move_by_pieces -;; requires an insn to "push a byte". -;; But actually we use pushw, which has the effect of rounding -;; the amount pushed up to a halfword. -(define_insn "" - [(set (match_operand:QI 0 "push_operand" "=<") - (match_operand:QI 1 "const_int_operand" "n"))] - "" - "* return AS1(push%W0,%1);") - -(define_insn "" - [(set (match_operand:QI 0 "push_operand" "=<") - (match_operand:QI 1 "register_operand" "q"))] - "" - "* -{ - operands[1] = gen_rtx_REG (HImode, REGNO (operands[1])); - return AS1 (push%W0,%1); -}") - -;; On i486, incb reg is faster than movb $1,reg. - -;; ??? Do a recognizer for zero_extract that looks just like this, but reads -;; or writes %ah, %bh, %ch, %dh. - -(define_expand "movqi" - [(set (match_operand:QI 0 "general_operand" "") - (match_operand:QI 1 "general_operand" ""))] - "" - " -{ - /* Don't generate memory->memory moves, go through a register */ - if (TARGET_MOVE - && no_new_pseudos == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (QImode, operands[1]); - } -}") - -(define_insn "" - [(set (match_operand:QI 0 "nonimmediate_operand" "=q,*r,qm") - (match_operand:QI 1 "general_operand" "*g,*rn,qn"))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)" - "* -{ - rtx link; - - /* movb $0,reg8 is 2 bytes, the same as xorl reg8,reg8. - It is at least as fast as xor on any processor except a Pentium. */ - - if (operands[1] == const1_rtx - && TARGET_PENTIUM - && (link = find_reg_note (insn, REG_WAS_0, 0)) - /* Make sure the insn that stored the 0 is still present. */ - && ! INSN_DELETED_P (XEXP (link, 0)) - && GET_CODE (XEXP (link, 0)) != NOTE - /* Make sure cross jumping didn't happen here. */ - && no_labels_between_p (XEXP (link, 0), insn) - /* Make sure the reg hasn't been clobbered. */ - && ! reg_set_between_p (operands[0], XEXP (link, 0), insn)) - { - /* Fastest way to change a 0 to a 1. - If inc%B0 isn't allowed, use inc%L0. */ - if (NON_QI_REG_P (operands[0])) - return AS1 (inc%L0,%k0); - else - return AS1 (inc%B0,%0); - } - - /* If mov%B0 isn't allowed for one of these regs, use mov%L0. */ - if (NON_QI_REG_P (operands[0]) || NON_QI_REG_P (operands[1])) - return (AS2 (mov%L0,%k1,%k0)); - - return (AS2 (mov%B0,%1,%0)); -}") - -;; If it becomes necessary to support movstrictqi into %esi or %edi, -;; use the insn sequence: -;; -;; shrdl $8,srcreg,dstreg -;; rorl $24,dstreg -;; -;; If operands[1] is a constant, then an andl/orl sequence would be -;; faster. - -(define_expand "movstrictqi" - [(set (strict_low_part (match_operand:QI 0 "general_operand" "")) - (match_operand:QI 1 "general_operand" ""))] - "" - " -{ - /* Don't generate memory->memory moves, go through a register */ - if (TARGET_MOVE - && no_new_pseudos == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (QImode, operands[1]); - } -}") - -(define_insn "" - [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q")) - (match_operand:QI 1 "general_operand" "*qn,m"))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)" - "* -{ - rtx link; - - /* movb $0,reg8 is 2 bytes, the same as xorl reg8,reg8. */ - - if (operands[1] == const1_rtx - && TARGET_PENTIUM - && ! NON_QI_REG_P (operands[0]) - && (link = find_reg_note (insn, REG_WAS_0, 0)) - /* Make sure the insn that stored the 0 is still present. */ - && ! INSN_DELETED_P (XEXP (link, 0)) - && GET_CODE (XEXP (link, 0)) != NOTE - /* Make sure cross jumping didn't happen here. */ - && no_labels_between_p (XEXP (link, 0), insn) - /* Make sure the reg hasn't been clobbered. */ - && ! reg_set_between_p (operands[0], XEXP (link, 0), insn)) - /* Fastest way to change a 0 to a 1. */ - return AS1 (inc%B0,%0); - - /* If mov%B0 isn't allowed for one of these regs, use mov%L0. */ - if (NON_QI_REG_P (operands[0]) || NON_QI_REG_P (operands[1])) - { - abort (); - return (AS2 (mov%L0,%k1,%k0)); - } - - return AS2 (mov%B0,%1,%0); -}") - -(define_insn "movsf_push" - [(set (match_operand:SF 0 "push_operand" "=<,<") - (match_operand:SF 1 "general_operand" "*rfF,m"))] - "TARGET_PUSH_MEMORY || GET_CODE (operands[1]) != MEM - || reload_in_progress || reload_completed" - "* -{ - if (STACK_REG_P (operands[1])) - { - rtx xops[3]; - - if (! STACK_TOP_P (operands[1])) - abort (); - - xops[0] = AT_SP (SFmode); - xops[1] = GEN_INT (4); - xops[2] = stack_pointer_rtx; - - output_asm_insn (AS2 (sub%L2,%1,%2), xops); - - if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG)) - output_asm_insn (AS1 (fstp%S0,%0), xops); - else - output_asm_insn (AS1 (fst%S0,%0), xops); - - RET; - } - - return AS1 (push%L0,%1); -}") - -(define_split - [(set (match_operand:SF 0 "push_operand" "") - (match_operand:SF 1 "general_operand" ""))] - "reload_completed && STACK_REG_P (operands[1])" - [(set (reg:SI 7) - (minus:SI (reg:SI 7) (const_int 4))) - (set (mem:SF (reg:SI 7)) - (match_dup 1))] - "") - -(define_expand "movsf" - [(set (match_operand:SF 0 "general_operand" "") - (match_operand:SF 1 "general_operand" ""))] - "" - " -{ - /* Don't generate memory->memory moves, go through a register */ - if (TARGET_MOVE - && no_new_pseudos == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (SFmode, operands[1]); - } - - /* If we are loading a floating point constant that isn't 0 or 1 - into a register, force the value to memory now, since we'll - get better code out the back end. */ - else if ((reload_in_progress | reload_completed) == 0 - && GET_CODE (operands[0]) != MEM - && GET_CODE (operands[1]) == CONST_DOUBLE - && !standard_80387_constant_p (operands[1])) - { - operands[1] = validize_mem (force_const_mem (SFmode, operands[1])); - } -}") - -;; For the purposes of regclass, prefer FLOAT_REGS. -(define_insn "" - [(set (match_operand:SF 0 "nonimmediate_operand" "=f,m,!*r,!m") - (match_operand:SF 1 "general_operand" "fmG,f,*rmF,*rF"))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)" - "* -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - - /* First handle a `pop' insn or a `fld %st(0)' */ - - if (STACK_TOP_P (operands[0]) && STACK_TOP_P (operands[1])) - { - if (stack_top_dies) - return AS1 (fstp,%y0); - else - return AS1 (fld,%y0); - } - - /* Handle other kinds of writes from the 387 */ - - if (STACK_TOP_P (operands[1])) - { - if (stack_top_dies) - return AS1 (fstp%z0,%y0); - else - return AS1 (fst%z0,%y0); - } - - /* Handle other kinds of reads to the 387 */ - - if (STACK_TOP_P (operands[0]) && GET_CODE (operands[1]) == CONST_DOUBLE) - return output_move_const_single (operands); - - if (STACK_TOP_P (operands[0])) - return AS1 (fld%z1,%y1); - - /* Handle all SFmode moves not involving the 387 */ - - return singlemove_string (operands); -}" - [(set_attr "type" "fld")]) - - -(define_insn "swapsf" - [(set (match_operand:SF 0 "register_operand" "f") - (match_operand:SF 1 "register_operand" "f")) - (set (match_dup 1) - (match_dup 0))] - "" - "* -{ - if (STACK_TOP_P (operands[0])) - return AS1 (fxch,%1); - else - return AS1 (fxch,%0); -}") - - -(define_insn "movdf_push" - [(set (match_operand:DF 0 "push_operand" "=<,<") - (match_operand:DF 1 "general_operand" "*rfF,o"))] - "TARGET_PUSH_MEMORY || GET_CODE (operands[1]) != MEM - || reload_in_progress || reload_completed" - "* -{ - if (STACK_REG_P (operands[1])) - { - rtx xops[3]; - - xops[0] = AT_SP (DFmode); - xops[1] = GEN_INT (8); - xops[2] = stack_pointer_rtx; - - output_asm_insn (AS2 (sub%L2,%1,%2), xops); - - if (find_regno_note (insn, REG_DEAD, FIRST_STACK_REG)) - output_asm_insn (AS1 (fstp%Q0,%0), xops); - else - output_asm_insn (AS1 (fst%Q0,%0), xops); - - RET; - } - - if (which_alternative == 1) - return output_move_pushmem (operands, insn, GET_MODE_SIZE (DFmode), 0, 0); - - return output_move_double (operands); -}") - -(define_split - [(set (match_operand:DF 0 "push_operand" "") - (match_operand:DF 1 "register_operand" ""))] - "reload_completed && STACK_REG_P (operands[1])" - [(set (reg:SI 7) - (minus:SI (reg:SI 7) (const_int 8))) - (set (mem:DF (reg:SI 7)) - (match_dup 1))] - "") - -(define_expand "movdf" - [(set (match_operand:DF 0 "general_operand" "") - (match_operand:DF 1 "general_operand" ""))] - "" - " -{ - /* Don't generate memory->memory moves, go through a register */ - if (TARGET_MOVE - && no_new_pseudos == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (DFmode, operands[1]); - } - - /* If we are loading a floating point constant that isn't 0 or 1 into a - register, indicate we need the pic register loaded. This could be - optimized into stores of constants if the target eventually moves to - memory, but better safe than sorry. */ - else if ((reload_in_progress | reload_completed) == 0 - && GET_CODE (operands[0]) != MEM - && GET_CODE (operands[1]) == CONST_DOUBLE - && !standard_80387_constant_p (operands[1])) - { - operands[1] = validize_mem (force_const_mem (DFmode, operands[1])); - } -}") - -;; For the purposes of regclass, prefer FLOAT_REGS. -(define_insn "" - [(set (match_operand:DF 0 "nonimmediate_operand" "=f,m,!*r,!o") - (match_operand:DF 1 "general_operand" "fmG,f,*roF,*rF"))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) - || (GET_CODE (operands[1]) != MEM)" - "* -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - - /* First handle a `pop' insn or a `fld %st(0)' */ - - if (STACK_TOP_P (operands[0]) && STACK_TOP_P (operands[1])) - { - if (stack_top_dies) - return AS1 (fstp,%y0); - else - return AS1 (fld,%y0); - } - - /* Handle other kinds of writes from the 387 */ - - if (STACK_TOP_P (operands[1])) - { - if (stack_top_dies) - return AS1 (fstp%z0,%y0); - else - return AS1 (fst%z0,%y0); - } - - /* Handle other kinds of reads to the 387 */ - - if (STACK_TOP_P (operands[0]) && GET_CODE (operands[1]) == CONST_DOUBLE) - return output_move_const_single (operands); - - if (STACK_TOP_P (operands[0])) - return AS1 (fld%z1,%y1); - - /* Handle all DFmode moves not involving the 387 */ - - return output_move_double (operands); -}" - [(set_attr "type" "fld")]) - - - -(define_insn "swapdf" - [(set (match_operand:DF 0 "register_operand" "f") - (match_operand:DF 1 "register_operand" "f")) - (set (match_dup 1) - (match_dup 0))] - "" - "* -{ - if (STACK_TOP_P (operands[0])) - return AS1 (fxch,%1); - else - return AS1 (fxch,%0); -}") - -(define_insn "movxf_push" - [(set (match_operand:XF 0 "push_operand" "=<,<") - (match_operand:XF 1 "general_operand" "*rfF,o"))] - "TARGET_PUSH_MEMORY || GET_CODE (operands[1]) != MEM - || reload_in_progress || reload_completed" - "* -{ - if (STACK_REG_P (operands[1])) - { - rtx xops[3]; - - xops[0] = AT_SP (XFmode); - xops[1] = GEN_INT (12); - xops[2] = stack_pointer_rtx; - - output_asm_insn (AS2 (sub%L2,%1,%2), xops); - - output_asm_insn (AS1 (fstp%T0,%0), xops); - if (! find_regno_note (insn, REG_DEAD, FIRST_STACK_REG)) - output_asm_insn (AS1 (fld%T0,%0), xops); - - RET; - } - - if (which_alternative == 1) - return output_move_pushmem (operands, insn, GET_MODE_SIZE (XFmode), 0, 0); - - return output_move_double (operands); - }") - -(define_split - [(set (match_operand:XF 0 "push_operand" "") - (match_operand:XF 1 "register_operand" ""))] - "reload_completed && STACK_REG_P (operands[1])" - [(set (reg:SI 7) - (minus:SI (reg:SI 7) (const_int 12))) - (set (mem:XF (reg:SI 7)) - (match_dup 1))] - "") - -(define_expand "movxf" - [(set (match_operand:XF 0 "general_operand" "") - (match_operand:XF 1 "general_operand" ""))] - "" - " -{ - /* Don't generate memory->memory moves, go through a register */ - if (TARGET_MOVE - && no_new_pseudos == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (XFmode, operands[1]); - } - - /* If we are loading a floating point constant that isn't 0 or 1 - into a register, indicate we need the pic register loaded. This could - be optimized into stores of constants if the target eventually moves - to memory, but better safe than sorry. */ - else if ((reload_in_progress | reload_completed) == 0 - && GET_CODE (operands[0]) != MEM - && GET_CODE (operands[1]) == CONST_DOUBLE - && !standard_80387_constant_p (operands[1])) - { - operands[1] = validize_mem (force_const_mem (XFmode, operands[1])); - } -}") - - -(define_insn "" - [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,!*r,!o") - (match_operand:XF 1 "general_operand" "fmG,f,*roF,*rF"))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) - || (GET_CODE (operands[1]) != MEM)" - "* -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - - /* First handle a `pop' insn or a `fld %st(0)' */ - - if (STACK_TOP_P (operands[0]) && STACK_TOP_P (operands[1])) - { - if (stack_top_dies) - return AS1 (fstp,%y0); - else - return AS1 (fld,%y0); - } - - /* Handle other kinds of writes from the 387 */ - - if (STACK_TOP_P (operands[1])) - { - output_asm_insn (AS1 (fstp%z0,%y0), operands); - if (! stack_top_dies) - return AS1 (fld%z0,%y0); - - RET; - } - - /* Handle other kinds of reads to the 387 */ - - if (STACK_TOP_P (operands[0]) && GET_CODE (operands[1]) == CONST_DOUBLE) - return output_move_const_single (operands); - - if (STACK_TOP_P (operands[0])) - return AS1 (fld%z1,%y1); - - /* Handle all XFmode moves not involving the 387 */ - - return output_move_double (operands); -}") - -(define_insn "swapxf" - [(set (match_operand:XF 0 "register_operand" "f") - (match_operand:XF 1 "register_operand" "f")) - (set (match_dup 1) - (match_dup 0))] - "" - "* -{ - if (STACK_TOP_P (operands[0])) - return AS1 (fxch,%1); - else - return AS1 (fxch,%0); -}") - -(define_insn "" - [(set (match_operand:DI 0 "push_operand" "=<") - (match_operand:DI 1 "general_operand" "riF"))] - "" - "* return output_move_double (operands);") - -(define_insn "" - [(set (match_operand:DI 0 "push_operand" "=<") - (match_operand:DI 1 "memory_operand" "o"))] - "TARGET_PUSH_MEMORY" - "* return output_move_pushmem (operands, insn, GET_MODE_SIZE (DImode),0,0);") - -(define_expand "movdi" - [(set (match_operand:DI 0 "general_operand" "") - (match_operand:DI 1 "general_operand" ""))] - "" - " -{ - /* Don't generate memory->memory moves, go through a register */ - if (TARGET_MOVE - && no_new_pseudos == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - operands[1] = force_reg (DImode, operands[1]); - } -}") - -(define_insn "" - [(set (match_operand:DI 0 "general_operand" "=g,r") - (match_operand:DI 1 "general_operand" "riF,m"))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) - || (GET_CODE (operands[1]) != MEM)" - "* return output_move_double (operands);" - [(set_attr "type" "integer,memory") - (set_attr "memory" "*,load")]) - -(define_split - [(set (match_operand:DI 0 "nonimmediate_operand" "") - (match_operand:DI 1 "general_operand" ""))] - "reload_completed - && (offsettable_memref_p (operands[0]) - || nonmemory_operand (operands[0], DImode)) - && (offsettable_memref_p (operands[1]) - || nonmemory_operand (operands[1], DImode)) - && (! reg_overlap_mentioned_p (gen_lowpart (SImode, operands[0]), - operands[1]) - || ! reg_overlap_mentioned_p (gen_highpart (SImode, operands[0]), - operands[1]))" - [(set (match_dup 2) - (match_dup 4)) - (set (match_dup 3) - (match_dup 5))] - " -{ - split_di (&operands[0], 1, &operands[2], &operands[3]); - split_di (&operands[1], 1, &operands[4], &operands[5]); - - if (reg_overlap_mentioned_p (operands[2], operands[1])) - { - rtx tmp; - - tmp = operands[2]; - operands[2] = operands[3]; - operands[3] = tmp; - - tmp = operands[4]; - operands[4] = operands[5]; - operands[5] = tmp; - } -}") - -;;- conversion instructions -;;- NONE - -;;- zero extension instructions -;; See comments by `andsi' for when andl is faster than movzx. - -(define_expand "zero_extendhisi2" - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))] - "" - "") - -;; When optimizing for the PPro/PII or code size, always use movzwl. -;; We want to use a different pattern so we can use different constraints -;; than the generic pattern. -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r") - (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))] - "(optimize_size || (int)ix86_cpu == (int)PROCESSOR_PENTIUMPRO)" - "* return AS2 (movz%W0%L0,%1,%0);") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r,&r,?r") - (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,rm,rm")))] - "! (optimize_size || (int)ix86_cpu == (int)PROCESSOR_PENTIUMPRO)" - "* - { - rtx xops[2]; - - if ((TARGET_ZERO_EXTEND_WITH_AND || REGNO (operands[0]) == 0) - && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])) - { - xops[0] = operands[0]; - xops[1] = GEN_INT (0xffff); - output_asm_insn (AS2 (and%L0,%1,%k0), xops); - RET; - } - if (TARGET_ZERO_EXTEND_WITH_AND && !reg_overlap_mentioned_p (operands[0], operands[1])) - { - output_asm_insn (AS2 (xor%L0,%0,%0),operands); - output_asm_insn (AS2 (mov%W0,%1,%w0),operands); - RET; - } - - if (TARGET_ZERO_EXTEND_WITH_AND) - { - xops[0] = operands[0]; - xops[1] = GEN_INT (0xffff); - if (i386_aligned_p (operands[1])) - output_asm_insn (AS2 (mov%L0,%k1,%k0),operands); - else - output_asm_insn (AS2 (mov%W0,%1,%w0),operands); - output_asm_insn (AS2 (and%L0,%1,%k0), xops); - RET; - } - -#ifdef INTEL_SYNTAX - return AS2 (movzx,%1,%0); -#else - return AS2 (movz%W0%L0,%1,%0); -#endif -}") - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))] - "reload_completed && TARGET_ZERO_EXTEND_WITH_AND && !reg_overlap_mentioned_p (operands[0], operands[1])" - [(set (match_dup 0) - (const_int 0)) - (set (strict_low_part (match_dup 2)) - (match_dup 1))] - "operands[2] = gen_rtx_REG (HImode, true_regnum (operands[0]));") - - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:HI 1 "memory_operand" "")))] - "reload_completed && TARGET_ZERO_EXTEND_WITH_AND && reg_overlap_mentioned_p (operands[0], operands[1])" - [(set (strict_low_part (match_dup 2)) - (match_dup 1)) - (set (match_dup 0) - (and:SI (match_dup 0) - (const_int 65535)))] - "operands[2] = gen_rtx_REG (HImode, true_regnum (operands[0]));") - -(define_expand "zero_extendqihi2" - [(set (match_operand:HI 0 "register_operand" "") - (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))] - "" - "") - -(define_insn "" - [(set (match_operand:HI 0 "register_operand" "=r") - (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))] - "optimize_size || (int)ix86_cpu == (int)PROCESSOR_PENTIUMPRO" - - "* return AS2 (movz%B0%W0,%1,%0);") - -(define_insn "" - [(set (match_operand:HI 0 "register_operand" "=q,&q,?r") - (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,qm,qm")))] - "! (optimize_size || (int)ix86_cpu == (int)PROCESSOR_PENTIUMPRO)" - "* - { - rtx xops[2]; - - if ((TARGET_ZERO_EXTEND_WITH_AND || REGNO (operands[0]) == 0) - && REG_P (operands[1]) - && REGNO (operands[0]) == REGNO (operands[1])) - { - xops[0] = operands[0]; - xops[1] = GEN_INT (0xff); - output_asm_insn (AS2 (and%L0,%1,%k0), xops); - RET; - } - if (TARGET_ZERO_EXTEND_WITH_AND && QI_REG_P (operands[0])) - { - if(!reg_overlap_mentioned_p(operands[0],operands[1])) - { - output_asm_insn (AS2 (xor%L0,%k0,%k0), operands); - output_asm_insn (AS2 (mov%B0,%1,%b0), operands); - } - else - { - xops[0] = operands[0]; - xops[1] = GEN_INT (0xff); - output_asm_insn (AS2 (mov%B0,%1,%b0),operands); - output_asm_insn (AS2 (and%L0,%1,%k0), xops); - } - RET; - } - -#ifdef INTEL_SYNTAX - return AS2 (movzx,%1,%0); -#else - return AS2 (movz%B0%W0,%1,%0); -#endif -}") - -(define_split - [(set (match_operand:HI 0 "register_operand" "") - (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))] - "reload_completed && QI_REG_P (operands[0]) && TARGET_ZERO_EXTEND_WITH_AND - && !reg_overlap_mentioned_p (operands[0], operands[1])" - [(set (match_dup 0) - (const_int 0)) - (set (strict_low_part (match_dup 2)) - (match_dup 1))] - "operands[2] = gen_rtx_REG (QImode, REGNO (operands[0]));") - - -(define_split - [(set (match_operand:HI 0 "register_operand" "") - (zero_extend:HI (match_operand:QI 1 "memory_operand" "")))] - "reload_completed && QI_REG_P (operands[0]) && TARGET_ZERO_EXTEND_WITH_AND - && reg_overlap_mentioned_p (operands[0], operands[1])" - [(set (strict_low_part (match_dup 2)) - (match_dup 1)) - (set (match_dup 0) - (and:HI (match_dup 0) - (const_int 255)))] - "operands[2] = gen_rtx_REG (QImode, REGNO (operands[0]));") - -(define_split - [(set (match_operand:HI 0 "register_operand" "") - (zero_extend:HI (match_operand:QI 1 "register_operand" "")))] - "reload_completed && TARGET_ZERO_EXTEND_WITH_AND" - [(set (match_dup 0) - (match_dup 2)) - (set (match_dup 0) - (and:HI (match_dup 0) - (const_int 255)))] - "if (GET_CODE (operands[1]) == SUBREG && SUBREG_WORD (operands[1]) == 0) - operands[1] = SUBREG_REG (operands[1]); - if (GET_CODE (operands[0]) != REG || GET_CODE (operands[1]) != REG - || REGNO (operands[0]) == REGNO (operands[1])) - FAIL; - operands[2] = gen_rtx_REG (HImode, REGNO (operands[1]));") - -(define_expand "zero_extendqisi2" - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))] - "" - "") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r") - (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))] - "optimize_size || (int)ix86_cpu == (int)PROCESSOR_PENTIUMPRO" - "* return AS2 (movz%B0%L0,%1,%0);") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=q,&q,?r") - (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,qm,qm")))] - "! (optimize_size || (int)ix86_cpu == (int)PROCESSOR_PENTIUMPRO)" - "* - { - rtx xops[2]; - - if ((TARGET_ZERO_EXTEND_WITH_AND || REGNO (operands[0]) == 0) - && REG_P (operands[1]) - && REGNO (operands[0]) == REGNO (operands[1])) - { - xops[0] = operands[0]; - xops[1] = GEN_INT (0xff); - output_asm_insn (AS2 (and%L0,%1,%k0), xops); - RET; - } - if (TARGET_ZERO_EXTEND_WITH_AND && QI_REG_P (operands[0])) - { - if(!reg_overlap_mentioned_p (operands[0], operands[1])) - { - output_asm_insn (AS2 (xor%L0,%0,%0),operands); - output_asm_insn (AS2 (mov%B0,%1,%b0),operands); - } - else - { - xops[0] = operands[0]; - xops[1] = GEN_INT (0xff); - output_asm_insn (AS2 (mov%B0,%1,%b0), operands); - output_asm_insn (AS2 (and%L0,%1,%k0), xops); - } - RET; - } - - if (TARGET_ZERO_EXTEND_WITH_AND && GET_CODE (operands[1]) == REG) - { - xops[0] = operands[0]; - xops[1] = GEN_INT (0xff); - operands[1] = gen_rtx_REG (SImode, REGNO (operands[1])); - output_asm_insn (AS2 (mov%L0,%1,%0), operands); - output_asm_insn (AS2 (and%L0,%1,%k0), xops); - RET; - } - -#ifdef INTEL_SYNTAX - return AS2 (movzx,%1,%0); -#else - return AS2 (movz%B0%L0,%1,%0); -#endif -}") - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))] - "reload_completed && QI_REG_P (operands[0]) && TARGET_ZERO_EXTEND_WITH_AND - && !reg_overlap_mentioned_p (operands[0], operands[1])" - [(set (match_dup 0) - (const_int 0)) - (set (strict_low_part (match_dup 2)) - (match_dup 1))] - "operands[2] = gen_rtx_REG (QImode, REGNO (operands[0]));") - - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:QI 1 "memory_operand" "")))] - "reload_completed && QI_REG_P (operands[0]) && TARGET_ZERO_EXTEND_WITH_AND - && reg_overlap_mentioned_p (operands[0], operands[1])" - [(set (strict_low_part (match_dup 2)) - (match_dup 1)) - (set (match_dup 0) - (and:SI (match_dup 0) - (const_int 255)))] - "operands[2] = gen_rtx_REG (QImode, REGNO (operands[0]));") - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:QI 1 "register_operand" "")))] - "reload_completed && TARGET_ZERO_EXTEND_WITH_AND - && ! reg_overlap_mentioned_p (operands[0], operands[1])" - [(set (match_dup 0) - (match_dup 2)) - (set (match_dup 0) - (and:SI (match_dup 0) - (const_int 255)))] - "operands[2] = gen_rtx_REG (SImode, true_regnum (operands[1]));") - -(define_insn "zero_extendsidi2" - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,?r,?*o") - (zero_extend:DI (match_operand:SI 1 "general_operand" "0,rm,r")))] - "" - "#") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (zero_extend:DI (match_operand:SI 1 "register_operand" "")))] - "reload_completed && true_regnum (operands[0]) == true_regnum (operands[1])" - [(set (match_dup 4) (const_int 0))] - "split_di (&operands[0], 1, &operands[3], &operands[4]);") - -(define_split - [(set (match_operand:DI 0 "nonimmediate_operand" "") - (zero_extend:DI (match_operand:SI 1 "general_operand" "")))] - "reload_completed" - [(set (match_dup 3) (match_dup 1)) - (set (match_dup 4) (const_int 0))] - "split_di (&operands[0], 1, &operands[3], &operands[4]);") - -;;- sign extension instructions - -(define_insn "extendsidi2" - [(set (match_operand:DI 0 "nonimmediate_operand" "=A,?r,?Ar,*o") - (sign_extend:DI (match_operand:SI 1 "register_operand" "0,0,r,*r"))) - (clobber (match_scratch:SI 2 "=X,X,X,&r"))] - "" - "#") - -;; Extend to memory case when source register does die. -(define_split - [(set (match_operand:DI 0 "memory_operand" "") - (sign_extend:DI (match_operand:SI 1 "register_operand" ""))) - (clobber (match_operand:SI 2 "register_operand" ""))] - "(flow2_completed - && dead_or_set_p (insn, operands[1]) - && !reg_mentioned_p (operands[1], operands[0]))" - [(set (match_dup 3) (match_dup 1)) - (set (match_dup 1) (ashiftrt:SI (match_dup 1) (const_int 31))) - (set (match_dup 4) (match_dup 1))] - "split_di (&operands[0], 1, &operands[3], &operands[4]);") - -;; Extend to memory case when source register does not die. -(define_split - [(set (match_operand:DI 0 "memory_operand" "") - (sign_extend:DI (match_operand:SI 1 "register_operand" ""))) - (clobber (match_operand:SI 2 "register_operand" ""))] - "flow2_completed" - [(const_int 0)] - " -{ - split_di (&operands[0], 1, &operands[3], &operands[4]); - - emit_move_insn (operands[3], operands[1]); - - /* Generate a cltd if possible and doing so it profitable. */ - if (true_regnum (operands[1]) == 0 - && true_regnum (operands[2]) == 1 - && (optimize_size || !TARGET_PENTIUM)) - { - emit_insn (gen_ashrsi3_31 (operands[2], operands[1])); - } - else - { - emit_move_insn (operands[2], operands[1]); - emit_insn (gen_ashrsi3_31 (operands[2], operands[2])); - } - emit_move_insn (operands[4], operands[2]); - DONE; -}") - -;; Extend to register case. Optimize case where source and destination -;; registers match and cases where we can use cltd. -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (sign_extend:DI (match_operand:SI 1 "register_operand" ""))) - (clobber (match_scratch:SI 2 ""))] - "reload_completed" - [(const_int 0)] - " -{ - split_di (&operands[0], 1, &operands[3], &operands[4]); - - if (true_regnum (operands[3]) != true_regnum (operands[1])) - emit_move_insn (operands[3], operands[1]); - - /* Generate a cltd if possible and doing so it profitable. */ - if (true_regnum (operands[3]) == 0 - && (optimize_size || !TARGET_PENTIUM)) - { - emit_insn (gen_ashrsi3_31 (operands[4], operands[3])); - DONE; - } - - if (true_regnum (operands[4]) != true_regnum (operands[1])) - emit_move_insn (operands[4], operands[1]); - - emit_insn (gen_ashrsi3_31 (operands[4], operands[4])); - DONE; -}") - -;; Note that the i386 programmers' manual says that the opcodes -;; are named movsx..., but the assembler on Unix does not accept that. -;; We use what the Unix assembler expects. - -(define_insn "extendhisi2" - [(set (match_operand:SI 0 "register_operand" "=r") - (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "rm")))] - "" - "* -{ - if (REGNO (operands[0]) == 0 - && REG_P (operands[1]) && REGNO (operands[1]) == 0 - && (optimize_size || ix86_cpu != PROCESSOR_K6)) -#ifdef INTEL_SYNTAX - return \"cwde\"; -#else - return \"cwtl\"; -#endif - -#ifdef INTEL_SYNTAX - return AS2 (movsx,%1,%0); -#else - return AS2 (movs%W0%L0,%1,%0); -#endif -}") - -(define_insn "extendqihi2" - [(set (match_operand:HI 0 "register_operand" "=r") - (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "qm")))] - "" - "* -{ - if (REGNO (operands[0]) == 0 - && REG_P (operands[1]) && REGNO (operands[1]) == 0 - && (optimize_size || ix86_cpu != PROCESSOR_K6)) - return \"cbtw\"; - -#ifdef INTEL_SYNTAX - return AS2 (movsx,%1,%0); -#else - return AS2 (movs%B0%W0,%1,%0); -#endif -}") - -(define_insn "extendqisi2" - [(set (match_operand:SI 0 "register_operand" "=r") - (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")))] - "" - "* -{ -#ifdef INTEL_SYNTAX - return AS2 (movsx,%1,%0); -#else - return AS2 (movs%B0%L0,%1,%0); -#endif -}") - - -;; Truncation of long long -> 32 bit - -(define_expand "truncdisi2" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m") - (truncate:SI (match_operand:DI 1 "nonimmediate_operand" "ro,r")))] - "" - " -{ - /* Don't generate memory->memory moves, go through a register */ - if (TARGET_MOVE - && (reload_in_progress | reload_completed) == 0 - && GET_CODE (operands[0]) == MEM - && GET_CODE (operands[1]) == MEM) - { - rtx target = gen_reg_rtx (SImode); - emit_insn (gen_truncdisi2 (target, operands[1])); - emit_move_insn (operands[0], target); - DONE; - } -}") - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m") - (truncate:SI (match_operand:DI 1 "nonimmediate_operand" "ro,r")))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)" - "* -{ - rtx low[2], high[2], xops[2]; - - split_di (&operands[1], 1, low, high); - xops[0] = operands[0]; - xops[1] = low[0]; - if (!rtx_equal_p (xops[0], xops[1])) - output_asm_insn (AS2 (mov%L0,%1,%0), xops); - - RET; -}") - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m") - (truncate:SI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro,r") - (const_int 32))))] - "(!TARGET_MOVE || GET_CODE (operands[0]) != MEM) || (GET_CODE (operands[1]) != MEM)" - "* -{ - rtx low[2], high[2], xops[2]; - - split_di (&operands[1], 1, low, high); - xops[0] = operands[0]; - xops[1] = high[0]; - if (!rtx_equal_p (xops[0], xops[1])) - output_asm_insn (AS2 (mov%L0,%1,%0), xops); - - RET; -}") - - - -;; Conversions between float and double. - -(define_expand "extendsfdf2" - [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "") - (float_extend:DF - (match_operand:SF 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2)) - (clobber (match_dup 3))])] - "TARGET_80387" - " -{ - if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) - operands[1] = force_reg (SFmode, operands[1]); - - operands[2] = assign_386_stack_local (SFmode, 0); - operands[3] = assign_386_stack_local (DFmode, 0); -}") - -(define_insn "" - [(set (match_operand:DF 0 "nonimmediate_operand" "=f,m,!f,!*r") - (float_extend:DF - (match_operand:SF 1 "nonimmediate_operand" "fm,f,*r,f"))) - (clobber (match_operand:SF 2 "memory_operand" "m,m,m,m")) - (clobber (match_operand:DF 3 "memory_operand" "m,m,m,o"))] - "TARGET_80387 && (GET_CODE (operands[0]) != MEM - || GET_CODE (operands[1]) != MEM)" - "* -{ - output_float_extend (insn, operands); - return \"\"; -}" - [(set_attr "type" "fld,fpop,fld,fpop")]) - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float_extend:DF (match_operand:SF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" "")) - (clobber (match_operand:DF 3 "memory_operand" ""))] - "TARGET_80387 && reload_completed && NON_STACK_REG_P (operands[1])" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float_extend:DF (match_dup 2)))] - "") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float_extend:DF (match_operand:SF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" "")) - (clobber (match_operand:DF 3 "memory_operand" ""))] - "TARGET_80387 && reload_completed && NON_STACK_REG_P (operands[0])" - [(set (match_dup 3) - (float_extend:DF (match_dup 1))) - (set (match_dup 0) - (match_dup 3))] - "") - -(define_split - [(set (match_operand:DF 0 "nonimmediate_operand" "") - (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" "")) - (clobber (match_operand:DF 3 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float_extend:DF (match_dup 1)))] - "") - -(define_insn "" - [(set (match_operand:DF 0 "nonimmediate_operand" "=f,m") - (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,f")))] - "TARGET_80387 && (GET_CODE (operands[0]) != MEM - || GET_CODE (operands[1]) != MEM)" - "* -{ - output_float_extend (insn, operands); - return \"\"; -}" - [(set_attr "type" "fld,fpop")]) - -(define_expand "extenddfxf2" - [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "") - (float_extend:XF - (match_operand:DF 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2)) - (clobber (match_dup 3))])] - "TARGET_80387" - " -{ - if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) - operands[1] = force_reg (DFmode, operands[1]); - - operands[2] = assign_386_stack_local (DFmode, 0); - operands[3] = assign_386_stack_local (XFmode, 0); -}") - -(define_insn "" - [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,!f,!*r") - (float_extend:XF - (match_operand:DF 1 "nonimmediate_operand" "fm,f,*r,f"))) - (clobber (match_operand:DF 2 "memory_operand" "m,m,o,m")) - (clobber (match_operand:XF 3 "memory_operand" "m,m,m,o"))] - "TARGET_80387 && (GET_CODE (operands[0]) != MEM - || GET_CODE (operands[1]) != MEM)" - "* -{ - output_float_extend (insn, operands); - return \"\"; -}" - [(set_attr "type" "fld,fpop,fld,fpop")]) - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float_extend:XF (match_operand:DF 1 "register_operand" ""))) - (clobber (match_operand:DF 2 "memory_operand" "")) - (clobber (match_operand:XF 3 "memory_operand" ""))] - "TARGET_80387 && reload_completed && NON_STACK_REG_P (operands[1])" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float_extend:XF (match_dup 2)))] - "") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float_extend:XF (match_operand:DF 1 "register_operand" ""))) - (clobber (match_operand:DF 2 "memory_operand" "")) - (clobber (match_operand:XF 3 "memory_operand" ""))] - "TARGET_80387 && reload_completed && NON_STACK_REG_P (operands[0])" - [(set (match_dup 3) - (float_extend:XF (match_dup 1))) - (set (match_dup 0) - (match_dup 3))] - "") - -(define_split - [(set (match_operand:XF 0 "nonimmediate_operand" "") - (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" ""))) - (clobber (match_operand:DF 2 "memory_operand" "")) - (clobber (match_operand:XF 3 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float_extend:XF (match_dup 1)))] - "") - -(define_insn "" - [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m") - (float_extend:XF (match_operand:DF 1 "nonimmediate_operand" "fm,f")))] - "TARGET_80387 && (GET_CODE (operands[0]) != MEM - || GET_CODE (operands[1]) != MEM)" - "* -{ - output_float_extend (insn, operands); - return \"\"; -}" - [(set_attr "type" "fld,fpop")]) - -(define_expand "extendsfxf2" - [(parallel [(set (match_operand:XF 0 "nonimmediate_operand" "") - (float_extend:XF - (match_operand:SF 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2)) - (clobber (match_dup 3))])] - "TARGET_80387" - " -{ - if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM) - operands[1] = force_reg (SFmode, operands[1]); - - operands[2] = assign_386_stack_local (SFmode, 0); - operands[3] = assign_386_stack_local (XFmode, 0); -}") - -(define_insn "" - [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,!f,!*r") - (float_extend:XF - (match_operand:SF 1 "nonimmediate_operand" "fm,f,*r,f"))) - (clobber (match_operand:SF 2 "memory_operand" "m,m,m,m")) - (clobber (match_operand:XF 3 "memory_operand" "m,m,m,o"))] - "TARGET_80387 && (GET_CODE (operands[0]) != MEM - || GET_CODE (operands[1]) != MEM)" - "* -{ - output_float_extend (insn, operands); - return \"\"; -}" - [(set_attr "type" "fld,fpop,fld,fpop")]) - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float_extend:XF (match_operand:SF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" "")) - (clobber (match_operand:XF 3 "memory_operand" ""))] - "TARGET_80387 && reload_completed && NON_STACK_REG_P (operands[1])" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float_extend:XF (match_dup 2)))] - "") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float_extend:XF (match_operand:SF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" "")) - (clobber (match_operand:XF 3 "memory_operand" ""))] - "TARGET_80387 && reload_completed && NON_STACK_REG_P (operands[0])" - [(set (match_dup 3) - (float_extend:XF (match_dup 1))) - (set (match_dup 0) - (match_dup 3))] - "") - -(define_split - [(set (match_operand:XF 0 "nonimmediate_operand" "") - (float_extend:XF (match_operand:SF 1 "nonimmediate_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" "")) - (clobber (match_operand:XF 3 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float_extend:XF (match_dup 1)))] - "") - -(define_insn "" - [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m") - (float_extend:XF - (match_operand:SF 1 "nonimmediate_operand" "fm,f")))] - "TARGET_80387 && (GET_CODE (operands[0]) != MEM - || GET_CODE (operands[1]) != MEM)" - "* -{ - output_float_extend (insn, operands); - return \"\"; -}" - [(set_attr "type" "fld,fpop")]) - -(define_expand "truncdfsf2" - [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "") - (float_truncate:SF - (match_operand:DF 1 "register_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - " -{ - operands[2] = (rtx) assign_386_stack_local (SFmode, 0); -}") - -(define_insn "" - [(set (match_operand:SF 0 "nonimmediate_operand" "=f,m,!*r") - (float_truncate:SF - (match_operand:DF 1 "register_operand" "0,f,f"))) - (clobber (match_operand:SF 2 "memory_operand" "m,m,m"))] - "TARGET_80387" - "* -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - rtx xops[1]; - - xops[0] = GET_CODE (operands[0]) == MEM ? operands[0] : operands[2]; - - if (stack_top_dies || STACK_REG_P (operands[0])) - output_asm_insn (AS1 (fstp%z0,%0), xops); - else - output_asm_insn (AS1 (fst%z0,%0), xops); - - if (STACK_REG_P (operands[0])) - return AS1 (fld%z2,%2); - else if (NON_STACK_REG_P (operands[0])) - return AS2 (mov%L0,%2,%0); - - return \"\"; -}" - [(set_attr "type" "fpop")]) - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (float_truncate:SF (match_operand:DF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (float_truncate:SF (match_dup 1))) - (set (match_dup 0) - (match_dup 2))] - "") - -(define_split - [(set (match_operand:SF 0 "memory_operand" "") - (float_truncate:SF (match_operand:DF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float_truncate:SF (match_dup 1)))] - "") - -;; This cannot output into an f-reg because there is no way to be sure -;; of truncating in that case. - -(define_insn "" - [(set (match_operand:SF 0 "memory_operand" "=m") - (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))] - "TARGET_80387" - "* -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - - if (stack_top_dies) - return AS1 (fstp%z0,%0); - else - return AS1 (fst%z0,%0); -}" - [(set_attr "type" "fpop")]) - -(define_expand "truncxfsf2" - [(parallel [(set (match_operand:SF 0 "nonimmediate_operand" "") - (float_truncate:SF - (match_operand:XF 1 "register_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - " -{ - operands[2] = (rtx) assign_386_stack_local (SFmode, 0); -}") - -(define_insn "" - [(set (match_operand:SF 0 "nonimmediate_operand" "=f,m,!*r") - (float_truncate:SF - (match_operand:XF 1 "register_operand" "0,f,f"))) - (clobber (match_operand:SF 2 "memory_operand" "m,m,m"))] - "TARGET_80387" - "* -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - rtx xops[1]; - - xops[0] = GET_CODE (operands[0]) == MEM ? operands[0] : operands[2]; - - if (stack_top_dies || STACK_REG_P (operands[0])) - output_asm_insn (AS1 (fstp%z0,%0), xops); - else - output_asm_insn (AS1 (fst%z0,%0), xops); - - if (STACK_REG_P (operands[0])) - return AS1 (fld%z2,%2); - else if (NON_STACK_REG_P (operands[0])) - return AS2 (mov%L0,%2,%0); - - return \"\"; -}" - [(set_attr "type" "fpop")]) - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (float_truncate:SF (match_operand:XF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (float_truncate:SF (match_dup 1))) - (set (match_dup 0) - (match_dup 2))] - "") - -(define_split - [(set (match_operand:SF 0 "memory_operand" "") - (float_truncate:SF (match_operand:XF 1 "register_operand" ""))) - (clobber (match_operand:SF 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float_truncate:SF (match_dup 1)))] - "") - -(define_insn "" - [(set (match_operand:SF 0 "memory_operand" "=m") - (float_truncate:SF (match_operand:XF 1 "register_operand" "f")))] - "TARGET_80387" - "* -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - - if (stack_top_dies) - return AS1 (fstp%z0,%0); - else - return AS1 (fst%z0,%0); -}" - [(set_attr "type" "fpop")]) - -(define_expand "truncxfdf2" - [(parallel [(set (match_operand:DF 0 "nonimmediate_operand" "") - (float_truncate:DF - (match_operand:XF 1 "register_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - " -{ - operands[2] = (rtx) assign_386_stack_local (DFmode, 0); -}") - -(define_insn "" - [(set (match_operand:DF 0 "nonimmediate_operand" "=f,m,!*r") - (float_truncate:DF - (match_operand:XF 1 "register_operand" "0,f,f"))) - (clobber (match_operand:DF 2 "memory_operand" "m,m,o"))] - "TARGET_80387" - "* -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - rtx xops[2]; - - xops[0] = GET_CODE (operands[0]) == MEM ? operands[0] : operands[2]; - - if (stack_top_dies || STACK_REG_P (operands[0])) - output_asm_insn (AS1 (fstp%z0,%0), xops); - else - output_asm_insn (AS1 (fst%z0,%0), xops); - - if (STACK_REG_P (operands[0])) - return AS1 (fld%z2,%2); - else if (NON_STACK_REG_P (operands[0])) - { - xops[0] = operands[0]; - xops[1] = operands[2]; - output_asm_insn (output_move_double (xops), xops); - } - - return \"\"; -}" - [(set_attr "type" "fpop")]) - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float_truncate:DF (match_operand:XF 1 "register_operand" ""))) - (clobber (match_operand:DF 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (float_truncate:DF (match_dup 1))) - (set (match_dup 0) - (match_dup 2))] - "") - -(define_split - [(set (match_operand:DF 0 "memory_operand" "") - (float_truncate:DF (match_operand:XF 1 "register_operand" ""))) - (clobber (match_operand:DF 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float_truncate:DF (match_dup 1)))] - "") - -(define_insn "" - [(set (match_operand:DF 0 "memory_operand" "=m") - (float_truncate:DF (match_operand:XF 1 "register_operand" "f")))] - "TARGET_80387" - "* -{ - int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0; - - if (stack_top_dies) - return AS1 (fstp%z0,%0); - else - return AS1 (fst%z0,%0); -}" - [(set_attr "type" "fpop")]) - -;; Conversions between floating point and fix point. - -(define_expand "fix_truncsfsi2" - [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "") - (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "")))) - (clobber (match_dup 2)) - (clobber (match_dup 3)) - (clobber (match_dup 4)) - (clobber (match_scratch:HI 5 ""))])] - "TARGET_80387" - " -{ - operands[2] = (rtx) assign_386_stack_local (HImode, 0); - operands[3] = (rtx) assign_386_stack_local (HImode, 1); - operands[4] = (rtx) assign_386_stack_local (SImode, 0); -}") - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=m,!&r") - (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f,f")))) - (clobber (match_operand:HI 2 "memory_operand" "m,m")) - (clobber (match_operand:HI 3 "memory_operand" "m,m")) - (clobber (match_operand:SI 4 "memory_operand" "m,m")) - (clobber (match_scratch:HI 5 "=&r,&r"))] - "TARGET_80387" - "* return output_fix_trunc (insn, operands);" - [(set_attr "type" "fpop")]) - -(define_expand "fix_truncsfdi2" - [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "") - (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "")))) - (clobber (match_dup 1)) - (clobber (match_dup 2)) - (clobber (match_dup 3)) - (clobber (match_dup 4)) - (clobber (match_scratch:HI 5 ""))])] - "TARGET_80387" - " -{ - operands[1] = copy_to_mode_reg (SFmode, operands[1]); - operands[2] = (rtx) assign_386_stack_local (HImode, 0); - operands[3] = (rtx) assign_386_stack_local (HImode, 1); - operands[4] = (rtx) assign_386_stack_local (DImode, 0); -}") - -(define_insn "" - [(set (match_operand:DI 0 "nonimmediate_operand" "=m,!&r") - (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f,f")))) - (clobber (match_dup 1)) - (clobber (match_operand:HI 2 "memory_operand" "m,m")) - (clobber (match_operand:HI 3 "memory_operand" "m,m")) - (clobber (match_operand:DI 4 "memory_operand" "m,o")) - (clobber (match_scratch:HI 5 "=&r,&r"))] - "TARGET_80387" - "* return output_fix_trunc (insn, operands);" - [(set_attr "type" "fpop")]) - -(define_expand "fix_truncdfsi2" - [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "") - (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "")))) - (clobber (match_dup 2)) - (clobber (match_dup 3)) - (clobber (match_dup 4)) - (clobber (match_scratch:HI 5 ""))])] - "TARGET_80387" - " -{ - operands[2] = (rtx) assign_386_stack_local (HImode, 0); - operands[3] = (rtx) assign_386_stack_local (HImode, 1); - operands[4] = (rtx) assign_386_stack_local (SImode, 0); -}") - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=m,!&r") - (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f,f")))) - (clobber (match_operand:HI 2 "memory_operand" "m,m")) - (clobber (match_operand:HI 3 "memory_operand" "m,m")) - (clobber (match_operand:SI 4 "memory_operand" "m,m")) - (clobber (match_scratch:HI 5 "=&r,&r"))] - "TARGET_80387" - "* return output_fix_trunc (insn, operands);" - [(set_attr "type" "fpop")]) - -(define_expand "fix_truncdfdi2" - [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "") - (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "")))) - (clobber (match_dup 1)) - (clobber (match_dup 2)) - (clobber (match_dup 3)) - (clobber (match_dup 4)) - (clobber (match_scratch:HI 5 ""))])] - "TARGET_80387" - " -{ - operands[1] = copy_to_mode_reg (DFmode, operands[1]); - operands[2] = (rtx) assign_386_stack_local (HImode, 0); - operands[3] = (rtx) assign_386_stack_local (HImode, 1); - operands[4] = (rtx) assign_386_stack_local (DImode, 0); -}") - -(define_insn "" - [(set (match_operand:DI 0 "nonimmediate_operand" "=m,!&r") - (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "f,f")))) - (clobber (match_dup 1)) - (clobber (match_operand:HI 2 "memory_operand" "m,m")) - (clobber (match_operand:HI 3 "memory_operand" "m,m")) - (clobber (match_operand:DI 4 "memory_operand" "m,o")) - (clobber (match_scratch:HI 5 "=&r,&r"))] - "TARGET_80387" - "* return output_fix_trunc (insn, operands);" - [(set_attr "type" "fpop")]) - -(define_expand "fix_truncxfsi2" - [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "") - (fix:SI (fix:XF (match_operand:XF 1 "register_operand" "")))) - (clobber (match_dup 2)) - (clobber (match_dup 3)) - (clobber (match_dup 4)) - (clobber (match_scratch:HI 5 ""))])] - "TARGET_80387" - " -{ - operands[2] = (rtx) assign_386_stack_local (HImode, 0); - operands[3] = (rtx) assign_386_stack_local (HImode, 1); - operands[4] = (rtx) assign_386_stack_local (SImode, 0); -}") - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=m,!&r") - (fix:SI (fix:XF (match_operand:XF 1 "register_operand" "f,f")))) - (clobber (match_operand:HI 2 "memory_operand" "m,m")) - (clobber (match_operand:HI 3 "memory_operand" "m,m")) - (clobber (match_operand:SI 4 "memory_operand" "m,m")) - (clobber (match_scratch:HI 5 "=&r,&r"))] - "TARGET_80387" - "* return output_fix_trunc (insn, operands);" - [(set_attr "type" "fpop")]) - -(define_expand "fix_truncxfdi2" - [(parallel [(set (match_operand:DI 0 "nonimmediate_operand" "") - (fix:DI (fix:XF (match_operand:XF 1 "register_operand" "")))) - (clobber (match_dup 1)) - (clobber (match_dup 2)) - (clobber (match_dup 3)) - (clobber (match_dup 4)) - (clobber (match_scratch:HI 5 ""))])] - "TARGET_80387" - " -{ - operands[1] = copy_to_mode_reg (XFmode, operands[1]); - operands[2] = (rtx) assign_386_stack_local (HImode, 0); - operands[3] = (rtx) assign_386_stack_local (HImode, 1); - operands[4] = (rtx) assign_386_stack_local (DImode, 0); -}") - -(define_insn "" - [(set (match_operand:DI 0 "nonimmediate_operand" "=m,!&r") - (fix:DI (fix:XF (match_operand:XF 1 "register_operand" "f,f")))) - (clobber (match_dup 1)) - (clobber (match_operand:HI 2 "memory_operand" "m,m")) - (clobber (match_operand:HI 3 "memory_operand" "m,m")) - (clobber (match_operand:DI 4 "memory_operand" "m,o")) - (clobber (match_scratch:HI 5 "=&r,&r"))] - "TARGET_80387" - "* return output_fix_trunc (insn, operands);" - [(set_attr "type" "fpop")]) - -;; Conversion between fixed point and floating point. - -;; ??? Possibly represent floatunssidf2 here in gcc2. - -(define_expand "floatsisf2" - [(parallel [(set (match_operand:SF 0 "register_operand" "") - (float:SF (match_operand:SI 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (SImode, 0);") - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f,f") - (float:SF (match_operand:SI 1 "nonimmediate_operand" "m,!r"))) - (clobber (match_operand:SI 2 "memory_operand" "m,m"))] - "TARGET_80387" - "#") - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (float:SF (match_operand:SI 1 "memory_operand" ""))) - (clobber (match_operand:SI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float:SF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (float:SF (match_operand:SI 1 "register_operand" ""))) - (clobber (match_operand:SI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float:SF (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f") - (float:SF (match_operand:SI 1 "memory_operand" "m")))] - "TARGET_80387" - "* return AS1 (fild%z1,%1);" - [(set_attr "type" "fpop")]) - -(define_expand "floathisf2" - [(parallel [(set (match_operand:SF 0 "register_operand" "") - (float:SF (match_operand:HI 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (HImode, 0);") - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f,f") - (float:SF (match_operand:HI 1 "nonimmediate_operand" "m,!r"))) - (clobber (match_operand:HI 2 "memory_operand" "m,m"))] - "TARGET_80387" - "#") - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (float:SF (match_operand:HI 1 "memory_operand" ""))) - (clobber (match_operand:HI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float:SF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (float:SF (match_operand:HI 1 "register_operand" ""))) - (clobber (match_operand:HI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float:SF (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f") - (float:SF (match_operand:HI 1 "memory_operand" "m")))] - "TARGET_80387" - "* return AS1 (fild%z1,%1);" - [(set_attr "type" "fpop")]) - -(define_expand "floatdisf2" - [(parallel [(set (match_operand:SF 0 "register_operand" "") - (float:SF (match_operand:DI 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (DImode, 0);") - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f,f") - (float:SF (match_operand:DI 1 "nonimmediate_operand" "m,!r"))) - (clobber (match_operand:DI 2 "memory_operand" "m,o"))] - "TARGET_80387" - "#") - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (float:SF (match_operand:DI 1 "memory_operand" ""))) - (clobber (match_operand:DI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float:SF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (float:SF (match_operand:DI 1 "register_operand" ""))) - (clobber (match_operand:DI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float:SF (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f") - (float:SF (match_operand:DI 1 "memory_operand" "m")))] - "TARGET_80387" - "* return AS1 (fild%z1,%1);" - [(set_attr "type" "fpop")]) - -(define_expand "floatsidf2" - [(parallel [(set (match_operand:DF 0 "register_operand" "") - (float:DF (match_operand:SI 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (SImode, 0);") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (float:DF (match_operand:SI 1 "nonimmediate_operand" "m,!r"))) - (clobber (match_operand:SI 2 "memory_operand" "m,m"))] - "TARGET_80387" - "#") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float:DF (match_operand:SI 1 "memory_operand" ""))) - (clobber (match_operand:SI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float:DF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float:DF (match_operand:SI 1 "register_operand" ""))) - (clobber (match_operand:SI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float:DF (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (float:DF (match_operand:SI 1 "memory_operand" "m")))] - "TARGET_80387" - "* return AS1 (fild%z1,%1);" - [(set_attr "type" "fpop")]) - -(define_expand "floathidf2" - [(parallel [(set (match_operand:DF 0 "register_operand" "") - (float:DF (match_operand:HI 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (HImode, 0);") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (float:DF (match_operand:HI 1 "nonimmediate_operand" "m,!r"))) - (clobber (match_operand:HI 2 "memory_operand" "m,m"))] - "TARGET_80387" - "#") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float:DF (match_operand:HI 1 "memory_operand" ""))) - (clobber (match_operand:HI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float:DF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float:DF (match_operand:HI 1 "register_operand" ""))) - (clobber (match_operand:HI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float:DF (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (float:DF (match_operand:HI 1 "memory_operand" "m")))] - "TARGET_80387" - "* return AS1 (fild%z1,%1);" - [(set_attr "type" "fpop")]) - -(define_expand "floatdidf2" - [(parallel [(set (match_operand:DF 0 "register_operand" "") - (float:DF (match_operand:DI 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (DImode, 0);") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (float:DF (match_operand:DI 1 "nonimmediate_operand" "m,!r"))) - (clobber (match_operand:DI 2 "memory_operand" "m,o"))] - "TARGET_80387" - "#") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float:DF (match_operand:DI 1 "memory_operand" ""))) - (clobber (match_operand:DI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float:DF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (float:DF (match_operand:DI 1 "register_operand" ""))) - (clobber (match_operand:DI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float:DF (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (float:DF (match_operand:DI 1 "memory_operand" "m")))] - "TARGET_80387" - "* return AS1 (fild%z1,%1);" - [(set_attr "type" "fpop")]) - -(define_expand "floatsixf2" - [(parallel [(set (match_operand:XF 0 "register_operand" "") - (float:XF (match_operand:SI 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (SImode, 0);") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f,f") - (float:XF (match_operand:SI 1 "nonimmediate_operand" "m,!r"))) - (clobber (match_operand:SI 2 "memory_operand" "m,m"))] - "TARGET_80387" - "#") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float:XF (match_operand:SI 1 "memory_operand" ""))) - (clobber (match_operand:SI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float:XF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float:XF (match_operand:SI 1 "register_operand" ""))) - (clobber (match_operand:SI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float:XF (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f") - (float:XF (match_operand:SI 1 "memory_operand" "m")))] - "TARGET_80387" - "* return AS1 (fild%z1,%1);" - [(set_attr "type" "fpop")]) - -(define_expand "floathixf2" - [(parallel [(set (match_operand:XF 0 "register_operand" "") - (float:XF (match_operand:HI 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (HImode, 0);") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f,f") - (float:XF (match_operand:HI 1 "nonimmediate_operand" "m,!r"))) - (clobber (match_operand:HI 2 "memory_operand" "m,m"))] - "TARGET_80387" - "#") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float:XF (match_operand:HI 1 "memory_operand" ""))) - (clobber (match_operand:HI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float:XF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float:XF (match_operand:HI 1 "register_operand" ""))) - (clobber (match_operand:HI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float:XF (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f") - (float:XF (match_operand:HI 1 "memory_operand" "m")))] - "TARGET_80387" - "* return AS1 (fild%z1,%1);" - [(set_attr "type" "fpop")]) - -(define_expand "floatdixf2" - [(parallel [(set (match_operand:XF 0 "register_operand" "") - (float:XF (match_operand:DI 1 "nonimmediate_operand" ""))) - (clobber (match_dup 2))])] - "TARGET_80387" - "operands[2] = assign_386_stack_local (DImode, 0);") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f,f") - (float:XF (match_operand:DI 1 "nonimmediate_operand" "m,!r"))) - (clobber (match_operand:DI 2 "memory_operand" "m,o"))] - "TARGET_80387" - "#") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float:XF (match_operand:DI 1 "memory_operand" ""))) - (clobber (match_operand:DI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 0) - (float:XF (match_dup 1)))] - "") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (float:XF (match_operand:DI 1 "register_operand" ""))) - (clobber (match_operand:DI 2 "memory_operand" ""))] - "TARGET_80387 && reload_completed" - [(set (match_dup 2) - (match_dup 1)) - (set (match_dup 0) - (float:XF (match_dup 2)))] - "") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f") - (float:XF (match_operand:DI 1 "memory_operand" "m")))] - "TARGET_80387" - "* return AS1 (fild%z1,%1);" - [(set_attr "type" "fpop")]) - -;;- add instructions - -(define_insn "*addsidi3_1" - [(set (match_operand:DI 0 "nonimmediate_operand" "=&r,r,o,!&r,!r,o,!o") - (plus:DI (match_operand:DI 1 "general_operand" "0,0,0,o,riF,riF,o") - (zero_extend:DI (match_operand:SI 2 "general_operand" "o,ri,ri,roi,roi,ri,ri")))) - (clobber (match_scratch:SI 3 "=X,X,X,X,X,X,&r"))] - "" - "* -{ - rtx low[3], high[3], xops[7]; - - CC_STATUS_INIT; - - split_di (operands, 2, low, high); - high[2] = const0_rtx; - low[2] = operands[2]; - - if (!rtx_equal_p (operands[0], operands[1])) - { - xops[0] = high[0]; - xops[1] = low[0]; - xops[2] = high[1]; - xops[3] = low[1]; - - if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) - { - output_asm_insn (AS2 (mov%L1,%3,%1), xops); - output_asm_insn (AS2 (mov%L0,%2,%0), xops); - } - else - { - xops[4] = high[2]; - xops[5] = low[2]; - xops[6] = operands[3]; - output_asm_insn (AS2 (mov%L6,%3,%6), xops); - output_asm_insn (AS2 (add%L6,%5,%6), xops); - output_asm_insn (AS2 (mov%L1,%6,%1), xops); - output_asm_insn (AS2 (mov%L6,%2,%6), xops); - output_asm_insn (AS2 (adc%L6,%4,%6), xops); - output_asm_insn (AS2 (mov%L0,%6,%0), xops); - RET; - } - } - - output_asm_insn (AS2 (add%L0,%2,%0), low); - output_asm_insn (AS2 (adc%L0,%2,%0), high); - cc_status.value1 = high[0]; - cc_status.flags = CC_NO_OVERFLOW; - RET; -}" - [(set_attr "type" "binary")]) - -(define_insn "addsidi3_2" - [(set (match_operand:DI 0 "nonimmediate_operand" "=&r,r,o,&r,!&r,&r,o,o,!o") - (plus:DI (zero_extend:DI (match_operand:SI 2 "general_operand" "o,ri,ri,o,o,ri,ri,i,r")) - (match_operand:DI 1 "general_operand" "0,0,0,iF,ro,roiF,riF,o,o"))) - (clobber (match_scratch:SI 3 "=X,X,X,X,X,X,X,&r,&r"))] - "" - "* -{ - rtx low[3], high[3], xops[7]; - - CC_STATUS_INIT; - - split_di (operands, 2, low, high); - high[2] = const0_rtx; - low[2] = operands[2]; - - if (!rtx_equal_p (operands[0], operands[1])) - { - xops[0] = high[0]; - xops[1] = low[0]; - xops[2] = high[1]; - xops[3] = low[1]; - - if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) - { - if (rtx_equal_p (low[0], operands[2])) - { - output_asm_insn (AS2 (mov%L0,%2,%0), high); - output_asm_insn (AS2 (add%L0,%1,%0), low); - output_asm_insn (AS2 (adc%L0,%1,%0), high); - RET; - } - if (rtx_equal_p (high[0], operands[2])) - { - if (GET_CODE (operands[0]) != MEM) - { - output_asm_insn (AS2 (mov%L0,%2,%0), low); - output_asm_insn (AS2 (mov%L0,%2,%0), high); - output_asm_insn (AS2 (add%L0,%1,%0), low); - output_asm_insn (AS2 (adc%L0,%1,%0), high); - } - else - { - /* It's too late to ask for a scratch now - but this - will probably not happen too often. */ - output_asm_insn (AS2 (add%L1,%2,%1), low); - output_asm_insn (AS2 (mov%L0,%1,%0), low); - output_asm_insn (AS2 (mov%L1,%2,%1), low); - output_asm_insn (AS2 (mov%L0,%2,%0), high); - output_asm_insn (AS2 (adc%L0,%1,%0), high); - output_asm_insn (AS2 (sub%L1,%0,%1), low); - output_asm_insn (AS1 (neg%L1,%1), low); - } - RET; - } - output_asm_insn (AS2 (mov%L1,%3,%1), xops); - output_asm_insn (AS2 (mov%L0,%2,%0), xops); - } - else - { - xops[4] = high[2]; - xops[5] = low[2]; - xops[6] = operands[3]; - output_asm_insn (AS2 (mov%L6,%3,%6), xops); - output_asm_insn (AS2 (add%L6,%5,%6), xops); - output_asm_insn (AS2 (mov%L1,%6,%1), xops); - output_asm_insn (AS2 (mov%L6,%2,%6), xops); - output_asm_insn (AS2 (adc%L6,%4,%6), xops); - output_asm_insn (AS2 (mov%L0,%6,%0), xops); - RET; - } - } - - output_asm_insn (AS2 (add%L0,%2,%0), low); - output_asm_insn (AS2 (adc%L0,%2,%0), high); - cc_status.value1 = high[0]; - cc_status.flags = CC_NO_OVERFLOW; - RET; -}" - [(set_attr "type" "binary")]) - -(define_insn "adddi3" - [(set (match_operand:DI 0 "general_operand" "=&r,&ro,!r,o,!&r,!o,!o") - (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0iF,or,riF,o") - (match_operand:DI 2 "general_operand" "o,riF,0,or,or,oriF,o"))) - (clobber (match_scratch:SI 3 "=X,X,X,&r,X,&r,&r"))] - "" - "* -{ - rtx low[3], high[3], xops[7], temp; - - CC_STATUS_INIT; - - if (rtx_equal_p (operands[0], operands[2])) - { - temp = operands[1]; - operands[1] = operands[2]; - operands[2] = temp; - } - - split_di (operands, 3, low, high); - if (!rtx_equal_p (operands[0], operands[1])) - { - xops[0] = high[0]; - xops[1] = low[0]; - xops[2] = high[1]; - xops[3] = low[1]; - - if (GET_CODE (operands[0]) != MEM) - { - output_asm_insn (AS2 (mov%L1,%3,%1), xops); - output_asm_insn (AS2 (mov%L0,%2,%0), xops); - } - else - { - xops[4] = high[2]; - xops[5] = low[2]; - xops[6] = operands[3]; - output_asm_insn (AS2 (mov%L6,%3,%6), xops); - output_asm_insn (AS2 (add%L6,%5,%6), xops); - output_asm_insn (AS2 (mov%L1,%6,%1), xops); - output_asm_insn (AS2 (mov%L6,%2,%6), xops); - output_asm_insn (AS2 (adc%L6,%4,%6), xops); - output_asm_insn (AS2 (mov%L0,%6,%0), xops); - RET; - } - } - - cc_status.value1 = high[0]; - cc_status.flags = CC_NO_OVERFLOW; - - if (GET_CODE (operands[3]) == REG && GET_CODE (operands[2]) != REG) - { - xops[0] = high[0]; - xops[1] = low[0]; - xops[2] = high[2]; - xops[3] = low[2]; - xops[4] = operands[3]; - - output_asm_insn (AS2 (mov%L4,%3,%4), xops); - output_asm_insn (AS2 (add%L1,%4,%1), xops); - output_asm_insn (AS2 (mov%L4,%2,%4), xops); - output_asm_insn (AS2 (adc%L0,%4,%0), xops); - } - - else if (GET_CODE (low[2]) != CONST_INT || INTVAL (low[2]) != 0) - { - output_asm_insn (AS2 (add%L0,%2,%0), low); - output_asm_insn (AS2 (adc%L0,%2,%0), high); - } - - else - output_asm_insn (AS2 (add%L0,%2,%0), high); - - RET; -}" - [(set_attr "type" "binary")]) - -;; On a 486, it is faster to do movl/addl than to do a single leal if -;; operands[1] and operands[2] are both registers. - -(define_expand "addsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "") - (plus:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:SI 2 "general_operand" "")))] - "" - "IX86_EXPAND_BINARY_OPERATOR (PLUS, SImode, operands);") - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm,r") - (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,r") - (match_operand:SI 2 "general_operand" "rmi,ri,ri")))] - "ix86_binary_operator_ok (PLUS, SImode, operands)" - "* -{ - if (REG_P (operands[0]) && REG_P (operands[1]) - && (REG_P (operands[2]) || CONSTANT_P (operands[2])) - && REGNO (operands[0]) != REGNO (operands[1])) - { - if (REG_P (operands[2]) && REGNO (operands[0]) == REGNO (operands[2])) - return AS2 (add%L0,%1,%0); - - if (operands[2] == stack_pointer_rtx) - { - rtx temp; - - temp = operands[1]; - operands[1] = operands[2]; - operands[2] = temp; - } - - if (operands[2] != stack_pointer_rtx) - { - CC_STATUS_INIT; - operands[1] = SET_SRC (PATTERN (insn)); - return AS2 (lea%L0,%a1,%0); - } - } - - if (!rtx_equal_p (operands[0], operands[1])) - output_asm_insn (AS2 (mov%L0,%1,%0), operands); - - if (operands[2] == const1_rtx) - return AS1 (inc%L0,%0); - - if (operands[2] == constm1_rtx) - return AS1 (dec%L0,%0); - - /* subl $-128,%ebx is smaller than addl $128,%ebx. */ - if (GET_CODE (operands[2]) == CONST_INT - && INTVAL (operands[2]) == 128) - { - /* This doesn't compute the carry bit in the same way - * as add%L0, but we use inc and dec above and they - * don't set the carry bit at all. If inc/dec don't need - * a CC_STATUS_INIT, this doesn't either... */ - operands[2] = GEN_INT (-128); - return AS2 (sub%L0,%2,%0); - } - - return AS2 (add%L0,%2,%0); -}" - [(set_attr "type" "binary")]) - -;; addsi3 is faster, so put this after. - -(define_insn "movsi_lea" - [(set (match_operand:SI 0 "register_operand" "=r") - (match_operand:QI 1 "address_operand" "p"))] - "" - "* -{ - /* Adding a constant to a register is faster with an add. */ - /* ??? can this ever happen? */ - if (GET_CODE (operands[1]) == PLUS - && GET_CODE (XEXP (operands[1], 1)) == CONST_INT - && rtx_equal_p (operands[0], XEXP (operands[1], 0))) - { - operands[1] = XEXP (operands[1], 1); - - if (operands[1] == const1_rtx) - return AS1 (inc%L0,%0); - - if (operands[1] == constm1_rtx) - return AS1 (dec%L0,%0); - - return AS2 (add%L0,%1,%0); - } - - CC_STATUS_INIT; - return AS2 (lea%L0,%a1,%0); -}" - [(set_attr "type" "lea")]) - -;; ??? `lea' here, for three operand add? If leaw is used, only %bx, -;; %si and %di can appear in SET_SRC, and output_asm_insn might not be -;; able to handle the operand. But leal always works? - -(define_expand "addhi3" - [(set (match_operand:HI 0 "general_operand" "") - (plus:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:HI 2 "general_operand" "")))] - "" - "IX86_EXPAND_BINARY_OPERATOR (PLUS, HImode, operands);") - -(define_insn "" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,?r") - (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,r") - (match_operand:HI 2 "general_operand" "ri,rm,ri")))] - "ix86_binary_operator_ok (PLUS, HImode, operands)" - "* -{ - if (REG_P (operands[0]) && REG_P (operands[1]) - && (REG_P (operands[2]) || CONSTANT_P (operands[2])) - && REGNO (operands[0]) != REGNO (operands[1])) - { - if (operands[2] == stack_pointer_rtx) - abort (); - - CC_STATUS_INIT; - operands[1] - = gen_rtx_PLUS (SImode, - gen_rtx_REG (SImode, REGNO (operands[1])), - (! REG_P (operands[2]) - ? operands[2] - : gen_rtx_REG (SImode, REGNO (operands[2])))); - operands[0] = gen_rtx_REG (SImode, REGNO (operands[0])); - return AS2 (lea%L0,%a1,%0); - } - - /* ??? what about offsettable memory references? */ - if (!TARGET_PENTIUMPRO /* partial stalls are just too painful to risk. */ - && QI_REG_P (operands[0]) - && GET_CODE (operands[2]) == CONST_INT - && (INTVAL (operands[2]) & 0xff) == 0 - && i386_cc_probably_useless_p (insn)) - { - int byteval = (INTVAL (operands[2]) >> 8) & 0xff; - CC_STATUS_INIT; - - if (byteval == 1) - return AS1 (inc%B0,%h0); - else if (byteval == 255) - return AS1 (dec%B0,%h0); - - operands[2] = GEN_INT (byteval); - return AS2 (add%B0,%2,%h0); - } - - /* Use a 32-bit operation when possible, to avoid the prefix penalty. */ - if (REG_P (operands[0]) - && i386_aligned_p (operands[2]) - && i386_cc_probably_useless_p (insn)) - { - CC_STATUS_INIT; - - if (GET_CODE (operands[2]) == CONST_INT) - { - HOST_WIDE_INT intval = 0xffff & INTVAL (operands[2]); - - if (intval == 1) - return AS1 (inc%L0,%k0); - - if (intval == 0xffff) - return AS1 (dec%L0,%k0); - - operands[2] = i386_sext16_if_const (operands[2]); - } - return AS2 (add%L0,%k2,%k0); - } - - if (operands[2] == const1_rtx) - return AS1 (inc%W0,%0); - - if (operands[2] == constm1_rtx - || (GET_CODE (operands[2]) == CONST_INT - && INTVAL (operands[2]) == 65535)) - return AS1 (dec%W0,%0); - - return AS2 (add%W0,%2,%0); -}" - [(set_attr "type" "binary")]) - -(define_expand "addqi3" - [(set (match_operand:QI 0 "general_operand" "") - (plus:QI (match_operand:QI 1 "general_operand" "") - (match_operand:QI 2 "general_operand" "")))] - "" - "IX86_EXPAND_BINARY_OPERATOR (PLUS, QImode, operands);") - -(define_insn "" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,?q") - (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,q") - (match_operand:QI 2 "general_operand" "qn,qmn,qn")))] - "ix86_binary_operator_ok (PLUS, QImode, operands)" - "* -{ - if (REG_P (operands[0]) && REG_P (operands[1]) - && (REG_P (operands[2]) || CONSTANT_P (operands[2])) - && (REGNO (operands[0]) != REGNO (operands[1]) - || NON_QI_REG_P (operands[1]) - || (REG_P (operands[2]) && NON_QI_REG_P (operands[2])))) - { - if (operands[2] == stack_pointer_rtx) - abort (); - - CC_STATUS_INIT; - operands[1] - = gen_rtx_PLUS (SImode, - gen_rtx_REG (SImode, REGNO (operands[1])), - (! REG_P (operands[2]) - ? operands[2] - : gen_rtx_REG (SImode, REGNO (operands[2])))); - operands[0] = gen_rtx_REG (SImode, REGNO (operands[0])); - return AS2 (lea%L0,%a1,%0); - } - if (operands[2] == const1_rtx) - return AS1 (inc%B0,%0); - - if (operands[2] == constm1_rtx - || (GET_CODE (operands[2]) == CONST_INT - && INTVAL (operands[2]) == 255)) - return AS1 (dec%B0,%0); - - return AS2 (add%B0,%2,%0); -}" - [(set_attr "type" "binary")]) - -;Lennart Augustsson -;says this pattern just makes slower code: -; pushl %ebp -; addl $-80,(%esp) -;instead of -; leal -80(%ebp),%eax -; pushl %eax -; -;(define_insn "" -; [(set (match_operand:SI 0 "push_operand" "=<") -; (plus:SI (match_operand:SI 1 "register_operand" "%r") -; (match_operand:SI 2 "nonmemory_operand" "ri")))] -; "" -; "* -;{ -; rtx xops[4]; -; xops[0] = operands[0]; -; xops[1] = operands[1]; -; xops[2] = operands[2]; -; xops[3] = gen_rtx_MEM (SImode, stack_pointer_rtx); -; output_asm_insn (\"push%z1 %1\", xops); -; output_asm_insn (AS2 (add%z3,%2,%3), xops); -; RET; -;}") - -;; The patterns that match these are at the end of this file. - -(define_expand "addxf3" - [(set (match_operand:XF 0 "register_operand" "") - (plus:XF (match_operand:XF 1 "register_operand" "") - (match_operand:XF 2 "register_operand" "")))] - "TARGET_80387" - "") - -(define_expand "adddf3" - [(set (match_operand:DF 0 "register_operand" "") - (plus:DF (match_operand:DF 1 "nonimmediate_operand" "") - (match_operand:DF 2 "nonimmediate_operand" "")))] - "TARGET_80387" - "") - -(define_expand "addsf3" - [(set (match_operand:SF 0 "register_operand" "") - (plus:SF (match_operand:SF 1 "nonimmediate_operand" "") - (match_operand:SF 2 "nonimmediate_operand" "")))] - "TARGET_80387" - "") - -;;- subtract instructions - -(define_insn "subsidi3" - [(set (match_operand:DI 0 "general_operand" "=&r,&ro,&r,!&r,o,o,!o") - (minus:DI (match_operand:DI 1 "general_operand" "0iF,0,roiF,roiF,riF,o,o") - (zero_extend:DI (match_operand:SI 2 "general_operand" "o,ri,ri,o,ri,i,r")))) - (clobber (match_scratch:SI 3 "=X,X,X,X,X,&r,&r"))] - "" - "* -{ - rtx low[3], high[3], xops[7]; - - CC_STATUS_INIT; - - split_di (operands, 2, low, high); - high[2] = const0_rtx; - low[2] = operands[2]; - - if (!rtx_equal_p (operands[0], operands[1])) - { - xops[0] = high[0]; - xops[1] = low[0]; - xops[2] = high[1]; - xops[3] = low[1]; - - if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM) - { - output_asm_insn (AS2 (mov%L1,%3,%1), xops); - output_asm_insn (AS2 (mov%L0,%2,%0), xops); - } - else - { - xops[4] = high[2]; - xops[5] = low[2]; - xops[6] = operands[3]; - output_asm_insn (AS2 (mov%L6,%3,%6), xops); - output_asm_insn (AS2 (sub%L6,%5,%6), xops); - output_asm_insn (AS2 (mov%L1,%6,%1), xops); - output_asm_insn (AS2 (mov%L6,%2,%6), xops); - output_asm_insn (AS2 (sbb%L6,%4,%6), xops); - output_asm_insn (AS2 (mov%L0,%6,%0), xops); - RET; - } - } - - output_asm_insn (AS2 (sub%L0,%2,%0), low); - output_asm_insn (AS2 (sbb%L0,%2,%0), high); - cc_status.value1 = high[0]; - cc_status.flags = CC_NO_OVERFLOW; - - RET; -}" - [(set_attr "type" "binary")]) - -(define_insn "subdi3" - [(set (match_operand:DI 0 "general_operand" "=&r,&ro,o,o,!&r,!o") - (minus:DI (match_operand:DI 1 "general_operand" "0,0,0iF,or,roiF,roiF") - (match_operand:DI 2 "general_operand" "or,riF,or,iF,roiF,roiF"))) - (clobber (match_scratch:SI 3 "=X,X,&r,&r,X,&r"))] - "" - "* -{ - rtx low[3], high[3], xops[7]; - - CC_STATUS_INIT; - - split_di (operands, 3, low, high); - - if (!rtx_equal_p (operands[0], operands[1])) - { - xops[0] = high[0]; - xops[1] = low[0]; - xops[2] = high[1]; - xops[3] = low[1]; - - if (GET_CODE (operands[0]) != MEM) - { - output_asm_insn (AS2 (mov%L1,%3,%1), xops); - output_asm_insn (AS2 (mov%L0,%2,%0), xops); - } - else - { - xops[4] = high[2]; - xops[5] = low[2]; - xops[6] = operands[3]; - output_asm_insn (AS2 (mov%L6,%3,%6), xops); - output_asm_insn (AS2 (sub%L6,%5,%6), xops); - output_asm_insn (AS2 (mov%L1,%6,%1), xops); - output_asm_insn (AS2 (mov%L6,%2,%6), xops); - output_asm_insn (AS2 (sbb%L6,%4,%6), xops); - output_asm_insn (AS2 (mov%L0,%6,%0), xops); - RET; - } - } - - cc_status.value1 = high[0]; - cc_status.flags = CC_NO_OVERFLOW; - - if (GET_CODE (operands[3]) == REG) - { - xops[0] = high[0]; - xops[1] = low[0]; - xops[2] = high[2]; - xops[3] = low[2]; - xops[4] = operands[3]; - - output_asm_insn (AS2 (mov%L4,%3,%4), xops); - output_asm_insn (AS2 (sub%L1,%4,%1), xops); - output_asm_insn (AS2 (mov%L4,%2,%4), xops); - output_asm_insn (AS2 (sbb%L0,%4,%0), xops); - } - - else if (GET_CODE (low[2]) != CONST_INT || INTVAL (low[2]) != 0) - { - output_asm_insn (AS2 (sub%L0,%2,%0), low); - output_asm_insn (AS2 (sbb%L0,%2,%0), high); - } - - else - output_asm_insn (AS2 (sub%L0,%2,%0), high); - - - RET; -}" - [(set_attr "type" "binary")]) - -(define_expand "subsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "") - (minus:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:SI 2 "general_operand" "")))] - "" - "IX86_EXPAND_BINARY_OPERATOR (MINUS, SImode, operands);") - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r") - (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0") - (match_operand:SI 2 "general_operand" "ri,rm")))] - "ix86_binary_operator_ok (MINUS, SImode, operands)" - "* return AS2 (sub%L0,%2,%0);" - [(set_attr "type" "binary")]) - -(define_expand "subhi3" - [(set (match_operand:HI 0 "general_operand" "") - (minus:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:HI 2 "general_operand" "")))] - "" - "IX86_EXPAND_BINARY_OPERATOR (MINUS, HImode, operands);") - -(define_insn "" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") - (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0") - (match_operand:HI 2 "general_operand" "ri,rm")))] - "ix86_binary_operator_ok (MINUS, HImode, operands)" - "* -{ - if (REG_P (operands[0]) - && i386_aligned_p (operands[2]) - && i386_cc_probably_useless_p (insn)) - { - CC_STATUS_INIT; - operands[2] = i386_sext16_if_const (operands[2]); - return AS2 (sub%L0,%k2,%k0); - } - return AS2 (sub%W0,%2,%0); -}" - [(set_attr "type" "binary")]) - -(define_expand "subqi3" - [(set (match_operand:QI 0 "general_operand" "") - (minus:QI (match_operand:QI 1 "general_operand" "") - (match_operand:QI 2 "general_operand" "")))] - "" - "IX86_EXPAND_BINARY_OPERATOR (MINUS, QImode, operands);") - -(define_insn "" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") - (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0") - (match_operand:QI 2 "general_operand" "qn,qmn")))] - "ix86_binary_operator_ok (MINUS, QImode, operands)" - "* return AS2 (sub%B0,%2,%0);" - [(set_attr "type" "binary")]) - -;; The patterns that match these are at the end of this file. - -(define_expand "subxf3" - [(set (match_operand:XF 0 "register_operand" "") - (minus:XF (match_operand:XF 1 "register_operand" "") - (match_operand:XF 2 "register_operand" "")))] - "TARGET_80387" - "") - -(define_expand "subdf3" - [(set (match_operand:DF 0 "register_operand" "") - (minus:DF (match_operand:DF 1 "nonimmediate_operand" "") - (match_operand:DF 2 "nonimmediate_operand" "")))] - "TARGET_80387" - "") - -(define_expand "subsf3" - [(set (match_operand:SF 0 "register_operand" "") - (minus:SF (match_operand:SF 1 "nonimmediate_operand" "") - (match_operand:SF 2 "nonimmediate_operand" "")))] - "TARGET_80387" - "") - -;;- multiply instructions - -;(define_insn "mulqi3" -; [(set (match_operand:QI 0 "register_operand" "=a") -; (mult:QI (match_operand:QI 1 "register_operand" "%0") -; (match_operand:QI 2 "nonimmediate_operand" "qm")))] -; "" -; "imul%B0 %2,%0") - -(define_insn "mulhi3" - [(set (match_operand:HI 0 "register_operand" "=r,r") - (mult:HI (match_operand:HI 1 "nonimmediate_operand" "%0,rm") - (match_operand:HI 2 "general_operand" "g,i")))] - "" - "* -{ - if (GET_CODE (operands[1]) == REG - && REGNO (operands[1]) == REGNO (operands[0]) - && (GET_CODE (operands[2]) == MEM || GET_CODE (operands[2]) == REG)) - /* Assembler has weird restrictions. */ - return AS2 (imul%W0,%2,%0); - return AS3 (imul%W0,%2,%1,%0); -}" - [(set_attr "type" "imul")]) - -(define_insn "mulsi3" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (mult:SI (match_operand:SI 1 "nonimmediate_operand" "%0,rm") - (match_operand:SI 2 "general_operand" "g,i")))] - "" - "* -{ - if (GET_CODE (operands[1]) == REG - && REGNO (operands[1]) == REGNO (operands[0]) - && (GET_CODE (operands[2]) == MEM || GET_CODE (operands[2]) == REG)) - /* Assembler has weird restrictions. */ - return AS2 (imul%L0,%2,%0); - return AS3 (imul%L0,%2,%1,%0); -}" - [(set_attr "type" "imul")]) - -(define_insn "umulqihi3" - [(set (match_operand:HI 0 "register_operand" "=a") - (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%0")) - (zero_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))] - "" - "mul%B0 %2" - [(set_attr "type" "imul")]) - -(define_insn "mulqihi3" - [(set (match_operand:HI 0 "register_operand" "=a") - (mult:HI (sign_extend:HI (match_operand:QI 1 "register_operand" "%0")) - (sign_extend:HI (match_operand:QI 2 "nonimmediate_operand" "qm"))))] - "" - "imul%B0 %2" - [(set_attr "type" "imul")]) - -(define_insn "umulsidi3" - [(set (match_operand:DI 0 "register_operand" "=A") - (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%0")) - (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))] - "TARGET_WIDE_MULTIPLY" - "mul%L0 %2" - [(set_attr "type" "imul")]) - -(define_insn "mulsidi3" - [(set (match_operand:DI 0 "register_operand" "=A") - (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%0")) - (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))))] - "TARGET_WIDE_MULTIPLY" - "imul%L0 %2" - [(set_attr "type" "imul")]) - -(define_insn "umulsi3_highpart" - [(set (match_operand:SI 0 "register_operand" "=d") - (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "%a")) - (zero_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))) - (const_int 32)))) - (clobber (match_scratch:SI 3 "=a"))] - "TARGET_WIDE_MULTIPLY" - "mul%L0 %2" - [(set_attr "type" "imul")]) - -(define_insn "smulsi3_highpart" - [(set (match_operand:SI 0 "register_operand" "=d") - (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "%a")) - (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "rm"))) - (const_int 32)))) - (clobber (match_scratch:SI 3 "=a"))] - "TARGET_WIDE_MULTIPLY" - "imul%L0 %2" - [(set_attr "type" "imul")]) - -;; The patterns that match these are at the end of this file. - -(define_expand "mulxf3" - [(set (match_operand:XF 0 "register_operand" "") - (mult:XF (match_operand:XF 1 "register_operand" "") - (match_operand:XF 2 "register_operand" "")))] - "TARGET_80387" - "") - -(define_expand "muldf3" - [(set (match_operand:DF 0 "register_operand" "") - (mult:DF (match_operand:DF 1 "register_operand" "") - (match_operand:DF 2 "nonimmediate_operand" "")))] - "TARGET_80387" - "") - -(define_expand "mulsf3" - [(set (match_operand:SF 0 "register_operand" "") - (mult:SF (match_operand:SF 1 "register_operand" "") - (match_operand:SF 2 "nonimmediate_operand" "")))] - "TARGET_80387" - "") - -;;- divide instructions - -(define_insn "divqi3" - [(set (match_operand:QI 0 "register_operand" "=a") - (div:QI (match_operand:HI 1 "register_operand" "0") - (match_operand:QI 2 "nonimmediate_operand" "qm")))] - "" - "idiv%B0 %2") - -(define_insn "udivqi3" - [(set (match_operand:QI 0 "register_operand" "=a") - (udiv:QI (match_operand:HI 1 "register_operand" "0") - (match_operand:QI 2 "nonimmediate_operand" "qm")))] - "" - "div%B0 %2" - [(set_attr "type" "idiv")]) - -;; The patterns that match these are at the end of this file. - -(define_expand "divxf3" - [(set (match_operand:XF 0 "register_operand" "") - (div:XF (match_operand:XF 1 "register_operand" "") - (match_operand:XF 2 "register_operand" "")))] - "TARGET_80387" - "") - -(define_expand "divdf3" - [(set (match_operand:DF 0 "register_operand" "") - (div:DF (match_operand:DF 1 "register_operand" "") - (match_operand:DF 2 "nonimmediate_operand" "")))] - "TARGET_80387" - "") - -(define_expand "divsf3" - [(set (match_operand:SF 0 "register_operand" "") - (div:SF (match_operand:SF 1 "register_operand" "") - (match_operand:SF 2 "nonimmediate_operand" "")))] - "TARGET_80387" - "") - -;; Remainder instructions. - -(define_insn "divmodsi4" - [(set (match_operand:SI 0 "register_operand" "=a") - (div:SI (match_operand:SI 1 "register_operand" "0") - (match_operand:SI 2 "nonimmediate_operand" "rm"))) - (set (match_operand:SI 3 "register_operand" "=&d") - (mod:SI (match_dup 1) (match_dup 2)))] - "" - "* -{ -#ifdef INTEL_SYNTAX - output_asm_insn (\"cdq\", operands); -#else - output_asm_insn (\"cltd\", operands); -#endif - return AS1 (idiv%L0,%2); -}" - [(set_attr "type" "idiv")]) - -(define_insn "divmodhi4" - [(set (match_operand:HI 0 "register_operand" "=a") - (div:HI (match_operand:HI 1 "register_operand" "0") - (match_operand:HI 2 "nonimmediate_operand" "rm"))) - (set (match_operand:HI 3 "register_operand" "=&d") - (mod:HI (match_dup 1) (match_dup 2)))] - "" - "cwtd\;idiv%W0 %2" - [(set_attr "type" "idiv")]) - -;; ??? Can we make gcc zero extend operand[0]? -(define_insn "udivmodsi4" - [(set (match_operand:SI 0 "register_operand" "=a") - (udiv:SI (match_operand:SI 1 "register_operand" "0") - (match_operand:SI 2 "nonimmediate_operand" "rm"))) - (set (match_operand:SI 3 "register_operand" "=&d") - (umod:SI (match_dup 1) (match_dup 2)))] - "" - "* -{ - output_asm_insn (AS2 (xor%L3,%3,%3), operands); - return AS1 (div%L0,%2); -}" - [(set_attr "type" "idiv")]) - -;; ??? Can we make gcc zero extend operand[0]? -(define_insn "udivmodhi4" - [(set (match_operand:HI 0 "register_operand" "=a") - (udiv:HI (match_operand:HI 1 "register_operand" "0") - (match_operand:HI 2 "nonimmediate_operand" "rm"))) - (set (match_operand:HI 3 "register_operand" "=&d") - (umod:HI (match_dup 1) (match_dup 2)))] - "" - "* -{ - output_asm_insn (AS2 (xor%W0,%3,%3), operands); - return AS1 (div%W0,%2); -}" - [(set_attr "type" "idiv")]) - -/* -;;this should be a valid double division which we may want to add - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=a") - (udiv:DI (match_operand:DI 1 "register_operand" "a") - (match_operand:SI 2 "nonimmediate_operand" "rm"))) - (set (match_operand:SI 3 "register_operand" "=d") - (umod:SI (match_dup 1) (match_dup 2)))] - "" - "div%L0 %2,%0" - [(set_attr "type" "idiv")]) -*/ - -;;- and instructions - -;; On i386, -;; movzbl %bl,%ebx -;; is faster than -;; andl $255,%ebx -;; -;; but if the reg is %eax, then the "andl" is faster. -;; -;; On i486, the "andl" is always faster than the "movzbl". -;; -;; On both i386 and i486, a three operand AND is as fast with movzbl or -;; movzwl as with andl, if operands[0] != operands[1]. - -;; The `r' in `rm' for operand 3 looks redundant, but it causes -;; optional reloads to be generated if op 3 is a pseudo in a stack slot. - -(define_insn "andsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r") - (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0") - (match_operand:SI 2 "general_operand" "ri,rm")))] - "" - "* -{ - HOST_WIDE_INT intval; - if (!rtx_equal_p (operands[0], operands[1]) - && rtx_equal_p (operands[0], operands[2])) - { - rtx tmp; - tmp = operands[1]; - operands[1] = operands[2]; - operands[2] = tmp; - } - switch (GET_CODE (operands[2])) - { - case CONST_INT: - if (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])) - break; - intval = INTVAL (operands[2]); - /* zero-extend 16->32? */ - if (intval == 0xffff && REG_P (operands[0]) - && (! REG_P (operands[1]) - || REGNO (operands[0]) != 0 || REGNO (operands[1]) != 0) - && (!TARGET_ZERO_EXTEND_WITH_AND || ! rtx_equal_p (operands[0], operands[1]))) - { - /* ??? tege: Should forget CC_STATUS only if we clobber a - remembered operand. Fix that later. */ - CC_STATUS_INIT; -#ifdef INTEL_SYNTAX - return AS2 (movzx,%w1,%0); -#else - return AS2 (movz%W0%L0,%w1,%0); -#endif - } - - /* zero extend 8->32? */ - if (intval == 0xff && REG_P (operands[0]) - && !(REG_P (operands[1]) && NON_QI_REG_P (operands[1])) - && (! REG_P (operands[1]) - || REGNO (operands[0]) != 0 || REGNO (operands[1]) != 0) - && (!TARGET_ZERO_EXTEND_WITH_AND || ! rtx_equal_p (operands[0], operands[1]))) - { - /* ??? tege: Should forget CC_STATUS only if we clobber a - remembered operand. Fix that later. */ - CC_STATUS_INIT; -#ifdef INTEL_SYNTAX - return AS2 (movzx,%b1,%0); -#else - return AS2 (movz%B0%L0,%b1,%0); -#endif - } - - /* Check partial bytes.. non-QI-regs are not available */ - if (REG_P (operands[0]) && ! QI_REG_P (operands[0])) - break; - - /* only low byte has zero bits? */ - if (~(intval | 0xff) == 0) - { - intval &= 0xff; - if (REG_P (operands[0])) - { - if (intval == 0) - { - CC_STATUS_INIT; - return AS2 (xor%B0,%b0,%b0); - } - - /* we're better off with the 32-bit version if reg != EAX */ - /* the value is sign-extended in 8 bits */ - if (REGNO (operands[0]) != 0 && (intval & 0x80)) - break; - } - - CC_STATUS_INIT; - - operands[2] = GEN_INT (intval); - - if (intval == 0) - return AS2 (mov%B0,%2,%b0); - - return AS2 (and%B0,%2,%b0); - } - - /* only second byte has zero? */ - if (~(intval | 0xff00) == 0) - { - CC_STATUS_INIT; - - intval = (intval >> 8) & 0xff; - operands[2] = GEN_INT (intval); - if (intval == 0) - { - if (REG_P (operands[0])) - return AS2 (xor%B0,%h0,%h0); - operands[0] = adj_offsettable_operand (operands[0], 1); - return AS2 (mov%B0,%2,%b0); - } - - if (REG_P (operands[0])) - return AS2 (and%B0,%2,%h0); - - operands[0] = adj_offsettable_operand (operands[0], 1); - return AS2 (and%B0,%2,%b0); - } - - if (REG_P (operands[0])) - break; - - /* third byte has zero bits? */ - if (~(intval | 0xff0000) == 0) - { - intval = (intval >> 16) & 0xff; - operands[0] = adj_offsettable_operand (operands[0], 2); -byte_and_operation: - CC_STATUS_INIT; - operands[2] = GEN_INT (intval); - if (intval == 0) - return AS2 (mov%B0,%2,%b0); - return AS2 (and%B0,%2,%b0); - } - - /* fourth byte has zero bits? */ - if (~(intval | 0xff000000) == 0) - { - intval = (intval >> 24) & 0xff; - operands[0] = adj_offsettable_operand (operands[0], 3); - goto byte_and_operation; - } - - /* Low word is zero? */ - if (intval == 0xffff0000) - { -word_zero_and_operation: - CC_STATUS_INIT; - operands[2] = const0_rtx; - return AS2 (mov%W0,%2,%w0); - } - - /* High word is zero? */ - if (intval == 0x0000ffff) - { - operands[0] = adj_offsettable_operand (operands[0], 2); - goto word_zero_and_operation; - } - - default: - break; - } - - return AS2 (and%L0,%2,%0); -}" - [(set_attr "type" "binary")]) - -(define_insn "andhi3" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") - (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "ri,rm")))] - "" - "* -{ - if (GET_CODE (operands[2]) == CONST_INT - && ! (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))) - { - /* Can we ignore the upper byte? */ - if ((! REG_P (operands[0]) || QI_REG_P (operands[0])) - && (INTVAL (operands[2]) & 0xff00) == 0xff00) - { - CC_STATUS_INIT; - - if ((INTVAL (operands[2]) & 0xff) == 0) - { - operands[2] = const0_rtx; - return AS2 (mov%B0,%2,%b0); - } - - operands[2] = GEN_INT (INTVAL (operands[2]) & 0xff); - return AS2 (and%B0,%2,%b0); - } - - /* Can we ignore the lower byte? */ - /* ??? what about offsettable memory references? */ - if (QI_REG_P (operands[0]) && (INTVAL (operands[2]) & 0xff) == 0xff) - { - CC_STATUS_INIT; - - if ((INTVAL (operands[2]) & 0xff00) == 0) - { - operands[2] = const0_rtx; - return AS2 (mov%B0,%2,%h0); - } - - operands[2] = GEN_INT ((INTVAL (operands[2]) >> 8) & 0xff); - return AS2 (and%B0,%2,%h0); - } - - /* use 32-bit ops on registers when there are no sign issues.. */ - if (REG_P (operands[0])) - { - if (!(INTVAL (operands[2]) & ~0x7fff)) - return AS2 (and%L0,%2,%k0); - } - } - - if (REG_P (operands[0]) - && i386_aligned_p (operands[2])) - { - CC_STATUS_INIT; - /* If op[2] is constant, we should zero-extend it and */ - /* make a note that op[0] has been zero-extended, so */ - /* that we could use 32-bit ops on it forthwith, but */ - /* there is no such reg-note available. Instead we do */ - /* a sign extension as that can result in shorter asm */ - operands[2] = i386_sext16_if_const (operands[2]); - return AS2 (and%L0,%k2,%k0); - } - - /* Use a 32-bit word with the upper bits set, invalidate CC */ - if (GET_CODE (operands[2]) == CONST_INT - && i386_aligned_p (operands[0])) - { - HOST_WIDE_INT val = INTVAL (operands[2]); - CC_STATUS_INIT; - val |= ~0xffff; - if (val != INTVAL (operands[2])) - operands[2] = GEN_INT (val); - return AS2 (and%L0,%k2,%k0); - } - - return AS2 (and%W0,%2,%0); -}" - [(set_attr "type" "binary")]) - -(define_insn "andqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") - (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0") - (match_operand:QI 2 "general_operand" "qn,qmn")))] - "" - "* return AS2 (and%B0,%2,%0);" - [(set_attr "type" "binary")]) - -/* I am nervous about these two.. add them later.. -;I presume this means that we have something in say op0= eax which is small -;and we want to and it with memory so we can do this by just an -;andb m,%al and have success. -(define_insn "" - [(set (match_operand:SI 0 "general_operand" "=r") - (and:SI (zero_extend:SI - (match_operand:HI 1 "nonimmediate_operand" "rm")) - (match_operand:SI 2 "general_operand" "0")))] - "GET_CODE (operands[2]) == CONST_INT - && (unsigned int) INTVAL (operands[2]) < (1 << GET_MODE_BITSIZE (HImode))" - "and%W0 %1,%0") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=q") - (and:SI - (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "qm")) - (match_operand:SI 2 "register_operand" "0")))] - "GET_CODE (operands[2]) == CONST_INT - && (unsigned int) INTVAL (operands[2]) < (1 << GET_MODE_BITSIZE (QImode))" - "and%L0 %1,%0") - -*/ - -;;- Bit set (inclusive or) instructions - -;; This optimizes known byte-wide operations to memory, and in some cases -;; to QI registers.. Note that we don't want to use the QI registers too -;; aggressively, because often the 32-bit register instruction is the same -;; size, and likely to be faster on PentiumPro. -(define_insn "iorsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r") - (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0") - (match_operand:SI 2 "general_operand" "ri,rm")))] - "" - "* -{ - HOST_WIDE_INT intval; - switch (GET_CODE (operands[2])) - { - case CONST_INT: - - if (REG_P (operands[0]) && ! QI_REG_P (operands[0])) - break; - - /* don't try to optimize volatile accesses */ - if (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])) - break; - - intval = INTVAL (operands[2]); - if ((intval & ~0xff) == 0) - { - if (REG_P (operands[0])) - { - /* Do low byte access only for %eax or when high bit is set */ - if (REGNO (operands[0]) != 0 && !(intval & 0x80)) - break; - } - -byte_or_operation: - CC_STATUS_INIT; - - if (intval != INTVAL (operands[2])) - operands[2] = GEN_INT (intval); - - if (intval == 0xff) - return AS2 (mov%B0,%2,%b0); - - return AS2 (or%B0,%2,%b0); - } - - /* second byte? */ - if ((intval & ~0xff00) == 0) - { - intval >>= 8; - - if (REG_P (operands[0])) - { - CC_STATUS_INIT; - operands[2] = GEN_INT (intval); - if (intval == 0xff) - return AS2 (mov%B0,%2,%h0); - - return AS2 (or%B0,%2,%h0); - } - - operands[0] = adj_offsettable_operand (operands[0], 1); - goto byte_or_operation; - } - - if (REG_P (operands[0])) - break; - - /* third byte? */ - if ((intval & ~0xff0000) == 0) - { - intval >>= 16; - operands[0] = adj_offsettable_operand (operands[0], 2); - goto byte_or_operation; - } - - /* fourth byte? */ - if ((intval & ~0xff000000) == 0) - { - intval = (intval >> 24) & 0xff; - operands[0] = adj_offsettable_operand (operands[0], 3); - goto byte_or_operation; - } - - default: - break; - } - - return AS2 (or%L0,%2,%0); -}" - [(set_attr "type" "binary")]) - -(define_insn "iorhi3" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") - (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "ri,rm")))] - "" - "* -{ - HOST_WIDE_INT intval; - switch (GET_CODE (operands[2])) - { - case CONST_INT: - - if (REG_P (operands[0]) && ! QI_REG_P (operands[0])) - break; - - /* don't try to optimize volatile accesses */ - if (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])) - break; - - intval = 0xffff & INTVAL (operands[2]); - - if ((intval & 0xff00) == 0) - { - if (REG_P (operands[0])) - { - /* Do low byte access only for %eax or when high bit is set */ - if (REGNO (operands[0]) != 0 && !(intval & 0x80)) - break; - } - -byte_or_operation: - CC_STATUS_INIT; - - if (intval == 0xff) - return AS2 (mov%B0,%2,%b0); - - return AS2 (or%B0,%2,%b0); - } - - /* high byte? */ - if ((intval & 0xff) == 0) - { - intval >>= 8; - operands[2] = GEN_INT (intval); - - if (REG_P (operands[0])) - { - CC_STATUS_INIT; - if (intval == 0xff) - return AS2 (mov%B0,%2,%h0); - - return AS2 (or%B0,%2,%h0); - } - - operands[0] = adj_offsettable_operand (operands[0], 1); - - goto byte_or_operation; - } - - default: - break; - } - - if (REG_P (operands[0]) - && i386_aligned_p (operands[2])) - { - CC_STATUS_INIT; - operands[2] = i386_sext16_if_const (operands[2]); - return AS2 (or%L0,%k2,%k0); - } - - if (GET_CODE (operands[2]) == CONST_INT - && i386_aligned_p (operands[0])) - { - CC_STATUS_INIT; - intval = 0xffff & INTVAL (operands[2]); - if (intval != INTVAL (operands[2])) - operands[2] = GEN_INT (intval); - return AS2 (or%L0,%2,%k0); - } - - return AS2 (or%W0,%2,%0); -}" - [(set_attr "type" "binary")]) - -(define_insn "iorqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") - (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0") - (match_operand:QI 2 "general_operand" "qn,qmn")))] - "" - "* return AS2 (or%B0,%2,%0);" - [(set_attr "type" "binary")]) - -;;- xor instructions - -(define_insn "xorsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r") - (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0") - (match_operand:SI 2 "general_operand" "ri,rm")))] - "" - "* -{ - HOST_WIDE_INT intval; - switch (GET_CODE (operands[2])) - { - case CONST_INT: - - if (REG_P (operands[0]) && ! QI_REG_P (operands[0])) - break; - - /* don't try to optimize volatile accesses */ - if (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])) - break; - - intval = INTVAL (operands[2]); - if ((intval & ~0xff) == 0) - { - if (REG_P (operands[0])) - { - /* Do low byte access only for %eax or when high bit is set */ - if (REGNO (operands[0]) != 0 && !(intval & 0x80)) - break; - } - -byte_xor_operation: - CC_STATUS_INIT; - - if (intval == 0xff - && (!TARGET_PENTIUM || optimize_size - || (GET_CODE (operands[0]) == MEM - && memory_address_info (XEXP (operands[0], 0), 1)))) - return AS1 (not%B0,%b0); - - if (intval != INTVAL (operands[2])) - operands[2] = GEN_INT (intval); - return AS2 (xor%B0,%2,%b0); - } - - /* second byte? */ - if ((intval & ~0xff00) == 0) - { - intval >>= 8; - - if (REG_P (operands[0])) - { - CC_STATUS_INIT; - if (intval == 0xff - && (!TARGET_PENTIUM || optimize_size - || (GET_CODE (operands[0]) == MEM - && memory_address_info (XEXP (operands[0], 0), 1)))) - return AS1 (not%B0,%h0); - - operands[2] = GEN_INT (intval); - return AS2 (xor%B0,%2,%h0); - } - - operands[0] = adj_offsettable_operand (operands[0], 1); - - goto byte_xor_operation; - } - - if (REG_P (operands[0])) - break; - - /* third byte? */ - if ((intval & ~0xff0000) == 0) - { - intval >>= 16; - operands[0] = adj_offsettable_operand (operands[0], 2); - goto byte_xor_operation; - } - - /* fourth byte? */ - if ((intval & ~0xff000000) == 0) - { - intval = (intval >> 24) & 0xff; - operands[0] = adj_offsettable_operand (operands[0], 3); - goto byte_xor_operation; - } - - default: - break; - } - - return AS2 (xor%L0,%2,%0); -}" - [(set_attr "type" "binary")]) - -(define_insn "xorhi3" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r") - (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0") - (match_operand:HI 2 "general_operand" "ri,rm")))] - "" - "* -{ - if (GET_CODE (operands[2]) == CONST_INT - && ! (GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))) - { - /* Can we ignore the upper byte? */ - if ((! REG_P (operands[0]) || QI_REG_P (operands[0])) - && (INTVAL (operands[2]) & 0xff00) == 0) - { - CC_STATUS_INIT; - if (INTVAL (operands[2]) & 0xffff0000) - operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffff); - - if (INTVAL (operands[2]) == 0xff - && (!TARGET_PENTIUM || optimize_size - || (GET_CODE (operands[0]) == MEM - && memory_address_info (XEXP (operands[0], 0), 1)))) - return AS1 (not%B0,%b0); - - return AS2 (xor%B0,%2,%b0); - } - - /* Can we ignore the lower byte? */ - /* ??? what about offsettable memory references? */ - if (QI_REG_P (operands[0]) - && (INTVAL (operands[2]) & 0xff) == 0) - { - CC_STATUS_INIT; - operands[2] = GEN_INT ((INTVAL (operands[2]) >> 8) & 0xff); - - if (INTVAL (operands[2]) == 0xff - && (!TARGET_PENTIUM || optimize_size - || (GET_CODE (operands[0]) == MEM - && memory_address_info (XEXP (operands[0], 0), 1)))) - return AS1 (not%B0,%h0); - - return AS2 (xor%B0,%2,%h0); - } - } - - if (REG_P (operands[0]) - && i386_aligned_p (operands[2])) - { - CC_STATUS_INIT; - operands[2] = i386_sext16_if_const (operands[2]); - return AS2 (xor%L0,%k2,%k0); - } - - if (GET_CODE (operands[2]) == CONST_INT - && i386_aligned_p (operands[0])) - { - HOST_WIDE_INT intval; - CC_STATUS_INIT; - intval = 0xffff & INTVAL (operands[2]); - if (intval != INTVAL (operands[2])) - operands[2] = GEN_INT (intval); - return AS2 (xor%L0,%2,%k0); - } - - return AS2 (xor%W0,%2,%0); -}" - [(set_attr "type" "binary")]) - -(define_insn "xorqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q") - (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0") - (match_operand:QI 2 "general_operand" "qn,qm")))] - "" - "* return AS2 (xor%B0,%2,%0);" - [(set_attr "type" "binary")]) - -;; logical operations for DImode - -(define_insn "anddi3" - [(set (match_operand:DI 0 "general_operand" "=&r,&ro") - (and:DI (match_operand:DI 1 "general_operand" "%0,0") - (match_operand:DI 2 "general_operand" "oriF,riF")))] - "" - "#" - [(set_attr "type" "binary")]) - - -(define_insn "iordi3" - [(set (match_operand:DI 0 "general_operand" "=&r,&ro") - (ior:DI (match_operand:DI 1 "general_operand" "%0,0") - (match_operand:DI 2 "general_operand" "oriF,riF")))] - "" - "#" - [(set_attr "type" "binary")]) - -(define_insn "xordi3" - [(set (match_operand:DI 0 "general_operand" "=&r,&ro") - (xor:DI (match_operand:DI 1 "general_operand" "%0,0") - (match_operand:DI 2 "general_operand" "oriF,riF")))] - "" - "#" - [(set_attr "type" "binary")]) - -(define_split - [(set (match_operand:DI 0 "general_operand" "") - (match_operator:DI 3 "ix86_logical_operator" - [(match_operand:DI 1 "general_operand" "") - (match_operand:DI 2 "general_operand" "")]))] - "" - [(set (match_dup 4) (match_op_dup:SI 3 [(match_dup 6) (match_dup 8)])) - (set (match_dup 5) (match_op_dup:SI 3 [(match_dup 7) (match_dup 9)]))] - "split_di (&operands[0], 1, &operands[4], &operands[5]); - split_di (&operands[1], 1, &operands[6], &operands[7]); - split_di (&operands[2], 1, &operands[8], &operands[9]);") - -;;- negation instructions - -(define_insn "negdi2" - [(set (match_operand:DI 0 "general_operand" "=&ro") - (neg:DI (match_operand:DI 1 "general_operand" "0")))] - "" - "* -{ - rtx xops[2], low[1], high[1]; - - CC_STATUS_INIT; - - split_di (operands, 1, low, high); - xops[0] = const0_rtx; - xops[1] = high[0]; - - output_asm_insn (AS1 (neg%L0,%0), low); - output_asm_insn (AS2 (adc%L1,%0,%1), xops); - output_asm_insn (AS1 (neg%L0,%0), high); - RET; -}") - -(define_insn "negsi2" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") - (neg:SI (match_operand:SI 1 "nonimmediate_operand" "0")))] - "" - "neg%L0 %0") - -(define_insn "neghi2" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") - (neg:HI (match_operand:HI 1 "nonimmediate_operand" "0")))] - "" - "* - if (REG_P (operands[0]) && i386_cc_probably_useless_p (insn)) - { - CC_STATUS_INIT; - return AS1(neg%L0,%k0); - } - return AS1(neg%W0,%0);") - -(define_insn "negqi2" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") - (neg:QI (match_operand:QI 1 "nonimmediate_operand" "0")))] - "" - "neg%B0 %0") - -(define_insn "negsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (neg:SF (match_operand:SF 1 "register_operand" "0")))] - "TARGET_80387" - "fchs" - [(set_attr "type" "fpop")]) - -(define_insn "negdf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (neg:DF (match_operand:DF 1 "register_operand" "0")))] - "TARGET_80387" - "fchs" - [(set_attr "type" "fpop")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (neg:DF (float_extend:DF (match_operand:SF 1 "register_operand" "0"))))] - "TARGET_80387" - "fchs" - [(set_attr "type" "fpop")]) - -(define_insn "negxf2" - [(set (match_operand:XF 0 "register_operand" "=f") - (neg:XF (match_operand:XF 1 "register_operand" "0")))] - "TARGET_80387" - "fchs" - [(set_attr "type" "fpop")]) - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f") - (neg:XF (float_extend:XF (match_operand:DF 1 "register_operand" "0"))))] - "TARGET_80387" - "fchs" - [(set_attr "type" "fpop")]) - -;; Absolute value instructions - -(define_insn "abssf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (abs:SF (match_operand:SF 1 "register_operand" "0")))] - "TARGET_80387" - "fabs" - [(set_attr "type" "fpop")]) - -(define_insn "absdf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (abs:DF (match_operand:DF 1 "register_operand" "0")))] - "TARGET_80387" - "fabs" - [(set_attr "type" "fpop")]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (abs:DF (float_extend:DF (match_operand:SF 1 "register_operand" "0"))))] - "TARGET_80387" - "fabs" - [(set_attr "type" "fpop")]) - -(define_insn "absxf2" - [(set (match_operand:XF 0 "register_operand" "=f") - (abs:XF (match_operand:XF 1 "register_operand" "0")))] - "TARGET_80387" - "fabs" - [(set_attr "type" "fpop")]) - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f") - (abs:XF (float_extend:XF (match_operand:DF 1 "register_operand" "0"))))] - "TARGET_80387" - "fabs" - [(set_attr "type" "fpop")]) - -(define_insn "sqrtsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (sqrt:SF (match_operand:SF 1 "register_operand" "0")))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387" - "fsqrt") - -(define_insn "sqrtdf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (sqrt:DF (match_operand:DF 1 "register_operand" "0")))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 - && (TARGET_IEEE_FP || flag_fast_math) " - "fsqrt") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (sqrt:DF (float_extend:DF - (match_operand:SF 1 "register_operand" "0"))))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387" - "fsqrt") - -(define_insn "sqrtxf2" - [(set (match_operand:XF 0 "register_operand" "=f") - (sqrt:XF (match_operand:XF 1 "register_operand" "0")))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 - && (TARGET_IEEE_FP || flag_fast_math) " - "fsqrt") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f") - (sqrt:XF (float_extend:XF - (match_operand:DF 1 "register_operand" "0"))))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387" - "fsqrt") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f") - (sqrt:XF (float_extend:XF - (match_operand:SF 1 "register_operand" "0"))))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387" - "fsqrt") - -(define_insn "sindf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 1))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math" - "fsin") - -(define_insn "sinsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 1))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math" - "fsin") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (unspec:DF [(float_extend:DF - (match_operand:SF 1 "register_operand" "0"))] 1))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math" - "fsin") - -(define_insn "sinxf2" - [(set (match_operand:XF 0 "register_operand" "=f") - (unspec:XF [(match_operand:XF 1 "register_operand" "0")] 1))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math" - "fsin") - -(define_insn "cosdf2" - [(set (match_operand:DF 0 "register_operand" "=f") - (unspec:DF [(match_operand:DF 1 "register_operand" "0")] 2))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math" - "fcos") - -(define_insn "cossf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (unspec:SF [(match_operand:SF 1 "register_operand" "0")] 2))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math" - "fcos") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f") - (unspec:DF [(float_extend:DF - (match_operand:SF 1 "register_operand" "0"))] 2))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math" - "fcos") - -(define_insn "cosxf2" - [(set (match_operand:XF 0 "register_operand" "=f") - (unspec:XF [(match_operand:XF 1 "register_operand" "0")] 2))] - "! TARGET_NO_FANCY_MATH_387 && TARGET_80387 && flag_fast_math" - "fcos") - -;;- one complement instructions - -(define_insn "one_cmplsi2" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") - (not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))] - "" - "* -{ - /* A Pentium NOT is not pariable. Output it only in case of complex - memory address, because XOR will be inpariable anyway because - of immediate/displacement rule. */ - - if (TARGET_PENTIUM && !optimize_size - && (GET_CODE (operands[0]) != MEM - || memory_address_info (XEXP (operands[0], 0), 1) == 0)) - { - rtx xops[2]; - xops[0] = operands[0]; - xops[1] = GEN_INT (0xffffffff); - output_asm_insn (AS2 (xor%L0,%1,%0), xops); - RET; - } - else - return AS1 (not%L0,%0); -}") - -(define_insn "one_cmplhi2" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") - (not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))] - "" - "* -{ - /* A Pentium NOT is not pariable. Output it only in case of complex - memory address, because XOR will be inpariable anyway because - of immediate/displacement rule. */ - - if (TARGET_PENTIUM && !optimize_size - && (GET_CODE (operands[0]) != MEM - || memory_address_info (XEXP (operands[0], 0), 1) == 0)) - { - rtx xops[2]; - xops[0] = operands[0]; - xops[1] = GEN_INT (0xffff); - if (REG_P (operands[0]) - && i386_cc_probably_useless_p (insn)) - { - CC_STATUS_INIT; - output_asm_insn (AS2 (xor%L0,%1,%k0), xops); - } - else - output_asm_insn (AS2 (xor%W0,%1,%0), xops); - RET; - } - else - { - if (REG_P (operands[0]) - && i386_cc_probably_useless_p (insn)) - { - CC_STATUS_INIT; - return AS1 (not%L0,%k0); - } - return AS1 (not%W0,%0); - } -}") - -(define_insn "one_cmplqi2" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") - (not:QI (match_operand:QI 1 "nonimmediate_operand" "0")))] - "" - "* -{ - /* A Pentium NOT is not pariable. Output it only in case of complex - memory address, because XOR will be inpariable anyway because - of immediate/displacement rule. */ - - if (TARGET_PENTIUM && !optimize_size - && (GET_CODE (operands[0]) != MEM - || memory_address_info (XEXP (operands[0], 0), 1) == 0)) - { - rtx xops[2]; - xops[0] = operands[0]; - xops[1] = GEN_INT (0xff); - output_asm_insn (AS2 (xor%B0,%1,%0), xops); - RET; - } - else - return AS1 (not%B0,%0); -}") - -;;- arithmetic shift instructions - -;; DImode shifts are implemented using the i386 "shift double" opcode, -;; which is written as "sh[lr]d[lw] imm,reg,reg/mem". If the shift count -;; is variable, then the count is in %cl and the "imm" operand is dropped -;; from the assembler input. - -;; This instruction shifts the target reg/mem as usual, but instead of -;; shifting in zeros, bits are shifted in from reg operand. If the insn -;; is a left shift double, bits are taken from the high order bits of -;; reg, else if the insn is a shift right double, bits are taken from the -;; low order bits of reg. So if %eax is "1234" and %edx is "5678", -;; "shldl $8,%edx,%eax" leaves %edx unchanged and sets %eax to "2345". - -;; Since sh[lr]d does not change the `reg' operand, that is done -;; separately, making all shifts emit pairs of shift double and normal -;; shift. Since sh[lr]d does not shift more than 31 bits, and we wish to -;; support a 63 bit shift, each shift where the count is in a reg expands -;; to a pair of shifts, a branch, a shift by 32 and a label. - -;; If the shift count is a constant, we need never emit more than one -;; shift pair, instead using moves and sign extension for counts greater -;; than 31. - -(define_expand "ashldi3" - [(set (match_operand:DI 0 "register_operand" "") - (ashift:DI (match_operand:DI 1 "register_operand" "") - (match_operand:QI 2 "nonmemory_operand" "")))] - "" - " -{ - if (GET_CODE (operands[2]) != CONST_INT - || ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')) - { - operands[2] = copy_to_mode_reg (QImode, operands[2]); - emit_insn (gen_ashldi3_non_const_int (operands[0], operands[1], - operands[2])); - } - else - emit_insn (gen_ashldi3_const_int (operands[0], operands[1], operands[2])); - - DONE; -}") - -(define_insn "ashldi3_const_int" - [(set (match_operand:DI 0 "register_operand" "=&r") - (ashift:DI (match_operand:DI 1 "register_operand" "0") - (match_operand:QI 2 "const_int_operand" "J")))] - "CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')" - "* -{ - rtx xops[4], low[1], high[1]; - - CC_STATUS_INIT; - - split_di (operands, 1, low, high); - xops[0] = operands[2]; - xops[1] = const1_rtx; - xops[2] = low[0]; - xops[3] = high[0]; - - if (INTVAL (xops[0]) > 31) - { - output_asm_insn (AS2 (mov%L3,%2,%3), xops); /* Fast shift by 32 */ - output_asm_insn (AS2 (xor%L2,%2,%2), xops); - - if (INTVAL (xops[0]) > 32) - { - xops[0] = GEN_INT (INTVAL (xops[0]) - 32); - output_asm_insn (AS2 (sal%L3,%0,%3), xops); /* Remaining shift */ - } - } - else - { - output_asm_insn (AS3 (shld%L3,%0,%2,%3), xops); - output_asm_insn (AS2 (sal%L2,%0,%2), xops); - } - RET; -}") - -(define_insn "ashldi3_non_const_int" - [(set (match_operand:DI 0 "register_operand" "=&r") - (ashift:DI (match_operand:DI 1 "register_operand" "0") - (match_operand:QI 2 "register_operand" "c")))] - "" - "* -{ - rtx xops[5], low[1], high[1]; - - CC_STATUS_INIT; - - split_di (operands, 1, low, high); - xops[0] = operands[2]; - xops[1] = GEN_INT (32); - xops[2] = low[0]; - xops[3] = high[0]; - xops[4] = gen_label_rtx (); - - output_asm_insn (AS3_SHIFT_DOUBLE (shld%L3,%0,%2,%3), xops); - output_asm_insn (AS2 (sal%L2,%0,%2), xops); - output_asm_insn (AS2 (test%B0,%1,%b0), xops); - output_asm_insn (AS1 (je,%X4), xops); - output_asm_insn (AS2 (mov%L3,%2,%3), xops); /* Fast shift by 32 */ - output_asm_insn (AS2 (xor%L2,%2,%2), xops); - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", - CODE_LABEL_NUMBER (xops[4])); - RET; -}") - -(define_expand "ashlsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "") - (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "") - (match_operand:SI 2 "nonmemory_operand" "")))] - "" - "") - -(define_expand "ashlhi3" - [(set (match_operand:HI 0 "nonimmediate_operand" "") - (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "") - (match_operand:HI 2 "nonmemory_operand" "")))] - "" - "") - -(define_expand "ashlqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "") - (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "") - (match_operand:QI 2 "nonmemory_operand" "")))] - "" - "") - -;; Pattern for shifts which can be encoded into an lea instruction. -;; This is kept as a separate pattern so that regmove can optimize cases -;; where we know the source and destination must match. -;; -;; Do not expose this pattern when optimizing for size since we never want -;; to use lea when optimizing for size since mov+sal is smaller than lea. - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r") - (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,r") - (match_operand:SI 2 "small_shift_operand" "M,M")))] - "! optimize_size" - "* return output_ashl (insn, operands);") - -;; Generic left shift pattern to catch all cases not handled by the -;; shift pattern above. -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") - (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:SI 2 "nonmemory_operand" "cI")))] - "" - "* return output_ashl (insn, operands);") - -(define_insn "" - [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r") - (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0,r") - (match_operand:HI 2 "small_shift_operand" "M,M")))] - "! optimize_size" - "* return output_ashl (insn, operands);") - -(define_insn "" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") - (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:HI 2 "nonmemory_operand" "cI")))] - "" - "* return output_ashl (insn, operands);") - -(define_insn "" - [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q") - (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,q") - (match_operand:QI 2 "small_shift_operand" "M,M")))] - "! optimize_size" - "* return output_ashl (insn, operands);") - -;; Generic left shift pattern to catch all cases not handled by the -;; shift pattern above. -(define_insn "" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") - (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "nonmemory_operand" "cI")))] - "" - "* return output_ashl (insn, operands);") - -;; See comment above `ashldi3' about how this works. - -(define_expand "ashrdi3" - [(set (match_operand:DI 0 "register_operand" "") - (ashiftrt:DI (match_operand:DI 1 "register_operand" "") - (match_operand:QI 2 "nonmemory_operand" "")))] - "" - " -{ - if (GET_CODE (operands[2]) != CONST_INT - || ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')) - { - operands[2] = copy_to_mode_reg (QImode, operands[2]); - emit_insn (gen_ashrdi3_non_const_int (operands[0], operands[1], - operands[2])); - } - else - emit_insn (gen_ashrdi3_const_int (operands[0], operands[1], operands[2])); - - DONE; -}") - -(define_insn "ashldi3_32" - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,m") - (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "ro,r") - (const_int 32)))] - "" - "* -{ - rtx low[2], high[2], xops[4]; - - split_di (operands, 2, low, high); - xops[0] = high[0]; - xops[1] = low[1]; - xops[2] = low[0]; - xops[3] = const0_rtx; - if (!rtx_equal_p (xops[0], xops[1])) - output_asm_insn (AS2 (mov%L0,%1,%0), xops); - - if (GET_CODE (low[0]) == MEM) - output_asm_insn (AS2 (mov%L2,%3,%2), xops); - else - output_asm_insn (AS2 (xor%L2,%2,%2), xops); - - RET; -}") - -(define_insn "ashrdi3_const_int" - [(set (match_operand:DI 0 "register_operand" "=&r") - (ashiftrt:DI (match_operand:DI 1 "register_operand" "0") - (match_operand:QI 2 "const_int_operand" "J")))] - "CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')" - "* -{ - rtx xops[4], low[1], high[1]; - - CC_STATUS_INIT; - - split_di (operands, 1, low, high); - xops[0] = operands[2]; - xops[1] = const1_rtx; - xops[2] = low[0]; - xops[3] = high[0]; - - if (INTVAL (xops[0]) > 31) - { - xops[1] = GEN_INT (31); - output_asm_insn (AS2 (mov%L2,%3,%2), xops); - output_asm_insn (AS2 (sar%L3,%1,%3), xops); /* shift by 32 */ - - if (INTVAL (xops[0]) > 32) - { - xops[0] = GEN_INT (INTVAL (xops[0]) - 32); - output_asm_insn (AS2 (sar%L2,%0,%2), xops); /* Remaining shift */ - } - } - else - { - output_asm_insn (AS3 (shrd%L2,%0,%3,%2), xops); - output_asm_insn (AS2 (sar%L3,%0,%3), xops); - } - - RET; -}") - -(define_insn "ashrdi3_non_const_int" - [(set (match_operand:DI 0 "register_operand" "=&r") - (ashiftrt:DI (match_operand:DI 1 "register_operand" "0") - (match_operand:QI 2 "register_operand" "c")))] - "" - "* -{ - rtx xops[5], low[1], high[1]; - - CC_STATUS_INIT; - - split_di (operands, 1, low, high); - xops[0] = operands[2]; - xops[1] = GEN_INT (32); - xops[2] = low[0]; - xops[3] = high[0]; - xops[4] = gen_label_rtx (); - - output_asm_insn (AS3_SHIFT_DOUBLE (shrd%L2,%0,%3,%2), xops); - output_asm_insn (AS2 (sar%L3,%0,%3), xops); - output_asm_insn (AS2 (test%B0,%1,%b0), xops); - output_asm_insn (AS1 (je,%X4), xops); - xops[1] = GEN_INT (31); - output_asm_insn (AS2 (mov%L2,%3,%2), xops); - output_asm_insn (AS2 (sar%L3,%1,%3), xops); /* shift by 32 */ - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", - CODE_LABEL_NUMBER (xops[4])); - RET; -}") - -(define_insn "ashrsi3_31" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,d") - (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,a") - (const_int 31)))] - "!TARGET_PENTIUM || optimize_size" - "@ - sar%L0 $31,%0 - cltd") - -(define_insn "ashrsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") - (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:SI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (sar%L0,%b2,%0); - else - return AS2 (sar%L0,%2,%0); -}") - -(define_insn "ashrhi3" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") - (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:HI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (sar%W0,%b2,%0); - else - return AS2 (sar%W0,%2,%0); -}") - -(define_insn "ashrqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") - (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (sar%B0,%b2,%0); - else - return AS2 (sar%B0,%2,%0); -}") - -;;- logical shift instructions - -;; See comment above `ashldi3' about how this works. - -(define_expand "lshrdi3" - [(set (match_operand:DI 0 "register_operand" "") - (lshiftrt:DI (match_operand:DI 1 "register_operand" "") - (match_operand:QI 2 "nonmemory_operand" "")))] - "" - " -{ - if (GET_CODE (operands[2]) != CONST_INT - || ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')) - { - operands[2] = copy_to_mode_reg (QImode, operands[2]); - emit_insn (gen_lshrdi3_non_const_int (operands[0], operands[1], - operands[2])); - } - else - emit_insn (gen_lshrdi3_const_int (operands[0], operands[1], operands[2])); - - DONE; -}") - -(define_insn "lshrdi3_32" - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,m") - (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro,r") - (const_int 32)))] - "" - "* -{ - rtx low[2], high[2], xops[4]; - - split_di (operands, 2, low, high); - xops[0] = low[0]; - xops[1] = high[1]; - xops[2] = high[0]; - xops[3] = const0_rtx; - if (!rtx_equal_p (xops[0], xops[1])) - output_asm_insn (AS2 (mov%L0,%1,%0), xops); - - if (GET_CODE (low[0]) == MEM) - output_asm_insn (AS2 (mov%L2,%3,%2), xops); - else - output_asm_insn (AS2 (xor%L2,%2,%2), xops); - - RET; -}") - -(define_insn "lshrdi3_const_int" - [(set (match_operand:DI 0 "register_operand" "=&r") - (lshiftrt:DI (match_operand:DI 1 "register_operand" "0") - (match_operand:QI 2 "const_int_operand" "J")))] - "CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J')" - "* -{ - rtx xops[4], low[1], high[1]; - - CC_STATUS_INIT; - - split_di (operands, 1, low, high); - xops[0] = operands[2]; - xops[1] = const1_rtx; - xops[2] = low[0]; - xops[3] = high[0]; - - if (INTVAL (xops[0]) > 31) - { - output_asm_insn (AS2 (mov%L2,%3,%2), xops); /* Fast shift by 32 */ - output_asm_insn (AS2 (xor%L3,%3,%3), xops); - - if (INTVAL (xops[0]) > 32) - { - xops[0] = GEN_INT (INTVAL (xops[0]) - 32); - output_asm_insn (AS2 (shr%L2,%0,%2), xops); /* Remaining shift */ - } - } - else - { - output_asm_insn (AS3 (shrd%L2,%0,%3,%2), xops); - output_asm_insn (AS2 (shr%L3,%0,%3), xops); - } - - RET; -}") - -(define_insn "lshrdi3_non_const_int" - [(set (match_operand:DI 0 "register_operand" "=&r") - (lshiftrt:DI (match_operand:DI 1 "register_operand" "0") - (match_operand:QI 2 "register_operand" "c")))] - "" - "* -{ - rtx xops[5], low[1], high[1]; - - CC_STATUS_INIT; - - split_di (operands, 1, low, high); - xops[0] = operands[2]; - xops[1] = GEN_INT (32); - xops[2] = low[0]; - xops[3] = high[0]; - xops[4] = gen_label_rtx (); - - output_asm_insn (AS3_SHIFT_DOUBLE (shrd%L2,%0,%3,%2), xops); - output_asm_insn (AS2 (shr%L3,%0,%3), xops); - output_asm_insn (AS2 (test%B0,%1,%b0), xops); - output_asm_insn (AS1 (je,%X4), xops); - output_asm_insn (AS2 (mov%L2,%3,%2), xops); /* Fast shift by 32 */ - output_asm_insn (AS2 (xor%L3,%3,%3), xops); - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", - CODE_LABEL_NUMBER (xops[4])); - RET; -}") - -(define_insn "lshrsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") - (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:SI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (shr%L0,%b2,%0); - else - return AS2 (shr%L0,%2,%1); -}") - -(define_insn "lshrhi3" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") - (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:HI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (shr%W0,%b2,%0); - else - return AS2 (shr%W0,%2,%0); -}") - -(define_insn "lshrqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") - (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (shr%B0,%b2,%0); - else - return AS2 (shr%B0,%2,%0); -}") - -;;- rotate instructions - -(define_insn "rotlsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") - (rotate:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:SI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (rol%L0,%b2,%0); - else - return AS2 (rol%L0,%2,%0); -}") - -(define_insn "rotlhi3" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") - (rotate:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:HI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (rol%W0,%b2,%0); - else - return AS2 (rol%W0,%2,%0); -}") - -(define_insn "rotlqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") - (rotate:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (rol%B0,%b2,%0); - else - return AS2 (rol%B0,%2,%0); -}") - -(define_insn "rotrsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") - (rotatert:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (match_operand:SI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (ror%L0,%b2,%0); - else - return AS2 (ror%L0,%2,%0); -}") - -(define_insn "rotrhi3" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rm") - (rotatert:HI (match_operand:HI 1 "nonimmediate_operand" "0") - (match_operand:HI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (ror%W0,%b2,%0); - else - return AS2 (ror%W0,%2,%0); -}") - -(define_insn "rotrqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") - (rotatert:QI (match_operand:QI 1 "nonimmediate_operand" "0") - (match_operand:QI 2 "nonmemory_operand" "cI")))] - "" - "* -{ - if (REG_P (operands[2])) - return AS2 (ror%B0,%b2,%0); - else - return AS2 (ror%B0,%2,%0); -}") - -/* -;; This usually looses. But try a define_expand to recognize a few case -;; we can do efficiently, such as accessing the "high" QImode registers, -;; %ah, %bh, %ch, %dh. -;; ??? Note this has a botch on the mode of operand 0, which needs to be -;; fixed if this is ever enabled. -(define_insn "insv" - [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+&r") - (match_operand:SI 1 "immediate_operand" "i") - (match_operand:SI 2 "immediate_operand" "i")) - (match_operand:SI 3 "nonmemory_operand" "ri"))] - "" - "* -{ - if (INTVAL (operands[1]) + INTVAL (operands[2]) > GET_MODE_BITSIZE (SImode)) - abort (); - if (GET_CODE (operands[3]) == CONST_INT) - { - unsigned int mask = (1 << INTVAL (operands[1])) - 1; - operands[1] = GEN_INT (~(mask << INTVAL (operands[2]))); - output_asm_insn (AS2 (and%L0,%1,%0), operands); - operands[3] = GEN_INT (INTVAL (operands[3]) << INTVAL (operands[2])); - output_asm_insn (AS2 (or%L0,%3,%0), operands); - } - else - { - operands[0] = gen_rtx_REG (SImode, REGNO (operands[0])); - if (INTVAL (operands[2])) - output_asm_insn (AS2 (ror%L0,%2,%0), operands); - output_asm_insn (AS3 (shrd%L0,%1,%3,%0), operands); - operands[2] = GEN_INT (BITS_PER_WORD - - INTVAL (operands[1]) - INTVAL (operands[2])); - if (INTVAL (operands[2])) - output_asm_insn (AS2 (ror%L0,%2,%0), operands); - } - RET; -}") -*/ -/* -;; ??? There are problems with the mode of operand[3]. The point of this -;; is to represent an HImode move to a "high byte" register. - -(define_expand "insv" - [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "") - (match_operand:SI 1 "immediate_operand" "") - (match_operand:SI 2 "immediate_operand" "")) - (match_operand:QI 3 "nonmemory_operand" "ri"))] - "" - " -{ - if (GET_CODE (operands[1]) != CONST_INT - || GET_CODE (operands[2]) != CONST_INT) - FAIL; - - if (! (INTVAL (operands[1]) == 8 - && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 0)) - && ! INTVAL (operands[1]) == 1) - FAIL; -}") -*/ - -;; On i386, the register count for a bit operation is *not* truncated, -;; so SHIFT_COUNT_TRUNCATED must not be defined. - -;; On i486, the shift & or/and code is faster than bts or btr. If -;; operands[0] is a MEM, the bt[sr] is half as fast as the normal code. - -;; On i386, bts is a little faster if operands[0] is a reg, and a -;; little slower if operands[0] is a MEM, than the shift & or/and code. -;; Use bts & btr, since they reload better. - -;; General bit set and clear. -(define_insn "" - [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+rm") - (const_int 1) - (match_operand:SI 2 "register_operand" "r")) - (match_operand:SI 3 "const_int_operand" "n"))] - "TARGET_USE_BIT_TEST && GET_CODE (operands[2]) != CONST_INT" - "* -{ - CC_STATUS_INIT; - - if (INTVAL (operands[3]) == 1) - return AS2 (bts%L0,%2,%0); - else - return AS2 (btr%L0,%2,%0); -}") - -;; Bit complement. See comments on previous pattern. -;; ??? Is this really worthwhile? -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") - (xor:SI (ashift:SI (const_int 1) - (match_operand:SI 1 "register_operand" "r")) - (match_operand:SI 2 "nonimmediate_operand" "0")))] - "TARGET_USE_BIT_TEST && GET_CODE (operands[1]) != CONST_INT" - "* -{ - CC_STATUS_INIT; - - return AS2 (btc%L0,%1,%0); -}") - -(define_insn "" - [(set (match_operand:SI 0 "nonimmediate_operand" "=rm") - (xor:SI (match_operand:SI 1 "nonimmediate_operand" "0") - (ashift:SI (const_int 1) - (match_operand:SI 2 "register_operand" "r"))))] - "TARGET_USE_BIT_TEST && GET_CODE (operands[2]) != CONST_INT" - "* -{ - CC_STATUS_INIT; - - return AS2 (btc%L0,%2,%0); -}") - -;; Recognizers for bit-test instructions. - -;; The bt opcode allows a MEM in operands[0]. But on both i386 and -;; i486, it is faster to copy a MEM to REG and then use bt, than to use -;; bt on the MEM directly. - -;; ??? The first argument of a zero_extract must not be reloaded, so -;; don't allow a MEM in the operand predicate without allowing it in the -;; constraint. - -(define_insn "" - [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "r") - (const_int 1) - (match_operand:SI 1 "register_operand" "r")))] - "GET_CODE (operands[1]) != CONST_INT" - "* -{ - cc_status.flags |= CC_Z_IN_NOT_C; - return AS2 (bt%L0,%1,%0); -}") - -(define_insn "" - [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "r") - (match_operand:SI 1 "const_int_operand" "n") - (match_operand:SI 2 "const_int_operand" "n")))] - "" - "* -{ - unsigned int mask; - - mask = ((1 << INTVAL (operands[1])) - 1) << INTVAL (operands[2]); - operands[1] = GEN_INT (mask); - - if (QI_REG_P (operands[0]) - /* A Pentium test is pairable only with eax. Not with ah or al. */ - && (! REG_P (operands[0]) || REGNO (operands[0]) || !TARGET_PENTIUM - || optimize_size)) - { - if ((mask & ~0xff) == 0) - { - cc_status.flags |= CC_NOT_NEGATIVE; - return AS2 (test%B0,%1,%b0); - } - - if ((mask & ~0xff00) == 0) - { - cc_status.flags |= CC_NOT_NEGATIVE; - operands[1] = GEN_INT (mask >> 8); - return AS2 (test%B0,%1,%h0); - } - } - - return AS2 (test%L0,%1,%0); -}") - -;; ??? All bets are off if operand 0 is a volatile MEM reference. -;; The CPU may access unspecified bytes around the actual target byte. - -(define_insn "" - [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m") - (match_operand:SI 1 "const_int_operand" "n") - (match_operand:SI 2 "const_int_operand" "n")))] - "GET_CODE (operands[0]) != MEM || ! MEM_VOLATILE_P (operands[0])" - "* -{ - unsigned int mask; - - mask = ((1 << INTVAL (operands[1])) - 1) << INTVAL (operands[2]); - operands[1] = GEN_INT (mask); - - if ((! REG_P (operands[0]) || QI_REG_P (operands[0])) - /* A Pentium test is pairable only with eax. Not with ah or al. */ - && (! REG_P (operands[0]) || REGNO (operands[0]) || !TARGET_PENTIUM - || optimize_size)) - { - if ((mask & ~0xff) == 0) - { - cc_status.flags |= CC_NOT_NEGATIVE; - return AS2 (test%B0,%1,%b0); - } - - if ((mask & ~0xff00) == 0) - { - cc_status.flags |= CC_NOT_NEGATIVE; - operands[1] = GEN_INT (mask >> 8); - - if (QI_REG_P (operands[0])) - return AS2 (test%B0,%1,%h0); - else - { - operands[0] = adj_offsettable_operand (operands[0], 1); - return AS2 (test%B0,%1,%b0); - } - } - - if (GET_CODE (operands[0]) == MEM && (mask & ~0xff0000) == 0) - { - cc_status.flags |= CC_NOT_NEGATIVE; - operands[1] = GEN_INT (mask >> 16); - operands[0] = adj_offsettable_operand (operands[0], 2); - return AS2 (test%B0,%1,%b0); - } - - if (GET_CODE (operands[0]) == MEM && (mask & ~0xff000000) == 0) - { - cc_status.flags |= CC_NOT_NEGATIVE; - operands[1] = GEN_INT (mask >> 24); - operands[0] = adj_offsettable_operand (operands[0], 3); - return AS2 (test%B0,%1,%b0); - } - } - - if (CONSTANT_P (operands[1]) || GET_CODE (operands[0]) == MEM) - return AS2 (test%L0,%1,%0); - - return AS2 (test%L1,%0,%1); -}") - -;; Store-flag instructions. - -;; For all sCOND expanders, also expand the compare or test insn that -;; generates cc0. Generate an equality comparison if `seq' or `sne'. - -(define_expand "seq" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (eq:QI (cc0) (const_int 0)))] - "" - " -{ - if (TARGET_IEEE_FP - && GET_MODE_CLASS (GET_MODE (i386_compare_op0)) == MODE_FLOAT) - operands[1] = (*i386_compare_gen_eq)(i386_compare_op0, i386_compare_op1); - else - operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1); -}") - -(define_expand "sne" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (ne:QI (cc0) (const_int 0)))] - "" - " -{ - if (TARGET_IEEE_FP - && GET_MODE_CLASS (GET_MODE (i386_compare_op0)) == MODE_FLOAT) - operands[1] = (*i386_compare_gen_eq)(i386_compare_op0, i386_compare_op1); - else - operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1); -}") - -(define_expand "sgt" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (gt:QI (cc0) (const_int 0)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "sgtu" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (gtu:QI (cc0) (const_int 0)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "slt" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (lt:QI (cc0) (const_int 0)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "sltu" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (ltu:QI (cc0) (const_int 0)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "sge" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (ge:QI (cc0) (const_int 0)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "sgeu" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (geu:QI (cc0) (const_int 0)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "sle" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (le:QI (cc0) (const_int 0)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "sleu" - [(match_dup 1) - (set (match_operand:QI 0 "register_operand" "") - (leu:QI (cc0) (const_int 0)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -;; The 386 sCOND opcodes can write to memory. But a gcc sCOND insn may -;; not have any input reloads. A MEM write might need an input reload -;; for the address of the MEM. So don't allow MEM as the SET_DEST. - -(define_insn "*setcc" - [(set (match_operand:QI 0 "nonimmediate_operand" "=qm") - (match_operator:QI 1 "comparison_operator" [(cc0) (const_int 0)]))] - "reload_completed || register_operand (operands[0], QImode)" - "* -{ - enum rtx_code code = GET_CODE (operands[1]); - if (cc_prev_status.flags & CC_TEST_AX) - { - int eq; - HOST_WIDE_INT c; - operands[2] = gen_rtx_REG (SImode, 0); - switch (code) - { - case EQ: - c = 0x4000; - eq = 0; - break; - case NE: - c = 0x4000; - eq = 1; - break; - case GT: - c = 0x4100; - eq = 1; - break; - case LT: - c = 0x100; - eq = 0; - break; - case GE: - c = 0x100; - eq = 1; - break; - case LE: - c = 0x4100; - eq = 0; - break; - default: - abort (); - } - if (!TARGET_PENTIUM || optimize_size) - { - operands[3] = GEN_INT (c >> 8); - output_asm_insn (AS2 (test%B0,%3,%h2), operands); - } - else - { - operands[3] = GEN_INT (c); - output_asm_insn (AS2 (test%L0,%3,%2), operands); - } - return eq ? AS1 (sete,%0) : AS1 (setne, %0); - } - - if ((cc_status.flags & CC_NO_OVERFLOW) && (code == LE || code == GT)) - return (char *)0; - return AS1(set%D1,%0); -}") - - -;; Basic conditional jump instructions. -;; We ignore the overflow flag for signed branch instructions. - -;; For all bCOND expanders, also expand the compare or test insn that -;; generates cc0. Generate an equality comparison if `beq' or `bne'. - -(define_expand "beq" - [(match_dup 1) - (set (pc) - (if_then_else (eq (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ - if (TARGET_IEEE_FP - && GET_MODE_CLASS (GET_MODE (i386_compare_op0)) == MODE_FLOAT) - operands[1] = (*i386_compare_gen_eq)(i386_compare_op0, i386_compare_op1); - else - operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1); -}") - -(define_expand "bne" - [(match_dup 1) - (set (pc) - (if_then_else (ne (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ - if (TARGET_IEEE_FP - && GET_MODE_CLASS (GET_MODE (i386_compare_op0)) == MODE_FLOAT) - operands[1] = (*i386_compare_gen_eq)(i386_compare_op0, i386_compare_op1); - else - operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1); -}") - - -(define_expand "bgt" - [(match_dup 1) - (set (pc) - (if_then_else (gt (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "bgtu" - [(match_dup 1) - (set (pc) - (if_then_else (gtu (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "blt" - [(match_dup 1) - (set (pc) - (if_then_else (lt (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - - -(define_expand "bltu" - [(match_dup 1) - (set (pc) - (if_then_else (ltu (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "bge" - [(match_dup 1) - (set (pc) - (if_then_else (ge (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "bgeu" - [(match_dup 1) - (set (pc) - (if_then_else (geu (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "ble" - [(match_dup 1) - (set (pc) - (if_then_else (le (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_expand "bleu" - [(match_dup 1) - (set (pc) - (if_then_else (leu (cc0) - (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - "operands[1] = (*i386_compare_gen)(i386_compare_op0, i386_compare_op1);") - -(define_insn "" - [(set (pc) - (if_then_else (match_operator 0 "comparison_operator" - [(cc0) (const_int 0)]) - (label_ref (match_operand 1 "" "")) - (pc)))] - "" - "* -{ - enum rtx_code code = GET_CODE (operands[0]); - if (cc_prev_status.flags & CC_TEST_AX) - { - int eq; - HOST_WIDE_INT c; - operands[2] = gen_rtx_REG (SImode, 0); - switch (code) - { - case EQ: - c = 0x4000; - eq = 0; - break; - case NE: - c = 0x4000; - eq = 1; - break; - case GT: - c = 0x4100; - eq = 1; - break; - case LT: - c = 0x100; - eq = 0; - break; - case GE: - c = 0x100; - eq = 1; - break; - case LE: - c = 0x4100; - eq = 0; - break; - default: - abort (); - } - if (!TARGET_PENTIUM || optimize_size) - { - operands[3] = GEN_INT (c >> 8); - output_asm_insn (AS2 (test%B0,%3,%h2), operands); - } - else - { - operands[3] = GEN_INT (c); - output_asm_insn (AS2 (test%L0,%3,%2), operands); - } - return eq ? AS1 (je,%l1) : AS1 (jne, %l1); - } - if ((cc_status.flags & CC_NO_OVERFLOW) && (code == LE || code == GT)) - return (char *)0; - - return AS1(j%D0,%l1); -}") - -(define_insn "" - [(set (pc) - (if_then_else (match_operator 0 "comparison_operator" - [(cc0) (const_int 0)]) - (pc) - (label_ref (match_operand 1 "" ""))))] - "" - "* -{ - enum rtx_code code = GET_CODE (operands[0]); - if (cc_prev_status.flags & CC_TEST_AX) - { - int eq; - HOST_WIDE_INT c; - operands[2] = gen_rtx_REG (SImode, 0); - switch (code) - { - case EQ: - c = 0x4000; - eq = 1; - break; - case NE: - c = 0x4000; - eq = 0; - break; - case GT: - c = 0x4100; - eq = 0; - break; - case LT: - c = 0x100; - eq = 1; - break; - case GE: - c = 0x100; - eq = 0; - break; - case LE: - c = 0x4100; - eq = 1; - break; - default: - abort (); - } - if (!TARGET_PENTIUM || optimize_size) - { - operands[3] = GEN_INT (c >> 8); - output_asm_insn (AS2 (test%B0,%3,%h2), operands); - } - else - { - operands[3] = GEN_INT (c); - output_asm_insn (AS2 (test%L0,%3,%2), operands); - } - return eq ? AS1 (je,%l1) : AS1 (jne, %l1); - } - if ((cc_status.flags & CC_NO_OVERFLOW) && (code == LE || code == GT)) - return (char *)0; - - return AS1(j%d0,%l1); -}") - -;; Unconditional and other jump instructions - -(define_insn "jump" - [(set (pc) - (label_ref (match_operand 0 "" "")))] - "" - "jmp %l0" - [(set_attr "memory" "none")]) - -(define_insn "indirect_jump" - [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))] - "" - "* -{ - CC_STATUS_INIT; - - return AS1 (jmp,%*%0); -}" - [(set_attr "memory" "none")]) - -;; ??? could transform while(--i > 0) S; to if (--i > 0) do S; while(--i); -;; if S does not change i - -(define_expand "decrement_and_branch_until_zero" - [(parallel [(set (pc) - (if_then_else (ge (plus:SI (match_operand:SI 0 "general_operand" "") - (const_int -1)) - (const_int 0)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int -1)))])] - "" - "") - -(define_insn "" - [(set (pc) - (if_then_else (match_operator 0 "arithmetic_comparison_operator" - [(plus:SI (match_operand:SI 1 "nonimmediate_operand" "+c*r,m") - (match_operand:SI 2 "general_operand" "rmi,ri")) - (const_int 0)]) - (label_ref (match_operand 3 "" "")) - (pc))) - (set (match_dup 1) - (plus:SI (match_dup 1) - (match_dup 2)))] - "" - "* -{ - CC_STATUS_INIT; - - if (GET_CODE (operands[1]) == REG && REGNO (operands[2]) == 2 && - operands[2] == constm1_rtx && ix86_cpu == PROCESSOR_K6) - return \"loop %l3\"; - - if (operands[2] == constm1_rtx) - output_asm_insn (AS1 (dec%L1,%1), operands); - - else if (operands[2] == const1_rtx) - output_asm_insn (AS1 (inc%L1,%1), operands); - - else - output_asm_insn (AS2 (add%L1,%2,%1), operands); - - return AS1 (%J0,%l3); -}") - -(define_insn "" - [(set (pc) - (if_then_else (match_operator 0 "arithmetic_comparison_operator" - [(minus:SI (match_operand:SI 1 "nonimmediate_operand" "+r,m") - (match_operand:SI 2 "general_operand" "rmi,ri")) - (const_int 0)]) - (label_ref (match_operand 3 "" "")) - (pc))) - (set (match_dup 1) - (minus:SI (match_dup 1) - (match_dup 2)))] - "" - "* -{ - CC_STATUS_INIT; - if (operands[2] == const1_rtx) - output_asm_insn (AS1 (dec%L1,%1), operands); - - else if (operands[1] == constm1_rtx) - output_asm_insn (AS1 (inc%L1,%1), operands); - - else - output_asm_insn (AS2 (sub%L1,%2,%1), operands); - - return AS1 (%J0,%l3); -}") - -(define_insn "" - [(set (pc) - (if_then_else (ne (match_operand:SI 0 "general_operand" "+g") - (const_int 0)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int -1)))] - "" - "* -{ - CC_STATUS_INIT; - operands[2] = const1_rtx; - output_asm_insn (AS2 (sub%L0,%2,%0), operands); - return \"jnc %l1\"; -}") - -(define_insn "" - [(set (pc) - (if_then_else (eq (match_operand:SI 0 "general_operand" "+g") - (const_int 0)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int -1)))] - "" - "* -{ - CC_STATUS_INIT; - operands[2] = const1_rtx; - output_asm_insn (AS2 (sub%L0,%2,%0), operands); - return \"jc %l1\"; -}") - -(define_insn "" - [(set (pc) - (if_then_else (ne (match_operand:SI 0 "general_operand" "+g") - (const_int 1)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int -1)))] - "" - "* -{ - CC_STATUS_INIT; - output_asm_insn (AS1 (dec%L0,%0), operands); - return \"jnz %l1\"; -}") - -(define_insn "" - [(set (pc) - (if_then_else (eq (match_operand:SI 0 "general_operand" "+g") - (const_int 1)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int -1)))] - "" - "* -{ - CC_STATUS_INIT; - output_asm_insn (AS1 (dec%L0,%0), operands); - return \"jz %l1\"; -}") - -(define_insn "" - [(set (pc) - (if_then_else (ne (match_operand:SI 0 "general_operand" "+g") - (const_int -1)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int 1)))] - "" - "* -{ - CC_STATUS_INIT; - output_asm_insn (AS1 (inc%L0,%0), operands); - return \"jnz %l1\"; -}") - -(define_insn "" - [(set (pc) - (if_then_else (eq (match_operand:SI 0 "general_operand" "+g") - (const_int -1)) - (label_ref (match_operand 1 "" "")) - (pc))) - (set (match_dup 0) - (plus:SI (match_dup 0) - (const_int 1)))] - "" - "* -{ - CC_STATUS_INIT; - output_asm_insn (AS1 (inc%L0,%0), operands); - return \"jz %l1\"; -}") - -;; Implement switch statements when generating PIC code. Switches are -;; implemented by `tablejump' when not using -fpic. - -;; Emit code here to do the range checking and make the index zero based. - -(define_expand "casesi" - [(set (match_dup 5) - (match_operand:SI 0 "general_operand" "")) - (set (match_dup 6) - (minus:SI (match_dup 5) - (match_operand:SI 1 "general_operand" ""))) - (set (cc0) - (compare:CC (match_dup 6) - (match_operand:SI 2 "general_operand" ""))) - (set (pc) - (if_then_else (gtu (cc0) - (const_int 0)) - (label_ref (match_operand 4 "" "")) - (pc))) - (parallel - [(set (pc) - (minus:SI (reg:SI 3) - (mem:SI (plus:SI (mult:SI (match_dup 6) - (const_int 4)) - (label_ref (match_operand 3 "" "")))))) - (clobber (match_scratch:SI 7 ""))])] - "flag_pic" - " -{ - operands[5] = gen_reg_rtx (SImode); - operands[6] = gen_reg_rtx (SImode); - current_function_uses_pic_offset_table = 1; -}") - -;; Implement a casesi insn. - -;; Each entry in the "addr_diff_vec" looks like this as the result of the -;; two rules below: -;; -;; .long _GLOBAL_OFFSET_TABLE_+[.-.L2] -;; -;; 1. An expression involving an external reference may only use the -;; addition operator, and only with an assembly-time constant. -;; The example above satisfies this because ".-.L2" is a constant. -;; -;; 2. The symbol _GLOBAL_OFFSET_TABLE_ is magic, and at link time is -;; given the value of "GOT - .", where GOT is the actual address of -;; the Global Offset Table. Therefore, the .long above actually -;; stores the value "( GOT - . ) + [ . - .L2 ]", or "GOT - .L2". The -;; expression "GOT - .L2" by itself would generate an error from as(1). -;; -;; The pattern below emits code that looks like this: -;; -;; movl %ebx,reg -;; subl TABLE@GOTOFF(%ebx,index,4),reg -;; jmp reg -;; -;; The addr_diff_vec contents may be directly referenced with @GOTOFF, since -;; the addr_diff_vec is known to be part of this module. -;; -;; The subl above calculates "GOT - (( GOT - . ) + [ . - .L2 ])", which -;; evaluates to just ".L2". - -(define_insn "" - [(set (pc) - (minus:SI (reg:SI 3) - (mem:SI (plus:SI - (mult:SI (match_operand:SI 0 "register_operand" "r") - (const_int 4)) - (label_ref (match_operand 1 "" "")))))) - (clobber (match_scratch:SI 2 "=&r"))] - "" - "* -{ - rtx xops[4]; - - xops[0] = operands[0]; - xops[1] = operands[1]; - xops[2] = operands[2]; - xops[3] = pic_offset_table_rtx; - - output_asm_insn (AS2 (mov%L2,%3,%2), xops); - output_asm_insn (\"sub%L2 %l1@GOTOFF(%3,%0,4),%2\", xops); - output_asm_insn (AS1 (jmp,%*%2), xops); - ASM_OUTPUT_ALIGN (asm_out_file, i386_align_jumps); - RET; -}") - -(define_insn "tablejump" - [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm")) - (use (label_ref (match_operand 1 "" "")))] - "" - "* -{ - CC_STATUS_INIT; - - return AS1 (jmp,%*%0); -}") - -;; Call insns. - -;; If generating PIC code, the predicate indirect_operand will fail -;; for operands[0] containing symbolic references on all of the named -;; call* patterns. Each named pattern is followed by an unnamed pattern -;; that matches any call to a symbolic CONST (ie, a symbol_ref). The -;; unnamed patterns are only used while generating PIC code, because -;; otherwise the named patterns match. - -;; Call subroutine returning no value. - -(define_expand "call_pop" - [(parallel [(call (match_operand:QI 0 "indirect_operand" "") - (match_operand:SI 1 "general_operand" "")) - (set (reg:SI 7) - (plus:SI (reg:SI 7) - (match_operand:SI 3 "immediate_operand" "")))])] - "" - " -{ - rtx addr; - - if (operands[3] == const0_rtx) - { - emit_insn (gen_call (operands[0], operands[1])); - DONE; - } - - if (flag_pic) - current_function_uses_pic_offset_table = 1; - - /* With half-pic, force the address into a register. */ - addr = XEXP (operands[0], 0); - if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr)) - XEXP (operands[0], 0) = force_reg (Pmode, addr); - - if (! expander_call_insn_operand (operands[0], QImode)) - operands[0] - = change_address (operands[0], VOIDmode, - copy_to_mode_reg (Pmode, XEXP (operands[0], 0))); -}") - -(define_insn "" - [(call (match_operand:QI 0 "call_insn_operand" "m") - (match_operand:SI 1 "general_operand" "g")) - (set (reg:SI 7) (plus:SI (reg:SI 7) - (match_operand:SI 3 "immediate_operand" "i")))] - "" - "* -{ - if (GET_CODE (operands[0]) == MEM - && ! CONSTANT_ADDRESS_P (XEXP (operands[0], 0))) - { - operands[0] = XEXP (operands[0], 0); - return AS1 (call,%*%0); - } - else - return AS1 (call,%P0); -}") - -(define_insn "" - [(call (mem:QI (match_operand:SI 0 "symbolic_operand" "")) - (match_operand:SI 1 "general_operand" "g")) - (set (reg:SI 7) (plus:SI (reg:SI 7) - (match_operand:SI 3 "immediate_operand" "i")))] - "!HALF_PIC_P ()" - "call %P0") - -(define_expand "call" - [(call (match_operand:QI 0 "indirect_operand" "") - (match_operand:SI 1 "general_operand" ""))] - ;; Operand 1 not used on the i386. - "" - " -{ - rtx addr; - - if (flag_pic) - current_function_uses_pic_offset_table = 1; - - /* With half-pic, force the address into a register. */ - addr = XEXP (operands[0], 0); - if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr)) - XEXP (operands[0], 0) = force_reg (Pmode, addr); - - if (! expander_call_insn_operand (operands[0], QImode)) - operands[0] - = change_address (operands[0], VOIDmode, - copy_to_mode_reg (Pmode, XEXP (operands[0], 0))); -}") - -(define_insn "" - [(call (match_operand:QI 0 "call_insn_operand" "m") - (match_operand:SI 1 "general_operand" "g"))] - ;; Operand 1 not used on the i386. - "" - "* -{ - if (GET_CODE (operands[0]) == MEM - && ! CONSTANT_ADDRESS_P (XEXP (operands[0], 0))) - { - operands[0] = XEXP (operands[0], 0); - return AS1 (call,%*%0); - } - else - return AS1 (call,%P0); -}") - -(define_insn "" - [(call (mem:QI (match_operand:SI 0 "symbolic_operand" "")) - (match_operand:SI 1 "general_operand" "g"))] - ;; Operand 1 not used on the i386. - "!HALF_PIC_P ()" - "call %P0") - -;; Call subroutine, returning value in operand 0 -;; (which must be a hard register). - -(define_expand "call_value_pop" - [(parallel [(set (match_operand 0 "" "") - (call (match_operand:QI 1 "indirect_operand" "") - (match_operand:SI 2 "general_operand" ""))) - (set (reg:SI 7) - (plus:SI (reg:SI 7) - (match_operand:SI 4 "immediate_operand" "")))])] - "" - " -{ - rtx addr; - - if (operands[4] == const0_rtx) - { - emit_insn (gen_call_value (operands[0], operands[1], operands[2])); - DONE; - } - - if (flag_pic) - current_function_uses_pic_offset_table = 1; - - /* With half-pic, force the address into a register. */ - addr = XEXP (operands[1], 0); - if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr)) - XEXP (operands[1], 0) = force_reg (Pmode, addr); - - if (! expander_call_insn_operand (operands[1], QImode)) - operands[1] - = change_address (operands[1], VOIDmode, - copy_to_mode_reg (Pmode, XEXP (operands[1], 0))); -}") - -(define_insn "" - [(set (match_operand 0 "" "=rf") - (call (match_operand:QI 1 "call_insn_operand" "m") - (match_operand:SI 2 "general_operand" "g"))) - (set (reg:SI 7) (plus:SI (reg:SI 7) - (match_operand:SI 4 "immediate_operand" "i")))] - "" - "* -{ - if (GET_CODE (operands[1]) == MEM - && ! CONSTANT_ADDRESS_P (XEXP (operands[1], 0))) - { - operands[1] = XEXP (operands[1], 0); - output_asm_insn (AS1 (call,%*%1), operands); - } - else - output_asm_insn (AS1 (call,%P1), operands); - - RET; -}") - -(define_insn "" - [(set (match_operand 0 "" "=rf") - (call (mem:QI (match_operand:SI 1 "symbolic_operand" "")) - (match_operand:SI 2 "general_operand" "g"))) - (set (reg:SI 7) (plus:SI (reg:SI 7) - (match_operand:SI 4 "immediate_operand" "i")))] - "!HALF_PIC_P ()" - "call %P1") - -(define_expand "call_value" - [(set (match_operand 0 "" "") - (call (match_operand:QI 1 "indirect_operand" "") - (match_operand:SI 2 "general_operand" "")))] - ;; Operand 2 not used on the i386. - "" - " -{ - rtx addr; - - if (flag_pic) - current_function_uses_pic_offset_table = 1; - - /* With half-pic, force the address into a register. */ - addr = XEXP (operands[1], 0); - if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr)) - XEXP (operands[1], 0) = force_reg (Pmode, addr); - - if (! expander_call_insn_operand (operands[1], QImode)) - operands[1] - = change_address (operands[1], VOIDmode, - copy_to_mode_reg (Pmode, XEXP (operands[1], 0))); -}") - -(define_insn "" - [(set (match_operand 0 "" "=rf") - (call (match_operand:QI 1 "call_insn_operand" "m") - (match_operand:SI 2 "general_operand" "g")))] - ;; Operand 2 not used on the i386. - "" - "* -{ - if (GET_CODE (operands[1]) == MEM - && ! CONSTANT_ADDRESS_P (XEXP (operands[1], 0))) - { - operands[1] = XEXP (operands[1], 0); - output_asm_insn (AS1 (call,%*%1), operands); - } - else - output_asm_insn (AS1 (call,%P1), operands); - - RET; -}") - -(define_insn "" - [(set (match_operand 0 "" "=rf") - (call (mem:QI (match_operand:SI 1 "symbolic_operand" "")) - (match_operand:SI 2 "general_operand" "g")))] - ;; Operand 2 not used on the i386. - "!HALF_PIC_P ()" - "call %P1") - -;; Call subroutine returning any type. - -(define_expand "untyped_call" - [(parallel [(call (match_operand 0 "" "") - (const_int 0)) - (match_operand 1 "" "") - (match_operand 2 "" "")])] - "" - " -{ - int i; - - /* In order to give reg-stack an easier job in validating two - coprocessor registers as containing a possible return value, - simply pretend the untyped call returns a complex long double - value. */ - - emit_call_insn (TARGET_80387 - ? gen_call_value (gen_rtx_REG (XCmode, FIRST_FLOAT_REG), - operands[0], const0_rtx) - : gen_call (operands[0], const0_rtx)); - - for (i = 0; i < XVECLEN (operands[2], 0); i++) - { - rtx set = XVECEXP (operands[2], 0, i); - emit_move_insn (SET_DEST (set), SET_SRC (set)); - } - - /* The optimizer does not know that the call sets the function value - registers we stored in the result block. We avoid problems by - claiming that all hard registers are used and clobbered at this - point. */ - emit_insn (gen_blockage ()); - - DONE; -}") - -;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and -;; all of memory. This blocks insns from being moved across this point. - -(define_insn "blockage" - [(unspec_volatile [(const_int 0)] 0)] - "" - "" - [(set_attr "memory" "none")]) - -;; Insn emitted into the body of a function to return from a function. -;; This is only done if the function's epilogue is known to be simple. -;; See comments for simple_386_epilogue in i386.c. - -(define_expand "return" - [(return)] - "ix86_can_use_return_insn_p ()" - "") - -(define_insn "return_internal" - [(return)] - "reload_completed" - "ret" - [(set_attr "memory" "none")]) - -(define_insn "return_pop_internal" - [(return) - (use (match_operand:SI 0 "const_int_operand" ""))] - "reload_completed" - "ret %0" - [(set_attr "memory" "none")]) - -(define_insn "nop" - [(const_int 0)] - "" - "nop" - [(set_attr "memory" "none")]) - -(define_expand "prologue" - [(const_int 1)] - "" - " -{ - ix86_expand_prologue (); - DONE; -}") - -;; The use of UNSPEC here is currently not necessary - a simple SET of ebp -;; to itself would be enough. But this way we are safe even if some optimizer -;; becomes too clever in the future. -(define_insn "prologue_set_stack_ptr" - [(set (reg:SI 7) - (minus:SI (reg:SI 7) (match_operand:SI 0 "immediate_operand" "i"))) - (set (reg:SI 6) (unspec:SI [(reg:SI 6)] 4))] - "" - "* -{ - rtx xops [2]; - - xops[0] = operands[0]; - xops[1] = stack_pointer_rtx; - output_asm_insn (AS2 (sub%L1,%0,%1), xops); - RET; -}" - [(set_attr "memory" "none")]) - -(define_insn "prologue_set_got" - [(set (match_operand:SI 0 "" "") - (unspec_volatile - [(plus:SI (match_dup 0) - (plus:SI (match_operand:SI 1 "symbolic_operand" "") - (minus:SI (pc) (match_operand 2 "" ""))))] 1))] - "" - "* -{ - char buffer[64]; - - if (TARGET_DEEP_BRANCH_PREDICTION) - { - sprintf (buffer, \"addl %s,%%0\", XSTR (operands[1], 0)); - output_asm_insn (buffer, operands); - } - else - { - sprintf (buffer, \"addl %s+[.-%%X2],%%0\", XSTR (operands[1], 0)); - output_asm_insn (buffer, operands); - } - RET; -}") - -(define_insn "prologue_get_pc" - [(set (match_operand:SI 0 "" "") - (unspec_volatile [(plus:SI (pc) (match_operand 1 "" ""))] 2))] - "" - "* -{ - output_asm_insn (AS1 (call,%X1), operands); - if (! TARGET_DEEP_BRANCH_PREDICTION) - { - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[1])); - } - RET; -}" - [(set_attr "memory" "none")]) - -(define_insn "prologue_get_pc_and_set_got" - [(unspec_volatile [(match_operand:SI 0 "" "")] 3)] - "" - "* -{ - operands[1] = gen_label_rtx (); - output_asm_insn (AS1 (call,%X1), operands); - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", - CODE_LABEL_NUMBER (operands[1])); - output_asm_insn (AS1 (pop%L0,%0), operands); - output_asm_insn (\"addl $%__GLOBAL_OFFSET_TABLE_+[.-%X1],%0\", operands); - RET; -}" - [(set_attr "memory" "none")]) - -(define_expand "epilogue" - [(const_int 1)] - "" - " -{ - ix86_expand_epilogue (); - DONE; -}") - -(define_insn "epilogue_set_stack_ptr" - [(set (reg:SI 7) (reg:SI 6)) - (clobber (reg:SI 6))] - "" - "* -{ - rtx xops [2]; - - xops[0] = frame_pointer_rtx; - xops[1] = stack_pointer_rtx; - output_asm_insn (AS2 (mov%L0,%0,%1), xops); - RET; -}" - [(set_attr "memory" "none")]) - -(define_insn "leave" - [(const_int 2) - (clobber (reg:SI 6)) - (clobber (reg:SI 7))] - "" - "leave" - [(set_attr "memory" "none")]) - -(define_insn "pop" - [(set (match_operand:SI 0 "register_operand" "r") - (mem:SI (reg:SI 7))) - (set (reg:SI 7) (plus:SI (reg:SI 7) (const_int 4)))] - "" - "* -{ - output_asm_insn (AS1 (pop%L0,%P0), operands); - RET; -}" - [(set_attr "memory" "load")]) - -(define_expand "movstrsi" - [(parallel [(set (match_operand:BLK 0 "memory_operand" "") - (match_operand:BLK 1 "memory_operand" "")) - (use (match_operand:SI 2 "const_int_operand" "")) - (use (match_operand:SI 3 "const_int_operand" "")) - (clobber (match_scratch:SI 4 "")) - (clobber (match_dup 5)) - (clobber (match_dup 6))])] - "" - " -{ - rtx addr0, addr1; - - if (GET_CODE (operands[2]) != CONST_INT) - FAIL; - - addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0)); - addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0)); - - operands[5] = addr0; - operands[6] = addr1; - - operands[0] = change_address (operands[0], VOIDmode, addr0); - operands[1] = change_address (operands[1], VOIDmode, addr1); -}") - -;; It might seem that operands 0 & 1 could use predicate register_operand. -;; But strength reduction might offset the MEM expression. So we let -;; reload put the address into %edi & %esi. - -(define_insn "" - [(set (mem:BLK (match_operand:SI 0 "address_operand" "D")) - (mem:BLK (match_operand:SI 1 "address_operand" "S"))) - (use (match_operand:SI 2 "const_int_operand" "n")) - (use (match_operand:SI 3 "immediate_operand" "i")) - (clobber (match_scratch:SI 4 "=&c")) - (clobber (match_dup 0)) - (clobber (match_dup 1))] - "" - "* -{ - rtx xops[2]; - - output_asm_insn (\"cld\", operands); - if (GET_CODE (operands[2]) == CONST_INT) - { - if (INTVAL (operands[2]) & ~0x03) - { - xops[0] = GEN_INT ((INTVAL (operands[2]) >> 2) & 0x3fffffff); - xops[1] = operands[4]; - - output_asm_insn (AS2 (mov%L1,%0,%1), xops); -#ifdef INTEL_SYNTAX - output_asm_insn (\"rep movsd\", xops); -#else - output_asm_insn (\"rep\;movsl\", xops); -#endif - } - if (INTVAL (operands[2]) & 0x02) - output_asm_insn (\"movsw\", operands); - if (INTVAL (operands[2]) & 0x01) - output_asm_insn (\"movsb\", operands); - } - else - abort (); - RET; -}") - -(define_expand "clrstrsi" - [(set (match_dup 3) (const_int 0)) - (parallel [(set (match_operand:BLK 0 "memory_operand" "") - (const_int 0)) - (use (match_operand:SI 1 "const_int_operand" "")) - (use (match_operand:SI 2 "const_int_operand" "")) - (use (match_dup 3)) - (clobber (match_scratch:SI 4 "")) - (clobber (match_dup 5))])] - "" - " -{ - rtx addr0; - - if (GET_CODE (operands[1]) != CONST_INT) - FAIL; - - addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0)); - - operands[3] = gen_reg_rtx (SImode); - operands[5] = addr0; - - operands[0] = gen_rtx_MEM (BLKmode, addr0); -}") - -;; It might seem that operand 0 could use predicate register_operand. -;; But strength reduction might offset the MEM expression. So we let -;; reload put the address into %edi. - -(define_insn "*bzero" - [(set (mem:BLK (match_operand:SI 0 "address_operand" "D")) - (const_int 0)) - (use (match_operand:SI 1 "const_int_operand" "n")) - (use (match_operand:SI 2 "immediate_operand" "i")) - (use (match_operand:SI 3 "register_operand" "a")) - (clobber (match_scratch:SI 4 "=&c")) - (clobber (match_dup 0))] - "" - "* -{ - rtx xops[2]; - - output_asm_insn (\"cld\", operands); - if (GET_CODE (operands[1]) == CONST_INT) - { - unsigned int count = INTVAL (operands[1]) & 0xffffffff; - if (count & ~0x03) - { - xops[0] = GEN_INT (count / 4); - xops[1] = operands[4]; - - /* K6: stos takes 1 cycle, rep stos takes 8 + %ecx cycles. - 80386: 4/5+5n (+2 for set of ecx) - 80486: 5/7+5n (+1 for set of ecx) - */ - if (count / 4 < ((int) ix86_cpu < (int)PROCESSOR_PENTIUM ? 4 : 6)) - { - do -#ifdef INTEL_SYNTAX - output_asm_insn (\"stosd\", xops); -#else - output_asm_insn (\"stosl\", xops); -#endif - while ((count -= 4) > 3); - } - else - { - output_asm_insn (AS2 (mov%L1,%0,%1), xops); -#ifdef INTEL_SYNTAX - output_asm_insn (\"rep stosd\", xops); -#else - output_asm_insn (\"rep\;stosl\", xops); -#endif - } - } - if (INTVAL (operands[1]) & 0x02) - output_asm_insn (\"stosw\", operands); - if (INTVAL (operands[1]) & 0x01) - output_asm_insn (\"stosb\", operands); - } - else - abort (); - RET; -}") - -(define_expand "cmpstrsi" - [(parallel [(set (match_operand:SI 0 "general_operand" "") - (compare:SI (match_operand:BLK 1 "general_operand" "") - (match_operand:BLK 2 "general_operand" ""))) - (use (match_operand:SI 3 "general_operand" "")) - (use (match_operand:SI 4 "immediate_operand" "")) - (clobber (match_dup 5)) - (clobber (match_dup 6)) - (clobber (match_dup 3))])] - "" - " -{ - rtx addr1, addr2; - - addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0)); - addr2 = copy_to_mode_reg (Pmode, XEXP (operands[2], 0)); - operands[3] = copy_to_mode_reg (SImode, operands[3]); - - operands[5] = addr1; - operands[6] = addr2; - - operands[1] = gen_rtx_MEM (BLKmode, addr1); - operands[2] = gen_rtx_MEM (BLKmode, addr2); - -}") - -;; memcmp recognizers. The `cmpsb' opcode does nothing if the count is -;; zero. Emit extra code to make sure that a zero-length compare is EQ. - -;; It might seem that operands 0 & 1 could use predicate register_operand. -;; But strength reduction might offset the MEM expression. So we let -;; reload put the address into %edi & %esi. - -;; ??? Most comparisons have a constant length, and it's therefore -;; possible to know that the length is non-zero, and to avoid the extra -;; code to handle zero-length compares. - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=&r") - (compare:SI (mem:BLK (match_operand:SI 1 "address_operand" "S")) - (mem:BLK (match_operand:SI 2 "address_operand" "D")))) - (use (match_operand:SI 3 "register_operand" "c")) - (use (match_operand:SI 4 "immediate_operand" "i")) - (clobber (match_dup 1)) - (clobber (match_dup 2)) - (clobber (match_dup 3))] - "" - "* -{ - rtx xops[2], label; - - label = gen_label_rtx (); - - output_asm_insn (\"cld\", operands); - output_asm_insn (AS2 (xor%L0,%0,%0), operands); - output_asm_insn (\"repz\;cmps%B2\", operands); - output_asm_insn (\"je %l0\", &label); - - xops[0] = operands[0]; - xops[1] = const1_rtx; - output_asm_insn (AS2 (sbb%L0,%0,%0), xops); - if (QI_REG_P (xops[0])) - output_asm_insn (AS2 (or%B0,%1,%b0), xops); - else - output_asm_insn (AS2 (or%L0,%1,%0), xops); - - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (label)); - RET; -}") - -(define_insn "" - [(set (cc0) - (compare:SI (mem:BLK (match_operand:SI 0 "address_operand" "S")) - (mem:BLK (match_operand:SI 1 "address_operand" "D")))) - (use (match_operand:SI 2 "register_operand" "c")) - (use (match_operand:SI 3 "immediate_operand" "i")) - (clobber (match_dup 0)) - (clobber (match_dup 1)) - (clobber (match_dup 2))] - "" - "* -{ - rtx xops[2]; - - cc_status.flags |= CC_NOT_SIGNED; - - xops[0] = gen_rtx_REG (QImode, 0); - xops[1] = CONST0_RTX (QImode); - - output_asm_insn (\"cld\", operands); - output_asm_insn (AS2 (test%B0,%1,%0), xops); - return \"repz\;cmps%B2\"; -}") - - -;; Note, you cannot optimize away the branch following the bsfl by assuming -;; that the destination is not modified if the input is 0, since not all -;; x86 implementations do this. - -(define_expand "ffssi2" - [(set (match_operand:SI 0 "general_operand" "") - (ffs:SI (match_operand:SI 1 "general_operand" "")))] - "" - " -{ - rtx label = gen_label_rtx (), temp = gen_reg_rtx (SImode); - - emit_insn (gen_ffssi_1 (temp, operands[1])); - emit_cmp_insn (operands[1], const0_rtx, NE, NULL_RTX, SImode, 0, 0); - emit_jump_insn (gen_bne (label)); - emit_move_insn (temp, constm1_rtx); - emit_label (label); - temp = expand_binop (SImode, add_optab, temp, const1_rtx, - operands[0], 0, OPTAB_WIDEN); - - if (temp != operands[0]) - emit_move_insn (operands[0], temp); - DONE; -}") - -(define_insn "ffssi_1" - [(set (match_operand:SI 0 "register_operand" "=r") - (unspec:SI [(match_operand:SI 1 "nonimmediate_operand" "rm")] 5))] - "" - "* return AS2 (bsf%L0,%1,%0);") - -(define_expand "ffshi2" - [(set (match_operand:SI 0 "general_operand" "") - (ffs:HI (match_operand:HI 1 "general_operand" "")))] - "" - " -{ - rtx label = gen_label_rtx (), temp = gen_reg_rtx (HImode); - - emit_insn (gen_ffshi_1 (temp, operands[1])); - emit_cmp_insn (operands[1], const0_rtx, NE, NULL_RTX, HImode, 0, 0); - emit_jump_insn (gen_bne (label)); - emit_move_insn (temp, constm1_rtx); - emit_label (label); - temp = expand_binop (HImode, add_optab, temp, const1_rtx, - operands[0], 0, OPTAB_WIDEN); - - if (temp != operands[0]) - emit_move_insn (operands[0], temp); - DONE; -}") - -(define_insn "ffshi_1" - [(set (match_operand:HI 0 "register_operand" "=r") - (unspec:HI [(match_operand:SI 1 "nonimmediate_operand" "rm")] 5))] - "" - "* return AS2 (bsf%W0,%1,%0);") - -;; These patterns match the binary 387 instructions for addM3, subM3, -;; mulM3 and divM3. There are three patterns for each of DFmode and -;; SFmode. The first is the normal insn, the second the same insn but -;; with one operand a conversion, and the third the same insn but with -;; the other operand a conversion. - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (match_operator:DF 3 "binary_387_op" - [(match_operand:DF 1 "nonimmediate_operand" "0,fm") - (match_operand:DF 2 "nonimmediate_operand" "fm,0")]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:DF 3 "is_mul" "") - (const_string "fpmul") - (match_operand:DF 3 "is_div" "") - (const_string "fpdiv") - ] - (const_string "fpop") - ) - )]) - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f,f") - (match_operator:XF 3 "binary_387_op" - [(match_operand:XF 1 "register_operand" "0,f") - (match_operand:XF 2 "register_operand" "f,0")]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:DF 3 "is_mul" "") - (const_string "fpmul") - (match_operand:DF 3 "is_div" "") - (const_string "fpdiv") - ] - (const_string "fpop") - ) - )]) - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f,f") - (match_operator:XF 3 "binary_387_op" - [(float_extend:XF (match_operand:SF 1 "nonimmediate_operand" "fm,0")) - (match_operand:XF 2 "register_operand" "0,f")]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:DF 3 "is_mul" "") - (const_string "fpmul") - (match_operand:DF 3 "is_div" "") - (const_string "fpdiv") - ] - (const_string "fpop") - ) - )]) - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f,f") - (match_operator:XF 3 "binary_387_op" - [(match_operand:XF 1 "register_operand" "0,f") - (float_extend:XF - (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:DF 3 "is_mul" "") - (const_string "fpmul") - (match_operand:DF 3 "is_div" "") - (const_string "fpdiv") - ] - (const_string "fpop") - ) - )]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (match_operator:DF 3 "binary_387_op" - [(float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "fm,0")) - (match_operand:DF 2 "register_operand" "0,f")]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:DF 3 "is_mul" "") - (const_string "fpmul") - (match_operand:DF 3 "is_div" "") - (const_string "fpdiv") - ] - (const_string "fpop") - ) - )]) - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (match_operator:DF 3 "binary_387_op" - [(match_operand:DF 1 "register_operand" "0,f") - (float_extend:DF - (match_operand:SF 2 "nonimmediate_operand" "fm,0"))]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:DF 3 "is_mul" "") - (const_string "fpmul") - (match_operand:DF 3 "is_div" "") - (const_string "fpdiv") - ] - (const_string "fpop") - ) - )]) - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f,f") - (match_operator:SF 3 "binary_387_op" - [(match_operand:SF 1 "nonimmediate_operand" "0,fm") - (match_operand:SF 2 "nonimmediate_operand" "fm,0")]))] - "TARGET_80387" - "* return output_387_binary_op (insn, operands);" - [(set (attr "type") - (cond [(match_operand:DF 3 "is_mul" "") - (const_string "fpmul") - (match_operand:DF 3 "is_div" "") - (const_string "fpdiv") - ] - (const_string "fpop") - ) - )]) - -(define_expand "strlensi" - [(parallel [(set (match_dup 4) - (unspec:SI [(mem:BLK (match_operand:BLK 1 "general_operand" "")) - (match_operand:QI 2 "immediate_operand" "") - (match_operand:SI 3 "immediate_operand" "")] 0)) - (clobber (match_dup 1))]) - (set (match_dup 5) - (not:SI (match_dup 4))) - (set (match_operand:SI 0 "register_operand" "") - (plus:SI (match_dup 5) - (const_int -1)))] - "" - " -{ - if (TARGET_UNROLL_STRLEN && operands[2] == const0_rtx && optimize > 1) - { - rtx address; - rtx scratch; - - /* well it seems that some optimizer does not combine a call like - foo(strlen(bar), strlen(bar)); - when the move and the subtraction is done here. It does calculate - the length just once when these instructions are done inside of - output_strlen_unroll(). But I think since &bar[strlen(bar)] is - often used and I use one fewer register for the lifetime of - output_strlen_unroll() this is better. */ - scratch = gen_reg_rtx (SImode); - address = force_reg (SImode, XEXP (operands[1], 0)); - - /* move address to scratch-register - this is done here because the i586 can do the following and - in the same cycle with the following move. */ - if (GET_CODE (operands[3]) != CONST_INT || INTVAL (operands[3]) < 4) - emit_insn (gen_movsi (scratch, address)); - - emit_insn (gen_movsi (operands[0], address)); - - if(TARGET_USE_Q_REG) - emit_insn (gen_strlensi_unroll5 (operands[0], - operands[3], - scratch, - operands[0])); - else - emit_insn (gen_strlensi_unroll4 (operands[0], - operands[3], - scratch, - operands[0])); - - /* gen_strlensi_unroll[45] returns the address of the zero - at the end of the string, like memchr(), so compute the - length by subtracting the startaddress. */ - emit_insn (gen_subsi3 (operands[0], operands[0], address)); - DONE; - } - - operands[1] = copy_to_mode_reg (SImode, XEXP (operands[1], 0)); - operands[4] = gen_reg_rtx (SImode); - operands[5] = gen_reg_rtx (SImode); -}") - -;; It might seem that operands 0 & 1 could use predicate register_operand. -;; But strength reduction might offset the MEM expression. So we let -;; reload put the address into %edi. - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=&c") - (unspec:SI [(mem:BLK (match_operand:SI 1 "address_operand" "D")) - (match_operand:QI 2 "immediate_operand" "a") - (match_operand:SI 3 "immediate_operand" "i")] 0)) - (clobber (match_dup 1))] - "" - "* -{ - rtx xops[2]; - - xops[0] = operands[0]; - xops[1] = constm1_rtx; - output_asm_insn (\"cld\", operands); - output_asm_insn (AS2 (mov%L0,%1,%0), xops); - return \"repnz\;scas%B2\"; -}") - -/* Conditional move define_insns. */ - -(define_expand "movsicc" - [(set (match_operand:SI 0 "register_operand" "") - (if_then_else:SI (match_operand 1 "comparison_operator" "") - (match_operand:SI 2 "nonimmediate_operand" "") - (match_operand:SI 3 "nonimmediate_operand" "")))] - "TARGET_CMOVE" - " -{ - if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) - FAIL; - - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), - GET_MODE (i386_compare_op0), - i386_compare_op0, i386_compare_op1); -}") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r,r,r,r") - (if_then_else:SI (match_operator 1 "comparison_operator" - [(match_operand:QI 2 "nonimmediate_operand" "q,m,q,m") - (match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn")]) - (match_operand:SI 4 "nonimmediate_operand" "rm,rm,0,0") - (match_operand:SI 5 "nonimmediate_operand" "0,0,rm,rm")))] - "TARGET_CMOVE" - "#") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r,r,r,r") - (if_then_else:SI (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "r,m,r,m") - (match_operand 3 "general_operand" "rmi,ri,rmi,ri")]) - (match_operand:SI 4 "nonimmediate_operand" "rm,rm,0,0") - (match_operand:SI 5 "nonimmediate_operand" "0,0,rm,rm")))] - "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT" - "#") - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (if_then_else:SI (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (const_int 0)]) - (match_operand:SI 3 "nonimmediate_operand" "") - (match_operand:SI 4 "nonimmediate_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) - (match_dup 2)) - (set (match_dup 0) - (if_then_else:SI (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 3) (match_dup 4)))] - "") - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (if_then_else:SI (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (match_operand 3 "general_operand" "")]) - (match_operand:SI 4 "nonimmediate_operand" "") - (match_operand:SI 5 "nonimmediate_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) (compare (match_dup 2) (match_dup 3))) - (set (match_dup 0) - (if_then_else:SI (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 4) (match_dup 5)))] - "") - -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (if_then_else:SI (match_operator 1 "comparison_operator" - [(cc0) (const_int 0)]) - (match_operand:SI 2 "nonimmediate_operand" "rm,0") - (match_operand:SI 3 "nonimmediate_operand" "0,rm")))] - "TARGET_CMOVE && reload_completed" - "* return output_int_conditional_move (which_alternative, operands);") - -(define_expand "movhicc" - [(set (match_operand:HI 0 "register_operand" "") - (if_then_else:HI (match_operand 1 "comparison_operator" "") - (match_operand:HI 2 "nonimmediate_operand" "") - (match_operand:HI 3 "nonimmediate_operand" "")))] - "TARGET_CMOVE" - " -{ - if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) - FAIL; - - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), - GET_MODE (i386_compare_op0), - i386_compare_op0, i386_compare_op1); -}") - -(define_insn "" - [(set (match_operand:HI 0 "register_operand" "=r,r,r,r") - (if_then_else:HI (match_operator 1 "comparison_operator" - [(match_operand:QI 2 "nonimmediate_operand" "q,m,q,m") - (match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn")]) - (match_operand:HI 4 "nonimmediate_operand" "rm,rm,0,0") - (match_operand:HI 5 "nonimmediate_operand" "0,0,rm,rm")))] - "TARGET_CMOVE" - "#") - -(define_insn "" - [(set (match_operand:HI 0 "register_operand" "=r,r,r,r") - (if_then_else:HI (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "r,m,r,m") - (match_operand 3 "general_operand" "rmi,ri,rmi,ri")]) - (match_operand:HI 4 "nonimmediate_operand" "rm,rm,0,0") - (match_operand:HI 5 "nonimmediate_operand" "0,0,rm,rm")))] - "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT" - "#") - -(define_split - [(set (match_operand:HI 0 "register_operand" "") - (if_then_else:HI (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (const_int 0)]) - (match_operand:HI 3 "nonimmediate_operand" "") - (match_operand:HI 4 "nonimmediate_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) - (match_dup 2)) - (set (match_dup 0) - (if_then_else:HI (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 3) (match_dup 4)))] - "") - -(define_split - [(set (match_operand:HI 0 "register_operand" "") - (if_then_else:HI (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (match_operand 3 "general_operand" "")]) - (match_operand:HI 4 "nonimmediate_operand" "") - (match_operand:HI 5 "nonimmediate_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) - (compare (match_dup 2) (match_dup 3))) - (set (match_dup 0) - (if_then_else:HI (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 4) (match_dup 5)))] - "") - -(define_insn "" - [(set (match_operand:HI 0 "register_operand" "=r,r") - (if_then_else:HI (match_operator 1 "comparison_operator" - [(cc0) (const_int 0)]) - (match_operand:HI 2 "nonimmediate_operand" "rm,0") - (match_operand:HI 3 "nonimmediate_operand" "0,rm")))] - "TARGET_CMOVE && reload_completed" - "* return output_int_conditional_move (which_alternative, operands);") - -(define_expand "movsfcc" - [(set (match_operand:SF 0 "register_operand" "") - (if_then_else:SF (match_operand 1 "comparison_operator" "") - (match_operand:SF 2 "register_operand" "") - (match_operand:SF 3 "register_operand" "")))] - "TARGET_CMOVE" - " -{ - rtx temp; - - if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) - FAIL; - - /* The floating point conditional move instructions don't directly - support conditions resulting from a signed integer comparison. */ - - switch (GET_CODE (operands[1])) - { - case LT: - case LE: - case GE: - case GT: - temp = emit_store_flag (gen_reg_rtx (QImode), - GET_CODE (operands[1]), i386_compare_op0, i386_compare_op1, - VOIDmode, 0, 0); - - if (!temp) - FAIL; - - operands[1] = gen_rtx_fmt_ee (NE, QImode, temp, const0_rtx); - break; - - default: - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), - GET_MODE (i386_compare_op0), - i386_compare_op0, i386_compare_op1); - break; - } -}") - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f,f,f,f") - (if_then_else:SF (match_operator 1 "comparison_operator" - [(match_operand:QI 2 "nonimmediate_operand" "q,m,q,m") - (match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn")]) - (match_operand:SF 4 "register_operand" "f,f,0,0") - (match_operand:SF 5 "register_operand" "0,0,f,f")))] - "TARGET_CMOVE - && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE - && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" - "#") - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f,f,f,f") - (if_then_else:SF (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "r,m,r,m") - (match_operand 3 "general_operand" "rmi,ri,rmi,ri")]) - (match_operand:SF 4 "register_operand" "f,f,0,0") - (match_operand:SF 5 "register_operand" "0,0,f,f")))] - "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT - && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE - && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" - "#") - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (if_then_else:SF (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (const_int 0)]) - (match_operand:SF 3 "register_operand" "") - (match_operand:SF 4 "register_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) - (match_dup 2)) - (set (match_dup 0) - (if_then_else:SF (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 3) (match_dup 4)))] - "") - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (if_then_else:SF (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (match_operand 3 "general_operand" "")]) - (match_operand:SF 4 "register_operand" "") - (match_operand:SF 5 "register_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) (compare (match_dup 2) (match_dup 3))) - (set (match_dup 0) - (if_then_else:SF (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 4) (match_dup 5)))] - "") - -(define_insn "" - [(set (match_operand:SF 0 "register_operand" "=f,f") - (if_then_else:SF (match_operator 1 "comparison_operator" - [(cc0) (const_int 0)]) - (match_operand:SF 2 "register_operand" "f,0") - (match_operand:SF 3 "register_operand" "0,f")))] - "TARGET_CMOVE && reload_completed" - "* return output_fp_conditional_move (which_alternative, operands);") - -(define_expand "movdfcc" - [(set (match_operand:DF 0 "register_operand" "") - (if_then_else:DF (match_operand 1 "comparison_operator" "") - (match_operand:DF 2 "register_operand" "") - (match_operand:DF 3 "register_operand" "")))] - "TARGET_CMOVE" - " -{ - rtx temp; - - if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) - FAIL; - - /* The floating point conditional move instructions don't directly - support conditions resulting from a signed integer comparison. */ - - switch (GET_CODE (operands[1])) - { - case LT: - case LE: - case GE: - case GT: - temp = emit_store_flag (gen_reg_rtx (QImode), - GET_CODE (operands[1]), i386_compare_op0, i386_compare_op1, - VOIDmode, 0, 0); - - if (!temp) - FAIL; - - operands[1] = gen_rtx_fmt_ee (NE, QImode, temp, const0_rtx); - break; - - default: - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), - GET_MODE (i386_compare_op0), - i386_compare_op0, i386_compare_op1); - break; - } -}") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f,f,f") - (if_then_else:DF (match_operator 1 "comparison_operator" - [(match_operand:QI 2 "nonimmediate_operand" "q,m,q,m") - (match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn")]) - (match_operand:DF 4 "register_operand" "f,f,0,0") - (match_operand:DF 5 "register_operand" "0,0,f,f")))] - "TARGET_CMOVE - && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE - && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" - "#") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f,f,f") - (if_then_else:DF (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "r,m,r,m") - (match_operand 3 "general_operand" "rmi,ri,rmi,ri")]) - (match_operand:DF 4 "register_operand" "f,f,0,0") - (match_operand:DF 5 "register_operand" "0,0,f,f")))] - "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT - && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE - && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" - "#") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (if_then_else:DF (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (const_int 0)]) - (match_operand:DF 3 "register_operand" "") - (match_operand:DF 4 "register_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) - (match_dup 2)) - (set (match_dup 0) - (if_then_else:DF (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 3) (match_dup 4)))] - "") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (if_then_else:DF (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (match_operand 3 "general_operand" "")]) - (match_operand:DF 4 "register_operand" "") - (match_operand:DF 5 "register_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) (compare (match_dup 2) (match_dup 3))) - (set (match_dup 0) - (if_then_else:DF (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 4) (match_dup 5)))] - "") - -(define_insn "" - [(set (match_operand:DF 0 "register_operand" "=f,f") - (if_then_else:DF (match_operator 1 "comparison_operator" - [(cc0) (const_int 0)]) - (match_operand:DF 2 "register_operand" "f,0") - (match_operand:DF 3 "register_operand" "0,f")))] - "TARGET_CMOVE && reload_completed" - "* return output_fp_conditional_move (which_alternative, operands);") - -(define_expand "movxfcc" - [(set (match_operand:XF 0 "register_operand" "") - (if_then_else:XF (match_operand 1 "comparison_operator" "") - (match_operand:XF 2 "register_operand" "") - (match_operand:XF 3 "register_operand" "")))] - "TARGET_CMOVE" - " -{ - rtx temp; - - if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) - FAIL; - - /* The floating point conditional move instructions don't directly - support conditions resulting from a signed integer comparison. */ - - switch (GET_CODE (operands[1])) - { - case LT: - case LE: - case GE: - case GT: - temp = emit_store_flag (gen_reg_rtx (QImode), - GET_CODE (operands[1]), i386_compare_op0, i386_compare_op1, - VOIDmode, 0, 0); - - if (!temp) - FAIL; - - operands[1] = gen_rtx_fmt_ee (NE, QImode, temp, const0_rtx); - break; - - default: - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), - GET_MODE (i386_compare_op0), - i386_compare_op0, i386_compare_op1); - break; - } -}") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f,f,f,f") - (if_then_else:XF (match_operator 1 "comparison_operator" - [(match_operand:QI 2 "nonimmediate_operand" "q,m,q,m") - (match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn")]) - (match_operand:XF 4 "register_operand" "f,f,0,0") - (match_operand:XF 5 "register_operand" "0,0,f,f")))] - "TARGET_CMOVE - && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE - && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" - "#") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f,f,f,f") - (if_then_else:XF (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "r,m,r,m") - (match_operand 3 "general_operand" "rmi,ri,rmi,ri")]) - (match_operand:XF 4 "register_operand" "f,f,0,0") - (match_operand:XF 5 "register_operand" "0,0,f,f")))] - "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT - && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE - && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT" - "#") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (if_then_else:XF (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (const_int 0)]) - (match_operand:XF 3 "register_operand" "") - (match_operand:XF 4 "register_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) - (match_dup 2)) - (set (match_dup 0) - (if_then_else:XF (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 3) (match_dup 4)))] - "") - -(define_split - [(set (match_operand:XF 0 "register_operand" "") - (if_then_else:XF (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (match_operand 3 "general_operand" "")]) - (match_operand:XF 4 "register_operand" "") - (match_operand:XF 5 "register_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) (compare (match_dup 2) (match_dup 3))) - (set (match_dup 0) - (if_then_else:XF (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 4) (match_dup 5)))] - "") - -(define_insn "" - [(set (match_operand:XF 0 "register_operand" "=f,f") - (if_then_else:XF (match_operator 1 "comparison_operator" - [(cc0) (const_int 0)]) - (match_operand:XF 2 "register_operand" "f,0") - (match_operand:XF 3 "register_operand" "0,f")))] - "TARGET_CMOVE && reload_completed" - "* return output_fp_conditional_move (which_alternative, operands);") - -(define_expand "movdicc" - [(set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (match_operand 1 "comparison_operator" "") - (match_operand:DI 2 "nonimmediate_operand" "") - (match_operand:DI 3 "nonimmediate_operand" "")))] - "TARGET_CMOVE" - " -{ - if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT) - FAIL; - - operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]), - GET_MODE (i386_compare_op0), - i386_compare_op0, i386_compare_op1); -}") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=&r,&r,&r,&r") - (if_then_else:DI (match_operator 1 "comparison_operator" - [(match_operand:QI 2 "nonimmediate_operand" "q,m,q,m") - (match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn")]) - (match_operand:DI 4 "nonimmediate_operand" "ro,ro,0,0") - (match_operand:DI 5 "nonimmediate_operand" "0,0,ro,ro")))] - "TARGET_CMOVE" - "#") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=&r,&r,&r,&r") - (if_then_else:DI (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "r,m,r,m") - (match_operand 3 "general_operand" "rmi,ri,rmi,ri")]) - (match_operand:DI 4 "nonimmediate_operand" "ro,ro,0,0") - (match_operand:DI 5 "nonimmediate_operand" "0,0,ro,ro")))] - "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT" - "#") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (const_int 0)]) - (match_operand:DI 3 "nonimmediate_operand" "") - (match_operand:DI 4 "nonimmediate_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) - (match_dup 2)) - (set (match_dup 5) - (if_then_else:SI (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 7) (match_dup 9))) - (set (match_dup 6) - (if_then_else:SI (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 8) (match_dup 10)))] - "split_di (&operands[0], 1, &operands[5], &operands[6]); - split_di (&operands[3], 1, &operands[7], &operands[8]); - split_di (&operands[4], 1, &operands[9], &operands[10]);") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (match_operator 1 "comparison_operator" - [(match_operand 2 "nonimmediate_operand" "") - (match_operand 3 "general_operand" "")]) - (match_operand:DI 4 "nonimmediate_operand" "") - (match_operand:DI 5 "nonimmediate_operand" "")))] - "TARGET_CMOVE && reload_completed" - [(set (cc0) (compare (match_dup 2) (match_dup 3))) - (set (match_dup 6) - (if_then_else:SI (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 8) (match_dup 10))) - (set (match_dup 7) - (if_then_else:SI (match_op_dup 1 [(cc0) (const_int 0)]) - (match_dup 9) (match_dup 11)))] - "split_di (&operands[0], 1, &operands[6], &operands[7]); - split_di (&operands[4], 1, &operands[8], &operands[9]); - split_di (&operands[5], 1, &operands[10], &operands[11]);") - -(define_insn "strlensi_unroll" - [(set (match_operand:SI 0 "register_operand" "=&r,&r") - (unspec:SI [(mem:BLK (match_operand:SI 1 "address_operand" "r,r")) - (match_operand:SI 2 "immediate_operand" "i,i")] 0)) - (clobber (match_scratch:SI 3 "=&q,&r"))] - "optimize > 1" - "* return output_strlen_unroll (operands);") - -;; the only difference between the following patterns is the register preference -;; on a pentium using a q-register saves one clock cycle per 4 characters - -(define_insn "strlensi_unroll4" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (unspec:SI [(mem:BLK (match_operand:SI 3 "register_operand" "0,0")) - (match_operand:SI 1 "immediate_operand" "i,i") - (match_operand:SI 2 "register_operand" "+q,!r")] 0)) - (clobber (match_dup 2))] - "(TARGET_USE_ANY_REG && optimize > 1)" - "* return output_strlen_unroll (operands);") - -(define_insn "strlensi_unroll5" - [(set (match_operand:SI 0 "register_operand" "=r") - (unspec:SI [(mem:BLK (match_operand:SI 3 "register_operand" "0")) - (match_operand:SI 1 "immediate_operand" "i") - (match_operand:SI 2 "register_operand" "+q")] 0)) - (clobber (match_dup 2))] - "(TARGET_USE_Q_REG && optimize > 1)" - "* return output_strlen_unroll (operands);" -) - -(define_insn "allocate_stack_worker" - [(unspec:SI [(match_operand:SI 0 "register_operand" "a")] 3) - (set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 0))) - (clobber (match_dup 0))] - "TARGET_STACK_PROBE" - "* return AS1(call,__alloca);" - [(set_attr "memory" "none")]) - -(define_expand "allocate_stack" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (reg:SI 7) (match_operand:SI 1 "general_operand" ""))) - (set (reg:SI 7) (minus:SI (reg:SI 7) (match_dup 1)))] - "TARGET_STACK_PROBE" - " -{ -#ifdef CHECK_STACK_LIMIT - if (GET_CODE (operands[1]) == CONST_INT - && INTVAL (operands[1]) < CHECK_STACK_LIMIT) - emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, - operands[1])); - else -#endif - emit_insn (gen_allocate_stack_worker (copy_to_mode_reg (SImode, - operands[1]))); - - emit_move_insn (operands[0], virtual_stack_dynamic_rtx); - DONE; -}") - -(define_expand "exception_receiver" - [(const_int 0)] - "flag_pic" - " -{ - load_pic_register (1); - DONE; -}") diff --git a/contrib/gcc/config/i386/i386iscgas.h b/contrib/gcc/config/i386/i386iscgas.h deleted file mode 100644 index 526fe374e481..000000000000 --- a/contrib/gcc/config/i386/i386iscgas.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Definitions for Intel 386 running Interactive Unix System V, - producing stabs-in-coff output (using a slightly modified gas). - Specifically, this is for recent versions that support POSIX; - for version 2.0.2, use configuration option i386-sysv instead. */ - -/* Underscores are not used on ISC systems (probably not on any COFF - system), despite the comments in i386/gas.h. If this is not defined, - enquire (for example) will fail to link. --karl@cs.umb.edu */ -#define NO_UNDERSCORES - -/* Mostly like other gas-using systems. */ -#include "i386/gas.h" - -/* But with ISC-specific additions. */ -#include "i386/isc.h" - -/* We do not want to output SDB debugging information. */ - -#undef SDB_DEBUGGING_INFO - -/* We want to output DBX debugging information. */ - -#define DBX_DEBUGGING_INFO - - -/* The function `dbxout_init' in dbxout.c omits the first character of - `ltext_label_name' when outputting the main source directory and main - source filename. I don't understand why, but rather than making a - system-independent change there, I override dbxout.c's defaults. - Perhaps it would be better to use ".Ltext0" instead of - `ltext_label_name', but we've already generated the label, so we just - use it here. --karl@cs.umb.edu */ -#define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(asmfile, cwd) \ - do { fprintf (asmfile, "%s ", ASM_STABS_OP); \ - output_quoted_string (asmfile, cwd); \ - fprintf (asmfile, ",%d,0,0,%s\n", N_SO, ltext_label_name); \ - } while (0) -#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(asmfile, input_file_name) \ - fprintf (asmfile, "%s ", ASM_STABS_OP); \ - output_quoted_string (input_file_name); \ - fprintf (asmfile, ",%d,0,0,%s\n", N_SO, ltext_label_name); \ - text_section (); \ - ASM_OUTPUT_INTERNAL_LABEL (asmfile, "Ltext", 0) - - -/* Because we don't include `svr3.h', we haven't yet defined SIZE_TYPE - and PTRDIFF_TYPE. ISC's definitions don't match GCC's defaults, so: */ - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - - -/* But we can't use crtbegin.o and crtend.o, because gas 1.38.1 doesn't - grok .section. The definitions here are otherwise identical to those - in i386/isc.h. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shlib:%{posix:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\ - %{!posix:%{pg:mcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}\ - %{p:-L/lib/libp} %{pg:-L/lib/libp}}}\ - %{shlib:%{posix:crtp1.o%s}%{!posix:crt1.o%s}}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtn.o%s" diff --git a/contrib/gcc/config/i386/interix.c b/contrib/gcc/config/i386/interix.c deleted file mode 100644 index 40062c70e15e..000000000000 --- a/contrib/gcc/config/i386/interix.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Subroutines for insn-output.c for Windows NT. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "regs.h" -#include "hard-reg-set.h" -#include "output.h" -#include "tree.h" -#include "flags.h" - -/* Return string which is the former assembler name modified with a - suffix consisting of an atsign (@) followed by the number of bytes of - arguments */ - -char * -gen_stdcall_suffix (decl) - tree decl; -{ - int total = 0; - /* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead - of DECL_ASSEMBLER_NAME. */ - char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - char *newsym; - - if (TYPE_ARG_TYPES (TREE_TYPE (decl))) - if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (decl)))) - == void_type_node) - { - tree formal_type = TYPE_ARG_TYPES (TREE_TYPE (decl)); - - while (TREE_VALUE (formal_type) != void_type_node) - { - int parm_size - = TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type))); - /* Must round up to include padding. This is done the same - way as in store_one_arg. */ - parm_size = ((parm_size + PARM_BOUNDARY - 1) - / PARM_BOUNDARY * PARM_BOUNDARY); - total += parm_size; - formal_type = TREE_CHAIN (formal_type); - } - } - - newsym = xmalloc (strlen (asmname) + 10); - sprintf (newsym, "%s@%d", asmname, total/BITS_PER_UNIT); - return IDENTIFIER_POINTER (get_identifier (newsym)); -} - -#if 0 -/* Turn this back on when the linker is updated to handle grouped - .data$ sections correctly. See corresponding note in i386/interix.h. - MK. */ - -/* Cover function for UNIQUE_SECTION. */ - -void -i386_pe_unique_section (decl, reloc) - tree decl; - int reloc; -{ - int len; - char *name,*string,*prefix; - - name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - /* Strip off any encoding in fnname. */ - STRIP_NAME_ENCODING (name, name); - - /* The object is put in, for example, section .text$foo. - The linker will then ultimately place them in .text - (everything from the $ on is stripped). Don't put - read-only data in .rdata section to avoid a PE linker - bug when .rdata$* grouped sections are used in code - without a .rdata section. */ - if (TREE_CODE (decl) == FUNCTION_DECL) - prefix = ".text$"; - else if (DECL_READONLY_SECTION (decl, reloc)) -#ifdef READONLY_DATA_SECTION - prefix = ".rdata$"; -#else - prefix = ".text$"; -#endif - else - prefix = ".data$"; - len = strlen (name) + strlen (prefix); - string = alloca (len + 1); - sprintf (string, "%s%s", prefix, name); - - DECL_SECTION_NAME (decl) = build_string (len, string); -} - -#endif /* 0 */ diff --git a/contrib/gcc/config/i386/isc.h b/contrib/gcc/config/i386/isc.h deleted file mode 100644 index 6c1c4c727180..000000000000 --- a/contrib/gcc/config/i386/isc.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Assembler-independent definitions for an Intel 386 running - Interactive Unix System V. Specifically, this is for recent versions - that support POSIX. */ - -/* Use crt1.o, not crt0.o, as a startup file, and crtn.o as a closing file. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shlib:%{posix:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\ - %{Xp:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\ - %{!posix:%{!Xp:%{pg:mcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}\ - %{p:-L/lib/libp} %{pg:-L/lib/libp}}}}\ - %{shlib:%{Xp:crtp1.o%s}%{posix:crtp1.o%s}%{!posix:%{!Xp:crt1.o%s}}}\ - crtbegin.o%s" - -#define ENDFILE_SPEC "crtend.o%s crtn.o%s" - -/* Library spec */ -#undef LIB_SPEC -#define LIB_SPEC "%{shlib:-lc_s} %{posix:-lcposix} %{Xp:-lcposix} -lc -lg" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{Xp:-D_POSIX_SOURCE}" - -/* ISC 2.2 uses `char' for `wchar_t'. */ -#undef WCHAR_TYPE -#define WCHAR_TYPE "char" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_UNIT - -#if 0 -/* This is apparently not true: ISC versions up to 3.0, at least, use - the standard calling sequence in which the called function pops the - extra arg. */ -/* caller has to pop the extra argument passed to functions that return - structures. */ - -#undef RETURN_POPS_ARGS -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ - ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE ? 0 \ - : (TARGET_RTD \ - && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ - == void_type_node))) ? (SIZE) \ - : 0) -/* On other 386 systems, the last line looks like this: - : (aggregate_value_p (TREE_TYPE (FUNTYPE))) ? GET_MODE_SIZE (Pmode) : 0) */ -#endif - -/* Handle #pragma pack and #pragma weak. */ -#define HANDLE_SYSV_PRAGMA - -/* By default, target has a 80387, uses IEEE compatible arithmetic, - and returns float values in the 387, ie, - (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387) - - ISC's software emulation of a 387 fails to handle the `fucomp' - opcode. fucomp is only used when generating IEEE compliant code. - So don't make TARGET_IEEE_FP default for ISC. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_80387 | MASK_FLOAT_RETURNS) - -/* The ISC 2.0.2 software FPU emulator apparently can't handle - 80-bit XFmode insns, so don't generate them. */ -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 64 - -/* The ISC assembler does not like a .file directive with a name - longer than 14 characters. Truncating it will not permit - debugging to work properly, but at least we won't get an error - message. */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - int len = strlen (main_input_filename); \ - char *na = main_input_filename + len; \ - char shorter[15]; \ - /* NA gets MAIN_INPUT_FILENAME sans directory names. */\ - while (na > main_input_filename) \ - { \ - if (na[-1] == '/') \ - break; \ - na--; \ - } \ - strncpy (shorter, na, 14); \ - shorter[14] = 0; \ - fprintf (FILE, "\t.file\t"); \ - output_quoted_string (FILE, shorter); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* Work around assembler forward label references generated in exception - handling code. */ -#define DWARF2_UNWIND_INFO 0 diff --git a/contrib/gcc/config/i386/isccoff.h b/contrib/gcc/config/i386/isccoff.h deleted file mode 100644 index 595c7d98fe3f..000000000000 --- a/contrib/gcc/config/i386/isccoff.h +++ /dev/null @@ -1,12 +0,0 @@ -/* Definitions for Intel 386 running Interactive Unix System V. - Specifically, this is for recent versions that support POSIX; - for version 2.0.2, use configuration option i386-sysv instead. - (But set TARGET_DEFAULT to (MASK_80307 | MASK_FLOAT_RETURNS) - if you do that, if you don't have a real 80387.) */ - -/* Mostly it's like AT&T Unix System V. */ - -#include "i386/sysv3.h" - -/* But with a few changes. */ -#include "i386/isc.h" diff --git a/contrib/gcc/config/i386/iscdbx.h b/contrib/gcc/config/i386/iscdbx.h deleted file mode 100644 index 6c2d42e470d0..000000000000 --- a/contrib/gcc/config/i386/iscdbx.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Definitions for Intel 386 running Interactive Unix System V, - using dbx-in-coff encapsulation. - Specifically, this is for recent versions that support POSIX. - Copyright (C) 1992, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Mostly it's like AT&T Unix System V with dbx-in-coff. */ - -#include "i386/svr3dbx.h" - -/* But with a few changes. */ -#undef ENDFILE_SPEC -#include "i386/isc.h" - -/* Overridden defines for ifile usage. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!r:%{!z:svr3.ifile%s}%{z:svr3z.ifile%s}}\ - %{!shlib:%{posix:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\ - %{Xp:%{pg:mcrtp1.o%s}%{!pg:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}}\ - %{!posix:%{!Xp:%{pg:mcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\ - %{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp}}\ - %{shlib:%{posix:crtp1.o%s}%{Xp:crtp1.o%s}%{!posix:%{!Xp:crt1.o%s}}}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtn.o%s" diff --git a/contrib/gcc/config/i386/linux-aout.h b/contrib/gcc/config/i386/linux-aout.h deleted file mode 100644 index de81d878317a..000000000000 --- a/contrib/gcc/config/i386/linux-aout.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Definitions for Intel 386 running Linux-based GNU systems using a.out. - Copyright (C) 1992, 1994, 1995, 1997, 1998 Free Software Foundation, Inc. - Contributed by H.J. Lu (hjl@nynexst.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This is tested by i386/gas.h. */ -#define YES_UNDERSCORES - -#include -#include /* some common stuff */ - -#undef ASM_COMMENT_START -#define ASM_COMMENT_START "#" - -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Dlinux -Asystem(posix)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -/* Don't default to pcc-struct-return, because gcc is the only compiler, - and we want to retain compatibility with older gcc versions. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 - -#undef LIB_SPEC - -#if 1 -/* We no longer link with libc_p.a or libg.a by default. If you - want to profile or debug the GNU/Linux C library, please add - -lc_p or -ggdb to LDFLAGS at the link time, respectively. */ -#define LIB_SPEC \ -"%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}" -#else -#define LIB_SPEC \ -"%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \ - %{!p:%{!pg:%{!g*:-lc} %{g*:-lg -static}}}" -#endif - - -#undef LINK_SPEC -#define LINK_SPEC "-m i386linux" - -/* Get perform_* macros to build libgcc.a. */ -#include "i386/perform.h" diff --git a/contrib/gcc/config/i386/linux-oldld.h b/contrib/gcc/config/i386/linux-oldld.h deleted file mode 100644 index 4e3085bc2caf..000000000000 --- a/contrib/gcc/config/i386/linux-oldld.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Definitions for Intel 386 running Linux-based GNU systems with pre-BFD - a.out linkers. - Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. - Contributed by Michael Meissner (meissner@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This is tested by i386/gas.h. */ -#define YES_UNDERSCORES - -#include -#include /* some common stuff */ - -#undef ASM_COMMENT_START -#define ASM_COMMENT_START "#" - -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Dlinux -Asystem(posix)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -/* Don't default to pcc-struct-return, because gcc is the only compiler, - and we want to retain compatibility with older gcc versions. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 - -#undef LIB_SPEC - -#if 1 -/* We no longer link with libc_p.a or libg.a by default. If you - want to profile or debug the GNU/Linux C library, please add - lc_p or -ggdb to LDFLAGS at the link time, respectively. */ -#define LIB_SPEC \ -"%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}" -#else -#define LIB_SPEC \ -"%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \ - %{!p:%{!pg:%{!g*:-lc} %{g*:-lg -static}}}" -#endif - - -#undef LINK_SPEC -#define LINK_SPEC "" - -/* Get perform_* macros to build libgcc.a. */ -#include diff --git a/contrib/gcc/config/i386/linux.h b/contrib/gcc/config/i386/linux.h deleted file mode 100644 index 7b368f8e5fb8..000000000000 --- a/contrib/gcc/config/i386/linux.h +++ /dev/null @@ -1,236 +0,0 @@ -/* Definitions for Intel 386 running Linux-based GNU systems with ELF format. - Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Eric Youngdale. - Modified for stabs-in-ELF by H.J. Lu. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define LINUX_DEFAULT_ELF - -/* A lie, I guess, but the general idea behind linux/ELF is that we are - supposed to be outputting something that will assemble under SVr4. - This gets us pretty close. */ -#include /* Base i386 target machine definitions */ -#include /* Use the i386 AT&T assembler syntax */ -#include /* some common stuff */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)"); - -/* The svr4 ABI for the i386 says that records and unions are returned - in memory. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 1 - -#undef ASM_COMMENT_START -#define ASM_COMMENT_START "#" - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ -#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) - -/* Copy this from the svr4 specifications... */ -/* Define the register numbers to be used in Dwarf debugging information. - The SVR4 reference port C compiler uses the following register numbers - in its Dwarf output code: - 0 for %eax (gnu regno = 0) - 1 for %ecx (gnu regno = 2) - 2 for %edx (gnu regno = 1) - 3 for %ebx (gnu regno = 3) - 4 for %esp (gnu regno = 7) - 5 for %ebp (gnu regno = 6) - 6 for %esi (gnu regno = 4) - 7 for %edi (gnu regno = 5) - The following three DWARF register numbers are never generated by - the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4 - believes these numbers have these meanings. - 8 for %eip (no gnu equivalent) - 9 for %eflags (no gnu equivalent) - 10 for %trapno (no gnu equivalent) - It is not at all clear how we should number the FP stack registers - for the x86 architecture. If the version of SDB on x86/svr4 were - a bit less brain dead with respect to floating-point then we would - have a precedent to follow with respect to DWARF register numbers - for x86 FP registers, but the SDB on x86/svr4 is so completely - broken with respect to FP registers that it is hardly worth thinking - of it as something to strive for compatibility with. - The version of x86/svr4 SDB I have at the moment does (partially) - seem to believe that DWARF register number 11 is associated with - the x86 register %st(0), but that's about all. Higher DWARF - register numbers don't seem to be associated with anything in - particular, and even for DWARF regno 11, SDB only seems to under- - stand that it should say that a variable lives in %st(0) (when - asked via an `=' command) if we said it was in DWARF regno 11, - but SDB still prints garbage when asked for the value of the - variable in question (via a `/' command). - (Also note that the labels SDB prints for various FP stack regs - when doing an `x' command are all wrong.) - Note that these problems generally don't affect the native SVR4 - C compiler because it doesn't allow the use of -O with -g and - because when it is *not* optimizing, it allocates a memory - location for each floating-point variable, and the memory - location is what gets described in the DWARF AT_location - attribute for the variable in question. - Regardless of the severe mental illness of the x86/svr4 SDB, we - do something sensible here and we use the following DWARF - register numbers. Note that these are all stack-top-relative - numbers. - 11 for %st(0) (gnu regno = 8) - 12 for %st(1) (gnu regno = 9) - 13 for %st(2) (gnu regno = 10) - 14 for %st(3) (gnu regno = 11) - 15 for %st(4) (gnu regno = 12) - 16 for %st(5) (gnu regno = 13) - 17 for %st(6) (gnu regno = 14) - 18 for %st(7) (gnu regno = 15) -*/ -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ - : (-1)) - -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - { \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ - LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall mcount\n"); \ - } \ -} - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__i386__ -Dlinux -Asystem(posix)" - -#undef CPP_SPEC -#ifdef USE_GNULIBC_1 -#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" -#else -#define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" -#endif - -#undef CC1_SPEC -#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" - -/* Provide a LINK_SPEC appropriate for Linux. Here we provide support - for the special GCC options -static and -shared, which allow us to - link things in one of these three modes by applying the appropriate - combinations of options at link-time. We like to support here for - as many of the other GNU linker options as possible. But I don't - have the time to search for those flags. I am sure how to add - support for -soname shared_object_name. H.J. - - I took out %{v:%{!V:-V}}. It is too much :-(. They can use - -Wl,-V. - - When the -shared link option is used a final link is not being - done. */ - -/* If ELF is the default format, we should not use /lib/elf. */ - -#undef LINK_SPEC -#ifdef USE_GNULIBC_1 -#ifndef LINUX_DEFAULT_ELF -#define LINK_SPEC "-m elf_i386 %{shared:-shared} \ - %{!shared: \ - %{!ibcs: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \ - %{!rpath:-rpath /lib/elf/}} %{static:-static}}}" -#else -#define LINK_SPEC "-m elf_i386 %{shared:-shared} \ - %{!shared: \ - %{!ibcs: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \ - %{static:-static}}}" -#endif -#else -#define LINK_SPEC "-m elf_i386 %{shared:-shared} \ - %{!shared: \ - %{!ibcs: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ - %{static:-static}}}" -#endif - -/* Get perform_* macros to build libgcc.a. */ -#include "i386/perform.h" - -/* A C statement (sans semicolon) to output to the stdio stream - FILE the assembler definition of uninitialized global DECL named - NAME whose size is SIZE bytes and alignment is ALIGN bytes. - Try to use asm_output_aligned_bss to implement this macro. */ - -#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ - asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) - -/* A C statement to output to the stdio stream FILE an assembler - command to advance the location counter to a multiple of 1< -#include - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Di386 -DI386 -DLynx -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(i386) -Amachine(i386)" - -/* Provide required defaults for linker switches. */ - -#undef LINK_SPEC -#define LINK_SPEC "-P1000 %{msystem-v:-V} %{mcoff:-k}" - -/* Apparently LynxOS clobbers ebx when you call into the OS. */ - -#undef CALL_USED_REGISTERS -#define CALL_USED_REGISTERS \ -/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \ -{ 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } diff --git a/contrib/gcc/config/i386/lynx.h b/contrib/gcc/config/i386/lynx.h deleted file mode 100644 index 73111f916a50..000000000000 --- a/contrib/gcc/config/i386/lynx.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Definitions for Intel 386 running LynxOS. - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Di386 -DI386 -DLynx -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(i386) -Amachine(i386)" - -/* The prefix to add to user-visible assembler symbols. */ - -/* Override the svr3 convention of adding a leading underscore. */ - -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "" - -/* Apparently LynxOS clobbers ebx when you call into the OS. */ - -#undef CALL_USED_REGISTERS -#define CALL_USED_REGISTERS \ -/*ax,dx,cx,bx,si,di,bp,sp,st,st1,st2,st3,st4,st5,st6,st7,arg*/ \ -{ 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } diff --git a/contrib/gcc/config/i386/mach.h b/contrib/gcc/config/i386/mach.h deleted file mode 100644 index 4b7cf37e54df..000000000000 --- a/contrib/gcc/config/i386/mach.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Configuration for an i386 running Mach as the target machine. */ - -/* We do want to add an underscore to the front of each user symbol. - i386/gas.h checks this. */ -#define YES_UNDERSCORES - -#include "i386/gstabs.h" - -/* Get perform_* macros to build libgcc.a. */ -#include "i386/perform.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Di386 -DMACH -Asystem(unix) -Asystem(mach) -Acpu(i386) -Amachine(i386)" - -/* Specify extra dir to search for include files. */ -#define SYSTEM_INCLUDE_DIR "/usr/mach/include" - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 diff --git a/contrib/gcc/config/i386/mingw32.h b/contrib/gcc/config/i386/mingw32.h deleted file mode 100644 index 552cbcd1932e..000000000000 --- a/contrib/gcc/config/i386/mingw32.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for - hosting on Windows32, using GNU tools and the Windows32 API Library, - as distinct from winnt.h, which is used to build GCC for use with a - windows style library and tool set and uses the Microsoft tools. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Most of this is the same as for cygwin, except for changing some - specs. */ - -#include "i386/cygwin.h" - -/* Please keep changes to CPP_PREDEFINES in sync with i386/crtdll. The - only difference between the two should be __MSVCRT__ needed to - distinguish MSVC from CRTDLL runtime in mingw headers. */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386 -D_WIN32 -DWIN32 -D__WIN32__ \ - -D__MINGW32__=0.2 -D__MSVCRT__ -DWINNT -D_X86_=1 -D__STDC__=1\ - -D__stdcall=__attribute__((__stdcall__)) \ - -D_stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - -D__declspec(x)=__attribute__((x)) \ - -Asystem(winnt) -Acpu(i386) -Amachine(i386)" - -/* Specific a different directory for the standard include files. */ -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR "/usr/local/i386-mingw32/include" - -#define STANDARD_INCLUDE_COMPONENT "MINGW32" - -#undef CPP_SPEC -#define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE}" - -/* For Windows applications, include more libraries, but always include - kernel32. */ -#undef LIB_SPEC -#define LIB_SPEC "%{mwindows:-lgdi32 -lcomdlg32} \ - -luser32 -lkernel32 -ladvapi32 -lshell32" - -/* Include in the mingw32 libraries with libgcc */ -#undef LIBGCC_SPEC -#define LIBGCC_SPEC "-lmingw32 -lgcc -lmoldname -lmsvcrt" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{mdll:dllcrt2%O%s} %{!mdll:crt2%O%s}" - -/* MS runtime does not need a separate math library. */ -#define MATH_LIBRARY "" - -/* Output STRING, a string representing a filename, to FILE. We canonicalize - it to be in MS-DOS format. */ -#define OUTPUT_QUOTED_STRING(FILE, STRING) \ -do { \ - char c; \ - \ - putc ('\"', asm_file); \ - if (STRING[1] == ':' \ - && (STRING[2] == '/' || STRING[2] == '\\')) \ - { \ - putc ('/', asm_file); \ - putc ('/', asm_file); \ - putc (*string, asm_file); \ - string += 2; \ - } \ - \ - while ((c = *string++) != 0) \ - { \ - if (c == '\\') \ - c = '/'; \ - \ - if (c == '\"') \ - putc ('\\', asm_file); \ - putc (c, asm_file); \ - } \ - \ - putc ('\"', asm_file); \ -} while (0) - diff --git a/contrib/gcc/config/i386/moss.h b/contrib/gcc/config/i386/moss.h deleted file mode 100644 index d2548e3a5b98..000000000000 --- a/contrib/gcc/config/i386/moss.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Definitions for Intel 386 running MOSS - Copyright (C) 1996 Free Software Foundation, Inc. - Contributed by Bryan Ford - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* I believe in reuse... */ -#include "i386/linux.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__ELF__ -Di386 -Dmoss -Asystem(posix) -Acpu(i386) -Amachine(i386)" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "crt0.o%s" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtn.o%s" - -#undef LINK_SPEC - diff --git a/contrib/gcc/config/i386/netbsd.h b/contrib/gcc/config/i386/netbsd.h deleted file mode 100644 index d9f06469e623..000000000000 --- a/contrib/gcc/config/i386/netbsd.h +++ /dev/null @@ -1,87 +0,0 @@ -/* This is tested by i386gas.h. */ -#define YES_UNDERSCORES - -#include - -/* Get perform_* macros to build libgcc.a. */ -#include - -/* Get generic NetBSD definitions. */ -#include - -/* This goes away when the math-emulator is fixed */ -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ - (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387) - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Di386 -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386)" - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_UNSIGNED -#define WCHAR_UNSIGNED 0 - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -/* The following macros are stolen from i386v4.h */ -/* These have to be defined to get PIC code correct */ - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ - -#define JUMP_TABLES_IN_TEXT_SECTION 1 - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* i386 netbsd still uses old binutils that don't insert nops by default - when the .align directive demands to insert extra space in the text - segment. */ -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG)) - -/* Profiling routines, partially copied from i386/osfrose.h. */ - -/* Redefine this to use %eax instead of %edx. */ -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - { \ - fprintf (FILE, "\tcall mcount@PLT\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tcall mcount\n"); \ - } \ -} - -/* Until they use ELF or something that handles dwarf2 unwinds - and initialization stuff better. */ -#define DWARF2_UNWIND_INFO 0 - diff --git a/contrib/gcc/config/i386/next.c b/contrib/gcc/config/i386/next.c deleted file mode 100644 index f249647ab595..000000000000 --- a/contrib/gcc/config/i386/next.c +++ /dev/null @@ -1,7 +0,0 @@ -/* next.c: Functions for NeXT as target machine for GNU C compiler. */ - -/* Note that the include below means that we can't debug routines in - i386.c when running on a COFF system. */ - -#include "i386/i386.c" -#include "nextstep.c" diff --git a/contrib/gcc/config/i386/next.h b/contrib/gcc/config/i386/next.h deleted file mode 100644 index bbc0e6b30612..000000000000 --- a/contrib/gcc/config/i386/next.h +++ /dev/null @@ -1,233 +0,0 @@ -/* Target definitions for GNU compiler for Intel x86 CPU running NeXTSTEP - Copyright (C) 1993, 1995, 1996, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/gas.h" -#include "nextstep.h" - -/* By default, target has a 80387, with IEEE FP. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP) - -/* Implicit library calls should use memcpy, not bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS - -/* Machines that use the AT&T assembler syntax - also return floating point values in an FP register. - Define how to find the value returned by a function. - VALTYPE is the data type of the value (as a tree). - If the precise function being called is known, FUNC is its FUNCTION_DECL; - otherwise, FUNC is 0. */ - -#undef VALUE_REGNO -#define VALUE_REGNO(MODE) \ - ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \ - ? FIRST_FLOAT_REG : 0) - -/* 1 if N is a possible register number for a function value. */ - -#undef FUNCTION_VALUE_REGNO_P -#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N)== FIRST_FLOAT_REG) - -#ifdef REAL_VALUE_TO_TARGET_LONG_DOUBLE -#undef ASM_OUTPUT_LONG_DOUBLE -#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \ - do { \ - long hex[3]; \ - REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, hex); \ - if (sizeof (int) == sizeof (long)) \ - fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n\t.long 0x%x\n", \ - hex[0], hex[1], hex[2]); \ - else \ - fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n\t.long 0x%lx\n", \ - hex[0], hex[1], hex[2]); \ - } while (0) -#endif - -#ifdef REAL_VALUE_TO_TARGET_DOUBLE -#undef ASM_OUTPUT_DOUBLE -#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ - do { \ - long hex[2]; \ - REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex); \ - if (sizeof (int) == sizeof (long)) \ - fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n", hex[0], hex[1]); \ - else \ - fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", hex[0], hex[1]); \ - } while (0) -#endif - -/* This is how to output an assembler line defining a `float' constant. */ - -#ifdef REAL_VALUE_TO_TARGET_SINGLE -#undef ASM_OUTPUT_FLOAT -#define ASM_OUTPUT_FLOAT(FILE,VALUE) \ - do { \ - long hex; \ - REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex); \ - if (sizeof (int) == sizeof (long)) \ - fprintf (FILE, "\t.long 0x%x\n", hex); \ - else \ - fprintf (FILE, "\t.long 0x%lx\n", hex); \ - } while (0) -#endif - -/* A C statement or statements which output an assembler instruction - opcode to the stdio stream STREAM. The macro-operand PTR is a - variable of type `char *' which points to the opcode name in its - "internal" form--the form that is written in the machine description. - - GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic. - So use `repe' instead. */ - -#undef ASM_OUTPUT_OPCODE -#define ASM_OUTPUT_OPCODE(STREAM, PTR) \ -{ \ - if ((PTR)[0] == 'r' \ - && (PTR)[1] == 'e' \ - && (PTR)[2] == 'p') \ - { \ - if ((PTR)[3] == 'z') \ - { \ - fprintf (STREAM, "repe"); \ - (PTR) += 4; \ - } \ - else if ((PTR)[3] == 'n' && (PTR)[4] == 'z') \ - { \ - fprintf (STREAM, "repne"); \ - (PTR) += 5; \ - } \ - } \ -} - -/* Define macro used to output shift-double opcodes when the shift - count is in %cl. Some assemblers require %cl as an argument; - some don't. - - GAS requires the %cl argument, so override unx386.h. */ - -#undef SHIFT_DOUBLE_OMITS_COUNT -#define SHIFT_DOUBLE_OMITS_COUNT 0 - -/* Print opcodes the way that GAS expects them. */ -#define GAS_MNEMONICS 1 - -/* Names to predefine in the preprocessor for this target machine. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386 -DNeXT -Dunix -D__MACH__ -D__LITTLE_ENDIAN__ -D__ARCHITECTURE__=\"i386\" -Asystem(unix) -Asystem(mach) -Acpu(i386) -Amachine(i386)" - -/* This accounts for the return pc and saved fp on the i386. */ - -#define OBJC_FORWARDING_STACK_OFFSET 8 -#define OBJC_FORWARDING_MIN_OFFSET 8 - -/* We do not want a dot in internal labels. */ - -#undef LPREFIX -#define LPREFIX "L" - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ - sprintf ((BUF), "*%s%d", (PREFIX), (NUMBER)) - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, "%s%d:\n", PREFIX, NUM) - -/* Output to assembler file text saying following lines - may contain character constants, extra white space, comments, etc. */ - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -/* Output to assembler file text saying following lines - no longer contain unusual constructs. */ - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -#undef ASM_OUTPUT_REG_PUSH -#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ - fprintf (FILE, "\tpushl %se%s\n", "%", reg_names[REGNO]) - -#undef ASM_OUTPUT_REG_POP -#define ASM_OUTPUT_REG_POP(FILE,REGNO) \ - fprintf (FILE, "\tpopl %se%s\n", "%", reg_names[REGNO]) - -/* This is being overridden because the default i386 configuration - generates calls to "_mcount". NeXT system libraries all use - "mcount". */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - { \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ - LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall mcount\n"); \ - } \ -} - -/* BEGIN Calling Convention CHANGES */ - -/* These changes violate the Intel/Unix ABI. Specifically, they - change the way that space for a block return value is passed to a - function. The ABI says that the pointer is passed on the stack. - We change to pass the pointer in %ebx. This makes the NeXT - Objective-C forwarding mechanism possible to implement on an i386. */ - -/* Do NOT pass address of structure values on the stack. */ - -#undef STRUCT_VALUE_INCOMING -#undef STRUCT_VALUE - -/* Pass them in %ebx. */ - -#undef STRUCT_VALUE_REGNUM -#define STRUCT_VALUE_REGNUM 3 - -/* Because we are passing the pointer in a register, we don't need to - rely on the callee to pop it. */ - -#undef RETURN_POPS_ARGS -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ - ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE \ - ? 0 \ - : (TARGET_RTD \ - && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ - == void_type_node))) ? (SIZE) : 0) - -/* END Calling Convention CHANGES */ - -/* NeXT still uses old binutils that don't insert nops by default - when the .align directive demands to insert extra space in the text - segment. */ -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG)) diff --git a/contrib/gcc/config/i386/openbsd.h b/contrib/gcc/config/i386/openbsd.h deleted file mode 100644 index dc84f892c168..000000000000 --- a/contrib/gcc/config/i386/openbsd.h +++ /dev/null @@ -1,136 +0,0 @@ -/* Configuration for an OpenBSD i386 target. - - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This is tested by i386gas.h. */ -#define YES_UNDERSCORES - -#include - -/* Get perform_* macros to build libgcc.a. */ -#include - -/* Get generic OpenBSD definitions. */ -#define OBSD_OLD_GAS -#include - -/* This goes away when the math-emulator is fixed */ -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ - (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387) - -/* Run-time target specifications */ -#define CPP_PREDEFINES "-D__unix__ -D__i386__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(i386) -Amachine(i386)" - -/* Layout of source language data types. */ - -/* This must agree with */ -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 - -/* Assembler format: overall framework. */ - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -/* The following macros were originally stolen from i386v4.h. - These have to be defined to get PIC code correct. */ - -/* Assembler format: dispatch tables. */ - -/* How to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Assembler format: sections. */ - -/* Indicate when jump tables go in the text section. This is - necessary when compiling PIC code. */ -#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) - -/* Stack & calling: aggregate returns. */ - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* Assembler format: alignment output. */ - -/* Kludgy test: when gas is upgraded, it will have p2align, and no problems - with nops. */ -#ifndef HAVE_GAS_MAX_SKIP_P2ALIGN -/* i386 OpenBSD still uses an older gas that doesn't insert nops by default - when the .align directive demands to insert extra space in the text - segment. */ -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG)) -#endif - -/* Stack & calling: profiling. */ - -/* OpenBSD's profiler recovers all information from the stack pointer. - The icky part is not here, but in machine/profile.h. */ -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ - fputs (flag_pic ? "\tcall mcount@PLT\n": "\tcall mcount\n", FILE); - -/* Assembler format: exception region output. */ - -/* All configurations that don't use elf must be explicit about not using - dwarf unwind information. egcs doesn't try too hard to check internal - configuration files... */ -#define DWARF2_UNWIND_INFO 0 - -/* Assembler format: alignment output. */ - -/* A C statement to output to the stdio stream FILE an assembler - command to advance the location counter to a multiple of 1< -#include "i386/sysv4.h" /* Base i386 target machine definitions */ -#define _sys_siglist sys_siglist -extern char *sys_siglist[]; - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 OSF/1)"); - -/* WORD_SWITCH_TAKES_ARG defined in svr4 is not correct. We also - need an extra -soname */ -#undef WORD_SWITCH_TAKES_ARG -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - || !strcmp (STR, "Tdata") || !strcmp (STR, "Ttext") \ - || !strcmp (STR, "Tbss") || !strcmp (STR, "soname")) - -/* Note, -fpic and -fPIC are equivalent */ -#undef CPP_SPEC -#define CPP_SPEC "\ -%{fpic: -D__SHARED__} %{fPIC: %{!fpic: -D__SHARED__}} \ -%{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \ -%{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ -%{.cc: -D__LANGUAGE_C_PLUS_PLUS} \ -%{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \ -%{.C: -D__LANGUAGE_C_PLUS_PLUS} \ -%{.m: -D__LANGUAGE_OBJECTIVE_C} \ -%{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}" - -/* -mmcount or -mno-mcount should be used with -pg or -p */ -#undef CC1_SPEC -#define CC1_SPEC "%{p: %{!mmcount: %{!mno-mcount: -mno-mcount }}} \ -%{!p: %{pg: %{!mmcount: %{!mno-mcount: -mno-mcount }}}}" - -/* Note, -D__NO_UNDERSCORES__ -D__ELF__ are provided in the older version of - OSF/1 gcc. We keep them here, so that old /usr/include/i386/asm.h works. - */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES \ - "-D__NO_UNDERSCORES__ -D__ELF__ -DOSF -DOSF1 -Di386 -Dunix -Asystem(xpg4) -Asystem(osf1) -Acpu(i386) -Amachine(i386)" - -/* current OSF/1 doesn't provide separate crti.o and gcrti.o (and also, crtn.o - and gcrtn.o) for profile. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared: \ - %{!symbolic: \ - %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\ - crti.o%s \ - crtbegin.o%s" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s crtn.o%s" - -#undef ASM_SPEC -#define ASM_SPEC "%{v*: -v}" - -#undef LINK_SPEC -#define LINK_SPEC "%{v*: -v} \ - %{h*} %{z*} \ - %{dy:-call_shared} %{dn:-static} \ - %{static:-static} \ - %{shared:-shared} \ - %{call_shared:-call_shared} \ - %{symbolic:-Bsymbolic -shared -call_shared} \ - %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \ - %{noshrlib: -static } \ - %{!noshrlib: -call_shared}}}}}}" - -#undef MD_EXEC_PREFIX -#define MD_EXEC_PREFIX "/usr/ccs/gcc/" - -#undef MD_STARTFILE_PREFIX -#define MD_STARTFILE_PREFIX "/usr/ccs/lib/" - -/* Define this macro meaning that gcc should find the library 'libgcc.a' - by hand, rather than passing the argument '-lgcc' to tell the linker - to do the search */ -#define LINK_LIBGCC_SPECIAL - -/* This goes with LINK_LIBGCC_SPECIAL, we need tell libgcc.a differently */ -#undef LIBGCC_SPEC -#define LIBGCC_SPEC "%{!shared:%{!symbolic:libgcc.a%s}}" - -/* A C statement to output assembler commands which will identify the object - file as having been compile with GNU CC. We don't need or want this for - OSF1. */ -#undef ASM_IDENTIFY_GCC -#define ASM_IDENTIFY_GCC(FILE) - -/* Identify the front-end which produced this file. To keep symbol - space down, and not confuse kdb, only do this if the language is - not C. */ -#define ASM_IDENTIFY_LANGUAGE(STREAM) \ -{ \ - if (strcmp (lang_identify (), "c") != 0) \ - output_lang_identify (STREAM); \ -} - -/* Specify size_t, ptrdiff_t, and wchar_t types. */ -#undef SIZE_TYPE -#undef PTRDIFF_TYPE -#undef WCHAR_TYPE -#undef WCHAR_TYPE_SIZE - -#define SIZE_TYPE "long unsigned int" -#define PTRDIFF_TYPE "int" -#define WCHAR_TYPE "unsigned int" -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -/* Turn off long double being 96 bits. */ -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 64 - -/* Work with OSF/1 profile */ -#define MASK_NO_MCOUNT 000200000000 /* profiling uses mcount_ptr */ - -#define TARGET_MCOUNT ((target_flags & MASK_NO_MCOUNT) == 0) - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - { "mcount", -MASK_NO_MCOUNT, "Profiling uses mcount" }, \ - { "no-mcount", MASK_NO_MCOUNT, "" }, - -/* This macro generates the assembly code for function entry. - FILE is a stdio stream to output the code to. - SIZE is an int: how many units of temporary storage to allocate. - Refer to the array `regs_ever_live' to determine which registers - to save; `regs_ever_live[I]' is nonzero if register number I - is ever used in the function. This macro is responsible for - knowing which registers should not be saved even if used. - - We override it here to allow for the new profiling code to go before - the prologue and the old mcount code to go after the prologue (and - after %ebx has been set up for ELF shared library support). */ -#if 0 -#define OSF_PROFILE_BEFORE_PROLOGUE \ - (!TARGET_MCOUNT \ - && !current_function_needs_context \ - && (!flag_pic \ - || !frame_pointer_needed \ - || (!current_function_uses_pic_offset_table \ - && !current_function_uses_const_pool))) -#else -#define OSF_PROFILE_BEFORE_PROLOGUE 0 -#endif -#undef FUNCTION_PROLOGUE -#define FUNCTION_PROLOGUE(FILE, SIZE) \ -do \ - { \ - char *prefix = ""; \ - char *lprefix = LPREFIX; \ - int labelno = profile_label_no; \ - \ - if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE) \ - { \ - if (!flag_pic) \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ - fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix); \ - } \ - \ - else \ - { \ - static int call_no = 0; \ - \ - fprintf (FILE, "\tcall %sPc%d\n", lprefix, call_no); \ - fprintf (FILE, "%sPc%d:\tpopl %%eax\n", lprefix, call_no); \ - fprintf (FILE, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-%sPc%d],%%eax\n", \ - lprefix, call_no++); \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%eax),%%edx\n", \ - lprefix, labelno); \ - fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n", \ - prefix); \ - fprintf (FILE, "\tcall *(%%eax)\n"); \ - } \ - } \ - \ - function_prologue (FILE, SIZE); \ - } \ -while (0) - -/* A C statement or compound statement to output to FILE some assembler code to - call the profiling subroutine `mcount'. Before calling, the assembler code - must load the address of a counter variable into a register where `mcount' - expects to find the address. The name of this variable is `LP' followed by - the number LABELNO, so you would generate the name using `LP%d' in a - `fprintf'. - - The details of how the address should be passed to `mcount' are determined - by your operating system environment, not by GNU CC. To figure them out, - compile a small program for profiling using the system's installed C - compiler and look at the assembler code that results. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -do \ - { \ - if (!OSF_PROFILE_BEFORE_PROLOGUE) \ - { \ - char *prefix = ""; \ - char *lprefix = LPREFIX; \ - int labelno = LABELNO; \ - \ - /* Note that OSF/rose blew it in terms of calling mcount, \ - since OSF/rose prepends a leading underscore, but mcount's \ - doesn't. At present, we keep this kludge for ELF as well \ - to allow old kernels to build profiling. */ \ - \ - if (flag_pic \ - && !current_function_uses_pic_offset_table \ - && !current_function_uses_const_pool) \ - abort (); \ - \ - if (TARGET_MCOUNT && flag_pic) \ - { \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ - lprefix, labelno); \ - fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \ - } \ - \ - else if (TARGET_MCOUNT) \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ - fprintf (FILE, "\tcall %smcount\n", prefix); \ - } \ - \ - else if (flag_pic && frame_pointer_needed) \ - { \ - fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \ - fprintf (FILE, "\tpushl %%ecx\n"); \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ - lprefix, labelno); \ - fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n"); \ - fprintf (FILE, "\tcall *(%%eax)\n"); \ - fprintf (FILE, "\tpopl %%eax\n"); \ - } \ - \ - else if (frame_pointer_needed) \ - { \ - fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \ - fprintf (FILE, "\tpushl %%ecx\n"); \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ - fprintf (FILE, "\tcall *_mcount_ptr\n"); \ - fprintf (FILE, "\tpopl %%eax\n"); \ - } \ - \ - else \ - abort (); \ - } \ - } \ -while (0) - -#if defined (CROSS_COMPILE) && defined (HOST_BITS_PER_INT) && defined (HOST_BITS_PER_LONG) && defined (HOST_BITS_PER_LONGLONG) -#if (HOST_BITS_PER_INT==32) && (HOST_BITS_PER_LONG==64) && (HOST_BITS_PER_LONGLONG==64) -#define REAL_ARITHMETIC -#endif -#endif diff --git a/contrib/gcc/config/i386/osf1elfgdb.h b/contrib/gcc/config/i386/osf1elfgdb.h deleted file mode 100644 index af6efa2d0def..000000000000 --- a/contrib/gcc/config/i386/osf1elfgdb.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Target definitions for GNU compiler for Intel 80386 running OSF/1 1.3+ - with gas and gdb. */ - -/* Use stabs instead of DWARF debug format. */ -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#include "i386/osf1elf.h" diff --git a/contrib/gcc/config/i386/osfelf.h b/contrib/gcc/config/i386/osfelf.h deleted file mode 100644 index 381ffc26313c..000000000000 --- a/contrib/gcc/config/i386/osfelf.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Definitions of target machine for GNU compiler. - Intel 386 (OSF/1 with ELF) version. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config/i386/osfrose.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Asystem(xpg4)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) \ -%{mrose: -D__ROSE__ %{!pic-none: -D__SHARED__}} \ -%{!mrose: -D__ELF__ %{fpic: -D__SHARED__}} \ -%{mno-underscores: -D__NO_UNDERSCORES__} \ -%{!mrose: %{!munderscores: -D__NO_UNDERSCORES__}} \ -%{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \ -%{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ -%{.cc: -D__LANGUAGE_C_PLUS_PLUS} \ -%{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \ -%{.C: -D__LANGUAGE_C_PLUS_PLUS} \ -%{.m: -D__LANGUAGE_OBJECTIVE_C} \ -%{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}" - -/* Turn on -pic-extern by default for OSF/rose, -fpic for ELF. */ -#undef CC1_SPEC -#define CC1_SPEC "\ -%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \ -%{!melf: %{!mrose: -melf }} \ -%{!mrose: %{!munderscores: %{!mno-underscores: -mno-underscores }} \ - %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount-ptr }}}} \ -%{mrose: %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount }}} \ - %{pic-extern: -mhalf-pic } %{pic-lib: -mhalf-pic } \ - %{!pic-extern: %{!pic-lib: %{pic-none: -mno-half-pic} %{!pic-none: -mhalf-pic}}} \ - %{pic-calls: } %{pic-names*: }}" - -#undef ASM_SPEC -#define ASM_SPEC "%{v*: -v}" - -#undef LINK_SPEC -#define LINK_SPEC "%{v*: -v} \ -%{mrose: %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \ - %{nostdlib} %{noshrlib} %{glue}} \ -%{!mrose: %{dy} %{dn} %{glue: } \ - %{h*} %{z*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy} \ - %{symbolic:-Bsymbolic -G -dy} \ - %{G:-G} \ - %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \ - %{noshrlib: -dn } %{pic-none: -dn } \ - %{!noshrlib: %{!pic-none: -dy}}}}}}}}" - -#undef TARGET_VERSION_INTERNAL -#undef TARGET_VERSION - -#undef I386_VERSION -#define I386_VERSION " 80386, ELF objects" - -#define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM) -#define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr) - -#undef OBJECT_FORMAT_ROSE diff --git a/contrib/gcc/config/i386/osfrose.h b/contrib/gcc/config/i386/osfrose.h deleted file mode 100644 index 9ad9f952d572..000000000000 --- a/contrib/gcc/config/i386/osfrose.h +++ /dev/null @@ -1,914 +0,0 @@ -/* Definitions of target machine for GNU compiler. - Intel 386 (OSF/1 with OSF/rose) version. - Copyright (C) 1991, 1992, 1993, 1996, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "halfpic.h" -#include "i386/gstabs.h" - -/* Get perform_* macros to build libgcc.a. */ -#include "i386/perform.h" - -#define OSF_OS - -#undef WORD_SWITCH_TAKES_ARG -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names")) - -/* This defines which switch letters take arguments. On svr4, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker). */ - -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'h' \ - || (CHAR) == 'z') - -#define MASK_HALF_PIC 010000000000 /* Mask for half-pic code */ -#define MASK_HALF_PIC_DEBUG 004000000000 /* Debug flag */ -#define MASK_ELF 002000000000 /* ELF not rose */ -#define MASK_NO_UNDERSCORES 000400000000 /* suppress leading _ */ -#define MASK_LARGE_ALIGN 000200000000 /* align to >word boundaries */ -#define MASK_NO_MCOUNT 000100000000 /* profiling uses mcount_ptr */ - -#define TARGET_HALF_PIC (target_flags & MASK_HALF_PIC) -#define TARGET_DEBUG (target_flags & MASK_HALF_PIC_DEBUG) -#define HALF_PIC_DEBUG TARGET_DEBUG -#define TARGET_ELF (target_flags & MASK_ELF) -#define TARGET_ROSE ((target_flags & MASK_ELF) == 0) -#define TARGET_UNDERSCORES ((target_flags & MASK_NO_UNDERSCORES) == 0) -#define TARGET_LARGE_ALIGN (target_flags & MASK_LARGE_ALIGN) -#define TARGET_MCOUNT ((target_flags & MASK_NO_MCOUNT) == 0) - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - { "half-pic", MASK_HALF_PIC, "Emit half-PIC code" }, \ - { "no-half-pic", -MASK_HALF_PIC, "" } \ - { "debug-half-pic", MASK_HALF_PIC_DEBUG, 0 /* intentionally undoc */ }, \ - { "debugb", MASK_HALF_PIC_DEBUG, 0 /* intentionally undoc */ }, \ - { "elf", MASK_ELF, "Emit ELF object code" }, \ - { "rose", -MASK_ELF, "Emit ROSE object code" }, \ - { "underscores", -MASK_NO_UNDERSCORES, "Symbols have a leading underscore" }, \ - { "no-underscores", MASK_NO_UNDERSCORES, "" }, \ - { "large-align", MASK_LARGE_ALIGN, "Align to >word boundaries" }, \ - { "no-large-align", -MASK_LARGE_ALIGN, "" }, \ - { "mcount", -MASK_NO_MCOUNT, "Use mcount for profiling" }, \ - { "mcount-ptr", MASK_NO_MCOUNT, "Use mcount_ptr for profiling" }, \ - { "no-mcount", MASK_NO_MCOUNT, "" }, - -/* OSF/rose uses stabs, not dwarf. */ -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#ifndef DWARF_DEBUGGING_INFO -#define DWARF_DEBUGGING_INFO /* enable dwarf debugging for testing */ -#endif - -/* Handle #pragma weak and #pragma pack. */ - -#define HANDLE_SYSV_PRAGMA -#define SUPPORTS_WEAK TARGET_ELF - -/* Change default predefines. */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Asystem(xpg4)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) \ -%{!melf: -D__ROSE__ %{!pic-none: -D__SHARED__}} \ -%{melf: -D__ELF__ %{fpic: -D__SHARED__}} \ -%{mno-underscores: -D__NO_UNDERSCORES__} \ -%{melf: %{!munderscores: -D__NO_UNDERSCORES__}} \ -%{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \ -%{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ -%{.cc: -D__LANGUAGE_C_PLUS_PLUS} \ -%{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \ -%{.C: -D__LANGUAGE_C_PLUS_PLUS} \ -%{.m: -D__LANGUAGE_OBJECTIVE_C} \ -%{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}" - -/* Turn on -pic-extern by default for OSF/rose, -fpic for ELF. */ -#undef CC1_SPEC -#define CC1_SPEC "\ -%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \ -%{!melf: %{!mrose: -mrose }} \ -%{melf: %{!munderscores: %{!mno-underscores: -mno-underscores }} \ - %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount-ptr }}}} \ -%{!melf: %{!munderscores: %{!mno-underscores: -munderscores }} \ - %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount }}} \ - %{pic-extern: -mhalf-pic } %{pic-lib: -mhalf-pic } \ - %{!pic-extern: %{!pic-lib: %{pic-none: -mno-half-pic} %{!pic-none: -mhalf-pic}}} \ - %{pic-calls: } %{pic-names*: }}" - -#undef ASM_SPEC -#define ASM_SPEC "%{v*: -v}" - -#undef LINK_SPEC -#define LINK_SPEC "%{v*: -v} \ -%{!melf: %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \ - %{nostdlib} %{noshrlib} %{glue}} \ -%{melf: %{dy} %{dn} %{glue: } \ - %{h*} %{z*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy} \ - %{symbolic:-Bsymbolic -G -dy} \ - %{G:-G} \ - %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \ - %{noshrlib: -dn } %{pic-none: -dn } \ - %{!noshrlib: %{!pic-none: -dy}}}}}}}}" - -#undef LIB_SPEC -#define LIB_SPEC "-lc" - -#undef LIBG_SPEC -#define LIBG_SPEC "" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}" - -#undef TARGET_VERSION_INTERNAL -#undef TARGET_VERSION - -#define I386_VERSION " 80386, OSF/rose objects" - -#define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM) -#define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr) - -#undef MD_EXEC_PREFIX -#define MD_EXEC_PREFIX "/usr/ccs/gcc/" - -#undef MD_STARTFILE_PREFIX -#define MD_STARTFILE_PREFIX "/usr/ccs/lib/" - -/* Specify size_t, ptrdiff_t, and wchar_t types. */ -#undef SIZE_TYPE -#undef PTRDIFF_TYPE -#undef WCHAR_TYPE -#undef WCHAR_TYPE_SIZE - -#define SIZE_TYPE "long unsigned int" -#define PTRDIFF_TYPE "int" -#define WCHAR_TYPE "unsigned int" -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -/* Define this macro if the system header files support C++ as well - as C. This macro inhibits the usual method of using system header - files in C++, which is to pretend that the file's contents are - enclosed in `extern "C" {...}'. */ -#define NO_IMPLICIT_EXTERN_C - -/* Turn off long double being 96 bits. */ -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 64 - -/* This macro generates the assembly code for function entry. - FILE is a stdio stream to output the code to. - SIZE is an int: how many units of temporary storage to allocate. - Refer to the array `regs_ever_live' to determine which registers - to save; `regs_ever_live[I]' is nonzero if register number I - is ever used in the function. This macro is responsible for - knowing which registers should not be saved even if used. - - We override it here to allow for the new profiling code to go before - the prologue and the old mcount code to go after the prologue (and - after %ebx has been set up for ELF shared library support). */ - -#define OSF_PROFILE_BEFORE_PROLOGUE \ - (!TARGET_MCOUNT \ - && !current_function_needs_context \ - && (!flag_pic \ - || !frame_pointer_needed \ - || (!current_function_uses_pic_offset_table \ - && !current_function_uses_const_pool))) - -#undef FUNCTION_PROLOGUE -#define FUNCTION_PROLOGUE(FILE, SIZE) \ -do \ - { \ - char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \ - char *lprefix = LPREFIX; \ - int labelno = profile_label_no; \ - \ - if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE) \ - { \ - if (!flag_pic && !HALF_PIC_P ()) \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ - fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix); \ - } \ - \ - else if (HALF_PIC_P ()) \ - { \ - rtx symref; \ - \ - HALF_PIC_EXTERNAL ("_mcount_ptr"); \ - symref = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, \ - "_mcount_ptr")); \ - \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ - fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix, \ - XSTR (symref, 0)); \ - fprintf (FILE, "\tcall *(%%eax)\n"); \ - } \ - \ - else \ - { \ - static int call_no = 0; \ - \ - fprintf (FILE, "\tcall %sPc%d\n", lprefix, call_no); \ - fprintf (FILE, "%sPc%d:\tpopl %%eax\n", lprefix, call_no); \ - fprintf (FILE, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-%sPc%d],%%eax\n", \ - lprefix, call_no++); \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%eax),%%edx\n", \ - lprefix, labelno); \ - fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n", \ - prefix); \ - fprintf (FILE, "\tcall *(%%eax)\n"); \ - } \ - } \ - \ - function_prologue (FILE, SIZE); \ - } \ -while (0) - -/* A C statement or compound statement to output to FILE some assembler code to - call the profiling subroutine `mcount'. Before calling, the assembler code - must load the address of a counter variable into a register where `mcount' - expects to find the address. The name of this variable is `LP' followed by - the number LABELNO, so you would generate the name using `LP%d' in a - `fprintf'. - - The details of how the address should be passed to `mcount' are determined - by your operating system environment, not by GNU CC. To figure them out, - compile a small program for profiling using the system's installed C - compiler and look at the assembler code that results. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -do \ - { \ - if (!OSF_PROFILE_BEFORE_PROLOGUE) \ - { \ - char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \ - char *lprefix = LPREFIX; \ - int labelno = LABELNO; \ - \ - /* Note that OSF/rose blew it in terms of calling mcount, \ - since OSF/rose prepends a leading underscore, but mcount's \ - doesn't. At present, we keep this kludge for ELF as well \ - to allow old kernels to build profiling. */ \ - \ - if (flag_pic \ - && !current_function_uses_pic_offset_table \ - && !current_function_uses_const_pool) \ - abort (); \ - \ - if (TARGET_MCOUNT && flag_pic) \ - { \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ - lprefix, labelno); \ - fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \ - } \ - \ - else if (TARGET_MCOUNT && HALF_PIC_P ()) \ - { \ - rtx symdef; \ - \ - HALF_PIC_EXTERNAL ("mcount"); \ - symdef = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, "mcount")); \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ - fprintf (FILE, "\tcall *%s%s\n", prefix, XSTR (symdef, 0)); \ - } \ - \ - else if (TARGET_MCOUNT) \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ - fprintf (FILE, "\tcall %smcount\n", prefix); \ - } \ - \ - else if (flag_pic && frame_pointer_needed) \ - { \ - fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \ - fprintf (FILE, "\tpushl %%ecx\n"); \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ - lprefix, labelno); \ - fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n"); \ - fprintf (FILE, "\tcall *(%%eax)\n"); \ - fprintf (FILE, "\tpopl %%eax\n"); \ - } \ - \ - else if (frame_pointer_needed) \ - { \ - fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \ - fprintf (FILE, "\tpushl %%ecx\n"); \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ - fprintf (FILE, "\tcall *_mcount_ptr\n"); \ - fprintf (FILE, "\tpopl %%eax\n"); \ - } \ - \ - else \ - abort (); \ - } \ - } \ -while (0) - -/* A C function or functions which are needed in the library to - support block profiling. When support goes into libc, undo - the #if 0. */ - -#if 0 -#undef BLOCK_PROFILING_CODE -#define BLOCK_PROFILING_CODE -#endif - -/* Prefix for internally generated assembler labels. If we aren't using - underscores, we are using prefix `.'s to identify labels that should - be ignored, as in `i386/gas.h' --karl@cs.umb.edu */ -#undef LPREFIX -#define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L") - -/* This is how to store into the string BUF - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ - sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".", \ - (PREFIX), (NUMBER)) - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".", \ - PREFIX, NUM) - -/* The prefix to add to user-visible assembler symbols. */ - -/* target_flags is not accessible by the preprocessor */ -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "_" - -/* This is how to output a reference to a user-level label named NAME. */ - -#undef ASM_OUTPUT_LABELREF -#define ASM_OUTPUT_LABELREF(FILE,NAME) \ - fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME) - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Output a definition */ -#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ -do \ -{ \ - fprintf ((FILE), "\t%s\t", SET_ASM_OP); \ - assemble_name (FILE, LABEL1); \ - fprintf (FILE, ","); \ - assemble_name (FILE, LABEL2); \ - fprintf (FILE, "\n"); \ - } \ -while (0) - -/* A C expression to output text to align the location counter in the - way that is desirable at a point in the code that is reached only - by jumping. - - This macro need not be defined if you don't want any special - alignment to be done at such a time. Most machine descriptions do - not currently define the macro. */ - -#undef LABEL_ALIGN_AFTER_BARRIER -#define LABEL_ALIGN_AFTER_BARRIER(LABEL) \ - ((!TARGET_LARGE_ALIGN && i386_align_jumps > 2) ? 2 : i386_align_jumps) - -/* A C expression to output text to align the location counter in the - way that is desirable at the beginning of a loop. - - This macro need not be defined if you don't want any special - alignment to be done at such a time. Most machine descriptions do - not currently define the macro. */ - -#undef LOOP_ALIGN -#define LOOP_ALIGN(LABEL) (i386_align_loops) - -/* A C statement to output to the stdio stream STREAM an assembler - command to advance the location counter to a multiple of 2 to the - POWER bytes. POWER will be a C expression of type `int'. */ - -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(STREAM, POWER) \ - fprintf (STREAM, "\t.align\t%d\n", \ - (!TARGET_LARGE_ALIGN && (POWER) > 2) ? 2 : (POWER)) - -/* A C expression that is 1 if the RTX X is a constant which is a - valid address. On most machines, this can be defined as - `CONSTANT_P (X)', but a few machines are more restrictive in - which constant addresses are supported. - - `CONSTANT_P' accepts integer-values expressions whose values are - not explicitly known, such as `symbol_ref', `label_ref', and - `high' expressions and `const' arithmetic expressions, in - addition to `const_int' and `const_double' expressions. */ - -#define CONSTANT_ADDRESS_P_ORIG(X) \ - (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ - || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \ - || GET_CODE (X) == HIGH) - -#undef CONSTANT_ADDRESS_P -#define CONSTANT_ADDRESS_P(X) \ - ((CONSTANT_ADDRESS_P_ORIG (X)) && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X))) - -/* Nonzero if the constant value X is a legitimate general operand. - It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ - -#undef LEGITIMATE_CONSTANT_P -#define LEGITIMATE_CONSTANT_P(X) \ - (!HALF_PIC_P () \ - || GET_CODE (X) == CONST_DOUBLE \ - || GET_CODE (X) == CONST_INT \ - || !HALF_PIC_ADDRESS_P (X)) - -/* Sometimes certain combinations of command options do not make sense - on a particular target machine. You can define a macro - `OVERRIDE_OPTIONS' to take account of this. This macro, if - defined, is executed once just after all the command options have - been parsed. */ - -#undef SUBTARGET_OVERRIDE_OPTIONS -#define SUBTARGET_OVERRIDE_OPTIONS \ -{ \ - /* \ - if (TARGET_ELF && TARGET_HALF_PIC) \ - { \ - target_flags &= ~MASK_HALF_PIC; \ - flag_pic = 1; \ - } \ - */ \ - \ - if (TARGET_ROSE && flag_pic) \ - { \ - target_flags |= MASK_HALF_PIC; \ - flag_pic = 0; \ - } \ - \ - if (TARGET_HALF_PIC) \ - half_pic_init (); \ -} - -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - The macro definition, if any, is executed immediately after the - rtl for DECL has been created and stored in `DECL_RTL (DECL)'. - The value of the rtl will be a `mem' whose address is a - `symbol_ref'. - - The usual thing for this macro to do is to a flag in the - `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified - name string in the `symbol_ref' (if one bit is not enough - information). - - The best way to modify the name string is by adding text to the - beginning, with suitable punctuation to prevent any ambiguity. - Allocate the new name in `saveable_obstack'. You will have to - modify `ASM_OUTPUT_LABELREF' to remove and decode the added text - and output the name accordingly. - - You can also check the information stored in the `symbol_ref' in - the definition of `GO_IF_LEGITIMATE_ADDRESS' or - `PRINT_OPERAND_ADDRESS'. */ - -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) \ -do \ - { \ - if (HALF_PIC_P ()) \ - HALF_PIC_ENCODE (DECL); \ - \ - else if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - } \ -while (0) - - -/* On most machines, read-only variables, constants, and jump tables - are placed in the text section. If this is not the case on your - machine, this macro should be defined to be the name of a function - (either `data_section' or a function defined in `EXTRA_SECTIONS') - that switches to the section to be used for read-only items. - - If these items should be placed in the text section, this macro - should not be defined. */ - -#if 0 -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION() \ -do \ - { \ - if (TARGET_ELF) \ - { \ - if (in_section != in_rodata) \ - { \ - fprintf (asm_out_file, "\t.section \"rodata\"\n"); \ - in_section = in_rodata; \ - } \ - } \ - else \ - text_section (); \ - } \ -while (0) -#endif - -/* A list of names for sections other than the standard two, which are - `in_text' and `in_data'. You need not define this macro on a - system with no other sections (that GCC needs to use). */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_rodata, in_data1 - -/* Given a decl node or constant node, choose the section to output it in - and select that section. */ - -#undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE, RTX) \ -do \ - { \ - if (MODE == Pmode && HALF_PIC_P () && HALF_PIC_ADDRESS_P (RTX)) \ - data_section (); \ - else \ - readonly_data_section (); \ - } \ -while (0) - -#undef SELECT_SECTION -#define SELECT_SECTION(DECL, RELOC) \ -{ \ - if (RELOC && HALF_PIC_P ()) \ - data_section (); \ - \ - else if (TREE_CODE (DECL) == STRING_CST) \ - { \ - if (flag_writable_strings) \ - data_section (); \ - else \ - readonly_data_section (); \ - } \ - \ - else if (TREE_CODE (DECL) != VAR_DECL) \ - readonly_data_section (); \ - \ - else if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ - || !DECL_INITIAL (DECL) \ - || (DECL_INITIAL (DECL) != error_mark_node \ - && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ - data_section (); \ - \ - else \ - readonly_data_section (); \ -} - - -/* Define the strings used for the special svr4 .type and .size directives. - These strings generally do not vary from one system running svr4 to - another, but if a given system (e.g. m88k running svr) needs to use - different pseudo-op names for these, they may be overridden in the - file which includes this one. */ - -#define TYPE_ASM_OP ".type" -#define SIZE_ASM_OP ".size" -#define SET_ASM_OP ".set" - -/* This is how we tell the assembler that a symbol is weak. */ - -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -/* The following macro defines the format used to output the second - operand of the .type assembler directive. Different svr4 assemblers - expect various different forms for this operand. The one given here - is just a default. You may need to override it in your machine- - specific tm.h file (depending upon the particulars of your assembler). */ - -#define TYPE_OPERAND_FMT "@%s" - -/* A C statement (sans semicolon) to output to the stdio stream - STREAM any text necessary for declaring the name NAME of an - initialized variable which is being defined. This macro must - output the label definition (perhaps using `ASM_OUTPUT_LABEL'). - The argument DECL is the `VAR_DECL' tree node representing the - variable. - - If this macro is not defined, then the variable name is defined - in the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */ - -#undef ASM_DECLARE_OBJECT_NAME -#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ -do \ - { \ - ASM_OUTPUT_LABEL(STREAM,NAME); \ - HALF_PIC_DECLARE (NAME); \ - if (TARGET_ELF) \ - { \ - fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (STREAM, NAME); \ - putc (',', STREAM); \ - fprintf (STREAM, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', STREAM); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (STREAM, NAME); \ - fprintf (STREAM, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - } \ - } \ -while (0) - -/* Output the size directive for a decl in rest_of_decl_compilation - in the case where we did not do so before the initializer. - Once we find the error_mark_node, we know that the value of - size_directive_output was set - by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ - -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (TARGET_ELF \ - && !flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - } while (0) - -/* This is how to declare a function name. */ - -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \ -do \ - { \ - ASM_OUTPUT_LABEL(STREAM,NAME); \ - HALF_PIC_DECLARE (NAME); \ - if (TARGET_ELF) \ - { \ - fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (STREAM, NAME); \ - putc (',', STREAM); \ - fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', STREAM); \ - ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \ - } \ - } \ -while (0) - -/* Write the extra assembler code needed to declare a function's result. - Most svr4 assemblers don't require any special declaration of the - result value, but there are exceptions. */ - -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -/* This is how to declare the size of a function. */ - -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ -do \ - { \ - if (TARGET_ELF && !flag_inhibit_size_directive) \ - { \ - char label[256]; \ - static int labelno; \ - labelno++; \ - ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, (FNAME)); \ - fprintf (FILE, ","); \ - assemble_name (FILE, label); \ - fprintf (FILE, "-"); \ - assemble_name (FILE, (FNAME)); \ - putc ('\n', FILE); \ - } \ - } \ -while (0) - -/* Attach a special .ident directive to the end of the file to identify - the version of GCC which compiled this code. The format of the - .ident string is patterned after the ones produced by native svr4 - C compilers. */ - -#define IDENT_ASM_OP ".ident" - -/* Allow #sccs in preprocessor. */ - -#define SCCS_DIRECTIVE - -/* This says what to print at the end of the assembly file */ -#define ASM_FILE_END(STREAM) \ -do \ - { \ - if (HALF_PIC_P ()) \ - HALF_PIC_FINISH (STREAM); \ - \ - if (!flag_no_ident) \ - { \ - char *fstart = main_input_filename; \ - char *fname; \ - \ - if (!fstart) \ - fstart = ""; \ - \ - fname = fstart + strlen (fstart) - 1; \ - while (fname > fstart && *fname != '/') \ - fname--; \ - \ - if (*fname == '/') \ - fname++; \ - \ - fprintf ((STREAM), "\t%s\t\"GCC: (GNU) %s %s -O%d", \ - IDENT_ASM_OP, version_string, fname, optimize); \ - \ - if (write_symbols == PREFERRED_DEBUGGING_TYPE) \ - fprintf ((STREAM), " -g%d", (int)debug_info_level); \ - \ - else if (write_symbols == DBX_DEBUG) \ - fprintf ((STREAM), " -gstabs%d", (int)debug_info_level); \ - \ - else if (write_symbols == DWARF_DEBUG) \ - fprintf ((STREAM), " -gdwarf%d", (int)debug_info_level); \ - \ - else if (write_symbols != NO_DEBUG) \ - fprintf ((STREAM), " -g??%d", (int)debug_info_level); \ - \ - if (flag_omit_frame_pointer) \ - fprintf ((STREAM), " -fomit-frame-pointer"); \ - \ - if (flag_strength_reduce) \ - fprintf ((STREAM), " -fstrength-reduce"); \ - \ - if (flag_unroll_loops) \ - fprintf ((STREAM), " -funroll-loops"); \ - \ - if (flag_schedule_insns) \ - fprintf ((STREAM), " -fschedule-insns"); \ - \ - if (flag_schedule_insns_after_reload) \ - fprintf ((STREAM), " -fschedule-insns2"); \ - \ - if (flag_force_mem) \ - fprintf ((STREAM), " -fforce-mem"); \ - \ - if (flag_force_addr) \ - fprintf ((STREAM), " -fforce-addr"); \ - \ - if (flag_inline_functions) \ - fprintf ((STREAM), " -finline-functions"); \ - \ - if (flag_caller_saves) \ - fprintf ((STREAM), " -fcaller-saves"); \ - \ - if (flag_pic) \ - fprintf ((STREAM), (flag_pic > 1) ? " -fPIC" : " -fpic"); \ - \ - if (flag_inhibit_size_directive) \ - fprintf ((STREAM), " -finhibit-size-directive"); \ - \ - if (flag_gnu_linker) \ - fprintf ((STREAM), " -fgnu-linker"); \ - \ - if (profile_flag) \ - fprintf ((STREAM), " -p"); \ - \ - if (profile_block_flag) \ - fprintf ((STREAM), " -a"); \ - \ - if (TARGET_IEEE_FP) \ - fprintf ((STREAM), " -mieee-fp"); \ - \ - if (TARGET_HALF_PIC) \ - fprintf ((STREAM), " -mhalf-pic"); \ - \ - if (!TARGET_MOVE) \ - fprintf ((STREAM), " -mno-move"); \ - \ - if (TARGET_386) \ - fprintf ((STREAM), " -m386"); \ - \ - else if (TARGET_486) \ - fprintf ((STREAM), " -m486"); \ - \ - else \ - fprintf ((STREAM), " -munknown-machine"); \ - \ - fprintf ((STREAM), (TARGET_ELF) ? " -melf\"\n" : " -mrose\"\n"); \ - } \ - } \ -while (0) - -/* Tell collect that the object format is OSF/rose. */ -#define OBJECT_FORMAT_ROSE - -/* Tell collect where the appropriate binaries are. */ -#define REAL_NM_FILE_NAME "/usr/ccs/gcc/bfd-nm" -#define REAL_STRIP_FILE_NAME "/usr/ccs/bin/strip" - -/* Use atexit for static constructors/destructors, instead of defining - our own exit function. */ -#define HAVE_ATEXIT - -/* Define this macro meaning that gcc should find the library 'libgcc.a' - by hand, rather than passing the argument '-lgcc' to tell the linker - to do the search */ -#define LINK_LIBGCC_SPECIAL - -/* A C statement to output assembler commands which will identify the object - file as having been compile with GNU CC. We don't need or want this for - OSF1. GDB doesn't need it and kdb doesn't like it */ -#define ASM_IDENTIFY_GCC(FILE) - -/* Identify the front-end which produced this file. To keep symbol - space down, and not confuse kdb, only do this if the language is - not C. */ - -#define ASM_IDENTIFY_LANGUAGE(STREAM) \ -{ \ - if (strcmp (lang_identify (), "c") != 0) \ - output_lang_identify (STREAM); \ -} - -/* Generate calls to memcpy, etc., not bcopy, etc. */ -#define TARGET_MEM_FUNCTIONS - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* Map i386 registers to the numbers dwarf expects. Of course this is different - from what stabs expects. */ - -#define DWARF_DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ - : (-1)) - -/* Now what stabs expects in the register. */ -#define STABS_DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 : \ - (n) == 1 ? 2 : \ - (n) == 2 ? 1 : \ - (n) == 3 ? 3 : \ - (n) == 4 ? 6 : \ - (n) == 5 ? 7 : \ - (n) == 6 ? 4 : \ - (n) == 7 ? 5 : \ - (n) + 4) - -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG) \ - ? DWARF_DBX_REGISTER_NUMBER(n) \ - : STABS_DBX_REGISTER_NUMBER(n)) diff --git a/contrib/gcc/config/i386/perform.h b/contrib/gcc/config/i386/perform.h deleted file mode 100644 index 8d6d0b71dfeb..000000000000 --- a/contrib/gcc/config/i386/perform.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Definitions for AT&T assembler syntax for the Intel 80386. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Defines to be able to build libgcc.a with GCC. */ - -/* It might seem that these are not important, since gcc 2 will never - call libgcc for these functions. But programs might be linked with - code compiled by gcc 1, and then these will be used. */ - -/* The arg names used to be a and b, but `a' appears inside strings - and that confuses non-ANSI cpp. */ - -#define perform_udivsi3(arg0,arg1) \ -{ \ - register int dx asm("dx"); \ - register int ax asm("ax"); \ - \ - dx = 0; \ - ax = arg0; \ - asm ("divl %3" : "=a" (ax), "=d" (dx) : "a" (ax), "g" (arg1), "d" (dx)); \ - return ax; \ -} - -#define perform_divsi3(arg0,arg1) \ -{ \ - register int dx asm("dx"); \ - register int ax asm("ax"); \ - register int cx asm("cx"); \ - \ - ax = arg0; \ - cx = arg1; \ - asm ("cltd\n\tidivl %3" : "=a" (ax), "=&d" (dx) : "a" (ax), "c" (cx)); \ - return ax; \ -} - -#define perform_umodsi3(arg0,arg1) \ -{ \ - register int dx asm("dx"); \ - register int ax asm("ax"); \ - \ - dx = 0; \ - ax = arg0; \ - asm ("divl %3" : "=a" (ax), "=d" (dx) : "a" (ax), "g" (arg1), "d" (dx)); \ - return dx; \ -} - -#define perform_modsi3(arg0,arg1) \ -{ \ - register int dx asm("dx"); \ - register int ax asm("ax"); \ - register int cx asm("cx"); \ - \ - ax = arg0; \ - cx = arg1; \ - asm ("cltd\n\tidivl %3" : "=a" (ax), "=&d" (dx) : "a" (ax), "c" (cx)); \ - return dx; \ -} - -#define perform_fixdfsi(arg0) \ -{ \ - auto unsigned short ostatus; \ - auto unsigned short nstatus; \ - auto int ret; \ - auto double tmp; \ - \ - &ostatus; /* guarantee these land in memory */ \ - &nstatus; \ - &ret; \ - &tmp; \ - \ - asm volatile ("fnstcw %0" : "=m" (ostatus)); \ - nstatus = ostatus | 0x0c00; \ - asm volatile ("fldcw %0" : /* no outputs */ : "m" (nstatus)); \ - tmp = arg0; \ - asm volatile ("fldl %0" : /* no outputs */ : "m" (tmp)); \ - asm volatile ("fistpl %0" : "=m" (ret)); \ - asm volatile ("fldcw %0" : /* no outputs */ : "m" (ostatus)); \ - \ - return ret; \ -} - diff --git a/contrib/gcc/config/i386/ptx4-i.h b/contrib/gcc/config/i386/ptx4-i.h deleted file mode 100644 index 1537b4a4ceee..000000000000 --- a/contrib/gcc/config/i386/ptx4-i.h +++ /dev/null @@ -1,247 +0,0 @@ -/* Target definitions for GNU compiler for Intel 80386 running Dynix/ptx v4 - Copyright (C) 1996 Free Software Foundation, Inc. - - Modified from sysv4.h - Originally written by Ron Guilmette (rfg@netcom.com). - Modified by Tim Wright (timw@sequent.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/i386.h" /* Base i386 target machine definitions */ -#include "i386/att.h" /* Use the i386 AT&T assembler syntax */ -#include "ptx4.h" /* Rest of definitions (non architecture dependent) */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 Sequent Dynix/ptx Version 4)"); - -/* The svr4 ABI for the i386 says that records and unions are returned - in memory. */ - -#undef RETURN_IN_MEMORY -#define RETURN_IN_MEMORY(TYPE) \ - (TYPE_MODE (TYPE) == BLKmode) - -/* Define which macros to predefine. _SEQUENT_ is our extension. */ -/* This used to define X86, but james@bigtex.cactus.org says that - is supposed to be defined optionally by user programs--not by default. */ -#define CPP_PREDEFINES \ - "-Di386 -Dunix -D_SEQUENT_ -Asystem(unix) -Asystem(ptx4) -Acpu(i386) -Amachine(i386)" - -/* This is how to output assembly code to define a `float' constant. - We always have to use a .long pseudo-op to do this because the native - SVR4 ELF assembler is buggy and it generates incorrect values when we - try to use the .float pseudo-op instead. */ - -#undef ASM_OUTPUT_FLOAT -#define ASM_OUTPUT_FLOAT(FILE,VALUE) \ -do { long value; \ - REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value); \ - if (sizeof (int) == sizeof (long)) \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value); \ - else \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value); \ - } while (0) - -/* This is how to output assembly code to define a `double' constant. - We always have to use a pair of .long pseudo-ops to do this because - the native SVR4 ELF assembler is buggy and it generates incorrect - values when we try to use the .double pseudo-op instead. */ - -#undef ASM_OUTPUT_DOUBLE -#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ -do { long value[2]; \ - REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value); \ - if (sizeof (int) == sizeof (long)) \ - { \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \ - } \ - else \ - { \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \ - } \ - } while (0) - - -#undef ASM_OUTPUT_LONG_DOUBLE -#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \ -do { long value[3]; \ - REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value); \ - if (sizeof (int) == sizeof (long)) \ - { \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[2]); \ - } \ - else \ - { \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[2]); \ - } \ - } while (0) - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - output_file_directive (FILE, main_input_filename); \ - fprintf (FILE, "\t.version\t\"01.01\"\n"); \ - } while (0) - -/* Define the register numbers to be used in Dwarf debugging information. - The SVR4 reference port C compiler uses the following register numbers - in its Dwarf output code: - - 0 for %eax (gnu regno = 0) - 1 for %ecx (gnu regno = 2) - 2 for %edx (gnu regno = 1) - 3 for %ebx (gnu regno = 3) - 4 for %esp (gnu regno = 7) - 5 for %ebp (gnu regno = 6) - 6 for %esi (gnu regno = 4) - 7 for %edi (gnu regno = 5) - - The following three DWARF register numbers are never generated by - the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4 - believes these numbers have these meanings. - - 8 for %eip (no gnu equivalent) - 9 for %eflags (no gnu equivalent) - 10 for %trapno (no gnu equivalent) - - It is not at all clear how we should number the FP stack registers - for the x86 architecture. If the version of SDB on x86/svr4 were - a bit less brain dead with respect to floating-point then we would - have a precedent to follow with respect to DWARF register numbers - for x86 FP registers, but the SDB on x86/svr4 is so completely - broken with respect to FP registers that it is hardly worth thinking - of it as something to strive for compatibility with. - - The version of x86/svr4 SDB I have at the moment does (partially) - seem to believe that DWARF register number 11 is associated with - the x86 register %st(0), but that's about all. Higher DWARF - register numbers don't seem to be associated with anything in - particular, and even for DWARF regno 11, SDB only seems to under- - stand that it should say that a variable lives in %st(0) (when - asked via an `=' command) if we said it was in DWARF regno 11, - but SDB still prints garbage when asked for the value of the - variable in question (via a `/' command). - - (Also note that the labels SDB prints for various FP stack regs - when doing an `x' command are all wrong.) - - Note that these problems generally don't affect the native SVR4 - C compiler because it doesn't allow the use of -O with -g and - because when it is *not* optimizing, it allocates a memory - location for each floating-point variable, and the memory - location is what gets described in the DWARF AT_location - attribute for the variable in question. - - Regardless of the severe mental illness of the x86/svr4 SDB, we - do something sensible here and we use the following DWARF - register numbers. Note that these are all stack-top-relative - numbers. - - 11 for %st(0) (gnu regno = 8) - 12 for %st(1) (gnu regno = 9) - 13 for %st(2) (gnu regno = 10) - 14 for %st(3) (gnu regno = 11) - 15 for %st(4) (gnu regno = 12) - 16 for %st(5) (gnu regno = 13) - 17 for %st(6) (gnu regno = 14) - 18 for %st(7) (gnu regno = 15) -*/ - -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ - : (-1)) - -/* The routine used to output sequences of byte values. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable. Note that if we find subparts of the - character sequence which end with NUL (and which are shorter than - STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ - -#undef ASM_OUTPUT_ASCII -#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ - do \ - { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ - register unsigned bytes_in_chunk = 0; \ - for (; _ascii_bytes < limit; _ascii_bytes++) \ - { \ - register unsigned char *p; \ - if (bytes_in_chunk >= 64) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ - continue; \ - if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ - { \ - if (bytes_in_chunk > 0) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ - _ascii_bytes = p; \ - } \ - else \ - { \ - if (bytes_in_chunk == 0) \ - fprintf ((FILE), "\t.byte\t"); \ - else \ - fputc (',', (FILE)); \ - fprintf ((FILE), "0x%02x", *_ascii_bytes); \ - bytes_in_chunk += 5; \ - } \ - } \ - if (bytes_in_chunk > 0) \ - fprintf ((FILE), "\n"); \ - } \ - while (0) - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ - -#define JUMP_TABLES_IN_TEXT_SECTION 1 diff --git a/contrib/gcc/config/i386/rtems.h b/contrib/gcc/config/i386/rtems.h deleted file mode 100644 index 60e6dc7c4197..000000000000 --- a/contrib/gcc/config/i386/rtems.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Definitions for rtems targeting an Intel i386 using coff. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Joel Sherrill (joel@OARcorp.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/i386-coff.h" - -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386 -Drtems -D__rtems__ \ - -Asystem(rtems) -Acpu(i386) -Amachine(i386)" - -/* Generate calls to memcpy, memcmp and memset. */ -#ifndef TARGET_MEM_FUNCTIONS -#define TARGET_MEM_FUNCTIONS -#endif - diff --git a/contrib/gcc/config/i386/rtemself.h b/contrib/gcc/config/i386/rtemself.h deleted file mode 100644 index d9d97337aa95..000000000000 --- a/contrib/gcc/config/i386/rtemself.h +++ /dev/null @@ -1,169 +0,0 @@ -/* Definitions for Intel 386 running Linux-based GNU systems with ELF format. - Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Eric Youngdale. - Modified for stabs-in-ELF by H.J. Lu. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define LINUX_DEFAULT_ELF - -/* A lie, I guess, but the general idea behind linux/ELF is that we are - supposed to be outputting something that will assemble under SVr4. - This gets us pretty close. */ -#include /* Base i386 target machine definitions */ -#include /* Use the i386 AT&T assembler syntax */ -#include /* some common stuff */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 RTEMS with ELF)"); - -/* The svr4 ABI for the i386 says that records and unions are returned - in memory. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 1 - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ -#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) - -/* Copy this from the svr4 specifications... */ -/* Define the register numbers to be used in Dwarf debugging information. - The SVR4 reference port C compiler uses the following register numbers - in its Dwarf output code: - 0 for %eax (gnu regno = 0) - 1 for %ecx (gnu regno = 2) - 2 for %edx (gnu regno = 1) - 3 for %ebx (gnu regno = 3) - 4 for %esp (gnu regno = 7) - 5 for %ebp (gnu regno = 6) - 6 for %esi (gnu regno = 4) - 7 for %edi (gnu regno = 5) - The following three DWARF register numbers are never generated by - the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4 - believes these numbers have these meanings. - 8 for %eip (no gnu equivalent) - 9 for %eflags (no gnu equivalent) - 10 for %trapno (no gnu equivalent) - It is not at all clear how we should number the FP stack registers - for the x86 architecture. If the version of SDB on x86/svr4 were - a bit less brain dead with respect to floating-point then we would - have a precedent to follow with respect to DWARF register numbers - for x86 FP registers, but the SDB on x86/svr4 is so completely - broken with respect to FP registers that it is hardly worth thinking - of it as something to strive for compatibility with. - The version of x86/svr4 SDB I have at the moment does (partially) - seem to believe that DWARF register number 11 is associated with - the x86 register %st(0), but that's about all. Higher DWARF - register numbers don't seem to be associated with anything in - particular, and even for DWARF regno 11, SDB only seems to under- - stand that it should say that a variable lives in %st(0) (when - asked via an `=' command) if we said it was in DWARF regno 11, - but SDB still prints garbage when asked for the value of the - variable in question (via a `/' command). - (Also note that the labels SDB prints for various FP stack regs - when doing an `x' command are all wrong.) - Note that these problems generally don't affect the native SVR4 - C compiler because it doesn't allow the use of -O with -g and - because when it is *not* optimizing, it allocates a memory - location for each floating-point variable, and the memory - location is what gets described in the DWARF AT_location - attribute for the variable in question. - Regardless of the severe mental illness of the x86/svr4 SDB, we - do something sensible here and we use the following DWARF - register numbers. Note that these are all stack-top-relative - numbers. - 11 for %st(0) (gnu regno = 8) - 12 for %st(1) (gnu regno = 9) - 13 for %st(2) (gnu regno = 10) - 14 for %st(3) (gnu regno = 11) - 15 for %st(4) (gnu regno = 12) - 16 for %st(5) (gnu regno = 13) - 17 for %st(6) (gnu regno = 14) - 18 for %st(7) (gnu regno = 15) -*/ -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ - : (-1)) - -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -{ \ - if (flag_pic) \ - { \ - fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ - LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \ - fprintf (FILE, "\tcall mcount\n"); \ - } \ -} - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Di386 -Drtems -D__rtems__ \ - -Asystem(rtems) -Acpu(i386) -Amachine(i386)" - -/* Get perform_* macros to build libgcc.a. */ -#include "i386/perform.h" - -/* A C statement (sans semicolon) to output to the stdio stream - FILE the assembler definition of uninitialized global DECL named - NAME whose size is SIZE bytes and alignment is ALIGN bytes. - Try to use asm_output_aligned_bss to implement this macro. */ - -#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ - asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "crt0.o%s" - -#undef ENDFILE_SPEC - diff --git a/contrib/gcc/config/i386/sco.h b/contrib/gcc/config/i386/sco.h deleted file mode 100644 index 55af64128a10..000000000000 --- a/contrib/gcc/config/i386/sco.h +++ /dev/null @@ -1,117 +0,0 @@ -/* Definitions for Intel 386 running SCO Unix System V. - Copyright (C) 1988, 92, 94, 95, 96, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Mostly it's like AT&T Unix System V. */ - -#include "i386/sysv3.h" - -/* By default, target has a 80387, uses IEEE compatible arithmetic, - and returns float values in the 387, ie, - (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387) - - SCO's software emulation of a 387 fails to handle the `fucomp' - opcode. fucomp is only used when generating IEEE compliant code. - So don't make TARGET_IEEE_FP default for SCO. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_80387 | MASK_FLOAT_RETURNS) - -/* Let's guess that the SCO software FPU emulator can't handle - 80-bit XFmode insns, so don't generate them. */ -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 64 - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} crtbegin.o%s" - -#define ENDFILE_SPEC "crtend.o%s crtn.o%s" - -/* Library spec, including SCO international language support. */ - -#undef LIB_SPEC -#define LIB_SPEC \ - "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} %{scointl:libintl.a%s} -lc" - -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -DM_UNIX -DM_I386 -DM_COFF -DM_WORDSWAP -Asystem(svr3)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %{scointl:-DM_INTERNAT}" - -/* This spec is used for telling cpp whether char is signed or not. */ - -#undef SIGNED_CHAR_SPEC -#if DEFAULT_SIGNED_CHAR -#define SIGNED_CHAR_SPEC \ - "%{funsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}" -#else -#define SIGNED_CHAR_SPEC \ - "%{!fsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}" -#endif - -/* Use atexit for static destructors, instead of defining - our own exit function. */ -#define HAVE_ATEXIT - -/* Specify the size_t type. */ -#define SIZE_TYPE "unsigned int" - -#if 0 /* Not yet certain whether this is needed. */ -/* If no 387, use the general regs to return floating values, - since this system does not emulate the 80387. */ - -#undef VALUE_REGNO -#define VALUE_REGNO(MODE) \ - ((TARGET_80387 - && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode) - ? FIRST_FLOAT_REG : 0) - -#undef HARD_REGNO_MODE_OK -#define HARD_REGNO_MODE_OK(REGNO, MODE) \ - ((REGNO) < 2 ? 1 \ - : (REGNO) < 4 ? 1 \ - : FP_REGNO_P (REGNO) ? ((GET_MODE_CLASS (MODE) == MODE_FLOAT \ - || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \ - && TARGET_80387 \ - && GET_MODE_UNIT_SIZE (MODE) <= 8) \ - : (MODE) != QImode) -#endif - -/* caller has to pop the extra argument passed to functions that return - structures. */ - -#undef RETURN_POPS_ARGS -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ - ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE ? 0 \ - : (TARGET_RTD \ - && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ - == void_type_node))) ? (SIZE) \ - : 0) -/* On other 386 systems, the last line looks like this: - : (aggregate_value_p (TREE_TYPE (FUNTYPE))) ? GET_MODE_SIZE (Pmode) : 0) */ - -/* Handle #pragma pack. */ -#define HANDLE_SYSV_PRAGMA diff --git a/contrib/gcc/config/i386/sco4.h b/contrib/gcc/config/i386/sco4.h deleted file mode 100644 index 5d1ea471dbf8..000000000000 --- a/contrib/gcc/config/i386/sco4.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 4. - Written by Chip Salzenberg. - Copyright (C) 1992, 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Mostly it's like earlier SCO UNIX. */ - -#include "i386/sco.h" - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{scoxpg3:%{p:mcrt1X.o%s}%{!p:crt1X.o%s}} \ - %{!scoxpg3:\ - %{posix:%{p:mcrt1P.o%s}%{!p:crt1P.o%s}} \ - %{!posix:\ - %{ansi:%{p:mcrt1A.o%s}%{!p:crt1A.o%s}} \ - %{!ansi:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}} \ - crtbegin.o%s" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "crtend.o%s \ - %{scoxpg3:crtnX.o%s} \ - %{!scoxpg3:\ - %{posix:crtnP.o%s} \ - %{!posix:\ - %{ansi:crtnA.o%s} \ - %{!ansi:crtn.o%s}}}" - -/* Library spec. */ - -#undef LIB_SPEC -#define LIB_SPEC \ - "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} \ - %{scoxpg3:-lcX -lcP -lcA} \ - %{!scoxpg3:\ - %{posix:-lcP -lcA} \ - %{!posix:\ - %{ansi:-lcA} \ - %{!ansi:%{scointl:-lintl} -lc}}}" - -/* Macros, macros everywhere: - Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES \ - "-Asystem(svr3)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) \ - -D_i386 -D_M_I386 -D_M_I86 -D_M_I86SM -D_M_SDATA -D_M_STEXT \ - -D_unix -D_M_UNIX -D_M_XENIX \ - -D_M_SYS5 -D_M_SYSV -D_M_SYS3 -D_M_SYSIII \ - -D_M_COFF -D_M_BITFIELDS -D_M_WORDSWAP \ - %{scoxpg3:-D_XOPEN_SOURCE -D_STRICT_NAMES} \ - %{!scoxpg3:%{posix:-D_POSIX_SOURCE -D_STRICT_NAMES}} \ - %{!scoxpg3:%{!posix:\ - %{ansi:-D_STRICT_NAMES}%{!ansi:\ - -Di386 -DM_I386 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \ - -Dunix -DM_UNIX -DM_XENIX \ - -DM_SYS5 -DM_SYSV -DM_SYS3 -DM_SYSIII \ - -DM_COFF -DM_BITFIELDS -DM_WORDSWAP \ - %{scointl:-D_M_INTERNAT -DM_INTERNAT} \ - %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE}}}}" - -/* The system headers are C++-aware. */ -#define NO_IMPLICIT_EXTERN_C diff --git a/contrib/gcc/config/i386/sco4dbx.h b/contrib/gcc/config/i386/sco4dbx.h deleted file mode 100644 index 3d075b6a2e26..000000000000 --- a/contrib/gcc/config/i386/sco4dbx.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 4.s, - using dbx-in-coff encapsulation. - Copyright (C) 1992 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Mostly it's like earlier SCO UNIX. */ - -#include "i386/scodbx.h" - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!r:%{!z:gcc.ifile%s}%{z:gccz.ifile%s}}\ - %{scoxpg3:%{p:mcrt1X.o%s}%{!p:crt1X.o%s}} \ - %{!scoxpg3:\ - %{posix:%{p:mcrt1P.o%s}%{!p:crt1P.o%s}} \ - %{!posix:\ - %{ansi:%{p:mcrt1A.o%s}%{!p:crt1A.o%s}} \ - %{!ansi:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{scoxpg3:crtnX.o%s} \ - %{!scoxpg3:\ - %{posix:crtnP.o%s} \ - %{!posix:\ - %{ansi:crtnA.o%s} \ - %{!ansi:crtn.o%s}}}" - -/* Library spec. */ - -#undef LIB_SPEC -#define LIB_SPEC \ - "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} \ - %{scoxpg3:-lcX -lcP -lcA} \ - %{!scoxpg3:\ - %{posix:-lcP -lcA} \ - %{!posix:\ - %{ansi:-lcA} \ - %{!ansi:%{scointl:-lintl} -lc}}}" - -/* Macros, macros everywhere: - Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Asystem(svr3)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) \ - -D_M_I386 -D_M_I86 -D_M_I86SM -D_M_SDATA -D_M_STEXT \ - -D_M_UNIX -D_M_XENIX \ - -D_M_SYS5 -D_M_SYSV -D_M_SYS3 -D_M_SYSIII \ - -D_M_COFF -D_M_BITFIELDS -D_M_WORDSWAP \ - %{scoxpg3:-D_XOPEN_SOURCE -D_STRICT_NAMES} \ - %{!scoxpg3:%{posix:-D_POSIX_SOURCE -D_STRICT_NAMES}} \ - %{!scoxpg3:%{!posix:\ - %{ansi:-D_STRICT_NAMES}%{!ansi:\ - -DM_I386 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \ - -DM_UNIX -DM_XENIX \ - -DM_SYS5 -DM_SYSV -DM_SYS3 -DM_SYSIII \ - -DM_COFF -DM_BITFIELDS -DM_WORDSWAP \ - %{scointl:-D_M_INTERNAT -DM_INTERNAT} \ - %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE}}}}" diff --git a/contrib/gcc/config/i386/sco5.h b/contrib/gcc/config/i386/sco5.h deleted file mode 100644 index ac4e7e1e0948..000000000000 --- a/contrib/gcc/config/i386/sco5.h +++ /dev/null @@ -1,976 +0,0 @@ -/* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5. - Copyright (C) 1992, 95-98, 1999 Free Software Foundation, Inc. - Contributed by Kean Johnston (hug@netcom.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/i386.h" /* Base i386 target definitions */ -#include "i386/att.h" /* Use AT&T i386 assembler syntax */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)"); - -#undef LPREFIX -#define LPREFIX ".L" - -#undef ALIGN_ASM_OP -#define ALIGN_ASM_OP "\t.align" - -#undef ASCII_DATA_ASM_OP -#define ASCII_DATA_ASM_OP "\t.ascii" - -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\t.byte" - -#undef IDENT_ASM_OP -#define IDENT_ASM_OP "\t.ident" - -#undef COMMON_ASM_OP -#define COMMON_ASM_OP "\t.comm" - -#undef SET_ASM_OP -#define SET_ASM_OP "\t.set" - -#undef LOCAL_ASM_OP -#define LOCAL_ASM_OP "\t.local" - -#undef INT_ASM_OP -#define INT_ASM_OP "\t.long" - -#undef ASM_SHORT -#define ASM_SHORT "\t.value" - -#undef ASM_LONG -#define ASM_LONG "\t.long" - -#undef ASM_DOUBLE -#define ASM_DOUBLE "\t.double" - -#undef TYPE_ASM_OP -#define TYPE_ASM_OP "\t.type" - -#undef SIZE_ASM_OP -#define SIZE_ASM_OP "\t.size" - -#undef STRING_ASM_OP -#define STRING_ASM_OP "\t.string" - -#undef SKIP_ASM_OP -#define SKIP_ASM_OP "\t.zero" - -#undef GLOBAL_ASM_OP -#define GLOBAL_ASM_OP "\t.globl" - -#undef EH_FRAME_SECTION_ASM_OP -#define EH_FRAME_SECTION_ASM_OP_COFF "\t.section\t.ehfram, \"x\"" -#define EH_FRAME_SECTION_ASM_OP_ELF "\t.section\t.eh_frame, \"aw\"" -#define EH_FRAME_SECTION_ASM_OP \ - ((TARGET_ELF) ? EH_FRAME_SECTION_ASM_OP_ELF : EH_FRAME_SECTION_ASM_OP_COFF) - -/* Avoid problems (long sectino names, forward assembler refs) with DWARF - exception unwinding when we're generating COFF */ -#define DWARF2_UNWIND_INFO \ - ((TARGET_ELF) ? 1 : 0 ) - -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP_COFF "\t.section\t.rodata, \"x\"" -#define CONST_SECTION_ASM_OP_ELF "\t.section\t.rodata" -#define CONST_SECTION_ASM_OP \ - ((TARGET_ELF) ? CONST_SECTION_ASM_OP_ELF : CONST_SECTION_ASM_OP_COFF) - -#undef USE_CONST_SECTION -#define USE_CONST_SECTION_ELF 1 -#define USE_CONST_SECTION_COFF 0 -#define USE_CONST_SECTION \ - ((TARGET_ELF) ? USE_CONST_SECTION_ELF : USE_CONST_SECTION_COFF) - -#undef INIT_SECTION_ASM_OP -#define INIT_SECTION_ASM_OP_ELF "\t.section\t.init" -#define INIT_SECTION_ASM_OP_COFF "\t.section\t.init ,\"x\"" -#define INIT_SECTION_ASM_OP \ - ((TARGET_ELF) ? INIT_SECTION_ASM_OP_ELF : INIT_SECTION_ASM_OP_COFF) - -#undef CTORS_SECTION_ASM_OP -#define CTORS_SECTION_ASM_OP_ELF "\t.section\t.ctors,\"aw\"" -#define CTORS_SECTION_ASM_OP_COFF INIT_SECTION_ASM_OP_COFF -#define CTORS_SECTION_ASM_OP \ - ((TARGET_ELF) ? CTORS_SECTION_ASM_OP_ELF : CTORS_SECTION_ASM_OP_COFF) - -#undef DTORS_SECTION_ASM_OP -#define DTORS_SECTION_ASM_OP_ELF "\t.section\t.dtors, \"aw\"" -#define DTORS_SECTION_ASM_OP_COFF FINI_SECTION_ASM_OP_COFF -#define DTORS_SECTION_ASM_OP \ - ((TARGET_ELF) ? DTORS_SECTION_ASM_OP_ELF : DTORS_SECTION_ASM_OP_COFF) - -#undef FINI_SECTION_ASM_OP -#define FINI_SECTION_ASM_OP_ELF "\t.section\t.fini" -#define FINI_SECTION_ASM_OP_COFF "\t.section\t.fini, \"x\"" -#define FINI_SECTION_ASM_OP \ - ((TARGET_ELF) ? FINI_SECTION_ASM_OP_ELF : FINI_SECTION_ASM_OP_COFF) - -#undef BSS_SECTION_ASM_OP -#define BSS_SECTION_ASM_OP "\t.data" - -#undef TEXT_SECTION_ASM_OP -#define TEXT_SECTION_ASM_OP "\t.text" - -#undef DATA_SECTION_ASM_OP -#define DATA_SECTION_ASM_OP "\t.data" - -#undef TYPE_OPERAND_FMT -#define TYPE_OPERAND_FMT "@%s" - -#undef APPLY_RESULT_SIZE -#define APPLY_RESULT_SIZE \ -(TARGET_ELF) ? size : 116 - -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -#define SCO_DEFAULT_ASM_COFF(FILE,NAME) \ -do { \ - ASM_OUTPUT_LABEL (FILE, NAME); \ - } while (0) - -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do { \ - if (TARGET_ELF) { \ - fprintf (FILE, "%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', FILE); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } else \ - SCO_DEFAULT_ASM_COFF(FILE, NAME); \ -} while (0) - -#undef ASM_DECLARE_FUNCTION_SIZE -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (TARGET_ELF) { if (!flag_inhibit_size_directive) \ - { \ - fprintf (FILE, "%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, (FNAME)); \ - fprintf (FILE, ",.-"); \ - assemble_name (FILE, (FNAME)); \ - putc ('\n', FILE); \ - } } \ - } while (0) - -#undef ASM_DECLARE_OBJECT_NAME -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ - do { \ - if (TARGET_ELF) { \ - fprintf (FILE, "%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', FILE); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } else \ - SCO_DEFAULT_ASM_COFF(FILE, NAME); \ - } while (0) - -#undef ASM_FILE_START_1 -#define ASM_FILE_START_1(FILE) - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ -do { \ - output_file_directive((FILE),main_input_filename); \ - fprintf ((FILE), "\t.version\t\"01.01\"\n"); \ -} while (0) - -#undef ASM_FILE_END -#define ASM_FILE_END(FILE) \ -do { \ - if (!flag_no_ident) \ - fprintf ((FILE), "%s\t\"GCC: (GNU) %s\"\n", \ - IDENT_ASM_OP, version_string); \ -} while (0) - -#undef ASM_FINISH_DECLARE_OBJECT -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - if (TARGET_ELF) { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - } \ -} while (0) - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ -do { \ - if (TARGET_ELF) \ - sprintf (LABEL, "*.%s%d", (PREFIX), (NUM)); \ - else \ - sprintf (LABEL, ".%s%d", (PREFIX), (NUM)); \ -} while (0) - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ -do { \ - if (TARGET_ELF) \ - fprintf (FILE, "%s _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", ASM_LONG, LPREFIX, VALUE); \ - else \ - fprintf (FILE, "\t.word %s%d-%s%d\n", LPREFIX,VALUE,LPREFIX,REL); \ -} while (0) - -#undef ASM_OUTPUT_ALIGNED_COMMON -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "%s\t", COMMON_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - if (TARGET_ELF) \ - fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ - else \ - fprintf ((FILE), ",%u\n", (SIZE)); \ -} while (0) - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - if (TARGET_ELF) { \ - fprintf ((FILE), "%s\t", LOCAL_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), "\n"); \ - ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ - } else { \ - int align = exact_log2 (ALIGN); \ - if (align > 2) align = 2; \ - if (TARGET_SVR3_SHLIB) \ - data_section (); \ - else \ - bss_section (); \ - ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \ - fprintf ((FILE), "%s\t", "\t.lcomm"); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u\n", (SIZE)); \ - } \ -} while (0) - -/* A C statement (sans semicolon) to output to the stdio stream - FILE the assembler definition of uninitialized global DECL named - NAME whose size is SIZE bytes and alignment is ALIGN bytes. - Try to use asm_output_aligned_bss to implement this macro. */ - -#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ -asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) - -#undef ESCAPES -#define ESCAPES \ -"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" - -#undef STRING_LIMIT -#define STRING_LIMIT ((unsigned) 256) - -#undef ASM_OUTPUT_LIMITED_STRING -#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ - do \ - { \ - register unsigned char *_limited_str = (unsigned char *) (STR); \ - register unsigned ch; \ - fprintf ((FILE), "%s\t\"", STRING_ASM_OP); \ - for (; (ch = *_limited_str); _limited_str++) \ - { \ - register int escape; \ - switch (escape = ESCAPES[ch]) \ - { \ - case 0: \ - putc (ch, (FILE)); \ - break; \ - case 1: \ - fprintf ((FILE), "\\%03o", ch); \ - break; \ - default: \ - putc ('\\', (FILE)); \ - putc (escape, (FILE)); \ - break; \ - } \ - } \ - fprintf ((FILE), "\"\n"); \ - } \ - while (0) - - -#undef ASM_OUTPUT_ASCII -#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ -do { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ - register unsigned bytes_in_chunk = 0; \ - for (; _ascii_bytes < limit; _ascii_bytes++) \ - { \ - register unsigned char *p; \ - if (bytes_in_chunk >= 64) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ - continue; \ - if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ - { \ - if (bytes_in_chunk > 0) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ - _ascii_bytes = p; \ - } \ - else \ - { \ - if (bytes_in_chunk == 0) \ - fprintf ((FILE), "%s\t", ASM_BYTE_OP); \ - else \ - fputc (',', (FILE)); \ - fprintf ((FILE), "0x%02x", *_ascii_bytes); \ - bytes_in_chunk += 5; \ - } \ - } \ - if (bytes_in_chunk > 0) \ - fprintf ((FILE), "\n"); \ -} while (0) - -/* Must use data section for relocatable constants when pic. */ -#undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX) \ -{ \ - if (TARGET_ELF) { \ - if (flag_pic && symbolic_operand (RTX)) \ - data_section (); \ - else \ - const_section (); \ - } else \ - readonly_data_section(); \ -} - -#undef ASM_OUTPUT_CASE_LABEL -#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ -do { \ - if (TARGET_ELF) \ - ASM_OUTPUT_ALIGN ((FILE), 2); \ - ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \ -} while (0) - - -#undef ASM_OUTPUT_CONSTRUCTOR -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ -do { \ - if (TARGET_ELF) { \ - ctors_section (); \ - fprintf (FILE, "%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } else { \ - init_section (); \ - fprintf (FILE, "\tpushl $"); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); } \ - } while (0) - -#undef ASM_OUTPUT_DESTRUCTOR -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ -do { \ - if (TARGET_ELF) { \ - dtors_section (); \ - fprintf (FILE, "%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } else { \ - fini_section (); \ - fprintf (FILE, "%s\t ", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); } \ - } while (0) - - -#undef ASM_OUTPUT_IDENT -#define ASM_OUTPUT_IDENT(FILE, NAME) \ - fprintf (FILE, "%s\t\"%s\"\n", IDENT_ASM_OP, NAME); - -#undef ASM_GLOBALIZE_LABEL -#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ - (fprintf ((FILE), "%s ", GLOBAL_ASM_OP), assemble_name (FILE, NAME), fputs ("\n", FILE)) - -#undef ASM_OUTPUT_EXTERNAL_LIBCALL -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ - if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM) - -/* The prefix to add to user-visible assembler symbols. */ - -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "" - -/* - * Compensate for the difference between ELF and COFF assembler syntax. - * Otherwise, this is cribbed from ../svr4.h. - * We rename 'gcc_except_table' to the shorter name in preparation - * for the day when we're ready to do DWARF2 eh unwinding under COFF - */ -#undef ASM_OUTPUT_SECTION_NAME -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ -do { \ - static struct section_info \ - { \ - struct section_info *next; \ - char *name; \ - enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ - } *sections; \ - struct section_info *s; \ - char *mode; \ - enum sect_enum type; \ - char *sname = NAME ; \ - if (strcmp(NAME, ".gcc_except_table") == 0) sname = ".gccexc" ; \ - \ - for (s = sections; s; s = s->next) \ - if (!strcmp (NAME, s->name)) \ - break; \ - \ - if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ - type = SECT_EXEC, mode = (TARGET_ELF) ? "ax" : "x" ; \ - else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ - type = SECT_RO, mode = "a"; \ - else \ - type = SECT_RW, mode = (TARGET_ELF) ? "aw" : "w" ; \ - \ - if (s == 0) \ - { \ - s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ - s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ - strcpy (s->name, NAME); \ - s->type = type; \ - s->next = sections; \ - sections = s; \ - fprintf (FILE, ".section\t%s,\"%s\"%s\n", sname, mode, \ - (TARGET_ELF) ? ",@progbits" : "" ); \ - } \ - else \ - { \ - if (DECL && s->type != type) \ - error_with_decl (DECL, "%s causes a section type conflict"); \ - \ - fprintf (FILE, ".section\t%s\n", sname); \ - } \ -} while (0) - -#undef ASM_OUTPUT_SKIP -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ -do { \ - if (TARGET_ELF) \ - fprintf (FILE, "%s\t%u\n", SKIP_ASM_OP, (SIZE)); \ - else \ - fprintf ((FILE), "%s\t.,.+%u\n", SET_ASM_OP, (SIZE)); \ -} while (0) - - -#undef CTOR_LIST_BEGIN -#define CTOR_LIST_BEGIN \ -do { \ - asm (CTORS_SECTION_ASM_OP); \ - if (TARGET_ELF) \ - STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; \ - else \ - asm ("pushl $0"); \ -} while (0) - -#undef CTOR_LIST_END -#define CTOR_LIST_END \ -do { \ - if (TARGET_ELF) { \ - asm (CTORS_SECTION_ASM_OP); \ - STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) }; \ - } else { \ - CTOR_LIST_BEGIN; \ - } \ -} while (0) - -#undef DBX_BLOCKS_FUNCTION_RELATIVE -#define DBX_BLOCKS_FUNCTION_RELATIVE 1 - -#undef DBX_FUNCTION_FIRST -#define DBX_FUNCTION_FIRST 1 - -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((TARGET_ELF) ? \ - ((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ - : (-1)) \ - : \ - ((n) == 0 ? 0 : \ - (n) == 1 ? 2 : \ - (n) == 2 ? 1 : \ - (n) == 3 ? 3 : \ - (n) == 4 ? 6 : \ - (n) == 5 ? 7 : \ - (n) == 6 ? 4 : \ - (n) == 7 ? 5 : \ - (n) + 4)) - -#undef DWARF_DEBUGGING_INFO -#undef SDB_DEBUGGING_INFO -#undef DBX_DEBUGGING_INFO -#undef PREFERRED_DEBUGGING_TYPE - -#define DWARF_DEBUGGING_INFO 1 -#define SDB_DEBUGGING_INFO 1 -#define DBX_DEBUGGING_INFO 1 -#define PREFERRED_DEBUGGING_TYPE \ - ((TARGET_ELF) ? DWARF_DEBUG: SDB_DEBUG) - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - INIT_SECTION_FUNCTION \ - FINI_SECTION_FUNCTION \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION - -#undef CONST_SECTION_FUNCTION -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - extern void text_section(); \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - -#undef FINI_SECTION_FUNCTION -#define FINI_SECTION_FUNCTION \ -void \ -fini_section () \ -{ \ - if ((!TARGET_ELF) && in_section != in_fini) \ - { \ - fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \ - in_section = in_fini; \ - } \ -} - -#undef INIT_SECTION_FUNCTION -#define INIT_SECTION_FUNCTION \ -void \ -init_section () \ -{ \ - if ((!TARGET_ELF) && in_section != in_init) \ - { \ - fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \ - in_section = in_init; \ - } \ -} - -#undef CTORS_SECTION_FUNCTION -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#undef DTORS_SECTION_FUNCTION -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -#undef FRAME_POINTER_REQUIRED -#define FRAME_POINTER_REQUIRED \ - ((TARGET_ELF) ? 0 : \ - (current_function_calls_setjmp || current_function_calls_longjmp)) - -#undef JUMP_TABLES_IN_TEXT_SECTION -#define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ELF && flag_pic) - -#undef LOCAL_LABEL_PREFIX -#define LOCAL_LABEL_PREFIX \ - ((TARGET_ELF) ? "" : ".") - -#undef MD_EXEC_PREFIX -#undef MD_STARTFILE_PREFIX -#define MD_EXEC_PREFIX "/usr/ccs/bin/" -#define MD_STARTFILE_PREFIX "/usr/ccs/lib/" - -#undef NON_SAVING_SETJMP -#define NON_SAVING_SETJMP \ - ((TARGET_ELF) ? 0 : \ - (current_function_calls_setjmp && current_function_calls_longjmp)) - -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C 1 - -/* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and - RETURN_POPS_ARGS */ - -#undef RETURN_POPS_ARGS -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ - ((TARGET_ELF) ? \ - (i386_return_pops_args (FUNDECL, FUNTYPE, SIZE)) : \ - (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0 \ - : (TARGET_RTD \ - && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ - == void_type_node))) ? (SIZE) \ - : 0)) - -#undef SELECT_SECTION -#define SELECT_SECTION(DECL,RELOC) \ -{ \ - if (TARGET_ELF && flag_pic && RELOC) \ - data_section (); \ - else if (TREE_CODE (DECL) == STRING_CST) \ - { \ - if (! flag_writable_strings) \ - const_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (DECL) == VAR_DECL) \ - { \ - if (! DECL_READONLY_SECTION (DECL, RELOC)) \ - data_section (); \ - else \ - const_section (); \ - } \ - else \ - const_section (); \ -} - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'h' \ - || (CHAR) == 'R' \ - || (CHAR) == 'Y' \ - || (CHAR) == 'z') - -#undef WORD_SWITCH_TAKES_ARG -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ - && strcmp (STR, "Tbss")) - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) - -#undef HANDLE_SYSV_PRAGMA -#define HANDLE_SYSV_PRAGMA 1 - -/* Though OpenServer support .weak in COFF, g++ doesn't play nice with it - * so we'll punt on it for now - */ -#define SUPPORTS_WEAK (TARGET_ELF) -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -#undef SCCS_DIRECTIVE -#define SCCS_DIRECTIVE 1 - -/* - * Define sizes and types - */ -#undef SIZE_TYPE -#undef PTRDIFF_TYPE -#undef WCHAR_TYPE -#undef WCHAR_TYPE_SIZE -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 96 -#define SIZE_TYPE "unsigned int" -#define PTRDIFF_TYPE "int" -#define WCHAR_TYPE "long int" -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -/* - * New for multilib support. Set the default switches for multilib, - * which is -melf. - */ -#define MULTILIB_DEFAULTS { "melf" } - - -/* Please note that these specs may look messy but they are required in - order to emulate the SCO Development system as closely as possible. - With SCO Open Server 5.0, you now get the linker and assembler free, - so that is what these specs are targeted for. These utilities are - very argument sensitive: a space in the wrong place breaks everything. - So RMS, please forgive this mess. It works. - - Parameters which can be passed to gcc, and their SCO equivalents: - GCC Parameter SCO Equivalent - -ansi -a ansi - -posix -a posix - -Xpg4 -a xpg4 - -Xpg4plus -a xpg4plus - -Xods30 -a ods30 - - As with SCO, the default is XPG4 plus mode. SCO also allows you to - specify a C dialect with -Xt, -Xa, -Xc, -Xk and -Xm. These are passed - on to the assembler and linker in the same way that the SCO compiler - does. - - SCO also allows you to compile, link and generate either ELF or COFF - binaries. With gcc, unlike the SCO compiler, the default is ELF. - Specify -mcoff to gcc to produce COFF binaries. -fpic will get the - assembler and linker to produce PIC code. -*/ - -/* Set up assembler flags for PIC and ELF compilations */ -#undef ASM_SPEC - -#if USE_GAS - /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c - * Undef MD_EXEC_PREFIX becuase we don't know where GAS is, but it's not - * likely in /usr/ccs/bin/ - */ -#undef MD_EXEC_PREFIX -#else - -#define ASM_SPEC \ - "-b %{!mcoff:elf}%{mcoff:coff \ - %{static:%e-static not valid with -mcoff} \ - %{shared:%e-shared not valid with -mcoff} \ - %{symbolic:%e-symbolic not valid with -mcoff}} \ - %{Ym,*} %{Yd,*} %{Wa,*:%*} \ - %{!mcoff:-E%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},ELF %{Qn:} %{!Qy:-Qn}}" -#endif - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{shared: %{!mcoff: crti.o%s}} \ - %{!shared:\ - %{!symbolic: \ - %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \ - %{ansi:values-Xc.o%s} \ - %{!ansi: \ - %{traditional:values-Xt.o%s} \ - %{!traditional: \ - %{Xa:values-Xa.o%s} \ - %{!Xa:%{Xc:values-Xc.o%s} \ - %{!Xc:%{Xk:values-Xk.o%s} \ - %{!Xk:%{Xt:values-Xt.o%s} \ - %{!Xt:values-Xa.o%s}}}}}} \ - %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{!mcoff:crtend.o%s} \ - %{mcoff:crtendS.o%s} \ - %{pg:gcrtn.o%s}%{!pg:crtn.o%s}" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES \ - "-Asystem(svr3)" - -/* You are in a maze of GCC specs ... all alike */ - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) \ - %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \ - %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \ - -D__i386 -D__unix -D_SCO_DS=1 -D_M_I386 -D_M_XENIX -D_M_UNIX \ - %{!Xods30:-D_STRICT_NAMES} \ - %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \ - %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi -D_STRICT_ANSI} \ - %{!ansi: \ - %{posix:-isystem include/posix%s -isystem /usr/include/posix \ - -D_POSIX_C_SOURCE=2 -D_POSIX_SOURCE=1} \ - %{!posix:%{Xpg4:-isystem include/xpg4%s -isystem /usr/include/xpg4 \ - -D_XOPEN_SOURCE=1} \ - %{!Xpg4:-D_M_I86 -D_M_I86SM -D_M_INTERNAT -D_M_SDATA -D_M_STEXT \ - -D_M_BITFIELDS -D_M_SYS5 -D_M_SYSV -D_M_SYSIII \ - -D_M_WORDSWAP -Dunix -DM_I386 -DM_UNIX -DM_XENIX \ - %{Xods30:-isystem include/ods_30_compat%s \ - -isystem /usr/include/ods_30_compat \ - -D_SCO_ODS_30 -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT \ - -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \ - -DM_WORDSWAP}}}} \ - %{scointl:-DM_INTERNAT -D_M_INTERNAT} \ - %{traditional:-D_KR -D_SVID -D_NO_PROTOTYPE} \ - %{!mcoff:-D_SCO_ELF} \ - %{mcoff:-D_M_COFF -D_SCO_COFF} \ - %{!mcoff:%{fpic:-D__PIC__ -D__pic__} \ - %{fPIC:%{!fpic:-D__PIC__ -D__pic__}}} \ - %{Xa:-D_SCO_C_DIALECT=1} \ - %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \ - %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \ - %{!Xk:%{Xt:-D_SCO_C_DIALECT=2} \ - %{!Xt:-D_SCO_C_DIALECT=1}}}} \ - %{traditional:-traditional -D_KR -D_NO_PROTOTYPE}" - -#undef LINK_SPEC -#define LINK_SPEC \ - "-b %{!mcoff:elf}%{mcoff:coff \ - %{static:%e-static not valid with -mcoff} \ - %{shared:%e-shared not valid with -mcoff} \ - %{symbolic:%e-symbolic not valid with -mcoff} \ - %{fpic:%e-fpic not valid with -mcoff} \ - %{fPIC:%e-fPIC not valid with -mcoff}} \ - -R%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},%{mcoff:COFF}%{!mcoff:ELF} \ - %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \ - %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \ - %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \ - %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \ - %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \ - %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}" - -/* The SCO COFF linker gets confused on the difference between "-ofoo" - and "-o foo". So we just always force a single space. */ - -#define SWITCHES_NEED_SPACES "o" - -/* Library spec. If we are not building a shared library, provide the - standard libraries, as per the SCO compiler. */ - -#undef LIB_SPEC -#define LIB_SPEC \ - "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}" - -#undef LIBGCC_SPEC -#define LIBGCC_SPEC \ - "%{!shared:-lgcc}" - -#define MASK_COFF 010000000000 /* Mask for elf generation */ -#define TARGET_COFF (target_flags & MASK_COFF) -#define TARGET_ELF (!(target_flags & MASK_COFF)) - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - { "coff", MASK_COFF, "Generate COFF output" }, \ - { "elf", -MASK_COFF, "Generate ELF output" }, - -#define NO_DOLLAR_IN_LABEL - -/* Implicit library calls should use memcpy, not bcopy, etc. They are - faster on OpenServer libraries. */ - -#define TARGET_MEM_FUNCTIONS - -/* Biggest alignment supported by the object file format of this - machine. Use this macro to limit the alignment which can be - specified using the `__attribute__ ((aligned (N)))' construct. If - not defined, the default value is `BIGGEST_ALIGNMENT'. */ - -#define MAX_OFILE_ALIGNMENT (32768*8) - -/* -Here comes some major hackery to get the crt stuff to compile properly. -Since we can (and do) compile for both COFF and ELF environments, we -set things up accordingly, based on the pre-processor defines for ELF -and COFF. This is insane, but then I guess having one compiler with a -single back-end supporting two vastly different file format types is -a little insane too. But it is not impossible and we get a useful -compiler at the end of the day. Onward we go ... -*/ - -#if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2) -# undef OBJECT_FORMAT_ELF -# undef HAVE_ATEXIT -# undef INIT_SECTION_ASM_OP -# undef FINI_SECTION_ASM_OP -# undef CTORS_SECTION_ASM_OP -# undef DTORS_SECTION_ASM_OP -# undef EH_FRAME_SECTION_ASM_OP -# undef CTOR_LIST_BEGIN -# undef CTOR_LIST_END -# undef DO_GLOBAL_CTORS_BODY - -# if defined (_SCO_ELF) -# define OBJECT_FORMAT_ELF -# define HAVE_ATEXIT 1 -# define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF -# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF -# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF -# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF -# define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_ELF -# else /* ! _SCO_ELF */ -# define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF -# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF -# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF -# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF -# define EH_FRAME_SECTION_ASM_OP "" -# define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0") -# define CTOR_LIST_END CTOR_LIST_BEGIN -# define DO_GLOBAL_CTORS_BODY \ -do { \ - func_ptr *p, *beg = alloca(0); \ - for (p = beg; *p;) \ - (*p++) (); \ -} while (0) -# endif /* ! _SCO_ELF */ -#endif /* CRT_BEGIN !! CRT_END */ diff --git a/contrib/gcc/config/i386/sco5gas.h b/contrib/gcc/config/i386/sco5gas.h deleted file mode 100644 index de3e5d5570f1..000000000000 --- a/contrib/gcc/config/i386/sco5gas.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Definitions for Intel x86 running SCO OpenServer, running GNU assembler - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Just set a single flag we can test for inside of sco5.h and include it. */ - -#define USE_GAS 1 diff --git a/contrib/gcc/config/i386/scodbx.h b/contrib/gcc/config/i386/scodbx.h deleted file mode 100644 index d7d03f86326b..000000000000 --- a/contrib/gcc/config/i386/scodbx.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Definitions for Intel 386 running SCO Unix System V, - using dbx-in-coff encapsulation. - Copyright (C) 1992, 1995, 1996, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/svr3dbx.h" - -/* Overridden defines for SCO systems from sco.h. */ - -/* By default, target has a 80387, uses IEEE compatible arithmetic, - and returns float values in the 387, ie, - (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387) - - SCO's software emulation of a 387 fails to handle the `fucomp' - opcode. fucomp is only used when generating IEEE compliant code. - So don't make TARGET_IEEE_FP default for SCO. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_80387 | MASK_FLOAT_RETURNS) - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!r:%{!z:svr3.ifile%s}%{z:svr3z.ifile%s}}\ - %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}" - -/* Library spec, including SCO international language support. */ - -#undef LIB_SPEC -#define LIB_SPEC \ - "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} %{scointl:libintl.a%s} -lc" - -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -DM_UNIX -DM_I386 -DM_COFF -DM_WORDSWAP -Asystem(svr3)" - -#undef CPP_SPEC -#define CPP_SPEC " -Acpu(i386) -Amachine(i386) %{scointl:-DM_INTERNAT}" - -/* This spec is used for telling cpp whether char is signed or not. */ - -#undef SIGNED_CHAR_SPEC -#if DEFAULT_SIGNED_CHAR -#define SIGNED_CHAR_SPEC \ - "%{funsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}" -#else -#define SIGNED_CHAR_SPEC \ - "%{!fsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}" -#endif - -/* Use atexit for static destructors, instead of defining - our own exit function. */ -#define HAVE_ATEXIT - -/* caller has to pop the extra argument passed to functions that return - structures. */ - -#undef RETURN_POPS_ARGS -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ - ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE ? 0 \ - : (TARGET_RTD \ - && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ - == void_type_node))) ? (SIZE) \ - : 0) -/* On other 386 systems, the last line looks like this: - : (aggregate_value_p (TREE_TYPE (FUNTYPE))) ? GET_MODE_SIZE (Pmode) : 0) */ - -/* Use periods rather than dollar signs in special g++ assembler names. */ - -#define NO_DOLLAR_IN_LABEL - -/* Handle #pragma pack. */ -#define HANDLE_SYSV_PRAGMA diff --git a/contrib/gcc/config/i386/seq-gas.h b/contrib/gcc/config/i386/seq-gas.h deleted file mode 100644 index 796eaa24d622..000000000000 --- a/contrib/gcc/config/i386/seq-gas.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Definitions for Sequent Intel 386 using GAS. - Copyright (C) 1992 Free Software Foundation, Inc. - -/* Mostly it's like a Sequent 386 without GAS. */ - -#include "i386/sequent.h" - -/* A C statement or statements which output an assembler instruction - opcode to the stdio stream STREAM. The macro-operand PTR is a - variable of type `char *' which points to the opcode name in its - "internal" form--the form that is written in the machine description. - - GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic. - So use `repe' instead. */ - -#undef ASM_OUTPUT_OPCODE -#define ASM_OUTPUT_OPCODE(STREAM, PTR) \ -{ \ - if ((PTR)[0] == 'r' \ - && (PTR)[1] == 'e' \ - && (PTR)[2] == 'p') \ - { \ - if ((PTR)[3] == 'z') \ - { \ - fprintf (STREAM, "repe"); \ - (PTR) += 4; \ - } \ - else if ((PTR)[3] == 'n' && (PTR)[4] == 'z') \ - { \ - fprintf (STREAM, "repne"); \ - (PTR) += 5; \ - } \ - } \ -} - -/* Define macro used to output shift-double opcodes when the shift - count is in %cl. Some assemblers require %cl as an argument; - some don't. - - GAS requires the %cl argument, so override i386/unix.h. */ - -#undef SHIFT_DOUBLE_OMITS_COUNT -#define SHIFT_DOUBLE_OMITS_COUNT 0 - -/* Print opcodes the way that GAS expects them. */ -#define GAS_MNEMONICS 1 diff --git a/contrib/gcc/config/i386/seq-sysv3.h b/contrib/gcc/config/i386/seq-sysv3.h deleted file mode 100644 index 9e8388d47d74..000000000000 --- a/contrib/gcc/config/i386/seq-sysv3.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Sequent DYNIX/ptx 1.x (SVr3) */ - -#include "i386/sysv3.h" - -/* Sequent Symmetry SVr3 doesn't have crtn.o; crt1.o doesn't work - but crt0.o does. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ -"%{pg:gcrt0.o%s}\ - %{!pg:%{posix:%{p:mcrtp0.o%s}%{!p:crtp0.o%s}}\ - %{!posix:%{p:mcrt0.o%s}%{!p:crt0.o%s}}} crtbegin.o%s\ - %{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp}" - -#undef LIB_SPEC -#define LIB_SPEC \ -"%{posix:-lcposix}\ - %{shlib:-lc_s}\ - %{fshared-data:-lpps -lseq} -lc crtend.o%s" - -#undef CPP_SPEC -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} -D_SEQUENT_=1" - -/* Although the .init section is used, it is not automatically invoked. - This because the _start() function in /lib/crt0.o never calls anything - from the .init section */ -#define INVOKE__main - -/* Assembler pseudo-op for initialized shared variables (.shdata). */ -#undef SHARED_SECTION_ASM_OP -#define SHARED_SECTION_ASM_OP ".section .shdata, \"ws\"" - -/* Assembler pseudo-op for uninitialized shared global variables (.shbss). */ -#undef ASM_OUTPUT_SHARED_COMMON -#define ASM_OUTPUT_SHARED_COMMON(FILE, NAME, SIZE, ROUNDED) \ -( fputs(".comm ", (FILE)), \ - assemble_name((FILE), (NAME)), \ - fprintf((FILE), ",%u,-3\n", (SIZE))) - -/* Assembler pseudo-op for uninitialized shared local variables (.shbss). */ -#undef SHARED_BSS_SECTION_ASM_OP -#define SHARED_BSS_SECTION_ASM_OP ".section .shbss, \"bs\"" diff --git a/contrib/gcc/config/i386/seq2-sysv3.h b/contrib/gcc/config/i386/seq2-sysv3.h deleted file mode 100644 index 763c5f0adcc3..000000000000 --- a/contrib/gcc/config/i386/seq2-sysv3.h +++ /dev/null @@ -1,8 +0,0 @@ -/* Sequent DYNIX/ptx 2.x (SVr3) */ - -#include "i386/seq-sysv3.h" - -/* Use atexit for static destructors, instead of defining - our own exit function. */ -#define HAVE_ATEXIT - diff --git a/contrib/gcc/config/i386/sequent.h b/contrib/gcc/config/i386/sequent.h deleted file mode 100644 index 8613ad79e2d3..000000000000 --- a/contrib/gcc/config/i386/sequent.h +++ /dev/null @@ -1,151 +0,0 @@ -/* Definitions for Sequent Intel 386. - Copyright (C) 1988, 1994, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/i386.h" - -/* Use the BSD assembler syntax. */ - -#include "i386/bsd.h" - -/* By default, don't use IEEE compatible arithmetic comparisons - because the assembler can't handle the fucom insn. - Return float values in the 387. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_80387 | MASK_FLOAT_RETURNS) - -/* Specify predefined symbols in preprocessor. */ - -#define CPP_PREDEFINES "-Dunix -Di386 -Dsequent -Asystem(unix) -Acpu(i386) -Amachine(i386)" - -/* Pass -Z and -ZO options to the linker. */ - -#define LINK_SPEC "%{Z*}" - -#if 0 /* Dynix 3.1 is said to accept -L. */ -/* Dynix V3.0.12 doesn't accept -L at all. */ - -#define LINK_LIBGCC_SPECIAL -#endif - -/* Link with libg.a when debugging, for dbx's sake. */ - -#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} " - -/* We don't want to output SDB debugging information. */ - -#undef SDB_DEBUGGING_INFO - -/* We want to output DBX debugging information. */ - -#define DBX_DEBUGGING_INFO - -/* Sequent Symmetry has size_t defined as int in /usr/include/sys/types.h */ -#define SIZE_TYPE "int" - -/* gcc order is ax, dx, cx, bx, si, di, bp, sp, st, st. - * dbx order is ax, dx, cx, st(0), st(1), bx, si, di, st(2), st(3), - * st(4), st(5), st(6), st(7), sp, bp */ - -/* ??? The right thing would be to change the ordering of the - registers to correspond to the conventions of this system, - and get rid of DBX_REGISTER_NUMBER. */ - -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((n) < 3 ? (n) : (n) < 6 ? (n) + 2 \ - : (n) == 6 ? 15 : (n) == 7 ? 14 : 3) - -/* malcolmp@hydra.maths.unsw.EDU.AU says these two definitions - fix trouble in dbx. */ -#undef DBX_OUTPUT_LBRAC -#define DBX_OUTPUT_LBRAC(file,name) \ - fprintf (asmfile, "%s %d,0,%d,", ASM_STABN_OP, N_LBRAC, depth); \ - assemble_name (asmfile, buf); \ - fprintf (asmfile, "\n"); - -#undef DBX_OUTPUT_RBRAC -#define DBX_OUTPUT_RBRAC(file,name) \ - fprintf (asmfile, "%s %d,0,%d,", ASM_STABN_OP, N_RBRAC, depth); \ - assemble_name (asmfile, buf); \ - fprintf (asmfile, "\n"); - -/* Prevent anything from being allocated in the register pair cx/bx, - since that would confuse GDB. */ - -#undef HARD_REGNO_MODE_OK -#define HARD_REGNO_MODE_OK(REGNO, MODE) \ - (((REGNO) < 2 ? 1 \ - : (REGNO) < 4 ? 1 \ - : FP_REGNO_P (REGNO) ? (GET_MODE_CLASS (MODE) == MODE_FLOAT \ - || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \ - : (MODE) != QImode) \ - && ! (REGNO == 2 && GET_MODE_UNIT_SIZE (MODE) > 4)) - -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. */ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ - fprintf (FILE, "\tmovl $.LP%d,%%eax\n\tcall mcount\n", (LABELNO)); - -/* Assembler pseudo-op for shared data segment. */ -#define SHARED_SECTION_ASM_OP ".shdata" - -/* A C statement or statements which output an assembler instruction - opcode to the stdio stream STREAM. The macro-operand PTR is a - variable of type `char *' which points to the opcode name in its - "internal" form--the form that is written in the machine description. - - The Sequent assembler (identified as "Balance 8000 Assembler - 07/17/85 3.90" by "as -v") does not understand the `movs[bwl]' string - move mnemonics - it uses `smov[bwl]' instead. Change "movs" into - "smov", carefully avoiding the sign-extend opcodes. */ - -#define ASM_OUTPUT_OPCODE(STREAM, PTR) \ -{ \ - if ((PTR)[0] == 'm' \ - && (PTR)[1] == 'o' \ - && (PTR)[2] == 'v' \ - && (PTR)[3] == 's' \ - && ((PTR)[4] == 'b' || (PTR)[4] == 'w' || (PTR)[4] == 'l') \ - && ((PTR)[5] == ' ' || (PTR)[5] == '\t'|| (PTR)[5] == '\0')) \ - { \ - fprintf (STREAM, "smov"); \ - (PTR) += 4; \ - } \ -} - -/* 10-Aug-92 pes Local labels are prefixed with ".L" */ -#undef LPREFIX -#define LPREFIX ".L" - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)\ - sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER)) - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)\ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM) - -/* The native compiler passes the address of the returned structure in eax. */ -#undef STRUCT_VALUE -#undef STRUCT_VALUE_INCOMING -#define STRUCT_VALUE_REGNUM 0 diff --git a/contrib/gcc/config/i386/sol2-c1.asm b/contrib/gcc/config/i386/sol2-c1.asm deleted file mode 100644 index d08bcbd4aeca..000000000000 --- a/contrib/gcc/config/i386/sol2-c1.asm +++ /dev/null @@ -1,156 +0,0 @@ -! crt1.s for Solaris 2, x86 - -! Copyright (C) 1993, 1998 Free Software Foundation, Inc. -! Written By Fred Fish, Nov 1992 -! -! This file 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. -! -! In addition to the permissions in the GNU General Public License, the -! Free Software Foundation gives you unlimited permission to link the -! compiled version of this file with other programs, and to distribute -! those programs without any restriction coming from the use of this -! file. (The General Public License restrictions do apply in other -! respects; for example, they cover modification of the file, and -! distribution when not linked into another program.) -! -! This file 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. -! -! You should have received a copy of the GNU General Public License -! along with this program; see the file COPYING. If not, write to -! the Free Software Foundation, 59 Temple Place - Suite 330, -! Boston, MA 02111-1307, USA. -! -! As a special exception, if you link this library with files -! compiled with GCC to produce an executable, this does not cause -! the resulting executable to be covered by the GNU General Public License. -! This exception does not however invalidate any other reasons why -! the executable file might be covered by the GNU General Public License. -! - -! This file takes control of the process from the kernel, as specified -! in section 3 of the System V Application Binary Interface, Intel386 -! Processor Supplement. It has been constructed from information obtained -! from the ABI, information obtained from single stepping existing -! Solaris executables through their startup code with gdb, and from -! information obtained by single stepping executables on other i386 SVR4 -! implementations. This file is the first thing linked into any executable. - - .file "crt1.s" - .ident "GNU C crt1.s" - .weak _cleanup - .weak _DYNAMIC - .text - -! Start creating the initial frame by pushing a NULL value for the return -! address of the initial frame, and mark the end of the stack frame chain -! (the innermost stack frame) with a NULL value, per page 3-32 of the ABI. -! Initialize the first stack frame pointer in %ebp (the contents of which -! are unspecified at process initialization). - - .globl _start -_start: - pushl $0x0 - pushl $0x0 - movl %esp,%ebp - -! As specified per page 3-32 of the ABI, %edx contains a function -! pointer that should be registered with atexit(), for proper -! shared object termination. Just push it onto the stack for now -! to preserve it. We want to register _cleanup() first. - - pushl %edx - -! Check to see if there is an _cleanup() function linked in, and if -! so, register it with atexit() as the last thing to be run by -! atexit(). - - movl $_cleanup,%eax - testl %eax,%eax - je .L1 - pushl $_cleanup - call atexit - addl $0x4,%esp -.L1: - -! Now check to see if we have an _DYNAMIC table, and if so then -! we need to register the function pointer previously in %edx, but -! now conveniently saved on the stack as the argument to pass to -! atexit(). - - movl $_DYNAMIC,%eax - testl %eax,%eax - je .L2 - call atexit -.L2: - -! Register _fini() with atexit(). We will take care of calling _init() -! directly. - - pushl $_fini - call atexit - -! Compute the address of the environment vector on the stack and load -! it into the global variable _environ. Currently argc is at 8 off -! the frame pointer. Fetch the argument count into %eax, scale by the -! size of each arg (4 bytes) and compute the address of the environment -! vector which is 16 bytes (the two zero words we pushed, plus argc, -! plus the null word terminating the arg vector) further up the stack, -! off the frame pointer (whew!). - - movl 8(%ebp),%eax - leal 16(%ebp,%eax,4),%edx - movl %edx,_environ - -! Push the environment vector pointer, the argument vector pointer, -! and the argument count on to the stack to set up the arguments -! for _init(), _fpstart(), and main(). Note that the environment -! vector pointer and the arg count were previously loaded into -! %edx and %eax respectively. The only new value we need to compute -! is the argument vector pointer, which is at a fixed address off -! the initial frame pointer. - - pushl %edx - leal 12(%ebp),%edx - pushl %edx - pushl %eax - -! Call _init(argc, argv, environ), _fpstart(argc, argv, environ), and -! main(argc, argv, environ). - - call _init - call __fpstart - call main - -! Pop the argc, argv, and environ arguments off the stack, push the -! value returned from main(), and call exit(). - - addl $12,%esp - pushl %eax - call exit - -! An inline equivalent of _exit, as specified in Figure 3-26 of the ABI. - - pushl $0x0 - movl $0x1,%eax - lcall $7,$0 - -! If all else fails, just try a halt! - - hlt - .type _start,@function - .size _start,.-_start - -! A dummy profiling support routine for non-profiling executables, -! in case we link in some objects that have been compiled for profiling. - - .weak _mcount -_mcount: - ret - .type _mcount,@function - .size _mcount,.-_mcount diff --git a/contrib/gcc/config/i386/sol2-ci.asm b/contrib/gcc/config/i386/sol2-ci.asm deleted file mode 100644 index 439c709ba689..000000000000 --- a/contrib/gcc/config/i386/sol2-ci.asm +++ /dev/null @@ -1,51 +0,0 @@ -! crti.s for Solaris 2, x86. - -! Copyright (C) 1993 Free Software Foundation, Inc. -! Written By Fred Fish, Nov 1992 -! -! This file 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. -! -! In addition to the permissions in the GNU General Public License, the -! Free Software Foundation gives you unlimited permission to link the -! compiled version of this file with other programs, and to distribute -! those programs without any restriction coming from the use of this -! file. (The General Public License restrictions do apply in other -! respects; for example, they cover modification of the file, and -! distribution when not linked into another program.) -! -! This file 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. -! -! You should have received a copy of the GNU General Public License -! along with this program; see the file COPYING. If not, write to -! the Free Software Foundation, 59 Temple Place - Suite 330, -! Boston, MA 02111-1307, USA. -! -! As a special exception, if you link this library with files -! compiled with GCC to produce an executable, this does not cause -! the resulting executable to be covered by the GNU General Public License. -! This exception does not however invalidate any other reasons why -! the executable file might be covered by the GNU General Public License. -! - -! This file just supplies labeled starting points for the .init and .fini -! sections. It is linked in before the values-Xx.o files and also before -! crtbegin.o. - - .file "crti.s" - .ident "GNU C crti.s" - - .section .init - .globl _init - .type _init,@function -_init: - - .section .fini - .globl _fini - .type _fini,@function -_fini: diff --git a/contrib/gcc/config/i386/sol2-cn.asm b/contrib/gcc/config/i386/sol2-cn.asm deleted file mode 100644 index 3f3bad933007..000000000000 --- a/contrib/gcc/config/i386/sol2-cn.asm +++ /dev/null @@ -1,46 +0,0 @@ -! crtn.s for Solaris 2, x86. - -! Copyright (C) 1993 Free Software Foundation, Inc. -! Written By Fred Fish, Nov 1992 -! -! This file 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. -! -! In addition to the permissions in the GNU General Public License, the -! Free Software Foundation gives you unlimited permission to link the -! compiled version of this file with other programs, and to distribute -! those programs without any restriction coming from the use of this -! file. (The General Public License restrictions do apply in other -! respects; for example, they cover modification of the file, and -! distribution when not linked into another program.) -! -! This file 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. -! -! You should have received a copy of the GNU General Public License -! along with this program; see the file COPYING. If not, write to -! the Free Software Foundation, 59 Temple Place - Suite 330, -! Boston, MA 02111-1307, USA. -! -! As a special exception, if you link this library with files -! compiled with GCC to produce an executable, this does not cause -! the resulting executable to be covered by the GNU General Public License. -! This exception does not however invalidate any other reasons why -! the executable file might be covered by the GNU General Public License. -! - -! This file just supplies returns for the .init and .fini sections. It is -! linked in after all other files. - - .file "crtn.o" - .ident "GNU C crtn.o" - - .section .init - ret $0x0 - - .section .fini - ret $0x0 diff --git a/contrib/gcc/config/i386/sol2-gc1.asm b/contrib/gcc/config/i386/sol2-gc1.asm deleted file mode 100644 index 24a1965f37e5..000000000000 --- a/contrib/gcc/config/i386/sol2-gc1.asm +++ /dev/null @@ -1,160 +0,0 @@ -! gcrt1.s for Solaris 2, x86 - -! Copyright (C) 1993 Free Software Foundation, Inc. -! Written By Fred Fish, Nov 1992 -! -! This file 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. -! -! In addition to the permissions in the GNU General Public License, the -! Free Software Foundation gives you unlimited permission to link the -! compiled version of this file with other programs, and to distribute -! those programs without any restriction coming from the use of this -! file. (The General Public License restrictions do apply in other -! respects; for example, they cover modification of the file, and -! distribution when not linked into another program.) -! -! This file 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. -! -! You should have received a copy of the GNU General Public License -! along with this program; see the file COPYING. If not, write to -! the Free Software Foundation, 59 Temple Place - Suite 330, -! Boston, MA 02111-1307, USA. -! -! As a special exception, if you link this library with files -! compiled with GCC to produce an executable, this does not cause -! the resulting executable to be covered by the GNU General Public License. -! This exception does not however invalidate any other reasons why -! the executable file might be covered by the GNU General Public License. -! - -! This file takes control of the process from the kernel, as specified -! in section 3 of the System V Application Binary Interface, Intel386 -! Processor Supplement. It has been constructed from information obtained -! from the ABI, information obtained from single stepping existing -! Solaris executables through their startup code with gdb, and from -! information obtained by single stepping executables on other i386 SVR4 -! implementations. This file is the first thing linked into any executable. - -! This is a modified crt1.s by J.W.Hawtin 15/8/96, -! to allow program profiling, by calling monstartup on entry and _mcleanup -! on exit - - .file "gcrt1.s" - .ident "GNU C gcrt1.s" - .weak _DYNAMIC - .text - -! Start creating the initial frame by pushing a NULL value for the return -! address of the initial frame, and mark the end of the stack frame chain -! (the innermost stack frame) with a NULL value, per page 3-32 of the ABI. -! Initialize the first stack frame pointer in %ebp (the contents of which -! are unspecified at process initialization). - - .globl _start -_start: - pushl $0x0 - pushl $0x0 - movl %esp,%ebp - -! As specified per page 3-32 of the ABI, %edx contains a function -! pointer that should be registered with atexit(), for proper -! shared object termination. Just push it onto the stack for now -! to preserve it. We want to register _cleanup() first. - - pushl %edx - -! Check to see if there is an _cleanup() function linked in, and if -! so, register it with atexit() as the last thing to be run by -! atexit(). - - movl $_mcleanup,%eax - testl %eax,%eax - je .L1 - pushl $_mcleanup - call atexit - addl $0x4,%esp -.L1: - -! Now check to see if we have an _DYNAMIC table, and if so then -! we need to register the function pointer previously in %edx, but -! now conveniently saved on the stack as the argument to pass to -! atexit(). - - movl $_DYNAMIC,%eax - testl %eax,%eax - je .L2 - call atexit -.L2: - -! Register _fini() with atexit(). We will take care of calling _init() -! directly. - - pushl $_fini - call atexit - -! Start profiling - - pushl %ebp - movl %esp,%ebp - pushl $_etext - pushl $_start - call monstartup - addl $8,%esp - popl %ebp - -! Compute the address of the environment vector on the stack and load -! it into the global variable _environ. Currently argc is at 8 off -! the frame pointer. Fetch the argument count into %eax, scale by the -! size of each arg (4 bytes) and compute the address of the environment -! vector which is 16 bytes (the two zero words we pushed, plus argc, -! plus the null word terminating the arg vector) further up the stack, -! off the frame pointer (whew!). - - movl 8(%ebp),%eax - leal 16(%ebp,%eax,4),%edx - movl %edx,_environ - -! Push the environment vector pointer, the argument vector pointer, -! and the argument count on to the stack to set up the arguments -! for _init(), _fpstart(), and main(). Note that the environment -! vector pointer and the arg count were previously loaded into -! %edx and %eax respectively. The only new value we need to compute -! is the argument vector pointer, which is at a fixed address off -! the initial frame pointer. - - pushl %edx - leal 12(%ebp),%edx - pushl %edx - pushl %eax - -! Call _init(argc, argv, environ), _fpstart(argc, argv, environ), and -! main(argc, argv, environ). - - call _init - call __fpstart - call main - -! Pop the argc, argv, and environ arguments off the stack, push the -! value returned from main(), and call exit(). - - addl $12,%esp - pushl %eax - call exit - -! An inline equivalent of _exit, as specified in Figure 3-26 of the ABI. - - pushl $0x0 - movl $0x1,%eax - lcall $7,$0 - -! If all else fails, just try a halt! - - hlt - .type _start,@function - .size _start,.-_start diff --git a/contrib/gcc/config/i386/sol2.h b/contrib/gcc/config/i386/sol2.h deleted file mode 100644 index b254a10f2ea5..000000000000 --- a/contrib/gcc/config/i386/sol2.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Target definitions for GNU compiler for Intel 80386 running Solaris 2 - Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Fred Fish (fnf@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/sysv4.h" - -/* We use stabs-in-elf for debugging, because that is what the native - toolchain uses. */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#if ! GAS_REJECTS_MINUS_S - -/* - Changed from config/svr4.h in the following ways: - - - Removed -Yd (neither the sun bundled assembler nor gas accept it). - - Added "-s" so that stabs are not discarded. -*/ - -#undef ASM_SPEC -#define ASM_SPEC \ - "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s" - -#else /* GAS_REJECTS_MINUS_S */ - -/* Same as above, except for -s, unsupported by GNU as. */ -#undef ASM_SPEC -#define ASM_SPEC \ - "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*}" - -#endif /* GAS_REJECTS_MINUS_S */ - -/* The Solaris 2.0 x86 linker botches alignment of code sections. - It tries to align to a 16 byte boundary by padding with 0x00000090 - ints, rather than 0x90 bytes (nop). This generates trash in the - ".init" section since the contribution from crtbegin.o is only 7 - bytes. The linker pads it to 16 bytes with a single 0x90 byte, and - two 0x00000090 ints, which generates a segmentation violation when - executed. This macro forces the assembler to do the padding, since - it knows what it is doing. */ - -#define FORCE_INIT_SECTION_ALIGN asm (ALIGN_ASM_OP ## " 16") -#define FORCE_FINI_SECTION_ALIGN FORCE_INIT_SECTION_ALIGN - -/* Add "sun" to the list of symbols defined for SVR4. */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES \ - "-Dunix -D__svr4__ -D__SVR4 -Dsun -Asystem(svr4)" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) \ - %{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude}" - -#undef LIB_SPEC -#define LIB_SPEC \ - "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} %{!shared:%{!symbolic:-lc}}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s %{pg:crtn.o%s}%{!pg:crtn.o%s}" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared: \ - %{!symbolic: \ - %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\ - %{pg:gmon.o%s} crti.o%s \ - %{ansi:values-Xc.o%s} \ - %{!ansi: \ - %{traditional:values-Xt.o%s} \ - %{!traditional:values-Xa.o%s}} \ - crtbegin.o%s" - -/* This should be the same as in svr4.h, except with -R added. */ -#undef LINK_SPEC -#define LINK_SPEC \ - "%{h*} %{v:-V} \ - %{b} %{Wl,*:%*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy -z text} \ - %{symbolic:-Bsymbolic -G -dy -z text} \ - %{G:-G} \ - %{YP,*} \ - %{R*} \ - %{compat-bsd: \ - %{!YP,*:%{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{!pg:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \ - -R /usr/ucblib} \ - %{!compat-bsd: \ - %{!YP,*:%{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{!pg:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}} \ - %{Qy:} %{!Qn:-Qy}" - -/* This defines which switch letters take arguments. - It is as in svr4.h but with -R added. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'R' \ - || (CHAR) == 'h' \ - || (CHAR) == 'z') - -#define STDC_0_IN_SYSTEM_HEADERS - -#undef LOCAL_LABEL_PREFIX -#define LOCAL_LABEL_PREFIX "." diff --git a/contrib/gcc/config/i386/sol2gas.h b/contrib/gcc/config/i386/sol2gas.h deleted file mode 100644 index 558183aecd57..000000000000 --- a/contrib/gcc/config/i386/sol2gas.h +++ /dev/null @@ -1,9 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARC running - Solaris 2 with GNU as up to 2.9.5.0.12. - - Copyright (C) 1999 Free Software Foundation, Inc. -*/ - -#ifndef GAS_REJECTS_MINUS_S -#define GAS_REJECTS_MINUS_S 1 -#endif diff --git a/contrib/gcc/config/i386/sun.h b/contrib/gcc/config/i386/sun.h deleted file mode 100644 index ecc0e8294d2e..000000000000 --- a/contrib/gcc/config/i386/sun.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Definitions for Intel 386 running SunOS 4.0. - Copyright (C) 1988, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "i386/i386.h" - -/* Use the Sun assembler syntax. */ - -#include "i386/sun386.h" - -/* Use crt0.o as a startup file. */ - -#define STARTFILE_SPEC \ - "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}" - -#define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} \ -%{g:-lg} %{sun386:}" -/* That last item is just to prevent a spurious error. */ - -#undef LINK_SPEC -#define LINK_SPEC \ - "%{!nostdlib:%{!r*:%{!e*:-e _start}}} -dc -dp %{static:-Bstatic}" - -/* Extra switches to give the assembler. */ - -#define ASM_SPEC "%{R} -i386 %{keep-local-as-symbols:-L}" - -/* Specify predefined symbols in preprocessor. */ - -#define CPP_PREDEFINES "-Dunix -Di386 -Dsun386 -Dsun -Asystem(unix) -Asystem(bsd) -Acpu(i386) -Amachine(i386)" - -/* Allow #sccs in preprocessor. */ - -#define SCCS_DIRECTIVE - -/* Output #ident as a .ident. */ - -#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME); - -/* We don't want to output SDB debugging information. */ - -#undef SDB_DEBUGGING_INFO - -/* We want to output DBX debugging information. */ - -#define DBX_DEBUGGING_INFO - -/* Implicit library calls should use memcpy, not bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS - -/* Force structure alignment to the type used for a bitfield. */ - -#define PCC_BITFIELD_TYPE_MATTERS 1 - -/* This is partly guess. */ - -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ - ((n) == 0 ? 11 : (n) == 1 ? 9 : (n) == 2 ? 10 : (n) == 3 ? 8 \ - : (n) == 4 ? 5 : (n) == 5 ? 4 : (n) == 6 ? 6 : (n)) - -/* Every debugger symbol must be in the text section. - Otherwise the assembler or the linker screws up. */ - -#define DEBUG_SYMS_TEXT diff --git a/contrib/gcc/config/i386/sun386.h b/contrib/gcc/config/i386/sun386.h deleted file mode 100644 index 4302ec40841d..000000000000 --- a/contrib/gcc/config/i386/sun386.h +++ /dev/null @@ -1,142 +0,0 @@ -/* Definitions for Sun assembler syntax for the Intel 80386. - Copyright (C) 1988, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Include common aspects of all 386 Unix assemblers. */ -#include "i386/unix.h" - -#define TARGET_VERSION fprintf (stderr, " (80386, Sun syntax)"); - -/* Define the syntax of instructions and addresses. */ - -/* Prefix for internally generated assembler labels. */ -#define LPREFIX ".L" - -/* Define the syntax of pseudo-ops, labels and comments. */ - -/* Assembler pseudos to introduce constants of various size. */ - -#define ASM_BYTE_OP "\t.byte" -#define ASM_SHORT "\t.value" -#define ASM_LONG "\t.long" -#define ASM_DOUBLE "\t.double" - -/* How to output an ASCII string constant. */ - -#define ASM_OUTPUT_ASCII(FILE, p, size) \ -do \ -{ int i = 0; \ - while (i < (size)) \ - { if (i%10 == 0) { if (i!=0) fprintf ((FILE), "\n"); \ - fprintf ((FILE), "%s ", ASM_BYTE_OP); } \ - else fprintf ((FILE), ","); \ - fprintf ((FILE), "0x%x", ((p)[i++] & 0377)) ;} \ - fprintf ((FILE), "\n"); \ -} while (0) - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - extern char *version_string, *language_string; \ - { \ - int len = strlen (main_input_filename); \ - char *na = main_input_filename + len; \ - char shorter[15]; \ - /* NA gets MAIN_INPUT_FILENAME sans directory names. */\ - while (na > main_input_filename) \ - { \ - if (na[-1] == '/') \ - break; \ - na--; \ - } \ - strncpy (shorter, na, 14); \ - shorter[14] = 0; \ - fprintf (FILE, "\t.file\t"); \ - output_quoted_string (FILE, shorter); \ - fprintf (FILE, "\n"); \ - } \ - fprintf (FILE, "\t.version\t\"%s %s\"\n", \ - language_string, version_string); \ - if (optimize) ASM_FILE_START_1 (FILE); \ - } while (0) - -#define ASM_FILE_START_1(FILE) fprintf (FILE, "\t.optim\n") - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) - -/* This is how to output an assembler line - that says to advance the location counter by SIZE bytes. */ - -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf ((FILE), "\t.set\t.,.+%u\n", (SIZE)) - -/* Output before read-only data. */ - -#undef TEXT_SECTION_ASM_OP -#define TEXT_SECTION_ASM_OP ".text" - -/* Output before writable data. */ - -#undef DATA_SECTION_ASM_OP -#define DATA_SECTION_ASM_OP ".data" - -/* Define the syntax of labels and symbol definitions/declarations. */ - -/* This says how to output an assembler line - to define a global common symbol. */ - -#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ -( fputs (".comm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u\n", (ROUNDED))) - -/* This says how to output an assembler line - to define a local common symbol. */ - -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ -( fputs (".lcomm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u\n", (ROUNDED))) - -/* This is how to store into the string BUF - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ - sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER)) - -/* The prefix to add to user-visible assembler symbols. */ - -#define USER_LABEL_PREFIX "" - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM) diff --git a/contrib/gcc/config/i386/svr3.ifile b/contrib/gcc/config/i386/svr3.ifile deleted file mode 100644 index 32b3ddc2bf32..000000000000 --- a/contrib/gcc/config/i386/svr3.ifile +++ /dev/null @@ -1,48 +0,0 @@ -/* - * svr3.ifile - for collectless G++ on i386 System V. - * Leaves memory configured at address 0. - * - * Install this file as $prefix/gcc-lib/TARGET/VERSION/gcc.ifile - * - * BLOCK to an offset that leaves room for many headers ( the value - * here allows for a file header, an outheader, and up to 11 section - * headers on most systems. - * BIND to an address that includes page 0 in mapped memory. The value - * used for BLOCK should be or'd into this value. Here I'm setting BLOCK - * to 0x200 and BIND to ( value_used_for(BLOCK) ) - * If you are using shared libraries, watch that you don't overlap the - * address ranges assigned for shared libs. - * - * GROUP BIND to a location in the next segment. Here, the only value - * that you should change (I think) is that within NEXT, which I've set - * to my hardware segment size. You can always use a larger size, but not - * a smaller one. - */ -SECTIONS -{ - .text BIND(0x000200) BLOCK (0x200) : - { - /* plenty for room for headers */ - *(.init) - *(.text) - vfork = fork; /* I got tired of editing peoples sloppy code */ - *(.fini) - } - .stab BIND(ADDR(.text) + SIZEOF(.text)): { } - .stabstr BIND(ADDR(.stab) + SIZEOF(.stab)): { } - GROUP BIND( NEXT(0x400000) + - (ADDR(.stabstr) + (SIZEOF(.stabstr)) % 0x1000)): - { - .data : { - __CTOR_LIST__ = . ; - . += 4 ; /* leading NULL */ - *(.ctor) - . += 4 ; /* trailing NULL */ - __DTOR_LIST__ = . ; - . += 4 ; /* leading NULL */ - *(.dtor) - . += 4 ; /* trailing NULL */ - } - .bss : { } - } -} diff --git a/contrib/gcc/config/i386/svr3dbx.h b/contrib/gcc/config/i386/svr3dbx.h deleted file mode 100644 index 36c01cc3c21a..000000000000 --- a/contrib/gcc/config/i386/svr3dbx.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Definitions for Intel 386 running system V, using dbx-in-coff encapsulation. - Copyright (C) 1992, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/svr3gas.h" - -/* We do not want to output SDB debugging information. */ - -#undef SDB_DEBUGGING_INFO - -/* We want to output DBX debugging information. */ - -#define DBX_DEBUGGING_INFO - -/* Compensate for botch in dbxout_init/dbxout_source_file which - unconditionally drops the first character from ltext_label_name */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ - sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER)) - -/* With the current gas, .align N aligns to an N-byte boundary. - This is done to be compatible with the system assembler. - You must specify -DOTHER_ALIGN when building gas-1.38.1. */ - -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) - -/* Align labels, etc. at 4-byte boundaries. - For the 486, align to 16-byte boundary for sake of cache. */ - -#undef LABEL_ALIGN_AFTER_BARRIER -#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (i386_align_jumps) - -/* Align start of loop at 4-byte boundary. */ - -#undef LOOP_ALIGN -#define LOOP_ALIGN(LABEL) (i386_align_loops) - - -/* Additional overrides needed for dbx-in-coff gas, mostly taken from pbb.h */ - -/* Although the gas we use can create .ctor and .dtor sections from N_SETT - stabs, it does not support section directives, so we need to have the loader - define the lists. - */ -#define CTOR_LISTS_DEFINED_EXTERNALLY - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ -/* - * The loader directive file svr3.ifile defines how to merge the constructor - * sections into the data section. Also, since gas only puts out those - * sections in response to N_SETT stabs, and does not (yet) have a - * ".sections" directive, svr3.ifile also defines the list symbols - * __DTOR_LIST__ and __CTOR_LIST__. - */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!r:%{!z:svr3.ifile%s}%{z:svr3z.ifile%s}}\ - %{pg:gcrt1.o%s}%{!pg:%{posix:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}%{!posix:%{p:mcrt1.o%s}%{!p:crt1.o%s}}} \ - %{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp}" - -#define ENDFILE_SPEC "crtn.o%s" - -#undef LIB_SPEC -#define LIB_SPEC "%{posix:-lcposix} %{shlib:-lc_s} -lc -lg" diff --git a/contrib/gcc/config/i386/svr3gas.h b/contrib/gcc/config/i386/svr3gas.h deleted file mode 100644 index a288b84e5240..000000000000 --- a/contrib/gcc/config/i386/svr3gas.h +++ /dev/null @@ -1,293 +0,0 @@ -/* Definitions for Intel 386 running system V, using gas. - Copyright (C) 1992, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/gas.h" - -/* Add stuff that normally comes from i386/sysv3.h */ - -/* longjmp may fail to restore the registers if called from the same - function that called setjmp. To compensate, the compiler avoids - putting variables in registers in functions that use both setjmp - and longjmp. */ - -#define NON_SAVING_SETJMP \ - (current_function_calls_setjmp && current_function_calls_longjmp) - -/* longjmp may fail to restore the stack pointer if the saved frame - pointer is the same as the caller's frame pointer. Requiring a frame - pointer in any function that calls setjmp or longjmp avoids this - problem, unless setjmp and longjmp are called from the same function. - Since a frame pointer will be required in such a function, it is OK - that the stack pointer is not restored. */ - -#undef FRAME_POINTER_REQUIRED -#define FRAME_POINTER_REQUIRED \ - (current_function_calls_setjmp || current_function_calls_longjmp) - -/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */ -#undef ASM_OUTPUT_LOCAL -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ - do { \ - int align = exact_log2 (ROUNDED); \ - if (align > 2) align = 2; \ - if (TARGET_SVR3_SHLIB) \ - { \ - data_section (); \ - ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \ - ASM_OUTPUT_LABEL ((FILE), (NAME)); \ - fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)); \ - } \ - else \ - { \ - fputs (".lcomm ", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u\n", (ROUNDED)); \ - } \ - } while (0) - -/* Add stuff that normally comes from i386/sysv3.h via svr3.h */ - -/* Define the actual types of some ANSI-mandated types. These - definitions should work for most SVR3 systems. */ - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -/* ??? This stuff is copied from config/svr3.h. In the future, - this file should be rewritten to include config/svr3.h - and override what isn't right. */ - -/* Support const sections and the ctors and dtors sections for g++. - Note that there appears to be two different ways to support const - sections at the moment. You can either #define the symbol - READONLY_DATA_SECTION (giving it some code which switches to the - readonly data section) or else you can #define the symbols - EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and - SELECT_RTX_SECTION. We do both here just to be on the safe side. - However, use of the const section is turned off by default - unless the specific tm.h file turns it on by defining - USE_CONST_SECTION as 1. */ - -/* Define a few machine-specific details of the implementation of - constructors. - - The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN - and CTOR_LIST_END to contribute to the .init section an instruction to - push a word containing 0 (or some equivalent of that). - - Define ASM_OUTPUT_CONSTRUCTOR to push the address of the constructor. */ - -#define USE_CONST_SECTION 0 - -#define INIT_SECTION_ASM_OP ".section\t.init" -#define FINI_SECTION_ASM_OP ".section .fini,\"x\"" -#define CONST_SECTION_ASM_OP ".section\t.rodata, \"x\"" -#define CTORS_SECTION_ASM_OP INIT_SECTION_ASM_OP -#define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP - -/* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent - because they push on the stack. */ - -#ifdef STACK_GROWS_DOWNWARD - -/* Constructor list on stack is in reverse order. Go to the end of the - list and go backwards to call constructors in the right order. */ -#define DO_GLOBAL_CTORS_BODY \ -do { \ - func_ptr *p, *beg = alloca (0); \ - for (p = beg; *p; p++) \ - ; \ - while (p != beg) \ - (*--p) (); \ -} while (0) - -#else - -/* Constructor list on stack is in correct order. Just call them. */ -#define DO_GLOBAL_CTORS_BODY \ -do { \ - func_ptr *p, *beg = alloca (0); \ - for (p = beg; *p; ) \ - (*p++) (); \ -} while (0) - -#endif /* STACK_GROWS_DOWNWARD */ - -/* Add extra sections .rodata, .init and .fini. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_init, in_fini - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - INIT_SECTION_FUNCTION \ - FINI_SECTION_FUNCTION - -#define INIT_SECTION_FUNCTION \ -void \ -init_section () \ -{ \ - if (in_section != in_init) \ - { \ - fprintf (asm_out_file, "\t%s\n", INIT_SECTION_ASM_OP); \ - in_section = in_init; \ - } \ -} - -#define FINI_SECTION_FUNCTION \ -void \ -fini_section () \ -{ \ - if (in_section != in_fini) \ - { \ - fprintf (asm_out_file, "\t%s\n", FINI_SECTION_ASM_OP); \ - in_section = in_fini; \ - } \ -} - -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - extern void text_section(); \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - -/* The ctors and dtors sections are not normally put into use - by EXTRA_SECTIONS and EXTRA_SECTION_FUNCTIONS as defined in svr3.h, - but it can't hurt to define these macros for whatever systems use them. */ -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -/* This is machine-dependent - because it needs to push something on the stack. */ -#undef ASM_OUTPUT_CONSTRUCTOR - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - fini_section (); \ - fprintf (FILE, "%s\t ", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement or statements to switch to the appropriate - section for output of DECL. DECL is either a `VAR_DECL' node - or a constant of some sort. RELOC indicates whether forming - the initial value of DECL requires link-time relocations. */ - -#define SELECT_SECTION(DECL,RELOC) \ -{ \ - if (TREE_CODE (DECL) == STRING_CST) \ - { \ - if (! flag_writable_strings) \ - const_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (DECL) == VAR_DECL) \ - { \ - if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \ - || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ - || !DECL_INITIAL (DECL) \ - || (DECL_INITIAL (DECL) != error_mark_node \ - && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ - data_section (); \ - else \ - const_section (); \ - } \ - else \ - const_section (); \ -} - -/* A C statement or statements to switch to the appropriate - section for output of RTX in mode MODE. RTX is some kind - of constant in RTL. The argument MODE is redundant except - in the case of a `const_int' rtx. Currently, these always - go into the const section. */ - -#define SELECT_RTX_SECTION(MODE,RTX) const_section() - -/* This is copied from i386/sysv3.h. */ - -/* Define a few machine-specific details of the implementation of - constructors. - - The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN - and CTOR_LIST_END to contribute to the .init section an instruction to - push a word containing 0 (or some equivalent of that). - - ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the - constructor. */ - -#undef INIT_SECTION_ASM_OP -#define INIT_SECTION_ASM_OP ".section .init,\"x\"" - -#define CTOR_LIST_BEGIN \ - asm (INIT_SECTION_ASM_OP); \ - asm ("pushl $0") -#define CTOR_LIST_END CTOR_LIST_BEGIN - -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - init_section (); \ - fprintf (FILE, "\tpushl $"); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) diff --git a/contrib/gcc/config/i386/svr3z.ifile b/contrib/gcc/config/i386/svr3z.ifile deleted file mode 100644 index 4946051235e4..000000000000 --- a/contrib/gcc/config/i386/svr3z.ifile +++ /dev/null @@ -1,48 +0,0 @@ -/* - * svr3z.ifile - for collectless G++ on i386 System V. - * Leaves memory unconfigured at address 0. - * - * Install this file as $prefix/gcc-lib/TARGET/VERSION/gccz.ifile - * - * BLOCK to an offset that leaves room for many headers ( the value - * here allows for a file header, an outheader, and up to 11 section - * headers on most systems. - * BIND to an address that excludes page 0 from being mapped. The value - * used for BLOCK should be or'd into this value. Here I'm setting BLOCK - * to 0x200 and BIND to ( 0x400000 | value_used_for(BLOCK) ) - * If you are using shared libraries, watch that you don't overlap the - * address ranges assigned for shared libs. - * - * GROUP BIND to a location in the next segment. Here, the only value - * that you should change (I think) is that within NEXT, which I've set - * to my hardware segment size. You can always use a larger size, but not - * a smaller one. - */ -SECTIONS -{ - .text BIND(0x400200) BLOCK (0x200) : - { - /* plenty for room for headers */ - *(.init) - *(.text) - vfork = fork; /* I got tired of editing peoples sloppy code */ - *(.fini) - } - .stab BIND(ADDR(.text) + SIZEOF(.text)): { } - .stabstr BIND(ADDR(.stab) + SIZEOF(.stab)): { } - GROUP BIND( NEXT(0x400000) + - (ADDR(.stabstr) + (SIZEOF(.stabstr)) % 0x1000)): - { - .data : { - __CTOR_LIST__ = . ; - . += 4 ; /* leading NULL */ - *(.ctor) - . += 4 ; /* trailing NULL */ - __DTOR_LIST__ = . ; - . += 4 ; /* leading NULL */ - *(.dtor) - . += 4 ; /* trailing NULL */ - } - .bss : { } - } -} diff --git a/contrib/gcc/config/i386/sysv3.h b/contrib/gcc/config/i386/sysv3.h deleted file mode 100644 index ce898899011a..000000000000 --- a/contrib/gcc/config/i386/sysv3.h +++ /dev/null @@ -1,124 +0,0 @@ -/* Definitions for Intel 386 running system V. - Copyright (C) 1988, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "i386/i386.h" - -/* Use default settings for system V.3. */ - -#include "svr3.h" - -/* Use the ATT assembler syntax. - This overrides at least one macro (USER_LABEL_PREFIX) from svr3.h. */ - -#include "i386/att.h" - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ - -#define STARTFILE_SPEC \ - "%{pg:gcrt1.o%s}%{!pg:%{posix:%{p:mcrtp1.o%s}%{!p:crtp1.o%s}}%{!posix:%{p:mcrt1.o%s}%{!p:crt1.o%s}}} crtbegin.o%s\ - %{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp}" - -/* ??? There is a suggestion that -lg is needed here. - Does anyone know whether this is right? */ -#define LIB_SPEC "%{posix:-lcposix} %{shlib:-lc_s} -lc crtend.o%s crtn.o%s" - -/* Specify predefined symbols in preprocessor. */ - -#define CPP_PREDEFINES "-Dunix -Asystem(svr3)" - -#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE}" - -/* Writing `int' for a bitfield forces int alignment for the structure. */ - -#define PCC_BITFIELD_TYPE_MATTERS 1 - -/* Don't write a `.optim' pseudo; this assembler doesn't handle them. */ - -#undef ASM_FILE_START_1 -#define ASM_FILE_START_1(FILE) - -/* We want to be able to get DBX debugging information via -gstabs. */ - -#undef DBX_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG - -/* longjmp may fail to restore the registers if called from the same - function that called setjmp. To compensate, the compiler avoids - putting variables in registers in functions that use both setjmp - and longjmp. */ - -#define NON_SAVING_SETJMP \ - (current_function_calls_setjmp && current_function_calls_longjmp) - -/* longjmp may fail to restore the stack pointer if the saved frame - pointer is the same as the caller's frame pointer. Requiring a frame - pointer in any function that calls setjmp or longjmp avoids this - problem, unless setjmp and longjmp are called from the same function. - Since a frame pointer will be required in such a function, it is OK - that the stack pointer is not restored. */ - -#undef FRAME_POINTER_REQUIRED -#define FRAME_POINTER_REQUIRED \ - (current_function_calls_setjmp || current_function_calls_longjmp) - -/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib. */ -#undef ASM_OUTPUT_LOCAL -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ - do { \ - int align = exact_log2 (ROUNDED); \ - if (align > 2) align = 2; \ - if (TARGET_SVR3_SHLIB) \ - data_section (); \ - else \ - bss_section (); \ - ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \ - ASM_OUTPUT_LABEL ((FILE), (NAME)); \ - fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)); \ - } while (0) - -/* Define a few machine-specific details of the implementation of - constructors. - - The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN - and CTOR_LIST_END to contribute to the .init section an instruction to - push a word containing 0 (or some equivalent of that). - - ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the - constructor. */ - -#undef INIT_SECTION_ASM_OP -#define INIT_SECTION_ASM_OP ".section .init,\"x\"" - -#define CTOR_LIST_BEGIN \ - asm (INIT_SECTION_ASM_OP); \ - asm ("pushl $0") -#define CTOR_LIST_END CTOR_LIST_BEGIN - -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - init_section (); \ - fprintf (FILE, "\tpushl $"); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) diff --git a/contrib/gcc/config/i386/sysv4.h b/contrib/gcc/config/i386/sysv4.h deleted file mode 100644 index e688f7b8c9f7..000000000000 --- a/contrib/gcc/config/i386/sysv4.h +++ /dev/null @@ -1,253 +0,0 @@ -/* Target definitions for GNU compiler for Intel 80386 running System V.4 - Copyright (C) 1991 Free Software Foundation, Inc. - - Written by Ron Guilmette (rfg@netcom.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/i386.h" /* Base i386 target machine definitions */ -#include "i386/att.h" /* Use the i386 AT&T assembler syntax */ -#include "svr4.h" /* Definitions common to all SVR4 targets */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)"); - -/* The svr4 ABI for the i386 says that records and unions are returned - in memory. */ - -#undef RETURN_IN_MEMORY -#define RETURN_IN_MEMORY(TYPE) \ - (TYPE_MODE (TYPE) == BLKmode) - -/* Define which macros to predefine. __svr4__ is our extension. */ -/* This used to define X86, but james@bigtex.cactus.org says that - is supposed to be defined optionally by user programs--not by default. */ -#define CPP_PREDEFINES \ - "-Di386 -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(i386) -Amachine(i386)" - -/* This is how to output assembly code to define a `float' constant. - We always have to use a .long pseudo-op to do this because the native - SVR4 ELF assembler is buggy and it generates incorrect values when we - try to use the .float pseudo-op instead. */ - -#undef ASM_OUTPUT_FLOAT -#define ASM_OUTPUT_FLOAT(FILE,VALUE) \ -do { long value; \ - REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value); \ - if (sizeof (int) == sizeof (long)) \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value); \ - else \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value); \ - } while (0) - -/* This is how to output assembly code to define a `double' constant. - We always have to use a pair of .long pseudo-ops to do this because - the native SVR4 ELF assembler is buggy and it generates incorrect - values when we try to use the .double pseudo-op instead. */ - -#undef ASM_OUTPUT_DOUBLE -#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ -do { long value[2]; \ - REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value); \ - if (sizeof (int) == sizeof (long)) \ - { \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \ - } \ - else \ - { \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \ - } \ - } while (0) - - -#undef ASM_OUTPUT_LONG_DOUBLE -#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \ -do { long value[3]; \ - REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value); \ - if (sizeof (int) == sizeof (long)) \ - { \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]); \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]); \ - fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[2]); \ - } \ - else \ - { \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]); \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]); \ - fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[2]); \ - } \ - } while (0) - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - output_file_directive (FILE, main_input_filename); \ - fprintf (FILE, "\t.version\t\"01.01\"\n"); \ - } while (0) - -/* Define the register numbers to be used in Dwarf debugging information. - The SVR4 reference port C compiler uses the following register numbers - in its Dwarf output code: - - 0 for %eax (gnu regno = 0) - 1 for %ecx (gnu regno = 2) - 2 for %edx (gnu regno = 1) - 3 for %ebx (gnu regno = 3) - 4 for %esp (gnu regno = 7) - 5 for %ebp (gnu regno = 6) - 6 for %esi (gnu regno = 4) - 7 for %edi (gnu regno = 5) - - The following three DWARF register numbers are never generated by - the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4 - believes these numbers have these meanings. - - 8 for %eip (no gnu equivalent) - 9 for %eflags (no gnu equivalent) - 10 for %trapno (no gnu equivalent) - - It is not at all clear how we should number the FP stack registers - for the x86 architecture. If the version of SDB on x86/svr4 were - a bit less brain dead with respect to floating-point then we would - have a precedent to follow with respect to DWARF register numbers - for x86 FP registers, but the SDB on x86/svr4 is so completely - broken with respect to FP registers that it is hardly worth thinking - of it as something to strive for compatibility with. - - The version of x86/svr4 SDB I have at the moment does (partially) - seem to believe that DWARF register number 11 is associated with - the x86 register %st(0), but that's about all. Higher DWARF - register numbers don't seem to be associated with anything in - particular, and even for DWARF regno 11, SDB only seems to under- - stand that it should say that a variable lives in %st(0) (when - asked via an `=' command) if we said it was in DWARF regno 11, - but SDB still prints garbage when asked for the value of the - variable in question (via a `/' command). - - (Also note that the labels SDB prints for various FP stack regs - when doing an `x' command are all wrong.) - - Note that these problems generally don't affect the native SVR4 - C compiler because it doesn't allow the use of -O with -g and - because when it is *not* optimizing, it allocates a memory - location for each floating-point variable, and the memory - location is what gets described in the DWARF AT_location - attribute for the variable in question. - - Regardless of the severe mental illness of the x86/svr4 SDB, we - do something sensible here and we use the following DWARF - register numbers. Note that these are all stack-top-relative - numbers. - - 11 for %st(0) (gnu regno = 8) - 12 for %st(1) (gnu regno = 9) - 13 for %st(2) (gnu regno = 10) - 14 for %st(3) (gnu regno = 11) - 15 for %st(4) (gnu regno = 12) - 16 for %st(5) (gnu regno = 13) - 17 for %st(6) (gnu regno = 14) - 18 for %st(7) (gnu regno = 15) -*/ - -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ -((n) == 0 ? 0 \ - : (n) == 1 ? 2 \ - : (n) == 2 ? 1 \ - : (n) == 3 ? 3 \ - : (n) == 4 ? 6 \ - : (n) == 5 ? 7 \ - : (n) == 6 ? 5 \ - : (n) == 7 ? 4 \ - : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ - : (-1)) - -/* The routine used to output sequences of byte values. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable. Note that if we find subparts of the - character sequence which end with NUL (and which are shorter than - STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ - -#undef ASM_OUTPUT_ASCII -#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ - do \ - { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ - register unsigned bytes_in_chunk = 0; \ - for (; _ascii_bytes < limit; _ascii_bytes++) \ - { \ - register unsigned char *p; \ - if (bytes_in_chunk >= 64) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ - continue; \ - if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ - { \ - if (bytes_in_chunk > 0) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ - _ascii_bytes = p; \ - } \ - else \ - { \ - if (bytes_in_chunk == 0) \ - fprintf ((FILE), "\t.byte\t"); \ - else \ - fputc (',', (FILE)); \ - fprintf ((FILE), "0x%02x", *_ascii_bytes); \ - bytes_in_chunk += 5; \ - } \ - } \ - if (bytes_in_chunk > 0) \ - fprintf ((FILE), "\n"); \ - } \ - while (0) - -/* This is how to output an element of a case-vector that is relative. - This is only used for PIC code. See comments by the `casesi' insn in - i386.md for an explanation of the expression this outputs. */ - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) - -/* Indicate that jump tables go in the text section. This is - necessary when compiling PIC code. */ - -#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) - -/* A C statement (sans semicolon) to output to the stdio stream - FILE the assembler definition of uninitialized global DECL named - NAME whose size is SIZE bytes and alignment is ALIGN bytes. - Try to use asm_output_aligned_bss to implement this macro. */ - -#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ - asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) diff --git a/contrib/gcc/config/i386/sysv4gdb.h b/contrib/gcc/config/i386/sysv4gdb.h deleted file mode 100644 index dd1e8f256f35..000000000000 --- a/contrib/gcc/config/i386/sysv4gdb.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Target definitions for GNU compiler for Intel 80386 running System V.4 - with gas and gdb. */ - -/* Use stabs instead of DWARF debug format. */ -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#include "i386/sysv4.h" diff --git a/contrib/gcc/config/i386/sysv5.h b/contrib/gcc/config/i386/sysv5.h deleted file mode 100644 index 09a3bbefc0c8..000000000000 --- a/contrib/gcc/config/i386/sysv5.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Definitions for Intel 386 running System V Release 5 (i.e. UnixWare 7) - Copyright (C) 1999 Free Software Foundation, Inc. - Contributed by Robert Lipe (robertlipe@usa.net) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "i386/sysv4.h" - -/* Dwarf2 is supported by native debuggers */ - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG - -/* Add -lcrt for Dwarf2 abbreviation table */ -#undef LIB_SPEC -#define LIB_SPEC "%{pthread:-lthread} %{!shared:%{!symbolic:-lc -lcrt}}" - -#undef CPP_SPEC -#define CPP_SPEC "%{pthread:-D_REENTRANT}" diff --git a/contrib/gcc/config/i386/t-crtpic b/contrib/gcc/config/i386/t-crtpic deleted file mode 100644 index ff81a9bef9ce..000000000000 --- a/contrib/gcc/config/i386/t-crtpic +++ /dev/null @@ -1,10 +0,0 @@ -# The pushl in CTOR initialization interferes with frame pointer elimination. - -# We need to use -fPIC when we are using gcc to compile the routines in -# crtstuff.c. This is only really needed when we are going to use gcc/g++ -# to produce a shared library, but since we don't know ahead of time when -# we will be doing that, we just always use -fPIC when compiling the -# routines in crtstuff.c. - -CRTSTUFF_T_CFLAGS = -fPIC -fno-omit-frame-pointer -TARGET_LIBGCC2_CFLAGS = -fPIC diff --git a/contrib/gcc/config/i386/t-crtstuff b/contrib/gcc/config/i386/t-crtstuff deleted file mode 100644 index a202df6653f6..000000000000 --- a/contrib/gcc/config/i386/t-crtstuff +++ /dev/null @@ -1,2 +0,0 @@ -# The pushl in CTOR initialization interferes with frame pointer elimination. -CRTSTUFF_T_CFLAGS = -fno-omit-frame-pointer diff --git a/contrib/gcc/config/i386/t-cygwin b/contrib/gcc/config/i386/t-cygwin deleted file mode 100644 index 175f66be6f35..000000000000 --- a/contrib/gcc/config/i386/t-cygwin +++ /dev/null @@ -1,16 +0,0 @@ -LIBGCC1 = libgcc1-asm.a -CROSS_LIBGCC1 = libgcc1-asm.a -LIB1ASMSRC = i386/cygwin.asm -LIB1ASMFUNCS = _chkstk - -# cygwin always has a limits.h, but, depending upon how we are doing -# the build, it may not be installed yet. -LIMITS_H_TEST = true - -# If we are building next to winsup, this will let us find the real -# limits.h when building libgcc2. Otherwise, winsup must be installed -# first. -LIBGCC2_INCLUDES = -I$(srcdir)/../winsup/include - -winnt.o: $(srcdir)/config/i386/winnt.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt.c diff --git a/contrib/gcc/config/i386/t-dgux b/contrib/gcc/config/i386/t-dgux deleted file mode 100644 index 1bf024a4c19c..000000000000 --- a/contrib/gcc/config/i386/t-dgux +++ /dev/null @@ -1,8 +0,0 @@ -# -# target makefile for dgux -# -EXTRA_PARTS=crti.o crtbegin.o crtend.o - -crti.o: $(srcdir)/config/i386/sol2-ci.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-ci.asm >crti.s - $(GCC_FOR_TARGET) -c -o crti.o crti.s diff --git a/contrib/gcc/config/i386/t-djgpp b/contrib/gcc/config/i386/t-djgpp deleted file mode 100644 index 6160b7ec945d..000000000000 --- a/contrib/gcc/config/i386/t-djgpp +++ /dev/null @@ -1,2 +0,0 @@ -LIBGCC1 = libgcc1.null -CROSS_LIBGCC1 = libgcc1.null diff --git a/contrib/gcc/config/i386/t-i386bare b/contrib/gcc/config/i386/t-i386bare deleted file mode 100644 index 2970fa714155..000000000000 --- a/contrib/gcc/config/i386/t-i386bare +++ /dev/null @@ -1,3 +0,0 @@ -# The i386 md has all of these taken care of, according to sef. -LIBGCC1 = -CROSS_LIBGCC1 = diff --git a/contrib/gcc/config/i386/t-interix b/contrib/gcc/config/i386/t-interix deleted file mode 100644 index 4c6d84f1b391..000000000000 --- a/contrib/gcc/config/i386/t-interix +++ /dev/null @@ -1,16 +0,0 @@ -# t-interix -LIBGCC1 = libgcc1-asm.a -CROSS_LIBGCC1 = libgcc1-asm.a - -LIB1ASMSRC = i386/cygwin.asm -LIB1ASMFUNCS = _chkstk - -interix.o: $(srcdir)/config/i386/interix.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/interix.c - -# System headers will track gcc's needs. -# Even LANG_EXTRA_HEADERS may be temporary. -USER_H=$(LANG_EXTRA_HEADERS) - -# We don't want this one either. -INSTALL_ASSERT_H= diff --git a/contrib/gcc/config/i386/t-iscscodbx b/contrib/gcc/config/i386/t-iscscodbx deleted file mode 100644 index 928a7589f8c9..000000000000 --- a/contrib/gcc/config/i386/t-iscscodbx +++ /dev/null @@ -1,2 +0,0 @@ -# The one that comes with the system is POSIX-compliant. -LIMITS_H = diff --git a/contrib/gcc/config/i386/t-mingw32 b/contrib/gcc/config/i386/t-mingw32 deleted file mode 100644 index fe948c6d15ec..000000000000 --- a/contrib/gcc/config/i386/t-mingw32 +++ /dev/null @@ -1,4 +0,0 @@ -# -# collect2 doesn't work for i386-mingw32* yet. -# -USE_COLLECT2= diff --git a/contrib/gcc/config/i386/t-next b/contrib/gcc/config/i386/t-next deleted file mode 100644 index effa6953b9a7..000000000000 --- a/contrib/gcc/config/i386/t-next +++ /dev/null @@ -1,12 +0,0 @@ -# libgcc1.c is not needed, since the standard library has these functions. -LIBGCC1=libgcc1.null -CROSS_LIBGCC1=libgcc1.null - -# Specify other dirs of system header files to be fixed. -OTHER_FIXINCLUDES_DIRS= /LocalDeveloper/Headers - -# is sometimes in /usr/include/ansi/limits.h. -LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h -o -f $(SYSTEM_HEADER_DIR)/ansi/limits.h ] - -nextstep.o: $(srcdir)/config/nextstep.c $(CONFIG_H) flags.h tree.h - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/nextstep.c diff --git a/contrib/gcc/config/i386/t-osf b/contrib/gcc/config/i386/t-osf deleted file mode 100644 index c996e0c9e77b..000000000000 --- a/contrib/gcc/config/i386/t-osf +++ /dev/null @@ -1,2 +0,0 @@ -# If compiling with the osf gcc, avoid sharing code. -TCFLAGS = -pic-none diff --git a/contrib/gcc/config/i386/t-osf1elf b/contrib/gcc/config/i386/t-osf1elf deleted file mode 100644 index 77c7df1a6dfd..000000000000 --- a/contrib/gcc/config/i386/t-osf1elf +++ /dev/null @@ -1,18 +0,0 @@ -# Assemble startup files. -crti.o: $(srcdir)/config/i386/osf1-ci.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/osf1-ci.asm >crti.s - $(GCC_FOR_TARGET) -c -o crti.o crti.s -crtn.o: $(srcdir)/config/i386/osf1-cn.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/osf1-cn.asm >crtn.s - $(GCC_FOR_TARGET) -c -o crtn.o crtn.s - -# The pushl in CTOR initialization interferes with frame pointer elimination. - -# We need to use -fPIC when we are using gcc to compile the routines in -# crtstuff.c. This is only really needed when we are going to use gcc/g++ -# to produce a shared library, but since we don't know ahead of time when -# we will be doing that, we just always use -fPIC when compiling the -# routines in crtstuff.c. - -CRTSTUFF_T_CFLAGS = -fPIC -fno-omit-frame-pointer -TARGET_LIBGCC2_CFLAGS = -fPIC diff --git a/contrib/gcc/config/i386/t-sco5 b/contrib/gcc/config/i386/t-sco5 deleted file mode 100644 index f602066e9959..000000000000 --- a/contrib/gcc/config/i386/t-sco5 +++ /dev/null @@ -1,20 +0,0 @@ -# The pushl in CTOR initialization interferes with frame pointer elimination. -CRTSTUFF_T_CFLAGS = -fPIC -fno-omit-frame-pointer -CRTSTUFF_T_CFLAGS_S = -mcoff -fno-omit-frame-pointer - -# -# I am still a little unsure of the multilib architecture. The following -# 4 lines are based on advice from meissner@cygnus.com. -# -MULTILIB_OPTIONS = mcoff/fPIC -MULTILIB_DIRNAMES = coff pic -MULTILIB_EXCEPTIONS = *mcoff*/*fPIC* -MULTILIB_MATCHES = fPIC=fpic -MULTILIB_EXTRA_OPTS = - -LIBGCC=stmp-multilib -INSTALL_LIBGCC=install-multilib - -crti.o: $(srcdir)/config/i386/sol2-ci.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-ci.asm >crti.s - $(GCC_FOR_TARGET) -c -o crti.o crti.s diff --git a/contrib/gcc/config/i386/t-sco5gas b/contrib/gcc/config/i386/t-sco5gas deleted file mode 100644 index 2bca87be7a8b..000000000000 --- a/contrib/gcc/config/i386/t-sco5gas +++ /dev/null @@ -1,20 +0,0 @@ -# The pushl in CTOR initialization interferes with frame pointer elimination. -CRTSTUFF_T_CFLAGS = -fPIC -fno-omit-frame-pointer -CRTSTUFF_T_CFLAGS_S = -mcoff -fno-omit-frame-pointer - -# -# I am still a little unsure of the multilib architecture. The following -# 4 lines are based on advice from meissner@cygnus.com. -# -MULTILIB_OPTIONS = fPIC -MULTILIB_DIRNAMES = pic -MULTILIB_EXCEPTIONS = *fPIC* -MULTILIB_MATCHES = fPIC=fpic -MULTILIB_EXTRA_OPTS = - -LIBGCC=stmp-multilib -INSTALL_LIBGCC=install-multilib - -crti.o: $(srcdir)/config/i386/sol2-ci.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-ci.asm >crti.s - $(GCC_FOR_TARGET) -c -o crti.o crti.s diff --git a/contrib/gcc/config/i386/t-sol2 b/contrib/gcc/config/i386/t-sol2 deleted file mode 100644 index 5dc59cc375ed..000000000000 --- a/contrib/gcc/config/i386/t-sol2 +++ /dev/null @@ -1,40 +0,0 @@ -# we need to supply our own assembly versions of libgcc1.c files, -# since the user may not have native 'cc' available - -LIBGCC1 = libgcc1.null -CROSS_LIBGCC1 = libgcc1.null - -# gmon build rule: -gmon.o: $(srcdir)/config/i386/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/config/i386/gmon-sol2.c -o gmon.o - -# Assemble startup files. -# Apparently Sun believes that assembler files don't need comments, because no -# single ASCII character is valid (tried them all). So we manually strip out -# the comments with sed. This bug may only be in the Early Access releases. -gcrt1.o: $(srcdir)/config/i386/sol2-gc1.asm - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-gc1.asm >gcrt1.s - $(AS) -o gcrt1.o gcrt1.s -crt1.o: $(srcdir)/config/i386/sol2-c1.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-c1.asm >crt1.s - $(GCC_FOR_TARGET) -c -o crt1.o crt1.s -crti.o: $(srcdir)/config/i386/sol2-ci.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-ci.asm >crti.s - $(GCC_FOR_TARGET) -c -o crti.o crti.s -crtn.o: $(srcdir)/config/i386/sol2-cn.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-cn.asm >crtn.s - $(GCC_FOR_TARGET) -c -o crtn.o crtn.s - -# We need to use -fPIC when we are using gcc to compile the routines in -# crtstuff.c. This is only really needed when we are going to use gcc/g++ -# to produce a shared library, but since we don't know ahead of time when -# we will be doing that, we just always use -fPIC when compiling the -# routines in crtstuff.c. -# -# We must also enable optimization to avoid having any code appear after -# the call & alignment statement, but before we switch back to the -# .text section. - -CRTSTUFF_T_CFLAGS = -fPIC -O2 -TARGET_LIBGCC2_CFLAGS = -fPIC diff --git a/contrib/gcc/config/i386/t-svr3dbx b/contrib/gcc/config/i386/t-svr3dbx deleted file mode 100644 index 517113791911..000000000000 --- a/contrib/gcc/config/i386/t-svr3dbx +++ /dev/null @@ -1,7 +0,0 @@ -# gas 1.38.1 supporting dbx-in-coff requires a link script. - -svr3.ifile: $(srcdir)/config/i386/svr3.ifile - rm -f svr3.ifile; cp $(srcdir)/config/i386/svr3.ifile . - -svr3z.ifile: $(srcdir)/config/i386/svr3z.ifile - rm -f svr3z.ifile; cp $(srcdir)/config/i386/svr3z.ifile . diff --git a/contrib/gcc/config/i386/t-udk b/contrib/gcc/config/i386/t-udk deleted file mode 100644 index 96e186439795..000000000000 --- a/contrib/gcc/config/i386/t-udk +++ /dev/null @@ -1,2 +0,0 @@ -# Tell fixincludes to work on this set of headers -SYSTEM_HEADER_DIR = /udk/usr/include diff --git a/contrib/gcc/config/i386/t-uwin b/contrib/gcc/config/i386/t-uwin deleted file mode 100644 index 8e598683cdc3..000000000000 --- a/contrib/gcc/config/i386/t-uwin +++ /dev/null @@ -1,5 +0,0 @@ -# -# This is included *after* t-cygwin to override LIB1ASMSRC. -# -LIB1ASMSRC = i386/uwin.asm - diff --git a/contrib/gcc/config/i386/t-vsta b/contrib/gcc/config/i386/t-vsta deleted file mode 100644 index 6160b7ec945d..000000000000 --- a/contrib/gcc/config/i386/t-vsta +++ /dev/null @@ -1,2 +0,0 @@ -LIBGCC1 = libgcc1.null -CROSS_LIBGCC1 = libgcc1.null diff --git a/contrib/gcc/config/i386/t-winnt b/contrib/gcc/config/i386/t-winnt deleted file mode 100644 index 1e3557c1822a..000000000000 --- a/contrib/gcc/config/i386/t-winnt +++ /dev/null @@ -1,6 +0,0 @@ -winnt.o: $(srcdir)/config/i386/winnt.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt.c -oldnames.o: $(srcdir)/config/winnt/oldnames.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/winnt/oldnames.c -spawnv.o: $(srcdir)/config/winnt/spawnv.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/winnt/spawnv.c diff --git a/contrib/gcc/config/i386/udk.h b/contrib/gcc/config/i386/udk.h deleted file mode 100644 index 8e03abf52273..000000000000 --- a/contrib/gcc/config/i386/udk.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Configuration for i386 interfacing with SCO's Universal Development Kit - probably running on OpenServer 5, Unixware 2, or Unixware 5 - */ - - -/* We're very much the SVR4 target with "/udk" prepended to everything that's - interesting */ - -#include "i386/sysv5.h" - -#undef MD_EXEC_PREFIX -#define MD_EXEC_PREFIX "/udk/usr/ccs/bin/" - -#undef MD_STARTFILE_PREFIX -#define MD_STARTFILE_PREFIX "/udk/usr/ccs/lib/" - -#define STANDARD_INCLUDE_DIR "/udk/usr/include" - -#undef LINK_SPEC -#define LINK_SPEC "%{h*} %{v:-V} \ - %{b} %{Wl,*:%*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy -z text} \ - %{symbolic:-Bsymbolic -G -dy -z text} \ - %{G:-G} \ - %{YP,*} \ - %{!YP,*:%{p:-Y P,/udk/usr/ccs/lib/libp:/udk/usr/lib/libp:/udk/usr/ccs/lib:/udk/usr/lib} \ - %{!p:-Y P,/udk/usr/ccs/lib:/udk/usr/lib}} \ - %{Qy:} %{!Qn:-Qy}" - diff --git a/contrib/gcc/config/i386/unix.h b/contrib/gcc/config/i386/unix.h deleted file mode 100644 index 771d802b4095..000000000000 --- a/contrib/gcc/config/i386/unix.h +++ /dev/null @@ -1,190 +0,0 @@ -/* Definitions for Unix assembler syntax for the Intel 80386. - Copyright (C) 1988, 1994, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file defines the aspects of assembler syntax - that are the same for all the i386 Unix systems - (though they may differ in non-Unix systems). */ - -/* Define some concatenation macros to concatenate an opcode - and one, two or three operands. In other assembler syntaxes - they may alter the order of ther operands. */ - -/* Note that the other files fail to use these - in some of the places where they should. */ - -#if defined(__STDC__) || defined(ALMOST_STDC) -#define AS2(a,b,c) #a " " #b "," #c -#define AS2C(b,c) " " #b "," #c -#define AS3(a,b,c,d) #a " " #b "," #c "," #d -#define AS1(a,b) #a " " #b -#else -#define AS1(a,b) "a b" -#define AS2(a,b,c) "a b,c" -#define AS2C(b,c) " b,c" -#define AS3(a,b,c,d) "a b,c,d" -#endif - -/* Define macro used to output shift-double opcodes when the shift - count is in %cl. Some assemblers require %cl as an argument; - some don't. This macro controls what to do: by default, don't - print %cl. */ -#define SHIFT_DOUBLE_OMITS_COUNT 1 -#define AS3_SHIFT_DOUBLE(a,b,c,d) \ - (SHIFT_DOUBLE_OMITS_COUNT ? AS2 (a,c,d) : AS3 (a,b,c,d)) - -/* Output the size-letter for an opcode. - CODE is the letter used in an operand spec (L, B, W, S or Q). - CH is the corresponding lower case letter - (except if CODE is `Q' then CH is `l', unless GAS_MNEMONICS). */ -#define PUT_OP_SIZE(CODE,CH,FILE) putc (CH,(FILE)) - -/* Opcode suffix for fullword insn. */ -#define L_SIZE "l" - -/* Prefix for register names in this syntax. */ -#define RP "%" - -/* Prefix for immediate operands in this syntax. */ -#define IP "$" - -/* Indirect call instructions should use `*'. */ -#define USE_STAR 1 - -/* Prefix for a memory-operand X. */ -#define PRINT_PTR(X, FILE) - -/* Delimiters that surround base reg and index reg. */ -#define ADDR_BEG(FILE) putc('(', (FILE)) -#define ADDR_END(FILE) putc(')', (FILE)) - -/* Print an index register (whose rtx is IREG). */ -#define PRINT_IREG(FILE,IREG) \ - do \ - { fputs (",", (FILE)); PRINT_REG ((IREG), 0, (FILE)); } \ - while (0) - -/* Print an index scale factor SCALE. */ -#define PRINT_SCALE(FILE,SCALE) \ - if ((SCALE) != 1) fprintf ((FILE), ",%d", (SCALE)) - -/* Print a base/index combination. - BREG is the base reg rtx, IREG is the index reg rtx, - and SCALE is the index scale factor (an integer). */ - -#define PRINT_B_I_S(BREG,IREG,SCALE,FILE) \ - { ADDR_BEG (FILE); \ - if (BREG) PRINT_REG ((BREG), 0, (FILE)); \ - if ((IREG) != 0) \ - { PRINT_IREG ((FILE), (IREG)); \ - PRINT_SCALE ((FILE), (SCALE)); } \ - ADDR_END (FILE); } - -/* Define the syntax of pseudo-ops, labels and comments. */ - -/* String containing the assembler's comment-starter. */ - -#define ASM_COMMENT_START "/" - -/* Output to assembler file text saying following lines - may contain character constants, extra white space, comments, etc. */ - -#define ASM_APP_ON "/APP\n" - -/* Output to assembler file text saying following lines - no longer contain unusual constructs. */ - -#define ASM_APP_OFF "/NO_APP\n" - -/* Output before read-only data. */ - -#define TEXT_SECTION_ASM_OP ".text" - -/* Output before writable (initialized) data. */ - -#define DATA_SECTION_ASM_OP ".data" - -/* Output before writable (uninitialized) data. */ - -#define BSS_SECTION_ASM_OP ".bss" - -/* This is how to output a command to make the user-level label named NAME - defined for reference from other files. */ - -#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ - (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE)) - -/* By default, target has a 80387, uses IEEE compatible arithmetic, - and returns float values in the 387. */ - -#define TARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) - -/* Floating-point return values come in the FP register. */ - -#define VALUE_REGNO(MODE) \ - (GET_MODE_CLASS (MODE) == MODE_FLOAT \ - && TARGET_FLOAT_RETURNS_IN_80387 ? FIRST_FLOAT_REG : 0) - -/* 1 if N is a possible register number for a function value. */ - -#define FUNCTION_VALUE_REGNO_P(N) \ - ((N) == 0 || ((N)== FIRST_FLOAT_REG && TARGET_FLOAT_RETURNS_IN_80387)) - -/* Output code to add DELTA to the first argument, and then jump to FUNCTION. - Used for C++ multiple inheritance. */ -#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ -do { \ - tree parm; \ - \ - if (i386_regparm > 0) \ - parm = TYPE_ARG_TYPES (TREE_TYPE (function)); \ - else \ - parm = NULL_TREE; \ - for (; parm; parm = TREE_CHAIN (parm)) \ - if (TREE_VALUE (parm) == void_type_node) \ - break; \ - fprintf (FILE, "\taddl $%d,%s\n", DELTA, \ - parm ? "%eax" \ - : aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? "8(%esp)" \ - : "4(%esp)"); \ - \ - if (flag_pic) \ - { \ - rtx xops[2]; \ - xops[0] = pic_offset_table_rtx; \ - xops[1] = (rtx) gen_label_rtx (); \ - \ - if (i386_regparm > 2) \ - abort (); \ - output_asm_insn ("push%L0 %0", xops); \ - output_asm_insn (AS1 (call,%P1), xops); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", CODE_LABEL_NUMBER (xops[1])); \ - output_asm_insn (AS1 (pop%L0,%0), xops); \ - output_asm_insn ("addl $%__GLOBAL_OFFSET_TABLE_+[.-%P1],%0", xops); \ - fprintf (FILE, "\tmovl "); \ - assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ - fprintf (FILE, "@GOT(%%ebx),%%ecx\n\tpopl %%ebx\n\tjmp *%%ecx\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tjmp "); \ - assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ - fprintf (FILE, "\n"); \ - } \ -} while (0) diff --git a/contrib/gcc/config/i386/uwin.asm b/contrib/gcc/config/i386/uwin.asm deleted file mode 100644 index 6268343f4c02..000000000000 --- a/contrib/gcc/config/i386/uwin.asm +++ /dev/null @@ -1,32 +0,0 @@ -/* stuff needed for libgcc1 on win32. */ - -#ifdef L_chkstk - - .global __chkstk - .global __alloca -__chkstk: -__alloca: - pushl %ecx /* save temp */ - movl %esp,%ecx /* get sp */ - addl $0x8,%ecx /* and point to return addr */ - -probe: cmpl $0x1000,%eax /* > 4k ?*/ - jb done - - subl $0x1000,%ecx /* yes, move pointer down 4k*/ - orl $0x0,(%ecx) /* probe there */ - subl $0x1000,%eax /* decrement count */ - jmp probe /* and do it again */ - -done: subl %eax,%ecx - orl $0x0,(%ecx) /* less that 4k, just peek here */ - - movl %esp,%eax - movl %ecx,%esp /* decrement stack */ - - movl (%eax),%ecx /* recover saved temp */ - movl 4(%eax),%eax /* get return address */ - jmp *%eax - - -#endif diff --git a/contrib/gcc/config/i386/uwin.h b/contrib/gcc/config/i386/uwin.h deleted file mode 100644 index 73e04add2e97..000000000000 --- a/contrib/gcc/config/i386/uwin.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for - hosting on U/WIN (Windows32), using GNU tools and the Windows32 API - Library, as distinct from winnt.h, which is used to build GCC for use - with a windows style library and tool set and uses the Microsoft tools. - Copyright (C) 1999 Free Software Foundation, Inc. - Contributed by Mumit Khan . - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Most of this is the same as for Cygwin32, except for changing some - specs. */ - -#include "i386/cygwin.h" - -#define STANDARD_INCLUDE_COMPONENT "UWIN" -#define SYSTEM_INCLUDE_DIR "/usr/gnu/include" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__i386__ -D_WIN32 -D__WIN32__ \ - -D_UWIN -DWINNT -D_X86_=1 -D__STDC__=1 \ - -D__UWIN__ -D__MSVCRT__ \ - -D_STD_INCLUDE_DIR=mingw32 \ - -D__stdcall=__attribute__((__stdcall__)) \ - _D_stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - -D__declspec(x)=__attribute__((x)) \ - -Asystem(winnt) -Acpu(i386) -Amachine(i386)" - -#undef CPP_SPEC -#define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ - -include /usr/include/astwin32.h \ - -idirafter /usr/gnu/include/mingw32" - -/* For Windows applications, include more libraries, but always include - kernel32. */ -#undef LIB_SPEC -#define LIB_SPEC \ - "%{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32 -ladvapi32" - -/* This is needed in g77spec.c for now. Will be removed in the future. */ -#define WIN32_UWIN_TARGET 1 - -/* Include in the mingw32 libraries with libgcc */ -#undef LIBGCC_SPEC -#define LIBGCC_SPEC "-lgnuwin -lposix -lgcc -last -lmoldname -lmsvcrt" - -/* Specify a different entry point when linking a DLL */ -#undef LINK_SPEC -#define LINK_SPEC \ - "%{mwindows:--subsystem windows} %{mdll:--dll -e _DllMainCRTStartup@12}" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{mdll:dllcrt2%O%s} %{!mdll:crt2%O%s}" - -/* These are PE BFD bug workarounds. Should go away eventually. */ - -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do \ - { \ - if (i386_pe_dllexport_name_p (NAME)) \ - { \ - drectve_section (); \ - fprintf ((FILE), "\t.ascii \" -export:%s\"\n", \ - I386_PE_STRIP_ENCODING (NAME)); \ - function_section (DECL); \ - } \ - /* disable i386_pe_declare_function_type for UWIN */ \ - if (0 && write_symbols != SDB_DEBUG) \ - i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \ - ASM_OUTPUT_LABEL (FILE, NAME); \ - } \ - while (0) - -#undef ASM_OUTPUT_EXTERNAL -#undef ASM_OUTPUT_EXTERNAL_LIBCALL -#undef ASM_FILE_END - diff --git a/contrib/gcc/config/i386/v3gas.h b/contrib/gcc/config/i386/v3gas.h deleted file mode 100644 index fe558d265b42..000000000000 --- a/contrib/gcc/config/i386/v3gas.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Definitions for Intel 386 running system V, using gas. - Copyright (C) 1992, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include - -/* Add stuff that normally comes from i386v.h */ - -/* longjmp may fail to restore the registers if called from the same - function that called setjmp. To compensate, the compiler avoids - putting variables in registers in functions that use both setjmp - and longjmp. */ - -#define NON_SAVING_SETJMP \ - (current_function_calls_setjmp && current_function_calls_longjmp) - -/* longjmp may fail to restore the stack pointer if the saved frame - pointer is the same as the caller's frame pointer. Requiring a frame - pointer in any function that calls setjmp or longjmp avoids this - problem, unless setjmp and longjmp are called from the same function. - Since a frame pointer will be required in such a function, it is OK - that the stack pointer is not restored. */ - -#undef FRAME_POINTER_REQUIRED -#define FRAME_POINTER_REQUIRED \ - (current_function_calls_setjmp || current_function_calls_longjmp) - -/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */ -#undef ASM_OUTPUT_LOCAL -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ - do { \ - int align = exact_log2 (ROUNDED); \ - if (align > 2) align = 2; \ - if (TARGET_SVR3_SHLIB) \ - { \ - data_section (); \ - ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \ - ASM_OUTPUT_LABEL ((FILE), (NAME)); \ - fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)); \ - } \ - else \ - { \ - fputs (".lcomm ", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u\n", (ROUNDED)); \ - } \ - } while (0) - -/* Add stuff that normally comes from i386v.h via svr3.h */ - -/* Define the actual types of some ANSI-mandated types. These - definitions should work for most SVR3 systems. */ - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD diff --git a/contrib/gcc/config/i386/vsta.h b/contrib/gcc/config/i386/vsta.h deleted file mode 100644 index ee7fab9173f2..000000000000 --- a/contrib/gcc/config/i386/vsta.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Configuration for an i386 running VSTa micro-kernel. - Copyright (C) 1994 Free Software Foundation, Inc. - Contributed by Rob Savoye (rob@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define YES_UNDERSCORES - -#include "i386/gas.h" - -#ifdef CPP_PREDEFINES -#undef CPP_PREDEFINES -#endif -#define CPP_PREDEFINES "-Dunix -Di386 -DVSTA \ - -Asystem(unix) -Asystem(vsta) -Acpu(i386) -Amachine(i386)" - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_ctor, in_dtor - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CTOR_SECTION_FUNCTION \ - DTOR_SECTION_FUNCTION - -#define CTOR_SECTION_FUNCTION \ -void \ -ctor_section () \ -{ \ - if (in_section != in_ctor) \ - { \ - fprintf (asm_out_file, "\t.section .ctor\n"); \ - in_section = in_ctor; \ - } \ -} - -#define DTOR_SECTION_FUNCTION \ -void \ -dtor_section () \ -{ \ - if (in_section != in_dtor) \ - { \ - fprintf (asm_out_file, "\t.section .dtor\n"); \ - in_section = in_dtor; \ - } \ -} - -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - - diff --git a/contrib/gcc/config/i386/vxi386.h b/contrib/gcc/config/i386/vxi386.h deleted file mode 100644 index 0bd27b4a189c..000000000000 --- a/contrib/gcc/config/i386/vxi386.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Definitions of target machine for GNU compiler. VxWorks i386 version. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef CPP_CPU_SPEC -#define CPP_CPU_SPEC "\ --Asystem(unix) -Acpu(i386) -Amachine(i386) \ -%{!ansi:-Di386} -D__i386 -D__i386__ \ -%{march=i386:-DCPU=I80386} \ -%{march=i486:-DCPU=I80486 %(cpp_486)} \ -%{march=pentium:-DCPU=PENTIUM -DCPU_VARIANT=PENTIUM %(cpp_586)} \ -%{march=pentiumpro:-DCPU=PENTIUM -DCPU_VARIANT=PENTIUMPRO %(cpp_686)} \ -%{!march=*: \ - %{mcpu=i386:-DCPU=I80386} \ - %{mcpu=i486:-DCPU=I80486 %(cpp_486)} %{m486:-DCPU=I80486 %(cpp_486)} \ - %{mpentium:-DCPU=PENTIUM -DCPU_VARIANT=PENTIUM %(cpp_586)} \ - %{mcpu=pentium:-DCPU=PENTIUM -DCPU_VARIANT=PENTIUM %(cpp_586)} \ - %{mpentiumpro:-DCPU=PENTIUM -DCPU_VARIANT=PENTIUMPRO %(cpp_686)} \ - %{mcpu=pentiumpro:-DCPU=PENTIUM -DCPU_VARIANT=PENTIUMPRO %(cpp_686)} \ - %{!mcpu*:%{!m486:%{!mpentium*:-DCPU=I80386 %(cpp_cpu_default)}}}}" - -#include "i386/i386-aout.h" - -#define HANDLE_SYSV_PRAGMA - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__vxworks -D__i386__" - -/* VxWorks does all the library stuff itself. */ - -#undef LIB_SPEC -#define LIB_SPEC "" - -/* VxWorks uses object files, not loadable images. make linker just - combine objects. */ - -#undef LINK_SPEC -#define LINK_SPEC "-r" - -/* VxWorks provides the functionality of crt0.o and friends itself. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "" diff --git a/contrib/gcc/config/i386/win-nt.h b/contrib/gcc/config/i386/win-nt.h deleted file mode 100644 index 97f10c39d002..000000000000 --- a/contrib/gcc/config/i386/win-nt.h +++ /dev/null @@ -1,150 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for - Windows NT 3.x on an i386. - Copyright (C) 1994, 1995 Free Software Foundation, Inc. - Contributed by Douglas B. Rupp (drupp@cs.washington.edu). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define YES_UNDERSCORES - -#include "i386/gas.h" - -#ifdef CPP_PREDEFINES -#undef CPP_PREDEFINES -#endif -#define CPP_PREDEFINES "-Dunix -Di386 -DWIN32 -D_WIN32 \ - -DWINNT -D_M_IX86=300 -D_X86_=1 -D__STDC__=0 -DALMOST_STDC -D_MSC_VER=800 \ - -D__stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - -D_cdecl=__attribute__((__cdecl__)) \ - -Asystem(unix) -Asystem(winnt) -Acpu(i386) -Amachine(i386)" - -#define SIZE_TYPE "unsigned int" -#define PTRDIFF_TYPE "int" -#define WCHAR_UNSIGNED 1 -#define WCHAR_TYPE_SIZE 16 -#define WCHAR_TYPE "short unsigned int" -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 64 -#define HAVE_ATEXIT 1 - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_ctor, in_dtor - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CTOR_SECTION_FUNCTION \ - DTOR_SECTION_FUNCTION - -#define CTOR_SECTION_FUNCTION \ -void \ -ctor_section () \ -{ \ - if (in_section != in_ctor) \ - { \ - fprintf (asm_out_file, "\t.section .ctor\n"); \ - in_section = in_ctor; \ - } \ -} - -#define DTOR_SECTION_FUNCTION \ -void \ -dtor_section () \ -{ \ - if (in_section != in_dtor) \ - { \ - fprintf (asm_out_file, "\t.section .dtor\n"); \ - in_section = in_dtor; \ - } \ -} - -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol - so that we may access it directly in the GOT. - - On i386 running Windows NT, modify the assembler name with a suffix - consisting of an atsign (@) followed by string of digits that represents - the number of bytes of arguments passed to the function, if it has the - attribute STDCALL. */ - -#ifdef ENCODE_SECTION_INFO -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) \ -do \ - { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ - if (lookup_attribute ("stdcall", \ - TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \ - XEXP (DECL_RTL (DECL), 0) = \ - gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \ - } \ -while (0) -#endif - -/* The global __fltused is necessary to cause the printf/scanf routines - for outputting/inputting floating point numbers to be loaded. Since this - is kind of hard to detect, we just do it all the time. */ - -#ifdef ASM_FILE_START -#undef ASM_FILE_START -#endif -#define ASM_FILE_START(FILE) \ - do { output_file_directive (FILE, main_input_filename); \ - fprintf (FILE, ".global\t__fltused\n"); \ - } while (0) - -/* if the switch "-mwindows" is passed to ld, then specify to the Microsoft - linker the proper switches and libraries to build a graphical program */ - -#undef LIB_SPEC -#define LIB_SPEC "%{mwindows:-subsystem windows -e _WinMainCRTStartup \ - USER32.LIB%s GDI32.LIB%s COMDLG32.LIB%s WINSPOOL.LIB%s} \ - %{!mwindows:-subsystem console -e _mainCRTStartup} \ - %{mcrtmt:LIBCMT.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \ - %{!mcrtmt:LIBC.LIB%s KERNEL32.LIB%s ADVAPI32.LIB%s} \ - %{v}" - -#include "winnt/win-nt.h" - diff --git a/contrib/gcc/config/i386/win32.h b/contrib/gcc/config/i386/win32.h deleted file mode 100644 index d62abbf16d8b..000000000000 --- a/contrib/gcc/config/i386/win32.h +++ /dev/null @@ -1,280 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for - hosting on Windows NT 3.x, using a Unix style C library and tools, - as distinct from winnt.h, which is used to build GCC for use with a - windows style library and tool set and uses the Microsoft tools. - Copyright (C) 1995-1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define YES_UNDERSCORES - -/* Enable parsing of #pragma pack(push,) and #pragma pack(pop). */ -#define HANDLE_PRAGMA_PACK_PUSH_POP 1 - -#define DBX_DEBUGGING_INFO -#define SDB_DEBUGGING_INFO -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#include "i386/gas.h" -#include "dbxcoff.h" - -/* Augment TARGET_SWITCHES with the cygwin/win32 options. */ -#define MASK_WIN32 0x40000000 /* Use -lming32 interface */ -#define MASK_CYGWIN 0x20000000 /* Use -lcygwin interface */ -#define MASK_WINDOWS 0x10000000 /* Use windows interface */ -#define MASK_DLL 0x08000000 /* Use dll interface */ -#define MASK_NOP_FUN_DLLIMPORT 0x20000 /* Ignore dllimport for functions */ - -#define TARGET_WIN32 (target_flags & MASK_WIN32) -#define TARGET_CYGWIN (target_flags & MASK_CYGWIN) -#define TARGET_WINDOWS (target_flags & MASK_WINDOWS) -#define TARGET_DLL (target_flags & MASK_DLL) -#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT) - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - { "win32", MASK_WIN32, "Use Mingw32 interface" }, \ - { "cygwin", MASK_CYGWIN, "Use Cygwin interface" }, \ - { "windows", MASK_WINDOWS, "Use bare Windows interface" }, \ - { "dll", MASK_DLL, "Generate code for a DLL" }, \ - { "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, "Ignore dllimport for functions" }, \ - { "no-nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, "" }, - - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D_WIN32 \ - -DWINNT -D_X86_=1 -D__STDC__=1\ - -D__stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - -Asystem(winnt)" - -#undef STARTFILE_SPEC - -#define STARTFILE_SPEC "%{mdll:dllcrt0%O%s} %{!mdll: %{!mcygwin:mcrt0%O%s} \ - %{mcygwin:crt0%O%s} %{pg:gcrt0%O%s}}" - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ - %{!mcygwin:-iwithprefixbefore include/mingw32 -D__MINGW32__} \ - %{mcygwin:-D__CYGWIN32__ -D__CYGWIN__}" - -/* We have to dynamic link to get to the system DLLs. All of libc, libm and - the Unix stuff is in cygwin.dll. The import library is called - 'libcygwin.a'. For Windows applications, include more libraries, but - always include kernel32. We'd like to specific subsystem windows to - ld, but that doesn't work just yet. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{pg:-lgmon} \ - %{!mcygwin:-lmingw32 -lmoldname -lmsvcrt -lcrtdll} \ - %{mcygwin:-lcygwin} %{mwindows:-luser32 -lgdi32 -lcomdlg32} \ - -lkernel32 -ladvapi32 -lshell32" - -#define LINK_SPEC "%{mwindows:--subsystem windows} \ - %{mdll:--dll -e _DllMainCRTStartup@12}" - -#define SIZE_TYPE "unsigned int" -#define PTRDIFF_TYPE "int" -#define WCHAR_UNSIGNED 1 -#define WCHAR_TYPE_SIZE 16 -#define WCHAR_TYPE "short unsigned int" -/* Currently we do not have the atexit() function, - so take that from libgcc2.c */ - -#define NEED_ATEXIT 1 -#define HAVE_ATEXIT 1 - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_ctor, in_dtor - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CTOR_SECTION_FUNCTION \ - DTOR_SECTION_FUNCTION - -#define CTOR_SECTION_FUNCTION \ -void \ -ctor_section () \ -{ \ - if (in_section != in_ctor) \ - { \ - fprintf (asm_out_file, "\t.section .ctor\n"); \ - in_section = in_ctor; \ - } \ -} - -#define DTOR_SECTION_FUNCTION \ -void \ -dtor_section () \ -{ \ - if (in_section != in_dtor) \ - { \ - fprintf (asm_out_file, "\t.section .dtor\n"); \ - in_section = in_dtor; \ - } \ -} - -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtor_section (); \ - fprintf (FILE, "%s\t", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol - so that we may access it directly in the GOT. - - On i386 running Windows NT, modify the assembler name with a suffix - consisting of an atsign (@) followed by string of digits that represents - the number of bytes of arguments passed to the function, if it has the - attribute STDCALL. */ - -#ifdef ENCODE_SECTION_INFO -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL) \ -do \ - { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ - if (lookup_attribute ("stdcall", \ - TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \ - XEXP (DECL_RTL (DECL), 0) = \ - gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \ - } \ -while (0) -#endif - -/* This macro gets just the user-specified name - out of the string in a SYMBOL_REF. Discard - trailing @[NUM] encoded by ENCODE_SECTION_INFO. - Do we need the stripping of leading '*'? */ -#undef STRIP_NAME_ENCODING -#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ -do { \ - char *_p; \ - char *_name = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*')); \ - for (_p = _name; *_p && *_p != '@'; ++_p) \ - ; \ - if (*_p == '@') \ - { \ - int _len = _p - _name; \ - (VAR) = (char *) alloca (_len + 1); \ - strncpy ((VAR), _name, _len); \ - (VAR)[_len] = '\0'; \ - } \ - else \ - (VAR) = _name; \ -} while (0) - - -/* Emit code to check the stack when allocating more that 4000 - bytes in one go. */ - -#define CHECK_STACK_LIMIT 4000 - -/* By default, target has a 80387, uses IEEE compatible arithmetic, - and returns float values in the 387 and needs stack probes */ -#undef TARGET_DEFAULT - -#define TARGET_DEFAULT \ - (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE) - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) - -/* Define this macro if in some cases global symbols from one translation - unit may not be bound to undefined symbols in another translation unit - without user intervention. For instance, under Microsoft Windows - symbols must be explicitly imported from shared libraries (DLLs). */ -#define MULTIPLE_SYMBOL_SPACES - -#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL) -extern void i386_pe_unique_section (); -#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC) - -#define SUPPORTS_ONE_ONLY 1 - -/* A C statement to output something to the assembler file to switch to section - NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or - NULL_TREE. Some target formats do not support arbitrary sections. Do not - define this macro in such cases. */ -#undef ASM_OUTPUT_SECTION_NAME -#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \ -do { \ - if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ - fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME)); \ - else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ - fprintf (STREAM, "\t.section %s,\"\"\n", (NAME)); \ - else \ - fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME)); \ - /* Functions may have been compiled at various levels of \ - optimization so we can't use `same_size' here. Instead, \ - have the linker pick one. */ \ - if ((DECL) && DECL_ONE_ONLY (DECL)) \ - fprintf (STREAM, "\t.linkonce %s\n", \ - TREE_CODE (DECL) == FUNCTION_DECL \ - ? "discard" : "same_size"); \ -} while (0) - -#undef ASM_COMMENT_START -#define ASM_COMMENT_START " #" - -/* DWARF2 Unwinding doesn't work with exception handling yet. */ -#define DWARF2_UNWIND_INFO 0 - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#define SUBTARGET_PROLOGUE \ - if (profile_flag \ - && strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)),\ - "main") == 0) \ - { \ - rtx xops[1]; \ - xops[0] = gen_rtx_MEM (FUNCTION_MODE, \ - gen_rtx (SYMBOL_REF, Pmode, "_monstartup")); \ - if (do_rtl) \ - emit_call_insn (gen_rtx (CALL, VOIDmode, xops[0], const0_rtx)); \ - else \ - output_asm_insn (AS1 (call,%P1), xops); \ - } diff --git a/contrib/gcc/config/i386/winnt.c b/contrib/gcc/config/i386/winnt.c deleted file mode 100644 index 24d8617f8dfa..000000000000 --- a/contrib/gcc/config/i386/winnt.c +++ /dev/null @@ -1,600 +0,0 @@ -/* Subroutines for insn-output.c for Windows NT. - Contributed by Douglas Rupp (drupp@cs.washington.edu) - Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "regs.h" -#include "hard-reg-set.h" -#include "output.h" -#include "tree.h" -#include "flags.h" - -/* i386/PE specific attribute support. - - i386/PE has two new attributes: - dllexport - for exporting a function/variable that will live in a dll - dllimport - for importing a function/variable from a dll - - Microsoft allows multiple declspecs in one __declspec, separating - them with spaces. We do NOT support this. Instead, use __declspec - multiple times. -*/ - -/* Return nonzero if ATTR is a valid attribute for DECL. - ATTRIBUTES are any existing attributes and ARGS are the arguments - supplied with ATTR. */ - -int -i386_pe_valid_decl_attribute_p (decl, attributes, attr, args) - tree decl; - tree attributes; - tree attr; - tree args; -{ - if (args == NULL_TREE) - { - if (is_attribute_p ("dllexport", attr)) - return 1; - if (is_attribute_p ("dllimport", attr)) - return 1; - } - - return i386_valid_decl_attribute_p (decl, attributes, attr, args); -} - -/* Return nonzero if ATTR is a valid attribute for TYPE. - ATTRIBUTES are any existing attributes and ARGS are the arguments - supplied with ATTR. */ - -int -i386_pe_valid_type_attribute_p (type, attributes, attr, args) - tree type; - tree attributes; - tree attr; - tree args; -{ - if (args == NULL_TREE - && (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE)) - { - if (is_attribute_p ("dllexport", attr)) - return 1; - if (is_attribute_p ("dllimport", attr)) - return 1; - } - - return i386_valid_type_attribute_p (type, attributes, attr, args); -} - -/* Merge attributes in decls OLD and NEW. - - This handles the following situation: - - __declspec (dllimport) int foo; - int foo; - - The second instance of `foo' nullifies the dllimport. */ - -tree -i386_pe_merge_decl_attributes (old, new) - tree old, new; -{ - tree a; - int delete_dllimport_p; - - old = DECL_MACHINE_ATTRIBUTES (old); - new = DECL_MACHINE_ATTRIBUTES (new); - - /* What we need to do here is remove from `old' dllimport if it doesn't - appear in `new'. dllimport behaves like extern: if a declaration is - marked dllimport and a definition appears later, then the object - is not dllimport'd. */ - - if (lookup_attribute ("dllimport", old) != NULL_TREE - && lookup_attribute ("dllimport", new) == NULL_TREE) - delete_dllimport_p = 1; - else - delete_dllimport_p = 0; - - a = merge_attributes (old, new); - - if (delete_dllimport_p) - { - tree prev,t; - - /* Scan the list for dllimport and delete it. */ - for (prev = NULL_TREE, t = a; t; prev = t, t = TREE_CHAIN (t)) - { - if (is_attribute_p ("dllimport", TREE_PURPOSE (t))) - { - if (prev == NULL_TREE) - a = TREE_CHAIN (a); - else - TREE_CHAIN (prev) = TREE_CHAIN (t); - break; - } - } - } - - return a; -} - -/* Return the type that we should use to determine if DECL is - imported or exported. */ - -static tree -associated_type (decl) - tree decl; -{ - tree t = NULL_TREE; - - /* In the C++ frontend, DECL_CONTEXT for a method doesn't actually refer - to the containing class. So we look at the 'this' arg. */ - if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE) - { - /* Artificial methods are not affected by the import/export status of - their class unless they are virtual. */ - if (! DECL_ARTIFICIAL (decl) || DECL_VINDEX (decl)) - t = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))); - } - else if (DECL_CONTEXT (decl) - && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't') - t = DECL_CONTEXT (decl); - - return t; -} - -/* Return non-zero if DECL is a dllexport'd object. */ - -int -i386_pe_dllexport_p (decl) - tree decl; -{ - tree exp; - - if (TREE_CODE (decl) != VAR_DECL - && TREE_CODE (decl) != FUNCTION_DECL) - return 0; - exp = lookup_attribute ("dllexport", DECL_MACHINE_ATTRIBUTES (decl)); - if (exp) - return 1; - - /* Class members get the dllexport status of their class. */ - if (associated_type (decl)) - { - exp = lookup_attribute ("dllexport", - TYPE_ATTRIBUTES (associated_type (decl))); - if (exp) - return 1; - } - - return 0; -} - -/* Return non-zero if DECL is a dllimport'd object. */ - -int -i386_pe_dllimport_p (decl) - tree decl; -{ - tree imp; - - if (TREE_CODE (decl) == FUNCTION_DECL - && TARGET_NOP_FUN_DLLIMPORT) - return 0; - - if (TREE_CODE (decl) != VAR_DECL - && TREE_CODE (decl) != FUNCTION_DECL) - return 0; - imp = lookup_attribute ("dllimport", DECL_MACHINE_ATTRIBUTES (decl)); - if (imp) - return 1; - - /* Class members get the dllimport status of their class. */ - if (associated_type (decl)) - { - imp = lookup_attribute ("dllimport", - TYPE_ATTRIBUTES (associated_type (decl))); - if (imp) - return 1; - } - - return 0; -} - -/* Return non-zero if SYMBOL is marked as being dllexport'd. */ - -int -i386_pe_dllexport_name_p (symbol) - char *symbol; -{ - return symbol[0] == '@' && symbol[1] == 'e' && symbol[2] == '.'; -} - -/* Return non-zero if SYMBOL is marked as being dllimport'd. */ - -int -i386_pe_dllimport_name_p (symbol) - char *symbol; -{ - return symbol[0] == '@' && symbol[1] == 'i' && symbol[2] == '.'; -} - -/* Mark a DECL as being dllexport'd. - Note that we override the previous setting (eg: dllimport). */ - -void -i386_pe_mark_dllexport (decl) - tree decl; -{ - char *oldname, *newname; - rtx rtlname; - tree idp; - - rtlname = XEXP (DECL_RTL (decl), 0); - if (GET_CODE (rtlname) == SYMBOL_REF) - oldname = XSTR (rtlname, 0); - else if (GET_CODE (rtlname) == MEM - && GET_CODE (XEXP (rtlname, 0)) == SYMBOL_REF) - oldname = XSTR (XEXP (rtlname, 0), 0); - else - abort (); - if (i386_pe_dllimport_name_p (oldname)) - oldname += 9; - else if (i386_pe_dllexport_name_p (oldname)) - return; /* already done */ - - newname = alloca (strlen (oldname) + 4); - sprintf (newname, "@e.%s", oldname); - - /* We pass newname through get_identifier to ensure it has a unique - address. RTL processing can sometimes peek inside the symbol ref - and compare the string's addresses to see if two symbols are - identical. */ - idp = get_identifier (newname); - - XEXP (DECL_RTL (decl), 0) = - gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (idp)); -} - -/* Mark a DECL as being dllimport'd. */ - -void -i386_pe_mark_dllimport (decl) - tree decl; -{ - char *oldname, *newname; - tree idp; - rtx rtlname, newrtl; - - rtlname = XEXP (DECL_RTL (decl), 0); - if (GET_CODE (rtlname) == SYMBOL_REF) - oldname = XSTR (rtlname, 0); - else if (GET_CODE (rtlname) == MEM - && GET_CODE (XEXP (rtlname, 0)) == SYMBOL_REF) - oldname = XSTR (XEXP (rtlname, 0), 0); - else - abort (); - if (i386_pe_dllexport_name_p (oldname)) - { - error ("`%s' declared as both exported to and imported from a DLL.", - IDENTIFIER_POINTER (DECL_NAME (decl))); - return; - } - else if (i386_pe_dllimport_name_p (oldname)) - { - /* Already done, but force correct linkage since the redeclaration - might have omitted explicit extern. Sigh. */ - if (TREE_CODE (decl) == VAR_DECL - /* ??? Is this test for vtables needed? */ - && !DECL_VIRTUAL_P (decl)) - { - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; - } - return; - } - - /* ??? One can well ask why we're making these checks here, - and that would be a good question. */ - - /* Imported variables can't be initialized. Note that C++ classes - are marked initial, so we need to check. */ - if (TREE_CODE (decl) == VAR_DECL - && !DECL_VIRTUAL_P (decl) - && (DECL_INITIAL (decl) - && ! TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))) - { - error_with_decl (decl, "initialized variable `%s' is marked dllimport"); - return; - } - /* Nor can they be static. */ - if (TREE_CODE (decl) == VAR_DECL - /* ??? Is this test for vtables needed? */ - && !DECL_VIRTUAL_P (decl) - && 0 /*???*/) - { - error_with_decl (decl, "static variable `%s' is marked dllimport"); - return; - } - - /* `extern' needn't be specified with dllimport. - Specify `extern' now and hope for the best. Sigh. */ - if (TREE_CODE (decl) == VAR_DECL - /* ??? Is this test for vtables needed? */ - && !DECL_VIRTUAL_P (decl)) - { - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; - } - - newname = alloca (strlen (oldname) + 11); - sprintf (newname, "@i._imp__%s", oldname); - - /* We pass newname through get_identifier to ensure it has a unique - address. RTL processing can sometimes peek inside the symbol ref - and compare the string's addresses to see if two symbols are - identical. */ - idp = get_identifier (newname); - - newrtl = gen_rtx (MEM, Pmode, - gen_rtx (SYMBOL_REF, Pmode, - IDENTIFIER_POINTER (idp))); - XEXP (DECL_RTL (decl), 0) = newrtl; - - /* Can't treat a pointer to this as a constant address */ - DECL_NON_ADDR_CONST_P (decl) = 1; -} - -/* Return string which is the former assembler name modified with a - suffix consisting of an atsign (@) followed by the number of bytes of - arguments */ - -char * -gen_stdcall_suffix (decl) - tree decl; -{ - int total = 0; - /* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead - of DECL_ASSEMBLER_NAME. */ - char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - char *newsym; - - if (TYPE_ARG_TYPES (TREE_TYPE (decl))) - if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (decl)))) - == void_type_node) - { - tree formal_type = TYPE_ARG_TYPES (TREE_TYPE (decl)); - - while (TREE_VALUE (formal_type) != void_type_node) - { - int parm_size - = TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type))); - /* Must round up to include padding. This is done the same - way as in store_one_arg. */ - parm_size = ((parm_size + PARM_BOUNDARY - 1) - / PARM_BOUNDARY * PARM_BOUNDARY); - total += parm_size; - formal_type = TREE_CHAIN (formal_type); - } - } - - newsym = xmalloc (strlen (asmname) + 10); - sprintf (newsym, "%s@%d", asmname, total/BITS_PER_UNIT); - return IDENTIFIER_POINTER (get_identifier (newsym)); -} - -/* Cover function to implement ENCODE_SECTION_INFO. */ - -void -i386_pe_encode_section_info (decl) - tree decl; -{ - /* This bit is copied from i386.h. */ - if (optimize > 0 && TREE_CONSTANT (decl) - && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) - { - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' - ? TREE_CST_RTL (decl) : DECL_RTL (decl)); - SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1; - } - - if (TREE_CODE (decl) == FUNCTION_DECL) - if (lookup_attribute ("stdcall", - TYPE_ATTRIBUTES (TREE_TYPE (decl)))) - XEXP (DECL_RTL (decl), 0) = - gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (decl)); - - /* Mark the decl so we can tell from the rtl whether the object is - dllexport'd or dllimport'd. */ - - if (i386_pe_dllexport_p (decl)) - i386_pe_mark_dllexport (decl); - else if (i386_pe_dllimport_p (decl)) - i386_pe_mark_dllimport (decl); - /* It might be that DECL has already been marked as dllimport, but a - subsequent definition nullified that. The attribute is gone but - DECL_RTL still has @i._imp__foo. We need to remove that. Ditto - for the DECL_NON_ADDR_CONST_P flag. */ - else if ((TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == VAR_DECL) - && DECL_RTL (decl) != NULL_RTX - && GET_CODE (DECL_RTL (decl)) == MEM - && GET_CODE (XEXP (DECL_RTL (decl), 0)) == MEM - && GET_CODE (XEXP (XEXP (DECL_RTL (decl), 0), 0)) == SYMBOL_REF - && i386_pe_dllimport_name_p (XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0))) - { - char *oldname = XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0); - tree idp = get_identifier (oldname + 9); - rtx newrtl = gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (idp)); - - XEXP (DECL_RTL (decl), 0) = newrtl; - - DECL_NON_ADDR_CONST_P (decl) = 0; - - /* We previously set TREE_PUBLIC and DECL_EXTERNAL. - We leave these alone for now. */ - } -} - -/* Cover function for UNIQUE_SECTION. */ - -void -i386_pe_unique_section (decl, reloc) - tree decl; - int reloc; -{ - int len; - char *name,*string,*prefix; - - name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - /* Strip off any encoding in fnname. */ - STRIP_NAME_ENCODING (name, name); - - /* The object is put in, for example, section .text$foo. - The linker will then ultimately place them in .text - (everything from the $ on is stripped). Don't put - read-only data in .rdata section to avoid a PE linker - bug when .rdata$* grouped sections are used in code - without a .rdata section. */ - if (TREE_CODE (decl) == FUNCTION_DECL) - prefix = ".text$"; - else if (DECL_READONLY_SECTION (decl, reloc)) -#ifdef READONLY_DATA_SECTION - prefix = ".rdata$"; -#else - prefix = ".text$"; -#endif - else - prefix = ".data$"; - len = strlen (name) + strlen (prefix); - string = alloca (len + 1); - sprintf (string, "%s%s", prefix, name); - - DECL_SECTION_NAME (decl) = build_string (len, string); -} - -/* The Microsoft linker requires that every function be marked as - DT_FCN. When using gas on cygwin, we must emit appropriate .type - directives. */ - -#include "gsyms.h" - -/* Mark a function appropriately. This should only be called for - functions for which we are not emitting COFF debugging information. - FILE is the assembler output file, NAME is the name of the - function, and PUBLIC is non-zero if the function is globally - visible. */ - -void -i386_pe_declare_function_type (file, name, public) - FILE *file; - char *name; - int public; -{ - fprintf (file, "\t.def\t"); - assemble_name (file, name); - fprintf (file, ";\t.scl\t%d;\t.type\t%d;\t.endef\n", - public ? (int) C_EXT : (int) C_STAT, - (int) DT_FCN << N_BTSHFT); -} - -/* Keep a list of external functions. */ - -struct extern_list -{ - struct extern_list *next; - char *name; -}; - -static struct extern_list *extern_head; - -/* Assemble an external function reference. We need to keep a list of - these, so that we can output the function types at the end of the - assembly. We can't output the types now, because we might see a - definition of the function later on and emit debugging information - for it then. */ - -void -i386_pe_record_external_function (name) - char *name; -{ - struct extern_list *p; - - p = (struct extern_list *) permalloc (sizeof *p); - p->next = extern_head; - p->name = name; - extern_head = p; -} - -static struct extern_list *exports_head; - -/* Assemble an export symbol entry. We need to keep a list of - these, so that we can output the export list at the end of the - assembly. We used to output these export symbols in each function, - but that causes problems with GNU ld when the sections are - linkonce. */ - -void -i386_pe_record_exported_symbol (name) - char *name; -{ - struct extern_list *p; - - p = (struct extern_list *) permalloc (sizeof *p); - p->next = exports_head; - p->name = name; - exports_head = p; -} - -/* This is called at the end of assembly. For each external function - which has not been defined, we output a declaration now. We also - output the .drectve section. */ - -void -i386_pe_asm_file_end (file) - FILE *file; -{ - struct extern_list *p; - - for (p = extern_head; p != NULL; p = p->next) - { - tree decl; - - decl = get_identifier (p->name); - - /* Positively ensure only one declaration for any given symbol. */ - if (! TREE_ASM_WRITTEN (decl) && TREE_SYMBOL_REFERENCED (decl)) - { - TREE_ASM_WRITTEN (decl) = 1; - i386_pe_declare_function_type (file, p->name, TREE_PUBLIC (decl)); - } - } - - if (exports_head) - drectve_section (); - for (p = exports_head; p != NULL; p = p->next) - { - fprintf (file, "\t.ascii \" -export:%s\"\n", - I386_PE_STRIP_ENCODING (p->name)); - } -} - diff --git a/contrib/gcc/config/i386/x-aix b/contrib/gcc/config/i386/x-aix deleted file mode 100644 index b191e48fd0f0..000000000000 --- a/contrib/gcc/config/i386/x-aix +++ /dev/null @@ -1,12 +0,0 @@ -# There is an alloca in -lbsd, but it is limited to 32K -ALLOCA = alloca.o - -# If you are running out of memory while compiling gcc, with the standard -# /bin/cc uncomment MALLOCLIB line. That version of malloc is slower but -# has less overhead than the one in libc. -#MALLOCLIB = -lmalloc - -# Uncomment out the next line if you want to link with the shareable libc_s. -#CLIB_S = -lc_s - -CLIB = -lld $(MALLOCLIB) $(CLIB_S) diff --git a/contrib/gcc/config/i386/x-cygwin b/contrib/gcc/config/i386/x-cygwin deleted file mode 100644 index f251835bd332..000000000000 --- a/contrib/gcc/config/i386/x-cygwin +++ /dev/null @@ -1,4 +0,0 @@ -# Don't run fixproto -STMP_FIXPROTO = -# prefix.c wants to poke around the Registry -CLIB = -ladvapi32 diff --git a/contrib/gcc/config/i386/x-dgux b/contrib/gcc/config/i386/x-dgux deleted file mode 100644 index 322bfe3ae911..000000000000 --- a/contrib/gcc/config/i386/x-dgux +++ /dev/null @@ -1,11 +0,0 @@ -# -# host is ix86 running dgux -# -CC = /bin/gcc -X_CFLAGS = -O -mstandard -mlegend -BOOT_CFLAGS = -O2 -g -mstandard -mlegend $(CFLAGS) -CLIB = -lw32 -RANLIB = true -USER_H = $(EXTRA_HEADERS) $(LANG_EXTRA_HEADERS) -STMP_FIXPROTO = - diff --git a/contrib/gcc/config/i386/x-djgpp b/contrib/gcc/config/i386/x-djgpp deleted file mode 100644 index 89f31ff50082..000000000000 --- a/contrib/gcc/config/i386/x-djgpp +++ /dev/null @@ -1,24 +0,0 @@ -# translate the version string, so it can be used on DJGPP, where only -# one dot in filename is allowed - -# to avoid recursion when redefining $(version) -_version:=$(version) -__version=$(subst ., ,$(_version)) -version=$(word 1,$(__version))$(word 2,$(__version)).$(word 3,$(__version)) - -SYSTEM_HEADER_DIR=$(DJDIR)/include -X_CPPFLAGS=-DSTANDARD_INCLUDE_DIR=\"\$$DJDIR/include\" \ - -DSTANDARD_INCLUDE_COMPONENT=\"\" - -# when building a native compiler for DJGPP, make the target_alias -# a shorter name, since otherwise it will produce some problems, when -# using the same gcc once with long filenames and once with short (8+3) -# filenames -ifeq ($(findstring -pc-msdosdjgpp,$(target_alias)),-pc-msdosdjgpp) -target_alias=djgpp -endif - -# on DJGPP the 'ln -s' does not work correctly -LN = cp -p -LN_S = cp -p - diff --git a/contrib/gcc/config/i386/x-freebsd b/contrib/gcc/config/i386/x-freebsd deleted file mode 100644 index a9b13ba5c819..000000000000 --- a/contrib/gcc/config/i386/x-freebsd +++ /dev/null @@ -1,3 +0,0 @@ -# Don't run fixproto -STMP_FIXPROTO = -CLIB=-lgnumalloc diff --git a/contrib/gcc/config/i386/x-isc b/contrib/gcc/config/i386/x-isc deleted file mode 100644 index ea65ec888a32..000000000000 --- a/contrib/gcc/config/i386/x-isc +++ /dev/null @@ -1,3 +0,0 @@ -CLIB = -lPW -lcposix -X_CFLAGS = -D_POSIX_SOURCE -ENQUIRE_LDFLAGS = -posix $(LDFLAGS) diff --git a/contrib/gcc/config/i386/x-isc3 b/contrib/gcc/config/i386/x-isc3 deleted file mode 100644 index 527cca8132b6..000000000000 --- a/contrib/gcc/config/i386/x-isc3 +++ /dev/null @@ -1,4 +0,0 @@ -CLIB = -lPW -# One person said it needs -DPOSIX_JC, but daa@CERF.NET says no. -X_CFLAGS = -D_SYSV3 -Xp -ENQUIRE_LDFLAGS = $(LDFLAGS) diff --git a/contrib/gcc/config/i386/x-ncr3000 b/contrib/gcc/config/i386/x-ncr3000 deleted file mode 100644 index 4ae168b1fe51..000000000000 --- a/contrib/gcc/config/i386/x-ncr3000 +++ /dev/null @@ -1,34 +0,0 @@ -# Makefile additions for the NCR3000 as host system. - -# Using -O with the AT&T compiler fails, with a message about a missing -# /usr/ccs/lib/optim pass. So override the default in Makefile.in - -CCLIBFLAGS= - -## Supposedly not needed now that xm-sysv4.h includes alloc.h for Metaware. -### NCR3000 ships with a MetaWare compiler installed as CC, which chokes and -### dies all over the place on GCC source. However, the AT&T compiler, -### crusty as it is, can be used to bootstrap GCC. It can be found in -### /usr/ccs/ATT/cc. It is also used to compile the things that should -### not be compiled with GCC. -## -##CC = /usr/ccs/ATT/cc -##OLDCC = /usr/ccs/ATT/cc - -# The rest is just x-i386v4. - -# Some versions of SVR4 have an alloca in /usr/ucblib/libucb.a, and if we are -# careful to link that in after libc we can use it, but since newer versions of -# SVR4 are dropping libucb, it is better to just use the portable C version for -# bootstrapping. Do this by defining ALLOCA. - -ALLOCA = alloca.o - -# We used to build all stages *without* shared libraries because that may make -# debugging the compiler easier (until there is a GDB which supports -# both Dwarf *and* svr4 shared libraries). - -# But james@bigtex.cactus.org says that redefining GCC_CFLAGS causes trouble, -# and that it is easy enough to debug using shared libraries. -# CCLIBFLAGS=-Bstatic -dn -g -# GCC_CFLAGS=-static -g -O2 -B./ diff --git a/contrib/gcc/config/i386/x-next b/contrib/gcc/config/i386/x-next deleted file mode 100644 index a16b918e2d37..000000000000 --- a/contrib/gcc/config/i386/x-next +++ /dev/null @@ -1,3 +0,0 @@ -# Make assignments for compiling on NeXT with their compiler version. -CC=cc -traditional-cpp -OLDCC=cc -traditional-cpp diff --git a/contrib/gcc/config/i386/x-osf1elf b/contrib/gcc/config/i386/x-osf1elf deleted file mode 100644 index 146738107f6e..000000000000 --- a/contrib/gcc/config/i386/x-osf1elf +++ /dev/null @@ -1,8 +0,0 @@ -# Defaults for OSF/1 1.3+ -CC = $(OLDCC) -CLIB = -lld -INSTALL = installbsd -c -OLDCC = /usr/ccs/gcc/gcc -X_CFLAGS = -static - -# FIXPROTO_DEFINES = -D_XOPEN_SOURCE diff --git a/contrib/gcc/config/i386/x-osfrose b/contrib/gcc/config/i386/x-osfrose deleted file mode 100644 index 2c5e3ba13c76..000000000000 --- a/contrib/gcc/config/i386/x-osfrose +++ /dev/null @@ -1,27 +0,0 @@ -# Define CC and OLDCC as the same, so that the tests: -# if [ x"$(OLDCC)" = x"$(CC)" ] ... -# -# will succeed (if OLDCC != CC, it is assumed that GCC is -# being used in secondary stage builds). - -BUILD = -CC = $(OLDCC) -CLIB = -lld -X_CFLAGS = $(DEB_OPT) $(MSTATS) $(X_DEFINES) -X_CFLAGS_NODEBUG = $(NO_DEBUG) $(MSTATS) $(OPT) $(PROFILE) $(X_DEFINES) $(XCFLAGS) -XCFLAGS = $(SHLIB) -CPP_ABORT = # -Dabort=fancy_abort -CPPFLAGS = $(CPP_ABORT) $(SYSTEM_INCLUDES) -DEB_OPT = $(OPT) $(DEBUG) $(PROFILE) -DEBUG = -DEBUG_COLLECT = # -DDEBUG -CCLIBFLAGS = -O -DNO_HALF_PIC -GCC_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -B./ -DPOSIX -DNO_HALF_PIC -LDFLAGS = -MSTATS = # -mstats -OLDCC = /usr/ccs/gcc/gcc -OPT = -O -PROFILE = -SHLIB = -pic-none -SYSTEM_INCLUDES = # -I${BUILD}/usr/include -X_DEFINES = -Dvfork=fork diff --git a/contrib/gcc/config/i386/x-sco b/contrib/gcc/config/i386/x-sco deleted file mode 100644 index f7f14e9f7c09..000000000000 --- a/contrib/gcc/config/i386/x-sco +++ /dev/null @@ -1,7 +0,0 @@ -RANLIB = : -RANLIB_TEST = false -CC = rcc $(RCCFLAGS) -OLDCC = rcc $(RCCFLAGS) -RCCFLAGS = -Dunix -Di386 -DM_UNIX -DM_I386 -DNULL=0 -CCLIBFLAGS = -CLIB = -lmalloc -lPW diff --git a/contrib/gcc/config/i386/x-sco4 b/contrib/gcc/config/i386/x-sco4 deleted file mode 100644 index be6080f8893d..000000000000 --- a/contrib/gcc/config/i386/x-sco4 +++ /dev/null @@ -1,10 +0,0 @@ -RANLIB = : -RANLIB_TEST = false -CC = rcc $(RCCFLAGS) -OLDCC = rcc $(RCCFLAGS) -RCCFLAGS = -Dunix -Di386 -DM_UNIX -DM_I386 -DNULL=0 -CCLIBFLAGS = -CLIB = -lmalloc -lPW - -# See all the declarations. -FIXPROTO_DEFINES = -D_XOPEN_SOURCE diff --git a/contrib/gcc/config/i386/x-sco5 b/contrib/gcc/config/i386/x-sco5 deleted file mode 100644 index e13ed7425404..000000000000 --- a/contrib/gcc/config/i386/x-sco5 +++ /dev/null @@ -1,10 +0,0 @@ -RANLIB = : -RANLIB_TEST = false -CC = cc -OLDCC = cc -CCLIBFLAGS = -# We avoid the ALLOCA in -lPW becuase it gives us an evil index() -ALLOCA = alloca.o - -# See all the declarations. -FIXPROTO_DEFINES = -D_XOPEN_SOURCE -D_POSIX_C_SOURCE=2 diff --git a/contrib/gcc/config/i386/x-sysv3 b/contrib/gcc/config/i386/x-sysv3 deleted file mode 100644 index a1391df851c9..000000000000 --- a/contrib/gcc/config/i386/x-sysv3 +++ /dev/null @@ -1 +0,0 @@ -CLIB=-lPW diff --git a/contrib/gcc/config/i386/x-vsta b/contrib/gcc/config/i386/x-vsta deleted file mode 100644 index e2279a4b59a7..000000000000 --- a/contrib/gcc/config/i386/x-vsta +++ /dev/null @@ -1 +0,0 @@ -CLIB=-lm diff --git a/contrib/gcc/config/i386/xm-aix.h b/contrib/gcc/config/i386/xm-aix.h deleted file mode 100644 index 4cbd36ef518f..000000000000 --- a/contrib/gcc/config/i386/xm-aix.h +++ /dev/null @@ -1,2 +0,0 @@ -#undef TRUE -#undef FALSE diff --git a/contrib/gcc/config/i386/xm-bsd386.h b/contrib/gcc/config/i386/xm-bsd386.h deleted file mode 100644 index 6b8eee7db039..000000000000 --- a/contrib/gcc/config/i386/xm-bsd386.h +++ /dev/null @@ -1,3 +0,0 @@ -/* Configuration for GCC for Intel i386 running BSDI's BSD/386 as host. */ - -#include "i386/xm-i386.h" diff --git a/contrib/gcc/config/i386/xm-cygwin.h b/contrib/gcc/config/i386/xm-cygwin.h deleted file mode 100644 index ab59627fce7d..000000000000 --- a/contrib/gcc/config/i386/xm-cygwin.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Configuration for GNU C-compiler for hosting on Windows NT. - using a unix style C library. - Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define EXECUTABLE_SUFFIX ".exe" -#define NO_SYS_SIGLIST 1 - -/* We support both "/" and "\" since everybody tests both but we - default to "/". This is important because if gcc produces Win32 - paths containing backslashes, make and configure may treat the - backslashes as escape characters. Many Win32 programs use forward - slashes so using a forward slash shouldn't be problematic from the - perspective of wanting gcc to produce native Win32 paths. */ -#define DIR_SEPARATOR '/' -#define DIR_SEPARATOR_2 '\\' - -/* Convert win32 style path lists to POSIX style for consistency. */ -#undef GET_ENV_PATH_LIST -#define GET_ENV_PATH_LIST(VAR,NAME) \ -do { \ - char *_epath; \ - char *_posixepath; \ - _epath = _posixepath = getenv (NAME); \ - /* if we have a posix path list, convert to posix path list */ \ - if (_epath != NULL && *_epath != 0 \ - && ! cygwin_posix_path_list_p (_epath)) \ - { \ - char *p; \ - _posixepath = (char *) xmalloc \ - (cygwin_win32_to_posix_path_list_buf_size (_epath)); \ - cygwin_win32_to_posix_path_list (_epath, _posixepath); \ - } \ - (VAR) = _posixepath; \ -} while (0) - -#define PATH_SEPARATOR ':' - -/* This is needed so that protoize will compile. */ -#ifndef POSIX -#define POSIX -#endif diff --git a/contrib/gcc/config/i386/xm-dgux.h b/contrib/gcc/config/i386/xm-dgux.h deleted file mode 100644 index 5bdb9be0ebb4..000000000000 --- a/contrib/gcc/config/i386/xm-dgux.h +++ /dev/null @@ -1,12 +0,0 @@ - -/* Configuration for GCC for Intel i386 running DG/ux */ - -/* looks just like sysv4 for now */ - -#include "i386/xm-i386.h" -#include "xm-svr4.h" - -/* If not compiled with GNU C, use the portable alloca. */ -#ifndef __GNUC__ -#define USE_C_ALLOCA -#endif diff --git a/contrib/gcc/config/i386/xm-djgpp.h b/contrib/gcc/config/i386/xm-djgpp.h deleted file mode 100644 index ccf6e3cedf63..000000000000 --- a/contrib/gcc/config/i386/xm-djgpp.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Configuration for GNU C-compiler for Intel 80386 running DJGPP. - Copyright (C) 1988, 1996, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define __MSDOS__ 1 - -#include "i386/xm-i386.h" - -/* Use semicolons to separate elements of a path. */ -#define PATH_SEPARATOR ';' - -#define EXECUTABLE_SUFFIX ".exe" - -/* Even though we support "/", allow "\" since everybody tests both. */ -#define DIR_SEPARATOR '/' -#define DIR_SEPARATOR_2 '\\' - -/* Allow test for DOS drive names. */ -#define HAVE_DOS_BASED_FILESYSTEM - -#define LIBSTDCXX "-lstdcxx" - -/* System dependant initialization for collect2 - to tell system() to act like Unix. */ -#define COLLECT2_HOST_INITIALIZATION \ - do { __system_flags |= (__system_allow_multiple_cmds \ - | __system_emulate_chdir); } while (0) - diff --git a/contrib/gcc/config/i386/xm-dos.h b/contrib/gcc/config/i386/xm-dos.h deleted file mode 100644 index 4e1cb42c8c11..000000000000 --- a/contrib/gcc/config/i386/xm-dos.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Configuration for GNU C-compiler for Intel 80386 running DOS. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "i386/xm-i386.h" - -/* Use semicolons to separate elements of a path. */ -#define PATH_SEPARATOR ';' - -/* Use backslashs to separate levels of directory. */ -#define DIR_SEPARATOR '\\' -#define DIR_SEPARATOR_2 '/' - -/* Allow checks for drive names. */ -#define HAVE_DOS_BASED_FILE_SYSTEM - -/* Suffix for executable file names. */ -#define EXECUTABLE_SUFFIX ".exe" - -#define MKTEMP_EACH_FILE 1 - -#define NO_PRECOMPILES 1 diff --git a/contrib/gcc/config/i386/xm-freebsd.h b/contrib/gcc/config/i386/xm-freebsd.h deleted file mode 100644 index 007a609f263f..000000000000 --- a/contrib/gcc/config/i386/xm-freebsd.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Configuration for GCC for Intel i386 running FreeBSD as host. */ - -#include -#include diff --git a/contrib/gcc/config/i386/xm-gnu.h b/contrib/gcc/config/i386/xm-gnu.h deleted file mode 100644 index 0b5985f9065c..000000000000 --- a/contrib/gcc/config/i386/xm-gnu.h +++ /dev/null @@ -1,5 +0,0 @@ -/* Configuration for GCC for Intel i386 running GNU as host. */ - -#include -#include - diff --git a/contrib/gcc/config/i386/xm-i386-interix.h b/contrib/gcc/config/i386/xm-i386-interix.h deleted file mode 100644 index 8bfd5e2d915d..000000000000 --- a/contrib/gcc/config/i386/xm-i386-interix.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Configuration for GNU compiler - for an Intel i386 or later processor running Interix. - Copyright (C) 1999 Free Software Foundation, Inc. - Contributed by Donn Terry (donn@interix.com) - Derived from code by Douglas B. Rupp (drupp@cs.washington.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include - -#define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG -#ifdef __GNUC__ -# define HOST_WIDEST_INT long long -#else -# define HOST_WIDEST_INT __int64 -#endif -#define HOST_WIDEST_INT_PRINT_DEC "%lld" -#define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu" -#define HOST_WIDEST_INT_PRINT_HEX "0x%llx" diff --git a/contrib/gcc/config/i386/xm-i386.h b/contrib/gcc/config/i386/xm-i386.h deleted file mode 100644 index acc165767093..000000000000 --- a/contrib/gcc/config/i386/xm-i386.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Configuration for GNU C-compiler for Intel 80386. - Copyright (C) 1988, 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef i386 -#define i386 -#endif - -/* #defines that need visibility everywhere. */ -#define FALSE 0 -#define TRUE 1 - -/* This describes the machine the compiler is hosted on. */ -#define HOST_BITS_PER_CHAR 8 -#define HOST_BITS_PER_SHORT 16 -#define HOST_BITS_PER_INT 32 -#define HOST_BITS_PER_LONG 32 -#define HOST_BITS_PER_LONGLONG 64 - -/* Arguments to use with `exit'. */ -#define SUCCESS_EXIT_CODE 0 -#define FATAL_EXIT_CODE 33 - -/* target machine dependencies. - tm.h is a symbolic link to the actual target specific file. */ - -#include "tm.h" diff --git a/contrib/gcc/config/i386/xm-isc.h b/contrib/gcc/config/i386/xm-isc.h deleted file mode 100644 index e686c5ec9d4d..000000000000 --- a/contrib/gcc/config/i386/xm-isc.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef REAL_ARITHMETIC -#define REAL_VALUE_ATOF(x, mode) strtod ((x), (char **)0) -extern double strtod (); -#endif diff --git a/contrib/gcc/config/i386/xm-linux.h b/contrib/gcc/config/i386/xm-linux.h deleted file mode 100644 index 713bf3b2817a..000000000000 --- a/contrib/gcc/config/i386/xm-linux.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Configuration for GCC for Intel i386 running Linux-based GNU systems. - Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc. - Contributed by H.J. Lu (hjl@nynexst.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include - diff --git a/contrib/gcc/config/i386/xm-lynx.h b/contrib/gcc/config/i386/xm-lynx.h deleted file mode 100644 index 359e41bbe242..000000000000 --- a/contrib/gcc/config/i386/xm-lynx.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Configuration for GNU C-compiler for i386 platforms running LynxOS. - Copyright (C) 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include - -/* This describes the machine the compiler is hosted on. */ -#define HOST_BITS_PER_CHAR 8 -#define HOST_BITS_PER_SHORT 16 -#define HOST_BITS_PER_INT 32 -#define HOST_BITS_PER_LONG 32 -#define HOST_BITS_PER_LONGLONG 64 - -/* target machine dependencies. - tm.h is a symbolic link to the actual target specific file. */ - -#include "tm.h" diff --git a/contrib/gcc/config/i386/xm-mingw32.h b/contrib/gcc/config/i386/xm-mingw32.h deleted file mode 100644 index 6872580f33e4..000000000000 --- a/contrib/gcc/config/i386/xm-mingw32.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Configuration for GNU C-compiler for hosting on Windows32. - using GNU tools and the Windows32 API Library. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef USG -#define USG 1 -#endif - -#ifndef ONLY_INT_FIELD -#define ONLY_INT_FIELDS 1 -#endif - -#ifndef USE_PROTOTYPES -#define USE_PROTOTYPES 1 -#endif - -#define NO_SYS_SIGLIST 1 -#define environ _environ - -/* Even though we support "/", allow "\" since everybody tests both. */ -#define DIR_SEPARATOR '\\' -#define DIR_SEPARATOR_2 '/' - -/* Mingw32 does not try to hide the underlying DOS-based file system - like Cygwin does. */ -#define HAVE_DOS_BASED_FILE_SYSTEM - -#define EXECUTABLE_SUFFIX ".exe" - -#undef PATH_SEPARATOR -#define PATH_SEPARATOR ';' diff --git a/contrib/gcc/config/i386/xm-netbsd.h b/contrib/gcc/config/i386/xm-netbsd.h deleted file mode 100644 index 3a9f32419907..000000000000 --- a/contrib/gcc/config/i386/xm-netbsd.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Configuration for GCC for Intel i386 running NetBSD as host. */ - -#include -#include diff --git a/contrib/gcc/config/i386/xm-next.h b/contrib/gcc/config/i386/xm-next.h deleted file mode 100644 index bf903281a0dc..000000000000 --- a/contrib/gcc/config/i386/xm-next.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "i386/xm-i386.h" - -/* malloc does better with chunks the size of a page. */ - -#define OBSTACK_CHUNK_SIZE (getpagesize ()) diff --git a/contrib/gcc/config/i386/xm-openbsd.h b/contrib/gcc/config/i386/xm-openbsd.h deleted file mode 100644 index 1a79e83bc4a4..000000000000 --- a/contrib/gcc/config/i386/xm-openbsd.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Configuration file for i386 hosts running OpenBSD. - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include - diff --git a/contrib/gcc/config/i386/xm-os2.h b/contrib/gcc/config/i386/xm-os2.h deleted file mode 100644 index b8a5ad057a3a..000000000000 --- a/contrib/gcc/config/i386/xm-os2.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Configuration for GNU compiler - for an Intel i386 or later processor running OS/2 2.x. - Copyright (C) 1993, 1994, 1995, 1997, 1998, 1999 Free Software Foundation, Inc. - Contributed by Samuel Figueroa (figueroa@apple.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef OS2 -#define OS2 -#endif - -#ifdef __IBMC__ -#include /* this defines alloca */ -#define USG -#define ONLY_INT_FIELDS -#define USE_PROTOTYPES 1 -#define strcasecmp stricmp -#define kill(a,b) raise(b) -#define mktemp tmpnam -#else -#ifdef __EMX__ -#define EMX -#define USG -#define BSTRING -#define HAVE_PUTENV -#define HAVE_VPRINTF -#define HAVE_STRERROR -#define strcasecmp stricmp -#else -#define ____386BSD____ -int spawnv (int modeflag, char *path, char *argv[]); -int spawnvp (int modeflag, char *path, char *argv[]); -#endif /* __EMX__ */ -#endif /* __IBMC__ */ - -#ifndef PATH_SEPARATOR -#define PATH_SEPARATOR ';' -#endif -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '\\' -#endif -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '/' -#endif - -/* Allow handling of drive names. */ -#define HAVE_DOS_BASED_FILE_SYSTEM - -#define EXECUTABLE_SUFFIX ".exe" - -/* The EMX compiler uses regular .o files */ -#ifndef __EMX__ -#define OBJECT_SUFFIX ".obj" -#endif - -/* This is required to make temporary file names unique on file - systems which severely restrict the length of file names. */ -#define MKTEMP_EACH_FILE - -#include "i386/xm-i386.h" diff --git a/contrib/gcc/config/i386/xm-osf.h b/contrib/gcc/config/i386/xm-osf.h deleted file mode 100644 index 4cbd36ef518f..000000000000 --- a/contrib/gcc/config/i386/xm-osf.h +++ /dev/null @@ -1,2 +0,0 @@ -#undef TRUE -#undef FALSE diff --git a/contrib/gcc/config/i386/xm-osf1elf.h b/contrib/gcc/config/i386/xm-osf1elf.h deleted file mode 100644 index 69ca9c14c007..000000000000 --- a/contrib/gcc/config/i386/xm-osf1elf.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Configuration for GCC for Intel i386 running OSF/1 1.3. */ - -#ifndef HZ -#include -#define HZ DEFAULT_CLK_TCK -#endif diff --git a/contrib/gcc/config/i386/xm-sco.h b/contrib/gcc/config/i386/xm-sco.h deleted file mode 100644 index ad634499d30b..000000000000 --- a/contrib/gcc/config/i386/xm-sco.h +++ /dev/null @@ -1,13 +0,0 @@ -/* Configuration for GCC for Intel i386 running SCO. */ - -/* Big buffers improve performance. */ - -#define IO_BUFFER_SIZE (0x8000 - 1024) - -#ifndef __GNUC__ -/* The SCO compiler gets it wrong, and treats enumerated bitfields - as signed quantities, making it impossible to use an 8-bit enum - for compiling GNU C++. */ -#define ONLY_INT_FIELDS 1 -#define CODE_FIELD_BUG 1 -#endif diff --git a/contrib/gcc/config/i386/xm-sco5.h b/contrib/gcc/config/i386/xm-sco5.h deleted file mode 100644 index 6b22b1d549fd..000000000000 --- a/contrib/gcc/config/i386/xm-sco5.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Configuration for GCC for Intel i386 running SCO. */ - -/* Big buffers improve performance. */ - -#define IO_BUFFER_SIZE (0x8000 - 1024) - - diff --git a/contrib/gcc/config/i386/xm-sun.h b/contrib/gcc/config/i386/xm-sun.h deleted file mode 100644 index de7c2013b3ef..000000000000 --- a/contrib/gcc/config/i386/xm-sun.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Configuration for GNU C-compiler for Intel 80386 running SunOS 4.0. - Copyright (C) 1988, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define USG - -#include "i386/xm-i386.h" diff --git a/contrib/gcc/config/i386/xm-sysv3.h b/contrib/gcc/config/i386/xm-sysv3.h deleted file mode 100644 index 72078bb1febe..000000000000 --- a/contrib/gcc/config/i386/xm-sysv3.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Configuration for GCC for Intel i386 running System V Release 3. */ - -#include "i386/xm-i386.h" -#include "xm-svr3.h" diff --git a/contrib/gcc/config/i386/xm-sysv4.h b/contrib/gcc/config/i386/xm-sysv4.h deleted file mode 100644 index 1365064a5a64..000000000000 --- a/contrib/gcc/config/i386/xm-sysv4.h +++ /dev/null @@ -1,5 +0,0 @@ -/* Configuration for GCC for Intel i386 running System V Release 4. */ - -#ifdef __HIGHC__ -#include /* for MetaWare High-C on NCR System 3000 */ -#endif diff --git a/contrib/gcc/config/i386/xm-uwin.h b/contrib/gcc/config/i386/xm-uwin.h deleted file mode 100644 index 2e1ecde0fa72..000000000000 --- a/contrib/gcc/config/i386/xm-uwin.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Configuration for GNU C-compiler for hosting on Windows32. - using GNU tools and the Windows32 API Library. - Copyright (C) 1999 Free Software Foundation, Inc. - Contributed by Mumit Khan . - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef ONLY_INT_FIELD -#define ONLY_INT_FIELDS 1 -#endif - -#ifndef USE_PROTOTYPES -#define USE_PROTOTYPES 1 -#endif - -/* U/WIN system calls only support '/' */ -#undef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#undef EXECUTABLE_SUFFIX -#define EXECUTABLE_SUFFIX ".exe" - -#undef PATH_SEPARATOR -#define PATH_SEPARATOR ':' - diff --git a/contrib/gcc/config/i386/xm-vsta.h b/contrib/gcc/config/i386/xm-vsta.h deleted file mode 100644 index 735d1d51943b..000000000000 --- a/contrib/gcc/config/i386/xm-vsta.h +++ /dev/null @@ -1,2 +0,0 @@ -/* Use semicolons to separate elements of a path. */ -#define PATH_SEPARATOR ';' diff --git a/contrib/gcc/config/i386/xm-winnt.h b/contrib/gcc/config/i386/xm-winnt.h deleted file mode 100644 index d36d2cdb11ed..000000000000 --- a/contrib/gcc/config/i386/xm-winnt.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Configuration for GNU compiler - for an Intel i386 or later processor running Windows NT 3.x. - Copyright (C) 1994 Free Software Foundation, Inc. - Contributed by Douglas B. Rupp (drupp@cs.washington.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "winnt/xm-winnt.h" -#include "i386/xm-i386.h" diff --git a/contrib/gcc/config/interix.h b/contrib/gcc/config/interix.h deleted file mode 100644 index 9cef8b35bf79..000000000000 --- a/contrib/gcc/config/interix.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for - Interix - Copyright (C) 1994, 1995, 1999 Free Software Foundation, Inc. - Donn Terry, Softway Systems, Inc. (donn@softway.com) - Modified from code - Contributed by Douglas B. Rupp (drupp@cs.washington.edu). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define TARGET_MEM_FUNCTIONS - -/* POSIX/Uni-thread only for now. Look at the winnt version -for windows/multi thread */ - -/* We need multiple -lc -lcpsx because they mutually refer; - that should go away someday */ - -#undef LIB_SPEC -#define LIB_SPEC "\ - %{!shared:%{!dynamic:-lc -lcpsx -lc -lcpsx %$INTERIX_ROOT/usr/lib/psxdll.a \ - %$INTERIX_ROOT/usr/lib/psxdll2.a \ - }} \ - %{!G:%{!dynamic:-lc -lcpsx -lc -lcpsx %$INTERIX_ROOT/usr/lib/psxdll.a \ - %$INTERIX_ROOT/usr/lib/psxdll2.a \ - }} \ - %{dynamic:-lc %$INTERIX_ROOT/usr/lib/psxdll.a \ - %$INTERIX_ROOT/usr/lib/psxdll2.a \ - } \ - %{v}" - -#undef LINK_SPEC -#define LINK_SPEC "%{!shared:-stack 0x400000,0x10000} \ - -subsystem posix \ - %{g} \ - %{dynamic:-Bdynamic} \ - %{static:-Bstatic} \ - %{shared:--shared -Bdynamic} \ - %{G:--shared -Bdynamic} \ - %{symbolic:--shared -Bsymbolic -Bdynamic} \ - %{soname*:--soname %*} \ - %{rpath*:--rpath %*} \ - " - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}} %{shared:crti%O%s}" - -#undef WORD_SWITCH_TAKES_ARG -#define WORD_SWITCH_TAKES_ARG(STR) \ - ((DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - || !strcmp(STR, "rpath")) \ - && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ - && strcmp (STR, "Tbss")) - - -#if 0 -/* don't do this until we can sort out the default path issues. MK */ -#undef STANDARD_EXEC_PREFIX -#define STANDARD_EXEC_PREFIX "" - -#undef STANDARD_STARTFILE_PREFIX -#define STANDARD_STARTFILE_PREFIX "" - -#undef TOOLDIR_BASE_PREFIX -#define TOOLDIR_BASE_PREFIX "" - -#endif /* 0 */ - -#undef STDC_VALUE -#define STDC_VALUE 0 - -#define HANDLE_SYSV_PRAGMA -#undef HANDLE_PRAGMA_WEAK /* until the link format can handle it */ - -/* Names to predefine in the preprocessor for this target machine. */ - -#define DBX_DEBUGGING_INFO -#define SDB_DEBUGGING_INFO -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - - -/* TARGET_DEFAULT from configure */ - -#undef WCHAR_TYPE -#undef WCHAR_TYPE_SIZE -#define WCHAR_UNSIGNED 1 -#define WCHAR_TYPE "short unsigned int" -#define WCHAR_TYPE_SIZE 16 - -/* For the sake of libgcc2.c, indicate target supports atexit. */ -#define HAVE_ATEXIT diff --git a/contrib/gcc/config/libgloss.h b/contrib/gcc/config/libgloss.h deleted file mode 100644 index 2f2ba569f4f9..000000000000 --- a/contrib/gcc/config/libgloss.h +++ /dev/null @@ -1,35 +0,0 @@ -/* libgloss.h -- operating system specific defines to be used when - targeting GCC for Libgloss supported targets. - Copyright (C) 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* The libgloss standard for crt0.s has the name based on the command line - option. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared:%{pg:pgcrt0%O%s}%{!pg:%{p:pcrt0%O%s}%{!p:crt0%O%s}}}" - -/* This file used to force LINK_SPEC to be the null string, but that is not - correct. LINK_SPEC is used to pass machine specific arguments to the - linker and hence can not be redefined here. LINK_SPEC is never used to - specify startup files or libraries, so it should never conflict with - libgloss. */ - -/* Don't set the target flags, this is done by the linker script */ -#undef LIB_SPEC -#define LIB_SPEC "" diff --git a/contrib/gcc/config/linux-aout.h b/contrib/gcc/config/linux-aout.h deleted file mode 100644 index ca8a39d50700..000000000000 --- a/contrib/gcc/config/linux-aout.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Definitions for Linux-based GNU systems. - Copyright (C) 1995, 1997 Free Software Foundation, Inc. - Contributed by H.J. Lu (hjl@nynexst.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#undef HAVE_ATEXIT -#define HAVE_ATEXIT - -/* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is. - For now, we play safe. It may change later. */ - -#if 0 -#undef MULTIBYTE_CHARS -#define MULTIBYTE_CHARS 1 -#endif - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static}" - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -#define SET_ASM_OP ".set" - -/* We need that too. */ -#define HANDLE_SYSV_PRAGMA diff --git a/contrib/gcc/config/linux.h b/contrib/gcc/config/linux.h deleted file mode 100644 index 46ce8988223e..000000000000 --- a/contrib/gcc/config/linux.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Definitions for Linux-based GNU systems with ELF format - Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Eric Youngdale. - Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#undef HAVE_ATEXIT -#define HAVE_ATEXIT - -/* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is. - For now, we play safe. It may change later. */ - -#if 0 -#undef MULTIBYTE_CHARS -#define MULTIBYTE_CHARS 1 -#endif - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -#define SET_ASM_OP ".set" - -/* Use stabs instead of DWARF debug format. */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG -#include "svr4.h" - -#undef MD_EXEC_PREFIX -#undef MD_STARTFILE_PREFIX - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - output_file_directive (FILE, main_input_filename); \ - fprintf (FILE, "\t.version\t\"01.01\"\n"); \ - } while (0) - -/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add - the GNU/Linux magical crtbegin.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main'. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ - %{!p:%{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on - the GNU/Linux magical crtend.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main', followed by a normal - GNU/Linux "finalizer" file, `crtn.o'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" - -/* This is for -profile to use -lc_p instead of -lc. */ -#ifndef CC1_SPEC -#define CC1_SPEC "%{profile:-p}" -#endif - -#ifndef USE_GNULIBC_1 -#undef DEFAULT_VTABLE_THUNKS -#define DEFAULT_VTABLE_THUNKS 2 -#endif - -#undef LIB_SPEC -/* We no longer link with libc_p.a or libg.a by default. If you - want to profile or debug the GNU/Linux C library, please add - -profile or -ggdb to LDFLAGS at the link time, respectively. */ -#if 1 -#ifdef USE_GNULIBC_1 -#define LIB_SPEC \ - "%{!shared: %{p:-lgmon} %{pg:-lgmon} %{profile:-lgmon -lc_p} \ - %{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}" -#else -#define LIB_SPEC \ - "%{shared: -lc} \ - %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \ - %{profile:-lc_p} %{!profile: -lc}}" -#endif -#else -#define LIB_SPEC \ - "%{!shared: \ - %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \ - %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}" -#endif diff --git a/contrib/gcc/config/lynx-ng.h b/contrib/gcc/config/lynx-ng.h deleted file mode 100644 index a3a9c3799d41..000000000000 --- a/contrib/gcc/config/lynx-ng.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Target independent definitions for LynxOS, using Lynx's old as and ld. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This is for backwards compatibility with older Lynx tools, which use - a version of a.out format. */ - -#undef ASM_SPEC -#define ASM_SPEC "%{mcoff:-C}" - -#undef CPP_SPEC -#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \ - %{mposix:-D_POSIX_SOURCE} \ - %{msystem-v:-I/usr/include_v}" - -/* Provide required defaults for linker switches. */ - -#undef LINK_SPEC -#define LINK_SPEC "%{msystem-v:-V} %{mcoff:-k}" - -#undef LIB_SPEC -#define LIB_SPEC "%{mthreads:-L/lib/thread/}%{msystem-v:-lc_v}%{!msystem-v:%{mposix:-lc_p} -lc}" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{p:%{mcoff:pinit1.o%s}%{!mcoff:pinit.o%s}}%{!p:%{msystem-v:%{mcoff:vinit1.o%s}%{!mcoff:vinit.o%s}}%{!msystem-v:%{mcoff:init1.o%s}%{!mcoff:init.o%s}}}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "%{mcoff:initn.o%s} %{p:_etext.o%s}" - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "long int" - -/* We want to output DBX debugging information. */ - -#define DBX_DEBUGGING_INFO -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* We optionally want to be able to produce SDB debugging output so that - we can create debuggable SDB/coff files. This won't be needed when - stabs-in-coff works. */ - -#define SDB_DEBUGGING_INFO - -/* Generate calls to memcpy, memcmp and memset. */ - -#define TARGET_MEM_FUNCTIONS - -/* Handle #pragma pack and sometimes #pragma weak. */ - -#define HANDLE_SYSV_PRAGMA - -#define TARGET_THREADS (target_flags & MASK_THREADS) -#define MASK_THREADS 0x40000000 - -#define TARGET_POSIX (target_flags & MASK_POSIX) -#define MASK_POSIX 0x20000000 - -#define TARGET_SYSTEM_V (target_flags & MASK_SYSTEM_V) -#define MASK_SYSTEM_V 0x10000000 - -#define TARGET_COFF (target_flags & MASK_COFF) -#define MASK_COFF 0x08000000 - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - {"threads", MASK_THREADS}, \ - {"posix", MASK_POSIX}, \ - {"system-v", MASK_SYSTEM_V}, \ - {"coff", MASK_COFF}, - -#undef SUBTARGET_OVERRIDE_OPTIONS -#define SUBTARGET_OVERRIDE_OPTIONS \ -{ if (TARGET_SYSTEM_V && profile_flag) \ - warning ("-msystem-v and -p are incompatible"); \ - if (TARGET_SYSTEM_V && TARGET_THREADS) \ - warning ("-msystem-v and -mthreads are incompatible"); } - -/* Define this so that C++ destructors will use atexit. */ - -#define HAVE_ATEXIT - -/* This is defined only so that we can find the assembler. Everything else - is in /bin. */ - -#define MD_EXEC_PREFIX "/usr/local/lib/gcc-" - -/* This is needed because /bin/ld does not handle -L options correctly. */ - -#define LINK_LIBGCC_SPECIAL_1 - -/* The Lynx linker considers __main to be a possible entry point, so we - must use a different name. */ - -#define NAME__MAIN "____main" -#define SYMBOL__MAIN ____main diff --git a/contrib/gcc/config/lynx.h b/contrib/gcc/config/lynx.h deleted file mode 100644 index 62c790b6bfb5..000000000000 --- a/contrib/gcc/config/lynx.h +++ /dev/null @@ -1,179 +0,0 @@ -/* Target independent definitions for LynxOS. - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* LynxOS is a multi-platform Unix, similar to SVR3, but not identical. - We can get quite a bit from generic svr3, but have to do some overrides. */ - -#include "svr3.h" - -/* Define various macros, depending on the combination of flags. */ - -#undef CPP_SPEC -#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \ - %{mposix:-D_POSIX_SOURCE} \ - %{msystem-v:-I/usr/include_v}" - -/* No asm spec needed, since using GNU assembler always. */ - -/* No linker spec needed, since using GNU linker always. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{mthreads:-L/lib/thread/} \ - %{msystem-v:-lc_v} \ - %{!msystem-v:%{mposix:-lc_p} -lc -lm}" - -/* Set the appropriate names for the Lynx startfiles. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{p:%{mthreads:thread/pinit1.o%s}%{!mthreads:pinit1.o%s}}%{!p:%{msystem-v:vinit1.o%s -e_start}%{!msystem-v:%{mthreads:thread/init1.o%s}%{!mthreads:init1.o%s}}}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "%{p:_etext.o%s}%{!p:initn.o%s}" - -/* Override the svr3 versions. */ - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "long int" - -/* We want to output DBX (stabs) debugging information normally. */ - -#define DBX_DEBUGGING_INFO -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* It is convenient to be able to generate standard coff debugging - if requested via -gcoff. */ - -#define SDB_DEBUGGING_INFO - -/* Be function-relative for block and source line stab directives. */ - -#define DBX_BLOCKS_FUNCTION_RELATIVE 1 - -/* but, to make this work, functions must appear prior to line info */ - -#define DBX_FUNCTION_FIRST - -/* Generate a blank trailing N_SO to mark the end of the .o file, since - we can't depend upon the linker to mark .o file boundaries with - embedded stabs. */ - -#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ - fprintf (FILE, \ - "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO) - -#undef ASM_OUTPUT_SOURCE_LINE -#define ASM_OUTPUT_SOURCE_LINE(file, line) \ - { static int sym_lineno = 1; \ - fprintf (file, ".stabn 68,0,%d,.LM%d-", \ - line, sym_lineno); \ - assemble_name (file, \ - XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ - fprintf (file, "\n.LM%d:\n", sym_lineno); \ - sym_lineno += 1; } - -/* Handle #pragma pack and sometimes #pragma weak. */ - -#define HANDLE_SYSV_PRAGMA - -/* Some additional command-line options. */ - -#define TARGET_THREADS (target_flags & MASK_THREADS) -#define MASK_THREADS 0x40000000 - -#define TARGET_POSIX (target_flags & MASK_POSIX) -#define MASK_POSIX 0x20000000 - -#define TARGET_SYSTEM_V (target_flags & MASK_SYSTEM_V) -#define MASK_SYSTEM_V 0x10000000 - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - {"threads", MASK_THREADS}, \ - {"posix", MASK_POSIX}, \ - {"system-v", MASK_SYSTEM_V}, - -#undef SUBTARGET_OVERRIDE_OPTIONS -#define SUBTARGET_OVERRIDE_OPTIONS \ -do { \ - if (TARGET_SYSTEM_V && profile_flag) \ - warning ("-msystem-v and -p are incompatible"); \ - if (TARGET_SYSTEM_V && TARGET_THREADS) \ - warning ("-msystem-v and -mthreads are incompatible"); \ -} while (0) - -/* Define this so that C++ destructors will use atexit, since LynxOS - calls exit after main returns. */ - -#define HAVE_ATEXIT - -/* Since init.o et al put all sorts of stuff into the init section, - we can't use the standard init section support in crtbegin.o. */ - -#undef INIT_SECTION_ASM_OP - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_fini - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION \ - FINI_SECTION_FUNCTION - -#undef CTORS_SECTION_ASM_OP -#define CTORS_SECTION_ASM_OP ".section\t.ctors" -#undef DTORS_SECTION_ASM_OP -#define DTORS_SECTION_ASM_OP ".section\t.dtors" - -#define INT_ASM_OP ".long" - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#undef ASM_OUTPUT_CONSTRUCTOR -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#undef ASM_OUTPUT_DESTRUCTOR -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -#undef DO_GLOBAL_CTORS_BODY -#undef DO_GLOBAL_DTORS_BODY - -/* LynxOS doesn't have mcount. */ -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(file, profile_label_no) diff --git a/contrib/gcc/config/netbsd.h b/contrib/gcc/config/netbsd.h deleted file mode 100644 index 0fb4d400ee27..000000000000 --- a/contrib/gcc/config/netbsd.h +++ /dev/null @@ -1,209 +0,0 @@ -/* NETBSD_NATIVE is defined when gcc is integrated into the NetBSD - source tree so it can be configured appropriately without using - the GNU configure/build mechanism. */ - -#ifdef NETBSD_NATIVE - -/* Look for the include files in the system-defined places. */ - -#undef GPLUSPLUS_INCLUDE_DIR -#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" - -#undef GCC_INCLUDE_DIR -#define GCC_INCLUDE_DIR "/usr/include" - -#undef INCLUDE_DEFAULTS -#define INCLUDE_DEFAULTS \ - { \ - { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ - { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ - { 0, 0, 0, 0 } \ - } - -/* Under NetBSD, the normal location of the compiler back ends is the - /usr/libexec directory. */ - -#undef STANDARD_EXEC_PREFIX -#define STANDARD_EXEC_PREFIX "/usr/libexec/" - -/* Under NetBSD, the normal location of the various *crt*.o files is the - /usr/lib directory. */ - -#undef STANDARD_STARTFILE_PREFIX -#define STANDARD_STARTFILE_PREFIX "/usr/lib/" - -#endif - - -/* Provide a CPP_SPEC appropriate for NetBSD. Current we just deal with - the GCC option `-posix'. */ - -#undef CPP_SPEC -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}" - -/* Provide an ASM_SPEC appropriate for NetBSD. Currently we only deal - with the options for generating PIC code. */ - -#undef ASM_SPEC -#define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}" - -/* Provide a LIB_SPEC appropriate for NetBSD. Just select the appropriate - libc, depending on whether we're doing profiling. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" - -/* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support - for the special GCC options -static, -assert, and -nostdlib. */ - -#undef LINK_SPEC -#define LINK_SPEC \ - "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" - -/* This defines which switch letters take arguments. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'R') - -/* We have atexit(3). */ - -#define HAVE_ATEXIT - -/* Implicit library calls should use memcpy, not bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS - -/* Handle #pragma weak and #pragma pack. */ - -#define HANDLE_SYSV_PRAGMA - -/* - * Some imports from svr4.h in support of shared libraries. - * Currently, we need the DECLARE_OBJECT_SIZE stuff. - */ - -/* Define the strings used for the .type, .size, and .set directives. - These strings generally do not vary from one system running netbsd - to another, but if a given system needs to use different pseudo-op - names for these, they may be overridden in the file which includes - this one. */ - -#undef TYPE_ASM_OP -#undef SIZE_ASM_OP -#undef SET_ASM_OP -#define TYPE_ASM_OP ".type" -#define SIZE_ASM_OP ".size" -#define SET_ASM_OP ".set" - -/* This is how we tell the assembler that a symbol is weak. */ - -#undef ASM_WEAKEN_LABEL -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); \ - fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -/* The following macro defines the format used to output the second - operand of the .type assembler directive. Different svr4 assemblers - expect various different forms for this operand. The one given here - is just a default. You may need to override it in your machine- - specific tm.h file (depending upon the particulars of your assembler). */ - -#undef TYPE_OPERAND_FMT -#define TYPE_OPERAND_FMT "@%s" - -/* Write the extra assembler code needed to declare a function's result. - Most svr4 assemblers don't require any special declaration of the - result value, but there are exceptions. */ - -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -/* These macros generate the special .type and .size directives which - are used to set the corresponding fields of the linker symbol table - entries in an ELF object file under SVR4. These macros also output - the starting labels for the relevant functions/objects. */ - -/* Write the extra assembler code needed to declare a function properly. - Some svr4 assemblers need to also have something extra said about the - function's return value. We allow for that here. */ - -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', FILE); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Write the extra assembler code needed to declare an object properly. */ - -#undef ASM_DECLARE_OBJECT_NAME -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', FILE); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Output the size directive for a decl in rest_of_decl_compilation - in the case where we did not do so before the initializer. - Once we find the error_mark_node, we know that the value of - size_directive_output was set - by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ - -#undef ASM_FINISH_DECLARE_OBJECT -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - } while (0) - -/* This is how to declare the size of a function. */ - -#undef ASM_DECLARE_FUNCTION_SIZE -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - { \ - char label[256]; \ - static int labelno; \ - labelno++; \ - ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, (FNAME)); \ - fprintf (FILE, ","); \ - assemble_name (FILE, label); \ - fprintf (FILE, "-"); \ - assemble_name (FILE, (FNAME)); \ - putc ('\n', FILE); \ - } \ - } while (0) diff --git a/contrib/gcc/config/nextstep.c b/contrib/gcc/config/nextstep.c deleted file mode 100644 index 1c658fb1171e..000000000000 --- a/contrib/gcc/config/nextstep.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Functions for generic NeXT as target machine for GNU C compiler. - Copyright (C) 1989, 90-93, 96, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include -#include "flags.h" -#include "tree.h" - -/* Make everything that used to go in the text section really go there. */ - -int flag_no_mach_text_sections = 0; - -#define OPT_STRCMP(opt) (!strncmp (opt, p, sizeof (opt)-1)) - -/* 1 if handle_pragma has been called yet. */ - -static int pragma_initialized; - -/* Initial setting of `optimize'. */ - -static int initial_optimize_flag; - -extern char *get_directive_line (); - -/* Called from check_newline via the macro HANDLE_PRAGMA. - FINPUT is the source file input stream. - CH is the first character after `#pragma'. - The result is 1 if the pragma was handled. */ - -int -handle_pragma (p_getc, p_ungetc, pname) - int (* p_getc) PROTO ((void)); - void (* p_ungetc) PROTO ((int)); - char * pname; -{ - int retval = 0; - - /* Record initial setting of optimize flag, so we can restore it. */ - if (!pragma_initialized) - { - pragma_initialized = 1; - initial_optimize_flag = optimize; - } - - if (strcmp (pname, "CC_OPT_ON") == 0) - { - optimize = 1, obey_regdecls = 0; - warning ("optimization turned on"); - retval = 1; - } - else if (strcmp (pname, "CC_OPT_OFF") == 0) - { - optimize = 0, obey_regdecls = 1; - warning ("optimization turned off"); - retval = 1; - } - else if (strcmp (pname, "CC_OPT_RESTORE") == 0) - { - extern int initial_optimize_flag; - - if (optimize != initial_optimize_flag) - { - if (initial_optimize_flag) - obey_regdecls = 0; - else - obey_regdecls = 1; - optimize = initial_optimize_flag; - } - warning ("optimization level restored"); - retval = 1; - } - else if (strcmp (pname, "CC_WRITABLE_STRINGS") == 0) - flag_writable_strings = retval = 1; - else if (strcmp (pname, "CC_NON_WRITABLE_STRINGS") == 0) - flag_writable_strings = 0, retval = 1; - else if (strcmp (pname, "CC_NO_MACH_TEXT_SECTIONS") == 0) - flag_no_mach_text_sections = retval = 1; - - return retval; -} diff --git a/contrib/gcc/config/nextstep.h b/contrib/gcc/config/nextstep.h deleted file mode 100644 index 59050a18a9e2..000000000000 --- a/contrib/gcc/config/nextstep.h +++ /dev/null @@ -1,601 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC - for NeXTSTEP. - Copyright (C) 1989, 90-93, 1996, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Use new NeXT include file search path. - In a cross compiler with NeXT as target, don't expect - the host to use Next's directory scheme. */ - -#ifndef CROSS_COMPILE -#undef INCLUDE_DEFAULTS -#define INCLUDE_DEFAULTS \ - { \ - { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ - { LOCAL_INCLUDE_DIR, 0, 0, 1 }, \ - { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 }, \ - { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ - /* These are for fixincludes-fixed ansi/bsd headers \ - which wouldn't be found otherwise. \ - (The use of string catenation here is OK since \ - NeXT's native compiler is derived from GCC.) */ \ - { GCC_INCLUDE_DIR "/ansi", 0, 0, 0 }, \ - { GCC_INCLUDE_DIR "/bsd", 0, 0, 0 }, \ - { "/NextDeveloper/Headers", 0, 0, 0 }, \ - { "/NextDeveloper/Headers/ansi", 0, 0, 0 }, \ - { "/NextDeveloper/Headers/bsd", 0, 0, 0 }, \ - { "/LocalDeveloper/Headers", 0, 0, 0 }, \ - { "/LocalDeveloper/Headers/ansi", 0, 0, 0 }, \ - { "/LocalDeveloper/Headers/bsd", 0, 0, 0 }, \ - { "/NextDeveloper/2.0CompatibleHeaders", 0, 0, 0 }, \ - { STANDARD_INCLUDE_DIR, 0, 0, 0 }, \ - { "/usr/include/bsd", 0, 0, 0 }, \ - { 0, 0, 0, 0 } \ - } -#else /* CROSS_COMPILE */ -#undef INCLUDE_DEFAULTS -#define INCLUDE_DEFAULTS \ - { \ - { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ - { GPLUSPLUS_INCLUDE_DIR, 0, 1, 1 }, \ - { LOCAL_INCLUDE_DIR, 0, 0, 1 }, \ - { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ - { GCC_INCLUDE_DIR "/ansi", 0, 0, 0 }, \ - { GCC_INCLUDE_DIR "/bsd", 0, 0, 0 }, \ - { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 }, \ - { TOOL_INCLUDE_DIR "/ansi", 0, 0, 0 }, \ - { TOOL_INCLUDE_DIR "/bsd", 0, 0, 0 }, \ - { STANDARD_INCLUDE_DIR, 0, 0, 0 }, \ - { "/usr/include/bsd", 0, 0, 0 }, \ - { 0, 0, 0, 0 } \ - } -#endif /* CROSS_COMPILE */ - -#undef EXTRA_FORMAT_FUNCTIONS -#define EXTRA_FORMAT_FUNCTIONS \ - "NXPrintf", FALSE, 2, FALSE, \ - "NXScanf", TRUE, 2, FALSE, \ - "NXVPrintf", FALSE, 2, TRUE, \ - "NXVScanf", TRUE, 2, TRUE, \ - "DPSPrintf", FALSE, 2, FALSE, \ - "bsd_sprintf", FALSE, 2, FALSE, \ - "bsd_vsprintf", FALSE, 2, TRUE, - -/* Make -fnext-runtime the default. */ - -#define NEXT_OBJC_RUNTIME - -/* We have atexit. */ - -#define HAVE_ATEXIT - -/* Enable recent gcc to compile under the old gcc in Next release 1.0. */ - -#define __inline inline - -/* wchar_t is unsigned short */ - -#undef WCHAR_TYPE -#define WCHAR_TYPE "short unsigned int" -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE (BITS_PER_WORD / 2) - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ - -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* These compiler options take n arguments. */ - -#undef WORD_SWITCH_TAKES_ARG -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) ? 1 : \ - !strcmp (STR, "segalign") ? 1 : \ - !strcmp (STR, "seg1addr") ? 1 : \ - !strcmp (STR, "segaddr") ? 2 : \ - !strcmp (STR, "sectobjectsymbols") ? 2 : \ - !strcmp (STR, "segprot") ? 3 : \ - !strcmp (STR, "sectcreate") ? 3 : \ - !strcmp (STR, "sectalign") ? 3 : \ - !strcmp (STR, "segcreate") ? 3 : \ - !strcmp (STR, "sectorder") ? 3 : \ - !strcmp (STR, "siff-mask") ? 1 : \ - !strcmp (STR, "siff-filter") ? 1 : \ - !strcmp (STR, "siff-warning") ? 1 : \ - !strcmp (STR, "arch") ? 1 : \ - !strcmp (STR, "pagezero_size") ? 1 : \ - 0) - -#undef WORD_SWITCH -#define WORD_SWITCH(STR) \ - (WORD_SWITCH_TAKES_ARG (STR) \ - || !strcmp (STR, "bsd") \ - || !strcmp (STR, "object") \ - || !strcmp (STR, "ObjC") \ - || !strcmp (STR, "all_load")) - -/* Machine dependent ccp options. */ - -#undef CPP_SPEC -#define CPP_SPEC "%{!traditional: -D__STDC__} \ - %{posixstrict:-D_POSIX_SOURCE} \ - %{!posixstrict:%{bsd:-D__STRICT_BSD__} \ - %{posix:-D_POSIX_SOURCE} \ - %{!ansi:-D_NEXT_SOURCE}} \ - %{MD:-MD %M} %{MMD:-MMD %M}" - -/* Machine dependent ld options. */ - -#undef LINK_SPEC -#define LINK_SPEC "%{Z} %{M} \ -%{execute*} %{preload*} %{fvmlib*} \ -%{segalign*} %{seg1addr*} %{segaddr*} %{segprot*} \ -%{pagezero_size*} \ -%{seglinkedit*} %{noseglinkedit*} \ -%{sectcreate*} %{sectalign*} %{sectobjectsymbols}\ -%{segcreate*} %{Mach*} %{whyload} %{w} \ -%{sectorder*} %{whatsloaded} %{ObjC} %{all_load} %{object}" - -/* Machine dependent libraries. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{!posix*:-lsys_s} %{posix*:-lposix}" - -/* We specify crt0.o as -lcrt0.o so that ld will search the library path. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!posix*:%{pg:-lgcrt0.o}%{!pg: \ - %{p:%e-p profiling is no longer supported. Use -pg instead.} \ - %{!p:-lcrt0.o}}}\ - %{posix*:%{pg:-lgposixcrt0.o}%{!pg: \ - %{p:%e-p profiling is no longer supported. Use -pg instead.} \ - %{!p:-lposixcrt0.o}}} \ - -lcrtbegin.o" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "-lcrtend.o" - -/* Allow #sscs (but don't do anything). */ - -#define SCCS_DIRECTIVE - -/* We use Dbx symbol format. */ - -#undef SDB_DEBUGGING_INFO -#undef XCOFF_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO - -/* This saves a fair amount of space. */ - -#undef DBX_CONTIN_LENGTH -#define DBX_CONTIN_LENGTH 0 - -/* These screw up NeXT's gdb at the moment, so don't use them. */ - -#undef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY -#define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE, FILENAME) - -/* These come from bsd386.h, but are specific to sequent, so make sure - they don't bite us. */ - -#undef DBX_NO_XREFS -#undef DBX_CONTIN_LENGTH - -/* gdb needs a null N_SO at the end of each file for scattered loading. */ - -#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END -#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ - fprintf (FILE, \ - "\t.text\n\t.stabs \"%s\",%d,0,0,Letext\nLetext:\n", \ - "" , N_SO) - -/* Define our object format type for crtstuff.c */ -#define OBJECT_FORMAT_MACHO - -/* Don't use .gcc_compiled symbols to communicate with GDB; - They interfere with numerically sorted symbol lists. */ - -#undef ASM_IDENTIFY_GCC -#define ASM_IDENTIFY_GCC(asm_out_file) -#undef INIT_SECTION_ASM_OP -#define INIT_SECTION_ASM_OP -#undef INVOKE__main - -#undef ASM_OUTPUT_CONSTRUCTOR -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { constructor_section (); \ - ASM_OUTPUT_ALIGN (FILE, 1); \ - fprintf (FILE, "\t.long "); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - fprintf (FILE, ".reference .constructors_used\n"); \ - } while (0) - -#undef ASM_OUTPUT_DESTRUCTOR -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { destructor_section (); \ - ASM_OUTPUT_ALIGN (FILE, 1); \ - fprintf (FILE, "\t.long "); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - fprintf (FILE, ".reference .destructors_used\n"); \ - } while (0) - -#define EH_FRAME_SECTION_ASM_OP ".section __TEXT,__eh_frame,regular" - -/* Don't output a .file directive. That is only used by the assembler for - error reporting. */ -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) - -#undef ASM_FILE_END -#define ASM_FILE_END(FILE) \ - do { \ - extern char *language_string; \ - if (strcmp (language_string, "GNU C++") == 0) \ - { \ - constructor_section (); \ - destructor_section (); \ - ASM_OUTPUT_ALIGN (FILE, 1); \ - } \ - } while (0) - -/* How to parse #pragma's */ - -#undef HANDLE_PRAGMA -#define HANDLE_PRAGMA(GETC, UNGETC, NAME) handle_pragma (GETC, UNGETC, NAME) -extern int handle_pragma (); - -/* Give methods pretty symbol names on NeXT. */ - -#undef OBJC_GEN_METHOD_LABEL -#define OBJC_GEN_METHOD_LABEL(BUF,IS_INST,CLASS_NAME,CAT_NAME,SEL_NAME,NUM) \ - do { if (CAT_NAME) \ - sprintf (BUF, "%c[%s(%s) %s]", (IS_INST) ? '-' : '+', \ - (CLASS_NAME), (CAT_NAME), (SEL_NAME)); \ - else \ - sprintf (BUF, "%c[%s %s]", (IS_INST) ? '-' : '+', \ - (CLASS_NAME), (SEL_NAME)); \ - } while (0) - -/* The prefix to add to user-visible assembler symbols. */ - -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "_" - -/* Wrap new method names in quotes so the assembler doesn't gag. - Make Objective-C internal symbols local. */ - -#undef ASM_OUTPUT_LABELREF -#define ASM_OUTPUT_LABELREF(FILE,NAME) \ - do { if (NAME[0] == '+' || NAME[0] == '-') fprintf (FILE, "\"%s\"", NAME); \ - else if (!strncmp (NAME, "_OBJC_", 6)) fprintf (FILE, "L%s", NAME); \ - else if (!strncmp (NAME, ".objc_class_name_", 17)) \ - fprintf (FILE, "%s", NAME); \ - else asm_fprintf (FILE, "%U%s", NAME); } while (0) - -#undef ALIGN_ASM_OP -#define ALIGN_ASM_OP ".align" - -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG) != 0) \ - fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)) - -/* Ensure correct alignment of bss data. */ - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -( fputs (".lcomm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u,%u\n", (SIZE), floor_log2 ((ALIGN) / BITS_PER_UNIT))) - -/* Output #ident as a .ident. */ - -#undef ASM_OUTPUT_IDENT -#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME); - -/* The maximum alignment which the object file format can support. - For NeXT's Mach-O format, this is 2^15. */ - -#undef MAX_OFILE_ALIGNMENT -#define MAX_OFILE_ALIGNMENT 0x8000 - -/* Create new Mach-O sections. */ - -#undef SECTION_FUNCTION -#define SECTION_FUNCTION(FUNCTION, SECTION, DIRECTIVE, WAS_TEXT, OBJC) \ -void \ -FUNCTION () \ -{ \ - extern void text_section (); \ - extern void objc_section_init (); \ - extern int flag_no_mach_text_sections; \ - \ - if (WAS_TEXT && flag_no_mach_text_sections) \ - text_section (); \ - else if (in_section != SECTION) \ - { \ - if (OBJC) \ - objc_section_init (); \ - fprintf (asm_out_file, "%s\n", DIRECTIVE); \ - in_section = SECTION; \ - } \ -} \ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS \ - in_const, in_cstring, in_literal4, in_literal8, \ - in_constructor, in_destructor, \ - in_objc_class, in_objc_meta_class, in_objc_category, \ - in_objc_class_vars, in_objc_instance_vars, \ - in_objc_cls_meth, in_objc_inst_meth, \ - in_objc_cat_cls_meth, in_objc_cat_inst_meth, \ - in_objc_selector_refs, \ - in_objc_symbols, in_objc_module_info, \ - in_objc_protocol, in_objc_string_object, \ - in_objc_class_names, in_objc_meth_var_names, \ - in_objc_meth_var_types, in_objc_cls_refs - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ -SECTION_FUNCTION (const_section, \ - in_const, \ - ".const", 1, 0) \ -SECTION_FUNCTION (cstring_section, \ - in_cstring, \ - ".cstring", 1, 0) \ -SECTION_FUNCTION (literal4_section, \ - in_literal4, \ - ".literal4", 1, 0) \ -SECTION_FUNCTION (literal8_section, \ - in_literal8, \ - ".literal8", 1, 0) \ -SECTION_FUNCTION (constructor_section, \ - in_constructor, \ - ".constructor", 0, 0) \ -SECTION_FUNCTION (destructor_section, \ - in_destructor, \ - ".destructor", 0, 0) \ -SECTION_FUNCTION (objc_class_section, \ - in_objc_class, \ - ".objc_class", 0, 1) \ -SECTION_FUNCTION (objc_meta_class_section, \ - in_objc_meta_class, \ - ".objc_meta_class", 0, 1) \ -SECTION_FUNCTION (objc_category_section, \ - in_objc_category, \ - ".objc_category", 0, 1) \ -SECTION_FUNCTION (objc_class_vars_section, \ - in_objc_class_vars, \ - ".objc_class_vars", 0, 1) \ -SECTION_FUNCTION (objc_instance_vars_section, \ - in_objc_instance_vars, \ - ".objc_instance_vars", 0, 1) \ -SECTION_FUNCTION (objc_cls_meth_section, \ - in_objc_cls_meth, \ - ".objc_cls_meth", 0, 1) \ -SECTION_FUNCTION (objc_inst_meth_section, \ - in_objc_inst_meth, \ - ".objc_inst_meth", 0, 1) \ -SECTION_FUNCTION (objc_cat_cls_meth_section, \ - in_objc_cat_cls_meth, \ - ".objc_cat_cls_meth", 0, 1) \ -SECTION_FUNCTION (objc_cat_inst_meth_section, \ - in_objc_cat_inst_meth, \ - ".objc_cat_inst_meth", 0, 1) \ -SECTION_FUNCTION (objc_selector_refs_section, \ - in_objc_selector_refs, \ - ".objc_message_refs", 0, 1) \ -SECTION_FUNCTION (objc_symbols_section, \ - in_objc_symbols, \ - ".objc_symbols", 0, 1) \ -SECTION_FUNCTION (objc_module_info_section, \ - in_objc_module_info, \ - ".objc_module_info", 0, 1) \ -SECTION_FUNCTION (objc_protocol_section, \ - in_objc_protocol, \ - ".objc_protocol", 0, 1) \ -SECTION_FUNCTION (objc_string_object_section, \ - in_objc_string_object, \ - ".objc_string_object", 0, 1) \ -SECTION_FUNCTION (objc_class_names_section, \ - in_objc_class_names, \ - ".objc_class_names", 0, 1) \ -SECTION_FUNCTION (objc_meth_var_names_section, \ - in_objc_meth_var_names, \ - ".objc_meth_var_names", 0, 1) \ -SECTION_FUNCTION (objc_meth_var_types_section, \ - in_objc_meth_var_types, \ - ".objc_meth_var_types", 0, 1) \ -SECTION_FUNCTION (objc_cls_refs_section, \ - in_objc_cls_refs, \ - ".objc_cls_refs", 0, 1) \ - \ -void \ -objc_section_init () \ -{ \ - static int been_here = 0; \ - \ - if (been_here == 0) \ - { \ - been_here = 1; \ - objc_class_section (); \ - objc_meta_class_section (); \ - objc_cat_cls_meth_section (); \ - objc_cat_inst_meth_section (); \ - objc_cls_meth_section (); \ - objc_inst_meth_section (); \ - objc_selector_refs_section (); \ - objc_symbols_section (); \ - objc_category_section (); \ - objc_protocol_section (); \ - objc_class_vars_section (); \ - objc_instance_vars_section (); \ - objc_module_info_section (); \ - objc_string_object_section (); \ - objc_class_names_section (); \ - objc_meth_var_names_section (); \ - objc_meth_var_types_section (); \ - objc_cls_refs_section (); \ - } \ -} - -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION const_section - -#undef SELECT_SECTION -#define SELECT_SECTION(exp,reloc) \ - do \ - { \ - if (TREE_CODE (exp) == STRING_CST) \ - { \ - if (flag_writable_strings) \ - data_section (); \ - else if (TREE_STRING_LENGTH (exp) != \ - strlen (TREE_STRING_POINTER (exp)) + 1) \ - readonly_data_section (); \ - else \ - cstring_section (); \ - } \ - else if (TREE_CODE (exp) == INTEGER_CST \ - || TREE_CODE (exp) == REAL_CST) \ - { \ - tree size = TYPE_SIZE (TREE_TYPE (exp)); \ - \ - if (TREE_CODE (size) == INTEGER_CST && \ - TREE_INT_CST_LOW (size) == 4 && \ - TREE_INT_CST_HIGH (size) == 0) \ - literal4_section (); \ - else if (TREE_CODE (size) == INTEGER_CST && \ - TREE_INT_CST_LOW (size) == 8 && \ - TREE_INT_CST_HIGH (size) == 0) \ - literal8_section (); \ - else \ - readonly_data_section (); \ - } \ - else if (TREE_CODE (exp) == CONSTRUCTOR \ - && TREE_TYPE (exp) \ - && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE \ - && TYPE_NAME (TREE_TYPE (exp)) \ - && TREE_CODE (TYPE_NAME (TREE_TYPE (exp))) == IDENTIFIER_NODE \ - && IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (exp)))) \ - { \ - if (!strcmp (IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (exp))), \ - "NXConstantString")) \ - objc_string_object_section (); \ - else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp)) \ - && !TREE_SIDE_EFFECTS (exp)) \ - readonly_data_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (exp) == VAR_DECL && \ - DECL_NAME (exp) && \ - TREE_CODE (DECL_NAME (exp)) == IDENTIFIER_NODE && \ - IDENTIFIER_POINTER (DECL_NAME (exp)) && \ - !strncmp (IDENTIFIER_POINTER (DECL_NAME (exp)), "_OBJC_", 6)) \ - { \ - const char *name = IDENTIFIER_POINTER (DECL_NAME (exp)); \ - \ - if (!strncmp (name, "_OBJC_CLASS_METHODS_", 20)) \ - objc_cls_meth_section (); \ - else if (!strncmp (name, "_OBJC_INSTANCE_METHODS_", 23)) \ - objc_inst_meth_section (); \ - else if (!strncmp (name, "_OBJC_CATEGORY_CLASS_METHODS_", 20)) \ - objc_cat_cls_meth_section (); \ - else if (!strncmp (name, "_OBJC_CATEGORY_INSTANCE_METHODS_", 23)) \ - objc_cat_inst_meth_section (); \ - else if (!strncmp (name, "_OBJC_CLASS_VARIABLES_", 22)) \ - objc_class_vars_section (); \ - else if (!strncmp (name, "_OBJC_INSTANCE_VARIABLES_", 25)) \ - objc_instance_vars_section (); \ - else if (!strncmp (name, "_OBJC_CLASS_PROTOCOLS_", 22)) \ - objc_cat_cls_meth_section (); \ - else if (!strncmp (name, "_OBJC_CLASS_NAME_", 17)) \ - objc_class_names_section (); \ - else if (!strncmp (name, "_OBJC_METH_VAR_NAME_", 20)) \ - objc_meth_var_names_section (); \ - else if (!strncmp (name, "_OBJC_METH_VAR_TYPE_", 20)) \ - objc_meth_var_types_section (); \ - else if (!strncmp (name, "_OBJC_CLASS_REFERENCES", 22)) \ - objc_cls_refs_section (); \ - else if (!strncmp (name, "_OBJC_CLASS_", 12)) \ - objc_class_section (); \ - else if (!strncmp (name, "_OBJC_METACLASS_", 16)) \ - objc_meta_class_section (); \ - else if (!strncmp (name, "_OBJC_CATEGORY_", 15)) \ - objc_category_section (); \ - else if (!strncmp (name, "_OBJC_SELECTOR_REFERENCES", 25)) \ - objc_selector_refs_section (); \ - else if (!strncmp (name, "_OBJC_SYMBOLS", 13)) \ - objc_symbols_section (); \ - else if (!strncmp (name, "_OBJC_MODULES", 13)) \ - objc_module_info_section (); \ - else if (!strncmp (name, "_OBJC_PROTOCOL_INSTANCE_METHODS_", 32)) \ - objc_cat_inst_meth_section (); \ - else if (!strncmp (name, "_OBJC_PROTOCOL_CLASS_METHODS_", 29)) \ - objc_cat_cls_meth_section (); \ - else if (!strncmp (name, "_OBJC_PROTOCOL_REFS_", 20)) \ - objc_cat_cls_meth_section (); \ - else if (!strncmp (name, "_OBJC_PROTOCOL_", 15)) \ - objc_protocol_section (); \ - else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp)) \ - && !TREE_SIDE_EFFECTS (exp)) \ - readonly_data_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (exp) == VAR_DECL) \ - { \ - if ((flag_pic && reloc) \ - || !TREE_READONLY (exp) || TREE_SIDE_EFFECTS (exp) \ - || !DECL_INITIAL (exp) \ - || (DECL_INITIAL (exp) != error_mark_node \ - && !TREE_CONSTANT (DECL_INITIAL (exp)))) \ - data_section (); \ - else \ - readonly_data_section (); \ - } \ - else \ - readonly_data_section (); \ - } \ - while (0) - -#undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(mode, rtx) \ - do \ - { \ - if (GET_MODE_SIZE(mode) == 8) \ - literal8_section(); \ - else if (GET_MODE_SIZE(mode) == 4) \ - literal4_section(); \ - else \ - const_section (); \ - } \ - while (0) - -#ifdef ASM_COMMENT_START -# undef ASM_COMMENT_START -#endif - -#define ASM_COMMENT_START ";#" diff --git a/contrib/gcc/config/nextstep21.h b/contrib/gcc/config/nextstep21.h deleted file mode 100644 index 8009571672b7..000000000000 --- a/contrib/gcc/config/nextstep21.h +++ /dev/null @@ -1,65 +0,0 @@ -/* nextstep.h -- operating system specific defines to be used when - targeting GCC for NeXTSTEP. - Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* changed for NeXTStep 2.1, Ch. Kranz, 2/94, 3/94 */ -#include "nextstep.h" - -/* set flag_gnu_linker=0, use collect2 for linking */ -#undef USE_COLLECT2 -#define USE_COLLECT2 - -/* use this until a newer gdb for NeXTStep21 is available */ -#define DEFAULT_GDB_EXTENSIONS 0 - -/* we need the call to __main to start all global destructors and constructors - correctly, so undef INIT_SECTION_ASM_OP, (see libgcc2.c line 1965) - and define INVOKE_main */ -#undef INIT_SECTION_ASM_OP -#define INVOKE__main - -/* We call the global destructors, constructors from __main */ -#undef ASM_OUTPUT_CONSTRUCTOR -#undef ASM_OUTPUT_DESTRUCTOR - -#undef ASM_FILE_END -#define ASM_FILE_END(FILE) \ - do { \ - extern char *language_string; \ - if (strcmp (language_string, "GNU C++") == 0) \ - { \ - ASM_OUTPUT_ALIGN (FILE, 1); \ - } \ - } while (0) -/* deleted: destructor_section (); \ */ -/* deleted: constructor_section (); \ */ - -/* Ensure correct alignment of bss data. */ -/* ASM_OUTPUT_ALIGNED_LOCAL not needed */ -/* need ASM_OUTPUT_LOCAL instead for old NeXT-as */ -/* look in varasm.c, line 1062 and 1476 */ -#undef ASM_OUTPUT_ALIGNED_LOCAL -#undef ASM_OUTPUT_LOCAL -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ -( fputs (".lcomm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u\n", (ROUNDED))) - diff --git a/contrib/gcc/config/openbsd.h b/contrib/gcc/config/openbsd.h deleted file mode 100644 index e95fbdaea0cc..000000000000 --- a/contrib/gcc/config/openbsd.h +++ /dev/null @@ -1,311 +0,0 @@ -/* Base configuration file for all OpenBSD targets. - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Common OpenBSD configuration. - All OpenBSD architectures include this file, which is intended as - a repository for common defines. - - Some defines are common to all architectures, a few of them are - triggered by OBSD_* guards, so that we won't override architecture - defaults by mistakes. - - OBSD_HAS_CORRECT_SPECS: - another mechanism provides correct specs already. - OBSD_NO_DYNAMIC_LIBRARIES: - no implementation of dynamic libraries. - OBSD_OLD_GAS: - older flavor of gas which needs help for PIC. - OBSD_HAS_DECLARE_FUNCTION_NAME, OBSD_HAS_DECLARE_FUNCTION_SIZE, - OBSD_HAS_DECLARE_OBJECT: - PIC support, FUNCTION_NAME/FUNCTION_SIZE are independent, whereas - the corresponding logic for OBJECTS is necessarily coupled. - - There are also a few `default' defines such as ASM_WEAKEN_LABEL, - intended as common ground for arch that don't provide - anything suitable. */ - -/* OPENBSD_NATIVE is defined only when gcc is configured as part of - the OpenBSD source tree, specifically through Makefile.bsd-wrapper. - - In such a case the include path can be trimmed as there is no - distinction between system includes and gcc includes. */ - -/* This configuration method, namely Makefile.bsd-wrapper and - OPENBSD_NATIVE is NOT recommended for building cross-compilers. */ - -#ifdef OPENBSD_NATIVE - -#undef GCC_INCLUDE_DIR -#define GCC_INCLUDE_DIR "/usr/include" - -/* The compiler is configured with ONLY the gcc/g++ standard headers. */ -#undef INCLUDE_DEFAULTS -#define INCLUDE_DEFAULTS \ - { \ - { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ - { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ - { 0, 0, 0, 0 } \ - } - -/* Under OpenBSD, the normal location of the various *crt*.o files is the - /usr/lib directory. */ -#define STANDARD_STARTFILE_PREFIX "/usr/lib/" - -#endif - - -/* Controlling the compilation driver. */ - -/* CPP_SPEC appropriate for OpenBSD. We deal with -posix and -pthread. - XXX the way threads are handling currently is not very satisfying, - since all code must be compiled with -pthread to work. - This two-stage defines makes it easy to pick that for targets that - have subspecs. */ -#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" - -/* LIB_SPEC appropriate for OpenBSD. Select the appropriate libc, - depending on profiling and threads. Basically, - -lc(_r)?(_p)?, select _r for threads, and _p for p or pg. */ -#define OBSD_LIB_SPEC "-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}" - -#ifndef OBSD_HAS_CORRECT_SPECS - -#ifndef OBSD_NO_DYNAMIC_LIBRARIES -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'R') -#endif - -#undef CPP_SPEC -#define CPP_SPEC OBSD_CPP_SPEC - -#ifdef OBSD_OLD_GAS -/* ASM_SPEC appropriate for OpenBSD. For some architectures, OpenBSD - still uses a special flavor of gas that needs to be told when generating - pic code. */ -#undef ASM_SPEC -#define ASM_SPEC "%{fpic:-k} %{fPIC:-k -K} %|" -#else -/* Since we use gas, stdin -> - is a good idea, but we don't want to - override native specs just for that. */ -#ifndef ASM_SPEC -#define ASM_SPEC "%|" -#endif -#endif - -/* LINK_SPEC appropriate for OpenBSD. Support for GCC options - -static, -assert, and -nostdlib. */ -#undef LINK_SPEC -#ifdef OBSD_NO_DYNAMIC_LIBRARIES -#define LINK_SPEC \ - "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{assert*}" -#else -#define LINK_SPEC \ - "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" -#endif - -#undef LIB_SPEC -#define LIB_SPEC OBSD_LIB_SPEC -#endif - - -/* Runtime target specification. */ - -/* You must redefine CPP_PREDEFINES in any arch specific file. */ -#undef CPP_PREDEFINES - -/* Implicit calls to library routines. */ - -/* Use memcpy and memset instead of bcopy and bzero. */ -#define TARGET_MEM_FUNCTIONS - -/* Miscellaneous parameters. */ - -/* Tell libgcc2.c that OpenBSD targets support atexit. */ -#define HAVE_ATEXIT - -/* Controlling debugging info: dbx options. */ - -/* Don't use the `xsTAG;' construct in DBX output; OpenBSD systems that - use DBX don't support it. */ -#define DBX_NO_XREFS - - -/* Support of shared libraries, mostly imported from svr4.h through netbsd. */ -/* Two differences from svr4.h: - - we use . - _func instead of a local label, - - we put extra spaces in expressions such as - .type _func , @function - This is more readable for a human being and confuses c++filt less. */ - -/* Assembler format: output and generation of labels. */ - -/* Define the strings used for the .type and .size directives. - These strings generally do not vary from one system running OpenBSD - to another, but if a given system needs to use different pseudo-op - names for these, they may be overridden in the arch specific file. */ - -/* OpenBSD assembler is hacked to have .type & .size support even in a.out - format object files. Functions size are supported but not activated - yet (look for GRACE_PERIOD_EXPIRED in gas/config/obj-aout.c). - SET_ASM_OP is needed for attribute alias to work. */ - -#undef TYPE_ASM_OP -#undef SIZE_ASM_OP -#undef SET_ASM_OP - -#define TYPE_ASM_OP ".type" -#define SIZE_ASM_OP ".size" -#define SET_ASM_OP ".set" - -/* The following macro defines the format used to output the second - operand of the .type assembler directive. */ -#undef TYPE_OPERAND_FMT -#define TYPE_OPERAND_FMT "@%s" - -/* Provision if extra assembler code is needed to declare a function's result - (taken from svr4, not needed yet actually). */ -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -/* These macros generate the special .type and .size directives which - are used to set the corresponding fields of the linker symbol table - entries under OpenBSD. These macros also have to output the starting - labels for the relevant functions/objects. */ - -#ifndef OBSD_HAS_DECLARE_FUNCTION_NAME -/* Extra assembler code needed to declare a function properly. - Some assemblers may also need to also have something extra said - about the function's return value. We allow for that here. */ -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fputs (" , ", FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', FILE); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) -#endif - -#ifndef OBSD_HAS_DECLARE_FUNCTION_SIZE -/* Declare the size of a function. */ -#undef ASM_DECLARE_FUNCTION_SIZE -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - { \ - fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ - assemble_name (FILE, (FNAME)); \ - fputs (" , . - ", FILE); \ - assemble_name (FILE, (FNAME)); \ - putc ('\n', FILE); \ - } \ - } while (0) -#endif - -#ifndef OBSD_HAS_DECLARE_OBJECT -/* Extra assembler code needed to declare an object properly. */ -#undef ASM_DECLARE_OBJECT_NAME -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fputs (" , ", FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', FILE); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, " , %d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ - } \ - ASM_OUTPUT_LABEL (FILE, NAME); \ - } while (0) - -/* Output the size directive for a decl in rest_of_decl_compilation - in the case where we did not do so before the initializer. - Once we find the error_mark_node, we know that the value of - size_directive_output was set by ASM_DECLARE_OBJECT_NAME - when it was run for the same decl. */ -#undef ASM_FINISH_DECLARE_OBJECT -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - fprintf (FILE, " , %d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ - } \ - } while (0) -#endif - - -/* Those are `generic' ways to weaken/globalize a label. We shouldn't need - to override a processor specific definition. Hence, #ifndef ASM_* - In case overriding turns out to be needed, one can always #undef ASM_* - before including this file. */ - -/* Tell the assembler that a symbol is weak. */ -/* Note: netbsd arm32 assembler needs a .globl here. An override may - be needed when/if we go for arm32 support. */ -#ifndef ASM_WEAKEN_LABEL -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) -#endif - -/* Tell the assembler that a symbol is global. */ -#ifndef ASM_GLOBALIZE_LABEL -#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ - do { fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while(0) -#endif - - -/* Storage layout. */ - -/* We don't have to worry about binary compatibility with older C++ code, - but there is a big known bug with vtable thunks which has not been - fixed yet, so DON'T activate it by default. */ -/* #define DEFAULT_VTABLE_THUNKS 1 */ - - -/* Otherwise, since we support weak, gthr.h erroneously tries to use - #pragma weak. */ -#define GTHREAD_USE_WEAK 0 - -/* bug work around: we don't want to support #pragma weak, but the current - code layout needs HANDLE_PRAGMA_WEAK asserted for __attribute((weak)) to - work. On the other hand, we don't define HANDLE_PRAGMA_WEAK directly, - as this depends on a few other details as well... */ -#define HANDLE_SYSV_PRAGMA - diff --git a/contrib/gcc/config/psos.h b/contrib/gcc/config/psos.h deleted file mode 100644 index d4043002a1c1..000000000000 --- a/contrib/gcc/config/psos.h +++ /dev/null @@ -1,183 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for some - embedded system running pSOS. We assume GNU tools with ELF, but - try to maintain compatibility with the MRI tools. Based on svr4.h. - Copyright (C) 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. - - To use this file, make up a file with a name like: - - ?????-psos.h - - where ????? is replaced by the name of the basic hardware that you - are targeting for. Then, in the file ?????-psos.h, put something - like: - - #include "?????.h" - #include "psos.h" - - followed by any really system-specific defines (or overrides of - defines) which you find that you need. -*/ - - -/* Define a symbol indicating that we are using psos.h. */ - -#define USING_PSOS_H - - -/* All pSOS targets currently use the ELF object file format. */ - -#define OBJECT_FORMAT_ELF - - -/* Provide a NULL STARTFILE_SPEC. The startfile cannot be specified - here because it depends on the architecture (e.g. 68K), the - board-support package (e.g. M162) and the run-time configuration - (e.g. application vs. ram-image vs. rom-image). Specify the - startfile in a linker-script created from the generic - architecture-specific linker-scripts. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - - -/* Predefined macros (independent of processor type). */ - -#define CPP_PREDEFINES "-Dpsos" - - -/* Implicit library calls should use ANSI memcpy rather than BSD - bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS - - -/* When using stabs, gcc2_compiled must be a stabs entry, not an - ordinary symbol, or gdb won't see it. The stabs entry must be - before the N_SO in order for gdb to find it. */ - -#define ASM_IDENTIFY_GCC(FILE) \ -do \ - { \ - fputs (".stabs \"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \ - } \ -while (0) - -/* This is how we tell the assembler that a symbol is weak. */ - -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -/* Switch into a generic section. */ - -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ - fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \ - (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \ - (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw") - - -/* Define the pseudo-ops used to switch to the .ctors and .dtors - sections. */ - -#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\"" -#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\"" - -/* A default list of other sections which we might be "in" at any given - time. For targets that use additional sections (e.g. .tdesc) you - should override this definition in the target-specific file which - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_ctors, in_dtors - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION - -extern void text_section (); - -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ - -#ifndef INT_ASM_OP -#define INT_ASM_OP ".long" -#endif -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ - -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - - -/* Use DBX debugging info by default. */ - -#ifndef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG -#endif - -/* For pSOS we use DBX debugging info. */ - -#define DBX_DEBUGGING_INFO - - -/* Prevent generation of an exit function. */ - -#define HAVE_ATEXIT - diff --git a/contrib/gcc/config/ptx4.h b/contrib/gcc/config/ptx4.h deleted file mode 100644 index b1eaabeb4ccb..000000000000 --- a/contrib/gcc/config/ptx4.h +++ /dev/null @@ -1,860 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for some - generic System V Release 4 system. - Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - Contributed by Ron Guilmette (rfg@monkeys.com). - Renamed and changed to suit Dynix/ptx v4 and later. - Modified by Tim Wright (timw@sequent.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. - -*/ - -/* Define a symbol indicating that we are using svr4.h. */ -#define USING_SVR4_H - -/* For the sake of libgcc2.c, indicate target supports atexit. */ -#define HAVE_ATEXIT - -/* Cpp, assembler, linker, library, and startfile spec's. */ - -/* This defines which switch letters take arguments. On svr4, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker). Note however that there is no such - thing as a -T option for svr4. */ - -#define SWITCH_TAKES_ARG(CHAR) \ - ( (CHAR) == 'D' \ - || (CHAR) == 'U' \ - || (CHAR) == 'o' \ - || (CHAR) == 'e' \ - || (CHAR) == 'u' \ - || (CHAR) == 'I' \ - || (CHAR) == 'm' \ - || (CHAR) == 'L' \ - || (CHAR) == 'A' \ - || (CHAR) == 'h' \ - || (CHAR) == 'z') - -/* This defines which multi-letter switches take arguments. On svr4, - there are no such switches except those implemented by GCC itself. */ - -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ - && strcmp (STR, "Tbss")) - -/* You should redefine CPP_PREDEFINES in any file which includes this one. - The definition should be appropriate for the type of target system - involved, and it should include any -A (assertion) options which are - appropriate for the given target system. */ -#undef CPP_PREDEFINES - -/* Provide an ASM_SPEC appropriate for svr4. Here we try to support as - many of the specialized svr4 assembler options as seems reasonable, - given that there are certain options which we can't (or shouldn't) - support directly due to the fact that they conflict with other options - for other svr4 tools (e.g. ld) or with other options for GCC itself. - For example, we don't support the -o (output file) or -R (remove - input file) options because GCC already handles these things. We - also don't support the -m (run m4) option for the assembler because - that conflicts with the -m (produce load map) option of the svr4 - linker. We do however allow passing arbitrary options to the svr4 - assembler via the -Wa, option. - - Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,* - option. -*/ - -#undef ASM_SPEC -#define ASM_SPEC \ - "-no_0f_fix %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}" - -/* svr4 assemblers need the `-' (indicating input from stdin) to come after - the -o option (and its argument) for some reason. If we try to put it - before the -o option, the assembler will try to read the file named as - the output file in the -o option as an input file (after it has already - written some stuff to it) and the binary stuff contained therein will - cause totally confuse the assembler, resulting in many spurious error - messages. */ - -#undef ASM_FINAL_SPEC -#define ASM_FINAL_SPEC "%{pipe:-}" - -/* Provide a LIB_SPEC appropriate for svr4. Here we tack on the default - standard C library (unless we are building a shared library). */ - -#undef LIB_SPEC -#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}" - -/* Provide a LIBGCC_SPEC appropriate for svr4. We also want to exclude - libgcc when -symbolic. */ - -#undef LIBGCC_SPEC -#define LIBGCC_SPEC "%{!shared:%{!symbolic:-lgcc}}" - -/* Provide an ENDFILE_SPEC appropriate for svr4. Here we tack on our own - magical crtend.o file (see crtstuff.c) which provides part of the - support for getting C++ file-scope static object constructed before - entering `main', followed by the normal svr3/svr4 "finalizer" file, - which is either `gcrtn.o' or `crtn.o'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o}%{!pg:crtn.o%s}" - -/* Provide a LINK_SPEC appropriate for svr4. Here we provide support - for the special GCC options -static, -shared, and -symbolic which - allow us to link things in one of these three modes by applying the - appropriate combinations of options at link-time. We also provide - support here for as many of the other svr4 linker options as seems - reasonable, given that some of them conflict with options for other - svr4 tools (e.g. the assembler). In particular, we do support the - -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*, - -l*, -o*, -r, -s, -u*, and -L* options are directly supported - by gcc.c itself. We don't directly support the -m (generate load - map) option because that conflicts with the -m (run m4) option of - the svr4 assembler. We also don't directly support the svr4 linker's - -I* or -M* options because these conflict with existing GCC options. - We do however allow passing arbitrary options to the svr4 linker - via the -Wl, option. We don't support the svr4 linker's -a option - at all because it is totally useless and because it conflicts with - GCC's own -a option. - - Note that gcc doesn't allow a space to follow -Y in a -YP,* option. - - When the -G link option is used (-shared and -symbolic) a final link is - not being done. */ - -#undef LINK_SPEC -#define LINK_SPEC "%{h*} %{v:-V} \ - %{b} %{Wl,*:%*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy -z text} \ - %{symbolic:-Bsymbolic -G -dy -z text} \ - %{G:-G} \ - %{YP,*} \ - %{!YP,*:%{p:-Y P,/lib/libp:/usr/lib/libp:/lib:/usr/lib} \ - %{!p:-Y P,/lib:/usr/lib}} \ - %{Qy:} %{!Qn:-Qy}" - -/* Gcc automatically adds in one of the files /lib/values-Xc.o, - /lib/values-Xa.o, or /lib/values-Xt.o for each final link - step (depending upon the other gcc options selected, such as - -traditional and -ansi). These files each contain one (initialized) - copy of a special variable called `_lib_version'. Each one of these - files has `_lib_version' initialized to a different (enum) value. - The SVR4 library routines query the value of `_lib_version' at run - to decide how they should behave. Specifically, they decide (based - upon the value of `_lib_version') if they will act in a strictly ANSI - conforming manner or not. -*/ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared: \ - %{!symbolic: \ - %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\ - %{pg:gcrti.o%s}%{!pg:crti.o%s} \ - %{ansi:values-Xc.o%s} \ - %{!ansi: \ - %{traditional:values-Xt.o%s} \ - %{!traditional:values-Xa.o%s}} \ - crtbegin.o%s" - -/* Attach a special .ident directive to the end of the file to identify - the version of GCC which compiled this code. The format of the - .ident string is patterned after the ones produced by native svr4 - C compilers. */ - -#define IDENT_ASM_OP ".ident" - -#define ASM_FILE_END(FILE) \ -do { \ - if (!flag_no_ident) \ - fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \ - IDENT_ASM_OP, version_string); \ - } while (0) - -/* Allow #sccs in preprocessor. */ - -#define SCCS_DIRECTIVE - -/* Output #ident as a .ident. */ - -#define ASM_OUTPUT_IDENT(FILE, NAME) \ - fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); - -/* Use periods rather than dollar signs in special g++ assembler names. */ - -#define NO_DOLLAR_IN_LABEL - -/* Writing `int' for a bitfield forces int alignment for the structure. */ - -#define PCC_BITFIELD_TYPE_MATTERS 1 - -/* Implicit library calls should use memcpy, not bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS - -/* Handle #pragma weak and #pragma pack. */ - -#define HANDLE_SYSV_PRAGMA - -/* System V Release 4 uses DWARF debugging info. */ - -#define DWARF_DEBUGGING_INFO - -/* The numbers used to denote specific machine registers in the System V - Release 4 DWARF debugging information are quite likely to be totally - different from the numbers used in BSD stabs debugging information - for the same kind of target machine. Thus, we undefine the macro - DBX_REGISTER_NUMBER here as an extra inducement to get people to - provide proper machine-specific definitions of DBX_REGISTER_NUMBER - (which is also used to provide DWARF registers numbers in dwarfout.c) - in their tm.h files which include this file. */ - -#undef DBX_REGISTER_NUMBER - -/* gas on SVR4 supports the use of .stabs. Permit -gstabs to be used - in general, although it will only work when using gas. */ - -#define DBX_DEBUGGING_INFO - -/* Use DWARF debugging info by default. */ - -#ifndef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG -#endif - -/* Make LBRAC and RBRAC addresses relative to the start of the - function. The native Solaris stabs debugging format works this - way, gdb expects it, and it reduces the number of relocation - entries. */ - -#define DBX_BLOCKS_FUNCTION_RELATIVE 1 - -/* When using stabs, gcc2_compiled must be a stabs entry, not an - ordinary symbol, or gdb won't see it. The stabs entry must be - before the N_SO in order for gdb to find it. */ - -#define ASM_IDENTIFY_GCC(FILE) \ -do \ - { \ - if (write_symbols != DBX_DEBUG) \ - fputs ("gcc2_compiled.:\n", FILE); \ - else \ - fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \ - } \ -while (0) - -/* Like block addresses, stabs line numbers are relative to the - current function. */ - -#define ASM_OUTPUT_SOURCE_LINE(file, line) \ -do \ - { \ - static int sym_lineno = 1; \ - fprintf (file, ".stabn 68,0,%d,.LM%d-", \ - line, sym_lineno); \ - assemble_name (file, \ - XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\ - fprintf (file, "\n.LM%d:\n", sym_lineno); \ - sym_lineno += 1; \ - } \ -while (0) - -/* In order for relative line numbers to work, we must output the - stabs entry for the function name first. */ - -#define DBX_FUNCTION_FIRST - -/* Generate a blank trailing N_SO to mark the end of the .o file, since - we can't depend upon the linker to mark .o file boundaries with - embedded stabs. */ - -#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ - fprintf (FILE, \ - "\t.text\n\t.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO) - -/* Define the actual types of some ANSI-mandated types. (These - definitions should work for most SVR4 systems). */ - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -/* This causes trouble, because it requires the host machine - to support ANSI C. */ -/* #define MULTIBYTE_CHARS */ - -#undef ASM_BYTE_OP -#define ASM_BYTE_OP ".byte" - -#undef SET_ASM_OP -#define SET_ASM_OP ".set" - -/* This is how to begin an assembly language file. Most svr4 assemblers want - at least a .file directive to come first, and some want to see a .version - directive come right after that. Here we just establish a default - which generates only the .file directive. If you need a .version - directive for any specific target, you should override this definition - in the target-specific file which includes this one. */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - output_file_directive ((FILE), main_input_filename) - -/* This is how to allocate empty space in some section. The .zero - pseudo-op is used for this on most svr4 assemblers. */ - -#define SKIP_ASM_OP ".zero" - -#undef ASM_OUTPUT_SKIP -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE)) - -/* The prefix to add to user-visible assembler symbols. - - For System V Release 4 the convention is *not* to prepend a leading - underscore onto user-level symbol names. */ - -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "" - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - - For most svr4 systems, the convention is that any symbol which begins - with a period is not put into the linker symbol table by the assembler. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \ -do { \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \ -} while (0) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. - - For most svr4 systems, the convention is that any symbol which begins - with a period is not put into the linker symbol table by the assembler. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ -do { \ - sprintf (LABEL, "*.%s%d", PREFIX, NUM); \ -} while (0) - -/* Output the label which precedes a jumptable. Note that for all svr4 - systems where we actually generate jumptables (which is to say every - svr4 target except i386, where we use casesi instead) we put the jump- - tables into the .rodata section and since other stuff could have been - put into the .rodata section prior to any given jumptable, we have to - make sure that the location counter for the .rodata section gets pro- - perly re-aligned prior to the actual beginning of the jump table. */ - -#define ALIGN_ASM_OP ".align" - -#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL -#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ - ASM_OUTPUT_ALIGN ((FILE), 2); -#endif - -#undef ASM_OUTPUT_CASE_LABEL -#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ - do { \ - ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \ - } while (0) - -/* The standard SVR4 assembler seems to require that certain builtin - library routines (e.g. .udiv) be explicitly declared as .globl - in each assembly file where they are referenced. */ - -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ - ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) - -/* This says how to output assembler code to declare an - uninitialized external linkage data object. Under SVR4, - the linker seems to want the alignment of data objects - to depend on their types. We do exactly that here. */ - -#define COMMON_ASM_OP ".comm" - -#undef ASM_OUTPUT_ALIGNED_COMMON -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ -} while (0) - -/* This says how to output assembler code to declare an - uninitialized internal linkage data object. Under SVR4, - the linker seems to want the alignment of data objects - to depend on their types. We do exactly that here. */ - -#define LOCAL_ASM_OP ".local" - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), "\n"); \ - ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ -} while (0) - -/* This is the pseudo-op used to generate a 32-bit word of data with a - specific value in some section. This is the same for all known svr4 - assemblers. */ - -#define INT_ASM_OP ".long" - -/* This is the pseudo-op used to generate a contiguous sequence of byte - values from a double-quoted string WITHOUT HAVING A TERMINATING NUL - AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ - -#undef ASCII_DATA_ASM_OP -#define ASCII_DATA_ASM_OP ".ascii" - -/* Support const sections and the ctors and dtors sections for g++. - Note that there appears to be two different ways to support const - sections at the moment. You can either #define the symbol - READONLY_DATA_SECTION (giving it some code which switches to the - readonly data section) or else you can #define the symbols - EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and - SELECT_RTX_SECTION. We do both here just to be on the safe side. */ - -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP ".section\t.rodata" - -/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. - - Note that we want to give these sections the SHF_WRITE attribute - because these sections will actually contain data (i.e. tables of - addresses of functions in the current root executable or shared library - file) and, in the case of a shared library, the relocatable addresses - will have to be properly resolved/relocated (and then written into) by - the dynamic linker when it actually attaches the given shared library - to the executing process. (Note that on SVR4, you may wish to use the - `-z text' option to the ELF linker, when building a shared library, as - an additional check that you are doing everything right. But if you do - use the `-z text' option when building a shared library, you will get - errors unless the .ctors and .dtors sections are marked as writable - via the SHF_WRITE attribute.) */ - -#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\"" -#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\"" - -/* On svr4, we *do* have support for the .init and .fini sections, and we - can put stuff in there to be executed before and after `main'. We let - crtstuff.c and other files know this by defining the following symbols. - The definitions say how to change sections to the .init and .fini - sections. This is the same for all known svr4 assemblers. */ - -#define INIT_SECTION_ASM_OP ".section\t.init" -#define FINI_SECTION_ASM_OP ".section\t.fini" - -/* A default list of other sections which we might be "in" at any given - time. For targets that use additional sections (e.g. .tdesc) you - should override this definition in the target-specific file which - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_ctors, in_dtors - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION - -#define READONLY_DATA_SECTION() const_section () - -extern void text_section (); - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -/* Switch into a generic section. - This is currently only used to support section attributes. - - We make the section read-only and executable for a function decl, - read-only for a const data decl, and writable for a non-const data decl. */ -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ - fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \ - (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \ - (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw") - - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement or statements to switch to the appropriate - section for output of DECL. DECL is either a `VAR_DECL' node - or a constant of some sort. RELOC indicates whether forming - the initial value of DECL requires link-time relocations. */ - -#define SELECT_SECTION(DECL,RELOC) \ -{ \ - if (TREE_CODE (DECL) == STRING_CST) \ - { \ - if (! flag_writable_strings) \ - const_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (DECL) == VAR_DECL) \ - { \ - if ((flag_pic && RELOC) \ - || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ - || !DECL_INITIAL (DECL) \ - || (DECL_INITIAL (DECL) != error_mark_node \ - && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ - data_section (); \ - else \ - const_section (); \ - } \ - else \ - const_section (); \ -} - -/* A C statement or statements to switch to the appropriate - section for output of RTX in mode MODE. RTX is some kind - of constant in RTL. The argument MODE is redundant except - in the case of a `const_int' rtx. Currently, these always - go into the const section. */ - -#undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX) const_section() - -/* Define the strings used for the special svr4 .type and .size directives. - These strings generally do not vary from one system running svr4 to - another, but if a given system (e.g. m88k running svr) needs to use - different pseudo-op names for these, they may be overridden in the - file which includes this one. */ - -#define TYPE_ASM_OP ".type" -#define SIZE_ASM_OP ".size" - -/* This is how we tell the assembler that a symbol is weak. */ - -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -/* The following macro defines the format used to output the second - operand of the .type assembler directive. Different svr4 assemblers - expect various different forms for this operand. The one given here - is just a default. You may need to override it in your machine- - specific tm.h file (depending upon the particulars of your assembler). */ - -#define TYPE_OPERAND_FMT "@%s" - -/* Write the extra assembler code needed to declare a function's result. - Most svr4 assemblers don't require any special declaration of the - result value, but there are exceptions. */ - -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -/* These macros generate the special .type and .size directives which - are used to set the corresponding fields of the linker symbol table - entries in an ELF object file under SVR4. These macros also output - the starting labels for the relevant functions/objects. */ - -/* Write the extra assembler code needed to declare a function properly. - Some svr4 assemblers need to also have something extra said about the - function's return value. We allow for that here. */ - -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', FILE); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Write the extra assembler code needed to declare an object properly. */ - -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', FILE); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Output the size directive for a decl in rest_of_decl_compilation - in the case where we did not do so before the initializer. - Once we find the error_mark_node, we know that the value of - size_directive_output was set - by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ - -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - } while (0) - -/* This is how to declare the size of a function. */ - -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - { \ - char label[256]; \ - static int labelno; \ - labelno++; \ - ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, (FNAME)); \ - fprintf (FILE, ","); \ - assemble_name (FILE, label); \ - fprintf (FILE, "-"); \ - assemble_name (FILE, (FNAME)); \ - putc ('\n', FILE); \ - } \ - } while (0) - -/* A table of bytes codes used by the ASM_OUTPUT_ASCII and - ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table - corresponds to a particular byte value [0..255]. For any - given byte value, if the value in the corresponding table - position is zero, the given character can be output directly. - If the table value is 1, the byte must be output as a \ooo - octal escape. If the tables value is anything else, then the - byte value should be output as a \ followed by the value - in the table. Note that we can use standard UN*X escape - sequences for many control characters, but we don't use - \a to represent BEL because some svr4 assemblers (e.g. on - the i386) don't know about that. Also, we don't use \v - since some versions of gas, such as 2.2 did not accept it. */ - -#define ESCAPES \ -"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" - -/* Some svr4 assemblers have a limit on the number of characters which - can appear in the operand of a .string directive. If your assembler - has such a limitation, you should define STRING_LIMIT to reflect that - limit. Note that at least some svr4 assemblers have a limit on the - actual number of bytes in the double-quoted string, and that they - count each character in an escape sequence as one byte. Thus, an - escape sequence like \377 would count as four bytes. - - If your target assembler doesn't support the .string directive, you - should define this to zero. -*/ - -#define STRING_LIMIT ((unsigned) 256) - -#define STRING_ASM_OP ".string" - -/* The routine used to output NUL terminated strings. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable, especially for targets like the i386 - (where the only alternative is to output character sequences as - comma separated lists of numbers). */ - -#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ - do \ - { \ - register unsigned char *_limited_str = (unsigned char *) (STR); \ - register unsigned ch; \ - fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ - for (; ch = *_limited_str; _limited_str++) \ - { \ - register int escape; \ - switch (escape = ESCAPES[ch]) \ - { \ - case 0: \ - putc (ch, (FILE)); \ - break; \ - case 1: \ - fprintf ((FILE), "\\%03o", ch); \ - break; \ - default: \ - putc ('\\', (FILE)); \ - putc (escape, (FILE)); \ - break; \ - } \ - } \ - fprintf ((FILE), "\"\n"); \ - } \ - while (0) - -/* The routine used to output sequences of byte values. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable. Note that if we find subparts of the - character sequence which end with NUL (and which are shorter than - STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ - -#undef ASM_OUTPUT_ASCII -#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ - do \ - { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ - register unsigned bytes_in_chunk = 0; \ - for (; _ascii_bytes < limit; _ascii_bytes++) \ - { \ - register unsigned char *p; \ - if (bytes_in_chunk >= 60) \ - { \ - fprintf ((FILE), "\"\n"); \ - bytes_in_chunk = 0; \ - } \ - for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ - continue; \ - if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ - { \ - if (bytes_in_chunk > 0) \ - { \ - fprintf ((FILE), "\"\n"); \ - bytes_in_chunk = 0; \ - } \ - ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ - _ascii_bytes = p; \ - } \ - else \ - { \ - register int escape; \ - register unsigned ch; \ - if (bytes_in_chunk == 0) \ - fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP); \ - switch (escape = ESCAPES[ch = *_ascii_bytes]) \ - { \ - case 0: \ - putc (ch, (FILE)); \ - bytes_in_chunk++; \ - break; \ - case 1: \ - fprintf ((FILE), "\\%03o", ch); \ - bytes_in_chunk += 4; \ - break; \ - default: \ - putc ('\\', (FILE)); \ - putc (escape, (FILE)); \ - bytes_in_chunk += 2; \ - break; \ - } \ - } \ - } \ - if (bytes_in_chunk > 0) \ - fprintf ((FILE), "\"\n"); \ - } \ - while (0) - -/* All SVR4 targets use the ELF object file format. */ -#define OBJECT_FORMAT_ELF diff --git a/contrib/gcc/config/sparc/aout.h b/contrib/gcc/config/sparc/aout.h deleted file mode 100644 index 478d710f82fd..000000000000 --- a/contrib/gcc/config/sparc/aout.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARC using a.out. - Copyright (C) 1994, 1996 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sparc/sparc.h" /* SPARC definitions */ -#include "aoutos.h" /* A.out definitions */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -Acpu(sparc) -Amachine(sparc)" diff --git a/contrib/gcc/config/sparc/bsd.h b/contrib/gcc/config/sparc/bsd.h deleted file mode 100644 index 761abe2671b8..000000000000 --- a/contrib/gcc/config/sparc/bsd.h +++ /dev/null @@ -1,7 +0,0 @@ -#include "sparc/sparc.h" - -#undef LIB_SPEC -#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:gcrt0.o%s}%{!p:crt0.o%s}}" diff --git a/contrib/gcc/config/sparc/elf.h b/contrib/gcc/config/sparc/elf.h deleted file mode 100644 index 635238f5b1f2..000000000000 --- a/contrib/gcc/config/sparc/elf.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Definitions of target machine for GNU compiler, - for SPARC running in an embedded environment using the ELF file format. - Copyright (C) 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sol2.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -D__elf__ -Acpu(sparc) -Amachine(sparc)" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s crtn.o%s" - -/* Use the default. */ -#undef LINK_SPEC - -/* Don't set the target flags, this is done by the linker script */ -#undef LIB_SPEC -#define LIB_SPEC "" - -/* FIXME: until fixed */ -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 64 - -/* This solaris2 define does not apply. */ -#undef STDC_0_IN_SYSTEM_HEADERS - -/* We don't want to use the Solaris2 specific long long int conversion - routines. */ -#undef INIT_SUBTARGET_OPTABS -#define INIT_SUBTARGET_OPTABS - -/* ??? We haven't added Solaris2 equivalent 64 bit library routines to - lb1sp*.asm, so we need to avoid using them. */ -#undef MULDI3_LIBCALL -#undef DIVDI3_LIBCALL -#undef UDIVDI3_LIBCALL -#undef MODDI3_LIBCALL -#undef UMODDI3_LIBCALL diff --git a/contrib/gcc/config/sparc/gmon-sol2.c b/contrib/gcc/config/sparc/gmon-sol2.c deleted file mode 100644 index a6abcabcc51f..000000000000 --- a/contrib/gcc/config/sparc/gmon-sol2.c +++ /dev/null @@ -1,425 +0,0 @@ -/*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* Mangled into a form that works on Sparc Solaris 2 by Mark Eichin - * for Cygnus Support, July 1992. - */ - -#include "config.h" -#include "system.h" - -#if 0 -#include "sparc/gmon.h" -#else -struct phdr { - char *lpc; - char *hpc; - int ncnt; -}; -#define HISTFRACTION 2 -#define HISTCOUNTER unsigned short -#define HASHFRACTION 1 -#define ARCDENSITY 2 -#define MINARCS 50 -struct tostruct { - char *selfpc; - long count; - unsigned short link; -}; -struct rawarc { - unsigned long raw_frompc; - unsigned long raw_selfpc; - long raw_count; -}; -#define ROUNDDOWN(x,y) (((x)/(y))*(y)) -#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) - -#endif - -/* extern mcount() asm ("mcount"); */ -/*extern*/ char *minbrk /* asm ("minbrk") */; - - /* - * froms is actually a bunch of unsigned shorts indexing tos - */ -static int profiling = 3; -static unsigned short *froms; -static struct tostruct *tos = 0; -static long tolimit = 0; -static char *s_lowpc = 0; -static char *s_highpc = 0; -static unsigned long s_textsize = 0; - -static int ssiz; -static char *sbuf; -static int s_scale; - /* see profil(2) where this is describe (incorrectly) */ -#define SCALE_1_TO_1 0x10000L - -#define MSG "No space for profiling buffer(s)\n" - -static void moncontrol PROTO ((int)); -extern void monstartup PROTO ((char *, char *)); -extern void _mcleanup PROTO ((void)); - -void monstartup(lowpc, highpc) - char *lowpc; - char *highpc; -{ - int monsize; - char *buffer; - register int o; - - /* - * round lowpc and highpc to multiples of the density we're using - * so the rest of the scaling (here and in gprof) stays in ints. - */ - lowpc = (char *) - ROUNDDOWN((unsigned)lowpc, HISTFRACTION*sizeof(HISTCOUNTER)); - s_lowpc = lowpc; - highpc = (char *) - ROUNDUP((unsigned)highpc, HISTFRACTION*sizeof(HISTCOUNTER)); - s_highpc = highpc; - s_textsize = highpc - lowpc; - monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr); - buffer = sbrk( monsize ); - if ( buffer == (char *) -1 ) { - write( 2 , MSG , sizeof(MSG) ); - return; - } - froms = (unsigned short *) sbrk( s_textsize / HASHFRACTION ); - if ( froms == (unsigned short *) -1 ) { - write( 2 , MSG , sizeof(MSG) ); - froms = 0; - return; - } - tolimit = s_textsize * ARCDENSITY / 100; - if ( tolimit < MINARCS ) { - tolimit = MINARCS; - } else if ( tolimit > 65534 ) { - tolimit = 65534; - } - tos = (struct tostruct *) sbrk( tolimit * sizeof( struct tostruct ) ); - if ( tos == (struct tostruct *) -1 ) { - write( 2 , MSG , sizeof(MSG) ); - froms = 0; - tos = 0; - return; - } - minbrk = sbrk(0); - tos[0].link = 0; - sbuf = buffer; - ssiz = monsize; - ( (struct phdr *) buffer ) -> lpc = lowpc; - ( (struct phdr *) buffer ) -> hpc = highpc; - ( (struct phdr *) buffer ) -> ncnt = ssiz; - monsize -= sizeof(struct phdr); - if ( monsize <= 0 ) - return; - o = highpc - lowpc; - if( monsize < o ) -#ifndef hp300 - s_scale = ( (float) monsize / o ) * SCALE_1_TO_1; -#else /* avoid floating point */ - { - int quot = o / monsize; - - if (quot >= 0x10000) - s_scale = 1; - else if (quot >= 0x100) - s_scale = 0x10000 / quot; - else if (o >= 0x800000) - s_scale = 0x1000000 / (o / (monsize >> 8)); - else - s_scale = 0x1000000 / ((o << 8) / monsize); - } -#endif - else - s_scale = SCALE_1_TO_1; - moncontrol(1); -} - -void -_mcleanup() -{ - int fd; - int fromindex; - int endfrom; - char *frompc; - int toindex; - struct rawarc rawarc; - char *profdir; - const char *proffile; - char *progname; - char buf[PATH_MAX]; - extern char **___Argv; - - moncontrol(0); - - if ((profdir = getenv("PROFDIR")) != NULL) { - /* If PROFDIR contains a null value, no profiling output is produced */ - if (*profdir == '\0') { - return; - } - - progname=strrchr(___Argv[0], '/'); - if (progname == NULL) - progname=___Argv[0]; - else - progname++; - - sprintf(buf, "%s/%ld.%s", profdir, getpid(), progname); - proffile = buf; - } else { - proffile = "gmon.out"; - } - - fd = creat( proffile, 0666 ); - if ( fd < 0 ) { - perror( proffile ); - return; - } -# ifdef DEBUG - fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz ); -# endif DEBUG - write( fd , sbuf , ssiz ); - endfrom = s_textsize / (HASHFRACTION * sizeof(*froms)); - for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) { - if ( froms[fromindex] == 0 ) { - continue; - } - frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms)); - for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) { -# ifdef DEBUG - fprintf( stderr , - "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" , - frompc , tos[toindex].selfpc , tos[toindex].count ); -# endif DEBUG - rawarc.raw_frompc = (unsigned long) frompc; - rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc; - rawarc.raw_count = tos[toindex].count; - write( fd , &rawarc , sizeof rawarc ); - } - } - close( fd ); -} - -/* - * The Sparc stack frame is only held together by the frame pointers - * in the register windows. According to the SVR4 SPARC ABI - * Supplement, Low Level System Information/Operating System - * Interface/Software Trap Types, a type 3 trap will flush all of the - * register windows to the stack, which will make it possible to walk - * the frames and find the return addresses. - * However, it seems awfully expensive to incur a trap (system - * call) for every function call. It turns out that "call" simply puts - * the return address in %o7 expecting the "save" in the procedure to - * shift it into %i7; this means that before the "save" occurs, %o7 - * contains the address of the call to mcount, and %i7 still contains - * the caller above that. The asm mcount here simply saves those - * registers in argument registers and branches to internal_mcount, - * simulating a call with arguments. - * Kludges: - * 1) the branch to internal_mcount is hard coded; it should be - * possible to tell asm to use the assembler-name of a symbol. - * 2) in theory, the function calling mcount could have saved %i7 - * somewhere and reused the register; in practice, I *think* this will - * break longjmp (and maybe the debugger) but I'm not certain. (I take - * some comfort in the knowledge that it will break the native mcount - * as well.) - * 3) if builtin_return_address worked, this could be portable. - * However, it would really have to be optimized for arguments of 0 - * and 1 and do something like what we have here in order to avoid the - * trap per function call performance hit. - * 4) the atexit and monsetup calls prevent this from simply - * being a leaf routine that doesn't do a "save" (and would thus have - * access to %o7 and %i7 directly) but the call to write() at the end - * would have also prevented this. - * - * -- [eichin:19920702.1107EST] - */ - -static void internal_mcount PROTO((char *, unsigned short *)) ATTRIBUTE_UNUSED; - -/* i7 == last ret, -> frompcindex */ -/* o7 == current ret, -> selfpc */ -/* Solaris 2 libraries use _mcount. */ -asm(".global _mcount; _mcount: mov %i7,%o1; mov %o7,%o0;b,a internal_mcount"); -/* This is for compatibility with old versions of gcc which used mcount. */ -asm(".global mcount; mcount: mov %i7,%o1; mov %o7,%o0;b,a internal_mcount"); - -static void internal_mcount(selfpc, frompcindex) - register char *selfpc; - register unsigned short *frompcindex; -{ - register struct tostruct *top; - register struct tostruct *prevtop; - register long toindex; - static char already_setup; - - /* - * find the return address for mcount, - * and the return address for mcount's caller. - */ - - if(!already_setup) { - extern char etext[]; - already_setup = 1; - monstartup(0, (char *)etext); -#ifdef USE_ONEXIT - on_exit(_mcleanup, 0); -#else - atexit(_mcleanup); -#endif - } - /* - * check that we are profiling - * and that we aren't recursively invoked. - */ - if (profiling) { - goto out; - } - profiling++; - /* - * check that frompcindex is a reasonable pc value. - * for example: signal catchers get called from the stack, - * not from text space. too bad. - */ - frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc); - if ((unsigned long)frompcindex > s_textsize) { - goto done; - } - frompcindex = - &froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))]; - toindex = *frompcindex; - if (toindex == 0) { - /* - * first time traversing this arc - */ - toindex = ++tos[0].link; - if (toindex >= tolimit) { - goto overflow; - } - *frompcindex = toindex; - top = &tos[toindex]; - top->selfpc = selfpc; - top->count = 1; - top->link = 0; - goto done; - } - top = &tos[toindex]; - if (top->selfpc == selfpc) { - /* - * arc at front of chain; usual case. - */ - top->count++; - goto done; - } - /* - * have to go looking down chain for it. - * top points to what we are looking at, - * prevtop points to previous top. - * we know it is not at the head of the chain. - */ - for (; /* goto done */; ) { - if (top->link == 0) { - /* - * top is end of the chain and none of the chain - * had top->selfpc == selfpc. - * so we allocate a new tostruct - * and link it to the head of the chain. - */ - toindex = ++tos[0].link; - if (toindex >= tolimit) { - goto overflow; - } - top = &tos[toindex]; - top->selfpc = selfpc; - top->count = 1; - top->link = *frompcindex; - *frompcindex = toindex; - goto done; - } - /* - * otherwise, check the next arc on the chain. - */ - prevtop = top; - top = &tos[top->link]; - if (top->selfpc == selfpc) { - /* - * there it is. - * increment its count - * move it to the head of the chain. - */ - top->count++; - toindex = prevtop->link; - prevtop->link = top->link; - top->link = *frompcindex; - *frompcindex = toindex; - goto done; - } - - } -done: - profiling--; - /* and fall through */ -out: - return; /* normal return restores saved registers */ - -overflow: - profiling++; /* halt further profiling */ -# define TOLIMIT "mcount: tos overflow\n" - write(2, TOLIMIT, sizeof(TOLIMIT)); - goto out; -} - -/* - * Control profiling - * profiling is what mcount checks to see if - * all the data structures are ready. - */ -static void moncontrol(mode) - int mode; -{ - if (mode) { - /* start */ - profil((unsigned short *)(sbuf + sizeof(struct phdr)), - ssiz - sizeof(struct phdr), - (int)s_lowpc, s_scale); - profiling = 0; - } else { - /* stop */ - profil((unsigned short *)0, 0, 0, 0); - profiling = 3; - } -} diff --git a/contrib/gcc/config/sparc/hal.h b/contrib/gcc/config/sparc/hal.h deleted file mode 100644 index 0222b819e0eb..000000000000 --- a/contrib/gcc/config/sparc/hal.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Definitions of target machine for GNU compiler, for HAL - SPARC running Solaris 2 HALOS - Copyright 1998 Free Software Foundation, Inc. - Contributed by Carol LePage (carolo@hal.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Need different command line for assembler */ - -#undef ASM_SPEC -#define ASM_SPEC \ - "%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -e1 \ - %{fpic:-K PIC} %{fPIC:-K PIC}" - -/* Need DWARF for debuggers. */ - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG diff --git a/contrib/gcc/config/sparc/lb1spc.asm b/contrib/gcc/config/sparc/lb1spc.asm deleted file mode 100644 index 831f33a988fb..000000000000 --- a/contrib/gcc/config/sparc/lb1spc.asm +++ /dev/null @@ -1,784 +0,0 @@ -/* This is an assembly language implementation of libgcc1.c for the sparc - processor. - - These routines are derived from the Sparc Architecture Manual, version 8, - slightly edited to match the desired calling convention, and also to - optimize them for our purposes. */ - -#ifdef L_mulsi3 -.text - .align 4 - .global .umul - .proc 4 -.umul: - or %o0, %o1, %o4 ! logical or of multiplier and multiplicand - mov %o0, %y ! multiplier to Y register - andncc %o4, 0xfff, %o5 ! mask out lower 12 bits - be mul_shortway ! can do it the short way - andcc %g0, %g0, %o4 ! zero the partial product and clear NV cc - ! - ! long multiply - ! - mulscc %o4, %o1, %o4 ! first iteration of 33 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 ! 32nd iteration - mulscc %o4, %g0, %o4 ! last iteration only shifts - ! the upper 32 bits of product are wrong, but we do not care - retl - rd %y, %o0 - ! - ! short multiply - ! -mul_shortway: - mulscc %o4, %o1, %o4 ! first iteration of 13 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 - mulscc %o4, %o1, %o4 ! 12th iteration - mulscc %o4, %g0, %o4 ! last iteration only shifts - rd %y, %o5 - sll %o4, 12, %o4 ! left shift partial product by 12 bits - srl %o5, 20, %o5 ! right shift partial product by 20 bits - retl - or %o5, %o4, %o0 ! merge for true product -#endif - -#ifdef L_divsi3 -/* - * Division and remainder, from Appendix E of the Sparc Version 8 - * Architecture Manual, with fixes from Gordon Irlam. - */ - -/* - * Input: dividend and divisor in %o0 and %o1 respectively. - * - * m4 parameters: - * .div name of function to generate - * div div=div => %o0 / %o1; div=rem => %o0 % %o1 - * true true=true => signed; true=false => unsigned - * - * Algorithm parameters: - * N how many bits per iteration we try to get (4) - * WORDSIZE total number of bits (32) - * - * Derived constants: - * TOPBITS number of bits in the top decade of a number - * - * Important variables: - * Q the partial quotient under development (initially 0) - * R the remainder so far, initially the dividend - * ITER number of main division loop iterations required; - * equal to ceil(log2(quotient) / N). Note that this - * is the log base (2^N) of the quotient. - * V the current comparand, initially divisor*2^(ITER*N-1) - * - * Cost: - * Current estimate for non-large dividend is - * ceil(log2(quotient) / N) * (10 + 7N/2) + C - * A large dividend is one greater than 2^(31-TOPBITS) and takes a - * different path, as the upper bits of the quotient must be developed - * one bit at a time. - */ - .global .udiv - .align 4 - .proc 4 - .text -.udiv: - b ready_to_divide - mov 0, %g3 ! result is always positive - - .global .div - .align 4 - .proc 4 - .text -.div: - ! compute sign of result; if neither is negative, no problem - orcc %o1, %o0, %g0 ! either negative? - bge ready_to_divide ! no, go do the divide - xor %o1, %o0, %g3 ! compute sign in any case - tst %o1 - bge 1f - tst %o0 - ! %o1 is definitely negative; %o0 might also be negative - bge ready_to_divide ! if %o0 not negative... - sub %g0, %o1, %o1 ! in any case, make %o1 nonneg -1: ! %o0 is negative, %o1 is nonnegative - sub %g0, %o0, %o0 ! make %o0 nonnegative - - -ready_to_divide: - - ! Ready to divide. Compute size of quotient; scale comparand. - orcc %o1, %g0, %o5 - bne 1f - mov %o0, %o3 - - ! Divide by zero trap. If it returns, return 0 (about as - ! wrong as possible, but that is what SunOS does...). - ta 0x2 ! ST_DIV0 - retl - clr %o0 - -1: - cmp %o3, %o5 ! if %o1 exceeds %o0, done - blu got_result ! (and algorithm fails otherwise) - clr %o2 - sethi %hi(1 << (32 - 4 - 1)), %g1 - cmp %o3, %g1 - blu not_really_big - clr %o4 - - ! Here the dividend is >= 2**(31-N) or so. We must be careful here, - ! as our usual N-at-a-shot divide step will cause overflow and havoc. - ! The number of bits in the result here is N*ITER+SC, where SC <= N. - ! Compute ITER in an unorthodox manner: know we need to shift V into - ! the top decade: so do not even bother to compare to R. - 1: - cmp %o5, %g1 - bgeu 3f - mov 1, %g2 - sll %o5, 4, %o5 - b 1b - add %o4, 1, %o4 - - ! Now compute %g2. - 2: addcc %o5, %o5, %o5 - bcc not_too_big - add %g2, 1, %g2 - - ! We get here if the %o1 overflowed while shifting. - ! This means that %o3 has the high-order bit set. - ! Restore %o5 and subtract from %o3. - sll %g1, 4, %g1 ! high order bit - srl %o5, 1, %o5 ! rest of %o5 - add %o5, %g1, %o5 - b do_single_div - sub %g2, 1, %g2 - - not_too_big: - 3: cmp %o5, %o3 - blu 2b - nop - be do_single_div - nop - /* NB: these are commented out in the V8-Sparc manual as well */ - /* (I do not understand this) */ - ! %o5 > %o3: went too far: back up 1 step - ! srl %o5, 1, %o5 - ! dec %g2 - ! do single-bit divide steps - ! - ! We have to be careful here. We know that %o3 >= %o5, so we can do the - ! first divide step without thinking. BUT, the others are conditional, - ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high- - ! order bit set in the first step, just falling into the regular - ! division loop will mess up the first time around. - ! So we unroll slightly... - do_single_div: - subcc %g2, 1, %g2 - bl end_regular_divide - nop - sub %o3, %o5, %o3 - mov 1, %o2 - b end_single_divloop - nop - single_divloop: - sll %o2, 1, %o2 - bl 1f - srl %o5, 1, %o5 - ! %o3 >= 0 - sub %o3, %o5, %o3 - b 2f - add %o2, 1, %o2 - 1: ! %o3 < 0 - add %o3, %o5, %o3 - sub %o2, 1, %o2 - 2: - end_single_divloop: - subcc %g2, 1, %g2 - bge single_divloop - tst %o3 - b,a end_regular_divide - -not_really_big: -1: - sll %o5, 4, %o5 - cmp %o5, %o3 - bleu 1b - addcc %o4, 1, %o4 - be got_result - sub %o4, 1, %o4 - - tst %o3 ! set up for initial iteration -divloop: - sll %o2, 4, %o2 - ! depth 1, accumulated bits 0 - bl L1.16 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 2, accumulated bits 1 - bl L2.17 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 3, accumulated bits 3 - bl L3.19 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits 7 - bl L4.23 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (7*2+1), %o2 - -L4.23: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (7*2-1), %o2 - - -L3.19: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits 5 - bl L4.21 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (5*2+1), %o2 - -L4.21: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (5*2-1), %o2 - -L2.17: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 3, accumulated bits 1 - bl L3.17 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits 3 - bl L4.19 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (3*2+1), %o2 - -L4.19: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (3*2-1), %o2 - -L3.17: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits 1 - bl L4.17 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (1*2+1), %o2 - -L4.17: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (1*2-1), %o2 - -L1.16: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 2, accumulated bits -1 - bl L2.15 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 3, accumulated bits -1 - bl L3.15 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits -1 - bl L4.15 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-1*2+1), %o2 - -L4.15: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-1*2-1), %o2 - -L3.15: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits -3 - bl L4.13 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-3*2+1), %o2 - -L4.13: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-3*2-1), %o2 - -L2.15: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 3, accumulated bits -3 - bl L3.13 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits -5 - bl L4.11 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-5*2+1), %o2 - -L4.11: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-5*2-1), %o2 - -L3.13: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits -7 - bl L4.9 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-7*2+1), %o2 - -L4.9: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-7*2-1), %o2 - - 9: -end_regular_divide: - subcc %o4, 1, %o4 - bge divloop - tst %o3 - bl,a got_result - ! non-restoring fixup here (one instruction only!) - sub %o2, 1, %o2 - - -got_result: - ! check to see if answer should be < 0 - tst %g3 - bl,a 1f - sub %g0, %o2, %o2 -1: - retl - mov %o2, %o0 -#endif - -#ifdef L_modsi3 -/* This implementation was taken from glibc: - * - * Input: dividend and divisor in %o0 and %o1 respectively. - * - * Algorithm parameters: - * N how many bits per iteration we try to get (4) - * WORDSIZE total number of bits (32) - * - * Derived constants: - * TOPBITS number of bits in the top decade of a number - * - * Important variables: - * Q the partial quotient under development (initially 0) - * R the remainder so far, initially the dividend - * ITER number of main division loop iterations required; - * equal to ceil(log2(quotient) / N). Note that this - * is the log base (2^N) of the quotient. - * V the current comparand, initially divisor*2^(ITER*N-1) - * - * Cost: - * Current estimate for non-large dividend is - * ceil(log2(quotient) / N) * (10 + 7N/2) + C - * A large dividend is one greater than 2^(31-TOPBITS) and takes a - * different path, as the upper bits of the quotient must be developed - * one bit at a time. - */ -.text - .align 4 - .global .urem - .proc 4 -.urem: - b divide - mov 0, %g3 ! result always positive - - .align 4 - .global .rem - .proc 4 -.rem: - ! compute sign of result; if neither is negative, no problem - orcc %o1, %o0, %g0 ! either negative? - bge 2f ! no, go do the divide - mov %o0, %g3 ! sign of remainder matches %o0 - tst %o1 - bge 1f - tst %o0 - ! %o1 is definitely negative; %o0 might also be negative - bge 2f ! if %o0 not negative... - sub %g0, %o1, %o1 ! in any case, make %o1 nonneg -1: ! %o0 is negative, %o1 is nonnegative - sub %g0, %o0, %o0 ! make %o0 nonnegative -2: - - ! Ready to divide. Compute size of quotient; scale comparand. -divide: - orcc %o1, %g0, %o5 - bne 1f - mov %o0, %o3 - - ! Divide by zero trap. If it returns, return 0 (about as - ! wrong as possible, but that is what SunOS does...). - ta 0x2 !ST_DIV0 - retl - clr %o0 - -1: - cmp %o3, %o5 ! if %o1 exceeds %o0, done - blu got_result ! (and algorithm fails otherwise) - clr %o2 - sethi %hi(1 << (32 - 4 - 1)), %g1 - cmp %o3, %g1 - blu not_really_big - clr %o4 - - ! Here the dividend is >= 2**(31-N) or so. We must be careful here, - ! as our usual N-at-a-shot divide step will cause overflow and havoc. - ! The number of bits in the result here is N*ITER+SC, where SC <= N. - ! Compute ITER in an unorthodox manner: know we need to shift V into - ! the top decade: so do not even bother to compare to R. - 1: - cmp %o5, %g1 - bgeu 3f - mov 1, %g2 - sll %o5, 4, %o5 - b 1b - add %o4, 1, %o4 - - ! Now compute %g2. - 2: addcc %o5, %o5, %o5 - bcc not_too_big - add %g2, 1, %g2 - - ! We get here if the %o1 overflowed while shifting. - ! This means that %o3 has the high-order bit set. - ! Restore %o5 and subtract from %o3. - sll %g1, 4, %g1 ! high order bit - srl %o5, 1, %o5 ! rest of %o5 - add %o5, %g1, %o5 - b do_single_div - sub %g2, 1, %g2 - - not_too_big: - 3: cmp %o5, %o3 - blu 2b - nop - be do_single_div - nop - /* NB: these are commented out in the V8-Sparc manual as well */ - /* (I do not understand this) */ - ! %o5 > %o3: went too far: back up 1 step - ! srl %o5, 1, %o5 - ! dec %g2 - ! do single-bit divide steps - ! - ! We have to be careful here. We know that %o3 >= %o5, so we can do the - ! first divide step without thinking. BUT, the others are conditional, - ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high- - ! order bit set in the first step, just falling into the regular - ! division loop will mess up the first time around. - ! So we unroll slightly... - do_single_div: - subcc %g2, 1, %g2 - bl end_regular_divide - nop - sub %o3, %o5, %o3 - mov 1, %o2 - b end_single_divloop - nop - single_divloop: - sll %o2, 1, %o2 - bl 1f - srl %o5, 1, %o5 - ! %o3 >= 0 - sub %o3, %o5, %o3 - b 2f - add %o2, 1, %o2 - 1: ! %o3 < 0 - add %o3, %o5, %o3 - sub %o2, 1, %o2 - 2: - end_single_divloop: - subcc %g2, 1, %g2 - bge single_divloop - tst %o3 - b,a end_regular_divide - -not_really_big: -1: - sll %o5, 4, %o5 - cmp %o5, %o3 - bleu 1b - addcc %o4, 1, %o4 - be got_result - sub %o4, 1, %o4 - - tst %o3 ! set up for initial iteration -divloop: - sll %o2, 4, %o2 - ! depth 1, accumulated bits 0 - bl L1.16 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 2, accumulated bits 1 - bl L2.17 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 3, accumulated bits 3 - bl L3.19 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits 7 - bl L4.23 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (7*2+1), %o2 -L4.23: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (7*2-1), %o2 - -L3.19: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits 5 - bl L4.21 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (5*2+1), %o2 - -L4.21: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (5*2-1), %o2 - -L2.17: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 3, accumulated bits 1 - bl L3.17 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits 3 - bl L4.19 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (3*2+1), %o2 - -L4.19: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (3*2-1), %o2 - -L3.17: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits 1 - bl L4.17 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (1*2+1), %o2 - -L4.17: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (1*2-1), %o2 - -L1.16: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 2, accumulated bits -1 - bl L2.15 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 3, accumulated bits -1 - bl L3.15 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits -1 - bl L4.15 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-1*2+1), %o2 - -L4.15: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-1*2-1), %o2 - -L3.15: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits -3 - bl L4.13 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-3*2+1), %o2 - -L4.13: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-3*2-1), %o2 - -L2.15: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 3, accumulated bits -3 - bl L3.13 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits -5 - bl L4.11 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-5*2+1), %o2 - -L4.11: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-5*2-1), %o2 - -L3.13: - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits -7 - bl L4.9 - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-7*2+1), %o2 - -L4.9: - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-7*2-1), %o2 - - 9: -end_regular_divide: - subcc %o4, 1, %o4 - bge divloop - tst %o3 - bl,a got_result - ! non-restoring fixup here (one instruction only!) - add %o3, %o1, %o3 - -got_result: - ! check to see if answer should be < 0 - tst %g3 - bl,a 1f - sub %g0, %o3, %o3 -1: - retl - mov %o3, %o0 - -#endif - diff --git a/contrib/gcc/config/sparc/lb1spl.asm b/contrib/gcc/config/sparc/lb1spl.asm deleted file mode 100644 index 4c8bc30b83d5..000000000000 --- a/contrib/gcc/config/sparc/lb1spl.asm +++ /dev/null @@ -1,246 +0,0 @@ -/* This is an assembly language implementation of libgcc1.c for the sparclite - processor. - - These routines are all from the Sparclite User's Guide, slightly edited - to match the desired calling convention, and also to optimize them. */ - -#ifdef L_udivsi3 -.text - .align 4 - .global .udiv - .proc 04 -.udiv: - wr %g0,%g0,%y ! Not a delayed write for sparclite - tst %g0 - divscc %o0,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - retl - divscc %g1,%o1,%o0 -#endif - -#ifdef L_umodsi3 -.text - .align 4 - .global .urem - .proc 04 -.urem: - wr %g0,%g0,%y ! Not a delayed write for sparclite - tst %g0 - divscc %o0,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - divscc %g1,%o1,%g1 - bl 1f - rd %y,%o0 - retl - nop -1: retl - add %o0,%o1,%o0 -#endif - -#ifdef L_divsi3 -.text - .align 4 - .global .div - .proc 04 -! ??? This routine could be made faster if was optimized, and if it was -! rewritten to only calculate the quotient. -.div: - wr %g0,%g0,%y ! Not a delayed write for sparclite - mov %o1,%o4 - tst %o1 - bl,a 1f - sub %g0,%o4,%o4 -1: tst %o0 - bl,a 2f - mov -1,%y -2: divscc %o0,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - be 6f - mov %y,%o3 - bg 4f - addcc %o3,%o4,%g0 - be,a 6f - mov %g0,%o3 - tst %o0 - bl 5f - tst %g1 - ba 5f - add %o3,%o4,%o3 -4: subcc %o3,%o4,%g0 - be,a 6f - mov %g0,%o3 - tst %o0 - bge 5f - tst %g1 - sub %o3,%o4,%o3 -5: bl,a 6f - add %g1,1,%g1 -6: tst %o1 - bl,a 7f - sub %g0,%g1,%g1 -7: retl - mov %g1,%o0 ! Quotient is in %g1. -#endif - -#ifdef L_modsi3 -.text - .align 4 - .global .rem - .proc 04 -! ??? This routine could be made faster if was optimized, and if it was -! rewritten to only calculate the remainder. -.rem: - wr %g0,%g0,%y ! Not a delayed write for sparclite - mov %o1,%o4 - tst %o1 - bl,a 1f - sub %g0,%o4,%o4 -1: tst %o0 - bl,a 2f - mov -1,%y -2: divscc %o0,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - divscc %g1,%o4,%g1 - be 6f - mov %y,%o3 - bg 4f - addcc %o3,%o4,%g0 - be,a 6f - mov %g0,%o3 - tst %o0 - bl 5f - tst %g1 - ba 5f - add %o3,%o4,%o3 -4: subcc %o3,%o4,%g0 - be,a 6f - mov %g0,%o3 - tst %o0 - bge 5f - tst %g1 - sub %o3,%o4,%o3 -5: bl,a 6f - add %g1,1,%g1 -6: tst %o1 - bl,a 7f - sub %g0,%g1,%g1 -7: retl - mov %o3,%o0 ! Remainder is in %o3. -#endif diff --git a/contrib/gcc/config/sparc/linux-aout.h b/contrib/gcc/config/sparc/linux-aout.h deleted file mode 100644 index 76d7653eaae6..000000000000 --- a/contrib/gcc/config/sparc/linux-aout.h +++ /dev/null @@ -1,130 +0,0 @@ -/* Definitions for SPARC running Linux-based GNU systems with a.out. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Eddie C. Dost (ecd@skynet.be) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#undef HAVE_ATEXIT -#define HAVE_ATEXIT - -/* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is. - For now, we play safe. It may change later. */ - -#if 0 -#undef MULTIBYTE_CHARS -#define MULTIBYTE_CHARS 1 -#endif - -/* We need that too. */ -#define HANDLE_SYSV_PRAGMA - -#undef MD_EXEC_PREFIX -#undef MD_STARTFILE_PREFIX - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - output_file_directive (FILE, main_input_filename); \ - fprintf (FILE, "\t.version\t\"01.01\"\n"); \ - } while (0) - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static}" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with a.out)"); - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Dsparc -Dlinux -Asystem(unix) -Asystem(posix)" - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC \ -"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" - -/* Don't default to pcc-struct-return, because gcc is the only compiler, - and we want to retain compatibility with older gcc versions. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 - -#undef LIB_SPEC - -#if 1 -/* We no longer link with libc_p.a or libg.a by default. If you - want to profile or debug the GNU/Linux C library, please add - -lc_p or -ggdb to LDFLAGS at the link time, respectively. */ -#define LIB_SPEC \ -"%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}" -#else -#define LIB_SPEC \ -"%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \ - %{!p:%{!pg:%{!g*:-lc} %{g*:-lg -static}}}" -#endif - -#undef LINK_SPEC -#define LINK_SPEC "-m sparclinux" - -/* The sun bundled assembler doesn't accept -Yd, (and neither does gas). - It's safe to pass -s always, even if -g is not used. */ -#undef ASM_SPEC -#define ASM_SPEC \ - "%{V} %{v:%{!V:-V}} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}" - -#if 0 -/* Define for support of TFmode long double and REAL_ARITHMETIC. - Sparc ABI says that long double is 4 words. GNU/Linux does not support - long double yet. */ -#define LONG_DOUBLE_TYPE_SIZE 128 -#endif - -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); diff --git a/contrib/gcc/config/sparc/linux.h b/contrib/gcc/config/sparc/linux.h deleted file mode 100644 index 40694908b68d..000000000000 --- a/contrib/gcc/config/sparc/linux.h +++ /dev/null @@ -1,259 +0,0 @@ -/* Definitions for SPARC running Linux-based GNU systems with ELF. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Eddie C. Dost (ecd@skynet.be) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define LINUX_DEFAULT_ELF - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#undef HAVE_ATEXIT -#define HAVE_ATEXIT - -/* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is. - For now, we play safe. It may change later. */ - -#if 0 -#undef MULTIBYTE_CHARS -#define MULTIBYTE_CHARS 1 -#endif - -#ifndef USE_GNULIBC_1 -#undef DEFAULT_VTABLE_THUNKS -#define DEFAULT_VTABLE_THUNKS 2 -#endif - -/* Use stabs instead of DWARF debug format. */ -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#include - -#undef MD_EXEC_PREFIX -#undef MD_STARTFILE_PREFIX - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - output_file_directive (FILE, main_input_filename); \ - fprintf (FILE, "\t.version\t\"01.01\"\n"); \ - } while (0) - -/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add - the GNU/Linux magical crtbegin.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main'. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on - the GNU/Linux magical crtend.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main', followed by a normal - GNU/Linux "finalizer" file, `crtn.o'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" - -/* This is for -profile to use -lc_p instead of -lc. */ -#undef CC1_SPEC -#define CC1_SPEC "%{profile:-p} \ -%{sun4:} %{target:} \ -%{mcypress:-mcpu=cypress} \ -%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ -%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ -" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with ELF)"); - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sparc__ -Dlinux -Asystem(unix) -Asystem(posix)" - -#undef CPP_SUBTARGET_SPEC -#ifdef USE_GNULIBC_1 -#define CPP_SUBTARGET_SPEC \ -"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" -#else -#define CPP_SUBTARGET_SPEC \ -"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" -#endif - -#undef LIB_SPEC -/* We no longer link with libc_p.a or libg.a by default. If you - want to profile or debug the GNU/Linux C library, please add - -lc_p or -ggdb to LDFLAGS at the link time, respectively. */ -#if 1 -#ifdef USE_GNULIBC_1 -#define LIB_SPEC \ - "%{!shared: %{p:-lgmon} %{pg:-lgmon} %{profile:-lgmon -lc_p} \ - %{!profile:%{!ggdb:-lc} %{ggdb:-lg}}}" -#else -#define LIB_SPEC \ - "%{shared: -lc} \ - %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \ - %{profile:-lc_p} %{!profile: -lc}}" -#endif -#else -#define LIB_SPEC \ - "%{!shared: \ - %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \ - %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}" -#endif - -/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support - for the special GCC options -static and -shared, which allow us to - link things in one of these three modes by applying the appropriate - combinations of options at link-time. We like to support here for - as many of the other GNU linker options as possible. But I don't - have the time to search for those flags. I am sure how to add - support for -soname shared_object_name. H.J. - - I took out %{v:%{!V:-V}}. It is too much :-(. They can use - -Wl,-V. - - When the -shared link option is used a final link is not being - done. */ - -/* If ELF is the default format, we should not use /lib/elf. */ - -#undef LINK_SPEC -#ifdef USE_GNULIBC_1 -#ifndef LINUX_DEFAULT_ELF -#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ - %{!shared: \ - %{!ibcs: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \ - %{!rpath:-rpath /lib/elf/}} %{static:-static}}}" -#else -#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ - %{!shared: \ - %{!ibcs: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \ - %{static:-static}}}" -#endif -#else -#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ - %{!shared: \ - %{!ibcs: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ - %{static:-static}}}" -#endif - -/* The sun bundled assembler doesn't accept -Yd, (and neither does gas). - It's safe to pass -s always, even if -g is not used. */ -#undef ASM_SPEC -#define ASM_SPEC \ - "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}" - -/* Same as sparc.h */ -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(REGNO) (REGNO) - -/* We use stabs-in-elf for debugging, because that is what the native - toolchain uses. XXX */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - fputs ("\t.local\t", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - putc ('\n', (FILE)); \ - ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ -} while (0) - -#undef COMMON_ASM_OP -#define COMMON_ASM_OP "\t.common" - -/* This is how to output a definition of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d:\n", PREFIX, NUM) - -/* This is how to output a reference to an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABELREF -#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d", PREFIX, NUM) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf (LABEL, "*.L%s%d", PREFIX, NUM) - - -#if 0 -/* Define for support of TFmode long double and REAL_ARITHMETIC. - Sparc ABI says that long double is 4 words. GNU/Linux does not support - long double yet. */ -#define LONG_DOUBLE_TYPE_SIZE 128 -#endif - -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); diff --git a/contrib/gcc/config/sparc/linux64.h b/contrib/gcc/config/sparc/linux64.h deleted file mode 100644 index 705b5ca33a04..000000000000 --- a/contrib/gcc/config/sparc/linux64.h +++ /dev/null @@ -1,366 +0,0 @@ -/* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF. - Copyright 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by David S. Miller (davem@caip.rutgers.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define SPARC_BI_ARCH - -#define LINUX_DEFAULT_ELF - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#undef HAVE_ATEXIT -#define HAVE_ATEXIT - -#include - -#undef MD_EXEC_PREFIX -#undef MD_STARTFILE_PREFIX - -#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc -/* A 64 bit v9 compiler with stack-bias, - in a Medium/Low code model environment. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ - (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \ - + MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU) -#endif - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - output_file_directive (FILE, main_input_filename); \ - fprintf (FILE, "\t.version\t\"01.01\"\n"); \ - } while (0) - -#undef ASM_CPU_DEFAULT_SPEC -#define ASM_CPU_DEFAULT_SPEC "-Av9a" - -/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add - the GNU/Linux magical crtbegin.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main'. */ - -#undef STARTFILE_SPEC - -#define STARTFILE_SPEC32 \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -#define STARTFILE_SPEC64 \ - "%{!shared: \ - %{pg:/usr/lib64/gcrt1.o%s} %{!pg:%{p:/usr/lib64/gcrt1.o%s} %{!p:/usr/lib64/crt1.o%s}}}\ - /usr/lib64/crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -#ifdef SPARC_BI_ARCH - -#if DEFAULT_ARCH32_P -#define STARTFILE_SPEC "\ -%{m32:" STARTFILE_SPEC32 "} \ -%{m64:" STARTFILE_SPEC64 "} \ -%{!m32:%{!m64:" STARTFILE_SPEC32 "}}" -#else -#define STARTFILE_SPEC "\ -%{m32:" STARTFILE_SPEC32 "} \ -%{m64:" STARTFILE_SPEC64 "} \ -%{!m32:%{!m64:" STARTFILE_SPEC64 "}}" -#endif - -#else - -#define STARTFILE_SPEC STARTFILE_SPEC64 - -#endif - -/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on - the GNU/Linux magical crtend.o file (see crtstuff.c) which - provides part of the support for getting C++ file-scope static - object constructed before entering `main', followed by a normal - GNU/Linux "finalizer" file, `crtn.o'. */ - -#undef ENDFILE_SPEC - -#define ENDFILE_SPEC32 \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" - -#define ENDFILE_SPEC64 \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s" - -#ifdef SPARC_BI_ARCH - -#if DEFAULT_ARCH32_P -#define ENDFILE_SPEC "\ -%{m32:" ENDFILE_SPEC32 "} \ -%{m64:" ENDFILE_SPEC64 "} \ -%{!m32:%{!m64:" ENDFILE_SPEC32 "}}" -#else -#define ENDFILE_SPEC "\ -%{m32:" ENDFILE_SPEC32 "} \ -%{m64:" ENDFILE_SPEC64 "} \ -%{!m32:%{!m64:" ENDFILE_SPEC64 "}}" -#endif - -#else - -#define ENDFILE_SPEC ENDFILE_SPEC64 - -#endif - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparc64 GNU/Linux with ELF)"); - -/* The default code model. */ -#undef SPARC_DEFAULT_CMODEL -#define SPARC_DEFAULT_CMODEL CM_MEDLOW - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 128 - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__ELF__ -Dunix -D_LONGLONG -D__sparc__ -Dlinux -Asystem(unix) -Asystem(posix)" - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "\ -%{fPIC:-D__PIC__ -D__pic__} \ -%{fpic:-D__PIC__ -D__pic__} \ -%{posix:-D_POSIX_SOURCE} \ -%{pthread:-D_REENTRANT} \ -" - -#undef LIB_SPEC -#define LIB_SPEC \ - "%{shared: -lc} \ - %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \ - %{profile:-lc_p} %{!profile: -lc}}" - -/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support - for the special GCC options -static and -shared, which allow us to - link things in one of these three modes by applying the appropriate - combinations of options at link-time. We like to support here for - as many of the other GNU linker options as possible. But I don't - have the time to search for those flags. I am sure how to add - support for -soname shared_object_name. H.J. - - I took out %{v:%{!V:-V}}. It is too much :-(. They can use - -Wl,-V. - - When the -shared link option is used a final link is not being - done. */ - -/* If ELF is the default format, we should not use /lib/elf. */ - -#ifdef SPARC_BI_ARCH - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "link_arch32", LINK_ARCH32_SPEC }, \ - { "link_arch64", LINK_ARCH64_SPEC }, \ - { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ - { "link_arch", LINK_ARCH_SPEC }, - -#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ - %{!shared: \ - %{!ibcs: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ - %{static:-static}}} \ -" - -#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ - %{!shared: \ - %{!ibcs: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ - %{static:-static}}} \ -" - -#define LINK_ARCH_SPEC "\ -%{m32:%(link_arch32)} \ -%{m64:%(link_arch64)} \ -%{!m32:%{!m64:%(link_arch_default)}} \ -" - -#define LINK_ARCH_DEFAULT_SPEC \ -(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC) - -#undef LINK_SPEC -#define LINK_SPEC "\ -%(link_arch) \ -%{mlittle-endian:-EL} \ -" - -#undef CC1_SPEC -#if DEFAULT_ARCH32_P -#define CC1_SPEC "\ -%{sun4:} %{target:} \ -%{mcypress:-mcpu=cypress} \ -%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ -%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ -%{m64:-mptr64 -mcpu=ultrasparc -mstack-bias} \ -" -#else -#define CC1_SPEC "\ -%{sun4:} %{target:} \ -%{mcypress:-mcpu=cypress} \ -%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ -%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ -%{m32:-mptr32 -mcpu=cypress -mno-stack-bias} \ -" -#endif - -#if DEFAULT_ARCH32_P -#define MULTILIB_DEFAULTS { "m32" } -#else -#define MULTILIB_DEFAULTS { "m64" } -#endif - -#else /* !SPARC_BI_ARCH */ - -#undef LINK_SPEC -#define LINK_ARCH_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ - %{!shared: \ - %{!ibcs: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ - %{static:-static}}} \ -%{mlittle-endian:-EL} \ -" - -#endif /* !SPARC_BI_ARCH */ - -/* The sun bundled assembler doesn't accept -Yd, (and neither does gas). - It's safe to pass -s always, even if -g is not used. */ -#undef ASM_SPEC -#define ASM_SPEC "\ -%{V} \ -%{v:%{!V:-V}} \ -%{!Qn:-Qy} \ -%{n} \ -%{T} \ -%{Ym,*} \ -%{Wa,*:%*} \ --s %{fpic:-K PIC} %{fPIC:-K PIC} \ -%{mlittle-endian:-EL} \ -%(asm_cpu) %(asm_arch) \ -" - -/* Same as sparc.h */ -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(REGNO) (REGNO) - -/* System V Release 4 uses DWARF debugging info. Buf DWARF1 doesn't do - 64-bit anything, so we use DWARF2. */ - -#undef DWARF2_DEBUGGING_INFO -#undef DWARF_DEBUGGING_INFO -#undef DBX_DEBUGGING_INFO -#define DWARF2_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - fputs ("\t.local\t", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - putc ('\n', (FILE)); \ - ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ -} while (0) - -#undef COMMON_ASM_OP -#define COMMON_ASM_OP "\t.common" - -/* This is how to output a definition of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d:\n", PREFIX, NUM) - -/* This is how to output a reference to an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABELREF -#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d", PREFIX, NUM) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf (LABEL, "*.L%s%d", PREFIX, NUM) - -/* Stabs doesn't use this, and it confuses a simulator. */ -/* ??? Need to see what DWARF needs, if anything. */ -#undef ASM_IDENTIFY_GCC -#define ASM_IDENTIFY_GCC(FILE) - -/* Define the names of various pseudo-ops used by the Sparc/svr4 assembler. - ??? If ints are 64 bits then UNALIGNED_INT_ASM_OP (defined elsewhere) is - misnamed. These should all refer to explicit sizes (half/word/xword?), - anything other than short/int/long/etc. */ - -#define UNALIGNED_DOUBLE_INT_ASM_OP ".uaxword" - -/* DWARF bits. */ - -/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. - Obviously the Dwarf2 folks havn't tried to actually build systems - with their spec. On a 64-bit system, only 64-bit relocs become - RELATIVE relocations. */ - -/* #define DWARF_OFFSET_SIZE PTR_SIZE */ - -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); diff --git a/contrib/gcc/config/sparc/lite.h b/contrib/gcc/config/sparc/lite.h deleted file mode 100644 index 55c232ac7798..000000000000 --- a/contrib/gcc/config/sparc/lite.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARClite w/o FPU. - Copyright (C) 1993, 1996 Free Software Foundation, Inc. - Contributed by Jim Wilson (wilson@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sparc/sparc.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -Dsparclite -Acpu(sparc) -Amachine(sparc)" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparclite)"); - -/* Enable app-regs and epilogue options. Do not enable the fpu. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE) - -/* US Software GOFAST library support. */ -#include "gofast.h" -#undef INIT_SUBTARGET_OPTABS -#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS diff --git a/contrib/gcc/config/sparc/litecoff.h b/contrib/gcc/config/sparc/litecoff.h deleted file mode 100644 index bd89e1b46865..000000000000 --- a/contrib/gcc/config/sparc/litecoff.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARClite w/o FPU, COFF. - Copyright (C) 1994, 1996 Free Software Foundation, Inc. - Written by Ken Raeburn (raeburn@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sparc/lite.h" - -#undef ASM_OUTPUT_IDENT - -#undef SELECT_SECTION -#undef SELECT_RTX_SECTION -#define BSS_SECTION_ASM_OP ".section\t\".bss\"" - -#include "svr3.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -Dsparclite -Acpu(sparc) -Amachine(sparc)" - -/* Default to stabs in COFF. */ - -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#include "dbxcoff.h" - -/* Support the ctors and dtors sections for g++. */ - -#undef INIT_SECTION_ASM_OP - -/* Support the ctors and dtors sections for g++. */ - -#undef CTORS_SECTION_ASM_OP -#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\"" -#undef DTORS_SECTION_ASM_OP -#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\"" - -/* A list of other sections which the compiler might be "in" at any - given time. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_ctors, in_dtors - -/* A list of extra section function definitions. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION - -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -#define INT_ASM_OP ".long" - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#undef ASM_OUTPUT_CONSTRUCTOR -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#undef ASM_OUTPUT_DESTRUCTOR -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -#undef DO_GLOBAL_CTORS_BODY -#undef DO_GLOBAL_DTORS_BODY diff --git a/contrib/gcc/config/sparc/lynx-ng.h b/contrib/gcc/config/sparc/lynx-ng.h deleted file mode 100644 index 9e9f82cf10b6..000000000000 --- a/contrib/gcc/config/sparc/lynx-ng.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Definitions for SPARC running LynxOS, using Lynx's old as and ld. - Copyright (C) 1993, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include - -/* ??? Must redefine to get sparclite and v8 defines. Can this be done - differently? */ - -#undef CPP_SPEC -#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \ - %{mposix:-D_POSIX_SOURCE} \ - %{msystem-v:-I/usr/include_v} \ - %(cpp_cpu)" - -/* Names to predefine in the preprocessor for this target machine. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Dsparc -DLynx -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(sparc) -Amachine(sparc)" - -/* Provide required defaults for linker switches. */ - -#undef LINK_SPEC -#define LINK_SPEC "-e __main -T 0 %{msystem-v:-V} %{mcoff:-k}" diff --git a/contrib/gcc/config/sparc/lynx.h b/contrib/gcc/config/sparc/lynx.h deleted file mode 100644 index 99b319a0df22..000000000000 --- a/contrib/gcc/config/sparc/lynx.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Definitions for SPARC running LynxOS. - Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include - -#undef ASM_OUTPUT_IDENT -#undef SELECT_SECTION -#undef SELECT_RTX_SECTION - -#define BSS_SECTION_ASM_OP ".section\t\".bss\"" - -#include - -/* ??? Must redefine to get sparclite and v8 defines. Can this be done - differently? */ - -#undef CPP_SPEC -#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \ - %{mposix:-D_POSIX_SOURCE} \ - %{msystem-v:-I/usr/include_v} \ - %(cpp_cpu)" - -/* Names to predefine in the preprocessor for this target machine. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Dsparc -DSPARC -DLynx -DLYNX -DIBITS32 -Asystem(unix) -Asystem(lynx) -Acpu(sparc) -Amachine(sparc)" - -#undef LINK_SPEC - -/* Sparc version of libc.a has references to libm.a (printf calls pow for - instance), so we must always link both. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{mthreads:-L/lib/thread/} \ - %{msystem-v:-lc_v -lm_v -lc_v} \ - %{!msystem-v:%{mposix:-lc_p} -lc -lm -lc}" diff --git a/contrib/gcc/config/sparc/netbsd.h b/contrib/gcc/config/sparc/netbsd.h deleted file mode 100644 index a512f41e1553..000000000000 --- a/contrib/gcc/config/sparc/netbsd.h +++ /dev/null @@ -1,46 +0,0 @@ -#include - -/* Get generic NetBSD definitions. */ - -#include - -/* Names to predefine in the preprocessor for this target machine. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Dsparc -D__NetBSD__ -Asystem(unix) -Asystem(NetBSD) -Acpu(sparc) -Amachine(sparc)" - -/* Make gcc agree with */ - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_UNSIGNED -#define WCHAR_UNSIGNED 0 - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 - -/* This is BSD, so it wants DBX format. */ - -#define DBX_DEBUGGING_INFO - -/* This is the char to use for continuation (in case we need to turn - continuation back on). */ - -#define DBX_CONTIN_CHAR '?' - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* Until they use ELF or something that handles dwarf2 unwinds - and initialization stuff better. */ -#define DWARF2_UNWIND_INFO 0 - diff --git a/contrib/gcc/config/sparc/openbsd.h b/contrib/gcc/config/sparc/openbsd.h deleted file mode 100644 index 19ece975e99e..000000000000 --- a/contrib/gcc/config/sparc/openbsd.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Configuration file for sparc OpenBSD target. - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include - -/* Get generic OpenBSD definitions. */ -#define OBSD_OLD_GAS -#include - -/* Run-time target specifications. */ -#define CPP_PREDEFINES "-D__unix__ -D__sparc__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(sparc) -Amachine(sparc)" - -/* Layout of source language data types */ - -/* This must agree with */ -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 - -/* Specific options for DBX Output. */ - -/* This is BSD, so it wants DBX format. */ -#define DBX_DEBUGGING_INFO - -/* This is the char to use for continuation */ -#define DBX_CONTIN_CHAR '?' - -/* Stack & calling: aggregate returns. */ - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* Assembler format: exception region output. */ - -/* All configurations that don't use elf must be explicit about not using - dwarf unwind information. egcs doesn't try too hard to check internal - configuration files... */ -#define DWARF2_UNWIND_INFO 0 - -/* Default sparc.h does already define ASM_OUTPUT_MI_THUNK */ - diff --git a/contrib/gcc/config/sparc/pbd.h b/contrib/gcc/config/sparc/pbd.h deleted file mode 100644 index b70fdcb259b5..000000000000 --- a/contrib/gcc/config/sparc/pbd.h +++ /dev/null @@ -1,156 +0,0 @@ -/* Definitions of target machine for GNU compiler, Citicorp/TTI Unicom PBD - version (using GAS and COFF (encapsulated is unacceptable) ) - Copyright (C) 1990, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sparc/sparc.h" - -/* Names to predefine in the preprocessor for this target machine. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -DUnicomPBD -Dunix -D__GCC_NEW_VARARGS__ -Asystem(unix) -Acpu(sparc) -Amachine(sparc)" - -/* We want DBX format for use with gdb under COFF. */ - -#define DBX_DEBUGGING_INFO - -/* Generate calls to memcpy, memcmp and memset. */ - -#define TARGET_MEM_FUNCTIONS - -/* we use /lib/libp/lib* when profiling */ - -#undef LIB_SPEC -#define LIB_SPEC "%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc" - - -/* Use crt1.o as a startup file and crtn.o as a closing file. */ -/* - * The loader directive file gcc.ifile defines how to merge the constructor - * sections into the data section. Also, since gas only puts out those - * sections in response to N_SETT stabs, and does not (yet) have a - * ".sections" directive, gcc.ifile also defines the list symbols - * __DTOR_LIST__ and __CTOR_LIST__. - * - * Finally, we must explicitly specify the file from libgcc.a that defines - * exit(), otherwise if the user specifies (for example) "-lc_s" on the - * command line, the wrong exit() will be used and global destructors will - * not get called . - */ - -#define STARTFILE_SPEC \ -"%{!r: gcc.ifile%s} %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} \ -%{!r:_exit.o%s}" - -#define ENDFILE_SPEC "crtn.o%s" - -/* cpp has to support a #sccs directive for the /usr/include files */ - -#define SCCS_DIRECTIVE - -/* LINK_SPEC is needed only for SunOS 4. */ - -#undef LINK_SPEC - -/* Although the gas we use can create .ctor and .dtor sections from N_SETT - stabs, it does not support section directives, so we need to have the loader - define the lists. - */ -#define CTOR_LISTS_DEFINED_EXTERNALLY - -/* similar to default, but allows for the table defined by ld with gcc.ifile. - nptrs is always 0. So we need to instead check that __DTOR_LIST__[1] != 0. - The old check is left in so that the same macro can be used if and when - a future version of gas does support section directives. */ - -#define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \ - if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0)) \ - for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++); \ - for (i = nptrs; i >= 1; i--) \ - __DTOR_LIST__[i] (); } - -/* - * Here is an example gcc.ifile. I've tested it on PBD sparc - * systems. The NEXT(0x200000) works on just about all 386 and m68k systems, - * but can be reduced to any power of 2 that is >= NBPS (0x40000 on a pbd). - - SECTIONS { - .text BIND(0x41000200) BLOCK (0x200) : - { *(.init) *(.text) vfork = fork; *(.fini) } - - GROUP BIND( NEXT(0x200000) + ADDR(.text) + SIZEOF(.text)): - { .data : { __CTOR_LIST__ = . ; . += 4; *(.ctor) . += 4 ; - __DTOR_LIST__ = . ; . += 4; *(.dtor) . += 4 ; } - .bss : { } - } - } - */ - -/* The prefix to add to user-visible assembler symbols. */ - -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "" - -/* fixes: */ -/* - * Internal labels are prefixed with a period. - */ - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#undef ASM_GENERATE_INTERNAL_LABEL - -#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf (LABEL, "*.%s%d", PREFIX, NUM) - - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM) - -/* This is how to output an element of a case-vector that is relative. */ - -#undef ASM_OUTPUT_ADDR_DIFF_ELT -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ - fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL) - -/* This is how to output an element of a case-vector that is absolute. - (The 68000 does not use such vectors, - but we must define this macro anyway.) */ - -#undef ASM_OUTPUT_ADDR_VEC_ELT -#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ - fprintf (FILE, "\t.word .L%d\n", VALUE) - -/* This is needed for SunOS 4.0, and should not hurt for 3.2 - versions either. */ -#undef ASM_OUTPUT_SOURCE_LINE(file, line) -#define ASM_OUTPUT_SOURCE_LINE(file, line) \ - { static int sym_lineno = 1; \ - fprintf (file, ".stabn 68,0,%d,.LM%d\n.LM%d:\n", \ - line, sym_lineno, sym_lineno); \ - sym_lineno += 1; } - -#define ASM_INT_OP ".long " diff --git a/contrib/gcc/config/sparc/rtems.h b/contrib/gcc/config/sparc/rtems.h deleted file mode 100644 index 1ab0a4216fd9..000000000000 --- a/contrib/gcc/config/sparc/rtems.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Definitions for rtems targeting a SPARC using a.out. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Joel Sherrill (joel@OARcorp.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sparc/aout.h" - -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -D__GCC_NEW_VARARGS__ -Drtems -D__rtems__ \ - -Asystem(rtems) -Acpu(sparc) -Amachine(sparc)" - -/* Generate calls to memcpy, memcmp and memset. */ -#ifndef TARGET_MEM_FUNCTIONS -#define TARGET_MEM_FUNCTIONS -#endif - -/* end of sparc/rtems.h */ diff --git a/contrib/gcc/config/sparc/sol2-c1.asm b/contrib/gcc/config/sparc/sol2-c1.asm deleted file mode 100644 index 894a8c34c084..000000000000 --- a/contrib/gcc/config/sparc/sol2-c1.asm +++ /dev/null @@ -1,110 +0,0 @@ -! crt1.s for sparc & sparcv9 (SunOS 5) - -! Copyright (C) 1992 Free Software Foundation, Inc. -! Written By David Vinayak Henkel-Wallace, June 1992 -! -! This file 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. -! -! In addition to the permissions in the GNU General Public License, the -! Free Software Foundation gives you unlimited permission to link the -! compiled version of this file with other programs, and to distribute -! those programs without any restriction coming from the use of this -! file. (The General Public License restrictions do apply in other -! respects; for example, they cover modification of the file, and -! distribution when not linked into another program.) -! -! This file 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. -! -! You should have received a copy of the GNU General Public License -! along with this program; see the file COPYING. If not, write to -! the Free Software Foundation, 59 Temple Place - Suite 330, -! Boston, MA 02111-1307, USA. -! -! As a special exception, if you link this library with files -! compiled with GCC to produce an executable, this does not cause -! the resulting executable to be covered by the GNU General Public License. -! This exception does not however invalidate any other reasons why -! the executable file might be covered by the GNU General Public License. -! - -! This file takes control of the process from the kernel, as specified -! in section 3 of the SVr4 ABI. -! This file is the first thing linked into any executable. - -#ifdef __sparcv9 -#define CPTRSIZE 8 -#define CPTRSHIFT 3 -#define STACK_BIAS 2047 -#define ldn ldx -#define stn stx -#define setn(s, scratch, dst) setx s, scratch, dst -#else -#define CPTRSIZE 4 -#define CPTRSHIFT 2 -#define STACK_BIAS 0 -#define ldn ld -#define stn st -#define setn(s, scratch, dst) set s, dst -#endif - - .section ".text" - .proc 022 - .global _start - -_start: - mov 0, %fp ! Mark bottom frame pointer - ldn [%sp + (16 * CPTRSIZE) + STACK_BIAS], %l0 ! argc - add %sp, (17 * CPTRSIZE) + STACK_BIAS, %l1 ! argv - - ! Leave some room for a call. Sun leaves 32 octets (to sit on - ! a cache line?) so we do too. -#ifdef __sparcv9 - sub %sp, 48, %sp -#else - sub %sp, 32, %sp -#endif - - ! %g1 may contain a function to be registered w/atexit - orcc %g0, %g1, %g0 -#ifdef __sparcv9 - be %xcc, .nope -#else - be .nope -#endif - mov %g1, %o0 - call atexit - nop -.nope: - ! Now make sure constructors and destructors are handled. - setn(_fini, %o1, %o0) - call atexit, 1 - nop - call _init, 0 - nop - - ! We ignore the auxiliary vector; there is no defined way to - ! access those data anyway. Instead, go straight to main: - mov %l0, %o0 ! argc - mov %l1, %o1 ! argv - ! Skip argc words past argv, to env: - sll %l0, CPTRSHIFT, %o2 - add %o2, CPTRSIZE, %o2 - add %l1, %o2, %o2 ! env - setn(_environ, %o4, %o3) - stn %o2, [%o3] ! *_environ - call main, 4 - nop - call exit, 0 - nop - call _exit, 0 - nop - ! We should never get here. - - .type _start,#function - .size _start,.-_start diff --git a/contrib/gcc/config/sparc/sol2-ci.asm b/contrib/gcc/config/sparc/sol2-ci.asm deleted file mode 100644 index 3dc793c0c89c..000000000000 --- a/contrib/gcc/config/sparc/sol2-ci.asm +++ /dev/null @@ -1,68 +0,0 @@ -! crti.s for solaris 2.0. - -! Copyright (C) 1992 Free Software Foundation, Inc. -! Written By David Vinayak Henkel-Wallace, June 1992 -! -! This file 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. -! -! In addition to the permissions in the GNU General Public License, the -! Free Software Foundation gives you unlimited permission to link the -! compiled version of this file with other programs, and to distribute -! those programs without any restriction coming from the use of this -! file. (The General Public License restrictions do apply in other -! respects; for example, they cover modification of the file, and -! distribution when not linked into another program.) -! -! This file 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. -! -! You should have received a copy of the GNU General Public License -! along with this program; see the file COPYING. If not, write to -! the Free Software Foundation, 59 Temple Place - Suite 330, -! Boston, MA 02111-1307, USA. -! -! As a special exception, if you link this library with files -! compiled with GCC to produce an executable, this does not cause -! the resulting executable to be covered by the GNU General Public License. -! This exception does not however invalidate any other reasons why -! the executable file might be covered by the GNU General Public License. -! - -! This file just make a stack frame for the contents of the .fini and -! .init sections. Users may put any desired instructions in those -! sections. - -! This file is linked in before the Values-Xx.o files and also before -! crtbegin, with which perhaps it should be merged. - - .file "crti.s" - - .section ".init" - .proc 022 - .global _init - .type _init,#function - .align 4 -_init: -#ifdef __sparcv9 - save %sp, -176, %sp -#else - save %sp, -96, %sp -#endif - - - .section ".fini" - .proc 022 - .global _fini - .type _fini,#function - .align 4 -_fini: -#ifdef __sparcv9 - save %sp, -176, %sp -#else - save %sp, -96, %sp -#endif diff --git a/contrib/gcc/config/sparc/sol2-cn.asm b/contrib/gcc/config/sparc/sol2-cn.asm deleted file mode 100644 index 49e070f34f4c..000000000000 --- a/contrib/gcc/config/sparc/sol2-cn.asm +++ /dev/null @@ -1,54 +0,0 @@ -! crtn.s for solaris 2.0. - -! Copyright (C) 1992 Free Software Foundation, Inc. -! Written By David Vinayak Henkel-Wallace, June 1992 -! -! This file 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. -! -! In addition to the permissions in the GNU General Public License, the -! Free Software Foundation gives you unlimited permission to link the -! compiled version of this file with other programs, and to distribute -! those programs without any restriction coming from the use of this -! file. (The General Public License restrictions do apply in other -! respects; for example, they cover modification of the file, and -! distribution when not linked into another program.) -! -! This file 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. -! -! You should have received a copy of the GNU General Public License -! along with this program; see the file COPYING. If not, write to -! the Free Software Foundation, 59 Temple Place - Suite 330, -! Boston, MA 02111-1307, USA. -! -! As a special exception, if you link this library with files -! compiled with GCC to produce an executable, this does not cause -! the resulting executable to be covered by the GNU General Public License. -! This exception does not however invalidate any other reasons why -! the executable file might be covered by the GNU General Public License. -! - -! This file just makes sure that the .fini and .init sections do in -! fact return. Users may put any desired instructions in those sections. -! This file is the last thing linked into any executable. - - .file "crtn.s" - - .section ".init" - .align 4 - - ret - restore - - .section ".fini" - .align 4 - - ret - restore - -! Th-th-th-that is all folks! diff --git a/contrib/gcc/config/sparc/sol2-g1.asm b/contrib/gcc/config/sparc/sol2-g1.asm deleted file mode 100644 index b9d878856f8d..000000000000 --- a/contrib/gcc/config/sparc/sol2-g1.asm +++ /dev/null @@ -1,88 +0,0 @@ -! gcrt1.s for solaris 2.0. - -! Copyright (C) 1992 Free Software Foundation, Inc. -! Written By David Vinayak Henkel-Wallace, June 1992 -! -! This file 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. -! -! In addition to the permissions in the GNU General Public License, the -! Free Software Foundation gives you unlimited permission to link the -! compiled version of this file with other programs, and to distribute -! those programs without any restriction coming from the use of this -! file. (The General Public License restrictions do apply in other -! respects; for example, they cover modification of the file, and -! distribution when not linked into another program.) -! -! This file 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. -! -! You should have received a copy of the GNU General Public License -! along with this program; see the file COPYING. If not, write to -! the Free Software Foundation, 59 Temple Place - Suite 330, -! Boston, MA 02111-1307, USA. -! -! As a special exception, if you link this library with files -! compiled with GCC to produce an executable, this does not cause -! the resulting executable to be covered by the GNU General Public License. -! This exception does not however invalidate any other reasons why -! the executable file might be covered by the GNU General Public License. -! - -! This file takes control of the process from the kernel, as specified -! in section 3 of the SVr4 ABI. -! This file is the first thing linked into any executable. - - .section ".text" - .proc 022 - .global _start - -_start: - mov 0, %fp ! Mark bottom frame pointer - ld [%sp + 64], %l0 ! argc - add %sp, 68, %l1 ! argv - - ! Leave some room for a call. Sun leaves 32 octets (to sit on - ! a cache line?) so we do too. - sub %sp, 32, %sp - - ! %g1 may contain a function to be registered w/atexit - orcc %g0, %g1, %g0 - be .nope - mov %g1, %o0 - call atexit - nop -.nope: - ! Now make sure constructors and destructors are handled. - set _fini, %o0 - call atexit, 1 - nop - call _init, 0 - nop - - ! We ignore the auxiliary vector; there's no defined way to - ! access those data anyway. Instead, go straight to main: - mov %l0, %o0 ! argc - mov %l1, %o1 ! argv - set ___Argv, %o3 - st %o1, [%o3] ! *___Argv - ! Skip argc words past argv, to env: - sll %l0, 2, %o2 - add %o2, 4, %o2 - add %l1, %o2, %o2 ! env - set _environ, %o3 - st %o2, [%o3] ! *_environ - call main, 4 - nop - call exit, 0 - nop - call _exit, 0 - nop - ! We should never get here. - - .type _start,#function - .size _start,.-_start diff --git a/contrib/gcc/config/sparc/sol2-sld-64.h b/contrib/gcc/config/sparc/sol2-sld-64.h deleted file mode 100644 index c2518d8def0b..000000000000 --- a/contrib/gcc/config/sparc/sol2-sld-64.h +++ /dev/null @@ -1,363 +0,0 @@ -/* Definitions of target machine for GNU compiler, for 64-bit SPARC - running Solaris 2 using the system linker. */ - -#define SPARC_BI_ARCH - -#include "sparc/sol2.h" - -/* At least up through Solaris 2.6, - the system linker does not work with DWARF or DWARF2, - since it does not have working support for relocations - to unaligned data. */ - -#define LINKER_DOES_NOT_WORK_WITH_DWARF2 - -/* A 64 bit v9 compiler with stack-bias */ - -#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ - (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ + \ - MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU) -#endif - -/* The default code model. */ -#undef SPARC_DEFAULT_CMODEL -#define SPARC_DEFAULT_CMODEL CM_MEDANY - -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 128 - -#undef ASM_CPU32_DEFAULT_SPEC -#define ASM_CPU32_DEFAULT_SPEC "" -#undef ASM_CPU64_DEFAULT_SPEC -#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9" - -#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 -#undef CPP_CPU64_DEFAULT_SPEC -#define CPP_CPU64_DEFAULT_SPEC "" -#undef ASM_CPU32_DEFAULT_SPEC -#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus" -#endif -#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc -#undef CPP_CPU64_DEFAULT_SPEC -#define CPP_CPU64_DEFAULT_SPEC "" -#undef ASM_CPU32_DEFAULT_SPEC -#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa" -#undef ASM_CPU64_DEFAULT_SPEC -#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9a" -#endif - -/* The sun bundled assembler doesn't accept -Yd, (and neither does gas). - It's safe to pass -s always, even if -g is not used. */ -#undef ASM_SPEC -#define ASM_SPEC "\ -%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ -%{fpic:-K PIC} %{fPIC:-K PIC} \ -%(asm_cpu)\ -" - -#if DEFAULT_ARCH32_P -#define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}" -#define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}" -#else -#define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}" -#define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}" -#endif - -#undef CPP_CPU_SPEC -#define CPP_CPU_SPEC "\ -%{mcypress:} \ -%{msparclite:-D__sparclite__} \ -%{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \ -%{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \ -%{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \ -%{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \ -%{mcpu=sparclite:-D__sparclite__} \ -%{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \ -%{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \ -%{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \ -%{mcpu=v9:" DEF_ARCH32_SPEC("-D__sparcv8") "} \ -%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-D__sparcv8") "} \ -%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \ -" - -#undef ASM_CPU_SPEC -#define ASM_CPU_SPEC "\ -%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC("-xarch=v9a") "} \ -%{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC("-xarch=v9") "} \ -%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC("-xarch=v9") "}}} \ -%{!mcpu*:%(asm_cpu_default)} \ -" - -#define STARTFILE_SPEC32 "\ -%{ansi:values-Xc.o%s} \ -%{!ansi: \ - %{traditional:values-Xt.o%s} \ - %{!traditional:values-Xa.o%s}}" - -#define STARTFILE_SPEC64 "\ -%{ansi:/usr/lib/sparcv9/values-Xc.o%s} \ -%{!ansi: \ - %{traditional:/usr/lib/sparcv9/values-Xt.o%s} \ - %{!traditional:/usr/lib/sparcv9/values-Xa.o%s}}" - -#ifdef SPARC_BI_ARCH - -#if DEFAULT_ARCH32_P -#define STARTFILE_ARCH_SPEC "\ -%{m32:" STARTFILE_SPEC32 "} \ -%{m64:" STARTFILE_SPEC64 "} \ -%{!m32:%{!m64:" STARTFILE_SPEC32 "}}" -#else -#define STARTFILE_ARCH_SPEC "\ -%{m32:" STARTFILE_SPEC32 "} \ -%{m64:" STARTFILE_SPEC64 "} \ -%{!m32:%{!m64:" STARTFILE_SPEC64 "}}" -#endif - -#else /* !SPARC_BI_ARCH */ - -/* In this case we define MD_STARTFILE_PREFIX to /usr/lib/sparcv9/ */ -#define STARTFILE_ARCH_SPEC STARTFILE_SPEC32 - -#endif /* !SPARC_BI_ARCH */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared: \ - %{!symbolic: \ - %{p:mcrt1.o%s} \ - %{!p: \ - %{pg:gcrt1.o%s gmon.o%s} \ - %{!pg:crt1.o%s}}}} \ - crti.o%s" STARTFILE_ARCH_SPEC " \ - crtbegin.o%s" - -#ifdef SPARC_BI_ARCH - -#undef CPP_CPU_DEFAULT_SPEC -#define CPP_CPU_DEFAULT_SPEC \ -(DEFAULT_ARCH32_P ? "\ -%{m64:" CPP_CPU64_DEFAULT_SPEC "} \ -%{!m64:" CPP_CPU32_DEFAULT_SPEC "} \ -" : "\ -%{m32:" CPP_CPU32_DEFAULT_SPEC "} \ -%{!m32:" CPP_CPU64_DEFAULT_SPEC "} \ -") - -#undef ASM_CPU_DEFAULT_SPEC -#define ASM_CPU_DEFAULT_SPEC \ -(DEFAULT_ARCH32_P ? "\ -%{m64:" ASM_CPU64_DEFAULT_SPEC "} \ -%{!m64:" ASM_CPU32_DEFAULT_SPEC "} \ -" : "\ -%{m32:" ASM_CPU32_DEFAULT_SPEC "} \ -%{!m32:" ASM_CPU64_DEFAULT_SPEC "} \ -") - -#undef CPP_ARCH32_SPEC -#define CPP_ARCH32_SPEC "-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \ --D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)" -#undef CPP_ARCH64_SPEC -#define CPP_ARCH64_SPEC "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \ --D__arch64__ -Acpu(sparc64) -Amachine(sparcv9) -D__sparcv9" - -#undef CPP_ARCH_SPEC -#define CPP_ARCH_SPEC "\ -%{m32:%(cpp_arch32)} \ -%{m64:%(cpp_arch64)} \ -%{!m32:%{!m64:%(cpp_arch_default)}} \ -" - -#undef ASM_ARCH_SPEC -#define ASM_ARCH_SPEC "" - -#undef ASM_ARCH32_SPEC -#define ASM_ARCH32_SPEC "" - -#undef ASM_ARCH64_SPEC -#define ASM_ARCH64_SPEC "" - -#undef ASM_ARCH_DEFAULT_SPEC -#define ASM_ARCH_DEFAULT_SPEC "" - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "link_arch32", LINK_ARCH32_SPEC }, \ - { "link_arch64", LINK_ARCH64_SPEC }, \ - { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ - { "link_arch", LINK_ARCH_SPEC }, - -/* This should be the same as in svr4.h, except with -R added. */ -#define LINK_ARCH32_SPEC \ - "%{G:-G} \ - %{YP,*} \ - %{R*} \ - %{compat-bsd: \ - %{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \ - -R /usr/ucblib} \ - %{!compat-bsd: \ - %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}}" - -#define LINK_ARCH64_SPEC \ - "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \ - %{G:-G} \ - %{YP,*} \ - %{R*} \ - %{compat-bsd: \ - %{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ - %{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ - %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \ - -R /usr/ucblib} \ - %{!compat-bsd: \ - %{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ - %{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ - %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}" - -#define LINK_ARCH_SPEC "\ -%{m32:%(link_arch32)} \ -%{m64:%(link_arch64)} \ -%{!m32:%{!m64:%(link_arch_default)}} \ -" - -#define LINK_ARCH_DEFAULT_SPEC \ -(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC) - -#undef LINK_SPEC -#define LINK_SPEC \ - "%{h*} %{v:-V} \ - %{b} %{Wl,*:%*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy %{!mimpure-text:-z text}} \ - %{symbolic:-Bsymbolic -G -dy -z text} \ - %(link_arch) \ - %{Qy:} %{!Qn:-Qy}" - -#undef CC1_SPEC -#if DEFAULT_ARCH32_P -#define CC1_SPEC "\ -%{sun4:} %{target:} \ -%{mcypress:-mcpu=cypress} \ -%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ -%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ -%{m64:-mptr64 -mcpu=v9 -mstack-bias -mno-v8plus} \ -" -#else -#define CC1_SPEC "\ -%{sun4:} %{target:} \ -%{mcypress:-mcpu=cypress} \ -%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ -%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ -%{m32:-mptr32 -mcpu=cypress -mno-stack-bias} \ -%{mv8plus:-m32 -mptr32 -mcpu=cypress -mno-stack-bias} \ -" -#endif - -#if DEFAULT_ARCH32_P -#define MULTILIB_DEFAULTS { "m32" } -#else -#define MULTILIB_DEFAULTS { "m64" } -#endif - -#else /* !SPARC_BI_ARCH */ - -/* - * This should be the same as in sol2-sld.h, except with "/sparcv9" - * appended to the paths and /usr/ccs/lib is no longer necessary - */ -#undef LINK_SPEC -#define LINK_SPEC \ - "%{h*} %{v:-V} \ - %{b} %{Wl,*:%*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy %{!mimpure-text:-z text}} \ - %{symbolic:-Bsymbolic -G -dy -z text} \ - %{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \ - %{G:-G} \ - %{YP,*} \ - %{R*} \ - %{compat-bsd: \ - %{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ - %{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ - %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \ - -R /usr/ucblib} \ - %{!compat-bsd: \ - %{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ - %{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ - %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}} \ - %{Qy:} %{!Qn:-Qy}" - -#undef MD_STARTFILE_PREFIX -#define MD_STARTFILE_PREFIX "/usr/lib/sparcv9/" - -#endif /* ! SPARC_BI_ARCH */ - -/* - * Attempt to turn on access permissions for the stack. - * - * This code must be defined when compiling gcc but not when compiling - * libgcc2.a, unless we're generating code for 64 bits SPARC - * - * _SC_STACK_PROT is only defined for post 2.6, but we want this code - * to run always. 2.6 can change the stack protection but has no way to - * query it. - * - */ - -#define TRANSFER_FROM_TRAMPOLINE \ -static int need_enable_exec_stack; \ - \ -static void check_enabling(void) __attribute__ ((constructor)); \ -static void check_enabling(void) \ -{ \ - extern long sysconf(int); \ - \ - int prot = (int) sysconf(515 /*_SC_STACK_PROT */); \ - if (prot != 7) \ - need_enable_exec_stack = 1; \ -} \ - \ -void \ -__enable_execute_stack (addr) \ - void *addr; \ -{ \ - if (!need_enable_exec_stack) \ - return; \ - else { \ - long size = getpagesize (); \ - long mask = ~(size-1); \ - char *page = (char *) (((long) addr) & mask); \ - char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ - \ - /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ - if (mprotect (page, end - page, 7) < 0) \ - perror ("mprotect of trampoline code"); \ - } \ -} - -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#undef ASM_OUTPUT_CONSTRUCTOR -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", TARGET_ARCH64 ? ASM_LONGLONG : INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#undef ASM_OUTPUT_DESTRUCTOR -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", TARGET_ARCH64 ? ASM_LONGLONG : INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - diff --git a/contrib/gcc/config/sparc/sol2-sld.h b/contrib/gcc/config/sparc/sol2-sld.h deleted file mode 100644 index a82498791b90..000000000000 --- a/contrib/gcc/config/sparc/sol2-sld.h +++ /dev/null @@ -1,11 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARC running Solaris 2 - using the system linker. */ - -#include "sparc/sol2.h" - -/* At least up through Solaris 2.6, - the system linker does not work with DWARF or DWARF2, - since it does not have working support for relocations - to unaligned data. */ - -#define LINKER_DOES_NOT_WORK_WITH_DWARF2 diff --git a/contrib/gcc/config/sparc/sol2.h b/contrib/gcc/config/sparc/sol2.h deleted file mode 100644 index 9274f9d9108e..000000000000 --- a/contrib/gcc/config/sparc/sol2.h +++ /dev/null @@ -1,236 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARC running Solaris 2 - Copyright 1992, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Ron Guilmette (rfg@netcom.com). - Additional changes by David V. Henkel-Wallace (gumby@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */ -#include "sparc/sysv4.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES \ -"-Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 \ --Asystem(unix) -Asystem(svr4)" - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "\ -%{pthreads:-D_REENTRANT -D_PTHREADS} \ -%{!pthreads:%{threads:-D_REENTRANT -D_SOLARIS_THREADS}} \ -%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \ -" - -/* The sun bundled assembler doesn't accept -Yd, (and neither does gas). - It's safe to pass -s always, even if -g is not used. */ -#undef ASM_SPEC -#define ASM_SPEC "\ -%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ -%{fpic:-K PIC} %{fPIC:-K PIC} \ -%(asm_cpu) \ -" - -/* This is here rather than in sparc.h because it's not known what - other assemblers will accept. */ -#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 -#undef ASM_CPU_DEFAULT_SPEC -#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plus" -#endif -#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc -#undef ASM_CPU_DEFAULT_SPEC -#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusa" -#endif -#undef ASM_CPU_SPEC -#define ASM_CPU_SPEC "\ -%{mcpu=v8plus:-xarch=v8plus} \ -%{mcpu=ultrasparc:-xarch=v8plusa} \ -%{!mcpu*:%(asm_cpu_default)} \ -" - -/* However it appears that Solaris 2.0 uses the same reg numbering as - the old BSD-style system did. */ - -#undef DBX_REGISTER_NUMBER -/* Same as sparc.h */ -#define DBX_REGISTER_NUMBER(REGNO) \ - (TARGET_FLAT && REGNO == FRAME_POINTER_REGNUM ? 31 : REGNO) - -/* We use stabs-in-elf for debugging, because that is what the native - toolchain uses. */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* The Solaris 2 assembler uses .skip, not .zero, so put this back. */ -#undef ASM_OUTPUT_SKIP -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t.skip %u\n", (SIZE)) - -/* Use .uahalf/.uaword so packed structure members don't generate - assembler errors when using the native assembler. */ -#undef ASM_SHORT -#define ASM_SHORT ".uahalf" -#undef ASM_LONG -#define ASM_LONG ".uaword" - -/* This is how to output a definition of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d:\n", PREFIX, NUM) - -/* This is how to output a reference to an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABELREF -#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d", PREFIX, NUM) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM)) - - -/* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us. - We don't use the standard LIB_SPEC only because we don't yet support c++ */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared: \ - %{!symbolic: \ - %{p:mcrt1.o%s} \ - %{!p: \ - %{pg:gcrt1.o%s gmon.o%s} \ - %{!pg:crt1.o%s}}}} \ - crti.o%s \ - %{ansi:values-Xc.o%s} \ - %{!ansi: \ - %{traditional:values-Xt.o%s} \ - %{!traditional:values-Xa.o%s}} \ - crtbegin.o%s" - -/* ??? Note: in order for -compat-bsd to work fully, - we must somehow arrange to fixincludes /usr/ucbinclude - and put the result in $(libsubdir)/ucbinclude. */ - -#undef LIB_SPEC -#define LIB_SPEC \ - "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \ - %{!shared:\ - %{!symbolic:\ - %{pthreads:-lpthread} \ - %{!pthreads:%{threads:-lthread}} \ - -lc}}" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s crtn.o%s" - -/* This should be the same as in svr4.h, except with -R added. */ -#undef LINK_SPEC -#define LINK_SPEC \ - "%{h*} %{v:-V} \ - %{b} %{Wl,*:%*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy %{!mimpure-text:-z text}} \ - %{symbolic:-Bsymbolic -G -dy -z text} \ - %{G:-G} \ - %{YP,*} \ - %{R*} \ - %{compat-bsd: \ - %{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \ - -R /usr/ucblib} \ - %{!compat-bsd: \ - %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}} \ - %{Qy:} %{!Qn:-Qy}" - -/* This defines which switch letters take arguments. - It is as in svr4.h but with -R added. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'R' \ - || (CHAR) == 'h' \ - || (CHAR) == 'x' \ - || (CHAR) == 'z') - -/* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h. - Instead, it is enabled here, because it does work under Solaris. */ -/* Define for support of TFmode long double and REAL_ARITHMETIC. - Sparc ABI says that long double is 4 words. */ -#define LONG_DOUBLE_TYPE_SIZE 128 - -/* But indicate that it isn't supported by the hardware. */ -#define WIDEST_HARDWARE_FP_SIZE 64 - -#define STDC_0_IN_SYSTEM_HEADERS - -#define MULDI3_LIBCALL "__mul64" -#define DIVDI3_LIBCALL "__div64" -#define UDIVDI3_LIBCALL "__udiv64" -#define MODDI3_LIBCALL "__rem64" -#define UMODDI3_LIBCALL "__urem64" - -#undef INIT_SUBTARGET_OPTABS -#define INIT_SUBTARGET_OPTABS \ - fixsfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \ - TARGET_ARCH64 ? "__ftol" : "__ftoll"); \ - fixunssfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \ - TARGET_ARCH64 ? "__ftoul" : "__ftoull"); \ - fixdfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \ - TARGET_ARCH64 ? "__dtol" : "__dtoll"); \ - fixunsdfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, \ - TARGET_ARCH64 ? "__dtoul" : "__dtoull") - -/* No weird SPARC variants on Solaris */ -#undef TARGET_LIVE_G0 -#define TARGET_LIVE_G0 0 -#undef TARGET_BROKEN_SAVERESTORE -#define TARGET_BROKEN_SAVERESTORE 0 - -/* Solaris allows 64 bit out and global registers in 32 bit mode. - sparc_override_options will disable V8+ if not generating V9 code. */ -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU + MASK_V8PLUS) - -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); - diff --git a/contrib/gcc/config/sparc/sp64-aout.h b/contrib/gcc/config/sparc/sp64-aout.h deleted file mode 100644 index e3056dfbc54e..000000000000 --- a/contrib/gcc/config/sparc/sp64-aout.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARC64, a.out. - Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Doug Evans, dje@cygnus.com. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sparc/sparc.h" -#include "aoutos.h" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparc64-aout)") - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ - (MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_HARD_QUAD \ - + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU + MASK_STACK_BIAS) - -/* The only code model supported is Medium/Low. */ -#undef SPARC_DEFAULT_CMODEL -#define SPARC_DEFAULT_CMODEL CM_MEDLOW - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -Acpu(sparc) -Amachine(sparc)" diff --git a/contrib/gcc/config/sparc/sp64-elf.h b/contrib/gcc/config/sparc/sp64-elf.h deleted file mode 100644 index 4fd81c55c470..000000000000 --- a/contrib/gcc/config/sparc/sp64-elf.h +++ /dev/null @@ -1,158 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARC64, ELF. - Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - Contributed by Doug Evans, dje@cygnus.com. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* ??? We're taking the scheme of including another file and then overriding - the values we don't like a bit too far here. The alternative is to more or - less duplicate all of svr4.h, sparc/sysv4.h, and sparc/sol2.h here - (suitably cleaned up). */ - -#include "sparc/sol2.h" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparc64-elf)") - -/* A 64 bit v9 compiler in a Medium/Anywhere code model environment. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ -(MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_HARD_QUAD \ - + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU + MASK_STACK_BIAS) - -#undef SPARC_DEFAULT_CMODEL -#define SPARC_DEFAULT_CMODEL CM_EMBMEDANY - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -D__ELF__ -Acpu(sparc) -Amachine(sparc)" - -/* __svr4__ is used by the C library (FIXME) */ -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "-D__svr4__" - -#undef MD_EXEC_PREFIX -#undef MD_STARTFILE_PREFIX - -#undef ASM_SPEC -#define ASM_SPEC "\ -%{v:-V} -s %{fpic:-K PIC} %{fPIC:-K PIC} \ -%{mlittle-endian:-EL} \ -%(asm_cpu) %(asm_arch) \ -" - -/* This is taken from sol2.h. */ -#undef LINK_SPEC -#define LINK_SPEC "\ -%{v:-V} \ -%{mlittle-endian:-EL} \ -" - -/* We need something a little simpler for the embedded environment. - Profiling doesn't really work yet so we just copy the default. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "\ -%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}} \ -crtbegin.o%s \ -" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s" - -/* Use the default (for now). */ -#undef LIB_SPEC - -/* V9 chips can handle either endianness. */ -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ -{"big-endian", -MASK_LITTLE_ENDIAN, "Generate code for big endian" }, \ -{"little-endian", MASK_LITTLE_ENDIAN, "Generate code for little endian" }, - -#undef BYTES_BIG_ENDIAN -#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) - -#undef WORDS_BIG_ENDIAN -#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) - -/* ??? This should be 32 bits for v9 but what can we do? */ -#undef WCHAR_TYPE -#define WCHAR_TYPE "short unsigned int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 16 - -#undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 128 - -/* The medium/anywhere code model practically requires us to put jump tables - in the text section as gcc is unable to distinguish LABEL_REF's of jump - tables from other label refs (when we need to). */ -/* But we now defer the tables to the end of the function, so we make - this 0 to not confuse the branch shortening code. */ -#undef JUMP_TABLES_IN_TEXT_SECTION -#define JUMP_TABLES_IN_TEXT_SECTION 0 - -/* System V Release 4 uses DWARF debugging info. - GDB doesn't support 64 bit stabs yet and the desired debug format is DWARF - anyway so it is the default. */ - -#define DWARF_DEBUGGING_INFO -#define DWARF2_DEBUGGING_INFO -#define DBX_DEBUGGING_INFO - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG - -/* Stabs doesn't use this, and it confuses a simulator. */ -/* ??? Need to see what DWARF needs, if anything. */ -#undef ASM_IDENTIFY_GCC -#define ASM_IDENTIFY_GCC(FILE) - -/* Define the names of various pseudo-ops used by the Sparc/svr4 assembler. - ??? If ints are 64 bits then UNALIGNED_INT_ASM_OP (defined elsewhere) is - misnamed. These should all refer to explicit sizes (half/word/xword?), - anything other than short/int/long/etc. */ - -#define UNALIGNED_LONGLONG_ASM_OP ".uaxword" - -/* DWARF stuff. */ - -#define ASM_OUTPUT_DWARF_ADDR(FILE, LABEL) \ -do { \ - fprintf ((FILE), "\t%s\t", UNALIGNED_LONGLONG_ASM_OP); \ - assemble_name ((FILE), (LABEL)); \ - fprintf ((FILE), "\n"); \ -} while (0) - -#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, RTX) \ -do { \ - fprintf ((FILE), "\t%s\t", UNALIGNED_LONGLONG_ASM_OP); \ - output_addr_const ((FILE), (RTX)); \ - fputc ('\n', (FILE)); \ -} while (0) - -#define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE, ADDR) \ - fprintf ((FILE), "\t%s\t%s", UNALIGNED_LONGLONG_ASM_OP, (ADDR)) - -/* ??? Not sure if this should be 4 or 8 bytes. 4 works for now. */ -#define ASM_OUTPUT_DWARF_REF(FILE, LABEL) \ -do { \ - fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \ - assemble_name ((FILE), (LABEL)); \ - fprintf ((FILE), "\n"); \ -} while (0) diff --git a/contrib/gcc/config/sparc/sparc.c b/contrib/gcc/config/sparc/sparc.c deleted file mode 100644 index 45862a77bc73..000000000000 --- a/contrib/gcc/config/sparc/sparc.c +++ /dev/null @@ -1,7843 +0,0 @@ -/* Subroutines for insn-output.c for Sun SPARC. - Copyright (C) 1987, 88, 89, 92-98, 1999 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com) - 64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans, - at Cygnus Support. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "rtl.h" -#include "regs.h" -#include "hard-reg-set.h" -#include "real.h" -#include "insn-config.h" -#include "conditions.h" -#include "insn-flags.h" -#include "output.h" -#include "insn-attr.h" -#include "flags.h" -#include "expr.h" -#include "recog.h" -#include "toplev.h" - -/* 1 if the caller has placed an "unimp" insn immediately after the call. - This is used in v8 code when calling a function that returns a structure. - v9 doesn't have this. Be careful to have this test be the same as that - used on the call. */ - -#define SKIP_CALLERS_UNIMP_P \ -(!TARGET_ARCH64 && current_function_returns_struct \ - && ! integer_zerop (DECL_SIZE (DECL_RESULT (current_function_decl))) \ - && (TREE_CODE (DECL_SIZE (DECL_RESULT (current_function_decl))) \ - == INTEGER_CST)) - -/* Global variables for machine-dependent things. */ - -/* Size of frame. Need to know this to emit return insns from leaf procedures. - ACTUAL_FSIZE is set by compute_frame_size() which is called during the - reload pass. This is important as the value is later used in insn - scheduling (to see what can go in a delay slot). - APPARENT_FSIZE is the size of the stack less the register save area and less - the outgoing argument area. It is used when saving call preserved regs. */ -static int apparent_fsize; -static int actual_fsize; - -/* Save the operands last given to a compare for use when we - generate a scc or bcc insn. */ - -rtx sparc_compare_op0, sparc_compare_op1; - -/* We may need an epilogue if we spill too many registers. - If this is non-zero, then we branch here for the epilogue. */ -static rtx leaf_label; - -#ifdef LEAF_REGISTERS - -/* Vector to say how input registers are mapped to output - registers. FRAME_POINTER_REGNUM cannot be remapped by - this function to eliminate it. You must use -fomit-frame-pointer - to get that. */ -char leaf_reg_remap[] = -{ 0, 1, 2, 3, 4, 5, 6, 7, - -1, -1, -1, -1, -1, -1, 14, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - 8, 9, 10, 11, 12, 13, -1, 15, - - 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100}; - -#endif - -/* Name of where we pretend to think the frame pointer points. - Normally, this is "%fp", but if we are in a leaf procedure, - this is "%sp+something". We record "something" separately as it may be - too big for reg+constant addressing. */ - -static const char *frame_base_name; -static int frame_base_offset; - -static rtx pic_setup_code PROTO((void)); -static void sparc_init_modes PROTO((void)); -static int save_regs PROTO((FILE *, int, int, const char *, - int, int, int)); -static int restore_regs PROTO((FILE *, int, int, const char *, int, int)); -static void build_big_number PROTO((FILE *, int, const char *)); -static int function_arg_slotno PROTO((const CUMULATIVE_ARGS *, - enum machine_mode, tree, int, int, - int *, int *)); - -static int supersparc_adjust_cost PROTO((rtx, rtx, rtx, int)); -static int hypersparc_adjust_cost PROTO((rtx, rtx, rtx, int)); -static int ultrasparc_adjust_cost PROTO((rtx, rtx, rtx, int)); - -static void sparc_output_addr_vec PROTO((rtx)); -static void sparc_output_addr_diff_vec PROTO((rtx)); -static void sparc_output_deferred_case_vectors PROTO((void)); - - -#ifdef DWARF2_DEBUGGING_INFO -extern char *dwarf2out_cfi_label (); -#endif - -/* Option handling. */ - -/* Code model option as passed by user. */ -const char *sparc_cmodel_string; -/* Parsed value. */ -enum cmodel sparc_cmodel; - -/* Record alignment options as passed by user. */ -const char *sparc_align_loops_string; -const char *sparc_align_jumps_string; -const char *sparc_align_funcs_string; - -/* Parsed values, as a power of two. */ -int sparc_align_loops; -int sparc_align_jumps; -int sparc_align_funcs; - -struct sparc_cpu_select sparc_select[] = -{ - /* switch name, tune arch */ - { (char *)0, "default", 1, 1 }, - { (char *)0, "-mcpu=", 1, 1 }, - { (char *)0, "-mtune=", 1, 0 }, - { 0, 0, 0, 0 } -}; - -/* CPU type. This is set from TARGET_CPU_DEFAULT and -m{cpu,tune}=xxx. */ -enum processor_type sparc_cpu; - -/* Validate and override various options, and do some machine dependent - initialization. */ - -void -sparc_override_options () -{ - static struct code_model { - const char *name; - int value; - } cmodels[] = { - { "32", CM_32 }, - { "medlow", CM_MEDLOW }, - { "medmid", CM_MEDMID }, - { "medany", CM_MEDANY }, - { "embmedany", CM_EMBMEDANY }, - { 0, 0 } - }; - struct code_model *cmodel; - /* Map TARGET_CPU_DEFAULT to value for -m{arch,tune}=. */ - static struct cpu_default { - int cpu; - const char *name; - } cpu_default[] = { - /* There must be one entry here for each TARGET_CPU value. */ - { TARGET_CPU_sparc, "cypress" }, - { TARGET_CPU_sparclet, "tsc701" }, - { TARGET_CPU_sparclite, "f930" }, - { TARGET_CPU_v8, "v8" }, - { TARGET_CPU_hypersparc, "hypersparc" }, - { TARGET_CPU_sparclite86x, "sparclite86x" }, - { TARGET_CPU_supersparc, "supersparc" }, - { TARGET_CPU_v9, "v9" }, - { TARGET_CPU_ultrasparc, "ultrasparc" }, - { 0, 0 } - }; - struct cpu_default *def; - /* Table of values for -m{cpu,tune}=. */ - static struct cpu_table { - const char *name; - enum processor_type processor; - int disable; - int enable; - } cpu_table[] = { - { "v7", PROCESSOR_V7, MASK_ISA, 0 }, - { "cypress", PROCESSOR_CYPRESS, MASK_ISA, 0 }, - { "v8", PROCESSOR_V8, MASK_ISA, MASK_V8 }, - /* TI TMS390Z55 supersparc */ - { "supersparc", PROCESSOR_SUPERSPARC, MASK_ISA, MASK_V8 }, - { "sparclite", PROCESSOR_SPARCLITE, MASK_ISA, MASK_SPARCLITE }, - /* The Fujitsu MB86930 is the original sparclite chip, with no fpu. - The Fujitsu MB86934 is the recent sparclite chip, with an fpu. */ - { "f930", PROCESSOR_F930, MASK_ISA|MASK_FPU, MASK_SPARCLITE }, - { "f934", PROCESSOR_F934, MASK_ISA, MASK_SPARCLITE|MASK_FPU }, - { "hypersparc", PROCESSOR_HYPERSPARC, MASK_ISA, MASK_V8|MASK_FPU }, - { "sparclite86x", PROCESSOR_SPARCLITE86X, MASK_ISA|MASK_FPU, MASK_V8 }, - { "sparclet", PROCESSOR_SPARCLET, MASK_ISA, MASK_SPARCLET }, - /* TEMIC sparclet */ - { "tsc701", PROCESSOR_TSC701, MASK_ISA, MASK_SPARCLET }, - { "v9", PROCESSOR_V9, MASK_ISA, MASK_V9 }, - /* TI ultrasparc */ - { "ultrasparc", PROCESSOR_ULTRASPARC, MASK_ISA, MASK_V9 }, - { 0, 0, 0, 0 } - }; - struct cpu_table *cpu; - struct sparc_cpu_select *sel; - int fpu; - -#ifndef SPARC_BI_ARCH - /* Check for unsupported architecture size. */ - if (! TARGET_64BIT != DEFAULT_ARCH32_P) - { - error ("%s is not supported by this configuration", - DEFAULT_ARCH32_P ? "-m64" : "-m32"); - } -#endif - - /* At the moment we don't allow different pointer size and architecture */ - if (! TARGET_64BIT != ! TARGET_PTR64) - { - error ("-mptr%d not allowed on -m%d", - TARGET_PTR64 ? 64 : 32, TARGET_64BIT ? 64 : 32); - if (TARGET_64BIT) - target_flags |= MASK_PTR64; - else - target_flags &= ~MASK_PTR64; - } - - /* Code model selection. */ - sparc_cmodel = SPARC_DEFAULT_CMODEL; - -#ifdef SPARC_BI_ARCH - if (TARGET_ARCH32) - sparc_cmodel = CM_32; -#endif - - if (sparc_cmodel_string != NULL) - { - if (TARGET_ARCH64) - { - for (cmodel = &cmodels[0]; cmodel->name; cmodel++) - if (strcmp (sparc_cmodel_string, cmodel->name) == 0) - break; - if (cmodel->name == NULL) - error ("bad value (%s) for -mcmodel= switch", sparc_cmodel_string); - else - sparc_cmodel = cmodel->value; - } - else - error ("-mcmodel= is not supported on 32 bit systems"); - } - - fpu = TARGET_FPU; /* save current -mfpu status */ - - /* Set the default CPU. */ - for (def = &cpu_default[0]; def->name; ++def) - if (def->cpu == TARGET_CPU_DEFAULT) - break; - if (! def->name) - abort (); - sparc_select[0].string = def->name; - - for (sel = &sparc_select[0]; sel->name; ++sel) - { - if (sel->string) - { - for (cpu = &cpu_table[0]; cpu->name; ++cpu) - if (! strcmp (sel->string, cpu->name)) - { - if (sel->set_tune_p) - sparc_cpu = cpu->processor; - - if (sel->set_arch_p) - { - target_flags &= ~cpu->disable; - target_flags |= cpu->enable; - } - break; - } - - if (! cpu->name) - error ("bad value (%s) for %s switch", sel->string, sel->name); - } - } - - /* If -mfpu or -mno-fpu was explicitly used, don't override with - the processor default. */ - if (TARGET_FPU_SET) - target_flags = (target_flags & ~MASK_FPU) | fpu; - - /* Use the deprecated v8 insns for sparc64 in 32 bit mode. */ - if (TARGET_V9 && TARGET_ARCH32) - target_flags |= MASK_DEPRECATED_V8_INSNS; - - /* V8PLUS requires V9, makes no sense in 64 bit mode. */ - if (! TARGET_V9 || TARGET_ARCH64) - target_flags &= ~MASK_V8PLUS; - - /* Don't use stack biasing in 32 bit mode. */ - if (TARGET_ARCH32) - target_flags &= ~MASK_STACK_BIAS; - - /* Don't allow -mvis if FPU is disabled. */ - if (! TARGET_FPU) - target_flags &= ~MASK_VIS; - - /* Validate -malign-loops= value, or provide default. */ - if (sparc_align_loops_string) - { - sparc_align_loops = exact_log2 (atoi (sparc_align_loops_string)); - if (sparc_align_loops < 2 || sparc_align_loops > 7) - fatal ("-malign-loops=%s is not between 4 and 128 or is not a power of two", - sparc_align_loops_string); - } - else - { - /* ??? This relies on ASM_OUTPUT_ALIGN to not emit the alignment if - its 0. This sounds a bit kludgey. */ - sparc_align_loops = 0; - } - - /* Validate -malign-jumps= value, or provide default. */ - if (sparc_align_jumps_string) - { - sparc_align_jumps = exact_log2 (atoi (sparc_align_jumps_string)); - if (sparc_align_jumps < 2 || sparc_align_loops > 7) - fatal ("-malign-jumps=%s is not between 4 and 128 or is not a power of two", - sparc_align_jumps_string); - } - else - { - /* ??? This relies on ASM_OUTPUT_ALIGN to not emit the alignment if - its 0. This sounds a bit kludgey. */ - sparc_align_jumps = 0; - } - - /* Validate -malign-functions= value, or provide default. */ - if (sparc_align_funcs_string) - { - sparc_align_funcs = exact_log2 (atoi (sparc_align_funcs_string)); - if (sparc_align_funcs < 2 || sparc_align_loops > 7) - fatal ("-malign-functions=%s is not between 4 and 128 or is not a power of two", - sparc_align_funcs_string); - } - else - sparc_align_funcs = DEFAULT_SPARC_ALIGN_FUNCS; - - /* Validate PCC_STRUCT_RETURN. */ - if (flag_pcc_struct_return == DEFAULT_PCC_STRUCT_RETURN) - flag_pcc_struct_return = (TARGET_ARCH64 ? 0 : 1); - - /* Do various machine dependent initializations. */ - sparc_init_modes (); - - if ((profile_flag || profile_block_flag) - && sparc_cmodel != CM_MEDLOW) - { - error ("profiling does not support code models other than medlow"); - } -} - -/* Miscellaneous utilities. */ - -/* Nonzero if CODE, a comparison, is suitable for use in v9 conditional move - or branch on register contents instructions. */ - -int -v9_regcmp_p (code) - enum rtx_code code; -{ - return (code == EQ || code == NE || code == GE || code == LT - || code == LE || code == GT); -} - - -/* Operand constraints. */ - -/* Return non-zero only if OP is a register of mode MODE, - or const0_rtx. Don't allow const0_rtx if TARGET_LIVE_G0 because - %g0 may contain anything. */ - -int -reg_or_0_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - if (register_operand (op, mode)) - return 1; - if (TARGET_LIVE_G0) - return 0; - if (op == const0_rtx) - return 1; - if (GET_MODE (op) == VOIDmode && GET_CODE (op) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (op) == 0 - && CONST_DOUBLE_LOW (op) == 0) - return 1; - if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT - && GET_CODE (op) == CONST_DOUBLE - && fp_zero_operand (op)) - return 1; - return 0; -} - -/* Nonzero if OP is a floating point value with value 0.0. */ - -int -fp_zero_operand (op) - rtx op; -{ - REAL_VALUE_TYPE r; - - REAL_VALUE_FROM_CONST_DOUBLE (r, op); - return (REAL_VALUES_EQUAL (r, dconst0) && ! REAL_VALUE_MINUS_ZERO (r)); -} - -/* Nonzero if OP is an integer register. */ - -int -intreg_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (register_operand (op, SImode) - || (TARGET_ARCH64 && register_operand (op, DImode))); -} - -/* Nonzero if OP is a floating point condition code register. */ - -int -fcc_reg_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - /* This can happen when recog is called from combine. Op may be a MEM. - Fail instead of calling abort in this case. */ - if (GET_CODE (op) != REG) - return 0; - - if (mode != VOIDmode && mode != GET_MODE (op)) - return 0; - if (mode == VOIDmode - && (GET_MODE (op) != CCFPmode && GET_MODE (op) != CCFPEmode)) - return 0; - -#if 0 /* ??? ==> 1 when %fcc0-3 are pseudos first. See gen_compare_reg(). */ - if (reg_renumber == 0) - return REGNO (op) >= FIRST_PSEUDO_REGISTER; - return REGNO_OK_FOR_CCFP_P (REGNO (op)); -#else - return (unsigned) REGNO (op) - SPARC_FIRST_V9_FCC_REG < 4; -#endif -} - -/* Nonzero if OP is an integer or floating point condition code register. */ - -int -icc_or_fcc_reg_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - if (GET_CODE (op) == REG && REGNO (op) == SPARC_ICC_REG) - { - if (mode != VOIDmode && mode != GET_MODE (op)) - return 0; - if (mode == VOIDmode - && GET_MODE (op) != CCmode && GET_MODE (op) != CCXmode) - return 0; - return 1; - } - - return fcc_reg_operand (op, mode); -} - -/* Nonzero if OP can appear as the dest of a RESTORE insn. */ -int -restore_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return (GET_CODE (op) == REG && GET_MODE (op) == mode - && (REGNO (op) < 8 || (REGNO (op) >= 24 && REGNO (op) < 32))); -} - -/* Call insn on SPARC can take a PC-relative constant address, or any regular - memory address. */ - -int -call_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - if (GET_CODE (op) != MEM) - abort (); - op = XEXP (op, 0); - return (symbolic_operand (op, mode) || memory_address_p (Pmode, op)); -} - -int -call_operand_address (op, mode) - rtx op; - enum machine_mode mode; -{ - return (symbolic_operand (op, mode) || memory_address_p (Pmode, op)); -} - -/* Returns 1 if OP is either a symbol reference or a sum of a symbol - reference and a constant. */ - -int -symbolic_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - switch (GET_CODE (op)) - { - case SYMBOL_REF: - case LABEL_REF: - return 1; - - case CONST: - op = XEXP (op, 0); - return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF - || GET_CODE (XEXP (op, 0)) == LABEL_REF) - && GET_CODE (XEXP (op, 1)) == CONST_INT); - - /* ??? This clause seems to be irrelevant. */ - case CONST_DOUBLE: - return GET_MODE (op) == mode; - - default: - return 0; - } -} - -/* Return truth value of statement that OP is a symbolic memory - operand of mode MODE. */ - -int -symbolic_memory_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - if (GET_CODE (op) == SUBREG) - op = SUBREG_REG (op); - if (GET_CODE (op) != MEM) - return 0; - op = XEXP (op, 0); - return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST - || GET_CODE (op) == HIGH || GET_CODE (op) == LABEL_REF); -} - -/* Return truth value of statement that OP is a LABEL_REF of mode MODE. */ - -int -label_ref_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - if (GET_CODE (op) != LABEL_REF) - return 0; - if (GET_MODE (op) != mode) - return 0; - return 1; -} - -/* Return 1 if the operand is an argument used in generating pic references - in either the medium/low or medium/anywhere code models of sparc64. */ - -int -sp64_medium_pic_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - /* Check for (const (minus (symbol_ref:GOT) - (const (minus (label) (pc))))). */ - if (GET_CODE (op) != CONST) - return 0; - op = XEXP (op, 0); - if (GET_CODE (op) != MINUS) - return 0; - if (GET_CODE (XEXP (op, 0)) != SYMBOL_REF) - return 0; - /* ??? Ensure symbol is GOT. */ - if (GET_CODE (XEXP (op, 1)) != CONST) - return 0; - if (GET_CODE (XEXP (XEXP (op, 1), 0)) != MINUS) - return 0; - return 1; -} - -/* Return 1 if the operand is a data segment reference. This includes - the readonly data segment, or in other words anything but the text segment. - This is needed in the medium/anywhere code model on v9. These values - are accessed with EMBMEDANY_BASE_REG. */ - -int -data_segment_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - switch (GET_CODE (op)) - { - case SYMBOL_REF : - return ! SYMBOL_REF_FLAG (op); - case PLUS : - /* Assume canonical format of symbol + constant. - Fall through. */ - case CONST : - return data_segment_operand (XEXP (op, 0)); - default : - return 0; - } -} - -/* Return 1 if the operand is a text segment reference. - This is needed in the medium/anywhere code model on v9. */ - -int -text_segment_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - switch (GET_CODE (op)) - { - case LABEL_REF : - return 1; - case SYMBOL_REF : - return SYMBOL_REF_FLAG (op); - case PLUS : - /* Assume canonical format of symbol + constant. - Fall through. */ - case CONST : - return text_segment_operand (XEXP (op, 0)); - default : - return 0; - } -} - -/* Return 1 if the operand is either a register or a memory operand that is - not symbolic. */ - -int -reg_or_nonsymb_mem_operand (op, mode) - register rtx op; - enum machine_mode mode; -{ - if (register_operand (op, mode)) - return 1; - - if (memory_operand (op, mode) && ! symbolic_memory_operand (op, mode)) - return 1; - - return 0; -} - -int -splittable_symbolic_memory_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - if (GET_CODE (op) != MEM) - return 0; - if (! symbolic_operand (XEXP (op, 0), Pmode)) - return 0; - return 1; -} - -int -splittable_immediate_memory_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - if (GET_CODE (op) != MEM) - return 0; - if (! immediate_operand (XEXP (op, 0), Pmode)) - return 0; - return 1; -} - -/* Return truth value of whether OP is EQ or NE. */ - -int -eq_or_neq (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == EQ || GET_CODE (op) == NE); -} - -/* Return 1 if this is a comparison operator, but not an EQ, NE, GEU, - or LTU for non-floating-point. We handle those specially. */ - -int -normal_comp_operator (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - enum rtx_code code = GET_CODE (op); - - if (GET_RTX_CLASS (code) != '<') - return 0; - - if (GET_MODE (XEXP (op, 0)) == CCFPmode - || GET_MODE (XEXP (op, 0)) == CCFPEmode) - return 1; - - return (code != NE && code != EQ && code != GEU && code != LTU); -} - -/* Return 1 if this is a comparison operator. This allows the use of - MATCH_OPERATOR to recognize all the branch insns. */ - -int -noov_compare_op (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - enum rtx_code code = GET_CODE (op); - - if (GET_RTX_CLASS (code) != '<') - return 0; - - if (GET_MODE (XEXP (op, 0)) == CC_NOOVmode) - /* These are the only branches which work with CC_NOOVmode. */ - return (code == EQ || code == NE || code == GE || code == LT); - return 1; -} - -/* Nonzero if OP is a comparison operator suitable for use in v9 - conditional move or branch on register contents instructions. */ - -int -v9_regcmp_op (op, mode) - register rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - enum rtx_code code = GET_CODE (op); - - if (GET_RTX_CLASS (code) != '<') - return 0; - - return v9_regcmp_p (code); -} - -/* Return 1 if this is a SIGN_EXTEND or ZERO_EXTEND operation. */ - -int -extend_op (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return GET_CODE (op) == SIGN_EXTEND || GET_CODE (op) == ZERO_EXTEND; -} - -/* Return nonzero if OP is an operator of mode MODE which can set - the condition codes explicitly. We do not include PLUS and MINUS - because these require CC_NOOVmode, which we handle explicitly. */ - -int -cc_arithop (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - if (GET_CODE (op) == AND - || GET_CODE (op) == IOR - || GET_CODE (op) == XOR) - return 1; - - return 0; -} - -/* Return nonzero if OP is an operator of mode MODE which can bitwise - complement its second operand and set the condition codes explicitly. */ - -int -cc_arithopn (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - /* XOR is not here because combine canonicalizes (xor (not ...) ...) - and (xor ... (not ...)) to (not (xor ...)). */ - return (GET_CODE (op) == AND - || GET_CODE (op) == IOR); -} - -/* Return true if OP is a register, or is a CONST_INT that can fit in a - signed 13 bit immediate field. This is an acceptable SImode operand for - most 3 address instructions. */ - -int -arith_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - int val; - if (register_operand (op, mode)) - return 1; - if (GET_CODE (op) != CONST_INT) - return 0; - val = INTVAL (op) & 0xffffffff; - return SPARC_SIMM13_P (val); -} - -/* Return true if OP is a constant 4096 */ - -int -arith_4096_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - int val; - if (GET_CODE (op) != CONST_INT) - return 0; - val = INTVAL (op) & 0xffffffff; - return val == 4096; -} - -/* Return true if OP is suitable as second operand for add/sub */ - -int -arith_add_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return arith_operand (op, mode) || arith_4096_operand (op, mode); -} - -/* Return true if OP is a CONST_INT or a CONST_DOUBLE which can fit in the - immediate field of OR and XOR instructions. Used for 64-bit - constant formation patterns. */ -int -const64_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return ((GET_CODE (op) == CONST_INT - && SPARC_SIMM13_P (INTVAL (op))) -#if HOST_BITS_PER_WIDE_INT != 64 - || (GET_CODE (op) == CONST_DOUBLE - && SPARC_SIMM13_P (CONST_DOUBLE_LOW (op)) - && (CONST_DOUBLE_HIGH (op) == - ((CONST_DOUBLE_LOW (op) & 0x80000000) != 0 ? - (HOST_WIDE_INT)0xffffffff : 0))) -#endif - ); -} - -/* The same, but only for sethi instructions. */ -int -const64_high_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return ((GET_CODE (op) == CONST_INT - && (INTVAL (op) & 0xfffffc00) != 0 - && SPARC_SETHI_P (INTVAL (op)) -#if HOST_BITS_PER_WIDE_INT != 64 - /* Must be positive on non-64bit host else the - optimizer is fooled into thinking that sethi - sign extends, even though it does not. */ - && INTVAL (op) >= 0 -#endif - ) - || (GET_CODE (op) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (op) == 0 - && (CONST_DOUBLE_LOW (op) & 0xfffffc00) != 0 - && SPARC_SETHI_P (CONST_DOUBLE_LOW (op)))); -} - -/* Return true if OP is a register, or is a CONST_INT that can fit in a - signed 11 bit immediate field. This is an acceptable SImode operand for - the movcc instructions. */ - -int -arith11_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return (register_operand (op, mode) - || (GET_CODE (op) == CONST_INT && SPARC_SIMM11_P (INTVAL (op)))); -} - -/* Return true if OP is a register, or is a CONST_INT that can fit in a - signed 10 bit immediate field. This is an acceptable SImode operand for - the movrcc instructions. */ - -int -arith10_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return (register_operand (op, mode) - || (GET_CODE (op) == CONST_INT && SPARC_SIMM10_P (INTVAL (op)))); -} - -/* Return true if OP is a register, is a CONST_INT that fits in a 13 bit - immediate field, or is a CONST_DOUBLE whose both parts fit in a 13 bit - immediate field. - v9: Return true if OP is a register, or is a CONST_INT or CONST_DOUBLE that - can fit in a 13 bit immediate field. This is an acceptable DImode operand - for most 3 address instructions. */ - -int -arith_double_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return (register_operand (op, mode) - || (GET_CODE (op) == CONST_INT && SMALL_INT (op)) - || (! TARGET_ARCH64 - && GET_CODE (op) == CONST_DOUBLE - && (unsigned HOST_WIDE_INT) (CONST_DOUBLE_LOW (op) + 0x1000) < 0x2000 - && (unsigned HOST_WIDE_INT) (CONST_DOUBLE_HIGH (op) + 0x1000) < 0x2000) - || (TARGET_ARCH64 - && GET_CODE (op) == CONST_DOUBLE - && (unsigned HOST_WIDE_INT) (CONST_DOUBLE_LOW (op) + 0x1000) < 0x2000 - && ((CONST_DOUBLE_HIGH (op) == -1 - && (CONST_DOUBLE_LOW (op) & 0x1000) == 0x1000) - || (CONST_DOUBLE_HIGH (op) == 0 - && (CONST_DOUBLE_LOW (op) & 0x1000) == 0)))); -} - -/* Return true if OP is a constant 4096 for DImode on ARCH64 */ - -int -arith_double_4096_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (TARGET_ARCH64 && - ((GET_CODE (op) == CONST_INT && INTVAL (op) == 4096) || - (GET_CODE (op) == CONST_DOUBLE && - CONST_DOUBLE_LOW (op) == 4096 && - CONST_DOUBLE_HIGH (op) == 0))); -} - -/* Return true if OP is suitable as second operand for add/sub in DImode */ - -int -arith_double_add_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return arith_double_operand (op, mode) || arith_double_4096_operand (op, mode); -} - -/* Return true if OP is a register, or is a CONST_INT or CONST_DOUBLE that - can fit in an 11 bit immediate field. This is an acceptable DImode - operand for the movcc instructions. */ -/* ??? Replace with arith11_operand? */ - -int -arith11_double_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return (register_operand (op, mode) - || (GET_CODE (op) == CONST_DOUBLE - && (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) - && (unsigned HOST_WIDE_INT) (CONST_DOUBLE_LOW (op) + 0x400) < 0x800 - && ((CONST_DOUBLE_HIGH (op) == -1 - && (CONST_DOUBLE_LOW (op) & 0x400) == 0x400) - || (CONST_DOUBLE_HIGH (op) == 0 - && (CONST_DOUBLE_LOW (op) & 0x400) == 0))) - || (GET_CODE (op) == CONST_INT - && (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) - && (unsigned HOST_WIDE_INT) (INTVAL (op) + 0x400) < 0x800)); -} - -/* Return true if OP is a register, or is a CONST_INT or CONST_DOUBLE that - can fit in an 10 bit immediate field. This is an acceptable DImode - operand for the movrcc instructions. */ -/* ??? Replace with arith10_operand? */ - -int -arith10_double_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return (register_operand (op, mode) - || (GET_CODE (op) == CONST_DOUBLE - && (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) - && (unsigned) (CONST_DOUBLE_LOW (op) + 0x200) < 0x400 - && ((CONST_DOUBLE_HIGH (op) == -1 - && (CONST_DOUBLE_LOW (op) & 0x200) == 0x200) - || (CONST_DOUBLE_HIGH (op) == 0 - && (CONST_DOUBLE_LOW (op) & 0x200) == 0))) - || (GET_CODE (op) == CONST_INT - && (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) - && (unsigned HOST_WIDE_INT) (INTVAL (op) + 0x200) < 0x400)); -} - -/* Return truth value of whether OP is a integer which fits the - range constraining immediate operands in most three-address insns, - which have a 13 bit immediate field. */ - -int -small_int (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == CONST_INT && SMALL_INT (op)); -} - -int -small_int_or_double (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return ((GET_CODE (op) == CONST_INT && SMALL_INT (op)) - || (GET_CODE (op) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (op) == 0 - && SPARC_SIMM13_P (CONST_DOUBLE_LOW (op)))); -} - -/* Recognize operand values for the umul instruction. That instruction sign - extends immediate values just like all other sparc instructions, but - interprets the extended result as an unsigned number. */ - -int -uns_small_int (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ -#if HOST_BITS_PER_WIDE_INT > 32 - /* All allowed constants will fit a CONST_INT. */ - return (GET_CODE (op) == CONST_INT - && ((INTVAL (op) >= 0 && INTVAL (op) < 0x1000) - || (INTVAL (op) >= 0xFFFFF000 - && INTVAL (op) < 0x100000000))); -#else - return ((GET_CODE (op) == CONST_INT && (unsigned) INTVAL (op) < 0x1000) - || (GET_CODE (op) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (op) == 0 - && (unsigned) CONST_DOUBLE_LOW (op) - 0xFFFFF000 < 0x1000)); -#endif -} - -int -uns_arith_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - return register_operand (op, mode) || uns_small_int (op, mode); -} - -/* Return truth value of statement that OP is a call-clobbered register. */ -int -clobbered_register (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return (GET_CODE (op) == REG && call_used_regs[REGNO (op)]); -} - -/* Return 1 if OP is const0_rtx, used for TARGET_LIVE_G0 insns. */ - -int -zero_operand (op, mode) - rtx op; - enum machine_mode mode ATTRIBUTE_UNUSED; -{ - return op == const0_rtx; -} - -/* Return 1 if OP is a valid operand for the source of a move insn. */ - -int -input_operand (op, mode) - rtx op; - enum machine_mode mode; -{ - /* If both modes are non-void they must be the same. */ - if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op)) - return 0; - - /* Only a tiny bit of handling for CONSTANT_P_RTX is necessary. */ - if (GET_CODE (op) == CONST && GET_CODE (XEXP (op, 0)) == CONSTANT_P_RTX) - return 1; - - /* Allow any one instruction integer constant, and all CONST_INT - variants when we are working in DImode and !arch64. */ - if (GET_MODE_CLASS (mode) == MODE_INT - && ((GET_CODE (op) == CONST_INT - && ((SPARC_SETHI_P (INTVAL (op)) - && (! TARGET_ARCH64 - || (INTVAL (op) >= 0) - || mode == SImode)) - || SPARC_SIMM13_P (INTVAL (op)) - || (mode == DImode - && ! TARGET_ARCH64))) - || (TARGET_ARCH64 - && GET_CODE (op) == CONST_DOUBLE - && ((CONST_DOUBLE_HIGH (op) == 0 - && SPARC_SETHI_P (CONST_DOUBLE_LOW (op))) - || -#if HOST_BITS_PER_WIDE_INT == 64 - (CONST_DOUBLE_HIGH (op) == 0 - && SPARC_SIMM13_P (CONST_DOUBLE_LOW (op))) -#else - (SPARC_SIMM13_P (CONST_DOUBLE_LOW (op)) - && (((CONST_DOUBLE_LOW (op) & 0x80000000) == 0 - && CONST_DOUBLE_HIGH (op) == 0) - || (CONST_DOUBLE_HIGH (op) == -1))) -#endif - )))) - return 1; - - /* If !arch64 and this is a DImode const, allow it so that - the splits can be generated. */ - if (! TARGET_ARCH64 - && mode == DImode - && GET_CODE (op) == CONST_DOUBLE) - return 1; - - if (register_operand (op, mode)) - return 1; - - /* If this is a SUBREG, look inside so that we handle - paradoxical ones. */ - if (GET_CODE (op) == SUBREG) - op = SUBREG_REG (op); - - /* Check for valid MEM forms. */ - if (GET_CODE (op) == MEM) - { - rtx inside = XEXP (op, 0); - - if (GET_CODE (inside) == LO_SUM) - { - /* We can't allow these because all of the splits - (eventually as they trickle down into DFmode - splits) require offsettable memory references. */ - if (! TARGET_V9 - && GET_MODE (op) == TFmode) - return 0; - - return (register_operand (XEXP (inside, 0), Pmode) - && CONSTANT_P (XEXP (inside, 1))); - } - return memory_address_p (mode, inside); - } - - return 0; -} - - -/* We know it can't be done in one insn when we get here, - the movsi expander guarentees this. */ -void -sparc_emit_set_const32 (op0, op1) - rtx op0; - rtx op1; -{ - enum machine_mode mode = GET_MODE (op0); - rtx temp; - - if (GET_CODE (op1) == CONST_INT) - { - HOST_WIDE_INT value = INTVAL (op1); - - if (SPARC_SETHI_P (value) - || SPARC_SIMM13_P (value)) - abort (); - } - - /* Full 2-insn decomposition is needed. */ - if (reload_in_progress || reload_completed) - temp = op0; - else - temp = gen_reg_rtx (mode); - - if (GET_CODE (op1) == CONST_INT) - { - /* Emit them as real moves instead of a HIGH/LO_SUM, - this way CSE can see everything and reuse intermediate - values if it wants. */ - if (TARGET_ARCH64 - && HOST_BITS_PER_WIDE_INT != 64 - && (INTVAL (op1) & 0x80000000) != 0) - { - emit_insn (gen_rtx_SET (VOIDmode, - temp, - gen_rtx_CONST_DOUBLE (VOIDmode, const0_rtx, - INTVAL (op1) & 0xfffffc00, 0))); - } - else - { - emit_insn (gen_rtx_SET (VOIDmode, - temp, - GEN_INT (INTVAL (op1) & 0xfffffc00))); - } - emit_insn (gen_rtx_SET (VOIDmode, - op0, - gen_rtx_IOR (mode, - temp, - GEN_INT (INTVAL (op1) & 0x3ff)))); - } - else - { - /* A symbol, emit in the traditional way. */ - emit_insn (gen_rtx_SET (VOIDmode, - temp, - gen_rtx_HIGH (mode, - op1))); - emit_insn (gen_rtx_SET (VOIDmode, - op0, - gen_rtx_LO_SUM (mode, - temp, - op1))); - - } -} - - -/* Sparc-v9 code-model support. */ -void -sparc_emit_set_symbolic_const64 (op0, op1, temp1) - rtx op0; - rtx op1; - rtx temp1; -{ - switch (sparc_cmodel) - { - case CM_MEDLOW: - /* The range spanned by all instructions in the object is less - than 2^31 bytes (2GB) and the distance from any instruction - to the location of the label _GLOBAL_OFFSET_TABLE_ is less - than 2^31 bytes (2GB). - - The executable must be in the low 4TB of the virtual address - space. - - sethi %hi(symbol), %temp - or %temp, %lo(symbol), %reg */ - emit_insn (gen_rtx_SET (VOIDmode, temp1, gen_rtx_HIGH (DImode, op1))); - emit_insn (gen_rtx_SET (VOIDmode, op0, gen_rtx_LO_SUM (DImode, temp1, op1))); - break; - - case CM_MEDMID: - /* The range spanned by all instructions in the object is less - than 2^31 bytes (2GB) and the distance from any instruction - to the location of the label _GLOBAL_OFFSET_TABLE_ is less - than 2^31 bytes (2GB). - - The executable must be in the low 16TB of the virtual address - space. - - sethi %h44(symbol), %temp1 - or %temp1, %m44(symbol), %temp2 - sllx %temp2, 12, %temp3 - or %temp3, %l44(symbol), %reg */ - emit_insn (gen_seth44 (op0, op1)); - emit_insn (gen_setm44 (op0, op0, op1)); - emit_insn (gen_rtx_SET (VOIDmode, temp1, - gen_rtx_ASHIFT (DImode, op0, GEN_INT (12)))); - emit_insn (gen_setl44 (op0, temp1, op1)); - break; - - case CM_MEDANY: - /* The range spanned by all instructions in the object is less - than 2^31 bytes (2GB) and the distance from any instruction - to the location of the label _GLOBAL_OFFSET_TABLE_ is less - than 2^31 bytes (2GB). - - The executable can be placed anywhere in the virtual address - space. - - sethi %hh(symbol), %temp1 - sethi %lm(symbol), %temp2 - or %temp1, %hm(symbol), %temp3 - or %temp2, %lo(symbol), %temp4 - sllx %temp3, 32, %temp5 - or %temp4, %temp5, %reg */ - - /* Getting this right wrt. reloading is really tricky. - We _MUST_ have a seperate temporary at this point, - if we don't barf immediately instead of generating - incorrect code. */ - if (temp1 == op0) - abort (); - - emit_insn (gen_sethh (op0, op1)); - emit_insn (gen_setlm (temp1, op1)); - emit_insn (gen_sethm (op0, op0, op1)); - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_ASHIFT (DImode, op0, GEN_INT (32)))); - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_PLUS (DImode, op0, temp1))); - emit_insn (gen_setlo (op0, op0, op1)); - break; - - case CM_EMBMEDANY: - /* Old old old backwards compatibility kruft here. - Essentially it is MEDLOW with a fixed 64-bit - virtual base added to all data segment addresses. - Text-segment stuff is computed like MEDANY, we can't - reuse the code above because the relocation knobs - look different. - - Data segment: sethi %hi(symbol), %temp1 - or %temp1, %lo(symbol), %temp2 - add %temp2, EMBMEDANY_BASE_REG, %reg - - Text segment: sethi %uhi(symbol), %temp1 - sethi %hi(symbol), %temp2 - or %temp1, %ulo(symbol), %temp3 - or %temp2, %lo(symbol), %temp4 - sllx %temp3, 32, %temp5 - or %temp4, %temp5, %reg */ - if (data_segment_operand (op1, GET_MODE (op1))) - { - emit_insn (gen_embmedany_sethi (temp1, op1)); - emit_insn (gen_embmedany_brsum (op0, temp1)); - emit_insn (gen_embmedany_losum (op0, op0, op1)); - } - else - { - /* Getting this right wrt. reloading is really tricky. - We _MUST_ have a seperate temporary at this point, - so we barf immediately instead of generating - incorrect code. */ - if (temp1 == op0) - abort (); - - emit_insn (gen_embmedany_textuhi (op0, op1)); - emit_insn (gen_embmedany_texthi (temp1, op1)); - emit_insn (gen_embmedany_textulo (op0, op0, op1)); - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_ASHIFT (DImode, op0, GEN_INT (32)))); - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_PLUS (DImode, op0, temp1))); - emit_insn (gen_embmedany_textlo (op0, op0, op1)); - } - break; - - default: - abort(); - } -} - -/* These avoid problems when cross compiling. If we do not - go through all this hair then the optimizer will see - invalid REG_EQUAL notes or in some cases none at all. */ -static void sparc_emit_set_safe_HIGH64 PROTO ((rtx, HOST_WIDE_INT)); -static rtx gen_safe_SET64 PROTO ((rtx, HOST_WIDE_INT)); -static rtx gen_safe_OR64 PROTO ((rtx, HOST_WIDE_INT)); -static rtx gen_safe_XOR64 PROTO ((rtx, HOST_WIDE_INT)); - -#if HOST_BITS_PER_WIDE_INT == 64 -#define GEN_HIGHINT64(__x) GEN_INT ((__x) & 0xfffffc00) -#define GEN_INT64(__x) GEN_INT (__x) -#else -#define GEN_HIGHINT64(__x) \ - gen_rtx_CONST_DOUBLE (VOIDmode, const0_rtx, \ - (__x) & 0xfffffc00, 0) -#define GEN_INT64(__x) \ - gen_rtx_CONST_DOUBLE (VOIDmode, const0_rtx, \ - (__x) & 0xffffffff, \ - ((__x) & 0x80000000 \ - ? 0xffffffff : 0)) -#endif - -/* The optimizer is not to assume anything about exactly - which bits are set for a HIGH, they are unspecified. - Unfortunately this leads to many missed optimizations - during CSE. We mask out the non-HIGH bits, and matches - a plain movdi, to alleviate this problem. */ -static void -sparc_emit_set_safe_HIGH64 (dest, val) - rtx dest; - HOST_WIDE_INT val; -{ - emit_insn (gen_rtx_SET (VOIDmode, dest, GEN_HIGHINT64 (val))); -} - -static rtx -gen_safe_SET64 (dest, val) - rtx dest; - HOST_WIDE_INT val; -{ - return gen_rtx_SET (VOIDmode, dest, GEN_INT64 (val)); -} - -static rtx -gen_safe_OR64 (src, val) - rtx src; - HOST_WIDE_INT val; -{ - return gen_rtx_IOR (DImode, src, GEN_INT64 (val)); -} - -static rtx -gen_safe_XOR64 (src, val) - rtx src; - HOST_WIDE_INT val; -{ - return gen_rtx_XOR (DImode, src, GEN_INT64 (val)); -} - -/* Worker routines for 64-bit constant formation on arch64. - One of the key things to be doing in these emissions is - to create as many temp REGs as possible. This makes it - possible for half-built constants to be used later when - such values are similar to something required later on. - Without doing this, the optimizer cannot see such - opportunities. */ - -static void sparc_emit_set_const64_quick1 - PROTO((rtx, rtx, unsigned HOST_WIDE_INT, int)); - -static void -sparc_emit_set_const64_quick1 (op0, temp, low_bits, is_neg) - rtx op0; - rtx temp; - unsigned HOST_WIDE_INT low_bits; - int is_neg; -{ - unsigned HOST_WIDE_INT high_bits; - - if (is_neg) - high_bits = (~low_bits) & 0xffffffff; - else - high_bits = low_bits; - - sparc_emit_set_safe_HIGH64 (temp, high_bits); - if (!is_neg) - { - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_safe_OR64 (temp, (high_bits & 0x3ff)))); - } - else - { - /* If we are XOR'ing with -1, then we should emit a one's complement - instead. This way the combiner will notice logical operations - such as ANDN later on and substitute. */ - if ((low_bits & 0x3ff) == 0x3ff) - { - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_NOT (DImode, temp))); - } - else - { - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_safe_XOR64 (temp, - (-0x400 | (low_bits & 0x3ff))))); - } - } -} - -static void sparc_emit_set_const64_quick2 - PROTO((rtx, rtx, unsigned HOST_WIDE_INT, - unsigned HOST_WIDE_INT, int)); - -static void -sparc_emit_set_const64_quick2 (op0, temp, high_bits, low_immediate, shift_count) - rtx op0; - rtx temp; - unsigned HOST_WIDE_INT high_bits; - unsigned HOST_WIDE_INT low_immediate; - int shift_count; -{ - rtx temp2 = op0; - - if ((high_bits & 0xfffffc00) != 0) - { - sparc_emit_set_safe_HIGH64 (temp, high_bits); - if ((high_bits & ~0xfffffc00) != 0) - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_safe_OR64 (temp, (high_bits & 0x3ff)))); - else - temp2 = temp; - } - else - { - emit_insn (gen_safe_SET64 (temp, high_bits)); - temp2 = temp; - } - - /* Now shift it up into place. */ - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_ASHIFT (DImode, temp2, - GEN_INT (shift_count)))); - - /* If there is a low immediate part piece, finish up by - putting that in as well. */ - if (low_immediate != 0) - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_safe_OR64 (op0, low_immediate))); -} - -static void sparc_emit_set_const64_longway - PROTO((rtx, rtx, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT)); - -/* Full 64-bit constant decomposition. Even though this is the - 'worst' case, we still optimize a few things away. */ -static void -sparc_emit_set_const64_longway (op0, temp, high_bits, low_bits) - rtx op0; - rtx temp; - unsigned HOST_WIDE_INT high_bits; - unsigned HOST_WIDE_INT low_bits; -{ - rtx sub_temp; - - if (reload_in_progress || reload_completed) - sub_temp = op0; - else - sub_temp = gen_reg_rtx (DImode); - - if ((high_bits & 0xfffffc00) != 0) - { - sparc_emit_set_safe_HIGH64 (temp, high_bits); - if ((high_bits & ~0xfffffc00) != 0) - emit_insn (gen_rtx_SET (VOIDmode, - sub_temp, - gen_safe_OR64 (temp, (high_bits & 0x3ff)))); - else - sub_temp = temp; - } - else - { - emit_insn (gen_safe_SET64 (temp, high_bits)); - sub_temp = temp; - } - - if (!reload_in_progress && !reload_completed) - { - rtx temp2 = gen_reg_rtx (DImode); - rtx temp3 = gen_reg_rtx (DImode); - rtx temp4 = gen_reg_rtx (DImode); - - emit_insn (gen_rtx_SET (VOIDmode, temp4, - gen_rtx_ASHIFT (DImode, sub_temp, - GEN_INT (32)))); - - sparc_emit_set_safe_HIGH64 (temp2, low_bits); - if ((low_bits & ~0xfffffc00) != 0) - { - emit_insn (gen_rtx_SET (VOIDmode, temp3, - gen_safe_OR64 (temp2, (low_bits & 0x3ff)))); - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_PLUS (DImode, temp4, temp3))); - } - else - { - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_PLUS (DImode, temp4, temp2))); - } - } - else - { - rtx low1 = GEN_INT ((low_bits >> (32 - 12)) & 0xfff); - rtx low2 = GEN_INT ((low_bits >> (32 - 12 - 12)) & 0xfff); - rtx low3 = GEN_INT ((low_bits >> (32 - 12 - 12 - 8)) & 0x0ff); - int to_shift = 12; - - /* We are in the middle of reload, so this is really - painful. However we do still make an attempt to - avoid emitting truly stupid code. */ - if (low1 != const0_rtx) - { - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_ASHIFT (DImode, sub_temp, - GEN_INT (to_shift)))); - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_IOR (DImode, op0, low1))); - sub_temp = op0; - to_shift = 12; - } - else - { - to_shift += 12; - } - if (low2 != const0_rtx) - { - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_ASHIFT (DImode, sub_temp, - GEN_INT (to_shift)))); - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_IOR (DImode, op0, low2))); - sub_temp = op0; - to_shift = 8; - } - else - { - to_shift += 8; - } - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_ASHIFT (DImode, sub_temp, - GEN_INT (to_shift)))); - if (low3 != const0_rtx) - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_IOR (DImode, op0, low3))); - /* phew... */ - } -} - -/* Analyze a 64-bit constant for certain properties. */ -static void analyze_64bit_constant - PROTO((unsigned HOST_WIDE_INT, - unsigned HOST_WIDE_INT, - int *, int *, int *)); - -static void -analyze_64bit_constant (high_bits, low_bits, hbsp, lbsp, abbasp) - unsigned HOST_WIDE_INT high_bits, low_bits; - int *hbsp, *lbsp, *abbasp; -{ - int lowest_bit_set, highest_bit_set, all_bits_between_are_set; - int i; - - lowest_bit_set = highest_bit_set = -1; - i = 0; - do - { - if ((lowest_bit_set == -1) - && ((low_bits >> i) & 1)) - lowest_bit_set = i; - if ((highest_bit_set == -1) - && ((high_bits >> (32 - i - 1)) & 1)) - highest_bit_set = (64 - i - 1); - } - while (++i < 32 - && ((highest_bit_set == -1) - || (lowest_bit_set == -1))); - if (i == 32) - { - i = 0; - do - { - if ((lowest_bit_set == -1) - && ((high_bits >> i) & 1)) - lowest_bit_set = i + 32; - if ((highest_bit_set == -1) - && ((low_bits >> (32 - i - 1)) & 1)) - highest_bit_set = 32 - i - 1; - } - while (++i < 32 - && ((highest_bit_set == -1) - || (lowest_bit_set == -1))); - } - /* If there are no bits set this should have gone out - as one instruction! */ - if (lowest_bit_set == -1 - || highest_bit_set == -1) - abort (); - all_bits_between_are_set = 1; - for (i = lowest_bit_set; i <= highest_bit_set; i++) - { - if (i < 32) - { - if ((low_bits & (1 << i)) != 0) - continue; - } - else - { - if ((high_bits & (1 << (i - 32))) != 0) - continue; - } - all_bits_between_are_set = 0; - break; - } - *hbsp = highest_bit_set; - *lbsp = lowest_bit_set; - *abbasp = all_bits_between_are_set; -} - -static int const64_is_2insns - PROTO((unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT)); - -static int -const64_is_2insns (high_bits, low_bits) - unsigned HOST_WIDE_INT high_bits, low_bits; -{ - int highest_bit_set, lowest_bit_set, all_bits_between_are_set; - - if (high_bits == 0 - || high_bits == 0xffffffff) - return 1; - - analyze_64bit_constant (high_bits, low_bits, - &highest_bit_set, &lowest_bit_set, - &all_bits_between_are_set); - - if ((highest_bit_set == 63 - || lowest_bit_set == 0) - && all_bits_between_are_set != 0) - return 1; - - if ((highest_bit_set - lowest_bit_set) < 21) - return 1; - - return 0; -} - -static unsigned HOST_WIDE_INT create_simple_focus_bits - PROTO((unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT, - int, int)); - -static unsigned HOST_WIDE_INT -create_simple_focus_bits (high_bits, low_bits, lowest_bit_set, shift) - unsigned HOST_WIDE_INT high_bits, low_bits; - int lowest_bit_set, shift; -{ - HOST_WIDE_INT hi, lo; - - if (lowest_bit_set < 32) - { - lo = (low_bits >> lowest_bit_set) << shift; - hi = ((high_bits << (32 - lowest_bit_set)) << shift); - } - else - { - lo = 0; - hi = ((high_bits >> (lowest_bit_set - 32)) << shift); - } - if (hi & lo) - abort (); - return (hi | lo); -} - -/* Here we are sure to be arch64 and this is an integer constant - being loaded into a register. Emit the most efficient - insn sequence possible. Detection of all the 1-insn cases - has been done already. */ -void -sparc_emit_set_const64 (op0, op1) - rtx op0; - rtx op1; -{ - unsigned HOST_WIDE_INT high_bits, low_bits; - int lowest_bit_set, highest_bit_set; - int all_bits_between_are_set; - rtx temp; - - /* Sanity check that we know what we are working with. */ - if (! TARGET_ARCH64 - || GET_CODE (op0) != REG - || (REGNO (op0) >= SPARC_FIRST_FP_REG - && REGNO (op0) <= SPARC_LAST_V9_FP_REG)) - abort (); - - if (reload_in_progress || reload_completed) - temp = op0; - else - temp = gen_reg_rtx (DImode); - - if (GET_CODE (op1) != CONST_DOUBLE - && GET_CODE (op1) != CONST_INT) - { - sparc_emit_set_symbolic_const64 (op0, op1, temp); - return; - } - - if (GET_CODE (op1) == CONST_DOUBLE) - { -#if HOST_BITS_PER_WIDE_INT == 64 - high_bits = (CONST_DOUBLE_LOW (op1) >> 32) & 0xffffffff; - low_bits = CONST_DOUBLE_LOW (op1) & 0xffffffff; -#else - high_bits = CONST_DOUBLE_HIGH (op1); - low_bits = CONST_DOUBLE_LOW (op1); -#endif - } - else - { -#if HOST_BITS_PER_WIDE_INT == 64 - high_bits = ((INTVAL (op1) >> 32) & 0xffffffff); - low_bits = (INTVAL (op1) & 0xffffffff); -#else - high_bits = ((INTVAL (op1) < 0) ? - 0xffffffff : - 0x00000000); - low_bits = INTVAL (op1); -#endif - } - - /* low_bits bits 0 --> 31 - high_bits bits 32 --> 63 */ - - analyze_64bit_constant (high_bits, low_bits, - &highest_bit_set, &lowest_bit_set, - &all_bits_between_are_set); - - /* First try for a 2-insn sequence. */ - - /* These situations are preferred because the optimizer can - * do more things with them: - * 1) mov -1, %reg - * sllx %reg, shift, %reg - * 2) mov -1, %reg - * srlx %reg, shift, %reg - * 3) mov some_small_const, %reg - * sllx %reg, shift, %reg - */ - if (((highest_bit_set == 63 - || lowest_bit_set == 0) - && all_bits_between_are_set != 0) - || ((highest_bit_set - lowest_bit_set) < 12)) - { - HOST_WIDE_INT the_const = -1; - int shift = lowest_bit_set; - - if ((highest_bit_set != 63 - && lowest_bit_set != 0) - || all_bits_between_are_set == 0) - { - the_const = - create_simple_focus_bits (high_bits, low_bits, - lowest_bit_set, 0); - } - else if (lowest_bit_set == 0) - shift = -(63 - highest_bit_set); - - if (! SPARC_SIMM13_P (the_const)) - abort (); - - emit_insn (gen_safe_SET64 (temp, the_const)); - if (shift > 0) - emit_insn (gen_rtx_SET (VOIDmode, - op0, - gen_rtx_ASHIFT (DImode, - temp, - GEN_INT (shift)))); - else if (shift < 0) - emit_insn (gen_rtx_SET (VOIDmode, - op0, - gen_rtx_LSHIFTRT (DImode, - temp, - GEN_INT (-shift)))); - else - abort (); - return; - } - - /* Now a range of 22 or less bits set somewhere. - * 1) sethi %hi(focus_bits), %reg - * sllx %reg, shift, %reg - * 2) sethi %hi(focus_bits), %reg - * srlx %reg, shift, %reg - */ - if ((highest_bit_set - lowest_bit_set) < 21) - { - unsigned HOST_WIDE_INT focus_bits = - create_simple_focus_bits (high_bits, low_bits, - lowest_bit_set, 10); - - if (! SPARC_SETHI_P (focus_bits)) - abort (); - - sparc_emit_set_safe_HIGH64 (temp, focus_bits); - - /* If lowest_bit_set == 10 then a sethi alone could have done it. */ - if (lowest_bit_set < 10) - emit_insn (gen_rtx_SET (VOIDmode, - op0, - gen_rtx_LSHIFTRT (DImode, temp, - GEN_INT (10 - lowest_bit_set)))); - else if (lowest_bit_set > 10) - emit_insn (gen_rtx_SET (VOIDmode, - op0, - gen_rtx_ASHIFT (DImode, temp, - GEN_INT (lowest_bit_set - 10)))); - else - abort (); - return; - } - - /* 1) sethi %hi(low_bits), %reg - * or %reg, %lo(low_bits), %reg - * 2) sethi %hi(~low_bits), %reg - * xor %reg, %lo(-0x400 | (low_bits & 0x3ff)), %reg - */ - if (high_bits == 0 - || high_bits == 0xffffffff) - { - sparc_emit_set_const64_quick1 (op0, temp, low_bits, - (high_bits == 0xffffffff)); - return; - } - - /* Now, try 3-insn sequences. */ - - /* 1) sethi %hi(high_bits), %reg - * or %reg, %lo(high_bits), %reg - * sllx %reg, 32, %reg - */ - if (low_bits == 0) - { - sparc_emit_set_const64_quick2 (op0, temp, high_bits, 0, 32); - return; - } - - /* We may be able to do something quick - when the constant is negated, so try that. */ - if (const64_is_2insns ((~high_bits) & 0xffffffff, - (~low_bits) & 0xfffffc00)) - { - /* NOTE: The trailing bits get XOR'd so we need the - non-negated bits, not the negated ones. */ - unsigned HOST_WIDE_INT trailing_bits = low_bits & 0x3ff; - - if ((((~high_bits) & 0xffffffff) == 0 - && ((~low_bits) & 0x80000000) == 0) - || (((~high_bits) & 0xffffffff) == 0xffffffff - && ((~low_bits) & 0x80000000) != 0)) - { - int fast_int = (~low_bits & 0xffffffff); - - if ((SPARC_SETHI_P (fast_int) - && (~high_bits & 0xffffffff) == 0) - || SPARC_SIMM13_P (fast_int)) - emit_insn (gen_safe_SET64 (temp, fast_int)); - else - sparc_emit_set_const64 (temp, GEN_INT64 (fast_int)); - } - else - { - rtx negated_const; -#if HOST_BITS_PER_WIDE_INT == 64 - negated_const = GEN_INT (((~low_bits) & 0xfffffc00) | - (((HOST_WIDE_INT)((~high_bits) & 0xffffffff))<<32)); -#else - negated_const = gen_rtx_CONST_DOUBLE (DImode, const0_rtx, - (~low_bits) & 0xfffffc00, - (~high_bits) & 0xffffffff); -#endif - sparc_emit_set_const64 (temp, negated_const); - } - - /* If we are XOR'ing with -1, then we should emit a one's complement - instead. This way the combiner will notice logical operations - such as ANDN later on and substitute. */ - if (trailing_bits == 0x3ff) - { - emit_insn (gen_rtx_SET (VOIDmode, op0, - gen_rtx_NOT (DImode, temp))); - } - else - { - emit_insn (gen_rtx_SET (VOIDmode, - op0, - gen_safe_XOR64 (temp, - (-0x400 | trailing_bits)))); - } - return; - } - - /* 1) sethi %hi(xxx), %reg - * or %reg, %lo(xxx), %reg - * sllx %reg, yyy, %reg - * - * ??? This is just a generalized version of the low_bits==0 - * thing above, FIXME... - */ - if ((highest_bit_set - lowest_bit_set) < 32) - { - unsigned HOST_WIDE_INT focus_bits = - create_simple_focus_bits (high_bits, low_bits, - lowest_bit_set, 0); - - /* We can't get here in this state. */ - if (highest_bit_set < 32 - || lowest_bit_set >= 32) - abort (); - - /* So what we know is that the set bits straddle the - middle of the 64-bit word. */ - sparc_emit_set_const64_quick2 (op0, temp, - focus_bits, 0, - lowest_bit_set); - return; - } - - /* 1) sethi %hi(high_bits), %reg - * or %reg, %lo(high_bits), %reg - * sllx %reg, 32, %reg - * or %reg, low_bits, %reg - */ - if (SPARC_SIMM13_P(low_bits) - && ((int)low_bits > 0)) - { - sparc_emit_set_const64_quick2 (op0, temp, high_bits, low_bits, 32); - return; - } - - /* The easiest way when all else fails, is full decomposition. */ -#if 0 - printf ("sparc_emit_set_const64: Hard constant [%08lx%08lx] neg[%08lx%08lx]\n", - high_bits, low_bits, ~high_bits, ~low_bits); -#endif - sparc_emit_set_const64_longway (op0, temp, high_bits, low_bits); -} - -/* X and Y are two things to compare using CODE. Emit the compare insn and - return the rtx for the cc reg in the proper mode. */ - -rtx -gen_compare_reg (code, x, y) - enum rtx_code code; - rtx x, y; -{ - enum machine_mode mode = SELECT_CC_MODE (code, x, y); - rtx cc_reg; - - /* ??? We don't have movcc patterns so we cannot generate pseudo regs for the - fcc regs (cse can't tell they're really call clobbered regs and will - remove a duplicate comparison even if there is an intervening function - call - it will then try to reload the cc reg via an int reg which is why - we need the movcc patterns). It is possible to provide the movcc - patterns by using the ldxfsr/stxfsr v9 insns. I tried it: you need two - registers (say %g1,%g5) and it takes about 6 insns. A better fix would be - to tell cse that CCFPE mode registers (even pseudos) are call - clobbered. */ - - /* ??? This is an experiment. Rather than making changes to cse which may - or may not be easy/clean, we do our own cse. This is possible because - we will generate hard registers. Cse knows they're call clobbered (it - doesn't know the same thing about pseudos). If we guess wrong, no big - deal, but if we win, great! */ - - if (TARGET_V9 && GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) -#if 1 /* experiment */ - { - int reg; - /* We cycle through the registers to ensure they're all exercised. */ - static int next_fcc_reg = 0; - /* Previous x,y for each fcc reg. */ - static rtx prev_args[4][2]; - - /* Scan prev_args for x,y. */ - for (reg = 0; reg < 4; reg++) - if (prev_args[reg][0] == x && prev_args[reg][1] == y) - break; - if (reg == 4) - { - reg = next_fcc_reg; - prev_args[reg][0] = x; - prev_args[reg][1] = y; - next_fcc_reg = (next_fcc_reg + 1) & 3; - } - cc_reg = gen_rtx_REG (mode, reg + SPARC_FIRST_V9_FCC_REG); - } -#else - cc_reg = gen_reg_rtx (mode); -#endif /* ! experiment */ - else if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) - cc_reg = gen_rtx_REG (mode, SPARC_FCC_REG); - else - cc_reg = gen_rtx_REG (mode, SPARC_ICC_REG); - - emit_insn (gen_rtx_SET (VOIDmode, cc_reg, - gen_rtx_COMPARE (mode, x, y))); - - return cc_reg; -} - -/* This function is used for v9 only. - CODE is the code for an Scc's comparison. - OPERANDS[0] is the target of the Scc insn. - OPERANDS[1] is the value we compare against const0_rtx (which hasn't - been generated yet). - - This function is needed to turn - - (set (reg:SI 110) - (gt (reg:CCX 100 %icc) - (const_int 0))) - into - (set (reg:SI 110) - (gt:DI (reg:CCX 100 %icc) - (const_int 0))) - - IE: The instruction recognizer needs to see the mode of the comparison to - find the right instruction. We could use "gt:DI" right in the - define_expand, but leaving it out allows us to handle DI, SI, etc. - - We refer to the global sparc compare operands sparc_compare_op0 and - sparc_compare_op1. */ - -int -gen_v9_scc (compare_code, operands) - enum rtx_code compare_code; - register rtx *operands; -{ - rtx temp, op0, op1; - - if (! TARGET_ARCH64 - && (GET_MODE (sparc_compare_op0) == DImode - || GET_MODE (operands[0]) == DImode)) - return 0; - - /* Handle the case where operands[0] == sparc_compare_op0. - We "early clobber" the result. */ - if (REGNO (operands[0]) == REGNO (sparc_compare_op0)) - { - op0 = gen_reg_rtx (GET_MODE (sparc_compare_op0)); - emit_move_insn (op0, sparc_compare_op0); - } - else - op0 = sparc_compare_op0; - /* For consistency in the following. */ - op1 = sparc_compare_op1; - - /* Try to use the movrCC insns. */ - if (TARGET_ARCH64 - && GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT - && op1 == const0_rtx - && v9_regcmp_p (compare_code)) - { - /* Special case for op0 != 0. This can be done with one instruction if - operands[0] == sparc_compare_op0. We don't assume they are equal - now though. */ - - if (compare_code == NE - && GET_MODE (operands[0]) == DImode - && GET_MODE (op0) == DImode) - { - emit_insn (gen_rtx_SET (VOIDmode, operands[0], op0)); - emit_insn (gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_IF_THEN_ELSE (DImode, - gen_rtx_fmt_ee (compare_code, DImode, - op0, const0_rtx), - const1_rtx, - operands[0]))); - return 1; - } - - emit_insn (gen_rtx_SET (VOIDmode, operands[0], const0_rtx)); - if (GET_MODE (op0) != DImode) - { - temp = gen_reg_rtx (DImode); - convert_move (temp, op0, 0); - } - else - temp = op0; - emit_insn (gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_IF_THEN_ELSE (GET_MODE (operands[0]), - gen_rtx_fmt_ee (compare_code, DImode, - temp, const0_rtx), - const1_rtx, - operands[0]))); - return 1; - } - else - { - operands[1] = gen_compare_reg (compare_code, op0, op1); - - switch (GET_MODE (operands[1])) - { - case CCmode : - case CCXmode : - case CCFPEmode : - case CCFPmode : - break; - default : - abort (); - } - emit_insn (gen_rtx_SET (VOIDmode, operands[0], const0_rtx)); - emit_insn (gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_IF_THEN_ELSE (GET_MODE (operands[0]), - gen_rtx_fmt_ee (compare_code, - GET_MODE (operands[1]), - operands[1], const0_rtx), - const1_rtx, operands[0]))); - return 1; - } -} - -/* Emit a conditional jump insn for the v9 architecture using comparison code - CODE and jump target LABEL. - This function exists to take advantage of the v9 brxx insns. */ - -void -emit_v9_brxx_insn (code, op0, label) - enum rtx_code code; - rtx op0, label; -{ - emit_jump_insn (gen_rtx_SET (VOIDmode, - pc_rtx, - gen_rtx_IF_THEN_ELSE (VOIDmode, - gen_rtx_fmt_ee (code, GET_MODE (op0), - op0, const0_rtx), - gen_rtx_LABEL_REF (VOIDmode, label), - pc_rtx))); -} - -/* Return nonzero if a return peephole merging return with - setting of output register is ok. */ -int -leaf_return_peephole_ok () -{ - return (actual_fsize == 0); -} - -/* Return nonzero if TRIAL can go into the function epilogue's - delay slot. SLOT is the slot we are trying to fill. */ - -int -eligible_for_epilogue_delay (trial, slot) - rtx trial; - int slot; -{ - rtx pat, src; - - if (slot >= 1) - return 0; - - if (GET_CODE (trial) != INSN || GET_CODE (PATTERN (trial)) != SET) - return 0; - - if (get_attr_length (trial) != 1) - return 0; - - /* If %g0 is live, there are lots of things we can't handle. - Rather than trying to find them all now, let's punt and only - optimize things as necessary. */ - if (TARGET_LIVE_G0) - return 0; - - /* In the case of a true leaf function, anything can go into the delay slot. - A delay slot only exists however if the frame size is zero, otherwise - we will put an insn to adjust the stack after the return. */ - if (current_function_uses_only_leaf_regs) - { - if (leaf_return_peephole_ok ()) - return ((get_attr_in_uncond_branch_delay (trial) - == IN_BRANCH_DELAY_TRUE)); - return 0; - } - - /* If only trivial `restore' insns work, nothing can go in the - delay slot. */ - else if (TARGET_BROKEN_SAVERESTORE) - return 0; - - pat = PATTERN (trial); - - /* Otherwise, only operations which can be done in tandem with - a `restore' insn can go into the delay slot. */ - if (GET_CODE (SET_DEST (pat)) != REG - || REGNO (SET_DEST (pat)) >= 32 - || REGNO (SET_DEST (pat)) < 24) - return 0; - - /* The set of insns matched here must agree precisely with the set of - patterns paired with a RETURN in sparc.md. */ - - src = SET_SRC (pat); - - /* This matches "*return_[qhs]i" or even "*return_di" on TARGET_ARCH64. */ - if (arith_operand (src, GET_MODE (src))) - { - if (TARGET_ARCH64) - return GET_MODE_SIZE (GET_MODE (src)) <= GET_MODE_SIZE (DImode); - else - return GET_MODE_SIZE (GET_MODE (src)) <= GET_MODE_SIZE (SImode); - } - - /* This matches "*return_di". */ - else if (arith_double_operand (src, GET_MODE (src))) - return GET_MODE_SIZE (GET_MODE (src)) <= GET_MODE_SIZE (DImode); - - /* This matches "*return_sf_no_fpu". */ - else if (! TARGET_FPU && restore_operand (SET_DEST (pat), SFmode) - && register_operand (src, SFmode)) - return 1; - - /* This matches "*return_addsi". */ - else if (GET_CODE (src) == PLUS - && arith_operand (XEXP (src, 0), SImode) - && arith_operand (XEXP (src, 1), SImode) - && (register_operand (XEXP (src, 0), SImode) - || register_operand (XEXP (src, 1), SImode))) - return 1; - - /* This matches "*return_adddi". */ - else if (GET_CODE (src) == PLUS - && arith_double_operand (XEXP (src, 0), DImode) - && arith_double_operand (XEXP (src, 1), DImode) - && (register_operand (XEXP (src, 0), DImode) - || register_operand (XEXP (src, 1), DImode))) - return 1; - - return 0; -} - -static int -check_return_regs (x) - rtx x; -{ - switch (GET_CODE (x)) - { - case REG: - return IN_OR_GLOBAL_P (x); - - case CONST_INT: - case CONST_DOUBLE: - case CONST: - case SYMBOL_REF: - case LABEL_REF: - return 1; - - case SET: - case IOR: - case AND: - case XOR: - case PLUS: - case MINUS: - if (check_return_regs (XEXP (x, 1)) == 0) - return 0; - case NOT: - case NEG: - case MEM: - return check_return_regs (XEXP (x, 0)); - - default: - return 0; - } - -} - -/* Return 1 if TRIAL references only in and global registers. */ -int -eligible_for_return_delay (trial) - rtx trial; -{ - if (GET_CODE (PATTERN (trial)) != SET) - return 0; - - return check_return_regs (PATTERN (trial)); -} - -int -short_branch (uid1, uid2) - int uid1, uid2; -{ - unsigned int delta = insn_addresses[uid1] - insn_addresses[uid2]; - if (delta + 1024 < 2048) - return 1; - /* warning ("long branch, distance %d", delta); */ - return 0; -} - -/* Return non-zero if REG is not used after INSN. - We assume REG is a reload reg, and therefore does - not live past labels or calls or jumps. */ -int -reg_unused_after (reg, insn) - rtx reg; - rtx insn; -{ - enum rtx_code code, prev_code = UNKNOWN; - - while ((insn = NEXT_INSN (insn))) - { - if (prev_code == CALL_INSN && call_used_regs[REGNO (reg)]) - return 1; - - code = GET_CODE (insn); - if (GET_CODE (insn) == CODE_LABEL) - return 1; - - if (GET_RTX_CLASS (code) == 'i') - { - rtx set = single_set (insn); - int in_src = set && reg_overlap_mentioned_p (reg, SET_SRC (set)); - if (set && in_src) - return 0; - if (set && reg_overlap_mentioned_p (reg, SET_DEST (set))) - return 1; - if (set == 0 && reg_overlap_mentioned_p (reg, PATTERN (insn))) - return 0; - } - prev_code = code; - } - return 1; -} - -/* The table we use to reference PIC data. */ -static rtx global_offset_table; - -/* The function we use to get at it. */ -static rtx get_pc_symbol; -static char get_pc_symbol_name[256]; - -/* Ensure that we are not using patterns that are not OK with PIC. */ - -int -check_pic (i) - int i; -{ - switch (flag_pic) - { - case 1: - if (GET_CODE (recog_operand[i]) == SYMBOL_REF - || (GET_CODE (recog_operand[i]) == CONST - && ! (GET_CODE (XEXP (recog_operand[i], 0)) == MINUS - && (XEXP (XEXP (recog_operand[i], 0), 0) - == global_offset_table) - && (GET_CODE (XEXP (XEXP (recog_operand[i], 0), 1)) - == CONST)))) - abort (); - case 2: - default: - return 1; - } -} - -/* Return true if X is an address which needs a temporary register when - reloaded while generating PIC code. */ - -int -pic_address_needs_scratch (x) - rtx x; -{ - /* An address which is a symbolic plus a non SMALL_INT needs a temp reg. */ - if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS - && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF - && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && ! SMALL_INT (XEXP (XEXP (x, 0), 1))) - return 1; - - return 0; -} - -/* Legitimize PIC addresses. If the address is already position-independent, - we return ORIG. Newly generated position-independent addresses go into a - reg. This is REG if non zero, otherwise we allocate register(s) as - necessary. */ - -rtx -legitimize_pic_address (orig, mode, reg) - rtx orig; - enum machine_mode mode ATTRIBUTE_UNUSED; - rtx reg; -{ - if (GET_CODE (orig) == SYMBOL_REF) - { - rtx pic_ref, address; - rtx insn; - - if (reg == 0) - { - if (reload_in_progress || reload_completed) - abort (); - else - reg = gen_reg_rtx (Pmode); - } - - if (flag_pic == 2) - { - /* If not during reload, allocate another temp reg here for loading - in the address, so that these instructions can be optimized - properly. */ - rtx temp_reg = ((reload_in_progress || reload_completed) - ? reg : gen_reg_rtx (Pmode)); - - /* Must put the SYMBOL_REF inside an UNSPEC here so that cse - won't get confused into thinking that these two instructions - are loading in the true address of the symbol. If in the - future a PIC rtx exists, that should be used instead. */ - if (Pmode == SImode) - { - emit_insn (gen_movsi_high_pic (temp_reg, orig)); - emit_insn (gen_movsi_lo_sum_pic (temp_reg, temp_reg, orig)); - } - else - { - emit_insn (gen_movdi_high_pic (temp_reg, orig)); - emit_insn (gen_movdi_lo_sum_pic (temp_reg, temp_reg, orig)); - } - address = temp_reg; - } - else - address = orig; - - pic_ref = gen_rtx_MEM (Pmode, - gen_rtx_PLUS (Pmode, - pic_offset_table_rtx, address)); - current_function_uses_pic_offset_table = 1; - RTX_UNCHANGING_P (pic_ref) = 1; - insn = emit_move_insn (reg, pic_ref); - /* Put a REG_EQUAL note on this insn, so that it can be optimized - by loop. */ - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, orig, - REG_NOTES (insn)); - return reg; - } - else if (GET_CODE (orig) == CONST) - { - rtx base, offset; - - if (GET_CODE (XEXP (orig, 0)) == PLUS - && XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx) - return orig; - - if (reg == 0) - { - if (reload_in_progress || reload_completed) - abort (); - else - reg = gen_reg_rtx (Pmode); - } - - if (GET_CODE (XEXP (orig, 0)) == PLUS) - { - base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg); - offset = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode, - base == reg ? 0 : reg); - } - else - abort (); - - if (GET_CODE (offset) == CONST_INT) - { - if (SMALL_INT (offset)) - return plus_constant_for_output (base, INTVAL (offset)); - else if (! reload_in_progress && ! reload_completed) - offset = force_reg (Pmode, offset); - else - /* If we reach here, then something is seriously wrong. */ - abort (); - } - return gen_rtx_PLUS (Pmode, base, offset); - } - else if (GET_CODE (orig) == LABEL_REF) - /* ??? Why do we do this? */ - /* Now movsi_pic_label_ref uses it, but we ought to be checking that - the register is live instead, in case it is eliminated. */ - current_function_uses_pic_offset_table = 1; - - return orig; -} - -/* Return the RTX for insns to set the PIC register. */ - -static rtx -pic_setup_code () -{ - rtx seq; - - start_sequence (); - emit_insn (gen_get_pc (pic_offset_table_rtx, global_offset_table, - get_pc_symbol)); - seq = gen_sequence (); - end_sequence (); - - return seq; -} - -/* Emit special PIC prologues and epilogues. */ - -void -finalize_pic () -{ - /* Labels to get the PC in the prologue of this function. */ - int orig_flag_pic = flag_pic; - rtx insn; - - if (current_function_uses_pic_offset_table == 0) - return; - - if (! flag_pic) - abort (); - - /* If we havn't emitted the special get_pc helper function, do so now. */ - if (get_pc_symbol_name[0] == 0) - { - int align; - - ASM_GENERATE_INTERNAL_LABEL (get_pc_symbol_name, "LGETPC", 0); - text_section (); - - align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); - if (align > 0) - ASM_OUTPUT_ALIGN (asm_out_file, align); - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LGETPC", 0); - fputs ("\tretl\n\tadd %o7,%l7,%l7\n", asm_out_file); - } - - /* Initialize every time through, since we can't easily - know this to be permanent. */ - global_offset_table = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_"); - get_pc_symbol = gen_rtx_SYMBOL_REF (Pmode, get_pc_symbol_name); - flag_pic = 0; - - emit_insn_after (pic_setup_code (), get_insns ()); - - /* Insert the code in each nonlocal goto receiver. - If you make changes here or to the nonlocal_goto_receiver - pattern, make sure the unspec_volatile numbers still - match. */ - for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == UNSPEC_VOLATILE - && XINT (PATTERN (insn), 1) == 5) - emit_insn_after (pic_setup_code (), insn); - - flag_pic = orig_flag_pic; - - /* Need to emit this whether or not we obey regdecls, - since setjmp/longjmp can cause life info to screw up. - ??? In the case where we don't obey regdecls, this is not sufficient - since we may not fall out the bottom. */ - emit_insn (gen_rtx_USE (VOIDmode, pic_offset_table_rtx)); -} - -/* Return 1 if RTX is a MEM which is known to be aligned to at - least an 8 byte boundary. */ - -int -mem_min_alignment (mem, desired) - rtx mem; - int desired; -{ - rtx addr, base, offset; - - /* If it's not a MEM we can't accept it. */ - if (GET_CODE (mem) != MEM) - return 0; - - addr = XEXP (mem, 0); - base = offset = NULL_RTX; - if (GET_CODE (addr) == PLUS) - { - if (GET_CODE (XEXP (addr, 0)) == REG) - { - base = XEXP (addr, 0); - - /* What we are saying here is that if the base - REG is aligned properly, the compiler will make - sure any REG based index upon it will be so - as well. */ - if (GET_CODE (XEXP (addr, 1)) == CONST_INT) - offset = XEXP (addr, 1); - else - offset = const0_rtx; - } - } - else if (GET_CODE (addr) == REG) - { - base = addr; - offset = const0_rtx; - } - - if (base != NULL_RTX) - { - int regno = REGNO (base); - - if (regno != FRAME_POINTER_REGNUM - && regno != STACK_POINTER_REGNUM) - { - /* Check if the compiler has recorded some information - about the alignment of the base REG. If reload has - completed, we already matched with proper alignments. */ - if (((regno_pointer_align != NULL - && REGNO_POINTER_ALIGN (regno) >= desired) - || reload_completed) - && ((INTVAL (offset) & (desired - 1)) == 0)) - return 1; - } - else - { - if (((INTVAL (offset) - SPARC_STACK_BIAS) & (desired - 1)) == 0) - return 1; - } - } - else if (! TARGET_UNALIGNED_DOUBLES - || CONSTANT_P (addr) - || GET_CODE (addr) == LO_SUM) - { - /* Anything else we know is properly aligned unless TARGET_UNALIGNED_DOUBLES - is true, in which case we can only assume that an access is aligned if - it is to a constant address, or the address involves a LO_SUM. */ - return 1; - } - - /* An obviously unaligned address. */ - return 0; -} - - -/* Vectors to keep interesting information about registers where it can easily - be got. We use to use the actual mode value as the bit number, but there - are more than 32 modes now. Instead we use two tables: one indexed by - hard register number, and one indexed by mode. */ - -/* The purpose of sparc_mode_class is to shrink the range of modes so that - they all fit (as bit numbers) in a 32 bit word (again). Each real mode is - mapped into one sparc_mode_class mode. */ - -enum sparc_mode_class { - S_MODE, D_MODE, T_MODE, O_MODE, - SF_MODE, DF_MODE, TF_MODE, OF_MODE, - CC_MODE, CCFP_MODE -}; - -/* Modes for single-word and smaller quantities. */ -#define S_MODES ((1 << (int) S_MODE) | (1 << (int) SF_MODE)) - -/* Modes for double-word and smaller quantities. */ -#define D_MODES (S_MODES | (1 << (int) D_MODE) | (1 << DF_MODE)) - -/* Modes for quad-word and smaller quantities. */ -#define T_MODES (D_MODES | (1 << (int) T_MODE) | (1 << (int) TF_MODE)) - -/* Modes for single-float quantities. We must allow any single word or - smaller quantity. This is because the fix/float conversion instructions - take integer inputs/outputs from the float registers. */ -#define SF_MODES (S_MODES) - -/* Modes for double-float and smaller quantities. */ -#define DF_MODES (S_MODES | D_MODES) - -#define DF_MODES64 DF_MODES - -/* Modes for double-float only quantities. */ -#define DF_ONLY_MODES ((1 << (int) DF_MODE) | (1 << (int) D_MODE)) - -/* Modes for double-float and larger quantities. */ -#define DF_UP_MODES (DF_ONLY_MODES | TF_ONLY_MODES) - -/* Modes for quad-float only quantities. */ -#define TF_ONLY_MODES (1 << (int) TF_MODE) - -/* Modes for quad-float and smaller quantities. */ -#define TF_MODES (DF_MODES | TF_ONLY_MODES) - -#define TF_MODES64 (DF_MODES64 | TF_ONLY_MODES) - -/* Modes for condition codes. */ -#define CC_MODES (1 << (int) CC_MODE) -#define CCFP_MODES (1 << (int) CCFP_MODE) - -/* Value is 1 if register/mode pair is acceptable on sparc. - The funny mixture of D and T modes is because integer operations - do not specially operate on tetra quantities, so non-quad-aligned - registers can hold quadword quantities (except %o4 and %i4 because - they cross fixed registers). */ - -/* This points to either the 32 bit or the 64 bit version. */ -int *hard_regno_mode_classes; - -static int hard_32bit_mode_classes[] = { - S_MODES, S_MODES, T_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES, - T_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES, D_MODES, S_MODES, - T_MODES, S_MODES, T_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES, - T_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES, D_MODES, S_MODES, - - TF_MODES, SF_MODES, DF_MODES, SF_MODES, TF_MODES, SF_MODES, DF_MODES, SF_MODES, - TF_MODES, SF_MODES, DF_MODES, SF_MODES, TF_MODES, SF_MODES, DF_MODES, SF_MODES, - TF_MODES, SF_MODES, DF_MODES, SF_MODES, TF_MODES, SF_MODES, DF_MODES, SF_MODES, - TF_MODES, SF_MODES, DF_MODES, SF_MODES, TF_MODES, SF_MODES, DF_MODES, SF_MODES, - - /* FP regs f32 to f63. Only the even numbered registers actually exist, - and none can hold SFmode/SImode values. */ - DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0, - DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0, - DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0, - DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0, - - /* %fcc[0123] */ - CCFP_MODES, CCFP_MODES, CCFP_MODES, CCFP_MODES, - - /* %icc */ - CC_MODES -}; - -static int hard_64bit_mode_classes[] = { - D_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, - T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, - T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, - T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, T_MODES, D_MODES, - - TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, - TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, - TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, - TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, TF_MODES64, SF_MODES, DF_MODES64, SF_MODES, - - /* FP regs f32 to f63. Only the even numbered registers actually exist, - and none can hold SFmode/SImode values. */ - DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0, - DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0, - DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0, - DF_UP_MODES, 0, DF_ONLY_MODES, 0, DF_UP_MODES, 0, DF_ONLY_MODES, 0, - - /* %fcc[0123] */ - CCFP_MODES, CCFP_MODES, CCFP_MODES, CCFP_MODES, - - /* %icc */ - CC_MODES -}; - -int sparc_mode_class [NUM_MACHINE_MODES]; - -enum reg_class sparc_regno_reg_class[FIRST_PSEUDO_REGISTER]; - -static void -sparc_init_modes () -{ - int i; - - for (i = 0; i < NUM_MACHINE_MODES; i++) - { - switch (GET_MODE_CLASS (i)) - { - case MODE_INT: - case MODE_PARTIAL_INT: - case MODE_COMPLEX_INT: - if (GET_MODE_SIZE (i) <= 4) - sparc_mode_class[i] = 1 << (int) S_MODE; - else if (GET_MODE_SIZE (i) == 8) - sparc_mode_class[i] = 1 << (int) D_MODE; - else if (GET_MODE_SIZE (i) == 16) - sparc_mode_class[i] = 1 << (int) T_MODE; - else if (GET_MODE_SIZE (i) == 32) - sparc_mode_class[i] = 1 << (int) O_MODE; - else - sparc_mode_class[i] = 0; - break; - case MODE_FLOAT: - case MODE_COMPLEX_FLOAT: - if (GET_MODE_SIZE (i) <= 4) - sparc_mode_class[i] = 1 << (int) SF_MODE; - else if (GET_MODE_SIZE (i) == 8) - sparc_mode_class[i] = 1 << (int) DF_MODE; - else if (GET_MODE_SIZE (i) == 16) - sparc_mode_class[i] = 1 << (int) TF_MODE; - else if (GET_MODE_SIZE (i) == 32) - sparc_mode_class[i] = 1 << (int) OF_MODE; - else - sparc_mode_class[i] = 0; - break; - case MODE_CC: - default: - /* mode_class hasn't been initialized yet for EXTRA_CC_MODES, so - we must explicitly check for them here. */ - if (i == (int) CCFPmode || i == (int) CCFPEmode) - sparc_mode_class[i] = 1 << (int) CCFP_MODE; - else if (i == (int) CCmode || i == (int) CC_NOOVmode - || i == (int) CCXmode || i == (int) CCX_NOOVmode) - sparc_mode_class[i] = 1 << (int) CC_MODE; - else - sparc_mode_class[i] = 0; - break; - } - } - - if (TARGET_ARCH64) - hard_regno_mode_classes = hard_64bit_mode_classes; - else - hard_regno_mode_classes = hard_32bit_mode_classes; - - /* Initialize the array used by REGNO_REG_CLASS. */ - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - { - if (i < 16 && TARGET_V8PLUS) - sparc_regno_reg_class[i] = I64_REGS; - else if (i < 32) - sparc_regno_reg_class[i] = GENERAL_REGS; - else if (i < 64) - sparc_regno_reg_class[i] = FP_REGS; - else if (i < 96) - sparc_regno_reg_class[i] = EXTRA_FP_REGS; - else if (i < 100) - sparc_regno_reg_class[i] = FPCC_REGS; - else - sparc_regno_reg_class[i] = NO_REGS; - } -} - -/* Save non call used registers from LOW to HIGH at BASE+OFFSET. - N_REGS is the number of 4-byte regs saved thus far. This applies even to - v9 int regs as it simplifies the code. */ - -static int -save_regs (file, low, high, base, offset, n_regs, real_offset) - FILE *file; - int low, high; - const char *base; - int offset; - int n_regs; - int real_offset; -{ - int i; - - if (TARGET_ARCH64 && high <= 32) - { - for (i = low; i < high; i++) - { - if (regs_ever_live[i] && ! call_used_regs[i]) - { - fprintf (file, "\tstx\t%s, [%s+%d]\n", - reg_names[i], base, offset + 4 * n_regs); - if (dwarf2out_do_frame ()) - dwarf2out_reg_save ("", i, real_offset + 4 * n_regs); - n_regs += 2; - } - } - } - else - { - for (i = low; i < high; i += 2) - { - if (regs_ever_live[i] && ! call_used_regs[i]) - { - if (regs_ever_live[i+1] && ! call_used_regs[i+1]) - { - fprintf (file, "\tstd\t%s, [%s+%d]\n", - reg_names[i], base, offset + 4 * n_regs); - if (dwarf2out_do_frame ()) - { - char *l = dwarf2out_cfi_label (); - dwarf2out_reg_save (l, i, real_offset + 4 * n_regs); - dwarf2out_reg_save (l, i+1, real_offset + 4 * n_regs + 4); - } - n_regs += 2; - } - else - { - fprintf (file, "\tst\t%s, [%s+%d]\n", - reg_names[i], base, offset + 4 * n_regs); - if (dwarf2out_do_frame ()) - dwarf2out_reg_save ("", i, real_offset + 4 * n_regs); - n_regs += 2; - } - } - else - { - if (regs_ever_live[i+1] && ! call_used_regs[i+1]) - { - fprintf (file, "\tst\t%s, [%s+%d]\n", - reg_names[i+1], base, offset + 4 * n_regs + 4); - if (dwarf2out_do_frame ()) - dwarf2out_reg_save ("", i + 1, real_offset + 4 * n_regs + 4); - n_regs += 2; - } - } - } - } - return n_regs; -} - -/* Restore non call used registers from LOW to HIGH at BASE+OFFSET. - - N_REGS is the number of 4-byte regs saved thus far. This applies even to - v9 int regs as it simplifies the code. */ - -static int -restore_regs (file, low, high, base, offset, n_regs) - FILE *file; - int low, high; - const char *base; - int offset; - int n_regs; -{ - int i; - - if (TARGET_ARCH64 && high <= 32) - { - for (i = low; i < high; i++) - { - if (regs_ever_live[i] && ! call_used_regs[i]) - fprintf (file, "\tldx\t[%s+%d], %s\n", - base, offset + 4 * n_regs, reg_names[i]), - n_regs += 2; - } - } - else - { - for (i = low; i < high; i += 2) - { - if (regs_ever_live[i] && ! call_used_regs[i]) - if (regs_ever_live[i+1] && ! call_used_regs[i+1]) - fprintf (file, "\tldd\t[%s+%d], %s\n", - base, offset + 4 * n_regs, reg_names[i]), - n_regs += 2; - else - fprintf (file, "\tld\t[%s+%d],%s\n", - base, offset + 4 * n_regs, reg_names[i]), - n_regs += 2; - else if (regs_ever_live[i+1] && ! call_used_regs[i+1]) - fprintf (file, "\tld\t[%s+%d],%s\n", - base, offset + 4 * n_regs + 4, reg_names[i+1]), - n_regs += 2; - } - } - return n_regs; -} - -/* Static variables we want to share between prologue and epilogue. */ - -/* Number of live general or floating point registers needed to be saved - (as 4-byte quantities). This is only done if TARGET_EPILOGUE. */ -static int num_gfregs; - -/* Compute the frame size required by the function. This function is called - during the reload pass and also by output_function_prologue(). */ - -int -compute_frame_size (size, leaf_function) - int size; - int leaf_function; -{ - int n_regs = 0, i; - int outgoing_args_size = (current_function_outgoing_args_size - + REG_PARM_STACK_SPACE (current_function_decl)); - - if (TARGET_EPILOGUE) - { - /* N_REGS is the number of 4-byte regs saved thus far. This applies - even to v9 int regs to be consistent with save_regs/restore_regs. */ - - if (TARGET_ARCH64) - { - for (i = 0; i < 8; i++) - if (regs_ever_live[i] && ! call_used_regs[i]) - n_regs += 2; - } - else - { - for (i = 0; i < 8; i += 2) - if ((regs_ever_live[i] && ! call_used_regs[i]) - || (regs_ever_live[i+1] && ! call_used_regs[i+1])) - n_regs += 2; - } - - for (i = 32; i < (TARGET_V9 ? 96 : 64); i += 2) - if ((regs_ever_live[i] && ! call_used_regs[i]) - || (regs_ever_live[i+1] && ! call_used_regs[i+1])) - n_regs += 2; - } - - /* Set up values for use in `function_epilogue'. */ - num_gfregs = n_regs; - - if (leaf_function && n_regs == 0 - && size == 0 && current_function_outgoing_args_size == 0) - { - actual_fsize = apparent_fsize = 0; - } - else - { - /* We subtract STARTING_FRAME_OFFSET, remember it's negative. - The stack bias (if any) is taken out to undo its effects. */ - apparent_fsize = (size - STARTING_FRAME_OFFSET + SPARC_STACK_BIAS + 7) & -8; - apparent_fsize += n_regs * 4; - actual_fsize = apparent_fsize + ((outgoing_args_size + 7) & -8); - } - - /* Make sure nothing can clobber our register windows. - If a SAVE must be done, or there is a stack-local variable, - the register window area must be allocated. - ??? For v8 we apparently need an additional 8 bytes of reserved space. */ - if (leaf_function == 0 || size > 0) - actual_fsize += (16 * UNITS_PER_WORD) + (TARGET_ARCH64 ? 0 : 8); - - return SPARC_STACK_ALIGN (actual_fsize); -} - -/* Build a (32 bit) big number in a register. */ -/* ??? We may be able to use the set macro here too. */ - -static void -build_big_number (file, num, reg) - FILE *file; - int num; - const char *reg; -{ - if (num >= 0 || ! TARGET_ARCH64) - { - fprintf (file, "\tsethi\t%%hi(%d), %s\n", num, reg); - if ((num & 0x3ff) != 0) - fprintf (file, "\tor\t%s, %%lo(%d), %s\n", reg, num, reg); - } - else /* num < 0 && TARGET_ARCH64 */ - { - /* Sethi does not sign extend, so we must use a little trickery - to use it for negative numbers. Invert the constant before - loading it in, then use xor immediate to invert the loaded bits - (along with the upper 32 bits) to the desired constant. This - works because the sethi and immediate fields overlap. */ - int asize = num; - int inv = ~asize; - int low = -0x400 + (asize & 0x3FF); - - fprintf (file, "\tsethi\t%%hi(%d), %s\n\txor\t%s, %d, %s\n", - inv, reg, reg, low, reg); - } -} - -/* Output code for the function prologue. */ - -void -output_function_prologue (file, size, leaf_function) - FILE *file; - int size; - int leaf_function; -{ - /* Need to use actual_fsize, since we are also allocating - space for our callee (and our own register save area). */ - actual_fsize = compute_frame_size (size, leaf_function); - - if (leaf_function) - { - frame_base_name = "%sp"; - frame_base_offset = actual_fsize + SPARC_STACK_BIAS; - } - else - { - frame_base_name = "%fp"; - frame_base_offset = SPARC_STACK_BIAS; - } - - /* This is only for the human reader. */ - fprintf (file, "\t%s#PROLOGUE# 0\n", ASM_COMMENT_START); - - if (actual_fsize == 0) - /* do nothing. */ ; - else if (! leaf_function && ! TARGET_BROKEN_SAVERESTORE) - { - if (actual_fsize <= 4096) - fprintf (file, "\tsave\t%%sp, -%d, %%sp\n", actual_fsize); - else if (actual_fsize <= 8192) - { - fprintf (file, "\tsave\t%%sp, -4096, %%sp\n"); - fprintf (file, "\tadd\t%%sp, -%d, %%sp\n", actual_fsize - 4096); - } - else - { - build_big_number (file, -actual_fsize, "%g1"); - fprintf (file, "\tsave\t%%sp, %%g1, %%sp\n"); - } - } - else if (! leaf_function && TARGET_BROKEN_SAVERESTORE) - { - /* We assume the environment will properly handle or otherwise avoid - trouble associated with an interrupt occurring after the `save' or - trap occurring during it. */ - fprintf (file, "\tsave\n"); - - if (actual_fsize <= 4096) - fprintf (file, "\tadd\t%%fp, -%d, %%sp\n", actual_fsize); - else if (actual_fsize <= 8192) - { - fprintf (file, "\tadd\t%%fp, -4096, %%sp\n"); - fprintf (file, "\tadd\t%%fp, -%d, %%sp\n", actual_fsize - 4096); - } - else - { - build_big_number (file, -actual_fsize, "%g1"); - fprintf (file, "\tadd\t%%fp, %%g1, %%sp\n"); - } - } - else /* leaf function */ - { - if (actual_fsize <= 4096) - fprintf (file, "\tadd\t%%sp, -%d, %%sp\n", actual_fsize); - else if (actual_fsize <= 8192) - { - fprintf (file, "\tadd\t%%sp, -4096, %%sp\n"); - fprintf (file, "\tadd\t%%sp, -%d, %%sp\n", actual_fsize - 4096); - } - else - { - build_big_number (file, -actual_fsize, "%g1"); - fprintf (file, "\tadd\t%%sp, %%g1, %%sp\n"); - } - } - - if (dwarf2out_do_frame () && actual_fsize) - { - char *label = dwarf2out_cfi_label (); - - /* The canonical frame address refers to the top of the frame. */ - dwarf2out_def_cfa (label, (leaf_function ? STACK_POINTER_REGNUM - : FRAME_POINTER_REGNUM), - frame_base_offset); - - if (! leaf_function) - { - /* Note the register window save. This tells the unwinder that - it needs to restore the window registers from the previous - frame's window save area at 0(cfa). */ - dwarf2out_window_save (label); - - /* The return address (-8) is now in %i7. */ - dwarf2out_return_reg (label, 31); - } - } - - /* If doing anything with PIC, do it now. */ - if (! flag_pic) - fprintf (file, "\t%s#PROLOGUE# 1\n", ASM_COMMENT_START); - - /* Call saved registers are saved just above the outgoing argument area. */ - if (num_gfregs) - { - int offset, real_offset, n_regs; - const char *base; - - real_offset = -apparent_fsize; - offset = -apparent_fsize + frame_base_offset; - if (offset < -4096 || offset + num_gfregs * 4 > 4096) - { - /* ??? This might be optimized a little as %g1 might already have a - value close enough that a single add insn will do. */ - /* ??? Although, all of this is probably only a temporary fix - because if %g1 can hold a function result, then - output_function_epilogue will lose (the result will get - clobbered). */ - build_big_number (file, offset, "%g1"); - fprintf (file, "\tadd\t%s, %%g1, %%g1\n", frame_base_name); - base = "%g1"; - offset = 0; - } - else - { - base = frame_base_name; - } - - n_regs = 0; - if (TARGET_EPILOGUE && ! leaf_function) - /* ??? Originally saved regs 0-15 here. */ - n_regs = save_regs (file, 0, 8, base, offset, 0, real_offset); - else if (leaf_function) - /* ??? Originally saved regs 0-31 here. */ - n_regs = save_regs (file, 0, 8, base, offset, 0, real_offset); - if (TARGET_EPILOGUE) - save_regs (file, 32, TARGET_V9 ? 96 : 64, base, offset, n_regs, - real_offset); - } - - leaf_label = 0; - if (leaf_function && actual_fsize != 0) - { - /* warning ("leaf procedure with frame size %d", actual_fsize); */ - if (! TARGET_EPILOGUE) - leaf_label = gen_label_rtx (); - } -} - -/* Output code for the function epilogue. */ - -void -output_function_epilogue (file, size, leaf_function) - FILE *file; - int size ATTRIBUTE_UNUSED; - int leaf_function; -{ - const char *ret; - - if (leaf_label) - { - emit_label_after (leaf_label, get_last_insn ()); - final_scan_insn (get_last_insn (), file, 0, 0, 1); - } - -#ifdef FUNCTION_BLOCK_PROFILER_EXIT - else if (profile_block_flag == 2) - { - FUNCTION_BLOCK_PROFILER_EXIT(file); - } -#endif - - else if (current_function_epilogue_delay_list == 0) - { - /* If code does not drop into the epilogue, we need - do nothing except output pending case vectors. */ - rtx insn = get_last_insn (); - if (GET_CODE (insn) == NOTE) - insn = prev_nonnote_insn (insn); - if (insn && GET_CODE (insn) == BARRIER) - goto output_vectors; - } - - /* Restore any call saved registers. */ - if (num_gfregs) - { - int offset, n_regs; - const char *base; - - offset = -apparent_fsize + frame_base_offset; - if (offset < -4096 || offset + num_gfregs * 4 > 4096 - 8 /*double*/) - { - build_big_number (file, offset, "%g1"); - fprintf (file, "\tadd\t%s, %%g1, %%g1\n", frame_base_name); - base = "%g1"; - offset = 0; - } - else - { - base = frame_base_name; - } - - n_regs = 0; - if (TARGET_EPILOGUE && ! leaf_function) - /* ??? Originally saved regs 0-15 here. */ - n_regs = restore_regs (file, 0, 8, base, offset, 0); - else if (leaf_function) - /* ??? Originally saved regs 0-31 here. */ - n_regs = restore_regs (file, 0, 8, base, offset, 0); - if (TARGET_EPILOGUE) - restore_regs (file, 32, TARGET_V9 ? 96 : 64, base, offset, n_regs); - } - - /* Work out how to skip the caller's unimp instruction if required. */ - if (leaf_function) - ret = (SKIP_CALLERS_UNIMP_P ? "jmp\t%o7+12" : "retl"); - else - ret = (SKIP_CALLERS_UNIMP_P ? "jmp\t%i7+12" : "ret"); - - if (TARGET_EPILOGUE || leaf_label) - { - int old_target_epilogue = TARGET_EPILOGUE; - target_flags &= ~old_target_epilogue; - - if (! leaf_function) - { - /* If we wound up with things in our delay slot, flush them here. */ - if (current_function_epilogue_delay_list) - { - rtx insn = emit_jump_insn_after (gen_rtx_RETURN (VOIDmode), - get_last_insn ()); - PATTERN (insn) = gen_rtx_PARALLEL (VOIDmode, - gen_rtvec (2, - PATTERN (XEXP (current_function_epilogue_delay_list, 0)), - PATTERN (insn))); - final_scan_insn (insn, file, 1, 0, 1); - } - else if (TARGET_V9 && ! SKIP_CALLERS_UNIMP_P) - fputs ("\treturn\t%i7+8\n\tnop\n", file); - else - fprintf (file, "\t%s\n\trestore\n", ret); - } - /* All of the following cases are for leaf functions. */ - else if (current_function_epilogue_delay_list) - { - /* eligible_for_epilogue_delay_slot ensures that if this is a - leaf function, then we will only have insn in the delay slot - if the frame size is zero, thus no adjust for the stack is - needed here. */ - if (actual_fsize != 0) - abort (); - fprintf (file, "\t%s\n", ret); - final_scan_insn (XEXP (current_function_epilogue_delay_list, 0), - file, 1, 0, 1); - } - /* Output 'nop' instead of 'sub %sp,-0,%sp' when no frame, so as to - avoid generating confusing assembly language output. */ - else if (actual_fsize == 0) - fprintf (file, "\t%s\n\tnop\n", ret); - else if (actual_fsize <= 4096) - fprintf (file, "\t%s\n\tsub\t%%sp, -%d, %%sp\n", ret, actual_fsize); - else if (actual_fsize <= 8192) - fprintf (file, "\tsub\t%%sp, -4096, %%sp\n\t%s\n\tsub\t%%sp, -%d, %%sp\n", - ret, actual_fsize - 4096); - else if ((actual_fsize & 0x3ff) == 0) - fprintf (file, "\tsethi\t%%hi(%d), %%g1\n\t%s\n\tadd\t%%sp, %%g1, %%sp\n", - actual_fsize, ret); - else - fprintf (file, "\tsethi\t%%hi(%d), %%g1\n\tor\t%%g1, %%lo(%d), %%g1\n\t%s\n\tadd\t%%sp, %%g1, %%sp\n", - actual_fsize, actual_fsize, ret); - target_flags |= old_target_epilogue; - } - - output_vectors: - sparc_output_deferred_case_vectors (); -} - -/* Functions for handling argument passing. - - For v8 the first six args are normally in registers and the rest are - pushed. Any arg that starts within the first 6 words is at least - partially passed in a register unless its data type forbids. - - For v9, the argument registers are laid out as an array of 16 elements - and arguments are added sequentially. The first 6 int args and up to the - first 16 fp args (depending on size) are passed in regs. - - Slot Stack Integral Float Float in structure Double Long Double - ---- ----- -------- ----- ------------------ ------ ----------- - 15 [SP+248] %f31 %f30,%f31 %d30 - 14 [SP+240] %f29 %f28,%f29 %d28 %q28 - 13 [SP+232] %f27 %f26,%f27 %d26 - 12 [SP+224] %f25 %f24,%f25 %d24 %q24 - 11 [SP+216] %f23 %f22,%f23 %d22 - 10 [SP+208] %f21 %f20,%f21 %d20 %q20 - 9 [SP+200] %f19 %f18,%f19 %d18 - 8 [SP+192] %f17 %f16,%f17 %d16 %q16 - 7 [SP+184] %f15 %f14,%f15 %d14 - 6 [SP+176] %f13 %f12,%f13 %d12 %q12 - 5 [SP+168] %o5 %f11 %f10,%f11 %d10 - 4 [SP+160] %o4 %f9 %f8,%f9 %d8 %q8 - 3 [SP+152] %o3 %f7 %f6,%f7 %d6 - 2 [SP+144] %o2 %f5 %f4,%f5 %d4 %q4 - 1 [SP+136] %o1 %f3 %f2,%f3 %d2 - 0 [SP+128] %o0 %f1 %f0,%f1 %d0 %q0 - - Here SP = %sp if -mno-stack-bias or %sp+stack_bias otherwise. - - Integral arguments are always passed as 64 bit quantities appropriately - extended. - - Passing of floating point values is handled as follows. - If a prototype is in scope: - If the value is in a named argument (i.e. not a stdarg function or a - value not part of the `...') then the value is passed in the appropriate - fp reg. - If the value is part of the `...' and is passed in one of the first 6 - slots then the value is passed in the appropriate int reg. - If the value is part of the `...' and is not passed in one of the first 6 - slots then the value is passed in memory. - If a prototype is not in scope: - If the value is one of the first 6 arguments the value is passed in the - appropriate integer reg and the appropriate fp reg. - If the value is not one of the first 6 arguments the value is passed in - the appropriate fp reg and in memory. - */ - -/* Maximum number of int regs for args. */ -#define SPARC_INT_ARG_MAX 6 -/* Maximum number of fp regs for args. */ -#define SPARC_FP_ARG_MAX 16 - -#define ROUND_ADVANCE(SIZE) (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) - -/* Handle the INIT_CUMULATIVE_ARGS macro. - Initialize a variable CUM of type CUMULATIVE_ARGS - for a call to a function whose data type is FNTYPE. - For a library call, FNTYPE is 0. */ - -void -init_cumulative_args (cum, fntype, libname, indirect) - CUMULATIVE_ARGS *cum; - tree fntype; - tree libname ATTRIBUTE_UNUSED; - int indirect ATTRIBUTE_UNUSED; -{ - cum->words = 0; - cum->prototype_p = fntype && TYPE_ARG_TYPES (fntype); - cum->libcall_p = fntype == 0; -} - -/* Compute the slot number to pass an argument in. - Returns the slot number or -1 if passing on the stack. - - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - MODE is the argument's machine mode. - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). - INCOMING_P is zero for FUNCTION_ARG, nonzero for FUNCTION_INCOMING_ARG. - *PREGNO records the register number to use if scalar type. - *PPADDING records the amount of padding needed in words. */ - -static int -function_arg_slotno (cum, mode, type, named, incoming_p, pregno, ppadding) - const CUMULATIVE_ARGS *cum; - enum machine_mode mode; - tree type; - int named; - int incoming_p; - int *pregno; - int *ppadding; -{ - int regbase = (incoming_p - ? SPARC_INCOMING_INT_ARG_FIRST - : SPARC_OUTGOING_INT_ARG_FIRST); - int slotno = cum->words; - int regno; - - *ppadding = 0; - - if (type != 0 && TREE_ADDRESSABLE (type)) - return -1; - if (TARGET_ARCH32 - && type != 0 && mode == BLKmode - && TYPE_ALIGN (type) % PARM_BOUNDARY != 0) - return -1; - - switch (mode) - { - case VOIDmode : - /* MODE is VOIDmode when generating the actual call. - See emit_call_1. */ - return -1; - - case QImode : case CQImode : - case HImode : case CHImode : - case SImode : case CSImode : - case DImode : case CDImode : - if (slotno >= SPARC_INT_ARG_MAX) - return -1; - regno = regbase + slotno; - break; - - case SFmode : case SCmode : - case DFmode : case DCmode : - case TFmode : case TCmode : - if (TARGET_ARCH32) - { - if (slotno >= SPARC_INT_ARG_MAX) - return -1; - regno = regbase + slotno; - } - else - { - if ((mode == TFmode || mode == TCmode) - && (slotno & 1) != 0) - slotno++, *ppadding = 1; - if (TARGET_FPU && named) - { - if (slotno >= SPARC_FP_ARG_MAX) - return -1; - regno = SPARC_FP_ARG_FIRST + slotno * 2; - if (mode == SFmode) - regno++; - } - else - { - if (slotno >= SPARC_INT_ARG_MAX) - return -1; - regno = regbase + slotno; - } - } - break; - - case BLKmode : - /* For sparc64, objects requiring 16 byte alignment get it. */ - if (TARGET_ARCH64) - { - if (type && TYPE_ALIGN (type) == 128 && (slotno & 1) != 0) - slotno++, *ppadding = 1; - } - - if (TARGET_ARCH32 - || (type && TREE_CODE (type) == UNION_TYPE)) - { - if (slotno >= SPARC_INT_ARG_MAX) - return -1; - regno = regbase + slotno; - } - else - { - tree field; - int intregs_p = 0, fpregs_p = 0; - /* The ABI obviously doesn't specify how packed - structures are passed. These are defined to be passed - in int regs if possible, otherwise memory. */ - int packed_p = 0; - - /* First see what kinds of registers we need. */ - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) - { - if (TREE_CODE (field) == FIELD_DECL) - { - if (TREE_CODE (TREE_TYPE (field)) == REAL_TYPE - && TARGET_FPU) - fpregs_p = 1; - else - intregs_p = 1; - if (DECL_PACKED (field)) - packed_p = 1; - } - } - if (packed_p || !named) - fpregs_p = 0, intregs_p = 1; - - /* If all arg slots are filled, then must pass on stack. */ - if (fpregs_p && slotno >= SPARC_FP_ARG_MAX) - return -1; - /* If there are only int args and all int arg slots are filled, - then must pass on stack. */ - if (!fpregs_p && intregs_p && slotno >= SPARC_INT_ARG_MAX) - return -1; - /* Note that even if all int arg slots are filled, fp members may - still be passed in regs if such regs are available. - *PREGNO isn't set because there may be more than one, it's up - to the caller to compute them. */ - return slotno; - } - break; - - default : - abort (); - } - - *pregno = regno; - return slotno; -} - -/* Handle recursive register counting for structure field layout. */ - -struct function_arg_record_value_parms -{ - rtx ret; - int slotno, named, regbase; - int nregs, intoffset; -}; - -static void function_arg_record_value_3 - PROTO((int, struct function_arg_record_value_parms *)); -static void function_arg_record_value_2 - PROTO((tree, int, struct function_arg_record_value_parms *)); -static rtx function_arg_record_value - PROTO((tree, enum machine_mode, int, int, int)); - -static void -function_arg_record_value_1 (type, startbitpos, parms) - tree type; - int startbitpos; - struct function_arg_record_value_parms *parms; -{ - tree field; - - /* The ABI obviously doesn't specify how packed structures are - passed. These are defined to be passed in int regs if possible, - otherwise memory. */ - int packed_p = 0; - - /* We need to compute how many registers are needed so we can - allocate the PARALLEL but before we can do that we need to know - whether there are any packed fields. If there are, int regs are - used regardless of whether there are fp values present. */ - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) - { - if (TREE_CODE (field) == FIELD_DECL && DECL_PACKED (field)) - { - packed_p = 1; - break; - } - } - - /* Compute how many registers we need. */ - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) - { - if (TREE_CODE (field) == FIELD_DECL) - { - int bitpos = startbitpos; - if (DECL_FIELD_BITPOS (field)) - bitpos += TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field)); - /* ??? FIXME: else assume zero offset. */ - - if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE) - { - function_arg_record_value_1 (TREE_TYPE (field), bitpos, parms); - } - else if (TREE_CODE (TREE_TYPE (field)) == REAL_TYPE - && TARGET_FPU - && ! packed_p - && parms->named) - { - if (parms->intoffset != -1) - { - int intslots, this_slotno; - - intslots = (bitpos - parms->intoffset + BITS_PER_WORD - 1) - / BITS_PER_WORD; - this_slotno = parms->slotno + parms->intoffset - / BITS_PER_WORD; - - intslots = MIN (intslots, SPARC_INT_ARG_MAX - this_slotno); - intslots = MAX (intslots, 0); - parms->nregs += intslots; - parms->intoffset = -1; - } - - /* There's no need to check this_slotno < SPARC_FP_ARG MAX. - If it wasn't true we wouldn't be here. */ - parms->nregs += 1; - } - else - { - if (parms->intoffset == -1) - parms->intoffset = bitpos; - } - } - } -} - -/* Handle recursive structure field register assignment. */ - -static void -function_arg_record_value_3 (bitpos, parms) - int bitpos; - struct function_arg_record_value_parms *parms; -{ - enum machine_mode mode; - int regno, this_slotno, intslots, intoffset; - rtx reg; - - if (parms->intoffset == -1) - return; - intoffset = parms->intoffset; - parms->intoffset = -1; - - intslots = (bitpos - intoffset + BITS_PER_WORD - 1) / BITS_PER_WORD; - this_slotno = parms->slotno + intoffset / BITS_PER_WORD; - - intslots = MIN (intslots, SPARC_INT_ARG_MAX - this_slotno); - if (intslots <= 0) - return; - - /* If this is the trailing part of a word, only load that much into - the register. Otherwise load the whole register. Note that in - the latter case we may pick up unwanted bits. It's not a problem - at the moment but may wish to revisit. */ - - if (intoffset % BITS_PER_WORD != 0) - { - mode = mode_for_size (BITS_PER_WORD - intoffset%BITS_PER_WORD, - MODE_INT, 0); - } - else - mode = word_mode; - - intoffset /= BITS_PER_UNIT; - do - { - regno = parms->regbase + this_slotno; - reg = gen_rtx_REG (mode, regno); - XVECEXP (parms->ret, 0, parms->nregs) - = gen_rtx_EXPR_LIST (VOIDmode, reg, GEN_INT (intoffset)); - - this_slotno += 1; - intoffset = (intoffset | (UNITS_PER_WORD-1)) + 1; - parms->nregs += 1; - intslots -= 1; - } - while (intslots > 0); -} - -static void -function_arg_record_value_2 (type, startbitpos, parms) - tree type; - int startbitpos; - struct function_arg_record_value_parms *parms; -{ - tree field; - int packed_p = 0; - - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) - { - if (TREE_CODE (field) == FIELD_DECL && DECL_PACKED (field)) - { - packed_p = 1; - break; - } - } - - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) - { - if (TREE_CODE (field) == FIELD_DECL) - { - int bitpos = startbitpos; - if (DECL_FIELD_BITPOS (field)) - bitpos += TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field)); - /* ??? FIXME: else assume zero offset. */ - - if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE) - { - function_arg_record_value_2 (TREE_TYPE (field), bitpos, parms); - } - else if (TREE_CODE (TREE_TYPE (field)) == REAL_TYPE - && TARGET_FPU - && ! packed_p - && parms->named) - { - int this_slotno = parms->slotno + bitpos / BITS_PER_WORD; - rtx reg; - - function_arg_record_value_3 (bitpos, parms); - - reg = gen_rtx_REG (DECL_MODE (field), - (SPARC_FP_ARG_FIRST + this_slotno * 2 - + (DECL_MODE (field) == SFmode - && (bitpos & 32) != 0))); - XVECEXP (parms->ret, 0, parms->nregs) - = gen_rtx_EXPR_LIST (VOIDmode, reg, - GEN_INT (bitpos / BITS_PER_UNIT)); - parms->nregs += 1; - } - else - { - if (parms->intoffset == -1) - parms->intoffset = bitpos; - } - } - } -} - -static rtx -function_arg_record_value (type, mode, slotno, named, regbase) - tree type; - enum machine_mode mode; - int slotno, named, regbase; -{ - HOST_WIDE_INT typesize = int_size_in_bytes (type); - struct function_arg_record_value_parms parms; - int nregs; - - parms.ret = NULL_RTX; - parms.slotno = slotno; - parms.named = named; - parms.regbase = regbase; - - /* Compute how many registers we need. */ - parms.nregs = 0; - parms.intoffset = 0; - function_arg_record_value_1 (type, 0, &parms); - - if (parms.intoffset != -1) - { - int intslots, this_slotno; - - intslots = (typesize*BITS_PER_UNIT - parms.intoffset + BITS_PER_WORD - 1) - / BITS_PER_WORD; - this_slotno = slotno + parms.intoffset / BITS_PER_WORD; - - intslots = MIN (intslots, SPARC_INT_ARG_MAX - this_slotno); - intslots = MAX (intslots, 0); - - parms.nregs += intslots; - } - nregs = parms.nregs; - - /* Allocate the vector and handle some annoying special cases. */ - if (nregs == 0) - { - /* ??? Empty structure has no value? Duh? */ - if (typesize <= 0) - { - /* Though there's nothing really to store, return a word register - anyway so the rest of gcc doesn't go nuts. Returning a PARALLEL - leads to breakage due to the fact that there are zero bytes to - load. */ - return gen_rtx_REG (mode, regbase); - } - else - { - /* ??? C++ has structures with no fields, and yet a size. Give up - for now and pass everything back in integer registers. */ - nregs = (typesize + UNITS_PER_WORD - 1) / UNITS_PER_WORD; - } - if (nregs + slotno > SPARC_INT_ARG_MAX) - nregs = SPARC_INT_ARG_MAX - slotno; - } - if (nregs == 0) - abort (); - - parms.ret = gen_rtx_PARALLEL (mode, rtvec_alloc (nregs)); - - /* Fill in the entries. */ - parms.nregs = 0; - parms.intoffset = 0; - function_arg_record_value_2 (type, 0, &parms); - function_arg_record_value_3 (typesize * BITS_PER_UNIT, &parms); - - if (parms.nregs != nregs) - abort (); - - return parms.ret; -} - -/* Handle the FUNCTION_ARG macro. - Determine where to put an argument to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - MODE is the argument's machine mode. - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). - INCOMING_P is zero for FUNCTION_ARG, nonzero for FUNCTION_INCOMING_ARG. */ - -rtx -function_arg (cum, mode, type, named, incoming_p) - const CUMULATIVE_ARGS *cum; - enum machine_mode mode; - tree type; - int named; - int incoming_p; -{ - int regbase = (incoming_p - ? SPARC_INCOMING_INT_ARG_FIRST - : SPARC_OUTGOING_INT_ARG_FIRST); - int slotno, regno, padding; - rtx reg; - - slotno = function_arg_slotno (cum, mode, type, named, incoming_p, - ®no, &padding); - - if (slotno == -1) - return 0; - - if (TARGET_ARCH32) - { - reg = gen_rtx_REG (mode, regno); - return reg; - } - - /* v9 fp args in reg slots beyond the int reg slots get passed in regs - but also have the slot allocated for them. - If no prototype is in scope fp values in register slots get passed - in two places, either fp regs and int regs or fp regs and memory. */ - if ((GET_MODE_CLASS (mode) == MODE_FLOAT - || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT) - && SPARC_FP_REG_P (regno)) - { - reg = gen_rtx_REG (mode, regno); - if (cum->prototype_p || cum->libcall_p) - { - /* "* 2" because fp reg numbers are recorded in 4 byte - quantities. */ -#if 0 - /* ??? This will cause the value to be passed in the fp reg and - in the stack. When a prototype exists we want to pass the - value in the reg but reserve space on the stack. That's an - optimization, and is deferred [for a bit]. */ - if ((regno - SPARC_FP_ARG_FIRST) >= SPARC_INT_ARG_MAX * 2) - return gen_rtx_PARALLEL (mode, - gen_rtvec (2, - gen_rtx_EXPR_LIST (VOIDmode, - NULL_RTX, const0_rtx), - gen_rtx_EXPR_LIST (VOIDmode, - reg, const0_rtx))); - else -#else - /* ??? It seems that passing back a register even when past - the area declared by REG_PARM_STACK_SPACE will allocate - space appropriately, and will not copy the data onto the - stack, exactly as we desire. - - This is due to locate_and_pad_parm being called in - expand_call whenever reg_parm_stack_space > 0, which - while benefical to our example here, would seem to be - in error from what had been intended. Ho hum... -- r~ */ -#endif - return reg; - } - else - { - rtx v0, v1; - - if ((regno - SPARC_FP_ARG_FIRST) < SPARC_INT_ARG_MAX * 2) - { - int intreg; - - /* On incoming, we don't need to know that the value - is passed in %f0 and %i0, and it confuses other parts - causing needless spillage even on the simplest cases. */ - if (incoming_p) - return reg; - - intreg = (SPARC_OUTGOING_INT_ARG_FIRST - + (regno - SPARC_FP_ARG_FIRST) / 2); - - v0 = gen_rtx_EXPR_LIST (VOIDmode, reg, const0_rtx); - v1 = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_REG (mode, intreg), - const0_rtx); - return gen_rtx_PARALLEL (mode, gen_rtvec (2, v0, v1)); - } - else - { - v0 = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx); - v1 = gen_rtx_EXPR_LIST (VOIDmode, reg, const0_rtx); - return gen_rtx_PARALLEL (mode, gen_rtvec (2, v0, v1)); - } - } - } - else if (type && TREE_CODE (type) == RECORD_TYPE) - { - /* Structures up to 16 bytes in size are passed in arg slots on the - stack and are promoted to registers where possible. */ - - if (int_size_in_bytes (type) > 16) - abort (); /* shouldn't get here */ - - return function_arg_record_value (type, mode, slotno, named, regbase); - } - else if (type && TREE_CODE (type) == UNION_TYPE) - { - enum machine_mode mode; - int bytes = int_size_in_bytes (type); - - if (bytes > 16) - abort (); - - mode = mode_for_size (bytes * BITS_PER_UNIT, MODE_INT, 0); - reg = gen_rtx_REG (mode, regno); - } - else - { - /* Scalar or complex int. */ - reg = gen_rtx_REG (mode, regno); - } - - return reg; -} - -/* Handle the FUNCTION_ARG_PARTIAL_NREGS macro. - For an arg passed partly in registers and partly in memory, - this is the number of registers used. - For args passed entirely in registers or entirely in memory, zero. - - Any arg that starts in the first 6 regs but won't entirely fit in them - needs partial registers on v8. On v9, structures with integer - values in arg slots 5,6 will be passed in %o5 and SP+176, and complex fp - values that begin in the last fp reg [where "last fp reg" varies with the - mode] will be split between that reg and memory. */ - -int -function_arg_partial_nregs (cum, mode, type, named) - const CUMULATIVE_ARGS *cum; - enum machine_mode mode; - tree type; - int named; -{ - int slotno, regno, padding; - - /* We pass 0 for incoming_p here, it doesn't matter. */ - slotno = function_arg_slotno (cum, mode, type, named, 0, ®no, &padding); - - if (slotno == -1) - return 0; - - if (TARGET_ARCH32) - { - if ((slotno + (mode == BLKmode - ? ROUND_ADVANCE (int_size_in_bytes (type)) - : ROUND_ADVANCE (GET_MODE_SIZE (mode)))) - > NPARM_REGS (SImode)) - return NPARM_REGS (SImode) - slotno; - return 0; - } - else - { - if (type && AGGREGATE_TYPE_P (type)) - { - int size = int_size_in_bytes (type); - int align = TYPE_ALIGN (type); - - if (align == 16) - slotno += slotno & 1; - if (size > 8 && size <= 16 - && slotno == SPARC_INT_ARG_MAX - 1) - return 1; - } - else if (GET_MODE_CLASS (mode) == MODE_COMPLEX_INT - || (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT - && ! TARGET_FPU)) - { - if (GET_MODE_ALIGNMENT (mode) == 128) - { - slotno += slotno & 1; - if (slotno == SPARC_INT_ARG_MAX - 2) - return 1; - } - else - { - if (slotno == SPARC_INT_ARG_MAX - 1) - return 1; - } - } - else if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT) - { - if (GET_MODE_ALIGNMENT (mode) == 128) - slotno += slotno & 1; - if ((slotno + GET_MODE_SIZE (mode) / UNITS_PER_WORD) - > SPARC_FP_ARG_MAX) - return 1; - } - return 0; - } -} - -/* Handle the FUNCTION_ARG_PASS_BY_REFERENCE macro. - !v9: The SPARC ABI stipulates passing struct arguments (of any size) and - quad-precision floats by invisible reference. - v9: Aggregates greater than 16 bytes are passed by reference. - For Pascal, also pass arrays by reference. */ - -int -function_arg_pass_by_reference (cum, mode, type, named) - const CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED; - enum machine_mode mode; - tree type; - int named ATTRIBUTE_UNUSED; -{ - if (TARGET_ARCH32) - { - return ((type && AGGREGATE_TYPE_P (type)) - || mode == TFmode || mode == TCmode); - } - else - { - return ((type && TREE_CODE (type) == ARRAY_TYPE) - /* Consider complex values as aggregates, so care for TCmode. */ - || GET_MODE_SIZE (mode) > 16 - || (type && AGGREGATE_TYPE_P (type) - && int_size_in_bytes (type) > 16)); - } -} - -/* Handle the FUNCTION_ARG_ADVANCE macro. - Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - TYPE is null for libcalls where that information may not be available. */ - -void -function_arg_advance (cum, mode, type, named) - CUMULATIVE_ARGS *cum; - enum machine_mode mode; - tree type; - int named; -{ - int slotno, regno, padding; - - /* We pass 0 for incoming_p here, it doesn't matter. */ - slotno = function_arg_slotno (cum, mode, type, named, 0, ®no, &padding); - - /* If register required leading padding, add it. */ - if (slotno != -1) - cum->words += padding; - - if (TARGET_ARCH32) - { - cum->words += (mode != BLKmode - ? ROUND_ADVANCE (GET_MODE_SIZE (mode)) - : ROUND_ADVANCE (int_size_in_bytes (type))); - } - else - { - if (type && AGGREGATE_TYPE_P (type)) - { - int size = int_size_in_bytes (type); - - if (size <= 8) - ++cum->words; - else if (size <= 16) - cum->words += 2; - else /* passed by reference */ - ++cum->words; - } - else if (GET_MODE_CLASS (mode) == MODE_COMPLEX_INT) - { - cum->words += 2; - } - else if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT) - { - cum->words += GET_MODE_SIZE (mode) / UNITS_PER_WORD; - } - else - { - cum->words += (mode != BLKmode - ? ROUND_ADVANCE (GET_MODE_SIZE (mode)) - : ROUND_ADVANCE (int_size_in_bytes (type))); - } - } -} - -/* Handle the FUNCTION_ARG_PADDING macro. - For the 64 bit ABI structs are always stored left shifted in their - argument slot. */ - -enum direction -function_arg_padding (mode, type) - enum machine_mode mode; - tree type; -{ - if (TARGET_ARCH64 && type != 0 && AGGREGATE_TYPE_P (type)) - return upward; - - /* This is the default definition. */ - return (! BYTES_BIG_ENDIAN - ? upward - : ((mode == BLKmode - ? (type && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST - && int_size_in_bytes (type) < (PARM_BOUNDARY / BITS_PER_UNIT)) - : GET_MODE_BITSIZE (mode) < PARM_BOUNDARY) - ? downward : upward)); -} - -/* Handle FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE, and LIBCALL_VALUE macros. - For v9, function return values are subject to the same rules as arguments, - except that up to 32-bytes may be returned in registers. */ - -rtx -function_value (type, mode, incoming_p) - tree type; - enum machine_mode mode; - int incoming_p; -{ - int regno; - int regbase = (incoming_p - ? SPARC_OUTGOING_INT_ARG_FIRST - : SPARC_INCOMING_INT_ARG_FIRST); - - if (TARGET_ARCH64 && type) - { - if (TREE_CODE (type) == RECORD_TYPE) - { - /* Structures up to 32 bytes in size are passed in registers, - promoted to fp registers where possible. */ - - if (int_size_in_bytes (type) > 32) - abort (); /* shouldn't get here */ - - return function_arg_record_value (type, mode, 0, 1, regbase); - } - else if (TREE_CODE (type) == UNION_TYPE) - { - int bytes = int_size_in_bytes (type); - - if (bytes > 32) - abort (); - - mode = mode_for_size (bytes * BITS_PER_UNIT, MODE_INT, 0); - } - } - - if (TARGET_ARCH64 - && GET_MODE_CLASS (mode) == MODE_INT - && GET_MODE_SIZE (mode) < UNITS_PER_WORD - && type && TREE_CODE (type) != UNION_TYPE) - mode = DImode; - - if (incoming_p) - regno = BASE_RETURN_VALUE_REG (mode); - else - regno = BASE_OUTGOING_VALUE_REG (mode); - - return gen_rtx_REG (mode, regno); -} - -/* Do what is necessary for `va_start'. The argument is ignored. - - We look at the current function to determine if stdarg or varargs - is used and return the address of the first unnamed parameter. */ - -rtx -sparc_builtin_saveregs (arglist) - tree arglist ATTRIBUTE_UNUSED; -{ - int first_reg = current_function_args_info.words; - rtx address; - int regno; - - for (regno = first_reg; regno < NPARM_REGS (word_mode); regno++) - emit_move_insn (gen_rtx_MEM (word_mode, - gen_rtx_PLUS (Pmode, - frame_pointer_rtx, - GEN_INT (STACK_POINTER_OFFSET - + UNITS_PER_WORD * regno))), - gen_rtx_REG (word_mode, - BASE_INCOMING_ARG_REG (word_mode) + regno)); - - address = gen_rtx_PLUS (Pmode, - frame_pointer_rtx, - GEN_INT (STACK_POINTER_OFFSET - + UNITS_PER_WORD * first_reg)); - - if (current_function_check_memory_usage - && first_reg < NPARM_REGS (word_mode)) - emit_library_call (chkr_set_right_libfunc, 1, VOIDmode, 3, - address, ptr_mode, - GEN_INT (UNITS_PER_WORD - * (NPARM_REGS (word_mode) - first_reg)), - TYPE_MODE (sizetype), GEN_INT (MEMORY_USE_RW), - TYPE_MODE (integer_type_node)); - - return address; -} - -/* Return the string to output a conditional branch to LABEL, which is - the operand number of the label. OP is the conditional expression. - XEXP (OP, 0) is assumed to be a condition code register (integer or - floating point) and its mode specifies what kind of comparison we made. - - REVERSED is non-zero if we should reverse the sense of the comparison. - - ANNUL is non-zero if we should generate an annulling branch. - - NOOP is non-zero if we have to follow this branch by a noop. - - INSN, if set, is the insn. */ - -char * -output_cbranch (op, label, reversed, annul, noop, insn) - rtx op; - int label; - int reversed, annul, noop; - rtx insn; -{ - static char string[32]; - enum rtx_code code = GET_CODE (op); - rtx cc_reg = XEXP (op, 0); - enum machine_mode mode = GET_MODE (cc_reg); - static char v8_labelno[] = "%lX"; - static char v9_icc_labelno[] = "%%icc, %lX"; - static char v9_xcc_labelno[] = "%%xcc, %lX"; - static char v9_fcc_labelno[] = "%%fccX, %lY"; - char *labelno; - int labeloff, spaces = 8; - - /* ??? !v9: FP branches cannot be preceded by another floating point insn. - Because there is currently no concept of pre-delay slots, we can fix - this only by always emitting a nop before a floating point branch. */ - - if ((mode == CCFPmode || mode == CCFPEmode) && ! TARGET_V9) - strcpy (string, "nop\n\t"); - else - string[0] = '\0'; - - /* If not floating-point or if EQ or NE, we can just reverse the code. */ - if (reversed - && ((mode != CCFPmode && mode != CCFPEmode) || code == EQ || code == NE)) - code = reverse_condition (code), reversed = 0; - - /* Start by writing the branch condition. */ - switch (code) - { - case NE: - if (mode == CCFPmode || mode == CCFPEmode) - { - strcat (string, "fbne"); - spaces -= 4; - } - else - { - strcpy (string, "bne"); - spaces -= 3; - } - break; - - case EQ: - if (mode == CCFPmode || mode == CCFPEmode) - { - strcat (string, "fbe"); - spaces -= 3; - } - else - { - strcpy (string, "be"); - spaces -= 2; - } - break; - - case GE: - if (mode == CCFPmode || mode == CCFPEmode) - { - if (reversed) - strcat (string, "fbul"); - else - strcat (string, "fbge"); - spaces -= 4; - } - else if (mode == CC_NOOVmode) - { - strcpy (string, "bpos"); - spaces -= 4; - } - else - { - strcpy (string, "bge"); - spaces -= 3; - } - break; - - case GT: - if (mode == CCFPmode || mode == CCFPEmode) - { - if (reversed) - { - strcat (string, "fbule"); - spaces -= 5; - } - else - { - strcat (string, "fbg"); - spaces -= 3; - } - } - else - { - strcpy (string, "bg"); - spaces -= 2; - } - break; - - case LE: - if (mode == CCFPmode || mode == CCFPEmode) - { - if (reversed) - strcat (string, "fbug"); - else - strcat (string, "fble"); - spaces -= 4; - } - else - { - strcpy (string, "ble"); - spaces -= 3; - } - break; - - case LT: - if (mode == CCFPmode || mode == CCFPEmode) - { - if (reversed) - { - strcat (string, "fbuge"); - spaces -= 5; - } - else - { - strcat (string, "fbl"); - spaces -= 3; - } - } - else if (mode == CC_NOOVmode) - { - strcpy (string, "bneg"); - spaces -= 4; - } - else - { - strcpy (string, "bl"); - spaces -= 2; - } - break; - - case GEU: - strcpy (string, "bgeu"); - spaces -= 4; - break; - - case GTU: - strcpy (string, "bgu"); - spaces -= 3; - break; - - case LEU: - strcpy (string, "bleu"); - spaces -= 4; - break; - - case LTU: - strcpy (string, "blu"); - spaces -= 3; - break; - - default: - abort (); - } - - /* Now add the annulling, the label, and a possible noop. */ - if (annul) - { - strcat (string, ",a"); - spaces -= 2; - } - - if (! TARGET_V9) - { - labeloff = 2; - labelno = v8_labelno; - } - else - { - rtx note; - - if (insn && (note = find_reg_note (insn, REG_BR_PRED, NULL_RTX))) - { - strcat (string, - INTVAL (XEXP (note, 0)) & ATTR_FLAG_likely ? ",pt" : ",pn"); - spaces -= 3; - } - - labeloff = 9; - if (mode == CCFPmode || mode == CCFPEmode) - { - labeloff = 10; - labelno = v9_fcc_labelno; - /* Set the char indicating the number of the fcc reg to use. */ - labelno[5] = REGNO (cc_reg) - SPARC_FIRST_V9_FCC_REG + '0'; - } - else if (mode == CCXmode || mode == CCX_NOOVmode) - labelno = v9_xcc_labelno; - else - labelno = v9_icc_labelno; - } - /* Set the char indicating the number of the operand containing the - label_ref. */ - labelno[labeloff] = label + '0'; - if (spaces > 0) - strcat (string, "\t"); - else - strcat (string, " "); - strcat (string, labelno); - - if (noop) - strcat (string, "\n\tnop"); - - return string; -} - -/* Return the string to output a conditional branch to LABEL, testing - register REG. LABEL is the operand number of the label; REG is the - operand number of the reg. OP is the conditional expression. The mode - of REG says what kind of comparison we made. - - REVERSED is non-zero if we should reverse the sense of the comparison. - - ANNUL is non-zero if we should generate an annulling branch. - - NOOP is non-zero if we have to follow this branch by a noop. */ - -char * -output_v9branch (op, reg, label, reversed, annul, noop, insn) - rtx op; - int reg, label; - int reversed, annul, noop; - rtx insn; -{ - static char string[20]; - enum rtx_code code = GET_CODE (op); - enum machine_mode mode = GET_MODE (XEXP (op, 0)); - static char labelno[] = "%X, %lX"; - rtx note; - int spaces = 8; - - /* If not floating-point or if EQ or NE, we can just reverse the code. */ - if (reversed) - code = reverse_condition (code), reversed = 0; - - /* Only 64 bit versions of these instructions exist. */ - if (mode != DImode) - abort (); - - /* Start by writing the branch condition. */ - - switch (code) - { - case NE: - strcpy (string, "brnz"); - spaces -= 4; - break; - - case EQ: - strcpy (string, "brz"); - spaces -= 3; - break; - - case GE: - strcpy (string, "brgez"); - spaces -= 5; - break; - - case LT: - strcpy (string, "brlz"); - spaces -= 4; - break; - - case LE: - strcpy (string, "brlez"); - spaces -= 5; - break; - - case GT: - strcpy (string, "brgz"); - spaces -= 4; - break; - - default: - abort (); - } - - /* Now add the annulling, reg, label, and nop. */ - if (annul) - { - strcat (string, ",a"); - spaces -= 2; - } - - if (insn && (note = find_reg_note (insn, REG_BR_PRED, NULL_RTX))) - { - strcat (string, - INTVAL (XEXP (note, 0)) & ATTR_FLAG_likely ? ",pt" : ",pn"); - spaces -= 3; - } - - labelno[1] = reg + '0'; - labelno[6] = label + '0'; - if (spaces > 0) - strcat (string, "\t"); - else - strcat (string, " "); - strcat (string, labelno); - - if (noop) - strcat (string, "\n\tnop"); - - return string; -} - -/* Renumber registers in delay slot. Replace registers instead of - renumbering because they may be shared. - - This does not handle instructions other than move. */ - -static void -epilogue_renumber (where) - rtx *where; -{ - rtx x = *where; - enum rtx_code code = GET_CODE (x); - - switch (code) - { - case MEM: - *where = x = copy_rtx (x); - epilogue_renumber (&XEXP (x, 0)); - return; - - case REG: - { - int regno = REGNO (x); - if (regno > 8 && regno < 24) - abort (); - if (regno >= 24 && regno < 32) - *where = gen_rtx_REG (GET_MODE (x), regno - 16); - return; - } - case CONST_INT: - case CONST_DOUBLE: - case CONST: - case SYMBOL_REF: - case LABEL_REF: - return; - - case IOR: - case AND: - case XOR: - case PLUS: - case MINUS: - epilogue_renumber (&XEXP (x, 1)); - case NEG: - case NOT: - epilogue_renumber (&XEXP (x, 0)); - return; - - default: - debug_rtx (*where); - abort (); - } -} - -/* Output assembler code to return from a function. */ - -const char * -output_return (operands) - rtx *operands; -{ - rtx delay = final_sequence ? XVECEXP (final_sequence, 0, 1) : 0; - - if (leaf_label) - { - operands[0] = leaf_label; - return "b%* %l0%("; - } - else if (current_function_uses_only_leaf_regs) - { - /* No delay slot in a leaf function. */ - if (delay) - abort (); - - /* If we didn't allocate a frame pointer for the current function, - the stack pointer might have been adjusted. Output code to - restore it now. */ - - operands[0] = GEN_INT (actual_fsize); - - /* Use sub of negated value in first two cases instead of add to - allow actual_fsize == 4096. */ - - if (actual_fsize <= 4096) - { - if (SKIP_CALLERS_UNIMP_P) - return "jmp\t%%o7+12\n\tsub\t%%sp, -%0, %%sp"; - else - return "retl\n\tsub\t%%sp, -%0, %%sp"; - } - else if (actual_fsize <= 8192) - { - operands[0] = GEN_INT (actual_fsize - 4096); - if (SKIP_CALLERS_UNIMP_P) - return "sub\t%%sp, -4096, %%sp\n\tjmp\t%%o7+12\n\tsub\t%%sp, -%0, %%sp"; - else - return "sub\t%%sp, -4096, %%sp\n\tretl\n\tsub\t%%sp, -%0, %%sp"; - } - else if (SKIP_CALLERS_UNIMP_P) - { - if ((actual_fsize & 0x3ff) != 0) - return "sethi\t%%hi(%a0), %%g1\n\tor\t%%g1, %%lo(%a0), %%g1\n\tjmp\t%%o7+12\n\tadd\t%%sp, %%g1, %%sp"; - else - return "sethi\t%%hi(%a0), %%g1\n\tjmp\t%%o7+12\n\tadd\t%%sp, %%g1, %%sp"; - } - else - { - if ((actual_fsize & 0x3ff) != 0) - return "sethi %%hi(%a0),%%g1\n\tor %%g1,%%lo(%a0),%%g1\n\tretl\n\tadd %%sp,%%g1,%%sp"; - else - return "sethi %%hi(%a0),%%g1\n\tretl\n\tadd %%sp,%%g1,%%sp"; - } - } - else if (TARGET_V9) - { - if (delay) - { - epilogue_renumber (&SET_DEST (PATTERN (delay))); - epilogue_renumber (&SET_SRC (PATTERN (delay))); - } - if (SKIP_CALLERS_UNIMP_P) - return "return\t%%i7+12%#"; - else - return "return\t%%i7+8%#"; - } - else - { - if (delay) - abort (); - if (SKIP_CALLERS_UNIMP_P) - return "jmp\t%%i7+12\n\trestore"; - else - return "ret\n\trestore"; - } -} - -/* Leaf functions and non-leaf functions have different needs. */ - -static int -reg_leaf_alloc_order[] = REG_LEAF_ALLOC_ORDER; - -static int -reg_nonleaf_alloc_order[] = REG_ALLOC_ORDER; - -static int *reg_alloc_orders[] = { - reg_leaf_alloc_order, - reg_nonleaf_alloc_order}; - -void -order_regs_for_local_alloc () -{ - static int last_order_nonleaf = 1; - - if (regs_ever_live[15] != last_order_nonleaf) - { - last_order_nonleaf = !last_order_nonleaf; - bcopy ((char *) reg_alloc_orders[last_order_nonleaf], - (char *) reg_alloc_order, FIRST_PSEUDO_REGISTER * sizeof (int)); - } -} - -/* Return 1 if REG and MEM are legitimate enough to allow the various - mem<-->reg splits to be run. */ - -int -sparc_splitdi_legitimate (reg, mem) - rtx reg; - rtx mem; -{ - /* Punt if we are here by mistake. */ - if (! reload_completed) - abort (); - - /* We must have an offsettable memory reference. */ - if (! offsettable_memref_p (mem)) - return 0; - - /* If we have legitimate args for ldd/std, we do not want - the split to happen. */ - if ((REGNO (reg) % 2) == 0 - && mem_min_alignment (mem, 8)) - return 0; - - /* Success. */ - return 1; -} - -/* Return 1 if x and y are some kind of REG and they refer to - different hard registers. This test is guarenteed to be - run after reload. */ - -int -sparc_absnegfloat_split_legitimate (x, y) - rtx x, y; -{ - if (GET_CODE (x) == SUBREG) - x = alter_subreg (x); - if (GET_CODE (x) != REG) - return 0; - if (GET_CODE (y) == SUBREG) - y = alter_subreg (y); - if (GET_CODE (y) != REG) - return 0; - if (REGNO (x) == REGNO (y)) - return 0; - return 1; -} - -/* Return 1 if REGNO (reg1) is even and REGNO (reg1) == REGNO (reg2) - 1. - This makes them candidates for using ldd and std insns. - - Note reg1 and reg2 *must* be hard registers. */ - -int -registers_ok_for_ldd_peep (reg1, reg2) - rtx reg1, reg2; -{ - /* We might have been passed a SUBREG. */ - if (GET_CODE (reg1) != REG || GET_CODE (reg2) != REG) - return 0; - - if (REGNO (reg1) % 2 != 0) - return 0; - - /* Integer ldd is deprecated in SPARC V9 */ - if (TARGET_V9 && REGNO (reg1) < 32) - return 0; - - return (REGNO (reg1) == REGNO (reg2) - 1); -} - -/* Return 1 if addr1 and addr2 are suitable for use in an ldd or - std insn. - - This can only happen when addr1 and addr2 are consecutive memory - locations (addr1 + 4 == addr2). addr1 must also be aligned on a - 64 bit boundary (addr1 % 8 == 0). - - We know %sp and %fp are kept aligned on a 64 bit boundary. Other - registers are assumed to *never* be properly aligned and are - rejected. - - Knowing %sp and %fp are kept aligned on a 64 bit boundary, we - need only check that the offset for addr1 % 8 == 0. */ - -int -addrs_ok_for_ldd_peep (addr1, addr2) - rtx addr1, addr2; -{ - int reg1, offset1; - - /* Extract a register number and offset (if used) from the first addr. */ - if (GET_CODE (addr1) == PLUS) - { - /* If not a REG, return zero. */ - if (GET_CODE (XEXP (addr1, 0)) != REG) - return 0; - else - { - reg1 = REGNO (XEXP (addr1, 0)); - /* The offset must be constant! */ - if (GET_CODE (XEXP (addr1, 1)) != CONST_INT) - return 0; - offset1 = INTVAL (XEXP (addr1, 1)); - } - } - else if (GET_CODE (addr1) != REG) - return 0; - else - { - reg1 = REGNO (addr1); - /* This was a simple (mem (reg)) expression. Offset is 0. */ - offset1 = 0; - } - - /* Make sure the second address is a (mem (plus (reg) (const_int). */ - if (GET_CODE (addr2) != PLUS) - return 0; - - if (GET_CODE (XEXP (addr2, 0)) != REG - || GET_CODE (XEXP (addr2, 1)) != CONST_INT) - return 0; - - /* Only %fp and %sp are allowed. Additionally both addresses must - use the same register. */ - if (reg1 != FRAME_POINTER_REGNUM && reg1 != STACK_POINTER_REGNUM) - return 0; - - if (reg1 != REGNO (XEXP (addr2, 0))) - return 0; - - /* The first offset must be evenly divisible by 8 to ensure the - address is 64 bit aligned. */ - if (offset1 % 8 != 0) - return 0; - - /* The offset for the second addr must be 4 more than the first addr. */ - if (INTVAL (XEXP (addr2, 1)) != offset1 + 4) - return 0; - - /* All the tests passed. addr1 and addr2 are valid for ldd and std - instructions. */ - return 1; -} - -/* Return 1 if reg is a pseudo, or is the first register in - a hard register pair. This makes it a candidate for use in - ldd and std insns. */ - -int -register_ok_for_ldd (reg) - rtx reg; -{ - /* We might have been passed a SUBREG. */ - if (GET_CODE (reg) != REG) - return 0; - - if (REGNO (reg) < FIRST_PSEUDO_REGISTER) - return (REGNO (reg) % 2 == 0); - else - return 1; -} - -/* Print operand X (an rtx) in assembler syntax to file FILE. - CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. - For `%' followed by punctuation, CODE is the punctuation and X is null. */ - -void -print_operand (file, x, code) - FILE *file; - rtx x; - int code; -{ - switch (code) - { - case '#': - /* Output a 'nop' if there's nothing for the delay slot. */ - if (dbr_sequence_length () == 0) - fputs ("\n\t nop", file); - return; - case '*': - /* Output an annul flag if there's nothing for the delay slot and we - are optimizing. This is always used with '(' below. */ - /* Sun OS 4.1.1 dbx can't handle an annulled unconditional branch; - this is a dbx bug. So, we only do this when optimizing. */ - /* On UltraSPARC, a branch in a delay slot causes a pipeline flush. - Always emit a nop in case the next instruction is a branch. */ - if (dbr_sequence_length () == 0 - && (optimize && (int)sparc_cpu < PROCESSOR_V9)) - fputs (",a", file); - return; - case '(': - /* Output a 'nop' if there's nothing for the delay slot and we are - not optimizing. This is always used with '*' above. */ - if (dbr_sequence_length () == 0 - && ! (optimize && (int)sparc_cpu < PROCESSOR_V9)) - fputs ("\n\t nop", file); - return; - case '_': - /* Output the Embedded Medium/Anywhere code model base register. */ - fputs (EMBMEDANY_BASE_REG, file); - return; - case '@': - /* Print out what we are using as the frame pointer. This might - be %fp, or might be %sp+offset. */ - /* ??? What if offset is too big? Perhaps the caller knows it isn't? */ - fprintf (file, "%s+%d", frame_base_name, frame_base_offset); - return; - case 'Y': - /* Adjust the operand to take into account a RESTORE operation. */ - if (GET_CODE (x) == CONST_INT) - break; - else if (GET_CODE (x) != REG) - output_operand_lossage ("Invalid %%Y operand"); - else if (REGNO (x) < 8) - fputs (reg_names[REGNO (x)], file); - else if (REGNO (x) >= 24 && REGNO (x) < 32) - fputs (reg_names[REGNO (x)-16], file); - else - output_operand_lossage ("Invalid %%Y operand"); - return; - case 'L': - /* Print out the low order register name of a register pair. */ - if (WORDS_BIG_ENDIAN) - fputs (reg_names[REGNO (x)+1], file); - else - fputs (reg_names[REGNO (x)], file); - return; - case 'H': - /* Print out the high order register name of a register pair. */ - if (WORDS_BIG_ENDIAN) - fputs (reg_names[REGNO (x)], file); - else - fputs (reg_names[REGNO (x)+1], file); - return; - case 'R': - /* Print out the second register name of a register pair or quad. - I.e., R (%o0) => %o1. */ - fputs (reg_names[REGNO (x)+1], file); - return; - case 'S': - /* Print out the third register name of a register quad. - I.e., S (%o0) => %o2. */ - fputs (reg_names[REGNO (x)+2], file); - return; - case 'T': - /* Print out the fourth register name of a register quad. - I.e., T (%o0) => %o3. */ - fputs (reg_names[REGNO (x)+3], file); - return; - case 'x': - /* Print a condition code register. */ - if (REGNO (x) == SPARC_ICC_REG) - { - /* We don't handle CC[X]_NOOVmode because they're not supposed - to occur here. */ - if (GET_MODE (x) == CCmode) - fputs ("%icc", file); - else if (GET_MODE (x) == CCXmode) - fputs ("%xcc", file); - else - abort (); - } - else - /* %fccN register */ - fputs (reg_names[REGNO (x)], file); - return; - case 'm': - /* Print the operand's address only. */ - output_address (XEXP (x, 0)); - return; - case 'r': - /* In this case we need a register. Use %g0 if the - operand is const0_rtx. */ - if (x == const0_rtx - || (GET_MODE (x) != VOIDmode && x == CONST0_RTX (GET_MODE (x)))) - { - fputs ("%g0", file); - return; - } - else - break; - - case 'A': - switch (GET_CODE (x)) - { - case IOR: fputs ("or", file); break; - case AND: fputs ("and", file); break; - case XOR: fputs ("xor", file); break; - default: output_operand_lossage ("Invalid %%A operand"); - } - return; - - case 'B': - switch (GET_CODE (x)) - { - case IOR: fputs ("orn", file); break; - case AND: fputs ("andn", file); break; - case XOR: fputs ("xnor", file); break; - default: output_operand_lossage ("Invalid %%B operand"); - } - return; - - /* These are used by the conditional move instructions. */ - case 'c' : - case 'C': - { - enum rtx_code rc = (code == 'c' - ? reverse_condition (GET_CODE (x)) - : GET_CODE (x)); - switch (rc) - { - case NE: fputs ("ne", file); break; - case EQ: fputs ("e", file); break; - case GE: fputs ("ge", file); break; - case GT: fputs ("g", file); break; - case LE: fputs ("le", file); break; - case LT: fputs ("l", file); break; - case GEU: fputs ("geu", file); break; - case GTU: fputs ("gu", file); break; - case LEU: fputs ("leu", file); break; - case LTU: fputs ("lu", file); break; - default: output_operand_lossage (code == 'c' - ? "Invalid %%c operand" - : "Invalid %%C operand"); - } - return; - } - - /* These are used by the movr instruction pattern. */ - case 'd': - case 'D': - { - enum rtx_code rc = (code == 'd' - ? reverse_condition (GET_CODE (x)) - : GET_CODE (x)); - switch (rc) - { - case NE: fputs ("ne", file); break; - case EQ: fputs ("e", file); break; - case GE: fputs ("gez", file); break; - case LT: fputs ("lz", file); break; - case LE: fputs ("lez", file); break; - case GT: fputs ("gz", file); break; - default: output_operand_lossage (code == 'd' - ? "Invalid %%d operand" - : "Invalid %%D operand"); - } - return; - } - - case 'b': - { - /* Print a sign-extended character. */ - int i = INTVAL (x) & 0xff; - if (i & 0x80) - i |= 0xffffff00; - fprintf (file, "%d", i); - return; - } - - case 'f': - /* Operand must be a MEM; write its address. */ - if (GET_CODE (x) != MEM) - output_operand_lossage ("Invalid %%f operand"); - output_address (XEXP (x, 0)); - return; - - case 0: - /* Do nothing special. */ - break; - - default: - /* Undocumented flag. */ - output_operand_lossage ("invalid operand output code"); - } - - if (GET_CODE (x) == REG) - fputs (reg_names[REGNO (x)], file); - else if (GET_CODE (x) == MEM) - { - fputc ('[', file); - /* Poor Sun assembler doesn't understand absolute addressing. */ - if (CONSTANT_P (XEXP (x, 0)) - && ! TARGET_LIVE_G0) - fputs ("%g0+", file); - output_address (XEXP (x, 0)); - fputc (']', file); - } - else if (GET_CODE (x) == HIGH) - { - fputs ("%hi(", file); - output_addr_const (file, XEXP (x, 0)); - fputc (')', file); - } - else if (GET_CODE (x) == LO_SUM) - { - print_operand (file, XEXP (x, 0), 0); - if (TARGET_CM_MEDMID) - fputs ("+%l44(", file); - else - fputs ("+%lo(", file); - output_addr_const (file, XEXP (x, 1)); - fputc (')', file); - } - else if (GET_CODE (x) == CONST_DOUBLE - && (GET_MODE (x) == VOIDmode - || GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)) - { - if (CONST_DOUBLE_HIGH (x) == 0) - fprintf (file, "%u", CONST_DOUBLE_LOW (x)); - else if (CONST_DOUBLE_HIGH (x) == -1 - && CONST_DOUBLE_LOW (x) < 0) - fprintf (file, "%d", CONST_DOUBLE_LOW (x)); - else - output_operand_lossage ("long long constant not a valid immediate operand"); - } - else if (GET_CODE (x) == CONST_DOUBLE) - output_operand_lossage ("floating point constant not a valid immediate operand"); - else { output_addr_const (file, x); } -} - -/* This function outputs assembler code for VALUE to FILE, where VALUE is - a 64 bit (DImode) value. */ - -/* ??? If there is a 64 bit counterpart to .word that the assembler - understands, then using that would simply this code greatly. */ -/* ??? We only output .xword's for symbols and only then in environments - where the assembler can handle them. */ - -void -output_double_int (file, value) - FILE *file; - rtx value; -{ - if (GET_CODE (value) == CONST_INT) - { - /* ??? This has endianness issues. */ -#if HOST_BITS_PER_WIDE_INT == 64 - HOST_WIDE_INT xword = INTVAL (value); - HOST_WIDE_INT high, low; - - high = (xword >> 32) & 0xffffffff; - low = xword & 0xffffffff; - ASM_OUTPUT_INT (file, GEN_INT (high)); - ASM_OUTPUT_INT (file, GEN_INT (low)); -#else - if (INTVAL (value) < 0) - ASM_OUTPUT_INT (file, constm1_rtx); - else - ASM_OUTPUT_INT (file, const0_rtx); - ASM_OUTPUT_INT (file, value); -#endif - } - else if (GET_CODE (value) == CONST_DOUBLE) - { - ASM_OUTPUT_INT (file, GEN_INT (CONST_DOUBLE_HIGH (value))); - ASM_OUTPUT_INT (file, GEN_INT (CONST_DOUBLE_LOW (value))); - } - else if (GET_CODE (value) == SYMBOL_REF - || GET_CODE (value) == CONST - || GET_CODE (value) == PLUS - || (TARGET_ARCH64 && - (GET_CODE (value) == LABEL_REF - || GET_CODE (value) == CODE_LABEL - || GET_CODE (value) == MINUS))) - { - if (! TARGET_V9) - { - ASM_OUTPUT_INT (file, const0_rtx); - ASM_OUTPUT_INT (file, value); - } - else - { - fprintf (file, "\t%s\t", ASM_LONGLONG); - output_addr_const (file, value); - fprintf (file, "\n"); - } - } - else - abort (); -} - -/* Return the value of a code used in the .proc pseudo-op that says - what kind of result this function returns. For non-C types, we pick - the closest C type. */ - -#ifndef CHAR_TYPE_SIZE -#define CHAR_TYPE_SIZE BITS_PER_UNIT -#endif - -#ifndef SHORT_TYPE_SIZE -#define SHORT_TYPE_SIZE (BITS_PER_UNIT * 2) -#endif - -#ifndef INT_TYPE_SIZE -#define INT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_LONG_TYPE_SIZE -#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef FLOAT_TYPE_SIZE -#define FLOAT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef DOUBLE_TYPE_SIZE -#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -unsigned long -sparc_type_code (type) - register tree type; -{ - register unsigned long qualifiers = 0; - register unsigned shift; - - /* Only the first 30 bits of the qualifier are valid. We must refrain from - setting more, since some assemblers will give an error for this. Also, - we must be careful to avoid shifts of 32 bits or more to avoid getting - unpredictable results. */ - - for (shift = 6; shift < 30; shift += 2, type = TREE_TYPE (type)) - { - switch (TREE_CODE (type)) - { - case ERROR_MARK: - return qualifiers; - - case ARRAY_TYPE: - qualifiers |= (3 << shift); - break; - - case FUNCTION_TYPE: - case METHOD_TYPE: - qualifiers |= (2 << shift); - break; - - case POINTER_TYPE: - case REFERENCE_TYPE: - case OFFSET_TYPE: - qualifiers |= (1 << shift); - break; - - case RECORD_TYPE: - return (qualifiers | 8); - - case UNION_TYPE: - case QUAL_UNION_TYPE: - return (qualifiers | 9); - - case ENUMERAL_TYPE: - return (qualifiers | 10); - - case VOID_TYPE: - return (qualifiers | 16); - - case INTEGER_TYPE: - /* If this is a range type, consider it to be the underlying - type. */ - if (TREE_TYPE (type) != 0) - break; - - /* Carefully distinguish all the standard types of C, - without messing up if the language is not C. We do this by - testing TYPE_PRECISION and TREE_UNSIGNED. The old code used to - look at both the names and the above fields, but that's redundant. - Any type whose size is between two C types will be considered - to be the wider of the two types. Also, we do not have a - special code to use for "long long", so anything wider than - long is treated the same. Note that we can't distinguish - between "int" and "long" in this code if they are the same - size, but that's fine, since neither can the assembler. */ - - if (TYPE_PRECISION (type) <= CHAR_TYPE_SIZE) - return (qualifiers | (TREE_UNSIGNED (type) ? 12 : 2)); - - else if (TYPE_PRECISION (type) <= SHORT_TYPE_SIZE) - return (qualifiers | (TREE_UNSIGNED (type) ? 13 : 3)); - - else if (TYPE_PRECISION (type) <= INT_TYPE_SIZE) - return (qualifiers | (TREE_UNSIGNED (type) ? 14 : 4)); - - else - return (qualifiers | (TREE_UNSIGNED (type) ? 15 : 5)); - - case REAL_TYPE: - /* If this is a range type, consider it to be the underlying - type. */ - if (TREE_TYPE (type) != 0) - break; - - /* Carefully distinguish all the standard types of C, - without messing up if the language is not C. */ - - if (TYPE_PRECISION (type) == FLOAT_TYPE_SIZE) - return (qualifiers | 6); - - else - return (qualifiers | 7); - - case COMPLEX_TYPE: /* GNU Fortran COMPLEX type. */ - /* ??? We need to distinguish between double and float complex types, - but I don't know how yet because I can't reach this code from - existing front-ends. */ - return (qualifiers | 7); /* Who knows? */ - - case CHAR_TYPE: /* GNU Pascal CHAR type. Not used in C. */ - case BOOLEAN_TYPE: /* GNU Fortran BOOLEAN type. */ - case FILE_TYPE: /* GNU Pascal FILE type. */ - case SET_TYPE: /* GNU Pascal SET type. */ - case LANG_TYPE: /* ? */ - return qualifiers; - - default: - abort (); /* Not a type! */ - } - } - - return qualifiers; -} - -/* Nested function support. */ - -/* Emit RTL insns to initialize the variable parts of a trampoline. - FNADDR is an RTX for the address of the function's pure code. - CXT is an RTX for the static chain value for the function. - - This takes 16 insns: 2 shifts & 2 ands (to split up addresses), 4 sethi - (to load in opcodes), 4 iors (to merge address and opcodes), and 4 writes - (to store insns). This is a bit excessive. Perhaps a different - mechanism would be better here. - - Emit enough FLUSH insns to synchronize the data and instruction caches. */ - -void -sparc_initialize_trampoline (tramp, fnaddr, cxt) - rtx tramp, fnaddr, cxt; -{ - /* SPARC 32 bit trampoline: - - sethi %hi(fn), %g1 - sethi %hi(static), %g2 - jmp %g1+%lo(fn) - or %g2, %lo(static), %g2 - - SETHI i,r = 00rr rrr1 00ii iiii iiii iiii iiii iiii - JMPL r+i,d = 10dd ddd1 1100 0rrr rr1i iiii iiii iiii - */ -#ifdef TRANSFER_FROM_TRAMPOLINE - emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__enable_execute_stack"), - 0, VOIDmode, 1, tramp, Pmode); -#endif - - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 0)), - expand_binop (SImode, ior_optab, - expand_shift (RSHIFT_EXPR, SImode, fnaddr, - size_int (10), 0, 1), - GEN_INT (0x03000000), - NULL_RTX, 1, OPTAB_DIRECT)); - - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 4)), - expand_binop (SImode, ior_optab, - expand_shift (RSHIFT_EXPR, SImode, cxt, - size_int (10), 0, 1), - GEN_INT (0x05000000), - NULL_RTX, 1, OPTAB_DIRECT)); - - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 8)), - expand_binop (SImode, ior_optab, - expand_and (fnaddr, GEN_INT (0x3ff), NULL_RTX), - GEN_INT (0x81c06000), - NULL_RTX, 1, OPTAB_DIRECT)); - - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 12)), - expand_binop (SImode, ior_optab, - expand_and (cxt, GEN_INT (0x3ff), NULL_RTX), - GEN_INT (0x8410a000), - NULL_RTX, 1, OPTAB_DIRECT)); - - emit_insn (gen_flush (validize_mem (gen_rtx_MEM (SImode, tramp)))); - /* On UltraSPARC a flush flushes an entire cache line. The trampoline is - aligned on a 16 byte boundary so one flush clears it all. */ - if (sparc_cpu != PROCESSOR_ULTRASPARC) - emit_insn (gen_flush (validize_mem (gen_rtx_MEM (SImode, - plus_constant (tramp, 8))))); -} - -/* The 64 bit version is simpler because it makes more sense to load the - values as "immediate" data out of the trampoline. It's also easier since - we can read the PC without clobbering a register. */ - -void -sparc64_initialize_trampoline (tramp, fnaddr, cxt) - rtx tramp, fnaddr, cxt; -{ -#ifdef TRANSFER_FROM_TRAMPOLINE - emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__enable_execute_stack"), - 0, VOIDmode, 1, tramp, Pmode); -#endif - - /* - rd %pc, %g1 - ldx [%g1+24], %g5 - jmp %g5 - ldx [%g1+16], %g5 - +16 bytes data - */ - - emit_move_insn (gen_rtx_MEM (SImode, tramp), - GEN_INT (0x83414000)); - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 4)), - GEN_INT (0xca586018)); - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 8)), - GEN_INT (0x81c14000)); - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 12)), - GEN_INT (0xca586010)); - emit_move_insn (gen_rtx_MEM (DImode, plus_constant (tramp, 16)), cxt); - emit_move_insn (gen_rtx_MEM (DImode, plus_constant (tramp, 24)), fnaddr); - emit_insn (gen_flush (validize_mem (gen_rtx_MEM (DImode, tramp)))); - - if (sparc_cpu != PROCESSOR_ULTRASPARC) - emit_insn (gen_flush (validize_mem (gen_rtx_MEM (DImode, plus_constant (tramp, 8))))); -} - -/* Subroutines to support a flat (single) register window calling - convention. */ - -/* Single-register window sparc stack frames look like: - - Before call After call - +-----------------------+ +-----------------------+ - high | | | | - mem | caller's temps. | | caller's temps. | - | | | | - +-----------------------+ +-----------------------+ - | | | | - | arguments on stack. | | arguments on stack. | - | | | | - +-----------------------+FP+92->+-----------------------+ - | 6 words to save | | 6 words to save | - | arguments passed | | arguments passed | - | in registers, even | | in registers, even | - | if not passed. | | if not passed. | - SP+68->+-----------------------+FP+68->+-----------------------+ - | 1 word struct addr | | 1 word struct addr | - +-----------------------+FP+64->+-----------------------+ - | | | | - | 16 word reg save area | | 16 word reg save area | - | | | | - SP->+-----------------------+ FP->+-----------------------+ - | 4 word area for | - | fp/alu reg moves | - FP-16->+-----------------------+ - | | - | local variables | - | | - +-----------------------+ - | | - | fp register save | - | | - +-----------------------+ - | | - | gp register save | - | | - +-----------------------+ - | | - | alloca allocations | - | | - +-----------------------+ - | | - | arguments on stack | - | | - SP+92->+-----------------------+ - | 6 words to save | - | arguments passed | - | in registers, even | - low | if not passed. | - memory SP+68->+-----------------------+ - | 1 word struct addr | - SP+64->+-----------------------+ - | | - I 16 word reg save area | - | | - SP->+-----------------------+ */ - -/* Structure to be filled in by sparc_flat_compute_frame_size with register - save masks, and offsets for the current function. */ - -struct sparc_frame_info -{ - unsigned long total_size; /* # bytes that the entire frame takes up. */ - unsigned long var_size; /* # bytes that variables take up. */ - unsigned long args_size; /* # bytes that outgoing arguments take up. */ - unsigned long extra_size; /* # bytes of extra gunk. */ - unsigned int gp_reg_size; /* # bytes needed to store gp regs. */ - unsigned int fp_reg_size; /* # bytes needed to store fp regs. */ - unsigned long gmask; /* Mask of saved gp registers. */ - unsigned long fmask; /* Mask of saved fp registers. */ - unsigned long reg_offset; /* Offset from new sp to store regs. */ - int initialized; /* Nonzero if frame size already calculated. */ -}; - -/* Current frame information calculated by sparc_flat_compute_frame_size. */ -struct sparc_frame_info current_frame_info; - -/* Zero structure to initialize current_frame_info. */ -struct sparc_frame_info zero_frame_info; - -/* Tell prologue and epilogue if register REGNO should be saved / restored. */ - -#define RETURN_ADDR_REGNUM 15 -#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM)) -#define RETURN_ADDR_MASK (1 << (RETURN_ADDR_REGNUM)) - -#define MUST_SAVE_REGISTER(regno) \ - ((regs_ever_live[regno] && !call_used_regs[regno]) \ - || (regno == FRAME_POINTER_REGNUM && frame_pointer_needed) \ - || (regno == RETURN_ADDR_REGNUM && regs_ever_live[RETURN_ADDR_REGNUM])) - -/* Return the bytes needed to compute the frame pointer from the current - stack pointer. */ - -unsigned long -sparc_flat_compute_frame_size (size) - int size; /* # of var. bytes allocated. */ -{ - int regno; - unsigned long total_size; /* # bytes that the entire frame takes up. */ - unsigned long var_size; /* # bytes that variables take up. */ - unsigned long args_size; /* # bytes that outgoing arguments take up. */ - unsigned long extra_size; /* # extra bytes. */ - unsigned int gp_reg_size; /* # bytes needed to store gp regs. */ - unsigned int fp_reg_size; /* # bytes needed to store fp regs. */ - unsigned long gmask; /* Mask of saved gp registers. */ - unsigned long fmask; /* Mask of saved fp registers. */ - unsigned long reg_offset; /* Offset to register save area. */ - int need_aligned_p; /* 1 if need the save area 8 byte aligned. */ - - /* This is the size of the 16 word reg save area, 1 word struct addr - area, and 4 word fp/alu register copy area. */ - extra_size = -STARTING_FRAME_OFFSET + FIRST_PARM_OFFSET(0); - var_size = size; - gp_reg_size = 0; - fp_reg_size = 0; - gmask = 0; - fmask = 0; - reg_offset = 0; - need_aligned_p = 0; - - args_size = 0; - if (!leaf_function_p ()) - { - /* Also include the size needed for the 6 parameter registers. */ - args_size = current_function_outgoing_args_size + 24; - } - total_size = var_size + args_size; - - /* Calculate space needed for gp registers. */ - for (regno = 1; regno <= 31; regno++) - { - if (MUST_SAVE_REGISTER (regno)) - { - /* If we need to save two regs in a row, ensure there's room to bump - up the address to align it to a doubleword boundary. */ - if ((regno & 0x1) == 0 && MUST_SAVE_REGISTER (regno+1)) - { - if (gp_reg_size % 8 != 0) - gp_reg_size += 4; - gp_reg_size += 2 * UNITS_PER_WORD; - gmask |= 3 << regno; - regno++; - need_aligned_p = 1; - } - else - { - gp_reg_size += UNITS_PER_WORD; - gmask |= 1 << regno; - } - } - } - - /* Calculate space needed for fp registers. */ - for (regno = 32; regno <= 63; regno++) - { - if (regs_ever_live[regno] && !call_used_regs[regno]) - { - fp_reg_size += UNITS_PER_WORD; - fmask |= 1 << (regno - 32); - } - } - - if (gmask || fmask) - { - int n; - reg_offset = FIRST_PARM_OFFSET(0) + args_size; - /* Ensure save area is 8 byte aligned if we need it. */ - n = reg_offset % 8; - if (need_aligned_p && n != 0) - { - total_size += 8 - n; - reg_offset += 8 - n; - } - total_size += gp_reg_size + fp_reg_size; - } - - /* If we must allocate a stack frame at all, we must also allocate - room for register window spillage, so as to be binary compatible - with libraries and operating systems that do not use -mflat. */ - if (total_size > 0) - total_size += extra_size; - else - extra_size = 0; - - total_size = SPARC_STACK_ALIGN (total_size); - - /* Save other computed information. */ - current_frame_info.total_size = total_size; - current_frame_info.var_size = var_size; - current_frame_info.args_size = args_size; - current_frame_info.extra_size = extra_size; - current_frame_info.gp_reg_size = gp_reg_size; - current_frame_info.fp_reg_size = fp_reg_size; - current_frame_info.gmask = gmask; - current_frame_info.fmask = fmask; - current_frame_info.reg_offset = reg_offset; - current_frame_info.initialized = reload_completed; - - /* Ok, we're done. */ - return total_size; -} - -/* Save/restore registers in GMASK and FMASK at register BASE_REG plus offset - OFFSET. - - BASE_REG must be 8 byte aligned. This allows us to test OFFSET for - appropriate alignment and use DOUBLEWORD_OP when we can. We assume - [BASE_REG+OFFSET] will always be a valid address. - - WORD_OP is either "st" for save, "ld" for restore. - DOUBLEWORD_OP is either "std" for save, "ldd" for restore. */ - -void -sparc_flat_save_restore (file, base_reg, offset, gmask, fmask, word_op, - doubleword_op, base_offset) - FILE *file; - char *base_reg; - unsigned int offset; - unsigned long gmask; - unsigned long fmask; - char *word_op; - char *doubleword_op; - unsigned long base_offset; -{ - int regno; - - if (gmask == 0 && fmask == 0) - return; - - /* Save registers starting from high to low. We've already saved the - previous frame pointer and previous return address for the debugger's - sake. The debugger allows us to not need a nop in the epilog if at least - one register is reloaded in addition to return address. */ - - if (gmask) - { - for (regno = 1; regno <= 31; regno++) - { - if ((gmask & (1L << regno)) != 0) - { - if ((regno & 0x1) == 0 && ((gmask & (1L << (regno+1))) != 0)) - { - /* We can save two registers in a row. If we're not at a - double word boundary, move to one. - sparc_flat_compute_frame_size ensures there's room to do - this. */ - if (offset % 8 != 0) - offset += UNITS_PER_WORD; - - if (word_op[0] == 's') - { - fprintf (file, "\t%s\t%s, [%s+%d]\n", - doubleword_op, reg_names[regno], - base_reg, offset); - if (dwarf2out_do_frame ()) - { - char *l = dwarf2out_cfi_label (); - dwarf2out_reg_save (l, regno, offset + base_offset); - dwarf2out_reg_save - (l, regno+1, offset+base_offset + UNITS_PER_WORD); - } - } - else - fprintf (file, "\t%s\t[%s+%d], %s\n", - doubleword_op, base_reg, offset, - reg_names[regno]); - - offset += 2 * UNITS_PER_WORD; - regno++; - } - else - { - if (word_op[0] == 's') - { - fprintf (file, "\t%s\t%s, [%s+%d]\n", - word_op, reg_names[regno], - base_reg, offset); - if (dwarf2out_do_frame ()) - dwarf2out_reg_save ("", regno, offset + base_offset); - } - else - fprintf (file, "\t%s\t[%s+%d], %s\n", - word_op, base_reg, offset, reg_names[regno]); - - offset += UNITS_PER_WORD; - } - } - } - } - - if (fmask) - { - for (regno = 32; regno <= 63; regno++) - { - if ((fmask & (1L << (regno - 32))) != 0) - { - if (word_op[0] == 's') - { - fprintf (file, "\t%s\t%s, [%s+%d]\n", - word_op, reg_names[regno], - base_reg, offset); - if (dwarf2out_do_frame ()) - dwarf2out_reg_save ("", regno, offset + base_offset); - } - else - fprintf (file, "\t%s\t[%s+%d], %s\n", - word_op, base_reg, offset, reg_names[regno]); - - offset += UNITS_PER_WORD; - } - } - } -} - -/* Set up the stack and frame (if desired) for the function. */ - -void -sparc_flat_output_function_prologue (file, size) - FILE *file; - int size; -{ - char *sp_str = reg_names[STACK_POINTER_REGNUM]; - unsigned long gmask = current_frame_info.gmask; - - /* This is only for the human reader. */ - fprintf (file, "\t%s#PROLOGUE# 0\n", ASM_COMMENT_START); - fprintf (file, "\t%s# vars= %ld, regs= %d/%d, args= %d, extra= %ld\n", - ASM_COMMENT_START, - current_frame_info.var_size, - current_frame_info.gp_reg_size / 4, - current_frame_info.fp_reg_size / 4, - current_function_outgoing_args_size, - current_frame_info.extra_size); - - size = SPARC_STACK_ALIGN (size); - size = (! current_frame_info.initialized - ? sparc_flat_compute_frame_size (size) - : current_frame_info.total_size); - - /* These cases shouldn't happen. Catch them now. */ - if (size == 0 && (gmask || current_frame_info.fmask)) - abort (); - - /* Allocate our stack frame by decrementing %sp. - At present, the only algorithm gdb can use to determine if this is a - flat frame is if we always set %i7 if we set %sp. This can be optimized - in the future by putting in some sort of debugging information that says - this is a `flat' function. However, there is still the case of debugging - code without such debugging information (including cases where most fns - have such info, but there is one that doesn't). So, always do this now - so we don't get a lot of code out there that gdb can't handle. - If the frame pointer isn't needn't then that's ok - gdb won't be able to - distinguish us from a non-flat function but there won't (and shouldn't) - be any differences anyway. The return pc is saved (if necessary) right - after %i7 so gdb won't have to look too far to find it. */ - if (size > 0) - { - unsigned int reg_offset = current_frame_info.reg_offset; - char *fp_str = reg_names[FRAME_POINTER_REGNUM]; - const char *t1_str = "%g1"; - - /* Things get a little tricky if local variables take up more than ~4096 - bytes and outgoing arguments take up more than ~4096 bytes. When that - happens, the register save area can't be accessed from either end of - the frame. Handle this by decrementing %sp to the start of the gp - register save area, save the regs, update %i7, and then set %sp to its - final value. Given that we only have one scratch register to play - with it is the cheapest solution, and it helps gdb out as it won't - slow down recognition of flat functions. - Don't change the order of insns emitted here without checking with - the gdb folk first. */ - - /* Is the entire register save area offsettable from %sp? */ - if (reg_offset < 4096 - 64 * UNITS_PER_WORD) - { - if (size <= 4096) - { - fprintf (file, "\tadd\t%s, %d, %s\n", - sp_str, -size, sp_str); - if (gmask & FRAME_POINTER_MASK) - { - fprintf (file, "\tst\t%s, [%s+%d]\n", - fp_str, sp_str, reg_offset); - fprintf (file, "\tsub\t%s, %d, %s\t%s# set up frame pointer\n", - sp_str, -size, fp_str, ASM_COMMENT_START); - reg_offset += 4; - } - } - else - { - fprintf (file, "\tset\t%d, %s\n\tsub\t%s, %s, %s\n", - size, t1_str, sp_str, t1_str, sp_str); - if (gmask & FRAME_POINTER_MASK) - { - fprintf (file, "\tst\t%s, [%s+%d]\n", - fp_str, sp_str, reg_offset); - fprintf (file, "\tadd\t%s, %s, %s\t%s# set up frame pointer\n", - sp_str, t1_str, fp_str, ASM_COMMENT_START); - reg_offset += 4; - } - } - if (dwarf2out_do_frame ()) - { - char *l = dwarf2out_cfi_label (); - if (gmask & FRAME_POINTER_MASK) - { - dwarf2out_reg_save (l, FRAME_POINTER_REGNUM, - reg_offset - 4 - size); - dwarf2out_def_cfa (l, FRAME_POINTER_REGNUM, 0); - } - else - dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, size); - } - if (gmask & RETURN_ADDR_MASK) - { - fprintf (file, "\tst\t%s, [%s+%d]\n", - reg_names[RETURN_ADDR_REGNUM], sp_str, reg_offset); - if (dwarf2out_do_frame ()) - dwarf2out_return_save ("", reg_offset - size); - reg_offset += 4; - } - sparc_flat_save_restore (file, sp_str, reg_offset, - gmask & ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK), - current_frame_info.fmask, - "st", "std", -size); - } - else - { - /* Subtract %sp in two steps, but make sure there is always a - 64 byte register save area, and %sp is properly aligned. */ - /* Amount to decrement %sp by, the first time. */ - unsigned int size1 = ((size - reg_offset + 64) + 15) & -16; - /* Offset to register save area from %sp. */ - unsigned int offset = size1 - (size - reg_offset); - - if (size1 <= 4096) - { - fprintf (file, "\tadd\t%s, %d, %s\n", - sp_str, -size1, sp_str); - if (gmask & FRAME_POINTER_MASK) - { - fprintf (file, "\tst\t%s, [%s+%d]\n\tsub\t%s, %d, %s\t%s# set up frame pointer\n", - fp_str, sp_str, offset, sp_str, -size1, fp_str, - ASM_COMMENT_START); - offset += 4; - } - } - else - { - fprintf (file, "\tset\t%d, %s\n\tsub\t%s, %s, %s\n", - size1, t1_str, sp_str, t1_str, sp_str); - if (gmask & FRAME_POINTER_MASK) - { - fprintf (file, "\tst\t%s, [%s+%d]\n\tadd\t%s, %s, %s\t%s# set up frame pointer\n", - fp_str, sp_str, offset, sp_str, t1_str, fp_str, - ASM_COMMENT_START); - offset += 4; - } - } - if (dwarf2out_do_frame ()) - { - char *l = dwarf2out_cfi_label (); - if (gmask & FRAME_POINTER_MASK) - { - dwarf2out_reg_save (l, FRAME_POINTER_REGNUM, - offset - 4 - size1); - dwarf2out_def_cfa (l, FRAME_POINTER_REGNUM, 0); - } - else - dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, size1); - } - if (gmask & RETURN_ADDR_MASK) - { - fprintf (file, "\tst\t%s, [%s+%d]\n", - reg_names[RETURN_ADDR_REGNUM], sp_str, offset); - if (dwarf2out_do_frame ()) - /* offset - size1 == reg_offset - size - if reg_offset were updated above like offset. */ - dwarf2out_return_save ("", offset - size1); - offset += 4; - } - sparc_flat_save_restore (file, sp_str, offset, - gmask & ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK), - current_frame_info.fmask, - "st", "std", -size1); - fprintf (file, "\tset\t%d, %s\n\tsub\t%s, %s, %s\n", - size - size1, t1_str, sp_str, t1_str, sp_str); - if (dwarf2out_do_frame ()) - if (! (gmask & FRAME_POINTER_MASK)) - dwarf2out_def_cfa ("", STACK_POINTER_REGNUM, size); - } - } - - fprintf (file, "\t%s#PROLOGUE# 1\n", ASM_COMMENT_START); -} - -/* Do any necessary cleanup after a function to restore stack, frame, - and regs. */ - -void -sparc_flat_output_function_epilogue (file, size) - FILE *file; - int size; -{ - rtx epilogue_delay = current_function_epilogue_delay_list; - int noepilogue = FALSE; - - /* This is only for the human reader. */ - fprintf (file, "\t%s#EPILOGUE#\n", ASM_COMMENT_START); - - /* The epilogue does not depend on any registers, but the stack - registers, so we assume that if we have 1 pending nop, it can be - ignored, and 2 it must be filled (2 nops occur for integer - multiply and divide). */ - - size = SPARC_STACK_ALIGN (size); - size = (!current_frame_info.initialized - ? sparc_flat_compute_frame_size (size) - : current_frame_info.total_size); - - if (size == 0 && epilogue_delay == 0) - { - rtx insn = get_last_insn (); - - /* If the last insn was a BARRIER, we don't have to write any code - because a jump (aka return) was put there. */ - if (GET_CODE (insn) == NOTE) - insn = prev_nonnote_insn (insn); - if (insn && GET_CODE (insn) == BARRIER) - noepilogue = TRUE; - } - - if (!noepilogue) - { - unsigned int reg_offset = current_frame_info.reg_offset; - unsigned int size1; - char *sp_str = reg_names[STACK_POINTER_REGNUM]; - char *fp_str = reg_names[FRAME_POINTER_REGNUM]; - const char *t1_str = "%g1"; - - /* In the reload sequence, we don't need to fill the load delay - slots for most of the loads, also see if we can fill the final - delay slot if not otherwise filled by the reload sequence. */ - - if (size > 4095) - fprintf (file, "\tset\t%d, %s\n", size, t1_str); - - if (frame_pointer_needed) - { - if (size > 4095) - fprintf (file,"\tsub\t%s, %s, %s\t\t%s# sp not trusted here\n", - fp_str, t1_str, sp_str, ASM_COMMENT_START); - else - fprintf (file,"\tsub\t%s, %d, %s\t\t%s# sp not trusted here\n", - fp_str, size, sp_str, ASM_COMMENT_START); - } - - /* Is the entire register save area offsettable from %sp? */ - if (reg_offset < 4096 - 64 * UNITS_PER_WORD) - { - size1 = 0; - } - else - { - /* Restore %sp in two steps, but make sure there is always a - 64 byte register save area, and %sp is properly aligned. */ - /* Amount to increment %sp by, the first time. */ - size1 = ((reg_offset - 64 - 16) + 15) & -16; - /* Offset to register save area from %sp. */ - reg_offset = size1 - reg_offset; - - fprintf (file, "\tset\t%d, %s\n\tadd\t%s, %s, %s\n", - size1, t1_str, sp_str, t1_str, sp_str); - } - - /* We must restore the frame pointer and return address reg first - because they are treated specially by the prologue output code. */ - if (current_frame_info.gmask & FRAME_POINTER_MASK) - { - fprintf (file, "\tld\t[%s+%d], %s\n", - sp_str, reg_offset, fp_str); - reg_offset += 4; - } - if (current_frame_info.gmask & RETURN_ADDR_MASK) - { - fprintf (file, "\tld\t[%s+%d], %s\n", - sp_str, reg_offset, reg_names[RETURN_ADDR_REGNUM]); - reg_offset += 4; - } - - /* Restore any remaining saved registers. */ - sparc_flat_save_restore (file, sp_str, reg_offset, - current_frame_info.gmask & ~(FRAME_POINTER_MASK | RETURN_ADDR_MASK), - current_frame_info.fmask, - "ld", "ldd", 0); - - /* If we had to increment %sp in two steps, record it so the second - restoration in the epilogue finishes up. */ - if (size1 > 0) - { - size -= size1; - if (size > 4095) - fprintf (file, "\tset\t%d, %s\n", - size, t1_str); - } - - if (current_function_returns_struct) - fprintf (file, "\tjmp\t%%o7+12\n"); - else - fprintf (file, "\tretl\n"); - - /* If the only register saved is the return address, we need a - nop, unless we have an instruction to put into it. Otherwise - we don't since reloading multiple registers doesn't reference - the register being loaded. */ - - if (epilogue_delay) - { - if (size) - abort (); - final_scan_insn (XEXP (epilogue_delay, 0), file, 1, -2, 1); - } - - else if (size > 4095) - fprintf (file, "\tadd\t%s, %s, %s\n", sp_str, t1_str, sp_str); - - else if (size > 0) - fprintf (file, "\tadd\t%s, %d, %s\n", sp_str, size, sp_str); - - else - fprintf (file, "\tnop\n"); - } - - /* Reset state info for each function. */ - current_frame_info = zero_frame_info; - - sparc_output_deferred_case_vectors (); -} - -/* Define the number of delay slots needed for the function epilogue. - - On the sparc, we need a slot if either no stack has been allocated, - or the only register saved is the return register. */ - -int -sparc_flat_epilogue_delay_slots () -{ - if (!current_frame_info.initialized) - (void) sparc_flat_compute_frame_size (get_frame_size ()); - - if (current_frame_info.total_size == 0) - return 1; - - return 0; -} - -/* Return true is TRIAL is a valid insn for the epilogue delay slot. - Any single length instruction which doesn't reference the stack or frame - pointer is OK. */ - -int -sparc_flat_eligible_for_epilogue_delay (trial, slot) - rtx trial; - int slot ATTRIBUTE_UNUSED; -{ - rtx pat = PATTERN (trial); - - if (get_attr_length (trial) != 1) - return 0; - - /* If %g0 is live, there are lots of things we can't handle. - Rather than trying to find them all now, let's punt and only - optimize things as necessary. */ - if (TARGET_LIVE_G0) - return 0; - - if (! reg_mentioned_p (stack_pointer_rtx, pat) - && ! reg_mentioned_p (frame_pointer_rtx, pat)) - return 1; - - return 0; -} - -/* Adjust the cost of a scheduling dependency. Return the new cost of - a dependency LINK or INSN on DEP_INSN. COST is the current cost. */ - -static int -supersparc_adjust_cost (insn, link, dep_insn, cost) - rtx insn; - rtx link; - rtx dep_insn; - int cost; -{ - enum attr_type insn_type; - - if (! recog_memoized (insn)) - return 0; - - insn_type = get_attr_type (insn); - - if (REG_NOTE_KIND (link) == 0) - { - /* Data dependency; DEP_INSN writes a register that INSN reads some - cycles later. */ - - /* if a load, then the dependence must be on the memory address; - add an extra "cycle". Note that the cost could be two cycles - if the reg was written late in an instruction group; we ca not tell - here. */ - if (insn_type == TYPE_LOAD || insn_type == TYPE_FPLOAD) - return cost + 3; - - /* Get the delay only if the address of the store is the dependence. */ - if (insn_type == TYPE_STORE || insn_type == TYPE_FPSTORE) - { - rtx pat = PATTERN(insn); - rtx dep_pat = PATTERN (dep_insn); - - if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET) - return cost; /* This should not happen! */ - - /* The dependency between the two instructions was on the data that - is being stored. Assume that this implies that the address of the - store is not dependent. */ - if (rtx_equal_p (SET_DEST (dep_pat), SET_SRC (pat))) - return cost; - - return cost + 3; /* An approximation. */ - } - - /* A shift instruction cannot receive its data from an instruction - in the same cycle; add a one cycle penalty. */ - if (insn_type == TYPE_SHIFT) - return cost + 3; /* Split before cascade into shift. */ - } - else - { - /* Anti- or output- dependency; DEP_INSN reads/writes a register that - INSN writes some cycles later. */ - - /* These are only significant for the fpu unit; writing a fp reg before - the fpu has finished with it stalls the processor. */ - - /* Reusing an integer register causes no problems. */ - if (insn_type == TYPE_IALU || insn_type == TYPE_SHIFT) - return 0; - } - - return cost; -} - -static int -hypersparc_adjust_cost (insn, link, dep_insn, cost) - rtx insn; - rtx link; - rtx dep_insn; - int cost; -{ - enum attr_type insn_type, dep_type; - rtx pat = PATTERN(insn); - rtx dep_pat = PATTERN (dep_insn); - - if (recog_memoized (insn) < 0 || recog_memoized (dep_insn) < 0) - return cost; - - insn_type = get_attr_type (insn); - dep_type = get_attr_type (dep_insn); - - switch (REG_NOTE_KIND (link)) - { - case 0: - /* Data dependency; DEP_INSN writes a register that INSN reads some - cycles later. */ - - switch (insn_type) - { - case TYPE_STORE: - case TYPE_FPSTORE: - /* Get the delay iff the address of the store is the dependence. */ - if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET) - return cost; - - if (rtx_equal_p (SET_DEST (dep_pat), SET_SRC (pat))) - return cost; - return cost + 3; - - case TYPE_LOAD: - case TYPE_SLOAD: - case TYPE_FPLOAD: - /* If a load, then the dependence must be on the memory address. If - the addresses aren't equal, then it might be a false dependency */ - if (dep_type == TYPE_STORE || dep_type == TYPE_FPSTORE) - { - if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET - || GET_CODE (SET_DEST (dep_pat)) != MEM - || GET_CODE (SET_SRC (pat)) != MEM - || ! rtx_equal_p (XEXP (SET_DEST (dep_pat), 0), - XEXP (SET_SRC (pat), 0))) - return cost + 2; - - return cost + 8; - } - break; - - case TYPE_BRANCH: - /* Compare to branch latency is 0. There is no benefit from - separating compare and branch. */ - if (dep_type == TYPE_COMPARE) - return 0; - /* Floating point compare to branch latency is less than - compare to conditional move. */ - if (dep_type == TYPE_FPCMP) - return cost - 1; - break; - default: - break; - } - break; - - case REG_DEP_ANTI: - /* Anti-dependencies only penalize the fpu unit. */ - if (insn_type == TYPE_IALU || insn_type == TYPE_SHIFT) - return 0; - break; - - default: - break; - } - - return cost; -} - -static int -ultrasparc_adjust_cost (insn, link, dep_insn, cost) - rtx insn; - rtx link; - rtx dep_insn; - int cost; -{ - enum attr_type insn_type, dep_type; - rtx pat = PATTERN(insn); - rtx dep_pat = PATTERN (dep_insn); - - if (recog_memoized (insn) < 0 || recog_memoized (dep_insn) < 0) - return cost; - - insn_type = get_attr_type (insn); - dep_type = get_attr_type (dep_insn); - - /* Nothing issues in parallel with integer multiplies, so - mark as zero cost since the scheduler can not do anything - about it. */ - if (insn_type == TYPE_IMUL) - return 0; - -#define SLOW_FP(dep_type) \ -(dep_type == TYPE_FPSQRT || dep_type == TYPE_FPDIVS || dep_type == TYPE_FPDIVD) - - switch (REG_NOTE_KIND (link)) - { - case 0: - /* Data dependency; DEP_INSN writes a register that INSN reads some - cycles later. */ - - if (dep_type == TYPE_CMOVE) - { - /* Instructions that read the result of conditional moves cannot - be in the same group or the following group. */ - return cost + 1; - } - - switch (insn_type) - { - /* UltraSPARC can dual issue a store and an instruction setting - the value stored, except for divide and square root. */ - case TYPE_FPSTORE: - if (! SLOW_FP (dep_type)) - return 0; - return cost; - - case TYPE_STORE: - if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET) - return cost; - - if (rtx_equal_p (SET_DEST (dep_pat), SET_SRC (pat))) - /* The dependency between the two instructions is on the data - that is being stored. Assume that the address of the store - is not also dependent. */ - return 0; - return cost; - - case TYPE_LOAD: - case TYPE_SLOAD: - case TYPE_FPLOAD: - /* A load does not return data until at least 11 cycles after - a store to the same location. 3 cycles are accounted for - in the load latency; add the other 8 here. */ - if (dep_type == TYPE_STORE || dep_type == TYPE_FPSTORE) - { - /* If the addresses are not equal this may be a false - dependency because pointer aliasing could not be - determined. Add only 2 cycles in that case. 2 is - an arbitrary compromise between 8, which would cause - the scheduler to generate worse code elsewhere to - compensate for a dependency which might not really - exist, and 0. */ - if (GET_CODE (pat) != SET || GET_CODE (dep_pat) != SET - || GET_CODE (SET_SRC (pat)) != MEM - || GET_CODE (SET_DEST (dep_pat)) != MEM - || ! rtx_equal_p (XEXP (SET_SRC (pat), 0), - XEXP (SET_DEST (dep_pat), 0))) - return cost + 2; - - return cost + 8; - } - return cost; - - case TYPE_BRANCH: - /* Compare to branch latency is 0. There is no benefit from - separating compare and branch. */ - if (dep_type == TYPE_COMPARE) - return 0; - /* Floating point compare to branch latency is less than - compare to conditional move. */ - if (dep_type == TYPE_FPCMP) - return cost - 1; - return cost; - - case TYPE_FPCMOVE: - /* FMOVR class instructions can not issue in the same cycle - or the cycle after an instruction which writes any - integer register. Model this as cost 2 for dependent - instructions. */ - if ((dep_type == TYPE_IALU || dep_type == TYPE_UNARY - || dep_type == TYPE_BINARY) - && cost < 2) - return 2; - /* Otherwise check as for integer conditional moves. */ - - case TYPE_CMOVE: - /* Conditional moves involving integer registers wait until - 3 cycles after loads return data. The interlock applies - to all loads, not just dependent loads, but that is hard - to model. */ - if (dep_type == TYPE_LOAD || dep_type == TYPE_SLOAD) - return cost + 3; - return cost; - - default: - break; - } - break; - - case REG_DEP_ANTI: - /* Divide and square root lock destination registers for full latency. */ - if (! SLOW_FP (dep_type)) - return 0; - break; - - case REG_DEP_OUTPUT: - /* IEU and FPU instruction that have the same destination - register cannot be grouped together. */ - return cost + 1; - - default: - break; - } - - /* Other costs not accounted for: - - Single precision floating point loads lock the other half of - the even/odd register pair. - - Several hazards associated with ldd/std are ignored because these - instructions are rarely generated for V9. - - The floating point pipeline can not have both a single and double - precision operation active at the same time. Format conversions - and graphics instructions are given honorary double precision status. - - call and jmpl are always the first instruction in a group. */ - - return cost; - -#undef SLOW_FP -} - -int -sparc_adjust_cost(insn, link, dep, cost) - rtx insn; - rtx link; - rtx dep; - int cost; -{ - switch (sparc_cpu) - { - case PROCESSOR_SUPERSPARC: - cost = supersparc_adjust_cost (insn, link, dep, cost); - break; - case PROCESSOR_HYPERSPARC: - case PROCESSOR_SPARCLITE86X: - cost = hypersparc_adjust_cost (insn, link, dep, cost); - break; - case PROCESSOR_ULTRASPARC: - cost = ultrasparc_adjust_cost (insn, link, dep, cost); - break; - default: - break; - } - return cost; -} - -/* This describes the state of the UltraSPARC pipeline during - instruction scheduling. */ - -#define TMASK(__x) ((unsigned)1 << ((int)(__x))) -#define UMASK(__x) ((unsigned)1 << ((int)(__x))) - -enum ultra_code { NONE=0, /* no insn at all */ - IEU0, /* shifts and conditional moves */ - IEU1, /* condition code setting insns, calls+jumps */ - IEUN, /* all other single cycle ieu insns */ - LSU, /* loads and stores */ - CTI, /* branches */ - FPM, /* FPU pipeline 1, multiplies and divides */ - FPA, /* FPU pipeline 2, all other operations */ - SINGLE, /* single issue instructions */ - NUM_ULTRA_CODES }; - -static const char *ultra_code_names[NUM_ULTRA_CODES] = { - "NONE", "IEU0", "IEU1", "IEUN", "LSU", "CTI", - "FPM", "FPA", "SINGLE" }; - -struct ultrasparc_pipeline_state { - /* The insns in this group. */ - rtx group[4]; - - /* The code for each insn. */ - enum ultra_code codes[4]; - - /* Which insns in this group have been committed by the - scheduler. This is how we determine how many more - can issue this cycle. */ - char commit[4]; - - /* How many insns in this group. */ - char group_size; - - /* Mask of free slots still in this group. */ - char free_slot_mask; - - /* The slotter uses the following to determine what other - insn types can still make their way into this group. */ - char contents [NUM_ULTRA_CODES]; - char num_ieu_insns; -}; - -#define ULTRA_NUM_HIST 8 -static struct ultrasparc_pipeline_state ultra_pipe_hist[ULTRA_NUM_HIST]; -static int ultra_cur_hist; -static int ultra_cycles_elapsed; - -#define ultra_pipe (ultra_pipe_hist[ultra_cur_hist]) - -/* Given TYPE_MASK compute the ultra_code it has. */ -static enum ultra_code -ultra_code_from_mask (type_mask) - int type_mask; -{ - if (type_mask & (TMASK (TYPE_SHIFT) | TMASK (TYPE_CMOVE))) - return IEU0; - else if (type_mask & (TMASK (TYPE_COMPARE) | - TMASK (TYPE_CALL) | - TMASK (TYPE_UNCOND_BRANCH))) - return IEU1; - else if (type_mask & (TMASK (TYPE_IALU) | TMASK (TYPE_BINARY) | - TMASK (TYPE_MOVE) | TMASK (TYPE_UNARY))) - return IEUN; - else if (type_mask & (TMASK (TYPE_LOAD) | TMASK (TYPE_SLOAD) | - TMASK (TYPE_STORE) | TMASK (TYPE_FPLOAD) | - TMASK (TYPE_FPSTORE))) - return LSU; - else if (type_mask & (TMASK (TYPE_FPMUL) | TMASK (TYPE_FPDIVS) | - TMASK (TYPE_FPDIVD) | TMASK (TYPE_FPSQRT))) - return FPM; - else if (type_mask & (TMASK (TYPE_FPMOVE) | TMASK (TYPE_FPCMOVE) | - TMASK (TYPE_FP) | TMASK (TYPE_FPCMP))) - return FPA; - else if (type_mask & TMASK (TYPE_BRANCH)) - return CTI; - - return SINGLE; -} - -/* Check INSN (a conditional move) and make sure that it's - results are available at this cycle. Return 1 if the - results are in fact ready. */ -static int -ultra_cmove_results_ready_p (insn) - rtx insn; -{ - struct ultrasparc_pipeline_state *up; - int entry, slot; - - /* If this got dispatched in the previous - group, the results are not ready. */ - entry = (ultra_cur_hist - 1) % (ULTRA_NUM_HIST - 1); - up = &ultra_pipe_hist[entry]; - slot = 4; - while (--slot >= 0) - if (up->group[slot] == insn) - return 0; - - return 1; -} - -/* Walk backwards in pipeline history looking for FPU - operations which use a mode different than FPMODE and - will create a stall if an insn using FPMODE were to be - dispatched this cycle. */ -static int -ultra_fpmode_conflict_exists (fpmode) - enum machine_mode fpmode; -{ - int hist_ent; - int hist_lim; - - hist_ent = (ultra_cur_hist - 1) % (ULTRA_NUM_HIST - 1); - if (ultra_cycles_elapsed < 4) - hist_lim = ultra_cycles_elapsed; - else - hist_lim = 4; - while (hist_lim > 0) - { - struct ultrasparc_pipeline_state *up = &ultra_pipe_hist[hist_ent]; - int slot = 4; - - while (--slot >= 0) - { - rtx insn = up->group[slot]; - enum machine_mode this_mode; - rtx pat; - - if (! insn - || GET_CODE (insn) != INSN - || (pat = PATTERN (insn)) == 0 - || GET_CODE (pat) != SET) - continue; - - this_mode = GET_MODE (SET_DEST (pat)); - if ((this_mode != SFmode - && this_mode != DFmode) - || this_mode == fpmode) - continue; - - /* If it is not FMOV, FABS, FNEG, FDIV, or FSQRT then - we will get a stall. Loads and stores are independant - of these rules. */ - if (GET_CODE (SET_SRC (pat)) != ABS - && GET_CODE (SET_SRC (pat)) != NEG - && ((TMASK (get_attr_type (insn)) & - (TMASK (TYPE_FPDIVS) | TMASK (TYPE_FPDIVD) | - TMASK (TYPE_FPMOVE) | TMASK (TYPE_FPSQRT) | - TMASK (TYPE_LOAD) | TMASK (TYPE_STORE))) == 0)) - return 1; - } - hist_lim--; - hist_ent = (hist_ent - 1) % (ULTRA_NUM_HIST - 1); - } - - /* No conflicts, safe to dispatch. */ - return 0; -} - -/* Find an instruction in LIST which has one of the - type attributes enumerated in TYPE_MASK. START - says where to begin the search. - - NOTE: This scheme depends upon the fact that we - have less than 32 distinct type attributes. */ - -static int ultra_types_avail; - -static rtx * -ultra_find_type (type_mask, list, start) - int type_mask; - rtx *list; - int start; -{ - int i; - - /* Short circuit if no such insn exists in the ready - at the moment. */ - if ((type_mask & ultra_types_avail) == 0) - return 0; - - for (i = start; i >= 0; i--) - { - rtx insn = list[i]; - - if (recog_memoized (insn) >= 0 - && (TMASK(get_attr_type (insn)) & type_mask)) - { - enum machine_mode fpmode = SFmode; - rtx pat = 0; - int slot; - int check_depend = 0; - int check_fpmode_conflict = 0; - - if (GET_CODE (insn) == INSN - && (pat = PATTERN(insn)) != 0 - && GET_CODE (pat) == SET - && !(type_mask & (TMASK (TYPE_STORE) | - TMASK (TYPE_FPSTORE)))) - { - check_depend = 1; - if (GET_MODE (SET_DEST (pat)) == SFmode - || GET_MODE (SET_DEST (pat)) == DFmode) - { - fpmode = GET_MODE (SET_DEST (pat)); - check_fpmode_conflict = 1; - } - } - - slot = 4; - while(--slot >= 0) - { - rtx slot_insn = ultra_pipe.group[slot]; - rtx slot_pat; - - /* Already issued, bad dependency, or FPU - mode conflict. */ - if (slot_insn != 0 - && (slot_pat = PATTERN (slot_insn)) != 0 - && ((insn == slot_insn) - || (check_depend == 1 - && GET_CODE (slot_insn) == INSN - && GET_CODE (slot_pat) == SET - && ((GET_CODE (SET_DEST (slot_pat)) == REG - && GET_CODE (SET_SRC (pat)) == REG - && REGNO (SET_DEST (slot_pat)) == - REGNO (SET_SRC (pat))) - || (GET_CODE (SET_DEST (slot_pat)) == SUBREG - && GET_CODE (SET_SRC (pat)) == SUBREG - && REGNO (SUBREG_REG (SET_DEST (slot_pat))) == - REGNO (SUBREG_REG (SET_SRC (pat))) - && SUBREG_WORD (SET_DEST (slot_pat)) == - SUBREG_WORD (SET_SRC (pat))))) - || (check_fpmode_conflict == 1 - && GET_CODE (slot_insn) == INSN - && GET_CODE (slot_pat) == SET - && (GET_MODE (SET_DEST (slot_pat)) == SFmode - || GET_MODE (SET_DEST (slot_pat)) == DFmode) - && GET_MODE (SET_DEST (slot_pat)) != fpmode))) - goto next; - } - - /* Check for peculiar result availability and dispatch - interference situations. */ - if (pat != 0 - && ultra_cycles_elapsed > 0) - { - rtx link; - - for (link = LOG_LINKS (insn); link; link = XEXP (link, 1)) - { - rtx link_insn = XEXP (link, 0); - if (GET_CODE (link_insn) == INSN - && recog_memoized (link_insn) >= 0 - && (TMASK (get_attr_type (link_insn)) & - (TMASK (TYPE_CMOVE) | TMASK (TYPE_FPCMOVE))) - && ! ultra_cmove_results_ready_p (link_insn)) - goto next; - } - - if (check_fpmode_conflict - && ultra_fpmode_conflict_exists (fpmode)) - goto next; - } - - return &list[i]; - } - next: - ; - } - return 0; -} - -static void -ultra_build_types_avail (ready, n_ready) - rtx *ready; - int n_ready; -{ - int i = n_ready - 1; - - ultra_types_avail = 0; - while(i >= 0) - { - rtx insn = ready[i]; - - if (recog_memoized (insn) >= 0) - ultra_types_avail |= TMASK (get_attr_type (insn)); - - i -= 1; - } -} - -/* Place insn pointed to my IP into the pipeline. - Make element THIS of READY be that insn if it - is not already. TYPE indicates the pipeline class - this insn falls into. */ -static void -ultra_schedule_insn (ip, ready, this, type) - rtx *ip; - rtx *ready; - int this; - enum ultra_code type; -{ - int pipe_slot; - char mask = ultra_pipe.free_slot_mask; - - /* Obtain free slot. */ - for (pipe_slot = 0; pipe_slot < 4; pipe_slot++) - if ((mask & (1 << pipe_slot)) != 0) - break; - if (pipe_slot == 4) - abort (); - - /* In it goes, and it hasn't been committed yet. */ - ultra_pipe.group[pipe_slot] = *ip; - ultra_pipe.codes[pipe_slot] = type; - ultra_pipe.contents[type] = 1; - if (UMASK (type) & - (UMASK (IEUN) | UMASK (IEU0) | UMASK (IEU1))) - ultra_pipe.num_ieu_insns += 1; - - ultra_pipe.free_slot_mask = (mask & ~(1 << pipe_slot)); - ultra_pipe.group_size += 1; - ultra_pipe.commit[pipe_slot] = 0; - - /* Update ready list. */ - if (ip != &ready[this]) - { - rtx temp = *ip; - - *ip = ready[this]; - ready[this] = temp; - } -} - -/* Advance to the next pipeline group. */ -static void -ultra_flush_pipeline () -{ - ultra_cur_hist = (ultra_cur_hist + 1) % (ULTRA_NUM_HIST - 1); - ultra_cycles_elapsed += 1; - bzero ((char *) &ultra_pipe, sizeof ultra_pipe); - ultra_pipe.free_slot_mask = 0xf; -} - -static int ultra_reorder_called_this_block; - -/* Init our data structures for this current block. */ -void -ultrasparc_sched_init (dump, sched_verbose) - FILE *dump ATTRIBUTE_UNUSED; - int sched_verbose ATTRIBUTE_UNUSED; -{ - bzero ((char *) ultra_pipe_hist, sizeof ultra_pipe_hist); - ultra_cur_hist = 0; - ultra_cycles_elapsed = 0; - ultra_reorder_called_this_block = 0; - ultra_pipe.free_slot_mask = 0xf; -} - -/* INSN has been scheduled, update pipeline commit state - and return how many instructions are still to be - scheduled in this group. */ -int -ultrasparc_variable_issue (insn) - rtx insn; -{ - struct ultrasparc_pipeline_state *up = &ultra_pipe; - int i, left_to_fire; - - left_to_fire = 0; - for (i = 0; i < 4; i++) - { - if (up->group[i] == 0) - continue; - - if (up->group[i] == insn) - { - up->commit[i] = 1; - } - else if (! up->commit[i]) - left_to_fire++; - } - - return left_to_fire; -} - -/* In actual_hazard_this_instance, we may have yanked some - instructions from the ready list due to conflict cost - adjustments. If so, and such an insn was in our pipeline - group, remove it and update state. */ -static void -ultra_rescan_pipeline_state (ready, n_ready) - rtx *ready; - int n_ready; -{ - struct ultrasparc_pipeline_state *up = &ultra_pipe; - int i; - - for (i = 0; i < 4; i++) - { - rtx insn = up->group[i]; - int j; - - if (! insn) - continue; - - /* If it has been committed, then it was removed from - the ready list because it was actually scheduled, - and that is not the case we are searching for here. */ - if (up->commit[i] != 0) - continue; - - for (j = n_ready - 1; j >= 0; j--) - if (ready[j] == insn) - break; - - /* If we didn't find it, toss it. */ - if (j < 0) - { - enum ultra_code ucode = up->codes[i]; - - up->group[i] = 0; - up->codes[i] = NONE; - up->contents[ucode] = 0; - if (UMASK (ucode) & - (UMASK (IEUN) | UMASK (IEU0) | UMASK (IEU1))) - up->num_ieu_insns -= 1; - - up->free_slot_mask |= (1 << i); - up->group_size -= 1; - up->commit[i] = 0; - } - } -} - -void -ultrasparc_sched_reorder (dump, sched_verbose, ready, n_ready) - FILE *dump; - int sched_verbose; - rtx *ready; - int n_ready; -{ - struct ultrasparc_pipeline_state *up = &ultra_pipe; - int i, this_insn; - - /* We get called once unnecessarily per block of insns - scheduled. */ - if (ultra_reorder_called_this_block == 0) - { - ultra_reorder_called_this_block = 1; - return; - } - - if (sched_verbose) - { - int n; - - fprintf (dump, "\n;;\tUltraSPARC Looking at ["); - for (n = n_ready - 1; n >= 0; n--) - { - rtx insn = ready[n]; - enum ultra_code ucode; - - if (recog_memoized (insn) < 0) - continue; - ucode = ultra_code_from_mask (TMASK (get_attr_type (insn))); - if (n != 0) - fprintf (dump, "%s(%d) ", - ultra_code_names[ucode], - INSN_UID (insn)); - else - fprintf (dump, "%s(%d)", - ultra_code_names[ucode], - INSN_UID (insn)); - } - fprintf (dump, "]\n"); - } - - this_insn = n_ready - 1; - - /* Skip over junk we don't understand. */ - while ((this_insn >= 0) - && recog_memoized (ready[this_insn]) < 0) - this_insn--; - - ultra_build_types_avail (ready, this_insn + 1); - - while (this_insn >= 0) { - int old_group_size = up->group_size; - - if (up->group_size != 0) - { - int num_committed; - - num_committed = (up->commit[0] + up->commit[1] + - up->commit[2] + up->commit[3]); - /* If nothing has been commited from our group, or all of - them have. Clear out the (current cycle's) pipeline - state and start afresh. */ - if (num_committed == 0 - || num_committed == up->group_size) - { - ultra_flush_pipeline (); - up = &ultra_pipe; - old_group_size = 0; - } - else - { - /* OK, some ready list insns got requeued and thus removed - from the ready list. Account for this fact. */ - ultra_rescan_pipeline_state (ready, n_ready); - - /* Something "changed", make this look like a newly - formed group so the code at the end of the loop - knows that progress was in fact made. */ - if (up->group_size != old_group_size) - old_group_size = 0; - } - } - - if (up->group_size == 0) - { - /* If the pipeline is (still) empty and we have any single - group insns, get them out now as this is a good time. */ - rtx *ip = ultra_find_type ((TMASK (TYPE_RETURN) | TMASK (TYPE_ADDRESS) | - TMASK (TYPE_IMUL) | TMASK (TYPE_CMOVE) | - TMASK (TYPE_MULTI) | TMASK (TYPE_MISC)), - ready, this_insn); - if (ip) - { - ultra_schedule_insn (ip, ready, this_insn, SINGLE); - break; - } - - /* If we are not in the process of emptying out the pipe, try to - obtain an instruction which must be the first in it's group. */ - ip = ultra_find_type ((TMASK (TYPE_CALL) | - TMASK (TYPE_CALL_NO_DELAY_SLOT) | - TMASK (TYPE_UNCOND_BRANCH)), - ready, this_insn); - if (ip) - { - ultra_schedule_insn (ip, ready, this_insn, IEU1); - this_insn--; - } - else if ((ip = ultra_find_type ((TMASK (TYPE_FPDIVS) | - TMASK (TYPE_FPDIVD) | - TMASK (TYPE_FPSQRT)), - ready, this_insn)) != 0) - { - ultra_schedule_insn (ip, ready, this_insn, FPM); - this_insn--; - } - } - - /* Try to fill the integer pipeline. First, look for an IEU0 specific - operation. We can't do more IEU operations if the first 3 slots are - all full or we have dispatched two IEU insns already. */ - if ((up->free_slot_mask & 0x7) != 0 - && up->num_ieu_insns < 2 - && up->contents[IEU0] == 0 - && up->contents[IEUN] == 0) - { - rtx *ip = ultra_find_type (TMASK(TYPE_SHIFT), ready, this_insn); - if (ip) - { - ultra_schedule_insn (ip, ready, this_insn, IEU0); - this_insn--; - } - } - - /* If we can, try to find an IEU1 specific or an unnamed - IEU instruction. */ - if ((up->free_slot_mask & 0x7) != 0 - && up->num_ieu_insns < 2) - { - rtx *ip = ultra_find_type ((TMASK (TYPE_IALU) | TMASK (TYPE_BINARY) | - TMASK (TYPE_MOVE) | TMASK (TYPE_UNARY) | - (up->contents[IEU1] == 0 ? TMASK (TYPE_COMPARE) : 0)), - ready, this_insn); - if (ip) - { - rtx insn = *ip; - - ultra_schedule_insn (ip, ready, this_insn, - (!up->contents[IEU1] - && get_attr_type (insn) == TYPE_COMPARE) - ? IEU1 : IEUN); - this_insn--; - } - } - - /* If only one IEU insn has been found, try to find another unnamed - IEU operation or an IEU1 specific one. */ - if ((up->free_slot_mask & 0x7) != 0 - && up->num_ieu_insns < 2) - { - rtx *ip; - int tmask = (TMASK (TYPE_IALU) | TMASK (TYPE_BINARY) | - TMASK (TYPE_MOVE) | TMASK (TYPE_UNARY)); - - if (!up->contents[IEU1]) - tmask |= TMASK (TYPE_COMPARE); - ip = ultra_find_type (tmask, ready, this_insn); - if (ip) - { - rtx insn = *ip; - - ultra_schedule_insn (ip, ready, this_insn, - (!up->contents[IEU1] - && get_attr_type (insn) == TYPE_COMPARE) - ? IEU1 : IEUN); - this_insn--; - } - } - - /* Try for a load or store, but such an insn can only be issued - if it is within' one of the first 3 slots. */ - if ((up->free_slot_mask & 0x7) != 0 - && up->contents[LSU] == 0) - { - rtx *ip = ultra_find_type ((TMASK (TYPE_LOAD) | TMASK (TYPE_SLOAD) | - TMASK (TYPE_STORE) | TMASK (TYPE_FPLOAD) | - TMASK (TYPE_FPSTORE)), ready, this_insn); - if (ip) - { - ultra_schedule_insn (ip, ready, this_insn, LSU); - this_insn--; - } - } - - /* Now find FPU operations, first FPM class. But not divisions or - square-roots because those will break the group up. Unlike all - the previous types, these can go in any slot. */ - if (up->free_slot_mask != 0 - && up->contents[FPM] == 0) - { - rtx *ip = ultra_find_type (TMASK (TYPE_FPMUL), ready, this_insn); - if (ip) - { - ultra_schedule_insn (ip, ready, this_insn, FPM); - this_insn--; - } - } - - /* Continue on with FPA class if we have not filled the group already. */ - if (up->free_slot_mask != 0 - && up->contents[FPA] == 0) - { - rtx *ip = ultra_find_type ((TMASK (TYPE_FPMOVE) | TMASK (TYPE_FPCMOVE) | - TMASK (TYPE_FP) | TMASK (TYPE_FPCMP)), - ready, this_insn); - if (ip) - { - ultra_schedule_insn (ip, ready, this_insn, FPA); - this_insn--; - } - } - - /* Finally, maybe stick a branch in here. */ - if (up->free_slot_mask != 0 - && up->contents[CTI] == 0) - { - rtx *ip = ultra_find_type (TMASK (TYPE_BRANCH), ready, this_insn); - - /* Try to slip in a branch only if it is one of the - next 2 in the ready list. */ - if (ip && ((&ready[this_insn] - ip) < 2)) - { - ultra_schedule_insn (ip, ready, this_insn, CTI); - this_insn--; - } - } - - up->group_size = 0; - for (i = 0; i < 4; i++) - if ((up->free_slot_mask & (1 << i)) == 0) - up->group_size++; - - /* See if we made any progress... */ - if (old_group_size != up->group_size) - break; - - /* Clean out the (current cycle's) pipeline state - and try once more. If we placed no instructions - into the pipeline at all, it means a real hard - conflict exists with some earlier issued instruction - so we must advance to the next cycle to clear it up. */ - if (up->group_size == 0) - { - ultra_flush_pipeline (); - up = &ultra_pipe; - } - else - { - bzero ((char *) &ultra_pipe, sizeof ultra_pipe); - ultra_pipe.free_slot_mask = 0xf; - } - } - - if (sched_verbose) - { - int n, gsize; - - fprintf (dump, ";;\tUltraSPARC Launched ["); - gsize = up->group_size; - for (n = 0; n < 4; n++) - { - rtx insn = up->group[n]; - - if (! insn) - continue; - - gsize -= 1; - if (gsize != 0) - fprintf (dump, "%s(%d) ", - ultra_code_names[up->codes[n]], - INSN_UID (insn)); - else - fprintf (dump, "%s(%d)", - ultra_code_names[up->codes[n]], - INSN_UID (insn)); - } - fprintf (dump, "]\n"); - } -} - -int -sparc_issue_rate () -{ - switch (sparc_cpu) - { - default: - return 1; - case PROCESSOR_V9: - /* Assume V9 processors are capable of at least dual-issue. */ - return 2; - case PROCESSOR_SUPERSPARC: - return 3; - case PROCESSOR_HYPERSPARC: - case PROCESSOR_SPARCLITE86X: - return 2; - case PROCESSOR_ULTRASPARC: - return 4; - } -} - -static int -set_extends(x, insn) - rtx x, insn; -{ - register rtx pat = PATTERN (insn); - - switch (GET_CODE (SET_SRC (pat))) - { - /* Load and some shift instructions zero extend. */ - case MEM: - case ZERO_EXTEND: - /* sethi clears the high bits */ - case HIGH: - /* LO_SUM is used with sethi. sethi cleared the high - bits and the values used with lo_sum are positive */ - case LO_SUM: - /* Store flag stores 0 or 1 */ - case LT: case LTU: - case GT: case GTU: - case LE: case LEU: - case GE: case GEU: - case EQ: - case NE: - return 1; - case AND: - { - rtx op1 = XEXP (SET_SRC (pat), 1); - if (GET_CODE (op1) == CONST_INT) - return INTVAL (op1) >= 0; - if (GET_CODE (XEXP (SET_SRC (pat), 0)) == REG - && sparc_check_64 (XEXP (SET_SRC (pat), 0), insn) == 1) - return 1; - if (GET_CODE (op1) == REG - && sparc_check_64 ((op1), insn) == 1) - return 1; - } - case ASHIFT: - case LSHIFTRT: - return GET_MODE (SET_SRC (pat)) == SImode; - /* Positive integers leave the high bits zero. */ - case CONST_DOUBLE: - return ! (CONST_DOUBLE_LOW (x) & 0x80000000); - case CONST_INT: - return ! (INTVAL (x) & 0x80000000); - case ASHIFTRT: - case SIGN_EXTEND: - return - (GET_MODE (SET_SRC (pat)) == SImode); - default: - return 0; - } -} - -/* We _ought_ to have only one kind per function, but... */ -static rtx sparc_addr_diff_list; -static rtx sparc_addr_list; - -void -sparc_defer_case_vector (lab, vec, diff) - rtx lab, vec; - int diff; -{ - vec = gen_rtx_EXPR_LIST (VOIDmode, lab, vec); - if (diff) - sparc_addr_diff_list - = gen_rtx_EXPR_LIST (VOIDmode, vec, sparc_addr_diff_list); - else - sparc_addr_list = gen_rtx_EXPR_LIST (VOIDmode, vec, sparc_addr_list); -} - -static void -sparc_output_addr_vec (vec) - rtx vec; -{ - rtx lab = XEXP (vec, 0), body = XEXP (vec, 1); - int idx, vlen = XVECLEN (body, 0); - -#ifdef ASM_OUTPUT_ADDR_VEC_START - ASM_OUTPUT_ADDR_VEC_START (asm_out_file); -#endif - -#ifdef ASM_OUTPUT_CASE_LABEL - ASM_OUTPUT_CASE_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (lab), - NEXT_INSN (lab)); -#else - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (lab)); -#endif - - for (idx = 0; idx < vlen; idx++) - { - ASM_OUTPUT_ADDR_VEC_ELT - (asm_out_file, CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 0, idx), 0))); - } - -#ifdef ASM_OUTPUT_ADDR_VEC_END - ASM_OUTPUT_ADDR_VEC_END (asm_out_file); -#endif -} - -static void -sparc_output_addr_diff_vec (vec) - rtx vec; -{ - rtx lab = XEXP (vec, 0), body = XEXP (vec, 1); - rtx base = XEXP (XEXP (body, 0), 0); - int idx, vlen = XVECLEN (body, 1); - -#ifdef ASM_OUTPUT_ADDR_VEC_START - ASM_OUTPUT_ADDR_VEC_START (asm_out_file); -#endif - -#ifdef ASM_OUTPUT_CASE_LABEL - ASM_OUTPUT_CASE_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (lab), - NEXT_INSN (lab)); -#else - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (lab)); -#endif - - for (idx = 0; idx < vlen; idx++) - { - ASM_OUTPUT_ADDR_DIFF_ELT - (asm_out_file, - body, - CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 1, idx), 0)), - CODE_LABEL_NUMBER (base)); - } - -#ifdef ASM_OUTPUT_ADDR_VEC_END - ASM_OUTPUT_ADDR_VEC_END (asm_out_file); -#endif -} - -static void -sparc_output_deferred_case_vectors () -{ - rtx t; - int align; - - if (sparc_addr_list == NULL_RTX - && sparc_addr_diff_list == NULL_RTX) - return; - - /* Align to cache line in the function's code section. */ - function_section (current_function_decl); - - align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); - if (align > 0) - ASM_OUTPUT_ALIGN (asm_out_file, align); - - for (t = sparc_addr_list; t ; t = XEXP (t, 1)) - sparc_output_addr_vec (XEXP (t, 0)); - for (t = sparc_addr_diff_list; t ; t = XEXP (t, 1)) - sparc_output_addr_diff_vec (XEXP (t, 0)); - - sparc_addr_list = sparc_addr_diff_list = NULL_RTX; -} - -/* Return 0 if the high 32 bits of X (the low word of X, if DImode) are - unknown. Return 1 if the high bits are zero, -1 if the register is - sign extended. */ -int -sparc_check_64 (x, insn) - rtx x, insn; -{ - /* If a register is set only once it is safe to ignore insns this - code does not know how to handle. The loop will either recognize - the single set and return the correct value or fail to recognize - it and return 0. */ - int set_once = 0; - - if (GET_CODE (x) == REG - && flag_expensive_optimizations - && REG_N_SETS (REGNO (x)) == 1) - set_once = 1; - - if (insn == 0) - { - if (set_once) - insn = get_last_insn_anywhere (); - else - return 0; - } - - while ((insn = PREV_INSN (insn))) - { - switch (GET_CODE (insn)) - { - case JUMP_INSN: - case NOTE: - break; - case CODE_LABEL: - case CALL_INSN: - default: - if (! set_once) - return 0; - break; - case INSN: - { - rtx pat = PATTERN (insn); - if (GET_CODE (pat) != SET) - return 0; - if (rtx_equal_p (x, SET_DEST (pat))) - return set_extends (x, insn); - if (reg_overlap_mentioned_p (SET_DEST (pat), x)) - return 0; - } - } - } - return 0; -} - -char * -sparc_v8plus_shift (operands, insn, opcode) - rtx *operands; - rtx insn; - char *opcode; -{ - static char asm_code[60]; - - if (GET_CODE (operands[3]) == SCRATCH) - operands[3] = operands[0]; - if (GET_CODE (operands[1]) == CONST_INT) - { - output_asm_insn ("mov %1,%3", operands); - } - else - { - output_asm_insn ("sllx %H1,32,%3", operands); - if (sparc_check_64 (operands[1], insn) <= 0) - output_asm_insn ("srl %L1,0,%L1", operands); - output_asm_insn ("or %L1,%3,%3", operands); - } - - strcpy(asm_code, opcode); - if (which_alternative != 2) - return strcat (asm_code, " %0,%2,%L0\n\tsrlx %L0,32,%H0"); - else - return strcat (asm_code, " %3,%2,%3\n\tsrlx %3,32,%H0\n\tmov %3,%L0"); -} - - -/* Return 1 if DEST and SRC reference only global and in registers. */ - -int -sparc_return_peephole_ok (dest, src) - rtx dest, src; -{ - if (! TARGET_V9) - return 0; - if (current_function_uses_only_leaf_regs) - return 0; - if (GET_CODE (src) != CONST_INT - && (GET_CODE (src) != REG || ! IN_OR_GLOBAL_P (src))) - return 0; - return IN_OR_GLOBAL_P (dest); -} - -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. - - 32 bit sparc uses %g2 as the STATIC_CHAIN_REGNUM which gets clobbered - during profiling so we need to save/restore it around the call to mcount. - We're guaranteed that a save has just been done, and we use the space - allocated for intreg/fpreg value passing. */ - -void -sparc_function_profiler (file, labelno) - FILE *file; - int labelno; -{ - char buf[32]; - ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno); - - if (! TARGET_ARCH64) - fputs ("\tst\t%g2,[%fp-4]\n", file); - - fputs ("\tsethi\t%hi(", file); - assemble_name (file, buf); - fputs ("),%o0\n", file); - - fputs ("\tcall\t", file); - assemble_name (file, MCOUNT_FUNCTION); - putc ('\n', file); - - fputs ("\t or\t%o0,%lo(", file); - assemble_name (file, buf); - fputs ("),%o0\n", file); - - if (! TARGET_ARCH64) - fputs ("\tld\t[%fp-4],%g2\n", file); -} - - -/* The following macro shall output assembler code to FILE - to initialize basic-block profiling. - - If profile_block_flag == 2 - - Output code to call the subroutine `__bb_init_trace_func' - and pass two parameters to it. The first parameter is - the address of a block allocated in the object module. - The second parameter is the number of the first basic block - of the function. - - The name of the block is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - The number of the first basic block of the function is - passed to the macro in BLOCK_OR_LABEL. - - If described in a virtual assembler language the code to be - output looks like: - - parameter1 <- LPBX0 - parameter2 <- BLOCK_OR_LABEL - call __bb_init_trace_func - - else if profile_block_flag != 0 - - Output code to call the subroutine `__bb_init_func' - and pass one single parameter to it, which is the same - as the first parameter to `__bb_init_trace_func'. - - The first word of this parameter is a flag which will be nonzero if - the object module has already been initialized. So test this word - first, and do not call `__bb_init_func' if the flag is nonzero. - Note: When profile_block_flag == 2 the test need not be done - but `__bb_init_trace_func' *must* be called. - - BLOCK_OR_LABEL may be used to generate a label number as a - branch destination in case `__bb_init_func' will not be called. - - If described in a virtual assembler language the code to be - output looks like: - - cmp (LPBX0),0 - jne local_label - parameter1 <- LPBX0 - call __bb_init_func - local_label: - -*/ - -void -sparc_function_block_profiler(file, block_or_label) - FILE *file; - int block_or_label; -{ - char LPBX[32]; - ASM_GENERATE_INTERNAL_LABEL (LPBX, "LPBX", 0); - - if (profile_block_flag == 2) - { - fputs ("\tsethi\t%hi(", file); - assemble_name (file, LPBX); - fputs ("),%o0\n", file); - - fprintf (file, "\tsethi\t%%hi(%d),%%o1\n", block_or_label); - - fputs ("\tor\t%o0,%lo(", file); - assemble_name (file, LPBX); - fputs ("),%o0\n", file); - - fprintf (file, "\tcall\t%s__bb_init_trace_func\n", user_label_prefix); - - fprintf (file, "\t or\t%%o1,%%lo(%d),%%o1\n", block_or_label); - } - else if (profile_block_flag != 0) - { - char LPBY[32]; - ASM_GENERATE_INTERNAL_LABEL (LPBY, "LPBY", block_or_label); - - fputs ("\tsethi\t%hi(", file); - assemble_name (file, LPBX); - fputs ("),%o0\n", file); - - fputs ("\tld\t[%lo(", file); - assemble_name (file, LPBX); - fputs (")+%o0],%o1\n", file); - - fputs ("\ttst\t%o1\n", file); - - if (TARGET_V9) - { - fputs ("\tbne,pn\t%icc,", file); - assemble_name (file, LPBY); - putc ('\n', file); - } - else - { - fputs ("\tbne\t", file); - assemble_name (file, LPBY); - putc ('\n', file); - } - - fputs ("\t or\t%o0,%lo(", file); - assemble_name (file, LPBX); - fputs ("),%o0\n", file); - - fprintf (file, "\tcall\t%s__bb_init_func\n\t nop\n", user_label_prefix); - - ASM_OUTPUT_INTERNAL_LABEL (file, "LPBY", block_or_label); - } -} - -/* The following macro shall output assembler code to FILE - to increment a counter associated with basic block number BLOCKNO. - - If profile_block_flag == 2 - - Output code to initialize the global structure `__bb' and - call the function `__bb_trace_func' which will increment the - counter. - - `__bb' consists of two words. In the first word the number - of the basic block has to be stored. In the second word - the address of a block allocated in the object module - has to be stored. - - The basic block number is given by BLOCKNO. - - The address of the block is given by the label created with - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0); - - by FUNCTION_BLOCK_PROFILER. - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language the code to be - output looks like: - - move BLOCKNO -> (__bb) - move LPBX0 -> (__bb+4) - call __bb_trace_func - - Note that function `__bb_trace_func' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE - and MACHINE_STATE_RESTORE. The last two macros will be - used in the function `__bb_trace_func', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE. - - else if profile_block_flag != 0 - - Output code to increment the counter directly. - Basic blocks are numbered separately from zero within each - compiled object module. The count associated with block number - BLOCKNO is at index BLOCKNO in an array of words; the name of - this array is a local symbol made with this statement: - - ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2); - - Of course, since you are writing the definition of - `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you - can take a short cut in the definition of this macro and use the - name that you know will result. - - If described in a virtual assembler language, the code to be - output looks like: - - inc (LPBX2+4*BLOCKNO) - -*/ - -void -sparc_block_profiler(file, blockno) - FILE *file; - int blockno; -{ - char LPBX[32]; - - if (profile_block_flag == 2) - { - ASM_GENERATE_INTERNAL_LABEL (LPBX, "LPBX", 0); - - fprintf (file, "\tsethi\t%%hi(%s__bb),%%g1\n", user_label_prefix); - fprintf (file, "\tsethi\t%%hi(%d),%%g2\n", blockno); - fprintf (file, "\tor\t%%g1,%%lo(%s__bb),%%g1\n", user_label_prefix); - fprintf (file, "\tor\t%%g2,%%lo(%d),%%g2\n", blockno); - - fputs ("\tst\t%g2,[%g1]\n", file); - - fputs ("\tsethi\t%hi(", file); - assemble_name (file, LPBX); - fputs ("),%g2\n", file); - - fputs ("\tor\t%g2,%lo(", file); - assemble_name (file, LPBX); - fputs ("),%g2\n", file); - - fputs ("\tst\t%g2,[%g1+4]\n", file); - fputs ("\tmov\t%o7,%g2\n", file); - - fprintf (file, "\tcall\t%s__bb_trace_func\n\t nop\n", user_label_prefix); - - fputs ("\tmov\t%g2,%o7\n", file); - } - else if (profile_block_flag != 0) - { - ASM_GENERATE_INTERNAL_LABEL (LPBX, "LPBX", 2); - - fputs ("\tsethi\t%hi(", file); - assemble_name (file, LPBX); - fprintf (file, "+%d),%%g1\n", blockno*4); - - fputs ("\tld\t[%g1+%lo(", file); - assemble_name (file, LPBX); - fprintf (file, "+%d)],%%g2\n", blockno*4); - - fputs ("\tadd\t%g2,1,%g2\n", file); - - fputs ("\tst\t%g2,[%g1+%lo(", file); - assemble_name (file, LPBX); - fprintf (file, "+%d)]\n", blockno*4); - } -} - -/* The following macro shall output assembler code to FILE - to indicate a return from function during basic-block profiling. - - If profile_block_flag == 2: - - Output assembler code to call function `__bb_trace_ret'. - - Note that function `__bb_trace_ret' must not change the - machine state, especially the flag register. To grant - this, you must output code to save and restore registers - either in this macro or in the macros MACHINE_STATE_SAVE_RET - and MACHINE_STATE_RESTORE_RET. The last two macros will be - used in the function `__bb_trace_ret', so you must make - sure that the function prologue does not change any - register prior to saving it with MACHINE_STATE_SAVE_RET. - - else if profile_block_flag != 0: - - The macro will not be used, so it need not distinguish - these cases. -*/ - -void -sparc_function_block_profiler_exit(file) - FILE *file; -{ - if (profile_block_flag == 2) - fprintf (file, "\tcall\t%s__bb_trace_ret\n\t nop\n", user_label_prefix); - else - abort (); -} diff --git a/contrib/gcc/config/sparc/sparc.h b/contrib/gcc/config/sparc/sparc.h deleted file mode 100644 index ad11d74afc14..000000000000 --- a/contrib/gcc/config/sparc/sparc.h +++ /dev/null @@ -1,3309 +0,0 @@ -/* Definitions of target machine for GNU compiler, for Sun SPARC. - Copyright (C) 1987, 88, 89, 92, 94-98, 1999 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com). - 64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans, - at Cygnus Support. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Note that some other tm.h files include this one and then override - whatever definitions are necessary. */ - -/* Specify this in a cover file to provide bi-architecture (32/64) support. */ -/* #define SPARC_BI_ARCH */ - -/* Macro used later in this file to determine default architecture. */ -#define DEFAULT_ARCH32_P ((TARGET_DEFAULT & MASK_64BIT) == 0) - -/* TARGET_ARCH{32,64} are the main macros to decide which of the two - architectures to compile for. We allow targets to choose compile time or - runtime selection. */ -#ifdef SPARC_BI_ARCH -#ifdef IN_LIBGCC2 -#if defined(__sparcv9) || defined(__sparcv_v9) || defined(__arch64__) -#define TARGET_ARCH32 0 -#else -#define TARGET_ARCH32 1 -#endif /* V9 sparc */ -#else -#define TARGET_ARCH32 (! TARGET_64BIT) -#endif /* IN_LIBGCC2 */ -#else -#define TARGET_ARCH32 (DEFAULT_ARCH32_P) -#endif /* SPARC_BI_ARCH */ -#define TARGET_ARCH64 (! TARGET_ARCH32) - -/* Code model selection. - -mcmodel is used to select the v9 code model. - Different code models aren't supported for v8 code. - - TARGET_CM_32: 32 bit address space, top 32 bits = 0, - pointers are 32 bits. Note that this isn't intended - to imply a v8 abi. - - TARGET_CM_MEDLOW: 32 bit address space, top 32 bits = 0, - avoid generating %uhi and %ulo terms, - pointers are 64 bits. - - TARGET_CM_MEDMID: 64 bit address space. - The executable must be in the low 16 TB of memory. - This corresponds to the low 44 bits, and the %[hml]44 - relocs are used. The text segment has a maximum size - of 31 bits. - - TARGET_CM_MEDANY: 64 bit address space. - The text and data segments have a maximum size of 31 - bits and may be located anywhere. The maximum offset - from any instruction to the label _GLOBAL_OFFSET_TABLE_ - is 31 bits. - - TARGET_CM_EMBMEDANY: 64 bit address space. - The text and data segments have a maximum size of 31 bits - and may be located anywhere. Register %g4 contains - the start address of the data segment. -*/ - -enum cmodel { - CM_32, - CM_MEDLOW, - CM_MEDMID, - CM_MEDANY, - CM_EMBMEDANY -}; - -/* Value of -mcmodel specified by user. */ -extern const char *sparc_cmodel_string; -/* One of CM_FOO. */ -extern enum cmodel sparc_cmodel; - -/* V9 code model selection. */ -#define TARGET_CM_MEDLOW (sparc_cmodel == CM_MEDLOW) -#define TARGET_CM_MEDMID (sparc_cmodel == CM_MEDMID) -#define TARGET_CM_MEDANY (sparc_cmodel == CM_MEDANY) -#define TARGET_CM_EMBMEDANY (sparc_cmodel == CM_EMBMEDANY) - -#define SPARC_DEFAULT_CMODEL CM_MEDLOW - -/* This is call-clobbered in the normal ABI, but is reserved in the - home grown (aka upward compatible) embedded ABI. */ -#define EMBMEDANY_BASE_REG "%g4" - -/* Values of TARGET_CPU_DEFAULT, set via -D in the Makefile, - and specified by the user via --with-cpu=foo. - This specifies the cpu implementation, not the architecture size. */ -/* Note that TARGET_CPU_v9 is assumed to start the list of 64-bit - capable cpu's. */ -#define TARGET_CPU_sparc 0 -#define TARGET_CPU_v7 0 /* alias for previous */ -#define TARGET_CPU_sparclet 1 -#define TARGET_CPU_sparclite 2 -#define TARGET_CPU_v8 3 /* generic v8 implementation */ -#define TARGET_CPU_supersparc 4 -#define TARGET_CPU_hypersparc 5 -#define TARGET_CPU_sparc86x 6 -#define TARGET_CPU_sparclite86x 6 -#define TARGET_CPU_v9 7 /* generic v9 implementation */ -#define TARGET_CPU_sparcv9 7 /* alias */ -#define TARGET_CPU_sparc64 7 /* alias */ -#define TARGET_CPU_ultrasparc 8 - -#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \ - || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc - -#define CPP_CPU32_DEFAULT_SPEC "" -#define ASM_CPU32_DEFAULT_SPEC "" - -#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 -/* ??? What does Sun's CC pass? */ -#define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__" -/* ??? It's not clear how other assemblers will handle this, so by default - use GAS. Sun's Solaris assembler recognizes -xarch=v8plus, but this case - is handled in sol2.h. */ -#define ASM_CPU64_DEFAULT_SPEC "-Av9" -#endif -#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc -#define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__" -#define ASM_CPU64_DEFAULT_SPEC "-Av9a" -#endif - -#else - -#define CPP_CPU64_DEFAULT_SPEC "" -#define ASM_CPU64_DEFAULT_SPEC "" - -#if TARGET_CPU_DEFAULT == TARGET_CPU_sparc \ - || TARGET_CPU_DEFAULT == TARGET_CPU_v8 -#define CPP_CPU32_DEFAULT_SPEC "" -#define ASM_CPU32_DEFAULT_SPEC "" -#endif - -#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclet -#define CPP_CPU32_DEFAULT_SPEC "-D__sparclet__" -#define ASM_CPU32_DEFAULT_SPEC "-Asparclet" -#endif - -#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclite -#define CPP_CPU32_DEFAULT_SPEC "-D__sparclite__" -#define ASM_CPU32_DEFAULT_SPEC "-Asparclite" -#endif - -#if TARGET_CPU_DEFAULT == TARGET_CPU_supersparc -#define CPP_CPU32_DEFAULT_SPEC "-D__supersparc__ -D__sparc_v8__" -#define ASM_CPU32_DEFAULT_SPEC "" -#endif - -#if TARGET_CPU_DEFAULT == TARGET_CPU_hypersparc -#define CPP_CPU32_DEFAULT_SPEC "-D__hypersparc__ -D__sparc_v8__" -#define ASM_CPU32_DEFAULT_SPEC "" -#endif - -#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclite86x -#define CPP_CPU32_DEFAULT_SPEC "-D__sparclite86x__ -D__sparc_v8__" -#define ASM_CPU32_DEFAULT_SPEC "-Av8" -#endif - -#endif - -#if !defined(CPP_CPU32_DEFAULT_SPEC) || !defined(CPP_CPU64_DEFAULT_SPEC) -Unrecognized value in TARGET_CPU_DEFAULT. -#endif - -#ifdef SPARC_BI_ARCH - -#define CPP_CPU_DEFAULT_SPEC \ -(DEFAULT_ARCH32_P ? "\ -%{m64:" CPP_CPU64_DEFAULT_SPEC "} \ -%{!m64:" CPP_CPU32_DEFAULT_SPEC "} \ -" : "\ -%{m32:" CPP_CPU32_DEFAULT_SPEC "} \ -%{!m32:" CPP_CPU64_DEFAULT_SPEC "} \ -") -#define ASM_CPU_DEFAULT_SPEC \ -(DEFAULT_ARCH32_P ? "\ -%{m64:" ASM_CPU64_DEFAULT_SPEC "} \ -%{!m64:" ASM_CPU32_DEFAULT_SPEC "} \ -" : "\ -%{m32:" ASM_CPU32_DEFAULT_SPEC "} \ -%{!m32:" ASM_CPU64_DEFAULT_SPEC "} \ -") - -#else /* !SPARC_BI_ARCH */ - -#define CPP_CPU_DEFAULT_SPEC (DEFAULT_ARCH32_P ? CPP_CPU32_DEFAULT_SPEC : CPP_CPU64_DEFAULT_SPEC) -#define ASM_CPU_DEFAULT_SPEC (DEFAULT_ARCH32_P ? ASM_CPU32_DEFAULT_SPEC : ASM_CPU64_DEFAULT_SPEC) - -#endif /* !SPARC_BI_ARCH */ - -/* Names to predefine in the preprocessor for this target machine. - ??? It would be nice to not include any subtarget specific values here, - however there's no way to portably provide subtarget values to - CPP_PREFINES. Also, -D values in CPP_SUBTARGET_SPEC don't get turned into - foo, __foo and __foo__. */ - -#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem(unix) -Asystem(bsd)" - -/* Define macros to distinguish architectures. */ - -/* Common CPP definitions used by CPP_SPEC amongst the various targets - for handling -mcpu=xxx switches. */ -#define CPP_CPU_SPEC "\ -%{mcypress:} \ -%{msparclite:-D__sparclite__} \ -%{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \ -%{mv8:-D__sparc_v8__} \ -%{msupersparc:-D__supersparc__ -D__sparc_v8__} \ -%{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \ -%{mcpu=sparclite:-D__sparclite__} \ -%{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \ -%{mcpu=v8:-D__sparc_v8__} \ -%{mcpu=supersparc:-D__supersparc__ -D__sparc_v8__} \ -%{mcpu=hypersparc:-D__hypersparc__ -D__sparc_v8__} \ -%{mcpu=sparclite86x:-D__sparclite86x__ -D__sparc_v8__} \ -%{mcpu=v9:-D__sparc_v9__} \ -%{mcpu=ultrasparc:-D__sparc_v9__} \ -%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \ -" - -/* ??? The GCC_NEW_VARARGS macro is now obsolete, because gcc always uses - the right varags.h file when bootstrapping. */ -/* ??? It's not clear what value we want to use for -Acpu/machine for - sparc64 in 32 bit environments, so for now we only use `sparc64' in - 64 bit environments. */ - -#ifdef SPARC_BI_ARCH - -#define CPP_ARCH32_SPEC "-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \ --D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)" -#define CPP_ARCH64_SPEC "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \ --D__arch64__ -Acpu(sparc64) -Amachine(sparc64)" - -#else - -#define CPP_ARCH32_SPEC "-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)" -#define CPP_ARCH64_SPEC "-D__arch64__ -Acpu(sparc64) -Amachine(sparc64)" - -#endif - -#define CPP_ARCH_DEFAULT_SPEC \ -(DEFAULT_ARCH32_P ? CPP_ARCH32_SPEC : CPP_ARCH64_SPEC) - -#define CPP_ARCH_SPEC "\ -%{m32:%(cpp_arch32)} \ -%{m64:%(cpp_arch64)} \ -%{!m32:%{!m64:%(cpp_arch_default)}} \ -" - -/* Macros to distinguish endianness. */ -#define CPP_ENDIAN_SPEC "\ -%{mlittle-endian:-D__LITTLE_ENDIAN__} \ -%{mlittle-endian-data:-D__LITTLE_ENDIAN_DATA__}" - -/* Macros to distinguish the particular subtarget. */ -#define CPP_SUBTARGET_SPEC "" - -#define CPP_SPEC "%(cpp_cpu) %(cpp_arch) %(cpp_endian) %(cpp_subtarget)" - -/* Prevent error on `-sun4' and `-target sun4' options. */ -/* This used to translate -dalign to -malign, but that is no good - because it can't turn off the usual meaning of making debugging dumps. */ -/* Translate old style -m into new style -mcpu=. - ??? Delete support for -m for 2.9. */ - -#define CC1_SPEC "\ -%{sun4:} %{target:} \ -%{mcypress:-mcpu=cypress} \ -%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ -%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ -" - -/* Override in target specific files. */ -#define ASM_CPU_SPEC "\ -%{mcpu=sparclet:-Asparclet} %{mcpu=tsc701:-Asparclet} \ -%{msparclite:-Asparclite} \ -%{mf930:-Asparclite} %{mf934:-Asparclite} \ -%{mcpu=sparclite:-Asparclite} \ -%{mcpu=f930:-Asparclite} %{mcpu=f934:-Asparclite} \ -%{mv8plus:-Av8plus} \ -%{mcpu=v9:-Av9} \ -%{mcpu=ultrasparc:%{!mv8plus:-Av9a}} \ -%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(asm_cpu_default)}}}}}}} \ -" - -/* Word size selection, among other things. - This is what GAS uses. Add %(asm_arch) to ASM_SPEC to enable. */ - -#define ASM_ARCH32_SPEC "-32" -#define ASM_ARCH64_SPEC "-64" -#define ASM_ARCH_DEFAULT_SPEC \ -(DEFAULT_ARCH32_P ? ASM_ARCH32_SPEC : ASM_ARCH64_SPEC) - -#define ASM_ARCH_SPEC "\ -%{m32:%(asm_arch32)} \ -%{m64:%(asm_arch64)} \ -%{!m32:%{!m64:%(asm_arch_default)}} \ -" - -/* Special flags to the Sun-4 assembler when using pipe for input. */ - -#define ASM_SPEC "\ -%| %{R} %{!pg:%{!p:%{fpic:-k} %{fPIC:-k}}} %{keep-local-as-symbols:-L} \ -%(asm_cpu) \ -" - -#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}" - -/* Provide required defaults for linker -e and -d switches. */ - -#define LINK_SPEC \ - "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \ - %{assert*} %{shared:%{!mimpure-text:-assert pure-text}}" - -/* This macro defines names of additional specifications to put in the specs - that can be used in various specifications like CC1_SPEC. Its definition - is an initializer with a subgrouping for each command option. - - Each subgrouping contains a string constant, that defines the - specification name, and a string constant that used by the GNU CC driver - program. - - Do not define this macro if it does not need to do anything. */ - -#define EXTRA_SPECS \ - { "cpp_cpu", CPP_CPU_SPEC }, \ - { "cpp_cpu_default", CPP_CPU_DEFAULT_SPEC }, \ - { "cpp_arch32", CPP_ARCH32_SPEC }, \ - { "cpp_arch64", CPP_ARCH64_SPEC }, \ - { "cpp_arch_default", CPP_ARCH_DEFAULT_SPEC },\ - { "cpp_arch", CPP_ARCH_SPEC }, \ - { "cpp_endian", CPP_ENDIAN_SPEC }, \ - { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \ - { "asm_cpu", ASM_CPU_SPEC }, \ - { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \ - { "asm_arch32", ASM_ARCH32_SPEC }, \ - { "asm_arch64", ASM_ARCH64_SPEC }, \ - { "asm_arch_default", ASM_ARCH_DEFAULT_SPEC },\ - { "asm_arch", ASM_ARCH_SPEC }, \ - SUBTARGET_EXTRA_SPECS - -#define SUBTARGET_EXTRA_SPECS - -#ifdef SPARC_BI_ARCH -#define NO_BUILTIN_PTRDIFF_TYPE -#define NO_BUILTIN_SIZE_TYPE -#endif -#define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int") -#define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int") - -/* ??? This should be 32 bits for v9 but what can we do? */ -#define WCHAR_TYPE "short unsigned int" -#define WCHAR_TYPE_SIZE 16 -#define MAX_WCHAR_TYPE_SIZE 16 - -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP - -/* To make profiling work with -f{pic,PIC}, we need to emit the profiling - code into the rtl. Also, if we are profiling, we cannot eliminate - the frame pointer (because the return address will get smashed). */ - -void sparc_override_options (); - -#define OVERRIDE_OPTIONS \ - do { \ - if (profile_flag || profile_block_flag || profile_arc_flag) \ - { \ - if (flag_pic) \ - { \ - const char *pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC";\ - warning ("%s and profiling conflict: disabling %s", \ - pic_string, pic_string); \ - flag_pic = 0; \ - } \ - flag_omit_frame_pointer = 0; \ - } \ - sparc_override_options (); \ - SUBTARGET_OVERRIDE_OPTIONS; \ - } while (0) - -/* This is meant to be redefined in the host dependent files. */ -#define SUBTARGET_OVERRIDE_OPTIONS - -/* These compiler options take an argument. We ignore -target for now. */ - -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - || !strcmp (STR, "target") || !strcmp (STR, "assert")) - -/* Print subsidiary information on the compiler version in use. */ - -#define TARGET_VERSION fprintf (stderr, " (sparc)"); - -/* Generate DBX debugging information. */ - -#define DBX_DEBUGGING_INFO - -/* Run-time compilation parameters selecting different hardware subsets. */ - -extern int target_flags; - -/* Nonzero if we should generate code to use the fpu. */ -#define MASK_FPU 1 -#define TARGET_FPU (target_flags & MASK_FPU) - -/* Nonzero if we should use FUNCTION_EPILOGUE. Otherwise, we - use fast return insns, but lose some generality. */ -#define MASK_EPILOGUE 2 -#define TARGET_EPILOGUE (target_flags & MASK_EPILOGUE) - -/* Nonzero if we should assume that double pointers might be unaligned. - This can happen when linking gcc compiled code with other compilers, - because the ABI only guarantees 4 byte alignment. */ -#define MASK_UNALIGNED_DOUBLES 4 -#define TARGET_UNALIGNED_DOUBLES (target_flags & MASK_UNALIGNED_DOUBLES) - -/* Nonzero means that we should generate code for a v8 sparc. */ -#define MASK_V8 0x8 -#define TARGET_V8 (target_flags & MASK_V8) - -/* Nonzero means that we should generate code for a sparclite. - This enables the sparclite specific instructions, but does not affect - whether FPU instructions are emitted. */ -#define MASK_SPARCLITE 0x10 -#define TARGET_SPARCLITE (target_flags & MASK_SPARCLITE) - -/* Nonzero if we're compiling for the sparclet. */ -#define MASK_SPARCLET 0x20 -#define TARGET_SPARCLET (target_flags & MASK_SPARCLET) - -/* Nonzero if we're compiling for v9 sparc. - Note that v9's can run in 32 bit mode so this doesn't necessarily mean - the word size is 64. */ -#define MASK_V9 0x40 -#define TARGET_V9 (target_flags & MASK_V9) - -/* Non-zero to generate code that uses the instructions deprecated in - the v9 architecture. This option only applies to v9 systems. */ -/* ??? This isn't user selectable yet. It's used to enable such insns - on 32 bit v9 systems and for the moment they're permanently disabled - on 64 bit v9 systems. */ -#define MASK_DEPRECATED_V8_INSNS 0x80 -#define TARGET_DEPRECATED_V8_INSNS (target_flags & MASK_DEPRECATED_V8_INSNS) - -/* Mask of all CPU selection flags. */ -#define MASK_ISA \ -(MASK_V8 + MASK_SPARCLITE + MASK_SPARCLET + MASK_V9 + MASK_DEPRECATED_V8_INSNS) - -/* Non-zero means don't pass `-assert pure-text' to the linker. */ -#define MASK_IMPURE_TEXT 0x100 -#define TARGET_IMPURE_TEXT (target_flags & MASK_IMPURE_TEXT) - -/* Nonzero means that we should generate code using a flat register window - model, i.e. no save/restore instructions are generated, which is - compatible with normal sparc code. - The frame pointer is %i7 instead of %fp. */ -#define MASK_FLAT 0x200 -#define TARGET_FLAT (target_flags & MASK_FLAT) - -/* Nonzero means use the registers that the Sparc ABI reserves for - application software. This must be the default to coincide with the - setting in FIXED_REGISTERS. */ -#define MASK_APP_REGS 0x400 -#define TARGET_APP_REGS (target_flags & MASK_APP_REGS) - -/* Option to select how quad word floating point is implemented. - When TARGET_HARD_QUAD is true, we use the hardware quad instructions. - Otherwise, we use the SPARC ABI quad library functions. */ -#define MASK_HARD_QUAD 0x800 -#define TARGET_HARD_QUAD (target_flags & MASK_HARD_QUAD) - -/* Non-zero on little-endian machines. */ -/* ??? Little endian support currently only exists for sparclet-aout and - sparc64-elf configurations. May eventually want to expand the support - to all targets, but for now it's kept local to only those two. */ -#define MASK_LITTLE_ENDIAN 0x1000 -#define TARGET_LITTLE_ENDIAN (target_flags & MASK_LITTLE_ENDIAN) - -/* 0x2000, 0x4000 are unused */ - -/* Nonzero if pointers are 64 bits. - At the moment it must follow architecture size flag. */ -#define MASK_PTR64 0x8000 -#define TARGET_PTR64 (target_flags & MASK_PTR64) - -/* Nonzero if generating code to run in a 64 bit environment. - This is intended to only be used by TARGET_ARCH{32,64} as they are the - mechanism used to control compile time or run time selection. */ -#define MASK_64BIT 0x10000 -#define TARGET_64BIT (target_flags & MASK_64BIT) - -/* 0x20000,0x40000 unused */ - -/* Non-zero means use a stack bias of 2047. Stack offsets are obtained by - adding 2047 to %sp. This option is for v9 only and is the default. */ -#define MASK_STACK_BIAS 0x80000 -#define TARGET_STACK_BIAS (target_flags & MASK_STACK_BIAS) - -/* Non-zero means %g0 is a normal register. - We still clobber it as necessary, but we can't rely on it always having - a zero value. - We don't bother to support this in true 64 bit mode. */ -#define MASK_LIVE_G0 0x100000 -#define TARGET_LIVE_G0 (target_flags & MASK_LIVE_G0) - -/* Non-zero means the cpu has broken `save' and `restore' insns, only - the trivial versions work (save %g0,%g0,%g0; restore %g0,%g0,%g0). - We assume the environment will properly handle or otherwise avoid - trouble associated with an interrupt occurring after the `save' or trap - occurring during it. */ -#define MASK_BROKEN_SAVERESTORE 0x200000 -#define TARGET_BROKEN_SAVERESTORE (target_flags & MASK_BROKEN_SAVERESTORE) - -/* Non-zero means -m{,no-}fpu was passed on the command line. */ -#define MASK_FPU_SET 0x400000 -#define TARGET_FPU_SET (target_flags & MASK_FPU_SET) - -/* Use the UltraSPARC Visual Instruction Set extensions. */ -#define MASK_VIS 0x1000000 -#define TARGET_VIS (target_flags & MASK_VIS) - -/* Compile for Solaris V8+. 32 bit Solaris preserves the high bits of - the current out and global registers. Linux saves the high bits on - context switches but not signals. */ -#define MASK_V8PLUS 0x2000000 -#define TARGET_V8PLUS (target_flags & MASK_V8PLUS) - -/* TARGET_HARD_MUL: Use hardware multiply instructions but not %y. - TARGET_HARD_MUL32: Use hardware multiply instructions with rd %y - to get high 32 bits. False in V8+ or V9 because multiply stores - a 64 bit result in a register. */ - -#define TARGET_HARD_MUL32 \ - ((TARGET_V8 || TARGET_SPARCLITE \ - || TARGET_SPARCLET || TARGET_DEPRECATED_V8_INSNS) \ - && ! TARGET_V8PLUS) - -#define TARGET_HARD_MUL \ - (TARGET_V8 || TARGET_SPARCLITE || TARGET_SPARCLET \ - || TARGET_DEPRECATED_V8_INSNS || TARGET_V8PLUS) - - -/* Macro to define tables used to set the flags. - This is a list in braces of pairs in braces, - each pair being { "NAME", VALUE } - where VALUE is the bits to set or minus the bits to clear. - An empty string NAME is used to identify the default VALUE. */ - -#define TARGET_SWITCHES \ - { {"fpu", MASK_FPU | MASK_FPU_SET, "Use hardware fp" }, \ - {"no-fpu", -MASK_FPU, "Do not use hardware fp" }, \ - {"no-fpu", MASK_FPU_SET, "Do not use hardware fp" }, \ - {"hard-float", MASK_FPU | MASK_FPU_SET, "Use hardware fp" }, \ - {"soft-float", -MASK_FPU, "Do not use hardware fp" }, \ - {"soft-float", MASK_FPU_SET, "Do not use hardware fp" }, \ - {"epilogue", MASK_EPILOGUE, "Use FUNCTION_EPILOGUE" }, \ - {"no-epilogue", -MASK_EPILOGUE, "Do not use FUNCTION_EPILOGUE" }, \ - {"unaligned-doubles", MASK_UNALIGNED_DOUBLES, "Assume possible double misalignment" },\ - {"no-unaligned-doubles", -MASK_UNALIGNED_DOUBLES, "Assume all doubles are aligned" }, \ - {"impure-text", MASK_IMPURE_TEXT, "Pass -assert pure-text to linker" }, \ - {"no-impure-text", -MASK_IMPURE_TEXT, "Do not pass -assert pure-text to linker" }, \ - {"flat", MASK_FLAT, "Use flat register window model" }, \ - {"no-flat", -MASK_FLAT, "Do not use flat register window model" }, \ - {"app-regs", MASK_APP_REGS, "Use ABI reserved registers" }, \ - {"no-app-regs", -MASK_APP_REGS, "Do not use ABI reserved registers" }, \ - {"hard-quad-float", MASK_HARD_QUAD, "Use hardware quad fp instructions" }, \ - {"soft-quad-float", -MASK_HARD_QUAD, "Do not use hardware quad fp instructions" }, \ - {"v8plus", MASK_V8PLUS, "Compile for v8plus ABI" }, \ - {"no-v8plus", -MASK_V8PLUS, "Do not compile for v8plus ABI" }, \ - {"vis", MASK_VIS, "Utilize Visual Instruction Set" }, \ - {"no-vis", -MASK_VIS, "Do not utilize Visual Instruction Set" }, \ - /* ??? These are deprecated, coerced to -mcpu=. Delete in 2.9. */ \ - {"cypress", 0, "Optimize for Cypress processors" }, \ - {"sparclite", 0, "Optimize for SparcLite processors" }, \ - {"f930", 0, "Optimize for F930 processors" }, \ - {"f934", 0, "Optimize for F934 processors" }, \ - {"v8", 0, "Use V8 Sparc ISA" }, \ - {"supersparc", 0, "Optimize for SuperSparc processors" }, \ - /* End of deprecated options. */ \ - {"ptr64", MASK_PTR64, "Pointers are 64-bit" }, \ - {"ptr32", -MASK_PTR64, "Pointers are 32-bit" }, \ - {"32", -MASK_64BIT, "Use 32-bit ABI" }, \ - {"64", MASK_64BIT, "Use 64-bit ABI" }, \ - {"stack-bias", MASK_STACK_BIAS, "Use stack bias" }, \ - {"no-stack-bias", -MASK_STACK_BIAS, "Do not use stack bias" }, \ - SUBTARGET_SWITCHES \ - { "", TARGET_DEFAULT, ""}} - -/* MASK_APP_REGS must always be the default because that's what - FIXED_REGISTERS is set to and -ffixed- is processed before - CONDITIONAL_REGISTER_USAGE is called (where we process -mno-app-regs). */ -#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU) - -/* This is meant to be redefined in target specific files. */ -#define SUBTARGET_SWITCHES - -/* Processor type. - These must match the values for the cpu attribute in sparc.md. */ -enum processor_type { - PROCESSOR_V7, - PROCESSOR_CYPRESS, - PROCESSOR_V8, - PROCESSOR_SUPERSPARC, - PROCESSOR_SPARCLITE, - PROCESSOR_F930, - PROCESSOR_F934, - PROCESSOR_HYPERSPARC, - PROCESSOR_SPARCLITE86X, - PROCESSOR_SPARCLET, - PROCESSOR_TSC701, - PROCESSOR_V9, - PROCESSOR_ULTRASPARC -}; - -/* This is set from -m{cpu,tune}=xxx. */ -extern enum processor_type sparc_cpu; - -/* Recast the cpu class to be the cpu attribute. - Every file includes us, but not every file includes insn-attr.h. */ -#define sparc_cpu_attr ((enum attr_cpu) sparc_cpu) - -/* This macro is similar to `TARGET_SWITCHES' but defines names of - command options that have values. Its definition is an - initializer with a subgrouping for each command option. - - Each subgrouping contains a string constant, that defines the - fixed part of the option name, and the address of a variable. - The variable, type `char *', is set to the variable part of the - given option if the fixed part matches. The actual option name - is made by appending `-m' to the specified name. - - Here is an example which defines `-mshort-data-NUMBER'. If the - given option is `-mshort-data-512', the variable `m88k_short_data' - will be set to the string `"512"'. - - extern char *m88k_short_data; - #define TARGET_OPTIONS { { "short-data-", &m88k_short_data } } */ - -#define TARGET_OPTIONS \ -{ \ - { "cpu=", &sparc_select[1].string, "Use features of and schedule code for given CPU" }, \ - { "tune=", &sparc_select[2].string, "Schedule code for given CPU" }, \ - { "cmodel=", &sparc_cmodel_string, "Use given Sparc code model" }, \ - { "align-loops=", &sparc_align_loops_string, "Loop code aligned to this power of 2" }, \ - { "align-jumps=", &sparc_align_jumps_string, "Jump targets are aligned to this power of 2" }, \ - { "align-functions=", &sparc_align_funcs_string, "Function starts are aligned to this power of 2" }, \ - SUBTARGET_OPTIONS \ -} - -/* This is meant to be redefined in target specific files. */ -#define SUBTARGET_OPTIONS - -/* sparc_select[0] is reserved for the default cpu. */ -struct sparc_cpu_select -{ - const char *string; - const char *name; - int set_tune_p; - int set_arch_p; -}; - -extern struct sparc_cpu_select sparc_select[]; - -/* Variables to record values the user passes. */ -extern const char *sparc_align_loops_string; -extern const char *sparc_align_jumps_string; -extern const char *sparc_align_funcs_string; -/* Parsed values as a power of two. */ -extern int sparc_align_loops; -extern int sparc_align_jumps; -extern int sparc_align_funcs; - -#define DEFAULT_SPARC_ALIGN_FUNCS \ -(sparc_cpu == PROCESSOR_ULTRASPARC ? 5 : 2) - -/* target machine storage layout */ - -/* Define for cross-compilation to a sparc target with no TFmode from a host - with a different float format (e.g. VAX). */ -#define REAL_ARITHMETIC - -/* Define this if most significant bit is lowest numbered - in instructions that operate on numbered bit-fields. */ -#define BITS_BIG_ENDIAN 1 - -/* Define this if most significant byte of a word is the lowest numbered. */ -#define BYTES_BIG_ENDIAN 1 - -/* Define this if most significant word of a multiword number is the lowest - numbered. */ -#define WORDS_BIG_ENDIAN 1 - -/* Define this to set the endianness to use in libgcc2.c, which can - not depend on target_flags. */ -#if defined (__LITTLE_ENDIAN__) || defined(__LITTLE_ENDIAN_DATA__) -#define LIBGCC2_WORDS_BIG_ENDIAN 0 -#else -#define LIBGCC2_WORDS_BIG_ENDIAN 1 -#endif - -/* number of bits in an addressable storage unit */ -#define BITS_PER_UNIT 8 - -/* Width in bits of a "word", which is the contents of a machine register. - Note that this is not necessarily the width of data type `int'; - if using 16-bit ints on a 68000, this would still be 32. - But on a machine with 16-bit registers, this would be 16. */ -#define BITS_PER_WORD (TARGET_ARCH64 ? 64 : 32) -#define MAX_BITS_PER_WORD 64 - -/* Width of a word, in units (bytes). */ -#define UNITS_PER_WORD (TARGET_ARCH64 ? 8 : 4) -#define MIN_UNITS_PER_WORD 4 - -/* Now define the sizes of the C data types. */ - -#define SHORT_TYPE_SIZE 16 -#define INT_TYPE_SIZE 32 -#define LONG_TYPE_SIZE (TARGET_ARCH64 ? 64 : 32) -#define LONG_LONG_TYPE_SIZE 64 -#define FLOAT_TYPE_SIZE 32 -#define DOUBLE_TYPE_SIZE 64 - -#if defined (SPARC_BI_ARCH) -#define MAX_LONG_TYPE_SIZE 64 -#endif - -#if 0 -/* ??? This does not work in SunOS 4.x, so it is not enabled here. - Instead, it is enabled in sol2.h, because it does work under Solaris. */ -/* Define for support of TFmode long double and REAL_ARITHMETIC. - Sparc ABI says that long double is 4 words. */ -#define LONG_DOUBLE_TYPE_SIZE 128 -#endif - -/* Width in bits of a pointer. - See also the macro `Pmode' defined below. */ -#define POINTER_SIZE (TARGET_PTR64 ? 64 : 32) - -/* A macro to update MODE and UNSIGNEDP when an object whose type - is TYPE and which has the specified mode and signedness is to be - stored in a register. This macro is only called when TYPE is a - scalar type. */ -#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ -if (TARGET_ARCH64 \ - && GET_MODE_CLASS (MODE) == MODE_INT \ - && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ -{ \ - (MODE) = DImode; \ -} - -/* Define this macro if the promotion described by PROMOTE_MODE - should also be done for outgoing function arguments. */ -/* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op - for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime test - for this value. */ -#define PROMOTE_FUNCTION_ARGS - -/* Define this macro if the promotion described by PROMOTE_MODE - should also be done for the return value of functions. - If this macro is defined, FUNCTION_VALUE must perform the same - promotions done by PROMOTE_MODE. */ -/* This is only needed for TARGET_ARCH64, but since PROMOTE_MODE is a no-op - for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime test - for this value. */ -#define PROMOTE_FUNCTION_RETURN - -/* Allocation boundary (in *bits*) for storing arguments in argument list. */ -#define PARM_BOUNDARY (TARGET_ARCH64 ? 64 : 32) - -/* Boundary (in *bits*) on which stack pointer should be aligned. */ -#define STACK_BOUNDARY (TARGET_ARCH64 ? 128 : 64) - -/* ALIGN FRAMES on double word boundaries */ - -#define SPARC_STACK_ALIGN(LOC) \ - (TARGET_ARCH64 ? (((LOC)+15) & ~15) : (((LOC)+7) & ~7)) - -/* Allocation boundary (in *bits*) for the code of a function. */ -#define FUNCTION_BOUNDARY (1 << (sparc_align_funcs + 3)) - -/* Alignment of field after `int : 0' in a structure. */ -#define EMPTY_FIELD_BOUNDARY (TARGET_ARCH64 ? 64 : 32) - -/* Every structure's size must be a multiple of this. */ -#define STRUCTURE_SIZE_BOUNDARY 8 - -/* A bitfield declared as `int' forces `int' alignment for the struct. */ -#define PCC_BITFIELD_TYPE_MATTERS 1 - -/* No data type wants to be aligned rounder than this. */ -#define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64) - -/* The best alignment to use in cases where we have a choice. */ -#define FASTEST_ALIGNMENT 64 - -/* Make strings word-aligned so strcpy from constants will be faster. */ -#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ - ((TREE_CODE (EXP) == STRING_CST \ - && (ALIGN) < FASTEST_ALIGNMENT) \ - ? FASTEST_ALIGNMENT : (ALIGN)) - -/* Make arrays of chars word-aligned for the same reasons. */ -#define DATA_ALIGNMENT(TYPE, ALIGN) \ - (TREE_CODE (TYPE) == ARRAY_TYPE \ - && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ - && (ALIGN) < FASTEST_ALIGNMENT ? FASTEST_ALIGNMENT : (ALIGN)) - -/* Set this nonzero if move instructions will actually fail to work - when given unaligned data. */ -#define STRICT_ALIGNMENT 1 - -/* Things that must be doubleword aligned cannot go in the text section, - because the linker fails to align the text section enough! - Put them in the data section. This macro is only used in this file. */ -#define MAX_TEXT_ALIGN 32 - -/* This forces all variables and constants to the data section when PIC. - This is because the SunOS 4 shared library scheme thinks everything in - text is a function, and patches the address to point to a loader stub. */ -/* This is defined to zero for every system which doesn't use the a.out object - file format. */ -#ifndef SUNOS4_SHARED_LIBRARIES -#define SUNOS4_SHARED_LIBRARIES 0 -#endif - -/* This is defined differently for v9 in a cover file. */ -#define SELECT_SECTION(T,RELOC) \ -{ \ - if (TREE_CODE (T) == VAR_DECL) \ - { \ - if (TREE_READONLY (T) && ! TREE_SIDE_EFFECTS (T) \ - && DECL_INITIAL (T) \ - && (DECL_INITIAL (T) == error_mark_node \ - || TREE_CONSTANT (DECL_INITIAL (T))) \ - && DECL_ALIGN (T) <= MAX_TEXT_ALIGN \ - && ! (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES))) \ - text_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (T) == CONSTRUCTOR) \ - { \ - if (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES)) \ - data_section (); \ - } \ - else if (TREE_CODE_CLASS (TREE_CODE (T)) == 'c') \ - { \ - if ((TREE_CODE (T) == STRING_CST && flag_writable_strings) \ - || TYPE_ALIGN (TREE_TYPE (T)) > MAX_TEXT_ALIGN \ - || (flag_pic && ((RELOC) || SUNOS4_SHARED_LIBRARIES))) \ - data_section (); \ - else \ - text_section (); \ - } \ -} - -/* Use text section for a constant - unless we need more alignment than that offers. */ -/* This is defined differently for v9 in a cover file. */ -#define SELECT_RTX_SECTION(MODE, X) \ -{ \ - if (GET_MODE_BITSIZE (MODE) <= MAX_TEXT_ALIGN \ - && ! (flag_pic && (symbolic_operand (X) || SUNOS4_SHARED_LIBRARIES))) \ - text_section (); \ - else \ - data_section (); \ -} - -/* Standard register usage. */ - -/* Number of actual hardware registers. - The hardware registers are assigned numbers for the compiler - from 0 to just below FIRST_PSEUDO_REGISTER. - All registers that the compiler knows about must be given numbers, - even those that are not normally considered general registers. - - SPARC has 32 integer registers and 32 floating point registers. - 64 bit SPARC has 32 additional fp regs, but the odd numbered ones are not - accessible. We still account for them to simplify register computations - (eg: in CLASS_MAX_NREGS). There are also 4 fp condition code registers, so - 32+32+32+4 == 100. - Register 100 is used as the integer condition code register. */ - -#define FIRST_PSEUDO_REGISTER 101 - -#define SPARC_FIRST_FP_REG 32 -/* Additional V9 fp regs. */ -#define SPARC_FIRST_V9_FP_REG 64 -#define SPARC_LAST_V9_FP_REG 95 -/* V9 %fcc[0123]. V8 uses (figuratively) %fcc0. */ -#define SPARC_FIRST_V9_FCC_REG 96 -#define SPARC_LAST_V9_FCC_REG 99 -/* V8 fcc reg. */ -#define SPARC_FCC_REG 96 -/* Integer CC reg. We don't distinguish %icc from %xcc. */ -#define SPARC_ICC_REG 100 - -/* Nonzero if REGNO is an fp reg. */ -#define SPARC_FP_REG_P(REGNO) \ -((REGNO) >= SPARC_FIRST_FP_REG && (REGNO) <= SPARC_LAST_V9_FP_REG) - -/* Argument passing regs. */ -#define SPARC_OUTGOING_INT_ARG_FIRST 8 -#define SPARC_INCOMING_INT_ARG_FIRST (TARGET_FLAT ? 8 : 24) -#define SPARC_FP_ARG_FIRST 32 - -/* 1 for registers that have pervasive standard uses - and are not available for the register allocator. - - On non-v9 systems: - g1 is free to use as temporary. - g2-g4 are reserved for applications. Gcc normally uses them as - temporaries, but this can be disabled via the -mno-app-regs option. - g5 through g7 are reserved for the operating system. - - On v9 systems: - g1,g5 are free to use as temporaries, and are free to use between calls - if the call is to an external function via the PLT. - g4 is free to use as a temporary in the non-embedded case. - g4 is reserved in the embedded case. - g2-g3 are reserved for applications. Gcc normally uses them as - temporaries, but this can be disabled via the -mno-app-regs option. - g6-g7 are reserved for the operating system (or application in - embedded case). - ??? Register 1 is used as a temporary by the 64 bit sethi pattern, so must - currently be a fixed register until this pattern is rewritten. - Register 1 is also used when restoring call-preserved registers in large - stack frames. - - Registers fixed in arch32 and not arch64 (or vice-versa) are marked in - CONDITIONAL_REGISTER_USAGE in order to properly handle -ffixed-. -*/ - -#define FIXED_REGISTERS \ - {1, 0, 0, 0, 0, 0, 1, 1, \ - 0, 0, 0, 0, 0, 0, 1, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 1, 1, \ - \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - \ - 0, 0, 0, 0, 0} - -/* 1 for registers not available across function calls. - These must include the FIXED_REGISTERS and also any - registers that can be used without being saved. - The latter must include the registers where values are returned - and the register where structure-value addresses are passed. - Aside from that, you can include as many other registers as you like. */ - -#define CALL_USED_REGISTERS \ - {1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 1, 1, \ - \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - \ - 1, 1, 1, 1, 1} - -/* If !TARGET_FPU, then make the fp registers and fp cc regs fixed so that - they won't be allocated. */ - -#define CONDITIONAL_REGISTER_USAGE \ -do \ - { \ - if (flag_pic) \ - { \ - fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ - call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \ - } \ - if (TARGET_ARCH32) \ - { \ - fixed_regs[5] = 1; \ - } \ - if (TARGET_LIVE_G0) \ - fixed_regs[0] = 0; \ - if (! TARGET_V9) \ - { \ - int regno; \ - for (regno = SPARC_FIRST_V9_FP_REG; \ - regno <= SPARC_LAST_V9_FP_REG; \ - regno++) \ - fixed_regs[regno] = 1; \ - /* %fcc0 is used by v8 and v9. */ \ - for (regno = SPARC_FIRST_V9_FCC_REG + 1; \ - regno <= SPARC_LAST_V9_FCC_REG; \ - regno++) \ - fixed_regs[regno] = 1; \ - } \ - if (! TARGET_FPU) \ - { \ - int regno; \ - for (regno = 32; regno < SPARC_LAST_V9_FCC_REG; regno++) \ - fixed_regs[regno] = 1; \ - } \ - /* Don't unfix g2-g4 if they were fixed with -ffixed-. */ \ - fixed_regs[2] |= ! TARGET_APP_REGS; \ - fixed_regs[3] |= ! TARGET_APP_REGS; \ - fixed_regs[4] |= ! TARGET_APP_REGS || TARGET_CM_EMBMEDANY; \ - if (TARGET_FLAT) \ - { \ - /* Let the compiler believe the frame pointer is still \ - %fp, but output it as %i7. */ \ - fixed_regs[31] = 1; \ - reg_names[FRAME_POINTER_REGNUM] = "%i7"; \ - /* ??? This is a hack to disable leaf functions. */ \ - global_regs[7] = 1; \ - } \ - if (profile_block_flag) \ - { \ - /* %g1 and %g2 must be fixed, because BLOCK_PROFILER \ - uses them. */ \ - fixed_regs[1] = 1; \ - fixed_regs[2] = 1; \ - } \ - } \ -while (0) - -/* Return number of consecutive hard regs needed starting at reg REGNO - to hold something of mode MODE. - This is ordinarily the length in words of a value of mode MODE - but can be less for certain modes in special long registers. - - On SPARC, ordinary registers hold 32 bits worth; - this means both integer and floating point registers. - On v9, integer regs hold 64 bits worth; floating point regs hold - 32 bits worth (this includes the new fp regs as even the odd ones are - included in the hard register count). */ - -#define HARD_REGNO_NREGS(REGNO, MODE) \ - (TARGET_ARCH64 \ - ? ((REGNO) < 32 \ - ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD \ - : (GET_MODE_SIZE (MODE) + 3) / 4) \ - : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)) - -/* A subreg in 64 bit mode will have the wrong offset for a floating point - register. The least significant part is at offset 1, compared to 0 for - integer registers. This only applies when FMODE is a larger mode. - We also need to handle a special case of TF-->DF conversions. */ -#define ALTER_HARD_SUBREG(TMODE, WORD, FMODE, REGNO) \ - (TARGET_ARCH64 \ - && (REGNO) >= SPARC_FIRST_FP_REG \ - && (REGNO) <= SPARC_LAST_V9_FP_REG \ - && (TMODE) == SImode \ - && !((FMODE) == QImode || (FMODE) == HImode) \ - ? ((REGNO) + 1) \ - : ((TMODE) == DFmode && (FMODE) == TFmode) \ - ? ((REGNO) + ((WORD) * 2)) \ - : ((REGNO) + (WORD))) - -/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. - See sparc.c for how we initialize this. */ -extern int *hard_regno_mode_classes; -extern int sparc_mode_class[]; -#define HARD_REGNO_MODE_OK(REGNO, MODE) \ - ((hard_regno_mode_classes[REGNO] & sparc_mode_class[MODE]) != 0) - -/* Value is 1 if it is a good idea to tie two pseudo registers - when one has mode MODE1 and one has mode MODE2. - If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2, - for any hard reg, then this must be 0 for correct output. - - For V9: SFmode can't be combined with other float modes, because they can't - be allocated to the %d registers. Also, DFmode won't fit in odd %f - registers, but SFmode will. */ -#define MODES_TIEABLE_P(MODE1, MODE2) \ - ((MODE1) == (MODE2) \ - || (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2) \ - && (! TARGET_V9 \ - || (GET_MODE_CLASS (MODE1) != MODE_FLOAT \ - || (MODE1 != SFmode && MODE2 != SFmode))))) - -/* Specify the registers used for certain standard purposes. - The values of these macros are register numbers. */ - -/* SPARC pc isn't overloaded on a register that the compiler knows about. */ -/* #define PC_REGNUM */ - -/* Register to use for pushing function arguments. */ -#define STACK_POINTER_REGNUM 14 - -/* Actual top-of-stack address is 92/176 greater than the contents of the - stack pointer register for !v9/v9. That is: - - !v9: 64 bytes for the in and local registers, 4 bytes for structure return - address, and 6*4 bytes for the 6 register parameters. - - v9: 128 bytes for the in and local registers + 6*8 bytes for the integer - parameter regs. */ -#define STACK_POINTER_OFFSET FIRST_PARM_OFFSET(0) - -/* The stack bias (amount by which the hardware register is offset by). */ -#define SPARC_STACK_BIAS ((TARGET_ARCH64 && TARGET_STACK_BIAS) ? 2047 : 0) - -/* Is stack biased? */ -#define STACK_BIAS SPARC_STACK_BIAS - -/* Base register for access to local variables of the function. */ -#define FRAME_POINTER_REGNUM 30 - -#if 0 -/* Register that is used for the return address for the flat model. */ -#define RETURN_ADDR_REGNUM 15 -#endif - -/* Value should be nonzero if functions must have frame pointers. - Zero means the frame pointer need not be set up (and parms - may be accessed via the stack pointer) in functions that seem suitable. - This is computed in `reload', in reload1.c. - Used in flow.c, global.c, and reload1.c. - - Being a non-leaf function does not mean a frame pointer is needed in the - flat window model. However, the debugger won't be able to backtrace through - us with out it. */ -#define FRAME_POINTER_REQUIRED \ - (TARGET_FLAT ? (current_function_calls_alloca || current_function_varargs \ - || !leaf_function_p ()) \ - : ! (leaf_function_p () && only_leaf_regs_used ())) - -/* C statement to store the difference between the frame pointer - and the stack pointer values immediately after the function prologue. - - Note, we always pretend that this is a leaf function because if - it's not, there's no point in trying to eliminate the - frame pointer. If it is a leaf function, we guessed right! */ -#define INITIAL_FRAME_POINTER_OFFSET(VAR) \ - ((VAR) = (TARGET_FLAT ? sparc_flat_compute_frame_size (get_frame_size ()) \ - : compute_frame_size (get_frame_size (), 1))) - -/* Base register for access to arguments of the function. */ -#define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM - -/* Register in which static-chain is passed to a function. This must - not be a register used by the prologue. */ -#define STATIC_CHAIN_REGNUM (TARGET_ARCH64 ? 5 : 2) - -/* Register which holds offset table for position-independent - data references. */ - -#define PIC_OFFSET_TABLE_REGNUM 23 - -#define FINALIZE_PIC finalize_pic () - -/* Pick a default value we can notice from override_options: - !v9: Default is on. - v9: Default is off. */ - -#define DEFAULT_PCC_STRUCT_RETURN -1 - -/* Sparc ABI says that quad-precision floats and all structures are returned - in memory. - For v9: unions <= 32 bytes in size are returned in int regs, - structures up to 32 bytes are returned in int and fp regs. */ - -#define RETURN_IN_MEMORY(TYPE) \ -(TARGET_ARCH32 \ - ? (TYPE_MODE (TYPE) == BLKmode \ - || TYPE_MODE (TYPE) == TFmode \ - || TYPE_MODE (TYPE) == TCmode) \ - : (TYPE_MODE (TYPE) == BLKmode \ - && int_size_in_bytes (TYPE) > 32)) - -/* Functions which return large structures get the address - to place the wanted value at offset 64 from the frame. - Must reserve 64 bytes for the in and local registers. - v9: Functions which return large structures get the address to place the - wanted value from an invisible first argument. */ -/* Used only in other #defines in this file. */ -#define STRUCT_VALUE_OFFSET 64 - -#define STRUCT_VALUE \ - (TARGET_ARCH64 \ - ? 0 \ - : gen_rtx_MEM (Pmode, \ - gen_rtx_PLUS (Pmode, stack_pointer_rtx, \ - GEN_INT (STRUCT_VALUE_OFFSET)))) -#define STRUCT_VALUE_INCOMING \ - (TARGET_ARCH64 \ - ? 0 \ - : gen_rtx_MEM (Pmode, \ - gen_rtx_PLUS (Pmode, frame_pointer_rtx, \ - GEN_INT (STRUCT_VALUE_OFFSET)))) - -/* Define the classes of registers for register constraints in the - machine description. Also define ranges of constants. - - One of the classes must always be named ALL_REGS and include all hard regs. - If there is more than one class, another class must be named NO_REGS - and contain no registers. - - The name GENERAL_REGS must be the name of a class (or an alias for - another name such as ALL_REGS). This is the class of registers - that is allowed by "g" or "r" in a register constraint. - Also, registers outside this class are allocated only when - instructions express preferences for them. - - The classes must be numbered in nondecreasing order; that is, - a larger-numbered class must never be contained completely - in a smaller-numbered class. - - For any two classes, it is very desirable that there be another - class that represents their union. */ - -/* The SPARC has various kinds of registers: general, floating point, - and condition codes [well, it has others as well, but none that we - care directly about]. - - For v9 we must distinguish between the upper and lower floating point - registers because the upper ones can't hold SFmode values. - HARD_REGNO_MODE_OK won't help here because reload assumes that register(s) - satisfying a group need for a class will also satisfy a single need for - that class. EXTRA_FP_REGS is a bit of a misnomer as it covers all 64 fp - regs. - - It is important that one class contains all the general and all the standard - fp regs. Otherwise find_reg() won't properly allocate int regs for moves, - because reg_class_record() will bias the selection in favor of fp regs, - because reg_class_subunion[GENERAL_REGS][FP_REGS] will yield FP_REGS, - because FP_REGS > GENERAL_REGS. - - It is also important that one class contain all the general and all the - fp regs. Otherwise when spilling a DFmode reg, it may be from EXTRA_FP_REGS - but find_reloads() may use class GENERAL_OR_FP_REGS. This will cause - allocate_reload_reg() to bypass it causing an abort because the compiler - thinks it doesn't have a spill reg when in fact it does. - - v9 also has 4 floating point condition code registers. Since we don't - have a class that is the union of FPCC_REGS with either of the others, - it is important that it appear first. Otherwise the compiler will die - trying to compile _fixunsdfsi because fix_truncdfsi2 won't match its - constraints. - - It is important that SPARC_ICC_REG have class NO_REGS. Otherwise combine - may try to use it to hold an SImode value. See register_operand. - ??? Should %fcc[0123] be handled similarly? -*/ - -enum reg_class { NO_REGS, FPCC_REGS, I64_REGS, GENERAL_REGS, FP_REGS, - EXTRA_FP_REGS, GENERAL_OR_FP_REGS, GENERAL_OR_EXTRA_FP_REGS, - ALL_REGS, LIM_REG_CLASSES }; - -#define N_REG_CLASSES (int) LIM_REG_CLASSES - -/* Give names of register classes as strings for dump file. */ - -#define REG_CLASS_NAMES \ - { "NO_REGS", "FPCC_REGS", "I64_REGS", "GENERAL_REGS", "FP_REGS", \ - "EXTRA_FP_REGS", "GENERAL_OR_FP_REGS", "GENERAL_OR_EXTRA_FP_REGS", \ - "ALL_REGS" } - -/* Define which registers fit in which classes. - This is an initializer for a vector of HARD_REG_SET - of length N_REG_CLASSES. */ - -#define REG_CLASS_CONTENTS \ - {{0, 0, 0, 0}, {0, 0, 0, 0xf}, {0xffff, 0, 0, 0}, \ - {-1, 0, 0, 0}, {0, -1, 0, 0}, {0, -1, -1, 0}, \ - {-1, -1, 0, 0}, {-1, -1, -1, 0}, {-1, -1, -1, 0x1f}} - -/* The same information, inverted: - Return the class number of the smallest class containing - reg number REGNO. This could be a conditional expression - or could index an array. */ - -extern enum reg_class sparc_regno_reg_class[]; - -#define REGNO_REG_CLASS(REGNO) sparc_regno_reg_class[(REGNO)] - -/* This is the order in which to allocate registers normally. - - We put %f0/%f1 last among the float registers, so as to make it more - likely that a pseudo-register which dies in the float return register - will get allocated to the float return register, thus saving a move - instruction at the end of the function. */ - -#define REG_ALLOC_ORDER \ -{ 8, 9, 10, 11, 12, 13, 2, 3, \ - 15, 16, 17, 18, 19, 20, 21, 22, \ - 23, 24, 25, 26, 27, 28, 29, 31, \ - 34, 35, 36, 37, 38, 39, /* %f2-%f7 */ \ - 40, 41, 42, 43, 44, 45, 46, 47, /* %f8-%f15 */ \ - 48, 49, 50, 51, 52, 53, 54, 55, /* %f16-%f23 */ \ - 56, 57, 58, 59, 60, 61, 62, 63, /* %f24-%f31 */ \ - 64, 65, 66, 67, 68, 69, 70, 71, /* %f32-%f39 */ \ - 72, 73, 74, 75, 76, 77, 78, 79, /* %f40-%f47 */ \ - 80, 81, 82, 83, 84, 85, 86, 87, /* %f48-%f55 */ \ - 88, 89, 90, 91, 92, 93, 94, 95, /* %f56-%f63 */ \ - 32, 33, /* %f0,%f1 */ \ - 96, 97, 98, 99, 100, /* %fcc0-3, %icc */ \ - 1, 4, 5, 6, 7, 0, 14, 30} - -/* This is the order in which to allocate registers for - leaf functions. If all registers can fit in the "i" registers, - then we have the possibility of having a leaf function. */ - -#define REG_LEAF_ALLOC_ORDER \ -{ 2, 3, 24, 25, 26, 27, 28, 29, \ - 15, 8, 9, 10, 11, 12, 13, \ - 16, 17, 18, 19, 20, 21, 22, 23, \ - 34, 35, 36, 37, 38, 39, \ - 40, 41, 42, 43, 44, 45, 46, 47, \ - 48, 49, 50, 51, 52, 53, 54, 55, \ - 56, 57, 58, 59, 60, 61, 62, 63, \ - 64, 65, 66, 67, 68, 69, 70, 71, \ - 72, 73, 74, 75, 76, 77, 78, 79, \ - 80, 81, 82, 83, 84, 85, 86, 87, \ - 88, 89, 90, 91, 92, 93, 94, 95, \ - 32, 33, \ - 96, 97, 98, 99, 100, \ - 1, 4, 5, 6, 7, 0, 14, 30, 31} - -#define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc () - -/* ??? %g7 is not a leaf register to effectively #undef LEAF_REGISTERS when - -mflat is used. Function only_leaf_regs_used will return 0 if a global - register is used and is not permitted in a leaf function. We make %g7 - a global reg if -mflat and voila. Since %g7 is a system register and is - fixed it won't be used by gcc anyway. */ - -#define LEAF_REGISTERS \ -{ 1, 1, 1, 1, 1, 1, 1, 0, \ - 0, 0, 0, 0, 0, 0, 1, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, \ - 1, 1, 1, 1, 1, 1, 0, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1} - -extern char leaf_reg_remap[]; -#define LEAF_REG_REMAP(REGNO) (leaf_reg_remap[REGNO]) - -/* The class value for index registers, and the one for base regs. */ -#define INDEX_REG_CLASS GENERAL_REGS -#define BASE_REG_CLASS GENERAL_REGS - -/* Local macro to handle the two v9 classes of FP regs. */ -#define FP_REG_CLASS_P(CLASS) ((CLASS) == FP_REGS || (CLASS) == EXTRA_FP_REGS) - -/* Get reg_class from a letter such as appears in the machine description. - In the not-v9 case, coerce v9's 'e' class to 'f', so we can use 'e' in the - .md file for v8 and v9. - 'd' and 'b' are used for single and double precision VIS operations, - if TARGET_VIS. - 'h' is used for V8+ 64 bit global and out registers. */ - -#define REG_CLASS_FROM_LETTER(C) \ -(TARGET_V9 \ - ? ((C) == 'f' ? FP_REGS \ - : (C) == 'e' ? EXTRA_FP_REGS \ - : (C) == 'c' ? FPCC_REGS \ - : ((C) == 'd' && TARGET_VIS) ? FP_REGS\ - : ((C) == 'b' && TARGET_VIS) ? EXTRA_FP_REGS\ - : ((C) == 'h' && TARGET_V8PLUS) ? I64_REGS\ - : NO_REGS) \ - : ((C) == 'f' ? FP_REGS \ - : (C) == 'e' ? FP_REGS \ - : (C) == 'c' ? FPCC_REGS \ - : NO_REGS)) - -/* The letters I, J, K, L and M in a register constraint string - can be used to stand for particular ranges of immediate operands. - This macro defines what the ranges are. - C is the letter, and VALUE is a constant value. - Return 1 if VALUE is in the range specified by C. - - `I' is used for the range of constants an insn can actually contain. - `J' is used for the range which is just zero (since that is R0). - `K' is used for constants which can be loaded with a single sethi insn. - `L' is used for the range of constants supported by the movcc insns. - `M' is used for the range of constants supported by the movrcc insns. */ - -#define SPARC_SIMM10_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x200 < 0x400) -#define SPARC_SIMM11_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x400 < 0x800) -#define SPARC_SIMM13_P(X) ((unsigned HOST_WIDE_INT) (X) + 0x1000 < 0x2000) -/* 10 and 11 bit immediates are only used for a few specific insns. - SMALL_INT is used throughout the port so we continue to use it. */ -#define SMALL_INT(X) (SPARC_SIMM13_P (INTVAL (X))) -/* 13 bit immediate, considering only the low 32 bits */ -#define SMALL_INT32(X) (SPARC_SIMM13_P ((int)INTVAL (X) & 0xffffffff)) -#define SPARC_SETHI_P(X) \ -(((unsigned HOST_WIDE_INT) (X) & ~(unsigned HOST_WIDE_INT) 0xfffffc00) == 0) - -#define CONST_OK_FOR_LETTER_P(VALUE, C) \ - ((C) == 'I' ? SPARC_SIMM13_P (VALUE) \ - : (C) == 'J' ? (VALUE) == 0 \ - : (C) == 'K' ? SPARC_SETHI_P (VALUE) \ - : (C) == 'L' ? SPARC_SIMM11_P (VALUE) \ - : (C) == 'M' ? SPARC_SIMM10_P (VALUE) \ - : 0) - -/* Similar, but for floating constants, and defining letters G and H. - Here VALUE is the CONST_DOUBLE rtx itself. */ - -#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ - ((C) == 'G' ? fp_zero_operand (VALUE) \ - : (C) == 'H' ? arith_double_operand (VALUE, DImode) \ - : 0) - -/* Given an rtx X being reloaded into a reg required to be - in class CLASS, return the class of reg to actually use. - In general this is just CLASS; but on some machines - in some cases it is preferable to use a more restrictive class. */ -/* - We can't load constants into FP registers. We can't load any FP - constant if an 'E' constraint fails to match it. - - Try and reload integer constants (symbolic or otherwise) back into - registers directly, rather than having them dumped to memory. */ - -#define PREFERRED_RELOAD_CLASS(X,CLASS) \ - (CONSTANT_P (X) \ - ? ((FP_REG_CLASS_P (CLASS) \ - || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ - && (HOST_FLOAT_FORMAT != IEEE_FLOAT_FORMAT \ - || HOST_BITS_PER_INT != BITS_PER_WORD))) \ - ? NO_REGS \ - : (!FP_REG_CLASS_P (CLASS) \ - && GET_MODE_CLASS (GET_MODE (X)) == MODE_INT) \ - ? GENERAL_REGS \ - : (CLASS)) \ - : (CLASS)) - -/* Return the register class of a scratch register needed to load IN into - a register of class CLASS in MODE. - - We need a temporary when loading/storing a HImode/QImode value - between memory and the FPU registers. This can happen when combine puts - a paradoxical subreg in a float/fix conversion insn. */ - -#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN) \ - ((FP_REG_CLASS_P (CLASS) \ - && ((MODE) == HImode || (MODE) == QImode) \ - && (GET_CODE (IN) == MEM \ - || ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG) \ - && true_regnum (IN) == -1))) \ - ? GENERAL_REGS \ - : (((TARGET_CM_MEDANY \ - && symbolic_operand ((IN), (MODE))) \ - || (TARGET_CM_EMBMEDANY \ - && text_segment_operand ((IN), (MODE)))) \ - && !flag_pic) \ - ? GENERAL_REGS \ - : NO_REGS) - -#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, IN) \ - ((FP_REG_CLASS_P (CLASS) \ - && ((MODE) == HImode || (MODE) == QImode) \ - && (GET_CODE (IN) == MEM \ - || ((GET_CODE (IN) == REG || GET_CODE (IN) == SUBREG) \ - && true_regnum (IN) == -1))) \ - ? GENERAL_REGS \ - : (((TARGET_CM_MEDANY \ - && symbolic_operand ((IN), (MODE))) \ - || (TARGET_CM_EMBMEDANY \ - && text_segment_operand ((IN), (MODE)))) \ - && !flag_pic) \ - ? GENERAL_REGS \ - : NO_REGS) - -/* On SPARC it is not possible to directly move data between - GENERAL_REGS and FP_REGS. */ -#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \ - (FP_REG_CLASS_P (CLASS1) != FP_REG_CLASS_P (CLASS2)) - -/* Return the stack location to use for secondary memory needed reloads. - We want to use the reserved location just below the frame pointer. - However, we must ensure that there is a frame, so use assign_stack_local - if the frame size is zero. */ -#define SECONDARY_MEMORY_NEEDED_RTX(MODE) \ - (get_frame_size () == 0 \ - ? assign_stack_local (MODE, GET_MODE_SIZE (MODE), 0) \ - : gen_rtx_MEM (MODE, gen_rtx_PLUS (Pmode, frame_pointer_rtx, \ - GEN_INT (STARTING_FRAME_OFFSET)))) - -/* Get_secondary_mem widens its argument to BITS_PER_WORD which loses on v9 - because the movsi and movsf patterns don't handle r/f moves. - For v8 we copy the default definition. */ -#define SECONDARY_MEMORY_NEEDED_MODE(MODE) \ - (TARGET_ARCH64 \ - ? (GET_MODE_BITSIZE (MODE) < 32 \ - ? mode_for_size (32, GET_MODE_CLASS (MODE), 0) \ - : MODE) \ - : (GET_MODE_BITSIZE (MODE) < BITS_PER_WORD \ - ? mode_for_size (BITS_PER_WORD, GET_MODE_CLASS (MODE), 0) \ - : MODE)) - -/* Return the maximum number of consecutive registers - needed to represent mode MODE in a register of class CLASS. */ -/* On SPARC, this is the size of MODE in words. */ -#define CLASS_MAX_NREGS(CLASS, MODE) \ - (FP_REG_CLASS_P (CLASS) ? (GET_MODE_SIZE (MODE) + 3) / 4 \ - : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) - -/* Stack layout; function entry, exit and calling. */ - -/* Define the number of register that can hold parameters. - This macro is only used in other macro definitions below and in sparc.c. - MODE is the mode of the argument. - !v9: All args are passed in %o0-%o5. - v9: %o0-%o5 and %f0-%f31 are cumulatively used to pass values. - See the description in sparc.c. */ -#define NPARM_REGS(MODE) \ -(TARGET_ARCH64 \ - ? (GET_MODE_CLASS (MODE) == MODE_FLOAT ? 32 : 6) \ - : 6) - -/* Define this if pushing a word on the stack - makes the stack pointer a smaller address. */ -#define STACK_GROWS_DOWNWARD - -/* Define this if the nominal address of the stack frame - is at the high-address end of the local variables; - that is, each additional local variable allocated - goes at a more negative offset in the frame. */ -#define FRAME_GROWS_DOWNWARD - -/* Offset within stack frame to start allocating local variables at. - If FRAME_GROWS_DOWNWARD, this is the offset to the END of the - first local allocated. Otherwise, it is the offset to the BEGINNING - of the first local allocated. */ -/* This allows space for one TFmode floating point value. */ -#define STARTING_FRAME_OFFSET \ - (TARGET_ARCH64 ? (SPARC_STACK_BIAS - 16) \ - : (-SPARC_STACK_ALIGN (LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT))) - -/* If we generate an insn to push BYTES bytes, - this says how many the stack pointer really advances by. - On SPARC, don't define this because there are no push insns. */ -/* #define PUSH_ROUNDING(BYTES) */ - -/* Offset of first parameter from the argument pointer register value. - !v9: This is 64 for the ins and locals, plus 4 for the struct-return reg - even if this function isn't going to use it. - v9: This is 128 for the ins and locals. */ -#define FIRST_PARM_OFFSET(FNDECL) \ - (TARGET_ARCH64 ? (SPARC_STACK_BIAS + 16 * UNITS_PER_WORD) \ - : (STRUCT_VALUE_OFFSET + UNITS_PER_WORD)) - -/* Offset from the argument pointer register value to the CFA. */ - -#define ARG_POINTER_CFA_OFFSET SPARC_STACK_BIAS - -/* When a parameter is passed in a register, stack space is still - allocated for it. - !v9: All 6 possible integer registers have backing store allocated. - v9: Only space for the arguments passed is allocated. */ -/* ??? Ideally, we'd use zero here (as the minimum), but zero has special - meaning to the backend. Further, we need to be able to detect if a - varargs/unprototyped function is called, as they may want to spill more - registers than we've provided space. Ugly, ugly. So for now we retain - all 6 slots even for v9. */ -#define REG_PARM_STACK_SPACE(DECL) (6 * UNITS_PER_WORD) - -/* Keep the stack pointer constant throughout the function. - This is both an optimization and a necessity: longjmp - doesn't behave itself when the stack pointer moves within - the function! */ -#define ACCUMULATE_OUTGOING_ARGS - -/* Value is the number of bytes of arguments automatically - popped when returning from a subroutine call. - FUNDECL is the declaration node of the function (as a tree), - FUNTYPE is the data type of the function (as a tree), - or for a library call it is an identifier node for the subroutine name. - SIZE is the number of bytes of arguments passed on the stack. */ - -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 - -/* Some subroutine macros specific to this machine. - When !TARGET_FPU, put float return values in the general registers, - since we don't have any fp registers. */ -#define BASE_RETURN_VALUE_REG(MODE) \ - (TARGET_ARCH64 \ - ? (TARGET_FPU && FLOAT_MODE_P (MODE) ? 32 : 8) \ - : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32 : 8)) - -#define BASE_OUTGOING_VALUE_REG(MODE) \ - (TARGET_ARCH64 \ - ? (TARGET_FPU && FLOAT_MODE_P (MODE) ? 32 \ - : TARGET_FLAT ? 8 : 24) \ - : (((MODE) == SFmode || (MODE) == DFmode) && TARGET_FPU ? 32 \ - : (TARGET_FLAT ? 8 : 24))) - -#define BASE_PASSING_ARG_REG(MODE) \ - (TARGET_ARCH64 \ - ? (TARGET_FPU && FLOAT_MODE_P (MODE) ? 32 : 8) \ - : 8) - -/* ??? FIXME -- seems wrong for v9 structure passing... */ -#define BASE_INCOMING_ARG_REG(MODE) \ - (TARGET_ARCH64 \ - ? (TARGET_FPU && FLOAT_MODE_P (MODE) ? 32 \ - : TARGET_FLAT ? 8 : 24) \ - : (TARGET_FLAT ? 8 : 24)) - -/* Define this macro if the target machine has "register windows". This - C expression returns the register number as seen by the called function - corresponding to register number OUT as seen by the calling function. - Return OUT if register number OUT is not an outbound register. */ - -#define INCOMING_REGNO(OUT) \ - ((TARGET_FLAT || (OUT) < 8 || (OUT) > 15) ? (OUT) : (OUT) + 16) - -/* Define this macro if the target machine has "register windows". This - C expression returns the register number as seen by the calling function - corresponding to register number IN as seen by the called function. - Return IN if register number IN is not an inbound register. */ - -#define OUTGOING_REGNO(IN) \ - ((TARGET_FLAT || (IN) < 24 || (IN) > 31) ? (IN) : (IN) - 16) - -/* Define how to find the value returned by a function. - VALTYPE is the data type of the value (as a tree). - If the precise function being called is known, FUNC is its FUNCTION_DECL; - otherwise, FUNC is 0. */ - -/* On SPARC the value is found in the first "output" register. */ - -extern struct rtx_def *function_value (); -#define FUNCTION_VALUE(VALTYPE, FUNC) \ - function_value ((VALTYPE), TYPE_MODE (VALTYPE), 1) - -/* But the called function leaves it in the first "input" register. */ - -#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \ - function_value ((VALTYPE), TYPE_MODE (VALTYPE), 0) - -/* Define how to find the value returned by a library function - assuming the value has mode MODE. */ - -#define LIBCALL_VALUE(MODE) \ - function_value (NULL_TREE, (MODE), 1) - -/* 1 if N is a possible register number for a function value - as seen by the caller. - On SPARC, the first "output" reg is used for integer values, - and the first floating point register is used for floating point values. */ - -#define FUNCTION_VALUE_REGNO_P(N) ((N) == 8 || (N) == 32) - -/* Define the size of space to allocate for the return value of an - untyped_call. */ - -#define APPLY_RESULT_SIZE 16 - -/* 1 if N is a possible register number for function argument passing. - On SPARC, these are the "output" registers. v9 also uses %f0-%f31. */ - -#define FUNCTION_ARG_REGNO_P(N) \ -(TARGET_ARCH64 \ - ? (((N) >= 8 && (N) <= 13) || ((N) >= 32 && (N) <= 63)) \ - : ((N) >= 8 && (N) <= 13)) - -/* Define a data type for recording info about an argument list - during the scan of that argument list. This data type should - hold all necessary information about the function itself - and about the args processed so far, enough to enable macros - such as FUNCTION_ARG to determine where the next arg should go. - - On SPARC (!v9), this is a single integer, which is a number of words - of arguments scanned so far (including the invisible argument, - if any, which holds the structure-value-address). - Thus 7 or more means all following args should go on the stack. - - For v9, we also need to know whether a prototype is present. */ - -struct sparc_args { - int words; /* number of words passed so far */ - int prototype_p; /* non-zero if a prototype is present */ - int libcall_p; /* non-zero if a library call */ -}; -#define CUMULATIVE_ARGS struct sparc_args - -/* Initialize a variable CUM of type CUMULATIVE_ARGS - for a call to a function whose data type is FNTYPE. - For a library call, FNTYPE is 0. */ - -extern void init_cumulative_args (); -#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \ -init_cumulative_args (& (CUM), (FNTYPE), (LIBNAME), (INDIRECT)); - -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - TYPE is null for libcalls where that information may not be available. */ - -extern void function_arg_advance (); -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ -function_arg_advance (& (CUM), (MODE), (TYPE), (NAMED)) - -/* Determine where to put an argument to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - MODE is the argument's machine mode. - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). */ - -extern struct rtx_def *function_arg (); -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ -function_arg (& (CUM), (MODE), (TYPE), (NAMED), 0) - -/* Define where a function finds its arguments. - This is different from FUNCTION_ARG because of register windows. */ - -#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \ -function_arg (& (CUM), (MODE), (TYPE), (NAMED), 1) - -/* For an arg passed partly in registers and partly in memory, - this is the number of registers used. - For args passed entirely in registers or entirely in memory, zero. */ - -extern int function_arg_partial_nregs (); -#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ -function_arg_partial_nregs (& (CUM), (MODE), (TYPE), (NAMED)) - -/* A C expression that indicates when an argument must be passed by reference. - If nonzero for an argument, a copy of that argument is made in memory and a - pointer to the argument is passed instead of the argument itself. - The pointer is passed in whatever way is appropriate for passing a pointer - to that type. */ - -extern int function_arg_pass_by_reference (); -#define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \ -function_arg_pass_by_reference (& (CUM), (MODE), (TYPE), (NAMED)) - -/* If defined, a C expression which determines whether, and in which direction, - to pad out an argument with extra space. The value should be of type - `enum direction': either `upward' to pad above the argument, - `downward' to pad below, or `none' to inhibit padding. */ - -#define FUNCTION_ARG_PADDING(MODE, TYPE) \ -function_arg_padding ((MODE), (TYPE)) - -/* If defined, a C expression that gives the alignment boundary, in bits, - of an argument with the specified mode and type. If it is not defined, - PARM_BOUNDARY is used for all arguments. - For sparc64, objects requiring 16 byte alignment are passed that way. */ - -#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \ -((TARGET_ARCH64 \ - && (GET_MODE_ALIGNMENT (MODE) == 128 \ - || ((TYPE) && TYPE_ALIGN (TYPE) == 128))) \ - ? 128 : PARM_BOUNDARY) - -/* Define the information needed to generate branch and scc insns. This is - stored from the compare operation. Note that we can't use "rtx" here - since it hasn't been defined! */ - -extern struct rtx_def *sparc_compare_op0, *sparc_compare_op1; - -/* Define the function that build the compare insn for scc and bcc. */ - -extern struct rtx_def *gen_compare_reg (); - -/* This function handles all v9 scc insns */ - -extern int gen_v9_scc (); - -/* Generate the special assembly code needed to tell the assembler whatever - it might need to know about the return value of a function. - - For Sparc assemblers, we need to output a .proc pseudo-op which conveys - information to the assembler relating to peephole optimization (done in - the assembler). */ - -#define ASM_DECLARE_RESULT(FILE, RESULT) \ - fprintf ((FILE), "\t.proc\t0%lo\n", sparc_type_code (TREE_TYPE (RESULT))) - -/* Output the label for a function definition. */ - -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ -do { \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - ASM_OUTPUT_LABEL (FILE, NAME); \ -} while (0) - -/* This macro generates the assembly code for function entry. - FILE is a stdio stream to output the code to. - SIZE is an int: how many units of temporary storage to allocate. - Refer to the array `regs_ever_live' to determine which registers - to save; `regs_ever_live[I]' is nonzero if register number I - is ever used in the function. This macro is responsible for - knowing which registers should not be saved even if used. */ - -/* On SPARC, move-double insns between fpu and cpu need an 8-byte block - of memory. If any fpu reg is used in the function, we allocate - such a block here, at the bottom of the frame, just in case it's needed. - - If this function is a leaf procedure, then we may choose not - to do a "save" insn. The decision about whether or not - to do this is made in regclass.c. */ - -#define FUNCTION_PROLOGUE(FILE, SIZE) \ - (TARGET_FLAT ? sparc_flat_output_function_prologue (FILE, (int)SIZE) \ - : output_function_prologue (FILE, (int)SIZE, \ - current_function_uses_only_leaf_regs)) - -/* Output assembler code to FILE to increment profiler label # LABELNO - for profiling a function entry. */ - -#define FUNCTION_PROFILER(FILE, LABELNO) \ - sparc_function_profiler(FILE, LABELNO) - -/* Set the name of the mcount function for the system. */ - -#define MCOUNT_FUNCTION "*mcount" - -/* The following macro shall output assembler code to FILE - to initialize basic-block profiling. */ - -#define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \ - sparc_function_block_profiler(FILE, BLOCK_OR_LABEL) - -/* The following macro shall output assembler code to FILE - to increment a counter associated with basic block number BLOCKNO. */ - -#define BLOCK_PROFILER(FILE, BLOCKNO) \ - sparc_block_profiler (FILE, BLOCKNO) - -/* The following macro shall output assembler code to FILE - to indicate a return from function during basic-block profiling. */ - -#define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \ - sparc_function_block_profiler_exit(FILE) - -/* The function `__bb_trace_func' is called in every basic block - and is not allowed to change the machine state. Saving (restoring) - the state can either be done in the BLOCK_PROFILER macro, - before calling function (rsp. after returning from function) - `__bb_trace_func', or it can be done inside the function by - defining the macros: - - MACHINE_STATE_SAVE(ID) - MACHINE_STATE_RESTORE(ID) - - In the latter case care must be taken, that the prologue code - of function `__bb_trace_func' does not already change the - state prior to saving it with MACHINE_STATE_SAVE. - - The parameter `ID' is a string identifying a unique macro use. - - On sparc it is sufficient to save the psw register to memory. - Unfortunately the psw register can be read in supervisor mode only, - so we read only the condition codes by using branch instructions - and hope that this is enough. */ - -#define MACHINE_STATE_SAVE(ID) \ - int ms_flags, ms_saveret; \ - asm volatile( \ - "mov %%g0,%0\n\ - be,a LFLGNZ"ID"\n\ - or %0,4,%0\n\ -LFLGNZ"ID":\n\ - bcs,a LFLGNC"ID"\n\ - or %0,1,%0\n\ -LFLGNC"ID":\n\ - bvs,a LFLGNV"ID"\n\ - or %0,2,%0\n\ -LFLGNV"ID":\n\ - bneg,a LFLGNN"ID"\n\ - or %0,8,%0\n\ -LFLGNN"ID":\n\ - mov %%g2,%1" \ - : "=r"(ms_flags), "=r"(ms_saveret)); - -/* On sparc MACHINE_STATE_RESTORE restores the psw register from memory. - The psw register can be written in supervisor mode only, - which is true even for simple condition codes. - We use some combination of instructions to produce the - proper condition codes, but some flag combinations can not - be generated in this way. If this happens an unimplemented - instruction will be executed to abort the program. */ - -#define MACHINE_STATE_RESTORE(ID) \ -{ extern char flgtab[] __asm__("LFLGTAB"ID); \ - int scratch; \ - asm volatile ( \ - "jmpl %2+%1,%%g0\n\ - ! Do part of VC in the delay slot here, as it needs 3 insns.\n\ - addcc 2,%3,%%g0\n\ -LFLGTAB" ID ":\n\ - ! 0\n\ - ba LFLGRET"ID"\n\ - orcc 1,%%g0,%%g0\n\ - ! C\n\ - ba LFLGRET"ID"\n\ - addcc 2,%3,%%g0\n\ - ! V\n\ - unimp\n\ - nop\n\ - ! VC\n\ - ba LFLGRET"ID"\n\ - addxcc %4,%4,%0\n\ - ! Z\n\ - ba LFLGRET"ID"\n\ - subcc %%g0,%%g0,%%g0\n\ - ! ZC\n\ - ba LFLGRET"ID"\n\ - addcc 1,%3,%0\n\ - ! ZVC\n\ - ba LFLGRET"ID"\n\ - addcc %4,%4,%0\n\ - ! N\n\ - ba LFLGRET"ID"\n\ - orcc %%g0,-1,%%g0\n\ - ! NC\n\ - ba LFLGRET"ID"\n\ - addcc %%g0,%3,%%g0\n\ - ! NV\n\ - unimp\n\ - nop\n\ - ! NVC\n\ - unimp\n\ - nop\n\ - ! NZ\n\ - unimp\n\ - nop\n\ - ! NZC\n\ - unimp\n\ - nop\n\ - ! NZV\n\ - unimp\n\ - nop\n\ - ! NZVC\n\ - unimp\n\ - nop\n\ -LFLGRET"ID":\n\ - mov %5,%%g2" \ - : "=r"(scratch) \ - : "r"(ms_flags*8), "r"(flgtab), "r"(-1), \ - "r"(0x80000000), "r"(ms_saveret) \ - : "cc", "%g2"); } - -/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, - the stack pointer does not matter. The value is tested only in - functions that have frame pointers. - No definition is equivalent to always zero. */ - -extern int current_function_calls_alloca; -extern int current_function_outgoing_args_size; - -#define EXIT_IGNORE_STACK \ - (get_frame_size () != 0 \ - || current_function_calls_alloca || current_function_outgoing_args_size) - -/* This macro generates the assembly code for function exit, - on machines that need it. If FUNCTION_EPILOGUE is not defined - then individual return instructions are generated for each - return statement. Args are same as for FUNCTION_PROLOGUE. - - The function epilogue should not depend on the current stack pointer! - It should use the frame pointer only. This is mandatory because - of alloca; we also take advantage of it to omit stack adjustments - before returning. */ - -/* This declaration is needed due to traditional/ANSI - incompatibilities which cannot be #ifdefed away - because they occur inside of macros. Sigh. */ -extern union tree_node *current_function_decl; - -#define FUNCTION_EPILOGUE(FILE, SIZE) \ - (TARGET_FLAT ? sparc_flat_output_function_epilogue (FILE, (int)SIZE) \ - : output_function_epilogue (FILE, (int)SIZE, \ - current_function_uses_only_leaf_regs)) - -#define DELAY_SLOTS_FOR_EPILOGUE \ - (TARGET_FLAT ? sparc_flat_epilogue_delay_slots () : 1) -#define ELIGIBLE_FOR_EPILOGUE_DELAY(trial, slots_filled) \ - (TARGET_FLAT ? sparc_flat_eligible_for_epilogue_delay (trial, slots_filled) \ - : eligible_for_epilogue_delay (trial, slots_filled)) - -/* Define registers used by the epilogue and return instruction. */ -#define EPILOGUE_USES(REGNO) \ - (!TARGET_FLAT && REGNO == 31) - -/* Length in units of the trampoline for entering a nested function. */ - -#define TRAMPOLINE_SIZE (TARGET_ARCH64 ? 32 : 16) - -#define TRAMPOLINE_ALIGNMENT 128 /* 16 bytes */ - -/* Emit RTL insns to initialize the variable parts of a trampoline. - FNADDR is an RTX for the address of the function's pure code. - CXT is an RTX for the static chain value for the function. */ - -void sparc_initialize_trampoline (); -void sparc64_initialize_trampoline (); -#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ - if (TARGET_ARCH64) \ - sparc64_initialize_trampoline (TRAMP, FNADDR, CXT); \ - else \ - sparc_initialize_trampoline (TRAMP, FNADDR, CXT) - -/* Generate necessary RTL for __builtin_saveregs(). - ARGLIST is the argument list; see expr.c. */ - -extern struct rtx_def *sparc_builtin_saveregs (); -#define EXPAND_BUILTIN_SAVEREGS(ARGLIST) sparc_builtin_saveregs (ARGLIST) - -/* Define this macro if the location where a function argument is passed - depends on whether or not it is a named argument. - - This macro controls how the NAMED argument to FUNCTION_ARG - is set for varargs and stdarg functions. With this macro defined, - the NAMED argument is always true for named arguments, and false for - unnamed arguments. If this is not defined, but SETUP_INCOMING_VARARGS - is defined, then all arguments are treated as named. Otherwise, all named - arguments except the last are treated as named. - For the v9 we want NAMED to mean what it says it means. */ - -#define STRICT_ARGUMENT_NAMING TARGET_V9 - -/* Generate RTL to flush the register windows so as to make arbitrary frames - available. */ -#define SETUP_FRAME_ADDRESSES() \ - emit_insn (gen_flush_register_windows ()) - -/* Given an rtx for the address of a frame, - return an rtx for the address of the word in the frame - that holds the dynamic chain--the previous frame's address. - ??? -mflat support? */ -#define DYNAMIC_CHAIN_ADDRESS(frame) \ - gen_rtx_PLUS (Pmode, frame, GEN_INT (14 * UNITS_PER_WORD)) - -/* The return address isn't on the stack, it is in a register, so we can't - access it from the current frame pointer. We can access it from the - previous frame pointer though by reading a value from the register window - save area. */ -#define RETURN_ADDR_IN_PREVIOUS_FRAME - -/* This is the offset of the return address to the true next instruction to be - executed for the current function. */ -#define RETURN_ADDR_OFFSET \ - (8 + 4 * (! TARGET_ARCH64 && current_function_returns_struct)) - -/* The current return address is in %i7. The return address of anything - farther back is in the register window save area at [%fp+60]. */ -/* ??? This ignores the fact that the actual return address is +8 for normal - returns, and +12 for structure returns. */ -#define RETURN_ADDR_RTX(count, frame) \ - ((count == -1) \ - ? gen_rtx_REG (Pmode, 31) \ - : gen_rtx_MEM (Pmode, \ - memory_address (Pmode, plus_constant (frame, 15 * UNITS_PER_WORD)))) - -/* Before the prologue, the return address is %o7 + 8. OK, sometimes it's - +12, but always using +8 is close enough for frame unwind purposes. - Actually, just using %o7 is close enough for unwinding, but %o7+8 - is something you can return to. */ -#define INCOMING_RETURN_ADDR_RTX \ - gen_rtx_PLUS (word_mode, gen_rtx_REG (word_mode, 15), GEN_INT (8)) - -/* The offset from the incoming value of %sp to the top of the stack frame - for the current function. On sparc64, we have to account for the stack - bias if present. */ -#define INCOMING_FRAME_SP_OFFSET SPARC_STACK_BIAS - -#define DOESNT_NEED_UNWINDER (! TARGET_FLAT) - -/* Addressing modes, and classification of registers for them. */ - -/* #define HAVE_POST_INCREMENT 0 */ -/* #define HAVE_POST_DECREMENT 0 */ - -/* #define HAVE_PRE_DECREMENT 0 */ -/* #define HAVE_PRE_INCREMENT 0 */ - -/* Macros to check register numbers against specific register classes. */ - -/* These assume that REGNO is a hard or pseudo reg number. - They give nonzero only if REGNO is a hard reg of the suitable class - or a pseudo reg currently allocated to a suitable hard reg. - Since they use reg_renumber, they are safe only once reg_renumber - has been allocated, which happens in local-alloc.c. */ - -#define REGNO_OK_FOR_INDEX_P(REGNO) \ -((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < (unsigned)32) -#define REGNO_OK_FOR_BASE_P(REGNO) \ -((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < (unsigned)32) -#define REGNO_OK_FOR_FP_P(REGNO) \ - (((unsigned) (REGNO) - 32 < (TARGET_V9 ? (unsigned)64 : (unsigned)32)) \ - || ((unsigned) reg_renumber[REGNO] - 32 < (TARGET_V9 ? (unsigned)64 : (unsigned)32))) -#define REGNO_OK_FOR_CCFP_P(REGNO) \ - (TARGET_V9 \ - && (((unsigned) (REGNO) - 96 < (unsigned)4) \ - || ((unsigned) reg_renumber[REGNO] - 96 < (unsigned)4))) - -/* Now macros that check whether X is a register and also, - strictly, whether it is in a specified class. - - These macros are specific to the SPARC, and may be used only - in code for printing assembler insns and in conditions for - define_optimization. */ - -/* 1 if X is an fp register. */ - -#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X))) - -/* Is X, a REG, an in or global register? i.e. is regno 0..7 or 24..31 */ -#define IN_OR_GLOBAL_P(X) (REGNO (X) < 8 || (REGNO (X) >= 24 && REGNO (X) <= 31)) - -/* Maximum number of registers that can appear in a valid memory address. */ - -#define MAX_REGS_PER_ADDRESS 2 - -/* Recognize any constant value that is a valid address. - When PIC, we do not accept an address that would require a scratch reg - to load into a register. */ - -#define CONSTANT_ADDRESS_P(X) \ - (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \ - || GET_CODE (X) == CONST_INT || GET_CODE (X) == HIGH \ - || (GET_CODE (X) == CONST \ - && ! (flag_pic && pic_address_needs_scratch (X)))) - -/* Define this, so that when PIC, reload won't try to reload invalid - addresses which require two reload registers. */ - -#define LEGITIMATE_PIC_OPERAND_P(X) (! pic_address_needs_scratch (X)) - -/* Nonzero if the constant value X is a legitimate general operand. - Anything can be made to work except floating point constants. - If TARGET_VIS, 0.0 can be made to work as well. */ - -#define LEGITIMATE_CONSTANT_P(X) \ - (GET_CODE (X) != CONST_DOUBLE || GET_MODE (X) == VOIDmode || \ - (TARGET_VIS && (GET_MODE (X) == SFmode || GET_MODE (X) == DFmode) && \ - fp_zero_operand (X))) - -/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx - and check its validity for a certain class. - We have two alternate definitions for each of them. - The usual definition accepts all pseudo regs; the other rejects - them unless they have been allocated suitable hard regs. - The symbol REG_OK_STRICT causes the latter definition to be used. - - Most source files want to accept pseudo regs in the hope that - they will get allocated to the class that the insn wants them to be in. - Source files for reload pass need to be strict. - After reload, it makes no difference, since pseudo regs have - been eliminated by then. */ - -/* Optional extra constraints for this machine. - - 'T' handles memory addresses where the alignment is known to - be at least 8 bytes. - - `U' handles all pseudo registers or a hard even numbered - integer register, needed for ldd/std instructions. */ - -#ifndef REG_OK_STRICT - -/* Nonzero if X is a hard reg that can be used as an index - or if it is a pseudo reg. */ -#define REG_OK_FOR_INDEX_P(X) \ - (((unsigned) REGNO (X)) - 32 >= (FIRST_PSEUDO_REGISTER - 32)) -/* Nonzero if X is a hard reg that can be used as a base reg - or if it is a pseudo reg. */ -#define REG_OK_FOR_BASE_P(X) \ - (((unsigned) REGNO (X)) - 32 >= (FIRST_PSEUDO_REGISTER - 32)) - -/* 'T', 'U' are for aligned memory loads which aren't needed for v9. */ - -#define EXTRA_CONSTRAINT(OP, C) \ - ((! TARGET_ARCH64 && (C) == 'T') \ - ? (mem_min_alignment (OP, 8)) \ - : ((! TARGET_ARCH64 && (C) == 'U') \ - ? (register_ok_for_ldd (OP)) \ - : 0)) - -#else - -/* Nonzero if X is a hard reg that can be used as an index. */ -#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) -/* Nonzero if X is a hard reg that can be used as a base reg. */ -#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) - -#define EXTRA_CONSTRAINT(OP, C) \ - ((! TARGET_ARCH64 && (C) == 'T') \ - ? mem_min_alignment (OP, 8) && strict_memory_address_p (Pmode, XEXP (OP, 0)) \ - : ((! TARGET_ARCH64 && (C) == 'U') \ - ? (GET_CODE (OP) == REG \ - && (REGNO (OP) < FIRST_PSEUDO_REGISTER \ - || reg_renumber[REGNO (OP)] >= 0) \ - && register_ok_for_ldd (OP)) \ - : 0)) -#endif - -/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression - that is a valid memory address for an instruction. - The MODE argument is the machine mode for the MEM expression - that wants to use this address. - - On SPARC, the actual legitimate addresses must be REG+REG or REG+SMALLINT - ordinarily. This changes a bit when generating PIC. - - If you change this, execute "rm explow.o recog.o reload.o". */ - -#define RTX_OK_FOR_BASE_P(X) \ - ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \ - || (GET_CODE (X) == SUBREG \ - && GET_CODE (SUBREG_REG (X)) == REG \ - && REG_OK_FOR_BASE_P (SUBREG_REG (X)))) - -#define RTX_OK_FOR_INDEX_P(X) \ - ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \ - || (GET_CODE (X) == SUBREG \ - && GET_CODE (SUBREG_REG (X)) == REG \ - && REG_OK_FOR_INDEX_P (SUBREG_REG (X)))) - -#define RTX_OK_FOR_OFFSET_P(X) \ - (GET_CODE (X) == CONST_INT && INTVAL (X) >= -0x1000 && INTVAL (X) < 0x1000) - -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ if (RTX_OK_FOR_BASE_P (X)) \ - goto ADDR; \ - else if (GET_CODE (X) == PLUS) \ - { \ - register rtx op0 = XEXP (X, 0); \ - register rtx op1 = XEXP (X, 1); \ - if (flag_pic && op0 == pic_offset_table_rtx) \ - { \ - if (RTX_OK_FOR_BASE_P (op1)) \ - goto ADDR; \ - else if (flag_pic == 1 \ - && GET_CODE (op1) != REG \ - && GET_CODE (op1) != LO_SUM \ - && GET_CODE (op1) != MEM \ - && (GET_CODE (op1) != CONST_INT \ - || SMALL_INT (op1))) \ - goto ADDR; \ - } \ - else if (RTX_OK_FOR_BASE_P (op0)) \ - { \ - if ((RTX_OK_FOR_INDEX_P (op1) \ - /* We prohibit REG + REG for TFmode when \ - there are no instructions which accept \ - REG+REG instructions. We do this \ - because REG+REG is not an offsetable \ - address. If we get the situation \ - in reload where source and destination \ - of a movtf pattern are both MEMs with \ - REG+REG address, then only one of them \ - gets converted to an offsetable \ - address. */ \ - && (MODE != TFmode \ - || (TARGET_FPU && TARGET_ARCH64 \ - && TARGET_V9 \ - && TARGET_HARD_QUAD))) \ - || RTX_OK_FOR_OFFSET_P (op1)) \ - goto ADDR; \ - } \ - else if (RTX_OK_FOR_BASE_P (op1)) \ - { \ - if ((RTX_OK_FOR_INDEX_P (op0) \ - /* See the previous comment. */ \ - && (MODE != TFmode \ - || (TARGET_FPU && TARGET_ARCH64 \ - && TARGET_V9 \ - && TARGET_HARD_QUAD))) \ - || RTX_OK_FOR_OFFSET_P (op0)) \ - goto ADDR; \ - } \ - } \ - else if (GET_CODE (X) == LO_SUM) \ - { \ - register rtx op0 = XEXP (X, 0); \ - register rtx op1 = XEXP (X, 1); \ - if (RTX_OK_FOR_BASE_P (op0) \ - && CONSTANT_P (op1) \ - /* We can't allow TFmode, because an offset \ - greater than or equal to the alignment (8) \ - may cause the LO_SUM to overflow if !v9. */\ - && (MODE != TFmode || TARGET_V9)) \ - goto ADDR; \ - } \ - else if (GET_CODE (X) == CONST_INT && SMALL_INT (X)) \ - goto ADDR; \ -} - -/* Try machine-dependent ways of modifying an illegitimate address - to be legitimate. If we find one, return the new, valid address. - This macro is used in only one place: `memory_address' in explow.c. - - OLDX is the address as it was before break_out_memory_refs was called. - In some cases it is useful to look at this to decide what needs to be done. - - MODE and WIN are passed so that this macro can use - GO_IF_LEGITIMATE_ADDRESS. - - It is always safe for this macro to do nothing. It exists to recognize - opportunities to optimize the output. */ - -/* On SPARC, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */ -extern struct rtx_def *legitimize_pic_address (); -#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \ -{ rtx sparc_x = (X); \ - if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \ - (X) = gen_rtx_PLUS (Pmode, XEXP (X, 1), \ - force_operand (XEXP (X, 0), NULL_RTX)); \ - if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == MULT) \ - (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0), \ - force_operand (XEXP (X, 1), NULL_RTX)); \ - if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == PLUS) \ - (X) = gen_rtx_PLUS (Pmode, force_operand (XEXP (X, 0), NULL_RTX),\ - XEXP (X, 1)); \ - if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == PLUS) \ - (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0), \ - force_operand (XEXP (X, 1), NULL_RTX)); \ - if (sparc_x != (X) && memory_address_p (MODE, X)) \ - goto WIN; \ - if (flag_pic) (X) = legitimize_pic_address (X, MODE, 0); \ - else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \ - (X) = gen_rtx_PLUS (Pmode, XEXP (X, 0), \ - copy_to_mode_reg (Pmode, XEXP (X, 1))); \ - else if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 0))) \ - (X) = gen_rtx_PLUS (Pmode, XEXP (X, 1), \ - copy_to_mode_reg (Pmode, XEXP (X, 0))); \ - else if (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \ - || GET_CODE (X) == LABEL_REF) \ - (X) = copy_to_suggested_reg (X, NULL_RTX, Pmode); \ - if (memory_address_p (MODE, X)) \ - goto WIN; } - -/* Try a machine-dependent way of reloading an illegitimate address - operand. If we find one, push the reload and jump to WIN. This - macro is used in only one place: `find_reloads_address' in reload.c. - - For Sparc 32, we wish to handle addresses by splitting them into - HIGH+LO_SUM pairs, retaining the LO_SUM in the memory reference. - This cuts the number of extra insns by one. - - Do nothing when generating PIC code and the address is a - symbolic operand or requires a scratch register. */ - -#define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_LEVELS,WIN) \ -do { \ - /* Decompose SImode constants into hi+lo_sum. We do have to \ - rerecognize what we produce, so be careful. */ \ - if (CONSTANT_P (X) \ - && (MODE != TFmode || TARGET_V9) \ - && GET_MODE (X) == SImode \ - && GET_CODE (X) != LO_SUM && GET_CODE (X) != HIGH \ - && ! (flag_pic \ - && (symbolic_operand (X, Pmode) \ - || pic_address_needs_scratch (X)))) \ - { \ - X = gen_rtx_LO_SUM (GET_MODE (X), \ - gen_rtx_HIGH (GET_MODE (X), X), X); \ - push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL_PTR, \ - BASE_REG_CLASS, GET_MODE (X), VOIDmode, 0, 0, \ - OPNUM, TYPE); \ - goto WIN; \ - } \ - /* ??? 64-bit reloads. */ \ -} while (0) - -/* Go to LABEL if ADDR (a legitimate address expression) - has an effect that depends on the machine mode it is used for. - On the SPARC this is never true. */ - -#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) - -/* If we are referencing a function make the SYMBOL_REF special. - In the Embedded Medium/Anywhere code model, %g4 points to the data segment - so we must not add it to function addresses. */ - -#define ENCODE_SECTION_INFO(DECL) \ - do { \ - if (TARGET_CM_EMBMEDANY && TREE_CODE (DECL) == FUNCTION_DECL) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ - } while (0) - -/* Specify the machine mode that this machine uses - for the index in the tablejump instruction. */ -/* If we ever implement any of the full models (such as CM_FULLANY), - this has to be DImode in that case */ -#ifdef HAVE_GAS_SUBSECTION_ORDERING -#define CASE_VECTOR_MODE \ -(! TARGET_PTR64 ? SImode : flag_pic ? SImode : TARGET_CM_MEDLOW ? SImode : DImode) -#else -/* If assembler does not have working .subsection -1, we use DImode for pic, as otherwise - we have to sign extend which slows things down. */ -#define CASE_VECTOR_MODE \ -(! TARGET_PTR64 ? SImode : flag_pic ? DImode : TARGET_CM_MEDLOW ? SImode : DImode) -#endif - -/* Define as C expression which evaluates to nonzero if the tablejump - instruction expects the table to contain offsets from the address of the - table. - Do not define this if the table should contain absolute addresses. */ -/* #define CASE_VECTOR_PC_RELATIVE 1 */ - -/* Specify the tree operation to be used to convert reals to integers. */ -#define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR - -/* This is the kind of divide that is easiest to do in the general case. */ -#define EASY_DIV_EXPR TRUNC_DIV_EXPR - -/* Define this as 1 if `char' should by default be signed; else as 0. */ -#define DEFAULT_SIGNED_CHAR 1 - -/* Max number of bytes we can move from memory to memory - in one reasonably fast instruction. */ -#define MOVE_MAX 8 - -#if 0 /* Sun 4 has matherr, so this is no good. */ -/* This is the value of the error code EDOM for this machine, - used by the sqrt instruction. */ -#define TARGET_EDOM 33 - -/* This is how to refer to the variable errno. */ -#define GEN_ERRNO_RTX \ - gen_rtx_MEM (SImode, gen_rtx_SYMBOL_REF (Pmode, "errno")) -#endif /* 0 */ - -/* Define if operations between registers always perform the operation - on the full register even if a narrower mode is specified. */ -#define WORD_REGISTER_OPERATIONS - -/* Define if loading in MODE, an integral mode narrower than BITS_PER_WORD - will either zero-extend or sign-extend. The value of this macro should - be the code that says which one of the two operations is implicitly - done, NIL if none. */ -#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND - -/* Nonzero if access to memory by bytes is slow and undesirable. - For RISC chips, it means that access to memory by bytes is no - better than access by words when possible, so grab a whole word - and maybe make use of that. */ -#define SLOW_BYTE_ACCESS 1 - -/* We assume that the store-condition-codes instructions store 0 for false - and some other value for true. This is the value stored for true. */ - -#define STORE_FLAG_VALUE 1 - -/* When a prototype says `char' or `short', really pass an `int'. */ -#define PROMOTE_PROTOTYPES - -/* Define this to be nonzero if shift instructions ignore all but the low-order - few bits. */ -#define SHIFT_COUNT_TRUNCATED 1 - -/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits - is done just by pretending it is already truncated. */ -#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 - -/* Specify the machine mode that pointers have. - After generation of rtl, the compiler makes no further distinction - between pointers and any other objects of this machine mode. */ -#define Pmode (TARGET_PTR64 ? DImode : SImode) - -/* Generate calls to memcpy, memcmp and memset. */ -#define TARGET_MEM_FUNCTIONS - -/* Add any extra modes needed to represent the condition code. - - On the Sparc, we have a "no-overflow" mode which is used when an add or - subtract insn is used to set the condition code. Different branches are - used in this case for some operations. - - We also have two modes to indicate that the relevant condition code is - in the floating-point condition code register. One for comparisons which - will generate an exception if the result is unordered (CCFPEmode) and - one for comparisons which will never trap (CCFPmode). - - CCXmode and CCX_NOOVmode are only used by v9. */ - -#define EXTRA_CC_MODES CCXmode, CC_NOOVmode, CCX_NOOVmode, CCFPmode, CCFPEmode - -/* Define the names for the modes specified above. */ - -#define EXTRA_CC_NAMES "CCX", "CC_NOOV", "CCX_NOOV", "CCFP", "CCFPE" - -/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, - return the mode to be used for the comparison. For floating-point, - CCFP[E]mode is used. CC_NOOVmode should be used when the first operand is a - PLUS, MINUS, NEG, or ASHIFT. CCmode should be used when no special - processing is needed. */ -#define SELECT_CC_MODE(OP,X,Y) \ - (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ - ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode) \ - : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \ - || GET_CODE (X) == NEG || GET_CODE (X) == ASHIFT) \ - ? (TARGET_ARCH64 && GET_MODE (X) == DImode ? CCX_NOOVmode : CC_NOOVmode) \ - : ((TARGET_ARCH64 || TARGET_V8PLUS) && GET_MODE (X) == DImode ? CCXmode : CCmode))) - -/* Return non-zero if SELECT_CC_MODE will never return MODE for a - floating point inequality comparison. */ - -#define REVERSIBLE_CC_MODE(MODE) ((MODE) != CCFPEmode) - -/* A function address in a call instruction - is a byte address (for indexing purposes) - so give the MEM rtx a byte's mode. */ -#define FUNCTION_MODE SImode - -/* Define this if addresses of constant functions - shouldn't be put through pseudo regs where they can be cse'd. - Desirable on machines where ordinary constants are expensive - but a CALL with constant address is cheap. */ -#define NO_FUNCTION_CSE - -/* alloca should avoid clobbering the old register save area. */ -#define SETJMP_VIA_SAVE_AREA - -/* Define subroutines to call to handle multiply and divide. - Use the subroutines that Sun's library provides. - The `*' prevents an underscore from being prepended by the compiler. */ - -#define DIVSI3_LIBCALL "*.div" -#define UDIVSI3_LIBCALL "*.udiv" -#define MODSI3_LIBCALL "*.rem" -#define UMODSI3_LIBCALL "*.urem" -/* .umul is a little faster than .mul. */ -#define MULSI3_LIBCALL "*.umul" - -/* Define library calls for quad FP operations. These are all part of the - SPARC ABI. - ??? ARCH64 still does not work as the _Qp_* routines take pointers. */ -#define ADDTF3_LIBCALL (TARGET_ARCH64 ? "_Qp_add" : "_Q_add") -#define SUBTF3_LIBCALL (TARGET_ARCH64 ? "_Qp_sub" : "_Q_sub") -#define NEGTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_neg" : "_Q_neg") -#define MULTF3_LIBCALL (TARGET_ARCH64 ? "_Qp_mul" : "_Q_mul") -#define DIVTF3_LIBCALL (TARGET_ARCH64 ? "_Qp_div" : "_Q_div") -#define FLOATSITF2_LIBCALL (TARGET_ARCH64 ? "_Qp_itoq" : "_Q_itoq") -#define FIX_TRUNCTFSI2_LIBCALL (TARGET_ARCH64 ? "_Qp_qtoi" : "_Q_qtoi") -#define FIXUNS_TRUNCTFSI2_LIBCALL (TARGET_ARCH64 ? "_Qp_qtoui" : "_Q_qtou") -#define EXTENDSFTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_stoq" : "_Q_stoq") -#define TRUNCTFSF2_LIBCALL (TARGET_ARCH64 ? "_Qp_qtos" : "_Q_qtos") -#define EXTENDDFTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_dtoq" : "_Q_dtoq") -#define TRUNCTFDF2_LIBCALL (TARGET_ARCH64 ? "_Qp_qtod" : "_Q_qtod") -#define EQTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_feq" : "_Q_feq") -#define NETF2_LIBCALL (TARGET_ARCH64 ? "_Qp_fne" : "_Q_fne") -#define GTTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_fgt" : "_Q_fgt") -#define GETF2_LIBCALL (TARGET_ARCH64 ? "_Qp_fge" : "_Q_fge") -#define LTTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_flt" : "_Q_flt") -#define LETF2_LIBCALL (TARGET_ARCH64 ? "_Qp_fle" : "_Q_fle") - -/* We can define the TFmode sqrt optab only if TARGET_FPU. This is because - with soft-float, the SFmode and DFmode sqrt instructions will be absent, - and the compiler will notice and try to use the TFmode sqrt instruction - for calls to the builtin function sqrt, but this fails. */ -#define INIT_TARGET_OPTABS \ - do { \ - add_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, ADDTF3_LIBCALL); \ - sub_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, SUBTF3_LIBCALL); \ - neg_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, NEGTF2_LIBCALL); \ - smul_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, MULTF3_LIBCALL); \ - flodiv_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, DIVTF3_LIBCALL); \ - eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EQTF2_LIBCALL); \ - netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, NETF2_LIBCALL); \ - gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GTTF2_LIBCALL); \ - getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GETF2_LIBCALL); \ - lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LTTF2_LIBCALL); \ - letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LETF2_LIBCALL); \ - trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFSF2_LIBCALL); \ - trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFDF2_LIBCALL); \ - extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDSFTF2_LIBCALL); \ - extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDDFTF2_LIBCALL); \ - floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATSITF2_LIBCALL); \ - fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFSI2_LIBCALL); \ - fixunstfsi_libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFSI2_LIBCALL); \ - if (TARGET_FPU) \ - sqrt_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, "_Q_sqrt"); \ - INIT_SUBTARGET_OPTABS; \ - } while (0) - -/* This is meant to be redefined in the host dependent files */ -#define INIT_SUBTARGET_OPTABS - -/* Compute the cost of computing a constant rtl expression RTX - whose rtx-code is CODE. The body of this macro is a portion - of a switch statement. If the code is computed here, - return it with a return statement. Otherwise, break from the switch. */ - -#define CONST_COSTS(RTX,CODE,OUTER_CODE) \ - case CONST_INT: \ - if (INTVAL (RTX) < 0x1000 && INTVAL (RTX) >= -0x1000) \ - return 0; \ - case HIGH: \ - return 2; \ - case CONST: \ - case LABEL_REF: \ - case SYMBOL_REF: \ - return 4; \ - case CONST_DOUBLE: \ - if (GET_MODE (RTX) == DImode) \ - if ((XINT (RTX, 3) == 0 \ - && (unsigned) XINT (RTX, 2) < 0x1000) \ - || (XINT (RTX, 3) == -1 \ - && XINT (RTX, 2) < 0 \ - && XINT (RTX, 2) >= -0x1000)) \ - return 0; \ - return 8; - -#define ADDRESS_COST(RTX) 1 - -/* Compute extra cost of moving data between one register class - and another. */ -#define GENERAL_OR_I64(C) ((C) == GENERAL_REGS || (C) == I64_REGS) -#define REGISTER_MOVE_COST(CLASS1, CLASS2) \ - (((FP_REG_CLASS_P (CLASS1) && GENERAL_OR_I64 (CLASS2)) \ - || (GENERAL_OR_I64 (CLASS1) && FP_REG_CLASS_P (CLASS2)) \ - || (CLASS1) == FPCC_REGS || (CLASS2) == FPCC_REGS) \ - ? (sparc_cpu == PROCESSOR_ULTRASPARC ? 12 : 6) : 2) - -/* Provide the costs of a rtl expression. This is in the body of a - switch on CODE. The purpose for the cost of MULT is to encourage - `synth_mult' to find a synthetic multiply when reasonable. - - If we need more than 12 insns to do a multiply, then go out-of-line, - since the call overhead will be < 10% of the cost of the multiply. */ - -#define RTX_COSTS(X,CODE,OUTER_CODE) \ - case MULT: \ - if (sparc_cpu == PROCESSOR_ULTRASPARC) \ - return (GET_MODE (X) == DImode ? \ - COSTS_N_INSNS (34) : COSTS_N_INSNS (19)); \ - return TARGET_HARD_MUL ? COSTS_N_INSNS (5) : COSTS_N_INSNS (25); \ - case DIV: \ - case UDIV: \ - case MOD: \ - case UMOD: \ - if (sparc_cpu == PROCESSOR_ULTRASPARC) \ - return (GET_MODE (X) == DImode ? \ - COSTS_N_INSNS (68) : COSTS_N_INSNS (37)); \ - return COSTS_N_INSNS (25); \ - /* Make FLOAT and FIX more expensive than CONST_DOUBLE,\ - so that cse will favor the latter. */ \ - case FLOAT: \ - case FIX: \ - return 19; - -#define ISSUE_RATE sparc_issue_rate() - -/* Adjust the cost of dependencies. */ -#define ADJUST_COST(INSN,LINK,DEP,COST) \ - sparc_adjust_cost(INSN, LINK, DEP, COST) - -extern void ultrasparc_sched_reorder (); -extern void ultrasparc_sched_init (); -extern int ultrasparc_variable_issue (); - -#define MD_SCHED_INIT(DUMP, SCHED_VERBOSE) \ - if (sparc_cpu == PROCESSOR_ULTRASPARC) \ - ultrasparc_sched_init (DUMP, SCHED_VERBOSE) - -#define MD_SCHED_REORDER(DUMP, SCHED_VERBOSE, READY, N_READY) \ - if (sparc_cpu == PROCESSOR_ULTRASPARC) \ - ultrasparc_sched_reorder (DUMP, SCHED_VERBOSE, READY, N_READY) - -#define MD_SCHED_VARIABLE_ISSUE(DUMP, SCHED_VERBOSE, INSN, CAN_ISSUE_MORE) \ - if (sparc_cpu == PROCESSOR_ULTRASPARC) \ - (CAN_ISSUE_MORE) = ultrasparc_variable_issue (INSN); \ - else \ - (CAN_ISSUE_MORE)-- - -/* Conditional branches with empty delay slots have a length of two. */ -#define ADJUST_INSN_LENGTH(INSN, LENGTH) \ - if (GET_CODE (INSN) == CALL_INSN \ - || (GET_CODE (INSN) == JUMP_INSN && ! simplejump_p (insn))) \ - LENGTH += 1; else - -/* Control the assembler format that we output. */ - -/* Output at beginning of assembler file. */ - -#define ASM_FILE_START(file) - -/* A C string constant describing how to begin a comment in the target - assembler language. The compiler assumes that the comment will end at - the end of the line. */ - -#define ASM_COMMENT_START "!" - -/* Output to assembler file text saying following lines - may contain character constants, extra white space, comments, etc. */ - -#define ASM_APP_ON "" - -/* Output to assembler file text saying following lines - no longer contain unusual constructs. */ - -#define ASM_APP_OFF "" - -/* ??? Try to make the style consistent here (_OP?). */ - -#define ASM_LONGLONG ".xword" -#define ASM_LONG ".word" -#define ASM_SHORT ".half" -#define ASM_BYTE_OP ".byte" -#define ASM_FLOAT ".single" -#define ASM_DOUBLE ".double" -#define ASM_LONGDOUBLE ".xxx" /* ??? Not known (or used yet). */ - -/* Output before read-only data. */ - -#define TEXT_SECTION_ASM_OP ".text" - -/* Output before writable data. */ - -#define DATA_SECTION_ASM_OP ".data" - -/* How to refer to registers in assembler output. - This sequence is indexed by compiler's hard-register-number (see above). */ - -#define REGISTER_NAMES \ -{"%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7", \ - "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7", \ - "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \ - "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7", \ - "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", \ - "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15", \ - "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23", \ - "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31", \ - "%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39", \ - "%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47", \ - "%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55", \ - "%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63", \ - "%fcc0", "%fcc1", "%fcc2", "%fcc3", "%icc"} - -/* Define additional names for use in asm clobbers and asm declarations. */ - -#define ADDITIONAL_REGISTER_NAMES \ -{{"ccr", SPARC_ICC_REG}, {"cc", SPARC_ICC_REG}} - -/* How to renumber registers for dbx and gdb. In the flat model, the frame - pointer is really %i7. */ - -#define DBX_REGISTER_NUMBER(REGNO) \ - (TARGET_FLAT && REGNO == FRAME_POINTER_REGNUM ? 31 : REGNO) - -/* On Sun 4, this limit is 2048. We use 1000 to be safe, since the length - can run past this up to a continuation point. Once we used 1500, but - a single entry in C++ can run more than 500 bytes, due to the length of - mangled symbol names. dbxout.c should really be fixed to do - continuations when they are actually needed instead of trying to - guess... */ -#define DBX_CONTIN_LENGTH 1000 - -/* This is how to output a note to DBX telling it the line number - to which the following sequence of instructions corresponds. - - This is needed for SunOS 4.0, and should not hurt for 3.2 - versions either. */ -#define ASM_OUTPUT_SOURCE_LINE(file, line) \ - { static int sym_lineno = 1; \ - fprintf (file, ".stabn 68,0,%d,LM%d\nLM%d:\n", \ - line, sym_lineno, sym_lineno); \ - sym_lineno += 1; } - -/* This is how to output the definition of a user-level label named NAME, - such as the label on a static function or variable NAME. */ - -#define ASM_OUTPUT_LABEL(FILE,NAME) \ - do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) - -/* This is how to output a command to make the user-level label named NAME - defined for reference from other files. */ - -#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ - do { fputs ("\t.global ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0) - -/* The prefix to add to user-visible assembler symbols. */ - -#define USER_LABEL_PREFIX "_" - -/* This is how to output a definition of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, "%s%d:\n", PREFIX, NUM) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf ((LABEL), "*%s%ld", (PREFIX), (long)(NUM)) - -/* This is how to output an assembler line defining a `float' constant. - We always have to use a .long pseudo-op to do this because the native - SVR4 ELF assembler is buggy and it generates incorrect values when we - try to use the .float pseudo-op instead. */ - -#define ASM_OUTPUT_FLOAT(FILE,VALUE) \ - { \ - long t; \ - char str[30]; \ - REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \ - REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \ - fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t, \ - ASM_COMMENT_START, str); \ - } \ - -/* This is how to output an assembler line defining a `double' constant. - We always have to use a .long pseudo-op to do this because the native - SVR4 ELF assembler is buggy and it generates incorrect values when we - try to use the .float pseudo-op instead. */ - -#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ - { \ - long t[2]; \ - char str[30]; \ - REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t); \ - REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \ - fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t[0], \ - ASM_COMMENT_START, str); \ - fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[1]); \ - } - -/* This is how to output an assembler line defining a `long double' - constant. */ - -#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \ - { \ - long t[4]; \ - char str[30]; \ - REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), t); \ - REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \ - fprintf (FILE, "\t%s\t0x%lx %s ~%s\n", ASM_LONG, t[0], \ - ASM_COMMENT_START, str); \ - fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[1]); \ - fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[2]); \ - fprintf (FILE, "\t%s\t0x%lx\n", ASM_LONG, t[3]); \ - } - -/* This is how to output an assembler line defining an `int' constant. */ - -#define ASM_OUTPUT_INT(FILE,VALUE) \ -( fprintf (FILE, "\t%s\t", ASM_LONG), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line defining a DImode constant. */ -#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE) \ - output_double_int (FILE, VALUE) - -/* Likewise for `char' and `short' constants. */ - -#define ASM_OUTPUT_SHORT(FILE,VALUE) \ -( fprintf (FILE, "\t%s\t", ASM_SHORT), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -#define ASM_OUTPUT_CHAR(FILE,VALUE) \ -( fprintf (FILE, "\t%s\t", ASM_BYTE_OP), \ - output_addr_const (FILE, (VALUE)), \ - fprintf (FILE, "\n")) - -/* This is how to output an assembler line for a numeric constant byte. */ - -#define ASM_OUTPUT_BYTE(FILE,VALUE) \ - fprintf (FILE, "\t%s\t0x%x\n", ASM_BYTE_OP, (VALUE)) - -/* This is how we hook in and defer the case-vector until the end of - the function. */ -extern void sparc_defer_case_vector (); - -#define ASM_OUTPUT_ADDR_VEC(LAB,VEC) \ - sparc_defer_case_vector ((LAB),(VEC), 0) - -#define ASM_OUTPUT_ADDR_DIFF_VEC(LAB,VEC) \ - sparc_defer_case_vector ((LAB),(VEC), 1) - -/* This is how to output an element of a case-vector that is absolute. */ - -#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ -do { \ - char label[30]; \ - ASM_GENERATE_INTERNAL_LABEL (label, "L", VALUE); \ - if (CASE_VECTOR_MODE == SImode) \ - fprintf (FILE, "\t.word\t"); \ - else \ - fprintf (FILE, "\t.xword\t"); \ - assemble_name (FILE, label); \ - fputc ('\n', FILE); \ -} while (0) - -/* This is how to output an element of a case-vector that is relative. - (SPARC uses such vectors only when generating PIC.) */ - -#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ -do { \ - char label[30]; \ - ASM_GENERATE_INTERNAL_LABEL (label, "L", (VALUE)); \ - if (CASE_VECTOR_MODE == SImode) \ - fprintf (FILE, "\t.word\t"); \ - else \ - fprintf (FILE, "\t.xword\t"); \ - assemble_name (FILE, label); \ - ASM_GENERATE_INTERNAL_LABEL (label, "L", (REL)); \ - fputc ('-', FILE); \ - assemble_name (FILE, label); \ - fputc ('\n', FILE); \ -} while (0) - -/* This is what to output before and after case-vector (both - relative and absolute). If .subsection -1 works, we put case-vectors - at the beginning of the current section. */ - -#ifdef HAVE_GAS_SUBSECTION_ORDERING - -#define ASM_OUTPUT_ADDR_VEC_START(FILE) \ - fprintf(FILE, "\t.subsection\t-1\n") - -#define ASM_OUTPUT_ADDR_VEC_END(FILE) \ - fprintf(FILE, "\t.previous\n") - -#endif - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG) != 0) \ - fprintf (FILE, "\t.align %d\n", (1<<(LOG))) - -#define LABEL_ALIGN_AFTER_BARRIER(LABEL) (sparc_align_jumps) - -#define LOOP_ALIGN(LABEL) (sparc_align_loops) - -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t.skip %u\n", (SIZE)) - -/* This says how to output an assembler line - to define a global common symbol. */ - -#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ -( fputs ("\t.common ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u,\"bss\"\n", (SIZE))) - -/* This says how to output an assembler line to define a local common - symbol. */ - -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNED) \ -( fputs ("\t.reserve ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u,\"bss\",%u\n", \ - (SIZE), ((ALIGNED) / BITS_PER_UNIT))) - -/* A C statement (sans semicolon) to output to the stdio stream - FILE the assembler definition of uninitialized global DECL named - NAME whose size is SIZE bytes and alignment is ALIGN bytes. - Try to use asm_output_aligned_bss to implement this macro. */ - -#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ - do { \ - fputs (".globl ", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - fputs ("\n", (FILE)); \ - ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN); \ - } while (0) - -/* Store in OUTPUT a string (made with alloca) containing - an assembler-name for a local static variable named NAME. - LABELNO is an integer which is different for each call. */ - -#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ -( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ - sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) - -#define IDENT_ASM_OP ".ident" - -/* Output #ident as a .ident. */ - -#define ASM_OUTPUT_IDENT(FILE, NAME) \ - fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); - -/* Output code to add DELTA to the first argument, and then jump to FUNCTION. - Used for C++ multiple inheritance. */ -#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ -do { \ - int big_delta = (DELTA) >= 4096 || (DELTA) < -4096; \ - if (big_delta) \ - fprintf (FILE, "\tset %d,%%g1\n\tadd %%o0,%%g1,%%o0\n", (DELTA)); \ - /* Don't use the jmp solution unless we know the target is local to \ - the application or shared object. \ - XXX: Wimp out and don't actually check anything except if this is \ - an embedded target where we assume there are no shared libs. */ \ - if (!TARGET_CM_EMBMEDANY || flag_pic) \ - { \ - if (! big_delta) \ - fprintf (FILE, "\tadd %%o0,%d,%%o0\n", DELTA); \ - fprintf (FILE, "\tmov %%o7,%%g1\n"); \ - fprintf (FILE, "\tcall "); \ - assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ - fprintf (FILE, ",0\n"); \ - } \ - else if (TARGET_CM_EMBMEDANY) \ - { \ - fprintf (FILE, "\tsetx "); \ - assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ - fprintf (FILE, ",%%g5,%%g1\n\tjmp %%g1\n"); \ - } \ - else \ - { \ - fprintf (FILE, "\tsethi %%hi("); \ - assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ - fprintf (FILE, "),%%g1\n\tjmp %%g1+%%lo("); \ - assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ - fprintf (FILE, ")\n"); \ - } \ - if (!TARGET_CM_EMBMEDANY || flag_pic) \ - fprintf (FILE, "\tmov %%g1,%%o7\n"); \ - else if (big_delta) \ - fprintf (FILE, "\tnop\n"); \ - else \ - fprintf (FILE, "\tadd %%o0,%d,%%o0\n", DELTA); \ -} while (0) - -/* Define the parentheses used to group arithmetic operations - in assembler code. */ - -#define ASM_OPEN_PAREN "(" -#define ASM_CLOSE_PAREN ")" - -/* Define results of standard character escape sequences. */ -#define TARGET_BELL 007 -#define TARGET_BS 010 -#define TARGET_TAB 011 -#define TARGET_NEWLINE 012 -#define TARGET_VT 013 -#define TARGET_FF 014 -#define TARGET_CR 015 - -#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \ - ((CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^' || (CHAR) == '(' || (CHAR) == '_') - -/* Print operand X (an rtx) in assembler syntax to file FILE. - CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. - For `%' followed by punctuation, CODE is the punctuation and X is null. */ - -#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) - -/* Print a memory address as an operand to reference that memory location. */ - -#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ -{ register rtx base, index = 0; \ - int offset = 0; \ - register rtx addr = ADDR; \ - if (GET_CODE (addr) == REG) \ - fputs (reg_names[REGNO (addr)], FILE); \ - else if (GET_CODE (addr) == PLUS) \ - { \ - if (GET_CODE (XEXP (addr, 0)) == CONST_INT) \ - offset = INTVAL (XEXP (addr, 0)), base = XEXP (addr, 1);\ - else if (GET_CODE (XEXP (addr, 1)) == CONST_INT) \ - offset = INTVAL (XEXP (addr, 1)), base = XEXP (addr, 0);\ - else \ - base = XEXP (addr, 0), index = XEXP (addr, 1); \ - fputs (reg_names[REGNO (base)], FILE); \ - if (index == 0) \ - fprintf (FILE, "%+d", offset); \ - else if (GET_CODE (index) == REG) \ - fprintf (FILE, "+%s", reg_names[REGNO (index)]); \ - else if (GET_CODE (index) == SYMBOL_REF \ - || GET_CODE (index) == CONST) \ - fputc ('+', FILE), output_addr_const (FILE, index); \ - else abort (); \ - } \ - else if (GET_CODE (addr) == MINUS \ - && GET_CODE (XEXP (addr, 1)) == LABEL_REF) \ - { \ - output_addr_const (FILE, XEXP (addr, 0)); \ - fputs ("-(", FILE); \ - output_addr_const (FILE, XEXP (addr, 1)); \ - fputs ("-.)", FILE); \ - } \ - else if (GET_CODE (addr) == LO_SUM) \ - { \ - output_operand (XEXP (addr, 0), 0); \ - if (TARGET_CM_MEDMID) \ - fputs ("+%l44(", FILE); \ - else \ - fputs ("+%lo(", FILE); \ - output_address (XEXP (addr, 1)); \ - fputc (')', FILE); \ - } \ - else if (flag_pic && GET_CODE (addr) == CONST \ - && GET_CODE (XEXP (addr, 0)) == MINUS \ - && GET_CODE (XEXP (XEXP (addr, 0), 1)) == CONST \ - && GET_CODE (XEXP (XEXP (XEXP (addr, 0), 1), 0)) == MINUS \ - && XEXP (XEXP (XEXP (XEXP (addr, 0), 1), 0), 1) == pc_rtx) \ - { \ - addr = XEXP (addr, 0); \ - output_addr_const (FILE, XEXP (addr, 0)); \ - /* Group the args of the second CONST in parenthesis. */ \ - fputs ("-(", FILE); \ - /* Skip past the second CONST--it does nothing for us. */\ - output_addr_const (FILE, XEXP (XEXP (addr, 1), 0)); \ - /* Close the parenthesis. */ \ - fputc (')', FILE); \ - } \ - else \ - { \ - output_addr_const (FILE, addr); \ - } \ -} - -/* Define the codes that are matched by predicates in sparc.c. */ - -#define PREDICATE_CODES \ -{"reg_or_0_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \ -{"fp_zero_operand", {CONST_DOUBLE}}, \ -{"intreg_operand", {SUBREG, REG}}, \ -{"fcc_reg_operand", {REG}}, \ -{"icc_or_fcc_reg_operand", {REG}}, \ -{"restore_operand", {REG}}, \ -{"call_operand", {MEM}}, \ -{"call_operand_address", {SYMBOL_REF, LABEL_REF, CONST, CONST_DOUBLE, \ - ADDRESSOF, SUBREG, REG, PLUS, LO_SUM, CONST_INT}}, \ -{"symbolic_operand", {SYMBOL_REF, LABEL_REF, CONST, CONST_DOUBLE}}, \ -{"symbolic_memory_operand", {SUBREG, MEM}}, \ -{"label_ref_operand", {LABEL_REF}}, \ -{"sp64_medium_pic_operand", {CONST}}, \ -{"data_segment_operand", {SYMBOL_REF, PLUS, CONST}}, \ -{"text_segment_operand", {LABEL_REF, SYMBOL_REF, PLUS, CONST}}, \ -{"reg_or_nonsymb_mem_operand", {SUBREG, REG, MEM}}, \ -{"splittable_symbolic_memory_operand", {MEM}}, \ -{"splittable_immediate_memory_operand", {MEM}}, \ -{"eq_or_neq", {EQ, NE}}, \ -{"normal_comp_operator", {GE, GT, LE, LT, GTU, LEU}}, \ -{"noov_compare_op", {NE, EQ, GE, GT, LE, LT, GEU, GTU, LEU, LTU}}, \ -{"v9_regcmp_op", {EQ, NE, GE, LT, LE, GT}}, \ -{"extend_op", {SIGN_EXTEND, ZERO_EXTEND}}, \ -{"cc_arithop", {AND, IOR, XOR}}, \ -{"cc_arithopn", {AND, IOR}}, \ -{"arith_operand", {SUBREG, REG, CONST_INT}}, \ -{"arith_add_operand", {SUBREG, REG, CONST_INT}}, \ -{"arith11_operand", {SUBREG, REG, CONST_INT}}, \ -{"arith10_operand", {SUBREG, REG, CONST_INT}}, \ -{"arith_double_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \ -{"arith_double_add_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \ -{"arith11_double_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \ -{"arith10_double_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \ -{"small_int", {CONST_INT}}, \ -{"small_int_or_double", {CONST_INT, CONST_DOUBLE}}, \ -{"uns_small_int", {CONST_INT}}, \ -{"uns_arith_operand", {SUBREG, REG, CONST_INT}}, \ -{"clobbered_register", {REG}}, \ -{"input_operand", {SUBREG, REG, CONST_INT, MEM, CONST}}, \ -{"zero_operand", {CONST_INT}}, \ -{"const64_operand", {CONST_INT, CONST_DOUBLE}}, \ -{"const64_high_operand", {CONST_INT, CONST_DOUBLE}}, - -/* The number of Pmode words for the setjmp buffer. */ -#define JMP_BUF_SIZE 12 - -#define DONT_ACCESS_GBLS_AFTER_EPILOGUE (flag_pic) - -/* Declare functions defined in sparc.c and used in templates. */ - -extern void sparc_emit_set_const32 (); -extern void sparc_emit_set_const64 (); -extern void sparc_emit_set_symbolic_const64 (); -extern int sparc_splitdi_legitimate (); -extern int sparc_absnegfloat_split_legitimate (); - -extern char *output_cbranch (); -extern const char *output_return (); -extern char *output_v9branch (); - -extern void emit_v9_brxx_insn (); -extern void finalize_pic (); -extern void order_regs_for_local_alloc (); -extern void output_double_int (); -extern void output_function_epilogue (); -extern void output_function_prologue (); -extern void print_operand (); -extern void sparc_flat_output_function_epilogue (); -extern void sparc_flat_output_function_prologue (); - -extern int addrs_ok_for_ldd_peep (); -extern int arith10_double_operand (); -extern int arith10_operand (); -extern int arith11_double_operand (); -extern int arith11_operand (); -extern int arith_double_operand (); -extern int arith_double_4096_operand (); -extern int arith_double_add_operand (); -extern int arith_operand (); -extern int arith_4096_operand (); -extern int arith_add_operand (); -extern int call_operand_address (); -extern int input_operand (); -extern int zero_operand (); -extern int const64_operand (); -extern int const64_high_operand (); -extern int cc_arithop (); -extern int cc_arithopn (); -extern int check_pic (); -extern int compute_frame_size (); -extern int data_segment_operand (); -extern int eligible_for_epilogue_delay (); -extern int eligible_for_return_delay (); -extern int emit_move_sequence (); -extern int extend_op (); -extern int fcc_reg_operand (); -extern int fp_zero_operand (); -extern int icc_or_fcc_reg_operand (); -extern int label_ref_operand (); -extern int mem_min_alignment (); -extern int noov_compare_op (); -extern int pic_address_needs_scratch (); -extern int reg_or_0_operand (); -extern int reg_or_nonsymb_mem_operand (); -extern int reg_unused_after (); -extern int register_ok_for_ldd (); -extern int registers_ok_for_ldd_peep (); -extern int restore_operand (); -extern int short_branch (); -extern int small_int (); -extern int small_int_or_double (); -extern int sp64_medium_pic_operand (); -extern int sparc_flat_eligible_for_epilogue_delay (); -extern int sparc_flat_epilogue_delay_slots (); -extern int sparc_issue_rate (); -extern int splittable_immediate_memory_operand (); -extern int splittable_symbolic_memory_operand (); -extern int sparc_adjust_cost (); -extern int symbolic_memory_operand (); -extern int symbolic_operand (); -extern int text_segment_operand (); -extern int uns_small_int (); -extern int v9_regcmp_op (); -extern int v9_regcmp_p (); - -extern unsigned long sparc_flat_compute_frame_size (); -extern unsigned long sparc_type_code (); - -extern void sparc_function_profiler (); -extern void sparc_function_block_profiler (); -extern void sparc_block_profiler (); -extern void sparc_function_block_profiler_exit (); - -extern char *sparc_v8plus_shift (); - -#ifdef __STDC__ -/* Function used for V8+ code generation. Returns 1 if the high - 32 bits of REG are 0 before INSN. */ -extern int sparc_check_64 (struct rtx_def *, struct rtx_def *); -extern int sparc_return_peephole_ok (struct rtx_def *, struct rtx_def *); -extern int compute_frame_size (int, int); -#endif - -/* Defined in flags.h, but insn-emit.c does not include flags.h. */ - -extern int flag_pic; diff --git a/contrib/gcc/config/sparc/sparc.md b/contrib/gcc/config/sparc/sparc.md deleted file mode 100644 index aafb7a63ea41..000000000000 --- a/contrib/gcc/config/sparc/sparc.md +++ /dev/null @@ -1,8236 +0,0 @@ -;;- Machine description for SPARC chip for GNU C compiler -;; Copyright (C) 1987, 88, 89, 92-98, 1999 Free Software Foundation, Inc. -;; Contributed by Michael Tiemann (tiemann@cygnus.com) -;; 64 bit SPARC V9 support by Michael Tiemann, Jim Wilson, and Doug Evans, -;; at Cygnus Support. - -;; This file is part of GNU CC. - -;; GNU CC 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. - -;; GNU CC 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. - -;; You should have received a copy of the GNU General Public License -;; along with GNU CC; see the file COPYING. If not, write to -;; the Free Software Foundation, 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - -;;- See file "rtl.def" for documentation on define_insn, match_*, et. al. - -;; Uses of UNSPEC and UNSPEC_VOLATILE in this file: -;; -;; UNSPEC: 0 movsi_{lo_sum,high}_pic -;; pic_lo_sum_di -;; pic_sethi_di -;; 1 update_return -;; 2 get_pc -;; 5 movsi_{,lo_sum_,high_}pic_label_ref -;; 6 seth44 -;; 7 setm44 -;; 8 setl44 -;; 9 sethh -;; 10 setlm -;; 11 embmedany_sethi, embmedany_brsum -;; 12 movsf_const_high -;; 13 embmedany_textuhi -;; 14 embmedany_texthi -;; 15 embmedany_textulo -;; 16 embmedany_textlo -;; 17 movsf_const_lo -;; 18 sethm -;; 19 setlo -;; -;; UNSPEC_VOLATILE: 0 blockage -;; 1 flush_register_windows -;; 2 goto_handler_and_restore -;; 3 goto_handler_and_restore_v9* -;; 4 flush -;; 5 nonlocal_goto_receiver -;; - -;; The upper 32 fp regs on the v9 can't hold SFmode values. To deal with this -;; a second register class, EXTRA_FP_REGS, exists for the v9 chip. The name -;; is a bit of a misnomer as it covers all 64 fp regs. The corresponding -;; constraint letter is 'e'. To avoid any confusion, 'e' is used instead of -;; 'f' for all DF/TFmode values, including those that are specific to the v8. -;; -;; -mlive-g0 is *not* supported for TARGET_ARCH64, so we don't bother to -;; test TARGET_LIVE_G0 if we have TARGET_ARCH64. - -;; Attribute for cpu type. -;; These must match the values for enum processor_type in sparc.h. -(define_attr "cpu" "v7,cypress,v8,supersparc,sparclite,f930,f934,hypersparc,sparclite86x,sparclet,tsc701,v9,ultrasparc" - (const (symbol_ref "sparc_cpu_attr"))) - -;; Attribute for the instruction set. -;; At present we only need to distinguish v9/!v9, but for clarity we -;; test TARGET_V8 too. -(define_attr "isa" "v6,v8,v9,sparclet" - (const - (cond [(symbol_ref "TARGET_V9") (const_string "v9") - (symbol_ref "TARGET_V8") (const_string "v8") - (symbol_ref "TARGET_SPARCLET") (const_string "sparclet")] - (const_string "v6")))) - -;; Architecture size. -(define_attr "arch" "arch32bit,arch64bit" - (const - (cond [(symbol_ref "TARGET_ARCH64") (const_string "arch64bit")] - (const_string "arch32bit")))) - -;; Whether -mlive-g0 is in effect. -(define_attr "live_g0" "no,yes" - (const - (cond [(symbol_ref "TARGET_LIVE_G0") (const_string "yes")] - (const_string "no")))) - -;; Insn type. Used to default other attribute values. - -;; type "unary" insns have one input operand (1) and one output operand (0) -;; type "binary" insns have two input operands (1,2) and one output (0) -;; type "compare" insns have one or two input operands (0,1) and no output -;; type "call_no_delay_slot" is a call followed by an unimp instruction. - -(define_attr "type" - "move,unary,binary,compare,load,sload,store,ialu,shift,uncond_branch,branch,call,call_no_delay_slot,return,address,imul,fpload,fpstore,fp,fpmove,fpcmove,fpcmp,fpmul,fpdivs,fpdivd,fpsqrt,cmove,multi,misc" - (const_string "binary")) - -;; Set true if insn uses call-clobbered intermediate register. -(define_attr "use_clobbered" "false,true" - (if_then_else (and (eq_attr "type" "address") - (match_operand 0 "clobbered_register" "")) - (const_string "true") - (const_string "false"))) - -;; Length (in # of insns). -(define_attr "length" "" - (cond [(eq_attr "type" "load,sload,fpload") - (if_then_else (match_operand 1 "symbolic_memory_operand" "") - (const_int 2) (const_int 1)) - - (eq_attr "type" "store,fpstore") - (if_then_else (match_operand 0 "symbolic_memory_operand" "") - (const_int 2) (const_int 1)) - - (eq_attr "type" "address") (const_int 2) - - (eq_attr "type" "binary") - (if_then_else (ior (match_operand 2 "arith_operand" "") - (match_operand 2 "arith_double_operand" "")) - (const_int 1) (const_int 3)) - - (eq_attr "type" "multi") (const_int 2) - - (eq_attr "type" "move,unary") - (if_then_else (ior (match_operand 1 "arith_operand" "") - (match_operand 1 "arith_double_operand" "")) - (const_int 1) (const_int 2))] - - (const_int 1))) - -(define_asm_attributes - [(set_attr "length" "1") - (set_attr "type" "multi")]) - -;; Attributes for instruction and branch scheduling - -(define_attr "in_call_delay" "false,true" - (cond [(eq_attr "type" "uncond_branch,branch,call,call_no_delay_slot,return,multi") - (const_string "false") - (eq_attr "type" "load,fpload,store,fpstore") - (if_then_else (eq_attr "length" "1") - (const_string "true") - (const_string "false")) - (eq_attr "type" "address") - (if_then_else (eq_attr "use_clobbered" "false") - (const_string "true") - (const_string "false"))] - (if_then_else (eq_attr "length" "1") - (const_string "true") - (const_string "false")))) - -(define_delay (eq_attr "type" "call") - [(eq_attr "in_call_delay" "true") (nil) (nil)]) - -(define_attr "leaf_function" "false,true" - (const (symbol_ref "current_function_uses_only_leaf_regs"))) - -(define_attr "in_return_delay" "false,true" - (if_then_else (and (and (and (eq_attr "type" "move,load,sload,store,binary,ialu") - (eq_attr "length" "1")) - (eq_attr "leaf_function" "false")) - (match_insn "eligible_for_return_delay")) - (const_string "true") - (const_string "false"))) - -(define_delay (and (eq_attr "type" "return") - (eq_attr "isa" "v9")) - [(eq_attr "in_return_delay" "true") (nil) (nil)]) - -;; ??? Should implement the notion of predelay slots for floating point -;; branches. This would allow us to remove the nop always inserted before -;; a floating point branch. - -;; ??? It is OK for fill_simple_delay_slots to put load/store instructions -;; in a delay slot, but it is not OK for fill_eager_delay_slots to do so. -;; This is because doing so will add several pipeline stalls to the path -;; that the load/store did not come from. Unfortunately, there is no way -;; to prevent fill_eager_delay_slots from using load/store without completely -;; disabling them. For the SPEC benchmark set, this is a serious lose, -;; because it prevents us from moving back the final store of inner loops. - -(define_attr "in_branch_delay" "false,true" - (if_then_else (and (eq_attr "type" "!uncond_branch,branch,call,call_no_delay_slot,multi") - (eq_attr "length" "1")) - (const_string "true") - (const_string "false"))) - -(define_attr "in_uncond_branch_delay" "false,true" - (if_then_else (and (eq_attr "type" "!uncond_branch,branch,call,call_no_delay_slot,multi") - (eq_attr "length" "1")) - (const_string "true") - (const_string "false"))) - -(define_attr "in_annul_branch_delay" "false,true" - (if_then_else (and (eq_attr "type" "!uncond_branch,branch,call,call_no_delay_slot,multi") - (eq_attr "length" "1")) - (const_string "true") - (const_string "false"))) - -(define_delay (eq_attr "type" "branch") - [(eq_attr "in_branch_delay" "true") - (nil) (eq_attr "in_annul_branch_delay" "true")]) - -(define_delay (eq_attr "type" "uncond_branch") - [(eq_attr "in_uncond_branch_delay" "true") - (nil) (nil)]) - -;; Function units of the SPARC - -;; (define_function_unit {name} {num-units} {n-users} {test} -;; {ready-delay} {issue-delay} [{conflict-list}]) - -;; The integer ALU. -;; (Noted only for documentation; units that take one cycle do not need to -;; be specified.) - -;; On the sparclite, integer multiply takes 1, 3, or 5 cycles depending on -;; the inputs. - -;; (define_function_unit "alu" 1 0 -;; (eq_attr "type" "unary,binary,move,address") 1 0) - -;; ---- cypress CY7C602 scheduling: -;; Memory with load-delay of 1 (i.e., 2 cycle load). - -(define_function_unit "memory" 1 0 - (and (eq_attr "cpu" "cypress") - (eq_attr "type" "load,sload,fpload")) - 2 2) - -;; SPARC has two floating-point units: the FP ALU, -;; and the FP MUL/DIV/SQRT unit. -;; Instruction timings on the CY7C602 are as follows -;; FABSs 4 -;; FADDs/d 5/5 -;; FCMPs/d 4/4 -;; FDIVs/d 23/37 -;; FMOVs 4 -;; FMULs/d 5/7 -;; FNEGs 4 -;; FSQRTs/d 34/63 -;; FSUBs/d 5/5 -;; FdTOi/s 5/5 -;; FsTOi/d 5/5 -;; FiTOs/d 9/5 - -;; The CY7C602 can only support 2 fp isnsn simultaneously. -;; More insns cause the chip to stall. - -(define_function_unit "fp_alu" 1 0 - (and (eq_attr "cpu" "cypress") - (eq_attr "type" "fp,fpmove")) - 5 5) - -(define_function_unit "fp_mds" 1 0 - (and (eq_attr "cpu" "cypress") - (eq_attr "type" "fpmul")) - 7 7) - -(define_function_unit "fp_mds" 1 0 - (and (eq_attr "cpu" "cypress") - (eq_attr "type" "fpdivs,fpdivd")) - 37 37) - -(define_function_unit "fp_mds" 1 0 - (and (eq_attr "cpu" "cypress") - (eq_attr "type" "fpsqrt")) - 63 63) - -;; ----- The TMS390Z55 scheduling -;; The Supersparc can issue 1 - 3 insns per cycle: up to two integer, -;; one ld/st, one fp. -;; Memory delivers its result in one cycle to IU, zero cycles to FP - -(define_function_unit "memory" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "load,sload")) - 1 1) - -(define_function_unit "memory" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "fpload")) - 0 1) - -(define_function_unit "memory" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "store,fpstore")) - 1 1) - -(define_function_unit "shift" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "shift")) - 1 1) - -;; There are only two write ports to the integer register file -;; A store also uses a write port - -(define_function_unit "iwport" 2 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "load,sload,store,shift,ialu")) - 1 1) - -;; Timings; throughput/latency -;; FADD 1/3 add/sub, format conv, compar, abs, neg -;; FMUL 1/3 -;; FDIVs 4/6 -;; FDIVd 7/9 -;; FSQRTs 6/8 -;; FSQRTd 10/12 -;; IMUL 4/4 - -(define_function_unit "fp_alu" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "fp,fpmove,fpcmp")) - 3 1) - -(define_function_unit "fp_mds" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "fpmul")) - 3 1) - -(define_function_unit "fp_mds" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "fpdivs")) - 6 4) - -(define_function_unit "fp_mds" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "fpdivd")) - 9 7) - -(define_function_unit "fp_mds" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "fpsqrt")) - 12 10) - -(define_function_unit "fp_mds" 1 0 - (and (eq_attr "cpu" "supersparc") - (eq_attr "type" "imul")) - 4 4) - -;; ----- hypersparc/sparclite86x scheduling -;; The Hypersparc can issue 1 - 2 insns per cycle. The dual issue cases are: -;; L-Ld/St I-Int F-Float B-Branch LI/LF/LB/II/IF/IB/FF/FB -;; II/FF case is only when loading a 32 bit hi/lo constant -;; Single issue insns include call, jmpl, u/smul, u/sdiv, lda, sta, fcmp -;; Memory delivers its result in one cycle to IU - -(define_function_unit "memory" 1 0 - (and (ior (eq_attr "cpu" "hypersparc") (eq_attr "cpu" "sparclite86x")) - (eq_attr "type" "load,sload,fpload")) - 1 1) - -(define_function_unit "memory" 1 0 - (and (ior (eq_attr "cpu" "hypersparc") (eq_attr "cpu" "sparclite86x")) - (eq_attr "type" "store,fpstore")) - 2 1) - -(define_function_unit "fp_alu" 1 0 - (and (ior (eq_attr "cpu" "hypersparc") (eq_attr "cpu" "sparclite86x")) - (eq_attr "type" "fp,fpmove,fpcmp")) - 1 1) - -(define_function_unit "fp_mds" 1 0 - (and (ior (eq_attr "cpu" "hypersparc") (eq_attr "cpu" "sparclite86x")) - (eq_attr "type" "fpmul")) - 1 1) - -(define_function_unit "fp_mds" 1 0 - (and (ior (eq_attr "cpu" "hypersparc") (eq_attr "cpu" "sparclite86x")) - (eq_attr "type" "fpdivs")) - 8 6) - -(define_function_unit "fp_mds" 1 0 - (and (ior (eq_attr "cpu" "hypersparc") (eq_attr "cpu" "sparclite86x")) - (eq_attr "type" "fpdivd")) - 12 10) - -(define_function_unit "fp_mds" 1 0 - (and (ior (eq_attr "cpu" "hypersparc") (eq_attr "cpu" "sparclite86x")) - (eq_attr "type" "fpsqrt")) - 17 15) - -(define_function_unit "fp_mds" 1 0 - (and (ior (eq_attr "cpu" "hypersparc") (eq_attr "cpu" "sparclite86x")) - (eq_attr "type" "imul")) - 17 15) - -;; ----- sparclet tsc701 scheduling -;; The tsc701 issues 1 insn per cycle. -;; Results may be written back out of order. - -;; Loads take 2 extra cycles to complete and 4 can be buffered at a time. - -(define_function_unit "tsc701_load" 4 1 - (and (eq_attr "cpu" "tsc701") - (eq_attr "type" "load,sload")) - 3 1) - -;; Stores take 2(?) extra cycles to complete. -;; It is desirable to not have any memory operation in the following 2 cycles. -;; (??? or 2 memory ops in the case of std). - -(define_function_unit "tsc701_store" 1 0 - (and (eq_attr "cpu" "tsc701") - (eq_attr "type" "store")) - 3 3 - [(eq_attr "type" "load,sload,store")]) - -;; The multiply unit has a latency of 5. -(define_function_unit "tsc701_mul" 1 0 - (and (eq_attr "cpu" "tsc701") - (eq_attr "type" "imul")) - 5 5) - -;; ----- The UltraSPARC-1 scheduling -;; UltraSPARC has two integer units. Shift instructions can only execute -;; on IE0. Condition code setting instructions, call, and jmpl (including -;; the ret and retl pseudo-instructions) can only execute on IE1. -;; Branch on register uses IE1, but branch on condition code does not. -;; Conditional moves take 2 cycles. No other instruction can issue in the -;; same cycle as a conditional move. -;; Multiply and divide take many cycles during which no other instructions -;; can issue. -;; Memory delivers its result in two cycles (except for signed loads, -;; which take one cycle more). One memory instruction can be issued per -;; cycle. - -(define_function_unit "memory" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "load,fpload")) - 2 1) - -(define_function_unit "memory" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "sload")) - 3 1) - -(define_function_unit "memory" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "store,fpstore")) - 1 1) - -(define_function_unit "ieuN" 2 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "ialu,binary,move,unary,shift,compare,call,call_no_delay_slot,uncond_branch")) - 1 1) - -(define_function_unit "ieu0" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "shift")) - 1 1) - -(define_function_unit "ieu0" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "cmove")) - 2 1) - -(define_function_unit "ieu1" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "compare,call,call_no_delay_slot,uncond_branch")) - 1 1) - -(define_function_unit "cti" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "branch")) - 1 1) - -;; Timings; throughput/latency -;; FMOV 1/1 fmov, fabs, fneg -;; FMOVcc 1/2 -;; FADD 1/4 add/sub, format conv, compar -;; FMUL 1/4 -;; FDIVs 12/12 -;; FDIVd 22/22 -;; FSQRTs 12/12 -;; FSQRTd 22/22 -;; FCMP takes 1 cycle to branch, 2 cycles to conditional move. -;; -;; ??? This is really bogus because the timings really depend upon -;; who uses the result. We should record who the user is with -;; more descriptive 'type' attribute names and account for these -;; issues in ultrasparc_adjust_cost. - -(define_function_unit "fadd" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "fpmove")) - 1 1) - -(define_function_unit "fadd" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "fpcmove")) - 2 1) - -(define_function_unit "fadd" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "fp")) - 4 1) - -(define_function_unit "fadd" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "fpcmp")) - 2 1) - -(define_function_unit "fmul" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "fpmul")) - 4 1) - -(define_function_unit "fadd" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "fpcmove")) - 2 1) - -(define_function_unit "fmul" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "fpdivs")) - 12 12) - -(define_function_unit "fmul" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "fpdivd")) - 22 22) - -(define_function_unit "fmul" 1 0 - (and (eq_attr "cpu" "ultrasparc") - (eq_attr "type" "fpsqrt")) - 12 12) - -;; Compare instructions. -;; This controls RTL generation and register allocation. - -;; We generate RTL for comparisons and branches by having the cmpxx -;; patterns store away the operands. Then, the scc and bcc patterns -;; emit RTL for both the compare and the branch. -;; -;; We do this because we want to generate different code for an sne and -;; seq insn. In those cases, if the second operand of the compare is not -;; const0_rtx, we want to compute the xor of the two operands and test -;; it against zero. -;; -;; We start with the DEFINE_EXPANDs, then the DEFINE_INSNs to match -;; the patterns. Finally, we have the DEFINE_SPLITs for some of the scc -;; insns that actually require more than one machine instruction. - -;; Put cmpsi first among compare insns so it matches two CONST_INT operands. - -(define_expand "cmpsi" - [(set (reg:CC 100) - (compare:CC (match_operand:SI 0 "register_operand" "") - (match_operand:SI 1 "arith_operand" "")))] - "" - " -{ - sparc_compare_op0 = operands[0]; - sparc_compare_op1 = operands[1]; - DONE; -}") - -(define_expand "cmpdi" - [(set (reg:CCX 100) - (compare:CCX (match_operand:DI 0 "register_operand" "") - (match_operand:DI 1 "arith_double_operand" "")))] - "TARGET_ARCH64" - " -{ - sparc_compare_op0 = operands[0]; - sparc_compare_op1 = operands[1]; - DONE; -}") - -(define_expand "cmpsf" - ;; The 96 here isn't ever used by anyone. - [(set (reg:CCFP 96) - (compare:CCFP (match_operand:SF 0 "register_operand" "") - (match_operand:SF 1 "register_operand" "")))] - "TARGET_FPU" - " -{ - sparc_compare_op0 = operands[0]; - sparc_compare_op1 = operands[1]; - DONE; -}") - -(define_expand "cmpdf" - ;; The 96 here isn't ever used by anyone. - [(set (reg:CCFP 96) - (compare:CCFP (match_operand:DF 0 "register_operand" "") - (match_operand:DF 1 "register_operand" "")))] - "TARGET_FPU" - " -{ - sparc_compare_op0 = operands[0]; - sparc_compare_op1 = operands[1]; - DONE; -}") - -(define_expand "cmptf" - ;; The 96 here isn't ever used by anyone. - [(set (reg:CCFP 96) - (compare:CCFP (match_operand:TF 0 "register_operand" "") - (match_operand:TF 1 "register_operand" "")))] - "TARGET_FPU" - " -{ - sparc_compare_op0 = operands[0]; - sparc_compare_op1 = operands[1]; - DONE; -}") - -;; Now the compare DEFINE_INSNs. - -(define_insn "*cmpsi_insn" - [(set (reg:CC 100) - (compare:CC (match_operand:SI 0 "register_operand" "r") - (match_operand:SI 1 "arith_operand" "rI")))] - "" - "cmp\\t%0, %1" - [(set_attr "type" "compare")]) - -(define_insn "*cmpdi_sp64" - [(set (reg:CCX 100) - (compare:CCX (match_operand:DI 0 "register_operand" "r") - (match_operand:DI 1 "arith_double_operand" "rHI")))] - "TARGET_ARCH64" - "cmp\\t%0, %1" - [(set_attr "type" "compare")]) - -(define_insn "*cmpsf_fpe" - [(set (match_operand:CCFPE 0 "fcc_reg_operand" "=c") - (compare:CCFPE (match_operand:SF 1 "register_operand" "f") - (match_operand:SF 2 "register_operand" "f")))] - "TARGET_FPU" - "* -{ - if (TARGET_V9) - return \"fcmpes\\t%0, %1, %2\"; - return \"fcmpes\\t%1, %2\"; -}" - [(set_attr "type" "fpcmp")]) - -(define_insn "*cmpdf_fpe" - [(set (match_operand:CCFPE 0 "fcc_reg_operand" "=c") - (compare:CCFPE (match_operand:DF 1 "register_operand" "e") - (match_operand:DF 2 "register_operand" "e")))] - "TARGET_FPU" - "* -{ - if (TARGET_V9) - return \"fcmped\\t%0, %1, %2\"; - return \"fcmped\\t%1, %2\"; -}" - [(set_attr "type" "fpcmp")]) - -(define_insn "*cmptf_fpe" - [(set (match_operand:CCFPE 0 "fcc_reg_operand" "=c") - (compare:CCFPE (match_operand:TF 1 "register_operand" "e") - (match_operand:TF 2 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "* -{ - if (TARGET_V9) - return \"fcmpeq\\t%0, %1, %2\"; - return \"fcmpeq\\t%1, %2\"; -}" - [(set_attr "type" "fpcmp")]) - -(define_insn "*cmpsf_fp" - [(set (match_operand:CCFP 0 "fcc_reg_operand" "=c") - (compare:CCFP (match_operand:SF 1 "register_operand" "f") - (match_operand:SF 2 "register_operand" "f")))] - "TARGET_FPU" - "* -{ - if (TARGET_V9) - return \"fcmps\\t%0, %1, %2\"; - return \"fcmps\\t%1, %2\"; -}" - [(set_attr "type" "fpcmp")]) - -(define_insn "*cmpdf_fp" - [(set (match_operand:CCFP 0 "fcc_reg_operand" "=c") - (compare:CCFP (match_operand:DF 1 "register_operand" "e") - (match_operand:DF 2 "register_operand" "e")))] - "TARGET_FPU" - "* -{ - if (TARGET_V9) - return \"fcmpd\\t%0, %1, %2\"; - return \"fcmpd\\t%1, %2\"; -}" - [(set_attr "type" "fpcmp")]) - -(define_insn "*cmptf_fp" - [(set (match_operand:CCFP 0 "fcc_reg_operand" "=c") - (compare:CCFP (match_operand:TF 1 "register_operand" "e") - (match_operand:TF 2 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "* -{ - if (TARGET_V9) - return \"fcmpq\\t%0, %1, %2\"; - return \"fcmpq\\t%1, %2\"; -}" - [(set_attr "type" "fpcmp")]) - -;; Next come the scc insns. For seq, sne, sgeu, and sltu, we can do this -;; without jumps using the addx/subx instructions. For seq/sne on v9 we use -;; the same code as v8 (the addx/subx method has more applications). The -;; exception to this is "reg != 0" which can be done in one instruction on v9 -;; (so we do it). For the rest, on v9 we use conditional moves; on v8, we do -;; branches. - -;; Seq_special[_xxx] and sne_special[_xxx] clobber the CC reg, because they -;; generate addcc/subcc instructions. - -(define_expand "seqsi_special" - [(set (match_dup 3) - (xor:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "register_operand" ""))) - (parallel [(set (match_operand:SI 0 "register_operand" "") - (eq:SI (match_dup 3) (const_int 0))) - (clobber (reg:CC 100))])] - "! TARGET_LIVE_G0" - "{ operands[3] = gen_reg_rtx (SImode); }") - -(define_expand "seqdi_special" - [(set (match_dup 3) - (xor:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "register_operand" ""))) - (set (match_operand:DI 0 "register_operand" "") - (eq:DI (match_dup 3) (const_int 0)))] - "TARGET_ARCH64" - "{ operands[3] = gen_reg_rtx (DImode); }") - -(define_expand "snesi_special" - [(set (match_dup 3) - (xor:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "register_operand" ""))) - (parallel [(set (match_operand:SI 0 "register_operand" "") - (ne:SI (match_dup 3) (const_int 0))) - (clobber (reg:CC 100))])] - "! TARGET_LIVE_G0" - "{ operands[3] = gen_reg_rtx (SImode); }") - -(define_expand "snedi_special" - [(set (match_dup 3) - (xor:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "register_operand" ""))) - (set (match_operand:DI 0 "register_operand" "") - (ne:DI (match_dup 3) (const_int 0)))] - "TARGET_ARCH64" - "{ operands[3] = gen_reg_rtx (DImode); }") - -(define_expand "seqdi_special_trunc" - [(set (match_dup 3) - (xor:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "register_operand" ""))) - (set (match_operand:SI 0 "register_operand" "") - (eq:SI (match_dup 3) (const_int 0)))] - "TARGET_ARCH64" - "{ operands[3] = gen_reg_rtx (DImode); }") - -(define_expand "snedi_special_trunc" - [(set (match_dup 3) - (xor:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "register_operand" ""))) - (set (match_operand:SI 0 "register_operand" "") - (ne:SI (match_dup 3) (const_int 0)))] - "TARGET_ARCH64" - "{ operands[3] = gen_reg_rtx (DImode); }") - -(define_expand "seqsi_special_extend" - [(set (match_dup 3) - (xor:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "register_operand" ""))) - (parallel [(set (match_operand:DI 0 "register_operand" "") - (eq:DI (match_dup 3) (const_int 0))) - (clobber (reg:CC 100))])] - "TARGET_ARCH64" - "{ operands[3] = gen_reg_rtx (SImode); }") - -(define_expand "snesi_special_extend" - [(set (match_dup 3) - (xor:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "register_operand" ""))) - (parallel [(set (match_operand:DI 0 "register_operand" "") - (ne:DI (match_dup 3) (const_int 0))) - (clobber (reg:CC 100))])] - "TARGET_ARCH64" - "{ operands[3] = gen_reg_rtx (SImode); }") - -;; ??? v9: Operand 0 needs a mode, so SImode was chosen. -;; However, the code handles both SImode and DImode. -(define_expand "seq" - [(set (match_operand:SI 0 "intreg_operand" "") - (eq:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (GET_MODE (sparc_compare_op0) == SImode) - { - rtx pat; - - if (GET_MODE (operands[0]) == SImode) - pat = gen_seqsi_special (operands[0], sparc_compare_op0, - sparc_compare_op1); - else if (! TARGET_ARCH64) - FAIL; - else - pat = gen_seqsi_special_extend (operands[0], sparc_compare_op0, - sparc_compare_op1); - emit_insn (pat); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == DImode) - { - rtx pat; - - if (! TARGET_ARCH64) - FAIL; - else if (GET_MODE (operands[0]) == SImode) - pat = gen_seqdi_special_trunc (operands[0], sparc_compare_op0, - sparc_compare_op1); - else - pat = gen_seqdi_special (operands[0], sparc_compare_op0, - sparc_compare_op1); - emit_insn (pat); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, EQ); - emit_insn (gen_sne (operands[0])); - DONE; - } - else if (TARGET_V9) - { - if (gen_v9_scc (EQ, operands)) - DONE; - /* fall through */ - } - FAIL; -}") - -;; ??? v9: Operand 0 needs a mode, so SImode was chosen. -;; However, the code handles both SImode and DImode. -(define_expand "sne" - [(set (match_operand:SI 0 "intreg_operand" "") - (ne:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (GET_MODE (sparc_compare_op0) == SImode) - { - rtx pat; - - if (GET_MODE (operands[0]) == SImode) - pat = gen_snesi_special (operands[0], sparc_compare_op0, - sparc_compare_op1); - else if (! TARGET_ARCH64) - FAIL; - else - pat = gen_snesi_special_extend (operands[0], sparc_compare_op0, - sparc_compare_op1); - emit_insn (pat); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == DImode) - { - rtx pat; - - if (! TARGET_ARCH64) - FAIL; - else if (GET_MODE (operands[0]) == SImode) - pat = gen_snedi_special_trunc (operands[0], sparc_compare_op0, - sparc_compare_op1); - else - pat = gen_snedi_special (operands[0], sparc_compare_op0, - sparc_compare_op1); - emit_insn (pat); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, NE); - emit_insn (gen_sne (operands[0])); - DONE; - } - else if (TARGET_V9) - { - if (gen_v9_scc (NE, operands)) - DONE; - /* fall through */ - } - FAIL; -}") - -(define_expand "sgt" - [(set (match_operand:SI 0 "intreg_operand" "") - (gt:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GT); - emit_insn (gen_sne (operands[0])); - DONE; - } - else if (TARGET_V9) - { - if (gen_v9_scc (GT, operands)) - DONE; - /* fall through */ - } - FAIL; -}") - -(define_expand "slt" - [(set (match_operand:SI 0 "intreg_operand" "") - (lt:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LT); - emit_insn (gen_sne (operands[0])); - DONE; - } - else if (TARGET_V9) - { - if (gen_v9_scc (LT, operands)) - DONE; - /* fall through */ - } - FAIL; -}") - -(define_expand "sge" - [(set (match_operand:SI 0 "intreg_operand" "") - (ge:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GE); - emit_insn (gen_sne (operands[0])); - DONE; - } - else if (TARGET_V9) - { - if (gen_v9_scc (GE, operands)) - DONE; - /* fall through */ - } - FAIL; -}") - -(define_expand "sle" - [(set (match_operand:SI 0 "intreg_operand" "") - (le:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LE); - emit_insn (gen_sne (operands[0])); - DONE; - } - else if (TARGET_V9) - { - if (gen_v9_scc (LE, operands)) - DONE; - /* fall through */ - } - FAIL; -}") - -(define_expand "sgtu" - [(set (match_operand:SI 0 "intreg_operand" "") - (gtu:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (! TARGET_V9) - { - rtx tem, pat; - - /* We can do ltu easily, so if both operands are registers, swap them and - do a LTU. */ - if ((GET_CODE (sparc_compare_op0) == REG - || GET_CODE (sparc_compare_op0) == SUBREG) - && (GET_CODE (sparc_compare_op1) == REG - || GET_CODE (sparc_compare_op1) == SUBREG)) - { - tem = sparc_compare_op0; - sparc_compare_op0 = sparc_compare_op1; - sparc_compare_op1 = tem; - pat = gen_sltu (operands[0]); - if (pat == NULL_RTX) - FAIL; - emit_insn (pat); - DONE; - } - } - else - { - if (gen_v9_scc (GTU, operands)) - DONE; - } - FAIL; -}") - -(define_expand "sltu" - [(set (match_operand:SI 0 "intreg_operand" "") - (ltu:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (TARGET_V9) - { - if (gen_v9_scc (LTU, operands)) - DONE; - } - operands[1] = gen_compare_reg (LTU, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "sgeu" - [(set (match_operand:SI 0 "intreg_operand" "") - (geu:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (TARGET_V9) - { - if (gen_v9_scc (GEU, operands)) - DONE; - } - operands[1] = gen_compare_reg (GEU, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "sleu" - [(set (match_operand:SI 0 "intreg_operand" "") - (leu:SI (match_dup 1) (const_int 0)))] - "! TARGET_LIVE_G0" - " -{ - if (! TARGET_V9) - { - rtx tem, pat; - - /* We can do geu easily, so if both operands are registers, swap them and - do a GEU. */ - if ((GET_CODE (sparc_compare_op0) == REG - || GET_CODE (sparc_compare_op0) == SUBREG) - && (GET_CODE (sparc_compare_op1) == REG - || GET_CODE (sparc_compare_op1) == SUBREG)) - { - tem = sparc_compare_op0; - sparc_compare_op0 = sparc_compare_op1; - sparc_compare_op1 = tem; - pat = gen_sgeu (operands[0]); - if (pat == NULL_RTX) - FAIL; - emit_insn (pat); - DONE; - } - } - else - { - if (gen_v9_scc (LEU, operands)) - DONE; - } - FAIL; -}") - -;; Now the DEFINE_INSNs for the scc cases. - -;; The SEQ and SNE patterns are special because they can be done -;; without any branching and do not involve a COMPARE. We want -;; them to always use the splitz below so the results can be -;; scheduled. - -(define_insn "*snesi_zero" - [(set (match_operand:SI 0 "register_operand" "=r") - (ne:SI (match_operand:SI 1 "register_operand" "r") - (const_int 0))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (ne:SI (match_operand:SI 1 "register_operand" "") - (const_int 0))) - (clobber (reg:CC 100))] - "" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (ltu:SI (reg:CC 100) (const_int 0)))] - "") - -(define_insn "*neg_snesi_zero" - [(set (match_operand:SI 0 "register_operand" "=r") - (neg:SI (ne:SI (match_operand:SI 1 "register_operand" "r") - (const_int 0)))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (neg:SI (ne:SI (match_operand:SI 1 "register_operand" "") - (const_int 0)))) - (clobber (reg:CC 100))] - "" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (neg:SI (ltu:SI (reg:CC 100) (const_int 0))))] - "") - -(define_insn "*snesi_zero_extend" - [(set (match_operand:DI 0 "register_operand" "=r") - (ne:DI (match_operand:SI 1 "register_operand" "r") - (const_int 0))) - (clobber (reg:CC 100))] - "TARGET_ARCH64" - "#" - [(set_attr "type" "unary") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (ne:DI (match_operand:SI 1 "register_operand" "") - (const_int 0))) - (clobber (reg:CC 100))] - "TARGET_ARCH64" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (minus:SI (const_int 0) (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (zero_extend:DI (plus:SI (plus:SI (const_int 0) - (const_int 0)) - (ltu:SI (reg:CC_NOOV 100) - (const_int 0)))))] - "") - -(define_insn "*snedi_zero" - [(set (match_operand:DI 0 "register_operand" "=&r") - (ne:DI (match_operand:DI 1 "register_operand" "r") - (const_int 0)))] - "TARGET_ARCH64" - "#" - [(set_attr "type" "cmove") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (ne:DI (match_operand:DI 1 "register_operand" "") - (const_int 0)))] - "TARGET_ARCH64" - [(set (match_dup 0) (const_int 0)) - (set (match_dup 0) (if_then_else:DI (ne:DI (match_dup 1) - (const_int 0)) - (const_int 1) - (match_dup 0)))] - "") - -(define_insn "*neg_snedi_zero" - [(set (match_operand:DI 0 "register_operand" "=&r") - (neg:DI (ne:DI (match_operand:DI 1 "register_operand" "r") - (const_int 0))))] - "TARGET_ARCH64" - "#" - [(set_attr "type" "cmove") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (neg:DI (ne:DI (match_operand:DI 1 "register_operand" "") - (const_int 0))))] - "TARGET_ARCH64" - [(set (match_dup 0) (const_int 0)) - (set (match_dup 0) (if_then_else:DI (ne:DI (match_dup 1) - (const_int 0)) - (const_int -1) - (match_dup 0)))] - "") - -(define_insn "*snedi_zero_trunc" - [(set (match_operand:SI 0 "register_operand" "=&r") - (ne:SI (match_operand:DI 1 "register_operand" "r") - (const_int 0)))] - "TARGET_ARCH64" - "#" - [(set_attr "type" "cmove") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (ne:SI (match_operand:DI 1 "register_operand" "") - (const_int 0)))] - "TARGET_ARCH64" - [(set (match_dup 0) (const_int 0)) - (set (match_dup 0) (if_then_else:SI (ne:DI (match_dup 1) - (const_int 0)) - (const_int 1) - (match_dup 0)))] - "") - -(define_insn "*seqsi_zero" - [(set (match_operand:SI 0 "register_operand" "=r") - (eq:SI (match_operand:SI 1 "register_operand" "r") - (const_int 0))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (eq:SI (match_operand:SI 1 "register_operand" "") - (const_int 0))) - (clobber (reg:CC 100))] - "" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (geu:SI (reg:CC 100) (const_int 0)))] - "") - -(define_insn "*neg_seqsi_zero" - [(set (match_operand:SI 0 "register_operand" "=r") - (neg:SI (eq:SI (match_operand:SI 1 "register_operand" "r") - (const_int 0)))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (neg:SI (eq:SI (match_operand:SI 1 "register_operand" "") - (const_int 0)))) - (clobber (reg:CC 100))] - "" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (neg:SI (geu:SI (reg:CC 100) (const_int 0))))] - "") - -(define_insn "*seqsi_zero_extend" - [(set (match_operand:DI 0 "register_operand" "=r") - (eq:DI (match_operand:SI 1 "register_operand" "r") - (const_int 0))) - (clobber (reg:CC 100))] - "TARGET_ARCH64" - "#" - [(set_attr "type" "unary") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (eq:DI (match_operand:SI 1 "register_operand" "") - (const_int 0))) - (clobber (reg:CC 100))] - "TARGET_ARCH64" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (minus:SI (const_int 0) (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (zero_extend:DI (minus:SI (minus:SI (const_int 0) - (const_int -1)) - (ltu:SI (reg:CC_NOOV 100) - (const_int 0)))))] - "") - -(define_insn "*seqdi_zero" - [(set (match_operand:DI 0 "register_operand" "=&r") - (eq:DI (match_operand:DI 1 "register_operand" "r") - (const_int 0)))] - "TARGET_ARCH64" - "#" - [(set_attr "type" "cmove") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (eq:DI (match_operand:DI 1 "register_operand" "") - (const_int 0)))] - "TARGET_ARCH64" - [(set (match_dup 0) (const_int 0)) - (set (match_dup 0) (if_then_else:DI (eq:DI (match_dup 1) - (const_int 0)) - (const_int 1) - (match_dup 0)))] - "") - -(define_insn "*neg_seqdi_zero" - [(set (match_operand:DI 0 "register_operand" "=&r") - (neg:DI (eq:DI (match_operand:DI 1 "register_operand" "r") - (const_int 0))))] - "TARGET_ARCH64" - "#" - [(set_attr "type" "cmove") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (neg:DI (eq:DI (match_operand:DI 1 "register_operand" "") - (const_int 0))))] - "TARGET_ARCH64" - [(set (match_dup 0) (const_int 0)) - (set (match_dup 0) (if_then_else:DI (eq:DI (match_dup 1) - (const_int 0)) - (const_int -1) - (match_dup 0)))] - "") - -(define_insn "*seqdi_zero_trunc" - [(set (match_operand:SI 0 "register_operand" "=&r") - (eq:SI (match_operand:DI 1 "register_operand" "r") - (const_int 0)))] - "TARGET_ARCH64" - "#" - [(set_attr "type" "cmove") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (eq:SI (match_operand:DI 1 "register_operand" "") - (const_int 0)))] - "TARGET_ARCH64" - [(set (match_dup 0) (const_int 0)) - (set (match_dup 0) (if_then_else:SI (eq:DI (match_dup 1) - (const_int 0)) - (const_int 1) - (match_dup 0)))] - "") - -;; We can also do (x + (i == 0)) and related, so put them in. -;; ??? The addx/subx insns use the 32 bit carry flag so there are no DImode -;; versions for v9. - -(define_insn "*x_plus_i_ne_0" - [(set (match_operand:SI 0 "register_operand" "=r") - (plus:SI (ne:SI (match_operand:SI 1 "register_operand" "r") - (const_int 0)) - (match_operand:SI 2 "register_operand" "r"))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (plus:SI (ne:SI (match_operand:SI 1 "register_operand" "") - (const_int 0)) - (match_operand:SI 2 "register_operand" ""))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (plus:SI (ltu:SI (reg:CC 100) (const_int 0)) - (match_dup 2)))] - "") - -(define_insn "*x_minus_i_ne_0" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (match_operand:SI 2 "register_operand" "r") - (ne:SI (match_operand:SI 1 "register_operand" "r") - (const_int 0)))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (minus:SI (match_operand:SI 2 "register_operand" "") - (ne:SI (match_operand:SI 1 "register_operand" "") - (const_int 0)))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (minus:SI (match_dup 2) - (ltu:SI (reg:CC 100) (const_int 0))))] - "") - -(define_insn "*x_plus_i_eq_0" - [(set (match_operand:SI 0 "register_operand" "=r") - (plus:SI (eq:SI (match_operand:SI 1 "register_operand" "r") - (const_int 0)) - (match_operand:SI 2 "register_operand" "r"))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (plus:SI (eq:SI (match_operand:SI 1 "register_operand" "") - (const_int 0)) - (match_operand:SI 2 "register_operand" ""))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (plus:SI (geu:SI (reg:CC 100) (const_int 0)) - (match_dup 2)))] - "") - -(define_insn "*x_minus_i_eq_0" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (match_operand:SI 2 "register_operand" "r") - (eq:SI (match_operand:SI 1 "register_operand" "r") - (const_int 0)))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (minus:SI (match_operand:SI 2 "register_operand" "") - (eq:SI (match_operand:SI 1 "register_operand" "") - (const_int 0)))) - (clobber (reg:CC 100))] - "! TARGET_LIVE_G0" - [(set (reg:CC_NOOV 100) (compare:CC_NOOV (neg:SI (match_dup 1)) - (const_int 0))) - (set (match_dup 0) (minus:SI (match_dup 2) - (geu:SI (reg:CC 100) (const_int 0))))] - "") - -;; We can also do GEU and LTU directly, but these operate after a compare. -;; ??? The addx/subx insns use the 32 bit carry flag so there are no DImode -;; versions for v9. - -(define_insn "*sltu_insn" - [(set (match_operand:SI 0 "register_operand" "=r") - (ltu:SI (reg:CC 100) (const_int 0)))] - "! TARGET_LIVE_G0" - "addx\\t%%g0, 0, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*neg_sltu_insn" - [(set (match_operand:SI 0 "register_operand" "=r") - (neg:SI (ltu:SI (reg:CC 100) (const_int 0))))] - "! TARGET_LIVE_G0" - "subx\\t%%g0, 0, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -;; ??? Combine should canonicalize these next two to the same pattern. -(define_insn "*neg_sltu_minus_x" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (neg:SI (ltu:SI (reg:CC 100) (const_int 0))) - (match_operand:SI 1 "arith_operand" "rI")))] - "! TARGET_LIVE_G0" - "subx\\t%%g0, %1, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*neg_sltu_plus_x" - [(set (match_operand:SI 0 "register_operand" "=r") - (neg:SI (plus:SI (ltu:SI (reg:CC 100) (const_int 0)) - (match_operand:SI 1 "arith_operand" "rI"))))] - "! TARGET_LIVE_G0" - "subx\\t%%g0, %1, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*sgeu_insn" - [(set (match_operand:SI 0 "register_operand" "=r") - (geu:SI (reg:CC 100) (const_int 0)))] - "! TARGET_LIVE_G0" - "subx\\t%%g0, -1, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*neg_sgeu_insn" - [(set (match_operand:SI 0 "register_operand" "=r") - (neg:SI (geu:SI (reg:CC 100) (const_int 0))))] - "! TARGET_LIVE_G0" - "addx\\t%%g0, -1, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -;; We can also do (x + ((unsigned) i >= 0)) and related, so put them in. -;; ??? The addx/subx insns use the 32 bit carry flag so there are no DImode -;; versions for v9. - -(define_insn "*sltu_plus_x" - [(set (match_operand:SI 0 "register_operand" "=r") - (plus:SI (ltu:SI (reg:CC 100) (const_int 0)) - (match_operand:SI 1 "arith_operand" "rI")))] - "! TARGET_LIVE_G0" - "addx\\t%%g0, %1, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*sltu_plus_x_plus_y" - [(set (match_operand:SI 0 "register_operand" "=r") - (plus:SI (ltu:SI (reg:CC 100) (const_int 0)) - (plus:SI (match_operand:SI 1 "arith_operand" "%r") - (match_operand:SI 2 "arith_operand" "rI"))))] - "" - "addx\\t%1, %2, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*x_minus_sltu" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (match_operand:SI 1 "register_operand" "r") - (ltu:SI (reg:CC 100) (const_int 0))))] - "" - "subx\\t%1, 0, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -;; ??? Combine should canonicalize these next two to the same pattern. -(define_insn "*x_minus_y_minus_sltu" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") - (match_operand:SI 2 "arith_operand" "rI")) - (ltu:SI (reg:CC 100) (const_int 0))))] - "" - "subx\\t%r1, %2, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*x_minus_sltu_plus_y" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") - (plus:SI (ltu:SI (reg:CC 100) (const_int 0)) - (match_operand:SI 2 "arith_operand" "rI"))))] - "" - "subx\\t%r1, %2, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*sgeu_plus_x" - [(set (match_operand:SI 0 "register_operand" "=r") - (plus:SI (geu:SI (reg:CC 100) (const_int 0)) - (match_operand:SI 1 "register_operand" "r")))] - "" - "subx\\t%1, -1, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*x_minus_sgeu" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (match_operand:SI 1 "register_operand" "r") - (geu:SI (reg:CC 100) (const_int 0))))] - "" - "addx\\t%1, -1, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "=r") - (match_operator:SI 2 "noov_compare_op" - [(match_operand 1 "icc_or_fcc_reg_operand" "") - (const_int 0)]))] - ;; 32 bit LTU/GEU are better implemented using addx/subx - "TARGET_V9 && REGNO (operands[1]) == SPARC_ICC_REG - && (GET_MODE (operands[1]) == CCXmode - || (GET_CODE (operands[2]) != LTU && GET_CODE (operands[2]) != GEU))" - [(set (match_dup 0) (const_int 0)) - (set (match_dup 0) - (if_then_else:SI (match_op_dup:SI 2 [(match_dup 1) (const_int 0)]) - (const_int 1) - (match_dup 0)))] - "") - - -;; These control RTL generation for conditional jump insns - -;; The quad-word fp compare library routines all return nonzero to indicate -;; true, which is different from the equivalent libgcc routines, so we must -;; handle them specially here. - -(define_expand "beq" - [(set (pc) - (if_then_else (eq (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ - if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode) - { - emit_v9_brxx_insn (EQ, sparc_compare_op0, operands[0]); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, EQ); - emit_jump_insn (gen_bne (operands[0])); - DONE; - } - operands[1] = gen_compare_reg (EQ, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "bne" - [(set (pc) - (if_then_else (ne (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ - if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode) - { - emit_v9_brxx_insn (NE, sparc_compare_op0, operands[0]); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, NE); - emit_jump_insn (gen_bne (operands[0])); - DONE; - } - operands[1] = gen_compare_reg (NE, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "bgt" - [(set (pc) - (if_then_else (gt (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ - if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode) - { - emit_v9_brxx_insn (GT, sparc_compare_op0, operands[0]); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GT); - emit_jump_insn (gen_bne (operands[0])); - DONE; - } - operands[1] = gen_compare_reg (GT, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "bgtu" - [(set (pc) - (if_then_else (gtu (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ operands[1] = gen_compare_reg (GTU, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "blt" - [(set (pc) - (if_then_else (lt (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ - if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode) - { - emit_v9_brxx_insn (LT, sparc_compare_op0, operands[0]); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LT); - emit_jump_insn (gen_bne (operands[0])); - DONE; - } - operands[1] = gen_compare_reg (LT, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "bltu" - [(set (pc) - (if_then_else (ltu (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ operands[1] = gen_compare_reg (LTU, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "bge" - [(set (pc) - (if_then_else (ge (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ - if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode) - { - emit_v9_brxx_insn (GE, sparc_compare_op0, operands[0]); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, GE); - emit_jump_insn (gen_bne (operands[0])); - DONE; - } - operands[1] = gen_compare_reg (GE, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "bgeu" - [(set (pc) - (if_then_else (geu (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ operands[1] = gen_compare_reg (GEU, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "ble" - [(set (pc) - (if_then_else (le (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ - if (TARGET_ARCH64 && sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode) - { - emit_v9_brxx_insn (LE, sparc_compare_op0, operands[0]); - DONE; - } - else if (GET_MODE (sparc_compare_op0) == TFmode && ! TARGET_HARD_QUAD) - { - emit_float_lib_cmp (sparc_compare_op0, sparc_compare_op1, LE); - emit_jump_insn (gen_bne (operands[0])); - DONE; - } - operands[1] = gen_compare_reg (LE, sparc_compare_op0, sparc_compare_op1); -}") - -(define_expand "bleu" - [(set (pc) - (if_then_else (leu (match_dup 1) (const_int 0)) - (label_ref (match_operand 0 "" "")) - (pc)))] - "" - " -{ operands[1] = gen_compare_reg (LEU, sparc_compare_op0, sparc_compare_op1); -}") - -;; Now match both normal and inverted jump. - -;; XXX fpcmp nop braindamage -(define_insn "*normal_branch" - [(set (pc) - (if_then_else (match_operator 0 "noov_compare_op" - [(reg 100) (const_int 0)]) - (label_ref (match_operand 1 "" "")) - (pc)))] - "" - "* -{ - return output_cbranch (operands[0], 1, 0, - final_sequence && INSN_ANNULLED_BRANCH_P (insn), - ! final_sequence, insn); -}" - [(set_attr "type" "branch")]) - -;; XXX fpcmp nop braindamage -(define_insn "*inverted_branch" - [(set (pc) - (if_then_else (match_operator 0 "noov_compare_op" - [(reg 100) (const_int 0)]) - (pc) - (label_ref (match_operand 1 "" ""))))] - "" - "* -{ - return output_cbranch (operands[0], 1, 1, - final_sequence && INSN_ANNULLED_BRANCH_P (insn), - ! final_sequence, insn); -}" - [(set_attr "type" "branch")]) - -;; XXX fpcmp nop braindamage -(define_insn "*normal_fp_branch" - [(set (pc) - (if_then_else (match_operator 1 "comparison_operator" - [(match_operand:CCFP 0 "fcc_reg_operand" "c") - (const_int 0)]) - (label_ref (match_operand 2 "" "")) - (pc)))] - "" - "* -{ - return output_cbranch (operands[1], 2, 0, - final_sequence && INSN_ANNULLED_BRANCH_P (insn), - ! final_sequence, insn); -}" - [(set_attr "type" "branch")]) - -;; XXX fpcmp nop braindamage -(define_insn "*inverted_fp_branch" - [(set (pc) - (if_then_else (match_operator 1 "comparison_operator" - [(match_operand:CCFP 0 "fcc_reg_operand" "c") - (const_int 0)]) - (pc) - (label_ref (match_operand 2 "" ""))))] - "" - "* -{ - return output_cbranch (operands[1], 2, 1, - final_sequence && INSN_ANNULLED_BRANCH_P (insn), - ! final_sequence, insn); -}" - [(set_attr "type" "branch")]) - -;; XXX fpcmp nop braindamage -(define_insn "*normal_fpe_branch" - [(set (pc) - (if_then_else (match_operator 1 "comparison_operator" - [(match_operand:CCFPE 0 "fcc_reg_operand" "c") - (const_int 0)]) - (label_ref (match_operand 2 "" "")) - (pc)))] - "" - "* -{ - return output_cbranch (operands[1], 2, 0, - final_sequence && INSN_ANNULLED_BRANCH_P (insn), - ! final_sequence, insn); -}" - [(set_attr "type" "branch")]) - -;; XXX fpcmp nop braindamage -(define_insn "*inverted_fpe_branch" - [(set (pc) - (if_then_else (match_operator 1 "comparison_operator" - [(match_operand:CCFPE 0 "fcc_reg_operand" "c") - (const_int 0)]) - (pc) - (label_ref (match_operand 2 "" ""))))] - "" - "* -{ - return output_cbranch (operands[1], 2, 1, - final_sequence && INSN_ANNULLED_BRANCH_P (insn), - ! final_sequence, insn); -}" - [(set_attr "type" "branch")]) - -;; Sparc V9-specific jump insns. None of these are guaranteed to be -;; in the architecture. - -;; There are no 32 bit brreg insns. - -;; XXX -(define_insn "*normal_int_branch_sp64" - [(set (pc) - (if_then_else (match_operator 0 "v9_regcmp_op" - [(match_operand:DI 1 "register_operand" "r") - (const_int 0)]) - (label_ref (match_operand 2 "" "")) - (pc)))] - "TARGET_ARCH64" - "* -{ - return output_v9branch (operands[0], 1, 2, 0, - final_sequence && INSN_ANNULLED_BRANCH_P (insn), - ! final_sequence, insn); -}" - [(set_attr "type" "branch")]) - -;; XXX -(define_insn "*inverted_int_branch_sp64" - [(set (pc) - (if_then_else (match_operator 0 "v9_regcmp_op" - [(match_operand:DI 1 "register_operand" "r") - (const_int 0)]) - (pc) - (label_ref (match_operand 2 "" ""))))] - "TARGET_ARCH64" - "* -{ - return output_v9branch (operands[0], 1, 2, 1, - final_sequence && INSN_ANNULLED_BRANCH_P (insn), - ! final_sequence, insn); -}" - [(set_attr "type" "branch")]) - -;; Load program counter insns. - -(define_insn "get_pc" - [(clobber (reg:SI 15)) - (set (match_operand 0 "register_operand" "=r") - (unspec [(match_operand 1 "" "") (match_operand 2 "" "")] 2))] - "flag_pic && REGNO (operands[0]) == 23" - "sethi\\t%%hi(%a1-4), %0\\n\\tcall\\t%a2\\n\\tadd\\t%0, %%lo(%a1+4), %0" - [(set_attr "length" "3")]) - -;; Currently unused... -;; (define_insn "get_pc_via_rdpc" -;; [(set (match_operand 0 "register_operand" "=r") (pc))] -;; "TARGET_V9" -;; "rd\\t%%pc, %0" -;; [(set_attr "type" "move")]) - - -;; Move instructions - -(define_expand "movqi" - [(set (match_operand:QI 0 "general_operand" "") - (match_operand:QI 1 "general_operand" ""))] - "" - " -{ - /* Working with CONST_INTs is easier, so convert - a double if needed. */ - if (GET_CODE (operands[1]) == CONST_DOUBLE) - { - operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]) & 0xff); - } - else if (GET_CODE (operands[1]) == CONST_INT) - { - /* And further, we know for all QI cases that only the - low byte is significant, which we can always process - in a single insn. So mask it now. */ - operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff); - } - - /* Handle sets of MEM first. */ - if (GET_CODE (operands[0]) == MEM) - { - /* This checks TARGET_LIVE_G0 for us. */ - if (reg_or_0_operand (operands[1], QImode)) - goto movqi_is_ok; - - if (! reload_in_progress) - { - operands[0] = validize_mem (operands[0]); - operands[1] = force_reg (QImode, operands[1]); - } - } - - /* Fixup PIC cases. */ - if (flag_pic) - { - if (CONSTANT_P (operands[1]) - && pic_address_needs_scratch (operands[1])) - operands[1] = legitimize_pic_address (operands[1], QImode, 0); - - if (symbolic_operand (operands[1], QImode)) - { - operands[1] = legitimize_pic_address (operands[1], - QImode, - (reload_in_progress ? - operands[0] : - NULL_RTX)); - goto movqi_is_ok; - } - } - - /* All QI constants require only one insn, so proceed. */ - - movqi_is_ok: - ; -}") - -(define_insn "*movqi_insn" - [(set (match_operand:QI 0 "general_operand" "=r,r,m") - (match_operand:QI 1 "input_operand" "rI,m,rJ"))] - "(register_operand (operands[0], QImode) - || reg_or_0_operand (operands[1], QImode))" - "@ - mov\\t%1, %0 - ldub\\t%1, %0 - stb\\t%r1, %0" - [(set_attr "type" "move,load,store") - (set_attr "length" "1")]) - -(define_expand "movhi" - [(set (match_operand:HI 0 "general_operand" "") - (match_operand:HI 1 "general_operand" ""))] - "" - " -{ - /* Working with CONST_INTs is easier, so convert - a double if needed. */ - if (GET_CODE (operands[1]) == CONST_DOUBLE) - operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1])); - - /* Handle sets of MEM first. */ - if (GET_CODE (operands[0]) == MEM) - { - /* This checks TARGET_LIVE_G0 for us. */ - if (reg_or_0_operand (operands[1], HImode)) - goto movhi_is_ok; - - if (! reload_in_progress) - { - operands[0] = validize_mem (operands[0]); - operands[1] = force_reg (HImode, operands[1]); - } - } - - /* Fixup PIC cases. */ - if (flag_pic) - { - if (CONSTANT_P (operands[1]) - && pic_address_needs_scratch (operands[1])) - operands[1] = legitimize_pic_address (operands[1], HImode, 0); - - if (symbolic_operand (operands[1], HImode)) - { - operands[1] = legitimize_pic_address (operands[1], - HImode, - (reload_in_progress ? - operands[0] : - NULL_RTX)); - goto movhi_is_ok; - } - } - - /* This makes sure we will not get rematched due to splittage. */ - if (! CONSTANT_P (operands[1]) || input_operand (operands[1], HImode)) - ; - else if (CONSTANT_P (operands[1]) - && GET_CODE (operands[1]) != HIGH - && GET_CODE (operands[1]) != LO_SUM) - { - sparc_emit_set_const32 (operands[0], operands[1]); - DONE; - } - movhi_is_ok: - ; -}") - -(define_insn "*movhi_const64_special" - [(set (match_operand:HI 0 "register_operand" "=r") - (match_operand:HI 1 "const64_high_operand" ""))] - "TARGET_ARCH64" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "*movhi_insn" - [(set (match_operand:HI 0 "general_operand" "=r,r,r,m") - (match_operand:HI 1 "input_operand" "rI,K,m,rJ"))] - "(register_operand (operands[0], HImode) - || reg_or_0_operand (operands[1], HImode))" - "@ - mov\\t%1, %0 - sethi\\t%%hi(%a1), %0 - lduh\\t%1, %0 - sth\\t%r1, %0" - [(set_attr "type" "move,move,load,store") - (set_attr "length" "1")]) - -;; We always work with constants here. -(define_insn "*movhi_lo_sum" - [(set (match_operand:HI 0 "register_operand" "=r") - (ior:HI (match_operand:HI 1 "arith_operand" "%r") - (match_operand:HI 2 "arith_operand" "I")))] - "" - "or\\t%1, %2, %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_expand "movsi" - [(set (match_operand:SI 0 "general_operand" "") - (match_operand:SI 1 "general_operand" ""))] - "" - " -{ - /* Working with CONST_INTs is easier, so convert - a double if needed. */ - if (GET_CODE (operands[1]) == CONST_DOUBLE) - operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1])); - - /* Handle sets of MEM first. */ - if (GET_CODE (operands[0]) == MEM) - { - /* This checks TARGET_LIVE_G0 for us. */ - if (reg_or_0_operand (operands[1], SImode)) - goto movsi_is_ok; - - if (! reload_in_progress) - { - operands[0] = validize_mem (operands[0]); - operands[1] = force_reg (SImode, operands[1]); - } - } - - /* Fixup PIC cases. */ - if (flag_pic) - { - if (CONSTANT_P (operands[1]) - && pic_address_needs_scratch (operands[1])) - operands[1] = legitimize_pic_address (operands[1], SImode, 0); - - if (GET_CODE (operands[1]) == LABEL_REF) - { - /* shit */ - emit_insn (gen_movsi_pic_label_ref (operands[0], operands[1])); - DONE; - } - - if (symbolic_operand (operands[1], SImode)) - { - operands[1] = legitimize_pic_address (operands[1], - SImode, - (reload_in_progress ? - operands[0] : - NULL_RTX)); - goto movsi_is_ok; - } - } - - /* If we are trying to toss an integer constant into the - FPU registers, force it into memory. */ - if (GET_CODE (operands[0]) == REG - && REGNO (operands[0]) >= SPARC_FIRST_FP_REG - && REGNO (operands[0]) <= SPARC_LAST_V9_FP_REG - && CONSTANT_P (operands[1])) - operands[1] = validize_mem (force_const_mem (GET_MODE (operands[0]), - operands[1])); - - /* This makes sure we will not get rematched due to splittage. */ - if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode)) - ; - else if (CONSTANT_P (operands[1]) - && GET_CODE (operands[1]) != HIGH - && GET_CODE (operands[1]) != LO_SUM) - { - sparc_emit_set_const32 (operands[0], operands[1]); - DONE; - } - movsi_is_ok: - ; -}") - -;; Special LIVE_G0 pattern to obtain zero in a register. -(define_insn "*movsi_zero_liveg0" - [(set (match_operand:SI 0 "register_operand" "=r") - (match_operand:SI 1 "zero_operand" "J"))] - "TARGET_LIVE_G0" - "and\\t%0, 0, %0" - [(set_attr "type" "binary") - (set_attr "length" "1")]) - -;; This is needed to show CSE exactly which bits are set -;; in a 64-bit register by sethi instructions. -(define_insn "*movsi_const64_special" - [(set (match_operand:SI 0 "register_operand" "=r") - (match_operand:SI 1 "const64_high_operand" ""))] - "TARGET_ARCH64" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "*movsi_insn" - [(set (match_operand:SI 0 "general_operand" "=r,f,r,r,r,f,m,m,d") - (match_operand:SI 1 "input_operand" "rI,!f,K,J,m,!m,rJ,!f,J"))] - "(register_operand (operands[0], SImode) - || reg_or_0_operand (operands[1], SImode))" - "@ - mov\\t%1, %0 - fmovs\\t%1, %0 - sethi\\t%%hi(%a1), %0 - clr\\t%0 - ld\\t%1, %0 - ld\\t%1, %0 - st\\t%r1, %0 - st\\t%1, %0 - fzeros\\t%0" - [(set_attr "type" "move,fpmove,move,move,load,fpload,store,fpstore,fpmove") - (set_attr "length" "1")]) - -(define_insn "*movsi_lo_sum" - [(set (match_operand:SI 0 "register_operand" "=r") - (lo_sum:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "immediate_operand" "in")))] - "" - "or\\t%1, %%lo(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "*movsi_high" - [(set (match_operand:SI 0 "register_operand" "=r") - (high:SI (match_operand:SI 1 "immediate_operand" "in")))] - "" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -;; The next two patterns must wrap the SYMBOL_REF in an UNSPEC -;; so that CSE won't optimize the address computation away. -(define_insn "movsi_lo_sum_pic" - [(set (match_operand:SI 0 "register_operand" "=r") - (lo_sum:SI (match_operand:SI 1 "register_operand" "r") - (unspec:SI [(match_operand:SI 2 "immediate_operand" "in")] 0)))] - "flag_pic" - "or\\t%1, %%lo(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "movsi_high_pic" - [(set (match_operand:SI 0 "register_operand" "=r") - (high:SI (unspec:SI [(match_operand 1 "" "")] 0)))] - "flag_pic && check_pic (1)" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_expand "movsi_pic_label_ref" - [(set (match_dup 3) (high:SI - (unspec:SI [(match_operand:SI 1 "label_ref_operand" "") - (match_dup 2)] 5))) - (set (match_dup 4) (lo_sum:SI (match_dup 3) - (unspec:SI [(match_dup 1) (match_dup 2)] 5))) - (set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (match_dup 5) (match_dup 4)))] - "flag_pic" - " -{ - current_function_uses_pic_offset_table = 1; - operands[2] = gen_rtx_SYMBOL_REF (Pmode, \"_GLOBAL_OFFSET_TABLE_\"); - operands[3] = gen_reg_rtx (SImode); - operands[4] = gen_reg_rtx (SImode); - operands[5] = pic_offset_table_rtx; -}") - -(define_insn "*movsi_high_pic_label_ref" - [(set (match_operand:SI 0 "register_operand" "=r") - (high:SI - (unspec:SI [(match_operand:SI 1 "label_ref_operand" "") - (match_operand:SI 2 "" "")] 5)))] - "flag_pic" - "sethi\\t%%hi(%a2-(%a1-.)), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "*movsi_lo_sum_pic_label_ref" - [(set (match_operand:SI 0 "register_operand" "=r") - (lo_sum:SI (match_operand:SI 1 "register_operand" "r") - (unspec:SI [(match_operand:SI 2 "label_ref_operand" "") - (match_operand:SI 3 "" "")] 5)))] - "flag_pic" - "or\\t%1, %%lo(%a3-(%a2-.)), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_expand "movdi" - [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand" "") - (match_operand:DI 1 "general_operand" ""))] - "" - " -{ - /* Where possible, convert CONST_DOUBLE into a CONST_INT. */ - if (GET_CODE (operands[1]) == CONST_DOUBLE -#if HOST_BITS_PER_WIDE_INT == 32 - && ((CONST_DOUBLE_HIGH (operands[1]) == 0 - && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) == 0) - || (CONST_DOUBLE_HIGH (operands[1]) == (HOST_WIDE_INT) 0xffffffff - && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) != 0)) -#endif - ) - operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1])); - - /* Handle MEM cases first. */ - if (GET_CODE (operands[0]) == MEM) - { - /* If it's a REG, we can always do it. - The const zero case is more complex, on v9 - we can always perform it. */ - if (register_operand (operands[1], DImode) - || (TARGET_ARCH64 - && (operands[1] == const0_rtx))) - goto movdi_is_ok; - - if (! reload_in_progress) - { - operands[0] = validize_mem (operands[0]); - operands[1] = force_reg (DImode, operands[1]); - } - } - - if (flag_pic) - { - if (CONSTANT_P (operands[1]) - && pic_address_needs_scratch (operands[1])) - operands[1] = legitimize_pic_address (operands[1], DImode, 0); - - if (GET_CODE (operands[1]) == LABEL_REF) - { - if (! TARGET_ARCH64) - abort (); - emit_insn (gen_movdi_pic_label_ref (operands[0], operands[1])); - DONE; - } - - if (symbolic_operand (operands[1], DImode)) - { - operands[1] = legitimize_pic_address (operands[1], - DImode, - (reload_in_progress ? - operands[0] : - NULL_RTX)); - goto movdi_is_ok; - } - } - - /* If we are trying to toss an integer constant into the - FPU registers, force it into memory. */ - if (GET_CODE (operands[0]) == REG - && REGNO (operands[0]) >= SPARC_FIRST_FP_REG - && REGNO (operands[0]) <= SPARC_LAST_V9_FP_REG - && CONSTANT_P (operands[1])) - operands[1] = validize_mem (force_const_mem (GET_MODE (operands[0]), - operands[1])); - - /* This makes sure we will not get rematched due to splittage. */ - if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode)) - ; - else if (TARGET_ARCH64 - && CONSTANT_P (operands[1]) - && GET_CODE (operands[1]) != HIGH - && GET_CODE (operands[1]) != LO_SUM) - { - sparc_emit_set_const64 (operands[0], operands[1]); - DONE; - } - - movdi_is_ok: - ; -}") - -;; Be careful, fmovd does not exist when !arch64. -;; We match MEM moves directly when we have correct even -;; numbered registers, but fall into splits otherwise. -;; The constraint ordering here is really important to -;; avoid insane problems in reload, especially for patterns -;; of the form: -;; -;; (set (mem:DI (plus:SI (reg:SI 30 %fp) -;; (const_int -5016))) -;; (reg:DI 2 %g2)) -;; -(define_insn "*movdi_insn_sp32" - [(set (match_operand:DI 0 "general_operand" "=T,U,o,r,r,r,?T,?f,?f,?o,?f") - (match_operand:DI 1 "input_operand" "U,T,r,o,i,r,f,T,o,f,f"))] - "! TARGET_ARCH64 && - (register_operand (operands[0], DImode) - || register_operand (operands[1], DImode))" - "@ - std\\t%1, %0 - ldd\\t%1, %0 - # - # - # - # - std\\t%1, %0 - ldd\\t%1, %0 - # - # - #" - [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,*,*,*") - (set_attr "length" "1,1,2,2,2,2,1,1,2,2,2")]) - -;; The following are generated by sparc_emit_set_const64 -(define_insn "*movdi_sp64_dbl" - [(set (match_operand:DI 0 "register_operand" "=r") - (match_operand:DI 1 "const64_operand" ""))] - "(TARGET_ARCH64 - && HOST_BITS_PER_WIDE_INT != 64)" - "mov\\t%1, %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -;; This is needed to show CSE exactly which bits are set -;; in a 64-bit register by sethi instructions. -(define_insn "*movdi_const64_special" - [(set (match_operand:DI 0 "register_operand" "=r") - (match_operand:DI 1 "const64_high_operand" ""))] - "TARGET_ARCH64" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "*movdi_insn_sp64" - [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,m,?e,?e,?m,b") - (match_operand:DI 1 "input_operand" "rI,K,J,m,rJ,e,m,e,J"))] - "TARGET_ARCH64 && - (register_operand (operands[0], DImode) - || reg_or_0_operand (operands[1], DImode))" - "@ - mov\\t%1, %0 - sethi\\t%%hi(%a1), %0 - clr\\t%0 - ldx\\t%1, %0 - stx\\t%r1, %0 - fmovd\\t%1, %0 - ldd\\t%1, %0 - std\\t%1, %0 - fzero\\t%0" - [(set_attr "type" "move,move,move,load,store,fpmove,fpload,fpstore,fpmove") - (set_attr "length" "1")]) - -(define_expand "movdi_pic_label_ref" - [(set (match_dup 3) (high:DI - (unspec:DI [(match_operand:DI 1 "label_ref_operand" "") - (match_dup 2)] 5))) - (set (match_dup 4) (lo_sum:DI (match_dup 3) - (unspec:DI [(match_dup 1) (match_dup 2)] 5))) - (set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (match_dup 5) (match_dup 4)))] - "TARGET_ARCH64 && flag_pic" - " -{ - current_function_uses_pic_offset_table = 1; - operands[2] = gen_rtx_SYMBOL_REF (Pmode, \"_GLOBAL_OFFSET_TABLE_\"); - operands[3] = gen_reg_rtx (DImode); - operands[4] = gen_reg_rtx (DImode); - operands[5] = pic_offset_table_rtx; -}") - -(define_insn "*movdi_high_pic_label_ref" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI - (unspec:DI [(match_operand:DI 1 "label_ref_operand" "") - (match_operand:DI 2 "" "")] 5)))] - "TARGET_ARCH64 && flag_pic" - "sethi\\t%%hi(%a2-(%a1-.)), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "*movdi_lo_sum_pic_label_ref" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (unspec:DI [(match_operand:DI 2 "label_ref_operand" "") - (match_operand:DI 3 "" "")] 5)))] - "TARGET_ARCH64 && flag_pic" - "or\\t%1, %%lo(%a3-(%a2-.)), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -;; Sparc-v9 code model support insns. See sparc_emit_set_symbolic_const64 -;; in sparc.c to see what is going on here... PIC stuff comes first. - -(define_insn "movdi_lo_sum_pic" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (unspec:DI [(match_operand:DI 2 "immediate_operand" "in")] 0)))] - "TARGET_ARCH64 && flag_pic" - "or\\t%1, %%lo(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "movdi_high_pic" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI (unspec:DI [(match_operand 1 "" "")] 0)))] - "TARGET_ARCH64 && flag_pic && check_pic (1)" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "*sethi_di_medlow_embmedany_pic" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI (match_operand:DI 1 "sp64_medium_pic_operand" "")))] - "(TARGET_CM_MEDLOW || TARGET_CM_EMBMEDANY) && check_pic (1)" - "sethi\\t%%lo(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "*sethi_di_medlow" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI (match_operand:DI 1 "symbolic_operand" "")))] - "TARGET_CM_MEDLOW && check_pic (1)" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "*losum_di_medlow" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "symbolic_operand" "")))] - "TARGET_CM_MEDLOW" - "or\\t%1, %%lo(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "seth44" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")] 6)))] - "TARGET_CM_MEDMID" - "sethi\\t%%h44(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "setm44" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")] 7)))] - "TARGET_CM_MEDMID" - "or\\t%1, %%m44(%a2), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "setl44" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "symbolic_operand" "")))] - "TARGET_CM_MEDMID" - "or\\t%1, %%l44(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "sethh" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")] 9)))] - "TARGET_CM_MEDANY" - "sethi\\t%%hh(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "setlm" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")] 10)))] - "TARGET_CM_MEDANY" - "sethi\\t%%lm(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "sethm" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")] 18)))] - "TARGET_CM_MEDANY" - "or\\t%1, %%hm(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "setlo" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "symbolic_operand" "")))] - "TARGET_CM_MEDANY" - "or\\t%1, %%lo(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "embmedany_sethi" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI (unspec:DI [(match_operand:DI 1 "data_segment_operand" "")] 11)))] - "TARGET_CM_EMBMEDANY && check_pic (1)" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "embmedany_losum" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "data_segment_operand" "")))] - "TARGET_CM_EMBMEDANY" - "add\\t%1, %%lo(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "embmedany_brsum" - [(set (match_operand:DI 0 "register_operand" "=r") - (unspec:DI [(match_operand:DI 1 "register_operand" "r")] 11))] - "TARGET_CM_EMBMEDANY" - "add\\t%1, %_, %0" - [(set_attr "length" "1")]) - -(define_insn "embmedany_textuhi" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI (unspec:DI [(match_operand:DI 1 "text_segment_operand" "")] 13)))] - "TARGET_CM_EMBMEDANY && check_pic (1)" - "sethi\\t%%uhi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "embmedany_texthi" - [(set (match_operand:DI 0 "register_operand" "=r") - (high:DI (unspec:DI [(match_operand:DI 1 "text_segment_operand" "")] 14)))] - "TARGET_CM_EMBMEDANY && check_pic (1)" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "embmedany_textulo" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (unspec:DI [(match_operand:DI 2 "text_segment_operand" "")] 15)))] - "TARGET_CM_EMBMEDANY" - "or\\t%1, %%ulo(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "embmedany_textlo" - [(set (match_operand:DI 0 "register_operand" "=r") - (lo_sum:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "text_segment_operand" "")))] - "TARGET_CM_EMBMEDANY" - "or\\t%1, %%lo(%a2), %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -;; Now some patterns to help reload out a bit. -(define_expand "reload_indi" - [(parallel [(match_operand:DI 0 "register_operand" "=r") - (match_operand:DI 1 "immediate_operand" "") - (match_operand:TI 2 "register_operand" "=&r")])] - "(TARGET_CM_MEDANY - || TARGET_CM_EMBMEDANY) - && ! flag_pic" - " -{ - sparc_emit_set_symbolic_const64 (operands[0], operands[1], - gen_rtx_REG (DImode, REGNO (operands[2]))); - DONE; -}") - -(define_expand "reload_outdi" - [(parallel [(match_operand:DI 0 "register_operand" "=r") - (match_operand:DI 1 "immediate_operand" "") - (match_operand:TI 2 "register_operand" "=&r")])] - "(TARGET_CM_MEDANY - || TARGET_CM_EMBMEDANY) - && ! flag_pic" - " -{ - sparc_emit_set_symbolic_const64 (operands[0], operands[1], - gen_rtx_REG (DImode, REGNO (operands[2]))); - DONE; -}") - -;; Split up putting CONSTs and REGs into DI regs when !arch64 -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (match_operand:DI 1 "const_int_operand" ""))] - "! TARGET_ARCH64 && reload_completed" - [(clobber (const_int 0))] - " -{ - emit_insn (gen_movsi (gen_highpart (SImode, operands[0]), - (INTVAL (operands[1]) < 0) ? - constm1_rtx : - const0_rtx)); - emit_insn (gen_movsi (gen_lowpart (SImode, operands[0]), - operands[1])); - DONE; -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (match_operand:DI 1 "const_double_operand" ""))] - "! TARGET_ARCH64 && reload_completed" - [(clobber (const_int 0))] - " -{ - emit_insn (gen_movsi (gen_highpart (SImode, operands[0]), - GEN_INT (CONST_DOUBLE_HIGH (operands[1])))); - - /* Slick... but this trick loses if this subreg constant part - can be done in one insn. */ - if (CONST_DOUBLE_LOW (operands[1]) == CONST_DOUBLE_HIGH (operands[1]) - && !(SPARC_SETHI_P (CONST_DOUBLE_HIGH (operands[1])) - || SPARC_SIMM13_P (CONST_DOUBLE_HIGH (operands[1])))) - { - emit_insn (gen_movsi (gen_lowpart (SImode, operands[0]), - gen_highpart (SImode, operands[0]))); - } - else - { - emit_insn (gen_movsi (gen_lowpart (SImode, operands[0]), - GEN_INT (CONST_DOUBLE_LOW (operands[1])))); - } - DONE; -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (match_operand:DI 1 "register_operand" ""))] - "! TARGET_ARCH64 && reload_completed" - [(clobber (const_int 0))] - " -{ - rtx set_dest = operands[0]; - rtx set_src = operands[1]; - rtx dest1, dest2; - rtx src1, src2; - - if (GET_CODE (set_dest) == SUBREG) - set_dest = alter_subreg (set_dest); - if (GET_CODE (set_src) == SUBREG) - set_src = alter_subreg (set_src); - - dest1 = gen_highpart (SImode, set_dest); - dest2 = gen_lowpart (SImode, set_dest); - src1 = gen_highpart (SImode, set_src); - src2 = gen_lowpart (SImode, set_src); - - /* Now emit using the real source and destination we found, swapping - the order if we detect overlap. */ - if (reg_overlap_mentioned_p (dest1, src2)) - { - emit_insn (gen_movsi (dest2, src2)); - emit_insn (gen_movsi (dest1, src1)); - } - else - { - emit_insn (gen_movsi (dest1, src1)); - emit_insn (gen_movsi (dest2, src2)); - } - DONE; -}") - -;; Now handle the cases of memory moves from/to non-even -;; DI mode register pairs. -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (match_operand:DI 1 "memory_operand" ""))] - "(! TARGET_ARCH64 - && reload_completed - && sparc_splitdi_legitimate (operands[0], operands[1]))" - [(clobber (const_int 0))] - " -{ - rtx word0 = change_address (operands[1], SImode, NULL_RTX); - rtx word1 = change_address (operands[1], SImode, - plus_constant_for_output (XEXP (word0, 0), 4)); - rtx high_part = gen_highpart (SImode, operands[0]); - rtx low_part = gen_lowpart (SImode, operands[0]); - - if (reg_overlap_mentioned_p (high_part, word1)) - { - emit_insn (gen_movsi (low_part, word1)); - emit_insn (gen_movsi (high_part, word0)); - } - else - { - emit_insn (gen_movsi (high_part, word0)); - emit_insn (gen_movsi (low_part, word1)); - } - DONE; -}") - -(define_split - [(set (match_operand:DI 0 "memory_operand" "") - (match_operand:DI 1 "register_operand" ""))] - "(! TARGET_ARCH64 - && reload_completed - && sparc_splitdi_legitimate (operands[1], operands[0]))" - [(clobber (const_int 0))] - " -{ - rtx word0 = change_address (operands[0], SImode, NULL_RTX); - rtx word1 = change_address (operands[0], SImode, - plus_constant_for_output (XEXP (word0, 0), 4)); - rtx high_part = gen_highpart (SImode, operands[1]); - rtx low_part = gen_lowpart (SImode, operands[1]); - - emit_insn (gen_movsi (word0, high_part)); - emit_insn (gen_movsi (word1, low_part)); - DONE; -}") - - -;; Floating point move insns - -(define_insn "*clear_sf" - [(set (match_operand:SF 0 "general_operand" "=f") - (match_operand:SF 1 "" ""))] - "TARGET_VIS - && GET_CODE (operands[1]) == CONST_DOUBLE - && GET_CODE (operands[0]) == REG - && fp_zero_operand (operands[1])" - "fzeros\\t%0" - [(set_attr "type" "fpmove") - (set_attr "length" "1")]) - -(define_insn "*movsf_const_intreg" - [(set (match_operand:SF 0 "general_operand" "=f,r") - (match_operand:SF 1 "" "m,F"))] - "TARGET_FPU - && GET_CODE (operands[1]) == CONST_DOUBLE - && GET_CODE (operands[0]) == REG" - "* -{ - REAL_VALUE_TYPE r; - long i; - - if (which_alternative == 0) - return \"ld\\t%1, %0\"; - - REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]); - REAL_VALUE_TO_TARGET_SINGLE (r, i); - if (SPARC_SIMM13_P (i) || SPARC_SETHI_P (i)) - { - operands[1] = GEN_INT (i); - if (SPARC_SIMM13_P (INTVAL (operands[1]))) - return \"mov\\t%1, %0\"; - else if (SPARC_SETHI_P (INTVAL (operands[1]))) - return \"sethi\\t%%hi(%a1), %0\"; - else - abort (); - } - else - return \"#\"; -}" - [(set_attr "type" "move") - (set_attr "length" "1,2")]) - -;; There isn't much I can do about this, if I change the -;; mode then flow info gets really confused because the -;; destination no longer looks the same. Ho hum... -(define_insn "*movsf_const_high" - [(set (match_operand:SF 0 "register_operand" "=r") - (unspec:SF [(match_operand 1 "const_int_operand" "")] 12))] - "" - "sethi\\t%%hi(%a1), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_insn "*movsf_const_lo" - [(set (match_operand:SF 0 "register_operand" "=r") - (unspec:SF [(match_operand 1 "register_operand" "r") - (match_operand 2 "const_int_operand" "")] 17))] - "" - "or\\t%1, %%lo(%a2), %0" - [(set_attr "type" "move") - (set_attr "length" "1")]) - -(define_split - [(set (match_operand:SF 0 "register_operand" "") - (match_operand:SF 1 "const_double_operand" ""))] - "TARGET_FPU - && (GET_CODE (operands[0]) == REG - && REGNO (operands[0]) < 32)" - [(set (match_dup 0) (unspec:SF [(match_dup 1)] 12)) - (set (match_dup 0) (unspec:SF [(match_dup 0) (match_dup 1)] 17))] - " -{ - REAL_VALUE_TYPE r; - long i; - - REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]); - REAL_VALUE_TO_TARGET_SINGLE (r, i); - operands[1] = GEN_INT (i); -}") - -(define_expand "movsf" - [(set (match_operand:SF 0 "general_operand" "") - (match_operand:SF 1 "general_operand" ""))] - "" - " -{ - /* Force SFmode constants into memory. */ - if (GET_CODE (operands[0]) == REG - && CONSTANT_P (operands[1])) - { - if (TARGET_VIS - && GET_CODE (operands[1]) == CONST_DOUBLE - && fp_zero_operand (operands[1])) - goto movsf_is_ok; - - /* emit_group_store will send such bogosity to us when it is - not storing directly into memory. So fix this up to avoid - crashes in output_constant_pool. */ - if (operands [1] == const0_rtx) - operands[1] = CONST0_RTX (SFmode); - operands[1] = validize_mem (force_const_mem (GET_MODE (operands[0]), - operands[1])); - } - - /* Handle sets of MEM first. */ - if (GET_CODE (operands[0]) == MEM) - { - if (register_operand (operands[1], SFmode)) - goto movsf_is_ok; - - if (! reload_in_progress) - { - operands[0] = validize_mem (operands[0]); - operands[1] = force_reg (SFmode, operands[1]); - } - } - - /* Fixup PIC cases. */ - if (flag_pic) - { - if (CONSTANT_P (operands[1]) - && pic_address_needs_scratch (operands[1])) - operands[1] = legitimize_pic_address (operands[1], SFmode, 0); - - if (symbolic_operand (operands[1], SFmode)) - { - operands[1] = legitimize_pic_address (operands[1], - SFmode, - (reload_in_progress ? - operands[0] : - NULL_RTX)); - } - } - - movsf_is_ok: - ; -}") - -(define_insn "*movsf_insn" - [(set (match_operand:SF 0 "general_operand" "=f,f,m,r,r,m") - (match_operand:SF 1 "input_operand" "f,m,f,r,m,r"))] - "TARGET_FPU - && (register_operand (operands[0], SFmode) - || register_operand (operands[1], SFmode))" - "@ - fmovs\\t%1, %0 - ld\\t%1, %0 - st\\t%1, %0 - mov\\t%1, %0 - ld\\t%1, %0 - st\\t%1, %0" - [(set_attr "type" "fpmove,fpload,fpstore,move,load,store") - (set_attr "length" "1")]) - -;; Exactly the same as above, except that all `f' cases are deleted. -;; This is necessary to prevent reload from ever trying to use a `f' reg -;; when -mno-fpu. - -(define_insn "*movsf_no_f_insn" - [(set (match_operand:SF 0 "general_operand" "=r,r,m") - (match_operand:SF 1 "input_operand" "r,m,r"))] - "! TARGET_FPU - && (register_operand (operands[0], SFmode) - || register_operand (operands[1], SFmode))" - "@ - mov\\t%1, %0 - ld\\t%1, %0 - st\\t%1, %0" - [(set_attr "type" "move,load,store") - (set_attr "length" "1")]) - -(define_insn "*clear_df" - [(set (match_operand:DF 0 "general_operand" "=e") - (match_operand:DF 1 "" ""))] - "TARGET_VIS - && GET_CODE (operands[1]) == CONST_DOUBLE - && GET_CODE (operands[0]) == REG - && fp_zero_operand (operands[1])" - "fzero\\t%0" - [(set_attr "type" "fpmove") - (set_attr "length" "1")]) - -(define_insn "*movdf_const_intreg_sp32" - [(set (match_operand:DF 0 "general_operand" "=e,e,r") - (match_operand:DF 1 "" "T,o,F"))] - "TARGET_FPU && ! TARGET_ARCH64 - && GET_CODE (operands[1]) == CONST_DOUBLE - && GET_CODE (operands[0]) == REG" - "* -{ - if (which_alternative == 0) - return \"ldd\\t%1, %0\"; - else - return \"#\"; -}" - [(set_attr "type" "move") - (set_attr "length" "1,2,2")]) - -;; Now that we redo life analysis with a clean slate after -;; instruction splitting for sched2 this can work. -(define_insn "*movdf_const_intreg_sp64" - [(set (match_operand:DF 0 "general_operand" "=e,e,r") - (match_operand:DF 1 "" "m,o,F"))] - "TARGET_FPU - && TARGET_ARCH64 - && GET_CODE (operands[1]) == CONST_DOUBLE - && GET_CODE (operands[0]) == REG" - "* -{ - if (which_alternative == 0) - return \"ldd\\t%1, %0\"; - else - return \"#\"; -}" - [(set_attr "type" "move") - (set_attr "length" "1,2,2")]) - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (match_operand:DF 1 "const_double_operand" ""))] - "TARGET_FPU - && GET_CODE (operands[1]) == CONST_DOUBLE - && (GET_CODE (operands[0]) == REG - && REGNO (operands[0]) < 32) - && reload_completed" - [(clobber (const_int 0))] - " -{ - REAL_VALUE_TYPE r; - long l[2]; - - REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]); - REAL_VALUE_TO_TARGET_DOUBLE (r, l); - if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - operands[0] = gen_rtx_raw_REG (DImode, REGNO (operands[0])); - - if (TARGET_ARCH64) - { -#if HOST_BITS_PER_WIDE_INT == 64 - HOST_WIDE_INT val; - - val = ((HOST_WIDE_INT)l[1] | - ((HOST_WIDE_INT)l[0] << 32)); - emit_insn (gen_movdi (operands[0], GEN_INT (val))); -#else - emit_insn (gen_movdi (operands[0], - gen_rtx_CONST_DOUBLE (VOIDmode, const0_rtx, - l[1], l[0]))); -#endif - } - else - { - emit_insn (gen_movsi (gen_highpart (SImode, operands[0]), - GEN_INT (l[0]))); - - /* Slick... but this trick loses if this subreg constant part - can be done in one insn. */ - if (l[1] == l[0] - && !(SPARC_SETHI_P (l[0]) - || SPARC_SIMM13_P (l[0]))) - { - emit_insn (gen_movsi (gen_lowpart (SImode, operands[0]), - gen_highpart (SImode, operands[0]))); - } - else - { - emit_insn (gen_movsi (gen_lowpart (SImode, operands[0]), - GEN_INT (l[1]))); - } - } - DONE; -}") - -(define_expand "movdf" - [(set (match_operand:DF 0 "general_operand" "") - (match_operand:DF 1 "general_operand" ""))] - "" - " -{ - /* Force DFmode constants into memory. */ - if (GET_CODE (operands[0]) == REG - && CONSTANT_P (operands[1])) - { - if (TARGET_VIS - && GET_CODE (operands[1]) == CONST_DOUBLE - && fp_zero_operand (operands[1])) - goto movdf_is_ok; - - /* emit_group_store will send such bogosity to us when it is - not storing directly into memory. So fix this up to avoid - crashes in output_constant_pool. */ - if (operands [1] == const0_rtx) - operands[1] = CONST0_RTX (DFmode); - operands[1] = validize_mem (force_const_mem (GET_MODE (operands[0]), - operands[1])); - } - - /* Handle MEM cases first. */ - if (GET_CODE (operands[0]) == MEM) - { - if (register_operand (operands[1], DFmode)) - goto movdf_is_ok; - - if (! reload_in_progress) - { - operands[0] = validize_mem (operands[0]); - operands[1] = force_reg (DFmode, operands[1]); - } - } - - /* Fixup PIC cases. */ - if (flag_pic) - { - if (CONSTANT_P (operands[1]) - && pic_address_needs_scratch (operands[1])) - operands[1] = legitimize_pic_address (operands[1], DFmode, 0); - - if (symbolic_operand (operands[1], DFmode)) - { - operands[1] = legitimize_pic_address (operands[1], - DFmode, - (reload_in_progress ? - operands[0] : - NULL_RTX)); - } - } - - movdf_is_ok: - ; -}") - -;; Be careful, fmovd does not exist when !v9. -(define_insn "*movdf_insn_sp32" - [(set (match_operand:DF 0 "general_operand" "=e,T,U,T,e,r,r,o,e,o") - (match_operand:DF 1 "input_operand" "T,e,T,U,e,r,o,r,o,e"))] - "TARGET_FPU - && ! TARGET_V9 - && (register_operand (operands[0], DFmode) - || register_operand (operands[1], DFmode))" - "@ - ldd\\t%1, %0 - std\\t%1, %0 - ldd\\t%1, %0 - std\\t%1, %0 - # - # - # - # - # - #" - [(set_attr "type" "fpload,fpstore,load,store,*,*,*,*,*,*") - (set_attr "length" "1,1,1,1,2,2,2,2,2,2")]) - -(define_insn "*movdf_no_e_insn_sp32" - [(set (match_operand:DF 0 "general_operand" "=U,T,r,r,o") - (match_operand:DF 1 "input_operand" "T,U,r,o,r"))] - "! TARGET_FPU - && ! TARGET_ARCH64 - && (register_operand (operands[0], DFmode) - || register_operand (operands[1], DFmode))" - "@ - ldd\\t%1, %0 - std\\t%1, %0 - # - # - #" - [(set_attr "type" "load,store,*,*,*") - (set_attr "length" "1,1,2,2,2")]) - -;; We have available v9 double floats but not 64-bit -;; integer registers. -(define_insn "*movdf_insn_v9only" - [(set (match_operand:DF 0 "general_operand" "=e,e,m,U,T,r,r,o") - (match_operand:DF 1 "input_operand" "e,m,e,T,U,r,o,r"))] - "TARGET_FPU - && TARGET_V9 - && ! TARGET_ARCH64 - && (register_operand (operands[0], DFmode) - || register_operand (operands[1], DFmode))" - "@ - fmovd\\t%1, %0 - ldd\\t%1, %0 - std\\t%1, %0 - ldd\\t%1, %0 - std\\t%1, %0 - # - # - #" - [(set_attr "type" "fpmove,load,store,load,store,*,*,*") - (set_attr "length" "1,1,1,1,1,2,2,2")]) - -;; We have available both v9 double floats and 64-bit -;; integer registers. -(define_insn "*movdf_insn_sp64" - [(set (match_operand:DF 0 "general_operand" "=e,e,m,r,r,m") - (match_operand:DF 1 "input_operand" "e,m,e,r,m,r"))] - "TARGET_FPU - && TARGET_V9 - && TARGET_ARCH64 - && (register_operand (operands[0], DFmode) - || register_operand (operands[1], DFmode))" - "@ - fmovd\\t%1, %0 - ldd\\t%1, %0 - std\\t%1, %0 - mov\\t%1, %0 - ldx\\t%1, %0 - stx\\t%1, %0" - [(set_attr "type" "fpmove,load,store,move,load,store") - (set_attr "length" "1")]) - -(define_insn "*movdf_no_e_insn_sp64" - [(set (match_operand:DF 0 "general_operand" "=r,r,m") - (match_operand:DF 1 "input_operand" "r,m,r"))] - "! TARGET_FPU - && TARGET_ARCH64 - && (register_operand (operands[0], DFmode) - || register_operand (operands[1], DFmode))" - "@ - mov\\t%1, %0 - ldx\\t%1, %0 - stx\\t%1, %0" - [(set_attr "type" "move,load,store") - (set_attr "length" "1")]) - -;; Ok, now the splits to handle all the multi insn and -;; mis-aligned memory address cases. -;; In these splits please take note that we must be -;; careful when V9 but not ARCH64 because the integer -;; register DFmode cases must be handled. -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (match_operand:DF 1 "register_operand" ""))] - "(! TARGET_V9 - || (! TARGET_ARCH64 - && ((GET_CODE (operands[0]) == REG - && REGNO (operands[0]) < 32) - || (GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == REG - && REGNO (SUBREG_REG (operands[0])) < 32)))) - && reload_completed" - [(clobber (const_int 0))] - " -{ - rtx set_dest = operands[0]; - rtx set_src = operands[1]; - rtx dest1, dest2; - rtx src1, src2; - - if (GET_CODE (set_dest) == SUBREG) - set_dest = alter_subreg (set_dest); - if (GET_CODE (set_src) == SUBREG) - set_src = alter_subreg (set_src); - - dest1 = gen_highpart (SFmode, set_dest); - dest2 = gen_lowpart (SFmode, set_dest); - src1 = gen_highpart (SFmode, set_src); - src2 = gen_lowpart (SFmode, set_src); - - /* Now emit using the real source and destination we found, swapping - the order if we detect overlap. */ - if (reg_overlap_mentioned_p (dest1, src2)) - { - emit_insn (gen_movsf (dest2, src2)); - emit_insn (gen_movsf (dest1, src1)); - } - else - { - emit_insn (gen_movsf (dest1, src1)); - emit_insn (gen_movsf (dest2, src2)); - } - DONE; -}") - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (match_operand:DF 1 "memory_operand" ""))] - "((! TARGET_V9 - || (! TARGET_ARCH64 - && ((GET_CODE (operands[0]) == REG - && REGNO (operands[0]) < 32) - || (GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == REG - && REGNO (SUBREG_REG (operands[0])) < 32)))) - && (reload_completed - && (((REGNO (operands[0])) % 2) != 0 - || ! mem_min_alignment (operands[1], 8)) - && offsettable_memref_p (operands[1])))" - [(clobber (const_int 0))] - " -{ - rtx word0 = change_address (operands[1], SFmode, NULL_RTX); - rtx word1 = change_address (operands[1], SFmode, - plus_constant_for_output (XEXP (word0, 0), 4)); - - if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - - if (reg_overlap_mentioned_p (gen_highpart (SFmode, operands[0]), word1)) - { - emit_insn (gen_movsf (gen_lowpart (SFmode, operands[0]), - word1)); - emit_insn (gen_movsf (gen_highpart (SFmode, operands[0]), - word0)); - } - else - { - emit_insn (gen_movsf (gen_highpart (SFmode, operands[0]), - word0)); - emit_insn (gen_movsf (gen_lowpart (SFmode, operands[0]), - word1)); - } - DONE; -}") - -(define_split - [(set (match_operand:DF 0 "memory_operand" "") - (match_operand:DF 1 "register_operand" ""))] - "((! TARGET_V9 - || (! TARGET_ARCH64 - && ((GET_CODE (operands[1]) == REG - && REGNO (operands[1]) < 32) - || (GET_CODE (operands[1]) == SUBREG - && GET_CODE (SUBREG_REG (operands[1])) == REG - && REGNO (SUBREG_REG (operands[1])) < 32)))) - && (reload_completed - && (((REGNO (operands[1])) % 2) != 0 - || ! mem_min_alignment (operands[0], 8)) - && offsettable_memref_p (operands[0])))" - [(clobber (const_int 0))] - " -{ - rtx word0 = change_address (operands[0], SFmode, NULL_RTX); - rtx word1 = change_address (operands[0], SFmode, - plus_constant_for_output (XEXP (word0, 0), 4)); - - if (GET_CODE (operands[1]) == SUBREG) - operands[1] = alter_subreg (operands[1]); - emit_insn (gen_movsf (word0, - gen_highpart (SFmode, operands[1]))); - emit_insn (gen_movsf (word1, - gen_lowpart (SFmode, operands[1]))); - DONE; -}") - -(define_expand "movtf" - [(set (match_operand:TF 0 "general_operand" "") - (match_operand:TF 1 "general_operand" ""))] - "" - " -{ - /* Force TFmode constants into memory. */ - if (GET_CODE (operands[0]) == REG - && CONSTANT_P (operands[1])) - { - /* emit_group_store will send such bogosity to us when it is - not storing directly into memory. So fix this up to avoid - crashes in output_constant_pool. */ - if (operands [1] == const0_rtx) - operands[1] = CONST0_RTX (TFmode); - operands[1] = validize_mem (force_const_mem (GET_MODE (operands[0]), - operands[1])); - } - - /* Handle MEM cases first, note that only v9 guarentees - full 16-byte alignment for quads. */ - if (GET_CODE (operands[0]) == MEM) - { - if (register_operand (operands[1], TFmode)) - goto movtf_is_ok; - - if (! reload_in_progress) - { - operands[0] = validize_mem (operands[0]); - operands[1] = force_reg (TFmode, operands[1]); - } - } - - /* Fixup PIC cases. */ - if (flag_pic) - { - if (CONSTANT_P (operands[1]) - && pic_address_needs_scratch (operands[1])) - operands[1] = legitimize_pic_address (operands[1], TFmode, 0); - - if (symbolic_operand (operands[1], TFmode)) - { - operands[1] = legitimize_pic_address (operands[1], - TFmode, - (reload_in_progress ? - operands[0] : - NULL_RTX)); - } - } - - movtf_is_ok: - ; -}") - -;; Be careful, fmovq and {st,ld}{x,q} do not exist when !arch64 so -;; we must split them all. :-( -(define_insn "*movtf_insn_sp32" - [(set (match_operand:TF 0 "general_operand" "=e,o,U,o,e,r,r,o") - (match_operand:TF 1 "input_operand" "o,e,o,U,e,r,o,r"))] - "TARGET_FPU - && ! TARGET_ARCH64 - && (register_operand (operands[0], TFmode) - || register_operand (operands[1], TFmode))" - "#" - [(set_attr "length" "4")]) - -;; Exactly the same as above, except that all `e' cases are deleted. -;; This is necessary to prevent reload from ever trying to use a `e' reg -;; when -mno-fpu. - -(define_insn "*movtf_no_e_insn_sp32" - [(set (match_operand:TF 0 "general_operand" "=U,o,r,r,o") - (match_operand:TF 1 "input_operand" "o,U,r,o,r"))] - "! TARGET_FPU - && ! TARGET_ARCH64 - && (register_operand (operands[0], TFmode) - || register_operand (operands[1], TFmode))" - "#" - [(set_attr "length" "4")]) - -;; Now handle the float reg cases directly when arch64, -;; hard_quad, and proper reg number alignment are all true. -(define_insn "*movtf_insn_hq_sp64" - [(set (match_operand:TF 0 "general_operand" "=e,e,m,r,r,o") - (match_operand:TF 1 "input_operand" "e,m,e,r,o,r"))] - "TARGET_FPU - && TARGET_ARCH64 - && TARGET_V9 - && TARGET_HARD_QUAD - && (register_operand (operands[0], TFmode) - || register_operand (operands[1], TFmode))" - "@ - fmovq\\t%1, %0 - ldq\\t%1, %0 - stq\\t%1, %0 - # - # - #" - [(set_attr "type" "fpmove,fpload,fpstore,*,*,*") - (set_attr "length" "1,1,1,2,2,2")]) - -;; Now we allow the integer register cases even when -;; only arch64 is true. -(define_insn "*movtf_insn_sp64" - [(set (match_operand:TF 0 "general_operand" "=e,o,r,o,e,r") - (match_operand:TF 1 "input_operand" "o,e,o,r,e,r"))] - "TARGET_FPU - && TARGET_ARCH64 - && ! TARGET_HARD_QUAD - && (register_operand (operands[0], TFmode) - || register_operand (operands[1], TFmode))" - "#" - [(set_attr "length" "2")]) - -(define_insn "*movtf_no_e_insn_sp64" - [(set (match_operand:TF 0 "general_operand" "=r,o,r") - (match_operand:TF 1 "input_operand" "o,r,r"))] - "! TARGET_FPU - && TARGET_ARCH64 - && (register_operand (operands[0], TFmode) - || register_operand (operands[1], TFmode))" - "#" - [(set_attr "length" "2")]) - -;; Now all the splits to handle multi-insn TF mode moves. -(define_split - [(set (match_operand:TF 0 "register_operand" "") - (match_operand:TF 1 "register_operand" ""))] - "reload_completed - && (! TARGET_ARCH64 - || (TARGET_FPU - && ! TARGET_HARD_QUAD))" - [(clobber (const_int 0))] - " -{ - rtx set_dest = operands[0]; - rtx set_src = operands[1]; - rtx dest1, dest2; - rtx src1, src2; - - if (GET_CODE (set_dest) == SUBREG) - set_dest = alter_subreg (set_dest); - if (GET_CODE (set_src) == SUBREG) - set_src = alter_subreg (set_src); - - /* Ugly, but gen_highpart will crap out here for 32-bit targets. */ - dest1 = gen_rtx_SUBREG (DFmode, set_dest, WORDS_BIG_ENDIAN == 0); - dest2 = gen_rtx_SUBREG (DFmode, set_dest, WORDS_BIG_ENDIAN != 0); - src1 = gen_rtx_SUBREG (DFmode, set_src, WORDS_BIG_ENDIAN == 0); - src2 = gen_rtx_SUBREG (DFmode, set_src, WORDS_BIG_ENDIAN != 0); - - /* Now emit using the real source and destination we found, swapping - the order if we detect overlap. */ - if (reg_overlap_mentioned_p (dest1, src2)) - { - emit_insn (gen_movdf (dest2, src2)); - emit_insn (gen_movdf (dest1, src1)); - } - else - { - emit_insn (gen_movdf (dest1, src1)); - emit_insn (gen_movdf (dest2, src2)); - } - DONE; -}") - -(define_split - [(set (match_operand:TF 0 "register_operand" "") - (match_operand:TF 1 "memory_operand" ""))] - "(reload_completed - && offsettable_memref_p (operands[1]))" - [(clobber (const_int 0))] - " -{ - rtx word0 = change_address (operands[1], DFmode, NULL_RTX); - rtx word1 = change_address (operands[1], DFmode, - plus_constant_for_output (XEXP (word0, 0), 8)); - rtx dest1, dest2; - - /* Ugly, but gen_highpart will crap out here for 32-bit targets. */ - dest1 = gen_rtx_SUBREG (DFmode, operands[0], WORDS_BIG_ENDIAN == 0); - dest2 = gen_rtx_SUBREG (DFmode, operands[0], WORDS_BIG_ENDIAN != 0); - - /* Now output, ordering such that we don't clobber any registers - mentioned in the address. */ - if (reg_overlap_mentioned_p (dest1, word1)) - - { - emit_insn (gen_movdf (dest2, word1)); - emit_insn (gen_movdf (dest1, word0)); - } - else - { - emit_insn (gen_movdf (dest1, word0)); - emit_insn (gen_movdf (dest2, word1)); - } - DONE; -}") - -(define_split - [(set (match_operand:TF 0 "memory_operand" "") - (match_operand:TF 1 "register_operand" ""))] - "(reload_completed - && offsettable_memref_p (operands[0]))" - [(clobber (const_int 0))] - " -{ - rtx word0 = change_address (operands[0], DFmode, NULL_RTX); - rtx word1 = change_address (operands[0], DFmode, - plus_constant_for_output (XEXP (word0, 0), 8)); - rtx src1, src2; - - /* Ugly, but gen_highpart will crap out here for 32-bit targets. */ - src1 = gen_rtx_SUBREG (DFmode, operands[1], WORDS_BIG_ENDIAN == 0); - src2 = gen_rtx_SUBREG (DFmode, operands[1], WORDS_BIG_ENDIAN != 0); - emit_insn (gen_movdf (word0, src1)); - emit_insn (gen_movdf (word1, src2)); - DONE; -}") - -;; Sparc V9 conditional move instructions. - -;; We can handle larger constants here for some flavors, but for now we keep -;; it simple and only allow those constants supported by all flavours. -;; Note that emit_conditional_move canonicalizes operands 2,3 so that operand -;; 3 contains the constant if one is present, but we handle either for -;; generality (sparc.c puts a constant in operand 2). - -(define_expand "movqicc" - [(set (match_operand:QI 0 "register_operand" "") - (if_then_else:QI (match_operand 1 "comparison_operator" "") - (match_operand:QI 2 "arith10_operand" "") - (match_operand:QI 3 "arith10_operand" "")))] - "TARGET_V9" - " -{ - enum rtx_code code = GET_CODE (operands[1]); - - if (GET_MODE (sparc_compare_op0) == DImode - && ! TARGET_ARCH64) - FAIL; - - if (sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode - && v9_regcmp_p (code)) - { - operands[1] = gen_rtx_fmt_ee (code, DImode, - sparc_compare_op0, sparc_compare_op1); - } - else - { - rtx cc_reg = gen_compare_reg (code, - sparc_compare_op0, sparc_compare_op1); - operands[1] = gen_rtx_fmt_ee (code, GET_MODE (cc_reg), cc_reg, const0_rtx); - } -}") - -(define_expand "movhicc" - [(set (match_operand:HI 0 "register_operand" "") - (if_then_else:HI (match_operand 1 "comparison_operator" "") - (match_operand:HI 2 "arith10_operand" "") - (match_operand:HI 3 "arith10_operand" "")))] - "TARGET_V9" - " -{ - enum rtx_code code = GET_CODE (operands[1]); - - if (GET_MODE (sparc_compare_op0) == DImode - && ! TARGET_ARCH64) - FAIL; - - if (sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode - && v9_regcmp_p (code)) - { - operands[1] = gen_rtx_fmt_ee (code, DImode, - sparc_compare_op0, sparc_compare_op1); - } - else - { - rtx cc_reg = gen_compare_reg (code, - sparc_compare_op0, sparc_compare_op1); - operands[1] = gen_rtx_fmt_ee (code, GET_MODE (cc_reg), cc_reg, const0_rtx); - } -}") - -(define_expand "movsicc" - [(set (match_operand:SI 0 "register_operand" "") - (if_then_else:SI (match_operand 1 "comparison_operator" "") - (match_operand:SI 2 "arith10_operand" "") - (match_operand:SI 3 "arith10_operand" "")))] - "TARGET_V9" - " -{ - enum rtx_code code = GET_CODE (operands[1]); - enum machine_mode op0_mode = GET_MODE (sparc_compare_op0); - - if (sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && (TARGET_ARCH64 && op0_mode == DImode && v9_regcmp_p (code))) - { - operands[1] = gen_rtx_fmt_ee (code, op0_mode, - sparc_compare_op0, sparc_compare_op1); - } - else - { - rtx cc_reg = gen_compare_reg (code, - sparc_compare_op0, sparc_compare_op1); - operands[1] = gen_rtx_fmt_ee (code, GET_MODE (cc_reg), - cc_reg, const0_rtx); - } -}") - -(define_expand "movdicc" - [(set (match_operand:DI 0 "register_operand" "") - (if_then_else:DI (match_operand 1 "comparison_operator" "") - (match_operand:DI 2 "arith10_double_operand" "") - (match_operand:DI 3 "arith10_double_operand" "")))] - "TARGET_ARCH64" - " -{ - enum rtx_code code = GET_CODE (operands[1]); - - if (sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode - && v9_regcmp_p (code)) - { - operands[1] = gen_rtx_fmt_ee (code, DImode, - sparc_compare_op0, sparc_compare_op1); - } - else - { - rtx cc_reg = gen_compare_reg (code, - sparc_compare_op0, sparc_compare_op1); - operands[1] = gen_rtx_fmt_ee (code, GET_MODE (cc_reg), - cc_reg, const0_rtx); - } -}") - -(define_expand "movsfcc" - [(set (match_operand:SF 0 "register_operand" "") - (if_then_else:SF (match_operand 1 "comparison_operator" "") - (match_operand:SF 2 "register_operand" "") - (match_operand:SF 3 "register_operand" "")))] - "TARGET_V9 && TARGET_FPU" - " -{ - enum rtx_code code = GET_CODE (operands[1]); - - if (GET_MODE (sparc_compare_op0) == DImode - && ! TARGET_ARCH64) - FAIL; - - if (sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode - && v9_regcmp_p (code)) - { - operands[1] = gen_rtx_fmt_ee (code, DImode, - sparc_compare_op0, sparc_compare_op1); - } - else - { - rtx cc_reg = gen_compare_reg (code, - sparc_compare_op0, sparc_compare_op1); - operands[1] = gen_rtx_fmt_ee (code, GET_MODE (cc_reg), cc_reg, const0_rtx); - } -}") - -(define_expand "movdfcc" - [(set (match_operand:DF 0 "register_operand" "") - (if_then_else:DF (match_operand 1 "comparison_operator" "") - (match_operand:DF 2 "register_operand" "") - (match_operand:DF 3 "register_operand" "")))] - "TARGET_V9 && TARGET_FPU" - " -{ - enum rtx_code code = GET_CODE (operands[1]); - - if (GET_MODE (sparc_compare_op0) == DImode - && ! TARGET_ARCH64) - FAIL; - - if (sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode - && v9_regcmp_p (code)) - { - operands[1] = gen_rtx_fmt_ee (code, DImode, - sparc_compare_op0, sparc_compare_op1); - } - else - { - rtx cc_reg = gen_compare_reg (code, - sparc_compare_op0, sparc_compare_op1); - operands[1] = gen_rtx_fmt_ee (code, GET_MODE (cc_reg), cc_reg, const0_rtx); - } -}") - -(define_expand "movtfcc" - [(set (match_operand:TF 0 "register_operand" "") - (if_then_else:TF (match_operand 1 "comparison_operator" "") - (match_operand:TF 2 "register_operand" "") - (match_operand:TF 3 "register_operand" "")))] - "TARGET_V9 && TARGET_FPU" - " -{ - enum rtx_code code = GET_CODE (operands[1]); - - if (GET_MODE (sparc_compare_op0) == DImode - && ! TARGET_ARCH64) - FAIL; - - if (sparc_compare_op1 == const0_rtx - && GET_CODE (sparc_compare_op0) == REG - && GET_MODE (sparc_compare_op0) == DImode - && v9_regcmp_p (code)) - { - operands[1] = gen_rtx_fmt_ee (code, DImode, - sparc_compare_op0, sparc_compare_op1); - } - else - { - rtx cc_reg = gen_compare_reg (code, - sparc_compare_op0, sparc_compare_op1); - operands[1] = gen_rtx_fmt_ee (code, GET_MODE (cc_reg), cc_reg, const0_rtx); - } -}") - -;; Conditional move define_insns. - -(define_insn "*movqi_cc_sp64" - [(set (match_operand:QI 0 "register_operand" "=r,r") - (if_then_else:QI (match_operator 1 "comparison_operator" - [(match_operand 2 "icc_or_fcc_reg_operand" "X,X") - (const_int 0)]) - (match_operand:QI 3 "arith11_operand" "rL,0") - (match_operand:QI 4 "arith11_operand" "0,rL")))] - "TARGET_V9" - "@ - mov%C1\\t%x2, %3, %0 - mov%c1\\t%x2, %4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -(define_insn "*movhi_cc_sp64" - [(set (match_operand:HI 0 "register_operand" "=r,r") - (if_then_else:HI (match_operator 1 "comparison_operator" - [(match_operand 2 "icc_or_fcc_reg_operand" "X,X") - (const_int 0)]) - (match_operand:HI 3 "arith11_operand" "rL,0") - (match_operand:HI 4 "arith11_operand" "0,rL")))] - "TARGET_V9" - "@ - mov%C1\\t%x2, %3, %0 - mov%c1\\t%x2, %4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -(define_insn "*movsi_cc_sp64" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (if_then_else:SI (match_operator 1 "comparison_operator" - [(match_operand 2 "icc_or_fcc_reg_operand" "X,X") - (const_int 0)]) - (match_operand:SI 3 "arith11_operand" "rL,0") - (match_operand:SI 4 "arith11_operand" "0,rL")))] - "TARGET_V9" - "@ - mov%C1\\t%x2, %3, %0 - mov%c1\\t%x2, %4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -;; ??? The constraints of operands 3,4 need work. -(define_insn "*movdi_cc_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (if_then_else:DI (match_operator 1 "comparison_operator" - [(match_operand 2 "icc_or_fcc_reg_operand" "X,X") - (const_int 0)]) - (match_operand:DI 3 "arith11_double_operand" "rLH,0") - (match_operand:DI 4 "arith11_double_operand" "0,rLH")))] - "TARGET_ARCH64" - "@ - mov%C1\\t%x2, %3, %0 - mov%c1\\t%x2, %4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -(define_insn "*movdi_cc_sp64_trunc" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (if_then_else:SI (match_operator 1 "comparison_operator" - [(match_operand 2 "icc_or_fcc_reg_operand" "X,X") - (const_int 0)]) - (match_operand:SI 3 "arith11_double_operand" "rLH,0") - (match_operand:SI 4 "arith11_double_operand" "0,rLH")))] - "TARGET_ARCH64" - "@ - mov%C1\\t%x2, %3, %0 - mov%c1\\t%x2, %4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -(define_insn "*movsf_cc_sp64" - [(set (match_operand:SF 0 "register_operand" "=f,f") - (if_then_else:SF (match_operator 1 "comparison_operator" - [(match_operand 2 "icc_or_fcc_reg_operand" "X,X") - (const_int 0)]) - (match_operand:SF 3 "register_operand" "f,0") - (match_operand:SF 4 "register_operand" "0,f")))] - "TARGET_V9 && TARGET_FPU" - "@ - fmovs%C1\\t%x2, %3, %0 - fmovs%c1\\t%x2, %4, %0" - [(set_attr "type" "fpcmove") - (set_attr "length" "1")]) - -(define_insn "*movdf_cc_sp64" - [(set (match_operand:DF 0 "register_operand" "=e,e") - (if_then_else:DF (match_operator 1 "comparison_operator" - [(match_operand 2 "icc_or_fcc_reg_operand" "X,X") - (const_int 0)]) - (match_operand:DF 3 "register_operand" "e,0") - (match_operand:DF 4 "register_operand" "0,e")))] - "TARGET_V9 && TARGET_FPU" - "@ - fmovd%C1\\t%x2, %3, %0 - fmovd%c1\\t%x2, %4, %0" - [(set_attr "type" "fpcmove") - (set_attr "length" "1")]) - -(define_insn "*movtf_cc_sp64" - [(set (match_operand:TF 0 "register_operand" "=e,e") - (if_then_else:TF (match_operator 1 "comparison_operator" - [(match_operand 2 "icc_or_fcc_reg_operand" "X,X") - (const_int 0)]) - (match_operand:TF 3 "register_operand" "e,0") - (match_operand:TF 4 "register_operand" "0,e")))] - "TARGET_V9 && TARGET_FPU && TARGET_HARD_QUAD" - "@ - fmovq%C1\\t%x2, %3, %0 - fmovq%c1\\t%x2, %4, %0" - [(set_attr "type" "fpcmove") - (set_attr "length" "1")]) - -(define_insn "*movqi_cc_reg_sp64" - [(set (match_operand:QI 0 "register_operand" "=r,r") - (if_then_else:QI (match_operator 1 "v9_regcmp_op" - [(match_operand:DI 2 "register_operand" "r,r") - (const_int 0)]) - (match_operand:QI 3 "arith10_operand" "rM,0") - (match_operand:QI 4 "arith10_operand" "0,rM")))] - "TARGET_ARCH64" - "@ - movr%D1\\t%2, %r3, %0 - movr%d1\\t%2, %r4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -(define_insn "*movhi_cc_reg_sp64" - [(set (match_operand:HI 0 "register_operand" "=r,r") - (if_then_else:HI (match_operator 1 "v9_regcmp_op" - [(match_operand:DI 2 "register_operand" "r,r") - (const_int 0)]) - (match_operand:HI 3 "arith10_operand" "rM,0") - (match_operand:HI 4 "arith10_operand" "0,rM")))] - "TARGET_ARCH64" - "@ - movr%D1\\t%2, %r3, %0 - movr%d1\\t%2, %r4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -(define_insn "*movsi_cc_reg_sp64" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (if_then_else:SI (match_operator 1 "v9_regcmp_op" - [(match_operand:DI 2 "register_operand" "r,r") - (const_int 0)]) - (match_operand:SI 3 "arith10_operand" "rM,0") - (match_operand:SI 4 "arith10_operand" "0,rM")))] - "TARGET_ARCH64" - "@ - movr%D1\\t%2, %r3, %0 - movr%d1\\t%2, %r4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -;; ??? The constraints of operands 3,4 need work. -(define_insn "*movdi_cc_reg_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (if_then_else:DI (match_operator 1 "v9_regcmp_op" - [(match_operand:DI 2 "register_operand" "r,r") - (const_int 0)]) - (match_operand:DI 3 "arith10_double_operand" "rMH,0") - (match_operand:DI 4 "arith10_double_operand" "0,rMH")))] - "TARGET_ARCH64" - "@ - movr%D1\\t%2, %r3, %0 - movr%d1\\t%2, %r4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -(define_insn "*movdi_cc_reg_sp64_trunc" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (if_then_else:SI (match_operator 1 "v9_regcmp_op" - [(match_operand:DI 2 "register_operand" "r,r") - (const_int 0)]) - (match_operand:SI 3 "arith10_double_operand" "rMH,0") - (match_operand:SI 4 "arith10_double_operand" "0,rMH")))] - "TARGET_ARCH64" - "@ - movr%D1\\t%2, %r3, %0 - movr%d1\\t%2, %r4, %0" - [(set_attr "type" "cmove") - (set_attr "length" "1")]) - -(define_insn "*movsf_cc_reg_sp64" - [(set (match_operand:SF 0 "register_operand" "=f,f") - (if_then_else:SF (match_operator 1 "v9_regcmp_op" - [(match_operand:DI 2 "register_operand" "r,r") - (const_int 0)]) - (match_operand:SF 3 "register_operand" "f,0") - (match_operand:SF 4 "register_operand" "0,f")))] - "TARGET_ARCH64 && TARGET_FPU" - "@ - fmovrs%D1\\t%2, %3, %0 - fmovrs%d1\\t%2, %4, %0" - [(set_attr "type" "fpcmove") - (set_attr "length" "1")]) - -(define_insn "*movdf_cc_reg_sp64" - [(set (match_operand:DF 0 "register_operand" "=e,e") - (if_then_else:DF (match_operator 1 "v9_regcmp_op" - [(match_operand:DI 2 "register_operand" "r,r") - (const_int 0)]) - (match_operand:DF 3 "register_operand" "e,0") - (match_operand:DF 4 "register_operand" "0,e")))] - "TARGET_ARCH64 && TARGET_FPU" - "@ - fmovrd%D1\\t%2, %3, %0 - fmovrd%d1\\t%2, %4, %0" - [(set_attr "type" "fpcmove") - (set_attr "length" "1")]) - -(define_insn "*movtf_cc_reg_sp64" - [(set (match_operand:TF 0 "register_operand" "=e,e") - (if_then_else:TF (match_operator 1 "v9_regcmp_op" - [(match_operand:DI 2 "register_operand" "r,r") - (const_int 0)]) - (match_operand:TF 3 "register_operand" "e,0") - (match_operand:TF 4 "register_operand" "0,e")))] - "TARGET_ARCH64 && TARGET_FPU" - "@ - fmovrq%D1\\t%2, %3, %0 - fmovrq%d1\\t%2, %4, %0" - [(set_attr "type" "fpcmove") - (set_attr "length" "1")]) - -;;- zero extension instructions - -;; These patterns originally accepted general_operands, however, slightly -;; better code is generated by only accepting register_operands, and then -;; letting combine generate the ldu[hb] insns. - -(define_expand "zero_extendhisi2" - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:HI 1 "register_operand" "")))] - "" - " -{ - rtx temp = gen_reg_rtx (SImode); - rtx shift_16 = GEN_INT (16); - int op1_subword = 0; - - if (GET_CODE (operand1) == SUBREG) - { - op1_subword = SUBREG_WORD (operand1); - operand1 = XEXP (operand1, 0); - } - - emit_insn (gen_ashlsi3 (temp, gen_rtx_SUBREG (SImode, operand1, - op1_subword), - shift_16)); - emit_insn (gen_lshrsi3 (operand0, temp, shift_16)); - DONE; -}") - -(define_insn "*zero_extendhisi2_insn" - [(set (match_operand:SI 0 "register_operand" "=r") - (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))] - "" - "lduh\\t%1, %0" - [(set_attr "type" "load") - (set_attr "length" "1")]) - -(define_expand "zero_extendqihi2" - [(set (match_operand:HI 0 "register_operand" "") - (zero_extend:HI (match_operand:QI 1 "register_operand" "")))] - "" - "") - -(define_insn "*zero_extendqihi2_insn" - [(set (match_operand:HI 0 "register_operand" "=r,r") - (zero_extend:HI (match_operand:QI 1 "input_operand" "r,m")))] - "GET_CODE (operands[1]) != CONST_INT" - "@ - and\\t%1, 0xff, %0 - ldub\\t%1, %0" - [(set_attr "type" "unary,load") - (set_attr "length" "1")]) - -(define_expand "zero_extendqisi2" - [(set (match_operand:SI 0 "register_operand" "") - (zero_extend:SI (match_operand:QI 1 "register_operand" "")))] - "" - "") - -(define_insn "*zero_extendqisi2_insn" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (zero_extend:SI (match_operand:QI 1 "input_operand" "r,m")))] - "GET_CODE (operands[1]) != CONST_INT" - "@ - and\\t%1, 0xff, %0 - ldub\\t%1, %0" - [(set_attr "type" "unary,load") - (set_attr "length" "1")]) - -(define_expand "zero_extendqidi2" - [(set (match_operand:DI 0 "register_operand" "") - (zero_extend:DI (match_operand:QI 1 "register_operand" "")))] - "TARGET_ARCH64" - "") - -(define_insn "*zero_extendqidi2_insn" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (zero_extend:DI (match_operand:QI 1 "input_operand" "r,m")))] - "TARGET_ARCH64 && GET_CODE (operands[1]) != CONST_INT" - "@ - and\\t%1, 0xff, %0 - ldub\\t%1, %0" - [(set_attr "type" "unary,load") - (set_attr "length" "1")]) - -(define_expand "zero_extendhidi2" - [(set (match_operand:DI 0 "register_operand" "") - (zero_extend:DI (match_operand:HI 1 "register_operand" "")))] - "TARGET_ARCH64" - " -{ - rtx temp = gen_reg_rtx (DImode); - rtx shift_48 = GEN_INT (48); - int op1_subword = 0; - - if (GET_CODE (operand1) == SUBREG) - { - op1_subword = SUBREG_WORD (operand1); - operand1 = XEXP (operand1, 0); - } - - emit_insn (gen_ashldi3 (temp, gen_rtx_SUBREG (DImode, operand1, - op1_subword), - shift_48)); - emit_insn (gen_lshrdi3 (operand0, temp, shift_48)); - DONE; -}") - -(define_insn "*zero_extendhidi2_insn" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))] - "TARGET_ARCH64" - "lduh\\t%1, %0" - [(set_attr "type" "load") - (set_attr "length" "1")]) - - -;; ??? Write truncdisi pattern using sra? - -(define_expand "zero_extendsidi2" - [(set (match_operand:DI 0 "register_operand" "") - (zero_extend:DI (match_operand:SI 1 "register_operand" "")))] - "" - "") - -(define_insn "*zero_extendsidi2_insn_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (zero_extend:DI (match_operand:SI 1 "input_operand" "r,m")))] - "TARGET_ARCH64 && GET_CODE (operands[1]) != CONST_INT" - "@ - srl\\t%1, 0, %0 - lduw\\t%1, %0" - [(set_attr "type" "shift,load") - (set_attr "length" "1")]) - -(define_insn "*zero_extendsidi2_insn_sp32" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))] - "! TARGET_ARCH64" - "#" - [(set_attr "type" "unary") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (zero_extend:DI (match_operand:SI 1 "register_operand" "")))] - "! TARGET_ARCH64 && reload_completed" - [(set (match_dup 2) (match_dup 3)) - (set (match_dup 4) (match_dup 5))] - " -{ - rtx dest1, dest2; - - if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - - dest1 = gen_highpart (SImode, operands[0]); - dest2 = gen_lowpart (SImode, operands[0]); - - /* Swap the order in case of overlap. */ - if (REGNO (dest1) == REGNO (operands[1])) - { - operands[2] = dest2; - operands[3] = operands[1]; - operands[4] = dest1; - operands[5] = const0_rtx; - } - else - { - operands[2] = dest1; - operands[3] = const0_rtx; - operands[4] = dest2; - operands[5] = operands[1]; - } -}") - -;; Simplify comparisons of extended values. - -(define_insn "*cmp_zero_extendqisi2" - [(set (reg:CC 100) - (compare:CC (zero_extend:SI (match_operand:QI 0 "register_operand" "r")) - (const_int 0)))] - "! TARGET_LIVE_G0" - "andcc\\t%0, 0xff, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_zero_extendqisi2_set" - [(set (reg:CC 100) - (compare:CC (zero_extend:SI (match_operand:QI 1 "register_operand" "r")) - (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (zero_extend:SI (match_dup 1)))] - "" - "andcc\\t%1, 0xff, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_zero_extendqidi2" - [(set (reg:CCX 100) - (compare:CCX (zero_extend:DI (match_operand:QI 0 "register_operand" "r")) - (const_int 0)))] - "TARGET_ARCH64" - "andcc\\t%0, 0xff, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_zero_extendqidi2_set" - [(set (reg:CCX 100) - (compare:CCX (zero_extend:DI (match_operand:QI 1 "register_operand" "r")) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (match_dup 1)))] - "TARGET_ARCH64" - "andcc\\t%1, 0xff, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -;; Similarly, handle {SI,DI}->QI mode truncation followed by a compare. - -(define_insn "*cmp_siqi_trunc" - [(set (reg:CC 100) - (compare:CC (subreg:QI (match_operand:SI 0 "register_operand" "r") 0) - (const_int 0)))] - "! TARGET_LIVE_G0" - "andcc\\t%0, 0xff, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_siqi_trunc_set" - [(set (reg:CC 100) - (compare:CC (subreg:QI (match_operand:SI 1 "register_operand" "r") 0) - (const_int 0))) - (set (match_operand:QI 0 "register_operand" "=r") - (subreg:QI (match_dup 1) 0))] - "" - "andcc\\t%1, 0xff, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_diqi_trunc" - [(set (reg:CC 100) - (compare:CC (subreg:QI (match_operand:DI 0 "register_operand" "r") 0) - (const_int 0)))] - "TARGET_ARCH64" - "andcc\\t%0, 0xff, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_diqi_trunc_set" - [(set (reg:CC 100) - (compare:CC (subreg:QI (match_operand:DI 1 "register_operand" "r") 0) - (const_int 0))) - (set (match_operand:QI 0 "register_operand" "=r") - (subreg:QI (match_dup 1) 0))] - "TARGET_ARCH64" - "andcc\\t%1, 0xff, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -;;- sign extension instructions - -;; These patterns originally accepted general_operands, however, slightly -;; better code is generated by only accepting register_operands, and then -;; letting combine generate the lds[hb] insns. - -(define_expand "extendhisi2" - [(set (match_operand:SI 0 "register_operand" "") - (sign_extend:SI (match_operand:HI 1 "register_operand" "")))] - "" - " -{ - rtx temp = gen_reg_rtx (SImode); - rtx shift_16 = GEN_INT (16); - int op1_subword = 0; - - if (GET_CODE (operand1) == SUBREG) - { - op1_subword = SUBREG_WORD (operand1); - operand1 = XEXP (operand1, 0); - } - - emit_insn (gen_ashlsi3 (temp, gen_rtx_SUBREG (SImode, operand1, - op1_subword), - shift_16)); - emit_insn (gen_ashrsi3 (operand0, temp, shift_16)); - DONE; -}") - -(define_insn "*sign_extendhisi2_insn" - [(set (match_operand:SI 0 "register_operand" "=r") - (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))] - "" - "ldsh\\t%1, %0" - [(set_attr "type" "sload") - (set_attr "length" "1")]) - -(define_expand "extendqihi2" - [(set (match_operand:HI 0 "register_operand" "") - (sign_extend:HI (match_operand:QI 1 "register_operand" "")))] - "" - " -{ - rtx temp = gen_reg_rtx (SImode); - rtx shift_24 = GEN_INT (24); - int op1_subword = 0; - int op0_subword = 0; - - if (GET_CODE (operand1) == SUBREG) - { - op1_subword = SUBREG_WORD (operand1); - operand1 = XEXP (operand1, 0); - } - if (GET_CODE (operand0) == SUBREG) - { - op0_subword = SUBREG_WORD (operand0); - operand0 = XEXP (operand0, 0); - } - emit_insn (gen_ashlsi3 (temp, gen_rtx_SUBREG (SImode, operand1, - op1_subword), - shift_24)); - if (GET_MODE (operand0) != SImode) - operand0 = gen_rtx_SUBREG (SImode, operand0, op0_subword); - emit_insn (gen_ashrsi3 (operand0, temp, shift_24)); - DONE; -}") - -(define_insn "*sign_extendqihi2_insn" - [(set (match_operand:HI 0 "register_operand" "=r") - (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))] - "" - "ldsb\\t%1, %0" - [(set_attr "type" "sload") - (set_attr "length" "1")]) - -(define_expand "extendqisi2" - [(set (match_operand:SI 0 "register_operand" "") - (sign_extend:SI (match_operand:QI 1 "register_operand" "")))] - "" - " -{ - rtx temp = gen_reg_rtx (SImode); - rtx shift_24 = GEN_INT (24); - int op1_subword = 0; - - if (GET_CODE (operand1) == SUBREG) - { - op1_subword = SUBREG_WORD (operand1); - operand1 = XEXP (operand1, 0); - } - - emit_insn (gen_ashlsi3 (temp, gen_rtx_SUBREG (SImode, operand1, - op1_subword), - shift_24)); - emit_insn (gen_ashrsi3 (operand0, temp, shift_24)); - DONE; -}") - -(define_insn "*sign_extendqisi2_insn" - [(set (match_operand:SI 0 "register_operand" "=r") - (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))] - "" - "ldsb\\t%1, %0" - [(set_attr "type" "sload") - (set_attr "length" "1")]) - -(define_expand "extendqidi2" - [(set (match_operand:DI 0 "register_operand" "") - (sign_extend:DI (match_operand:QI 1 "register_operand" "")))] - "TARGET_ARCH64" - " -{ - rtx temp = gen_reg_rtx (DImode); - rtx shift_56 = GEN_INT (56); - int op1_subword = 0; - - if (GET_CODE (operand1) == SUBREG) - { - op1_subword = SUBREG_WORD (operand1); - operand1 = XEXP (operand1, 0); - } - - emit_insn (gen_ashldi3 (temp, gen_rtx_SUBREG (DImode, operand1, - op1_subword), - shift_56)); - emit_insn (gen_ashrdi3 (operand0, temp, shift_56)); - DONE; -}") - -(define_insn "*sign_extendqidi2_insn" - [(set (match_operand:DI 0 "register_operand" "=r") - (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))] - "TARGET_ARCH64" - "ldsb\\t%1, %0" - [(set_attr "type" "sload") - (set_attr "length" "1")]) - -(define_expand "extendhidi2" - [(set (match_operand:DI 0 "register_operand" "") - (sign_extend:DI (match_operand:HI 1 "register_operand" "")))] - "TARGET_ARCH64" - " -{ - rtx temp = gen_reg_rtx (DImode); - rtx shift_48 = GEN_INT (48); - int op1_subword = 0; - - if (GET_CODE (operand1) == SUBREG) - { - op1_subword = SUBREG_WORD (operand1); - operand1 = XEXP (operand1, 0); - } - - emit_insn (gen_ashldi3 (temp, gen_rtx_SUBREG (DImode, operand1, - op1_subword), - shift_48)); - emit_insn (gen_ashrdi3 (operand0, temp, shift_48)); - DONE; -}") - -(define_insn "*sign_extendhidi2_insn" - [(set (match_operand:DI 0 "register_operand" "=r") - (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))] - "TARGET_ARCH64" - "ldsh\\t%1, %0" - [(set_attr "type" "sload") - (set_attr "length" "1")]) - -(define_expand "extendsidi2" - [(set (match_operand:DI 0 "register_operand" "") - (sign_extend:DI (match_operand:SI 1 "register_operand" "")))] - "TARGET_ARCH64" - "") - -(define_insn "*sign_extendsidi2_insn" - [(set (match_operand:DI 0 "register_operand" "=r,r") - (sign_extend:DI (match_operand:SI 1 "input_operand" "r,m")))] - "TARGET_ARCH64" - "@ - sra\\t%1, 0, %0 - ldsw\\t%1, %0" - [(set_attr "type" "shift,sload") - (set_attr "length" "1")]) - -;; Special pattern for optimizing bit-field compares. This is needed -;; because combine uses this as a canonical form. - -(define_insn "*cmp_zero_extract" - [(set (reg:CC 100) - (compare:CC - (zero_extract:SI (match_operand:SI 0 "register_operand" "r") - (match_operand:SI 1 "small_int_or_double" "n") - (match_operand:SI 2 "small_int_or_double" "n")) - (const_int 0)))] - "! TARGET_LIVE_G0 - && ((GET_CODE (operands[2]) == CONST_INT - && INTVAL (operands[2]) > 19) - || (GET_CODE (operands[2]) == CONST_DOUBLE - && CONST_DOUBLE_LOW (operands[2]) > 19))" - "* -{ - int len = (GET_CODE (operands[1]) == CONST_INT - ? INTVAL (operands[1]) - : CONST_DOUBLE_LOW (operands[1])); - int pos = 32 - - (GET_CODE (operands[2]) == CONST_INT - ? INTVAL (operands[2]) - : CONST_DOUBLE_LOW (operands[2])) - len; - HOST_WIDE_INT mask = ((1 << len) - 1) << pos; - - operands[1] = GEN_INT (mask); - return \"andcc\\t%0, %1, %%g0\"; -}" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_zero_extract_sp64" - [(set (reg:CCX 100) - (compare:CCX - (zero_extract:DI (match_operand:DI 0 "register_operand" "r") - (match_operand:SI 1 "small_int_or_double" "n") - (match_operand:SI 2 "small_int_or_double" "n")) - (const_int 0)))] - "TARGET_ARCH64 - && ((GET_CODE (operands[2]) == CONST_INT - && INTVAL (operands[2]) > 51) - || (GET_CODE (operands[2]) == CONST_DOUBLE - && CONST_DOUBLE_LOW (operands[2]) > 51))" - "* -{ - int len = (GET_CODE (operands[1]) == CONST_INT - ? INTVAL (operands[1]) - : CONST_DOUBLE_LOW (operands[1])); - int pos = 64 - - (GET_CODE (operands[2]) == CONST_INT - ? INTVAL (operands[2]) - : CONST_DOUBLE_LOW (operands[2])) - len; - HOST_WIDE_INT mask = (((unsigned HOST_WIDE_INT) 1 << len) - 1) << pos; - - operands[1] = GEN_INT (mask); - return \"andcc\\t%0, %1, %%g0\"; -}" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -;; Conversions between float, double and long double. - -(define_insn "extendsfdf2" - [(set (match_operand:DF 0 "register_operand" "=e") - (float_extend:DF - (match_operand:SF 1 "register_operand" "f")))] - "TARGET_FPU" - "fstod\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "extendsftf2" - [(set (match_operand:TF 0 "register_operand" "=e") - (float_extend:TF - (match_operand:SF 1 "register_operand" "f")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fstoq\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "extenddftf2" - [(set (match_operand:TF 0 "register_operand" "=e") - (float_extend:TF - (match_operand:DF 1 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fdtoq\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "truncdfsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (float_truncate:SF - (match_operand:DF 1 "register_operand" "e")))] - "TARGET_FPU" - "fdtos\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "trunctfsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (float_truncate:SF - (match_operand:TF 1 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fqtos\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "trunctfdf2" - [(set (match_operand:DF 0 "register_operand" "=e") - (float_truncate:DF - (match_operand:TF 1 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fqtod\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -;; Conversion between fixed point and floating point. - -(define_insn "floatsisf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (float:SF (match_operand:SI 1 "register_operand" "f")))] - "TARGET_FPU" - "fitos\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "floatsidf2" - [(set (match_operand:DF 0 "register_operand" "=e") - (float:DF (match_operand:SI 1 "register_operand" "f")))] - "TARGET_FPU" - "fitod\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "floatsitf2" - [(set (match_operand:TF 0 "register_operand" "=e") - (float:TF (match_operand:SI 1 "register_operand" "f")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fitoq\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -;; Now the same for 64 bit sources. - -(define_insn "floatdisf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (float:SF (match_operand:DI 1 "register_operand" "e")))] - "TARGET_V9 && TARGET_FPU" - "fxtos\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "floatdidf2" - [(set (match_operand:DF 0 "register_operand" "=e") - (float:DF (match_operand:DI 1 "register_operand" "e")))] - "TARGET_V9 && TARGET_FPU" - "fxtod\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "floatditf2" - [(set (match_operand:TF 0 "register_operand" "=e") - (float:TF (match_operand:DI 1 "register_operand" "e")))] - "TARGET_V9 && TARGET_FPU && TARGET_HARD_QUAD" - "fxtoq\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -;; Convert a float to an actual integer. -;; Truncation is performed as part of the conversion. - -(define_insn "fix_truncsfsi2" - [(set (match_operand:SI 0 "register_operand" "=f") - (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))] - "TARGET_FPU" - "fstoi\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "fix_truncdfsi2" - [(set (match_operand:SI 0 "register_operand" "=f") - (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "e"))))] - "TARGET_FPU" - "fdtoi\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "fix_trunctfsi2" - [(set (match_operand:SI 0 "register_operand" "=f") - (fix:SI (fix:TF (match_operand:TF 1 "register_operand" "e"))))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fqtoi\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -;; Now the same, for V9 targets - -(define_insn "fix_truncsfdi2" - [(set (match_operand:DI 0 "register_operand" "=e") - (fix:DI (fix:SF (match_operand:SF 1 "register_operand" "f"))))] - "TARGET_V9 && TARGET_FPU" - "fstox\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "fix_truncdfdi2" - [(set (match_operand:DI 0 "register_operand" "=e") - (fix:DI (fix:DF (match_operand:DF 1 "register_operand" "e"))))] - "TARGET_V9 && TARGET_FPU" - "fdtox\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "fix_trunctfdi2" - [(set (match_operand:DI 0 "register_operand" "=e") - (fix:DI (fix:TF (match_operand:TF 1 "register_operand" "e"))))] - "TARGET_V9 && TARGET_FPU && TARGET_HARD_QUAD" - "fqtox\\t%1, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -;;- arithmetic instructions - -(define_expand "adddi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (match_operand:DI 1 "arith_double_operand" "%r") - (match_operand:DI 2 "arith_double_add_operand" "rHI")))] - "" - " -{ - if (! TARGET_ARCH64) - { - emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, - gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_PLUS (DImode, operands[1], - operands[2])), - gen_rtx_CLOBBER (VOIDmode, - gen_rtx_REG (CCmode, SPARC_ICC_REG))))); - DONE; - } - if (arith_double_4096_operand(operands[2], DImode)) - { - emit_insn (gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_MINUS (DImode, operands[1], - GEN_INT(-4096)))); - DONE; - } -}") - -(define_insn "adddi3_insn_sp32" - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (match_operand:DI 1 "arith_double_operand" "%r") - (match_operand:DI 2 "arith_double_operand" "rHI"))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (match_operand:DI 1 "arith_double_operand" "%r") - (match_operand:DI 2 "arith_double_operand" "rHI"))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64 && reload_completed" - [(parallel [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (plus:SI (match_dup 4) - (match_dup 5)) - (const_int 0))) - (set (match_dup 3) - (plus:SI (match_dup 4) (match_dup 5)))]) - (set (match_dup 6) - (plus:SI (plus:SI (match_dup 7) - (match_dup 8)) - (ltu:SI (reg:CC_NOOV 100) (const_int 0))))] - " -{ - operands[3] = gen_lowpart (SImode, operands[0]); - operands[4] = gen_lowpart (SImode, operands[1]); - operands[5] = gen_lowpart (SImode, operands[2]); - operands[6] = gen_highpart (SImode, operands[0]); - operands[7] = gen_highpart (SImode, operands[1]); - if (GET_CODE (operands[2]) == CONST_INT) - { - if (INTVAL (operands[2]) < 0) - operands[8] = constm1_rtx; - else - operands[8] = const0_rtx; - } - else - operands[8] = gen_highpart (SImode, operands[2]); -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (match_operand:DI 1 "arith_double_operand" "r") - (match_operand:DI 2 "arith_double_operand" "rHI"))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64 && reload_completed" - [(parallel [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (minus:SI (match_dup 4) - (match_dup 5)) - (const_int 0))) - (set (match_dup 3) - (minus:SI (match_dup 4) (match_dup 5)))]) - (set (match_dup 6) - (minus:SI (minus:SI (match_dup 7) - (match_dup 8)) - (ltu:SI (reg:CC_NOOV 100) (const_int 0))))] - " -{ - operands[3] = gen_lowpart (SImode, operands[0]); - operands[4] = gen_lowpart (SImode, operands[1]); - operands[5] = gen_lowpart (SImode, operands[2]); - operands[6] = gen_highpart (SImode, operands[0]); - operands[7] = gen_highpart (SImode, operands[1]); - if (GET_CODE (operands[2]) == CONST_INT) - { - if (INTVAL (operands[2]) < 0) - operands[8] = constm1_rtx; - else - operands[8] = const0_rtx; - } - else - operands[8] = gen_highpart (SImode, operands[2]); -}") - -;; LTU here means "carry set" -(define_insn "addx" - [(set (match_operand:SI 0 "register_operand" "=r") - (plus:SI (plus:SI (match_operand:SI 1 "arith_operand" "%r") - (match_operand:SI 2 "arith_operand" "rI")) - (ltu:SI (reg:CC_NOOV 100) (const_int 0))))] - "" - "addx\\t%1, %2, %0" - [(set_attr "type" "unary") - (set_attr "length" "1")]) - -(define_insn "*addx_extend_sp32" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (plus:SI (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ") - (match_operand:SI 2 "arith_operand" "rI")) - (ltu:SI (reg:CC_NOOV 100) (const_int 0)))))] - "! TARGET_ARCH64" - "#" - [(set_attr "type" "unary") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (zero_extend:DI (plus:SI (plus:SI (match_operand:SI 1 "reg_or_0_operand" "") - (match_operand:SI 2 "arith_operand" "")) - (ltu:SI (reg:CC_NOOV 100) (const_int 0)))))] - "! TARGET_ARCH64 && reload_completed" - [(set (match_dup 3) (plus:SI (plus:SI (match_dup 1) (match_dup 2)) - (ltu:SI (reg:CC_NOOV 100) (const_int 0)))) - (set (match_dup 4) (const_int 0))] - "operands[3] = gen_lowpart (SImode, operands[0]); - operands[4] = gen_highpart (SImode, operands[1]);") - -(define_insn "*addx_extend_sp64" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (plus:SI (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ") - (match_operand:SI 2 "arith_operand" "rI")) - (ltu:SI (reg:CC_NOOV 100) (const_int 0)))))] - "TARGET_ARCH64" - "addx\\t%r1, %2, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "subx" - [(set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") - (match_operand:SI 2 "arith_operand" "rI")) - (ltu:SI (reg:CC_NOOV 100) (const_int 0))))] - "" - "subx\\t%r1, %2, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*subx_extend_sp64" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (minus:SI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") - (match_operand:SI 2 "arith_operand" "rI")) - (ltu:SI (reg:CC_NOOV 100) (const_int 0)))))] - "TARGET_ARCH64" - "subx\\t%r1, %2, %0" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "*subx_extend" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (minus:SI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") - (match_operand:SI 2 "arith_operand" "rI")) - (ltu:SI (reg:CC_NOOV 100) (const_int 0)))))] - "! TARGET_ARCH64" - "#" - [(set_attr "type" "unary") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (minus:SI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") - (match_operand:SI 2 "arith_operand" "rI")) - (ltu:SI (reg:CC_NOOV 100) (const_int 0)))))] - "! TARGET_ARCH64 && reload_completed" - [(set (match_dup 3) (minus:SI (minus:SI (match_dup 1) (match_dup 2)) - (ltu:SI (reg:CC_NOOV 100) (const_int 0)))) - (set (match_dup 4) (const_int 0))] - "operands[3] = gen_lowpart (SImode, operands[0]); - operands[4] = gen_highpart (SImode, operands[0]);") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) - (match_operand:DI 2 "register_operand" "r"))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64" - "#" - [(set_attr "type" "multi") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (plus:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "")) - (match_operand:DI 2 "register_operand" ""))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64 && reload_completed" - [(parallel [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (plus:SI (match_dup 3) (match_dup 1)) - (const_int 0))) - (set (match_dup 5) (plus:SI (match_dup 3) (match_dup 1)))]) - (set (match_dup 6) - (plus:SI (plus:SI (match_dup 4) (const_int 0)) - (ltu:SI (reg:CC_NOOV 100) (const_int 0))))] - "operands[3] = gen_lowpart (SImode, operands[2]); - operands[4] = gen_highpart (SImode, operands[2]); - operands[5] = gen_lowpart (SImode, operands[0]); - operands[6] = gen_highpart (SImode, operands[0]);") - -(define_insn "*adddi3_sp64" - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (match_operand:DI 1 "arith_double_operand" "%r") - (match_operand:DI 2 "arith_double_operand" "rHI")))] - "TARGET_ARCH64" - "add\\t%1, %2, %0" - [(set_attr "type" "binary") - (set_attr "length" "1")]) - -(define_expand "addsi3" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (plus:SI (match_operand:SI 1 "arith_operand" "%r,d") - (match_operand:SI 2 "arith_add_operand" "rI,d")))] - "" - " -{ - if (arith_4096_operand(operands[2], DImode)) - { - emit_insn (gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_MINUS (SImode, operands[1], - GEN_INT(-4096)))); - DONE; - } -}") - -(define_insn "*addsi3" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (plus:SI (match_operand:SI 1 "arith_operand" "%r,d") - (match_operand:SI 2 "arith_operand" "rI,d")))] - "" - "@ - add\\t%1, %2, %0 - fpadd32s\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_plus" - [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (plus:SI (match_operand:SI 0 "arith_operand" "%r") - (match_operand:SI 1 "arith_operand" "rI")) - (const_int 0)))] - "! TARGET_LIVE_G0" - "addcc\\t%0, %1, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_plus" - [(set (reg:CCX_NOOV 100) - (compare:CCX_NOOV (plus:DI (match_operand:DI 0 "arith_double_operand" "%r") - (match_operand:DI 1 "arith_double_operand" "rHI")) - (const_int 0)))] - "TARGET_ARCH64" - "addcc\\t%0, %1, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_plus_set" - [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (plus:SI (match_operand:SI 1 "arith_operand" "%r") - (match_operand:SI 2 "arith_operand" "rI")) - (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (plus:SI (match_dup 1) (match_dup 2)))] - "" - "addcc\\t%1, %2, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_plus_set" - [(set (reg:CCX_NOOV 100) - (compare:CCX_NOOV (plus:DI (match_operand:DI 1 "arith_double_operand" "%r") - (match_operand:DI 2 "arith_double_operand" "rHI")) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (match_dup 1) (match_dup 2)))] - "TARGET_ARCH64" - "addcc\\t%1, %2, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_expand "subdi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "arith_double_add_operand" "rHI")))] - "" - " -{ - if (! TARGET_ARCH64) - { - emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, - gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_MINUS (DImode, operands[1], - operands[2])), - gen_rtx_CLOBBER (VOIDmode, - gen_rtx_REG (CCmode, SPARC_ICC_REG))))); - DONE; - } - if (arith_double_4096_operand(operands[2], DImode)) - { - emit_insn (gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_PLUS (DImode, operands[1], - GEN_INT(-4096)))); - DONE; - } -}") - -(define_insn "*subdi3_sp32" - [(set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "arith_double_operand" "rHI"))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64" - "#" - [(set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (minus:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "arith_double_operand" ""))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64 - && reload_completed - && (GET_CODE (operands[2]) == CONST_INT - || GET_CODE (operands[2]) == CONST_DOUBLE)" - [(clobber (const_int 0))] - " -{ - rtx highp, lowp; - - highp = gen_highpart (SImode, operands[2]); - lowp = gen_lowpart (SImode, operands[2]); - if ((lowp == const0_rtx) - && (operands[0] == operands[1])) - { - emit_insn (gen_rtx_SET (VOIDmode, - gen_highpart (SImode, operands[0]), - gen_rtx_MINUS (SImode, - gen_highpart (SImode, operands[1]), - highp))); - } - else - { - emit_insn (gen_cmp_minus_cc_set (gen_lowpart (SImode, operands[0]), - gen_lowpart (SImode, operands[1]), - lowp)); - emit_insn (gen_subx (gen_highpart (SImode, operands[0]), - gen_highpart (SImode, operands[1]), - highp)); - } - DONE; -}") - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (minus:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "register_operand" ""))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64 - && reload_completed" - [(clobber (const_int 0))] - " -{ - emit_insn (gen_cmp_minus_cc_set (gen_lowpart (SImode, operands[0]), - gen_lowpart (SImode, operands[1]), - gen_lowpart (SImode, operands[2]))); - emit_insn (gen_subx (gen_highpart (SImode, operands[0]), - gen_highpart (SImode, operands[1]), - gen_highpart (SImode, operands[2]))); - DONE; -}") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (match_operand:DI 1 "register_operand" "r") - (zero_extend:DI (match_operand:SI 2 "register_operand" "r")))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64" - "#" - [(set_attr "type" "multi") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (minus:DI (match_operand:DI 1 "register_operand" "") - (zero_extend:DI (match_operand:SI 2 "register_operand" "")))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64 && reload_completed" - [(parallel [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (minus:SI (match_dup 3) (match_dup 2)) - (const_int 0))) - (set (match_dup 5) (minus:SI (match_dup 3) (match_dup 2)))]) - (set (match_dup 6) - (minus:SI (minus:SI (match_dup 4) (const_int 0)) - (ltu:SI (reg:CC_NOOV 100) (const_int 0))))] - "operands[3] = gen_lowpart (SImode, operands[1]); - operands[4] = gen_highpart (SImode, operands[1]); - operands[5] = gen_lowpart (SImode, operands[0]); - operands[6] = gen_highpart (SImode, operands[0]);") - -(define_insn "*subdi3_sp64" - [(set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "arith_double_operand" "rHI")))] - "TARGET_ARCH64" - "sub\\t%1, %2, %0" - [(set_attr "type" "binary") - (set_attr "length" "1")]) - -(define_expand "subsi3" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (minus:SI (match_operand:SI 1 "register_operand" "r,d") - (match_operand:SI 2 "arith_add_operand" "rI,d")))] - "" - " -{ - if (arith_4096_operand(operands[2], DImode)) - { - emit_insn (gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_PLUS (SImode, operands[1], - GEN_INT(-4096)))); - DONE; - } -}") - -(define_insn "*subsi3" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (minus:SI (match_operand:SI 1 "register_operand" "r,d") - (match_operand:SI 2 "arith_operand" "rI,d")))] - "" - "@ - sub\\t%1, %2, %0 - fpsub32s\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1")]) - -(define_insn "*cmp_minus_cc" - [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (minus:SI (match_operand:SI 0 "reg_or_0_operand" "rJ") - (match_operand:SI 1 "arith_operand" "rI")) - (const_int 0)))] - "! TARGET_LIVE_G0" - "subcc\\t%r0, %1, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_minus_ccx" - [(set (reg:CCX_NOOV 100) - (compare:CCX_NOOV (minus:DI (match_operand:DI 0 "register_operand" "r") - (match_operand:DI 1 "arith_double_operand" "rHI")) - (const_int 0)))] - "TARGET_ARCH64" - "subcc\\t%0, %1, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "cmp_minus_cc_set" - [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ") - (match_operand:SI 2 "arith_operand" "rI")) - (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (minus:SI (match_dup 1) (match_dup 2)))] - "" - "subcc\\t%r1, %2, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_minus_ccx_set" - [(set (reg:CCX_NOOV 100) - (compare:CCX_NOOV (minus:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "arith_double_operand" "rHI")) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (minus:DI (match_dup 1) (match_dup 2)))] - "TARGET_ARCH64" - "subcc\\t%1, %2, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -;; Integer Multiply/Divide. - -;; The 32 bit multiply/divide instructions are deprecated on v9 and shouldn't -;; we used. We still use them in 32 bit v9 compilers. -;; The 64 bit v9 compiler will (/should) widen the args and use muldi3. - -(define_insn "mulsi3" - [(set (match_operand:SI 0 "register_operand" "=r") - (mult:SI (match_operand:SI 1 "arith_operand" "%r") - (match_operand:SI 2 "arith_operand" "rI")))] - "TARGET_HARD_MUL" - "smul\\t%1, %2, %0" - [(set_attr "type" "imul") - (set_attr "length" "1")]) - -(define_expand "muldi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (mult:DI (match_operand:DI 1 "arith_double_operand" "%r") - (match_operand:DI 2 "arith_double_operand" "rHI")))] - "TARGET_ARCH64 || TARGET_V8PLUS" - " -{ - if (TARGET_V8PLUS) - { - emit_insn (gen_muldi3_v8plus (operands[0], operands[1], operands[2])); - DONE; - } -}") - -(define_insn "*muldi3_sp64" - [(set (match_operand:DI 0 "register_operand" "=r") - (mult:DI (match_operand:DI 1 "arith_double_operand" "%r") - (match_operand:DI 2 "arith_double_operand" "rHI")))] - "TARGET_ARCH64" - "mulx\\t%1, %2, %0" - [(set_attr "type" "imul") - (set_attr "length" "1")]) - -;; V8plus wide multiply. -;; XXX -(define_insn "muldi3_v8plus" - [(set (match_operand:DI 0 "register_operand" "=r,h") - (mult:DI (match_operand:DI 1 "arith_double_operand" "%r,0") - (match_operand:DI 2 "arith_double_operand" "rHI,rHI"))) - (clobber (match_scratch:SI 3 "=&h,X")) - (clobber (match_scratch:SI 4 "=&h,X"))] - "TARGET_V8PLUS" - "* -{ - if (sparc_check_64 (operands[1], insn) <= 0) - output_asm_insn (\"srl\\t%L1, 0, %L1\", operands); - if (which_alternative == 1) - output_asm_insn (\"sllx\\t%H1, 32, %H1\", operands); - if (sparc_check_64 (operands[2], insn) <= 0) - output_asm_insn (\"srl\\t%L2, 0, %L2\", operands); - if (which_alternative == 1) - return \"or\\t%L1, %H1, %H1\\n\\tsllx\\t%H2, 32, %L1\\n\\tor\\t%L2, %L1, %L1\\n\\tmulx\\t%H1, %L1, %L0\;srlx\\t%L0, 32, %H0\"; - else - return \"sllx\\t%H1, 32, %3\\n\\tsllx\\t%H2, 32, %4\\n\\tor\\t%L1, %3, %3\\n\\tor\\t%L2, %4, %4\\n\\tmulx\\t%3, %4, %3\\n\\tsrlx\\t%3, 32, %H0\\n\\tmov\\t%3, %L0\"; -}" - [(set_attr "length" "9,8")]) - -;; It is not known whether this will match. - -(define_insn "*cmp_mul_set" - [(set (match_operand:SI 0 "register_operand" "=r") - (mult:SI (match_operand:SI 1 "arith_operand" "%r") - (match_operand:SI 2 "arith_operand" "rI"))) - (set (reg:CC_NOOV 100) - (compare:CC_NOOV (mult:SI (match_dup 1) (match_dup 2)) - (const_int 0)))] - "TARGET_V8 || TARGET_SPARCLITE || TARGET_DEPRECATED_V8_INSNS" - "smulcc\\t%1, %2, %0" - [(set_attr "type" "imul") - (set_attr "length" "1")]) - -(define_expand "mulsidi3" - [(set (match_operand:DI 0 "register_operand" "") - (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "")) - (sign_extend:DI (match_operand:SI 2 "arith_operand" ""))))] - "TARGET_HARD_MUL" - " -{ - if (CONSTANT_P (operands[2])) - { - if (TARGET_V8PLUS) - { - emit_insn (gen_const_mulsidi3_v8plus (operands[0], operands[1], - operands[2])); - DONE; - } - emit_insn (gen_const_mulsidi3 (operands[0], operands[1], operands[2])); - DONE; - } - if (TARGET_V8PLUS) - { - emit_insn (gen_mulsidi3_v8plus (operands[0], operands[1], operands[2])); - DONE; - } -}") - -;; V9 puts the 64 bit product in a 64 bit register. Only out or global -;; registers can hold 64 bit values in the V8plus environment. -;; XXX -(define_insn "mulsidi3_v8plus" - [(set (match_operand:DI 0 "register_operand" "=h,r") - (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) - (sign_extend:DI (match_operand:SI 2 "register_operand" "r,r")))) - (clobber (match_scratch:SI 3 "=X,&h"))] - "TARGET_V8PLUS" - "@ - smul\\t%1, %2, %L0\\n\\tsrlx\\t%L0, 32, %H0 - smul\\t%1, %2, %3\\n\\tsrlx\\t%3, 32, %H0\\n\\tmov\\t%3, %L0" - [(set_attr "length" "2,3")]) - -;; XXX -(define_insn "const_mulsidi3_v8plus" - [(set (match_operand:DI 0 "register_operand" "=h,r") - (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) - (match_operand:SI 2 "small_int" "I,I"))) - (clobber (match_scratch:SI 3 "=X,&h"))] - "TARGET_V8PLUS" - "@ - smul\\t%1, %2, %L0\\n\\tsrlx\\t%L0, 32, %H0 - smul\\t%1, %2, %3\\n\\tsrlx\\t%3, 32, %H0\\n\\tmov\\t%3, %L0" - [(set_attr "length" "2,3")]) - -;; XXX -(define_insn "*mulsidi3_sp32" - [(set (match_operand:DI 0 "register_operand" "=r") - (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) - (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))))] - "TARGET_HARD_MUL32" - "* -{ - return TARGET_SPARCLET ? \"smuld\\t%1, %2, %L0\" : \"smul\\t%1, %2, %L0\\n\\trd\\t%%y, %H0\"; -}" - [(set (attr "length") - (if_then_else (eq_attr "isa" "sparclet") - (const_int 1) (const_int 2)))]) - -;; Extra pattern, because sign_extend of a constant isn't valid. - -;; XXX -(define_insn "const_mulsidi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) - (match_operand:SI 2 "small_int" "I")))] - "TARGET_HARD_MUL" - "* -{ - return TARGET_SPARCLET ? \"smuld\\t%1, %2, %L0\" : \"smul\\t%1, %2, %L0\\n\\trd\\t%%y, %H0\"; -}" - [(set (attr "length") - (if_then_else (eq_attr "isa" "sparclet") - (const_int 1) (const_int 2)))]) - -(define_expand "smulsi3_highpart" - [(set (match_operand:SI 0 "register_operand" "") - (truncate:SI - (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "")) - (sign_extend:DI (match_operand:SI 2 "arith_operand" ""))) - (const_int 32))))] - "TARGET_HARD_MUL" - " -{ - if (CONSTANT_P (operands[2])) - { - if (TARGET_V8PLUS) - { - emit_insn (gen_const_smulsi3_highpart_v8plus (operands[0], - operands[1], - operands[2], - GEN_INT (32))); - DONE; - } - emit_insn (gen_const_smulsi3_highpart (operands[0], operands[1], operands[2])); - DONE; - } - if (TARGET_V8PLUS) - { - emit_insn (gen_smulsi3_highpart_v8plus (operands[0], operands[1], - operands[2], GEN_INT (32))); - DONE; - } -}") - -;; XXX -(define_insn "smulsi3_highpart_v8plus" - [(set (match_operand:SI 0 "register_operand" "=h,r") - (truncate:SI - (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) - (sign_extend:DI (match_operand:SI 2 "register_operand" "r,r"))) - (match_operand:SI 3 "const_int_operand" "i,i")))) - (clobber (match_scratch:SI 4 "=X,&h"))] - "TARGET_V8PLUS" - "@ - smul %1,%2,%0\;srlx %0,%3,%0 - smul %1,%2,%4\;srlx %4,%3,%0" - [(set_attr "length" "2")]) - -;; The combiner changes TRUNCATE in the previous pattern to SUBREG. -;; XXX -(define_insn "" - [(set (match_operand:SI 0 "register_operand" "=h,r") - (subreg:SI - (lshiftrt:DI - (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) - (sign_extend:DI (match_operand:SI 2 "register_operand" "r,r"))) - (match_operand:SI 3 "const_int_operand" "i,i")) - 1)) - (clobber (match_scratch:SI 4 "=X,&h"))] - "TARGET_V8PLUS" - "@ - smul\\t%1, %2, %0\\n\\tsrlx\\t%0, %3, %0 - smul\\t%1, %2, %4\\n\\tsrlx\\t%4, %3, %0" - [(set_attr "length" "2")]) - -;; XXX -(define_insn "const_smulsi3_highpart_v8plus" - [(set (match_operand:SI 0 "register_operand" "=h,r") - (truncate:SI - (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r,r")) - (match_operand 2 "small_int" "i,i")) - (match_operand:SI 3 "const_int_operand" "i,i")))) - (clobber (match_scratch:SI 4 "=X,&h"))] - "TARGET_V8PLUS" - "@ - smul\\t%1, %2, %0\\n\\tsrlx\\t%0, %3, %0 - smul\\t%1, %2, %4\\n\\tsrlx\\t%4, %3, %0" - [(set_attr "length" "2")]) - -;; XXX -(define_insn "*smulsi3_highpart_sp32" - [(set (match_operand:SI 0 "register_operand" "=r") - (truncate:SI - (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) - (sign_extend:DI (match_operand:SI 2 "register_operand" "r"))) - (const_int 32))))] - "TARGET_HARD_MUL32 - && ! TARGET_LIVE_G0" - "smul\\t%1, %2, %%g0\\n\\trd\\t%%y, %0" - [(set_attr "length" "2")]) - -;; XXX -(define_insn "const_smulsi3_highpart" - [(set (match_operand:SI 0 "register_operand" "=r") - (truncate:SI - (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "r")) - (match_operand:SI 2 "register_operand" "r")) - (const_int 32))))] - "TARGET_HARD_MUL32 - && ! TARGET_LIVE_G0" - "smul\\t%1, %2, %%g0\\n\\trd\\t%%y, %0" - [(set_attr "length" "2")]) - -(define_expand "umulsidi3" - [(set (match_operand:DI 0 "register_operand" "") - (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "")) - (zero_extend:DI (match_operand:SI 2 "uns_arith_operand" ""))))] - "TARGET_HARD_MUL" - " -{ - if (CONSTANT_P (operands[2])) - { - if (TARGET_V8PLUS) - { - emit_insn (gen_const_umulsidi3_v8plus (operands[0], operands[1], - operands[2])); - DONE; - } - emit_insn (gen_const_umulsidi3 (operands[0], operands[1], operands[2])); - DONE; - } - if (TARGET_V8PLUS) - { - emit_insn (gen_umulsidi3_v8plus (operands[0], operands[1], operands[2])); - DONE; - } -}") - -;; XXX -(define_insn "umulsidi3_v8plus" - [(set (match_operand:DI 0 "register_operand" "=h,r") - (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r,r")) - (zero_extend:DI (match_operand:SI 2 "register_operand" "r,r")))) - (clobber (match_scratch:SI 3 "=X,&h"))] - "TARGET_V8PLUS" - "@ - umul\\t%1, %2, %L0\\n\\tsrlx\\t%L0, 32, %H0 - umul\\t%1, %2, %3\\n\\tsrlx\\t%3, 32, %H0\\n\\tmov\\t%3, %L0" - [(set_attr "length" "2,3")]) - -;; XXX -(define_insn "*umulsidi3_sp32" - [(set (match_operand:DI 0 "register_operand" "=r") - (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) - (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))))] - "TARGET_HARD_MUL32" - "* -{ - return TARGET_SPARCLET ? \"umuld\\t%1, %2, %L0\" : \"umul\\t%1, %2, %L0\\n\\trd\\t%%y, %H0\"; -}" - [(set (attr "length") - (if_then_else (eq_attr "isa" "sparclet") - (const_int 1) (const_int 2)))]) - -;; Extra pattern, because sign_extend of a constant isn't valid. - -;; XXX -(define_insn "const_umulsidi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) - (match_operand:SI 2 "uns_small_int" "")))] - "TARGET_HARD_MUL32" - "* -{ - return TARGET_SPARCLET ? \"umuld\\t%1, %2, %L0\" : \"umul\\t%1, %2, %L0\\n\\trd\\t%%y, %H0\"; -}" - [(set (attr "length") - (if_then_else (eq_attr "isa" "sparclet") - (const_int 1) (const_int 2)))]) - -;; XXX -(define_insn "const_umulsidi3_v8plus" - [(set (match_operand:DI 0 "register_operand" "=h,r") - (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r,r")) - (match_operand:SI 2 "uns_small_int" ""))) - (clobber (match_scratch:SI 3 "=X,h"))] - "TARGET_V8PLUS" - "@ - umul\\t%1, %2, %L0\\n\\tsrlx\\t%L0, 32, %H0 - umul\\t%1, %2, %3\\n\\tsrlx\\t%3, 32, %H0\\n\\tmov\\t%3, %L0" - [(set_attr "length" "2,3")]) - -(define_expand "umulsi3_highpart" - [(set (match_operand:SI 0 "register_operand" "") - (truncate:SI - (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "")) - (zero_extend:DI (match_operand:SI 2 "uns_arith_operand" ""))) - (const_int 32))))] - "TARGET_HARD_MUL" - " -{ - if (CONSTANT_P (operands[2])) - { - if (TARGET_V8PLUS) - { - emit_insn (gen_const_umulsi3_highpart_v8plus (operands[0], - operands[1], - operands[2], - GEN_INT (32))); - DONE; - } - emit_insn (gen_const_umulsi3_highpart (operands[0], operands[1], operands[2])); - DONE; - } - if (TARGET_V8PLUS) - { - emit_insn (gen_umulsi3_highpart_v8plus (operands[0], operands[1], - operands[2], GEN_INT (32))); - DONE; - } -}") - -;; XXX -(define_insn "umulsi3_highpart_v8plus" - [(set (match_operand:SI 0 "register_operand" "=h,r") - (truncate:SI - (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r,r")) - (zero_extend:DI (match_operand:SI 2 "register_operand" "r,r"))) - (match_operand:SI 3 "const_int_operand" "i,i")))) - (clobber (match_scratch:SI 4 "=X,h"))] - "TARGET_V8PLUS" - "@ - umul\\t%1, %2, %0\\n\\tsrlx\\t%0, %3, %0 - umul\\t%1, %2, %4\\n\\tsrlx\\t%4, %3, %0" - [(set_attr "length" "2")]) - -;; XXX -(define_insn "const_umulsi3_highpart_v8plus" - [(set (match_operand:SI 0 "register_operand" "=h,r") - (truncate:SI - (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r,r")) - (match_operand:SI 2 "uns_small_int" "")) - (match_operand:SI 3 "const_int_operand" "i,i")))) - (clobber (match_scratch:SI 4 "=X,h"))] - "TARGET_V8PLUS" - "@ - umul\\t%1, %2, %0\\n\\tsrlx\\t%0, %3, %0 - umul\\t%1, %2, %4\\n\\tsrlx\\t%4, %3, %0" - [(set_attr "length" "2")]) - -;; XXX -(define_insn "*umulsi3_highpart_sp32" - [(set (match_operand:SI 0 "register_operand" "=r") - (truncate:SI - (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) - (zero_extend:DI (match_operand:SI 2 "register_operand" "r"))) - (const_int 32))))] - "TARGET_HARD_MUL32 - && ! TARGET_LIVE_G0" - "umul\\t%1, %2, %%g0\\n\\trd\\t%%y, %0" - [(set_attr "length" "2")]) - -;; XXX -(define_insn "const_umulsi3_highpart" - [(set (match_operand:SI 0 "register_operand" "=r") - (truncate:SI - (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r")) - (match_operand:SI 2 "uns_small_int" "")) - (const_int 32))))] - "TARGET_HARD_MUL32 - && ! TARGET_LIVE_G0" - "umul\\t%1, %2, %%g0\\n\\trd\\t%%y, %0" - [(set_attr "length" "2")]) - -;; The v8 architecture specifies that there must be 3 instructions between -;; a y register write and a use of it for correct results. - -;; XXX SHEESH -(define_insn "divsi3" - [(set (match_operand:SI 0 "register_operand" "=r,r") - (div:SI (match_operand:SI 1 "register_operand" "r,r") - (match_operand:SI 2 "input_operand" "rI,m"))) - (clobber (match_scratch:SI 3 "=&r,&r"))] - "(TARGET_V8 - || TARGET_DEPRECATED_V8_INSNS) - && ! TARGET_LIVE_G0" - "* -{ - if (which_alternative == 0) - if (TARGET_V9) - return \"sra\\t%1, 31, %3\\n\\twr\\t%%g0, %3, %%y\\n\\tsdiv\\t%1, %2, %0\"; - else - return \"sra\\t%1, 31, %3\\n\\twr\\t%%g0, %3, %%y\\n\\tnop\\n\\tnop\\n\\tnop\\n\\tsdiv\\t%1, %2, %0\"; - else - if (TARGET_V9) - return \"sra\\t%1, 31, %3\\n\\twr\\t%%g0, %3, %%y\\n\\tld\\t%2, %3\\n\\tsdiv\\t%1, %3, %0\"; - else - return \"sra\\t%1, 31, %3\\n\\twr\\t%%g0, %3, %%y\\n\\tld\\t%2, %3\\n\\tnop\\n\\tnop\\n\\tsdiv\\t%1, %3, %0\"; -}" - [(set (attr "length") - (if_then_else (eq_attr "isa" "v9") - (const_int 4) (const_int 7)))]) - -(define_insn "divdi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (div:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "arith_double_operand" "rHI")))] - "TARGET_ARCH64" - "sdivx\\t%1, %2, %0") - -;; It is not known whether this will match. - -;; XXX I hope it doesn't fucking match... -(define_insn "*cmp_sdiv_cc_set" - [(set (match_operand:SI 0 "register_operand" "=r") - (div:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI"))) - (set (reg:CC 100) - (compare:CC (div:SI (match_dup 1) (match_dup 2)) - (const_int 0))) - (clobber (match_scratch:SI 3 "=&r"))] - "(TARGET_V8 - || TARGET_DEPRECATED_V8_INSNS) - && ! TARGET_LIVE_G0" - "* -{ - if (TARGET_V9) - return \"sra\\t%1, 31, %3\\n\\twr\\t%%g0, %3, %%y\\n\\tsdivcc\\t%1, %2, %0\"; - else - return \"sra\\t%1, 31, %3\\n\\twr\\t%%g0, %3, %%y\\n\\tnop\\n\\tnop\\n\\tnop\\n\\tsdivcc\\t%1, %2, %0\"; -}" - [(set (attr "length") - (if_then_else (eq_attr "isa" "v9") - (const_int 3) (const_int 6)))]) - -;; XXX -(define_insn "udivsi3" - [(set (match_operand:SI 0 "register_operand" "=r,&r,&r") - (udiv:SI (match_operand:SI 1 "reg_or_nonsymb_mem_operand" "r,r,m") - (match_operand:SI 2 "input_operand" "rI,m,r")))] - "(TARGET_V8 - || TARGET_DEPRECATED_V8_INSNS) - && ! TARGET_LIVE_G0" - "* -{ - output_asm_insn (\"wr\\t%%g0, %%g0, %%y\", operands); - switch (which_alternative) - { - default: - if (TARGET_V9) - return \"udiv\\t%1, %2, %0\"; - return \"nop\\n\\tnop\\n\\tnop\\n\\tudiv\\t%1, %2, %0\"; - case 1: - return \"ld\\t%2, %0\\n\\tnop\\n\\tnop\\n\\tudiv\\t%1, %0, %0\"; - case 2: - return \"ld\\t%1, %0\\n\\tnop\\n\\tnop\\n\\tudiv\\t%0, %2, %0\"; - } -}" - [(set (attr "length") - (if_then_else (and (eq_attr "isa" "v9") - (eq_attr "alternative" "0")) - (const_int 2) (const_int 5)))]) - -(define_insn "udivdi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (udiv:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "arith_double_operand" "rHI")))] - "TARGET_ARCH64" - "udivx\\t%1, %2, %0") - -;; It is not known whether this will match. - -;; XXX I hope it doesn't fucking match... -(define_insn "*cmp_udiv_cc_set" - [(set (match_operand:SI 0 "register_operand" "=r") - (udiv:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI"))) - (set (reg:CC 100) - (compare:CC (udiv:SI (match_dup 1) (match_dup 2)) - (const_int 0)))] - "(TARGET_V8 - || TARGET_DEPRECATED_V8_INSNS) - && ! TARGET_LIVE_G0" - "* -{ - if (TARGET_V9) - return \"wr\\t%%g0, %%g0, %%y\\n\\tudivcc\\t%1, %2, %0\"; - else - return \"wr\\t%%g0, %%g0, %%y\\n\\tnop\\n\\tnop\\n\\tnop\\n\\tudivcc\\t%1, %2, %0\"; -}" - [(set (attr "length") - (if_then_else (eq_attr "isa" "v9") - (const_int 2) (const_int 5)))]) - -; sparclet multiply/accumulate insns - -(define_insn "*smacsi" - [(set (match_operand:SI 0 "register_operand" "=r") - (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "%r") - (match_operand:SI 2 "arith_operand" "rI")) - (match_operand:SI 3 "register_operand" "0")))] - "TARGET_SPARCLET" - "smac\\t%1, %2, %0" - [(set_attr "type" "imul") - (set_attr "length" "1")]) - -(define_insn "*smacdi" - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (mult:DI (sign_extend:DI - (match_operand:SI 1 "register_operand" "%r")) - (sign_extend:DI - (match_operand:SI 2 "register_operand" "r"))) - (match_operand:DI 3 "register_operand" "0")))] - "TARGET_SPARCLET" - "smacd\\t%1, %2, %L0" - [(set_attr "type" "imul") - (set_attr "length" "1")]) - -(define_insn "*umacdi" - [(set (match_operand:DI 0 "register_operand" "=r") - (plus:DI (mult:DI (zero_extend:DI - (match_operand:SI 1 "register_operand" "%r")) - (zero_extend:DI - (match_operand:SI 2 "register_operand" "r"))) - (match_operand:DI 3 "register_operand" "0")))] - "TARGET_SPARCLET" - "umacd\\t%1, %2, %L0" - [(set_attr "type" "imul") - (set_attr "length" "1")]) - -;;- Boolean instructions -;; We define DImode `and' so with DImode `not' we can get -;; DImode `andn'. Other combinations are possible. - -(define_expand "anddi3" - [(set (match_operand:DI 0 "register_operand" "") - (and:DI (match_operand:DI 1 "arith_double_operand" "") - (match_operand:DI 2 "arith_double_operand" "")))] - "" - "") - -(define_insn "*anddi3_sp32" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (and:DI (match_operand:DI 1 "arith_double_operand" "%r,b") - (match_operand:DI 2 "arith_double_operand" "rHI,b")))] - "! TARGET_ARCH64" - "@ - # - fand\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "2,1")]) - -(define_insn "*anddi3_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (and:DI (match_operand:DI 1 "arith_double_operand" "%r,b") - (match_operand:DI 2 "arith_double_operand" "rHI,b")))] - "TARGET_ARCH64" - "@ - and\\t%1, %2, %0 - fand\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_insn "andsi3" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (and:SI (match_operand:SI 1 "arith_operand" "%r,d") - (match_operand:SI 2 "arith_operand" "rI,d")))] - "" - "@ - and\\t%1, %2, %0 - fands\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (and:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "" ""))) - (clobber (match_operand:SI 3 "register_operand" ""))] - "GET_CODE (operands[2]) == CONST_INT - && !SMALL_INT32 (operands[2]) - && (INTVAL (operands[2]) & 0x3ff) == 0x3ff" - [(set (match_dup 3) (match_dup 4)) - (set (match_dup 0) (and:SI (not:SI (match_dup 3)) (match_dup 1)))] - " -{ - operands[4] = GEN_INT (~INTVAL (operands[2]) & 0xffffffff); -}") - -;; Split DImode logical operations requiring two instructions. -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (match_operator:DI 1 "cc_arithop" ; AND, IOR, XOR - [(match_operand:DI 2 "register_operand" "") - (match_operand:DI 3 "arith_double_operand" "")]))] - "! TARGET_ARCH64 - && reload_completed - && ((GET_CODE (operands[0]) == REG - && REGNO (operands[0]) < 32) - || (GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == REG - && REGNO (SUBREG_REG (operands[0])) < 32))" - [(set (match_dup 4) (match_op_dup:SI 1 [(match_dup 6) (match_dup 8)])) - (set (match_dup 5) (match_op_dup:SI 1 [(match_dup 7) (match_dup 9)]))] - " -{ - if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - operands[4] = gen_highpart (SImode, operands[0]); - operands[5] = gen_lowpart (SImode, operands[0]); - operands[6] = gen_highpart (SImode, operands[2]); - operands[7] = gen_lowpart (SImode, operands[2]); - if (GET_CODE (operands[3]) == CONST_INT) - { - if (INTVAL (operands[3]) < 0) - operands[8] = constm1_rtx; - else - operands[8] = const0_rtx; - } - else - operands[8] = gen_highpart (SImode, operands[3]); - operands[9] = gen_lowpart (SImode, operands[3]); -}") - -(define_insn "*and_not_di_sp32" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (and:DI (not:DI (match_operand:DI 1 "register_operand" "r,b")) - (match_operand:DI 2 "register_operand" "r,b")))] - "! TARGET_ARCH64" - "@ - # - fandnot1\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "2,1")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (and:DI (not:DI (match_operand:DI 1 "register_operand" "")) - (match_operand:DI 2 "register_operand" "")))] - "! TARGET_ARCH64 - && reload_completed - && ((GET_CODE (operands[0]) == REG - && REGNO (operands[0]) < 32) - || (GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == REG - && REGNO (SUBREG_REG (operands[0])) < 32))" - [(set (match_dup 3) (and:SI (not:SI (match_dup 4)) (match_dup 5))) - (set (match_dup 6) (and:SI (not:SI (match_dup 7)) (match_dup 8)))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - operands[3] = gen_highpart (SImode, operands[0]); - operands[4] = gen_highpart (SImode, operands[1]); - operands[5] = gen_highpart (SImode, operands[2]); - operands[6] = gen_lowpart (SImode, operands[0]); - operands[7] = gen_lowpart (SImode, operands[1]); - operands[8] = gen_lowpart (SImode, operands[2]);") - -(define_insn "*and_not_di_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (and:DI (not:DI (match_operand:DI 1 "register_operand" "r,b")) - (match_operand:DI 2 "register_operand" "r,b")))] - "TARGET_ARCH64" - "@ - andn\\t%2, %1, %0 - fandnot1\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_insn "*and_not_si" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (and:SI (not:SI (match_operand:SI 1 "register_operand" "r,d")) - (match_operand:SI 2 "register_operand" "r,d")))] - "" - "@ - andn\\t%2, %1, %0 - fandnot1s\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_expand "iordi3" - [(set (match_operand:DI 0 "register_operand" "") - (ior:DI (match_operand:DI 1 "arith_double_operand" "") - (match_operand:DI 2 "arith_double_operand" "")))] - "" - "") - -(define_insn "*iordi3_sp32" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (ior:DI (match_operand:DI 1 "arith_double_operand" "%r,b") - (match_operand:DI 2 "arith_double_operand" "rHI,b")))] - "! TARGET_ARCH64" - "@ - # - for\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "2,1")]) - -(define_insn "*iordi3_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (ior:DI (match_operand:DI 1 "arith_double_operand" "%r,b") - (match_operand:DI 2 "arith_double_operand" "rHI,b")))] - "TARGET_ARCH64" - "@ - or\\t%1, %2, %0 - for\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_insn "iorsi3" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (ior:SI (match_operand:SI 1 "arith_operand" "%r,d") - (match_operand:SI 2 "arith_operand" "rI,d")))] - "" - "@ - or\\t%1, %2, %0 - fors\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (ior:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "" ""))) - (clobber (match_operand:SI 3 "register_operand" ""))] - "GET_CODE (operands[2]) == CONST_INT - && !SMALL_INT32 (operands[2]) - && (INTVAL (operands[2]) & 0x3ff) == 0x3ff" - [(set (match_dup 3) (match_dup 4)) - (set (match_dup 0) (ior:SI (not:SI (match_dup 3)) (match_dup 1)))] - " -{ - operands[4] = GEN_INT (~INTVAL (operands[2]) & 0xffffffff); -}") - -(define_insn "*or_not_di_sp32" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (ior:DI (not:DI (match_operand:DI 1 "register_operand" "r,b")) - (match_operand:DI 2 "register_operand" "r,b")))] - "! TARGET_ARCH64" - "@ - # - fornot1\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "2,1")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (ior:DI (not:DI (match_operand:DI 1 "register_operand" "")) - (match_operand:DI 2 "register_operand" "")))] - "! TARGET_ARCH64 - && reload_completed - && ((GET_CODE (operands[0]) == REG - && REGNO (operands[0]) < 32) - || (GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == REG - && REGNO (SUBREG_REG (operands[0])) < 32))" - [(set (match_dup 3) (ior:SI (not:SI (match_dup 4)) (match_dup 5))) - (set (match_dup 6) (ior:SI (not:SI (match_dup 7)) (match_dup 8)))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - operands[3] = gen_highpart (SImode, operands[0]); - operands[4] = gen_highpart (SImode, operands[1]); - operands[5] = gen_highpart (SImode, operands[2]); - operands[6] = gen_lowpart (SImode, operands[0]); - operands[7] = gen_lowpart (SImode, operands[1]); - operands[8] = gen_lowpart (SImode, operands[2]);") - -(define_insn "*or_not_di_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (ior:DI (not:DI (match_operand:DI 1 "register_operand" "r,b")) - (match_operand:DI 2 "register_operand" "r,b")))] - "TARGET_ARCH64" - "@ - orn\\t%2, %1, %0 - fornot1\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_insn "*or_not_si" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (ior:SI (not:SI (match_operand:SI 1 "register_operand" "r,d")) - (match_operand:SI 2 "register_operand" "r,d")))] - "" - "@ - orn\\t%2, %1, %0 - fornot1s\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_expand "xordi3" - [(set (match_operand:DI 0 "register_operand" "") - (xor:DI (match_operand:DI 1 "arith_double_operand" "") - (match_operand:DI 2 "arith_double_operand" "")))] - "" - "") - -(define_insn "*xordi3_sp32" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (xor:DI (match_operand:DI 1 "arith_double_operand" "%r,b") - (match_operand:DI 2 "arith_double_operand" "rHI,b")))] - "! TARGET_ARCH64" - "@ - # - fxor\\t%1, %2, %0" - [(set_attr "length" "2,1") - (set_attr "type" "ialu,fp")]) - -(define_insn "*xordi3_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (xor:DI (match_operand:DI 1 "arith_double_operand" "%rJ,b") - (match_operand:DI 2 "arith_double_operand" "rHI,b")))] - "TARGET_ARCH64" - "@ - xor\\t%r1, %2, %0 - fxor\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_insn "*xordi3_sp64_dbl" - [(set (match_operand:DI 0 "register_operand" "=r") - (xor:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:DI 2 "const64_operand" "")))] - "(TARGET_ARCH64 - && HOST_BITS_PER_WIDE_INT != 64)" - "xor\\t%1, %2, %0" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_insn "xorsi3" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (xor:SI (match_operand:SI 1 "arith_operand" "%rJ,d") - (match_operand:SI 2 "arith_operand" "rI,d")))] - "" - "@ - xor\\t%r1, %2, %0 - fxors\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (xor:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "" ""))) - (clobber (match_operand:SI 3 "register_operand" ""))] - "GET_CODE (operands[2]) == CONST_INT - && !SMALL_INT32 (operands[2]) - && (INTVAL (operands[2]) & 0x3ff) == 0x3ff" - [(set (match_dup 3) (match_dup 4)) - (set (match_dup 0) (not:SI (xor:SI (match_dup 3) (match_dup 1))))] - " -{ - operands[4] = GEN_INT (~INTVAL (operands[2]) & 0xffffffff); -}") - -(define_split - [(set (match_operand:SI 0 "register_operand" "") - (not:SI (xor:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "" "")))) - (clobber (match_operand:SI 3 "register_operand" ""))] - "GET_CODE (operands[2]) == CONST_INT - && !SMALL_INT32 (operands[2]) - && (INTVAL (operands[2]) & 0x3ff) == 0x3ff" - [(set (match_dup 3) (match_dup 4)) - (set (match_dup 0) (xor:SI (match_dup 3) (match_dup 1)))] - " -{ - operands[4] = GEN_INT (~INTVAL (operands[2]) & 0xffffffff); -}") - -;; xnor patterns. Note that (a ^ ~b) == (~a ^ b) == ~(a ^ b). -;; Combine now canonicalizes to the rightmost expression. -(define_insn "*xor_not_di_sp32" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (not:DI (xor:DI (match_operand:DI 1 "register_operand" "r,b") - (match_operand:DI 2 "register_operand" "r,b"))))] - "! TARGET_ARCH64" - "@ - # - fxnor\\t%1, %2, %0" - [(set_attr "length" "2,1") - (set_attr "type" "ialu,fp")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (not:DI (xor:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "register_operand" ""))))] - "! TARGET_ARCH64 - && reload_completed - && ((GET_CODE (operands[0]) == REG - && REGNO (operands[0]) < 32) - || (GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == REG - && REGNO (SUBREG_REG (operands[0])) < 32))" - [(set (match_dup 3) (not:SI (xor:SI (match_dup 4) (match_dup 5)))) - (set (match_dup 6) (not:SI (xor:SI (match_dup 7) (match_dup 8))))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - operands[3] = gen_highpart (SImode, operands[0]); - operands[4] = gen_highpart (SImode, operands[1]); - operands[5] = gen_highpart (SImode, operands[2]); - operands[6] = gen_lowpart (SImode, operands[0]); - operands[7] = gen_lowpart (SImode, operands[1]); - operands[8] = gen_lowpart (SImode, operands[2]);") - -(define_insn "*xor_not_di_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (not:DI (xor:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,b") - (match_operand:DI 2 "arith_double_operand" "rHI,b"))))] - "TARGET_ARCH64" - "@ - xnor\\t%r1, %2, %0 - fxnor\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -(define_insn "*xor_not_si" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (not:SI (xor:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,d") - (match_operand:SI 2 "arith_operand" "rI,d"))))] - "" - "@ - xnor\\t%r1, %2, %0 - fxnors\\t%1, %2, %0" - [(set_attr "type" "ialu,fp") - (set_attr "length" "1,1")]) - -;; These correspond to the above in the case where we also (or only) -;; want to set the condition code. - -(define_insn "*cmp_cc_arith_op" - [(set (reg:CC 100) - (compare:CC - (match_operator:SI 2 "cc_arithop" - [(match_operand:SI 0 "arith_operand" "%r") - (match_operand:SI 1 "arith_operand" "rI")]) - (const_int 0)))] - "! TARGET_LIVE_G0" - "%A2cc\\t%0, %1, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_arith_op" - [(set (reg:CCX 100) - (compare:CCX - (match_operator:DI 2 "cc_arithop" - [(match_operand:DI 0 "arith_double_operand" "%r") - (match_operand:DI 1 "arith_double_operand" "rHI")]) - (const_int 0)))] - "TARGET_ARCH64" - "%A2cc\\t%0, %1, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_arith_op_set" - [(set (reg:CC 100) - (compare:CC - (match_operator:SI 3 "cc_arithop" - [(match_operand:SI 1 "arith_operand" "%r") - (match_operand:SI 2 "arith_operand" "rI")]) - (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (match_dup 3))] - "" - "%A3cc\\t%1, %2, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_arith_op_set" - [(set (reg:CCX 100) - (compare:CCX - (match_operator:DI 3 "cc_arithop" - [(match_operand:DI 1 "arith_double_operand" "%r") - (match_operand:DI 2 "arith_double_operand" "rHI")]) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (match_dup 3))] - "TARGET_ARCH64" - "%A3cc\\t%1, %2, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_xor_not" - [(set (reg:CC 100) - (compare:CC - (not:SI (xor:SI (match_operand:SI 0 "reg_or_0_operand" "%rJ") - (match_operand:SI 1 "arith_operand" "rI"))) - (const_int 0)))] - "! TARGET_LIVE_G0" - "xnorcc\\t%r0, %1, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_xor_not" - [(set (reg:CCX 100) - (compare:CCX - (not:DI (xor:DI (match_operand:DI 0 "reg_or_0_operand" "%rJ") - (match_operand:DI 1 "arith_double_operand" "rHI"))) - (const_int 0)))] - "TARGET_ARCH64" - "xnorcc\\t%r0, %1, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_xor_not_set" - [(set (reg:CC 100) - (compare:CC - (not:SI (xor:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ") - (match_operand:SI 2 "arith_operand" "rI"))) - (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (not:SI (xor:SI (match_dup 1) (match_dup 2))))] - "" - "xnorcc\\t%r1, %2, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_xor_not_set" - [(set (reg:CCX 100) - (compare:CCX - (not:DI (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ") - (match_operand:DI 2 "arith_double_operand" "rHI"))) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (not:DI (xor:DI (match_dup 1) (match_dup 2))))] - "TARGET_ARCH64" - "xnorcc\\t%r1, %2, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_arith_op_not" - [(set (reg:CC 100) - (compare:CC - (match_operator:SI 2 "cc_arithopn" - [(not:SI (match_operand:SI 0 "arith_operand" "rI")) - (match_operand:SI 1 "reg_or_0_operand" "rJ")]) - (const_int 0)))] - "! TARGET_LIVE_G0" - "%B2cc\\t%r1, %0, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_arith_op_not" - [(set (reg:CCX 100) - (compare:CCX - (match_operator:DI 2 "cc_arithopn" - [(not:DI (match_operand:DI 0 "arith_double_operand" "rHI")) - (match_operand:DI 1 "reg_or_0_operand" "rJ")]) - (const_int 0)))] - "TARGET_ARCH64" - "%B2cc\\t%r1, %0, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_arith_op_not_set" - [(set (reg:CC 100) - (compare:CC - (match_operator:SI 3 "cc_arithopn" - [(not:SI (match_operand:SI 1 "arith_operand" "rI")) - (match_operand:SI 2 "reg_or_0_operand" "rJ")]) - (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (match_dup 3))] - "" - "%B3cc\\t%r2, %1, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_arith_op_not_set" - [(set (reg:CCX 100) - (compare:CCX - (match_operator:DI 3 "cc_arithopn" - [(not:DI (match_operand:DI 1 "arith_double_operand" "rHI")) - (match_operand:DI 2 "reg_or_0_operand" "rJ")]) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (match_dup 3))] - "TARGET_ARCH64" - "%B3cc\\t%r2, %1, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -;; We cannot use the "neg" pseudo insn because the Sun assembler -;; does not know how to make it work for constants. - -(define_expand "negdi2" - [(set (match_operand:DI 0 "register_operand" "=r") - (neg:DI (match_operand:DI 1 "register_operand" "r")))] - "" - " -{ - if (! TARGET_ARCH64) - { - emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, - gen_rtx_SET (VOIDmode, operand0, - gen_rtx_NEG (DImode, operand1)), - gen_rtx_CLOBBER (VOIDmode, - gen_rtx_REG (CCmode, SPARC_ICC_REG))))); - DONE; - } -}") - -(define_insn "*negdi2_sp32" - [(set (match_operand:DI 0 "register_operand" "=r") - (neg:DI (match_operand:DI 1 "register_operand" "r"))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64 - && ! TARGET_LIVE_G0" - "#" - [(set_attr "type" "unary") - (set_attr "length" "2")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (neg:DI (match_operand:DI 1 "register_operand" ""))) - (clobber (reg:CC 100))] - "! TARGET_ARCH64 - && ! TARGET_LIVE_G0 - && reload_completed" - [(parallel [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (minus:SI (const_int 0) (match_dup 5)) - (const_int 0))) - (set (match_dup 4) (minus:SI (const_int 0) (match_dup 5)))]) - (set (match_dup 2) (minus:SI (minus:SI (const_int 0) (match_dup 3)) - (ltu:SI (reg:CC 100) (const_int 0))))] - "operands[2] = gen_highpart (SImode, operands[0]); - operands[3] = gen_highpart (SImode, operands[1]); - operands[4] = gen_lowpart (SImode, operands[0]); - operands[5] = gen_lowpart (SImode, operands[1]);") - -(define_insn "*negdi2_sp64" - [(set (match_operand:DI 0 "register_operand" "=r") - (neg:DI (match_operand:DI 1 "register_operand" "r")))] - "TARGET_ARCH64" - "sub\\t%%g0, %1, %0" - [(set_attr "type" "unary") - (set_attr "length" "1")]) - -(define_expand "negsi2" - [(set (match_operand:SI 0 "register_operand" "") - (neg:SI (match_operand:SI 1 "arith_operand" "")))] - "" - " -{ - if (TARGET_LIVE_G0) - { - rtx zero_reg = gen_reg_rtx (SImode); - - emit_insn (gen_rtx_SET (VOIDmode, zero_reg, const0_rtx)); - emit_insn (gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_MINUS (SImode, zero_reg, - operands[1]))); - DONE; - } -}") - -(define_insn "*negsi2_not_liveg0" - [(set (match_operand:SI 0 "register_operand" "=r") - (neg:SI (match_operand:SI 1 "arith_operand" "rI")))] - "! TARGET_LIVE_G0" - "sub\\t%%g0, %1, %0" - [(set_attr "type" "unary") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_neg" - [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (neg:SI (match_operand:SI 0 "arith_operand" "rI")) - (const_int 0)))] - "! TARGET_LIVE_G0" - "subcc\\t%%g0, %0, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_neg" - [(set (reg:CCX_NOOV 100) - (compare:CCX_NOOV (neg:DI (match_operand:DI 0 "arith_double_operand" "rHI")) - (const_int 0)))] - "TARGET_ARCH64" - "subcc\\t%%g0, %0, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_set_neg" - [(set (reg:CC_NOOV 100) - (compare:CC_NOOV (neg:SI (match_operand:SI 1 "arith_operand" "rI")) - (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (neg:SI (match_dup 1)))] - "! TARGET_LIVE_G0" - "subcc\\t%%g0, %1, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_set_neg" - [(set (reg:CCX_NOOV 100) - (compare:CCX_NOOV (neg:DI (match_operand:DI 1 "arith_double_operand" "rHI")) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (neg:DI (match_dup 1)))] - "TARGET_ARCH64" - "subcc\\t%%g0, %1, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -;; We cannot use the "not" pseudo insn because the Sun assembler -;; does not know how to make it work for constants. -(define_expand "one_cmpldi2" - [(set (match_operand:DI 0 "register_operand" "") - (not:DI (match_operand:DI 1 "register_operand" "")))] - "" - "") - -(define_insn "*one_cmpldi2_sp32" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (not:DI (match_operand:DI 1 "register_operand" "r,b")))] - "! TARGET_ARCH64" - "@ - # - fnot1\\t%1, %0" - [(set_attr "type" "unary,fp") - (set_attr "length" "2,1")]) - -(define_split - [(set (match_operand:DI 0 "register_operand" "") - (not:DI (match_operand:DI 1 "register_operand" "")))] - "! TARGET_ARCH64 - && reload_completed - && ((GET_CODE (operands[0]) == REG - && REGNO (operands[0]) < 32) - || (GET_CODE (operands[0]) == SUBREG - && GET_CODE (SUBREG_REG (operands[0])) == REG - && REGNO (SUBREG_REG (operands[0])) < 32))" - [(set (match_dup 2) (not:SI (xor:SI (match_dup 3) (const_int 0)))) - (set (match_dup 4) (not:SI (xor:SI (match_dup 5) (const_int 0))))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - operands[2] = gen_highpart (SImode, operands[0]); - operands[3] = gen_highpart (SImode, operands[1]); - operands[4] = gen_lowpart (SImode, operands[0]); - operands[5] = gen_lowpart (SImode, operands[1]);") - -(define_insn "*one_cmpldi2_sp64" - [(set (match_operand:DI 0 "register_operand" "=r,b") - (not:DI (match_operand:DI 1 "arith_double_operand" "rHI,b")))] - "TARGET_ARCH64" - "@ - xnor\\t%%g0, %1, %0 - fnot1\\t%1, %0" - [(set_attr "type" "unary,fp") - (set_attr "length" "1")]) - -(define_expand "one_cmplsi2" - [(set (match_operand:SI 0 "register_operand" "") - (not:SI (match_operand:SI 1 "arith_operand" "")))] - "" - " -{ - if (TARGET_LIVE_G0 - && GET_CODE (operands[1]) == CONST_INT) - { - rtx zero_reg = gen_reg_rtx (SImode); - - emit_insn (gen_rtx_SET (VOIDmode, zero_reg, const0_rtx)); - emit_insn (gen_rtx_SET (VOIDmode, - operands[0], - gen_rtx_NOT (SImode, - gen_rtx_XOR (SImode, - zero_reg, - operands[1])))); - DONE; - } -}") - -(define_insn "*one_cmplsi2_not_liveg0" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (not:SI (match_operand:SI 1 "arith_operand" "rI,d")))] - "! TARGET_LIVE_G0" - "@ - xnor\\t%%g0, %1, %0 - fnot1s\\t%1, %0" - [(set_attr "type" "unary,fp") - (set_attr "length" "1,1")]) - -(define_insn "*one_cmplsi2_liveg0" - [(set (match_operand:SI 0 "register_operand" "=r,d") - (not:SI (match_operand:SI 1 "arith_operand" "r,d")))] - "TARGET_LIVE_G0" - "@ - xnor\\t%1, 0, %0 - fnot1s\\t%1, %0" - [(set_attr "type" "unary,fp") - (set_attr "length" "1,1")]) - -(define_insn "*cmp_cc_not" - [(set (reg:CC 100) - (compare:CC (not:SI (match_operand:SI 0 "arith_operand" "rI")) - (const_int 0)))] - "! TARGET_LIVE_G0" - "xnorcc\\t%%g0, %0, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_not" - [(set (reg:CCX 100) - (compare:CCX (not:DI (match_operand:DI 0 "arith_double_operand" "rHI")) - (const_int 0)))] - "TARGET_ARCH64" - "xnorcc\\t%%g0, %0, %%g0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_cc_set_not" - [(set (reg:CC 100) - (compare:CC (not:SI (match_operand:SI 1 "arith_operand" "rI")) - (const_int 0))) - (set (match_operand:SI 0 "register_operand" "=r") - (not:SI (match_dup 1)))] - "! TARGET_LIVE_G0" - "xnorcc\\t%%g0, %1, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -(define_insn "*cmp_ccx_set_not" - [(set (reg:CCX 100) - (compare:CCX (not:DI (match_operand:DI 1 "arith_double_operand" "rHI")) - (const_int 0))) - (set (match_operand:DI 0 "register_operand" "=r") - (not:DI (match_dup 1)))] - "TARGET_ARCH64" - "xnorcc\\t%%g0, %1, %0" - [(set_attr "type" "compare") - (set_attr "length" "1")]) - -;; Floating point arithmetic instructions. - -(define_insn "addtf3" - [(set (match_operand:TF 0 "register_operand" "=e") - (plus:TF (match_operand:TF 1 "register_operand" "e") - (match_operand:TF 2 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "faddq\\t%1, %2, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "adddf3" - [(set (match_operand:DF 0 "register_operand" "=e") - (plus:DF (match_operand:DF 1 "register_operand" "e") - (match_operand:DF 2 "register_operand" "e")))] - "TARGET_FPU" - "faddd\\t%1, %2, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "addsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (plus:SF (match_operand:SF 1 "register_operand" "f") - (match_operand:SF 2 "register_operand" "f")))] - "TARGET_FPU" - "fadds\\t%1, %2, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "subtf3" - [(set (match_operand:TF 0 "register_operand" "=e") - (minus:TF (match_operand:TF 1 "register_operand" "e") - (match_operand:TF 2 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fsubq\\t%1, %2, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "subdf3" - [(set (match_operand:DF 0 "register_operand" "=e") - (minus:DF (match_operand:DF 1 "register_operand" "e") - (match_operand:DF 2 "register_operand" "e")))] - "TARGET_FPU" - "fsubd\\t%1, %2, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "subsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (minus:SF (match_operand:SF 1 "register_operand" "f") - (match_operand:SF 2 "register_operand" "f")))] - "TARGET_FPU" - "fsubs\\t%1, %2, %0" - [(set_attr "type" "fp") - (set_attr "length" "1")]) - -(define_insn "multf3" - [(set (match_operand:TF 0 "register_operand" "=e") - (mult:TF (match_operand:TF 1 "register_operand" "e") - (match_operand:TF 2 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fmulq\\t%1, %2, %0" - [(set_attr "type" "fpmul") - (set_attr "length" "1")]) - -(define_insn "muldf3" - [(set (match_operand:DF 0 "register_operand" "=e") - (mult:DF (match_operand:DF 1 "register_operand" "e") - (match_operand:DF 2 "register_operand" "e")))] - "TARGET_FPU" - "fmuld\\t%1, %2, %0" - [(set_attr "type" "fpmul") - (set_attr "length" "1")]) - -(define_insn "mulsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (mult:SF (match_operand:SF 1 "register_operand" "f") - (match_operand:SF 2 "register_operand" "f")))] - "TARGET_FPU" - "fmuls\\t%1, %2, %0" - [(set_attr "type" "fpmul") - (set_attr "length" "1")]) - -(define_insn "*muldf3_extend" - [(set (match_operand:DF 0 "register_operand" "=e") - (mult:DF (float_extend:DF (match_operand:SF 1 "register_operand" "f")) - (float_extend:DF (match_operand:SF 2 "register_operand" "f"))))] - "(TARGET_V8 || TARGET_V9) && TARGET_FPU" - "fsmuld\\t%1, %2, %0" - [(set_attr "type" "fpmul") - (set_attr "length" "1")]) - -(define_insn "*multf3_extend" - [(set (match_operand:TF 0 "register_operand" "=e") - (mult:TF (float_extend:TF (match_operand:DF 1 "register_operand" "e")) - (float_extend:TF (match_operand:DF 2 "register_operand" "e"))))] - "(TARGET_V8 || TARGET_V9) && TARGET_FPU && TARGET_HARD_QUAD" - "fdmulq\\t%1, %2, %0" - [(set_attr "type" "fpmul") - (set_attr "length" "1")]) - -;; don't have timing for quad-prec. divide. -(define_insn "divtf3" - [(set (match_operand:TF 0 "register_operand" "=e") - (div:TF (match_operand:TF 1 "register_operand" "e") - (match_operand:TF 2 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fdivq\\t%1, %2, %0" - [(set_attr "type" "fpdivd") - (set_attr "length" "1")]) - -(define_insn "divdf3" - [(set (match_operand:DF 0 "register_operand" "=e") - (div:DF (match_operand:DF 1 "register_operand" "e") - (match_operand:DF 2 "register_operand" "e")))] - "TARGET_FPU" - "fdivd\\t%1, %2, %0" - [(set_attr "type" "fpdivd") - (set_attr "length" "1")]) - -(define_insn "divsf3" - [(set (match_operand:SF 0 "register_operand" "=f") - (div:SF (match_operand:SF 1 "register_operand" "f") - (match_operand:SF 2 "register_operand" "f")))] - "TARGET_FPU" - "fdivs\\t%1, %2, %0" - [(set_attr "type" "fpdivs") - (set_attr "length" "1")]) - -(define_expand "negtf2" - [(set (match_operand:TF 0 "register_operand" "=e,e") - (neg:TF (match_operand:TF 1 "register_operand" "0,e")))] - "TARGET_FPU" - "") - -(define_insn "*negtf2_notv9" - [(set (match_operand:TF 0 "register_operand" "=e,e") - (neg:TF (match_operand:TF 1 "register_operand" "0,e")))] - ; We don't use quad float insns here so we don't need TARGET_HARD_QUAD. - "TARGET_FPU - && ! TARGET_V9" - "@ - fnegs\\t%0, %0 - #" - [(set_attr "type" "fpmove") - (set_attr "length" "1,2")]) - -(define_split - [(set (match_operand:TF 0 "register_operand" "") - (neg:TF (match_operand:TF 1 "register_operand" "")))] - "TARGET_FPU - && ! TARGET_V9 - && reload_completed - && sparc_absnegfloat_split_legitimate (operands[0], operands[1])" - [(set (match_dup 2) (neg:SF (match_dup 3))) - (set (match_dup 4) (match_dup 5)) - (set (match_dup 6) (match_dup 7))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - if (GET_CODE (operands[1]) == SUBREG) - operands[1] = alter_subreg (operands[1]); - operands[2] = gen_rtx_raw_REG (SFmode, REGNO (operands[0])); - operands[3] = gen_rtx_raw_REG (SFmode, REGNO (operands[1])); - operands[4] = gen_rtx_raw_REG (SFmode, REGNO (operands[0]) + 1); - operands[5] = gen_rtx_raw_REG (SFmode, REGNO (operands[1]) + 1); - operands[6] = gen_rtx_raw_REG (DFmode, REGNO (operands[0]) + 2); - operands[7] = gen_rtx_raw_REG (DFmode, REGNO (operands[1]) + 2);") - -(define_insn "*negtf2_v9" - [(set (match_operand:TF 0 "register_operand" "=e,e") - (neg:TF (match_operand:TF 1 "register_operand" "0,e")))] - ; We don't use quad float insns here so we don't need TARGET_HARD_QUAD. - "TARGET_FPU && TARGET_V9" - "@ - fnegd\\t%0, %0 - #" - [(set_attr "type" "fpmove") - (set_attr "length" "1,2")]) - -(define_split - [(set (match_operand:TF 0 "register_operand" "") - (neg:TF (match_operand:TF 1 "register_operand" "")))] - "TARGET_FPU - && TARGET_V9 - && reload_completed - && sparc_absnegfloat_split_legitimate (operands[0], operands[1])" - [(set (match_dup 2) (neg:DF (match_dup 3))) - (set (match_dup 4) (match_dup 5))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - if (GET_CODE (operands[1]) == SUBREG) - operands[1] = alter_subreg (operands[1]); - operands[2] = gen_rtx_raw_REG (DFmode, REGNO (operands[0])); - operands[3] = gen_rtx_raw_REG (DFmode, REGNO (operands[1])); - operands[4] = gen_rtx_raw_REG (DFmode, REGNO (operands[0]) + 2); - operands[5] = gen_rtx_raw_REG (DFmode, REGNO (operands[1]) + 2);") - -(define_expand "negdf2" - [(set (match_operand:DF 0 "register_operand" "") - (neg:DF (match_operand:DF 1 "register_operand" "")))] - "TARGET_FPU" - "") - -(define_insn "*negdf2_notv9" - [(set (match_operand:DF 0 "register_operand" "=e,e") - (neg:DF (match_operand:DF 1 "register_operand" "0,e")))] - "TARGET_FPU && ! TARGET_V9" - "@ - fnegs\\t%0, %0 - #" - [(set_attr "type" "fpmove") - (set_attr "length" "1,2")]) - -(define_split - [(set (match_operand:DF 0 "register_operand" "") - (neg:DF (match_operand:DF 1 "register_operand" "")))] - "TARGET_FPU - && ! TARGET_V9 - && reload_completed - && sparc_absnegfloat_split_legitimate (operands[0], operands[1])" - [(set (match_dup 2) (neg:SF (match_dup 3))) - (set (match_dup 4) (match_dup 5))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - if (GET_CODE (operands[1]) == SUBREG) - operands[1] = alter_subreg (operands[1]); - operands[2] = gen_rtx_raw_REG (SFmode, REGNO (operands[0])); - operands[3] = gen_rtx_raw_REG (SFmode, REGNO (operands[1])); - operands[4] = gen_rtx_raw_REG (SFmode, REGNO (operands[0]) + 1); - operands[5] = gen_rtx_raw_REG (SFmode, REGNO (operands[1]) + 1);") - -(define_insn "*negdf2_v9" - [(set (match_operand:DF 0 "register_operand" "=e") - (neg:DF (match_operand:DF 1 "register_operand" "e")))] - "TARGET_FPU && TARGET_V9" - "fnegd\\t%1, %0" - [(set_attr "type" "fpmove") - (set_attr "length" "1")]) - -(define_insn "negsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (neg:SF (match_operand:SF 1 "register_operand" "f")))] - "TARGET_FPU" - "fnegs\\t%1, %0" - [(set_attr "type" "fpmove") - (set_attr "length" "1")]) - -(define_expand "abstf2" - [(set (match_operand:TF 0 "register_operand" "") - (abs:TF (match_operand:TF 1 "register_operand" "")))] - "TARGET_FPU" - "") - -(define_insn "*abstf2_notv9" - [(set (match_operand:TF 0 "register_operand" "=e,e") - (abs:TF (match_operand:TF 1 "register_operand" "0,e")))] - ; We don't use quad float insns here so we don't need TARGET_HARD_QUAD. - "TARGET_FPU && ! TARGET_V9" - "@ - fabss\\t%0, %0 - #" - [(set_attr "type" "fpmove") - (set_attr "length" "1,2")]) - -(define_split - [(set (match_operand:TF 0 "register_operand" "=e,e") - (abs:TF (match_operand:TF 1 "register_operand" "0,e")))] - "TARGET_FPU - && ! TARGET_V9 - && reload_completed - && sparc_absnegfloat_split_legitimate (operands[0], operands[1])" - [(set (match_dup 2) (abs:SF (match_dup 3))) - (set (match_dup 4) (match_dup 5)) - (set (match_dup 6) (match_dup 7))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - if (GET_CODE (operands[1]) == SUBREG) - operands[1] = alter_subreg (operands[1]); - operands[2] = gen_rtx_raw_REG (SFmode, REGNO (operands[0])); - operands[3] = gen_rtx_raw_REG (SFmode, REGNO (operands[1])); - operands[4] = gen_rtx_raw_REG (SFmode, REGNO (operands[0]) + 1); - operands[5] = gen_rtx_raw_REG (SFmode, REGNO (operands[1]) + 1); - operands[6] = gen_rtx_raw_REG (DFmode, REGNO (operands[0]) + 2); - operands[7] = gen_rtx_raw_REG (DFmode, REGNO (operands[1]) + 2);") - -(define_insn "*abstf2_hq_v9" - [(set (match_operand:TF 0 "register_operand" "=e,e") - (abs:TF (match_operand:TF 1 "register_operand" "0,e")))] - "TARGET_FPU && TARGET_V9 && TARGET_HARD_QUAD" - "@ - fabsd\\t%0, %0 - fabsq\\t%1, %0" - [(set_attr "type" "fpmove") - (set_attr "length" "1")]) - -(define_insn "*abstf2_v9" - [(set (match_operand:TF 0 "register_operand" "=e,e") - (abs:TF (match_operand:TF 1 "register_operand" "0,e")))] - "TARGET_FPU && TARGET_V9 && !TARGET_HARD_QUAD" - "@ - fabsd\\t%0, %0 - #" - [(set_attr "type" "fpmove") - (set_attr "length" "1,2")]) - -(define_split - [(set (match_operand:TF 0 "register_operand" "=e,e") - (abs:TF (match_operand:TF 1 "register_operand" "0,e")))] - "TARGET_FPU - && TARGET_V9 - && reload_completed - && sparc_absnegfloat_split_legitimate (operands[0], operands[1])" - [(set (match_dup 2) (abs:DF (match_dup 3))) - (set (match_dup 4) (match_dup 5))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - if (GET_CODE (operands[1]) == SUBREG) - operands[1] = alter_subreg (operands[1]); - operands[2] = gen_rtx_raw_REG (DFmode, REGNO (operands[0])); - operands[3] = gen_rtx_raw_REG (DFmode, REGNO (operands[1])); - operands[4] = gen_rtx_raw_REG (DFmode, REGNO (operands[0]) + 2); - operands[5] = gen_rtx_raw_REG (DFmode, REGNO (operands[1]) + 2);") - -(define_expand "absdf2" - [(set (match_operand:DF 0 "register_operand" "") - (abs:DF (match_operand:DF 1 "register_operand" "")))] - "TARGET_FPU" - "") - -(define_insn "*absdf2_notv9" - [(set (match_operand:DF 0 "register_operand" "=e,e") - (abs:DF (match_operand:DF 1 "register_operand" "0,e")))] - "TARGET_FPU && ! TARGET_V9" - "@ - fabss\\t%0, %0 - #" - [(set_attr "type" "fpmove") - (set_attr "length" "1,2")]) - -(define_split - [(set (match_operand:DF 0 "register_operand" "=e,e") - (abs:DF (match_operand:DF 1 "register_operand" "0,e")))] - "TARGET_FPU - && ! TARGET_V9 - && reload_completed - && sparc_absnegfloat_split_legitimate (operands[0], operands[1])" - [(set (match_dup 2) (abs:SF (match_dup 3))) - (set (match_dup 4) (match_dup 5))] - "if (GET_CODE (operands[0]) == SUBREG) - operands[0] = alter_subreg (operands[0]); - if (GET_CODE (operands[1]) == SUBREG) - operands[1] = alter_subreg (operands[1]); - operands[2] = gen_rtx_raw_REG (SFmode, REGNO (operands[0])); - operands[3] = gen_rtx_raw_REG (SFmode, REGNO (operands[1])); - operands[4] = gen_rtx_raw_REG (SFmode, REGNO (operands[0]) + 1); - operands[5] = gen_rtx_raw_REG (SFmode, REGNO (operands[1]) + 1);") - -(define_insn "*absdf2_v9" - [(set (match_operand:DF 0 "register_operand" "=e") - (abs:DF (match_operand:DF 1 "register_operand" "e")))] - "TARGET_FPU && TARGET_V9" - "fabsd\\t%1, %0" - [(set_attr "type" "fpmove") - (set_attr "length" "1")]) - -(define_insn "abssf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (abs:SF (match_operand:SF 1 "register_operand" "f")))] - "TARGET_FPU" - "fabss\\t%1, %0" - [(set_attr "type" "fpmove") - (set_attr "length" "1")]) - -(define_insn "sqrttf2" - [(set (match_operand:TF 0 "register_operand" "=e") - (sqrt:TF (match_operand:TF 1 "register_operand" "e")))] - "TARGET_FPU && TARGET_HARD_QUAD" - "fsqrtq\\t%1, %0" - [(set_attr "type" "fpsqrt") - (set_attr "length" "1")]) - -(define_insn "sqrtdf2" - [(set (match_operand:DF 0 "register_operand" "=e") - (sqrt:DF (match_operand:DF 1 "register_operand" "e")))] - "TARGET_FPU" - "fsqrtd\\t%1, %0" - [(set_attr "type" "fpsqrt") - (set_attr "length" "1")]) - -(define_insn "sqrtsf2" - [(set (match_operand:SF 0 "register_operand" "=f") - (sqrt:SF (match_operand:SF 1 "register_operand" "f")))] - "TARGET_FPU" - "fsqrts\\t%1, %0" - [(set_attr "type" "fpsqrt") - (set_attr "length" "1")]) - -;;- arithmetic shift instructions - -(define_insn "ashlsi3" - [(set (match_operand:SI 0 "register_operand" "=r") - (ashift:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI")))] - "" - "* -{ - if (GET_CODE (operands[2]) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 31) - operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); - - return \"sll\\t%1, %2, %0\"; -}" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -;; We special case multiplication by two, as add can be done -;; in both ALUs, while shift only in IEU0 on UltraSPARC. -(define_insn "*ashlsi3_const1" - [(set (match_operand:SI 0 "register_operand" "=r") - (ashift:SI (match_operand:SI 1 "register_operand" "r") - (const_int 1)))] - "" - "add\\t%1, %1, %0" - [(set_attr "type" "binary") - (set_attr "length" "1")]) - -(define_expand "ashldi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI")))] - "TARGET_ARCH64 || TARGET_V8PLUS" - " -{ - if (! TARGET_ARCH64) - { - if (GET_CODE (operands[2]) == CONST_INT) - FAIL; - emit_insn (gen_ashldi3_v8plus (operands[0], operands[1], operands[2])); - DONE; - } -}") - -;; We special case multiplication by two, as add can be done -;; in both ALUs, while shift only in IEU0 on UltraSPARC. -(define_insn "*ashldi3_const1" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (match_operand:DI 1 "register_operand" "r") - (const_int 1)))] - "TARGET_ARCH64" - "add\\t%1, %1, %0" - [(set_attr "type" "binary") - (set_attr "length" "1")]) - -(define_insn "*ashldi3_sp64" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashift:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI")))] - "TARGET_ARCH64" - "* -{ - if (GET_CODE (operands[2]) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 63) - operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); - - return \"sllx\\t%1, %2, %0\"; -}" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -;; XXX UGH! -(define_insn "ashldi3_v8plus" - [(set (match_operand:DI 0 "register_operand" "=&h,&h,r") - (ashift:DI (match_operand:DI 1 "arith_operand" "rI,0,rI") - (match_operand:SI 2 "arith_operand" "rI,rI,rI"))) - (clobber (match_scratch:SI 3 "=X,X,&h"))] - "TARGET_V8PLUS" - "*return sparc_v8plus_shift (operands, insn, \"sllx\");" - [(set_attr "length" "5,5,6")]) - -;; Optimize (1LL< 31) - operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); - - return \"sra\\t%1, %2, %0\"; -}" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -(define_insn "*ashrsi3_extend" - [(set (match_operand:DI 0 "register_operand" "=r") - (sign_extend:DI (ashiftrt:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "r"))))] - "TARGET_ARCH64" - "sra\\t%1, %2, %0" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -;; This handles the case as above, but with constant shift instead of -;; register. Combiner "simplifies" it for us a little bit though. -(define_insn "*ashrsi3_extend2" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashiftrt:DI (ashift:DI (subreg:DI (match_operand:SI 1 "register_operand" "r") 0) - (const_int 32)) - (match_operand:SI 2 "small_int_or_double" "n")))] - "TARGET_ARCH64 - && ((GET_CODE (operands[2]) == CONST_INT - && INTVAL (operands[2]) >= 32 && INTVAL (operands[2]) < 64) - || (GET_CODE (operands[2]) == CONST_DOUBLE - && !CONST_DOUBLE_HIGH (operands[2]) - && CONST_DOUBLE_LOW (operands[2]) >= 32 - && CONST_DOUBLE_LOW (operands[2]) < 64))" - "* -{ - operands[2] = GEN_INT (INTVAL (operands[2]) - 32); - - return \"sra\\t%1, %2, %0\"; -}" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -(define_expand "ashrdi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashiftrt:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI")))] - "TARGET_ARCH64 || TARGET_V8PLUS" - " -{ - if (! TARGET_ARCH64) - { - if (GET_CODE (operands[2]) == CONST_INT) - FAIL; /* prefer generic code in this case */ - emit_insn (gen_ashrdi3_v8plus (operands[0], operands[1], operands[2])); - DONE; - } -}") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (ashiftrt:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI")))] - "TARGET_ARCH64" - "* -{ - if (GET_CODE (operands[2]) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 63) - operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); - - return \"srax\\t%1, %2, %0\"; -}" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -;; XXX -(define_insn "ashrdi3_v8plus" - [(set (match_operand:DI 0 "register_operand" "=&h,&h,r") - (ashiftrt:DI (match_operand:DI 1 "arith_operand" "rI,0,rI") - (match_operand:SI 2 "arith_operand" "rI,rI,rI"))) - (clobber (match_scratch:SI 3 "=X,X,&h"))] - "TARGET_V8PLUS" - "*return sparc_v8plus_shift (operands, insn, \"srax\");" - [(set_attr "length" "5,5,6")]) - -(define_insn "lshrsi3" - [(set (match_operand:SI 0 "register_operand" "=r") - (lshiftrt:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI")))] - "" - "* -{ - if (GET_CODE (operands[2]) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 31) - operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); - - return \"srl\\t%1, %2, %0\"; -}" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -;; This handles the case where -;; (zero_extend:DI (lshiftrt:SI (match_operand:SI) (match_operand:SI))), -;; but combiner "simplifies" it for us. -(define_insn "*lshrsi3_extend" - [(set (match_operand:DI 0 "register_operand" "=r") - (and:DI (subreg:DI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "r")) 0) - (match_operand 3 "" "")))] - "TARGET_ARCH64 - && ((GET_CODE (operands[3]) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (operands[3]) == 0 - && CONST_DOUBLE_LOW (operands[3]) == 0xffffffff) -#if HOST_BITS_PER_WIDE_INT >= 64 - || (GET_CODE (operands[3]) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (operands[3]) == 0xffffffff) -#endif - )" - "srl\\t%1, %2, %0" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -;; This handles the case where -;; (lshiftrt:DI (zero_extend:DI (match_operand:SI)) (const_int >=0 < 32)) -;; but combiner "simplifies" it for us. -(define_insn "*lshrsi3_extend2" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extract:DI (subreg:DI (match_operand:SI 1 "register_operand" "r") 0) - (match_operand 2 "small_int_or_double" "n") - (const_int 32)))] - "TARGET_ARCH64 - && ((GET_CODE (operands[2]) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 32) - || (GET_CODE (operands[2]) == CONST_DOUBLE - && CONST_DOUBLE_HIGH (operands[2]) == 0 - && (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (operands[2]) < 32))" - "* -{ - operands[2] = GEN_INT (32 - INTVAL (operands[2])); - - return \"srl\\t%1, %2, %0\"; -}" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -(define_expand "lshrdi3" - [(set (match_operand:DI 0 "register_operand" "=r") - (lshiftrt:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI")))] - "TARGET_ARCH64 || TARGET_V8PLUS" - " -{ - if (! TARGET_ARCH64) - { - if (GET_CODE (operands[2]) == CONST_INT) - FAIL; - emit_insn (gen_lshrdi3_v8plus (operands[0], operands[1], operands[2])); - DONE; - } -}") - -(define_insn "" - [(set (match_operand:DI 0 "register_operand" "=r") - (lshiftrt:DI (match_operand:DI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI")))] - "TARGET_ARCH64" - "* -{ - if (GET_CODE (operands[2]) == CONST_INT - && (unsigned HOST_WIDE_INT) INTVAL (operands[2]) > 63) - operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); - - return \"srlx\\t%1, %2, %0\"; -}" - [(set_attr "type" "shift") - (set_attr "length" "1")]) - -;; XXX -(define_insn "lshrdi3_v8plus" - [(set (match_operand:DI 0 "register_operand" "=&h,&h,r") - (lshiftrt:DI (match_operand:DI 1 "arith_operand" "rI,0,rI") - (match_operand:SI 2 "arith_operand" "rI,rI,rI"))) - (clobber (match_scratch:SI 3 "=X,X,&h"))] - "TARGET_V8PLUS" - "*return sparc_v8plus_shift (operands, insn, \"srlx\");" - [(set_attr "length" "5,5,6")]) - -;; Unconditional and other jump instructions -;; On the Sparc, by setting the annul bit on an unconditional branch, the -;; following insn is never executed. This saves us a nop. Dbx does not -;; handle such branches though, so we only use them when optimizing. -(define_insn "jump" - [(set (pc) (label_ref (match_operand 0 "" "")))] - "" - "* -{ - /* TurboSparc is reported to have problems with - with - foo: b,a foo - i.e. an empty loop with the annul bit set. The workaround is to use - foo: b foo; nop - instead. */ - - if (! TARGET_V9 && flag_delayed_branch - && (insn_addresses[INSN_UID (operands[0])] - == insn_addresses[INSN_UID (insn)])) - return \"b\\t%l0%#\"; - else - return TARGET_V9 ? \"ba,pt%*\\t%%xcc, %l0%(\" : \"b%*\\t%l0%(\"; -}" - [(set_attr "type" "uncond_branch")]) - -(define_expand "tablejump" - [(parallel [(set (pc) (match_operand 0 "register_operand" "r")) - (use (label_ref (match_operand 1 "" "")))])] - "" - " -{ - if (GET_MODE (operands[0]) != CASE_VECTOR_MODE) - abort (); - - /* In pic mode, our address differences are against the base of the - table. Add that base value back in; CSE ought to be able to combine - the two address loads. */ - if (flag_pic) - { - rtx tmp, tmp2; - tmp = gen_rtx_LABEL_REF (Pmode, operands[1]); - tmp2 = operands[0]; - if (CASE_VECTOR_MODE != Pmode) - tmp2 = gen_rtx_SIGN_EXTEND (Pmode, tmp2); - tmp = gen_rtx_PLUS (Pmode, tmp2, tmp); - operands[0] = memory_address (Pmode, tmp); - } -}") - -(define_insn "*tablejump_sp32" - [(set (pc) (match_operand:SI 0 "address_operand" "p")) - (use (label_ref (match_operand 1 "" "")))] - "! TARGET_PTR64" - "jmp\\t%a0%#" - [(set_attr "type" "uncond_branch")]) - -(define_insn "*tablejump_sp64" - [(set (pc) (match_operand:DI 0 "address_operand" "p")) - (use (label_ref (match_operand 1 "" "")))] - "TARGET_PTR64" - "jmp\\t%a0%#" - [(set_attr "type" "uncond_branch")]) - -;; This pattern recognizes the "instruction" that appears in -;; a function call that wants a structure value, -;; to inform the called function if compiled with Sun CC. -;(define_insn "*unimp_insn" -; [(match_operand:SI 0 "immediate_operand" "")] -; "GET_CODE (operands[0]) == CONST_INT && INTVAL (operands[0]) > 0" -; "unimp\\t%0" -; [(set_attr "type" "marker")]) - -;;- jump to subroutine -(define_expand "call" - ;; Note that this expression is not used for generating RTL. - ;; All the RTL is generated explicitly below. - [(call (match_operand 0 "call_operand" "") - (match_operand 3 "" "i"))] - ;; operands[2] is next_arg_register - ;; operands[3] is struct_value_size_rtx. - "" - " -{ - rtx fn_rtx, nregs_rtx; - - if (GET_MODE (operands[0]) != FUNCTION_MODE) - abort (); - - if (GET_CODE (XEXP (operands[0], 0)) == LABEL_REF) - { - /* This is really a PIC sequence. We want to represent - it as a funny jump so its delay slots can be filled. - - ??? But if this really *is* a CALL, will not it clobber the - call-clobbered registers? We lose this if it is a JUMP_INSN. - Why cannot we have delay slots filled if it were a CALL? */ - - if (! TARGET_ARCH64 && INTVAL (operands[3]) != 0) - emit_jump_insn - (gen_rtx_PARALLEL (VOIDmode, - gen_rtvec (3, - gen_rtx_SET (VOIDmode, pc_rtx, - XEXP (operands[0], 0)), - operands[3], - gen_rtx_CLOBBER (VOIDmode, - gen_rtx_REG (Pmode, 15))))); - else - emit_jump_insn - (gen_rtx_PARALLEL (VOIDmode, - gen_rtvec (2, - gen_rtx_SET (VOIDmode, pc_rtx, - XEXP (operands[0], 0)), - gen_rtx_CLOBBER (VOIDmode, - gen_rtx_REG (Pmode, 15))))); - goto finish_call; - } - - fn_rtx = operands[0]; - - /* Count the number of parameter registers being used by this call. - if that argument is NULL, it means we are using them all, which - means 6 on the sparc. */ -#if 0 - if (operands[2]) - nregs_rtx = GEN_INT (REGNO (operands[2]) - 8); - else - nregs_rtx = GEN_INT (6); -#else - nregs_rtx = const0_rtx; -#endif - - if (! TARGET_ARCH64 && INTVAL (operands[3]) != 0) - emit_call_insn - (gen_rtx_PARALLEL (VOIDmode, - gen_rtvec (3, gen_rtx_CALL (VOIDmode, fn_rtx, nregs_rtx), - operands[3], - gen_rtx_CLOBBER (VOIDmode, - gen_rtx_REG (Pmode, 15))))); - else - emit_call_insn - (gen_rtx_PARALLEL (VOIDmode, - gen_rtvec (2, gen_rtx_CALL (VOIDmode, fn_rtx, nregs_rtx), - gen_rtx_CLOBBER (VOIDmode, - gen_rtx_REG (Pmode, 15))))); - - finish_call: -#if 0 - /* If this call wants a structure value, - emit an unimp insn to let the called function know about this. */ - if (! TARGET_ARCH64 && INTVAL (operands[3]) > 0) - { - rtx insn = emit_insn (operands[3]); - SCHED_GROUP_P (insn) = 1; - } -#endif - - DONE; -}") - -;; We can't use the same pattern for these two insns, because then registers -;; in the address may not be properly reloaded. - -(define_insn "*call_address_sp32" - [(call (mem:SI (match_operand:SI 0 "address_operand" "p")) - (match_operand 1 "" "")) - (clobber (reg:SI 15))] - ;;- Do not use operand 1 for most machines. - "! TARGET_PTR64" - "call\\t%a0, %1%#" - [(set_attr "type" "call")]) - -(define_insn "*call_symbolic_sp32" - [(call (mem:SI (match_operand:SI 0 "symbolic_operand" "s")) - (match_operand 1 "" "")) - (clobber (reg:SI 15))] - ;;- Do not use operand 1 for most machines. - "! TARGET_PTR64" - "call\\t%a0, %1%#" - [(set_attr "type" "call")]) - -(define_insn "*call_address_sp64" - [(call (mem:SI (match_operand:DI 0 "address_operand" "p")) - (match_operand 1 "" "")) - (clobber (reg:DI 15))] - ;;- Do not use operand 1 for most machines. - "TARGET_PTR64" - "call\\t%a0, %1%#" - [(set_attr "type" "call")]) - -(define_insn "*call_symbolic_sp64" - [(call (mem:SI (match_operand:DI 0 "symbolic_operand" "s")) - (match_operand 1 "" "")) - (clobber (reg:DI 15))] - ;;- Do not use operand 1 for most machines. - "TARGET_PTR64" - "call\\t%a0, %1%#" - [(set_attr "type" "call")]) - -;; This is a call that wants a structure value. -;; There is no such critter for v9 (??? we may need one anyway). -(define_insn "*call_address_struct_value_sp32" - [(call (mem:SI (match_operand:SI 0 "address_operand" "p")) - (match_operand 1 "" "")) - (match_operand 2 "immediate_operand" "") - (clobber (reg:SI 15))] - ;;- Do not use operand 1 for most machines. - "! TARGET_ARCH64 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0" - "call\\t%a0, %1\\n\\tnop\\n\\tunimp\\t%2" - [(set_attr "type" "call_no_delay_slot")]) - -;; This is a call that wants a structure value. -;; There is no such critter for v9 (??? we may need one anyway). -(define_insn "*call_symbolic_struct_value_sp32" - [(call (mem:SI (match_operand:SI 0 "symbolic_operand" "s")) - (match_operand 1 "" "")) - (match_operand 2 "immediate_operand" "") - (clobber (reg:SI 15))] - ;;- Do not use operand 1 for most machines. - "! TARGET_ARCH64 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 0" - "call\\t%a0, %1\\n\\tnop\\n\\tunimp\\t%2" - [(set_attr "type" "call_no_delay_slot")]) - -;; This is a call that may want a structure value. This is used for -;; untyped_calls. -(define_insn "*call_address_untyped_struct_value_sp32" - [(call (mem:SI (match_operand:SI 0 "address_operand" "p")) - (match_operand 1 "" "")) - (match_operand 2 "immediate_operand" "") - (clobber (reg:SI 15))] - ;;- Do not use operand 1 for most machines. - "! TARGET_ARCH64 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0" - "call\\t%a0, %1\\n\\tnop\\n\\tnop" - [(set_attr "type" "call_no_delay_slot")]) - -;; This is a call that wants a structure value. -(define_insn "*call_symbolic_untyped_struct_value_sp32" - [(call (mem:SI (match_operand:SI 0 "symbolic_operand" "s")) - (match_operand 1 "" "")) - (match_operand 2 "immediate_operand" "") - (clobber (reg:SI 15))] - ;;- Do not use operand 1 for most machines. - "! TARGET_ARCH64 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0" - "call\\t%a0, %1\\n\\tnop\\n\\tnop" - [(set_attr "type" "call_no_delay_slot")]) - -(define_expand "call_value" - ;; Note that this expression is not used for generating RTL. - ;; All the RTL is generated explicitly below. - [(set (match_operand 0 "register_operand" "=rf") - (call (match_operand:SI 1 "" "") - (match_operand 4 "" "")))] - ;; operand 2 is stack_size_rtx - ;; operand 3 is next_arg_register - "" - " -{ - rtx fn_rtx, nregs_rtx; - rtvec vec; - - if (GET_MODE (operands[1]) != FUNCTION_MODE) - abort (); - - fn_rtx = operands[1]; - -#if 0 - if (operands[3]) - nregs_rtx = GEN_INT (REGNO (operands[3]) - 8); - else - nregs_rtx = GEN_INT (6); -#else - nregs_rtx = const0_rtx; -#endif - - vec = gen_rtvec (2, - gen_rtx_SET (VOIDmode, operands[0], - gen_rtx_CALL (VOIDmode, fn_rtx, nregs_rtx)), - gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 15))); - - emit_call_insn (gen_rtx_PARALLEL (VOIDmode, vec)); - - DONE; -}") - -(define_insn "*call_value_address_sp32" - [(set (match_operand 0 "" "=rf") - (call (mem:SI (match_operand:SI 1 "address_operand" "p")) - (match_operand 2 "" ""))) - (clobber (reg:SI 15))] - ;;- Do not use operand 2 for most machines. - "! TARGET_PTR64" - "call\\t%a1, %2%#" - [(set_attr "type" "call")]) - -(define_insn "*call_value_symbolic_sp32" - [(set (match_operand 0 "" "=rf") - (call (mem:SI (match_operand:SI 1 "symbolic_operand" "s")) - (match_operand 2 "" ""))) - (clobber (reg:SI 15))] - ;;- Do not use operand 2 for most machines. - "! TARGET_PTR64" - "call\\t%a1, %2%#" - [(set_attr "type" "call")]) - -(define_insn "*call_value_address_sp64" - [(set (match_operand 0 "" "") - (call (mem:SI (match_operand:DI 1 "address_operand" "p")) - (match_operand 2 "" ""))) - (clobber (reg:DI 15))] - ;;- Do not use operand 2 for most machines. - "TARGET_PTR64" - "call\\t%a1, %2%#" - [(set_attr "type" "call")]) - -(define_insn "*call_value_symbolic_sp64" - [(set (match_operand 0 "" "") - (call (mem:SI (match_operand:DI 1 "symbolic_operand" "s")) - (match_operand 2 "" ""))) - (clobber (reg:DI 15))] - ;;- Do not use operand 2 for most machines. - "TARGET_PTR64" - "call\\t%a1, %2%#" - [(set_attr "type" "call")]) - -(define_expand "untyped_call" - [(parallel [(call (match_operand 0 "" "") - (const_int 0)) - (match_operand 1 "" "") - (match_operand 2 "" "")])] - "" - " -{ - int i; - - /* Pass constm1 to indicate that it may expect a structure value, but - we don't know what size it is. */ - emit_call_insn (gen_call (operands[0], const0_rtx, NULL, constm1_rtx)); - - for (i = 0; i < XVECLEN (operands[2], 0); i++) - { - rtx set = XVECEXP (operands[2], 0, i); - emit_move_insn (SET_DEST (set), SET_SRC (set)); - } - - /* The optimizer does not know that the call sets the function value - registers we stored in the result block. We avoid problems by - claiming that all hard registers are used and clobbered at this - point. */ - emit_insn (gen_blockage ()); - - DONE; -}") - -;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and -;; all of memory. This blocks insns from being moved across this point. - -(define_insn "blockage" - [(unspec_volatile [(const_int 0)] 0)] - "" - "" - [(set_attr "length" "0")]) - -;; Prepare to return any type including a structure value. - -(define_expand "untyped_return" - [(match_operand:BLK 0 "memory_operand" "") - (match_operand 1 "" "")] - "" - " -{ - rtx valreg1 = gen_rtx_REG (DImode, 24); - rtx valreg2 = gen_rtx_REG (TARGET_ARCH64 ? TFmode : DFmode, 32); - rtx result = operands[0]; - - if (! TARGET_ARCH64) - { - rtx rtnreg = gen_rtx_REG (SImode, (current_function_uses_only_leaf_regs - ? 15 : 31)); - rtx value = gen_reg_rtx (SImode); - - /* Fetch the instruction where we will return to and see if it's an unimp - instruction (the most significant 10 bits will be zero). If so, - update the return address to skip the unimp instruction. */ - emit_move_insn (value, - gen_rtx_MEM (SImode, plus_constant (rtnreg, 8))); - emit_insn (gen_lshrsi3 (value, value, GEN_INT (22))); - emit_insn (gen_update_return (rtnreg, value)); - } - - /* Reload the function value registers. */ - emit_move_insn (valreg1, change_address (result, DImode, XEXP (result, 0))); - emit_move_insn (valreg2, - change_address (result, TARGET_ARCH64 ? TFmode : DFmode, - plus_constant (XEXP (result, 0), 8))); - - /* Put USE insns before the return. */ - emit_insn (gen_rtx_USE (VOIDmode, valreg1)); - emit_insn (gen_rtx_USE (VOIDmode, valreg2)); - - /* Construct the return. */ - expand_null_return (); - - DONE; -}") - -;; This is a bit of a hack. We're incrementing a fixed register (%i7), -;; and parts of the compiler don't want to believe that the add is needed. - -(define_insn "update_return" - [(unspec:SI [(match_operand:SI 0 "register_operand" "r") - (match_operand:SI 1 "register_operand" "r")] 1)] - "! TARGET_ARCH64" - "cmp %1,0\;be,a .+8\;add %0,4,%0" - [(set_attr "type" "multi")]) - -(define_insn "return" - [(return) - (use (reg:SI 31))] - "! TARGET_EPILOGUE" - "* return output_return (operands);" - [(set_attr "type" "return")]) - -(define_peephole - [(set (match_operand:SI 0 "register_operand" "=r") - (match_operand:SI 1 "arith_operand" "rI")) - (parallel [(return) - (use (reg:SI 31))])] - "sparc_return_peephole_ok (operands[0], operands[1])" - "return\\t%%i7+8\\n\\tmov\\t%Y1, %Y0") - -(define_insn "nop" - [(const_int 0)] - "" - "nop" - [(set_attr "type" "ialu") - (set_attr "length" "1")]) - -(define_expand "indirect_jump" - [(set (pc) (match_operand 0 "address_operand" "p"))] - "" - "") - -(define_insn "*branch_sp32" - [(set (pc) (match_operand:SI 0 "address_operand" "p"))] - "! TARGET_PTR64" - "jmp\\t%a0%#" - [(set_attr "type" "uncond_branch")]) - -(define_insn "*branch_sp64" - [(set (pc) (match_operand:DI 0 "address_operand" "p"))] - "TARGET_PTR64" - "jmp\\t%a0%#" - [(set_attr "type" "uncond_branch")]) - -;; ??? Doesn't work with -mflat. -(define_expand "nonlocal_goto" - [(match_operand:SI 0 "general_operand" "") - (match_operand:SI 1 "general_operand" "") - (match_operand:SI 2 "general_operand" "") - (match_operand:SI 3 "" "")] - "" - " -{ -#if 0 - rtx chain = operands[0]; -#endif - rtx fp = operands[1]; - rtx stack = operands[2]; - rtx lab = operands[3]; - rtx labreg; - - /* Trap instruction to flush all the register windows. */ - emit_insn (gen_flush_register_windows ()); - - /* Load the fp value for the containing fn into %fp. This is needed - because STACK refers to %fp. Note that virtual register instantiation - fails if the virtual %fp isn't set from a register. */ - if (GET_CODE (fp) != REG) - fp = force_reg (Pmode, fp); - emit_move_insn (virtual_stack_vars_rtx, fp); - - /* Find the containing function's current nonlocal goto handler, - which will do any cleanups and then jump to the label. */ - labreg = gen_rtx_REG (Pmode, 8); - emit_move_insn (labreg, lab); - - /* Restore %fp from stack pointer value for containing function. - The restore insn that follows will move this to %sp, - and reload the appropriate value into %fp. */ - emit_move_insn (frame_pointer_rtx, stack); - - /* USE of frame_pointer_rtx added for consistency; not clear if - really needed. */ - /*emit_insn (gen_rtx_USE (VOIDmode, frame_pointer_rtx));*/ - emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx)); - -#if 0 - /* Return, restoring reg window and jumping to goto handler. */ - if (TARGET_V9 && GET_CODE (chain) == CONST_INT - && ! (INTVAL (chain) & ~(HOST_WIDE_INT)0xffffffff)) - { - emit_insn (gen_goto_handler_and_restore_v9 (labreg, static_chain_rtx, - chain)); - emit_barrier (); - DONE; - } - /* Put in the static chain register the nonlocal label address. */ - emit_move_insn (static_chain_rtx, chain); -#endif - - emit_insn (gen_rtx_USE (VOIDmode, static_chain_rtx)); - emit_insn (gen_goto_handler_and_restore (labreg)); - emit_barrier (); - DONE; -}") - -;; Special trap insn to flush register windows. -(define_insn "flush_register_windows" - [(unspec_volatile [(const_int 0)] 1)] - "" - "* return TARGET_V9 ? \"flushw\" : \"ta\\t3\";" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "goto_handler_and_restore" - [(unspec_volatile [(match_operand 0 "register_operand" "=r")] 2)] - "" - "jmp\\t%0+0\\n\\trestore" - [(set_attr "type" "misc") - (set_attr "length" "2")]) - -;;(define_insn "goto_handler_and_restore_v9" -;; [(unspec_volatile [(match_operand:SI 0 "register_operand" "=r,r") -;; (match_operand:SI 1 "register_operand" "=r,r") -;; (match_operand:SI 2 "const_int_operand" "I,n")] 3)] -;; "TARGET_V9 && ! TARGET_ARCH64" -;; "@ -;; return\\t%0+0\\n\\tmov\\t%2, %Y1 -;; sethi\\t%%hi(%2), %1\\n\\treturn\\t%0+0\\n\\tor\\t%Y1, %%lo(%2), %Y1" -;; [(set_attr "type" "misc") -;; (set_attr "length" "2,3")]) -;; -;;(define_insn "*goto_handler_and_restore_v9_sp64" -;; [(unspec_volatile [(match_operand:DI 0 "register_operand" "=r,r") -;; (match_operand:DI 1 "register_operand" "=r,r") -;; (match_operand:SI 2 "const_int_operand" "I,n")] 3)] -;; "TARGET_V9 && TARGET_ARCH64" -;; "@ -;; return\\t%0+0\\n\\tmov\\t%2, %Y1 -;; sethi\\t%%hi(%2), %1\\n\\treturn\\t%0+0\\n\\tor\\t%Y1, %%lo(%2), %Y1" -;; [(set_attr "type" "misc") -;; (set_attr "length" "2,3")]) - -;; Pattern for use after a setjmp to store FP and the return register -;; into the stack area. - -(define_expand "setjmp" - [(const_int 0)] - "" - " -{ - if (TARGET_ARCH64) - emit_insn (gen_setjmp_64 ()); - else - emit_insn (gen_setjmp_32 ()); - DONE; -}") - -(define_expand "setjmp_32" - [(set (mem:SI (plus:SI (reg:SI 14) (const_int 56))) (match_dup 0)) - (set (mem:SI (plus:SI (reg:SI 14) (const_int 60))) (reg:SI 31))] - "" - " -{ operands[0] = frame_pointer_rtx; }") - -(define_expand "setjmp_64" - [(set (mem:DI (plus:DI (reg:DI 14) (const_int 112))) (match_dup 0)) - (set (mem:DI (plus:DI (reg:DI 14) (const_int 120))) (reg:DI 31))] - "" - " -{ operands[0] = frame_pointer_rtx; }") - -;; Special pattern for the FLUSH instruction. - -(define_insn "flush" - [(unspec_volatile [(match_operand 0 "memory_operand" "m")] 4)] - "" - "* return TARGET_V9 ? \"flush\\t%f0\" : \"iflush\\t%f0\";" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -;; find first set. - -;; The scan instruction searches from the most significant bit while ffs -;; searches from the least significant bit. The bit index and treatment of -;; zero also differ. It takes at least 7 instructions to get the proper -;; result. Here is an obvious 8 instruction sequence. - -;; XXX -(define_insn "ffssi2" - [(set (match_operand:SI 0 "register_operand" "=&r") - (ffs:SI (match_operand:SI 1 "register_operand" "r"))) - (clobber (match_scratch:SI 2 "=&r"))] - "TARGET_SPARCLITE || TARGET_SPARCLET" - "* -{ - if (TARGET_LIVE_G0) - output_asm_insn (\"and %%g0,0,%%g0\", operands); - return \"sub %%g0,%1,%0\;and %0,%1,%0\;scan %0,0,%0\;mov 32,%2\;sub %2,%0,%0\;sra %0,31,%2\;and %2,31,%2\;add %2,%0,%0\"; -}" - [(set_attr "type" "multi") - (set_attr "length" "8")]) - -;; ??? This should be a define expand, so that the extra instruction have -;; a chance of being optimized away. - -;; Disabled because none of the UltraSparcs implement popc. The HAL R1 -;; does, but no one uses that and we don't have a switch for it. -; -;(define_insn "ffsdi2" -; [(set (match_operand:DI 0 "register_operand" "=&r") -; (ffs:DI (match_operand:DI 1 "register_operand" "r"))) -; (clobber (match_scratch:DI 2 "=&r"))] -; "TARGET_ARCH64" -; "neg %1,%2\;xnor %1,%2,%2\;popc %2,%0\;movzr %1,0,%0" -; [(set_attr "type" "multi") -; (set_attr "length" "4")]) - - -;; Peepholes go at the end. - -;; Optimize consecutive loads or stores into ldd and std when possible. -;; The conditions in which we do this are very restricted and are -;; explained in the code for {registers,memory}_ok_for_ldd functions. - -(define_peephole - [(set (match_operand:SI 0 "memory_operand" "") - (const_int 0)) - (set (match_operand:SI 1 "memory_operand" "") - (const_int 0))] - "TARGET_V9 - && ! MEM_VOLATILE_P (operands[0]) - && ! MEM_VOLATILE_P (operands[1]) - && addrs_ok_for_ldd_peep (XEXP (operands[0], 0), XEXP (operands[1], 0))" - "stx\\t%%g0, %0") - -(define_peephole - [(set (match_operand:SI 0 "memory_operand" "") - (const_int 0)) - (set (match_operand:SI 1 "memory_operand" "") - (const_int 0))] - "TARGET_V9 - && ! MEM_VOLATILE_P (operands[0]) - && ! MEM_VOLATILE_P (operands[1]) - && addrs_ok_for_ldd_peep (XEXP (operands[1], 0), XEXP (operands[0], 0))" - "stx\\t%%g0, %1") - -(define_peephole - [(set (match_operand:SI 0 "register_operand" "=rf") - (match_operand:SI 1 "memory_operand" "")) - (set (match_operand:SI 2 "register_operand" "=rf") - (match_operand:SI 3 "memory_operand" ""))] - "registers_ok_for_ldd_peep (operands[0], operands[2]) - && ! MEM_VOLATILE_P (operands[1]) - && ! MEM_VOLATILE_P (operands[3]) - && addrs_ok_for_ldd_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))" - "ldd\\t%1, %0") - -(define_peephole - [(set (match_operand:SI 0 "memory_operand" "") - (match_operand:SI 1 "register_operand" "rf")) - (set (match_operand:SI 2 "memory_operand" "") - (match_operand:SI 3 "register_operand" "rf"))] - "registers_ok_for_ldd_peep (operands[1], operands[3]) - && ! MEM_VOLATILE_P (operands[0]) - && ! MEM_VOLATILE_P (operands[2]) - && addrs_ok_for_ldd_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))" - "std\\t%1, %0") - -(define_peephole - [(set (match_operand:SF 0 "register_operand" "=fr") - (match_operand:SF 1 "memory_operand" "")) - (set (match_operand:SF 2 "register_operand" "=fr") - (match_operand:SF 3 "memory_operand" ""))] - "registers_ok_for_ldd_peep (operands[0], operands[2]) - && ! MEM_VOLATILE_P (operands[1]) - && ! MEM_VOLATILE_P (operands[3]) - && addrs_ok_for_ldd_peep (XEXP (operands[1], 0), XEXP (operands[3], 0))" - "ldd\\t%1, %0") - -(define_peephole - [(set (match_operand:SF 0 "memory_operand" "") - (match_operand:SF 1 "register_operand" "fr")) - (set (match_operand:SF 2 "memory_operand" "") - (match_operand:SF 3 "register_operand" "fr"))] - "registers_ok_for_ldd_peep (operands[1], operands[3]) - && ! MEM_VOLATILE_P (operands[0]) - && ! MEM_VOLATILE_P (operands[2]) - && addrs_ok_for_ldd_peep (XEXP (operands[0], 0), XEXP (operands[2], 0))" - "std\\t%1, %0") - -(define_peephole - [(set (match_operand:SI 0 "register_operand" "=rf") - (match_operand:SI 1 "memory_operand" "")) - (set (match_operand:SI 2 "register_operand" "=rf") - (match_operand:SI 3 "memory_operand" ""))] - "registers_ok_for_ldd_peep (operands[2], operands[0]) - && ! MEM_VOLATILE_P (operands[3]) - && ! MEM_VOLATILE_P (operands[1]) - && addrs_ok_for_ldd_peep (XEXP (operands[3], 0), XEXP (operands[1], 0))" - "ldd\\t%3, %2") - -(define_peephole - [(set (match_operand:SI 0 "memory_operand" "") - (match_operand:SI 1 "register_operand" "rf")) - (set (match_operand:SI 2 "memory_operand" "") - (match_operand:SI 3 "register_operand" "rf"))] - "registers_ok_for_ldd_peep (operands[3], operands[1]) - && ! MEM_VOLATILE_P (operands[2]) - && ! MEM_VOLATILE_P (operands[0]) - && addrs_ok_for_ldd_peep (XEXP (operands[2], 0), XEXP (operands[0], 0))" - "std\\t%3, %2") - -(define_peephole - [(set (match_operand:SF 0 "register_operand" "=fr") - (match_operand:SF 1 "memory_operand" "")) - (set (match_operand:SF 2 "register_operand" "=fr") - (match_operand:SF 3 "memory_operand" ""))] - "registers_ok_for_ldd_peep (operands[2], operands[0]) - && ! MEM_VOLATILE_P (operands[3]) - && ! MEM_VOLATILE_P (operands[1]) - && addrs_ok_for_ldd_peep (XEXP (operands[3], 0), XEXP (operands[1], 0))" - "ldd\\t%3, %2") - -(define_peephole - [(set (match_operand:SF 0 "memory_operand" "") - (match_operand:SF 1 "register_operand" "fr")) - (set (match_operand:SF 2 "memory_operand" "") - (match_operand:SF 3 "register_operand" "fr"))] - "registers_ok_for_ldd_peep (operands[3], operands[1]) - && ! MEM_VOLATILE_P (operands[2]) - && ! MEM_VOLATILE_P (operands[0]) - && addrs_ok_for_ldd_peep (XEXP (operands[2], 0), XEXP (operands[0], 0))" - "std\\t%3, %2") - -;; Optimize the case of following a reg-reg move with a test -;; of reg just moved. Don't allow floating point regs for operand 0 or 1. -;; This can result from a float to fix conversion. - -(define_peephole - [(set (match_operand:SI 0 "register_operand" "=r") - (match_operand:SI 1 "register_operand" "r")) - (set (reg:CC 100) - (compare:CC (match_operand:SI 2 "register_operand" "r") - (const_int 0)))] - "(rtx_equal_p (operands[2], operands[0]) - || rtx_equal_p (operands[2], operands[1])) - && ! FP_REG_P (operands[0]) - && ! FP_REG_P (operands[1])" - "orcc\\t%1, 0, %0") - -(define_peephole - [(set (match_operand:DI 0 "register_operand" "=r") - (match_operand:DI 1 "register_operand" "r")) - (set (reg:CCX 100) - (compare:CCX (match_operand:DI 2 "register_operand" "r") - (const_int 0)))] - "TARGET_ARCH64 - && (rtx_equal_p (operands[2], operands[0]) - || rtx_equal_p (operands[2], operands[1])) - && ! FP_REG_P (operands[0]) - && ! FP_REG_P (operands[1])" - "orcc\\t%1, 0, %0") - -;; Return peepholes. First the "normal" ones. -;; These are necessary to catch insns ending up in the epilogue delay list. - -(define_insn "*return_qi" - [(set (match_operand:QI 0 "restore_operand" "") - (match_operand:QI 1 "arith_operand" "rI")) - (return)] - "! TARGET_EPILOGUE && ! TARGET_LIVE_G0" - "* -{ - if (! TARGET_ARCH64 && current_function_returns_struct) - return \"jmp\\t%%i7+12\\n\\trestore %%g0, %1, %Y0\"; - else if (TARGET_V9 && (GET_CODE (operands[1]) == CONST_INT - || IN_OR_GLOBAL_P (operands[1]))) - return \"return\\t%%i7+8\\n\\tmov\\t%Y1, %Y0\"; - else - return \"ret\\n\\trestore %%g0, %1, %Y0\"; -}" - [(set_attr "type" "multi")]) - -(define_insn "*return_hi" - [(set (match_operand:HI 0 "restore_operand" "") - (match_operand:HI 1 "arith_operand" "rI")) - (return)] - "! TARGET_EPILOGUE && ! TARGET_LIVE_G0" - "* -{ - if (! TARGET_ARCH64 && current_function_returns_struct) - return \"jmp\\t%%i7+12\\n\\trestore %%g0, %1, %Y0\"; - else if (TARGET_V9 && (GET_CODE (operands[1]) == CONST_INT - || IN_OR_GLOBAL_P (operands[1]))) - return \"return\\t%%i7+8\\n\\tmov\\t%Y1, %Y0\"; - else - return \"ret\;restore %%g0, %1, %Y0\"; -}" - [(set_attr "type" "multi")]) - -(define_insn "*return_si" - [(set (match_operand:SI 0 "restore_operand" "") - (match_operand:SI 1 "arith_operand" "rI")) - (return)] - "! TARGET_EPILOGUE && ! TARGET_LIVE_G0" - "* -{ - if (! TARGET_ARCH64 && current_function_returns_struct) - return \"jmp\\t%%i7+12\\n\\trestore %%g0, %1, %Y0\"; - else if (TARGET_V9 && (GET_CODE (operands[1]) == CONST_INT - || IN_OR_GLOBAL_P (operands[1]))) - return \"return\\t%%i7+8\\n\\tmov\\t%Y1, %Y0\"; - else - return \"ret\;restore %%g0, %1, %Y0\"; -}" - [(set_attr "type" "multi")]) - -;; The following pattern is only generated by delayed-branch scheduling, -;; when the insn winds up in the epilogue. This can happen not only when -;; ! TARGET_FPU because we move complex types around by parts using -;; SF mode SUBREGs. -(define_insn "*return_sf_no_fpu" - [(set (match_operand:SF 0 "restore_operand" "r") - (match_operand:SF 1 "register_operand" "r")) - (return)] - "! TARGET_EPILOGUE && ! TARGET_LIVE_G0" - "* -{ - if (! TARGET_ARCH64 && current_function_returns_struct) - return \"jmp\\t%%i7+12\\n\\trestore %%g0, %1, %Y0\"; - else if (TARGET_V9 && IN_OR_GLOBAL_P (operands[1])) - return \"return\\t%%i7+8\\n\\tmov\\t%Y1, %Y0\"; - else - return \"ret\;restore %%g0, %1, %Y0\"; -}" - [(set_attr "type" "multi")]) - -(define_insn "*return_addsi" - [(set (match_operand:SI 0 "restore_operand" "") - (plus:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI"))) - (return)] - "! TARGET_EPILOGUE && ! TARGET_LIVE_G0" - "* -{ - if (! TARGET_ARCH64 && current_function_returns_struct) - return \"jmp\\t%%i7+12\\n\\trestore %r1, %2, %Y0\"; - /* If operands are global or in registers, can use return */ - else if (TARGET_V9 && IN_OR_GLOBAL_P (operands[1]) - && (GET_CODE (operands[2]) == CONST_INT - || IN_OR_GLOBAL_P (operands[2]))) - return \"return\\t%%i7+8\\n\\tadd\\t%Y1, %Y2, %Y0\"; - else - return \"ret\;restore %r1, %2, %Y0\"; -}" - [(set_attr "type" "multi")]) - -(define_insn "*return_di" - [(set (match_operand:DI 0 "restore_operand" "") - (match_operand:DI 1 "arith_double_operand" "rHI")) - (return)] - "TARGET_ARCH64 && ! TARGET_EPILOGUE" - "ret\;restore %%g0, %1, %Y0" - [(set_attr "type" "multi")]) - -(define_insn "*return_adddi" - [(set (match_operand:DI 0 "restore_operand" "") - (plus:DI (match_operand:DI 1 "arith_operand" "%r") - (match_operand:DI 2 "arith_double_operand" "rHI"))) - (return)] - "TARGET_ARCH64 && ! TARGET_EPILOGUE" - "ret\;restore %r1, %2, %Y0" - [(set_attr "type" "multi")]) - -;; The following pattern is only generated by delayed-branch scheduling, -;; when the insn winds up in the epilogue. -(define_insn "*return_sf" - [(set (reg:SF 32) - (match_operand:SF 0 "register_operand" "f")) - (return)] - "! TARGET_EPILOGUE" - "ret\;fmovs\\t%0, %%f0" - [(set_attr "type" "multi")]) - -;; Now peepholes to do a call followed by a jump. - -(define_peephole - [(parallel [(set (match_operand 0 "" "") - (call (mem:SI (match_operand:SI 1 "call_operand_address" "ps")) - (match_operand 2 "" ""))) - (clobber (reg:SI 15))]) - (set (pc) (label_ref (match_operand 3 "" "")))] - "short_branch (INSN_UID (insn), INSN_UID (operands[3])) - && in_same_eh_region (insn, operands[3]) - && in_same_eh_region (insn, ins1)" - "call\\t%a1, %2\\n\\tadd\\t%%o7, (%l3-.-4), %%o7") - -(define_peephole - [(parallel [(call (mem:SI (match_operand:SI 0 "call_operand_address" "ps")) - (match_operand 1 "" "")) - (clobber (reg:SI 15))]) - (set (pc) (label_ref (match_operand 2 "" "")))] - "short_branch (INSN_UID (insn), INSN_UID (operands[2])) - && in_same_eh_region (insn, operands[2]) - && in_same_eh_region (insn, ins1)" - "call\\t%a0, %1\\n\\tadd\\t%%o7, (%l2-.-4), %%o7") - -(define_peephole - [(parallel [(set (match_operand 0 "" "") - (call (mem:SI (match_operand:DI 1 "call_operand_address" "ps")) - (match_operand 2 "" ""))) - (clobber (reg:DI 15))]) - (set (pc) (label_ref (match_operand 3 "" "")))] - "TARGET_ARCH64 - && short_branch (INSN_UID (insn), INSN_UID (operands[3])) - && in_same_eh_region (insn, operands[3]) - && in_same_eh_region (insn, ins1)" - "call\\t%a1, %2\\n\\tadd\\t%%o7, (%l3-.-4), %%o7") - -(define_peephole - [(parallel [(call (mem:SI (match_operand:DI 0 "call_operand_address" "ps")) - (match_operand 1 "" "")) - (clobber (reg:DI 15))]) - (set (pc) (label_ref (match_operand 2 "" "")))] - "TARGET_ARCH64 - && short_branch (INSN_UID (insn), INSN_UID (operands[2])) - && in_same_eh_region (insn, operands[2]) - && in_same_eh_region (insn, ins1)" - "call\\t%a0, %1\\n\\tadd\\t%%o7, (%l2-.-4), %%o7") - -;; After a nonlocal goto, we need to restore the PIC register, but only -;; if we need it. So do nothing much here, but we'll check for this in -;; finalize_pic. - -;; Make sure this unspec_volatile number agrees with finalize_pic. -(define_insn "nonlocal_goto_receiver" - [(unspec_volatile [(const_int 0)] 5)] - "flag_pic" - "" - [(set_attr "length" "0")]) - -(define_insn "trap" - [(trap_if (const_int 1) (const_int 5))] - "" - "ta\\t5" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_expand "conditional_trap" - [(trap_if (match_operator 0 "noov_compare_op" - [(match_dup 2) (match_dup 3)]) - (match_operand:SI 1 "arith_operand" ""))] - "" - "operands[2] = gen_compare_reg (GET_CODE (operands[0]), - sparc_compare_op0, sparc_compare_op1); - operands[3] = const0_rtx;") - -(define_insn "" - [(trap_if (match_operator 0 "noov_compare_op" [(reg:CC 100) (const_int 0)]) - (match_operand:SI 1 "arith_operand" "rM"))] - "" - "t%C0\\t%1" - [(set_attr "type" "misc") - (set_attr "length" "1")]) - -(define_insn "" - [(trap_if (match_operator 0 "noov_compare_op" [(reg:CCX 100) (const_int 0)]) - (match_operand:SI 1 "arith_operand" "rM"))] - "TARGET_V9" - "t%C0\\t%%xcc, %1" - [(set_attr "type" "misc") - (set_attr "length" "1")]) diff --git a/contrib/gcc/config/sparc/splet.h b/contrib/gcc/config/sparc/splet.h deleted file mode 100644 index d924e7089963..000000000000 --- a/contrib/gcc/config/sparc/splet.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARClet. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Doug Evans (dje@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sparc/aout.h" - -/* -mbroken-saverestore is not included here because the long term - default is -mno-broken-saverestore. */ -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE) - -/* -mlive-g0 is only supported on the sparclet. */ -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ -{"big-endian", -MASK_LITTLE_ENDIAN, "Generate code for big endian" }, \ -{"little-endian", MASK_LITTLE_ENDIAN, "Generate code for little endian" }, \ -{"live-g0", MASK_LIVE_G0, "Use g0 as a normal register" }, \ -{"no-live-g0", -MASK_LIVE_G0, "Register g0 is fixed with a zero value" }, \ -{"broken-saverestore", MASK_BROKEN_SAVERESTORE, "Enable save/restore bug workarounds" }, \ -{"no-broken-saverestore", -MASK_BROKEN_SAVERESTORE, "Disable save/restore bug workarouns" }, - -#undef ASM_SPEC -#define ASM_SPEC "%{mlittle-endian:-EL} %(asm_cpu)" - -/* Require the user to supply crt0.o. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef LINK_SPEC -#define LINK_SPEC "%{mlittle-endian:-EL}" - -/* sparclet chips are bi-endian. */ -#undef BYTES_BIG_ENDIAN -#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) -#undef WORDS_BIG_ENDIAN -#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) - -#undef SUBTARGET_OVERRIDE_OPTIONS -#define SUBTARGET_OVERRIDE_OPTIONS \ - do { \ - if (TARGET_LIVE_G0) \ - { \ - warning ("Option '-mlive-g0' deprecated."); \ - target_flags &= ~MASK_LIVE_G0; \ - } \ - else if (TARGET_BROKEN_SAVERESTORE) \ - { \ - warning ("Option '-mbroken-saverestore' deprecated."); \ - target_flags &= ~MASK_BROKEN_SAVERESTORE; \ - } \ - } while (0) - diff --git a/contrib/gcc/config/sparc/sun4gas.h b/contrib/gcc/config/sparc/sun4gas.h deleted file mode 100644 index 3cea9560b4fe..000000000000 --- a/contrib/gcc/config/sparc/sun4gas.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SunOS 4.x with gas - Copyright (C) 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* gas supports unaligned data. */ -#define UNALIGNED_DOUBLE_INT_ASM_OP ".uaxword" -#define UNALIGNED_INT_ASM_OP ".uaword" -#define UNALIGNED_SHORT_ASM_OP ".uahalf" - -/* defaults.h will define DWARF2_UNWIND_INFO for us. */ -#undef DWARF2_UNWIND_INFO diff --git a/contrib/gcc/config/sparc/sun4o3.h b/contrib/gcc/config/sparc/sun4o3.h deleted file mode 100644 index d2a53c1f2372..000000000000 --- a/contrib/gcc/config/sparc/sun4o3.h +++ /dev/null @@ -1,29 +0,0 @@ -#include "sparc/sparc.h" - -/* Override the name of the mcount profiling function. */ - -#undef MCOUNT_FUNCTION -#define MCOUNT_FUNCTION "*.mcount" - -/* LINK_SPEC is needed only for SunOS 4. */ - -#undef LINK_SPEC - -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); diff --git a/contrib/gcc/config/sparc/sunos4.h b/contrib/gcc/config/sparc/sunos4.h deleted file mode 100644 index 14c7a437d67c..000000000000 --- a/contrib/gcc/config/sparc/sunos4.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SunOS 4.x - Copyright (C) 1994 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define SUNOS4_SHARED_LIBRARIES 1 - -/* Use N_BINCL stabs. */ - -#define DBX_USE_BINCL - -#include "sparc/sparc.h" - -/* The Sun as doesn't like unaligned data. */ -#define DWARF2_UNWIND_INFO 0 - -/* Override MACHINE_STATE_{SAVE,RESTORE} because we have special - traps available which can get and set the condition codes - reliably. */ -#undef MACHINE_STATE_SAVE -#define MACHINE_STATE_SAVE(ID) \ - unsigned long int ms_flags, ms_saveret; \ - asm volatile("ta 0x20\n\t" \ - "mov %%g1, %0\n\t" \ - "mov %%g2, %1\n\t" \ - : "=r" (ms_flags), "=r" (ms_saveret)); - -#undef MACHINE_STATE_RESTORE -#define MACHINE_STATE_RESTORE(ID) \ - asm volatile("mov %0, %%g1\n\t" \ - "mov %1, %%g2\n\t" \ - "ta 0x21\n\t" \ - : /* no outputs */ \ - : "r" (ms_flags), "r" (ms_saveret)); diff --git a/contrib/gcc/config/sparc/sysv4.h b/contrib/gcc/config/sparc/sysv4.h deleted file mode 100644 index 5f9bba9e594d..000000000000 --- a/contrib/gcc/config/sparc/sysv4.h +++ /dev/null @@ -1,216 +0,0 @@ -/* Target definitions for GNU compiler for Sparc running System V.4 - Copyright (C) 1991, 92, 95, 96, 97, 1998 Free Software Foundation, Inc. - Contributed by Ron Guilmette (rfg@monkeys.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sparc/sparc.h" - -/* Undefine some symbols which are defined in "sparc.h" but which are - appropriate only for SunOS 4.x, and not for svr4. */ - -#undef WORD_SWITCH_TAKES_ARG -#undef ASM_OUTPUT_SOURCE_LINE -#undef SELECT_SECTION -#undef ASM_DECLARE_FUNCTION_NAME -#undef TEXT_SECTION_ASM_OP -#undef DATA_SECTION_ASM_OP - -#include "svr4.h" - -/* ??? Put back the SIZE_TYPE/PTRDIFF_TYPE definitions set by sparc.h. - Why, exactly, is svr4.h messing with this? Seems like the chip - would know best. */ - -#undef SIZE_TYPE -#define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int") - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int") - -/* Undefined some symbols which are defined in "svr4.h" but which are - appropriate only for typical svr4 systems, but not for the specific - case of svr4 running on a Sparc. */ - -#undef INIT_SECTION_ASM_OP -#undef FINI_SECTION_ASM_OP -#undef CONST_SECTION_ASM_OP -#undef TYPE_OPERAND_FMT -#undef PUSHSECTION_FORMAT -#undef STRING_ASM_OP -#undef COMMON_ASM_OP -#undef SKIP_ASM_OP -#undef SET_ASM_OP /* Has no equivalent. See ASM_OUTPUT_DEF below. */ - -/* Provide a set of pre-definitions and pre-assertions appropriate for - the Sparc running svr4. __svr4__ is our extension. */ - -#define CPP_PREDEFINES \ -"-Dsparc -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4)" - -/* The native assembler can't compute differences between symbols in different - sections when generating pic code, so we must put jump tables in the - text section. */ -/* But we now defer the tables to the end of the function, so we make - this 0 to not confuse the branch shortening code. */ -#define JUMP_TABLES_IN_TEXT_SECTION 0 - -/* Pass -K to the assembler when PIC. */ -#undef ASM_SPEC -#define ASM_SPEC \ - "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ - %{fpic:-K PIC} %{fPIC:-K PIC} %(asm_cpu)" - -/* Must use data section for relocatable constants when pic. */ -#undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX) \ -{ \ - if (flag_pic && symbolic_operand (RTX)) \ - data_section (); \ - else \ - const_section (); \ -} - -/* Define the names of various pseudo-op used by the Sparc/svr4 assembler. - Note that many of these are different from the typical pseudo-ops used - by most svr4 assemblers. That is probably due to a (misguided?) attempt - to keep the Sparc/svr4 assembler somewhat compatible with the Sparc/SunOS - assembler. */ - -#define STRING_ASM_OP ".asciz" -#define COMMON_ASM_OP ".common" -#define SKIP_ASM_OP ".skip" -#define UNALIGNED_DOUBLE_INT_ASM_OP ".uaxword" -#define UNALIGNED_INT_ASM_OP ".uaword" -#define UNALIGNED_SHORT_ASM_OP ".uahalf" -#define PUSHSECTION_ASM_OP ".pushsection" -#define POPSECTION_ASM_OP ".popsection" - -/* This is defined in sparc.h but is not used by svr4.h. */ -#undef ASM_LONG -#define ASM_LONG ".long" - -/* This is the format used to print the second operand of a .type pseudo-op - for the Sparc/svr4 assembler. */ - -#define TYPE_OPERAND_FMT "#%s" - -/* This is the format used to print a .pushsection pseudo-op (and its operand) - for the Sparc/svr4 assembler. */ - -#define PUSHSECTION_FORMAT "\t%s\t\"%s\"\n" - -#undef ASM_OUTPUT_CASE_LABEL -#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \ -do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \ - ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM); \ - } while (0) - -/* This is how to equate one symbol to another symbol. The syntax used is - `SYM1=SYM2'. Note that this is different from the way equates are done - with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */ - -#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ - do { fprintf ((FILE), "\t"); \ - assemble_name (FILE, LABEL1); \ - fprintf (FILE, " = "); \ - assemble_name (FILE, LABEL2); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* Define how the Sparc registers should be numbered for Dwarf output. - The numbering provided here should be compatible with the native - svr4 SDB debugger in the Sparc/svr4 reference port. The numbering - is as follows: - - Assembly name gcc internal regno Dwarf regno - ---------------------------------------------------------- - g0-g7 0-7 0-7 - o0-o7 8-15 8-15 - l0-l7 16-23 16-23 - i0-i7 24-31 24-31 - f0-f31 32-63 40-71 -*/ - -#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 32 ? (REGNO) : (REGNO) + 8) - -/* A set of symbol definitions for assembly pseudo-ops which will - get us switched to various sections of interest. These are used - in all places where we simply want to switch to a section, and - *not* to push the previous section name onto the assembler's - section names stack (as we do often in dwarfout.c). */ - -#define TEXT_SECTION_ASM_OP ".section\t\".text\"" -#define DATA_SECTION_ASM_OP ".section\t\".data\"" -#define BSS_SECTION_ASM_OP ".section\t\".bss\"" -#define CONST_SECTION_ASM_OP ".section\t\".rodata\"" -#define INIT_SECTION_ASM_OP ".section\t\".init\"" -#define FINI_SECTION_ASM_OP ".section\t\".fini\"" - -/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. - - Note that we want to give these sections the SHF_WRITE attribute - because these sections will actually contain data (i.e. tables of - addresses of functions in the current root executable or shared library - file) and, in the case of a shared library, the relocatable addresses - will have to be properly resolved/relocated (and then written into) by - the dynamic linker when it actually attaches the given shared library - to the executing process. (Note that on SVR4, you may wish to use the - `-z text' option to the ELF linker, when building a shared library, as - an additional check that you are doing everything right. But if you do - use the `-z text' option when building a shared library, you will get - errors unless the .ctors and .dtors sections are marked as writable - via the SHF_WRITE attribute.) */ - -#undef CTORS_SECTION_ASM_OP -#define CTORS_SECTION_ASM_OP ".section\t\".ctors\",#alloc,#write" -#undef DTORS_SECTION_ASM_OP -#define DTORS_SECTION_ASM_OP ".section\t\".dtors\",#alloc,#write" -#undef EH_FRAME_SECTION_ASM_OP -#define EH_FRAME_SECTION_ASM_OP ".section\t\".eh_frame\",#alloc,#write" - -/* A C statement to output something to the assembler file to switch to section - NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or - NULL_TREE. Some target formats do not support arbitrary sections. Do not - define this macro in such cases. */ - -#undef ASM_OUTPUT_SECTION_NAME /* Override svr4.h's definition. */ -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ -do { \ - if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ - fprintf (FILE, ".section\t\"%s\",#alloc,#execinstr\n", \ - (NAME)); \ - else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ - fprintf (FILE, ".section\t\"%s\",#alloc\n", (NAME)); \ - else \ - fprintf (FILE, ".section\t\"%s\",#alloc,#write\n", (NAME)); \ -} while (0) - -/* A C statement (sans semicolon) to output to the stdio stream - FILE the assembler definition of uninitialized global DECL named - NAME whose size is SIZE bytes and alignment is ALIGN bytes. - Try to use asm_output_aligned_bss to implement this macro. */ - -#undef ASM_OUTPUT_ALIGNED_BSS -#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ - asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) - -/* Override the name of the mcount profiling function. */ - -#undef MCOUNT_FUNCTION -#define MCOUNT_FUNCTION "*_mcount" diff --git a/contrib/gcc/config/sparc/t-elf b/contrib/gcc/config/sparc/t-elf deleted file mode 100644 index da9df38368ee..000000000000 --- a/contrib/gcc/config/sparc/t-elf +++ /dev/null @@ -1,39 +0,0 @@ -# we need to supply our own assembly versions of libgcc1.c files, -# since the user may not have native 'cc' available - -CROSS_LIBGCC1 = libgcc1-asm.a -LIB1ASMSRC = sparc/lb1spc.asm -LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 - -# crt0 is built elsewhere -LIBGCC1_TEST = - -# These are really part of libgcc1, but this will cause them to be -# built correctly, so... - -LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - cat $(srcdir)/config/fp-bit.c > dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -# MULTILIB_OPTIONS should have msparclite too, but we'd have to make -# gas build... -#MULTILIB_OPTIONS = msoft-float mcpu=v8 -MULTILIB_OPTIONS = msoft-float -#MULTILIB_DIRNAMES = soft v8 -MULTILIB_DIRNAMES = soft -#MULTILIB_MATCHES = msoft-float=mno-fpu mcpu?v8=mv8 -MULTILIB_MATCHES = msoft-float=mno-fpu - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib - -# Assemble startup files. -crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/sparc/sol2-ci.asm -crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/sparc/sol2-cn.asm diff --git a/contrib/gcc/config/sparc/t-halos b/contrib/gcc/config/sparc/t-halos deleted file mode 100644 index 0bd5496ac238..000000000000 --- a/contrib/gcc/config/sparc/t-halos +++ /dev/null @@ -1,2 +0,0 @@ -# For a native HALOS compile, we need to set -e1 for the assembler -AS=as -e1 diff --git a/contrib/gcc/config/sparc/t-linux64 b/contrib/gcc/config/sparc/t-linux64 deleted file mode 100644 index 077cf69e7193..000000000000 --- a/contrib/gcc/config/sparc/t-linux64 +++ /dev/null @@ -1,21 +0,0 @@ -MULTILIB_OPTIONS = m64/m32 -MULTILIB_DIRNAMES = 64 32 -MULTILIB_MATCHES = - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib - -EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o - -tcrtbeginS.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ - defaults.h frame.h gbl-ctors.h - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS_S) \ - -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o tcrtbeginS$(objext) - -tcrtendS.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ - defaults.h frame.h gbl-ctors.h - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS_S) \ - -c $(srcdir)/crtstuff.c -DCRT_END -o tcrtendS$(objext) - diff --git a/contrib/gcc/config/sparc/t-sol2 b/contrib/gcc/config/sparc/t-sol2 deleted file mode 100644 index a9b6ee147939..000000000000 --- a/contrib/gcc/config/sparc/t-sol2 +++ /dev/null @@ -1,30 +0,0 @@ -# we need to supply our own assembly versions of libgcc1.c files, -# since the user may not have native 'cc' available - -LIBGCC1 = -CROSS_LIBGCC1 = -LIBGCC1_TEST = - -# gmon build rule: -$(T)gmon.o: $(srcdir)/config/sparc/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) stmp-int-hdrs - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \ - -c $(srcdir)/config/sparc/gmon-sol2.c -o $(T)gmon.o - -# Assemble startup files. -$(T)crt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm -$(T)crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-ci.asm -$(T)crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-cn.asm -$(T)gcrt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -DGCRT1 -o $(T)gcrt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm - -# We need to use -fPIC when we are using gcc to compile the routines in -# crtstuff.c. This is only really needed when we are going to use gcc/g++ -# to produce a shared library, but since we don't know ahead of time when -# we will be doing that, we just always use -fPIC when compiling the -# routines in crtstuff.c. - -CRTSTUFF_T_CFLAGS = -fPIC -TARGET_LIBGCC2_CFLAGS = -fPIC diff --git a/contrib/gcc/config/sparc/t-sol2-64 b/contrib/gcc/config/sparc/t-sol2-64 deleted file mode 100644 index 8d42c4453542..000000000000 --- a/contrib/gcc/config/sparc/t-sol2-64 +++ /dev/null @@ -1,8 +0,0 @@ -MULTILIB_OPTIONS = m32/m64 -MULTILIB_DIRNAMES = sparcv7 sparcv9 -MULTILIB_MATCHES = - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib - -EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o gmon.o crt1.o crti.o crtn.o gcrt1.o diff --git a/contrib/gcc/config/sparc/t-sp64 b/contrib/gcc/config/sparc/t-sp64 deleted file mode 100644 index 99acd5d54235..000000000000 --- a/contrib/gcc/config/sparc/t-sp64 +++ /dev/null @@ -1,2 +0,0 @@ -LIBGCC1 = -CROSS_LIBGCC1 = diff --git a/contrib/gcc/config/sparc/t-sparcbare b/contrib/gcc/config/sparc/t-sparcbare deleted file mode 100644 index 8bd978b068d9..000000000000 --- a/contrib/gcc/config/sparc/t-sparcbare +++ /dev/null @@ -1,26 +0,0 @@ -# configuration file for a bare sparc cpu - -CROSS_LIBGCC1 = libgcc1-asm.a -LIB1ASMSRC = sparc/lb1spc.asm -LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 - -# These are really part of libgcc1, but this will cause them to be -# built correctly, so... - -LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - cat $(srcdir)/config/fp-bit.c > dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -# MULTILIB_OPTIONS should have msparclite too, but we'd have to make -# gas build... -MULTILIB_OPTIONS = msoft-float mcpu=v8 -MULTILIB_DIRNAMES = soft v8 -MULTILIB_MATCHES = msoft-float=mno-fpu mcpu?v8=mv8 - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/sparc/t-sparclite b/contrib/gcc/config/sparc/t-sparclite deleted file mode 100644 index 7cdfbb04551c..000000000000 --- a/contrib/gcc/config/sparc/t-sparclite +++ /dev/null @@ -1,24 +0,0 @@ -CROSS_LIBGCC1 = libgcc1-asm.a -LIB1ASMSRC = sparc/lb1spl.asm -LIB1ASMFUNCS = _divsi3 _udivsi3 _modsi3 _umodsi3 - -# These are really part of libgcc1, but this will cause them to be -# built correctly, so... - -LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define US_SOFTWARE_GOFAST' > dp-bit.c - cat $(srcdir)/config/fp-bit.c >> dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - echo '#define US_SOFTWARE_GOFAST' >> fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -MULTILIB_OPTIONS = mfpu mflat -MULTILIB_DIRNAMES = -MULTILIB_MATCHES = mfpu=mhard-float mfpu=mcpu?f934 - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/sparc/t-splet b/contrib/gcc/config/sparc/t-splet deleted file mode 100644 index 3329e0bef072..000000000000 --- a/contrib/gcc/config/sparc/t-splet +++ /dev/null @@ -1,22 +0,0 @@ -# configuration file for a bare sparclet cpu, aout format files - -CROSS_LIBGCC1 = libgcc1-asm.a -LIB1ASMSRC = sparc/lb1spc.asm -LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 - -# These are really part of libgcc1, but this will cause them to be -# built correctly, so... - -LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - cat $(srcdir)/config/fp-bit.c > dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -MULTILIB_OPTIONS = mlittle-endian mflat -MULTILIB_DIRNAMES = little flat -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/sparc/t-sunos40 b/contrib/gcc/config/sparc/t-sunos40 deleted file mode 100644 index 3e10575eaea5..000000000000 --- a/contrib/gcc/config/sparc/t-sunos40 +++ /dev/null @@ -1,7 +0,0 @@ -# SunOS 4.0.* -# /bin/as doesn't recognize the v8 instructions, so we can't do a v8 -# multilib build. - -LIBGCC1 = -CROSS_LIBGCC1 = -LIBGCC1_TEST = diff --git a/contrib/gcc/config/sparc/t-sunos41 b/contrib/gcc/config/sparc/t-sunos41 deleted file mode 100644 index 5783d6a26258..000000000000 --- a/contrib/gcc/config/sparc/t-sunos41 +++ /dev/null @@ -1,16 +0,0 @@ -# SunOS 4.1.* - -LIBGCC1 = -CROSS_LIBGCC1 = -LIBGCC1_TEST = - -MULTILIB_OPTIONS = fpic/fPIC mcpu=v8 -MULTILIB_DIRNAMES = pic ucpic v8 -MULTILIB_MATCHES = mcpu?v8=mv8 - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib - -# The native linker doesn't handle linking -fpic code with -fPIC code. Ugh. -# We cope by building both variants of libgcc. -#TARGET_LIBGCC2_CFLAGS = -fPIC diff --git a/contrib/gcc/config/sparc/t-vxsparc b/contrib/gcc/config/sparc/t-vxsparc deleted file mode 100644 index 0c7a14a44295..000000000000 --- a/contrib/gcc/config/sparc/t-vxsparc +++ /dev/null @@ -1,17 +0,0 @@ -LIBGCC1 = -CROSS_LIBGCC1 = - -# We don't want to build .umul, etc., because VxWorks provides them, -# which means that libgcc1-test will fail. -LIBGCC1_TEST = - -# We don't want to put exit in libgcc.a for VxWorks, because VxWorks -# does not have _exit. -TARGET_LIBGCC2_CFLAGS = -Dexit=unused_exit - -MULTILIB_OPTIONS=msoft-float mv8 -MULTILIB_DIRNAMES=soft v8 -MULTILIB_MATCHES=msoft-float=mno-fpu - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/sparc/vxsim.h b/contrib/gcc/config/sparc/vxsim.h deleted file mode 100644 index 6c80375f56b9..000000000000 --- a/contrib/gcc/config/sparc/vxsim.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARC VxSim - Copyright 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */ -#include "sparc/sysv4.h" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES \ - "-DCPU=SIMSPARCSOLARIS -D__vxworks -D__vxworks__ -Dsparc -D__svr4__ -D__SVR4 \ - -Asystem(embedded) -Asystem(svr4) -Acpu(sparc) -Amachine(sparc)\ - -D__GCC_NEW_VARARGS__" - -#undef CPP_SPEC -#define CPP_SPEC "" - -#undef CC1_SPEC -#define CC1_SPEC "-fno-builtin %{sun4:} %{target:}" - -/* The sun bundled assembler doesn't accept -Yd, (and neither does gas). - It's safe to pass -s always, even if -g is not used. */ -#undef ASM_SPEC -#define ASM_SPEC \ - "%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ - %{fpic:-K PIC} %{fPIC:-K PIC}" - -/* However it appears that Solaris 2.0 uses the same reg numbering as - the old BSD-style system did. */ - -#undef DBX_REGISTER_NUMBER -/* Same as sparc.h */ -#define DBX_REGISTER_NUMBER(REGNO) (REGNO) - -/* We use stabs-in-elf for debugging, because that is what the native - toolchain uses. */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* The Solaris 2 assembler uses .skip, not .zero, so put this back. */ -#undef ASM_OUTPUT_SKIP -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t.skip %u\n", (SIZE)) - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - fputs ("\t.local\t", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - putc ('\n', (FILE)); \ - ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ -} while (0) - -#undef COMMON_ASM_OP -#define COMMON_ASM_OP "\t.common" - -/* This is how to output a definition of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d:\n", PREFIX, NUM) - -/* This is how to output a reference to an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABELREF -#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d", PREFIX, NUM) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf (LABEL, "*.L%s%d", PREFIX, NUM) - - - -#undef LIB_SPEC -#define LIB_SPEC "" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "" - -#undef LINK_SPEC -#define LINK_SPEC "-r" - -/* This defines which switch letters take arguments. - It is as in svr4.h but with -R added. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - ( (CHAR) == 'D' \ - || (CHAR) == 'U' \ - || (CHAR) == 'o' \ - || (CHAR) == 'e' \ - || (CHAR) == 'u' \ - || (CHAR) == 'I' \ - || (CHAR) == 'm' \ - || (CHAR) == 'L' \ - || (CHAR) == 'R' \ - || (CHAR) == 'A' \ - || (CHAR) == 'h' \ - || (CHAR) == 'z') - -/* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h. - Instead, it is enabled here, because it does work under Solaris. */ -/* Define for support of TFmode long double and REAL_ARITHMETIC. - Sparc ABI says that long double is 4 words. */ -#define LONG_DOUBLE_TYPE_SIZE 64 diff --git a/contrib/gcc/config/sparc/vxsparc.h b/contrib/gcc/config/sparc/vxsparc.h deleted file mode 100644 index 18ce6ed97b70..000000000000 --- a/contrib/gcc/config/sparc/vxsparc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Definitions of target machine for GNU compiler. Vxworks SPARC version. - Copyright (C) 1994, 1996 Free Software Foundation, Inc. - Contributed by David Henkel-Wallace (gumby@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "sparc/aout.h" - -/* Specify what to link with. */ -/* VxWorks does all the library stuff itself. */ - -#undef LIB_SPEC -#define LIB_SPEC "" - -/* Provide required defaults for linker -e. */ -#undef LINK_SPEC -#define LINK_SPEC "%{!nostdlib:%{!r*:%{!e*:-e start}}}" - -/* VxWorks provides the functionality of crt0.o and friends itself. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -Acpu(sparc) -Amachine(sparc)" - -/* Note that we define CPU here even if the user has specified -ansi. - This violates user namespace, but the VxWorks headers, and potentially - user code, all explicitly rely upon the definition of CPU in order to get - the proper processor information. */ -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) -DCPU=SPARC" - -#undef PTRDIFF_TYPE -#undef SIZE_TYPE -#undef WCHAR_TYPE -#undef WCHAR_TYPE_SIZE - -#define PTRDIFF_TYPE "long int" -#define SIZE_TYPE "unsigned int" -#define WCHAR_TYPE "char" -#define WCHAR_TYPE_SIZE 8 - -/* US Software GOFAST library support. */ -#include "gofast.h" -#undef INIT_SUBTARGET_OPTABS -#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS diff --git a/contrib/gcc/config/sparc/x-sysv4 b/contrib/gcc/config/sparc/x-sysv4 deleted file mode 100644 index 2a661e359993..000000000000 --- a/contrib/gcc/config/sparc/x-sysv4 +++ /dev/null @@ -1,2 +0,0 @@ -X_CFLAGS=-DSVR4 -ALLOCA=alloca.o diff --git a/contrib/gcc/config/sparc/xm-linux.h b/contrib/gcc/config/sparc/xm-linux.h deleted file mode 100644 index 691c7d167847..000000000000 --- a/contrib/gcc/config/sparc/xm-linux.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Configuration for GCC for SPARC running Linux-based GNU systems. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. - Contributed by Eddie C. Dost (ecd@skynet.be) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef inhibit_libc -#include -#include -#include -#endif diff --git a/contrib/gcc/config/sparc/xm-lynx.h b/contrib/gcc/config/sparc/xm-lynx.h deleted file mode 100644 index 90fef8543b91..000000000000 --- a/contrib/gcc/config/sparc/xm-lynx.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Configuration for GNU C-compiler for sparc platforms running LynxOS. - Copyright (C) 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include - -/* This describes the machine the compiler is hosted on. */ -#define HOST_BITS_PER_CHAR 8 -#define HOST_BITS_PER_SHORT 16 -#define HOST_BITS_PER_INT 32 -#define HOST_BITS_PER_LONG 32 -#define HOST_BITS_PER_LONGLONG 64 - -#define HOST_WORDS_BIG_ENDIAN 1 - -/* Include to define the exit status access macros. */ -#include -#include - -/* target machine dependencies. - tm.h is a symbolic link to the actual target specific file. */ - -#include "tm.h" diff --git a/contrib/gcc/config/sparc/xm-openbsd.h b/contrib/gcc/config/sparc/xm-openbsd.h deleted file mode 100644 index 2df7fb3e3639..000000000000 --- a/contrib/gcc/config/sparc/xm-openbsd.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Configuration file for an host running sparc OpenBSD. - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include -#include - diff --git a/contrib/gcc/config/sparc/xm-pbd.h b/contrib/gcc/config/sparc/xm-pbd.h deleted file mode 100644 index 1c3f47590c79..000000000000 --- a/contrib/gcc/config/sparc/xm-pbd.h +++ /dev/null @@ -1,10 +0,0 @@ -/* Host environment for the tti "Unicom" PBB 68020 boards */ - -#include "sparc/xm-sparc.h" - -#define USG - -#ifndef __GNUC__ -#define USE_C_ALLOCA -#endif - diff --git a/contrib/gcc/config/sparc/xm-sol2.h b/contrib/gcc/config/sparc/xm-sol2.h deleted file mode 100644 index 5613b086b572..000000000000 --- a/contrib/gcc/config/sparc/xm-sol2.h +++ /dev/null @@ -1,4 +0,0 @@ -/* If not compiled with GNU C, include the system's header. */ -#ifndef __GNUC__ -#include -#endif diff --git a/contrib/gcc/config/sparc/xm-sp64.h b/contrib/gcc/config/sparc/xm-sp64.h deleted file mode 100644 index b673161282f4..000000000000 --- a/contrib/gcc/config/sparc/xm-sp64.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Configuration for GCC for Sparc v9 running 64-bit native. - Copyright (C) 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include - -/* This describes the machine the compiler is hosted on. */ -#if defined(__arch64__) || defined(__sparc_v9__) || defined(__sparcv9) -#undef HOST_BITS_PER_LONG -#define HOST_BITS_PER_LONG 64 -#endif diff --git a/contrib/gcc/config/sparc/xm-sparc.h b/contrib/gcc/config/sparc/xm-sparc.h deleted file mode 100644 index e553a0df0b25..000000000000 --- a/contrib/gcc/config/sparc/xm-sparc.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Configuration for GNU C-compiler for Sun Sparc. - Copyright (C) 1988, 1993, 1995, 1997 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* #defines that need visibility everywhere. */ -#define FALSE 0 -#define TRUE 1 - -/* This describes the machine the compiler is hosted on. */ -#define HOST_BITS_PER_CHAR 8 -#define HOST_BITS_PER_SHORT 16 -#define HOST_BITS_PER_INT 32 -#define HOST_BITS_PER_LONG 32 -#define HOST_BITS_PER_LONGLONG 64 - -/* Doubles are stored in memory with the high order word first. This - matters when cross-compiling. */ -#define HOST_WORDS_BIG_ENDIAN 1 - -/* target machine dependencies. - tm.h is a symbolic link to the actual target specific file. */ -#include "tm.h" - -/* Arguments to use with `exit'. */ -#define SUCCESS_EXIT_CODE 0 -#define FATAL_EXIT_CODE 33 - -/* If compiled with Sun CC, the use of alloca requires this #include. */ -#ifndef __GNUC__ -#include "alloca.h" -#endif diff --git a/contrib/gcc/config/sparc/xm-sysv4-64.h b/contrib/gcc/config/sparc/xm-sysv4-64.h deleted file mode 100644 index c506d22dd360..000000000000 --- a/contrib/gcc/config/sparc/xm-sysv4-64.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Configuration for GCC for Sparc v9 running 64-bit native. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include - -/* This describes the machine the compiler is hosted on. */ -#if defined(__arch64__) || defined(__sparc_v9__) || defined(__sparcv9) -#undef HOST_BITS_PER_LONG -#define HOST_BITS_PER_LONG 64 -#endif diff --git a/contrib/gcc/config/sparc/xm-sysv4.h b/contrib/gcc/config/sparc/xm-sysv4.h deleted file mode 100644 index 6e663d12cfa1..000000000000 --- a/contrib/gcc/config/sparc/xm-sysv4.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Configuration for GNU C-compiler for Sun Sparc running System V.4. - Copyright (C) 1992, 1993, 1998 Free Software Foundation, Inc. - Contributed by Ron Guilmette (rfg@netcom.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* #defines that need visibility everywhere. */ -#define FALSE 0 -#define TRUE 1 - -/* This describes the machine the compiler is hosted on. */ -#define HOST_BITS_PER_CHAR 8 -#define HOST_BITS_PER_SHORT 16 -#define HOST_BITS_PER_INT 32 -#define HOST_BITS_PER_LONG 32 -#define HOST_BITS_PER_LONGLONG 64 - -/* Doubles are stored in memory with the high order word first. This - matters when cross-compiling. */ -#define HOST_WORDS_BIG_ENDIAN 1 - -/* target machine dependencies. - tm.h is a symbolic link to the actual target specific file. */ -#include "tm.h" - -/* Arguments to use with `exit'. */ -#define SUCCESS_EXIT_CODE 0 -#define FATAL_EXIT_CODE 33 - -#ifndef __GNUC__ -#define ONLY_INT_FIELDS -#endif diff --git a/contrib/gcc/config/svr3.h b/contrib/gcc/config/svr3.h deleted file mode 100644 index 3475561799b4..000000000000 --- a/contrib/gcc/config/svr3.h +++ /dev/null @@ -1,375 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for - generic System V Release 3 system. - Copyright (C) 1991, 1996 Free Software Foundation, Inc. - Contributed by Ron Guilmette (rfg@monkeys.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. - - To use this file, make up a file with a name like: - - ?????svr3.h - - where ????? is replaced by the name of the basic hardware that you - are targeting for. Then, in the file ?????svr3.h, put something - like: - - #include "?????.h" - #include "svr3.h" - - followed by any really system-specific defines (or overrides of - defines) which you find that you need. For example, CPP_PREDEFINES - is defined here with only the defined -Dunix and -DSVR3. You should - probably override that in your target-specific ?????svr3.h file - with a set of defines that includes these, but also contains an - appropriate define for the type of hardware that you are targeting. -*/ - -/* Define a symbol indicating that we are using svr3.h. */ -#define USING_SVR3_H - -/* Define a symbol so that libgcc* can know what sort of operating - environment and assembler syntax we are targeting for. */ -#define SVR3_target - -/* Cpp, assembler, linker, library, and startfile spec's. */ - -/* You should redefine CPP_PREDEFINES in any file which includes this one. - The definition should be appropriate for the type of target system - involved, and it should include any -A (assertion) options which are - appropriate for the given target system. */ - -#undef CPP_PREDEFINES - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { output_file_directive ((FILE), main_input_filename); \ - if (optimize) ASM_FILE_START_1 (FILE); \ - } while (0) - -/* By default, do nothing: a few machines support .optim, but not most. */ -#undef ASM_FILE_START_1 -#define ASM_FILE_START_1(FILE) - -/* This says how to output an assembler line - to define a global common symbol. */ -/* We don't use ROUNDED because the standard compiler doesn't, - and the linker gives error messages if a common symbol - has more than one length value. */ - -#undef ASM_OUTPUT_COMMON -#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ -( fputs (".comm ", (FILE)), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ",%u\n", (SIZE))) - -/* This says how to output an assembler line - to define a local common symbol. */ - -/* Note that using bss_section here caused errors - in building shared libraries on system V.3. */ -#undef ASM_OUTPUT_LOCAL -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ - do { \ - int align = exact_log2 (ROUNDED); \ - if (align > 2) align = 2; \ - data_section (); \ - ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \ - ASM_OUTPUT_LABEL ((FILE), (NAME)); \ - fprintf ((FILE), "\t.set .,.+%u\n", (ROUNDED)); \ - } while (0) - -#if 0 /* For now, let's leave these machine-specific. */ -/* Use crt1.o as a startup file and crtn.o as a closing file. */ - -#define STARTFILE_SPEC \ - "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}" - -#ifdef CROSS_COMPILE -#define LIB_SPEC "-lc crtn.o%s" -#else -#define LIB_SPEC "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} -lc crtn.o%s" -#endif - -/* Special flags for the linker. I don't know what they do. */ - -#define LINK_SPEC "%{T*} %{z:-lm}" -#endif - -/* Allow #sccs in preprocessor. */ - -#define SCCS_DIRECTIVE - -/* Output #ident as a .ident. */ - -#define ASM_OUTPUT_IDENT(FILE, NAME) \ - fprintf (FILE, "\t.ident \"%s\"\n", NAME); - -/* Use periods rather than dollar signs in special g++ assembler names. */ - -#define NO_DOLLAR_IN_LABEL - -/* Implicit library calls should use memcpy, not bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS - -/* System V Release 3 uses COFF debugging info. */ - -#define SDB_DEBUGGING_INFO - -/* We don't want to output DBX debugging information. */ - -#undef DBX_DEBUGGING_INFO - -/* Define the actual types of some ANSI-mandated types. These - definitions should work for most SVR3 systems. */ - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -/* Assembler pseudos to introduce constants of various size. These - definitions should work for most svr3 systems. */ - -#undef ASM_BYTE_OP -#define ASM_BYTE_OP "\t.byte" - -/* The prefix to add to user-visible assembler symbols. - - For System V Release 3 the convention is to prepend a leading - underscore onto user-level symbol names. */ - -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "_" - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - - For most svr3 systems, the convention is that any symbol which begins - with a period is not put into the linker symbol table by the assembler. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. - - For most svr3 systems, the convention is that any symbol which begins - with a period is not put into the linker symbol table by the assembler. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM) - -/* We want local labels to start with period if made with asm_fprintf. */ -#undef LOCAL_LABEL_PREFIX -#define LOCAL_LABEL_PREFIX "." - -/* Support const sections and the ctors and dtors sections for g++. - Note that there appears to be two different ways to support const - sections at the moment. You can either #define the symbol - READONLY_DATA_SECTION (giving it some code which switches to the - readonly data section) or else you can #define the symbols - EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and - SELECT_RTX_SECTION. We do both here just to be on the safe side. - However, use of the const section is turned off by default - unless the specific tm.h file turns it on by defining - USE_CONST_SECTION as 1. */ - -/* Define a few machine-specific details of the implementation of - constructors. - - The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN - and CTOR_LIST_END to contribute to the .init section an instruction to - push a word containing 0 (or some equivalent of that). - - Define ASM_OUTPUT_CONSTRUCTOR to push the address of the constructor. */ - -#define USE_CONST_SECTION 0 - -#define INIT_SECTION_ASM_OP ".section\t.init" -#define FINI_SECTION_ASM_OP ".section .fini,\"x\"" -#define CONST_SECTION_ASM_OP ".section\t.rodata, \"x\"" -#define CTORS_SECTION_ASM_OP INIT_SECTION_ASM_OP -#define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP - -/* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent - because they push on the stack. */ - -#ifndef STACK_GROWS_DOWNWARD - -/* Constructor list on stack is in reverse order. Go to the end of the - list and go backwards to call constructors in the right order. */ -#define DO_GLOBAL_CTORS_BODY \ -do { \ - func_ptr *p, *beg = alloca (0); \ - for (p = beg; *p; p++) \ - ; \ - while (p != beg) \ - (*--p) (); \ -} while (0) - -#else - -/* Constructor list on stack is in correct order. Just call them. */ -#define DO_GLOBAL_CTORS_BODY \ -do { \ - func_ptr *p, *beg = alloca (0); \ - for (p = beg; *p; ) \ - (*p++) (); \ -} while (0) - -#endif /* STACK_GROWS_DOWNWARD */ - -/* Add extra sections .rodata, .init and .fini. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_init, in_fini - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - INIT_SECTION_FUNCTION \ - FINI_SECTION_FUNCTION - -#define INIT_SECTION_FUNCTION \ -void \ -init_section () \ -{ \ - if (in_section != in_init) \ - { \ - fprintf (asm_out_file, "\t%s\n", INIT_SECTION_ASM_OP); \ - in_section = in_init; \ - } \ -} - -#define FINI_SECTION_FUNCTION \ -void \ -fini_section () \ -{ \ - if (in_section != in_fini) \ - { \ - fprintf (asm_out_file, "\t%s\n", FINI_SECTION_ASM_OP); \ - in_section = in_fini; \ - } \ -} - -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - extern void text_section(); \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - -/* The ctors and dtors sections are not normally put into use - by EXTRA_SECTIONS and EXTRA_SECTION_FUNCTIONS as defined in svr3.h, - but it can't hurt to define these macros for whatever systems use them. */ -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -/* This is machine-dependent - because it needs to push something on the stack. */ -#undef ASM_OUTPUT_CONSTRUCTOR - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - fini_section (); \ - fprintf (FILE, "%s\t ", ASM_LONG); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement or statements to switch to the appropriate - section for output of DECL. DECL is either a `VAR_DECL' node - or a constant of some sort. RELOC indicates whether forming - the initial value of DECL requires link-time relocations. */ - -#define SELECT_SECTION(DECL,RELOC) \ -{ \ - if (TREE_CODE (DECL) == STRING_CST) \ - { \ - if (! flag_writable_strings) \ - const_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (DECL) == VAR_DECL) \ - { \ - if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \ - || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ - || !DECL_INITIAL (DECL) \ - || (DECL_INITIAL (DECL) != error_mark_node \ - && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ - data_section (); \ - else \ - const_section (); \ - } \ - else \ - const_section (); \ -} - -/* A C statement or statements to switch to the appropriate - section for output of RTX in mode MODE. RTX is some kind - of constant in RTL. The argument MODE is redundant except - in the case of a `const_int' rtx. Currently, these always - go into the const section. */ - -#define SELECT_RTX_SECTION(MODE,RTX) const_section() diff --git a/contrib/gcc/config/svr4.h b/contrib/gcc/config/svr4.h deleted file mode 100644 index 7fa30e8ac261..000000000000 --- a/contrib/gcc/config/svr4.h +++ /dev/null @@ -1,926 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for some - generic System V Release 4 system. - Copyright (C) 1991, 94-98, 1999 Free Software Foundation, Inc. - Contributed by Ron Guilmette (rfg@monkeys.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. - - To use this file, make up a file with a name like: - - ?????svr4.h - - where ????? is replaced by the name of the basic hardware that you - are targeting for. Then, in the file ?????svr4.h, put something - like: - - #include "?????.h" - #include "svr4.h" - - followed by any really system-specific defines (or overrides of - defines) which you find that you need. For example, CPP_PREDEFINES - is defined here with only the defined -Dunix and -DSVR4. You should - probably override that in your target-specific ?????svr4.h file - with a set of defines that includes these, but also contains an - appropriate define for the type of hardware that you are targeting. -*/ - -/* Define a symbol indicating that we are using svr4.h. */ -#define USING_SVR4_H - -/* For the sake of libgcc2.c, indicate target supports atexit. */ -#define HAVE_ATEXIT - -/* Cpp, assembler, linker, library, and startfile spec's. */ - -/* This defines which switch letters take arguments. On svr4, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker). Note however that there is no such - thing as a -T option for svr4. */ - -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'h' \ - || (CHAR) == 'x' \ - || (CHAR) == 'z') - -/* This defines which multi-letter switches take arguments. On svr4, - there are no such switches except those implemented by GCC itself. */ - -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ - && strcmp (STR, "Tbss")) - -/* You should redefine CPP_PREDEFINES in any file which includes this one. - The definition should be appropriate for the type of target system - involved, and it should include any -A (assertion) options which are - appropriate for the given target system. */ -#undef CPP_PREDEFINES - -/* Provide an ASM_SPEC appropriate for svr4. Here we try to support as - many of the specialized svr4 assembler options as seems reasonable, - given that there are certain options which we can't (or shouldn't) - support directly due to the fact that they conflict with other options - for other svr4 tools (e.g. ld) or with other options for GCC itself. - For example, we don't support the -o (output file) or -R (remove - input file) options because GCC already handles these things. We - also don't support the -m (run m4) option for the assembler because - that conflicts with the -m (produce load map) option of the svr4 - linker. We do however allow passing arbitrary options to the svr4 - assembler via the -Wa, option. - - Note that gcc doesn't allow a space to follow -Y in a -Ym,* or -Yd,* - option. -*/ - -#undef ASM_SPEC -#define ASM_SPEC \ - "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}" - -/* svr4 assemblers need the `-' (indicating input from stdin) to come after - the -o option (and its argument) for some reason. If we try to put it - before the -o option, the assembler will try to read the file named as - the output file in the -o option as an input file (after it has already - written some stuff to it) and the binary stuff contained therein will - cause totally confuse the assembler, resulting in many spurious error - messages. */ - -#undef ASM_FINAL_SPEC -#define ASM_FINAL_SPEC "%|" - -/* Under svr4, the normal location of the `ld' and `as' programs is the - /usr/ccs/bin directory. */ - -#ifndef CROSS_COMPILE -#undef MD_EXEC_PREFIX -#define MD_EXEC_PREFIX "/usr/ccs/bin/" -#endif - -/* Under svr4, the normal location of the various *crt*.o files is the - /usr/ccs/lib directory. */ - -#ifndef CROSS_COMPILE -#undef MD_STARTFILE_PREFIX -#define MD_STARTFILE_PREFIX "/usr/ccs/lib/" -#endif - -/* Provide a LIB_SPEC appropriate for svr4. Here we tack on the default - standard C library (unless we are building a shared library). */ - -#undef LIB_SPEC -#define LIB_SPEC "%{!shared:%{!symbolic:-lc}}" - -/* Provide an ENDFILE_SPEC appropriate for svr4. Here we tack on our own - magical crtend.o file (see crtstuff.c) which provides part of the - support for getting C++ file-scope static object constructed before - entering `main', followed by the normal svr3/svr4 "finalizer" file, - which is either `gcrtn.o' or `crtn.o'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "crtend.o%s %{pg:gcrtn.o%s}%{!pg:crtn.o%s}" - -/* Provide a LINK_SPEC appropriate for svr4. Here we provide support - for the special GCC options -static, -shared, and -symbolic which - allow us to link things in one of these three modes by applying the - appropriate combinations of options at link-time. We also provide - support here for as many of the other svr4 linker options as seems - reasonable, given that some of them conflict with options for other - svr4 tools (e.g. the assembler). In particular, we do support the - -z*, -V, -b, -t, -Qy, -Qn, and -YP* options here, and the -e*, - -l*, -o*, -r, -s, -u*, and -L* options are directly supported - by gcc.c itself. We don't directly support the -m (generate load - map) option because that conflicts with the -m (run m4) option of - the svr4 assembler. We also don't directly support the svr4 linker's - -I* or -M* options because these conflict with existing GCC options. - We do however allow passing arbitrary options to the svr4 linker - via the -Wl, option. We don't support the svr4 linker's -a option - at all because it is totally useless and because it conflicts with - GCC's own -a option. - - Note that gcc doesn't allow a space to follow -Y in a -YP,* option. - - When the -G link option is used (-shared and -symbolic) a final link is - not being done. */ - -#undef LINK_SPEC -#ifdef CROSS_COMPILE -#define LINK_SPEC "%{h*} %{v:-V} \ - %{b} %{Wl,*:%*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy -z text} \ - %{symbolic:-Bsymbolic -G -dy -z text} \ - %{G:-G} \ - %{YP,*} \ - %{Qy:} %{!Qn:-Qy}" -#else -#define LINK_SPEC "%{h*} %{v:-V} \ - %{b} %{Wl,*:%*} \ - %{static:-dn -Bstatic} \ - %{shared:-G -dy -z text} \ - %{symbolic:-Bsymbolic -G -dy -z text} \ - %{G:-G} \ - %{YP,*} \ - %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ - %{!p:-Y P,/usr/ccs/lib:/usr/lib}} \ - %{Qy:} %{!Qn:-Qy}" -#endif - -/* Gcc automatically adds in one of the files /usr/ccs/lib/values-Xc.o, - /usr/ccs/lib/values-Xa.o, or /usr/ccs/lib/values-Xt.o for each final - link step (depending upon the other gcc options selected, such as - -traditional and -ansi). These files each contain one (initialized) - copy of a special variable called `_lib_version'. Each one of these - files has `_lib_version' initialized to a different (enum) value. - The SVR4 library routines query the value of `_lib_version' at run - to decide how they should behave. Specifically, they decide (based - upon the value of `_lib_version') if they will act in a strictly ANSI - conforming manner or not. -*/ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared: \ - %{!symbolic: \ - %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\ - %{pg:gcrti.o%s}%{!pg:crti.o%s} \ - %{ansi:values-Xc.o%s} \ - %{!ansi: \ - %{traditional:values-Xt.o%s} \ - %{!traditional:values-Xa.o%s}} \ - crtbegin.o%s" - -/* Attach a special .ident directive to the end of the file to identify - the version of GCC which compiled this code. The format of the - .ident string is patterned after the ones produced by native svr4 - C compilers. */ - -#define IDENT_ASM_OP ".ident" - -#define ASM_FILE_END(FILE) \ -do { \ - if (!flag_no_ident) \ - fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \ - IDENT_ASM_OP, version_string); \ - } while (0) - -/* Allow #sccs in preprocessor. */ - -#define SCCS_DIRECTIVE - -/* Output #ident as a .ident. */ - -#define ASM_OUTPUT_IDENT(FILE, NAME) \ - fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); - -/* Use periods rather than dollar signs in special g++ assembler names. */ - -#define NO_DOLLAR_IN_LABEL - -/* Writing `int' for a bitfield forces int alignment for the structure. */ - -#define PCC_BITFIELD_TYPE_MATTERS 1 - -/* Implicit library calls should use memcpy, not bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS - -/* Handle #pragma weak and #pragma pack. */ - -#define HANDLE_SYSV_PRAGMA - -/* System V Release 4 uses DWARF debugging info. */ - -#define DWARF_DEBUGGING_INFO - -/* All ELF targets can support DWARF-2. */ -#ifndef DWARF2_DEBUGGING_INFO -#define DWARF2_DEBUGGING_INFO -#endif - -/* The numbers used to denote specific machine registers in the System V - Release 4 DWARF debugging information are quite likely to be totally - different from the numbers used in BSD stabs debugging information - for the same kind of target machine. Thus, we undefine the macro - DBX_REGISTER_NUMBER here as an extra inducement to get people to - provide proper machine-specific definitions of DBX_REGISTER_NUMBER - (which is also used to provide DWARF registers numbers in dwarfout.c) - in their tm.h files which include this file. */ - -#undef DBX_REGISTER_NUMBER - -/* Use DWARF debugging info by default. */ - -#ifndef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG -#endif - -/* But allow STABS to be supoorted as well. */ -#include "dbxelf.h" - -/* Define the actual types of some ANSI-mandated types. (These - definitions should work for most SVR4 systems). */ - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "long int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE BITS_PER_WORD - -/* This causes trouble, because it requires the host machine - to support ANSI C. */ -/* #define MULTIBYTE_CHARS */ - -#undef ASM_BYTE_OP -#define ASM_BYTE_OP ".byte" - -#undef SET_ASM_OP -#define SET_ASM_OP ".set" - -/* This is how to begin an assembly language file. Most svr4 assemblers want - at least a .file directive to come first, and some want to see a .version - directive come right after that. Here we just establish a default - which generates only the .file directive. If you need a .version - directive for any specific target, you should override this definition - in the target-specific file which includes this one. */ - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - output_file_directive ((FILE), main_input_filename) - -/* This is how to allocate empty space in some section. The .zero - pseudo-op is used for this on most svr4 assemblers. */ - -#define SKIP_ASM_OP ".zero" - -#undef ASM_OUTPUT_SKIP -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE)) - -/* The prefix to add to user-visible assembler symbols. - - For System V Release 4 the convention is *not* to prepend a leading - underscore onto user-level symbol names. */ - -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "" - -/* This is how to output an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - - For most svr4 systems, the convention is that any symbol which begins - with a period is not put into the linker symbol table by the assembler. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \ -do { \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \ -} while (0) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. - - For most svr4 systems, the convention is that any symbol which begins - with a period is not put into the linker symbol table by the assembler. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ -do { \ - sprintf (LABEL, "*.%s%d", PREFIX, (unsigned) (NUM)); \ -} while (0) - -/* Output the label which precedes a jumptable. Note that for all svr4 - systems where we actually generate jumptables (which is to say every - svr4 target except i386, where we use casesi instead) we put the jump- - tables into the .rodata section and since other stuff could have been - put into the .rodata section prior to any given jumptable, we have to - make sure that the location counter for the .rodata section gets pro- - perly re-aligned prior to the actual beginning of the jump table. */ - -#define ALIGN_ASM_OP ".align" - -#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL -#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ - ASM_OUTPUT_ALIGN ((FILE), 2); -#endif - -#undef ASM_OUTPUT_CASE_LABEL -#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ - do { \ - ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \ - } while (0) - -/* The standard SVR4 assembler seems to require that certain builtin - library routines (e.g. .udiv) be explicitly declared as .globl - in each assembly file where they are referenced. */ - -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ - ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) - -/* This says how to output assembler code to declare an - uninitialized external linkage data object. Under SVR4, - the linker seems to want the alignment of data objects - to depend on their types. We do exactly that here. */ - -#define COMMON_ASM_OP ".comm" - -#undef ASM_OUTPUT_ALIGNED_COMMON -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ -} while (0) - -/* This says how to output assembler code to declare an - uninitialized internal linkage data object. Under SVR4, - the linker seems to want the alignment of data objects - to depend on their types. We do exactly that here. */ - -#define LOCAL_ASM_OP ".local" - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), "\n"); \ - ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ -} while (0) - -/* Biggest alignment supported by the object file format of this - machine. Use this macro to limit the alignment which can be - specified using the `__attribute__ ((aligned (N)))' construct. If - not defined, the default value is `BIGGEST_ALIGNMENT'. */ - -#define MAX_OFILE_ALIGNMENT (32768*8) - -/* This is the pseudo-op used to generate a 32-bit word of data with a - specific value in some section. This is the same for all known svr4 - assemblers. */ - -#define INT_ASM_OP ".long" - -/* This is the pseudo-op used to generate a contiguous sequence of byte - values from a double-quoted string WITHOUT HAVING A TERMINATING NUL - AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ - -#undef ASCII_DATA_ASM_OP -#define ASCII_DATA_ASM_OP ".ascii" - -/* Support const sections and the ctors and dtors sections for g++. - Note that there appears to be two different ways to support const - sections at the moment. You can either #define the symbol - READONLY_DATA_SECTION (giving it some code which switches to the - readonly data section) or else you can #define the symbols - EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and - SELECT_RTX_SECTION. We do both here just to be on the safe side. */ - -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP ".section\t.rodata" - -/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. - - Note that we want to give these sections the SHF_WRITE attribute - because these sections will actually contain data (i.e. tables of - addresses of functions in the current root executable or shared library - file) and, in the case of a shared library, the relocatable addresses - will have to be properly resolved/relocated (and then written into) by - the dynamic linker when it actually attaches the given shared library - to the executing process. (Note that on SVR4, you may wish to use the - `-z text' option to the ELF linker, when building a shared library, as - an additional check that you are doing everything right. But if you do - use the `-z text' option when building a shared library, you will get - errors unless the .ctors and .dtors sections are marked as writable - via the SHF_WRITE attribute.) */ - -#define CTORS_SECTION_ASM_OP ".section\t.ctors,\"aw\"" -#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\"" - -/* On svr4, we *do* have support for the .init and .fini sections, and we - can put stuff in there to be executed before and after `main'. We let - crtstuff.c and other files know this by defining the following symbols. - The definitions say how to change sections to the .init and .fini - sections. This is the same for all known svr4 assemblers. */ - -#define INIT_SECTION_ASM_OP ".section\t.init" -#define FINI_SECTION_ASM_OP ".section\t.fini" - -/* A default list of other sections which we might be "in" at any given - time. For targets that use additional sections (e.g. .tdesc) you - should override this definition in the target-specific file which - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_ctors, in_dtors - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION - -#define READONLY_DATA_SECTION() const_section () - -extern void text_section (); - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} - -/* Switch into a generic section. - - We make the section read-only and executable for a function decl, - read-only for a const data decl, and writable for a non-const data decl. - - If the section has already been defined, we must not - emit the attributes here. The SVR4 assembler does not - recognize section redefinitions. - If DECL is NULL, no attributes are emitted. */ - -#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ -do { \ - static struct section_info \ - { \ - struct section_info *next; \ - char *name; \ - enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ - } *sections; \ - struct section_info *s; \ - char *mode; \ - enum sect_enum type; \ - \ - for (s = sections; s; s = s->next) \ - if (!strcmp (NAME, s->name)) \ - break; \ - \ - if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ - type = SECT_EXEC, mode = "ax"; \ - else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ - type = SECT_RO, mode = "a"; \ - else \ - type = SECT_RW, mode = "aw"; \ - \ - if (s == 0) \ - { \ - s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ - s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ - strcpy (s->name, NAME); \ - s->type = type; \ - s->next = sections; \ - sections = s; \ - fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, mode); \ - } \ - else \ - { \ - if (DECL && s->type != type) \ - error_with_decl (DECL, "%s causes a section type conflict"); \ - \ - fprintf (FILE, ".section\t%s\n", NAME); \ - } \ -} while (0) - -#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) -#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL)) -#define UNIQUE_SECTION(DECL,RELOC) \ -do { \ - int len; \ - char *name, *string, *prefix; \ - \ - name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ - \ - if (! DECL_ONE_ONLY (DECL)) \ - { \ - prefix = "."; \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ - prefix = ".text."; \ - else if (DECL_READONLY_SECTION (DECL, RELOC)) \ - prefix = ".rodata."; \ - else \ - prefix = ".data."; \ - } \ - else if (TREE_CODE (DECL) == FUNCTION_DECL) \ - prefix = ".gnu.linkonce.t."; \ - else if (DECL_READONLY_SECTION (DECL, RELOC)) \ - prefix = ".gnu.linkonce.r."; \ - else \ - prefix = ".gnu.linkonce.d."; \ - \ - len = strlen (name) + strlen (prefix); \ - string = alloca (len + 1); \ - sprintf (string, "%s%s", prefix, name); \ - \ - DECL_SECTION_NAME (DECL) = build_string (len, string); \ -} while (0) -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement or statements to switch to the appropriate - section for output of DECL. DECL is either a `VAR_DECL' node - or a constant of some sort. RELOC indicates whether forming - the initial value of DECL requires link-time relocations. */ - -#define SELECT_SECTION(DECL,RELOC) \ -{ \ - if (flag_pic && RELOC) \ - data_section (); \ - else if (TREE_CODE (DECL) == STRING_CST) \ - { \ - if (! flag_writable_strings) \ - const_section (); \ - else \ - data_section (); \ - } \ - else if (TREE_CODE (DECL) == VAR_DECL) \ - { \ - if (! DECL_READONLY_SECTION (DECL, RELOC)) \ - data_section (); \ - else \ - const_section (); \ - } \ - else \ - const_section (); \ -} - -/* A C statement or statements to switch to the appropriate - section for output of RTX in mode MODE. RTX is some kind - of constant in RTL. The argument MODE is redundant except - in the case of a `const_int' rtx. Currently, these always - go into the const section. */ - -#undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX) const_section() - -/* Define the strings used for the special svr4 .type and .size directives. - These strings generally do not vary from one system running svr4 to - another, but if a given system (e.g. m88k running svr) needs to use - different pseudo-op names for these, they may be overridden in the - file which includes this one. */ - -#define TYPE_ASM_OP ".type" -#define SIZE_ASM_OP ".size" - -/* This is how we tell the assembler that a symbol is weak. */ - -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -/* The following macro defines the format used to output the second - operand of the .type assembler directive. Different svr4 assemblers - expect various different forms for this operand. The one given here - is just a default. You may need to override it in your machine- - specific tm.h file (depending upon the particulars of your assembler). */ - -#define TYPE_OPERAND_FMT "@%s" - -/* Write the extra assembler code needed to declare a function's result. - Most svr4 assemblers don't require any special declaration of the - result value, but there are exceptions. */ - -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -/* These macros generate the special .type and .size directives which - are used to set the corresponding fields of the linker symbol table - entries in an ELF object file under SVR4. These macros also output - the starting labels for the relevant functions/objects. */ - -/* Write the extra assembler code needed to declare a function properly. - Some svr4 assemblers need to also have something extra said about the - function's return value. We allow for that here. */ - -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', FILE); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Write the extra assembler code needed to declare an object properly. */ - -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ - do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ - putc ('\n', FILE); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \ - int_size_in_bytes (TREE_TYPE (DECL))); \ - fputc ('\n', FILE); \ - } \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Output the size directive for a decl in rest_of_decl_compilation - in the case where we did not do so before the initializer. - Once we find the error_mark_node, we know that the value of - size_directive_output was set - by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ - -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - putc (',', FILE); \ - fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \ - int_size_in_bytes (TREE_TYPE (DECL))); \ - fputc ('\n', FILE); \ - } \ - } while (0) - -/* This is how to declare the size of a function. */ - -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - { \ - char label[256]; \ - static int labelno; \ - labelno++; \ - ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, (FNAME)); \ - fprintf (FILE, ","); \ - assemble_name (FILE, label); \ - fprintf (FILE, "-"); \ - assemble_name (FILE, (FNAME)); \ - putc ('\n', FILE); \ - } \ - } while (0) - -/* A table of bytes codes used by the ASM_OUTPUT_ASCII and - ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table - corresponds to a particular byte value [0..255]. For any - given byte value, if the value in the corresponding table - position is zero, the given character can be output directly. - If the table value is 1, the byte must be output as a \ooo - octal escape. If the tables value is anything else, then the - byte value should be output as a \ followed by the value - in the table. Note that we can use standard UN*X escape - sequences for many control characters, but we don't use - \a to represent BEL because some svr4 assemblers (e.g. on - the i386) don't know about that. Also, we don't use \v - since some versions of gas, such as 2.2 did not accept it. */ - -#define ESCAPES \ -"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" - -/* Some svr4 assemblers have a limit on the number of characters which - can appear in the operand of a .string directive. If your assembler - has such a limitation, you should define STRING_LIMIT to reflect that - limit. Note that at least some svr4 assemblers have a limit on the - actual number of bytes in the double-quoted string, and that they - count each character in an escape sequence as one byte. Thus, an - escape sequence like \377 would count as four bytes. - - If your target assembler doesn't support the .string directive, you - should define this to zero. -*/ - -#define STRING_LIMIT ((unsigned) 256) - -#define STRING_ASM_OP ".string" - -/* The routine used to output NUL terminated strings. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable, especially for targets like the i386 - (where the only alternative is to output character sequences as - comma separated lists of numbers). */ - -#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ - do \ - { \ - register unsigned char *_limited_str = (unsigned char *) (STR); \ - register unsigned ch; \ - fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ - for (; (ch = *_limited_str); _limited_str++) \ - { \ - register int escape; \ - switch (escape = ESCAPES[ch]) \ - { \ - case 0: \ - putc (ch, (FILE)); \ - break; \ - case 1: \ - fprintf ((FILE), "\\%03o", ch); \ - break; \ - default: \ - putc ('\\', (FILE)); \ - putc (escape, (FILE)); \ - break; \ - } \ - } \ - fprintf ((FILE), "\"\n"); \ - } \ - while (0) - -/* The routine used to output sequences of byte values. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable. Note that if we find subparts of the - character sequence which end with NUL (and which are shorter than - STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ - -#undef ASM_OUTPUT_ASCII -#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ - do \ - { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ - register unsigned bytes_in_chunk = 0; \ - for (; _ascii_bytes < limit; _ascii_bytes++) \ - { \ - register unsigned char *p; \ - if (bytes_in_chunk >= 60) \ - { \ - fprintf ((FILE), "\"\n"); \ - bytes_in_chunk = 0; \ - } \ - for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ - continue; \ - if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT) \ - { \ - if (bytes_in_chunk > 0) \ - { \ - fprintf ((FILE), "\"\n"); \ - bytes_in_chunk = 0; \ - } \ - ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ - _ascii_bytes = p; \ - } \ - else \ - { \ - register int escape; \ - register unsigned ch; \ - if (bytes_in_chunk == 0) \ - fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP); \ - switch (escape = ESCAPES[ch = *_ascii_bytes]) \ - { \ - case 0: \ - putc (ch, (FILE)); \ - bytes_in_chunk++; \ - break; \ - case 1: \ - fprintf ((FILE), "\\%03o", ch); \ - bytes_in_chunk += 4; \ - break; \ - default: \ - putc ('\\', (FILE)); \ - putc (escape, (FILE)); \ - bytes_in_chunk += 2; \ - break; \ - } \ - } \ - } \ - if (bytes_in_chunk > 0) \ - fprintf ((FILE), "\"\n"); \ - } \ - while (0) - -/* All SVR4 targets use the ELF object file format. */ -#define OBJECT_FORMAT_ELF diff --git a/contrib/gcc/config/t-freebsd b/contrib/gcc/config/t-freebsd deleted file mode 100644 index 998168634298..000000000000 --- a/contrib/gcc/config/t-freebsd +++ /dev/null @@ -1,4 +0,0 @@ -# Don't run fixproto -STMP_FIXPROTO = -# Use only native include files -USER_H = $(EXTRA_HEADERS) $(LANG_EXTRA_HEADERS) diff --git a/contrib/gcc/config/t-gnu b/contrib/gcc/config/t-gnu deleted file mode 100644 index 575f729768ca..000000000000 --- a/contrib/gcc/config/t-gnu +++ /dev/null @@ -1,16 +0,0 @@ -# In GNU, "/usr" is a four-letter word. -SYSTEM_HEADER_DIR = /include - -LIBGCC1 = libgcc1.null -CROSS_LIBGCC1 = libgcc1.null - -# The pushl in CTOR initialization interferes with frame pointer elimination. - -# We need to use -fPIC when we are using gcc to compile the routines in -# crtstuff.c. This is only really needed when we are going to use gcc/g++ -# to produce a shared library, but since we don't know ahead of time when -# we will be doing that, we just always use -fPIC when compiling the -# routines in crtstuff.c. - -CRTSTUFF_T_CFLAGS = -fPIC -fno-omit-frame-pointer -TARGET_LIBGCC2_CFLAGS = -fPIC diff --git a/contrib/gcc/config/t-libc-ok b/contrib/gcc/config/t-libc-ok deleted file mode 100644 index 43e4f5e9e048..000000000000 --- a/contrib/gcc/config/t-libc-ok +++ /dev/null @@ -1,3 +0,0 @@ -LIBGCC1=libgcc1.null -CROSS_LIBGCC1=libgcc1.null -CRTSTUFF_T_FLAGS_S=-fPIC diff --git a/contrib/gcc/config/t-linux-aout b/contrib/gcc/config/t-linux-aout deleted file mode 100644 index 8826cddcab65..000000000000 --- a/contrib/gcc/config/t-linux-aout +++ /dev/null @@ -1,11 +0,0 @@ -# Don't run fixproto -STMP_FIXPROTO = - -# Don't install "assert.h" in gcc. We use the one in glibc. -INSTALL_ASSERT_H = - -# Do not build libgcc1. Let gcc generate those functions. The GNU/Linux -# C library can handle them. -LIBGCC1 = -CROSS_LIBGCC1 = -LIBGCC1_TEST = diff --git a/contrib/gcc/config/t-netbsd b/contrib/gcc/config/t-netbsd deleted file mode 100644 index 85d6057feb04..000000000000 --- a/contrib/gcc/config/t-netbsd +++ /dev/null @@ -1,9 +0,0 @@ -LIBGCC1=libgcc1.null -CROSS_LIBGCC1=libgcc1.null -LIBGCC1_TEST= - -# Don't run fixproto -STMP_FIXPROTO = - -# Don't install "assert.h" in gcc. We use the one in glibc. -INSTALL_ASSERT_H = diff --git a/contrib/gcc/config/t-openbsd b/contrib/gcc/config/t-openbsd deleted file mode 100644 index 14bebc13e6ba..000000000000 --- a/contrib/gcc/config/t-openbsd +++ /dev/null @@ -1,7 +0,0 @@ -# Don't run fixproto -STMP_FIXPROTO = - -# We don't need GCC's own include files but we do need lang specific ones. -USER_H = ${LANG_EXTRA_HEADERS} -INSTALL_ASSERT_H = - diff --git a/contrib/gcc/config/t-openbsd-thread b/contrib/gcc/config/t-openbsd-thread deleted file mode 100644 index 4b25f25a4e57..000000000000 --- a/contrib/gcc/config/t-openbsd-thread +++ /dev/null @@ -1,5 +0,0 @@ -# This is currently needed to compile libgcc2 for threads support -TARGET_LIBGCC2_CFLAGS=-pthread -#T_CFLAGS=-pthread -#T_CPPFLAGS=-pthread - diff --git a/contrib/gcc/config/t-rtems b/contrib/gcc/config/t-rtems deleted file mode 100644 index 5d7d5696c3d2..000000000000 --- a/contrib/gcc/config/t-rtems +++ /dev/null @@ -1,13 +0,0 @@ -# RTEMS uses newlib which does not require prototype fixing -STMP_FIXPROTO = - -# Don't install "assert.h" in gcc. RTEMS uses the one in newlib. -INSTALL_ASSERT_H = - -# RTEMS always has limits.h. -LIMITS_H_TEST = true - -# If we are building next to newlib, this will let us find the RTEMS -# limits.h when building libgcc2. Otherwise, newlib must be installed -# first. -LIBGCC2_INCLUDES = -I$(srcdir)/../newlib/libc/sys/rtems/include diff --git a/contrib/gcc/config/t-svr4 b/contrib/gcc/config/t-svr4 deleted file mode 100644 index e6be0c3b0c8f..000000000000 --- a/contrib/gcc/config/t-svr4 +++ /dev/null @@ -1,8 +0,0 @@ -# We need to use -fPIC when we are using gcc to compile the routines in -# crtstuff.c. This is only really needed when we are going to use gcc/g++ -# to produce a shared library, but since we don't know ahead of time when -# we will be doing that, we just always use -fPIC when compiling the -# routines in crtstuff.c. Likewise for libgcc2.c. - -CRTSTUFF_T_CFLAGS = -fPIC -TARGET_LIBGCC2_CFLAGS = -fPIC diff --git a/contrib/gcc/config/tm-dwarf2.h b/contrib/gcc/config/tm-dwarf2.h deleted file mode 100644 index a580964ba1ab..000000000000 --- a/contrib/gcc/config/tm-dwarf2.h +++ /dev/null @@ -1,4 +0,0 @@ -/* Enable Dwarf2 debugging and make it the default */ -#define DWARF2_DEBUGGING_INFO 1 -#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG - diff --git a/contrib/gcc/config/x-interix b/contrib/gcc/config/x-interix deleted file mode 100644 index afdfe76c7f76..000000000000 --- a/contrib/gcc/config/x-interix +++ /dev/null @@ -1,24 +0,0 @@ -# These are host overrides -# From config dir - -# Interix doesn't yet have alloca; it's better to use the portable C version for -# bootstrapping. Do this by defining ALLOCA. - -ALLOCA = alloca.o - -# See all the declarations. -FIXPROTO_DEFINES = -D_XOPEN_SOURCE - -# Don't run fixproto -STMP_FIXPROTO = -RANLIB = : -RANLIB_TEST = false -SHELL = sh - -# Existing CC/GCC may not define -D__INTERIX, so need this here. -# Since we want to configure with _ALL_SOURCE, we need to build that way too -X_CFLAGS= -D__INTERIX -D_ALL_SOURCE - -LIBGCC2_INCLUDES = -idirafter $${INTERIX_ROOT}/usr/include -# Headers come from a funny place -SYSTEM_HEADER_DIR=$${INTERIX_ROOT}/usr/include diff --git a/contrib/gcc/config/x-linux b/contrib/gcc/config/x-linux deleted file mode 100644 index a7c091799e89..000000000000 --- a/contrib/gcc/config/x-linux +++ /dev/null @@ -1,5 +0,0 @@ -# Don't run fixproto -STMP_FIXPROTO = - -# Don't install "assert.h" in gcc. We use the one in glibc. -INSTALL_ASSERT_H = diff --git a/contrib/gcc/config/x-linux-aout b/contrib/gcc/config/x-linux-aout deleted file mode 100644 index 36ae68acec54..000000000000 --- a/contrib/gcc/config/x-linux-aout +++ /dev/null @@ -1,14 +0,0 @@ -# It is defined in config/xm-linux.h. -# X_CFLAGS = -DPOSIX - -# The following is needed when compiling stages 2 and 3 because gcc's -# limits.h must be picked up before /usr/include/limits.h. This is because -# each does an #include_next of the other if the other hasn't been included. -# /usr/include/limits.h loses if it gets found first because /usr/include is -# at the end of the search order. When a new version of gcc is released, -# gcc's limits.h hasn't been installed yet and hence isn't found. - -# BOOT_CFLAGS = -O $(CFLAGS) -Iinclude - -# Don't run fixproto -# STMP_FIXPROTO = diff --git a/contrib/gcc/config/x-lynx b/contrib/gcc/config/x-lynx deleted file mode 100644 index 0be03e453e12..000000000000 --- a/contrib/gcc/config/x-lynx +++ /dev/null @@ -1,6 +0,0 @@ -# /bin/cc is hopelessly broken, so we must use /bin/gcc instead. -CC = $(OLDCC) -OLDCC = /bin/gcc - -# /bin/sh is too buggy, so use /bin/bash instead. -SHELL = /bin/bash diff --git a/contrib/gcc/config/x-netbsd b/contrib/gcc/config/x-netbsd deleted file mode 100644 index 1c272f5a8dc8..000000000000 --- a/contrib/gcc/config/x-netbsd +++ /dev/null @@ -1,6 +0,0 @@ -# Don't run fixproto -STMP_FIXPROTO = - -# We don't need GCC's own include files. -USER_H = -INSTALL_ASSERT_H = diff --git a/contrib/gcc/config/x-svr4 b/contrib/gcc/config/x-svr4 deleted file mode 100644 index 9c705434cc99..000000000000 --- a/contrib/gcc/config/x-svr4 +++ /dev/null @@ -1,9 +0,0 @@ -# Some versions of SVR4 have an alloca in /usr/ucblib/libucb.a, and if we are -# careful to link that in after libc we can use it, but since newer versions of -# SVR4 are dropping libucb, it is better to just use the portable C version for -# bootstrapping. Do this by defining ALLOCA. - -ALLOCA = alloca.o - -# See all the declarations. -FIXPROTO_DEFINES = -D_XOPEN_SOURCE diff --git a/contrib/gcc/config/xm-alloca.h b/contrib/gcc/config/xm-alloca.h deleted file mode 100644 index 3dbdc37a1f0a..000000000000 --- a/contrib/gcc/config/xm-alloca.h +++ /dev/null @@ -1,4 +0,0 @@ -/* If not compiled with GNU C, use the portable alloca. */ -#ifndef __GNUC__ -#define USE_C_ALLOCA -#endif diff --git a/contrib/gcc/config/xm-freebsd.h b/contrib/gcc/config/xm-freebsd.h deleted file mode 100644 index b71ff56ca107..000000000000 --- a/contrib/gcc/config/xm-freebsd.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Configuration for GNU C-compiler for hosts running FreeBSD. - Copyright (C) 1994, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file defines machine-independent things specific to a host - running FreeBSD. This file should not be specified as $xm_file itself; - instead $xm_file should be CPU/xm-freebsd.h, which should include both - CPU/xm-CPU.h and this file xm-freebsd.h. */ diff --git a/contrib/gcc/config/xm-gnu.h b/contrib/gcc/config/xm-gnu.h deleted file mode 100644 index 64e8e2fa8171..000000000000 --- a/contrib/gcc/config/xm-gnu.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Configuration for GNU C-compiler for hosts running GNU. - Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file defines machine-independent things specific to a host - running GNU. This file should not be specified as $xm_file itself; - instead $xm_file should be CPU/xm-gnu.h, which should include both - CPU/xm-CPU.h and this file xm-gnu.h. */ - -#define POSIX /* GNU complies to POSIX.1. */ - -#ifndef inhibit_libc -/* Get a definition of O_RDONLY; some of the GCC files don't include this - properly and will define it themselves to be zero. */ -#include -#endif diff --git a/contrib/gcc/config/xm-interix.h b/contrib/gcc/config/xm-interix.h deleted file mode 100644 index 756fb5d465f2..000000000000 --- a/contrib/gcc/config/xm-interix.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Configuration for GNU compiler for processor running Interix - Copyright (C) 1993, 1995, 1999 Free Software Foundation, Inc. - Donn Terry, Softway Systems, Inc, - from code - Contributed by Douglas B. Rupp (drupp@cs.washington.edu) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef USG -#define USG 1 -#endif - -#ifndef ONLY_INT_FIELDS -#ifndef __GNUC__ -#define ONLY_INT_FIELDS 1 -#endif -#endif - -#ifndef USE_PROTOTYPES -#define USE_PROTOTYPES 1 -#endif - -/* If not compiled with GNU C, use the portable alloca. */ -#ifndef __GNUC__ -#define USE_C_ALLOCA 1 -#endif - -#define NO_SYS_SIGLIST 1 - -/* Our strategy for finding global constructors is a bit different, although - not a lot. */ -#define DO_GLOBAL_CTORS_BODY \ -do { \ - int i; \ - unsigned long nptrs; \ - func_ptr *p; \ - asm( \ - " .section .ctor_head, \"rw\"\n" \ - "1:\n" \ - " .text \n" \ - ASM_LOAD_ADDR(1b,%0) \ - : "=r" (p) : : "cc"); \ - for (nptrs = 0; p[nptrs] != 0; nptrs++); \ - for (i = nptrs-1; i >= 0; i--) \ - p[i] (); \ -} while (0) - -#define DO_GLOBAL_DTORS_BODY \ -do { \ - func_ptr *p; \ - asm( \ - " .section .dtor_head, \"rw\"\n" \ - "1:\n" \ - " .text \n" \ - ASM_LOAD_ADDR(1b,%0) \ - : "=r" (p) : : "cc"); \ - while (*p) \ - { \ - p++; \ - (*(p-1)) (); \ - } \ -} while (0) diff --git a/contrib/gcc/config/xm-linux.h b/contrib/gcc/config/xm-linux.h deleted file mode 100644 index 2cffdb7fab61..000000000000 --- a/contrib/gcc/config/xm-linux.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Configuration for GCC for Intel i386 running Linux-based GNU systems. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - Contributed by H.J. Lu (hjl@nynexst.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#undef HAVE_ATEXIT -#define HAVE_ATEXIT - -#undef POSIX -#define POSIX - -/* We do have one, but I'd like to use the one come with gcc since - we have been doing that for a long time with USG defined. H.J. */ -#undef HAVE_STAB_H - -#undef BSTRING -#define BSTRING diff --git a/contrib/gcc/config/xm-lynx.h b/contrib/gcc/config/xm-lynx.h deleted file mode 100644 index 009f8445eab7..000000000000 --- a/contrib/gcc/config/xm-lynx.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Configuration for GNU C-compiler for Lynx. - Copyright (C) 1993, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file defines machine-independent things specific to a host - running Lynx. This file should not be specified as $xm_file itself; - instead $xm_file should be CPU/xm-lynx.h, which should include this one. */ - -/* #defines that need visibility everywhere. */ -#define FALSE 0 -#define TRUE 1 - -/* Arguments to use with `exit'. */ -#define SUCCESS_EXIT_CODE 0 -#define FATAL_EXIT_CODE 33 - -/* Lynx has no vfork system call. */ -#define vfork fork - -/* Lynx has a non-standard mktemp function. */ -/* ??? This is simpler than creating YATM: Yet Another Target Macro. */ -#define mktemp lynx_mktemp - -#define lynx_mktemp(template) \ -do { \ - int pid = getpid (); \ - char *t = template; \ - char *p; \ - p = t + strlen (t); \ - while (*--p == 'X') \ - { \ - *p = (pid % 10) + '0'; \ - pid /= 10; \ - } \ -} while (0) diff --git a/contrib/gcc/config/xm-netbsd.h b/contrib/gcc/config/xm-netbsd.h deleted file mode 100644 index 099a9234ffa6..000000000000 --- a/contrib/gcc/config/xm-netbsd.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Configuration for GNU C-compiler for hosts running NetBSD. - Copyright (C) 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This file defines machine-independent things specific to a host - running NetBSD. This file should not be specified as $xm_file itself; - instead $xm_file should be CPU/xm-netbsd.h, which should include both - CPU/xm-CPU.h and this file xm-netbsd.h. */ - -#define HAVE_VPRINTF diff --git a/contrib/gcc/config/xm-openbsd.h b/contrib/gcc/config/xm-openbsd.h deleted file mode 100644 index 74a842184c37..000000000000 --- a/contrib/gcc/config/xm-openbsd.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Configuration fragment for hosts running a version of OpenBSD. - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ -/* This file gets included by all architectures. It holds stuff - that ought to be defined when hosting a compiler on an OpenBSD - machine, independently of the architecture. It's included by - ${cpu_type}/xm-openbsd.h, not included directly. */ - -/* OpenBSD is trying to be POSIX-compliant, to the point of fixing - problems that may occur with gcc's interpretation. */ -#undef POSIX -#define POSIX - -/* Ensure we get gnu C's defaults. */ -#ifdef __GNUC__ -#define alloca __builtin_alloca -#endif - - diff --git a/contrib/gcc/config/xm-siglist.h b/contrib/gcc/config/xm-siglist.h deleted file mode 100644 index d6133d6a194a..000000000000 --- a/contrib/gcc/config/xm-siglist.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Some systems provide no sys_siglist, but do offer the same data under - another name. */ - -#define sys_siglist _sys_siglist -#undef SYS_SIGLIST_DECLARED -#define SYS_SIGLIST_DECLARED diff --git a/contrib/gcc/config/xm-std32.h b/contrib/gcc/config/xm-std32.h deleted file mode 100644 index c52782e9741c..000000000000 --- a/contrib/gcc/config/xm-std32.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Configuration for GNU C-compiler for standard 32-bit host machine. - Copyright (C) 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* #defines that need visibility everywhere. */ -#define FALSE 0 -#define TRUE 1 - -/* This describes the machine the compiler is hosted on. */ -#define HOST_BITS_PER_CHAR 8 -#define HOST_BITS_PER_SHORT 16 -#define HOST_BITS_PER_INT 32 -#define HOST_BITS_PER_LONG 32 -#define HOST_BITS_PER_LONGLONG 64 - -/* Arguments to use with `exit'. */ -#define SUCCESS_EXIT_CODE 0 -#define FATAL_EXIT_CODE 33 diff --git a/contrib/gcc/config/xm-svr3.h b/contrib/gcc/config/xm-svr3.h deleted file mode 100644 index 6f252505252d..000000000000 --- a/contrib/gcc/config/xm-svr3.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Configuration for GNU C-compiler for hosts running System V Release 3 - Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define USG - -#ifndef SVR3 -#define SVR3 -#endif diff --git a/contrib/gcc/config/xm-svr4.h b/contrib/gcc/config/xm-svr4.h deleted file mode 100644 index 8534aaa75a12..000000000000 --- a/contrib/gcc/config/xm-svr4.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Configuration for GNU C-compiler for hosts running System V Release 4 - Copyright (C) 1988, 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define USG - -#define POSIX - -/* SVR4 provides no sys_siglist, - but does offer the same data under another name. */ -#define sys_siglist _sys_siglist -#undef SYS_SIGLIST_DECLARED -#define SYS_SIGLIST_DECLARED diff --git a/contrib/gcc/configure b/contrib/gcc/configure deleted file mode 100755 index cc737605ea44..000000000000 --- a/contrib/gcc/configure +++ /dev/null @@ -1,9202 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --with-gnu-ld arrange to work with GNU ld." -ac_help="$ac_help - --with-ld arrange to use the specified ld (full pathname)." -ac_help="$ac_help - --with-gnu-as arrange to work with GNU as." -ac_help="$ac_help - --with-as arrange to use the specified as (full pathname)." -ac_help="$ac_help - --with-stabs arrange to use stabs instead of host debug format." -ac_help="$ac_help - --with-elf arrange to use ELF instead of host debug format." -ac_help="$ac_help - --with-local-prefix=DIR specifies directory to put local include." -ac_help="$ac_help - --with-gxx-include-dir=DIR - specifies directory to put g++ header files." -ac_help="$ac_help - --enable-checking enable expensive run-time checks." -ac_help="$ac_help - --disable-cpp don't provide a user-visible C preprocessor." -ac_help="$ac_help - --with-cpp-install-dir=DIR - install the user visible C preprocessor in DIR - (relative to PREFIX) as well as PREFIX/bin." -ac_help="$ac_help - --enable-cpplib use cpplib for the C preprocessor." -ac_help="$ac_help - --enable-c-cpplib link cpplib directly into C and C++ compilers - (EXPERIMENTAL) (implies --enable-cpplib)." -ac_help="$ac_help - --enable-c-mbchar enable multibyte characters for C and C++." -ac_help="$ac_help - --disable-fast-fixincludes - Disable the new fast fixincludes. - Run the old fixincludes script unconditionally" -ac_help="$ac_help - --enable-haifa use the experimental scheduler. - --disable-haifa don't use the experimental scheduler for the - targets which normally enable it." -ac_help="$ac_help - --enable-threads enable thread usage for target GCC. - --enable-threads=LIB use LIB thread package for target GCC." -ac_help="$ac_help - --enable-objc-gc enable the use of Boehm's garbage collector with - the GNU Objective-C runtime." -ac_help="$ac_help - --enable-java-gc=TYPE choose garbage collector [boehm]" -ac_help="$ac_help - --enable-dwarf2 enable DWARF2 debugging as default." -ac_help="$ac_help - --enable-nls use Native Language Support (disabled by default)" -ac_help="$ac_help - --disable-nls do not use Native Language Support" -ac_help="$ac_help - --with-included-gettext use the GNU gettext library included here" -ac_help="$ac_help - --with-catgets use catgets functions if available" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=tree.c - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - - -remove=rm -hard_link=ln -symbolic_link='ln -s' -copy=cp - -# Check for bogus environment variables. -# Test if LIBRARY_PATH contains the notation for the current directory -# since this would lead to problems installing/building glibc. -# LIBRARY_PATH contains the current directory if one of the following -# is true: -# - one of the terminals (":" and ";") is the first or last sign -# - two terminals occur directly after each other -# - the path contains an element with a dot in it -echo $ac_n "checking LIBRARY_PATH variable""... $ac_c" 1>&6 -echo "configure:599: checking LIBRARY_PATH variable" >&5 -case ${LIBRARY_PATH} in - [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) - library_path_setting="contains current directory" - ;; - *) - library_path_setting="ok" - ;; -esac -echo "$ac_t""$library_path_setting" 1>&6 -if test "$library_path_setting" != "ok"; then -{ echo "configure: error: -*** LIBRARY_PATH shouldn't contain the current directory when -*** building gcc. Please change the environment variable -*** and run configure again." 1>&2; exit 1; } -fi - -# Test if GCC_EXEC_PREFIX contains the notation for the current directory -# since this would lead to problems installing/building glibc. -# GCC_EXEC_PREFIX contains the current directory if one of the following -# is true: -# - one of the terminals (":" and ";") is the first or last sign -# - two terminals occur directly after each other -# - the path contains an element with a dot in it -echo $ac_n "checking GCC_EXEC_PREFIX variable""... $ac_c" 1>&6 -echo "configure:624: checking GCC_EXEC_PREFIX variable" >&5 -case ${GCC_EXEC_PREFIX} in - [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) - gcc_exec_prefix_setting="contains current directory" - ;; - *) - gcc_exec_prefix_setting="ok" - ;; -esac -echo "$ac_t""$gcc_exec_prefix_setting" 1>&6 -if test "$gcc_exec_prefix_setting" != "ok"; then -{ echo "configure: error: -*** GCC_EXEC_PREFIX shouldn't contain the current directory when -*** building gcc. Please change the environment variable -*** and run configure again." 1>&2; exit 1; } -fi - -# Check for additional parameters - -# With GNU ld -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - gnu_ld_flag="$with_gnu_ld" -else - gnu_ld_flag=no -fi - - -# With pre-defined ld -# Check whether --with-ld or --without-ld was given. -if test "${with_ld+set}" = set; then - withval="$with_ld" - DEFAULT_LINKER="$with_ld" -fi - -if test x"${DEFAULT_LINKER+set}" = x"set"; then - if test ! -x "$DEFAULT_LINKER"; then - echo "configure: warning: cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER" 1>&2 - elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then - gnu_ld_flag=yes - fi - cat >> confdefs.h <&2 - elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then - gas_flag=yes - fi - cat >> confdefs.h <&2; exit 1; } ;; -no) ;; -*) local_prefix=$with_local_prefix ;; -esac -fi - - -# Default local prefix if it is empty -if test x$local_prefix = x; then - local_prefix=/usr/local -fi - -# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only -# passed in by the toplevel make and thus we'd get different behavior -# depending on where we built the sources. -gcc_gxx_include_dir= -# Specify the g++ header file directory -# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. -if test "${with_gxx_include_dir+set}" = set; then - withval="$with_gxx_include_dir" - case "${withval}" in -yes) { echo "configure: error: bad value ${withval} given for g++ include directory" 1>&2; exit 1; } ;; -no) ;; -*) gcc_gxx_include_dir=$with_gxx_include_dir ;; -esac -fi - - -if test x${gcc_gxx_include_dir} = x; then - if test x${enable_version_specific_runtime_libs} = xyes; then - gcc_gxx_include_dir='${libsubdir}/include/g++' - else - topsrcdir=${srcdir}/.. . ${srcdir}/../config.if - gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++"-${libstdcxx_interface} - fi -fi - -# Enable expensive internal checks -# Check whether --enable-checking or --disable-checking was given. -if test "${enable_checking+set}" = set; then - enableval="$enable_checking" - case "${enableval}" in -yes) cat >> confdefs.h <<\EOF -#define ENABLE_CHECKING 1 -EOF - ;; -no) ;; -*) { echo "configure: error: bad value ${enableval} given for checking option" 1>&2; exit 1; } ;; -esac -fi - - -# Check whether --enable-cpp or --disable-cpp was given. -if test "${enable_cpp+set}" = set; then - enableval="$enable_cpp" - : -else - enable_cpp=yes -fi - - -# Check whether --with-cpp_install_dir or --without-cpp_install_dir was given. -if test "${with_cpp_install_dir+set}" = set; then - withval="$with_cpp_install_dir" - if test x$withval = xyes; then - { echo "configure: error: option --with-cpp-install-dir requires an argument" 1>&2; exit 1; } -elif test x$withval != xno; then - cpp_install_dir=$withval -fi -fi - - -# Use cpplib+cppmain for the preprocessor, but don't link it with the compiler. -cpp_main=cccp -# Check whether --enable-cpplib or --disable-cpplib was given. -if test "${enable_cpplib+set}" = set; then - enableval="$enable_cpplib" - if test x$enable_cpplib != xno; then - cpp_main=cppmain -fi -fi - - -# Link cpplib into the compiler proper, for C/C++/ObjC. -# Check whether --enable-c-cpplib or --disable-c-cpplib was given. -if test "${enable_c_cpplib+set}" = set; then - enableval="$enable_c_cpplib" - if test x$enable_c_cpplib != xno; then - extra_c_objs="${extra_c_objs} libcpp.a" - extra_cxx_objs="${extra_cxx_objs} ../libcpp.a" - extra_c_flags="${extra_c_flags} -DUSE_CPPLIB=1" - cpp_main=cppmain -fi -fi - - -# Enable Multibyte Characters for C/C++ -# Check whether --enable-c-mbchar or --disable-c-mbchar was given. -if test "${enable_c_mbchar+set}" = set; then - enableval="$enable_c_mbchar" - if test x$enable_c_mbchar != xno; then - extra_c_flags=-DMULTIBYTE_CHARS=1 -fi -fi - - -# Disable fast fixincludes -# Check whether --enable-fast-fixincludes or --disable-fast-fixincludes was given. -if test "${enable_fast_fixincludes+set}" = set; then - enableval="$enable_fast_fixincludes" - if test x$enable_fast_fixincludes = xno ; then - cp $srcdir/fixincludes ./fixinc.sh -fi -fi - - -# Enable Haifa scheduler. -# Check whether --enable-haifa or --disable-haifa was given. -if test "${enable_haifa+set}" = set; then - enableval="$enable_haifa" - : -fi - - -# Enable threads -# Pass with no value to take the default -# Pass with a value to specify a thread package -# Check whether --enable-threads or --disable-threads was given. -if test "${enable_threads+set}" = set; then - enableval="$enable_threads" - if test x$enable_threads = xno; then - enable_threads='' -fi -else - enable_threads='' -fi - - -enable_threads_flag=$enable_threads -# Check if a valid thread package -case x${enable_threads_flag} in - x | xno) - # No threads - target_thread_file='single' - ;; - xyes) - # default - target_thread_file='' - ;; - xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \ - xsolaris | xwin32 | xdce | xvxworks) - target_thread_file=$enable_threads_flag - ;; - *) - echo "$enable_threads is an unknown thread package" 1>&2 - exit 1 - ;; -esac - -# Check whether --enable-objc-gc or --disable-objc-gc was given. -if test "${enable_objc_gc+set}" = set; then - enableval="$enable_objc_gc" - if [ x$enable_objc_gc = xno ]; then - objc_boehm_gc='' -else - objc_boehm_gc=1 -fi -else - objc_boehm_gc='' -fi - - -# Check whether --enable-java-gc or --disable-java-gc was given. -if test "${enable_java_gc+set}" = set; then - enableval="$enable_java_gc" - - JAVAGC=$enableval -else - JAVAGC=boehm -fi - - -# Check whether --with-dwarf2 or --without-dwarf2 was given. -if test "${with_dwarf2+set}" = set; then - withval="$with_dwarf2" - dwarf2="$with_dwarf2" -else - dwarf2=no -fi - - -# Determine the host, build, and target systems -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:965: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:986: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1004: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - -# Find the native compiler -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1031: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1061: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1112: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1144: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1155 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1160: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1186: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1191: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1219: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - - -# If the native compiler is GCC, we can enable warnings even in stage1. -# That's useful for people building cross-compilers, or just running a -# quick `make'. -if test "x$GCC" = "xyes"; then - stage1_warn_cflags='$(WARN_CFLAGS)' -else - stage1_warn_cflags="" -fi - - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1262: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - - -echo $ac_n "checking whether a default assembler was specified""... $ac_c" 1>&6 -echo "configure:1290: checking whether a default assembler was specified" >&5 -if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then - if test x"$gas_flag" = x"no"; then - echo "$ac_t""yes ($DEFAULT_ASSEMBLER)" 1>&6 - else - echo "$ac_t""yes ($DEFAULT_ASSEMBLER - GNU as)" 1>&6 - fi -else - echo "$ac_t""no" 1>&6 -fi - -echo $ac_n "checking whether a default linker was specified""... $ac_c" 1>&6 -echo "configure:1302: checking whether a default linker was specified" >&5 -if test x"${DEFAULT_LINKER+set}" = x"set"; then - if test x"$gnu_ld_flag" = x"no"; then - echo "$ac_t""yes ($DEFAULT_LINKER)" 1>&6 - else - echo "$ac_t""yes ($DEFAULT_LINKER - GNU ld)" 1>&6 - fi -else - echo "$ac_t""no" 1>&6 -fi - -# Find some useful tools -for ac_prog in gawk mawk nawk awk -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1319: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AWK="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AWK="$ac_cv_prog_AWK" -if test -n "$AWK"; then - echo "$ac_t""$AWK" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$AWK" && break -done - -# Extract the first word of "flex", so it can be a program name with args. -set dummy flex; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1351: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LEX="flex" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" -fi -fi -LEX="$ac_cv_prog_LEX" -if test -n "$LEX"; then - echo "$ac_t""$LEX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$LEXLIB" -then - case "$LEX" in - flex*) ac_lib=fl ;; - *) ac_lib=l ;; - esac - echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1385: checking for yywrap in -l$ac_lib" >&5 -ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-l$ac_lib $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LEXLIB="-l$ac_lib" -else - echo "$ac_t""no" 1>&6 -fi - -fi - -echo $ac_n "checking whether ln works""... $ac_c" 1>&6 -echo "configure:1427: checking whether ln works" >&5 -if eval "test \"`echo '$''{'gcc_cv_prog_LN'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata_t -echo >conftestdata_f -if ln conftestdata_f conftestdata_t 2>/dev/null -then - gcc_cv_prog_LN="ln" -else - if ln -s conftestdata_f conftestdata_t 2>/dev/null - then - gcc_cv_prog_LN="ln -s" - else - gcc_cv_prog_LN=cp - fi -fi -rm -f conftestdata_f conftestdata_t - -fi -LN="$gcc_cv_prog_LN" -if test "$gcc_cv_prog_LN" = "ln"; then - echo "$ac_t""yes" 1>&6 -else - if test "$gcc_cv_prog_LN" = "ln -s"; then - echo "$ac_t""no, using ln -s" 1>&6 - else - echo "$ac_t""no, and neither does ln -s, so using cp" 1>&6 - fi -fi - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1459: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'gcc_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata_t -echo >conftestdata_f -if ln -s conftestdata_f conftestdata_t 2>/dev/null -then - gcc_cv_prog_LN_S="ln -s" -else - if ln conftestdata_f conftestdata_t 2>/dev/null - then - gcc_cv_prog_LN_S=ln - else - gcc_cv_prog_LN_S=cp - fi -fi -rm -f conftestdata_f conftestdata_t - -fi -LN_S="$gcc_cv_prog_LN_S" -if test "$gcc_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - if test "$gcc_cv_prog_LN_S" = "ln"; then - echo "$ac_t""no, using ln" 1>&6 - else - echo "$ac_t""no, and neither does ln, so using cp" 1>&6 - fi -fi - -echo $ac_n "checking for volatile""... $ac_c" 1>&6 -echo "configure:1491: checking for volatile" >&5 -if eval "test \"`echo '$''{'gcc_cv_c_volatile'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_c_volatile=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_c_volatile=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gcc_cv_c_volatile" 1>&6 -if test $gcc_cv_c_volatile = yes ; then - cat >> confdefs.h <<\EOF -#define HAVE_VOLATILE 1 -EOF - -fi - -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1526: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -for ac_prog in 'bison -y' byacc -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1558: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_YACC="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -YACC="$ac_cv_prog_YACC" -if test -n "$YACC"; then - echo "$ac_t""$YACC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1599: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1650: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1688: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1730: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -#include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - : -else - cat > conftest.$ac_ext < -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } - -EOF -if { (eval echo configure:1810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1834: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -int main() { -struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:1848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_header_time=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_time=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_time" 1>&6 -if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF -#define TIME_WITH_SYS_TIME 1 -EOF - -fi - -echo $ac_n "checking whether string.h and strings.h may both be included""... $ac_c" 1>&6 -echo "configure:1869: checking whether string.h and strings.h may both be included" >&5 -if eval "test \"`echo '$''{'gcc_cv_header_string'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -int main() { - -; return 0; } -EOF -if { (eval echo configure:1882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_header_string=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_header_string=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gcc_cv_header_string" 1>&6 -if test $gcc_cv_header_string = yes; then - cat >> confdefs.h <<\EOF -#define STRING_WITH_STRINGS 1 -EOF - -fi - -echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1903: checking for sys/wait.h that is POSIX.1 compatible" >&5 -if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#ifndef WEXITSTATUS -#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) -#endif -#ifndef WIFEXITED -#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif -int main() { -int s; -wait (&s); -s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; -; return 0; } -EOF -if { (eval echo configure:1924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_header_sys_wait_h=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_sys_wait_h=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 -if test $ac_cv_header_sys_wait_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_SYS_WAIT_H 1 -EOF - -fi - -for ac_hdr in limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h sys/stat.h direct.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1948: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1958: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - - -# Check for thread headers. -ac_safe=`echo "thread.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for thread.h""... $ac_c" 1>&6 -echo "configure:1988: checking for thread.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1998: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - have_thread_h=yes -else - echo "$ac_t""no" 1>&6 -have_thread_h= -fi - -ac_safe=`echo "pthread.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for pthread.h""... $ac_c" 1>&6 -echo "configure:2022: checking for pthread.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2032: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - have_pthread_h=yes -else - echo "$ac_t""no" 1>&6 -have_pthread_h= -fi - - -# See if GNAT has been installed -# Extract the first word of "gnatbind", so it can be a program name with args. -set dummy gnatbind; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2059: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gnat'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$gnat"; then - ac_cv_prog_gnat="$gnat" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_gnat="yes" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_gnat" && ac_cv_prog_gnat="no" -fi -fi -gnat="$ac_cv_prog_gnat" -if test -n "$gnat"; then - echo "$ac_t""$gnat" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -# See if the system preprocessor understands the ANSI C preprocessor -# stringification operator. -echo $ac_n "checking whether cpp understands the stringify operator""... $ac_c" 1>&6 -echo "configure:2090: checking whether cpp understands the stringify operator" >&5 -if eval "test \"`echo '$''{'gcc_cv_c_have_stringify'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_c_have_stringify=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_c_have_stringify=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gcc_cv_c_have_stringify" 1>&6 -if test $gcc_cv_c_have_stringify = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_CPP_STRINGIFY 1 -EOF - -fi - -# Use only if it exists, -# doesn't clash with , and declares intmax_t. -echo $ac_n "checking for inttypes.h""... $ac_c" 1>&6 -echo "configure:2126: checking for inttypes.h" >&5 -if eval "test \"`echo '$''{'gcc_cv_header_inttypes_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -int main() { -intmax_t i = -1; -; return 0; } -EOF -if { (eval echo configure:2139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_header_inttypes_h=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_header_inttypes_h=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gcc_cv_header_inttypes_h" 1>&6 -if test $gcc_cv_header_inttypes_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_INTTYPES_H 1 -EOF - -fi - -for ac_func in strtoul bsearch strerror putenv popen bcopy bzero bcmp \ - index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \ - sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \ - fputs_unlocked -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2165: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - -# Make sure wchar_t is available -#AC_CHECK_TYPE(wchar_t, unsigned int) - -echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:2222: checking for vprintf" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vprintf(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_vprintf) || defined (__stub___vprintf) -choke me -#else -vprintf(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_vprintf=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_vprintf=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_VPRINTF 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi - -if test "$ac_cv_func_vprintf" != yes; then -echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:2274: checking for _doprnt" >&5 -if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char _doprnt(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub__doprnt) || defined (__stub____doprnt) -choke me -#else -_doprnt(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func__doprnt=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func__doprnt=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_DOPRNT 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi - -fi - -vfprintf= -doprint= -if test $ac_cv_func_vprintf != yes ; then - vfprintf=vfprintf.o - if test $ac_cv_func__doprnt != yes ; then - doprint=doprint.o - fi -fi - - - -echo $ac_n "checking whether the printf functions support %p""... $ac_c" 1>&6 -echo "configure:2338: checking whether the printf functions support %p" >&5 -if eval "test \"`echo '$''{'gcc_cv_func_printf_ptr'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - gcc_cv_func_printf_ptr=no -else - cat > conftest.$ac_ext < - -main() -{ - char buf[64]; - char *p = buf, *q = NULL; - sprintf(buf, "%p", p); - sscanf(buf, "%p", &q); - exit (p != q); -} -EOF -if { (eval echo configure:2359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - gcc_cv_func_printf_ptr=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - gcc_cv_func_printf_ptr=no -fi -rm -fr conftest* -fi - -rm -f core core.* *.core -fi - -echo "$ac_t""$gcc_cv_func_printf_ptr" 1>&6 -if test $gcc_cv_func_printf_ptr = yes ; then - cat >> confdefs.h <<\EOF -#define HAVE_PRINTF_PTR 1 -EOF - -fi - - -case "${host}" in -*-*-uwin*) - # Under some versions of uwin, vfork is notoriously buggy and the test - # can hang configure; on other versions, vfork exists just as a stub. - # FIXME: This should be removed once vfork in uwin's runtime is fixed. - ac_cv_func_vfork_works=no - ;; -esac -echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2392: checking for pid_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_pid_t=yes -else - rm -rf conftest* - ac_cv_type_pid_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_pid_t" 1>&6 -if test $ac_cv_type_pid_t = no; then - cat >> confdefs.h <<\EOF -#define pid_t int -EOF - -fi - -ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2426: checking for vfork.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_VFORK_H 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi - -echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2461: checking for working vfork" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2467: checking for vfork" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vfork(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_vfork) || defined (__stub___vfork) -choke me -#else -vfork(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_vfork=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_vfork=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -fi - -ac_cv_func_vfork_works=$ac_cv_func_vfork -else - cat > conftest.$ac_ext < -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_VFORK_H -#include -#endif -/* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. - The compiler is told about this with #include , - but some compilers (e.g. gcc -O) don't grok . - Test for this by using a static variable whose address - is put into a register that is clobbered by the vfork. */ -static -#ifdef __cplusplus -sparc_address_test (int arg) -#else -sparc_address_test (arg) int arg; -#endif -{ - static pid_t child; - if (!child) { - child = vfork (); - if (child < 0) { - perror ("vfork"); - _exit(2); - } - if (!child) { - arg = getpid(); - write(-1, "", 0); - _exit (arg); - } - } -} -main() { - pid_t parent = getpid (); - pid_t child; - - sparc_address_test (); - - child = vfork (); - - if (child == 0) { - /* Here is another test for sparc vfork register problems. - This test uses lots of local variables, at least - as many local variables as main has allocated so far - including compiler temporaries. 4 locals are enough for - gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. - A buggy compiler should reuse the register of parent - for one of the local variables, since it will think that - parent can't possibly be used any more in this routine. - Assigning to the local variable will thus munge parent - in the parent process. */ - pid_t - p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), - p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); - /* Convince the compiler that p..p7 are live; otherwise, it might - use the same hardware register for all 8 local variables. */ - if (p != p1 || p != p2 || p != p3 || p != p4 - || p != p5 || p != p6 || p != p7) - _exit(1); - - /* On some systems (e.g. IRIX 3.3), - vfork doesn't separate parent from child file descriptors. - If the child closes a descriptor before it execs or exits, - this munges the parent's descriptor as well. - Test for this by closing stdout in the child. */ - _exit(close(fileno(stdout)) != 0); - } else { - int status; - struct stat st; - - while (wait(&status) != child) - ; - exit( - /* Was there some problem with vforking? */ - child < 0 - - /* Did the child fail? (This shouldn't happen.) */ - || status - - /* Did the vfork/compiler bug occur? */ - || parent != getpid() - - /* Did the file descriptor bug occur? */ - || fstat(fileno(stdout), &st) != 0 - ); - } -} -EOF -if { (eval echo configure:2612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_vfork_works=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_vfork_works=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 -if test $ac_cv_func_vfork_works = no; then - cat >> confdefs.h <<\EOF -#define vfork fork -EOF - -fi - - -for ac_func in malloc realloc calloc free bcopy bzero bcmp \ - index rindex getenv atol sbrk abort atof strerror getcwd getwd \ - strsignal putc_unlocked fputs_unlocked strstr -do -echo $ac_n "checking whether $ac_func must be declared""... $ac_c" 1>&6 -echo "configure:2640: checking whether $ac_func must be declared" >&5 -if eval "test \"`echo '$''{'gcc_cv_decl_needed_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#ifdef STRING_WITH_STRINGS -# include -# include -#else -# ifdef HAVE_STRING_H -# include -# else -# ifdef HAVE_STRINGS_H -# include -# endif -# endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifndef HAVE_RINDEX -#define rindex strrchr -#endif -#ifndef HAVE_INDEX -#define index strchr -#endif - -int main() { -char *(*pfn) = (char *(*)) $ac_func -; return 0; } -EOF -if { (eval echo configure:2678: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - eval "gcc_cv_decl_needed_$ac_func=no" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "gcc_cv_decl_needed_$ac_func=yes" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$gcc_cv_decl_needed_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - gcc_tr_decl=NEED_DECLARATION_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi - -done - - -for ac_func in getrlimit setrlimit -do -echo $ac_n "checking whether $ac_func must be declared""... $ac_c" 1>&6 -echo "configure:2707: checking whether $ac_func must be declared" >&5 -if eval "test \"`echo '$''{'gcc_cv_decl_needed_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#ifdef STRING_WITH_STRINGS -# include -# include -#else -# ifdef HAVE_STRING_H -# include -# else -# ifdef HAVE_STRINGS_H -# include -# endif -# endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifndef HAVE_RINDEX -#define rindex strrchr -#endif -#ifndef HAVE_INDEX -#define index strchr -#endif -#include -#ifdef HAVE_SYS_RESOURCE_H -#include -#endif - -int main() { -char *(*pfn) = (char *(*)) $ac_func -; return 0; } -EOF -if { (eval echo configure:2749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - eval "gcc_cv_decl_needed_$ac_func=no" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "gcc_cv_decl_needed_$ac_func=yes" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$gcc_cv_decl_needed_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - gcc_tr_decl=NEED_DECLARATION_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi - -done - - -echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:2776: checking for sys_siglist declaration in signal.h or unistd.h" >&5 -if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -/* NetBSD declares sys_siglist in unistd.h. */ -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *msg = *(sys_siglist + 1); -; return 0; } -EOF -if { (eval echo configure:2793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_decl_sys_siglist=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_decl_sys_siglist=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_decl_sys_siglist" 1>&6 -if test $ac_cv_decl_sys_siglist = yes; then - cat >> confdefs.h <<\EOF -#define SYS_SIGLIST_DECLARED 1 -EOF - -fi - - -# mkdir takes a single argument on some systems. -echo $ac_n "checking if mkdir takes one argument""... $ac_c" 1>&6 -echo "configure:2816: checking if mkdir takes one argument" >&5 -if eval "test \"`echo '$''{'gcc_cv_mkdir_takes_one_arg'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_DIRECT_H -# include -#endif -int main() { -mkdir ("foo", 0); -; return 0; } -EOF -if { (eval echo configure:2838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gcc_cv_mkdir_takes_one_arg=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gcc_cv_mkdir_takes_one_arg=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$gcc_cv_mkdir_takes_one_arg" 1>&6 -if test $gcc_cv_mkdir_takes_one_arg = yes ; then - cat >> confdefs.h <<\EOF -#define MKDIR_TAKES_ONE_ARG 1 -EOF - -fi - - -# File extensions -manext='.1' -objext='.o' - - - -build_xm_file= -build_xm_defines= -build_install_headers_dir=install-headers-tar -build_exeext= -host_xm_file= -host_xm_defines= -host_xmake_file= -host_truncate_target= -host_exeext= - -# Decode the host machine, then the target machine. -# For the host machine, we save the xm_file variable as host_xm_file; -# then we decode the target machine and forget everything else -# that came from the host machine. -for machine in $build $host $target; do - - out_file= - xmake_file= - tmake_file= - extra_headers= - extra_passes= - extra_parts= - extra_programs= - extra_objs= - extra_host_objs= - extra_gcc_objs= - xm_defines= - float_format= - # Set this to force installation and use of collect2. - use_collect2= - # Set this to override the default target model. - target_cpu_default= - # Set this to control how the header file directory is installed. - install_headers_dir=install-headers-tar - # Set this to a non-empty list of args to pass to cpp if the target - # wants its .md file passed through cpp. - md_cppflags= - # Set this if directory names should be truncated to 14 characters. - truncate_target= - # Set this if gdb needs a dir command with `dirname $out_file` - gdb_needs_out_file_path= - # Set this if the build machine requires executables to have a - # file name suffix. - exeext= - # Set this to control which thread package will be used. - thread_file= - # Reinitialize these from the flag values every loop pass, since some - # configure entries modify them. - gas="$gas_flag" - gnu_ld="$gnu_ld_flag" - enable_threads=$enable_threads_flag - - # Set default cpu_type, tm_file and xm_file so it can be updated in - # each machine entry. - cpu_type=`echo $machine | sed 's/-.*$//'` - case $machine in - alpha*-*-*) - cpu_type=alpha - ;; - arm*-*-*) - cpu_type=arm - ;; - c*-convex-*) - cpu_type=convex - ;; - i[34567]86-*-*) - cpu_type=i386 - ;; - hppa*-*-*) - cpu_type=pa - ;; - m68000-*-*) - cpu_type=m68k - ;; - mips*-*-*) - cpu_type=mips - ;; - powerpc*-*-*) - cpu_type=rs6000 - ;; - pyramid-*-*) - cpu_type=pyr - ;; - sparc*-*-*) - cpu_type=sparc - ;; - esac - - tm_file=${cpu_type}/${cpu_type}.h - xm_file=${cpu_type}/xm-${cpu_type}.h - - # Common parts for linux-gnu and openbsd systems - case $machine in - *-*-linux-gnu*) - xm_defines="HAVE_ATEXIT POSIX BSTRING" - ;; - *-*-openbsd*) - tm_file=${cpu_type}/openbsd.h - tmake_file="t-libc-ok t-openbsd" - # avoid surprises, always provide an xm-openbsd file - xm_file=${cpu_type}/xm-openbsd.h - # don't depend on processor x-fragments as well - xmake_file=none - if test x$enable_threads = xyes; then - thread_file='posix' - tmake_file="${tmake_file} t-openbsd-thread" - fi - ;; - esac - - case $machine in - # Support site-specific machine types. - *local*) - cpu_type=`echo $machine | sed -e 's/-.*//'` - rest=`echo $machine | sed -e "s/$cpu_type-//"` - xm_file=${cpu_type}/xm-$rest.h - tm_file=${cpu_type}/$rest.h - if test -f $srcdir/config/${cpu_type}/x-$rest; \ - then xmake_file=${cpu_type}/x-$rest; \ - else true; \ - fi - if test -f $srcdir/config/${cpu_type}/t-$rest; \ - then tmake_file=${cpu_type}/t-$rest; \ - else true; \ - fi - ;; - 1750a-*-*) - ;; - a29k-*-bsd* | a29k-*-sym1*) - tm_file="${tm_file} a29k/unix.h" - xm_defines=USG - xmake_file=a29k/x-unix - use_collect2=yes - ;; - a29k-*-udi | a29k-*-coff) - tm_file="${tm_file} dbxcoff.h a29k/udi.h" - tmake_file=a29k/t-a29kbare - ;; - a29k-wrs-vxworks*) - tm_file="${tm_file} dbxcoff.h a29k/udi.h a29k/vx29k.h" - tmake_file=a29k/t-vx29k - extra_parts="crtbegin.o crtend.o" - thread_file='vxworks' - ;; - a29k-*-*) # Default a29k environment. - use_collect2=yes - ;; - alpha-*-interix) - tm_file="${tm_file} alpha/alpha32.h interix.h alpha/alpha-interix.h" - - # GAS + IEEE_CONFORMANT+IEEE (no inexact); - #target_cpu_default="MASK_GAS|MASK_IEEE_CONFORMANT|MASK_IEEE" - - # GAS + IEEE_CONFORMANT - target_cpu_default="MASK_GAS|MASK_IEEE_CONFORMANT" - - xm_file="alpha/xm-alpha-interix.h xm-interix.h" - xmake_file="x-interix alpha/t-pe" - tmake_file="alpha/t-interix alpha/t-ieee" - if test x$enable_threads = xyes ; then - thread_file='posix' - fi - if test x$stabs = xyes ; then - tm_file="${tm_file} dbxcoff.h" - fi - #prefix='$$INTERIX_ROOT'/usr/contrib - #local_prefix='$$INTERIX_ROOT'/usr/contrib - ;; - alpha*-*-linux-gnuecoff*) - tm_file="${tm_file} alpha/linux-ecoff.h alpha/linux.h" - target_cpu_default="MASK_GAS" - tmake_file="alpha/t-ieee" - gas=no - xmake_file=none - gas=yes gnu_ld=yes - ;; - alpha*-*-linux-gnulibc1*) - tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h" - target_cpu_default="MASK_GAS" - tmake_file="t-linux t-linux-gnulibc1 alpha/t-linux alpha/t-crtbe alpha/t-ieee" - extra_parts="crtbegin.o crtend.o" - xmake_file=none - gas=yes gnu_ld=yes - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - alpha*-*-linux-gnu*) - tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h" - target_cpu_default="MASK_GAS" - tmake_file="t-linux alpha/t-linux alpha/t-crtbe alpha/t-ieee" - extra_parts="crtbegin.o crtend.o" - xmake_file=none - gas=yes gnu_ld=yes - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - alpha*-*-netbsd*) - tm_file="${tm_file} alpha/elf.h alpha/netbsd.h alpha/netbsd-elf.h" - target_cpu_default="MASK_GAS" - tmake_file="alpha/t-crtbe alpha/t-ieee" - extra_parts="crtbegin.o crtend.o" - xmake_file=none - gas=yes gnu_ld=yes - ;; - - alpha*-*-openbsd*) - # default x-alpha is only appropriate for dec-osf. - target_cpu_default="MASK_GAS" - tmake_file="alpha/t-ieee" - ;; - - alpha*-dec-osf*) - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - if test x$gas != xyes - then - extra_passes="mips-tfile mips-tdump" - fi - use_collect2=yes - tmake_file="alpha/t-ieee" - case $machine in - *-*-osf1*) - tm_file="${tm_file} alpha/osf.h alpha/osf12.h alpha/osf2or3.h" - ;; - *-*-osf[23]*) - tm_file="${tm_file} alpha/osf.h alpha/osf2or3.h" - ;; - *-*-osf4*) - tm_file="${tm_file} alpha/osf.h" - # Some versions of OSF4 (specifically X4.0-9 296.7) have - # a broken tar, so we use cpio instead. - install_headers_dir=install-headers-cpio - ;; - esac - case $machine in - *-*-osf4.0[b-z] | *-*-osf4.[1-9]*) - target_cpu_default=MASK_SUPPORT_ARCH - ;; - esac - ;; - alpha*-*-vxworks*) - tm_file="${tm_file} dbx.h alpha/vxworks.h" - tmake_file="alpha/t-ieee" - if x$gas != xyes - then - extra_passes="mips-tfile mips-tdump" - fi - use_collect2=yes - thread_file='vxworks' - ;; - alpha*-*-winnt*) - tm_file="${tm_file} alpha/alpha32.h alpha/win-nt.h winnt/win-nt.h" - xm_file="${xm_file} config/winnt/xm-winnt.h alpha/xm-winnt.h" - tmake_file="t-libc-ok alpha/t-ieee" - xmake_file=winnt/x-winnt - extra_host_objs=oldnames.o - extra_gcc_objs="spawnv.o oldnames.o" - if test x$gnu_ld != xyes - then - extra_programs=ld.exe - fi - if test x$enable_threads = xyes; then - thread_file='win32' - fi - ;; - alpha*-dec-vms*) - tm_file=alpha/vms.h - xm_file="${xm_file} alpha/xm-vms.h" - tmake_file="alpha/t-vms alpha/t-ieee" - ;; - arc-*-elf*) - extra_parts="crtinit.o crtfini.o" - ;; - arm-*-coff* | armel-*-coff*) - tm_file=arm/coff.h - tmake_file=arm/t-bare - ;; - arm-*-vxworks*) - tm_file=arm/vxarm.h - tmake_file=arm/t-bare - thread_file='vxworks' - ;; - arm-*-riscix1.[01]*) # Acorn RISC machine (early versions) - tm_file=arm/riscix1-1.h - use_collect2=yes - ;; - arm-*-riscix*) # Acorn RISC machine - if test x$gas = xyes - then - tm_file=arm/rix-gas.h - else - tm_file=arm/riscix.h - fi - xmake_file=arm/x-riscix - tmake_file=arm/t-riscix - use_collect2=yes - ;; - arm-semi-aout | armel-semi-aout) - tm_file=arm/semi.h - tmake_file=arm/t-semi - ;; - arm-semi-aof | armel-semi-aof) - tm_file=arm/semiaof.h - tmake_file=arm/t-semiaof - ;; - arm*-*-netbsd*) - tm_file=arm/netbsd.h - xm_file="arm/xm-netbsd.h ${xm_file}" - tmake_file="t-netbsd arm/t-netbsd" - use_collect2=yes - ;; - arm*-*-linux-gnuaout*) # ARM GNU/Linux with a.out - cpu_type=arm - xmake_file=x-linux - tm_file=arm/linux-aout.h - tmake_file=arm/t-linux - gnu_ld=yes - ;; - arm*-*-linux-gnu*) # ARM GNU/Linux with ELF - xm_file=arm/xm-linux.h - xmake_file=x-linux - case $machine in - armv2*-*-*) - tm_file=arm/linux-elf26.h - ;; - *) - tm_file=arm/linux-elf.h - ;; - esac - tmake_file="t-linux arm/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - case x${enable_threads} in - x | xyes | xpthreads | xposix) - thread_file='posix' - ;; - esac - ;; - arm*-*-aout) - tm_file=arm/aout.h - tmake_file=arm/t-bare - ;; - arm*-*-ecos-elf) - tm_file=arm/ecos-elf.h - tmake_file=arm/t-elf - ;; - arm*-*-elf) - tm_file=arm/unknown-elf.h - tmake_file=arm/t-arm-elf - ;; - arm*-*-oabi) - tm_file=arm/unknown-elf-oabi.h - tmake_file=arm/t-arm-elf - ;; - c1-convex-*) # Convex C1 - target_cpu_default=1 - use_collect2=yes - ;; - c2-convex-*) # Convex C2 - target_cpu_default=2 - use_collect2=yes - ;; - c32-convex-*) - target_cpu_default=4 - use_collect2=yes - ;; - c34-convex-*) - target_cpu_default=8 - use_collect2=yes - ;; - c38-convex-*) - target_cpu_default=16 - use_collect2=yes - ;; - c4x-*) - cpu_type=c4x - tmake_file=c4x/t-c4x - ;; - clipper-intergraph-clix*) - tm_file="${tm_file} svr3.h clipper/clix.h" - xm_file=clipper/xm-clix.h - xmake_file=clipper/x-clix - extra_headers=va-clipper.h - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; - dsp16xx-*) - ;; - elxsi-elxsi-*) - use_collect2=yes - ;; -# This hasn't been upgraded to GCC 2. -# fx80-alliant-*) # Alliant FX/80 -# ;; - h8300-*-*) - float_format=i32 - ;; - hppa*-*-openbsd*) - target_cpu_default="MASK_PA_11" - tmake_file=pa/t-openbsd - ;; - hppa1.1-*-pro*) - tm_file="pa/pa-pro.h ${tm_file} pa/pa-pro-end.h libgloss.h" - xm_file=pa/xm-papro.h - tmake_file=pa/t-pro - ;; - hppa1.1-*-osf*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-osf.h" - use_collect2=yes - ;; - hppa1.1-*-rtems*) - tm_file="pa/pa-pro.h ${tm_file} pa/pa-pro-end.h libgloss.h pa/rtems.h" - xm_file=pa/xm-papro.h - tmake_file=pa/t-pro - ;; - hppa1.0-*-osf*) - tm_file="${tm_file} pa/pa-osf.h" - use_collect2=yes - ;; - hppa1.1-*-bsd*) - target_cpu_default="MASK_PA_11" - use_collect2=yes - ;; - hppa1.0-*-bsd*) - use_collect2=yes - ;; - hppa1.0-*-hpux7*) - tm_file="pa/pa-oldas.h ${tm_file} pa/pa-hpux7.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.0-*-hpux8.0[0-2]*) - tm_file="${tm_file} pa/pa-hpux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - else - tm_file="pa/pa-oldas.h ${tm_file}" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.1-*-hpux8.0[0-2]*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - else - tm_file="pa/pa-oldas.h ${tm_file}" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.1-*-hpux8*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.0-*-hpux8*) - tm_file="${tm_file} pa/pa-hpux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.1-*-hpux10* | hppa2*-*-hpux10*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux10.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - tmake_file=pa/t-pa - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - if test x$enable_threads = x; then - enable_threads=$have_pthread_h - fi - if test x$enable_threads = xyes; then - thread_file='dce' - tmake_file="${tmake_file} pa/t-dce-thr" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.0-*-hpux10*) - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux10.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - tmake_file=pa/t-pa - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - if test x$enable_threads = x; then - enable_threads=$have_pthread_h - fi - if test x$enable_threads = xyes; then - thread_file='dce' - tmake_file="${tmake_file} pa/t-dce-thr" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.1-*-hpux* | hppa2*-*-hpux*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux9.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.0-*-hpux*) - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux9.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.1-*-hiux* | hppa2*-*-hiux*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hiux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.0-*-hiux*) - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hiux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa*-*-lites*) - target_cpu_default="MASK_PA_11" - use_collect2=yes - ;; - i370-*-mvs*) - ;; - i[34567]86-ibm-aix*) # IBM PS/2 running AIX - if test x$gas = xyes - then - tm_file=i386/aix386.h - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtstuff - else - tm_file=i386/aix386ng.h - use_collect2=yes - fi - xm_file="xm-alloca.h i386/xm-aix.h ${xm_file}" - xm_defines=USG - xmake_file=i386/x-aix - ;; - i[34567]86-ncr-sysv4*) # NCR 3000 - ix86 running system V.4 - xm_file="xm-siglist.h xm-alloca.h ${xm_file}" - xm_defines="USG POSIX SMALL_ARG_MAX" - xmake_file=i386/x-ncr3000 - if test x$stabs = xyes -a x$gas = xyes - then - tm_file=i386/sysv4gdb.h - else - tm_file=i386/sysv4.h - fi - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtpic - ;; - i[34567]86-next-*) - tm_file=i386/next.h - xm_file=i386/xm-next.h - tmake_file=i386/t-next - xmake_file=i386/x-next - extra_objs=nextstep.o - extra_parts="crtbegin.o crtend.o" - if test x$enable_threads = xyes; then - thread_file='mach' - fi - ;; - i[34567]86-sequent-bsd*) # 80386 from Sequent - use_collect2=yes - if test x$gas = xyes - then - tm_file=i386/seq-gas.h - else - tm_file=i386/sequent.h - fi - ;; - i[34567]86-sequent-ptx1*) - xm_defines="USG SVR3" - xmake_file=i386/x-sysv3 - tm_file=i386/seq-sysv3.h - tmake_file=i386/t-crtstuff - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; - i[34567]86-sequent-ptx2* | i[34567]86-sequent-sysv3*) - xm_defines="USG SVR3" - xmake_file=i386/x-sysv3 - tm_file=i386/seq2-sysv3.h - tmake_file=i386/t-crtstuff - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; - i[34567]86-sequent-ptx4* | i[34567]86-sequent-sysv4*) - xm_file="xm-siglist.h xm-alloca.h ${xm_file}" - xm_defines="USG POSIX SMALL_ARG_MAX" - xmake_file=x-svr4 - tm_file=i386/ptx4-i.h - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; - i386-sun-sunos*) # Sun i386 roadrunner - xm_defines=USG - tm_file=i386/sun.h - use_collect2=yes - ;; - i[34567]86-wrs-vxworks*) - tm_file=i386/vxi386.h - tmake_file=i386/t-i386bare - thread_file='vxworks' - ;; - i[34567]86-*-aout*) - tm_file=i386/i386-aout.h - tmake_file=i386/t-i386bare - ;; - i[34567]86-*-bsdi* | i[34567]86-*-bsd386*) - tm_file=i386/bsd386.h -# tmake_file=t-libc-ok - ;; - i[34567]86-*-bsd*) - tm_file=i386/386bsd.h -# tmake_file=t-libc-ok -# Next line turned off because both 386BSD and BSD/386 use GNU ld. -# use_collect2=yes - ;; - i[34567]86-*-freebsdelf*) - tm_file="i386/i386.h i386/att.h svr4.h i386/freebsd-elf.h i386/perform.h" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - tmake_file=t-freebsd - gas=yes - gnu_ld=yes - stabs=yes - ;; - i[34567]86-*-freebsd*) - tm_file=i386/freebsd.h - tmake_file=t-freebsd - ;; - i[34567]86-*-netbsd*) - tm_file=i386/netbsd.h - tmake_file=t-netbsd - use_collect2=yes - ;; - i[34567]86-*-openbsd*) - # we need collect2 until our bug is fixed... - use_collect2=yes - ;; - i[34567]86-*-coff*) - tm_file=i386/i386-coff.h - tmake_file=i386/t-i386bare - ;; - i[34567]86-*-isc*) # 80386 running ISC system - xm_file="${xm_file} i386/xm-isc.h" - xm_defines="USG SVR3" - case $machine in - i[34567]86-*-isc[34]*) - xmake_file=i386/x-isc3 - ;; - *) - xmake_file=i386/x-isc - ;; - esac - if test x$gas = xyes -a x$stabs = xyes - then - tm_file=i386/iscdbx.h - tmake_file=i386/t-svr3dbx - extra_parts="svr3.ifile svr3z.ifile" - else - tm_file=i386/isccoff.h - tmake_file=i386/t-crtstuff - extra_parts="crtbegin.o crtend.o" - fi - install_headers_dir=install-headers-cpio - ;; - i[34567]86-*-linux-gnuoldld*) # Intel 80386's running GNU/Linux - # pre BFD linkers - xmake_file=x-linux-aout - tmake_file="t-linux-aout i386/t-crtstuff" - tm_file=i386/linux-oldld.h - gnu_ld=yes - float_format=i386 - ;; - i[34567]86-*-linux-gnuaout*) # Intel 80386's running GNU/Linux - xmake_file=x-linux-aout - tmake_file="t-linux-aout i386/t-crtstuff" - tm_file=i386/linux-aout.h - gnu_ld=yes - float_format=i386 - ;; - i[34567]86-*-linux-gnulibc1) # Intel 80386's running GNU/Linux - # GNU/Linux C library 5 - xmake_file=x-linux - tm_file=i386/linux.h - tmake_file="t-linux t-linux-gnulibc1 i386/t-crtstuff" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - float_format=i386 - if test x$enable_threads = xyes; then - thread_file='single' - fi - ;; - i[34567]86-*-linux-gnu*) # Intel 80386's running GNU/Linux - # aka GNU/Linux C library 6 - xmake_file=x-linux - tm_file=i386/linux.h - tmake_file="t-linux i386/t-crtstuff" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - float_format=i386 - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - i[34567]86-*-gnu*) - float_format=i386 - ;; - i[34567]86-go32-msdos | i[34567]86-*-go32*) - echo "GO32/DJGPP V1.X is no longer supported. Use *-pc-msdosdjgpp for DJGPP V2.X instead." - exit 1 - ;; - i[34567]86-pc-msdosdjgpp*) - xm_file=i386/xm-djgpp.h - tm_file=i386/djgpp.h - tmake_file=i386/t-djgpp - xmake_file=i386/x-djgpp - gnu_ld=yes - gas=yes - exeext=.exe - case $host in *pc-msdosdjgpp*) - target_alias=djgpp - ;; - esac - ;; - i[34567]86-moss-msdos* | i[34567]86-*-moss*) - tm_file=i386/moss.h - tmake_file=t-libc-ok - gnu_ld=yes - gas=yes - ;; - i[34567]86-*-lynxos*) - if test x$gas = xyes - then - tm_file=i386/lynx.h - else - tm_file=i386/lynx-ng.h - fi - xm_file=i386/xm-lynx.h - tmake_file=i386/t-i386bare - xmake_file=x-lynx - ;; - i[34567]86-*-mach*) - tm_file=i386/mach.h -# tmake_file=t-libc-ok - use_collect2=yes - ;; - i[34567]86-*-osfrose*) # 386 using OSF/rose - if test x$elf = xyes - then - tm_file=i386/osfelf.h - use_collect2= - else - tm_file=i386/osfrose.h - use_collect2=yes - fi - xm_file="i386/xm-osf.h ${xm_file}" - xmake_file=i386/x-osfrose - tmake_file=i386/t-osf - extra_objs=halfpic.o - ;; - i[34567]86-go32-rtems*) - cpu_type=i386 - xm_file=i386/xm-go32.h - tm_file=i386/go32-rtems.h - tmake_file="i386/t-go32 t-rtems" - ;; - i[34567]86-*-rtemself*) - cpu_type=i386 - tm_file=i386/rtemself.h - tmake_file="i386/t-i386bare t-rtems" - ;; - i[34567]86-*-rtems*) - cpu_type=i386 - tm_file=i386/rtems.h - tmake_file="i386/t-i386bare t-rtems" - ;; - i[34567]86-*-sco3.2v5*) # 80386 running SCO Open Server 5 - xm_file="xm-siglist.h xm-alloca.h ${xm_file} i386/xm-sco5.h" - xm_defines="USG SVR3" - xmake_file=i386/x-sco5 - install_headers_dir=install-headers-cpio - tm_file=i386/sco5.h - if test x$gas = xyes - then - tm_file="i386/sco5gas.h ${tm_file}" - tmake_file=i386/t-sco5gas - else - tmake_file=i386/t-sco5 - fi - extra_parts="crti.o crtbegin.o crtend.o crtbeginS.o crtendS.o" - ;; - i[34567]86-*-sco3.2v4*) # 80386 running SCO 3.2v4 system - xm_file="${xm_file} i386/xm-sco.h" - xm_defines="USG SVR3 BROKEN_LDEXP SMALL_ARG_MAX NO_SYS_SIGLIST" - xmake_file=i386/x-sco4 - install_headers_dir=install-headers-cpio - if test x$stabs = xyes - then - tm_file=i386/sco4dbx.h - tmake_file=i386/t-svr3dbx - extra_parts="svr3.ifile svr3z.rfile" - else - tm_file=i386/sco4.h - tmake_file=i386/t-crtstuff - extra_parts="crtbegin.o crtend.o" - fi - truncate_target=yes - ;; - i[34567]86-*-sco*) # 80386 running SCO system - xm_file=i386/xm-sco.h - xmake_file=i386/x-sco - install_headers_dir=install-headers-cpio - if test x$stabs = xyes - then - tm_file=i386/scodbx.h - tmake_file=i386/t-svr3dbx - extra_parts="svr3.ifile svr3z.rfile" - else - tm_file=i386/sco.h - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtstuff - fi - truncate_target=yes - ;; - i[34567]86-*-solaris2*) - xm_file="xm-siglist.h xm-alloca.h ${xm_file}" - xm_defines="USG POSIX SMALL_ARG_MAX" - if test x$gas = xyes; then - # Only needed if gas does not support -s - tm_file=i386/sol2gas.h - else - tm_file=i386/sol2.h - fi - tmake_file=i386/t-sol2 - extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o" - xmake_file=x-svr4 - if test x$enable_threads = xyes; then - thread_file='solaris' - fi - ;; - i[34567]86-*-sysv5*) # Intel x86 on System V Release 5 - xm_file="xm-alloca.h xm-siglist.h ${xm_file}" - xm_defines="USG POSIX" - tm_file=i386/sysv5.h - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - tmake_file=i386/t-crtpic - xmake_file=x-svr4 - extra_parts="crtbegin.o crtend.o" - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - i[34567]86-*-sysv4*) # Intel 80386's running system V.4 - xm_file="xm-siglist.h xm-alloca.h ${xm_file}" - xm_defines="USG POSIX SMALL_ARG_MAX" - tm_file=i386/sysv4.h - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - tmake_file=i386/t-crtpic - xmake_file=x-svr4 - extra_parts="crtbegin.o crtend.o" - ;; - i[34567]86-*-udk*) # Intel x86 on SCO UW/OSR5 Dev Kit - xm_file="xm-alloca.h xm-siglist.h ${xm_file}" - xm_defines="USG POSIX" - tm_file=i386/udk.h - tmake_file="i386/t-crtpic i386/t-udk" - xmake_file=x-svr4 - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; - i[34567]86-*-osf1*) # Intel 80386's running OSF/1 1.3+ - cpu_type=i386 - xm_file="${xm_file} xm-svr4.h i386/xm-sysv4.h i386/xm-osf1elf.h" - xm_defines="USE_C_ALLOCA SMALL_ARG_MAX" - if test x$stabs = xyes - then - tm_file=i386/osf1elfgdb.h - else - tm_file=i386/osf1elf.h - fi - tmake_file=i386/t-osf1elf - xmake_file=i386/x-osf1elf - extra_parts="crti.o crtn.o crtbegin.o crtend.o" - ;; - i[34567]86-*-sysv*) # Intel 80386's running system V - xm_defines="USG SVR3" - xmake_file=i386/x-sysv3 - if test x$gas = xyes - then - if test x$stabs = xyes - then - tm_file=i386/svr3dbx.h - tmake_file=i386/t-svr3dbx - extra_parts="svr3.ifile svr3z.rfile" - else - tm_file=i386/svr3gas.h - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtstuff - fi - else - tm_file=i386/sysv3.h - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtstuff - fi - ;; - i386-*-vsta) # Intel 80386's running VSTa kernel - xm_file="${xm_file} i386/xm-vsta.h" - tm_file=i386/vsta.h - tmake_file=i386/t-vsta - xmake_file=i386/x-vsta - ;; - i[34567]86-*-win32) - xm_file="${xm_file} i386/xm-cygwin.h" - tmake_file=i386/t-cygwin - tm_file=i386/win32.h - xmake_file=i386/x-cygwin - extra_objs=winnt.o - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - ;; - i[34567]86-*-pe | i[34567]86-*-cygwin*) - xm_file="${xm_file} i386/xm-cygwin.h" - tmake_file=i386/t-cygwin - tm_file=i386/cygwin.h - xmake_file=i386/x-cygwin - extra_objs=winnt.o - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - ;; - i[34567]86-*-mingw32*) - tm_file=i386/mingw32.h - xm_file="${xm_file} i386/xm-mingw32.h" - tmake_file="i386/t-cygwin i386/t-mingw32" - extra_objs=winnt.o - xmake_file=i386/x-cygwin - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - case $machine in - *mingw32msv*) - ;; - *minwg32crt* | *mingw32*) - tm_file="${tm_file} i386/crtdll.h" - ;; - esac - ;; - i[34567]86-*-uwin*) - tm_file=i386/uwin.h - xm_file="${xm_file} i386/xm-uwin.h" - xm_defines="USG NO_STAB_H NO_SYS_SIGLIST" - tmake_file="i386/t-cygwin i386/t-uwin" - extra_objs=winnt.o - xmake_file=i386/x-cygwin - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - ;; - i[34567]86-*-interix*) - tm_file="i386/i386-interix.h interix.h" - xm_file="i386/xm-i386-interix.h xm-interix.h" - xm_defines="USG NO_SYS_SIGLIST" - tmake_file="i386/t-interix" - extra_objs=interix.o - xmake_file=x-interix - if test x$enable_threads = xyes ; then - thread_file='posix' - fi - if test x$stabs = xyes ; then - tm_file="${tm_file} dbxcoff.h" - fi - ;; - i[34567]86-*-winnt3*) - tm_file=i386/win-nt.h - out_file=i386/i386.c - xm_file="xm-winnt.h ${xm_file}" - xmake_file=winnt/x-winnt - tmake_file=i386/t-winnt - extra_host_objs="winnt.o oldnames.o" - extra_gcc_objs="spawnv.o oldnames.o" - if test x$gnu_ld != xyes - then - extra_programs=ld.exe - fi - if test x$enable_threads = xyes; then - thread_file='win32' - fi - ;; - i[34567]86-dg-dgux*) - xm_file="xm-alloca.h xm-siglist.h ${xm_file}" - xm_defines="USG POSIX" - out_file=i386/dgux.c - tm_file=i386/dgux.h - tmake_file=i386/t-dgux - xmake_file=i386/x-dgux - install_headers_dir=install-headers-cpio - ;; - i860-alliant-*) # Alliant FX/2800 - tm_file="${tm_file} svr4.h i860/sysv4.h i860/fx2800.h" - xm_file="${xm_file}" - xmake_file=i860/x-fx2800 - tmake_file=i860/t-fx2800 - extra_parts="crtbegin.o crtend.o" - ;; - i860-*-bsd*) - tm_file="${tm_file} i860/bsd.h" - if test x$gas = xyes - then - tm_file="${tm_file} i860/bsd-gas.h" - fi - use_collect2=yes - ;; - i860-*-mach*) - tm_file="${tm_file} i860/mach.h" - tmake_file=t-libc-ok - ;; - i860-*-osf*) # Intel Paragon XP/S, OSF/1AD - tm_file="${tm_file} svr3.h i860/paragon.h" - xm_defines="USG SVR3" - tmake_file=t-osf - ;; - i860-*-sysv3*) - tm_file="${tm_file} svr3.h i860/sysv3.h" - xm_defines="USG SVR3" - xmake_file=i860/x-sysv3 - extra_parts="crtbegin.o crtend.o" - ;; - i860-*-sysv4*) - tm_file="${tm_file} svr4.h i860/sysv4.h" - xm_defines="USG SVR3" - xmake_file=i860/x-sysv4 - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - ;; - i960-wrs-vxworks5 | i960-wrs-vxworks5.0*) - tm_file="${tm_file} i960/vx960.h" - tmake_file=i960/t-vxworks960 - use_collect2=yes - thread_file='vxworks' - ;; - i960-wrs-vxworks5* | i960-wrs-vxworks) - tm_file="${tm_file} dbxcoff.h i960/i960-coff.h i960/vx960-coff.h" - tmake_file=i960/t-vxworks960 - use_collect2=yes - thread_file='vxworks' - ;; - i960-wrs-vxworks*) - tm_file="${tm_file} i960/vx960.h" - tmake_file=i960/t-vxworks960 - use_collect2=yes - thread_file='vxworks' - ;; - i960-*-coff*) - tm_file="${tm_file} dbxcoff.h i960/i960-coff.h libgloss.h" - tmake_file=i960/t-960bare - use_collect2=yes - ;; - i960-*-rtems) - tmake_file="i960/t-960bare t-rtems" - tm_file="${tm_file} dbxcoff.h i960/rtems.h" - use_collect2=yes - ;; - i960-*-*) # Default i960 environment. - use_collect2=yes - ;; - m32r-*-elf*) - extra_parts="crtinit.o crtfini.o" - ;; - m68000-convergent-sysv*) - tm_file=m68k/ctix.h - xm_file="m68k/xm-3b1.h ${xm_file}" - xm_defines=USG - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-hp-bsd*) # HP 9000/200 running BSD - tm_file=m68k/hp2bsd.h - xmake_file=m68k/x-hp2bsd - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-hp-hpux*) # HP 9000 series 300 - xm_file="xm_alloca.h ${xm_file}" - xm_defines="USG NO_SYS_SIGLIST" - if test x$gas = xyes - then - xmake_file=m68k/x-hp320g - tm_file=m68k/hp310g.h - else - xmake_file=m68k/x-hp320 - tm_file=m68k/hp310.h - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-sun-sunos3*) - tm_file=m68k/sun2.h - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-sun-sunos4*) - tm_file=m68k/sun2o4.h - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-att-sysv*) - xm_file="m68k/xm-3b1.h ${xm_file}" - xm_defines=USG - if test x$gas = xyes - then - tm_file=m68k/3b1g.h - else - tm_file=m68k/3b1.h - fi - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-apple-aux*) # Apple Macintosh running A/UX - xm_defines="USG AUX" - tmake_file=m68k/t-aux - install_headers_dir=install-headers-cpio - extra_headers=math-68881.h - extra_parts="crt1.o mcrt1.o maccrt1.o crt2.o crtn.o" - tm_file= - if test "$gnu_ld" = yes - then - tm_file="${tm_file} m68k/auxgld.h" - else - tm_file="${tm_file} m68k/auxld.h" - fi - if test "$gas" = yes - then - tm_file="${tm_file} m68k/auxgas.h" - else - tm_file="${tm_file} m68k/auxas.h" - fi - tm_file="${tm_file} m68k/a-ux.h" - float_format=m68k - ;; - m68k-apollo-*) - tm_file=m68k/apollo68.h - xmake_file=m68k/x-apollo68 - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-altos-sysv*) # Altos 3068 - if test x$gas = xyes - then - tm_file=m68k/altos3068.h - xm_defines=USG - else - echo "The Altos is supported only with the GNU assembler" 1>&2 - exit 1 - fi - extra_headers=math-68881.h - ;; - m68k-bull-sysv*) # Bull DPX/2 - if test x$gas = xyes - then - if test x$stabs = xyes - then - tm_file=m68k/dpx2cdbx.h - else - tm_file=m68k/dpx2g.h - fi - else - tm_file=m68k/dpx2.h - fi - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - xmake_file=m68k/x-dpx2 - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-atari-sysv4*) # Atari variant of V.4. - tm_file=m68k/atari.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines="USG FULL_PROTOTYPES" - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-motorola-sysv*) - tm_file=m68k/mot3300.h - xm_file="xm-alloca.h m68k/xm-mot3300.h ${xm_file}" - xm_defines=NO_SYS_SIGLIST - if test x$gas = xyes - then - xmake_file=m68k/x-mot3300-gas - if test x$gnu_ld = xyes - then - tmake_file=m68k/t-mot3300-gald - else - tmake_file=m68k/t-mot3300-gas - use_collect2=yes - fi - else - xmake_file=m68k/x-mot3300 - if test x$gnu_ld = xyes - then - tmake_file=m68k/t-mot3300-gld - else - tmake_file=m68k/t-mot3300 - use_collect2=yes - fi - fi - gdb_needs_out_file_path=yes - extra_parts="crt0.o mcrt0.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-ncr-sysv*) # NCR Tower 32 SVR3 - tm_file=m68k/tower-as.h - xm_defines="USG SVR3" - xmake_file=m68k/x-tower - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - ;; - m68k-plexus-sysv*) - tm_file=m68k/plexus.h - xm_file="xm-alloca.h m68k/xm-plexus.h ${xm_file}" - xm_defines=USG - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-tti-*) - tm_file=m68k/pbb.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - extra_headers=math-68881.h - ;; - m68k-crds-unos*) - xm_file="xm-alloca.h m68k/xm-crds.h ${xm_file}" - xm_defines="USG unos" - xmake_file=m68k/x-crds - tm_file=m68k/crds.h - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-cbm-sysv4*) # Commodore variant of V.4. - tm_file=m68k/amix.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines="USG FULL_PROTOTYPES" - xmake_file=m68k/x-amix - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-ccur-rtu) - tm_file=m68k/ccur-GAS.h - xmake_file=m68k/x-ccur - extra_headers=math-68881.h - use_collect2=yes - float_format=m68k - ;; - m68k-hp-bsd4.4*) # HP 9000/3xx running 4.4bsd - tm_file=m68k/hp3bsd44.h - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-hp-bsd*) # HP 9000/3xx running Berkeley Unix - tm_file=m68k/hp3bsd.h - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-isi-bsd*) - if test x$with_fp = xno - then - tm_file=m68k/isi-nfp.h - else - tm_file=m68k/isi.h - float_format=m68k - fi - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-hp-hpux7*) # HP 9000 series 300 running HPUX version 7. - xm_file="xm_alloca.h ${xm_file}" - xm_defines="USG NO_SYS_SIGLIST" - if test x$gas = xyes - then - xmake_file=m68k/x-hp320g - tm_file=m68k/hp320g.h - else - xmake_file=m68k/x-hp320 - tm_file=m68k/hpux7.h - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-hp-hpux*) # HP 9000 series 300 - xm_file="xm_alloca.h ${xm_file}" - xm_defines="USG NO_SYS_SIGLIST" - if test x$gas = xyes - then - xmake_file=m68k/x-hp320g - tm_file=m68k/hp320g.h - else - xmake_file=m68k/x-hp320 - tm_file=m68k/hp320.h - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-sun-mach*) - tm_file=m68k/sun3mach.h - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-sony-newsos3*) - if test x$gas = xyes - then - tm_file=m68k/news3gas.h - else - tm_file=m68k/news3.h - fi - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-sony-bsd* | m68k-sony-newsos*) - if test x$gas = xyes - then - tm_file=m68k/newsgas.h - else - tm_file=m68k/news.h - fi - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-next-nextstep2*) - tm_file=m68k/next21.h - xm_file="m68k/xm-next.h ${xm_file}" - tmake_file=m68k/t-next - xmake_file=m68k/x-next - extra_objs=nextstep.o - extra_headers=math-68881.h - use_collect2=yes - float_format=m68k - ;; - m68k-next-nextstep3*) - tm_file=m68k/next.h - xm_file="m68k/xm-next.h ${xm_file}" - tmake_file=m68k/t-next - xmake_file=m68k/x-next - extra_objs=nextstep.o - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - if test x$enable_threads = xyes; then - thread_file='mach' - fi - ;; - m68k-sun-sunos3*) - if test x$with_fp = xno - then - tm_file=m68k/sun3n3.h - else - tm_file=m68k/sun3o3.h - float_format=m68k - fi - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-sun-sunos*) # For SunOS 4 (the default). - if test x$with_fp = xno - then - tm_file=m68k/sun3n.h - else - tm_file=m68k/sun3.h - float_format=m68k - fi - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-wrs-vxworks*) - tm_file=m68k/vxm68k.h - tmake_file=m68k/t-vxworks68 - extra_headers=math-68881.h - thread_file='vxworks' - float_format=m68k - ;; - m68k-*-aout*) - tmake_file=m68k/t-m68kbare - tm_file="m68k/m68k-aout.h libgloss.h" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-*-coff*) - tmake_file=m68k/t-m68kbare - tm_file="m68k/m68k-coff.h dbx.h libgloss.h" - extra_headers=math-68881.h - float_format=m68k - ;; - m68020-*-elf* | m68k-*-elf*) - tm_file="m68k/m68020-elf.h libgloss.h" - xm_file=m68k/xm-m68kv.h - tmake_file=m68k/t-m68kelf - header_files=math-68881.h - ;; - m68k-*-lynxos*) - if test x$gas = xyes - then - tm_file=m68k/lynx.h - else - tm_file=m68k/lynx-ng.h - fi - xm_file=m68k/xm-lynx.h - xmake_file=x-lynx - tmake_file=m68k/t-lynx - extra_headers=math-68881.h - float_format=m68k - ;; - m68k*-*-netbsd*) - tm_file=m68k/netbsd.h - tmake_file=t-netbsd - float_format=m68k - use_collect2=yes - ;; - m68k*-*-openbsd*) - float_format=m68k - # we need collect2 until our bug is fixed... - use_collect2=yes - ;; - m68k-*-sysv3*) # Motorola m68k's running system V.3 - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - xmake_file=m68k/x-m68kv - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-*-sysv4*) # Motorola m68k's running system V.4 - tm_file=m68k/m68kv4.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-*-linux-gnuaout*) # Motorola m68k's running GNU/Linux - # with a.out format - xmake_file=x-linux - tm_file=m68k/linux-aout.h - tmake_file="t-linux-aout m68k/t-linux-aout" - extra_headers=math-68881.h - float_format=m68k - gnu_ld=yes - ;; - m68k-*-linux-gnulibc1) # Motorola m68k's running GNU/Linux - # with ELF format using the - # GNU/Linux C library 5 - xmake_file=x-linux - tm_file=m68k/linux.h - tmake_file="t-linux t-linux-gnulibc1 m68k/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - extra_headers=math-68881.h - float_format=m68k - gnu_ld=yes - ;; - m68k-*-linux-gnu*) # Motorola m68k's running GNU/Linux - # with ELF format using glibc 2 - # aka the GNU/Linux C library 6. - xmake_file=x-linux - tm_file=m68k/linux.h - tmake_file="t-linux m68k/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - extra_headers=math-68881.h - float_format=m68k - gnu_ld=yes - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - m68k-*-psos*) - tmake_file=m68k/t-m68kbare - tm_file=m68k/m68k-psos.h - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-*-rtems*) - tmake_file="m68k/t-m68kbare t-rtems" - tm_file=m68k/rtems.h - extra_headers=math-68881.h - float_format=m68k - ;; - - m88k-dg-dgux*) - case $machine in - m88k-dg-dguxbcs*) - tm_file=m88k/dguxbcs.h - tmake_file=m88k/t-dguxbcs - ;; - *) - tm_file=m88k/dgux.h - tmake_file=m88k/t-dgux - ;; - esac - extra_parts="crtbegin.o bcscrtbegin.o crtend.o m88kdgux.ld" - xmake_file=m88k/x-dgux - if test x$gas = xyes - then - tmake_file=m88k/t-dgux-gas - fi - ;; - m88k-dolphin-sysv3*) - tm_file=m88k/dolph.h - extra_parts="crtbegin.o crtend.o" - xm_file="m88k/xm-sysv3.h ${xm_file}" - xmake_file=m88k/x-dolph - if test x$gas = xyes - then - tmake_file=m88k/t-m88k-gas - fi - ;; - m88k-tektronix-sysv3) - tm_file=m88k/tekXD88.h - extra_parts="crtbegin.o crtend.o" - xm_file="m88k/xm-sysv3.h ${xm_file}" - xmake_file=m88k/x-tekXD88 - if test x$gas = xyes - then - tmake_file=m88k/t-m88k-gas - fi - ;; - m88k-*-aout*) - tm_file=m88k/m88k-aout.h - ;; - m88k-*-coff*) - tm_file=m88k/m88k-coff.h - tmake_file=m88k/t-bug - ;; - m88k-*-luna*) - tm_file=m88k/luna.h - extra_parts="crtbegin.o crtend.o" - if test x$gas = xyes - then - tmake_file=m88k/t-luna-gas - else - tmake_file=m88k/t-luna - fi - ;; - m88k-*-openbsd*) - tmake_file="${tmake_file} m88k/t-luna-gas" - ;; - m88k-*-sysv3*) - tm_file=m88k/sysv3.h - extra_parts="crtbegin.o crtend.o" - xm_file="m88k/xm-sysv3.h ${xm_file}" - xmake_file=m88k/x-sysv3 - if test x$gas = xyes - then - tmake_file=m88k/t-m88k-gas - fi - ;; - m88k-*-sysv4*) - tm_file=m88k/sysv4.h - extra_parts="crtbegin.o crtend.o" - xmake_file=m88k/x-sysv4 - tmake_file=m88k/t-sysv4 - ;; - mips-sgi-irix6*) # SGI System V.4., IRIX 6 - tm_file=mips/iris6.h - xm_file=mips/xm-iris6.h - xmake_file=mips/x-iris6 - tmake_file=mips/t-iris6 -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-wrs-vxworks) - tm_file="mips/elf.h libgloss.h mips/vxworks.h" - tmake_file=mips/t-ecoff - gas=yes - gnu_ld=yes - extra_parts="crtbegin.o crtend.o" - thread_file='vxworks' - ;; - mips-sgi-irix5cross64) # Irix5 host, Irix 6 target, cross64 - tm_file="mips/iris6.h mips/cross64.h" - xm_defines=USG - xm_file="mips/xm-iris5.h" - xmake_file=mips/x-iris - tmake_file=mips/t-cross64 - # See comment in mips/iris[56].h files. - use_collect2=yes -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-sni-sysv4) - if test x$gas = xyes - then - if test x$stabs = xyes - then - tm_file=mips/iris5gdb.h - else - tm_file="mips/sni-svr4.h mips/sni-gas.h" - fi - else - tm_file=mips/sni-svr4.h - fi - xm_defines=USG - xmake_file=mips/x-sni-svr4 - tmake_file=mips/t-mips-gas - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-sgi-irix5*) # SGI System V.4., IRIX 5 - if test x$gas = xyes - then - tm_file="mips/iris5.h mips/iris5gas.h" - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - else - tm_file=mips/iris5.h - fi - xm_defines=USG - xm_file="mips/xm-iris5.h" - xmake_file=mips/x-iris - # mips-tfile doesn't work yet - tmake_file=mips/t-mips-gas - # See comment in mips/iris5.h file. - use_collect2=yes -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-sgi-irix4loser*) # Mostly like a MIPS. - tm_file="mips/iris4loser.h mips/iris3.h ${tm_file} mips/iris4.h" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-iris - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-sgi-irix4*) # Mostly like a MIPS. - tm_file="mips/iris3.h ${tm_file} mips/iris4.h" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-iris - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-sgi-*) # Mostly like a MIPS. - tm_file="mips/iris3.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-iris3 - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-dec-osfrose*) # Decstation running OSF/1 reference port with OSF/rose. - tm_file="mips/osfrose.h ${tm_file}" - xmake_file=mips/x-osfrose - tmake_file=mips/t-osfrose - extra_objs=halfpic.o - use_collect2=yes - ;; - mips-dec-osf*) # Decstation running OSF/1 as shipped by DIGITAL - tm_file=mips/dec-osf1.h - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xmake_file=mips/x-dec-osf1 - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - tmake_file=mips/t-ultrix - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-dec-bsd*) # Decstation running 4.4 BSD - tm_file=mips/dec-bsd.h - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - tmake_file=mips/t-ultrix - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mipsel-*-netbsd* | mips-dec-netbsd*) # Decstation running NetBSD - tm_file=mips/netbsd.h - # On NetBSD, the headers are already okay, except for math.h. - tmake_file=t-netbsd - ;; - mips*-*-linux*) # Linux MIPS, either endian. - xmake_file=x-linux - xm_file="xm-siglist.h ${xm_file}" - case $machine in - mipsel-*) tm_file="mips/elfl.h mips/linux.h" ;; - *) tm_file="mips/elf.h mips/linux.h" ;; - esac - extra_parts="crtbegin.o crtend.o" - gnu_ld=yes - gas=yes - ;; - mips*el-*-openbsd*) # mips little endian - target_cpu_default="MASK_GAS|MASK_ABICALLS" - tm_file=mips/openbsd.h - ;; - mips*-*-openbsd*) # mips big endian - target_cpu_default="MASK_GAS|MASK_ABICALLS" - tm_file=mips/openbsd-be.h - ;; - mips-sony-bsd* | mips-sony-newsos*) # Sony NEWS 3600 or risc/news. - tm_file="mips/news4.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - xmake_file=mips/x-sony - ;; - mips-sony-sysv*) # Sony NEWS 3800 with NEWSOS5.0. - # That is based on svr4. - # t-svr4 is not right because this system doesn't use ELF. - tm_file="mips/news5.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_file="xm-siglist.h ${xm_file}" - xm_defines=USG - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-tandem-sysv4*) # Tandem S2 running NonStop UX - tm_file="mips/svr4-5.h mips/svr4-t.h" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_file="xm-siglist.h ${xm_file}" - xm_defines=USG - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - extra_parts="crtbegin.o crtend.o" - else - tmake_file=mips/t-mips - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-ultrix* | mips-dec-mach3) # Decstation. - tm_file="mips/ultrix.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xmake_file=mips/x-ultrix - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - tmake_file=mips/t-ultrix - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-riscos[56789]bsd*) - tm_file=mips/bsd-5.h # MIPS BSD 4.3, RISC-OS 5.0 - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-bsd-gas - else - tmake_file=mips/t-bsd - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-bsd* | mips-*-riscosbsd* | mips-*-riscos[1234]bsd*) - tm_file="mips/bsd-4.h ${tm_file}" # MIPS BSD 4.3, RISC-OS 4.0 - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-bsd-gas - else - tmake_file=mips/t-bsd - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-riscos[56789]sysv4*) - tm_file=mips/svr4-5.h # MIPS System V.4., RISC-OS 5.0 - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_file="xm-siglist.h ${xm_file}" - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-svr4-gas - else - tmake_file=mips/t-svr4 - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-sysv4* | mips-*-riscos[1234]sysv4* | mips-*-riscossysv4*) - tm_file="mips/svr4-4.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-svr4-gas - else - tmake_file=mips/t-svr4 - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-riscos[56789]sysv*) - tm_file=mips/svr3-5.h # MIPS System V.3, RISC-OS 5.0 - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-svr3-gas - else - tmake_file=mips/t-svr3 - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-sysv* | mips-*-riscos*sysv*) - tm_file="mips/svr3-4.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-svr3-gas - else - tmake_file=mips/t-svr3 - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-riscos[56789]*) # Default MIPS RISC-OS 5.0. - tm_file=mips/mips-5.h - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-gnu*) - ;; - mipsel-*-ecoff*) - tm_file=mips/ecoffl.h - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - tmake_file=mips/t-ecoff - ;; - mips-*-ecoff*) - tm_file="gofast.h mips/ecoff.h" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - tmake_file=mips/t-ecoff - ;; - mipsel-*-elf*) - tm_file="mips/elfl.h libgloss.h" - tmake_file=mips/t-elf - ;; - mips-*-elf*) - tm_file="mips/elf.h" - tmake_file=mips/t-elf - ;; - mips64el-*-elf*) - tm_file="mips/elfl64.h" - tmake_file=mips/t-elf - ;; - mips64orionel-*-elf*) - tm_file="mips/elforion.h mips/elfl64.h libgloss.h" - tmake_file=mips/t-elf - ;; - mips64-*-elf*) - tm_file="mips/elf64.h" - tmake_file=mips/t-elf - ;; - mips64orion-*-elf*) - tm_file="mips/elforion.h mips/elf64.h libgloss.h" - tmake_file=mips/t-elf - ;; - mips64orion-*-rtems*) - tm_file="mips/elforion.h mips/elf64.h mips/rtems64.h" - tmake_file="mips/t-ecoff t-rtems" - ;; - mipstx39el-*-elf*) - tm_file="mips/r3900.h mips/elfl.h mips/abi64.h" - tmake_file=mips/t-r3900 - ;; - mipstx39-*-elf*) - tm_file="mips/r3900.h mips/elf.h mips/abi64.h" - tmake_file=mips/t-r3900 - ;; - mips-*-*) # Default MIPS RISC-OS 4.0. - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mn10200-*-*) - cpu_type=mn10200 - tm_file="mn10200/mn10200.h" - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - use_collect2=no - ;; - mn10300-*-*) - cpu_type=mn10300 - tm_file="mn10300/mn10300.h" - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - use_collect2=no - ;; - ns32k-encore-bsd*) - tm_file=ns32k/encore.h - use_collect2=yes - ;; - ns32k-sequent-bsd*) - tm_file=ns32k/sequent.h - use_collect2=yes - ;; - ns32k-tek6100-bsd*) - tm_file=ns32k/tek6100.h - use_collect2=yes - ;; - ns32k-tek6200-bsd*) - tm_file=ns32k/tek6200.h - use_collect2=yes - ;; -# This has not been updated to GCC 2. -# ns32k-ns-genix*) -# xm_defines=USG -# xmake_file=ns32k/x-genix -# tm_file=ns32k/genix.h -# use_collect2=yes -# ;; - ns32k-merlin-*) - tm_file=ns32k/merlin.h - use_collect2=yes - ;; - ns32k-pc532-mach*) - tm_file=ns32k/pc532-mach.h - use_collect2=yes - ;; - ns32k-pc532-minix*) - tm_file=ns32k/pc532-min.h - xm_file="ns32k/xm-pc532-min.h ${xm-file}" - xm_defines=USG - use_collect2=yes - ;; - ns32k-*-netbsd*) - tm_file=ns32k/netbsd.h - xm_file="ns32k/xm-netbsd.h ${xm_file}" - # On NetBSD, the headers are already okay, except for math.h. - tmake_file=t-netbsd - use_collect2=yes - ;; - pdp11-*-bsd) - tm_file="${tm_file} pdp11/2bsd.h" - ;; - pdp11-*-*) - ;; - ns32k-*-openbsd*) - # Nothing special - ;; - pyramid-*-*) - cpu_type=pyr - xmake_file=pyr/x-pyr - use_collect2=yes - ;; - romp-*-aos*) - use_collect2=yes - ;; - romp-*-mach*) - xmake_file=romp/x-mach - use_collect2=yes - ;; - romp-*-openbsd*) - # Nothing special - ;; - powerpc-*-openbsd*) - tmake_file="${tmake_file} rs6000/t-rs6000 rs6000/t-openbsd" - ;; - powerpc-*-beos*) - cpu_type=rs6000 - tm_file=rs6000/beos.h - xm_file=rs6000/xm-beos.h - tmake_file=rs6000/t-beos - xmake_file=rs6000/x-beos - ;; - powerpc-*-sysv* | powerpc-*-elf*) - tm_file=rs6000/sysv4.h - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG POSIX" - extra_headers=ppc-asm.h - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - xmake_file=rs6000/x-sysv4 - ;; - powerpc-*-eabiaix*) - tm_file=rs6000/eabiaix.h - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - extra_headers=ppc-asm.h - ;; - powerpc-*-eabisim*) - tm_file=rs6000/eabisim.h - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - extra_headers=ppc-asm.h - ;; - powerpc-*-eabi*) - tm_file=rs6000/eabi.h - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - extra_headers=ppc-asm.h - ;; - powerpc-*-rtems*) - tm_file=rs6000/rtems.h - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcgas t-rtems rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc t-rtems rs6000/t-ppccomm" - fi - extra_headers=ppc-asm.h - ;; - powerpc-*-linux-gnulibc1) - tm_file=rs6000/linux.h - xm_file=rs6000/xm-sysv4.h - out_file=rs6000/rs6000.c - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos t-linux t-linux-gnulibc1 rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc t-linux t-linux-gnulibc1 rs6000/t-ppccomm" - fi - xmake_file=x-linux - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - extra_headers=ppc-asm.h - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - powerpc-*-linux-gnu*) - tm_file=rs6000/linux.h - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG ${xm_defines}" - out_file=rs6000/rs6000.c - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos t-linux rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc t-linux rs6000/t-ppccomm" - fi - xmake_file=x-linux - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - extra_headers=ppc-asm.h - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - powerpc-wrs-vxworks*) - cpu_type=rs6000 - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG POSIX" - tm_file=rs6000/vxppc.h - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - extra_headers=ppc-asm.h - thread_file='vxworks' - ;; - powerpcle-*-sysv* | powerpcle-*-elf*) - tm_file=rs6000/sysv4le.h - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG POSIX" - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - xmake_file=rs6000/x-sysv4 - extra_headers=ppc-asm.h - ;; - powerpcle-*-eabisim*) - tm_file=rs6000/eabilesim.h - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - extra_headers=ppc-asm.h - ;; - powerpcle-*-eabi*) - tm_file=rs6000/eabile.h - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - extra_headers=ppc-asm.h - ;; - powerpcle-*-winnt* ) - tm_file=rs6000/win-nt.h - tmake_file=rs6000/t-winnt -# extra_objs=pe.o - if test x$enable_threads = xyes; then - thread_file='win32' - fi - extra_headers=ppc-asm.h - ;; - powerpcle-*-pe | powerpcle-*-cygwin*) - tm_file=rs6000/cygwin.h - xm_file="rs6000/xm-cygwin.h ${xm_file}" - tmake_file=rs6000/t-winnt - xmake_file=rs6000/x-cygwin -# extra_objs=pe.o - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - extra_headers=ppc-asm.h - ;; - powerpcle-*-solaris2*) - tm_file=rs6000/sol2.h - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG POSIX" - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - xmake_file=rs6000/x-sysv4 - extra_headers=ppc-asm.h - ;; - rs6000-ibm-aix3.[01]*) - tm_file=rs6000/aix31.h - xmake_file=rs6000/x-aix31 - float_format=none - use_collect2=yes - ;; - rs6000-ibm-aix3.2.[456789]* | powerpc-ibm-aix3.2.[456789]*) - tm_file=rs6000/aix3newas.h - if test x$host != x$target - then - tmake_file=rs6000/t-xnewas - else - tmake_file=rs6000/t-newas - fi - float_format=none - use_collect2=yes - ;; - rs6000-ibm-aix4.[12]* | powerpc-ibm-aix4.[12]*) - tm_file=rs6000/aix41.h - if test x$host != x$target - then - tmake_file=rs6000/t-xnewas - else - tmake_file=rs6000/t-newas - fi - if test "$gnu_ld" = yes - then - xmake_file=rs6000/x-aix41-gld - else - xmake_file=rs6000/x-aix41 - fi - float_format=none - use_collect2=yes - ;; - rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*) - tm_file=rs6000/aix43.h - if test x$host != x$target - then - tmake_file=rs6000/t-xaix43 - else - tmake_file=rs6000/t-aix43 - fi - xmake_file=rs6000/x-aix43 - float_format=none - use_collect2=yes - ;; - rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*) - tm_file=rs6000/aix43.h - if test x$host != x$target - then - tmake_file=rs6000/t-xaix43 - else - tmake_file=rs6000/t-aix43 - fi - xmake_file=rs6000/x-aix43 - float_format=none - use_collect2=yes - ;; - rs6000-ibm-aix*) - float_format=none - use_collect2=yes - ;; - rs6000-bull-bosx) - float_format=none - use_collect2=yes - ;; - rs6000-*-mach*) - tm_file=rs6000/mach.h - xm_file="${xm_file} rs6000/xm-mach.h" - xmake_file=rs6000/x-mach - use_collect2=yes - ;; - rs6000-*-lynxos*) - tm_file=rs6000/lynx.h - xm_file=rs6000/xm-lynx.h - tmake_file=rs6000/t-rs6000 - xmake_file=rs6000/x-lynx - use_collect2=yes - ;; - sh-*-elf*) - tm_file=sh/elf.h - float_format=sh - ;; - sh-*-rtemself*) - tmake_file="sh/t-sh t-rtems" - tm_file=sh/rtemself.h - float_format=sh - ;; - sh-*-rtems*) - tmake_file="sh/t-sh t-rtems" - tm_file=sh/rtems.h - float_format=sh - ;; - sh-*-*) - float_format=sh - ;; - sparc-tti-*) - tm_file=sparc/pbd.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - ;; - sparc-wrs-vxworks* | sparclite-wrs-vxworks*) - tm_file=sparc/vxsparc.h - tmake_file=sparc/t-vxsparc - use_collect2=yes - thread_file='vxworks' - ;; - sparc-*-aout*) - tmake_file=sparc/t-sparcbare - tm_file="sparc/aout.h libgloss.h" - ;; - sparc-*-netbsd*) - tm_file=sparc/netbsd.h - tmake_file=t-netbsd - use_collect2=yes - ;; - sparc-*-openbsd*) - # we need collect2 until our bug is fixed... - use_collect2=yes - ;; - sparc-*-bsd*) - tm_file=sparc/bsd.h - ;; - sparc-*-elf*) - tm_file=sparc/elf.h - tmake_file=sparc/t-elf - extra_parts="crti.o crtn.o crtbegin.o crtend.o" - #float_format=i128 - float_format=i64 - ;; - sparc-*-linux-gnuaout*) # Sparc's running GNU/Linux, a.out - xm_file="${xm_file} sparc/xm-linux.h" - tm_file=sparc/linux-aout.h - xmake_file=x-linux - gnu_ld=yes - ;; - sparc-*-linux-gnulibc1*) # Sparc's running GNU/Linux, libc5 - xm_file="${xm_file} sparc/xm-linux.h" - xmake_file=x-linux - tm_file=sparc/linux.h - tmake_file="t-linux t-linux-gnulibc1" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - ;; - sparc-*-linux-gnu*) # Sparc's running GNU/Linux, libc6 - xm_file="${xm_file} sparc/xm-linux.h" - xmake_file=x-linux - tm_file=sparc/linux.h - tmake_file="t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - sparc-*-lynxos*) - if test x$gas = xyes - then - tm_file=sparc/lynx.h - else - tm_file=sparc/lynx-ng.h - fi - xm_file=sparc/xm-lynx.h - tmake_file=sparc/t-sunos41 - xmake_file=x-lynx - ;; - sparc-*-rtems*) - tmake_file="sparc/t-sparcbare t-rtems" - tm_file=sparc/rtems.h - ;; - sparcv9-*-solaris2*) - tm_file=sparc/sol2-sld-64.h - xm_file="sparc/xm-sysv4-64.h sparc/xm-sol2.h" - xm_defines="USG POSIX" - tmake_file="sparc/t-sol2 sparc/t-sol2-64" - xmake_file=sparc/x-sysv4 - extra_parts="crt1.o crti.o crtn.o gcrt1.o crtbegin.o crtend.o" - float_format=none - if test x${enable_threads} = x ; then - enable_threads=$have_pthread_h - if test x${enable_threads} = x ; then - enable_threads=$have_thread_h - fi - fi - if test x${enable_threads} = xyes ; then - if test x${have_pthread_h} = xyes ; then - thread_file='posix' - else - thread_file='solaris' - fi - fi - ;; - sparc-hal-solaris2*) - xm_file="xm-siglist.h sparc/xm-sysv4.h sparc/xm-sol2.h" - xm_defines="USG POSIX" - tm_file="sparc/sol2.h sparc/hal.h" - tmake_file="sparc/t-halos sparc/t-sol2" - xmake_file=sparc/x-sysv4 - extra_parts="crt1.o crti.o crtn.o gmon.o crtbegin.o crtend.o" - case $machine in - *-*-solaris2.[0-4]) - float_format=i128 - ;; - *) - float_format=none - ;; - esac - thread_file='solaris' - ;; - sparc-*-solaris2*) - if test x$gnu_ld = xyes - then - tm_file=sparc/sol2.h - else - tm_file=sparc/sol2-sld.h - fi - xm_file="xm-siglist.h sparc/xm-sysv4.h sparc/xm-sol2.h" - xm_defines="USG POSIX" - tmake_file=sparc/t-sol2 - xmake_file=sparc/x-sysv4 - extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o" - case $machine in - *-*-solaris2.[0-4]) - float_format=i128 - ;; - *) - float_format=none - ;; - esac - if test x${enable_threads} = x; then - enable_threads=$have_pthread_h - if test x${enable_threads} = x; then - enable_threads=$have_thread_h - fi - fi - if test x${enable_threads} = xyes; then - if test x${have_pthread_h} = xyes; then - thread_file='posix' - else - thread_file='solaris' - fi - fi - ;; - sparc-*-sunos4.0*) - tm_file=sparc/sunos4.h - tmake_file=sparc/t-sunos40 - use_collect2=yes - ;; - sparc-*-sunos4*) - tm_file=sparc/sunos4.h - tmake_file=sparc/t-sunos41 - use_collect2=yes - if test x$gas = xyes; then - tm_file="${tm_file} sparc/sun4gas.h" - fi - ;; - sparc-*-sunos3*) - tm_file=sparc/sun4o3.h - use_collect2=yes - ;; - sparc-*-sysv4*) - tm_file=sparc/sysv4.h - xm_file="xm-siglist.h sparc/xm-sysv4.h" - xm_defines="USG POSIX" - tmake_file=t-svr4 - xmake_file=sparc/x-sysv4 - extra_parts="crtbegin.o crtend.o" - ;; - sparc-*-vxsim*) - xm_file="xm-siglist.h sparc/xm-sysv4.h sparc/xm-sol2.h" - xm_defines="USG POSIX" - tm_file=sparc/vxsim.h - tmake_file=sparc/t-vxsparc - xmake_file=sparc/x-sysv4 - ;; - sparclet-*-aout*) - tm_file="sparc/splet.h libgloss.h" - tmake_file=sparc/t-splet - ;; - sparclite-*-coff*) - tm_file="sparc/litecoff.h libgloss.h" - tmake_file=sparc/t-sparclite - ;; - sparclite-*-aout*) - tm_file="sparc/lite.h aoutos.h libgloss.h" - tmake_file=sparc/t-sparclite - ;; - sparc64-*-aout*) - tmake_file=sparc/t-sp64 - tm_file=sparc/sp64-aout.h - ;; - sparc64-*-elf*) - tmake_file=sparc/t-sp64 - tm_file=sparc/sp64-elf.h - extra_parts="crtbegin.o crtend.o" - ;; - sparc64-*-linux*) # 64-bit Sparc's running GNU/Linux - tmake_file="t-linux sparc/t-linux64" - xm_file="sparc/xm-sp64.h sparc/xm-linux.h" - tm_file=sparc/linux64.h - xmake_file=x-linux - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - ;; -# This hasn't been upgraded to GCC 2. -# tahoe-harris-*) # Harris tahoe, using COFF. -# tm_file=tahoe/harris.h -# ;; -# tahoe-*-bsd*) # tahoe running BSD -# ;; - thumb-*-coff* | thumbel-*-coff*) - tm_file=arm/tcoff.h - out_file=arm/thumb.c - xm_file=arm/xm-thumb.h - md_file=arm/thumb.md - tmake_file=arm/t-thumb - ;; - thumb-wrs-vxworks) - tm_file=arm/tcoff.h - out_file=arm/thumb.c - xm_file=arm/xm-thumb.h - md_file=arm/thumb.md - tmake_file=arm/t-thumb - thread_file='vxworks' - ;; -# This hasn't been upgraded to GCC 2. -# tron-*-*) -# cpu_type=gmicro -# use_collect2=yes -# ;; - v850-*-*) - cpu_type=v850 - tm_file="v850/v850.h" - xm_file="v850/xm-v850.h" - tmake_file=v850/t-v850 - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - use_collect2=no - ;; - vax-*-bsd*) # vaxen running BSD - use_collect2=yes - float_format=vax - ;; - vax-*-sysv*) # vaxen running system V - tm_file="${tm_file} vax/vaxv.h" - xm_defines=USG - float_format=vax - ;; - vax-*-netbsd*) - tm_file="${tm_file} netbsd.h vax/netbsd.h" - tmake_file=t-netbsd - float_format=vax - use_collect2=yes - ;; - vax-*-openbsd*) - tmake_file="${tmake_file} vax/t-openbsd" - ;; - vax-*-ultrix*) # vaxen running ultrix - tm_file="${tm_file} vax/ultrix.h" - use_collect2=yes - float_format=vax - ;; - vax-*-vms*) # vaxen running VMS - xm_file=vax/xm-vms.h - tm_file=vax/vms.h - float_format=vax - ;; - vax-*-*) # vax default entry - float_format=vax - ;; - we32k-att-sysv*) - xm_file="${xm_file} xm-svr3" - use_collect2=yes - ;; - *) - echo "Configuration $machine not supported" 1>&2 - exit 1 - ;; - esac - - case $machine in - *-*-linux-gnu*) - ;; # Existing GNU/Linux systems do not use the GNU setup. - *-*-gnu*) - # On the GNU system, the setup is just about the same on - # each different CPU. The specific machines that GNU - # supports are matched above and just set $cpu_type. - xm_file="xm-gnu.h ${xm_file}" - tm_file=${cpu_type}/gnu.h - extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" - # GNU always uses ELF. - elf=yes - # GNU tools are the only tools. - gnu_ld=yes - gas=yes - xmake_file=x-linux # These details are the same as Linux. - tmake_file=t-gnu # These are not. - ;; - *-*-sysv4*) - xmake_try_sysv=x-sysv - install_headers_dir=install-headers-cpio - ;; - *-*-sysv*) - install_headers_dir=install-headers-cpio - ;; - esac - - # Distinguish i[34567]86 - # Also, do not run mips-tfile on MIPS if using gas. - # Process --with-cpu= for PowerPC/rs6000 - target_cpu_default2= - case $machine in - i486-*-*) - target_cpu_default2=1 - ;; - i586-*-*) - case $target_alias in - k6-*) - target_cpu_default2=4 - ;; - *) - target_cpu_default2=2 - ;; - esac - ;; - i686-*-* | i786-*-*) - target_cpu_default2=3 - ;; - alpha*-*-*) - case $machine in - alphaev6*) - target_cpu_default2="MASK_CPU_EV6|MASK_BWX|MASK_MAX|MASK_FIX" - ;; - alphapca56*) - target_cpu_default2="MASK_CPU_EV5|MASK_BWX|MASK_MAX" - ;; - alphaev56*) - target_cpu_default2="MASK_CPU_EV5|MASK_BWX" - ;; - alphaev5*) - target_cpu_default2="MASK_CPU_EV5" - ;; - esac - - if test x$gas = xyes - then - if test "$target_cpu_default2" = "" - then - target_cpu_default2="MASK_GAS" - else - target_cpu_default2="${target_cpu_default2}|MASK_GAS" - fi - fi - ;; - arm*-*-*) - case "x$with_cpu" in - x) - # The most generic - target_cpu_default2="TARGET_CPU_generic" - ;; - - # Distinguish cores, and major variants - # arm7m doesn't exist, but D & I don't affect code - xarm23678 | xarm250 | xarm67010 \ - | xarm7m | xarm7dm | xarm7dmi | xarm7tdmi \ - | xarm7100 | xarm7500 | xarm7500fe | xarm810 \ - | xstrongarm | xstrongarm110 | xstrongarm1100) - target_cpu_default2="TARGET_CPU_$with_cpu" - ;; - - xyes | xno) - echo "--with-cpu must be passed a value" 1>&2 - exit 1 - ;; - - *) - if test x$pass2done = xyes - then - echo "Unknown cpu used with --with-cpu=$with_cpu" 1>&2 - exit 1 - fi - ;; - esac - ;; - - mips*-*-ecoff* | mips*-*-elf*) - if test x$gas = xyes - then - if test x$gnu_ld = xyes - then - target_cpu_default2=20 - else - target_cpu_default2=16 - fi - fi - ;; - mips*-*-*) - if test x$gas = xyes - then - target_cpu_default2=16 - fi - ;; - powerpc*-*-* | rs6000-*-*) - case "x$with_cpu" in - x) - ;; - - xcommon | xpower | xpower2 | xpowerpc | xrios \ - | xrios1 | xrios2 | xrsc | xrsc1 \ - | x601 | x602 | x603 | x603e | x604 | x604e | x620 \ - | xec603e | x740 | x750 | x401 \ - | x403 | x505 | x801 | x821 | x823 | x860) - target_cpu_default2="\"$with_cpu\"" - ;; - - xyes | xno) - echo "--with-cpu must be passed a value" 1>&2 - exit 1 - ;; - - *) - if test x$pass2done = xyes - then - echo "Unknown cpu used with --with-cpu=$with_cpu" 1>&2 - exit 1 - fi - ;; - esac - ;; - sparc*-*-*) - case ".$with_cpu" in - .) - target_cpu_default2=TARGET_CPU_"`echo $machine | sed 's/-.*$//'`" - ;; - .supersparc | .hypersparc | .ultrasparc | .v7 | .v8 | .v9) - target_cpu_default2="TARGET_CPU_$with_cpu" - ;; - *) - if test x$pass2done = xyes - then - echo "Unknown cpu used with --with-cpu=$with_cpu" 1>&2 - exit 1 - fi - ;; - esac - ;; - esac - - if test "$target_cpu_default2" != "" - then - if test "$target_cpu_default" != "" - then - target_cpu_default="(${target_cpu_default}|${target_cpu_default2})" - else - target_cpu_default=$target_cpu_default2 - fi - fi - - # No need for collect2 if we have the GNU linker. - # Actually, there is now; GNU ld doesn't handle the EH info or - # collecting for shared libraries. - #case x$gnu_ld in - #xyes) - # use_collect2= - # ;; - #esac - -# Save data on machine being used to compile GCC in build_xm_file. -# Save data on host machine in vars host_xm_file and host_xmake_file. - if test x$pass1done = x - then - if test x"$xm_file" = x - then build_xm_file=$cpu_type/xm-$cpu_type.h - else build_xm_file=$xm_file - fi - build_xm_defines=$xm_defines - build_install_headers_dir=$install_headers_dir - build_exeext=$exeext - pass1done=yes - else - if test x$pass2done = x - then - if test x"$xm_file" = x - then host_xm_file=$cpu_type/xm-$cpu_type.h - else host_xm_file=$xm_file - fi - host_xm_defines=$xm_defines - if test x"$xmake_file" = x - then xmake_file=$cpu_type/x-$cpu_type - fi - host_xmake_file="$xmake_file" - host_truncate_target=$truncate_target - host_extra_gcc_objs=$extra_gcc_objs - host_extra_objs=$extra_host_objs - host_exeext=$exeext - pass2done=yes - fi - fi -done - -extra_objs="${host_extra_objs} ${extra_objs}" - -# Default the target-machine variables that were not explicitly set. -if test x"$tm_file" = x -then tm_file=$cpu_type/$cpu_type.h; fi - -if test x$extra_headers = x -then extra_headers=; fi - -if test x"$xm_file" = x -then xm_file=$cpu_type/xm-$cpu_type.h; fi - -if test x$md_file = x -then md_file=$cpu_type/$cpu_type.md; fi - -if test x$out_file = x -then out_file=$cpu_type/$cpu_type.c; fi - -if test x"$tmake_file" = x -then tmake_file=$cpu_type/t-$cpu_type -fi - -if test x"$dwarf2" = xyes -then tm_file="tm-dwarf2.h $tm_file" -fi - -if test x$float_format = x -then float_format=i64 -fi - -if test $float_format = none -then float_h_file=Makefile.in -else float_h_file=float-$float_format.h -fi - -if test x$enable_haifa = x -then - case $target in - alpha*-* | hppa*-* | powerpc*-* | rs6000-* | *sparc*-* | m32r*-*) - enable_haifa=yes;; - esac -fi - -# Handle cpp installation. -if test x$enable_cpp != xno -then - tmake_file="$tmake_file t-install-cpp" -fi - -# Say what files are being used for the output code and MD file. -echo "Using \`$srcdir/config/$out_file' to output insns." -echo "Using \`$srcdir/config/$md_file' as machine description file." - -count=a -for f in $tm_file; do - count=${count}x -done -if test $count = ax; then - echo "Using \`$srcdir/config/$tm_file' as target machine macro file." -else - echo "Using the following target machine macro files:" - for f in $tm_file; do - echo " $srcdir/config/$f" - done -fi - -count=a -for f in $host_xm_file; do - count=${count}x -done -if test $count = ax; then - echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file." -else - echo "Using the following host machine macro files:" - for f in $host_xm_file; do - echo " $srcdir/config/$f" - done -fi - -if test "$host_xm_file" != "$build_xm_file"; then - count=a - for f in $build_xm_file; do - count=${count}x - done - if test $count = ax; then - echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file." - else - echo "Using the following build machine macro files:" - for f in $build_xm_file; do - echo " $srcdir/config/$f" - done - fi -fi - -if test x$thread_file = x; then - if test x$target_thread_file != x; then - thread_file=$target_thread_file - else - thread_file='single' - fi -fi - -# Set up the header files. -# $links is the list of header files to create. -# $vars is the list of shell variables with file names to include. -# auto-host.h is the file containing items generated by autoconf and is -# the first file included by config.h. -null_defines= -host_xm_file="auto-host.h gansidecl.h ${host_xm_file} hwint.h" - -# If host=build, it is correct to have hconfig include auto-host.h -# as well. If host!=build, we are in error and need to do more -# work to find out the build config parameters. -if test x$host = x$build -then - build_xm_file="auto-host.h gansidecl.h ${build_xm_file} hwint.h" -else - # We create a subdir, then run autoconf in the subdir. - # To prevent recursion we set host and build for the new - # invocation of configure to the build for this invocation - # of configure. - tempdir=build.$$ - rm -rf $tempdir - mkdir $tempdir - cd $tempdir - case ${srcdir} in - /*) realsrcdir=${srcdir};; - *) realsrcdir=../${srcdir};; - esac - CC=${CC_FOR_BUILD} ${realsrcdir}/configure \ - --target=$target --host=$build --build=$build - - # We just finished tests for the build machine, so rename - # the file auto-build.h in the gcc directory. - mv auto-host.h ../auto-build.h - cd .. - rm -rf $tempdir - build_xm_file="auto-build.h gansidecl.h ${build_xm_file} hwint.h" -fi - -xm_file="gansidecl.h ${xm_file}" -tm_file="gansidecl.h ${tm_file}" - -vars="host_xm_file tm_file xm_file build_xm_file" -links="config.h tm.h tconfig.h hconfig.h" -defines="host_xm_defines null_defines xm_defines build_xm_defines" - -rm -f config.bak -if test -f config.status; then mv -f config.status config.bak; fi - -# Make the links. -while test -n "$vars" -do - set $vars; var=$1; shift; vars=$* - set $links; link=$1; shift; links=$* - set $defines; define=$1; shift; defines=$* - - rm -f $link - - # Define TARGET_CPU_DEFAULT if the system wants one. - # This substitutes for lots of *.h files. - if test "$target_cpu_default" != "" -a $link = tm.h - then - echo "#define TARGET_CPU_DEFAULT ($target_cpu_default)" >>$link - fi - - for file in `eval echo '$'$var`; do - case $file in - auto-config.h) - ;; - *) - echo '#ifdef IN_GCC' >>$link - ;; - esac - echo "#include \"$file\"" >>$link - case $file in - auto-config.h) - ;; - *) - echo '#endif' >>$link - ;; - esac - done - - for def in `eval echo '$'$define`; do - echo "#ifndef $def" >>$link - echo "#define $def" >>$link - echo "#endif" >>$link - done -done - -# Truncate the target if necessary -if test x$host_truncate_target != x; then - target=`echo $target | sed -e 's/\(..............\).*/\1/'` -fi - -# Get the version trigger filename from the toplevel -if test "${with_gcc_version_trigger+set}" = set; then - gcc_version_trigger=$with_gcc_version_trigger -else - gcc_version_trigger=${srcdir}/version.c -fi -gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${gcc_version_trigger}` - -# Internationalization -PACKAGE=gcc -VERSION="$gcc_version" -cat >> confdefs.h <> confdefs.h <&6 -echo "configure:6044: checking for strerror in -lcposix" >&5 -ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lcposix $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lcposix" -else - echo "$ac_t""no" 1>&6 -fi - - - -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:6086: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:6140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_const=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF - -fi - -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:6161: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_inline=$ac_kw; break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done - -fi - -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in - inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >> confdefs.h <&6 -echo "configure:6201: checking for off_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_off_t=yes -else - rm -rf conftest* - ac_cv_type_off_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_off_t" 1>&6 -if test $ac_cv_type_off_t = no; then - cat >> confdefs.h <<\EOF -#define off_t long -EOF - -fi - -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:6234: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_size_t=yes -else - rm -rf conftest* - ac_cv_type_size_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF -#define size_t unsigned -EOF - -fi - -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:6269: checking for working alloca.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -char *p = alloca(2 * sizeof(int)); -; return 0; } -EOF -if { (eval echo configure:6281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_header_alloca_h=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_alloca_h=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 -if test $ac_cv_header_alloca_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ALLOCA_H 1 -EOF - -fi - -echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:6302: checking for alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -# define alloca _alloca -# else -# if HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -int main() { -char *p = (char *) alloca(1); -; return 0; } -EOF -if { (eval echo configure:6335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_func_alloca_works=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_alloca_works=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 -if test $ac_cv_func_alloca_works = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ALLOCA 1 -EOF - -fi - -if test $ac_cv_func_alloca_works = no; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.${ac_objext} - cat >> confdefs.h <<\EOF -#define C_ALLOCA 1 -EOF - - -echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:6367: checking whether alloca needs Cray hooks" >&5 -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_os_cray=yes -else - rm -rf conftest* - ac_cv_os_cray=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_os_cray" 1>&6 -if test $ac_cv_os_cray = yes; then -for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6397: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:6425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <&6 -fi - -done -fi - -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:6452: checking stack direction for C alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_stack_direction=0 -else - cat > conftest.$ac_ext < addr) ? 1 : -1; -} -main () -{ - exit (find_stack_direction() < 0); -} -EOF -if { (eval echo configure:6479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_c_stack_direction=1 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 -cat >> confdefs.h <&6 -echo "configure:6504: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6514: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_func in getpagesize -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6543: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:6571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6596: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no -else - cat > conftest.$ac_ext < -#include -#include - -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif - -/* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H -# define HAVE_SYS_PARAM_H 1 -# endif - -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - -#ifdef __cplusplus -extern "C" { void *malloc(unsigned); } -#else -char *malloc(); -#endif - -int -main() -{ - char *data, *data2, *data3; - int i, pagesize; - int fd; - - pagesize = getpagesize(); - - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); - - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); - - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); -} - -EOF -if { (eval echo configure:6744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_mmap_fixed_mapped=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 -if test $ac_cv_func_mmap_fixed_mapped = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_MMAP 1 -EOF - -fi - - - for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h sys/param.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6772: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6782: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - - for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ -strdup __argz_count __argz_stringify __argz_next -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6812: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:6840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - - if test "${ac_cv_func_stpcpy+set}" != "set"; then - for ac_func in stpcpy -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6869: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:6897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - fi - if test "${ac_cv_func_stpcpy}" = "yes"; then - cat >> confdefs.h <<\EOF -#define HAVE_STPCPY 1 -EOF - - fi - - if test $ac_cv_header_locale_h = yes; then - echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:6931: checking for LC_MESSAGES" >&5 -if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -return LC_MESSAGES -; return 0; } -EOF -if { (eval echo configure:6943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_val_LC_MESSAGES=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_val_LC_MESSAGES=no -fi -rm -f conftest* -fi - -echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 - if test $am_cv_val_LC_MESSAGES = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_LC_MESSAGES 1 -EOF - - fi - fi - echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:6964: checking whether NLS is requested" >&5 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi - - echo "$ac_t""$USE_NLS" 1>&6 - - - USE_INCLUDED_LIBINTL=no - - if test "$USE_NLS" = "yes"; then - cat >> confdefs.h <<\EOF -#define ENABLE_NLS 1 -EOF - - echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:6984: checking whether included gettext is requested" >&5 - # Check whether --with-included-gettext or --without-included-gettext was given. -if test "${with_included_gettext+set}" = set; then - withval="$with_included_gettext" - nls_cv_force_use_gnu_gettext=$withval -else - nls_cv_force_use_gnu_gettext=no -fi - - echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - nls_cv_header_intl= - nls_cv_header_libgt= - CATOBJEXT=NONE - - ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:7003: checking for libintl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:7030: checking for gettext in libc" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -return (int) gettext ("") -; return 0; } -EOF -if { (eval echo configure:7042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - gt_cv_func_gettext_libc=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gettext_libc=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 - - if test "$gt_cv_func_gettext_libc" != "yes"; then - echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:7058: checking for bindtextdomain in -lintl" >&5 -ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lintl $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:7093: checking for gettext in libintl" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6 -echo "configure:7098: checking for gettext in -lintl" >&5 -ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lintl $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - gt_cv_func_gettext_libintl=yes -else - echo "$ac_t""no" 1>&6 -gt_cv_func_gettext_libintl=no -fi - -fi - -echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - fi - - if test "$gt_cv_func_gettext_libc" = "yes" \ - || test "$gt_cv_func_gettext_libintl" = "yes"; then - cat >> confdefs.h <<\EOF -#define HAVE_GETTEXT 1 -EOF - - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7156: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test -n "$MSGFMT"; then - echo "$ac_t""$MSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - if test "$MSGFMT" != "no"; then - for ac_func in dcgettext -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7190: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:7218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7245: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7281: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - CATOBJEXT=.gmo - DATADIRNAME=share -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CATOBJEXT=.mo - DATADIRNAME=lib -fi -rm -f conftest* - INSTOBJEXT=.mo - fi - fi - -else - echo "$ac_t""no" 1>&6 -fi - - - if test "$CATOBJEXT" = "NONE"; then - echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6 -echo "configure:7344: checking whether catgets can be used" >&5 - # Check whether --with-catgets or --without-catgets was given. -if test "${with_catgets+set}" = set; then - withval="$with_catgets" - nls_cv_use_catgets=$withval -else - nls_cv_use_catgets=no -fi - - echo "$ac_t""$nls_cv_use_catgets" 1>&6 - - if test "$nls_cv_use_catgets" = "yes"; then - echo $ac_n "checking for main in -li""... $ac_c" 1>&6 -echo "configure:7357: checking for main in -li" >&5 -ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-li $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo i | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - - echo $ac_n "checking for catgets""... $ac_c" 1>&6 -echo "configure:7400: checking for catgets" >&5 -if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char catgets(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_catgets) || defined (__stub___catgets) -choke me -#else -catgets(); -#endif - -; return 0; } -EOF -if { (eval echo configure:7428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_catgets=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_catgets=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'catgets`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_CATGETS 1 -EOF - - INTLOBJS="\$(CATOBJS)" - # Extract the first word of "gencat", so it can be a program name with args. -set dummy gencat; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7450: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GENCAT" in - /*) - ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GENCAT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GENCAT" && ac_cv_path_GENCAT="no" - ;; -esac -fi -GENCAT="$ac_cv_path_GENCAT" -if test -n "$GENCAT"; then - echo "$ac_t""$GENCAT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - if test "$GENCAT" != "no"; then - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7486: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test "$GMSGFMT" = "no"; then - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7523: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - fi - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7558: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.cat - INSTOBJEXT=.cat - DATADIRNAME=lib - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi -else - echo "$ac_t""no" 1>&6 -fi - - fi - fi - - if test "$CATOBJEXT" = "NONE"; then - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - INTLOBJS="\$(GETTOBJS)" - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7616: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test -n "$MSGFMT"; then - echo "$ac_t""$MSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7650: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7686: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INSTOBJEXT=.mo - DATADIRNAME=share - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then - : ; - else - echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6 - XGETTEXT=":" - fi - fi - - # We need to process the po/ directory. - POSUB=po - else - DATADIRNAME=share - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi - - - - - # If this is used in GNU gettext we have to set USE_NLS to `yes' - # because some of the sources are only built for this goal. - if test "$PACKAGE" = gettext; then - USE_NLS=yes - USE_INCLUDED_LIBINTL=yes - fi - - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - - - - - - - - - - - - - - - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:7779: checking for catalogs to be installed" >&5 - NEW_LINGUAS= - for lang in ${LINGUAS=$ALL_LINGUAS}; do - case "$ALL_LINGUAS" in - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; - esac - done - LINGUAS=$NEW_LINGUAS - echo "$ac_t""$LINGUAS" 1>&6 - fi - - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - - if test $ac_cv_header_locale_h = yes; then - INCLUDE_LOCALE_H="#include " - else - INCLUDE_LOCALE_H="\ -/* The system does not provide the header . Take care yourself. */" - fi - - - test -d intl || mkdir intl - if test "$CATOBJEXT" = ".cat"; then - ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:7807: checking for linux/version.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7817: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - msgformat=linux -else - echo "$ac_t""no" 1>&6 -msgformat=xopen -fi - - - sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed - fi - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ - $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed - - if test "$PACKAGE" = "gettext"; then - GT_NO="#NO#" - GT_YES= - else - GT_NO= - GT_YES="#YES#" - fi - - - - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - l= - - - test -d po || mkdir po - if test "x$srcdir" != "x."; then - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then - posrcprefix="$srcdir/" - else - posrcprefix="../$srcdir/" - fi - else - posrcprefix="../" - fi - rm -f po/POTFILES - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ - < $srcdir/po/POTFILES.in > po/POTFILES - -XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT" - -# Get an absolute path to the GCC top-level source directory -holddir=`pwd` -cd $srcdir -topdir=`pwd` -cd $holddir - -# Conditionalize the makefile for this host machine. -# Make-host contains the concatenation of all host makefile fragments -# [there can be more than one]. This file is built by configure.frag. -host_overrides=Make-host -dep_host_xmake_file= -for f in .. ${host_xmake_file} -do - if test -f ${srcdir}/config/$f - then - dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f" - fi -done - -# Conditionalize the makefile for this target machine. -# Make-target contains the concatenation of all host makefile fragments -# [there can be more than one]. This file is built by configure.frag. -target_overrides=Make-target -dep_tmake_file= -for f in .. ${tmake_file} -do - if test -f ${srcdir}/config/$f - then - dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f" - fi -done - -# If the host doesn't support symlinks, modify CC in -# FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works. -# Otherwise, we can use "CC=$(CC)". -rm -f symtest.tem -if $symbolic_link $srcdir/gcc.c symtest.tem 2>/dev/null -then - cc_set_by_configure="\$(CC)" - quoted_cc_set_by_configure="\$(CC)" - stage_prefix_set_by_configure="\$(STAGE_PREFIX)" -else - rm -f symtest.tem - if cp -p $srcdir/gcc.c symtest.tem 2>/dev/null - then - symbolic_link="cp -p" - else - symbolic_link="cp" - fi - cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`" - quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`" - stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`" -fi -rm -f symtest.tem - -out_object_file=`basename $out_file .c`.o - -tm_file_list= -for f in $tm_file; do - case $f in - gansidecl.h ) - tm_file_list="${tm_file_list} $f" ;; - *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;; - esac -done - -host_xm_file_list= -for f in $host_xm_file; do - case $f in - auto-host.h | gansidecl.h | hwint.h ) - host_xm_file_list="${host_xm_file_list} $f" ;; - *) host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" ;; - esac -done - -build_xm_file_list= -for f in $build_xm_file; do - case $f in - auto-build.h | auto-host.h | gansidecl.h | hwint.h ) - build_xm_file_list="${build_xm_file_list} $f" ;; - *) build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" ;; - esac -done - -# Define macro CROSS_COMPILE in compilation -# if this is a cross-compiler. -# Also use all.cross instead of all.internal -# and add cross-make to Makefile. -cross_overrides="/dev/null" -if test x$host != x$target -then - cross_defines="CROSS=-DCROSS_COMPILE" - cross_overrides="${topdir}/cross-make" -fi - -# When building gcc with a cross-compiler, we need to fix a few things. -# This must come after cross-make as we want all.build to override -# all.cross. -build_overrides="/dev/null" -if test x$build != x$host -then - build_overrides="${topdir}/build-make" -fi - -# Expand extra_headers to include complete path. -# This substitutes for lots of t-* files. -extra_headers_list= -if test "x$extra_headers" = x -then true -else - # Prepend ${srcdir}/ginclude/ to every entry in extra_headers. - for file in $extra_headers; - do - extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/${file}" - done -fi - -if test x$use_collect2 = xno; then - use_collect2= -fi - -# Add a definition of USE_COLLECT2 if system wants one. -# Also tell toplev.c what to do. -# This substitutes for lots of t-* files. -if test x$use_collect2 = x -then - will_use_collect2= - maybe_use_collect2= -else - will_use_collect2="collect2" - maybe_use_collect2="-DUSE_COLLECT2" -fi - -# NEED TO CONVERT -# Set MD_DEPS if the real md file is in md.pre-cpp. -# Set MD_CPP to the cpp to pass the md file through. Md files use ';' -# for line oriented comments, so we must always use a GNU cpp. If -# building gcc with a cross compiler, use the cross compiler just -# built. Otherwise, we can use the cpp just built. -md_file_sub= -if test "x$md_cppflags" = x -then - md_file_sub=$srcdir/config/$md_file -else - md_file=md -fi - -# If we have gas in the build tree, make a link to it. -if test -f ../gas/Makefile; then - rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null -fi - -# If we have nm in the build tree, make a link to it. -if test -f ../binutils/Makefile; then - rm -f nm; $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null -fi - -# If we have ld in the build tree, make a link to it. -if test -f ../ld/Makefile; then -# if test x$use_collect2 = x; then -# rm -f ld; $symbolic_link ../ld/ld-new$host_exeext ld$host_exeext 2>/dev/null -# else - rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null -# fi -fi - -# Figure out what assembler alignment features are present. -echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6 -echo "configure:8051: checking assembler alignment features" >&5 -gcc_cv_as= -gcc_cv_as_alignment_features= -gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas -if test -x "$DEFAULT_ASSEMBLER"; then - gcc_cv_as="$DEFAULT_ASSEMBLER" -elif test -x "$AS"; then - gcc_cv_as="$AS" -elif test -x as$host_exeext; then - # Build using assembler in the current directory. - gcc_cv_as=./as$host_exeext -elif test -f $gcc_cv_as_gas_srcdir/configure.in -a -f ../gas/Makefile; then - # Single tree build which includes gas. - for f in $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in - do - gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f` - if test x$gcc_cv_gas_version != x; then - break - fi - done - gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"` - gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"` - if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - # Gas version 2.6 and later support for .balign and .p2align. - # bytes to skip when using .p2align. - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_alignment_features=".balign and .p2align" - cat >> confdefs.h <<\EOF -#define HAVE_GAS_BALIGN_AND_P2ALIGN 1 -EOF - - fi - # Gas version 2.8 and later support specifying the maximum - # bytes to skip when using .p2align. - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_alignment_features=".p2align including maximum skip" - cat >> confdefs.h <<\EOF -#define HAVE_GAS_MAX_SKIP_P2ALIGN 1 -EOF - - fi - fi -elif test x$host = x$target; then - # Native build. - # Search the same directories that the installed compiler will - # search. Else we may find the wrong assembler and lose. If we - # do not find a suitable assembler binary, then try the user's - # path. - # - # Also note we have to check MD_EXEC_PREFIX before checking the - # user's path. Unfortunately, there is no good way to get at the - # value of MD_EXEC_PREFIX here. So we do a brute force search - # through all the known MD_EXEC_PREFIX values. Ugh. This needs - # to be fixed as part of the make/configure rewrite too. - - if test "x$exec_prefix" = xNONE; then - if test "x$prefix" = xNONE; then - test_prefix=/usr/local - else - test_prefix=$prefix - fi - else - test_prefix=$exec_prefix - fi - - # If the loop below does not find an assembler, then use whatever - # one we can find in the users's path. - # user's path. - as=as$host_exeext - - test_dirs="$test_prefix/lib/gcc-lib/$target/$gcc_version \ - $test_prefix/lib/gcc-lib/$target \ - /usr/lib/gcc/$target/$gcc_version \ - /usr/lib/gcc/$target \ - $test_prefix/$target/bin/$target/$gcc_version \ - $test_prefix/$target/bin \ - /usr/libexec \ - /usr/ccs/gcc \ - /usr/ccs/bin \ - /udk/usr/ccs/bin \ - /bsd43/usr/lib/cmplrs/cc \ - /usr/cross64/usr/bin \ - /usr/lib/cmplrs/cc \ - /sysv/usr/lib/cmplrs/cc \ - /svr4/usr/lib/cmplrs/cc \ - /usr/bin" - - for dir in $test_dirs; do - if test -f $dir/as$host_exeext; then - gcc_cv_as=$dir/as$host_exeext - break; - fi - done -fi -if test x$gcc_cv_as != x; then - # Check if we have .balign and .p2align - echo ".balign 4" > conftest.s - echo ".p2align 2" >> conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_alignment_features=".balign and .p2align" - cat >> confdefs.h <<\EOF -#define HAVE_GAS_BALIGN_AND_P2ALIGN 1 -EOF - - fi - rm -f conftest.s conftest.o - # Check if specifying the maximum bytes to skip when - # using .p2align is supported. - echo ".p2align 4,,7" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_alignment_features=".p2align including maximum skip" - cat >> confdefs.h <<\EOF -#define HAVE_GAS_MAX_SKIP_P2ALIGN 1 -EOF - - fi - rm -f conftest.s conftest.o -fi -echo "$ac_t""$gcc_cv_as_alignment_features" 1>&6 - -echo $ac_n "checking assembler subsection support""... $ac_c" 1>&6 -echo "configure:8172: checking assembler subsection support" >&5 -gcc_cv_as_subsections= -if test x$gcc_cv_as != x; then - # Check if we have .subsection - echo ".subsection 1" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_subsections=".subsection" - if test -x nm$host_exeext; then - gcc_cv_nm=./nm$host_exeext - elif test x$host = x$target; then - # Native build. - gcc_cv_nm=nm$host_exeext - fi - if test x$gcc_cv_nm != x; then - cat > conftest.s < /dev/null 2>&1; then - $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1 - $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2 - if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then - : - else - gcc_cv_as_subsections="working .subsection -1" - cat >> confdefs.h <<\EOF -#define HAVE_GAS_SUBSECTION_ORDERING 1 -EOF - - fi - fi - fi - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 -fi -echo "$ac_t""$gcc_cv_as_subsections" 1>&6 - -echo $ac_n "checking assembler instructions""... $ac_c" 1>&6 -echo "configure:8212: checking assembler instructions" >&5 -gcc_cv_as_instructions= -if test x$gcc_cv_as != x; then - set "filds fists" "filds mem; fists mem" - while test $# -gt 0 - do - echo "$2" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" " - cat >> confdefs.h <&6 - -# Figure out what language subdirectories are present. -# Look if the user specified --enable-languages="..."; if not, use -# the environment variable $LANGUAGES if defined. $LANGUAGES might -# go away some day. -if test x"${enable_languages+set}" != xset; then - if test x"${LANGUAGES+set}" = xset; then - enable_languages="`echo ${LANGUAGES} | tr ' ' ','`" - else - enable_languages=all - fi -fi -subdirs= -for lang in ${srcdir}/*/config-lang.in .. -do - case $lang in - ..) ;; - # The odd quoting in the next line works around - # an apparent bug in bash 1.12 on linux. - ${srcdir}/[*]/config-lang.in) ;; - *) - lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang` - if test "x$lang_alias" = x - then - echo "$lang doesn't set \$language." 1>&2 - exit 1 - fi - if test x"${enable_languages}" = xall; then - add_this_lang=yes - else - case "${enable_languages}" in - ${lang_alias} | "${lang_alias},"* | *",${lang_alias},"* | *",${lang_alias}" ) - add_this_lang=yes - ;; - * ) - add_this_lang=no - ;; - esac - fi - if test x"${add_this_lang}" = xyes; then - case $lang in - ${srcdir}/ada/config-lang.in) - if test x$gnat = xyes ; then - subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" - fi - ;; - *) - subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" - ;; - esac - fi - ;; - esac -done - -# Make gthr-default.h if we have a thread file. -gthread_flags= -if test $thread_file != single; then - rm -f gthr-default.h - echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h - gthread_flags=-DHAVE_GTHR_DEFAULT -fi - - -# Make empty files to contain the specs and options for each language. -# Then add #include lines to for a compiler that has specs and/or options. - -lang_specs_files= -lang_options_files= -lang_tree_files= -rm -f specs.h options.h gencheck.h -touch specs.h options.h gencheck.h -for subdir in . $subdirs -do - if test -f $srcdir/$subdir/lang-specs.h; then - echo "#include \"$subdir/lang-specs.h\"" >>specs.h - lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h" - fi - if test -f $srcdir/$subdir/lang-options.h; then - echo "#include \"$subdir/lang-options.h\"" >>options.h - lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h" - fi - if test -f $srcdir/$subdir/$subdir-tree.def; then - echo "#include \"$subdir/$subdir-tree.def\"" >>gencheck.h - lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def" - fi -done - -# These (without "all_") are set in each config-lang.in. -# `language' must be a single word so is spelled singularly. -all_languages= -all_boot_languages= -all_compilers= -all_stagestuff= -all_diff_excludes= -all_outputs='Makefile intl/Makefile po/Makefile.in fixinc/Makefile' -# List of language makefile fragments. -all_lang_makefiles= -all_headers= -all_lib2funcs= - -# Add the language fragments. -# Languages are added via two mechanisms. Some information must be -# recorded in makefile variables, these are defined in config-lang.in. -# We accumulate them and plug them into the main Makefile. -# The other mechanism is a set of hooks for each of the main targets -# like `clean', `install', etc. - -language_fragments="Make-lang" -language_hooks="Make-hooks" -oldstyle_subdirs= - -for s in .. $subdirs -do - if test $s != ".." - then - language= - boot_language= - compilers= - stagestuff= - diff_excludes= - headers= - outputs= - lib2funcs= - . ${srcdir}/$s/config-lang.in - if test "x$language" = x - then - echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2 - exit 1 - fi - all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in ${srcdir}/$s/Makefile.in" - all_languages="$all_languages $language" - if test "x$boot_language" = xyes - then - all_boot_languages="$all_boot_languages $language" - fi - all_compilers="$all_compilers $compilers" - all_stagestuff="$all_stagestuff $stagestuff" - all_diff_excludes="$all_diff_excludes $diff_excludes" - all_headers="$all_headers $headers" - all_outputs="$all_outputs $outputs" - if test x$outputs = x - then - oldstyle_subdirs="$oldstyle_subdirs $s" - fi - all_lib2funcs="$all_lib2funcs $lib2funcs" - fi -done - -# Since we can't use `::' targets, we link each language in -# with a set of hooks, reached indirectly via lang.${target}. - -rm -f Make-hooks -touch Make-hooks -target_list="all.build all.cross start.encap rest.encap \ - info dvi \ - install-normal install-common install-info install-man \ - uninstall distdir \ - mostlyclean clean distclean extraclean maintainer-clean \ - stage1 stage2 stage3 stage4" -for t in $target_list -do - x= - for lang in .. $all_languages - do - if test $lang != ".."; then - x="$x $lang.$t" - fi - done - echo "lang.$t: $x" >> Make-hooks -done - -# If we're not building in srcdir, create .gdbinit. - -if test ! -f Makefile.in; then - echo "dir ." > .gdbinit - echo "dir ${srcdir}" >> .gdbinit - if test x$gdb_needs_out_file_path = xyes - then - echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit - fi - if test "x$subdirs" != x; then - for s in $subdirs - do - echo "dir ${srcdir}/$s" >> .gdbinit - done - fi - echo "source ${srcdir}/.gdbinit" >> .gdbinit -fi - -# Define variables host_canonical and build_canonical -# because some Cygnus local changes in the Makefile depend on them. -build_canonical=${build} -host_canonical=${host} -target_subdir= -if test "${host}" != "${target}" ; then - target_subdir=${target}/ -fi - - - - -# If this is using newlib, then define inhibit_libc in -# LIBGCC2_CFLAGS. This will cause __eprintf to be left out of -# libgcc.a, but that's OK because newib should have its own version of -# assert.h. -inhibit_libc= -if test x$with_newlib = xyes; then - inhibit_libc=-Dinhibit_libc -fi - - -# Override SCHED_OBJ and SCHED_CFLAGS to enable the Haifa scheduler. -sched_prefix= -sched_cflags= -if test x$enable_haifa = xyes; then - echo "Using the Haifa scheduler." - sched_prefix=haifa- - sched_cflags=-DHAIFA -fi - - -if test x$enable_haifa != x; then - # Explicitly remove files that need to be recompiled for the Haifa scheduler. - for x in genattrtab.o toplev.o *sched.o; do - if test -f $x; then - echo "Removing $x" - rm -f $x - fi - done -fi - -# If $(exec_prefix) exists and is not the same as $(prefix), then compute an -# absolute path for gcc_tooldir based on inserting the number of up-directory -# movements required to get from $(exec_prefix) to $(prefix) into the basic -# $(libsubdir)/@(unlibsubdir) based path. -# Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel -# make and thus we'd get different behavior depending on where we built the -# sources. -if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then - gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)' -else -# An explanation of the sed strings: -# -e 's|^\$(prefix)||' matches and eliminates 'prefix' from 'exec_prefix' -# -e 's|/$||' match a trailing forward slash and eliminates it -# -e 's|^[^/]|/|' forces the string to start with a forward slash (*) -# -e 's|/[^/]*|../|g' replaces each occurance of / with ../ -# -# (*) Note this pattern overwrites the first character of the string -# with a forward slash if one is not already present. This is not a -# problem because the exact names of the sub-directories concerned is -# unimportant, just the number of them matters. -# -# The practical upshot of these patterns is like this: -# -# prefix exec_prefix result -# ------ ----------- ------ -# /foo /foo/bar ../ -# /foo/ /foo/bar ../ -# /foo /foo/bar/ ../ -# /foo/ /foo/bar/ ../ -# /foo /foo/bar/ugg ../../ -# - dollar='$$' - gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_alias)" -fi - - - -# Nothing to do for FLOAT_H, float_format already handled. -objdir=`pwd` - - -# Process the language and host/target makefile fragments. -${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file" - -# Substitute configuration variables - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Echo that links are built -if test x$host = x$target -then - str1="native " -else - str1="cross-" - str2=" from $host" -fi - -if test x$host != x$build -then - str3=" on a $build system" -fi - -if test "x$str2" != x || test "x$str3" != x -then - str4= -fi - -echo "Links are now set up to build a ${str1}compiler for ${target}$str4" 1>&2 - -if test "x$str2" != x || test "x$str3" != x -then - echo " ${str2}${str3}." 1>&2 -fi - -# Truncate the target if necessary -if test x$host_truncate_target != x; then - target=`echo $target | sed -e 's/\(..............\).*/\1/'` -fi - -# Configure the subdirectories -# AC_CONFIG_SUBDIRS($subdirs) - -# Create the Makefile -# and configure language subdirectories -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -DEFS=-DHAVE_CONFIG_H - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "$all_outputs auto-host.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@CC@%$CC%g -s%@stage1_warn_cflags@%$stage1_warn_cflags%g -s%@SET_MAKE@%$SET_MAKE%g -s%@AWK@%$AWK%g -s%@LEX@%$LEX%g -s%@LEXLIB@%$LEXLIB%g -s%@LN@%$LN%g -s%@LN_S@%$LN_S%g -s%@RANLIB@%$RANLIB%g -s%@YACC@%$YACC%g -s%@INSTALL@%$INSTALL%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@CPP@%$CPP%g -s%@gnat@%$gnat%g -s%@vfprintf@%$vfprintf%g -s%@doprint@%$doprint%g -s%@manext@%$manext%g -s%@objext@%$objext%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ALLOCA@%$ALLOCA%g -s%@USE_NLS@%$USE_NLS%g -s%@MSGFMT@%$MSGFMT%g -s%@GMSGFMT@%$GMSGFMT%g -s%@XGETTEXT@%$XGETTEXT%g -s%@GENCAT@%$GENCAT%g -s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g -s%@CATALOGS@%$CATALOGS%g -s%@CATOBJEXT@%$CATOBJEXT%g -s%@DATADIRNAME@%$DATADIRNAME%g -s%@GMOFILES@%$GMOFILES%g -s%@INSTOBJEXT@%$INSTOBJEXT%g -s%@INTLDEPS@%$INTLDEPS%g -s%@INTLLIBS@%$INTLLIBS%g -s%@INTLOBJS@%$INTLOBJS%g -s%@POFILES@%$POFILES%g -s%@POSUB@%$POSUB%g -s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g -s%@GT_NO@%$GT_NO%g -s%@GT_YES@%$GT_YES%g -s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g -s%@l@%$l%g -s%@gthread_flags@%$gthread_flags%g -s%@build_canonical@%$build_canonical%g -s%@host_canonical@%$host_canonical%g -s%@target_subdir@%$target_subdir%g -s%@inhibit_libc@%$inhibit_libc%g -s%@sched_prefix@%$sched_prefix%g -s%@sched_cflags@%$sched_cflags%g -s%@gcc_tooldir@%$gcc_tooldir%g -s%@dollar@%$dollar%g -s%@objdir@%$objdir%g -s%@subdirs@%$subdirs%g -s%@all_boot_languages@%$all_boot_languages%g -s%@all_compilers@%$all_compilers%g -s%@all_diff_excludes@%$all_diff_excludes%g -s%@all_headers@%$all_headers%g -s%@all_lang_makefiles@%$all_lang_makefiles%g -s%@all_languages@%$all_languages%g -s%@all_lib2funcs@%$all_lib2funcs%g -s%@all_stagestuff@%$all_stagestuff%g -s%@build_exeext@%$build_exeext%g -s%@build_install_headers_dir@%$build_install_headers_dir%g -s%@build_xm_file_list@%$build_xm_file_list%g -s%@cc_set_by_configure@%$cc_set_by_configure%g -s%@quoted_cc_set_by_configure@%$quoted_cc_set_by_configure%g -s%@cpp_install_dir@%$cpp_install_dir%g -s%@cpp_main@%$cpp_main%g -s%@dep_host_xmake_file@%$dep_host_xmake_file%g -s%@dep_tmake_file@%$dep_tmake_file%g -s%@extra_c_flags@%$extra_c_flags%g -s%@extra_c_objs@%$extra_c_objs%g -s%@extra_cpp_objs@%$extra_cpp_objs%g -s%@extra_cxx_objs@%$extra_cxx_objs%g -s%@extra_headers_list@%$extra_headers_list%g -s%@extra_objs@%$extra_objs%g -s%@extra_parts@%$extra_parts%g -s%@extra_passes@%$extra_passes%g -s%@extra_programs@%$extra_programs%g -s%@fixinc_defs@%$fixinc_defs%g -s%@float_h_file@%$float_h_file%g -s%@gcc_gxx_include_dir@%$gcc_gxx_include_dir%g -s%@gcc_version@%$gcc_version%g -s%@gcc_version_trigger@%$gcc_version_trigger%g -s%@host_exeext@%$host_exeext%g -s%@host_extra_gcc_objs@%$host_extra_gcc_objs%g -s%@host_xm_file_list@%$host_xm_file_list%g -s%@install@%$install%g -s%@JAVAGC@%$JAVAGC%g -s%@lang_options_files@%$lang_options_files%g -s%@lang_specs_files@%$lang_specs_files%g -s%@lang_tree_files@%$lang_tree_files%g -s%@local_prefix@%$local_prefix%g -s%@maybe_use_collect2@%$maybe_use_collect2%g -s%@md_file@%$md_file%g -s%@objc_boehm_gc@%$objc_boehm_gc%g -s%@out_file@%$out_file%g -s%@out_object_file@%$out_object_file%g -s%@stage_prefix_set_by_configure@%$stage_prefix_set_by_configure%g -s%@symbolic_link@%$symbolic_link%g -s%@thread_file@%$thread_file%g -s%@tm_file_list@%$tm_file_list%g -s%@will_use_collect2@%$will_use_collect2%g -/@target_overrides@/r $target_overrides -s%@target_overrides@%%g -/@host_overrides@/r $host_overrides -s%@host_overrides@%%g -s%@cross_defines@%$cross_defines%g -/@cross_overrides@/r $cross_overrides -s%@cross_overrides@%%g -/@build_overrides@/r $build_overrides -s%@build_overrides@%%g -/@language_fragments@/r $language_fragments -s%@language_fragments@%%g -/@language_hooks@/r $language_hooks -s%@language_hooks@%%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' -ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' - -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - echo creating $ac_file - - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in - -EOF - -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. - -rm -f conftest.tail -while : -do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS - echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals -done -rm -f conftest.vals - -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h - else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file - fi -fi; done - -EOF - -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -srcdir=$ac_given_srcdir -while test -n "$ac_sources"; do - set $ac_dests; ac_dest=$1; shift; ac_dests=$* - set $ac_sources; ac_source=$1; shift; ac_sources=$* - - echo "linking $srcdir/$ac_source to $ac_dest" - - if test ! -r $srcdir/$ac_source; then - { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } - fi - rm -f $ac_dest - - # Make relative symlinks. - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` - if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then - # The dest file is in a subdirectory. - test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" - ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dest_dir_suffix. - ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dest_dir_suffix= ac_dots= - fi - - case "$srcdir" in - [/$]*) ac_rel_source="$srcdir/$ac_source" ;; - *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; - esac - - # Make a symlink if possible; otherwise try a hard link. - if ln -s $ac_rel_source $ac_dest 2>/dev/null || - ln $srcdir/$ac_source $ac_dest; then : - else - { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } - fi -done -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -case "$CONFIG_FILES" in *po/Makefile.in*) - sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile - esac - -. $srcdir/configure.lang -case x$CONFIG_HEADERS in -xauto-host.h:config.in) -echo > cstamp-h ;; -esac -# If the host supports symlinks, point stage[1234] at ../stage[1234] so -# bootstrapping and the installation procedure can still use -# CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks, -# FLAGS_TO_PASS has been modified to solve the problem there. -# This is virtually a duplicate of what happens in configure.lang; we do -# an extra check to make sure this only happens if ln -s can be used. -if test "$symbolic_link" = "ln -s"; then - for d in .. ${subdirs} ; do - if test $d != ..; then - STARTDIR=`pwd` - cd $d - for t in stage1 stage2 stage3 stage4 include - do - rm -f $t - $symbolic_link ../$t $t 2>/dev/null - done - cd $STARTDIR - fi - done -else true ; fi -# Avoid having to add intl to our include paths. -if test -f intl/libintl.h; then - echo creating libintl.h - echo '#include "intl/libintl.h"' >libintl.h -fi - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/contrib/gcc/configure.frag b/contrib/gcc/configure.frag deleted file mode 100644 index 4bdac943f6d6..000000000000 --- a/contrib/gcc/configure.frag +++ /dev/null @@ -1,77 +0,0 @@ -# configure.frag for GNU CC -# Process the host/target/language Makefile fragments. - -# Copyright (C) 1997 Free Software Foundation, Inc. - -#This file is part of GNU CC. - -#GNU CC 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. - -#GNU CC 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. - -#You should have received a copy of the GNU General Public License -#along with GNU CC; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, -#Boston, MA 02111-1307, USA. - -# First parameter is the source directory, second is list of subdirectories, -# third is list of host makefile fragments, fourth is list of target makefile -# fragments. - -srcdir=$1 -subdirs=$2 -xmake_files=$3 -tmake_files=$4 - -# Copy all the host makefile fragments into Make-host. - -rm -f Make-host -touch Make-host -for f in .. $xmake_files -do - if [ -f $f ] - then - cat $f >> Make-host - fi -done - -# Copy all the target makefile fragments into Make-target. - -rm -f Make-target -touch Make-target -for f in .. $tmake_files -do - if [ -f $f ] - then - cat $f >> Make-target - fi -done - -# Ensure the language build subdirectories exist. - -for subdir in . $subdirs -do - if [ $subdir != . ] - then - test -d $subdir || mkdir $subdir - fi -done - -# Now copy each language's Make-lang.in file to Make-lang. - -rm -f Make-lang -touch Make-lang - -for subdir in . $subdirs -do - if [ $subdir != . ] - then - cat $srcdir/$subdir/Make-lang.in >> Make-lang - fi -done diff --git a/contrib/gcc/configure.in b/contrib/gcc/configure.in deleted file mode 100644 index c9e2bbf20571..000000000000 --- a/contrib/gcc/configure.in +++ /dev/null @@ -1,4514 +0,0 @@ -# configure.in for GNU CC -# Process this file with autoconf to generate a configuration script. - -# Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. - -#This file is part of GNU CC. - -#GNU CC 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. - -#GNU CC 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. - -#You should have received a copy of the GNU General Public License -#along with GNU CC; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, -#Boston, MA 02111-1307, USA. - -# Initialization and defaults -AC_PREREQ(2.12.1) -AC_INIT(tree.c) -AC_CONFIG_HEADER(auto-host.h:config.in) - -remove=rm -hard_link=ln -symbolic_link='ln -s' -copy=cp - -# Check for bogus environment variables. -# Test if LIBRARY_PATH contains the notation for the current directory -# since this would lead to problems installing/building glibc. -# LIBRARY_PATH contains the current directory if one of the following -# is true: -# - one of the terminals (":" and ";") is the first or last sign -# - two terminals occur directly after each other -# - the path contains an element with a dot in it -AC_MSG_CHECKING(LIBRARY_PATH variable) -changequote(,)dnl -case ${LIBRARY_PATH} in - [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) - library_path_setting="contains current directory" - ;; - *) - library_path_setting="ok" - ;; -esac -changequote([,])dnl -AC_MSG_RESULT($library_path_setting) -if test "$library_path_setting" != "ok"; then -AC_MSG_ERROR([ -*** LIBRARY_PATH shouldn't contain the current directory when -*** building gcc. Please change the environment variable -*** and run configure again.]) -fi - -# Test if GCC_EXEC_PREFIX contains the notation for the current directory -# since this would lead to problems installing/building glibc. -# GCC_EXEC_PREFIX contains the current directory if one of the following -# is true: -# - one of the terminals (":" and ";") is the first or last sign -# - two terminals occur directly after each other -# - the path contains an element with a dot in it -AC_MSG_CHECKING(GCC_EXEC_PREFIX variable) -changequote(,)dnl -case ${GCC_EXEC_PREFIX} in - [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) - gcc_exec_prefix_setting="contains current directory" - ;; - *) - gcc_exec_prefix_setting="ok" - ;; -esac -changequote([,])dnl -AC_MSG_RESULT($gcc_exec_prefix_setting) -if test "$gcc_exec_prefix_setting" != "ok"; then -AC_MSG_ERROR([ -*** GCC_EXEC_PREFIX shouldn't contain the current directory when -*** building gcc. Please change the environment variable -*** and run configure again.]) -fi - -# Check for additional parameters - -# With GNU ld -AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld arrange to work with GNU ld.], -gnu_ld_flag="$with_gnu_ld", -gnu_ld_flag=no) - -# With pre-defined ld -AC_ARG_WITH(ld, -[ --with-ld arrange to use the specified ld (full pathname).], -DEFAULT_LINKER="$with_ld") -if test x"${DEFAULT_LINKER+set}" = x"set"; then - if test ! -x "$DEFAULT_LINKER"; then - AC_MSG_WARN([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER]) - elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then - gnu_ld_flag=yes - fi - AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER") -fi - -# With GNU as -AC_ARG_WITH(gnu-as, -[ --with-gnu-as arrange to work with GNU as.], -gas_flag="$with_gnu_as", -gas_flag=no) - -AC_ARG_WITH(as, -[ --with-as arrange to use the specified as (full pathname).], -DEFAULT_ASSEMBLER="$with_as") -if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then - if test ! -x "$DEFAULT_ASSEMBLER"; then - AC_MSG_WARN([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER]) - elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then - gas_flag=yes - fi - AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER") -fi - -# With stabs -AC_ARG_WITH(stabs, -[ --with-stabs arrange to use stabs instead of host debug format.], -stabs="$with_stabs", -stabs=no) - -# With ELF -AC_ARG_WITH(elf, -[ --with-elf arrange to use ELF instead of host debug format.], -elf="$with_elf", -elf=no) - -# Specify the local prefix -local_prefix= -AC_ARG_WITH(local-prefix, -[ --with-local-prefix=DIR specifies directory to put local include.], -[case "${withval}" in -yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;; -no) ;; -*) local_prefix=$with_local_prefix ;; -esac]) - -# Default local prefix if it is empty -if test x$local_prefix = x; then - local_prefix=/usr/local -fi - -# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only -# passed in by the toplevel make and thus we'd get different behavior -# depending on where we built the sources. -gcc_gxx_include_dir= -# Specify the g++ header file directory -AC_ARG_WITH(gxx-include-dir, -[ --with-gxx-include-dir=DIR - specifies directory to put g++ header files.], -[case "${withval}" in -yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;; -no) ;; -*) gcc_gxx_include_dir=$with_gxx_include_dir ;; -esac]) - -if test x${gcc_gxx_include_dir} = x; then - if test x${enable_version_specific_runtime_libs} = xyes; then - gcc_gxx_include_dir='${libsubdir}/include/g++' - else - topsrcdir=${srcdir}/.. . ${srcdir}/../config.if -changequote(<<, >>)dnl - gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/g++"-${libstdcxx_interface} -changequote([, ])dnl - fi -fi - -# Enable expensive internal checks -AC_ARG_ENABLE(checking, -[ --enable-checking enable expensive run-time checks.], -[case "${enableval}" in -yes) AC_DEFINE(ENABLE_CHECKING) ;; -no) ;; -*) AC_MSG_ERROR(bad value ${enableval} given for checking option) ;; -esac]) - -AC_ARG_ENABLE(cpp, -[ --disable-cpp don't provide a user-visible C preprocessor.], -[], [enable_cpp=yes]) - -AC_ARG_WITH(cpp_install_dir, -[ --with-cpp-install-dir=DIR - install the user visible C preprocessor in DIR - (relative to PREFIX) as well as PREFIX/bin.], -[if test x$withval = xyes; then - AC_MSG_ERROR([option --with-cpp-install-dir requires an argument]) -elif test x$withval != xno; then - cpp_install_dir=$withval -fi]) - -# Use cpplib+cppmain for the preprocessor, but don't link it with the compiler. -cpp_main=cccp -AC_ARG_ENABLE(cpplib, -[ --enable-cpplib use cpplib for the C preprocessor.], -if test x$enable_cpplib != xno; then - cpp_main=cppmain -fi) - -# Link cpplib into the compiler proper, for C/C++/ObjC. -AC_ARG_ENABLE(c-cpplib, -[ --enable-c-cpplib link cpplib directly into C and C++ compilers - (EXPERIMENTAL) (implies --enable-cpplib).], -if test x$enable_c_cpplib != xno; then - extra_c_objs="${extra_c_objs} libcpp.a" - extra_cxx_objs="${extra_cxx_objs} ../libcpp.a" - extra_c_flags="${extra_c_flags} -DUSE_CPPLIB=1" - cpp_main=cppmain -fi) - -# Enable Multibyte Characters for C/C++ -AC_ARG_ENABLE(c-mbchar, -[ --enable-c-mbchar enable multibyte characters for C and C++.], -if test x$enable_c_mbchar != xno; then - extra_c_flags=-DMULTIBYTE_CHARS=1 -fi) - -# Disable fast fixincludes -AC_ARG_ENABLE(fast-fixincludes, -[ --disable-fast-fixincludes - Disable the new fast fixincludes. - Run the old fixincludes script unconditionally], -if test x$enable_fast_fixincludes = xno ; then - cp $srcdir/fixincludes ./fixinc.sh -fi) - -# Enable Haifa scheduler. -AC_ARG_ENABLE(haifa, -[ --enable-haifa use the experimental scheduler. - --disable-haifa don't use the experimental scheduler for the - targets which normally enable it.]) - -# Enable threads -# Pass with no value to take the default -# Pass with a value to specify a thread package -AC_ARG_ENABLE(threads, -[ --enable-threads enable thread usage for target GCC. - --enable-threads=LIB use LIB thread package for target GCC.], -if test x$enable_threads = xno; then - enable_threads='' -fi, -enable_threads='') - -enable_threads_flag=$enable_threads -# Check if a valid thread package -case x${enable_threads_flag} in - x | xno) - # No threads - target_thread_file='single' - ;; - xyes) - # default - target_thread_file='' - ;; - xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \ - xsolaris | xwin32 | xdce | xvxworks) - target_thread_file=$enable_threads_flag - ;; - *) - echo "$enable_threads is an unknown thread package" 1>&2 - exit 1 - ;; -esac - -AC_ARG_ENABLE(objc-gc, -[ --enable-objc-gc enable the use of Boehm's garbage collector with - the GNU Objective-C runtime.], -if [[[ x$enable_objc_gc = xno ]]]; then - objc_boehm_gc='' -else - objc_boehm_gc=1 -fi, -objc_boehm_gc='') - -AC_ARG_ENABLE(java-gc, -changequote(<<,>>)dnl -<< --enable-java-gc=TYPE choose garbage collector [boehm]>>, -changequote([,]) - JAVAGC=$enableval, - JAVAGC=boehm) - -AC_ARG_WITH(dwarf2, -[ --enable-dwarf2 enable DWARF2 debugging as default.], -dwarf2="$with_dwarf2", -dwarf2=no) - -# Determine the host, build, and target systems -AC_CANONICAL_SYSTEM - -# Find the native compiler -AC_PROG_CC - -# If the native compiler is GCC, we can enable warnings even in stage1. -# That's useful for people building cross-compilers, or just running a -# quick `make'. -if test "x$GCC" = "xyes"; then - stage1_warn_cflags='$(WARN_CFLAGS)' -else - stage1_warn_cflags="" -fi -AC_SUBST(stage1_warn_cflags) - -AC_PROG_MAKE_SET - -AC_MSG_CHECKING([whether a default assembler was specified]) -if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then - if test x"$gas_flag" = x"no"; then - AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)]) - else - AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)]) - fi -else - AC_MSG_RESULT(no) -fi - -AC_MSG_CHECKING([whether a default linker was specified]) -if test x"${DEFAULT_LINKER+set}" = x"set"; then - if test x"$gnu_ld_flag" = x"no"; then - AC_MSG_RESULT([yes ($DEFAULT_LINKER)]) - else - AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)]) - fi -else - AC_MSG_RESULT(no) -fi - -# Find some useful tools -AC_PROG_AWK -AC_PROG_LEX -GCC_PROG_LN -GCC_PROG_LN_S -GCC_C_VOLATILE -AC_PROG_RANLIB -AC_PROG_YACC -EGCS_PROG_INSTALL - -AC_HEADER_STDC -AC_HEADER_TIME -GCC_HEADER_STRING -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h sys/stat.h direct.h) - -# Check for thread headers. -AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=]) -AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=]) - -# See if GNAT has been installed -AC_CHECK_PROG(gnat, gnatbind, yes, no) - -# See if the system preprocessor understands the ANSI C preprocessor -# stringification operator. -AC_MSG_CHECKING(whether cpp understands the stringify operator) -AC_CACHE_VAL(gcc_cv_c_have_stringify, -[AC_TRY_COMPILE(, -[#define S(x) #x -char *test = S(foo);], -gcc_cv_c_have_stringify=yes, gcc_cv_c_have_stringify=no)]) -AC_MSG_RESULT($gcc_cv_c_have_stringify) -if test $gcc_cv_c_have_stringify = yes; then - AC_DEFINE(HAVE_CPP_STRINGIFY) -fi - -# Use only if it exists, -# doesn't clash with , and declares intmax_t. -AC_MSG_CHECKING(for inttypes.h) -AC_CACHE_VAL(gcc_cv_header_inttypes_h, -[AC_TRY_COMPILE( - [#include -#include ], - [intmax_t i = -1;], - [gcc_cv_header_inttypes_h=yes], - gcc_cv_header_inttypes_h=no)]) -AC_MSG_RESULT($gcc_cv_header_inttypes_h) -if test $gcc_cv_header_inttypes_h = yes; then - AC_DEFINE(HAVE_INTTYPES_H) -fi - -AC_CHECK_FUNCS(strtoul bsearch strerror putenv popen bcopy bzero bcmp \ - index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \ - sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \ - fputs_unlocked) - -# Make sure wchar_t is available -#AC_CHECK_TYPE(wchar_t, unsigned int) - -GCC_FUNC_VFPRINTF_DOPRNT -GCC_FUNC_PRINTF_PTR - -case "${host}" in -*-*-uwin*) - # Under some versions of uwin, vfork is notoriously buggy and the test - # can hang configure; on other versions, vfork exists just as a stub. - # FIXME: This should be removed once vfork in uwin's runtime is fixed. - ac_cv_func_vfork_works=no - ;; -esac -AC_FUNC_VFORK - -GCC_NEED_DECLARATIONS(malloc realloc calloc free bcopy bzero bcmp \ - index rindex getenv atol sbrk abort atof strerror getcwd getwd \ - strsignal putc_unlocked fputs_unlocked strstr) - -GCC_NEED_DECLARATIONS(getrlimit setrlimit, [ -#include -#ifdef HAVE_SYS_RESOURCE_H -#include -#endif -]) - -AC_DECL_SYS_SIGLIST - -# mkdir takes a single argument on some systems. -GCC_FUNC_MKDIR_TAKES_ONE_ARG - -# File extensions -manext='.1' -objext='.o' -AC_SUBST(manext) -AC_SUBST(objext) - -build_xm_file= -build_xm_defines= -build_install_headers_dir=install-headers-tar -build_exeext= -host_xm_file= -host_xm_defines= -host_xmake_file= -host_truncate_target= -host_exeext= - -# Decode the host machine, then the target machine. -# For the host machine, we save the xm_file variable as host_xm_file; -# then we decode the target machine and forget everything else -# that came from the host machine. -for machine in $build $host $target; do - - out_file= - xmake_file= - tmake_file= - extra_headers= - extra_passes= - extra_parts= - extra_programs= - extra_objs= - extra_host_objs= - extra_gcc_objs= - xm_defines= - float_format= - # Set this to force installation and use of collect2. - use_collect2= - # Set this to override the default target model. - target_cpu_default= - # Set this to control how the header file directory is installed. - install_headers_dir=install-headers-tar - # Set this to a non-empty list of args to pass to cpp if the target - # wants its .md file passed through cpp. - md_cppflags= - # Set this if directory names should be truncated to 14 characters. - truncate_target= - # Set this if gdb needs a dir command with `dirname $out_file` - gdb_needs_out_file_path= - # Set this if the build machine requires executables to have a - # file name suffix. - exeext= - # Set this to control which thread package will be used. - thread_file= - # Reinitialize these from the flag values every loop pass, since some - # configure entries modify them. - gas="$gas_flag" - gnu_ld="$gnu_ld_flag" - enable_threads=$enable_threads_flag - - # Set default cpu_type, tm_file and xm_file so it can be updated in - # each machine entry. - cpu_type=`echo $machine | sed 's/-.*$//'` - case $machine in - alpha*-*-*) - cpu_type=alpha - ;; - arm*-*-*) - cpu_type=arm - ;; - c*-convex-*) - cpu_type=convex - ;; -changequote(,)dnl - i[34567]86-*-*) -changequote([,])dnl - cpu_type=i386 - ;; - hppa*-*-*) - cpu_type=pa - ;; - m68000-*-*) - cpu_type=m68k - ;; - mips*-*-*) - cpu_type=mips - ;; - powerpc*-*-*) - cpu_type=rs6000 - ;; - pyramid-*-*) - cpu_type=pyr - ;; - sparc*-*-*) - cpu_type=sparc - ;; - esac - - tm_file=${cpu_type}/${cpu_type}.h - xm_file=${cpu_type}/xm-${cpu_type}.h - - # Common parts for linux-gnu and openbsd systems - case $machine in - *-*-linux-gnu*) - xm_defines="HAVE_ATEXIT POSIX BSTRING" - ;; - *-*-openbsd*) - tm_file=${cpu_type}/openbsd.h - tmake_file="t-libc-ok t-openbsd" - # avoid surprises, always provide an xm-openbsd file - xm_file=${cpu_type}/xm-openbsd.h - # don't depend on processor x-fragments as well - xmake_file=none - if test x$enable_threads = xyes; then - thread_file='posix' - tmake_file="${tmake_file} t-openbsd-thread" - fi - ;; - esac - - case $machine in - # Support site-specific machine types. - *local*) - cpu_type=`echo $machine | sed -e 's/-.*//'` - rest=`echo $machine | sed -e "s/$cpu_type-//"` - xm_file=${cpu_type}/xm-$rest.h - tm_file=${cpu_type}/$rest.h - if test -f $srcdir/config/${cpu_type}/x-$rest; \ - then xmake_file=${cpu_type}/x-$rest; \ - else true; \ - fi - if test -f $srcdir/config/${cpu_type}/t-$rest; \ - then tmake_file=${cpu_type}/t-$rest; \ - else true; \ - fi - ;; - 1750a-*-*) - ;; - a29k-*-bsd* | a29k-*-sym1*) - tm_file="${tm_file} a29k/unix.h" - xm_defines=USG - xmake_file=a29k/x-unix - use_collect2=yes - ;; - a29k-*-udi | a29k-*-coff) - tm_file="${tm_file} dbxcoff.h a29k/udi.h" - tmake_file=a29k/t-a29kbare - ;; - a29k-wrs-vxworks*) - tm_file="${tm_file} dbxcoff.h a29k/udi.h a29k/vx29k.h" - tmake_file=a29k/t-vx29k - extra_parts="crtbegin.o crtend.o" - thread_file='vxworks' - ;; - a29k-*-*) # Default a29k environment. - use_collect2=yes - ;; - alpha-*-interix) - tm_file="${tm_file} alpha/alpha32.h interix.h alpha/alpha-interix.h" - - # GAS + IEEE_CONFORMANT+IEEE (no inexact); - #target_cpu_default="MASK_GAS|MASK_IEEE_CONFORMANT|MASK_IEEE" - - # GAS + IEEE_CONFORMANT - target_cpu_default="MASK_GAS|MASK_IEEE_CONFORMANT" - - xm_file="alpha/xm-alpha-interix.h xm-interix.h" - xmake_file="x-interix alpha/t-pe" - tmake_file="alpha/t-interix alpha/t-ieee" - if test x$enable_threads = xyes ; then - thread_file='posix' - fi - if test x$stabs = xyes ; then - tm_file="${tm_file} dbxcoff.h" - fi - #prefix='$$INTERIX_ROOT'/usr/contrib - #local_prefix='$$INTERIX_ROOT'/usr/contrib - ;; - alpha*-*-linux-gnuecoff*) - tm_file="${tm_file} alpha/linux-ecoff.h alpha/linux.h" - target_cpu_default="MASK_GAS" - tmake_file="alpha/t-ieee" - gas=no - xmake_file=none - gas=yes gnu_ld=yes - ;; - alpha*-*-linux-gnulibc1*) - tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h" - target_cpu_default="MASK_GAS" - tmake_file="t-linux t-linux-gnulibc1 alpha/t-linux alpha/t-crtbe alpha/t-ieee" - extra_parts="crtbegin.o crtend.o" - xmake_file=none - gas=yes gnu_ld=yes - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - alpha*-*-linux-gnu*) - tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h" - target_cpu_default="MASK_GAS" - tmake_file="t-linux alpha/t-linux alpha/t-crtbe alpha/t-ieee" - extra_parts="crtbegin.o crtend.o" - xmake_file=none - gas=yes gnu_ld=yes - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - alpha*-*-netbsd*) - tm_file="${tm_file} alpha/elf.h alpha/netbsd.h alpha/netbsd-elf.h" - target_cpu_default="MASK_GAS" - tmake_file="alpha/t-crtbe alpha/t-ieee" - extra_parts="crtbegin.o crtend.o" - xmake_file=none - gas=yes gnu_ld=yes - ;; - - alpha*-*-openbsd*) - # default x-alpha is only appropriate for dec-osf. - target_cpu_default="MASK_GAS" - tmake_file="alpha/t-ieee" - ;; - - alpha*-dec-osf*) - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - if test x$gas != xyes - then - extra_passes="mips-tfile mips-tdump" - fi - use_collect2=yes - tmake_file="alpha/t-ieee" - case $machine in - *-*-osf1*) - tm_file="${tm_file} alpha/osf.h alpha/osf12.h alpha/osf2or3.h" - ;; -changequote(,)dnl - *-*-osf[23]*) -changequote([,])dnl - tm_file="${tm_file} alpha/osf.h alpha/osf2or3.h" - ;; - *-*-osf4*) - tm_file="${tm_file} alpha/osf.h" - # Some versions of OSF4 (specifically X4.0-9 296.7) have - # a broken tar, so we use cpio instead. - install_headers_dir=install-headers-cpio - ;; - esac - case $machine in -changequote(,)dnl - *-*-osf4.0[b-z] | *-*-osf4.[1-9]*) -changequote([,])dnl - target_cpu_default=MASK_SUPPORT_ARCH - ;; - esac - ;; - alpha*-*-vxworks*) - tm_file="${tm_file} dbx.h alpha/vxworks.h" - tmake_file="alpha/t-ieee" - if [ x$gas != xyes ] - then - extra_passes="mips-tfile mips-tdump" - fi - use_collect2=yes - thread_file='vxworks' - ;; - alpha*-*-winnt*) - tm_file="${tm_file} alpha/alpha32.h alpha/win-nt.h winnt/win-nt.h" - xm_file="${xm_file} config/winnt/xm-winnt.h alpha/xm-winnt.h" - tmake_file="t-libc-ok alpha/t-ieee" - xmake_file=winnt/x-winnt - extra_host_objs=oldnames.o - extra_gcc_objs="spawnv.o oldnames.o" - if test x$gnu_ld != xyes - then - extra_programs=ld.exe - fi - if test x$enable_threads = xyes; then - thread_file='win32' - fi - ;; - alpha*-dec-vms*) - tm_file=alpha/vms.h - xm_file="${xm_file} alpha/xm-vms.h" - tmake_file="alpha/t-vms alpha/t-ieee" - ;; - arc-*-elf*) - extra_parts="crtinit.o crtfini.o" - ;; - arm-*-coff* | armel-*-coff*) - tm_file=arm/coff.h - tmake_file=arm/t-bare - ;; - arm-*-vxworks*) - tm_file=arm/vxarm.h - tmake_file=arm/t-bare - thread_file='vxworks' - ;; -changequote(,)dnl - arm-*-riscix1.[01]*) # Acorn RISC machine (early versions) -changequote([,])dnl - tm_file=arm/riscix1-1.h - use_collect2=yes - ;; - arm-*-riscix*) # Acorn RISC machine - if test x$gas = xyes - then - tm_file=arm/rix-gas.h - else - tm_file=arm/riscix.h - fi - xmake_file=arm/x-riscix - tmake_file=arm/t-riscix - use_collect2=yes - ;; - arm-semi-aout | armel-semi-aout) - tm_file=arm/semi.h - tmake_file=arm/t-semi - ;; - arm-semi-aof | armel-semi-aof) - tm_file=arm/semiaof.h - tmake_file=arm/t-semiaof - ;; - arm*-*-netbsd*) - tm_file=arm/netbsd.h - xm_file="arm/xm-netbsd.h ${xm_file}" - tmake_file="t-netbsd arm/t-netbsd" - use_collect2=yes - ;; - arm*-*-linux-gnuaout*) # ARM GNU/Linux with a.out - cpu_type=arm - xmake_file=x-linux - tm_file=arm/linux-aout.h - tmake_file=arm/t-linux - gnu_ld=yes - ;; - arm*-*-linux-gnu*) # ARM GNU/Linux with ELF - xm_file=arm/xm-linux.h - xmake_file=x-linux - case $machine in - armv2*-*-*) - tm_file=arm/linux-elf26.h - ;; - *) - tm_file=arm/linux-elf.h - ;; - esac - tmake_file="t-linux arm/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - case x${enable_threads} in - x | xyes | xpthreads | xposix) - thread_file='posix' - ;; - esac - ;; - arm*-*-aout) - tm_file=arm/aout.h - tmake_file=arm/t-bare - ;; - arm*-*-ecos-elf) - tm_file=arm/ecos-elf.h - tmake_file=arm/t-elf - ;; - arm*-*-elf) - tm_file=arm/unknown-elf.h - tmake_file=arm/t-arm-elf - ;; - arm*-*-oabi) - tm_file=arm/unknown-elf-oabi.h - tmake_file=arm/t-arm-elf - ;; - c1-convex-*) # Convex C1 - target_cpu_default=1 - use_collect2=yes - ;; - c2-convex-*) # Convex C2 - target_cpu_default=2 - use_collect2=yes - ;; - c32-convex-*) - target_cpu_default=4 - use_collect2=yes - ;; - c34-convex-*) - target_cpu_default=8 - use_collect2=yes - ;; - c38-convex-*) - target_cpu_default=16 - use_collect2=yes - ;; - c4x-*) - cpu_type=c4x - tmake_file=c4x/t-c4x - ;; - clipper-intergraph-clix*) - tm_file="${tm_file} svr3.h clipper/clix.h" - xm_file=clipper/xm-clix.h - xmake_file=clipper/x-clix - extra_headers=va-clipper.h - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; - dsp16xx-*) - ;; - elxsi-elxsi-*) - use_collect2=yes - ;; -# This hasn't been upgraded to GCC 2. -# fx80-alliant-*) # Alliant FX/80 -# ;; - h8300-*-*) - float_format=i32 - ;; - hppa*-*-openbsd*) - target_cpu_default="MASK_PA_11" - tmake_file=pa/t-openbsd - ;; - hppa1.1-*-pro*) - tm_file="pa/pa-pro.h ${tm_file} pa/pa-pro-end.h libgloss.h" - xm_file=pa/xm-papro.h - tmake_file=pa/t-pro - ;; - hppa1.1-*-osf*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-osf.h" - use_collect2=yes - ;; - hppa1.1-*-rtems*) - tm_file="pa/pa-pro.h ${tm_file} pa/pa-pro-end.h libgloss.h pa/rtems.h" - xm_file=pa/xm-papro.h - tmake_file=pa/t-pro - ;; - hppa1.0-*-osf*) - tm_file="${tm_file} pa/pa-osf.h" - use_collect2=yes - ;; - hppa1.1-*-bsd*) - target_cpu_default="MASK_PA_11" - use_collect2=yes - ;; - hppa1.0-*-bsd*) - use_collect2=yes - ;; - hppa1.0-*-hpux7*) - tm_file="pa/pa-oldas.h ${tm_file} pa/pa-hpux7.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; -changequote(,)dnl - hppa1.0-*-hpux8.0[0-2]*) -changequote([,])dnl - tm_file="${tm_file} pa/pa-hpux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - else - tm_file="pa/pa-oldas.h ${tm_file}" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; -changequote(,)dnl - hppa1.1-*-hpux8.0[0-2]*) -changequote([,])dnl - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - else - tm_file="pa/pa-oldas.h ${tm_file}" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.1-*-hpux8*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.0-*-hpux8*) - tm_file="${tm_file} pa/pa-hpux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.1-*-hpux10* | hppa2*-*-hpux10*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux10.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - tmake_file=pa/t-pa - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - if test x$enable_threads = x; then - enable_threads=$have_pthread_h - fi - if test x$enable_threads = xyes; then - thread_file='dce' - tmake_file="${tmake_file} pa/t-dce-thr" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.0-*-hpux10*) - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux10.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - tmake_file=pa/t-pa - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - if test x$enable_threads = x; then - enable_threads=$have_pthread_h - fi - if test x$enable_threads = xyes; then - thread_file='dce' - tmake_file="${tmake_file} pa/t-dce-thr" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.1-*-hpux* | hppa2*-*-hpux*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux9.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.0-*-hpux*) - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux9.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.1-*-hiux* | hppa2*-*-hiux*) - target_cpu_default="MASK_PA_11" - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hiux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa1.0-*-hiux*) - tm_file="${tm_file} pa/pa-hpux.h pa/pa-hiux.h" - xm_file=pa/xm-pahpux.h - xmake_file=pa/x-pa-hpux - if test x$gas = xyes - then - tm_file="${tm_file} pa/pa-gas.h" - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - ;; - hppa*-*-lites*) - target_cpu_default="MASK_PA_11" - use_collect2=yes - ;; - i370-*-mvs*) - ;; -changequote(,)dnl - i[34567]86-ibm-aix*) # IBM PS/2 running AIX -changequote([,])dnl - if test x$gas = xyes - then - tm_file=i386/aix386.h - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtstuff - else - tm_file=i386/aix386ng.h - use_collect2=yes - fi - xm_file="xm-alloca.h i386/xm-aix.h ${xm_file}" - xm_defines=USG - xmake_file=i386/x-aix - ;; -changequote(,)dnl - i[34567]86-ncr-sysv4*) # NCR 3000 - ix86 running system V.4 -changequote([,])dnl - xm_file="xm-siglist.h xm-alloca.h ${xm_file}" - xm_defines="USG POSIX SMALL_ARG_MAX" - xmake_file=i386/x-ncr3000 - if test x$stabs = xyes -a x$gas = xyes - then - tm_file=i386/sysv4gdb.h - else - tm_file=i386/sysv4.h - fi - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtpic - ;; -changequote(,)dnl - i[34567]86-next-*) -changequote([,])dnl - tm_file=i386/next.h - xm_file=i386/xm-next.h - tmake_file=i386/t-next - xmake_file=i386/x-next - extra_objs=nextstep.o - extra_parts="crtbegin.o crtend.o" - if test x$enable_threads = xyes; then - thread_file='mach' - fi - ;; -changequote(,)dnl - i[34567]86-sequent-bsd*) # 80386 from Sequent -changequote([,])dnl - use_collect2=yes - if test x$gas = xyes - then - tm_file=i386/seq-gas.h - else - tm_file=i386/sequent.h - fi - ;; -changequote(,)dnl - i[34567]86-sequent-ptx1*) -changequote([,])dnl - xm_defines="USG SVR3" - xmake_file=i386/x-sysv3 - tm_file=i386/seq-sysv3.h - tmake_file=i386/t-crtstuff - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; -changequote(,)dnl - i[34567]86-sequent-ptx2* | i[34567]86-sequent-sysv3*) -changequote([,])dnl - xm_defines="USG SVR3" - xmake_file=i386/x-sysv3 - tm_file=i386/seq2-sysv3.h - tmake_file=i386/t-crtstuff - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; -changequote(,)dnl - i[34567]86-sequent-ptx4* | i[34567]86-sequent-sysv4*) -changequote([,])dnl - xm_file="xm-siglist.h xm-alloca.h ${xm_file}" - xm_defines="USG POSIX SMALL_ARG_MAX" - xmake_file=x-svr4 - tm_file=i386/ptx4-i.h - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; - i386-sun-sunos*) # Sun i386 roadrunner - xm_defines=USG - tm_file=i386/sun.h - use_collect2=yes - ;; -changequote(,)dnl - i[34567]86-wrs-vxworks*) -changequote([,])dnl - tm_file=i386/vxi386.h - tmake_file=i386/t-i386bare - thread_file='vxworks' - ;; -changequote(,)dnl - i[34567]86-*-aout*) -changequote([,])dnl - tm_file=i386/i386-aout.h - tmake_file=i386/t-i386bare - ;; -changequote(,)dnl - i[34567]86-*-bsdi* | i[34567]86-*-bsd386*) -changequote([,])dnl - tm_file=i386/bsd386.h -# tmake_file=t-libc-ok - ;; -changequote(,)dnl - i[34567]86-*-bsd*) -changequote([,])dnl - tm_file=i386/386bsd.h -# tmake_file=t-libc-ok -# Next line turned off because both 386BSD and BSD/386 use GNU ld. -# use_collect2=yes - ;; -changequote(,)dnl - i[34567]86-*-freebsdelf*) -changequote([,])dnl - tm_file="i386/i386.h i386/att.h svr4.h i386/freebsd-elf.h i386/perform.h" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - tmake_file=t-freebsd - gas=yes - gnu_ld=yes - stabs=yes - ;; -changequote(,)dnl - i[34567]86-*-freebsd*) -changequote([,])dnl - tm_file=i386/freebsd.h - tmake_file=t-freebsd - ;; -changequote(,)dnl - i[34567]86-*-netbsd*) -changequote([,])dnl - tm_file=i386/netbsd.h - tmake_file=t-netbsd - use_collect2=yes - ;; -changequote(,)dnl - i[34567]86-*-openbsd*) -changequote([,])dnl - # we need collect2 until our bug is fixed... - use_collect2=yes - ;; -changequote(,)dnl - i[34567]86-*-coff*) -changequote([,])dnl - tm_file=i386/i386-coff.h - tmake_file=i386/t-i386bare - ;; -changequote(,)dnl - i[34567]86-*-isc*) # 80386 running ISC system -changequote([,])dnl - xm_file="${xm_file} i386/xm-isc.h" - xm_defines="USG SVR3" - case $machine in -changequote(,)dnl - i[34567]86-*-isc[34]*) -changequote([,])dnl - xmake_file=i386/x-isc3 - ;; - *) - xmake_file=i386/x-isc - ;; - esac - if test x$gas = xyes -a x$stabs = xyes - then - tm_file=i386/iscdbx.h - tmake_file=i386/t-svr3dbx - extra_parts="svr3.ifile svr3z.ifile" - else - tm_file=i386/isccoff.h - tmake_file=i386/t-crtstuff - extra_parts="crtbegin.o crtend.o" - fi - install_headers_dir=install-headers-cpio - ;; -changequote(,)dnl - i[34567]86-*-linux-gnuoldld*) # Intel 80386's running GNU/Linux -changequote([,])dnl # with a.out format using - # pre BFD linkers - xmake_file=x-linux-aout - tmake_file="t-linux-aout i386/t-crtstuff" - tm_file=i386/linux-oldld.h - gnu_ld=yes - float_format=i386 - ;; -changequote(,)dnl - i[34567]86-*-linux-gnuaout*) # Intel 80386's running GNU/Linux -changequote([,])dnl # with a.out format - xmake_file=x-linux-aout - tmake_file="t-linux-aout i386/t-crtstuff" - tm_file=i386/linux-aout.h - gnu_ld=yes - float_format=i386 - ;; -changequote(,)dnl - i[34567]86-*-linux-gnulibc1) # Intel 80386's running GNU/Linux -changequote([,])dnl # with ELF format using the - # GNU/Linux C library 5 - xmake_file=x-linux - tm_file=i386/linux.h - tmake_file="t-linux t-linux-gnulibc1 i386/t-crtstuff" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - float_format=i386 - if test x$enable_threads = xyes; then - thread_file='single' - fi - ;; -changequote(,)dnl - i[34567]86-*-linux-gnu*) # Intel 80386's running GNU/Linux -changequote([,])dnl # with ELF format using glibc 2 - # aka GNU/Linux C library 6 - xmake_file=x-linux - tm_file=i386/linux.h - tmake_file="t-linux i386/t-crtstuff" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - float_format=i386 - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; -changequote(,)dnl - i[34567]86-*-gnu*) - float_format=i386 -changequote([,])dnl - ;; -changequote(,)dnl - i[34567]86-go32-msdos | i[34567]86-*-go32*) -changequote([,])dnl - echo "GO32/DJGPP V1.X is no longer supported. Use *-pc-msdosdjgpp for DJGPP V2.X instead." - exit 1 - ;; -changequote(,)dnl - i[34567]86-pc-msdosdjgpp*) -changequote([,])dnl - xm_file=i386/xm-djgpp.h - tm_file=i386/djgpp.h - tmake_file=i386/t-djgpp - xmake_file=i386/x-djgpp - gnu_ld=yes - gas=yes - exeext=.exe - case $host in *pc-msdosdjgpp*) - target_alias=djgpp - ;; - esac - ;; -changequote(,)dnl - i[34567]86-moss-msdos* | i[34567]86-*-moss*) -changequote([,])dnl - tm_file=i386/moss.h - tmake_file=t-libc-ok - gnu_ld=yes - gas=yes - ;; -changequote(,)dnl - i[34567]86-*-lynxos*) -changequote([,])dnl - if test x$gas = xyes - then - tm_file=i386/lynx.h - else - tm_file=i386/lynx-ng.h - fi - xm_file=i386/xm-lynx.h - tmake_file=i386/t-i386bare - xmake_file=x-lynx - ;; -changequote(,)dnl - i[34567]86-*-mach*) -changequote([,])dnl - tm_file=i386/mach.h -# tmake_file=t-libc-ok - use_collect2=yes - ;; -changequote(,)dnl - i[34567]86-*-osfrose*) # 386 using OSF/rose -changequote([,])dnl - if test x$elf = xyes - then - tm_file=i386/osfelf.h - use_collect2= - else - tm_file=i386/osfrose.h - use_collect2=yes - fi - xm_file="i386/xm-osf.h ${xm_file}" - xmake_file=i386/x-osfrose - tmake_file=i386/t-osf - extra_objs=halfpic.o - ;; -changequote(,)dnl - i[34567]86-go32-rtems*) -changequote([,])dnl - cpu_type=i386 - xm_file=i386/xm-go32.h - tm_file=i386/go32-rtems.h - tmake_file="i386/t-go32 t-rtems" - ;; -changequote(,)dnl - i[34567]86-*-rtemself*) -changequote([,])dnl - cpu_type=i386 - tm_file=i386/rtemself.h - tmake_file="i386/t-i386bare t-rtems" - ;; -changequote(,)dnl - i[34567]86-*-rtems*) -changequote([,])dnl - cpu_type=i386 - tm_file=i386/rtems.h - tmake_file="i386/t-i386bare t-rtems" - ;; -changequote(,)dnl - i[34567]86-*-sco3.2v5*) # 80386 running SCO Open Server 5 -changequote([,])dnl - xm_file="xm-siglist.h xm-alloca.h ${xm_file} i386/xm-sco5.h" - xm_defines="USG SVR3" - xmake_file=i386/x-sco5 - install_headers_dir=install-headers-cpio - tm_file=i386/sco5.h - if test x$gas = xyes - then - tm_file="i386/sco5gas.h ${tm_file}" - tmake_file=i386/t-sco5gas - else - tmake_file=i386/t-sco5 - fi - extra_parts="crti.o crtbegin.o crtend.o crtbeginS.o crtendS.o" - ;; -changequote(,)dnl - i[34567]86-*-sco3.2v4*) # 80386 running SCO 3.2v4 system -changequote([,])dnl - xm_file="${xm_file} i386/xm-sco.h" - xm_defines="USG SVR3 BROKEN_LDEXP SMALL_ARG_MAX NO_SYS_SIGLIST" - xmake_file=i386/x-sco4 - install_headers_dir=install-headers-cpio - if test x$stabs = xyes - then - tm_file=i386/sco4dbx.h - tmake_file=i386/t-svr3dbx - extra_parts="svr3.ifile svr3z.rfile" - else - tm_file=i386/sco4.h - tmake_file=i386/t-crtstuff - extra_parts="crtbegin.o crtend.o" - fi - truncate_target=yes - ;; -changequote(,)dnl - i[34567]86-*-sco*) # 80386 running SCO system -changequote([,])dnl - xm_file=i386/xm-sco.h - xmake_file=i386/x-sco - install_headers_dir=install-headers-cpio - if test x$stabs = xyes - then - tm_file=i386/scodbx.h - tmake_file=i386/t-svr3dbx - extra_parts="svr3.ifile svr3z.rfile" - else - tm_file=i386/sco.h - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtstuff - fi - truncate_target=yes - ;; -changequote(,)dnl - i[34567]86-*-solaris2*) -changequote([,])dnl - xm_file="xm-siglist.h xm-alloca.h ${xm_file}" - xm_defines="USG POSIX SMALL_ARG_MAX" - tm_file=i386/sol2.h - if test x$gas = xyes; then - # Only needed if gas does not support -s - tm_file="i386/sol2gas.h ${tm_file}" - fi - tmake_file=i386/t-sol2 - extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o" - xmake_file=x-svr4 - if test x$enable_threads = xyes; then - thread_file='solaris' - fi - ;; -changequote(,)dnl - i[34567]86-*-sysv5*) # Intel x86 on System V Release 5 -changequote([,])dnl - xm_file="xm-alloca.h xm-siglist.h ${xm_file}" - xm_defines="USG POSIX" - tm_file=i386/sysv5.h - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - tmake_file=i386/t-crtpic - xmake_file=x-svr4 - extra_parts="crtbegin.o crtend.o" - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; -changequote(,)dnl - i[34567]86-*-sysv4*) # Intel 80386's running system V.4 -changequote([,])dnl - xm_file="xm-siglist.h xm-alloca.h ${xm_file}" - xm_defines="USG POSIX SMALL_ARG_MAX" - tm_file=i386/sysv4.h - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - tmake_file=i386/t-crtpic - xmake_file=x-svr4 - extra_parts="crtbegin.o crtend.o" - ;; -changequote(,)dnl - i[34567]86-*-udk*) # Intel x86 on SCO UW/OSR5 Dev Kit -changequote([,])dnl - xm_file="xm-alloca.h xm-siglist.h ${xm_file}" - xm_defines="USG POSIX" - tm_file=i386/udk.h - tmake_file="i386/t-crtpic i386/t-udk" - xmake_file=x-svr4 - extra_parts="crtbegin.o crtend.o" - install_headers_dir=install-headers-cpio - ;; -changequote(,)dnl - i[34567]86-*-osf1*) # Intel 80386's running OSF/1 1.3+ -changequote([,])dnl - cpu_type=i386 - xm_file="${xm_file} xm-svr4.h i386/xm-sysv4.h i386/xm-osf1elf.h" - xm_defines="USE_C_ALLOCA SMALL_ARG_MAX" - if test x$stabs = xyes - then - tm_file=i386/osf1elfgdb.h - else - tm_file=i386/osf1elf.h - fi - tmake_file=i386/t-osf1elf - xmake_file=i386/x-osf1elf - extra_parts="crti.o crtn.o crtbegin.o crtend.o" - ;; -changequote(,)dnl - i[34567]86-*-sysv*) # Intel 80386's running system V -changequote([,])dnl - xm_defines="USG SVR3" - xmake_file=i386/x-sysv3 - if test x$gas = xyes - then - if test x$stabs = xyes - then - tm_file=i386/svr3dbx.h - tmake_file=i386/t-svr3dbx - extra_parts="svr3.ifile svr3z.rfile" - else - tm_file=i386/svr3gas.h - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtstuff - fi - else - tm_file=i386/sysv3.h - extra_parts="crtbegin.o crtend.o" - tmake_file=i386/t-crtstuff - fi - ;; - i386-*-vsta) # Intel 80386's running VSTa kernel - xm_file="${xm_file} i386/xm-vsta.h" - tm_file=i386/vsta.h - tmake_file=i386/t-vsta - xmake_file=i386/x-vsta - ;; -changequote(,)dnl - i[34567]86-*-win32) -changequote([,])dnl - xm_file="${xm_file} i386/xm-cygwin.h" - tmake_file=i386/t-cygwin - tm_file=i386/win32.h - xmake_file=i386/x-cygwin - extra_objs=winnt.o - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - ;; -changequote(,)dnl - i[34567]86-*-pe | i[34567]86-*-cygwin*) -changequote([,])dnl - xm_file="${xm_file} i386/xm-cygwin.h" - tmake_file=i386/t-cygwin - tm_file=i386/cygwin.h - xmake_file=i386/x-cygwin - extra_objs=winnt.o - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - ;; -changequote(,)dnl - i[34567]86-*-mingw32*) -changequote([,])dnl - tm_file=i386/mingw32.h - xm_file="${xm_file} i386/xm-mingw32.h" - tmake_file="i386/t-cygwin i386/t-mingw32" - extra_objs=winnt.o - xmake_file=i386/x-cygwin - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - case $machine in - *mingw32msv*) - ;; - *minwg32crt* | *mingw32*) - tm_file="${tm_file} i386/crtdll.h" - ;; - esac - ;; -changequote(,)dnl - i[34567]86-*-uwin*) -changequote([,])dnl - tm_file=i386/uwin.h - xm_file="${xm_file} i386/xm-uwin.h" - xm_defines="USG NO_STAB_H NO_SYS_SIGLIST" - tmake_file="i386/t-cygwin i386/t-uwin" - extra_objs=winnt.o - xmake_file=i386/x-cygwin - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - ;; -changequote(,)dnl - i[34567]86-*-interix*) -changequote([,])dnl - tm_file="i386/i386-interix.h interix.h" - xm_file="i386/xm-i386-interix.h xm-interix.h" - xm_defines="USG NO_SYS_SIGLIST" - tmake_file="i386/t-interix" - extra_objs=interix.o - xmake_file=x-interix - if test x$enable_threads = xyes ; then - thread_file='posix' - fi - if test x$stabs = xyes ; then - tm_file="${tm_file} dbxcoff.h" - fi - ;; -changequote(,)dnl - i[34567]86-*-winnt3*) -changequote([,])dnl - tm_file=i386/win-nt.h - out_file=i386/i386.c - xm_file="xm-winnt.h ${xm_file}" - xmake_file=winnt/x-winnt - tmake_file=i386/t-winnt - extra_host_objs="winnt.o oldnames.o" - extra_gcc_objs="spawnv.o oldnames.o" - if test x$gnu_ld != xyes - then - extra_programs=ld.exe - fi - if test x$enable_threads = xyes; then - thread_file='win32' - fi - ;; -changequote(,)dnl - i[34567]86-dg-dgux*) -changequote([,])dnl - xm_file="xm-alloca.h xm-siglist.h ${xm_file}" - xm_defines="USG POSIX" - out_file=i386/dgux.c - tm_file=i386/dgux.h - tmake_file=i386/t-dgux - xmake_file=i386/x-dgux - install_headers_dir=install-headers-cpio - ;; - i860-alliant-*) # Alliant FX/2800 - tm_file="${tm_file} svr4.h i860/sysv4.h i860/fx2800.h" - xm_file="${xm_file}" - xmake_file=i860/x-fx2800 - tmake_file=i860/t-fx2800 - extra_parts="crtbegin.o crtend.o" - ;; - i860-*-bsd*) - tm_file="${tm_file} i860/bsd.h" - if test x$gas = xyes - then - tm_file="${tm_file} i860/bsd-gas.h" - fi - use_collect2=yes - ;; - i860-*-mach*) - tm_file="${tm_file} i860/mach.h" - tmake_file=t-libc-ok - ;; - i860-*-osf*) # Intel Paragon XP/S, OSF/1AD - tm_file="${tm_file} svr3.h i860/paragon.h" - xm_defines="USG SVR3" - tmake_file=t-osf - ;; - i860-*-sysv3*) - tm_file="${tm_file} svr3.h i860/sysv3.h" - xm_defines="USG SVR3" - xmake_file=i860/x-sysv3 - extra_parts="crtbegin.o crtend.o" - ;; - i860-*-sysv4*) - tm_file="${tm_file} svr4.h i860/sysv4.h" - xm_defines="USG SVR3" - xmake_file=i860/x-sysv4 - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - ;; - i960-wrs-vxworks5 | i960-wrs-vxworks5.0*) - tm_file="${tm_file} i960/vx960.h" - tmake_file=i960/t-vxworks960 - use_collect2=yes - thread_file='vxworks' - ;; - i960-wrs-vxworks5* | i960-wrs-vxworks) - tm_file="${tm_file} dbxcoff.h i960/i960-coff.h i960/vx960-coff.h" - tmake_file=i960/t-vxworks960 - use_collect2=yes - thread_file='vxworks' - ;; - i960-wrs-vxworks*) - tm_file="${tm_file} i960/vx960.h" - tmake_file=i960/t-vxworks960 - use_collect2=yes - thread_file='vxworks' - ;; - i960-*-coff*) - tm_file="${tm_file} dbxcoff.h i960/i960-coff.h libgloss.h" - tmake_file=i960/t-960bare - use_collect2=yes - ;; - i960-*-rtems) - tmake_file="i960/t-960bare t-rtems" - tm_file="${tm_file} dbxcoff.h i960/rtems.h" - use_collect2=yes - ;; - i960-*-*) # Default i960 environment. - use_collect2=yes - ;; - m32r-*-elf*) - extra_parts="crtinit.o crtfini.o" - ;; - m68000-convergent-sysv*) - tm_file=m68k/ctix.h - xm_file="m68k/xm-3b1.h ${xm_file}" - xm_defines=USG - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-hp-bsd*) # HP 9000/200 running BSD - tm_file=m68k/hp2bsd.h - xmake_file=m68k/x-hp2bsd - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-hp-hpux*) # HP 9000 series 300 - xm_file="xm-alloca.h ${xm_file}" - xm_defines="USG NO_SYS_SIGLIST" - if test x$gas = xyes - then - xmake_file=m68k/x-hp320g - tm_file=m68k/hp310g.h - else - xmake_file=m68k/x-hp320 - tm_file=m68k/hp310.h - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-sun-sunos3*) - tm_file=m68k/sun2.h - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-sun-sunos4*) - tm_file=m68k/sun2o4.h - use_collect2=yes - extra_headers=math-68881.h - ;; - m68000-att-sysv*) - xm_file="m68k/xm-3b1.h ${xm_file}" - xm_defines=USG - if test x$gas = xyes - then - tm_file=m68k/3b1g.h - else - tm_file=m68k/3b1.h - fi - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-apple-aux*) # Apple Macintosh running A/UX - xm_defines="USG AUX" - tmake_file=m68k/t-aux - install_headers_dir=install-headers-cpio - extra_headers=math-68881.h - extra_parts="crt1.o mcrt1.o maccrt1.o crt2.o crtn.o" - tm_file= - if test "$gnu_ld" = yes - then - tm_file="${tm_file} m68k/auxgld.h" - else - tm_file="${tm_file} m68k/auxld.h" - fi - if test "$gas" = yes - then - tm_file="${tm_file} m68k/auxgas.h" - else - tm_file="${tm_file} m68k/auxas.h" - fi - tm_file="${tm_file} m68k/a-ux.h" - float_format=m68k - ;; - m68k-apollo-*) - tm_file=m68k/apollo68.h - xmake_file=m68k/x-apollo68 - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-altos-sysv*) # Altos 3068 - if test x$gas = xyes - then - tm_file=m68k/altos3068.h - xm_defines=USG - else - echo "The Altos is supported only with the GNU assembler" 1>&2 - exit 1 - fi - extra_headers=math-68881.h - ;; - m68k-bull-sysv*) # Bull DPX/2 - if test x$gas = xyes - then - if test x$stabs = xyes - then - tm_file=m68k/dpx2cdbx.h - else - tm_file=m68k/dpx2g.h - fi - else - tm_file=m68k/dpx2.h - fi - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - xmake_file=m68k/x-dpx2 - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-atari-sysv4*) # Atari variant of V.4. - tm_file=m68k/atari.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines="USG FULL_PROTOTYPES" - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-motorola-sysv*) - tm_file=m68k/mot3300.h - xm_file="xm-alloca.h m68k/xm-mot3300.h ${xm_file}" - xm_defines=NO_SYS_SIGLIST - if test x$gas = xyes - then - xmake_file=m68k/x-mot3300-gas - if test x$gnu_ld = xyes - then - tmake_file=m68k/t-mot3300-gald - else - tmake_file=m68k/t-mot3300-gas - use_collect2=yes - fi - else - xmake_file=m68k/x-mot3300 - if test x$gnu_ld = xyes - then - tmake_file=m68k/t-mot3300-gld - else - tmake_file=m68k/t-mot3300 - use_collect2=yes - fi - fi - gdb_needs_out_file_path=yes - extra_parts="crt0.o mcrt0.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-ncr-sysv*) # NCR Tower 32 SVR3 - tm_file=m68k/tower-as.h - xm_defines="USG SVR3" - xmake_file=m68k/x-tower - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - ;; - m68k-plexus-sysv*) - tm_file=m68k/plexus.h - xm_file="xm-alloca.h m68k/xm-plexus.h ${xm_file}" - xm_defines=USG - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-tti-*) - tm_file=m68k/pbb.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - extra_headers=math-68881.h - ;; - m68k-crds-unos*) - xm_file="xm-alloca.h m68k/xm-crds.h ${xm_file}" - xm_defines="USG unos" - xmake_file=m68k/x-crds - tm_file=m68k/crds.h - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-cbm-sysv4*) # Commodore variant of V.4. - tm_file=m68k/amix.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines="USG FULL_PROTOTYPES" - xmake_file=m68k/x-amix - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-ccur-rtu) - tm_file=m68k/ccur-GAS.h - xmake_file=m68k/x-ccur - extra_headers=math-68881.h - use_collect2=yes - float_format=m68k - ;; - m68k-hp-bsd4.4*) # HP 9000/3xx running 4.4bsd - tm_file=m68k/hp3bsd44.h - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-hp-bsd*) # HP 9000/3xx running Berkeley Unix - tm_file=m68k/hp3bsd.h - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-isi-bsd*) - if test x$with_fp = xno - then - tm_file=m68k/isi-nfp.h - else - tm_file=m68k/isi.h - float_format=m68k - fi - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-hp-hpux7*) # HP 9000 series 300 running HPUX version 7. - xm_file="xm-alloca.h ${xm_file}" - xm_defines="USG NO_SYS_SIGLIST" - if test x$gas = xyes - then - xmake_file=m68k/x-hp320g - tm_file=m68k/hp320g.h - else - xmake_file=m68k/x-hp320 - tm_file=m68k/hpux7.h - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-hp-hpux*) # HP 9000 series 300 - xm_file="xm-alloca.h ${xm_file}" - xm_defines="USG NO_SYS_SIGLIST" - if test x$gas = xyes - then - xmake_file=m68k/x-hp320g - tm_file=m68k/hp320g.h - else - xmake_file=m68k/x-hp320 - tm_file=m68k/hp320.h - fi - install_headers_dir=install-headers-cpio - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-sun-mach*) - tm_file=m68k/sun3mach.h - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-sony-newsos3*) - if test x$gas = xyes - then - tm_file=m68k/news3gas.h - else - tm_file=m68k/news3.h - fi - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-sony-bsd* | m68k-sony-newsos*) - if test x$gas = xyes - then - tm_file=m68k/newsgas.h - else - tm_file=m68k/news.h - fi - use_collect2=yes - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-next-nextstep2*) - tm_file=m68k/next21.h - xm_file="m68k/xm-next.h ${xm_file}" - tmake_file=m68k/t-next - xmake_file=m68k/x-next - extra_objs=nextstep.o - extra_headers=math-68881.h - use_collect2=yes - float_format=m68k - ;; - m68k-next-nextstep3*) - tm_file=m68k/next.h - xm_file="m68k/xm-next.h ${xm_file}" - tmake_file=m68k/t-next - xmake_file=m68k/x-next - extra_objs=nextstep.o - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - if test x$enable_threads = xyes; then - thread_file='mach' - fi - ;; - m68k-sun-sunos3*) - if test x$with_fp = xno - then - tm_file=m68k/sun3n3.h - else - tm_file=m68k/sun3o3.h - float_format=m68k - fi - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-sun-sunos*) # For SunOS 4 (the default). - if test x$with_fp = xno - then - tm_file=m68k/sun3n.h - else - tm_file=m68k/sun3.h - float_format=m68k - fi - use_collect2=yes - extra_headers=math-68881.h - ;; - m68k-wrs-vxworks*) - tm_file=m68k/vxm68k.h - tmake_file=m68k/t-vxworks68 - extra_headers=math-68881.h - thread_file='vxworks' - float_format=m68k - ;; - m68k-*-aout*) - tmake_file=m68k/t-m68kbare - tm_file="m68k/m68k-aout.h libgloss.h" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-*-coff*) - tmake_file=m68k/t-m68kbare - tm_file="m68k/m68k-coff.h dbx.h libgloss.h" - extra_headers=math-68881.h - float_format=m68k - ;; - m68020-*-elf* | m68k-*-elf*) - tm_file="m68k/m68020-elf.h libgloss.h" - xm_file=m68k/xm-m68kv.h - tmake_file=m68k/t-m68kelf - header_files=math-68881.h - ;; - m68k-*-lynxos*) - if test x$gas = xyes - then - tm_file=m68k/lynx.h - else - tm_file=m68k/lynx-ng.h - fi - xm_file=m68k/xm-lynx.h - xmake_file=x-lynx - tmake_file=m68k/t-lynx - extra_headers=math-68881.h - float_format=m68k - ;; - m68k*-*-netbsd*) - tm_file=m68k/netbsd.h - tmake_file=t-netbsd - float_format=m68k - use_collect2=yes - ;; - m68k*-*-openbsd*) - float_format=m68k - # we need collect2 until our bug is fixed... - use_collect2=yes - ;; - m68k-*-sysv3*) # Motorola m68k's running system V.3 - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - xmake_file=m68k/x-m68kv - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-*-sysv4*) # Motorola m68k's running system V.4 - tm_file=m68k/m68kv4.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - tmake_file=t-svr4 - extra_parts="crtbegin.o crtend.o" - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-*-linux-gnuaout*) # Motorola m68k's running GNU/Linux - # with a.out format - xmake_file=x-linux - tm_file=m68k/linux-aout.h - tmake_file="t-linux-aout m68k/t-linux-aout" - extra_headers=math-68881.h - float_format=m68k - gnu_ld=yes - ;; - m68k-*-linux-gnulibc1) # Motorola m68k's running GNU/Linux - # with ELF format using the - # GNU/Linux C library 5 - xmake_file=x-linux - tm_file=m68k/linux.h - tmake_file="t-linux t-linux-gnulibc1 m68k/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - extra_headers=math-68881.h - float_format=m68k - gnu_ld=yes - ;; - m68k-*-linux-gnu*) # Motorola m68k's running GNU/Linux - # with ELF format using glibc 2 - # aka the GNU/Linux C library 6. - xmake_file=x-linux - tm_file=m68k/linux.h - tmake_file="t-linux m68k/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - extra_headers=math-68881.h - float_format=m68k - gnu_ld=yes - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - m68k-*-psos*) - tmake_file=m68k/t-m68kbare - tm_file=m68k/m68k-psos.h - extra_headers=math-68881.h - float_format=m68k - ;; - m68k-*-rtems*) - tmake_file="m68k/t-m68kbare t-rtems" - tm_file=m68k/rtems.h - extra_headers=math-68881.h - float_format=m68k - ;; - - m88k-dg-dgux*) - case $machine in - m88k-dg-dguxbcs*) - tm_file=m88k/dguxbcs.h - tmake_file=m88k/t-dguxbcs - ;; - *) - tm_file=m88k/dgux.h - tmake_file=m88k/t-dgux - ;; - esac - extra_parts="crtbegin.o bcscrtbegin.o crtend.o m88kdgux.ld" - xmake_file=m88k/x-dgux - if test x$gas = xyes - then - tmake_file=m88k/t-dgux-gas - fi - ;; - m88k-dolphin-sysv3*) - tm_file=m88k/dolph.h - extra_parts="crtbegin.o crtend.o" - xm_file="m88k/xm-sysv3.h ${xm_file}" - xmake_file=m88k/x-dolph - if test x$gas = xyes - then - tmake_file=m88k/t-m88k-gas - fi - ;; - m88k-tektronix-sysv3) - tm_file=m88k/tekXD88.h - extra_parts="crtbegin.o crtend.o" - xm_file="m88k/xm-sysv3.h ${xm_file}" - xmake_file=m88k/x-tekXD88 - if test x$gas = xyes - then - tmake_file=m88k/t-m88k-gas - fi - ;; - m88k-*-aout*) - tm_file=m88k/m88k-aout.h - ;; - m88k-*-coff*) - tm_file=m88k/m88k-coff.h - tmake_file=m88k/t-bug - ;; - m88k-*-luna*) - tm_file=m88k/luna.h - extra_parts="crtbegin.o crtend.o" - if test x$gas = xyes - then - tmake_file=m88k/t-luna-gas - else - tmake_file=m88k/t-luna - fi - ;; - m88k-*-openbsd*) - tmake_file="${tmake_file} m88k/t-luna-gas" - ;; - m88k-*-sysv3*) - tm_file=m88k/sysv3.h - extra_parts="crtbegin.o crtend.o" - xm_file="m88k/xm-sysv3.h ${xm_file}" - xmake_file=m88k/x-sysv3 - if test x$gas = xyes - then - tmake_file=m88k/t-m88k-gas - fi - ;; - m88k-*-sysv4*) - tm_file=m88k/sysv4.h - extra_parts="crtbegin.o crtend.o" - xmake_file=m88k/x-sysv4 - tmake_file=m88k/t-sysv4 - ;; - mips-sgi-irix6*) # SGI System V.4., IRIX 6 - tm_file=mips/iris6.h - xm_file=mips/xm-iris6.h - xmake_file=mips/x-iris6 - tmake_file=mips/t-iris6 -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-wrs-vxworks) - tm_file="mips/elf.h libgloss.h mips/vxworks.h" - tmake_file=mips/t-ecoff - gas=yes - gnu_ld=yes - extra_parts="crtbegin.o crtend.o" - thread_file='vxworks' - ;; - mips-sgi-irix5cross64) # Irix5 host, Irix 6 target, cross64 - tm_file="mips/iris6.h mips/cross64.h" - xm_defines=USG - xm_file="mips/xm-iris5.h" - xmake_file=mips/x-iris - tmake_file=mips/t-cross64 - # See comment in mips/iris[56].h files. - use_collect2=yes -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-sni-sysv4) - if test x$gas = xyes - then - if test x$stabs = xyes - then - tm_file=mips/iris5gdb.h - else - tm_file="mips/sni-svr4.h mips/sni-gas.h" - fi - else - tm_file=mips/sni-svr4.h - fi - xm_defines=USG - xmake_file=mips/x-sni-svr4 - tmake_file=mips/t-mips-gas - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-sgi-irix5*) # SGI System V.4., IRIX 5 - if test x$gas = xyes - then - tm_file="mips/iris5.h mips/iris5gas.h" - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - else - tm_file=mips/iris5.h - fi - xm_defines=USG - xm_file="mips/xm-iris5.h" - xmake_file=mips/x-iris - # mips-tfile doesn't work yet - tmake_file=mips/t-mips-gas - # See comment in mips/iris5.h file. - use_collect2=yes -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-sgi-irix4loser*) # Mostly like a MIPS. - tm_file="mips/iris4loser.h mips/iris3.h ${tm_file} mips/iris4.h" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-iris - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-sgi-irix4*) # Mostly like a MIPS. - tm_file="mips/iris3.h ${tm_file} mips/iris4.h" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-iris - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi -# if test x$enable_threads = xyes; then -# thread_file='irix' -# fi - ;; - mips-sgi-*) # Mostly like a MIPS. - tm_file="mips/iris3.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-iris3 - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-dec-osfrose*) # Decstation running OSF/1 reference port with OSF/rose. - tm_file="mips/osfrose.h ${tm_file}" - xmake_file=mips/x-osfrose - tmake_file=mips/t-osfrose - extra_objs=halfpic.o - use_collect2=yes - ;; - mips-dec-osf*) # Decstation running OSF/1 as shipped by DIGITAL - tm_file=mips/dec-osf1.h - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xmake_file=mips/x-dec-osf1 - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - tmake_file=mips/t-ultrix - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-dec-bsd*) # Decstation running 4.4 BSD - tm_file=mips/dec-bsd.h - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - tmake_file=mips/t-ultrix - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mipsel-*-netbsd* | mips-dec-netbsd*) # Decstation running NetBSD - tm_file=mips/netbsd.h - # On NetBSD, the headers are already okay, except for math.h. - tmake_file=t-netbsd - ;; - mips*-*-linux*) # Linux MIPS, either endian. - xmake_file=x-linux - xm_file="xm-siglist.h ${xm_file}" - case $machine in - mipsel-*) tm_file="mips/elfl.h mips/linux.h" ;; - *) tm_file="mips/elf.h mips/linux.h" ;; - esac - extra_parts="crtbegin.o crtend.o" - gnu_ld=yes - gas=yes - ;; - mips*el-*-openbsd*) # mips little endian - target_cpu_default="MASK_GAS|MASK_ABICALLS" - tm_file=mips/openbsd.h - ;; - mips*-*-openbsd*) # mips big endian - target_cpu_default="MASK_GAS|MASK_ABICALLS" - tm_file=mips/openbsd-be.h - ;; - mips-sony-bsd* | mips-sony-newsos*) # Sony NEWS 3600 or risc/news. - tm_file="mips/news4.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - xmake_file=mips/x-sony - ;; - mips-sony-sysv*) # Sony NEWS 3800 with NEWSOS5.0. - # That is based on svr4. - # t-svr4 is not right because this system doesn't use ELF. - tm_file="mips/news5.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_file="xm-siglist.h ${xm_file}" - xm_defines=USG - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-tandem-sysv4*) # Tandem S2 running NonStop UX - tm_file="mips/svr4-5.h mips/svr4-t.h" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_file="xm-siglist.h ${xm_file}" - xm_defines=USG - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - extra_parts="crtbegin.o crtend.o" - else - tmake_file=mips/t-mips - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-ultrix* | mips-dec-mach3) # Decstation. - tm_file="mips/ultrix.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xmake_file=mips/x-ultrix - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - tmake_file=mips/t-ultrix - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; -changequote(,)dnl - mips-*-riscos[56789]bsd*) -changequote([,])dnl - tm_file=mips/bsd-5.h # MIPS BSD 4.3, RISC-OS 5.0 - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-bsd-gas - else - tmake_file=mips/t-bsd - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; -changequote(,)dnl - mips-*-bsd* | mips-*-riscosbsd* | mips-*-riscos[1234]bsd*) -changequote([,])dnl - tm_file="mips/bsd-4.h ${tm_file}" # MIPS BSD 4.3, RISC-OS 4.0 - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-bsd-gas - else - tmake_file=mips/t-bsd - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; -changequote(,)dnl - mips-*-riscos[56789]sysv4*) -changequote([,])dnl - tm_file=mips/svr4-5.h # MIPS System V.4., RISC-OS 5.0 - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_file="xm-siglist.h ${xm_file}" - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-svr4-gas - else - tmake_file=mips/t-svr4 - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; -changequote(,)dnl - mips-*-sysv4* | mips-*-riscos[1234]sysv4* | mips-*-riscossysv4*) -changequote([,])dnl - tm_file="mips/svr4-4.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-svr4-gas - else - tmake_file=mips/t-svr4 - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; -changequote(,)dnl - mips-*-riscos[56789]sysv*) -changequote([,])dnl - tm_file=mips/svr3-5.h # MIPS System V.3, RISC-OS 5.0 - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-svr3-gas - else - tmake_file=mips/t-svr3 - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-sysv* | mips-*-riscos*sysv*) - tm_file="mips/svr3-4.h ${tm_file}" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - xm_defines=USG - xmake_file=mips/x-sysv - if test x$gas = xyes - then - tmake_file=mips/t-svr3-gas - else - tmake_file=mips/t-svr3 - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; -changequote(,)dnl - mips-*-riscos[56789]*) # Default MIPS RISC-OS 5.0. -changequote([,])dnl - tm_file=mips/mips-5.h - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mips-*-gnu*) - ;; - mipsel-*-ecoff*) - tm_file=mips/ecoffl.h - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - tmake_file=mips/t-ecoff - ;; - mips-*-ecoff*) - tm_file="gofast.h mips/ecoff.h" - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - tmake_file=mips/t-ecoff - ;; - mipsel-*-elf*) - tm_file="mips/elfl.h libgloss.h" - tmake_file=mips/t-elf - ;; - mips-*-elf*) - tm_file="mips/elf.h" - tmake_file=mips/t-elf - ;; - mips64el-*-elf*) - tm_file="mips/elfl64.h" - tmake_file=mips/t-elf - ;; - mips64orionel-*-elf*) - tm_file="mips/elforion.h mips/elfl64.h libgloss.h" - tmake_file=mips/t-elf - ;; - mips64-*-elf*) - tm_file="mips/elf64.h" - tmake_file=mips/t-elf - ;; - mips64orion-*-elf*) - tm_file="mips/elforion.h mips/elf64.h libgloss.h" - tmake_file=mips/t-elf - ;; - mips64orion-*-rtems*) - tm_file="mips/elforion.h mips/elf64.h mips/rtems64.h" - tmake_file="mips/t-ecoff t-rtems" - ;; - mipstx39el-*-elf*) - tm_file="mips/r3900.h mips/elfl.h mips/abi64.h" - tmake_file=mips/t-r3900 - ;; - mipstx39-*-elf*) - tm_file="mips/r3900.h mips/elf.h mips/abi64.h" - tmake_file=mips/t-r3900 - ;; - mips-*-*) # Default MIPS RISC-OS 4.0. - if test x$stabs = xyes; then - tm_file="${tm_file} dbx.h" - fi - if test x$gas = xyes - then - tmake_file=mips/t-mips-gas - else - extra_passes="mips-tfile mips-tdump" - fi - if test x$gnu_ld != xyes - then - use_collect2=yes - fi - ;; - mn10200-*-*) - cpu_type=mn10200 - tm_file="mn10200/mn10200.h" - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - use_collect2=no - ;; - mn10300-*-*) - cpu_type=mn10300 - tm_file="mn10300/mn10300.h" - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - use_collect2=no - ;; - ns32k-encore-bsd*) - tm_file=ns32k/encore.h - use_collect2=yes - ;; - ns32k-sequent-bsd*) - tm_file=ns32k/sequent.h - use_collect2=yes - ;; - ns32k-tek6100-bsd*) - tm_file=ns32k/tek6100.h - use_collect2=yes - ;; - ns32k-tek6200-bsd*) - tm_file=ns32k/tek6200.h - use_collect2=yes - ;; -# This has not been updated to GCC 2. -# ns32k-ns-genix*) -# xm_defines=USG -# xmake_file=ns32k/x-genix -# tm_file=ns32k/genix.h -# use_collect2=yes -# ;; - ns32k-merlin-*) - tm_file=ns32k/merlin.h - use_collect2=yes - ;; - ns32k-pc532-mach*) - tm_file=ns32k/pc532-mach.h - use_collect2=yes - ;; - ns32k-pc532-minix*) - tm_file=ns32k/pc532-min.h - xm_file="ns32k/xm-pc532-min.h ${xm-file}" - xm_defines=USG - use_collect2=yes - ;; - ns32k-*-netbsd*) - tm_file=ns32k/netbsd.h - xm_file="ns32k/xm-netbsd.h ${xm_file}" - # On NetBSD, the headers are already okay, except for math.h. - tmake_file=t-netbsd - use_collect2=yes - ;; - pdp11-*-bsd) - tm_file="${tm_file} pdp11/2bsd.h" - ;; - pdp11-*-*) - ;; - ns32k-*-openbsd*) - # Nothing special - ;; - pyramid-*-*) - cpu_type=pyr - xmake_file=pyr/x-pyr - use_collect2=yes - ;; - romp-*-aos*) - use_collect2=yes - ;; - romp-*-mach*) - xmake_file=romp/x-mach - use_collect2=yes - ;; - romp-*-openbsd*) - # Nothing special - ;; - powerpc-*-openbsd*) - tmake_file="${tmake_file} rs6000/t-rs6000 rs6000/t-openbsd" - ;; - powerpc-*-beos*) - cpu_type=rs6000 - tm_file=rs6000/beos.h - xm_file=rs6000/xm-beos.h - tmake_file=rs6000/t-beos - xmake_file=rs6000/x-beos - ;; - powerpc-*-sysv* | powerpc-*-elf*) - tm_file=rs6000/sysv4.h - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG POSIX" - extra_headers=ppc-asm.h - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - xmake_file=rs6000/x-sysv4 - ;; - powerpc-*-eabiaix*) - tm_file=rs6000/eabiaix.h - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - extra_headers=ppc-asm.h - ;; - powerpc-*-eabisim*) - tm_file=rs6000/eabisim.h - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - extra_headers=ppc-asm.h - ;; - powerpc-*-eabi*) - tm_file=rs6000/eabi.h - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - extra_headers=ppc-asm.h - ;; - powerpc-*-rtems*) - tm_file=rs6000/rtems.h - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcgas t-rtems rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc t-rtems rs6000/t-ppccomm" - fi - extra_headers=ppc-asm.h - ;; - powerpc-*-linux-gnulibc1) - tm_file=rs6000/linux.h - xm_file=rs6000/xm-sysv4.h - out_file=rs6000/rs6000.c - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos t-linux t-linux-gnulibc1 rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc t-linux t-linux-gnulibc1 rs6000/t-ppccomm" - fi - xmake_file=x-linux - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - extra_headers=ppc-asm.h - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - powerpc-*-linux-gnu*) - tm_file=rs6000/linux.h - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG ${xm_defines}" - out_file=rs6000/rs6000.c - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos t-linux rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc t-linux rs6000/t-ppccomm" - fi - xmake_file=x-linux - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - extra_headers=ppc-asm.h - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - powerpc-wrs-vxworks*) - cpu_type=rs6000 - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG POSIX" - tm_file=rs6000/vxppc.h - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - extra_headers=ppc-asm.h - thread_file='vxworks' - ;; - powerpcle-*-sysv* | powerpcle-*-elf*) - tm_file=rs6000/sysv4le.h - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG POSIX" - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - xmake_file=rs6000/x-sysv4 - extra_headers=ppc-asm.h - ;; - powerpcle-*-eabisim*) - tm_file=rs6000/eabilesim.h - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - extra_headers=ppc-asm.h - ;; - powerpcle-*-eabi*) - tm_file=rs6000/eabile.h - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcgas rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - extra_headers=ppc-asm.h - ;; - powerpcle-*-winnt* ) - tm_file=rs6000/win-nt.h - tmake_file=rs6000/t-winnt -# extra_objs=pe.o - if test x$enable_threads = xyes; then - thread_file='win32' - fi - extra_headers=ppc-asm.h - ;; - powerpcle-*-pe | powerpcle-*-cygwin*) - tm_file=rs6000/cygwin.h - xm_file="rs6000/xm-cygwin.h ${xm_file}" - tmake_file=rs6000/t-winnt - xmake_file=rs6000/x-cygwin -# extra_objs=pe.o - if test x$enable_threads = xyes; then - thread_file='win32' - fi - exeext=.exe - extra_headers=ppc-asm.h - ;; - powerpcle-*-solaris2*) - tm_file=rs6000/sol2.h - xm_file="xm-siglist.h rs6000/xm-sysv4.h" - xm_defines="USG POSIX" - if test x$gas = xyes - then - tmake_file="rs6000/t-ppcos rs6000/t-ppccomm" - else - tmake_file="rs6000/t-ppc rs6000/t-ppccomm" - fi - xmake_file=rs6000/x-sysv4 - extra_headers=ppc-asm.h - ;; -changequote(,)dnl - rs6000-ibm-aix3.[01]*) -changequote([,])dnl - tm_file=rs6000/aix31.h - xmake_file=rs6000/x-aix31 - float_format=none - use_collect2=yes - ;; -changequote(,)dnl - rs6000-ibm-aix3.2.[456789]* | powerpc-ibm-aix3.2.[456789]*) -changequote([,])dnl - tm_file=rs6000/aix3newas.h - if test x$host != x$target - then - tmake_file=rs6000/t-xnewas - else - tmake_file=rs6000/t-newas - fi - float_format=none - use_collect2=yes - ;; -changequote(,)dnl - rs6000-ibm-aix4.[12]* | powerpc-ibm-aix4.[12]*) -changequote([,])dnl - tm_file=rs6000/aix41.h - if test x$host != x$target - then - tmake_file=rs6000/t-xnewas - else - tmake_file=rs6000/t-newas - fi - if test "$gnu_ld" = yes - then - xmake_file=rs6000/x-aix41-gld - else - xmake_file=rs6000/x-aix41 - fi - float_format=none - use_collect2=yes - ;; -changequote(,)dnl - rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*) -changequote([,])dnl - tm_file=rs6000/aix43.h - if test x$host != x$target - then - tmake_file=rs6000/t-xaix43 - else - tmake_file=rs6000/t-aix43 - fi - xmake_file=rs6000/x-aix43 - float_format=none - use_collect2=yes - ;; -changequote(,)dnl - rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*) -changequote([,])dnl - tm_file=rs6000/aix43.h - if test x$host != x$target - then - tmake_file=rs6000/t-xaix43 - else - tmake_file=rs6000/t-aix43 - fi - xmake_file=rs6000/x-aix43 - float_format=none - use_collect2=yes - ;; - rs6000-ibm-aix*) - float_format=none - use_collect2=yes - ;; - rs6000-bull-bosx) - float_format=none - use_collect2=yes - ;; - rs6000-*-mach*) - tm_file=rs6000/mach.h - xm_file="${xm_file} rs6000/xm-mach.h" - xmake_file=rs6000/x-mach - use_collect2=yes - ;; - rs6000-*-lynxos*) - tm_file=rs6000/lynx.h - xm_file=rs6000/xm-lynx.h - tmake_file=rs6000/t-rs6000 - xmake_file=rs6000/x-lynx - use_collect2=yes - ;; - sh-*-elf*) - tm_file=sh/elf.h - float_format=sh - ;; - sh-*-rtemself*) - tmake_file="sh/t-sh t-rtems" - tm_file=sh/rtemself.h - float_format=sh - ;; - sh-*-rtems*) - tmake_file="sh/t-sh t-rtems" - tm_file=sh/rtems.h - float_format=sh - ;; - sh-*-*) - float_format=sh - ;; - sparc-tti-*) - tm_file=sparc/pbd.h - xm_file="xm-alloca.h ${xm_file}" - xm_defines=USG - ;; - sparc-wrs-vxworks* | sparclite-wrs-vxworks*) - tm_file=sparc/vxsparc.h - tmake_file=sparc/t-vxsparc - use_collect2=yes - thread_file='vxworks' - ;; - sparc-*-aout*) - tmake_file=sparc/t-sparcbare - tm_file="sparc/aout.h libgloss.h" - ;; - sparc-*-netbsd*) - tm_file=sparc/netbsd.h - tmake_file=t-netbsd - use_collect2=yes - ;; - sparc-*-openbsd*) - # we need collect2 until our bug is fixed... - use_collect2=yes - ;; - sparc-*-bsd*) - tm_file=sparc/bsd.h - ;; - sparc-*-elf*) - tm_file=sparc/elf.h - tmake_file=sparc/t-elf - extra_parts="crti.o crtn.o crtbegin.o crtend.o" - #float_format=i128 - float_format=i64 - ;; - sparc-*-linux-gnuaout*) # Sparc's running GNU/Linux, a.out - xm_file="${xm_file} sparc/xm-linux.h" - tm_file=sparc/linux-aout.h - xmake_file=x-linux - gnu_ld=yes - ;; - sparc-*-linux-gnulibc1*) # Sparc's running GNU/Linux, libc5 - xm_file="${xm_file} sparc/xm-linux.h" - xmake_file=x-linux - tm_file=sparc/linux.h - tmake_file="t-linux t-linux-gnulibc1" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - ;; - sparc-*-linux-gnu*) # Sparc's running GNU/Linux, libc6 - xm_file="${xm_file} sparc/xm-linux.h" - xmake_file=x-linux - tm_file=sparc/linux.h - tmake_file="t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - if test x$enable_threads = xyes; then - thread_file='posix' - fi - ;; - sparc-*-lynxos*) - if test x$gas = xyes - then - tm_file=sparc/lynx.h - else - tm_file=sparc/lynx-ng.h - fi - xm_file=sparc/xm-lynx.h - tmake_file=sparc/t-sunos41 - xmake_file=x-lynx - ;; - sparc-*-rtems*) - tmake_file="sparc/t-sparcbare t-rtems" - tm_file=sparc/rtems.h - ;; - sparcv9-*-solaris2*) - tm_file=sparc/sol2-sld-64.h - xm_file="sparc/xm-sysv4-64.h sparc/xm-sol2.h" - xm_defines="USG POSIX" - tmake_file="sparc/t-sol2 sparc/t-sol2-64" - xmake_file=sparc/x-sysv4 - extra_parts="crt1.o crti.o crtn.o gcrt1.o crtbegin.o crtend.o" - float_format=none - if test x${enable_threads} = x ; then - enable_threads=$have_pthread_h - if test x${enable_threads} = x ; then - enable_threads=$have_thread_h - fi - fi - if test x${enable_threads} = xyes ; then - if test x${have_pthread_h} = xyes ; then - thread_file='posix' - else - thread_file='solaris' - fi - fi - ;; - sparc-hal-solaris2*) - xm_file="xm-siglist.h sparc/xm-sysv4.h sparc/xm-sol2.h" - xm_defines="USG POSIX" - tm_file="sparc/sol2.h sparc/hal.h" - tmake_file="sparc/t-halos sparc/t-sol2" - xmake_file=sparc/x-sysv4 - extra_parts="crt1.o crti.o crtn.o gmon.o crtbegin.o crtend.o" - case $machine in - *-*-solaris2.[0-4]) - float_format=i128 - ;; - *) - float_format=none - ;; - esac - thread_file='solaris' - ;; - sparc-*-solaris2*) - if test x$gnu_ld = xyes - then - tm_file=sparc/sol2.h - else - tm_file=sparc/sol2-sld.h - fi - xm_file="xm-siglist.h sparc/xm-sysv4.h sparc/xm-sol2.h" - xm_defines="USG POSIX" - tmake_file=sparc/t-sol2 - xmake_file=sparc/x-sysv4 - extra_parts="crt1.o crti.o crtn.o gcrt1.o gmon.o crtbegin.o crtend.o" - case $machine in -changequote(,)dnl - *-*-solaris2.[0-4]) -changequote([,])dnl - float_format=i128 - ;; - *) - float_format=none - ;; - esac - if test x${enable_threads} = x; then - enable_threads=$have_pthread_h - if test x${enable_threads} = x; then - enable_threads=$have_thread_h - fi - fi - if test x${enable_threads} = xyes; then - if test x${have_pthread_h} = xyes; then - thread_file='posix' - else - thread_file='solaris' - fi - fi - ;; - sparc-*-sunos4.0*) - tm_file=sparc/sunos4.h - tmake_file=sparc/t-sunos40 - use_collect2=yes - ;; - sparc-*-sunos4*) - tm_file=sparc/sunos4.h - tmake_file=sparc/t-sunos41 - use_collect2=yes - if test x$gas = xyes; then - tm_file="${tm_file} sparc/sun4gas.h" - fi - ;; - sparc-*-sunos3*) - tm_file=sparc/sun4o3.h - use_collect2=yes - ;; - sparc-*-sysv4*) - tm_file=sparc/sysv4.h - xm_file="xm-siglist.h sparc/xm-sysv4.h" - xm_defines="USG POSIX" - tmake_file=t-svr4 - xmake_file=sparc/x-sysv4 - extra_parts="crtbegin.o crtend.o" - ;; - sparc-*-vxsim*) - xm_file="xm-siglist.h sparc/xm-sysv4.h sparc/xm-sol2.h" - xm_defines="USG POSIX" - tm_file=sparc/vxsim.h - tmake_file=sparc/t-vxsparc - xmake_file=sparc/x-sysv4 - ;; - sparclet-*-aout*) - tm_file="sparc/splet.h libgloss.h" - tmake_file=sparc/t-splet - ;; - sparclite-*-coff*) - tm_file="sparc/litecoff.h libgloss.h" - tmake_file=sparc/t-sparclite - ;; - sparclite-*-aout*) - tm_file="sparc/lite.h aoutos.h libgloss.h" - tmake_file=sparc/t-sparclite - ;; - sparc64-*-aout*) - tmake_file=sparc/t-sp64 - tm_file=sparc/sp64-aout.h - ;; - sparc64-*-elf*) - tmake_file=sparc/t-sp64 - tm_file=sparc/sp64-elf.h - extra_parts="crtbegin.o crtend.o" - ;; - sparc64-*-linux*) # 64-bit Sparc's running GNU/Linux - tmake_file="t-linux sparc/t-linux64" - xm_file="sparc/xm-sp64.h sparc/xm-linux.h" - tm_file=sparc/linux64.h - xmake_file=x-linux - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" - gnu_ld=yes - ;; -# This hasn't been upgraded to GCC 2. -# tahoe-harris-*) # Harris tahoe, using COFF. -# tm_file=tahoe/harris.h -# ;; -# tahoe-*-bsd*) # tahoe running BSD -# ;; - thumb-*-coff* | thumbel-*-coff*) - tm_file=arm/tcoff.h - out_file=arm/thumb.c - xm_file=arm/xm-thumb.h - md_file=arm/thumb.md - tmake_file=arm/t-thumb - ;; - thumb-wrs-vxworks) - tm_file=arm/tcoff.h - out_file=arm/thumb.c - xm_file=arm/xm-thumb.h - md_file=arm/thumb.md - tmake_file=arm/t-thumb - thread_file='vxworks' - ;; -# This hasn't been upgraded to GCC 2. -# tron-*-*) -# cpu_type=gmicro -# use_collect2=yes -# ;; - v850-*-*) - cpu_type=v850 - tm_file="v850/v850.h" - xm_file="v850/xm-v850.h" - tmake_file=v850/t-v850 - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - use_collect2=no - ;; - vax-*-bsd*) # vaxen running BSD - use_collect2=yes - float_format=vax - ;; - vax-*-sysv*) # vaxen running system V - tm_file="${tm_file} vax/vaxv.h" - xm_defines=USG - float_format=vax - ;; - vax-*-netbsd*) - tm_file="${tm_file} netbsd.h vax/netbsd.h" - tmake_file=t-netbsd - float_format=vax - use_collect2=yes - ;; - vax-*-openbsd*) - tmake_file="${tmake_file} vax/t-openbsd" - ;; - vax-*-ultrix*) # vaxen running ultrix - tm_file="${tm_file} vax/ultrix.h" - use_collect2=yes - float_format=vax - ;; - vax-*-vms*) # vaxen running VMS - xm_file=vax/xm-vms.h - tm_file=vax/vms.h - float_format=vax - ;; - vax-*-*) # vax default entry - float_format=vax - ;; - we32k-att-sysv*) - xm_file="${xm_file} xm-svr3" - use_collect2=yes - ;; - *) - echo "Configuration $machine not supported" 1>&2 - exit 1 - ;; - esac - - case $machine in - *-*-linux-gnu*) - ;; # Existing GNU/Linux systems do not use the GNU setup. - *-*-gnu*) - # On the GNU system, the setup is just about the same on - # each different CPU. The specific machines that GNU - # supports are matched above and just set $cpu_type. - xm_file="xm-gnu.h ${xm_file}" - tm_file=${cpu_type}/gnu.h - extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" - # GNU always uses ELF. - elf=yes - # GNU tools are the only tools. - gnu_ld=yes - gas=yes - xmake_file=x-linux # These details are the same as Linux. - tmake_file=t-gnu # These are not. - ;; - *-*-sysv4*) - xmake_try_sysv=x-sysv - install_headers_dir=install-headers-cpio - ;; - *-*-sysv*) - install_headers_dir=install-headers-cpio - ;; - esac - - # Distinguish i[34567]86 - # Also, do not run mips-tfile on MIPS if using gas. - # Process --with-cpu= for PowerPC/rs6000 - target_cpu_default2= - case $machine in - i486-*-*) - target_cpu_default2=1 - ;; - i586-*-*) - case $target_alias in - k6-*) - target_cpu_default2=4 - ;; - *) - target_cpu_default2=2 - ;; - esac - ;; - i686-*-* | i786-*-*) - target_cpu_default2=3 - ;; - alpha*-*-*) - case $machine in - alphaev6*) - target_cpu_default2="MASK_CPU_EV6|MASK_BWX|MASK_MAX|MASK_FIX" - ;; - alphapca56*) - target_cpu_default2="MASK_CPU_EV5|MASK_BWX|MASK_MAX" - ;; - alphaev56*) - target_cpu_default2="MASK_CPU_EV5|MASK_BWX" - ;; - alphaev5*) - target_cpu_default2="MASK_CPU_EV5" - ;; - esac - - if test x$gas = xyes - then - if test "$target_cpu_default2" = "" - then - target_cpu_default2="MASK_GAS" - else - target_cpu_default2="${target_cpu_default2}|MASK_GAS" - fi - fi - ;; - arm*-*-*) - case "x$with_cpu" in - x) - # The most generic - target_cpu_default2="TARGET_CPU_generic" - ;; - - # Distinguish cores, and major variants - # arm7m doesn't exist, but D & I don't affect code - xarm[23678] | xarm250 | xarm[67][01]0 \ - | xarm7m | xarm7dm | xarm7dmi | xarm7tdmi \ - | xarm7100 | xarm7500 | xarm7500fe | xarm810 \ - | xstrongarm | xstrongarm110 | xstrongarm1100) - target_cpu_default2="TARGET_CPU_$with_cpu" - ;; - - xyes | xno) - echo "--with-cpu must be passed a value" 1>&2 - exit 1 - ;; - - *) - if test x$pass2done = xyes - then - echo "Unknown cpu used with --with-cpu=$with_cpu" 1>&2 - exit 1 - fi - ;; - esac - ;; - - mips*-*-ecoff* | mips*-*-elf*) - if test x$gas = xyes - then - if test x$gnu_ld = xyes - then - target_cpu_default2=20 - else - target_cpu_default2=16 - fi - fi - ;; - mips*-*-*) - if test x$gas = xyes - then - target_cpu_default2=16 - fi - ;; - powerpc*-*-* | rs6000-*-*) - case "x$with_cpu" in - x) - ;; - - xcommon | xpower | xpower2 | xpowerpc | xrios \ - | xrios1 | xrios2 | xrsc | xrsc1 \ - | x601 | x602 | x603 | x603e | x604 | x604e | x620 \ - | xec603e | x740 | x750 | x401 \ - | x403 | x505 | x801 | x821 | x823 | x860) - target_cpu_default2="\"$with_cpu\"" - ;; - - xyes | xno) - echo "--with-cpu must be passed a value" 1>&2 - exit 1 - ;; - - *) - if test x$pass2done = xyes - then - echo "Unknown cpu used with --with-cpu=$with_cpu" 1>&2 - exit 1 - fi - ;; - esac - ;; - sparc*-*-*) - case ".$with_cpu" in - .) - target_cpu_default2=TARGET_CPU_"`echo $machine | sed 's/-.*$//'`" - ;; - .supersparc | .hypersparc | .ultrasparc | .v7 | .v8 | .v9) - target_cpu_default2="TARGET_CPU_$with_cpu" - ;; - *) - if test x$pass2done = xyes - then - echo "Unknown cpu used with --with-cpu=$with_cpu" 1>&2 - exit 1 - fi - ;; - esac - ;; - esac - - if test "$target_cpu_default2" != "" - then - if test "$target_cpu_default" != "" - then - target_cpu_default="(${target_cpu_default}|${target_cpu_default2})" - else - target_cpu_default=$target_cpu_default2 - fi - fi - - # No need for collect2 if we have the GNU linker. - # Actually, there is now; GNU ld doesn't handle the EH info or - # collecting for shared libraries. - #case x$gnu_ld in - #xyes) - # use_collect2= - # ;; - #esac - -# Save data on machine being used to compile GCC in build_xm_file. -# Save data on host machine in vars host_xm_file and host_xmake_file. - if test x$pass1done = x - then - if test x"$xm_file" = x - then build_xm_file=$cpu_type/xm-$cpu_type.h - else build_xm_file=$xm_file - fi - build_xm_defines=$xm_defines - build_install_headers_dir=$install_headers_dir - build_exeext=$exeext - pass1done=yes - else - if test x$pass2done = x - then - if test x"$xm_file" = x - then host_xm_file=$cpu_type/xm-$cpu_type.h - else host_xm_file=$xm_file - fi - host_xm_defines=$xm_defines - if test x"$xmake_file" = x - then xmake_file=$cpu_type/x-$cpu_type - fi - host_xmake_file="$xmake_file" - host_truncate_target=$truncate_target - host_extra_gcc_objs=$extra_gcc_objs - host_extra_objs=$extra_host_objs - host_exeext=$exeext - pass2done=yes - fi - fi -done - -extra_objs="${host_extra_objs} ${extra_objs}" - -# Default the target-machine variables that were not explicitly set. -if test x"$tm_file" = x -then tm_file=$cpu_type/$cpu_type.h; fi - -if test x$extra_headers = x -then extra_headers=; fi - -if test x"$xm_file" = x -then xm_file=$cpu_type/xm-$cpu_type.h; fi - -if test x$md_file = x -then md_file=$cpu_type/$cpu_type.md; fi - -if test x$out_file = x -then out_file=$cpu_type/$cpu_type.c; fi - -if test x"$tmake_file" = x -then tmake_file=$cpu_type/t-$cpu_type -fi - -if test x"$dwarf2" = xyes -then tm_file="tm-dwarf2.h $tm_file" -fi - -if test x$float_format = x -then float_format=i64 -fi - -if test $float_format = none -then float_h_file=Makefile.in -else float_h_file=float-$float_format.h -fi - -if test x$enable_haifa = x -then - case $target in - alpha*-* | hppa*-* | powerpc*-* | rs6000-* | *sparc*-* | m32r*-*) - enable_haifa=yes;; - esac -fi - -# Handle cpp installation. -if test x$enable_cpp != xno -then - tmake_file="$tmake_file t-install-cpp" -fi - -# Say what files are being used for the output code and MD file. -echo "Using \`$srcdir/config/$out_file' to output insns." -echo "Using \`$srcdir/config/$md_file' as machine description file." - -count=a -for f in $tm_file; do - count=${count}x -done -if test $count = ax; then - echo "Using \`$srcdir/config/$tm_file' as target machine macro file." -else - echo "Using the following target machine macro files:" - for f in $tm_file; do - echo " $srcdir/config/$f" - done -fi - -count=a -for f in $host_xm_file; do - count=${count}x -done -if test $count = ax; then - echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file." -else - echo "Using the following host machine macro files:" - for f in $host_xm_file; do - echo " $srcdir/config/$f" - done -fi - -if test "$host_xm_file" != "$build_xm_file"; then - count=a - for f in $build_xm_file; do - count=${count}x - done - if test $count = ax; then - echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file." - else - echo "Using the following build machine macro files:" - for f in $build_xm_file; do - echo " $srcdir/config/$f" - done - fi -fi - -if test x$thread_file = x; then - if test x$target_thread_file != x; then - thread_file=$target_thread_file - else - thread_file='single' - fi -fi - -# Set up the header files. -# $links is the list of header files to create. -# $vars is the list of shell variables with file names to include. -# auto-host.h is the file containing items generated by autoconf and is -# the first file included by config.h. -null_defines= -host_xm_file="auto-host.h gansidecl.h ${host_xm_file} hwint.h" - -# If host=build, it is correct to have hconfig include auto-host.h -# as well. If host!=build, we are in error and need to do more -# work to find out the build config parameters. -if test x$host = x$build -then - build_xm_file="auto-host.h gansidecl.h ${build_xm_file} hwint.h" -else - # We create a subdir, then run autoconf in the subdir. - # To prevent recursion we set host and build for the new - # invocation of configure to the build for this invocation - # of configure. - tempdir=build.$$ - rm -rf $tempdir - mkdir $tempdir - cd $tempdir - case ${srcdir} in - /*) realsrcdir=${srcdir};; - *) realsrcdir=../${srcdir};; - esac - CC=${CC_FOR_BUILD} ${realsrcdir}/configure \ - --target=$target --host=$build --build=$build - - # We just finished tests for the build machine, so rename - # the file auto-build.h in the gcc directory. - mv auto-host.h ../auto-build.h - cd .. - rm -rf $tempdir - build_xm_file="auto-build.h gansidecl.h ${build_xm_file} hwint.h" -fi - -xm_file="gansidecl.h ${xm_file}" -tm_file="gansidecl.h ${tm_file}" - -vars="host_xm_file tm_file xm_file build_xm_file" -links="config.h tm.h tconfig.h hconfig.h" -defines="host_xm_defines null_defines xm_defines build_xm_defines" - -rm -f config.bak -if test -f config.status; then mv -f config.status config.bak; fi - -# Make the links. -while test -n "$vars" -do - set $vars; var=$1; shift; vars=$* - set $links; link=$1; shift; links=$* - set $defines; define=$1; shift; defines=$* - - rm -f $link - - # Define TARGET_CPU_DEFAULT if the system wants one. - # This substitutes for lots of *.h files. - if test "$target_cpu_default" != "" -a $link = tm.h - then - echo "#define TARGET_CPU_DEFAULT ($target_cpu_default)" >>$link - fi - - for file in `eval echo '$'$var`; do - case $file in - auto-config.h) - ;; - *) - echo '#ifdef IN_GCC' >>$link - ;; - esac - echo "#include \"$file\"" >>$link - case $file in - auto-config.h) - ;; - *) - echo '#endif' >>$link - ;; - esac - done - - for def in `eval echo '$'$define`; do - echo "#ifndef $def" >>$link - echo "#define $def" >>$link - echo "#endif" >>$link - done -done - -# Truncate the target if necessary -if test x$host_truncate_target != x; then - target=`echo $target | sed -e 's/\(..............\).*/\1/'` -fi - -# Get the version trigger filename from the toplevel -if test "${with_gcc_version_trigger+set}" = set; then - gcc_version_trigger=$with_gcc_version_trigger -else - gcc_version_trigger=${srcdir}/version.c -fi -changequote(,)dnl -gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${gcc_version_trigger}` -changequote([,])dnl - -# Internationalization -PACKAGE=gcc -VERSION="$gcc_version" -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") -AC_DEFINE_UNQUOTED(VERSION, "$VERSION") -AC_SUBST(PACKAGE) -AC_SUBST(VERSION) - -ALL_LINGUAS="en_UK" - -# NLS support is still experimental, so disable it by default for now. -AC_ARG_ENABLE(nls, - [ --enable-nls use Native Language Support (disabled by default)], - , enable_nls=no) - -AM_GNU_GETTEXT -XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT" - -# Get an absolute path to the GCC top-level source directory -holddir=`pwd` -cd $srcdir -topdir=`pwd` -cd $holddir - -# Conditionalize the makefile for this host machine. -# Make-host contains the concatenation of all host makefile fragments -# [there can be more than one]. This file is built by configure.frag. -host_overrides=Make-host -dep_host_xmake_file= -for f in .. ${host_xmake_file} -do - if test -f ${srcdir}/config/$f - then - dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f" - fi -done - -# Conditionalize the makefile for this target machine. -# Make-target contains the concatenation of all host makefile fragments -# [there can be more than one]. This file is built by configure.frag. -target_overrides=Make-target -dep_tmake_file= -for f in .. ${tmake_file} -do - if test -f ${srcdir}/config/$f - then - dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f" - fi -done - -# If the host doesn't support symlinks, modify CC in -# FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works. -# Otherwise, we can use "CC=$(CC)". -rm -f symtest.tem -if $symbolic_link $srcdir/gcc.c symtest.tem 2>/dev/null -then - cc_set_by_configure="\$(CC)" - quoted_cc_set_by_configure="\$(CC)" - stage_prefix_set_by_configure="\$(STAGE_PREFIX)" -else - rm -f symtest.tem - if cp -p $srcdir/gcc.c symtest.tem 2>/dev/null - then - symbolic_link="cp -p" - else - symbolic_link="cp" - fi - cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`" - quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`" - stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`" -fi -rm -f symtest.tem - -out_object_file=`basename $out_file .c`.o - -tm_file_list= -for f in $tm_file; do - case $f in - gansidecl.h ) - tm_file_list="${tm_file_list} $f" ;; - *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;; - esac -done - -host_xm_file_list= -for f in $host_xm_file; do - case $f in - auto-host.h | gansidecl.h | hwint.h ) - host_xm_file_list="${host_xm_file_list} $f" ;; - *) host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" ;; - esac -done - -build_xm_file_list= -for f in $build_xm_file; do - case $f in - auto-build.h | auto-host.h | gansidecl.h | hwint.h ) - build_xm_file_list="${build_xm_file_list} $f" ;; - *) build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" ;; - esac -done - -# Define macro CROSS_COMPILE in compilation -# if this is a cross-compiler. -# Also use all.cross instead of all.internal -# and add cross-make to Makefile. -cross_overrides="/dev/null" -if test x$host != x$target -then - cross_defines="CROSS=-DCROSS_COMPILE" - cross_overrides="${topdir}/cross-make" -fi - -# When building gcc with a cross-compiler, we need to fix a few things. -# This must come after cross-make as we want all.build to override -# all.cross. -build_overrides="/dev/null" -if test x$build != x$host -then - build_overrides="${topdir}/build-make" -fi - -# Expand extra_headers to include complete path. -# This substitutes for lots of t-* files. -extra_headers_list= -if test "x$extra_headers" = x -then true -else - # Prepend ${srcdir}/ginclude/ to every entry in extra_headers. - for file in $extra_headers; - do - extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/${file}" - done -fi - -if test x$use_collect2 = xno; then - use_collect2= -fi - -# Add a definition of USE_COLLECT2 if system wants one. -# Also tell toplev.c what to do. -# This substitutes for lots of t-* files. -if test x$use_collect2 = x -then - will_use_collect2= - maybe_use_collect2= -else - will_use_collect2="collect2" - maybe_use_collect2="-DUSE_COLLECT2" -fi - -# NEED TO CONVERT -# Set MD_DEPS if the real md file is in md.pre-cpp. -# Set MD_CPP to the cpp to pass the md file through. Md files use ';' -# for line oriented comments, so we must always use a GNU cpp. If -# building gcc with a cross compiler, use the cross compiler just -# built. Otherwise, we can use the cpp just built. -md_file_sub= -if test "x$md_cppflags" = x -then - md_file_sub=$srcdir/config/$md_file -else - md_file=md -fi - -# If we have gas in the build tree, make a link to it. -if test -f ../gas/Makefile; then - rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null -fi - -# If we have nm in the build tree, make a link to it. -if test -f ../binutils/Makefile; then - rm -f nm; $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null -fi - -# If we have ld in the build tree, make a link to it. -if test -f ../ld/Makefile; then -# if test x$use_collect2 = x; then -# rm -f ld; $symbolic_link ../ld/ld-new$host_exeext ld$host_exeext 2>/dev/null -# else - rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null -# fi -fi - -# Figure out what assembler alignment features are present. -AC_MSG_CHECKING(assembler alignment features) -gcc_cv_as= -gcc_cv_as_alignment_features= -gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas -if test -x "$DEFAULT_ASSEMBLER"; then - gcc_cv_as="$DEFAULT_ASSEMBLER" -elif test -x "$AS"; then - gcc_cv_as="$AS" -elif test -x as$host_exeext; then - # Build using assembler in the current directory. - gcc_cv_as=./as$host_exeext -elif test -f $gcc_cv_as_gas_srcdir/configure.in -a -f ../gas/Makefile; then - # Single tree build which includes gas. - for f in $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in - do -changequote(,)dnl - gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f` -changequote([,])dnl - if test x$gcc_cv_gas_version != x; then - break - fi - done -changequote(,)dnl - gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"` - gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"` -changequote([,])dnl - if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - # Gas version 2.6 and later support for .balign and .p2align. - # bytes to skip when using .p2align. - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_alignment_features=".balign and .p2align" - AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN) - fi - # Gas version 2.8 and later support specifying the maximum - # bytes to skip when using .p2align. - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_alignment_features=".p2align including maximum skip" - AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN) - fi - fi -elif test x$host = x$target; then - # Native build. - # Search the same directories that the installed compiler will - # search. Else we may find the wrong assembler and lose. If we - # do not find a suitable assembler binary, then try the user's - # path. - # - # Also note we have to check MD_EXEC_PREFIX before checking the - # user's path. Unfortunately, there is no good way to get at the - # value of MD_EXEC_PREFIX here. So we do a brute force search - # through all the known MD_EXEC_PREFIX values. Ugh. This needs - # to be fixed as part of the make/configure rewrite too. - - if test "x$exec_prefix" = xNONE; then - if test "x$prefix" = xNONE; then - test_prefix=/usr/local - else - test_prefix=$prefix - fi - else - test_prefix=$exec_prefix - fi - - # If the loop below does not find an assembler, then use whatever - # one we can find in the users's path. - # user's path. - as=as$host_exeext - - test_dirs="$test_prefix/lib/gcc-lib/$target/$gcc_version \ - $test_prefix/lib/gcc-lib/$target \ - /usr/lib/gcc/$target/$gcc_version \ - /usr/lib/gcc/$target \ - $test_prefix/$target/bin/$target/$gcc_version \ - $test_prefix/$target/bin \ - /usr/libexec \ - /usr/ccs/gcc \ - /usr/ccs/bin \ - /udk/usr/ccs/bin \ - /bsd43/usr/lib/cmplrs/cc \ - /usr/cross64/usr/bin \ - /usr/lib/cmplrs/cc \ - /sysv/usr/lib/cmplrs/cc \ - /svr4/usr/lib/cmplrs/cc \ - /usr/bin" - - for dir in $test_dirs; do - if test -f $dir/as$host_exeext; then - gcc_cv_as=$dir/as$host_exeext - break; - fi - done -fi -if test x$gcc_cv_as != x; then - # Check if we have .balign and .p2align - echo ".balign 4" > conftest.s - echo ".p2align 2" >> conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_alignment_features=".balign and .p2align" - AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN) - fi - rm -f conftest.s conftest.o - # Check if specifying the maximum bytes to skip when - # using .p2align is supported. - echo ".p2align 4,,7" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_alignment_features=".p2align including maximum skip" - AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN) - fi - rm -f conftest.s conftest.o -fi -AC_MSG_RESULT($gcc_cv_as_alignment_features) - -AC_MSG_CHECKING(assembler subsection support) -gcc_cv_as_subsections= -if test x$gcc_cv_as != x; then - # Check if we have .subsection - echo ".subsection 1" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_subsections=".subsection" - if test -x nm$host_exeext; then - gcc_cv_nm=./nm$host_exeext - elif test x$host = x$target; then - # Native build. - gcc_cv_nm=nm$host_exeext - fi - if test x$gcc_cv_nm != x; then - cat > conftest.s < /dev/null 2>&1; then - $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1 - $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2 - if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then - : - else - gcc_cv_as_subsections="working .subsection -1" - AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING) - fi - fi - fi - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 -fi -AC_MSG_RESULT($gcc_cv_as_subsections) - -AC_MSG_CHECKING(assembler instructions) -gcc_cv_as_instructions= -if test x$gcc_cv_as != x; then - set "filds fists" "filds mem; fists mem" - while test $# -gt 0 - do - echo "$2" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" " - AC_DEFINE_UNQUOTED(HAVE_GAS_`echo "$1" | tr '[a-z ]' '[A-Z_]'`) - fi - shift 2 - done - rm -f conftest.s conftest.o -fi -AC_MSG_RESULT($gcc_cv_as_instructions) - -# Figure out what language subdirectories are present. -# Look if the user specified --enable-languages="..."; if not, use -# the environment variable $LANGUAGES if defined. $LANGUAGES might -# go away some day. -if test x"${enable_languages+set}" != xset; then - if test x"${LANGUAGES+set}" = xset; then - enable_languages="`echo ${LANGUAGES} | tr ' ' ','`" - else - enable_languages=all - fi -fi -subdirs= -for lang in ${srcdir}/*/config-lang.in .. -do - case $lang in - ..) ;; - # The odd quoting in the next line works around - # an apparent bug in bash 1.12 on linux. -changequote(,)dnl - ${srcdir}/[*]/config-lang.in) ;; - *) - lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang` - if test "x$lang_alias" = x - then - echo "$lang doesn't set \$language." 1>&2 - exit 1 - fi - if test x"${enable_languages}" = xall; then - add_this_lang=yes - else - case "${enable_languages}" in - ${lang_alias} | "${lang_alias},"* | *",${lang_alias},"* | *",${lang_alias}" ) - add_this_lang=yes - ;; - * ) - add_this_lang=no - ;; - esac - fi - if test x"${add_this_lang}" = xyes; then - case $lang in - ${srcdir}/ada/config-lang.in) - if test x$gnat = xyes ; then - subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" - fi - ;; - *) - subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" - ;; - esac - fi - ;; -changequote([,])dnl - esac -done - -# Make gthr-default.h if we have a thread file. -gthread_flags= -if test $thread_file != single; then - rm -f gthr-default.h - echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h - gthread_flags=-DHAVE_GTHR_DEFAULT -fi -AC_SUBST(gthread_flags) - -# Make empty files to contain the specs and options for each language. -# Then add #include lines to for a compiler that has specs and/or options. - -lang_specs_files= -lang_options_files= -lang_tree_files= -rm -f specs.h options.h gencheck.h -touch specs.h options.h gencheck.h -for subdir in . $subdirs -do - if test -f $srcdir/$subdir/lang-specs.h; then - echo "#include \"$subdir/lang-specs.h\"" >>specs.h - lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h" - fi - if test -f $srcdir/$subdir/lang-options.h; then - echo "#include \"$subdir/lang-options.h\"" >>options.h - lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h" - fi - if test -f $srcdir/$subdir/$subdir-tree.def; then - echo "#include \"$subdir/$subdir-tree.def\"" >>gencheck.h - lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def" - fi -done - -# These (without "all_") are set in each config-lang.in. -# `language' must be a single word so is spelled singularly. -all_languages= -all_boot_languages= -all_compilers= -all_stagestuff= -all_diff_excludes= -all_outputs='Makefile intl/Makefile po/Makefile.in fixinc/Makefile' -# List of language makefile fragments. -all_lang_makefiles= -all_headers= -all_lib2funcs= - -# Add the language fragments. -# Languages are added via two mechanisms. Some information must be -# recorded in makefile variables, these are defined in config-lang.in. -# We accumulate them and plug them into the main Makefile. -# The other mechanism is a set of hooks for each of the main targets -# like `clean', `install', etc. - -language_fragments="Make-lang" -language_hooks="Make-hooks" -oldstyle_subdirs= - -for s in .. $subdirs -do - if test $s != ".." - then - language= - boot_language= - compilers= - stagestuff= - diff_excludes= - headers= - outputs= - lib2funcs= - . ${srcdir}/$s/config-lang.in - if test "x$language" = x - then - echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2 - exit 1 - fi - all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in ${srcdir}/$s/Makefile.in" - all_languages="$all_languages $language" - if test "x$boot_language" = xyes - then - all_boot_languages="$all_boot_languages $language" - fi - all_compilers="$all_compilers $compilers" - all_stagestuff="$all_stagestuff $stagestuff" - all_diff_excludes="$all_diff_excludes $diff_excludes" - all_headers="$all_headers $headers" - all_outputs="$all_outputs $outputs" - if test x$outputs = x - then - oldstyle_subdirs="$oldstyle_subdirs $s" - fi - all_lib2funcs="$all_lib2funcs $lib2funcs" - fi -done - -# Since we can't use `::' targets, we link each language in -# with a set of hooks, reached indirectly via lang.${target}. - -rm -f Make-hooks -touch Make-hooks -target_list="all.build all.cross start.encap rest.encap \ - info dvi \ - install-normal install-common install-info install-man \ - uninstall distdir \ - mostlyclean clean distclean extraclean maintainer-clean \ - stage1 stage2 stage3 stage4" -for t in $target_list -do - x= - for lang in .. $all_languages - do - if test $lang != ".."; then - x="$x $lang.$t" - fi - done - echo "lang.$t: $x" >> Make-hooks -done - -# If we're not building in srcdir, create .gdbinit. - -if test ! -f Makefile.in; then - echo "dir ." > .gdbinit - echo "dir ${srcdir}" >> .gdbinit - if test x$gdb_needs_out_file_path = xyes - then - echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit - fi - if test "x$subdirs" != x; then - for s in $subdirs - do - echo "dir ${srcdir}/$s" >> .gdbinit - done - fi - echo "source ${srcdir}/.gdbinit" >> .gdbinit -fi - -# Define variables host_canonical and build_canonical -# because some Cygnus local changes in the Makefile depend on them. -build_canonical=${build} -host_canonical=${host} -target_subdir= -if test "${host}" != "${target}" ; then - target_subdir=${target}/ -fi -AC_SUBST(build_canonical) -AC_SUBST(host_canonical) -AC_SUBST(target_subdir) - -# If this is using newlib, then define inhibit_libc in -# LIBGCC2_CFLAGS. This will cause __eprintf to be left out of -# libgcc.a, but that's OK because newib should have its own version of -# assert.h. -inhibit_libc= -if test x$with_newlib = xyes; then - inhibit_libc=-Dinhibit_libc -fi -AC_SUBST(inhibit_libc) - -# Override SCHED_OBJ and SCHED_CFLAGS to enable the Haifa scheduler. -sched_prefix= -sched_cflags= -if test x$enable_haifa = xyes; then - echo "Using the Haifa scheduler." - sched_prefix=haifa- - sched_cflags=-DHAIFA -fi -AC_SUBST(sched_prefix) -AC_SUBST(sched_cflags) -if test x$enable_haifa != x; then - # Explicitly remove files that need to be recompiled for the Haifa scheduler. - for x in genattrtab.o toplev.o *sched.o; do - if test -f $x; then - echo "Removing $x" - rm -f $x - fi - done -fi - -# If $(exec_prefix) exists and is not the same as $(prefix), then compute an -# absolute path for gcc_tooldir based on inserting the number of up-directory -# movements required to get from $(exec_prefix) to $(prefix) into the basic -# $(libsubdir)/@(unlibsubdir) based path. -# Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel -# make and thus we'd get different behavior depending on where we built the -# sources. -if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then - gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)' -else -changequote(<<, >>)dnl -# An explanation of the sed strings: -# -e 's|^\$(prefix)||' matches and eliminates 'prefix' from 'exec_prefix' -# -e 's|/$||' match a trailing forward slash and eliminates it -# -e 's|^[^/]|/|' forces the string to start with a forward slash (*) -# -e 's|/[^/]*|../|g' replaces each occurance of / with ../ -# -# (*) Note this pattern overwrites the first character of the string -# with a forward slash if one is not already present. This is not a -# problem because the exact names of the sub-directories concerned is -# unimportant, just the number of them matters. -# -# The practical upshot of these patterns is like this: -# -# prefix exec_prefix result -# ------ ----------- ------ -# /foo /foo/bar ../ -# /foo/ /foo/bar ../ -# /foo /foo/bar/ ../ -# /foo/ /foo/bar/ ../ -# /foo /foo/bar/ugg ../../ -# - dollar='$$' - gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_alias)" -changequote([, ])dnl -fi -AC_SUBST(gcc_tooldir) -AC_SUBST(dollar) - -# Nothing to do for FLOAT_H, float_format already handled. -objdir=`pwd` -AC_SUBST(objdir) - -# Process the language and host/target makefile fragments. -${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file" - -# Substitute configuration variables -AC_SUBST(subdirs) -AC_SUBST(all_boot_languages) -AC_SUBST(all_compilers) -AC_SUBST(all_diff_excludes) -AC_SUBST(all_headers) -AC_SUBST(all_lang_makefiles) -AC_SUBST(all_languages) -AC_SUBST(all_lib2funcs) -AC_SUBST(all_stagestuff) -AC_SUBST(build_exeext) -AC_SUBST(build_install_headers_dir) -AC_SUBST(build_xm_file_list) -AC_SUBST(cc_set_by_configure) -AC_SUBST(quoted_cc_set_by_configure) -AC_SUBST(cpp_install_dir) -AC_SUBST(cpp_main) -AC_SUBST(dep_host_xmake_file) -AC_SUBST(dep_tmake_file) -AC_SUBST(extra_c_flags) -AC_SUBST(extra_c_objs) -AC_SUBST(extra_cpp_objs) -AC_SUBST(extra_cxx_objs) -AC_SUBST(extra_headers_list) -AC_SUBST(extra_objs) -AC_SUBST(extra_parts) -AC_SUBST(extra_passes) -AC_SUBST(extra_programs) -AC_SUBST(fixinc_defs) -AC_SUBST(float_h_file) -AC_SUBST(gcc_gxx_include_dir) -AC_SUBST(gcc_version) -AC_SUBST(gcc_version_trigger) -AC_SUBST(host_exeext) -AC_SUBST(host_extra_gcc_objs) -AC_SUBST(host_xm_file_list) -AC_SUBST(install) -AC_SUBST(JAVAGC) -AC_SUBST(lang_options_files) -AC_SUBST(lang_specs_files) -AC_SUBST(lang_tree_files) -AC_SUBST(local_prefix) -AC_SUBST(maybe_use_collect2) -AC_SUBST(md_file) -AC_SUBST(objc_boehm_gc) -AC_SUBST(out_file) -AC_SUBST(out_object_file) -AC_SUBST(stage_prefix_set_by_configure) -AC_SUBST(symbolic_link) -AC_SUBST(thread_file) -AC_SUBST(tm_file_list) -AC_SUBST(will_use_collect2) - - -AC_SUBST_FILE(target_overrides) -AC_SUBST_FILE(host_overrides) -AC_SUBST(cross_defines) -AC_SUBST_FILE(cross_overrides) -AC_SUBST_FILE(build_overrides) -AC_SUBST_FILE(language_fragments) -AC_SUBST_FILE(language_hooks) - -# Echo that links are built -if test x$host = x$target -then - str1="native " -else - str1="cross-" - str2=" from $host" -fi - -if test x$host != x$build -then - str3=" on a $build system" -fi - -if test "x$str2" != x || test "x$str3" != x -then - str4= -fi - -echo "Links are now set up to build a ${str1}compiler for ${target}$str4" 1>&2 - -if test "x$str2" != x || test "x$str3" != x -then - echo " ${str2}${str3}." 1>&2 -fi - -# Truncate the target if necessary -if test x$host_truncate_target != x; then - target=`echo $target | sed -e 's/\(..............\).*/\1/'` -fi - -# Configure the subdirectories -# AC_CONFIG_SUBDIRS($subdirs) - -# Create the Makefile -# and configure language subdirectories -AC_OUTPUT($all_outputs, -[ -. $srcdir/configure.lang -case x$CONFIG_HEADERS in -xauto-host.h:config.in) -echo > cstamp-h ;; -esac -# If the host supports symlinks, point stage[1234] at ../stage[1234] so -# bootstrapping and the installation procedure can still use -# CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks, -# FLAGS_TO_PASS has been modified to solve the problem there. -# This is virtually a duplicate of what happens in configure.lang; we do -# an extra check to make sure this only happens if ln -s can be used. -if test "$symbolic_link" = "ln -s"; then - for d in .. ${subdirs} ; do - if test $d != ..; then - STARTDIR=`pwd` - cd $d - for t in stage1 stage2 stage3 stage4 include - do - rm -f $t - $symbolic_link ../$t $t 2>/dev/null - done - cd $STARTDIR - fi - done -else true ; fi -# Avoid having to add intl to our include paths. -if test -f intl/libintl.h; then - echo creating libintl.h - echo '#include "intl/libintl.h"' >libintl.h -fi -], -[ -host='${host}' -build='${build}' -target='${target}' -target_alias='${target_alias}' -srcdir='${srcdir}' -subdirs='${subdirs}' -oldstyle_subdirs='${oldstyle_subdirs}' -symbolic_link='${symbolic_link}' -program_transform_set='${program_transform_set}' -program_transform_name='${program_transform_name}' -dep_host_xmake_file='${dep_host_xmake_file}' -host_xmake_file='${host_xmake_file}' -dep_tmake_file='${dep_tmake_file}' -tmake_file='${tmake_file}' -thread_file='${thread_file}' -gcc_version='${gcc_version}' -gcc_version_trigger='${gcc_version_trigger}' -local_prefix='${local_prefix}' -build_install_headers_dir='${build_install_headers_dir}' -build_exeext='${build_exeext}' -host_exeext='${host_exeext}' -out_file='${out_file}' -gdb_needs_out_file_path='${gdb_needs_out_file_path}' -SET_MAKE='${SET_MAKE}' -target_list='${target_list}' -target_overrides='${target_overrides}' -host_overrides='${host_overrides}' -cross_defines='${cross_defines}' -cross_overrides='${cross_overrides}' -build_overrides='${build_overrides}' -cpp_install_dir='${cpp_install_dir}' -]) diff --git a/contrib/gcc/configure.lang b/contrib/gcc/configure.lang deleted file mode 100644 index d96b6d8d5314..000000000000 --- a/contrib/gcc/configure.lang +++ /dev/null @@ -1,233 +0,0 @@ -# configure.lang for GNU CC -# This script is run by configure for configuration of language -# subdirectories which conform to the old GCC configure mechanism -# for such subdirectories. - -# Copyright (C) 1997, 1998 Free Software Foundation, Inc. - -#This file is part of GNU CC. - -#GNU CC 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. - -#GNU CC 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. - -#You should have received a copy of the GNU General Public License -#along with GNU CC; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, -#Boston, MA 02111-1307, USA. - -savesrcdir=$srcdir - -for subdir in . $oldstyle_subdirs -do - # We only want to do this in language subdirs, but we have to handle - # the case of $oldstyle_subdirs = "". - if [ $subdir = . ] - then - continue - fi - - oldsrcdir=$savesrcdir - - # Re-adjust the path - case $oldsrcdir in - /*) - srcdir=$oldsrcdir/$subdir - ;; - *) - oldsrcdir=../${oldsrcdir} - srcdir=$oldsrcdir/$subdir - ;; - esac - mainsrcdir=$oldsrcdir - STARTDIR=`pwd` - test -d $subdir || mkdir $subdir - cd $subdir - - # Create Makefile.tem from Makefile.in. - # Make it set VPATH if necessary so that the sources are found. - # Also change its value of srcdir. - # Also create a .gdbinit file which runs the one in srcdir - # and tells GDB to look there for source files. - case $srcdir in - . | ./$subdir | .././$subdir) - rm -f Makefile.tem - cp Makefile.in Makefile.tem - chmod +w Makefile.tem - ;; - *) - rm -f Makefile.tem - echo "VPATH = ${srcdir}" \ - | cat - ${srcdir}/Makefile.in \ - | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.tem - rm -f .gdbinit - echo "dir ." > .gdbinit - echo "dir ${srcdir}" >> .gdbinit - echo "dir ${mainsrcdir}" >> .gdbinit - if [ x$gdb_needs_out_file_path = xyes ] - then - echo "dir ${mainsrcdir}/config/"`dirname ${out_file}` >> .gdbinit - fi - echo "source ${mainsrcdir}/.gdbinit" >> .gdbinit - ;; - esac - - # Conditionalize the makefile for this host machine. - rm -f Makefile.xx Makefile.ll - merged_frags= - for f in .. ${host_xmake_file} - do - if [ -f ${mainsrcdir}/config/$f ] - then - cat ${mainsrcdir}/config/$f >> Makefile.ll - if [ x"${merged_frags}" != x ] - then - merged_frags="${merged_frags} and " - fi - merged_frags="${merged_frags}${f}" - fi - done - if [ x"${merged_frags}" != x ] - then - sed -e "/####host/ r Makefile.ll" Makefile.tem > Makefile.xx - echo "Merged ${merged_frags}." - rm -f Makefile.tem - mv Makefile.xx Makefile.tem - rm -f Makefile.ll - fi - - # Add a definition for MAKE if system wants one. - case "$SET_MAKE" in - ?*) - rm -f Makefile.xx - (echo "$SET_MAKE"; cat Makefile.tem) >Makefile.xx - rm -f Makefile.tem - mv Makefile.xx Makefile.tem - esac - - # Add a definition for INSTALL if system wants one. - # This substitutes for lots of x-* files. - if [ x$build_broken_install = x ] - then true - else - rm -f Makefile.xx - abssrcdir=`cd ${srcdir}; pwd` - sed "s|^INSTALL = .*|${INSTALL}|" Makefile.tem > Makefile.xx - rm -f Makefile.tem - mv Makefile.xx Makefile.tem - fi - - # If using -program-transform-name, override the installation names. - if [ "x${program_transform_set}" = "xyes" ] ; then - sed -e "s/^program_transform_name[ ]*=.*$/program_transform_name = -$program_transform_name/" \ - -e "s/^program_transform_cross_name[ -]*=.*$/program_transform_cross_name = $program_transform_name/" \ - Makefile.tem > Makefile.xx - rm -f Makefile.tem - mv Makefile.xx Makefile.tem - fi - - # Conditionalize the makefile for this target machine. - rm -f Makefile.xx Makefile.ll - merged_frags= - for f in .. ${tmake_file} - do - if [ -f ${mainsrcdir}/config/$f ] - then - cat ${mainsrcdir}/config/$f >> Makefile.ll - if [ x"${merged_frags}" != x ] - then - merged_frags="${merged_frags} and " - fi - merged_frags="${merged_frags}$f" - fi - done - if [ x"${merged_frags}" != x ] - then - sed -e "/####target/ r Makefile.ll" Makefile.tem > Makefile.xx - echo "Merged ${merged_frags}." - rm -f Makefile.tem - mv Makefile.xx Makefile.tem - rm -f Makefile.ll - fi - - # If the host supports - # symlinks, point stage[123] at ../stage[123] so bootstrapping and the - # installation procedure can still use CC="stage1/xgcc -Bstage1/". - # If the host doesn't support symlinks, FLAGS_TO_PASS has been - # modified to solve the problem there. - for t in stage1 stage2 stage3 stage4 include - do - rm -f $t - $symbolic_link ../$t $t 2>/dev/null - done - - # Remove all formfeeds, since some Makes get confused by them. - # Also arrange to give the variables `target', `target_alias', - # `host_xmake_file', `tmake_file', `prefix', `local_prefix', - # `exec_prefix', `INSTALL_HEADERS_DIR', `exeext' - # values in the Makefile from the values they have in this script. - rm -f Makefile.xx - # Create an empty Makefile.sed first, to work around a Nextstep 3.3 bug. - echo 's| ||' > Makefile.sed - rm Makefile.sed - echo 's| ||' > Makefile.sed - echo "s|^target=.*$|target=${target}|" >> Makefile.sed - echo "s|^target_alias=.*$|target_alias=${target_alias}|" >> Makefile.sed - echo "s|^xmake_file=.*$|xmake_file=${dep_host_xmake_file}|" >> Makefile.sed - echo "s|^tmake_file=.*$|tmake_file=${dep_tmake_file}|" >> Makefile.sed - echo "s|^version=.*$|version=${version}|" >> Makefile.sed - echo "s|^GCC_THREAD_FILE=.*$|GCC_THREAD_FILE=${thread_file}|" >> Makefile.sed - echo "s|^prefix[ ]*=.*|prefix = $prefix|" >> Makefile.sed - echo "s|^local_prefix[ ]*=.*|local_prefix = $local_prefix|" >> Makefile.sed - echo "s|^exec_prefix[ ]*=.*|exec_prefix = $exec_prefix|" >> Makefile.sed - echo "s|^INSTALL_HEADERS_DIR[ ]*=.*$|INSTALL_HEADERS_DIR = ${build_install_headers_dir}|" >> Makefile.sed - echo "s|^exeext[ ]*=.*$|exeext = ${build_exeext}|" >> Makefile.sed - sed -f Makefile.sed Makefile.tem > Makefile.xx - rm -f Makefile.tem Makefile.sed - mv Makefile.xx Makefile.tem - - # Install Makefile for real, after making final changes. - # Define macro CROSS_COMPILE in compilation - # if this is a cross-compiler. - # Also use all.cross instead of all.internal - # and add cross-make to Makefile. - if [ x$host != x$target ] - then - rm -f Makefile.xx - echo "CROSS=-DCROSS_COMPILE" > Makefile.xx - sed -e "/####cross/ r ${mainsrcdir}/cross-make" Makefile.tem >> Makefile.xx - rm -f Makefile.tem - mv Makefile.xx Makefile.tem - fi - - # When building gcc with a cross-compiler, we need to fix a few things. - # This must come after cross-make as we want all.build to override - # all.cross. - if [ x$build != x$host ] - then - rm -f Makefile.xx - echo "build= $build" > Makefile.xx - echo "host= $host" >> Makefile.xx - sed -e "s|objc-runtime$||" \ - -e "/####build/ r ${mainsrcdir}/build-make" Makefile.tem >> Makefile.xx - rm -f Makefile.tem - mv Makefile.xx Makefile.tem - fi - - rm -f Makefile - mv Makefile.tem Makefile - echo "Created \`$subdir/Makefile'." - - cd $STARTDIR -done # end of current-dir SUBDIRS loop - -# Restore this, remember we're invoked with `.'. -srcdir=$savesrcdir diff --git a/contrib/gcc/convert.c b/contrib/gcc/convert.c deleted file mode 100644 index bfcb5db44704..000000000000 --- a/contrib/gcc/convert.c +++ /dev/null @@ -1,444 +0,0 @@ -/* Utility routines for data type conversion for GNU C. - Copyright (C) 1987, 88, 91-95, 97, 1998 Free Software Foundation, Inc. - -This file is part of GNU C. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* These routines are somewhat language-independent utility function - intended to be called by the language-specific convert () functions. */ - -#include "config.h" -#include "tree.h" -#include "flags.h" -#include "convert.h" -#include "toplev.h" - -/* Convert EXPR to some pointer or reference type TYPE. - - EXPR must be pointer, reference, integer, enumeral, or literal zero; - in other cases error is called. */ - -tree -convert_to_pointer (type, expr) - tree type, expr; -{ - if (integer_zerop (expr)) - { - expr = build_int_2 (0, 0); - TREE_TYPE (expr) = type; - return expr; - } - - switch (TREE_CODE (TREE_TYPE (expr))) - { - case POINTER_TYPE: - case REFERENCE_TYPE: - return build1 (NOP_EXPR, type, expr); - - case INTEGER_TYPE: - case ENUMERAL_TYPE: - case BOOLEAN_TYPE: - case CHAR_TYPE: - if (TYPE_PRECISION (TREE_TYPE (expr)) == POINTER_SIZE) - return build1 (CONVERT_EXPR, type, expr); - - return - convert_to_pointer (type, - convert (type_for_size (POINTER_SIZE, 0), expr)); - - default: - error ("cannot convert to a pointer type"); - return convert_to_pointer (type, integer_zero_node); - } -} - -/* Convert EXPR to some floating-point type TYPE. - - EXPR must be float, integer, or enumeral; - in other cases error is called. */ - -tree -convert_to_real (type, expr) - tree type, expr; -{ - switch (TREE_CODE (TREE_TYPE (expr))) - { - case REAL_TYPE: - return build1 (flag_float_store ? CONVERT_EXPR : NOP_EXPR, - type, expr); - - case INTEGER_TYPE: - case ENUMERAL_TYPE: - case BOOLEAN_TYPE: - case CHAR_TYPE: - return build1 (FLOAT_EXPR, type, expr); - - case COMPLEX_TYPE: - return convert (type, - fold (build1 (REALPART_EXPR, - TREE_TYPE (TREE_TYPE (expr)), expr))); - - case POINTER_TYPE: - case REFERENCE_TYPE: - error ("pointer value used where a floating point value was expected"); - return convert_to_real (type, integer_zero_node); - - default: - error ("aggregate value used where a float was expected"); - return convert_to_real (type, integer_zero_node); - } -} - -/* Convert EXPR to some integer (or enum) type TYPE. - - EXPR must be pointer, integer, discrete (enum, char, or bool), or float; - in other cases error is called. - - The result of this is always supposed to be a newly created tree node - not in use in any existing structure. */ - -tree -convert_to_integer (type, expr) - tree type, expr; -{ - enum tree_code ex_form = TREE_CODE (expr); - tree intype = TREE_TYPE (expr); - int inprec = TYPE_PRECISION (intype); - int outprec = TYPE_PRECISION (type); - - /* An INTEGER_TYPE cannot be incomplete, but an ENUMERAL_TYPE can - be. Consider `enum E = { a, b = (enum E) 3 };'. */ - if (!TYPE_SIZE (type)) - { - error ("conversion to incomplete type"); - return error_mark_node; - } - - switch (TREE_CODE (intype)) - { - case POINTER_TYPE: - case REFERENCE_TYPE: - if (integer_zerop (expr)) - expr = integer_zero_node; - else - expr = fold (build1 (CONVERT_EXPR, - type_for_size (POINTER_SIZE, 0), expr)); - - return convert_to_integer (type, expr); - - case INTEGER_TYPE: - case ENUMERAL_TYPE: - case BOOLEAN_TYPE: - case CHAR_TYPE: - /* If this is a logical operation, which just returns 0 or 1, we can - change the type of the expression. For some logical operations, - we must also change the types of the operands to maintain type - correctness. */ - - if (TREE_CODE_CLASS (ex_form) == '<') - { - TREE_TYPE (expr) = type; - return expr; - } - - else if (ex_form == TRUTH_AND_EXPR || ex_form == TRUTH_ANDIF_EXPR - || ex_form == TRUTH_OR_EXPR || ex_form == TRUTH_ORIF_EXPR - || ex_form == TRUTH_XOR_EXPR) - { - TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0)); - TREE_OPERAND (expr, 1) = convert (type, TREE_OPERAND (expr, 1)); - TREE_TYPE (expr) = type; - return expr; - } - - else if (ex_form == TRUTH_NOT_EXPR) - { - TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0)); - TREE_TYPE (expr) = type; - return expr; - } - - /* If we are widening the type, put in an explicit conversion. - Similarly if we are not changing the width. After this, we know - we are truncating EXPR. */ - - else if (outprec >= inprec) - return build1 (NOP_EXPR, type, expr); - - /* If TYPE is an enumeral type or a type with a precision less - than the number of bits in its mode, do the conversion to the - type corresponding to its mode, then do a nop conversion - to TYPE. */ - else if (TREE_CODE (type) == ENUMERAL_TYPE - || outprec != GET_MODE_BITSIZE (TYPE_MODE (type))) - return build1 (NOP_EXPR, type, - convert (type_for_mode (TYPE_MODE (type), - TREE_UNSIGNED (type)), - expr)); - - /* Here detect when we can distribute the truncation down past some - arithmetic. For example, if adding two longs and converting to an - int, we can equally well convert both to ints and then add. - For the operations handled here, such truncation distribution - is always safe. - It is desirable in these cases: - 1) when truncating down to full-word from a larger size - 2) when truncating takes no work. - 3) when at least one operand of the arithmetic has been extended - (as by C's default conversions). In this case we need two conversions - if we do the arithmetic as already requested, so we might as well - truncate both and then combine. Perhaps that way we need only one. - - Note that in general we cannot do the arithmetic in a type - shorter than the desired result of conversion, even if the operands - are both extended from a shorter type, because they might overflow - if combined in that type. The exceptions to this--the times when - two narrow values can be combined in their narrow type even to - make a wider result--are handled by "shorten" in build_binary_op. */ - - switch (ex_form) - { - case RSHIFT_EXPR: - /* We can pass truncation down through right shifting - when the shift count is a nonpositive constant. */ - if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST - && tree_int_cst_lt (TREE_OPERAND (expr, 1), - convert (TREE_TYPE (TREE_OPERAND (expr, 1)), - integer_one_node))) - goto trunc1; - break; - - case LSHIFT_EXPR: - /* We can pass truncation down through left shifting - when the shift count is a nonnegative constant. */ - if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST - && tree_int_cst_sgn (TREE_OPERAND (expr, 1)) >= 0 - && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST) - { - /* If shift count is less than the width of the truncated type, - really shift. */ - if (tree_int_cst_lt (TREE_OPERAND (expr, 1), TYPE_SIZE (type))) - /* In this case, shifting is like multiplication. */ - goto trunc1; - else - { - /* If it is >= that width, result is zero. - Handling this with trunc1 would give the wrong result: - (int) ((long long) a << 32) is well defined (as 0) - but (int) a << 32 is undefined and would get a - warning. */ - - tree t = convert_to_integer (type, integer_zero_node); - - /* If the original expression had side-effects, we must - preserve it. */ - if (TREE_SIDE_EFFECTS (expr)) - return build (COMPOUND_EXPR, type, expr, t); - else - return t; - } - } - break; - - case MAX_EXPR: - case MIN_EXPR: - case MULT_EXPR: - { - tree arg0 = get_unwidened (TREE_OPERAND (expr, 0), type); - tree arg1 = get_unwidened (TREE_OPERAND (expr, 1), type); - - /* Don't distribute unless the output precision is at least as big - as the actual inputs. Otherwise, the comparison of the - truncated values will be wrong. */ - if (outprec >= TYPE_PRECISION (TREE_TYPE (arg0)) - && outprec >= TYPE_PRECISION (TREE_TYPE (arg1)) - /* If signedness of arg0 and arg1 don't match, - we can't necessarily find a type to compare them in. */ - && (TREE_UNSIGNED (TREE_TYPE (arg0)) - == TREE_UNSIGNED (TREE_TYPE (arg1)))) - goto trunc1; - break; - } - - case PLUS_EXPR: - case MINUS_EXPR: - case BIT_AND_EXPR: - case BIT_IOR_EXPR: - case BIT_XOR_EXPR: - case BIT_ANDTC_EXPR: - trunc1: - { - tree arg0 = get_unwidened (TREE_OPERAND (expr, 0), type); - tree arg1 = get_unwidened (TREE_OPERAND (expr, 1), type); - - if (outprec >= BITS_PER_WORD - || TRULY_NOOP_TRUNCATION (outprec, inprec) - || inprec > TYPE_PRECISION (TREE_TYPE (arg0)) - || inprec > TYPE_PRECISION (TREE_TYPE (arg1))) - { - /* Do the arithmetic in type TYPEX, - then convert result to TYPE. */ - register tree typex = type; - - /* Can't do arithmetic in enumeral types - so use an integer type that will hold the values. */ - if (TREE_CODE (typex) == ENUMERAL_TYPE) - typex = type_for_size (TYPE_PRECISION (typex), - TREE_UNSIGNED (typex)); - - /* But now perhaps TYPEX is as wide as INPREC. - In that case, do nothing special here. - (Otherwise would recurse infinitely in convert. */ - if (TYPE_PRECISION (typex) != inprec) - { - /* Don't do unsigned arithmetic where signed was wanted, - or vice versa. - Exception: if either of the original operands were - unsigned then can safely do the work as unsigned. - And we may need to do it as unsigned - if we truncate to the original size. */ - typex = ((TREE_UNSIGNED (TREE_TYPE (expr)) - || TREE_UNSIGNED (TREE_TYPE (arg0)) - || TREE_UNSIGNED (TREE_TYPE (arg1))) - ? unsigned_type (typex) : signed_type (typex)); - return convert (type, - fold (build (ex_form, typex, - convert (typex, arg0), - convert (typex, arg1), - 0))); - } - } - } - break; - - case NEGATE_EXPR: - case BIT_NOT_EXPR: - /* This is not correct for ABS_EXPR, - since we must test the sign before truncation. */ - { - register tree typex = type; - - /* Can't do arithmetic in enumeral types - so use an integer type that will hold the values. */ - if (TREE_CODE (typex) == ENUMERAL_TYPE) - typex = type_for_size (TYPE_PRECISION (typex), - TREE_UNSIGNED (typex)); - - /* But now perhaps TYPEX is as wide as INPREC. - In that case, do nothing special here. - (Otherwise would recurse infinitely in convert. */ - if (TYPE_PRECISION (typex) != inprec) - { - /* Don't do unsigned arithmetic where signed was wanted, - or vice versa. */ - typex = (TREE_UNSIGNED (TREE_TYPE (expr)) - ? unsigned_type (typex) : signed_type (typex)); - return convert (type, - fold (build1 (ex_form, typex, - convert (typex, - TREE_OPERAND (expr, 0))))); - } - } - - case NOP_EXPR: - /* If truncating after truncating, might as well do all at once. - If truncating after extending, we may get rid of wasted work. */ - return convert (type, get_unwidened (TREE_OPERAND (expr, 0), type)); - - case COND_EXPR: - /* It is sometimes worthwhile to push the narrowing down through - the conditional and never loses. */ - return fold (build (COND_EXPR, type, TREE_OPERAND (expr, 0), - convert (type, TREE_OPERAND (expr, 1)), - convert (type, TREE_OPERAND (expr, 2)))); - - default: - break; - } - - return build1 (NOP_EXPR, type, expr); - - case REAL_TYPE: - return build1 (FIX_TRUNC_EXPR, type, expr); - - case COMPLEX_TYPE: - return convert (type, - fold (build1 (REALPART_EXPR, - TREE_TYPE (TREE_TYPE (expr)), expr))); - - default: - error ("aggregate value used where an integer was expected"); - return convert (type, integer_zero_node); - } -} - -/* Convert EXPR to the complex type TYPE in the usual ways. */ - -tree -convert_to_complex (type, expr) - tree type, expr; -{ - tree subtype = TREE_TYPE (type); - - switch (TREE_CODE (TREE_TYPE (expr))) - { - case REAL_TYPE: - case INTEGER_TYPE: - case ENUMERAL_TYPE: - case BOOLEAN_TYPE: - case CHAR_TYPE: - return build (COMPLEX_EXPR, type, convert (subtype, expr), - convert (subtype, integer_zero_node)); - - case COMPLEX_TYPE: - { - tree elt_type = TREE_TYPE (TREE_TYPE (expr)); - - if (TYPE_MAIN_VARIANT (elt_type) == TYPE_MAIN_VARIANT (subtype)) - return expr; - else if (TREE_CODE (expr) == COMPLEX_EXPR) - return fold (build (COMPLEX_EXPR, - type, - convert (subtype, TREE_OPERAND (expr, 0)), - convert (subtype, TREE_OPERAND (expr, 1)))); - else - { - expr = save_expr (expr); - return - fold (build (COMPLEX_EXPR, - type, convert (subtype, - fold (build1 (REALPART_EXPR, - TREE_TYPE (TREE_TYPE (expr)), - expr))), - convert (subtype, - fold (build1 (IMAGPART_EXPR, - TREE_TYPE (TREE_TYPE (expr)), - expr))))); - } - } - - case POINTER_TYPE: - case REFERENCE_TYPE: - error ("pointer value used where a complex was expected"); - return convert_to_complex (type, integer_zero_node); - - default: - error ("aggregate value used where a complex was expected"); - return convert_to_complex (type, integer_zero_node); - } -} diff --git a/contrib/gcc/convert.h b/contrib/gcc/convert.h deleted file mode 100644 index 4123874fbb32..000000000000 --- a/contrib/gcc/convert.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Definition of functions in convert.c. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -extern tree convert_to_integer PROTO ((tree, tree)); -extern tree convert_to_pointer PROTO ((tree, tree)); -extern tree convert_to_real PROTO ((tree, tree)); -extern tree convert_to_complex PROTO ((tree, tree)); diff --git a/contrib/gcc/cp/ChangeLog b/contrib/gcc/cp/ChangeLog deleted file mode 100644 index 3f005333b881..000000000000 --- a/contrib/gcc/cp/ChangeLog +++ /dev/null @@ -1,16207 +0,0 @@ -2000-03-08 Nathan Sidwell - - * exception.cc (__cp_pop_exception): Cleanup the original object. - -1999-11-13 Jason Merrill - - * rtti.c (get_tinfo_fn_unused): Split out from get_tinfo_fn. - * class.c (set_rtti_entry): Use it. - -Wed Apr 12 00:45:49 2000 Jeffrey A Law (law@cygnus.com) - - 2000-02-03 - * call.c (add_function_candidate): Do not add vlist ctor into - candidates in compatibility mode. - (build_user_type_conversion_1): Add LOOKUP_HAS_VLIST when adding - vlist. - (convert_like): Likewise. - (build_over_call): Skip vlist only if it is mentioned in flags. - (build_new_method_call): Do not add vlist in compatibility mode, - except for dtors. - * cp-tree.h (flag_vtable_thunks): Has now four possible values. - (DECL_VLIST_CTOR_WRAPPER_P, DECL_VLIST_CTOR_WRAPPED): New macros. - (in_charge_identifier): Declare external. - * decl.c (xref_basetypes): Check for vtable_thunks >=2. - (finish_dtor): Use bit 2 of in_chrg. - (finish_function): Do not finish vlist ctor wrappers. - * decl2.c (flag_vtable_thunks_compat): New variable. - (lang_decode_option): Set it accordingly. - (maybe_retrofit_in_chrg): Call make_vlist_ctor_wrapper. - * init.c (build_base_dtor_call): Pass 4 in in_chrg. - (no_vlist_base_init): New function. - (expand_default_init): Do not pass vlist in compatibility mode. - Try to call old base ctor if new one was not generated. - (build_new_1): Do not pass vlist in compatibility mode. - * method.c (get_id_2): Do not put _Vlist into dtor name in - compatibility mode. - (make_vlist_ctor_wrapper, emit_vlist_ctor_wrapper): New functions. - (synthesize_method): Call emit_vlist_ctor_wrapper. - * pt.c (instantiate_class_template): Check for vtable_thunks >=2. - - Sat Nov 13 15:48:59 1999 H.J. Lu - * init.c (finish_dtor): Call mark_all_temps_used () before - declaring vlist. - - Tue Nov 9 15:01:57 1999 H.J. Lu - * init.c (construct_virtual_bases): Update. - (expand_cleanup_for_base): Update. - - Tue Nov 9 08:25:04 1999 H.J. Lu - * init.c (construct_virtual_bases): Update. - (expand_cleanup_for_base): Take vlist parameter. - (emit_base_init): Pass vlist to expand_cleanup_for_base. - (construct_virtual_bases): Likewise. - - 1999-05-02 Martin von Löwis - * class.c (prepare_ctor_vtable, finish_one_ctor_vtable, - prepend_ctor_vfields_for_vbase, finish_ctor_vtables_for_vbases, - finish_ctor_vtables_1, prepend_vbase_vfields, - finish_ctor_vtables): New functions. - (finish_struct_1): Call finish_ctor_vtables. - * cp-tree.h (TYPE_USES_PVBASES): New macro. - (constructor_for_vbase_attr): Widen to two bits. - (CONSTRUCTOR_FOR_VBASE, CONSTRUCTOR_FOR_PVBASE, - DESTRUCTOR_FOR_PVBASE): New macros. - (DECL_CONSTRUCTOR_FOR_VBASE_P): Adopt to new enumeration. - (DECL_CONSTRUCTOR_FOR_VBASE): New macro. - (DECL_CONSTRUCTOR_FOR_PVBASE_P, DECL_DESTRUCTOR_FOR_PVBASE_P): New - macros. - (vlist_identifier, vlist_type_node, vlist_zero_node): Declare. - (VCTABLE_NAME, VLIST_NAME_FORMAT, VLIST_NAME, VLIST1_NAME, - VLIST_TYPE_NAME): New macros. - (LOOKUP_HAS_VLIST): New macro. - (build_base_dtor_call, init_vlist): Declare. - (build_destructor_name): Add int argument. - * decl.c (vlist_identifier, vlist_type_node, vlist_zero_node): - Define. - (init_decl_processing): Initialize them. - (grokdeclarator): Handle vlist argument. - (copy_args_p): Likewise. - (grok_ctor_properties): Don't try to skip initial int for - templates. Skip vlist if available. - (xref_basetypes): Set TYPE_USES_PVBASES. - (finish_dtor, finish_ctor): New functions, moved out of ... - (finish_function): ... here. - * decl2.c (lang_decode_option): Set flag_vtable_thunks explicitly. - (maybe_retrofit_in_chrg): Retrofit __vlist parameter. - (grokclassfn): Pass pvbase flag into mangled name. - * init.c (build_base_dtor_call): New function. - (build_partial_cleanup_for): Call it. - (pvbasecount, init_vlist, ): New functions. - (emit_base_init): Process vlist argument. - (expand_aggr_vbase_init_1): Likewise. - (expand_aggr_vbase_init): Likewise. - (expand_default_init): Likewise. - (build_new_1): Pass null vlist argument. - (build_delete): Likewise. Call build_base_dtor_call. - * method.c (process_overload_item): Mangle _Vlist specially. - (build_base_path, get_vlist_vtable_id): New functions. - (build_destructor_name): Potentially mangle _Vlist into it. - (do_build_copy_constructor): Skip vlist argument. - (synthesize_method): Likewise. - * pt.c (has_pvbases_p): New function. - (instantiate_class_template): Call it. - (tsubst_decl): Retrofit before mangling. Pass pvbase_p to - destructor mangling. - * search.c (expand_direct_vtbls_init_thunks): New function. - (expand_indirect_vtbls_init_thunks): New function. - (expand_indirect_vtbls_init): Call it. - * call.c (add_function_candidate): Process vlist argument. - (build_user_type_conversion_1): Add vlist argument. - (convert_like): Likewise. - (build_over_call): Likewise. - (build_new_method_call): Likewise. - -2000-02-18 Martin von Loewis - - * typeck2.c (my_friendly_abort): Use GCCBUGURL. - -1999-11-01 Jason Merrill - - * decl2.c (maybe_make_one_only): Always make things comdat on - ELF targets, too. - -Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.2 Released. - -1999-09-06 Mark Mitchell - - * pt.c (tsubst): Back out 1999-08-06 patch. Use fold and - decl_constant_value to simplify array bounds. - -1999-08-19 Jason Merrill - - * cp-tree.h: Declare flag_use_repository. - * pt.c (do_decl_instantiation): Don't complain about duplicate - instantiation with -frepo. - (do_type_instantiation): Likewise. - -1999-08-14 Jason Merrill - - * decl2.c (lookup_arg_dependent): Note that we've already checked - the current namespace. - -Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95.1 Released. - -1999-08-12 Mark Mitchell - - * decl2.c (lang_decode_option): Deprecate signatures. - -1999-08-11 Martin v. Loewis - - * lex.c (do_identifier): If we find a hidden type after a global - was selected already, continue using the global. - -1999-08-10 Martin v. Loewis - - * decl2.c (set_decl_namespace): Do not complain about non-matching - decls if processing a template. - -1999-08-09 Jason Merrill - - * parse.y (function_try_block): Call end_protect_partials - before expand_start_all_catch. - -1999-08-06 Jason Merrill - - * pt.c (maybe_get_template_decl_from_type_decl): Make sure that - we're looking at a class. - - * decl.c (lookup_name_real): Set the complain flag if we're - looking for a namespace member. - - * decl.c (pushdecl): Only give an error for shadowing a parm - from *this* function. - - * decl2.c (build_expr_from_tree, case METHOD_CALL_EXPR): Only - build_expr_from_tree on the args of a TEMPLATE_ID_EXPR. - - * class.c (mark_overriders): Fix order of args to overrides. - (warn_hidden): Likewise. Fix for having virtual and non-virtual - functions with the same name. - - * cp-tree.h (DECL_VIRTUAL_CONTEXT): New macro. - * typeck.c (expand_ptrmemfunc_cst): Calculate delta correctly for - virtual functions and MI. Simplify. - - * typeck.c (c_expand_return): Downgrade pedwarn about returning NULL - from op new to warning. - - * decl2.c (reparse_absdcl_as_casts): Don't warn about old-style - casts in system headers or extern "C" blocks. - - * pt.c (do_decl_instantiation): Downgrade duplicate instantiation - errors to pedwarn. - - * error.c (dump_type_real): Handle TREE_LIST again. - - * typeck.c (comp_target_parms): Don't complain about - converting from () to (...) if !flag_strict_prototype. - - * class.c (instantiate_type): Downgrade errors for object-dependent - memfn refs to pedwarn. - -1999-08-06 Alexandre Oliva - - * pt.c (tsubst): Use build_index_type to build in-template array - index type. Fixes g++.oliva/dwarf1.C. - * decl.c (grokdeclarator): Likewise, just for consistency, as it - doesn't seem to trigger the bug without it. - -Thu Aug 5 02:40:42 1999 Jeffrey A Law (law@cygnus.com) - - * typeck2.c: Update URLs and mail addresses. - -1999-08-03 Mumit Khan - - * decl.c (start_decl): Set attributes before duplicate_decls call. - -Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com) - - * gcc-2.95 Released. - -Sun Jul 25 15:24:21 1999 Jeffrey A Law (law@cygnus.com) - - * g++FAQ.texi: Deleted per Joe Buck's request. - * Makefile.in: Corresponding changes. - -Sat Jul 17 23:50:47 1999 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (INTERFACE): Bump to 2. - -1999-07-17 Alexandre Oliva - - * typeck2.c (my_friendly_abort): Updated URL with bug reporting - instructions to gcc.gnu.org. Removed e-mail address. - -1999-07-15 Mark Mitchell - - * pt.c (check_default_tmpl_args): Handle friends defined in the - class just like member functions defined in the class. - -Thu Jul 15 01:26:49 1999 H.J. Lu - - * decl.c (duplicate_decls): Relax restriction for exception - checks on duplicate symbols. - -1999-07-07 Jason Merrill - - * decl.c (grokdeclarator): Update the names of all variants when - de-anonymizing. - -Wed Jul 7 01:26:47 1999 Alexandre Oliva - - * decl2.c (mark_vtable_entries): Fix check for rtti offset. - -1999-06-26 Richard Henderson - - * decl.c (cp_finish_decl): Fix typo in cp_warning_at call. - -1999-06-21 Mark Mitchell - - * init.c (expand_aggr_vbase_init): Rename to - construct_virtual_bases. Conditionalize construction here, - rather than ... - (emit_base_init): Here. - -1999-06-19 Mark Mitchell - - * semantics.c (finish_asm_statement): Apply decay conversions to - input operands. - - * decl.c (expand_static_init): When building an anonymous function - for use with atexit, compute its body before and after entering - the function. - -1999-06-18 Mark Mitchell - - * init.c (expand_aggr_vbase_init): Add flag parameter. - (build_partial_cleanup_for): Remove, inlining into .. - (expand_cleanup_for_base): ... here. Take flag parameter. - (emit_base_init): Pass the in_chrg parameter to - emit_aggr_vbase_init. - (emit_aggr_vbase_init): Pass it to expand_cleanup_for_base. - -1999-06-16 Mark Mitchell - - * decl2.c (import_export_decl): Use same_type_p, rather than - relying on pointer-equality for types. - - * method.c (do_build_copy_constructor): Simplify. - - * call.c (build_method_call): Remove bogus code for two-argument - delete. - * init.c (build_new_1): Expand on comment, and remove dead code. - - * init.c (expand_cleanup_for_base): New function, split out - from ... - (emit_base_init): Here. - (expand_aggr_vbase_init): Use it. - -1999-06-15 Mark Mitchell - - * cp-tree.h (class_cache_firstobj): Declare. - (maybe_push_cache_obstack): Rename to push_cache_obstack. - * class.c (permanent_obstack): Remove declaration. - (class_cache_firstobj): Make it global. - (add_method): Don't use permanent_obstack directly. - (pushclass): Only free the class_cache_obstack if we know how far - back to free it. - (maybe_push_cache_obstack): Rename to push_cache_obstack. - * decl.c: Remove dead comment. - (saved_scope): Add class_cache_firstobj. - (push_to_top_level): Save it. - (pop_from_top_level): Restore it. - (push_class_level_binding): Use push_cache_obstack, not - maybe_push_cache_obstack. - * search.c (push_class_decls): Likewise. - -1999-06-14 Nathan Sidwell - - * call.c (build_new_op): Remove REF_BIND from all operands. - -1999-06-07 Mark Mitchell - - * search.c (convert_pointer_to_single_level): Reimplement without - using get_binfo. - -1999-06-06 Mark Mitchell - - * method.c (is_back_referenceable_type): Back-reference bools when - not squangling. - -1999-06-04 Jason Merrill - - * semantics.c (finish_if_stmt_cond): Copy cond to permanent_obstack. - (finish_while_stmt_cond, finish_do_stmt, finish_for_cond): Likewise. - -1999-05-30 Mark Mitchell - - * lex.c (make_lang_type): Create TYPE_BINFO for - TEMPLATE_TYPE_PARMs just like for non-template types. - -1999-05-28 Nathan Sidwell - - * decl.c (complete_array_type): Allocate off same obstack. Fix - DO_DEFAULT comment to match reality. - -1999-05-22 Mark Mitchell - - * tree.c (mapcar): Handle NON_LVALUE_EXPR. - -1999-05-21 Mark Mitchell - - * typeck.c (build_ptrmemfunc): Handle PTRMEM_CSTs carefully to - reveal optimization opportunities. - -1999-05-20 Mark Mitchell - - * decl.c (grokdeclarator): Don't treat [] as indicating a - zero-sized array in a typedef. - - * call.c (build_object_call): Don't look at DECL_NAME for a type. - (pt.c): Or CP_TYPE_QUALS for an ERROR_MARK. - (typeck.c): Or TYPE_MAIN_VARIANT for a type. - -1999-05-20 Jason Merrill - - * tree.c (lvalue_p_1): A NOP_EXPR can be an lvalue. - (build_cplus_new): Make sure that what we return is of the right type. - -1999-05-20 Mark Mitchell - - * cp-tree.h (make_ptrmem_cst): New function. - * expr.c (cplus_expand_constant): Split out from ... - (cplus_expand_expr): Here. Use cplus_expand_constant. - (init_cplus_expand): Set lang_expand_constant. - * pt.c (convert_nontype_argument): Use make_ptrmem_cst. - * tree.c (make_ptrmem_cst): Define. - * typeck.c (unary_complex_lvalue): Use make_ptrmem_cst. - * typeck2.c (initializer_constant_valid_p): Use make_ptrmem_cst. - -1999-05-19 Mark Mitchell - - * decl2.c (start_static_storage_duration_function): Fix comment. - (finish_file): Create static storage duration functions lazily. - -Wed May 19 02:50:53 1999 Arvind Sankar - - * gxxint.texi: Fix typo. - -1999-05-18 Jason Merrill - - * call.c (joust): Compare the types of the conv ops, not the - target types of the conversions. - -Tue May 18 00:21:34 1999 Zack Weinberg - - * lang-specs.h: Define __GNUC__ and __GNUC_MINOR__ only if -no-gcc - was not given. - -1999-05-17 Mark Mitchell - - * cp-tree.def (TEMPLATE_ID_EXPR): Update documentation. - * decl.c (grokfndecl): Don't allow inline declarations of friend - template specializations, or friend template specializations with - default arguments. - * pt.c (tsubst): Handle substitution into array types that does - not yield a fixed upper bound, even when not processing a - template. - (tsubst_copy): Deal with the fact that the second operand to a - TEMPLATE_ID_EXPR may be NULL_TREE, a TREE_LIST, or a TREE_VEC. - * search.c (marked_pushdecls_p): Don't descend into - TEMPLATE_TYPE_PARMs and the like. - (unmarked_pushdecls_p): Likewise. - - * call.c (build_over_call): Don't throw away - initializations/copies of empty classes; use MODIFY_EXPR and - INIT_EXPR as for non-empty classes. - * class.c (finish_struct_1): Put the padding byte for an empty - class on the TYPE_NONCOPIED_PARTS list for the class. - -1999-05-16 Mark Mitchell - - * decl2.c (build_expr_from_tree): Handle COMPONENT_REFs that - indicate a reference to a field that is a qualified name. - -1999-05-16 Jason Merrill - - * decl2.c (finish_objects): Don't use .?tors.* if we don't have - ASM_OUTPUT_CONSTRUCTOR. - - * friend.c (do_friend): Add attrlist arg. Remove support for - getting a non-decl as 'decl'. - * decl.c (grokfndecl): Remove attrlist arg. Don't set attrs or - rtl. - (grokdeclarator): Adjust. - * cp-tree.h: Adjust. - -1999-05-16 Mark Mitchell - - * cp-tree.h (permanent_p): New function. - * init.c (build_new_1): Use mapcar, not copy_node, to copy a - possibly complex tree node. - * tree.c (mapcar): Adjust comments, and follow coding standards in - conditional. - (permanent_p): New function. - -1999-05-13 Per Bothner - - * class.c (push_lang_context): Turn off DECL_IGNORED_P for - primitive Java types, if we actually see `extern "Java"'. - -1999-05-10 18:21 -0400 Zack Weinberg - - * lang-specs.h: Pass -$ to the preprocessor. - -1999-05-10 Jason Merrill - - * init.c (build_offset_ref): Wrap baselinks in OFFSET_REF, too. - Don't bother wrapping an OFFSET_TYPE around unknown_type_node. - (resolve_offset_ref): Don't handle a raw baselink. - * cvt.c (build_expr_type_conversion): Likewise. - * typeck.c (decay_conversion, build_c_cast, convert_for_assignment, - convert_for_initialization): Likewise. - * class.c (instantiate_type): Handle seeing a baselink under an - OFFSET_REF. - * error.c (dump_expr): Likewise. - * pt.c (for_each_template_parm): Likewise. - (resolve_overloaded_unification): Likewise. - * tree.c (is_overloaded_fn, really_overloaded_fn): Likewise. - * typeck.c (expr_sizeof): Also complain about other permutations - of overloaded functions. - -1999-05-07 Jason Merrill - - * init.c (resolve_offset_ref): Don't return a raw method. - Use BASELINK_P. - * typeck.c (decay_conversion): Don't handle a raw method. - Resolve all OFFSET_REFs. - (get_member_function_from_ptrfunc): 0 is a valid vtable index. - (build_binary_op_nodefault): Handle resolving overloaded fns. Use - same_type_p for pmf bits. Don't use build_binary_op to compare - raw pointers to methods. - (convert_for_assignment): Check for OFFSET_REF, not OFFSET_TYPE, - to decide when to call resolve_offset_ref. - (build_c_cast, convert_for_initialization): Likewise. - * cvt.c (build_expr_type_conversion): Likewise. - -1999-05-06 Nathan Sidwell - - * call.c (build_new_method_call): Use TYPE_MAIN_VARIANT of class. - -1999-05-05 Mark Mitchell - - * decl2.c (start_objects): Don't let static constructors and - destructors get inlined. - - * parse.y (nested_name_specifier): Make sure ordinary types are - complete, just like template types. - * parse.c: Regenerated. - - * pt.c (check_explicit_specialization): Improve error messages. - -1999-05-04 Martin von Löwis - - * typeck.c (string_conv_p): Use same_type_p to check whether we - try to convert between char and wchar_t. - -1999-05-03 Mark Mitchell - - * search.c (lookup_field_r): Set the TREE_TYPE of an ambiguous - lookup to error_mark_node here. - (lookup_member): Revise documentation. Add comments. Don't set - the TREE_TYPE to error_mark_node here, and don't build up an extra - TREE_LIST for ambiguous lookups. - (setup_class_bindings): Adjust accordingly. - (push_class_decls): Revise out-of-date comments. - - * typeck.c (build_const_cast): Tighten checks for legality. - -1999-05-02 Martin von Löwis - - * init.c (build_member_call): Lookup names coming from - namespace-scoped LOOKUP_EXPR. - -1999-05-03 Jim Blandy - - * gxxint.texi: Add documentation for 'I'. - -1999-05-02 Martin von Löwis - - * tinfo.cc (operator==): Qualify type_info with std::. - -1999-05-02 Mark Mitchell - - * cp-tree.h (lang_decl_flags): Remove comdat. Updated dummy. - (DECL_COMDAT): Remove definition. - -1999-05-01 Mark Mitchell - - * decl.c (wrapup_globals_for_namespace): Fix thinko in previous - change. - -1999-04-30 Mark Mitchell - - * class.c (build_vtable): Use build_lang_decl when building - vtables, not just build_decl. - (prepare_fresh_vtable): Likewise. - * decl.c (wrapup_globals_for_namespace): Mark vtables as - DECL_EXTERNAL when calling wrapup_global_declarations. - * decl2.c (priority_info_s): Add initializations_p and - destructions_p members. - (finish_vtable_vardecl): Use TREE_SYMBOL_REFERENCED, not TREE_USED, - when deciding what vtables to write out. - (ssdf_decls): New variable. - (ssdf_decls_used): Likewise. - (start_static_storage_duration_function): Deal with being called - multiple times. Avoid inlining this function. - (generate_inits_for_priority): Deal with reuse of priority map. - (get_priority_info): Clear initializations_p and destructions_p. - (do_static_initialization): Tweak comment. - (do_static_destruction): Likewise. Fix condition on sentries for - destruction. - (generate_ctor_or_dtor_function): Call all of the static storage - duration functions. - (generate_ctor_or_dtor_function_for_priority): Check - initializations_p and destructions_p to see what priorities need - initialization functions. - (finish_file): Rework to generate multiple static storage duration - functions, rather than just one. - - * typeck.c (build_const_cast): Tweak last change to handle - templates correctly. - - * typeck.c (build_const_cast): Disallow use of const_cast to - anything but a pointer or reference type. - -1999-04-30 Nathan Sidwell - - * decl.c (cp_finish_decl): Don't permit arrays of abstract or - signature type. - -1999-04-29 Mark Mitchell - - * decl2.c (do_static_destruction): Remove obsolete FIXME comment. - (finish_file): Indent comments properly. - -1999-04-29 Richard Henderson - - * decl2.c (do_static_initialization): Call do_pending_stack_adjust. - (do_static_destruction): Likewise. - -1999-04-29 Nathan Sidwell - - * cp-tree.h (TYPE_NOTHROW_P): New macro. - * decl2.c (delete_sanity): Warn on deleting void *. - * init.c (build_new_1): Use TYPE_NOTHROW_P. - * typeck.c (c_expand_return): cp_pedwarn on returning NULL from - throwing operator new. - -1999-04-28 Nathan Sidwell - - * cp-tree.h (build_component_addr): Remove prototype. - * typeck.c (build_component_addr): Make static. Remove MSG - argument. - (build_component_addr): Remove MSG parameter, clean up - comment. - (build_x_function_call): Use cp_error. - (build_unary_op): Adjust call of build_component_addr. - -1999-04-28 Mark Mitchell - - * pt.c (tsubst_friend_class): Check for NULL. - -Wed Apr 28 11:42:22 1999 Andreas Schwab - - * search.c (binfo_for_vtable): Initialize bfvi.var. - -1999-04-27 Nathan Sidwell - - * rtti.c (build_x_typeid): Check rtti is enabled. - -1999-04-26 Mark Mitchell - - * search.c (is_subobject_of_p): Make sure we're looking at the - right baseclasses. - -1999-04-26 Marc Espie - - * Make-lang.in (cplib2.ready): Don't depend on phony targets. - -1999-04-23 Mark Mitchell - - * decl2.c (finish_file): Tweak handling of extern inlines so that - they are not unnecessarily put out. - - * search.c (is_subobject_of_p): Handle TEMPLATE_TYPE_PARMs and - such as base classes. - -1999-04-22 Brendan Kehoe - - * tree.c (build_exception_variant): Fix typo: use the chain of U, - not trying V, while cycling through U. - -1999-04-22 Mark Mitchell - - * cp-tree.h (lang_decl_flags): Remove returns_first_arg and - preserves_first_arg. Enlarge dummy accordingly. - (DECL_TINFO_FN_P): New macro. - (SET_DECL_TINFO_FN_P): Likeiwse. - (DECL_RETURNS_FIRST_ARG): Remove. - (DECL_PRESERVES_THIS): Likewise. - (DECL_INIT_PRIORITY): New macro. - (finish_struct_1): Change prototype. - (cat_namespace_levels): Remove prototype. - (vtable_decl_p): New prototype. - (vtype_decl_p): Likewise. - (sigtable_decl_p): Likewise. - (walk_globals_pred): New typedef. - (walk_globals_fn): Likewise. - (walk_globals): New prototype. - (walk_namespaces_fn): New typedef. - (walk_namespaces): New prototype. - (wrapup_globals_for_namespace): Likewise. - (walk_vtables): Remove prototype. - (walk_sigtables): Likewise. - (instantiate_pending_templates): New prototype. - * class.c (finish_struct_1): Don't return a value. - * decl.h (pending_statics): Remove declaration. - * decl.c (walk_namespaces_r): New function. - (walk_globals_r): Likewise. - (vtable_decl_p): Likewise. - (vtype_decl_p): Likewise. - (sigtable_decl_p): Likewise. - (walk_namespaces): Likewise. - (walk_globals_data): New type. - (walk_globals): New function. - (wrapup_globals_for_namespace): Likewise. - (expand_static_init): Remove assertion. Remove redundancy in - conditional. Don't put static data members in static_aggregates - Tidy. - (finish_function): Remove redundancy in conditional. Don't set - DECL_RETURNS_FIRST_ARG. - (cat_namespace_levels): Remove. - * decl2.c: Include splay-tree.h and varray.h. - (priority_info_s): New structure. - (finish_vtable_vardecl): Change prototype. Adjust for new calling - conventions. - (prune_vtable_vardecl): Likewise. - (finish_sigtable_vardecl): Likewise. - (setup_initp): Remove. - (do_dtors): Remove. - (do_ctors): Remove. - (start_static_storage_duration_function): New function. - (generate_inits_for_priority): Likewise. - (finish_static_storage_duration_function): Likewise. - (get_priority_info): Likewise. - (do_static_initialization): Likewise. - (do_static_destruction): Likewise. - (do_static_initialization_and_destruction): Likewise. - (generate_ctor_or_dtor_function): Likewise. - (generate_ctor_and_dtor_functions_for_priority): Likewise. - (pending_statics): Make it a varray. - (pending_statics_used): New variable. - (saved_inlines): Make it a varray. - (saved_inlines_used): New variable. - (finish_static_data_member): Change method of updating - pending_statics. - (mark_inline_for_output): Remove #if 0'd code. Change method of - updating saved_inlines. - (walk_vtables): Remove. - (walk_sigtables): Likewise. - (import_export_decl): Use DECL_TINFO_FN_P. - (pending_templates): Remove declaration. - (maybe_templates): Likewise. - (static_aggregates_initp): Likewise. - (setup_initp): Likewise. - (finish_objects): Simplify. - (INITIALIZE_P_IDENTIFIER): New macro. - (PRIORITY_IDENTIFIER): New macro. - (SSDF_IDENTIFIER): New macro. - (initialize_p_decl): New variable. - (priority_decl): Likewise. - (ssdf_decl): Likewise. - (priority_info_map): Likewise. - (finish_file): Recode output of static intializers and other - file-scope finalization tasks. - * error.c (OB_END_TEMPLATE_ID): New macro. - (dump_type_real): Use it. - (dump_decl): Likewise. - (dump_function_name): Likewise. - * lex.c (set_typedecl_interface_info): Adjust for new walk_globals - interface. - (check_newline): Use walk_globals, not walk_vtables. - * pt.c (pending_tempalte_expansions): Remove. - (set_vardecl_interface_info): Likewise. - (pending_templates): Make static. - (maybe_templates): Likewise. - (instantiate_class_template): Adjust call to finish_struct_1. - (instantiate_pending_templates): New function. - * rtti.c (get_tinfo_fn): Use SET_DECL_TINFO_FN_P. - * tree.c (static_aggregates_initp): Remove. - (cp_valid_lang_attribute): Don't use it; use DECL_INIT_PRIORITY - instead. - * Makefile.in (decl2.o): Depend on varray.h and splay-tree.h. - - * gxx.gperf (RETURN): Rename to RETURN_KEYWORD to avoid clashes - with the RTL code RETURN. - * hash.h: Regenerated. - * lex.c (reinit_parse_for_block): Use RETURN_KEYWORD. - * parse.y: Replace RETURN with RETURN_KEYWORD throughout. - * parse.c: Regenerated. - * pt.c: Include varray.h. Include rtl.h since varray.h requires - it. - (inline_parm_levels): New variable. - (inline_parm_levels_used): Likewise. - (maybe_begin_member_template_processing): Update them. - (maybe_end_member_template_processing): Use them, rather than - guessing how many levels to pop. - - * decl.c (make_typename_type): Tighten error-checking. - -1999-04-20 Mark Mitchell - - * cp-tree.h (build_binary_op): Remove unneeded parameter. - * class.c (build_vrable_entry_ref): Adjust call to - build_binary_op. - * decl.c (expand_static_init): Likewise. - (grokdeclarator): Likewise. - (finish_function): Likewise. - * decl2.c (delete_sanity): Likewise. - (do_dtors): Likewise. - (do_ctors): Likewise. - * error.c (dump_type_suffix): Likewise. - * expr.c (cplus_expand_expr): Likewise. - * init.c (resolve_offset_ref): Likewise. - (build_new): Likewise. - (build_new_1): Likewise. - (build_vec_delete_1): Likewise. - (expand_vec_init_catch_clause): Likewise. - (build_delete): Likewise. - * pt.c (tsubst): Likewise. - * rtti.c (synthesize_tinfo_fn): Likewise. - * search.c (expand_upcast_fixups): Likewise. - (expand_direct_vtbls_init): Likewise. - * typeck.c (get_member_function_from_ptrfunc): Likewise. - (build_binary_op_nodefault): Likewise. - (point_int_sum): Likewise. - (pointer_diff): Likewise. - (build_unary_op): Likewise. - (build_modify_expr): Likewise. - (get_delta_difference): Likewise. - (build_ptrmemfunc): Likewise. - (expand_ptrmemfunc_cst): Likewise. - -1999-04-20 Jason Merrill - - * decl.c (grokfndecl): Always call cplus_decl_attributes. - * decl2.c (grokfield): Pass attrlist to grokdeclarator. - -1999-04-19 Mark Mitchell - - * cp-tree.h (finish_static_data_member_decl): New function. - * decl2.c (finish_static_data_member_decl): Split out from ... - (grokfield): Here. - * pt.c (instantiate_class_template): Use it here instead of - trying to fake it. - (tsubst_decl): Don't set DECL_ASSEMBLER_NAME; - finish_static_data_member_decl will do that. Explicit set - DECL_EXTERNAL to match non-template processing. - -1999-04-18 Mark Mitchell - - * cp-tree.h (finish_class_definition): Add parameter. - * parse.y (structsp): Use it. Don't call pop_scope here. - * parse.c: Regenerated. - * semantics.c (finish_class_definition): Pop it here. - -1999-04-17 Mark Mitchell - - * decl.c (xref_tag): Revise handling of nested template - declarations. - * pt.c (check_explicit_specialization): Tweak handling of friend - templates in template classes. - (tsubst_friend_class): Handle friend declarations for nested - member template classes. - -1999-04-16 Mark Mitchell - - * class.c (finish_struct): Remove unused variable. - (pushclass): Likewise. - (invalidate_class_lookup_cache): Likewise. - * cp-tree.def (TYPENAME_TYPE): Improve documentation. - * decl.c (build_typename_type): Make sure TYPENAME_TYPE_FULLNAME - doesn't get obliterated. - (make_typename_type): Handle template classes correctly. - - * cp-tree.h (TREE_NONLOCAL_FLAG): Remove. - (storetags): Declare. - * class.c (finish_struct): Don't use TREE_NONLOCAL_FLAG. - (pushclass): Likewise. Use storetags to install tag declarations, - not pushtag. - (invalidate_class_lookup_cache): Don't use TREE_NONLOCAL_FLAG. - * decl.c (storetags): Make it global. - (push_class_binding): Set INHERITED_VALUE_BINDING_P for an - implicit typename declaration. - (pushtag): Tidy. Don't use TREE_NONLOCAL_FLAG. - * method.c (hack_identifier): Likewise. - * search.c (lookup_member): Likewise. - - * decl.c (warn_about_implicit_typename_lookup): New function. - (lookup_name_real): Use it. Rework handling of implicit typename - extension. - -1999-04-15 Mark Mitchell - - * cp-tree.h (lookup_nested_field): Remove. - * class.c (push_nested_class): Handle UNION_TYPEs. - (pop_nested_class): Likewise. - * decl.c (lookup_name_real): Don't call lookup_nested_field. - (start_decl): Use push_nested_class, not just pushclass. - (cp_finish_decl): Use pop_nested_class, not just popclass. - * search.c (lookup_nested_field): Remove. - - * cp-tree.h (lang_type): Add documentation. - * decl2.c (handle_class_head): Create template declarations here, - as appropriate. - * parse.y (class_head): Return whether or not we entered a new - scope, as well as the type named. - (named_class_head): Likewise. - (named_complex_class_head_sans_basetype): Likewise. - (structsp): Adjust accordingly. Pop scope when required. - * parse.c: Regenerated. - * pt.c (check_default_tmpl_args): Robustify. - (redeclare_class_template): Likewise. - (instantiate_class_template): An instantiation of an - anonymous union is itself an anonymous union. - * semantics.c (begin_class_definition): Don't create template - declarations here. - -1999-04-15 Jason Merrill - - * parse.y (after_type_declarator_intern): New nonterminal. - (after_type_declarator): Use it. - (direct_after_type_declarator): Likewise. Move above - nonnested_type to fix reduce/reduce conflict resolution. - (declmods): Reducing from just 'attributes' has EMPTY precedence. - * Makefile.in (CONFLICTS): Update. - - * decl.c (define_label): Downgrade error for jumping over a - non-POD decl to pedwarn. - -1999-04-14 Mark Mitchell - - * cp-tree.h (popclass): Change declaration. - (pop_nested_class): Likewise. - (poplevel_class): Remove declaration. - * call.c (convert_default_argument): Pass no arguments to - popclass. - * class.c (finish_struct_1): Likewise. - (finish_struct): Likewise. - (popclass): Remove argument. Simplify code accordingly. - (pop_nested_class): Likewise. - * decl.c (poplevel_class): Declare it here, and make it static. - (poplevel): Handle class scopes. - (poplevel_class): Don't take an rgument. Simplify. - (pop_everything): Pass no arguments to pop_nested_class. - (cp_finish_decl): Pass no arguments to popclass. - (grokdeclarator): Pass no arguments to pop_nested_class. - (finish_function): Likewise. - * decl2.c (grokfield): Likewise. - (pop_scope): Pass no arguments to popclass. - * lex.c (do_pending_defargs): Pass no arguments to pop_nested_class. - * pt.c (instantiate_class_template): Move call to pushclass, and - document. Pass no arguments to popclass. - (regenerate_decl_from_template): Likewise. - -1999-04-14 Jason Merrill - - * typeck.c (build_unary_op): Handle taking the address of a unique - bound non-static member function. - -1999-04-13 Martin von Loewis - - * lang-options.h (-Wdeprecated): New flag. - * decl2.c (warn_deprecated): New flag. - (lang_decode_option): Deprecated this-is-variable, - external-templates, alt-external-templates. - Support -Wdeprecated. - * errfn.c (cp_deprecated): New function. - -1999-04-13 Jason Merrill - - * decl2.c (setup_initp): Compare DECL_ASSEMBLER_NAME instead - of the decls themselves. - - * pt.c (tsubst_function_type): Copy attributes over. - - * tree.c (cp_valid_lang_attribute): New fn. Handle init_priority - and com_interface. - * cp-tree.h: Add prototype. - * decl.c (init_decl_processing): Set valid_lang_attribute. - -1999-04-13 Mark Mitchell - - * class.c (finish_struct_1): Look at the const-ness of the field's - type, not the TREE_READONLY-ness of the declaration. - * method.c (synthesize_method): Likewise. - * pt.c (tsubst_decl): Call c_apply_type_quals_to_decl when - creating new declarations. - -1999-04-13 Mike Stump - - * decl2.c (import_export_decl): Because vtables always reference - virtual functions, even if they are inlined, don't allow - -fno-implement-inlines to not emit them, instead, emit them with - the vtable. - * decl.c (start_function): Likewise. - -1999-04-12 Jason Merrill - - * cp-tree.h (struct lang_type): Add com_interface. - (CLASSTYPE_COM_INTERFACE): New macro. - * class.c (set_rtti_entry): COM interface classes have no RTTI - entries in their vtables; adjust. - (add_virtual_function, finish_base_struct, skip_rtti_stuff, - modify_one_vtable, fixup_vtable_deltas1, override_one_vtable, - finish_struct_1): Likewise. - * decl2.c (mark_vtable_entries): Likewise. - * rtti.c (build_headof, get_tinfo_fn_dynamic): Likewise. - * search.c (get_abstract_virtuals_1, get_abstract_virtuals, - expand_upcast_fixups): Likewise. - * tree.c (debug_binfo): Likewise. - - * cp-tree.h (COMPARE_NO_ATTRIBUTES): New macro. - * typeck.c (comptypes): If we get it, ignore attributes. - * class.c (instantiate_type): Use BASELINK_P. Change complain - parameter to flags; 2 means ignore attributes. - * call.c (build_op_delete_call): Pass it. - - * decl.c (xref_tag): Only complain once about using a typedef-name - with 'struct'. Downgrade to pedwarn. - - * decl.c (grokdeclarator): Allow [] syntax for zero-length array. - - * parse.y (absdcl_intern): New nonterminal. - (absdcl, direct_abstract_declarator): Use it. - - * pt.c (lookup_template_class): Look through implict typename. - -1999-04-11 Mark Mitchell - - * friend.c (add_friend): Deal gracefully with error_mark_node. - * method.c (build_overload_value): Handle pointers-to-members as - template parameters. - - * decl.c (push_binding): Fix typo in comment. - -1999-04-10 Mark Mitchell - - * error.c (dump_type_real): If a typename is a template-id, put - out the template arguments. - (dump_expr): Handle TEMPLATE_ID_EXPR. - * pt.c (lookup_template_class): Now that full arguments are - available everywhere, remove code that tried to guess them. - -1999-04-09 Mark Mitchell - - * decl.c (make_typename_type): Complain if we don't find a type - when trying to make a typename type for a non-template type. - -1999-04-09 Jason Merrill - - * decl.c (start_decl): Pass attributes to grokdeclarator. - (grokdeclarator): Handle attributes on constructor-syntax - initializers. - -1999-04-08 Mark Mitchell - - * error.c (dump_expr): Don't crash on INDIRECT_REFs whose operands - don't have types. - - * search.c (template_self_reference_p): Tweak. - -1999-04-07 Mark Mitchell - - * init.c (build_offset_ref): Don't build yet another weird data - structure to describe overloaded functions. - -1999-04-06 Mark Mitchell - - * cp-tree.h (BASELINK_P): New macro. - (SET_BASELINK_P): Likewise. - * init.c (build_member_call): Remove needless assignment in if - statement. - * search.c (lookup_field_r): Fix handling when we are looking - specifically for a type; these are not hidden by functions and - variables. - (lookup_member): Use SET_BASELINK_P. - * tree.c (is_overloaded_fn): Use BASELINK_P. - (really_overloaed_fn): Likewise. - (get_first_fn): Likewise. - -1999-04-05 Mark Mitchell - - * decl.c (lookup_name_current_level): Tweak, and improve - documentation. - - * class.c (maybe_fixup_vptrs): Remove declaration. - (build_class_init_list): Likewise. - * decl.c (pushdecl_class_level): Call check_template_shadow here - ... - (push_class_level_binding): ... not here. - * search.c (dfs_push_type_decls): Only avoid - template-self-reference TYPE_DECLs if they are from base classes. - -1999-04-04 Mark Mitchell - - * pt.c (check_template_shadow): Don't treat OVERLOADs as _DECL - nodes. Tidy. - -1999-04-03 Jason Merrill - - * class.c (maybe_fixup_vptrs, build_class_init_list): Lose. - (finish_struct_1): Don't call build_class_init_list. - -1999-04-02 Mark Mitchell - - * tinfo.h (__class_type_info): Fix illegal declaration. - - * cp-tree.def (TEMPLATE_ID_EXPR): Update comment. - * cp-tree.h (INHERITED_VALUE_BINDING_P): New macro. - (IDENTIFIER_CLASS_VALUE): Improve documentation. - (is_properly_derived_from): Declare. - (invalidate_class_lookup_cache): Likewise. - (maybe_maybe_note_name_used_in_class): Likewise. - (note_name_declared_in_class): Likewise. - (push_using_decl): Remove duplicate declaration. - (id_in_current_class): Remove declaration. - (push_class_binding): Change prototype. - (clear_identitifer_class_values): Declare. - * call.c (is_properly_derived_from): Make it global. - (build_new_function_call): Be careful about updating candidates. - (build_new_method_call): Handle COMPONENT_REFs. Don't crash when - asked to make illegal calls. - * class.c: Include splay-tree.h. - (class_stack_node): Add names_used slot. - (check_member_decl_is_same_in_complete_scope): Remove. - (add_method): Fix comment. Push the declaration into class - scope. - (finish_struct_1): When popping the class, pop the bindings too. - Remove check for data member/function member conflict. - (finish_struct): Remove calls to - check_member_decl_is_same_in_complete_scope. Change calls to - popclass. - (pushclass): Clear names_used in the class stack entry. - Use invalidate_class_lookup_cache to remove cached entries, rather - than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE - before entering a new class. Remove dead code. Don't mess with - current_function_decl when pushing declarations. - (invalidate_class_lookup_cache): New function, split out from ... - (popclass): Here. Clean up names_used on our way out. - (instantiate_type): Adjust. - (build_self_reference): Don't push the declaration here. - (maybe_note_name_used_in_class): New function. - (note_name_declared_in_class): Likewise. - * decl.c (add_binding): Change prototype. - (find_class_binding_level): New function. - (innermost_nonclass_level): Likewise. - (current_binding_level): Update documentation. - (inner_binding_level): Remove. Replace with current_binding_level - throughout. - (push_binding_level): Remove special handling of - class_binding_level. - (pop_binding_level): Likewise. Use find_class_binding_level. - (suspend_binding_level): Likewise. - (global_bindings_p): Use innermost_nonclass_level. - (toplevel_bindings_p): Likewise. - (namespace_bindings_p): Likewise. - (pseudo_global_level_p): Likewise. - (push_binding): Clear INHERITED_VALUE_BINDING_P. - (add_binding): Check for illegal multiple declarations. Return a - value indicating whether or not the new binding was legal. - (push_local_binding): Skip over class binding levels. Check - return value from add_binding. - (push_class_binding): Set INHERITED_VALUE_BINDING_P. Call - note_name_declared_in_class. - (pushlevel_class): Remove "fake out the rest of the compiler" - code. - (poplevel_class): Reset IDENTIFIER_CLASS_VALUEs. - (clear_identifier_class_values): New function. - (pop_from_top_level): Use it. - (pop_everything): Tweak. - (maybe_process_template_type_declaration): Don't push the - declaration for the template here. - (pushtag): Don't push tag declarations into class scope here. - (pushdecl): Apply DeMorgan's law for readability. - (pushdecl_class_level): Remove special-case code for - TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions. - (push_class_level_bindng): Deal with inherited bindings. - (lookup_name_real): Remove special-case code for - TYPE_BEING_DEFINED, and some implicit typename magic. - (grokdeclarator): Handle COMPONENT_REF for a template function. - (build_enumerator): Don't call pushdecl_class_level here. - (id_in_current_class): Remove. - * decl2.c (grokfield): Don't call pushdecl_class_level or - check_template_shadow. - * errfn.c (cp_file_of): Don't declare. - (cp_line_of): Likewise. - * error.c (dump_decl): Handle an OVERLOAD. - (cp_file_of): Likewise. - (cp_line_of): Likewise. - * init.c (build_member_call): Handle a COMPONENT_REF. - * lex.c (do_identifier): Call maybe_note_name_used_in_class, not - pushdecl_class_level. - * method.c (hack_identifier): Build COMPONENT_REFs for references - to member templates as well as member functions. Remove dead - code. - * parse.y (left_curly): Remove. - (nonnested_type): Call maybe_note_name_used_in_class, not - pushdecl_class_level. - * parse.c: Regenerated. - (nested_name_specifier_1): Likewise. - * pt.c (check_explicit_specialization): Adjust, for robustness. - (check_template_shadow): Handle OVERLOADs. - (build_template_decl): Set DECL_CONSTRUCTOR_P on the - TEMPLATE_DECL, if appropriate. - * search.c (envelope_add_decl): Remove. - (dfs_pushdecls): Likewise. - (dfs_compress_decls): Likewise. - (dfs_push_decls): New function. - (dfs_push_type_decls): Likewise. - (setup_class_bindings): Likewise. - (template_self_reference_p): Likewise. - (lookup_field_r): Use it. - (looup_member): Remove old comment. Deal with ambiguity. - (push_class_decls): Use dfs_push_decls and dfs_push_type_decls, - and remove envelope processing. - * semantics.c (begin_class_definition): Let pushclass push - declarations for base classes. - (finish_member_declaration): Push declarations into class scope. - * typeck.c (build_component_ref): Just put an OVERLOAD into the - COMPONENT_REF, not a TREE_LIST of an OVERLOAD. - (build_x_function_call): Deal with OVERLOAD. Handle template-ids. - * Makefile.in (class.o): Depend on splay-tree.h. - -Wed Mar 31 11:30:43 1999 Nathan Sidwell - - * cvt.c (convert_pointer_to_real): Use same_type_p. - * typeck.c (comp_target_types): Use same_type_p. - -1999-03-31 Jason Merrill - - * semantics.c (begin_inline_definitions, - finish_inline_definitions): Rename from finish_default_args and - begin_inline_definitions, respectively, to something that isn't a - total lie. :) - * parse.y (structsp): Adjust. - - * tree.c (hash_tree_cons): Remove obsolete via_* parms. - (list_hash_lookup): Likewise. - (hash_tree_chain): Adjust. - * pt.c (tsubst): Adjust. - (tsubst_arg_types): Use plain hash_tree_cons. - * cp-tree.h (hash_tree_cons_simple): Lose. - * parse.y (declmods, nonempty_cv_qualifiers): Use hash_tree_cons. - -Wed Mar 31 10:48:29 1999 Kaveh R. Ghazi - - * Makefile.in (hash.h): Generate using gperf language 'C', not - 'KR-C', so gperf uses the `const' keyword on strings. - - * gxx.gperf (resword): Const-ify a char*. - -1999-03-30 Jason Merrill - - * cp-tree.h (IDENTIFIER_AS_DESC, IDENTIFIER_AS_LIST, - CLASSTYPE_BASELINK_VEC, CLASSTYPE_N_SUPERCLASSES, - CLASSTYPE_N_BASECLASSES, CLASSTYPE_MAX_DEPTH, - CLASSTYPE_BASE_INIT_LIST, CLASSTYPE_AS_LIST, CLASSTYPE_ID_AS_LIST, - CLASSTYPE_BINFO_AS_LIST): Remove cruft. - * class.c, lex.c, parse.y, ptree.c, search.c, semantics.c, - tree.c: Adjust. - -1999-03-29 Jason Merrill - - * decl2.c (lang_decode_option): Remove -Wsign-promo from -Wall. - -1999-03-28 Jason Merrill - - * pt.c (fn_type_unification): Ignore 'this' parm from conversion ops. - -1999-03-27 Mark Mitchell - - * cp-tree.h (add_friend): Declare. - (add_friends): Likewise. - * friend.c (add_friend): Make it global. Don't add to - DECL_BEFRIENDING_CLASSES if the befriending class is a template. - (add_friends): Make it global. - (make_friend_class): Don't add to DECL_BEFRIENDING_CLASSES if the - befriending class is a template. - * parse.y (component_decl_1): Fix typo in comment. - * parse.c: Regenerated. - * pt.c (instantiate_class_template): Use add_friend and - add_friends rather that duplicating some of their functionality - here. - -1999-03-27 Jason Merrill - - * call.c (build_field_call): Unify 'this' and non-'this' cases. - - * typeck.c (build_indirect_ref): Check for 'this' sooner. - -Fri Mar 26 10:20:34 1999 Kaveh R. Ghazi - - * call.c (op_error): Const-ify a char*. - (add_candidate, source_type, add_warning): Add static prototype. - (print_z_candidates): Const-ify a char*. - - * class.c (resolve_address_of_overloaded_function, - fixed_type_or_null, build_vtable_entry_ref): Add static prototype. - (get_vtable_name, finish_struct_1): Const-ify a char*. - - * cvt.c (convert_to_reference): Likewise. - - * decl.c (redeclaration_error_message, record_builtin_type, - record_unknown_type, member_function_or_else, bad_specifiers): - Likewise. - (find_binding, select_decl, unqualified_namespace_lookup, - lookup_flags, qualify_lookup, record_builtin_java_type, tag_name): - Add static prototype. - (warn_extern_redeclared_static, duplicate_decls, pushdecl, - implicitly_declare, record_builtin_java_type, define_function, - grok_op_properties, tag_name): Const-ify a char*. - - * cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const. - (define_function, finish_builtin_type): Const-ify a char*. - (cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn, - cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args. - (file_name_nondirectory): Const-ify a char*. - (init_filename_times): Don't prototype. - (compiler_error): Prototype. - (yyerror, init_repo): Const-ify a char*. - (build_srcloc): Don't prototype. - (build_x_indirect_ref, build_indirect_ref, build_component_addr): - Const-ify a char*. - (warn_for_assignment): Don't prototype. - (convert_for_initialization, readonly_error, check_for_new_type, - GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call): - Const-ify a char*. - - * decl2.c (acceptable_java_type, output_vtable_inherit, - setup_initp, start_objects, finish_objects, do_dtors, do_ctors, - merge_functions, decl_namespace, validate_nonmember_using_decl, - do_nonmember_using_decl): Add static prototype. - (lang_f_options): Const-ify a char*. - (finish_builtin_type): Likewise. - (add_function, arg_assoc_namespace, arg_assoc_class): Add static - prototype. - - * errfn.c: Include cp-tree.h. - (cp_thing): Add static prototype. - (compiler_error): Don't protoptype. - (cp_compiler_error): Cast `compiler_error' to `errorfn' before - passing it to `cp_thing'. - - * error.c (interesting_scope_p): Add static prototype. - - * except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify - a char*. - - * init.c (compiler_error): Don't prototype. - (member_init_ok_or_else): Const-ify a char*. - (build_java_class_ref): Add static prototype. - - * lex.c (compiler_error): Don't prototype. - (get_time_identifier, interface_strcmp, extend_token_buffer, - handle_cp_pragma): Const-ify a char*. - (is_global, init_filename_times): Add static prototype. - (file_name_nondirectory, cplus_tree_code_name): Const-ify a char*. - (compiler_error): Change from fixed args to variable args. - (yyerror): Const-ify a char*. - - * parse.y (cond_stmt_keyword): Const-ify a char*. - (parse_decl): Add static prototype. - - * pt.c (template_args_equal, print_template_context): Likewise. - (print_candidates, check_default_tmpl_args): Const-ify a char*. - (instantiate_class_template): Likewise. - - * repo.c (get_base_filename, open_repo_file, init_repo): Likewise. - - * rtti.c (call_void_fn, expand_generic_desc, expand_si_desc, - expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise. - - * search.c (lookup_field_info, lookup_member): Likewise. - (lookup_member): Cast the first argument of `bzero' to a PTR. - - * sig.c (compiler_error): Don't prototype. - (build_signature_pointer_or_reference_nam): Const-ify a char*. - (get_sigtable_name, build_member_function_pointer): Likewise. - - * tree.c (compiler_error): Don't prototype. - (no_linkage_helper, build_srcloc): Add static prototype. - (build_vbase_pointer_fields): Const-ify a char*. - (__eprintf): Don't unnecessarily handle `const' when !__STDC__. - - * typeck.c (compiler_error): Don't prototype. - (convert_for_assignment): Const-ify a char*. - (comp_cv_target_types): Add static prototype. - (build_x_indirect_ref, build_indirect_ref, convert_arguments, - build_component_addr, build_unary_op, convert_for_initialization): - Const-ify a char*. - - * typeck2.c (ack): Add static prototype and change from fixed args - to variable args. - (readonly_error, check_for_new_type): Const-ify a char*. - - * xref.c (_XREF_FILE, find_file, filename, fctname, declname, - fixname, open_xref_file, classname, GNU_xref_begin): Likewise. - (GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'. - (GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call, - gen_assign, GNU_xref_member): Const-ify a char*. - -1999-03-25 Martin von Löwis - - * gxxint.texi: Remove old discussion on copying virtual bases. - -1999-03-25 Zack Weinberg - - * Make-lang.in: Remove all references to g++.o/g++.c. - Link g++ from gcc.o. - -1999-03-25 Jason Merrill - - * decl2.c (comdat_linkage): Treat vtables like functions. - -1999-03-25 Mark Mitchell - - * pt.c (tsubst_decl): tsubst into DECL_BEFRIENDING_CLASSES. - -1999-03-25 Nathan Sidwell - - * decl.c (init_decl_processing): Add `signed' type as a synonym - for `int'. - -1999-03-25 Jason Merrill - - * typeck.c (common_type): Handle cv-qual unification for pointers - to members. - - * decl.c (unqualified_namespace_lookup): Return error_mark_node - on error. - (lookup_name_real): Set LOOKUP_COMPLAIN when *not* parsing. - * lex.c (do_identifier): If we got error_mark_node, call - lookup_name again. - -1999-03-24 Martin von Löwis - - * class.c (finish_struct_1): Always reset TYPE_FIELDS for empty - classes. - -1999-03-24 Jason Merrill - - * decl.c (lookup_name_real): Do nested field lookup regardless of - TYPE_BEING_DEFINED. - -1999-03-24 Mark Mitchell - - * cp-tree.h (lang_type): Remove has_assignment and - has_real_assignment. Add befriending_classes. - (TYPE_HAS_ASSIGNMENT): Remove. - (TYPE_HAS_REAL_ASSIGNMENT): Likewise. - (CLASSTYPE_BEFRIENDING_CLASSES): New macro. - (lang_decl): Document. - (DECL_BEFRIENDING_CLASSES): New macro. - (FRIEND_NAME): Move declaration to more obvious location. - (FRIEND_DECLS): Likewise. - * class.c (finish_struct_1): Don't use TYPE_HAS_REAL_ASSIGNMENT. - * decl.c (duplicate_decls): Copy DECL_BEFRIENDING_CLASSES. - (fixup_anonymous_union): Don't use TYPE_HAS_ASSIGNMENT. - (grok_op_properties): Likewise. - * friend.c (is_friend): Use FRIEND_NAME and FRIEND_DECLS. - (add_friend): Likewise. Don't do weird things with assignment - operators. Update DECL_BEFRIENDING_CLASSES. - (add_friends): Don't do weird things with assignment operators. - (make_friend_class): Likewise. Update - CLASSTYPE_BEFRIENDING_CLASSES. - * pt.c (instantiate_class_template): Don't set - TYPE_HAS_ASSIGNMENT. - (tsubst_copy): Substitute the TREE_TYPE for more unary - expressions. - * ptree.c (print_lang_type): Don't look at TYPE_HAS_ASSIGNMENT. - * search.c (protected_accessible_p): New function. - (friend_accessible_p): Likewise. - (accessible_p): Use them. - -1999-03-23 Mark Mitchell - - * pt.c (convert_nontype_argument): Don't create things that aren't - PTRMEM_CSTs when applying a qualification conversion to a - PTRMEM_CST. - -1999-03-23 Mark Mitchell - - * Makefile.in (OBJS): Don't mention hash.o. - (OBJDEPS): Likewise. - -1999-03-23 Jason Merrill - - * decl2.c (finish_file): Set at_eof to 2 after expanding ctors. - * decl.c (expand_static_init): Make sure we don't add any after - then. - - * decl.c (cp_finish_decl): Move intelligence about handling - DECL_COMDAT for variables from here... - * decl2.c (comdat_linkage): ...to here. - (maybe_make_one_only): Tweak. - (import_export_decl): Call comdat_linkage for variables, too. - (finish_file): Handle template statics properly. - -1999-03-22 Mark Mitchell - - * cp-tree.h (TYPE_PTRMEMFUNC_P): Use TYPE_PTRMEMFUNC_FLAG. - Document internals of pointer-to-member-functions. - (DELTA2_FROM_PTRMEMFUNC): Make it call delta2_from_ptrmemfunc. - (PFN_FROM_PTRMEMFUNC): Likewise. - (build_type_conversion): Remove unused parameter. - (build_ptrmemfunc1): Declare. - (expand_ptrmemfunc_cst): New function. - (delta2_from_ptrmemfunc): Likewise. - (pfn_from_ptrmemfunc): Likewise. - * cvt.c (cp_convert_to_pointer): Remove unused parameter to - build_type_conversion. Use TYPE_PTRMEM_P for readability. - (convert_to_reference): Remove unused parameter to - build_type_conversion. - (ocp_convert): Likewise. - (build_user_type_conversion): Likewise. - * error.c (dump_expr): Handle NULL pointer-to-member functions. - * expr.c (cplus_expand_expr): Handle PTRMEM_CSTs for functions. - * method.c (build_overload_value): Don't go splitting CONSTRUCTORs - open when handling pointer-to-member functions. - * pt.c (convert_nontype_argument): Clean up error messages. Be - more stringent with pointers-to-members. - * typeck.c (build_ptrmemfunc1): Don't declare. Make it global. - (build_unary_op): Tidy ever-so-slightly. - (build_conditional_expr): Remove extra parameter to - build_type_conversion. - (build_ptrmemfunc): Build PTRMEM_CSTs if we know what function - we're using. - (expand_ptrmemfunc_cst): Define. - (delta2_from_ptrmemfunc): Likewise. - (pfn_from_ptrmemfunc): Likewise. - -1999-03-19 Mark Mitchell - - * init.c (build_member_call): Handle template-id expressions - correctly. - * typeck.c (build_x_function_call): Likewise. - -1999-03-19 Chip Salzenberg - - * friend.c (make_friend_class): Avoid core dump when - not-yet-defined friend type lacks TYPE_LANG_SPECIFIC(). - -1999-03-18 Jason Merrill - - * decl.c (start_function): Suppress normal linkage heuristics - for #pragma interface under MULTIPLE_SYMBOL_SPACES. - -1999-03-19 Alexandre Oliva - - * Make-lang.in: ($(INTL_TARGETS)): Depend on cp/parse.c. - ($(srcdir)/cp/parse.c): Moved from ../Makefile.in. - -1999-03-17 Martin von Löwis - - * parse.y (named_complex_class_head_sans_basetype): - Do not push a scope for error_mark_node. - (maybe_base_class_list): Likewise. - - * decl.c (start_decl): Check for error_mark_node as a type. - Detected by g++.brendan/array-refs.C. - (start_decl_1): Likewise. Detected by g++.bugs/900322_01.C. - (maybe_build_cleanup_1): Likewise. Detected by - g++.jason/incomplete1.C. - - * tree.c (build_dummy_object): Use void_zero_node instead of the - error_mark_node. - (is_dummy_object): Check for such a node. - Detected by g++.bob/inherit1.C - -1999-03-16 Jason Merrill - - * method.c (old_backref_index): Split out... - (flush_repeats): From here. Rename back from try_old_backref. - (build_mangled_name): Put back some old-style repeat handling. - -Mon Mar 15 21:57:16 1999 Kaveh R. Ghazi - - * lex.c: Don't include setjmp.h. - (parse_float): New static function. - (pf_args): New struct. - (real_yylex): Use them in call to `do_float_handler'. - -1999-03-15 Mark Mitchell - - * decl.c (xref_basetypes): Set CLASSTYPE_VBASECLASSES here. - * tree.c (layout_basetypes): Not here. - * search.c (dfs_search): Remove; no longer used. - -1999-03-12 Mark Mitchell - - * decl2.c (validate_nonmember_using_decl): Issue sensible - error-messages on bogus qualifiers. - -1999-03-14 Jason Merrill - - * call.c (add_function_candidate): Fix uninitialized variable. - - * Makefile.in (search.o): Add dependency on varray.h. - -1999-03-13 Jason Merrill - - * decl.c (duplicate_decls): Use same_type_p. - * method.c (try_old_backref): Renamed from flush_repeats. Use - same_type_p. Don't try to handle repeats. Return success. - (is_back_referenceable_type): Return 0 if TYPE_FOR_JAVA. Support - calls from old-style code, too. - (check_ktype): Use same_type_p. - (check_btype): Use same_type_p. Don't pull out TYPE_MAIN_VARIANT. - (build_qualified_name): Simplify logic. - (process_overload_item): Strip typedefs and quals at the top. - (build_mangled_name_for_type_with_Gcode): Remove call to - type_canonical_variant. - (build_mangled_name): Likewise. Remove support for old-style - repeats, which have been disabled since 2.7.2. Don't mess with - TREE_USED. - (build_decl_overload_real): Don't mess with TREE_USED. - -1999-03-13 Nathan Sidwell - - * error.c (cp_printers): Add 'F' escape character. - (dump_type_real): Remove TREE_LIST (fnargs) printing. - Functionality moved to dump_parameters. - (dump_type_suffix): Use dump_parameters and dump_exception_spec. - (dump_function_decl): Extend meaning of V parameter. Use - dump_parameters and dump_exception_spec. - (dump_parameters): New static function. - (dump_exception_spec): New static function. - (fndecl_as_string): Change argument semantics. Use - dump_function_decl directly. - - * sig.c (build_signature_table_constructor): Use cp_error. - -1999-03-13 Martin von Löwis - - * semantics.c (finish_switch_cond): Handle error cases gracefully. - Detected by g++.law/enum5.C. - - * typeck.c (build_modify_expr): Check for errors after resolving - offsets. Detected by g++.brendan/static1.C. - - * decl.c (complete_array_type): Ignore initial_value if it is an - error. Detected by g++.benjamin/17930.C. - - * typeck2.c (process_init_constructor): Return error if one argument - is in error. Detected by g++.benjamin/13478.C. - -1999-03-12 Martin von Löwis - - * decl.c (select_decl): Allow class templates when we need types. - * decl2.c (ambiguous_decl): Likewise. - -1999-03-12 Mark Mitchell - - * lex.c (do_identifier): Correct call to enforce_access. - * search.c (accessible_p): Tweak comment. - -1999-03-10 Mark Mitchell - - * semantics.c (begin_class_definition): Call build_self_reference. - (finish_member_declaration): Set DECL_CONTEXT for TYPE_DECLs. - - * search.c (assert_canonical_unmarked): Fix typo in prototype. - - * search.c (dfs_canonical_queue): New function. - (dfs_assert_unmarked_p): Likewise. - (assert_canonical_unmarked): Likewise. - (access_in_type): Use it. - (accessible_p): Likewise. Walk the whole tree when umarking. - - * sig.c (build_signature_table_constructor): Use accessible_p - instead of compute_access. - -1999-03-09 Jason Merrill - - * call.c (add_builtin_candidates): Handle overloaded conversion ops. - -1999-03-09 Mark Mitchell - - * cp-tree.h (flag_access_control): Declare. - (TREE_VIA_PPUBLIC): Document. - (DECL_NONSTATIC_MEMBER_P): New macro. - (enforce_access): Return an indication of whether or not access - was permitted. - (build_self_reference): Change prototype. - (compute_access): Replace with ... - (accessible_p): New function. - (dfs_walk): Change prototype. - (dfs_unmark): Likewise. - (markedp): Likewise. - * call.c (enforce_access): Use accessible_p. - * class.c (build_self_reference): Insert the declaration into the - list of members for this type, and make it public. - * decl.c (xref_basetypes): Avoid ill-timed recursion. - * init.c (build_offset_ref): Use lookup_member, not three separate - name-lookups. Call enforce_access rather than checking for - illegal accesses here. - (resolve_offset_ref): Likewise. - * lex.c (do_identifier): Likewise. - * method.c (hack_identifier): Likewise. - * parse.y (self_reference): Remove. - (opt_component_decl_list): Don't use it. - * parse.c: Regenerated. - * pt.c (print_candidates): Generalize to handle lists of - overloaded functions. - (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's - not set. - (get_template_base): Use new calling convention for dfs_walk. - * search.c: Include varray.h. Add prototypes. - (dfs_walk): Accept a data pointer to pass to the work functions. - All callers changed. All work functions changed. - (breadth_first_search): Rename to bfs_walk, and make consistent - with dfs_walk. - (dfs_walk_real): New function. - (canonical_binfo): New function. - (context_for_name_lookup): Likewise. - (shared_marked_p): Likewise. - (shared_unmarked_p): Likewise. - (lokup_field_queue_p): Likewise. - (lookup_field_r): Generalize to handle both functions and fields. - (lookup_field): Just call lookup_member. - (lookup_fnfields): Likewise. - (lookup_member): Move body of lookup_field here and generalize. - (dfs_accessible_queue_p): Likewise. - (dfs_accessible_p): Likewise. - (dfs_access_in_type): Likewise. - (access_in_type): Likewise. - (compute_access): Remove, and replace with ... - (accessible_p): New function. - (vbase_types): Remove. - (vbase_decl_ptr_intermediate): Likewise. - (vbase_decl_ptr): Likewise. - (vbase_init_result): Likewise. - (closed_envelopes): Likewise. - (bvtable): Likewise. - -1999-03-09 Jason Merrill - - * call.c (add_function_candidate): Check for proper number of args - before checking the validity of those args. - -1999-03-06 Jason Merrill - - * cp-tree.h (struct lang_type): Add anon_union field. - (ANON_UNION_TYPE_P): Use it instead of examining type. - (SET_ANON_UNION_TYPE_P): New macro. - * decl.c (check_tag_decl): Use it. - - * search.c (compute_access): Handle non-type contexts earlier, and - handle NULL_TREE. - - * tree.c (build_exception_variant): Use copy_to_permanent. - - * decl2.c (setup_initp): Give statics with no priority the default - priority here. - (do_dtors, do_ctors, finish_file): Remove special handling of - non-prioritized statics. - -1999-03-05 Mark Mitchell - - * cp-tree.h (ANON_UNION_TYPE_P): Robustify. - * decl.c (make_typename_type): Don't issue an error if an - immediate lookup fails; it migt be resolved later. - * friend.c (is_friend): Add comment. - * search.c (breadth_first_search): Add POSTFN and DATA - parameters. Tidy. All callers changed. - (lookup_field_queue_p): New function. - (lookup_field_r): Likewise. - (lookup_field_post): Likewise. - (lookup_field): Use them, via breadth_first_search, instead of - duplicating logic. - (compute_access): Robustify. - (lookup_fnfield_info): New structure. - -1999-03-05 Jason Merrill - - * pt.c (tsubst, case ARRAY_REF): Use tsubst_expr again. - -1999-03-03 Jason Merrill - - * class.c, decl2.c, method.c, pt.c: Add 'static' to make SunOS 4 - cc happy. - - * decl2.c (import_export_class): Also return if - CLASSTYPE_INTERFACE_ONLY is set. - -1999-03-03 Martin von Löwis - - * decl.c (push_overloaded_decl): Only overwrite the old binding if - there was one. - * decl2.c (do_local_using_decl): Fix loop termination. - -1999-03-02 Mark Mitchell - - * cp-tree.h (determine_specialization): Don't declare. - * pt.c (determine_specialization): Make it static. Eliminate - complain parameter. Note that decl is always non-NULL now, and - simplify accordingly. - - * decl.c (maybe_push_to_top_level): Always call - push_cp_function_context. - (pop_from_top_level): Always call pop_cp_function_context. - -1999-02-26 Nathan Sidwell - - * typeck.c (complete_type_or_else): Add VALUE arg, for helpful - diagnostics. - * cp-tree.h (complete_type_or_else): Added VALUE parameter. - * init.c (build_new_1): Extra arg to complete_type_or_else. - (build_delete): Likewise. - * typeck.c (require_complete_type): Likewise. - (pointer_int_sum): Likewise. - (pointer_diff): Likewise. - (build_component_ref): Likewise. - - * typeck2.c (incomplete_type_error): Always use cp_error. - Show declaration of undefined type, if appropriate. - Deal with UNKNOWN_TYPE nodes. - - * typeck.c (require_complete_type): Use TYPE_SIZE as - size_zero_node to mean incomplete type. - (require_complete_type_in_void): New function. - (build_compound_expr): Call complete_type_in_void for LHS. - (build_c_cast): Call complete_type_in_void for void cast. - * cvt.c (ocp_convert): Call complete_type_in_void for void cast. - * decl.c (cplus_expand_expr_stmt): Void expression checks moved to - require_complete_type_in_void. Call it. - * cp-tree.h (require_complete_type_in_void): Prototype new function. - - * typeck.c (convert_arguments): Use alternative format for - function decls. Don't require_complete_type here. Simplify - diagnostic printing. - (convert_for_initialization): Don't require_complete_type on RHS yet. - * call.c (convert_arg_to_ellipsis): Call require_complete_type. - - * call.c (build_over_call): Cope with qualified void return type. - * semantics.c (finish_call_expr): Likewise. - * typeck.c (build_function_call_real): Likewise. - (c_expand_return): Likewise. - * decl2.c (reparse_absdcl_as_expr): Cope with qualified void type. - - * call.c (print_z_candidates): Use alternate print format, to be - consistent with (pt.c) print_candidates. - * method.c (hack_identifier): List candidate members. - * search.c (lookup_field): Build ambiguous list, and show it, if - ambiguous. - -1999-02-26 Mark Mitchell - - * typeck.c (decay_conversion): Don't confuse constant array - variables with their initializers. - - * decl.c (duplicate_decls): Copy DECL_TEMPLATE_INSTANTIATED when - merging decls. - * pt.c (regenerate_decl_from_template): Tweak for clarity. - (instantiate_decl): Mark a decl instantiated before regenerating - it to avoid recursion. - * tree.c (mapcar): Don't call decl_constant_value unless we know - something is TREE_READONLY_DECL_P. - - * class.c (check_for_override): Don't stop checking when we find - the first overridden function. Delete #if 0'd code. - * search.c (get_matching_virtual): Likewise. - -1999-02-25 Richard Henderson - - * lang-specs.h: Define __FAST_MATH__ when appropriate. - -1999-02-24 Mike Stump - - * typeck.c (convert_for_assignment): Allow boolean integral constant - expressions to convert to null pointer. - -1999-02-24 Martin von Loewis - - * decl.c (lookup_namespace_name): Resolve namespace aliases. - - * class.c (push_nested_class): Allow namespaces. - - * decl2.c (set_decl_namespace): Add friendp parameter. - * decl.c (grokfndecl): Pass it. - (grokvardecl): Likewise. - * cp-tree.h: Change declaration. - -1999-02-24 Jason Merrill - - * pt.c (tsubst): Allow an array of explicit size zero. - -1999-02-23 Jason Merrill - - * errfn.c: Change varargs code to look like toplev.c. - - * method.c (process_modifiers): Don't prepend 'U' for char or - wchar_t. - -1999-02-20 Craig Burley - - * Make-lang.in (cplib2.ready): Don't consider updating - cplib2 stuff if the current directory isn't writable, as - it won't work (such as during a `make install'). - -Sun Feb 21 20:38:00 1999 H.J. Lu (hjl@gnu.org) - - * decl2.c (start_objects): Make file scope constructors and - destructors local to the file if ASM_OUTPUT_CONSTRUCTOR and - ASM_OUTPUT_DESTRUCTOR are defined. - -1999-02-19 Mark Mitchell - - * cp-tree.h (CLASSTYPE_METHOD_VEC): Adjust comment. - (fn_type_unification): Adjust prototype. - (lookup_fnfields_1): Declare. - * call.c (add_template_candidate_real): Adjust call to - fn_type_unification. - * class.c (add_method): Don't allow duplicate declarations of - constructors or destructors. - (resolve_address_of_overloaded_function): Remove unused variable. - Adjust call to fn_type_unification. - * decl.c (grokfndecl): Be more robust in the face of illegal - specializations. - * decl2.c (check_classfn): Remove hokey handling of member - templates. - * pt.c (determine_specialization): Improve comments. Adjust to - handle template argument deduction as per the standard. - (check_explicit_specialization): Fix comment spacing. Handle - type-conversion operators correctly. Improve error-recovery. - (fn_type_unification): Remove EXTRA_FN_ARG parameter. - (get_bindings_real): Simplify handling of static members. - * search.c (lookup_fnfields_1): Make it have external linkage. - * typeck.c (compparms): Fix comment. - (build_unary_op): Don't try to figure out which template - specialization is being referred to when when the address-of - operator is used with a template function. - -Thu Feb 18 23:40:01 1999 Kaveh R. Ghazi - - * cp-tree.h (lvalue_or_else): Qualify a char* with the `const' - keyword to match an analogous change at the top level. - - * tree.c (lvalue_or_else): Likewise. - -1999-02-17 Mark Mitchell - - * decl.c (xref_basetypes): Comment. - * pt.c (instantiate_class_template): Use xref_basetypes. - -1999-02-16 Mark Mitchell - - * cp-tree.h (tsubst): Change prototype. - (tsubst_expr): Likewise. - (tsubst_copy): Likewise. - (type_unification): Remove prototype. - * call.c (convert_default_arg): Adjust call to tsubst_expr. - * class.c (resolve_address_of_overloaded_function): Just use - fn_type_unification. - * decl.c (grokdeclarator): Adjust call to tsubst. - * method.c (build_template_parm_names): Likewise. - * pt.c (GTB_VIA_VIRTUAL): New macro. - (GTB_IGNORE_TYPE): Likewise. - (resolve_overloaded_unification): Add `complain' parameter. - (try_one_overload): Likewise. - (tsubst_template_arg_vector): Likewise. - (tsubst_template_parms): Likewise. - (tsubst_aggr_type): Likewise. - (tsubst_arg_types): Likewise. - (tsubst_call_declarator_parms): Likewise. - (unify): Remove explicit_mask. - (type_unification_real): Likewise. - (get_template_base_recursive): Likewise. - (coerce_template_template_parms): Provide prototype. - (tsubst_function_type): Likewise. - (try_class_unification): New function. - All callers changed to use new complain parameter. - (get_template_base): Use try_class_unification. - (unify): Adjust handling of classes derived from template types. - (fn_type_unification): Substitute explicit arguments before - unification. - -1999-02-16 Kriang Lerdsuwanakij - - * decl.c (pushdecl): Remove dead code. - -1999-02-16 Jason Merrill - - * decl2.c (finish_objects): Fix code I missed in previous change. - -1999-02-13 Jason Merrill - - * decl.c (grokfndecl): Return NULL_TREE instead of error_mark_node. - (grokdeclarator): Don't expect error_mark_node from grokfndecl. - - * pt.c (maybe_process_partial_specialization): Complain about - 'template <>' on non-specialization. - -1999-02-10 Jason Merrill - - * decl.c (grokdeclarator): Catch wierd declarators. - * decl2.c (finish_file): Don't abort because of namespace parsing - failure. - (check_decl_namespace): Remove. - -1999-02-09 Mark Mitchell - - * cp-tree.h (get_template_base): Don't declare. - (dfs_walk): Declare. - (dfs_unmark): Likewise. - (markedp): Likewise. - * pt.c (unify): Remove duplicate declaration. Pass tparms and - targs to get_template_base. - (get_template_base_recursive): Move here from search.c. Check to - see that the base found can be instantiated to form the desired - type. - (get_template_base): Likewise. - (get_class_bindings): Simplify. - * search.c (get_template_base_recursive): Move to pt.c. - (get_template_base): Likewise. - (markedp): Make it global. - (dfs_walk): Likewise. - (dfs_unmark): Likewise. - -1999-02-07 Jason Merrill - - * pt.c (maybe_process_partial_specialization): Complain about - specialization in wrong namespace. - * tree.c (decl_namespace_context): New fn. - -1999-02-06 Kriang Lerdsuwanakij - - * decl2.c (arg_assoc_type): Handle TEMPLATE_TEMPLATE_PARM. - * pt.c (coerce_template_template_parms): Handle nested - template template parameters. - -Sat Feb 6 18:08:40 1999 Jeffrey A Law (law@cygnus.com) - - * typeck2.c: Update email addresses. - -1999-02-04 Kriang Lerdsuwanakij - - * pt.c (unify): Call coerce_template_parms with the COMPLAIN flag - turned off. - -1999-02-04 Jason Merrill - - * lex.c (retrofit_lang_decl): Split out... - (build_lang_decl): From here. - * decl.c (pushdecl): Call it for functions generated by the middle - end that don't have DECL_LANG_SPECIFIC. - * cp-tree.h: Declare it. - - * decl2.c: Remove flag_init_priority. Always enable initp stuff. - (start_objects, finish_objects): Only use special - init_priority code if the user specified a priority. - (do_ctors, do_dtors): Use DEFAULT_INIT_PRIORITY for the non-initp - objects. - -Wed Feb 3 22:50:17 1999 Marc Espie - - * Make-lang.in (GXX_OBJS): Remove choose-temp.o, pexecute.o and - mkstemp.o. Get them from libiberty now. - (DEMANGLER_PROG): Simlarly, remove getopt.o getopt1.o. - -Tue Feb 2 22:38:48 1999 Theodore Papadopoulo - - * decl2.c (lang_decode_option): Use read_integral_parameter. - -1999-02-01 Mark Mitchell - - * pt.c (tsubst, case TYPENAME_TYPE): Check TYPE_BEING_DEFINED - before calling complete_type_or_else. - -Mon Feb 1 09:49:52 1999 Kaveh R. Ghazi - - * input.c (inline): Don't define, its handled by system.h. - -Sun Jan 31 20:34:29 1999 Zack Weinberg - - * decl2.c: Don't define flag_no_ident here. Don't process - -f(no-)ident here. - * cp-tree.h: Don't declare flag_no_ident here. - * lang-specs.h: Map -Qn to -fno-ident. - -1999-01-28 Jason Merrill - - * cp-tree.h (struct tree_binding): Replace scope field with a union. - (BINDING_SCOPE): Adjust. - * decl.c (BINDING_LEVEL): Adjust. - -1999-01-26 Jason Merrill - - * pt.c (instantiate_class_template): Set up the DECL_INITIAL of - member constants. - - * init.c (expand_member_init): Pull out TYPE_MAIN_VARIANT in - a ctor initializer. - - * tree.c (equal_functions): Fix name in prototype. - - * decl.c (push_local_binding): Add FLAGS argument. - (pushdecl, push_overloaded_decl): Pass it. - * decl2.c (do_local_using_decl): Likewise. - * cp-tree.h: Adjust prototype. - * decl.c (poplevel): Fix logic. - - * decl.c (push_local_binding): Also wrap used decls in a TREE_LIST. - (poplevel): Handle that. Fix logic for removing TREE_LISTs. - (cat_namespace_levels): Don't loop forever. - -1999-01-25 Richard Henderson - - * typeck.c (build_reinterpret_cast): Fix typo in duplicated test. - -1999-01-25 Jason Merrill - - * class.c (resolve_address_of_overloaded_function): Mark the - chosen function used. - - * call.c (build_call): Make sure that a function coming in has - been marked used already. - * decl.c (expand_static_init): Call mark_used instead of - assemble_external. - * except.c (call_eh_info, do_pop_exception, expand_end_eh_spec, - alloc_eh_object, expand_throw): Likewise. - * init.c (build_builtin_delete_call): Likewise. - * rtti.c (call_void_fn, get_tinfo_fn, build_dynamic_cast_1, - expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc, - expand_generic_desc): Likewise. - -1999-01-25 Martin von Löwis - - * tree.c (equal_functions): New function. - (ovl_member): Call it. - -1999-01-24 Jason Merrill - - * cvt.c (cp_convert_to_pointer): Fix conversion of 0 to pmf. - -1999-01-25 Martin von Loewis - - * decl.c (decls_match): Return 1 if old and new are identical. - (push_overloaded_decl): Set OVL_USED when PUSH_USING. - -1999-01-24 Jason Merrill - - * decl.c (start_function): Make member functions one_only on windows. - * decl2.c (import_export_decl): Likewise. - - * decl.c (grokdeclarator): Don't complain about implicit int in - a system header. Change same-name field check to not complain in - a system header instead of within extern "C". - -1999-01-21 Mark Mitchell - - * cp-tree.h (PUSH_GLOBAL): New macro. - (PUSH_LOCAL): Likewise. - (PUSH_USING): Likewise. - (namespace_bindings_p): Declare. - (push_overloaded_decl): Likewise. - * decl.c (push_overloaded_decl): Don't make it static. Check for - illegal declarations after using declarations here. - (namespace_bindings_p): Likewise. - (duplicate_decls): Don't consider declarations from different - namespaces to be the same. - (pushdecl): Use symbolic PUSH_ constants in calls to - push_overloaded_decl. - (push_overloaded_decl_1): Likewise. - * decl2.c (validate_nonmember_using_decl): Tweak `std' handling. - (do_nonmember_using_decl): Check for illegal using declarations - after ordinary declarations here. - (do_local_using_decl): Call pushdecl to insert declarations. - -1999-01-21 Jason Merrill - - * decl.c (grokdeclarator): Fix lang_c -> lang_name_c typo. - -1999-01-21 Mark Mitchell - - * tree.c (build_cplus_array_type_1): Don't call build_array_type - for types involving template parameters. - - * cp-tree.h (PARM_DECL_EXPR): Delete. - (convert_default_arg): Change prototype. - (check_default_argument): Declare. - (search_tree): Likewise. - * call.c (convert_default_arg): Take the function to which the - default argument belongs as a parameter, and do any necessary - instantiation here, instead of ... - (build_over_call): Here. - * decl.c (local_variable_p): New function. - (check_default_argument): Likewise, split out and tidied from ... - (grokparms): Here. - * error.c (dump_expr): Don't set PARM_DECL_EXPR. - * pt.c (tsubst_call_declarator_parms): New function. - (for_each_template_parm): Handle ARRAY_REFs. Do the obvious thing - with CALL_EXPRs, rather than trying to be clever. - (tsubst): Use tsubst_call_declarator_parms. - * tree.c (search_tree): Don't make it static. - * typeck.c (convert_arguments): Use new interface to - convert_default_arg. - -1999-01-20 Mark Mitchell - - * error.c (dump_function_decl): Don't print the argument types for - a function when the verbosity level is negative. - - * call.c (build_over_call): Check format attributes at call-time. - - * pt.c (tsubst_copy): Fix comment. - (unify): Don't allow unification with variable-sized arrays. - - * semantics.c (finish_stmt_expr): When processing a template make - the BIND_EXPR long-lived. - -1999-01-19 Jason Merrill - - * decl2.c (finish_vtable_vardecl): Make vtables comdat here. - (import_export_vtable): Not here. - -1999-01-18 Jason Merrill - - * typeck.c (build_component_ref): Wrap an OVERLOAD around a unique - non-static member function. - -1999-01-18 Nathan Sidwell - - * class.c (instantiate_type): Only diagnose illegal address of member - function if complaining. - - * decl.c (lookup_name_real): Remove duplicate code. - -1999-01-18 Jason Merrill - - * tree.c (copy_template_template_parm): Use permanent_obstack. - -1999-01-18 Kriang Lerdsuwanakij - - * pt.c (unify): Remove restrictions on deduction of argument - of template template parameters. - -1999-01-18 Nathan Sidwell - - * rtti.c (build_dynamic_cast_1): Resolve OFFSET_REF exprs. - - * class.c (resolve_address_of_overloaded_function): Show list of - all candidates, when none of them match. - -1999-01-18 Chip Salzenberg - - * typeck.c (comp_ptr_ttypes_reinterpret): Per ANSI, tighten up - definition of 'casting away const' in reinterpret_cast<>. - -1999-01-18 Graham - - * cvt.c: Add include for decl.h, remove extern for - static_aggregates which is now provided by decl.h. - - * Makefile.in (cvt.o): Add dependency for decl.h and missing - dependencies for convert.h and flags.h. - -1999-01-18 Nathan Sidwell - - * decl2.c (do_dtors): Set current location to that of the - decl, for sensible diagnostics and debugging. - (check_classfn): Issue `incomplete type' error, if - class is not defined. - -1999-01-16 Jason Merrill - - * cp-tree.h: Add prototype for bound_pmf_p. - -1999-01-16 Jason Merrill - Manfred Hollstein - - * decl.c (grokdeclarator): Don't make 'main(){}' an error with only - -Wreturn-type. - -1999-01-16 Nathan Sidwell - - * cp-tree.h (struct lang_type): Added has_mutable flag. - (CLASSTYPE_HAS_MUTABLE): New macro to access it. - (TYPE_HAS_MUTABLE_P): New macro to read it. - (cp_has_mutable_p): Prototype for new function. - * class.c (finish_struct_1): Set has_mutable from members. - * decl.c (cp_finish_decl): Clear decl's TREE_READONLY flag, if - it contains a mutable. - * typeck.c (cp_has_mutable_p): New function. - -1999-01-15 Mark Mitchell - - * pt.c (process_template_parm): Ignore top-level qualifiers on - non-type parameters. - - * decl.c (start_function): Use current_function_parms in the call - to require_complete_type_for_parms, not the probably empty - DECL_ARGUMENTS. - -1999-01-14 Jason Merrill - - * semantics.c (finish_asm_stmt): Don't warn about redundant volatile. - - * decl2.c (import_export_class): MULTIPLE_SYMBOL_SPACES only means - that we don't suppress the other copies. - * lex.c (handle_cp_pragma): Likewise. - -1999-01-13 Mark Mitchell - - * decl.c (grokdeclarator): Undo 1998-12-14 change. - * tree.c (build_cplus_array_type_1): Likewise. - * pt.c (instantiate_class_template): Remove misleading comment. - (tsubst_aggr_type): Substitute if there are template parameters, - regardless of whether or not they use template arguments. - (unify): Likewise, but for unification. - -1999-01-12 Richard Henderson - - * cp-tree.h (flag_permissive): Declare extern. - -1999-01-06 Mark Mitchell - - * cp-tree.h (IDENTIFIER_TYPENAME_P): Use OPERATOR_TYPENAME_FORMAT - here. - (lang_type): Add is_partial_instantiation. Decrease width of - dummy. - (PARTIAL_INSTANTIATION_P): New macro. - (OPERATOR_TYPENAME_P): Remove. - * decl.c (unary_op_p): Use IDENTIFIER_TYPENAME_P, not - OPERATOR_TYPENAME_P. - (grok_op_properties): Likewise. - * friend.c (do_friend): Handle friends that are member functions - correctly. - * lex.c (init_parse): Use OPERATOR_TYPENAME_FORMAT. - * pt.c (instantiate_class_template): Rework for clarity. Avoid - leaving TYPE_BEING_DEFINED set in obscure cases. Don't do - any more partial instantiation than is absolutely necessary for - implicit typename. Set PARTIAL_INSTANTIATION_P. - (tsubst_decl): Use IDENTIFIER_TYPENAME_P. - * semantics.c (begin_class_definition): Handle partial - specializations of a type that was previously partially - instantiated. - -Wed Jan 6 03:18:53 1999 Mark Elbrecht - - * Make-lang.in (g++.o): Depend on prefix.h. - -1999-01-04 Jason Merrill - - * tree.c (bound_pmf_p): New fn. - * typeck.c (build_c_cast): Use it. - - * decl.c (grok_op_properties): Use same_type_p. - -Tue Dec 22 15:09:25 1998 Kaveh R. Ghazi - - * Makefile.in (cvt.o): Depend on toplev.h. - - * cp-tree.h (check_template_shadow, pod_type_p): Add prototypes. - - * cvt.c: Include toplev.h. - - * except.c (get_eh_caught, get_eh_handlers): Hide prototypes and - definitions. - - * init.c (expand_vec_init): Initialize variable `itype'. - - * lex.c (yyerror): Cast the argument passed to a ctype function to - an unsigned char. - - * method.c (build_mangled_C9x_name): Wrap prototype and definition - in "HOST_BITS_PER_WIDE_INT >= 64". - - * typeck.c (build_binary_op): Mark parameter `convert_p' with - ATTRIBUTE_UNUSED. - -1998-12-22 Mark Mitchell - - * cp-tree.h (TYPE_RAISES_EXCEPTIONS): Improve documentation. - * tree.c (build_exception_variant): Don't crash on empty throw - specs. - -1998-12-18 DJ Delorie - - * cvt.c (convert_to_reference): Check for both error_mark_node - and NULL_NODE after call to convert_for_initialization. - -1998-12-17 Jason Merrill - - * error.c (interesting_scope_p): New fn. - (dump_simple_decl): Use it. - (dump_expr, case CONSTRUCTOR): Force a & for a PMF. - (dump_expr, case OFFSET_REF): Print ->* if appropriate. - -1998-12-16 Mark Mitchell - - * class.c (resolve_address_of_overloaded_function): Do conversion - to correct type here, rather than ... - (instantiate_type): Here. - - * cp-tree.h (DECL_TEMPLATE_PARM_P): New macro. - (DECL_TEMPLATE_TEMPLATE_PARM_P): Use it. - (decl_template_parm_p): Remove. - * decl.c (pushdecl): Don't set DECL_CONTEXT for a template - parameter. - * lex.c (do_identifier): Use DECL_TEMPLATE_PARM_P. - * pt.c (push_inline_template_parms_recursive): Set it. - (decl_template_parm_p): Remove. - (check_template_shadow): Use DECL_TEMPLATE_PARM_P. - (process_template_parm): Set it. - -Wed Dec 16 16:33:58 1998 Dave Brolley - - * lang-specs.h (default_compilers): Pass -MD, -MMD and -MG to cc1plus - if configured with cpplib. - -1998-12-15 Mark Mitchell - - * decl.c (poplevel): Make sure ns_binding is initialized. - - * decl.c (finish_function): Undo inadvertent change in previous - patch. - -1998-12-14 Mark Mitchell - - * class.c (pushclass): Tweak handling of class-level bindings. - (resolve_address_of_overloaded_function): Update pointer-to-member - handling. - (instantiate_type): Likewise. - * cvt.c (cp_convert_to_pointer): Likewise. - * decl.c (pop_binding): Take the DECL to pop, not just the name. - Deal with `struct stat' hack. - (binding_level): Add to documentation. - (push_binding): Clear BINDING_TYPE. - (add_binding): New function. - (push_local_binding): Use it. - (push_class_binding): Likewise. - (poplevel): Adjust calls to pop_binding. - (poplevel_class): Likewise. - (pushdecl): Adjust handling of TYPE_DECLs; add bindings for hidden - declarations to current binding level. - (push_class_level_binding): Likewise. - (push_overloaded_decl): Adjust handling of OVERLOADs in local - bindings. - (lookup_namespace_name): Don't crash when confronted with a - TEMPLATE_DECL. - (lookup_name_real): Do `struct stat' hack in local binding - contexts. - (build_ptrmemfunc_type): Adjust documentation. - (grokdeclarator): Don't avoid building real array types when - processing templates unless really necessary. - (finish_method): Adjust calls to pop_binding. - * decl2.c (reparse_absdcl_as_expr): Recursively call ourselves, - not reparse_decl_as_expr. - (build_expr_from_tree): Deal with a template-id as the function to - call in a METHOD_CALL_EXPR. - * pt.c (convert_nontype_argument): Tweak pointer-to-member handling. - (maybe_adjust_types_For_deduction): Don't do peculiar things with - METHOD_TYPEs here. - (resolve_overloaded_unification): Handle COMPONENT_REFs. Build - pointer-to-member types where necessary. - * tree.c (build_cplus_array_type_1): Don't avoid building real - array types when processing templates unless really necessary. - (build_exception_variant): Compare the exception lists correctly. - -1998-12-13 Mark Mitchell - - * cp-tree.def (CPLUS_BINDING): Update documentation. - * cp-tree.h (LOCAL_BINDING_P): New macro. - (lang_identifier): Rename local_value to bindings. - (tree_binding): Make `scope' of type `void*', not `tree'. - (BINDING_SCOPE): Update documentation. - (IDENTIFIER_LOCAL_VALUE): Remove. - (IDENTIFIER_CLASS_VALUE): Document. - (IDENTIFIER_BINDING): New macro. - (IDENTIFIER_VALUE): Likewise. - (TIME_IDENTIFIER_TIME): Likewise. - (TIME_IDENTIFIER_FILEINFO): Likewise. - (IMPLICIT_TYPENAME_P): Likewise. - (set_identifier_local_value): Remove. - (push_local_binding): New function. - (push_class_binding): Likewise. - * class.c (pushclass): Update comments; use push_class_binding. - * decl.c (set_identifier_local_value_with_scope): Remove. - (set_identifier_local_value): Likewise. - (push_binding): New function. - (pop_binding): Likewise. - (binding_level): Update documentation. Remove shadowed. - (BINDING_LEVEL): New macro. - (free_binding_nodes): New variable. - (poplevel): Adjust for new name-lookup scheme. Don't mess up - BLOCK_VARs when doing for-scope extension. Remove effectively - dead code. - (pushlevel_class): Tweak formatting. - (poplevel_class): Adjust for new name-lookup scheme. - (print_binding_level): Likewise. - (store_bindings): Likewise. - (pushdecl): Likewise. - (pushdecl_class_level): Likewise. - (push_class_level_binding): Likewise. - (push_overloaded_decl): Update comments. Adjust for new - name-lookup scheme. - (lookup_name_real): Likewise. - (lookup_name_current_level): Likewise. - (cp_finish_decl): Likewise. - (require_complete_types_for_parms): Likewise. Remove misleading - #if 0'd code. - (grok_parms): Likewise. Don't call - require_complete_types_for_parms here. - (grok_ctor_properties): Don't treat templates as copy - constructors. - (grop_op_properties): Or as assignment operators. - (start_function): Document. Adjust for new name-lookup scheme. - (finish_function): Likewise. - * decl2.c (do_local_using_decl): Use push_local_binding. - * lex.c (begin_definition_of_inclass_inline): New function, split - out from ... - (do_pending_inlines): Here, and ... - (process_next_inline): Here. - (get_time_identifier): Use TIME_IDENTIFIER_* macros. - (init_filename_times): Likewise. - (extract_interface_info): Likewise. - (ste_typedecl_interface_info): Likewise. - (check_newline): Likewise. - (dump_time_statistics): Likewise. - (handle_cp_pragma): Likewise. - (do_identifier): Adjust for new name-lookup scheme. - * parse.y (function_try_block): Return ctor_initializer_opt value. - (fndef): Use it. - (fn.defpen): Pass appropriate values to start_function. - (pending_inline): Use functor_try_block value, and pass - appropriate values to finish_function. - * pt.c (is_member_template): Update documentation; remove handling - of FUNCTION_DECLs. As per name, this function should deal only in - TEMPLATE_DECLs. - (decl_template_parm_p): Change name of olddecl parameter to decl. - (check_template_shadow): Adjust for new name-lookup scheme. - (lookup_template_class): Likewise. - (tsubst_decl): Tweak so as not to confuse member templates with - copy constructors and assignment operators. - (unify): Handle UNION_TYPEs. - * ptree.c (print_lang_identifier): Adjust for new name-lookup scheme. - (lang_print_xnode): Adjust for new name-lookup scheme. - * typeck.c (mark_addressable): Likewise. - (c_expand_return): Likewise. - -1998-12-08 Jason Merrill - - * decl.c (grokdeclarator): Allow field with same name as class - in extern "C". - - * decl.c (lookup_name_real): Don't limit field lookup to types. - * class.c (check_member_decl_is_same_in_complete_scope): No error - if icv and x are the same. - * lex.c (do_identifier): Tweak error message. - -1998-12-10 Mark Mitchell - - * decl.c (start_enum): Use push_obstacks, not - end_temporary_allocation. - (finish_enum): Call pop_obstacks. - -1998-12-10 Mark Mitchell - - * class.c (instantiate_type): Return error_mark_node rather than - junk. - -1998-12-09 Mark Mitchell - - * cp-tree.h (most_specialized_instantiation): New function. - (print_candidates): Likewise. - * class.c (validate_lhs): Remove. - (resolve_address_of_overloaded_function): New function, split out - and then substantially reworked, from ... - (instantiate_type): Use it. Simplify. - * cvt.c (convert_to_reference): Complain when caller has indicated - that's the right thing to do. Don't crash if instantiate_type - fails. - * pt.c: Substitute `parameters' for `paramters' throughout. - (print_candidates): Don't make it static. - (most_specialized_instantiation): Split out from ... - (most_specialized): Here. - -Wed Dec 9 15:33:01 1998 Dave Brolley - - * lex.c (lang_init_options): Initialize cpplib. - * decl2.c (parse_options,cpp_initialized): Removed. - (lang_decode_option): Move initialization of cpplib to - lang_init_options. - -1998-12-09 Mark Mitchell - - * decl.c (grokdeclarator): Update the name of the TEMPLATE_DECL, as - well as the TYPE_DECL, when a typedef name is assigned to a - previously anonymous type. - -1998-12-08 Andrew MacLeod - - * cp/except.c (call_eh_info): Use __start_cp_handler instead of - __cp_eh_info for getting the eh info pointer. Add table_index to - field list. - (push_eh_cleanup): Don't increment 'handlers' data field. - (process_start_catch_block): Don't set the 'caught' field. - - * cp/exception.cc (CP_EH_INFO): New macro for getting the - exception info pointer within library routines. - (__cp_eh_info): Use CP_EH_INFO. - (__start_cp_handler): Get exception info pointer, set caught field, - and increment the handlers field. Avoids this being done by handlers. - (__uncatch_exception, __check_eh_spec): Use CP_EH_INFO macro. - (uncaught_exception): Use CP_EH_INFO macro. - -Tue Dec 8 10:48:21 1998 Jeffrey A Law (law@cygnus.com) - - * Make-lang.in (cxxmain.o): Depend on $(DEMANGLE_H), not demangle.h - -Mon Dec 7 17:56:06 1998 Mike Stump - - * lex.c (check_newline): Add support for \ as `natural' - characters in file names in #line to be consistent with #include - handling. We support escape processing in the # 1 "..." version of - the command. See also support in cp/lex.c. - -1998-12-07 Zack Weinberg - - * cp/decl2.c: s/data/opts/ when initializing cpp_reader - structure. - -1998-12-07 Jason Merrill - - * decl.c (build_typename_type): Set DECL_ARTIFICIAL. - - * error.c (dump_simple_decl): Also print namespace context. - (dump_function_decl): Likewise. - - * decl2.c (ambiguous_decl): Don't print old value if it's - error_mark_node. - - * decl.c (lookup_name_real): Fix handling of local types shadowed - by a non-type decl. Remove obsolete code. - * cp-tree.h (DECL_FUNCTION_SCOPE_P): New macro. - - * lang-options.h: Add -fpermissive. - * decl2.c: Likewise. - * cp-tree.h: Add flag_permissive. - * decl.c (init_decl_processing): If neither -fpermissive or -pedantic - were specified, set flag_pedantic_errors. - * call.c (build_over_call): Turn dropped qualifier messages - back into pedwarns. - * cvt.c (convert_to_reference): Likewise. - * typeck.c (convert_for_assignment): Likewise. - -1998-12-05 Jason Merrill - - * decl2.c (coerce_new_type): Use same_type_p. - (coerce_delete_type): Likewise. - - * call.c (check_dtor_name): Return 1, not error_mark_node. - -1998-12-04 Jason Merrill - - * lex.c (handle_cp_pragma): Disable #pragma interface/implementation - if MULTIPLE_SYMBOL_SPACES. - - * pt.c (check_template_shadow): New fn. - * decl2.c (grokfield): Use it. - * decl.c (pushdecl): Likewise. - (pushdecl_class_level): Likewise. - (start_method): Likewise. - (xref_tag): Don't try to use 't' if we're defining. - - * call.c (check_dtor_name): Just return an error_mark_node. - * pt.c (lookup_template_class): Complain about using non-template here. - * parse.y (apparent_template_type): Not here. - - * pt.c (check_explicit_specialization): Complain about specialization - with C linkage. - - * lang-options.h: Add -f{no-,}implicit-inline-templates. - - * pt.c (convert_nontype_argument): Don't assume that any integer - argument is intended to be a constant-expression. - -1998-12-03 Mark Mitchell - - * class.c (handle_using_decl): Fix comment. Don't lookup - constructors in base classes. - (validate_lhs): Fix typo in comment. - * search.c (lookup_field_1): Don't return a USING_DECL. - - * cp-tree.h (DECL_ACCESS): Improve documentation. - - * decl.c (expand_static_init): Don't set the initialization-done - flag until the initialization is done. - -1998-12-02 Mark Mitchell - - * decl2.c (validate_nonmember_using_decl): Complain about using - declarations for class members. - -1998-11-29 Jason Merrill - - * typeck2.c (process_init_constructor): Use same_type_p. - - * decl.c (check_tag_decl): Don't warn about null decl inside a - class. - - * pt.c (unify, case OFFSET_TYPE): Pass down 'strict' rather than - UNIFY_ALLOW_NONE. - (convert_nontype_argument): Use TYPE_PTRMEMFUNC_FN_TYPE. - (resolve_overloaded_unification): Strip baselinks. - -Fri Nov 27 13:07:23 1998 Kaveh R. Ghazi - - * g++spec.c: Don't prototype xmalloc. - -1998-11-25 Jason Merrill - - * except.c (expand_throw): Use TYPE_PTR_P to check for pointers. - - * decl.c (check_tag_decl): Do complain about null friend decl at - file scope. - -1998-11-25 Andreas Schwab - - * lex.c (make_lang_type): Clear the whole struct lang_type, not - only the first multiple of sizeof (int). - -1998-11-24 Jason Merrill - - * decl.c (start_decl): An explicit specialization of a static data - member is only a definition if it has an initializer. - - * except.c (expand_throw): Use cp_finish_decl for the throw temp. - * cvt.c (build_up_reference): Pass DIRECT_BIND down into - cp_finish_decl. - * init.c (expand_default_init): Check for DIRECT_BIND instead of - DECL_ARTIFICIAL. - - * call.c (build_over_call): Use build_decl. - - * except.c (expand_throw): Just use convert, not - build_reinterpret_cast. - - * lex.c (handle_generic_pragma): Use token_buffer. - - * decl.c (check_tag_decl): Don't complain about null friend decl. - -1998-11-24 Dave Pitts - - * Make-lang.in (DEMANGLER_PROG): Move the output arguments to the - first position. - * lex.c (check_newline): Use ISALPHA. - (readescape): Use ISGRAPH. - (yyerror): Use ISGRAPH. - -1998-11-24 Nathan Sidwell - - * search.c (get_abstract_virtuals): Do not use initial - CLASSTYPE_ABSTRACT_VIRTUALS. - * typeck2.c (abstract_virtuals_error): Show location of abstract - declaration. - * call.c (build_new_method_call): Use - CLASSTYPE_ABSTRACT_VIRTUAL, rather than recalculate. - * class.c (finish_struct_bits): Don't bother working out whether - get_abstract_virtuals will do anything, just do it. - -1998-11-24 Graham - - * typeck.c (build_component_ref): Remove unused statement. - -1998-11-24 Jason Merrill - - * class.c (add_method): Catch invalid overloads. - - * class.c (add_method): Build up OVERLOADs properly for conversion ops. - * search.c (lookup_conversions): Handle getting real OVERLOADs. - (add_conversions): Likewise. Revert last change. - * call.c (add_conv_candidate): Pass totype to add_candidate instead - of fn. Don't add a new candidate if the last one was for the same - type. - (print_z_candidates): Handle getting a type as a function. - (joust): If we got two conversion candidates to the same type, - just pick one. - (build_object_call): Lose 'templates'. - (build_user_type_conversion_1): Handle getting real OVERLOADs. - -1998-11-23 Jason Merrill - - * typeck2.c (process_init_constructor): If there are elements - that don't have initializers and they need to have constructors - run, supply them with initializers. - - * class.c (finish_struct_1): A class with a 0-width bitfield is - still empty. - -1998-11-23 Mark Mitchell - - * pt.c (instantiate_class_template): Don't try to figure out what - specialization to use for a partial instantiation. Correct - typos in a couple of comments. Avoid calling uses_template_parms - multiple times. - -1998-11-23 Benjamin Kosnik - - * method.c (process_overload_item): Add call to - build_mangled_C9x_name for intTI_type_nodes. - (build_mangled_C9x_name): Add prototype, define. - * decl.c (init_decl_processing): Add names for - TImode_type_node. - -1998-11-23 Jason Merrill - - * parse.y (named_class_head): Update CLASSTYPE_DECLARED_CLASS. - - * class.c (finish_struct_1): Set things up for 0-width bitfields - like we do for others. - - * decl.c (check_tag_decl): New fn. - (shadow_tag): Split out from here. - * decl2.c (grok_x_components): Call it. - -1998-11-22 Jason Merrill - - * decl.c: Lose warn_about_return_type. - (grokdeclarator): Always complain about implicit int, except for - `main () { ... }'. - - * decl.c (tag_name): New fn. - (xref_tag): Complain about using typedef-name after class-key. - - * init.c (expand_vec_init): Also keep going if from_array. - - * tree.c (is_overloaded_fn): Also handle the output of - build_offset_ref. - - * decl.c (grokdeclarator): Use constructor_name when comparing - field name against enclosing class. - * class.c (finish_struct_anon): Likewise. - -1998-11-22 Mark Mitchell - - * decl.c (poplevel): Remove code to handle KEEP == 2. - (finish_function): Don't confuse BLOCK-order when - processing a destructor. - -1998-11-21 Jason Merrill - - * decl.c (require_complete_types_for_parms): Call layout_decl - after we've completed the type. - -1998-11-21 Martin von Löwis - - * decl2.c (validate_nonmember_using_decl): Allow using templates - from the global namespace. - -1998-11-21 Jason Merrill - - Handle specifying template args to member function templates. - * tree.c (build_overload): Always create an OVERLOAD for a template. - * search.c (add_conversions): Handle finding an OVERLOAD. - * decl2.c (check_classfn): Likewise. - * lex.c (identifier_type): See through a baselink. - * parse.y (do_id): Don't call do_identifier if we got a baselink. - * class.c (instantiate_type, case TREE_LIST): Recurse. - - * decl.c (grokdeclarator): Allow a boolean constant for array - bounds, odd as that sounds. - - * pt.c (unify): Be more strict about non-type parms, except for - array bounds. - (UNIFY_ALLOW_INTEGER): New macro. - -1998-11-19 Manfred Hollstein - - * Make-lang.in (mandir): Replace all uses of $(mandir) by $(man1dir). - -1998-11-19 Jason Merrill - - * semantics.c (begin_class_definition): Call - maybe_process_partial_specialization before push_template_decl. - Don't call push_template_decl for a specialization. - * search.c (lookup_field): Do return a member template class. - * decl2.c (handle_class_head): Handle member template classes. - - * decl.c (grokdeclarator): A parm type need not be complete. - - * pt.c (convert_nontype_argument): Fix thinko. - -1998-11-18 Mark Mitchell - - * cp-tree.h (PTRMEM_CST_CLASS): Fix typo. - (global_delete_fndecl): New variable. - * decl.c (global_delete_fndecl): Define it. - (init_decl_processing): Set it. - * init.c (build_builtin_delete_call): Use it. - * tree.c (mapcar): Recursively call mapcar for the type of EXPR - nodes. - -1998-11-18 Jason Merrill - - * decl.c (cplus_expand_expr_stmt): Always complain about unresolved - type. - - * tree.c (lvalue_p_1): An INDIRECT_REF to a function is an lvalue. - * call.c (build_object_call): Also support references to functions. - * typeck.c (convert_for_initialization): Don't decay a function - if the target is a reference to function. - - * search.c (add_conversions): Get all the overloads from a class. - - * decl.c (grok_ctor_properties): Complain about any constructor - that will take a single arg of the class type by value. - - * typeck2.c (build_functional_cast): Can't create objects of - abstract classes this way. - * cvt.c (ocp_convert): Likewise. - - * decl.c (grokfndecl): Member functions of local classes are not - public. - -1998-11-18 Mark Mitchell - - * Make-lang.in (cc1plus): Add dependency on hash.o. - -1998-11-18 Jason Merrill - - * search.c (get_abstract_virtuals): Complain about virtuals with - no final overrider. - * typeck2.c (abstract_virtuals_error): Remove handling for virtuals - with no final overrider. - * class.c (override_one_vtable): Don't set DECL_ABSTRACT_VIRTUAL_P - on virtuals with no final overrider. - - * lex.c (reinit_parse_for_block): Add a space after the initial ':'. - - * class.c (finish_struct_1): Don't remove zero-width bit-fields until - after layout_type. - - * friend.c (do_friend): Don't set_mangled_name_for_decl. - - * class.c (finish_struct_anon): Complain about non-fields. - * decl2.c (build_anon_union_vars): Likewise. - - * decl.c (grokdeclarator): Normal data members can't have the same - name as the class, either. - * class.c (finish_struct_anon): Neither can members of an - anonymous union. - -1998-11-17 Mark Mitchell - - * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses. - (TYPE_BINFO): Likewise. - (IS_AGGR_TYPE): Tweak. - (SET_IS_AGGR_TYPE): New macro. - (CLASS_TYPE_P): Tweak. - (lang_type): Group mark bitfields together. Remove linenum. - (CLASSTYPE_SOURCE_LINE): Remove macro. - (CLASSTYPE_MARKED_N): New macro. - (SET_CLASSTYPE_MARKED_N): Likewise. - (CLEAR_CLASSTYPE_MARKED_N): Likewise. - (CLASS_TYPE_MARKED_*): Use them. - (SET_CLASSTYPE_MARKED_*): Likewise. - (CLEAR_CLASSTYPE_MARKED_*): Likewise. - (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. - (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well. - (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE. - * class.c (class_cache_obstack): New variable. - (class_cache_firstobj): Likewise. - (finish_struct): Don't set CLASSTYPE_SOURCE_LINE. - (pushclass): Free the cache, when appropriate. - (popclass): Tidy. - (maybe_push_cache_obstack): Use class_cache_obstack. - * decl.c (include hash.h). - (typename_hash): New function. - (typename_compare): Likewise. - (build_typename_type): Check the hash table to avoid creating - duplicates. - (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE. - (grokdeclarator): Use CLASS_TYPE_P. - (xref_basetypes): Likewise. - (start_function): Likewise. Don't put current_class_ref on the - permanent obstack. - * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO - and TYPE_TI_ARGS. - * lex.c (note_got_semicolon): Use CLASS_TYPE_P. - (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated - fields for types other than class types. Do clear TYPE_ALIAS_SET - for types other than class types, though. - * method.c (build_overload_identifier): Use CLASS_TYPE_P and - TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. - * pt.c (process_template_parm): Don't set - CLASSTYPE_GOT_SEMICOLON. - (lookup_template_class): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. - Coerce arguments on the momentary obstack. - (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. - (instantiate_class_template): Calculate template arguments on the - momentary obstack. Tidy. - (tsubst_template_arg_vector): Use make_temp_vec. - (tsubst_aggr_type): Put template arguments on the momentary - obstack. - (tsubst_decl): Likewise. - (tsubst): Copy the array bounds index to the permanent obstack - before building index types. Use new macros. - (unify): Use new macros. - (do_type_instantiation): Likewise. - * search.c (lookup_fnfields_1): Use new macros. - (dfs_pushdecls): Build envelopes on the cache obstack. - (dfs_compress_decls): Use new macros. - (push_class_decls): Build on the cache obstack. - * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON. - * sign.c (build_signature_pointer_or_reference_type): Use - SET_IS_AGGR_TYPE. - * tree.c (make_binfo): Check CLASS_TYPE_P. - (copy_template_template_parm): Adjust. - (make_temp_vec): Use push_expression_obstack. - * typeck.c (complete_type): Use new macros. - (comptypes): Likewise. - -1998-11-17 Jason Merrill - - * pt.c (tsubst): Add diagnostics for invalid array, reference - and pointer to member types. - -1998-11-16 Jason Merrill - - * typeck2.c (my_friendly_abort): Don't fatal twice in a row. - - * typeck.c (c_expand_start_case): Use build_expr_type_conversion. - Simplify. - - * parse.y (structsp): Fix cut-and-paste error. - - * init.c (build_new): Complain about non-integral size. - - * parse.y (unary_expr): Complain about defining types in sizeof. - - * typeck.c (expr_sizeof): Complain about sizeof an overloaded fn. - - * rtti.c (build_x_typeid): Complain about typeid without - including . - (get_typeid): Likewise. Complain about typeid of incomplete type. - (get_tinfo_fn_dynamic): Likewise. - (get_typeid_1): Not static anymore. - * except.c (build_eh_type_type): Use get_typeid_1. - - * rtti.c (build_dynamic_cast_1): Give errors for dynamic_cast to - ambiguous or private bases. Fix warning for reference cast. - -1998-11-16 Mark Mitchell - - * cp-tree.h (DECL_TEMPLATE_INSTANTIATED): New macro. - * decl.c (duplicate_decls): Remove special-case code to deal with - template friends, and just do the obvious thing. - * pt.c (register_specialization): Tweak for clarity, and also to - clear DECL_INITIAL for an instantiation before it is merged with a - specialization. - (check_explicit_specialization): Fix indentation. - (tsubst_friend_function): Handle both definitions in friend - declaration and outside friend declarations. - (tsubst_decl): Don't clear DECL_INITIAL for an instantiation. - (regenerate_decl_from_template): Tweak accordingly. - (instantiate_decl): Likewise. - -1998-11-16 Jason Merrill - - * decl.c (cplus_expand_expr_stmt): Promote warning about naked - member function reference to error. - * cvt.c (ocp_convert): Complain about converting an overloaded - function to void. - - * init.c (build_offset_ref): Just return a lone static member - function. - - * decl.c (cp_finish_decl): Only complain about real CONSTRUCTORs, - not internal ones. - - * typeck.c (build_binary_op_nodefault): Improve error handling. - - * decl.c (grokfndecl): Complain about making 'main' a template. - - * typeck.c (string_conv_p): Don't convert from wchar_t[] to char*. - - * call.c (build_method_call): Handle a BIT_NOT_EXPR around a - TYPE_DECL in a template. - -1998-11-15 Jason Merrill - - * typeck2.c (my_friendly_abort): Add URL in the other case, too. - - * decl.c (struct cp_function): Add named_label_uses. - (push_cp_function_context): Save it. - (pop_cp_function_context): Restore it. - (define_label): Also complain about jumping into the scope of - non-POD objects that don't have constructors. - * tree.c (pod_type_p): New fn. - - * pt.c (instantiate_class_template): Clear TYPE_BEING_DEFINED sooner. - * rtti.c (synthesize_tinfo_fn): Call import_export_decl here. - (get_tinfo_fn): Not here. - * repo.c (repo_get_id): Abort if we get called for an incomplete - type. - -1998-11-13 Mark Mitchell - - * except.c (expand_throw): Make sure first argument to - __cp_push_exception is of type `void*' to avoid spurious error - messages. - -1998-11-11 Jason Merrill - - * pt.c (try_one_overload): Take orig_targs again. Only check for - mismatches against them; we don't care what a previous call found. - (resolve_overloaded_unification): Adjust. - - * search.c (lookup_field): Don't return anything for a non-type - field from a dependent type. - * decl.c (grokdeclarator): Resolve SCOPE_REFs of the current class - in an array declarator. - (start_decl): Push into the class before looking for the field. - -1998-11-08 Mark Mitchell - - * method.c (build_overload_value): Handle REFERENCE_TYPE. - -1998-11-08 Martin von Löwis - - * decl.c (grokdeclarator): Allow namespace-scoped members if they - are friends. - -1998-11-08 Jason Merrill - - * pt.c (tsubst_decl): Don't mess with the global value of an - un-mangled DECL_ASSEMBLER_NAME. - -1998-11-03 Christopher Faylor - - * decl.c (init_decl_processing): Remove CYGWIN conditional - since CYGWIN is now able to deal with trapping signals. - -Sat Nov 7 15:48:02 1998 Kaveh R. Ghazi - - * cp-tree.h: Don't include gansidecl.h. - * exception.cc: Include gansidecl.h (since we don't include config.h) - * g++spec.c: Don't include gansidecl.h. - -1998-11-06 Mark Mitchell - - * cp-tree.h (lang_decl_flags): Add defined_in_class. Decrease - size of dummy. - (DECL_DEFINED_IN_CLASS_P): New macro. - (TEMPLATE_PARMS_FOR_INLINE): Document. - (check_static_variable_definition): New function. - * decl.c (cp_finish_decl): Set DECL_DEFINED_IN_CLASS_P, if - appropriate. - (check_static_variable_definition): Split out from ... - (grokdeclarator): Here. - * pt.c (check_default_tmpl_args): New function, split out from ... - (push_template_decl_real): Here. - (instantiate_template): Fix comment. - -1998-11-04 Mark Mitchell - - * cp-tree.h (CP_TYPE_CONST_P): Make {0,1}-valued. - (CP_TYPE_VOLATILE_P): Likewise. - (CP_TYPE_RESTRICT_P): Likewise. - -1998-11-03 Mark Mitchell - - * pt.c (tsubst): Use build_index_type, not build_index_2_type. - -1998-11-02 Jason Merrill - - * class.c (instantiate_type): Be more helpful. - - * decl2.c (import_export_decl): Call import_export_class. - - * cp-tree.h (EMPTY_CONSTRUCTOR_P): Check !TREE_HAS_CONSTRUCTOR. - * decl2.c (build_expr_from_tree): Propagate TREE_HAS_CONSTRUCTOR. - * pt.c (tsubst_copy): Likewise. - -1998-11-02 Mark Mitchell - - * init.c (expand_vec_init): Fix off-by-one error. - -1998-11-02 Alexandre Oliva - - * parse.y (apparent_template_type): New type. - (named_complex_class_head_sans_basetype): Use it. - * Makefile.in (CONFLICTS): One new conflict. - * parse.c: Regenerated. - -1998-11-01 Mark Mitchell - - * cp-tree.h (COMPARE_STRICT): New macro. - (COMPARE_BASE): Likewise. - (COMPARE_RELAXED): Likewise. - (COMPARE_REDECLARATION): Likewise. - (same_type_p): Likewise. - (same_or_base_type_p): Likewise. - * call.c (standard_conversion): Use them, in place of comptypes - with numeric arguments. - (reference_binding): Likewise. - (convert_like): Likewise. - (build_over_call): Likewise. - (is_subseq): Likewise. - (is_properly_derived_from): Likewise. - (compare_ics): Likewise. - (joust): Likewise. - * class.c (delete_duplicate_fields_1): Likewise. - (resolves_to_fixed_type_p): Likewise. - (instantiate_type): Likewise. Remove #if 0'd code. - * decl.c (decls_match): Likewise. Use COMPARE_REDECLARATION here. - (pushdecl): Likewise. - (lookup_name_real): Likewise. - (grokdeclarator): Likewise. Check for illegal array declarations. - (grokparms): Likewise. - (grok_op_properties): Likewise. - * decl2.c (check_classfn): Likewise. - * friend.c (is_friend): Likewise. - (make_friend_class): Likewise. - * init.c (expand_aggr_init): Likewise. - (expand_vec_init): Likewise. - * pt.c (is_member_template_class): Remove declaration. - (is_specialization_of): Use COMPARE_* and new macros. - (comp_template_parms): Likewise. - (convert_nontype_argument): Likewise. - (coerce_template_template_parms): Likewise. - (template_args_equal): Likewise. - (lookup_template_class): Likewise. - (type_unification_real): Likewise. - (unify): Likewise. - (get_bindings_real): Likewise. - * search.c (covariant_return_p): Likewise. - (get_matching_virtual): Likewise. - * sig.c (match_method_types): Likewise. - * tree.c (vec_binfo_member): Likewise. - (cp_tree_equal): Likewise. - * typeck.c (common_type): Likewise. - (comp_array_types): Likewise. Get issues involving unknown array - bounds right. - (comptypes): Update comments. Use new flags. - (comp_target_types): Use new macros. - (compparms): Likewise. - (comp_target_parms): Likewise. - (string_conv_p): Likewise. - (build_component_ref): Likewise. - (build_indirect_ref): Likewise. - (build_conditional_expr): Likewise. - (build_static_cast): Likewise. - (build_reinterpret_cast): Likewise. - (build_const_cast): Likewise. - (build_modify_expr): Likewise. - (convert_for_assignment): Likewise. - (comp_ptr_ttypes_real): Likewise. - (ptr_reasonably_similar): Likewise. - (comp_ptr_ttypes_const): Likewise. - -1998-10-31 Jason Merrill - - * rtti.c (build_dynamic_cast_1): Fix cut-and-paste error. - -1998-10-30 Mark Mitchell - - * decl2.c (delete_sanity): Pass integer_zero_node, not - integer_two_node, to build_vec_delete. - * init.c (build_array_eh_cleanup): Remove. - (expand_vec_init_try_block): New function. - (expand_vec_init_catch_clause): Likewise. - (build_vec_delete_1): Don't deal with case that auto_delete_vec - might be integer_two_node anymore. - (expand_vec_init): Rework for initialization-correctness and - exception-correctness. - * typeck2.c (process_init_constructor): Make mutual exclusivity - of cases more obvious. - -1998-10-29 Jason Merrill - - * decl.c (lookup_name_real): OK, only warn if not lexing. - Simplify suggested fix. - - * cp-tree.h (IDENTIFIER_MARKED): New macro. - * search.c (lookup_conversions): Use breadth_first_search. - (add_conversions): Avoid adding two conversions to the same type. - (breadth_first_search): Work with base binfos, rather - than binfos and base indices. - (get_virtual_destructor): Adjust. - (tree_has_any_destructor_p): Adjust. - (get_matching_virtual): Adjust. - - * pt.c (push_template_decl_real): Generalize check for incorrect - number of template parms. - (is_member_template_class): #if 0. - -1998-10-29 Richard Henderson - - * Makefile.in (cc1plus): Put CXX_OBJS, and thence @extra_cxx_objs@, - last. - -1998-10-28 Zack Weinberg - - * lex.c: Call check_newline from lang_init always. After - calling cpp_start_read, set yy_cur and yy_lim to read from the - cpplib token buffer. - -1998-10-28 Jason Merrill - - * class.c (instantiate_type): Don't consider templates for a normal - match. - - * class.c (finish_struct_1): Don't complain about non-copy - assignment ops in union members. - - * class.c (build_vtable): Don't pass at_eof to import_export_vtable. - (prepare_fresh_vtable): Likewise. - (finish_struct_1): Don't call import_export_class. - * decl2.c (finish_vtable_vardecl): Do import/export stuff. - (finish_prevtable_vardecl): Lose. - (finish_file): Don't call it. - * pt.c (instantiate_class_template): Likewise. - * cp-tree.h: Remove it. - - * init.c (build_delete): Reset TYPE_HAS_DESTRUCTOR here. - * decl.c (finish_function): Not here. - (start_function): Do set DECL_INITIAL. - - * pt.c (push_template_decl_real): Complain about default template - args for enclosing classes. - - * call.c (add_function_candidate): Treat conversion functions - as coming from the argument's class. - * cp-tree.h (DECL_CONV_FN_P): New fn. - (DECL_DESTRUCTOR_P): Also check DECL_LANGUAGE. - * class.c (add_method): Use DECL_CONV_FN_P. - * decl2.c (check_classfn): Likewise. - * error.c (dump_function_name): Likewise. - (dump_function_decl): Likewise. - * pt.c (fn_type_unification): Likewise. - * search.c (add_conversions): Likewise. - -1998-10-27 Jason Merrill - - * lex.c (do_identifier): Also generate LOOKUP_EXPR for RESULT_DECL. - * method.c (hack_identifier): Also check for using RESULT_DECL - from outer context. - -1998-10-27 Mark Mitchell - - * decl.c (grokdeclarator): Use type_quals, rather than constp, - consistently. - -1998-10-27 Jason Merrill - - * call.c (standard_conversion): instantiate_type here. - (reference_binding): And here. - (implicit_conversion): Not here. - (build_op_delete_call): No need to cons up an OVERLOAD. - * cvt.c (cp_convert_to_pointer): instantiate_type here. - (convert_to_reference): And here. - * decl.c (grok_reference_init): Not here. - (grokparms): Or here. - * typeck2.c (digest_init): Or here. - * typeck.c (decay_conversion): Take the address of overloaded - functions, too. - (require_instantiated_type): Lose. - (convert_arguments): Don't handle unknown types here. - (build_c_cast): Likewise. - (build_binary_op): Gut. - (build_conditional_expr): Don't require_instantiated_type. - (build_modify_expr): Likewise. - (build_static_cast): Don't instantiate_type. - (build_reinterpret_cast): Likewise. - (build_const_cast): Likewise. - (convert_for_initialization): Likewise. - (build_ptrmemfunc): Use type_unknown_p. - (convert_for_assignment): Also do default_conversion on overloaded - functions. Hand them off to ocp_convert. - -1998-10-26 Mark Mitchell - - * error.c (dump_decl): Deal with TEMPLATE_DECLs that are - VAR_DECLs. Handle vtables whose DECL_CONTEXT is not a type. - - * class.c (finish_struct_1): Use build_cplus_array_type to build - array types. - * decl.c (init_decl_processing): Likewise. - * except.c (expand_end_eh_spec): Likewise. - * search.c (expand_upcast_fixups): Simplify very slightly. - -1998-10-26 Jason Merrill - - * decl.c (grokdeclarator): Complain about a variable using - constructor syntax coming back null from start_decl. - - * friend.c (make_friend_class): Complain about trying to make - a non-class type a friend. - - * decl.c (grokfndecl): Set DECL_INITIAL for a defn here. - (start_function): Not here. - -1998-10-26 Brendan Kehoe - - * decl.c (grokdeclarator): Disallow `explicit' in a friend declaration. - -1998-10-26 Jason Merrill - - * typeck2.c (process_init_constructor): Only skip anonymous fields - if they are bitfields. - - * cp-tree.def (TYPEOF_TYPE): New code. - * error.c (dump_type_real): Handle it. - * pt.c (tsubst): Likewise. - * tree.c (search_tree): Likewise. - * semantics.c (finish_typeof): New fn. - * parse.y (typespec): Use it. - * cp-tree.h: Declare it. - -1998-10-26 Manfred Hollstein - - * cp-tree.h (FORMAT_VBASE_NAME): Make definition unconditional. - -1998-10-26 Jason Merrill - - * typeck.c (convert_arguments): Don't handle pmf references - specially. - - * init.c (build_member_call): Don't try to convert to the base type - if it's ambiguous or pedantic. - - * typeck2.c (check_for_new_type): Only depend on pedantic for - C-style casts. - -1998-10-25 Mark Mitchell - - * decl.c (grokdeclarator): Set DECL_NONCONVERTING_P for all - non-converting constructors. - -1998-10-24 Martin von Löwis - - * gxxint.texi: Correct documentation for n, N, Q, and B. - -1998-10-23 Martin von Löwis - - * parse.y (condition): Convert VAR_DECL from reference to indirect - reference. - -1998-10-23 Andrew MacLeod - - * exception.cc (__cp_pop_exception): Free the original exception - value, not the potentially coerced one. - -1998-10-23 Mark Mitchell - - * Makefile.in (hash.h): Run gperf when necessary. - - * cp-tree.h (CP_TYPE_READONLY): Remove. - (CP_TYPE_VOLATILE): Likewise. - (CP_TYPE_QUALS): New macro. - (CP_TYPE_CONST_P): Likewise. - (CP_TYPE_VOLATILE_P): Likewise. - (CP_TYPE_RESTRICT_P): Likewise. - (CP_TYPE_CONST_NON_VOLATILE_P): Likewise. - (cp_build_type_variant): Rename to ... - (cp_build_qualified_type): New function. - (c_apply_type_quals_to_decl): Declare. - (SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'. - (SIGNATURE_REFERENCE_NAME_FORMAT): Likewise. - (cp_type_qual_from_rid): New function. - (compparms): Remove unused parameter. All callers changed. - (cp_type_quals): New function. - (at_least_as_qualified_p): Likewise. - (more_qualified_p): Likewise. - - * call.c (standard_conversion): Replace calls to - cp_build_type_variant with cp_build_qualified_type. Use - CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to - compare them. Use CP_TYPE_* macros to check qualifiers. - (reference_binding): Likewise. - (implicit_conversion): Likewise. - (add_builtin_candidates): Likewise. - (build_over_call): Likewise. - * class.c (overrides): Compare all qualifiers, not just `const', - on method declarations. - * cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc. - (convert_pointer_to_real): Likewise. - (type_promotes_to): Likewise. - * decl.c (check_for_uninitialized_const_var): New function. - (init_decl_processing): More CP_TYPE_QUALS conversion, etc. - (cp_finish_decl): Use check_for_uninitialized_const_var. - (grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to - handle `restrict'. - (grok_ctor_properties): Likewise. - (grok_op_properties): Likewise. - (start_function): Likewise. - (rever_static_member_fn): Likewise. - * decl2.c (grok_method_quals): Likewise. - (grokfield): Likewise. - * error.c (dump_readonly_or_volatile): Rename to ... - (dump_qualifiers): New function. Handle `restrict'. - (dump_type_real): Use it. - (dump_aggr_type): Likewise. - (dump_type_prefix): Likewise. - (dump_type_suffix): Likewise. - (dump_function_decl): Likewise. - (cv_as_string): Likewise. - * gxx.gperf: Add __restrict and __restrict__. - * gxxint.texi: Document `u' as used for `__restrict', and a few - other previously undocumented codes. - * hash.h: Regenerated. - * init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc. - (build_member_call): Likewise. - (build_new_1): Likewise. - * lex.c (init_parse): Add entry for RID_RESTRICT. - (cons_up_default_function): More CP_TYPE_QUALS conversion, etc. - (cp_type_qual_from_rid): Define. - * lex.h (enum rid): Add RID_RESTRICT. - * method.c (process_modifiers): Deal with `restrict'. - * parse.y (primary): More CP_TYPE_QUALS conversion, etc. - * parse.c: Regenerated. - * pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc. - (tsubst_aggr_type): Likewise. - (tsubst): Likewise. - (check_cv_quals_for_unify): Likewise. - (unify): Likewise. - * rtti.c (init_rtti_processing): Likewise. - (build_headof): Likewise. - (get_tinfo_var): Likewise. - (buidl_dynamic_cast_1): Likewise. Fix `volatile' handling. - (expand_class_desc): Likewise. - (expand_attr_desc): Likewise. - (synthesize_tinfo_fn): Likewise. - * search.c (covariant_return_p): Likewise. Fix `volatile' handling. - (get_matching_virtual): Likewise. - (expand_upcast_fixups): Likewise. - * sig.c (build_signature_pointer_or_reference_name): Take - type_quals, not constp and volatilep. - (build_signature_pointer_or_reference_type): Likewise. - (match_method_types): More CP_TYPE_QUALS conversion, etc. - (build_signature_pointer_constructor): Likewise. - (build_signature_method_call): Likewise. - * tree.c (build_cplus_array_type): Likewise. - (cp_build_type_variant): Rename to ... - (cp_build_qualified_type): New function. Deal with `__restrict'. - (canonical_type_variant): More CP_TYPE_QUALS conversion, etc. - (build_exception_variant): Likewise. - (mapcar): Likewise. - * typeck.c (qualif_type): Likewise. - (common_type): Likewise. - (comptypes): Likewise. - (comp_cv_target_types): Likewise. - (at_least_as_qualified_p): Define. - (more_qualified_p): Likewise. - (comp_cv_qualification): More CP_TYPE_QUALS conversion, etc. - (compparms): Likewise. - (inline_conversion): Likewise. - (string_conv_p): Likewise. - (build_component_ref): Likewise. - (build_indirect_ref): Likewise. - (build_array_ref): Likewise. - (build_unary_op): Likewise. - (build_conditional_expr): Likewise. - (build_static_cast): Likewise. - (build_c_cast): Likewise. - (build_modify_expr): Likewise. - (convert_For_assignment): Likewise. - (comp_ptr_ttypes_real): Likewise. - (cp_type_quals): New function. - -1998-10-23 Jason Merrill - - * cp-tree.h (CP_TYPE_READONLY): New macro to handle arrays. - (CP_TYPE_VOLATILE): Likewise. - * decl.c (grokdeclarator): Use them. - * tree.c (canonical_type_variant): Likewise. - -1998-10-22 Martin von Löwis - - * parse.y (named_class_head): Push into class while parsing the - base class list. - * decl2.c (push_scope, pop_scope): New functions. - * cp-tree.h: Declare them. - * init.c (build_new_1): Delay cleanup until end of full expression. - -1998-10-21 Jason Merrill - - * typeck.c (build_component_ref): Use of a type here is an error. - -1998-10-19 Jason Merrill - - Revamp references to member functions. - * method.c (hack_identifier): Call build_component_ref for a - reference to a member function. - * typeck.c (build_component_ref): Only return a single function - if it's static. Otherwise, return a COMPONENT_REF. - (build_x_function_call): Handle a COMPONENT_REF. - (build_unary_op): Handle all unknown-type things. - * decl2.c (arg_assoc): Handle COMPONENT_REF. - * class.c (instantiate_type): Complain if the function we get is a - nonstatic member function. Remove code for finding "compatible" - functions. - * pt.c (tsubst_copy): Handle NOP_EXPR. - * tree.c (build_dummy_object): New fn. - (maybe_dummy_object): New fn. - (is_dummy_object): New fn. - * cp-tree.h: Declare them. - * cvt.c (cp_convert_to_pointer): Use maybe_dummy_object. - * error.c (dump_expr, case OFFSET_REF): Use is_dummy_object. - * init.c (build_member_call): Use maybe_dummy_object and - is_dummy_object. - (build_offset_ref): Use maybe_dummy_object. - (resolve_offset_ref): Use is_dummy_object. - * typeck.c (build_x_function_call): Call build_dummy_object. - (unary_complex_lvalue): Call is_dummy_object. - - * typeck.c (build_component_addr): Make sure field is a field. - - * call.c (build_new_op): Delete obsolete code. - - * pt.c (tsubst, TEMPLATE*PARM*): Abort if we don't have any args. - -1998-10-18 Martin von Löwis - - * decl2.c (validate_nonmember_using_decl): Fix using-directives of - std if std is ignored. - -1998-10-18 Jason Merrill - - * decl.c (grokvardecl): Fix thinko. - - * decl.c (grokdeclarator): Embedded attrs bind to the right, - not the left. - - * parse.y (fn.def2): Fix 'attrs' format. - -1998-10-18 Alastair J. Houghton - - * Makefile.in (CONFLICTS): Update. - * parse.y (expr_or_declarator_intern): New rule. - (expr_or_declarator, direct_notype_declarator, primary, - functional_cast): Use it. - (notype_declarator_intern): New rule. - (notype_declarator, complex_notype_declarator): Use it. - -1998-10-17 Jason Merrill - - * decl.c (grokfndecl): Set DECL_CONTEXT to namespace if appropriate. - (grokvardecl): Likewise. - -Sat Oct 17 23:27:20 1998 Kaveh R. Ghazi - - * class.c (make_method_vec): Cast 1st argument of `bzero' to (PTR). - (add_method): Likewise for arguments 1 & 2 of `bcopy'. - - * decl.c (signal_catch): Mark with ATTRIBUTE_NORETURN. - - * pt.c (process_partial_specialization): Cast 1st argument of - `bzero' to (PTR). - - * tree.c (build_base_fields): Cast `base_align' to (int) when - comparing against one. - -1998-10-16 Mark Mitchell - - * decl.c (lookup_name_real): Handle template parameters for member - templates where said parameters have the same name as the - surrounding class. - - * decl.c (expand_static_init): Build cleanups before entering the - anonymous function used to do them to avoid access-checking - confusion. - - * decl.c (grokfndecl): Add back call to cplus_decl_attributes - accidentally removed by previous change, and make DECL_RTL here. - * class.c (add_method): Don't make DECL_RTL here. - - * pt.c (for_each_template_parm): Don't examine uninstantiated - default arguments. - -1998-10-16 Dave Brolley - - * lex.c (real_yylex): Fix unaligned access of wchar_t. - -1998-10-16 Mark Mitchell - - * class.c (add_method): Fix documentation to reflect previous - changes. Check for duplicate method declarations here. - * decl.c (decls_match): Handle FUNCTION_DECL vs TEMPLATE_DECL - correctly; such things never match. - (grokfndecl): Don't look for duplicate methods here. - * decl2.c (check_classfn): Don't assume names are mangled. - Don't add bogus member function declarations to a class before the - class type is complete. - (grokfield): Reformat error message. - * method.c (set_mangled_name_for_decl): Don't mangle names while - processing_template_decl. - -1998-10-16 Jason Merrill - - * typeck.c (build_indirect_ref): Complain about a pointer to data - member, too. - * typeck2.c (build_m_component_ref): Don't indirect a pointer to - data member. - * init.c (resolve_offset_ref): Don't undo the above. - - * cp-tree.h (DECL_C_BIT_FIELD, SET_DECL_C_BIT_FIELD): New macros. - (struct lang_decl_flags): Add `bitfield'. - * class.c (finish_struct_1): Use DECL_C_BIT_FIELD instead of - DECL_BIT_FIELD. - * decl2.c (grokbitfield, grok_alignof): Likewise. - * init.c (build_offset_ref): Likewise. - * typeck.c (build_component_addr, expr_sizeof): Likewise. - * cvt.c (build_up_reference): Don't crash if taking the address - returns error_mark_node. - - * decl.c (grokfndecl): Also check ctype when checking for ::main(). - -1998-10-15 Jason Merrill - - * decl.c (grokfndecl): ::main and __builtin_* get C linkage. - Do mangling here. - (grokdeclarator): Instead of here. - * friend.c (do_friend): Lose special handling of ::main and - __builtin_*. - * cp-tree.h (DECL_MAIN_P): Check for C linkage. - - * spew.c (yylex): Clear looking_for_typename if we got - 'enum { ... };'. - -1998-10-15 Mark Mitchell - - * class.c (maybe_warn_about_overly_private_class): Improve error - messages for class with only private constructors. - - * cp-tree.def (TYPENAME_TYPE): Add to documentation. - * cp-tree.h (TYPENAME_TYPE_FULLNAME): Document. - (build_typename_type): New function. - * decl.c (build_typename_type): Broken out from ... - (make_typename_type): Use it. - * search.c (lookup_field): Likewise. - -1998-10-14 Benjamin Kosnik - - * pt.c (convert_nontype_argument): Check against type_referred_to. - * decl.c (grokvardecl): Check for declarator name before building - DECL_ASSEMBLER_NAME. - -1998-10-14 Mark Mitchell - - * pt.c (lookup_template_class): Add comment. - (instantiate_class_template): Don't mark the _TYPE node for - member class templates as an instantiation. - -1998-10-14 Jason Merrill - - * decl.c (grokfndecl): Fix my thinko. - -1998-10-13 Jason Merrill - - * tinfo2.cc (fast_compare): Remove. - (before): Just use strcmp. - * tinfo.cc (operator==): Just use strcmp. - -1998-10-13 Klaus-Georg Adams - - * decl.c (grokfndecl): Don't check for linkage in `extern "C"' - declarations. - -1998-10-13 Mark Mitchell - - * cp-tree.h (specializations_of_same_template_p): Remove. - * search.c (get_template_base): Don't use it. - (get_template_base_recursive): Likewise. - * pt.c (specializations_of_same_template_p): Remove. - (unify): Don't use it. - (lookup_template_class): Find the correct parent when setting - CLASSTYPE_TI_TEMPLATE. - -1998-10-12 Jason Merrill - - * tinfo.cc (operator==): Always compare names. - -1998-10-12 Herman ten Brugge - - * decl.c (start_function): Fix cut-and-paste error. - -1998-10-12 Jason Merrill - - * inc/typeinfo: Add #pragma interface. - (operator!=): Just call operator==. - * tinfo.cc: Add #pragma implementation. - (operator==): Move from inc/typeinfo and tinfo2.cc. - Check __COMMON_UNRELIABLE instead of _WIN32. - - * typeck2.c (my_friendly_abort): Add URL. - -1998-10-12 Alastair J. Houghton - - * decl.c (start_method): Added extra parameter for attributes. - * cp-tree.h (start_method): Update prototype. - * parse.y (fn.def2): Update start_method parameter list. - -1998-10-11 Mark Mitchell - - * cp-tree.h (specializations_of_same_template_p): Declare. - * pt.c (specializations_of_same_template_p): New function. - (unify): Use it. - * search.c (get_template_base): Use it. - (get_template_base_recursive): Likewise. - -1998-10-10 Manfred Hollstein - - * decl2.c (start_objects): Add new variable `joiner' and - initialize it properly. - -1998-10-09 Mark Mitchell - - * search.c (expand_upcast_fixups): Tweak to match 1998-10-07 - change to vtable types. - - * cvt.c (ocp_convert): Avoid infinite recursion caused by - 1998-10-03 change. - -1998-10-08 Jason Merrill - - * pt.c (resolve_overloaded_unification): New fn. - (try_one_overload): Likewise. - (unify): Don't fail on unknown type. - (type_unification_real): Likewise. Use resolve_overloaded_unification - to handle an overloaded argument. - (template_args_equal): Split out... - (comp_template_args): From here. - (determine_specialization): Also allow a template with more - parms than were explicitly specified. - * cp-tree.h: Add template_args_equal. - * call.c (resolve_args): Remove TEMPLATE_ID_EXPR code. - -Thu Oct 8 15:58:30 1998 Anthony Green - - * semantics.c (finish_asm_stmt): Revert my 1998-09-28 - change. - -Thu Oct 8 06:00:19 1998 Jeffrey A Law (law@cygnus.com) - - * typeck.c (unsigned_type): Only return TItype nodes when - HOST_BITS_PER_WIDE_INT is >= 64 bits. - (signed_type): Likewise. - * decl.c (intTI_type_node, unsigned_intTI_type_node): Only declare - when HOST_BITS_PER_WIDE_INT is >= 64 bits. - (init_decl_processing): Only create TItype nodes when - HOST_BITS_PER_WIDE_INT is >= 64 bits. - * cp-tree.h (intTI_type_node, unsigned_intTI_type_node): Only declare - when HOST_BITS_PER_WIDE_INT is >= 64 bits. - -Wed Oct 7 12:32:44 1998 Kaveh R. Ghazi - - * Makefile.in (hash.h): Add -L KR-C -F ', 0, 0' flags to gperf. - (gxx.gperf): Update comments describing invocation flags. - (hash.h): Regenerate using gperf 2.7.1 (19981006 egcs). - -1998-10-07 Mark Mitchell - - * class.c (finish_struct_1): Add commentary on previous change. - - * cp-tree.h (vtbl_ptr_type_node): New variable. - * class.c (build_vtbl_ref): Don't indirect through the vptr; it's - already of the right type. - (finish_struct_1): Make the vptr be of type vtbl_ptr_type_node. - Simplify code to grow vtable. - * decl.c (vtbl_ptr_type_node): Define. - (init_decl_processing): Initialize it. - -1998-10-06 Mark Mitchell - - * cp-tree.def (PTRMEM_CST): New tree node. - * cp-tree.h (ptrmem_cst): New type. - (lang_type): Remove local_typedecls. - (dummy): Increase to 12 bits from 11. - (CLASSTYPE_LOCAL_TYPEDECLS): Remove. - (PTRMEM_CST_CLASS): New macro. - (PTRMEM_CST_MEMBER): Likewise. - (current_access_specifier): New variable. - (current_class_type): Remove duplicate declaration. - (finish_struct): Change prototype. - (unreverse_member_declarations): New function. - (pushdecl_class_level): Change prototype. - (grok_enum_decls): Remove. - (fixup_anonymous_union): New function. - (grok_x_components): Change prototype. - (tsubst_chain): Remove. - (finish_member_template_decl): Likewise. - (check_explicit_specialization): Fix indentation. - (finish_class_definition): Change prototype. - (finish_member_class_template): Likewise. - (finish_member_declaration): New function. - (check_multiple_declarators): Likewise. - * class.c (class_stack_node_t): New type. - (current_class_base): Remove. - (current_class_stack): Change type. - (current_access_specifier): New variable. - (grow_method): Remove. - (check_member_decl_is_same_in_complete_scope): Break out from - finish_struct. - (make_method_vec): New function. - (free_method_vec): Likewise. - (add_implicitly_declared_members): Break out from finish_struct_1. - (free_method_vecs): New variable. - (add_method): Rework for direct use from parser. - (handle_using_decl): Watch for NULL_TREE while iterating through - CLASSTYPE_METHOD_VEC. - (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; - just do some error-checking. - (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. - (finish_struct_1): Simplify. Use add_implicitly_declared_members. - (finish_struct): Change prototype. Simplify; fields and methods - are already set up at this point. - (init_class_processing): Set up current_class_stack. - (pushclass): Save current_access_specifier. - (popclass): Restore it. - (currently_open_class): Simplify. - (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. - * decl.c (saved_scope): Add access_specifier. - (maybe_push_to_top_level): Save it. - (pop_from_top_level): Restore it. - (maybe_process_template_type_declaration): Use - finish_member_declaration. - (pushtag): Likewise. - (pushdecl_class_level): Don't return a value. - (fixup_anonymous_union): Break out from grok_x_components. - (shadow_tag): Use it. - (xref_tag): Complain about using an elaborated type specifier to - reference a template type parameter or typedef name. - (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. - (current_local_enum): Remove. - (build_enumerator): Call finish_member_declaration. - (grok_enum_decls): Remove. - * decl2.c (grok_x_components): Simplify. - (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. - (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. - (merge_functions): Add to comment. - (arg_assoc_type): Prototype. - (arg_assoc): Pass as many arguments as there are parameters. - * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of - OFFSET_REF. - * expr.c (cpls_expand_expr): Remove dead code. Handle - PTRMEM_CST. - * friend.c (do_friend): Lookup friends when in nested classes. - Change comments. - * init.c (build_offset_ref): Do lookup even for classes that are - only partially defined. - (decl_constant_value): Remove dead code. - * method.c (build_overload_value): Remove hack where by TYPE was - not a TYPE. Handle PTRMEM_CST. - (build_template_parm_names): Don't pass a PARM_DECL where a TYPE - should go. - * parse.y (components, notype_components, component_decl, - component_decl_1, component_declarator, component_declarator0): - Now all are itype rather than ttype. Rework to add members to - classes on the fly. - (typesqpecqual_reserved): Use check_multiple_declarators. - (structsp): Update class to finish_class_definition. - (do_xref_defn): Unsplit into named_class_head. - (access_specifier): Set current_access_specifier. - * pt.c (set_current_access_from_decl): New function. - (finish_member_template_decl): Don't take the parameters. - (comp_template_args): Make more robust. - (lookup_template_class): Don't use current_local_enum. - (for_each_template_parm): Handle PTRMEM_CST. - (instantiate_class_template): Use set_current_access_from_decl, - finish_member_declaration and unreverse_member_declarations. Set - lineno/input_filename before generating implicit member functions. - (type_unification_real): Don't assume back-unification happens - only for the last argument. - (regenerate_decl_from_template): Call pushclass a bit earlier. - (tsubst_chain): Remove. - (tsubst_enum): Use set_current_access_from_decl. - (set_mangled_name_for_template_decl): Fix indentation. - * search.c (lookup_fnfields_1): Change iteration through - CLASSTYPE_METHOD_VEC. - (dfs_pushdecls): Likewise. - (dfs_compress_decls): Likewise. - (add_conversions): Likewise. - * semantics.c (finish_class_definition): Don't take components. - Change call to finish_struct. - (finish_member_declaration): New function. - (finish_member_class_template): Don't take template parameters. - Change call to grok_x_components. Call finish_member_template_decl. - (check_multiple_declarators): New function. - * sig.c (append_signature_fields): Work from the TYPE_METHODS, not - a passed in fieldlist. - * tree.c (search_tree): Handle PTRMEM_CST. - (mapcar): Likewise. - * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not - INTEGER_CSTs, for pointer-to-data members. - - * call.c (resolve_args): Resolve template specializations, if - possible. - -Tue Oct 6 07:57:26 1998 Kaveh R. Ghazi - - * Makefile.in (spew.o): Depend on toplev.h. - - * call.c (compare_ics): Initialize variables `deref_from_type2', - `deref_to_type1' and `deref_to_type2'. - - * except.c (get_eh_type): Hide prototype and definition. - (process_start_catch_block_old): Remove unused static prototype. - - * pt.c (tsubst_decl): Initialize variable `argvec'. - - * spew.c: Include toplev.h. - -1998-10-05 Jason Merrill - - * pt.c (instantiate_decl): Do save and restore file position. - -1998-10-05 Martin von Löwis - - * method.c (build_decl_overload_real): Clear - numeric_output_need_bar after __. - -1998-10-05 Nathan Sidwell - - * call.c (build_new_method_call): Issue 'incomplete type' error, - if class is not defined. - -1998-10-05 Kaveh R. Ghazi - - * call.c (build_object_call): Move declaration of variable - `fn' into the scope where it is used. Don't access variable - `fn' when it is uninitialized, instead use `fns'. - -1998-10-04 Theodore Papadopoulo - - * errfn.c (cp_thing): Print buf as a string not as a printf format - to avoid problems with the operator%. Consequently, `%%' sequences - in format are copied as `%' in buf. - -1998-10-04 Jason Merrill - - * pt.c (pop_tinst_level): Call extract_interface_info. - (instantiate_decl): Don't save and restore file position. - - * decl.c (cp_finish_decl): Make statics in extern inlines and - templates common, if possible and the target doesn't support weak - symbols. - - * decl.c (grokdeclarator): Remove redundant calls to - build_type_variant and some duplicated code. - * sig.c (build_signature_reference_type): Only take the type parm. - (build_signature_pointer_type): Likewise. - * tree.c (build_cplus_method_type): Adjust. - * cp-tree.h: Update. - -1998-10-04 Mark Mitchell - - * call.c (build_over_call): Make pedwarns about dropped qualifiers - into full-fledged errors. - * cvt.c (convert_to_reference): Likewise. - * typeck.c (convert_for_assignment): Likewise. - - * search.c (expand_upcast_vtables): In addition to unsetting - TREE_READONLY, remove top-level const type qualifier. - -1998-10-03 Mark Mitchell - - * class.c (current_class_ptr, current_class_ref): Clarify - documentation. - * cvt.c (ocp_convert): Don't expect fold to remove all trivial - NOP type conversions. - * decl.c (decls_match): Use comptypes directly; ignore - qualifiers on the DECL. - (duplicate_decls): Remove qualifier checks on DECL. - (grokdeclarator): Make the type built up include top-level - qualifiers. - * decl2.c (do_dtors): Fix spelling error. - * error.c (dump_simple_decl): Don't look at qualifiers on the decl - when printing type information. - * init.c (build_new_1): Add documentation. Deal with the fact - that type of allocated memory now contains qualifiers. - * lex.c (is_global): Improve error-recovery. - * sig.c (build_member_function_pointer): Don't cast away const - on fields of sigtable_entry_type. - * tree.c (lvalue_type): Don't look at top-level qualifiers on - expressions. - * typeck.c (decay_conversion): Likewise. - (build_component_ref): Make sure the type of the COMPONENT_REF - contains top-level qualifiers, as appropriate. Improve - error-handling. - (build_indirect_ref): Simplify. Don't strip top-level qualifiers. - (build_array_ref): Likewise. - (build_unary_op): Improve error-recovery. - (unary_complex_lvalue): Make taking the address a bound member - function an error, not a sorry. - (build_conditional_expr): Look at the type qualifiers, not the - qualifiers on the expression itself. - -1998-10-03 Jason Merrill - - * decl2.c (merge_functions): Remove duplicates. - - * decl2.c: Add -f{no-,}implicit-inline-templates. - (import_export_decl): Check it. - - * decl.c (lookup_name_real): Template parms also take precedence - over implicit typename. Only warn if yylex. - - * typeck.c (build_conditional_expr): Only fold if ifexp is an - INTEGER_CST. - - * decl2.c (finish_vtable_vardecl): Check DECL_INTERFACE_KNOWN - instead of linkage. - -1998-10-01 Jason Merrill - - * cp-tree.h (FORMAT_VBASE_NAME): New macro. - * class.c (build_vbase_pointer): Use it. - * rtti.c (expand_class_desc): Likewise. - * tree.c (build_vbase_pointer_fields): Likewise. - -Thu Oct 1 10:43:45 1998 Nick Clifton - - * decl.c (start_decl): Add invocation of - SET_DEFAULT_DECL_ATTRIBUTES, if defined. - (start_function): Add invocation of - SET_DEFAULT_DECL_ATTRIBUTES, if defined. - - * lex.c: Replace occurrences of HANDLE_SYSV_PRAGMA with - HANDLE_GENERIC_PRAGMAS. - -1998-09-28 Anthony Green - - * semantics.c (finish_asm_stmt): Always permit volatile asms. - -1998-09-28 Mark Mitchell - - * decl.c (grokdeclarator): Tighten checks for invalid - destructors. Improve error-messages and error-recovery. - * decl2.c (check_classfn): Don't assume that mangled destructor - names contain type information. - -1998-09-25 Jason Merrill - - * search.c (get_base_distance): Remove assert. - - * decl2.c (build_anon_union_vars): Don't process a field with no - name. - (finish_anon_union): Also complain about local anon unions with no - members. - -1998-09-25 Martin von Löwis - - * decl.c (lookup_namespace_name): If the name is a namespace, - return it immediately. - -Fri Sep 25 11:45:38 1998 Kaveh R. Ghazi - - * cp-tree.h (define_case_label): Remove unused parameter. - (check_java_method): Likewise. - (grokclassfn): Likewise. - (expand_aggr_init): Likewise. - (build_x_delete): Likewise. - (maybe_end_member_template_processing): Likewise. - (unshare_base_binfos): Add prototype. - (string_conv_p): Likewise. - (my_friendly_abort): Mark with ATTRIBUTE_NORETURN. - - * cvt.c (build_up_reference): Remove unused parameter - `checkconst', all callers changed. - (build_type_conversion): Mark parameter `code' with - ATTRIBUTE_UNUSED. - (build_expr_type_conversion): Initialize variable `conv'. - - * decl.c (push_namespace): Initialize variable `d'. - (define_case_label): Remove unused parameter `decl', all callers - changed. - - * decl2.c (lang_decode_option): If !USE_CPPLIB, mark parameter - `argc' with ATTRIBUTE_UNUSED. - (grokclassfn): Remove unused parameter `cname', all callers - changed. - (check_java_method): Likewise for parameter `ctype'. - (copy_assignment_arg_p): Mark parameter `virtualp' with - ATTRIBUTE_UNUSED. - (finish_prevtable_vardecl): Likewise for parameter `prev'. - - * expr.c (extract_init): Likewise for parameters `decl' and `init'. - - * init.c (expand_aggr_init_1): Remove unused parameter - `alias_this', all callers changed. - (expand_aggr_init): Likewise. - (expand_default_init): Likewise. - (build_new_1): Initialize variable `susp'. - (build_x_delete): Remove unused parameter `type', all callers - changed. - - * lex.c (set_typedecl_interface_info): Mark parameter `prev' with - ATTRIBUTE_UNUSED. - (readescape): Use (unsigned) value in shift. - (real_yylex): Likewise. Likewise. Also cast `sizeof' to int when - comparing to a signed quantity. - - * pt.c (maybe_end_member_template_processing): Remove unused - parameter `decl', all callers changed. - (check_explicit_specialization): Add braces around empty body in - an else-statement. - (current_template_args): Initialize variable `args'. - (lookup_template_class): Likewise for variable `prev_local_enum'. - (tsubst_decl): Likewise for variable `r'. - (set_mangled_name_for_template_decl): Initialize variable - `context'. - - * spew.c (scan_tokens): Change type of parameter `n' to unsigned. - Likewise for variable `i'. - (yylex): Initialize variable `trrr'. - - * typeck.c (compparms): Mark variable `strict' with - ATTRIBUTE_UNUSED. - - * xref.c (simplify_type): Cast argument of ctype function to - `unsigned char'. - -1998-09-24 Mark Mitchell - - * cp-tree.h (language_lvalue_valid): Remove. - * decl.c (grokdeclarator): Don't disallow references to functions. - * tree.c (lvalue_p_1): New function, combining duplicated - code from ... - (lvalue_p): Use it. - (real_lvalue_p): Likewise. - * typeck.c (language_lvalue_valid): Remove. - (build_modify_expr): Treat FUNCTION_TYPEs as readonly, even though - they don't have TREE_READONLY set. - * typeck2.c (readonly_error): Add case for FUNCTION_DECLs. - -1998-09-24 Benjamin Kosnik - - * spew.c (yylex): Give diagnostic. - * hash.h (is_reserved_word): Add export. - * gxx.gperf: Likewise. - * lex.h (rid): Add RID_EXPORT. - * lex.c (init_parse): Likewise. - -Tue Sep 22 21:01:19 1998 Gerald Pfeifer - - * friend.c (do_friend): Make warning a full sentence. - -1998-09-22 Mark Mitchell - - * parse.y (component_decl_list): Improve error-recovery. - -1998-09-22 Benjamin Kosnik - - * decl.c (make_typename_type): Move error to point where name - variable can be used by dump_type. - -1998-09-22 Mark Mitchell - - * decl.c (grokfndecl): Improve error-recovery. - * decl2.c (grokfield): Likewise. - * pt.c (finish_member_template_decl): Likewise. - -1998-09-20 Martin von Löwis - - * method.c (hack_identifier): Finding multiple members is always - an error. - -1998-09-21 Per Bothner - - * Make-lang.in (c++-filt): Link libiberty.a after cxxmain.o. - -Mon Sep 21 01:53:05 1998 Felix Lee - - * lex.c (init_lex): Use getenv ("LANG"), not GET_ENVIRONMENT (). - -1998-09-20 Mark Mitchell - - * class.c (maybe_warn_about_overly_private_class): Reformat. - -1998-09-17 Andrew MacLeod - - * exception.cc (__cplus_type_matcher): Realign some code. - -1998-09-16 Mark Mitchell - - * Make-lang.in (tinfo.o): Use CXXFLAGS when compiling. - (tinfo2.o): Likewise. - (exception.o): Likewise. - (new.o): Likewise. - (opnew.o): Likewise. - (opnewnt.o): Likewise. - (opvnew.o): Likewise. - (opvnewnt.o): Likewise. - (opdel.o): Likewise. - (opdelnt.o): Likewise. - (opvdel.o): Likewise. - (opvdelnt.o): Likewise. - -1998-09-16 Richard Henderson - - * decl.c (init_decl_processing): Kill __builtin_fp and __builtin_sp. - -1998-09-15 Alexandre Oliva - - * call.c (build_field_call): Handle static data members too. - - * typeck.c (comptypes): When comparing pointer types, check - whether referred types match even in strictest modes. - -1998-09-15 Mark Mitchell - - * cp-tree.h: Revert previous change. - (finish_struct_methods): Remove declaration. - * class.c: Revert previous change. - (maybe_warn_about_overly_private_class): New function. - (finish_struct_methods): Declare here, and make static. Remove - unnecessary parameters. Tidy slightly. Use - maybe_warn_about_overly_private_class. - (finish_struct_1): Adjust. Remove check for private constructors, - now done elsewhere. - (finish_struct): Adjust. - -1998-09-15 Andrew MacLeod - - * except.c (expand_start_catch_block): No need to check for new - exception model. - (process_start_catch_block_old): Deleted. - (process_start_catch_block): Add call to start_decl_1(). - (expand_end_catch_block): Add call to end_catch_handler(). - * exception.cc (__cplus_type_matcher): Only check the exception - language if there is an exception table. - -1998-09-15 Andrew MacLeod - - * search.c (expand_indirect_vtbls_init): Mark temporary stack slots - as used to prevent conflicts with virtual function tables. - -1998-09-14 Mark Mitchell - - * cp-tree.h (lang_type): Add has_non_private_static_mem_fn. - (CLASSTYPE_HAS_NON_PRIVATE_STATIC_MEM_FN): New macro, to access it. - * class.c (maybe_class_too_private_p): New function. - (finish_struct_methods): Use it. - (finish_struct_1): Likewise. - (finish_struct): Set CLASSTYPE_HAS_NON_PRIVATE_STATIC_MEM_FN if - appropriate. - - * pt.c (check_specialization_scope): Fix spelling error. - (check_explicit_specialization): Remove code to handle explicit - specializations in class scope; they are now correctly diagnosed - as errors. - -1998-09-10 Mark Mitchell - - * decl.c (pushdecl): Don't copy types if the - DECL_ABSTRACT_ORIGIN of the new decl matches the TYPE_NAME of the - type. - -1998-09-09 Kriang Lerdsuwanakij - - * class.c (get_enclosing_class): New function. - (is_base_of_enclosing_class): Likewise. - * cp-tree.h (get_enclosing_class): Declare. - (is_base_of_enclosing_class): Likewise. - * pt.c (coerce_template_parms): Use them. - -1998-09-09 Jason Merrill - - * g++spec.c (lang_specific_driver): Check whether MATH_LIBRARY is - null to decide whether to use it. - - * error.c (dump_type_real): Handle NAMESPACE_DECL. - * parse.y (base_class.1): Avoid crash on error. - -1998-09-08 Martin von Löwis - - * decl.c (make_typename_type): If context is a namespace, the code - is in error. - -1998-09-08 Mumit Khan - - * parse.y (nomods_initdcl0): Set up the parser stack correctly. - -1998-09-08 Mark Mitchell - - * cp-tree.h (anonymous_namespace_name): Declare. - * decl.c: Define it. - (push_namespace): Use anonymous_namespace_name, rather than local - static anon_name. - * error.c (dump_decl): If a namespace is named - anonymous_namespace_name, call it {anonymous}. - - * decl.c (grokparms): Distinguish between references and pointers - in error message. - -1998-09-08 Richard Henderson - Mark Mitchell - - * pt.c (process_partial_specialization): Consistently allocate - and zero tpd.parms based on ntparms. Use tpd2.parms, not - tpd.parms, where appropriate. - -Sun Sep 6 00:00:51 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (INCLUDES): Update after recent toplevel gcc - reorganizations. - -1998-09-05 Mark Mitchell - - * cp-tree.h (TI_PENDING_SPECIALIZATION_FLAG): Remove. - * class.c (finish_struct): Remove hackery to deal with explicit - specializations in class scope. - * decl.c (grokfndecl): Improve error-recovery. - * decl2.c (grokfield): Likewise. - * pt.c (check_specialization_scope): New function. - (begin_specialization): Call it. - (process_partial_specialization): New function, split out from - push_template_decl. Check partial specializations more - stringently. - (push_template_decl): Call it. - (check_explicit_specialization): Don't attempt to handle explicit - specializations in class scope. - (template_parm_data): Document. Add current_arg and - arg_uses_template_parms. - (mark_template_parm): Set it. - (tsubst_arg_types): Remove unused variable. - * semantics.c (begin_class_definition): Tweak. - -1998-09-04 Mark Mitchell - - * inc/typeinfo (type_info::type_info(const char*)): Make - `explicit'. - - * cp-tree.h (hash_tree_cons_simple): New macro. - * pt.c (tsubst_arg_types): New function. Use hash_tree_cons. - (coerce_template_parms): Use make_temp_vec, instead of - make_tree_vec. Document this behavior. - (lookup_template_class): Likewise. - (tsubst, cases METHOD_TYPE, FUNCTION_TYPE): Use tsubst_arg_types. - Remove dead code (and add assertion to check its deadness). Fix - bug w.r.t. exception specifications. - -1998-09-03 Jason Merrill - - * decl2.c (import_export_vtable): Always make artificials comdat. - (import_export_decl): Likewise. - * pt.c (mark_decl_instantiated): Likewise. - -1998-09-03 Mark Mitchell - - * cp-tree.h (finish_globally_qualified_member_call_expr): - Rename to ... - (finish_qualified_call_expr). - * semantics.c: Likewise. - * parse.y (primary): Use it. - * method.c (hack_identifier): Remove redundant code. - - * init.c (resolve_offset_ref): Call convert_from_reference to - handle members of reference type. Improve error recovery. - -1998-09-03 Benjamin Kosnik - - * cp-tree.h: Declare warn_nontemplate_friend. - * decl2.c (lang_decode_option): Set. - * lang-options.h: Add -Wnon-template-friend. - * friend.c (do_friend): Use to toggle non-template function warning. - -1998-09-03 Mark Mitchell - - * decl.c (finish_enum): Don't resolve CONST_DECLs to their - corresponding INTEGER_CSTs when processing_template_decl. - * pt.c (tsubst_enum): Tweak accordingly. - -1998-09-03 Benjamin Kosnik - - * decl.c (pushdecl_class_level): Add warning here. - (pushdecl): Tweak. - -1998-09-02 Jason Merrill - - * cvt.c (convert_pointer_to_real): Tidy. - * search.c (get_base_distance_recursive): Simplify. - (get_base_distance): Likewise. - - * pt.c (unify): Only special-case INTEGER_TYPE if it uses template - parms. - -Wed Sep 02 09:25:29 1998 Nick Clifton - - * lex.c (check_newline): Call HANDLE_PRAGMA before - HANDLE_SYSV_PRAGMA if both are defined. Generate warning messages - if unknown pragmas are encountered. - (handle_sysv_pragma): Interpret return code from - handle_pragma_token (). Return success/failure indication rather - than next unprocessed character. - (pragma_getc): New function: retrieves characters from the - input stream. Defined when HANDLE_PRAGMA is defined. - (pragma_ungetc): New function: replaces characters back into the - input stream. Defined when HANDLE_PRAGMA is defined. - -1998-09-01 Jason Merrill - - * decl2.c (output_vtable_inherit): Use %cDIGIT in the operands. - * class.c (build_vtable_entry_ref): Likewise. - -1998-09-01 Mark Mitchell - - * cp-tree.h (DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION): New macro. - * decl2.c (import_export_decl): Likewise. - * pt.c (instantiate_decl): Use it. - -1998-09-01 Jason Merrill - - * decl.c (lookup_name_real): Also do implicit typename thing for - artificial TYPE_DECLs. - * search.c (lookup_field): Likewise. - (lookup_fnfields, lookup_field): Adjust for implicit typename kludge. - * semantics.c (begin_constructor_declarator): Use enter_scope_of. - (enter_scope_of): Extract type from implicit typename. - (begin_class_definition): Likewise. - * lex.c (identifier_type): Handle implicit typename when checking - for SELFNAME. - - * cp-tree.h: Declare flag_strict_prototype. - * lex.c (do_scoped_id, do_identifier): Don't implicitly_declare if - -fstrict-prototype. - * decl.c (init_decl_processing): If -f{no,-}strict-prototype wasn't - specified, set it to the value of pedantic. - -1998-09-01 Mark Mitchell - - * decl2.c (arg_assoc): Handle template-id expressions as arguments. - -1998-08-31 Mark Mitchell - - * decl.c (finish_enum): Handle member enums of classes declared in - template functions. - - * decl2.c (grok_x_components): Strip attributes before calling - groktypename. - -1998-08-31 Jason Merrill - - * cp-tree.h, decl2.c: Remove support for -fall-virtual, - -fenum-int-equivalence and -fno-nonnull-objects. - * class.c (check_for_override): Remove support for -fall-virtual. - (finish_struct_1): Likewise. - * call.c (build_new_op): Remove support for -fenum-int-equivalence. - * typeck.c (build_binary_op_nodefault): Likewise. - * cvt.c (ocp_convert): Likewise. - * call.c (build_vfield_ref): Remove support for -fno-nonnull-objects. - * class.c (build_vbase_path): Likewise. - -Sun Aug 30 22:16:31 1998 H.J. Lu (hjl@gnu.org) - - * Makefile.in (INTERFACE): New, set to 1. - -1998-08-30 Mark Mitchell - - * error.c (dump_decl): Use CP_DECL_CONTEXT, not DECL_CONTEXT, when - comparing with global_namespace. - (dump_aggr_type): Likewise. - - * decl.c (grokfndecl): Issue error on declaration of friend - templates with explicit template arguments. - - * pt.c (convert_template_argument): New function, split out - from... - (coerce_template_parms): Here. - (tsubst): Attempt better error-recovery. - -1998-08-28 Benjamin Kosnik - - * pt.c (decl_template_parm_p): Add checks for - TEMPLATE_TEMPLATE_PARM. - -1998-08-28 Mark Mitchell - - * lex.c (do_identifier): Fix thinko in previous change. - -1998-08-28 Jason Merrill - - * search.c (dfs_search, binfo_for_vtable, dfs_bfv_helper): New fns. - * decl2.c (output_vtable_inherit): Call binfo_for_vtable. - -1998-08-28 Richard Henderson - - Add support for discarding unused virtual functions. - * lang-options.h: Add -fvtable-gc. - * cp-tree.h: Add flag_vtable_gc. - * decl2.c (output_vtable_inherit): New fn. - (finish_vtable_vardecl): Call it. - * class.c (build_vtable_entry_ref): New fn. - (build_vtbl_ref): Call it. - -1998-08-28 Mark Mitchell - - * cp-tree.h (build_enumerator): Take the enumeration type as a - parameter. - * decl.c (finish_enum): Don't set the TREE_TYPE for the - enumeration constant values if we're processing_template_decls. - Don't set the type for the CONST_DECLs either; that's done in - build_enumerator. - (build_enumerator): Take the enumeration type as a - parameter. - * lex.c (do_identifier): Don't resolve enumeration constants while - processing template declarations, even if they happen to be - TEMPLATE_PARM_INDEXs. - - * parse.y (current_enum_type): New variable. - (primary): Don't allow statement-expression in local classes just - as we don't in global classes. - (structsp): Use current_enum_type. - (enum_list): Likewise. - * pt.c (tsubst_enum): Don't check for NOP_EXPRs introduced by - finish_enum; they no longer occur. - - * cp-tree.h (finish_base_specifier): New function. - * parse.y (base_class): Use it. - * semantics.c (finish_base_specifier): Define it. - - * parse.y (structsp): Warn on use of typename outside of template - declarations. - -1998-08-27 Jason Merrill - - * lex.c (handle_cp_pragma): Remove #pragma vtable. - * lang-options.h: Remove +e options. - * decl2.c (lang_decode_option): Likewise. - (import_export_vtable): Don't check write_virtuals. - (finish_vtable_vardecl, finish_file): Likewise. - * search.c (dfs_debug_mark): Likewise. - * semantics.c (begin_class_definition): Likewise. - * class.c (build_vtable, finish_vtbls, finish_struct_1): Likewise. - - * call.c (build_over_call): Check flag_elide_constructors. - * decl2.c: flag_elide_constructors defaults to 1. - * typeck.c (convert_arguments): Remove return_loc parm. - (build_function_call_real): Adjust. - - * search.c: Tear out all mi_matrix and memoize code. - (lookup_field, lookup_fnfields): Use scratch_tree_cons. - * lang-options.h: Remove documentation for -fhandle-exceptions, - -fmemoize-lookups and -fsave-memoized. - * cp-tree.h: Lose mi_matrix and memoize support. - * decl2.c: Ignore -fmemoize-lookups and -fsave-memoized. - * class.c: Lose struct class_level. - (pushclass, popclass): Lose memoize support. - * init.c (build_offset_ref): Likewise. - - Never change BINFO_INHERITANCE_CHAIN. - * init.c (emit_base_init): Change modification of - BINFO_INHERITANCE_CHAIN to an assert. - * search.c (get_base_distance_recursive): Likewise. - (get_base_distance): Likewise. - (lookup_member): Likewise. - (convert_pointer_to_single_level): Likewise. - (lookup_field): Likewise. Lose setting TREE_VIA_* on TREE_LISTs. - (lookup_fnfields): Likewise. - * tree.c (propagate_binfo_offsets): Don't call unshare_base_binfos. - (unshare_base_binfos): Don't call propagate_binfo_offsets. - (layout_basetypes): Call propagate_binfo_offsets instead of - unshare_base_binfos. - * decl.c (xref_basetypes): Call unshare_base_binfos. - * pt.c (instantiate_class_template): Likewise. - * tree.c (reverse_path): Remove 'copy' parm; always make a - temporary copy. - * class.c (build_vbase_path): Just call it. - * search.c (compute_access): Likewise. Don't re-reverse. - -1998-08-27 Mark Mitchell - - * class.c (build_vbase_path): Use reverse_path. - (finish_base_struct): Move warnings for inaccessible bases to - layout_basetypes. - (modify_one_vtable): Remove check of TREE_USED (binfo). - (fixup_vtable_deltas1): Likewise. - * cp-tree.h (BINFO_INHERITANCE_CHAIN): Document here. - (xref_tag): Remove binfos parameter. - (make_binfo): Remove chain parameter. - (reverse_path): Add copy parameter. - * decl.c (init_decl_processing): Change calls to xref_tag. - (xref_tag): Remove binfos parameter. - (xref_basetypes): Change calls to make_binfo. - * decl2.c (grok_x_components): Change calls to xref_tag. - (handle_class_head): Likewise. - * friend.c (do_friend): Likewise. - * lex.c (make_lang_type): Change calls to make_binfo. - * parse.y (structsp): Change calls to xref_tag. - (named_complex_class_head_sans_basetype): Likewise. - (named_class_head): Likewise. - * rtti.c (init_rtti_processing): Likewise. - * search.c (compute_access): Change calls to reverse_path. - (dfs_get_vbase_types): Change calls to make_binfo. - (get_vbase_types): Remove dead code. - * tree.c (unshare_base_binfos): Change calls to make_binfo. - (layout_basetypes): Warn here about inaccessible bases. - (make_binfo): Remove chain parameter. - (reverse_path): Add copy parameter. - -1998-08-27 Jason Merrill - - * class.c: #if 0 complete_type_p. - * init.c (build_java_class_ref, build_new_1): Remove unused locals. - * method.c (process_overload_item): Likewise. - * typeck.c (comp_target_types): Likewise. - - Stop sharing binfos for indirect virtual bases. - * tree.c (propagate_binfo_offsets): Unshare vbases, too. - (layout_basetypes): Likewise. - (unshare_base_binfos): Copy vbases, too. - * cp-tree.h (BINFO_VIA_PUBLIC, BINFO_BASEINIT_MARKED, - BINFO_VBASE_INIT_MARKED): Remove obsolete macros. - (BINFO_PUSHDECLS_MARKED, SET_BINFO_PUSHDECLS_MARKED, - CLEAR_BINFO_PUSHDECLS_MARKED): New macros. - * search.c (lookup_field, lookup_fnfields, lookup_member): Remove - reference to BINFO_VIA_PUBLIC. - (marked_pushdecls_p, unmarked_pushdecls_p): New fns. - (push_class_decls): Use them. - (dfs_pushdecls): Use SET_BINFO_PUSHDECLS_MARKED. - (dfs_compress_decls): Use CLEAR_BINFO_PUSHDECLS_MARKED. - -1998-08-27 Mark Mitchell - - * decl.c (build_enumerator): Set DECL_CONTEXT for the - CONST_DECLs. - -1998-08-26 Mark Mitchell - - * cp-tree.h (finish_enum): Change prototype. - * decl.c (finish_enum): Use TYPE_VALUES, rather than taking a - VALUES parameter. Don't try to compute mins/maxs if - processing_template_decl. - * parse.y (structsp): Use new calling sequence for finish_enum. - * pt.c (tsubst_enum): Likewise. Take the new type as input. - (lookup_template_class): Remove unused variables. Tweak. - Register enums on instantiation list before substituting - enumeration constants. - (tsubst_decl): Remove unused variables. - (regenerate_decl_from_template): Likewise. - - * decl.c (duplicate_decls): Don't obliterate the - DECL_TEMPLATE_INFO for a template if we're not replacing it with - anything. - - * lex.c (do_identifier): Fix typo in comment. - -Wed Aug 26 10:54:51 1998 Kaveh R. Ghazi - - * errfn.c: Remove stdarg.h/varargs.h. - * tree.c: Likewise. - -1998-08-25 Brendan Kehoe - - * pt.c (tsubst_copy): Only do typename overloading on an - IDENTIFIER_NODE that happens to look like a typename if it actually - has a type for us to use. - -1998-08-25 Jason Merrill - - * typeck.c (comp_cv_target_types): Split out... - (comp_target_types): From here. Don't allow cv-qual changes under - a pointer if nptrs == 0. Fix OFFSET_TYPE handling. - (build_ptrmemfunc): Pass 1 to nptrs. - * cvt.c (perform_qualification_conversions): Use comp_ptr_ttypes. - -1998-08-25 Mark Mitchell - - * search.c (dependent_base_p): Don't compare a binfo to - current_class_type; use the TREE_TYPE of the binfo instead. - - * cp-tree.h (CLASS_TYPE_P): Revise definition. - -1998-08-25 Jason Merrill - - * decl.c (duplicate_decls): Don't complain about different - exceptions from an internal decl even if pedantic. - - * typeck.c (convert_for_assignment): Converting from pm of vbase - to derived is an error, not a sorry. - - * call.c (build_over_call): Use convert_pointer_to_real for 'this'. - * class.c (fixed_type_or_null): Rename from - resolves_to_fixed_type_p. Return the dynamic type of the - expression, if fixed, or null. - (resolves_to_fixed_type_p): Use it. Return 0 if the dynamic type - does not match the static type. - (build_vbase_path): Rename 'alias_this' to 'nonnull'. Use - resolves_to_fixed_type_p again. - -1998-08-24 Mark Mitchell - - * pt.c (tsubst_decl): Move special case code for dealing with - tricky friend templates here from ... - (regenerate_decl_from_template): Here. - -1998-08-24 Jason Merrill - - * decl.c (start_decl): Remove redundant linkage check. - -1998-08-24 Gavin Romig-Koch - - * typeck.c (c_expand_return): Handle the case that valtype - is wider than the functions return type. - -1998-08-24 Mark Mitchell - - * cp-tree.h (CLASS_TYPE_P): New macro. - * decl.c (grokdeclarator): Use it instead of IS_AGGR_TYPE. - * pt.c (process_template_parm): Undo previous change. - -1998-08-24 Benjamin Kosnik - - * cp-tree.h: Declare. - * pt.c (decl_template_parm_p): New function. - * decl.c (pushdecl): Check decls for redeclaring template parms. - (xref_tag): Make redeclaration an error, print decl. - * decl2.c (grokfield): Check field_decls for redeclaration as well. - -1998-08-24 Jason Merrill - - * parse.y (primary): Fix up the type of string constants. - -1998-08-24 Mark Mitchell - - * typeck.c (convert_for_initialization): Move check for odd uses - of NULL to avoid duplicate warnings. - -1998-08-24 Jason Merrill - - * tree.c (lvalue_type): Fix for arrays. - * typeck.c (string_conv_p): New fn. - (convert_for_assignment): Use it. - (build_unary_op): Use lvalue_type. - * call.c (standard_conversion, convert_like): Use string_conv_p. - (add_function_candidate): Use lvalue_type. - * cvt.c (convert_to_reference): Likewise. - * decl2.c (lang_decode_option): Ignore -traditional. - * decl.c (init_decl_processing): flag_writable_strings inhibits - flag_const_strings. - -1998-08-24 Andrew MacLeod - - * lang-options.h (lang_options): Add fconst-strings to the list - of valid options. - * decl2.c (lang_f_options, lang_decode_option): Likewise. - -1998-08-24 Nathan Sidwell - - * lex.c (real_yylex): Don't warn about long long constants if - we're allowing long long. - -1998-08-24 Martin von Löwis - - * decl.c (pushdecl): Use IDENTIFIER_NAMESPACE_VALUE instead of - accessing bindings directly. - - * search.c (my_tree_cons): Reimplement. - - * lang-specs.h: Remove __HONOR_STD. - * inc/exception, inc/new, inc/new.h, inc/typeinfo: Likewise. - -1998-08-23 Mark Mitchell - - * decl.c (grokdeclarator): Complain about in-class initialization - of aggregates and/or references. - * pt.c (process_template_parm): Clear IS_AGGR_TYPE for - TEMPLATE_TYPE_PARMs. - - * decl2.c (grok_array_decl): Add comment. - (mark_used): Don't instantiate an explicit instantiation. - * friend.c (make_friend_class): Remove bogus comment. Fix check - for partial specializations. - * pt.c (check_explicit_specialization): Don't - SET_DECL_EXPLICIT_INSTANTIATION here. - (mark_decl_instantiated): Or here. - (do_decl_instantiation): Do it here, instead. Add checks for - duplicate explicit instantiations, etc. Tidy. - (do_type_instantiation): Likewise. - (instantiate_decl): Improve comments. Complain about explicit - instantiations where no definition is available. - - * cp-tree.h (ansi_null_node): Remove. - * call.c (build_over_call): Warn about converting NULL to an - arithmetic type. - * cvt.c (build_expr_type_conversion): Likewise. Use - null_ptr_cst_p instead of expanding it inline. - * decl.c (ansi_null_node): Remove. - (init_decl_processing): Make null_node always have integral type. - * except.c (build_throw): Warn about converting NULL to an - arithmetic type. - * lex.c (init_parse): Remove handling of ansi_null_node. - * pt.c (type_unification_real): Don't convert NULL to void* type. - * typeck.c (build_binary_op_nodefault): Fix NULL warnings. - (convert_for_assignment): Warn about converting NULL to an - arithmetic type. - (convert_for_initialization): Likewise. - -1998-08-20 Jason Merrill - - * tree.c (search_tree, no_linkage_helper, no_linkage_check): New fn. - * pt.c (coerce_template_parms): Use no_linkage_check. - * decl.c (grokvardecl): Likewise. - (grokfndecl): Likewise. Members of anonymous types have no linkage. - - * method.c (process_overload_item): Remove useless code. - -1998-08-20 Per Bothner - - Handle new'ing of Java classes. - * init.c (build_class_classref): New function. - (build_new_1): If type is TYPE_FOR_JAVA: Call _Jv_AllocObject; - constructor does not return this; don't need to exception-protect. - - * pt.c (lookup_template_class): Copy TYPE_FOR_JAVA flag. - * decl2.c (acceptable_java_type): Handle template-derived types. - -1998-08-20 Per Bothner - - * decl2.c (import_export_vtable): Suppress vtables for Java classes. - -1998-08-20 Mark Mitchell - - * decl.c (duplicate_decls): Always merge the old and new patterns - for templates, regardless of whether or not the new one has - DECL_INITIAL. Don't throw away specializations. Merge - DECL_SAVED_TREE. - * pt.c (tsubst_decl): Use the right pattern when calculating the - complete args for a new template instance. - (do_decl_instantiation): Fix typo in comment. - (regenerate_decl_from_template): Deal with tricky friend template - case. - (instantiate_decl): Likewise. - -Thu Aug 20 09:09:45 1998 Jeffrey A Law (law@cygnus.com) - - * init.c (build_builtin_delete_call): Add missing assemble_external - call. - -1998-08-20 Jason Merrill - - * parse.y (notype_unqualified_id): Also accept ~A. - -1998-08-19 Mark Mitchell - - * typeck.c (build_binary_op_nodefault): Warn on use of NULL in - arithmetic. - * except.c (build_throw): Warn when NULL is thrown, even with - -ansi. Use ansi_null_node, rather than integer_zero_node, in the - thrown expression. - - * cp-tree.h (ansi_null_node): New variable. - * decl.c (ansi_null_node): New variable. - (init_decl_processing): Initialize its type. - * lex.c (init_parse): Initialize its value. Use ansi_null_node - for null_node in non-ANSI mode. - * typeck.c (build_binary_op_nodefault): Use ansi_null_node in - place of null_node to avoid spurious errors. - -1998-08-17 Mark Mitchell - - * cp-tree.h (enter_scope_of): New function. - * parse.y (complex_direct_notype_declarator): Use it. - * semantics.c (enter_scope_of): New function. - -1998-08-17 Jason Merrill - - * decl.c (grokparms): No, here. - - * decl.c (grokdeclarator): Catch parm with pointer to array of - unknown bound here... - * method.c (process_overload_item): ...not here. - - * gxxint.texi: Remove obsolete documentation of overloading code. - - * decl.c (finish_enum): Also set TYPE_SIZE_UNIT. - * class.c (finish_struct_bits): Likewise. - - * tree.c (lvalue_type): Fix for arrays. - * typeck.c (build_unary_op): Use lvalue_type. - * call.c (add_function_candidate): Likewise. - * cvt.c (convert_to_reference): Likewise. - - * decl2.c (lang_decode_option): Ignore -traditional. - - * init.c (build_offset_ref): Don't mess with error_mark_node. - * lex.c (do_scoped_id): Use cp_error. - - * rtti.c (get_tinfo_fn): Don't mess with the context for now. - -1998-08-17 Benjamin Kosnik - - * decl.c (grokdeclarator): Allow anonymous types to be cv-qualified. - -Mon Aug 17 10:40:18 1998 Jeffrey A Law (law@cygnus.com) - - * cp-tree.h (set_identifier_local_value): Provide prototype. - - * decl2.c (do_namespace_alias): Remove unused variables `binding' - and `old'. - -Fri Aug 14 16:42:27 1998 Nick Clifton - - * Makefile.in: Rename BBISON to BISON so that it can be properly - inherited from the parent makefile. - -1998-08-13 Jason Merrill - - * lang-options.h: Add -finit-priority. - * decl2.c: Likewise. Check flag_init_priority instead of - USE_INIT_PRIORITY. - - * decl2.c (setup_initp): New fn. - (start_objects, finish_objects, do_ctors): Handle init_priority. - (do_dtors, finish_file): Likewise. - -1998-08-13 Jason Merrill - - * pt.c (tsubst_copy): Hush warning. - - * rtti.c (get_tinfo_fn): Also set DECL_IGNORED_P. - -1998-08-12 Mark Mitchell - - * pt.c (print_template_context): Don't abort when instantiating a - synthesized method. - - * decl.c (grokdeclarator): Issue errors on namespace qualified - declarators in parameter lists or in class scope. - -1998-08-09 Mark Mitchell - - * pt.c (check_explicit_specialization): Don't abort on bogus - explicit instantiations. - -1998-08-07 Mark Mitchell - - * typeck.c (require_complete_type): Use complete_type_or_else. - (complete_type_or_else): Always return NULL_TREE on failure, as - documented. - - * pt.c (tsubst_aggr_type): Prototype. - (tsubst_decl): New function, split out from tsubst. Set - input_filename and lineno as appropriate. - (pop_tinst_level): Restore the file and line number saved in - push_tinst_level. - (instantiate_class_template): Set input_filename and lineno as - appropriate. - (tsubst): Move _DECL processing to tsubst_decl. Make sure the - context for a TYPENAME_TYPE is complete. - - * decl2.c (grokbitfield): Issue errors on bitfields declared with - function type. - (do_dtors): As in do_ctors, pretend to be a member of the same - class as a static data member while generating a call to its - destructor. - - * cvt.c (cp_convert_to_pointer): Handle NULL pointer - conversions, even in complex virtual base class hierarchies. - -1998-08-06 Mark Mitchell - - * cp-tree.h (ENUM_TEMPLATE_INFO): New macro. - (TYPE_TEMPLATE_INFO): Likewise. - (SET_TYPE_TEMPLATE_INFO): Likewise. - (ENUM_TI_TEMPLATE): Likewise. - (ENUM_TI_ARGS): Likewise. - (lookup_nested_type_by_name): Remove. - * decl.c (maybe_process_template_type_declaration): Handle enums. - (start_enum): Don't check for primary-template enum declarations - here. - (finish_enum): Clean up, document. Make sure template enum - constants get the correct type. - (build_enumerator): Copy initializers for template enumerations, - too. - (grok_enum_decls): Document. - * lex.c (do_identifier): Document use of LOOKUP_EXPR a bit - better. Build LOOKUP_EXPRs for local variables, even if they are - TREE_PERMANENT. - * pt.c (tsubst_enum): Remove field_chain parameter. - (template_class_depth): Include the depth of surrounding function - contexts. - (push_template_decl): Check for primary-template enum declarations - here. Deal with enumeration templates. - (lookup_template_class): Likewise. - (for_each_template_parm): Likewise. - (instantiate_class_template): Don't call tsubst_enum directly, - call tsubst instead, to instantiate enums. Deal with all - field_chain issues here, not in tsubst_enum. - (lookup_nested_type_by_name): Remove. - (tsubst_aggr_type): Revise handling of enumeration types. - (tsubst): Likewise. - (tsubst_copy): Likewise. - (tsubst_expr): Call tsubst, not tsubst_enum for TAG_DEFNs. - -1998-08-04 Mark Mitchell - - * decl.c (pushtag): Don't mangle the name of a TYPE_DECL if it - uses template parameters. - * method.c (build_template_parm_names): Use the full set of - template arguments for tsubst'ing. - (build_overload_identifier): Pass the full set of template - arguments to build_template_parm_names, not just the - innermost_args. - * pt.c (TMPL_ARGS_DEPTH): Define using - TMPL_ARGS_HAVE_MULTIPLE_LEVELS, for clarity. - (NUM_TMPL_ARGS): New macro. - (add_outermost_template_args): Deal with the case where the outer - args will be completely discarded. - (coerce_template_parms): Use the full set of template arguments - for tsubst'ing. Simplify. Add some asserts. Improve - error messages. - (lookup_template_class): Pass the full set of template arguments - to coerce_template_parms. - (tsubst): Add assertion. - (do_type_instantiation): Don't instantiate member template - classes. - - * init.c (build_offset_ref): Deal with a TEMPLATE_ID_EXPR whose - name is a LOOKUP_EXPR, rather than an IDENTIFIER_NODE. - -1998-08-03 Jason Merrill - - * method.c (set_mangled_name_for_decl): Change return type to void. - - * decl.c (lookup_name_real): A namespace-level decl takes priority - over implicit typename. Avoid doing the same lookup twice. - - * search.c (dependent_base_p): New fn. - (dfs_pushdecls, dfs_compress_decls): Use it. - - * typeck.c (get_member_function_from_ptrfunc): Don't try to handle - virtual functions if the type doesn't have any. - -1998-08-03 Mark Mitchell - - * decl2.c (grokfield): Don't mangle the name of a TYPE_DECL if it - uses template parameters. - -1998-08-02 Mark Mitchell - - * cp-tree.def (LOOKUP_EXPR): Document. Remove second argument. - * cp-tree.h (DECL_TI_TEMPLATE): Improve documentation. - * lex.c (do_identifier): Don't use a second argument, or a type, - when building LOOKUP_EXPRs. - (do_identifier): Likewise. - (do_scoped_id): Likewise. - * method.c (hack_identifier): Improve error message. - * pt.c (lookup_template_function): Don't needlessly call - copy_to_permanent or build_min. - (tsubst_copy): Remove #if 0'd code. tsubst into LOOKUP_EXPRs if - necessary. - (do_decl_instantiation): Improve error message. - * tree.c (mapcar, case LOOKUP_EXPR): Don't be sorry; make a copy. - (build_min): Copy the type to the permanent obstack, too. - -1998-08-01 Jason Merrill - - * init.c (init_init_processing): Remove BI* handling. - (build_builtin_call): Remove. - (build_builtin_delete_call): New fn. - (build_delete): Use it. - -1998-07-31 Mark Mitchell - - * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): New macro. - (maybe_check_template_type): New function. - * decl.c (maybe_process_template_type_declaration): New function, - split out from pushtag Call maybe_check_template_type. - (pushtag): Use it. Use PROCESSING_REAL_TEMPLATE_DECL_P. - (xref_tag): Use PROCESSING_REAL_TEMPLATE_DECL_P. - * friend.c (do_friend): Use PROCESSING_REAL_TEMPLATE_DECL_P. - * pt.c (template_class_depth_real): Generalization of ... - (template_class_depth): Use it. - (register_specialization): Use duplicate_decls for duplicate - declarations of specializations. - (maybe_check_template_type): New function. - (push_template_decl_real): Fix comment. - (convert_nontype_argument): Likewise. - (lookup_template_class): Likewise. Avoid an infinite loop on - erroneous code. - (tsubst_friend_function): Fix comment. - (tsubst, case FUNCTION_DECL): Deal with a DECL_TI_TEMPLATE that is - an IDENTIFIER_NODE. - * semantics.c (begin_function_definition): Use - reset_specialization to note that template headers don't apply - directly to declarations after the opening curly for a function. - -1998-07-29 Jason Merrill - - * decl.c (push_overloaded_decl): Use current_namespace instead of - DECL_CONTEXT (decl) to determine where we go. - - * decl.c (lookup_name_real): Fix typo. - -1998-07-28 Mark Mitchell - - * friend.c (is_friend): Be lenient with member functions to deal - with nested friends. - -1998-07-28 Jason Merrill - - * class.c (finish_struct_1): Convert integer_zero_node to - ssizetype before passing it to set_rtti_entry. - * typeck2.c (initializer_constant_valid_p): Allow conversion of 0 - of any size to a pointer. - -1998-07-27 Mark Mitchell - - * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove. - (build_template_decl_overload): Remove. - (set_mangled_name_for_decl): New function. - (innermost_args): Remove is_spec parameter. - (most_specialized, most_specialized_class): Remove declarations. - (lookup_template_class): Add entering_scope parameter. - (maybe_process_partial_specialization): New function. - (finish_template_decl): Likewise. - (finish_template_type): Likewise. - * class.c (finish_struct): Clean up processing of member template - specializations. - * decl.c (pushtag): Fix formatting. - (lookup_tag): Improve handling of pseudo-global levels. - (make_typename_type): Adjust call to lookup_template_class. - (shadow_tag): Use maybe_process_partial_specialization. - (xref_tag): Improve handling of member friends. - (start_function): Call push_nested_class before - push_template_decl. Don't call push_template_decl for - specializations. - * decl2.c (grok_x_components): Don't call xref_tag for - template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. - (grokclassfn): Use set_mangled_name_for_decl. - (arg_assoc_class): Adjust call to innermost_args. - (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. - * error.c (dump_function_name): Improve printing of template - function names. - * friend.c (is_friend): Don't compare types of decls to determine - friendship, unless flag_guiding_decls. - (make_friend_class): Partial specializations cannot be friends. - (do_friend): Use set_mangled_name_for_decl. Call - push_template_decl_real instead of push_template_decl. - * method.c (build_decl_overload_real): Remove prototype. Give it - external linkage. - (build_overload_identififer): Adjust call to innermost_args. - (build_template_decl_overload): Remove. - (set_mangled_name_for_decl): New function. - * parse.y (.finish_template_type): New non-terminal. - (template_def): Use finish_template_decl. Use template_extdef - instead of extdef. - (template_extdef, template_datadef): New non-terminals, containing - only those rules for things which can be templates. - (datadef): Tidy. - (template_type, self_template_type): Use .finish_template_type. - (named_class_head): Use maybe_process_partial_specialization. - * pt.c (mangle_class_name_for_template): Remove context parameter. - (get_class_bindings): Remove outer_args parameter. - (complete_template_args): Remove. - (add_outermost_template_args): New function. - (register_specialization): Return the specialization. - (unregister_specialization): New function. - (tsubst_template_parms): Likewise. - (most_specialized, most_specialized_class): Prototype here as - static. - (original_template): Rename to most_general_template. - (tsubst_template_parms): New function. - (set_mangled_name_for_template_decl): Likewise. - (TMPL_ARGS_DEPTH): New macro. - (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. - (TMPL_ARGS_LEVEL): New macro. - (SET_TMPL_ARGS_LEVEL): Likewise. - (TMPL_ARG): Likewise. - (SET_TMPL_ARG): Likewise. - (TMPL_ARGS_DEPTH): Likewise. - (finish_member_template_decl): Use finish_template_decl. - (maybe_process_partial_specialization): New function, split out - from tsubst. - (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. - (maybe_begin_member_template_processing): Use new macros. - (is_member_template): Likewise. - (is_member_template_class): Likewise. - (add_to_template_args): Likewise. Deal with multiple levels of - args. - (maybe_process_partial_specialization): New function. - (retrieve_specialization): Add consistency check. - (determine_specialization): Return full argument list. - (check_explicit_specialization): Tweak friend handling. Use full - argument lists. Simplify. - (current_template_args): Use new macros. - (push_template_decl_real): Change ill-named mainargs to specargs. - Check that a partial specialization actually specializes at least - one parameter. Improve friend handling. Modify for full - template arguments. - (classtype_mangled_name): Don't mangle the names of - specializations. - (lookup_template_class): Add entering_scope parameter. Use it to - avoid finding a template type when an instantiation is required. - Simplify. Use full template arguments. - (tsubst_friend_function): Use unregister_specialization. Use new - macros. Use full template arguments. - (tsubst_friend_class): Substitute, using tsubst_template_parms, - into the template parameters before passing them to - redeclare_class_template. - (instantiate_class_template): Simplify. Use full template - arguments. Adjust calls to get_class_bindings. Use - SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. - (innermost_args): Use new macros. - (tsubst_aggr_type): New function, split out from tsubst. - (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling - conventions for lookup_template_class. Refine handling of partial - instantiations. Remove calls to complete_template_args. - Simplify. Add consistency checks. Use set_mangled_name_for_decl - and set_mangled_name_for_template_decl. - (tsubst_copy): Use tsubst_aggr_type. - (instantiate_template): Use full template arguments. - (more_specialized): Improve formatting. - (more_specialized_class): Adjust calls to get_class_bindings. - (get_bindings_real): Don't call complete_template_args. - (most_specialized): Don't overwrite input; create a new list. - (most_specialized_class): Use most_general_template. - (regenerate_decl_from_template): Use unregister_specialization. - Use full template arguments. - (instantiate_decl): Use full template arguments. - (set_mangled_name_for_template_decl): New function. - * semantics.c (begin_class_definition): Use - maybe_process_partial_specialization. - (finish_member_class_template): New function. - (finish_template_decl): Likewise. - (finish_template_type): Likewise. - (typeck.c): Don't crash after issuing a compiler_error. - * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. - -1998-07-27 Jason Merrill - - * typeck2.c (build_functional_cast): Handle default-initialization. - - * call.c (build_over_call): Pass 1 to popclass. - - * parse.y (direct_notype_declarator): Add precedence declaration - to notype_unqualified_id case. - * Makefile.in (EXPECT): Adjust. - - * tree.c (ovl_member): Fix for single function in OVL. - -1998-07-27 Dave Brolley - - * c-lex.c (yylex): Fix boundary conditions in character literal and - string literal loops. - -1998-07-24 Jason Merrill - - * decl.c (lookup_name_real): OK, do return the from_obj value - unless got_object depends on template parms. - - * parse.y (nested_name_specifier_1): Pull out the TYPE_MAIN_VARIANT. - - * pt.c (coerce_template_parms): Also complain about local enums. - - * cp-tree.h: Add prototype for set_identifier_local_value. - * decl.c (set_identifier_local_value_with_scope): Make static, - prototype. - * search.c (covariant_return_p): Likewise. - * except.c (build_terminate_handler, alloc_eh_object): Likewise. - - * call.c (build_method_call): Only pull out the type of a destructor - if it's a template type parm. - * decl.c (lookup_name_real): Never return the from_obj value. - -1998-07-23 Jason Merrill - - * except.c (process_start_catch_block_old): Call start_decl_1 for - catch parm. - * decl.c (start_decl_1): Avoid duplicate error. - - * init.c (expand_default_init): Only perform the initialization if - it will do something. - -1998-07-23 H.J. Lu (hjl@gnu.org) - - * parse.y (base_class): Check for invalid base class. - -1998-07-23 Jason Merrill - - * decl2.c (import_export_template): Fold in... - (import_export_class): ...to here. Handle dllimport/export. - - * class.c (build_vtable): Pass at_eof to import_export_vtable. - (prepare_fresh_vtable): Likewise. - * decl2.c (import_export_class): Split out... - (finish_prevtable_vardecl): From here. - * class.c (finish_struct_1): Call import_export_class if at_eof. - - * decl.c (start_function): #if 0 mysterious code I wrote and have - forgotten why. - * rtti.c (get_tinfo_fn): If this is for a class type, set - DECL_CONTEXT. - -1998-07-22 Jason Merrill - - * inc/exception: Change terminate and unexpected to (). - - * parse.y (named_class_head_sans_basetype_defn): A - named_class_head_sans_basetype followed by '{' or ':' is a defn. - -1998-07-21 Jason Merrill - - * tree.c (canonical_type_variant): New fn to handle arrays. - * cp-tree.h (CANONICAL_TYPE_VARIANT): Remove. - * pt.c (unify, default case): Also fold arg. Fix array bounds case. - * method.c (process_overload_item): Use build_overload_value for - arrays. - -1998-07-20 Dave Brolley - - * lex.c (mbchar.h): #include it. - (GET_ENVIRONMENT): New macro. - (init_parse): Set character set based on LANG environment variable. - (real_yylex): Handle multibyte characters in character literals. - (real_yylex): Handle multibyte characters in string literals. - -1998-07-19 Jason Merrill - - * lex.c (do_identifier): Look for class value even if we don't - have a global value. Do implicit declaration if parsing is 2. - * semantics.c (finish_call_expr): Pass 2 if we're doing Koenig - lookup. - -1998-07-19 Mark Mitchell - - * decl.c (pushtag): Revert previous change. - * pt.c (lookup_template_class): Don't put out debugging - information for types that use template parameters. - - * decl.c (pushtag): Don't put out debugging information for - compiler-generated typedefs. - - * error.c (dump_type_real): Don't crash when presented with - intQI_type_node or the like. - - * semantics.c (finish_translation_unit): Fix spelling error in - comment. - -1998-07-17 Jason Merrill - - * decl.c (lookup_name_real): Pull out single function here. - (select_decl): Not here. - (unqualified_namespace_lookup): Use CP_DECL_CONTEXT. - - * decl.c (qualify_lookup): Tweak again. - - * pt.c (lookup_template_class): Don't mess with the context of the - instantiation. - * decl2.c (current_decl_namespace): Remove special handling for - templates. - - * pt.c (tsubst, case FUNCTION_DECL): Fix getting complete args for - a member template specialization. - - * tree.c (ovl_member): Use decls_match to compare functions. - * decl.c (decls_match): Check the context of a function. - - * parse.y (primary): Use notype_unqualified_id instead of IDENTIFIER - in Koenig lookup support rules. - * semantics.c (finish_call_expr): Handle the new cases. - - * typeck.c (build_x_function_call): Handle overloaded methods. - - * decl.c (grokvardecl): Don't call build_static_name for extern "C". - -1998-07-16 Mark Mitchell - - * semantics.c (finish_object_call_expr): Revert previous change. - * call.c (build_new_method_call): Likewise. Instead, convert - TYPE_DECLs to IDENTIFIERs here, in the presence of templates. - -1998-07-16 Jason Merrill - - * decl.c (qualify_lookup): Handle templates. - - * decl2.c (do_using_directive): Don't pass ancestor. - * decl.c (push_using_directive): Calculate ancestor. - - * decl2.c (do_nonmember_using_decl): Allow for type shadowing. - * decl.c (pushdecl): Move type shadowing handling from here... - (duplicate_decls): ...to here. - * decl.c (set_identifier_local_value_with_scope): New fn. - (pushdecl): Use it. - (set_identifier_local_value, lookup_type_current_level): New fns. - * decl2.c (do_local_using_decl): Handle types and binding level - stuff properly. - - * init.c (build_offset_ref): Don't call mark_used on an OVERLOAD. - * decl.c (select_decl): Extract a lone function from an OVERLOAD. - (lookup_namespace_name): Likewise. - * typeck.c (build_unary_op): Not here anymore. - - * decl2.c (do_class_using_decl): Make sure we get an identifier. - * class.c (handle_using_decl): Ignore TYPE_DECLs. - - * decl.c (qualify_lookup): New fn. - (lookup_name_real): Use it. - -1998-07-16 Martin v. Loewis - - * decl2.c (add_using_namespace): When directly using a namespace - that was indirect before, promote it. - - * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES, - LOOKUP_PREFER_BOTH, LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY, - LOOKUP_QUALIFIERS_ONLY, LOOKUP_TEMPLATES_EXPECTED): New macros. - * decl.c (select_decl): Replace two flag parameters by one. - (unqualified_namespace_lookup): Likewise, pass flag. - (lookup_flags): New function. - (lookup_name_real): Compute flags, pass them. - (lookup_namespace_name): Call with zero-flag. - * decl2.c (ambiguous_decl): Add flag parameter, complain only - according to flags. - (lookup_using_namespace, qualified_lookup_using_namespace): - Add flag parameter, pass them through. - * lex.c (do_scoped_id): Call with zero-flag. - -1998-07-16 Jason Merrill - - * typeck.c (convert_for_assignment): Use comptypes. - -1998-07-16 Mark Mitchell - - * semantics.c (finish_object_call_expr): Move test for the - function called being a TYPE_DECL to ... - * call.c (build_new_method_call): Here. - -1998-07-15 Jason Merrill - - * decl2.c (arg_assoc_class): Also look at template arguments, if any. - (arg_assoc): Handle error_mark_node and multiple levels of TREE_LIST. - - * lex.c (looking_for_typename): Don't initialize. - - * decl2.c (ambiguous_decl): Clarify error message. - - * decl.c (push_using_directive): Iterate over namespaces used - indirectly. - -1998-07-15 Martin v. Löwis - - * decl2.c (add_using_namespace): Iterate over namespaces used - indirectly. - - * decl.c (lookup_name_real): Accept namespace aliases as locals. - (cat_namespace_levels): Ignore aliases. - (duplicate_decls): Ignore duplicate aliases. - * decl2.c (do_namespace_alias): Process block level namespace - aliases. Store alias with pushdecl. Remove odr errors. - * parse.y (namespace_alias): New non-terminal. - (extdef): Use it. - -1998-07-15 Jason Merrill - - * decl2.c (arg_assoc_type): Handle METHOD_TYPE like FUNCTION_TYPE. - Handle TEMPLATE_TYPE_PARM. - (arg_assoc): Rewrite. - - * pt.c (complete_template_args): Don't look at the context unless - we have to. - - * method.c (build_decl_overload_real): Fix namespace handling. - - * typeck.c (build_unary_op): Extract a lone function from an - OVERLOAD. - - * call.c (build_scoped_method_call): Handle getting a namespace - for basetype in a destructor call. - (check_dtor_name): Handle enums. - - * parse.y (using_directive): New nonterminal. - (extdef, simple_stmt): Use it. - -1998-07-14 Martin von Löwis - - * decl2.c (add_function): Move error message ... - (arg_assoc_namespace): ... from here. - -1998-07-14 Jason Merrill - - * parse.y (namespace_qualifier): Fix multiple level handling. - * decl2.c (namespace_ancestor): Use CP_DECL_CONTEXT. - (arg_assoc): Don't skip the first argument of a function. - -Tue Jul 14 20:09:22 1998 Jeffrey A Law (law@cygnus.com) - - * search.c (my_tree_cons): Clean up. - -1998-07-14 Jason Merrill - - * call.c (joust): Don't warn about "confusing" conversions to the - same type. - -1998-07-14 Martin von Löwis - - * class.c (push_nested_class): Complain about namespaces. - * decl.c (start_decl): Enter the object's namespace. - (cp_finish_decl): Leave it. - (grokdeclarator): Likewise. - * decl2.c (check_decl_namespace): New function. - (finish_file): Call it. - * parse.y (complex_direct_notype_declarator): Set complexity - of namespace-qualified ids to -1, enter the namespace. - - * method.c (build_template_decl_overload): Expect _DECL as first - parameter. Put context temporarily into current_namespace. - * pt.c (check_explicit_specialization): Change caller. - (tsubst): Likewise. - - * init.c (build_offset_ref): Call mark_used and - convert_from_reference for namespace members. - -Mon Jul 13 23:25:28 1998 Martin von Löwis - - * search.c (my_tree_cons): The bitfield is at index 2. - -Mon Jul 13 17:21:01 1998 Nick Clifton - - * lang-options.h: Format changed to work with new --help support - in gcc/toplev.c - -1998-07-12 Martin von Löwis - - * decl2.c (build_expr_from_tree): Change calls of do_identifier. - Do Koenig lookup in CALL_EXPR. - (arg_assoc): Handle error_mark. - * lex.c (is_global): New function. - (do_identifier): Expect arguments for Koenig lookup. - * parse.y (primary): Add rules for calls of unqualified function calls. - (do_id): Change call of do_identifier. - * pt.c (finish_stmt_expr): Likewise. - * semantics.c (finish_id_expr): Likewise. - (finish_call_expr): Add integer parameter to indicate - argument-dependent lookup. - - * decl.c (struct binding_level): New field using_directives. - (push_using_decl): Not sorry anymore. - (push_using_directive): New function. - (lookup_tag): Use CP_DECL_CONTEXT to iterate. - (unqualified_namespace_lookup): New function, code from ... - (lookup_name_real): ... here. - * decl2.c (lookup_using_namespace): Pass using list instead of - initial scope. - (validate_nonmember_using_decl): New function. - (do_nonmember_using_decl): New function. - (do_toplevel_using_decl): Use them. - (do_local_using_decl): New function. - (do_using_directive): Support block-level directives. - * parse.y (simple_stmt): Support using declarations and - directives. - (namespace_qualifier, namespace_using_decl): New non-terminals. - - * xref.c (classname): New function. - (GNU_xref_hier): Change class and base parameters to tree. - * decl.c (xref_baseypes): Change caller. - * friend.c (make_friend_class): Likewise. - -1998-07-12 Kriang Lerdsuwanakij - - * typeck.c (comptypes, case TEMPLATE_TEMPLATE_PARM): Add parameter - comparison. - - * pt.c (for_each_template_parm, case TEMPLATE_DECL): If it is a - template template parameter, record its use. - (for_each_template_parm, case TEMPLATE_TEMPLATE_PARM): Traverse - its template arguments if exists. - - * pt.c (coerce_template_template_parms): New function equivalent - to coerce_template_parms when IS_TMPL_PARM is true. - (coerce_template_parms): Use it. Remove the IS_TMPL_PARM parameter, - all callers changed. - - (coerce_template_parms): Access ARGLIST properly when creating a - new vector. Only accept implicit TYPE_DECL as valid argument for - a template template parameter when it is a base class of - current_class_type. Don't display error message when COMPLAIN is - false. - -1998-07-12 Klaus Kaempf (kkaempf@progis.de) - - * repo.c (get_base_filename): Use file_name_nondirectory. - (open_repo_file): Likewise. - * cp-tree.h (file_name_nondirectory): Add prototype. - -1998-07-12 Jason Merrill - - * friend.c (do_friend): Pull the identifier out of declarator. - Use cp_error and friends. - * decl2.c (qualified_lookup_using_namespace): Fix call to - purpose_member. - * decl.c (lookup_name_real): Don't call complete_type on a namespace. - (grokvardecl): Use DECL_CLASS_SCOPE_P. - * cvt.c (convert_pointer_to_real): Check for error_mark_node sooner. - * class.c (warn_hidden): Fix for OVERLOAD. - From grahams@rcp.co.uk: - * cp-tree.h (DEFARG_NODE_CHECK): New macro. - (DEFARG_LENGTH, DEFARG_POINTER): Use it. - -Sun Jul 12 01:20:57 1998 Jeffrey A Law (law@cygnus.com) - - * g++.1 (-traditional): Remove duplicated documentation. - -1998-07-11 Mark Mitchell - - * method.c (flush_repeats): Add nrepeats parameter. - (issue_nrepeats): Likewise. - (is_back_referenceable_type): New function. Don't back-reference - TEMPLATE_TYPE_PARMs as well as simple types like integers. - (build_mangled_name_for_type): Likewise. - (build_mangled_name_for_type_with_Gcode): Likewise. - (lasttype): Remove. - (nrepeats): Likewise. - (Nrepeats): Likewise. - (start_squangling): Don't clear the variables removed above. - (end_squangling): Likewise. - (flush_repeats): Tidy. Use nrepeats parameter rather than - Nrepeats global. - (issue_nrepeats): Likewise, but with nrepeats global. Use - is_backreferenceable_type. - (build_overload_nested_name): Tidy. Add comment. Use - build_mangled_name_for_type. - (build_underscore_int): Comment. - (build_overload_scope_ref): Use build_mangled_name_for_type. - (build_overload_int): Likewise. - (build_template_template_parm_names): Tidy. - (build_template_parm_names): Use build_mangled_name_for_type. - (build_overload_identifier): Add comments. - (build_mangled_name_for_type_with_Gcode): Split out from - build_mangled_name. - (build_mangled_name_for_type): Use it. - (build_mangled_name): Rework to use build_mangled_name_for_type - and to not use global nrepeats/Nrepeats. Tidy. - (process_modifiers): Tidy. - (check_btype): Use is_backreferenceable_type. Add comment. - Rename `node' to `type'. - (process_overload_item): Set numeric_output_need_bar here. - Use build_mangled_name_for_type. Tidy. - (build_decl_overload_real): Tidy. Don't use Nrepeats. Use - build_mangled_name_for_type. - - * pt.c (push_template_decl_real): Don't look at DECL_TEMPLATE_INFO - for TYPE_DECLs. - -1998-07-08 Vladimir N. Makarov - - * cp-tree.h (warn_long_long): Define. - * decl.c (grokdeclarator): Add flag `warn_long_long' as guard for - warning "ANSI C++ does not support `long long'". - * decl2.c (warn_long_long): Define. - (lang_decode_option): Parse -Wlong-long, -Wno-long-long options. - -1998-07-07 Jason Merrill - - * decl.c (xref_tag): Handle attributes between 'class' and name. - * parse.y (aggr): Likewise. - * semantics.c (finish_class_definition): Likewise. - * Makefile.in (EXPECTED): Adjust. - - * cp-tree.h: Declare flag_optional_diags and warn_multichar. - * decl2.c: Define them. - (lang_decode_option): Handle them. - * lang-options.h: Add -foptional-diags. - * class.c (finish_struct): Don't complain about multiple meanings of - name if -fno-optional-diags. - * decl.c (pushdecl_class_level): Likewise. - * lex.c (real_yylex): Check warn_multichar. - -1998-07-06 Jason Merrill - - * decl.c (lookup_tag): Use CP_DECL_CONTEXT. - - * tree.c (make_binfo): Fix length. - -1998-06-30 Benjamin Kosnik - - * decl2.c (lang_decode_option): Remove warn_template_debugging. - * lang-options.h: Likewise. - -Mon Jun 29 20:17:40 1998 Kaveh R. Ghazi - - * except.c (build_eh_type_type_ref): Remove unused variable `susp'. - (process_start_catch_block): Likewise for variables - `false_label_rtx', `call_rtx' and `return_value_rtx'. - -1998-06-29 Brendan Kehoe - - * tree.c (build_srcloc): Make sure we allocate this node on the - permanent obstack. - -Sat Jun 27 23:34:18 1998 Fred Fish - - * g++spec.c (NEED_MATH_LIBRARY): Define to 1 if not already defined. - (lang_specific_driver): Initialize need_math with NEED_MATH_LIBRARY. - (lang_specific_driver): Only add -lm automatically if need_math is - nonzero. - -Sat Jun 27 12:22:56 1998 Jeffrey A Law (law@cygnus.com) - - * Make-lang.in (g++): Depend on mkstemp.o. Link in mkstemp.o - -Sat Jun 27 07:36:09 1998 Kaveh R. Ghazi - - * Makefile.in (EXPR_H): New dependency variable. - (decl2.o): Depend on $(EXPR_H). - (typeck.o): Likewise. - (init.o): Likewise. - (expr.o): Likewise. - -1998-06-25 Benjamin Kosnik - - * decl.c (start_enum): Put local enums on permanent_obstack. - -1998-06-25 Mark Mitchell - - * cp-tree.h (c_get_alias_set): Declare. - * decl.c (init_decl_processing): Set lang_get_alias_set. - -1998-06-25 Andrew MacLeod - - * cp-tree.h (mark_all_runtime_matches): Add function prototype. - * except.c (mark_all_runtime_matches): Set TREE_SYMBOL_REFERENCED - flag for all function decls which are in the exception table. - * exception.cc (__cplus_type_matcher): Check for CATCH_ALL_TYPE match. - * decl2.c (finish_file): Call mark_all_runtime_matches to make sure - code is emitted for any referenced rtti function. - -1998-06-25 Dave Brolley - - * lang-specs.h: Use new | syntax to eliminate - string concatenation. - -1998-06-25 Jason Merrill - - * cp-tree.h (CP_DECL_CONTEXT): New macro. - * decl2.c (is_namespace_ancestor, lookup_using_namespace): Use it. - * method.c (build_overload_nested_name): Likewise. - * sig.c (build_signature_pointer_or_reference_type): Don't set - DECL_CONTEXT. - -1998-06-24 Martin v. Löwis - - Set DECL_CONTEXT for globals to NULL_TREE instead of global_namespace. - * cp-tree.h (FROB_CONTEXT): New macro. - (DECL_MAIN_P): ::main should have a DECL_CONTEXT of NULL_TREE. - * decl.c (namespace_binding): Replace NULL_TREE with - global_namespace. - (set_namespace_binding, pop_namespace, lookup_name_real): Likewise. - * decl2.c (is_namespace_ancestor, lookup_using_namespace): - Likewise. - * decl.c (pushtag): Use FROB_CONTEXT. - (pushdecl, make_typename_type, define_function, grokdeclarator): - Likewise. - * decl2.c (set_decl_namespace, do_namespace_alias): Likewise. - * pt.c (push_template_decl_real, lookup_template_class, tsubst): - Likewise. - * decl2.c (decl_namespace): Return global_namespace if no context. - * method.c (build_overload_nested_name): Expect null as context. - * pt.c (mangle_class_name_for_template): Do nothing for null - contexts. - (lookup_template_class): Allow for null id_context. - -1998-06-25 Richard Henderson - - * method.c (emit_thunk): Set current_function_is_thunk for the - ASM_OUTPUT_MI_THUNK case as well. - -1998-06-23 Andrew MacLeod - - * exception.cc (__cplus_type_matcher): Get a match_info pointer - instead of an exception table entry as a parameter. - -1998-06-23 Andrew MacLeod - - * parse.y (function_try_block): Don't call start_catch_handler. - * except.c (call_eh_info): Remove coerced field from declaration. - (build_eh_type_type_ref): New function to create an address of a - rtti function for the new style exception tables. - (expand_start_catch_block): Split function, this contains the - common part. - (process_start_catch_block_old): New function to perform the rest - of expand_start_catch_block under old style exceptions. - (process_start_catch_block_old): New function to perform the rest - of expand_start_catch_block under new style exceptions. - (expand_end_catch_block): Only pop the false label off the stack under - the old style of exceptions. - * semantics.c (finish_try_block): Don't call start_catch_handler. - * exception.cc (struct cp_eh_info): Add original_value field. - (__cplus_type_matcher): Perform type matching on the original exception - value, and if we have a match, set the current value. - (__cp_push_exception): Set the original exception value. - -1998-06-23 Jason Merrill - - * call.c (joust): Fix confusing conversion warning. - - * call.c (build_op_delete_call): Add placement parm. Check - LOOKUP_SPECULATIVELY. - * cp-tree.h, decl2.c, init.c: Adjust. - * decl.c (finish_function): Use it. - - * pt.c (tsubst): Diagnose creating void fields or variables. - -Mon Jun 22 08:50:26 1998 Kaveh R. Ghazi - - * call.c (build_scoped_method_call): Remove unused variable `tmp'. - - * cp-tree.h (check_dtor_name): Add prototype. - - * init.c (expand_member_init): Remove unused variables - `ptr_type_node', `parm' and `rval'. - - * ptree.c (print_lang_type): Use HOST_WIDE_INT_PRINT_DEC specifier - in call to fprintf. - (lang_print_xnode): Likewise. - - * typeck2.c (enum_name_string): Cast argument to sprintf to long - and use %ld specifier. - - * xref.c (GNU_xref_end_scope): Use HOST_WIDE_INT_PRINT_DEC - specifier in call to fprintf. - (GNU_xref_member): Cast argument to sprintf to int. - -Fri Jun 19 23:22:42 1998 Bruno Haible - - * typeck2.c (pop_init_level): Warn about implicit zero initialization - of struct members. - -Thu Jun 18 09:32:32 1998 Kaveh R. Ghazi - - * cp-tree.h: Prototype function `check_java_method'. - -1998-06-17 Jason Merrill - - * class.c (finish_struct): Make conflicting use of id a pedwarn. - * decl.c (pushdecl_class_level): Likewise. - -1998-06-17 Mark Mitchell - - * pt.c (convert_nontype_argument): Issue an error when presented - with an integer (real) constant that cannot be simplified to an - INT_CST (REAL_CST). - - * cp-tree.h (c_get_alias_set): Remove declaration added in - 1998-06-13 change that should never have been checked in. - -1998-06-17 Jason Merrill - - * typeck.c (build_binary_op_nodefault): Change % in format strings - to %%. - - * decl.c (grokvardecl): Don't build_static_name for decls that - aren't at namespace scope. - - * init.c (perform_member_init): Catch default-initialization of - references. - -1998-06-17 Mark Mitchell - - * errfn.c (cp_thing): Handle the `%%' formatting sequence. - -1998-06-17 Jason Merrill - - * method.c (hack_identifier): Complain about getting a namespace - or class template. - * typeck.c (decay_conversion): Remove check for namespaces. - * typeck2.c (incomplete_type_error): Likewise. - * parse.y (template_arg): Add PTYPENAME expansion. - -1998-06-16 Andrew MacLeod - - * decl.c (grokvardecl): Don't build external assembler names for - TYPENAMEs in other namespaces as there is no declarator. - * error.c (cp_file_of, cp_line_of): Don't extract file or line number - info from DECL_CONTEXT if it is NULL. - -1998-06-16 Jason Merrill - - * call.c (check_dtor_name): Split out. - (build_scoped_method_call): Use it. - (build_method_call): Use it. - * init.c (build_offset_ref): Use it. - - * typeck.c (build_static_cast): Fix handling of pointers to members. - - * decl.c (finish_function): Just return nothing from a constructor. - * typeck.c (c_expand_return): Complain about returning a void - expression from a destructor. - -1998-06-13 Mark Mitchell - - * class.c (alter_access): Accept a BINFO explaining how to get - from the entity whose accessed is being altered to the type doing - the altering. - (handle_using_decl): New function containing code split out from ... - (finish_struct_1): Here. - - * cp-tree.h (complete_type_or_else): Declare. - * init.c (build_new_1, build_delete): Use it. - * typeck.c (require_complete_type): Use complete_type, rather than - expanding it inline. - (complete_type_or_else): New function. - (build_component_ref): Use it. - (pointer_int_sum): Make sure the type pointed to is complete. - (pointer_diff): Likewise. - - * pt.c (for_each_template_parm): Traverse the TYPE_CONTEXT for - types. - - * search.c (get_matching_virtual): Note that member templates - cannot override virtual functions. - -1998-06-12 Brendan Kehoe - - * pt.c (check_explicit_specialization): If DECLARATOR turned into - an error_mark_node from lookup_template_function, return the same. - (determine_specialization): Also make sure TEMPLATE_ID isn't an - error_mark_node, before we try to read its operands. - * decl.c (grokdeclarator): If we got an error_mark_node from - check_explicit_specialization, just return it right back. - -1998-06-12 Mark Mitchell - - * class.c (instantiate_type): Don't treat template-ids that don't - specify any template arguments as equivalent to ordinary - identifiers. Use OFFSET_REF instead of SCOPE_REF to refer to - pointer-to-members for member templates. Tidy slightly. - * cp-tree.def (TEMPLATE_ID_EXPR): Revise documentation. - * init.c (build_offset_ref): Handle template-ids like ordinary - identifiers, for the most part, but store a TEMPLATE_ID_EXPR in the - offset part of the OFFSET_REF. - * typeck.c (build_unary_op): Change check for unknown types to - look for OFFSET_REFs, not SCOPE_REFs. - -1998-06-11 Mark Mitchell - - * pt.c (is_member_template_class): New function. - (push_template_decl_real): Use it. - -1998-06-11 Benjamin Kosnik - - * friend.c (do_friend): Add support for nested classes using - member functions of the enclosing class as friends. - -1998-06-10 Mark Mitchell - - * call.c (convert_default_arg): Make global, not static. - (convert_arg_for_ellipsis): Split out from ... - (build_over_call): Here. - * cp-tree.h (convert_default_arg); Declare. - (convert_arg_to_ellipsis): Likewise. - (do_member_init): Remove. - * init.c (do_member_init): Remove; this code is dead. - (expand_member_init): Remove much of this code; it is dead. - * typeck.c (convert_arguments): Use convert_default_arg and - convert_arg_for_ellipsis, rather than duplicating here. - - * call.c (convert_like): Don't fail silently if - build_user_type_conversion fails. Always return error_mark_node - for failure. - -1998-06-10 Jason Merrill - - * search.c (covariant_return_p): Complain about ambiguous base. - - * typeck.c (build_component_ref): Diagnose ref to nested type. - -1998-06-10 Brendan Kehoe - - * decl.c (grokparms): Check that INIT isn't an error_mark_node - before giving error about invalid type for default arg. - -1998-06-10 Jason Merrill - - * call.c (build_method_call): Fix thinko. - -1998-06-10 Dave Brolley - - * decl2.c (lang_decode_option): New argc/argv interface. - * cp-tree.h (lang_decode_option): New argc/argv interface. - * lang-specs.h (default_compilers): Only call cpp if -E, -M or -MM is - specified for cpplib-enabled compilers. - * lex.c (lang_init): Don't check_newline for cpplib. - (init_parse): Don't initialize cpplib here. - -1998-06-10 Brendan Kehoe - - * typeck.c (build_component_ref): Make sure FIELD has a lang_specific - piece before checking DECL_MUTABLE_P. - -1998-06-10 John Carr - - * tree.c (debug_binfo): Make printf format match arguments. - - * error.c (OB_PUTI): Make printf format match arguments. - -1998-06-10 Jason Merrill - - * init.c (perform_member_init): Handle default-initialization. - - * except.c (build_throw): Handle throwing NULL. - - * typeck.c (build_x_function_call): Use resolve_offset_ref. - - * search.c (compute_access): Only strip an anonymous union - for a FIELD_DECL. - - * call.c (add_builtin_candidates): Tweak. - - * cvt.c (build_expr_type_conversion): Restore code for conversion - from class types. - * decl2.c (delete_sanity): Use it. Clean up. - - * typeck.c (comp_ptr_ttypes_real): Fix cv-qual comparisons. - -1998-06-10 Branko Cibej - - * typeck.c (c_expand_return): Don't warn about void expressions on - return statements in functions returning void. - -1998-06-09 Mark Mitchell - - * pt.c (fn_type_unification): Revise documentation. Tidy. - (type_unification): Likewise. - -1998-06-09 Andrew MacLeod - - * semantics.c (finish_try_block): Rename expand_start_catch, and delete - expand_end_catch. - * parse.y (function_try_block): Rename expand_start_catch, and delete - expand_end_catch. - * except.c (expand_end_eh_spec): Rename expand_start_catch, and delete - expand_end_catch. - -1998-06-09 Jason Merrill - - * search.c (lookup_member): New fn. - * class.c (finish_struct_1): Use it. - * decl.c (lookup_name_real): Use it. - -Mon Jun 8 20:45:52 1998 Kaveh R. Ghazi - - * Makefile.in (decl2.o): Depend on dwarf2out.h and dwarfout.h. - - * cp-tree.h: Add prototype for `maybe_print_template_context' and - `maybe_make_one_only'. - - * decl.c (auto_function): Remove unused variable `decl'. - - * decl2.c: Include dwarf2out.h and dwarfout.h. - - * lex.c: Remove redundant declarations of `set_float_handler' and - `asm_out_file'. - -1998-06-08 Andrew MacLeod - - * except.c (init_exception_processing): Remove NEW_EH_MODEL compile - time flag. Call __cp_eh_info instead of __cp_exception_info. - * exception.cc (struct cp_eh_info): Remove NEW_EH_MODEL flag. - (__cp_exception_info): Return offset into cp_eh_info structure to - match what use to be the start of this structure. - (__cp_eh_info): New function to return a pointer to cp_eh_info struct. - (__cplus_type_matcher, __cp_push_exception): Remove NEW_EH_MODEL - compile time flag. - (__uncatch_exception, __check_eh_spec, std::uncaught_exception): Call - __cp_eh_info instead of __cp_exception_info. - -1998-06-08 Jason Merrill - - * decl.c (cp_finish_decl): Disable inlining of extern inlines - with static variables. - -1998-06-08 Mark Mitchell - - * init.c (build_offset_ref): Correct previous change to use build, - not build_min. - -1998-06-07 Mark Mitchell - - * class.c (instantiate_type): Handle pointer-to-members where the - member is a template. - * init.c (build_offset_ref): Likewise. - * typeck.c (build_unary_op): Likewise. - -1998-06-07 Richard Henderson - - * lex.c (lang_init_options): New function. - (lang_init): Remove flag_exceptions == 2 hack. - -1998-06-05 Jason Merrill - - * search.c (envelope_add_decl): Tweak for implicit typename. - - * call.c (joust): Also warn about confusing conversion op/constructor - overload resolution. - - * spew.c (yylex): Also return the TYPE_DECL if got_object. - Don't clear got_object after '~'. - * call.c (build_scoped_method_call): Tweak destructor handling. - (build_method_call): Likewise. - * pt.c (tsubst_copy, case METHOD_CALL_EXPR): Don't mess with - TYPE_MAIN_VARIANT for destructors. - * semantics.c (finish_object_call_expr): Complain about calling a - TYPE_DECL. - -1998-06-05 Per Bothner - - * g++spec.c (lang_specific_pre_link, lang_specific_extra_ofiles): - Define - update needed by gcc.c change. - -1998-06-05 Jason Merrill - - * error.c (cp_printers): Use 'o' instead of '_' for the null entry. - -1998-06-05 Martin v. Loewis - - * cp-tree.h (DECL_NAMESPACE_ALIAS, ORIGINAL_NAMESPACE): Declare. - * decl.c (lookup_name_real): Add namespaces_only parameter. - If set, return only NAMESPACE_DECLs. - (select_decl): Likewise. - (identifier_type_value): Give additional parameter. - (lookup_name_nonclass): Likewise. - (lookup_name): Likewise. - (find_binding): Skip namespace aliases. - (binding_for_name): Likewise. - (push_namespace): Check for namespace aliases. - (lookup_name_namespace_only): New function. - (begin_only_namespace_names, end_only_namespace_names): New functions. - * decl2.c (set_decl_namespace): Skip namespace aliases. - (do_using_directive): Likewise. - (do_namespace_alias): Produce namespace aliases, fix alias - redeclaration. - * error.c (dump_decl): Support SCOPE_REF. - * parse.y (extdef): Wrap lookup with namespace_only for namespace - aliases and using declarations. - -1998-06-04 Jason Merrill - - * tree.c (really_overloaded_fn): Only see through one TREE_LIST. - - * error.c (dump_expr): Clean up NEW_EXPR case. - -1998-06-04 Martin von Löwis - - Suggested by Brendan Kehoe - * decl2.c (do_toplevel_using_decl): When decl is a TYPE_DECL, - treat it as using ::decl. - - * decl2.c (arg_assoc_type): Process unknown_type_node and OFFSET_TYPE. - - * tree.c (mapcar): Support NEW_EXPR. - - * error.c (dump_expr): Support NEW_EXPR. - -1998-06-03 Jason Merrill - - * method.c (make_thunk): Use overload machinery to make name. - * search.c (covariant_return_p): New fn. - (get_matching_virtual): Use it. - - * init.c (build_new_1): Fix check for void. - -1998-06-01 Per Bothner - - * cp-tree.h (TYPE_FOR_JAVA): New macro. - * decl.c, cp-tree.h (java_byte_type_node, java_short_type_node, - java_int_type_node, java_long_type_node, java_float_type_node, - java_double_type_node, java_char_type_node, java_boolean_type_node): - New "primitive" types, with predefined names __java_byte etc. - (record_builtin_java_type): New function. - (init_decl_processing): Make Java types with record_builtin_java_type. - (pushtag, grokdeclarator): Set TYPE_FOR_JAVA if in extern "JAVA". - (xref_baseypes): If base class was TYPE_FOR_JAVA, so is this class. - (grokfndecl): Call check_java_method for Java classes. - * method.c (is_java_type): Removed. Replaced with TYPE_FOR_JAVA. - (process_overload_item): Match types against specific - java_XX_type_node types, rather than using is_java_type. - * class.c (finish_struct_1): Don't add default copy constructor - or operator= if TYPE_FOR_JAVA. - (pop_lang_conext): Restore strict_prototyp proper if Java. - * decl2.c (acceptable_java_type, check_java_method): New functions. - * pt.c (instantiate_class_template): Copy TYPE_FOR_JAVA from pattern. - (tsubst): Move common statement after if statement. - * typeck.c (comptypes): If strict, TYPE_FOR_JAVA must match. - -1998-06-01 Jason Merrill - - * pt.c (for_each_template_parm): Use first_rtl_op. - - * tree.c (build_cplus_array_type_1): Also check index_type for - template parms. - -1998-05-31 Jason Merrill - - * pt.c (tsubst): Always copy BINFO_BASETYPES. - -1998-05-29 scott snyder - - * tree.c (layout_basetypes): If we change TYPE_SIZE, change - TYPE_SIZE_UNIT too. - -1998-05-29 Mark Mitchell - - * decl.c (grokdeclarator): Don't complain about in-class - initialization of static consts if we don't really know the type - of the variable. - -1998-05-29 Jason Merrill - - * cp-tree.h (DECL_DESTRUCTOR_P): New macro. - * method.c (build_destructor_name): New fn. - * decl2.c (maybe_retrofit_in_chrg): Split out... - (grokclassfn): From here. Reorganize. - * decl.c (grok_ctor_properties): Make sure ctors for types with - vbases have the in_chrg parm. - * pt.c (instantiate_class_template): Update - TYPE_USES_VIRTUAL_BASECLASSES from tsubsted bases. Don't call - grok_*_properties. - (tsubst): Call grok_ctor_properties and maybe_retrofit_in_chrg. - -1998-05-28 Mark Mitchell - - * pt.c (instantiate_decl): Make test for whether or not static - variables should be instantiated early match its comment. - -1998-05-28 Jason Merrill - - * decl.c (start_decl): Always pedwarn about vacuously redeclaring - a member. - (start_function): Call check_default_args. - * decl2.c (grokfield): Don't call check_default_args. - (check_default_args): Use cp_error_at. - * lex.c (do_pending_defargs): Call check_default_args. - -1998-05-27 Brendan Kehoe - - * call.c (build_method_call): Make sure get_type_value returns - something before we try to use its TYPE_MAIN_VARIANT. - (build_scoped_method_call): Likewise. - -1998-05-27 Jason Merrill - - * typeck2.c (digest_init): Complain about getting a TREE_LIST to - initialize an array. - - * search.c (expand_upcast_fixups): Don't set DECL_CONTEXT and - DECL_VIRTUAL_P. - - * friend.c (do_friend): Clarify template warning. - -1998-05-27 Mark Mitchell - - * decl.c (shadow_label): Don't treat decls as identifiers. - (maybe_push_to_top_level): Clear shadowed_labels. - - * pt.c (instantiate_decl): Reset lineno and filename after calling - regenerate_decl_from_template. - - * decl.c (grokdeclarator): Don't try to use TYPE_OBSTACK on an - error_mark_node. - -1998-05-27 Kevin Buhr - - * parse.y (base_class): Use is_aggr_type, not IS_AGGR_TYPE. - -1998-05-26 Kriang Lerdsuwanakij - - * pt.c (process_template_parm): Accept TYPENAME_TYPE nodes. - (convert_nontype_argument): Handle cases when nontype template - parameters become classes after substitution. - -1998-05-26 Mark Mitchell - - * friend.c (is_friend): Use comptypes, rather than == to compare - types. Modify for new representation of template friends. - (make_friend_class): Likewise. - * pt.c (tsubst_friend_class): Undo 1998-05-21 change. Tweak. - (instantiate_class_template): Deal with template friends. - - * decl.c (store_parm_decls): Remove redundant call to - expand_main_function. - -1998-05-26 Benjamin Kosnik - - * decl.c (start_decl): Check for DECL_LANG_SPECIFIC before - DECL_USE_TEMPLATE. - -1998-05-26 Per Bothner - - * language_as_string: Handle lang_java. - -1998-05-26 Jason Merrill - - * decl.c (pushdecl): Don't copy the type_decl. - -1998-05-26 Martin v. Löwis - - * class.c (pushclass): Always store TYPE_MAIN_VARIANT in - current_class_type. - * decl.c (grokdeclarator): Put typedefs on the type's obstack. - - * parse.y (complex_direct_notype_declarator): Use $1 to access - scope of notype_qualified_id. - -1998-05-26 Dave Brolley - - * lex.c (parse_options,yy_cur,yy_lim): Add for cpplib. - (init_parse): Initialize cpplib interface. - - * Makefile.in (CXX_OBJS): Make sure dependencies never end with an - empty continuation. - -1998-05-26 Mark Mitchell - - * decl.c (pushtag): Avoid crashing on erroneous input. - -1998-05-25 Martin v. Löwis - - * decl.c (push_namespace): Only produce one unique name for - anonymous namespaces. - (get_unique_name): Remove. - -1998-05-25 Mark Mitchell - - * call.c (tourney): Don't do any extra comparisons. - - * decl2.c (build_anon_union_vars): Don't crash on empty sub-unions. - - * cp-tree.h (processing_template_parmlist): Declare. - * decl.c (pushtag): Don't call push_template_decl when we - shouldn't. - * pt.c (processing_template_parmlist): New variable. - (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): New macro. - (complete_template_args): Use it. - (add_to_template_args): Likewise. - (innermost_args): Likewise. - (tsubst): Likewise. - (begin_template_parm_list): Use processing_template_parmlist. - (end_template_parm_list): Likewise. - - * cp-tree.h (ANON_UNION_TYPE_P): New macro. - * decl.c (grokdeclarator): Use it. - * decl2.c (grok_x_components): Likewise. - * init.c (initializing_context): Likewise. - * method.c (do_build_copy_constructor): Likewise. - (do_build_assign_ref): Likewise. - * search.c (compute_access): Likewise. - * typeck.c (build_component_ref): Likewise. - - * decl.c (grokdeclarator): Don't give a cv-qualified version of an - unnamed type a typedef name "for linkage purposes". - - * pt.c (lookup_template_class): Don't look at - IDENTIFIER_CLASS_VALUE when there's no current_class_type. - - * method.c (build_overload_int): Handle error cases gracefully. - - * pt.c (instantiate_decl): Handle static member variables - correctly. - - * pt.c (tsubst): Use the tsubst'd type when producing new - TEMPLATE_PARM_INDEX nodes. - -1998-05-24 Mark Mitchell - - * tree.c (cp_tree_equal): Handle pointers to member functions. - - * call.c (maybe_handle_implicit_object): Handle QUAL_CONVs. Make - sure the type of the REF_BIND is a reference type. - (maybe_handle_ref_bind, compare_ics): Rename reference_type to - target_type for clarity. - - * parse.y (xcond): Move call to condition_conversion ... - * semantics.c (finish_for_cond): Here. - * parse.c: Regenerated. - -1998-05-24 Jason Merrill - - * decl.c (push_namespace): Namespaces have type void. - * typeck2.c (incomplete_type_error): Complain about namespace - used as expression. - * typeck.c (decay_conversion): Likewise. - -1998-05-24 Martin von Löwis - - * error.c (dump_expr): Support namespaces. - -1998-05-23 Jason Merrill - - * cp-tree.def: Add SRCLOC. - * cp-tree.h: Add struct tree_srcloc and accessor macros. - * tree.c (build_srcloc, build_srcloc_here): New fns. - * pt.c (add_pending_template): Use build_srcloc_here. - (push_tinst_level): Update last_template_error_tick before erroring. - (instantiate_decl): Restore lineno and input_filename before - calling add_pending_template. - * decl2.c (finish_file): Set up lineno and input_filename for - pending templates. - -1998-05-22 Jason Merrill - - * decl.c (lang_print_error_function): New fn. - (init_decl_processing): Set print_error_function to use it. - * errfn.c (cp_thing): Don't call maybe_print_template_context here. - - * call.c (maybe_handle_ref_bind): Propagate ICS_USER_FLAG and - ICS_BAD_FLAG. - - * cvt.c (ocp_convert): Don't set LOOKUP_NO_CONVERSION for - copy-initialization. - - * class.c (build_vtable_entry): Use int_fits_type_p. - (build_vtable): Pass a signed offset to build_vtable_entry. - (prepare_fresh_vtable, modify_one_vtable, fixup_vtable_deltas1, - set_rtti_entry): Likewise. - -1998-05-22 Per Bothner - - * cp-tree.h: Add comments documenting which LANG_FLAGS are used. - (C_TYPE_VARIABLE_SIZE, C_DECL_VARIABLE_SIZE): Removed, not used. - -1998-05-22 Jason Merrill - - * pt.c (print_template_context): Use fprintf instead of cp_error. - - * pt.c (determine_specialization): Just return an error_mark_node. - Also print the decl we want in error messages. If we complain, - return error_mark_node. - (tsubst_friend_function): Set lineno and input_filename so - error messages will be useful. - (instantiate_template): Just return an error_mark_node. - (check_explicit_specialization): Don't mess with a returned - error_mark_node. - - * pt.c (print_template_context): Add new argument. - (maybe_print_template_context): New fn. - (push_tinst_level): Increment tinst_level_tick. - (pop_tinst_level): Likewise. - * errfn.c (cp_thing): Call maybe_print_template_context. Use - xrealloc instead of xmalloc. - - * typeck.c (build_unary_op, CONVERT_EXPR): Propagate TREE_CONSTANT. - -1998-05-21 Jason Merrill - - * pt.c (tsubst_friend_class): Don't call redeclare_class_template - if the template we looked up is the same as the one we already - have. - -Thu May 21 11:54:44 1998 Dave Brolley - - * lex.c: (handle_sysv_pragma): FILE* parameter not used. - (cpp_reader,parse_in): Add for cpplib. - (check_newline): Call handle_sysv_pragma with new interface. - (check_newline): Call GET_DIRECTIVE_LINE, not get_directive_line. - - * input.c: (yy_cur,yy_lim,yy_get_token,GETC): Add for cpplib. - (sub_getch): Call GETC for cpplib. - - * cp-tree.h: (get_directive_line): Different prototype for cpplib. - (GET_DIRECTIVE_LINE): Macro wrapper for get_directive_line. - - * Makefile.in (CXX_OBJS): Add @extra_cxx_objs@ for cpplib. - -1998-05-21 Jason Merrill - - * decl2.c (maybe_make_one_only): New fn. - (import_export_vtable): Use it. - (import_export_decl): Likewise. - * pt.c (mark_decl_instantiated): Likewise. - -1998-05-21 Mark Mitchell - - * decl2.c (find_representative_member): Rename to ... - (build_anon_union_vars): New function. - (finish_anon_union): Fix stupidity of previous change. - -1998-05-20 Jason Merrill - - * decl.c (grokfndecl): Handle definition of specialization in - friend declaration. - - * error.c (dump_decl): Fix LOOKUP_EXPR handling. - -1998-05-20 Mark Mitchell - - * class.c (delete_duplicate_fields_1): Use DECL_DECLARES_TYPE_P - to look for type declarations. - (finish_struct): Deal with templates on the CLASSTYPE_TAGS list. - * cp-tree.h (DECL_DECLARES_TYPE_P): New macro. - (finish_member_class_template): Declare. - * decl.c (pushtag): Put member class templates on the - CLASSTYPE_TAGS list, just as for ordinary member classes. - (pushdecl_class_level): Use DECL_DECLARES_TYPE_P. - (lookup_tag): Look for IDENTIFIER_CLASS_VALUEs, just as with - IDENTIFIER_NAMESPACE_VALUEs. - * parse.y (component_decl): Move code to ... - * semantics.c (finish_member_class_template): New function. - Don't put member class templates on the list of components for a - class. - * parse.c: Regenerated. - * pt.c (classtype_mangled_name): Don't try DECL_CONTEXT on types. - In fact, don't use DECL_CONTEXT at all here. - -1998-05-20 Martin von Loewis - - * decl.c (record_unknown_type): New function. - (init_decl_processing): Call it for the unknown and global type - nodes. - -1998-05-20 Mark Mitchell - - * decl2.c (find_representative_member): New function. - (finish_anon_union): Use it. - - * cp-tree.h (MAIN_NAME_P): New macro. - (DECL_MAIN_P): Likwise. - * decl.c (pushdecl): Avoid crashing on redefinitions of `main'. - (grokfndecl): Use the new macros. - (grokdeclarator): Likewise. - (start_function): Likewise. - (store_parm_decls): Likewise. - (finsh_function): Likewise. - * friend.c (do_friend): Likewise. - * typeck.c (build_function_call_real): Likewise. - (build_unary_op): Likewise. - -Wed May 20 02:16:01 1998 Jason Merrill - - * decl2.c (start_objects, finish_objects, do_dtors, - do_ctors): Split out from... - (finish_file): ...here. - -Tue May 19 20:36:23 1998 Jason Merrill - - * tree.c (is_overloaded_fn): Don't abort on placeholders from - push_class_decls. - -Tue May 19 15:16:22 1998 Brendan Kehoe - - * class.c (is_empty_class): Return 0 if TYPE is an error_mark_node. - - * error.c (dump_expr): Handle an ARROW_EXPR. - -Tue May 19 15:13:39 1998 Mark Mitchell - - * decl.c (saveable_obstack): Declare. - (pushdecl): Copy TYPE_DECLs to the same obstack as the type they - declare, if necessary. - -Tue May 19 14:50:27 1998 Mark Mitchell - - * call.c (compare_qual): Remove. - (is_subseq): Tweak. - (is_properly_derived_from): New function. - (maybe_handle_ref_bind): Likewise. - (maybe_handle_implicit_object): Likewise. - (compare_ics): Modify substantially to bring into conformance with - the standard. - * cp-tree.h (TYPE_PTRMEMFUNC_OBJECT_TYPE): New macro. - (comp_cv_qualification): Declare. - (comp_cv_qual_signature): Likewise. - * typeck.c (comp_cv_qualification): Likewise. - (comp_cv_qual_signature): Likewise. - -Tue May 19 10:05:02 1998 Kaveh R. Ghazi - - * Makefile.in (parse.o): Depend on toplev.h. - - * class.c (typecode_p): Remove prototype and definition. - - * cp-tree.h (currently_open_class, is_empty_class, member_p): - Add prototype. - - * decl.c (push_overloaded_decl_top_level): Remove prototype and - definition. - - * errfn.c (cp_error): Cast function pointer `error' to (errorfn *) - in call to `cp_thing'. - (cp_warning): Likewise for function pointer `warning'. - - * except.c (do_function_call): Remove prototype and definition. - (call_eh_info): Wrap variable `t1' in macro NEW_EH_MODEL. - - * method.c (is_java_type): Add prototype and make it static. - - * parse.y: Include toplev.h. - - * pt.c (type_unification): Remove unused variable `arg'. - (instantiate_decl): Likewise for `save_ti'. - - * tree.c (propagate_binfo_offsets): Likewise for `base_binfos'. - -Tue May 19 02:43:25 1998 Jason Merrill - - * init.c (build_member_call): Handle template_ids. - * parse.y (primary): Add global_scope template_id. - -Mon May 18 23:22:52 1998 Jason Merrill - - * decl2.c (get_sentry): Use end_temporary_allocation. - Don't declare permanent_obstack. - -Mon May 18 12:28:44 1998 Mark Mitchell - - * parse.y (.finish_new_placement): New non-terminal. - (unary_expr, new_type_id): Use it. - * parse.c: Regenerated. - -Mon May 18 12:20:27 1998 Brendan Kehoe - - * pt.c (redeclare_class_template): Say where the original definition - of the template-parameter's default argument appeared. - -Mon May 18 03:00:57 1998 Jason Merrill - - * call.c (build_over_call): Tweak empty class handling. - - * decl.c (make_typename_type): Use currently_open_class. - - * class.c (instantiate_type): Don't abort on TREE_NONLOCAL_FLAG. - -Mon May 18 01:43:01 1998 Martin v. Loewis - - * decl.c (lookup_name_real): Don't look at IDENTIFIER_LOCAL_VALUE - for a type unless it is one. - - * class.c (finish_struct_1): Use OVL_CURRENT in error message. - -Mon May 18 01:24:08 1998 Jeffrey A Law (law@cygnus.com) - - * Makefile.in (program_transform_name, objdir): Define. - - * Makefile.in (BISON): Use bison from the build tree if it exists. - (FLEX): Likewise. - -Sun May 17 14:52:08 1998 Martin v. Loewis - - * typeck.c (type_unknown_p): Return true for TREE_LIST also. - - * call.c (build_method_call): Use TYPE_MAIN_VARIANT on typedefs. - -Sun May 17 14:51:41 1998 Jason Merrill - - * call.c (build_scoped_method_call): Likewise. - -Sun May 17 13:53:48 1998 Mark Mitchell - - * init.c (build_new_1): Call suspend_momentary around the creation - of values that must be saved for exception handling. - * parse.y (.build_new_placement): New non-terminal. - (unary_expr, new_placement): Use it. - * parse.c: Regenerated. - -Sun May 17 12:32:08 1998 Jason Merrill - - * decl.c (duplicate_decls): Use CANONICAL_TYPE_VARIANT to compare - old and new types. - - * pt.c (tsubst): Make sure that BINFO_TYPE of new binfos is the - canonical type. - - * call.c (build_over_call): Don't use IS_SIGNATURE on a namespace. - -Fri May 15 20:28:00 1998 Jason Merrill - - * decl.c (start_decl): Revert problem change. - - * Makefile.in (CONFLICTS): Fix. - -Fri May 15 15:34:02 1998 Benjamin Kosnik - - * decl.c (duplicate_decls): Clean up, add DECL_DATA_AREA bits. - -Fri May 15 00:46:05 1998 Jason Merrill - - * class.c (finish_struct_1): Use BINFO_SIZE. - - * decl.c (start_decl): Use 'tem'. - -Thu May 14 16:30:47 1998 Andrew MacLeod - - * exception.cc: Include eh-common.h. - (struct cp_eh_info): Add eh_info struct with NEW_EH_MODEL. - (__cplus_type_matcher): First stab at new C++ runtime type matcher. - (__cp_push_exception): Initialize eh_info struct as well. - * except.c: Remove local structs and include eh-common.h. - (init_exception_processing): Set language and version codes. - (call_eh_info): Add presence of eh_info to runtime description of - struct cp_eh_info. - (expand_end_eh_spec): Call start_catch_block() and end_catch_block(). - * semantics.c (finish_try_block): Call start_catch_block() and - end_catch_block(). - * parse.y (function_try_block): Call start_catch_block() and - end_catch_block(). - -Thu May 14 12:27:34 1998 Brendan Kehoe - - * typeck.c (original_type): New function. - (common_type): Use it to get the DECL_ORIGINAL_TYPE for T1 and T2, - to see if they're actually the same. - * cp-tree.h (original_type): Declare. - -Wed May 13 12:54:30 1998 Kaveh R. Ghazi - - * Makefile.in (lex.o): Depend on output.h. - - * call.c (add_function_candidate): Remove unused variable `cand'. - (add_conv_candidate): Likewise. - (build_builtin_candidate): Likewise. - - * cp-tree.h: Add prototype for `types_overlap_p'. - - * decl.c (signal_catch): Mark parameter `sig' with ATTRIBUTE_UNUSED. - - * decl2.c (merge_functions): Remove unused variables `tmp' and - `tempn'. - - * error.c (expr_as_string): Mark parameter `v' with ATTRIBUTE_UNUSED. - (code_as_string): Likewise. - (language_as_string): Likewise. - (parm_as_string): Likewise. - (op_as_string): Likewise. - (assop_as_string): Likewise. - (cv_as_string): Likewise. - - * lex.c: Include output.h. - - * pt.c (type_unification): Cast first argument of `bzero' to a char*. - - * search.c (dfs_no_overlap_yet): Mark parameter `t' with - ATTRIBUTE_UNUSED. - - * tinfo.cc (__class_type_info::dcast): Change the type of variable - `i' from int to size_t. - - * typeck.c (language_lvalue_valid): Mark parameter `exp' with - ATTRIBUTE_UNUSED. - -Tue May 12 21:37:49 1998 Jason Merrill - - * error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/or - DECL_NAMESPACE_SCOPE_P. - (lang_decl_name): Likewise. - * pt.c (tsubst_friend_function, tsubst): Likewise. - * decl.c (pushdecl, redeclaration_error_message, start_decl, - cp_finish_decl, start_function): Likewise. - * class.c (finish_struct_1): Likewise. - * call.c (build_over_call): Likewise. - (compare_ics): Use DERIVED_FROM_P. - -Tue May 12 07:24:18 1998 Mark Mitchell - - * cp-tree.h (CANONICAL_TYPE_VARIANT): New macro. - * method.c (build_mangled_name): Use it. - (build_decl_overload_real): Likewise. - - * error.c (dump_simple_decl): New function, broken out from ... - (dump_decl): Use it. - -Mon May 11 11:38:07 1998 Mark Mitchell - - * ptree.c (lang_print_xnode): Add missing `break'. - - * pt.c (tsubst): Remove duplicate check for IDENTIFIER_NODE. - - * call.c (add_template_candidate): Adjust for changes to - fn_type_unification. - (add_template_candidate_real): Likewise. - (add_template_conv_candidate): Likewise. - (build_user_type_conversion_1): Likewise. - (build_new_function_call): Likewise. - (build_object_call): Likewise. - (build_new_op): Likewise. - (build_new_method_call): Likewise. - * class.c (instantiate_type): Likewise. - * cp-tree.h (unification_kind_t): New type. - (fn_type_unification): Adjust prototype. - (type_unificaiton): Likewise. - * pt.c (UNIFY_ALLOW_NONE): New macro. - (UNIFY_ALLOW_MORE_CV_QUAL): Likewise. - (UNIFY_ALLOW_LESS_CV_QUAL): Likewise. - (UNIFY_ALLOW_DERIVED): Likewise. - (unify): Change prototype. - (maybe_adjust_types_for_deduction): New function. - (check_cv_quals_for_unify): Likewise. - (determine_specialization): Adjust. - (fn_type_unification): Likewise. - (type_unification): Likewise. - (type_unification_real): Likewise. Use - maybe_adjust_types_for_deduction. Fix mishandling of - back-unification of template functions passed as arguments. Pass - appropriate combination of UNIFY_ALLOW_* to unify. - (unify): Remove unused NTPARMS parameter. Use - check_cv_quals_for_unify. Remove bogus code that allowed - too-generous unification in order to adhere more closely to standard. - (get_bindings_real): Adjust. - (get_class_bindings): Likewise. - - * method.c (build_overload_identifier): Only use the innermost - template arguments when mangling. - * pt.c (tsubst_template_argument_vector): New function. - (complete_template_args): Deal with the situation where the - extra_args contain more than one level of arguments. - (lookup_template_class): Deal with member template classes, which - may have more than one level of arguments. - (tsubst): Don't tsbust into the TREE_TYPE of an IDENTIFIER_NODE. - Improve handling of member template classes. Use - DECL_PRIMARY_TEMPLATE instead of inline expansion. Use - tsubst_template_argument_vector where appropriate. - (regenerate_decl_from_template): Break out from ... - (instantiate_decl): Here. - - * lex.c (yyprint): Remove TYPENAME_ELLIPSIS. - * parse.h: Regenerated. - * parse.c: Really regenerated. - - * cp-tree.h (finish_unary_op_expr): New function. - (finish_id_expr): Likewise. - (begin_new_placement): Likewise. - (finish_new_placement): Likewise. - (finish_declarator): Likewise. - (finish_translation_unit): Likewise. - (finish_parmlist): Likewise. - (begin_class_definition): Likewise. - (finish_class_definition): Likewise. - (finish_default_args): Likewise. - (finish_inline_definitions): Likewise. - * parse.y (GCC_ASM_KEYWORD): Remove. - (TYPENAME_ELLIPSIS): Likewise. - * parse.c: Regenerated. - Use new functions in semantics.c in the actions for many rules. - * gxx.gperf (GCC_ASM_KEYWORD): Just use ASM_KEYWORD. - * hash.h: Regenerated. - * semantics.c (finish_expr_stmt): Allow NULL expr. - (finish_unary_op_expr): New function, containing - code previously in parse.y. - (finish_id_expr): Likewise. - (begin_new_placement): Likewise. - (finish_new_placement): Likewise. - (finish_declarator): Likewise. - (finish_translation_unit): Likewise. - (finish_parmlist): Likewise. - (begin_class_definition): Likewise. - (finish_class_definition): Likewise. - (finish_default_args): Likewise. - (finish_inline_definitions): Likewise. - -Sun May 10 23:43:13 1998 Mark Mitchell - - * typeck.c (build_c_cast): Don't decay arrays and functions to - pointer type when converting to a class type. - -Sun May 10 22:53:56 1998 Jason Merrill - - * cp-tree.h (DECL_NAMESPACE_SCOPE_P): New macro. - (DECL_CLASS_SCOPE_P): Likewise. - -Sun May 10 22:48:22 1998 H.J. Lu (hjl@gnu.org) - - * class.c (finish_struct_1): Use OVL_CURRENT on TREE_VEC_ELT. - * decl2.c (constructor_name_full): Likewise. - -Sun May 10 22:48:12 1998 Mike Stump - - * tree.c (mapcar): Add OVERLOAD support. - - * init.c (resolve_offset_ref): We must use basetype_path before we - destroy it with a call to convert_pointer_to. - -Sat May 9 14:44:37 1998 Jason Merrill - - * class.c (currently_open_class): New fn. - * decl.c (lookup_name_real): Use it. - * search.c (lookup_field): Likewise. - -Fri May 8 23:32:42 1998 Martin von Loewis - - * cp-tree.def (OVERLOAD): New node. - * cp-tree.h (BINDING_TYPE, SET_IDENTIFIER_GLOBAL_VALUE, - SET_IDENTIFIER_NAMESPACE_VALUE): Define. - (NAMESPACE_BINDING): Remove. - (IDENTIFIER_GLOBAL_VALUE, IDENTIFIER_NAMESPACE_VALUE): Use - namespace_binding. - (OVL_FUNCTION, OVL_CHAIN, OVL_CURRENT, OVL_NEXT, OVL_USED): - Define. - (tree_overload): New struct. - (IDENTIFIER_TYPE_VALUE): Use identifier_type_value. - (REAL_IDENTIFIER_TYPE_VALUE): Define. - (IDENTIFIER_HAS_TYPE_VALUE): Use IDENTIFIER_TYPE_VALUE. - (lang_decl_flags): Remove in_namespace. - (lang_decl): Remove chain. - (DECL_CHAIN, DECL_NAMESPACE): Remove. - (flag_honor_std): Declare extern. - (identifier_type_value, pushdecl_namespace_level, push_using_decl, - namespace_binding, set_namespace_binding, - lookup_function_nonclass, cat_namespace_levels, - set_decl_namespace, lookup_arg_dependent, binding_init, ovl_cons, - scratch_ovl_cons, ovl_member, build_overload): Declare. - (decl_list_length, get_namespace_id, current_namespace_id, - overloaded_globals_p): Remove. - (lookup_using_namespace, qualified_lookup_using_namespace): Change - return type. - (push_scratch_obstack): New macro. - * call.c (add_function_candidate): Special-case type of OVERLOAD node. - (build_user_conversions_1): Iterate using OVL_NEXT for ctors, - convs, fns. - (build_new_function_call): Iterate using OVL_CHAIN. - Print DECL_NAME in when reporting ambiguities. - (build_object_call): Iterate using OVL_NEXT for fns, convs. - (build_new_op): Call lookup_function_nonclass. - Iterate using OVL_NEXT. - (build_op_delete_call): Change detection of members. - Do not wrap TREE_LIST around fields and single global functions. - (build_over_call): Don't push a class level if the context is a - namespace. - (build_new_method_call): Iterate using OVL_NEXT. - * class.c (add_method): Chain overloaded members using - build_overload. Remove copying of method. - (grow_method): When iterating through the obstack, expect OVERLOAD - nodes. Chain overload members. - (finish_struct_methods): Chain overload members. Unpack OVERLOAD - nodes in call to get_baselinks. - (duplicate_tag_error): Expect OVERLOAD nodes when unchaining. - (finish_struct_1): Iterate over ctor using OVL_NEXT. Handle - fdecls that are OVERLOAD nodes. - (validate_lhs): New function. - (instantiate_type): Do not copy OVERLOAD nodes. Remove dead - code. Use DECL_NAME in error messages. Split code between global - and member function processing. - * decl.c (global_type_node): New static variable. - (in_std): New global. - (struct binding_level): New field usings. - (resume_binding_level): Assert that we are not in a class. - (toplevel_bindings_p): Just check for namespace_p or - pseudo_global. - (resume_level): Remove. - (find_binding): New function. - (binding_for_name): Call it. - (namespace_binding, set_namespace_binding): New functions. - (push_namespace): Associate binding level with new namespace, - resume_binding_level for existing namespace. Remove old code. - Fake std by counting. - (store_bindings): Use REAL_IDENTIFIER_TYPE_VALUE. - (maybe_push_to_top_level): Save current namespace. - (pop_from_top_level): Restore saved namespace. - (pop_namespace): Call suspend_binding_level. Remove old code. - (cat_namespace_levels): New function. - (set_identifier_type_value_with_scope): For namespace bindings, - set BINDING_TYPE, and use global_type_node. - Use REAL_IDENTIFIER_TYPE_VALUE otherwise. - (identifier_type_value): New function. - (pushtag): If no context, use current_namespace. - (duplicate_decls): Don't process DECL_CHAIN. - (pushdecl): Set DECL_CONTEXT to current_namespace, if it is not - already set. Never reset it to NULL_TREE. Lookup global variables - in their namespace. Push overloaded templates if they are on - namespace level. - (pushdecl_namespace_level): New function. - (pushdecl_top_level): Implement using pushdecl_namespace_level. - (pushdecl_using_decl): New function. - (overloaded_globals_p): Remove. - (push_overloaded_decl): Create OVERLOAD nodes, and iterate through - them. Use namespace_binding and set_namespace_value. - (redeclaration_error_message): Complain if the declarations come - from different namespaces. - (lookup_tag): On namespace level, look in the BINDING_TYPE. - (lookup_namespace_name): Pass tree_bindings from stack. Remove - old code. - (select_decl): New function. - (lookup_name_real): Call it for qualified and unqualified lookup. - Pass tree_bindings from the stack. - If prefer_type is 1, also accept namespaces. - (lookup_function_nonclass): New function. - (init_decl_processing): Set the binding level of the global - namespace to global_binding_level. - Build a proper type list for __builtin_apply. - Initialize std_node to "fake std" if flag_honor_std is set. - Initialize global_type_node. - Allocated bad_alloc in namespace std if flag_honor_std. - (define_function): Set the DECL_CONTEXT to the current_namespace. - (start_decl): A namespace is not considered as a context here. If - the DECL_CONTEXT is a namespace, push the decl. - (cp_finish_decl): Check for namespaces used as initializers. - (grokfndecl): Add namespace parameter. Remove processing of - DECL_CHAIN. - (grokvardecl): Add namespace parameter. - (grokdeclarator): Process SCOPEs that are namespaces. For - mangling, temporarily set the DECL_CONTEXT on anonymous structs. - (start_function): Check for contexts that are namespaces. - Set context for declarations that have not been pushed. - (store_parm_decls): Check for ::main only. - (finish_function): Likewise. - (start_method): Check for contexts that are namespaces. - (start_method): Remove DECL_CHAIN processing. - * decl2.c (flag_honor_std): Declare. - (lang_decode_option): Set it if -fhonor-std or -fnew-abi is given. - (decl_namespace_list): New static global. - (grok_x_components): Ignore namespaces as type contexts. - (check_classfn): Expect OVERLOAD nodes. - (grokfield): Remove DECL_CHAIN processing. - (finish_file): Call cat_namespace_levels. - (merge_functions): New function. - (ambiguous_decl): Rewrite. - (lookup_using_namespace): Produce tree_bindings. - (qualified_lookup_using_namespace): Likewise. - (set_decl_namespace, decl_namespace, current_decl_namespace, - push_decl_namespace, pop_decl_namespace): New functions. - (arg_lookup): New struct. - (add_function, arg_assoc_namespace, arg_assoc_class, - arg_assoc_type, arg_assoc_args, arg_assoc, lookup_arg_dependent): - New functions. - (get_namespace_id, current_namespace_id): Remove. - (do_toplevel_using_decl): Rewrite. - (do_class_using_decl): Complain about namespace qualifiers. - (do_using_directive): Sorry if not on namespace level. Complain - about unknown namespaces. - * error.c (dump_aggr_type): Check for namespace contexts. - * except.c (init_exception_processing): Push terminate into std. - * friend.c (is_friend): A namespace is not a context, here. - * init.c (expand_member_init): Remove DECL_CHAIN processing. - (build_offset_ref): Process OVERLOAD nodes. - * lang-specs.h (__HONOR_STD): Define if -fnew-abi or -fhonor-std. - * lex.c (identifier_type): Loop using OVL_CHAIN. - (see_typename): Set looking_for_typename to 2. - (real_yylex): Likewise. - (do_identifier): Expect OVERLOAD nodes instead of TREE_LISTs. - (do_scoped_id): Expect OVERLOAD nodes. - Change calling convention for qualified_lookup_using_namespace. - (build_lang_decl): Don't set in_namespace anymore. - * method.c (typevec_size): New global. - (build_overload_nested_name): Return if global_namespace. - Otherwise, always expect a declaration context. - (build_qualified_name): Likewise. - Make sure we don't write beyond typevec_size. - (build_decl_overload_real): Likewise. - Allocate one extra slot for the namespace. - (hack_identifier): Mark code dead. - Process OVERLOAD and NAMESPACE_DECL nodes. - * parse.y (program): Pop namespaces until in global namespace. - (extdef): In a using-declaration, don't discard the identifier if - there is no declaration. - (left_curly): Ignore type contexts which are namespaces. - (typename_sub2): Use IDENTIFIER_TYPE_VALUE to retrieve the type - used as scope. - * pt.c (template_class_depth): Expect types to be namespaces. - (determine_specialization): Simplify by expecting OVERLOAD nodes. - (push_template_decl): Push into namespace level. - Reset ctx if it is a namespace. - Set DECL_CONTEXT to current_namespace if not set already. - Ignore real contexts that are namespaces. - (mangle_class_name_for_template): Skip global_namespace. - Mangle other namespaces as declarations. - (lookup_template_function): Set type of OVERLOAD nodes to unknown. - (lookup_template_class): Push into namespace of context. - If the context is a namespace, set it to global_namespace. - Use id_context for mangling. - (for_each_template_parm): Handle OVERLOAD and NAMESPACE_DECL nodes. - (tsubst_friend_function): Ignore namespace contexts. - Push into namespace level. - (tsubst): Handle NAMESPACE_DECL nodes. - Remove DECL_CHAIN processing. - (type_unification_real): Recognize OVERLOAD instead of TREE_LIST nodes. - * ptree.c (print_lang_identifier): Print bindings. - (lang_print_xnode): Print OVERLOAD nodes. - * rtti.c (init_rtti_processing): Push type_info into std. - * search.c (lookup_fnfields_here): Expect OVERLOAD nodes. - (lookup_fnfields_1, get_virtuals_named_this, get_matching_virtual, - dfs_debug_mark, dfs_pushdecls, dfs_compress_decls, add_conversions, - lookup_fnfields_here): Likewise. - Process all nodes, instead of going through TREE_CHAIN. - * sig.c (build_signature_pointer_or_reference_type): Set context - to global_namespace. - (build_signature_table_constructor): Expect OVERLOAD nodes. - * spew.c (yylex): Save old setting of looking_for_typename. - * tree.c (decl_list_length): Remove. - (binding_init): New function. - (count_functions): Rewrite. - (is_overloaded_fn): Expect OVERLOAD nodes. - (really_overloaded_fn, get_first_fn, lvalue_type): Likewise. - (ovl_cons, scratch_ovl_cons, build_overload, build_overload_after, - ovl_member): New functions. - * typeck.c (require_complete_type): Expect OVERLOAD nodes. - (type_unknown_p): Likewise. - (require_instantiated_type): Likewise. - (build_component_ref): Declare code dead. - (build_x_function_call): Create and expect OVERLOAD nodes. - (build_function_call_real): Check for ::main only. - (build_unary_op): Likewise. Expect OVERLOAD nodes. - (convert_for_assignment): Check for TREE_LIST before accessing - TREE_VALUE. - * decl.c (duplicate_decls): Check for namespace bindings instead - of global bindings. - (pushdecl, push_overloaded_decl, lookup_tag, lookup_name_real, - lookup_name_current_level, start_decl, xref_tag, - finish_enum): Likewise. - * init.c (build_offset_ref): Likewise. - * search.c (lookup_field): Likewise. - (lookup_fnfields): Likewise. - (dfs_debug_mark): Likewise. - * decl.c (poplevel): Use SET_IDENTIFIER_TYPE_VALUE. - (poplevel_class, pop_from_top_level): Likewise. - * decl2.c (finish_method): Likewise. - * class.c (build_vtable): Use SET_IDENTIFIER_GLOBAL_VALUE. - * decl.c (record_builtin_type): Likewise. - (init_decl_processing, grokfndecl): Likewise. - * lex.c (get_time_identifier, do_identifier, do_scoped_id): Likewise. - (make_lang_type): Likewise. - * parse.y (make_thunk): Likewise. - * pt.c (tsubst): Likewise. - * tree.c (debug_binfo): Likewise. - * exception.cc, new.cc, new1.cc, new2.cc, tinfo.cc, tinfo.h, - tinfo2.cc, inc/new.h: Add std qualifications. - * inc/new: Wrap with namespace std if __HONOR_STD. - * inc/typeinfo: Likewise. - -Fri May 8 00:43:50 1998 Jason Merrill - - * call.c (build_user_type_conversion_1): Handle second_conv - properly for templates. - -Thu May 7 17:09:25 1998 Andrew MacLeod - - * method.c (build_decl_overload_real): Set TREE_USED flag to - zero for build_type_variants nodes as well. - -Wed May 6 19:27:09 1998 Jason Merrill - - * pt.c (tsubst): Don't tsubst the type of an IDENTIFIER_NODE. - -Wed May 6 16:49:48 1998 Jim Wilson - - * Makefile.in (call.o, class.o, decl.o, decl2.o, errfn.o, error.o, - except.o, expr.o, friend.o, init.o, lex.o, method.o, pt.o, repo.o, - rtti.o, search.o, semantics.o, sig.o, tree.o, typeck.o, typeck2.o, - xref.o): Add toplev.h dependencies. - -Wed May 6 16:44:58 1998 Jeffrey A Law (law@cygnus.com) - - * errfn.c (cp_error, cp_warning): Remove declarations for - error and warning respectively. - -Wed May 6 14:28:18 1998 Kaveh R. Ghazi - - * error.c: Convert to using ctype macros defined in system.h. - * method.c: Likewise. - * xref.c: Likewise. - * lex.c: Likewise. Also remove redundant system header stuff. - -Wed May 6 06:36:41 1998 Robert Lipe - - * call.c, class.c, decl.c, decl2.c, errfn.c, error.c, except.c, - expr.c, friend.c, init.c, lex.c, method.c, pt.c, repo.c, rtti.c, - search.c, semantics.c, sig.c, tree.c, typeck.c, typeck2.c, - xref.c: Add include of toplev.h. - -Wed May 6 02:33:39 1998 Jason Merrill - - * tree.c (perm_manip): Also regenerate the RTL of an extern. - (copy_to_permanent): Use end_temporary_allocation. - -Tue May 5 23:54:04 1998 Jason Merrill - - * init.c (expand_vec_init): The initialization of each array - element is a full-expression. - -Tue May 5 18:24:13 1998 Andrew MacLeod - - * method.c (build_mangled_name): Add a call to build_type_variant - to get the right type. - -Tue May 5 01:25:03 1998 Jason Merrill - - * Makefile.in: Add .SUFFIXES. - - * cp-tree.def: Remove NAMESPACE_DECL. - -Sun May 3 01:32:14 1998 Jason Merrill - - * call.c (build_over_call): Do evaluate arg even if it has empty - class type. - * decl.c (start_function): Don't push a member function. - -Thu Apr 30 18:59:23 1998 Jim Wilson - - * Makefile.in (g++FAQ.info): Put -o option before input file. - -Thu Apr 30 13:05:33 1998 Andrew MacLeod - - * gxxint.texi: Add info for squangling codes K and B. - -Tue Apr 28 13:22:01 1998 Mark Mitchell - - * semantics.c (begin_stmt_expr): Avoid duplicating the effect of - the expression in templates. - (finish_stmt_expr): Likewise. - -1998-04-28 Brendan Kehoe - - * decl2.c (ambiguous_decl): Fix NAME parm to be a tree, not int. - -Mon Apr 27 13:58:10 1998 Mark Mitchell - - * decl.c (maybe_push_to_top_level): Always clear - current_template_parms and processing_template_decl. - (pushtag): Remove check of current_class_type and some comments, - since maybe_push_to_top_level no longer creates confusion. - -Sun Apr 26 12:10:18 1998 Mark Mitchell - - * cp-tree.h (CLASSTYPE_IS_TEMPLATE): New macro. - (DECL_CLASS_TEMPLATE_P): Likewise. - (DECL_PRIMARY_TEMPLATE): Likewise. - (PRIMARY_TEMPLATE_P): Use it. - (push_template_decl_real): New function. - (redeclare_class_template): Take new template parameters as - input. - (is_specialization_of): New function. - (comp_template_args): Declare. - * decl.c (pushtag): Handle friend template classes. - (xref_tag): Likewise. Use new calling convention for - redeclare_class_template. - * decl2.c (grok_x_components): Handle friend templates. - * friend.c (is_friend): Use is_specialization_of where - appropriate. Deal with friend class templates. - (make_friend_class): Let a class template be friends with itself. - * pt.c (comp_template_args): Remove declaration. - (tsubst_friend_class): New function. - (push_template_decl_real): New function. - (push_template_decl): Use it. - (redeclare_class_template): Adjust for new calling convention. - (comp_template_args): Give it external linkage. - (instantiate_class_type): Use tsubst_friend_class to deal - with friend templates. - * typeck.c (comptypes): Use comp_template_args, rather than - expanding it inline. - * parse.y (component_decl): Handle a nested template type - like other component type declarations. - - * pt.c (check_explicit_specialization): Handle overloaded - constructors correctly. - - * pt.c (mabybe_get_template_decl_from_type_decl): New function. - (lookup_template_class): Use it. - -Thu Apr 23 21:19:06 1998 Jason Merrill - - * cp-tree.def: Add WRAPPER. USER_CONV now only has two ops. - * cp-tree.h: Add WRAPPER support. - * call.c (add_candidate): Split out from add_*_candidate fns. - (build_over_call): Take the candidate instead of function and args. - Enforce access control here. Emit overload warnings here. - (add_warning): New fn. - (joust): Add WARN parm. If not set, call add_warning instead of - printing a warning. Re-enable some warnings. - (tourney): Pass it. - (convert_like): Adjust. - (build_new_op): Adjust. - (build_new_function_call): Adjust. - (build_user_type_conversion_1): Adjust. - (USER_CONV_FN): Adjust. - * tree.c (build_expr_wrapper, build_expr_ptr_wrapper, - build_int_wrapper): New fns. - -Thu Apr 23 18:27:53 1998 Mark P. Mitchell - - * pt.c (unify): Fix typo in previous change. - -Thu Apr 23 09:32:58 1998 Jason Merrill - - * error.c (dump_type_real): Declare canonical_name. - - * typeck.c (comp_target_types): Fix PMFs. - -Wed Apr 22 13:24:48 1998 Mark Mitchell - - * class.c (finish_struct): Set TREE_PRIVATE and TREE_PROTECTED for - the DECL_RESULTs of a member TEMPLATE_DECL, not just the - TEMPLATE_DECL. - - * pt.c (tsubst): Decrease the template-level of - TEMPLATE_TEMPLATE_PARMS. Likewise for the DECL_INITIAL of a - TEMPLATE_PARM_INDEX. - (template_decl_level): New function. - (unify): Make sure to record unifications for template - parameters, even when the parameters exactly match the arguments. - Combine duplicated code for TEMPLATE_TEMPLATE_PARMs and - TEMPLATE_TYPE_PARMS. Don't try to unify template parameters that - aren't from the level we're currently working on. - -Tue Apr 21 22:00:04 1998 Mark Mitchell - - * errfn.c (cp_thing): Use xrealloc, not xmalloc, to copy memory. - - * decl2.c (check_member_template): Set DECL_IGNORED for member - class templates, too. - - * decl2.c (grokfield): Remangle the name of a member TYPE_DECL. - -Tue Apr 21 18:59:11 1998 Benjamin Kosnik - - * decl.c (duplicate_decls): Only check DECL_FRIEND_P if function. - -Tue Apr 21 14:22:00 1998 Jeffrey A Law (law@cygnus.com) - - * cp-tree.h (intTI_type_node, unsigned_intTI_type_node): Declare. - * decl.c (intTI_type_node, unsigned_intTI_type_node): Define. - (init_decl_processing): Handle TI types. - * typeck.c (unsigned_type, signed_type): Handle TI types. - -Sat Apr 18 15:25:21 1998 Jim Wilson - - * g++spec.c (lang_specific_driver): New argument in_added_libraries. - New local added_libraries. Increment count when add library to - arglist. - -Fri Apr 17 21:25:00 1998 Mark Mitchell - - * cp-tree.h (type_as_string_real): New function. - * pt.c (mangle_class_name_for_template): Use it. - * error.c (dump_aggr_type): Change prototype. - (dump_type_prefix): Likewise. - (dump_type_suffix): Likewise. - (dump_type_real): Convert from dump_type. If desired, the - "canonica" name of a typedef, i.e., the name of the underlying - type, can be printed. - (dump_type): Call dump_type_real. - -Fri Apr 17 14:30:45 1998 Jason Merrill - - * decl2.c (lang_decode_option): -fnew-abi implies -fvtable-thunks. - - * typeck.c (comp_target_types): Tweak pedantic case. - (comp_target_parms): Tweak pedantic case. Clean up somewhat. - Return -1 or 1 instead of 1 or 2. - (compparms): Remove STRICT handling. - (convert_for_assignment): Fix handling of pmfs. - -Fri Apr 17 14:04:16 1998 Mark Mitchell - - * typeck.c (comp_target_types): Handle references like pointers. - (comp_target_parms): Note that return code from comp_target_types - can be negative to indicate failure. - -Fri Apr 17 09:10:52 1998 Andreas Schwab - - * Make-lang.in (c++.all.build): Don't depend on $(DEMANGLER_PROG), - which requires a working target compiler to build. - -Fri Apr 17 08:57:35 1998 Jeffrey A Law (law@cygnus.com) - - * tree.c (avoid_overlap): Add prototype. - - * spew.c (num_tokens): Add prototype. - (nth_noken, add_token, consume_token, debug_yychar): Likewise. - - * search.c (dfs_check_overlap): Add prototype. - (dfs_no_overlap_yet): Likewise. - - * pt.c (original_template): Add prototype. - (inline_needs_template_parms): Likewise. - (push_inline_template_parms_recursive): Likewise. - (retrieve_specialization, register_specialization): Likewise. - (print_candidates, reduce_template_parm_level): Likewise. - (build_template_decl, mark_template_parm): Likewise. - (tsubst_friend_function, get_bindings_real): Likewise. - - * method.c (start_squangling): Add prototype. - (end_squangling, check_ktype, issue_ktype): Likewise. - (build_overloaded_scope_ref, check_btype): Likewise. - (build_mangled_template_parm_index): Likewise. - - * lex.c (init_cpp_parse): Add prototype. - (handle_cp_pragma, handle_sysv_pragma): Likewise. - (reduce_cmp, token_cmp): Likewise. - - * except.c (call_eh_info): Add prototype. - (push_eh_info, get_eh_info, get_eh_value, get_eh_type): Likewise. - (get_eh_caught, get_eh_handlers, do_pop_exception): Likewise. - - * decl2.c (is_namespace_ancestor): Add prototype. - (namespace_ancestor, add_using_namespace): Likewise. - (ambiguous_decl): Likewise. - - * decl.c (indent): Add prototype. - - * call.c (add_template_candidate_real): Add prototype. - -Fri Apr 17 01:57:12 1998 Jason Merrill - - * decl2.c (build_expr_from_tree): Just return a PMF. - -Fri Apr 17 00:45:12 1998 Mark Mitchell - - * typeck2.c (process_init_constructor): Don't strip cv-qualifiers - when doing initializations. - - * pt.c (unify): Use comptypes to compare type args. - -Fri Apr 17 00:24:22 1998 Jason Merrill - - * decl.c (duplicate_decls): Fix check for when it's safe to free - the new decl. - - * pt.c (mangle_class_name_for_template): Don't pass a typedef type - to type_as_string. - -Thu Apr 16 17:47:30 1998 Jeffrey A Law (law@cygnus.com) - - * pt.c (build_template_parm_index): Add prototype. - - * search.c (my_tree_cons): Don't clear words outside the - newly allocated node. - -Wed Apr 15 15:34:44 1998 Dave Brolley - - * lex.c (init_parse): Now returns char* containing the filename. - -Wed Apr 15 13:20:06 1998 John Carr - Jeff Law - - * errfn.c: Rework to avoid problems when HOST_WIDE_INT is longer - than a pointer. - -Sun Apr 12 22:31:19 1998 Richard Kenner - - * cvt.c (cp_convert_to_pointer): Use TYPE_PRECISION. - -Fri Apr 10 12:16:49 1998 Benjamin Kosnik - - * decl.c (duplicate_decls): Don't warn for redundant decls if - friend: let add_friend take care of it. - -Thu Apr 9 02:40:48 1998 Jason Merrill - - * sig.c (build_signature_pointer_constructor): Don't set - TREE_HAS_CONSTRUCTOR for a signature pointer. - * cvt.c (ocp_convert): Don't force a temporary for internal structs. - * init.c (resolve_offset_ref): Warn about implicit & on pmfs - here, too. - * typeck.c (build_unary_op): Only allow taking the address of a - real constructor. - * typeck2.c (digest_init): Simplify. - (store_init_value): Don't pedwarn about using { } for pmfs. - -Thu Apr 9 22:16:57 1998 Per Bothner - - * cp-tree.h (start_decl): Update prototype. - * decl.c (start_decl): Like the C version, new parameters - for the attributes. Call cplus_decl_attributes here, - (pushdecl): Like C version, do build_type_copy if TYPE_DECL, - (grokdeclarator): Pass NULL for new start_decl arguments. - * pt.c (tsubst_expr): Likewise. - * parse.y: Merge cplus_decl_attribute calls into start_decl calls. - * typeck.c (common_type): Check TYPE_MAIN_VARIANT. - * lex.c (build_lang_decl): Add lang_name_java. - * class.c (push_lang_context): Add lang_name_java. - * method.c (build_mangled_name): Check for is_java_type. - -Thu Apr 9 22:16:57 1998 Benjamin Kosnik - - * decl.c (grokdeclarator): Check TYPE_MAIN_VARIANT. - * call.c (build_scoped_method_call): Check for TREE_CODE for - VOID_TYPE instead of type == void_type_node. - (build_method_call): Likewise. - * decl.c (lookup_name_real): Likewise. - (grokdeclarator): Likewise. - (start_decl): Likewise. - (grokparms): Likewise. - (start_function): Likewise. - (finish_function): Likewise. - (start_method): Likewise. - -Thu Apr 9 00:18:44 1998 Dave Brolley (brolley@cygnus.com) - - * lex.c (finput): New variable. - (init_cpp_parse): Renamed from init_parse. - (init_parse): Handle !USE_CPPLIB. Call init_cpp_parse when finished. - (finish_parse): New function. - * cp-tree.h (init_lex, init_parse): Remove declarations. - -Mon Apr 6 02:25:05 1998 Jason Merrill - - * call.c (build_call): Still evaluate the actual argument. - * class.c (is_empty_class): Update for -fnew-abi. - - * decl2.c: -fnew-abi implies -fsquangle. - - * method.c (do_build_assign_ref): Don't do anything to copy - an empty class. - (do_build_copy_constructor): Likewise. - * call.c (build_over_call): Likewise. - -Sat Apr 4 18:43:58 1998 Jason Merrill - - * tree.c (avoid_overlap): Return a value. - -Sat Apr 4 12:52:35 1998 Jeffrey A Law (law@cygnus.com) - - * method.c (check_btype): Add missing argument to xrealloc. - (check_ktype): Likewise. - -Fri Apr 3 02:22:59 1998 Jason Merrill - - Implement empty base optimization. - * class.c (finish_struct_1): Add vbase fields earlier. Set - CLASSTYPE_SIZE of an empty base to 0. Types with bases can be empty. - * search.c (dfs_check_overlap, dfs_no_overlap_yet): New fns. - (types_overlap_p): New fn. - * tree.c (avoid_overlap): New fn. - (build_base_fields): Use it to avoid overlapping empty bases. - * cp-tree.h, decl2.c, lang-options.h: Add -fnew-abi. - - * decl.c (cplus_expand_expr_stmt): Strip unused INDIRECT_REFs. - - Re-implement allocation of base class subobjects. - * tree.c (unshare_base_binfos): New fn. - (layout_basetypes): Use it. Now handles offsets of both virtual and - non-virtual bases, after layout_type. - (layout_vbasetypes): Remove. - (build_base_fields): Generate FIELD_DECLs for each non-virtual base. - (build_vbase_pointer_fields): Split out from old layout_basetypes. - * class.c (finish_base_struct): Lose offset handling code. - Move nonvdtor warning here. Don't mess with t_binfo anymore. - (finish_struct_1): Don't mess with t_binfo anymore. Use fns above. - * cp-tree.h: Adjust. - -Thu Apr 2 14:25:13 1998 Jason Merrill - - * cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff. - * decl.c, decl2.c, pt.c, ptree.c, lex.c: Likewise. - * class.c (duplicate_tag_error): Likewise. - (finish_struct_1): Set CLASSTYPE_SIZE, CLASSTYPE_MODE, CLASSTYPE_ALIGN. - * tree.c (layout_vbasetypes): Update from layout_record, remove - var_size support, use CLASSTYPE_SIZE instead of CLASSTYPE_VBASE_SIZE. - (layout_basetypes): Likewise. - -Wed Apr 1 18:22:25 1998 Jeffrey A Law (law@cygnus.com) - - * class.c, Make sure system.h is included just after config.h. - Delete lingering stdio and errno references too. - * decl.c, errfn.c, parse.y, ptree.c search.c, xref.c: Likewise. - -Wed Apr 1 15:38:36 1998 Jason Merrill - - * friend.c (is_friend): Fix access control for local classes. - - * class.c (is_empty_class): New fn. - * call.c (build_call): Don't pass empty class objects to a function. - -Wed Apr 1 14:58:35 1998 Mark Mitchell - - * call.c (build_over_call): Do name resolution for default - arguments of function templates in the scope of the templates. - -Tue Mar 31 13:43:57 1998 Jeffrey A Law (law@cygnus.com) - - * call.c: Include system.h. Remove includes, declarations and - defines provided by system.h. - * class.c, cvt.c, decl.c, decl2.c, errfn.c error.c: Likewise. - * except.c, expr.c friend.c, g++spec.c, init.c, input.c: Likewise. - * lex.c, parse.y, pt.c, ptree.c repo.c rtti.c, search.c: Likewise. - * semantics.c, sig.c, spew.c, tree.c, typeck.c: Likewise. - * typeck2.c, xref.c: Likewise. - * Makefile.in: Dependencies updated as appropriate. - * Make-lang.in: Likewise. - -Mon Mar 30 12:15:00 1998 Mark Mitchell - - * pt.c (fn_type_unification): Allow incomplete unification without - an immediate error message. - -Mon Mar 30 08:55:42 1998 Jason Merrill - - * tree.c (member_p): New fn. - * decl2.c (finish_file): Only set DECL_STATIC_FUNCTION_P for - initializing class members. - - * cp-tree.def (TEMPLATE_PARM_INDEX): Class 'x'. - * ptree.c (lang_print_xnode): Handle TEMPLATE_PARM_INDEX. - - * call.c (build_method_call): Handle non-scoped destructors, too. - * pt.c (tsubst_copy): Likewise. - - * pt.c (print_template_context): Split out... - (push_tinst_level): ...from here. - - * friend.c (is_friend): Don't pass a type to decl_function_context. - - * typeck.c (convert_for_initialization): Always hand off - conversions to class type. - -Sun Mar 29 20:01:59 1998 Jason Merrill - - * friend.c (is_friend): Local classes have the same access as the - enclosing function. - -Sun Mar 29 00:47:32 1998 Jeffrey A Law (law@cygnus.com) - - * typeck.c (expand_target_expr): Delete dead function. - - * search.c: Put various prototypes inside #ifdef MI_MATRIX. - - * repo.c (save_string): Delete dead function. - - * method.c (thunk_printable_name): Delete dead function. - - * lex.c (yynextch): Delete dead function. - - * expr.c (tree_extract_aggr_init): #if 0 out. - - * except.c (do_unwind): Delete dead function. - (easy_expand_asm): Likewise. - - * cvt.c (build_conversion_type_1): Delete dead function. - - * cp-tree.h (push_expression_obstack): Declare. - - * call.c (source_type): #if 0 out. - - * class.c (alter_access): Remove unused label. Add braces - around empty else clause. - - * lex.c (yyprint): Fix argument to printf. - -Sat Mar 28 17:43:52 1998 Mark Mitchell - - * pt.c (tsubst): Clear TREE_USED for new FUNCTION_DECLs. - - * pt.c (instantiate_class_template): Make sure template - arguments are permanent. - * init.c (resolve_offset_ref): Don't go looking around in - template types. - - * semantics.c: Add routines to handle expressions, and some - declaration processing. - * parse.y: Use them. - (current_class_depth): Move declaration to cp-tree.h. - * parse.c: Regenerated. - * cp-tree.h: Use them. - (current_class_depth): Declare. - * pt.c (tsubst_copy): Use begin_stmt_expr and finish_stmt_expr. - -Fri Mar 27 20:23:18 1998 Mark Mitchell - - * error.c (dump_decl): Be a bit more explicit with template - type arguments, when verbose. - -Fri Mar 27 18:16:40 1998 Jason Merrill - - * inc/exception: Reorder closing braces. - -Fri Mar 27 13:22:18 1998 Mark Mitchell - - * pt.c (redeclare_class_template): New function. - * cp_tree.h (redeclare_class_template): Declare it. - * decl.c (xref_tag): Use it. - -Thu Mar 26 11:16:30 1998 Jason Merrill - - * call.c (build_over_call): Check IS_AGGR_TYPE, not - TYPE_LANG_SPECIFIC. - * typeck.c (convert_arguments): Likewise. - - * decl.c (grokdeclarator): Remove const and volatile from type after - setting constp and volatilep. - - * class.c (finish_struct_1): Don't warn about bool bitfield larger - than one bit. - -Thu Mar 26 10:25:52 1998 Mark Mitchell - - * pt.c (convert_nontype_argument): STRIP_NOPS where appropriate. - -Thu Mar 26 10:24:05 1998 Mark Mitchell - - * call.c (build_object_call): Complain about ambiguous operator(), - rather that crashing. - (build_new_op): Likewise. - (build_op_delete_call): Likewise. - -Thu Mar 26 10:23:24 1998 Mark Mitchell - - * cvt.c (perform_qualification_conversions): Use comp_target_types - instead of comp_ptr_ttypes. - -Wed Mar 25 16:10:50 1998 Mark Mitchell - - * cp-tree.h (enforce_access): Declare. - * call.c (enforce_access): Make it extern, not static. - * class.c (alter_access): Use enforce_access; modify code for ISO - compliance, rather than ARM rules. - -Wed Mar 25 12:10:45 1998 Kriang Lerdsuwanakij - - * cp-tree.h: Fix typo. - -Wed Mar 25 02:01:02 1998 Jason Merrill - - * expr.c (cplus_expand_expr): Only do PCC_STATIC_STRUCT_RETURN thing - if (aggregate_value_p (type)). - - * decl2.c (constructor_name_full): Handle TYPENAME_TYPE. - -Tue Mar 24 16:12:01 1998 Mark Mitchell - - * tree.c (mapcar): When dealing with a DECL, use it's constant - value, if any. - * pt.c (lookup_template_class): Don't mangle the names of template - classes whose arguments are unknown. - - * pt.c (tsubst_expr): Handle GOTO_STMT correctly. - -Tue Mar 24 12:21:55 1998 Benjamin Kosnik - - * decl.c (init_decl_processing): Set TYPE_PRECISON for bools to 1. - -Tue Mar 24 12:21:48 1998 Jim Wilson - - * decl.c (init_decl_processing): Initialize TYPE_MAX_VALUE for - boolean_type_node to 1. - -Tue Mar 24 10:23:47 1998 Mark Mitchell - - * error.c (dump_expr): Remove unused variable `l'. - - * pt.c (for_each_template_parm): New function, created by - converting uses_template_parms. - (tree_fn_t): New typedef. - (uses_template_parms): Use it. - (mark_template_parm): New function. - (push_template_decl): Check that the argument list of a partial - specialization uses all the template parameters. - - * Make-lang.in (c++filt): Don't delete cxxmain.c after we're done - with it; we might want it for debugging. - * cp-tree.h (type_unification): Change interface. - * class.c (finish_struct_1): Skip nested template types, just like - ordinary nested types. - (instantiate_type): Use new interface to type_unification. - * lex.c (init_lex): Add __sz as opname for sizeof. - * method.c (build_overload_scope_ref): New function. - (build_overload_int): Handle complex expressions. Set - numeric_output_need_bar if necessary. - (build_overload_value): Handle non-PARM_DECL nodes; this - routine is now used by build_overload_int. Remove some - assignments to numeric_output_need_bar. Use - build_overload_scope_ref. - (build_qualified_name): Note that some template mangled names end - with digits, and set numeric_output_need_bar appropriately. Use - build_underscore_int. - * pt.c (unify): Change interface. - (type_unification_real): Likewise. - (determine_specialization): Use new interfaces. - (tsubst): Deal gracefully with situations in which the argument - vector is not fully filled. - (fn_type_unification): Use new interfaces. - (type_unification): Likewise. Remove NOP_EXPR hack. - (type_unification_real): Likewise. - (unify): Likewise. Deal with unification of complex expressions. - -Mon Mar 23 12:24:37 1998 Jason Merrill - - * pt.c (complete_template_args): Initialize skip properly. - - * decl.c (make_typename_type): Revert. - (make_implicit_typename): Remove. - (lookup_name_real): Don't call it. Call lookup_field if we see a - TYPE_DECL from a template base. - * search.c (lookup_field): Do implicit typename stuff. - -Sun Mar 22 00:50:42 1998 Nick Clifton - Geoff Noer - - * Makefile.in: Various fixes for building cygwin32 native toolchains. - * Make-lang.in: Likewise. - -Fri Mar 20 18:07:39 1998 Kriang Lerdsuwanakij - - * pt.c (tsubst, TEMPLATE_TEMPLATE_PARM): Simplify. - -Fri Mar 20 10:42:07 1998 Jason Merrill - - * decl.c (make_implicit_typename): Rewrite removed code. - (make_typename_type): Call it if the type we look up comes from - a base that uses template parms. - - * pt.c (complete_template_args): Rewrite. - (tsubst, FUNCTION_DECL): Use it. - -Fri Mar 20 08:12:43 1998 H.J. Lu (hjl@gnu.org) - - * semantics.c (finish_asm_stmt): Fix combine strings. Call - c_expand_asm_operands () if output_operands, input_operands or - clobbers is not NULL_TREE. - -Fri Mar 20 00:10:19 1998 Kriang Lerdsuwanakij - - * pt.c (complete_template_args): New function. - (get_bindings): Deal with specializations of function templates - with return type containing parameters from outer class - templates. - (tsubst, TEMPLATE_TEMPLATE_PARM): When reducing parameter level, - substitute arguments and compose a new type. - -Thu Mar 19 19:01:48 1998 Mark Mitchell - - * pt.c (tsubst): Clear DECL_PENDING_INLINE_INFO for new - FUNCTION_DECLs. - -Thu Mar 19 11:51:58 1998 Jason Merrill - - * decl.c (make_implicit_typename): Lose useless code. - - * call.c (standard_conversion): Handle A* -> const A* properly. - - * pt.c (get_bindings_real): Rename from get_bindings. Add - check_rettype parm. - (get_bindings): Pass 1. - (get_bindings_overload): Pass 0. - -Wed Mar 19 09:08:12 1998 Mark Mitchell - - * pt.c (check_explicit_specialization): When reverting a static - member function, also remove the `this' parameter from - last_function_parms. - -Thu Mar 19 02:27:48 1998 Jason Merrill - - * pt.c (tsubst_copy, CONST_DECL): Don't bother tsubsting - a function context. - - * decl.c (store_bindings): Use free_binding_vecs. - (pop_from_top_level): Likewise. - -Wed Mar 18 12:41:43 1998 Jason Merrill - - * decl.c (make_implicit_typename): Only change the type of a - TYPENAME_TYPE. - -Wed Mar 18 10:09:51 1998 Mark Mitchell - - * semantics.c: New file, containing routines to perform the - semantic phase of parsing. - * parse.y: Use it. - * pt.c (tsubst_expr): Likewise. - * cp-tree.h: Declare the various functions in semantics.c. - Provide macros to access _STMT tree nodes. - * cp-tree.def: Add ASM_STMT tree node. - * Makefile.in, Make-lang.in: Add dependencies on and for - semantics.c. - -Wed Mar 18 00:24:10 1998 Jason Merrill - - * pt.c (push_template_decl): Only check primary templates. - - * pt.c (check_explicit_specialization): Complain about default args - in explicit specialization. - - * parse.y (nomods_initdcl0): Also call cp_finish_decl for a - constructor_declarator. - -Tue Mar 17 14:44:54 1998 Mark Mitchell - - * typeck2.c (build_x_arrow): Don't crash when an aggregate type - has no overloaded operator ->. - - * call.c (build_field_call): Don't crash when presented with a - field that is actually a nested type. - - * decl.c (pushtag): Deal with friend class injection in local - classes. - - * call.c (build_object_call): Don't crash if OBJ is a - pointer-to-member-function. - -Tue Mar 17 11:40:26 1998 Jason Merrill - - * pt.c (push_template_decl): Complain about template with C linkage, - anonymous template class. - -Mon Mar 16 12:10:39 1998 Jason Merrill - - * class.c (pushclass): Only use the mi_matrix stuff #ifdef MI_MATRIX. - * search.c: Likewise. - - * lex.c (do_pending_defargs): Only call - maybe_{begin,end}_member_template_processing for FUNCTION_DECLs. - - * parse.y (initdcl0_innards): Move maybeasm back into initdcl0 et al. - -Mon Mar 16 10:47:22 1998 Mark Mitchell - - * parse.y: Deal with CONSTRUCTORS in new_initializers. - -Mon Mar 16 10:54:21 1998 Mark Mitchell - - * pt.c (tsubst_copy): Deal with BIND_EXPR in a way that more - closely mimics the behavior in parse.y. - (tsubst_expr): Return the resulting BLOCK when making a tsubst'ing - into a compound statement. - -Sun Mar 15 02:07:26 1998 Jason Merrill - - * cp-tree.h (TEMPLATE_PARMS_FOR_INLINE): New macro. - * pt.c (inline_needs_template_parms): New fn. - (original_template): New fn. - (push_inline_template_parms_recursive): New fn. - (maybe_begin_member_template_processing): Use them. - (maybe_end_member_template_processing): Likewise. - (is_member_or_friend_template): Rename to is_member_template. - Member functions of local classes are never member templates. - -Sun Mar 15 01:14:22 1998 Kriang Lerdsuwanakij - - * lex.c (do_identifier): Handle TEMPLATE_DECL that was - added in the class scope to catch redefinition error. - - * pt.c (reduce_template_parm_level): Also copy - the DECL_TEMPLATE_PARMS field. - -Sun Mar 15 10:54:08 1998 Mark Mitchell - - * pt.c (tsubst): Clear TYPE_REFERENCE_TO when creating a - reduced-level template type parameter. - -Sun Mar 15 12:26:02 1998 Manfred Hollstein - - * cp-tree.h (struct lang_decl_flags): Add needs_final_overrider. - (DECL_NEEDS_FINAL_OVERRIDER_P): New macro. - * class.c (override_one_vtable): Set DECL_NEEDS_FINAL_OVERRIDER_P. - * decl.c (duplicate_decls): Propagate it. - * typeck2.c (abstract_virtuals_error): Use two loops to emit - abstract virtual functions and virtual functions which need a - final overrider separately. - -Thu Mar 12 09:39:40 1998 Manfred Hollstein - - * lang-specs.h: Properly put brackets around array elements in - initializer. - - * typeck.c (build_binary_op_nodefault): Correctly place parens around - && and || in expression. - -Thu Mar 12 09:26:04 1998 Manfred Hollstein - - * call.c (default_parm_conversions): Remove prototype definition. - (build_method_call): Remove unused variable result. - - * cvt.c (ocp_convert): Remove unused variable conversion. - - * decl2.c (ambiguous_decl): Add explicit parameter definition for name. - - * except.c (do_unwind): #if 0 definition of unused variables fcall - and next_pc. - - * expr.c (extract_scalar_init): #if 0 prototype and function - definition. - - * init.c (expand_aggr_init_1): Remove unused variable init_type. - (build_new_1): Remove unused variable t. - - * pt.c (instantiate_class_template): Remove unused variable newtag; - cast called function return value to void. - (do_decl_instantiation): Remove unused variables name and fn. - - * tree.c (get_type_decl): Add default return to shut up compiler from - complaining control reaches end of non-void function. - - * typeck.c (build_x_conditional_expr): Remove unused variable rval. - -Thu Mar 12 09:12:15 1998 Manfred Hollstein - - * call.c (default_parm_conversions): Remove prototype definition. - (build_method_call): Remove unused variable result. - (build_over_call): Add default case in enumeration switch. - -Thu Mar 12 08:39:13 1998 Manfred Hollstein - - * decl2.c (lang_decode_option): Change j's type to size_t. - - * tree.c (layout_vbasetypes): record_align and desired_align are of - type unsigned int; const_size and nonvirtual_const_size likewise. - -Wed Mar 11 07:25:20 1998 Mark Mitchell - - * parse.y (new_initializer): Make sure all initializers are - lists. - -Tue Mar 10 07:32:36 1998 Mark Mitchell - - * decl2.c (import_export_decl): Mark tinfo functions for - cv-qualified versions of class types as DECL_NOT_REALLY_EXTERN. - -Fri Mar 6 23:27:35 1998 Jeffrey A Law (law@cygnus.com) - - * method.c: Fix typo. - -Fri Mar 6 10:06:59 1998 Kaveh R. Ghazi - - * method.c: Include "system.h" to get stdlib.h, stdio.h, - ctype.h, string.h, etc. - (issue_nrepeats): Add default case in enumeration switch. - (check_btype): Likewise. - (process_overload_item): Likewise. - - * Makefile.in (method.o): Depend on system.h. - -Wed Mar 4 22:26:53 1998 Andreas Schwab - - * lex.c (do_scoped_id): Fix parenthesizing. - -Wed Mar 4 12:11:53 1998 Michael Tiemann - - * rtti.c (get_tinfo_fn_dynamic): If this function is called an - FLAG_RTTI is unset, initialize type info machinery and continue - with FLAG_RTTI enabled. - (get_typeid): Likewise. - -Wed Mar 4 11:47:55 1998 Jason Merrill - - * typeck.c (unary_complex_lvalue): &D::i has type B::* if i comes - from B. - -Wed Mar 4 11:28:08 1998 Mark Mitchell - - * pt.c (finish_member_template_decl): Deal more gracefully with - invalid declarations. - -Tue Mar 3 01:38:17 1998 Jason Merrill - - * cvt.c, decl.c, decl2.c, init.c, rtti.c, typeck.c, typeck2.c, - cp-tree.h: Clean up more old overloading code, old RTTI code, and - some formatting quirks. - - * call.c, class.c, cp-tree.h, cvt.c, decl.c, init.c, lex.c, - method.c, pt.c, ptree.c, typeck.c: Remove support for - -fno-ansi-overloading and overloading METHOD_CALL_EXPR. - * class.h: Remove. - * Makefile.in: Adjust. - - * pt.c (unify): Don't allow reduced cv-quals when strict. - - * call.c, class.c, pt.c, cp-tree.h: Remove nsubsts parm from - *type_unification* and unify. - -Mon Mar 2 12:11:06 1998 Jason Merrill - - * parse.y (explicit_template_type): Remove TEMPLATE keyword. - (nested_name_specifier): And add it before this use. - (typename_sub0): And this use. Also add use without the keyword. - (typename_sub1): Likewise. - * pt.c (instantiate_class_template): Don't actually instantiate - anything if our type uses template parms. - -Mon Mar 2 11:04:59 1998 Jim Wilson - - * decl.c (start_function): Don't call temporary_allocation for a - nested function. - -Sun Mar 1 21:06:37 1998 Jason Merrill - - * pt.c (instantiate_class_template): Don't mess with friends if - our type uses template parms. - -Sat Feb 28 12:06:44 1998 Jason Merrill - - * parse.y (nested_name_specifier): Use explicit_template_type. - (typename_sub): Allow a template_type, an explicit_template_type, - or an implicit template type at the end. - * lex.c (yyprint): Handle a PTYPENAME being a TEMPLATE_DECL. - * decl.c (make_typename_type): Handle template-id where the name - is a TEMPLATE_DECL. - * call.c (build_scoped_method_call): Handle member template - destructor call. - * pt.c (tsubst_copy, METHOD_CALL_EXPR): Don't assume a member - destructor is represented by the type. - - * cp-tree.h (TYPENAME_TYPE_FULLNAME): New macro. - * parse.y (nested_name_specifier): Add 'template' case. - (explicit_template_type): New rule. - (typename_sub): Use it. - * decl.c (make_typename_type): Handle getting a template-id for NAME. - * pt.c (tsubst): Likewise. - -Fri Feb 27 11:17:50 1998 Jason Merrill - - * pt.c (add_to_template_args): Fix thinko. - (instantiate_class_template): Call it later. - - * pt.c (get_class_bindings): Add outer_args parm. - (most_specialized_class): Likewise. - (instantiate_class_template): Pass it. - (more_specialized_class): Likewise. - (lookup_template_class): Get context from template if none - was specified. - (finish_member_template_decl): Don't do anything with a - partial specialization. - * decl2.c (check_member_template): Use IS_AGGR_TYPE instead of - AGGREGATE_TYPE_P. - * class.c (finish_struct): Member class templates have already been - checked for name clashes. - * decl.c (pushdecl_with_scope): Handle pushing at class level. - -Fri Feb 27 02:25:16 1998 Jason Merrill - - * pt.c (tsubst, TEMPLATE_DECL): Support member class templates. - (tsubst, *_PARM): Support multiple levels of template classes. - (instantiate_class_template): Look up the pattern from the - original template. - (lookup_template_class): Handle getting a template for d1. - (push_template_decl): Correct setting of 'primary'. - (reduce_template_parm_level): Add 'levels' parm. - (finish_member_template_decl): Support member class templates. - (template_class_depth): Handle multiple levels. - * parse.y (component_decl_1, fn.def2): Remove member template case. - (component_decl): Add member template cases. - * decl2.c (check_member_template): We now handle member template - classes. - * decl.c (pushtag): Handle member templates. - * method.c (do_inline_function_hair): Don't touch - IDENTIFIER_GLOBAL_VALUE. - * init.c (build_offset_ref): If name isn't an identifier, just - return it. - * spew.c (yylex): Handle PTYPENAME like TYPENAME. - - * typeck.c (get_delta_difference): Do adjust for conversions to - and from virtual base. - -Wed Feb 25 09:51:29 1998 Jason Merrill - - * typeck.c (get_delta_difference): Give hard error for conversion - from virtual base. - - * cp-tree.h: Tweak formatting. - -Wed Feb 25 00:35:33 1998 Jason Merrill - - * decl.c (push_namespace): Handle redeclaration error. - - * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. - (IDENTIFIER_NAMESPACE_BINDINGS): New macro. - (NAMESPACE_BINDING): New macro. - (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. - * *.c: Use them. - - * pt.c (push_template_decl): Use innermost_args. - - * decl.c (get_unique_name): Tweak from earlier in the name. - -Tue Feb 24 22:15:04 1998 Martin von Loewis - - * cp-tree.def: Add CPLUS_BINDING node. - * cp-tree.h (tree_binding): New struct. - (BINDING_SCOPE, BINDING_VALUE): New macros. - (current_namespace, global_namespace): Declare extern. - (struct lang_decl_flags): New field in_namespace. - (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): New macros. - (DECL_NAMESPACE, SET_DECL_NAMESPACE): New macros. - (TREE_INDIRECT_USING): New macro. - * decl2.c (current_namespace, global_namespace): Declare. The - value is a NAMESPACE_DECL now, not a TREE_LIST. - (is_namespace_ancestor, namespace_ancestor): New static functions. - (add_using_namespace, ambiguous_decl): Likewise. - (lookup_using_namespace): New support function for lookup_name. - (qualified_lookup_using_namespace): New support function for - do_scoped_id and lookup_namespace_name. - (get_namespace_id): Mark as obsolete. - (current_namespace_id): Likewise. - (do_namespace_alias): Implement. - (do_using_directive): Implement as call to add_using_namespace. - * decl.c (binding_for_name): New function. - (push_namespace, pop_namespace): Implement. - (push_decl): Don't install a FUNCTION_DECL in the global branch. - (lookup_namespace_name): Implement using qualified lookup. - (lookup_name_real): For global scoping, lookup in - global_namespace. For namespace scoping, lookup in given - namespace. For unscoped lookup, iterate over namespace, - considering using directives. - (init_decl_processing): Initialize global_namespace. - (grokvardecl): Build assembler name as static name for globals. - (grokdeclarator): Remove old namespace mangling. - (xref_tag): When installing a global binding for the - tag, make sure we have an identifier. - * method.c (build_overload_nested_name): Mangle namespaces. - (build_qualified_name): Likewise. - (build_decl_overload_real): Likewise. - * lex.c (build_lang_decl): Set namespace for new declaration to - current_namespace. - (do_scoped_id): Find global names in global or current - namespace, or using qualified namespace lookup, depending on - context. - * init.c (build_member_call): When scope is namespace, use - build_x_function_call instead. - (build_offset_ref): When scope is namespace, collapse processing - to lookup_namespace_name instead. - * error.c (dump_decl): Support NAMESPACE_DECL. - * decl.c (pushdecl): Bind globals to current namespace. - (push_overloaded_decl): Likewise. - (lookup_tag): Likewise. - (lookup_name_current_level): Likewise. - (xref_tag): Likewise. - (start_function): Likewise. - * lex.c (do_identifier): Likewise. - (identifier_typedecl_value): Likewise. - (real_yylex): Likewise. - * method.c (do_inline_function_hair): Likewise. - * parse.y (unscoped): Likewise. - * pt.c (check_explicit_specialization): Likewise. - (lookup_template_class): Likewise. - * rtti.c (call_void_fn): Likewise. - * sig.c (build_sigtable): Likewise. - * ptree.c (lang_print_xnode): New function. - -Tue Feb 24 01:40:24 1998 Jason Merrill - - * pt.c (instantiate_class_template): Don't instantiate if pedantic - and the args use template parms. - - * pt.c (push_tinst_level): If the instantiation uses template parms, - fail silently. - * decl.c (xref_basetypes): Do call complete_type for basetypes - that involve template parameters. - -Tue Feb 24 00:36:43 1998 Jason Merrill - - * typeck2.c (process_init_constructor): Fix labeled init check. - -Mon Feb 23 05:08:55 1998 Jason Merrill - - * pt.c, call.c, decl.c, method.c, cp-tree.h: Remove unused NARGS - argument to tsubst and friends. - - * pt.c (tsubst, FUNCTION_DECL): Tidy. - - * typeck.c (build_x_function_call): Handle static member function - templates like non-templates. Handle friend templates like normal - function templates. - * pt.c (tsubst, *_PARM): Don't use orig_level. - (get_bindings): Don't call add_to_template_args. - (instantiate_template): Likewise. - (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate. - * ptree.c (print_lang_type): Print index/level for template parms. - -Mon Feb 23 02:52:29 1998 Mark Mitchell - - * Make-lang.in (cc1plus): Note that cc1plus depends on - cp/cp-tree.h and cp/cp-tree.def. - - * cp-tree.def (TEMPLATE_CONST_PARM): Remove. - (TEMPLATE_PARM_INDEX): New tree code, used to indicate a - position in a template parameter list. - * cp-tree.h (template_parm_index): New structure, used as the tree - structure for a TEMPLATE_PARM_INDEX. - (TEMPLATE_PARM_IDX): New macro. - (TEMPLATE_PARM_LEVEL): Likewise. - (TEMPLATE_PARM_DESCENDANTS): Likewise. - (TEMPLATE_PARM_ORIG_LEVEL): Likewise. - (TEMPLATE_PARM_DECL): Likewise. - (TEMPLATE_TYPE_PARM_INDEX): Likewise. - (TEMPLATE_TYPE_ORIG_LEVEL): Likewise. - (TEMPLATE_TYPE_DECL): Likewise. - (TEMPLATE_CONST_IDX): Remove. - (TEMPLATE_CONST_LEVEL): Likewise. - (TEMPLATE_CONST_SET_INFO): Likewise. - (TEMPLATE_TYPE_SET_INFO): Likewise. - (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX - node. - (TEMPLATE_TYPE_LEVEL): Likewise. - * decl.c (decls_match): Call comp_template_parms, rather than - expanding it inline. - (duplicate_decls): If two template declarations are being merged, - then their TEMPLATE_INFOs should be merged as well. - (grokfndecl): Save template-id information when declaring a friend - with explicit template arguments. Pass arguments to - check_explicit_specialization via correct convention; at some - point check_explicit_specialization changed, but these call-sites - did not. - (grokdeclarator): Tidy up slightly. - * decl2.c (check_classfn): Tidy up slightly. Don't assume that - two template functions with the same DECL_ASSEMBLER_NAME the same, - since the names are not yet mangled. - * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of - TEMPLATE_CONST_PARM. - (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the - decl for a non-type parameter, rather than printing `'. - * friend.c (is_friend): Handle TEMPLATE_DECL friends. - (do_friend): Deal with template friends. - * lex.c (do_pending_inlines): Call - maybe_begin_member_template_processing, rather than - conditionally calling begin_member_template_processing. - (process_next_inline): Likewise. Call - maybe_end_member_template_processing, rather than - conditionally calling end_member_template_processing. - (do_pending_defargs): Likewise. - (do_identifier): Use TEMPLATE_PARM_INDEX instead of - TEMPLATE_CONST_PARM. - * method.c (build_mangled_template_parm_index): New function. - (build_overload_value): Use it. - (build_overload_name): Likewise. - * pt.c (finish_member_template_decl): Allow friend declarations. - (template_class_depth): New function. - (is_member_template): Rename, and modify, to become... - (is_member_or_friend_template): New function. - (end_member_template_processing): Rename, and modify, to become... - (maybe_end_member_template_processing). - (build_template_parm_index): New function. - (reduce_template_parm_level): New function. - (process_template_parm): Modify to use build_template_parm_index. - (push_template_decl): Deal with friend templates. - (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of - TEMPLATE_CONST_PARM. - (tsubst_friend_function): New function. - (instantiate_class_template): Generate the DECL_FRIENDLIST - for a new instantiation by using tsubst_friend_function rather - than just tsubst. - (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL. - Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the - appropriate new macros. Use reduce_template_parm_level to - generate lower-level template parameters. Handle tsubst'ing into - TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget - to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created - templates. Similarly for the template parameters for a new - template. - (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead - of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them. - (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. - (get_bindings): Call add_to_template_args if necessary. - (instantiate_decl): Handle instantiations of friend templates. - * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a - TEMPLATE_TYPE_PARM as a list of fields; it's not! - * spew.c (yylex): Do a little manual constant propagation to - clarify the code. - -Sun Feb 22 19:53:29 1998 Jeffrey A Law (law@cygnus.com) - - * error.c: Include sys/types.h. - -Thu Feb 19 14:49:09 1998 Jeffrey A Law (law@cygnus.com) - - * method.c (build_mangled_name): Start CPP directives in column zero. - -Thu Feb 19 10:36:48 1998 Jason Merrill - - * typeck2.c (process_init_constructor): Sorry about non-trivial - labeled initializers. - * parse.y (initlist): Re-enable labeled initializers. - -Thu Feb 19 10:15:55 1998 Kriang Lerdsuwanakij - - * pt.c (coerce_template_parms): Add a new parameter, is_tmpl_parm, - all callers changed. Rely on the new parameter instead of arg - being a TREE_LIST when determine whether we are working inside - template template parameter. Clean up is_type test. - -Thu Feb 19 10:04:12 1998 Jason Merrill - - * cvt.c (cp_convert_to_pointer): Preserve TREE_CONSTANT. - * typeck2.c (initializer_constant_valid_p): Allow conversions - between pointers and references. - -1998-02-19 Brendan Kehoe - - * typeck.c (build_unary_op): Only warn about incr/decr a pointer - if pedantic || warn_pointer_arith. - -Thu Feb 19 09:37:21 1998 Kriang Lerdsuwanakij - - * pt.c (unify): Handle TEMPLATE_DECL. - -1998-02-18 Brendan Kehoe - - * cp-tree.h (strip_attrs): Remove decl. - -1998-02-18 Doug Evans - - * decl.c (duplicate_decls): Call merge_machine_decl_attributes. - Update olddecl's attributes too. - (strip_attrs): Remove function. - * typeck.c (common_type): Call merge_machine_type_attributes. - -Tue Feb 17 14:07:52 1998 Mark Mitchell - - * parse.y (initdcl0_innards): New grammar symbol. - (nomods_initdecls, nomods_initdcl0): Change type from itype to - none, since the resulting value is never used. - (parse_decl): New function. - (datadef): Remove redundant actions. - (initdcl0, notype_initdcl0, nomods_initdcl0): Use initdcl0_innards. - * parse.c: Regenerated. - -Tue Feb 17 11:54:16 1998 Jason Merrill - - * parse.y (simple_stmt): Use getdecls() to check for decl. - -Sat Feb 14 11:50:51 1998 Manfred Hollstein - - * Make-lang.in (DEMANGLER_INSTALL_NAME, DEMANGLER_CROSS_NAME): New - macros. - (c++.install-common): Install c++filt properly as native or as cross - variant. - (c++.uninstall): Add c++filt. - -Fri Feb 13 14:55:37 1998 Jason Merrill - - * call.c (standard_conversion): Fix multi-level ptr conversions. - -Fri Feb 13 14:06:22 1998 Mike Stump - - * init.c (build_new): Propagate error_mark_node up. - -Fri Feb 13 13:24:32 1998 Jason Merrill - - * parse.y (simple_stmt): If the condition isn't a declaration, - start the controlled block after the test. - -Fri Feb 13 02:26:10 1998 Andreas Schwab - - * call.c (build_over_call): Convert builtin abs, labs and fabs to - tree-codes. - * decl.c (init_decl_processing): Re-enable abs, labs and fabs as - builtins. - -Fri Feb 13 01:36:42 1998 Jason Merrill - - * call.c (standard_conversion): A BASE_CONV replaces an RVALUE_CONV. - -Fri Feb 13 00:21:59 1998 Jason Merrill - - * cp-tree.h: Add access_protected_virtual_node. - * class.c (init_class_processing): Initialize it. - * decl.c (xref_basetypes): Use it. - * parse.y (base_class_access_list): Likewise. - - * Make-lang.in (DEMANGLER_PROG): Add $(exeext). - (c++.install-common): Install c++filt. - -Thu Feb 12 12:46:51 1998 Benjamin Kosnik - - * decl.c (shadow_tag): Give error for typedef-ing built-in types. - -Wed Feb 11 23:28:05 1998 Mark Mitchell - - * call.c (reference_binding): Use comptypes when comparing - TYPE_MAIN_VARIANTS to handle non-canonical array/index types. - -Wed Feb 11 16:42:04 1998 Mark Mitchell - - * tree.c (is_overloaded_fn): Use really_overloaded_fn. - (really_overloaded_fn): Move check here from is_overloaded_fn. - (get_first_fn): Use really_overloaded_fn and is_overloaded_fn. - -Wed Feb 11 15:54:18 1998 Mark Mitchell - - * typeck.c (build_ptrmemfunc): Type-check pointer-to-member - conversions. - -Mon Feb 9 22:23:31 1998 Mark Mitchell - - * cp-tree.h (push_template_decl): Return the decl passed in, or an - equivalent duplicate. - * decl.c (pushtag): Use the return value from push_template_decl. - (duplicate_decls): When duplicating a template declaration, merge - the DECL_TEMPLATE_RESULTs as well. - (make_implicit_typename): Don't try to dive into typename types to - find a context for making a new implicit typename. - (start_decl): Use the return value from push_template_decl. - (grokdeclarator): Complain about declarations list `const operator - int'. Since we don't correctly handle in-class initializations of - non-static data members, complain about this (now illegal) - practice. Issue an error for initializations of non-const statics - since that is illegal as well, and since we don't handle that case - correctly either. - (start_function): Use the return value from push_template_decl. - (start_method): Likewise. - * decl2.c (grokfield): Likewise. Since the change to - grokdeclarator ensures that all initialized fields are in fact - static, remove a redundant test for TREE_PUBLIC. - * parse.y (initlist): Disable labeled initializers since they do - not work as per the documentation, and since they do not use the - same syntax as the C front end. - * pt.c (push_template_decl): Return the decl passed in, or an - equivalent duplicate. - (lookup_template_class): When searching in a nested context, - use the right arguments. - (uses_template_parms): Handle the DECL_INITIAL for a CONST_DECL. - * typeck.c (build_component_ref): Assign the correct type to the - result of build_vfn_ref. - -Tue Feb 10 23:56:46 1998 Jason Merrill - - * pt.c (convert_nontype_argument): Fix typo. - (check_explicit_specialization): Allow old-style specialization - of class template members. - -Tue Feb 10 20:36:52 1998 Jason Merrill - Manfred Hollstein - - * decl.c (grokdeclarator): Use DECL_USE_TEMPLATE instead - when deciding to override DECL_ASSEMBLER_NAME. - -Tue Feb 10 15:30:55 1998 Andrew MacLeod - - * decl2.c (lang_f_options): Add -fsquangle to option processing list. - * cp-tree.h (flag_do_squangling): Add declaration. - * lang-options.h: Add -fsquangle and -fno-squangle. - * method.c: Add macros and static variables for squangling. - (build_overload_name): Rename to build_mangled_name, add logic for B - compression, and split into process_modifiers and - process_overload_item. - (process_modifiers): New function, to handle constant, reference, - and pointer types. - (process_overload_item): New function, handles issue of type codes. - (build_overload_name): New function, start squangling and call - build_mangled_name. - (ALLOCATE_TYPEVEC, DEALLOCATE_TYPEVEC): Remove macro and expand inline. - (start_squangling): New function to initialize squangling structs. - (end_squangling): New function to destroy squangling structs. - (nrepeats): Rename variable to Nrepeats. - (issue_nrepeats): New function for issuing 'n' type repeats. - (check_ktype): New function to check for type K name compression. - (build_overload_nested_name): Add a check for K name compression. - (build_qualified_name): Add a check for K name compression and don't - use DECL_ASSEMBLER_NAME when squangling is on. - (check_btype): New function, checks for B type compression. - (build_static_name, build_decl_overload_real): Initiate squangling. - (build_typename_overload, build_overload_with_type): Initiate - squangling - -Sun Feb 8 23:47:38 1998 scott snyder - - * method.c (make_thunk): Avoid name buffer overflow. - -Sat Feb 7 16:48:54 1998 Jason Merrill - - * pt.c (instantiate_decl): Call cp_finish_decl for vars even if we - don't define them yet. - - * parse.y (nomods_initdcl0): Add constructor_declarator case. - -Fri Feb 6 21:32:25 1998 Richard Kenner - - * config-lang.in (diff_excludes): Use basename only. - -Thu Feb 5 19:10:40 1998 Jason Merrill - - * tinfo2.cc: Add tinfo for signed char. - -Thu Feb 5 14:38:23 1998 Mike Stump - - * search.c (compute_access): Handle protected constructors in derived - classes as accessible. - -Wed Feb 4 01:26:49 1998 Jason Merrill - - * expr.c (cplus_expand_expr, PCC_STATIC_STRUCT_RETURN code): - Call convert_from_reference sooner. - -Tue Feb 3 23:50:52 1998 Mark Mitchell - - * cvt.c (ocp_convert): Obtain the constant values from constant - decls even if the destination type is the same as the type of the - decl. - - * decl2.c (finish_file): Make sure that static inlines with - definitions are not marked DECL_EXTERNAL before returning. - -Tue Feb 3 22:43:42 1998 Jason Merrill - - * decl.c: Lose arg_looking_for_template. - (lookup_name_real): Likewise. - * parse.y: Lose processing_template_arg, template_arg1. - (primary): Likewise. - * spew.c (yylex): Set lastiddecl for PTYPENAMEs, too. - -Tue Feb 3 22:04:01 1998 Kriang Lerdsuwanakij - - * error.c (dump_decl): Fix type of default arguments for template - template parameters and nontype template parameters. - * parse.y (template_parm): Handle invalid default template - template arguments here. - - * parse.y (template_parm): Use template_arg instead of PTYPENAME - for default template template argument. - * pt.c (coerce_template_parms): Merge default template argument - codes. Can treat RECORD_TYPE as template name if it is implicitly - created. Fix argument index in error message. - * typeck.c (comptypes): Merge template argument comparison codes in - TEMPLATE_TEMPLATE_PARM and RECORD_TYPE. - -Tue Jan 6 01:42:44 1998 Mumit Khan - - * lex.c (file_name_nondirectory): Also check for '/'. - -Mon Feb 2 11:24:22 1998 Mark Mitchell - - * parse.y (primary): Deal with statement-expressions in - templates. - * pt.c (tsubst_copy): Handle BIND_EXPR. - * tree.c (mapcar): Likewise. - - * call.c (add_template_candidate_real): Pass extra parameter to - fn_type_unification. - * cp-tree.h (fn_type_unification): Add parameter. - * pt.c (fn_type_unification): Add additional parameter to deal with - static member functions. - (get_bindings): Deal with static member functions. - - * cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): New macro. - (revert_static_member_fn): Declare. - * decl.c (revert_static_member_fn): Remove declaration. Change - linkage from internal to external. - (cp_finish_decl): Deal with virtual functions in classes local to - template functions. - * decl2.c (finish_file): Don't forget to emit increment/decrement - expressions in initializers for file-scope variables. - * parse.y (typename_sub2): If the typename doesn't names a - template, rather than a type, issue an error message. - * pt.c (check_explicit_specialization): Handle specializations of - static member functions. - (coerce_template_parms): Handle offset references to lists of - member functions. - * search.c (note_debug_info_needed): Don't crash when handed a - type which is being defined. - * typeck.c (complete_type): Don't crash when handed NULL_TREE; - that can happen with some illegal code. - -Mon Feb 2 00:57:38 1998 Kaveh R. Ghazi - - * call.c (user_harshness): Initialize `code' to 0. - (build_method_call): Initialize `candidates', `cp' and `len' to 0. - (null_ptr_cst_p): Add parentheses around && within ||. - (standard_conversion): Likewise. - (z_candidate): Likewise. - (build_user_type_conversion_1): Initialize `args' to NULL_TREE. - (build_object_call): Likewise for `mem_args'. - (build_new_op): Likewise for `mem_arglist'. Add `return' from - default case in enumeration switch. - - * class.c (build_vtable_entry): Add explicit braces to avoid - ambiguous `else'. - (build_class_init_list): Likewise. - (finish_struct_1): Initialize `width' to 0. - (instantiate_type): Initialize `name' to NULL_TREE. Add - explicit braces to avoid ambiguous `else'. - - * cvt.c (convert_to_aggr): Add explicit braces to avoid ambiguous - `else'. - - * decl.c (grok_reference_init): Eliminate unused parameter, all - callers changed. - (record_builtin_type): Initialize `tdecl' to NULL_TREE. - (init_decl_processing): Initialize `vb_off_identifier' to NULL_TREE. - (cp_finish_decl): Initialize `ttype' to NULL_TREE. - (grokdeclarator): Add parentheses around && within ||. Add - explicit braces to avoid ambiguous `else'. - (grokparms): Initialize `type' to NULL_TREE. - (xref_tag): Remove unused label `just_return'. - (finish_enum): Initialize `minnode' and `maxnode' to NULL_TREE. - (finish_function): Initialize `cond' and `thenclause' to NULL_TREE. - (hack_incomplete_structures): Add parentheses around assignment - used as truth value. - - * decl2.c (coerce_delete_type): Hide definition of `e3'. - - * error.c: Include . - (dump_expr): Change the type of `i' to size_t. Remove unused - label `error'. - - * except.c (init_exception_processing): Remove unused variable `d'. - (expand_throw): Likewise for `label'. - - * friend.c (add_friends): Add explicit braces to avoid ambiguous - `else'. - - * init.c (sort_member_init): Initialize `last_field' to NULL_TREE. - (sort_base_init): Likewise for `binfo'. - (expand_member_init): Likewise for `rval'. - (build_member_call): Add parentheses around assignment used as - truth value. - (build_offset_ref): Add explicit braces to avoid ambiguous `else'. - (build_new): Initialize `nelts' to NULL_TREE. Initialize - `old_immediate_size_expand' to 0. - (build_new_1): Initialize `nelts' and `alloc_node' to NULL_TREE. - (build_vec_delete_1): Remove unused variable `block'. - (expand_vec_init): Initialize `itype' to NULL_TREE. - - * lex.c: Include if we don't have . Protect - declaration of `index' and `rindex' with autoconf macros. - (reinit_parse_for_expr): Remove unused variables - `look_for_semicolon' and `look_for_lbrac'. - (cons_up_default_function): Initialize `args' to NULL_TREE. - (readescape): Initialize `firstdig' to 0. - (real_yylex): Add parentheses around assignment used as truth value. - - * method.c: Include if we don't have . - Protect declaration of `index' with autoconf macro. - - * parse.y (primary): Add explicit braces to avoid ambiguous `else'. - Initialize `type' to NULL_TREE. - (structsp): Remove unused variable `id'. - - * pt.c (coerce_template_parms): Add explicit braces to avoid - ambiguous `else'. - (lookup_template_class): Initialize `template' to NULL_TREE. - (instantiate_class_template): Remove unused variable `name' and `e'. - (tsubst): Likewise for `i'. Initialize `last' to NULL_TREE. - (do_poplevel): Initialize `saved_warn_unused' to 0. - (type_unification): Remove unused varable `parm'. - (unify): Likewise for `j'. - - * repo.c (init_repo): Add parentheses around assignment used as - truth value. - (finish_repo): Remove unused varable `p'. - - * search.c (get_binfo): Initialize `type' to NULL_TREE. - (get_base_distance): Likewise. - (lookup_field): Initialize `rval_binfo_h', `type', `basetype_path' - and `new_v' to NULL_TREE. - (lookup_fnfields): Likewise for `rval_binfo_h'. - (breadth_first_search): Add parentheses around assignment used as - truth value. - (get_template_base): Initialize `type' to NULL_TREE. - - * sig.c (append_signature_fields): Initialize `last_mfptr' to - NULL_TREE. - (build_signature_table_constructor): Likewise for - `last_rhs_field', `pfn' and `vt_off'. - (build_sigtable): Likewise for `init'. - - * tree.c (break_out_calls): Initialize `t2' to NULL_TREE. - (propagate_binfo_offsets): Likewise for `delta'. - (hash_tree_cons): Initialize hashcode to 0. - (can_free): Likewise for `size'. - (cp_tree_equal): Add explicit braces to avoid ambiguous `else'. - - * typeck.c (convert_sequence): Hide prototype. - (common_type): Add explicit braces to avoid ambiguous `else'. - (comp_target_types): Likewise. - (build_x_function_call): Initialize `ctypeptr' to NULL_TREE. - (build_function_call_real): Add explicit braces to avoid ambiguous - `else'. - (convert_arguments): Initialize `called_thing' to 0. - (convert_for_initialization): Initialize `savew' and `savee' to 0. - - * typeck2.c (incomplete_type_error): Initialize `errmsg' to 0. - (digest_init): Initialize `old_tail_contents' to NULL_TREE. - (build_x_arrow): Likewise for `last_rval'. - - * xref.c (GNU_xref_decl): Initialize `cls' to 0. - -Sun Feb 1 12:45:34 1998 J"orn Rennecke - - * decl.c (init_decl_processing): Use set_sizetype. - * decl2.c (sizetype): Don't declare. - * typeck.c (c_sizeof): Convert result of *_DIV_EXPR to sizetype. - (c_sizeof_nowarn, build_binary_op_nodefault): Likewise. - (build_component_addr, unary_complex_lvalue): Likewise. - * rtti.c (expand_class_desc): Likewise. - * class.c (get_vfield_offset): Likewise. - -Thu Jan 29 10:39:30 1998 Mark Mitchell - - * pt.c (convert_nontype_argument): Move check for is_overloaded_fn - early to avoid bogus error. Handle overloaded function - names provided as template arguments correctly. - (coerce_template_parms): Don't mishandle overloaded functions when - dealing with template template parameters. - (lookup_template_class): Issue an error message, rather than - crashing, when the TYPE_DECL provided is not a template type. - -Wed Jan 28 23:14:44 1998 Jason Merrill - - * class.c (instantiate_type): Don't just return a known type if - it's wrong. - -Wed Jan 28 11:04:07 1998 Mark Mitchell - - * class.c (instantiate_type): Remove handling of FUNCTION_DECL - since that code could never be reached. - - * error.c (dump_decl): Avoid aborting in the midst of printing an - error message about an illegal template declaration. - - * parse.y (structsp): Print an error message, rather than crashing, - when a class-head does not name a class. - - * pt.c (convert_nontype_argument): Allow REAL_TYPE and COMPLEX_TYPE - template arguments as a g++ extension. - - * cp-tree.def (ALIGNOF_EXPR): New tree code. - * decl2.c (grok_alignof): If processing_template_decl, just store - the expression. - * typeck.c (c_alignof): Likewise. - * decl2.c (build_expr_from_tree): Handle ALIGNOF_EXPR. - * error.c (dump_expr): Likewise. - * pt.c (tsubst_copy): Likewise. - * tree.c (cp_tree_equal): Likewise. - * pt.c (uses_template_parms): Correctly determine whether or not a - SIZEOF_EXPR/ALIGNOF_EXPR uses template parameters so that constant - folding can be done. - - * cp-tree.h (grok_enum_decls): Remove type parameter. - * decl.c (grok_enum_decls): Likewise. - * decl2.c (grok_x_components): Call grok_enum_decls - unconditionally, since it will do nothing if there is no - current_local_enum. Use the new calling sequence. - * pt.c (tsubst_enum): Use the new calling sequence for - grok_enum_decls. - - * decl.c (start_function): Make member functions of local classes - in extern inline functions have comdat linkage here... - (grokdeclarator): Rather than here. - -Wed Jan 28 10:55:47 1998 Jason Merrill - - * pt.c (convert_nontype_argument): Use decl_constant_value. - -Tue Jan 27 16:42:21 1998 Mark Mitchell - - * call.c (add_template_candidate_real): New function. - (add_template_candidate): Use it. - (add_template_conv_candidate): Likewise. - (joust): Pass extra argument to more_specialized. - * class.c (instantiate_type): Handle a single FUNCTION_DECL. - (is_local_class): Remove. - (finish_struct): Check TI_PENDING_SPECIALIZATION_FLAG. - * cp-tree.h (is_local_class): Remove. - (perform_array_to_pointer_conversion): Likewise. - (finish_member_template_decl): Add. - (check_explicit_specialization): Return a tree, not an int. - (more_specialized): Take additional argument. - (get_bindings): Likewise. - (TI_PENDING_SPECIALIZATION_FLAG): New macro. - * cvt.c (perform_qualification_conversions): Use comp_ptr_ttypes. - (perform_array_to_pointer_conversion): Remove. - * decl.c (saved_scope): Add processing_specialization, - processing_explicit_instantiation fields. - (maybe_push_to_top_level): Save them. - (pop_from_top_level): Restore them. - (grokfndecl): Use new return value from - check_explicit_specialization. - (start_decl): Don't check flag_guiding_decls before pushing - decls. - (cp_finish_decl): Remove previous (bogus) change. - (grok_declarator): Use decl_function_context rather than - is_local_class. - * decl2.c (finish_file): Pass extra argument to get_bindings. - (build_expr_from_tree): Let build_x_component_ref check - validity of arguments rather than doing it here. - * lex.c (cons_up_default_function): Remove code fooling with - processing_specialization, processing_explicit_instantiation - flags, as that is now done in {maybe_push_top,pop_from}_top_level. - * method.c (build_overload_identifier): Mangle local classes in - template functions correctly. - * parse.y (finish_member_template_decl): Move to pt.c. - * pt.c (finish_member_template_decl): Moved here from parse.y. - (print_candidates): New function. - (determine_specialization): Change interface. Properly look for - most specialized versions of template candidates. - (check_explicit_specialization): Fully process explicit - instantiations. - (push_template_decl): Avoid looking at CLASSTYPE fields in - FUNCTION_DECLS. - (determine_overloaded_function): Remove. - (convert_nontype_argument): Change name from - convert_nontype_parameter. Use determine_overloaded_function - instead of instantiate_type. - (mangle_class_name_for_template): Handle type contexts as well as - function contexts. - (classtype_mangled_name): Likewise. - (lookup_template_class): Likewise. - (tsubst): Likewise. - (more_specialized): Take explict template arguments as a - parameter. - (most_specialized): Likewise. - (get_bindings): Likewise. Check that return types match before - proclaiming a function a match. - (do_decl_instantiation): Remove code searching for function to - instantiate; that is now done in check_explicit_specialization. - (add_maybe_template): Pass extra argument to get_bindings. - * tree.c (really_overloaded_fn): Use is_overloaded_fn to simplify - implementation. - * typeck.c (build_component_ref): Check for invalid arguments. - -Tue Jan 27 01:44:02 1998 Jason Merrill - - * expr.c (cplus_expand_expr, AGGR_INIT_EXPR): Don't check that - return_target and call_target are equivalent. - - * pt.c (type_unification_real): Just accept function parms that - don't use any template parms. - -Sun Jan 25 03:30:00 1998 Jason Merrill - - * decl.c (cp_finish_decl): When bailing on a comdat variable, also - unset DECL_NOT_REALLY_EXTERN. - - * parse.y (typename_sub*): Fix std::. - -Sat Jan 24 12:13:54 1998 Jason Merrill - - * error.c (dump_decl): Fix type default template args. - (dump_type): Hand TEMPLATE_DECL off to dump_decl. - -Fri Jan 23 18:34:37 1998 Mumit Khan - - * lex.c (DIR_SEPARATOR): Define to be '/' if not already defined. - (file_name_nondirectory): Use. - -Wed Jan 21 10:29:57 1998 Kriang Lerdsuwanakij - - * pt.c (coerce_template_parms): Don't access elements of ARGLIST - that are not really present. Substitute default arguments in - template template arguments. Correctly convert TEMPLATE_DECL to - TEMPLATE_TEMPLATE_PARM. - (comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM - are no longer treated specially here. - * parse.y (template_template_parm): Fix copy error. - * decl.c (grokdeclarator): Warn about missing `typename' for nested - type created from template template parameters. - * parse.y (bad_parm): Likewise - - * class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM. - (push_nested_class): Likewise. - * cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code. - * cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro. - (copy_template_template_parm): Declare. - * decl.c (arg_looking_for_template): New variable. - (lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM. - Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM - node if arg_looking_for_template is nonzero. - (pushdecl): Handle TEMPLATE_TEMPLATE_PARM. - (grok_op_properties, xref_tag, xref_basetypes): Likewise. - (grokdeclarator): Handle TEMPLATE_DECL. - * decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM. - * error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM. - (dump_type_prefix, dump_type_suffix): Handle TEMPLATE_TEMPLATE_PARM. - (dump_decl): Handle unnamed template type parameters. - Handle template template parameters. - (dump_function_name): Handle template template parameters. - * init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef): - Handle TEMPLATE_TEMPLATE_PARM. - * method.c (build_template_template_parm_names): New function. - (build_template_parm_names): Handle TEMPLATE_DECL. - (build_overload_nested_name, build_overload_name): - Handle TEMPLATE_TEMPLATE_PARM. - * parse.y (maybe_identifier): New nonterminal. - (template_type_parm): Use it. - (template_template_parm, template_arg1): New nonterminal. - (template_parm): Add template_template_parm rules. - (template_arg): Set processing_template_arg. - (template_arg1): Rules moved from template_arg. - (primary, nonnested_type): Set arg_looking_for_template if we are - processing template arguments. - * pt.c (begin_member_template_processing): Handle TEMPLATE_DECL. - (process_template_parm): Handle template template parameters. - (coerce_template_parms, comp_template_args): Likewise. - (mangle_class_name_for_template, lookup_template_class): Likewise. - (uses_template_parms): Handle TEMPLATE_DECL and - TEMPLATE_TEMPLATE_PARM. - (current_template_args): Handle TEMPLATE_DECL. - (tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM. - * search.c (dfs_walk, dfs_record_inheritance): - Handle TEMPLATE_TEMPLATE_PARM. - * tree.c (copy_template_template_parm): New function. - (mapcar): Handle TEMPLATE_TEMPLATE_PARM. - * typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM. - -Mon Jan 19 22:40:03 1998 Mark Mitchell - - * decl.c (start_decl): Don't allow duplicate definitions of static - data members. - - * call.c (build_user_type_conversion_1): Handle user-defined - template conversion operators correctly. - - * decl2.c (build_expr_from_tree): Issue an error message if the - object in a COMPONENT_REF is a TEMPLATE_DECL. - - * typeck.c (incomplete_type_error): Handle TEMPLATE_TYPE_PARMs. - - * class.c (is_local_class): New function. - * cp-tree.h (is_local_class): Declare it. - (last_tree): Likewise. - (begin_tree): Likewise. - (end_tree): Likewise. - (lookup_template_class): Change prototype. - * decl.c (cp_finish_decl): Check for NULL where necessary. - Consider FUNCTION_DECLS to declare objects with top-level binding, - when calling make_decl_rtl. - (grokdeclarator): Give members of local classes internal linkage. - (start_function): Remove declaration of last_tree. - (finish_function): Set flag_keep_inline_functions around call to - rest_of_compilation if we are processing a member function in a - local class. - (start_method): Call push_template_decl for member functions of - local classes in template functions. - * decl2.c (import_export_decl): Don't give external linkage to - instantiations of templates with internal linkage. - * parse.y (last_tree): Remove declaration. - (template_type): Pass extra parameter to lookup_template_class. - (self_template_type): Likewise. - (structsp): Move call to reset_specialization into left_curly. - (left_curly): Call reset_specialization, and begin_tree. - * pt.c (saved_trees): New variable. - (mangle_class_name_for_template): Change prototype. Use - additional function context to name local classes in templates - correctly. - (classtype_mangled_name): Pass the context. - (push_template_decl): Handle local classes and templates, and - member functions for such classes. - (convert_nontype_parameter): Fix handling of pointer-to-member - constants. - (lookup_template_class): Handle local classes in templates. - (tsubst): Likewise. Don't assume that template instantiations - have external linkage; pay attention to the template declaration. - (mark_decl_instantiated): Likewise. - (begin_tree): New function. - (end_tree): Likewise. - - * decl.c (xref_basetypes): Don't call complete_type for basetypes - that involve template parameters; that can lead to infinite - recursion unnecessarily. - - * pt.c (register_specialization): Do not register specializations - that aren't ready to be registered yet. - (check_explicit_specialization): Handle explicit specialization of - constructors and destructors. - (build_template_decl): New function. - (push_template_delc): Handle out-of-class specializations of - member templates. - - * pt.c (check_explicit_specialization): Set up the template - information before registering the specialization. - (coerce_template_parms): Fix thinko. - (tsubst): Handle specializations of member templates correctly. - - * class.c (finish_struct_methods): Remove calls to - check_explicit_specialization from here. - (finish_struct): And insert them here. - * cp-tree.h (perform_qualification_conversions): New function. - (perform_array_to_pointer_conversion): Likewise. - (begin_explicit_instantiation): Likewise. - (end_explicit_instantiation): Likewise. - (determine_specialization): Renamed from - determine_explicit_specialization. - (comp_template_parms): New function. - (processing_explicit_instantiation): New variable. - * cvt.c (perform_qualification_conversions): New function. - (perform_array_to_pointer_conversion): Likewise. - * decl.c (duplicate_decls): Don't consider template functions - alike unless they have the same parameters. Refine handling of - instantiation/specialization mismatches. - (start_decl): Don't call pushdecl for template specializations, - since they don't affect overloading. - (start_function): Likewise. - (grokfndecl): Call check_explicit_specialization a little later. - Don't call duplicate_decls for memberm template specializations. - (grokdeclarator): Don't update template_count for classes that are - themselves specializations. Remove use of `2' as parameter to - grokfndecl since that value isn't used. - * lex.c (cons_up_default_function): Save and restore - processing_explicit_instantiation around calls to grokfield. - * parse.y (finish_member_template_decl): New function. - (component_decl_1): Use it. - (fn.def2): Likewise. - (template_arg_list_opt): New nonterminal. - (template_type): Use it. - (self_template_type): Likewise. - (template_id): Likewise. - (object_template_id): Likewise. - (notype_template_declarator): Likwise. - (begin_explicit_instantiation): Likewise. - (end_explicit_instantiation): Likewise. - (explicit_instantiation): Use them. - * pt.c (coerce_template_parms): Add parameters. - (processing_explicit_instantiation): New variable. - (convert_nontype_parameter): New function. - (determine_overloaded_function): Likewise. - (begin_explicit_instantiation): Likewise. - (end_explicit_instantiation): Likewise. - (retrieve_specialization): Likewise. - (register_specialization): Likewise. - (processing_explicit_specialization): Removed. - (determine_specialization): Handle specializations of member - functions of template class instantiations. - (check_explicit_specialization): Refine to conform to standard. - (comp_template_parms): New function. - (coerce_template_parms): Call convert_nontype_parameter. - (tsubst): Refine handling of member templates. Use - register_specialization. - (instantiate_template): Use retrieve_specialization. - (do_decl_instantiation): Likewise. - (instantiate_decl): Likewise. - (type_unification): Improve handling of explict template - arguments. - * tree.c (mapcar): Return error_mark_node, rather than aborting, - on VAR_DECLS, FUNCTION_DECLS, and CONST_DECLS. - * typeck.c (build_unary_op): Call determine_specialization, rather - than determine_explicit_specialization. - -Mon Jan 19 13:18:51 1998 Jason Merrill - - * cvt.c (build_up_reference): A TARGET_EXPR has side effects. - -Fri Jan 16 11:40:50 1998 Bruno Haible - - * error.c (dump_decl): For enum tags, output the tag, not its value. - -1998-01-13 Brendan Kehoe - - * decl.c (init_decl_processing): Only call init_rtti_processing - FLAG_RTTI is set. - -Mon Jan 12 01:35:18 1998 Jason Merrill - - * init.c (build_new_1): Split out from build_new. - (build_new): Just return a NEW_EXPR. - * expr.c (cplus_expand_expr): Handle NEW_EXPR. - - * decl2.c (get_temp_regvar): Tweak. - - * cp-tree.h (TREE_CALLS_NEW): Comment out. - * class.c (resolves_to_fixed_type_p): Remove use. - * method.c (build_opfncall): Likewise. - * call.c (build_new_op): Likewise. - -Wed Jan 7 23:47:13 1998 Jason Merrill - - * exception.cc (__eh_alloc, __eh_free): New fns. - (__cp_push_exception, __cp_pop_exception): Use them. - (__uncatch_exception): Call terminate here if no exception. - * except.c (build_terminate_handler): New fn. - (expand_start_catch_block): Use it. - (expand_exception_blocks): Likewise. - (alloc_eh_object): New fn. - (expand_throw): Use it. Protect exception init with terminate. - * typeck.c (build_modify_expr): Remove code that ignores trivial - methods. - -Mon Dec 22 11:36:27 1997 Kaveh R. Ghazi - - * call.c (add_builtin_candidate): Add default case in enumeration - switch. - (build_new_op): Likewise. - (convert_like): Likewise. - * cvt.c (build_expr_type_conversion): Likewise. - * tree.c (real_lvalue_p): Likewise. - (lvalue_p): Likewise. - (cp_tree_equal): Likewise. - * typeck.c (comptypes): Likewise. - (build_component_ref): Likewise. - (build_function_call_real): Likewise. - (build_binary_op_nodefault): Likewise. - (build_unary_op): Likewise. - (build_modify_expr): Likewise. - * typeck2.c (initializer_constant_valid_p): Likewise. - -Sun Dec 21 15:59:00 1997 Nick Clifton - - * decl2.c (lang_decode_option): Add support for -Wunknown-pragmas. - -Thu Dec 18 14:51:50 1997 Mark Mitchell - - * pt.c (coerce_template_parms): Make sure to digest_init if - possible. - - * decl.c (duplicate_decls): Make the newdecl virtual if the - olddecl was, just as is done with other attributes of olddecl. - -Thu Dec 18 14:43:19 1997 Jason Merrill - - * typeck.c (unary_complex_lvalue): Ignore op0 when taking the - address of an OFFSET_REF. - - * cp-tree.def: Add AGGR_INIT_EXPR. - * error.c, tree.c, typeck.c: Replace uses of NEW_EXPR with - AGGR_INIT_EXPR where appropriate. - * expr.c (cplus_expand_expr): Likewise. Simplify. - - * decl2.c (finish_file): Remove call to register_exception_table. - -Wed Dec 17 17:08:52 1997 Benjamin Kosnik - - * pt.c (instantiate_class_template): Don't do injection when - processing_template_decl is true, as pollutes current_binding_level - for base classes. - -Wed Dec 17 21:17:39 1997 Peter Schmid - - * pt.c (maybe_fold_nontype_arg): Add prototype. - -Tue Dec 16 10:31:20 1997 Jason Merrill - - * tree.c (mapcar): Handle TRY_CATCH_EXPR et al. - * error.c (dump_expr): Likewise. - -Mon Dec 15 12:22:04 1997 Jason Merrill - - * typeck.c (build_function_call_real): Remove "inline called before - definition" pedwarn. - - * pt.c (coerce_template_parms): Use maybe_fold_nontype_arg. - -Sun Dec 14 22:34:20 1997 Jason Merrill - - * cvt.c (cp_convert_to_pointer): Fix base conversion of pm's. - - * pt.c (type_unification_real): Change __null to type void* with - a warning. - -Sun Dec 14 20:38:35 1997 Mark Mitchell - - * call.c (implicit_conversion): Don't call - build_user_type_conversion_1 with a NULL expr, since it will - crash. - - * pt.c (unify): Don't try to unify array bounds if either array is - unbounded. - -Fri Dec 12 16:09:14 1997 Jason Merrill - - * errfn.c (cp_pedwarn, cp_pedwarn_at, cp_error_at, cp_warning_at): - Replace extern decls with casts. - - * decl.c (expand_start_early_try_stmts): Don't mess with a sequence. - Update last_parm_cleanup_insn. - (store_after_parms): Remove. - * cp-tree.h: Adjust. - -Thu Dec 11 22:18:37 1997 Jason Merrill - - * decl2.c (comdat_linkage): Also set DECL_COMDAT. - (finish_file): Check DECL_COMDAT instead of weak|one_only. - (import_export_vtable): Use make_decl_one_only instead of - comdat_linkage for win32 tweak. - (import_export_decl): Likewise. - * pt.c (mark_decl_instantiated): Likewise. - - * decl2.c (finish_file): Lose handling of templates in pending_statics. - -Thu Dec 11 21:12:09 1997 Jason Merrill - - * decl2.c (finish_file): Lose call to expand_builtin_throw. - * except.c (expand_builtin_throw): Remove. - * cp-tree.h: Remove ptr_ptr_type_node. - * decl.c: Likewise. - -Thu Dec 11 20:43:33 1997 Teemu Torma - - * decl.c (ptr_ptr_type_node): Define. - (init_decl_processing): Initialize it. - * cp-tree.h: Declare it. - * exception.cc (__cp_exception_info): Use __get_eh_info. - (__cp_push_exception): Likewise. - (__cp_pop_exception): Likewise. - - From Scott Snyder : - * except.c (expand_builtin_throw): Use get_saved_pc_ref instead of - saved_pc. - (init_exception_processing): Removed saved_pc initialization. - -Wed Dec 10 11:04:45 1997 Jason Merrill - - * pt.c (instantiate_decl): Defer all templates but inline functions. - -Mon Dec 8 23:17:13 1997 Jason Merrill - - * init.c (expand_vec_init): Don't fold a list of parameters. - - * decl.c (copy_args_p): Handle copy elision for types with virtual - bases. - * call.c (build_over_call): Likewise. - -Sun Dec 7 22:38:12 1997 Mark Mitchell - - * pt.c (lookup_template_function): Copy the template arguments, - not just the list containing them, to the permanent obstack. - -Sun Dec 7 15:53:06 1997 Jason Merrill - - * except.c (expand_start_catch_block): suspend_momentary for the - terminate handler. - - * error.c (dump_decl): Handle LOOKUP_EXPR. - -Sun Dec 7 15:45:07 1997 Mark Mitchell - - * rtti.c (build_dynamic_cast): Copy the cast-to type to the - permanent obstack if we are processing a template decl. - * typeck.c (build_static_cast): Likewise. - (build_const_cast): Likewise. - (build_reinterpret_cast): Likewise. - - * pt.c (coerce_template_parms): Coerce some expressions, even - when processing_template_decl. - -Sun Dec 7 01:46:33 1997 Bruno Haible - - * typeck.c (build_binary_op_nodefault, pointer_diff): Symmetric - handling of pointer difference expressions. - - * typeck.c (comp_target_types): Comparison of function/method types - is independent of nptrs. - -Sun Dec 7 01:40:27 1997 Mark Mitchell - - * pt.c (tsubst): Avoid creating pointer to reference and - reference to reference types. - -Sat Dec 6 01:29:37 1997 Jason Merrill - - * parse.y (do_id): New nonterminal. - (template_id): Use it. - -Fri Dec 5 01:17:34 1997 Jason Merrill - - * parse.y (template_id): do_identifier for PFUNCNAMEs, too. - * spew.c (yylex): Don't do_identifier here. - * decl2.c (build_expr_from_tree): Revert last change. - - * decl2.c (build_expr_from_tree): Expand the name for a method call. - * parse.y (object_template_id): Don't try to take the DECL_NAME. - -Wed Dec 3 20:02:39 1997 Jason Merrill - - * init.c (build_new): Use a TARGET_EXPR instead of SAVE_EXPR for - alloc_expr. - * call.c (build_op_delete_call): Adjust. - - * except.c (expand_end_catch_block): Lose rethrow region. - (expand_start_catch_block): Likewise. - (expand_end_catch_block): Don't expand_leftover_cleanups. - -Wed Dec 3 13:24:04 1997 Benjamin Kosnik - - * pt.c (tsubst): Remove tree_cons call (places redundant info into - DECL_TEMPLATE_INSTANTIATION). - -Wed Dec 3 11:44:52 1997 Jason Merrill - - * tree.c (is_overloaded_fn): Handle getting a fn template. - (really_overloaded_fn): Likewise. - * error.c (dump_decl): Handle TEMPLATE_ID_EXPRs better. - * pt.c (check_explicit_specialization): Tweak. - (determine_explicit_specialization): Tweak. - - * tree.c, cp-tree.h (get_target_expr): New fn. - -Wed Dec 3 08:47:27 1997 Paul Eggert - - * pt.c (check_explicit_specialization): Fix misspelling in - diagnostic: `preceeded'. - * typeck.c (get_delta_difference): Fix misspelling in diagnostic: - `conversiona'. - -1997-12-02 Mark Mitchell - - * pt.c (determine_explicit_specialization): Avoid an internal - error for bad specializations. - - * method.c (build_overload_value): Handle SCOPE_REF. - -Tue Dec 2 19:18:50 1997 Mike Stump - - * class.c (prepare_fresh_vtable): Enable even more complex MI - vtable names. - -Tue Dec 2 01:37:19 1997 Jason Merrill - - * exception.cc (__check_eh_spec): Optimize a bit. - - * exception.cc (__cp_pop_exception): Lose handler arg. - * except.c (do_pop_exception): Likewise. - (push_eh_cleanup): Let the cleanup mechanism supply the handler. - (expand_end_catch_block): Likewise. - -Fri Nov 28 01:58:14 1997 Jason Merrill - - * pt.c (check_explicit_specialization): Complain about using a - template-id for a non-specialization. - -Fri Nov 28 12:35:19 1997 Scott Christley - - * repo.c: Prototype rindex only if needed. - * xref.c: Likewise. - -Fri Nov 28 01:56:35 1997 Bruno Haible - - * error.c (dump_decl): Handle TEMPLATE_ID_EXPR. - -Thu Nov 27 00:59:46 1997 Jason Merrill - - * typeck.c (build_const_cast): Handle references here instead of - handing off to convert_to_reference. - - * except.c: Lose Unexpected, SetTerminate, SetUnexpected, - TerminateFunctionCall. - (init_exception_processing): Likewise. Terminate et al are now - the fns, not ADDR_EXPRs. - (various): Lose redundant assemble_external calls. - (do_unwind): s/BuiltinReturnAddress/builtin_return_address_fndecl/. - - * cp-tree.h (struct lang_decl_flags): Add comdat. - (DECL_COMDAT): New macro. - * decl.c (duplicate_decls): Propagate it. - (cp_finish_decl): Handle it. - * decl2.c (import_export_decl): Just set DECL_COMDAT on VAR_DECLs. - - * class.c: Remove static pending_hard_virtuals. - (add_virtual_function): Take pointers to pending_virtuals - and pending_hard_virtuals. - (finish_struct_1): Pass them. Declare pending_hard_virtuals. - -Wed Nov 26 20:28:49 1997 Jason Merrill - - * decl2.c (import_export_vtable): If we support one_only but not - weak symbols, mark instantiated template vtables one_only. - (import_export_decl): Likewise for tinfo functions. - (finish_vtable_vardecl): Also write out vtables from explicitly - instantiated template classes. - * pt.c (mark_class_instantiated): Revert last change. - - * except.c (expand_throw): Call mark_used on the destructor. - -Wed Nov 26 15:13:48 1997 Jeffrey A Law (law@cygnus.com) - - * lex.c (lang_init): Enable flag_exceptions by default if no - command line switch was specified. - -1997-11-26 Mark Mitchell - - * pt.c (unify): Handle `void' template parameters in - specializations. - -Wed Nov 26 01:11:24 1997 Jason Merrill - - * rtti.c (build_dynamic_cast): Handle template case here. - (build_dynamic_cast_1): Not here. - - * typeck2.c (digest_init): Make copies where appropriate. - - * decl2.c (delete_sanity): resolve_offset_ref. - - * except.c: Call terminate without caching so many bits. - - * except.c (expand_start_catch_block): Fix catching a reference - to pointer. - -Tue Nov 25 11:28:21 1997 Jason Merrill - - * init.c (build_new): Copy size to the saveable obstack. - - * init.c (build_new): Stick a CLEANUP_POINT_EXPR inside the - TRY_CATCH_EXPR for now. - -Mon Nov 24 12:15:55 1997 Jason Merrill - - * typeck.c (mark_addressable): Don't assume a FUNCTION_DECL - has DECL_LANG_SPECIFIC. - - * exception.cc (struct cp_eh_info): Add handlers field. - (__cp_push_exception): Initialize it. - (__cp_pop_exception): Decrement it. Don't pop unless it's 0. - (__throw_bad_exception): Remove. - * except.c (call_eh_info): Add handlers field. - (get_eh_handlers): New fn. - (push_eh_cleanup): Increment handlers. - -Fri Nov 21 12:22:07 1997 Jason Merrill - - * except.c (expand_start_eh_spec): Use the try/catch code. - (expand_end_eh_spec): Likewise. Call __check_eh_spec instead of - doing everything inline. - (init_exception_processing): throw_type_match now takes - const void pointers. - * exception.cc (__check_eh_spec): New fn. - * inc/exception: Neither terminate nor unexpected return. - * decl.c: Make const_ptr_type_node public. - * tinfo2.cc (__throw_type_match_rtti): Take the typeinfos constly. - - * except.c (expand_start_catch_block): We only need the rethrow - region for non-sjlj exceptions. - (expand_end_catch_block): Likewise. Use outer_context_label_stack. - -Thu Nov 20 14:40:17 1997 Jason Merrill - - * Make-lang.in (CXX_LIB2FUNCS): Add new op new and op delete objs. - (various.o): Likewise. - * inc/new: Add placement deletes. Add throw specs for default new. - * new.cc (set_new_handler): Move here from libgcc2. - * new1.cc (new (nothrow)): Catch a bad_alloc thrown from the handler. - (new): Move from libgcc2. Throw bad_alloc. - * new2.cc: Move the rest of the op news and op deletes from libgcc2. - * decl.c (init_decl_processing): Update exception specs on new and - delete. - - * method.c (build_decl_overload_real): Don't mess with global - placement delete. - - * init.c (build_new): Check for null throw spec, not nothrow_t. - - * decl.c (duplicate_decls): Don't complain about different exceptions - from an internal declaration. - - * call.c (build_op_delete_call): Fix check for member fns again. - - * decl2.c (import_export_decl): Interface hackery affects - virtual synthesized methods. - -Wed Nov 19 18:24:14 1997 Jason Merrill - - * decl.c (start_decl): Don't just complain about a mismatched - scope, fix it. - - * decl.c (make_implicit_typename): Handle case where t is not - actually from context. - * tree.c (get_type_decl): Lose identifier case. - * spew.c (yylex): Lose useless call to identifier_typedecl_value. - * parse.y (nonnested_type): Just use lookup_name. - (complex_type_name): Just use IDENTIFIER_GLOBAL_VALUE. - -Wed Nov 19 11:45:07 1997 Michael Tiemann - - * error.c (dump_function_name): Test DECL_LANG_SPECIFIC in case - T was built in C language context (for example, by - output_func_start_profiler). - -Wed Nov 19 10:39:27 1997 Jason Merrill - - * decl.c (make_implicit_typename): New fn. - (lookup_name_real): Use it. Use current_class_type as the context. - -Mon Nov 17 23:42:03 1997 Bruno Haible - - * pt.c (do_poplevel): Don't prohibit jumps into this contour. - -Mon Nov 17 02:01:28 1997 Jason Merrill - - * friend.c (do_friend): Warn about non-template friends in templates. - - * call.c (build_op_delete_call): Fix handling of inherited delete. - - * search.c (dfs_record_inheritance): Ignore template type parms. - -Sat Nov 15 00:30:51 1997 Jason Merrill - - * call.c (build_new_op): Fix copy error. - (build_op_new_call): New fn. - (build_op_delete_call): New fn. - * cp-tree.h: Declare them. - * init.c (build_new): Use them. Support placement delete. - (build_x_delete): Use build_op_delete_call. - (build_delete): Likewise. - * decl2.c (delete_sanity): Likewise. - (coerce_delete_type): Don't complain about placement delete. - -Thu Nov 13 01:52:36 1997 Jason Merrill - - * call.c (build_new_function_call): Remove unused 'obj' parm. - * cp-tree.h, typeck.c: Adjust. - - * init.c (build_new): Make the cleanup last longer. - (expand_vec_init): Call do_pending_stack_adjust. - -Wed Nov 12 11:04:33 1997 Jason Merrill - - * pt.c (do_type_instantiation): Fix typo. - (mark_class_instantiated): If we support one_only but not weak - symbols, don't mark this as known. - - * init.c (build_new): Handle vec delete in EH cleanup. - -Wed Nov 12 08:11:55 1997 Benjamin Kosnik - - * call.c (build_method_call): Call complete_type before checking - for destructor. - -Sun Nov 9 01:29:55 1997 Jim Wilson (wilson@cygnus.com) - - * decl.c (add_block_current_level): Delete. - * init.c (build_vec_delete_1): Delete build_block and - add_block_current_level calls. - -Wed Nov 12 00:48:16 1997 Jason Merrill - - * init.c (build_new): Handle freeing allocated memory when the - constructor throws. - - * call.c (build_new_method_call): Fix flags arg. - - * pt.c (do_type_instantiation): Don't try to instantiate - member templates. - (mark_decl_instantiated): If we support one_only but not - weak symbols, mark this one_only. - * decl2.c (import_export_vtable): Don't defer handling of vtables - if MULTIPLE_SYMBOL_SPACES. - -Tue Nov 11 12:02:12 1997 Jason Merrill - - * except.c (expand_end_catch_block): Lose call to __sjpopnthrow. - -Tue Nov 11 02:53:44 1997 Jason Merrill - - * except.c (do_pop_exception): Return a value. - -Mon Nov 10 20:25:31 1997 Jason Merrill - - * call.c (build_new_method_call): Handle getting a - TEMPLATE_ID_EXPR around a TEMPLATE_DECL. Don't look for a field - if we got template parms. - * typeck.c (build_x_function_call): Remember the TEMPLATE_ID_EXPR, - not just the args. - * decl2.c (build_expr_from_tree): Tweak last change. - * pt.c (tsubst_copy): Use get_first_fn instead of TREE_VALUE. - (maybe_fold_nontype_arg): Split out from tsubst_copy. - * tree.c (get_first_fn): Just return a TEMPLATE_ID_EXPR. - -Mon Nov 10 20:08:38 1997 Kriang Lerdsuwanakij - - * pt.c (tsubst_copy): Handle explicit template arguments in - function calls. - * typeck.c (build_x_function_call): Likewise. - * decl2.c (build_expr_from_tree): Lookup function name if it - hasn't been done. - - * pt.c (tsubst): Instantiate template functions properly when - template parameter does not appear in function arguments and return - type. - (comp_template_args): Handle member templates required by tsubst. - -Mon Nov 10 20:08:38 1997 Jason Merrill - - * decl.c (grokdeclarator): Tweak conditions for pedwarn in - previous change. - -Mon Nov 10 20:08:29 1997 Bruno Haible - - * pt.c (coerce_template_parms): Tweak error message. - - * decl.c (grokdeclarator): If -Wreturn-type, warn everytime a - return type defaults to `int', even if there are storage-class - specifiers. - -Mon Nov 10 03:04:20 1997 Jason Merrill - - Complete nested exception support. - * except.c (do_pop_exception): Split out... - (push_eh_cleanup): From here. Handle the EH region by hand. - (expand_start_catch_block): Add a new level for the catch parm. - Move the rethrow region outside the two cleanup regions. - Protect the initializer for the catch parm with terminate. - (expand_end_catch_block): Likewise. End the region for the eh_cleanup. - * exception.cc (__cp_pop_exception): Now takes two parms. Handle - popping off the middle of the stack. - * tree.c (lvalue_p, real_lvalue_p): Handle TRY_CATCH_EXPR, - WITH_CLEANUP_EXPR, and UNSAVE_EXPR. - (build_cplus_new): Only wrap CALL_EXPRs. - * init.c (expand_default_init): Handle a TRY_CATCH_EXPR around - the constructor call. - -Sun Nov 9 18:00:26 1997 Richard Kenner - - * Make-lang.in (c++.distdir): Make inc subdirectory. - -Fri Nov 7 11:57:28 1997 Jason Merrill - - * decl2.c (finish_file): Put back some code. - -Thu Nov 6 11:28:14 1997 Jason Merrill - - * decl2.c (finish_file): Remove redundant code. - * method.c (emit_thunk): Don't let the backend defer generic thunks. - -Wed Nov 5 23:52:50 1997 Jason Merrill - - * except.c (call_eh_info): Split out... - (push_eh_info): From here. - (expand_builtin_throw): Use it. - (expand_start_catch_block): Move region start back. - -Tue Nov 4 13:45:10 1997 Doug Evans - - * lex.c (MULTIBYTE_CHARS): #undef if cross compiling. - (real_yylex): Record wide strings using target endianness, not host. - -1997-11-03 Brendan Kehoe - - * repo.c (rindex): Add decl unconditionally. - (get_base_filename, open_repo_file): Don't cast rindex. - * xref.c (rindex): Add decl unconditionally. - (index): Remove unused decl. - (open_xref_file): Don't cast rindex. - -Sun Nov 2 15:04:12 1997 Jason Merrill - - * class.c (build_vbase_path): Propagate the result type properly. - -1997-11-01 Brendan Kehoe - - * except.c (expand_builtin_throw) [!DWARF2_UNWIND_INFO]: Replace - remaining use of saved_throw_type with a call to get_eh_type. - -1997-10-31 Brendan Kehoe - - * lex.c (FILE_NAME_NONDIRECTORY): Delete macro. - (file_name_nondirectory): New function, doing the same as the macro. - (set_typedecl_interface_info): Use it instead of the macro. - (check_newline): Likewise. - (handle_cp_pragma): Likewise. - - * repo.c (get_base_filename): Cast result of rindex to char*. - (open_repo_file): Likewise. - * xref.c (open_xref_file): Likewise. - * error.c (dump_char): Make its arg int, not char. - - * except.c (push_eh_info): Pass the number of fields - 1 down, not - the exact number of fields. - -Fri Oct 31 01:47:57 1997 Jason Merrill - - Support for nested exceptions. - * tinfo2.cc (__is_pointer): New fn. - * exception.cc (struct cp_eh_info): Define. - (__cp_exception_info, __uncatch_exception): New fns. - (__cp_push_exception, __cp_pop_exception): New fns. - * except.c: Lose saved_throw_{type,value,cleanup,in_catch}. - Lose empty_fndecl. - (init_exception_processing): Likewise. __eh_pc is now external. - (push_eh_info): New fn. - (get_eh_{info,value,type,caught}): New fns. - (push_eh_cleanup): Just call __cp_pop_exception. - (expand_start_catch_block): Use push_eh_info. Start the eh region - sooner. - (expand_end_eh_spec): Use push_eh_info. - (expand_throw): Call __cp_push_exception to set up the exception info. - Just pass the destructor or 0 as the cleanup. Call __uncatch_exception - when we rethrow. - (expand_builtin_throw): Don't refer to empty_fndecl. - -Thu Oct 23 02:01:30 1997 Jason Merrill - - * pt.c (instantiate_decl): SET_DECL_IMPLICIT_INSTANTIATION on new decl. - -1997-10-22 Brendan Kehoe - - * method.c (build_template_parm_names, build_decl_overload_real): - Add static to definitions. - * pt.c (add_to_template_args, note_template_header, - processing_explicit_specialization, type_unification_real): Likewise. - ({determine,check}_explicit_specialization): Use a single string for - error messages. - -Mon Oct 20 12:06:34 1997 Jason Merrill - - * except.c (expand_exception_blocks): Call do_pending_stack_adjust. - (expand_end_catch_block): Likewise. - (expand_end_eh_spec): Likewise. - -Mon Oct 20 11:44:20 1997 Mark Mitchell - - * decl.c (duplicate_decls): Handle template specializations - correctly. - * error.c (dump_function_name): Fix printing of specializations of - member functions that are not member templates. - * cp-tree.h (processing_specialization): Make global. - * pt.c (processing_specialization): Likewise. - * lex.c (cons_up_default_function): Save and restore - processing_specialization to avoid confusion. - -Mon Oct 20 10:52:22 1997 Jason Merrill - - * decl.c (init_decl_processing): Give null_node unknown* type. - * typeck.c (comp_target_types): Handle UNKNOWN_TYPE. - (common_type): Likewise. - * error.c (args_as_string): Recognize null_node. - -Sun Oct 19 09:13:01 1997 Richard Kenner - - * typeck.c (rationalize_conditional_expr): Handle {MIN,MAX}_EXPR. - (unary_complex_lvalue): Call it for {MIN,MAX}_EXPR. - - * decl.c (init_decl_processing): Call using_eh_for_cleanups. - - * Make-lang.in (g++): Include prefix.o. - -Thu Oct 16 15:31:09 1997 Judy Goldberg - - * pt.c (determine_explicit_specialization): Initialize "dummy" - to keep Purify quiet. - -Thu Oct 16 00:14:48 1997 Jason Merrill - - * method.c (build_overload_value): Handle TEMPLATE_CONST_PARMs here. - (build_overload_int): Not here. - -Wed Oct 15 00:35:28 1997 Mike Stump - - * class.c (build_type_pathname): Remove. - (prepare_fresh_vtable): Fix problem with complex MI vtable names. - -1997-10-14 Brendan Kehoe - - * parse.y (unary_expr): Give a pedwarn if someone tries to use the - &&label GNU extension. - -Tue Oct 14 12:01:00 1997 Mark Mitchell - - * decl.c (pushtag): Unset DECL_ASSEMBLER_NAME before setting it, - so as to avoid incorrect manglings. - * method.c (build_decl_overload_real): Don't mangle return types - for constructors. - -Tue Oct 14 11:46:14 1997 Jason Merrill - - * cp-tree.h (scratchalloc, build_scratch_list, make_scratch_vec, - scratch_tree_cons): Define as macros for now. - * call.c, class.c, cvt.c, decl.c, decl2.c, except.c, expr.c, init.c, - lex.c, method.c, parse.y, pt.c, rtti.c, search.c, tree.c, typeck.c, - typeck2.c: Use them and the expression_obstack variants. - -Mon Oct 13 17:41:26 1997 Benjamin Kosnik - - * decl.c (store_return_init): Allow classes with explicit ctors to - be used with the named return values extension. - -Fri Oct 10 12:21:11 1997 Jason Merrill - - * pt.c (instantiate_decl): Fix previous change. - -Thu Oct 9 12:08:21 1997 Jason Merrill - - * pt.c (tsubst): Fix thinko. - (instantiate_decl): Really use the original template. - - * call.c (build_new_method_call): Use simple constructor_name for - error messages. - -Wed Oct 8 22:44:42 1997 Jeffrey A Law - - * method.c (build_underscore_int): Don't use ANSI specific - features. - -Wed Oct 8 00:18:22 1997 Jason Merrill - - * decl2.c (finish_prevtable_vardecl): Check DECL_REALLY_EXTERN - for our key method; it might have been inlined by -O3. - -Tue Oct 7 23:00:12 1997 Mark Mitchell - - * decl.c (make_typename_type): Do not try to call lookup_field for - non-aggregate types. - -Tue Oct 7 22:52:10 1997 Jason Merrill - - * typeck.c (build_reinterpret_cast): Tweak. - -Tue Oct 7 22:45:31 1997 Alexandre Oliva - - * typeck.c (build_reinterpret_cast): Converting a void pointer - to function pointer with a reinterpret_cast produces a warning - if -pedantic is issued. - -Tue Oct 7 22:43:43 1997 Bruno Haible - - * typeck.c (c_expand_return): Don't warn about returning a - reference-type variable as a reference. - -Tue Oct 7 21:11:22 1997 Jason Merrill - - * method.c (build_static_name): Fix typo. - -1997-10-07 Brendan Kehoe - - * decl.c (duplicate_decls): Make sure DECL_LANG_SPECIFIC is set on - OLDDECL before we try to do DECL_USE_TEMPLATE. - -Tue Oct 7 00:48:36 1997 Jason Merrill - - * decl.c (duplicate_decls): Don't warn about template instances. - - * typeck.c (mark_addressable): Lose ancient code that unsets - DECL_EXTERNAL. - - * pt.c (do_decl_instantiation): Lose support for instantiating - non-templates. - - * call.c (build_new_function_call): Fix handling of null explicit - template args. - (build_new_method_call): Likewise. - -Mon Oct 6 23:44:34 1997 Mark Mitchell - - * method.c (build_underscore_int): Fix typo. - -1997-10-06 Brendan Kehoe - - * tree.c (print_lang_statistics): #if 0 call to - print_inline_obstack_statistics until its definition is checked in. - -Mon Oct 6 09:27:29 1997 Jason Merrill - - * decl2.c (finish_file): Move dump_tree_statistics to end. - - * pt.c (instantiate_decl): Look for the original template. - (tsubst): Set DECL_IMPLICIT_INSTANTIATION on partial instantiations - of member templates. - -Wed Oct 1 08:41:38 1997 Jason Merrill - - * Makefile.in (g++FAQ.*): New rules. - (CONFLICTS): Update. - * g++FAQ.texi: Moved from libg++. - - * parse.y (PFUNCNAME): Only specify the type once. - -1997-10-01 Brendan Kehoe - - * lex.c (real_yylex): Clean up the code to fully behave the way - the c-lex.c parser does for complex and real numbers. - -Tue Sep 30 08:51:36 1997 Jason Merrill - - * method.c (build_decl_overload_real): Reformat. - -Tue Sep 30 00:18:26 1997 Jason Merrill - - * method.c (synthesize_method): If at_eof, determine our linkage. - -1997-09-29 Paul Eggert - - * lex.c (real_yylex): Treat `$' just like `_', except issue a - diagnostic if !dollars_in_ident or if pedantic. - - * lang-specs.h (@c++): -ansi no longer implies -$. - - * decl2.c (lang_decode_option): - -traditional and -ansi now do not mess with - dollars_in_ident. - -Mon Sep 29 19:57:51 1997 H.J. Lu - - * Makefile.in (parse.o, decl.o): Also depend on - $(srcdir)/../except.h $(srcdir)/../output.h. - (decl2.o): Also depend on $(srcdir)/../expr.h ../insn-codes.h - $(srcdir)/../except.h $(srcdir)/../output.h. - (typeck.o, init.o): Also depend on $(srcdir)/../expr.h - ../insn-codes.h. - - * call.c, cp-tree.h, decl.c, tree.c: Finish prototyping. - - * expr.c (cplus_expand_expr): Make it static. - - * decl2.c, init.c, typeck.c: Include "expr.h". - (expand_expr): Use proper values when calling the function. - -Mon Sep 29 11:05:54 1997 Alexandre Oliva - - * lang-options.h: New -Wold-style-cast flag. - * cp-tree.h (warn_old_style_cast): New variable. - * decl2.c (warn_old_style_cast): Likewise. - (lang_decode_option): Support -Wold-style-cast. - (reparse_absdcl_as_casts): Produce old-style-cast warning. - -Mon Sep 29 09:20:53 1997 Benjamin Kosnik - - * decl.c (cp_finish_decl): Allow expand_aggr_init to set - TREE_USED, reset value based on already_used. - - * init.c (expand_member_init): Revert change. - -Mon Sep 29 08:57:53 1997 Jason Merrill - - * cp-tree.h, decl.c, decl2.c, pt.c: - Lose DECL_C_STATIC and DECL_PUBLIC. Don't pretend statics are public. - - * decl2.c (lang_decode_option): Add missing ;. - -Sat Sep 27 16:22:48 1997 Jason Merrill - - * friend.c (do_friend): Disable injection for all template-derived - decls. - * decl2.c (lang_decode_option): Handle -fguiding-decls. - * parse.y (notype_template_declarator): New nonterminal. - (direct_notype_declarator): Use it. - (complex_direct_notype_declarator): Likewise. - (object_template_id): Accept any kind of identifier after TEMPLATE. - (notype_qualified_id): Don't add template declarators here. - -Sat Sep 27 16:21:58 1997 Mark Mitchell - - * call.c (add_template_candidate): Add explicit_targs parameter. - (build_scoped_method_call): Use it. - (build_overload_call_real): Likewise. - (build_user_type_conversion_1): Likewise. - (build_new_function_call): Likewise. - (build_object_call): Likewise. - (build_new_op): Likewise. - (build_new_method_call): Likewise. - (build_new_function_call): Handle TEMPLATE_ID_EXPR. - (build_new_method_call): Likewise. - - * class.c (finish_struct_methods): Add specialization pass to - determine which methods were specializing which other methods. - (instantiate_type): Handle TEMPLATE_ID_EXPR. - - * cp-tree.def (TEMPLATE_ID_EXPR): New tree code. - - * cp-tree.h (name_mangling_version): New variable. - (flag_guiding_decls): Likewise. - (build_template_decl_overload): New function. - (begin_specialization): Likewise. - (reset_specialization): Likewise. - (end_specialization): Likewise. - (determine_explicit_specialization): Likewise. - (check_explicit_specialization): Likewise. - (lookup_template_function): Likewise. - (fn_type_unification): Add explicit_targs parameter. - (type_unification): Likewise. - - * decl.c (duplicate_decls): Add smarts for explicit - specializations. - (grokdeclarator): Handle TEMPLATE_ID_EXPR, and function - specializations. - (grokfndecl): Call check_explicit_specialization. - - * decl2.c (lang_decode_option): Handle -fname-mangling-version. - (build_expr_from_tree): Handle TEMPLATE_ID_EXPR. - (check_classfn): Handle specializations. - - * error.c (dump_function_name): Print specialization arguments. - - * friend.c (do_friend): Don't call pushdecl for template - instantiations. - - * init.c (build_member_call): Handle TEMPLATE_ID_EXPR. - - * lang-options.h: Add -fname-mangling-version, -fguiding-decls, - and -fno-guiding-decls. - - * lex.c (identifier_type): Return PFUNCNAME for template function - names. - - * method.c (build_decl_overload_real): New function. - (build_template_parm_names): New function. - (build_overload_identifier): Use it. - (build_underscore_int): New function. - (build_overload_int): Use it. Add levels for template - parameters. - (build_overload_name): Likewise. Also, handle TYPENAME_TYPEs. - (build_overload_nested_names): Handle template type parameters. - (build_template_decl_overload): New function. - - * parse.y (YYSTYPE): New ntype member. - (nested_name_specifier): Use it. - (nested_name_specifier_1): Likewise. - (PFUNCNAME): New token. - (template_id, object_template_id): New non-terminals. - (template_parm_list): Note specializations. - (template_def): Likewise. - (structsp): Likewise. - (fn.def2): Handle member template specializations. - (component_decl_1): Likewise. - (direct_notype_declarator): Handle template-ids. - (component_decl_1): Likewise. - (direct_notype_declarator): Handle template-ids. - (primary): Handle TEMPLATE_ID_EXPR, and template-ids. - - * pt.c (processing_specializations): New variable. - (template_header_count): Likewise. - (type_unification_real): New function. - (processing_explicit_specialization): Likewise. - (note_template_header): Likewise. - (is_member_template): Handle specializations. - (end_template_decl): Call reset_specialization. - (push_template_decl): Handle member template specializations. - (tsubst): Likewise. - (tsubst_copy): Handle TEMPLATE_ID_EXPR. - (instantiate_template): Handle specializations. - (instantiate_decl): Likewise. - (fn_type_unification): Handle explicit_targs. - (type_unification): Likewise. Allow incomplete unification - without an error message, if allow_incomplete. - (get_bindings): Use new calling sequence for fn_type_unification. - - * spew.c (yylex): Handle PFUNCNAME. - - * tree.c (is_overloaded_fn): Handle TEMPLATE_ID_EXPR. - (really_overloaded_fn): Likewise. - (get_first_fn): Handle function templates. - - * typeck.c (build_x_function_call): Use really_overloaded_fn. - Handle TEMPLATE_ID_EXPR. - (build_x_unary_op): Likewise. - (build_unary_op): Likewise. - (mark_addressable): Templates whose address is taken are marked - as used. - -1997-09-25 Andreas Schwab - - * decl.c (init_decl_processing): Declare __builtin_constant_p as - accepting any kind of type, not only int. - -Fri Sep 26 00:22:56 1997 Jason Merrill - - * search.c (get_matching_virtual): Notice virtual bases when sorrying - about covariant returns. - - * parse.y (member_init): Also imply typename here. Remove ancient - extension for initializing base members. - -Thu Sep 25 11:11:13 1997 Jason Merrill - - Handle multi-level typenames and implicit typename in base list. - * parse.y (typename_sub{,[0-2]}): New rules. - (structsp, rule TYPENAME_KEYWORD): Use typename_sub. - (nonnested_type): New rule. - (complete_type_name): Use it. - (base_class.1): Use typename_sub and nonnested_type. - (nested_name_specifier): Don't elide std:: here. - * decl.c (make_typename_type): Handle getting a type for NAME. - (lookup_name_real): Turn std:: into :: here. - - Rvalue conversions were removed in London. - * call.c (is_subseq): Don't consider lvalue transformations. - (build_conv): LVALUE_CONV and RVALUE_CONV get IDENTITY_RANK. - (joust): Re-enable ?: kludge. - -1997-09-22 Brendan Kehoe - - * decl.c (start_function): Up warning of no return type to be a - pedwarn. - -Mon Sep 22 14:15:34 1997 Benjamin Kosnik - - * init.c (expand_member_init): Don't set TREE_USED. - * decl.c (cp_finish_decl): Mark decls used if type has TREE_USED - set,don't clear TREE_USED wholesale. - -Sat Sep 20 15:31:00 1997 Jason Merrill - - * call.c (build_over_call): Do require_complete_type before - build_cplus_new. - -Thu Sep 18 16:47:52 1997 Jason Merrill - - * search.c (lookup_field): Call complete_type in all cases. - - * decl.c (finish_function): Just warn about flowing off the end. - -Wed Sep 17 10:31:25 1997 Jason Merrill - - * decl.c (grokparms): Don't bash a permanent list node if we're - in a function. - -1997-09-17 Brendan Kehoe - - * Makefile.in (CONFLICTS): Fix s/r conflict count to 18. - -Tue Sep 16 14:06:56 1997 Jason Merrill - - * call.c (build_new_op): Give better error for syntactically - correct, but semantically invalid, use of undeclared template. - - * call.c (compare_qual): Handle pmfs. - - * decl.c (store_parm_decls): last_parm_cleanup_insn is the insn - after the exception spec. - -Mon Sep 15 11:52:13 1997 Jason Merrill - - * call.c (null_ptr_cst_p): Integer type, not integral type. - - * call.c (joust): Disable warnings until they can be moved to the - right place. - -Fri Sep 12 16:11:13 1997 Per Bothner - - * Makefile.in, config-lang.in: Convert to autoconf. - -Thu Sep 11 17:14:55 1997 Jason Merrill - - * decl.c (lookup_name_real): Add implicit 'typename' to types from - base classes. - - * pt.c (most_specialized_class): Fix typo. - (tsubst): Move constant folding to TREE_VEC case. - -Thu Sep 11 10:08:45 1997 Mark Mitchell - - * pt.c (do_poplevel): Don't warn about unused local variables - while processing_template_decl since we don't always know whether - or not they will need constructing/destructing. - - * pt.c (uses_template_parms): Check the values of an enumeration - type to make sure they don't depend on template parms. - - * decl.c (make_typename_type): Don't lookup the field if the - context uses template parms, even if we're not - processing_template_decl at the moment. - - * pt.c (coerce_template_parms): Avoid looking at the - TYPE_LANG_DECL portion of a typename type, since there won't be - one. - (tsubst): Do constant folding as necessary to make sure that - arguments passed to lookup_template_class really are constants. - -Wed Sep 10 11:21:55 1997 Jason Merrill - - * except.c (expand_builtin_throw): #ifndef DWARF2_UNWIND_INFO. - * decl2.c (finish_file): Only register exception tables if we - need to. - - * decl.c (init_decl_processing): Add __builtin_[fs]p. - -Tue Sep 9 19:49:38 1997 Jason Merrill - - * pt.c (unify): Just return 0 for a TYPENAME_TYPE. - -Tue Sep 9 17:57:25 1997 Mark Mitchell - - * error.c (dump_decl): Avoid crashing when presented with a - uninitialized constant, as can occur with a template parameter. - (dump_expr): Make sure that there are enough levels of - current_template_parms before we start diving through them. - -1997-09-09 Brendan Kehoe - - * typeck.c (build_indirect_ref): Heed FLAG_VOLATILE similar to - c-typeck.c. - -Tue Sep 9 09:36:39 1997 Benjamin Kosnik - - * except.c (expand_throw): Call build_delete for all - exception types, not just objects with destructors. - -Mon Sep 8 02:33:20 1997 Jody Goldberg - - * decl.c (current_local_enum): Remove static. - * pt.c (tsubst_enum): Save and restore value of current_local_enum - in case template is expanded in enum decl. - (instantiate_class_template): Use new tsubst_enum signature. - (tsubst_expr): Likewise. - -Mon Sep 8 01:21:43 1997 Mark Mitchell - - * pt.c (begin_member_template_processing): Take a function as - argument, not a set of template arguments. Use the template - parameters, rather than the arguments. Handle non-type parameters - correctly. Push a binding level for the parameters so that multiple - member templates using the same parameter names can be declared. - (end_member_template_processing): Pop the binding level. - (push_template_decl): Mark member templates as static when - appropriate. - - * lex.c (do_pending_inlines): Pass the function, not its template - arguments, to begin_member_template_processing. - (process_next_inline): Likewise. - (do_pending_defargs): Likewise. - - * error.c (dump_expr): Obtain the correct declaration for a - TEMPLATE_CONST_PARM. - - * call.c (add_template_conv_candidate): New function. - (build_object_call): Handle member templates, as done in the other - build_ functions. - -Sat Sep 6 10:20:27 1997 Mark Mitchell - - * decl.c (replace_defag): Undo previous change. - * lex.c (do_pending_defargs): Deal with member templates. - - * pt.c (is_member_template): Avoid crashing when passed a - non-function argument. - -Fri Sep 5 17:27:38 1997 Jason Merrill - - * class.c (grow_method): Remove check for redeclaration. - -Fri Sep 5 01:37:17 1997 Mark Mitchell - - * cp-tree.h (INNERMOST_TEMPLATE_PARMS): New macro. - (DECL_INNERMOST_TEMPLATE_PARMS): Likewise. - (PRIMARY_TEMPLATE_P): Use it. - * call.c (build_overload_call_real): Use it. - * class.c (instantiate_type): Likewise. - * decl.c (decls_match): Likewise. - * method.c (build_overload_identifier): Likewise. - * pt.c (push_template_decl): Likewise. - (classtype_mangled_name): Likewise. - (lookup_template_class): Likewise. - - * cp-tree.h (DECL_NTPARMS): Change name from DECL_NT_PARMS to - DECL_NTPARMS to conform to usage elsewhere. - * call.c (add_template_candidate): Likewise. - * class.c (instantiate_type): Likewise. - * pt.c (instantiate_template): Likewise. - (get_bindings): Likewise. - - * class.c (grow_method): Use DECL_FUNCTION_TEMPLATE_P instead of - is_member_template. - - * pt.c (unify): Undo changes to allow multiple levels of template - parameters. - (type_unification): Likewise. - (fn_type_unification): Likewise. - (get_class_bindings): Likewise. - * cp-tree.h (Likewise). - - * decl.c (replace_defarg): Check that the type of the default - parameter does not invlove a template type before complaining - about the initialization. - - * error.c (dump_expr): Deal with template constant parameters in - member templates correctly. - - * pt.c (is_member_template): Deal with class specializations - correctly. - (tsubst): Handle "partial instantiation" of member templates - correctly. - -Wed Sep 3 12:30:24 1997 Mark Mitchell - - * pt.c (type_unification): Change calling sequence to allow for - multiple levels of template parameters. - (tsubst_expr): Likewise. - (tsubst): Likewise. - (tsubst_copy): Likewise. - (instantiate_template): Likewise. - (unify): Likewise. - * call.c (build_overload_call_real): Use it. - (add_builtin_candidate): Use it. - (build_new_method_call): Use it. - * class.c (instantiate_type): Use it. - * decl.c (grokdeclarator): Use it. - * decl2.c (finish_file): Use it. - * method.c (build_overload_identifier): Use it. - - * call.c (add_template_candidate): Add additional parameter for - the function return type. Call fn_type_unification istead of - type_unification. - (build_user_type_conversion_1): Handle member templates. - (build_new_function_call): Likewise. - (build_new_op): Likewise. - (build_new_method_call): Likewise. - - * class.c (grow_method): Don't give an error message indicating - that two member templates with the same name are ambiguous. - (finish_struct): Treat member template functions just like member - functions. - - * cp-tree.h (check_member_template): Add declaration. - (begin_member_template_processing): Likewise. - (end_member_template_processing): Likewise. - (fn_type_unification): Likewise. - (is_member_template): Likewise. - (tsubst): Change prototype. - (tsubst_expr): Likewise. - (tsubst_copy): Likewise. - (instantiate_template): Likewise. - (get_bindings): Likewise. - - * decl.c (decls_match): Handle multiple levels of template - parameters. - (pushdecl): Handle template type params just like other type - declarations. - (push_class_level_binding): Return immediately if the - class_binding_level is NULL. - (grokfndecl): If check_classfn() returns a member_template, use - the result of the template, not the template itself. - - * decl2.c (check_member_template): New function. Check to see - that the entity declared to be a member template can be one. - (check_classfn): Allow redeclaration of member template functions - with different types; the new functions can be specializations or - explicit instantiations. - - * error.c (dump_decl): Handle multiple levels of template - parameters. - (dump_function_decl): Update to handle function templates. - - * lex.c (do_pending_inlines): Set up template parameter context - for member templates. - (process_next_inline): Likewise. - - * method.c (build_overload_identifier): Adjust for multiple levels - of template parameters. - - * parse.y (fn.def2): Add member templates. - (component_decl_1): Likewise. - - * pt.c (begin_member_template_processing): New function. - (end_member_template_processing): Likewise. - (is_member_template): Likewise. - (fn_type_unification): Likewise. - (current_template_parms): Return a vector of all the template - parms, not just the innermost level of parms. - (push_template_decl): Deal with the possibility of member - templates. - (lookup_template_class): Likewise. - (uses_template_parms): Likewise. - (tsubst): Modify processing to TEMPLATE_TYPE_PARM and - TEMPLATE_CONST_PARM to deal with multiple levels of template - arguments. Add processing of TEMPLATE_DECL to produce new - TEMPLATE_DECLs from old ones. - (do_decl_instantiation): Handle member templates. - - * search.c (lookup_fnfields_1): Handle member template conversion - operators. - - * tree.c (cp_tree_equal): Check the levels, as well as the - indices, of TEMPLATE_CONST_PARMs. - - * typeck.c (comptypes): Check the levels, as well as the indices, - fo TEMPLATE_TYPE_PARMs. - (build_x_function_call): Treat member templates like member - functions. - -Wed Sep 3 11:09:25 1997 Jason Merrill - - * typeck.c (c_expand_return): Always convert_for_initialization - before checking for returning a pointer to local. - - * pt.c (type_unification): If strict and the function parm doesn't - use template parms, just compare types. - -Wed Sep 3 10:35:49 1997 Klaus Espenlaub - - * method.c (build_overloaded_value): Replace direct call - to the floating point emulator with REAL_VALUE_TO_DECIMAL macro. - -Wed Sep 3 00:02:53 1997 Jason Merrill - - * typeck.c (convert_arguments): Don't arbitrarily choose the first - of a set of overloaded functions. - -Tue Sep 2 12:09:13 1997 Jason Merrill - - * lex.c (real_yylex): Don't elide __FUNCTION__. - - * method.c (build_overload_value): Add in_template parm. - (build_overload_int): Likewise. - (build_overload_identifier): Pass it. - - * decl.c (duplicate_decls): Don't bash a previous template - definition with a redeclaration. - - * pt.c (unify): float doesn't match double. - - * pt.c (do_type_instantiation): Handle getting a _TYPE or a - TYPE_DECL. Handle getting non-template types. - * parse.y (explicit_instantiation): Use typespec instead of - aggr template_type. - -Tue Sep 2 10:27:08 1997 Richard Henderson - - * typeck.c (build_ptrmemfunc1): Clean up ptr->int cast warnings. - -Mon Sep 1 13:19:04 1997 Eugene Mamchits - - * call.c (add_builtin_candidate): Add missing TREE_TYPE. - (compare_ics): Likewise. - -Mon Sep 1 13:19:04 1997 Jason Merrill - - * call.c (joust): Warn about choosing one conversion op over - another because of 'this' argument when the other return type is - better. - (source_type): New fn. - - * call.c (build_new_op): Strip leading REF_BIND from first operand - to builtin operator. - - * decl2.c (mark_vtable_entries): Mark abort_fndecl as used when we - use its RTL. - -Thu Aug 28 09:45:23 1997 Jason Merrill - - * call.c (null_ptr_cst_p): Remove support for (void*)0. - -Wed Aug 27 02:03:34 1997 Jeffrey A Law - - * typeck.c (expand_target_expr): Make definition match declaration. - - * class.c (get_basefndecls): Make definition match declaration. - -Mon Aug 25 14:30:02 1997 Jason Merrill - - * input.c (sub_getch): Eventually give up and release the input file. - - * decl.c (cp_finish_decl): If #p i/i, put inline statics in the - right place. - - * call.c (joust): Tweak message. - -Sat Aug 23 18:02:59 1997 Mark Mitchell - - * error.c (type_as_string): Put const/volatile on template type - parameters where appropriate. - -Sat Aug 23 17:47:22 1997 Jeffrey A Law - - * call.c (strictly_better): Make arguments unsigned ints. - -Thu Aug 21 18:48:44 1997 Jason Merrill - - * lex.c (real_yylex): Refer to __complex instead of complex. - -Thu Aug 21 22:25:46 1997 J"orn Rennecke - - * lex.c (real_yylex): Don't use getc directly. - -Wed Aug 20 17:25:08 1997 Jason Merrill - - * call.c (is_subseq): Don't try to be clever. - -Wed Aug 20 03:13:36 1997 H.J. Lu (hjl@gnu.ai.mit.edu) - - * parse.y, pt.c: Include "except.h". - * call.c, class.c, class.h, cp-tree.h, cvt.c, decl.c, decl2.c, - error.c, except.c, expr.c, friend.c, g++spec.c, init.c, input.c, - lex.c, lex.h, method.c, parse.y, pt.c, repo.c, rtti.c, search.c, - sig.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c: Finish - prototyping. - -Wed Aug 20 01:34:40 1997 Jason Merrill - - * decl2.c (mark_vtable_entries): Instead of replacing pure - virtuals with a reference to __pure_virtual, copy the decl and - change the RTL. - -Tue Aug 19 02:26:07 1997 Jason Merrill - - * pt.c (lookup_nested_type_by_name): Handle typedef wierdness. - - * typeck2.c (my_friendly_abort): Report bugs to egcs-bugs@cygnus.com. - - * pt.c (instantiate_class_template): Call repo_template_used - before finish_prevtable_vardecl. - - * call.c (is_subseq): New fn. - (compare_ics): Use it. - - * repo.c (finish_repo): Don't crash on no args. - - * parse.y (named_complex_class_head_sans_basetype): Handle - explicit global scope. - * decl2.c (handle_class_head): New fn. - - * pt.c (unify): Add CONST_DECL case. - -Thu Aug 14 10:05:13 1997 Brendan Kehoe - - * rtti.c (permanent_obstack): Fix decl to not be a pointer. - - * cp-tree.h (report_type_mismatch): Add prototype. - * call.c (build_overload_call_real): Remove erroneous fourth - argument to report_type_mismatch. - (build_user_type_conversion_1): Remove erroneous second arg to - tourney. - (build_new_function_call): Likewise. - (build_object_call): Likewise. - (build_new_op): Likewise. - (build_new_method_call): Likewise. - -Wed Aug 13 19:19:25 1997 Jason Merrill - - * error.c (dump_decl): Don't bother processing a function with no - DECL_LANG_SPECIFIC. - - * method.c (emit_thunk): Call init_function_start in the macro case. - -Wed Aug 13 10:46:19 1997 H.J. Lu (hjl@gnu.ai.mit.edu) - - * decl2.c (DEFAULT_VTABLE_THUNKS): Define to be 0 if not - defined and used to set flag_vtable_thunks. - -Tue Aug 12 20:13:57 1997 Jason Merrill - - * parse.y: Don't clear the inlines from their obstack until they've - all been processed. - - * decl.c (duplicate_decls): Don't complain about exception - specification mismatch if flag_exceptions is off. - -Mon Aug 11 15:01:56 1997 Marc Lehmann - - * Make-lang.in (c++.distclean): Remove g++.c on make distclean. - -Sun Aug 10 12:06:09 1997 Paul Eggert - - * cp-tree.h: Replace STDIO_PROTO with PROTO in include files. - * cvt.c, error.c, except.c, expr.c, friend.c, init.c, rtti.c: - Include before include files that formerly used STDIO_PROTO. - - * decl.c, g++spec.c, lex.c, method.c, repo.c: - Include "config.h" first, as per autoconf manual. - -Fri Aug 8 11:47:48 1997 Jason Merrill - - * decl.c (duplicate_decls): Tweak wording. - * lex.c (do_pending_defargs): Don't die if we see a default arg - that isn't a DEFAULT_ARG. - * error.c (dump_expr): Handle DEFAULT_ARG. - - * decl2.c (lang_decode_option): Handle -fhandle-exceptions. - * lang-options.h: Add -fhandle-exceptions. - - * class.c (build_vtable): Vtables are artificial. - (prepare_fresh_vtable): Likewise. - -Wed Aug 6 11:02:36 1997 Jason Merrill - - * cvt.c (ocp_convert): After converting to the target type, set - LOOKUP_NO_CONVERSION. - - * call.c (joust): Warn about potentially confusing promotion rules - with -Wsign-promo. - * cp-tree.h, lang-options.h, decl2.c: Support -Wsign-promo. - -Tue Aug 5 15:15:07 1997 Michael Meissner - - * exception.cc: Declare __terminate_func with noreturn attribute. - -Fri Aug 1 03:18:15 1997 Jason Merrill - - * parse.y: Break out eat_saved_input, handle errors. - (function_try_block): Use compstmt instead of compstmt_or_error. - -Thu Jul 31 17:14:04 1997 Jason Merrill - - * tree.c (build_cplus_new): Don't set TREE_ADDRESSABLE. - -Fri Jul 4 01:45:16 1997 Andreas Schwab - - * Make-lang.in (cplib2.txt, cplib2.ready): Instead of checking for - existence of cc1plus check whether $(LANGUAGES) contains C++. - -Wed Jul 30 13:04:21 1997 Andreas Schwab - - * method.c (do_build_copy_constructor): When copying an anonymous - union member loop around to handle nested anonymous unions. Use - the offset of the member relative to the outer structure, not the - union. - -Tue Jul 29 21:17:29 1997 Jason Merrill - - * call.c (resolve_args): New fn. - (build_new_function_call): Use it. - (build_object_call): Likewise. - (build_new_method_call): Likewise. - -Mon Jul 28 16:02:36 1997 Jason Merrill - - * call.c (build_over_call): tsubst all default parms from templates. - -Wed Jul 23 13:36:25 1997 Jason Merrill - - * decl.c (struct cp_function): Add static_labelno. - (push_cp_function_context): Save it. - (pop_cp_function_context): Restore it. - -Tue Jul 22 14:43:29 1997 Jason Merrill - - * typeck.c (build_component_ref_1): Convert from reference. - -Tue Jul 22 11:06:23 1997 Brendan Kehoe - - * parse.y (current_declspecs, prefix_attributes): Initialize to - NULL_TREE. - - * parse.y (initdcl0): Make sure CURRENT_DECLSPECS is non-nil - before we try to force it to be a TREE_LIST. - (decl): Make sure $1.t is non-nil. - -Sun Jul 20 11:53:07 1997 Jason Merrill - - * pt.c (uses_template_parms): Handle template first-parse codes. - - * decl.c (cp_finish_decl): Only warn about user-defined statics. - -Fri Jul 18 17:56:08 1997 Jason Merrill - - * pt.c (unify): Handle BOOLEAN_TYPE. - - * cp-tree.h: Lose PARM_DEFAULT_FROM_TEMPLATE. - * pt.c (tsubst): Don't set it. - * call.c (build_over_call): Use uses_template_parms. - -Thu Jul 17 18:06:30 1997 Jason Merrill - - * method.c (build_overload_nested_name): Use static_labelno - instead of var_labelno. - (build_qualified_name): New fn. - (build_overload_name): Split out from here. - (build_static_name): Use build_qualified_name. - * decl.c (cp_finish_decl): Statics in extern inline functions - have comdat linkage. - (start_function): Initialize static_labelno. - -Thu Jul 17 11:20:17 1997 Benjamin Kosnik - - * class.c (finish_struct_methods): Add check of warn_ctor_dtor_privacy - before "all member functions in class [] are private". - -Wed Jul 16 23:47:08 1997 Jason Merrill - - * lex.c (do_scoped_id): convert_from_reference. - * init.c (build_offset_ref): Likewise. - -Wed Jul 16 12:34:29 1997 Benjamin Kosnik - - * error.c (dump_expr): Check TREE_OPERAND before dump_expr_list. - -Mon Jul 14 03:23:46 1997 Jason Merrill - - * typeck.c (get_member_function_from_ptrfunc): Promote index - before saving it. - -Sun Jul 13 00:11:52 1997 Jason Merrill - - * tree.c (layout_basetypes): Move non-virtual destructor warning. - * decl.c (xref_basetypes): Remove non-virtual destructor warning. - -Sat Jul 12 12:47:12 1997 Jason Merrill - - * decl.c (grokdeclarator): Call add_defarg_fn for the function - type, too. - * lex.c (add_defarg_fn): Adjust. - (do_pending_defargs): Adjust. Don't skip the first parm. - -Fri Jul 11 01:39:50 1997 Jason Merrill - - * decl.c (build_enumerator): Global enumerators are also readonly. - - * rtti.c (build_dynamic_cast_1): Renamed from build_dynamic_cast. - (build_dynamic_cast): Call it and convert_from_reference. - - * lex.c (add_defarg_fn): New fn. - (snarf_defarg): Don't add to defarg_types. - (do_pending_defargs): Lose defarg_types. All fns we process now - have defargs. - * decl.c (grokfndecl): Call add_defarg_fn. - - * Makefile.in (CONFLICTS): Expect 18 s/r conflicts. - * cp-tree.def: Add DEFAULT_ARG. - * spew.c (yylex): Call snarf_defarg as appropriate. - * parse.y: New tokens DEFARG and DEFARG_MARKER. - (defarg_again, pending_defargs, defarg, defarg1): New rules. - (structsp): Use pending_defargs. - (parms, full_parm): Use defarg. - * lex.c (init_lex): Initialize inline_text_firstobj. - (do_pending_inlines): Never pass the obstack to feed_input. - (process_next_inline): Call end_input instead of restore_pending_input. - (clear_inline_text_obstack, reinit_parse_for_expr, do_pending_defargs, - finish_defarg, feed_defarg, snarf_defarg, maybe_snarf_defarg): New fns. - * input.c (end_input): New fn. - (sub_getch): At the end of some fed input, just keep returning EOF - until someone calls end_input. - Remove 'obstack' field from struct input_source. - * decl.c (grokparms): Handle DEFAULT_ARG. - (replace_defarg): New fn. - * cp-tree.h (DEFARG_LENGTH, DEFARG_POINTER): New macros. - -Wed Jul 9 13:44:12 1997 Jason Merrill - - * call.c (implicit_conversion): If nothing else works, try binding - an rvalue to a reference. - -Wed Jul 9 13:04:38 1997 Geoffrey Noer - - * decl.c (init_decl_processing): Fix Jun 30 patch -- move - ifndef for Cygwin32 to include SIGSEGV. - -Thu Jul 3 01:44:05 1997 Jason Merrill - - * class.c (finish_struct_1): Only complain about pointers without - copy stuff if there are any constructors. - - * rtti.c (build_dynamic_cast): Call complete_type on the types. - - * decl.c (grokfndecl): If the function we chose doesn't actually - match, die. - - * decl2.c (grokclassfn): Don't specify 'const int' for the - artificial destructor parm. - - * pt.c (type_unification): If we are called recursively, nothing - decays. - -Mon Jun 30 17:53:21 1997 Geoffrey Noer - - * decl.c (init_decl_processing): Stop trying to catch signals - other than SIGABRT since the Cygwin32 library doesn't support - them correctly yet. This fixes a situation in which g++ causes - a hang on SIGSEGVs and other such signals in our Win32-hosted - tools. - -Mon Jun 30 14:50:01 1997 Jason Merrill - - * tree.c (mapcar, case CALL_EXPR): Handle all the parse node data. - -Fri Jun 27 15:18:49 1997 Jason Merrill - - * typeck2.c (store_init_value): Always return the value if our - type needs constructing. - - * method.c (hack_identifier): Convert class statics from - reference, too. - -Thu Jun 26 11:44:46 1997 Jason Merrill - - * Make-lang.in (cplib2.ready): Add $(LANGUAGES) dependency. - -Thu Jun 19 16:49:28 1997 Mike Stump - - * typeck.c (c_expand_return): Make sure we clean up temporaries at - the end of return x; - -Thu Jun 19 12:28:43 1997 Brendan Kehoe - - * lex.c (check_for_missing_semicolon): Also check for CV_QUALIFIER. - -Tue Jun 17 18:35:57 1997 Mike Stump - - * except.c (expand_builtin_throw): Add support - -fno-sjlj-exceptions -fPIC exception handling on the SPARC. - -Mon Jun 16 01:24:37 1997 Jason Merrill - - * repo.c (extract_string): Null-terminate. - - * cp-tree.h (TI_SPEC_INFO): New macro. - (CLASSTYPE_TI_SPEC_INFO): New macro. - * pt.c (push_template_decl): Correctly determine # of template parms - for partial specs. - - * call.c (compare_ics): Really fix 'this' conversions. - - * pt.c (do_decl_instantiation): Don't crash on explicit inst of - non-template fn. - - * pt.c (push_template_decl): Complain about mismatch in # of - template parms between a class template and a member template. - -Sun Jun 15 02:38:20 1997 Jason Merrill - - * method.c (synthesize_method): You can't call - function_cannot_inline_p after finish_function. - * decl.c (finish_function): Turn on flag_inline_functions and turn - off DECL_INLINE before handing a synthesized method to the - backend. - -Thu Jun 12 17:35:28 1997 Jason Merrill - - * method.c (synthesize_method): Remove July 30 change to never set - DECL_INLINE if at_eof. - -Thu Jun 12 15:25:08 1997 Mike Stump - - * xref.c (GNU_xref_member): Ensure that the node has a - decl_lang_specific part before checking DECL_FRIEND_P. - -Thu Jun 12 12:36:05 1997 Jason Merrill - - * pt.c (instantiate_class_template): Diagnose non-class types used - as bases. - -Wed Jun 11 17:33:40 1997 Jason Merrill - - * typeck.c (build_conditional_expr): Use convert_for_initialization - instead of convert_and_check. - -Wed Jun 11 12:31:33 1997 Brendan Kehoe - - * parse.y (typespec): Don't pedwarn for typeof. - -Tue Jun 10 00:22:09 1997 Jason Merrill - - * repo.c (finish_repo): Only check changes if we would write a - repo file. - - * call.c (compare_ics): Fix handling of 'this' conversions. - - * pt.c (do_decl_instantiation): Support static data too. Rename - from do_function_instantiation. - * cp-tree.h: Adjust. - * parse.y: Adjust. - - * repo.c (extract_string): New fn. - (get_base_filename): Use it. - (init_repo): Compare old args with current args. - -Mon Jun 9 14:25:30 1997 Mike Stump - - * Makefile.in, Make-lang.in: Protect C-ls with a comment - character, idea from Paul Eggert . - -Mon Jun 9 01:52:03 1997 Jason Merrill - - * typeck.c (c_expand_return): Be more persistent in looking for - returned temps. - - * cvt.c (build_up_reference): Use NOP_EXPR for switching from - pointer to reference. - - * class.c (build_vbase_path): Don't do anything if PATH has no steps. - -Sun Jun 8 03:07:05 1997 Jason Merrill - - * init.c (build_member_call, build_offset_ref): - Use do_scoped_id instead of do_identifier. - - * cvt.c (convert): Remove bogosity. - -Sat Jun 7 20:50:17 1997 Brendan Kehoe - - * cvt.c (build_up_reference): Do checks of ARGTYPE and - TARGET_TYPE before trying to use get_binfo. - -Fri Jun 6 17:36:39 1997 Jason Merrill - - * cvt.c (build_up_reference): Call get_binfo to get access control. - - * decl2.c (import_export_decl): If we don't support weaks, leave - statics undefined. - -Fri Jun 6 15:55:49 1997 Mike Stump - - * except.c (expand_builtin_throw): Add support for machines that - cannot access globals after throw's epilogue when - -fno-sjlj-exceptions is used. - -Thu Jun 5 16:28:43 1997 Jason Merrill - - * parse.y: 'std::' becomes '::'. - * lex.c (real_yylex): Remove 'namespace' warning. - * init.c (build_member_call): Ignore 'std::'. - (build_offset_ref): Likewise. - * decl2.c (do_using_directive): Ignore 'using namespace std;'. - (do_toplevel_using_decl): Ignore 'using std::whatever'. - * decl.c (push_namespace): Just sorry. - (pop_namespace): Nop. - (init_decl_processing): Declare std namespace. - -Tue Jun 3 18:08:23 1997 Jason Merrill - - * search.c (push_class_decls): A name which ambiguously refers to - several instantiations of the same template just refers to the - template. - -Tue Jun 3 12:30:40 1997 Benjamin Kosnik - - * decl.c (build_enumerator): Fix problem with unsigned long - enumerated values being smashed to ints, causing overflow - when computing next enumerated value (for enum values around - MAX_VAL). - -Mon Jun 2 17:40:56 1997 Jason Merrill - - * typeck.c (build_component_ref): Only call mark_used on a decl. - -Thu May 29 15:54:17 1997 Brendan Kehoe - - * typeck.c (build_c_cast): Make the check for a ptr to function - more specific before possible default_conversion call. - -Thu May 29 13:02:06 1997 Mike Stump - - * except.c (expand_exception_blocks): Simplify and fix and make - sure we don't end a region in a sequence, as expand_end_bindings - doesn't like it. - -Wed May 28 17:08:03 1997 Mike Stump - - * except.c (init_exception_processing): Mark terminate as not - returning so that the optimizer can optimize better. - -Tue May 27 19:49:19 1997 Mike Stump - - * cvt.c (convert): Don't do any extra work, if we can avoid it - easily. - -Tue May 27 18:21:47 1997 Mike Stump - - * *.[chy]: Change cp_convert to ocp_convert, change convert to - cp_convert. convert is now reserved for the backend, and doesn't - have the semantics a frontend person should ever want. - -Fri May 23 10:58:31 1997 Jason Merrill - - * lang-specs.h: Define __EXCEPTIONS if exceptions are enabled. - Lose -traditional support. - -Thu May 22 15:41:28 1997 Jason Merrill - - * rtti.c (get_tinfo_var): Use TYPE_PRECISION (sizetype). - - * parse.y (self_reference): Do it for templates, too. - * class.c (pushclass): Don't overload_template_name; the alias - generated by build_self_reference serves the same purpose. - - * tree.c (list_hash): Make static, take more args. - (list_hash_lookup): Likewise. - (list_hash_add): Make static. - (list_hash_canon): Lose. - (hash_tree_cons): Only build a new node if one isn't already in the - hashtable. - (hash_tree_chain): Use hash_tree_cons. - * cp-tree.h: Adjust. - * decl.c (grokfndecl): Just check IDENTIFIER_GLOBAL_VALUE instead - of calling lookup_name. - -Wed May 21 18:24:19 1997 Jason Merrill - - * pt.c (instantiate_class_template): TYPE_VALUES for an enum - doesn't refer to the CONST_DECLs. - -Tue May 20 21:09:32 1997 Bob Manson - - * rtti.c (get_tinfo_var): Either INT_TYPE_SIZE or 32, whichever - is bigger. - (expand_class_desc): Convert the last argument to a sizetype. - -Tue May 20 13:55:57 1997 Brendan Kehoe - - * gxx.gperf (__complex, __complex__, __imag, __imag__, __real, - __real__): Add reswords. - * hash.h: Regenerate. - * lex.h (rid): Add RID_COMPLEX. - (RID_LAST_MODIFIER): Set to RID_COMPLEX. - * lex.c (init_lex): Add building of RID_COMPLEX. - (real_yylex): General cleanup in line with what c-lex.c also has, - sans the cruft for traditional; add handling of SPEC_IMAG, complex - types, and imaginary numeric constants. - * parse.y (REALPART, IMAGPART): Add tokens. - (unary_expr): Add REALPART and IMAGPART rules. - * cp-tree.h (complex_{integer,float,double,long}_type_node): Declare. - * decl.c (complex_{integer,float,double,long}_type_node): Define - types. - (init_decl_processing): Set up the types. - (grokdeclarator): Add handling of RID_COMPLEX. Set and use - DEFAULTED_INT instead of EXPLICIT_INT when we default to int type. - * call.c (build_new_op): Add REALPART_EXPR and IMAGPART_EXPR cases. - * cvt.c (cp_convert): Handle COMPLEX_TYPE. - * error.c (dump_type_prefix, dump_type, dump_type_suffix): Add - COMPLEX_TYPE case. - * method.c (build_overload_name): Add handling of the different - COMPLEX_TYPEs, prefixing them with `J'. - * pt.c (process_template_parm): Don't let them use a COMPLEX_TYPE - as a template parm. - (uses_template_parms, tsubst, unify): Add COMPLEX_TYPE case. - * tree.c (lvalue_p): Add REALPART_EXPR and IMAGPART_EXPR cases. - (mapcar): Handle COMPLEX_CST. - * typeck.c (build_binary_op_nodefault): Handle COMPLEX_TYPE. - (common_type): Add code for complex types. - (build_unary_op): Add REALPART_EXPR and IMAGPART_EXPR cases. - (convert_for_assignment): Likewise. - (mark_addressable): Add REALPART_EXPR and IMAGPART_EXPR cases. - -Mon May 19 12:26:27 1997 Jason Merrill - - * pt.c (tsubst): Don't pass the MINUS_EXPR for an array domain to - tsubst_expr, as it might try to do overload resolution. - -Sat May 17 10:48:31 1997 Jason Merrill - - * pt.c (instantiate_class_template): Oops. - -Fri May 16 14:23:57 1997 Jason Merrill - - * cp-tree.def: Add TAG_DEFN. - * pt.c (tsubst_enum): New fn. - (instantiate_class_template): Use it. - (tsubst_expr): Support TAG_DEFN. - (tsubst): Support local enums. - (tsubst_copy): Likewise. - * decl.c (finish_enum): Likewise. - (start_enum): If this is a local enum, switch to permanent_obstack. - -Wed May 14 19:08:28 1997 Mike Stump - - * decl.c (store_parm_decls): Set last_parm_cleanup_insn here. - (finish_function): Put the base init code for constructors just - after the parm cleanup insns. - (struct cp_function): Add last_parm_cleanup_insn. - (push_cp_function_context): Likewise. - (pop_cp_function_context): Likewise. - -Tue May 13 15:51:20 1997 Jason Merrill - - * pt.c (tsubst_copy): Handle BIT_NOT_EXPR. - -Wed May 7 11:17:59 1997 Brendan Kehoe - - * method.c (emit_thunk) [ASM_OUTPUT_MI_THUNK]: Build up the RTL - for THUNK_FNDECL before we switch to temporary allocation. - -Mon May 5 14:46:53 1997 Jason Merrill - - * call.c (build_new_op): Handle null arg2 for ?:. - -Thu May 1 18:26:37 1997 Mike Stump - - * except.c (expand_exception_blocks): Ensure that we flow through - the end of the exception region for the exception specification. - Move exception region for the exception specification in, so that - it doesn't protect the parm cleanup. Remove some obsolete code. - * decl.c (store_parm_decls): Likewise. - (finish_function): Likewise. - -Tue Apr 29 15:38:54 1997 Jason Merrill - - * init.c (build_new): Fix nothrow handling. - -Tue Apr 29 14:29:50 1997 Brendan Kehoe - - * init.c (emit_base_init): Don't warn about the initialization - list for an artificial member. - -Fri Apr 25 17:47:59 1997 Brendan Kehoe - - * expr.c (do_case): Handle !START case for the error msg. - -Fri Apr 25 11:55:23 1997 Jason Merrill - - * decl2.c, lang-options.h: New option -Weffc++. - * class.c, decl.c, init.c, typeck.c: Move Effective C++ warnings - to -Weffc++. - - * decl2.c (finish_prevtable_vardecl): Change NO_LINKAGE_HEURISTICS - to MULTIPLE_SYMBOL_SPACES. - -Wed Apr 23 18:06:50 1997 Jason Merrill - - * method.c (emit_thunk, generic case): Set current_function_is_thunk. - - * method.c (emit_thunk, macro case): Set up DECL_RESULT. - - * typeck.c (c_expand_return): Don't complain about returning void - to void in an artificial function. - * method.c (make_thunk): Change settings of READONLY/VOLATILE, - don't set DECL_RESULT, set DECL_ARTIFICIAL. - (emit_thunk, generic code): Also set up DECL_LANG_SPECIFIC. - -Wed Apr 23 14:43:06 1997 Mike Stump - - * init.c (init_decl_processing): Add support for setjmp/longjmp based - exception handling. - * except.c (init_exception_processing): Likewise. - (expand_end_catch_block): Likewise. - (expand_exception_blocks): Likewise. - (expand_throw): Likewise. - * exception.cc (__default_terminate): Likewise. - - * init.c (perform_member_init): Use new method of expr level - cleanups, instead of cleanups_this_call and friends. - (emit_base_init): Likewise. - (expand_aggr_vbase_init_1): Likewise. - (expand_vec_init): Likewise. - * decl.c (cp_finish_decl): Likewise. - (expand_static_init): Likewise. - (store_parm_decls): Likewise. - (cplus_expand_expr_stmt): Likewise. - * decl2.c (finish_file): Likewise. - - * Make-lang.in (exception.o): Ok to compile with -O now. - - * decl.c (maybe_build_cleanup_1): We no longer have to unsave, as - we know it will be done later by the backend. - - * decl2.c (lang_f_options): Remove support for short temps. - * lang-options.h: Likewise. - -Wed Apr 23 04:12:06 1997 Jason Merrill - - * tree.c (varargs_function_p): New fn. - * method.c (emit_thunk): Replace broken generic code with code to - generate a heavyweight thunk function. - -Tue Apr 22 02:45:18 1997 Jason Merrill - - * pt.c (process_template_parm): pedwarn about floating-point parms. - - * decl.c (grokdeclarator): inline no longer implies static. - - * spew.c (yylex): Always return the TYPE_DECL if we got a scope. - -Mon Apr 21 15:42:27 1997 Jason Merrill - - * class.c (check_for_override): The signature of an overriding - function is not changed. - - * call.c (build_over_call): Move setting of conv into the loop. - Note: this change, along with the related changes of the 18th thru - the 20th of April, fix an infinite loop problem in conversions. - -Sun Apr 20 16:24:29 1997 Jason Merrill - - * call.c (build_user_type_conversion_1): Really ignore rvalue - conversions when looking for a REFERENCE_TYPE. - - * cvt.c (build_up_reference): Eviscerate, use build_unary_op. - * cp-tree.h (TREE_REFERENCE_EXPR): #if 0. - * typeck.c (decay_conversion): Don't set TREE_REFERENCE_EXPR. - (build_unary_op): Likewise. - * call.c (build_over_call): See through a CONVERT_EXPR around the - ADDR_EXPR for on a temporary. - * typeck.c (c_expand_return): See through a CONVERT_EXPR around - the ADDR_EXPR for a local variable. - -Fri Apr 18 12:11:33 1997 Jason Merrill - - * call.c (build_user_type_conversion_1): If we're trying to - convert to a REFERENCE_TYPE, only consider lvalue conversions. - (build_new_function_call): Print candidates. - (implicit_conversion): Try a temp binding if the lvalue conv is BAD. - (reference_binding): Binding a temporary of a reference-related type - is BAD. - -Thu Apr 17 14:37:22 1997 Brendan Kehoe - - * inc/typeinfo (type_info::before): Add cv-qualifier-seq. - * tinfo2.cc (type_info::before): Likewise. - -Mon Apr 14 12:38:17 1997 Jason Merrill - - * call.c (implicit_conversion): Oops. - -Fri Apr 11 02:18:30 1997 Jason Merrill - - * call.c (implicit_conversion): Try to find a reference conversion - before binding a const reference to a temporary. - -Wed Apr 2 12:51:36 1997 Mike Stump - - * exception.cc (__default_unexpected): Call terminate by default, - so that if the user overrides terminate, the correct function will - be called. - -Wed Mar 19 14:14:45 1997 Mike Stump - - * parse.y (left_curly): Avoid trying to use any fields of - error_mark_node, as there aren't any. - -Thu Mar 13 16:33:22 1997 Jason Merrill - - * lex.c (do_identifier): Avoid breaking on overloaded methods - as default arguments. - -Wed Mar 12 13:55:10 1997 Hans-Peter Nilsson - - * call.c (add_template_candidate): Initialize the variable "dummy". - -Mon Mar 10 15:13:14 1997 Brendan Kehoe - - * decl.c (start_decl): Make sure TYPE isn't an error_mark_node - before we try to use TYPE_SIZE and TREE_CONSTANT on it. - -Fri Mar 7 13:19:36 1997 Brendan Kehoe - - * cp-tree.h (comp_ptr_ttypes, more_specialized): Add decl. - (debug_binfo): Delete decl, not needed. - - * tree.c (fnaddr_from_vtable_entry, function_arg_chain, - promotes_to_aggr_type): Delete fns. - * cp-tree.h (FNADDR_FROM_VTABLE_ENTRY, - SET_FNADDR_FROM_VTABLE_ENTRY, FUNCTION_ARG_CHAIN, - PROMOTES_TO_AGGR_TYPE): Delete alternates to #if 1. - - * decl.c (pending_invalid_xref{,_file,_line}): Delete unused vars. - - * friend.c (is_friend_type): Delete fn. - * cp-tree.h (is_friend_type): Delete decl. - - * decl.c (original_result_rtx, double_ftype_double, - double_ftype_double_double, int_ftype_int, long_ftype_long, - float_ftype_float, ldouble_ftype_ldouble, last_dtor_insn): Make static. - * typeck.c (original_result_rtx, warn_synth): Delete extern decls. - - * decl.c (push_overloaded_decl{,_top_level}): Make static, adding - fwd decls. - * cp-tree.h (push_overloaded_decl{,_top_level}): Delete decls. - - * decl.c (pushdecl_nonclass_level): #if 0, unused. - * cp-tree.h (pushdecl_nonclass_level): #if 0 decl. - - * lex.c (reinit_lang_specific): #if 0, unused. - * cp-tree.h (reinit_lang_specific): #if 0 decl. - - * decl.c (revert_static_member_fn): Make static, adding fwd decl. - * cp-tree.h (revert_static_member_fn): Delete decl. - - * class.c (root_lang_context_p): Delete fn. - * cp-tree.h (root_lang_context_p): Delete decl. - - * decl.c (set_current_level_tags_transparency): #if 0, unused. - * cp-tree.h (set_current_level_tags_transparency): #if 0 decl. - - * lex.c (set_vardecl_interface_info): Make static. - * cp-tree.h (set_vardecl_interface_info): Delete decl. - - * call.c (find_scoped_type): Make static. - * cp-tree.h (find_scoped_type): Delete decl. - - * search.c (convert_pointer_to_vbase): Make static. - * cp-tree.h (convert_pointer_to_vbase): Delete decl. - - * decl.c (const_ptr_type_node): Likewise. - * cp-tree.h (const_ptr_type_node): Delete decl. - - * typeck.c (common_base_type): Make static. - * cp-tree.h (common_base_types): Delete erroneous decl. - - * pt.c (classtype_mangled_name): Make static. - * cp-tree.h (classtype_mangled_name): Delete decl. - - * lex.c (check_newline): Make static. - * cp-tree.h (check_newline): Delete decl. - - * typeck.c (build_x_array_ref): Delete fn, same idea as - grok_array_decl. - * cp-tree.h (build_x_array_ref): Delete decl. - - * lex.c (copy_decl_lang_specific): Delete fn, same idea as - copy_lang_decl. - * cp-tree.h (copy_decl_lang_specific): #if 0 decl. - - * class.c (build_vtable_entry): Make static. - * cp-tree.h (build_vtable_entry): Delete decl. - - * class.c (build_vbase_pointer): Make static. - * cp-tree.h (build_vbase_pointer): Delete decl. - - * sig.c (build_sptr_ref): Add forward decl and make static. - * cp-tree.h (build_sptr_ref): Delete decl. - - * call.c (build_new_method_call): Add forward decl and make static. - * cp-tree.h (build_new_method_call): Delete decl. - - * call.c (build_object_call): Make static. - * class.c (check_for_override, complete_type_p, mark_overriders): - Likewise. - * decl.c (cp_function_chain): Likewise. - * lex.c (set_typedecl_interface_info, reinit_parse_for_block): - Likewise. - * pt.c (comp_template_args, get_class_bindings, push_tinst_level): - Likewise. - * tree.c (build_cplus_array_type_1): Likewise. - * typeck.c (comp_ptr_ttypes_{const,real,reinterpret}): Likewise. - (comp_target_parms): Likewise. - - * init.c (build_builtin_call): Make static. - * cp-tree.h (build_builtin_call): Delete decl. - - * typeck.c (binary_op_error): Delete decl. - * cp-tree.h (binary_op_error): Likewise. - -Thu Mar 6 16:13:52 1997 Brendan Kehoe - - * call.c (build_method_call): Compare against error_mark_node - directly, rather than the ERROR_MARK tree code. - * cvt.c (cp_convert): Likewise. - * decl.c (print_binding_level): Likewise. - (duplicate_decls): Likewise. - (grokdeclarator): Likewise. - (grokdeclarator): Likewise. - * init.c (expand_aggr_init_1): Likewise. - (decl_constant_value): Likewise. - * method.c (build_opfncall): Likewise. - (hack_identifier): Likewise. - * typeck.c (build_modify_expr): Likewise. - - * typeck.c (build_c_cast): Don't decl TYPE as register tree. - -Sun Mar 2 02:54:36 1997 Bruno Haible - - * pt.c (unify): Strip NOP_EXPR wrappers before unifying integer values. - - * pt.c (coerce_template_parms): Add new error message. - - * method.c (build_overload_value): Implement name mangling for - floating-point template arguments. - - * method.c (build_overload_int, icat, dicat): Fix mangling of template - arguments whose absolute value doesn't fit in a signed word. - -Mon Mar 3 12:14:54 1997 Brendan Kehoe - - * friend.c: New file; put all of the friend stuff in here. - * init.c: Instead of here. - * Makefile.in (CXX_OBJS): Add friend.o. - (friend.o): Add dependencies. - * Make-lang.in (CXX_SRCS): Add $(srcdir)/cp/friend.c. - -Sun Mar 2 11:04:43 1997 Jason Merrill - - * call.c (build_scoped_method_call): Complain if the scope isn't a - base. - -Wed Feb 26 11:31:06 1997 Jason Merrill - - * parse.y (left_curly): Don't crash on erroneous type. - - * init.c (build_delete): Fix type of ref. - -Tue Feb 25 12:41:48 1997 Jason Merrill - - * search.c (get_vbase_1): Renamed from get_vbase. - (get_vbase): Wrapper, now non-static. - (convert_pointer_to_vbase): Now static. - - * call.c (build_scoped_method_call): Accept a binfo for BASETYPE. - * init.c (build_delete): Pass one. - (build_partial_cleanup_for): Use build_scoped_method_call. - * decl.c (finish_function): Pass a binfo. - -Mon Feb 24 15:00:12 1997 Jason Merrill - - * call.c (build_over_call): Only synthesize non-trivial copy ctors. - - * typeck.c (build_c_cast): Lose other reference to flag. - - * call.c (build_field_call): Don't look for [cd]tor_identifier. - * decl2.c (delete_sanity): Remove meaningless use of - LOOKUP_HAS_IN_CHARGE. - * decl.c (finish_function): Use build_scoped_method_call instead - of build_delete for running vbase dtors. - * init.c (build_delete): Call overload resolution code instead of - duplicating it badly. - -Thu Feb 20 15:12:15 1997 Jason Merrill - - * call.c (build_over_call): Call mark_used before trying to elide - the call. - - * decl.c (implicitly_declare): Don't set DECL_ARTIFICIAL. - -Wed Feb 19 11:18:53 1997 Brendan Kehoe - - * typeck.c (build_modify_expr): Always pedwarn for a cast to - non-reference used as an lvalue. - -Wed Feb 19 10:35:37 1997 Jason Merrill - - * cvt.c (cp_convert_to_pointer): Convert from 0 to a pmf properly. - -Tue Feb 18 15:40:57 1997 Jason Merrill - - * parse.y (handler): Fix template typo. - -Sun Feb 16 02:12:28 1997 Jason Merrill - - * error.c (lang_decl_name): New fn. - * tree.c (lang_printable_name): Use it. - -Fri Feb 14 16:57:05 1997 Mike Stump - - * g++spec.c: Include config.h so that we can catch bzero #defines - from the config file. - -Tue Feb 11 13:50:48 1997 Mike Stump - - * new1.cc: Include a declaration for malloc, to avoid warning, and - avoid lossing on systems that require one (ones that define malloc - in xm.h). - -Mon Feb 10 22:51:13 1997 Bruno Haible - - * decl2.c (max_tinst_depth): New variable. - (lang_decode_option): Parse "-ftemplate-depth-NN" command line - option. - * pt.c (max_tinst_depth): Variable moved. - * lang-options.h: Declare "-ftemplate-depth-NN" command line option - as legal. - -Fri Feb 7 15:43:34 1997 Jason Merrill - - * decl.c (xref_basetypes): Allow a base class that depends on - template parms to be incomplete. - - * decl2.c (build_expr_from_tree): Support typeid(type). - * rtti.c (get_typeid): Support templates. - (expand_si_desc, expand_class_desc): Fix string length. - (expand_ptr_desc, expand_attr_desc, expand_generic_desc): Likewise. - -Tue Feb 4 11:28:24 1997 Jason Merrill - - * pt.c (unify, case TEMPLATE_CONST_PARM): Use cp_tree_equal. - - * pt.c (tsubst): Put it back for -fno-ansi-overloading. - -Mon Feb 3 18:41:12 1997 Jason Merrill - - * pt.c (tsubst, case FUNCTION_DECL): Lose obsolete code that - smashes together template and non-template decls of the same - signature. - -Thu Jan 30 19:18:00 1997 Jason Merrill - - * pt.c (tsubst): Don't recurse for the type of a TYPENAME_TYPE. - -Wed Jan 29 11:40:35 1997 Brendan Kehoe - - * decl.c (duplicate_decls): Next route, pedwarn about different - exceptions if -pedantic *or* olddecl !DECL_IN_SYSTEM_HEADER. - -Tue Jan 28 20:43:29 1997 Brendan Kehoe - - * cp-tree.h (HAS_DEFAULT_IMPLEMENTATION): Delete macro. - (struct lang_type): Delete has_default_implementation member. - Increase dummy to 21. - * decl.c (start_method): Delete usage. - - * cp-tree.h (build_call, null_ptr_cst_p, in_function_p, - store_after_parms, start_decl_1, auto_function): Add decls. - (get_arglist_len_in_bytes, declare_implicit_exception, - have_exceptions_p, make_type_decl, typedecl_for_tag, - store_in_parms, pop_implicit_try_blocks, push_exception_cleanup, - build_component_type_expr, cplus_exception_name, - {make,clear}_anon_parm_name, dont_see_typename): Removed decls. - * call.c (build_this): Make static. - (is_complete): Likewise. - (implicit_conversion): Likewise. - (reference_binding): Likewise. - (standard_conversion): Likewise. - (strip_top_quals): Likewise. - (non_reference): Likewise. - (build_conv): Likewise. - (user_harshness): Likewise. - (rank_for_ideal): Likewise. - * decl.c (start_decl_1): Delete forward decl. - (push_decl_level): Make static. - (resume_binding_level): Make static. - (namespace_bindings_p): Make static. - (declare_namespace_level): Make static. - (lookup_name_real): Make static. - (duplicate_decls): Make static. Take register off NEWDECL and - OLDDECL parm decls. - * decl2.c (get_sentry): Make static. - (temp_name_p): Delete fn. - * except.c (auto_function): Delete decl. - * lex.c (handle_{cp,sysv}_pragma): Make static. - (handle_sysv_pragma) [HANDLE_SYSV_PRAGMA]: Add forward decl. - * method.c (do_build_{copy_constructor,assign_ref}): Make static. - * pt.c (tsubst_expr_values): Make static. - * rtti.c (combine_strings): Delete decl. - -Tue Jan 28 16:40:40 1997 Jason Merrill - - * pt.c (push_template_decl): Handle getting a typedef. - - * call.c (build_new_function_call): Complain about void arg. - -Tue Jan 28 15:25:09 1997 Brendan Kehoe - - * decl.c (duplicate_decls): Give pedwarn of different exceptions - if -pedantic, instead of olddecl !DECL_IN_SYSTEM_HEADER. - -Mon Jan 27 19:21:29 1997 Mike Stump - - * except.c (expand_throw): Don't expand the cleanup tree here, - since we are not going to write the rtl out. Fixes problem with - -g -O on SPARC. - -Mon Jan 27 16:24:35 1997 Sean McNeil - - * Make-lang.in: Add $(exeext) as necessary. - -Mon Jan 27 13:20:39 1997 Mike Stump - - * parse.y (handler_seq): Must have at least one catch clause. - -Sat Jan 25 12:00:05 1997 Jason Merrill - - * call.c (add_builtin_candidate): Restore ?: hack. - - * decl.c (grok_op_properties): More warnings. - -Sat Jan 25 08:50:03 1997 Brendan Kehoe - - * decl.c (duplicate_decls): On second thought, do it as a pedwarn - still but only if !DECL_IN_SYSTEM_HEADER (olddecl). - - * decl.c (duplicate_decls): Scale back to a warning, and only do - 'em if -pedantic. - -Fri Jan 24 17:52:54 1997 Mike Stump - - * decl.c (duplicate_decls): pedwarn mismatched exception - specifications. - -Thu Jan 23 18:18:54 1997 Mike Stump - - * call.c (build_new_method_call): Don't display the invisible - argument for controlling virtual bases. - -Thu Jan 23 16:48:10 1997 Mike Stump - - * new: Add nothrow new and delete, bad_alloc and throw specifications - for delete. - * decl.c (init_decl_processing): Add throw specification for delete. - * new.cc (nothrow): Define. - * lex.c (real_yylex): Removing warning that throw and friends are - keywords. - * new1.cc (operator new (size_t sz, const nothrow_t&)): Define. - * new2.cc (operator new[] (size_t sz, const nothrow_t&): Define. - * Make-lang.in: Add new{1,2}.{cc,o}. - -Thu Jan 23 16:39:06 1997 Jason Merrill - - * lex.c (cons_up_default_function): Fix return type of synth op=. - - * init.c (emit_base_init): Add warnings for uninitialized members - and bases. - - * decl.c (xref_basetypes): Add warning for non-polymorphic type - with destructor used as base type. - - * decl.c (grok_op_properties): Add warning for op= returning void. - * typeck.c (c_expand_return): Add warning for op= returning anything - other than *this. - - * class.c (finish_struct_1): Add warning for class with pointers - but not copy ctor or copy op=. - - * cp-tree.h (TI_PENDING_TEMPLATE_FLAG): New macro. - * pt.c (add_pending_template): Use it instead of LANG_FLAG_0. - (instantiate_template): If -fexternal-templates, add this - instantiation to pending_templates. - - * decl2.c (copy_assignment_arg_p): Disable old hack to support - Booch components. - -Tue Jan 21 18:32:04 1997 Mike Stump - - * cvt.c (cp_convert): pedwarn enum to pointer conversions. - -Mon Jan 20 17:59:51 1997 Jason Merrill - - * call.c (standard_conversion): Handle getting references. Tack - on RVALUE_CONV here. Do it for non-class types, too. - (reference_binding): Pass references to standard_conversion. - (implicit_conversion): Likewise. - (add_builtin_candidate): Disable one ?: kludge. - (convert_like): Handle RVALUE_CONVs for non-class types. - (joust): Disable the other ?: kludge. - -Mon Jan 20 14:53:13 1997 Brendan Kehoe - - * decl.c (init_decl_processing): Add code to build up common - function types beforehand, to avoid creation then removal of - things already in the hash table. - -Mon Jan 20 14:43:49 1997 Jason Merrill - - * decl.c (finish_function): Also zero out DECL_INCOMING_RTL for - the arguments. - - * error.c (dump_expr, TEMPLATE_CONST_PARM): Don't require - current_template_parms. - -Fri Jan 17 10:25:42 1997 Jason Merrill - - * search.c (lookup_field): Don't return a function, check want_type. - -Thu Jan 16 18:14:35 1997 Brendan Kehoe - - * init.c (build_new): Make sure PLACEMENT has a type. - -Thu Jan 16 17:40:28 1997 Jason Merrill - - * init.c (build_new): Support new (nothrow). - -Wed Jan 15 12:38:14 1997 Jason Merrill - - * pt.c (instantiate_decl): Also do push_to_top_level before setting - up DECL_INITIAL. - - * cp-tree.h (PARM_DEFAULT_FROM_TEMPLATE): New macro. - * pt.c (tsubst): Defer instantiation of default args. - * call.c (build_over_call): Until here. - -Wed Jan 15 10:08:10 1997 Brendan Kehoe - - * search.c (lookup_field): Make sure we have an - IDENTIFIER_CLASS_VALUE before we try to return it. - -Thu Jan 9 07:19:01 1997 Brendan Kehoe - - * call.c (build_method_call): Delete unused var PARM. - (build_overload_call_real): Likewise. - (build_object_call): Delete unused var P. - (build_new_op): Likewise. - * decl.c (builtin_type_tdescs_{arr, len, max}): #if 0 out static - var definitions, which are never used. - (shadow_tag): Delete unused var FN. - * expr.c (cplus_expand_expr): Delete unused var ORIGINAL_TARGET. - * init.c (build_new): Delete unused var ALLOC_TEMP. - * method.c (hack_identifier): Delete unused var CONTEXT. - (do_build_copy_constructor): Delete unused var NAME. - (synthesize_method): Delete unused var BASE. - * pt.c (lookup_template_class): Delete unused var CODE_TYPE_NODE. - * rtti.c (build_headof): Delete unused var VPTR. - (get_typeid): Delete unused var T. - * typeck.c (build_conditional_expr): Delete unused vars ORIG_OP1 - and ORIG_OP2. - (build_ptrmemfunc): Delete unused vars U and NINDEX. - * typeck2.c (build_functional_cast): Delete unused var BINFO. - -Wed Jan 8 13:09:54 1997 Jason Merrill - - * search.c (lookup_field): Use IDENTIFIER_CLASS_VALUE to look up - things in a type being defined. - * decl.c (finish_enum): Reverse the values so that they are in - the correct order. - - * pt.c (instantiate_class_template): Don't initialize - BINFO_BASETYPES until the vector is filled out. - (unify): Don't abort on conflicting bindings, just fail. - (instantiate_decl): Do push_tinst_level before any tsubsting. - - * method.c (build_overload_value): Handle getting a - TEMPLATE_CONST_PARM for a pointer. - -Tue Jan 7 14:00:58 1997 Jason Merrill - - * init.c (expand_member_init): Don't give 'not a base' error for - templates. - - * pt.c (instantiate_decl): Call import_export_decl later. - - * pt.c (instantiate_class_template): Return a value. - - * parse.y (extension): New rule for __extension__. - (extdef, unary_expr, decl, component_decl): Use it. - -Tue Jan 7 09:20:28 1997 Mike Stump - - * class.c (base_binfo): Remove unused base_has_virtual member. - (finish_base_struct): Likewise. - (finish_struct_1): Likewise. - -Tue Dec 31 20:25:50 1996 Mike Stump - - * search.c (expand_upcast_fixups): Fix bogus code generation - problem where the generated code uses the wrong index into the - runtime built vtable on the stack. Old code could clobber random - stack values. - -Tue Dec 31 15:16:56 1996 Mike Stump - - * init.c (perform_member_init): Make sure the partial EH cleanups - live on the function_obstack. - -Fri Dec 27 10:31:40 1996 Paul Eggert - - * Make-lang.in (g++spec.o): Don't use $< with an explicit target; - this isn't portable to some versions of `make' (e.g. Solaris 2.5.1). - -Tue Dec 24 10:24:03 1996 Jeffrey A Law - - * decl.c (grokvardecl): Avoid ANSI style initialization. - -Sun Dec 22 04:22:06 1996 Jason Merrill - - * pt.c (tsubst): Tweak arg types for a FUNCTION_TYPE. - -Fri Dec 20 17:09:25 1996 Jason Merrill - - * pt.c (instantiate_class_template): Call grok_{ctor,op}_properties. - -Fri Dec 20 12:17:12 1996 Brendan Kehoe - - * g++spec.c (lang_specific_driver): Put missing hyphen in front of - arguments we compare against. Start the count of I at 1, not 0, - since argv[0] is still the command. - -Thu Dec 19 11:53:57 1996 Stan Shebs - - * lang-specs.h: Accept .cp as an C++ extension. - -Mon Dec 16 22:43:31 1996 Brendan Kehoe - - * cp-tree.h (ptr_reasonably_similar): Add decl. - -Thu Dec 12 15:00:35 1996 Brendan Kehoe - - * decl.c (grokvardecl): Change SPECBITS parm to be the SPECBITS_IN - pointer. New local SPECBITS with the parm's value. - (grokdeclarator): Pass &specbits down. - - * parse.y (expr_no_commas): Make sure $$ is not an error_mark_node - before we try to do C_SET_EXP_ORIGINAL_CODE on it. - - * search.c (envelope_add_decl): Check that the CLASSTYPE_CID of - CONTEXT is not 0 before we try to use TYPE_DERIVES_FROM. - - * decl.c (cplus_expand_expr_stmt): Only expand the expr if EXP is - not an error_mark_node. - -Sat Dec 7 17:20:22 1996 Jason Merrill - - * cp-tree.h (TYPE_MAIN_DECL): Use TYPE_STUB_DECL. - * *.c: Use TYPE_MAIN_DECL instead of TYPE_NAME where appropriate. - -Fri Dec 6 14:40:09 1996 Jason Merrill - - * decl.c (grokdeclarator): When giving an anonymous struct a name, - replace TYPE_NAME instead of TYPE_IDENTIFIER (so TYPE_STUB_DECL is - not affected). - - * typeck2.c (build_m_component_ref): If component is a pointer - to data member, resolve the OFFSET_REF now. - - * call.c (convert_like): Don't go into infinite recursion. - - * pt.c (coerce_template_parms): Use tsubst_expr for non-type args. - - * class.c (finish_struct_1): Set DECL_ARTIFICIAL on the vptr. - * tree.c (layout_basetypes): And on the vbase ptr. - -Thu Dec 5 02:11:28 1996 Jason Merrill - - * decl.c (BOOL_TYPE_SIZE): Define in terms of POINTER_SIZE or - CHAR_TYPE_SIZE so bool is always the same size as another type. - - * decl.c (pushtag): Set DECL_IGNORED_P for DWARF, too. - -Tue Dec 3 23:18:37 1996 Jason Merrill - - * decl2.c (grok_x_components): Remove synthesized methods from - TYPE_METHODS of an anonymous union, complain about member - functions. - * decl.c (shadow_tag): Wipe out memory of synthesized methods in - anonymous unions. - (finish_function): Just clear the DECL_RTL of our arguments. - -Fri Nov 29 21:54:17 1996 Jason Merrill - - * decl2.c (finish_file): Emit DWARF debugging info for static data - members. - - * pt.c (tsubst): If t is a stub decl, return the stub decl for type. - -Wed Nov 27 14:47:15 1996 Bob Manson - - * typeck.c (build_component_ref): Don't die if COMPONENT isn't a - IDENTIFIER_NODE. - -Wed Nov 27 16:05:19 1996 Michael Meissner - - * Make-lang.in (g++-cross$(exeext)): Fix typo. - -Wed Nov 27 08:14:00 1996 Brendan Kehoe - - Make the g++ driver now be a standalone program, rather than one - that tries to run the gcc driver after munging up the options. - * Make-lang.in (g++.c, g++spec.o): New rules. - (g++.o): New rule, based on gcc.o with -DLANG_SPECIFIC_DRIVER - added. - (g++$(exeext)): New rule, based on xgcc rule. - (g++-cross$(exeext)): Now just copies g++$(exeext) over. - * g++spec.c: New file. - * g++.c: Removed file. - -Tue Nov 26 19:01:09 1996 Mike Stump - - * cvt.c (build_up_reference): Arrange for any temporary values - that have been keep in registers until now to be put into memory. - -Mon Nov 25 15:16:41 1996 Kaveh R. Ghazi - - * Make-lang.in (c++.stage[1234]): Depend upon stage[1-4]-start, so - that make -j3 bootstrap works better. - -Sun Nov 24 02:09:39 1996 Jason Merrill - - * decl.c (pushtag): Do pushdecl for anon tags. - -Thu Nov 21 16:30:24 1996 Jason Merrill - - * typeck.c (c_expand_return): Fix logic. - (unary_complex_lvalue): Avoid unused warning on address of INIT_EXPR. - -Wed Nov 20 18:47:31 1996 Bob Manson - - * g++.c (main): Make sure arglist has a final NULL entry. Add - PEXECUTE_LAST to the flags passed to pexecute, as otherwise - stdin/stdout of the invoked program are redirected to - nowheresville. - -Tue Nov 19 16:12:44 1996 Jason Merrill - - * decl.c (implicitly_declare): Set DECL_ARTIFICIAL. - -Tue Nov 19 15:48:19 1996 Mike Stump - - * init.c (resolve_offset_ref): Handle obj.vfn better. - * typeck.c (build_component_ref): Set TREE_TYPE on result from - build_vfn_ref. - -Tue Nov 19 13:14:33 1996 Mike Stump - - * typeck.c (convert_for_assignment): Also handle anachronistic - implicit conversions from (::*)() to cv void*. - * cvt.c (cp_convert_to_pointer): Likewise. - -Mon Nov 18 17:05:26 1996 Jason Merrill - - * lex.c (handle_cp_pragma): Fix bogus warning. - -Mon Nov 18 16:10:43 1996 Mike Stump - - * cvt.c (cp_convert_to_pointer): Avoid thinking a POINTER_TYPE - (METHOD_TYPE) is a TYPE_PTRMEMFUNC_P. - -Thu Nov 14 23:18:17 1996 Jason Merrill - - * class.c (finish_struct_1): Support DWARF2_DEBUG. - * search.c (dfs_debug_mark): Likewise. - * decl2.c (finish_vtable_vardecl): Likewise. - * decl.c (pushtag, finish_enum): Likewise. - * lex.c (check_newline): Use debug_* instead of calling *out - functions directly. - -Thu Nov 14 15:21:46 1996 Brendan Kehoe - - * Make-lang.in (cplib2.ready): Add else clause to avoid problems - on some picky hosts. - -Wed Nov 13 12:32:07 1996 Jason Merrill - - * class.c (finish_struct_1): A class has a non-trivial copy - constructor if it has virtual functions. - - * cvt.c (cp_convert): Always call a constructor. - - * call.c (reference_binding): Still tack on a REF_BIND - for bad conversions. - (build_user_type_conversion_1): Propagate ICS_BAD_FLAG. - - * typeck.c (convert_arguments): Pass LOOKUP_ONLYCONVERTING. - (c_expand_return): Likewise. - * typeck2.c (digest_init): Likewise for { }. - * init.c (expand_aggr_init_1): Keep the CONSTRUCTOR handling. - * cvt.c (cp_convert): Handle failure better. - -Wed Nov 13 11:51:20 1996 Brendan Kehoe - - * g++.c (main): Also set PEXECUTE_SEARCH, to make the invocation - of GCC be path-relative. - -Wed Nov 13 11:27:16 1996 Michael Meissner - - * Make-lang.in (g++-cross): G++-cross doesn't need version.o, but - it does need choose-temp.o and pexecute.o. - -Wed Nov 13 07:53:38 1996 Brendan Kehoe - - * g++.c (error) [!HAVE_VPRINTF]: Put error back for the only time - that we still use it. - (P_tmpdir, R_OK, W_OK, X_OK) [__MSDOS__]: Delete unnecessary macros. - -Wed Nov 13 02:00:26 1996 Jason Merrill - - * init.c (expand_default_init): Avoid calling constructors to - initialize reference temps. - - * cvt.c (convert_to_reference): Fix. - -Tue Nov 12 19:10:07 1996 Jason Merrill - - * cvt.c (cp_convert): Simplify for flag_ansi_overloading. - (convert_to_reference): Likewise. - * typeck.c (convert_for_initialization): Likewise. - * init.c (expand_default_init): Likewise. - (expand_aggr_init_1): Likewise. - * cp-tree.h (CONV_NONCONVERTING): Lose. - * typeck.c (build_c_cast): Lose allow_nonconverting parm. - * *.c: Adjust. - * call.c (build_user_type_conversion_1): Assume LOOKUP_ONLYCONVERTING. - -Tue Nov 12 16:29:04 1996 Brendan Kehoe - - * pt.c (tsubst_expr): Reverse args to expand_start_catch_block. - -Tue Nov 12 15:26:17 1996 Jason Merrill - - * init.c (expand_aggr_init_1): Don't crash on non-constructor - TARGET_EXPR. - -Tue Nov 12 14:00:50 1996 Brendan Kehoe - - * g++.c: Include gansidecl.h. - (VPROTO, PVPROTO, VA_START): Delete. - (choose_temp_base_try, choose_temp_base, perror_exec, - run_dos) [__MSDOS__]: Delete fns. - (pfatal_with_name): Delete fn. - (temp_filename): Declare like in gcc.c. - (pexecute, pwait, choose_temp_base): Declare from gcc.c. - (error_count, signal_count): Define. - (error): Delete both definitions. - (PEXECUTE_{FIRST,LAST,SEARCH,VERBOSE}): Define from gcc.c. - (pfatal_pexecute): Add fn from gcc.c. - (main): Rename local VERBOSE var to VERBOSE_FLAG. Rewrite the - code to use the pexecute stuff also used by gcc.c. - (MIN_FATAL_STATUS): Define. - * Make-lang.in (g++): Add dependency on and linking with - choose-temp.o and pexecute.o. - - * cp-tree.h: Include gansidecl.h. - (STDIO_PROTO): Delete #undef/#define. - * cvt.c (NULL): Delete #undef/#define. - * expr.c (NULL): Likewise. - * init.c (NULL): Likewise. - * rtti.c (NULL): Likewise. - * xref.c (NULL): Likewise. - - * cp-tree.h (build_user_type_conversion): Add prototype. - * call.c (build_user_type_conversion): Delete prototype. Correct - decl of FLAGS arg to be an int. - * cvt.c (build_user_type_conversion): Likewise. - -Tue Nov 12 12:16:20 1996 Jason Merrill - - * cp-tree.def: Add TRY_BLOCK and HANDLER. - * except.c (expand_start_catch_block): Support templates. - * parse.y (try_block, handler_seq): Likewise. - * pt.c (tsubst_expr): Support TRY_BLOCK and HANDLER. - -Mon Nov 11 13:57:31 1996 Jason Merrill - - * pt.c (current_template_args): New fn. - (push_template_decl): Use it. - * decl.c (grokdeclarator): Use it. - - * decl2.c (build_expr_from_tree): Dereference ref vars. - - * decl.c (grokdeclarator): Generalize handling of TYPENAME_TYPEs in - the decl-specifier-seq. - - * decl.c (grok_op_properties): Don't force the type of a conversion - op to be complete. Don't warn about converting to the same type - for template instantiations. - - * decl2.c (finish_file): Don't call instantiate_decl on synthesized - methods. - -Mon Nov 11 13:20:34 1996 Bob Manson - - * typeck.c (get_delta_difference): Remove previous bogusness. - Don't give errors if force is set. - -Fri Nov 8 17:38:44 1996 Jason Merrill - - * decl2.c (finish_file): Don't emit debug info. - * decl.c (pushdecl): Lose obsolete code. - (grokdeclarator): Still do the long long thing after complaining. - * search.c (note_debug_info_needed): Don't do anything if we're in a - template. - * method.c (synthesize_method): For non-local classes, - push_to_top_level first. - -Fri Nov 8 11:52:28 1996 Bob Manson - - * typeck.c (get_delta_difference): Add no_error parameter. - (build_ptrmemfunc): Call get_delta_difference with no_error set; - we don't want error messages when converting unrelated - pointer-to-member functions. - -Thu Nov 7 11:16:24 1996 Mike Stump - - * error.c (dump_expr): Improve the wording on error messages that - involve pointer to member functions. - -Tue Nov 5 17:12:05 1996 Mike Stump - - * cvt.c (cp_convert_to_pointer): Move code for conversions from - (::*)() to void* or (*)() up a bit, so that we can convert from - METHOD_TYPEs as well. - -Tue Nov 5 14:54:17 1996 Jason Merrill - - * rtti.c (get_tinfo_fn): Make sure 'type' is permanent. - There are no 'member' types. - (get_tinfo_fn_dynamic): Diagnose typeid of overloaded fn. - (build_x_typeid): Handle errors. - -Mon Nov 4 17:43:12 1996 Mike Stump - - * typeck.c (convert_for_assignment): Handle anachronistic implicit - conversions from (::*)() to void* or (*)(). - * cvt.c (cp_convert_to_pointer): Likewise. - (cp_convert_to_pointer_force): Remove cp_convert_to_pointer - conversions from here. - * decl2.c (lang_decode_option): Add -W{no-,}pmf-conversions. - * lang-options.h: Likewise. - * decl2.c (warn_pmf2ptr): Define. - * cp-tree.h: Declare it. - * typeck2.c (digest_init): Allow pmfs down into - convert_for_initialization. - -Sun Nov 3 09:43:00 1996 Jason Merrill - - * typeck.c (c_expand_return): Fix for returning overloaded fn. - -Fri Nov 1 08:53:17 1996 Jason Merrill - - * cp-tree.h (DIRECT_BIND): Change from INDIRECT_BIND. - * decl.c (grok_reference_init): Pass DIRECT_BIND. - * cvt.c (build_up_reference): Don't mark 'this' addressable. Use - DIRECT_BIND. - * call.c (convert_like): Don't pass INDIRECT_BIND. - * typeck.c (convert_arguments): Likewise. - * typeck.c (mark_addressable): Allow &this if flag_this_is_variable. - -Thu Oct 31 17:08:49 1996 Jason Merrill - - * typeck.c (mark_addressable): Support TARGET_EXPR, unify with - similar code in build_up_ref. - * cvt.c (build_up_reference): Drastically simplify. - -Mon Oct 28 12:45:05 1996 Jeffrey A Law - - * typeck.c (signed_or_unsigned_type): If the given type already - as the correct signedness, then just return it. - - * typeck.c ({un,}signed_type): If can't do anything, call - signed_or_unsigned_type. - -Thu Oct 24 14:21:59 1996 Bob Manson - - * decl2.c (copy_assignment_arg_p): Don't buy the farm if - current_class_type is NULL. - -Wed Oct 23 00:43:10 1996 Jason Merrill - - * class.c (finish_struct_1): Avoid empty structs by adding a field - so layout_type gets the mode right. - - * typeck.c (c_expand_return): Drastically simplify. - -Mon Oct 21 22:34:02 1996 Jason Merrill - - * typeck.c (decay_conversion): Handle overloaded methods. - -Fri Oct 18 16:03:48 1996 Jason Merrill - - * call.c (build_over_call): A TARGET_EXPR has side-effects. - -Thu Oct 17 11:31:59 1996 Mike Stump - - * cvt.c (convert_to_pointer_force): Add code to support pointer to - member function to pointer to function conversions. - * init.c (resolve_offset_ref): Add code to allow faked up objects, - ignoring them if they are not used, and giving an error, if they - are needed. - * typeck.c (get_member_function_from_ptrfunc): Fold e1 to improve - code, and so that we can give an error, if we needed an object, - and one was not provided. - (build_c_cast): Don't call default_conversion when we want to - convert to pointer to function from a METHOD_TYPE. - -Mon Oct 14 00:28:51 1996 Jason Merrill - - * Make-lang.in (cplib2.ready): Fix logic. - - * decl.c (shadow_tag): Only complain about non-artificial function - members. - - * class.c (finish_struct_1): Add synthesized methods to TYPE_METHODS. - -Fri Oct 11 16:12:40 1996 Jason Merrill - - * expr.c (cplus_expand_expr): Pre-tweak call_target like - expand_inline_function would. - - * pt.c (mark_decl_instantiated): If extern_p, call - mark_inline_for_output. - -Thu Oct 10 15:58:08 1996 Mike Stump - - * typeck.c (unary_complex_lvalue): Add code to handle intermediate - pmd conversions. - - * typeck.c (get_delta_difference): Fix wording, as we can be used - for pointer to data members. - -Tue Oct 8 12:43:51 1996 Bob Manson - - * pt.c (tsubst): If the function decl isn't a member of this - template, return a copy of the decl (including copying the - lang-specific part) so we don't hose ourselves later. - -Thu Oct 3 16:24:28 1996 Jason Merrill - - * class.c (finish_struct): Remove DWARF-specific tag handling. - * decl.c (pushtag): Likewise. - (finish_function): Always clear DECL_ARGUMENTS on function decls with - no saved RTX. - * decl2.c (finish_file): Emit DWARF debugging info for static data - members. - -Wed Oct 2 21:58:01 1996 Bob Manson - - * decl.c (duplicate_decls): Make sure the old DECL_LANG_SPECIFIC - isn't the same as the new one before we whack it. - -Mon Sep 30 13:38:24 1996 Jason Merrill - - * class.c, cp-tree.h, cvt.c, decl.c, decl2.c, gxx.gperf, hash.h, - lex.c, method.c, parse.y, typeck.c, typeck2.c: Remove - warn_traditional and warn_strict_prototypes; remove ancient - 'overload' code; remove references to flag_traditional. - -Mon Sep 30 12:58:40 1996 Mike Stump - - * input.c (sub_getch): Handle 8-bit characters in string literals. - -Sun Sep 29 03:12:01 1996 Jason Merrill - - * tree.c (mapcar): Handle CONSTRUCTORs. - (copy_to_permanent): Handle expression_obstack properly. - - * Make-lang.in (cplib2.txt): Also depend on the headers. - - * rtti.c (get_tinfo_var): Don't assume that POINTER_SIZE == - INT_TYPE_SIZE. - (expand_class_desc): Use USItype for offset field. - * tinfo.h (struct __class_type_info): Likewise. - - * method.c (build_overload_int): TYPE_PRECISION should be applied - to types. - -Sat Sep 28 14:44:50 1996 Jason Merrill - - * call.c (build_new_op): A COND_EXPR involving void must be a - builtin. - -Fri Sep 27 16:40:30 1996 Jason Merrill - - * typeck.c (build_x_component_ref): New fn. - (build_object_ref): Use it. - * parse.y (primary): Use it. - * decl2.c (build_expr_from_tree): Use it. - * cp-tree.h: Declare it. - - * decl.c (start_decl): Variable-sized arrays cannot be initialized. - * error.c (dump_type_suffix): Handle variable arrays. - -Fri Sep 27 13:14:05 1996 Brendan Kehoe - - * Make-lang.in (exception.o): Put back compiling it with -fPIC. - -Fri Sep 27 03:00:09 1996 Jason Merrill - - * decl.c (lookup_name_real): Don't try to look up anything in a - TYPENAME_TYPE. - - * tinfo2.cc (__throw_type_match_rtti): Oops. - -Thu Sep 26 22:11:05 1996 Brendan Kehoe - - * Make-lang.in (exception.o): Use -fno-PIC for now. - -Thu Sep 26 10:59:00 1996 Jason Merrill - - * rtti.c (build_dynamic_cast): Pass tinfo fns rather than - calling them. - (get_tinfo_fn_dynamic): Extracted from build_typeid. - * tinfo2.cc (__dynamic_cast): Adjust. - - * rtti.c (build_typeid): Use resolves_to_fixed_type_p. - (build_x_typeid): Likewise. - - * parse.y: Call build_x_typeid instead of build_typeid. - * cp-tree.def: Add TYPEID_EXPR. - * pt.c (tsubst_copy): Handle typeid. - * decl2.c (build_expr_from_tree): Likewise. - * rtti.c (build_x_typeid): Throw bad_typeid from here. - (build_typeid): Not here. - * cp-tree.h: Declare build_x_typeid. - -Wed Sep 25 17:26:16 1996 Jason Merrill - - * call.c (convert_like): Pull out constant values. - - * tree.c (mapcar): Use build_cplus_array_type, not build_array_type. - -Wed Sep 25 17:28:53 1996 Michael Meissner - - * decl.c (init_decl_processing): Create short int types before - creating size_t in case a machine description needs to use - unsigned short for size_t. - -Tue Sep 24 18:18:44 1996 Jason Merrill - - * Make-lang.in (exception.o): Turn off pic. - - * tinfo2.cc (__throw_type_match_rtti): Fix cv-variants of the same - type, multi-level ptr conversions. - - * rtti.c (call_void_fn): Renamed and genericized from throw_bad_cast. - (throw_bad_cast): Use it. - (throw_bad_typeid): New fn. - (build_typeid): Throw bad_typeid as needed. - Use build_call. - (synthesize_tinfo_fn): Handle functions and arrays before checking - for cv-quals. - - * Remove .h from standard C++ headers, add new.h, move into inc - subdirectory. - - * exception*: Remove pointer from object, constructors. Add - default exception::what that uses type_info::name. Add - __throw_bad_typeid. - - * init.c (build_new): Don't add a cookie to new (void *) T[2]. - -Mon Sep 23 15:21:53 1996 Jason Merrill - - * Make-lang.in: Building C++ code depends on cc1plus. - -Mon Sep 23 12:38:40 1996 Brendan Kehoe - - * decl.c (struct saved_scope): Declare PROCESSING_TEMPLATE_DECL as - a HOST_WIDE_INT, not a tree. - -Mon Sep 23 12:36:02 1996 Jason Merrill - - * exception.cc: Don't include . - - * Make-lang.in (c++.clean): Remove cplib2.*. - -Mon Sep 23 09:42:19 1996 Doug Evans - - * parse.y (component_decl_1, component_costructor_declarator case): - Pass attributes/prefix_attributes in tree list. - -Mon Sep 23 01:18:50 1996 Jason Merrill - - * tinfo{,2}.cc: #include instead of . - -Sun Sep 22 05:31:22 1996 Jason Merrill - - * lex.c (do_identifier): Don't do deferred lookup in a template - header. - - * typeck2.c (store_init_value): Oops. - - * new.{h,cc}, exception.{h,cc}, typeinfo.h, tinfo{2.cc,.cc,.h}: - New files for C++ lang-support library. - * Make-lang.in (CXX_EXTRA_HEADERS): Define. - (CXX_LIB2FUNCS): Define. - And rules for building the C++ lang-support code. - * config-lang.in (headers): Define. - (lib2funcs): Define. - -Sat Sep 21 19:17:28 1996 Jason Merrill - - * decl2.c (build_expr_from_tree): If CONSTRUCTOR has a type, call - digest_init. - * pt.c (tsubst_copy): Compute type for CONSTRUCTOR. - * typeck2.c (store_init_value): Check for initializing pmf with { } - here. - (process_init_constructor): Not here. - -Thu Sep 19 16:41:07 1996 Jason Merrill - - * pt.c (begin_template_parm_list): Increment - processing_template_decl here. - (end_template_parm_list): Not here. - (process_template_parm): No need to add 1 to it now. - * *.c: Use processing_template_decl instead of current_template_parms - to check for being in a template. - - * pt.c (uses_template_parms): Handle SCOPE_REF. Fix CONSTRUCTOR. - (tsubst_copy): Handle CONSTRUCTOR. - (instantiate_decl): Set up context properly for variables. - * decl2.c (build_expr_from_tree): Handle CONSTRUCTOR. - * class.c (finish_struct): Reverse CLASSTYPE_TAGS. - -Wed Sep 18 13:30:20 1996 Brendan Kehoe - - * lex.c (enum tree_node_kind) [GATHER_STATISTICS]: Put the enum back. - -Wed Sep 18 04:24:07 1996 Jason Merrill - - * method.c (make_thunk): Call comdat_linkage before setting the - TREE_CODE. - - * decl2.c (comdat_linkage): Use make_decl_one_only. - (import_export_decl): Likewise. - * decl.c (init_decl_processing): Check supports_one_only instead of - SUPPORTS_WEAK. - -Sat Sep 14 08:34:41 1996 Jason Merrill - - * decl2.c (grokfield): Tighten checking for access decls. - - * decl.c (make_typename_type): Resolve references to - current_class_type. Set CLASSTYPE_GOT_SEMICOLON. - (lookup_name_real): Types that depend on a template parameter get - an implicit 'typename' unless they're in the current scope. - (start_decl_1): We don't care about incomplete types that depend - on a template parm. - (grokdeclarator): Resolve 'typename's in the type specifier that - refer to members of the current scope. - - * call.c (build_over_call): Remove 'inline called before - definition' diagnostic. - (build_method_call): Likewise. - * decl.c (duplicate_decls): Downgrade 'used before declared - inline' to a warning, only with -Winline. - -Fri Sep 13 17:31:40 1996 Stan Shebs - - * mpw-make.sed: Fix include paths, add @DASH_C_FLAG@ to compile. - -Wed Sep 11 22:38:13 1996 Gerald Baumgartner - - * call.c (build_method_call): When calling a signature - default implementation, as in other cases, let instance_ptr simply - be instance. - -Wed Sep 11 22:14:44 1996 Mike Stump - - * parse.y (simple_stmt): Cleanup and use do_poplevel (). - -Wed Sep 11 22:10:48 1996 Mike Stump - - * except.c (expand_start_catch_block): Add a pushlevel so that -g - works on hppa and SPARC. - -Wed Sep 11 10:18:06 1996 Brendan Kehoe - - * typeck.c (build_indirect_ref): Catch PTR being an error_mark_node. - -Mon Sep 9 19:51:14 1996 Gerald Baumgartner - - * call.c (build_over_call): Check first whether DECL_CONTEXT exists - before testing whether it's a signature. - -Sun Sep 8 16:06:57 1996 Gerald Baumgartner - - * call.c (build_new_method_call): Don't complain about signature - pointers and references not being an aggr type. - (build_this): If a signature pointer or reference was passed in, - just return it. - (build_new_method_call): If instance is a signature pointer, set - basetype to the signature type of instance. - * sig.c (build_signature_method_call): Deleted basetype and - instance parameters, they can be found as the DECL_CONTEXT of - function and as the first argument passed in. - * cp-tree.h: Changed declaration of build_signature_method_call. - * call.c (build_method_call): Deleted first two arguments in call - of build_signature_method_call. - (build_over_call): Added call to build_signature_method_call. - -Thu Sep 5 16:51:28 1996 Jason Merrill - - * typeck.c (build_c_cast): Don't tack a non_lvalue_expr onto a - target_expr. - -Thu Sep 5 10:05:38 1996 Brendan Kehoe - - * cvt.c (convert_to_reference): Use %#T, not %#D, for error. - -Wed Sep 4 17:16:09 1996 Bob Manson - - * except.c (expand_start_try_stmts): Move to except.c in the backend. - (expand_end_try_stmts): Remove. - - * init.c (perform_member_init): Use add_partial_entry () instead - of directly manipulating lists. - (emit_base_init): Likewise. - -Wed Sep 4 12:14:36 1996 Mike Stump - - * except.c (expand_exception_blocks): Always make sure USE and - CLOBBER insns that came at the end still do, the backend relies - upon this. - -Wed Sep 4 07:44:48 1996 Jason Merrill - - * call.c (build_over_call): We can only use a TARGET_EXPR of the - right type. - -Tue Sep 3 19:26:05 1996 Jason Merrill - - * cvt.c (convert_to_reference): Revert last change, don't complain - about temp without target decl. - -Tue Sep 3 10:22:56 1996 Mike Stump - - * decl.c (grokdeclarator): Don't core dump when void() is given. - -Tue Sep 3 02:38:56 1996 Jason Merrill - - * decl.c (copy_args_p): Don't crash. - -Fri Aug 30 14:26:57 1996 Mike Stump - - * pt.c (tsubst): And support template args inside the exception - specification. - - * pt.c (tsubst): Add support for exception specifications in - template functions. - -Fri Aug 30 10:01:55 1996 Mike Stump - - * cp-tree.def (DECL_STMT): Eliminate the throw spec field, only 3 - fields now. - * cp-tree.h (start_decl): Eliminate the throw spec parameter. - (start_function): Likewise. - (start_method): Likewise. - (grokfield): Likewise. - (make_call_declarator): Add throw spec parameter. - (set_quals_and_spec): Add routine. - * lex.c (set_quals_and_spec): Likewise. - * decl.h (grokdeclarator): Eliminate the throw spec parameter. - * decl.c (shadow_tag): Eliminate the throw spec parameter to - grokdeclarator. - (groktypename): Likewise. - (start_decl): Eliminate the throw spec parameter. Eliminate the - throw spec parameter to grokdeclarator. Eliminate the throw spec - field in DECL_STMT. - (cp_finish_decl): Eliminate the throw spec field in DECL_STMT. - (grokfndecl): Remove useless set of raises. - (grokdeclarator): Eliminate the throw spec parameter. Eliminate - the throw spec parameter to start_decl. Pull the throw spec out - of the call declarator. - (grokparms): Eliminate the throw spec parameter to grokdeclarator. - (start_function): Eliminate the throw spec parameter. Eliminate - the throw spec parameter to grokdeclarator. - (start_method): Likewise. - * decl2.c (grokfield): Likewise. - (grokbitfield): Eliminate the throw spec parameter to grokdeclarator. - (grokoptypename): Likewise. - (finish_file): Eliminate the throw spec parameter to - start_function. Add throw spec to make_call_declarator. - * except.c (init_exception_processing): Add throw spec to - make_call_declarator. Eliminate the throw spec parameter to - start_decl. - (expand_start_catch_block): Eliminate the throw spec parameter to - grokdeclarator. - (expand_builtin_throw): Add throw spec to make_call_declarator. - Eliminate the throw spec parameter to start_function. - (start_anon_func): Likewise. - * lex.c (make_call_declarator): Add throw spec parameter. - (set_quals_and_spec): New routine. - (cons_up_default_function): Add throw spec to make_call_declarator. - Eliminate the throw spec parameter to grokfield. - * method.c (synthesize_method): Eliminate the throw spec parameter - to start_function. - * pt.c (process_template_parm): Eliminate the throw spec parameter - to grokdeclarator. - (tsubst): Add throw spec to make_call_declarator. - (tsubst_expr): Eliminate the throw spec parameter to start_decl. - (do_function_instantiation): Eliminate the throw spec parameter to - grokdeclarator. Eliminate the throw spec parameter to - start_function. - * rtti.c (synthesize_tinfo_fn): Eliminate the throw spec parameter - to start_function. - * parse.y (datadef): Remove non-winning optimization. - (decl): Likewise. - (fndef): Remove ambiguous error productions uncovered by grammar - fixing. - (constructor_declarator): Add exception_specification_opt here. - (component_constructor_declarator): Likewise. - (direct_after_type_declarator): Likewise. - (complex_direct_notype_declarator): Likewise. - (direct_abstract_declarator): Likewise. - (fn.def1): Remove exception_specification_opt. - (fn.def2): Likewise. - (condition): Likewise. - (initdcl0): Likewise. - (initdcl): Likewise. - (notype_initdcl0): Likewise. - (nomods_initdcl0): Likewise. - (component_decl_1): Likewise. - (component_declarator): Likewise. - (after_type_component_declarator0): Likewise. - (after_type_component_declarator): Likewise. - (notype_component_declarator): Likewise. - -Wed Aug 28 01:40:30 1996 Jason Merrill - - * call.c (build_over_call): Also use an INIT_EXPR when - initializing anything from an rvalue. - - * call.c (build_over_call): Call stabilize_reference when building - an INIT_EXPR instead of calling the copy ctor. - - * call.c (joust): Extend the previous change to all comparisons. - - * decl2.c, method.c, lex.c: Use MAKE_DECL_ONE_ONLY and - NO_LINKAGE_HEURISTICS. - - * decl2.c (finish_file): Emit any statics that weren't already. - - * typeck.c (build_static_cast): Implement. - * tree.c (build_cplus_new): Handle getting a TARGET_EXPR. - * decl.c (grokparms): Use can_convert_arg instead of - implicit_conversion directly. - (copy_args_p): New fn. - * cvt.c (convert_to_reference): Don't complain about temp with - static_cast. - (build_up_reference): Handle TARGET_EXPRs. - * call.c (build_over_call): Elide unnecessary temps. - (can_convert*): Use new overloading code. - -Tue Aug 27 13:12:21 1996 Jason Merrill - - * call.c: Move TYPE_PTR*_MACROS ... - * cp-tree.h: To here. - * typeck.c (build_reinterpret_cast): Implement. - - * call.c (add_builtin_candidate): Use TYPE_PTROB_P instead of - ptr_complete_ob. - (joust): If we're comparing a function to a builtin and the worst - conversion for the builtin is worse than the worst conversion for the - function, take the function. - - * typeck.c (build_const_cast): Implement. - (comp_ptr_ttypes_const): Like comp_ptr_ttypes, for const_cast. - (comp_ptr_ttypes_reinterpret): Like cpt, for reinterpret_cast. - -Tue Aug 27 13:14:58 1996 Bob Manson - - * rtti.c (build_dynamic_cast): Don't try to dereference exprtype - too early. Make sure we explode if exprtype turns out to be a - NULL_TREE when it shouldn't be. - -Tue Aug 27 10:56:21 1996 Mike Stump - - * cp-tree.h: New routine make_call_declarator. - * lex.c (make_call_declarator): Define it. - * except.c (init_exception_processing): Use it. - (expand_builtin_throw): Likewise. - (start_anon_func): Likewise. - * decl2.c (finish_file): Likewise. - * lex.c (cons_up_default_function): Likewise. - * parse.y: Likewise. - * pt.c (tsubst): Likewise. - -Mon Aug 26 17:40:03 1996 Mike Stump - - * decl2.c (groktypefield): Remove unused code. - -Mon Aug 26 17:00:33 1996 Mike Stump - - * gxx.gperf: Change TYPE_QUAL into CV_QUALIFIER. - * parse.y: Likewise. Change maybe_type_qual into maybe_cv_qualifier. - Change type_quals into cv_qualifiers. Change nonempty_type_quals into - nonempty_cv_qualifiers. - * hash.h: Rebuild. - - * lex.c (make_pointer_declarator): Change type_quals into - cv_qualifiers. - (make_reference_declarator): Likewise. - -Thu Aug 22 01:09:22 1996 Jason Merrill - - * decl.c (start_function): Only check interface_* for templates - with flag_alt_external_templates. - - * call.c (build_new_op): Check for comparison of different enum types. - (build_over_call): Fix arg # output. - - * typeck.c (build_component_ref): Handle pre-found TYPE_DECL. - -Wed Aug 21 00:13:15 1996 Jason Merrill - - * call.c (build_new_op): Check for erroneous args. - - * call.c (build_new_method_call): Add missing args to cp_error. - - * tree.c (error_type): Don't print reference-to-array. - - * typeck.c (convert_for_assignment): Don't say contravariance for - removing const. - -Tue Aug 20 13:23:00 1996 Jason Merrill - - * call.c (build_over_call): Diagnose bad convs for `this'. - - * lex.c (cons_up_default_function): Set DECL_ARTIFICIAL - on _ctor_arg. - - * call.c (convert_like): Handle bad convs. - (build_over_call): Handle bad convs better. - - * decl2.c: -fansi-overloading is now the default. - - * call.c (build_new_method_call): Check for erroneous args. - - * pt.c (instantiate_class_template): Propagate - TYPE_USES_MULTIPLE_INHERITANCE. - -Tue Aug 20 13:09:57 1996 Mike Stump - - * call.c (enforce_access): Add static to routine. - -Sun Aug 18 14:35:54 1996 Jason Merrill - - * call.c (build_user_type_conversion_1): Fix bad handling. - (compare_ics): Likewise. - -Sat Aug 17 21:54:11 1996 Jason Merrill - - * call.c (standard_conversion): Oops. - -Sat Aug 17 16:28:11 1996 Geoffrey Noer - - * g++.c: Update test for win32 (&& ! cygwin32). - -Sat Aug 17 03:45:31 1996 Jason Merrill - - * typeck.c (comp_ptr_ttypes_real): Handle OFFSET_TYPEs properly. - (ptr_reasonably_similar): New fn. - * call.c (BAD_RANK): New rank. - (ICS_BAD_FLAG): New macro. - (standard_conversion): Handle almost-right pointer conversions. - (reference_binding): Handle bad rvalue bindings. - (add_*_candidate): Stuff. - (build_over_call): Pass bad conversions to convert_for_initialization. - (compare_ics): Handle bad convs. - (joust): Likewise. - -Fri Aug 16 15:02:19 1996 Bob Manson - - * init.c (expand_vec_init): Use ptrdiff_type_node instead of - integer_type_node when computing pointer offsets. - -Fri Aug 16 01:28:32 1996 Jason Merrill - - * tree.c (lvalue_type): New fn. - (error_type): New fn. - * call.c (op_error): Use error_type. - (add_conv_candidate): Use lvalue_type. - (add_builtin_candidates): Likewise. - * error.c (args_as_string): Use error_type. - -Thu Aug 15 17:27:13 1996 Jason Merrill - - * pt.c (instantiate_decl): Evaluate DECL_INITIAL of a VAR_DECL here. - (tsubst): Not here. - - * decl.c (init_decl_processing): With -ansi, __null's type is the - signed integral type with the same number of bits as a pointer. - Introduce a new variable null_node for it. - * cp-tree.h: Adjust. - * call.c (null_ptr_cst_p): Adjust. - -Thu Aug 15 17:09:54 1996 Mike Stump - - * except.c (do_unwind): Mark %i7 as used on the SPARC so we can - optimize. - -Thu Aug 15 01:36:49 1996 Jason Merrill - - * decl2.c (import_export_decl): Ignore #pragma interface for tinfo - fns of classes without virtual functions. - - * call.c (add_function_candidate): Handle `this' specially. - (compare_ics): Likewise. - -Tue Aug 13 12:16:10 1996 Jason Merrill - - * typeck.c (build_conditional_expr): Fix handling of __null. - - * decl2.c (comdat_linkage): New fn. - (import_export_vtable): Use it. - (import_export_decl): Use it. - * method.c (make_thunk): Use it. - -Mon Aug 12 00:09:18 1996 Jason Merrill - - * pt.c (end_template_decl): If we don't actually have parms, return. - * parse.y (template_header): Accept 'template <>'. - - * errfn.c: Allow 5 args. - -Sun Aug 11 15:20:58 1996 Jason Merrill - - * tree.c (make_temp_vec): New fn. - * pt.c (push_template_decl): Handle partial specs. - (instantiate_class_template): Likewise. - (more_specialized): Use get_bindings. - (more_specialized_class): New fn. - (get_class_bindings): New fn. - (most_specialized_class): New fn. - (do_function_instantiation): List candidates for ambiguous case. - * decl.c (duplicate_decls): Lose reference to DECL_TEMPLATE_MEMBERS. - (shadow_tag): Call push_template_decl for partial specializations. - * parse.y: Likewise. - * cp-tree.h (DECL_TEMPLATE_SPECIALIZATIONS): Replaces - DECL_TEMPLATE_MEMBERS. - * call.c (print_z_candidates): Reduce duplication. - -Fri Aug 9 14:36:08 1996 Jason Merrill - - * decl2.c (lang_decode_option): Allow -fansi-overloading. - -Thu Aug 8 17:04:18 1996 Jason Merrill - - * pt.c (get_bindings): New fn. - (most_specialized): Likewise. - (do_function_instantiation): Use them. - (add_maybe_template): New fn. - * cp-tree.h (DECL_MAYBE_TEMPLATE): New macro. - * call.c (build_new_op): Handle guiding decls. - (build_new_function_call): Likewise. - * decl2.c (finish_file): Likewise. - - * decl2.c (mark_used): Do synthesis here. - * call.c (build_method_call): Not here. - (build_over_call): Or here. - * typeck.c (build_function_call_real): Or here. - * tree.c (bot_manip): Call mark_used on functions used in default - args. - -Thu Aug 8 17:48:16 1996 Michael Meissner - - * decl2.c (import_export_vtable): Delete code that disabled vtable - heuristic on systems with ASM_OUTPUT_EXTERNAL. - -Wed Aug 7 12:44:11 1996 Jason Merrill - - * typeck.c (build_x_function_call): Handle static call context - better. - - * decl.c (finish_function): Set the DECL_CONTEXT of the result to - the function, not its outer block. - - * call.c (build_field_call): Pass fields on to build_opfncall - regardless of TYPE_OVERLOADS_CALL_EXPR. - (build_method_call): Pass on to build_new_method_call sooner. - - * typeck.c (build_ptrmemfunc): Just return what instantiate_type - gives us. - * class.c (instantiate_type): Don't put a POINTER_TYPE to - METHOD_TYPE on an expression. Also make a copy of rhs instead of - modifying it. - -Tue Aug 6 12:58:46 1996 Jason Merrill - - * call.c (compare_ics): Handle qual_conv after lvalue_conv. - (add_builtin_candidate): Don't take enums for ++. - (build_new_method_call): Handle non-aggregates and field calls. - Move new overloading code from... - * cvt.c: Here. - - * decl.c (grokparms): Don't check default args in templates. - -Mon Aug 5 17:17:06 1996 Jason Merrill - - * cvt.c (build_new_op): Fix args to build_unary_op. - (add_builtin_candidates): Don't call type_promotes_to on float. - - * decl.c (grokparms): Check the type of the default arg. - - * cvt.c (build_new_op): Pass non-overloaded cases on rather than - returning NULL_TREE. - - * typeck.c (build_x_binary_op): Avoid doing extra work. - (build_x_unary_op): Likewise. - (build_x_conditional_expr): Likewise. - * cvt.c (build_over_call): Return. - (add_builtin_candidate): Fix MEMBER_REF. - (build_new_op): Likewise. - -Mon Aug 5 17:07:47 1996 Mike Stump - - * method.c (build_overload_name): Put bug fix into code but leave - disabled for now so we can be bug compatible with older releases - that do repeats incorrectly. In the future, we can enable it. - -Mon Aug 5 13:46:28 1996 Jason Merrill - - * cvt.c (convert_like): Don't call build_cplus_new twice. - - * call.c, cp-tree.h, cvt.c, decl2.c, init.c, method.c, pt.c, typeck.c: - Control new overloading code with -fansi-overloading. - -Sun Aug 4 15:29:11 1996 Jason Merrill - - * cvt.c (build_over_call): Call build_cplus_new. - * call.c (build_method_call): Likewise. - * typeck.c (build_function_call_real): Likewise. - (build_conditional_expr): If both operands are TARGET_EXPRs, wrap - the COND_EXPR in a TARGET_EXPR so they use the same slot. - - * cvt.c (build_up_reference): Propagate INDIRECT_BIND to - recursive calls. - * typeck.c (complete_type): Propagate - TYPE_NEEDS_{CONSTRUCTING,DESTRUCTOR}. - -Sat Aug 3 14:05:07 1996 Jason Merrill - - * cvt.c (joust): More ?: kludging. Sigh. - (build_over_call): Don't try to synthesize global fns. - - * search.c (lookup_conversions): Use binfo marking. - -Sat Aug 3 12:33:42 1996 Bob Manson - - * search.c (build_mi_matrix): Use the correct value of cid - when determining the new mi_size. - -Sat Aug 3 01:27:41 1996 Jason Merrill - - * cvt.c (add_builtin_candidates): Do consider type conversion ops - for the first parms of += et al. - (strip_top_quals): New fn. - (reference_binding): Use it instead of TYPE_MAIN_VARIANT. - (implicit_conversion): Likewise. - (add_builtin_candidates): Be careful about arrays. - (build_new_method_call): Handle vtable optimization. - -Fri Aug 2 01:26:59 1996 Jason Merrill - - * cp-tree.h (LOOKUP_NO_TEMP_BIND): New flag. - * cvt.c (reference_binding): Use it. - (implicit_conversion): Use it. - (add_builtin_candidate, COND_EXPR): Use it. - - * cvt.c (build_new_function_call): Check for error args. - - * typeck.c (comptypes): Just check DERIVED_FROM_P, not UNIQUELY. - - * gxx.gperf: Add __null. - * hash.h: Regenerate. - * lex.h: Add RID_NULL. - * lex.c (init_lex): Create null_pointer_node here, stick it in - RID_NULL. - * decl.c (init_decl_processing): Still set its type here. - * cvt.c (cp_convert_to_pointer): Don't produce null_pointer_node. - (convert_to_pointer_force): Likewise. - (null_ptr_cst_p): Check for null_pointer_node; only accept (void*)0 - if (! pedantic). - * call.c (convert_harshness): Use null_ptr_cst_p. - * typeck.c (convert_for_assignment): Likewise. Don't produce - null_pointer_node. - - * error.c (args_as_string): Handle lists of actual args, too. - * cvt.c (null_ptr_cst): Support (void*)0 for now. - (build_user_type_conversion_1): Improve diagnostics. - (build_new_function_call): Likewise. - (build_object_call): Likewise. - (build_new_method_call): Likewise. Move call before def diagnostic... - (build_over_call): Here. - - * cvt.c (build_new_method_call): Don't complain about no match if - LOOKUP_SPECULATIVELY. - (build_over_call): Fix 'this' for virtual fn. - (build_new_method_call): Add diagnostic. - -Thu Aug 1 16:45:09 1996 Jason Merrill - - * cvt.c (add_function_candidate): Expect 'this' and 'in_chrg' for - constructors to be passed in. - (build_over_call): Likewise. - (build_user_type_conversion_1): Pass them in. - (convert_like): Likewise. - (build_object_call): Handle overloaded conversions. - (build_over_call): Pass the right args to build_vfn_ref. - (standard_conversion): Fix pmf convs. - (joust): Handle comparing statics and non-statics. - (build_new_method_call): New fn. - * call.c (build_method_call): Call it if NEW_OVER. - -Thu Aug 1 16:06:14 1996 Mike Stump - - * lex.c (do_identifier): Don't use %O on IDENTIFIER_OPNAME_Ps, use - %D instead. - -Thu Aug 1 15:24:02 1996 Mike Stump - - * except.c (expand_throw): Use maybe_build_cleanup_and_delete - instead of just maybe_build_cleanup so that we deallocate the - thrown object. - -Thu Aug 1 15:18:00 1996 Brendan Kehoe - - * decl2.c (finish_prevtable_vardecl): Make non-static for pt.c's use. - * cp-tree.h (finish_prevtable_vardecl): Add decl. - -Thu Aug 1 11:53:51 1996 Bob Manson - - * pt.c (instantiate_class_template): Call complete_type. Also, if - we're at the end of the file and we just instantiated a template - class with a vtable, call finish_prevtable_vardecl. - - * error.c (dump_decl): Don't explode (or explode more gracefully - as appropriate) if the object being dumped has a null type. - (dump_expr): Likewise. - - * search.c (build_mi_matrix): Ensure that mi_size is large enough, - by counting the number of nodes that we'll need before allocating - the array. - (lookup_fnfields): Fix comment. - (breadth_first_search): Fix comment. - -Wed Jul 31 09:57:05 1996 Jason Merrill - - * pt.c (instantiate_class_template): Propagate TYPE_PACKED and - TYPE_ALIGN. - * class.c (finish_struct): Call cplus_decl_attributes here. - (finish_struct_1): Not here. - * cp-tree.h: Adjust. - - * pt.c (type_unification): New parameter STRICT. - (unify): If STRICT, don't allow cv addition or base deduction. - * call.c, class.c, cvt.c, cp-tree.h: Adjust. - -Tue Jul 30 13:06:13 1996 Jason Merrill - - * search.c (get_template_base{_recursive}): New fns. - * pt.c (more_specialized): New fn. - (do_function_instantiation): Use it. - (unify): Handle base deduction. - * cvt.c (joust): Use more_specialized. - Don't arbitrarily choose between non-builtin candidates. - (build_over_call): Call require_complete_type. - - * decl.c (start_function): Statics are static even in a #pragma - interface file. - - * decl2.c (import_export_vtable): Disable vtable heuristic on - systems with ASM_OUTPUT_EXTERNAL. - - * cvt.c (compare_ics): Fix comparison of PMEM_CONV and BASE_CONV. - (standard_conversion): No std conv to enum type. - - * cvt.c (standard_conversion): Fix order of args to DERIVED_FROM_P - for ptm's. - - * cvt.c (reference_binding): Bind directly to a base subobject of - a class rvalue. - - * cvt.c (build_new_op): Enforce access control. - -Tue Jul 30 09:22:53 1996 Bob Manson - - * typeck2.c (process_init_constructor): When scanning the - union for a named field, skip things that aren't FIELD_DECLs. - - * method.c (synthesize_method): Don't scan fndecl's rtl if - we're at the end of the file; just assume the function can't - be inlined. - -Mon Jul 29 15:48:30 1996 Jason Merrill - - * cvt.c (build_builtin_candidate): Stick a dummy conversion in if - it failed. - - * cvt.c (build_user_type_conversion_1): Handle overloaded - conversion ops. - - * cvt.c (add_builtin_candidates): Don't consider type conversion - operators for the first parameter of operator=. - -Mon Jul 29 15:33:55 1996 Bob Manson - - * typeck.c (complete_type): Only call layout_type if we're not - expanding a template. - -Mon Jul 29 14:40:38 1996 Jason Merrill - - * cvt.c (compare_ics): Oops. - - * cvt.c (op_error): Oops. - - * cp-tree.def: Add RVALUE_CONV, rename EXACT_CONV to IDENTITY_CONV. - * cvt.c: Add IDENTITY_RANK before others. Use real_lvalue_p. - (build_conv): Use them. - (implicit_conversion): Use them. - (convert_like): Handle them. - (build_new_op): Handle builtin COND_EXPR again. - (add_builtin_candidates): Strip cv-quals. Fix oops. Include enums - in lists of types for COND_EXPR. - (add_builtin_candidate): Add enum candidates for COND_EXPR. - -Mon Jul 29 12:05:40 1996 Bob Manson - - * typeck.c (build_modify_expr): Always attempt to build a call to - the assignment operator, even if we're using a default one. - (convert_for_initialization): Call complete_type. - -Mon Jul 29 11:25:08 1996 Jason Merrill - - * cvt.c (reference_binding): A REF_BIND gets the reference type. - (implicit_conversion): Likewise. - (convert_like): Likewise. - (compare_ics): Likewise. - (compare_qual): Likewise. - (print_z_candidates): Handle no candidates. - (build_new_op): Don't handle builtin COND_EXPR for now. - -Sat Jul 27 11:27:47 1996 Stan Shebs - - * cvt.c (build_builtin_candidate): Init local var in an ANSI way. - -Fri Jul 26 01:07:22 1996 Jason Merrill - - * cvt.c (joust): If the candidates are the same, arbitrarily pick one. - - * cvt.c (build_builtin_candidate): Oops. - (build_new_op): Oops. - - * method.c (build_opfncall): Pass COND_EXPR on. - * cvt.c (build_builtin_candidate): Reorganize, support COND_EXPR. - (add_builtin_candidate{,s}): Likewise. - (add_builtin_candidates): Likewise. - (print_z_candidates, op_error, build_new_op): Likewise. - (type_decays_to): New fn. - * lex.c (init_lex): Just say ?: for COND_EXPR. - -Thu Jul 25 09:33:33 1996 Jason Merrill - - * typeck.c (complete_type): Call layout_type rather than building - a new array type. - - * cvt.c (add_builtin_candidate): Pointer arithmetic candidates - only use ptrdiff_t. - -Wed Jul 24 12:45:08 1996 Jason Merrill - - * cvt.c: Always compile the new overloading code (but don't use it). - (implicit_conversion): Add a BASE_CONV when converting to - the same class type. - (convert_like): Handle BASE_CONV. - -Tue Jul 23 12:46:30 1996 Jason Merrill - - * cvt.c (build_new_op): Support {MAX,MIN}_EXPR. - (add_builtin_candidate): Likewise. - - NEW_OVER changes: - * typeck.c (build_x_function_call): Try an operator function - whenever we call an object of class type. - * method.c (build_opfncall): Pass CALL_EXPRs through. - * cvt.c (implicit_conversion): Do const-ref case first. - (add_conv_candidate, build_object_call, op_error): New fns. - (ptr_complete_ob, TYPE_PTROB_P): void is not an object type. - ({add,build}_builtin_candidate{,s}, print_z_candidates): Display - builtin candidates. - (build_new_op): Handle CALL_EXPR. Don't try to decay void. - Fall back on preincrement handling. Use op_error. - Handle warn_synth. - (convert_like): Pass INDIRECT_BIND. Don't try to do anything with - an error_mark_node. - (build_over_call): Handle PROMOTE_PROTOTYPES and ellipsis promotions - properly. - -Mon Jul 22 16:21:55 1996 Bob Manson - - * pt.c (tsubst_expr): Handle CONTINUE_STMT. - -Mon Jul 22 15:38:58 1996 Mike Stump - - * typeck.c (build_component_ref_1): Use build_component_ref - instead of open coding it here. - -Mon Jul 22 12:18:54 1996 Jason Merrill - - * g++.c (main): Don't link with -lg++. - - NEW_OVER changes: - * cvt.c (convert_to_reference): Don't use convert_from_reference on - result of build_type_conversion. - (cp_convert): Only call build_method_call for ctors if - build_type_conversion failed. - (ptr_complete_ob): New function. - (TYPE_PTR{,OB,MEM}_P): New macros. - ({add,build}_builtin_candidate{,s}): New functions. - (print_z_candidates): Handle builtins. - (build_user_type_conversion_1): Don't use conversion fns for - converting to a base type. - (build_user_type_conversion_1): Set ICS_USER_FLAG on AMBIG_CONVs. - (build_user_type_conversion): Use convert_from_reference. - (build_new_op): New function. - (build_over_call): Fix handling of methods. - (compare_ics): Handle AMBIG_CONV properly. - * typeck2.c: Increment abort count. - * method.c (build_opfncall): Forward most requests to build_new_op. - * cp-tree.h (IS_OVERLOAD_TYPE): Tweak. - -Fri Jul 19 17:59:29 1996 Brendan Kehoe - - * error.c (dump_expr, case CONSTRUCTOR, case CAST_EXPR): Take out - invalid second argument to dump_expr_list. - -Fri Jul 19 14:04:05 1996 Mike Stump - - * decl.c (lookup_name_real): Make sure we do obj->X::i correctly. - -Thu Jul 18 14:48:23 1996 Bob Manson - - * decl2.c (import_export_vtable): ASM_OUTPUT_EXTERNAL, not - ASSEMBLE_EXTERNAL. - -Mon Jul 15 17:48:43 1996 Mike Stump - - * typeck2.c (process_init_constructor): New pedwarn for using { } - to initialize a pointer to member function. - * typeck.c (build_ptrmemfunc1): Avoid use of digest_init so that - we can avoid the new error. - -Mon Jul 15 15:42:03 1996 Mike Stump - - * typeck.c (build_ptrmemfunc1): New function to hide details of - pointer to member functions better. - -Mon Jul 15 14:23:02 1996 Mike Stump - - * init.c (resolve_offset_ref): Resolve OFFSET_REFs that are - methods into the actual method, as we know the implied object is - not used. - -Mon Jul 15 13:08:29 1996 Brendan Kehoe - - * parse.y (maybecomma_warn): Only emit the pedwarn if we're not - inside a system header. - -Fri Jul 12 16:30:05 1996 Bob Manson - - * call.c (build_method_call): Call complete_type on the - instance type. - -Thu Jul 11 17:16:40 1996 Mike Stump - - * typeck.c (build_component_ref): Always build up an OFFSET_REF - for obj_ptr->func so that we can know which object to use in a - method call. - -Wed Jul 10 19:36:37 1996 Mike Stump - - * typeck.c (build_ptrmemfunc): Remove sorry, now we can cast - around things. Also improve maintainability. - -Wed Jul 10 18:20:11 1996 Bob Manson - - * decl.c (grokdeclarator): Check for overflow when evaluating an - array dimension. - -Wed Jul 10 17:26:19 1996 Jason Merrill - - * cvt.c (cp_convert): Don't check for ambiguity with constructor - if NEW_OVER. - - * typeck.c (build_x_function_call): Pass function overload - questions to new overloading code if NEW_OVER. - * init.c (expand_aggr_init_1): Only check for type conversion ops - if we're doing copy-initialization (i.e. LOOKUP_ONLYCONVERTING). - Don't check for ambiguity with constructor if NEW_OVER. - * cvt.c (convert_to_reference): Dereference the result of a type - conversion operator. - (build_conv): Propagate ICS_USER_FLAG. - (implicit_conversion): Call instantiate_type. - Pass LOOKUP_ONLYCONVERTING instead of LOOKUP_NORMAL. - (add_function_candidate): Fix cv-quals on argtype. - (print_z_candidates): New function. - (build_new_function_call): Call it. - (build_user_type_conversion_1): If LOOKUP_ONLYCONVERTING, don't - consider non-converting constructors. - Call print_z_candidates. - Return an AMBIG_CONV for an ambiguous conversion. - (build_user_type_conversion): Handle AMBIG_CONV. - (convert_like): Fix test for building TARGET_EXPR. - Call instantiate_type. - Handle AMBIG_CONV and LVALUE_CONV. - (build_over_call): Handle 0 args and ellipsis. - * cp-tree.def: Add AMBIG_CONV. - -Tue Jul 9 17:48:48 1996 Mike Stump - - * decl.c (lookup_name_real): If we find mem in obj when parsing - `obj->mem', make sure we return the right value. - -Tue Jul 9 16:11:28 1996 Bob Manson - - * search.c (get_base_distance): Call complete_type. - -Tue Jul 9 12:46:34 1996 Mike Stump - - * decl.c (store_bindings): Make static. - -Mon Jul 8 16:42:31 1996 Jason Merrill - - * init.c (expand_aggr_init_1): Don't check type conversions if - NEW_OVER. - - * cvt.c (z_candidate): Put back template field. - (add_function_candidate): Set it. - (add_template_candidate): Likewise. - (joust): Use it. - (compare_qual): Handle references and pointers to members. - (compare_ics): Handle reference bindings. - - * decl.c (duplicate_decls): Propagate DECL_ONE_ONLY. - -Mon Jul 8 16:18:56 1996 Bob Manson - - * call.c (compute_conversion_costs): Call complete_type. - - * tree.c (vec_binfo_member): Use comptypes instead of comparing - pointers, so we can handle template parameters. - -Fri Jul 5 16:51:53 1996 Bob Manson - - * cvt.c (cp_convert_to_pointer): We have to call complete_type - here; let's make it explicit instead of a side effect of an - error check. - -Wed Jul 3 16:29:51 1996 Jason Merrill - - * cvt.c (z_candidate): Remove template field. - (reference_binding): Handle binding to temporary. - (implicit_conversion): Likewise. - (add_function_candidate): Handle artificial constructor parms. - Handle functions with too few parms. - (add_template_candidate): New function. - (build_user_type_conversion_1): Handle constructors. - (convert_like): Likewise. - (build_over_call): Likewise. - (build_new_function_call): Support templates. - (compare_ics): Fix reference, inheritance handling. - -Mon Jul 1 22:58:18 1996 Bob Manson - - * decl.c: Add signed_size_zero_node. - (init_decl_processing): Build it. - * class.c (prepare_fresh_vtable): Use it instead of size_zero_node - when we're trying to make a negative delta. - -Mon Jul 1 17:56:19 1996 Brendan Kehoe - - Stop doing this damn index==strchr variable name confusion. - * class.c (add_virtual_function): Change local var INDEX to be - named IDX. - (add_method): Likewise. - * lex.c (print_parse_statistics): Likewise. - * search.c (make_memoized_table_entry): Likewise. - (lookup_fnfields_here): Likewise. - (lookup_field): Likewise. - (lookup_fnfields): Likewise. - (get_baselinks): Likewise. - * sig.c (build_signature_table_constructor): Likewise. - (build_signature_method_call): Likewise. - * typeck.c (build_x_array_ref): Change INDEX parm to be named IDX. - (get_member_function_from_ptrfunc): Likewise. - (build_ptrmemfunc): Change local var INDEX to be IDX. - (c_expand_start_case): Likewise. - -Sat Jun 29 14:05:46 1996 Jason Merrill - - * cvt.c (cp_convert_to_pointer): Move user-defined type conversion - handling to before extraction of TYPE_PTRMEMFUNC_FN_TYPE. - (convert_to_reference): Use build_type_conversion to convert to - the reference type directly. - (standard_conversion): Fix void* case, non-conversions. - (reference_binding): Fix expr == 0 case, non-conversions. - (convert_like): Support REF_BIND. - (compare_qual): Split out from compare_ics. - (compare_ics): Use it, handle icses with only a qual_conv. - - * init.c (expand_vec_init): Don't crash if decl is NULL. - -Fri Jun 28 11:52:51 1996 Stan Shebs - - * mpw-config.in: New file, configury for Mac MPW. - * mpw-make.sed: New file, makefile editing for MPW. - -Thu Jun 27 15:18:30 1996 Jason Merrill - - * pt.c (instantiate_class_template): Call repo_template_used. - - * search.c (lookup_conversions): Only lookup conversions in - complete types. - -Thu Jun 27 12:59:53 1996 Brendan Kehoe - - * cp-tree.def: Renamed from tree.def, to avoid confusion with - gcc's tree.def. - * cp-tree.h, lex.c: Include cp-tree.def. - * Makefile.in (CXX_TREE_H): Reference cp-tree.def. - -Wed Jun 26 18:29:47 1996 Bob Manson - - * init.c (build_vec_delete_1): Call complete_type. - -Mon Jun 24 17:17:32 1996 Mike Stump - - * except.c (start_anon_func): Make sure anonymous functions are - never external. - -Fri Jun 21 15:10:58 1996 Jason Merrill - - * decl.c (finish_function): If function_depth > 1, set nested. - - * decl2.c (grokbitfield): Revert Bob's change. - * class.c (finish_struct_1): Fix handling of named bitfield widths. - -Thu Jun 20 23:35:38 1996 Jason Merrill - - * pt.c (add_pending_template): Handle types. - (lookup_template_class): With -fexternal-templates, just add the class - to pending_templates instead of instantiating it now. - * decl2.c (finish_file): Handle types in pending_templates. - -Thu Jun 20 14:08:40 1996 Bob Manson - - * decl2.c (grokbitfield): Handle constant decls appropriately. - Give an appropriate error message now instead of spewing core - later. - -Thu Jun 20 13:01:51 1996 Jason Merrill - - * decl2.c: Don't turn on thunks by default for now. - -Wed Jun 19 11:37:04 1996 Jason Merrill - - * typeck.c (complete_type): Handle error_mark_node. - (common_type, OFFSET_TYPE): Handle template_type_parms. - -Tue Jun 18 10:02:15 1996 Jason Merrill - - * pt.c (instantiate_decl): If at_eof, call import_export_decl - regardless of DECL_INLINE. - - * typeck.c (mark_addressable): Set TREE_ADDRESSABLE on CONSTRUCTORs. - - * class.c (finish_struct_bits): Copy TYPE_SIZE. - - * rtti.c (build_dynamic_cast): Support templates. - * tree.def: Support DYNAMIC_CAST_EXPR. - * pt.c (tsubst_copy): Likewise. - * decl2.c (build_expr_from_tree): Likewise. - -Mon Jun 17 15:23:36 1996 Jason Merrill - - * typeck.c (build_static_cast): Support templates. - (build_const_cast): Likewise. - * tree.def: Support CONST/STATIC_CAST_EXPR. - * pt.c (tsubst_copy): Likewise. - * decl2.c (build_expr_from_tree): Likewise. - -Sun Jun 16 12:33:57 1996 Jason Merrill - - * decl2.c (finish_vtable_vardecl): Don't trust - TREE_SYMBOL_REFERENCED for vtables of local classes. - -Fri Jun 14 18:13:36 1996 Jason Merrill - - * pt.c (tsubst_copy): Handle operator T. - -Wed Jun 12 17:52:40 1996 Brendan Kehoe - - * init.c (build_delete): Move creation of PARMS inside test of - TYPE_HAS_DESTRUCTOR, since it's never used outside of that block. - -Tue Jun 11 15:09:18 1996 Bob Manson - - * typeck.c (build_conditional_expr): Don't assume that - the arguments to ?: are always pointers or records. - -Tue Jun 11 13:56:23 1996 Jason Merrill - - * decl2.c (import_export_decl): Still emit static/weak/comdat - copies of inline template functions with -fno-implicit-templates. - -Tue Jun 11 11:42:13 1996 Bob Manson - - * init.c (build_delete): Determine the complete basetype - path to the destructor we're calling. - -Fri Jun 7 15:30:10 1996 Bob Manson - - * decl.c (build_enumerator): Always copy the INTEGER_CST used to - initialize the enum, because we really and truly don't know where - it came from. - (start_enum): Don't copy integer_zero_node because - build_enumerator will do it. - -Fri Jun 7 11:11:09 1996 Jason Merrill - - * decl.c (finish_function): Do access control on base destructors. - - * pt.c (tsubst, case FUNCTION_DECL): Set up - IDENTIFIER_GLOBAL_VALUE for member functions so pushdecl doesn't - hose us. - -Fri Jun 7 10:37:33 1996 Mike Stump - - * cvt.c (build_up_reference): If we have already extended the - lifetime of the temporary, don't try it again. - * typeck.c (c_expand_return): Don't try and convert the return - value twice when we want a reference, once is enough. - -Tue Jun 4 15:41:45 1996 Jason Merrill - - * pt.c (tsubst_expr, case DECL_STMT): Don't pass - LOOKUP_ONLYCONVERTING at all for now. - - * search.c (add_conversions): Put the conversion function in - TREE_VALUE, the basetype in TREE_PURPOSE. - * cvt.c (build_type_conversion): Adjust. - * cvt.c (build_expr_type_conversion): Adjust. - * call.c (user_harshness): Adjust. - -Mon Jun 3 15:30:52 1996 Jason Merrill - - * method.c (emit_thunk): Pretend this is a FUNCTION_DECL for the - backend's benefit. - -Mon Jun 10 18:58:19 1996 Mike Stump - - * except.c (expand_start_catch_block): Add a dummy region, if we - get an error, so that we can avoid core dumping later. - -Fri May 31 14:56:13 1996 Mike Stump - - * cp-tree.h (OFFSET_REF): Remove. - * tree.def (CP_OFFSET_REF): Rename to OFFSET_REF. - * expr.c (cplus_expand_expr): Cleanup callers of expand_expr. - * init.c (expand_aggr_init_1): Likewise. - (build_new): Likewise. - * typeck.c (expand_target_expr): Likewise. - -Fri May 31 14:22:08 1996 Jason Merrill - - * typeck.c (build_modify_expr): Don't use TREE_VALUE on a - TARGET_EXPR. - -Wed May 29 17:04:33 1996 Mike Stump - - * cvt.c (build_up_reference): Redo how and when temporaries are - created. - * decl.c (grok_reference_init): Don't try and be smart about - running cleanups. - -Wed May 29 16:02:08 1996 Mike Stump - - * cvt.c (build_up_reference): Add NULL_TREE to all calls to build - (TARGET_EXPR...), now that it has 4 arguments. - * tree.c (build_cplus_new): Likewise. - -Thu May 23 16:40:30 1996 Jason Merrill - - * error.c (dump_expr, case CAST_EXPR): Handle T() properly. - - * pt.c (instantiate_decl): Don't call push/pop_cp_function_context. - * decl.c (struct saved_scope): Remove named_labels, - {base,member}_init_list. - (maybe_push_to_top_level): Don't set them. Call - push_cp_function_context if appropriate. - (pop_from_top_level): Likewise. - - * method.c (do_build_assign_ref): Remove obsolete check of - TYPE_HAS_ASSIGN_REF (basetype). - - * decl.c (grokfndecl): Diagnose user definition of - implicitly-declared methods. - -Thu May 23 12:13:08 1996 Bob Manson - - * method.c (do_build_copy_constructor): Add code to give - meaningful error messages instead of crashing. - (do_build_assign_ref): Don't synthesize assignment operators for - classes containing reference or const members. - - * class.c (struct base_info): Remove cant_synth_copy_ctor - and cant_synth_asn_ref. - (finish_base_struct): Remove the code that tries to conditionalize - synthesis of copy constructors & assignment operators based on - access permissions. Instead, let it fail when it tries to - synthesize the copy constructor. This will give meaningful error - messages instead of silently generating code to perform a bitcopy. - -Wed May 22 11:45:19 1996 Bob Manson - - * lex.c (real_yylex): Remove old-n-crufty #if 0 code for - determining types for constant values. - - * decl.c (struct named_label_list): Use instead of stuffing - random items into a TREE_LIST node. - (named_label_uses): Use the new struct. - (poplevel): Likewise. - (lookup_label): Likewise. - (define_label): Add an error message to tell the user the line - where the goto is located in addition to the destination of the - goto. - (init_decl_processing): Use NULL instead of NULL_TREE to initialize - named_label_uses. - (finish_function): Likewise. - - (start_decl): Complain about defining a static data member - in a different type from which it was declared. - -Wed May 22 09:33:23 1996 Jason Merrill - - * cvt.c (build_expr_type_conversion): Adjust. - -Tue May 21 11:21:56 1996 Jason Merrill - - * call.c (build_method_call): Always convert 'this' to the - appropriate type. - - * search.c (add_conversions): Put the conversion function in - TREE_VALUE, the type in TREE_PURPOSE. - * cvt.c (build_type_conversion): Adjust. - * call.c (user_harshness): Adjust. - - * method.c (emit_thunk): Call temporary_allocation and - permanent_allocation around the ASM_OUTPUT_MI_THUNK case, too. - - * tree.c (build_cplus_array_type): Handle tweaking of - TYPE_MAIN_VARIANT here. - * typeck.c (common_type): Not here. - - * typeck.c (complete_type): Only try to complete an array type if - it has a domain. - -Mon May 20 14:55:59 1996 Jason Merrill - - * decl.c (grokvardecl): Call complete_type. - (grokdeclarator): Call complete_type for PARM_DECLs. - -Fri May 17 16:41:17 1996 Jason Merrill - - * pt.c (instantiate_class_template): Re-set - CLASSTYPE_GOT_SEMICOLON after calling finish_struct_1. - -Fri May 17 14:56:55 1996 Mike Stump - - * cp-tree.h (cp_expand_decl_cleanup): Remove, the backend is now - smart enough to do it right. - * tree.c (cp_expand_decl_cleanup): Likewise. - * decl.c (cp_finish_decl): Use expand_decl_cleanup instead of - cp_expand_decl_cleanup. - (store_parm_decls): Likewise. - (hack_incomplete_structures): Likewise. - * except.c (push_eh_cleanup): Likewise. - -Fri May 17 13:13:51 1996 Mike Stump - - * expr.c (expand_expr, cond UNSAVE_EXPR): Move from the C++ - frontend to the backend where it belongs. - * tree.c (unsave_expr): Likewise. - (unsave_expr_now): Likewise. - * tree.def (UNSAVE_EXPR): Likewise. - * cp-tree.h (unsave_expr): Likewise. - (unsave_expr_now): Likewise. - -Fri May 17 11:02:41 1996 Mike Stump - - * init.c (emit_base_init): Make sure the partial EH cleanups live - on the function_obstack. - -Thu May 16 15:29:33 1996 Bob Manson - - * expr.c (do_case): Don't try to dereference null TREE_TYPEs - when checking for pointer types. - -Thu May 16 13:38:58 1996 Jason Merrill - - * pt.c (instantiate_class_template): Remove obsolete check for - access declarations. - -Thu May 16 13:34:15 1996 Mike Stump - - * call.c (build_overload_call): Simplify calls to - build_overload_call by removing last parameter. - (build_method_call): Likewise. - * cp-tree.h: Likewise. - * method.c (build_opfncall): Likewise. - * typeck.c (build_x_function_call): Likewise. - -Thu May 16 13:15:43 1996 Mike Stump - - * call.c (default_parm_conversions): Factor out common code. - (build_method_call): Use it. - (build_overload_call_real): Use it. - -Wed May 15 14:46:14 1996 Mike Stump - - * call.c (build_method_call): Allow implicit & on METHOD_TYPEs, - but pedwarn as the code is bogus. - * typeck.c (decay_conversion): Likewise. - (build_function_call_real): Use build_addr_func instead of - default_conversion. Don't allow pointer-to-method functions down - here. - (build_unary_op): Use real pointer-to-member functions instead of - fake ones. - (build_ptrmemfunc): Use build_addr_func instead of build_unary_op. - (convert_for_assignment): Removed some obsolete code. - * decl2.c (reparse_absdcl_as_expr): Pass current_class_ref to - build_x_function_call instead of current_class_ptr. Only call - digest_init once on an initializer, we do this just checking - TREE_TYPE. - (build_expr_from_tree): Pass current_class_ref to - build_x_function_call instead of current_class_ptr. - * init.c (build_member_call): Likewise. - * pase.y: Likewise. - * error.c (dump_expr): Handle OFFSET_REFs better. - * pt.c (unify): Handle pointer-to-member functions better. - * decl.c (finish_function): Clear out current_class_ref just like - we do for current_class_ptr. - - * typeck.c (get_delta_difference): Handle virtual bases better. - -Tue May 14 16:37:37 1996 Jason Merrill - - * sig.c (build_signature_table_constructor): Use the delta for - the original basetype for this virtual function with thunks. - (build_signature_method_call): We still need to adjust 'this' - with thunks. - -Tue May 14 16:27:25 1996 Mike Stump - - * call.c (build_addr_func): New routine. Used to get the `real' - address of a function or a method. Needed to avoid getting a - pointer-to-member function. - (build_call): New routine to build CALL_EXPRs. - (build_method_call): Use it. - * cvt.c (convert_to_aggr): Likewise. - * typeck.c (build_function_call_real): Likewise. - * sig.c (build_signature_table_constructor): Use build_addr_func. - * cp-tree.h (build_call, build_addr_func): Declare them. - -Tue May 14 12:47:47 1996 Mike Stump - - * cp-tree.h (LOOKUP_AGGR): Remove, unused. - * parse.y: Remove uses of LOOKUP_AGGR. - -Tue May 14 12:07:51 1996 Mike Stump - - * *.[chy]: Rename current_class_decl to current_class_ptr, and - C_C_D to current_class_ref. - -Mon May 13 16:55:23 1996 Jason Merrill - - * call.c (convert_harshness): Tighten up pointer conversions. - -Sat May 11 04:33:50 1996 Doug Evans - - * decl2.c (finish_vtable_vardecl): Surround DECL_ONE_ONLY with ifdef. - (finish_file): Likewise. - -Fri May 10 11:09:57 1996 Jason Merrill - - * cvt.c (convert_fn_ptr): We don't use thunks for pmfs. - - * method.c (emit_thunk): Set flag_omit_frame_pointer in default - code. - -Thu May 9 18:18:30 1996 Jason Merrill - - * decl2.c: Turn on thunks by default where supported. - -Tue May 7 20:39:57 1996 Mike Stump - - * cp-tree.h (build_overload_call_maybe): Removed. - * call.c (build_overload_call_real): Invert meaning of last arg to - be require_complete. - (build_overload_call): Likewise. - * typeck.c (build_x_function_call): Use build_overload_call_real - instead of build_overload_call_maybe. - -Mon May 6 01:23:32 1996 Jason Merrill - - * decl2.c (finish_file): Don't try to emit functions that haven't - been compiled. - -Fri May 3 09:30:13 1996 Jason Merrill - - * decl2.c (finish_vtable_vardecl): Oops. - - * decl.c (maybe_push_to_top_level): Do save previous_class_*. - Also store the bindings from previous_class_values. - (pop_from_top_level): Restore them. - -Thu May 2 21:56:49 1996 Jason Merrill - - * decl2.c (finish_vtable_vardecl): Only write out vtable if its - symbol has been referenced. - (finish_file): Re-join synthesis/vtable loop with inline emission - loop, disable inlining when an inline is output. - -Thu May 2 17:20:02 1996 Mike Stump - - * except.c (init_exception_processing): Setup saved_in_catch. - (push_eh_cleanup): Reset __eh_in_catch. - (expand_start_catch_block): Set __eh_in_catch. - -Thu May 2 16:21:17 1996 Mike Stump - - * except.c (push_eh_cleanup): Add tracking for whether or not we - have an active exception object. - (expand_builtin_throw): Use it to make sure a rethrow without an - exception object is caught. - -Thu May 2 11:26:41 1996 Jason Merrill - - * decl.c (maybe_push_to_top_level): Clear out class-level bindings - cache. - -Wed May 1 11:26:52 1996 Jason Merrill - - * decl2.c (finish_file): Also use sentries for vars with - DECL_ONE_ONLY or DECL_WEAK set (should any such happen to be - created). - - * lex.c (handle_cp_pragma): Disable #pragma - interface/implementation if SUPPORTS_ONE_ONLY > 1. - -Tue Apr 30 11:25:46 1996 Jason Merrill - - * method.c (emit_thunk): Wrap default case in - temporary/permanent_allocation. - - * method.c (make_thunk): Use DECL_ONE_ONLY. - (emit_thunk): Call assemble_end_function. - -Mon Apr 29 15:38:29 1996 Jason Merrill - - * decl2.c (import_export_vtable): Use DECL_ONE_ONLY. - (import_export_decl): Likewise. - (finish_prevtable_vardecl): Disable vtable hack if - SUPPORTS_ONE_ONLY > 1. - -Mon Apr 29 14:32:47 1996 Mike Stump - - * typeck.c (build_modify_expr): PREINCREMENT_EXPR and - PREDECREMENT_EXPRs take two arguments, not one. - -Mon Apr 29 00:27:53 1996 Jason Merrill - - * class.c (build_vtable_entry): Don't build thunks for abstract - virtuals. - - * lex.c (real_yylex): Fix handling of __PRETTY_FUNCTION__ like C - frontend. - -Sat Apr 27 16:45:35 1996 Jason Merrill - - * class.c (set_rtti_entry): Use size_zero_node. - (build_vtable): Likewise. - -Sat Apr 27 14:48:57 1996 Jason Merrill - - * class.c (finish_struct_1): Pass size_zero_node to set_rtti_entry. - (prepare_fresh_vtable): Likewise. - -Fri Apr 26 13:14:14 1996 Jason Merrill - - * method.c (emit_thunk): Call mark_used on the target function. - - * call.c (build_method_call): Don't warn about pending templates. - -Thu Apr 25 14:55:44 1996 Jason Merrill - - * decl2.c (finish_file): Fix list walking logic. - - * typeck2.c (check_for_new_type): Only warn if -pedantic. - -Wed Apr 24 15:41:15 1996 Bob Manson - - * class.c (finish_struct_1): Remove old code for - dont_allow_type_definitions. - * cp-tree.h: Likewise. - * spew.c: Make sure cp-tree.h is included before parse.h, so the - definition of flagged_type_tree is found before it is used. - * lex.c: Likewise. - * parse.y: Added the ftype member to the type union, and changed a - number of rules to use it instead of ttype. Added calls to - check_for_new_type() as appropriate. - * typeck2.c (check_for_new_type): New function for checking - if a newly defined type appears in the specified tree. - * cp-tree.h: Add new type flagged_type_tree. Add a prototype - for check_for_new_type(). - -Wed Apr 24 00:36:21 1996 Jason Merrill - - * decl2.c (finish_file): Only use a sentry if the decl is public. - - * pt.c (tsubst_expr, DECL_STMT): If we don't have an initializer, - don't pass LOOKUP_ONLYCONVERTING. - -Tue Apr 23 17:18:47 1996 Bob Manson - - * typeck.c (common_type): Fix the ARRAY_TYPE case so it - properly keeps track of const and volatile type modifiers. - -Tue Apr 23 10:52:56 1996 Jason Merrill - - * tree.c (cp_tree_equal): C++ version of simple_cst_equal. - * pt.c (comp_template_args): Use it. - - * rtti.c (get_tinfo_fn, build_dynamic_cast, expand_*_desc): Call - assemble_external for artificial function decls. - - * decl.c (cp_finish_decl): Oops. - -Mon Apr 22 17:28:27 1996 Jason Merrill - - * decl2.c (import_export_decl): Put static data member templates - into common storage, or make them weak, depending on whether they - are dynamically or statically initialized. - (get_sentry): New function. - (finish_file): Do import_export_decl for static data members before - building the init/fini functions. Don't init/fini a variable that's - EXTERNAL. Use a sentry for variables in common. Fix mismatching - push/pop_temp_slots. - * decl.c (cp_finish_decl): If DECL_NOT_REALLY_EXTERN, do the - expand_static_init thang. - * method.c (get_id_2): New function. - -Mon Apr 22 15:32:45 1996 Bob Manson - - * parse.y (empty_parms): Make sure we use C++-style prototypes - when we're declaring member functions. - -Sun Apr 21 10:08:22 1996 Jason Merrill - - * Makefile.in (CONFLICTS): 16 s/r conflicts. - * parse.y (self_template_type): New nonterminal. - -Thu Apr 18 08:56:54 1996 Jason Merrill - - * decl.c (make_typename_type): Handle getting a TYPE_DECL for a - name. - * parse.y (base_class.1): Allow 'typename foo::bar'. - - * lex.c (check_newline): Remove #pragma code that plays with the - input stream, since we now deal with tokens. Clear nextchar when - we're done. - (handle_cp_pragma): Use real_yylex. - (handle_sysv_pragma): Don't do skipline here. Only call real_yylex - in one place. - - * lex.c (check_for_missing_semicolon): Handle SELFNAME. - - * lex.c (handle_cp_pragma): Fix "#pragma implementation". - -Wed Apr 17 16:51:33 1996 Jason Merrill - - * parse.y: New token SELFNAME for potential constructor. - * spew.c (yylex): Handle it. - * lex.c (identifier_type): Produce it. - - * parse.y (complete_type_name): In :: case, don't push class binding. - (complex_type_name): Likewise. - -Wed Apr 17 15:02:40 1996 Mike Stump - - * typeck.c (build_reinterpret_cast): Handle pointer to member - functions. - -Wed Apr 17 12:28:26 1996 Brendan Kehoe - - * lex.c (handle_cp_pragma): New function, with decl, doing the cc1plus - pragmas. - (check_newline): Put the vtable/unit/implementation/interface pragma - code into handle_cp_pragma, replacing it with a call. - (handle_sysv_pragma): Give int return type, and take FINPUT and TOKEN - args. Get the next token after handling the pragma token. - -Wed Apr 17 10:28:34 1996 Jason Merrill - - * cvt.c (cp_convert_to_pointer): Avoid doing base analysis on pmfs. - (convert_to_pointer_force): Likewise. - - * init.c (build_new): Fix array new without -fcheck-new. - -Tue Apr 16 13:44:58 1996 Jason Merrill - - * cp-tree.h, call.c, class.c, decl.c, parse.y, pt.c, rtti.c, - tree.c: Lose TYPE_NESTED_NAME. - - * parse.y (nested_name_specifier_1): Don't treat non-identifiers - as identifiers. - - * tree.def: Add VEC_INIT_EXPR. - * expr.c (cplus_expand_expr): Handle it. - * init.c (build_new): Use it instead of the RTL_EXPR nastiness and - the extra file-scope symbol nastiness. - -Mon Apr 15 16:21:29 1996 Jason Merrill - - * method.c (make_thunk): Thunks are static. - (emit_thunk): Use ASM_OUTPUT_MI_THUNK if it's defined. - - * decl2.c (mark_vtable_entries): Emit thunks as needed. - (finish_file): Don't emit them here. - -Sun Apr 14 11:34:39 1996 Jason Merrill - - * rtti.c (build_dynamic_cast): Handle null pointers. - (ifnonnull): New function. - -Fri Apr 12 09:08:27 1996 Bob Manson - - * call.c (build_method_call): Remember the original basetype we - were called with. Give an error message instead of trying - (incorrectly) to call a non-static member function through a - non-inherited class. - - * search.c (expand_upcast_fixups): Mark the new fixup as - DECL_ARTIFICIAL. - -Thu Apr 11 03:57:09 1996 Jason Merrill - - * init.c (build_new): Use a TARGET_EXPR for alloc_expr. - - * class.c (set_rtti_entry): Fix for thunks. - - * decl2.c (import_export_decl): Still emit typeinfo fns for - cv-variants of builtin types. - - * rtti.c (expand_class_desc): Set up base_info_type_node here. - (init_rtti_processing): Instead of here. - -Wed Apr 10 14:17:13 1996 Jason Merrill - - * rtti.c (init_rtti_processing): Do init regardless of -frtti. - (build_typeid): Only complain about taking dynamic typeid without - -frtti. - - * decl2.c: flag_rtti defaults to 1. - - * rtti.c (get_tinfo_var): The general class case is now smaller. - (init_rtti_processing): Pack the latter three fields of base_info - into 32 bits. - -Wed Apr 10 13:50:14 1996 Mike Stump - - * init.c (expand_member_init): Don't dump if name is NULL_TREE. - -Wed Apr 10 12:56:02 1996 Mike Stump - - * search.c (make_memoized_table_entry): Undefer the pop, if necessary. - (push_memoized_context): Split out code to undefer pop_type_level to - (clear_memoized_cache): here. - (pop_memoized_context): We can only handle one layer of deferral of - pop_type_level so clear the cache, if there was a previous level. - -Tue Apr 9 23:06:09 1996 Jason Merrill - - * rtti.c (init_rtti_processing): Build up base_info_type_node. - (expand_class_desc): Use one pointer to an array of base_info - structs, passed using a CONSTRUCTOR. - -Tue Apr 9 14:20:57 1996 Mike Stump - - * class.c (build_vbase_path): Remove block extern for - flag_assume_nonnull_objects here. - (build_vfn_ref): Split out functionality into build_vtbl_ref. - (build_vtbl_ref): New routine. - (build_vtable): Set up rtti info here. - (add_virtual_function): Note in CLASSTYPE_RTTI the best - place where we can get the rtti pointers from to avoid having to - search around for a place. - (finish_base_struct): Likewise. - (finish_struct_1): Likewise. Never create totally new vtables - with totally new vtable pointers for rtti. Disable code to layout - vtable pointers better until we want to break binary - compatibility. - * rtti.c (build_headof_sub): New routine to convert down to a - sub-object that has an rtti pointer in the vtable. - (build_headof): Use it. Also, use build_vtbl_ref now to be more - maintainable. - (build_dynamic_cast): Make sure we have saved it, if we need to. - * search.c (dfs_init_vbase_pointers): Disable code that deals with - a more efficient vtable layout, enable later. - * call.c (flag_assume_nonnull_objects): Moved declaration to - * cp-tree.h: here. Declare build_vtbl_ref. - * pt.c (instantiate_class_template): Use NULL_TREE instead of 0 in - function calls that want a tree. - -Tue Apr 9 12:10:26 1996 Jason Merrill - - * rtti.c (build_dynamic_cast): Handle downcasting to X* given - other X subobjects in the most derived type. Ack. - - * rtti.c (build_dynamic_cast): No need to strip cv-quals here, - get_typeid will do it for us. - (get_typeid_1): Break out call-building for expand_*_desc to use. - (get_typeid): Call it. - (expand_*_desc): Likewise. - * decl.c (init_decl_processing): Don't set TYPE_BUILT_IN on char * - and void *. - (init_decl_processing): Lose builtin_type_tdescs lossage. - * decl2.c (finish_vtable_vardecl): Remove obsolete code. - -Mon Apr 8 17:23:23 1996 Bob Manson - - * pt.c (tsubst): When calling set_nested_typename, use - TYPE_NESTED_NAME (current_class_type) instead of - current_class_name. - - * decl.c (pushdecl): Likewise. - (pushdecl_class_level): Likewise. - (grokdeclarator): Use NULL_TREE instead of 0 in the call to - set_nested_typename. - -Sun Apr 7 10:44:31 1996 Jason Merrill - - * rtti.c (synthesize_tinfo_fn): Handle arrays. - - * cp-tree.h (DECL_REALLY_EXTERN): New macro. - -Sat Apr 6 13:56:27 1996 Jason Merrill - - * rtti.c (throw_bad_cast): Use entry point __throw_bad_cast. - (init_rtti_processing): Lose bad_cast_type. - (build_dynamic_cast): Use throw_bad_cast. - - * rtti.c (synthesize_tinfo_fn): Handle enums and pmfs. - - * decl2.c (finish_file): Don't synthesize artificial functions - that are external and not inline. - - * rtti.c (get_tinfo_fn): If at_eof, call import_export_decl. - - * decl2.c (finish_file): Handle having new inlines added to - saved_inlines by synthesis. - - * rtti.c (get_bad_cast_node): Don't require . - -Fri Apr 5 17:02:09 1996 Jason Merrill - - RTTI rewrite to initialize nodes as needed, not require that - users #include , complete functionality and reduce wasted - space. - * rtti.c (init_rtti_processing): New fn. - (build_typeid): The vtable entry is now a function. - (get_tinfo_var): New fn. - (get_tinfo_fn): Likewise. - (get_typeid): Use it. - (build_dynamic_cast): Declare and use entry point __dynamic_cast. - (build_*_desc): Rename to expand_*_desc and rewrite to use entry - points __rtti_*. - (add_uninstantiated_desc, get_def_to_follow, build_t_desc): Lose. - (synthesize_tinfo_fn): New fn. - * method.c (build_t_desc_overload): Lose. - (build_overload_with_type): More generic. - * decl.c (init_decl_processing): Call init_rtti_processing. - * class.c (set_rtti_entry): Use get_tinfo_fn. - * decl2.c (mark_vtable_entries): Mark the rtti function. - (finish_prevtable_vardecl): Don't build_t_desc. - (import_export_decl): Handle tinfo functions. - (finish_file): Likewise. - * typeck.c (inline_conversion): New fn. - (build_function_call_real): Use it. - * cp-tree.h: Add decls. - - * method.c (hack_identifier): Also convert component_refs from - references. - - * lex.c (cons_up_default_function): Use the type, not the name, in - declspecs. - - * decl2.c (import_export_vtable): Fix weak vtables. - -Fri Apr 5 13:30:17 1996 Bob Manson - - * search.c (get_base_distance_recursive): Fix access checks for - protected bases. - -Fri Apr 5 11:02:06 1996 Brendan Kehoe - - * call.c (unary_complex_lvalue): Delete unneeded decl, it's in - cp-tree.h. - (convert_harshness): Add prototypes wrapped by PROTO. - * decl2.c (grok_function_init): Likewise. - (do_toplevel_using_decl): Change to void return type. - * class.c (build_vtable_entry): Remove decl of make_thunk. - (merge_overrides): Fix order of arg definitions. - (finish_vtbls): Likewise. - (fixup_vtable_deltas): Likewise. - (modify_all_direct_vtables): Likewise. - (modify_all_indirect_vtables): Likewise. - * search.c (get_base_distance_recursive): Likewise. - (get_abstract_virtuals_1): Likewise. - (fixup_virtual_upcast_offsets): Likewise. - (lookup_fnfields_1): Add prototypes wrapped by PROTO. - * init.c (perform_member_init): Fix order of arg definitions. - (expand_aggr_init_1): Add prototypes wrapped by PROTO. - * cp-tree.h (make_thunk): Add decl. - (overload_template_name, push_template_decl): Add decls. - (do_toplevel_using_decl): Change to void return type. - (vec_binfo_member): Add decl. - -Thu Apr 4 13:33:10 1996 Brendan Kehoe - - * typeck.c (mark_addressable, convert_for_assignment, - convert_for_initialization, pointer_int_sum, pointer_diff, - unary_complex_lvalue): Add prototypes wrapped by PROTO. - (convert_sequence): #if 0 fn decl, since definition also is. - -Thu Apr 4 11:00:53 1996 Mike Stump - - * rtti.c (build_dynamic_cast): Make sure we strip qualifiers on - cast to pointer types for type searching. - -Wed Apr 3 17:10:57 1996 Brendan Kehoe - - * typeck.c (get_delta_difference): Use cp_error, not error, in the - case where BINFO == 0. - -Wed Apr 3 12:01:02 1996 Mike Stump - - * call.c (build_method_call): Fix wording of error messages so - constructors come out right. - -Tue Apr 2 16:06:59 1996 Bob Manson - - * decl.c (push_overloaded_decl): Don't warn about hidden - constructors when both the type and the function are declared - in a system header file. - -Mon Apr 1 09:03:13 1996 Bob Manson - - * class.c (finish_struct_1): Propagate the TYPE_PACKED - flag for the type to the type's fields. - -Sat Mar 30 12:14:33 1996 Brendan Kehoe - - * parse.y (complex_parmlist, ELLIPSES): Take out ARM-based warning. - -Fri Mar 29 15:51:36 1996 Bob Manson - - * class.c (base_info, finish_base_struct): Replace - needs_virtual_dtor with base_has_virtual. - - (finish_struct_1): Remove the old code that tried to make default - destructors virtual. Use base_has_virtual when checking if we need - to add a vtable entry for the rtti code. - -Fri Mar 29 14:02:36 1996 Jason Merrill - - * pt.c (push_template_decl): Complain about template decl with - inappropriate declaration. - -Fri Mar 29 12:15:35 1996 Bob Manson - - * typeck.c (build_x_unary_op): Remove bogus check for taking - the address of a member function. - -Fri Mar 29 11:56:02 1996 Jason Merrill - - * parse.y (constructor_declarator): Only push the class if - we are not already in the class. - -Fri Mar 29 09:41:02 1996 Jeffrey A. Law - - * method.c (emit_thunk): Remove current_call_is_indirect nonsense. - Add additional argument to INIT_CUMULATIVE_ARGS. - -Thu Mar 28 16:41:39 1996 Jason Merrill - - * decl.c (shadow_tag): Fix error about anon union with methods. - - * parse.y (self_reference): Only generate a self-reference if this - is a non-template class. - (opt.component_decl_list): Only use it if it was generated. - - * parse.y (component_decl_1): Use constructor_declarator. - (fn.def2): Likewise. - (notype_component_declarator0): Likewise. - -Thu Mar 28 15:11:35 1996 Bob Manson - - * typeck.c (build_x_unary_op): Add checks for taking the address - of a TARGET_EXPR or of a member function, and give appropriate - warnings. - -Thu Mar 28 14:49:26 1996 Jason Merrill - - * pt.c (process_template_parm): Allow template type parms to be - used as types for template const parms. - -Wed Mar 27 15:51:19 1996 Mike Stump - - * init.c (expand_vec_init): Ensure the eh cleanups are on the - function_obstack. - -Wed Mar 27 10:14:30 1996 Jason Merrill - - * decl.c (lookup_name_real): Be even more picky about the - ambiguous lookup warning. - (grokdeclarator): Tweak SCOPE_REF constructor declarators here. - * parse.y (constructor_declarator): Rather than here. - - * parse.y (constructor_declarator): New nonterminal. - (fn.def1): Use it. - (explicit_instantiation): Likewise. - -Tue Mar 26 13:41:33 1996 Jason Merrill - - Add implicit declaration of class name at class scope. - * decl.c (lookup_name_real): Restrict pedwarn about ambiguous lookup. - * parse.y (self_reference): New nonterminal. - (opt.component_decl_list): Use it. - (fn.def1): Add nested_name_specifier type_name cases. - * class.c (build_self_reference): New function. - (finish_struct): Handle access_default later, move self-reference - decl to the end. - * pt.c (lookup_template_class): Handle getting a TYPE_DECL. - * cp-tree.h: Adjust. - - * pt.c (do_function_instantiation): Separate handling of member - functions and non-member functions properly. - -Mon Mar 25 14:23:22 1996 Jason Merrill - - * pt.c (process_template_parm): Improve error for 'volatile class K'. - - * class.c (finish_struct_1): Check the right slot for destructors. - - * decl.c (start_enum): Complain about enum templates. - -Mon Mar 25 13:25:31 1996 Mike Stump - - * init.c (resolve_offset_ref): Offset pointers to member data by one. - * typeck.c (unary_complex_lvalue): Likewise. - -Mon Mar 25 13:30:42 1996 Bob Manson - - * typeck.c (c_expand_return): Check for a returned local - array name, similar to the check for an ADDR_EXPR. - -Mon Mar 25 13:07:19 1996 Jason Merrill - - * decl.c (cp_finish_decl): Don't build cleanups for static - variables here. - -Fri Mar 22 17:57:55 1996 Mike Stump - - * typeck.c (build_modify_expr): Fix error messages to be more - accurate. - * cp-tree.h (assop_as_string): Parallel to op_as_string, but for - assignment operators. - * error.c (assop_as_string): Likewise. Add support for `%Q' for - assignment operators. - -Fri Mar 22 13:48:29 1996 Jason Merrill - - * decl.c (grokdeclarator): Call bad_specifiers for typedefs. Also - give an error if initialized. pedwarn about nested type with the - same name as its enclosing class. - - * pt.c (tsubst, case TYPE_DECL): Set DECL_CONTEXT. - - * typeck.c (require_complete_type): Be sure to instantiate the - MAIN_VARIANT of the type. - - * decl2.c (finish_file): Instantiate pending templates before - processing static constructors and destructors. - - * pt.c (instantiate_decl): Don't instantiate functions at toplevel - unless at_eof. - -Fri Mar 22 09:30:17 1996 Bob Manson - - * decl2.c (delete_sanity): If error_mark_node is passed - in as an expression, quit while we're ahead. - - * decl.c (grokdeclarator): Give an error message if `friend' - is combined with any storage class specifiers. - -Wed Mar 20 14:51:55 1996 Jason Merrill - - * parse.y (named_complex_class_head_sans_basetype): Don't crash on - definition of nonexistent nested type. - - * error.c (dump_decl, case TYPE_DECL): Fix decision for whether or - not to say 'typedef'. - -Wed Mar 20 00:11:47 1996 Brendan Kehoe - - * cp-tree.h (struct lang_type): Make search_slot a tree, not a char*. - * search.c (dfs_walk, dfs_init_vbase_pointers, - expand_upcast_fixups): Remove cast of CLASSTYPE_SEARCH_SLOT. - (dfs_find_vbases): Remove cast for CLASSTYPE_SEARCH_SLOT init. - -Tue Mar 19 17:56:03 1996 Jason Merrill - - * except.c (build_throw): Support minimal parse. - * pt.c (tsubst_copy): Support THROW_EXPR. - * decl2.c (build_expr_from_tree): Likewise. - - * pt.c (mangle_class_name_for_template): Always allocate - scratch_firstobj. - -Tue Mar 19 16:34:31 1996 Bob Manson - - * cvt.c (cp_convert_to_pointer): Give an appropriate error - when trying to cast from an incomplete type. - -Tue Mar 19 16:00:33 1996 Jason Merrill - - * pt.c (instantiate_class_template): Don't bother setting up - CLASSTYPE_TAGS explicitly, as the nested types will add - themselves. - -Tue Mar 19 15:48:43 1996 Bob Manson - - * decl.c (shadow_tag): Remove old error check for usage of - an enum without a previous declaration. - (xref_tag): Add error message about usage of enums without a - previous declaration. - -Tue Mar 19 09:21:35 1996 Jason Merrill - - * lex.c (do_identifier): Only do name consistency check if we're - parsing. - - * pt.c (push_template_decl): Don't crash if we get a member defn - that doesn't match. - - * decl.c (xref_tag_from_type): New function to do an xref without - always having to figure out code_type_node. - * cp-tree.h: Declare it. - * pt.c (instantiate_class_template): Use it for friend classes. - (lookup_template_class): Use it. - - * typeck2.c (build_functional_cast): Pull out a single parm before - passing it to build_c_cast. - -Tue Mar 19 09:07:15 1996 Bob Manson - - * expr.c (do_case): Give an error message if a pointer is - given as a case value. - -Mon Mar 18 21:57:54 1996 Jason Merrill - - * typeck.c (build_c_cast): Don't pull single TEMPLATE_DECL out of - an overload list. - - * lex.c (cons_up_default_function): Really, now, interface hackery - does not apply to synthesized methods. - -Mon Mar 18 18:20:57 1996 Mike Stump - - * call.c (build_method_call): Ctors and dtors now have special names - with respect to lookups. - * class.c (add_method): Likewise. - (grow_method): Likewise. - (finish_struct_methods): Likewise. - (warn_hidden): Likewise. - (finish_struct_1): Likewise. - * cvt.c (convert_to_reference): Likewise. - (convert_to_aggr): Likewise. - (cp_convert): Likewise. - * decl2.c (check_classfn): Likewise. - * init.c (expand_member_init): Likewise. - (expand_default_init): Likewise. - (expand_aggr_init_1): Likewise. - (build_offset_ref): Likewise. - (build_new): Likewise. - (build_delete): Likewise. - * lex.c (do_inline_function_hair): Likewise. - * search.c (lookup_field_1): Likewise. - (lookup_fnfields_here): Likewise. - (lookup_field): Likewise. - (lookup_fnfields): Likewise. - (get_virtual_destructor): Likewise. - (dfs_debug_mark): Likewise. - (dfs_pushdecls): Likewise. - (dfs_compress_decls): Likewise. - * tree.c (layout_basetypes): Likewise. - * typeck.c (build_component_ref): Likewise. - (build_x_function_call): Likewise. - (build_modify_expr): Likewise. - (convert_for_initialization): Likewise. - (build_functional_cast): Likewise. - * cp-tree.h (CLASSTYPE_FIRST_CONVERSION): Likewise. - (CTOR_NAME): New. - (DTOR_NAME): New. - * decl.c (ctor_identifier): New. - (dtor_identifier): New. - (init_decl_processing): Set them. - -Mon Mar 18 18:00:51 1996 Mike Stump - - * typeck.c (build_component_ref): Don't get confused by fields whose - context has no type name, like pointer to member functions. - -Mon Mar 18 13:19:03 1996 Jason Merrill - - * decl.c (grokdeclarator): Handle typedef without declarator. - - * pt.c (tsubst): Handle SCOPE_REF in declarator. - - * parse.y (bad_parm): Catch another case of missing `typename'. - - * lex.c (yyprint): Handle TYPE_DECLs. - - * decl.c (start_function): Don't try to be clever. - - * lex.c: Lose compiler_error_with_decl. - * typeck2.c: Lose error_with_aggr_type. - (incomplete_type_error): Use cp_* instead of old functions. - (readonly_error): Likewise. - * typeck.c (convert_arguments): Likewise. - * search.c (lookup_nested_field): Likewise. - * method.c (make_thunk): Likewise. - * decl.c (grokparms): Likewise. - * cp-tree.h: Update. - - * tree.c (min_tree_cons): Call copy_to_permanent for the purpose - and value. - -Mon Mar 18 11:25:52 1996 Bob Manson - - * method.c (build_opfncall): When deleting a pointer to an - array, build a new pointer to the tree past any ARRAY_TYPE - nodes. - -Mon Mar 18 10:11:46 1996 Brendan Kehoe - - * decl.c (lookup_name_real): Initialize local var TYPE to NULL_TREE. - -Fri Mar 15 11:03:57 1996 Jason Merrill - - * pt.c (instantiate_decl): Only call import_export_decl if at_eof - and ! DECL_INLINE. - - * decl.c (finish_function): Don't set nested based on - hack_decl_function_context. - * parse.y (function_try_block): Check for nested function. - (pending_inlines): Likewise. - - * decl2.c (build_expr_from_tree): If a unary op already has a - type, just return it. - - * decl2.c (finish_prevtable_vardecl): Use ADJUST_VTABLE_LINKAGE. - - * decl2.c (walk_vtables): vardecl_fn returns int; return 1 if it does. - (finish_file): Check the return value of walk_vtables. - (finish_prevtable_vardecl): Return int. - (finish_vtable_vardecl): Likewise. - (prune_vtable_vardecl): Likewise. - * lex.c (set_vardecl_interface_info): Likewise. - * cp-tree.h: Adjust return types. - - * class.c (delete_duplicate_fields_1): Don't complain about - duplicate nested types if they're the same type. - (finish_struct): Remove check for duplicate. - * decl2.c (grokfield): Don't check for typedef of anonymous type. - -Thu Mar 14 10:00:19 1996 Jason Merrill - - * cp-tree.h: Lose SIGNATURE_GROKKING_TYPEDEF. - - * decl.c (grokdeclarator): Lose special handling of class-level - typedef. Lose SIGNATURE_GROKKING_TYPEDEF. Set - SIGNATURE_HAS_OPAQUE_TYPEDECLS later. - - * cvt.c (convert_pointer_to_real): Retain cv-quals in conversion. - - * pt.c (tsubst_copy): Strip cv-quals from destructor name types. - - * search.c (compute_access): Fix handling of anonymous union - members. - * class.c (finish_struct_anon): Propagate TREE_{PRIVATE,PROTECTED} - from anonymous unions to their members. - - * typeck.c (build_x_function_call): For static member functions, - hand off to build_member_call. - -Wed Mar 13 14:03:34 1996 Jason Merrill - - * typeck.c (build_component_ref): Handle OFFSET_REFs. - - * init.c (expand_vec_init): Fix init == 0 case. - -Tue Mar 12 14:36:02 1996 Jason Merrill - - * init.c (build_new): pedwarn about init and array new. - (expand_vec_init): Handle lists, use convert_for_initialization. - - * typeck.c (convert_for_initialization): Pass LOOKUP_NO_CONVERSION - when converting to an aggregate type. - * cvt.c (cp_convert): Pass it through. - - * typeck.c (build_conditional_expr): Handle user-defined - conversions to slightly different types. - - * decl.c (grokdeclarator): Force an array type in a parm to be - permanent. - - * decl2.c (do_using_directive): Sorry. - (do_namespace_alias): Likewise. - * lex.c (real_yylex): Warn about using the `namespace' keyword. - -Sun Mar 10 22:26:09 1996 Jason Merrill - - * parse.y (datadef): Move call to note_list_got_semicolon up. - -Fri Mar 8 11:47:26 1996 Mike Stump - - * tree.c (unsave_expr): Don't unsave, UNSAVE_EXPRs. - -Fri Mar 8 11:29:06 1996 Mike Stump - - * decl.c (cp_finish_decl): The exception regions have to be - nested, not overlapping. We start the exception region for a - decl, after it has been fully built, and all temporaries for it - have been cleaned up. - -Thu Mar 7 17:46:06 1996 Mike Stump - - * tree.c (vec_binfo_member): Don't core dump if we have no bases. - -Thu Mar 7 14:11:49 1996 Jason Merrill - - * tree.def: Add RETURN_INIT. - * pt.c (instantiate_decl): Handle RETURN_INIT. - * decl.c (store_return_init): Handle minimal_parse_mode. - - * tree.c (cp_build_type_variant): Just return an error_mark_node. - * decl.c (make_typename_type): Don't try to get the file and line - of an identifier. - * typeck.c (comptypes): Handle TYPENAME_TYPE. - -Wed Mar 6 18:47:50 1996 Per Bothner - - * decl.c (poplevel): Make sure we clear out and restore old local - non-VAR_DECL values by default when they go out of scope. - -Wed Mar 6 09:57:36 1996 Jason Merrill - - * method.c (build_overload_value): Use DECL_ASSEMBLER_NAME in - referring to addresses of variables and functions. - - * error.c (dump_expr): Support SIZEOF_EXPR. - - * init.c (do_friend): Use the return value of check_classfn. - - * typeck.c (convert_arguments): Call complete_type. - - * method.c (hack_identifier): After giving an error, set value to - error_mark_node. - -Tue Mar 5 16:00:15 1996 Jason Merrill - - * tree.c (hack_decl_function_context): Kludge around DECL_CONTEXT - lossage for local classes. - * cp-tree.h: Declare it. - * decl.c (lookup_name_real): Evil, painful hack for local classes. - (grokfndecl): Set DECL_CLASS_CONTEXT and DECL_NO_STATIC_CHAIN here. - Use hack_decl_function_context. - (grokdeclarator): Don't set DECL_NO_STATIC_CHAIN here. - (start_function): Use hack_decl_function_context. - (finish_function): Likewise. - * method.c (synthesize_method): Likewise. - * lex.c (process_next_inline): Likewise. - (do_pending_inlines): Likewise. - * decl2.c (finish_file): Unset DECL_STATIC_FUNCTION_P when we're - done with it. - -Mon Mar 4 22:38:39 1996 Gerald Baumgartner - - * sig.c (build_signature_pointer_or_reference_type): Align - signature pointers/references on 8-byte boundaries so they can be - grabbed 2 words at a time on a Sparc. - -Tue Mar 5 10:21:01 1996 Jason Merrill - - * method.c (hack_identifier): Requiring a static chain is now a - hard error. - * decl.c (grokdeclarator): Set DECL_NO_STATIC_CHAIN on nested - functions. - -Mon Mar 4 20:03:33 1996 Jason Merrill - - * init.c (build_offset_ref): Call complete_type. - - * decl.c (pop_from_top_level): Always pop previous_class_type. - - * parse.y: Handle multiple decls in a for-init-statement. - * pt.c (tsubst_expr): Likewise. - - * pt.c (tsubst): Use tsubst_expr for the second operand of an - ARRAY_REF. - - * decl.c (maybe_push_to_top_level): Don't save previous_class_type. - (poplevel_class): Set it here. - (pop_from_top_level): Pop it here if we're returning to class scope. - * class.c (pushclass): Don't set it here. - - * decl.c (maybe_push_to_top_level): Save current_template_parms, - and clear it if !pseudo. - (pop_from_top_level): Restore it. - - * decl2.c (finish_file): Push the dummy each time we walk the list - of vtables. - - * error.c (dump_expr): Support LOOKUP_EXPR and actually do - something for CAST_EXPR. - -Mon Feb 19 14:49:18 1996 Rusty Russell - - * cvt.c (cp_convert): Warn about implicit conversion of the - address of a function to bool, as it is always true. - -Fri Feb 23 23:06:01 1996 Rusty Russell - - * typeck.c (c_expand_return): Fix warning for local externs returned. - -Mon Mar 4 15:03:11 1996 Jason Merrill - - * tree.c (mapcar): Propagate const and volatile properly. - - * typeck.c (complete_type): Be sure to instantiate the - MAIN_VARIANT of the type. - - * method.c (synthesize_method): Class interface hackery does not - apply to synthesized methods. - -Mon Mar 4 14:05:23 1996 Jason Merrill - - * pt.c (comp_template_args): Use comptypes rather than just - checking for TEMPLATE_TYPE_PARM equivalence. - - * typeck.c (build_x_function_call): Call complete_type before - checking TYPE_OVERLOADS_CALL_EXPR. - -Mon Mar 4 18:48:30 1996 Manfred Hollstein - - * g++.c (main): Check also for new define ALT_LIBM. - -Fri Mar 1 13:09:33 1996 Jason Merrill - - * pt.c (instantiate_class_template): If we don't have a pattern - yet, that's OK. - (coerce_template_parms): If we see a local class, bail. - - * decl.c (grok_reference_init): Make sure there's a type before - checking its code. - - * pt.c (do_function_instantiation): Avoid crashing on invalid decls. - (push_template_decl): Likewise. - - * parse.y (named_class_head): Set - CLASSTYPE_TEMPLATE_SPECIALIZATION here if we have basetypes. - - * decl.c (xref_tag): Diagnose redeclaration of template - type-parameter name. - - * error.c (dump_type): Handle anonymous template type parms. - - * pt.c (instantiate_template): Use TYPE_MAIN_DECL instead of - TYPE_STUB_DECL. - (coerce_template_parms): Likewise. - -Thu Feb 29 16:26:01 1996 Mike Stump - - * class.c (instantiate_type, case {ARRAY,INDIRECT}_REF, - case ADDR_EXPR): Don't modify rhs if a subinstantiation fails. - -Thu Feb 29 08:20:25 1996 Jason Merrill - - * pt.c (instantiate_template): Take the MAIN_VARIANT of the type - before trying to get its STUB_DECL. - (coerce_template_parms): Likewise. - - * parse.y (template_type_parm): If they didn't use 'class', - pretend they did after giving an error. - - * pt.c (coerce_template_parms): Diagnose use of local class. - - * decl.c (grok_reference_init): Use instantiate_type. - - * error.c (dump_expr): Handle TEMPLATE_DECLs. - - * parse.y (named_class_head): Diagnose mismatching types and tags. - - * decl.c (pushdecl): Type decls and class templates clash with - artificial type decls, not hide them. - - * decl.c (redeclaration_error_message): Diagnose redefinition of - templates properly. - (duplicate_decls): Diagnose disallowed overloads for template - functions, too. - - * decl.c (start_decl): Call complete_type before checking for a - destructor. - - * pt.c (tsubst): Use tsubst_expr on the elts of a VEC. - - * decl.c (xref_tag): A TEMPLATE_TYPE_PARM is a match. - -Wed Feb 28 09:28:44 1996 Jason Merrill - - * decl.c (grok_op_properties): Don't check for operator++(int) in - a template. - - * tree.c (perm_manip): Return a copy of variable and function - decls with external linkage. - - * tree.def: Change some of the min tree codes to type "1". - * pt.c (uses_template_parms): Handle 'e's, return 1 for LOOKUP_EXPRs. - * method.c (build_overload_int): Emit something arbitrary for - anything but an INTEGER_CST if we're in a template. - - * decl.c (cp_finish_decl): Call complete_type before deciding - whether or not to lay out the decl. - - * lex.c (do_identifier): Check for DECL_INITIAL before using it. - -Tue Feb 27 16:35:32 1996 Jason Merrill - - * typeck2.c (build_x_arrow): Call complete_type. - - * pt.c (add_pending_template): Broken out. - (lookup_template_class): If -fexternal-templates, call it for all - the methods of implemented types. - (instantiate_class_template): Instead of instantiating them here. - (instantiate_decl): Handle -fexternal-templates earlier. - -Tue Feb 27 15:51:32 1996 Brendan Kehoe - - * search.c, lex.c, decl.c, class.c, cp-tree.h: Don't wrap the - memoized lookup stuff inside GATHER_STATISTICS. - -Tue Feb 27 10:38:08 1996 Jason Merrill - - * decl.c (start_decl): Complain about array of incomplete type - here. - (grokdeclarator): Not here. - - * parse.y (template_parm): Expand full_parm inline so we can set - the rule's precedence. - - * pt.c (tsubst_expr): If we're in a template, just do tsubst_copy. - (tsubst): tsubst_expr the DECL_INITIAL of FIELD_DECLs. - * decl2.c (grokbitfield): Don't check for integer constant here. - * class.c (finish_struct_1): Check here. - - * decl.c (define_label): Make the min decl go on permanent_obstack. - - * pt.c (unify): Don't handle CONST_DECLs. - (uses_template_parms): Don't check DECL_INITIAL on a CONST_DECL. - (tsubst_copy): Likewise. - - * lex.c (do_identifier): Do pull the DECL_INITIAL out of a - CONST_DECL for a template parm. - -Mon Feb 26 12:48:18 1996 Jason Merrill - - * decl.c (grokdeclarator): Complain about array of incomplete type - here. - (start_decl_1): Not here. - - * pt.c (tsubst): Handle pointer-to-function declarators. - - * method.c (hack_identifier): If pedantic, diagnose local class - methods that require a static chain. - - * decl.c (grok_op_properties): No longer static. - * cp-tree.h: Declare it. - * pt.c (tsubst): Call it for operators. - Use tsubst_copy for TREE_VECs. - - * parse.y (template_arg): The expr has precedence like '>'. - -Fri Feb 23 14:51:52 1996 Jason Merrill - - * pt.c (coerce_template_parms): Don't coerce an expression using - template parms. - (uses_template_parms): Also check DECL_INITIAL in CONST_DECLs. - (tsubst): Don't use build_index_2_type if the max_value uses template - parms. - * method.c (build_overload_int): Emit something arbitrary for an - expression using template parms. - - * parse.y (template_close_bracket): New non-terminal to catch use - of '>>' instead of '> >' in template class names. - (template_type): Use it. - * Makefile.in (CONFLICTS): Causes one more r/r conflict. - - * tree.def: Add CAST_EXPR. - * typeck2.c (build_functional_cast): Use CAST_EXPR instead of - CONVERT_EXPR for minimal_parse_mode. - * typeck.c (build_c_cast): Likewise. - * pt.c (tsubst_copy): Likewise. - * decl2.c (build_expr_from_tree): Likewise. - * error.c (dump_expr): Likewise. - -Fri Feb 23 10:36:46 1996 Brendan Kehoe - - * except.c (SetTerminate, SetUnexpected): Put back global vars. - (init_exception_processing): Put back decl/init of - set_unexpected_fndecl and set_terminate_fndecl, needed to get the - fns from libstdc++. - - * decl.c (struct binding_level): Delete ACCEPT_ANY bitfield. - (declare_uninstantiated_type_level, uninstantiated_type_level_p): - Delete unused fns. - * cp-tree.h (declare_uninstantiated_type_level, - uninstantiated_type_level_p): Delete prototypes. - -Thu Feb 22 19:36:15 1996 Jason Merrill - - * pt.c (tsubst_expr): Add default return. - -Thu Feb 22 16:47:24 1996 Brendan Kehoe - - * error.c (fndecl_as_string): Delete unused arg CNAME. - * sig.c (build_signature_table_constructor, - build_signature_method_call): Fix calls. - - * class.c (the_null_vtable_entry): Delete var definition. - (init_class_processing): Delete tree the_null_vtable_entry init. - * decl.c (no_print_{functions, builtins}): Declare as static. - (__tp_desc_type_node): #if 0 var definition. - (init_type_desc): #if 0 init of __tp_desc_type_node. - (vb_off_identifier): Move var decl into init_decl_processing. - (current_function_assigns_this): Declare as static. - (int_ftype_ptr_ptr_int, void_ftype_ptr_int_int): Delete var decls. - (init_decl_processing): Delete init of void_ftype_ptr_ptr_int. - Move decls of string_ftype_ptr_ptr and int_ftype_string_string here. - * decl2.c (delete_sanity): Delete definition/mod of local var ELT_SIZE. - * init.c (BI_header_type, BI_header_size): Declare as static. - * pt.c (template_classes): Delete unused var. - (add_pending_template): Delete decl for non-existent fn. - (lookup_template_class): Delete vars CODE and TAG_CODE. - (instantiate_template): Delete unused var TARGS. - * cp-tree.h (vb_off_identifier, current_function_assigns_this): - Delete decls. - (__tp_desc_type_node): #if 0 var decl. - (fndecl_as_string): Fix prototype. - -Thu Feb 22 15:56:19 1996 Jason Merrill - - * tree.def: Add GOTO_STMT. - * pt.c (tsubst_expr): Support goto and labels. - * decl.c (define_label): Support minimal parsing. - * parse.y (simple_stmt): Likewise. - -Thu Feb 22 15:30:12 1996 Brendan Kehoe - - * xref.c (GNU_xref_member): Only define/set var I if - XREF_SHORT_MEMBER_NAMES is defined, to match when it's actually - used. - (GNU_xref_end_scope): Delete unused fifth arg TRNS. - (GNU_xref_end): Fix call. - * decl.c (poplevel, poplevel_class, finish_method): Fix calls. - * cp-tree.h (GNU_xref_end_scope): Fix prototype. - - * tree.c (build_exception_variant): Delete unused vars I, A, T, - T2, and CNAME. - (layout_vbasetypes): Delete unused var NONVIRTUAL_VAR_SIZE. - (mapcar): Delete unused var CODE. - (build_cplus_new): Delete unused arg WITH_CLEANUP_P. - (break_out_cleanups): Fix call. - (bot_manip): Likewise. - * call.c (build_method_call): Likewise. - * cvt.c (build_up_reference, convert_to_reference, cp_convert): - Likewise. - * typeck.c (unary_complex_lvalue, build_modify_expr, - convert_for_initialization): Likewise. - * typeck2.c (build_functional_cast): Likewise. - * cp-tree.h (build_cplus_new): Fix prototype. - - * repo.c (open_repo_file): Delete unused var Q. - (repo_compile_flags, repo_template_declared, - repo_template_defined, repo_class_defined, repo_inline_used, - repo_vtable_used, repo_tinfo_used): #if 0 unused fns. - (repo_get_id, repo_vtable_used): Declare as static. - * cp-tree.h (mark_{decl,class}_instantiated, finish_repo): Add - prototypes. - -Thu Feb 22 14:53:35 1996 Jason Merrill - - * parse.y (pending_inlines): Add function_try_block case. - - * pt.c (unify): Fix for template const parms. - -Thu Feb 22 13:24:15 1996 Brendan Kehoe - - * lex.c (extract_interface_info): Delete forward decl. - (default_copy_constructor_body, default_assign_ref_body): Delete - decls for non-existent functions. - (synth_firstobj, inline_text_firstobjs): Delete unused vars. - (init_lex): Delete setting them. - (cons_up_default_function): Delete unused vars FUNC_BUF, - FUNC_LEN, and COMPLEX. Delete code setting COMPLEX. Delete old - #if 0'd synth code. - (toplevel, expression_obstack): Delete unused extern decls. - (tree_node_kind): Delete unused enum. - (tree_node_counts, tree_node_sizes): Wrap with #ifdef - GATHER_STATISTICS. - (tree_node_kind_names): Delete unused extern decl. - (synth_obstack): Delete unused var. - (init_lex): Don't set it. - (init_parse): Add decl before use. - (reduce_count): Only define #ifdef GATHER_STATISTICS && REDUCE_LENGTH. - (current_unit_{name, language}): Delete unused vars. - (check_newline): Don't bother setting them, just accept the #pragma. - * cp-tree.h (init_repo, peek_yylex): Add prototypes. - (current_unit_{name, language}): Delete decls. - - * search.c: Wrap all of the memoized functions, macros, and - variables inside #ifdef GATHER_STATISTICS. - (lookup_field, lookup_fnfields): Likewise. - (init_search_processing): Likewise. - (reinit_search_statistics): Wrap whole function. - * lex.c (reinit_lang_specific): Wrap call to reinit_search_statistics. - - * decl.c (finish_function): Only call pop_memoized_context if - GATHER_STATISTICS is defined. - (start_function): Likewise for push_memoized_context. - * class.c (pushclass, popclass): Likewise. - - * cp-tree.h (CLASSTYPE_MTABLE_ENTRY): Move definition from here... - * search.c (CLASSTYPE_MTABLE_ENTRY): ... to here. - - * cvt.c (cp_convert): Delete unused local var FORM. - * cp-tree.h (can_convert, can_convert_arg, real_lvalue_p): Add - prototypes. - -Thu Feb 22 13:19:44 1996 Jason Merrill - - * pt.c (do_poplevel): Oops; really return what we get from - poplevel this time. - -Thu Feb 22 11:41:44 1996 Brendan Kehoe - - * cp-tree.h (is_aggr_type): Add prototype. - - * cp-tree.h ({push,pop}_cp_function_context): Add decls. - * method.c ({push,pop}_cp_function_context): Delete decls. - * except.c (start_eh_unwinder, end_eh_unwinder): Declare as void. - (SetUnexpected, SetTerminate): Delete unused vars. - (init_exception_processing): Don't set SetUnexpected or - SetTerminate. Don't set SET_UNEXPECTED_FNDECL or SET_TERMINATE_FNDECL. - (output_exception_table_entry): Delete unused array LABEL. - (expand_internal_throw): Delete unused var PARAMS. - (expand_start_catch_block): Delete unused var CLEANUP. - (emit_exception_table): Delete unused var EH_NODE_DECL. - (expand_builtin_throw): Delete unused vars UNWIND_AND_THROW and - GOTO_UNWIND_AND_THROW. Don't set them. - (end_eh_unwinder): Add top decl. - (pop_rtl_from_perm): Delete unused decl of PERMANENT_OBSTACK. - (exception_section, push_rtl_perm, do_function_call, - lang_interim_eh, push_eh_cleanup, eh_outer_context, - expand_end_eh_spec, end_eh_unwinder): Declare as static. - (saved_pc, saved_throw_type, saved_throw_value, saved_cleanup, - throw_used): Likewise. - * cp-tree.h (expand_end_eh_spec): Delete prototype. - - * search.c (dfs_mark, dfs_mark_vtable_path, - dfs_unmark_vtable_path, dfs_mark_new_vtable, - dfs_unmark_new_vtable, dfs_clear_search_slot, - dfs_search_slot_nonempty_p, bfs_markedp, bfs_unmarkedp, - bfs_marked_vtable_pathp, bfs_unmarked_vtable_pathp, - bfs_marked_new_vtablep, bfs_unmarked_new_vtablep): #if 0 unused - functions. - (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, - n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, - n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): - Only define #ifdef GATHER_STATISTICS. - (reinit_search_statistics): Only init some vars if GATHER_STATISTICS - is defined. - (vbase_decl): Delete var definition. - (init_search): Delete old decl. - (init_vbase_pointers): Delete building of VBASE_DECL, since it's - never actually used. - (expand_indirect_vtbls_init): Delete init of VBASE_DECL. - (get_base_distance_recursive): Delete unused fourth arg - BASETYPE_PATH. Fix call . - (get_base_distance): Fix call. - (push_class_decls): Delete unused var ID. - (make_memoized_table_entry): Declare as static. - (breadth_first_search): Declare as static. - (tree_has_any_destructor_p): Declare as static. - (pop_class_decls): Delete unused arg pop_class_decls. - * class.c (popclass): Fix call to pop_class_decls. - * cp-tree.h (make_memoized_table_entry, breadth_first_search, - tree_has_any_destructor_p): Delete prototypes. - - * rtti.c (build_ptmf_desc): Delete unused arg TYPE. - (build_t_desc): Fix call. Delete unused vars ELEMS and TT. - (build_dynamic_cast): Delete unused local vars TMP1 and RETVAL. - (build_user_desc): Delete unused var T. - (build_class_desc): Delete unused vars T and OFF. - (build_t_desc): Delete unused var NAME_STRING. - (build_headof): Make static. - (get_bad_cast_node): Likewise. - (get_def_to_follow): Likewise. - * cp-tree.h (init_type_desc): Add prototype. - (build_headof): Remove prototype. - -Thu Feb 22 00:54:22 1996 Jason Merrill - - * pt.c (tsubst): Only look for matching decls at file scope for - non-member functions. - - * call.c (build_scoped_method_call): Handle scoped destructor - calls in templates. - - * decl.c (*_top_level): Also save previous_class_values. - - * pt.c (tsubst_expr): Support do {} while loops. - * parse.y (simple_stmt): Likewise. - * tree.def: Likewise. - - * method.c (build_overload_identifier): For a class nested in a - template class, don't mangle in the template parms from our - context. - - * lex.c, cp-tree.h: Remove support for template instantiations in - the pending_inlines code. - * pt.c: Remove dead functions and unused arguments. - (uses_template_parms): TYPENAME_TYPEs always use template parms. - * parse.y: Stop passing anything to end_template_decl. - * tree.c (print_lang_statistics): Only print tinst info #ifdef - GATHER_STATISTICS. - -Wed Feb 21 16:57:33 1996 Brendan Kehoe - - * init.c (expand_recursive_init{,_1}): Delete decls. - (sort_member_init): Delete unused var INIT. - (emit_base_init): Delete unused var X. - (build_offset_ref): Delete unused var CNAME. - (sort_member_init): Delete unused var FIELDS_TO_UNMARK. - (emit_base_init): Delete unused local var BASE. Delete extern - decl of IN_CHARGE_IDENTIFIER. - (build_delete): Delete unused local var VIRTUAL_SIZE. - - * init.c (build_vec_delete): Delete unused third arg ELT_SIZE. - (build_delete): Fix call. - * decl2.c (delete_sanity): Likewise. - * cp-tree.h (build_vec_delete): Update prototype. - - * typeck.c (common_base_type): Delete unused var TMP. - (build_binary_op): Delete local var ARGS_SAVE. - (build_array_ref): Delete unused var ITYPE. - (c_expand_return): Delete unused var USE_TEMP. - - * typeck.c (compexcepttypes): Delete unused arg STRICT. - (comptypes): Fix calls. - * decl.c (duplicate_decls): Likewise. - * cp-tree.h (compexcepttypes): Delete extra arg. - - * decl2.c (check_classfn): Delete unused second arg CNAME. - * decl.c (start_decl, grokfndecl): Fix calls. - * init.c (do_friend): Likewise. - * cp-tree.h (check_classfn): Update prototype. - - * cp-tree.h (signature_error, import_export_vtable, - append_signature_fields, id_in_current_class, mark_used, - copy_assignment_arg_p): Add decls. - * decl2.c (mark_used): Delete decl. - - * class.c (n_*): Wrap with #ifdef GATHER_STATISTICS. - - * class.c (get_vtable_entry): Disable unused function. - (doing_hard_virtuals): Delete unused static global var. - (finish_struct_1): Don't init DOING_HARD_VIRTUALS. - (prepare_fresh_vtable): Delete unused vars PATH and RESULT. - (overrides): Delete unused vars RETTYPE and BASE_RETTYPE. - (modify_one_vtable): Delete unused var OLD_RTTI. - (finish_struct_anon): Delete unused vars OFFSET and X. - (finish_struct_bits): Delete unused var METHOD_VEC. - (get_basefndecls): Delete unused var PURPOSE. Delete unused - for-scope local variable METHODS. - - * call.c (user_harshness): Delete unused/unneeded arg PARM. - (ideal_candidate): Delete unused args BASETYPE and PARMS. - (build_method_call): Delete unused args passed into ideal_candidate. - (build_overload_call_real): Likewise. Delete unused var OVERLOAD_NAME. - * cp-tree.h (synthesize_method): Add decl. - - * decl.c (note_level_for_for): Give void return type. - (pushdecl_nonclass_level): Likewise. - (finish_function): Delete unused vars VFIELDS and ALLOCATED_THIS. - (poplevel): Delete unused var IMPLICIT_TRY_BLOCK. - (suspend_binding_level): Delete unused var LEVEL. - (duplicate_decls): Delete unused var CTYPE. - (duplicate_decls): Delete unused var PREVIOUS_C_DECL. - (init_decl_processing): Delete unused vars FLOAT_ENDLINK and - PTR_ENDLINK. - (grokdeclarator): Delete unused var C. - (grokdeclarator): Delete unused var SIZE_VARIES. - (grokparms): Delete unused var SAW_VOID. - (start_function): Delete unused var OLDDECL. - (cplus_expand_expr_stmt): Delete unused var - REMOVE_IMPLICIT_IMMEDIATELY. - - * cp-tree.h (pushdecl_nonclass_level): Fix prototype. - - * Makefile.in (CONFLICTS): Update to 12 shift/reduce. - -Wed Feb 21 00:06:17 1996 Jason Merrill - - * tree.c (build_min): Set TREE_COMPLEXITY to lineno. - (build_min_nt): Likewise. - * pt.c (do_pushlevel): Emit line note. - (do_poplevel): Return what we get from poplevel. - (tsubst_expr): Set lineno from TREE_COMPLEXITY in stmt nodes. - * parse.y: Use do_pushlevel and do_poplevel. - * cp-tree.h: Declare do_poplevel. - - * cp-tree.h: Declare at_eof. - * decl.c (cp_finish_decl): Pass it to rest_of_decl_compilation. - * decl2.c (import_export_decl): Renamed from import_export_inline. - (finish_file): Call it to do interface handling for statics. - * pt.c (tsubst_copy): Call mark_used on variables and functions - used here. - - * decl2.c (finish_file): Don't emit statics we can't generate. - * pt.c (instantiate_decl): Don't set interface on instantiations - we can't generate. - - * cp-tree.h (struct tinst_level): Change 'classname' to 'decl'. - * tree.c (print_lang_statistics): Print max template depth. - * pt.c (push_tinst_level): Dump entire instantiation context. - (instantiate_class_template): Use it and pop_tinst_level. - (instantiate_decl): Likewise. - - * call.c class.c cp-tree.h decl.c decl2.c error.c lex.c method.c - pt.c ptree.c tree.def: Remove all traces of UNINSTANTIATED_P_TYPE. - -Tue Feb 20 18:21:51 1996 Jason Merrill - - * call.c class.c cp-tree.h cvt.c decl.c decl2.c error.c expr.c - init.c lex.c method.c parse.y pt.c repo.c search.c spew.c tree.c - tree.def typeck.c typeck2.c xref.c: Massive, systemic changes for - the new template implementation. - -Tue Feb 20 17:14:29 1996 Brendan Kehoe - - * decl2.c (check_cp_case_value): Use STRIP_TYPE_NOPS. - -Thu Feb 15 18:44:42 1996 Mike Stump - - * decl.c (cp_finish_decl): Delay emitting the debug information for - a typedef that has been installed as the canonical typedef, if the - type has not yet been defined. - -Thu Feb 15 09:39:08 1996 Jason Merrill - - * decl2.c (grokfield): Still call pop_nested_class for access decls. - -Wed Feb 14 17:30:04 1996 Brendan Kehoe - - * decl.c (lookup_label): Call label_rtx. - - * decl.c (make_binding_level): New function. - (pushlevel, pushlevel_class): Call it instead of explicit - duplicate calls to xmalloc. - - * decl.c (init_decl_processing): Delete useless build_pointer_type - call. - - * decl.c (float_ftype_float, ldouble_ftype_ldouble): Add definitions. - (sizet_ftype_string): Delete variable. - (init_decl_processing): Add built-in functions fabsf, fabsl, - sqrtf, sqrtl, sinf, sin, sinl, cosf, cos, cosl. New local - variable strlen_ftype, used for strlen. - -Wed Feb 14 16:21:25 1996 Jason Merrill - - * decl.c (push_to_top_level): Start from current_binding_level - again for now; the stl hacks depend on g++ being broken in this - way, and it'll be fixed in the template rewrite. - - * tree.def: Add USING_DECL. - * decl2.c (do_class_using_decl): Implement. - (grokfield): Pass access decls off to do_class_using_decl instead of - grokdeclarator. - * error.c (dump_decl): Handle USING_DECLs. - * decl.c (grokdeclarator): Remove code for handling access decls. - * class.c (finish_struct_1): Adjust accordingly, treat using-decls - as access decls for now. - (finish_struct): Don't check USING_DECLs for other uses of the name. - - * search.c (get_matching_virtual): Use cp_error_at. - -Wed Feb 14 10:36:58 1996 Brendan Kehoe - - * typeck.c (comptypes): Default COMP_TYPE_ATTRIBUTES to 1, to - match c-typeck.c. - (self_promoting_args_p): Move the check that TYPE is non-nil - before trying to look at its main variant. - (unsigned_type, signed_type): Add checking of DI/SI/HI/QI nodes. - - * cp-tree.h (DECL_WAITING_FRIENDS, SET_DECL_WAITING_FRIENDS): - Delete macros. - * init.c (xref_friend, embrace_waiting_friends): Delete functions. - (do_friend): Delete call to xref_friend. - * class.c (finish_struct_1): Delete call to embrace_waiting_friends. - - * typeck.c (convert_sequence): #if 0 unused function. - - * cp-tree.h (DECL_IN_MEMORY_P): New macro w/ the check that used to - be in decl_in_memory_p. - (decl_in_memory_p): Delete decl. - * expr.c (decl_in_memory_p): Delete fn. - * typeck.c (mark_addressable): Use DECL_IN_MEMORY_P. - - * decl.c (cp_finish_decl): Use DECL_IN_MEMORY_P. - -Tue Feb 13 12:51:21 1996 Jason Merrill - - * class.c (finish_struct_1): Check for a pure-specifier on a - non-virtual function here. - - * decl2.c (grok_function_init): Don't check whether the function - is virtual here. - (grokfield): Don't call check_for_override here. - - * decl.c (push_to_top_level): Start from inner_binding_level, - check class_shadowed in class levels. - -Mon Feb 12 17:46:59 1996 Mike Stump - - * decl.c (resume_level): Ignore things that don't have names, instead - of core dumping. - -Mon Feb 12 15:47:44 1996 Brendan Kehoe - - * decl2.c (grokfield): Set DECL_VINDEX properly for FUNCTION_DECLs. - -Sat Feb 10 17:59:45 1996 Jason Merrill - - * class.c (finish_struct_1): Set DECL_VINDEX properly on a - synthesized dtor. - - * parse.y (complete_type_name): Bind global_scope earlier. - (complex_type_name): Likewise. - (qualified_type_name): Remove. - -Thu Feb 8 15:15:14 1996 Jason Merrill - - * decl.c (grokfndecl): Move code that looks for virtuals in base - classes... - * class.c (check_for_override): ... to a new function. - (finish_struct_1): Call it. - - * cp-tree.h: Declare warn_sign_compare. - - * typeck.c (build_binary_op_nodefault): Check warn_sign_compare - rather than extra_warnings to decide whether to warn about - comparison of signed and unsigned. - - * decl2.c (lang_decode_option): Handle warn_sign_compare. -Wall - implies -Wsign-compare. -Wall doesn't imply -W. - -Wed Feb 7 15:27:57 1996 Mike Stump - - * typeck.c (build_component_ref): Fix to handle anon unions in base - classes as well. - -Wed Feb 7 14:29:12 1996 Brendan Kehoe - - * class.c (resolves_to_fixed_type_p): Delete code dealing with - a WITH_CLEANUP_EXPR, since we don't generate them any more. - * cvt.c (build_up_reference): Likewise. - * decl.c (grok_reference_init): Likewise. - (cp_finish_decl): Likewise. - * error.c (dump_expr): Likewise. - * tree.c (real_lvalue_p): Likewise. - (lvalue_p): Likewise. - (build_cplus_new): Likewise. - (unsave_expr_now): Likewise. - * typeck.c (unary_complex_lvalue, build_modify_expr, - c_expand_return): Likewise. - -Tue Feb 6 13:39:22 1996 Brendan Kehoe - - Make the C++ front-end pay attention to attributes for structures. - * class.c (finish_struct): New argument ATTRIBUTES, passed down into - finish_struct_1. - (finish_struct_1): New argument ATTRIBUTES; call cplus_decl_attributes. - Take out old round_up_size use and setting the DECL_ALIGN possibly - using it. Take out setting of TYPE_ALIGN to round_up_size, which - can override what the attribute set. - * cp-tree.h (finish_struct): Update prototype. - * parse.y (template_instantiate_once): Pass a NULL_TREE for the - attributes to finish_struct. - (structsp): For a CLASS decl, add maybe_attribute to rule and pass that - value down into finish_struct. - * Makefile.in (CONFLICTS): Switch to 7 shift/reduce conflicts. - -Tue Feb 6 13:12:15 1996 Per Bothner - - * decl.c (poplevel): Re-word dead for local handling. - (pushdecl): Remove useless DECL_DEAD_FOR_LOCAL test. - (cp_finish_decl): If is_for_scope, check for duplicates so - we can disable is_for_scope. Otherwise, preserve_temp_slots. - - * lex.c (do_identifier): Use global binding in preference of - dead for local variable. - -Mon Feb 5 17:46:46 1996 Mike Stump - - * init.c (initializing_context): Handle anon union changes, the - context where fields of anon unions can be initialized now has to be - found by walking up the TYPE_CONTEXT chain. - -Fri Feb 2 14:54:04 1996 Doug Evans - - * decl.c (start_decl): #ifdef out code to set DECL_COMMON - if ASM_OUTPUT{,_ALIGNED}_BSS is defined. - (obscure_complex_init): If bss is supported, always set - DECL_INITIAL to error_mark_node. - -Thu Feb 1 16:19:56 1996 Brendan Kehoe - - * init.c (is_friend): Make sure there's a context before we see if - it's an aggr type. - -Thu Feb 1 15:44:53 1996 Mike Stump - - * init.c (is_friend): Classes are not friendly with nested classes. - -Thu Feb 1 15:27:37 1996 Doug Evans - - * lex.c (check_newline): Pass last character read to HANDLE_PRAGMA, - and record its result. - -Thu Feb 1 09:27:01 1996 Mike Stump - - * class.c (finish_struct_anon): Switch around code to not move anon - union elements around, nor mess up their contexts, nor offsets, - instead we now build up the right number of COMPONENT_REFs for all - the anon unions that may be present at build_component_ref time. - * typeck.c (lookup_anon_field): New routine to handle field lookup - on fields without names. We find them, based upon their unique type - instead. - * typeck.c (build_component_ref): Allow FIELD_DECL components. - Handle finding components in anonymous unions, and ensure that a - COMPONENT_REF is built for each level as necessary. - -Tue Jan 30 18:18:23 1996 Mike Stump - - * cvt.c (build_up_reference): Make the INDIRECT_BIND case come after - code that ensures that copy ctors are used if appropriate. - -Tue Jan 30 17:35:14 1996 Brendan Kehoe - - * init.c (build_vec_delete): Only give an error if base isn't an - error_mark_node. - -Mon Jan 29 17:09:06 1996 Mike Stump - - * spew.c (do_aggr): `new struct S;' isn't a forward declaration. - (yylex): If we see `new', keep slurping. - -Thu Jan 25 18:31:36 1996 Mike Stump - - * class.c (finish_struct_1): Move code for handling anon unions... - (finish_struct_anon): to here. Fixup so that we do the offset - calculations right, and so that the fields are physically moved to - the containers's chain. - -Thu Jan 25 18:27:37 1996 Brendan Kehoe - - * decl.c (grokdeclarator): Avoid trying to get an operand off an - identifier node. - -Wed Jan 24 11:25:30 1996 Jim Wilson - - * typeck.c (pointer_int_sum): Use TYPE_PRECISION (sizetype) not - POINTER_SIZE to agree with expr.c. - -Thu Jan 25 13:01:23 1996 Mike Stump - - * search.c (lookup_field): Don't report ambiguities if protect is 0, - instead return NULL_TREE. - -Wed Jan 24 13:01:26 1996 Mike Stump - - * class.c (finish_struct_1): Call warn_hidden if we want warnings - about overloaded virtual functions. - (warn_hidden): New routine to warn of virtual functions that are - hidden by other virtual functions, that are not overridden. - (get_basefndecls): New routine, used by warn_hidden. - (mark_overriders): New routine, used by warn_hidden. - * search.c (get_matching_virtual): Remove old warning that just - isn't very useful. - -Tue Jan 23 12:26:10 1996 Brendan Kehoe - - * decl.c (output_builtin_tdesc_entries): #if 0 the function definition. - - * typeck.c (null_ptr_cst_p): Delete unused fn. - (build_function_call_maybe): Delete unused fn. - - * expr.c (extract_init): #if 0 the code after unconditional return 0 - for now. - - Delete old cadillac code. - * edsel.c: Remove file. - * Make-lang.in (CXX_SRCS): Take edsel.c off the list. - * Makefile.in (CXX_OBJS): Delete edsel.o. - (edsel.o): Delete rule. - * cp-tree.h (flag_cadillac): Delete var decl. - * lang-options.h: Delete "-fcadillac" and "-fno-cadillac". - * decl2.c (flag_cadillac): Delete var definition. - (lang_decode_option): Delete handling of -fcadillac and -fno-cadillac. - (grokfield): Delete code depending on flag_cadillac. - (finish_anon_union): Likewise. - * class.c (finish_struct_1): Likewise. - (pushclass): Likewise. - (popclass): Likewise. - (push_lang_context): Likewise. - (pop_lang_context): Likewise. - * decl.c (init_decl_processing): Likewise. - (start_decl): Likewise. - (cp_finish_decl): Likewise. - (xref_tag): Likewise. - (finish_enum): Likewise. - (start_function): Likewise. - (finish_function): Likewise. - (finish_stmt): Likewise. - * lex.c (lang_init): Likewise. - (check_newline): Likewise. - - * lex.c (do_pending_inlines): Delete synthesized method kludge. - - Delete defunct, ancient garbage collection implementation. - * rtti.c: New file with the RTTI stuff from gc.c. - * gc.c: Removed file (moved the remaining stuff into rtti.c). - * Makefile.in (CXX_OBJS): Replace gc.o with rtti.o. - (rtti.o): New rule, replacing gc.o. - * Make-lang.in (CXX_SRCS): Replace gc.c with rtti.c. - * cp-tree.h: Delete gc-related fn decls. - (DECL_GC_OFFSET): Delete macro. - (flag_gc): Delete extern decl. - * decl.c (current_function_obstack_index): Delete var decl. - (current_function_obstack_usage): Delete var decl. - (start_function): Delete clearing of current_function_obstack_index - and current_function_obstack_usage. - (init_decl_processing): Delete code relying on -fgc. - Delete call to init_gc_processing. - (cp_finish_decl): Delete calls to build_static_gc_entry and - type_needs_gc_entry. Delete gc code setting DECL_GC_OFFSET. - (store_parm_decls): Delete -fgc calls to cp_expand_decl_cleanup - and to expand_expr of a __gc_main call. - (maybe_gc_cleanup): Delete var decl. - (finish_function): Delete call to expand_gc_prologue_and_epilogue. - * decl2.c (flag_gc): Delete var decl. - (lang_f_options): Delete offering of -fgc. - (lang_decode_option): Delete -fgc and -fno-gc handling. - (get_temp_regvar): Delete gc code. - * init.c (build_new): Delete gc code. - * lex.c (init_lex): Delete checking of flag_gc. - - * typeck.c (convert_arguments): Delete gc code. - (build_component_addr): Delete -fgc warning. - (build_modify_expr): Delete gc code. - - * decl2.c (build_push_scope): Delete fn. - * cp-tree.h (build_push_scope): Delete decl. - - * search.c (clear_search_slots): Delete fn. - * cp-tree.h (clear_search_slots): Delete decl. - - * search.c (tree_needs_constructor_p): Delete fn. - * cp-tree.h (tree_needs_constructor_p): Delete decl. - - * tree.c (id_cmp): Delete fn. - - * tree.c (set_fnaddr_from_vtable_entry): Delete fn. - * cp-tree.h (set_fnaddr_from_vtable_entry): Delete decl. - - * tree.c (decl_value_member): Delete fn. - * cp-tree.h (decl_value_member): Delete decl. - - * tree.c (list_hash_lookup_or_cons): Delete fn. - * cp-tree.h (list_hash_lookup_or_cons): Delete decl. - - * method.c (cplus_exception_name): Delete fn. - (EXCEPTION_NAME_{PREFIX, LENGTH}): Delete macros. - - * spew.c (shift_tokens): Delete fn. - -Mon Jan 22 17:49:33 1996 Jason Merrill - - * except.c (init_exception_processing): Pass 1 to needs_pop in calls - to cp_finish_decl. - * parse.y: Likewise. - -Mon Jan 22 17:34:29 1996 Brendan Kehoe - - * tree.c (build_cplus_staticfn_type): Delete function definition; - never used. - * cp-tree.h (build_cplus_staticfn_type): Delete decl. - - * tree.c (virtual_member): Delete function definition; never used. - * cp-tree.h (virtual_member): Delete decl. - -Fri Jan 19 18:03:14 1996 Mike Stump - - * typeck.c (build_component_ref): Handle getting vbase pointers - out of complex multiple inheritance better. - -Fri Jan 19 16:27:40 1996 Mike Stump - - * typeck.c (build_object_ref): Make sure we use the real type, not - any reference type. - -Fri Jan 19 16:01:47 1996 Mike Stump - - * tree.c (build_exception_variant): Don't create new types if we - don't have to, also build new types on the right obstack. - -Fri Jan 19 14:09:44 1996 Jason Merrill - - * decl.c (store_bindings): Split out from push_to_top_level. - (push_to_top_level): Call it for b->type_shadowed on class binding - levels. - -Fri Jan 19 13:53:14 1996 Mike Stump - - * search.c (expand_upcast_fixups): Fix so that offsets stored in - vbase_offsets are always right. Fixes a problem where virtual base - upcasting and downcasting could be wrong during conversions on this - during virtual function dispatch at ctor/dtor time when dynamic - vtable fixups for deltas are needed. This only sounds easier than - it is. :-) - (fixup_virtual_upcast_offsets): Change to reflect new calling - convention for expand_upcast_fixups. - -Fri Jan 19 12:23:08 1996 Brendan Kehoe - - * decl2.c (grokbitfield): Strip the NOPs from WIDTH before we - check that it's usable as the bitfield width. - -Wed Jan 17 21:22:40 1996 Brendan Kehoe - - * decl2.c (grokfield): Call cplus_decl_attributes with the attrlist. - Pass a null tree to grokdeclarator for its ATTRLIST arg, since it's - only ever used for functions in it. - -Wed Jan 17 12:10:38 1996 Jason Merrill - - * parse.y (qualified_type_name): Use the TYPE_DECL, not the type. - (nested_type): Likewise. - (nested_name_specifier): Use lastiddecl. - - * decl.c (grokdeclarator): Adjust accordingly. - * init.c (expand_member_init): Likewise. - * parse.y (base_class): Likewise. - * typeck2.c (build_functional_cast): Likewise. - - * typeck2.c (build_functional_cast): Fill in name after we've - checked for non-aggr type. - -Wed Jan 17 10:18:01 1996 Mike Stump - - * decl2.c (warn_pointer_arith): Default to on. - -Tue Jan 16 12:45:38 1996 Jason Merrill - - * lex.c (is_rid): New function. - * decl.c (grokdeclarator): Diagnose reserved words used as - declarator-ids. - -Tue Jan 16 11:39:40 1996 Jason Merrill - - * tree.c (get_decl_list): Don't lose cv-quals. - - * decl.c (grokdeclarator): Fix SCOPE_REF handling and diagnose - typespecs used as declarator-ids. - -Tue Jan 16 11:09:42 1996 Mike Stump - - * decl.c (poplevel): When poping a level, don't give a warning for - any subblocks that already exist. - -Tue Jan 16 00:25:33 1996 Jason Merrill - - * typeck.c (build_object_ref): Finish what I started. - - * parse.y (qualified_type_name): Don't check TYPE_BUILT_IN. - - * decl2.c (constructor_name_full): Handle TEMPLATE_TYPE_PARMs. - - * decl.c (grokdeclarator): Also accept TEMPLATE_TYPE_PARM as a - scope. - -Mon Jan 15 16:19:32 1996 Jason Merrill - - * decl.c (xref_tag): Handle passing a type in directly. - - * parse.y (qualified_type_name): Pull out the type. - (nested_type): Likewise. - Take types directly instead of as identifiers. - * call.c (build_scoped_method_call): Take types directly instead of - as identifiers. - * decl.c (xref_basetypes): Likewise. - * init.c (expand_member_init): Likewise. - (build_member_call): Likewise. - (build_offset_ref): Likewise. - * typeck2.c (build_scoped_ref): Likewise, remove bogus code. - * method.c (do_build_assign_ref): Likewise. - * decl.c (grokdeclarator): Handle a type appearing as the - declarator-id for constructors. - * method.c (do_build_copy_constructor): current_base_init_list now - uses the types directly, not their names. - * init.c (sort_base_init): Likewise. - (expand_member_init): Likewise. - * init.c (is_aggr_type): New function, like is_aggr_typedef. - -Mon Jan 15 08:45:01 1996 Jeffrey A Law - - * tree.c (layout_basetypes): Call build_lang_field_decl instead - of build_lang_decl if first arg is a FIELD_DECL. - -Thu Jan 11 14:55:07 1996 Brendan Kehoe - - * decl.c (cp_finish_decl): Only clear TREE_USED if DECL_NAME is - non-empty. - * except.c (expand_start_catch_block): Set TREE_USED to avoid - warnings about the catch handler. - -Mon Jan 8 17:35:12 1996 Jason Merrill - - * typeck.c (build_modify_expr): Use a COMPOUND_EXPR instead of - expand_target_expr. - -Thu Jan 4 12:30:32 1996 Brendan Kehoe - - Fix access control to use trees rather than integers. - * class.c (access_{default, public, protected, private, - default_virtual, public_virtual, private_virtual}_node): Add - definitions. - (init_class_processing): Do creation of those nodes. - * cp-tree.h (access_type): Delete enum decl. - (access_{default, public, protected, private, default_virtual, - public_virtual, private_virtual}_node): Add decls. - (compute_access): Change return type. - * search.c (compute_access): Have tree return type, instead of enum. - (lookup_field): Declare THIS_V and NEW_V to be tree nodes. - * lex.c (real_yylex): Use yylval.ttype for giving the value of the - access_* node for each of RID_{PUBLIC, PRIVATE, PROTECTED}. - * parse.y (VISSPEC): Make ttype rather than itype. - (base_class_access_list): Likewise. - * *.[cy]: Change all refs of `access_public' to `access_public_node', - etc. - * call.c (build_method_call): Make ACCESS be a tree. - * class.c (alter_access, finish_struct_1, filter_struct): Likewise. - * cvt.c (convert_to_aggr): Likewise. - * init.c (build_offset_ref, resolve_offset_ref, build_delete): - Likewise. - * method.c (hack_identifier): Likewise. - * typeck.c (build_component_ref_1, build_component_ref): ): Likewise. - -Thu Jan 4 11:02:20 1996 Mike Stump - - * typeck.c (pointer_int_sum, pointer_diff): Make code agree with C - frontend, and make it more consistent with respect to - warn_pointer_arith. - -Tue Jan 2 00:13:38 1996 Rusty Russell - - * decl.c (pushdecl): Check for duplicate parameter names. - -Wed Jan 3 09:25:48 1996 Mike Stump - - * decl.c (expand_static_init): Call assemble_external for atexit. - -Wed Jan 3 07:55:19 1996 Mike Stump - - * except.c (do_unwind): Remove some generated dead code. - (eh_outer_context): New routine, factor out some common code from - expand_builtin_throw and end_eh_unwinder. Add code to do return - address masking for the PA. - (expand_builtin_throw): Use eh_outer_context instead of open coding - it here. - (end_eh_unwinder): Likewise. - -Tue Jan 2 17:00:56 1996 Mike Stump - - * except.c (expand_throw): Call assemble_external for __empty, if we - use it. - -Thu Dec 28 11:13:15 1995 Mike Stump - - * except.c (expand_builtin_throw): Use RETURN_ADDR_OFFSET instead of - NORMAL_RETURN_ADDR_OFFSET. - (end_eh_unwinder): Likewise. - -Wed Dec 27 22:18:16 1995 Mike Stump - - * gc.c (build_dynamic_cast): Make sure we don't cast away const - when dealing with references, and make sure we handle dynamic - casting to a cv qualified reference. - -Thu Dec 21 23:50:35 1995 Mike Stump - - * except.c (struct eh_context): New structure top hold eh context - information. - (push_eh_context): New routine. - (pop_eh_context): Likewise. - * decl.c (push_cp_function_context): Use them. - (pop_cp_function_context): Likewise. - -Wed Dec 20 12:42:51 1995 Jason Merrill - - * decl2.c (finish_file): Also prune uninteresting functions in the - inline emission loop. - -Wed Dec 20 02:32:07 1995 Jeffrey A Law - - * sig.c (build_signature_table_constructor): Mark functions - in the signature as referenced. - -Tue Dec 19 22:36:56 1995 Jason Merrill - - * decl2.c (finish_file): Do all the vtable/synthesis stuff before - the inline emission stuff. - -Mon Dec 18 15:51:33 1995 Jason Merrill - - * cp-tree.h, decl2.c (flag_weak): New flag to control the use of - weak symbols. - * lang-options.h: Add -f{no-,}weak. - * decl.c (init_decl_processing): If the target does not support weak - symbols, don't use them. - * decl2.c, pt.c: s/SUPPORTS_WEAK/flag_weak/. - -Sun Dec 17 21:13:23 1995 Rusty Russell - - * init.c (expand_member_init): warning for base init after members. - -Fri Dec 15 15:32:18 1995 Jason Merrill - - * cvt.c (build_expr_type_conversion): Don't convert to a reference - type. - -Thu Dec 14 16:05:58 1995 Mike Stump - - * method.c (report_type_mismatch): Improve wording for volatile - mismatches. - -Thu Dec 14 14:16:26 1995 Mike Stump - - * init.c (expand_aggr_init_1): Use expand_aggr_init_1 instead of - expand_assignment, as the later doesn't handle things that have - copy constructors well. The compiler would do bitwise copying, - instead of ctor calling in some cases. - -Wed Dec 13 17:05:54 1995 Paul Eggert - - * g++.c (my_strerror): Return "cannot access" if errno is 0. - (pfatal_with_name, perror_exec): Don't assume that - the returned value from my_strerror contains no '%'s. - (concat): Remove. - (sys_nerror): Declare only if HAVE_STRERROR is not defined. - -Wed Dec 13 16:22:38 1995 Jason Merrill - - Lose CLASSTYPE_METHODS/DECL_NEXT_METHOD chain; make - TYPE_METHODS/TREE_CHAIN mean what they used to. - * decl2.c (constructor_name_full): Refer to CLASSTYPE_METHOD_VEC - instead of TYPE_METHODS. - * decl.c (duplicate_decls): Lose references to DECL_NEXT_METHOD. - * tree.c (tree_copy_lang_decl_for_deferred_output): Likewise. - * cp-tree.h (CLASSTYPE_METHODS): Lose. - (CLASSTYPE_METHOD_VEC): Point to lang_spec->methods instead of - TYPE_METHODS. - (struct lang_decl): Lose next_method field. - (DECL_NEXT_METHOD): Lose. - * class.c (finish_struct_methods): Don't mess with TYPE_METHODS. - (finish_struct): Just use TYPE_METHODS; we don't need fn_fields - anymore. - (finish_struct_methods): Don't mess with the TREE_CHAINs in - fn_fields. - - * search.c (add_conversions): Don't use TREE_CHAIN to traverse method - vector. - - * call.c (build_method_call): Synthesize here even when not inlining. - * typeck.c (build_function_call_real): Likewise. - -Wed Dec 13 15:02:39 1995 Ian Lance Taylor - - * cp/lex.c (check_newline): If DBX_DEBUGGING_INFO and write_symbols - == DBX_DEBUG, call dbxout_start_new_source_file and - dbxout_resume_previous_source_file when appropriate. - -Tue Dec 12 20:38:55 1995 Mike Stump - - * except.c (start_anon_func): Push to the top level. - (end_anon_func): Pop from the top level. - -Mon Dec 11 18:56:14 1995 Mike Stump - - * cp-tree.h (build_cleanup): New routine to build cleanups. - * decl.c (expand_static_init): Use build_cleanup to build a cleanup - call at ctor time and use atexit to run it later. - * decl2.c (build_cleanup): New routine, taken from finish_file. - (finish_file): Use build_cleanup instead, and don't put function - local statics in global dtor list. - -Wed Dec 6 14:34:29 1995 Mike Stump - - * except.c (expand_throw): Ensure that we have cleanups, if we try - and expand cleanups. - -Wed Dec 6 11:48:21 1995 Mike Stump - - * except.c (expand_throw): Add logic to manage dynamic cleanups for - the EH object. - (expand_end_catch_block): Use the magic of expand_goto, instead of - emit_jump so that we get the cleanup for any catch clause parameter - and the cleanup for the exception object. Update to reflect label - changes. - (push_eh_cleanup): New routine to register a cleanup for an - exception object. - (empty_fndecl): Used to default cleanup actions to - nothing. - (init_exception_processing): Setup empty_fndecl. Setup - saved_cleanup. - (expand_start_catch_block): Update to reflect label changes. Call - push_eh_object to register the cleanup for the EH object. - (start_anon_func): New routine to start building lambda expressions - from trees. - (end_anon_func): New routine to end them. - (struct labelNode): Change so that we can use tree labels, or rtx - labels. - (saved_cleanup): Object to check for dynamic cleanups for the - exception handling object. - (push_label_entry): Change so that we can use tree labels, or rtx - labels. - (pop_label_entry): Likewise. - (top_label_entry): Likewise. - (expand_start_all_catch): Use tree label instead of rtx label, so - that we can get the magic of expand_goto. - (expand_end_all_catch): Update to reflect label changes. - - * class.c (build_vfn_ref): Remove building_cleanup logic, as we now - use UNSAVE_EXPRs. - * typeck.c (get_member_function_from_ptrfunc): Remove remnants of - building_cleanup logic, as we now use UNSAVE_EXPRs. - * cp-tree.h (unsave_expr): Declare it. - * decl.c (building_cleanup): Remove. - (maybe_build_cleanup): Remove building_cleanup logic, and use - UNSAVE_EXPR instead. - -Sun Dec 3 01:34:58 1995 Mike Stump - - * gc.c (build_t_desc): Update error message to say . - -Thu Nov 30 12:30:05 1995 Brendan Kehoe - - * decl.c (pushdecl): Only warn about shadowing a local variable if - warn_shadow is true. - -Sun Nov 26 16:06:55 1995 Rusty Russell - - * typeck.c (build_binary_op_nodefault): Added warning about - comparisons between different enum types with -Wall, unless - -fenum-int-equiv set. - -Wed Nov 22 15:44:02 1995 Mike Stump - - * class.c (finish_struct_1): Skip down to the inner type in - multidimensional arrays. Ensures ctors will be made for types that - need constructing. - -Wed Nov 22 14:19:22 1995 Mike Stump - - * decl.c (last_dtor_insn): New to track the last compiler generated - insn in a dtor. - (store_parm_decls): Set it. - (finish_function): Use it to see if the dtor is empty. Avoid doing - vtable setup all the time, if we can. - (struct cp_function): Add last_dtor_insn. - (push_cp_function_context): Save it. - (pop_cp_function_context): Restore it. - -Wed Nov 22 11:52:19 1995 Paul Russell - - * typeck.c (build_unary_op): Set TREE_NO_UNUSED_WARNING to avoid - warnings. - -Tue Nov 21 17:15:23 1995 Mike Stump - - * typeck.c (expand_target_expr): Make sure targets get put into the - current temp_slot_level, so that the free_temp_slots call will reuse - them. - -Tue Nov 21 13:32:03 1995 Mike Stump - - * class.c (finish_struct_1): Delay delta fixups for virtual bases - until after we have done the hard virtuals, to avoid a bogus `every - virtual function must have a unique final overrider' for virtual - functions that are only overridden by hard virtuals. - -Thu Nov 9 13:35:30 1995 Jason Merrill - - * pt.c (do_function_instantiation): Don't try to find a file-scope - template for a member function. - -Tue Nov 14 06:20:35 1995 Mike Stump - - * g++.c (main): Add handling of -nodefaultlibs. - -Mon Nov 13 15:45:34 1995 Mike Stump - - * cp-tree.h (INDIRECT_BIND): Add a way for the frontend to - distinguish between direct bindings of reference variables, and - indirect bindings of reference variables. - * cvt.c (build_up_reference): Use it. - * typeck.c (convert_arguments): Use it to indicate this is an - indirect binding. - * decl.c (cp_finish_decl): Ensure that we reuse stack slots as fast - as they are unused. - (expand_static_init): Likewise. - (cplus_expand_expr_stmt): Likewise. - * decl2.c (finish_file): Likewise. - * init.c (perform_member_init): Likewise. - (emit_base_init): Likewise. - (expand_aggr_vbase_init_1): Likewise. - -Fri Nov 10 09:18:09 1995 Brendan Kehoe - - * decl.c (push_namespace): Rewrite to use build_lang_decl, so we - get a DECL_LANG_SPECIFIC node. - * cp-tree.h (lang_decl_flags): Add new member `level'. - (NAMESPACE_LEVEL): Don't use decl.arguments, instead use the - decl_flags level member. - -Mon Nov 6 18:36:13 1995 Brendan Kehoe - - * call.c (build_method_call): Make sure instance has a - TYPE_LANG_SPECIFIC node before we dive into it. - -Sat Nov 4 20:01:52 1995 Jason Molenda - - * method.c (make_thunk): Use TREE_SET_CODE to set thunk's tree code. - -Thu Nov 2 17:56:57 1995 Mike Stump - - * decl.c (duplicate_decls): When smashing decls, smash staticness in - the usual way. - -Thu Nov 2 16:44:02 1995 Mike Stump - - * decl.c (poplevel): Handle the merging of subblocks of cleanups - when finishing blocks that have already been created (usually due to - the fixup goto code). Fixes bad debugging information. - -Wed Nov 1 12:33:53 1995 Jason Merrill - - * method.c (hack_identifier): Don't abort when we get a TREE_LIST - that's not a list of overloaded functions. - -Wed Nov 1 11:38:58 1995 Brendan Kehoe - - * decl2.c (mark_vtable_entries): Check DECL_LANG_SPECIFIC on fn - before trying to use DECL_ABSTRACT_VIRTUAL_P. - -Tue Oct 31 11:56:55 1995 Jason Merrill - - * decl2.c (mark_used): New function for hooking into setting of - TREE_USED on decls. - * call.c (build_method_call): Use it. - * class.c (instantiate_type): Likewise. - * init.c (build_offset_ref): Likewise. Don't call assemble_external - for all like-named functions. - * method.c (hack_identifier): Likewise. - (emit_thunk): Don't call assemble_external. - (make_thunk): Create thunk as a FUNCTION_DECL so that it - gets the right mode and ENCODE_SECTION_INFO works. - - * parse.y: Use mark_used. Pass operator names to do_identifier. - * lex.c (do_identifier): Handle operator names. - - * decl2.c (grokclassfn): Tweak __in_chrg attributes. - -Thu Oct 26 16:45:58 1995 Brendan Kehoe - - * errfn.c: Include stdio.h. - (cp_sprintf): Take out decl of sprintf, and cast sprintf to errorfn*. - -Wed Oct 25 18:58:41 1995 Mike Stump - - * typeck2.c (digest_init): Always convert initializers to the - right type. - -Wed Oct 25 13:25:24 1995 Mike Stump - - * init.c (member_init_ok_or_else): Don't allow member initializers - for indirect members, as it is invalid. - -Wed Oct 25 11:35:28 1995 Brendan Kehoe - - * decl.c (grokdeclarator): Don't allow `friend signed ()'. - -Fri Oct 20 10:30:59 1995 Mike Stump - - * parse.y (for.init.statement): Catch compound statements inside for - initializations, if we're being pedantic. - -Fri Oct 20 10:03:42 1995 Mike Stump - - * decl.c (lookup_tag): Return NULL_TREE if we don't find what we are - looking for. - -Thu Oct 19 14:26:10 1995 Mike Stump - - * error.c (dump_expr): Don't core dump when a boolean expression is - used as a default argument. - -Thu Oct 19 10:36:30 1995 Jason Merrill - - * class.c (finish_struct_bits): Check aggregate_value_p instead of - RETURN_IN_MEMORY. - -Wed Oct 18 18:12:32 1995 Jason Merrill - - * class.c (finish_struct_bits): Also set TREE_ADDRESSABLE on a - BLKmode type that would otherwise be returned in registers. - -Mon Oct 16 12:32:19 1995 Brendan Kehoe - - * g++.c (WITHLIBC): New macro. - (main): Declare saw_libc. Use WITHLIBC if `-lc' was used; set - saw_libc and pass it at the end if it was set. - -Wed Oct 11 16:30:34 1995 Brendan Kehoe - - * parse.y (fn.def1): Call split_specs_attrs in - declmods notype_declarator case. diff --git a/contrib/gcc/cp/Make-lang.in b/contrib/gcc/cp/Make-lang.in deleted file mode 100644 index d5d4e4d4cef4..000000000000 --- a/contrib/gcc/cp/Make-lang.in +++ /dev/null @@ -1,310 +0,0 @@ -# Top level makefile fragment for GNU C++. -# Copyright (C) 1994, 1995, 1997, 1998, 1999 Free Software Foundation, Inc. - -#This file is part of GNU CC. - -#GNU CC 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. - -#GNU CC 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. - -#You should have received a copy of the GNU General Public License -#along with GNU CC; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, -#Boston, MA 02111-1307, USA. - -# This file provides the language dependent support in the main Makefile. -# Each language makefile fragment must provide the following targets: -# -# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap, -# foo.info, foo.dvi, -# foo.install-normal, foo.install-common, foo.install-info, foo.install-man, -# foo.uninstall, foo.distdir, -# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean, -# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 -# -# where `foo' is the name of the language. -# -# It should also provide rules for: -# -# - making any compiler driver (eg: g++) -# - the compiler proper (eg: cc1plus) -# - define the names for selecting the language in LANGUAGES. -# -# Extra flags to pass to recursive makes. -CXX_FLAGS_TO_PASS = \ - "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \ - "CXXFLAGS=$(CXXFLAGS)" \ - "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" - -# Actual names to use when installing a native compiler. -CXX_INSTALL_NAME = `t='$(program_transform_name)'; echo c++ | sed $$t` -GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t` -DEMANGLER_INSTALL_NAME = `t='$(program_transform_name)'; echo c++filt | sed $$t` - -# Actual names to use when installing a cross-compiler. -CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t` -GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t` -DEMANGLER_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++filt | sed $$t` - -# The name to use for the demangler program. -DEMANGLER_PROG = c++filt$(exeext) - -# Extra headers to install. -CXX_EXTRA_HEADERS = $(srcdir)/cp/inc/typeinfo $(srcdir)/cp/inc/exception \ - $(srcdir)/cp/inc/new $(srcdir)/cp/inc/new.h - -# Extra code to include in libgcc2. -CXX_LIB2FUNCS = tinfo.o tinfo2.o new.o opnew.o opnewnt.o opvnew.o opvnewnt.o \ - opdel.o opdelnt.o opvdel.o opvdelnt.o exception.o -CXX_LIB2SRCS = $(srcdir)/cp/new.cc $(srcdir)/cp/new1.cc $(srcdir)/cp/new2.cc \ - $(srcdir)/cp/exception.cc $(srcdir)/cp/tinfo.cc \ - $(srcdir)/cp/tinfo2.cc $(srcdir)/cp/tinfo.h -# -# Define the names for selecting c++ in LANGUAGES. -# Note that it would be nice to move the dependency on g++ -# into the C++ rule, but that needs a little bit of work -# to do the right thing within all.cross. -C++ c++: cc1plus$(exeext) - -# Tell GNU make to ignore these if they exist. -.PHONY: C++ c++ - -g++spec.o: $(srcdir)/cp/g++spec.c - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/cp/g++spec.c - -$(INTL_TARGETS): $(srcdir)/cp/parse.c -$(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y - @cp_srcdir=`sed -n 's/^srcdir[ ]*=[ ]*//p' cp/Makefile` && \ - echo "cd cp && $(MAKE) $$cp_srcdir/parse.c" && \ - cd cp && \ - $(MAKE) $(SUBDIR_FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) \ - $$cp_srcdir/parse.c - -# Create the compiler driver for g++. -GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o -g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ - $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS) - -# Create a version of the g++ driver which calls the cross-compiler. -g++-cross$(exeext): g++$(exeext) - -rm -f g++-cross$(exeext) - cp g++$(exeext) g++-cross$(exeext) - -cxxmain.o: $(srcdir)/../libiberty/cplus-dem.c $(DEMANGLE_H) - rm -f cxxmain.c - $(LN_S) $(srcdir)/../libiberty/cplus-dem.c cxxmain.c - $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - -DVERSION=\"$(version)\" cxxmain.c - -# Apparently OpenVM needs the -o to be at the beginning of the link line. -$(DEMANGLER_PROG): cxxmain.o underscore.o $(LIBDEPS) - $(CC) -o $@ $(ALL_CFLAGS) $(LDFLAGS) \ - cxxmain.o underscore.o $(LIBS) - -CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \ - $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \ - $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \ - $(srcdir)/cp/expr.c $(srcdir)/cp/lex.c \ - $(srcdir)/cp/ptree.c $(srcdir)/cp/tree.c $(srcdir)/cp/cvt.c \ - $(srcdir)/cp/errfn.c $(srcdir)/cp/rtti.c $(srcdir)/cp/method.c \ - $(srcdir)/cp/search.c $(srcdir)/cp/typeck.c $(srcdir)/cp/decl.c \ - $(srcdir)/cp/error.c $(srcdir)/cp/friend.c $(srcdir)/cp/init.c \ - $(srcdir)/cp/parse.y $(srcdir)/cp/sig.c $(srcdir)/cp/typeck2.c \ - $(srcdir)/cp/repo.c $(srcdir)/cp/semantics.c - -cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o \ - $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def hash.o - cd cp; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) ../cc1plus$(exeext) -# -# Build hooks: - -c++.all.build: g++$(exeext) -c++.all.cross: g++-cross$(exeext) $(DEMANGLER_PROG) -c++.start.encap: g++$(exeext) -c++.rest.encap: $(DEMANGLER_PROG) - -c++.info: -c++.dvi: - -# C++ language-support library pieces for libgcc. -tinfo.o: cc1plus$(exeext) $(srcdir)/cp/tinfo.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/tinfo.cc -tinfo2.o: cc1plus$(exeext) $(srcdir)/cp/tinfo2.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/tinfo2.cc -exception.o: cc1plus$(exeext) $(srcdir)/cp/exception.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c -fexceptions $(srcdir)/cp/exception.cc -new.o: cc1plus$(exeext) $(srcdir)/cp/new.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/new.cc -opnew.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/new1.cc -DL_op_new -o opnew.o -opnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new1.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/new1.cc -DL_op_newnt -o opnewnt.o -opvnew.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/new2.cc -DL_op_vnew -o opvnew.o -opvnewnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/new2.cc -DL_op_vnewnt -o opvnewnt.o -opdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/new2.cc -DL_op_delete -o opdel.o -opdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/new2.cc -DL_op_delnt -o opdelnt.o -opvdel.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/new2.cc -DL_op_vdel -o opvdel.o -opvdelnt.o: cc1plus$(exeext) $(srcdir)/cp/new2.cc - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(CXXFLAGS) $(INCLUDES) \ - -c $(srcdir)/cp/new2.cc -DL_op_vdelnt -o opvdelnt.o - -# We want to update cplib2.txt if any of the source files change... -cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS) cplib2.ready - case " $(LANGUAGES) " in \ - *" "[cC]"++ "*) \ - echo $(CXX_LIB2FUNCS) > cplib2.new;; \ - *) \ - echo "" > cplib2.new;; \ - esac - mv -f cplib2.new cplib2.txt - -# Or if it would be different. -# Don't try to do write if `.' is not writable; -# in that case, we're installing from someone else's directory. -# But go ahead and fail if that directory hasn't been properly built. -cplib2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs - @if [ -r cplib2.txt -a -w . ]; then \ - case " $(LANGUAGES) " in \ - *" "[cC]"++ "*) \ - echo $(CXX_LIB2FUNCS) > cplib2.new;; \ - *) \ - echo "" > cplib2.new;; \ - esac; \ - if cmp -s cplib2.new cplib2.txt; then true; else \ - touch cplib2.ready; \ - fi; \ - rm -f cplib2.new; \ - else true ; \ - fi - @if [ -f cplib2.ready ]; then true; else \ - touch cplib2.ready; \ - fi -# -# Install hooks: -# cc1plus is installed elsewhere as part of $(COMPILERS). - -# Nothing to do here. -c++.install-normal: - -# Install the driver program as $(target)-g++ -# and also as either g++ (if native) or $(tooldir)/bin/g++. -c++.install-common: - -if [ -f cc1plus$(exeext) ] ; then \ - if [ -f g++-cross$(exeext) ] ; then \ - rm -f $(bindir)/$(GXX_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) g++-cross$(exeext) $(bindir)/$(GXX_CROSS_NAME)$(exeext); \ - chmod a+x $(bindir)/$(GXX_CROSS_NAME)$(exeext); \ - rm -f $(bindir)/$(CXX_CROSS_NAME)$(exeext); \ - $(LN) $(bindir)/$(GXX_CROSS_NAME)$(exeext) $(bindir)/$(CXX_CROSS_NAME)$(exeext); \ - else \ - rm -f $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) g++$(exeext) $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ - chmod a+x $(bindir)/$(GXX_INSTALL_NAME)$(exeext); \ - rm -f $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ - $(LN) $(bindir)/$(GXX_INSTALL_NAME)$(exeext) $(bindir)/$(CXX_INSTALL_NAME)$(exeext); \ - fi ; \ - if [ x$(DEMANGLER_PROG) != x ] && [ -x "$(DEMANGLER_PROG)" ]; then \ - if [ -f g++-cross$(exeext) ] ; then \ - rm -f $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \ - $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \ - chmod a+x $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext); \ - else \ - rm -f $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \ - $(INSTALL_PROGRAM) $(DEMANGLER_PROG) $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \ - chmod a+x $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext); \ - fi ; \ - fi ; \ - fi - -c++.install-info: - -c++.install-man: $(srcdir)/cp/g++.1 - -if [ -f cc1plus$(exeext) ] ; then \ - if [ -f g++-cross$(exeext) ] ; then \ - rm -f $(man1dir)/$(GXX_CROSS_NAME)$(manext); \ - $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_CROSS_NAME)$(manext); \ - chmod a-x $(man1dir)/$(GXX_CROSS_NAME)$(manext); \ - else \ - rm -f $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \ - $(INSTALL_DATA) $(srcdir)/cp/g++.1 $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \ - chmod a-x $(man1dir)/$(GXX_INSTALL_NAME)$(manext); \ - fi; \ - else true; fi - -c++.uninstall: - -rm -rf $(bindir)/$(CXX_INSTALL_NAME)$(exeext) - -rm -rf $(bindir)/$(CXX_CROSS_NAME)$(exeext) - -rm -rf $(bindir)/$(GXX_INSTALL_NAME)$(exeext) - -rm -rf $(bindir)/$(GXX_CROSS_NAME)$(exeext) - -rm -rf $(bindir)/$(DEMANGLER_INSTALL_NAME)$(exeext) - -rm -rf $(bindir)/$(DEMANGLER_CROSS_NAME)$(exeext) - -rm -rf $(man1dir)/$(GXX_INSTALL_NAME)$(manext) - -rm -rf $(man1dir)/$(GXX_CROSS_NAME)$(manext) -# -# Clean hooks: -# A lot of the ancillary files are deleted by the main makefile. -# We just have to delete files specific to us. - -c++.mostlyclean: - -rm -f cp/*$(objext) $(DEMANGLER_PROG) -c++.clean: - -rm -f cplib2.txt cplib2.ready -c++.distclean: - -rm -f cp/config.status cp/Makefile - -rm -f cp/parse.output -c++.extraclean: -c++.maintainer-clean: - -rm -f cp/parse.c cp/parse.h -# -# Stage hooks: -# The main makefile has already created stage?/cp. - -c++.stage1: stage1-start - -mv cp/*$(objext) stage1/cp -c++.stage2: stage2-start - -mv cp/*$(objext) stage2/cp -c++.stage3: stage3-start - -mv cp/*$(objext) stage3/cp -c++.stage4: stage4-start - -mv cp/*$(objext) stage4/cp -# -# Maintenance hooks: - -# This target creates the files that can be rebuilt, but go in the -# distribution anyway. It then copies the files to the distdir directory. -c++.distdir: - mkdir tmp/cp - mkdir tmp/cp/inc - cd cp ; $(MAKE) $(FLAGS_TO_PASS) $(CXX_FLAGS_TO_PASS) parse.c hash.h - cd cp; \ - for file in *[0-9a-zA-Z+]; do \ - $(LN) $$file ../tmp/cp; \ - done - cd cp/inc; \ - for file in *[0-9a-zA-Z+]; do \ - ln $$file ../../tmp/cp/inc >/dev/null 2>&1 \ - || cp $$file ../../tmp/cp/inc; \ - done diff --git a/contrib/gcc/cp/Makefile.in b/contrib/gcc/cp/Makefile.in deleted file mode 100644 index 1a5b32c40c8c..000000000000 --- a/contrib/gcc/cp/Makefile.in +++ /dev/null @@ -1,324 +0,0 @@ -# Makefile for GNU C++ compiler. -# Copyright (C) 1987, 88, 90-5, 1998, 1999 Free Software Foundation, Inc. - -#This file is part of GNU CC. - -#GNU CC 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. - -#GNU CC 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. - -#You should have received a copy of the GNU General Public License -#along with GNU CC; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, -#Boston, MA 02111-1307, USA. - -# The makefile built from this file lives in the language subdirectory. -# Its purpose is to provide support for: -# -# 1) recursion where necessary, and only then (building .o's), and -# 2) building and debugging cc1 from the language subdirectory, and -# 3) nothing else. -# -# The parent makefile handles all other chores, with help from the -# language makefile fragment, of course. -# -# The targets for external use are: -# all, TAGS, ???mostlyclean, ???clean. - -# Suppress smart makes who think they know how to automake Yacc files -.y.c: - -# It defines the c++ interface name. It should be changed when the -# c++ interface is changed. -INTERFACE = 2 - -# Variables that exist for you to override. -# See below for how to change them for certain systems. - -ALLOCA = - -# Various ways of specifying flags for compilations: -# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2. -# BOOT_CFLAGS is the value of CFLAGS to pass -# to the stage2 and stage3 compilations -# XCFLAGS is used for most compilations but not when using the GCC just built. -XCFLAGS = -CFLAGS = -g -BOOT_CFLAGS = -O $(CFLAGS) -# These exists to be overridden by the x-* and t-* files, respectively. -X_CFLAGS = -T_CFLAGS = - -X_CPPFLAGS = -T_CPPFLAGS = - -CC = @CC@ -BISON = `if [ -f ../../bison/bison ] ; then echo ../../bison/bison -L $(srcdir)/../../bison/ ; else echo bison ; fi` -BISONFLAGS = -LEX = `if [ -f ../../flex/flex ] ; then echo ../../flex/flex ; else echo flex ; fi` -LEXFLAGS = -AR = ar -AR_FLAGS = rc -SHELL = /bin/sh -MAKEINFO = makeinfo -TEXI2DVI = texi2dvi - -# Define this as & to perform parallel make on a Sequent. -# Note that this has some bugs, and it seems currently necessary -# to compile all the gen* files first by hand to avoid erroneous results. -P = - -# This is used in the definition of SUBDIR_USE_ALLOCA. -# ??? Perhaps it would be better if it just looked for *gcc*. -OLDCC = cc - -# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET. -# It omits XCFLAGS, and specifies -B./. -# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler. -GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) - -# Tools to use when building a cross-compiler. -# These are used because `configure' appends `cross-make' -# to the makefile when making a cross-compiler. - -# We don't use cross-make. Instead we use the tools -# from the build tree, if they are available. -# program_transform_name and objdir are set by configure.in. -program_transform_name = -objdir = . - -target=@target@ -xmake_file=@dep_host_xmake_file@ -tmake_file=@dep_tmake_file@ -#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c` -#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c` - -# Directory where sources are, from where we are. -srcdir = @srcdir@ -VPATH = @srcdir@ - -# Additional system libraries to link with. -CLIB= - -# Top build directory, relative to here. -top_builddir = .. - -# Internationalization library. -INTLLIBS = @INTLLIBS@ - -# Change this to a null string if obstacks are installed in the -# system library. -OBSTACK=obstack.o - -# Choose the real default target. -ALL=all - -# End of variables for you to override. - -# Definition of `all' is here so that new rules inserted by sed -# do not specify the default target. -all: all.indirect - -# This tells GNU Make version 3 not to put all variables in the environment. -.NOEXPORT: - -# sed inserts variable overrides after the following line. -####target overrides -@target_overrides@ -####host overrides -@host_overrides@ -####cross overrides -@cross_defines@ -@cross_overrides@ -####build overrides -@build_overrides@ -# -# Now figure out from those variables how to compile and link. - -all.indirect: Makefile ../cc1plus$(exeext) - -# IN_GCC tells obstack.h that we are using gcc's file. -INTERNAL_CFLAGS = $(CROSS) -DIN_GCC @extra_c_flags@ - -# This is the variable actually used when we compile. -ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) - -# Likewise. -ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) - -# Even if ALLOCA is set, don't use it if compiling with GCC. - -SUBDIR_OBSTACK = `if [ x$(OBSTACK) != x ]; then echo ../$(OBSTACK); else true; fi` -SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac` -SUBDIR_MALLOC = `if [ x$(MALLOC) != x ]; then echo ../$(MALLOC); else true; fi` - -# How to link with both our special library facilities -# and the system's installed libraries. -LIBS = $(SUBDIR_OBSTACK) $(SUBDIR_USE_ALLOCA) $(SUBDIR_MALLOC) \ - $(INTLLIBS) $(CLIB) - -# Specify the directories to be searched for header files. -# Both . and srcdir are used, in that order, -# so that tm.h and config.h will be found in the compilation -# subdirectory rather than in the source directory. -INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)/../../include - -# Always use -I$(srcdir)/config when compiling. -.c.o: - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< - -# The only suffixes we want for implicit rules are .c and .o. -.SUFFIXES: -.SUFFIXES: .c .o - -# This tells GNU make version 3 not to export all the variables -# defined in this file into the environment. -.NOEXPORT: -# -# Lists of files for various purposes. - -# Language-specific object files for g++ - -CXX_OBJS = call.o decl.o errfn.o expr.o pt.o sig.o typeck2.o \ - class.o decl2.o error.o lex.o parse.o ptree.o rtti.o spew.o typeck.o cvt.o \ - except.o friend.o init.o method.o search.o semantics.o tree.o xref.o \ - repo.o @extra_cxx_objs@ - -# Language-independent object files. -OBJS = `cat ../stamp-objlist` ../c-common.o ../c-pragma.o -OBJDEPS = ../stamp-objlist ../c-common.o ../c-pragma.o - -compiler: ../cc1plus$(exeext) -../cc1plus$(exeext): $(P) $(OBJDEPS) $(CXX_OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(CXX_OBJS) $(LIBS) - -Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure - cd ..; $(SHELL) config.status - -native: config.status ../cc1plus$(exeext) -# -# Compiling object files from source files. - -# Note that dependencies on obstack.h are not written -# because that file is not part of GCC. - -# C++ language specific files. - -RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \ - $(srcdir)/../machmode.h $(srcdir)/../machmode.def -TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \ - $(srcdir)/../machmode.h $(srcdir)/../machmode.def -CXX_TREE_H = $(TREE_H) cp-tree.h cp-tree.def -PARSE_H = $(srcdir)/parse.h -PARSE_C = $(srcdir)/parse.c -EXPR_H = $(srcdir)/../expr.h ../insn-codes.h - -parse.o : $(PARSE_C) $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h \ - $(srcdir)/../except.h $(srcdir)/../output.h $(srcdir)/../system.h \ - $(srcdir)/../toplev.h - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \ - `echo $(PARSE_C) | sed 's,^\./,,'` - -CONFLICTS = expect 30 shift/reduce conflicts and 42 reduce/reduce conflicts. -$(PARSE_H) : $(PARSE_C) -$(PARSE_C) : $(srcdir)/parse.y - @echo $(CONFLICTS) - cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o parse.c parse.y - cd $(srcdir); grep '^#define[ ]*YYEMPTY' parse.c >>parse.h -#$(PARSE_C) $(PARSE_H) : stamp-parse ; @true -#stamp-parse: $(srcdir)/parse.y -# @echo $(CONFLICTS) -# $(BISON) $(BISONFLAGS) -d $(srcdir)/parse.y -# grep '^#define[ ]*YYEMPTY' y.tab.c >>y.tab.h -# $(srcdir)/../move-if-change y.tab.c $(PARSE_C) -# $(srcdir)/../move-if-change y.tab.h $(PARSE_H) -# cp $(PARSE_C) y.tab.c -# touch stamp-parse - -# We used to try to protect people from having to rerun gperf. But, -# the C front-end already requires this if c-parse.gperf is changed, -# so we should be consistent. -$(srcdir)/hash.h: $(srcdir)/gxx.gperf - gperf -L C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word \ - '-k1,4,7,$$' $(srcdir)/gxx.gperf >$(srcdir)/hash.h - -spew.o : spew.c $(CONFIG_H) $(CXX_TREE_H) $(PARSE_H) $(srcdir)/../flags.h \ - lex.h $(srcdir)/../system.h $(srcdir)/../toplev.h -lex.o : lex.c $(CONFIG_H) $(CXX_TREE_H) \ - $(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h \ - $(srcdir)/../c-pragma.h $(srcdir)/../system.h $(srcdir)/../toplev.h \ - $(srcdir)/../output.h $(srcdir)/../mbchar.h -decl.o : decl.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ - lex.h decl.h $(srcdir)/../stack.h $(srcdir)/../output.h \ - $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h \ - $(srcdir)/../hash.h -decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ - lex.h decl.h $(EXPR_H) $(srcdir)/../except.h \ - $(srcdir)/../output.h $(srcdir)/../except.h $(srcdir)/../system.h \ - $(srcdir)/../toplev.h $(srcdir)/../dwarf2out.h $(srcdir)/../dwarfout.h \ - $(srcdir)/../../include/splay-tree.h $(srcdir)/../varray.h -typeck2.o : typeck2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ - $(srcdir)/../system.h $(srcdir)/../toplev.h -typeck.o : typeck.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ - $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h -class.o : class.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ - $(srcdir)/../system.h $(srcdir)/../toplev.h \ - $(srcdir)/../../include/splay-tree.h -call.o : call.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ - $(srcdir)/../system.h $(srcdir)/../toplev.h -friend.o : friend.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ - $(srcdir)/../system.h $(srcdir)/../toplev.h -init.o : init.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ - $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h -method.o : method.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ - $(srcdir)/../toplev.h -cvt.o : cvt.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h decl.h \ - $(srcdir)/../flags.h $(srcdir)/../toplev.h $(srcdir)/../convert.h -search.o : search.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../stack.h \ - $(srcdir)/../flags.h $(srcdir)/../system.h $(srcdir)/../toplev.h \ - $(srcdir)/../varray.h -tree.o : tree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ - $(srcdir)/../system.h $(srcdir)/../toplev.h -ptree.o : ptree.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h -rtti.o : rtti.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ - $(srcdir)/../system.h $(srcdir)/../toplev.h -except.o : except.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \ - $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h -expr.o : expr.c $(CONFIG_H) $(CXX_TREE_H) $(RTL_H) $(srcdir)/../flags.h \ - $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h -xref.o : xref.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../input.h \ - $(srcdir)/../system.h $(srcdir)/../toplev.h -pt.o : pt.c $(CONFIG_H) $(CXX_TREE_H) decl.h $(PARSE_H) lex.h \ - $(srcdir)/../system.h $(srcdir)/../toplev.h -error.o : error.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ - $(srcdir)/../toplev.h -errfn.o : errfn.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ - $(srcdir)/../toplev.h -sig.o : sig.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ - $(srcdir)/../system.h $(srcdir)/../toplev.h -repo.o : repo.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \ - $(srcdir)/../toplev.h -semantics.o: semantics.c $(CONFIG_H) $(CXX_TREE_H) lex.h \ - $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h - - -# -# These exist for maintenance purposes. - -# Update the tags table. -TAGS: force - cd $(srcdir) ; \ - etags *.c *.h ; \ - echo 'l' | tr 'l' '\f' >> TAGS ; \ - echo 'parse.y,0' >> TAGS ; \ - etags -a ../*.h ../*.c; - -.PHONY: TAGS - -force: diff --git a/contrib/gcc/cp/NEWS b/contrib/gcc/cp/NEWS deleted file mode 100644 index 1a242abcf41c..000000000000 --- a/contrib/gcc/cp/NEWS +++ /dev/null @@ -1,262 +0,0 @@ -*** Changes in GCC 2.95: - -* Messages about non-conformant code that we can still handle ("pedwarns") - are now errors by default, rather than warnings. This can be reverted - with -fpermissive, and is overridden by -pedantic or -pedantic-errors. - -* String constants are now of type `const char[n]', rather than `char[n]'. - This can be reverted with -fno-const-strings. - -* References to functions are now supported. - -* Lookup of class members during class definition now works in all cases. - -* In overload resolution, type conversion operators are now properly - treated as always coming from the most derived class. - -* C9x-style restricted pointers are supported, using the `__restrict' - keyword. - -* You can now use -fno-implicit-inline-templates to suppress writing out - implicit instantiations of inline templates. Normally we do write them - out, even with -fno-implicit-templates, so that optimization doesn't - affect which instantiations are needed. - -* -fstrict-prototype now also suppresses implicit declarations. - -* Many obsolete options have been removed: -fall-virtual, -fmemoize-lookups, - -fsave-memoized, +e?, -fenum-int-equivalence, -fno-nonnull-objects. - -* Unused virtual functions can be discarded on some targets by specifying - -ffunction-sections -fvtable-gc to the compiler and --gc-sections to the - linker. Unfortunately, this only works on Linux if you're linking - statically. - -* Lots of bugs stomped. - -*** Changes in EGCS 1.1: - -* Namespaces are fully supported. The library has not yet been converted - to use namespace std, however, and the old std-faking code is still on by - default. To turn it off, you can use -fhonor-std. - -* Massive template improvements: - + member template classes are supported. - + template friends are supported. - + template template parameters are supported. - + local classes in templates are supported. - + lots of bugs fixed. - -* operator new now throws bad_alloc where appropriate. - -* Exception handling is now thread safe, and supports nested exceptions and - placement delete. Exception handling overhead on x86 is much lower with - GNU as 2.9. - -* protected virtual inheritance is now supported. - -* Loops are optimized better; we now move the test to the end in most - cases, like the C frontend does. - -* For class D derived from B which has a member 'int i', &D::i is now of - type 'int B::*' instead of 'int D::*'. - -* An _experimental_ new ABI for g++ can be turned on with -fnew-abi. The - current features of this are more efficient allocation of base classes - (including the empty base optimization), and more compact mangling of C++ - symbol names (which can be turned on separately with -fsquangle). This - ABI is subject to change without notice, so don't use it for anything - that you don't want to rebuild with every release of the compiler. - - As with all ABI-changing flags, this flag is for experts only, as all - code (including the library code in libgcc and libstdc++) must be - compiled with the same ABI. - -*** Changes in EGCS 1.0: - -* A public review copy of the December 1996 Draft of the ISO/ANSI C++ - standard is now available. See - - http://www.cygnus.com/misc/wp/ - - for more information. - -* g++ now uses a new implementation of templates. The basic idea is that - now templates are minimally parsed when seen and then expanded later. - This allows conformant early name binding and instantiation controls, - since instantiations no longer have to go through the parser. - - What you get: - - + Inlining of template functions works without any extra effort or - modifications. - + Instantiations of class templates and methods defined in the class - body are deferred until they are actually needed (unless - -fexternal-templates is specified). - + Nested types in class templates work. - + Static data member templates work. - + Member function templates are now supported. - + Partial specialization of class templates is now supported. - + Explicit specification of template parameters to function templates - is now supported. - - Things you may need to fix in your code: - - + Syntax errors in templates that are never instantiated will now be - diagnosed. - + Types and class templates used in templates must be declared - first, or the compiler will assume they are not types, and fail. - + Similarly, nested types of template type parameters must be tagged - with the 'typename' keyword, except in base lists. In many cases, - but not all, the compiler will tell you where you need to add - 'typename'. For more information, see - - http://www.cygnus.com/misc/wp/dec96pub/template.html#temp.res - - + Guiding declarations are no longer supported. Function declarations, - including friend declarations, do not refer to template instantiations. - You can restore the old behavior with -fguiding-decls until you fix - your code. - - Other features: - - + Default function arguments in templates will not be evaluated (or - checked for semantic validity) unless they are needed. Default - arguments in class bodies will not be parsed until the class - definition is complete. - + The -ftemplate-depth-NN flag can be used to increase the maximum - recursive template instantiation depth, which defaults to 17. If you - need to use this flag, the compiler will tell you. - + Explicit instantiation of template constructors and destructors is - now supported. For instance: - - template A::A(const A&); - - Still not supported: - - + Member class templates. - + Template friends. - -* Exception handling support has been significantly improved and is on by - default. The compiler supports two mechanisms for walking back up the - call stack; one relies on static information about how registers are - saved, and causes no runtime overhead for code that does not throw - exceptions. The other mechanism uses setjmp and longjmp equivalents, and - can result in quite a bit of runtime overhead. You can determine which - mechanism is the default for your target by compiling a testcase that - uses exceptions and doing an 'nm' on the object file; if it uses __throw, - it's using the first mechanism. If it uses __sjthrow, it's using the - second. - - You can turn EH support off with -fno-exceptions. - -* RTTI support has been rewritten to work properly and is now on by default. - This means code that uses virtual functions will have a modest space - overhead. You can use the -fno-rtti flag to disable RTTI support. - -* On ELF systems, duplicate copies of symbols with 'initialized common' - linkage (such as template instantiations, vtables, and extern inlines) - will now be discarded by the GNU linker, so you don't need to use -frepo. - This support requires GNU ld from binutils 2.8 or later. - -* The overload resolution code has been rewritten to conform to the latest - C++ Working Paper. Built-in operators are now considered as candidates - in operator overload resolution. Function template overloading chooses - the more specialized template, and handles base classes in type deduction - and guiding declarations properly. In this release the old code can - still be selected with -fno-ansi-overloading, although this is not - supported and will be removed in a future release. - -* Standard usage syntax for the std namespace is supported; std is treated - as an alias for global scope. General namespaces are still not supported. - -* New flags: - - + New warning -Wno-pmf-conversion (don't warn about - converting from a bound member function pointer to function - pointer). - - + A flag -Weffc++ has been added for violations of some of the style - guidelines in Scott Meyers' _Effective C++_ books. - - + -Woverloaded-virtual now warns if a virtual function in a base - class is hidden in a derived class, rather than warning about - virtual functions being overloaded (even if all of the inherited - signatures are overridden) as it did before. - - + -Wall no longer implies -W. The new warning flag, -Wsign-compare, - included in -Wall, warns about dangerous comparisons of signed and - unsigned values. Only the flag is new; it was previously part of - -W. - - + The new flag, -fno-weak, disables the use of weak symbols. - -* Synthesized methods are now emitted in any translation units that need - an out-of-line copy. They are no longer affected by #pragma interface - or #pragma implementation. - -* __FUNCTION__ and __PRETTY_FUNCTION__ are now treated as variables by the - parser; previously they were treated as string constants. So code like - `printf (__FUNCTION__ ": foo")' must be rewritten to - `printf ("%s: foo", __FUNCTION__)'. This is necessary for templates. - -* local static variables in extern inline functions will be shared between - translation units. - -* -fvtable-thunks is supported for all targets, and is the default for - Linux with glibc 2.x (also called libc 6.x). - -* bool is now always the same size as another built-in type. Previously, - a 64-bit RISC target using a 32-bit ABI would have 32-bit pointers and a - 64-bit bool. This should only affect Irix 6, which was not supported in - 2.7.2. - -* new (nothrow) is now supported. - -* Synthesized destructors are no longer made virtual just because the class - already has virtual functions, only if they override a virtual destructor - in a base class. The compiler will warn if this affects your code. - -* The g++ driver now only links against libstdc++, not libg++; it is - functionally identical to the c++ driver. - -* (void *)0 is no longer considered a null pointer constant; NULL in - is now defined as __null, a magic constant of type (void *) - normally, or (size_t) with -ansi. - -* The name of a class is now implicitly declared in its own scope; A::A - refers to A. - -* Local classes are now supported. - -* __attribute__ can now be attached to types as well as declarations. - -* The compiler no longer emits a warning if an ellipsis is used as a - function's argument list. - -* Definition of nested types outside of their containing class is now - supported. For instance: - - struct A { - struct B; - B* bp; - }; - - struct A::B { - int member; - }; - -* On the HPPA, some classes that do not define a copy constructor - will be passed and returned in memory again so that functions - returning those types can be inlined. - -*** The g++ team thanks everyone that contributed to this release, - but especially: - -* Joe Buck , the maintainer of the g++ FAQ. -* Brendan Kehoe , who coordinates testing of g++. -* Jason Merrill , the g++ maintainer. -* Mark Mitchell , who implemented member function - templates and explicit qualification of function templates. -* Mike Stump , the previous g++ maintainer, who did most of - the exception handling work. diff --git a/contrib/gcc/cp/call.c b/contrib/gcc/cp/call.c deleted file mode 100644 index a931500d2d8c..000000000000 --- a/contrib/gcc/cp/call.c +++ /dev/null @@ -1,4558 +0,0 @@ -/* Functions related to invoking methods and overloaded functions. - Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com) and - modified by Brendan Kehoe (brendan@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* High-level class interface. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "cp-tree.h" -#include "output.h" -#include "flags.h" -#include "rtl.h" -#include "toplev.h" - -#include "obstack.h" -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -extern int inhibit_warnings; -extern tree ctor_label, dtor_label; - -static tree build_new_method_call PROTO((tree, tree, tree, tree, int)); - -static tree build_field_call PROTO((tree, tree, tree, tree)); -static tree find_scoped_type PROTO((tree, tree, tree)); -static struct z_candidate * tourney PROTO((struct z_candidate *)); -static int joust PROTO((struct z_candidate *, struct z_candidate *, int)); -static int compare_ics PROTO((tree, tree)); -static tree build_over_call PROTO((struct z_candidate *, tree, int)); -static tree convert_like PROTO((tree, tree)); -static void op_error PROTO((enum tree_code, enum tree_code, tree, tree, - tree, const char *)); -static tree build_object_call PROTO((tree, tree)); -static tree resolve_args PROTO((tree)); -static struct z_candidate * build_user_type_conversion_1 - PROTO ((tree, tree, int)); -static void print_z_candidates PROTO((struct z_candidate *)); -static tree build_this PROTO((tree)); -static struct z_candidate * splice_viable PROTO((struct z_candidate *)); -static int any_viable PROTO((struct z_candidate *)); -static struct z_candidate * add_template_candidate - PROTO((struct z_candidate *, tree, tree, tree, tree, int, - unification_kind_t)); -static struct z_candidate * add_template_candidate_real - PROTO((struct z_candidate *, tree, tree, tree, tree, int, - tree, unification_kind_t)); -static struct z_candidate * add_template_conv_candidate - PROTO((struct z_candidate *, tree, tree, tree, tree)); -static struct z_candidate * add_builtin_candidates - PROTO((struct z_candidate *, enum tree_code, enum tree_code, - tree, tree *, int)); -static struct z_candidate * add_builtin_candidate - PROTO((struct z_candidate *, enum tree_code, enum tree_code, - tree, tree, tree, tree *, tree *, int)); -static int is_complete PROTO((tree)); -static struct z_candidate * build_builtin_candidate - PROTO((struct z_candidate *, tree, tree, tree, tree *, tree *, - int)); -static struct z_candidate * add_conv_candidate - PROTO((struct z_candidate *, tree, tree, tree)); -static struct z_candidate * add_function_candidate - PROTO((struct z_candidate *, tree, tree, int)); -static tree implicit_conversion PROTO((tree, tree, tree, int)); -static tree standard_conversion PROTO((tree, tree, tree)); -static tree reference_binding PROTO((tree, tree, tree, int)); -static tree strip_top_quals PROTO((tree)); -static tree non_reference PROTO((tree)); -static tree build_conv PROTO((enum tree_code, tree, tree)); -static int is_subseq PROTO((tree, tree)); -static int maybe_handle_ref_bind PROTO((tree*, tree*)); -static void maybe_handle_implicit_object PROTO((tree*)); -static struct z_candidate * add_candidate PROTO((struct z_candidate *, - tree, tree, int)); -static tree source_type PROTO((tree)); -static void add_warning PROTO((struct z_candidate *, struct z_candidate *)); - -tree -build_vfield_ref (datum, type) - tree datum, type; -{ - tree rval; - - if (datum == error_mark_node) - return error_mark_node; - - if (TREE_CODE (TREE_TYPE (datum)) == REFERENCE_TYPE) - datum = convert_from_reference (datum); - - if (! TYPE_USES_COMPLEX_INHERITANCE (type)) - rval = build (COMPONENT_REF, TREE_TYPE (CLASSTYPE_VFIELD (type)), - datum, CLASSTYPE_VFIELD (type)); - else - rval = build_component_ref (datum, DECL_NAME (CLASSTYPE_VFIELD (type)), NULL_TREE, 0); - - return rval; -} - -/* Build a call to a member of an object. I.e., one that overloads - operator ()(), or is a pointer-to-function or pointer-to-method. */ - -static tree -build_field_call (basetype_path, instance_ptr, name, parms) - tree basetype_path, instance_ptr, name, parms; -{ - tree field, instance; - - if (name == ctor_identifier || name == dtor_identifier) - return NULL_TREE; - - /* Speed up the common case. */ - if (instance_ptr == current_class_ptr - && IDENTIFIER_CLASS_VALUE (name) == NULL_TREE) - return NULL_TREE; - - field = lookup_field (basetype_path, name, 1, 0); - - if (field == error_mark_node || field == NULL_TREE) - return field; - - if (TREE_CODE (field) == FIELD_DECL || TREE_CODE (field) == VAR_DECL) - { - /* If it's a field, try overloading operator (), - or calling if the field is a pointer-to-function. */ - instance = build_indirect_ref (instance_ptr, NULL_PTR); - instance = build_component_ref_1 (instance, field, 0); - - if (instance == error_mark_node) - return error_mark_node; - - if (IS_AGGR_TYPE (TREE_TYPE (instance))) - return build_opfncall (CALL_EXPR, LOOKUP_NORMAL, - instance, parms, NULL_TREE); - else if (TREE_CODE (TREE_TYPE (instance)) == POINTER_TYPE) - { - if (TREE_CODE (TREE_TYPE (TREE_TYPE (instance))) == FUNCTION_TYPE) - return build_function_call (instance, parms); - else if (TREE_CODE (TREE_TYPE (TREE_TYPE (instance))) - == METHOD_TYPE) - return build_function_call - (instance, expr_tree_cons (NULL_TREE, instance_ptr, parms)); - } - } - - return NULL_TREE; -} - -static tree -find_scoped_type (type, inner_name, inner_types) - tree type, inner_name, inner_types; -{ - tree tags = CLASSTYPE_TAGS (type); - - while (tags) - { - /* The TREE_PURPOSE of an enum tag (which becomes a member of the - enclosing class) is set to the name for the enum type. So, if - inner_name is `bar', and we strike `baz' for `enum bar { baz }', - then this test will be true. */ - if (TREE_PURPOSE (tags) == inner_name) - { - if (inner_types == NULL_TREE) - return TYPE_MAIN_DECL (TREE_VALUE (tags)); - return resolve_scope_to_name (TREE_VALUE (tags), inner_types); - } - tags = TREE_CHAIN (tags); - } - - /* Look for a TYPE_DECL. */ - for (tags = TYPE_FIELDS (type); tags; tags = TREE_CHAIN (tags)) - if (TREE_CODE (tags) == TYPE_DECL && DECL_NAME (tags) == inner_name) - { - /* Code by raeburn. */ - if (inner_types == NULL_TREE) - return tags; - return resolve_scope_to_name (TREE_TYPE (tags), inner_types); - } - - return NULL_TREE; -} - -/* Resolve an expression NAME1::NAME2::...::NAMEn to - the name that names the above nested type. INNER_TYPES - is a chain of nested type names (held together by SCOPE_REFs); - OUTER_TYPE is the type we know to enclose INNER_TYPES. - Returns NULL_TREE if there is an error. */ - -tree -resolve_scope_to_name (outer_type, inner_stuff) - tree outer_type, inner_stuff; -{ - register tree tmp; - tree inner_name, inner_type; - - if (outer_type == NULL_TREE && current_class_type != NULL_TREE) - { - /* We first try to look for a nesting in our current class context, - then try any enclosing classes. */ - tree type = current_class_type; - - while (type && (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE)) - { - tree rval = resolve_scope_to_name (type, inner_stuff); - - if (rval != NULL_TREE) - return rval; - type = DECL_CONTEXT (TYPE_MAIN_DECL (type)); - } - } - - if (TREE_CODE (inner_stuff) == SCOPE_REF) - { - inner_name = TREE_OPERAND (inner_stuff, 0); - inner_type = TREE_OPERAND (inner_stuff, 1); - } - else - { - inner_name = inner_stuff; - inner_type = NULL_TREE; - } - - if (outer_type == NULL_TREE) - { - tree x; - /* If we have something that's already a type by itself, - use that. */ - if (IDENTIFIER_HAS_TYPE_VALUE (inner_name)) - { - if (inner_type) - return resolve_scope_to_name (IDENTIFIER_TYPE_VALUE (inner_name), - inner_type); - return inner_name; - } - - x = lookup_name (inner_name, 0); - - if (x && TREE_CODE (x) == NAMESPACE_DECL) - { - x = lookup_namespace_name (x, inner_type); - return x; - } - return NULL_TREE; - } - - if (! IS_AGGR_TYPE (outer_type)) - return NULL_TREE; - - /* Look for member classes or enums. */ - tmp = find_scoped_type (outer_type, inner_name, inner_type); - - /* If it's not a type in this class, then go down into the - base classes and search there. */ - if (! tmp && TYPE_BINFO (outer_type)) - { - tree binfos = TYPE_BINFO_BASETYPES (outer_type); - int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - for (i = 0; i < n_baselinks; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - tmp = resolve_scope_to_name (BINFO_TYPE (base_binfo), inner_stuff); - if (tmp) - return tmp; - } - tmp = NULL_TREE; - } - - return tmp; -} - -/* Returns nonzero iff the destructor name specified in NAME - (a BIT_NOT_EXPR) matches BASETYPE. The operand of NAME can take many - forms... */ - -int -check_dtor_name (basetype, name) - tree basetype, name; -{ - name = TREE_OPERAND (name, 0); - - /* Just accept something we've already complained about. */ - if (name == error_mark_node) - return 1; - - if (TREE_CODE (name) == TYPE_DECL) - name = TREE_TYPE (name); - else if (TREE_CODE_CLASS (TREE_CODE (name)) == 't') - /* OK */; - else if (TREE_CODE (name) == IDENTIFIER_NODE) - { - if ((IS_AGGR_TYPE (basetype) && name == constructor_name (basetype)) - || (TREE_CODE (basetype) == ENUMERAL_TYPE - && name == TYPE_IDENTIFIER (basetype))) - name = basetype; - else - name = get_type_value (name); - } - else - my_friendly_abort (980605); - - if (name && TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (name)) - return 1; - return 0; -} - -/* Build a method call of the form `EXP->SCOPES::NAME (PARMS)'. - This is how virtual function calls are avoided. */ - -tree -build_scoped_method_call (exp, basetype, name, parms) - tree exp, basetype, name, parms; -{ - /* Because this syntactic form does not allow - a pointer to a base class to be `stolen', - we need not protect the derived->base conversion - that happens here. - - @@ But we do have to check access privileges later. */ - tree binfo, decl; - tree type = TREE_TYPE (exp); - - if (type == error_mark_node - || basetype == error_mark_node) - return error_mark_node; - - if (processing_template_decl) - { - if (TREE_CODE (name) == BIT_NOT_EXPR - && TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE) - { - tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0); - if (type) - name = build_min_nt (BIT_NOT_EXPR, type); - } - name = build_min_nt (SCOPE_REF, basetype, name); - return build_min_nt (METHOD_CALL_EXPR, name, exp, parms, NULL_TREE); - } - - if (TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); - - if (TREE_CODE (basetype) == TREE_VEC) - { - binfo = basetype; - basetype = BINFO_TYPE (binfo); - } - else - binfo = NULL_TREE; - - /* Check the destructor call syntax. */ - if (TREE_CODE (name) == BIT_NOT_EXPR) - { - /* We can get here if someone writes their destructor call like - `obj.NS::~T()'; this isn't really a scoped method call, so hand - it off. */ - if (TREE_CODE (basetype) == NAMESPACE_DECL) - return build_method_call (exp, name, parms, NULL_TREE, LOOKUP_NORMAL); - - if (! check_dtor_name (basetype, name)) - cp_error ("qualified type `%T' does not match destructor name `~%T'", - basetype, TREE_OPERAND (name, 0)); - - /* Destructors can be "called" for simple types; see 5.2.4 and 12.4 Note - that explicit ~int is caught in the parser; this deals with typedefs - and template parms. */ - if (! IS_AGGR_TYPE (basetype)) - { - if (TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (basetype)) - cp_error ("type of `%E' does not match destructor type `%T' (type was `%T')", - exp, basetype, type); - - return cp_convert (void_type_node, exp); - } - } - - if (! is_aggr_type (basetype, 1)) - return error_mark_node; - - if (! IS_AGGR_TYPE (type)) - { - cp_error ("base object `%E' of scoped method call is of non-aggregate type `%T'", - exp, type); - return error_mark_node; - } - - if (! binfo) - { - binfo = get_binfo (basetype, type, 1); - if (binfo == error_mark_node) - return error_mark_node; - if (! binfo) - error_not_base_type (basetype, type); - } - - if (binfo) - { - if (TREE_CODE (exp) == INDIRECT_REF) - decl = build_indirect_ref - (convert_pointer_to_real - (binfo, build_unary_op (ADDR_EXPR, exp, 0)), NULL_PTR); - else - decl = build_scoped_ref (exp, basetype); - - /* Call to a destructor. */ - if (TREE_CODE (name) == BIT_NOT_EXPR) - { - if (! TYPE_HAS_DESTRUCTOR (TREE_TYPE (decl))) - return cp_convert (void_type_node, exp); - - return build_delete (TREE_TYPE (decl), decl, integer_two_node, - LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, - 0); - } - - /* Call to a method. */ - return build_method_call (decl, name, parms, binfo, - LOOKUP_NORMAL|LOOKUP_NONVIRTUAL); - } - return error_mark_node; -} - -/* We want the address of a function or method. We avoid creating a - pointer-to-member function. */ - -tree -build_addr_func (function) - tree function; -{ - tree type = TREE_TYPE (function); - - /* We have to do these by hand to avoid real pointer to member - functions. */ - if (TREE_CODE (type) == METHOD_TYPE) - { - tree addr; - - type = build_pointer_type (type); - - if (mark_addressable (function) == 0) - return error_mark_node; - - addr = build1 (ADDR_EXPR, type, function); - - /* Address of a static or external variable or function counts - as a constant */ - if (staticp (function)) - TREE_CONSTANT (addr) = 1; - - function = addr; - } - else - function = default_conversion (function); - - return function; -} - -/* Build a CALL_EXPR, we can handle FUNCTION_TYPEs, METHOD_TYPEs, or - POINTER_TYPE to those. Note, pointer to member function types - (TYPE_PTRMEMFUNC_P) must be handled by our callers. */ - -tree -build_call (function, result_type, parms) - tree function, result_type, parms; -{ - int is_constructor = 0; - tree tmp; - tree decl; - - function = build_addr_func (function); - - if (TYPE_PTRMEMFUNC_P (TREE_TYPE (function))) - { - sorry ("unable to call pointer to member function here"); - return error_mark_node; - } - - if (TREE_CODE (function) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL) - decl = TREE_OPERAND (function, 0); - else - decl = NULL_TREE; - - if (decl && DECL_CONSTRUCTOR_P (decl)) - is_constructor = 1; - - if (decl) - my_friendly_assert (TREE_USED (decl), 990125); - - /* Don't pass empty class objects by value. This is useful - for tags in STL, which are used to control overload resolution. - We don't need to handle other cases of copying empty classes. */ - if (! decl || ! DECL_BUILT_IN (decl)) - for (tmp = parms; tmp; tmp = TREE_CHAIN (tmp)) - if (is_empty_class (TREE_TYPE (TREE_VALUE (tmp))) - && ! TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (tmp)))) - { - tree t = make_node (RTL_EXPR); - TREE_TYPE (t) = TREE_TYPE (TREE_VALUE (tmp)); - RTL_EXPR_RTL (t) = const0_rtx; - RTL_EXPR_SEQUENCE (t) = NULL_RTX; - TREE_VALUE (tmp) = build (COMPOUND_EXPR, TREE_TYPE (t), - TREE_VALUE (tmp), t); - } - - function = build_nt (CALL_EXPR, function, parms, NULL_TREE); - TREE_HAS_CONSTRUCTOR (function) = is_constructor; - TREE_TYPE (function) = result_type; - TREE_SIDE_EFFECTS (function) = 1; - - return function; -} - -/* Build something of the form ptr->method (args) - or object.method (args). This can also build - calls to constructors, and find friends. - - Member functions always take their class variable - as a pointer. - - INSTANCE is a class instance. - - NAME is the name of the method desired, usually an IDENTIFIER_NODE. - - PARMS help to figure out what that NAME really refers to. - - BASETYPE_PATH, if non-NULL, contains a chain from the type of INSTANCE - down to the real instance type to use for access checking. We need this - information to get protected accesses correct. This parameter is used - by build_member_call. - - FLAGS is the logical disjunction of zero or more LOOKUP_ - flags. See cp-tree.h for more info. - - If this is all OK, calls build_function_call with the resolved - member function. - - This function must also handle being called to perform - initialization, promotion/coercion of arguments, and - instantiation of default parameters. - - Note that NAME may refer to an instance variable name. If - `operator()()' is defined for the type of that field, then we return - that result. */ - -tree -build_method_call (instance, name, parms, basetype_path, flags) - tree instance, name, parms, basetype_path; - int flags; -{ - tree basetype, instance_ptr; - -#ifdef GATHER_STATISTICS - n_build_method_call++; -#endif - - if (instance == error_mark_node - || name == error_mark_node - || parms == error_mark_node - || (instance != NULL_TREE && TREE_TYPE (instance) == error_mark_node)) - return error_mark_node; - - if (processing_template_decl) - { - /* We need to process template parm names here so that tsubst catches - them properly. Other type names can wait. */ - if (TREE_CODE (name) == BIT_NOT_EXPR) - { - tree type = NULL_TREE; - - if (TREE_CODE (TREE_OPERAND (name, 0)) == IDENTIFIER_NODE) - type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0); - else if (TREE_CODE (TREE_OPERAND (name, 0)) == TYPE_DECL) - type = TREE_TYPE (TREE_OPERAND (name, 0)); - - if (type && TREE_CODE (type) == TEMPLATE_TYPE_PARM) - name = build_min_nt (BIT_NOT_EXPR, type); - } - - return build_min_nt (METHOD_CALL_EXPR, name, instance, parms, NULL_TREE); - } - - if (TREE_CODE (name) == BIT_NOT_EXPR) - { - if (parms) - error ("destructors take no parameters"); - basetype = TREE_TYPE (instance); - if (TREE_CODE (basetype) == REFERENCE_TYPE) - basetype = TREE_TYPE (basetype); - - if (! check_dtor_name (basetype, name)) - cp_error - ("destructor name `~%T' does not match type `%T' of expression", - TREE_OPERAND (name, 0), basetype); - - if (! TYPE_HAS_DESTRUCTOR (complete_type (basetype))) - return cp_convert (void_type_node, instance); - instance = default_conversion (instance); - instance_ptr = build_unary_op (ADDR_EXPR, instance, 0); - return build_delete (build_pointer_type (basetype), - instance_ptr, integer_two_node, - LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0); - } - - return build_new_method_call (instance, name, parms, basetype_path, flags); -} - -/* New overloading code. */ - -struct z_candidate { - tree fn; - tree convs; - tree second_conv; - int viable; - tree basetype_path; - tree template; - tree warnings; - struct z_candidate *next; -}; - -#define IDENTITY_RANK 0 -#define EXACT_RANK 1 -#define PROMO_RANK 2 -#define STD_RANK 3 -#define PBOOL_RANK 4 -#define USER_RANK 5 -#define ELLIPSIS_RANK 6 -#define BAD_RANK 7 - -#define ICS_RANK(NODE) \ - (ICS_BAD_FLAG (NODE) ? BAD_RANK \ - : ICS_ELLIPSIS_FLAG (NODE) ? ELLIPSIS_RANK \ - : ICS_USER_FLAG (NODE) ? USER_RANK \ - : ICS_STD_RANK (NODE)) - -#define ICS_STD_RANK(NODE) TREE_COMPLEXITY (NODE) - -#define ICS_USER_FLAG(NODE) TREE_LANG_FLAG_0 (NODE) -#define ICS_ELLIPSIS_FLAG(NODE) TREE_LANG_FLAG_1 (NODE) -#define ICS_THIS_FLAG(NODE) TREE_LANG_FLAG_2 (NODE) -#define ICS_BAD_FLAG(NODE) TREE_LANG_FLAG_3 (NODE) - -#define USER_CONV_CAND(NODE) \ - ((struct z_candidate *)WRAPPER_PTR (TREE_OPERAND (NODE, 1))) -#define USER_CONV_FN(NODE) (USER_CONV_CAND (NODE)->fn) - -int -null_ptr_cst_p (t) - tree t; -{ - if (t == null_node - || (integer_zerop (t) && TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE)) - return 1; - return 0; -} - -static tree -build_conv (code, type, from) - enum tree_code code; - tree type, from; -{ - tree t = build1 (code, type, from); - int rank = ICS_STD_RANK (from); - switch (code) - { - case PTR_CONV: - case PMEM_CONV: - case BASE_CONV: - case STD_CONV: - if (rank < STD_RANK) - rank = STD_RANK; - break; - - case QUAL_CONV: - if (rank < EXACT_RANK) - rank = EXACT_RANK; - - default: - break; - } - ICS_STD_RANK (t) = rank; - ICS_USER_FLAG (t) = ICS_USER_FLAG (from); - ICS_BAD_FLAG (t) = ICS_BAD_FLAG (from); - return t; -} - -static tree -non_reference (t) - tree t; -{ - if (TREE_CODE (t) == REFERENCE_TYPE) - t = TREE_TYPE (t); - return t; -} - -static tree -strip_top_quals (t) - tree t; -{ - if (TREE_CODE (t) == ARRAY_TYPE) - return t; - return TYPE_MAIN_VARIANT (t); -} - -/* Returns the standard conversion path (see [conv]) from type FROM to type - TO, if any. For proper handling of null pointer constants, you must - also pass the expression EXPR to convert from. */ - -static tree -standard_conversion (to, from, expr) - tree to, from, expr; -{ - enum tree_code fcode, tcode; - tree conv; - int fromref = 0; - - if (TREE_CODE (to) == REFERENCE_TYPE) - to = TREE_TYPE (to); - if (TREE_CODE (from) == REFERENCE_TYPE) - { - fromref = 1; - from = TREE_TYPE (from); - } - to = strip_top_quals (to); - from = strip_top_quals (from); - - if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to)) - && expr && type_unknown_p (expr)) - { - expr = instantiate_type (to, expr, 0); - if (expr == error_mark_node) - return NULL_TREE; - from = TREE_TYPE (expr); - } - - fcode = TREE_CODE (from); - tcode = TREE_CODE (to); - - conv = build1 (IDENTITY_CONV, from, expr); - - if (fcode == FUNCTION_TYPE) - { - from = build_pointer_type (from); - fcode = TREE_CODE (from); - conv = build_conv (LVALUE_CONV, from, conv); - } - else if (fcode == ARRAY_TYPE) - { - from = build_pointer_type (TREE_TYPE (from)); - fcode = TREE_CODE (from); - conv = build_conv (LVALUE_CONV, from, conv); - } - else if (fromref || (expr && real_lvalue_p (expr))) - conv = build_conv (RVALUE_CONV, from, conv); - - if (from == to) - return conv; - - if ((tcode == POINTER_TYPE || TYPE_PTRMEMFUNC_P (to)) - && expr && null_ptr_cst_p (expr)) - { - conv = build_conv (STD_CONV, to, conv); - } - else if (tcode == POINTER_TYPE && fcode == POINTER_TYPE) - { - enum tree_code ufcode = TREE_CODE (TREE_TYPE (from)); - enum tree_code utcode = TREE_CODE (TREE_TYPE (to)); - - if (same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (from)), - TYPE_MAIN_VARIANT (TREE_TYPE (to)))) - ; - else if (utcode == VOID_TYPE && ufcode != OFFSET_TYPE - && ufcode != FUNCTION_TYPE) - { - from = build_pointer_type - (cp_build_qualified_type (void_type_node, - CP_TYPE_QUALS (TREE_TYPE (from)))); - conv = build_conv (PTR_CONV, from, conv); - } - else if (ufcode == OFFSET_TYPE && utcode == OFFSET_TYPE) - { - tree fbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (from)); - tree tbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (to)); - - if (DERIVED_FROM_P (fbase, tbase) - && (same_type_p - (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (from))), - TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (to)))))) - { - from = build_offset_type (tbase, TREE_TYPE (TREE_TYPE (from))); - from = build_pointer_type (from); - conv = build_conv (PMEM_CONV, from, conv); - } - } - else if (IS_AGGR_TYPE (TREE_TYPE (from)) - && IS_AGGR_TYPE (TREE_TYPE (to))) - { - if (DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from))) - { - from = - cp_build_qualified_type (TREE_TYPE (to), - CP_TYPE_QUALS (TREE_TYPE (from))); - from = build_pointer_type (from); - conv = build_conv (PTR_CONV, from, conv); - } - } - - if (same_type_p (from, to)) - /* OK */; - else if (comp_ptr_ttypes (TREE_TYPE (to), TREE_TYPE (from))) - conv = build_conv (QUAL_CONV, to, conv); - else if (expr && string_conv_p (to, expr, 0)) - /* converting from string constant to char *. */ - conv = build_conv (QUAL_CONV, to, conv); - else if (ptr_reasonably_similar (TREE_TYPE (to), TREE_TYPE (from))) - { - conv = build_conv (PTR_CONV, to, conv); - ICS_BAD_FLAG (conv) = 1; - } - else - return 0; - - from = to; - } - else if (TYPE_PTRMEMFUNC_P (to) && TYPE_PTRMEMFUNC_P (from)) - { - tree fromfn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (from)); - tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to)); - tree fbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fromfn))); - tree tbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (tofn))); - - if (! DERIVED_FROM_P (fbase, tbase) - || ! same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn)) - || ! compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)), - TREE_CHAIN (TYPE_ARG_TYPES (tofn))) - || CP_TYPE_QUALS (fbase) != CP_TYPE_QUALS (tbase)) - return 0; - - from = cp_build_qualified_type (tbase, CP_TYPE_QUALS (fbase)); - from = build_cplus_method_type (from, TREE_TYPE (fromfn), - TREE_CHAIN (TYPE_ARG_TYPES (fromfn))); - from = build_ptrmemfunc_type (build_pointer_type (from)); - conv = build_conv (PMEM_CONV, from, conv); - } - else if (tcode == BOOLEAN_TYPE) - { - if (! (INTEGRAL_CODE_P (fcode) || fcode == REAL_TYPE - || fcode == POINTER_TYPE || TYPE_PTRMEMFUNC_P (from))) - return 0; - - conv = build_conv (STD_CONV, to, conv); - if (fcode == POINTER_TYPE - || (TYPE_PTRMEMFUNC_P (from) && ICS_STD_RANK (conv) < PBOOL_RANK)) - ICS_STD_RANK (conv) = PBOOL_RANK; - } - /* We don't check for ENUMERAL_TYPE here because there are no standard - conversions to enum type. */ - else if (tcode == INTEGER_TYPE || tcode == BOOLEAN_TYPE - || tcode == REAL_TYPE) - { - if (! (INTEGRAL_CODE_P (fcode) || fcode == REAL_TYPE)) - return 0; - conv = build_conv (STD_CONV, to, conv); - - /* Give this a better rank if it's a promotion. */ - if (to == type_promotes_to (from) - && ICS_STD_RANK (TREE_OPERAND (conv, 0)) <= PROMO_RANK) - ICS_STD_RANK (conv) = PROMO_RANK; - } - else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from) - && DERIVED_FROM_P (to, from)) - { - if (TREE_CODE (conv) == RVALUE_CONV) - conv = TREE_OPERAND (conv, 0); - conv = build_conv (BASE_CONV, to, conv); - } - else - return 0; - - return conv; -} - -/* Returns the conversion path from type FROM to reference type TO for - purposes of reference binding. For lvalue binding, either pass a - reference type to FROM or an lvalue expression to EXPR. - - Currently does not distinguish in the generated trees between binding to - an lvalue and a temporary. Should it? */ - -static tree -reference_binding (rto, rfrom, expr, flags) - tree rto, rfrom, expr; - int flags; -{ - tree conv; - int lvalue = 1; - tree to = TREE_TYPE (rto); - tree from = rfrom; - int related; - - if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr)) - { - expr = instantiate_type (to, expr, 0); - if (expr == error_mark_node) - return NULL_TREE; - from = TREE_TYPE (expr); - } - - if (TREE_CODE (from) == REFERENCE_TYPE) - from = TREE_TYPE (from); - else if (! expr || ! real_lvalue_p (expr)) - lvalue = 0; - - related = (same_type_p (TYPE_MAIN_VARIANT (to), - TYPE_MAIN_VARIANT (from)) - || (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from) - && DERIVED_FROM_P (to, from))); - - if (lvalue && related && at_least_as_qualified_p (to, from)) - { - conv = build1 (IDENTITY_CONV, from, expr); - - if (same_type_p (TYPE_MAIN_VARIANT (to), - TYPE_MAIN_VARIANT (from))) - conv = build_conv (REF_BIND, rto, conv); - else - { - conv = build_conv (REF_BIND, rto, conv); - ICS_STD_RANK (conv) = STD_RANK; - } - } - else - conv = NULL_TREE; - - if (! conv) - { - conv = standard_conversion (to, rfrom, expr); - if (conv) - { - conv = build_conv (REF_BIND, rto, conv); - - /* Bind directly to a base subobject of a class rvalue. Do it - after building the conversion for proper handling of ICS_RANK. */ - if (TREE_CODE (TREE_OPERAND (conv, 0)) == BASE_CONV) - TREE_OPERAND (conv, 0) = TREE_OPERAND (TREE_OPERAND (conv, 0), 0); - } - if (conv - && ((! (CP_TYPE_CONST_NON_VOLATILE_P (to) - && (flags & LOOKUP_NO_TEMP_BIND) == 0)) - /* If T1 is reference-related to T2, cv1 must be the same - cv-qualification as, or greater cv-qualification than, - cv2; otherwise, the program is ill-formed. */ - || (related && !at_least_as_qualified_p (to, from)))) - ICS_BAD_FLAG (conv) = 1; - } - - return conv; -} - -/* Returns the implicit conversion sequence (see [over.ics]) from type FROM - to type TO. The optional expression EXPR may affect the conversion. - FLAGS are the usual overloading flags. Only LOOKUP_NO_CONVERSION is - significant. */ - -static tree -implicit_conversion (to, from, expr, flags) - tree to, from, expr; - int flags; -{ - tree conv; - struct z_candidate *cand; - - if (TREE_CODE (to) == REFERENCE_TYPE) - conv = reference_binding (to, from, expr, flags); - else - conv = standard_conversion (to, from, expr); - - if (conv) - ; - else if (expr != NULL_TREE - && (IS_AGGR_TYPE (non_reference (from)) - || IS_AGGR_TYPE (non_reference (to))) - && (flags & LOOKUP_NO_CONVERSION) == 0) - { - cand = build_user_type_conversion_1 - (to, expr, LOOKUP_ONLYCONVERTING); - if (cand) - conv = cand->second_conv; - if ((! conv || ICS_BAD_FLAG (conv)) - && TREE_CODE (to) == REFERENCE_TYPE - && (flags & LOOKUP_NO_TEMP_BIND) == 0) - { - cand = build_user_type_conversion_1 - (TYPE_MAIN_VARIANT (TREE_TYPE (to)), expr, LOOKUP_ONLYCONVERTING); - if (cand) - { - if (!CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (to))) - ICS_BAD_FLAG (cand->second_conv) = 1; - if (!conv || (ICS_BAD_FLAG (conv) - > ICS_BAD_FLAG (cand->second_conv))) - conv = build_conv (REF_BIND, to, cand->second_conv); - } - } - } - - return conv; -} - -/* Add a new entry to the list of candidates. Used by the add_*_candidate - functions. */ - -static struct z_candidate * -add_candidate (candidates, fn, convs, viable) - struct z_candidate *candidates; - tree fn, convs; - int viable; -{ - struct z_candidate *cand - = (struct z_candidate *) scratchalloc (sizeof (struct z_candidate)); - - cand->fn = fn; - cand->convs = convs; - cand->second_conv = NULL_TREE; - cand->viable = viable; - cand->basetype_path = NULL_TREE; - cand->template = NULL_TREE; - cand->warnings = NULL_TREE; - cand->next = candidates; - - return cand; -} - -/* Create an overload candidate for the function or method FN called with - the argument list ARGLIST and add it to CANDIDATES. FLAGS is passed on - to implicit_conversion. */ - -static struct z_candidate * -add_function_candidate (candidates, fn, arglist, flags) - struct z_candidate *candidates; - tree fn, arglist; - int flags; -{ - tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (fn)); - int i, len; - tree convs; - tree parmnode, argnode; - int viable = 1; - - /* The `this', `in_chrg', and `vlist' arguments to constructors are - not considered in overload resolution. */ - if (DECL_CONSTRUCTOR_P (fn)) - { - parmlist = TREE_CHAIN (parmlist); - arglist = TREE_CHAIN (arglist); - if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn))) - { - parmlist = TREE_CHAIN (parmlist); - arglist = TREE_CHAIN (arglist); - } - if ((flags & LOOKUP_HAS_VLIST) - && DECL_CONSTRUCTOR_FOR_PVBASE_P (fn)) - { - parmlist = TREE_CHAIN (parmlist); - arglist = TREE_CHAIN (arglist); - } - else if (!(flags & LOOKUP_HAS_VLIST) - && !DECL_CONSTRUCTOR_FOR_PVBASE_P (fn)) - /* Ok */; - else - { - /* The ctor expects a vlist and the arguments don't have - one, or vice versa, so fn is not even a candidate, since - the corresponding ctor would be the candidate. */ - return candidates; - } - } - - len = list_length (arglist); - convs = make_scratch_vec (len); - - /* 13.3.2 - Viable functions [over.match.viable] - First, to be a viable function, a candidate function shall have enough - parameters to agree in number with the arguments in the list. - - We need to check this first; otherwise, checking the ICSes might cause - us to produce an ill-formed template instantiation. */ - - parmnode = parmlist; - for (i = 0; i < len; ++i) - { - if (parmnode == NULL_TREE || parmnode == void_list_node) - break; - parmnode = TREE_CHAIN (parmnode); - } - - if (i < len && parmnode) - viable = 0; - - /* Make sure there are default args for the rest of the parms. */ - else for (; parmnode && parmnode != void_list_node; - parmnode = TREE_CHAIN (parmnode)) - if (! TREE_PURPOSE (parmnode)) - { - viable = 0; - break; - } - - if (! viable) - goto out; - - /* Second, for F to be a viable function, there shall exist for each - argument an implicit conversion sequence that converts that argument - to the corresponding parameter of F. */ - - parmnode = parmlist; - argnode = arglist; - - for (i = 0; i < len; ++i) - { - tree arg = TREE_VALUE (argnode); - tree argtype = lvalue_type (arg); - tree t; - - if (parmnode == void_list_node) - break; - - if (parmnode) - { - tree parmtype = TREE_VALUE (parmnode); - - /* [over.match.funcs] For conversion functions, the function is - considered to be a member of the class of the implicit object - argument for the purpose of defining the type of the implicit - object parameter. - - Since build_over_call ignores the ICS for the `this' parameter, - we can just change the parm type. */ - if (DECL_CONV_FN_P (fn) && i == 0) - { - parmtype - = build_qualified_type (TREE_TYPE (argtype), - TYPE_QUALS (TREE_TYPE (parmtype))); - parmtype = build_pointer_type (parmtype); - } - - t = implicit_conversion (parmtype, argtype, arg, flags); - } - else - { - t = build1 (IDENTITY_CONV, argtype, arg); - ICS_ELLIPSIS_FLAG (t) = 1; - } - - if (i == 0 && t && TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE - && ! DECL_CONSTRUCTOR_P (fn)) - ICS_THIS_FLAG (t) = 1; - - TREE_VEC_ELT (convs, i) = t; - if (! t) - { - viable = 0; - break; - } - - if (ICS_BAD_FLAG (t)) - viable = -1; - - if (parmnode) - parmnode = TREE_CHAIN (parmnode); - argnode = TREE_CHAIN (argnode); - } - - out: - return add_candidate (candidates, fn, convs, viable); -} - -/* Create an overload candidate for the conversion function FN which will - be invoked for expression OBJ, producing a pointer-to-function which - will in turn be called with the argument list ARGLIST, and add it to - CANDIDATES. FLAGS is passed on to implicit_conversion. - - Actually, we don't really care about FN; we care about the type it - converts to. There may be multiple conversion functions that will - convert to that type, and we rely on build_user_type_conversion_1 to - choose the best one; so when we create our candidate, we record the type - instead of the function. */ - -static struct z_candidate * -add_conv_candidate (candidates, fn, obj, arglist) - struct z_candidate *candidates; - tree fn, obj, arglist; -{ - tree totype = TREE_TYPE (TREE_TYPE (fn)); - tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (totype)); - int i, len = list_length (arglist) + 1; - tree convs = make_scratch_vec (len); - tree parmnode = parmlist; - tree argnode = arglist; - int viable = 1; - int flags = LOOKUP_NORMAL; - - /* Don't bother looking up the same type twice. */ - if (candidates && candidates->fn == totype) - return candidates; - - for (i = 0; i < len; ++i) - { - tree arg = i == 0 ? obj : TREE_VALUE (argnode); - tree argtype = lvalue_type (arg); - tree t; - - if (i == 0) - t = implicit_conversion (totype, argtype, arg, flags); - else if (parmnode == void_list_node) - break; - else if (parmnode) - t = implicit_conversion (TREE_VALUE (parmnode), argtype, arg, flags); - else - { - t = build1 (IDENTITY_CONV, argtype, arg); - ICS_ELLIPSIS_FLAG (t) = 1; - } - - TREE_VEC_ELT (convs, i) = t; - if (! t) - break; - - if (ICS_BAD_FLAG (t)) - viable = -1; - - if (i == 0) - continue; - - if (parmnode) - parmnode = TREE_CHAIN (parmnode); - argnode = TREE_CHAIN (argnode); - } - - if (i < len) - viable = 0; - - for (; parmnode && parmnode != void_list_node; - parmnode = TREE_CHAIN (parmnode)) - if (! TREE_PURPOSE (parmnode)) - { - viable = 0; - break; - } - - return add_candidate (candidates, totype, convs, viable); -} - -static struct z_candidate * -build_builtin_candidate (candidates, fnname, type1, type2, - args, argtypes, flags) - struct z_candidate *candidates; - tree fnname, type1, type2, *args, *argtypes; - int flags; - -{ - tree t, convs; - int viable = 1, i; - tree types[2]; - - types[0] = type1; - types[1] = type2; - - convs = make_scratch_vec (args[2] ? 3 : (args[1] ? 2 : 1)); - - for (i = 0; i < 2; ++i) - { - if (! args[i]) - break; - - t = implicit_conversion (types[i], argtypes[i], args[i], flags); - if (! t) - { - viable = 0; - /* We need something for printing the candidate. */ - t = build1 (IDENTITY_CONV, types[i], NULL_TREE); - } - else if (ICS_BAD_FLAG (t)) - viable = 0; - TREE_VEC_ELT (convs, i) = t; - } - - /* For COND_EXPR we rearranged the arguments; undo that now. */ - if (args[2]) - { - TREE_VEC_ELT (convs, 2) = TREE_VEC_ELT (convs, 1); - TREE_VEC_ELT (convs, 1) = TREE_VEC_ELT (convs, 0); - t = implicit_conversion (boolean_type_node, argtypes[2], args[2], flags); - if (t) - TREE_VEC_ELT (convs, 0) = t; - else - viable = 0; - } - - return add_candidate (candidates, fnname, convs, viable); -} - -static int -is_complete (t) - tree t; -{ - return TYPE_SIZE (complete_type (t)) != NULL_TREE; -} - -/* Create any builtin operator overload candidates for the operator in - question given the converted operand types TYPE1 and TYPE2. The other - args are passed through from add_builtin_candidates to - build_builtin_candidate. */ - -static struct z_candidate * -add_builtin_candidate (candidates, code, code2, fnname, type1, type2, - args, argtypes, flags) - struct z_candidate *candidates; - enum tree_code code, code2; - tree fnname, type1, type2, *args, *argtypes; - int flags; -{ - switch (code) - { - case POSTINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - args[1] = integer_zero_node; - type2 = integer_type_node; - break; - default: - break; - } - - switch (code) - { - -/* 4 For every pair T, VQ), where T is an arithmetic or enumeration type, - and VQ is either volatile or empty, there exist candidate operator - functions of the form - VQ T& operator++(VQ T&); - T operator++(VQ T&, int); - 5 For every pair T, VQ), where T is an enumeration type or an arithmetic - type other than bool, and VQ is either volatile or empty, there exist - candidate operator functions of the form - VQ T& operator--(VQ T&); - T operator--(VQ T&, int); - 6 For every pair T, VQ), where T is a cv-qualified or cv-unqualified - complete object type, and VQ is either volatile or empty, there exist - candidate operator functions of the form - T*VQ& operator++(T*VQ&); - T*VQ& operator--(T*VQ&); - T* operator++(T*VQ&, int); - T* operator--(T*VQ&, int); */ - - case POSTDECREMENT_EXPR: - case PREDECREMENT_EXPR: - if (TREE_CODE (type1) == BOOLEAN_TYPE) - return candidates; - case POSTINCREMENT_EXPR: - case PREINCREMENT_EXPR: - if ((ARITHMETIC_TYPE_P (type1) && TREE_CODE (type1) != ENUMERAL_TYPE) - || TYPE_PTROB_P (type1)) - { - type1 = build_reference_type (type1); - break; - } - return candidates; - -/* 7 For every cv-qualified or cv-unqualified complete object type T, there - exist candidate operator functions of the form - - T& operator*(T*); - - 8 For every function type T, there exist candidate operator functions of - the form - T& operator*(T*); */ - - case INDIRECT_REF: - if (TREE_CODE (type1) == POINTER_TYPE - && (TYPE_PTROB_P (type1) - || TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE)) - break; - return candidates; - -/* 9 For every type T, there exist candidate operator functions of the form - T* operator+(T*); - - 10For every promoted arithmetic type T, there exist candidate operator - functions of the form - T operator+(T); - T operator-(T); */ - - case CONVERT_EXPR: /* unary + */ - if (TREE_CODE (type1) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (type1)) != OFFSET_TYPE) - break; - case NEGATE_EXPR: - if (ARITHMETIC_TYPE_P (type1)) - break; - return candidates; - -/* 11For every promoted integral type T, there exist candidate operator - functions of the form - T operator~(T); */ - - case BIT_NOT_EXPR: - if (INTEGRAL_TYPE_P (type1)) - break; - return candidates; - -/* 12For every quintuple C1, C2, T, CV1, CV2), where C2 is a class type, C1 - is the same type as C2 or is a derived class of C2, T is a complete - object type or a function type, and CV1 and CV2 are cv-qualifier-seqs, - there exist candidate operator functions of the form - CV12 T& operator->*(CV1 C1*, CV2 T C2::*); - where CV12 is the union of CV1 and CV2. */ - - case MEMBER_REF: - if (TREE_CODE (type1) == POINTER_TYPE - && (TYPE_PTRMEMFUNC_P (type2) || TYPE_PTRMEM_P (type2))) - { - tree c1 = TREE_TYPE (type1); - tree c2 = (TYPE_PTRMEMFUNC_P (type2) - ? TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (type2))) - : TYPE_OFFSET_BASETYPE (TREE_TYPE (type2))); - - if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1) - && (TYPE_PTRMEMFUNC_P (type2) - || is_complete (TREE_TYPE (TREE_TYPE (type2))))) - break; - } - return candidates; - -/* 13For every pair of promoted arithmetic types L and R, there exist can- - didate operator functions of the form - LR operator*(L, R); - LR operator/(L, R); - LR operator+(L, R); - LR operator-(L, R); - bool operator<(L, R); - bool operator>(L, R); - bool operator<=(L, R); - bool operator>=(L, R); - bool operator==(L, R); - bool operator!=(L, R); - where LR is the result of the usual arithmetic conversions between - types L and R. - - 14For every pair of types T and I, where T is a cv-qualified or cv- - unqualified complete object type and I is a promoted integral type, - there exist candidate operator functions of the form - T* operator+(T*, I); - T& operator[](T*, I); - T* operator-(T*, I); - T* operator+(I, T*); - T& operator[](I, T*); - - 15For every T, where T is a pointer to complete object type, there exist - candidate operator functions of the form112) - ptrdiff_t operator-(T, T); - - 16For every pointer type T, there exist candidate operator functions of - the form - bool operator<(T, T); - bool operator>(T, T); - bool operator<=(T, T); - bool operator>=(T, T); - bool operator==(T, T); - bool operator!=(T, T); - - 17For every pointer to member type T, there exist candidate operator - functions of the form - bool operator==(T, T); - bool operator!=(T, T); */ - - case MINUS_EXPR: - if (TYPE_PTROB_P (type1) && TYPE_PTROB_P (type2)) - break; - if (TYPE_PTROB_P (type1) && INTEGRAL_TYPE_P (type2)) - { - type2 = ptrdiff_type_node; - break; - } - case MULT_EXPR: - case TRUNC_DIV_EXPR: - if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2)) - break; - return candidates; - - case EQ_EXPR: - case NE_EXPR: - if ((TYPE_PTRMEMFUNC_P (type1) && TYPE_PTRMEMFUNC_P (type2)) - || (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))) - break; - if ((TYPE_PTRMEMFUNC_P (type1) || TYPE_PTRMEM_P (type1)) - && null_ptr_cst_p (args[1])) - { - type2 = type1; - break; - } - if ((TYPE_PTRMEMFUNC_P (type2) || TYPE_PTRMEM_P (type2)) - && null_ptr_cst_p (args[0])) - { - type1 = type2; - break; - } - case LT_EXPR: - case GT_EXPR: - case LE_EXPR: - case GE_EXPR: - case MAX_EXPR: - case MIN_EXPR: - if ((ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2)) - || (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))) - break; - if (TYPE_PTR_P (type1) && null_ptr_cst_p (args[1])) - { - type2 = type1; - break; - } - if (null_ptr_cst_p (args[0]) && TYPE_PTR_P (type2)) - { - type1 = type2; - break; - } - return candidates; - - case PLUS_EXPR: - if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2)) - break; - case ARRAY_REF: - if (INTEGRAL_TYPE_P (type1) && TYPE_PTROB_P (type2)) - { - type1 = ptrdiff_type_node; - break; - } - if (TYPE_PTROB_P (type1) && INTEGRAL_TYPE_P (type2)) - { - type2 = ptrdiff_type_node; - break; - } - return candidates; - -/* 18For every pair of promoted integral types L and R, there exist candi- - date operator functions of the form - LR operator%(L, R); - LR operator&(L, R); - LR operator^(L, R); - LR operator|(L, R); - L operator<<(L, R); - L operator>>(L, R); - where LR is the result of the usual arithmetic conversions between - types L and R. */ - - case TRUNC_MOD_EXPR: - case BIT_AND_EXPR: - case BIT_IOR_EXPR: - case BIT_XOR_EXPR: - case LSHIFT_EXPR: - case RSHIFT_EXPR: - if (INTEGRAL_TYPE_P (type1) && INTEGRAL_TYPE_P (type2)) - break; - return candidates; - -/* 19For every triple L, VQ, R), where L is an arithmetic or enumeration - type, VQ is either volatile or empty, and R is a promoted arithmetic - type, there exist candidate operator functions of the form - VQ L& operator=(VQ L&, R); - VQ L& operator*=(VQ L&, R); - VQ L& operator/=(VQ L&, R); - VQ L& operator+=(VQ L&, R); - VQ L& operator-=(VQ L&, R); - - 20For every pair T, VQ), where T is any type and VQ is either volatile - or empty, there exist candidate operator functions of the form - T*VQ& operator=(T*VQ&, T*); - - 21For every pair T, VQ), where T is a pointer to member type and VQ is - either volatile or empty, there exist candidate operator functions of - the form - VQ T& operator=(VQ T&, T); - - 22For every triple T, VQ, I), where T is a cv-qualified or cv- - unqualified complete object type, VQ is either volatile or empty, and - I is a promoted integral type, there exist candidate operator func- - tions of the form - T*VQ& operator+=(T*VQ&, I); - T*VQ& operator-=(T*VQ&, I); - - 23For every triple L, VQ, R), where L is an integral or enumeration - type, VQ is either volatile or empty, and R is a promoted integral - type, there exist candidate operator functions of the form - - VQ L& operator%=(VQ L&, R); - VQ L& operator<<=(VQ L&, R); - VQ L& operator>>=(VQ L&, R); - VQ L& operator&=(VQ L&, R); - VQ L& operator^=(VQ L&, R); - VQ L& operator|=(VQ L&, R); */ - - case MODIFY_EXPR: - switch (code2) - { - case PLUS_EXPR: - case MINUS_EXPR: - if (TYPE_PTROB_P (type1) && INTEGRAL_TYPE_P (type2)) - { - type2 = ptrdiff_type_node; - break; - } - case MULT_EXPR: - case TRUNC_DIV_EXPR: - if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2)) - break; - return candidates; - - case TRUNC_MOD_EXPR: - case BIT_AND_EXPR: - case BIT_IOR_EXPR: - case BIT_XOR_EXPR: - case LSHIFT_EXPR: - case RSHIFT_EXPR: - if (INTEGRAL_TYPE_P (type1) && INTEGRAL_TYPE_P (type2)) - break; - return candidates; - - case NOP_EXPR: - if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2)) - break; - if ((TYPE_PTRMEMFUNC_P (type1) && TYPE_PTRMEMFUNC_P (type2)) - || (TYPE_PTR_P (type1) && TYPE_PTR_P (type2)) - || (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2)) - || ((TYPE_PTRMEMFUNC_P (type1) - || TREE_CODE (type1) == POINTER_TYPE) - && null_ptr_cst_p (args[1]))) - { - type2 = type1; - break; - } - return candidates; - - default: - my_friendly_abort (367); - } - type1 = build_reference_type (type1); - break; - - case COND_EXPR: - /* Kludge around broken overloading rules whereby - bool ? const char& : enum is ambiguous - (between int and const char&). */ - flags |= LOOKUP_NO_TEMP_BIND; - - /* Extension: Support ?: of enumeral type. Hopefully this will not - be an extension for long. */ - if (TREE_CODE (type1) == ENUMERAL_TYPE && type1 == type2) - break; - else if (TREE_CODE (type1) == ENUMERAL_TYPE - || TREE_CODE (type2) == ENUMERAL_TYPE) - return candidates; - if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2)) - break; - if (TREE_CODE (type1) == TREE_CODE (type2) - && (TREE_CODE (type1) == REFERENCE_TYPE - || TREE_CODE (type1) == POINTER_TYPE - || TYPE_PTRMEMFUNC_P (type1) - || IS_AGGR_TYPE (type1))) - break; - if (TREE_CODE (type1) == REFERENCE_TYPE - || TREE_CODE (type2) == REFERENCE_TYPE) - return candidates; - if (((TYPE_PTRMEMFUNC_P (type1) || TREE_CODE (type1) == POINTER_TYPE) - && null_ptr_cst_p (args[1])) - || IS_AGGR_TYPE (type1)) - { - type2 = type1; - break; - } - if (((TYPE_PTRMEMFUNC_P (type2) || TREE_CODE (type2) == POINTER_TYPE) - && null_ptr_cst_p (args[0])) - || IS_AGGR_TYPE (type2)) - { - type1 = type2; - break; - } - return candidates; - - default: - my_friendly_abort (367); - } - - /* If we're dealing with two pointer types, we need candidates - for both of them. */ - if (type2 && type1 != type2 - && TREE_CODE (type1) == TREE_CODE (type2) - && (TREE_CODE (type1) == REFERENCE_TYPE - || (TREE_CODE (type1) == POINTER_TYPE - && TYPE_PTRMEM_P (type1) == TYPE_PTRMEM_P (type2)) - || TYPE_PTRMEMFUNC_P (type1) - || IS_AGGR_TYPE (type1))) - { - candidates = build_builtin_candidate - (candidates, fnname, type1, type1, args, argtypes, flags); - return build_builtin_candidate - (candidates, fnname, type2, type2, args, argtypes, flags); - } - - return build_builtin_candidate - (candidates, fnname, type1, type2, args, argtypes, flags); -} - -tree -type_decays_to (type) - tree type; -{ - if (TREE_CODE (type) == ARRAY_TYPE) - return build_pointer_type (TREE_TYPE (type)); - if (TREE_CODE (type) == FUNCTION_TYPE) - return build_pointer_type (type); - return type; -} - -/* There are three conditions of builtin candidates: - - 1) bool-taking candidates. These are the same regardless of the input. - 2) pointer-pair taking candidates. These are generated for each type - one of the input types converts to. - 3) arithmetic candidates. According to the WP, we should generate - all of these, but I'm trying not to... */ - -static struct z_candidate * -add_builtin_candidates (candidates, code, code2, fnname, args, flags) - struct z_candidate *candidates; - enum tree_code code, code2; - tree fnname, *args; - int flags; -{ - int ref1, i; - tree type, argtypes[3], types[2]; - - for (i = 0; i < 3; ++i) - { - if (args[i]) - argtypes[i] = lvalue_type (args[i]); - else - argtypes[i] = NULL_TREE; - } - - switch (code) - { -/* 4 For every pair T, VQ), where T is an arithmetic or enumeration type, - and VQ is either volatile or empty, there exist candidate operator - functions of the form - VQ T& operator++(VQ T&); */ - - case POSTINCREMENT_EXPR: - case PREINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - case PREDECREMENT_EXPR: - case MODIFY_EXPR: - ref1 = 1; - break; - -/* 24There also exist candidate operator functions of the form - bool operator!(bool); - bool operator&&(bool, bool); - bool operator||(bool, bool); */ - - case TRUTH_NOT_EXPR: - return build_builtin_candidate - (candidates, fnname, boolean_type_node, - NULL_TREE, args, argtypes, flags); - - case TRUTH_ORIF_EXPR: - case TRUTH_ANDIF_EXPR: - return build_builtin_candidate - (candidates, fnname, boolean_type_node, - boolean_type_node, args, argtypes, flags); - - case ADDR_EXPR: - case COMPOUND_EXPR: - case COMPONENT_REF: - return candidates; - - default: - ref1 = 0; - } - - types[0] = types[1] = NULL_TREE; - - for (i = 0; i < 2; ++i) - { - if (! args[i]) - ; - else if (IS_AGGR_TYPE (argtypes[i])) - { - tree convs; - - if (i == 0 && code == MODIFY_EXPR && code2 == NOP_EXPR) - return candidates; - - convs = lookup_conversions (argtypes[i]); - - if (code == COND_EXPR) - { - if (real_lvalue_p (args[i])) - types[i] = scratch_tree_cons - (NULL_TREE, build_reference_type (argtypes[i]), types[i]); - - types[i] = scratch_tree_cons - (NULL_TREE, TYPE_MAIN_VARIANT (argtypes[i]), types[i]); - } - - else if (! convs) - return candidates; - - for (; convs; convs = TREE_CHAIN (convs)) - { - type = TREE_TYPE (TREE_TYPE (OVL_CURRENT (TREE_VALUE (convs)))); - - if (i == 0 && ref1 - && (TREE_CODE (type) != REFERENCE_TYPE - || CP_TYPE_CONST_P (TREE_TYPE (type)))) - continue; - - if (code == COND_EXPR && TREE_CODE (type) == REFERENCE_TYPE) - types[i] = scratch_tree_cons (NULL_TREE, type, types[i]); - - type = non_reference (type); - if (i != 0 || ! ref1) - { - type = TYPE_MAIN_VARIANT (type_decays_to (type)); - if (code == COND_EXPR && TREE_CODE (type) == ENUMERAL_TYPE) - types[i] = scratch_tree_cons (NULL_TREE, type, types[i]); - if (INTEGRAL_TYPE_P (type)) - type = type_promotes_to (type); - } - - if (! value_member (type, types[i])) - types[i] = scratch_tree_cons (NULL_TREE, type, types[i]); - } - } - else - { - if (code == COND_EXPR && real_lvalue_p (args[i])) - types[i] = scratch_tree_cons - (NULL_TREE, build_reference_type (argtypes[i]), types[i]); - type = non_reference (argtypes[i]); - if (i != 0 || ! ref1) - { - type = TYPE_MAIN_VARIANT (type_decays_to (type)); - if (code == COND_EXPR && TREE_CODE (type) == ENUMERAL_TYPE) - types[i] = scratch_tree_cons (NULL_TREE, type, types[i]); - if (INTEGRAL_TYPE_P (type)) - type = type_promotes_to (type); - } - types[i] = scratch_tree_cons (NULL_TREE, type, types[i]); - } - } - - for (; types[0]; types[0] = TREE_CHAIN (types[0])) - { - if (types[1]) - for (type = types[1]; type; type = TREE_CHAIN (type)) - candidates = add_builtin_candidate - (candidates, code, code2, fnname, TREE_VALUE (types[0]), - TREE_VALUE (type), args, argtypes, flags); - else - candidates = add_builtin_candidate - (candidates, code, code2, fnname, TREE_VALUE (types[0]), - NULL_TREE, args, argtypes, flags); - } - - return candidates; -} - - -/* If TMPL can be successfully instantiated as indicated by - EXPLICIT_TARGS and ARGLIST, adds the instantiation to CANDIDATES. - - TMPL is the template. EXPLICIT_TARGS are any explicit template - arguments. ARGLIST is the arguments provided at the call-site. - The RETURN_TYPE is the desired type for conversion operators. If - OBJ is NULL_TREE, FLAGS are as for add_function_candidate. If an - OBJ is supplied, FLAGS are ignored, and OBJ is as for - add_conv_candidate. */ - -static struct z_candidate* -add_template_candidate_real (candidates, tmpl, explicit_targs, - arglist, return_type, flags, - obj, strict) - struct z_candidate *candidates; - tree tmpl, explicit_targs, arglist, return_type; - int flags; - tree obj; - unification_kind_t strict; -{ - int ntparms = DECL_NTPARMS (tmpl); - tree targs = make_scratch_vec (ntparms); - struct z_candidate *cand; - int i; - tree fn; - - i = fn_type_unification (tmpl, explicit_targs, targs, arglist, - return_type, strict); - - if (i != 0) - return candidates; - - fn = instantiate_template (tmpl, targs); - if (fn == error_mark_node) - return candidates; - - if (obj != NULL_TREE) - /* Aha, this is a conversion function. */ - cand = add_conv_candidate (candidates, fn, obj, arglist); - else - cand = add_function_candidate (candidates, fn, arglist, flags); - if (DECL_TI_TEMPLATE (fn) != tmpl) - /* This situation can occur if a member template of a template - class is specialized. Then, instantiate_template might return - an instantiation of the specialization, in which case the - DECL_TI_TEMPLATE field will point at the original - specialization. For example: - - template struct S { template void f(U); - template <> void f(int) {}; }; - S sd; - sd.f(3); - - Here, TMPL will be template S::f(U). - And, instantiate template will give us the specialization - template <> S::f(int). But, the DECL_TI_TEMPLATE field - for this will point at template template <> S::f(int), - so that we can find the definition. For the purposes of - overload resolution, however, we want the original TMPL. */ - cand->template = tree_cons (tmpl, targs, NULL_TREE); - else - cand->template = DECL_TEMPLATE_INFO (fn); - - return cand; -} - - -static struct z_candidate * -add_template_candidate (candidates, tmpl, explicit_targs, - arglist, return_type, flags, strict) - struct z_candidate *candidates; - tree tmpl, explicit_targs, arglist, return_type; - int flags; - unification_kind_t strict; -{ - return - add_template_candidate_real (candidates, tmpl, explicit_targs, - arglist, return_type, flags, - NULL_TREE, strict); -} - - -static struct z_candidate * -add_template_conv_candidate (candidates, tmpl, obj, arglist, return_type) - struct z_candidate *candidates; - tree tmpl, obj, arglist, return_type; -{ - return - add_template_candidate_real (candidates, tmpl, NULL_TREE, arglist, - return_type, 0, obj, DEDUCE_CONV); -} - - -static int -any_viable (cands) - struct z_candidate *cands; -{ - for (; cands; cands = cands->next) - if (pedantic ? cands->viable == 1 : cands->viable) - return 1; - return 0; -} - -static struct z_candidate * -splice_viable (cands) - struct z_candidate *cands; -{ - struct z_candidate **p = &cands; - - for (; *p; ) - { - if (pedantic ? (*p)->viable == 1 : (*p)->viable) - p = &((*p)->next); - else - *p = (*p)->next; - } - - return cands; -} - -static tree -build_this (obj) - tree obj; -{ - /* Fix this to work on non-lvalues. */ - if (IS_SIGNATURE_POINTER (TREE_TYPE (obj)) - || IS_SIGNATURE_REFERENCE (TREE_TYPE (obj))) - return obj; - else - return build_unary_op (ADDR_EXPR, obj, 0); -} - -static void -print_z_candidates (candidates) - struct z_candidate *candidates; -{ - const char *str = "candidates are:"; - for (; candidates; candidates = candidates->next) - { - if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE) - { - if (candidates->fn == ansi_opname [COND_EXPR]) - cp_error ("%s %D(%T, %T, %T) ", str, candidates->fn, - TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)), - TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)), - TREE_TYPE (TREE_VEC_ELT (candidates->convs, 2))); - else if (TREE_VEC_LENGTH (candidates->convs) == 2) - cp_error ("%s %D(%T, %T) ", str, candidates->fn, - TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)), - TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1))); - else - cp_error ("%s %D(%T) ", str, candidates->fn, - TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0))); - } - else if (TYPE_P (candidates->fn)) - cp_error ("%s %T ", str, candidates->fn); - else - cp_error_at ("%s %+#D%s", str, candidates->fn, - candidates->viable == -1 ? " " : ""); - str = " "; - } -} - -/* Returns the best overload candidate to perform the requested - conversion. This function is used for three the overloading situations - described in [over.match.copy], [over.match.conv], and [over.match.ref]. - If TOTYPE is a REFERENCE_TYPE, we're trying to find an lvalue binding as - per [dcl.init.ref], so we ignore temporary bindings. */ - -static struct z_candidate * -build_user_type_conversion_1 (totype, expr, flags) - tree totype, expr; - int flags; -{ - struct z_candidate *candidates, *cand; - tree fromtype = TREE_TYPE (expr); - tree ctors = NULL_TREE, convs = NULL_TREE, *p; - tree args = NULL_TREE; - tree templates = NULL_TREE; - - if (IS_AGGR_TYPE (totype)) - ctors = lookup_fnfields (TYPE_BINFO (totype), ctor_identifier, 0); - if (IS_AGGR_TYPE (fromtype) - && (! IS_AGGR_TYPE (totype) || ! DERIVED_FROM_P (totype, fromtype))) - convs = lookup_conversions (fromtype); - - candidates = 0; - flags |= LOOKUP_NO_CONVERSION; - - if (ctors) - { - tree t = build_int_2 (0, 0); - TREE_TYPE (t) = build_pointer_type (totype); - args = build_scratch_list (NULL_TREE, expr); - if (TYPE_USES_PVBASES (totype) && !flag_vtable_thunks_compat) - { - args = scratch_tree_cons (NULL_TREE, vlist_zero_node, args); - flags |= LOOKUP_HAS_VLIST; - } - if (TYPE_USES_VIRTUAL_BASECLASSES (totype)) - args = scratch_tree_cons (NULL_TREE, integer_one_node, args); - args = scratch_tree_cons (NULL_TREE, t, args); - - ctors = TREE_VALUE (ctors); - } - for (; ctors; ctors = OVL_NEXT (ctors)) - { - tree ctor = OVL_CURRENT (ctors); - if (DECL_NONCONVERTING_P (ctor)) - continue; - - if (TREE_CODE (ctor) == TEMPLATE_DECL) - { - templates = scratch_tree_cons (NULL_TREE, ctor, templates); - candidates = - add_template_candidate (candidates, ctor, - NULL_TREE, args, NULL_TREE, flags, - DEDUCE_CALL); - } - else - candidates = add_function_candidate (candidates, ctor, - args, flags); - - if (candidates) - { - candidates->second_conv = build1 (IDENTITY_CONV, totype, NULL_TREE); - candidates->basetype_path = TYPE_BINFO (totype); - } - } - - if (convs) - args = build_scratch_list (NULL_TREE, build_this (expr)); - - for (; convs; convs = TREE_CHAIN (convs)) - { - tree fns = TREE_VALUE (convs); - int convflags = LOOKUP_NO_CONVERSION; - tree ics; - - /* If we are called to convert to a reference type, we are trying to - find an lvalue binding, so don't even consider temporaries. If - we don't find an lvalue binding, the caller will try again to - look for a temporary binding. */ - if (TREE_CODE (totype) == REFERENCE_TYPE) - convflags |= LOOKUP_NO_TEMP_BIND; - - if (TREE_CODE (OVL_CURRENT (fns)) != TEMPLATE_DECL) - ics = implicit_conversion - (totype, TREE_TYPE (TREE_TYPE (OVL_CURRENT (fns))), 0, convflags); - else - /* We can't compute this yet. */ - ics = error_mark_node; - - if (TREE_CODE (totype) == REFERENCE_TYPE && ics && ICS_BAD_FLAG (ics)) - /* ignore the near match. */; - else if (ics) - for (; fns; fns = OVL_NEXT (fns)) - { - tree fn = OVL_CURRENT (fns); - struct z_candidate *old_candidates = candidates; - - if (TREE_CODE (fn) == TEMPLATE_DECL) - { - templates = scratch_tree_cons (NULL_TREE, fn, templates); - candidates = - add_template_candidate (candidates, fn, NULL_TREE, - args, totype, flags, - DEDUCE_CONV); - } - else - candidates = add_function_candidate (candidates, fn, - args, flags); - - if (candidates != old_candidates) - { - if (TREE_CODE (fn) == TEMPLATE_DECL) - ics = implicit_conversion - (totype, TREE_TYPE (TREE_TYPE (candidates->fn)), - 0, convflags); - - candidates->second_conv = ics; - candidates->basetype_path = TREE_PURPOSE (convs); - - if (ics == NULL_TREE) - candidates->viable = 0; - else if (candidates->viable == 1 && ICS_BAD_FLAG (ics)) - candidates->viable = -1; - } - } - } - - if (! any_viable (candidates)) - { -#if 0 - if (flags & LOOKUP_COMPLAIN) - { - if (candidates && ! candidates->next) - /* say why this one won't work or try to be loose */; - else - cp_error ("no viable candidates"); - } -#endif - - return 0; - } - - candidates = splice_viable (candidates); - cand = tourney (candidates); - - if (cand == 0) - { - if (flags & LOOKUP_COMPLAIN) - { - cp_error ("conversion from `%T' to `%T' is ambiguous", - fromtype, totype); - print_z_candidates (candidates); - } - - cand = candidates; /* any one will do */ - cand->second_conv = build1 (AMBIG_CONV, totype, expr); - ICS_USER_FLAG (cand->second_conv) = 1; - ICS_BAD_FLAG (cand->second_conv) = 1; - - return cand; - } - - for (p = &(cand->second_conv); TREE_CODE (*p) != IDENTITY_CONV; ) - p = &(TREE_OPERAND (*p, 0)); - - /* Pedantically, normal function declarations are never considered - to refer to template instantiations, so we only do this with - -fguiding-decls. */ - if (flag_guiding_decls && templates && ! cand->template - && !DECL_INITIAL (cand->fn) - && TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE) - add_maybe_template (cand->fn, templates); - - *p = build - (USER_CONV, - (DECL_CONSTRUCTOR_P (cand->fn) - ? totype : non_reference (TREE_TYPE (TREE_TYPE (cand->fn)))), - expr, build_expr_ptr_wrapper (cand)); - ICS_USER_FLAG (cand->second_conv) = 1; - if (cand->viable == -1) - ICS_BAD_FLAG (cand->second_conv) = 1; - - return cand; -} - -tree -build_user_type_conversion (totype, expr, flags) - tree totype, expr; - int flags; -{ - struct z_candidate *cand - = build_user_type_conversion_1 (totype, expr, flags); - - if (cand) - { - if (TREE_CODE (cand->second_conv) == AMBIG_CONV) - return error_mark_node; - return convert_from_reference (convert_like (cand->second_conv, expr)); - } - return NULL_TREE; -} - -/* Do any initial processing on the arguments to a function call. */ - -static tree -resolve_args (args) - tree args; -{ - tree t; - for (t = args; t; t = TREE_CHAIN (t)) - { - if (TREE_VALUE (t) == error_mark_node) - return error_mark_node; - else if (TREE_CODE (TREE_TYPE (TREE_VALUE (t))) == VOID_TYPE) - { - error ("invalid use of void expression"); - return error_mark_node; - } - else if (TREE_CODE (TREE_VALUE (t)) == OFFSET_REF) - TREE_VALUE (t) = resolve_offset_ref (TREE_VALUE (t)); - } - return args; -} - -tree -build_new_function_call (fn, args) - tree fn, args; -{ - struct z_candidate *candidates = 0, *cand; - tree explicit_targs = NULL_TREE; - int template_only = 0; - - if (TREE_CODE (fn) == TEMPLATE_ID_EXPR) - { - explicit_targs = TREE_OPERAND (fn, 1); - fn = TREE_OPERAND (fn, 0); - template_only = 1; - } - - if (really_overloaded_fn (fn)) - { - tree t1; - tree templates = NULL_TREE; - - args = resolve_args (args); - - if (args == error_mark_node) - return error_mark_node; - - for (t1 = fn; t1; t1 = OVL_CHAIN (t1)) - { - tree t = OVL_FUNCTION (t1); - struct z_candidate *old_candidates = candidates; - - if (TREE_CODE (t) == TEMPLATE_DECL) - { - templates = scratch_tree_cons (NULL_TREE, t, templates); - candidates = add_template_candidate - (candidates, t, explicit_targs, args, NULL_TREE, - LOOKUP_NORMAL, DEDUCE_CALL); - } - else if (! template_only) - candidates = add_function_candidate - (candidates, t, args, LOOKUP_NORMAL); - - if (candidates != old_candidates) - candidates->basetype_path = DECL_REAL_CONTEXT (t); - } - - if (! any_viable (candidates)) - { - if (candidates && ! candidates->next) - return build_function_call (candidates->fn, args); - cp_error ("no matching function for call to `%D (%A)'", - DECL_NAME (OVL_FUNCTION (fn)), args); - if (candidates) - print_z_candidates (candidates); - return error_mark_node; - } - candidates = splice_viable (candidates); - cand = tourney (candidates); - - if (cand == 0) - { - cp_error ("call of overloaded `%D (%A)' is ambiguous", - DECL_NAME (OVL_FUNCTION (fn)), args); - print_z_candidates (candidates); - return error_mark_node; - } - - /* Pedantically, normal function declarations are never considered - to refer to template instantiations, so we only do this with - -fguiding-decls. */ - if (flag_guiding_decls && templates && ! cand->template - && ! DECL_INITIAL (cand->fn)) - add_maybe_template (cand->fn, templates); - - return build_over_call (cand, args, LOOKUP_NORMAL); - } - - /* This is not really overloaded. */ - fn = OVL_CURRENT (fn); - - return build_function_call (fn, args); -} - -static tree -build_object_call (obj, args) - tree obj, args; -{ - struct z_candidate *candidates = 0, *cand; - tree fns, convs, mem_args = NULL_TREE; - tree type = TREE_TYPE (obj); - - if (TYPE_PTRMEMFUNC_P (type)) - { - /* It's no good looking for an overloaded operator() on a - pointer-to-member-function. */ - cp_error ("pointer-to-member function %E cannot be called", obj); - cp_error ("without an object; consider using .* or ->*"); - return error_mark_node; - } - - fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname [CALL_EXPR], 1); - if (fns == error_mark_node) - return error_mark_node; - - args = resolve_args (args); - - if (args == error_mark_node) - return error_mark_node; - - if (fns) - { - tree base = TREE_PURPOSE (fns); - mem_args = scratch_tree_cons (NULL_TREE, build_this (obj), args); - - for (fns = TREE_VALUE (fns); fns; fns = OVL_NEXT (fns)) - { - tree fn = OVL_CURRENT (fns); - if (TREE_CODE (fn) == TEMPLATE_DECL) - { - candidates - = add_template_candidate (candidates, fn, NULL_TREE, - mem_args, NULL_TREE, - LOOKUP_NORMAL, DEDUCE_CALL); - } - else - candidates = add_function_candidate - (candidates, fn, mem_args, LOOKUP_NORMAL); - - if (candidates) - candidates->basetype_path = base; - } - } - - convs = lookup_conversions (type); - - for (; convs; convs = TREE_CHAIN (convs)) - { - tree fns = TREE_VALUE (convs); - tree totype = TREE_TYPE (TREE_TYPE (OVL_CURRENT (fns))); - - if ((TREE_CODE (totype) == POINTER_TYPE - || TREE_CODE (totype) == REFERENCE_TYPE) - && TREE_CODE (TREE_TYPE (totype)) == FUNCTION_TYPE) - for (; fns; fns = OVL_NEXT (fns)) - { - tree fn = OVL_CURRENT (fns); - if (TREE_CODE (fn) == TEMPLATE_DECL) - { - candidates = add_template_conv_candidate (candidates, - fn, - obj, - args, - totype); - } - else - candidates = add_conv_candidate (candidates, fn, obj, args); - - if (candidates) - candidates->basetype_path = TREE_PURPOSE (convs); - } - } - - if (! any_viable (candidates)) - { - cp_error ("no match for call to `(%T) (%A)'", TREE_TYPE (obj), args); - print_z_candidates (candidates); - return error_mark_node; - } - - candidates = splice_viable (candidates); - cand = tourney (candidates); - - if (cand == 0) - { - cp_error ("call of `(%T) (%A)' is ambiguous", TREE_TYPE (obj), args); - print_z_candidates (candidates); - return error_mark_node; - } - - /* Since cand->fn will be a type, not a function, for a conversion - function, we must be careful not to unconditionally look at - DECL_NAME here. */ - if (TREE_CODE (cand->fn) == FUNCTION_DECL - && DECL_NAME (cand->fn) == ansi_opname [CALL_EXPR]) - return build_over_call (cand, mem_args, LOOKUP_NORMAL); - - obj = convert_like (TREE_VEC_ELT (cand->convs, 0), obj); - - /* FIXME */ - return build_function_call (obj, args); -} - -static void -op_error (code, code2, arg1, arg2, arg3, problem) - enum tree_code code, code2; - tree arg1, arg2, arg3; - const char *problem; -{ - const char * opname - = (code == MODIFY_EXPR ? assignop_tab [code2] : opname_tab [code]); - - switch (code) - { - case COND_EXPR: - cp_error ("%s for `%T ? %T : %T'", problem, - error_type (arg1), error_type (arg2), error_type (arg3)); - break; - case POSTINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - cp_error ("%s for `%T%s'", problem, error_type (arg1), opname); - break; - case ARRAY_REF: - cp_error ("%s for `%T[%T]'", problem, - error_type (arg1), error_type (arg2)); - break; - default: - if (arg2) - cp_error ("%s for `%T %s %T'", problem, - error_type (arg1), opname, error_type (arg2)); - else - cp_error ("%s for `%s%T'", problem, opname, error_type (arg1)); - } -} - -tree -build_new_op (code, flags, arg1, arg2, arg3) - enum tree_code code; - int flags; - tree arg1, arg2, arg3; -{ - struct z_candidate *candidates = 0, *cand; - tree fns, mem_arglist = NULL_TREE, arglist, fnname; - enum tree_code code2 = NOP_EXPR; - tree templates = NULL_TREE; - tree conv; - - if (arg1 == error_mark_node - || arg2 == error_mark_node - || arg3 == error_mark_node) - return error_mark_node; - - /* This can happen if a template takes all non-type parameters, e.g. - undeclared_template<1, 5, 72>a; */ - if (code == LT_EXPR && TREE_CODE (arg1) == TEMPLATE_DECL) - { - cp_error ("`%D' must be declared before use", arg1); - return error_mark_node; - } - - if (code == MODIFY_EXPR) - { - code2 = TREE_CODE (arg3); - arg3 = NULL_TREE; - fnname = ansi_assopname[code2]; - } - else - fnname = ansi_opname[code]; - - switch (code) - { - case NEW_EXPR: - case VEC_NEW_EXPR: - case VEC_DELETE_EXPR: - case DELETE_EXPR: - /* Use build_op_new_call and build_op_delete_call instead. */ - my_friendly_abort (981018); - - case CALL_EXPR: - return build_object_call (arg1, arg2); - - default: - break; - } - - /* The comma operator can have void args. */ - if (TREE_CODE (arg1) == OFFSET_REF) - arg1 = resolve_offset_ref (arg1); - if (arg2 && TREE_CODE (arg2) == OFFSET_REF) - arg2 = resolve_offset_ref (arg2); - if (arg3 && TREE_CODE (arg3) == OFFSET_REF) - arg3 = resolve_offset_ref (arg3); - - if (code == COND_EXPR) - { - if (arg2 == NULL_TREE - || TREE_CODE (TREE_TYPE (arg2)) == VOID_TYPE - || TREE_CODE (TREE_TYPE (arg3)) == VOID_TYPE - || (! IS_OVERLOAD_TYPE (TREE_TYPE (arg2)) - && ! IS_OVERLOAD_TYPE (TREE_TYPE (arg3)))) - goto builtin; - } - else if (! IS_OVERLOAD_TYPE (TREE_TYPE (arg1)) - && (! arg2 || ! IS_OVERLOAD_TYPE (TREE_TYPE (arg2)))) - goto builtin; - - if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR) - arg2 = integer_zero_node; - - if (arg2 && arg3) - arglist = scratch_tree_cons (NULL_TREE, arg1, scratch_tree_cons - (NULL_TREE, arg2, build_scratch_list (NULL_TREE, arg3))); - else if (arg2) - arglist = scratch_tree_cons (NULL_TREE, arg1, build_scratch_list (NULL_TREE, arg2)); - else - arglist = build_scratch_list (NULL_TREE, arg1); - - fns = lookup_function_nonclass (fnname, arglist); - - if (fns && TREE_CODE (fns) == TREE_LIST) - fns = TREE_VALUE (fns); - for (; fns; fns = OVL_NEXT (fns)) - { - tree fn = OVL_CURRENT (fns); - if (TREE_CODE (fn) == TEMPLATE_DECL) - { - templates = scratch_tree_cons (NULL_TREE, fn, templates); - candidates - = add_template_candidate (candidates, fn, NULL_TREE, - arglist, TREE_TYPE (fnname), - flags, DEDUCE_CALL); - } - else - candidates = add_function_candidate (candidates, fn, arglist, flags); - } - - if (IS_AGGR_TYPE (TREE_TYPE (arg1))) - { - fns = lookup_fnfields (TYPE_BINFO (TREE_TYPE (arg1)), fnname, 1); - if (fns == error_mark_node) - return fns; - } - else - fns = NULL_TREE; - - if (fns) - { - tree basetype = TREE_PURPOSE (fns); - mem_arglist = scratch_tree_cons (NULL_TREE, build_this (arg1), TREE_CHAIN (arglist)); - for (fns = TREE_VALUE (fns); fns; fns = OVL_NEXT (fns)) - { - tree fn = OVL_CURRENT (fns); - tree this_arglist; - - if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE) - this_arglist = mem_arglist; - else - this_arglist = arglist; - - if (TREE_CODE (fn) == TEMPLATE_DECL) - { - /* A member template. */ - templates = scratch_tree_cons (NULL_TREE, fn, templates); - candidates - = add_template_candidate (candidates, fn, NULL_TREE, - this_arglist, TREE_TYPE (fnname), - flags, DEDUCE_CALL); - } - else - candidates = add_function_candidate - (candidates, fn, this_arglist, flags); - - if (candidates) - candidates->basetype_path = basetype; - } - } - - { - tree args[3]; - - /* Rearrange the arguments for ?: so that add_builtin_candidate only has - to know about two args; a builtin candidate will always have a first - parameter of type bool. We'll handle that in - build_builtin_candidate. */ - if (code == COND_EXPR) - { - args[0] = arg2; - args[1] = arg3; - args[2] = arg1; - } - else - { - args[0] = arg1; - args[1] = arg2; - args[2] = NULL_TREE; - } - - candidates = add_builtin_candidates - (candidates, code, code2, fnname, args, flags); - } - - if (! any_viable (candidates)) - { - switch (code) - { - case POSTINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - /* Look for an `operator++ (int)'. If they didn't have - one, then we fall back to the old way of doing things. */ - if (flags & LOOKUP_COMPLAIN) - cp_pedwarn ("no `%D (int)' declared for postfix `%s', trying prefix operator instead", - fnname, opname_tab [code]); - if (code == POSTINCREMENT_EXPR) - code = PREINCREMENT_EXPR; - else - code = PREDECREMENT_EXPR; - return build_new_op (code, flags, arg1, NULL_TREE, NULL_TREE); - - /* The caller will deal with these. */ - case ADDR_EXPR: - case COMPOUND_EXPR: - case COMPONENT_REF: - return NULL_TREE; - - default: - break; - } - if (flags & LOOKUP_COMPLAIN) - { - op_error (code, code2, arg1, arg2, arg3, "no match"); - print_z_candidates (candidates); - } - return error_mark_node; - } - candidates = splice_viable (candidates); - cand = tourney (candidates); - - if (cand == 0) - { - if (flags & LOOKUP_COMPLAIN) - { - op_error (code, code2, arg1, arg2, arg3, "ambiguous overload"); - print_z_candidates (candidates); - } - return error_mark_node; - } - - if (TREE_CODE (cand->fn) == FUNCTION_DECL) - { - extern int warn_synth; - if (warn_synth - && fnname == ansi_opname[MODIFY_EXPR] - && DECL_ARTIFICIAL (cand->fn) - && candidates->next - && ! candidates->next->next) - { - cp_warning ("using synthesized `%#D' for copy assignment", - cand->fn); - cp_warning_at (" where cfront would use `%#D'", - cand == candidates - ? candidates->next->fn - : candidates->fn); - } - - /* Pedantically, normal function declarations are never considered - to refer to template instantiations, so we only do this with - -fguiding-decls. */ - if (flag_guiding_decls && templates && ! cand->template - && ! DECL_INITIAL (cand->fn) - && TREE_CODE (TREE_TYPE (cand->fn)) != METHOD_TYPE) - add_maybe_template (cand->fn, templates); - - return build_over_call - (cand, - TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE - ? mem_arglist : arglist, - LOOKUP_NORMAL); - } - - /* Check for comparison of different enum types. */ - switch (code) - { - case GT_EXPR: - case LT_EXPR: - case GE_EXPR: - case LE_EXPR: - case EQ_EXPR: - case NE_EXPR: - if (TREE_CODE (TREE_TYPE (arg1)) == ENUMERAL_TYPE - && TREE_CODE (TREE_TYPE (arg2)) == ENUMERAL_TYPE - && (TYPE_MAIN_VARIANT (TREE_TYPE (arg1)) - != TYPE_MAIN_VARIANT (TREE_TYPE (arg2)))) - { - cp_warning ("comparison between `%#T' and `%#T'", - TREE_TYPE (arg1), TREE_TYPE (arg2)); - } - break; - default: - break; - } - - /* We need to strip any leading REF_BIND so that bitfields don't cause - errors. This should not remove any important conversions, because - builtins don't apply to class objects directly. */ - conv = TREE_VEC_ELT (cand->convs, 0); - if (TREE_CODE (conv) == REF_BIND) - conv = TREE_OPERAND (conv, 0); - arg1 = convert_like (conv, arg1); - if (arg2) - { - conv = TREE_VEC_ELT (cand->convs, 1); - if (TREE_CODE (conv) == REF_BIND) - conv = TREE_OPERAND (conv, 0); - arg2 = convert_like (conv, arg2); - } - if (arg3) - { - conv = TREE_VEC_ELT (cand->convs, 2); - if (TREE_CODE (conv) == REF_BIND) - conv = TREE_OPERAND (conv, 0); - arg3 = convert_like (conv, arg3); - } - -builtin: - switch (code) - { - case MODIFY_EXPR: - return build_modify_expr (arg1, code2, arg2); - - case INDIRECT_REF: - return build_indirect_ref (arg1, "unary *"); - - case PLUS_EXPR: - case MINUS_EXPR: - case MULT_EXPR: - case TRUNC_DIV_EXPR: - case GT_EXPR: - case LT_EXPR: - case GE_EXPR: - case LE_EXPR: - case EQ_EXPR: - case NE_EXPR: - case MAX_EXPR: - case MIN_EXPR: - case LSHIFT_EXPR: - case RSHIFT_EXPR: - case TRUNC_MOD_EXPR: - case BIT_AND_EXPR: - case BIT_IOR_EXPR: - case BIT_XOR_EXPR: - case TRUTH_ANDIF_EXPR: - case TRUTH_ORIF_EXPR: - return build_binary_op_nodefault (code, arg1, arg2, code); - - case CONVERT_EXPR: - case NEGATE_EXPR: - case BIT_NOT_EXPR: - case TRUTH_NOT_EXPR: - case PREINCREMENT_EXPR: - case POSTINCREMENT_EXPR: - case PREDECREMENT_EXPR: - case POSTDECREMENT_EXPR: - case REALPART_EXPR: - case IMAGPART_EXPR: - return build_unary_op (code, arg1, candidates != 0); - - case ARRAY_REF: - return build_array_ref (arg1, arg2); - - case COND_EXPR: - return build_conditional_expr (arg1, arg2, arg3); - - case MEMBER_REF: - return build_m_component_ref - (build_indirect_ref (arg1, NULL_PTR), arg2); - - /* The caller will deal with these. */ - case ADDR_EXPR: - case COMPONENT_REF: - case COMPOUND_EXPR: - return NULL_TREE; - - default: - my_friendly_abort (367); - return NULL_TREE; - } -} - -/* Build up a call to operator new. This has to be handled differently - from other operators in the way lookup is handled; first members are - considered, then globals. CODE is either NEW_EXPR or VEC_NEW_EXPR. - TYPE is the type to be created. ARGS are any new-placement args. - FLAGS are the usual overloading flags. */ - -tree -build_op_new_call (code, type, args, flags) - enum tree_code code; - tree type, args; - int flags; -{ - tree fnname = ansi_opname[code]; - - if (IS_AGGR_TYPE (type) && ! (flags & LOOKUP_GLOBAL) - && (TYPE_GETS_NEW (type) & (1 << (code == VEC_NEW_EXPR)))) - { - return build_method_call (build_dummy_object (type), - fnname, args, NULL_TREE, flags); - } - else - return build_new_function_call - (lookup_function_nonclass (fnname, args), args); -} - -/* Build a call to operator delete. This has to be handled very specially, - because the restrictions on what signatures match are different from all - other call instances. For a normal delete, only a delete taking (void *) - or (void *, size_t) is accepted. For a placement delete, only an exact - match with the placement new is accepted. - - CODE is either DELETE_EXPR or VEC_DELETE_EXPR. - ADDR is the pointer to be deleted. For placement delete, it is also - used to determine what the corresponding new looked like. - SIZE is the size of the memory block to be deleted. - FLAGS are the usual overloading flags. - PLACEMENT is the corresponding placement new call, or 0. */ - -tree -build_op_delete_call (code, addr, size, flags, placement) - enum tree_code code; - tree addr, size, placement; - int flags; -{ - tree fn, fns, fnname, fntype, argtypes, args, type; - - if (addr == error_mark_node) - return error_mark_node; - - type = TREE_TYPE (TREE_TYPE (addr)); - fnname = ansi_opname[code]; - - if (IS_AGGR_TYPE (type) && ! (flags & LOOKUP_GLOBAL)) - /* In [class.free] - - If the result of the lookup is ambiguous or inaccessible, or if - the lookup selects a placement deallocation function, the - program is ill-formed. - - Therefore, we ask lookup_fnfields to complain ambout ambiguity. */ - { - fns = lookup_fnfields (TYPE_BINFO (type), fnname, 1); - if (fns == error_mark_node) - return error_mark_node; - } - else - fns = NULL_TREE; - - if (fns == NULL_TREE) - fns = lookup_name_nonclass (fnname); - - if (placement) - { - /* placement is a CALL_EXPR around an ADDR_EXPR around a function. */ - - /* Extract the function. */ - argtypes = TREE_OPERAND (TREE_OPERAND (placement, 0), 0); - /* Then the second parm type. */ - argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (argtypes))); - - /* Also the second argument. */ - args = TREE_CHAIN (TREE_OPERAND (placement, 1)); - } - else - { - /* First try it without the size argument. */ - argtypes = void_list_node; - args = NULL_TREE; - } - - argtypes = tree_cons (NULL_TREE, ptr_type_node, argtypes); - fntype = build_function_type (void_type_node, argtypes); - - /* Strip const and volatile from addr. */ - if (type != TYPE_MAIN_VARIANT (type)) - addr = cp_convert (build_pointer_type (TYPE_MAIN_VARIANT (type)), addr); - - fn = instantiate_type (fntype, fns, 2); - - if (fn != error_mark_node) - { - if (TREE_CODE (fns) == TREE_LIST) - /* Member functions. */ - enforce_access (TREE_PURPOSE (fns), fn); - return build_function_call (fn, expr_tree_cons (NULL_TREE, addr, args)); - } - - /* If we are doing placement delete we do nothing if we don't find a - matching op delete. */ - if (placement) - return NULL_TREE; - - /* Normal delete; now try to find a match including the size argument. */ - argtypes = tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, sizetype, void_list_node)); - fntype = build_function_type (void_type_node, argtypes); - - fn = instantiate_type (fntype, fns, 2); - - if (fn != error_mark_node) - { - if (BASELINK_P (fns)) - /* Member functions. */ - enforce_access (TREE_PURPOSE (fns), fn); - return build_function_call - (fn, expr_tree_cons (NULL_TREE, addr, - build_expr_list (NULL_TREE, size))); - } - - /* finish_function passes LOOKUP_SPECULATIVELY if we're in a - destructor, in which case the error should be deferred - until someone actually tries to delete one of these. */ - if (flags & LOOKUP_SPECULATIVELY) - return NULL_TREE; - - cp_error ("no suitable operator delete for `%T'", type); - return error_mark_node; -} - -/* If the current scope isn't allowed to access DECL along - BASETYPE_PATH, give an error. The most derived class in - BASETYPE_PATH is the one used to qualify DECL. */ - -int -enforce_access (basetype_path, decl) - tree basetype_path; - tree decl; -{ - int accessible; - - accessible = accessible_p (basetype_path, decl); - if (!accessible) - { - if (TREE_PRIVATE (decl)) - cp_error_at ("`%+#D' is private", decl); - else if (TREE_PROTECTED (decl)) - cp_error_at ("`%+#D' is protected", decl); - else - cp_error_at ("`%+#D' is inaccessible", decl); - cp_error ("within this context"); - return 0; - } - - return 1; -} - -/* Perform the conversions in CONVS on the expression EXPR. */ - -static tree -convert_like (convs, expr) - tree convs, expr; -{ - if (ICS_BAD_FLAG (convs) - && TREE_CODE (convs) != USER_CONV - && TREE_CODE (convs) != AMBIG_CONV) - { - tree t = convs; - for (; t; t = TREE_OPERAND (t, 0)) - { - if (TREE_CODE (t) == USER_CONV) - { - expr = convert_like (t, expr); - break; - } - else if (TREE_CODE (t) == AMBIG_CONV) - return convert_like (t, expr); - else if (TREE_CODE (t) == IDENTITY_CONV) - break; - } - return convert_for_initialization - (NULL_TREE, TREE_TYPE (convs), expr, LOOKUP_NORMAL, - "conversion", NULL_TREE, 0); - } - - switch (TREE_CODE (convs)) - { - case USER_CONV: - { - struct z_candidate *cand - = WRAPPER_PTR (TREE_OPERAND (convs, 1)); - tree fn = cand->fn; - tree args; - int flags = LOOKUP_NORMAL; - - if (DECL_CONSTRUCTOR_P (fn)) - { - tree t = build_int_2 (0, 0); - TREE_TYPE (t) = build_pointer_type (DECL_CONTEXT (fn)); - - args = build_scratch_list (NULL_TREE, expr); - if (TYPE_USES_PVBASES (DECL_CONTEXT (fn)) - && !flag_vtable_thunks_compat) - { - args = scratch_tree_cons (NULL_TREE, vlist_zero_node, args); - flags != LOOKUP_HAS_VLIST; - } - if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn))) - args = scratch_tree_cons (NULL_TREE, integer_one_node, args); - args = scratch_tree_cons (NULL_TREE, t, args); - } - else - args = build_this (expr); - expr = build_over_call (cand, args, flags); - - /* If this is a constructor or a function returning an aggr type, - we need to build up a TARGET_EXPR. */ - if (DECL_CONSTRUCTOR_P (fn)) - expr = build_cplus_new (TREE_TYPE (convs), expr); - - return expr; - } - case IDENTITY_CONV: - if (type_unknown_p (expr)) - expr = instantiate_type (TREE_TYPE (convs), expr, 1); - if (TREE_READONLY_DECL_P (expr)) - expr = decl_constant_value (expr); - return expr; - case AMBIG_CONV: - /* Call build_user_type_conversion again for the error. */ - return build_user_type_conversion - (TREE_TYPE (convs), TREE_OPERAND (convs, 0), LOOKUP_NORMAL); - - default: - break; - }; - - expr = convert_like (TREE_OPERAND (convs, 0), expr); - if (expr == error_mark_node) - return error_mark_node; - - switch (TREE_CODE (convs)) - { - case RVALUE_CONV: - if (! IS_AGGR_TYPE (TREE_TYPE (convs))) - return expr; - /* else fall through */ - case BASE_CONV: - { - tree cvt_expr = build_user_type_conversion - (TREE_TYPE (convs), expr, LOOKUP_NORMAL); - if (!cvt_expr) - { - /* This can occur if, for example, the EXPR has incomplete - type. We can't check for that before attempting the - conversion because the type might be an incomplete - array type, which is OK if some constructor for the - destination type takes a pointer argument. */ - if (TYPE_SIZE (TREE_TYPE (expr)) == 0) - { - if (same_type_p (TREE_TYPE (expr), TREE_TYPE (convs))) - incomplete_type_error (expr, TREE_TYPE (expr)); - else - cp_error ("could not convert `%E' (with incomplete type `%T') to `%T'", - expr, TREE_TYPE (expr), TREE_TYPE (convs)); - } - else - cp_error ("could not convert `%E' to `%T'", - expr, TREE_TYPE (convs)); - return error_mark_node; - } - return cvt_expr; - } - - case REF_BIND: - return convert_to_reference - (TREE_TYPE (convs), expr, - CONV_IMPLICIT, LOOKUP_NORMAL|LOOKUP_NO_CONVERSION, - error_mark_node); - case LVALUE_CONV: - return decay_conversion (expr); - - case QUAL_CONV: - /* Warn about deprecated conversion if appropriate. */ - string_conv_p (TREE_TYPE (convs), expr, 1); - break; - - default: - break; - } - return ocp_convert (TREE_TYPE (convs), expr, CONV_IMPLICIT, - LOOKUP_NORMAL|LOOKUP_NO_CONVERSION); -} - -/* ARG is being passed to a varargs function. Perform any conversions - required. Return the converted value. */ - -tree -convert_arg_to_ellipsis (arg) - tree arg; -{ - if (TREE_CODE (TREE_TYPE (arg)) == REAL_TYPE - && (TYPE_PRECISION (TREE_TYPE (arg)) - < TYPE_PRECISION (double_type_node))) - /* Convert `float' to `double'. */ - arg = cp_convert (double_type_node, arg); - else if (IS_AGGR_TYPE (TREE_TYPE (arg)) - && ! TYPE_HAS_TRIVIAL_INIT_REF (TREE_TYPE (arg))) - cp_warning ("cannot pass objects of type `%T' through `...'", - TREE_TYPE (arg)); - else - /* Convert `short' and `char' to full-size `int'. */ - arg = default_conversion (arg); - - arg = require_complete_type (arg); - - return arg; -} - -/* ARG is a default argument expression being passed to a parameter of - the indicated TYPE, which is a parameter to FN. Do any required - conversions. Return the converted value. */ - -tree -convert_default_arg (type, arg, fn) - tree type; - tree arg; - tree fn; -{ - if (fn && DECL_TEMPLATE_INFO (fn)) - { - /* This default argument came from a template. Instantiate the - default argument here, not in tsubst. In the case of - something like: - - template - struct S { - static T t(); - void f(T = t()); - }; - - we must be careful to do name lookup in the scope of S, - rather than in the current class. */ - if (DECL_CLASS_SCOPE_P (fn)) - pushclass (DECL_REAL_CONTEXT (fn), 2); - - arg = tsubst_expr (arg, DECL_TI_ARGS (fn), /*complain=*/1, NULL_TREE); - - if (DECL_CLASS_SCOPE_P (fn)) - popclass (); - - /* Make sure the default argument is reasonable. */ - arg = check_default_argument (type, arg); - } - - arg = break_out_target_exprs (arg); - - if (TREE_CODE (arg) == CONSTRUCTOR) - { - arg = digest_init (type, arg, 0); - arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL, - "default argument", 0, 0); - } - else - { - /* This could get clobbered by the following call. */ - if (TREE_HAS_CONSTRUCTOR (arg)) - arg = copy_node (arg); - - arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL, - "default argument", 0, 0); -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) - && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) - arg = default_conversion (arg); -#endif - } - - return arg; -} - -static tree -build_over_call (cand, args, flags) - struct z_candidate *cand; - tree args; - int flags; -{ - tree fn = cand->fn; - tree convs = cand->convs; - tree converted_args = NULL_TREE; - tree parm = TYPE_ARG_TYPES (TREE_TYPE (fn)); - tree conv, arg, val; - int i = 0; - int is_method = 0; - - /* Give any warnings we noticed during overload resolution. */ - if (cand->warnings) - for (val = cand->warnings; val; val = TREE_CHAIN (val)) - joust (cand, WRAPPER_PTR (TREE_VALUE (val)), 1); - - if (DECL_FUNCTION_MEMBER_P (fn)) - enforce_access (cand->basetype_path, fn); - - if (args && TREE_CODE (args) != TREE_LIST) - args = build_scratch_list (NULL_TREE, args); - arg = args; - - /* The implicit parameters to a constructor are not considered by overload - resolution, and must be of the proper type. */ - if (DECL_CONSTRUCTOR_P (fn)) - { - converted_args = expr_tree_cons (NULL_TREE, TREE_VALUE (arg), converted_args); - arg = TREE_CHAIN (arg); - parm = TREE_CHAIN (parm); - if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn))) - { - converted_args = expr_tree_cons - (NULL_TREE, TREE_VALUE (arg), converted_args); - arg = TREE_CHAIN (arg); - parm = TREE_CHAIN (parm); - } - if (flags & LOOKUP_HAS_VLIST) - { - converted_args = expr_tree_cons - (NULL_TREE, TREE_VALUE (arg), converted_args); - arg = TREE_CHAIN (arg); - parm = TREE_CHAIN (parm); - } - } - /* Bypass access control for 'this' parameter. */ - else if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE) - { - tree parmtype = TREE_VALUE (parm); - tree argtype = TREE_TYPE (TREE_VALUE (arg)); - tree t; - if (ICS_BAD_FLAG (TREE_VEC_ELT (convs, i))) - cp_pedwarn ("passing `%T' as `this' argument of `%#D' discards qualifiers", - TREE_TYPE (argtype), fn); - - /* [class.mfct.nonstatic]: If a nonstatic member function of a class - X is called for an object that is not of type X, or of a type - derived from X, the behavior is undefined. - - So we can assume that anything passed as 'this' is non-null, and - optimize accordingly. */ - if (TREE_CODE (parmtype) == POINTER_TYPE) - t = convert_pointer_to_real (TREE_TYPE (parmtype), TREE_VALUE (arg)); - else - /* This happens with signatures. */ - t = convert_force (parmtype, TREE_VALUE (arg), CONV_C_CAST); - converted_args = expr_tree_cons (NULL_TREE, t, converted_args); - parm = TREE_CHAIN (parm); - arg = TREE_CHAIN (arg); - ++i; - is_method = 1; - } - - for (; arg && parm; - parm = TREE_CHAIN (parm), arg = TREE_CHAIN (arg), ++i) - { - tree type = TREE_VALUE (parm); - - conv = TREE_VEC_ELT (convs, i); - if (ICS_BAD_FLAG (conv)) - { - tree t = conv; - val = TREE_VALUE (arg); - - for (; t; t = TREE_OPERAND (t, 0)) - { - if (TREE_CODE (t) == USER_CONV - || TREE_CODE (t) == AMBIG_CONV) - { - val = convert_like (t, val); - break; - } - else if (TREE_CODE (t) == IDENTITY_CONV) - break; - } - val = convert_for_initialization - (NULL_TREE, type, val, LOOKUP_NORMAL, - "argument passing", fn, i - is_method); - } - else - { - /* Issue warnings about peculiar, but legal, uses of NULL. */ - if (ARITHMETIC_TYPE_P (TREE_VALUE (parm)) - && TREE_VALUE (arg) == null_node) - cp_warning ("converting NULL to non-pointer type"); - - val = convert_like (conv, TREE_VALUE (arg)); - } - -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) - && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) - val = default_conversion (val); -#endif - converted_args = expr_tree_cons (NULL_TREE, val, converted_args); - } - - /* Default arguments */ - for (; parm && parm != void_list_node; parm = TREE_CHAIN (parm)) - converted_args - = expr_tree_cons (NULL_TREE, - convert_default_arg (TREE_VALUE (parm), - TREE_PURPOSE (parm), - fn), - converted_args); - - /* Ellipsis */ - for (; arg; arg = TREE_CHAIN (arg)) - converted_args - = expr_tree_cons (NULL_TREE, - convert_arg_to_ellipsis (TREE_VALUE (arg)), - converted_args); - - converted_args = nreverse (converted_args); - - if (warn_format && (DECL_NAME (fn) || DECL_ASSEMBLER_NAME (fn))) - check_function_format (DECL_NAME (fn), DECL_ASSEMBLER_NAME (fn), - converted_args); - - /* Avoid actually calling copy constructors and copy assignment operators, - if possible. */ - - if (! flag_elide_constructors) - /* Do things the hard way. */; - else if (DECL_CONSTRUCTOR_P (fn) - && TREE_VEC_LENGTH (convs) == 1 - && copy_args_p (fn)) - { - tree targ; - arg = TREE_CHAIN (converted_args); - if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (fn))) - arg = TREE_CHAIN (arg); - if (flags & LOOKUP_HAS_VLIST) - arg = TREE_CHAIN (arg); - arg = TREE_VALUE (arg); - - /* Pull out the real argument, disregarding const-correctness. */ - targ = arg; - while (TREE_CODE (targ) == NOP_EXPR - || TREE_CODE (targ) == NON_LVALUE_EXPR - || TREE_CODE (targ) == CONVERT_EXPR) - targ = TREE_OPERAND (targ, 0); - if (TREE_CODE (targ) == ADDR_EXPR) - { - targ = TREE_OPERAND (targ, 0); - if (!same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (arg))), - TYPE_MAIN_VARIANT (TREE_TYPE (targ)))) - targ = NULL_TREE; - } - else - targ = NULL_TREE; - - if (targ) - arg = targ; - else - arg = build_indirect_ref (arg, 0); - - /* [class.copy]: the copy constructor is implicitly defined even if - the implementation elided its use. */ - if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn))) - mark_used (fn); - - /* If we're creating a temp and we already have one, don't create a - new one. If we're not creating a temp but we get one, use - INIT_EXPR to collapse the temp into our target. Otherwise, if the - ctor is trivial, do a bitwise copy with a simple TARGET_EXPR for a - temp or an INIT_EXPR otherwise. */ - if (integer_zerop (TREE_VALUE (args))) - { - if (! real_lvalue_p (arg)) - return arg; - else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))) - { - val = build_decl (VAR_DECL, NULL_TREE, DECL_CONTEXT (fn)); - val = build (TARGET_EXPR, DECL_CONTEXT (fn), val, arg, 0, 0); - TREE_SIDE_EFFECTS (val) = 1; - return val; - } - } - else if (! real_lvalue_p (arg) - || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))) - { - tree address; - tree to = stabilize_reference - (build_indirect_ref (TREE_VALUE (args), 0)); - - /* If we're initializing an empty class, then we actually - have to use a MODIFY_EXPR rather than an INIT_EXPR. The - reason is that the dummy padding member in the target may - not actually be allocated if TO is a base class - subobject. Since we've set TYPE_NONCOPIED_PARTS on the - padding, a MODIFY_EXPR will preserve its value, which is - the right thing to do if it's not really padding at all. - - It's not safe to just throw away the ARG if we're looking - at an empty class because the ARG might contain a - TARGET_EXPR which wants to be bound to TO. If it is not, - expand_expr will assign a dummy slot for the TARGET_EXPR, - and we will call a destructor for it, which is wrong, - because we will also destroy TO, but will never have - constructed it. */ - val = build (is_empty_class (DECL_CLASS_CONTEXT (fn)) - ? MODIFY_EXPR : INIT_EXPR, - DECL_CONTEXT (fn), to, arg); - TREE_SIDE_EFFECTS (val) = 1; - address = build_unary_op (ADDR_EXPR, val, 0); - /* Avoid a warning about this expression, if the address is - never used. */ - TREE_USED (address) = 1; - return address; - } - } - else if (DECL_NAME (fn) == ansi_opname[MODIFY_EXPR] - && copy_args_p (fn) - && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CLASS_CONTEXT (fn))) - { - tree to = stabilize_reference - (build_indirect_ref (TREE_VALUE (converted_args), 0)); - - arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0); - - val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg); - TREE_SIDE_EFFECTS (val) = 1; - return val; - } - - mark_used (fn); - - if (DECL_CLASS_SCOPE_P (fn) && IS_SIGNATURE (DECL_CONTEXT (fn))) - return build_signature_method_call (fn, converted_args); - else if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0) - { - tree t, *p = &TREE_VALUE (converted_args); - tree binfo = get_binfo - (DECL_CONTEXT (fn), TREE_TYPE (TREE_TYPE (*p)), 0); - *p = convert_pointer_to_real (binfo, *p); - if (TREE_SIDE_EFFECTS (*p)) - *p = save_expr (*p); - t = build_pointer_type (TREE_TYPE (fn)); - fn = build_vfn_ref (p, build_indirect_ref (*p, 0), DECL_VINDEX (fn)); - TREE_TYPE (fn) = t; - } - else if (DECL_INLINE (fn)) - fn = inline_conversion (fn); - else - fn = build_addr_func (fn); - - /* Recognize certain built-in functions so we can make tree-codes - other than CALL_EXPR. We do this when it enables fold-const.c - to do something useful. */ - - if (TREE_CODE (fn) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL - && DECL_BUILT_IN (TREE_OPERAND (fn, 0))) - switch (DECL_FUNCTION_CODE (TREE_OPERAND (fn, 0))) - { - case BUILT_IN_ABS: - case BUILT_IN_LABS: - case BUILT_IN_FABS: - if (converted_args == 0) - return integer_zero_node; - return build_unary_op (ABS_EXPR, TREE_VALUE (converted_args), 0); - default: - break; - } - - fn = build_call (fn, TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), converted_args); - if (TREE_CODE (TREE_TYPE (fn)) == VOID_TYPE) - return fn; - fn = require_complete_type (fn); - if (IS_AGGR_TYPE (TREE_TYPE (fn))) - fn = build_cplus_new (TREE_TYPE (fn), fn); - return convert_from_reference (fn); -} - -static tree -build_new_method_call (instance, name, args, basetype_path, flags) - tree instance, name, args, basetype_path; - int flags; -{ - struct z_candidate *candidates = 0, *cand; - tree explicit_targs = NULL_TREE; - tree basetype, mem_args = NULL_TREE, fns, instance_ptr; - tree pretty_name; - tree user_args = args; - tree templates = NULL_TREE; - int template_only = 0; - - if (TREE_CODE (name) == TEMPLATE_ID_EXPR) - { - explicit_targs = TREE_OPERAND (name, 1); - name = TREE_OPERAND (name, 0); - if (TREE_CODE_CLASS (TREE_CODE (name)) == 'd') - name = DECL_NAME (name); - else - { - if (TREE_CODE (name) == COMPONENT_REF) - name = TREE_OPERAND (name, 1); - if (TREE_CODE (name) == OVERLOAD) - name = DECL_NAME (OVL_CURRENT (name)); - } - - template_only = 1; - } - - /* If there is an extra argument for controlling virtual bases, - remove it for error reporting. */ - if (flags & LOOKUP_HAS_IN_CHARGE) - user_args = TREE_CHAIN (args); - if (flags & LOOKUP_HAS_VLIST) - user_args = TREE_CHAIN (user_args); - - args = resolve_args (args); - - if (args == error_mark_node) - return error_mark_node; - - if (instance == NULL_TREE) - basetype = BINFO_TYPE (basetype_path); - else - { - if (TREE_CODE (instance) == OFFSET_REF) - instance = resolve_offset_ref (instance); - if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE) - instance = convert_from_reference (instance); - basetype = TYPE_MAIN_VARIANT (TREE_TYPE (instance)); - - /* XXX this should be handled before we get here. */ - if (! IS_AGGR_TYPE (basetype) - && ! (TYPE_LANG_SPECIFIC (basetype) - && (IS_SIGNATURE_POINTER (basetype) - || IS_SIGNATURE_REFERENCE (basetype)))) - { - if ((flags & LOOKUP_COMPLAIN) && basetype != error_mark_node) - cp_error ("request for member `%D' in `%E', which is of non-aggregate type `%T'", - name, instance, basetype); - - return error_mark_node; - } - - /* If `instance' is a signature pointer/reference and `name' is - not a constructor, we are calling a signature member function. - In that case set the `basetype' to the signature type. */ - if ((IS_SIGNATURE_POINTER (basetype) - || IS_SIGNATURE_REFERENCE (basetype)) - && TYPE_IDENTIFIER (basetype) != name) - basetype = SIGNATURE_TYPE (basetype); - } - - if (basetype_path == NULL_TREE) - basetype_path = TYPE_BINFO (basetype); - - if (instance) - { - instance_ptr = build_this (instance); - - if (! template_only) - { - /* XXX this should be handled before we get here. */ - fns = build_field_call (basetype_path, instance_ptr, name, args); - if (fns) - return fns; - } - } - else - { - instance_ptr = build_int_2 (0, 0); - TREE_TYPE (instance_ptr) = build_pointer_type (basetype); - } - - pretty_name - = (name == ctor_identifier ? constructor_name (basetype) : name); - - fns = lookup_fnfields (basetype_path, name, 1); - - if (fns == error_mark_node) - return error_mark_node; - if (fns) - { - tree fn = TREE_VALUE (fns); - if (name == ctor_identifier && TYPE_USES_VIRTUAL_BASECLASSES (basetype) - && ! (flags & LOOKUP_HAS_IN_CHARGE)) - { - if (TYPE_USES_PVBASES(basetype) - && (!flag_vtable_thunks_compat || (name == dtor_identifier))) - { - args = scratch_tree_cons (NULL_TREE, vlist_zero_node, args); - flags |= LOOKUP_HAS_VLIST; - } - flags |= LOOKUP_HAS_IN_CHARGE; - args = scratch_tree_cons (NULL_TREE, integer_one_node, args); - } - mem_args = scratch_tree_cons (NULL_TREE, instance_ptr, args); - for (; fn; fn = OVL_NEXT (fn)) - { - tree t = OVL_CURRENT (fn); - tree this_arglist; - - /* We can end up here for copy-init of same or base class. */ - if (name == ctor_identifier - && (flags & LOOKUP_ONLYCONVERTING) - && DECL_NONCONVERTING_P (t)) - continue; - if (TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE) - this_arglist = mem_args; - else - this_arglist = args; - - if (TREE_CODE (t) == TEMPLATE_DECL) - { - /* A member template. */ - templates = scratch_tree_cons (NULL_TREE, t, templates); - candidates = - add_template_candidate (candidates, t, explicit_targs, - this_arglist, - TREE_TYPE (name), flags, DEDUCE_CALL); - } - else if (! template_only) - candidates = add_function_candidate (candidates, t, - this_arglist, flags); - - if (candidates) - candidates->basetype_path = TREE_PURPOSE (fns); - } - } - - if (! any_viable (candidates)) - { - /* XXX will LOOKUP_SPECULATIVELY be needed when this is done? */ - if (flags & LOOKUP_SPECULATIVELY) - return NULL_TREE; - if (TYPE_SIZE (basetype) == 0) - incomplete_type_error (instance_ptr, basetype); - else - cp_error ("no matching function for call to `%T::%D (%A)%V'", - basetype, pretty_name, user_args, - TREE_TYPE (TREE_TYPE (instance_ptr))); - print_z_candidates (candidates); - return error_mark_node; - } - candidates = splice_viable (candidates); - cand = tourney (candidates); - - if (cand == 0) - { - cp_error ("call of overloaded `%D(%A)' is ambiguous", pretty_name, - user_args); - print_z_candidates (candidates); - return error_mark_node; - } - - if (DECL_ABSTRACT_VIRTUAL_P (cand->fn) - && instance == current_class_ref - && DECL_CONSTRUCTOR_P (current_function_decl) - && ! (flags & LOOKUP_NONVIRTUAL) - && value_member (cand->fn, CLASSTYPE_ABSTRACT_VIRTUALS (basetype))) - cp_error ("abstract virtual `%#D' called from constructor", cand->fn); - if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE - && is_dummy_object (instance_ptr)) - { - cp_error ("cannot call member function `%D' without object", cand->fn); - return error_mark_node; - } - - if (DECL_VINDEX (cand->fn) && ! (flags & LOOKUP_NONVIRTUAL) - && ((instance == current_class_ref && (dtor_label || ctor_label)) - || resolves_to_fixed_type_p (instance, 0))) - flags |= LOOKUP_NONVIRTUAL; - - /* Pedantically, normal function declarations are never considered - to refer to template instantiations, so we only do this with - -fguiding-decls. */ - if (flag_guiding_decls && templates && ! cand->template - && ! DECL_INITIAL (cand->fn)) - add_maybe_template (cand->fn, templates); - - return build_over_call - (cand, - TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE ? mem_args : args, - flags); -} - -/* Returns non-zero iff standard conversion sequence ICS1 is a proper - subsequence of ICS2. */ - -static int -is_subseq (ics1, ics2) - tree ics1, ics2; -{ - /* We can assume that a conversion of the same code - between the same types indicates a subsequence since we only get - here if the types we are converting from are the same. */ - - while (TREE_CODE (ics1) == RVALUE_CONV - || TREE_CODE (ics1) == LVALUE_CONV) - ics1 = TREE_OPERAND (ics1, 0); - - while (1) - { - while (TREE_CODE (ics2) == RVALUE_CONV - || TREE_CODE (ics2) == LVALUE_CONV) - ics2 = TREE_OPERAND (ics2, 0); - - if (TREE_CODE (ics2) == USER_CONV - || TREE_CODE (ics2) == AMBIG_CONV - || TREE_CODE (ics2) == IDENTITY_CONV) - /* At this point, ICS1 cannot be a proper subsequence of - ICS2. We can get a USER_CONV when we are comparing the - second standard conversion sequence of two user conversion - sequences. */ - return 0; - - ics2 = TREE_OPERAND (ics2, 0); - - if (TREE_CODE (ics2) == TREE_CODE (ics1) - && same_type_p (TREE_TYPE (ics2), TREE_TYPE (ics1)) - && same_type_p (TREE_TYPE (TREE_OPERAND (ics2, 0)), - TREE_TYPE (TREE_OPERAND (ics1, 0)))) - return 1; - } -} - -/* Returns non-zero iff DERIVED is derived from BASE. The inputs may - be any _TYPE nodes. */ - -int -is_properly_derived_from (derived, base) - tree derived; - tree base; -{ - if (!IS_AGGR_TYPE_CODE (TREE_CODE (derived)) - || !IS_AGGR_TYPE_CODE (TREE_CODE (base))) - return 0; - - /* We only allow proper derivation here. The DERIVED_FROM_P macro - considers every class derived from itself. */ - return (!same_type_p (TYPE_MAIN_VARIANT (derived), - TYPE_MAIN_VARIANT (base)) - && DERIVED_FROM_P (base, derived)); -} - -/* We build the ICS for an implicit object parameter as a pointer - conversion sequence. However, such a sequence should be compared - as if it were a reference conversion sequence. If ICS is the - implicit conversion sequence for an implicit object parameter, - modify it accordingly. */ - -static void -maybe_handle_implicit_object (ics) - tree* ics; -{ - if (ICS_THIS_FLAG (*ics)) - { - /* [over.match.funcs] - - For non-static member functions, the type of the - implicit object parameter is "reference to cv X" - where X is the class of which the function is a - member and cv is the cv-qualification on the member - function declaration. */ - tree t = *ics; - if (TREE_CODE (t) == QUAL_CONV) - t = TREE_OPERAND (t, 0); - if (TREE_CODE (t) == PTR_CONV) - t = TREE_OPERAND (t, 0); - t = build1 (IDENTITY_CONV, TREE_TYPE (TREE_TYPE (t)), NULL_TREE); - t = build_conv (REF_BIND, - build_reference_type (TREE_TYPE (TREE_TYPE (*ics))), - t); - ICS_STD_RANK (t) = ICS_STD_RANK (*ics); - *ics = t; - } -} - -/* If ICS is a REF_BIND, modify it appropriately, set TARGET_TYPE - to the type the reference originally referred to, and return 1. - Otherwise, return 0. */ - -static int -maybe_handle_ref_bind (ics, target_type) - tree* ics; - tree* target_type; -{ - if (TREE_CODE (*ics) == REF_BIND) - { - /* [over.ics.rank] - - When a parameter of reference type binds directly - (_dcl.init.ref_) to an argument expression, the implicit - conversion sequence is the identity conversion, unless the - argument expression has a type that is a derived class of the - parameter type, in which case the implicit conversion - sequence is a derived-to-base Conversion. - - If the parameter binds directly to the result of applying a - conversion function to the argument expression, the implicit - conversion sequence is a user-defined conversion sequence - (_over.ics.user_), with the second standard conversion - sequence either an identity conversion or, if the conversion - function returns an entity of a type that is a derived class - of the parameter type, a derived-to-base Conversion. - - When a parameter of reference type is not bound directly to - an argument expression, the conversion sequence is the one - required to convert the argument expression to the underlying - type of the reference according to _over.best.ics_. - Conceptually, this conversion sequence corresponds to - copy-initializing a temporary of the underlying type with the - argument expression. Any difference in top-level - cv-qualification is subsumed by the initialization itself and - does not constitute a conversion. */ - - tree old_ics = *ics; - - *target_type = TREE_TYPE (TREE_TYPE (*ics)); - *ics = TREE_OPERAND (*ics, 0); - if (TREE_CODE (*ics) == IDENTITY_CONV - && is_properly_derived_from (TREE_TYPE (*ics), *target_type)) - *ics = build_conv (BASE_CONV, *target_type, *ics); - ICS_USER_FLAG (*ics) = ICS_USER_FLAG (old_ics); - ICS_BAD_FLAG (*ics) = ICS_BAD_FLAG (old_ics); - - return 1; - } - - return 0; -} - -/* Compare two implicit conversion sequences according to the rules set out in - [over.ics.rank]. Return values: - - 1: ics1 is better than ics2 - -1: ics2 is better than ics1 - 0: ics1 and ics2 are indistinguishable */ - -static int -compare_ics (ics1, ics2) - tree ics1, ics2; -{ - tree from_type1; - tree from_type2; - tree to_type1; - tree to_type2; - tree deref_from_type1 = NULL_TREE; - tree deref_from_type2 = NULL_TREE; - tree deref_to_type1 = NULL_TREE; - tree deref_to_type2 = NULL_TREE; - - /* REF_BINDING is non-zero if the result of the conversion sequence - is a reference type. In that case TARGET_TYPE is the - type referred to by the reference. */ - int ref_binding1; - int ref_binding2; - tree target_type1; - tree target_type2; - - /* Handle implicit object parameters. */ - maybe_handle_implicit_object (&ics1); - maybe_handle_implicit_object (&ics2); - - /* Handle reference parameters. */ - ref_binding1 = maybe_handle_ref_bind (&ics1, &target_type1); - ref_binding2 = maybe_handle_ref_bind (&ics2, &target_type2); - - /* [over.ics.rank] - - When comparing the basic forms of implicit conversion sequences (as - defined in _over.best.ics_) - - --a standard conversion sequence (_over.ics.scs_) is a better - conversion sequence than a user-defined conversion sequence - or an ellipsis conversion sequence, and - - --a user-defined conversion sequence (_over.ics.user_) is a - better conversion sequence than an ellipsis conversion sequence - (_over.ics.ellipsis_). */ - if (ICS_RANK (ics1) > ICS_RANK (ics2)) - return -1; - else if (ICS_RANK (ics1) < ICS_RANK (ics2)) - return 1; - - if (ICS_RANK (ics1) == BAD_RANK) - { - /* Both ICS are bad. We try to make a decision based on what - would have happenned if they'd been good. */ - if (ICS_USER_FLAG (ics1) > ICS_USER_FLAG (ics2) - || ICS_STD_RANK (ics1) > ICS_STD_RANK (ics2)) - return -1; - else if (ICS_USER_FLAG (ics1) < ICS_USER_FLAG (ics2) - || ICS_STD_RANK (ics1) < ICS_STD_RANK (ics2)) - return 1; - - /* We couldn't make up our minds; try to figure it out below. */ - } - - if (ICS_ELLIPSIS_FLAG (ics1)) - /* Both conversions are ellipsis conversions. */ - return 0; - - /* User-defined conversion sequence U1 is a better conversion sequence - than another user-defined conversion sequence U2 if they contain the - same user-defined conversion operator or constructor and if the sec- - ond standard conversion sequence of U1 is better than the second - standard conversion sequence of U2. */ - - if (ICS_USER_FLAG (ics1)) - { - tree t1, t2; - - for (t1 = ics1; TREE_CODE (t1) != USER_CONV; t1 = TREE_OPERAND (t1, 0)) - if (TREE_CODE (t1) == AMBIG_CONV) - return 0; - for (t2 = ics2; TREE_CODE (t2) != USER_CONV; t2 = TREE_OPERAND (t2, 0)) - if (TREE_CODE (t2) == AMBIG_CONV) - return 0; - - if (USER_CONV_FN (t1) != USER_CONV_FN (t2)) - return 0; - - /* We can just fall through here, after setting up - FROM_TYPE1 and FROM_TYPE2. */ - from_type1 = TREE_TYPE (t1); - from_type2 = TREE_TYPE (t2); - } - else - { - /* We're dealing with two standard conversion sequences. - - [over.ics.rank] - - Standard conversion sequence S1 is a better conversion - sequence than standard conversion sequence S2 if - - --S1 is a proper subsequence of S2 (comparing the conversion - sequences in the canonical form defined by _over.ics.scs_, - excluding any Lvalue Transformation; the identity - conversion sequence is considered to be a subsequence of - any non-identity conversion sequence */ - - from_type1 = ics1; - while (TREE_CODE (from_type1) != IDENTITY_CONV) - from_type1 = TREE_OPERAND (from_type1, 0); - from_type1 = TREE_TYPE (from_type1); - - from_type2 = ics2; - while (TREE_CODE (from_type2) != IDENTITY_CONV) - from_type2 = TREE_OPERAND (from_type2, 0); - from_type2 = TREE_TYPE (from_type2); - } - - if (same_type_p (from_type1, from_type2)) - { - if (is_subseq (ics1, ics2)) - return 1; - if (is_subseq (ics2, ics1)) - return -1; - } - /* Otherwise, one sequence cannot be a subsequence of the other; they - don't start with the same type. This can happen when comparing the - second standard conversion sequence in two user-defined conversion - sequences. */ - - /* [over.ics.rank] - - Or, if not that, - - --the rank of S1 is better than the rank of S2 (by the rules - defined below): - - Standard conversion sequences are ordered by their ranks: an Exact - Match is a better conversion than a Promotion, which is a better - conversion than a Conversion. - - Two conversion sequences with the same rank are indistinguishable - unless one of the following rules applies: - - --A conversion that is not a conversion of a pointer, or pointer - to member, to bool is better than another conversion that is such - a conversion. - - The ICS_STD_RANK automatically handles the pointer-to-bool rule, - so that we do not have to check it explicitly. */ - if (ICS_STD_RANK (ics1) < ICS_STD_RANK (ics2)) - return 1; - else if (ICS_STD_RANK (ics2) < ICS_STD_RANK (ics1)) - return -1; - - to_type1 = TREE_TYPE (ics1); - to_type2 = TREE_TYPE (ics2); - - if (TYPE_PTR_P (from_type1) - && TYPE_PTR_P (from_type2) - && TYPE_PTR_P (to_type1) - && TYPE_PTR_P (to_type2)) - { - deref_from_type1 = TREE_TYPE (from_type1); - deref_from_type2 = TREE_TYPE (from_type2); - deref_to_type1 = TREE_TYPE (to_type1); - deref_to_type2 = TREE_TYPE (to_type2); - } - /* The rules for pointers to members A::* are just like the rules - for pointers A*, except opposite: if B is derived from A then - A::* converts to B::*, not vice versa. For that reason, we - switch the from_ and to_ variables here. */ - else if (TYPE_PTRMEM_P (from_type1) - && TYPE_PTRMEM_P (from_type2) - && TYPE_PTRMEM_P (to_type1) - && TYPE_PTRMEM_P (to_type2)) - { - deref_to_type1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (from_type1)); - deref_to_type2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (from_type2)); - deref_from_type1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (to_type1)); - deref_from_type2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (to_type2)); - } - else if (TYPE_PTRMEMFUNC_P (from_type1) - && TYPE_PTRMEMFUNC_P (from_type2) - && TYPE_PTRMEMFUNC_P (to_type1) - && TYPE_PTRMEMFUNC_P (to_type2)) - { - deref_to_type1 = TYPE_PTRMEMFUNC_OBJECT_TYPE (from_type1); - deref_to_type2 = TYPE_PTRMEMFUNC_OBJECT_TYPE (from_type2); - deref_from_type1 = TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type1); - deref_from_type2 = TYPE_PTRMEMFUNC_OBJECT_TYPE (to_type2); - } - - if (deref_from_type1 != NULL_TREE - && IS_AGGR_TYPE_CODE (TREE_CODE (deref_from_type1)) - && IS_AGGR_TYPE_CODE (TREE_CODE (deref_from_type2))) - { - /* This was one of the pointer or pointer-like conversions. - - [over.ics.rank] - - --If class B is derived directly or indirectly from class A, - conversion of B* to A* is better than conversion of B* to - void*, and conversion of A* to void* is better than - conversion of B* to void*. */ - if (TREE_CODE (deref_to_type1) == VOID_TYPE - && TREE_CODE (deref_to_type2) == VOID_TYPE) - { - if (is_properly_derived_from (deref_from_type1, - deref_from_type2)) - return -1; - else if (is_properly_derived_from (deref_from_type2, - deref_from_type1)) - return 1; - } - else if (TREE_CODE (deref_to_type1) == VOID_TYPE - || TREE_CODE (deref_to_type2) == VOID_TYPE) - { - if (same_type_p (deref_from_type1, deref_from_type2)) - { - if (TREE_CODE (deref_to_type2) == VOID_TYPE) - { - if (is_properly_derived_from (deref_from_type1, - deref_to_type1)) - return 1; - } - /* We know that DEREF_TO_TYPE1 is `void' here. */ - else if (is_properly_derived_from (deref_from_type1, - deref_to_type2)) - return -1; - } - } - else if (IS_AGGR_TYPE_CODE (TREE_CODE (deref_to_type1)) - && IS_AGGR_TYPE_CODE (TREE_CODE (deref_to_type2))) - { - /* [over.ics.rank] - - --If class B is derived directly or indirectly from class A - and class C is derived directly or indirectly from B, - - --conversion of C* to B* is better than conversion of C* to - A*, - - --conversion of B* to A* is better than conversion of C* to - A* */ - if (same_type_p (deref_from_type1, deref_from_type2)) - { - if (is_properly_derived_from (deref_to_type1, - deref_to_type2)) - return 1; - else if (is_properly_derived_from (deref_to_type2, - deref_to_type1)) - return -1; - } - else if (same_type_p (deref_to_type1, deref_to_type2)) - { - if (is_properly_derived_from (deref_from_type2, - deref_from_type1)) - return 1; - else if (is_properly_derived_from (deref_from_type1, - deref_from_type2)) - return -1; - } - } - } - else if (IS_AGGR_TYPE_CODE (TREE_CODE (from_type1)) - && same_type_p (from_type1, from_type2)) - { - /* [over.ics.rank] - - --binding of an expression of type C to a reference of type - B& is better than binding an expression of type C to a - reference of type A& - - --conversion of C to B is better than conversion of C to A, */ - if (is_properly_derived_from (from_type1, to_type1) - && is_properly_derived_from (from_type1, to_type2)) - { - if (is_properly_derived_from (to_type1, to_type2)) - return 1; - else if (is_properly_derived_from (to_type2, to_type1)) - return -1; - } - } - else if (IS_AGGR_TYPE_CODE (TREE_CODE (to_type1)) - && same_type_p (to_type1, to_type2)) - { - /* [over.ics.rank] - - --binding of an expression of type B to a reference of type - A& is better than binding an expression of type C to a - reference of type A&, - - --onversion of B to A is better than conversion of C to A */ - if (is_properly_derived_from (from_type1, to_type1) - && is_properly_derived_from (from_type2, to_type1)) - { - if (is_properly_derived_from (from_type2, from_type1)) - return 1; - else if (is_properly_derived_from (from_type1, from_type2)) - return -1; - } - } - - /* [over.ics.rank] - - --S1 and S2 differ only in their qualification conversion and yield - similar types T1 and T2 (_conv.qual_), respectively, and the cv- - qualification signature of type T1 is a proper subset of the cv- - qualification signature of type T2 */ - if (TREE_CODE (ics1) == QUAL_CONV - && TREE_CODE (ics2) == QUAL_CONV - && same_type_p (from_type1, from_type2)) - return comp_cv_qual_signature (to_type1, to_type2); - - /* [over.ics.rank] - - --S1 and S2 are reference bindings (_dcl.init.ref_), and the - types to which the references refer are the same type except for - top-level cv-qualifiers, and the type to which the reference - initialized by S2 refers is more cv-qualified than the type to - which the reference initialized by S1 refers */ - - if (ref_binding1 && ref_binding2 - && same_type_p (TYPE_MAIN_VARIANT (to_type1), - TYPE_MAIN_VARIANT (to_type2))) - return comp_cv_qualification (target_type2, target_type1); - - /* Neither conversion sequence is better than the other. */ - return 0; -} - -/* The source type for this standard conversion sequence. */ - -static tree -source_type (t) - tree t; -{ - for (;; t = TREE_OPERAND (t, 0)) - { - if (TREE_CODE (t) == USER_CONV - || TREE_CODE (t) == AMBIG_CONV - || TREE_CODE (t) == IDENTITY_CONV) - return TREE_TYPE (t); - } - my_friendly_abort (1823); -} - -/* Note a warning about preferring WINNER to LOSER. We do this by storing - a pointer to LOSER and re-running joust to produce the warning if WINNER - is actually used. */ - -static void -add_warning (winner, loser) - struct z_candidate *winner, *loser; -{ - winner->warnings = expr_tree_cons (NULL_PTR, - build_expr_ptr_wrapper (loser), - winner->warnings); -} - -/* Compare two candidates for overloading as described in - [over.match.best]. Return values: - - 1: cand1 is better than cand2 - -1: cand2 is better than cand1 - 0: cand1 and cand2 are indistinguishable */ - -static int -joust (cand1, cand2, warn) - struct z_candidate *cand1, *cand2; - int warn; -{ - int winner = 0; - int i, off1 = 0, off2 = 0, len; - - /* Candidates that involve bad conversions are always worse than those - that don't. */ - if (cand1->viable > cand2->viable) - return 1; - if (cand1->viable < cand2->viable) - return -1; - - /* If we have two pseudo-candidates for conversions to the same type, - arbitrarily pick one. */ - if (TYPE_P (cand1->fn) && cand1->fn == cand2->fn) - return 1; - - /* a viable function F1 - is defined to be a better function than another viable function F2 if - for all arguments i, ICSi(F1) is not a worse conversion sequence than - ICSi(F2), and then */ - - /* for some argument j, ICSj(F1) is a better conversion sequence than - ICSj(F2) */ - - /* For comparing static and non-static member functions, we ignore the - implicit object parameter of the non-static function. The WP says to - pretend that the static function has an object parm, but that won't - work with operator overloading. */ - len = TREE_VEC_LENGTH (cand1->convs); - if (len != TREE_VEC_LENGTH (cand2->convs)) - { - if (DECL_STATIC_FUNCTION_P (cand1->fn) - && ! DECL_STATIC_FUNCTION_P (cand2->fn)) - off2 = 1; - else if (! DECL_STATIC_FUNCTION_P (cand1->fn) - && DECL_STATIC_FUNCTION_P (cand2->fn)) - { - off1 = 1; - --len; - } - else - my_friendly_abort (42); - } - - for (i = 0; i < len; ++i) - { - tree t1 = TREE_VEC_ELT (cand1->convs, i+off1); - tree t2 = TREE_VEC_ELT (cand2->convs, i+off2); - int comp = compare_ics (t1, t2); - - if (comp != 0) - { - if (warn_sign_promo - && ICS_RANK (t1) + ICS_RANK (t2) == STD_RANK + PROMO_RANK - && TREE_CODE (t1) == STD_CONV - && TREE_CODE (t2) == STD_CONV - && TREE_CODE (TREE_TYPE (t1)) == INTEGER_TYPE - && TREE_CODE (TREE_TYPE (t2)) == INTEGER_TYPE - && (TYPE_PRECISION (TREE_TYPE (t1)) - == TYPE_PRECISION (TREE_TYPE (t2))) - && (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (t1, 0))) - || (TREE_CODE (TREE_TYPE (TREE_OPERAND (t1, 0))) - == ENUMERAL_TYPE))) - { - tree type = TREE_TYPE (TREE_OPERAND (t1, 0)); - tree type1, type2; - struct z_candidate *w, *l; - if (comp > 0) - type1 = TREE_TYPE (t1), type2 = TREE_TYPE (t2), - w = cand1, l = cand2; - else - type1 = TREE_TYPE (t2), type2 = TREE_TYPE (t1), - w = cand2, l = cand1; - - if (warn) - { - cp_warning ("passing `%T' chooses `%T' over `%T'", - type, type1, type2); - cp_warning (" in call to `%D'", w->fn); - } - else - add_warning (w, l); - } - - if (winner && comp != winner) - { - winner = 0; - goto tweak; - } - winner = comp; - } - } - - /* warn about confusing overload resolution for user-defined conversions, - either between a constructor and a conversion op, or between two - conversion ops. */ - if (winner && cand1->second_conv - && ((DECL_CONSTRUCTOR_P (cand1->fn) - != DECL_CONSTRUCTOR_P (cand2->fn)) - /* Don't warn if the two conv ops convert to the same type... */ - || (! DECL_CONSTRUCTOR_P (cand1->fn) - && ! same_type_p (TREE_TYPE (TREE_TYPE (cand1->fn)), - TREE_TYPE (TREE_TYPE (cand2->fn)))))) - { - int comp = compare_ics (cand1->second_conv, cand2->second_conv); - if (comp != winner) - { - struct z_candidate *w, *l; - if (winner == 1) - w = cand1, l = cand2; - else - w = cand2, l = cand1; - if (warn) - { - tree source = source_type (TREE_VEC_ELT (w->convs, 0)); - if (! DECL_CONSTRUCTOR_P (w->fn)) - source = TREE_TYPE (source); - cp_warning ("choosing `%D' over `%D'", w->fn, l->fn); - cp_warning (" for conversion from `%T' to `%T'", - source, TREE_TYPE (w->second_conv)); - cp_warning (" because conversion sequence for the argument is better"); - } - else - add_warning (w, l); - } - } - - if (winner) - return winner; - - /* or, if not that, - F1 is a non-template function and F2 is a template function */ - - if (! cand1->template && cand2->template) - return 1; - else if (cand1->template && ! cand2->template) - return -1; - else if (cand1->template && cand2->template) - winner = more_specialized - (TI_TEMPLATE (cand1->template), TI_TEMPLATE (cand2->template), - NULL_TREE); - - /* or, if not that, - the context is an initialization by user-defined conversion (see - _dcl.init_ and _over.match.user_) and the standard conversion - sequence from the return type of F1 to the destination type (i.e., - the type of the entity being initialized) is a better conversion - sequence than the standard conversion sequence from the return type - of F2 to the destination type. */ - - if (! winner && cand1->second_conv) - winner = compare_ics (cand1->second_conv, cand2->second_conv); - - /* If the built-in candidates are the same, arbitrarily pick one. */ - if (! winner && cand1->fn == cand2->fn - && TREE_CODE (cand1->fn) == IDENTIFIER_NODE) - { - for (i = 0; i < len; ++i) - if (!same_type_p (TREE_TYPE (TREE_VEC_ELT (cand1->convs, i)), - TREE_TYPE (TREE_VEC_ELT (cand2->convs, i)))) - break; - if (i == TREE_VEC_LENGTH (cand1->convs)) - return 1; - - /* Kludge around broken overloading rules whereby - Integer a, b; test ? a : b; is ambiguous, since there's a builtin - that takes references and another that takes values. */ - if (cand1->fn == ansi_opname[COND_EXPR]) - { - tree c1 = TREE_VEC_ELT (cand1->convs, 1); - tree c2 = TREE_VEC_ELT (cand2->convs, 1); - tree t1 = strip_top_quals (non_reference (TREE_TYPE (c1))); - tree t2 = strip_top_quals (non_reference (TREE_TYPE (c2))); - - if (same_type_p (t1, t2)) - { - if (TREE_CODE (c1) == REF_BIND && TREE_CODE (c2) != REF_BIND) - return 1; - if (TREE_CODE (c1) != REF_BIND && TREE_CODE (c2) == REF_BIND) - return -1; - } - } - } - -tweak: - - /* Extension: If the worst conversion for one candidate is worse than the - worst conversion for the other, take the first. */ - if (! winner && ! pedantic) - { - int rank1 = IDENTITY_RANK, rank2 = IDENTITY_RANK; - - for (i = 0; i < len; ++i) - { - if (ICS_RANK (TREE_VEC_ELT (cand1->convs, i+off1)) > rank1) - rank1 = ICS_RANK (TREE_VEC_ELT (cand1->convs, i+off1)); - if (ICS_RANK (TREE_VEC_ELT (cand2->convs, i+off2)) > rank2) - rank2 = ICS_RANK (TREE_VEC_ELT (cand2->convs, i+off2)); - } - - if (rank1 < rank2) - return 1; - if (rank1 > rank2) - return -1; - } - - return winner; -} - -/* Given a list of candidates for overloading, find the best one, if any. - This algorithm has a worst case of O(2n) (winner is last), and a best - case of O(n/2) (totally ambiguous); much better than a sorting - algorithm. */ - -static struct z_candidate * -tourney (candidates) - struct z_candidate *candidates; -{ - struct z_candidate *champ = candidates, *challenger; - int fate; - int champ_compared_to_predecessor = 0; - - /* Walk through the list once, comparing each current champ to the next - candidate, knocking out a candidate or two with each comparison. */ - - for (challenger = champ->next; challenger; ) - { - fate = joust (champ, challenger, 0); - if (fate == 1) - challenger = challenger->next; - else - { - if (fate == 0) - { - champ = challenger->next; - if (champ == 0) - return 0; - champ_compared_to_predecessor = 0; - } - else - { - champ = challenger; - champ_compared_to_predecessor = 1; - } - - challenger = champ->next; - } - } - - /* Make sure the champ is better than all the candidates it hasn't yet - been compared to. */ - - for (challenger = candidates; - challenger != champ - && !(champ_compared_to_predecessor && challenger->next == champ); - challenger = challenger->next) - { - fate = joust (champ, challenger, 0); - if (fate != 1) - return 0; - } - - return champ; -} - -int -can_convert (to, from) - tree to, from; -{ - tree t = implicit_conversion (to, from, NULL_TREE, LOOKUP_NORMAL); - return (t && ! ICS_BAD_FLAG (t)); -} - -int -can_convert_arg (to, from, arg) - tree to, from, arg; -{ - tree t = implicit_conversion (to, from, arg, LOOKUP_NORMAL); - return (t && ! ICS_BAD_FLAG (t)); -} diff --git a/contrib/gcc/cp/class.c b/contrib/gcc/cp/class.c deleted file mode 100644 index 74808c56f355..000000000000 --- a/contrib/gcc/cp/class.c +++ /dev/null @@ -1,5753 +0,0 @@ -/* Functions related to building classes and their related objects. - Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* High-level class interface. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "cp-tree.h" -#include "flags.h" -#include "rtl.h" -#include "output.h" -#include "toplev.h" -#include "splay-tree.h" - -#include "obstack.h" -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -/* This is how we tell when two virtual member functions are really the - same. */ -#define SAME_FN(FN1DECL, FN2DECL) (DECL_ASSEMBLER_NAME (FN1DECL) == DECL_ASSEMBLER_NAME (FN2DECL)) - -extern void set_class_shadows PROTO ((tree)); - -/* The number of nested classes being processed. If we are not in the - scope of any class, this is zero. */ - -int current_class_depth; - -/* In order to deal with nested classes, we keep a stack of classes. - The topmost entry is the innermost class, and is the entry at index - CURRENT_CLASS_DEPTH */ - -typedef struct class_stack_node { - /* The name of the class. */ - tree name; - - /* The _TYPE node for the class. */ - tree type; - - /* The access specifier pending for new declarations in the scope of - this class. */ - tree access; - - /* If were defining TYPE, the names used in this class. */ - splay_tree names_used; -}* class_stack_node_t; - -/* The stack itself. This is an dynamically resized array. The - number of elements allocated is CURRENT_CLASS_STACK_SIZE. */ -static int current_class_stack_size; -static class_stack_node_t current_class_stack; - -/* When we're processing a member function, current_class_ptr is the - PARM_DECL for the `this' pointer. The current_class_ref is an - expression for `*this'. */ -tree current_class_ptr, current_class_ref; - -/* The following two can be derived from the previous one */ -tree current_class_name; /* IDENTIFIER_NODE: name of current class */ -tree current_class_type; /* _TYPE: the type of the current class */ -tree current_access_specifier; -tree previous_class_type; /* _TYPE: the previous type that was a class */ -tree previous_class_values; /* TREE_LIST: copy of the class_shadowed list - when leaving an outermost class scope. */ - -/* The obstack on which the cached class declarations are kept. */ -static struct obstack class_cache_obstack; -/* The first object allocated on that obstack. We can use - obstack_free with tis value to free the entire obstack. */ -char *class_cache_firstobj; - -struct base_info; - -static tree get_vfield_name PROTO((tree)); -static void finish_struct_anon PROTO((tree)); -static tree build_vbase_pointer PROTO((tree, tree)); -static tree build_vtable_entry PROTO((tree, tree)); -static tree get_vtable_name PROTO((tree)); -static tree get_derived_offset PROTO((tree, tree)); -static tree get_basefndecls PROTO((tree, tree)); -static void set_rtti_entry PROTO((tree, tree, tree)); -static tree build_vtable PROTO((tree, tree)); -static void prepare_fresh_vtable PROTO((tree, tree)); -static tree prepare_ctor_vtable PROTO((tree, tree, tree)); -static void fixup_vtable_deltas1 PROTO((tree, tree)); -static void fixup_vtable_deltas PROTO((tree, int, tree)); -static tree finish_one_ctor_vtable PROTO((tree, tree, tree, tree)); -static tree prepend_ctor_vfields_for_vbase PROTO((tree, tree, tree, tree, int, tree)); -static tree finish_ctor_vtables_for_vbases PROTO((tree, tree, tree)); -static tree finish_ctor_vtables_1 PROTO((tree, tree)); -static tree prepend_vbase_vfields PROTO((tree, int, tree)); -static void finish_ctor_vtables PROTO((tree)); -static void finish_vtbls PROTO((tree, int, tree)); -static void modify_vtable_entry PROTO((tree, tree, tree)); -static tree get_vtable_entry_n PROTO((tree, unsigned HOST_WIDE_INT)); -static void add_virtual_function PROTO((tree *, tree *, int *, tree, tree)); -static tree delete_duplicate_fields_1 PROTO((tree, tree)); -static void delete_duplicate_fields PROTO((tree)); -static void finish_struct_bits PROTO((tree, int)); -static int alter_access PROTO((tree, tree, tree, tree)); -static void handle_using_decl PROTO((tree, tree, tree, tree)); -static int overrides PROTO((tree, tree)); -static int strictly_overrides PROTO((tree, tree)); -static void merge_overrides PROTO((tree, tree, int, tree)); -static void override_one_vtable PROTO((tree, tree, tree)); -static void mark_overriders PROTO((tree, tree)); -static void check_for_override PROTO((tree, tree)); -static tree get_class_offset_1 PROTO((tree, tree, tree, tree, tree)); -static tree get_class_offset PROTO((tree, tree, tree, tree)); -static void modify_one_vtable PROTO((tree, tree, tree, tree)); -static void modify_all_vtables PROTO((tree, tree, tree)); -static void modify_all_direct_vtables PROTO((tree, int, tree, tree, - tree)); -static void modify_all_indirect_vtables PROTO((tree, int, int, tree, - tree, tree)); -static int finish_base_struct PROTO((tree, struct base_info *)); -static void finish_struct_methods PROTO((tree)); -static void maybe_warn_about_overly_private_class PROTO ((tree)); -static tree make_method_vec PROTO((int)); -static void free_method_vec PROTO((tree)); -static tree add_implicitly_declared_members PROTO((tree, int, int, int)); -static tree fixed_type_or_null PROTO((tree, int *)); -static tree resolve_address_of_overloaded_function PROTO((tree, tree, int, - int, tree)); -static void build_vtable_entry_ref PROTO((tree, tree, tree)); - -/* Way of stacking language names. */ -tree *current_lang_base, *current_lang_stack; -int current_lang_stacksize; - -/* Names of languages we recognize. */ -tree lang_name_c, lang_name_cplusplus, lang_name_java; -tree current_lang_name; - -/* When layout out an aggregate type, the size of the - basetypes (virtual and non-virtual) is passed to layout_record - via this node. */ -static tree base_layout_decl; - -/* Constants used for access control. */ -tree access_default_node; /* 0 */ -tree access_public_node; /* 1 */ -tree access_protected_node; /* 2 */ -tree access_private_node; /* 3 */ -tree access_default_virtual_node; /* 4 */ -tree access_public_virtual_node; /* 5 */ -tree access_protected_virtual_node; /* 6 */ -tree access_private_virtual_node; /* 7 */ - -/* Variables shared between class.c and call.c. */ - -#ifdef GATHER_STATISTICS -int n_vtables = 0; -int n_vtable_entries = 0; -int n_vtable_searches = 0; -int n_vtable_elems = 0; -int n_convert_harshness = 0; -int n_compute_conversion_costs = 0; -int n_build_method_call = 0; -int n_inner_fields_searched = 0; -#endif - -/* Virtual baseclass things. */ - -static tree -build_vbase_pointer (exp, type) - tree exp, type; -{ - char *name; - FORMAT_VBASE_NAME (name, type); - - return build_component_ref (exp, get_identifier (name), NULL_TREE, 0); -} - -#if 0 -/* Is the type of the EXPR, the complete type of the object? - If we are going to be wrong, we must be conservative, and return 0. */ - -static int -complete_type_p (expr) - tree expr; -{ - tree type = TYPE_MAIN_VARIANT (TREE_TYPE (expr)); - while (1) - { - switch (TREE_CODE (expr)) - { - case SAVE_EXPR: - case INDIRECT_REF: - case ADDR_EXPR: - case NOP_EXPR: - case CONVERT_EXPR: - expr = TREE_OPERAND (expr, 0); - continue; - - case CALL_EXPR: - if (! TREE_HAS_CONSTRUCTOR (expr)) - break; - /* fall through... */ - case VAR_DECL: - case FIELD_DECL: - if (TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE - && IS_AGGR_TYPE (TREE_TYPE (TREE_TYPE (expr))) - && TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type) - return 1; - /* fall through... */ - case TARGET_EXPR: - case PARM_DECL: - if (IS_AGGR_TYPE (TREE_TYPE (expr)) - && TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type) - return 1; - /* fall through... */ - case PLUS_EXPR: - default: - break; - } - break; - } - return 0; -} -#endif - -/* Build multi-level access to EXPR using hierarchy path PATH. - CODE is PLUS_EXPR if we are going with the grain, - and MINUS_EXPR if we are not (in which case, we cannot traverse - virtual baseclass links). - - TYPE is the type we want this path to have on exit. - - NONNULL is non-zero if we know (for any reason) that EXPR is - not, in fact, zero. */ - -tree -build_vbase_path (code, type, expr, path, nonnull) - enum tree_code code; - tree type, expr, path; - int nonnull; -{ - register int changed = 0; - tree last = NULL_TREE, last_virtual = NULL_TREE; - int fixed_type_p; - tree null_expr = 0, nonnull_expr; - tree basetype; - tree offset = integer_zero_node; - - if (BINFO_INHERITANCE_CHAIN (path) == NULL_TREE) - return build1 (NOP_EXPR, type, expr); - - /* If -fthis-is-variable, we might have set nonnull incorrectly. We - don't care enough to get this right, so just clear it. */ - if (flag_this_is_variable > 0) - nonnull = 0; - - /* We could do better if we had additional logic to convert back to the - unconverted type (the static type of the complete object), and then - convert back to the type we want. Until that is done, we only optimize - if the complete type is the same type as expr has. */ - fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull); - - if (!fixed_type_p && TREE_SIDE_EFFECTS (expr)) - expr = save_expr (expr); - nonnull_expr = expr; - - if (BINFO_INHERITANCE_CHAIN (path)) - path = reverse_path (path); - - basetype = BINFO_TYPE (path); - - while (path) - { - if (TREE_VIA_VIRTUAL (path)) - { - last_virtual = BINFO_TYPE (path); - if (code == PLUS_EXPR) - { - changed = ! fixed_type_p; - - if (changed) - { - tree ind; - - /* We already check for ambiguous things in the caller, just - find a path. */ - if (last) - { - tree binfo = get_binfo (last, TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (nonnull_expr))), 0); - nonnull_expr = convert_pointer_to_real (binfo, nonnull_expr); - } - ind = build_indirect_ref (nonnull_expr, NULL_PTR); - nonnull_expr = build_vbase_pointer (ind, last_virtual); - if (nonnull == 0 - && TREE_CODE (type) == POINTER_TYPE - && null_expr == NULL_TREE) - { - null_expr = build1 (NOP_EXPR, build_pointer_type (last_virtual), integer_zero_node); - expr = build (COND_EXPR, build_pointer_type (last_virtual), - build (EQ_EXPR, boolean_type_node, expr, - integer_zero_node), - null_expr, nonnull_expr); - } - } - /* else we'll figure out the offset below. */ - - /* Happens in the case of parse errors. */ - if (nonnull_expr == error_mark_node) - return error_mark_node; - } - else - { - cp_error ("cannot cast up from virtual baseclass `%T'", - last_virtual); - return error_mark_node; - } - } - last = path; - path = BINFO_INHERITANCE_CHAIN (path); - } - /* LAST is now the last basetype assoc on the path. */ - - /* A pointer to a virtual base member of a non-null object - is non-null. Therefore, we only need to test for zeroness once. - Make EXPR the canonical expression to deal with here. */ - if (null_expr) - { - TREE_OPERAND (expr, 2) = nonnull_expr; - TREE_TYPE (expr) = TREE_TYPE (TREE_OPERAND (expr, 1)) - = TREE_TYPE (nonnull_expr); - } - else - expr = nonnull_expr; - - /* If we go through any virtual base pointers, make sure that - casts to BASETYPE from the last virtual base class use - the right value for BASETYPE. */ - if (changed) - { - tree intype = TREE_TYPE (TREE_TYPE (expr)); - if (TYPE_MAIN_VARIANT (intype) != BINFO_TYPE (last)) - { - tree binfo = get_binfo (last, TYPE_MAIN_VARIANT (intype), 0); - offset = BINFO_OFFSET (binfo); - } - } - else - { - if (last_virtual) - { - offset = BINFO_OFFSET (binfo_member (last_virtual, - CLASSTYPE_VBASECLASSES (basetype))); - offset = size_binop (PLUS_EXPR, offset, BINFO_OFFSET (last)); - } - else - offset = BINFO_OFFSET (last); - } - - if (TREE_INT_CST_LOW (offset)) - { - /* Bash types to make the backend happy. */ - offset = cp_convert (type, offset); -#if 0 - /* This shouldn't be necessary. (mrs) */ - expr = build1 (NOP_EXPR, type, expr); -#endif - - /* If expr might be 0, we need to preserve that zeroness. */ - if (nonnull == 0) - { - if (null_expr) - TREE_TYPE (null_expr) = type; - else - null_expr = build1 (NOP_EXPR, type, integer_zero_node); - if (TREE_SIDE_EFFECTS (expr)) - expr = save_expr (expr); - - return build (COND_EXPR, type, - build (EQ_EXPR, boolean_type_node, expr, integer_zero_node), - null_expr, - build (code, type, expr, offset)); - } - else return build (code, type, expr, offset); - } - - /* Cannot change the TREE_TYPE of a NOP_EXPR here, since it may - be used multiple times in initialization of multiple inheritance. */ - if (null_expr) - { - TREE_TYPE (expr) = type; - return expr; - } - else - return build1 (NOP_EXPR, type, expr); -} - -/* Virtual function things. */ - -/* Build an entry in the virtual function table. - DELTA is the offset for the `this' pointer. - PFN is an ADDR_EXPR containing a pointer to the virtual function. - Note that the index (DELTA2) in the virtual function table - is always 0. */ - -static tree -build_vtable_entry (delta, pfn) - tree delta, pfn; -{ - if (flag_vtable_thunks) - { - HOST_WIDE_INT idelta = TREE_INT_CST_LOW (delta); - if (idelta && ! DECL_ABSTRACT_VIRTUAL_P (TREE_OPERAND (pfn, 0))) - { - pfn = build1 (ADDR_EXPR, vtable_entry_type, - make_thunk (pfn, idelta)); - TREE_READONLY (pfn) = 1; - TREE_CONSTANT (pfn) = 1; - } -#ifdef GATHER_STATISTICS - n_vtable_entries += 1; -#endif - return pfn; - } - else - { - extern int flag_huge_objects; - tree elems = expr_tree_cons (NULL_TREE, delta, - expr_tree_cons (NULL_TREE, integer_zero_node, - build_expr_list (NULL_TREE, pfn))); - tree entry = build (CONSTRUCTOR, vtable_entry_type, NULL_TREE, elems); - - /* DELTA used to be constructed by `size_int' and/or size_binop, - which caused overflow problems when it was negative. That should - be fixed now. */ - - if (! int_fits_type_p (delta, delta_type_node)) - { - if (flag_huge_objects) - sorry ("object size exceeds built-in limit for virtual function table implementation"); - else - sorry ("object size exceeds normal limit for virtual function table implementation, recompile all source and use -fhuge-objects"); - } - - TREE_CONSTANT (entry) = 1; - TREE_STATIC (entry) = 1; - TREE_READONLY (entry) = 1; - -#ifdef GATHER_STATISTICS - n_vtable_entries += 1; -#endif - - return entry; - } -} - -/* We want to give the assembler the vtable identifier as well as - the offset to the function pointer. So we generate - - __asm__ __volatile__ (".vtable_entry %c0, %c1" - : : "s"(&class_vtable), - "i"((long)&vtbl[idx].pfn - (long)&vtbl[0])); */ - -static void -build_vtable_entry_ref (basetype, vtbl, idx) - tree basetype, vtbl, idx; -{ - static char asm_stmt[] = ".vtable_entry %c0, %c1"; - tree s, i, i2; - - s = build_unary_op (ADDR_EXPR, TYPE_BINFO_VTABLE (basetype), 0); - s = build_tree_list (build_string (1, "s"), s); - - i = build_array_ref (vtbl, idx); - if (!flag_vtable_thunks) - i = build_component_ref (i, pfn_identifier, vtable_entry_type, 0); - i = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i, 0)); - i2 = build_array_ref (vtbl, build_int_2(0,0)); - i2 = build_c_cast (ptrdiff_type_node, build_unary_op (ADDR_EXPR, i2, 0)); - i = build_binary_op (MINUS_EXPR, i, i2); - i = build_tree_list (build_string (1, "i"), i); - - expand_asm_operands (build_string (sizeof(asm_stmt)-1, asm_stmt), - NULL_TREE, chainon (s, i), NULL_TREE, 1, NULL, 0); -} - -/* Given an object INSTANCE, return an expression which yields the - virtual function vtable element corresponding to INDEX. There are - many special cases for INSTANCE which we take care of here, mainly - to avoid creating extra tree nodes when we don't have to. */ - -tree -build_vtbl_ref (instance, idx) - tree instance, idx; -{ - tree vtbl, aref; - tree basetype = TREE_TYPE (instance); - - if (TREE_CODE (basetype) == REFERENCE_TYPE) - basetype = TREE_TYPE (basetype); - - if (instance == current_class_ref) - vtbl = build_vfield_ref (instance, basetype); - else - { - if (optimize) - { - /* Try to figure out what a reference refers to, and - access its virtual function table directly. */ - tree ref = NULL_TREE; - - if (TREE_CODE (instance) == INDIRECT_REF - && TREE_CODE (TREE_TYPE (TREE_OPERAND (instance, 0))) == REFERENCE_TYPE) - ref = TREE_OPERAND (instance, 0); - else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE) - ref = instance; - - if (ref && TREE_CODE (ref) == VAR_DECL - && DECL_INITIAL (ref)) - { - tree init = DECL_INITIAL (ref); - - while (TREE_CODE (init) == NOP_EXPR - || TREE_CODE (init) == NON_LVALUE_EXPR) - init = TREE_OPERAND (init, 0); - if (TREE_CODE (init) == ADDR_EXPR) - { - init = TREE_OPERAND (init, 0); - if (IS_AGGR_TYPE (TREE_TYPE (init)) - && (TREE_CODE (init) == PARM_DECL - || TREE_CODE (init) == VAR_DECL)) - instance = init; - } - } - } - - if (IS_AGGR_TYPE (TREE_TYPE (instance)) - && (TREE_CODE (instance) == RESULT_DECL - || TREE_CODE (instance) == PARM_DECL - || TREE_CODE (instance) == VAR_DECL)) - vtbl = TYPE_BINFO_VTABLE (basetype); - else - vtbl = build_vfield_ref (instance, basetype); - } - - assemble_external (vtbl); - - if (flag_vtable_gc) - build_vtable_entry_ref (basetype, vtbl, idx); - - aref = build_array_ref (vtbl, idx); - - return aref; -} - -/* Given an object INSTANCE, return an expression which yields the - virtual function corresponding to INDEX. There are many special - cases for INSTANCE which we take care of here, mainly to avoid - creating extra tree nodes when we don't have to. */ - -tree -build_vfn_ref (ptr_to_instptr, instance, idx) - tree *ptr_to_instptr, instance; - tree idx; -{ - tree aref = build_vtbl_ref (instance, idx); - - /* When using thunks, there is no extra delta, and we get the pfn - directly. */ - if (flag_vtable_thunks) - return aref; - - if (ptr_to_instptr) - { - /* Save the intermediate result in a SAVE_EXPR so we don't have to - compute each component of the virtual function pointer twice. */ - if (TREE_CODE (aref) == INDIRECT_REF) - TREE_OPERAND (aref, 0) = save_expr (TREE_OPERAND (aref, 0)); - - *ptr_to_instptr - = build (PLUS_EXPR, TREE_TYPE (*ptr_to_instptr), - *ptr_to_instptr, - cp_convert (ptrdiff_type_node, - build_component_ref (aref, delta_identifier, NULL_TREE, 0))); - } - - return build_component_ref (aref, pfn_identifier, NULL_TREE, 0); -} - -/* Return the name of the virtual function table (as an IDENTIFIER_NODE) - for the given TYPE. */ - -static tree -get_vtable_name (type) - tree type; -{ - tree type_id = build_typename_overload (type); - char *buf = (char *) alloca (strlen (VTABLE_NAME_FORMAT) - + IDENTIFIER_LENGTH (type_id) + 2); - const char *ptr = IDENTIFIER_POINTER (type_id); - int i; - for (i = 0; ptr[i] == OPERATOR_TYPENAME_FORMAT[i]; i++) ; -#if 0 - /* We don't take off the numbers; prepare_fresh_vtable uses the - DECL_ASSEMBLER_NAME for the type, which includes the number - in `3foo'. If we were to pull them off here, we'd end up with - something like `_vt.foo.3bar', instead of a uniform definition. */ - while (ptr[i] >= '0' && ptr[i] <= '9') - i += 1; -#endif - sprintf (buf, VTABLE_NAME_FORMAT, ptr+i); - return get_identifier (buf); -} - -/* Return the offset to the main vtable for a given base BINFO. */ - -tree -get_vfield_offset (binfo) - tree binfo; -{ - tree tmp - = size_binop (FLOOR_DIV_EXPR, - DECL_FIELD_BITPOS (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))), - size_int (BITS_PER_UNIT)); - tmp = convert (sizetype, tmp); - return size_binop (PLUS_EXPR, tmp, BINFO_OFFSET (binfo)); -} - -/* Get the offset to the start of the original binfo that we derived - this binfo from. If we find TYPE first, return the offset only - that far. The shortened search is useful because the this pointer - on method calling is expected to point to a DECL_CONTEXT (fndecl) - object, and not a baseclass of it. */ - -static tree -get_derived_offset (binfo, type) - tree binfo, type; -{ - tree offset1 = get_vfield_offset (TYPE_BINFO (BINFO_TYPE (binfo))); - tree offset2; - int i; - while (BINFO_BASETYPES (binfo) - && (i=CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo))) != -1) - { - tree binfos = BINFO_BASETYPES (binfo); - if (BINFO_TYPE (binfo) == type) - break; - binfo = TREE_VEC_ELT (binfos, i); - } - offset2 = get_vfield_offset (TYPE_BINFO (BINFO_TYPE (binfo))); - return size_binop (MINUS_EXPR, offset1, offset2); -} - -/* Update the rtti info for this class. */ - -static void -set_rtti_entry (virtuals, offset, type) - tree virtuals, offset, type; -{ - tree vfn; - - if (CLASSTYPE_COM_INTERFACE (type)) - return; - - if (flag_rtti) - vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, get_tinfo_fn_unused (type)); - else - vfn = build1 (NOP_EXPR, vfunc_ptr_type_node, size_zero_node); - TREE_CONSTANT (vfn) = 1; - - if (! flag_vtable_thunks) - TREE_VALUE (virtuals) = build_vtable_entry (offset, vfn); - else - { - tree voff = build1 (NOP_EXPR, vfunc_ptr_type_node, offset); - TREE_CONSTANT (voff) = 1; - - TREE_VALUE (virtuals) = build_vtable_entry (integer_zero_node, voff); - - /* The second slot is for the tdesc pointer when thunks are used. */ - TREE_VALUE (TREE_CHAIN (virtuals)) - = build_vtable_entry (integer_zero_node, vfn); - } -} - -/* Build a virtual function for type TYPE. - If BINFO is non-NULL, build the vtable starting with the initial - approximation that it is the same as the one which is the head of - the association list. */ - -static tree -build_vtable (binfo, type) - tree binfo, type; -{ - tree name = get_vtable_name (type); - tree virtuals, decl; - - if (binfo) - { - tree offset; - - virtuals = copy_list (BINFO_VIRTUALS (binfo)); - decl = build_lang_decl (VAR_DECL, name, TREE_TYPE (BINFO_VTABLE (binfo))); - - /* Now do rtti stuff. */ - offset = get_derived_offset (TYPE_BINFO (type), NULL_TREE); - offset = ssize_binop (MINUS_EXPR, integer_zero_node, offset); - set_rtti_entry (virtuals, offset, type); - } - else - { - virtuals = NULL_TREE; - decl = build_lang_decl (VAR_DECL, name, void_type_node); - } - -#ifdef GATHER_STATISTICS - n_vtables += 1; - n_vtable_elems += list_length (virtuals); -#endif - - /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */ - import_export_vtable (decl, type, 0); - - decl = pushdecl_top_level (decl); - SET_IDENTIFIER_GLOBAL_VALUE (name, decl); - /* Initialize the association list for this type, based - on our first approximation. */ - TYPE_BINFO_VTABLE (type) = decl; - TYPE_BINFO_VIRTUALS (type) = virtuals; - - DECL_ARTIFICIAL (decl) = 1; - TREE_STATIC (decl) = 1; -#ifndef WRITABLE_VTABLES - /* Make them READONLY by default. (mrs) */ - TREE_READONLY (decl) = 1; -#endif - /* At one time the vtable info was grabbed 2 words at a time. This - fails on sparc unless you have 8-byte alignment. (tiemann) */ - DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node), - DECL_ALIGN (decl)); - - DECL_VIRTUAL_P (decl) = 1; - DECL_CONTEXT (decl) = type; - - binfo = TYPE_BINFO (type); - SET_BINFO_NEW_VTABLE_MARKED (binfo); - return decl; -} - -extern tree signed_size_zero_node; - -/* Give TYPE a new virtual function table which is initialized - with a skeleton-copy of its original initialization. The only - entry that changes is the `delta' entry, so we can really - share a lot of structure. - - FOR_TYPE is the derived type which caused this table to - be needed. - - BINFO is the type association which provided TYPE for FOR_TYPE. - - The order in which vtables are built (by calling this function) for - an object must remain the same, otherwise a binary incompatibility - can result. */ - -static void -prepare_fresh_vtable (binfo, for_type) - tree binfo, for_type; -{ - tree basetype; - tree orig_decl = BINFO_VTABLE (binfo); - tree name; - tree new_decl; - tree offset; - tree path = binfo; - char *buf, *buf2; - char joiner = '_'; - int i; - -#ifdef JOINER - joiner = JOINER; -#endif - - basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (binfo)); - - buf2 = TYPE_ASSEMBLER_NAME_STRING (basetype); - i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1; - - /* We know that the vtable that we are going to create doesn't exist - yet in the global namespace, and when we finish, it will be - pushed into the global namespace. In complex MI hierarchies, we - have to loop while the name we are thinking of adding is globally - defined, adding more name components to the vtable name as we - loop, until the name is unique. This is because in complex MI - cases, we might have the same base more than once. This means - that the order in which this function is called for vtables must - remain the same, otherwise binary compatibility can be - compromised. */ - - while (1) - { - char *buf1 = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (for_type) - + 1 + i); - char *new_buf2; - - sprintf (buf1, "%s%c%s", TYPE_ASSEMBLER_NAME_STRING (for_type), joiner, - buf2); - buf = (char *) alloca (strlen (VTABLE_NAME_FORMAT) + strlen (buf1) + 1); - sprintf (buf, VTABLE_NAME_FORMAT, buf1); - name = get_identifier (buf); - - /* If this name doesn't clash, then we can use it, otherwise - we add more to the name until it is unique. */ - - if (! IDENTIFIER_GLOBAL_VALUE (name)) - break; - - /* Set values for next loop through, if the name isn't unique. */ - - path = BINFO_INHERITANCE_CHAIN (path); - - /* We better not run out of stuff to make it unique. */ - my_friendly_assert (path != NULL_TREE, 368); - - basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (path)); - - if (for_type == basetype) - { - /* If we run out of basetypes in the path, we have already - found created a vtable with that name before, we now - resort to tacking on _%d to distinguish them. */ - int j = 2; - i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i + 1 + 3; - buf1 = (char *) alloca (i); - do { - sprintf (buf1, "%s%c%s%c%d", - TYPE_ASSEMBLER_NAME_STRING (basetype), joiner, - buf2, joiner, j); - buf = (char *) alloca (strlen (VTABLE_NAME_FORMAT) - + strlen (buf1) + 1); - sprintf (buf, VTABLE_NAME_FORMAT, buf1); - name = get_identifier (buf); - - /* If this name doesn't clash, then we can use it, - otherwise we add something different to the name until - it is unique. */ - } while (++j <= 999 && IDENTIFIER_GLOBAL_VALUE (name)); - - /* Hey, they really like MI don't they? Increase the 3 - above to 6, and the 999 to 999999. :-) */ - my_friendly_assert (j <= 999, 369); - - break; - } - - i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i; - new_buf2 = (char *) alloca (i); - sprintf (new_buf2, "%s%c%s", - TYPE_ASSEMBLER_NAME_STRING (basetype), joiner, buf2); - buf2 = new_buf2; - } - - new_decl = build_lang_decl (VAR_DECL, name, TREE_TYPE (orig_decl)); - /* Remember which class this vtable is really for. */ - DECL_CONTEXT (new_decl) = for_type; - - DECL_ARTIFICIAL (new_decl) = 1; - TREE_STATIC (new_decl) = 1; - BINFO_VTABLE (binfo) = pushdecl_top_level (new_decl); - DECL_VIRTUAL_P (new_decl) = 1; -#ifndef WRITABLE_VTABLES - /* Make them READONLY by default. (mrs) */ - TREE_READONLY (new_decl) = 1; -#endif - DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl); - - /* Make fresh virtual list, so we can smash it later. */ - BINFO_VIRTUALS (binfo) = copy_list (BINFO_VIRTUALS (binfo)); - - if (TREE_VIA_VIRTUAL (binfo)) - { - tree binfo1 = binfo_member (BINFO_TYPE (binfo), - CLASSTYPE_VBASECLASSES (for_type)); - - /* XXX - This should never happen, if it does, the caller should - ensure that the binfo is from for_type's binfos, not from any - base type's. We can remove all this code after a while. */ - if (binfo1 != binfo) - warning ("internal inconsistency: binfo offset error for rtti"); - - offset = BINFO_OFFSET (binfo1); - } - else - offset = BINFO_OFFSET (binfo); - - set_rtti_entry (BINFO_VIRTUALS (binfo), - ssize_binop (MINUS_EXPR, integer_zero_node, offset), - for_type); - -#ifdef GATHER_STATISTICS - n_vtables += 1; - n_vtable_elems += list_length (BINFO_VIRTUALS (binfo)); -#endif - - /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */ - import_export_vtable (new_decl, for_type, 0); - - if (TREE_VIA_VIRTUAL (binfo)) - my_friendly_assert (binfo == binfo_member (BINFO_TYPE (binfo), - CLASSTYPE_VBASECLASSES (current_class_type)), - 170); - SET_BINFO_NEW_VTABLE_MARKED (binfo); -} - -/* Return a new vtable for use in initialization of the BASE subobject - of COMPLETE_TYPE. The vtable there goes into the vfield of the - VBASEBASE virtual subobject. */ - -static tree -prepare_ctor_vtable (complete_type, base, vbasebase) - tree complete_type, base, vbasebase; -{ - tree orig_decl = BINFO_VTABLE (vbasebase); - tree name = get_vlist_vtable_id (base, vbasebase); - tree new_decl; - - new_decl = build_lang_decl (VAR_DECL, name, TREE_TYPE (orig_decl)); - /* Remember which class this vtable is really for. */ - DECL_CONTEXT (new_decl) = complete_type; - - DECL_ARTIFICIAL (new_decl) = 1; - TREE_STATIC (new_decl) = 1; - new_decl = pushdecl_top_level (new_decl); - DECL_VIRTUAL_P (new_decl) = 1; -#ifndef WRITABLE_VTABLES - /* Make them READONLY by default. (mrs) */ - TREE_READONLY (new_decl) = 1; -#endif - DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl); - -#ifdef GATHER_STATISTICS - n_vtables += 1; - n_vtable_elems += list_length (BINFO_VIRTUALS (binfo)); -#endif - - /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */ - import_export_vtable (new_decl, complete_type, 0); - - return new_decl; -} - -#if 0 -/* Access the virtual function table entry that logically - contains BASE_FNDECL. VIRTUALS is the virtual function table's - initializer. We can run off the end, when dealing with virtual - destructors in MI situations, return NULL_TREE in that case. */ - -static tree -get_vtable_entry (virtuals, base_fndecl) - tree virtuals, base_fndecl; -{ - unsigned HOST_WIDE_INT n = (HOST_BITS_PER_WIDE_INT >= BITS_PER_WORD - ? (TREE_INT_CST_LOW (DECL_VINDEX (base_fndecl)) - & (((unsigned HOST_WIDE_INT)1<<(BITS_PER_WORD-1))-1)) - : TREE_INT_CST_LOW (DECL_VINDEX (base_fndecl))); - -#ifdef GATHER_STATISTICS - n_vtable_searches += n; -#endif - - while (n > 0 && virtuals) - { - --n; - virtuals = TREE_CHAIN (virtuals); - } - return virtuals; -} -#endif - -/* Put new entry ENTRY into virtual function table initializer - VIRTUALS. - - Also update DECL_VINDEX (FNDECL). */ - -static void -modify_vtable_entry (old_entry_in_list, new_entry, fndecl) - tree old_entry_in_list, new_entry, fndecl; -{ - tree base_fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (old_entry_in_list)), 0); - -#ifdef NOTQUITE - cp_warning ("replaced %D with %D", DECL_ASSEMBLER_NAME (base_fndecl), - DECL_ASSEMBLER_NAME (fndecl)); -#endif - TREE_VALUE (old_entry_in_list) = new_entry; - - /* Now assign virtual dispatch information, if unset. */ - /* We can dispatch this, through any overridden base function. */ - if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST) - { - DECL_VINDEX (fndecl) = DECL_VINDEX (base_fndecl); - DECL_CONTEXT (fndecl) = DECL_CONTEXT (base_fndecl); - } -} - -/* Access the virtual function table entry N. VIRTUALS is the virtual - function table's initializer. */ - -static tree -get_vtable_entry_n (virtuals, n) - tree virtuals; - unsigned HOST_WIDE_INT n; -{ - while (n > 0) - { - --n; - virtuals = TREE_CHAIN (virtuals); - } - return virtuals; -} - -/* Add a virtual function to all the appropriate vtables for the class - T. DECL_VINDEX(X) should be error_mark_node, if we want to - allocate a new slot in our table. If it is error_mark_node, we - know that no other function from another vtable is overridden by X. - HAS_VIRTUAL keeps track of how many virtuals there are in our main - vtable for the type, and we build upon the PENDING_VIRTUALS list - and return it. */ - -static void -add_virtual_function (pv, phv, has_virtual, fndecl, t) - tree *pv, *phv; - int *has_virtual; - tree fndecl; - tree t; /* Structure type. */ -{ - tree pending_virtuals = *pv; - tree pending_hard_virtuals = *phv; - - /* FUNCTION_TYPEs and OFFSET_TYPEs no longer freely - convert to void *. Make such a conversion here. */ - tree vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fndecl); - TREE_CONSTANT (vfn) = 1; - -#ifndef DUMB_USER - if (current_class_type == 0) - cp_warning ("internal problem, current_class_type is zero when adding `%D', please report", - fndecl); - if (current_class_type && t != current_class_type) - cp_warning ("internal problem, current_class_type differs when adding `%D', please report", - fndecl); -#endif - - /* If the virtual function is a redefinition of a prior one, - figure out in which base class the new definition goes, - and if necessary, make a fresh virtual function table - to hold that entry. */ - if (DECL_VINDEX (fndecl) == error_mark_node) - { - tree entry; - - /* We remember that this was the base sub-object for rtti. */ - CLASSTYPE_RTTI (t) = t; - - /* If we are using thunks, use two slots at the front, one - for the offset pointer, one for the tdesc pointer. - For ARM-style vtables, use the same slot for both. */ - if (*has_virtual == 0 && ! CLASSTYPE_COM_INTERFACE (t)) - { - if (flag_vtable_thunks) - *has_virtual = 2; - else - *has_virtual = 1; - } - - /* Build a new INT_CST for this DECL_VINDEX. */ - { - static tree index_table[256]; - tree idx; - /* We skip a slot for the offset/tdesc entry. */ - int i = (*has_virtual)++; - - if (i >= 256 || index_table[i] == 0) - { - idx = build_int_2 (i, 0); - if (i < 256) - index_table[i] = idx; - } - else - idx = index_table[i]; - - /* Now assign virtual dispatch information. */ - DECL_VINDEX (fndecl) = idx; - DECL_CONTEXT (fndecl) = t; - } - entry = build_vtable_entry (integer_zero_node, vfn); - pending_virtuals = tree_cons (DECL_VINDEX (fndecl), entry, pending_virtuals); - } - /* Might already be INTEGER_CST if declared twice in class. We will - give error later or we've already given it. */ - else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST) - { - /* Need an entry in some other virtual function table. - Deal with this after we have laid out our virtual base classes. */ - pending_hard_virtuals = temp_tree_cons (fndecl, vfn, pending_hard_virtuals); - } - *pv = pending_virtuals; - *phv = pending_hard_virtuals; -} - -/* Obstack on which to build the vector of class methods. */ -struct obstack class_obstack; -extern struct obstack *current_obstack; - -/* These are method vectors that were too small for the number of - methods in some class, and so were abandoned. */ -static tree free_method_vecs; - -/* Returns a method vector with enough room for N methods. N should - be a power of two. */ - -static tree -make_method_vec (n) - int n; -{ - tree new_vec; - tree* t; - - for (t = &free_method_vecs; *t; t = &(TREE_CHAIN (*t))) - /* Note that we don't use >= n here because we don't want to - allocate a very large vector where it isn't needed. */ - if (TREE_VEC_LENGTH (*t) == n) - { - new_vec = *t; - *t = TREE_CHAIN (new_vec); - TREE_CHAIN (new_vec) = NULL_TREE; - bzero ((PTR) &TREE_VEC_ELT (new_vec, 0), n * sizeof (tree)); - return new_vec; - } - - new_vec = make_tree_vec (n); - return new_vec; -} - -/* Free the method vector VEC. */ - -static void -free_method_vec (vec) - tree vec; -{ - TREE_CHAIN (vec) = free_method_vecs; - free_method_vecs = vec; -} - -/* Add method METHOD to class TYPE. - - If non-NULL, FIELDS is the entry in the METHOD_VEC vector entry of - the class type where the method should be added. */ - -void -add_method (type, fields, method) - tree type, *fields, method; -{ - push_obstacks_nochange (); - end_temporary_allocation (); - - /* Setting the DECL_CONTEXT and DECL_CLASS_CONTEXT here is probably - redundant. */ - DECL_CONTEXT (method) = type; - DECL_CLASS_CONTEXT (method) = type; - - if (fields && *fields) - *fields = build_overload (method, *fields); - else - { - int len; - int slot; - tree method_vec; - - if (!CLASSTYPE_METHOD_VEC (type)) - /* Make a new method vector. We start with 8 entries. We must - allocate at least two (for constructors and destructors), and - we're going to end up with an assignment operator at some - point as well. - - We could use a TREE_LIST for now, and convert it to a - TREE_VEC in finish_struct, but we would probably waste more - memory making the links in the list than we would by - over-allocating the size of the vector here. Furthermore, - we would complicate all the code that expects this to be a - vector. We keep a free list of vectors that we outgrew so - that we don't really waste any memory. */ - CLASSTYPE_METHOD_VEC (type) = make_method_vec (8); - - method_vec = CLASSTYPE_METHOD_VEC (type); - len = TREE_VEC_LENGTH (method_vec); - - if (DECL_NAME (method) == constructor_name (type)) - /* A new constructor or destructor. Constructors go in - slot 0; destructors go in slot 1. */ - slot = DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (method)) ? 1 : 0; - else - { - /* See if we already have an entry with this name. */ - for (slot = 2; slot < len; ++slot) - if (!TREE_VEC_ELT (method_vec, slot) - || (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, - slot))) - == DECL_NAME (method))) - break; - - if (slot == len) - { - /* We need a bigger method vector. */ - tree new_vec = make_method_vec (2 * len); - bcopy ((PTR) &TREE_VEC_ELT (method_vec, 0), - (PTR) &TREE_VEC_ELT (new_vec, 0), - len * sizeof (tree)); - free_method_vec (method_vec); - len = 2 * len; - method_vec = CLASSTYPE_METHOD_VEC (type) = new_vec; - } - - if (DECL_CONV_FN_P (method) && !TREE_VEC_ELT (method_vec, slot)) - { - /* Type conversion operators have to come before - ordinary methods; add_conversions depends on this to - speed up looking for conversion operators. So, if - necessary, we slide some of the vector elements up. - In theory, this makes this algorithm O(N^2) but we - don't expect many conversion operators. */ - for (slot = 2; slot < len; ++slot) - { - tree fn = TREE_VEC_ELT (method_vec, slot); - - if (!fn) - /* There are no more entries in the vector, so we - can insert the new conversion operator here. */ - break; - - if (!DECL_CONV_FN_P (OVL_CURRENT (fn))) - /* We can insert the new function right at the - SLOTth position. */ - break; - } - - if (!TREE_VEC_ELT (method_vec, slot)) - /* There is nothing in the Ith slot, so we can avoid - moving anything. */ - ; - else - { - /* We know the last slot in the vector is empty - because we know that at this point there's room - for a new function. */ - bcopy ((PTR) &TREE_VEC_ELT (method_vec, slot), - (PTR) &TREE_VEC_ELT (method_vec, slot + 1), - (len - slot - 1) * sizeof (tree)); - TREE_VEC_ELT (method_vec, slot) = NULL_TREE; - } - } - } - - if (template_class_depth (type)) - /* TYPE is a template class. Don't issue any errors now; wait - until instantiation time to complain. */ - ; - else - { - tree fns; - - /* Check to see if we've already got this method. */ - for (fns = TREE_VEC_ELT (method_vec, slot); - fns; - fns = OVL_NEXT (fns)) - { - tree fn = OVL_CURRENT (fns); - - if (TREE_CODE (fn) != TREE_CODE (method)) - continue; - - if (TREE_CODE (method) != TEMPLATE_DECL) - { - /* [over.load] Member function declarations with the - same name and the same parameter types cannot be - overloaded if any of them is a static member - function declaration. */ - if (DECL_STATIC_FUNCTION_P (fn) - != DECL_STATIC_FUNCTION_P (method)) - { - tree parms1 = TYPE_ARG_TYPES (TREE_TYPE (fn)); - tree parms2 = TYPE_ARG_TYPES (TREE_TYPE (method)); - - if (! DECL_STATIC_FUNCTION_P (fn)) - parms1 = TREE_CHAIN (parms1); - else - parms2 = TREE_CHAIN (parms2); - - if (compparms (parms1, parms2)) - cp_error ("`%#D' and `%#D' cannot be overloaded", - fn, method); - } - - /* Since this is an ordinary function in a - non-template class, it's mangled name can be used - as a unique identifier. This technique is only - an optimization; we would get the same results if - we just used decls_match here. */ - if (DECL_ASSEMBLER_NAME (fn) - != DECL_ASSEMBLER_NAME (method)) - continue; - } - else if (!decls_match (fn, method)) - continue; - - /* There has already been a declaration of this method - or member template. */ - cp_error_at ("`%D' has already been declared in `%T'", - method, type); - - /* We don't call duplicate_decls here to merge the - declarations because that will confuse things if the - methods have inline definitions. In particular, we - will crash while processing the definitions. */ - return; - } - } - - /* Actually insert the new method. */ - TREE_VEC_ELT (method_vec, slot) - = build_overload (method, TREE_VEC_ELT (method_vec, slot)); - - /* Add the new binding. */ - if (!DECL_CONSTRUCTOR_P (method) - && !DECL_DESTRUCTOR_P (method)) - push_class_level_binding (DECL_NAME (method), - TREE_VEC_ELT (method_vec, slot)); - } - pop_obstacks (); -} - -/* Subroutines of finish_struct. */ - -/* Look through the list of fields for this struct, deleting - duplicates as we go. This must be recursive to handle - anonymous unions. - - FIELD is the field which may not appear anywhere in FIELDS. - FIELD_PTR, if non-null, is the starting point at which - chained deletions may take place. - The value returned is the first acceptable entry found - in FIELDS. - - Note that anonymous fields which are not of UNION_TYPE are - not duplicates, they are just anonymous fields. This happens - when we have unnamed bitfields, for example. */ - -static tree -delete_duplicate_fields_1 (field, fields) - tree field, fields; -{ - tree x; - tree prev = 0; - if (DECL_NAME (field) == 0) - { - if (TREE_CODE (TREE_TYPE (field)) != UNION_TYPE) - return fields; - - for (x = TYPE_FIELDS (TREE_TYPE (field)); x; x = TREE_CHAIN (x)) - fields = delete_duplicate_fields_1 (x, fields); - return fields; - } - else - { - for (x = fields; x; prev = x, x = TREE_CHAIN (x)) - { - if (DECL_NAME (x) == 0) - { - if (TREE_CODE (TREE_TYPE (x)) != UNION_TYPE) - continue; - TYPE_FIELDS (TREE_TYPE (x)) - = delete_duplicate_fields_1 (field, TYPE_FIELDS (TREE_TYPE (x))); - if (TYPE_FIELDS (TREE_TYPE (x)) == 0) - { - if (prev == 0) - fields = TREE_CHAIN (fields); - else - TREE_CHAIN (prev) = TREE_CHAIN (x); - } - } - else - { - if (DECL_NAME (field) == DECL_NAME (x)) - { - if (TREE_CODE (field) == CONST_DECL - && TREE_CODE (x) == CONST_DECL) - cp_error_at ("duplicate enum value `%D'", x); - else if (TREE_CODE (field) == CONST_DECL - || TREE_CODE (x) == CONST_DECL) - cp_error_at ("duplicate field `%D' (as enum and non-enum)", - x); - else if (DECL_DECLARES_TYPE_P (field) - && DECL_DECLARES_TYPE_P (x)) - { - if (same_type_p (TREE_TYPE (field), TREE_TYPE (x))) - continue; - cp_error_at ("duplicate nested type `%D'", x); - } - else if (DECL_DECLARES_TYPE_P (field) - || DECL_DECLARES_TYPE_P (x)) - { - /* Hide tag decls. */ - if ((TREE_CODE (field) == TYPE_DECL - && DECL_ARTIFICIAL (field)) - || (TREE_CODE (x) == TYPE_DECL - && DECL_ARTIFICIAL (x))) - continue; - cp_error_at ("duplicate field `%D' (as type and non-type)", - x); - } - else - cp_error_at ("duplicate member `%D'", x); - if (prev == 0) - fields = TREE_CHAIN (fields); - else - TREE_CHAIN (prev) = TREE_CHAIN (x); - } - } - } - } - return fields; -} - -static void -delete_duplicate_fields (fields) - tree fields; -{ - tree x; - for (x = fields; x && TREE_CHAIN (x); x = TREE_CHAIN (x)) - TREE_CHAIN (x) = delete_duplicate_fields_1 (x, TREE_CHAIN (x)); -} - -/* Change the access of FDECL to ACCESS in T. The access to FDECL is - along the path given by BINFO. Return 1 if change was legit, - otherwise return 0. */ - -static int -alter_access (t, binfo, fdecl, access) - tree t; - tree binfo; - tree fdecl; - tree access; -{ - tree elem = purpose_member (t, DECL_ACCESS (fdecl)); - if (elem) - { - if (TREE_VALUE (elem) != access) - { - if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL) - cp_error_at ("conflicting access specifications for method `%D', ignored", TREE_TYPE (fdecl)); - else - error ("conflicting access specifications for field `%s', ignored", - IDENTIFIER_POINTER (DECL_NAME (fdecl))); - } - else - { - /* They're changing the access to the same thing they changed - it to before. That's OK. */ - ; - } - } - else - { - enforce_access (binfo, fdecl); - DECL_ACCESS (fdecl) = tree_cons (t, access, DECL_ACCESS (fdecl)); - return 1; - } - return 0; -} - -/* Process the USING_DECL, which is a member of T. The METHOD_VEC, if - non-NULL, is the methods of T. The FIELDS are the fields of T. */ - -static void -handle_using_decl (using_decl, t, method_vec, fields) - tree using_decl; - tree t; - tree method_vec; - tree fields; -{ - tree ctype = DECL_INITIAL (using_decl); - tree name = DECL_NAME (using_decl); - tree access - = TREE_PRIVATE (using_decl) ? access_private_node - : TREE_PROTECTED (using_decl) ? access_protected_node - : access_public_node; - tree fdecl, binfo; - tree flist = NULL_TREE; - tree tmp; - int i; - int n_methods; - - binfo = binfo_or_else (ctype, t); - if (! binfo) - return; - - if (name == constructor_name (ctype) - || name == constructor_name_full (ctype)) - { - cp_error_at ("using-declaration for constructor", using_decl); - return; - } - - fdecl = lookup_member (binfo, name, 0, 0); - - if (!fdecl) - { - cp_error_at ("no members matching `%D' in `%#T'", using_decl, ctype); - return; - } - - /* Functions are represented as TREE_LIST, with the purpose - being the type and the value the functions. Other members - come as themselves. */ - if (TREE_CODE (fdecl) == TREE_LIST) - /* Ignore base type this came from. */ - fdecl = TREE_VALUE (fdecl); - - if (TREE_CODE (fdecl) == OVERLOAD) - { - /* We later iterate over all functions. */ - flist = fdecl; - fdecl = OVL_FUNCTION (flist); - } - - name = DECL_NAME (fdecl); - n_methods = method_vec ? TREE_VEC_LENGTH (method_vec) : 0; - for (i = 2; i < n_methods && TREE_VEC_ELT (method_vec, i); i++) - if (DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i))) - == name) - { - cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t); - cp_error_at (" because of local method `%#D' with same name", - OVL_CURRENT (TREE_VEC_ELT (method_vec, i))); - return; - } - - if (! DECL_LANG_SPECIFIC (fdecl)) - /* We don't currently handle DECL_ACCESS for TYPE_DECLs; just return. */ - return; - - for (tmp = fields; tmp; tmp = TREE_CHAIN (tmp)) - if (DECL_NAME (tmp) == name) - { - cp_error ("cannot adjust access to `%#D' in `%#T'", fdecl, t); - cp_error_at (" because of local field `%#D' with same name", tmp); - return; - } - - /* Make type T see field decl FDECL with access ACCESS.*/ - if (flist) - { - while (flist) - { - if (alter_access (t, binfo, OVL_FUNCTION (flist), - access) == 0) - return; - flist = OVL_CHAIN (flist); - } - } - else - alter_access (t, binfo, fdecl, access); -} - -struct base_info -{ - int has_virtual; - int max_has_virtual; - tree vfield; - tree vfields; - tree rtti; - char cant_have_default_ctor; - char cant_have_const_ctor; - char no_const_asn_ref; -}; - -/* Record information about type T derived from its base classes. - Store most of that information in T itself, and place the - remaining information in the struct BASE_INFO. - - Propagate basetype offsets throughout the lattice. Note that the - lattice topped by T is really a pair: it's a DAG that gives the - structure of the derivation hierarchy, and it's a list of the - virtual baseclasses that appear anywhere in the DAG. When a vbase - type appears in the DAG, it's offset is 0, and it's children start - their offsets from that point. When a vbase type appears in the list, - its offset is the offset it has in the hierarchy, and its children's - offsets include that offset in theirs. - - Returns the index of the first base class to have virtual functions, - or -1 if no such base class. */ - -static int -finish_base_struct (t, b) - tree t; - struct base_info *b; -{ - tree binfos = TYPE_BINFO_BASETYPES (t); - int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0; - int first_vfn_base_index = -1; - bzero ((char *) b, sizeof (struct base_info)); - - for (i = 0; i < n_baseclasses; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - tree basetype = BINFO_TYPE (base_binfo); - - /* Effective C++ rule 14. We only need to check TYPE_VIRTUAL_P - here because the case of virtual functions but non-virtual - dtor is handled in finish_struct_1. */ - if (warn_ecpp && ! TYPE_VIRTUAL_P (basetype) - && TYPE_HAS_DESTRUCTOR (basetype)) - cp_warning ("base class `%#T' has a non-virtual destructor", basetype); - - /* If the type of basetype is incomplete, then - we already complained about that fact - (and we should have fixed it up as well). */ - if (TYPE_SIZE (basetype) == 0) - { - int j; - /* The base type is of incomplete type. It is - probably best to pretend that it does not - exist. */ - if (i == n_baseclasses-1) - TREE_VEC_ELT (binfos, i) = NULL_TREE; - TREE_VEC_LENGTH (binfos) -= 1; - n_baseclasses -= 1; - for (j = i; j+1 < n_baseclasses; j++) - TREE_VEC_ELT (binfos, j) = TREE_VEC_ELT (binfos, j+1); - } - - if (! TYPE_HAS_CONST_INIT_REF (basetype)) - b->cant_have_const_ctor = 1; - - if (TYPE_HAS_CONSTRUCTOR (basetype) - && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype)) - { - b->cant_have_default_ctor = 1; - if (! TYPE_HAS_CONSTRUCTOR (t)) - { - cp_pedwarn ("base `%T' with only non-default constructor", - basetype); - cp_pedwarn ("in class without a constructor"); - } - } - - if (TYPE_HAS_ASSIGN_REF (basetype) - && !TYPE_HAS_CONST_ASSIGN_REF (basetype)) - b->no_const_asn_ref = 1; - - TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (basetype); - TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_NEEDS_DESTRUCTOR (basetype); - TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (basetype); - TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (basetype); - - TYPE_OVERLOADS_CALL_EXPR (t) |= TYPE_OVERLOADS_CALL_EXPR (basetype); - TYPE_OVERLOADS_ARRAY_REF (t) |= TYPE_OVERLOADS_ARRAY_REF (basetype); - TYPE_OVERLOADS_ARROW (t) |= TYPE_OVERLOADS_ARROW (basetype); - - if (CLASSTYPE_COM_INTERFACE (basetype)) - { - CLASSTYPE_COM_INTERFACE (t) = 1; - if (i > 0) - cp_error - ("COM interface type `%T' must be the leftmost base class", - basetype); - } - else if (CLASSTYPE_COM_INTERFACE (t)) - { - cp_error ("COM interface type `%T' with non-COM base class `%T'", - t, basetype); - CLASSTYPE_COM_INTERFACE (t) = 0; - } - - if (TYPE_VIRTUAL_P (basetype)) - { - /* Ensure that this is set from at least a virtual base - class. */ - if (b->rtti == NULL_TREE) - b->rtti = CLASSTYPE_RTTI (basetype); - - /* Don't borrow virtuals from virtual baseclasses. */ - if (TREE_VIA_VIRTUAL (base_binfo)) - continue; - - if (first_vfn_base_index < 0) - { - tree vfields; - first_vfn_base_index = i; - - /* Update these two, now that we know what vtable we are - going to extend. This is so that we can add virtual - functions, and override them properly. */ - TYPE_BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (basetype); - TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype); - b->has_virtual = CLASSTYPE_VSIZE (basetype); - b->vfield = CLASSTYPE_VFIELD (basetype); - b->vfields = copy_list (CLASSTYPE_VFIELDS (basetype)); - vfields = b->vfields; - while (vfields) - { - if (VF_BINFO_VALUE (vfields) == NULL_TREE - || ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields))) - { - tree value = VF_BASETYPE_VALUE (vfields); - if (DECL_NAME (CLASSTYPE_VFIELD (value)) - == DECL_NAME (CLASSTYPE_VFIELD (basetype))) - VF_NORMAL_VALUE (b->vfields) = basetype; - else - VF_NORMAL_VALUE (b->vfields) = VF_NORMAL_VALUE (vfields); - } - vfields = TREE_CHAIN (vfields); - } - CLASSTYPE_VFIELD (t) = b->vfield; - } - else - { - /* Only add unique vfields, and flatten them out as we go. */ - tree vfields = CLASSTYPE_VFIELDS (basetype); - while (vfields) - { - if (VF_BINFO_VALUE (vfields) == NULL_TREE - || ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields))) - { - tree value = VF_BASETYPE_VALUE (vfields); - b->vfields = tree_cons (base_binfo, value, b->vfields); - if (DECL_NAME (CLASSTYPE_VFIELD (value)) - == DECL_NAME (CLASSTYPE_VFIELD (basetype))) - VF_NORMAL_VALUE (b->vfields) = basetype; - else - VF_NORMAL_VALUE (b->vfields) = VF_NORMAL_VALUE (vfields); - } - vfields = TREE_CHAIN (vfields); - } - - if (b->has_virtual == 0) - { - first_vfn_base_index = i; - - /* Update these two, now that we know what vtable we are - going to extend. This is so that we can add virtual - functions, and override them properly. */ - TYPE_BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (basetype); - TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype); - b->has_virtual = CLASSTYPE_VSIZE (basetype); - b->vfield = CLASSTYPE_VFIELD (basetype); - CLASSTYPE_VFIELD (t) = b->vfield; - /* When we install the first one, set the VF_NORMAL_VALUE - to be the current class, as this it is the most derived - class. Hopefully, this is not set to something else - later. (mrs) */ - vfields = b->vfields; - while (vfields) - { - if (DECL_NAME (CLASSTYPE_VFIELD (t)) - == DECL_NAME (CLASSTYPE_VFIELD (basetype))) - { - VF_NORMAL_VALUE (vfields) = t; - /* There should only be one of them! And it should - always be found, if we get into here. (mrs) */ - break; - } - vfields = TREE_CHAIN (vfields); - } - } - } - } - } - - { - tree vfields; - /* Find the base class with the largest number of virtual functions. */ - for (vfields = b->vfields; vfields; vfields = TREE_CHAIN (vfields)) - { - if (CLASSTYPE_VSIZE (VF_BASETYPE_VALUE (vfields)) > b->max_has_virtual) - b->max_has_virtual = CLASSTYPE_VSIZE (VF_BASETYPE_VALUE (vfields)); - if (VF_DERIVED_VALUE (vfields) - && CLASSTYPE_VSIZE (VF_DERIVED_VALUE (vfields)) > b->max_has_virtual) - b->max_has_virtual = CLASSTYPE_VSIZE (VF_DERIVED_VALUE (vfields)); - } - } - - if (b->vfield == 0) - /* If all virtual functions come only from virtual baseclasses. */ - return -1; - - /* Update the rtti base if we have a non-virtual base class version - of it. */ - b->rtti = CLASSTYPE_RTTI (BINFO_TYPE (TREE_VEC_ELT (binfos, first_vfn_base_index))); - - return first_vfn_base_index; -} - -/* Set memoizing fields and bits of T (and its variants) for later use. - MAX_HAS_VIRTUAL is the largest size of any T's virtual function tables. */ - -static void -finish_struct_bits (t, max_has_virtual) - tree t; - int max_has_virtual; -{ - int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t); - - /* Fix up variants (if any). */ - tree variants = TYPE_NEXT_VARIANT (t); - while (variants) - { - /* These fields are in the _TYPE part of the node, not in - the TYPE_LANG_SPECIFIC component, so they are not shared. */ - TYPE_HAS_CONSTRUCTOR (variants) = TYPE_HAS_CONSTRUCTOR (t); - TYPE_HAS_DESTRUCTOR (variants) = TYPE_HAS_DESTRUCTOR (t); - TYPE_NEEDS_CONSTRUCTING (variants) = TYPE_NEEDS_CONSTRUCTING (t); - TYPE_NEEDS_DESTRUCTOR (variants) = TYPE_NEEDS_DESTRUCTOR (t); - - TYPE_USES_COMPLEX_INHERITANCE (variants) = TYPE_USES_COMPLEX_INHERITANCE (t); - TYPE_VIRTUAL_P (variants) = TYPE_VIRTUAL_P (t); - TYPE_USES_VIRTUAL_BASECLASSES (variants) = TYPE_USES_VIRTUAL_BASECLASSES (t); - TYPE_USES_PVBASES (variants) = TYPE_USES_PVBASES (t); - /* Copy whatever these are holding today. */ - TYPE_MIN_VALUE (variants) = TYPE_MIN_VALUE (t); - TYPE_MAX_VALUE (variants) = TYPE_MAX_VALUE (t); - TYPE_FIELDS (variants) = TYPE_FIELDS (t); - TYPE_SIZE (variants) = TYPE_SIZE (t); - TYPE_SIZE_UNIT (variants) = TYPE_SIZE_UNIT (t); - variants = TYPE_NEXT_VARIANT (variants); - } - - if (n_baseclasses && max_has_virtual) - { - /* For a class w/o baseclasses, `finish_struct' has set - CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by definition). Similarly - for a class who's base classes do not have vtables. When neither - of these is true, we might have removed abstract virtuals (by - providing a definition), added some (by declaring new ones), or - redeclared ones from a base class. We need to recalculate what's - really an abstract virtual at this point (by looking in the - vtables). */ - CLASSTYPE_ABSTRACT_VIRTUALS (t) = get_abstract_virtuals (t); - } - - if (n_baseclasses) - { - /* Notice whether this class has type conversion functions defined. */ - tree binfo = TYPE_BINFO (t); - tree binfos = BINFO_BASETYPES (binfo); - tree basetype; - - for (i = n_baseclasses-1; i >= 0; i--) - { - basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, i)); - - TYPE_HAS_CONVERSION (t) |= TYPE_HAS_CONVERSION (basetype); - } - } - - /* If this type has a copy constructor, force its mode to be BLKmode, and - force its TREE_ADDRESSABLE bit to be nonzero. This will cause it to - be passed by invisible reference and prevent it from being returned in - a register. - - Also do this if the class has BLKmode but can still be returned in - registers, since function_cannot_inline_p won't let us inline - functions returning such a type. This affects the HP-PA. */ - if (! TYPE_HAS_TRIVIAL_INIT_REF (t) - || (TYPE_MODE (t) == BLKmode && ! aggregate_value_p (t) - && CLASSTYPE_NON_AGGREGATE (t))) - { - tree variants; - DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode; - for (variants = t; variants; variants = TYPE_NEXT_VARIANT (variants)) - { - TYPE_MODE (variants) = BLKmode; - TREE_ADDRESSABLE (variants) = 1; - } - } -} - -/* Issue warnings about T having private constructors, but no friends, - and so forth. - - HAS_NONPRIVATE_METHOD is nonzero if T has any non-private methods or - static members. HAS_NONPRIVATE_STATIC_FN is nonzero if T has any - non-private static member functions. */ - -static void -maybe_warn_about_overly_private_class (t) - tree t; -{ - int has_member_fn = 0; - int has_nonprivate_method = 0; - tree fn; - - if (!warn_ctor_dtor_privacy - /* If the class has friends, those entities might create and - access instances, so we should not warn. */ - || (CLASSTYPE_FRIEND_CLASSES (t) - || DECL_FRIENDLIST (TYPE_MAIN_DECL (t))) - /* We will have warned when the template was declared; there's - no need to warn on every instantiation. */ - || CLASSTYPE_TEMPLATE_INSTANTIATION (t)) - /* There's no reason to even consider warning about this - class. */ - return; - - /* We only issue one warning, if more than one applies, because - otherwise, on code like: - - class A { - // Oops - forgot `public:' - A(); - A(const A&); - ~A(); - }; - - we warn several times about essentially the same problem. */ - - /* Check to see if all (non-constructor, non-destructor) member - functions are private. (Since there are no friends or - non-private statics, we can't ever call any of the private member - functions.) */ - for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn)) - /* We're not interested in compiler-generated methods; they don't - provide any way to call private members. */ - if (!DECL_ARTIFICIAL (fn)) - { - if (!TREE_PRIVATE (fn)) - { - if (DECL_STATIC_FUNCTION_P (fn)) - /* A non-private static member function is just like a - friend; it can create and invoke private member - functions, and be accessed without a class - instance. */ - return; - - has_nonprivate_method = 1; - break; - } - else if (!DECL_CONSTRUCTOR_P (fn) && !DECL_DESTRUCTOR_P (fn)) - has_member_fn = 1; - } - - if (!has_nonprivate_method && has_member_fn) - { - /* There are no non-private methods, and there's at least one - private member function that isn't a constructor or - destructor. (If all the private members are - constructors/destructors we want to use the code below that - issues error messages specifically referring to - constructors/destructors.) */ - int i; - tree binfos = BINFO_BASETYPES (TYPE_BINFO (t)); - for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); i++) - if (TREE_VIA_PUBLIC (TREE_VEC_ELT (binfos, i)) - || TREE_VIA_PROTECTED (TREE_VEC_ELT (binfos, i))) - { - has_nonprivate_method = 1; - break; - } - if (!has_nonprivate_method) - { - cp_warning ("all member functions in class `%T' are private", t); - return; - } - } - - /* Even if some of the member functions are non-private, the class - won't be useful for much if all the constructors or destructors - are private: such an object can never be created or destroyed. */ - if (TYPE_HAS_DESTRUCTOR (t)) - { - tree dtor = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 1); - - if (TREE_PRIVATE (dtor)) - { - cp_warning ("`%#T' only defines a private destructor and has no friends", - t); - return; - } - } - - if (TYPE_HAS_CONSTRUCTOR (t)) - { - int nonprivate_ctor = 0; - - /* If a non-template class does not define a copy - constructor, one is defined for it, enabling it to avoid - this warning. For a template class, this does not - happen, and so we would normally get a warning on: - - template class C { private: C(); }; - - To avoid this asymmetry, we check TYPE_HAS_INIT_REF. All - complete non-template or fully instantiated classes have this - flag set. */ - if (!TYPE_HAS_INIT_REF (t)) - nonprivate_ctor = 1; - else - for (fn = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 0); - fn; - fn = OVL_NEXT (fn)) - { - tree ctor = OVL_CURRENT (fn); - /* Ideally, we wouldn't count copy constructors (or, in - fact, any constructor that takes an argument of the - class type as a parameter) because such things cannot - be used to construct an instance of the class unless - you already have one. But, for now at least, we're - more generous. */ - if (! TREE_PRIVATE (ctor)) - { - nonprivate_ctor = 1; - break; - } - } - - if (nonprivate_ctor == 0) - { - cp_warning ("`%#T' only defines private constructors and has no friends", - t); - return; - } - } -} - - -/* Warn about duplicate methods in fn_fields. Also compact method - lists so that lookup can be made faster. - - Data Structure: List of method lists. The outer list is a - TREE_LIST, whose TREE_PURPOSE field is the field name and the - TREE_VALUE is the DECL_CHAIN of the FUNCTION_DECLs. TREE_CHAIN - links the entire list of methods for TYPE_METHODS. Friends are - chained in the same way as member functions (? TREE_CHAIN or - DECL_CHAIN), but they live in the TREE_TYPE field of the outer - list. That allows them to be quickly deleted, and requires no - extra storage. - - If there are any constructors/destructors, they are moved to the - front of the list. This makes pushclass more efficient. - - We also link each field which has shares a name with its baseclass - to the head of the list of fields for that base class. This allows - us to reduce search time in places like `build_method_call' to - consider only reasonably likely functions. */ - -static void -finish_struct_methods (t) - tree t; -{ - tree fn_fields; - tree method_vec = CLASSTYPE_METHOD_VEC (t); - tree ctor_name = constructor_name (t); - - /* First fill in entry 0 with the constructors, entry 1 with destructors, - and the next few with type conversion operators (if any). */ - for (fn_fields = TYPE_METHODS (t); fn_fields; - fn_fields = TREE_CHAIN (fn_fields)) - { - tree fn_name = DECL_NAME (fn_fields); - - /* Clear out this flag. - - @@ Doug may figure out how to break - @@ this with nested classes and friends. */ - DECL_IN_AGGR_P (fn_fields) = 0; - - /* Note here that a copy ctor is private, so we don't dare generate - a default copy constructor for a class that has a member - of this type without making sure they have access to it. */ - if (fn_name == ctor_name) - { - tree parmtypes = FUNCTION_ARG_CHAIN (fn_fields); - tree parmtype = parmtypes ? TREE_VALUE (parmtypes) : void_type_node; - - if (TREE_CODE (parmtype) == REFERENCE_TYPE - && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == t) - { - if (TREE_CHAIN (parmtypes) == NULL_TREE - || TREE_CHAIN (parmtypes) == void_list_node - || TREE_PURPOSE (TREE_CHAIN (parmtypes))) - { - if (TREE_PROTECTED (fn_fields)) - TYPE_HAS_NONPUBLIC_CTOR (t) = 1; - else if (TREE_PRIVATE (fn_fields)) - TYPE_HAS_NONPUBLIC_CTOR (t) = 2; - } - } - } - else if (fn_name == ansi_opname[(int) MODIFY_EXPR]) - { - tree parmtype = TREE_VALUE (FUNCTION_ARG_CHAIN (fn_fields)); - - if (copy_assignment_arg_p (parmtype, DECL_VIRTUAL_P (fn_fields))) - { - if (TREE_PROTECTED (fn_fields)) - TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 1; - else if (TREE_PRIVATE (fn_fields)) - TYPE_HAS_NONPUBLIC_ASSIGN_REF (t) = 2; - } - } - } - - if (TYPE_HAS_DESTRUCTOR (t) && !TREE_VEC_ELT (method_vec, 1)) - /* We thought there was a destructor, but there wasn't. Some - parse errors cause this anomalous situation. */ - TYPE_HAS_DESTRUCTOR (t) = 0; - - /* Issue warnings about private constructors and such. If there are - no methods, then some public defaults are generated. */ - maybe_warn_about_overly_private_class (t); -} - -/* Emit error when a duplicate definition of a type is seen. Patch up. */ - -void -duplicate_tag_error (t) - tree t; -{ - cp_error ("redefinition of `%#T'", t); - cp_error_at ("previous definition here", t); - - /* Pretend we haven't defined this type. */ - - /* All of the component_decl's were TREE_CHAINed together in the parser. - finish_struct_methods walks these chains and assembles all methods with - the same base name into DECL_CHAINs. Now we don't need the parser chains - anymore, so we unravel them. */ - - /* This used to be in finish_struct, but it turns out that the - TREE_CHAIN is used by dbxout_type_methods and perhaps some other - things... */ - if (CLASSTYPE_METHOD_VEC (t)) - { - tree method_vec = CLASSTYPE_METHOD_VEC (t); - int i, len = TREE_VEC_LENGTH (method_vec); - for (i = 0; i < len; i++) - { - tree unchain = TREE_VEC_ELT (method_vec, i); - while (unchain != NULL_TREE) - { - TREE_CHAIN (OVL_CURRENT (unchain)) = NULL_TREE; - unchain = OVL_NEXT (unchain); - } - } - } - - if (TYPE_LANG_SPECIFIC (t)) - { - tree binfo = TYPE_BINFO (t); - int interface_only = CLASSTYPE_INTERFACE_ONLY (t); - int interface_unknown = CLASSTYPE_INTERFACE_UNKNOWN (t); - - bzero ((char *) TYPE_LANG_SPECIFIC (t), sizeof (struct lang_type)); - BINFO_BASETYPES(binfo) = NULL_TREE; - - TYPE_BINFO (t) = binfo; - CLASSTYPE_INTERFACE_ONLY (t) = interface_only; - SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown); - TYPE_REDEFINED (t) = 1; - } - TYPE_SIZE (t) = NULL_TREE; - TYPE_MODE (t) = VOIDmode; - TYPE_FIELDS (t) = NULL_TREE; - TYPE_METHODS (t) = NULL_TREE; - TYPE_VFIELD (t) = NULL_TREE; - TYPE_CONTEXT (t) = NULL_TREE; -} - -/* finish up all new vtables. */ - -static void -finish_vtbls (binfo, do_self, t) - tree binfo; - int do_self; - tree t; -{ - tree binfos = BINFO_BASETYPES (binfo); - int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - /* Should we use something besides CLASSTYPE_VFIELDS? */ - if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) - { - if (BINFO_NEW_VTABLE_MARKED (binfo)) - { - tree decl, context; - - decl = BINFO_VTABLE (binfo); - context = DECL_CONTEXT (decl); - DECL_CONTEXT (decl) = 0; - if (DECL_INITIAL (decl) != BINFO_VIRTUALS (binfo)) - DECL_INITIAL (decl) = build_nt (CONSTRUCTOR, NULL_TREE, - BINFO_VIRTUALS (binfo)); - cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0, 0); - DECL_CONTEXT (decl) = context; - } - CLEAR_BINFO_NEW_VTABLE_MARKED (binfo); - } - - for (i = 0; i < n_baselinks; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - int is_not_base_vtable - = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo)); - if (TREE_VIA_VIRTUAL (base_binfo)) - { - base_binfo = binfo_member (BINFO_TYPE (base_binfo), CLASSTYPE_VBASECLASSES (t)); - } - finish_vtbls (base_binfo, is_not_base_vtable, t); - } -} - -/* True if we should override the given BASE_FNDECL with the given - FNDECL. */ - -static int -overrides (fndecl, base_fndecl) - tree fndecl, base_fndecl; -{ - /* Destructors have special names. */ - if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (base_fndecl)) - && DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl))) - return 1; - if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (base_fndecl)) - || DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl))) - return 0; - if (DECL_NAME (fndecl) == DECL_NAME (base_fndecl)) - { - tree types, base_types; -#if 0 - retypes = TREE_TYPE (TREE_TYPE (fndecl)); - base_retypes = TREE_TYPE (TREE_TYPE (base_fndecl)); -#endif - types = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); - base_types = TYPE_ARG_TYPES (TREE_TYPE (base_fndecl)); - if ((TYPE_QUALS (TREE_TYPE (TREE_VALUE (base_types))) - == TYPE_QUALS (TREE_TYPE (TREE_VALUE (types)))) - && compparms (TREE_CHAIN (base_types), TREE_CHAIN (types))) - return 1; - } - return 0; -} - -static tree -get_class_offset_1 (parent, binfo, context, t, fndecl) - tree parent, binfo, context, t, fndecl; -{ - tree binfos = BINFO_BASETYPES (binfo); - int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; - tree rval = NULL_TREE; - - if (binfo == parent) - return error_mark_node; - - for (i = 0; i < n_baselinks; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - tree nrval; - - if (TREE_VIA_VIRTUAL (base_binfo)) - base_binfo = binfo_member (BINFO_TYPE (base_binfo), - CLASSTYPE_VBASECLASSES (t)); - nrval = get_class_offset_1 (parent, base_binfo, context, t, fndecl); - /* See if we have a new value */ - if (nrval && (nrval != error_mark_node || rval==0)) - { - /* Only compare if we have two offsets */ - if (rval && rval != error_mark_node - && ! tree_int_cst_equal (nrval, rval)) - { - /* Only give error if the two offsets are different */ - error ("every virtual function must have a unique final overrider"); - cp_error (" found two (or more) `%T' class subobjects in `%T'", context, t); - cp_error (" with virtual `%D' from virtual base class", fndecl); - return rval; - } - rval = nrval; - } - - if (rval && BINFO_TYPE (binfo) == context) - { - my_friendly_assert (rval == error_mark_node - || tree_int_cst_equal (rval, BINFO_OFFSET (binfo)), 999); - rval = BINFO_OFFSET (binfo); - } - } - return rval; -} - -/* Get the offset to the CONTEXT subobject that is related to the - given BINFO. */ - -static tree -get_class_offset (context, t, binfo, fndecl) - tree context, t, binfo, fndecl; -{ - tree first_binfo = binfo; - tree offset; - int i; - - if (context == t) - return integer_zero_node; - - if (BINFO_TYPE (binfo) == context) - return BINFO_OFFSET (binfo); - - /* Check less derived binfos first. */ - while (BINFO_BASETYPES (binfo) - && (i=CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo))) != -1) - { - tree binfos = BINFO_BASETYPES (binfo); - binfo = TREE_VEC_ELT (binfos, i); - if (BINFO_TYPE (binfo) == context) - return BINFO_OFFSET (binfo); - } - - /* Ok, not found in the less derived binfos, now check the more - derived binfos. */ - offset = get_class_offset_1 (first_binfo, TYPE_BINFO (t), context, t, fndecl); - if (offset==0 || TREE_CODE (offset) != INTEGER_CST) - my_friendly_abort (999); /* we have to find it. */ - return offset; -} - -/* Skip RTTI information at the front of the virtual list. */ - -unsigned HOST_WIDE_INT -skip_rtti_stuff (virtuals, t) - tree *virtuals, t; -{ - int n; - - if (CLASSTYPE_COM_INTERFACE (t)) - return 0; - - n = 0; - if (*virtuals) - { - /* We always reserve a slot for the offset/tdesc entry. */ - ++n; - *virtuals = TREE_CHAIN (*virtuals); - } - if (flag_vtable_thunks && *virtuals) - { - /* The second slot is reserved for the tdesc pointer when thunks - are used. */ - ++n; - *virtuals = TREE_CHAIN (*virtuals); - } - return n; -} - -static void -modify_one_vtable (binfo, t, fndecl, pfn) - tree binfo, t, fndecl, pfn; -{ - tree virtuals = BINFO_VIRTUALS (binfo); - unsigned HOST_WIDE_INT n; - - /* update rtti entry */ - if (flag_rtti) - { - if (binfo == TYPE_BINFO (t)) - { - if (! BINFO_NEW_VTABLE_MARKED (binfo)) - build_vtable (TYPE_BINFO (DECL_CONTEXT (CLASSTYPE_VFIELD (t))), t); - } - else - { - if (! BINFO_NEW_VTABLE_MARKED (binfo)) - prepare_fresh_vtable (binfo, t); - } - } - if (fndecl == NULL_TREE) - return; - - n = skip_rtti_stuff (&virtuals, t); - - while (virtuals) - { - tree current_fndecl = TREE_VALUE (virtuals); - current_fndecl = FNADDR_FROM_VTABLE_ENTRY (current_fndecl); - current_fndecl = TREE_OPERAND (current_fndecl, 0); - if (current_fndecl && overrides (fndecl, current_fndecl)) - { - tree base_offset, offset; - tree context = DECL_CLASS_CONTEXT (fndecl); - tree vfield = CLASSTYPE_VFIELD (t); - tree this_offset; - - offset = get_class_offset (context, t, binfo, fndecl); - - /* Find the right offset for the this pointer based on the - base class we just found. We have to take into - consideration the virtual base class pointers that we - stick in before the virtual function table pointer. - - Also, we want just the delta between the most base class - that we derived this vfield from and us. */ - base_offset = size_binop (PLUS_EXPR, - get_derived_offset (binfo, DECL_CONTEXT (current_fndecl)), - BINFO_OFFSET (binfo)); - this_offset = ssize_binop (MINUS_EXPR, offset, base_offset); - - if (binfo == TYPE_BINFO (t)) - { - /* In this case, it is *type*'s vtable we are modifying. - We start with the approximation that it's vtable is that - of the immediate base class. */ - if (! BINFO_NEW_VTABLE_MARKED (binfo)) - build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t); - } - else - { - /* This is our very own copy of `basetype' to play with. - Later, we will fill in all the virtual functions - that override the virtual functions in these base classes - which are not defined by the current type. */ - if (! BINFO_NEW_VTABLE_MARKED (binfo)) - prepare_fresh_vtable (binfo, t); - } - -#ifdef NOTQUITE - cp_warning ("in %D", DECL_NAME (BINFO_VTABLE (binfo))); -#endif - modify_vtable_entry (get_vtable_entry_n (BINFO_VIRTUALS (binfo), n), - build_vtable_entry (this_offset, pfn), - fndecl); - } - ++n; - virtuals = TREE_CHAIN (virtuals); - } -} - -/* These are the ones that are not through virtual base classes. */ - -static void -modify_all_direct_vtables (binfo, do_self, t, fndecl, pfn) - tree binfo; - int do_self; - tree t, fndecl, pfn; -{ - tree binfos = BINFO_BASETYPES (binfo); - int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - /* Should we use something besides CLASSTYPE_VFIELDS? */ - if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) - { - modify_one_vtable (binfo, t, fndecl, pfn); - } - - for (i = 0; i < n_baselinks; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - int is_not_base_vtable - = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo)); - if (! TREE_VIA_VIRTUAL (base_binfo)) - modify_all_direct_vtables (base_binfo, is_not_base_vtable, t, fndecl, pfn); - } -} - -/* Fixup all the delta entries in this one vtable that need updating. */ - -static void -fixup_vtable_deltas1 (binfo, t) - tree binfo, t; -{ - tree virtuals = BINFO_VIRTUALS (binfo); - unsigned HOST_WIDE_INT n; - - n = skip_rtti_stuff (&virtuals, t); - - while (virtuals) - { - tree fndecl = TREE_VALUE (virtuals); - tree pfn = FNADDR_FROM_VTABLE_ENTRY (fndecl); - tree delta = DELTA_FROM_VTABLE_ENTRY (fndecl); - fndecl = TREE_OPERAND (pfn, 0); - if (fndecl) - { - tree base_offset, offset; - tree context = DECL_CLASS_CONTEXT (fndecl); - tree vfield = CLASSTYPE_VFIELD (t); - tree this_offset; - - offset = get_class_offset (context, t, binfo, fndecl); - - /* Find the right offset for the this pointer based on the - base class we just found. We have to take into - consideration the virtual base class pointers that we - stick in before the virtual function table pointer. - - Also, we want just the delta between the most base class - that we derived this vfield from and us. */ - base_offset = size_binop (PLUS_EXPR, - get_derived_offset (binfo, - DECL_CONTEXT (fndecl)), - BINFO_OFFSET (binfo)); - this_offset = ssize_binop (MINUS_EXPR, offset, base_offset); - - if (! tree_int_cst_equal (this_offset, delta)) - { - /* Make sure we can modify the derived association with immunity. */ - if (binfo == TYPE_BINFO (t)) - { - /* In this case, it is *type*'s vtable we are modifying. - We start with the approximation that it's vtable is that - of the immediate base class. */ - if (! BINFO_NEW_VTABLE_MARKED (binfo)) - build_vtable (TYPE_BINFO (DECL_CONTEXT (vfield)), t); - } - else - { - /* This is our very own copy of `basetype' to play with. - Later, we will fill in all the virtual functions - that override the virtual functions in these base classes - which are not defined by the current type. */ - if (! BINFO_NEW_VTABLE_MARKED (binfo)) - prepare_fresh_vtable (binfo, t); - } - - modify_vtable_entry (get_vtable_entry_n (BINFO_VIRTUALS (binfo), n), - build_vtable_entry (this_offset, pfn), - fndecl); - } - } - ++n; - virtuals = TREE_CHAIN (virtuals); - } -} - -/* Fixup all the delta entries in all the direct vtables that need updating. - This happens when we have non-overridden virtual functions from a - virtual base class, that are at a different offset, in the new - hierarchy, because the layout of the virtual bases has changed. */ - -static void -fixup_vtable_deltas (binfo, init_self, t) - tree binfo; - int init_self; - tree t; -{ - tree binfos = BINFO_BASETYPES (binfo); - int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - for (i = 0; i < n_baselinks; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - int is_not_base_vtable - = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo)); - if (! TREE_VIA_VIRTUAL (base_binfo)) - fixup_vtable_deltas (base_binfo, is_not_base_vtable, t); - } - /* Should we use something besides CLASSTYPE_VFIELDS? */ - if (init_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) - { - fixup_vtable_deltas1 (binfo, t); - } -} - -/* These are the ones that are through virtual base classes. */ - -static void -modify_all_indirect_vtables (binfo, do_self, via_virtual, t, fndecl, pfn) - tree binfo; - int do_self, via_virtual; - tree t, fndecl, pfn; -{ - tree binfos = BINFO_BASETYPES (binfo); - int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - /* Should we use something besides CLASSTYPE_VFIELDS? */ - if (do_self && via_virtual && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) - { - modify_one_vtable (binfo, t, fndecl, pfn); - } - - for (i = 0; i < n_baselinks; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - int is_not_base_vtable - = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo)); - if (TREE_VIA_VIRTUAL (base_binfo)) - { - via_virtual = 1; - base_binfo = binfo_member (BINFO_TYPE (base_binfo), CLASSTYPE_VBASECLASSES (t)); - } - modify_all_indirect_vtables (base_binfo, is_not_base_vtable, via_virtual, t, fndecl, pfn); - } -} - -static void -modify_all_vtables (t, fndecl, vfn) - tree t, fndecl, vfn; -{ - /* Do these first, so that we will make use of any non-virtual class's - vtable, over a virtual classes vtable. */ - modify_all_direct_vtables (TYPE_BINFO (t), 1, t, fndecl, vfn); - if (TYPE_USES_VIRTUAL_BASECLASSES (t)) - modify_all_indirect_vtables (TYPE_BINFO (t), 1, 0, t, fndecl, vfn); -} - -/* Here, we already know that they match in every respect. - All we have to check is where they had their declarations. */ - -static int -strictly_overrides (fndecl1, fndecl2) - tree fndecl1, fndecl2; -{ - int distance = get_base_distance (DECL_CLASS_CONTEXT (fndecl2), - DECL_CLASS_CONTEXT (fndecl1), - 0, (tree *)0); - if (distance == -2 || distance > 0) - return 1; - return 0; -} - -/* Merge overrides for one vtable. - If we want to merge in same function, we are fine. - else - if one has a DECL_CLASS_CONTEXT that is a parent of the - other, than choose the more derived one - else - potentially ill-formed (see 10.3 [class.virtual]) - we have to check later to see if there was an - override in this class. If there was ok, if not - then it is ill-formed. (mrs) - - We take special care to reuse a vtable, if we can. */ - -static void -override_one_vtable (binfo, old, t) - tree binfo, old, t; -{ - tree virtuals = BINFO_VIRTUALS (binfo); - tree old_virtuals = BINFO_VIRTUALS (old); - enum { REUSE_NEW, REUSE_OLD, UNDECIDED, NEITHER } choose = UNDECIDED; - - /* If we have already committed to modifying it, then don't try and - reuse another vtable. */ - if (BINFO_NEW_VTABLE_MARKED (binfo)) - choose = NEITHER; - - skip_rtti_stuff (&virtuals, t); - skip_rtti_stuff (&old_virtuals, t); - - while (virtuals) - { - tree fndecl = TREE_VALUE (virtuals); - tree old_fndecl = TREE_VALUE (old_virtuals); - fndecl = FNADDR_FROM_VTABLE_ENTRY (fndecl); - old_fndecl = FNADDR_FROM_VTABLE_ENTRY (old_fndecl); - fndecl = TREE_OPERAND (fndecl, 0); - old_fndecl = TREE_OPERAND (old_fndecl, 0); - /* First check to see if they are the same. */ - if (DECL_ASSEMBLER_NAME (fndecl) == DECL_ASSEMBLER_NAME (old_fndecl)) - { - /* No need to do anything. */ - } - else if (strictly_overrides (fndecl, old_fndecl)) - { - if (choose == UNDECIDED) - choose = REUSE_NEW; - else if (choose == REUSE_OLD) - { - choose = NEITHER; - if (! BINFO_NEW_VTABLE_MARKED (binfo)) - { - prepare_fresh_vtable (binfo, t); - override_one_vtable (binfo, old, t); - return; - } - } - } - else if (strictly_overrides (old_fndecl, fndecl)) - { - if (choose == UNDECIDED) - choose = REUSE_OLD; - else if (choose == REUSE_NEW) - { - choose = NEITHER; - if (! BINFO_NEW_VTABLE_MARKED (binfo)) - { - prepare_fresh_vtable (binfo, t); - override_one_vtable (binfo, old, t); - return; - } - TREE_VALUE (virtuals) = TREE_VALUE (old_virtuals); - } - else if (choose == NEITHER) - { - TREE_VALUE (virtuals) = TREE_VALUE (old_virtuals); - } - } - else - { - choose = NEITHER; - if (! BINFO_NEW_VTABLE_MARKED (binfo)) - { - prepare_fresh_vtable (binfo, t); - override_one_vtable (binfo, old, t); - return; - } - { - /* This MUST be overridden, or the class is ill-formed. */ - tree fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0); - tree vfn; - - fndecl = copy_node (fndecl); - copy_lang_decl (fndecl); - DECL_NEEDS_FINAL_OVERRIDER_P (fndecl) = 1; - /* Make sure we search for it later. */ - if (! CLASSTYPE_ABSTRACT_VIRTUALS (t)) - CLASSTYPE_ABSTRACT_VIRTUALS (t) = error_mark_node; - - vfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fndecl); - TREE_CONSTANT (vfn) = 1; - - /* We can use integer_zero_node, as we will core dump - if this is used anyway. */ - TREE_VALUE (virtuals) = build_vtable_entry (integer_zero_node, vfn); - } - } - virtuals = TREE_CHAIN (virtuals); - old_virtuals = TREE_CHAIN (old_virtuals); - } - - /* Let's reuse the old vtable. */ - if (choose == REUSE_OLD) - { - BINFO_VTABLE (binfo) = BINFO_VTABLE (old); - BINFO_VIRTUALS (binfo) = BINFO_VIRTUALS (old); - } -} - -/* Merge in overrides for virtual bases. - BINFO is the hierarchy we want to modify, and OLD has the potential - overrides. */ - -static void -merge_overrides (binfo, old, do_self, t) - tree binfo, old; - int do_self; - tree t; -{ - tree binfos = BINFO_BASETYPES (binfo); - tree old_binfos = BINFO_BASETYPES (old); - int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - /* Should we use something besides CLASSTYPE_VFIELDS? */ - if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) - { - override_one_vtable (binfo, old, t); - } - - for (i = 0; i < n_baselinks; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - tree old_base_binfo = TREE_VEC_ELT (old_binfos, i); - int is_not_base_vtable - = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo)); - if (! TREE_VIA_VIRTUAL (base_binfo)) - merge_overrides (base_binfo, old_base_binfo, is_not_base_vtable, t); - } -} - -/* Get the base virtual function declarations in T that are either - overridden or hidden by FNDECL as a list. We set TREE_PURPOSE with - the overrider/hider. */ - -static tree -get_basefndecls (fndecl, t) - tree fndecl, t; -{ - tree methods = TYPE_METHODS (t); - tree base_fndecls = NULL_TREE; - tree binfos = BINFO_BASETYPES (TYPE_BINFO (t)); - int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - while (methods) - { - if (TREE_CODE (methods) == FUNCTION_DECL - && DECL_VINDEX (methods) != NULL_TREE - && DECL_NAME (fndecl) == DECL_NAME (methods)) - base_fndecls = temp_tree_cons (fndecl, methods, base_fndecls); - - methods = TREE_CHAIN (methods); - } - - if (base_fndecls) - return base_fndecls; - - for (i = 0; i < n_baseclasses; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - tree basetype = BINFO_TYPE (base_binfo); - - base_fndecls = chainon (get_basefndecls (fndecl, basetype), - base_fndecls); - } - - return base_fndecls; -} - -/* Mark the functions that have been hidden with their overriders. - Since we start out with all functions already marked with a hider, - no need to mark functions that are just hidden. - - Subroutine of warn_hidden. */ - -static void -mark_overriders (fndecl, base_fndecls) - tree fndecl, base_fndecls; -{ - for (; base_fndecls; base_fndecls = TREE_CHAIN (base_fndecls)) - { - if (overrides (fndecl, TREE_VALUE (base_fndecls))) - TREE_PURPOSE (base_fndecls) = fndecl; - } -} - -/* If this declaration supersedes the declaration of - a method declared virtual in the base class, then - mark this field as being virtual as well. */ - -static void -check_for_override (decl, ctype) - tree decl, ctype; -{ - tree binfos = BINFO_BASETYPES (TYPE_BINFO (ctype)); - int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; - int virtualp = DECL_VIRTUAL_P (decl); - int found_overriden_fn = 0; - - for (i = 0; i < n_baselinks; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - if (TYPE_VIRTUAL_P (BINFO_TYPE (base_binfo))) - { - tree tmp = get_matching_virtual - (base_binfo, decl, - DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl))); - - if (tmp && !found_overriden_fn) - { - /* If this function overrides some virtual in some base - class, then the function itself is also necessarily - virtual, even if the user didn't explicitly say so. */ - DECL_VIRTUAL_P (decl) = 1; - - /* The TMP we really want is the one from the deepest - baseclass on this path, taking care not to - duplicate if we have already found it (via another - path to its virtual baseclass. */ - if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE) - { - cp_error_at ("method `%D' may not be declared static", - decl); - cp_error_at ("(since `%D' declared virtual in base class.)", - tmp); - break; - } - virtualp = 1; - - DECL_VINDEX (decl) - = tree_cons (NULL_TREE, tmp, DECL_VINDEX (decl)); - - /* We now know that DECL overrides something, - which is all that is important. But, we must - continue to iterate through all the base-classes - in order to allow get_matching_virtual to check for - various illegal overrides. */ - found_overriden_fn = 1; - } - } - } - if (virtualp) - { - if (DECL_VINDEX (decl) == NULL_TREE) - DECL_VINDEX (decl) = error_mark_node; - IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)) = 1; - } -} - -/* Warn about hidden virtual functions that are not overridden in t. - We know that constructors and destructors don't apply. */ - -void -warn_hidden (t) - tree t; -{ - tree method_vec = CLASSTYPE_METHOD_VEC (t); - int n_methods = method_vec ? TREE_VEC_LENGTH (method_vec) : 0; - int i; - - /* We go through each separately named virtual function. */ - for (i = 2; i < n_methods && TREE_VEC_ELT (method_vec, i); ++i) - { - tree fns = TREE_VEC_ELT (method_vec, i); - tree fndecl; - - tree base_fndecls = NULL_TREE; - tree binfos = BINFO_BASETYPES (TYPE_BINFO (t)); - int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - /* First see if we have any virtual functions in this batch. */ - for (; fns; fns = OVL_NEXT (fns)) - { - fndecl = OVL_CURRENT (fns); - if (DECL_VINDEX (fndecl)) - break; - } - - if (fns == NULL_TREE) - continue; - - /* First we get a list of all possible functions that might be - hidden from each base class. */ - for (i = 0; i < n_baseclasses; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - tree basetype = BINFO_TYPE (base_binfo); - - base_fndecls = chainon (get_basefndecls (fndecl, basetype), - base_fndecls); - } - - fns = OVL_NEXT (fns); - - /* ...then mark up all the base functions with overriders, preferring - overriders to hiders. */ - if (base_fndecls) - for (; fns; fns = OVL_NEXT (fns)) - { - fndecl = OVL_CURRENT (fns); - if (DECL_VINDEX (fndecl)) - mark_overriders (fndecl, base_fndecls); - } - - /* Now give a warning for all base functions without overriders, - as they are hidden. */ - for (; base_fndecls; base_fndecls = TREE_CHAIN (base_fndecls)) - { - if (! overrides (TREE_PURPOSE (base_fndecls), - TREE_VALUE (base_fndecls))) - { - /* Here we know it is a hider, and no overrider exists. */ - cp_warning_at ("`%D' was hidden", TREE_VALUE (base_fndecls)); - cp_warning_at (" by `%D'", TREE_PURPOSE (base_fndecls)); - } - } - } -} - -/* Generate one vtable for use in constructors or destructors of BASE - subobjects of COMPLETE_TYPE objects. The vtable belongs to the - vfield of the VBASEVASE subobject of the VBASE virtual base of - COMPLETE_TYPE (and BASE). */ - -static tree -finish_one_ctor_vtable (complete_type, base, vbase, vbasebase) - tree complete_type, base, vbase, vbasebase; -{ - tree virtuals; - tree newtable; - tree newvirtuals; - tree offset; - tree newvbase = binfo_member (BINFO_TYPE (vbase), - CLASSTYPE_VBASECLASSES (complete_type)); - - newtable = prepare_ctor_vtable (complete_type, base, vbasebase); - newvirtuals = copy_list (BINFO_VIRTUALS (vbasebase)); - - virtuals = newvirtuals; - /* Change the offset entry. First, delta between base an vbase. */ - offset = ssize_binop (MINUS_EXPR, BINFO_OFFSET (newvbase), - BINFO_OFFSET (base)); - /* Add delta between vbase and vbasebase. */ - offset = ssize_binop (PLUS_EXPR, offset, BINFO_OFFSET (vbasebase)); - offset = ssize_binop (MINUS_EXPR, offset, BINFO_OFFSET (vbase)); - /* Finally, negate. */ - offset = ssize_binop (MINUS_EXPR, integer_zero_node, offset); - offset = build1 (NOP_EXPR, vfunc_ptr_type_node, offset); - TREE_CONSTANT (offset) = 1; - TREE_VALUE (virtuals) = build_vtable_entry (integer_zero_node, offset); - virtuals = TREE_CHAIN (virtuals); - - /* Skip the typeinfo function. */ - virtuals = TREE_CHAIN (virtuals); - - /* Iterate over all methods of this virtual base. */ - for (; virtuals; virtuals = TREE_CHAIN (virtuals)) - { - tree fndecl = TREE_VALUE (virtuals); - tree pfn = FNADDR_FROM_VTABLE_ENTRY (fndecl); - fndecl = TREE_OPERAND (pfn, 0); - if (fndecl) - { - tree delta, newdelta, binfo_context; - tree context = DECL_CLASS_CONTEXT (fndecl); - - /* If this method is implemented in a base of the vbase, the - thunk we have is correct. */ - if (DERIVED_FROM_P (context, vbase)) - continue; - - binfo_context = binfo_value (context, base); - if (TREE_VIA_VIRTUAL (binfo_context)) - binfo_context = binfo_member - (context, CLASSTYPE_VBASECLASSES (complete_type)); - /* This is the delta from a complete C to a B subobject, or - more generally to the base subobject that implements the - virtual function for B. BASE already has the offset to - the complete type. */ - delta = BINFO_OFFSET (binfo_context); - /* This is the delta from the A to the complete C. */ - newdelta = BINFO_OFFSET (newvbase); - /* This is the delta from the A to the B subobject. */ - newdelta = size_binop (MINUS_EXPR, newdelta, delta); - newdelta = ssize_binop (MINUS_EXPR, integer_zero_node, - newdelta); - - modify_vtable_entry (virtuals, - build_vtable_entry (newdelta, pfn), - fndecl); - } - } - DECL_INITIAL (newtable) = build_nt (CONSTRUCTOR, NULL_TREE, - newvirtuals); - DECL_CONTEXT (newtable) = NULL_TREE; - cp_finish_decl (newtable, DECL_INITIAL (newtable), NULL_TREE, 0, 0); - DECL_CONTEXT (newtable) = complete_type; - return newtable; -} - -/* Add all vtables into LIST for the VBASEBASE subobject and its bases - of VBASE virtual BASE of COMPLETE_TYPE for use in BASE - constructors. DO_SELF indicates whether this is the VBASEBASE that - has 'primary' vfield. Return the new LIST. */ - -static tree -prepend_ctor_vfields_for_vbase (complete_type, base, vbase, vbasebase, - do_self, list) - tree complete_type, base, vbase, vbasebase; - int do_self; - tree list; -{ - int i; - tree vtbl; - tree bases = BINFO_BASETYPES (vbasebase); - int vfp = CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (vbasebase)); - - if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (vbasebase))) - { - vtbl = finish_one_ctor_vtable (complete_type, base, vbase, vbasebase); - vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, vtbl); - TREE_READONLY (vtbl) = 1; - TREE_CONSTANT (vtbl) = 1; - list = tree_cons (NULL_TREE, vtbl, list); - } - - if (!bases) - return list; - - for (i = 0; i < TREE_VEC_LENGTH (bases); i++) - { - tree vbasebase = TREE_VEC_ELT (bases, i); - if (TREE_VIA_VIRTUAL (vbasebase)) - continue; - list = prepend_ctor_vfields_for_vbase - (complete_type, base, vbase, vbasebase, (i != vfp), list); - } - - return list; -} - -/* Iterate over all virtual bases of the BASE subobject of - COMPLETE_TYPE. This list is given in VBASES. Return the list of - vtables generated in the process. */ - -static tree -finish_ctor_vtables_for_vbases (vbases, base, complete_type) - tree vbases, base, complete_type; -{ - tree result = NULL_TREE; - - for (; vbases; vbases = TREE_CHAIN (vbases)) - result = prepend_ctor_vfields_for_vbase - (complete_type, base, vbases, vbases, 1, result); - return result; -} - -/* Generate special vtables for virtual bases for use inside base - class ctors and dtors. Inside this function, we assume the - following scenario: - class A{virtual void foo();}; - class B:virtual A{int member1;} - class C:B{int member2;} - - BINFO is a base subject (e.g. B) of COMPLETE_TYPE. Returns the list - of virtual tables. */ - -static tree -finish_ctor_vtables_1 (binfo, complete_type) - tree binfo; - tree complete_type; -{ - int i; - tree binfos; - tree result = NULL_TREE; - - binfos = BINFO_BASETYPES (binfo); - if (!binfos) - return result; - - /* Iterate over all bases (i.e. B). */ - for (i = 0; i < TREE_VEC_LENGTH (binfos); i++) - { - tree base = TREE_VEC_ELT (binfos, i); - tree vbases = CLASSTYPE_VBASECLASSES (BINFO_TYPE (base)); - if (!vbases) - /* This base class does not have virtual bases. */ - continue; - if (TREE_VIA_VIRTUAL (base)) - /* A virtual base class is initialized on in the most-derived - constructor. */ - continue; - if (!TYPE_USES_PVBASES (BINFO_TYPE (base))) - /* Class has no polymorphic vbases. */ - continue; - /* Prepend vtable list for base class. */ - result = chainon (finish_ctor_vtables_1 (base, complete_type), - result); - /* Prepend our own vtable list. */ - result = chainon - (finish_ctor_vtables_for_vbases (vbases, base, complete_type), - result); - } - return result; -} - -/* Add the vtables of a virtual base BINFO in front of LIST, returning - the new list. DO_SELF indicates whether we have to return the - vtable of a vfield borrowed in a derived class. */ - -static tree -prepend_vbase_vfields (binfo, do_self, list) - tree binfo; - int do_self; - tree list; -{ - int i; - tree vtbl; - tree bases = BINFO_BASETYPES (binfo); - int vfp = CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (binfo)); - - if (do_self && CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) - { - vtbl = BINFO_VTABLE (binfo); - vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, vtbl); - TREE_READONLY (vtbl) = 1; - TREE_CONSTANT (vtbl) = 1; - list = tree_cons (NULL_TREE, vtbl, list); - } - - if (!bases) - return list; - - for (i = 0; i < TREE_VEC_LENGTH (bases); i++) - { - tree base = TREE_VEC_ELT (bases, i); - if (TREE_VIA_VIRTUAL (base)) - continue; - list = prepend_vbase_vfields (base, (i != vfp), list); - } - - return list; -} - -/* Wrapper around finish_ctor_vtables_1. Compute the vtable list for - type T. */ - -static void -finish_ctor_vtables (t) - tree t; -{ - tree veclist = NULL_TREE; - tree decl, type; - char *name; - tree vbase; - int len; - - /* This is only good for vtable thunks. */ - my_friendly_assert (flag_vtable_thunks, 990307); - - /* Start with the list of most-derived vtables. */ - - for (vbase = CLASSTYPE_VBASECLASSES (t); vbase; - vbase = TREE_CHAIN (vbase)) - veclist = prepend_vbase_vfields (vbase, 1, veclist); - - /* Compute the list of vtables for the bases. */ - veclist = chainon (veclist, finish_ctor_vtables_1 (TYPE_BINFO (t), t)); - - /* Finally, we initialize the virtual bases first. */ - for (vbase = CLASSTYPE_VBASECLASSES (t); vbase; - vbase = TREE_CHAIN (vbase)) - { - tree vbases = CLASSTYPE_VBASECLASSES (BINFO_TYPE (vbase)); - if (!vbases) - continue; - veclist = chainon (veclist, - finish_ctor_vtables_for_vbases (vbases, vbase, t)); - veclist = chainon (veclist, - finish_ctor_vtables_1 (vbase, t)); - } - - veclist = nreverse (veclist); - - /* Generate the name for the vtable list. */ - name = alloca (strlen (VLIST_NAME_FORMAT) - + TYPE_ASSEMBLER_NAME_LENGTH (t) + 2); - sprintf (name, VLIST_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (t)); - - /* Build the type of the list. */ - len = list_length (veclist) - 1; - if (len < 0) - /* If this class has virtual bases without virtual methods, make a - single zero-entry in the array. This avoids zero-sized objects. */ - len++; - type = build_cplus_array_type (vtbl_ptr_type_node, - build_index_type (size_int (len))); - - - /* Produce a new decl holding the list. */ - decl = build_lang_decl (VAR_DECL, get_identifier (name), type); - TREE_STATIC (decl) = 1; - TREE_READONLY (decl) = 1; - decl = pushdecl_top_level (decl); - import_export_vtable (decl, t, 0); - DECL_INITIAL (decl) = build_nt (CONSTRUCTOR, NULL_TREE, veclist); - - DECL_ARTIFICIAL (decl) = 1; - /* This tells finish_file et.al. that this is related to virtual - tables. There is currently no way to distinguish between vtables - and vlists, other than the name of the decl. */ - DECL_VIRTUAL_P (decl) = 1; - - /* Output the array. */ - cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0, 0); - - /* Set the class context after finishing, so that finish thinks this - is an unrelated global, and then finish_vtable_vardecl knows what - class this is related to. */ - DECL_CONTEXT (decl) = t; -} - -/* Check for things that are invalid. There are probably plenty of other - things we should check for also. */ - -static void -finish_struct_anon (t) - tree t; -{ - tree field; - for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field)) - { - if (TREE_STATIC (field)) - continue; - if (TREE_CODE (field) != FIELD_DECL) - continue; - - if (DECL_NAME (field) == NULL_TREE - && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE) - { - tree* uelt = &TYPE_FIELDS (TREE_TYPE (field)); - for (; *uelt; uelt = &TREE_CHAIN (*uelt)) - { - if (DECL_ARTIFICIAL (*uelt)) - continue; - - if (DECL_NAME (*uelt) == constructor_name (t)) - cp_pedwarn_at ("ANSI C++ forbids member `%D' with same name as enclosing class", - *uelt); - - if (TREE_CODE (*uelt) != FIELD_DECL) - { - cp_pedwarn_at ("`%#D' invalid; an anonymous union can only have non-static data members", - *uelt); - continue; - } - - if (TREE_PRIVATE (*uelt)) - cp_pedwarn_at ("private member `%#D' in anonymous union", - *uelt); - else if (TREE_PROTECTED (*uelt)) - cp_pedwarn_at ("protected member `%#D' in anonymous union", - *uelt); - - TREE_PRIVATE (*uelt) = TREE_PRIVATE (field); - TREE_PROTECTED (*uelt) = TREE_PROTECTED (field); - } - } - } -} - -extern int interface_only, interface_unknown; - -/* Create default constructors, assignment operators, and so forth for - the type indicated by T, if they are needed. - CANT_HAVE_DEFAULT_CTOR, CANT_HAVE_CONST_CTOR, and - CANT_HAVE_ASSIGNMENT are nonzero if, for whatever reason, the class - cannot have a default constructor, copy constructor taking a const - reference argument, or an assignment operator, respectively. If a - virtual destructor is created, its DECL is returned; otherwise the - return value is NULL_TREE. */ - -static tree -add_implicitly_declared_members (t, cant_have_default_ctor, - cant_have_const_cctor, - cant_have_assignment) - tree t; - int cant_have_default_ctor; - int cant_have_const_cctor; - int cant_have_assignment; -{ - tree default_fn; - tree implicit_fns = NULL_TREE; - tree name = TYPE_IDENTIFIER (t); - tree virtual_dtor = NULL_TREE; - tree *f; - - /* Destructor. */ - if (TYPE_NEEDS_DESTRUCTOR (t) && !TYPE_HAS_DESTRUCTOR (t) - && !IS_SIGNATURE (t)) - { - default_fn = cons_up_default_function (t, name, 0); - check_for_override (default_fn, t); - - /* If we couldn't make it work, then pretend we didn't need it. */ - if (default_fn == void_type_node) - TYPE_NEEDS_DESTRUCTOR (t) = 0; - else - { - TREE_CHAIN (default_fn) = implicit_fns; - implicit_fns = default_fn; - - if (DECL_VINDEX (default_fn)) - virtual_dtor = default_fn; - } - } - TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_HAS_DESTRUCTOR (t); - - /* Default constructor. */ - if (! TYPE_HAS_CONSTRUCTOR (t) && ! cant_have_default_ctor - && ! IS_SIGNATURE (t)) - { - default_fn = cons_up_default_function (t, name, 2); - TREE_CHAIN (default_fn) = implicit_fns; - implicit_fns = default_fn; - } - - /* Copy constructor. */ - if (! TYPE_HAS_INIT_REF (t) && ! IS_SIGNATURE (t) && ! TYPE_FOR_JAVA (t)) - { - /* ARM 12.18: You get either X(X&) or X(const X&), but - not both. --Chip */ - default_fn = cons_up_default_function (t, name, - 3 + cant_have_const_cctor); - TREE_CHAIN (default_fn) = implicit_fns; - implicit_fns = default_fn; - } - - /* Assignment operator. */ - if (! TYPE_HAS_ASSIGN_REF (t) && ! IS_SIGNATURE (t) && ! TYPE_FOR_JAVA (t)) - { - default_fn = cons_up_default_function (t, name, - 5 + cant_have_assignment); - TREE_CHAIN (default_fn) = implicit_fns; - implicit_fns = default_fn; - } - - /* Now, hook all of the new functions on to TYPE_METHODS, - and add them to the CLASSTYPE_METHOD_VEC. */ - for (f = &implicit_fns; *f; f = &TREE_CHAIN (*f)) - add_method (t, 0, *f); - *f = TYPE_METHODS (t); - TYPE_METHODS (t) = implicit_fns; - - return virtual_dtor; -} - -/* Create a RECORD_TYPE or UNION_TYPE node for a C struct or union declaration - (or C++ class declaration). - - For C++, we must handle the building of derived classes. - Also, C++ allows static class members. The way that this is - handled is to keep the field name where it is (as the DECL_NAME - of the field), and place the overloaded decl in the DECL_FIELD_BITPOS - of the field. layout_record and layout_union will know about this. - - More C++ hair: inline functions have text in their - DECL_PENDING_INLINE_INFO nodes which must somehow be parsed into - meaningful tree structure. After the struct has been laid out, set - things up so that this can happen. - - And still more: virtual functions. In the case of single inheritance, - when a new virtual function is seen which redefines a virtual function - from the base class, the new virtual function is placed into - the virtual function table at exactly the same address that - it had in the base class. When this is extended to multiple - inheritance, the same thing happens, except that multiple virtual - function tables must be maintained. The first virtual function - table is treated in exactly the same way as in the case of single - inheritance. Additional virtual function tables have different - DELTAs, which tell how to adjust `this' to point to the right thing. - - ATTRIBUTES is the set of decl attributes to be applied, if any. */ - -void -finish_struct_1 (t, warn_anon) - tree t; - int warn_anon; -{ - int old; - enum tree_code code = TREE_CODE (t); - tree fields = TYPE_FIELDS (t); - tree x, last_x, method_vec; - int has_virtual; - int max_has_virtual; - tree pending_virtuals = NULL_TREE; - tree pending_hard_virtuals = NULL_TREE; - tree abstract_virtuals = NULL_TREE; - tree vfield; - tree vfields; - tree virtual_dtor; - int cant_have_default_ctor; - int cant_have_const_ctor; - int no_const_asn_ref; - int has_mutable = 0; - - /* The index of the first base class which has virtual - functions. Only applied to non-virtual baseclasses. */ - int first_vfn_base_index; - - int n_baseclasses; - int any_default_members = 0; - int const_sans_init = 0; - int ref_sans_init = 0; - tree access_decls = NULL_TREE; - int aggregate = 1; - int empty = 1; - int has_pointers = 0; - tree inline_friends; - - if (warn_anon && code != UNION_TYPE && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))) - pedwarn ("anonymous class type not used to declare any objects"); - - if (TYPE_SIZE (t)) - { - if (IS_AGGR_TYPE (t)) - cp_error ("redefinition of `%#T'", t); - else - my_friendly_abort (172); - popclass (); - return; - } - - GNU_xref_decl (current_function_decl, t); - - /* If this type was previously laid out as a forward reference, - make sure we lay it out again. */ - - TYPE_SIZE (t) = NULL_TREE; - CLASSTYPE_GOT_SEMICOLON (t) = 0; - -#if 0 - /* This is in general too late to do this. I moved the main case up to - left_curly, what else needs to move? */ - if (! IS_SIGNATURE (t)) - { - my_friendly_assert (CLASSTYPE_INTERFACE_ONLY (t) == interface_only, 999); - my_friendly_assert (CLASSTYPE_INTERFACE_KNOWN (t) == ! interface_unknown, 999); - } -#endif - - old = suspend_momentary (); - - /* Install struct as DECL_FIELD_CONTEXT of each field decl. - Also process specified field sizes. - Set DECL_FIELD_SIZE to the specified size, or 0 if none specified. - The specified size is found in the DECL_INITIAL. - Store 0 there, except for ": 0" fields (so we can find them - and delete them, below). */ - - if (TYPE_BINFO_BASETYPES (t)) - n_baseclasses = TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (t)); - else - n_baseclasses = 0; - - if (n_baseclasses > 0) - { - struct base_info base_info; - - first_vfn_base_index = finish_base_struct (t, &base_info); - /* Remember where we got our vfield from. */ - CLASSTYPE_VFIELD_PARENT (t) = first_vfn_base_index; - has_virtual = base_info.has_virtual; - max_has_virtual = base_info.max_has_virtual; - vfield = base_info.vfield; - vfields = base_info.vfields; - CLASSTYPE_RTTI (t) = base_info.rtti; - cant_have_default_ctor = base_info.cant_have_default_ctor; - cant_have_const_ctor = base_info.cant_have_const_ctor; - no_const_asn_ref = base_info.no_const_asn_ref; - aggregate = 0; - } - else - { - first_vfn_base_index = -1; - has_virtual = 0; - max_has_virtual = has_virtual; - vfield = NULL_TREE; - vfields = NULL_TREE; - CLASSTYPE_RTTI (t) = NULL_TREE; - cant_have_default_ctor = 0; - cant_have_const_ctor = 0; - no_const_asn_ref = 0; - } - -#if 0 - /* Both of these should be done before now. */ - if (write_virtuals == 3 && CLASSTYPE_INTERFACE_KNOWN (t) - && ! IS_SIGNATURE (t)) - { - my_friendly_assert (CLASSTYPE_INTERFACE_ONLY (t) == interface_only, 999); - my_friendly_assert (CLASSTYPE_VTABLE_NEEDS_WRITING (t) == ! interface_only, 999); - } -#endif - - /* The three of these are approximations which may later be - modified. Needed at this point to make add_virtual_function - and modify_vtable_entries work. */ - CLASSTYPE_VFIELDS (t) = vfields; - CLASSTYPE_VFIELD (t) = vfield; - - for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x)) - { - GNU_xref_member (current_class_name, x); - - /* If this was an evil function, don't keep it in class. */ - if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (x))) - continue; - - /* Do both of these, even though they're in the same union; - if the insn `r' member and the size `i' member are - different sizes, as on the alpha, the larger of the two - will end up with garbage in it. */ - DECL_SAVED_INSNS (x) = NULL_RTX; - DECL_FIELD_SIZE (x) = 0; - - check_for_override (x, t); - if (DECL_ABSTRACT_VIRTUAL_P (x) && ! DECL_VINDEX (x)) - cp_error_at ("initializer specified for non-virtual method `%D'", x); - - /* The name of the field is the original field name - Save this in auxiliary field for later overloading. */ - if (DECL_VINDEX (x)) - { - add_virtual_function (&pending_virtuals, &pending_hard_virtuals, - &has_virtual, x, t); - if (DECL_ABSTRACT_VIRTUAL_P (x)) - abstract_virtuals = tree_cons (NULL_TREE, x, abstract_virtuals); -#if 0 - /* XXX Why did I comment this out? (jason) */ - else - TREE_USED (x) = 1; -#endif - } - } - - if (n_baseclasses) - fields = chainon (build_vbase_pointer_fields (t), fields); - - last_x = NULL_TREE; - for (x = fields; x; x = TREE_CHAIN (x)) - { - GNU_xref_member (current_class_name, x); - - if (TREE_CODE (x) == FIELD_DECL) - { - DECL_PACKED (x) |= TYPE_PACKED (t); - - if (DECL_C_BIT_FIELD (x) && integer_zerop (DECL_INITIAL (x))) - /* A zero-width bitfield doesn't do the trick. */; - else - empty = 0; - } - - if (TREE_CODE (x) == USING_DECL) - { - /* Save access declarations for later. */ - if (last_x) - TREE_CHAIN (last_x) = TREE_CHAIN (x); - else - fields = TREE_CHAIN (x); - - access_decls = scratch_tree_cons (NULL_TREE, x, access_decls); - continue; - } - - last_x = x; - - if (TREE_CODE (x) == TYPE_DECL - || TREE_CODE (x) == TEMPLATE_DECL) - continue; - - /* If we've gotten this far, it's a data member, possibly static, - or an enumerator. */ - - DECL_FIELD_CONTEXT (x) = t; - - /* ``A local class cannot have static data members.'' ARM 9.4 */ - if (current_function_decl && TREE_STATIC (x)) - cp_error_at ("field `%D' in local class cannot be static", x); - - /* Perform error checking that did not get done in - grokdeclarator. */ - if (TREE_CODE (TREE_TYPE (x)) == FUNCTION_TYPE) - { - cp_error_at ("field `%D' invalidly declared function type", - x); - TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x)); - } - else if (TREE_CODE (TREE_TYPE (x)) == METHOD_TYPE) - { - cp_error_at ("field `%D' invalidly declared method type", x); - TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x)); - } - else if (TREE_CODE (TREE_TYPE (x)) == OFFSET_TYPE) - { - cp_error_at ("field `%D' invalidly declared offset type", x); - TREE_TYPE (x) = build_pointer_type (TREE_TYPE (x)); - } - -#if 0 - if (DECL_NAME (x) == constructor_name (t)) - cant_have_default_ctor = 1; -#endif - - if (TREE_TYPE (x) == error_mark_node) - continue; - - DECL_SAVED_INSNS (x) = NULL_RTX; - DECL_FIELD_SIZE (x) = 0; - - /* When this goes into scope, it will be a non-local reference. */ - DECL_NONLOCAL (x) = 1; - - if (TREE_CODE (x) == CONST_DECL) - continue; - - if (TREE_CODE (x) == VAR_DECL) - { - if (TREE_CODE (t) == UNION_TYPE) - /* Unions cannot have static members. */ - cp_error_at ("field `%D' declared static in union", x); - - continue; - } - - /* Now it can only be a FIELD_DECL. */ - - if (TREE_PRIVATE (x) || TREE_PROTECTED (x)) - aggregate = 0; - - /* If this is of reference type, check if it needs an init. - Also do a little ANSI jig if necessary. */ - if (TREE_CODE (TREE_TYPE (x)) == REFERENCE_TYPE) - { - if (DECL_INITIAL (x) == NULL_TREE) - ref_sans_init = 1; - - /* ARM $12.6.2: [A member initializer list] (or, for an - aggregate, initialization by a brace-enclosed list) is the - only way to initialize nonstatic const and reference - members. */ - cant_have_default_ctor = 1; - TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1; - - if (! TYPE_HAS_CONSTRUCTOR (t) && extra_warnings) - { - if (DECL_NAME (x)) - cp_warning_at ("non-static reference `%#D' in class without a constructor", x); - else - cp_warning_at ("non-static reference in class without a constructor", x); - } - } - - if (TREE_CODE (TREE_TYPE (x)) == POINTER_TYPE) - has_pointers = 1; - - if (DECL_MUTABLE_P (x) || TYPE_HAS_MUTABLE_P (TREE_TYPE (x))) - has_mutable = 1; - - /* If any field is const, the structure type is pseudo-const. */ - if (CP_TYPE_CONST_P (TREE_TYPE (x))) - { - C_TYPE_FIELDS_READONLY (t) = 1; - if (DECL_INITIAL (x) == NULL_TREE) - const_sans_init = 1; - - /* ARM $12.6.2: [A member initializer list] (or, for an - aggregate, initialization by a brace-enclosed list) is the - only way to initialize nonstatic const and reference - members. */ - cant_have_default_ctor = 1; - TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1; - - if (! TYPE_HAS_CONSTRUCTOR (t) && !IS_SIGNATURE (t) - && extra_warnings) - { - if (DECL_NAME (x)) - cp_warning_at ("non-static const member `%#D' in class without a constructor", x); - else - cp_warning_at ("non-static const member in class without a constructor", x); - } - } - else - { - /* A field that is pseudo-const makes the structure - likewise. */ - tree t1 = TREE_TYPE (x); - while (TREE_CODE (t1) == ARRAY_TYPE) - t1 = TREE_TYPE (t1); - if (IS_AGGR_TYPE (t1)) - { - if (C_TYPE_FIELDS_READONLY (t1)) - C_TYPE_FIELDS_READONLY (t) = 1; - if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (t1)) - const_sans_init = 1; - } - } - - /* We set DECL_C_BIT_FIELD in grokbitfield. - If the type and width are valid, we'll also set DECL_BIT_FIELD. */ - if (DECL_C_BIT_FIELD (x)) - { - /* Invalid bit-field size done by grokfield. */ - /* Detect invalid bit-field type. */ - if (DECL_INITIAL (x) - && ! INTEGRAL_TYPE_P (TREE_TYPE (x))) - { - cp_error_at ("bit-field `%#D' with non-integral type", x); - DECL_INITIAL (x) = NULL; - } - - /* Detect and ignore out of range field width. */ - if (DECL_INITIAL (x)) - { - tree w = DECL_INITIAL (x); - register int width = 0; - - /* Avoid the non_lvalue wrapper added by fold for PLUS_EXPRs. */ - STRIP_NOPS (w); - - /* detect invalid field size. */ - if (TREE_CODE (w) == CONST_DECL) - w = DECL_INITIAL (w); - else if (TREE_READONLY_DECL_P (w)) - w = decl_constant_value (w); - - if (TREE_CODE (w) != INTEGER_CST) - { - cp_error_at ("bit-field `%D' width not an integer constant", - x); - DECL_INITIAL (x) = NULL_TREE; - } - else if (width = TREE_INT_CST_LOW (w), - width < 0) - { - DECL_INITIAL (x) = NULL; - cp_error_at ("negative width in bit-field `%D'", x); - } - else if (width == 0 && DECL_NAME (x) != 0) - { - DECL_INITIAL (x) = NULL; - cp_error_at ("zero width for bit-field `%D'", x); - } - else if (width - > TYPE_PRECISION (long_long_unsigned_type_node)) - { - /* The backend will dump if you try to use something - too big; avoid that. */ - DECL_INITIAL (x) = NULL; - sorry ("bit-fields larger than %d bits", - TYPE_PRECISION (long_long_unsigned_type_node)); - cp_error_at (" in declaration of `%D'", x); - } - else if (width > TYPE_PRECISION (TREE_TYPE (x)) - && TREE_CODE (TREE_TYPE (x)) != ENUMERAL_TYPE - && TREE_CODE (TREE_TYPE (x)) != BOOLEAN_TYPE) - { - cp_warning_at ("width of `%D' exceeds its type", x); - } - else if (TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE - && ((min_precision (TYPE_MIN_VALUE (TREE_TYPE (x)), - TREE_UNSIGNED (TREE_TYPE (x))) > width) - || (min_precision (TYPE_MAX_VALUE (TREE_TYPE (x)), - TREE_UNSIGNED (TREE_TYPE (x))) > width))) - { - cp_warning_at ("`%D' is too small to hold all values of `%#T'", - x, TREE_TYPE (x)); - } - - if (DECL_INITIAL (x)) - { - DECL_INITIAL (x) = NULL_TREE; - DECL_FIELD_SIZE (x) = width; - DECL_BIT_FIELD (x) = 1; - - if (width == 0) - { -#ifdef EMPTY_FIELD_BOUNDARY - DECL_ALIGN (x) = MAX (DECL_ALIGN (x), - EMPTY_FIELD_BOUNDARY); -#endif -#ifdef PCC_BITFIELD_TYPE_MATTERS - if (PCC_BITFIELD_TYPE_MATTERS) - DECL_ALIGN (x) = MAX (DECL_ALIGN (x), - TYPE_ALIGN (TREE_TYPE (x))); -#endif - } - } - } - else - /* Non-bit-fields are aligned for their type. */ - DECL_ALIGN (x) = MAX (DECL_ALIGN (x), TYPE_ALIGN (TREE_TYPE (x))); - } - else - { - tree type = TREE_TYPE (x); - - while (TREE_CODE (type) == ARRAY_TYPE) - type = TREE_TYPE (type); - - if (TYPE_LANG_SPECIFIC (type) && ! ANON_UNION_P (x) - && ! TYPE_PTRMEMFUNC_P (type)) - { - /* Never let anything with uninheritable virtuals - make it through without complaint. */ - if (CLASSTYPE_ABSTRACT_VIRTUALS (type)) - abstract_virtuals_error (x, type); - - /* Don't let signatures make it through either. */ - if (IS_SIGNATURE (type)) - signature_error (x, type); - - if (code == UNION_TYPE) - { - const char *fie = NULL; - if (TYPE_NEEDS_CONSTRUCTING (type)) - fie = "constructor"; - else if (TYPE_NEEDS_DESTRUCTOR (type)) - fie = "destructor"; - else if (TYPE_HAS_COMPLEX_ASSIGN_REF (type)) - fie = "copy assignment operator"; - if (fie) - cp_error_at ("member `%#D' with %s not allowed in union", x, - fie); - } - else - { - TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (type); - TYPE_NEEDS_DESTRUCTOR (t) |= TYPE_NEEDS_DESTRUCTOR (type); - TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (type); - TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (type); - } - - if (!TYPE_HAS_CONST_INIT_REF (type)) - cant_have_const_ctor = 1; - - if (!TYPE_HAS_CONST_ASSIGN_REF (type)) - no_const_asn_ref = 1; - - if (TYPE_HAS_CONSTRUCTOR (type) - && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type)) - { - cant_have_default_ctor = 1; -#if 0 - /* This is wrong for aggregates. */ - if (! TYPE_HAS_CONSTRUCTOR (t)) - { - if (DECL_NAME (x)) - cp_pedwarn_at ("member `%#D' with only non-default constructor", x); - else - cp_pedwarn_at ("member with only non-default constructor", x); - cp_pedwarn_at ("in class without a constructor", - x); - } -#endif - } - } - if (DECL_INITIAL (x) != NULL_TREE) - { - /* `build_class_init_list' does not recognize - non-FIELD_DECLs. */ - if (code == UNION_TYPE && any_default_members != 0) - cp_error_at ("multiple fields in union `%T' initialized"); - any_default_members = 1; - } - } - } - - /* If this type has any constant members which did not come - with their own initialization, mark that fact here. It is - not an error here, since such types can be saved either by their - constructors, or by fortuitous initialization. */ - CLASSTYPE_READONLY_FIELDS_NEED_INIT (t) = const_sans_init; - CLASSTYPE_REF_FIELDS_NEED_INIT (t) = ref_sans_init; - CLASSTYPE_ABSTRACT_VIRTUALS (t) = abstract_virtuals; - CLASSTYPE_HAS_MUTABLE (t) = has_mutable; - - /* Effective C++ rule 11. */ - if (has_pointers && warn_ecpp && TYPE_HAS_CONSTRUCTOR (t) - && ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t))) - { - cp_warning ("`%#T' has pointer data members", t); - - if (! TYPE_HAS_INIT_REF (t)) - { - cp_warning (" but does not override `%T(const %T&)'", t, t); - if (! TYPE_HAS_ASSIGN_REF (t)) - cp_warning (" or `operator=(const %T&)'", t); - } - else if (! TYPE_HAS_ASSIGN_REF (t)) - cp_warning (" but does not override `operator=(const %T&)'", t); - } - - /* Do some bookkeeping that will guide the generation of implicitly - declared member functions. */ - TYPE_HAS_COMPLEX_INIT_REF (t) - |= (TYPE_HAS_INIT_REF (t) || TYPE_USES_VIRTUAL_BASECLASSES (t) - || has_virtual || any_default_members); - TYPE_NEEDS_CONSTRUCTING (t) - |= (TYPE_HAS_CONSTRUCTOR (t) || TYPE_USES_VIRTUAL_BASECLASSES (t) - || has_virtual || any_default_members); - if (! IS_SIGNATURE (t)) - CLASSTYPE_NON_AGGREGATE (t) - = ! aggregate || has_virtual || TYPE_HAS_CONSTRUCTOR (t); - TYPE_HAS_REAL_ASSIGN_REF (t) |= TYPE_HAS_ASSIGN_REF (t); - TYPE_HAS_COMPLEX_ASSIGN_REF (t) - |= TYPE_HAS_ASSIGN_REF (t) || TYPE_USES_VIRTUAL_BASECLASSES (t); - - /* Synthesize any needed methods. Note that methods will be synthesized - for anonymous unions; grok_x_components undoes that. */ - virtual_dtor - = add_implicitly_declared_members (t, cant_have_default_ctor, - cant_have_const_ctor, - no_const_asn_ref); - if (virtual_dtor) - add_virtual_function (&pending_virtuals, &pending_hard_virtuals, - &has_virtual, virtual_dtor, t); - - if (TYPE_METHODS (t)) - { - finish_struct_methods (t); - method_vec = CLASSTYPE_METHOD_VEC (t); - } - else - { - method_vec = 0; - - /* Just in case these got accidentally - filled in by syntax errors. */ - TYPE_HAS_CONSTRUCTOR (t) = 0; - TYPE_HAS_DESTRUCTOR (t) = 0; - } - - for (access_decls = nreverse (access_decls); access_decls; - access_decls = TREE_CHAIN (access_decls)) - handle_using_decl (TREE_VALUE (access_decls), t, method_vec, fields); - - if (vfield == NULL_TREE && has_virtual) - { - /* We build this decl with vtbl_ptr_type_node, which is a - `vtable_entry_type*'. It might seem more precise to use - `vtable_entry_type (*)[N]' where N is the number of firtual - functions. However, that would require the vtable pointer in - base classes to have a different type than the vtable pointer - in derived classes. We could make that happen, but that - still wouldn't solve all the problems. In particular, the - type-based alias analysis code would decide that assignments - to the base class vtable pointer can't alias assignments to - the derived class vtable pointer, since they have different - types. Thus, in an derived class destructor, where the base - class constructor was inlined, we could generate bad code for - setting up the vtable pointer. - - Therefore, we use one type for all vtable pointers. We still - use a type-correct type; it's just doesn't indicate the array - bounds. That's better than using `void*' or some such; it's - cleaner, and it let's the alias analysis code know that these - stores cannot alias stores to void*! */ - vfield = build_lang_field_decl (FIELD_DECL, get_vfield_name (t), - vtbl_ptr_type_node); - /* If you change any of the below, take a look at all the - other VFIELD_BASEs and VTABLE_BASEs in the code, and change - them too. */ - DECL_ASSEMBLER_NAME (vfield) = get_identifier (VFIELD_BASE); - CLASSTYPE_VFIELD (t) = vfield; - DECL_VIRTUAL_P (vfield) = 1; - DECL_ARTIFICIAL (vfield) = 1; - DECL_FIELD_CONTEXT (vfield) = t; - DECL_CLASS_CONTEXT (vfield) = t; - DECL_FCONTEXT (vfield) = t; - DECL_SAVED_INSNS (vfield) = NULL_RTX; - DECL_FIELD_SIZE (vfield) = 0; - DECL_ALIGN (vfield) = TYPE_ALIGN (ptr_type_node); -#if 0 - /* This is more efficient, but breaks binary compatibility, turn - it on sometime when we don't care. If we turn it on, we also - have to enable the code in dfs_init_vbase_pointers. */ - /* vfield is always first entry in structure. */ - TREE_CHAIN (vfield) = fields; - fields = vfield; -#else - if (last_x) - { - my_friendly_assert (TREE_CHAIN (last_x) == NULL_TREE, 175); - TREE_CHAIN (last_x) = vfield; - last_x = vfield; - } - else - fields = vfield; -#endif - empty = 0; - vfields = chainon (vfields, build_tree_list (NULL_TREE, t)); - } - - /* Now DECL_INITIAL is null on all members except for zero-width bit-fields. - - C++: maybe we will support default field initialization some day... */ - - /* Delete all duplicate fields from the fields */ - delete_duplicate_fields (fields); - - /* Now we have the nearly final fieldlist for the data fields. Record it, - then lay out the structure or union (including the fields). */ - - TYPE_FIELDS (t) = fields; - - if (n_baseclasses) - { - last_x = build_base_fields (t); - - /* If all our bases are empty, we can be empty too. */ - for (x = last_x; empty && x; x = TREE_CHAIN (x)) - if (DECL_SIZE (x) != integer_zero_node) - empty = 0; - } - - /* CLASSTYPE_INLINE_FRIENDS is really TYPE_NONCOPIED_PARTS. Thus, - we have to save this before we start modifying - TYPE_NONCOPIED_PARTS. */ - inline_friends = CLASSTYPE_INLINE_FRIENDS (t); - CLASSTYPE_INLINE_FRIENDS (t) = NULL_TREE; - - if (empty) - { - /* C++: do not let empty structures exist. */ - tree decl = build_lang_field_decl - (FIELD_DECL, NULL_TREE, char_type_node); - TREE_CHAIN (decl) = fields; - TYPE_FIELDS (t) = decl; - TYPE_NONCOPIED_PARTS (t) - = tree_cons (NULL_TREE, decl, TYPE_NONCOPIED_PARTS (t)); - TREE_STATIC (TYPE_NONCOPIED_PARTS (t)) = 1; - } - - if (n_baseclasses) - TYPE_FIELDS (t) = chainon (last_x, TYPE_FIELDS (t)); - - layout_type (t); - - /* Remember the size and alignment of the class before adding - the virtual bases. */ - if (empty && flag_new_abi) - CLASSTYPE_SIZE (t) = integer_zero_node; - else if (flag_new_abi && TYPE_HAS_COMPLEX_INIT_REF (t) - && TYPE_HAS_COMPLEX_ASSIGN_REF (t)) - CLASSTYPE_SIZE (t) = TYPE_BINFO_SIZE (t); - else - CLASSTYPE_SIZE (t) = TYPE_SIZE (t); - CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t); - - finish_struct_anon (t); - - /* Set the TYPE_DECL for this type to contain the right - value for DECL_OFFSET, so that we can use it as part - of a COMPONENT_REF for multiple inheritance. */ - - layout_decl (TYPE_MAIN_DECL (t), 0); - - /* Now fix up any virtual base class types that we left lying - around. We must get these done before we try to lay out the - virtual function table. */ - pending_hard_virtuals = nreverse (pending_hard_virtuals); - - if (n_baseclasses) - /* layout_basetypes will remove the base subobject fields. */ - max_has_virtual = layout_basetypes (t, max_has_virtual); - if (empty) - TYPE_FIELDS (t) = fields; - - my_friendly_assert (TYPE_FIELDS (t) == fields, 981117); - - /* Delete all zero-width bit-fields from the front of the fieldlist */ - while (fields && DECL_C_BIT_FIELD (fields) - && DECL_INITIAL (fields)) - fields = TREE_CHAIN (fields); - /* Delete all such fields from the rest of the fields. */ - for (x = fields; x;) - { - if (TREE_CHAIN (x) && DECL_C_BIT_FIELD (TREE_CHAIN (x)) - && DECL_INITIAL (TREE_CHAIN (x))) - TREE_CHAIN (x) = TREE_CHAIN (TREE_CHAIN (x)); - else - x = TREE_CHAIN (x); - } - TYPE_FIELDS (t) = fields; - - if (TYPE_USES_VIRTUAL_BASECLASSES (t)) - { - tree vbases; - - vbases = CLASSTYPE_VBASECLASSES (t); - - { - /* Now fixup overrides of all functions in vtables from all - direct or indirect virtual base classes. */ - tree binfos = BINFO_BASETYPES (TYPE_BINFO (t)); - int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - for (i = 0; i < n_baseclasses; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - tree basetype = BINFO_TYPE (base_binfo); - tree vbases; - - vbases = CLASSTYPE_VBASECLASSES (basetype); - while (vbases) - { - merge_overrides (binfo_member (BINFO_TYPE (vbases), - CLASSTYPE_VBASECLASSES (t)), - vbases, 1, t); - vbases = TREE_CHAIN (vbases); - } - } - } - } - - /* Set up the DECL_FIELD_BITPOS of the vfield if we need to, as we - might need to know it for setting up the offsets in the vtable - (or in thunks) below. */ - if (vfield != NULL_TREE - && DECL_FIELD_CONTEXT (vfield) != t) - { - tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0); - tree offset = BINFO_OFFSET (binfo); - - vfield = copy_node (vfield); - copy_lang_decl (vfield); - - if (! integer_zerop (offset)) - offset = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT)); - DECL_FIELD_CONTEXT (vfield) = t; - DECL_CLASS_CONTEXT (vfield) = t; - DECL_FIELD_BITPOS (vfield) - = size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield)); - CLASSTYPE_VFIELD (t) = vfield; - } - -#ifdef NOTQUITE - cp_warning ("Doing hard virtuals for %T...", t); -#endif - - if (has_virtual > max_has_virtual) - max_has_virtual = has_virtual; - if (max_has_virtual > 0) - TYPE_VIRTUAL_P (t) = 1; - - if (flag_rtti && TYPE_VIRTUAL_P (t) && !pending_hard_virtuals) - modify_all_vtables (t, NULL_TREE, NULL_TREE); - - while (pending_hard_virtuals) - { - modify_all_vtables (t, - TREE_PURPOSE (pending_hard_virtuals), - TREE_VALUE (pending_hard_virtuals)); - pending_hard_virtuals = TREE_CHAIN (pending_hard_virtuals); - } - - if (TYPE_USES_VIRTUAL_BASECLASSES (t)) - { - tree vbases; - /* Now fixup any virtual function entries from virtual bases - that have different deltas. This has to come after we do the - pending hard virtuals, as we might have a function that comes - from multiple virtual base instances that is only overridden - by a hard virtual above. */ - vbases = CLASSTYPE_VBASECLASSES (t); - while (vbases) - { - /* We might be able to shorten the amount of work we do by - only doing this for vtables that come from virtual bases - that have differing offsets, but don't want to miss any - entries. */ - fixup_vtable_deltas (vbases, 1, t); - vbases = TREE_CHAIN (vbases); - } - } - - /* Under our model of GC, every C++ class gets its own virtual - function table, at least virtually. */ - if (pending_virtuals) - { - pending_virtuals = nreverse (pending_virtuals); - /* We must enter these virtuals into the table. */ - if (first_vfn_base_index < 0) - { - if (! CLASSTYPE_COM_INTERFACE (t)) - { - /* The second slot is for the tdesc pointer when thunks are used. */ - if (flag_vtable_thunks) - pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals); - - /* The first slot is for the rtti offset. */ - pending_virtuals = tree_cons (NULL_TREE, NULL_TREE, pending_virtuals); - - set_rtti_entry (pending_virtuals, - convert (ssizetype, integer_zero_node), t); - } - build_vtable (NULL_TREE, t); - } - else - { - /* Here we know enough to change the type of our virtual - function table, but we will wait until later this function. */ - - if (! BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (t))) - build_vtable (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (t), first_vfn_base_index), t); - } - - /* If this type has basetypes with constructors, then those - constructors might clobber the virtual function table. But - they don't if the derived class shares the exact vtable of the base - class. */ - - CLASSTYPE_NEEDS_VIRTUAL_REINIT (t) = 1; - } - else if (first_vfn_base_index >= 0) - { - tree binfo = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (t), first_vfn_base_index); - /* This class contributes nothing new to the virtual function - table. However, it may have declared functions which - went into the virtual function table "inherited" from the - base class. If so, we grab a copy of those updated functions, - and pretend they are ours. */ - - /* See if we should steal the virtual info from base class. */ - if (TYPE_BINFO_VTABLE (t) == NULL_TREE) - TYPE_BINFO_VTABLE (t) = BINFO_VTABLE (binfo); - if (TYPE_BINFO_VIRTUALS (t) == NULL_TREE) - TYPE_BINFO_VIRTUALS (t) = BINFO_VIRTUALS (binfo); - if (TYPE_BINFO_VTABLE (t) != BINFO_VTABLE (binfo)) - CLASSTYPE_NEEDS_VIRTUAL_REINIT (t) = 1; - } - - if (max_has_virtual || first_vfn_base_index >= 0) - { - CLASSTYPE_VSIZE (t) = has_virtual; - if (first_vfn_base_index >= 0) - { - if (pending_virtuals) - TYPE_BINFO_VIRTUALS (t) = chainon (TYPE_BINFO_VIRTUALS (t), - pending_virtuals); - } - else if (has_virtual) - { - TYPE_BINFO_VIRTUALS (t) = pending_virtuals; - DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)) = 1; - } - } - - /* Now lay out the virtual function table. */ - if (has_virtual) - { - /* Use size_int so values are memoized in common cases. */ - tree itype = build_index_type (size_int (has_virtual)); - tree atype = build_cplus_array_type (vtable_entry_type, itype); - - layout_type (atype); - - CLASSTYPE_VFIELD (t) = vfield; - - /* We may have to grow the vtable. */ - if (TREE_TYPE (TYPE_BINFO_VTABLE (t)) != atype) - { - TREE_TYPE (TYPE_BINFO_VTABLE (t)) = atype; - DECL_SIZE (TYPE_BINFO_VTABLE (t)) = 0; - layout_decl (TYPE_BINFO_VTABLE (t), 0); - /* At one time the vtable info was grabbed 2 words at a time. This - fails on sparc unless you have 8-byte alignment. (tiemann) */ - DECL_ALIGN (TYPE_BINFO_VTABLE (t)) - = MAX (TYPE_ALIGN (double_type_node), - DECL_ALIGN (TYPE_BINFO_VTABLE (t))); - } - } - else if (first_vfn_base_index >= 0) - CLASSTYPE_VFIELD (t) = vfield; - CLASSTYPE_VFIELDS (t) = vfields; - - finish_struct_bits (t, max_has_virtual); - - /* Complete the rtl for any static member objects of the type we're - working on. */ - for (x = fields; x; x = TREE_CHAIN (x)) - { - if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x) - && TREE_TYPE (x) == t) - { - DECL_MODE (x) = TYPE_MODE (t); - make_decl_rtl (x, NULL, 0); - } - } - - if (TYPE_HAS_CONSTRUCTOR (t)) - { - tree vfields = CLASSTYPE_VFIELDS (t); - - while (vfields) - { - /* Mark the fact that constructor for T - could affect anybody inheriting from T - who wants to initialize vtables for VFIELDS's type. */ - if (VF_DERIVED_VALUE (vfields)) - TREE_ADDRESSABLE (vfields) = 1; - vfields = TREE_CHAIN (vfields); - } - } - - /* Write out inline function definitions. */ - do_inline_function_hair (t, inline_friends); - - if (CLASSTYPE_VSIZE (t) != 0) - { -#if 0 - /* This is now done above. */ - if (DECL_FIELD_CONTEXT (vfield) != t) - { - tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0); - tree offset = BINFO_OFFSET (binfo); - - vfield = copy_node (vfield); - copy_lang_decl (vfield); - - if (! integer_zerop (offset)) - offset = size_binop (MULT_EXPR, offset, size_int (BITS_PER_UNIT)); - DECL_FIELD_CONTEXT (vfield) = t; - DECL_CLASS_CONTEXT (vfield) = t; - DECL_FIELD_BITPOS (vfield) - = size_binop (PLUS_EXPR, offset, DECL_FIELD_BITPOS (vfield)); - CLASSTYPE_VFIELD (t) = vfield; - } -#endif - - /* In addition to this one, all the other vfields should be listed. */ - /* Before that can be done, we have to have FIELD_DECLs for them, and - a place to find them. */ - TYPE_NONCOPIED_PARTS (t) - = tree_cons (default_conversion (TYPE_BINFO_VTABLE (t)), - vfield, TYPE_NONCOPIED_PARTS (t)); - - if (warn_nonvdtor && TYPE_HAS_DESTRUCTOR (t) - && DECL_VINDEX (TREE_VEC_ELT (method_vec, 1)) == NULL_TREE) - cp_warning ("`%#T' has virtual functions but non-virtual destructor", - t); - } - - /* Make the rtl for any new vtables we have created, and unmark - the base types we marked. */ - finish_vtbls (TYPE_BINFO (t), 1, t); - /* If we use thunks, and have virtual bases, we might need to emit - additional vtables. */ - if (flag_vtable_thunks && TYPE_USES_PVBASES (t)) - finish_ctor_vtables (t); - hack_incomplete_structures (t); - -#if 0 - if (TYPE_NAME (t) && TYPE_IDENTIFIER (t)) - undo_template_name_overload (TYPE_IDENTIFIER (t), 1); -#endif - - resume_momentary (old); - - if (warn_overloaded_virtual) - warn_hidden (t); - -#if 0 - /* This has to be done after we have sorted out what to do with - the enclosing type. */ - if (write_symbols != DWARF_DEBUG) - { - /* Be smarter about nested classes here. If a type is nested, - only output it if we would output the enclosing type. */ - if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (t))) - DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t)); - } -#endif - - if (write_symbols != DWARF_DEBUG && write_symbols != DWARF2_DEBUG) - { - /* If the type has methods, we want to think about cutting down - the amount of symbol table stuff we output. The value stored in - the TYPE_DECL's DECL_IGNORED_P slot is a first approximation. - For example, if a member function is seen and we decide to - write out that member function, then we can change the value - of the DECL_IGNORED_P slot, and the type will be output when - that member function's debug info is written out. - - We can't do this with DWARF, which does not support name - references between translation units. */ - if (CLASSTYPE_METHOD_VEC (t)) - { - /* Don't output full info about any type - which does not have its implementation defined here. */ - if (CLASSTYPE_INTERFACE_ONLY (t)) - TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1; -#if 0 - /* XXX do something about this. */ - else if (CLASSTYPE_INTERFACE_UNKNOWN (t)) - /* Only a first approximation! */ - TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1; -#endif - } - else if (CLASSTYPE_INTERFACE_ONLY (t)) - TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1; - } - - /* Finish debugging output for this type. */ - rest_of_type_compilation (t, toplevel_bindings_p ()); - - return; -} - -/* When T was built up, the member declarations were added in reverse - order. Rearrange them to declaration order. */ - -void -unreverse_member_declarations (t) - tree t; -{ - tree next; - tree prev; - tree x; - - /* The TYPE_FIELDS, TYPE_METHODS, and CLASSTYPE_TAGS are all in - reverse order. Put them in declaration order now. */ - TYPE_METHODS (t) = nreverse (TYPE_METHODS (t)); - CLASSTYPE_TAGS (t) = nreverse (CLASSTYPE_TAGS (t)); - - /* Actually, for the TYPE_FIELDS, only the non TYPE_DECLs are in - reverse order, so we can't just use nreverse. */ - prev = NULL_TREE; - for (x = TYPE_FIELDS (t); - x && TREE_CODE (x) != TYPE_DECL; - x = next) - { - next = TREE_CHAIN (x); - TREE_CHAIN (x) = prev; - prev = x; - } - if (prev) - { - TREE_CHAIN (TYPE_FIELDS (t)) = x; - if (prev) - TYPE_FIELDS (t) = prev; - } -} - -tree -finish_struct (t, attributes, warn_anon) - tree t, attributes; - int warn_anon; -{ - tree name = TYPE_NAME (t); - - if (TREE_CODE (name) == TYPE_DECL) - { - extern int lineno; - - DECL_SOURCE_FILE (name) = input_filename; - /* For TYPE_DECL that are not typedefs (those marked with a line - number of zero, we don't want to mark them as real typedefs. - If this fails one needs to make sure real typedefs have a - previous line number, even if it is wrong, that way the below - will fill in the right line number. (mrs) */ - if (DECL_SOURCE_LINE (name)) - DECL_SOURCE_LINE (name) = lineno; - name = DECL_NAME (name); - } - - /* Append the fields we need for constructing signature tables. */ - if (IS_SIGNATURE (t)) - append_signature_fields (t); - - /* Now that we've got all the field declarations, reverse everything - as necessary. */ - unreverse_member_declarations (t); - - cplus_decl_attributes (t, attributes, NULL_TREE); - - if (processing_template_decl) - { - tree d = getdecls (); - for (; d; d = TREE_CHAIN (d)) - { - /* If this is the decl for the class or one of the template - parms, we've seen all the injected decls. */ - if ((TREE_CODE (d) == TYPE_DECL - && (TREE_TYPE (d) == t - || TREE_CODE (TREE_TYPE (d)) == TEMPLATE_TYPE_PARM - || TREE_CODE (TREE_TYPE (d)) == TEMPLATE_TEMPLATE_PARM)) - || TREE_CODE (d) == CONST_DECL) - break; - /* Don't inject cache decls. */ - else if (IDENTIFIER_TEMPLATE (DECL_NAME (d))) - continue; - DECL_TEMPLATE_INJECT (CLASSTYPE_TI_TEMPLATE (t)) - = tree_cons (NULL_TREE, d, - DECL_TEMPLATE_INJECT (CLASSTYPE_TI_TEMPLATE (t))); - } - finish_struct_methods (t); - TYPE_SIZE (t) = integer_zero_node; - } - else - finish_struct_1 (t, warn_anon); - - TYPE_BEING_DEFINED (t) = 0; - - if (current_class_type) - popclass (); - else - error ("trying to finish struct, but kicked out due to previous parse errors."); - - return t; -} - -/* Return the dynamic type of INSTANCE, if known. - Used to determine whether the virtual function table is needed - or not. - - *NONNULL is set iff INSTANCE can be known to be nonnull, regardless - of our knowledge of its type. */ - -static tree -fixed_type_or_null (instance, nonnull) - tree instance; - int *nonnull; -{ - switch (TREE_CODE (instance)) - { - case INDIRECT_REF: - /* Check that we are not going through a cast of some sort. */ - if (TREE_TYPE (instance) - == TREE_TYPE (TREE_TYPE (TREE_OPERAND (instance, 0)))) - instance = TREE_OPERAND (instance, 0); - /* fall through... */ - case CALL_EXPR: - /* This is a call to a constructor, hence it's never zero. */ - if (TREE_HAS_CONSTRUCTOR (instance)) - { - if (nonnull) - *nonnull = 1; - return TREE_TYPE (instance); - } - return NULL_TREE; - - case SAVE_EXPR: - /* This is a call to a constructor, hence it's never zero. */ - if (TREE_HAS_CONSTRUCTOR (instance)) - { - if (nonnull) - *nonnull = 1; - return TREE_TYPE (instance); - } - return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull); - - case RTL_EXPR: - return NULL_TREE; - - case PLUS_EXPR: - case MINUS_EXPR: - if (TREE_CODE (TREE_OPERAND (instance, 1)) == INTEGER_CST) - /* Propagate nonnull. */ - fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull); - if (TREE_CODE (TREE_OPERAND (instance, 0)) == ADDR_EXPR) - return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull); - return NULL_TREE; - - case NOP_EXPR: - case CONVERT_EXPR: - return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull); - - case ADDR_EXPR: - if (nonnull) - *nonnull = 1; - return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull); - - case COMPONENT_REF: - return fixed_type_or_null (TREE_OPERAND (instance, 1), nonnull); - - case VAR_DECL: - case FIELD_DECL: - if (TREE_CODE (TREE_TYPE (instance)) == ARRAY_TYPE - && IS_AGGR_TYPE (TREE_TYPE (TREE_TYPE (instance)))) - { - if (nonnull) - *nonnull = 1; - return TREE_TYPE (TREE_TYPE (instance)); - } - /* fall through... */ - case TARGET_EXPR: - case PARM_DECL: - if (IS_AGGR_TYPE (TREE_TYPE (instance))) - { - if (nonnull) - *nonnull = 1; - return TREE_TYPE (instance); - } - else if (nonnull) - { - if (instance == current_class_ptr - && flag_this_is_variable <= 0) - { - /* Normally, 'this' must be non-null. */ - if (flag_this_is_variable == 0) - *nonnull = 1; - - /* <0 means we're in a constructor and we know our type. */ - if (flag_this_is_variable < 0) - return TREE_TYPE (TREE_TYPE (instance)); - } - else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE) - /* Reference variables should be references to objects. */ - *nonnull = 1; - } - return NULL_TREE; - - default: - return NULL_TREE; - } -} - -/* Return non-zero if the dynamic type of INSTANCE is known, and equivalent - to the static type. We also handle the case where INSTANCE is really - a pointer. - - Used to determine whether the virtual function table is needed - or not. - - *NONNULL is set iff INSTANCE can be known to be nonnull, regardless - of our knowledge of its type. */ - -int -resolves_to_fixed_type_p (instance, nonnull) - tree instance; - int *nonnull; -{ - tree t = TREE_TYPE (instance); - tree fixed = fixed_type_or_null (instance, nonnull); - if (fixed == NULL_TREE) - return 0; - if (POINTER_TYPE_P (t)) - t = TREE_TYPE (t); - return same_type_p (TYPE_MAIN_VARIANT (t), TYPE_MAIN_VARIANT (fixed)); -} - - -void -init_class_processing () -{ - current_class_depth = 0; - current_class_stack_size = 10; - current_class_stack - = (class_stack_node_t) xmalloc (current_class_stack_size - * sizeof (struct class_stack_node)); - - current_lang_stacksize = 10; - current_lang_base = (tree *)xmalloc(current_lang_stacksize * sizeof (tree)); - current_lang_stack = current_lang_base; - - access_default_node = build_int_2 (0, 0); - access_public_node = build_int_2 (1, 0); - access_protected_node = build_int_2 (2, 0); - access_private_node = build_int_2 (3, 0); - access_default_virtual_node = build_int_2 (4, 0); - access_public_virtual_node = build_int_2 (5, 0); - access_protected_virtual_node = build_int_2 (6, 0); - access_private_virtual_node = build_int_2 (7, 0); - - /* Keep these values lying around. */ - base_layout_decl = build_lang_field_decl (FIELD_DECL, NULL_TREE, error_mark_node); - TREE_TYPE (base_layout_decl) = make_node (RECORD_TYPE); - - gcc_obstack_init (&class_obstack); -} - -/* Set current scope to NAME. CODE tells us if this is a - STRUCT, UNION, or ENUM environment. - - NAME may end up being NULL_TREE if this is an anonymous or - late-bound struct (as in "struct { ... } foo;") */ - -/* Set global variables CURRENT_CLASS_NAME and CURRENT_CLASS_TYPE to - appropriate values, found by looking up the type definition of - NAME (as a CODE). - - If MODIFY is 1, we set IDENTIFIER_CLASS_VALUE's of names - which can be seen locally to the class. They are shadowed by - any subsequent local declaration (including parameter names). - - If MODIFY is 2, we set IDENTIFIER_CLASS_VALUE's of names - which have static meaning (i.e., static members, static - member functions, enum declarations, etc). - - If MODIFY is 3, we set IDENTIFIER_CLASS_VALUE of names - which can be seen locally to the class (as in 1), but - know that we are doing this for declaration purposes - (i.e. friend foo::bar (int)). - - So that we may avoid calls to lookup_name, we cache the _TYPE - nodes of local TYPE_DECLs in the TREE_TYPE field of the name. - - For multiple inheritance, we perform a two-pass depth-first search - of the type lattice. The first pass performs a pre-order search, - marking types after the type has had its fields installed in - the appropriate IDENTIFIER_CLASS_VALUE slot. The second pass merely - unmarks the marked types. If a field or member function name - appears in an ambiguous way, the IDENTIFIER_CLASS_VALUE of - that name becomes `error_mark_node'. */ - -void -pushclass (type, modify) - tree type; - int modify; -{ - type = TYPE_MAIN_VARIANT (type); - - /* Make sure there is enough room for the new entry on the stack. */ - if (current_class_depth + 1 >= current_class_stack_size) - { - current_class_stack_size *= 2; - current_class_stack - = (class_stack_node_t) xrealloc (current_class_stack, - current_class_stack_size - * sizeof (struct class_stack_node)); - } - - /* Insert a new entry on the class stack. */ - current_class_stack[current_class_depth].name = current_class_name; - current_class_stack[current_class_depth].type = current_class_type; - current_class_stack[current_class_depth].access = current_access_specifier; - current_class_stack[current_class_depth].names_used = 0; - current_class_depth++; - - /* Now set up the new type. */ - current_class_name = TYPE_NAME (type); - if (TREE_CODE (current_class_name) == TYPE_DECL) - current_class_name = DECL_NAME (current_class_name); - current_class_type = type; - - /* By default, things in classes are private, while things in - structures or unions are public. */ - current_access_specifier = (CLASSTYPE_DECLARED_CLASS (type) - ? access_private_node - : access_public_node); - - if (previous_class_type != NULL_TREE - && (type != previous_class_type - || TYPE_SIZE (previous_class_type) == NULL_TREE) - && current_class_depth == 1) - { - /* Forcibly remove any old class remnants. */ - invalidate_class_lookup_cache (); - - /* Now, free the obstack on which we cached all the values. */ - if (class_cache_firstobj) - obstack_free (&class_cache_obstack, class_cache_firstobj); - class_cache_firstobj - = (char*) obstack_finish (&class_cache_obstack); - } - - /* If we're about to enter a nested class, clear - IDENTIFIER_CLASS_VALUE for the enclosing classes. */ - if (modify && current_class_depth > 1) - clear_identifier_class_values (); - - pushlevel_class (); - -#if 0 - if (CLASSTYPE_TEMPLATE_INFO (type)) - overload_template_name (type); -#endif - - if (modify) - { - if (type != previous_class_type || current_class_depth > 1) - push_class_decls (type); - else - { - tree item; - - /* We are re-entering the same class we just left, so we - don't have to search the whole inheritance matrix to find - all the decls to bind again. Instead, we install the - cached class_shadowed list, and walk through it binding - names and setting up IDENTIFIER_TYPE_VALUEs. */ - set_class_shadows (previous_class_values); - for (item = previous_class_values; item; item = TREE_CHAIN (item)) - { - tree id = TREE_PURPOSE (item); - tree decl = TREE_TYPE (item); - - push_class_binding (id, decl); - if (TREE_CODE (decl) == TYPE_DECL) - set_identifier_type_value (id, TREE_TYPE (decl)); - } - unuse_fields (type); - } - - storetags (CLASSTYPE_TAGS (type)); - } -} - -/* When we exit a toplevel class scope, we save the - IDENTIFIER_CLASS_VALUEs so that we can restore them quickly if we - reenter the class. Here, we've entered some other class, so we - must invalidate our cache. */ - -void -invalidate_class_lookup_cache () -{ - tree t; - - /* This code can be seen as a cache miss. When we've cached a - class' scope's bindings and we can't use them, we need to reset - them. This is it! */ - for (t = previous_class_values; t; t = TREE_CHAIN (t)) - IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE; - - previous_class_type = NULL_TREE; -} - -/* Get out of the current class scope. If we were in a class scope - previously, that is the one popped to. */ - -void -popclass () -{ - poplevel (1, 0, 0); - /* Since poplevel_class does the popping of class decls nowadays, - this really only frees the obstack used for these decls. */ - pop_class_decls (); - - current_class_depth--; - current_class_name = current_class_stack[current_class_depth].name; - current_class_type = current_class_stack[current_class_depth].type; - current_access_specifier = current_class_stack[current_class_depth].access; - if (current_class_stack[current_class_depth].names_used) - splay_tree_delete (current_class_stack[current_class_depth].names_used); -} - -/* Returns 1 if current_class_type is either T or a nested type of T. */ - -int -currently_open_class (t) - tree t; -{ - int i; - if (t == current_class_type) - return 1; - for (i = 0; i < current_class_depth; ++i) - if (current_class_stack [i].type == t) - return 1; - return 0; -} - -/* When entering a class scope, all enclosing class scopes' names with - static meaning (static variables, static functions, types and enumerators) - have to be visible. This recursive function calls pushclass for all - enclosing class contexts until global or a local scope is reached. - TYPE is the enclosed class and MODIFY is equivalent with the pushclass - formal of the same name. */ - -void -push_nested_class (type, modify) - tree type; - int modify; -{ - tree context; - - /* A namespace might be passed in error cases, like A::B:C. */ - if (type == NULL_TREE || type == error_mark_node || ! IS_AGGR_TYPE (type) - || TREE_CODE (type) == NAMESPACE_DECL - || TREE_CODE (type) == TEMPLATE_TYPE_PARM - || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM) - return; - - context = DECL_CONTEXT (TYPE_MAIN_DECL (type)); - - if (context && CLASS_TYPE_P (context)) - push_nested_class (context, 2); - pushclass (type, modify); -} - -/* Undoes a push_nested_class call. MODIFY is passed on to popclass. */ - -void -pop_nested_class () -{ - tree context = DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type)); - - popclass (); - if (context && CLASS_TYPE_P (context)) - pop_nested_class (); -} - -/* Set global variables CURRENT_LANG_NAME to appropriate value - so that behavior of name-mangling machinery is correct. */ - -void -push_lang_context (name) - tree name; -{ - *current_lang_stack++ = current_lang_name; - if (current_lang_stack >= current_lang_base + current_lang_stacksize) - { - current_lang_base - = (tree *)xrealloc (current_lang_base, - sizeof (tree) * (current_lang_stacksize + 10)); - current_lang_stack = current_lang_base + current_lang_stacksize; - current_lang_stacksize += 10; - } - - if (name == lang_name_cplusplus) - { - strict_prototype = strict_prototypes_lang_cplusplus; - current_lang_name = name; - } - else if (name == lang_name_java) - { - strict_prototype = strict_prototypes_lang_cplusplus; - current_lang_name = name; - /* DECL_IGNORED_P is initially set for these types, to avoid clutter. - (See record_builtin_java_type in decl.c.) However, that causes - incorrect debug entries if these types are actually used. - So we re-enable debug output after extern "Java". */ - DECL_IGNORED_P (java_byte_type_node) = 0; - DECL_IGNORED_P (java_short_type_node) = 0; - DECL_IGNORED_P (java_int_type_node) = 0; - DECL_IGNORED_P (java_long_type_node) = 0; - DECL_IGNORED_P (java_float_type_node) = 0; - DECL_IGNORED_P (java_double_type_node) = 0; - DECL_IGNORED_P (java_char_type_node) = 0; - DECL_IGNORED_P (java_boolean_type_node) = 0; - } - else if (name == lang_name_c) - { - strict_prototype = strict_prototypes_lang_c; - current_lang_name = name; - } - else - error ("language string `\"%s\"' not recognized", IDENTIFIER_POINTER (name)); -} - -/* Get out of the current language scope. */ - -void -pop_lang_context () -{ - current_lang_name = *--current_lang_stack; - if (current_lang_name == lang_name_cplusplus - || current_lang_name == lang_name_java) - strict_prototype = strict_prototypes_lang_cplusplus; - else if (current_lang_name == lang_name_c) - strict_prototype = strict_prototypes_lang_c; -} - -/* Type instantiation routines. */ - -/* Given an OVERLOAD and a TARGET_TYPE, return the function that - matches the TARGET_TYPE. If there is no satisfactory match, return - error_mark_node, and issue an error message if COMPLAIN is - non-zero. If TEMPLATE_ONLY, the name of the overloaded function - was a template-id, and EXPLICIT_TARGS are the explicitly provided - template arguments. */ - -static tree -resolve_address_of_overloaded_function (target_type, - overload, - complain, - template_only, - explicit_targs) - tree target_type; - tree overload; - int complain; - int template_only; - tree explicit_targs; -{ - /* Here's what the standard says: - - [over.over] - - If the name is a function template, template argument deduction - is done, and if the argument deduction succeeds, the deduced - arguments are used to generate a single template function, which - is added to the set of overloaded functions considered. - - Non-member functions and static member functions match targets of - type "pointer-to-function" or "reference-to-function." Nonstatic - member functions match targets of type "pointer-to-member - function;" the function type of the pointer to member is used to - select the member function from the set of overloaded member - functions. If a nonstatic member function is selected, the - reference to the overloaded function name is required to have the - form of a pointer to member as described in 5.3.1. - - If more than one function is selected, any template functions in - the set are eliminated if the set also contains a non-template - function, and any given template function is eliminated if the - set contains a second template function that is more specialized - than the first according to the partial ordering rules 14.5.5.2. - After such eliminations, if any, there shall remain exactly one - selected function. */ - - int is_ptrmem = 0; - int is_reference = 0; - /* We store the matches in a TREE_LIST rooted here. The functions - are the TREE_PURPOSE, not the TREE_VALUE, in this list, for easy - interoperability with most_specialized_instantiation. */ - tree matches = NULL_TREE; - tree fn; - - /* By the time we get here, we should be seeing only real - pointer-to-member types, not the internal POINTER_TYPE to - METHOD_TYPE representation. */ - my_friendly_assert (!(TREE_CODE (target_type) == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (target_type)) - == METHOD_TYPE)), 0); - - /* Check that the TARGET_TYPE is reasonable. */ - if (TYPE_PTRFN_P (target_type)) - /* This is OK. */ - ; - else if (TYPE_PTRMEMFUNC_P (target_type)) - /* This is OK, too. */ - is_ptrmem = 1; - else if (TREE_CODE (target_type) == FUNCTION_TYPE) - { - /* This is OK, too. This comes from a conversion to reference - type. */ - target_type = build_reference_type (target_type); - is_reference = 1; - } - else - { - if (complain) - cp_error("cannot resolve overloaded function `%D' based on conversion to type `%T'", - DECL_NAME (OVL_FUNCTION (overload)), target_type); - return error_mark_node; - } - - /* If we can find a non-template function that matches, we can just - use it. There's no point in generating template instantiations - if we're just going to throw them out anyhow. But, of course, we - can only do this when we don't *need* a template function. */ - if (!template_only) - { - tree fns; - - for (fns = overload; fns; fns = OVL_CHAIN (fns)) - { - tree fn = OVL_FUNCTION (fns); - tree fntype; - - if (TREE_CODE (fn) == TEMPLATE_DECL) - /* We're not looking for templates just yet. */ - continue; - - if ((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE) - != is_ptrmem) - /* We're looking for a non-static member, and this isn't - one, or vice versa. */ - continue; - - /* See if there's a match. */ - fntype = TREE_TYPE (fn); - if (is_ptrmem) - fntype = build_ptrmemfunc_type (build_pointer_type (fntype)); - else if (!is_reference) - fntype = build_pointer_type (fntype); - - if (can_convert_arg (target_type, fntype, fn)) - matches = scratch_tree_cons (fn, NULL_TREE, matches); - } - } - - /* Now, if we've already got a match (or matches), there's no need - to proceed to the template functions. But, if we don't have a - match we need to look at them, too. */ - if (!matches) - { - tree target_fn_type; - tree target_arg_types; - tree fns; - - if (is_ptrmem) - target_fn_type - = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (target_type)); - else - target_fn_type = TREE_TYPE (target_type); - target_arg_types = TYPE_ARG_TYPES (target_fn_type); - - for (fns = overload; fns; fns = OVL_CHAIN (fns)) - { - tree fn = OVL_FUNCTION (fns); - tree instantiation; - tree instantiation_type; - tree targs; - - if (TREE_CODE (fn) != TEMPLATE_DECL) - /* We're only looking for templates. */ - continue; - - if ((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE) - != is_ptrmem) - /* We're not looking for a non-static member, and this is - one, or vice versa. */ - continue; - - /* Try to do argument deduction. */ - targs = make_scratch_vec (DECL_NTPARMS (fn)); - if (fn_type_unification (fn, explicit_targs, targs, - target_arg_types, NULL_TREE, - DEDUCE_EXACT) != 0) - /* Argument deduction failed. */ - continue; - - /* Instantiate the template. */ - instantiation = instantiate_template (fn, targs); - if (instantiation == error_mark_node) - /* Instantiation failed. */ - continue; - - /* See if there's a match. */ - instantiation_type = TREE_TYPE (instantiation); - if (is_ptrmem) - instantiation_type = - build_ptrmemfunc_type (build_pointer_type (instantiation_type)); - else if (!is_reference) - instantiation_type = build_pointer_type (instantiation_type); - if (can_convert_arg (target_type, instantiation_type, instantiation)) - matches = scratch_tree_cons (instantiation, fn, matches); - } - - /* Now, remove all but the most specialized of the matches. */ - if (matches) - { - tree match = most_specialized_instantiation (matches, - explicit_targs); - - if (match != error_mark_node) - matches = scratch_tree_cons (match, NULL_TREE, NULL_TREE); - } - } - - /* Now we should have exactly one function in MATCHES. */ - if (matches == NULL_TREE) - { - /* There were *no* matches. */ - if (complain) - { - cp_error ("no matches converting function `%D' to type `%#T'", - DECL_NAME (OVL_FUNCTION (overload)), - target_type); - - /* print_candidates expects a chain with the functions in - TREE_VALUE slots, so we cons one up here (we're losing anyway, - so why be clever?). */ - for (; overload; overload = OVL_NEXT (overload)) - matches = scratch_tree_cons (NULL_TREE, OVL_CURRENT (overload), - matches); - - print_candidates (matches); - } - return error_mark_node; - } - else if (TREE_CHAIN (matches)) - { - /* There were too many matches. */ - - if (complain) - { - tree match; - - cp_error ("converting overloaded function `%D' to type `%#T' is ambiguous", - DECL_NAME (OVL_FUNCTION (overload)), - target_type); - - /* Since print_candidates expects the functions in the - TREE_VALUE slot, we flip them here. */ - for (match = matches; match; match = TREE_CHAIN (match)) - TREE_VALUE (match) = TREE_PURPOSE (match); - - print_candidates (matches); - } - - return error_mark_node; - } - - /* Good, exactly one match. Now, convert it to the correct type. */ - fn = TREE_PURPOSE (matches); - - mark_used (fn); - - if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type)) - return build_unary_op (ADDR_EXPR, fn, 0); - else - { - /* The target must be a REFERENCE_TYPE. Above, build_unary_op - will mark the function as addressed, but here we must do it - explicitly. */ - mark_addressable (fn); - - return fn; - } -} - -/* This function will instantiate the type of the expression given in - RHS to match the type of LHSTYPE. If errors exist, then return - error_mark_node. We only complain is COMPLAIN is set. If we are - not complaining, never modify rhs, as overload resolution wants to - try many possible instantiations, in hopes that at least one will - work. - - FLAGS is a bitmask, as we see at the top of the function. - - For non-recursive calls, LHSTYPE should be a function, pointer to - function, or a pointer to member function. */ - -tree -instantiate_type (lhstype, rhs, flags) - tree lhstype, rhs; - int flags; -{ - int complain = (flags & 1); - int strict = (flags & 2) ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT; - - if (TREE_CODE (lhstype) == UNKNOWN_TYPE) - { - if (complain) - error ("not enough type information"); - return error_mark_node; - } - - if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs))) - { - if (comptypes (lhstype, TREE_TYPE (rhs), strict)) - return rhs; - if (complain) - cp_error ("argument of type `%T' does not match `%T'", - TREE_TYPE (rhs), lhstype); - return error_mark_node; - } - - /* We don't overwrite rhs if it is an overloaded function. - Copying it would destroy the tree link. */ - if (TREE_CODE (rhs) != OVERLOAD) - rhs = copy_node (rhs); - - /* This should really only be used when attempting to distinguish - what sort of a pointer to function we have. For now, any - arithmetic operation which is not supported on pointers - is rejected as an error. */ - - switch (TREE_CODE (rhs)) - { - case TYPE_EXPR: - case CONVERT_EXPR: - case SAVE_EXPR: - case CONSTRUCTOR: - case BUFFER_REF: - my_friendly_abort (177); - return error_mark_node; - - case INDIRECT_REF: - case ARRAY_REF: - { - tree new_rhs; - - new_rhs = instantiate_type (build_pointer_type (lhstype), - TREE_OPERAND (rhs, 0), flags); - if (new_rhs == error_mark_node) - return error_mark_node; - - TREE_TYPE (rhs) = lhstype; - TREE_OPERAND (rhs, 0) = new_rhs; - return rhs; - } - - case NOP_EXPR: - rhs = copy_node (TREE_OPERAND (rhs, 0)); - TREE_TYPE (rhs) = unknown_type_node; - return instantiate_type (lhstype, rhs, flags); - - case COMPONENT_REF: - { - tree field = TREE_OPERAND (rhs, 1); - tree r; - - r = instantiate_type (lhstype, field, flags); - - if (r != error_mark_node && TYPE_PTRMEMFUNC_P (lhstype)) - { - if (complain) - { - tree t = TYPE_PTRMEMFUNC_OBJECT_TYPE (lhstype); - - if (TREE_CODE (field) == OVERLOAD) - field = OVL_FUNCTION (field); - if (TREE_CODE (field) == FUNCTION_DECL) - { - cp_pedwarn ("object-dependent reference `%E' can only be used in a call", - DECL_NAME (field)); - cp_pedwarn (" to form a pointer to member function, say `&%T::%E'", - t, DECL_NAME (field)); - } - else - cp_pedwarn ("object-dependent reference can only be used in a call"); - } - return r; - } - - return r; - } - - case OFFSET_REF: - rhs = TREE_OPERAND (rhs, 1); - if (BASELINK_P (rhs)) - return instantiate_type (lhstype, TREE_VALUE (rhs), flags); - - /* This can happen if we are forming a pointer-to-member for a - member template. */ - my_friendly_assert (TREE_CODE (rhs) == TEMPLATE_ID_EXPR, 0); - - /* Fall through. */ - - case TEMPLATE_ID_EXPR: - return - resolve_address_of_overloaded_function (lhstype, - TREE_OPERAND (rhs, 0), - complain, - /*template_only=*/1, - TREE_OPERAND (rhs, 1)); - - case OVERLOAD: - return - resolve_address_of_overloaded_function (lhstype, - rhs, - complain, - /*template_only=*/0, - /*explicit_targs=*/NULL_TREE); - - case TREE_LIST: - /* Now we should have a baselink. */ - my_friendly_assert (BASELINK_P (rhs), 990412); - - return instantiate_type (lhstype, TREE_VALUE (rhs), flags); - - case CALL_EXPR: - /* This is too hard for now. */ - my_friendly_abort (183); - return error_mark_node; - - case PLUS_EXPR: - case MINUS_EXPR: - case COMPOUND_EXPR: - TREE_OPERAND (rhs, 0) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags); - if (TREE_OPERAND (rhs, 0) == error_mark_node) - return error_mark_node; - TREE_OPERAND (rhs, 1) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags); - if (TREE_OPERAND (rhs, 1) == error_mark_node) - return error_mark_node; - - TREE_TYPE (rhs) = lhstype; - return rhs; - - case MULT_EXPR: - case TRUNC_DIV_EXPR: - case FLOOR_DIV_EXPR: - case CEIL_DIV_EXPR: - case ROUND_DIV_EXPR: - case RDIV_EXPR: - case TRUNC_MOD_EXPR: - case FLOOR_MOD_EXPR: - case CEIL_MOD_EXPR: - case ROUND_MOD_EXPR: - case FIX_ROUND_EXPR: - case FIX_FLOOR_EXPR: - case FIX_CEIL_EXPR: - case FIX_TRUNC_EXPR: - case FLOAT_EXPR: - case NEGATE_EXPR: - case ABS_EXPR: - case MAX_EXPR: - case MIN_EXPR: - case FFS_EXPR: - - case BIT_AND_EXPR: - case BIT_IOR_EXPR: - case BIT_XOR_EXPR: - case LSHIFT_EXPR: - case RSHIFT_EXPR: - case LROTATE_EXPR: - case RROTATE_EXPR: - - case PREINCREMENT_EXPR: - case PREDECREMENT_EXPR: - case POSTINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - if (complain) - error ("invalid operation on uninstantiated type"); - return error_mark_node; - - case TRUTH_AND_EXPR: - case TRUTH_OR_EXPR: - case TRUTH_XOR_EXPR: - case LT_EXPR: - case LE_EXPR: - case GT_EXPR: - case GE_EXPR: - case EQ_EXPR: - case NE_EXPR: - case TRUTH_ANDIF_EXPR: - case TRUTH_ORIF_EXPR: - case TRUTH_NOT_EXPR: - if (complain) - error ("not enough type information"); - return error_mark_node; - - case COND_EXPR: - if (type_unknown_p (TREE_OPERAND (rhs, 0))) - { - if (complain) - error ("not enough type information"); - return error_mark_node; - } - TREE_OPERAND (rhs, 1) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags); - if (TREE_OPERAND (rhs, 1) == error_mark_node) - return error_mark_node; - TREE_OPERAND (rhs, 2) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 2), flags); - if (TREE_OPERAND (rhs, 2) == error_mark_node) - return error_mark_node; - - TREE_TYPE (rhs) = lhstype; - return rhs; - - case MODIFY_EXPR: - TREE_OPERAND (rhs, 1) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags); - if (TREE_OPERAND (rhs, 1) == error_mark_node) - return error_mark_node; - - TREE_TYPE (rhs) = lhstype; - return rhs; - - case ADDR_EXPR: - return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags); - - case ENTRY_VALUE_EXPR: - my_friendly_abort (184); - return error_mark_node; - - case ERROR_MARK: - return error_mark_node; - - default: - my_friendly_abort (185); - return error_mark_node; - } -} - -/* Return the name of the virtual function pointer field - (as an IDENTIFIER_NODE) for the given TYPE. Note that - this may have to look back through base types to find the - ultimate field name. (For single inheritance, these could - all be the same name. Who knows for multiple inheritance). */ - -static tree -get_vfield_name (type) - tree type; -{ - tree binfo = TYPE_BINFO (type); - char *buf; - - while (BINFO_BASETYPES (binfo) - && TYPE_VIRTUAL_P (BINFO_TYPE (BINFO_BASETYPE (binfo, 0))) - && ! TREE_VIA_VIRTUAL (BINFO_BASETYPE (binfo, 0))) - binfo = BINFO_BASETYPE (binfo, 0); - - type = BINFO_TYPE (binfo); - buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT) - + TYPE_NAME_LENGTH (type) + 2); - sprintf (buf, VFIELD_NAME_FORMAT, TYPE_NAME_STRING (type)); - return get_identifier (buf); -} - -void -print_class_statistics () -{ -#ifdef GATHER_STATISTICS - fprintf (stderr, "convert_harshness = %d\n", n_convert_harshness); - fprintf (stderr, "compute_conversion_costs = %d\n", n_compute_conversion_costs); - fprintf (stderr, "build_method_call = %d (inner = %d)\n", - n_build_method_call, n_inner_fields_searched); - if (n_vtables) - { - fprintf (stderr, "vtables = %d; vtable searches = %d\n", - n_vtables, n_vtable_searches); - fprintf (stderr, "vtable entries = %d; vtable elems = %d\n", - n_vtable_entries, n_vtable_elems); - } -#endif -} - -/* Push an obstack which is sufficiently long-lived to hold such class - decls that may be cached in the previous_class_values list. The - effect is undone by pop_obstacks. */ - -void -push_cache_obstack () -{ - static int cache_obstack_initialized; - - if (!cache_obstack_initialized) - { - gcc_obstack_init (&class_cache_obstack); - class_cache_firstobj - = (char*) obstack_finish (&class_cache_obstack); - cache_obstack_initialized = 1; - } - - push_obstacks_nochange (); - current_obstack = &class_cache_obstack; -} - -/* Build a dummy reference to ourselves so Derived::Base (and A::A) works, - according to [class]: - The class-name is also inserted - into the scope of the class itself. For purposes of access checking, - the inserted class name is treated as if it were a public member name. */ - -void -build_self_reference () -{ - tree name = constructor_name (current_class_type); - tree value = build_lang_decl (TYPE_DECL, name, current_class_type); - tree saved_cas; - - DECL_NONLOCAL (value) = 1; - DECL_CONTEXT (value) = current_class_type; - DECL_CLASS_CONTEXT (value) = current_class_type; - DECL_ARTIFICIAL (value) = 1; - - saved_cas = current_access_specifier; - current_access_specifier = access_public_node; - finish_member_declaration (value); - current_access_specifier = saved_cas; -} - -/* Returns 1 if TYPE contains only padding bytes. */ - -int -is_empty_class (type) - tree type; -{ - tree t; - - if (type == error_mark_node) - return 0; - - if (! IS_AGGR_TYPE (type)) - return 0; - - if (flag_new_abi) - return CLASSTYPE_SIZE (type) == integer_zero_node; - - if (TYPE_BINFO_BASETYPES (type)) - return 0; - t = TYPE_FIELDS (type); - while (t && TREE_CODE (t) != FIELD_DECL) - t = TREE_CHAIN (t); - return (t == NULL_TREE); -} - -/* Find the enclosing class of the given NODE. NODE can be a *_DECL or - a *_TYPE node. NODE can also be a local class. */ - -tree -get_enclosing_class (type) - tree type; -{ - tree node = type; - - while (node && TREE_CODE (node) != NAMESPACE_DECL) - { - switch (TREE_CODE_CLASS (TREE_CODE (node))) - { - case 'd': - node = DECL_CONTEXT (node); - break; - - case 't': - if (node != type) - return node; - node = TYPE_CONTEXT (node); - break; - - default: - my_friendly_abort (0); - } - } - return NULL_TREE; -} - -/* Return 1 if TYPE or one of its enclosing classes is derived from BASE. */ - -int -is_base_of_enclosing_class (base, type) - tree base, type; -{ - while (type) - { - if (get_binfo (base, type, 0)) - return 1; - - type = get_enclosing_class (type); - } - return 0; -} - -/* Note that NAME was looked up while the current class was being - defined and that the result of that lookup was DECL. */ - -void -maybe_note_name_used_in_class (name, decl) - tree name; - tree decl; -{ - splay_tree names_used; - - /* If we're not defining a class, there's nothing to do. */ - if (!current_class_type || !TYPE_BEING_DEFINED (current_class_type)) - return; - - /* If there's already a binding for this NAME, then we don't have - anything to worry about. */ - if (IDENTIFIER_CLASS_VALUE (name)) - return; - - if (!current_class_stack[current_class_depth - 1].names_used) - current_class_stack[current_class_depth - 1].names_used - = splay_tree_new (splay_tree_compare_pointers, 0, 0); - names_used = current_class_stack[current_class_depth - 1].names_used; - - splay_tree_insert (names_used, - (splay_tree_key) name, - (splay_tree_value) decl); -} - -/* Note that NAME was declared (as DECL) in the current class. Check - to see that the declaration is legal. */ - -void -note_name_declared_in_class (name, decl) - tree name; - tree decl; -{ - splay_tree names_used; - splay_tree_node n; - - /* Look to see if we ever used this name. */ - names_used - = current_class_stack[current_class_depth - 1].names_used; - if (!names_used) - return; - - n = splay_tree_lookup (names_used, (splay_tree_key) name); - if (n) - { - /* [basic.scope.class] - - A name N used in a class S shall refer to the same declaration - in its context and when re-evaluated in the completed scope of - S. */ - cp_error ("declaration of `%#D'", decl); - cp_error_at ("changes meaning of `%s' from `%+#D'", - IDENTIFIER_POINTER (DECL_NAME (decl)), - (tree) n->value); - } -} diff --git a/contrib/gcc/cp/class.h b/contrib/gcc/cp/class.h deleted file mode 100644 index f2c21735cc4c..000000000000 --- a/contrib/gcc/cp/class.h +++ /dev/null @@ -1,117 +0,0 @@ -/* Variables and structures for overloading rules. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* The following structure is used when comparing various alternatives - for overloading. The unsigned quantity `strikes.i' is used - for fast comparison of two possibilities. This number is an - aggregate of four constituents: - - EVIL: if this is non-zero, then the candidate should not be considered - ELLIPSIS: if this is non-zero, then some actual argument has been matched - against an ellipsis - USER: if this is non-zero, then a user-defined type conversion is needed - B_OR_D: if this is non-zero, then use a base pointer instead of the - type of the pointer we started with. - EASY: if this is non-zero, then we have a builtin conversion - (such as int to long, int to float, etc) to do. - - If two candidates require user-defined type conversions, and the - type conversions are not identical, then an ambiguity error - is reported. - - If two candidates agree on user-defined type conversions, - and one uses pointers of strictly higher type (derived where - another uses base), then that alternative is silently chosen. - - Note that this technique really only works for 255 arguments. Perhaps - this is not enough. */ - -/* These macros and harshness_code are used by the NEW METHOD. */ -#define EVIL_CODE (1<<7) -#define CONST_CODE (1<<6) -#define ELLIPSIS_CODE (1<<5) -#define USER_CODE (1<<4) -#define STD_CODE (1<<3) -#define PROMO_CODE (1<<2) -#define QUAL_CODE (1<<1) -#define TRIVIAL_CODE (1<<0) - -struct harshness_code -{ - /* What kind of conversion is involved. */ - unsigned short code; - - /* The inheritance distance. */ - short distance; - - /* For a PROMO_CODE, Any special penalties involved in integral conversions. - This exists because $4.1 of the ARM states that something like - `short unsigned int' should promote to `int', not `unsigned int'. - If, for example, it tries to match two fns, f(int) and f(unsigned), - f(int) should be a better match than f(unsigned) by this rule. Without - this extra metric, they both only appear as "integral promotions", which - will lead to an ambiguity. - For a TRIVIAL_CODE, This is also used by build_overload_call_real and - convert_harshness to keep track of other information we need. */ - unsigned short int_penalty; -}; - -struct candidate -{ - struct harshness_code h; /* Used for single-argument conversions. */ - - int h_len; /* The length of the harshness vector. */ - - tree function; /* A FUNCTION_DECL */ - tree basetypes; /* The path to function. */ - tree arg; /* first parm to function. */ - - /* Indexed by argument number, encodes evil, user, d_to_b, and easy - strikes for that argument. At end of array, we store the index+1 - of where we started using default parameters, or 0 if there are - none. */ - struct harshness_code *harshness; - - union - { - tree field; /* If no evil strikes, the FUNCTION_DECL of - the function (if a member function). */ - int bad_arg; /* the index of the first bad argument: - 0 if no bad arguments - > 0 is first bad argument - -1 if extra actual arguments - -2 if too few actual arguments. - -3 if const/non const method mismatch. - -4 if type unification failed. - -5 if contravariance violation. */ - } u; -}; -int rank_for_overload (); - -/* Variables shared between class.c and call.c. */ - -extern int n_vtables; -extern int n_vtable_entries; -extern int n_vtable_searches; -extern int n_vtable_elems; -extern int n_convert_harshness; -extern int n_compute_conversion_costs; -extern int n_build_method_call; -extern int n_inner_fields_searched; diff --git a/contrib/gcc/cp/config-lang.in b/contrib/gcc/cp/config-lang.in deleted file mode 100644 index dd31af4f986f..000000000000 --- a/contrib/gcc/cp/config-lang.in +++ /dev/null @@ -1,41 +0,0 @@ -# Top level configure fragment for GNU C++. -# Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc. - -#This file is part of GNU CC. - -#GNU CC 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. - -#GNU CC 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. - -#You should have received a copy of the GNU General Public License -#along with GNU CC; see the file COPYING. If not, write to -#the Free Software Foundation, 59 Temple Place - Suite 330, -#Boston, MA 02111-1307, USA. - -# Configure looks for the existence of this file to auto-config each language. -# We define several parameters used by configure: -# -# language - name of language as it would appear in $(LANGUAGES) -# compilers - value to add to $(COMPILERS) -# stagestuff - files to add to $(STAGESTUFF) -# diff_excludes - files to ignore when building diffs between two versions. - -language="c++" - -compilers="cc1plus\$(exeext)" - -stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)" - -diff_excludes="-x parse.c -x parse.h" - -headers='$(CXX_EXTRA_HEADERS)' - -lib2funcs=cplib2.txt - -outputs=cp/Makefile diff --git a/contrib/gcc/cp/cp-tree.def b/contrib/gcc/cp/cp-tree.def deleted file mode 100644 index 70801fc9563c..000000000000 --- a/contrib/gcc/cp/cp-tree.def +++ /dev/null @@ -1,258 +0,0 @@ -/* This file contains the definitions and documentation for the - additional tree codes used in the GNU C++ compiler (see tree.def - for the standard codes). - Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998 Free Software Foundation, Inc. - Hacked by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Reference to the contents of an offset - (a value whose type is an OFFSET_TYPE). - Operand 0 is the object within which the offset is taken. - Operand 1 is the offset. The language independent OFFSET_REF - just won't work for us. */ -DEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2) - -/* A pointer-to-member constant. For a pointer-to-member constant - `X::Y' The PTRMEM_CST_CLASS is the RECORD_TYPE for `X' and the - PTRMEM_CST_MEMBER is the _DECL for `Y'. */ -DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 1) - -/* For NEW_EXPR, operand 0 is the placement list. - Operand 1 is the new-declarator. - Operand 2 is the initializer. */ -DEFTREECODE (NEW_EXPR, "nw_expr", 'e', 3) -DEFTREECODE (VEC_NEW_EXPR, "vec_nw_expr", 'e', 3) - -/* For DELETE_EXPR, operand 0 is the store to be destroyed. - Operand 1 is the value to pass to the destroying function - saying whether the store should be deallocated as well. */ -DEFTREECODE (DELETE_EXPR, "dl_expr", 'e', 2) -DEFTREECODE (VEC_DELETE_EXPR, "vec_dl_expr", 'e', 2) - -/* Value is reference to particular overloaded class method. - Operand 0 is the class name (an IDENTIFIER_NODE); - operand 1 is the field (also an IDENTIFIER_NODE). - The COMPLEXITY field holds the class level (usually 0). */ -DEFTREECODE (SCOPE_REF, "scope_ref", 'r', 2) - -/* When composing an object with a member, this is the result. - Operand 0 is the object. Operand 1 is the member (usually - a dereferenced pointer to member). */ -DEFTREECODE (MEMBER_REF, "member_ref", 'r', 2) - -/* Type conversion operator in C++. TREE_TYPE is type that this - operator converts to. Operand is expression to be converted. */ -DEFTREECODE (TYPE_EXPR, "type_expr", 'e', 1) - -/* For AGGR_INIT_EXPR, operand 0 is function which performs initialization, - operand 1 is argument list to initialization function, - and operand 2 is the slot which was allocated for this expression. */ -DEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", 'e', 3) - -/* A throw expression. operand 0 is the expression, if there was one, - else it is NULL_TREE. */ -DEFTREECODE (THROW_EXPR, "throw_expr", 'e', 1) - -/* Initialization of a vector, used in build_new. Operand 0 is the target - of the initialization, operand 1 is the initializer, and operand 2 is - the number of elements. */ -DEFTREECODE (VEC_INIT_EXPR, "vec_init_expr", 'e', 3) - -/* Template definition. The following fields have the specified uses, - although there are other macros in cp-tree.h that should be used for - accessing this data. - DECL_ARGUMENTS template parm vector - DECL_TEMPLATE_INFO template text &c - DECL_VINDEX list of instantiations already produced; - only done for functions so far - For class template: - DECL_INITIAL associated templates (methods &c) - DECL_RESULT null - For non-class templates: - TREE_TYPE type of object to be constructed - DECL_RESULT decl for object to be created - (e.g., FUNCTION_DECL with tmpl parms used) - */ -DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0) - -/* Index into a template parameter list. The TEMPLATE_PARM_IDX gives - the index (from 0) of the parameter, while the TEMPLATE_PARM_LEVEL - gives the level (from 1) of the parameter. - - Here's an example: - - template // Index 0, Level 1. - struct S - { - template // Index 1, Level 2. - void f(); - }; - - The DESCENDANTS will be a chain of TEMPLATE_PARM_INDEXs descended - from this one. The first descendant will have the same IDX, but - its LEVEL will be one less. The TREE_CHAIN field is used to chain - together the descendants. The TEMPLATE_PARM_DECL is the - declaration of this parameter, either a TYPE_DECL or CONST_DECL. - The TEMPLATE_PARM_ORIG_LEVEL is the LEVEL of the most distant - parent, i.e., the LEVEL that the parameter originally had when it - was declared. For example, if we instantiate S, we will have: - - struct S - { - template // Index 1, Level 1, Orig Level 2 - void f(); - }; - - The LEVEL is the level of the parameter when we are worrying about - the types of things; the ORIG_LEVEL is the level when we are - worrying about instantiating things. */ -DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', - /* The addition of (sizeof(char*) - 1) in the next - expression is to ensure against the case where - sizeof(char*) does not evenly divide - sizeof(HOST_WIDE_INT). */ - 2 + ((3 * sizeof (HOST_WIDE_INT) + sizeof(char*) - 1) - / sizeof (char*))) - -/* Index into a template parameter list. This parameter must be a type. - The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX. */ -DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", 't', 0) - -/* Index into a template parameter list. This parameter must be a type. - If it is used in signature of a template, TEMPLATE_INFO is NULL_TREE. - Otherwise it is used to declare a type like TT. - The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX. */ -DEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", 't', 0) - -/* A type designated by `typename T::t'. TYPE_CONTEXT is `T', - TYPE_NAME is an IDENTIFIER_NODE for `t'. If the type was named via - template-id, TYPENAME_TYPE_FULLNAME will hold the TEMPLATE_ID_EXPR. - If TREE_TYPE is present, this type was generated by the implicit - typename extension, and the TREE_TYPE is a _TYPE from a baseclass - of `T'. */ -DEFTREECODE (TYPENAME_TYPE, "typename_type", 't', 0) - -/* A type designated by `__typeof (expr)'. TYPE_FIELDS is the - expression in question. */ -DEFTREECODE (TYPEOF_TYPE, "typeof_type", 't', 0) - -/* A thunk is a stub function. - - Thunks are used to implement multiple inheritance: - At run-time, such a thunk subtracts THUNK_DELTA (an int, not a tree) - from the this pointer, and then jumps to DECL_INITIAL - (which is an ADDR_EXPR whose operand is a FUNCTION_DECL). - - Other kinds of thunks may be defined later. */ -DEFTREECODE (THUNK_DECL, "thunk_decl", 'd', 0) - -/* A using declaration. DECL_INITIAL contains the specified scope. - This is not an alias, but is later expanded into multiple aliases. */ -DEFTREECODE (USING_DECL, "using_decl", 'd', 0) - -/* An un-parsed default argument. Looks like an IDENTIFIER_NODE. */ -DEFTREECODE (DEFAULT_ARG, "default_arg", 'c', 2) - -/* A template-id, like foo. The first operand is the template. - The second is the TREE_LIST or TREE_VEC of explicitly specified - arguments. The template will be a FUNCTION_DECL, TEMPLATE_DECL, or - an OVERLOAD. If the template-id refers to a member template, the - template may be an IDENTIFIER_NODE. */ -DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", 'e', 2) - -/* An association between name and entity. Parameters are the scope - and the (non-type) value. TREE_TYPE indicates the type bound to - the name. */ -DEFTREECODE (CPLUS_BINDING, "binding", 'x', 2) - -/* A list-like node for chaining overloading candidates. TREE_TYPE is - the original name, and the parameter is the FUNCTION_DECL. */ -DEFTREECODE (OVERLOAD, "overload", 'x', 1) - -/* A generic wrapper for something not tree that we want to include in - tree structure. */ -DEFTREECODE (WRAPPER, "wrapper", 'x', 1) - -/* A node to remember a source position. */ -DEFTREECODE (SRCLOC, "srcloc", 'x', 2) - -/* Used to represent deferred name lookup for dependent names while - parsing a template declaration. The first argument is an - IDENTIFIER_NODE for the name in question. The TREE_TYPE is - unused. */ -DEFTREECODE (LOOKUP_EXPR, "lookup_expr", 'e', 1) - -/* A whole bunch of tree codes for the initial, superficial parsing of - templates. */ -DEFTREECODE (MODOP_EXPR, "modop_expr", 'e', 3) -DEFTREECODE (CAST_EXPR, "cast_expr", '1', 1) -DEFTREECODE (REINTERPRET_CAST_EXPR, "reinterpret_cast_expr", '1', 1) -DEFTREECODE (CONST_CAST_EXPR, "const_cast_expr", '1', 1) -DEFTREECODE (STATIC_CAST_EXPR, "static_cast_expr", '1', 1) -DEFTREECODE (DYNAMIC_CAST_EXPR, "dynamic_cast_expr", '1', 1) -DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", '1', 1) -DEFTREECODE (ALIGNOF_EXPR, "alignof_expr", '1', 1) -DEFTREECODE (ARROW_EXPR, "arrow_expr", 'e', 1) -DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", 'e', 2) -DEFTREECODE (TYPEID_EXPR, "typeid_expr", 'e', 1) - -DEFTREECODE (EXPR_STMT, "expr_stmt", 'e', 1) -DEFTREECODE (COMPOUND_STMT, "compound_stmt", 'e', 1) -DEFTREECODE (DECL_STMT, "decl_stmt", 'e', 3) -DEFTREECODE (IF_STMT, "if_stmt", 'e', 3) -DEFTREECODE (FOR_STMT, "for_stmt", 'e', 4) -DEFTREECODE (WHILE_STMT, "while_stmt", 'e', 2) -DEFTREECODE (DO_STMT, "do_stmt", 'e', 2) -DEFTREECODE (RETURN_STMT, "return_stmt", 'e', 1) -DEFTREECODE (BREAK_STMT, "break_stmt", 'e', 0) -DEFTREECODE (CONTINUE_STMT, "continue_stmt", 'e', 0) -DEFTREECODE (SWITCH_STMT, "switch_stmt", 'e', 2) -DEFTREECODE (GOTO_STMT, "goto_stmt", 'e', 1) -DEFTREECODE (ASM_STMT, "asm_stmt", 'e', 5) - -DEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", 'e', 2) -DEFTREECODE (CASE_LABEL, "case_label", 'e', 2) -DEFTREECODE (RETURN_INIT, "return_init", 'e', 2) -DEFTREECODE (TRY_BLOCK, "try_stmt", 'e', 2) -DEFTREECODE (HANDLER, "catch_stmt", 'e', 2) - -DEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0) - -/* And some codes for expressing conversions for overload resolution. */ - -DEFTREECODE (IDENTITY_CONV, "identity_conv", 'e', 1) -DEFTREECODE (LVALUE_CONV, "lvalue_conv", 'e', 1) -DEFTREECODE (QUAL_CONV, "qual_conv", 'e', 1) -DEFTREECODE (STD_CONV, "std_conv", 'e', 1) -DEFTREECODE (PTR_CONV, "ptr_conv", 'e', 1) -DEFTREECODE (PMEM_CONV, "pmem_conv", 'e', 1) -DEFTREECODE (BASE_CONV, "base_conv", 'e', 1) -DEFTREECODE (REF_BIND, "ref_bind", 'e', 1) -DEFTREECODE (USER_CONV, "user_conv", 'e', 2) -DEFTREECODE (AMBIG_CONV, "ambig_conv", 'e', 1) -DEFTREECODE (RVALUE_CONV, "rvalue_conv", 'e', 1) - -/* -Local variables: -mode:c -End: -*/ diff --git a/contrib/gcc/cp/cp-tree.h b/contrib/gcc/cp/cp-tree.h deleted file mode 100644 index 8c1e7dfd7c1e..000000000000 --- a/contrib/gcc/cp/cp-tree.h +++ /dev/null @@ -1,3574 +0,0 @@ -/* Definitions for C++ parsing and type checking. - Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc. - Hacked by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef _CP_TREE_H -#define _CP_TREE_H - -/* Usage of TREE_LANG_FLAG_?: - 0: BINFO_MARKED (BINFO nodes). - COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT). - NEW_EXPR_USE_GLOBAL (in NEW_EXPR). - DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR). - LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR). - TREE_NEGATED_INT (in INTEGER_CST). - TREE_INDIRECT_USING (in NAMESPACE_DECL). - IDENTIFIER_MARKED (used by search routines). - LOCAL_BINDING_P (in CPLUS_BINDING) - 1: IDENTIFIER_VIRTUAL_P. - TI_PENDING_TEMPLATE_FLAG. - TEMPLATE_PARMS_FOR_INLINE. - DELETE_EXPR_USE_VEC (in DELETE_EXPR). - (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out). - TYPE_USES_COMPLEX_INHERITANCE (in _TYPE). - C_DECLARED_LABEL_FLAG. - INHERITED_VALUE_BINDING_P (in CPLUS_BINDING) - BASELINK_P (in TREE_LIST) - 2: IDENTIFIER_OPNAME_P. - BINFO_VBASE_MARKED. - BINFO_FIELDS_MARKED. - TYPE_VIRTUAL_P. - 3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE). - BINFO_VTABLE_PATH_MARKED. - BINFO_PUSHDECLS_MARKED. - (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). - 4: BINFO_NEW_VTABLE_MARKED. - TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, - or FIELD_DECL). - 5: TYPE_USES_PVBASES (in a class TYPE). - 6: Not used. - - Usage of TYPE_LANG_FLAG_?: - 0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE). - 1: TYPE_HAS_CONSTRUCTOR. - 2: TYPE_HAS_DESTRUCTOR. - 3: TYPE_FOR_JAVA. - 4: TYPE_NEEDS_DESTRUCTOR. - 5: IS_AGGR_TYPE. - 6: TYPE_BUILT_IN. - - Usage of DECL_LANG_FLAG_?: - 0: DECL_ERROR_REPORTED (in VAR_DECL). - DECL_TEMPLATE_PARM_P (in CONST_DECL, TYPE_DECL, or TEMPLATE_DECL) - 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL). - DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL) - 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL). - 3: DECL_IN_AGGR_P. - 4: DECL_MAYBE_TEMPLATE. - 5: DECL_INTERFACE_KNOWN. - 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL). - 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL). - - Usage of language-independent fields in a language-dependent manner: - - TYPE_ALIAS_SET - This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so - forth as a substitute for the mark bits provided in `lang_type'. - At present, only the six low-order bits are used. - - TYPE_BINFO - For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO. - For a TYPENAME_TYPE, this is TYPENAME_TYPE_FULLNAME. - For a TEMPLATE_TEMPLATE_PARM, this is - TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. - - DECL_SAVED_INSNS/DECL_FIELD_SIZE - For a static VAR_DECL, this is DECL_INIT_PRIORITY. -*/ - -/* Language-dependent contents of an identifier. */ - -struct lang_identifier -{ - struct tree_identifier ignore; - tree namespace_bindings; - tree bindings; - tree class_value; - tree class_template_info; - struct lang_id2 *x; -}; - -struct lang_id2 -{ - tree label_value, implicit_decl; - tree error_locus; -}; - -typedef struct -{ - tree t; - int new_type_flag; -} flagged_type_tree; - -typedef struct -{ - char common[sizeof (struct tree_common)]; - struct rtx_def *rtl; /* Unused, but required to match up with what - the middle-end expects. */ - HOST_WIDE_INT index; - HOST_WIDE_INT level; - HOST_WIDE_INT orig_level; - tree decl; -} template_parm_index; - -typedef struct ptrmem_cst -{ - char common[sizeof (struct tree_common)]; - tree member; -}* ptrmem_cst_t; - -/* Nonzero if this binding is for a local scope, as opposed to a class - or namespace scope. */ -#define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0(NODE) - -/* Nonzero if BINDING_VALUE is from a base class of the class which is - currently being defined. */ -#define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1(NODE) - -/* For a binding between a name and an entity at a non-local scope, - defines the scope where the binding is declared. (Either a class - _TYPE node, or a NAMESPACE_DECL.) This macro should be used only - for namespace-level bindings; on the IDENTIFIER_BINDING list - BINDING_LEVEL is used instead. */ -#define BINDING_SCOPE(NODE) (((struct tree_binding*)NODE)->scope.scope) - -/* This is the declaration bound to the name. Possible values: - variable, overloaded function, namespace, template, enumerator. */ -#define BINDING_VALUE(NODE) (((struct tree_binding*)NODE)->value) - -/* If name is bound to a type, this is the type (struct, union, enum). */ -#define BINDING_TYPE(NODE) TREE_TYPE(NODE) - -#define IDENTIFIER_GLOBAL_VALUE(NODE) \ - namespace_binding (NODE, global_namespace) -#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \ - set_namespace_binding (NODE, global_namespace, VAL) -#define IDENTIFIER_NAMESPACE_VALUE(NODE) \ - namespace_binding (NODE, current_namespace) -#define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \ - set_namespace_binding (NODE, current_namespace, VAL) - -struct tree_binding -{ - char common[sizeof (struct tree_common)]; - union { - tree scope; - struct binding_level *level; - } scope; - tree value; -}; - -/* The overloaded FUNCTION_DECL. */ -#define OVL_FUNCTION(NODE) (((struct tree_overload*)NODE)->function) -#define OVL_CHAIN(NODE) TREE_CHAIN(NODE) -/* Polymorphic access to FUNCTION and CHAIN. */ -#define OVL_CURRENT(NODE) \ - ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE) -#define OVL_NEXT(NODE) \ - ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE) -/* If set, this was imported in a using declaration. - This is not to confuse with being used somewhere, which - is not important for this node. */ -#define OVL_USED(NODE) TREE_USED(NODE) - -struct tree_overload -{ - char common[sizeof (struct tree_common)]; - tree function; -}; - -/* A `baselink' is a TREE_LIST whose TREE_PURPOSE is a BINFO - indicating a particular base class, and whose TREE_VALUE is a - (possibly overloaded) function from that base class. */ -#define BASELINK_P(NODE) \ - (TREE_CODE ((NODE)) == TREE_LIST && TREE_LANG_FLAG_1 ((NODE))) -#define SET_BASELINK_P(NODE) \ - (TREE_LANG_FLAG_1 ((NODE)) = 1) - -#define WRAPPER_PTR(NODE) (((struct tree_wrapper*)NODE)->u.ptr) -#define WRAPPER_INT(NODE) (((struct tree_wrapper*)NODE)->u.i) - -struct tree_wrapper -{ - char common[sizeof (struct tree_common)]; - union { - void *ptr; - int i; - } u; -}; - -#define SRCLOC_FILE(NODE) (((struct tree_srcloc*)NODE)->filename) -#define SRCLOC_LINE(NODE) (((struct tree_srcloc*)NODE)->linenum) -struct tree_srcloc -{ - char common[sizeof (struct tree_common)]; - char *filename; - int linenum; -}; - -/* To identify to the debug emitters if it should pay attention to the - flag `-Wtemplate-debugging'. */ -#define HAVE_TEMPLATES 1 - -/* Macros for access to language-specific slots in an identifier. */ - -#define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \ - (((struct lang_identifier *)(NODE))->namespace_bindings) -#define IDENTIFIER_TEMPLATE(NODE) \ - (((struct lang_identifier *)(NODE))->class_template_info) - -/* The IDENTIFIER_BINDING is the innermost CPLUS_BINDING for the - identifier. It's TREE_CHAIN is the next outermost binding. Each - BINDING_VALUE is a DECL for the associated declaration. Thus, - name lookup consists simply of pulling off the node at the front - of the list (modulo oddities for looking up the names of types, - and such.) You can use BINDING_SCOPE or BINDING_LEVEL to - determine the scope that bound the name. */ -#define IDENTIFIER_BINDING(NODE) \ - (((struct lang_identifier*) (NODE))->bindings) - -/* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or - NULL_TREE if there is no binding. */ -#define IDENTIFIER_VALUE(NODE) \ - (IDENTIFIER_BINDING (NODE) \ - ? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) \ - : NULL_TREE) - -/* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current - class, and IDENTIFIER_CLASS_VALUE is the value binding. This is - just a pointer to the BINDING_VALUE of one of the bindings in the - IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is - IDENTIFIER_BINDING. */ -#define IDENTIFIER_CLASS_VALUE(NODE) \ - (((struct lang_identifier *) (NODE))->class_value) - -/* The amount of time used by the file whose special "time identifier" - is NODE, represented as an INTEGER_CST. See get_time_identifier. */ -#define TIME_IDENTIFIER_TIME(NODE) IDENTIFIER_BINDING(NODE) - -/* For a "time identifier" this is a INTEGER_CST. The - TREE_INT_CST_LOW is 1 if the corresponding file is "interface only". - The TRE_INT_CST_HIGH is 1 if it is "interface unknown". */ -#define TIME_IDENTIFIER_FILEINFO(NODE) IDENTIFIER_CLASS_VALUE (NODE) - -/* TREE_TYPE only indicates on local and class scope the current - type. For namespace scope, the presence of a type in any namespace - is indicated with global_type_node, and the real type behind must - be found through lookup. */ -#define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE)) -#define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE)) -#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE) -#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0) - -#define LANG_ID_FIELD(NAME,NODE) \ - (((struct lang_identifier *)(NODE))->x \ - ? ((struct lang_identifier *)(NODE))->x->NAME : 0) -#define SET_LANG_ID(NODE,VALUE,NAME) \ - (((struct lang_identifier *)(NODE))->x == 0 \ - ? ((struct lang_identifier *)(NODE))->x \ - = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \ - ((struct lang_identifier *)(NODE))->x->NAME = (VALUE)) - -#define IDENTIFIER_LABEL_VALUE(NODE) LANG_ID_FIELD(label_value, NODE) -#define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \ - SET_LANG_ID(NODE, VALUE, label_value) - -#define IDENTIFIER_IMPLICIT_DECL(NODE) LANG_ID_FIELD(implicit_decl, NODE) -#define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \ - SET_LANG_ID(NODE, VALUE, implicit_decl) - -#define IDENTIFIER_ERROR_LOCUS(NODE) LANG_ID_FIELD(error_locus, NODE) -#define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \ - SET_LANG_ID(NODE, VALUE, error_locus) - - -#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE) - -/* Nonzero if this identifier is the prefix for a mangled C++ operator name. */ -#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE) - -/* Nonzero if this identifier is the name of a type-conversion - operator. */ -#define IDENTIFIER_TYPENAME_P(NODE) \ - (! strncmp (IDENTIFIER_POINTER (NODE), \ - OPERATOR_TYPENAME_FORMAT, \ - strlen (OPERATOR_TYPENAME_FORMAT))) - -/* Nonzero means reject anything that ANSI standard C forbids. */ -extern int pedantic; - -/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ -#define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type) - -/* Record in each node resulting from a binary operator - what operator was specified for it. */ -#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp)) - -/* Store a value in that field. */ -#define C_SET_EXP_ORIGINAL_CODE(exp, code) \ - (TREE_COMPLEXITY (exp) = (int)(code)) - -/* If non-zero, a VAR_DECL whose cleanup will cause a throw to the - next exception handler. */ -extern tree exception_throw_decl; - -extern tree double_type_node, long_double_type_node, float_type_node; -extern tree char_type_node, unsigned_char_type_node, signed_char_type_node; -extern tree ptrdiff_type_node; - -extern tree short_integer_type_node, short_unsigned_type_node; -extern tree long_integer_type_node, long_unsigned_type_node; -extern tree long_long_integer_type_node, long_long_unsigned_type_node; -extern tree unsigned_type_node; -extern tree string_type_node, char_array_type_node, int_array_type_node; -extern tree wchar_array_type_node; -extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node; - -extern tree complex_integer_type_node; -extern tree complex_float_type_node; -extern tree complex_double_type_node; -extern tree complex_long_double_type_node; - -extern tree intQI_type_node, unsigned_intQI_type_node; -extern tree intHI_type_node, unsigned_intHI_type_node; -extern tree intSI_type_node, unsigned_intSI_type_node; -extern tree intDI_type_node, unsigned_intDI_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -extern tree intTI_type_node, unsigned_intTI_type_node; -#endif - -extern tree java_byte_type_node; -extern tree java_short_type_node; -extern tree java_int_type_node; -extern tree java_long_type_node; -extern tree java_float_type_node; -extern tree java_double_type_node; -extern tree java_char_type_node; -extern tree java_boolean_type_node; - -extern int current_function_returns_value; -extern int current_function_returns_null; -extern tree current_function_return_value; - -extern tree current_namespace; -extern tree global_namespace; - -extern tree ridpointers[]; -extern tree ansi_opname[]; -extern tree ansi_assopname[]; - -/* Nonzero means `$' can be in an identifier. */ - -extern int dollars_in_ident; - -/* Nonzero means allow type mismatches in conditional expressions; - just make their values `void'. */ - -extern int flag_cond_mismatch; - -/* Nonzero means don't recognize the keyword `asm'. */ - -extern int flag_no_asm; - -/* For cross referencing. */ - -extern int flag_gnu_xref; - -/* For environments where you can use GNU binutils (as, ld in particular). */ - -extern int flag_gnu_binutils; - -/* Nonzero means warn about implicit declarations. */ - -extern int warn_implicit; - -/* Nonzero means warn about usage of long long when `-pedantic'. */ - -extern int warn_long_long; - -/* Nonzero means warn when all ctors or dtors are private, and the class - has no friends. */ - -extern int warn_ctor_dtor_privacy; - -/* Nonzero means warn about function definitions that default the return type - or that use a null return and have a return-type other than void. */ - -extern int warn_return_type; - -/* Nonzero means give string constants the type `const char *', as mandated - by the standard. */ - -extern int flag_const_strings; - -/* Nonzero means warn about deprecated conversion from string constant to - `char *'. */ - -extern int warn_write_strings; - -/* Nonzero means warn about sizeof(function) or addition/subtraction - of function pointers. */ - -extern int warn_pointer_arith; - -/* Nonzero means warn about suggesting putting in ()'s. */ - -extern int warn_parentheses; - -/* Nonzero means warn about multiple (redundant) decls for the same single - variable or function. */ - -extern int warn_redundant_decls; - -/* Warn if initializer is not completely bracketed. */ - -extern int warn_missing_braces; - -/* Warn about comparison of signed and unsigned values. */ - -extern int warn_sign_compare; - -/* Warn about a subscript that has type char. */ - -extern int warn_char_subscripts; - -/* Nonzero means warn about pointer casts that can drop a type qualifier - from the pointer target type. */ - -extern int warn_cast_qual; - -/* Warn about *printf or *scanf format/argument anomalies. */ - -extern int warn_format; - -/* Nonzero means warn about non virtual destructors in classes that have - virtual functions. */ - -extern int warn_nonvdtor; - -/* Non-zero means warn when we convert a pointer to member function - into a pointer to (void or function). */ - -extern int warn_pmf2ptr; - -/* Nonzero means warn about violation of some Effective C++ style rules. */ - -extern int warn_ecpp; - -/* Nonzero means warn where overload resolution chooses a promotion from - unsigned to signed over a conversion to an unsigned of the same size. */ - -extern int warn_sign_promo; - -/* Non-zero means warn when a function is declared extern and later inline. */ - -extern int warn_extern_inline; - -/* Non-zero means warn when an old-style cast is used. */ - -extern int warn_old_style_cast; - -/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */ - -extern int flag_signed_bitfields; - -/* 3 means write out only virtuals function tables `defined' - in this implementation file. - 2 means write out only specific virtual function tables - and give them (C) public access. - 1 means write out virtual function tables and give them - (C) public access. - 0 means write out virtual function tables and give them - (C) static access (default). - -1 means declare virtual function tables extern. */ - -extern int write_virtuals; - -/* True for more efficient but incompatible (not fully tested) - vtable implementation (using thunks). - 0 is old behavior; 1 is new behavior; 3 adds vlist arguments; - 2 is 3 plus backwards-compatibility to 1. */ -extern int flag_vtable_thunks, flag_vtable_thunks_compat; - -/* INTERFACE_ONLY nonzero means that we are in an "interface" - section of the compiler. INTERFACE_UNKNOWN nonzero means - we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN - is zero and INTERFACE_ONLY is zero, it means that we are responsible - for exporting definitions that others might need. */ -extern int interface_only, interface_unknown; - -/* Nonzero means we should attempt to elide constructors when possible. */ - -extern int flag_elide_constructors; - -/* Nonzero means enable obscure ANSI features and disable GNU extensions - that might cause ANSI-compliant code to be miscompiled. */ - -extern int flag_ansi; - -/* Nonzero means recognize and handle signature language constructs. */ - -extern int flag_handle_signatures; - -/* Nonzero means that member functions defined in class scope are - inline by default. */ - -extern int flag_default_inline; - -/* The name-mangling scheme to use. Versions of gcc before 2.8 use - version 0. */ -extern int name_mangling_version; - -/* Nonzero means that guiding declarations are allowed. */ -extern int flag_guiding_decls; - -/* Nonzero if squashed mangling is to be performed. - This uses the B and K codes to reference previously seen class types - and class qualifiers. */ -extern int flag_do_squangling; - -/* Nonzero means generate separate instantiation control files and juggle - them at link time. */ -extern int flag_use_repository; - -/* Nonzero if we want to issue diagnostics that the standard says are not - required. */ -extern int flag_optional_diags; - -/* Nonzero means do not consider empty argument prototype to mean function - takes no arguments. */ -extern int flag_strict_prototype; - -/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */ -extern int flag_vtable_gc; - -/* Nonzero means make the default pedwarns warnings instead of errors. - The value of this flag is ignored if -pedantic is specified. */ -extern int flag_permissive; - -/* Nonzero if we want to obey access control semantics. */ - -extern int flag_access_control; - - -/* C++ language-specific tree codes. */ -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM, -enum cplus_tree_code { - __DUMMY = LAST_AND_UNUSED_TREE_CODE, -#include "cp-tree.def" - LAST_CPLUS_TREE_CODE -}; -#undef DEFTREECODE - -enum languages { lang_c, lang_cplusplus, lang_java }; - -/* Macros to make error reporting functions' lives easier. */ -#define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE))) -#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE))) -#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE))) - -#define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE)))) -#define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE)))) - -/* The _DECL for this _TYPE. */ -#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE))) - -/* Nonzero if T is a class (or struct or union) type. Also nonzero - for template type parameters and typename types. Despite its name, - this macro has nothing to do with the definition of aggregate given - in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */ -#define IS_AGGR_TYPE(t) \ - (TREE_CODE (t) == TEMPLATE_TYPE_PARM \ - || TREE_CODE (t) == TYPENAME_TYPE \ - || TREE_CODE (t) == TYPEOF_TYPE \ - || TYPE_LANG_FLAG_5 (t)) - -/* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or - union type. */ -#define SET_IS_AGGR_TYPE(T, VAL) \ - (TYPE_LANG_FLAG_5 (T) = (VAL)) - -/* Nonzero if T is a class type. Zero for template type parameters, - typename types, and so forth. */ -#define CLASS_TYPE_P(t) \ - (IS_AGGR_TYPE_CODE (TREE_CODE (t)) && IS_AGGR_TYPE (t)) - -#define IS_AGGR_TYPE_CODE(t) (t == RECORD_TYPE || t == UNION_TYPE) -#define IS_AGGR_TYPE_2(TYPE1,TYPE2) \ - (TREE_CODE (TYPE1) == TREE_CODE (TYPE2) \ - && IS_AGGR_TYPE (TYPE1)&IS_AGGR_TYPE (TYPE2)) -#define IS_OVERLOAD_TYPE(t) \ - (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE) - -/* In a *_TYPE, nonzero means a built-in type. */ -#define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6(NODE) - -/* True if this a "Java" type, defined in 'extern "Java"'. */ -#define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE) - -/* The type qualifiers for this type, including the qualifiers on the - elements for an array type. */ -#define CP_TYPE_QUALS(NODE) \ - ((TREE_CODE (NODE) != ARRAY_TYPE) \ - ? TYPE_QUALS (NODE) : cp_type_quals (NODE)) - -/* Nonzero if this type is const-qualified. */ -#define CP_TYPE_CONST_P(NODE) \ - ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_CONST) != 0) - -/* Nonzero if this type is volatile-qualified. */ -#define CP_TYPE_VOLATILE_P(NODE) \ - ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_VOLATILE) != 0) - -/* Nonzero if this type is restrict-qualified. */ -#define CP_TYPE_RESTRICT_P(NODE) \ - ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_RESTRICT) != 0) - -/* Nonzero if this type is const-qualified, but not - volatile-qualified. Other qualifiers are ignored. This macro is - used to test whether or not it is OK to bind an rvalue to a - reference. */ -#define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \ - ((CP_TYPE_QUALS (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \ - == TYPE_QUAL_CONST) - -#define DELTA_FROM_VTABLE_ENTRY(ENTRY) \ - (!flag_vtable_thunks ? \ - TREE_VALUE (CONSTRUCTOR_ELTS (ENTRY)) \ - : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? integer_zero_node \ - : build_int_2 (THUNK_DELTA (TREE_OPERAND ((ENTRY), 0)), 0)) - -/* Virtual function addresses can be gotten from a virtual function - table entry using this macro. */ -#define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \ - (!flag_vtable_thunks ? \ - TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \ - : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? (ENTRY) \ - : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0))) -#define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \ - (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) = (VALUE)) -#define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE)))) -#define PROMOTES_TO_AGGR_TYPE(NODE,CODE) \ - (((CODE) == TREE_CODE (NODE) \ - && IS_AGGR_TYPE (TREE_TYPE (NODE))) \ - || IS_AGGR_TYPE (NODE)) - -/* Nonzero iff TYPE is uniquely derived from PARENT. Under MI, PARENT can - be an ambiguous base class of TYPE, and this macro will be false. */ -#define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0) -#define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0) -#define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0) -#define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1) - -/* This structure provides additional information above and beyond - what is provide in the ordinary tree_type. In the past, we used it - for the types of class types, template parameters types, typename - types, and so forth. However, there can be many (tens to hundreds - of thousands) of template parameter types in a compilation, and - there's no need for this additional information in that case. - Therefore, we now use this data structure only for class types. - - In the past, it was thought that there would be relatively few - class types. However, in the presence of heavy use of templates, - many (i.e., thousands) of classes can easily be generated. - Therefore, we should endeavor to keep the size of this structure to - a minimum. */ -struct lang_type -{ - struct - { - unsigned has_type_conversion : 1; - unsigned has_init_ref : 1; - unsigned has_default_ctor : 1; - unsigned uses_multiple_inheritance : 1; - unsigned const_needs_init : 1; - unsigned ref_needs_init : 1; - unsigned has_const_assign_ref : 1; - unsigned anon_union : 1; - - unsigned has_nonpublic_ctor : 2; - unsigned has_nonpublic_assign_ref : 2; - unsigned vtable_needs_writing : 1; - unsigned has_assign_ref : 1; - unsigned gets_new : 2; - - unsigned gets_delete : 2; - unsigned has_call_overloaded : 1; - unsigned has_array_ref_overloaded : 1; - unsigned has_arrow_overloaded : 1; - unsigned interface_only : 1; - unsigned interface_unknown : 1; - unsigned needs_virtual_reinit : 1; - - unsigned marks: 6; - unsigned vec_delete_takes_size : 1; - unsigned declared_class : 1; - - unsigned being_defined : 1; - unsigned redefined : 1; - unsigned debug_requested : 1; - unsigned use_template : 2; - unsigned got_semicolon : 1; - unsigned ptrmemfunc_flag : 1; - unsigned is_signature : 1; - - unsigned is_signature_pointer : 1; - unsigned is_signature_reference : 1; - unsigned has_opaque_typedecls : 1; - unsigned sigtable_has_been_generated : 1; - unsigned was_anonymous : 1; - unsigned has_real_assign_ref : 1; - unsigned has_const_init_ref : 1; - unsigned has_complex_init_ref : 1; - - unsigned has_complex_assign_ref : 1; - unsigned has_abstract_assign_ref : 1; - unsigned non_aggregate : 1; - unsigned is_partial_instantiation : 1; - unsigned has_mutable : 1; - unsigned com_interface : 1; - /* When adding a flag here, consider whether or not it ought to - apply to a template instance if it applies to the template. - If so, make sure to copy it in instantiate_class_template! */ - - /* The MIPS compiler gets it wrong if this struct also - does not fill out to a multiple of 4 bytes. Add a - member `dummy' with new bits if you go over the edge. */ - unsigned dummy : 10; - } type_flags; - - int vsize; - int vfield_parent; - - union tree_node *vfields; - union tree_node *vbases; - - union tree_node *tags; - - union tree_node *search_slot; - - unsigned char align; - /* Room for another three unsigned chars. */ - - union tree_node *size; - - union tree_node *abstract_virtuals; - union tree_node *friend_classes; - - union tree_node *rtti; - - union tree_node *methods; - - union tree_node *signature; - union tree_node *signature_pointer_to; - union tree_node *signature_reference_to; - union tree_node *template_info; - tree befriending_classes; -}; - -/* Indicates whether or not (and how) a template was expanded for this class. - 0=no information yet/non-template class - 1=implicit template instantiation - 2=explicit template specialization - 3=explicit template instantiation */ -#define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.use_template) - -/* Fields used for storing information before the class is defined. - After the class is defined, these fields hold other information. */ - -/* List of friends which were defined inline in this class definition. */ -#define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE)) - -/* Nonzero for _CLASSTYPE means that operator new and delete are defined, - respectively. */ -#define TYPE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new) -#define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete) -#define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1) - -/* Nonzero for _CLASSTYPE means that operator vec delete is defined and - takes the optional size_t argument. */ -#define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \ - (TYPE_LANG_SPECIFIC(NODE)->type_flags.vec_delete_takes_size) -#define TYPE_VEC_NEW_USES_COOKIE(NODE) \ - (TYPE_NEEDS_DESTRUCTOR (NODE) \ - || (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE))) - -/* Nonzero means that this _CLASSTYPE node defines ways of converting - itself to other types. */ -#define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion) - -/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */ -#define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref) -#define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref) - -/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */ -#define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref) -#define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_init_ref) - -/* Nonzero means that this type is being defined. I.e., the left brace - starting the definition of this type has been seen. */ -#define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.being_defined) -/* Nonzero means that this type has been redefined. In this case, if - convenient, don't reprocess any methods that appear in its redefinition. */ -#define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.redefined) - -/* Nonzero means that this type is a signature. */ -# define IS_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)?TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature:0) -# define SET_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=1) -# define CLEAR_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=0) - -/* Nonzero means that this type is a signature pointer type. */ -# define IS_SIGNATURE_POINTER(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_pointer) - -/* Nonzero means that this type is a signature reference type. */ -# define IS_SIGNATURE_REFERENCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_reference) - -/* Nonzero means that this signature contains opaque type declarations. */ -#define SIGNATURE_HAS_OPAQUE_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_opaque_typedecls) - -/* Nonzero means that a signature table has been generated - for this signature. */ -#define SIGTABLE_HAS_BEEN_GENERATED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.sigtable_has_been_generated) - -/* If NODE is a class, this is the signature type that contains NODE's - signature after it has been computed using sigof(). */ -#define CLASSTYPE_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature) - -/* If NODE is a signature pointer or signature reference, this is the - signature type the pointer/reference points to. */ -#define SIGNATURE_TYPE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature) - -/* If NODE is a signature, this is a vector of all methods defined - in the signature or in its base types together with their default - implementations. */ -#define SIGNATURE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature) - -/* If NODE is a signature, this is the _TYPE node that contains NODE's - signature pointer type. */ -#define SIGNATURE_POINTER_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_pointer_to) - -/* If NODE is a signature, this is the _TYPE node that contains NODE's - signature reference type. */ -#define SIGNATURE_REFERENCE_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_reference_to) - -/* The is the basetype that contains NODE's rtti. */ -#define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti) - -/* Nonzero means that this _CLASSTYPE node overloads operator(). */ -#define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded) - -/* Nonzero means that this _CLASSTYPE node overloads operator[]. */ -#define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded) - -/* Nonzero means that this _CLASSTYPE node overloads operator->. */ -#define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_arrow_overloaded) - -/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses - multiple inheritance. If this is 0 for the root of a type - hierarchy, then we can use more efficient search techniques. */ -#define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance) - -/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses - virtual base classes. If this is 0 for the root of a type - hierarchy, then we can use more efficient search techniques. */ -#define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE)) - -/* Nonzero means that this _CLASSTYPE uses polymorphic virtual bases. - This flag is set only when we use vtable thunks. */ -#define TYPE_USES_PVBASES(NODE) (TREE_LANG_FLAG_5(NODE)) - -/* Vector member functions defined in this class. Each element is - either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All - functions with the same name end up in the same slot. The first - two elements are for constructors, and destructors, respectively. - These are followed by ordinary member functions. There may be - empty entries at the end of the vector. */ -#define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods) - -/* The first type conversion operator in the class (the others can be - searched with TREE_CHAIN), or the first non-constructor function if - there are no type conversion operators. */ -#define CLASSTYPE_FIRST_CONVERSION(NODE) \ - TREE_VEC_LENGTH (CLASSTYPE_METHOD_VEC (NODE)) > 2 \ - ? TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), 2) \ - : NULL_TREE; - -/* Mark bits for depth-first and breath-first searches. */ - -/* Get the value of the Nth mark bit. */ -#define CLASSTYPE_MARKED_N(NODE, N) \ - (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->type_flags.marks \ - : TYPE_ALIAS_SET (NODE)) & (1 << N)) != 0) - -/* Set the Nth mark bit. */ -#define SET_CLASSTYPE_MARKED_N(NODE, N) \ - (CLASS_TYPE_P (NODE) \ - ? (TYPE_LANG_SPECIFIC (NODE)->type_flags.marks |= (1 << (N))) \ - : (TYPE_ALIAS_SET (NODE) |= (1 << (N)))) - -/* Clear the Nth mark bit. */ -#define CLEAR_CLASSTYPE_MARKED_N(NODE, N) \ - (CLASS_TYPE_P (NODE) \ - ? (TYPE_LANG_SPECIFIC (NODE)->type_flags.marks &= ~(1 << (N))) \ - : (TYPE_ALIAS_SET (NODE) &= ~(1 << (N)))) - -/* Get the value of the mark bits. */ -#define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N(NODE, 0) -#define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N(NODE, 1) -#define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N(NODE, 2) -#define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N(NODE, 3) -#define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N(NODE, 4) -#define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N(NODE, 5) - -/* Macros to modify the above flags */ -#define SET_CLASSTYPE_MARKED(NODE) SET_CLASSTYPE_MARKED_N(NODE, 0) -#define CLEAR_CLASSTYPE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 0) -#define SET_CLASSTYPE_MARKED2(NODE) SET_CLASSTYPE_MARKED_N(NODE, 1) -#define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 1) -#define SET_CLASSTYPE_MARKED3(NODE) SET_CLASSTYPE_MARKED_N(NODE, 2) -#define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 2) -#define SET_CLASSTYPE_MARKED4(NODE) SET_CLASSTYPE_MARKED_N(NODE, 3) -#define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 3) -#define SET_CLASSTYPE_MARKED5(NODE) SET_CLASSTYPE_MARKED_N(NODE, 4) -#define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 4) -#define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N(NODE, 5) -#define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 5) - -/* A list of the nested tag-types (class, struct, union, or enum) - found within this class. The TREE_PURPOSE of each node is the name - of the type; the TREE_VALUE is the type itself. This list includes - nested member class templates. */ -#define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags) - -/* If this class has any bases, this is the number of the base class from - which our VFIELD is based, -1 otherwise. If this class has no base - classes, this is not used. - In D : B1, B2, PARENT would be 0, if D's vtable came from B1, - 1, if D's vtable came from B2. */ -#define CLASSTYPE_VFIELD_PARENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield_parent) - -/* Remove when done merging. */ -#define CLASSTYPE_VFIELD(NODE) TYPE_VFIELD(NODE) - -/* The number of virtual functions defined for this - _CLASSTYPE node. */ -#define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize) -/* The list of binfos of virtual base classes that this type uses. */ -#define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases) -/* The virtual function pointer fields that this type contains. */ -#define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields) - -/* Number of baseclasses defined for this type. - 0 means no base classes. */ -#define CLASSTYPE_N_BASECLASSES(NODE) \ - (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0) - -/* Used for keeping search-specific information. Any search routine - which uses this must define what exactly this slot is used for. */ -#define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot) - -/* These are the size, mode and alignment of the type without its - virtual base classes, for when we use this type as a base itself. */ -#define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size) -#define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align) - -/* A cons list of virtual functions which cannot be inherited by - derived classes. When deriving from this type, the derived - class must provide its own definition for each of these functions. */ -#define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals) - -/* Nonzero means that this aggr type has been `closed' by a semicolon. */ -#define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon) - -/* Nonzero means that the main virtual function table pointer needs to be - set because base constructors have placed the wrong value there. - If this is zero, it means that they placed the right value there, - and there is no need to change it. */ -#define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit) - -/* Nonzero means that if this type has virtual functions, that - the virtual function table will be written out. */ -#define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing) - -/* Nonzero means that this type has an X() constructor. */ -#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor) - -/* Nonzero means the type declared a ctor as private or protected. We - use this to make sure we don't try to generate a copy ctor for a - class that has a member of type NODE. */ -#define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_ctor) - -/* Ditto, for operator=. */ -#define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_assign_ref) - -/* Nonzero means that this type contains a mutable member */ -#define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_mutable) -#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE)) - -/* Nonzero means that this type is meant for communication via COM. */ -#define CLASSTYPE_COM_INTERFACE(NODE) \ - (TYPE_LANG_SPECIFIC(NODE)->type_flags.com_interface) - -/* A list of class types of which this type is a friend. The - TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the - case of a template friend. */ -#define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes) - -/* A list of the classes which grant friendship to this class. */ -#define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \ - (TYPE_LANG_SPECIFIC (NODE)->befriending_classes) - -/* Say whether this node was declared as a "class" or a "struct". */ -#define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class) - -/* Nonzero if this class has const members which have no specified initialization. */ -#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init) - -/* Nonzero if this class has ref members which have no specified initialization. */ -#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init) - -/* Nonzero if this class is included from a header file which employs - `#pragma interface', and it is not included in its implementation file. */ -#define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only) - -/* Same as above, but for classes whose purpose we do not know. */ -#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown) -#define CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown == 0) -#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = !!(X)) -#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 1) -#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 0) - -/* Nonzero if a _DECL node requires us to output debug info for this class. */ -#define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.debug_requested) - -/* Additional macros for inheritance information. */ - -/* The BINFO_INHERITANCE_CHAIN is used opposite to the description in - gcc/tree.h. In particular if D is derived from B then the BINFO - for B (in D) will have a BINFO_INHERITANCE_CHAIN pointing to - D. In tree.h, this pointer is described as pointing in other - direction. There is a different BINFO for each path to a virtual - base; BINFOs for virtual bases are not shared. In addition, shared - versions of each of the virtual class BINFOs are stored in - CLASSTYPE_VBASECLASSES. - - We use TREE_VIA_PROTECTED and TREE_VIA_PUBLIC, but private - inheritance is indicated by the absence of the other two flags, not - by TREE_VIAR_PRIVATE, which is unused. - - The TREE_CHAIN is for scratch space in search.c. */ - -/* Nonzero means marked by DFS or BFS search, including searches - by `get_binfo' and `get_base_distance'. */ -#define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE)) -/* Macros needed because of C compilers that don't allow conditional - expressions to be lvalues. Grr! */ -#define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1)) -#define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0)) - -/* Nonzero means marked in search through virtual inheritance hierarchy. */ -#define BINFO_VBASE_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)) -/* Modifier macros */ -#define SET_BINFO_VBASE_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)) -#define CLEAR_BINFO_VBASE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)) - -/* Nonzero means marked in search for members or member functions. */ -#define BINFO_FIELDS_MARKED(NODE) \ - (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)):TREE_LANG_FLAG_2(NODE)) -#define SET_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=1)) -#define CLEAR_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=0)) - -/* Nonzero means that this class is on a path leading to a new vtable. */ -#define BINFO_VTABLE_PATH_MARKED(NODE) \ - (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE)) -#define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1)) -#define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0)) - -/* Nonzero means that this class has a new vtable. */ -#define BINFO_NEW_VTABLE_MARKED(NODE) \ - (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):TREE_LANG_FLAG_4(NODE)) -#define SET_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=1)) -#define CLEAR_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=0)) - -/* Nonzero means this class has done dfs_pushdecls. */ -#define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE) -#define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE) -#define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE) - -/* Used by various search routines. */ -#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE) - -/* Accessor macros for the vfield slots in structures. */ - -/* Get the assoc info that caused this vfield to exist. */ -#define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE) - -/* Get that same information as a _TYPE. */ -#define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE) - -/* Get the value of the top-most type dominating the non-`normal' vfields. */ -#define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE) - -/* Get the value of the top-most type that's `normal' for the vfield. */ -#define VF_NORMAL_VALUE(NODE) TREE_TYPE (NODE) - -/* Nonzero for TREE_LIST node means that this list of things - is a list of parameters, as opposed to a list of expressions. */ -#define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */ - -/* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that - this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE - will be NULL_TREE to indicate a throw specification of `(...)', or, - equivalently, no throw specification. */ -#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE) - -/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */ -#define TYPE_NOTHROW_P(NODE) \ - (TYPE_RAISES_EXCEPTIONS (NODE) \ - && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE) - -/* The binding level associated with the namespace. */ -#define NAMESPACE_LEVEL(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.level) - - -/* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or - a lang_decl (which has lang_decl_flags as its initial prefix). A - FUNCTION_DECL, NAMESPACE_DECL, TYPE_DECL, or USING_DECL may have a - full lang_decl. A FIELD_DECL, or a static data member VAR_DECL, - will have only lang_decl_flags. Thus, one should only access the - members of lang_decl that are not in lang_decl_flags for DECLs that - are not FIELD_DECLs or VAR_DECLs. */ - -struct lang_decl_flags -{ -#ifdef ONLY_INT_FIELDS - int language : 8; -#else - enum languages language : 8; -#endif - - unsigned operator_attr : 1; - unsigned constructor_attr : 1; - unsigned friend_attr : 1; - unsigned static_function : 1; - unsigned const_memfunc : 1; - unsigned volatile_memfunc : 1; - unsigned abstract_virtual : 1; - unsigned permanent_attr : 1 ; - - unsigned mutable_flag : 1; - unsigned is_default_implementation : 1; - unsigned saved_inline : 1; - unsigned use_template : 2; - unsigned nonconverting : 1; - unsigned declared_inline : 1; - unsigned not_really_extern : 1; - unsigned needs_final_overrider : 1; - unsigned bitfield : 1; - unsigned defined_in_class : 1; - unsigned constructor_for_vbase_attr : 2; - unsigned dummy : 3; - - tree access; - tree context; - tree memfunc_pointer_to; - tree template_info; - struct binding_level *level; -}; - -struct lang_decl -{ - struct lang_decl_flags decl_flags; - - tree main_decl_variant; - tree befriending_classes; - struct pending_inline *pending_inline_info; -}; - -/* Non-zero if NODE is a _DECL with TREE_READONLY set. */ -#define TREE_READONLY_DECL_P(NODE) \ - (TREE_READONLY (NODE) && TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd') - -/* Non-zero iff DECL is memory-based. The DECL_RTL of - certain const variables might be a CONST_INT, or a REG - in some cases. We cannot use `memory_operand' as a test - here because on most RISC machines, a variable's address - is not, by itself, a legitimate address. */ -#define DECL_IN_MEMORY_P(NODE) \ - (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM) - -/* For FUNCTION_DECLs: return the language in which this decl - was declared. */ -#define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language) - -/* For FUNCTION_DECLs: nonzero means that this function is a constructor. */ -#define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr) - -/* There ought to be a better way to find out whether or not something is - a destructor. */ -#define DECL_DESTRUCTOR_P(NODE) \ - (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (NODE)) \ - && DECL_LANGUAGE (NODE) == lang_cplusplus) - -#define DECL_CONV_FN_P(NODE) \ - (IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)) && TREE_TYPE (DECL_NAME (NODE))) - -#define CONSTRUCTOR_FOR_VBASE 1 -#define CONSTRUCTOR_FOR_PVBASE 2 -#define DESTRUCTOR_FOR_PVBASE 3 - -/* For FUNCTION_DECLs: nonzero means that this function is a con/destructor - for an object with virtual baseclasses. */ -#define DECL_CONSTRUCTOR_FOR_VBASE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr) - -/* Nonzero means that this function is a constructor for an object - with virtual baseclasses. */ -#define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) \ - (DECL_CONSTRUCTOR_FOR_VBASE (NODE) == CONSTRUCTOR_FOR_VBASE) - -/* Nonzero means that this function is a constructor for an object - with virtual baseclasses which have virtual functions. */ -#define DECL_CONSTRUCTOR_FOR_PVBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr == CONSTRUCTOR_FOR_PVBASE) - -/* Nonzero means that this function is a destructor for an object - with virtual baseclasses which have virtual functions. */ -#define DECL_DESTRUCTOR_FOR_PVBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr == DESTRUCTOR_FOR_PVBASE) - -/* Nonzero means that this function is a wrapper around a PVBASE ctor. */ -#define DECL_VLIST_CTOR_WRAPPER_P(NODE) \ - (DECL_CONSTRUCTOR_FOR_VBASE_P (NODE) && DECL_VLIST_CTOR_WRAPPED (NODE)\ - && TREE_CODE (DECL_VLIST_CTOR_WRAPPED (NODE)) == FUNCTION_DECL \ - && DECL_CONSTRUCTOR_FOR_PVBASE_P (DECL_VLIST_CTOR_WRAPPED (NODE))) - -/* Refers to original function that NODE wraps. */ -#define DECL_VLIST_CTOR_WRAPPED(NODE) DECL_MEMFUNC_POINTER_TO (NODE) - -/* Non-zero for a FUNCTION_DECL that declares a type-info function. */ -#define DECL_TINFO_FN_P(NODE) \ - (TREE_CODE (NODE) == FUNCTION_DECL \ - && DECL_ARTIFICIAL (NODE) \ - && DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag) - -/* Mark NODE as a type-info function. */ -#define SET_DECL_TINFO_FN_P(NODE) \ - (DECL_LANG_SPECIFIC((NODE))->decl_flags.mutable_flag = 1) - -/* For FUNCTION_DECLs: nonzero means that this function is a default - implementation of a signature method. */ -#define IS_DEFAULT_IMPLEMENTATION(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_default_implementation) - -/* Nonzero for _DECL means that this decl appears in (or will appear - in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for - detecting circularity in case members are multiply defined. In the - case of a VAR_DECL, it is also used to determine how program storage - should be allocated. */ -#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE)) - -/* Nonzero if the DECL was defined in the class definition itself, - rather than outside the class. */ -#define DECL_DEFINED_IN_CLASS_P(DECL) \ - (DECL_LANG_SPECIFIC (DECL)->decl_flags.defined_in_class) - -/* Nonzero for FUNCTION_DECL means that this decl is just a - friend declaration, and should not be added to the list of - member functions for this class. */ -#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr) - -/* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */ -#define DECL_BEFRIENDING_CLASSES(NODE) \ - (DECL_LANG_SPECIFIC(NODE)->befriending_classes) - -/* Nonzero for FUNCTION_DECL means that this decl is a static - member function. */ -#define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function) - -/* Nonzero for a class member means that it is shared between all objects - of that class. */ -#define SHARED_MEMBER_P(NODE) \ - (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \ - || TREE_CODE (NODE) == CONST_DECL) - -/* Nonzero for FUNCTION_DECL means that this decl is a non-static - member function. */ -#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \ - (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE) - -/* Nonzero for FUNCTION_DECL means that this decl is a member function - (static or non-static). */ -#define DECL_FUNCTION_MEMBER_P(NODE) \ - (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE)) - -/* Nonzero for FUNCTION_DECL means that this member function - has `this' as const X *const. */ -#define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc) - -/* Nonzero for FUNCTION_DECL means that this member function - has `this' as volatile X *const. */ -#define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc) - -/* Nonzero for a DECL means that this member is a non-static member. */ -#define DECL_NONSTATIC_MEMBER_P(NODE) \ - ((TREE_CODE (NODE) == FUNCTION_DECL \ - && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \ - || TREE_CODE (NODE) == FIELD_DECL) - -/* Nonzero for _DECL means that this member object type - is mutable. */ -#define DECL_MUTABLE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag) - -/* Nonzero for _DECL means that this constructor is a non-converting - constructor. */ -#define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting) - -/* Nonzero for FUNCTION_DECL means that this member function - exists as part of an abstract class's interface. */ -#define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual) - -/* Nonzero for FUNCTION_DECL means that this member function - must be overridden by derived classes. */ -#define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.needs_final_overrider) - -/* Nonzero if allocated on permanent_obstack. */ -#define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr) - -/* The _TYPE context in which this _DECL appears. This field holds the - class where a virtual function instance is actually defined, and the - lexical scope of a friend function defined in a class body. */ -#define DECL_CLASS_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.context) -#define DECL_REAL_CONTEXT(NODE) \ - ((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \ - ? DECL_CLASS_CONTEXT (NODE) : CP_DECL_CONTEXT (NODE)) - -/* NULL_TREE in DECL_CONTEXT represents the global namespace. */ -#define CP_DECL_CONTEXT(NODE) \ - (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace) -#define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE)) - -/* For a virtual function, the base where we find its vtable entry. - For a non-virtual function, the base where it is defined. */ -#define DECL_VIRTUAL_CONTEXT(NODE) DECL_CONTEXT (NODE) - -/* 1 iff NODE has namespace scope, including the global namespace. */ -#define DECL_NAMESPACE_SCOPE_P(NODE) \ - (DECL_CONTEXT (NODE) == NULL_TREE \ - || TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL) - -/* 1 iff NODE is a class member. */ -#define DECL_CLASS_SCOPE_P(NODE) \ - (DECL_CONTEXT (NODE) \ - && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't') - -/* 1 iff NODE is function-local. */ -#define DECL_FUNCTION_SCOPE_P(NODE) \ - (DECL_CONTEXT (NODE) \ - && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL) - -/* For a NAMESPACE_DECL: the list of using namespace directives - The PURPOSE is the used namespace, the value is the namespace - that is the common ancestor. */ -#define DECL_NAMESPACE_USING(NODE) DECL_VINDEX(NODE) - -/* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users - of a namespace, to record the transitive closure of using namespace. */ -#define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NODE) - -/* In a NAMESPACE_DECL, points to the original namespace if this is - a namespace alias. */ -#define DECL_NAMESPACE_ALIAS(NODE) DECL_ABSTRACT_ORIGIN (NODE) -#define ORIGINAL_NAMESPACE(NODE) \ - (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE)) - -/* In a non-local VAR_DECL with static storage duration, this is the - initialization priority. If this value is zero, the NODE will be - initialized at the DEFAULT_INIT_PRIORITY. */ -#define DECL_INIT_PRIORITY(NODE) (DECL_FIELD_SIZE ((NODE))) - -/* In a TREE_LIST concatenating using directives, indicate indirekt - directives */ -#define TREE_INDIRECT_USING(NODE) ((NODE)->common.lang_flag_0) - -/* In a VAR_DECL for a variable declared in a for statement, - this is the shadowed (local) variable. */ -#define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(NODE) - -/* Points back to the decl which caused this lang_decl to be allocated. */ -#define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant) - -/* For a FUNCTION_DECL: if this function was declared inline inside of - a class declaration, this is where the text for the function is - squirreled away. */ -#define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info) - -/* True if on the saved_inlines (see decl2.c) list. */ -#define DECL_SAVED_INLINE(DECL) \ - (DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline) - -/* For a FUNCTION_DECL: if this function was declared inside a signature - declaration, this is the corresponding member function pointer that was - created for it. */ -#define DECL_MEMFUNC_POINTER_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to) - -/* For a FIELD_DECL: this points to the signature member function from - which this signature member function pointer was created. */ -#define DECL_MEMFUNC_POINTING_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to) - -/* For a VAR_DECL or FUNCTION_DECL: template-specific information. */ -#define DECL_TEMPLATE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.template_info) - -/* Template information for a RECORD_TYPE or UNION_TYPE. */ -#define CLASSTYPE_TEMPLATE_INFO(NODE) (TYPE_LANG_SPECIFIC(NODE)->template_info) - -/* Template information for an ENUMERAL_TYPE. Although an enumeration may - not be a primary template, it may be declared within the scope of a - primary template and the enumeration constants may depend on - non-type template parameters. */ -#define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE)) - -/* Template information for a template template parameter. */ -#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE)) - -/* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */ -#define TYPE_TEMPLATE_INFO(NODE) \ - (TREE_CODE (NODE) == ENUMERAL_TYPE \ - ? ENUM_TEMPLATE_INFO (NODE) : \ - (TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM \ - ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) \ - : CLASSTYPE_TEMPLATE_INFO (NODE))) - -/* Set the template information for an ENUMERAL_, RECORD_, or - UNION_TYPE to VAL. */ -#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \ - (TREE_CODE (NODE) == ENUMERAL_TYPE \ - ? (ENUM_TEMPLATE_INFO (NODE) = VAL) \ - : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL)) - -#define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE)) -#define TI_ARGS(NODE) (TREE_VALUE (NODE)) -#define TI_SPEC_INFO(NODE) (TREE_CHAIN (NODE)) -#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE) - -/* The TEMPLATE_DECL instantiated or specialized by NODE. This - TEMPLATE_DECL will be the immediate parent, not the most general - template. For example, in: - - template struct S { template void f(U); } - - the FUNCTION_DECL for S::f will have, as its - DECL_TI_TEMPLATE, `template S::f'. - - As a special case, for a member friend template of a template - class, this value will not be a TEMPLATE_DECL, but rather a - LOOKUP_EXPR or IDENTIFIER_NODE indicating the name of the template - and any explicit template arguments provided. For example, in: - - template struct S { friend void f(int, double); } - - the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the - DECL_TI_ARGS will be {int}. */ -#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE)) - -/* The template arguments used to obtain this decl from the most - general form of DECL_TI_TEMPLATE. For the example given for - DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These - are always the full set of arguments required to instantiate this - declaration from the most general template specialized here. */ -#define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE)) -#define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE)) -#define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE)) -#define CLASSTYPE_TI_SPEC_INFO(NODE) TI_SPEC_INFO (CLASSTYPE_TEMPLATE_INFO (NODE)) -#define ENUM_TI_TEMPLATE(NODE) \ - TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE)) -#define ENUM_TI_ARGS(NODE) \ - TI_ARGS (ENUM_TEMPLATE_INFO (NODE)) - -/* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */ -#define TYPE_TI_TEMPLATE(NODE) \ - (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE))) - -/* Like DECL_TI_ARGS, , but for an ENUMERAL_, RECORD_, or UNION_TYPE. */ -#define TYPE_TI_ARGS(NODE) \ - (TI_ARGS (TYPE_TEMPLATE_INFO (NODE))) - -#define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE(NODE) - -/* Nonzero if the NODE corresponds to the template parameters for a - member template, whose inline definition is being processed after - the class definition is complete. */ -#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE) - -#define DECL_SAVED_TREE(NODE) DECL_MEMFUNC_POINTER_TO (NODE) -#define COMPOUND_STMT_NO_SCOPE(NODE) TREE_LANG_FLAG_0 (NODE) -#define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE) -#define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE) -#define DELETE_EXPR_USE_VEC(NODE) TREE_LANG_FLAG_1 (NODE) -#define LOOKUP_EXPR_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE) - -/* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a - TEMPLATE_DECL. This macro determines whether or not a given class - type is really a template type, as opposed to an instantiation or - specialization of one. */ -#define CLASSTYPE_IS_TEMPLATE(NODE) \ - (CLASSTYPE_TEMPLATE_INFO (NODE) \ - && !CLASSTYPE_USE_TEMPLATE (NODE) \ - && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE))) - -/* The name used by the user to name the typename type. Typically, - this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the - corresponding TYPE_DECL. However, this may also be a - TEMPLATE_ID_EXPR if we had something like `typename X::Y'. */ -#define TYPENAME_TYPE_FULLNAME(NODE) TYPE_BINFO (NODE) - -/* Nonzero if NODE is an implicit typename. */ -#define IMPLICIT_TYPENAME_P(NODE) \ - (TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE)) - -/* Nonzero in INTEGER_CST means that this int is negative by dint of - using a twos-complement negated operand. */ -#define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE)) - -#if 0 /* UNUSED */ -/* Nonzero in any kind of _EXPR or _REF node means that it is a call - to a storage allocation routine. If, later, alternate storage - is found to hold the object, this call can be ignored. */ -#define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_1 (NODE)) -#endif - -/* Nonzero in any kind of _TYPE that uses multiple inheritance - or virtual baseclasses. */ -#define TYPE_USES_COMPLEX_INHERITANCE(NODE) (TREE_LANG_FLAG_1 (NODE)) - -#if 0 /* UNUSED */ -/* Nonzero in IDENTIFIER_NODE means that this name is not the name the user - gave; it's a DECL_NESTED_TYPENAME. Someone may want to set this on - mangled function names, too, but it isn't currently. */ -#define TREE_MANGLED(NODE) (FOO) -#endif - -#if 0 /* UNUSED */ -/* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and - should be looked up in a non-standard way. */ -#define DECL_OVERLOADED(NODE) (FOO) -#endif - -/* Nonzero if this (non-TYPE)_DECL has its virtual attribute set. - For a FUNCTION_DECL, this is when the function is a virtual function. - For a VAR_DECL, this is when the variable is a virtual function table. - For a FIELD_DECL, when the field is the field for the virtual function table. - For an IDENTIFIER_NODE, nonzero if any function with this name - has been declared virtual. - - For a _TYPE if it uses virtual functions (or is derived from - one that does). */ -#define TYPE_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE)) - -extern int flag_new_for_scope; - -/* This flag is true of a local VAR_DECL if it was declared in a for - statement, but we are no longer in the scope of the for. */ -#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (NODE) - -/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL - if we already emitted a warning about using it. */ -#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (NODE) - -/* This _DECL represents a compiler-generated entity. */ -#define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1) - -/* Record whether a typedef for type `int' was actually `signed int'. */ -#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp)) - -/* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */ -#define DECL_C_BIT_FIELD(NODE) \ - (DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield) -#define SET_DECL_C_BIT_FIELD(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield = 1) - -/* Nonzero if the type T promotes to itself. - ANSI C states explicitly the list of types that promote; - in particular, short promotes to int even if they have the same width. */ -#define C_PROMOTING_INTEGER_TYPE_P(t) \ - (TREE_CODE ((t)) == INTEGER_TYPE \ - && (TYPE_MAIN_VARIANT (t) == char_type_node \ - || TYPE_MAIN_VARIANT (t) == signed_char_type_node \ - || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \ - || TYPE_MAIN_VARIANT (t) == short_integer_type_node \ - || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node)) - -#define INTEGRAL_CODE_P(CODE) \ - (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE) -#define ARITHMETIC_TYPE_P(TYPE) (INTEGRAL_TYPE_P (TYPE) || FLOAT_TYPE_P (TYPE)) - -/* Mark which labels are explicitly declared. - These may be shadowed, and may be referenced from nested functions. */ -#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label) - -/* Nonzero for _TYPE means that the _TYPE defines - at least one constructor. */ -#define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE)) - -/* When appearing in an INDIRECT_REF, it means that the tree structure - underneath is actually a call to a constructor. This is needed - when the constructor must initialize local storage (which can - be automatically destroyed), rather than allowing it to allocate - space from the heap. - - When appearing in a SAVE_EXPR, it means that underneath - is a call to a constructor. - - When appearing in a CONSTRUCTOR, it means that it was - a GNU C constructor expression. - - When appearing in a FIELD_DECL, it means that this field - has been duly initialized in its constructor. */ -#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE)) - -#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \ - && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \ - && ! TREE_HAS_CONSTRUCTOR (NODE)) - -#if 0 -/* Indicates that a NON_LVALUE_EXPR came from a C++ reference. - Used to generate more helpful error message in case somebody - tries to take its address. */ -#define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE)) -#endif - -/* Nonzero for _TYPE means that the _TYPE defines a destructor. */ -#define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE)) - -#if 0 -/* Nonzero for _TYPE node means that creating an object of this type - will involve a call to a constructor. This can apply to objects - of ARRAY_TYPE if the type of the elements needs a constructor. */ -#define TYPE_NEEDS_CONSTRUCTING(NODE) ... defined in ../tree.h ... -#endif - -/* Nonzero means that an object of this type can not be initialized using - an initializer list. */ -#define CLASSTYPE_NON_AGGREGATE(NODE) \ - (TYPE_LANG_SPECIFIC (NODE)->type_flags.non_aggregate) -#define TYPE_NON_AGGREGATE_CLASS(NODE) \ - (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE)) - -/* Nonzero if there is a user-defined X::op=(x&) for this class. */ -#define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assign_ref) -#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_assign_ref) -#define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_abstract_assign_ref) -#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_init_ref) - -/* Nonzero for _TYPE node means that destroying an object of this type - will involve a call to a destructor. This can apply to objects - of ARRAY_TYPE is the type of the elements needs a destructor. */ -#define TYPE_NEEDS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_4(NODE)) - -/* Nonzero for class type means that initialization of this type can use - a bitwise copy. */ -#define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \ - (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE)) - -/* Nonzero for class type means that assignment of this type can use - a bitwise copy. */ -#define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \ - (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE)) - -#define TYPE_PTRMEM_P(NODE) \ - (TREE_CODE (NODE) == POINTER_TYPE \ - && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE) -#define TYPE_PTR_P(NODE) \ - (TREE_CODE (NODE) == POINTER_TYPE \ - && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE) -#define TYPE_PTROB_P(NODE) \ - (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \ - && TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE) -#define TYPE_PTROBV_P(NODE) \ - (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE) -#define TYPE_PTRFN_P(NODE) \ - (TREE_CODE (NODE) == POINTER_TYPE \ - && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) - -/* Nonzero for _TYPE node means that this type is a pointer to member - function type. */ -#define TYPE_PTRMEMFUNC_P(NODE) \ - (TREE_CODE(NODE) == RECORD_TYPE && TYPE_PTRMEMFUNC_FLAG (NODE)) -#define TYPE_PTRMEMFUNC_FLAG(NODE) \ - (TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag) - -/* A pointer-to-function member type looks like: - - struct { - short __delta; - short __index; - union { - P __pfn; - short __delta2; - } __pfn_or_delta2; - }; - - where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the - pointer to member. The fields are used as follows: - - If __INDEX is -1, then the function to call is non-virtual, and - is located at the address given by __PFN. - - If __INDEX is zero, then this a NULL pointer-to-member. - - Otherwise, the function to call is virtual. Then, __DELTA2 gives - the offset from an instance of the object to the virtual function - table, and __INDEX - 1 is the index into the vtable to use to - find the function. - - The value to use for the THIS parameter is the address of the - object plus __DELTA. - - For example, given: - - struct B1 { - int i; - }; - - struct B2 { - double d; - void f(); - }; - - struct S : public B1, B2 {}; - - the pointer-to-member for `&S::f' looks like: - - { 4, -1, { &f__2B2 } }; - - The `4' means that given an `S*' you have to add 4 bytes to get to - the address of the `B2*'. Then, the -1 indicates that this is a - non-virtual function. Of course, `&f__2B2' is the name of that - function. - - (Of course, the exactl values may differ depending on the mangling - scheme, sizes of types, and such.). */ - -/* Get the POINTER_TYPE to the METHOD_TYPE associated with this - pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true, - before using this macro. */ -#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE))))))) - -/* Returns `A' for a type like `int (A::*)(double)' */ -#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \ - TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE))) - -/* These are use to manipulate the canonical RECORD_TYPE from the - hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */ -#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE)) -#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE))) -/* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */ -#define DELTA2_FROM_PTRMEMFUNC(NODE) delta2_from_ptrmemfunc ((NODE)) -#define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE)) - -/* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for - `X'. */ -#define PTRMEM_CST_CLASS(NODE) \ - (TYPE_PTRMEM_P (TREE_TYPE (NODE)) \ - ? TYPE_OFFSET_BASETYPE (TREE_TYPE (TREE_TYPE (NODE))) \ - : TYPE_PTRMEMFUNC_OBJECT_TYPE (TREE_TYPE (NODE))) - -/* For a pointer-to-member constant `X::Y' this is the _DECL for - `Y'. */ -#define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t) NODE)->member) - -/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was - specified in its declaration. */ -#define DECL_THIS_EXTERN(NODE) (DECL_LANG_FLAG_2(NODE)) - -/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was - specified in its declaration. */ -#define DECL_THIS_STATIC(NODE) (DECL_LANG_FLAG_6(NODE)) - -/* Nonzero in FUNCTION_DECL means it is really an operator. - Just used to communicate formatting information to dbxout.c. */ -#define DECL_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr) - -#define ANON_UNION_P(NODE) (DECL_NAME (NODE) == 0) - -/* Nonzero if TYPE is an anonymous union type. We have to use a flag for - this because "A union for which objects or pointers are declared is not - an anonymous union" [class.union]. */ -#define ANON_UNION_TYPE_P(NODE) \ - (TYPE_LANG_SPECIFIC (NODE) \ - && TYPE_LANG_SPECIFIC (NODE)->type_flags.anon_union) -#define SET_ANON_UNION_TYPE_P(NODE) \ - (TYPE_LANG_SPECIFIC (NODE)->type_flags.anon_union = 1) - -#define UNKNOWN_TYPE LANG_TYPE - -/* Define fields and accessors for nodes representing declared names. */ - -#if 0 -/* C++: A derived class may be able to directly use the virtual - function table of a base class. When it does so, it may - still have a decl node used to access the virtual function - table (so that variables of this type can initialize their - virtual function table pointers by name). When such thievery - is committed, know exactly which base class's virtual function - table is the one being stolen. This effectively computes the - transitive closure. */ -#define DECL_VPARENT(NODE) ((NODE)->decl.arguments) -#endif - -#define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.was_anonymous) - -/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */ - -/* The format of each node in the DECL_FRIENDLIST is as follows: - - The TREE_PURPOSE will be the name of a function, i.e., an - IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, the - list of functions with that name which are friends. The - TREE_PURPOSE of each node in this sublist will be error_mark_node, - if the function was declared a friend individually, in which case - the TREE_VALUE will be the function_decl. If, however, all - functions with a given name in a class were declared to be friends, - the TREE_PUROSE will be the class type, and the TREE_VALUE will be - NULL_TREE. */ -#define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE)) -#define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST)) -#define FRIEND_DECLS(LIST) (TREE_VALUE (LIST)) - -/* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of - each node is a type; the TREE_VALUE is the access granted for this - DECL in that type. The DECL_ACCESS is set by access declarations. - For example, if a member that would normally be public in a - derived class is made protected, then the derived class and the - protected_access_node will appear in the DECL_ACCESS for the node. */ -#define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.access) - -/* C++: all of these are overloaded! - These apply to PARM_DECLs and VAR_DECLs. */ -#define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments) -#define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL) - -/* Accessor macros for C++ template decl nodes. */ - -/* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node - is a INT_CST whose TREE_INT_CST_HIGH indicates the level of the - template parameters, with 1 being the outermost set of template - parameters. The TREE_VALUE is a vector, whose elements are the - template parameters at each level. Each element in the vector is a - TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a - non-type parameter), or a TYPE_DECL (if the parameter is a type - parameter). The TREE_PURPOSE is the default value, if any. The - TEMPLATE_PARM_INDEX for the parameter is avilable as the - DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a - TYPE_DECL). */ -#define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE) -#define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \ - INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE)) -#define DECL_NTPARMS(NODE) \ - TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE)) -/* For function, method, class-data templates. */ -#define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT(NODE) -/* For a static member variable template, the - DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and - implicitly generated instantiations of the variable. There are no - partial instantiations of static member variables, so all of these - will be full instantiations. - - For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds - all instantiations and specializations of the class type, including - partial instantiations and partial specializations. - - In both cases, the TREE_PURPOSE of each node contains the arguments - used; the TREE_VALUE contains the generated variable. The template - arguments are always complete. For example, given: - - template struct S1 { - template struct S2 {}; - template struct S2 {}; - }; - - the record for the partial specialization will contain, as its - argument list, { {T}, {U*} }, and will be on the - DECL_TEMPLATE_INSTANTIATIONS list for `template template - struct S1::S2'. - - This list is not used for function templates. */ -#define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE) -/* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists - contains all instantiations and specializations of the function, - including partial instantiations. For a partial instantiation - which is a specialization, this list holds only full - specializations of the template that are instantiations of the - partial instantiation. For example, given: - - template struct S { - template void f(U); - template <> void f(T); - }; - - the `S::f(int)' function will appear on the - DECL_TEMPLATE_SPECIALIZATIONS list for both `template - template void S::f(U)' and `template void - S::f(T)'. In the latter case, however, it will have only the - innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE - for the function declaration will point at the specialization, not - the fully general template. - - For a class template, this list contains the partial - specializations of this template. (Full specializations are not - recorded on this list.) The TREE_PURPOSE holds the innermost - arguments used in the partial specialization (e.g., for `template - struct S' this will be `T*'.) The TREE_VALUE - holds the innermost template parameters for the specialization - (e.g., `T' in the example above.) The TREE_TYPE is the _TYPE node - for the partial specialization. - - This list is not used for static variable templates. */ -#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE(NODE) -#define DECL_TEMPLATE_INJECT(NODE) DECL_INITIAL(NODE) - -/* Nonzero for a DECL which is actually a template parameter. */ -#define DECL_TEMPLATE_PARM_P(NODE) \ - DECL_LANG_FLAG_0 (NODE) - -#define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \ - (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE)) - -#define DECL_FUNCTION_TEMPLATE_P(NODE) \ - (TREE_CODE (NODE) == TEMPLATE_DECL \ - && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL) - -/* Nonzero for a DECL that represents a template class. */ -#define DECL_CLASS_TEMPLATE_P(NODE) \ - (TREE_CODE (NODE) == TEMPLATE_DECL \ - && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \ - && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE)) - -/* Nonzero if NODE which declares a type. */ -#define DECL_DECLARES_TYPE_P(NODE) \ - (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE)) - -/* A `primary' template is one that has its own template header. A - member function of a class template is a template, but not primary. - A member template is primary. Friend templates are primary, too. */ - -/* Returns the primary template corresponding to these parameters. */ -#define DECL_PRIMARY_TEMPLATE(NODE) \ - (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE))) - -/* Returns non-zero if NODE is a primary template. */ -#define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE) - -#define CLASSTYPE_TEMPLATE_LEVEL(NODE) \ - (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE)))) - -/* Indicates whether or not (and how) a template was expanded for this - FUNCTION_DECL or VAR_DECL. - 0=normal declaration, e.g. int min (int, int); - 1=implicit template instantiation - 2=explicit template specialization, e.g. int min (int, int); - 3=explicit template instantiation, e.g. template int min (int, int); */ -#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template) - -#define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1) -#define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \ - (CLASSTYPE_USE_TEMPLATE (NODE) & 1) - -#define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2) -#define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2) -#define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \ - (CLASSTYPE_USE_TEMPLATE (NODE) == 2) -#define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \ - (CLASSTYPE_USE_TEMPLATE (NODE) = 2) - -#define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1) -#define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1) -#define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ - (CLASSTYPE_USE_TEMPLATE(NODE) == 1) -#define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ - (CLASSTYPE_USE_TEMPLATE(NODE) = 1) - -#define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3) -#define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3) -#define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ - (CLASSTYPE_USE_TEMPLATE(NODE) == 3) -#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ - (CLASSTYPE_USE_TEMPLATE(NODE) = 3) - -/* Non-zero if DECL is a friend function which is an instantiation - from the point of view of the compiler, but not from the point of - view of the language. For example given: - template struct S { friend void f(T) {}; }; - the declaration of `void f(int)' generated when S is - instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be - a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */ -#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \ - (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL)) - -/* Non-zero if TYPE is a partial instantiation of a template class, - i.e., an instantiation whose instantiation arguments involve - template types. */ -#define PARTIAL_INSTANTIATION_P(TYPE) \ - (TYPE_LANG_SPECIFIC (TYPE)->type_flags.is_partial_instantiation) - -/* Non-zero iff we are currently processing a declaration for an - entity with its own template parameter list, and which is not a - full specialization. */ -#define PROCESSING_REAL_TEMPLATE_DECL_P() \ - (processing_template_decl > template_class_depth (current_class_type)) - -/* This function may be a guiding decl for a template. */ -#define DECL_MAYBE_TEMPLATE(NODE) DECL_LANG_FLAG_4 (NODE) - -/* Nonzero if this VAR_DECL or FUNCTION_DECL has already been - instantiated, i.e. its definition has been generated from the - pattern given in the the template. */ -#define DECL_TEMPLATE_INSTANTIATED(NODE) DECL_LANG_FLAG_1(NODE) - -/* We know what we're doing with this decl now. */ -#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE) - -/* This function was declared inline. This flag controls the linkage - semantics of 'inline'; whether or not the function is inlined is - controlled by DECL_INLINE. */ -#define DECL_THIS_INLINE(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.declared_inline) - -/* DECL_EXTERNAL must be set on a decl until the decl is actually emitted, - so that assemble_external will work properly. So we have this flag to - tell us whether the decl is really not external. */ -#define DECL_NOT_REALLY_EXTERN(NODE) \ - (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern) - -#define DECL_REALLY_EXTERN(NODE) \ - (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE)) - -#define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i) - -/* ...and for unexpanded-parameterized-type nodes. */ -#define UPT_TEMPLATE(NODE) TREE_PURPOSE(TYPE_VALUES(NODE)) -#define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE)) - -/* An un-parsed default argument looks like an identifier. */ -#define DEFARG_NODE_CHECK(t) TREE_CHECK(t, DEFAULT_ARG) -#define DEFARG_LENGTH(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.length) -#define DEFARG_POINTER(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.pointer) - -#define builtin_function(NAME, TYPE, CODE, LIBNAME) \ - define_function (NAME, TYPE, CODE, (void (*) PROTO((tree)))pushdecl, LIBNAME) - -/* These macros provide convenient access to the various _STMT nodes - created when parsing template declarations. */ -#define IF_COND(NODE) TREE_OPERAND (NODE, 0) -#define THEN_CLAUSE(NODE) TREE_OPERAND (NODE, 1) -#define ELSE_CLAUSE(NODE) TREE_OPERAND (NODE, 2) -#define WHILE_COND(NODE) TREE_OPERAND (NODE, 0) -#define WHILE_BODY(NODE) TREE_OPERAND (NODE, 1) -#define DO_COND(NODE) TREE_OPERAND (NODE, 0) -#define DO_BODY(NODE) TREE_OPERAND (NODE, 1) -#define RETURN_EXPR(NODE) TREE_OPERAND (NODE, 0) -#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (NODE, 0) -#define FOR_INIT_STMT(NODE) TREE_OPERAND (NODE, 0) -#define FOR_COND(NODE) TREE_OPERAND (NODE, 1) -#define FOR_EXPR(NODE) TREE_OPERAND (NODE, 2) -#define FOR_BODY(NODE) TREE_OPERAND (NODE, 3) -#define SWITCH_COND(NODE) TREE_OPERAND (NODE, 0) -#define SWITCH_BODY(NODE) TREE_OPERAND (NODE, 1) -#define CASE_LOW(NODE) TREE_OPERAND (NODE, 0) -#define CASE_HIGH(NODE) TREE_OPERAND (NODE, 1) -#define GOTO_DESTINATION(NODE) TREE_OPERAND (NODE, 0) -#define TRY_STMTS(NODE) TREE_OPERAND (NODE, 0) -#define TRY_HANDLERS(NODE) TREE_OPERAND (NODE, 1) -#define HANDLER_PARMS(NODE) TREE_OPERAND (NODE, 0) -#define HANDLER_BODY(NODE) TREE_OPERAND (NODE, 1) -#define COMPOUND_BODY(NODE) TREE_OPERAND (NODE, 0) -#define ASM_CV_QUAL(NODE) TREE_OPERAND (NODE, 0) -#define ASM_STRING(NODE) TREE_OPERAND (NODE, 1) -#define ASM_OUTPUTS(NODE) TREE_OPERAND (NODE, 2) -#define ASM_INPUTS(NODE) TREE_OPERAND (NODE, 3) -#define ASM_CLOBBERS(NODE) TREE_OPERAND (NODE, 4) - -/* An enumeration of the kind of tags that C++ accepts. */ -enum tag_types { record_type, class_type, union_type, enum_type, - signature_type }; - -/* Zero means prototype weakly, as in ANSI C (no args means nothing). - Each language context defines how this variable should be set. */ -extern int strict_prototype; -extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus; - -/* Non-zero means that if a label exists, and no other identifier - applies, use the value of the label. */ -extern int flag_labels_ok; - -/* Non-zero means to collect statistics which might be expensive - and to print them when we are done. */ -extern int flag_detailed_statistics; - -/* Non-zero means warn in function declared in derived class has the - same name as a virtual in the base class, but fails to match the - type signature of any virtual function in the base class. */ -extern int warn_overloaded_virtual; - -/* Nonzero means warn about use of multicharacter literals. */ -extern int warn_multichar; - -/* Non-zero means warn if a non-templatized friend function is - declared in a templatized class. This behavior is warned about with - flag_guiding_decls in do_friend. */ -extern int warn_nontemplate_friend; - -/* in c-common.c */ -extern void declare_function_name PROTO((void)); -extern void decl_attributes PROTO((tree, tree, tree)); -extern void init_function_format_info PROTO((void)); -extern void record_function_format PROTO((tree, tree, int, int, int)); -extern void check_function_format PROTO((tree, tree, tree)); -/* Print an error message for invalid operands to arith operation CODE. - NOP_EXPR is used as a special case (see truthvalue_conversion). */ -extern void binary_op_error PROTO((enum tree_code)); -extern tree cp_build_qualified_type PROTO((tree, int)); -extern tree canonical_type_variant PROTO((tree)); -extern void c_expand_expr_stmt PROTO((tree)); -/* Validate the expression after `case' and apply default promotions. */ -extern tree check_case_value PROTO((tree)); -/* Concatenate a list of STRING_CST nodes into one STRING_CST. */ -extern tree combine_strings PROTO((tree)); -extern void constant_expression_warning PROTO((tree)); -extern tree convert_and_check PROTO((tree, tree)); -extern void overflow_warning PROTO((tree)); -extern void unsigned_conversion_warning PROTO((tree, tree)); -extern void c_apply_type_quals_to_decl PROTO((int, tree)); - -/* Read the rest of the current #-directive line. */ -#if USE_CPPLIB -extern char *get_directive_line PROTO((void)); -#define GET_DIRECTIVE_LINE() get_directive_line () -#else -extern char *get_directive_line PROTO((FILE *)); -#define GET_DIRECTIVE_LINE() get_directive_line (finput) -#endif -/* Subroutine of build_binary_op, used for comparison operations. - See if the operands have both been converted from subword integer types - and, if so, perhaps change them both back to their original type. */ -extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *)); -/* Prepare expr to be an argument of a TRUTH_NOT_EXPR, - or validate its data type for an `if' or `while' statement or ?..: exp. */ -extern tree truthvalue_conversion PROTO((tree)); -extern tree type_for_mode PROTO((enum machine_mode, int)); -extern tree type_for_size PROTO((unsigned, int)); -extern int c_get_alias_set PROTO((tree)); - -/* in decl{2}.c */ -extern tree void_list_node; -extern tree void_zero_node; -extern tree default_function_type; -extern tree vtable_entry_type; -extern tree sigtable_entry_type; -extern tree __t_desc_type_node; -#if 0 -extern tree __tp_desc_type_node; -#endif -extern tree __access_mode_type_node; -extern tree __bltn_desc_type_node, __user_desc_type_node; -extern tree __class_desc_type_node, __attr_desc_type_node; -extern tree __ptr_desc_type_node, __func_desc_type_node; -extern tree __ptmf_desc_type_node, __ptmd_desc_type_node; -extern tree type_info_type_node; -extern tree class_star_type_node; -extern tree this_identifier; -extern tree ctor_identifier, dtor_identifier; -extern tree pfn_identifier; -extern tree index_identifier; -extern tree delta_identifier; -extern tree delta2_identifier; -extern tree pfn_or_delta2_identifier; -extern tree tag_identifier; -extern tree vt_off_identifier; -extern tree in_charge_identifier; - -/* A node that is a list (length 1) of error_mark_nodes. */ -extern tree error_mark_list; - -extern tree ptr_type_node; -extern tree class_type_node, record_type_node, union_type_node, enum_type_node; -extern tree unknown_type_node; -extern tree opaque_type_node, signature_type_node; - -extern tree vlist_identifier, vlist_type_node, vlist_zero_node; - -/* Node for "pointer to (virtual) function". - This may be distinct from ptr_type_node so gdb can distinguish them. */ -#define vfunc_ptr_type_node \ - (flag_vtable_thunks ? vtable_entry_type : ptr_type_node) - -/* The type of a vtbl, i.e., an array of vtable entries. */ -extern tree vtbl_type_node; -/* The type of a class vtbl pointer, i.e., a pointer to a vtable entry. */ -extern tree vtbl_ptr_type_node; -extern tree delta_type_node; -extern tree std_node; - -extern tree long_long_integer_type_node, long_long_unsigned_type_node; -/* For building calls to `delete'. */ -extern tree integer_two_node, integer_three_node; -extern tree boolean_type_node, boolean_true_node, boolean_false_node; - -extern tree null_node; - -extern tree anonymous_namespace_name; - -/* The FUNCTION_DECL for the default `::operator delete'. */ - -extern tree global_delete_fndecl; - -/* in pt.c */ - -/* These values are used for the `STRICT' parameter to type_unfication and - fn_type_unification. Their meanings are described with the - documentation for fn_type_unification. */ - -typedef enum unification_kind_t { - DEDUCE_CALL, - DEDUCE_CONV, - DEDUCE_EXACT -} unification_kind_t; - -extern tree current_template_parms; -extern HOST_WIDE_INT processing_template_decl; -extern tree last_tree; - -/* The template currently being instantiated, and where the instantiation - was triggered. */ -struct tinst_level -{ - tree decl; - int line; - char *file; - struct tinst_level *next; -}; - -extern int minimal_parse_mode; - -extern void maybe_print_template_context PROTO ((void)); - -/* in class.c */ - -/* When parsing a class definition, the access specifier most recently - given by the user, or, if no access specifier was given, the - default value appropriate for the kind of class (i.e., struct, - class, or union). */ -extern tree current_access_specifier; - -extern tree current_class_name; -extern tree current_class_type; -extern tree current_class_ptr; -extern tree previous_class_type; -extern tree current_class_ref; -extern int current_class_depth; - -extern tree current_lang_name; -extern tree lang_name_cplusplus, lang_name_c, lang_name_java; - -/* The low-water mark on the class-cache obstack. */ -extern char *class_cache_firstobj; - -/* Points to the name of that function. May not be the DECL_NAME - of CURRENT_FUNCTION_DECL due to overloading */ -extern tree original_function_name; - -/* in init.c */ -extern tree global_base_init_list; -extern tree current_base_init_list, current_member_init_list; - -extern int current_function_just_assigned_this; -extern int current_function_parms_stored; - -/* Here's where we control how name mangling takes place. */ - -#define OPERATOR_ASSIGN_FORMAT "__a%s" -#define OPERATOR_FORMAT "__%s" -#define OPERATOR_TYPENAME_FORMAT "__op" - -/* Cannot use '$' up front, because this confuses gdb - (names beginning with '$' are gdb-local identifiers). - - Note that all forms in which the '$' is significant are long enough - for direct indexing (meaning that if we know there is a '$' - at a particular location, we can index into the string at - any other location that provides distinguishing characters). */ - -/* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler - doesn't allow '$' in symbol names. */ -#ifndef NO_DOLLAR_IN_LABEL - -#define JOINER '$' - -#define VPTR_NAME "$v" -#define THROW_NAME "$eh_throw" -#define DESTRUCTOR_DECL_PREFIX "_$_" -#define AUTO_VTABLE_NAME "__vtbl$me__" -#define AUTO_TEMP_NAME "_$tmp_" -#define AUTO_TEMP_FORMAT "_$tmp_%d" -#define VTABLE_BASE "$vb" -#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt$%s") -#define VCTABLE_NAME "__vc$" -#define VLIST_NAME_FORMAT "__vl$%s" -#define VFIELD_BASE "$vf" -#define VFIELD_NAME "_vptr$" -#define VFIELD_NAME_FORMAT "_vptr$%s" -#define VBASE_NAME "_vb$" -#define VBASE_NAME_FORMAT "_vb$%s" -#define STATIC_NAME_FORMAT "_%s$%s" -#define ANON_AGGRNAME_FORMAT "$_%d" - -#else /* NO_DOLLAR_IN_LABEL */ - -#ifndef NO_DOT_IN_LABEL - -#define JOINER '.' - -#define VPTR_NAME ".v" -#define THROW_NAME ".eh_throw" -#define DESTRUCTOR_DECL_PREFIX "_._" -#define AUTO_VTABLE_NAME "__vtbl.me__" -#define AUTO_TEMP_NAME "_.tmp_" -#define AUTO_TEMP_FORMAT "_.tmp_%d" -#define VTABLE_BASE ".vb" -#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt.%s") -#define VCTABLE_NAME "__vc." -#define VLIST_NAME_FORMAT "__vl.%s" -#define VFIELD_BASE ".vf" -#define VFIELD_NAME "_vptr." -#define VFIELD_NAME_FORMAT "_vptr.%s" -#define VBASE_NAME "_vb." -#define VBASE_NAME_FORMAT "_vb.%s" -#define STATIC_NAME_FORMAT "_%s.%s" - -#define ANON_AGGRNAME_FORMAT "._%d" - -#else /* NO_DOT_IN_LABEL */ - -#define VPTR_NAME "__vptr" -#define VPTR_NAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1)) -#define THROW_NAME "__eh_throw" -#define DESTRUCTOR_DECL_PREFIX "__destr_" -#define DESTRUCTOR_NAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \ - sizeof (DESTRUCTOR_DECL_PREFIX) - 1)) -#define IN_CHARGE_NAME "__in_chrg" -#define AUTO_VTABLE_NAME "__vtbl_me__" -#define AUTO_TEMP_NAME "__tmp_" -#define TEMP_NAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \ - sizeof (AUTO_TEMP_NAME) - 1)) -#define AUTO_TEMP_FORMAT "__tmp_%d" -#define VTABLE_BASE "__vtb" -#define VTABLE_NAME "__vt_" -#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt_%s") -#define VTABLE_NAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \ - sizeof (VTABLE_NAME) - 1)) -#define VCTABLE_NAME "__vc_" -#define VLIST_NAME_FORMAT "__vl_%s" -#define VFIELD_BASE "__vfb" -#define VFIELD_NAME "__vptr_" -#define VFIELD_NAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \ - sizeof (VFIELD_NAME) - 1)) -#define VFIELD_NAME_FORMAT "_vptr_%s" -#define VBASE_NAME "__vb_" -#define VBASE_NAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \ - sizeof (VBASE_NAME) - 1)) -#define VBASE_NAME_FORMAT "__vb_%s" -#define STATIC_NAME_FORMAT "__static_%s_%s" - -#define ANON_AGGRNAME_PREFIX "__anon_" -#define ANON_AGGRNAME_P(ID_NODE) \ - (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \ - sizeof (ANON_AGGRNAME_PREFIX) - 1)) -#define ANON_AGGRNAME_FORMAT "__anon_%d" -#define ANON_PARMNAME_FORMAT "__%d" -#define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \ - && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \ - && IDENTIFIER_POINTER (ID_NODE)[2] <= '9') - -#endif /* NO_DOT_IN_LABEL */ -#endif /* NO_DOLLAR_IN_LABEL */ - -#define THIS_NAME "this" -#define DESTRUCTOR_NAME_FORMAT "~%s" -#define FILE_FUNCTION_PREFIX_LEN 9 -#define CTOR_NAME "__ct" -#define DTOR_NAME "__dt" - -#define IN_CHARGE_NAME "__in_chrg" -#define VLIST_NAME "__vlist" -#define VLIST1_NAME "__vlist1" -#define VLIST_TYPE_NAME "6_Vlist" - -#define VTBL_PTR_TYPE "__vtbl_ptr_type" -#define VTABLE_DELTA_NAME "__delta" -#define VTABLE_INDEX_NAME "__index" -#define VTABLE_PFN_NAME "__pfn" -#define VTABLE_DELTA2_NAME "__delta2" - -#define SIGNATURE_FIELD_NAME "__s_" -#define SIGNATURE_FIELD_NAME_FORMAT "__s_%s" -#define SIGNATURE_OPTR_NAME "__optr" -#define SIGNATURE_SPTR_NAME "__sptr" -#define SIGNATURE_POINTER_NAME "__sp_" -#define SIGNATURE_POINTER_NAME_FORMAT "__%s%s%ssp_%s" -#define SIGNATURE_REFERENCE_NAME "__sr_" -#define SIGNATURE_REFERENCE_NAME_FORMAT "__%s%s%ssr_%s" - -#define SIGTABLE_PTR_TYPE "__sigtbl_ptr_type" -#define SIGTABLE_NAME_FORMAT "__st_%s_%s" -#define SIGTABLE_NAME_FORMAT_LONG "__st_%s_%s_%d" -#define SIGTABLE_TAG_NAME "__tag" -#define SIGTABLE_VB_OFF_NAME "__vb_off" -#define SIGTABLE_VT_OFF_NAME "__vt_off" -#define EXCEPTION_CLEANUP_NAME "exception cleanup" - -#define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0) - -#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) - -#define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \ - && IDENTIFIER_POINTER (ID_NODE)[1] == 'v') -#define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \ - && IDENTIFIER_POINTER (ID_NODE)[2] == '_') - -#define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \ - && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \ - && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER) - -#define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \ - && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \ - && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER) - -#define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1)) -#define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1)) - -/* For anonymous aggregate types, we need some sort of name to - hold on to. In practice, this should not appear, but it should - not be harmful if it does. */ -#define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \ - && IDENTIFIER_POINTER (ID_NODE)[1] == '_') -#define ANON_PARMNAME_FORMAT "_%d" -#define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \ - && IDENTIFIER_POINTER (ID_NODE)[1] <= '9') -#endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */ - -/* Store the vbase pointer field name for type TYPE into pointer BUF. */ -#define FORMAT_VBASE_NAME(BUF,TYPE) do { \ - char *wbuf = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE) \ - + sizeof (VBASE_NAME) + 1); \ - sprintf (wbuf, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \ - (BUF) = wbuf; \ -} while (0) - -/* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is - `main'. */ -#define MAIN_NAME_P(ID_NODE) \ - (strcmp (IDENTIFIER_POINTER (ID_NODE), "main") == 0) - -/* Returns non-zero iff NODE is a declaration for the global function - `main'. */ -#define DECL_MAIN_P(NODE) \ - (TREE_CODE (NODE) == FUNCTION_DECL \ - && DECL_LANGUAGE (NODE) == lang_c \ - && DECL_NAME (NODE) != NULL_TREE \ - && MAIN_NAME_P (DECL_NAME (NODE))) - - -/* Define the sets of attributes that member functions and baseclasses - can have. These are sensible combinations of {public,private,protected} - cross {virtual,non-virtual}. */ - -/* in class.c. */ -extern tree access_default_node; /* 0 */ -extern tree access_public_node; /* 1 */ -extern tree access_protected_node; /* 2 */ -extern tree access_private_node; /* 3 */ -extern tree access_default_virtual_node; /* 4 */ -extern tree access_public_virtual_node; /* 5 */ -extern tree access_protected_virtual_node; /* 6 */ -extern tree access_private_virtual_node; /* 7 */ - -/* Things for handling inline functions. */ - -struct pending_inline -{ - struct pending_inline *next; /* pointer to next in chain */ - int lineno; /* line number we got the text from */ - char *filename; /* name of file we were processing */ - tree fndecl; /* FUNCTION_DECL that brought us here */ - int token; /* token we were scanning */ - int token_value; /* value of token we were scanning (YYSTYPE) */ - - char *buf; /* pointer to character stream */ - int len; /* length of stream */ - unsigned int can_free : 1; /* free this after we're done with it? */ - unsigned int deja_vu : 1; /* set iff we don't want to see it again. */ - unsigned int interface : 2; /* 0=interface 1=unknown 2=implementation */ -}; - -/* in method.c */ -extern struct pending_inline *pending_inlines; - -/* Positive values means that we cannot make optimizing assumptions about - `this'. Negative values means we know `this' to be of static type. */ - -extern int flag_this_is_variable; - -/* Nonzero means generate 'rtti' that give run-time type information. */ - -extern int flag_rtti; - -/* Nonzero means do emit exported implementations of functions even if - they can be inlined. */ - -extern int flag_implement_inlines; - -/* Nonzero means templates obey #pragma interface and implementation. */ - -extern int flag_external_templates; - -/* Nonzero means templates are emitted where they are instantiated. */ - -extern int flag_alt_external_templates; - -/* Nonzero means implicit template instantiations are emitted. */ - -extern int flag_implicit_templates; - -/* Nonzero if we want to emit defined symbols with common-like linkage as - weak symbols where possible, in order to conform to C++ semantics. - Otherwise, emit them as local symbols. */ - -extern int flag_weak; - -/* Nonzero to enable experimental ABI changes. */ - -extern int flag_new_abi; - -/* Nonzero to not ignore namespace std. */ - -extern int flag_honor_std; - -/* Nonzero if we're done parsing and into end-of-file activities. */ - -extern int at_eof; - -enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; - -/* The following two can be derived from the previous one */ -extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */ - -/* Some macros for char-based bitfields. */ -#define B_SET(a,x) (a[x>>3] |= (1 << (x&7))) -#define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7))) -#define B_TST(a,x) (a[x>>3] & (1 << (x&7))) - -/* These are uses as bits in flags passed to build_method_call - to control its error reporting behavior. - - LOOKUP_PROTECT means flag access violations. - LOOKUP_COMPLAIN mean complain if no suitable member function - matching the arguments is found. - LOOKUP_NORMAL is just a combination of these two. - LOOKUP_NONVIRTUAL means make a direct call to the member function found - LOOKUP_GLOBAL means search through the space of overloaded functions, - as well as the space of member functions. - LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already - in the parameter list. - LOOKUP_HAS_VLIST means that the "vlist" variable is already in - the parameter list. - LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried. - DIRECT_BIND means that if a temporary is created, it should be created so - that it lives as long as the current variable bindings; otherwise it - only lives until the end of the complete-expression. - LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are - after. Note, LOOKUP_COMPLAIN is checked and error messages printed - before LOOKUP_SPECULATIVELY is checked. - LOOKUP_NO_CONVERSION means that user-defined conversions are not - permitted. Built-in conversions are permitted. - LOOKUP_DESTRUCTOR means explicit call to destructor. - LOOKUP_NO_TEMP_BIND means temporaries will not be bound to references. - - These are used in global lookup to support elaborated types and - qualifiers. - - LOOKUP_PREFER_TYPES means not to accept objects, and possibly namespaces. - LOOKUP_PREFER_NAMESPACES means not to accept objects, and possibly types. - LOOKUP_PREFER_BOTH means class-or-namespace-name. - LOOKUP_TEMPLATES_EXPECTED means that class templates also count - as types. */ - -#define LOOKUP_PROTECT (1) -#define LOOKUP_COMPLAIN (2) -#define LOOKUP_NORMAL (3) -/* #define LOOKUP_UNUSED (4) */ -#define LOOKUP_NONVIRTUAL (8) -#define LOOKUP_GLOBAL (16) -#define LOOKUP_HAS_IN_CHARGE (32) -#define LOOKUP_SPECULATIVELY (64) -#define LOOKUP_ONLYCONVERTING (128) -#define DIRECT_BIND (256) -#define LOOKUP_NO_CONVERSION (512) -#define LOOKUP_DESTRUCTOR (512) -#define LOOKUP_NO_TEMP_BIND (1024) -#define LOOKUP_PREFER_TYPES (2048) -#define LOOKUP_PREFER_NAMESPACES (4096) -#define LOOKUP_PREFER_BOTH (6144) -#define LOOKUP_TEMPLATES_EXPECTED (8192) -#define LOOKUP_HAS_VLIST (16384) - -#define LOOKUP_NAMESPACES_ONLY(f) \ - (((f) & LOOKUP_PREFER_NAMESPACES) && !((f) & LOOKUP_PREFER_TYPES)) -#define LOOKUP_TYPES_ONLY(f) \ - (!((f) & LOOKUP_PREFER_NAMESPACES) && ((f) & LOOKUP_PREFER_TYPES)) -#define LOOKUP_QUALIFIERS_ONLY(f) ((f) & LOOKUP_PREFER_BOTH) - - -/* These flags are used by the conversion code. - CONV_IMPLICIT : Perform implicit conversions (standard and user-defined). - CONV_STATIC : Perform the explicit conversions for static_cast. - CONV_CONST : Perform the explicit conversions for const_cast. - CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast. - CONV_PRIVATE : Perform upcasts to private bases. - CONV_FORCE_TEMP : Require a new temporary when converting to the same - aggregate type. */ - -#define CONV_IMPLICIT 1 -#define CONV_STATIC 2 -#define CONV_CONST 4 -#define CONV_REINTERPRET 8 -#define CONV_PRIVATE 16 -/* #define CONV_NONCONVERTING 32 */ -#define CONV_FORCE_TEMP 64 -#define CONV_STATIC_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_FORCE_TEMP) -#define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \ - | CONV_REINTERPRET) -#define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \ - | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP) - -/* Used by build_expr_type_conversion to indicate which types are - acceptable as arguments to the expression under consideration. */ - -#define WANT_INT 1 /* integer types, including bool */ -#define WANT_FLOAT 2 /* floating point types */ -#define WANT_ENUM 4 /* enumerated types */ -#define WANT_POINTER 8 /* pointer types */ -#define WANT_NULL 16 /* null pointer constant */ -#define WANT_ARITH (WANT_INT | WANT_FLOAT) - -/* Used with comptypes, and related functions, to guide type - comparison. */ - -#define COMPARE_STRICT 0 /* Just check if the types are the - same. */ -#define COMPARE_BASE 1 /* Check to see if the second type is - derived from the first, or if both - are pointers (or references) and - the types pointed to by the second - type is derived from the pointed to - by the first. */ -#define COMPARE_RELAXED 2 /* Like COMPARE_DERIVED, but in - reverse. Also treat enmeration - types as the same as integer types - of the same width. */ -#define COMPARE_REDECLARATION 4 /* The comparsion is being done when - another declaration of an existing - entity is seen. */ -#define COMPARE_NO_ATTRIBUTES 8 /* The comparison should ignore - extra-linguistic type attributes. */ - -/* Used with push_overloaded_decl. */ -#define PUSH_GLOBAL 0 /* Push the DECL into namespace scope, - regardless of the current scope. */ -#define PUSH_LOCAL 1 /* Push the DECL into the current - scope. */ -#define PUSH_USING 2 /* We are pushing this DECL as the - result of a using declaration. */ - -/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual - sense of `same'. */ -#define same_type_p(type1, type2) \ - comptypes ((type1), (type2), COMPARE_STRICT) - -/* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2 - is derived from TYPE1, or if TYPE2 is a pointer (reference) to a - class derived from the type pointed to (referred to) by TYPE1. */ -#define same_or_base_type_p(type1, type2) \ - comptypes ((type1), (type2), COMPARE_BASE) - -/* These macros are used to access a TEMPLATE_PARM_INDEX. */ -#define TEMPLATE_PARM_IDX(NODE) (((template_parm_index*) NODE)->index) -#define TEMPLATE_PARM_LEVEL(NODE) (((template_parm_index*) NODE)->level) -#define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE)) -#define TEMPLATE_PARM_ORIG_LEVEL(NODE) (((template_parm_index*) NODE)->orig_level) -#define TEMPLATE_PARM_DECL(NODE) (((template_parm_index*) NODE)->decl) - -/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM - and TEMPLATE_TEMPLATE_PARM nodes. */ -#define TEMPLATE_TYPE_PARM_INDEX(NODE) (TYPE_FIELDS (NODE)) -#define TEMPLATE_TYPE_IDX(NODE) \ - (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE))) -#define TEMPLATE_TYPE_LEVEL(NODE) \ - (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE))) -#define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \ - (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE))) -#define TEMPLATE_TYPE_DECL(NODE) \ - (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE))) - -/* in lex.c */ -/* Indexed by TREE_CODE, these tables give C-looking names to - operators represented by TREE_CODES. For example, - opname_tab[(int) MINUS_EXPR] == "-". */ -extern char **opname_tab, **assignop_tab; - -/* in call.c */ -extern int check_dtor_name PROTO((tree, tree)); -extern int get_arglist_len_in_bytes PROTO((tree)); - -extern tree build_vfield_ref PROTO((tree, tree)); -extern tree resolve_scope_to_name PROTO((tree, tree)); -extern tree build_scoped_method_call PROTO((tree, tree, tree, tree)); -extern tree build_addr_func PROTO((tree)); -extern tree build_call PROTO((tree, tree, tree)); -extern tree build_method_call PROTO((tree, tree, tree, tree, int)); -extern int null_ptr_cst_p PROTO((tree)); -extern tree type_decays_to PROTO((tree)); -extern tree build_user_type_conversion PROTO((tree, tree, int)); -extern tree build_new_function_call PROTO((tree, tree)); -extern tree build_new_op PROTO((enum tree_code, int, tree, tree, tree)); -extern tree build_op_new_call PROTO((enum tree_code, tree, tree, int)); -extern tree build_op_delete_call PROTO((enum tree_code, tree, tree, int, tree)); -extern int can_convert PROTO((tree, tree)); -extern int can_convert_arg PROTO((tree, tree, tree)); -extern int enforce_access PROTO((tree, tree)); -extern tree convert_default_arg PROTO((tree, tree, tree)); -extern tree convert_arg_to_ellipsis PROTO((tree)); -extern int is_properly_derived_from PROTO((tree, tree)); - -/* in class.c */ -extern tree build_vbase_path PROTO((enum tree_code, tree, tree, tree, int)); -extern tree build_vtbl_ref PROTO((tree, tree)); -extern tree build_vfn_ref PROTO((tree *, tree, tree)); -extern void add_method PROTO((tree, tree *, tree)); -extern int currently_open_class PROTO((tree)); -extern tree get_vfield_offset PROTO((tree)); -extern void duplicate_tag_error PROTO((tree)); -extern tree finish_struct PROTO((tree, tree, int)); -extern void finish_struct_1 PROTO((tree, int)); -extern int resolves_to_fixed_type_p PROTO((tree, int *)); -extern void init_class_processing PROTO((void)); -extern int is_empty_class PROTO((tree)); -extern void pushclass PROTO((tree, int)); -extern void popclass PROTO((void)); -extern void push_nested_class PROTO((tree, int)); -extern void pop_nested_class PROTO((void)); -extern void push_lang_context PROTO((tree)); -extern void pop_lang_context PROTO((void)); -extern tree instantiate_type PROTO((tree, tree, int)); -extern void print_class_statistics PROTO((void)); -extern void push_cache_obstack PROTO((void)); -extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *, tree)); -extern void build_self_reference PROTO((void)); -extern void warn_hidden PROTO((tree)); -extern tree get_enclosing_class PROTO((tree)); -int is_base_of_enclosing_class PROTO((tree, tree)); -extern void unreverse_member_declarations PROTO((tree)); -extern void invalidate_class_lookup_cache PROTO((void)); -extern void maybe_note_name_used_in_class PROTO((tree, tree)); -extern void note_name_declared_in_class PROTO((tree, tree)); - -/* in cvt.c */ -extern tree convert_to_reference PROTO((tree, tree, int, int, tree)); -extern tree convert_from_reference PROTO((tree)); -extern tree convert_pointer_to_real PROTO((tree, tree)); -extern tree convert_pointer_to PROTO((tree, tree)); -extern tree ocp_convert PROTO((tree, tree, int, int)); -extern tree cp_convert PROTO((tree, tree)); -extern tree convert PROTO((tree, tree)); -extern tree convert_force PROTO((tree, tree, int)); -extern tree build_type_conversion PROTO((tree, tree, int)); -extern tree build_expr_type_conversion PROTO((int, tree, int)); -extern tree type_promotes_to PROTO((tree)); -extern tree perform_qualification_conversions PROTO((tree, tree)); - -/* decl.c */ -/* resume_binding_level */ -extern void set_identifier_local_value PROTO((tree, tree)); -extern int global_bindings_p PROTO((void)); -extern int toplevel_bindings_p PROTO((void)); -extern int namespace_bindings_p PROTO((void)); -extern void keep_next_level PROTO((void)); -extern int kept_level_p PROTO((void)); -extern void declare_parm_level PROTO((void)); -extern void declare_pseudo_global_level PROTO((void)); -extern int pseudo_global_level_p PROTO((void)); -extern void set_class_shadows PROTO((tree)); -extern void pushlevel PROTO((int)); -extern void note_level_for_for PROTO((void)); -extern void pushlevel_temporary PROTO((int)); -extern tree poplevel PROTO((int, int, int)); -extern void resume_level PROTO((struct binding_level *)); -extern void delete_block PROTO((tree)); -extern void insert_block PROTO((tree)); -extern void add_block_current_level PROTO((tree)); -extern void set_block PROTO((tree)); -extern void pushlevel_class PROTO((void)); -extern void print_binding_stack PROTO((void)); -extern void print_binding_level PROTO((struct binding_level *)); -extern void push_namespace PROTO((tree)); -extern void pop_namespace PROTO((void)); -extern void maybe_push_to_top_level PROTO((int)); -extern void push_to_top_level PROTO((void)); -extern void pop_from_top_level PROTO((void)); -extern tree identifier_type_value PROTO((tree)); -extern void set_identifier_type_value PROTO((tree, tree)); -extern void pop_everything PROTO((void)); -extern void pushtag PROTO((tree, tree, int)); -extern tree make_anon_name PROTO((void)); -extern void clear_anon_tags PROTO((void)); -extern int decls_match PROTO((tree, tree)); -extern int duplicate_decls PROTO((tree, tree)); -extern tree pushdecl PROTO((tree)); -extern tree pushdecl_top_level PROTO((tree)); -extern void pushdecl_class_level PROTO((tree)); -#if 0 -extern void pushdecl_nonclass_level PROTO((tree)); -#endif -extern tree pushdecl_namespace_level PROTO((tree)); -extern tree push_using_decl PROTO((tree, tree)); -extern tree push_using_directive PROTO((tree)); -extern void push_class_level_binding PROTO((tree, tree)); -extern tree implicitly_declare PROTO((tree)); -extern tree lookup_label PROTO((tree)); -extern tree shadow_label PROTO((tree)); -extern tree define_label PROTO((char *, int, tree)); -extern void push_switch PROTO((void)); -extern void pop_switch PROTO((void)); -extern void define_case_label PROTO((void)); -extern tree getdecls PROTO((void)); -extern tree gettags PROTO((void)); -#if 0 -extern void set_current_level_tags_transparency PROTO((int)); -#endif -extern tree binding_for_name PROTO((tree, tree)); -extern tree namespace_binding PROTO((tree, tree)); -extern void set_namespace_binding PROTO((tree, tree, tree)); -extern tree lookup_namespace_name PROTO((tree, tree)); -extern tree build_typename_type PROTO((tree, tree, tree, tree)); -extern tree make_typename_type PROTO((tree, tree)); -extern tree lookup_name_nonclass PROTO((tree)); -extern tree lookup_function_nonclass PROTO((tree, tree)); -extern tree lookup_name PROTO((tree, int)); -extern tree lookup_name_current_level PROTO((tree)); -extern tree lookup_type_current_level PROTO((tree)); -extern tree lookup_name_namespace_only PROTO((tree)); -extern void begin_only_namespace_names PROTO((void)); -extern void end_only_namespace_names PROTO((void)); -extern tree namespace_ancestor PROTO((tree, tree)); -extern int lookup_using_namespace PROTO((tree,tree,tree,tree,int)); -extern int qualified_lookup_using_namespace PROTO((tree,tree,tree,int)); -extern tree auto_function PROTO((tree, tree, enum built_in_function)); -extern void init_decl_processing PROTO((void)); -extern int init_type_desc PROTO((void)); -extern tree define_function - PROTO((const char *, tree, enum built_in_function, - void (*) (tree), const char *)); -extern tree check_tag_decl PROTO((tree)); -extern void shadow_tag PROTO((tree)); -extern tree groktypename PROTO((tree)); -extern tree start_decl PROTO((tree, tree, int, tree, tree)); -extern void start_decl_1 PROTO((tree)); -extern void cp_finish_decl PROTO((tree, tree, tree, int, int)); -extern void finish_decl PROTO((tree, tree, tree)); -extern void expand_static_init PROTO((tree, tree)); -extern int complete_array_type PROTO((tree, tree, int)); -extern tree build_ptrmemfunc_type PROTO((tree)); -/* the grokdeclarator prototype is in decl.h */ -extern int parmlist_is_exprlist PROTO((tree)); -extern int copy_args_p PROTO((tree)); -extern int grok_ctor_properties PROTO((tree, tree)); -extern void grok_op_properties PROTO((tree, int, int)); -extern tree xref_tag PROTO((tree, tree, int)); -extern tree xref_tag_from_type PROTO((tree, tree, int)); -extern void xref_basetypes PROTO((tree, tree, tree, tree)); -extern tree start_enum PROTO((tree)); -extern tree finish_enum PROTO((tree)); -extern tree build_enumerator PROTO((tree, tree, tree)); -extern int start_function PROTO((tree, tree, tree, int)); -extern void expand_start_early_try_stmts PROTO((void)); -extern void store_parm_decls PROTO((void)); -extern void store_return_init PROTO((tree, tree)); -extern void finish_function PROTO((int, int, int)); -extern tree start_method PROTO((tree, tree, tree)); -extern tree finish_method PROTO((tree)); -extern void hack_incomplete_structures PROTO((tree)); -extern tree maybe_build_cleanup_and_delete PROTO((tree)); -extern tree maybe_build_cleanup PROTO((tree)); -extern void cplus_expand_expr_stmt PROTO((tree)); -extern void finish_stmt PROTO((void)); -extern void push_cp_function_context PROTO((tree)); -extern void pop_cp_function_context PROTO((tree)); -extern int in_function_p PROTO((void)); -extern void replace_defarg PROTO((tree, tree)); -extern void print_other_binding_stack PROTO((struct binding_level *)); -extern void revert_static_member_fn PROTO((tree*, tree*, tree*)); -extern void fixup_anonymous_union PROTO((tree)); -extern int check_static_variable_definition PROTO((tree, tree)); -extern void push_local_binding PROTO((tree, tree, int)); -extern int push_class_binding PROTO((tree, tree)); -extern tree check_default_argument PROTO((tree, tree)); -extern tree push_overloaded_decl PROTO((tree, int)); -extern void clear_identifier_class_values PROTO((void)); -extern void storetags PROTO((tree)); -extern int vtable_decl_p PROTO((tree, void *)); -extern int vtype_decl_p PROTO((tree, void *)); -extern int sigtable_decl_p PROTO((tree, void *)); -typedef int (*walk_globals_pred) PROTO((tree, void *)); -typedef int (*walk_globals_fn) PROTO((tree *, void *)); -extern int walk_globals PROTO((walk_globals_pred, - walk_globals_fn, - void *)); -typedef int (*walk_namespaces_fn) PROTO((tree, void *)); -extern int walk_namespaces PROTO((walk_namespaces_fn, - void *)); -extern int wrapup_globals_for_namespace PROTO((tree, void *)); - -/* in decl2.c */ -extern int check_java_method PROTO((tree)); -extern int lang_decode_option PROTO((int, char **)); -extern tree grok_method_quals PROTO((tree, tree, tree)); -extern void warn_if_unknown_interface PROTO((tree)); -extern void grok_x_components PROTO((tree)); -extern void maybe_retrofit_in_chrg PROTO((tree)); -extern void maybe_make_one_only PROTO((tree)); -extern void grokclassfn PROTO((tree, tree, enum overload_flags, tree)); -extern tree grok_alignof PROTO((tree)); -extern tree grok_array_decl PROTO((tree, tree)); -extern tree delete_sanity PROTO((tree, tree, int, int)); -extern tree check_classfn PROTO((tree, tree)); -extern void check_member_template PROTO((tree)); -extern tree grokfield PROTO((tree, tree, tree, tree, tree)); -extern tree grokbitfield PROTO((tree, tree, tree)); -extern tree groktypefield PROTO((tree, tree)); -extern tree grokoptypename PROTO((tree, tree)); -extern int copy_assignment_arg_p PROTO((tree, int)); -extern void cplus_decl_attributes PROTO((tree, tree, tree)); -extern tree constructor_name_full PROTO((tree)); -extern tree constructor_name PROTO((tree)); -extern void setup_vtbl_ptr PROTO((void)); -extern void mark_inline_for_output PROTO((tree)); -extern void clear_temp_name PROTO((void)); -extern tree get_temp_name PROTO((tree, int)); -extern tree get_temp_regvar PROTO((tree, tree)); -extern void finish_anon_union PROTO((tree)); -extern tree finish_table PROTO((tree, tree, tree, int)); -extern void finish_builtin_type PROTO((tree, const char *, - tree *, int, tree)); -extern tree coerce_new_type PROTO((tree)); -extern tree coerce_delete_type PROTO((tree)); -extern void comdat_linkage PROTO((tree)); -extern void import_export_class PROTO((tree)); -extern void import_export_vtable PROTO((tree, tree, int)); -extern void import_export_decl PROTO((tree)); -extern tree build_cleanup PROTO((tree)); -extern void finish_file PROTO((void)); -extern tree reparse_absdcl_as_expr PROTO((tree, tree)); -extern tree reparse_absdcl_as_casts PROTO((tree, tree)); -extern tree build_expr_from_tree PROTO((tree)); -extern tree reparse_decl_as_expr PROTO((tree, tree)); -extern tree finish_decl_parsing PROTO((tree)); -extern tree check_cp_case_value PROTO((tree)); -extern void set_decl_namespace PROTO((tree, tree, int)); -extern tree current_decl_namespace PROTO((void)); -extern void push_decl_namespace PROTO((tree)); -extern void pop_decl_namespace PROTO((void)); -extern void push_scope PROTO((tree)); -extern void pop_scope PROTO((tree)); -extern void do_namespace_alias PROTO((tree, tree)); -extern void do_toplevel_using_decl PROTO((tree)); -extern void do_local_using_decl PROTO((tree)); -extern tree do_class_using_decl PROTO((tree)); -extern void do_using_directive PROTO((tree)); -extern void check_default_args PROTO((tree)); -extern void mark_used PROTO((tree)); -extern tree handle_class_head PROTO((tree, tree, tree)); -extern tree lookup_arg_dependent PROTO((tree, tree, tree)); -extern void finish_static_data_member_decl PROTO((tree, tree, tree, int, int)); - -/* in errfn.c */ -/* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */ -extern void cp_error PVPROTO((const char *, ...)); -extern void cp_error_at PVPROTO((const char *, ...)); -extern void cp_warning PVPROTO((const char *, ...)); -extern void cp_warning_at PVPROTO((const char *, ...)); -extern void cp_pedwarn PVPROTO((const char *, ...)); -extern void cp_pedwarn_at PVPROTO((const char *, ...)); -extern void cp_compiler_error PVPROTO((const char *, ...)); -extern void cp_sprintf PVPROTO((const char *, ...)); -extern void cp_deprecated PROTO((const char*)); - -/* in error.c */ -extern void init_error PROTO((void)); -extern char *fndecl_as_string PROTO((tree, int)); -extern char *type_as_string PROTO((tree, int)); -extern char *type_as_string_real PROTO((tree, int, int)); -extern char *args_as_string PROTO((tree, int)); -extern char *decl_as_string PROTO((tree, int)); -extern char *expr_as_string PROTO((tree, int)); -extern char *code_as_string PROTO((enum tree_code, int)); -extern char *language_as_string PROTO((enum languages, int)); -extern char *parm_as_string PROTO((int, int)); -extern char *op_as_string PROTO((enum tree_code, int)); -extern char *assop_as_string PROTO((enum tree_code, int)); -extern char *cv_as_string PROTO((tree, int)); -extern char *lang_decl_name PROTO((tree, int)); -extern char *cp_file_of PROTO((tree)); -extern int cp_line_of PROTO((tree)); - -/* in except.c */ -extern void init_exception_processing PROTO((void)); -extern void expand_start_catch_block PROTO((tree, tree)); -extern void expand_end_catch_block PROTO((void)); -extern void expand_builtin_throw PROTO((void)); -extern void expand_start_eh_spec PROTO((void)); -extern void expand_exception_blocks PROTO((void)); -extern tree start_anon_func PROTO((void)); -extern void end_anon_func PROTO((void)); -extern void expand_throw PROTO((tree)); -extern tree build_throw PROTO((tree)); -extern void mark_all_runtime_matches PROTO((void)); - -/* in expr.c */ -extern void init_cplus_expand PROTO((void)); -extern void fixup_result_decl PROTO((tree, struct rtx_def *)); -extern int extract_init PROTO((tree, tree)); -extern void do_case PROTO((tree, tree)); - -/* friend.c */ -extern int is_friend PROTO((tree, tree)); -extern void make_friend_class PROTO((tree, tree)); -extern void add_friend PROTO((tree, tree)); -extern void add_friends PROTO((tree, tree, tree)); -extern tree do_friend PROTO((tree, tree, tree, tree, tree, enum overload_flags, tree, int)); - -/* in init.c */ -extern void init_init_processing PROTO((void)); -extern void expand_direct_vtbls_init PROTO((tree, tree, int, int, tree)); -extern void emit_base_init PROTO((tree, int)); -extern void check_base_init PROTO((tree)); -extern void expand_member_init PROTO((tree, tree, tree)); -extern void expand_aggr_init PROTO((tree, tree, int)); -extern int is_aggr_typedef PROTO((tree, int)); -extern int is_aggr_type PROTO((tree, int)); -extern tree get_aggr_from_typedef PROTO((tree, int)); -extern tree get_type_value PROTO((tree)); -extern tree build_member_call PROTO((tree, tree, tree)); -extern tree build_offset_ref PROTO((tree, tree)); -extern tree resolve_offset_ref PROTO((tree)); -extern tree decl_constant_value PROTO((tree)); -extern tree build_new PROTO((tree, tree, tree, int)); -extern tree build_new_1 PROTO((tree)); -extern tree expand_vec_init PROTO((tree, tree, tree, tree, int)); -extern tree build_x_delete PROTO((tree, int, tree)); -extern tree build_delete PROTO((tree, tree, tree, int, int)); -extern tree build_vbase_delete PROTO((tree, tree)); -extern tree build_vec_delete PROTO((tree, tree, tree, tree, int)); -extern tree build_base_dtor_call PROTO((tree, tree, tree)); -extern void init_vlist PROTO((tree)); - -/* in input.c */ - -/* in lex.c */ -extern char *file_name_nondirectory PROTO((const char *)); -extern tree make_pointer_declarator PROTO((tree, tree)); -extern tree make_reference_declarator PROTO((tree, tree)); -extern tree make_call_declarator PROTO((tree, tree, tree, tree)); -extern void set_quals_and_spec PROTO((tree, tree, tree)); -extern char *operator_name_string PROTO((tree)); -extern void lang_init PROTO((void)); -extern void lang_finish PROTO((void)); -#if 0 -extern void reinit_lang_specific PROTO((void)); -#endif -extern void reinit_parse_for_function PROTO((void)); -extern void print_parse_statistics PROTO((void)); -extern void extract_interface_info PROTO((void)); -extern void do_pending_inlines PROTO((void)); -extern void process_next_inline PROTO((tree)); -extern struct pending_input *save_pending_input PROTO((void)); -extern void restore_pending_input PROTO((struct pending_input *)); -extern void yyungetc PROTO((int, int)); -extern void reinit_parse_for_method PROTO((int, tree)); -extern void reinit_parse_for_block PROTO((int, struct obstack *)); -extern tree cons_up_default_function PROTO((tree, tree, int)); -extern void check_for_missing_semicolon PROTO((tree)); -extern void note_got_semicolon PROTO((tree)); -extern void note_list_got_semicolon PROTO((tree)); -extern void do_pending_lang_change PROTO((void)); -extern int identifier_type PROTO((tree)); -extern void see_typename PROTO((void)); -extern tree do_identifier PROTO((tree, int, tree)); -extern tree do_scoped_id PROTO((tree, int)); -extern tree identifier_typedecl_value PROTO((tree)); -extern int real_yylex PROTO((void)); -extern int is_rid PROTO((tree)); -extern tree build_lang_decl PROTO((enum tree_code, tree, tree)); -extern void retrofit_lang_decl PROTO((tree)); -extern tree build_lang_field_decl PROTO((enum tree_code, tree, tree)); -extern void copy_lang_decl PROTO((tree)); -extern tree make_lang_type PROTO((enum tree_code)); -extern void dump_time_statistics PROTO((void)); -extern void compiler_error PVPROTO((const char *, ...)) - ATTRIBUTE_PRINTF_1; -extern void yyerror PROTO((const char *)); -extern void clear_inline_text_obstack PROTO((void)); -extern void maybe_snarf_defarg PROTO((void)); -extern tree snarf_defarg PROTO((void)); -extern void add_defarg_fn PROTO((tree)); -extern void do_pending_defargs PROTO((void)); -extern int identifier_type PROTO((tree)); -extern void yyhook PROTO((int)); -extern int cp_type_qual_from_rid PROTO((tree)); - -/* in method.c */ -extern void init_method PROTO((void)); -extern void do_inline_function_hair PROTO((tree, tree)); -extern char *build_overload_name PROTO((tree, int, int)); -extern tree build_static_name PROTO((tree, tree)); -extern tree build_decl_overload PROTO((tree, tree, int)); -extern tree build_decl_overload_real PROTO((tree, tree, tree, tree, - tree, int)); -extern void set_mangled_name_for_decl PROTO((tree)); -extern tree build_typename_overload PROTO((tree)); -extern tree build_overload_with_type PROTO((tree, tree)); -extern tree build_destructor_name PROTO((tree, int)); -extern tree build_opfncall PROTO((enum tree_code, int, tree, tree, tree)); -extern tree hack_identifier PROTO((tree, tree)); -extern tree make_thunk PROTO((tree, int)); -extern void emit_thunk PROTO((tree)); -extern void synthesize_method PROTO((tree)); -extern tree get_id_2 PROTO((char *, tree)); -extern tree get_vlist_vtable_id PROTO((tree, tree)); - - -/* in pt.c */ -extern void check_template_shadow PROTO ((tree)); -extern tree innermost_args PROTO ((tree)); -extern tree tsubst PROTO ((tree, tree, int, tree)); -extern tree tsubst_expr PROTO ((tree, tree, int, tree)); -extern tree tsubst_copy PROTO ((tree, tree, int, tree)); -extern void maybe_begin_member_template_processing PROTO((tree)); -extern void maybe_end_member_template_processing PROTO((void)); -extern tree finish_member_template_decl PROTO((tree)); -extern void begin_template_parm_list PROTO((void)); -extern void begin_specialization PROTO((void)); -extern void reset_specialization PROTO((void)); -extern void end_specialization PROTO((void)); -extern void begin_explicit_instantiation PROTO((void)); -extern void end_explicit_instantiation PROTO((void)); -extern tree check_explicit_specialization PROTO((tree, tree, int, int)); -extern tree process_template_parm PROTO((tree, tree)); -extern tree end_template_parm_list PROTO((tree)); -extern void end_template_decl PROTO((void)); -extern tree current_template_args PROTO((void)); -extern tree push_template_decl PROTO((tree)); -extern tree push_template_decl_real PROTO((tree, int)); -extern void redeclare_class_template PROTO((tree, tree)); -extern tree lookup_template_class PROTO((tree, tree, tree, tree, int)); -extern tree lookup_template_function PROTO((tree, tree)); -extern int uses_template_parms PROTO((tree)); -extern tree instantiate_class_template PROTO((tree)); -extern tree instantiate_template PROTO((tree, tree)); -extern void overload_template_name PROTO((tree)); -extern int fn_type_unification PROTO((tree, tree, tree, tree, tree, unification_kind_t)); -struct tinst_level *tinst_for_decl PROTO((void)); -extern void mark_decl_instantiated PROTO((tree, int)); -extern int more_specialized PROTO((tree, tree, tree)); -extern void mark_class_instantiated PROTO((tree, int)); -extern void do_decl_instantiation PROTO((tree, tree, tree)); -extern void do_type_instantiation PROTO((tree, tree)); -extern tree instantiate_decl PROTO((tree)); -extern tree do_poplevel PROTO((void)); -extern tree get_bindings PROTO((tree, tree, tree)); -/* CONT ... */ -extern void add_tree PROTO((tree)); -extern void begin_tree PROTO((void)); -extern void end_tree PROTO((void)); -extern void add_maybe_template PROTO((tree, tree)); -extern void pop_tinst_level PROTO((void)); -extern int more_specialized_class PROTO((tree, tree)); -extern void do_pushlevel PROTO((void)); -extern int is_member_template PROTO((tree)); -extern int template_parms_equal PROTO((tree, tree)); -extern int comp_template_parms PROTO((tree, tree)); -extern int template_class_depth PROTO((tree)); -extern int is_specialization_of PROTO((tree, tree)); -extern int comp_template_args PROTO((tree, tree)); -extern void maybe_process_partial_specialization PROTO((tree)); -extern void maybe_check_template_type PROTO((tree)); -extern tree most_specialized_instantiation PROTO((tree, tree)); -extern void print_candidates PROTO((tree)); -extern int instantiate_pending_templates PROTO((void)); - -extern int processing_specialization; -extern int processing_explicit_instantiation; -extern int processing_template_parmlist; - -/* in repo.c */ -extern void repo_template_used PROTO((tree)); -extern void repo_template_instantiated PROTO((tree, int)); -extern void init_repo PROTO((const char *)); -extern void finish_repo PROTO((void)); - -/* in rtti.c */ -extern void init_rtti_processing PROTO((void)); -extern tree get_tinfo_fn_dynamic PROTO((tree)); -extern tree build_typeid PROTO((tree)); -extern tree build_x_typeid PROTO((tree)); -extern tree get_tinfo_fn PROTO((tree)); -extern tree get_tinfo_fn_unused PROTO((tree)); -extern tree get_typeid PROTO((tree)); -extern tree get_typeid_1 PROTO((tree)); -extern tree build_dynamic_cast PROTO((tree, tree)); -extern void synthesize_tinfo_fn PROTO((tree)); - -/* in search.c */ -extern int types_overlap_p PROTO((tree, tree)); -extern tree get_vbase PROTO((tree, tree)); -extern tree get_binfo PROTO((tree, tree, int)); -extern int get_base_distance PROTO((tree, tree, int, tree *)); -extern int accessible_p PROTO((tree, tree)); -extern tree lookup_field PROTO((tree, tree, int, int)); -extern int lookup_fnfields_1 PROTO((tree, tree)); -extern tree lookup_fnfields PROTO((tree, tree, int)); -extern tree lookup_member PROTO((tree, tree, int, int)); -extern tree lookup_nested_tag PROTO((tree, tree)); -extern tree get_matching_virtual PROTO((tree, tree, int)); -extern tree get_abstract_virtuals PROTO((tree)); -extern tree init_vbase_pointers PROTO((tree, tree)); -extern void expand_indirect_vtbls_init PROTO((tree, tree, tree)); -extern void clear_search_slots PROTO((tree)); -extern tree get_vbase_types PROTO((tree)); -extern void note_debug_info_needed PROTO((tree)); -extern void push_class_decls PROTO((tree)); -extern void pop_class_decls PROTO((void)); -extern void unuse_fields PROTO((tree)); -extern void print_search_statistics PROTO((void)); -extern void init_search_processing PROTO((void)); -extern void reinit_search_statistics PROTO((void)); -extern tree current_scope PROTO((void)); -extern tree lookup_conversions PROTO((tree)); -extern tree binfo_for_vtable PROTO((tree)); -extern tree dfs_walk PROTO((tree, - tree (*)(tree, void *), - tree (*) (tree, void *), - void *)); -extern tree dfs_unmark PROTO((tree, void *)); -extern tree markedp PROTO((tree, void *)); - -/* in semantics.c */ -extern void finish_expr_stmt PROTO((tree)); -extern tree begin_if_stmt PROTO((void)); -extern void finish_if_stmt_cond PROTO((tree, tree)); -extern tree finish_then_clause PROTO((tree)); -extern void begin_else_clause PROTO((void)); -extern void finish_else_clause PROTO((tree)); -extern void finish_if_stmt PROTO((void)); -extern tree begin_while_stmt PROTO((void)); -extern void finish_while_stmt_cond PROTO((tree, tree)); -extern void finish_while_stmt PROTO((tree)); -extern tree begin_do_stmt PROTO((void)); -extern void finish_do_body PROTO((tree)); -extern void finish_do_stmt PROTO((tree, tree)); -extern void finish_return_stmt PROTO((tree)); -extern tree begin_for_stmt PROTO((void)); -extern void finish_for_init_stmt PROTO((tree)); -extern void finish_for_cond PROTO((tree, tree)); -extern void finish_for_expr PROTO((tree, tree)); -extern void finish_for_stmt PROTO((tree, tree)); -extern void finish_break_stmt PROTO((void)); -extern void finish_continue_stmt PROTO((void)); -extern void begin_switch_stmt PROTO((void)); -extern tree finish_switch_cond PROTO((tree)); -extern void finish_switch_stmt PROTO((tree, tree)); -extern void finish_case_label PROTO((tree, tree)); -extern void finish_goto_stmt PROTO((tree)); -extern tree begin_try_block PROTO((void)); -extern void finish_try_block PROTO((tree)); -extern void finish_handler_sequence PROTO((tree)); -extern tree begin_handler PROTO((void)); -extern void finish_handler_parms PROTO((tree)); -extern void finish_handler PROTO((tree)); -extern tree begin_compound_stmt PROTO((int)); -extern tree finish_compound_stmt PROTO((int, tree)); -extern void finish_asm_stmt PROTO((tree, tree, tree, tree, tree)); -extern tree finish_parenthesized_expr PROTO((tree)); -extern tree begin_stmt_expr PROTO((void)); -extern tree finish_stmt_expr PROTO((tree, tree)); -extern tree finish_call_expr PROTO((tree, tree, int)); -extern tree finish_increment_expr PROTO((tree, enum tree_code)); -extern tree finish_this_expr PROTO((void)); -extern tree finish_object_call_expr PROTO((tree, tree, tree)); -extern tree finish_qualified_object_call_expr PROTO((tree, tree, tree)); -extern tree finish_pseudo_destructor_call_expr PROTO((tree, tree, tree)); -extern tree finish_qualified_call_expr PROTO ((tree, tree)); -extern tree finish_label_address_expr PROTO((tree)); -extern tree finish_unary_op_expr PROTO((enum tree_code, tree)); -extern tree finish_id_expr PROTO((tree)); -extern int begin_new_placement PROTO((void)); -extern tree finish_new_placement PROTO((tree, int)); -extern int begin_function_definition PROTO((tree, tree)); -extern tree begin_constructor_declarator PROTO((tree, tree)); -extern tree finish_declarator PROTO((tree, tree, tree, tree, int)); -extern void finish_translation_unit PROTO((void)); -extern tree finish_template_type_parm PROTO((tree, tree)); -extern tree finish_template_template_parm PROTO((tree, tree)); -extern tree finish_parmlist PROTO((tree, int)); -extern tree begin_class_definition PROTO((tree)); -extern tree finish_class_definition PROTO((tree, tree, int, int)); -extern void finish_default_args PROTO((void)); -extern void begin_inline_definitions PROTO((void)); -extern void finish_inline_definitions PROTO((void)); -extern tree finish_member_class_template PROTO((tree)); -extern void finish_template_decl PROTO((tree)); -extern tree finish_template_type PROTO((tree, tree, int)); -extern void enter_scope_of PROTO((tree)); -extern tree finish_base_specifier PROTO((tree, tree, int)); -extern void finish_member_declaration PROTO((tree)); -extern void check_multiple_declarators PROTO((void)); -extern tree finish_typeof PROTO((tree)); - -/* in sig.c */ -extern tree build_signature_pointer_type PROTO((tree)); -extern tree build_signature_reference_type PROTO((tree)); -extern tree build_signature_pointer_constructor PROTO((tree, tree)); -extern tree build_signature_method_call PROTO((tree, tree)); -extern tree build_optr_ref PROTO((tree)); -extern void append_signature_fields PROTO((tree)); - -/* in spew.c */ -extern void init_spew PROTO((void)); -extern int peekyylex PROTO((void)); -extern int yylex PROTO((void)); -extern tree arbitrate_lookup PROTO((tree, tree, tree)); - -/* in tree.c */ -extern int pod_type_p PROTO((tree)); -extern void unshare_base_binfos PROTO((tree)); -extern int member_p PROTO((tree)); -extern int real_lvalue_p PROTO((tree)); -extern tree build_min PVPROTO((enum tree_code, tree, ...)); -extern tree build_min_nt PVPROTO((enum tree_code, ...)); -extern tree min_tree_cons PROTO((tree, tree, tree)); -extern int lvalue_p PROTO((tree)); -extern int lvalue_or_else PROTO((tree, const char *)); -extern tree build_cplus_new PROTO((tree, tree)); -extern tree get_target_expr PROTO((tree)); -extern tree break_out_cleanups PROTO((tree)); -extern tree break_out_calls PROTO((tree)); -extern tree build_cplus_method_type PROTO((tree, tree, tree)); -extern tree build_cplus_staticfn_type PROTO((tree, tree, tree)); -extern tree build_cplus_array_type PROTO((tree, tree)); -extern int layout_basetypes PROTO((tree, int)); -extern tree build_vbase_pointer_fields PROTO((tree)); -extern tree build_base_fields PROTO((tree)); -extern tree hash_tree_cons PROTO((tree, tree, tree)); -extern tree hash_tree_chain PROTO((tree, tree)); -extern tree hash_chainon PROTO((tree, tree)); -extern tree make_binfo PROTO((tree, tree, tree, tree)); -extern tree binfo_value PROTO((tree, tree)); -extern tree reverse_path PROTO((tree)); -extern int count_functions PROTO((tree)); -extern int is_overloaded_fn PROTO((tree)); -extern tree get_first_fn PROTO((tree)); -extern tree binding_init PROTO((struct tree_binding*)); -extern int bound_pmf_p PROTO((tree)); -extern tree ovl_cons PROTO((tree, tree)); -extern tree scratch_ovl_cons PROTO((tree, tree)); -extern int ovl_member PROTO((tree, tree)); -extern tree build_overload PROTO((tree, tree)); -extern tree fnaddr_from_vtable_entry PROTO((tree)); -extern tree function_arg_chain PROTO((tree)); -extern int promotes_to_aggr_type PROTO((tree, enum tree_code)); -extern int is_aggr_type_2 PROTO((tree, tree)); -extern char *lang_printable_name PROTO((tree, int)); -extern tree build_exception_variant PROTO((tree, tree)); -extern tree copy_template_template_parm PROTO((tree)); -extern tree copy_to_permanent PROTO((tree)); -extern tree permanent_p PROTO((tree)); -extern void print_lang_statistics PROTO((void)); -extern void __eprintf - PROTO((const char *, const char *, unsigned, const char *)); -extern tree array_type_nelts_total PROTO((tree)); -extern tree array_type_nelts_top PROTO((tree)); -extern tree break_out_target_exprs PROTO((tree)); -extern tree get_type_decl PROTO((tree)); -extern tree vec_binfo_member PROTO((tree, tree)); -extern tree hack_decl_function_context PROTO((tree)); -extern tree decl_namespace_context PROTO((tree)); -extern tree lvalue_type PROTO((tree)); -extern tree error_type PROTO((tree)); -extern tree make_temp_vec PROTO((int)); -extern tree build_ptr_wrapper PROTO((void *)); -extern tree build_expr_ptr_wrapper PROTO((void *)); -extern tree build_int_wrapper PROTO((int)); -extern tree build_srcloc_here PROTO((void)); -extern int varargs_function_p PROTO((tree)); -extern int really_overloaded_fn PROTO((tree)); -extern int cp_tree_equal PROTO((tree, tree)); -extern int can_free PROTO((struct obstack *, tree)); -extern tree mapcar PROTO((tree, tree (*) (tree))); -extern tree no_linkage_check PROTO((tree)); -extern void debug_binfo PROTO((tree)); -extern void push_expression_obstack PROTO((void)); -extern tree build_dummy_object PROTO((tree)); -extern tree maybe_dummy_object PROTO((tree, tree *)); -extern int is_dummy_object PROTO((tree)); -extern tree search_tree PROTO((tree, tree (*)(tree))); -extern int cp_valid_lang_attribute PROTO((tree, tree, tree, tree)); -extern tree make_ptrmem_cst PROTO((tree, tree)); - -#define scratchalloc expralloc -#define scratch_tree_cons expr_tree_cons -#define build_scratch_list build_expr_list -#define make_scratch_vec make_temp_vec -#define push_scratch_obstack push_expression_obstack - -/* in typeck.c */ -extern int string_conv_p PROTO((tree, tree, int)); -extern tree condition_conversion PROTO((tree)); -extern tree target_type PROTO((tree)); -extern tree require_complete_type PROTO((tree)); -extern tree require_complete_type_in_void PROTO((tree)); -extern tree complete_type PROTO((tree)); -extern tree complete_type_or_else PROTO((tree, tree)); -extern int type_unknown_p PROTO((tree)); -extern int fntype_p PROTO((tree)); -extern tree commonparms PROTO((tree, tree)); -extern tree original_type PROTO((tree)); -extern tree common_type PROTO((tree, tree)); -extern int compexcepttypes PROTO((tree, tree)); -extern int comptypes PROTO((tree, tree, int)); -extern int comp_target_types PROTO((tree, tree, int)); -extern int compparms PROTO((tree, tree)); -extern int comp_target_types PROTO((tree, tree, int)); -extern int comp_cv_qualification PROTO((tree, tree)); -extern int comp_cv_qual_signature PROTO((tree, tree)); -extern int self_promoting_args_p PROTO((tree)); -extern tree unsigned_type PROTO((tree)); -extern tree signed_type PROTO((tree)); -extern tree signed_or_unsigned_type PROTO((int, tree)); -extern tree expr_sizeof PROTO((tree)); -extern tree c_sizeof PROTO((tree)); -extern tree c_sizeof_nowarn PROTO((tree)); -extern tree c_alignof PROTO((tree)); -extern tree inline_conversion PROTO((tree)); -extern tree decay_conversion PROTO((tree)); -extern tree default_conversion PROTO((tree)); -extern tree build_object_ref PROTO((tree, tree, tree)); -extern tree build_component_ref_1 PROTO((tree, tree, int)); -extern tree build_component_ref PROTO((tree, tree, tree, int)); -extern tree build_x_component_ref PROTO((tree, tree, tree, int)); -extern tree build_x_indirect_ref PROTO((tree, const char *)); -extern tree build_indirect_ref PROTO((tree, const char *)); -extern tree build_array_ref PROTO((tree, tree)); -extern tree build_x_function_call PROTO((tree, tree, tree)); -extern tree get_member_function_from_ptrfunc PROTO((tree *, tree)); -extern tree build_function_call_real PROTO((tree, tree, int, int)); -extern tree build_function_call PROTO((tree, tree)); -extern tree build_function_call_maybe PROTO((tree, tree)); -extern tree convert_arguments PROTO((tree, tree, tree, int)); -extern tree build_x_binary_op PROTO((enum tree_code, tree, tree)); -extern tree build_binary_op PROTO((enum tree_code, tree, tree)); -extern tree build_binary_op_nodefault PROTO((enum tree_code, tree, tree, enum tree_code)); -extern tree build_x_unary_op PROTO((enum tree_code, tree)); -extern tree build_unary_op PROTO((enum tree_code, tree, int)); -extern tree unary_complex_lvalue PROTO((enum tree_code, tree)); -extern int mark_addressable PROTO((tree)); -extern tree build_x_conditional_expr PROTO((tree, tree, tree)); -extern tree build_conditional_expr PROTO((tree, tree, tree)); -extern tree build_x_compound_expr PROTO((tree)); -extern tree build_compound_expr PROTO((tree)); -extern tree build_static_cast PROTO((tree, tree)); -extern tree build_reinterpret_cast PROTO((tree, tree)); -extern tree build_const_cast PROTO((tree, tree)); -extern tree build_c_cast PROTO((tree, tree)); -extern tree build_x_modify_expr PROTO((tree, enum tree_code, tree)); -extern tree build_modify_expr PROTO((tree, enum tree_code, tree)); -extern tree convert_for_initialization PROTO((tree, tree, tree, int, const char *, tree, int)); -extern void c_expand_asm_operands PROTO((tree, tree, tree, tree, int, char *, int)); -extern void c_expand_return PROTO((tree)); -extern tree c_expand_start_case PROTO((tree)); -extern int comp_ptr_ttypes PROTO((tree, tree)); -extern int ptr_reasonably_similar PROTO((tree, tree)); -extern tree build_ptrmemfunc PROTO((tree, tree, int)); -extern int cp_type_quals PROTO((tree)); -extern int cp_has_mutable_p PROTO((tree)); -extern int at_least_as_qualified_p PROTO((tree, tree)); -extern int more_qualified_p PROTO((tree, tree)); -extern tree build_ptrmemfunc1 PROTO((tree, tree, tree, tree, tree)); -extern void expand_ptrmemfunc_cst PROTO((tree, tree *, tree *, tree *, tree *)); -extern tree delta2_from_ptrmemfunc PROTO((tree)); -extern tree pfn_from_ptrmemfunc PROTO((tree)); - -/* in typeck2.c */ -extern tree error_not_base_type PROTO((tree, tree)); -extern tree binfo_or_else PROTO((tree, tree)); -extern void readonly_error PROTO((tree, const char *, int)); -extern void abstract_virtuals_error PROTO((tree, tree)); -extern void signature_error PROTO((tree, tree)); -extern void incomplete_type_error PROTO((tree, tree)); -extern void my_friendly_abort PROTO((int)) - ATTRIBUTE_NORETURN; -extern void my_friendly_assert PROTO((int, int)); -extern tree store_init_value PROTO((tree, tree)); -extern tree digest_init PROTO((tree, tree, tree *)); -extern tree build_scoped_ref PROTO((tree, tree)); -extern tree build_x_arrow PROTO((tree)); -extern tree build_m_component_ref PROTO((tree, tree)); -extern tree build_functional_cast PROTO((tree, tree)); -extern char *enum_name_string PROTO((tree, tree)); -extern void report_case_error PROTO((int, tree, tree, tree)); -extern void check_for_new_type PROTO((const char *, flagged_type_tree)); -extern tree initializer_constant_valid_p PROTO((tree, tree)); - -/* in xref.c */ -extern void GNU_xref_begin PROTO((const char *)); -extern void GNU_xref_end PROTO((int)); -extern void GNU_xref_file PROTO((const char *)); -extern void GNU_xref_start_scope PROTO((HOST_WIDE_INT)); -extern void GNU_xref_end_scope PROTO((HOST_WIDE_INT, HOST_WIDE_INT, int, int)); -extern void GNU_xref_ref PROTO((tree, const char *)); -extern void GNU_xref_decl PROTO((tree, tree)); -extern void GNU_xref_call PROTO((tree, const char *)); -extern void GNU_xref_function PROTO((tree, tree)); -extern void GNU_xref_assign PROTO((tree)); -extern void GNU_xref_hier PROTO((tree, tree, int, int, int)); -extern void GNU_xref_member PROTO((tree, tree)); - -/* -- end of C++ */ - -#endif /* not _CP_TREE_H */ diff --git a/contrib/gcc/cp/cvt.c b/contrib/gcc/cp/cvt.c deleted file mode 100644 index 708272660d03..000000000000 --- a/contrib/gcc/cp/cvt.c +++ /dev/null @@ -1,1141 +0,0 @@ -/* Language-level data type conversion for GNU C++. - Copyright (C) 1987, 88, 92-97, 1998 Free Software Foundation, Inc. - Hacked by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* This file contains the functions for converting C expressions - to different data types. The only entry point is `convert'. - Every language front end must have a `convert' function - but what kind of conversions it does will depend on the language. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "flags.h" -#include "cp-tree.h" -#include "convert.h" -#include "toplev.h" -#include "decl.h" - -static tree cp_convert_to_pointer PROTO((tree, tree)); -static tree convert_to_pointer_force PROTO((tree, tree)); -static tree build_up_reference PROTO((tree, tree, int)); - -/* Change of width--truncation and extension of integers or reals-- - is represented with NOP_EXPR. Proper functioning of many things - assumes that no other conversions can be NOP_EXPRs. - - Conversion between integer and pointer is represented with CONVERT_EXPR. - Converting integer to real uses FLOAT_EXPR - and real to integer uses FIX_TRUNC_EXPR. - - Here is a list of all the functions that assume that widening and - narrowing is always done with a NOP_EXPR: - In convert.c, convert_to_integer. - In c-typeck.c, build_binary_op_nodefault (boolean ops), - and truthvalue_conversion. - In expr.c: expand_expr, for operands of a MULT_EXPR. - In fold-const.c: fold. - In tree.c: get_narrower and get_unwidened. - - C++: in multiple-inheritance, converting between pointers may involve - adjusting them by a delta stored within the class definition. */ - -/* Subroutines of `convert'. */ - -/* if converting pointer to pointer - if dealing with classes, check for derived->base or vice versa - else if dealing with method pointers, delegate - else convert blindly - else if converting class, pass off to build_type_conversion - else try C-style pointer conversion */ - -static tree -cp_convert_to_pointer (type, expr) - tree type, expr; -{ - register tree intype = TREE_TYPE (expr); - register enum tree_code form; - tree rval; - - if (IS_AGGR_TYPE (intype)) - { - intype = complete_type (intype); - if (TYPE_SIZE (intype) == NULL_TREE) - { - cp_error ("can't convert from incomplete type `%T' to `%T'", - intype, type); - return error_mark_node; - } - - rval = build_type_conversion (type, expr, 1); - if (rval) - { - if (rval == error_mark_node) - cp_error ("conversion of `%E' from `%T' to `%T' is ambiguous", - expr, intype, type); - return rval; - } - } - - /* Handle anachronistic conversions from (::*)() to cv void* or (*)(). */ - if (TREE_CODE (type) == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE - || TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node)) - { - /* Allow an implicit this pointer for pointer to member - functions. */ - if (TYPE_PTRMEMFUNC_P (intype)) - { - tree fntype = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (intype)); - tree decl = maybe_dummy_object (TYPE_METHOD_BASETYPE (fntype), 0); - expr = build (OFFSET_REF, fntype, decl, expr); - } - - if (TREE_CODE (expr) == OFFSET_REF - && TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE) - expr = resolve_offset_ref (expr); - if (TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE) - expr = build_addr_func (expr); - if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE) - { - if (TREE_CODE (TREE_TYPE (TREE_TYPE (expr))) == METHOD_TYPE) - if (pedantic || warn_pmf2ptr) - cp_pedwarn ("converting from `%T' to `%T'", TREE_TYPE (expr), - type); - return build1 (NOP_EXPR, type, expr); - } - intype = TREE_TYPE (expr); - } - - form = TREE_CODE (intype); - - if (POINTER_TYPE_P (intype)) - { - intype = TYPE_MAIN_VARIANT (intype); - - if (TYPE_MAIN_VARIANT (type) != intype - && TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE - && IS_AGGR_TYPE (TREE_TYPE (type)) - && IS_AGGR_TYPE (TREE_TYPE (intype)) - && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE - /* If EXPR is NULL, then we don't need to do any arithmetic - to convert it: - - [conv.ptr] - - The null pointer value is converted to the null pointer - value of the destination type. */ - && !integer_zerop (expr)) - { - enum tree_code code = PLUS_EXPR; - tree binfo = get_binfo (TREE_TYPE (type), TREE_TYPE (intype), 1); - if (binfo == error_mark_node) - return error_mark_node; - if (binfo == NULL_TREE) - { - binfo = get_binfo (TREE_TYPE (intype), TREE_TYPE (type), 1); - if (binfo == error_mark_node) - return error_mark_node; - code = MINUS_EXPR; - } - if (binfo) - { - if (TYPE_USES_VIRTUAL_BASECLASSES (TREE_TYPE (type)) - || TYPE_USES_VIRTUAL_BASECLASSES (TREE_TYPE (intype)) - || ! BINFO_OFFSET_ZEROP (binfo)) - { - /* Need to get the path we took. */ - tree path; - - if (code == PLUS_EXPR) - get_base_distance (TREE_TYPE (type), TREE_TYPE (intype), - 0, &path); - else - get_base_distance (TREE_TYPE (intype), TREE_TYPE (type), - 0, &path); - return build_vbase_path (code, type, expr, path, 0); - } - } - } - - if (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype)) - { - tree b1 = TYPE_OFFSET_BASETYPE (TREE_TYPE (type)); - tree b2 = TYPE_OFFSET_BASETYPE (TREE_TYPE (intype)); - tree binfo = get_binfo (b2, b1, 1); - enum tree_code code = PLUS_EXPR; - - if (binfo == NULL_TREE) - { - binfo = get_binfo (b1, b2, 1); - code = MINUS_EXPR; - } - - if (binfo == error_mark_node) - return error_mark_node; - if (binfo && ! TREE_VIA_VIRTUAL (binfo)) - expr = size_binop (code, expr, BINFO_OFFSET (binfo)); - } - else if (TYPE_PTRMEMFUNC_P (type)) - { - cp_error ("cannot convert `%E' from type `%T' to type `%T'", - expr, intype, type); - return error_mark_node; - } - - rval = build1 (NOP_EXPR, type, expr); - TREE_CONSTANT (rval) = TREE_CONSTANT (expr); - return rval; - } - else if (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)) - return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 1); - else if (TYPE_PTRMEMFUNC_P (intype)) - { - cp_error ("cannot convert `%E' from type `%T' to type `%T'", - expr, intype, type); - return error_mark_node; - } - - my_friendly_assert (form != OFFSET_TYPE, 186); - - if (TYPE_LANG_SPECIFIC (intype) - && (IS_SIGNATURE_POINTER (intype) || IS_SIGNATURE_REFERENCE (intype))) - return convert_to_pointer (type, build_optr_ref (expr)); - - if (integer_zerop (expr)) - { - if (TYPE_PTRMEMFUNC_P (type)) - return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0); - expr = build_int_2 (0, 0); - TREE_TYPE (expr) = type; - return expr; - } - - if (INTEGRAL_CODE_P (form)) - { - if (TYPE_PRECISION (intype) == POINTER_SIZE) - return build1 (CONVERT_EXPR, type, expr); - expr = cp_convert (type_for_size (POINTER_SIZE, 0), expr); - /* Modes may be different but sizes should be the same. */ - if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (expr))) - != GET_MODE_SIZE (TYPE_MODE (type))) - /* There is supposed to be some integral type - that is the same width as a pointer. */ - abort (); - return convert_to_pointer (type, expr); - } - - if (type_unknown_p (expr)) - return instantiate_type (type, expr, 1); - - cp_error ("cannot convert `%E' from type `%T' to type `%T'", - expr, intype, type); - return error_mark_node; -} - -/* Like convert, except permit conversions to take place which - are not normally allowed due to access restrictions - (such as conversion from sub-type to private super-type). */ - -static tree -convert_to_pointer_force (type, expr) - tree type, expr; -{ - register tree intype = TREE_TYPE (expr); - register enum tree_code form = TREE_CODE (intype); - - if (integer_zerop (expr)) - { - expr = build_int_2 (0, 0); - TREE_TYPE (expr) = type; - return expr; - } - - /* Convert signature pointer/reference to `void *' first. */ - if (form == RECORD_TYPE - && (IS_SIGNATURE_POINTER (intype) || IS_SIGNATURE_REFERENCE (intype))) - { - expr = build_optr_ref (expr); - intype = TREE_TYPE (expr); - form = TREE_CODE (intype); - } - - if (form == POINTER_TYPE) - { - intype = TYPE_MAIN_VARIANT (intype); - - if (TYPE_MAIN_VARIANT (type) != intype - && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE - && IS_AGGR_TYPE (TREE_TYPE (type)) - && IS_AGGR_TYPE (TREE_TYPE (intype)) - && TREE_CODE (TREE_TYPE (intype)) == RECORD_TYPE) - { - enum tree_code code = PLUS_EXPR; - tree path; - int distance = get_base_distance (TREE_TYPE (type), - TREE_TYPE (intype), 0, &path); - if (distance == -2) - { - ambig: - cp_error ("type `%T' is ambiguous baseclass of `%s'", - TREE_TYPE (type), - TYPE_NAME_STRING (TREE_TYPE (intype))); - return error_mark_node; - } - if (distance == -1) - { - distance = get_base_distance (TREE_TYPE (intype), - TREE_TYPE (type), 0, &path); - if (distance == -2) - goto ambig; - if (distance < 0) - /* Doesn't need any special help from us. */ - return build1 (NOP_EXPR, type, expr); - - code = MINUS_EXPR; - } - return build_vbase_path (code, type, expr, path, 0); - } - } - - return cp_convert_to_pointer (type, expr); -} - -/* We are passing something to a function which requires a reference. - The type we are interested in is in TYPE. The initial - value we have to begin with is in ARG. - - FLAGS controls how we manage access checking. - DIRECT_BIND in FLAGS controls how any temporaries are generated. */ - -static tree -build_up_reference (type, arg, flags) - tree type, arg; - int flags; -{ - tree rval; - tree argtype = TREE_TYPE (arg); - tree target_type = TREE_TYPE (type); - - my_friendly_assert (TREE_CODE (type) == REFERENCE_TYPE, 187); - - if ((flags & DIRECT_BIND) && ! real_lvalue_p (arg)) - { - tree targ = arg; - if (toplevel_bindings_p ()) - arg = get_temp_name (argtype, 1); - else - { - arg = pushdecl (build_decl (VAR_DECL, NULL_TREE, argtype)); - DECL_ARTIFICIAL (arg) = 1; - } - DECL_INITIAL (arg) = targ; - cp_finish_decl (arg, targ, NULL_TREE, 0, - LOOKUP_ONLYCONVERTING|DIRECT_BIND); - } - else if (!(flags & DIRECT_BIND) && ! lvalue_p (arg)) - { - tree slot = build_decl (VAR_DECL, NULL_TREE, argtype); - DECL_ARTIFICIAL (slot) = 1; - arg = build (TARGET_EXPR, argtype, slot, arg, NULL_TREE, NULL_TREE); - TREE_SIDE_EFFECTS (arg) = 1; - } - - /* If we had a way to wrap this up, and say, if we ever needed it's - address, transform all occurrences of the register, into a memory - reference we could win better. */ - rval = build_unary_op (ADDR_EXPR, arg, 1); - if (rval == error_mark_node) - return error_mark_node; - - if ((flags & LOOKUP_PROTECT) - && TYPE_MAIN_VARIANT (argtype) != TYPE_MAIN_VARIANT (target_type) - && IS_AGGR_TYPE (argtype) - && IS_AGGR_TYPE (target_type)) - { - /* We go through get_binfo for the access control. */ - tree binfo = get_binfo (target_type, argtype, 1); - if (binfo == error_mark_node) - return error_mark_node; - if (binfo == NULL_TREE) - return error_not_base_type (target_type, argtype); - rval = convert_pointer_to_real (binfo, rval); - } - else - rval - = convert_to_pointer_force (build_pointer_type (target_type), rval); - rval = build1 (NOP_EXPR, type, rval); - TREE_CONSTANT (rval) = TREE_CONSTANT (TREE_OPERAND (rval, 0)); - return rval; -} - -/* For C++: Only need to do one-level references, but cannot - get tripped up on signed/unsigned differences. - - DECL is either NULL_TREE or the _DECL node for a reference that is being - initialized. It can be error_mark_node if we don't know the _DECL but - we know it's an initialization. */ - -tree -convert_to_reference (reftype, expr, convtype, flags, decl) - tree reftype, expr; - int convtype, flags; - tree decl; -{ - register tree type = TYPE_MAIN_VARIANT (TREE_TYPE (reftype)); - register tree intype = TREE_TYPE (expr); - tree rval = NULL_TREE; - tree rval_as_conversion = NULL_TREE; - int i; - - if (TREE_CODE (type) == FUNCTION_TYPE && intype == unknown_type_node) - { - expr = instantiate_type (type, expr, - (flags & LOOKUP_COMPLAIN) != 0); - if (expr == error_mark_node) - return error_mark_node; - - intype = TREE_TYPE (expr); - } - - if (TREE_CODE (intype) == REFERENCE_TYPE) - my_friendly_abort (364); - - intype = TYPE_MAIN_VARIANT (intype); - - i = comp_target_types (type, intype, 0); - - if (i <= 0 && (convtype & CONV_IMPLICIT) && IS_AGGR_TYPE (intype) - && ! (flags & LOOKUP_NO_CONVERSION)) - { - /* Look for a user-defined conversion to lvalue that we can use. */ - - rval_as_conversion - = build_type_conversion (reftype, expr, 1); - - if (rval_as_conversion && rval_as_conversion != error_mark_node - && real_lvalue_p (rval_as_conversion)) - { - expr = rval_as_conversion; - rval_as_conversion = NULL_TREE; - intype = type; - i = 1; - } - } - - if (((convtype & CONV_STATIC) && i == -1) - || ((convtype & CONV_IMPLICIT) && i == 1)) - { - if (flags & LOOKUP_COMPLAIN) - { - tree ttl = TREE_TYPE (reftype); - tree ttr = lvalue_type (expr); - - /* [dcl.init.ref] says that if an rvalue is used to - initialize a reference, then the reference must be to a - non-volatile const type. */ - if (! real_lvalue_p (expr) - && !CP_TYPE_CONST_NON_VOLATILE_P (ttl)) - { - const char *msg; - - if (CP_TYPE_VOLATILE_P (ttl) && decl) - msg = "initialization of volatile reference type `%#T'"; - else if (CP_TYPE_VOLATILE_P (ttl)) - msg = "conversion to volatile reference type `%#T'"; - else if (decl) - msg = "initialization of non-const reference type `%#T'"; - else - msg = "conversion to non-const reference type `%#T'"; - - cp_pedwarn (msg, reftype); - cp_pedwarn ("from rvalue of type `%T'", intype); - } - else if (! (convtype & CONV_CONST) - && !at_least_as_qualified_p (ttl, ttr)) - cp_pedwarn ("conversion from `%T' to `%T' discards qualifiers", - ttr, reftype); - } - - return build_up_reference (reftype, expr, flags); - } - else if ((convtype & CONV_REINTERPRET) && lvalue_p (expr)) - { - /* When casting an lvalue to a reference type, just convert into - a pointer to the new type and deference it. This is allowed - by San Diego WP section 5.2.9 paragraph 12, though perhaps it - should be done directly (jason). (int &)ri ---> *(int*)&ri */ - - /* B* bp; A& ar = (A&)bp; is valid, but it's probably not what they - meant. */ - if (TREE_CODE (intype) == POINTER_TYPE - && (comptypes (TREE_TYPE (intype), type, - COMPARE_BASE | COMPARE_RELAXED ))) - cp_warning ("casting `%T' to `%T' does not dereference pointer", - intype, reftype); - - rval = build_unary_op (ADDR_EXPR, expr, 0); - if (rval != error_mark_node) - rval = convert_force (build_pointer_type (TREE_TYPE (reftype)), - rval, 0); - if (rval != error_mark_node) - rval = build1 (NOP_EXPR, reftype, rval); - } - else - { - rval = convert_for_initialization (NULL_TREE, type, expr, flags, - "converting", 0, 0); - if (rval == NULL_TREE || rval == error_mark_node) - return rval; - rval = build_up_reference (reftype, rval, flags); - - if (rval && ! CP_TYPE_CONST_P (TREE_TYPE (reftype))) - cp_pedwarn ("initializing non-const `%T' with `%T' will use a temporary", - reftype, intype); - } - - if (rval) - { - /* If we found a way to convert earlier, then use it. */ - return rval; - } - - my_friendly_assert (TREE_CODE (intype) != OFFSET_TYPE, 189); - - if (flags & LOOKUP_COMPLAIN) - cp_error ("cannot convert type `%T' to type `%T'", intype, reftype); - - if (flags & LOOKUP_SPECULATIVELY) - return NULL_TREE; - - return error_mark_node; -} - -/* We are using a reference VAL for its value. Bash that reference all the - way down to its lowest form. */ - -tree -convert_from_reference (val) - tree val; -{ - tree type = TREE_TYPE (val); - - if (TREE_CODE (type) == OFFSET_TYPE) - type = TREE_TYPE (type); - if (TREE_CODE (type) == REFERENCE_TYPE) - return build_indirect_ref (val, NULL_PTR); - return val; -} - -/* Call this when we know (for any reason) that expr is not, in fact, - zero. This routine is like convert_pointer_to, but it pays - attention to which specific instance of what type we want to - convert to. This routine should eventually become - convert_to_pointer after all references to convert_to_pointer - are removed. */ - -tree -convert_pointer_to_real (binfo, expr) - tree binfo, expr; -{ - register tree intype = TREE_TYPE (expr); - tree ptr_type; - tree type, rval; - - if (intype == error_mark_node) - return error_mark_node; - - if (TREE_CODE (binfo) == TREE_VEC) - type = BINFO_TYPE (binfo); - else if (IS_AGGR_TYPE (binfo)) - { - type = binfo; - } - else - { - type = binfo; - binfo = NULL_TREE; - } - - ptr_type = cp_build_qualified_type (type, - CP_TYPE_QUALS (TREE_TYPE (intype))); - ptr_type = build_pointer_type (ptr_type); - if (same_type_p (ptr_type, TYPE_MAIN_VARIANT (intype))) - return expr; - - my_friendly_assert (!integer_zerop (expr), 191); - - intype = TYPE_MAIN_VARIANT (TREE_TYPE (intype)); - if (TREE_CODE (type) == RECORD_TYPE - && TREE_CODE (intype) == RECORD_TYPE - && type != intype) - { - tree path; - int distance - = get_base_distance (binfo, intype, 0, &path); - - /* This function shouldn't be called with unqualified arguments - but if it is, give them an error message that they can read. */ - if (distance < 0) - { - cp_error ("cannot convert a pointer of type `%T' to a pointer of type `%T'", - intype, type); - - if (distance == -2) - cp_error ("because `%T' is an ambiguous base class", type); - return error_mark_node; - } - - return build_vbase_path (PLUS_EXPR, ptr_type, expr, path, 1); - } - rval = build1 (NOP_EXPR, ptr_type, - TREE_CODE (expr) == NOP_EXPR ? TREE_OPERAND (expr, 0) : expr); - TREE_CONSTANT (rval) = TREE_CONSTANT (expr); - return rval; -} - -/* Call this when we know (for any reason) that expr is - not, in fact, zero. This routine gets a type out of the first - argument and uses it to search for the type to convert to. If there - is more than one instance of that type in the expr, the conversion is - ambiguous. This routine should eventually go away, and all - callers should use convert_to_pointer_real. */ - -tree -convert_pointer_to (binfo, expr) - tree binfo, expr; -{ - tree type; - - if (TREE_CODE (binfo) == TREE_VEC) - type = BINFO_TYPE (binfo); - else if (IS_AGGR_TYPE (binfo)) - type = binfo; - else - type = binfo; - return convert_pointer_to_real (type, expr); -} - -/* C++ conversions, preference to static cast conversions. */ - -tree -cp_convert (type, expr) - tree type, expr; -{ - return ocp_convert (type, expr, CONV_OLD_CONVERT, LOOKUP_NORMAL); -} - -/* Conversion... - - FLAGS indicates how we should behave. */ - -tree -ocp_convert (type, expr, convtype, flags) - tree type, expr; - int convtype, flags; -{ - register tree e = expr; - register enum tree_code code = TREE_CODE (type); - - if (e == error_mark_node - || TREE_TYPE (e) == error_mark_node) - return error_mark_node; - - if (TREE_READONLY_DECL_P (e)) - e = decl_constant_value (e); - - if (IS_AGGR_TYPE (type) && (convtype & CONV_FORCE_TEMP) - /* Some internal structures (vtable_entry_type, sigtbl_ptr_type) - don't go through finish_struct, so they don't have the synthesized - constructors. So don't force a temporary. */ - && TYPE_HAS_CONSTRUCTOR (type)) - /* We need a new temporary; don't take this shortcut. */; - else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (e))) - { - if (same_type_p (type, TREE_TYPE (e))) - /* The call to fold will not always remove the NOP_EXPR as - might be expected, since if one of the types is a typedef; - the comparsion in fold is just equality of pointers, not a - call to comptypes. We don't call fold in this case because - that can result in infinite recursion; fold will call - convert, which will call ocp_convert, etc. */ - return e; - else - return fold (build1 (NOP_EXPR, type, e)); - } - - if (code == VOID_TYPE && (convtype & CONV_STATIC)) - { - e = require_complete_type_in_void (e); - if (e != error_mark_node) - e = build1 (CONVERT_EXPR, void_type_node, e); - - return e; - } - -#if 0 - /* This is incorrect. A truncation can't be stripped this way. - Extensions will be stripped by the use of get_unwidened. */ - if (TREE_CODE (e) == NOP_EXPR) - return cp_convert (type, TREE_OPERAND (e, 0)); -#endif - - /* Just convert to the type of the member. */ - if (code == OFFSET_TYPE) - { - type = TREE_TYPE (type); - code = TREE_CODE (type); - } - -#if 0 - if (code == REFERENCE_TYPE) - return fold (convert_to_reference (type, e, convtype, flags, NULL_TREE)); - else if (TREE_CODE (TREE_TYPE (e)) == REFERENCE_TYPE) - e = convert_from_reference (e); -#endif - - if (TREE_CODE (e) == OFFSET_REF) - e = resolve_offset_ref (e); - - if (INTEGRAL_CODE_P (code)) - { - tree intype = TREE_TYPE (e); - /* enum = enum, enum = int, enum = float, (enum)pointer are all - errors. */ - if (TREE_CODE (type) == ENUMERAL_TYPE - && ((ARITHMETIC_TYPE_P (intype) && ! (convtype & CONV_STATIC)) - || (TREE_CODE (intype) == POINTER_TYPE))) - { - cp_pedwarn ("conversion from `%#T' to `%#T'", intype, type); - - if (flag_pedantic_errors) - return error_mark_node; - } - if (IS_AGGR_TYPE (intype)) - { - tree rval; - rval = build_type_conversion (type, e, 1); - if (rval) - return rval; - if (flags & LOOKUP_COMPLAIN) - cp_error ("`%#T' used where a `%T' was expected", intype, type); - if (flags & LOOKUP_SPECULATIVELY) - return NULL_TREE; - return error_mark_node; - } - if (code == BOOLEAN_TYPE) - { - /* Common Ada/Pascal programmer's mistake. We always warn - about this since it is so bad. */ - if (TREE_CODE (expr) == FUNCTION_DECL) - cp_warning ("the address of `%D', will always be `true'", expr); - return truthvalue_conversion (e); - } - return fold (convert_to_integer (type, e)); - } - if (code == POINTER_TYPE || code == REFERENCE_TYPE - || TYPE_PTRMEMFUNC_P (type)) - return fold (cp_convert_to_pointer (type, e)); - if (code == REAL_TYPE || code == COMPLEX_TYPE) - { - if (IS_AGGR_TYPE (TREE_TYPE (e))) - { - tree rval; - rval = build_type_conversion (type, e, 1); - if (rval) - return rval; - else - if (flags & LOOKUP_COMPLAIN) - cp_error ("`%#T' used where a floating point value was expected", - TREE_TYPE (e)); - } - if (code == REAL_TYPE) - return fold (convert_to_real (type, e)); - else if (code == COMPLEX_TYPE) - return fold (convert_to_complex (type, e)); - } - - /* New C++ semantics: since assignment is now based on - memberwise copying, if the rhs type is derived from the - lhs type, then we may still do a conversion. */ - if (IS_AGGR_TYPE_CODE (code)) - { - tree dtype = TREE_TYPE (e); - tree ctor = NULL_TREE; - - dtype = TYPE_MAIN_VARIANT (dtype); - - /* Conversion of object pointers or signature pointers/references - to signature pointers/references. */ - - if (TYPE_LANG_SPECIFIC (type) - && (IS_SIGNATURE_POINTER (type) || IS_SIGNATURE_REFERENCE (type))) - { - tree constructor = build_signature_pointer_constructor (type, expr); - tree sig_ty = SIGNATURE_TYPE (type); - tree sig_ptr; - - if (constructor == error_mark_node) - return error_mark_node; - - sig_ptr = get_temp_name (type, 1); - DECL_INITIAL (sig_ptr) = constructor; - CLEAR_SIGNATURE (sig_ty); - cp_finish_decl (sig_ptr, constructor, NULL_TREE, 0, 0); - SET_SIGNATURE (sig_ty); - TREE_READONLY (sig_ptr) = 1; - - return sig_ptr; - } - - /* Conversion between aggregate types. New C++ semantics allow - objects of derived type to be cast to objects of base type. - Old semantics only allowed this between pointers. - - There may be some ambiguity between using a constructor - vs. using a type conversion operator when both apply. */ - - ctor = e; - - if (IS_AGGR_TYPE (type) && CLASSTYPE_ABSTRACT_VIRTUALS (type)) - { - abstract_virtuals_error (NULL_TREE, type); - return error_mark_node; - } - - if ((flags & LOOKUP_ONLYCONVERTING) - && ! (IS_AGGR_TYPE (dtype) && DERIVED_FROM_P (type, dtype))) - /* For copy-initialization, first we create a temp of the proper type - with a user-defined conversion sequence, then we direct-initialize - the target with the temp (see [dcl.init]). */ - ctor = build_user_type_conversion (type, ctor, flags); - if (ctor) - ctor = build_method_call (NULL_TREE, ctor_identifier, - build_expr_list (NULL_TREE, ctor), - TYPE_BINFO (type), flags); - if (ctor) - return build_cplus_new (type, ctor); - } - - /* If TYPE or TREE_TYPE (E) is not on the permanent_obstack, - then it won't be hashed and hence compare as not equal, - even when it is. */ - if (code == ARRAY_TYPE - && TREE_TYPE (TREE_TYPE (e)) == TREE_TYPE (type) - && index_type_equal (TYPE_DOMAIN (TREE_TYPE (e)), TYPE_DOMAIN (type))) - return e; - - if (flags & LOOKUP_COMPLAIN) - cp_error ("conversion from `%T' to non-scalar type `%T' requested", - TREE_TYPE (expr), type); - if (flags & LOOKUP_SPECULATIVELY) - return NULL_TREE; - return error_mark_node; -} - -/* Create an expression whose value is that of EXPR, - converted to type TYPE. The TREE_TYPE of the value - is always TYPE. This function implements all reasonable - conversions; callers should filter out those that are - not permitted by the language being compiled. - - Most of this routine is from build_reinterpret_cast. - - The backend cannot call cp_convert (what was convert) because - conversions to/from basetypes may involve memory references - (vbases) and adding or subtracting small values (multiple - inheritance), but it calls convert from the constant folding code - on subtrees of already build trees after it has ripped them apart. - - Also, if we ever support range variables, we'll probably also have to - do a little bit more work. */ - -tree -convert (type, expr) - tree type, expr; -{ - tree intype; - - if (type == error_mark_node || expr == error_mark_node) - return error_mark_node; - - intype = TREE_TYPE (expr); - - if (POINTER_TYPE_P (type) && POINTER_TYPE_P (intype)) - { - if (TREE_READONLY_DECL_P (expr)) - expr = decl_constant_value (expr); - return fold (build1 (NOP_EXPR, type, expr)); - } - - return ocp_convert (type, expr, CONV_OLD_CONVERT, - LOOKUP_NORMAL|LOOKUP_NO_CONVERSION); -} - -/* Like cp_convert, except permit conversions to take place which - are not normally allowed due to access restrictions - (such as conversion from sub-type to private super-type). */ - -tree -convert_force (type, expr, convtype) - tree type; - tree expr; - int convtype; -{ - register tree e = expr; - register enum tree_code code = TREE_CODE (type); - - if (code == REFERENCE_TYPE) - return fold (convert_to_reference (type, e, CONV_C_CAST, LOOKUP_COMPLAIN, - NULL_TREE)); - else if (TREE_CODE (TREE_TYPE (e)) == REFERENCE_TYPE) - e = convert_from_reference (e); - - if (code == POINTER_TYPE) - return fold (convert_to_pointer_force (type, e)); - - /* From typeck.c convert_for_assignment */ - if (((TREE_CODE (TREE_TYPE (e)) == POINTER_TYPE && TREE_CODE (e) == ADDR_EXPR - && TREE_CODE (TREE_TYPE (e)) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (TREE_TYPE (e))) == METHOD_TYPE) - || integer_zerop (e) - || TYPE_PTRMEMFUNC_P (TREE_TYPE (e))) - && TYPE_PTRMEMFUNC_P (type)) - { - /* compatible pointer to member functions. */ - return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), e, 1); - } - - return ocp_convert (type, e, CONV_C_CAST|convtype, LOOKUP_NORMAL); -} - -/* Convert an aggregate EXPR to type XTYPE. If a conversion - exists, return the attempted conversion. This may - return ERROR_MARK_NODE if the conversion is not - allowed (references private members, etc). - If no conversion exists, NULL_TREE is returned. - - If (FOR_SURE & 1) is non-zero, then we allow this type conversion - to take place immediately. Otherwise, we build a SAVE_EXPR - which can be evaluated if the results are ever needed. - - Changes to this functions should be mirrored in user_harshness. - - FIXME: Ambiguity checking is wrong. Should choose one by the implicit - object parameter, or by the second standard conversion sequence if - that doesn't do it. This will probably wait for an overloading rewrite. - (jason 8/9/95) */ - -tree -build_type_conversion (xtype, expr, for_sure) - tree xtype, expr; - int for_sure; -{ - /* C++: check to see if we can convert this aggregate type - into the required type. */ - return build_user_type_conversion - (xtype, expr, for_sure ? LOOKUP_NORMAL : 0); -} - -/* Convert the given EXPR to one of a group of types suitable for use in an - expression. DESIRES is a combination of various WANT_* flags (q.v.) - which indicates which types are suitable. If COMPLAIN is 1, complain - about ambiguity; otherwise, the caller will deal with it. */ - -tree -build_expr_type_conversion (desires, expr, complain) - int desires; - tree expr; - int complain; -{ - tree basetype = TREE_TYPE (expr); - tree conv = NULL_TREE; - tree winner = NULL_TREE; - - if (expr == null_node - && (desires & WANT_INT) - && !(desires & WANT_NULL)) - cp_warning ("converting NULL to non-pointer type"); - - if (TREE_CODE (expr) == OFFSET_REF) - expr = resolve_offset_ref (expr); - expr = convert_from_reference (expr); - basetype = TREE_TYPE (expr); - - if (! IS_AGGR_TYPE (basetype)) - switch (TREE_CODE (basetype)) - { - case INTEGER_TYPE: - if ((desires & WANT_NULL) && null_ptr_cst_p (expr)) - return expr; - /* else fall through... */ - - case BOOLEAN_TYPE: - return (desires & WANT_INT) ? expr : NULL_TREE; - case ENUMERAL_TYPE: - return (desires & WANT_ENUM) ? expr : NULL_TREE; - case REAL_TYPE: - return (desires & WANT_FLOAT) ? expr : NULL_TREE; - case POINTER_TYPE: - return (desires & WANT_POINTER) ? expr : NULL_TREE; - - case FUNCTION_TYPE: - case ARRAY_TYPE: - return (desires & WANT_POINTER) ? default_conversion (expr) - : NULL_TREE; - default: - return NULL_TREE; - } - - /* The code for conversions from class type is currently only used for - delete expressions. Other expressions are handled by build_new_op. */ - - if (! TYPE_HAS_CONVERSION (basetype)) - return NULL_TREE; - - for (conv = lookup_conversions (basetype); conv; conv = TREE_CHAIN (conv)) - { - int win = 0; - tree candidate; - tree cand = TREE_VALUE (conv); - - if (winner && winner == cand) - continue; - - candidate = TREE_TYPE (TREE_TYPE (cand)); - if (TREE_CODE (candidate) == REFERENCE_TYPE) - candidate = TREE_TYPE (candidate); - - switch (TREE_CODE (candidate)) - { - case BOOLEAN_TYPE: - case INTEGER_TYPE: - win = (desires & WANT_INT); break; - case ENUMERAL_TYPE: - win = (desires & WANT_ENUM); break; - case REAL_TYPE: - win = (desires & WANT_FLOAT); break; - case POINTER_TYPE: - win = (desires & WANT_POINTER); break; - - default: - break; - } - - if (win) - { - if (winner) - { - if (complain) - { - cp_error ("ambiguous default type conversion from `%T'", - basetype); - cp_error (" candidate conversions include `%D' and `%D'", - winner, cand); - } - return error_mark_node; - } - else - winner = cand; - } - } - - if (winner) - { - tree type = TREE_TYPE (TREE_TYPE (winner)); - if (TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); - return build_user_type_conversion (type, expr, LOOKUP_NORMAL); - } - - return NULL_TREE; -} - -/* Implements integral promotion (4.1) and float->double promotion. */ - -tree -type_promotes_to (type) - tree type; -{ - int type_quals; - - if (type == error_mark_node) - return error_mark_node; - - type_quals = CP_TYPE_QUALS (type); - type = TYPE_MAIN_VARIANT (type); - - /* bool always promotes to int (not unsigned), even if it's the same - size. */ - if (type == boolean_type_node) - type = integer_type_node; - - /* Normally convert enums to int, but convert wide enums to something - wider. */ - else if (TREE_CODE (type) == ENUMERAL_TYPE - || type == wchar_type_node) - { - int precision = MAX (TYPE_PRECISION (type), - TYPE_PRECISION (integer_type_node)); - tree totype = type_for_size (precision, 0); - if (TREE_UNSIGNED (type) - && ! int_fits_type_p (TYPE_MAX_VALUE (type), totype)) - type = type_for_size (precision, 1); - else - type = totype; - } - else if (C_PROMOTING_INTEGER_TYPE_P (type)) - { - /* Retain unsignedness if really not getting bigger. */ - if (TREE_UNSIGNED (type) - && TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)) - type = unsigned_type_node; - else - type = integer_type_node; - } - else if (type == float_type_node) - type = double_type_node; - - return cp_build_qualified_type (type, type_quals); -} - -/* The routines below this point are carefully written to conform to - the standard. They use the same terminology, and follow the rules - closely. Although they are used only in pt.c at the moment, they - should presumably be used everywhere in the future. */ - -/* Attempt to perform qualification conversions on EXPR to convert it - to TYPE. Return the resulting expression, or error_mark_node if - the conversion was impossible. */ - -tree -perform_qualification_conversions (type, expr) - tree type; - tree expr; -{ - if (TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE - && comp_ptr_ttypes (TREE_TYPE (type), TREE_TYPE (TREE_TYPE (expr)))) - return build1 (NOP_EXPR, type, expr); - else - return error_mark_node; -} diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c deleted file mode 100644 index 4b6770d15acc..000000000000 --- a/contrib/gcc/cp/decl.c +++ /dev/null @@ -1,15160 +0,0 @@ -/* Process declarations and variables for C compiler. - Copyright (C) 1988, 92-98, 1999 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Process declarations and symbol lookup for C front end. - Also constructs types; the standard scalar types at initialization, - and structure, union, array and enum types when they are declared. */ - -/* ??? not all decl nodes are given the most useful possible - line numbers. For example, the CONST_DECLs for enum values. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "rtl.h" -#include "flags.h" -#include "cp-tree.h" -#include "decl.h" -#include "lex.h" -#include -#include "obstack.h" -#include "defaults.h" -#include "output.h" -#include "except.h" -#include "toplev.h" -#include "../hash.h" - -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -extern tree builtin_return_address_fndecl; - -extern struct obstack permanent_obstack; -extern struct obstack* saveable_obstack; - -extern int current_class_depth; - -extern tree static_ctors, static_dtors; - -extern int static_labelno; - -extern tree current_namespace; -extern tree global_namespace; - -extern void (*print_error_function) PROTO((char *)); -extern int (*valid_lang_attribute) PROTO ((tree, tree, tree, tree)); - -/* Obstack used for remembering local class declarations (like - enums and static (const) members. */ -#include "stack.h" -struct obstack decl_obstack; -static struct stack_level *decl_stack; - -#ifndef CHAR_TYPE_SIZE -#define CHAR_TYPE_SIZE BITS_PER_UNIT -#endif - -#ifndef SHORT_TYPE_SIZE -#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2)) -#endif - -#ifndef INT_TYPE_SIZE -#define INT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef LONG_LONG_TYPE_SIZE -#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef WCHAR_UNSIGNED -#define WCHAR_UNSIGNED 0 -#endif - -#ifndef FLOAT_TYPE_SIZE -#define FLOAT_TYPE_SIZE BITS_PER_WORD -#endif - -#ifndef DOUBLE_TYPE_SIZE -#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) -#endif - -#ifndef BOOL_TYPE_SIZE -#ifdef SLOW_BYTE_ACCESS -#define BOOL_TYPE_SIZE ((SLOW_BYTE_ACCESS) ? (POINTER_SIZE) : (CHAR_TYPE_SIZE)) -#else -#define BOOL_TYPE_SIZE CHAR_TYPE_SIZE -#endif -#endif - -/* We let tm.h override the types used here, to handle trivial differences - such as the choice of unsigned int or long unsigned int for size_t. - When machines start needing nontrivial differences in the size type, - it would be best to do something here to figure out automatically - from other information what type to use. */ - -#ifndef SIZE_TYPE -#define SIZE_TYPE "long unsigned int" -#endif - -#ifndef PTRDIFF_TYPE -#define PTRDIFF_TYPE "long int" -#endif - -#ifndef WCHAR_TYPE -#define WCHAR_TYPE "int" -#endif - -static tree grokparms PROTO((tree, int)); -static tree lookup_nested_type PROTO((tree, tree)); -static const char *redeclaration_error_message PROTO((tree, tree)); - -static struct stack_level *push_decl_level PROTO((struct stack_level *, - struct obstack *)); -static void push_binding_level PROTO((struct binding_level *, int, - int)); -static void pop_binding_level PROTO((void)); -static void suspend_binding_level PROTO((void)); -static void resume_binding_level PROTO((struct binding_level *)); -static struct binding_level *make_binding_level PROTO((void)); -static void declare_namespace_level PROTO((void)); -static void signal_catch PROTO((int)) ATTRIBUTE_NORETURN; -static void storedecls PROTO((tree)); -static void require_complete_types_for_parms PROTO((tree)); -static void push_overloaded_decl_1 PROTO((tree)); -static int ambi_op_p PROTO((tree)); -static int unary_op_p PROTO((tree)); -static tree store_bindings PROTO((tree, tree)); -static tree lookup_tag_reverse PROTO((tree, tree)); -static tree obscure_complex_init PROTO((tree, tree)); -static tree maybe_build_cleanup_1 PROTO((tree, tree)); -static tree lookup_name_real PROTO((tree, int, int, int)); -static void warn_extern_redeclared_static PROTO((tree, tree)); -static void grok_reference_init PROTO((tree, tree, tree)); -static tree grokfndecl PROTO((tree, tree, tree, tree, int, - enum overload_flags, tree, - tree, int, int, int, int, int, int, tree)); -static tree grokvardecl PROTO((tree, tree, RID_BIT_TYPE *, int, int, tree)); -static tree lookup_tag PROTO((enum tree_code, tree, - struct binding_level *, int)); -static void set_identifier_type_value_with_scope - PROTO((tree, tree, struct binding_level *)); -static void record_builtin_type PROTO((enum rid, const char *, tree)); -static void record_unknown_type PROTO((tree, const char *)); -static int member_function_or_else PROTO((tree, tree, const char *)); -static void bad_specifiers PROTO((tree, const char *, int, int, int, int, - int)); -static void lang_print_error_function PROTO((char *)); -static tree maybe_process_template_type_declaration PROTO((tree, int, struct binding_level*)); -static void check_for_uninitialized_const_var PROTO((tree)); -static unsigned long typename_hash PROTO((hash_table_key)); -static boolean typename_compare PROTO((hash_table_key, hash_table_key)); -static void push_binding PROTO((tree, tree, struct binding_level*)); -static int add_binding PROTO((tree, tree)); -static void pop_binding PROTO((tree, tree)); -static tree local_variable_p PROTO((tree)); -static tree find_binding PROTO((tree, tree)); -static tree select_decl PROTO((tree, int)); -static tree unqualified_namespace_lookup PROTO((tree, int)); -static int lookup_flags PROTO((int, int)); -static tree qualify_lookup PROTO((tree, int)); -static tree record_builtin_java_type PROTO((const char *, int)); -static const char *tag_name PROTO((enum tag_types code)); -static void find_class_binding_level PROTO((void)); -static struct binding_level *innermost_nonclass_level PROTO((void)); -static void finish_dtor PROTO((void)); -static void finish_ctor PROTO((int)); -static tree poplevel_class PROTO((void)); -static void warn_about_implicit_typename_lookup PROTO((tree, tree)); -static int walk_namespaces_r PROTO((tree, walk_namespaces_fn, void *)); -static int walk_globals_r PROTO((tree, void *)); - -#if defined (DEBUG_CP_BINDING_LEVELS) -static void indent PROTO((void)); -#endif - -/* A node which has tree code ERROR_MARK, and whose type is itself. - All erroneous expressions are replaced with this node. All functions - that accept nodes as arguments should avoid generating error messages - if this node is one of the arguments, since it is undesirable to get - multiple error messages from one error in the input. */ - -tree error_mark_node; - -/* Erroneous argument lists can use this *IFF* they do not modify it. */ -tree error_mark_list; - -/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */ - -tree short_integer_type_node; -tree integer_type_node; -tree long_integer_type_node; -tree long_long_integer_type_node; - -tree short_unsigned_type_node; -tree unsigned_type_node; -tree long_unsigned_type_node; -tree long_long_unsigned_type_node; - -tree ptrdiff_type_node; - -tree unsigned_char_type_node; -tree signed_char_type_node; -tree char_type_node; -tree wchar_type_node; -tree signed_wchar_type_node; -tree unsigned_wchar_type_node; - -tree wchar_decl_node; - -tree float_type_node; -tree double_type_node; -tree long_double_type_node; - -tree complex_integer_type_node; -tree complex_float_type_node; -tree complex_double_type_node; -tree complex_long_double_type_node; - -tree intQI_type_node; -tree intHI_type_node; -tree intSI_type_node; -tree intDI_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -tree intTI_type_node; -#endif - -tree unsigned_intQI_type_node; -tree unsigned_intHI_type_node; -tree unsigned_intSI_type_node; -tree unsigned_intDI_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 -tree unsigned_intTI_type_node; -#endif - -tree java_byte_type_node; -tree java_short_type_node; -tree java_int_type_node; -tree java_long_type_node; -tree java_float_type_node; -tree java_double_type_node; -tree java_char_type_node; -tree java_boolean_type_node; - -/* A VOID_TYPE node, and the same, packaged in a TREE_LIST. */ - -tree void_type_node, void_list_node; -tree void_zero_node; - -/* Nodes for types `void *' and `const void *'. */ - -tree ptr_type_node; -tree const_ptr_type_node; - -/* Nodes for types `char *' and `const char *'. */ - -tree string_type_node, const_string_type_node; - -/* Type `char[256]' or something like it. - Used when an array of char is needed and the size is irrelevant. */ - -tree char_array_type_node; - -/* Type `int[256]' or something like it. - Used when an array of int needed and the size is irrelevant. */ - -tree int_array_type_node; - -/* Type `wchar_t[256]' or something like it. - Used when a wide string literal is created. */ - -tree wchar_array_type_node; - -/* The bool data type, and constants */ -tree boolean_type_node, boolean_true_node, boolean_false_node; - -/* Type `int ()' -- used for implicit declaration of functions. */ - -tree default_function_type; - -/* Function types `double (double)' and `double (double, double)', etc. */ - -static tree double_ftype_double, double_ftype_double_double; -static tree int_ftype_int, long_ftype_long; -static tree float_ftype_float; -static tree ldouble_ftype_ldouble; - -/* Function type `int (const void *, const void *, size_t)' */ -static tree int_ftype_cptr_cptr_sizet; - -/* C++ extensions */ -tree vtable_entry_type; -tree delta_type_node; -#if 0 -/* Old rtti stuff. */ -tree __baselist_desc_type_node; -tree __i_desc_type_node, __m_desc_type_node; -tree __t_desc_array_type, __i_desc_array_type, __m_desc_array_type; -#endif -tree __t_desc_type_node; -#if 0 -tree __tp_desc_type_node; -#endif -tree __access_mode_type_node; -tree __bltn_desc_type_node, __user_desc_type_node, __class_desc_type_node; -tree __ptr_desc_type_node, __attr_desc_type_node, __func_desc_type_node; -tree __ptmf_desc_type_node, __ptmd_desc_type_node; -#if 0 -/* Not needed yet? May be needed one day? */ -tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type; -tree __ptr_desc_array_type, __attr_dec_array_type, __func_desc_array_type; -tree __ptmf_desc_array_type, __ptmd_desc_array_type; -#endif - -/* This is the identifier __vlist. */ -tree vlist_identifier; - -/* This is the type _Vlist = vtable_entry_type**. */ -tree vlist_type_node; - -/* A null pointer of type _Vlist. */ -tree vlist_zero_node; - -/* Indicates that there is a type value in some namespace, although - that is not necessarily in scope at the moment. */ - -static tree global_type_node; - -tree class_star_type_node; -tree class_type_node, record_type_node, union_type_node, enum_type_node; -tree unknown_type_node; -tree opaque_type_node, signature_type_node; -tree sigtable_entry_type; - -/* Array type `vtable_entry_type[]' */ -tree vtbl_type_node; -tree vtbl_ptr_type_node; - -/* namespace std */ -tree std_node; -int in_std = 0; - -/* Expect only namespace names now. */ -static int only_namespace_names; - -/* In a destructor, the point at which all derived class destroying - has been done, just before any base class destroying will be done. */ - -tree dtor_label; - -/* In a destructor, the last insn emitted after the start of the - function and the parms. */ - -static rtx last_dtor_insn; - -/* In a constructor, the last insn emitted after the start of the - function and the parms, the exception specification and any - function-try-block. The constructor initializers are emitted after - this insn. */ - -static rtx last_parm_cleanup_insn; - -/* In a constructor, the point at which we are ready to return - the pointer to the initialized object. */ - -tree ctor_label; - -/* A FUNCTION_DECL which can call `abort'. Not necessarily the - one that the user will declare, but sufficient to be called - by routines that want to abort the program. */ - -tree abort_fndecl; - -/* A FUNCTION_DECL for the default `::operator delete'. */ - -tree global_delete_fndecl; - -extern rtx cleanup_label, return_label; - -/* If original DECL_RESULT of current function was a register, - but due to being an addressable named return value, would up - on the stack, this variable holds the named return value's - original location. */ -static rtx original_result_rtx; - -/* Sequence of insns which represents base initialization. */ -tree base_init_expr; - -/* C++: Keep these around to reduce calls to `get_identifier'. - Identifiers for `this' in member functions and the auto-delete - parameter for destructors. */ -tree this_identifier, in_charge_identifier; -tree ctor_identifier, dtor_identifier; -/* Used in pointer to member functions, in vtables, and in sigtables. */ -tree pfn_identifier, index_identifier, delta_identifier, delta2_identifier; -tree pfn_or_delta2_identifier, tag_identifier; -tree vt_off_identifier; - -struct named_label_list -{ - struct binding_level *binding_level; - tree names_in_scope; - tree label_decl; - char *filename_o_goto; - int lineno_o_goto; - struct named_label_list *next; -}; - -/* A list (chain of TREE_LIST nodes) of named label uses. - The TREE_PURPOSE field is the list of variables defined - in the label's scope defined at the point of use. - The TREE_VALUE field is the LABEL_DECL used. - The TREE_TYPE field holds `current_binding_level' at the - point of the label's use. - - BWAHAHAAHAHahhahahahaah. No, no, no, said the little chicken. - - Look at the pretty struct named_label_list. See the pretty struct - with the pretty named fields that describe what they do. See the - pretty lack of gratuitous casts. Notice the code got a lot cleaner. - - Used only for jumps to as-yet undefined labels, since - jumps to defined labels can have their validity checked - by stmt.c. */ - -static struct named_label_list *named_label_uses = NULL; - -/* A list of objects which have constructors or destructors - which reside in the global scope. The decl is stored in - the TREE_VALUE slot and the initializer is stored - in the TREE_PURPOSE slot. */ -tree static_aggregates; - -/* -- end of C++ */ - -/* Two expressions that are constants with value zero. - The first is of type `int', the second of type `void *'. */ - -tree integer_zero_node; -tree null_pointer_node; - -/* The value for __null (NULL), namely, a zero of an integer type with - the same number of bits as a pointer. */ -tree null_node; - -/* A node for the integer constants 1, 2, and 3. */ - -tree integer_one_node, integer_two_node, integer_three_node; - -/* While defining an enum type, this is 1 plus the last enumerator - constant value. */ - -static tree enum_next_value; - -/* Nonzero means that there was overflow computing enum_next_value. */ - -static int enum_overflow; - -/* Parsing a function declarator leaves a list of parameter names - or a chain or parameter decls here. */ - -tree last_function_parms; - -/* Parsing a function declarator leaves here a chain of structure - and enum types declared in the parmlist. */ - -static tree last_function_parm_tags; - -/* After parsing the declarator that starts a function definition, - `start_function' puts here the list of parameter names or chain of decls. - `store_parm_decls' finds it here. */ - -static tree current_function_parms; - -/* Similar, for last_function_parm_tags. */ -static tree current_function_parm_tags; - -/* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function - that have names. Here so we can clear out their names' definitions - at the end of the function. */ - -static tree named_labels; - -/* A list of LABEL_DECLs from outer contexts that are currently shadowed. */ - -static tree shadowed_labels; - -/* The FUNCTION_DECL for the function currently being compiled, - or 0 if between functions. */ -tree current_function_decl; - -/* Set to 0 at beginning of a function definition, set to 1 if - a return statement that specifies a return value is seen. */ - -int current_function_returns_value; - -/* Set to 0 at beginning of a function definition, set to 1 if - a return statement with no argument is seen. */ - -int current_function_returns_null; - -/* Set to 0 at beginning of a function definition, and whenever - a label (case or named) is defined. Set to value of expression - returned from function when that value can be transformed into - a named return value. */ - -tree current_function_return_value; - -/* Nonzero means give `double' the same size as `float'. */ - -extern int flag_short_double; - -/* Nonzero means don't recognize any builtin functions. */ - -extern int flag_no_builtin; - -/* Nonzero means don't recognize the non-ANSI builtin functions. - -ansi sets this. */ - -extern int flag_no_nonansi_builtin; - -/* Nonzero means enable obscure ANSI features and disable GNU extensions - that might cause ANSI-compliant code to be miscompiled. */ - -extern int flag_ansi; - -/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes) - objects. */ -extern int flag_huge_objects; - -/* Nonzero if we want to conserve space in the .o files. We do this - by putting uninitialized data and runtime initialized data into - .common instead of .data at the expense of not flagging multiple - definitions. */ -extern int flag_conserve_space; - -/* Pointers to the base and current top of the language name stack. */ - -extern tree *current_lang_base, *current_lang_stack; - -/* C and C++ flags are in decl2.c. */ - -/* Set to 0 at beginning of a constructor, set to 1 - if that function does an allocation before referencing its - instance variable. */ -static int current_function_assigns_this; -int current_function_just_assigned_this; - -/* Set to 0 at beginning of a function. Set non-zero when - store_parm_decls is called. Don't call store_parm_decls - if this flag is non-zero! */ -int current_function_parms_stored; - -/* Flag used when debugging spew.c */ - -extern int spew_debug; - -/* This is a copy of the class_shadowed list of the previous class binding - contour when at global scope. It's used to reset IDENTIFIER_CLASS_VALUEs - when entering another class scope (i.e. a cache miss). */ -extern tree previous_class_values; - -/* A expression of value 0 with the same precision as a sizetype - node, but signed. */ -tree signed_size_zero_node; - -/* The name of the anonymous namespace, throughout this translation - unit. */ -tree anonymous_namespace_name; - - -/* Allocate a level of searching. */ - -static -struct stack_level * -push_decl_level (stack, obstack) - struct stack_level *stack; - struct obstack *obstack; -{ - struct stack_level tem; - tem.prev = stack; - - return push_stack_level (obstack, (char *)&tem, sizeof (tem)); -} - -/* For each binding contour we allocate a binding_level structure - which records the names defined in that contour. - Contours include: - 0) the global one - 1) one for each function definition, - where internal declarations of the parameters appear. - 2) one for each compound statement, - to record its declarations. - - The current meaning of a name can be found by searching the levels - from the current one out to the global one. - - Off to the side, may be the class_binding_level. This exists only - to catch class-local declarations. It is otherwise nonexistent. - - Also there may be binding levels that catch cleanups that must be - run when exceptions occur. Thus, to see whether a name is bound in - the current scope, it is not enough to look in the - CURRENT_BINDING_LEVEL. You should use lookup_name_current_level - instead. */ - -/* Note that the information in the `names' component of the global contour - is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */ - -struct binding_level - { - /* A chain of _DECL nodes for all variables, constants, functions, - and typedef types. These are in the reverse of the order - supplied. There may be OVERLOADs on this list, too, but they - are wrapped in TREE_LISTs; the TREE_VALUE is the OVERLOAD. */ - tree names; - - /* A list of structure, union and enum definitions, for looking up - tag names. - It is a chain of TREE_LIST nodes, each of whose TREE_PURPOSE is a name, - or NULL_TREE; and whose TREE_VALUE is a RECORD_TYPE, UNION_TYPE, - or ENUMERAL_TYPE node. - - C++: the TREE_VALUE nodes can be simple types for - component_bindings. */ - tree tags; - - /* A list of USING_DECL nodes. */ - tree usings; - - /* A list of used namespaces. PURPOSE is the namespace, - VALUE the common ancestor with this binding_level's namespace. */ - tree using_directives; - - /* If this binding level is the binding level for a class, then - class_shadowed is a TREE_LIST. The TREE_PURPOSE of each node - is the name of an entity bound in the class; the TREE_VALUE is - the IDENTIFIER_CLASS_VALUE before we entered the class. Thus, - when leaving class scope, we can restore the - IDENTIFIER_CLASS_VALUE by walking this list. The TREE_TYPE is - the DECL bound by this name in the class. */ - tree class_shadowed; - - /* Similar to class_shadowed, but for IDENTIFIER_TYPE_VALUE, and - is used for all binding levels. */ - tree type_shadowed; - - /* For each level (except not the global one), - a chain of BLOCK nodes for all the levels - that were entered and exited one level down. */ - tree blocks; - - /* The BLOCK node for this level, if one has been preallocated. - If 0, the BLOCK is allocated (if needed) when the level is popped. */ - tree this_block; - - /* The binding level which this one is contained in (inherits from). */ - struct binding_level *level_chain; - - /* List of decls in `names' that have incomplete - structure or union types. */ - tree incomplete; - - /* List of VAR_DECLS saved from a previous for statement. - These would be dead in ANSI-conforming code, but might - be referenced in ARM-era code. These are stored in a - TREE_LIST; the TREE_VALUE is the actual declaration. */ - tree dead_vars_from_for; - - /* 1 for the level that holds the parameters of a function. - 2 for the level that holds a class declaration. - 3 for levels that hold parameter declarations. */ - unsigned parm_flag : 4; - - /* 1 means make a BLOCK for this level regardless of all else. - 2 for temporary binding contours created by the compiler. */ - unsigned keep : 3; - - /* Nonzero if this level "doesn't exist" for tags. */ - unsigned tag_transparent : 1; - - /* Nonzero if this level can safely have additional - cleanup-needing variables added to it. */ - unsigned more_cleanups_ok : 1; - unsigned have_cleanups : 1; - - /* Nonzero if this level is for storing the decls for template - parameters and generic decls; these decls will be discarded and - replaced with a TEMPLATE_DECL. */ - unsigned pseudo_global : 1; - - /* This is set for a namespace binding level. */ - unsigned namespace_p : 1; - - /* True if this level is that of a for-statement where we need to - worry about ambiguous (ARM or ANSI) scope rules. */ - unsigned is_for_scope : 1; - - /* Two bits left for this word. */ - -#if defined(DEBUG_CP_BINDING_LEVELS) - /* Binding depth at which this level began. */ - unsigned binding_depth; -#endif /* defined(DEBUG_CP_BINDING_LEVELS) */ - }; - -#define NULL_BINDING_LEVEL ((struct binding_level *) NULL) - -/* The binding level currently in effect. */ - -static struct binding_level *current_binding_level; - -/* The binding level of the current class, if any. */ - -static struct binding_level *class_binding_level; - -/* A chain of binding_level structures awaiting reuse. */ - -static struct binding_level *free_binding_level; - -/* The outermost binding level, for names of file scope. - This is created when the compiler is started and exists - through the entire run. */ - -static struct binding_level *global_binding_level; - -/* Binding level structures are initialized by copying this one. */ - -static struct binding_level clear_binding_level; - -/* Nonzero means unconditionally make a BLOCK for the next level pushed. */ - -static int keep_next_level_flag; - -#if defined(DEBUG_CP_BINDING_LEVELS) -static int binding_depth = 0; -static int is_class_level = 0; - -static void -indent () -{ - register unsigned i; - - for (i = 0; i < binding_depth*2; i++) - putc (' ', stderr); -} -#endif /* defined(DEBUG_CP_BINDING_LEVELS) */ - -static tree pushdecl_with_scope PROTO((tree, struct binding_level *)); - -static void -push_binding_level (newlevel, tag_transparent, keep) - struct binding_level *newlevel; - int tag_transparent, keep; -{ - /* Add this level to the front of the chain (stack) of levels that - are active. */ - *newlevel = clear_binding_level; - newlevel->level_chain = current_binding_level; - current_binding_level = newlevel; - newlevel->tag_transparent = tag_transparent; - newlevel->more_cleanups_ok = 1; - newlevel->keep = keep; -#if defined(DEBUG_CP_BINDING_LEVELS) - newlevel->binding_depth = binding_depth; - indent (); - fprintf (stderr, "push %s level 0x%08x line %d\n", - (is_class_level) ? "class" : "block", newlevel, lineno); - is_class_level = 0; - binding_depth++; -#endif /* defined(DEBUG_CP_BINDING_LEVELS) */ -} - -/* Find the innermost enclosing class scope, and reset - CLASS_BINDING_LEVEL appropriately. */ - -static void -find_class_binding_level () -{ - struct binding_level *level = current_binding_level; - - while (level && level->parm_flag != 2) - level = level->level_chain; - if (level && level->parm_flag == 2) - class_binding_level = level; - else - class_binding_level = 0; -} - -static void -pop_binding_level () -{ - if (global_binding_level) - { - /* Cannot pop a level, if there are none left to pop. */ - if (current_binding_level == global_binding_level) - my_friendly_abort (123); - } - /* Pop the current level, and free the structure for reuse. */ -#if defined(DEBUG_CP_BINDING_LEVELS) - binding_depth--; - indent (); - fprintf (stderr, "pop %s level 0x%08x line %d\n", - (is_class_level) ? "class" : "block", - current_binding_level, lineno); - if (is_class_level != (current_binding_level == class_binding_level)) - { - indent (); - fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n"); - } - is_class_level = 0; -#endif /* defined(DEBUG_CP_BINDING_LEVELS) */ - { - register struct binding_level *level = current_binding_level; - current_binding_level = current_binding_level->level_chain; - level->level_chain = free_binding_level; -#if 0 /* defined(DEBUG_CP_BINDING_LEVELS) */ - if (level->binding_depth != binding_depth) - abort (); -#endif /* defined(DEBUG_CP_BINDING_LEVELS) */ - free_binding_level = level; - find_class_binding_level (); - } -} - -static void -suspend_binding_level () -{ - if (class_binding_level) - current_binding_level = class_binding_level; - - if (global_binding_level) - { - /* Cannot suspend a level, if there are none left to suspend. */ - if (current_binding_level == global_binding_level) - my_friendly_abort (123); - } - /* Suspend the current level. */ -#if defined(DEBUG_CP_BINDING_LEVELS) - binding_depth--; - indent (); - fprintf (stderr, "suspend %s level 0x%08x line %d\n", - (is_class_level) ? "class" : "block", - current_binding_level, lineno); - if (is_class_level != (current_binding_level == class_binding_level)) - { - indent (); - fprintf (stderr, "XXX is_class_level != (current_binding_level == class_binding_level)\n"); - } - is_class_level = 0; -#endif /* defined(DEBUG_CP_BINDING_LEVELS) */ - current_binding_level = current_binding_level->level_chain; - find_class_binding_level (); -} - -static void -resume_binding_level (b) - struct binding_level *b; -{ - /* Resuming binding levels is meant only for namespaces, - and those cannot nest into classes. */ - my_friendly_assert(!class_binding_level, 386); - /* Also, resuming a non-directly nested namespace is a no-no. */ - my_friendly_assert(b->level_chain == current_binding_level, 386); - current_binding_level = b; -#if defined(DEBUG_CP_BINDING_LEVELS) - b->binding_depth = binding_depth; - indent (); - fprintf (stderr, "resume %s level 0x%08x line %d\n", - (is_class_level) ? "class" : "block", b, lineno); - is_class_level = 0; - binding_depth++; -#endif /* defined(DEBUG_CP_BINDING_LEVELS) */ -} - -/* Create a new `struct binding_level'. */ - -static -struct binding_level * -make_binding_level () -{ - /* NOSTRICT */ - return (struct binding_level *) xmalloc (sizeof (struct binding_level)); -} - -/* Nonzero if we are currently in the global binding level. */ - -int -global_bindings_p () -{ - return current_binding_level == global_binding_level; -} - -/* Return the innermost binding level that is not for a class scope. */ - -static struct binding_level * -innermost_nonclass_level () -{ - struct binding_level *b; - - b = current_binding_level; - while (b->parm_flag == 2) - b = b->level_chain; - - return b; -} - -/* Nonzero if we are currently in a toplevel binding level. This - means either the global binding level or a namespace in a toplevel - binding level. Since there are no non-toplevel namespace levels, - this really means any namespace or pseudo-global level. We also - include a class whose context is toplevel. */ - -int -toplevel_bindings_p () -{ - struct binding_level *b = innermost_nonclass_level (); - - return b->namespace_p || b->pseudo_global; -} - -/* Nonzero if this is a namespace scope, or if we are defining a class - which is itself at namespace scope, or whose enclosing class is - such a class, etc. */ - -int -namespace_bindings_p () -{ - struct binding_level *b = innermost_nonclass_level (); - - return b->namespace_p; -} - -void -keep_next_level () -{ - keep_next_level_flag = 1; -} - -/* Nonzero if the current level needs to have a BLOCK made. */ - -int -kept_level_p () -{ - return (current_binding_level->blocks != NULL_TREE - || current_binding_level->keep - || current_binding_level->names != NULL_TREE - || (current_binding_level->tags != NULL_TREE - && !current_binding_level->tag_transparent)); -} - -/* Identify this binding level as a level of parameters. */ - -void -declare_parm_level () -{ - current_binding_level->parm_flag = 1; -} - -void -declare_pseudo_global_level () -{ - current_binding_level->pseudo_global = 1; -} - -static void -declare_namespace_level () -{ - current_binding_level->namespace_p = 1; -} - -int -pseudo_global_level_p () -{ - struct binding_level *b = innermost_nonclass_level (); - - return b->pseudo_global; -} - -void -set_class_shadows (shadows) - tree shadows; -{ - class_binding_level->class_shadowed = shadows; -} - -/* Enter a new binding level. - If TAG_TRANSPARENT is nonzero, do so only for the name space of variables, - not for that of tags. */ - -void -pushlevel (tag_transparent) - int tag_transparent; -{ - register struct binding_level *newlevel = NULL_BINDING_LEVEL; - - /* If this is the top level of a function, - just make sure that NAMED_LABELS is 0. - They should have been set to 0 at the end of the previous function. */ - - if (current_binding_level == global_binding_level) - my_friendly_assert (named_labels == NULL_TREE, 134); - - /* Reuse or create a struct for this binding level. */ - -#if defined(DEBUG_CP_BINDING_LEVELS) - if (0) -#else /* !defined(DEBUG_CP_BINDING_LEVELS) */ - if (free_binding_level) -#endif /* !defined(DEBUG_CP_BINDING_LEVELS) */ - { - newlevel = free_binding_level; - free_binding_level = free_binding_level->level_chain; - } - else - { - newlevel = make_binding_level (); - } - - push_binding_level (newlevel, tag_transparent, keep_next_level_flag); - GNU_xref_start_scope ((HOST_WIDE_INT) newlevel); - keep_next_level_flag = 0; -} - -void -note_level_for_for () -{ - current_binding_level->is_for_scope = 1; -} - -void -pushlevel_temporary (tag_transparent) - int tag_transparent; -{ - pushlevel (tag_transparent); - current_binding_level->keep = 2; - clear_last_expr (); - - /* Note we don't call push_momentary() here. Otherwise, it would cause - cleanups to be allocated on the momentary obstack, and they will be - overwritten by the next statement. */ - - expand_start_bindings (0); -} - -/* For a binding between a name and an entity at a block scope, - this is the `struct binding_level' for the block. */ -#define BINDING_LEVEL(NODE) \ - (((struct tree_binding*)NODE)->scope.level) - -/* These are currently unused, but permanent, CPLUS_BINDING nodes. - They are kept here because they are allocated from the permanent - obstack and cannot be easily freed. */ -static tree free_binding_nodes; - -/* Make DECL the innermost binding for ID. The LEVEL is the binding - level at which this declaration is being bound. */ - -static void -push_binding (id, decl, level) - tree id; - tree decl; - struct binding_level* level; -{ - tree binding; - - if (!free_binding_nodes) - { - /* There are no free nodes, so we must build one here. */ - push_obstacks_nochange (); - end_temporary_allocation (); - binding = make_node (CPLUS_BINDING); - pop_obstacks (); - } - else - { - /* There are nodes on the free list. Grab the first one. */ - binding = free_binding_nodes; - - /* And update the free list. */ - free_binding_nodes = TREE_CHAIN (free_binding_nodes); - } - - /* Now, fill in the binding information. */ - BINDING_VALUE (binding) = decl; - BINDING_TYPE (binding) = NULL_TREE; - BINDING_LEVEL (binding) = level; - INHERITED_VALUE_BINDING_P (binding) = 0; - LOCAL_BINDING_P (binding) = (level != class_binding_level); - - /* And put it on the front of the list of bindings for ID. */ - TREE_CHAIN (binding) = IDENTIFIER_BINDING (id); - IDENTIFIER_BINDING (id) = binding; -} - -/* ID is already bound in the current scope. But, DECL is an - additional binding for ID in the same scope. This is the `struct - stat' hack whereby a non-typedef class-name or enum-name can be - bound at the same level as some other kind of entity. It's the - responsibility of the caller to check that inserting this name is - legal here. Returns nonzero if the new binding was successful. */ -static int -add_binding (id, decl) - tree id; - tree decl; -{ - tree binding = IDENTIFIER_BINDING (id); - int ok = 1; - - if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl)) - /* The new name is the type name. */ - BINDING_TYPE (binding) = decl; - else if (!BINDING_VALUE (binding)) - /* This situation arises when push_class_level_binding moves an - inherited type-binding out of the way to make room for a new - value binding. */ - BINDING_VALUE (binding) = decl; - else if (TREE_CODE (BINDING_VALUE (binding)) == TYPE_DECL - && DECL_ARTIFICIAL (BINDING_VALUE (binding))) - { - /* The old binding was a type name. It was placed in - BINDING_VALUE because it was thought, at the point it was - declared, to be the only entity with such a name. Move the - type name into the type slot; it is now hidden by the new - binding. */ - BINDING_TYPE (binding) = BINDING_VALUE (binding); - BINDING_VALUE (binding) = decl; - INHERITED_VALUE_BINDING_P (binding) = 0; - } - else - { - cp_error ("declaration of `%#D'", decl); - cp_error_at ("conflicts with previous declaration `%#D'", - BINDING_VALUE (binding)); - ok = 0; - } - - return ok; -} - -/* Bind DECL to ID in the current_binding_level. - If PUSH_USING is set in FLAGS, we know that DECL doesn't really belong - to this binding level, that it got here through a using-declaration. */ - -void -push_local_binding (id, decl, flags) - tree id; - tree decl; - int flags; -{ - struct binding_level *b; - - /* Skip over any local classes. This makes sense if we call - push_local_binding with a friend decl of a local class. */ - b = current_binding_level; - while (b->parm_flag == 2) - b = b->level_chain; - - if (lookup_name_current_level (id)) - { - /* Supplement the existing binding. */ - if (!add_binding (id, decl)) - /* It didn't work. Something else must be bound at this - level. Do not add DECL to the list of things to pop - later. */ - return; - } - else - /* Create a new binding. */ - push_binding (id, decl, b); - - if (TREE_CODE (decl) == OVERLOAD || (flags & PUSH_USING)) - /* We must put the OVERLOAD into a TREE_LIST since the - TREE_CHAIN of an OVERLOAD is already used. Similarly for - decls that got here through a using-declaration. */ - decl = build_tree_list (NULL_TREE, decl); - - /* And put DECL on the list of things declared by the current - binding level. */ - TREE_CHAIN (decl) = b->names; - b->names = decl; -} - -/* Bind DECL to ID in the class_binding_level. Returns nonzero if the - binding was successful. */ - -int -push_class_binding (id, decl) - tree id; - tree decl; -{ - int result = 1; - tree binding = IDENTIFIER_BINDING (id); - tree context; - - /* Note that we declared this value so that we can issue an error if - this an illegal redeclaration of a name already used for some - other purpose. */ - note_name_declared_in_class (id, decl); - - if (binding && BINDING_LEVEL (binding) == class_binding_level) - /* Supplement the existing binding. */ - result = add_binding (id, decl); - else - /* Create a new binding. */ - push_binding (id, decl, class_binding_level); - - /* Update the IDENTIFIER_CLASS_VALUE for this ID to be the - class-level declaration. Note that we do not use DECL here - because of the possibility of the `struct stat' hack; if DECL is - a class-name or enum-name we might prefer a field-name, or some - such. */ - IDENTIFIER_CLASS_VALUE (id) = BINDING_VALUE (IDENTIFIER_BINDING (id)); - - /* If this is a binding from a base class, mark it as such. */ - binding = IDENTIFIER_BINDING (id); - if (BINDING_VALUE (binding) == decl && TREE_CODE (decl) != TREE_LIST) - { - /* Any implicit typename must be from a base-class. The - context for an implicit typename declaration is always - the derived class in which the lookup was done, so the checks - based on the context of DECL below will not trigger. */ - if (TREE_CODE (decl) == TYPE_DECL - && IMPLICIT_TYPENAME_P (TREE_TYPE (decl))) - INHERITED_VALUE_BINDING_P (binding) = 1; - else - { - if (TREE_CODE (decl) == OVERLOAD) - context = DECL_REAL_CONTEXT (OVL_CURRENT (decl)); - else - { - my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd', - 0); - context = DECL_REAL_CONTEXT (decl); - } - - if (is_properly_derived_from (current_class_type, context)) - INHERITED_VALUE_BINDING_P (binding) = 1; - else - INHERITED_VALUE_BINDING_P (binding) = 0; - } - } - else if (BINDING_VALUE (binding) == decl) - /* We only encounter a TREE_LIST when push_class_decls detects an - ambiguity. Such an ambiguity can be overridden by a definition - in this class. */ - INHERITED_VALUE_BINDING_P (binding) = 1; - - return result; -} - -/* Remove the binding for DECL which should be the innermost binding - for ID. */ - -static void -pop_binding (id, decl) - tree id; - tree decl; -{ - tree binding; - - if (id == NULL_TREE) - /* It's easiest to write the loops that call this function without - checking whether or not the entities involved have names. We - get here for such an entity. */ - return; - - /* Get the innermost binding for ID. */ - binding = IDENTIFIER_BINDING (id); - - /* The name should be bound. */ - my_friendly_assert (binding != NULL_TREE, 0); - - /* The DECL will be either the ordinary binding or the type - binding for this identifier. Remove that binding. */ - if (BINDING_VALUE (binding) == decl) - BINDING_VALUE (binding) = NULL_TREE; - else if (BINDING_TYPE (binding) == decl) - BINDING_TYPE (binding) = NULL_TREE; - else - my_friendly_abort (0); - - if (!BINDING_VALUE (binding) && !BINDING_TYPE (binding)) - { - /* We're completely done with the innermost binding for this - identifier. Unhook it from the list of bindings. */ - IDENTIFIER_BINDING (id) = TREE_CHAIN (binding); - - /* And place it on the free list. */ - TREE_CHAIN (binding) = free_binding_nodes; - free_binding_nodes = binding; - } -} - -/* Exit a binding level. - Pop the level off, and restore the state of the identifier-decl mappings - that were in effect when this level was entered. - - If KEEP == 1, this level had explicit declarations, so - and create a "block" (a BLOCK node) for the level - to record its declarations and subblocks for symbol table output. - - If FUNCTIONBODY is nonzero, this level is the body of a function, - so create a block as if KEEP were set and also clear out all - label names. - - If REVERSE is nonzero, reverse the order of decls before putting - them into the BLOCK. */ - -tree -poplevel (keep, reverse, functionbody) - int keep; - int reverse; - int functionbody; -{ - register tree link; - /* The chain of decls was accumulated in reverse order. - Put it into forward order, just for cleanliness. */ - tree decls; - int tmp = functionbody; - int real_functionbody = current_binding_level->keep == 2 - ? ((functionbody = 0), tmp) : functionbody; - tree tags = functionbody >= 0 ? current_binding_level->tags : 0; - tree subblocks = functionbody >= 0 ? current_binding_level->blocks : 0; - tree block = NULL_TREE; - tree decl; - int block_previously_created; - int leaving_for_scope; - - if (current_binding_level->parm_flag == 2) - return poplevel_class (); - - my_friendly_assert (!current_binding_level->class_shadowed, - 19990414); - - /* We used to use KEEP == 2 to indicate that the new block should go - at the beginning of the list of blocks at this binding level, - rather than the end. This hack is no longer used. */ - my_friendly_assert (keep == 0 || keep == 1, 0); - - GNU_xref_end_scope ((HOST_WIDE_INT) current_binding_level, - (HOST_WIDE_INT) current_binding_level->level_chain, - current_binding_level->parm_flag, - current_binding_level->keep); - - if (current_binding_level->keep == 1) - keep = 1; - - /* Get the decls in the order they were written. - Usually current_binding_level->names is in reverse order. - But parameter decls were previously put in forward order. */ - - if (reverse) - current_binding_level->names - = decls = nreverse (current_binding_level->names); - else - decls = current_binding_level->names; - - /* Output any nested inline functions within this block - if they weren't already output. */ - - for (decl = decls; decl; decl = TREE_CHAIN (decl)) - if (TREE_CODE (decl) == FUNCTION_DECL - && ! TREE_ASM_WRITTEN (decl) - && DECL_INITIAL (decl) != NULL_TREE - && TREE_ADDRESSABLE (decl) - && decl_function_context (decl) == current_function_decl) - { - /* If this decl was copied from a file-scope decl - on account of a block-scope extern decl, - propagate TREE_ADDRESSABLE to the file-scope decl. */ - if (DECL_ABSTRACT_ORIGIN (decl) != NULL_TREE) - TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (decl)) = 1; - else - { - push_function_context (); - output_inline_function (decl); - pop_function_context (); - } - } - - /* If there were any declarations or structure tags in that level, - or if this level is a function body, - create a BLOCK to record them for the life of this function. */ - - block = NULL_TREE; - block_previously_created = (current_binding_level->this_block != NULL_TREE); - if (block_previously_created) - block = current_binding_level->this_block; - else if (keep == 1 || functionbody) - block = make_node (BLOCK); - if (block != NULL_TREE) - { - if (block_previously_created) - { - if (decls || tags || subblocks) - { - if (BLOCK_VARS (block) || BLOCK_TYPE_TAGS (block)) - warning ("internal compiler error: debugging info corrupted"); - - BLOCK_VARS (block) = decls; - BLOCK_TYPE_TAGS (block) = tags; - - /* We can have previous subblocks and new subblocks when - doing fixup_gotos with complex cleanups. We chain the new - subblocks onto the end of any pre-existing subblocks. */ - BLOCK_SUBBLOCKS (block) = chainon (BLOCK_SUBBLOCKS (block), - subblocks); - } - /* If we created the block earlier on, and we are just - diddling it now, then it already should have a proper - BLOCK_END_NOTE value associated with it. */ - } - else - { - BLOCK_VARS (block) = decls; - BLOCK_TYPE_TAGS (block) = tags; - BLOCK_SUBBLOCKS (block) = subblocks; - /* Otherwise, for a new block, install a new BLOCK_END_NOTE - value. */ - remember_end_note (block); - } - } - - /* In each subblock, record that this is its superior. */ - - if (keep >= 0) - for (link = subblocks; link; link = TREE_CHAIN (link)) - BLOCK_SUPERCONTEXT (link) = block; - - /* We still support the old for-scope rules, whereby the variables - in a for-init statement were in scope after the for-statement - ended. We only use the new rules in flag_new_for_scope is - nonzero. */ - leaving_for_scope - = current_binding_level->is_for_scope && flag_new_for_scope == 1; - - /* Remove declarations for all the DECLs in this level. */ - for (link = decls; link; link = TREE_CHAIN (link)) - { - if (leaving_for_scope && TREE_CODE (link) == VAR_DECL) - { - tree outer_binding - = TREE_CHAIN (IDENTIFIER_BINDING (DECL_NAME (link))); - tree ns_binding; - - if (!outer_binding) - ns_binding = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (link)); - else - ns_binding = NULL_TREE; - - if (outer_binding - && (BINDING_LEVEL (outer_binding) - == current_binding_level->level_chain)) - /* We have something like: - - int i; - for (int i; ;); - - and we are leaving the `for' scope. There's no reason to - keep the binding of the inner `i' in this case. */ - pop_binding (DECL_NAME (link), link); - else if ((outer_binding - && (TREE_CODE (BINDING_VALUE (outer_binding)) - == TYPE_DECL)) - || (ns_binding - && TREE_CODE (ns_binding) == TYPE_DECL)) - /* Here, we have something like: - - typedef int I; - - void f () { - for (int I; ;); - } - - We must pop the for-scope binding so we know what's a - type and what isn't. */ - pop_binding (DECL_NAME (link), link); - else - { - /* Mark this VAR_DECL as dead so that we can tell we left it - there only for backward compatibility. */ - DECL_DEAD_FOR_LOCAL (link) = 1; - - /* Keep track of what should of have happenned when we - popped the binding. */ - if (outer_binding && BINDING_VALUE (outer_binding)) - DECL_SHADOWED_FOR_VAR (link) - = BINDING_VALUE (outer_binding); - - /* Add it to the list of dead variables in the next - outermost binding to that we can remove these when we - leave that binding. */ - current_binding_level->level_chain->dead_vars_from_for - = tree_cons (NULL_TREE, link, - current_binding_level->level_chain-> - dead_vars_from_for); - - /* Although we don't pop the CPLUS_BINDING, we do clear - its BINDING_LEVEL since the level is going away now. */ - BINDING_LEVEL (IDENTIFIER_BINDING (DECL_NAME (link))) - = 0; - } - } - else - { - /* Remove the binding. */ - decl = link; - if (TREE_CODE (decl) == TREE_LIST) - decl = TREE_VALUE (decl); - if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd') - pop_binding (DECL_NAME (decl), decl); - else if (TREE_CODE (decl) == OVERLOAD) - pop_binding (DECL_NAME (OVL_FUNCTION (decl)), decl); - else - my_friendly_abort (0); - } - } - - /* Remove declarations for any `for' variables from inner scopes - that we kept around. */ - for (link = current_binding_level->dead_vars_from_for; - link; link = TREE_CHAIN (link)) - pop_binding (DECL_NAME (TREE_VALUE (link)), TREE_VALUE (link)); - - /* Restore the IDENTIFIER_TYPE_VALUEs. */ - for (link = current_binding_level->type_shadowed; - link; link = TREE_CHAIN (link)) - SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (link), TREE_VALUE (link)); - - /* There may be OVERLOADs (wrapped in TREE_LISTs) on the BLOCK_VARs - list if a `using' declaration put them there. The debugging - back-ends won't understand OVERLOAD, so we remove them here. - Because the BLOCK_VARS are (temporarily) shared with - CURRENT_BINDING_LEVEL->NAMES we must do this fixup after we have - popped all the bindings. */ - if (block) - { - tree* d; - - for (d = &BLOCK_VARS (block); *d; ) - { - if (TREE_CODE (*d) == TREE_LIST) - *d = TREE_CHAIN (*d); - else - d = &TREE_CHAIN (*d); - } - } - - /* If the level being exited is the top level of a function, - check over all the labels. */ - - if (functionbody) - { - /* If this is the top level block of a function, - the vars are the function's parameters. - Don't leave them in the BLOCK because they are - found in the FUNCTION_DECL instead. */ - - BLOCK_VARS (block) = 0; - - /* Clear out the definitions of all label names, - since their scopes end here. */ - - for (link = named_labels; link; link = TREE_CHAIN (link)) - { - register tree label = TREE_VALUE (link); - - if (DECL_INITIAL (label) == NULL_TREE) - { - cp_error_at ("label `%D' used but not defined", label); - /* Avoid crashing later. */ - define_label (input_filename, 1, DECL_NAME (label)); - } - else if (warn_unused && !TREE_USED (label)) - cp_warning_at ("label `%D' defined but not used", label); - SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), NULL_TREE); - - /* Put the labels into the "variables" of the - top-level block, so debugger can see them. */ - TREE_CHAIN (label) = BLOCK_VARS (block); - BLOCK_VARS (block) = label; - } - - named_labels = NULL_TREE; - } - - /* Any uses of undefined labels now operate under constraints - of next binding contour. */ - { - struct binding_level *level_chain; - level_chain = current_binding_level->level_chain; - if (level_chain) - { - struct named_label_list *labels; - for (labels = named_label_uses; labels; labels = labels->next) - if (labels->binding_level == current_binding_level) - { - labels->binding_level = level_chain; - labels->names_in_scope = level_chain->names; - } - } - } - - tmp = current_binding_level->keep; - - pop_binding_level (); - if (functionbody) - DECL_INITIAL (current_function_decl) = block; - else if (block) - { - if (!block_previously_created) - current_binding_level->blocks - = chainon (current_binding_level->blocks, block); - } - /* If we did not make a block for the level just exited, - any blocks made for inner levels - (since they cannot be recorded as subblocks in that level) - must be carried forward so they will later become subblocks - of something else. */ - else if (subblocks) - current_binding_level->blocks - = chainon (current_binding_level->blocks, subblocks); - - /* Take care of compiler's internal binding structures. */ - if (tmp == 2) - { - expand_end_bindings (getdecls (), keep, 1); - /* Each and every BLOCK node created here in `poplevel' is important - (e.g. for proper debugging information) so if we created one - earlier, mark it as "used". */ - if (block) - TREE_USED (block) = 1; - block = poplevel (keep, reverse, real_functionbody); - } - - /* Each and every BLOCK node created here in `poplevel' is important - (e.g. for proper debugging information) so if we created one - earlier, mark it as "used". */ - if (block) - TREE_USED (block) = 1; - return block; -} - -/* Delete the node BLOCK from the current binding level. - This is used for the block inside a stmt expr ({...}) - so that the block can be reinserted where appropriate. */ - -void -delete_block (block) - tree block; -{ - tree t; - if (current_binding_level->blocks == block) - current_binding_level->blocks = TREE_CHAIN (block); - for (t = current_binding_level->blocks; t;) - { - if (TREE_CHAIN (t) == block) - TREE_CHAIN (t) = TREE_CHAIN (block); - else - t = TREE_CHAIN (t); - } - TREE_CHAIN (block) = NULL_TREE; - /* Clear TREE_USED which is always set by poplevel. - The flag is set again if insert_block is called. */ - TREE_USED (block) = 0; -} - -/* Insert BLOCK at the end of the list of subblocks of the - current binding level. This is used when a BIND_EXPR is expanded, - to handle the BLOCK node inside the BIND_EXPR. */ - -void -insert_block (block) - tree block; -{ - TREE_USED (block) = 1; - current_binding_level->blocks - = chainon (current_binding_level->blocks, block); -} - -/* Set the BLOCK node for the innermost scope - (the one we are currently in). */ - -void -set_block (block) - register tree block; -{ - current_binding_level->this_block = block; -} - -/* Do a pushlevel for class declarations. */ - -void -pushlevel_class () -{ - register struct binding_level *newlevel; - - /* Reuse or create a struct for this binding level. */ -#if defined(DEBUG_CP_BINDING_LEVELS) - if (0) -#else /* !defined(DEBUG_CP_BINDING_LEVELS) */ - if (free_binding_level) -#endif /* !defined(DEBUG_CP_BINDING_LEVELS) */ - { - newlevel = free_binding_level; - free_binding_level = free_binding_level->level_chain; - } - else - newlevel = make_binding_level (); - -#if defined(DEBUG_CP_BINDING_LEVELS) - is_class_level = 1; -#endif /* defined(DEBUG_CP_BINDING_LEVELS) */ - - push_binding_level (newlevel, 0, 0); - - decl_stack = push_decl_level (decl_stack, &decl_obstack); - class_binding_level = current_binding_level; - class_binding_level->parm_flag = 2; -} - -/* ...and a poplevel for class declarations. */ - -static tree -poplevel_class () -{ - register struct binding_level *level = class_binding_level; - tree shadowed; - - my_friendly_assert (level != 0, 354); - - decl_stack = pop_stack_level (decl_stack); - /* If we're leaving a toplevel class, don't bother to do the setting - of IDENTIFIER_CLASS_VALUE to NULL_TREE, since first of all this slot - shouldn't even be used when current_class_type isn't set, and second, - if we don't touch it here, we're able to use the cache effect if the - next time we're entering a class scope, it is the same class. */ - if (current_class_depth != 1) - { - struct binding_level* b; - - /* Clear out our IDENTIFIER_CLASS_VALUEs. */ - for (shadowed = level->class_shadowed; - shadowed; - shadowed = TREE_CHAIN (shadowed)) - IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed)) = NULL_TREE; - - /* Find the next enclosing class, and recreate - IDENTIFIER_CLASS_VALUEs appropriate for that class. */ - b = level->level_chain; - while (b && b->parm_flag != 2) - b = b->level_chain; - - if (b) - for (shadowed = b->class_shadowed; - shadowed; - shadowed = TREE_CHAIN (shadowed)) - { - tree t; - - t = IDENTIFIER_BINDING (TREE_PURPOSE (shadowed)); - while (t && BINDING_LEVEL (t) != b) - t = TREE_CHAIN (t); - - if (t) - IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (shadowed)) - = BINDING_VALUE (t); - } - } - else - /* Remember to save what IDENTIFIER's were bound in this scope so we - can recover from cache misses. */ - { - previous_class_type = current_class_type; - previous_class_values = class_binding_level->class_shadowed; - } - for (shadowed = level->type_shadowed; - shadowed; - shadowed = TREE_CHAIN (shadowed)) - SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (shadowed), TREE_VALUE (shadowed)); - - /* Remove the bindings for all of the class-level declarations. */ - for (shadowed = level->class_shadowed; - shadowed; - shadowed = TREE_CHAIN (shadowed)) - pop_binding (TREE_PURPOSE (shadowed), TREE_TYPE (shadowed)); - - GNU_xref_end_scope ((HOST_WIDE_INT) class_binding_level, - (HOST_WIDE_INT) class_binding_level->level_chain, - class_binding_level->parm_flag, - class_binding_level->keep); - - /* Now, pop out of the binding level which we created up in the - `pushlevel_class' routine. */ -#if defined(DEBUG_CP_BINDING_LEVELS) - is_class_level = 1; -#endif /* defined(DEBUG_CP_BINDING_LEVELS) */ - - pop_binding_level (); - - return NULL_TREE; -} - -/* We are entering the scope of a class. Clear IDENTIFIER_CLASS_VALUE - for any names in enclosing classes. */ - -void -clear_identifier_class_values () -{ - tree t; - - if (!class_binding_level) - return; - - for (t = class_binding_level->class_shadowed; - t; - t = TREE_CHAIN (t)) - IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE; -} - -/* Returns non-zero if T is a virtual function table. */ - -int -vtable_decl_p (t, data) - tree t; - void *data ATTRIBUTE_UNUSED; -{ - return (TREE_CODE (t) == VAR_DECL && DECL_VIRTUAL_P (t)); -} - -/* Returns non-zero if T is a TYPE_DECL for a type with virtual - functions. */ - -int -vtype_decl_p (t, data) - tree t; - void *data ATTRIBUTE_UNUSED; -{ - return (TREE_CODE (t) == TYPE_DECL - && TREE_TYPE (t) != error_mark_node - && TYPE_LANG_SPECIFIC (TREE_TYPE (t)) - && CLASSTYPE_VSIZE (TREE_TYPE (t))); -} - -/* Returns non-zero if T is a signature table. */ - -int -sigtable_decl_p (t, data) - tree t; - void *data ATTRIBUTE_UNUSED; -{ - return (TREE_CODE (t) == VAR_DECL - && TREE_TYPE (t) != error_mark_node - && IS_SIGNATURE (TREE_TYPE (t))); -} - -/* Walk all the namespaces contained NAMESPACE, including NAMESPACE - itself, calling F for each. The DATA is passed to F as well. */ - -static int -walk_namespaces_r (namespace, f, data) - tree namespace; - walk_namespaces_fn f; - void *data; -{ - tree current; - int result = 0; - - result |= (*f) (namespace, data); - - for (current = NAMESPACE_LEVEL (namespace)->names; - current; - current = TREE_CHAIN (current)) - { - if (TREE_CODE (current) != NAMESPACE_DECL - || DECL_NAMESPACE_ALIAS (current)) - continue; - if (!DECL_LANG_SPECIFIC (current)) - { - /* Hmm. std. */ - my_friendly_assert (current == std_node, 393); - continue; - } - - /* We found a namespace. */ - result |= walk_namespaces_r (current, f, data); - } - - return result; -} - -/* Walk all the namespaces, calling F for each. The DATA is passed to - F as well. */ - -int -walk_namespaces (f, data) - walk_namespaces_fn f; - void *data; -{ - return walk_namespaces_r (global_namespace, f, data); -} - -struct walk_globals_data { - walk_globals_pred p; - walk_globals_fn f; - void *data; -}; - -/* Walk the global declarations in NAMESPACE. Whenever one is found - for which P returns non-zero, call F with its address. If any call - to F returns a non-zero value, return a non-zero value. */ - -static int -walk_globals_r (namespace, data) - tree namespace; - void *data; -{ - struct walk_globals_data* wgd = (struct walk_globals_data *) data; - walk_globals_pred p = wgd->p; - walk_globals_fn f = wgd->f; - void *d = wgd->data; - tree *t; - int result = 0; - - t = &NAMESPACE_LEVEL (namespace)->names; - - while (*t) - { - tree glbl = *t; - - if ((*p) (glbl, d)) - result |= (*f) (t, d); - - /* If F changed *T, then *T still points at the next item to - examine. */ - if (*t == glbl) - t = &TREE_CHAIN (*t); - } - - return result; -} - -/* Walk the global declarations. Whenever one is found for which P - returns non-zero, call F with its address. If any call to F - returns a non-zero value, return a non-zero value. */ - -int -walk_globals (p, f, data) - walk_globals_pred p; - walk_globals_fn f; - void *data; -{ - struct walk_globals_data wgd; - wgd.p = p; - wgd.f = f; - wgd.data = data; - - return walk_namespaces (walk_globals_r, &wgd); -} - -/* Call wrapup_globals_declarations for the globals in NAMESPACE. If - DATA is non-NULL, this is the last time we will call - wrapup_global_declarations for this NAMESPACE. */ - -int -wrapup_globals_for_namespace (namespace, data) - tree namespace; - void *data; -{ - tree globals = NAMESPACE_LEVEL (namespace)->names; - int len = list_length (globals); - tree *vec = (tree *) alloca (sizeof (tree) * len); - int i; - int result; - tree decl; - int last_time = (data != 0); - - if (last_time && namespace == global_namespace) - /* Let compile_file handle the global namespace. */ - return 0; - - /* Process the decls in reverse order--earliest first. - Put them into VEC from back to front, then take out from front. */ - - for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl)) - vec[len - i - 1] = decl; - - if (last_time) - { - check_global_declarations (vec, len); - return 0; - } - - /* Temporarily mark vtables as external. That prevents - wrapup_global_declarations from writing them out; we must process - them ourselves in finish_vtable_vardecl. */ - for (i = 0; i < len; ++i) - if (vtable_decl_p (vec[i], /*data=*/0) && !DECL_EXTERNAL (vec[i])) - { - DECL_NOT_REALLY_EXTERN (vec[i]) = 1; - DECL_EXTERNAL (vec[i]) = 1; - } - - /* Write out any globals that need to be output. */ - result = wrapup_global_declarations (vec, len); - - /* Undo the hack to DECL_EXTERNAL above. */ - for (i = 0; i < len; ++i) - if (vtable_decl_p (vec[i], /*data=*/0) - && DECL_NOT_REALLY_EXTERN (vec[i])) - { - DECL_NOT_REALLY_EXTERN (vec[i]) = 0; - DECL_EXTERNAL (vec[i]) = 0; - } - - return result; -} - - -/* For debugging. */ -static int no_print_functions = 0; -static int no_print_builtins = 0; - -void -print_binding_level (lvl) - struct binding_level *lvl; -{ - tree t; - int i = 0, len; - fprintf (stderr, " blocks="); - fprintf (stderr, HOST_PTR_PRINTF, lvl->blocks); - fprintf (stderr, " n_incomplete=%d parm_flag=%d keep=%d", - list_length (lvl->incomplete), lvl->parm_flag, lvl->keep); - if (lvl->tag_transparent) - fprintf (stderr, " tag-transparent"); - if (lvl->more_cleanups_ok) - fprintf (stderr, " more-cleanups-ok"); - if (lvl->have_cleanups) - fprintf (stderr, " have-cleanups"); - fprintf (stderr, "\n"); - if (lvl->names) - { - fprintf (stderr, " names:\t"); - /* We can probably fit 3 names to a line? */ - for (t = lvl->names; t; t = TREE_CHAIN (t)) - { - if (no_print_functions && (TREE_CODE (t) == FUNCTION_DECL)) - continue; - if (no_print_builtins - && (TREE_CODE (t) == TYPE_DECL) - && (!strcmp (DECL_SOURCE_FILE (t),""))) - continue; - - /* Function decls tend to have longer names. */ - if (TREE_CODE (t) == FUNCTION_DECL) - len = 3; - else - len = 2; - i += len; - if (i > 6) - { - fprintf (stderr, "\n\t"); - i = len; - } - print_node_brief (stderr, "", t, 0); - if (t == error_mark_node) - break; - } - if (i) - fprintf (stderr, "\n"); - } - if (lvl->tags) - { - fprintf (stderr, " tags:\t"); - i = 0; - for (t = lvl->tags; t; t = TREE_CHAIN (t)) - { - if (TREE_PURPOSE (t) == NULL_TREE) - len = 3; - else if (TREE_PURPOSE (t) == TYPE_IDENTIFIER (TREE_VALUE (t))) - len = 2; - else - len = 4; - i += len; - if (i > 5) - { - fprintf (stderr, "\n\t"); - i = len; - } - if (TREE_PURPOSE (t) == NULL_TREE) - { - print_node_brief (stderr, ""); - } - else if (TREE_PURPOSE (t) == TYPE_IDENTIFIER (TREE_VALUE (t))) - print_node_brief (stderr, "", TREE_VALUE (t), 0); - else - { - print_node_brief (stderr, ""); - } - } - if (i) - fprintf (stderr, "\n"); - } - if (lvl->class_shadowed) - { - fprintf (stderr, " class-shadowed:"); - for (t = lvl->class_shadowed; t; t = TREE_CHAIN (t)) - { - fprintf (stderr, " %s ", IDENTIFIER_POINTER (TREE_PURPOSE (t))); - } - fprintf (stderr, "\n"); - } - if (lvl->type_shadowed) - { - fprintf (stderr, " type-shadowed:"); - for (t = lvl->type_shadowed; t; t = TREE_CHAIN (t)) - { - fprintf (stderr, " %s ", IDENTIFIER_POINTER (TREE_PURPOSE (t))); - } - fprintf (stderr, "\n"); - } -} - -void -print_other_binding_stack (stack) - struct binding_level *stack; -{ - struct binding_level *level; - for (level = stack; level != global_binding_level; level = level->level_chain) - { - fprintf (stderr, "binding level "); - fprintf (stderr, HOST_PTR_PRINTF, level); - fprintf (stderr, "\n"); - print_binding_level (level); - } -} - -void -print_binding_stack () -{ - struct binding_level *b; - fprintf (stderr, "current_binding_level="); - fprintf (stderr, HOST_PTR_PRINTF, current_binding_level); - fprintf (stderr, "\nclass_binding_level="); - fprintf (stderr, HOST_PTR_PRINTF, class_binding_level); - fprintf (stderr, "\nglobal_binding_level="); - fprintf (stderr, HOST_PTR_PRINTF, global_binding_level); - fprintf (stderr, "\n"); - if (class_binding_level) - { - for (b = class_binding_level; b; b = b->level_chain) - if (b == current_binding_level) - break; - if (b) - b = class_binding_level; - else - b = current_binding_level; - } - else - b = current_binding_level; - print_other_binding_stack (b); - fprintf (stderr, "global:\n"); - print_binding_level (global_binding_level); -} - -/* Namespace binding access routines: The namespace_bindings field of - the identifier is polymorphic, with three possible values: - NULL_TREE, a list of CPLUS_BINDINGS, or any other tree_node - indicating the BINDING_VALUE of global_namespace. */ - -/* Check whether the a binding for the name to scope is known. - Assumes that the bindings of the name are already a list - of bindings. Returns the binding found, or NULL_TREE. */ - -static tree -find_binding (name, scope) - tree name; - tree scope; -{ - tree iter, prev = NULL_TREE; - - scope = ORIGINAL_NAMESPACE (scope); - - for (iter = IDENTIFIER_NAMESPACE_BINDINGS (name); iter; - iter = TREE_CHAIN (iter)) - { - my_friendly_assert (TREE_CODE (iter) == CPLUS_BINDING, 374); - if (BINDING_SCOPE (iter) == scope) - { - /* Move binding found to the fron of the list, so - subsequent lookups will find it faster. */ - if (prev) - { - TREE_CHAIN (prev) = TREE_CHAIN (iter); - TREE_CHAIN (iter) = IDENTIFIER_NAMESPACE_BINDINGS (name); - IDENTIFIER_NAMESPACE_BINDINGS (name) = iter; - } - return iter; - } - prev = iter; - } - return NULL_TREE; -} - -/* Always returns a binding for name in scope. If the - namespace_bindings is not a list, convert it to one first. - If no binding is found, make a new one. */ - -tree -binding_for_name (name, scope) - tree name; - tree scope; -{ - tree b = IDENTIFIER_NAMESPACE_BINDINGS (name); - tree result; - - scope = ORIGINAL_NAMESPACE (scope); - - if (b && TREE_CODE (b) != CPLUS_BINDING) - { - /* Get rid of optimization for global scope. */ - IDENTIFIER_NAMESPACE_BINDINGS (name) = NULL_TREE; - BINDING_VALUE (binding_for_name (name, global_namespace)) = b; - b = IDENTIFIER_NAMESPACE_BINDINGS (name); - } - if (b && (result = find_binding (name, scope))) - return result; - /* Not found, make a new permanent one. */ - push_obstacks (&permanent_obstack, &permanent_obstack); - result = make_node (CPLUS_BINDING); - TREE_CHAIN (result) = b; - IDENTIFIER_NAMESPACE_BINDINGS (name) = result; - BINDING_SCOPE (result) = scope; - BINDING_TYPE (result) = NULL_TREE; - BINDING_VALUE (result) = NULL_TREE; - pop_obstacks (); - return result; -} - -/* Return the binding value for name in scope, considering that - namespace_binding may or may not be a list of CPLUS_BINDINGS. */ - -tree -namespace_binding (name, scope) - tree name; - tree scope; -{ - tree b = IDENTIFIER_NAMESPACE_BINDINGS (name); - if (b == NULL_TREE) - return NULL_TREE; - if (scope == NULL_TREE) - scope = global_namespace; - if (TREE_CODE (b) != CPLUS_BINDING) - return (scope == global_namespace) ? b : NULL_TREE; - name = find_binding (name,scope); - if (name == NULL_TREE) - return name; - return BINDING_VALUE (name); -} - -/* Set the binding value for name in scope. If modifying the binding - of global_namespace is attempted, try to optimize it. */ - -void -set_namespace_binding (name, scope, val) - tree name; - tree scope; - tree val; -{ - tree b; - - if (scope == NULL_TREE) - scope = global_namespace; - - if (scope == global_namespace) - { - b = IDENTIFIER_NAMESPACE_BINDINGS (name); - if (b == NULL_TREE || TREE_CODE (b) != CPLUS_BINDING) - { - IDENTIFIER_NAMESPACE_BINDINGS (name) = val; - return; - } - } - b = binding_for_name (name, scope); - BINDING_VALUE (b) = val; -} - -/* Push into the scope of the NAME namespace. If NAME is NULL_TREE, then we - select a name that is unique to this compilation unit. */ - -void -push_namespace (name) - tree name; -{ - tree d = NULL_TREE; - int need_new = 1; - int implicit_use = 0; - int global = 0; - if (!global_namespace) - { - /* This must be ::. */ - my_friendly_assert (name == get_identifier ("::"), 377); - global = 1; - } - else if (!name) - { - /* The name of anonymous namespace is unique for the translation - unit. */ - if (!anonymous_namespace_name) - anonymous_namespace_name = get_file_function_name ('N'); - name = anonymous_namespace_name; - d = IDENTIFIER_NAMESPACE_VALUE (name); - if (d) - /* Reopening anonymous namespace. */ - need_new = 0; - implicit_use = 1; - } - else if (current_namespace == global_namespace - && name == DECL_NAME (std_node)) - { - in_std++; - return; - } - else - { - /* Check whether this is an extended namespace definition. */ - d = IDENTIFIER_NAMESPACE_VALUE (name); - if (d != NULL_TREE && TREE_CODE (d) == NAMESPACE_DECL) - { - need_new = 0; - if (DECL_NAMESPACE_ALIAS (d)) - { - cp_error ("namespace alias `%D' not allowed here, assuming `%D'", - d, DECL_NAMESPACE_ALIAS (d)); - d = DECL_NAMESPACE_ALIAS (d); - } - } - } - - if (need_new) - { - /* Make a new namespace, binding the name to it. */ - d = build_lang_decl (NAMESPACE_DECL, name, void_type_node); - /* The global namespace is not pushed, and the global binding - level is set elsewhere. */ - if (!global) - { - d = pushdecl (d); - pushlevel (0); - declare_namespace_level (); - NAMESPACE_LEVEL (d) = current_binding_level; - } - } - else - resume_binding_level (NAMESPACE_LEVEL (d)); - - if (implicit_use) - do_using_directive (d); - /* Enter the name space. */ - current_namespace = d; -} - -/* Pop from the scope of the current namespace. */ - -void -pop_namespace () -{ - if (current_namespace == global_namespace) - { - my_friendly_assert (in_std>0, 980421); - in_std--; - return; - } - current_namespace = CP_DECL_CONTEXT (current_namespace); - /* The binding level is not popped, as it might be re-opened later. */ - suspend_binding_level (); -} - - -/* Subroutines for reverting temporarily to top-level for instantiation - of templates and such. We actually need to clear out the class- and - local-value slots of all identifiers, so that only the global values - are at all visible. Simply setting current_binding_level to the global - scope isn't enough, because more binding levels may be pushed. */ -struct saved_scope { - struct binding_level *old_binding_level; - tree old_bindings; - tree old_namespace; - struct saved_scope *prev; - tree class_name, class_type; - tree access_specifier; - tree function_decl; - struct binding_level *class_bindings; - tree *lang_base, *lang_stack, lang_name; - int lang_stacksize; - int minimal_parse_mode; - tree last_function_parms; - tree template_parms; - HOST_WIDE_INT processing_template_decl; - tree previous_class_type, previous_class_values; - int processing_specialization; - int processing_explicit_instantiation; - char *class_cache_firstobj; -}; -static struct saved_scope *current_saved_scope; - -/* A chain of the binding vecs created by store_bindings. We create a - whole bunch of these during compilation, on permanent_obstack, so we - can't just throw them away. */ -static tree free_binding_vecs; - -static tree -store_bindings (names, old_bindings) - tree names, old_bindings; -{ - tree t; - for (t = names; t; t = TREE_CHAIN (t)) - { - tree binding, t1, id; - - if (TREE_CODE (t) == TREE_LIST) - id = TREE_PURPOSE (t); - else - id = DECL_NAME (t); - - if (!id - /* Note that we may have an IDENTIFIER_CLASS_VALUE even when - we have no IDENTIFIER_BINDING if we have left the class - scope, but cached the class-level declarations. */ - || !(IDENTIFIER_BINDING (id) || IDENTIFIER_CLASS_VALUE (id))) - continue; - - for (t1 = old_bindings; t1; t1 = TREE_CHAIN (t1)) - if (TREE_VEC_ELT (t1, 0) == id) - goto skip_it; - - if (free_binding_vecs) - { - binding = free_binding_vecs; - free_binding_vecs = TREE_CHAIN (free_binding_vecs); - } - else - binding = make_tree_vec (4); - - if (id) - { - my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 135); - TREE_VEC_ELT (binding, 0) = id; - TREE_VEC_ELT (binding, 1) = REAL_IDENTIFIER_TYPE_VALUE (id); - TREE_VEC_ELT (binding, 2) = IDENTIFIER_BINDING (id); - TREE_VEC_ELT (binding, 3) = IDENTIFIER_CLASS_VALUE (id); - IDENTIFIER_BINDING (id) = NULL_TREE; - IDENTIFIER_CLASS_VALUE (id) = NULL_TREE; - } - TREE_CHAIN (binding) = old_bindings; - old_bindings = binding; - skip_it: - ; - } - return old_bindings; -} - -void -maybe_push_to_top_level (pseudo) - int pseudo; -{ - extern int current_lang_stacksize; - struct saved_scope *s - = (struct saved_scope *) xmalloc (sizeof (struct saved_scope)); - struct binding_level *b = current_binding_level; - tree old_bindings = NULL_TREE; - - push_cp_function_context (NULL_TREE); - - if (previous_class_type) - old_bindings = store_bindings (previous_class_values, old_bindings); - - /* Have to include global_binding_level, because class-level decls - aren't listed anywhere useful. */ - for (; b; b = b->level_chain) - { - tree t; - - /* Template IDs are inserted into the global level. If they were - inserted into namespace level, finish_file wouldn't find them - when doing pending instantiations. Therefore, don't stop at - namespace level, but continue until :: . */ - if (b == global_binding_level || (pseudo && b->pseudo_global)) - break; - - old_bindings = store_bindings (b->names, old_bindings); - /* We also need to check class_shadowed to save class-level type - bindings, since pushclass doesn't fill in b->names. */ - if (b->parm_flag == 2) - old_bindings = store_bindings (b->class_shadowed, old_bindings); - - /* Unwind type-value slots back to top level. */ - for (t = b->type_shadowed; t; t = TREE_CHAIN (t)) - SET_IDENTIFIER_TYPE_VALUE (TREE_PURPOSE (t), TREE_VALUE (t)); - } - - s->old_binding_level = current_binding_level; - current_binding_level = b; - - s->old_namespace = current_namespace; - s->class_name = current_class_name; - s->class_type = current_class_type; - s->access_specifier = current_access_specifier; - s->function_decl = current_function_decl; - s->class_bindings = class_binding_level; - s->lang_stack = current_lang_stack; - s->lang_base = current_lang_base; - s->lang_stacksize = current_lang_stacksize; - s->lang_name = current_lang_name; - s->minimal_parse_mode = minimal_parse_mode; - s->last_function_parms = last_function_parms; - s->template_parms = current_template_parms; - s->processing_template_decl = processing_template_decl; - s->previous_class_type = previous_class_type; - s->previous_class_values = previous_class_values; - s->class_cache_firstobj = class_cache_firstobj; - s->processing_specialization = processing_specialization; - s->processing_explicit_instantiation = processing_explicit_instantiation; - - current_class_name = current_class_type = NULL_TREE; - current_function_decl = NULL_TREE; - class_binding_level = (struct binding_level *)0; - current_lang_stacksize = 10; - current_lang_stack = current_lang_base - = (tree *) xmalloc (current_lang_stacksize * sizeof (tree)); - current_lang_name = lang_name_cplusplus; - strict_prototype = strict_prototypes_lang_cplusplus; - named_labels = NULL_TREE; - shadowed_labels = NULL_TREE; - minimal_parse_mode = 0; - previous_class_type = previous_class_values = NULL_TREE; - class_cache_firstobj = 0; - processing_specialization = 0; - processing_explicit_instantiation = 0; - current_template_parms = NULL_TREE; - processing_template_decl = 0; - current_namespace = global_namespace; - - s->prev = current_saved_scope; - s->old_bindings = old_bindings; - current_saved_scope = s; - - push_obstacks (&permanent_obstack, &permanent_obstack); -} - -void -push_to_top_level () -{ - maybe_push_to_top_level (0); -} - -void -pop_from_top_level () -{ - extern int current_lang_stacksize; - struct saved_scope *s = current_saved_scope; - tree t; - - /* Clear out class-level bindings cache. */ - if (previous_class_type) - invalidate_class_lookup_cache (); - - pop_obstacks (); - - current_binding_level = s->old_binding_level; - current_saved_scope = s->prev; - for (t = s->old_bindings; t; ) - { - tree save = t; - tree id = TREE_VEC_ELT (t, 0); - if (id) - { - SET_IDENTIFIER_TYPE_VALUE (id, TREE_VEC_ELT (t, 1)); - IDENTIFIER_BINDING (id) = TREE_VEC_ELT (t, 2); - IDENTIFIER_CLASS_VALUE (id) = TREE_VEC_ELT (t, 3); - } - t = TREE_CHAIN (t); - TREE_CHAIN (save) = free_binding_vecs; - free_binding_vecs = save; - } - current_namespace = s->old_namespace; - current_class_name = s->class_name; - current_class_type = s->class_type; - current_access_specifier = s->access_specifier; - current_function_decl = s->function_decl; - class_binding_level = s->class_bindings; - free (current_lang_base); - current_lang_base = s->lang_base; - current_lang_stack = s->lang_stack; - current_lang_name = s->lang_name; - current_lang_stacksize = s->lang_stacksize; - if (current_lang_name == lang_name_cplusplus) - strict_prototype = strict_prototypes_lang_cplusplus; - else if (current_lang_name == lang_name_c) - strict_prototype = strict_prototypes_lang_c; - minimal_parse_mode = s->minimal_parse_mode; - last_function_parms = s->last_function_parms; - current_template_parms = s->template_parms; - processing_template_decl = s->processing_template_decl; - previous_class_type = s->previous_class_type; - previous_class_values = s->previous_class_values; - processing_specialization = s->processing_specialization; - processing_explicit_instantiation = s->processing_explicit_instantiation; - class_cache_firstobj = s->class_cache_firstobj; - - free (s); - - pop_cp_function_context (NULL_TREE); -} - -/* Push a definition of struct, union or enum tag "name". - into binding_level "b". "type" should be the type node, - We assume that the tag "name" is not already defined. - - Note that the definition may really be just a forward reference. - In that case, the TYPE_SIZE will be a NULL_TREE. - - C++ gratuitously puts all these tags in the name space. */ - -/* When setting the IDENTIFIER_TYPE_VALUE field of an identifier ID, - record the shadowed value for this binding contour. TYPE is - the type that ID maps to. */ - -static void -set_identifier_type_value_with_scope (id, type, b) - tree id; - tree type; - struct binding_level *b; -{ - if (!b->namespace_p) - { - /* Shadow the marker, not the real thing, so that the marker - gets restored later. */ - tree old_type_value = REAL_IDENTIFIER_TYPE_VALUE (id); - b->type_shadowed - = tree_cons (id, old_type_value, b->type_shadowed); - } - else - { - tree binding = binding_for_name (id, current_namespace); - BINDING_TYPE (binding) = type; - /* Store marker instead of real type. */ - type = global_type_node; - } - SET_IDENTIFIER_TYPE_VALUE (id, type); -} - -/* As set_identifier_type_value_with_scope, but using current_binding_level. */ - -void -set_identifier_type_value (id, type) - tree id; - tree type; -{ - set_identifier_type_value_with_scope (id, type, current_binding_level); -} - -/* Return the type associated with id. */ - -tree -identifier_type_value (id) - tree id; -{ - /* There is no type with that name, anywhere. */ - if (REAL_IDENTIFIER_TYPE_VALUE (id) == NULL_TREE) - return NULL_TREE; - /* This is not the type marker, but the real thing. */ - if (REAL_IDENTIFIER_TYPE_VALUE (id) != global_type_node) - return REAL_IDENTIFIER_TYPE_VALUE (id); - /* Have to search for it. It must be on the global level, now. - Ask lookup_name not to return non-types. */ - id = lookup_name_real (id, 2, 1, 0); - if (id) - return TREE_TYPE (id); - return NULL_TREE; -} - -/* Pop off extraneous binding levels left over due to syntax errors. - - We don't pop past namespaces, as they might be valid. */ - -void -pop_everything () -{ -#ifdef DEBUG_CP_BINDING_LEVELS - fprintf (stderr, "XXX entering pop_everything ()\n"); -#endif - while (!toplevel_bindings_p ()) - { - if (current_binding_level->parm_flag == 2) - pop_nested_class (); - else - poplevel (0, 0, 0); - } -#ifdef DEBUG_CP_BINDING_LEVELS - fprintf (stderr, "XXX leaving pop_everything ()\n"); -#endif -} - -/* The type TYPE is being declared. If it is a class template, or a - specialization of a class template, do any processing required and - perform error-checking. If IS_FRIEND is non-zero, this TYPE is - being declared a friend. B is the binding level at which this TYPE - should be bound. - - Returns the TYPE_DECL for TYPE, which may have been altered by this - processing. */ - -static tree -maybe_process_template_type_declaration (type, globalize, b) - tree type; - int globalize; - struct binding_level* b; -{ - tree decl = TYPE_NAME (type); - - if (processing_template_parmlist) - /* You can't declare a new template type in a template parameter - list. But, you can declare a non-template type: - - template struct S; - - is a forward-declaration of `A'. */ - ; - else - { - maybe_check_template_type (type); - - my_friendly_assert (IS_AGGR_TYPE (type) - || TREE_CODE (type) == ENUMERAL_TYPE, 0); - - - if (/* If !GLOBALIZE then we are looking at a definition. - It may not be a primary template. (For example, in: - - template - struct S1 { class S2 {}; } - - we have to push_template_decl for S2.) */ - (processing_template_decl && !globalize) - /* If we are declaring a friend template class, we will - have GLOBALIZE set, since something like: - - template - struct S1 { - template - friend class S2; - }; - - declares S2 to be at global scope. */ - || PROCESSING_REAL_TEMPLATE_DECL_P ()) - { - /* This may change after the call to - push_template_decl_real, but we want the original value. */ - tree name = DECL_NAME (decl); - - decl = push_template_decl_real (decl, globalize); - /* If the current binding level is the binding level for the - template parameters (see the comment in - begin_template_parm_list) and the enclosing level is a class - scope, and we're not looking at a friend, push the - declaration of the member class into the class scope. In the - friend case, push_template_decl will already have put the - friend into global scope, if appropriate. */ - if (TREE_CODE (type) != ENUMERAL_TYPE - && !globalize && b->pseudo_global - && b->level_chain->parm_flag == 2) - { - finish_member_declaration (CLASSTYPE_TI_TEMPLATE (type)); - /* Put this tag on the list of tags for the class, since - that won't happen below because B is not the class - binding level, but is instead the pseudo-global level. */ - b->level_chain->tags = - saveable_tree_cons (name, type, b->level_chain->tags); - if (TYPE_SIZE (current_class_type) == NULL_TREE) - CLASSTYPE_TAGS (current_class_type) = b->level_chain->tags; - } - } - } - - return decl; -} - -/* Push a tag name NAME for struct/class/union/enum type TYPE. - Normally put it into the inner-most non-tag-transparent scope, - but if GLOBALIZE is true, put it in the inner-most non-class scope. - The latter is needed for implicit declarations. */ - -void -pushtag (name, type, globalize) - tree name, type; - int globalize; -{ - register struct binding_level *b; - - b = current_binding_level; - while (b->tag_transparent - || (globalize && b->parm_flag == 2)) - b = b->level_chain; - - if (toplevel_bindings_p ()) - b->tags = perm_tree_cons (name, type, b->tags); - else - b->tags = saveable_tree_cons (name, type, b->tags); - - if (name) - { - /* Do C++ gratuitous typedefing. */ - if (IDENTIFIER_TYPE_VALUE (name) != type) - { - register tree d = NULL_TREE; - int newdecl = 0, in_class = 0; - tree context; - tree c_decl = NULL_TREE; - - context = type ? TYPE_CONTEXT (type) : NULL_TREE; - if (! context) - { - tree cs = current_scope (); - - if (! globalize) - context = cs; - else if (cs != NULL_TREE - && TREE_CODE_CLASS (TREE_CODE (cs)) == 't') - /* When declaring a friend class of a local class, we want - to inject the newly named class into the scope - containing the local class, not the namespace scope. */ - context = hack_decl_function_context (get_type_decl (cs)); - } - if (context) - c_decl = TREE_CODE (context) == FUNCTION_DECL - ? context : TYPE_MAIN_DECL (context); - - if (!context) - context = current_namespace; - - if ((b->pseudo_global && b->level_chain->parm_flag == 2) - || b->parm_flag == 2) - in_class = 1; - else - d = lookup_nested_type (type, c_decl); - - if (d == NULL_TREE) - { - newdecl = 1; - d = build_decl (TYPE_DECL, name, type); - if (current_lang_name == lang_name_java) - TYPE_FOR_JAVA (type) = 1; - SET_DECL_ARTIFICIAL (d); - if (! in_class) - set_identifier_type_value_with_scope (name, type, b); - } - else - d = TYPE_MAIN_DECL (d); - - TYPE_NAME (type) = d; - DECL_CONTEXT (d) = FROB_CONTEXT (context); - - d = maybe_process_template_type_declaration (type, - globalize, b); - - if (b->parm_flag == 2) - { - if (newdecl && !PROCESSING_REAL_TEMPLATE_DECL_P ()) - /* Put this TYPE_DECL on the TYPE_FIELDS list for the - class. But if it's a member template class, we - want the TEMPLATE_DECL, not the TYPE_DECL, so this - is done later. */ - finish_member_declaration (d); - else - pushdecl_class_level (d); - } - else - d = pushdecl_with_scope (d, b); - - if (newdecl) - { - if (ANON_AGGRNAME_P (name)) - DECL_IGNORED_P (d) = 1; - - TYPE_CONTEXT (type) = DECL_CONTEXT (d); - DECL_ASSEMBLER_NAME (d) = DECL_NAME (d); - if (!uses_template_parms (type)) - DECL_ASSEMBLER_NAME (d) - = get_identifier (build_overload_name (type, 1, 1)); - } - } - if (b->parm_flag == 2) - { - if (TYPE_SIZE (current_class_type) == NULL_TREE) - CLASSTYPE_TAGS (current_class_type) = b->tags; - } - } - - if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) - /* Use the canonical TYPE_DECL for this node. */ - TYPE_STUB_DECL (type) = TYPE_NAME (type); - else - { - /* Create a fake NULL-named TYPE_DECL node whose TREE_TYPE - will be the tagged type we just added to the current - binding level. This fake NULL-named TYPE_DECL node helps - dwarfout.c to know when it needs to output a - representation of a tagged type, and it also gives us a - convenient place to record the "scope start" address for - the tagged type. */ - - tree d = build_decl (TYPE_DECL, NULL_TREE, type); - TYPE_STUB_DECL (type) = pushdecl_with_scope (d, b); - } -} - -/* Counter used to create anonymous type names. */ - -static int anon_cnt = 0; - -/* Return an IDENTIFIER which can be used as a name for - anonymous structs and unions. */ - -tree -make_anon_name () -{ - char buf[32]; - - sprintf (buf, ANON_AGGRNAME_FORMAT, anon_cnt++); - return get_identifier (buf); -} - -/* Clear the TREE_PURPOSE slot of tags which have anonymous typenames. - This keeps dbxout from getting confused. */ - -void -clear_anon_tags () -{ - register struct binding_level *b; - register tree tags; - static int last_cnt = 0; - - /* Fast out if no new anon names were declared. */ - if (last_cnt == anon_cnt) - return; - - b = current_binding_level; - while (b->tag_transparent) - b = b->level_chain; - tags = b->tags; - while (tags) - { - /* A NULL purpose means we have already processed all tags - from here to the end of the list. */ - if (TREE_PURPOSE (tags) == NULL_TREE) - break; - if (ANON_AGGRNAME_P (TREE_PURPOSE (tags))) - TREE_PURPOSE (tags) = NULL_TREE; - tags = TREE_CHAIN (tags); - } - last_cnt = anon_cnt; -} - -/* Subroutine of duplicate_decls: return truthvalue of whether - or not types of these decls match. - - For C++, we must compare the parameter list so that `int' can match - `int&' in a parameter position, but `int&' is not confused with - `const int&'. */ - -int -decls_match (newdecl, olddecl) - tree newdecl, olddecl; -{ - int types_match; - - if (newdecl == olddecl) - return 1; - - if (TREE_CODE (newdecl) != TREE_CODE (olddecl)) - /* If the two DECLs are not even the same kind of thing, we're not - interested in their types. */ - return 0; - - if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - tree f1 = TREE_TYPE (newdecl); - tree f2 = TREE_TYPE (olddecl); - tree p1 = TYPE_ARG_TYPES (f1); - tree p2 = TYPE_ARG_TYPES (f2); - - if (DECL_REAL_CONTEXT (newdecl) != DECL_REAL_CONTEXT (olddecl) - && ! (DECL_LANGUAGE (newdecl) == lang_c - && DECL_LANGUAGE (olddecl) == lang_c)) - return 0; - - /* When we parse a static member function definition, - we put together a FUNCTION_DECL which thinks its type - is METHOD_TYPE. Change that to FUNCTION_TYPE, and - proceed. */ - if (TREE_CODE (f1) == METHOD_TYPE && DECL_STATIC_FUNCTION_P (olddecl)) - revert_static_member_fn (&newdecl, &f1, &p1); - else if (TREE_CODE (f2) == METHOD_TYPE - && DECL_STATIC_FUNCTION_P (newdecl)) - revert_static_member_fn (&olddecl, &f2, &p2); - - /* Here we must take care of the case where new default - parameters are specified. Also, warn if an old - declaration becomes ambiguous because default - parameters may cause the two to be ambiguous. */ - if (TREE_CODE (f1) != TREE_CODE (f2)) - { - if (TREE_CODE (f1) == OFFSET_TYPE) - cp_compiler_error ("`%D' redeclared as member function", newdecl); - else - cp_compiler_error ("`%D' redeclared as non-member function", newdecl); - return 0; - } - - if (same_type_p (TREE_TYPE (f1), TREE_TYPE (f2))) - { - if (! strict_prototypes_lang_c && DECL_LANGUAGE (olddecl) == lang_c - && p2 == NULL_TREE) - { - types_match = self_promoting_args_p (p1); - if (p1 == void_list_node) - TREE_TYPE (newdecl) = TREE_TYPE (olddecl); - } - else if (!strict_prototypes_lang_c && DECL_LANGUAGE (olddecl)==lang_c - && DECL_LANGUAGE (newdecl) == lang_c && p1 == NULL_TREE) - { - types_match = self_promoting_args_p (p2); - TREE_TYPE (newdecl) = TREE_TYPE (olddecl); - } - else - types_match = compparms (p1, p2); - } - else - types_match = 0; - } - else if (TREE_CODE (newdecl) == TEMPLATE_DECL) - { - if (!comp_template_parms (DECL_TEMPLATE_PARMS (newdecl), - DECL_TEMPLATE_PARMS (olddecl))) - return 0; - - if (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL) - types_match = 1; - else - types_match = decls_match (DECL_TEMPLATE_RESULT (olddecl), - DECL_TEMPLATE_RESULT (newdecl)); - } - else - { - if (TREE_TYPE (newdecl) == error_mark_node) - types_match = TREE_TYPE (olddecl) == error_mark_node; - else if (TREE_TYPE (olddecl) == NULL_TREE) - types_match = TREE_TYPE (newdecl) == NULL_TREE; - else if (TREE_TYPE (newdecl) == NULL_TREE) - types_match = 0; - else - types_match = comptypes (TREE_TYPE (newdecl), - TREE_TYPE (olddecl), - COMPARE_REDECLARATION); - } - - return types_match; -} - -/* If NEWDECL is `static' and an `extern' was seen previously, - warn about it. (OLDDECL may be NULL_TREE; NAME contains - information about previous usage as an `extern'.) - - Note that this does not apply to the C++ case of declaring - a variable `extern const' and then later `const'. - - Don't complain about built-in functions, since they are beyond - the user's control. */ - -static void -warn_extern_redeclared_static (newdecl, olddecl) - tree newdecl, olddecl; -{ - tree name; - - static const char *explicit_extern_static_warning - = "`%D' was declared `extern' and later `static'"; - static const char *implicit_extern_static_warning - = "`%D' was declared implicitly `extern' and later `static'"; - - if (TREE_CODE (newdecl) == TYPE_DECL) - return; - - name = DECL_ASSEMBLER_NAME (newdecl); - if (TREE_PUBLIC (name) && DECL_THIS_STATIC (newdecl)) - { - /* It's okay to redeclare an ANSI built-in function as static, - or to declare a non-ANSI built-in function as anything. */ - if (! (TREE_CODE (newdecl) == FUNCTION_DECL - && olddecl != NULL_TREE - && TREE_CODE (olddecl) == FUNCTION_DECL - && (DECL_BUILT_IN (olddecl) - || DECL_BUILT_IN_NONANSI (olddecl)))) - { - cp_pedwarn (IDENTIFIER_IMPLICIT_DECL (name) - ? implicit_extern_static_warning - : explicit_extern_static_warning, newdecl); - if (olddecl != NULL_TREE) - cp_pedwarn_at ("previous declaration of `%D'", olddecl); - } - } -} - -/* Handle when a new declaration NEWDECL has the same name as an old - one OLDDECL in the same binding contour. Prints an error message - if appropriate. - - If safely possible, alter OLDDECL to look like NEWDECL, and return 1. - Otherwise, return 0. */ - -int -duplicate_decls (newdecl, olddecl) - tree newdecl, olddecl; -{ - extern struct obstack permanent_obstack; - unsigned olddecl_uid = DECL_UID (olddecl); - int olddecl_friend = 0, types_match = 0; - int new_defines_function = 0; - - if (newdecl == olddecl) - return 1; - - types_match = decls_match (newdecl, olddecl); - - /* If either the type of the new decl or the type of the old decl is an - error_mark_node, then that implies that we have already issued an - error (earlier) for some bogus type specification, and in that case, - it is rather pointless to harass the user with yet more error message - about the same declaration, so just pretend the types match here. */ - if (TREE_TYPE (newdecl) == error_mark_node - || TREE_TYPE (olddecl) == error_mark_node) - types_match = 1; - - /* Check for redeclaration and other discrepancies. */ - if (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_ARTIFICIAL (olddecl) - && (DECL_BUILT_IN (olddecl) || DECL_BUILT_IN_NONANSI (olddecl))) - { - /* If you declare a built-in or predefined function name as static, - the old definition is overridden, but optionally warn this was a - bad choice of name. Ditto for overloads. */ - if (! TREE_PUBLIC (newdecl) - || (TREE_CODE (newdecl) == FUNCTION_DECL - && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl))) - { - if (warn_shadow) - cp_warning ("shadowing %s function `%#D'", - DECL_BUILT_IN (olddecl) ? "built-in" : "library", - olddecl); - /* Discard the old built-in function. */ - return 0; - } - else if (! types_match) - { - if (TREE_CODE (newdecl) != FUNCTION_DECL) - { - /* If the built-in is not ansi, then programs can override - it even globally without an error. */ - if (! DECL_BUILT_IN (olddecl)) - cp_warning ("library function `%#D' redeclared as non-function `%#D'", - olddecl, newdecl); - else - { - cp_error ("declaration of `%#D'", newdecl); - cp_error ("conflicts with built-in declaration `%#D'", - olddecl); - } - return 0; - } - - cp_warning ("declaration of `%#D'", newdecl); - cp_warning ("conflicts with built-in declaration `%#D'", - olddecl); - } - } - else if (TREE_CODE (olddecl) != TREE_CODE (newdecl)) - { - if ((TREE_CODE (olddecl) == TYPE_DECL && DECL_ARTIFICIAL (olddecl) - && TREE_CODE (newdecl) != TYPE_DECL - && ! (TREE_CODE (newdecl) == TEMPLATE_DECL - && TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)) - || (TREE_CODE (newdecl) == TYPE_DECL && DECL_ARTIFICIAL (newdecl) - && TREE_CODE (olddecl) != TYPE_DECL - && ! (TREE_CODE (olddecl) == TEMPLATE_DECL - && (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) - == TYPE_DECL)))) - { - /* We do nothing special here, because C++ does such nasty - things with TYPE_DECLs. Instead, just let the TYPE_DECL - get shadowed, and know that if we need to find a TYPE_DECL - for a given name, we can look in the IDENTIFIER_TYPE_VALUE - slot of the identifier. */ - return 0; - } - - if ((TREE_CODE (newdecl) == FUNCTION_DECL - && DECL_FUNCTION_TEMPLATE_P (olddecl)) - || (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_FUNCTION_TEMPLATE_P (newdecl))) - return 0; - - cp_error ("`%#D' redeclared as different kind of symbol", newdecl); - if (TREE_CODE (olddecl) == TREE_LIST) - olddecl = TREE_VALUE (olddecl); - cp_error_at ("previous declaration of `%#D'", olddecl); - - /* New decl is completely inconsistent with the old one => - tell caller to replace the old one. */ - - return 0; - } - else if (!types_match) - { - if (DECL_REAL_CONTEXT (newdecl) != DECL_REAL_CONTEXT (olddecl)) - /* These are certainly not duplicate declarations; they're - from different scopes. */ - return 0; - - if (TREE_CODE (newdecl) == TEMPLATE_DECL) - { - /* The name of a class template may not be declared to refer to - any other template, class, function, object, namespace, value, - or type in the same scope. */ - if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL - || TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL) - { - cp_error ("declaration of template `%#D'", newdecl); - cp_error_at ("conflicts with previous declaration `%#D'", - olddecl); - } - else if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL - && TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == FUNCTION_DECL - && compparms (TYPE_ARG_TYPES (TREE_TYPE (DECL_TEMPLATE_RESULT (olddecl))), - TYPE_ARG_TYPES (TREE_TYPE (DECL_TEMPLATE_RESULT (newdecl)))) - && comp_template_parms (DECL_TEMPLATE_PARMS (newdecl), - DECL_TEMPLATE_PARMS (olddecl))) - { - cp_error ("new declaration `%#D'", newdecl); - cp_error_at ("ambiguates old declaration `%#D'", olddecl); - } - return 0; - } - if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - if (DECL_LANGUAGE (newdecl) == lang_c - && DECL_LANGUAGE (olddecl) == lang_c) - { - cp_error ("declaration of C function `%#D' conflicts with", - newdecl); - cp_error_at ("previous declaration `%#D' here", olddecl); - } - else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), - TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) - { - cp_error ("new declaration `%#D'", newdecl); - cp_error_at ("ambiguates old declaration `%#D'", olddecl); - } - else - return 0; - } - - /* Already complained about this, so don't do so again. */ - else if (current_class_type == NULL_TREE - || IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (newdecl)) != current_class_type) - { - cp_error ("conflicting types for `%#D'", newdecl); - cp_error_at ("previous declaration as `%#D'", olddecl); - } - } - else if (TREE_CODE (newdecl) == FUNCTION_DECL - && ((DECL_TEMPLATE_SPECIALIZATION (olddecl) - && (!DECL_TEMPLATE_INFO (newdecl) - || (DECL_TI_TEMPLATE (newdecl) - != DECL_TI_TEMPLATE (olddecl)))) - || (DECL_TEMPLATE_SPECIALIZATION (newdecl) - && (!DECL_TEMPLATE_INFO (olddecl) - || (DECL_TI_TEMPLATE (olddecl) - != DECL_TI_TEMPLATE (newdecl)))))) - /* It's OK to have a template specialization and a non-template - with the same type, or to have specializations of two - different templates with the same type. Note that if one is a - specialization, and the other is an instantiation of the same - template, that we do not exit at this point. That situation - can occur if we instantiate a template class, and then - specialize one of its methods. This situation is legal, but - the declarations must be merged in the usual way. */ - return 0; - else if (TREE_CODE (newdecl) == FUNCTION_DECL - && ((DECL_TEMPLATE_INSTANTIATION (olddecl) - && !DECL_USE_TEMPLATE (newdecl)) - || (DECL_TEMPLATE_INSTANTIATION (newdecl) - && !DECL_USE_TEMPLATE (olddecl)))) - /* One of the declarations is a template instantiation, and the - other is not a template at all. That's OK. */ - return 0; - else if (TREE_CODE (newdecl) == NAMESPACE_DECL - && DECL_NAMESPACE_ALIAS (newdecl) - && DECL_NAMESPACE_ALIAS (newdecl) == DECL_NAMESPACE_ALIAS (olddecl)) - /* Redeclaration of namespace alias, ignore it. */ - return 1; - else - { - const char *errmsg = redeclaration_error_message (newdecl, olddecl); - if (errmsg) - { - cp_error (errmsg, newdecl); - if (DECL_NAME (olddecl) != NULL_TREE) - cp_error_at ((DECL_INITIAL (olddecl) - && namespace_bindings_p ()) - ? "`%#D' previously defined here" - : "`%#D' previously declared here", olddecl); - } - else if (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_INITIAL (olddecl) != NULL_TREE - && TYPE_ARG_TYPES (TREE_TYPE (olddecl)) == NULL_TREE - && TYPE_ARG_TYPES (TREE_TYPE (newdecl)) != NULL_TREE) - { - /* Prototype decl follows defn w/o prototype. */ - cp_warning_at ("prototype for `%#D'", newdecl); - cp_warning_at ("follows non-prototype definition here", olddecl); - } - else if (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl)) - { - /* extern "C" int foo (); - int foo () { bar (); } - is OK. */ - if (current_lang_stack == current_lang_base) - DECL_LANGUAGE (newdecl) = DECL_LANGUAGE (olddecl); - else - { - cp_error_at ("previous declaration of `%#D' with %L linkage", - olddecl, DECL_LANGUAGE (olddecl)); - cp_error ("conflicts with new declaration with %L linkage", - DECL_LANGUAGE (newdecl)); - } - } - - if (DECL_LANG_SPECIFIC (olddecl) && DECL_USE_TEMPLATE (olddecl)) - ; - else if (TREE_CODE (olddecl) == FUNCTION_DECL) - { - tree t1 = TYPE_ARG_TYPES (TREE_TYPE (olddecl)); - tree t2 = TYPE_ARG_TYPES (TREE_TYPE (newdecl)); - int i = 1; - - if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE) - t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2); - - for (; t1 && t1 != void_list_node; - t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2), i++) - if (TREE_PURPOSE (t1) && TREE_PURPOSE (t2)) - { - if (1 == simple_cst_equal (TREE_PURPOSE (t1), - TREE_PURPOSE (t2))) - { - if (pedantic) - { - cp_pedwarn ("default argument given for parameter %d of `%#D'", - i, newdecl); - cp_pedwarn_at ("after previous specification in `%#D'", - olddecl); - } - } - else - { - cp_error ("default argument given for parameter %d of `%#D'", - i, newdecl); - cp_error_at ("after previous specification in `%#D'", - olddecl); - } - } - - if (DECL_THIS_INLINE (newdecl) && ! DECL_THIS_INLINE (olddecl) - && TREE_ADDRESSABLE (olddecl) && warn_inline) - { - cp_warning ("`%#D' was used before it was declared inline", - newdecl); - cp_warning_at ("previous non-inline declaration here", - olddecl); - } - } - } - - /* If new decl is `static' and an `extern' was seen previously, - warn about it. */ - warn_extern_redeclared_static (newdecl, olddecl); - - /* We have committed to returning 1 at this point. */ - if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - /* Now that functions must hold information normally held - by field decls, there is extra work to do so that - declaration information does not get destroyed during - definition. */ - if (DECL_VINDEX (olddecl)) - DECL_VINDEX (newdecl) = DECL_VINDEX (olddecl); - if (DECL_CONTEXT (olddecl)) - DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl); - if (DECL_CLASS_CONTEXT (olddecl)) - DECL_CLASS_CONTEXT (newdecl) = DECL_CLASS_CONTEXT (olddecl); - if (DECL_PENDING_INLINE_INFO (newdecl) == (struct pending_inline *)0) - DECL_PENDING_INLINE_INFO (newdecl) = DECL_PENDING_INLINE_INFO (olddecl); - DECL_STATIC_CONSTRUCTOR (newdecl) |= DECL_STATIC_CONSTRUCTOR (olddecl); - DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl); - DECL_ABSTRACT_VIRTUAL_P (newdecl) |= DECL_ABSTRACT_VIRTUAL_P (olddecl); - DECL_VIRTUAL_P (newdecl) |= DECL_VIRTUAL_P (olddecl); - DECL_NEEDS_FINAL_OVERRIDER_P (newdecl) |= DECL_NEEDS_FINAL_OVERRIDER_P (olddecl); - new_defines_function = DECL_INITIAL (newdecl) != NULL_TREE; - - /* Optionally warn about more than one declaration for the same - name, but don't warn about a function declaration followed by a - definition. */ - if (warn_redundant_decls && ! DECL_ARTIFICIAL (olddecl) - && !(new_defines_function && DECL_INITIAL (olddecl) == NULL_TREE) - /* Don't warn about extern decl followed by definition. */ - && !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl)) - /* Don't warn about friends, let add_friend take care of it. */ - && ! DECL_FRIEND_P (newdecl)) - { - cp_warning ("redundant redeclaration of `%D' in same scope", newdecl); - cp_warning_at ("previous declaration of `%D'", olddecl); - } - } - - /* Deal with C++: must preserve virtual function table size. */ - if (TREE_CODE (olddecl) == TYPE_DECL) - { - register tree newtype = TREE_TYPE (newdecl); - register tree oldtype = TREE_TYPE (olddecl); - - if (newtype != error_mark_node && oldtype != error_mark_node - && TYPE_LANG_SPECIFIC (newtype) && TYPE_LANG_SPECIFIC (oldtype)) - { - CLASSTYPE_VSIZE (newtype) = CLASSTYPE_VSIZE (oldtype); - CLASSTYPE_FRIEND_CLASSES (newtype) - = CLASSTYPE_FRIEND_CLASSES (oldtype); - } - } - - /* Copy all the DECL_... slots specified in the new decl - except for any that we copy here from the old type. */ - DECL_MACHINE_ATTRIBUTES (newdecl) - = merge_machine_decl_attributes (olddecl, newdecl); - - if (TREE_CODE (newdecl) == TEMPLATE_DECL) - { - if (! duplicate_decls (DECL_TEMPLATE_RESULT (newdecl), - DECL_TEMPLATE_RESULT (olddecl))) - cp_error ("invalid redeclaration of %D", newdecl); - TREE_TYPE (olddecl) = TREE_TYPE (DECL_TEMPLATE_RESULT (olddecl)); - DECL_TEMPLATE_SPECIALIZATIONS (olddecl) - = chainon (DECL_TEMPLATE_SPECIALIZATIONS (olddecl), - DECL_TEMPLATE_SPECIALIZATIONS (newdecl)); - - return 1; - } - - if (types_match) - { - /* Automatically handles default parameters. */ - tree oldtype = TREE_TYPE (olddecl); - tree newtype; - - /* Make sure we put the new type in the same obstack as the old one. */ - if (oldtype) - push_obstacks (TYPE_OBSTACK (oldtype), TYPE_OBSTACK (oldtype)); - else - { - push_obstacks_nochange (); - end_temporary_allocation (); - } - - /* Merge the data types specified in the two decls. */ - newtype = common_type (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); - - if (TREE_CODE (newdecl) == VAR_DECL) - DECL_THIS_EXTERN (newdecl) |= DECL_THIS_EXTERN (olddecl); - /* Do this after calling `common_type' so that default - parameters don't confuse us. */ - else if (TREE_CODE (newdecl) == FUNCTION_DECL - && (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)) - != TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)))) - { - TREE_TYPE (newdecl) = build_exception_variant (newtype, - TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl))); - TREE_TYPE (olddecl) = build_exception_variant (newtype, - TYPE_RAISES_EXCEPTIONS (oldtype)); - - if ((pedantic || (! DECL_IN_SYSTEM_HEADER (olddecl) - && ! DECL_IN_SYSTEM_HEADER (newdecl))) - && DECL_SOURCE_LINE (olddecl) != 0 - && flag_exceptions - && ! compexcepttypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl))) - { - cp_pedwarn ("declaration of `%D' throws different exceptions", - newdecl); - cp_pedwarn_at ("previous declaration here", olddecl); - } - } - TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype; - - /* Lay the type out, unless already done. */ - if (! same_type_p (newtype, oldtype) - && TREE_TYPE (newdecl) != error_mark_node - && !(processing_template_decl && uses_template_parms (newdecl))) - layout_type (TREE_TYPE (newdecl)); - - if ((TREE_CODE (newdecl) == VAR_DECL - || TREE_CODE (newdecl) == PARM_DECL - || TREE_CODE (newdecl) == RESULT_DECL - || TREE_CODE (newdecl) == FIELD_DECL - || TREE_CODE (newdecl) == TYPE_DECL) - && !(processing_template_decl && uses_template_parms (newdecl))) - layout_decl (newdecl, 0); - - /* Merge the type qualifiers. */ - if (TREE_READONLY (newdecl)) - TREE_READONLY (olddecl) = 1; - if (TREE_THIS_VOLATILE (newdecl)) - TREE_THIS_VOLATILE (olddecl) = 1; - - /* Merge the initialization information. */ - if (DECL_INITIAL (newdecl) == NULL_TREE - && DECL_INITIAL (olddecl) != NULL_TREE) - { - DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); - DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl); - DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl); - if (DECL_LANG_SPECIFIC (newdecl) - && DECL_LANG_SPECIFIC (olddecl)) - DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl); - } - - /* Merge the section attribute. - We want to issue an error if the sections conflict but that must be - done later in decl_attributes since we are called before attributes - are assigned. */ - if (DECL_SECTION_NAME (newdecl) == NULL_TREE) - DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl); - - /* Keep the old rtl since we can safely use it, unless it's the - call to abort() used for abstract virtuals. */ - if ((DECL_LANG_SPECIFIC (olddecl) - && !DECL_ABSTRACT_VIRTUAL_P (olddecl)) - || DECL_RTL (olddecl) != DECL_RTL (abort_fndecl)) - DECL_RTL (newdecl) = DECL_RTL (olddecl); - - pop_obstacks (); - } - /* If cannot merge, then use the new type and qualifiers, - and don't preserve the old rtl. */ - else - { - /* Clean out any memory we had of the old declaration. */ - tree oldstatic = value_member (olddecl, static_aggregates); - if (oldstatic) - TREE_VALUE (oldstatic) = error_mark_node; - - TREE_TYPE (olddecl) = TREE_TYPE (newdecl); - TREE_READONLY (olddecl) = TREE_READONLY (newdecl); - TREE_THIS_VOLATILE (olddecl) = TREE_THIS_VOLATILE (newdecl); - TREE_SIDE_EFFECTS (olddecl) = TREE_SIDE_EFFECTS (newdecl); - } - - /* Merge the storage class information. */ - DECL_WEAK (newdecl) |= DECL_WEAK (olddecl); - DECL_ONE_ONLY (newdecl) |= DECL_ONE_ONLY (olddecl); - TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl); - TREE_STATIC (olddecl) = TREE_STATIC (newdecl) |= TREE_STATIC (olddecl); - if (! DECL_EXTERNAL (olddecl)) - DECL_EXTERNAL (newdecl) = 0; - - if (DECL_LANG_SPECIFIC (newdecl) && DECL_LANG_SPECIFIC (olddecl)) - { - DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl); - DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl); - DECL_COMDAT (newdecl) |= DECL_COMDAT (olddecl); - DECL_TEMPLATE_INSTANTIATED (newdecl) - |= DECL_TEMPLATE_INSTANTIATED (olddecl); - /* Don't really know how much of the language-specific - values we should copy from old to new. */ - DECL_IN_AGGR_P (newdecl) = DECL_IN_AGGR_P (olddecl); - DECL_ACCESS (newdecl) = DECL_ACCESS (olddecl); - DECL_NONCONVERTING_P (newdecl) = DECL_NONCONVERTING_P (olddecl); - DECL_TEMPLATE_INFO (newdecl) = DECL_TEMPLATE_INFO (olddecl); - olddecl_friend = DECL_FRIEND_P (olddecl); - - /* Only functions have DECL_BEFRIENDING_CLASSES. */ - if (TREE_CODE (newdecl) == FUNCTION_DECL - || DECL_FUNCTION_TEMPLATE_P (newdecl)) - DECL_BEFRIENDING_CLASSES (newdecl) - = chainon (DECL_BEFRIENDING_CLASSES (newdecl), - DECL_BEFRIENDING_CLASSES (olddecl)); - } - - if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - if (DECL_TEMPLATE_INSTANTIATION (olddecl) - && !DECL_TEMPLATE_INSTANTIATION (newdecl)) - { - /* If newdecl is not a specialization, then it is not a - template-related function at all. And that means that we - shoud have exited above, returning 0. */ - my_friendly_assert (DECL_TEMPLATE_SPECIALIZATION (newdecl), - 0); - - if (TREE_USED (olddecl)) - /* From [temp.expl.spec]: - - If a template, a member template or the member of a class - template is explicitly specialized then that - specialization shall be declared before the first use of - that specialization that would cause an implicit - instantiation to take place, in every translation unit in - which such a use occurs. */ - cp_error ("explicit specialization of %D after first use", - olddecl); - - SET_DECL_TEMPLATE_SPECIALIZATION (olddecl); - } - DECL_THIS_INLINE (newdecl) |= DECL_THIS_INLINE (olddecl); - - /* If either decl says `inline', this fn is inline, unless its - definition was passed already. */ - if (DECL_INLINE (newdecl) && DECL_INITIAL (olddecl) == NULL_TREE) - DECL_INLINE (olddecl) = 1; - DECL_INLINE (newdecl) = DECL_INLINE (olddecl); - - if (! types_match) - { - DECL_LANGUAGE (olddecl) = DECL_LANGUAGE (newdecl); - DECL_ASSEMBLER_NAME (olddecl) = DECL_ASSEMBLER_NAME (newdecl); - DECL_RTL (olddecl) = DECL_RTL (newdecl); - } - if (! types_match || new_defines_function) - { - /* These need to be copied so that the names are available. */ - DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl); - DECL_RESULT (olddecl) = DECL_RESULT (newdecl); - } - if (new_defines_function) - /* If defining a function declared with other language - linkage, use the previously declared language linkage. */ - DECL_LANGUAGE (newdecl) = DECL_LANGUAGE (olddecl); - else - { - /* If redeclaring a builtin function, and not a definition, - it stays built in. */ - if (DECL_BUILT_IN (olddecl)) - { - DECL_BUILT_IN (newdecl) = 1; - DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl); - /* If we're keeping the built-in definition, keep the rtl, - regardless of declaration matches. */ - DECL_RTL (newdecl) = DECL_RTL (olddecl); - } - else - DECL_FRAME_SIZE (newdecl) = DECL_FRAME_SIZE (olddecl); - - DECL_RESULT (newdecl) = DECL_RESULT (olddecl); - if ((DECL_SAVED_INSNS (newdecl) = DECL_SAVED_INSNS (olddecl))) - /* Previously saved insns go together with - the function's previous definition. */ - DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); - /* Don't clear out the arguments if we're redefining a function. */ - if (DECL_ARGUMENTS (olddecl)) - DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl); - } - if (DECL_LANG_SPECIFIC (olddecl)) - DECL_MAIN_VARIANT (newdecl) = DECL_MAIN_VARIANT (olddecl); - } - - if (TREE_CODE (newdecl) == NAMESPACE_DECL) - { - NAMESPACE_LEVEL (newdecl) = NAMESPACE_LEVEL (olddecl); - } - - /* Now preserve various other info from the definition. */ - TREE_ADDRESSABLE (newdecl) = TREE_ADDRESSABLE (olddecl); - TREE_ASM_WRITTEN (newdecl) = TREE_ASM_WRITTEN (olddecl); - DECL_COMMON (newdecl) = DECL_COMMON (olddecl); - DECL_ASSEMBLER_NAME (newdecl) = DECL_ASSEMBLER_NAME (olddecl); - - if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - int function_size; - struct lang_decl *ol = DECL_LANG_SPECIFIC (olddecl); - struct lang_decl *nl = DECL_LANG_SPECIFIC (newdecl); - - function_size = sizeof (struct tree_decl); - - bcopy ((char *) newdecl + sizeof (struct tree_common), - (char *) olddecl + sizeof (struct tree_common), - function_size - sizeof (struct tree_common)); - - /* Can we safely free the storage used by newdecl? */ - -#define ROUND(x) ((x + obstack_alignment_mask (&permanent_obstack)) \ - & ~ obstack_alignment_mask (&permanent_obstack)) - - if (DECL_TEMPLATE_INSTANTIATION (newdecl)) - { - /* If newdecl is a template instantiation, it is possible that - the following sequence of events has occurred: - - o A friend function was declared in a class template. The - class template was instantiated. - - o The instantiation of the friend declaration was - recorded on the instantiation list, and is newdecl. - - o Later, however, instantiate_class_template called pushdecl - on the newdecl to perform name injection. But, pushdecl in - turn called duplicate_decls when it discovered that another - declaration of a global function with the same name already - existed. - - o Here, in duplicate_decls, we decided to clobber newdecl. - - If we're going to do that, we'd better make sure that - olddecl, and not newdecl, is on the list of - instantiations so that if we try to do the instantiation - again we won't get the clobbered declaration. */ - - tree tmpl = DECL_TI_TEMPLATE (newdecl); - tree decls = DECL_TEMPLATE_SPECIALIZATIONS (tmpl); - - for (; decls; decls = TREE_CHAIN (decls)) - if (TREE_VALUE (decls) == newdecl) - TREE_VALUE (decls) = olddecl; - } - - if (((char *)newdecl + ROUND (function_size) == (char *)nl - && ((char *)newdecl + ROUND (function_size) - + ROUND (sizeof (struct lang_decl)) - == obstack_next_free (&permanent_obstack))) - || ((char *)newdecl + ROUND (function_size) - == obstack_next_free (&permanent_obstack))) - { - DECL_MAIN_VARIANT (newdecl) = olddecl; - DECL_LANG_SPECIFIC (olddecl) = ol; - bcopy ((char *)nl, (char *)ol, sizeof (struct lang_decl)); - - obstack_free (&permanent_obstack, newdecl); - } - else if (LANG_DECL_PERMANENT (ol) && ol != nl) - { - if (DECL_MAIN_VARIANT (olddecl) == olddecl) - { - /* Save these lang_decls that would otherwise be lost. */ - extern tree free_lang_decl_chain; - tree free_lang_decl = (tree) ol; - - if (DECL_LANG_SPECIFIC (olddecl) == ol) - abort (); - - TREE_CHAIN (free_lang_decl) = free_lang_decl_chain; - free_lang_decl_chain = free_lang_decl; - } - else - { - /* Storage leak. */; - } - } - } - else - { - bcopy ((char *) newdecl + sizeof (struct tree_common), - (char *) olddecl + sizeof (struct tree_common), - sizeof (struct tree_decl) - sizeof (struct tree_common) - + tree_code_length [(int)TREE_CODE (newdecl)] * sizeof (char *)); - } - - DECL_UID (olddecl) = olddecl_uid; - if (olddecl_friend) - DECL_FRIEND_P (olddecl) = 1; - - /* NEWDECL contains the merged attribute lists. - Update OLDDECL to be the same. */ - DECL_MACHINE_ATTRIBUTES (olddecl) = DECL_MACHINE_ATTRIBUTES (newdecl); - - return 1; -} - -/* Record a decl-node X as belonging to the current lexical scope. - Check for errors (such as an incompatible declaration for the same - name already seen in the same scope). - - Returns either X or an old decl for the same name. - If an old decl is returned, it may have been smashed - to agree with what X says. */ - -tree -pushdecl (x) - tree x; -{ - register tree t; - register tree name = DECL_ASSEMBLER_NAME (x); - int need_new_binding = 1; - - if (DECL_TEMPLATE_PARM_P (x)) - /* Template parameters have no context; they are not X::T even - when declared within a class or namespace. */ - ; - else - { - if (current_function_decl && x != current_function_decl - /* A local declaration for a function doesn't constitute - nesting. */ - && (TREE_CODE (x) != FUNCTION_DECL || DECL_INITIAL (x)) - /* Don't change DECL_CONTEXT of virtual methods. */ - && (TREE_CODE (x) != FUNCTION_DECL || !DECL_VIRTUAL_P (x)) - && !DECL_CONTEXT (x)) - DECL_CONTEXT (x) = current_function_decl; - if (!DECL_CONTEXT (x)) - DECL_CONTEXT (x) = FROB_CONTEXT (current_namespace); - } - - /* Type are looked up using the DECL_NAME, as that is what the rest of the - compiler wants to use. */ - if (TREE_CODE (x) == TYPE_DECL || TREE_CODE (x) == VAR_DECL - || TREE_CODE (x) == NAMESPACE_DECL) - name = DECL_NAME (x); - - if (name) - { -#if 0 - /* Not needed...see below. */ - char *file; - int line; -#endif - if (TREE_CODE (name) == TEMPLATE_ID_EXPR) - name = TREE_OPERAND (name, 0); - - /* Namespace-scoped variables are not found in the current level. */ - if (TREE_CODE (x) == VAR_DECL && DECL_NAMESPACE_SCOPE_P (x)) - t = namespace_binding (name, DECL_CONTEXT (x)); - else - t = lookup_name_current_level (name); - if (t == error_mark_node) - { - /* error_mark_node is 0 for a while during initialization! */ - t = NULL_TREE; - cp_error_at ("`%#D' used prior to declaration", x); - } - - else if (t != NULL_TREE) - { -#if 0 - /* This is turned off until I have time to do it right (bpk). */ - /* With the code below that uses it... */ - file = DECL_SOURCE_FILE (t); - line = DECL_SOURCE_LINE (t); -#endif - if (TREE_CODE (t) == PARM_DECL) - { - if (DECL_CONTEXT (t) == NULL_TREE) - fatal ("parse errors have confused me too much"); - - /* Check for duplicate params. */ - if (duplicate_decls (x, t)) - return t; - } - else if (((TREE_CODE (x) == FUNCTION_DECL && DECL_LANGUAGE (x) == lang_c) - || DECL_FUNCTION_TEMPLATE_P (x)) - && is_overloaded_fn (t)) - /* Don't do anything just yet. */; - else if (t == wchar_decl_node) - { - if (pedantic && ! DECL_IN_SYSTEM_HEADER (x)) - cp_pedwarn ("redeclaration of wchar_t as `%T'", TREE_TYPE (x)); - - /* Throw away the redeclaration. */ - return t; - } - else if (TREE_CODE (t) != TREE_CODE (x)) - { - if (duplicate_decls (x, t)) - return t; - } - else if (duplicate_decls (x, t)) - { -#if 0 - /* This is turned off until I have time to do it right (bpk). */ - - /* Also warn if they did a prototype with `static' on it, but - then later left the `static' off. */ - if (! TREE_PUBLIC (name) && TREE_PUBLIC (x)) - { - if (DECL_LANG_SPECIFIC (t) && DECL_FRIEND_P (t)) - return t; - - if (extra_warnings) - { - cp_warning ("`static' missing from declaration of `%D'", - t); - warning_with_file_and_line (file, line, - "previous declaration of `%s'", - decl_as_string (t, 0)); - } - - /* Now fix things so it'll do what they expect. */ - if (current_function_decl) - TREE_PUBLIC (current_function_decl) = 0; - } - /* Due to interference in memory reclamation (X may be - obstack-deallocated at this point), we must guard against - one really special case. [jason: This should be handled - by start_function] */ - if (current_function_decl == x) - current_function_decl = t; -#endif - if (TREE_CODE (t) == TYPE_DECL) - SET_IDENTIFIER_TYPE_VALUE (name, TREE_TYPE (t)); - else if (TREE_CODE (t) == FUNCTION_DECL) - check_default_args (t); - - return t; - } - else if (DECL_MAIN_P (x)) - { - /* A redeclaration of main, but not a duplicate of the - previous one. - - [basic.start.main] - - This function shall not be overloaded. */ - cp_error_at ("invalid redeclaration of `%D'", t); - cp_error ("as `%D'", x); - /* We don't try to push this declaration since that - causes a crash. */ - return x; - } - } - - check_template_shadow (x); - - /* If this is a function conjured up by the backend, massage it - so it looks friendly. */ - if (TREE_CODE (x) == FUNCTION_DECL - && ! DECL_LANG_SPECIFIC (x)) - { - retrofit_lang_decl (x); - DECL_LANGUAGE (x) = lang_c; - } - - if (TREE_CODE (x) == FUNCTION_DECL && ! DECL_FUNCTION_MEMBER_P (x)) - { - t = push_overloaded_decl (x, PUSH_LOCAL); - if (t != x || DECL_LANGUAGE (x) == lang_c) - return t; - if (!namespace_bindings_p ()) - /* We do not need to create a binding for this name; - push_overloaded_decl will have already done so if - necessary. */ - need_new_binding = 0; - } - else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_NAMESPACE_SCOPE_P (x)) - return push_overloaded_decl (x, PUSH_GLOBAL); - - /* If declaring a type as a typedef, copy the type (unless we're - at line 0), and install this TYPE_DECL as the new type's typedef - name. See the extensive comment in ../c-decl.c (pushdecl). */ - if (TREE_CODE (x) == TYPE_DECL) - { - tree type = TREE_TYPE (x); - if (DECL_SOURCE_LINE (x) == 0) - { - if (TYPE_NAME (type) == 0) - TYPE_NAME (type) = x; - } - else if (type != error_mark_node && TYPE_NAME (type) != x - /* We don't want to copy the type when all we're - doing is making a TYPE_DECL for the purposes of - inlining. */ - && (!TYPE_NAME (type) - || TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x))) - { - push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type)); - - DECL_ORIGINAL_TYPE (x) = type; - type = build_type_copy (type); - TYPE_STUB_DECL (type) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x)); - TYPE_NAME (type) = x; - TREE_TYPE (x) = type; - - pop_obstacks (); - } - - if (type != error_mark_node - && TYPE_NAME (type) - && TYPE_IDENTIFIER (type)) - set_identifier_type_value_with_scope (DECL_NAME (x), type, - current_binding_level); - - } - - /* Multiple external decls of the same identifier ought to match. - - We get warnings about inline functions where they are defined. - We get warnings about other functions from push_overloaded_decl. - - Avoid duplicate warnings where they are used. */ - if (TREE_PUBLIC (x) && TREE_CODE (x) != FUNCTION_DECL) - { - tree decl; - - if (IDENTIFIER_NAMESPACE_VALUE (name) != NULL_TREE - && (DECL_EXTERNAL (IDENTIFIER_NAMESPACE_VALUE (name)) - || TREE_PUBLIC (IDENTIFIER_NAMESPACE_VALUE (name)))) - decl = IDENTIFIER_NAMESPACE_VALUE (name); - else - decl = NULL_TREE; - - if (decl - /* If different sort of thing, we already gave an error. */ - && TREE_CODE (decl) == TREE_CODE (x) - && !same_type_p (TREE_TYPE (x), TREE_TYPE (decl))) - { - cp_pedwarn ("type mismatch with previous external decl", x); - cp_pedwarn_at ("previous external decl of `%#D'", decl); - } - } - - /* This name is new in its binding level. - Install the new declaration and return it. */ - if (namespace_bindings_p ()) - { - /* Install a global value. */ - - /* If the first global decl has external linkage, - warn if we later see static one. */ - if (IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE && TREE_PUBLIC (x)) - TREE_PUBLIC (name) = 1; - - if (!(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x) - && t != NULL_TREE)) - { - if (TREE_CODE (x) == FUNCTION_DECL) - my_friendly_assert - ((IDENTIFIER_GLOBAL_VALUE (name) == NULL_TREE) - || (IDENTIFIER_GLOBAL_VALUE (name) == x), 378); - SET_IDENTIFIER_NAMESPACE_VALUE (name, x); - } - - /* Don't forget if the function was used via an implicit decl. */ - if (IDENTIFIER_IMPLICIT_DECL (name) - && TREE_USED (IDENTIFIER_IMPLICIT_DECL (name))) - TREE_USED (x) = 1; - - /* Don't forget if its address was taken in that way. */ - if (IDENTIFIER_IMPLICIT_DECL (name) - && TREE_ADDRESSABLE (IDENTIFIER_IMPLICIT_DECL (name))) - TREE_ADDRESSABLE (x) = 1; - - /* Warn about mismatches against previous implicit decl. */ - if (IDENTIFIER_IMPLICIT_DECL (name) != NULL_TREE - /* If this real decl matches the implicit, don't complain. */ - && ! (TREE_CODE (x) == FUNCTION_DECL - && TREE_TYPE (TREE_TYPE (x)) == integer_type_node)) - cp_warning - ("`%D' was previously implicitly declared to return `int'", x); - - /* If new decl is `static' and an `extern' was seen previously, - warn about it. */ - if (x != NULL_TREE && t != NULL_TREE && decls_match (x, t)) - warn_extern_redeclared_static (x, t); - } - else - { - /* Here to install a non-global value. */ - tree oldlocal = IDENTIFIER_VALUE (name); - tree oldglobal = IDENTIFIER_NAMESPACE_VALUE (name); - - if (need_new_binding) - { - push_local_binding (name, x, 0); - /* Because push_local_binding will hook X on to the - current_binding_level's name list, we don't want to - do that again below. */ - need_new_binding = 0; - } - - /* If this is a TYPE_DECL, push it into the type value slot. */ - if (TREE_CODE (x) == TYPE_DECL) - set_identifier_type_value_with_scope (name, TREE_TYPE (x), - current_binding_level); - - /* Clear out any TYPE_DECL shadowed by a namespace so that - we won't think this is a type. The C struct hack doesn't - go through namespaces. */ - if (TREE_CODE (x) == NAMESPACE_DECL) - set_identifier_type_value_with_scope (name, NULL_TREE, - current_binding_level); - - /* If this is an extern function declaration, see if we - have a global definition or declaration for the function. */ - if (oldlocal == NULL_TREE - && DECL_EXTERNAL (x) - && oldglobal != NULL_TREE - && TREE_CODE (x) == FUNCTION_DECL - && TREE_CODE (oldglobal) == FUNCTION_DECL) - { - /* We have one. Their types must agree. */ - if (decls_match (x, oldglobal)) - /* OK */; - else - { - cp_warning ("extern declaration of `%#D' doesn't match", x); - cp_warning_at ("global declaration `%#D'", oldglobal); - } - } - /* If we have a local external declaration, - and no file-scope declaration has yet been seen, - then if we later have a file-scope decl it must not be static. */ - if (oldlocal == NULL_TREE - && oldglobal == NULL_TREE - && DECL_EXTERNAL (x) - && TREE_PUBLIC (x)) - TREE_PUBLIC (name) = 1; - - if (DECL_FROM_INLINE (x)) - /* Inline decls shadow nothing. */; - - /* Warn if shadowing an argument at the top level of the body. */ - else if (oldlocal != NULL_TREE && !DECL_EXTERNAL (x) - && TREE_CODE (oldlocal) == PARM_DECL - /* Don't complain if it's from an enclosing function. */ - && DECL_CONTEXT (oldlocal) == current_function_decl - && TREE_CODE (x) != PARM_DECL) - { - /* Go to where the parms should be and see if we - find them there. */ - struct binding_level *b = current_binding_level->level_chain; - - if (cleanup_label) - b = b->level_chain; - - /* ARM $8.3 */ - if (b->parm_flag == 1) - cp_error ("declaration of `%#D' shadows a parameter", name); - } - else if (warn_shadow && oldlocal != NULL_TREE - && current_binding_level->is_for_scope - && !DECL_DEAD_FOR_LOCAL (oldlocal)) - { - warning ("variable `%s' shadows local", - IDENTIFIER_POINTER (name)); - cp_warning_at (" this is the shadowed declaration", oldlocal); - } - /* Maybe warn if shadowing something else. */ - else if (warn_shadow && !DECL_EXTERNAL (x) - /* No shadow warnings for internally generated vars. */ - && ! DECL_ARTIFICIAL (x) - /* No shadow warnings for vars made for inlining. */ - && ! DECL_FROM_INLINE (x)) - { - const char *warnstring = NULL; - - if (oldlocal != NULL_TREE && TREE_CODE (oldlocal) == PARM_DECL) - warnstring = "declaration of `%s' shadows a parameter"; - else if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE - && current_class_ptr - && !TREE_STATIC (name)) - warnstring = "declaration of `%s' shadows a member of `this'"; - else if (oldlocal != NULL_TREE) - warnstring = "declaration of `%s' shadows previous local"; - else if (oldglobal != NULL_TREE) - /* XXX shadow warnings in outer-more namespaces */ - warnstring = "declaration of `%s' shadows global declaration"; - - if (warnstring) - warning (warnstring, IDENTIFIER_POINTER (name)); - } - } - - if (TREE_CODE (x) == FUNCTION_DECL) - check_default_args (x); - - /* Keep count of variables in this level with incomplete type. */ - if (TREE_CODE (x) == VAR_DECL - && TREE_TYPE (x) != error_mark_node - && ((TYPE_SIZE (TREE_TYPE (x)) == NULL_TREE - && PROMOTES_TO_AGGR_TYPE (TREE_TYPE (x), ARRAY_TYPE)) - /* RTTI TD entries are created while defining the type_info. */ - || (TYPE_LANG_SPECIFIC (TREE_TYPE (x)) - && TYPE_BEING_DEFINED (TREE_TYPE (x))))) - current_binding_level->incomplete - = tree_cons (NULL_TREE, x, current_binding_level->incomplete); - } - - if (need_new_binding) - { - /* Put decls on list in reverse order. - We will reverse them later if necessary. */ - TREE_CHAIN (x) = current_binding_level->names; - current_binding_level->names = x; - if (current_binding_level == global_binding_level - && !TREE_PERMANENT (x)) - my_friendly_abort (124); - } - - return x; -} - -/* Same as pushdecl, but define X in binding-level LEVEL. We rely on the - caller to set DECL_CONTEXT properly. */ - -static tree -pushdecl_with_scope (x, level) - tree x; - struct binding_level *level; -{ - register struct binding_level *b; - tree function_decl = current_function_decl; - - current_function_decl = NULL_TREE; - if (level->parm_flag == 2) - { - b = class_binding_level; - class_binding_level = level; - pushdecl_class_level (x); - class_binding_level = b; - } - else - { - b = current_binding_level; - current_binding_level = level; - x = pushdecl (x); - current_binding_level = b; - } - current_function_decl = function_decl; - return x; -} - -/* Like pushdecl, only it places X in the current namespace, - if appropriate. */ - -tree -pushdecl_namespace_level (x) - tree x; -{ - register struct binding_level *b = current_binding_level; - register tree t; - - t = pushdecl_with_scope (x, NAMESPACE_LEVEL (current_namespace)); - - /* Now, the type_shadowed stack may screw us. Munge it so it does - what we want. */ - if (TREE_CODE (x) == TYPE_DECL) - { - tree name = DECL_NAME (x); - tree newval; - tree *ptr = (tree *)0; - for (; b != global_binding_level; b = b->level_chain) - { - tree shadowed = b->type_shadowed; - for (; shadowed; shadowed = TREE_CHAIN (shadowed)) - if (TREE_PURPOSE (shadowed) == name) - { - ptr = &TREE_VALUE (shadowed); - /* Can't break out of the loop here because sometimes - a binding level will have duplicate bindings for - PT names. It's gross, but I haven't time to fix it. */ - } - } - newval = TREE_TYPE (x); - if (ptr == (tree *)0) - { - /* @@ This shouldn't be needed. My test case "zstring.cc" trips - up here if this is changed to an assertion. --KR */ - SET_IDENTIFIER_TYPE_VALUE (name, newval); - } - else - { - *ptr = newval; - } - } - return t; -} - -/* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL, - if appropriate. */ - -tree -pushdecl_top_level (x) - tree x; -{ - tree cur_namespace = current_namespace; - current_namespace = global_namespace; - x = pushdecl_namespace_level (x); - current_namespace = cur_namespace; - return x; -} - -/* Make the declaration of X appear in CLASS scope. */ - -void -pushdecl_class_level (x) - tree x; -{ - /* Don't use DECL_ASSEMBLER_NAME here! Everything that looks in class - scope looks for the pre-mangled name. */ - register tree name; - - if (TREE_CODE (x) == OVERLOAD) - x = OVL_CURRENT (x); - name = DECL_NAME (x); - - if (name) - { - push_class_level_binding (name, x); - if (TREE_CODE (x) == TYPE_DECL) - set_identifier_type_value (name, TREE_TYPE (x)); - } - else if (ANON_UNION_TYPE_P (TREE_TYPE (x))) - { - tree f; - - for (f = TYPE_FIELDS (TREE_TYPE (x)); - f; - f = TREE_CHAIN (f)) - pushdecl_class_level (f); - } -} - -#if 0 -/* This function is used to push the mangled decls for nested types into - the appropriate scope. Previously pushdecl_top_level was used, but that - is incorrect for members of local classes. */ - -void -pushdecl_nonclass_level (x) - tree x; -{ - struct binding_level *b = current_binding_level; - - my_friendly_assert (b->parm_flag != 2, 180); - -#if 0 - /* Get out of template binding levels */ - while (b->pseudo_global) - b = b->level_chain; -#endif - - pushdecl_with_scope (x, b); -} -#endif - -/* Make the declaration(s) of X appear in CLASS scope - under the name NAME. */ - -void -push_class_level_binding (name, x) - tree name; - tree x; -{ - tree binding; - /* The class_binding_level will be NULL if x is a template - parameter name in a member template. */ - if (!class_binding_level) - return; - - /* Make sure that this new member does not have the same name - as a template parameter. */ - if (TYPE_BEING_DEFINED (current_class_type)) - check_template_shadow (x); - - /* If this declaration shadows a declaration from an enclosing - class, then we will need to restore IDENTIFIER_CLASS_VALUE when - we leave this class. Record the shadowed declaration here. */ - binding = IDENTIFIER_BINDING (name); - if (binding - && ((TREE_CODE (x) == OVERLOAD - && BINDING_VALUE (binding) - && is_overloaded_fn (BINDING_VALUE (binding))) - || INHERITED_VALUE_BINDING_P (binding))) - { - tree shadow; - tree old_decl; - - /* If the old binding was from a base class, and was for a tag - name, slide it over to make room for the new binding. The - old binding is still visible if explicitly qualified with a - class-key. */ - if (INHERITED_VALUE_BINDING_P (binding) - && BINDING_VALUE (binding) - && TREE_CODE (BINDING_VALUE (binding)) == TYPE_DECL - && DECL_ARTIFICIAL (BINDING_VALUE (binding)) - && !(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x))) - { - old_decl = BINDING_TYPE (binding); - BINDING_TYPE (binding) = BINDING_VALUE (binding); - BINDING_VALUE (binding) = NULL_TREE; - INHERITED_VALUE_BINDING_P (binding) = 0; - } - else - old_decl = BINDING_VALUE (binding); - - /* There was already a binding for X containing fewer - functions than are named in X. Find the previous - declaration of X on the class-shadowed list, and update it. */ - for (shadow = class_binding_level->class_shadowed; - shadow; - shadow = TREE_CHAIN (shadow)) - if (TREE_PURPOSE (shadow) == name - && TREE_TYPE (shadow) == old_decl) - { - BINDING_VALUE (binding) = x; - INHERITED_VALUE_BINDING_P (binding) = 0; - TREE_TYPE (shadow) = x; - return; - } - } - - /* If we didn't replace an existing binding, put the binding on the - stack of bindings for the identifier, and update - IDENTIFIER_CLASS_VALUE. */ - if (push_class_binding (name, x)) - { - push_cache_obstack (); - class_binding_level->class_shadowed - = tree_cons (name, IDENTIFIER_CLASS_VALUE (name), - class_binding_level->class_shadowed); - pop_obstacks (); - /* Record the value we are binding NAME to so that we can know - what to pop later. */ - TREE_TYPE (class_binding_level->class_shadowed) = x; - } -} - -/* Insert another USING_DECL into the current binding level, - returning this declaration. If this is a redeclaration, - do nothing and return NULL_TREE. */ - -tree -push_using_decl (scope, name) - tree scope; - tree name; -{ - tree decl; - - my_friendly_assert (TREE_CODE (scope) == NAMESPACE_DECL, 383); - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 384); - for (decl = current_binding_level->usings; decl; decl = TREE_CHAIN (decl)) - if (DECL_INITIAL (decl) == scope && DECL_NAME (decl) == name) - break; - if (decl) - return NULL_TREE; - decl = build_lang_decl (USING_DECL, name, void_type_node); - DECL_INITIAL (decl) = scope; - TREE_CHAIN (decl) = current_binding_level->usings; - current_binding_level->usings = decl; - return decl; -} - -/* Add namespace to using_directives. Return NULL_TREE if nothing was - changed (i.e. there was already a directive), or the fresh - TREE_LIST otherwise. */ - -tree -push_using_directive (used) - tree used; -{ - tree ud = current_binding_level->using_directives; - tree iter, ancestor; - - /* Check if we already have this. */ - if (purpose_member (used, ud) != NULL_TREE) - return NULL_TREE; - - /* Recursively add all namespaces used. */ - for (iter = DECL_NAMESPACE_USING (used); iter; iter = TREE_CHAIN (iter)) - push_using_directive (TREE_PURPOSE (iter)); - - ancestor = namespace_ancestor (current_decl_namespace (), used); - ud = current_binding_level->using_directives; - ud = perm_tree_cons (used, ancestor, ud); - current_binding_level->using_directives = ud; - return ud; -} - -/* DECL is a FUNCTION_DECL for a non-member function, which may have - other definitions already in place. We get around this by making - the value of the identifier point to a list of all the things that - want to be referenced by that name. It is then up to the users of - that name to decide what to do with that list. - - DECL may also be a TEMPLATE_DECL, with a FUNCTION_DECL in its DECL_RESULT - slot. It is dealt with the same way. - - FLAGS is a bitwise-or of the following values: - PUSH_LOCAL: Bind DECL in the current scope, rather than at - namespace scope. - PUSH_USING: DECL is being pushed as the result of a using - declaration. - - The value returned may be a previous declaration if we guessed wrong - about what language DECL should belong to (C or C++). Otherwise, - it's always DECL (and never something that's not a _DECL). */ - -tree -push_overloaded_decl (decl, flags) - tree decl; - int flags; -{ - tree name = DECL_NAME (decl); - tree old; - tree new_binding; - int doing_global = (namespace_bindings_p () || !(flags & PUSH_LOCAL)); - - if (doing_global) - { - old = namespace_binding (name, DECL_CONTEXT (decl)); - if (old && TREE_CODE (old) == FUNCTION_DECL - && DECL_ARTIFICIAL (old) - && (DECL_BUILT_IN (old) || DECL_BUILT_IN_NONANSI (old))) - { - if (duplicate_decls (decl, old)) - return old; - old = NULL_TREE; - } - } - else - old = lookup_name_current_level (name); - - if (old) - { - if (TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old)) - { - tree t = TREE_TYPE (old); - if (IS_AGGR_TYPE (t) && warn_shadow - && (! DECL_IN_SYSTEM_HEADER (decl) - || ! DECL_IN_SYSTEM_HEADER (old))) - cp_warning ("`%#D' hides constructor for `%#T'", decl, t); - old = NULL_TREE; - } - else if (is_overloaded_fn (old)) - { - tree tmp; - - for (tmp = old; tmp; tmp = OVL_NEXT (tmp)) - { - tree fn = OVL_CURRENT (tmp); - - if (TREE_CODE (tmp) == OVERLOAD && OVL_USED (tmp) - && !(flags & PUSH_USING) - && compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)), - TYPE_ARG_TYPES (TREE_TYPE (decl)))) - cp_error ("`%#D' conflicts with previous using declaration `%#D'", - decl, fn); - - if (duplicate_decls (decl, fn)) - return fn; - } - } - else - { - cp_error_at ("previous non-function declaration `%#D'", old); - cp_error ("conflicts with function declaration `%#D'", decl); - return decl; - } - } - - if (old || TREE_CODE (decl) == TEMPLATE_DECL) - { - if (old && TREE_CODE (old) != OVERLOAD) - new_binding = ovl_cons (decl, ovl_cons (old, NULL_TREE)); - else - new_binding = ovl_cons (decl, old); - if (flags & PUSH_USING) - OVL_USED (new_binding) = 1; - } - else - /* NAME is not ambiguous. */ - new_binding = decl; - - if (doing_global) - set_namespace_binding (name, current_namespace, new_binding); - else - { - /* We only create an OVERLOAD if there was a previous binding at - this level, or if decl is a template. In the former case, we - need to remove the old binding and replace it with the new - binding. We must also run through the NAMES on the binding - level where the name was bound to update the chain. */ - - if (TREE_CODE (new_binding) == OVERLOAD && old) - { - tree *d; - - for (d = &BINDING_LEVEL (IDENTIFIER_BINDING (name))->names; - *d; - d = &TREE_CHAIN (*d)) - if (*d == old - || (TREE_CODE (*d) == TREE_LIST - && TREE_VALUE (*d) == old)) - { - if (TREE_CODE (*d) == TREE_LIST) - /* Just replace the old binding with the new. */ - TREE_VALUE (*d) = new_binding; - else - /* Build a TREE_LIST to wrap the OVERLOAD. */ - *d = build_tree_list (NULL_TREE, new_binding); - - /* And update the CPLUS_BINDING node. */ - BINDING_VALUE (IDENTIFIER_BINDING (name)) - = new_binding; - return decl; - } - - /* We should always find a previous binding in this case. */ - my_friendly_abort (0); - } - - /* Install the new binding. */ - push_local_binding (name, new_binding, flags); - } - - return decl; -} - -/* Generate an implicit declaration for identifier FUNCTIONID - as a function of type int (). Print a warning if appropriate. */ - -tree -implicitly_declare (functionid) - tree functionid; -{ - register tree decl; - int temp = allocation_temporary_p (); - - push_obstacks_nochange (); - - /* Save the decl permanently so we can warn if definition follows. - In ANSI C, warn_implicit is usually false, so the saves little space. - But in C++, it's usually true, hence the extra code. */ - if (temp && (! warn_implicit || toplevel_bindings_p ())) - end_temporary_allocation (); - - /* We used to reuse an old implicit decl here, - but this loses with inline functions because it can clobber - the saved decl chains. */ - decl = build_lang_decl (FUNCTION_DECL, functionid, default_function_type); - - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; - - /* ANSI standard says implicit declarations are in the innermost block. - So we record the decl in the standard fashion. */ - pushdecl (decl); - rest_of_decl_compilation (decl, NULL_PTR, 0, 0); - - if (warn_implicit - /* Only one warning per identifier. */ - && IDENTIFIER_IMPLICIT_DECL (functionid) == NULL_TREE) - { - cp_pedwarn ("implicit declaration of function `%#D'", decl); - } - - SET_IDENTIFIER_IMPLICIT_DECL (functionid, decl); - - pop_obstacks (); - - return decl; -} - -/* Return zero if the declaration NEWDECL is valid - when the declaration OLDDECL (assumed to be for the same name) - has already been seen. - Otherwise return an error message format string with a %s - where the identifier should go. */ - -static const char * -redeclaration_error_message (newdecl, olddecl) - tree newdecl, olddecl; -{ - if (TREE_CODE (newdecl) == TYPE_DECL) - { - /* Because C++ can put things into name space for free, - constructs like "typedef struct foo { ... } foo" - would look like an erroneous redeclaration. */ - if (same_type_p (TREE_TYPE (newdecl), TREE_TYPE (olddecl))) - return 0; - else - return "redefinition of `%#D'"; - } - else if (TREE_CODE (newdecl) == FUNCTION_DECL) - { - /* If this is a pure function, its olddecl will actually be - the original initialization to `0' (which we force to call - abort()). Don't complain about redefinition in this case. */ - if (DECL_LANG_SPECIFIC (olddecl) && DECL_ABSTRACT_VIRTUAL_P (olddecl)) - return 0; - - /* If both functions come from different namespaces, this is not - a redeclaration - this is a conflict with a used function. */ - if (DECL_NAMESPACE_SCOPE_P (olddecl) - && DECL_CONTEXT (olddecl) != DECL_CONTEXT (newdecl)) - return "`%D' conflicts with used function"; - - /* We'll complain about linkage mismatches in - warn_extern_redeclared_static. */ - - /* Defining the same name twice is no good. */ - if (DECL_INITIAL (olddecl) != NULL_TREE - && DECL_INITIAL (newdecl) != NULL_TREE) - { - if (DECL_NAME (olddecl) == NULL_TREE) - return "`%#D' not declared in class"; - else - return "redefinition of `%#D'"; - } - return 0; - } - else if (TREE_CODE (newdecl) == TEMPLATE_DECL) - { - if ((TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == FUNCTION_DECL - && DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl)) - && DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl))) - || (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL - && TYPE_SIZE (TREE_TYPE (newdecl)) - && TYPE_SIZE (TREE_TYPE (olddecl)))) - return "redefinition of `%#D'"; - return 0; - } - else if (toplevel_bindings_p ()) - { - /* Objects declared at top level: */ - /* If at least one is a reference, it's ok. */ - if (DECL_EXTERNAL (newdecl) || DECL_EXTERNAL (olddecl)) - return 0; - /* Reject two definitions. */ - return "redefinition of `%#D'"; - } - else - { - /* Objects declared with block scope: */ - /* Reject two definitions, and reject a definition - together with an external reference. */ - if (!(DECL_EXTERNAL (newdecl) && DECL_EXTERNAL (olddecl))) - return "redeclaration of `%#D'"; - return 0; - } -} - -/* Get the LABEL_DECL corresponding to identifier ID as a label. - Create one if none exists so far for the current function. - This function is called for both label definitions and label references. */ - -tree -lookup_label (id) - tree id; -{ - register tree decl = IDENTIFIER_LABEL_VALUE (id); - - if (current_function_decl == NULL_TREE) - { - error ("label `%s' referenced outside of any function", - IDENTIFIER_POINTER (id)); - return NULL_TREE; - } - - if ((decl == NULL_TREE - || DECL_SOURCE_LINE (decl) == 0) - && (named_label_uses == NULL - || named_label_uses->names_in_scope != current_binding_level->names - || named_label_uses->label_decl != decl)) - { - struct named_label_list *new_ent; - new_ent - = (struct named_label_list*)oballoc (sizeof (struct named_label_list)); - new_ent->label_decl = decl; - new_ent->names_in_scope = current_binding_level->names; - new_ent->binding_level = current_binding_level; - new_ent->lineno_o_goto = lineno; - new_ent->filename_o_goto = input_filename; - new_ent->next = named_label_uses; - named_label_uses = new_ent; - } - - /* Use a label already defined or ref'd with this name. */ - if (decl != NULL_TREE) - { - /* But not if it is inherited and wasn't declared to be inheritable. */ - if (DECL_CONTEXT (decl) != current_function_decl - && ! C_DECLARED_LABEL_FLAG (decl)) - return shadow_label (id); - return decl; - } - - decl = build_decl (LABEL_DECL, id, void_type_node); - - /* Make sure every label has an rtx. */ - label_rtx (decl); - - /* A label not explicitly declared must be local to where it's ref'd. */ - DECL_CONTEXT (decl) = current_function_decl; - - DECL_MODE (decl) = VOIDmode; - - /* Say where one reference is to the label, - for the sake of the error if it is not defined. */ - DECL_SOURCE_LINE (decl) = lineno; - DECL_SOURCE_FILE (decl) = input_filename; - - SET_IDENTIFIER_LABEL_VALUE (id, decl); - - named_labels = tree_cons (NULL_TREE, decl, named_labels); - named_label_uses->label_decl = decl; - - return decl; -} - -/* Make a label named NAME in the current function, - shadowing silently any that may be inherited from containing functions - or containing scopes. - - Note that valid use, if the label being shadowed - comes from another scope in the same function, - requires calling declare_nonlocal_label right away. */ - -tree -shadow_label (name) - tree name; -{ - register tree decl = IDENTIFIER_LABEL_VALUE (name); - - if (decl != NULL_TREE) - { - shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels); - SET_IDENTIFIER_LABEL_VALUE (name, NULL_TREE); - } - - return lookup_label (name); -} - -/* Define a label, specifying the location in the source file. - Return the LABEL_DECL node for the label, if the definition is valid. - Otherwise return 0. */ - -tree -define_label (filename, line, name) - char *filename; - int line; - tree name; -{ - tree decl; - - if (minimal_parse_mode) - { - push_obstacks (&permanent_obstack, &permanent_obstack); - decl = build_decl (LABEL_DECL, name, void_type_node); - pop_obstacks (); - DECL_SOURCE_LINE (decl) = line; - DECL_SOURCE_FILE (decl) = filename; - add_tree (decl); - return decl; - } - - decl = lookup_label (name); - - /* After labels, make any new cleanups go into their - own new (temporary) binding contour. */ - current_binding_level->more_cleanups_ok = 0; - - /* If label with this name is known from an outer context, shadow it. */ - if (decl != NULL_TREE && DECL_CONTEXT (decl) != current_function_decl) - { - shadowed_labels = tree_cons (NULL_TREE, decl, shadowed_labels); - SET_IDENTIFIER_LABEL_VALUE (name, NULL_TREE); - decl = lookup_label (name); - } - - if (name == get_identifier ("wchar_t")) - cp_pedwarn ("label named wchar_t"); - - if (DECL_INITIAL (decl) != NULL_TREE) - { - cp_error ("duplicate label `%D'", decl); - return 0; - } - else - { - struct named_label_list *uses, *prev; - int identified = 0; - - /* Mark label as having been defined. */ - DECL_INITIAL (decl) = error_mark_node; - /* Say where in the source. */ - DECL_SOURCE_FILE (decl) = filename; - DECL_SOURCE_LINE (decl) = line; - - prev = NULL; - uses = named_label_uses; - while (uses != NULL) - if (uses->label_decl == decl) - { - struct binding_level *b = current_binding_level; - while (b) - { - tree new_decls = b->names; - tree old_decls = (b == uses->binding_level) - ? uses->names_in_scope : NULL_TREE; - while (new_decls != old_decls) - { - if (TREE_CODE (new_decls) == VAR_DECL - /* Don't complain about crossing initialization - of internal entities. They can't be accessed, - and they should be cleaned up - by the time we get to the label. */ - && ! DECL_ARTIFICIAL (new_decls) - && !(DECL_INITIAL (new_decls) == NULL_TREE - && pod_type_p (TREE_TYPE (new_decls)))) - { - /* This is really only important if we're crossing - an initialization. The POD stuff is just - pedantry; why should it matter if the class - contains a field of pointer to member type? */ - int problem = (DECL_INITIAL (new_decls) - || (TYPE_NEEDS_CONSTRUCTING - (TREE_TYPE (new_decls)))); - - if (! identified) - { - if (problem) - { - cp_error ("jump to label `%D'", decl); - error_with_file_and_line - (uses->filename_o_goto, - uses->lineno_o_goto, " from here"); - } - else - { - cp_pedwarn ("jump to label `%D'", decl); - pedwarn_with_file_and_line - (uses->filename_o_goto, - uses->lineno_o_goto, " from here"); - } - identified = 1; - } - - if (problem) - cp_error_at (" crosses initialization of `%#D'", - new_decls); - else - cp_pedwarn_at (" enters scope of non-POD `%#D'", - new_decls); - } - new_decls = TREE_CHAIN (new_decls); - } - if (b == uses->binding_level) - break; - b = b->level_chain; - } - - if (prev != NULL) - prev->next = uses->next; - else - named_label_uses = uses->next; - - uses = uses->next; - } - else - { - prev = uses; - uses = uses->next; - } - current_function_return_value = NULL_TREE; - return decl; - } -} - -struct cp_switch -{ - struct binding_level *level; - struct cp_switch *next; -}; - -static struct cp_switch *switch_stack; - -void -push_switch () -{ - struct cp_switch *p - = (struct cp_switch *) oballoc (sizeof (struct cp_switch)); - p->level = current_binding_level; - p->next = switch_stack; - switch_stack = p; -} - -void -pop_switch () -{ - switch_stack = switch_stack->next; -} - -/* Same, but for CASE labels. If DECL is NULL_TREE, it's the default. */ -/* XXX Note decl is never actually used. (bpk) */ - -void -define_case_label () -{ - tree cleanup = last_cleanup_this_contour (); - struct binding_level *b = current_binding_level; - int identified = 0; - - if (cleanup) - { - static int explained = 0; - cp_warning_at ("destructor needed for `%#D'", TREE_PURPOSE (cleanup)); - warning ("where case label appears here"); - if (!explained) - { - warning ("(enclose actions of previous case statements requiring"); - warning ("destructors in their own binding contours.)"); - explained = 1; - } - } - - for (; b && b != switch_stack->level; b = b->level_chain) - { - tree new_decls = b->names; - for (; new_decls; new_decls = TREE_CHAIN (new_decls)) - { - if (TREE_CODE (new_decls) == VAR_DECL - /* Don't complain about crossing initialization - of internal entities. They can't be accessed, - and they should be cleaned up - by the time we get to the label. */ - && ! DECL_ARTIFICIAL (new_decls) - && ((DECL_INITIAL (new_decls) != NULL_TREE - && DECL_INITIAL (new_decls) != error_mark_node) - || TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (new_decls)))) - { - if (! identified) - error ("jump to case label"); - identified = 1; - cp_error_at (" crosses initialization of `%#D'", - new_decls); - } - } - } - - /* After labels, make any new cleanups go into their - own new (temporary) binding contour. */ - - current_binding_level->more_cleanups_ok = 0; - current_function_return_value = NULL_TREE; -} - -/* Return the list of declarations of the current level. - Note that this list is in reverse order unless/until - you nreverse it; and when you do nreverse it, you must - store the result back using `storedecls' or you will lose. */ - -tree -getdecls () -{ - return current_binding_level->names; -} - -/* Return the list of type-tags (for structs, etc) of the current level. */ - -tree -gettags () -{ - return current_binding_level->tags; -} - -/* Store the list of declarations of the current level. - This is done for the parameter declarations of a function being defined, - after they are modified in the light of any missing parameters. */ - -static void -storedecls (decls) - tree decls; -{ - current_binding_level->names = decls; -} - -/* Similarly, store the list of tags of the current level. */ - -void -storetags (tags) - tree tags; -{ - current_binding_level->tags = tags; -} - -/* Given NAME, an IDENTIFIER_NODE, - return the structure (or union or enum) definition for that name. - Searches binding levels from BINDING_LEVEL up to the global level. - If THISLEVEL_ONLY is nonzero, searches only the specified context - (but skips any tag-transparent contexts to find one that is - meaningful for tags). - FORM says which kind of type the caller wants; - it is RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE. - If the wrong kind of type is found, and it's not a template, an error is - reported. */ - -static tree -lookup_tag (form, name, binding_level, thislevel_only) - enum tree_code form; - tree name; - struct binding_level *binding_level; - int thislevel_only; -{ - register struct binding_level *level; - /* Non-zero if, we should look past a pseudo-global level, even if - THISLEVEL_ONLY. */ - int allow_pseudo_global = 1; - - for (level = binding_level; level; level = level->level_chain) - { - register tree tail; - if (ANON_AGGRNAME_P (name)) - for (tail = level->tags; tail; tail = TREE_CHAIN (tail)) - { - /* There's no need for error checking here, because - anon names are unique throughout the compilation. */ - if (TYPE_IDENTIFIER (TREE_VALUE (tail)) == name) - return TREE_VALUE (tail); - } - else if (level->namespace_p) - /* Do namespace lookup. */ - for (tail = current_namespace; 1; tail = CP_DECL_CONTEXT (tail)) - { - tree old = binding_for_name (name, tail); - - /* If we just skipped past a pseudo global level, even - though THISLEVEL_ONLY, and we find a template class - declaration, then we use the _TYPE node for the - template. See the example below. */ - if (thislevel_only && !allow_pseudo_global - && old && BINDING_VALUE (old) - && DECL_CLASS_TEMPLATE_P (BINDING_VALUE (old))) - old = TREE_TYPE (BINDING_VALUE (old)); - else - old = BINDING_TYPE (old); - - /* If it has an original type, it is a typedef, and we - should not return it. */ - if (old && DECL_ORIGINAL_TYPE (TYPE_NAME (old))) - old = NULL_TREE; - if (old && TREE_CODE (old) != form - && !(form != ENUMERAL_TYPE && TREE_CODE (old) == TEMPLATE_DECL)) - { - cp_error ("`%#D' redeclared as %C", old, form); - return NULL_TREE; - } - if (old) - return old; - if (thislevel_only || tail == global_namespace) - return NULL_TREE; - } - else - for (tail = level->tags; tail; tail = TREE_CHAIN (tail)) - { - if (TREE_PURPOSE (tail) == name) - { - enum tree_code code = TREE_CODE (TREE_VALUE (tail)); - /* Should tighten this up; it'll probably permit - UNION_TYPE and a struct template, for example. */ - if (code != form - && !(form != ENUMERAL_TYPE && code == TEMPLATE_DECL)) - { - /* Definition isn't the kind we were looking for. */ - cp_error ("`%#D' redeclared as %C", TREE_VALUE (tail), - form); - return NULL_TREE; - } - return TREE_VALUE (tail); - } - } - if (thislevel_only && ! level->tag_transparent) - { - if (level->pseudo_global && allow_pseudo_global) - { - /* We must deal with cases like this: - - template struct S; - template struct S {}; - - When looking up `S', for the second declaration, we - would like to find the first declaration. But, we - are in the pseudo-global level created for the - template parameters, rather than the (surrounding) - namespace level. Thus, we keep going one more level, - even though THISLEVEL_ONLY is non-zero. */ - allow_pseudo_global = 0; - continue; - } - else - return NULL_TREE; - } - if (current_class_type && level->level_chain->namespace_p) - { - /* Try looking in this class's tags before heading into - global binding level. */ - tree context = current_class_type; - while (context) - { - switch (TREE_CODE_CLASS (TREE_CODE (context))) - { - tree these_tags; - case 't': - these_tags = CLASSTYPE_TAGS (context); - if (ANON_AGGRNAME_P (name)) - while (these_tags) - { - if (TYPE_IDENTIFIER (TREE_VALUE (these_tags)) - == name) - return TREE_VALUE (tail); - these_tags = TREE_CHAIN (these_tags); - } - else - while (these_tags) - { - if (TREE_PURPOSE (these_tags) == name) - { - if (TREE_CODE (TREE_VALUE (these_tags)) != form) - { - cp_error ("`%#D' redeclared as %C in class scope", - TREE_VALUE (tail), form); - return NULL_TREE; - } - return TREE_VALUE (tail); - } - these_tags = TREE_CHAIN (these_tags); - } - /* If this type is not yet complete, then don't - look at its context. */ - if (TYPE_SIZE (context) == NULL_TREE) - goto no_context; - /* Go to next enclosing type, if any. */ - context = DECL_CONTEXT (TYPE_MAIN_DECL (context)); - break; - case 'd': - context = DECL_CONTEXT (context); - break; - default: - my_friendly_abort (10); - } - continue; - no_context: - break; - } - } - } - return NULL_TREE; -} - -#if 0 -void -set_current_level_tags_transparency (tags_transparent) - int tags_transparent; -{ - current_binding_level->tag_transparent = tags_transparent; -} -#endif - -/* Given a type, find the tag that was defined for it and return the tag name. - Otherwise return 0. However, the value can never be 0 - in the cases in which this is used. - - C++: If NAME is non-zero, this is the new name to install. This is - done when replacing anonymous tags with real tag names. */ - -static tree -lookup_tag_reverse (type, name) - tree type; - tree name; -{ - register struct binding_level *level; - - for (level = current_binding_level; level; level = level->level_chain) - { - register tree tail; - for (tail = level->tags; tail; tail = TREE_CHAIN (tail)) - { - if (TREE_VALUE (tail) == type) - { - if (name) - TREE_PURPOSE (tail) = name; - return TREE_PURPOSE (tail); - } - } - } - return NULL_TREE; -} - -/* Lookup TYPE in CONTEXT (a chain of nested types or a FUNCTION_DECL). - Return the type value, or NULL_TREE if not found. */ - -static tree -lookup_nested_type (type, context) - tree type; - tree context; -{ - if (context == NULL_TREE) - return NULL_TREE; - while (context) - { - switch (TREE_CODE (context)) - { - case TYPE_DECL: - { - tree ctype = TREE_TYPE (context); - tree match = value_member (type, CLASSTYPE_TAGS (ctype)); - if (match) - return TREE_VALUE (match); - context = DECL_CONTEXT (context); - - /* When we have a nested class whose member functions have - local types (e.g., a set of enums), we'll arrive here - with the DECL_CONTEXT as the actual RECORD_TYPE node for - the enclosing class. Instead, we want to make sure we - come back in here with the TYPE_DECL, not the RECORD_TYPE. */ - if (context && TREE_CODE (context) == RECORD_TYPE) - context = TREE_CHAIN (context); - } - break; - case FUNCTION_DECL: - if (TYPE_NAME (type) && TYPE_IDENTIFIER (type)) - return lookup_name (TYPE_IDENTIFIER (type), 1); - return NULL_TREE; - default: - my_friendly_abort (12); - } - } - return NULL_TREE; -} - -/* Look up NAME in the NAMESPACE. */ - -tree -lookup_namespace_name (namespace, name) - tree namespace, name; -{ - struct tree_binding _b; - tree val; - - my_friendly_assert (TREE_CODE (namespace) == NAMESPACE_DECL, 370); - - if (TREE_CODE (name) == NAMESPACE_DECL) - /* This happens for A::B when B is a namespace. */ - return name; - else if (TREE_CODE (name) == TEMPLATE_DECL) - { - /* This happens for A::B where B is a template, and there are no - template arguments. */ - cp_error ("invalid use of `%D'", name); - return error_mark_node; - } - - namespace = ORIGINAL_NAMESPACE (namespace); - - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 373); - - val = binding_init (&_b); - if (!qualified_lookup_using_namespace (name, namespace, val, 0)) - return error_mark_node; - - if (BINDING_VALUE (val)) - { - val = BINDING_VALUE (val); - - /* If we have a single function from a using decl, pull it out. */ - if (TREE_CODE (val) == OVERLOAD && ! really_overloaded_fn (val)) - val = OVL_FUNCTION (val); - return val; - } - - cp_error ("`%D' undeclared in namespace `%D'", name, namespace); - return error_mark_node; -} - -/* Hash a TYPENAME_TYPE. K is really of type `tree'. */ - -static unsigned long -typename_hash (k) - hash_table_key k; -{ - unsigned long hash; - tree t; - - t = (tree) k; - hash = (((unsigned long) TYPE_CONTEXT (t)) - ^ ((unsigned long) DECL_NAME (TYPE_NAME (t)))); - - return hash; -} - -/* Compare two TYPENAME_TYPEs. K1 and K2 are really of type `tree'. */ - -static boolean -typename_compare (k1, k2) - hash_table_key k1; - hash_table_key k2; -{ - tree t1; - tree t2; - tree d1; - tree d2; - - t1 = (tree) k1; - t2 = (tree) k2; - d1 = TYPE_NAME (t1); - d2 = TYPE_NAME (t2); - - return (DECL_NAME (d1) == DECL_NAME (d2) - && same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2)) - && ((TREE_TYPE (t1) != NULL_TREE) - == (TREE_TYPE (t2) != NULL_TREE)) - && same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)) - && TYPENAME_TYPE_FULLNAME (t1) == TYPENAME_TYPE_FULLNAME (t2)); -} - -/* Build a TYPENAME_TYPE. If the type is `typename T::t', CONTEXT is - the type of `T', NAME is the IDENTIFIER_NODE for `t'. If BASE_TYPE - is non-NULL, this type is being created by the implicit typename - extension, and BASE_TYPE is a type named `t' in some base class of - `T' which depends on template parameters. - - Returns the new TYPENAME_TYPE. */ - -tree -build_typename_type (context, name, fullname, base_type) - tree context; - tree name; - tree fullname; - tree base_type; -{ - tree t; - tree d; - struct hash_entry* e; - - static struct hash_table ht; - - push_obstacks (&permanent_obstack, &permanent_obstack); - - if (!ht.table - && !hash_table_init (&ht, &hash_newfunc, &typename_hash, - &typename_compare)) - fatal ("virtual memory exhausted"); - - /* The FULLNAME needs to exist for the life of the hash table, i.e., - for the entire compilation. */ - if (!TREE_PERMANENT (fullname)) - fullname = copy_to_permanent (fullname); - - /* Build the TYPENAME_TYPE. */ - t = make_lang_type (TYPENAME_TYPE); - TYPE_CONTEXT (t) = FROB_CONTEXT (context); - TYPENAME_TYPE_FULLNAME (t) = fullname; - TREE_TYPE (t) = base_type; - - /* Build the corresponding TYPE_DECL. */ - d = build_decl (TYPE_DECL, name, t); - TYPE_NAME (TREE_TYPE (d)) = d; - TYPE_STUB_DECL (TREE_TYPE (d)) = d; - DECL_CONTEXT (d) = FROB_CONTEXT (context); - DECL_ARTIFICIAL (d) = 1; - - /* See if we already have this type. */ - e = hash_lookup (&ht, t, /*create=*/false, /*copy=*/0); - if (e) - { - /* This will free not only TREE_TYPE, but the lang-specific data - and the TYPE_DECL as well. */ - obstack_free (&permanent_obstack, t); - t = (tree) e->key; - } - else - /* Insert the type into the table. */ - hash_lookup (&ht, t, /*create=*/true, /*copy=*/0); - - pop_obstacks (); - - return t; -} - -tree -make_typename_type (context, name) - tree context, name; -{ - tree t; - tree fullname; - - if (TREE_CODE_CLASS (TREE_CODE (name)) == 't') - { - if (!(TYPE_LANG_SPECIFIC (name) - && (CLASSTYPE_IS_TEMPLATE (name) - || CLASSTYPE_USE_TEMPLATE (name)))) - name = TYPE_IDENTIFIER (name); - else - /* Create a TEMPLATE_ID_EXPR for the type. */ - name = build_nt (TEMPLATE_ID_EXPR, - CLASSTYPE_TI_TEMPLATE (name), - CLASSTYPE_TI_ARGS (name)); - } - else if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - - fullname = name; - - if (TREE_CODE (name) == TEMPLATE_ID_EXPR) - { - name = TREE_OPERAND (name, 0); - if (TREE_CODE (name) == TEMPLATE_DECL) - name = TREE_OPERAND (fullname, 0) = DECL_NAME (name); - } - if (TREE_CODE (name) != IDENTIFIER_NODE) - my_friendly_abort (2000); - - if (TREE_CODE (context) == NAMESPACE_DECL) - { - /* We can get here from typename_sub0 in the explicit_template_type - expansion. Just fail. */ - cp_error ("no class template named `%#T' in `%#T'", - name, context); - return error_mark_node; - } - - if (! uses_template_parms (context) - || currently_open_class (context)) - { - if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR) - { - tree tmpl = NULL_TREE; - if (IS_AGGR_TYPE (context)) - tmpl = lookup_field (context, name, 0, 0); - if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) - { - cp_error ("no class template named `%#T' in `%#T'", - name, context); - return error_mark_node; - } - - return lookup_template_class (tmpl, - TREE_OPERAND (fullname, 1), - NULL_TREE, context, - /*entering_scope=*/0); - } - else - { - if (IS_AGGR_TYPE (context)) - t = lookup_field (context, name, 0, 1); - else - { - cp_error ("no type named `%#T' in `%#T'", name, context); - return error_mark_node; - } - - if (t) - return TREE_TYPE (t); - } - } - - /* If the CONTEXT is not a template type, then either the field is - there now or its never going to be. */ - if (!uses_template_parms (context) && !t) - { - cp_error ("no type named `%#T' in `%#T'", name, context); - return error_mark_node; - } - - - return build_typename_type (context, name, fullname, NULL_TREE); -} - -/* Select the right _DECL from multiple choices. */ - -static tree -select_decl (binding, flags) - tree binding; - int flags; -{ - tree val; - val = BINDING_VALUE (binding); - if (LOOKUP_NAMESPACES_ONLY (flags)) - { - /* We are not interested in types. */ - if (val && TREE_CODE (val) == NAMESPACE_DECL) - return val; - return NULL_TREE; - } - - /* If we could have a type and - we have nothing or we need a type and have none. */ - if (BINDING_TYPE (binding) - && (!val || ((flags & LOOKUP_PREFER_TYPES) - && TREE_CODE (val) != TYPE_DECL))) - val = TYPE_STUB_DECL (BINDING_TYPE (binding)); - /* Don't return non-types if we really prefer types. */ - else if (val && LOOKUP_TYPES_ONLY (flags) && TREE_CODE (val) != TYPE_DECL - && (TREE_CODE (val) != TEMPLATE_DECL - || !DECL_CLASS_TEMPLATE_P (val))) - val = NULL_TREE; - - return val; -} - -/* Unscoped lookup of a global, iterate over namespaces, considering - using namespace statements. */ - -static tree -unqualified_namespace_lookup (name, flags) - tree name; - int flags; -{ - struct tree_binding _binding; - tree b = binding_init (&_binding); - tree initial = current_decl_namespace(); - tree scope = initial; - tree siter; - struct binding_level *level; - tree val = NULL_TREE; - - while (!val) - { - val = binding_for_name (name, scope); - - /* Initialize binding for this context. */ - BINDING_VALUE (b) = BINDING_VALUE (val); - BINDING_TYPE (b) = BINDING_TYPE (val); - - /* Add all _DECLs seen through local using-directives. */ - for (level = current_binding_level; - !level->namespace_p; - level = level->level_chain) - if (!lookup_using_namespace (name, b, level->using_directives, - scope, flags)) - /* Give up because of error. */ - return error_mark_node; - - /* Add all _DECLs seen through global using-directives. */ - /* XXX local and global using lists should work equally. */ - siter = initial; - while (1) - { - if (!lookup_using_namespace (name, b, DECL_NAMESPACE_USING (siter), - scope, flags)) - /* Give up because of error. */ - return error_mark_node; - if (siter == scope) break; - siter = CP_DECL_CONTEXT (siter); - } - - val = select_decl (b, flags); - if (scope == global_namespace) - break; - scope = CP_DECL_CONTEXT (scope); - } - return val; -} - -/* Combine prefer_type and namespaces_only into flags. */ - -static int -lookup_flags (prefer_type, namespaces_only) - int prefer_type, namespaces_only; -{ - if (namespaces_only) - return LOOKUP_PREFER_NAMESPACES; - if (prefer_type > 1) - return LOOKUP_PREFER_TYPES; - if (prefer_type > 0) - return LOOKUP_PREFER_BOTH; - return 0; -} - -/* Given a lookup that returned VAL, use FLAGS to decide if we want to - ignore it or not. Subroutine of lookup_name_real. */ - -static tree -qualify_lookup (val, flags) - tree val; - int flags; -{ - if (val == NULL_TREE) - return val; - if ((flags & LOOKUP_PREFER_NAMESPACES) && TREE_CODE (val) == NAMESPACE_DECL) - return val; - if ((flags & LOOKUP_PREFER_TYPES) - && (TREE_CODE (val) == TYPE_DECL - || ((flags & LOOKUP_TEMPLATES_EXPECTED) - && DECL_CLASS_TEMPLATE_P (val)))) - return val; - if (flags & (LOOKUP_PREFER_NAMESPACES | LOOKUP_PREFER_TYPES)) - return NULL_TREE; - return val; -} - -/* Any other BINDING overrides an implicit TYPENAME. Warn about - that. */ - -static void -warn_about_implicit_typename_lookup (typename, binding) - tree typename; - tree binding; -{ - tree subtype = TREE_TYPE (TREE_TYPE (typename)); - tree name = DECL_NAME (typename); - - if (! (TREE_CODE (binding) == TEMPLATE_DECL - && CLASSTYPE_TEMPLATE_INFO (subtype) - && CLASSTYPE_TI_TEMPLATE (subtype) == binding) - && ! (TREE_CODE (binding) == TYPE_DECL - && same_type_p (TREE_TYPE (binding), subtype))) - { - cp_warning ("lookup of `%D' finds `%#D'", - name, binding); - cp_warning (" instead of `%D' from dependent base class", - typename); - cp_warning (" (use `typename %T::%D' if that's what you meant)", - constructor_name (current_class_type), name); - } -} - -/* Look up NAME in the current binding level and its superiors in the - namespace of variables, functions and typedefs. Return a ..._DECL - node of some kind representing its definition if there is only one - such declaration, or return a TREE_LIST with all the overloaded - definitions if there are many, or return 0 if it is undefined. - - If PREFER_TYPE is > 0, we prefer TYPE_DECLs or namespaces. - If PREFER_TYPE is > 1, we reject non-type decls (e.g. namespaces). - If PREFER_TYPE is -2, we're being called from yylex(). (UGLY) - Otherwise we prefer non-TYPE_DECLs. - - If NONCLASS is non-zero, we don't look for the NAME in class scope, - using IDENTIFIER_CLASS_VALUE. */ - -static tree -lookup_name_real (name, prefer_type, nonclass, namespaces_only) - tree name; - int prefer_type, nonclass, namespaces_only; -{ - tree t; - tree val = NULL_TREE; - int yylex = 0; - tree from_obj = NULL_TREE; - int flags; - int val_is_implicit_typename = 0; - - /* Hack: copy flag set by parser, if set. */ - if (only_namespace_names) - namespaces_only = 1; - - if (prefer_type == -2) - { - extern int looking_for_typename; - tree type = NULL_TREE; - - yylex = 1; - prefer_type = looking_for_typename; - - flags = lookup_flags (prefer_type, namespaces_only); - /* If the next thing is '<', class templates are types. */ - if (looking_for_template) - flags |= LOOKUP_TEMPLATES_EXPECTED; - - /* std:: becomes :: for now. */ - if (got_scope == std_node) - got_scope = void_type_node; - - if (got_scope) - type = got_scope; - else if (got_object != error_mark_node) - type = got_object; - - if (type) - { - if (type == error_mark_node) - return error_mark_node; - if (TREE_CODE (type) == TYPENAME_TYPE && TREE_TYPE (type)) - type = TREE_TYPE (type); - - if (TYPE_P (type)) - type = complete_type (type); - - if (TREE_CODE (type) == VOID_TYPE) - type = global_namespace; - if (TREE_CODE (type) == NAMESPACE_DECL) - { - struct tree_binding b; - val = binding_init (&b); - flags |= LOOKUP_COMPLAIN; - if (!qualified_lookup_using_namespace (name, type, val, flags)) - return NULL_TREE; - val = select_decl (val, flags); - } - else if (! IS_AGGR_TYPE (type) - || TREE_CODE (type) == TEMPLATE_TYPE_PARM - || TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM - || TREE_CODE (type) == TYPENAME_TYPE) - /* Someone else will give an error about this if needed. */ - val = NULL_TREE; - else if (type == current_class_type) - val = IDENTIFIER_CLASS_VALUE (name); - else - val = lookup_member (type, name, 0, prefer_type); - } - else - val = NULL_TREE; - - if (got_scope) - goto done; - else if (got_object && val) - from_obj = val; - } - else - { - flags = lookup_flags (prefer_type, namespaces_only); - /* If we're not parsing, we need to complain. */ - flags |= LOOKUP_COMPLAIN; - } - - /* First, look in non-namespace scopes. */ - for (t = IDENTIFIER_BINDING (name); t; t = TREE_CHAIN (t)) - { - tree binding; - - if (!LOCAL_BINDING_P (t) && nonclass) - /* We're not looking for class-scoped bindings, so keep going. */ - continue; - - /* If this is the kind of thing we're looking for, we're done. */ - if (qualify_lookup (BINDING_VALUE (t), flags)) - binding = BINDING_VALUE (t); - else if ((flags & LOOKUP_PREFER_TYPES) - && qualify_lookup (BINDING_TYPE (t), flags)) - binding = BINDING_TYPE (t); - else - binding = NULL_TREE; - - if (binding - && (!val || !(TREE_CODE (binding) == TYPE_DECL - && IMPLICIT_TYPENAME_P (TREE_TYPE (binding))))) - { - if (val_is_implicit_typename && !yylex) - warn_about_implicit_typename_lookup (val, binding); - val = binding; - val_is_implicit_typename - = (TREE_CODE (val) == TYPE_DECL - && IMPLICIT_TYPENAME_P (TREE_TYPE (val))); - if (!val_is_implicit_typename) - break; - } - } - - /* Now lookup in namespace scopes. */ - if (!val || val_is_implicit_typename) - { - t = unqualified_namespace_lookup (name, flags); - if (t) - { - if (val_is_implicit_typename && !yylex) - warn_about_implicit_typename_lookup (val, t); - val = t; - } - } - - done: - if (val) - { - /* This should only warn about types used in qualified-ids. */ - if (from_obj && from_obj != val) - { - if (looking_for_typename && TREE_CODE (from_obj) == TYPE_DECL - && TREE_CODE (val) == TYPE_DECL - && TREE_TYPE (from_obj) != TREE_TYPE (val)) - { - cp_pedwarn ("lookup of `%D' in the scope of `%#T' (`%#T')", - name, got_object, TREE_TYPE (from_obj)); - cp_pedwarn (" does not match lookup in the current scope (`%#T')", - TREE_TYPE (val)); - } - - /* We don't change val to from_obj if got_object depends on - template parms because that breaks implicit typename for - destructor calls. */ - if (! uses_template_parms (got_object)) - val = from_obj; - } - - /* If we have a single function from a using decl, pull it out. */ - if (TREE_CODE (val) == OVERLOAD && ! really_overloaded_fn (val)) - val = OVL_FUNCTION (val); - } - else if (from_obj) - val = from_obj; - - return val; -} - -tree -lookup_name_nonclass (name) - tree name; -{ - return lookup_name_real (name, 0, 1, 0); -} - -tree -lookup_function_nonclass (name, args) - tree name; - tree args; -{ - return lookup_arg_dependent (name, lookup_name_nonclass (name), args); -} - -tree -lookup_name_namespace_only (name) - tree name; -{ - /* type-or-namespace, nonclass, namespace_only */ - return lookup_name_real (name, 1, 1, 1); -} - -tree -lookup_name (name, prefer_type) - tree name; - int prefer_type; -{ - return lookup_name_real (name, prefer_type, 0, 0); -} - -/* Similar to `lookup_name' but look only in the innermost non-class - binding level. */ - -tree -lookup_name_current_level (name) - tree name; -{ - struct binding_level *b; - tree t = NULL_TREE; - - b = current_binding_level; - while (b->parm_flag == 2) - b = b->level_chain; - - if (b->namespace_p) - { - t = IDENTIFIER_NAMESPACE_VALUE (name); - - /* extern "C" function() */ - if (t != NULL_TREE && TREE_CODE (t) == TREE_LIST) - t = TREE_VALUE (t); - } - else if (IDENTIFIER_BINDING (name) - && LOCAL_BINDING_P (IDENTIFIER_BINDING (name))) - { - while (1) - { - if (BINDING_LEVEL (IDENTIFIER_BINDING (name)) == b) - return IDENTIFIER_VALUE (name); - - if (b->keep == 2) - b = b->level_chain; - else - break; - } - } - - return t; -} - -/* Like lookup_name_current_level, but for types. */ - -tree -lookup_type_current_level (name) - tree name; -{ - register tree t = NULL_TREE; - - my_friendly_assert (! current_binding_level->namespace_p, 980716); - - if (REAL_IDENTIFIER_TYPE_VALUE (name) != NULL_TREE - && REAL_IDENTIFIER_TYPE_VALUE (name) != global_type_node) - { - struct binding_level *b = current_binding_level; - while (1) - { - if (purpose_member (name, b->type_shadowed)) - return REAL_IDENTIFIER_TYPE_VALUE (name); - if (b->keep == 2) - b = b->level_chain; - else - break; - } - } - - return t; -} - -void -begin_only_namespace_names () -{ - only_namespace_names = 1; -} - -void -end_only_namespace_names () -{ - only_namespace_names = 0; -} - -/* Arrange for the user to get a source line number, even when the - compiler is going down in flames, so that she at least has a - chance of working around problems in the compiler. We used to - call error(), but that let the segmentation fault continue - through; now, it's much more passive by asking them to send the - maintainers mail about the problem. */ - -static void -signal_catch (sig) - int sig ATTRIBUTE_UNUSED; -{ - signal (SIGSEGV, SIG_DFL); -#ifdef SIGIOT - signal (SIGIOT, SIG_DFL); -#endif -#ifdef SIGILL - signal (SIGILL, SIG_DFL); -#endif -#ifdef SIGABRT - signal (SIGABRT, SIG_DFL); -#endif -#ifdef SIGBUS - signal (SIGBUS, SIG_DFL); -#endif - my_friendly_abort (0); -} - -#if 0 -/* Unused -- brendan 970107 */ -/* Array for holding types considered "built-in". These types - are output in the module in which `main' is defined. */ -static tree *builtin_type_tdescs_arr; -static int builtin_type_tdescs_len, builtin_type_tdescs_max; -#endif - -/* Push the declarations of builtin types into the namespace. - RID_INDEX, if < RID_MAX is the index of the builtin type - in the array RID_POINTERS. NAME is the name used when looking - up the builtin type. TYPE is the _TYPE node for the builtin type. */ - -static void -record_builtin_type (rid_index, name, type) - enum rid rid_index; - const char *name; - tree type; -{ - tree rname = NULL_TREE, tname = NULL_TREE; - tree tdecl = NULL_TREE; - - if ((int) rid_index < (int) RID_MAX) - rname = ridpointers[(int) rid_index]; - if (name) - tname = get_identifier (name); - - TYPE_BUILT_IN (type) = 1; - - if (tname) - { - tdecl = pushdecl (build_decl (TYPE_DECL, tname, type)); - set_identifier_type_value (tname, NULL_TREE); - if ((int) rid_index < (int) RID_MAX) - /* Built-in types live in the global namespace. */ - SET_IDENTIFIER_GLOBAL_VALUE (tname, tdecl); - } - if (rname != NULL_TREE) - { - if (tname != NULL_TREE) - { - set_identifier_type_value (rname, NULL_TREE); - SET_IDENTIFIER_GLOBAL_VALUE (rname, tdecl); - } - else - { - tdecl = pushdecl (build_decl (TYPE_DECL, rname, type)); - set_identifier_type_value (rname, NULL_TREE); - } - } -} - -/* Record one of the standard Java types. - * Declare it as having the given NAME. - * If SIZE > 0, it is the size of one of the integral types; - * otherwise it is the negative of the size of one of the other types. */ - -static tree -record_builtin_java_type (name, size) - const char *name; - int size; -{ - tree type, decl; - if (size > 0) - type = make_signed_type (size); - else if (size > -32) - { /* "__java_char" or ""__java_boolean". */ - type = make_unsigned_type (-size); - /*if (size == -1) TREE_SET_CODE (type, BOOLEAN_TYPE);*/ - } - else - { /* "__java_float" or ""__java_double". */ - type = make_node (REAL_TYPE); - TYPE_PRECISION (type) = - size; - layout_type (type); - } - record_builtin_type (RID_MAX, name, type); - decl = TYPE_NAME (type); - - /* Suppress generate debug symbol entries for these types, - since for normal C++ they are just clutter. - However, push_lang_context undoes this if extern "Java" is seen. */ - DECL_IGNORED_P (decl) = 1; - - TYPE_FOR_JAVA (type) = 1; - return type; -} - -/* Push a type into the namespace so that the back-ends ignore it. */ - -static void -record_unknown_type (type, name) - tree type; - const char *name; -{ - tree decl = pushdecl (build_decl (TYPE_DECL, get_identifier (name), type)); - /* Make sure the "unknown type" typedecl gets ignored for debug info. */ - DECL_IGNORED_P (decl) = 1; - TYPE_DECL_SUPPRESS_DEBUG (decl) = 1; - TYPE_SIZE (type) = TYPE_SIZE (void_type_node); - TYPE_ALIGN (type) = 1; - TYPE_MODE (type) = TYPE_MODE (void_type_node); -} - -/* Push overloaded decl, in global scope, with one argument so it - can be used as a callback from define_function. */ - -static void -push_overloaded_decl_1 (x) - tree x; -{ - push_overloaded_decl (x, PUSH_GLOBAL); -} - -#ifdef __GNUC__ -__inline -#endif -tree -auto_function (name, type, code) - tree name, type; - enum built_in_function code; -{ - return define_function - (IDENTIFIER_POINTER (name), type, code, push_overloaded_decl_1, - IDENTIFIER_POINTER (build_decl_overload (name, TYPE_ARG_TYPES (type), - 0))); -} - -/* Create the predefined scalar types of C, - and some nodes representing standard constants (0, 1, (void *)0). - Initialize the global binding level. - Make definitions for built-in primitive functions. */ - -void -init_decl_processing () -{ - register tree endlink, int_endlink, double_endlink, unsigned_endlink; - tree fields[20]; - /* Data type of memcpy. */ - tree memcpy_ftype, strlen_ftype; - int wchar_type_size; - tree temp; - tree array_domain_type; - tree vb_off_identifier = NULL_TREE; - /* Function type `char *(char *, char *)' and similar ones */ - tree string_ftype_ptr_ptr, int_ftype_string_string; - tree sizetype_endlink; - tree ptr_ftype, ptr_ftype_unsigned, ptr_ftype_sizetype; - tree void_ftype, void_ftype_int, void_ftype_ptr; - - /* Have to make these distinct before we try using them. */ - lang_name_cplusplus = get_identifier ("C++"); - lang_name_c = get_identifier ("C"); - lang_name_java = get_identifier ("Java"); - - /* Enter the global namespace. */ - my_friendly_assert (global_namespace == NULL_TREE, 375); - my_friendly_assert (current_lang_name == NULL_TREE, 375); - current_lang_name = lang_name_cplusplus; - push_namespace (get_identifier ("::")); - global_namespace = current_namespace; - current_lang_name = NULL_TREE; - - if (flag_strict_prototype == 2) - flag_strict_prototype = pedantic; - if (! flag_permissive && ! pedantic) - flag_pedantic_errors = 1; - - strict_prototypes_lang_c = flag_strict_prototype; - - /* Initially, C. */ - current_lang_name = lang_name_c; - - current_function_decl = NULL_TREE; - named_labels = NULL_TREE; - named_label_uses = NULL; - current_binding_level = NULL_BINDING_LEVEL; - free_binding_level = NULL_BINDING_LEVEL; - - /* Because most segmentation signals can be traced back into user - code, catch them and at least give the user a chance of working - around compiler bugs. */ - signal (SIGSEGV, signal_catch); - - /* We will also catch aborts in the back-end through signal_catch and - give the user a chance to see where the error might be, and to defeat - aborts in the back-end when there have been errors previously in their - code. */ -#ifdef SIGIOT - signal (SIGIOT, signal_catch); -#endif -#ifdef SIGILL - signal (SIGILL, signal_catch); -#endif -#ifdef SIGABRT - signal (SIGABRT, signal_catch); -#endif -#ifdef SIGBUS - signal (SIGBUS, signal_catch); -#endif - - gcc_obstack_init (&decl_obstack); - - /* Must lay these out before anything else gets laid out. */ - error_mark_node = make_node (ERROR_MARK); - TREE_PERMANENT (error_mark_node) = 1; - TREE_TYPE (error_mark_node) = error_mark_node; - error_mark_list = build_tree_list (error_mark_node, error_mark_node); - TREE_TYPE (error_mark_list) = error_mark_node; - - /* Make the binding_level structure for global names. */ - pushlevel (0); - global_binding_level = current_binding_level; - /* The global level is the namespace level of ::. */ - NAMESPACE_LEVEL (global_namespace) = global_binding_level; - declare_namespace_level (); - - this_identifier = get_identifier (THIS_NAME); - in_charge_identifier = get_identifier (IN_CHARGE_NAME); - vlist_identifier = get_identifier (VLIST_NAME); - ctor_identifier = get_identifier (CTOR_NAME); - dtor_identifier = get_identifier (DTOR_NAME); - pfn_identifier = get_identifier (VTABLE_PFN_NAME); - index_identifier = get_identifier (VTABLE_INDEX_NAME); - delta_identifier = get_identifier (VTABLE_DELTA_NAME); - delta2_identifier = get_identifier (VTABLE_DELTA2_NAME); - pfn_or_delta2_identifier = get_identifier ("__pfn_or_delta2"); - if (flag_handle_signatures) - { - tag_identifier = get_identifier (SIGTABLE_TAG_NAME); - vb_off_identifier = get_identifier (SIGTABLE_VB_OFF_NAME); - vt_off_identifier = get_identifier (SIGTABLE_VT_OFF_NAME); - } - - /* Define `int' and `char' first so that dbx will output them first. */ - - integer_type_node = make_signed_type (INT_TYPE_SIZE); - record_builtin_type (RID_INT, NULL_PTR, integer_type_node); - - /* Define `char', which is like either `signed char' or `unsigned char' - but not the same as either. */ - - char_type_node - = (flag_signed_char - ? make_signed_type (CHAR_TYPE_SIZE) - : make_unsigned_type (CHAR_TYPE_SIZE)); - record_builtin_type (RID_CHAR, "char", char_type_node); - - /* `signed' is the same as `int' */ - record_builtin_type (RID_SIGNED, NULL_PTR, integer_type_node); - - long_integer_type_node = make_signed_type (LONG_TYPE_SIZE); - record_builtin_type (RID_LONG, "long int", long_integer_type_node); - - unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE); - record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node); - - long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE); - record_builtin_type (RID_MAX, "long unsigned int", long_unsigned_type_node); - record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node); - - long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE); - record_builtin_type (RID_MAX, "long long int", long_long_integer_type_node); - - long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE); - record_builtin_type (RID_MAX, "long long unsigned int", - long_long_unsigned_type_node); - record_builtin_type (RID_MAX, "long long unsigned", - long_long_unsigned_type_node); - - short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE); - record_builtin_type (RID_SHORT, "short int", short_integer_type_node); - short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE); - record_builtin_type (RID_MAX, "short unsigned int", short_unsigned_type_node); - record_builtin_type (RID_MAX, "unsigned short", short_unsigned_type_node); - - /* `unsigned long' is the standard type for sizeof. - Note that stddef.h uses `unsigned long', - and this must agree, even if long and int are the same size. */ - set_sizetype - (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)))); - - ptrdiff_type_node - = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE))); - - /* Define both `signed char' and `unsigned char'. */ - signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE); - record_builtin_type (RID_MAX, "signed char", signed_char_type_node); - unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE); - record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node); - - /* These are types that type_for_size and type_for_mode use. */ - intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node)); - intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node)); - intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node)); - intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node)); -#if HOST_BITS_PER_WIDE_INT >= 64 - intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("__int128_t"), intTI_type_node)); -#endif - unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node)); - unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node)); - unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node)); - unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node)); -#if HOST_BITS_PER_WIDE_INT >= 64 - unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("__uint128_t"), unsigned_intTI_type_node)); -#endif - - float_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE; - record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node); - layout_type (float_type_node); - - double_type_node = make_node (REAL_TYPE); - if (flag_short_double) - TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE; - else - TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE; - record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node); - layout_type (double_type_node); - - long_double_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE; - record_builtin_type (RID_MAX, "long double", long_double_type_node); - layout_type (long_double_type_node); - - complex_integer_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), - complex_integer_type_node)); - TREE_TYPE (complex_integer_type_node) = integer_type_node; - layout_type (complex_integer_type_node); - - complex_float_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), - complex_float_type_node)); - TREE_TYPE (complex_float_type_node) = float_type_node; - layout_type (complex_float_type_node); - - complex_double_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), - complex_double_type_node)); - TREE_TYPE (complex_double_type_node) = double_type_node; - layout_type (complex_double_type_node); - - complex_long_double_type_node = make_node (COMPLEX_TYPE); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), - complex_long_double_type_node)); - TREE_TYPE (complex_long_double_type_node) = long_double_type_node; - layout_type (complex_long_double_type_node); - - java_byte_type_node = record_builtin_java_type ("__java_byte", 8); - java_short_type_node = record_builtin_java_type ("__java_short", 16); - java_int_type_node = record_builtin_java_type ("__java_int", 32); - java_long_type_node = record_builtin_java_type ("__java_long", 64); - java_float_type_node = record_builtin_java_type ("__java_float", -32); - java_double_type_node = record_builtin_java_type ("__java_double", -64); - java_char_type_node = record_builtin_java_type ("__java_char", -16); - java_boolean_type_node = record_builtin_java_type ("__java_boolean", -1); - - integer_zero_node = build_int_2 (0, 0); - TREE_TYPE (integer_zero_node) = integer_type_node; - integer_one_node = build_int_2 (1, 0); - TREE_TYPE (integer_one_node) = integer_type_node; - integer_two_node = build_int_2 (2, 0); - TREE_TYPE (integer_two_node) = integer_type_node; - integer_three_node = build_int_2 (3, 0); - TREE_TYPE (integer_three_node) = integer_type_node; - - boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE); - TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE); - TYPE_MAX_VALUE (boolean_type_node) = build_int_2 (1, 0); - TREE_TYPE (TYPE_MAX_VALUE (boolean_type_node)) = boolean_type_node; - TYPE_PRECISION (boolean_type_node) = 1; - record_builtin_type (RID_BOOL, "bool", boolean_type_node); - boolean_false_node = build_int_2 (0, 0); - TREE_TYPE (boolean_false_node) = boolean_type_node; - boolean_true_node = build_int_2 (1, 0); - TREE_TYPE (boolean_true_node) = boolean_type_node; - - /* These are needed by stor-layout.c. */ - size_zero_node = size_int (0); - size_one_node = size_int (1); - - signed_size_zero_node = build_int_2 (0, 0); - TREE_TYPE (signed_size_zero_node) = make_signed_type (TYPE_PRECISION (sizetype)); - - void_type_node = make_node (VOID_TYPE); - record_builtin_type (RID_VOID, NULL_PTR, void_type_node); - layout_type (void_type_node); /* Uses integer_zero_node. */ - void_list_node = build_tree_list (NULL_TREE, void_type_node); - TREE_PARMLIST (void_list_node) = 1; - - null_pointer_node = build_int_2 (0, 0); - TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node); - layout_type (TREE_TYPE (null_pointer_node)); - - /* Used for expressions that do nothing, but are not errors. */ - void_zero_node = build_int_2 (0, 0); - TREE_TYPE (void_zero_node) = void_type_node; - - string_type_node = build_pointer_type (char_type_node); - const_string_type_node - = build_pointer_type (build_qualified_type (char_type_node, - TYPE_QUAL_CONST)); -#if 0 - record_builtin_type (RID_MAX, NULL_PTR, string_type_node); -#endif - - /* Make a type to be the domain of a few array types - whose domains don't really matter. - 200 is small enough that it always fits in size_t - and large enough that it can hold most function names for the - initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */ - array_domain_type = build_index_type (build_int_2 (200, 0)); - - /* Make a type for arrays of characters. - With luck nothing will ever really depend on the length of this - array type. */ - char_array_type_node - = build_array_type (char_type_node, array_domain_type); - /* Likewise for arrays of ints. */ - int_array_type_node - = build_array_type (integer_type_node, array_domain_type); - - /* This is just some anonymous class type. Nobody should ever - need to look inside this envelope. */ - class_star_type_node = build_pointer_type (make_lang_type (RECORD_TYPE)); - - default_function_type - = build_function_type (integer_type_node, NULL_TREE); - - ptr_type_node = build_pointer_type (void_type_node); - const_ptr_type_node - = build_pointer_type (build_qualified_type (void_type_node, - TYPE_QUAL_CONST)); -#if 0 - record_builtin_type (RID_MAX, NULL_PTR, ptr_type_node); -#endif - - endlink = void_list_node; - int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink); - double_endlink = tree_cons (NULL_TREE, double_type_node, endlink); - unsigned_endlink = tree_cons (NULL_TREE, unsigned_type_node, endlink); - - ptr_ftype = build_function_type (ptr_type_node, NULL_TREE); - ptr_ftype_unsigned = build_function_type (ptr_type_node, unsigned_endlink); - sizetype_endlink = tree_cons (NULL_TREE, sizetype, endlink); - /* We realloc here because sizetype could be int or unsigned. S'ok. */ - ptr_ftype_sizetype = build_function_type (ptr_type_node, sizetype_endlink); - - void_ftype = build_function_type (void_type_node, endlink); - void_ftype_int = build_function_type (void_type_node, int_endlink); - void_ftype_ptr - = build_function_type (void_type_node, - tree_cons (NULL_TREE, ptr_type_node, endlink)); - void_ftype_ptr - = build_exception_variant (void_ftype_ptr, - tree_cons (NULL_TREE, NULL_TREE, NULL_TREE)); - - float_ftype_float - = build_function_type (float_type_node, - tree_cons (NULL_TREE, float_type_node, endlink)); - - double_ftype_double - = build_function_type (double_type_node, double_endlink); - - ldouble_ftype_ldouble - = build_function_type (long_double_type_node, - tree_cons (NULL_TREE, long_double_type_node, - endlink)); - - double_ftype_double_double - = build_function_type (double_type_node, - tree_cons (NULL_TREE, double_type_node, - double_endlink)); - - int_ftype_int - = build_function_type (integer_type_node, int_endlink); - - long_ftype_long - = build_function_type (long_integer_type_node, - tree_cons (NULL_TREE, long_integer_type_node, - endlink)); - - int_ftype_cptr_cptr_sizet - = build_function_type (integer_type_node, - tree_cons (NULL_TREE, const_ptr_type_node, - tree_cons (NULL_TREE, const_ptr_type_node, - tree_cons (NULL_TREE, - sizetype, - endlink)))); - - string_ftype_ptr_ptr /* strcpy prototype */ - = build_function_type (string_type_node, - tree_cons (NULL_TREE, string_type_node, - tree_cons (NULL_TREE, - const_string_type_node, - endlink))); - - int_ftype_string_string /* strcmp prototype */ - = build_function_type (integer_type_node, - tree_cons (NULL_TREE, const_string_type_node, - tree_cons (NULL_TREE, - const_string_type_node, - endlink))); - - strlen_ftype /* strlen prototype */ - = build_function_type (sizetype, - tree_cons (NULL_TREE, const_string_type_node, - endlink)); - - memcpy_ftype /* memcpy prototype */ - = build_function_type (ptr_type_node, - tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, const_ptr_type_node, - sizetype_endlink))); - - if (flag_huge_objects) - delta_type_node = long_integer_type_node; - else - delta_type_node = short_integer_type_node; - - builtin_function ("__builtin_constant_p", default_function_type, - BUILT_IN_CONSTANT_P, NULL_PTR); - - builtin_return_address_fndecl - = builtin_function ("__builtin_return_address", ptr_ftype_unsigned, - BUILT_IN_RETURN_ADDRESS, NULL_PTR); - - builtin_function ("__builtin_frame_address", ptr_ftype_unsigned, - BUILT_IN_FRAME_ADDRESS, NULL_PTR); - - builtin_function ("__builtin_alloca", ptr_ftype_sizetype, - BUILT_IN_ALLOCA, "alloca"); - builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR); - /* Define alloca, ffs as builtins. - Declare _exit just to mark it as volatile. */ - if (! flag_no_builtin && !flag_no_nonansi_builtin) - { - temp = builtin_function ("alloca", ptr_ftype_sizetype, - BUILT_IN_ALLOCA, NULL_PTR); - /* Suppress error if redefined as a non-function. */ - DECL_BUILT_IN_NONANSI (temp) = 1; - temp = builtin_function ("ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR); - /* Suppress error if redefined as a non-function. */ - DECL_BUILT_IN_NONANSI (temp) = 1; - temp = builtin_function ("_exit", void_ftype_int, - NOT_BUILT_IN, NULL_PTR); - TREE_THIS_VOLATILE (temp) = 1; - TREE_SIDE_EFFECTS (temp) = 1; - /* Suppress error if redefined as a non-function. */ - DECL_BUILT_IN_NONANSI (temp) = 1; - } - - builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR); - builtin_function ("__builtin_fabsf", float_ftype_float, BUILT_IN_FABS, - NULL_PTR); - builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS, - NULL_PTR); - builtin_function ("__builtin_fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS, - NULL_PTR); - builtin_function ("__builtin_labs", long_ftype_long, - BUILT_IN_LABS, NULL_PTR); - builtin_function ("__builtin_saveregs", ptr_ftype, - BUILT_IN_SAVEREGS, NULL_PTR); - builtin_function ("__builtin_classify_type", default_function_type, - BUILT_IN_CLASSIFY_TYPE, NULL_PTR); - builtin_function ("__builtin_next_arg", ptr_ftype, - BUILT_IN_NEXT_ARG, NULL_PTR); - builtin_function ("__builtin_args_info", int_ftype_int, - BUILT_IN_ARGS_INFO, NULL_PTR); - builtin_function ("__builtin_setjmp", - build_function_type (integer_type_node, - tree_cons (NULL_TREE, ptr_type_node, - endlink)), - BUILT_IN_SETJMP, NULL_PTR); - builtin_function ("__builtin_longjmp", - build_function_type (integer_type_node, - tree_cons (NULL_TREE, ptr_type_node, - tree_cons (NULL_TREE, - integer_type_node, - endlink))), - BUILT_IN_LONGJMP, NULL_PTR); - - /* Untyped call and return. */ - builtin_function ("__builtin_apply_args", ptr_ftype, - BUILT_IN_APPLY_ARGS, NULL_PTR); - - temp = tree_cons (NULL_TREE, - build_pointer_type (build_function_type (void_type_node, - NULL_TREE)), - tree_cons (NULL_TREE, ptr_ftype_sizetype, NULL_TREE)); - builtin_function ("__builtin_apply", - build_function_type (ptr_type_node, temp), - BUILT_IN_APPLY, NULL_PTR); - builtin_function ("__builtin_return", void_ftype_ptr, - BUILT_IN_RETURN, NULL_PTR); - - /* Currently under experimentation. */ - builtin_function ("__builtin_memcpy", memcpy_ftype, - BUILT_IN_MEMCPY, "memcpy"); - builtin_function ("__builtin_memcmp", int_ftype_cptr_cptr_sizet, - BUILT_IN_MEMCMP, "memcmp"); - builtin_function ("__builtin_strcmp", int_ftype_string_string, - BUILT_IN_STRCMP, "strcmp"); - builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr, - BUILT_IN_STRCPY, "strcpy"); - builtin_function ("__builtin_strlen", strlen_ftype, - BUILT_IN_STRLEN, "strlen"); - builtin_function ("__builtin_sqrtf", float_ftype_float, - BUILT_IN_FSQRT, "sqrtf"); - builtin_function ("__builtin_fsqrt", double_ftype_double, - BUILT_IN_FSQRT, NULL_PTR); - builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble, - BUILT_IN_FSQRT, "sqrtl"); - builtin_function ("__builtin_sinf", float_ftype_float, - BUILT_IN_SIN, "sinf"); - builtin_function ("__builtin_sin", double_ftype_double, - BUILT_IN_SIN, "sin"); - builtin_function ("__builtin_sinl", ldouble_ftype_ldouble, - BUILT_IN_SIN, "sinl"); - builtin_function ("__builtin_cosf", float_ftype_float, - BUILT_IN_COS, "cosf"); - builtin_function ("__builtin_cos", double_ftype_double, - BUILT_IN_COS, "cos"); - builtin_function ("__builtin_cosl", ldouble_ftype_ldouble, - BUILT_IN_COS, "cosl"); - - if (!flag_no_builtin) - { - builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR); - builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR); - builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR); - builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR); - builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS, - NULL_PTR); - builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, NULL_PTR); - builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP, - NULL_PTR); - builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP, - NULL_PTR); - builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY, - NULL_PTR); - builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, NULL_PTR); - builtin_function ("sqrtf", float_ftype_float, BUILT_IN_FSQRT, NULL_PTR); - builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, NULL_PTR); - builtin_function ("sqrtl", ldouble_ftype_ldouble, BUILT_IN_FSQRT, - NULL_PTR); - builtin_function ("sinf", float_ftype_float, BUILT_IN_SIN, NULL_PTR); - builtin_function ("sin", double_ftype_double, BUILT_IN_SIN, NULL_PTR); - builtin_function ("sinl", ldouble_ftype_ldouble, BUILT_IN_SIN, NULL_PTR); - builtin_function ("cosf", float_ftype_float, BUILT_IN_COS, NULL_PTR); - builtin_function ("cos", double_ftype_double, BUILT_IN_COS, NULL_PTR); - builtin_function ("cosl", ldouble_ftype_ldouble, BUILT_IN_COS, NULL_PTR); - - /* Declare these functions volatile - to avoid spurious "control drops through" warnings. */ - temp = builtin_function ("abort", void_ftype, - NOT_BUILT_IN, NULL_PTR); - TREE_THIS_VOLATILE (temp) = 1; - TREE_SIDE_EFFECTS (temp) = 1; - /* Well, these are actually ANSI, but we can't set DECL_BUILT_IN on - them... */ - DECL_BUILT_IN_NONANSI (temp) = 1; - temp = builtin_function ("exit", void_ftype_int, - NOT_BUILT_IN, NULL_PTR); - TREE_THIS_VOLATILE (temp) = 1; - TREE_SIDE_EFFECTS (temp) = 1; - DECL_BUILT_IN_NONANSI (temp) = 1; - } - -#if 0 - /* Support for these has not been written in either expand_builtin - or build_function_call. */ - builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, NULL_PTR); - builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, NULL_PTR); - builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR, - NULL_PTR); - builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL, - NULL_PTR); - builtin_function ("__builtin_fmod", double_ftype_double_double, - BUILT_IN_FMOD, NULL_PTR); - builtin_function ("__builtin_frem", double_ftype_double_double, - BUILT_IN_FREM, NULL_PTR); - builtin_function ("__builtin_memset", ptr_ftype_ptr_int_int, - BUILT_IN_MEMSET, NULL_PTR); - builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP, - NULL_PTR); - builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN, - NULL_PTR); -#endif - - /* C++ extensions */ - - unknown_type_node = make_node (UNKNOWN_TYPE); - record_unknown_type (unknown_type_node, "unknown type"); - - /* Indirecting an UNKNOWN_TYPE node yields an UNKNOWN_TYPE node. */ - TREE_TYPE (unknown_type_node) = unknown_type_node; - - TREE_TYPE (null_node) = type_for_size (POINTER_SIZE, 0); - - /* Looking up TYPE_POINTER_TO and TYPE_REFERENCE_TO yield the same - result. */ - TYPE_POINTER_TO (unknown_type_node) = unknown_type_node; - TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node; - - /* This is for handling opaque types in signatures. */ - opaque_type_node = copy_node (ptr_type_node); - TYPE_MAIN_VARIANT (opaque_type_node) = opaque_type_node; - record_builtin_type (RID_MAX, 0, opaque_type_node); - - /* This is special for C++ so functions can be overloaded. */ - wchar_type_node - = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WCHAR_TYPE))); - wchar_type_size = TYPE_PRECISION (wchar_type_node); - signed_wchar_type_node = make_signed_type (wchar_type_size); - unsigned_wchar_type_node = make_unsigned_type (wchar_type_size); - wchar_type_node - = TREE_UNSIGNED (wchar_type_node) - ? unsigned_wchar_type_node - : signed_wchar_type_node; - record_builtin_type (RID_WCHAR, "__wchar_t", wchar_type_node); - - /* Artificial declaration of wchar_t -- can be bashed */ - wchar_decl_node = build_decl (TYPE_DECL, get_identifier ("wchar_t"), - wchar_type_node); - pushdecl (wchar_decl_node); - - /* This is for wide string constants. */ - wchar_array_type_node - = build_array_type (wchar_type_node, array_domain_type); - - if (flag_vtable_thunks) - { - /* Make sure we get a unique function type, so we can give - its pointer type a name. (This wins for gdb.) */ - tree vfunc_type = make_node (FUNCTION_TYPE); - TREE_TYPE (vfunc_type) = integer_type_node; - TYPE_ARG_TYPES (vfunc_type) = NULL_TREE; - layout_type (vfunc_type); - - vtable_entry_type = build_pointer_type (vfunc_type); - } - else - { - vtable_entry_type = make_lang_type (RECORD_TYPE); - fields[0] = build_lang_field_decl (FIELD_DECL, delta_identifier, - delta_type_node); - fields[1] = build_lang_field_decl (FIELD_DECL, index_identifier, - delta_type_node); - fields[2] = build_lang_field_decl (FIELD_DECL, pfn_identifier, - ptr_type_node); - finish_builtin_type (vtable_entry_type, VTBL_PTR_TYPE, fields, 2, - double_type_node); - - /* Make this part of an invisible union. */ - fields[3] = copy_node (fields[2]); - TREE_TYPE (fields[3]) = delta_type_node; - DECL_NAME (fields[3]) = delta2_identifier; - DECL_MODE (fields[3]) = TYPE_MODE (delta_type_node); - DECL_SIZE (fields[3]) = TYPE_SIZE (delta_type_node); - TREE_UNSIGNED (fields[3]) = 0; - TREE_CHAIN (fields[2]) = fields[3]; - vtable_entry_type = build_qualified_type (vtable_entry_type, - TYPE_QUAL_CONST); - } - record_builtin_type (RID_MAX, VTBL_PTR_TYPE, vtable_entry_type); - - vtbl_type_node - = build_cplus_array_type (vtable_entry_type, NULL_TREE); - layout_type (vtbl_type_node); - vtbl_type_node = build_qualified_type (vtbl_type_node, TYPE_QUAL_CONST); - record_builtin_type (RID_MAX, NULL_PTR, vtbl_type_node); - vtbl_ptr_type_node = build_pointer_type (vtable_entry_type); - layout_type (vtbl_ptr_type_node); - record_builtin_type (RID_MAX, NULL_PTR, vtbl_ptr_type_node); - - if (flag_vtable_thunks) - { - /* We need vlists only when using thunks; otherwise leave them - as NULL_TREE. That way, it doesn't get into the way of the - mangling. */ - vlist_type_node = build_pointer_type (vtbl_ptr_type_node); - vlist_zero_node = build_int_2 (0, 0); - TREE_TYPE (vlist_zero_node) = vlist_type_node; - } - - /* Simplify life by making a "sigtable_entry_type". Give its - fields names so that the debugger can use them. */ - - if (flag_handle_signatures) - { - sigtable_entry_type = make_lang_type (RECORD_TYPE); - fields[0] = build_lang_field_decl (FIELD_DECL, tag_identifier, - delta_type_node); - fields[1] = build_lang_field_decl (FIELD_DECL, vb_off_identifier, - delta_type_node); - fields[2] = build_lang_field_decl (FIELD_DECL, delta_identifier, - delta_type_node); - fields[3] = build_lang_field_decl (FIELD_DECL, index_identifier, - delta_type_node); - fields[4] = build_lang_field_decl (FIELD_DECL, pfn_identifier, - ptr_type_node); - - /* Set the alignment to the max of the alignment of ptr_type_node and - delta_type_node. Double alignment wastes a word on the Sparc. */ - finish_builtin_type (sigtable_entry_type, SIGTABLE_PTR_TYPE, fields, 4, - (TYPE_ALIGN (ptr_type_node) > TYPE_ALIGN (delta_type_node)) - ? ptr_type_node - : delta_type_node); - - /* Make this part of an invisible union. */ - fields[5] = copy_node (fields[4]); - TREE_TYPE (fields[5]) = delta_type_node; - DECL_NAME (fields[5]) = vt_off_identifier; - DECL_MODE (fields[5]) = TYPE_MODE (delta_type_node); - DECL_SIZE (fields[5]) = TYPE_SIZE (delta_type_node); - TREE_UNSIGNED (fields[5]) = 0; - TREE_CHAIN (fields[4]) = fields[5]; - - sigtable_entry_type = build_qualified_type (sigtable_entry_type, - TYPE_QUAL_CONST); - record_builtin_type (RID_MAX, SIGTABLE_PTR_TYPE, sigtable_entry_type); - } - - std_node = build_decl (NAMESPACE_DECL, - get_identifier (flag_honor_std ? "fake std":"std"), - void_type_node); - pushdecl (std_node); - - global_type_node = make_node (LANG_TYPE); - record_unknown_type (global_type_node, "global type"); - - /* Now, C++. */ - current_lang_name = lang_name_cplusplus; - - { - tree bad_alloc_type_node, newtype, deltype; - if (flag_honor_std) - push_namespace (get_identifier ("std")); - bad_alloc_type_node = xref_tag - (class_type_node, get_identifier ("bad_alloc"), 1); - if (flag_honor_std) - pop_namespace (); - newtype = build_exception_variant - (ptr_ftype_sizetype, build_tree_list (NULL_TREE, bad_alloc_type_node)); - deltype = build_exception_variant - (void_ftype_ptr, build_tree_list (NULL_TREE, NULL_TREE)); - auto_function (ansi_opname[(int) NEW_EXPR], newtype, NOT_BUILT_IN); - auto_function (ansi_opname[(int) VEC_NEW_EXPR], newtype, NOT_BUILT_IN); - global_delete_fndecl - = auto_function (ansi_opname[(int) DELETE_EXPR], deltype, NOT_BUILT_IN); - auto_function (ansi_opname[(int) VEC_DELETE_EXPR], deltype, NOT_BUILT_IN); - } - - abort_fndecl - = define_function ("__pure_virtual", void_ftype, - NOT_BUILT_IN, 0, 0); - - /* Perform other language dependent initializations. */ - init_class_processing (); - init_init_processing (); - init_search_processing (); - if (flag_rtti) - init_rtti_processing (); - - if (flag_exceptions) - init_exception_processing (); - if (flag_no_inline) - { - flag_inline_functions = 0; - } - - if (! supports_one_only ()) - flag_weak = 0; - - /* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */ - declare_function_name (); - - /* Prepare to check format strings against argument lists. */ - init_function_format_info (); - - /* Show we use EH for cleanups. */ - using_eh_for_cleanups (); - - print_error_function = lang_print_error_function; - lang_get_alias_set = &c_get_alias_set; - valid_lang_attribute = cp_valid_lang_attribute; - - /* Maintain consistency. Perhaps we should just complain if they - say -fwritable-strings? */ - if (flag_writable_strings) - flag_const_strings = 0; -} - -/* Function to print any language-specific context for an error message. */ - -static void -lang_print_error_function (file) - char *file; -{ - default_print_error_function (file); - maybe_print_template_context (); -} - -/* Make a definition for a builtin function named NAME and whose data type - is TYPE. TYPE should be a function type with argument types. - FUNCTION_CODE tells later passes how to compile calls to this function. - See tree.h for its possible values. - - If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME, - the name to be called if we can't opencode the function. */ - -tree -define_function (name, type, function_code, pfn, library_name) - const char *name; - tree type; - enum built_in_function function_code; - void (*pfn) PROTO((tree)); - const char *library_name; -{ - tree decl = build_lang_decl (FUNCTION_DECL, get_identifier (name), type); - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; - DECL_ARTIFICIAL (decl) = 1; - - my_friendly_assert (DECL_CONTEXT (decl) == NULL_TREE, 392); - DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); - - /* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME, - we cannot change DECL_ASSEMBLER_NAME until we have installed this - function in the namespace. */ - if (pfn) (*pfn) (decl); - if (library_name) - DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name); - make_function_rtl (decl); - if (function_code != NOT_BUILT_IN) - { - DECL_BUILT_IN (decl) = 1; - DECL_FUNCTION_CODE (decl) = function_code; - } - return decl; -} - -/* When we call finish_struct for an anonymous union, we create - default copy constructors and such. But, an anonymous union - shouldn't have such things; this function undoes the damage to the - anonymous union type T. - - (The reason that we create the synthesized methods is that we don't - distinguish `union { int i; }' from `typedef union { int i; } U'. - The first is an anonymous union; the second is just an ordinary - union type.) */ - -void -fixup_anonymous_union (t) - tree t; -{ - tree *q; - - /* Wipe out memory of synthesized methods */ - TYPE_HAS_CONSTRUCTOR (t) = 0; - TYPE_HAS_DEFAULT_CONSTRUCTOR (t) = 0; - TYPE_HAS_INIT_REF (t) = 0; - TYPE_HAS_CONST_INIT_REF (t) = 0; - TYPE_HAS_ASSIGN_REF (t) = 0; - TYPE_HAS_CONST_ASSIGN_REF (t) = 0; - - /* Splice the implicitly generated functions out of the TYPE_METHODS - list. */ - q = &TYPE_METHODS (t); - while (*q) - { - if (DECL_ARTIFICIAL (*q)) - *q = TREE_CHAIN (*q); - else - q = &TREE_CHAIN (*q); - } - - /* ANSI C++ June 5 1992 WP 9.5.3. Anonymous unions may not have - function members. */ - if (TYPE_METHODS (t)) - error ("an anonymous union cannot have function members"); -} - -/* Make sure that a declaration with no declarator is well-formed, i.e. - just defines a tagged type or anonymous union. - - Returns the type defined, if any. */ - -tree -check_tag_decl (declspecs) - tree declspecs; -{ - int found_type = 0; - tree ob_modifier = NULL_TREE; - register tree link; - register tree t = NULL_TREE; - - for (link = declspecs; link; link = TREE_CHAIN (link)) - { - register tree value = TREE_VALUE (link); - - if (TYPE_P (value)) - { - ++found_type; - - if (IS_AGGR_TYPE (value) || TREE_CODE (value) == ENUMERAL_TYPE) - { - my_friendly_assert (TYPE_MAIN_DECL (value) != NULL_TREE, 261); - t = value; - } - } - else if (value == ridpointers[(int) RID_FRIEND]) - { - if (current_class_type == NULL_TREE - || current_scope () != current_class_type) - ob_modifier = value; - } - else if (value == ridpointers[(int) RID_STATIC] - || value == ridpointers[(int) RID_EXTERN] - || value == ridpointers[(int) RID_AUTO] - || value == ridpointers[(int) RID_REGISTER] - || value == ridpointers[(int) RID_INLINE] - || value == ridpointers[(int) RID_VIRTUAL] - || value == ridpointers[(int) RID_CONST] - || value == ridpointers[(int) RID_VOLATILE] - || value == ridpointers[(int) RID_EXPLICIT]) - ob_modifier = value; - } - - if (found_type > 1) - error ("multiple types in one declaration"); - - /* Inside a class, we might be in a friend or access declaration. - Until we have a good way of detecting the latter, don't warn. */ - if (t == NULL_TREE && ! current_class_type) - pedwarn ("declaration does not declare anything"); - - /* Check for an anonymous union. We're careful - accessing TYPE_IDENTIFIER because some built-in types, like - pointer-to-member types, do not have TYPE_NAME. */ - else if (t && TREE_CODE (t) == UNION_TYPE - && TYPE_NAME (t) - && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))) - { - /* Anonymous unions are objects, so they can have specifiers. */; - SET_ANON_UNION_TYPE_P (t); - } - - else if (ob_modifier) - { - if (ob_modifier == ridpointers[(int) RID_INLINE] - || ob_modifier == ridpointers[(int) RID_VIRTUAL]) - cp_error ("`%D' can only be specified for functions", ob_modifier); - else if (ob_modifier == ridpointers[(int) RID_FRIEND]) - cp_error ("`%D' can only be specified inside a class", ob_modifier); - else if (ob_modifier == ridpointers[(int) RID_EXPLICIT]) - cp_error ("`%D' can only be specified for constructors", - ob_modifier); - else - cp_error ("`%D' can only be specified for objects and functions", - ob_modifier); - } - - return t; -} - -/* Called when a declaration is seen that contains no names to declare. - If its type is a reference to a structure, union or enum inherited - from a containing scope, shadow that tag name for the current scope - with a forward reference. - If its type defines a new named structure or union - or defines an enum, it is valid but we need not do anything here. - Otherwise, it is an error. - - C++: may have to grok the declspecs to learn about static, - complain for anonymous unions. */ - -void -shadow_tag (declspecs) - tree declspecs; -{ - tree t = check_tag_decl (declspecs); - - if (t) - maybe_process_partial_specialization (t); - - /* This is where the variables in an anonymous union are - declared. An anonymous union declaration looks like: - union { ... } ; - because there is no declarator after the union, the parser - sends that declaration here. */ - if (t && ANON_UNION_TYPE_P (t)) - { - fixup_anonymous_union (t); - - if (TYPE_FIELDS (t)) - { - tree decl = grokdeclarator (NULL_TREE, declspecs, NORMAL, 0, - NULL_TREE); - finish_anon_union (decl); - } - } -} - -/* Decode a "typename", such as "int **", returning a ..._TYPE node. */ - -tree -groktypename (typename) - tree typename; -{ - if (TREE_CODE (typename) != TREE_LIST) - return typename; - return grokdeclarator (TREE_VALUE (typename), - TREE_PURPOSE (typename), - TYPENAME, 0, NULL_TREE); -} - -/* Decode a declarator in an ordinary declaration or data definition. - This is called as soon as the type information and variable name - have been parsed, before parsing the initializer if any. - Here we create the ..._DECL node, fill in its type, - and put it on the list of decls for the current context. - The ..._DECL node is returned as the value. - - Exception: for arrays where the length is not specified, - the type is left null, to be filled in by `cp_finish_decl'. - - Function definitions do not come here; they go to start_function - instead. However, external and forward declarations of functions - do go through here. Structure field declarations are done by - grokfield and not through here. */ - -/* Set this to zero to debug not using the temporary obstack - to parse initializers. */ -int debug_temp_inits = 1; - -tree -start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) - tree declarator, declspecs; - int initialized; - tree attributes, prefix_attributes; -{ - register tree decl; - register tree type, tem; - tree context; - extern int have_extern_spec; - extern int used_extern_spec; - tree attrlist; - -#if 0 - /* See code below that used this. */ - int init_written = initialized; -#endif - - /* This should only be done once on the top most decl. */ - if (have_extern_spec && !used_extern_spec) - { - declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"), - declspecs); - used_extern_spec = 1; - } - - if (attributes || prefix_attributes) - attrlist = build_scratch_list (attributes, prefix_attributes); - else - attrlist = NULL_TREE; - - decl = grokdeclarator (declarator, declspecs, NORMAL, initialized, - attrlist); - - if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE) - return NULL_TREE; - - type = TREE_TYPE (decl); - - if (type == error_mark_node) - return NULL_TREE; - - /* Don't lose if destructors must be executed at file-level. */ - if (! processing_template_decl && TREE_STATIC (decl) - && TYPE_NEEDS_DESTRUCTOR (complete_type (type)) - && !TREE_PERMANENT (decl)) - { - push_obstacks (&permanent_obstack, &permanent_obstack); - decl = copy_node (decl); - if (TREE_CODE (type) == ARRAY_TYPE) - { - tree itype = TYPE_DOMAIN (type); - if (itype && ! TREE_PERMANENT (itype)) - { - itype = build_index_type (copy_to_permanent (TYPE_MAX_VALUE (itype))); - type = build_cplus_array_type (TREE_TYPE (type), itype); - TREE_TYPE (decl) = type; - } - } - pop_obstacks (); - } - - context - = (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl)) - ? DECL_CLASS_CONTEXT (decl) - : DECL_CONTEXT (decl); - - if (initialized && context && TREE_CODE (context) == NAMESPACE_DECL - && context != current_namespace && TREE_CODE (decl) == VAR_DECL) - { - /* When parsing the initializer, lookup should use the object's - namespace. */ - push_decl_namespace (context); - } - - /* We are only interested in class contexts, later. */ - if (context && TREE_CODE (context) == NAMESPACE_DECL) - context = NULL_TREE; - - if (initialized) - /* Is it valid for this decl to have an initializer at all? - If not, set INITIALIZED to zero, which will indirectly - tell `cp_finish_decl' to ignore the initializer once it is parsed. */ - switch (TREE_CODE (decl)) - { - case TYPE_DECL: - /* typedef foo = bar means give foo the same type as bar. - We haven't parsed bar yet, so `cp_finish_decl' will fix that up. - Any other case of an initialization in a TYPE_DECL is an error. */ - if (pedantic || list_length (declspecs) > 1) - { - cp_error ("typedef `%D' is initialized", decl); - initialized = 0; - } - break; - - case FUNCTION_DECL: - cp_error ("function `%#D' is initialized like a variable", decl); - initialized = 0; - break; - - default: - if (! processing_template_decl) - { - if (type != error_mark_node) - { - if (TYPE_SIZE (type) != NULL_TREE - && ! TREE_CONSTANT (TYPE_SIZE (type))) - { - cp_error - ("variable-sized object `%D' may not be initialized", - decl); - initialized = 0; - } - - if (TREE_CODE (type) == ARRAY_TYPE - && TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE) - { - cp_error - ("elements of array `%#D' have incomplete type", decl); - initialized = 0; - } - } - } - } - - if (initialized) - { - if (! toplevel_bindings_p () - && DECL_EXTERNAL (decl)) - cp_warning ("declaration of `%#D' has `extern' and is initialized", - decl); - DECL_EXTERNAL (decl) = 0; - if (toplevel_bindings_p ()) - TREE_STATIC (decl) = 1; - - /* Tell `pushdecl' this is an initialized decl - even though we don't yet have the initializer expression. - Also tell `cp_finish_decl' it may store the real initializer. */ - DECL_INITIAL (decl) = error_mark_node; - } - -#ifdef SET_DEFAULT_DECL_ATTRIBUTES - SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes); -#endif - - /* Set attributes here so if duplicate decl, will have proper attributes. */ - cplus_decl_attributes (decl, attributes, prefix_attributes); - - if (context && TYPE_SIZE (complete_type (context)) != NULL_TREE) - { - push_nested_class (context, 2); - - if (TREE_CODE (decl) == VAR_DECL) - { - tree field = lookup_field (context, DECL_NAME (decl), 0, 0); - if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL) - cp_error ("`%#D' is not a static member of `%#T'", decl, context); - else - { - if (DECL_CONTEXT (field) != context) - { - cp_pedwarn ("ANSI C++ does not permit `%T::%D' to be defined as `%T::%D'", - DECL_CONTEXT (field), DECL_NAME (decl), - context, DECL_NAME (decl)); - DECL_CONTEXT (decl) = DECL_CONTEXT (field); - } - /* Static data member are tricky; an in-class initialization - still doesn't provide a definition, so the in-class - declaration will have DECL_EXTERNAL set, but will have an - initialization. Thus, duplicate_decls won't warn - about this situation, and so we check here. */ - if (DECL_INITIAL (decl) && DECL_INITIAL (field)) - cp_error ("duplicate initialization of %D", decl); - if (duplicate_decls (decl, field)) - decl = field; - } - } - else - { - tree field = check_classfn (context, decl); - if (field && duplicate_decls (decl, field)) - decl = field; - } - - /* cp_finish_decl sets DECL_EXTERNAL if DECL_IN_AGGR_P is set. */ - DECL_IN_AGGR_P (decl) = 0; - if ((DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl)) - || CLASSTYPE_USE_TEMPLATE (context)) - { - SET_DECL_TEMPLATE_SPECIALIZATION (decl); - /* [temp.expl.spec] An explicit specialization of a static data - member of a template is a definition if the declaration - includes an initializer; otherwise, it is a declaration. - - We check for processing_specialization so this only applies - to the new specialization syntax. */ - if (DECL_INITIAL (decl) == NULL_TREE && processing_specialization) - DECL_EXTERNAL (decl) = 1; - } - - if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl)) - cp_pedwarn ("declaration of `%#D' outside of class is not definition", - decl); - } - - /* Add this decl to the current binding level, but not if it - comes from another scope, e.g. a static member variable. - TEM may equal DECL or it may be a previous decl of the same name. */ - - if ((TREE_CODE (decl) != PARM_DECL && DECL_CONTEXT (decl) != NULL_TREE - /* Definitions of namespace members outside their namespace are - possible. */ - && TREE_CODE (DECL_CONTEXT (decl)) != NAMESPACE_DECL) - || (TREE_CODE (decl) == TEMPLATE_DECL && !namespace_bindings_p ()) - || TREE_CODE (type) == LANG_TYPE - /* The declaration of template specializations does not affect - the functions available for overload resolution, so we do not - call pushdecl. */ - || (TREE_CODE (decl) == FUNCTION_DECL - && DECL_TEMPLATE_SPECIALIZATION (decl))) - tem = decl; - else - tem = pushdecl (decl); - - if (processing_template_decl) - { - if (! current_function_decl) - tem = push_template_decl (tem); - else if (minimal_parse_mode) - DECL_VINDEX (tem) - = build_min_nt (DECL_STMT, copy_to_permanent (declarator), - copy_to_permanent (declspecs), - NULL_TREE); - } - - -#if ! defined (ASM_OUTPUT_BSS) && ! defined (ASM_OUTPUT_ALIGNED_BSS) - /* Tell the back-end to use or not use .common as appropriate. If we say - -fconserve-space, we want this to save .data space, at the expense of - wrong semantics. If we say -fno-conserve-space, we want this to - produce errors about redefs; to do this we force variables into the - data segment. */ - DECL_COMMON (tem) = flag_conserve_space || ! TREE_PUBLIC (tem); -#endif - - if (! processing_template_decl) - start_decl_1 (tem); - - /* Corresponding pop_obstacks is done in `cp_finish_decl'. */ - push_obstacks_nochange (); - -#if 0 - /* We have no way of knowing whether the initializer will need to be - evaluated at run-time or not until we've parsed it, so let's just put - it in the permanent obstack. (jason) */ - if (init_written - && ! (TREE_CODE (tem) == PARM_DECL - || (TREE_READONLY (tem) - && (TREE_CODE (tem) == VAR_DECL - || TREE_CODE (tem) == FIELD_DECL)))) - { - /* When parsing and digesting the initializer, - use temporary storage. Do this even if we will ignore the value. */ - if (toplevel_bindings_p () && debug_temp_inits) - { - if (processing_template_decl - || TYPE_NEEDS_CONSTRUCTING (type) - || TREE_CODE (type) == REFERENCE_TYPE) - /* In this case, the initializer must lay down in permanent - storage, since it will be saved until `finish_file' is run. */ - ; - else - temporary_allocation (); - } - } -#endif - - return tem; -} - -void -start_decl_1 (decl) - tree decl; -{ - tree type = TREE_TYPE (decl); - int initialized = (DECL_INITIAL (decl) != NULL_TREE); - - if (type == error_mark_node) - return; - - /* If this type of object needs a cleanup, and control may - jump past it, make a new binding level so that it is cleaned - up only when it is initialized first. */ - if (TYPE_NEEDS_DESTRUCTOR (type) - && current_binding_level->more_cleanups_ok == 0) - pushlevel_temporary (1); - - if (initialized) - /* Is it valid for this decl to have an initializer at all? - If not, set INITIALIZED to zero, which will indirectly - tell `cp_finish_decl' to ignore the initializer once it is parsed. */ - { - /* Don't allow initializations for incomplete types except for - arrays which might be completed by the initialization. */ - if (TYPE_SIZE (complete_type (type)) != NULL_TREE) - ; /* A complete type is ok. */ - else if (TREE_CODE (type) != ARRAY_TYPE) - { - cp_error ("variable `%#D' has initializer but incomplete type", - decl); - initialized = 0; - type = TREE_TYPE (decl) = error_mark_node; - } - else if (TYPE_SIZE (complete_type (TREE_TYPE (type))) == NULL_TREE) - { - if (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)) - cp_error ("elements of array `%#D' have incomplete type", decl); - /* else we already gave an error in start_decl. */ - initialized = 0; - } - } - - if (!initialized - && TREE_CODE (decl) != TYPE_DECL - && TREE_CODE (decl) != TEMPLATE_DECL - && IS_AGGR_TYPE (type) && ! DECL_EXTERNAL (decl)) - { - if ((! processing_template_decl || ! uses_template_parms (type)) - && TYPE_SIZE (complete_type (type)) == NULL_TREE) - { - cp_error ("aggregate `%#D' has incomplete type and cannot be initialized", - decl); - /* Change the type so that assemble_variable will give - DECL an rtl we can live with: (mem (const_int 0)). */ - type = TREE_TYPE (decl) = error_mark_node; - } - else - { - /* If any base type in the hierarchy of TYPE needs a constructor, - then we set initialized to 1. This way any nodes which are - created for the purposes of initializing this aggregate - will live as long as it does. This is necessary for global - aggregates which do not have their initializers processed until - the end of the file. */ - initialized = TYPE_NEEDS_CONSTRUCTING (type); - } - } - -#if 0 - /* We don't do this yet for GNU C++. */ - /* For a local variable, define the RTL now. */ - if (! toplevel_bindings_p () - /* But not if this is a duplicate decl - and we preserved the rtl from the previous one - (which may or may not happen). */ - && DECL_RTL (tem) == NULL_RTX) - { - if (TYPE_SIZE (TREE_TYPE (tem)) != NULL_TREE) - expand_decl (tem); - else if (TREE_CODE (TREE_TYPE (tem)) == ARRAY_TYPE - && DECL_INITIAL (tem) != NULL_TREE) - expand_decl (tem); - } -#endif - - if (! initialized) - DECL_INITIAL (decl) = NULL_TREE; -} - -/* Handle initialization of references. - These three arguments are from `cp_finish_decl', and have the - same meaning here that they do there. - - Quotes on semantics can be found in ARM 8.4.3. */ - -static void -grok_reference_init (decl, type, init) - tree decl, type, init; -{ - tree tmp; - - if (init == NULL_TREE) - { - if ((DECL_LANG_SPECIFIC (decl) == 0 - || DECL_IN_AGGR_P (decl) == 0) - && ! DECL_THIS_EXTERN (decl)) - { - cp_error ("`%D' declared as reference but not initialized", decl); - if (TREE_CODE (decl) == VAR_DECL) - SET_DECL_REFERENCE_SLOT (decl, error_mark_node); - } - return; - } - - if (init == error_mark_node) - return; - - if (TREE_CODE (type) == REFERENCE_TYPE - && TREE_CODE (init) == CONSTRUCTOR) - { - cp_error ("ANSI C++ forbids use of initializer list to initialize reference `%D'", decl); - return; - } - - if (TREE_CODE (init) == TREE_LIST) - init = build_compound_expr (init); - - if (TREE_CODE (TREE_TYPE (init)) == REFERENCE_TYPE) - init = convert_from_reference (init); - - if (TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE - && TREE_CODE (TREE_TYPE (init)) == ARRAY_TYPE) - { - /* Note: default conversion is only called in very special cases. */ - init = default_conversion (init); - } - - tmp = convert_to_reference - (type, init, CONV_IMPLICIT, - LOOKUP_SPECULATIVELY|LOOKUP_NORMAL|DIRECT_BIND, decl); - - if (tmp == error_mark_node) - goto fail; - else if (tmp != NULL_TREE) - { - init = tmp; - DECL_INITIAL (decl) = save_expr (init); - } - else - { - cp_error ("cannot initialize `%T' from `%T'", type, TREE_TYPE (init)); - goto fail; - } - - /* ?? Can this be optimized in some cases to - hand back the DECL_INITIAL slot?? */ - if (TYPE_SIZE (TREE_TYPE (type))) - { - init = convert_from_reference (decl); - if (TREE_PERMANENT (decl)) - init = copy_to_permanent (init); - SET_DECL_REFERENCE_SLOT (decl, init); - } - - if (TREE_STATIC (decl) && ! TREE_CONSTANT (DECL_INITIAL (decl))) - { - expand_static_init (decl, DECL_INITIAL (decl)); - DECL_INITIAL (decl) = NULL_TREE; - } - return; - - fail: - if (TREE_CODE (decl) == VAR_DECL) - SET_DECL_REFERENCE_SLOT (decl, error_mark_node); - return; -} - -/* Fill in DECL_INITIAL with some magical value to prevent expand_decl from - mucking with forces it does not comprehend (i.e. initialization with a - constructor). If we are at global scope and won't go into COMMON, fill - it in with a dummy CONSTRUCTOR to force the variable into .data; - otherwise we can use error_mark_node. */ - -static tree -obscure_complex_init (decl, init) - tree decl, init; -{ - if (! flag_no_inline && TREE_STATIC (decl)) - { - if (extract_init (decl, init)) - return NULL_TREE; - } - -#if ! defined (ASM_OUTPUT_BSS) && ! defined (ASM_OUTPUT_ALIGNED_BSS) - if (toplevel_bindings_p () && ! DECL_COMMON (decl)) - DECL_INITIAL (decl) = build (CONSTRUCTOR, TREE_TYPE (decl), NULL_TREE, - NULL_TREE); - else -#endif - DECL_INITIAL (decl) = error_mark_node; - - return init; -} - -/* Issue an error message if DECL is an uninitialized const variable. */ - -static void -check_for_uninitialized_const_var (decl) - tree decl; -{ - tree type = TREE_TYPE (decl); - - /* ``Unless explicitly declared extern, a const object does not have - external linkage and must be initialized. ($8.4; $12.1)'' ARM - 7.1.6 */ - if (TREE_CODE (decl) == VAR_DECL - && TREE_CODE (type) != REFERENCE_TYPE - && CP_TYPE_CONST_P (type) - && !TYPE_NEEDS_CONSTRUCTING (type) - && !DECL_INITIAL (decl)) - cp_error ("uninitialized const `%D'", decl); -} - -/* Finish processing of a declaration; - install its line number and initial value. - If the length of an array type is not known before, - it must be determined now, from the initial value, or it is an error. - - Call `pop_obstacks' iff NEED_POP is nonzero. - - For C++, `cp_finish_decl' must be fairly evasive: it must keep initializers - for aggregates that have constructors alive on the permanent obstack, - so that the global initializing functions can be written at the end. - - INIT0 holds the value of an initializer that should be allowed to escape - the normal rules. - - FLAGS is LOOKUP_ONLYCONVERTING is the = init syntax was used, else 0 - if the (init) syntax was used. - - For functions that take default parameters, DECL points to its - "maximal" instantiation. `cp_finish_decl' must then also declared its - subsequently lower and lower forms of instantiation, checking for - ambiguity as it goes. This can be sped up later. */ - -void -cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) - tree decl, init; - tree asmspec_tree; - int need_pop; - int flags; -{ - register tree type; - tree cleanup = NULL_TREE, ttype = NULL_TREE; - int was_incomplete; - int temporary = allocation_temporary_p (); - char *asmspec = NULL; - int was_readonly = 0; - int already_used = 0; - tree core_type; - - /* If this is 0, then we did not change obstacks. */ - if (! decl) - { - if (init) - error ("assignment (not initialization) in declaration"); - return; - } - - /* If a name was specified, get the string. */ - if (asmspec_tree) - asmspec = TREE_STRING_POINTER (asmspec_tree); - - if (init && TREE_CODE (init) == NAMESPACE_DECL) - { - cp_error ("Cannot initialize `%D' to namespace `%D'", - decl, init); - init = NULL_TREE; - } - - if (current_class_type - && DECL_REAL_CONTEXT (decl) == current_class_type - && TYPE_BEING_DEFINED (current_class_type) - && (DECL_INITIAL (decl) || init)) - DECL_DEFINED_IN_CLASS_P (decl) = 1; - - if (TREE_CODE (decl) == VAR_DECL - && DECL_CONTEXT (decl) - && TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL - && DECL_CONTEXT (decl) != current_namespace - && init) - { - /* Leave the namespace of the object. */ - pop_decl_namespace (); - } - - /* If the type of the thing we are declaring either has - a constructor, or has a virtual function table pointer, - AND its initialization was accepted by `start_decl', - then we stayed on the permanent obstack through the - declaration, otherwise, changed obstacks as GCC would. */ - - type = TREE_TYPE (decl); - - if (type == error_mark_node) - { - if (toplevel_bindings_p () && temporary) - end_temporary_allocation (); - - return; - } - - if (TYPE_HAS_MUTABLE_P (type)) - TREE_READONLY (decl) = 0; - - if (processing_template_decl) - { - if (init && DECL_INITIAL (decl)) - DECL_INITIAL (decl) = init; - if (minimal_parse_mode && ! DECL_ARTIFICIAL (decl)) - { - tree stmt = DECL_VINDEX (decl); - /* If the decl is declaring a member of a local class (in a - template function), the DECL_VINDEX will either be NULL, - or it will be an actual virtual function index, not a - DECL_STMT. */ - if (stmt != NULL_TREE && TREE_CODE (stmt) == DECL_STMT) - { - DECL_VINDEX (decl) = NULL_TREE; - TREE_OPERAND (stmt, 2) = copy_to_permanent (init); - add_tree (stmt); - } - } - - goto finish_end0; - } - /* Take care of TYPE_DECLs up front. */ - if (TREE_CODE (decl) == TYPE_DECL) - { - if (init && DECL_INITIAL (decl)) - { - /* typedef foo = bar; store the type of bar as the type of foo. */ - TREE_TYPE (decl) = type = TREE_TYPE (init); - DECL_INITIAL (decl) = init = NULL_TREE; - } - if (type != error_mark_node - && IS_AGGR_TYPE (type) && DECL_NAME (decl)) - { - if (TREE_TYPE (DECL_NAME (decl)) && TREE_TYPE (decl) != type) - cp_warning ("shadowing previous type declaration of `%#D'", decl); - set_identifier_type_value (DECL_NAME (decl), type); - CLASSTYPE_GOT_SEMICOLON (type) = 1; - } - GNU_xref_decl (current_function_decl, decl); - - /* If we have installed this as the canonical typedef for this - type, and that type has not been defined yet, delay emitting - the debug information for it, as we will emit it later. */ - if (TYPE_MAIN_DECL (TREE_TYPE (decl)) == decl - && TYPE_SIZE (TREE_TYPE (decl)) == NULL_TREE) - TYPE_DECL_SUPPRESS_DEBUG (decl) = 1; - - rest_of_decl_compilation (decl, NULL_PTR, - DECL_CONTEXT (decl) == NULL_TREE, at_eof); - goto finish_end; - } - if (TREE_CODE (decl) != FUNCTION_DECL) - { - ttype = target_type (type); - } - - if (! DECL_EXTERNAL (decl) && TREE_READONLY (decl) - && TYPE_NEEDS_CONSTRUCTING (type)) - { - - /* Currently, GNU C++ puts constants in text space, making them - impossible to initialize. In the future, one would hope for - an operating system which understood the difference between - initialization and the running of a program. */ - was_readonly = 1; - TREE_READONLY (decl) = 0; - } - - if (TREE_CODE (decl) == FIELD_DECL) - { - if (init && init != error_mark_node) - my_friendly_assert (TREE_PERMANENT (init), 147); - - if (asmspec) - { - /* This must override the asm specifier which was placed - by grokclassfn. Lay this out fresh. */ - DECL_RTL (TREE_TYPE (decl)) = NULL_RTX; - DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec); - make_decl_rtl (decl, asmspec, 0); - } - } - /* If `start_decl' didn't like having an initialization, ignore it now. */ - else if (init != NULL_TREE && DECL_INITIAL (decl) == NULL_TREE) - init = NULL_TREE; - else if (DECL_EXTERNAL (decl)) - ; - else if (TREE_CODE (type) == REFERENCE_TYPE - || (TYPE_LANG_SPECIFIC (type) && IS_SIGNATURE_REFERENCE (type))) - { - if (TREE_STATIC (decl)) - make_decl_rtl (decl, NULL_PTR, - toplevel_bindings_p () - || pseudo_global_level_p ()); - grok_reference_init (decl, type, init); - init = NULL_TREE; - } - - GNU_xref_decl (current_function_decl, decl); - - core_type = type; - while (TREE_CODE (core_type) == ARRAY_TYPE) - core_type = TREE_TYPE (core_type); - - if (TREE_CODE (decl) == FIELD_DECL) - ; - else if (TREE_CODE (decl) == CONST_DECL) - { - my_friendly_assert (TREE_CODE (decl) != REFERENCE_TYPE, 148); - - DECL_INITIAL (decl) = init; - - /* This will keep us from needing to worry about our obstacks. */ - my_friendly_assert (init != NULL_TREE, 149); - init = NULL_TREE; - } - else if (init) - { - if (TYPE_HAS_CONSTRUCTOR (type) || TYPE_NEEDS_CONSTRUCTING (type)) - { - if (TREE_CODE (type) == ARRAY_TYPE) - init = digest_init (type, init, (tree *) 0); - else if (TREE_CODE (init) == CONSTRUCTOR - && TREE_HAS_CONSTRUCTOR (init)) - { - if (TYPE_NON_AGGREGATE_CLASS (type)) - { - cp_error ("`%D' must be initialized by constructor, not by `{...}'", - decl); - init = error_mark_node; - } - else - goto dont_use_constructor; - } - } - else - { - dont_use_constructor: - if (TREE_CODE (init) != TREE_VEC) - init = store_init_value (decl, init); - } - - if (init) - /* We must hide the initializer so that expand_decl - won't try to do something it does not understand. */ - init = obscure_complex_init (decl, init); - } - else if (DECL_EXTERNAL (decl)) - ; - else if (TREE_CODE_CLASS (TREE_CODE (type)) == 't' - && (IS_AGGR_TYPE (type) || TYPE_NEEDS_CONSTRUCTING (type))) - { - if (! TYPE_NEEDS_CONSTRUCTING (core_type)) - { - if (CLASSTYPE_READONLY_FIELDS_NEED_INIT (core_type)) - cp_error ("structure `%D' with uninitialized const members", decl); - if (CLASSTYPE_REF_FIELDS_NEED_INIT (core_type)) - cp_error ("structure `%D' with uninitialized reference members", - decl); - } - - check_for_uninitialized_const_var (decl); - - if (TYPE_SIZE (type) != NULL_TREE - && TYPE_NEEDS_CONSTRUCTING (type)) - init = obscure_complex_init (decl, NULL_TREE); - - } - else - check_for_uninitialized_const_var (decl); - - /* For top-level declaration, the initial value was read in - the temporary obstack. MAXINDEX, rtl, etc. to be made below - must go in the permanent obstack; but don't discard the - temporary data yet. */ - - if (toplevel_bindings_p () && temporary) - end_temporary_allocation (); - - /* Deduce size of array from initialization, if not already known. */ - - if (TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type) == NULL_TREE - && TREE_CODE (decl) != TYPE_DECL) - { - int do_default - = (TREE_STATIC (decl) - /* Even if pedantic, an external linkage array - may have incomplete type at first. */ - ? pedantic && ! DECL_EXTERNAL (decl) - : !DECL_EXTERNAL (decl)); - tree initializer = init ? init : DECL_INITIAL (decl); - int failure = complete_array_type (type, initializer, do_default); - - if (failure == 1) - cp_error ("initializer fails to determine size of `%D'", decl); - - if (failure == 2) - { - if (do_default) - cp_error ("array size missing in `%D'", decl); - /* If a `static' var's size isn't known, make it extern as - well as static, so it does not get allocated. If it's not - `static', then don't mark it extern; finish_incomplete_decl - will give it a default size and it will get allocated. */ - else if (!pedantic && TREE_STATIC (decl) && !TREE_PUBLIC (decl)) - DECL_EXTERNAL (decl) = 1; - } - - if (pedantic && TYPE_DOMAIN (type) != NULL_TREE - && tree_int_cst_lt (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), - integer_zero_node)) - cp_error ("zero-size array `%D'", decl); - - layout_decl (decl, 0); - } - - if (TREE_CODE (decl) == VAR_DECL) - { - if (DECL_SIZE (decl) == NULL_TREE - && TYPE_SIZE (complete_type (TREE_TYPE (decl))) != NULL_TREE) - layout_decl (decl, 0); - - if (TREE_STATIC (decl) && DECL_SIZE (decl) == NULL_TREE) - { - /* A static variable with an incomplete type: - that is an error if it is initialized. - Otherwise, let it through, but if it is not `extern' - then it may cause an error message later. */ - if (DECL_INITIAL (decl) != NULL_TREE) - cp_error ("storage size of `%D' isn't known", decl); - init = NULL_TREE; - } - else if (!DECL_EXTERNAL (decl) && DECL_SIZE (decl) == NULL_TREE) - { - /* An automatic variable with an incomplete type: that is an error. - Don't talk about array types here, since we took care of that - message in grokdeclarator. */ - cp_error ("storage size of `%D' isn't known", decl); - TREE_TYPE (decl) = error_mark_node; - } - else if (!DECL_EXTERNAL (decl) && IS_AGGR_TYPE (ttype)) - /* Let debugger know it should output info for this type. */ - note_debug_info_needed (ttype); - - if (TREE_STATIC (decl) && DECL_CLASS_SCOPE_P (decl)) - note_debug_info_needed (DECL_CONTEXT (decl)); - - if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl)) - && DECL_SIZE (decl) != NULL_TREE - && ! TREE_CONSTANT (DECL_SIZE (decl))) - { - if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST) - constant_expression_warning (DECL_SIZE (decl)); - else - cp_error ("storage size of `%D' isn't constant", decl); - } - - if (! DECL_EXTERNAL (decl) && TYPE_NEEDS_DESTRUCTOR (type) - /* Cleanups for static variables are handled by `finish_file'. */ - && ! TREE_STATIC (decl)) - { - int yes = suspend_momentary (); - cleanup = maybe_build_cleanup (decl); - resume_momentary (yes); - } - } - /* PARM_DECLs get cleanups, too. */ - else if (TREE_CODE (decl) == PARM_DECL && TYPE_NEEDS_DESTRUCTOR (type)) - { - if (temporary) - end_temporary_allocation (); - cleanup = maybe_build_cleanup (decl); - if (temporary) - resume_temporary_allocation (); - } - - /* Output the assembler code and/or RTL code for variables and functions, - unless the type is an undefined structure or union. - If not, it will get done when the type is completed. */ - - was_incomplete = (DECL_SIZE (decl) == NULL_TREE); - - if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == RESULT_DECL) - { - /* ??? FIXME: What about nested classes? */ - int toplev = toplevel_bindings_p () || pseudo_global_level_p (); - int was_temp - = (TREE_STATIC (decl) && TYPE_NEEDS_DESTRUCTOR (type) - && allocation_temporary_p ()); - - if (was_temp) - end_temporary_allocation (); - - /* Static data in a function with comdat linkage also has comdat - linkage. */ - if (TREE_CODE (decl) == VAR_DECL - && TREE_STATIC (decl) - /* Don't mess with __FUNCTION__. */ - && ! TREE_ASM_WRITTEN (decl) - && current_function_decl - && DECL_CONTEXT (decl) == current_function_decl - && (DECL_THIS_INLINE (current_function_decl) - || DECL_TEMPLATE_INSTANTIATION (current_function_decl)) - && TREE_PUBLIC (current_function_decl)) - { - /* Rather than try to get this right with inlining, we suppress - inlining of such functions. */ - current_function_cannot_inline - = "function with static variable cannot be inline"; - - /* If flag_weak, we don't need to mess with this, as we can just - make the function weak, and let it refer to its unique local - copy. This works because we don't allow the function to be - inlined. */ - if (! flag_weak) - { - if (DECL_INTERFACE_KNOWN (current_function_decl)) - { - TREE_PUBLIC (decl) = 1; - DECL_EXTERNAL (decl) = DECL_EXTERNAL (current_function_decl); - } - else if (DECL_INITIAL (decl) == NULL_TREE - || DECL_INITIAL (decl) == error_mark_node) - { - TREE_PUBLIC (decl) = 1; - DECL_COMMON (decl) = 1; - } - /* else we lose. We can only do this if we can use common, - which we can't if it has been initialized. */ - - if (TREE_PUBLIC (decl)) - DECL_ASSEMBLER_NAME (decl) - = build_static_name (current_function_decl, DECL_NAME (decl)); - else if (! DECL_ARTIFICIAL (decl)) - { - cp_warning_at ("sorry: semantics of inline function static data `%#D' are wrong (you'll wind up with multiple copies)", decl); - cp_warning_at (" you can work around this by removing the initializer", decl); - } - } - } - - else if (TREE_CODE (decl) == VAR_DECL - && DECL_LANG_SPECIFIC (decl) - && DECL_COMDAT (decl)) - /* Set it up again; we might have set DECL_INITIAL since the - last time. */ - comdat_linkage (decl); - - if (TREE_CODE (decl) == VAR_DECL && DECL_VIRTUAL_P (decl)) - make_decl_rtl (decl, NULL_PTR, toplev); - else if (TREE_CODE (decl) == VAR_DECL - && TREE_READONLY (decl) - && DECL_INITIAL (decl) != NULL_TREE - && DECL_INITIAL (decl) != error_mark_node - && ! EMPTY_CONSTRUCTOR_P (DECL_INITIAL (decl))) - { - DECL_INITIAL (decl) = save_expr (DECL_INITIAL (decl)); - - if (asmspec) - DECL_ASSEMBLER_NAME (decl) = get_identifier (asmspec); - - if (! toplev - && TREE_STATIC (decl) - && ! TREE_SIDE_EFFECTS (decl) - && ! TREE_PUBLIC (decl) - && ! DECL_EXTERNAL (decl) - && ! TYPE_NEEDS_DESTRUCTOR (type) - && DECL_MODE (decl) != BLKmode) - { - /* If this variable is really a constant, then fill its DECL_RTL - slot with something which won't take up storage. - If something later should take its address, we can always give - it legitimate RTL at that time. */ - DECL_RTL (decl) = gen_reg_rtx (DECL_MODE (decl)); - store_expr (DECL_INITIAL (decl), DECL_RTL (decl), 0); - TREE_ASM_WRITTEN (decl) = 1; - } - else if (toplev && ! TREE_PUBLIC (decl)) - { - /* If this is a static const, change its apparent linkage - if it belongs to a #pragma interface. */ - if (!interface_unknown) - { - TREE_PUBLIC (decl) = 1; - DECL_EXTERNAL (decl) = interface_only; - } - make_decl_rtl (decl, asmspec, toplev); - } - else - rest_of_decl_compilation (decl, asmspec, toplev, at_eof); - } - else if (TREE_CODE (decl) == VAR_DECL - && DECL_LANG_SPECIFIC (decl) - && DECL_IN_AGGR_P (decl)) - { - if (TREE_STATIC (decl)) - { - if (init == NULL_TREE -#ifdef DEFAULT_STATIC_DEFS - /* If this code is dead, then users must - explicitly declare static member variables - outside the class def'n as well. */ - && TYPE_NEEDS_CONSTRUCTING (type) -#endif - ) - { - DECL_EXTERNAL (decl) = 1; - make_decl_rtl (decl, asmspec, 1); - } - else - rest_of_decl_compilation (decl, asmspec, toplev, at_eof); - } - else - /* Just a constant field. Should not need any rtl. */ - goto finish_end0; - } - else - rest_of_decl_compilation (decl, asmspec, toplev, at_eof); - - if (was_temp) - resume_temporary_allocation (); - - if (type != error_mark_node - && TYPE_LANG_SPECIFIC (core_type) - && CLASSTYPE_ABSTRACT_VIRTUALS (core_type)) - abstract_virtuals_error (decl, core_type); - else if ((TREE_CODE (type) == FUNCTION_TYPE - || TREE_CODE (type) == METHOD_TYPE) - && TYPE_LANG_SPECIFIC (TREE_TYPE (type)) - && CLASSTYPE_ABSTRACT_VIRTUALS (TREE_TYPE (type))) - abstract_virtuals_error (decl, TREE_TYPE (type)); - - if (TYPE_LANG_SPECIFIC (core_type) && IS_SIGNATURE (core_type)) - signature_error (decl, core_type); - else if ((TREE_CODE (type) == FUNCTION_TYPE - || TREE_CODE (type) == METHOD_TYPE) - && TYPE_LANG_SPECIFIC (TREE_TYPE (type)) - && IS_SIGNATURE (TREE_TYPE (type))) - signature_error (decl, TREE_TYPE (type)); - - if (TREE_CODE (decl) == FUNCTION_DECL) - ; - else if (DECL_EXTERNAL (decl) - && ! (DECL_LANG_SPECIFIC (decl) - && DECL_NOT_REALLY_EXTERN (decl))) - { - if (init) - DECL_INITIAL (decl) = init; - } - else if (TREE_STATIC (decl) && type != error_mark_node) - { - /* Cleanups for static variables are handled by `finish_file'. */ - if (TYPE_NEEDS_CONSTRUCTING (type) || init != NULL_TREE - || TYPE_NEEDS_DESTRUCTOR (type)) - expand_static_init (decl, init); - } - else if (! toplev) - { - /* This is a declared decl which must live until the - end of the binding contour. It may need a cleanup. */ - - /* Recompute the RTL of a local array now - if it used to be an incomplete type. */ - if (was_incomplete && ! TREE_STATIC (decl)) - { - /* If we used it already as memory, it must stay in memory. */ - TREE_ADDRESSABLE (decl) = TREE_USED (decl); - /* If it's still incomplete now, no init will save it. */ - if (DECL_SIZE (decl) == NULL_TREE) - DECL_INITIAL (decl) = NULL_TREE; - expand_decl (decl); - } - else if (! TREE_ASM_WRITTEN (decl) - && (TYPE_SIZE (type) != NULL_TREE - || TREE_CODE (type) == ARRAY_TYPE)) - { - /* Do this here, because we did not expand this decl's - rtl in start_decl. */ - if (DECL_RTL (decl) == NULL_RTX) - expand_decl (decl); - else if (cleanup) - { - /* XXX: Why don't we use decl here? */ - /* Ans: Because it was already expanded? */ - if (! expand_decl_cleanup (NULL_TREE, cleanup)) - cp_error ("parser lost in parsing declaration of `%D'", - decl); - /* Cleanup used up here. */ - cleanup = NULL_TREE; - } - } - - if (current_binding_level->is_for_scope) - { - struct binding_level *outer - = current_binding_level->level_chain; - - /* Check to see if the same name is already bound at - the outer level, either because it was directly declared, - or because a dead for-decl got preserved. In either case, - the code would not have been valid under the ARM - scope rules, so clear is_for_scope for the - current_binding_level. - - Otherwise, we need to preserve the temp slot for decl - to last into the outer binding level. */ - - tree outer_binding - = TREE_CHAIN (IDENTIFIER_BINDING (DECL_NAME (decl))); - - if (outer_binding && BINDING_LEVEL (outer_binding) == outer - && (TREE_CODE (BINDING_VALUE (outer_binding)) - == VAR_DECL) - && DECL_DEAD_FOR_LOCAL (BINDING_VALUE (outer_binding))) - { - BINDING_VALUE (outer_binding) - = DECL_SHADOWED_FOR_VAR (BINDING_VALUE (outer_binding)); - current_binding_level->is_for_scope = 0; - } - else if (DECL_IN_MEMORY_P (decl)) - preserve_temp_slots (DECL_RTL (decl)); - } - - expand_start_target_temps (); - - if (DECL_SIZE (decl) && type != error_mark_node) - { - /* Compute and store the initial value. */ - expand_decl_init (decl); - already_used = TREE_USED (decl) || TREE_USED (type); - - if (init || TYPE_NEEDS_CONSTRUCTING (type)) - { - emit_line_note (DECL_SOURCE_FILE (decl), - DECL_SOURCE_LINE (decl)); - expand_aggr_init (decl, init, flags); - } - - /* Set this to 0 so we can tell whether an aggregate which - was initialized was ever used. Don't do this if it has a - destructor, so we don't complain about the 'resource - allocation is initialization' idiom. */ - /* Now set attribute((unused)) on types so decls of - that type will be marked used. (see TREE_USED, above.) - This avoids the warning problems this particular code - tried to work around. */ - - if (TYPE_NEEDS_CONSTRUCTING (type) - && ! already_used - && cleanup == NULL_TREE - && DECL_NAME (decl)) - TREE_USED (decl) = 0; - - if (already_used) - TREE_USED (decl) = 1; - } - - /* Cleanup any temporaries needed for the initial value. */ - expand_end_target_temps (); - - if (DECL_SIZE (decl) && type != error_mark_node) - { - /* Store the cleanup, if there was one. */ - if (cleanup) - { - if (! expand_decl_cleanup (decl, cleanup)) - cp_error ("parser lost in parsing declaration of `%D'", - decl); - } - } - } - finish_end0: - - /* Undo call to `pushclass' that was done in `start_decl' - due to initialization of qualified member variable. - I.e., Foo::x = 10; */ - { - tree context = DECL_REAL_CONTEXT (decl); - if (context - && TREE_CODE_CLASS (TREE_CODE (context)) == 't' - && (TREE_CODE (decl) == VAR_DECL - /* We also have a pushclass done that we need to undo here - if we're at top level and declare a method. */ - || TREE_CODE (decl) == FUNCTION_DECL) - /* If size hasn't been set, we're still defining it, - and therefore inside the class body; don't pop - the binding level.. */ - && TYPE_SIZE (context) != NULL_TREE - && context == current_class_type) - pop_nested_class (); - } - } - - finish_end: - - /* If requested, warn about definitions of large data objects. */ - - if (warn_larger_than - && ! processing_template_decl - && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL) - && !DECL_EXTERNAL (decl)) - { - register tree decl_size = DECL_SIZE (decl); - - if (decl_size && TREE_CODE (decl_size) == INTEGER_CST) - { - unsigned units = TREE_INT_CST_LOW (decl_size) / BITS_PER_UNIT; - - if (units > larger_than_size) - warning_with_decl (decl, "size of `%s' is %u bytes", units); - } - } - - if (need_pop) - { - /* Resume permanent allocation, if not within a function. */ - /* The corresponding push_obstacks_nochange is in start_decl, - start_method, groktypename, and in grokfield. */ - pop_obstacks (); - } - - if (was_readonly) - TREE_READONLY (decl) = 1; -} - -/* This is here for a midend callback from c-common.c */ - -void -finish_decl (decl, init, asmspec_tree) - tree decl, init; - tree asmspec_tree; -{ - cp_finish_decl (decl, init, asmspec_tree, 1, 0); -} - -void -expand_static_init (decl, init) - tree decl; - tree init; -{ - tree oldstatic = value_member (decl, static_aggregates); - - if (oldstatic) - { - if (TREE_PURPOSE (oldstatic) && init != NULL_TREE) - cp_error ("multiple initializations given for `%D'", decl); - } - else if (! toplevel_bindings_p ()) - { - /* Emit code to perform this initialization but once. */ - tree temp; - - /* Remember this information until end of file. */ - push_obstacks (&permanent_obstack, &permanent_obstack); - - /* Emit code to perform this initialization but once. This code - looks like: - - static int temp = 0; - if (!temp) { - // Do initialization. - temp = 1; - // Register variable for destruction at end of program. - } - - Note that the `temp' variable is only set to 1 *after* the - initialization is complete. This ensures that an exception, - thrown during the construction, will cause the variable to - reinitialized when we pass through this code again, as per: - - [stmt.dcl] - - If the initialization exits by throwing an exception, the - initialization is not complete, so it will be tried again - the next time control enters the declaration. - - In theory, this process should be thread-safe, too; multiple - threads should not be able to initialize the variable more - than once. We don't yet attempt to ensure thread-safety. */ - temp = get_temp_name (integer_type_node, 1); - rest_of_decl_compilation (temp, NULL_PTR, 0, 0); - - /* Begin the conditional initialization. */ - expand_start_cond (build_binary_op (EQ_EXPR, temp, - integer_zero_node), 0); - expand_start_target_temps (); - - /* Do the initialization itself. */ - if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)) - || (init && TREE_CODE (init) == TREE_LIST)) - { - expand_aggr_init (decl, init, 0); - do_pending_stack_adjust (); - } - else if (init) - expand_assignment (decl, init, 0, 0); - - /* Set TEMP to 1. */ - expand_assignment (temp, integer_one_node, 0, 0); - - /* Cleanup any temporaries needed for the initial value. If - destroying one of the temporaries causes an exception to be - thrown, then the object itself has still been fully - constructed. */ - expand_end_target_temps (); - - /* Use atexit to register a function for destroying this static - variable. */ - if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (decl))) - { - tree cleanup, fcall; - static tree Atexit = 0; - int saved_flag_access_control; - - if (Atexit == 0) - { - tree atexit_fndecl, PFV, pfvlist; - /* Remember this information until end of file. */ - push_obstacks (&permanent_obstack, &permanent_obstack); - PFV = build_pointer_type (build_function_type - (void_type_node, void_list_node)); - - pfvlist = tree_cons (NULL_TREE, PFV, void_list_node); - - push_lang_context (lang_name_c); - atexit_fndecl - = builtin_function ("atexit", - build_function_type (void_type_node, - pfvlist), - NOT_BUILT_IN, NULL_PTR); - mark_used (atexit_fndecl); - Atexit = default_conversion (atexit_fndecl); - pop_lang_context (); - pop_obstacks (); - } - - /* Call build_cleanup before we enter the anonymous function - so that any access checks will be done relative to the - current scope, rather than the scope of the anonymous - function. */ - build_cleanup (decl); - - /* Now start the function. */ - cleanup = start_anon_func (); - - /* Now, recompute the cleanup. It may contain SAVE_EXPRs - that refer to the original function, rather than the - anonymous one. That will make the back-end think that - nested functions are in use, which causes confusion. */ - saved_flag_access_control = flag_access_control; - flag_access_control = 0; - fcall = build_cleanup (decl); - flag_access_control = saved_flag_access_control; - - /* Finish off the function. */ - expand_expr_stmt (fcall); - end_anon_func (); - - /* Call atexit with the cleanup function. */ - mark_addressable (cleanup); - cleanup = build_unary_op (ADDR_EXPR, cleanup, 0); - fcall = build_function_call (Atexit, - expr_tree_cons (NULL_TREE, - cleanup, - NULL_TREE)); - expand_expr_stmt (fcall); - } - - expand_end_cond (); - /* Resume old (possibly temporary) allocation. */ - pop_obstacks (); - } - else - { - /* This code takes into account memory allocation policy of - `start_decl'. Namely, if TYPE_NEEDS_CONSTRUCTING does not - hold for this object, then we must make permanent the storage - currently in the temporary obstack. */ - if (!TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))) - preserve_initializer (); - static_aggregates = perm_tree_cons (init, decl, static_aggregates); - } -} - -/* Make TYPE a complete type based on INITIAL_VALUE. - Return 0 if successful, 1 if INITIAL_VALUE can't be deciphered, - 2 if there was no information (in which case assume 0 if DO_DEFAULT). */ - -int -complete_array_type (type, initial_value, do_default) - tree type, initial_value; - int do_default; -{ - register tree maxindex = NULL_TREE; - int value = 0; - - /* Allocate on the same obstack as TYPE. */ - push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type)); - - if (initial_value) - { - /* Note MAXINDEX is really the maximum index, - one less than the size. */ - if (TREE_CODE (initial_value) == STRING_CST) - { - int eltsize - = int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value))); - maxindex = build_int_2 ((TREE_STRING_LENGTH (initial_value) - / eltsize) - 1, 0); - } - else if (TREE_CODE (initial_value) == CONSTRUCTOR) - { - tree elts = CONSTRUCTOR_ELTS (initial_value); - maxindex = size_binop (MINUS_EXPR, integer_zero_node, size_one_node); - for (; elts; elts = TREE_CHAIN (elts)) - { - if (TREE_PURPOSE (elts)) - maxindex = TREE_PURPOSE (elts); - else - maxindex = size_binop (PLUS_EXPR, maxindex, size_one_node); - } - maxindex = copy_node (maxindex); - } - else - { - /* Make an error message unless that happened already. */ - if (initial_value != error_mark_node) - value = 1; - else - initial_value = NULL_TREE; - - /* Prevent further error messages. */ - maxindex = build_int_2 (0, 0); - } - } - - if (!maxindex) - { - if (do_default) - maxindex = build_int_2 (0, 0); - value = 2; - } - - if (maxindex) - { - tree itype; - tree domain; - - domain = build_index_type (maxindex); - TYPE_DOMAIN (type) = domain; - - if (! TREE_TYPE (maxindex)) - TREE_TYPE (maxindex) = domain; - if (initial_value) - itype = TREE_TYPE (initial_value); - else - itype = NULL; - if (itype && !TYPE_DOMAIN (itype)) - TYPE_DOMAIN (itype) = domain; - /* The type of the main variant should never be used for arrays - of different sizes. It should only ever be completed with the - size of the array. */ - if (! TYPE_DOMAIN (TYPE_MAIN_VARIANT (type))) - TYPE_DOMAIN (TYPE_MAIN_VARIANT (type)) = domain; - } - - pop_obstacks(); - - /* Lay out the type now that we can get the real answer. */ - - layout_type (type); - - return value; -} - -/* Return zero if something is declared to be a member of type - CTYPE when in the context of CUR_TYPE. STRING is the error - message to print in that case. Otherwise, quietly return 1. */ - -static int -member_function_or_else (ctype, cur_type, string) - tree ctype, cur_type; - const char *string; -{ - if (ctype && ctype != cur_type) - { - error (string, TYPE_NAME_STRING (ctype)); - return 0; - } - return 1; -} - -/* Subroutine of `grokdeclarator'. */ - -/* Generate errors possibly applicable for a given set of specifiers. - This is for ARM $7.1.2. */ - -static void -bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises) - tree object; - const char *type; - int virtualp, quals, friendp, raises, inlinep; -{ - if (virtualp) - cp_error ("`%D' declared as a `virtual' %s", object, type); - if (inlinep) - cp_error ("`%D' declared as an `inline' %s", object, type); - if (quals) - cp_error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration", - object, type); - if (friendp) - cp_error_at ("invalid friend declaration", object); - if (raises) - cp_error_at ("invalid exception specifications", object); -} - -/* CTYPE is class type, or null if non-class. - TYPE is type this FUNCTION_DECL should have, either FUNCTION_TYPE - or METHOD_TYPE. - DECLARATOR is the function's name. - VIRTUALP is truthvalue of whether the function is virtual or not. - FLAGS are to be passed through to `grokclassfn'. - QUALS are qualifiers indicating whether the function is `const' - or `volatile'. - RAISES is a list of exceptions that this function can raise. - CHECK is 1 if we must find this method in CTYPE, 0 if we should - not look, and -1 if we should not call `grokclassfn' at all. - - Returns `NULL_TREE' if something goes wrong, after issuing - applicable error messages. */ - -static tree -grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, - raises, check, friendp, publicp, inlinep, funcdef_flag, - template_count, in_namespace) - tree ctype, type; - tree declarator; - tree orig_declarator; - int virtualp; - enum overload_flags flags; - tree quals, raises; - int check, friendp, publicp, inlinep, funcdef_flag, template_count; - tree in_namespace; -{ - tree cname, decl; - int staticp = ctype && TREE_CODE (type) == FUNCTION_TYPE; - int has_default_arg = 0; - tree t; - - if (ctype) - cname = TREE_CODE (TYPE_NAME (ctype)) == TYPE_DECL - ? TYPE_IDENTIFIER (ctype) : TYPE_NAME (ctype); - else - cname = NULL_TREE; - - if (raises) - { - type = build_exception_variant (type, raises); - } - - decl = build_lang_decl (FUNCTION_DECL, declarator, type); - /* Propagate volatile out from type to decl. */ - if (TYPE_VOLATILE (type)) - TREE_THIS_VOLATILE (decl) = 1; - - /* If this decl has namespace scope, set that up. */ - if (in_namespace) - set_decl_namespace (decl, in_namespace, friendp); - else if (publicp && ! ctype) - DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); - - /* `main' and builtins have implicit 'C' linkage. */ - if ((MAIN_NAME_P (declarator) - || (IDENTIFIER_LENGTH (declarator) > 10 - && IDENTIFIER_POINTER (declarator)[0] == '_' - && IDENTIFIER_POINTER (declarator)[1] == '_' - && strncmp (IDENTIFIER_POINTER (declarator)+2, "builtin_", 8) == 0)) - && current_lang_name == lang_name_cplusplus - && ctype == NULL_TREE - /* NULL_TREE means global namespace. */ - && DECL_CONTEXT (decl) == NULL_TREE) - DECL_LANGUAGE (decl) = lang_c; - - /* Should probably propagate const out from type to decl I bet (mrs). */ - if (staticp) - { - DECL_STATIC_FUNCTION_P (decl) = 1; - DECL_CONTEXT (decl) = ctype; - } - - if (ctype) - DECL_CLASS_CONTEXT (decl) = ctype; - - if (ctype == NULL_TREE && DECL_MAIN_P (decl)) - { - if (processing_template_decl) - error ("cannot declare `main' to be a template"); - if (inlinep) - error ("cannot declare `main' to be inline"); - else if (! publicp) - error ("cannot declare `main' to be static"); - inlinep = 0; - publicp = 1; - } - - /* Members of anonymous types and local classes have no linkage; make - them internal. */ - if (ctype && (ANON_AGGRNAME_P (TYPE_IDENTIFIER (ctype)) - || hack_decl_function_context (TYPE_MAIN_DECL (ctype)))) - publicp = 0; - - if (publicp) - { - /* [basic.link]: A name with no linkage (notably, the name of a class - or enumeration declared in a local scope) shall not be used to - declare an entity with linkage. - - Only check this for public decls for now. */ - t = no_linkage_check (TREE_TYPE (decl)); - if (t) - { - if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))) - { - if (DECL_LANGUAGE (decl) == lang_c) - /* Allow this; it's pretty common in C. */; - else - cp_pedwarn ("non-local function `%#D' uses anonymous type", - decl); - } - else - cp_pedwarn ("non-local function `%#D' uses local type `%T'", - decl, t); - } - } - - TREE_PUBLIC (decl) = publicp; - if (! publicp) - { - DECL_INTERFACE_KNOWN (decl) = 1; - DECL_NOT_REALLY_EXTERN (decl) = 1; - } - - if (inlinep) - DECL_THIS_INLINE (decl) = DECL_INLINE (decl) = 1; - - DECL_EXTERNAL (decl) = 1; - if (quals != NULL_TREE && TREE_CODE (type) == FUNCTION_TYPE) - { - cp_error ("%smember function `%D' cannot have `%T' method qualifier", - (ctype ? "static " : "non-"), decl, TREE_VALUE (quals)); - quals = NULL_TREE; - } - - if (IDENTIFIER_OPNAME_P (DECL_NAME (decl))) - grok_op_properties (decl, virtualp, check < 0); - - if (ctype && hack_decl_function_context (decl)) - DECL_NO_STATIC_CHAIN (decl) = 1; - - for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); t; t = TREE_CHAIN (t)) - if (TREE_PURPOSE (t) - && TREE_CODE (TREE_PURPOSE (t)) == DEFAULT_ARG) - { - has_default_arg = 1; - break; - } - - if (friendp - && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR) - { - if (funcdef_flag) - cp_error - ("defining explicit specialization `%D' in friend declaration", - orig_declarator); - else - { - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - { - /* Something like `template friend void f()'. */ - cp_error ("template-id `%D' in declaration of primary template", - orig_declarator); - return NULL_TREE; - } - - - /* A friend declaration of the form friend void f<>(). Record - the information in the TEMPLATE_ID_EXPR. */ - SET_DECL_IMPLICIT_INSTANTIATION (decl); - DECL_TEMPLATE_INFO (decl) - = perm_tree_cons (TREE_OPERAND (orig_declarator, 0), - TREE_OPERAND (orig_declarator, 1), - NULL_TREE); - - if (has_default_arg) - { - cp_error ("default arguments are not allowed in declaration of friend template specialization `%D'", - decl); - return NULL_TREE; - } - - if (inlinep) - { - cp_error ("`inline' is not allowed in declaration of friend template specialization `%D'", - decl); - return NULL_TREE; - } - } - } - - if (has_default_arg) - add_defarg_fn (decl); - - /* Plain overloading: will not be grok'd by grokclassfn. */ - if (! ctype && ! processing_template_decl - && DECL_LANGUAGE (decl) != lang_c - && (! DECL_USE_TEMPLATE (decl) || name_mangling_version < 1)) - set_mangled_name_for_decl (decl); - - if (funcdef_flag) - /* Make the init_value nonzero so pushdecl knows this is not - tentative. error_mark_node is replaced later with the BLOCK. */ - DECL_INITIAL (decl) = error_mark_node; - - /* Caller will do the rest of this. */ - if (check < 0) - return decl; - - if (check && funcdef_flag) - DECL_INITIAL (decl) = error_mark_node; - - if (flags == NO_SPECIAL && ctype && constructor_name (cname) == declarator) - { - tree tmp; - /* Just handle constructors here. We could do this - inside the following if stmt, but I think - that the code is more legible by breaking this - case out. See comments below for what each of - the following calls is supposed to do. */ - DECL_CONSTRUCTOR_P (decl) = 1; - - grokclassfn (ctype, decl, flags, quals); - - decl = check_explicit_specialization (orig_declarator, decl, - template_count, - 2 * (funcdef_flag != 0) + - 4 * (friendp != 0)); - if (decl == error_mark_node) - return NULL_TREE; - - if ((! TYPE_FOR_JAVA (ctype) || check_java_method (decl)) - && check) - { - tmp = check_classfn (ctype, decl); - - if (tmp && TREE_CODE (tmp) == TEMPLATE_DECL) - tmp = DECL_TEMPLATE_RESULT(tmp); - - if (tmp && DECL_ARTIFICIAL (tmp)) - cp_error ("definition of implicitly-declared `%D'", tmp); - if (tmp && duplicate_decls (decl, tmp)) - return tmp; - } - if (! grok_ctor_properties (ctype, decl)) - return NULL_TREE; - } - else - { - tree tmp; - - /* Function gets the ugly name, field gets the nice one. - This call may change the type of the function (because - of default parameters)! */ - if (ctype != NULL_TREE) - grokclassfn (ctype, decl, flags, quals); - - decl = check_explicit_specialization (orig_declarator, decl, - template_count, - 2 * (funcdef_flag != 0) + - 4 * (friendp != 0)); - if (decl == error_mark_node) - return NULL_TREE; - - if (ctype != NULL_TREE - && (! TYPE_FOR_JAVA (ctype) || check_java_method (decl)) - && check) - { - tmp = check_classfn (ctype, decl); - - if (tmp && TREE_CODE (tmp) == TEMPLATE_DECL) - tmp = DECL_TEMPLATE_RESULT (tmp); - - if (tmp && DECL_STATIC_FUNCTION_P (tmp) - && TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE) - { - /* Remove the `this' parm added by grokclassfn. - XXX Isn't this done in start_function, too? */ - revert_static_member_fn (&decl, NULL, NULL); - last_function_parms = TREE_CHAIN (last_function_parms); - } - if (tmp && DECL_ARTIFICIAL (tmp)) - cp_error ("definition of implicitly-declared `%D'", tmp); - if (tmp) - { - /* Attempt to merge the declarations. This can fail, in - the case of some illegal specialization declarations. */ - if (!duplicate_decls (decl, tmp)) - cp_error ("no `%#D' member function declared in class `%T'", - decl, ctype); - return tmp; - } - } - - if (ctype == NULL_TREE || check) - return decl; - - if (virtualp) - { - DECL_VIRTUAL_P (decl) = 1; - if (DECL_VINDEX (decl) == NULL_TREE) - DECL_VINDEX (decl) = error_mark_node; - IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)) = 1; - } - } - return decl; -} - -static tree -grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace) - tree type; - tree declarator; - RID_BIT_TYPE *specbits_in; - int initialized; - int constp; - tree in_namespace; -{ - tree decl; - RID_BIT_TYPE specbits; - - specbits = *specbits_in; - - if (TREE_CODE (type) == OFFSET_TYPE) - { - /* If you declare a static member so that it - can be initialized, the code will reach here. */ - tree basetype = TYPE_OFFSET_BASETYPE (type); - type = TREE_TYPE (type); - decl = build_lang_field_decl (VAR_DECL, declarator, type); - DECL_CONTEXT (decl) = basetype; - DECL_CLASS_CONTEXT (decl) = basetype; - DECL_ASSEMBLER_NAME (decl) = build_static_name (basetype, declarator); - } - else - { - tree context; - - if (in_namespace) - context = in_namespace; - else if (namespace_bindings_p () || RIDBIT_SETP (RID_EXTERN, specbits)) - context = current_namespace; - else - context = NULL_TREE; - - decl = build_decl (VAR_DECL, declarator, complete_type (type)); - - if (context) - set_decl_namespace (decl, context, 0); - - context = DECL_CONTEXT (decl); - if (declarator && context && current_lang_name != lang_name_c) - DECL_ASSEMBLER_NAME (decl) = build_static_name (context, declarator); - } - - if (in_namespace) - set_decl_namespace (decl, in_namespace, 0); - - if (RIDBIT_SETP (RID_EXTERN, specbits)) - { - DECL_THIS_EXTERN (decl) = 1; - DECL_EXTERNAL (decl) = !initialized; - } - - /* In class context, static means one per class, - public access, and static storage. */ - if (DECL_CLASS_SCOPE_P (decl)) - { - TREE_PUBLIC (decl) = 1; - TREE_STATIC (decl) = 1; - DECL_EXTERNAL (decl) = 0; - } - /* At top level, either `static' or no s.c. makes a definition - (perhaps tentative), and absence of `static' makes it public. */ - else if (toplevel_bindings_p ()) - { - TREE_PUBLIC (decl) = (RIDBIT_NOTSETP (RID_STATIC, specbits) - && (DECL_THIS_EXTERN (decl) || ! constp)); - TREE_STATIC (decl) = ! DECL_EXTERNAL (decl); - } - /* Not at top level, only `static' makes a static definition. */ - else - { - TREE_STATIC (decl) = !! RIDBIT_SETP (RID_STATIC, specbits); - TREE_PUBLIC (decl) = DECL_EXTERNAL (decl); - } - - if (TREE_PUBLIC (decl)) - { - /* [basic.link]: A name with no linkage (notably, the name of a class - or enumeration declared in a local scope) shall not be used to - declare an entity with linkage. - - Only check this for public decls for now. */ - tree t = no_linkage_check (TREE_TYPE (decl)); - if (t) - { - if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))) - /* Ignore for now; `enum { foo } e' is pretty common. */; - else - cp_pedwarn ("non-local variable `%#D' uses local type `%T'", - decl, t); - } - } - - return decl; -} - -/* Create and return a canonical pointer to member function type, for - TYPE, which is a POINTER_TYPE to a METHOD_TYPE. */ - -tree -build_ptrmemfunc_type (type) - tree type; -{ - tree fields[4]; - tree t; - tree u; - - /* If a canonical type already exists for this type, use it. We use - this method instead of type_hash_canon, because it only does a - simple equality check on the list of field members. */ - - if ((t = TYPE_GET_PTRMEMFUNC_TYPE (type))) - return t; - - push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type)); - - u = make_lang_type (UNION_TYPE); - SET_IS_AGGR_TYPE (u, 0); - fields[0] = build_lang_field_decl (FIELD_DECL, pfn_identifier, type); - fields[1] = build_lang_field_decl (FIELD_DECL, delta2_identifier, - delta_type_node); - finish_builtin_type (u, "__ptrmemfunc_type", fields, 1, ptr_type_node); - TYPE_NAME (u) = NULL_TREE; - - t = make_lang_type (RECORD_TYPE); - - /* Let the front-end know this is a pointer to member function... */ - TYPE_PTRMEMFUNC_FLAG (t) = 1; - /* ... and not really an aggregate. */ - SET_IS_AGGR_TYPE (t, 0); - - fields[0] = build_lang_field_decl (FIELD_DECL, delta_identifier, - delta_type_node); - fields[1] = build_lang_field_decl (FIELD_DECL, index_identifier, - delta_type_node); - fields[2] = build_lang_field_decl (FIELD_DECL, pfn_or_delta2_identifier, u); - finish_builtin_type (t, "__ptrmemfunc_type", fields, 2, ptr_type_node); - - pop_obstacks (); - - /* Zap out the name so that the back-end will give us the debugging - information for this anonymous RECORD_TYPE. */ - TYPE_NAME (t) = NULL_TREE; - - TYPE_SET_PTRMEMFUNC_TYPE (type, t); - - /* Seems to be wanted. */ - CLASSTYPE_GOT_SEMICOLON (t) = 1; - return t; -} - -/* DECL is a VAR_DECL defined in-class, whose TYPE is also given. - Check to see that the definition is valid. Issue appropriate error - messages. Return 1 if the definition is particularly bad, or 0 - otherwise. */ - -int -check_static_variable_definition (decl, type) - tree decl; - tree type; -{ - /* Motion 10 at San Diego: If a static const integral data member is - initialized with an integral constant expression, the initializer - may appear either in the declaration (within the class), or in - the definition, but not both. If it appears in the class, the - member is a member constant. The file-scope definition is always - required. */ - if (CLASS_TYPE_P (type) || TREE_CODE (type) == REFERENCE_TYPE) - { - cp_error ("in-class initialization of static data member of non-integral type `%T'", - type); - /* If we just return the declaration, crashes will sometimes - occur. We therefore return void_type_node, as if this was a - friend declaration, to cause callers to completely ignore - this declaration. */ - return 1; - } - else if (!CP_TYPE_CONST_P (type)) - cp_error ("ANSI C++ forbids in-class initialization of non-const static member `%D'", - decl); - else if (pedantic && !INTEGRAL_TYPE_P (type)) - cp_pedwarn ("ANSI C++ forbids initialization of member constant `%D' of non-integral type `%T'", decl, type); - - return 0; -} - -/* Given declspecs and a declarator, - determine the name and type of the object declared - and construct a ..._DECL node for it. - (In one case we can return a ..._TYPE node instead. - For invalid input we sometimes return 0.) - - DECLSPECS is a chain of tree_list nodes whose value fields - are the storage classes and type specifiers. - - DECL_CONTEXT says which syntactic context this declaration is in: - NORMAL for most contexts. Make a VAR_DECL or FUNCTION_DECL or TYPE_DECL. - FUNCDEF for a function definition. Like NORMAL but a few different - error messages in each case. Return value may be zero meaning - this definition is too screwy to try to parse. - MEMFUNCDEF for a function definition. Like FUNCDEF but prepares to - handle member functions (which have FIELD context). - Return value may be zero meaning this definition is too screwy to - try to parse. - PARM for a parameter declaration (either within a function prototype - or before a function body). Make a PARM_DECL, or return void_type_node. - CATCHPARM for a parameter declaration before a catch clause. - TYPENAME if for a typename (in a cast or sizeof). - Don't make a DECL node; just return the ..._TYPE node. - FIELD for a struct or union field; make a FIELD_DECL. - BITFIELD for a field with specified width. - INITIALIZED is 1 if the decl has an initializer. - - ATTRLIST is a TREE_LIST node with prefix attributes in TREE_VALUE and - normal attributes in TREE_PURPOSE, or NULL_TREE. - - In the TYPENAME case, DECLARATOR is really an absolute declarator. - It may also be so in the PARM case, for a prototype where the - argument type is specified but not the name. - - This function is where the complicated C meanings of `static' - and `extern' are interpreted. - - For C++, if there is any monkey business to do, the function which - calls this one must do it, i.e., prepending instance variables, - renaming overloaded function names, etc. - - Note that for this C++, it is an error to define a method within a class - which does not belong to that class. - - Except in the case where SCOPE_REFs are implicitly known (such as - methods within a class being redundantly qualified), - declarations which involve SCOPE_REFs are returned as SCOPE_REFs - (class_name::decl_name). The caller must also deal with this. - - If a constructor or destructor is seen, and the context is FIELD, - then the type gains the attribute TREE_HAS_x. If such a declaration - is erroneous, NULL_TREE is returned. - - QUALS is used only for FUNCDEF and MEMFUNCDEF cases. For a member - function, these are the qualifiers to give to the `this' pointer. - - May return void_type_node if the declarator turned out to be a friend. - See grokfield for details. */ - -enum return_types { return_normal, return_ctor, return_dtor, return_conversion }; - -tree -grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) - tree declspecs; - tree declarator; - enum decl_context decl_context; - int initialized; - tree attrlist; -{ - RID_BIT_TYPE specbits; - int nclasses = 0; - tree spec; - tree type = NULL_TREE; - int longlong = 0; - int constp; - int restrictp; - int volatilep; - int type_quals; - int virtualp, explicitp, friendp, inlinep, staticp; - int explicit_int = 0; - int explicit_char = 0; - int defaulted_int = 0; - int opaque_typedef = 0; - tree typedef_decl = NULL_TREE; - char *name; - tree typedef_type = NULL_TREE; - int funcdef_flag = 0; - enum tree_code innermost_code = ERROR_MARK; - int bitfield = 0; -#if 0 - /* See the code below that used this. */ - tree decl_machine_attr = NULL_TREE; -#endif - /* Set this to error_mark_node for FIELD_DECLs we could not handle properly. - All FIELD_DECLs we build here have `init' put into their DECL_INITIAL. */ - tree init = NULL_TREE; - - /* Keep track of what sort of function is being processed - so that we can warn about default return values, or explicit - return values which do not match prescribed defaults. */ - enum return_types return_type = return_normal; - - tree dname = NULL_TREE; - tree ctype = current_class_type; - tree ctor_return_type = NULL_TREE; - enum overload_flags flags = NO_SPECIAL; - tree quals = NULL_TREE; - tree raises = NULL_TREE; - int template_count = 0; - tree in_namespace = NULL_TREE; - tree inner_attrs; - int ignore_attrs; - - RIDBIT_RESET_ALL (specbits); - if (decl_context == FUNCDEF) - funcdef_flag = 1, decl_context = NORMAL; - else if (decl_context == MEMFUNCDEF) - funcdef_flag = -1, decl_context = FIELD; - else if (decl_context == BITFIELD) - bitfield = 1, decl_context = FIELD; - - /* Look inside a declarator for the name being declared - and get it as a string, for an error message. */ - { - tree *next = &declarator; - register tree decl; - name = NULL; - - while (next && *next) - { - decl = *next; - switch (TREE_CODE (decl)) - { - case TREE_LIST: - /* For attributes. */ - next = &TREE_VALUE (decl); - break; - - case COND_EXPR: - ctype = NULL_TREE; - next = &TREE_OPERAND (decl, 0); - break; - - case BIT_NOT_EXPR: /* For C++ destructors! */ - { - tree name = TREE_OPERAND (decl, 0); - tree rename = NULL_TREE; - - my_friendly_assert (flags == NO_SPECIAL, 152); - flags = DTOR_FLAG; - return_type = return_dtor; - if (TREE_CODE (name) == TYPE_DECL) - TREE_OPERAND (decl, 0) = name = constructor_name (name); - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 153); - if (ctype == NULL_TREE) - { - if (current_class_type == NULL_TREE) - { - error ("destructors must be member functions"); - flags = NO_SPECIAL; - } - else - { - tree t = constructor_name (current_class_name); - if (t != name) - rename = t; - } - } - else - { - tree t = constructor_name (ctype); - if (t != name) - rename = t; - } - - if (rename) - { - cp_error ("destructor `%T' must match class name `%T'", - name, rename); - TREE_OPERAND (decl, 0) = rename; - } - next = &name; - } - break; - - case ADDR_EXPR: /* C++ reference declaration */ - /* Fall through. */ - case ARRAY_REF: - case INDIRECT_REF: - ctype = NULL_TREE; - innermost_code = TREE_CODE (decl); - next = &TREE_OPERAND (decl, 0); - break; - - case CALL_EXPR: - if (parmlist_is_exprlist (TREE_OPERAND (decl, 1))) - { - /* This is actually a variable declaration using - constructor syntax. We need to call start_decl and - cp_finish_decl so we can get the variable - initialized... */ - - tree attributes, prefix_attributes; - - *next = TREE_OPERAND (decl, 0); - init = TREE_OPERAND (decl, 1); - - if (attrlist) - { - attributes = TREE_PURPOSE (attrlist); - prefix_attributes = TREE_VALUE (attrlist); - } - else - { - attributes = NULL_TREE; - prefix_attributes = NULL_TREE; - } - - decl = start_decl (declarator, declspecs, 1, - attributes, prefix_attributes); - if (decl) - { - /* Look for __unused__ attribute */ - if (TREE_USED (TREE_TYPE (decl))) - TREE_USED (decl) = 1; - finish_decl (decl, init, NULL_TREE); - } - else - cp_error ("invalid declarator"); - return 0; - } - innermost_code = TREE_CODE (decl); - if (decl_context == FIELD && ctype == NULL_TREE) - ctype = current_class_type; - if (ctype - && TREE_OPERAND (decl, 0) - && (TREE_CODE (TREE_OPERAND (decl, 0)) == TYPE_DECL - && ((DECL_NAME (TREE_OPERAND (decl, 0)) - == constructor_name_full (ctype)) - || (DECL_NAME (TREE_OPERAND (decl, 0)) - == constructor_name (ctype))))) - TREE_OPERAND (decl, 0) = constructor_name (ctype); - next = &TREE_OPERAND (decl, 0); - decl = *next; - if (ctype != NULL_TREE - && decl != NULL_TREE && flags != DTOR_FLAG - && decl == constructor_name (ctype)) - { - return_type = return_ctor; - ctor_return_type = ctype; - } - ctype = NULL_TREE; - break; - - case TEMPLATE_ID_EXPR: - { - tree fns = TREE_OPERAND (decl, 0); - - if (TREE_CODE (fns) == LOOKUP_EXPR) - fns = TREE_OPERAND (fns, 0); - - dname = fns; - if (TREE_CODE (dname) == COMPONENT_REF) - dname = TREE_OPERAND (dname, 1); - if (TREE_CODE (dname) != IDENTIFIER_NODE) - { - my_friendly_assert (is_overloaded_fn (dname), - 19990331); - dname = DECL_NAME (get_first_fn (dname)); - } - } - /* Fall through. */ - - case IDENTIFIER_NODE: - if (TREE_CODE (decl) == IDENTIFIER_NODE) - dname = decl; - - next = 0; - - if (is_rid (dname)) - { - cp_error ("declarator-id missing; using reserved word `%D'", - dname); - name = IDENTIFIER_POINTER (dname); - } - if (! IDENTIFIER_OPNAME_P (dname) - /* GNU/Linux headers use '__op'. Arrgh. */ - || (IDENTIFIER_TYPENAME_P (dname) && ! TREE_TYPE (dname))) - name = IDENTIFIER_POINTER (dname); - else - { - if (IDENTIFIER_TYPENAME_P (dname)) - { - my_friendly_assert (flags == NO_SPECIAL, 154); - flags = TYPENAME_FLAG; - ctor_return_type = TREE_TYPE (dname); - return_type = return_conversion; - } - name = operator_name_string (dname); - } - break; - - /* C++ extension */ - case SCOPE_REF: - { - /* Perform error checking, and decide on a ctype. */ - tree cname = TREE_OPERAND (decl, 0); - if (cname == NULL_TREE) - ctype = NULL_TREE; - else if (TREE_CODE (cname) == NAMESPACE_DECL) - { - ctype = NULL_TREE; - in_namespace = TREE_OPERAND (decl, 0); - TREE_OPERAND (decl, 0) = NULL_TREE; - } - else if (! is_aggr_type (cname, 1)) - TREE_OPERAND (decl, 0) = NULL_TREE; - /* Must test TREE_OPERAND (decl, 1), in case user gives - us `typedef (class::memfunc)(int); memfunc *memfuncptr;' */ - else if (TREE_OPERAND (decl, 1) - && TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF) - ctype = cname; - else if (TREE_CODE (cname) == TEMPLATE_TYPE_PARM - || TREE_CODE (cname) == TEMPLATE_TEMPLATE_PARM) - { - cp_error ("`%T::%D' is not a valid declarator", cname, - TREE_OPERAND (decl, 1)); - cp_error (" perhaps you want `typename %T::%D' to make it a type", - cname, TREE_OPERAND (decl, 1)); - return void_type_node; - } - else if (ctype == NULL_TREE) - ctype = cname; - else if (TREE_COMPLEXITY (decl) == current_class_depth) - TREE_OPERAND (decl, 0) = ctype; - else - { - if (! UNIQUELY_DERIVED_FROM_P (cname, ctype)) - { - cp_error ("type `%T' is not derived from type `%T'", - cname, ctype); - TREE_OPERAND (decl, 0) = NULL_TREE; - } - else - ctype = cname; - } - - if (ctype && TREE_CODE (TREE_OPERAND (decl, 1)) == TYPE_DECL - && ((DECL_NAME (TREE_OPERAND (decl, 1)) - == constructor_name_full (ctype)) - || (DECL_NAME (TREE_OPERAND (decl, 1)) - == constructor_name (ctype)))) - TREE_OPERAND (decl, 1) = constructor_name (ctype); - next = &TREE_OPERAND (decl, 1); - decl = *next; - if (ctype) - { - if (TREE_CODE (decl) == IDENTIFIER_NODE - && constructor_name (ctype) == decl) - { - return_type = return_ctor; - ctor_return_type = ctype; - } - else if (TREE_CODE (decl) == BIT_NOT_EXPR - && TREE_CODE (TREE_OPERAND (decl, 0)) == IDENTIFIER_NODE - && (constructor_name (ctype) == TREE_OPERAND (decl, 0) - || constructor_name_full (ctype) == TREE_OPERAND (decl, 0))) - { - return_type = return_dtor; - ctor_return_type = ctype; - flags = DTOR_FLAG; - TREE_OPERAND (decl, 0) = constructor_name (ctype); - next = &TREE_OPERAND (decl, 0); - } - } - } - break; - - case ERROR_MARK: - next = 0; - break; - - case TYPE_DECL: - /* Parse error puts this typespec where - a declarator should go. */ - cp_error ("`%T' specified as declarator-id", DECL_NAME (decl)); - if (TREE_TYPE (decl) == current_class_type) - cp_error (" perhaps you want `%T' for a constructor", - current_class_name); - dname = DECL_NAME (decl); - name = IDENTIFIER_POINTER (dname); - - /* Avoid giving two errors for this. */ - IDENTIFIER_CLASS_VALUE (dname) = NULL_TREE; - - declspecs = temp_tree_cons (NULL_TREE, integer_type_node, - declspecs); - *next = dname; - next = 0; - break; - - default: - cp_compiler_error ("`%D' as declarator", decl); - return 0; /* We used to do a 155 abort here. */ - } - } - if (name == NULL) - name = "type name"; - } - - /* A function definition's declarator must have the form of - a function declarator. */ - - if (funcdef_flag && innermost_code != CALL_EXPR) - return 0; - - if (((dname && IDENTIFIER_OPNAME_P (dname)) || flags == TYPENAME_FLAG) - && innermost_code != CALL_EXPR - && ! (ctype && declspecs == NULL_TREE)) - { - cp_error ("declaration of `%D' as non-function", dname); - return void_type_node; - } - - /* Anything declared one level down from the top level - must be one of the parameters of a function - (because the body is at least two levels down). */ - - /* This heuristic cannot be applied to C++ nodes! Fixed, however, - by not allowing C++ class definitions to specify their parameters - with xdecls (must be spec.d in the parmlist). - - Since we now wait to push a class scope until we are sure that - we are in a legitimate method context, we must set oldcname - explicitly (since current_class_name is not yet alive). - - We also want to avoid calling this a PARM if it is in a namespace. */ - - if (decl_context == NORMAL && ! namespace_bindings_p () - && ! pseudo_global_level_p ()) - { - struct binding_level *b = current_binding_level; - current_binding_level = b->level_chain; - if (current_binding_level != 0 && toplevel_bindings_p ()) - decl_context = PARM; - current_binding_level = b; - } - - /* Look through the decl specs and record which ones appear. - Some typespecs are defined as built-in typenames. - Others, the ones that are modifiers of other types, - are represented by bits in SPECBITS: set the bits for - the modifiers that appear. Storage class keywords are also in SPECBITS. - - If there is a typedef name or a type, store the type in TYPE. - This includes builtin typedefs such as `int'. - - Set EXPLICIT_INT if the type is `int' or `char' and did not - come from a user typedef. - - Set LONGLONG if `long' is mentioned twice. - - For C++, constructors and destructors have their own fast treatment. */ - - for (spec = declspecs; spec; spec = TREE_CHAIN (spec)) - { - register int i; - register tree id; - - /* Certain parse errors slip through. For example, - `int class;' is not caught by the parser. Try - weakly to recover here. */ - if (TREE_CODE (spec) != TREE_LIST) - return 0; - - id = TREE_VALUE (spec); - - if (TREE_CODE (id) == IDENTIFIER_NODE) - { - if (id == ridpointers[(int) RID_INT] - || id == ridpointers[(int) RID_CHAR] - || id == ridpointers[(int) RID_BOOL] - || id == ridpointers[(int) RID_WCHAR]) - { - if (type) - { - if (id == ridpointers[(int) RID_BOOL]) - error ("`bool' is now a keyword"); - else - cp_error ("extraneous `%T' ignored", id); - } - else - { - if (id == ridpointers[(int) RID_INT]) - explicit_int = 1; - else if (id == ridpointers[(int) RID_CHAR]) - explicit_char = 1; - type = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (id)); - } - goto found; - } - /* C++ aggregate types. */ - if (IDENTIFIER_HAS_TYPE_VALUE (id)) - { - if (type) - cp_error ("multiple declarations `%T' and `%T'", type, id); - else - type = IDENTIFIER_TYPE_VALUE (id); - goto found; - } - - for (i = (int) RID_FIRST_MODIFIER; i <= (int) RID_LAST_MODIFIER; i++) - { - if (ridpointers[i] == id) - { - if (i == (int) RID_LONG && RIDBIT_SETP (i, specbits)) - { - if (pedantic && ! in_system_header && warn_long_long) - pedwarn ("ANSI C++ does not support `long long'"); - if (longlong) - error ("`long long long' is too long for GCC"); - else - longlong = 1; - } - else if (RIDBIT_SETP (i, specbits)) - pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id)); - RIDBIT_SET (i, specbits); - goto found; - } - } - } - /* C++ aggregate types. */ - else if (TREE_CODE (id) == TYPE_DECL || TREE_CODE (id) == TEMPLATE_DECL) - { - if (type) - cp_error ("multiple declarations `%T' and `%T'", type, - TREE_TYPE (id)); - else - { - type = TREE_TYPE (id); - TREE_VALUE (spec) = type; - } - goto found; - } - if (type) - error ("two or more data types in declaration of `%s'", name); - else if (TREE_CODE (id) == IDENTIFIER_NODE) - { - register tree t = lookup_name (id, 1); - if (!t || TREE_CODE (t) != TYPE_DECL) - error ("`%s' fails to be a typedef or built in type", - IDENTIFIER_POINTER (id)); - else - { - type = TREE_TYPE (t); -#if 0 - /* See the code below that used this. */ - decl_machine_attr = DECL_MACHINE_ATTRIBUTES (id); -#endif - typedef_decl = t; - } - } - else if (id != error_mark_node) - /* Can't change CLASS nodes into RECORD nodes here! */ - type = id; - - found: ; - } - - typedef_type = type; - - /* No type at all: default to `int', and set DEFAULTED_INT - because it was not a user-defined typedef. - Except when we have a `typedef' inside a signature, in - which case the type defaults to `unknown type' and is - instantiated when assigning to a signature pointer or ref. */ - - if (type == NULL_TREE - && (RIDBIT_SETP (RID_SIGNED, specbits) - || RIDBIT_SETP (RID_UNSIGNED, specbits) - || RIDBIT_SETP (RID_LONG, specbits) - || RIDBIT_SETP (RID_SHORT, specbits))) - { - /* These imply 'int'. */ - type = integer_type_node; - defaulted_int = 1; - } - - if (type == NULL_TREE) - { - explicit_int = -1; - if (return_type == return_dtor) - type = void_type_node; - else if (return_type == return_ctor) - type = build_pointer_type (ctor_return_type); - else if (return_type == return_conversion) - type = ctor_return_type; - else if (current_class_type - && IS_SIGNATURE (current_class_type) - && RIDBIT_SETP (RID_TYPEDEF, specbits) - && (decl_context == FIELD || decl_context == NORMAL)) - { - explicit_int = 0; - opaque_typedef = 1; - type = copy_node (opaque_type_node); - } - else - { - /* We handle `main' specially here, because 'main () { }' is so - common. With no options, it is allowed. With -Wreturn-type, - it is a warning. It is only an error with -pedantic-errors. */ - int is_main = (funcdef_flag - && MAIN_NAME_P (dname) - && ctype == NULL_TREE - && in_namespace == NULL_TREE - && current_namespace == global_namespace); - - if (in_system_header) - /* Allow it, sigh. */; - else if (pedantic || ! is_main) - cp_pedwarn ("ANSI C++ forbids declaration `%D' with no type", - dname); - else if (warn_return_type) - cp_warning ("ANSI C++ forbids declaration `%D' with no type", - dname); - - type = integer_type_node; - } - } - else if (return_type == return_dtor) - { - error ("return type specification for destructor invalid"); - type = void_type_node; - } - else if (return_type == return_ctor) - { - error ("return type specification for constructor invalid"); - type = build_pointer_type (ctor_return_type); - } - else if (return_type == return_conversion) - { - if (!same_type_p (type, ctor_return_type)) - cp_error ("operator `%T' declared to return `%T'", - ctor_return_type, type); - else - cp_pedwarn ("return type specified for `operator %T'", - ctor_return_type); - - type = ctor_return_type; - } - - ctype = NULL_TREE; - - /* Now process the modifiers that were specified - and check for invalid combinations. */ - - /* Long double is a special combination. */ - - if (RIDBIT_SETP (RID_LONG, specbits) - && TYPE_MAIN_VARIANT (type) == double_type_node) - { - RIDBIT_RESET (RID_LONG, specbits); - type = build_qualified_type (long_double_type_node, - CP_TYPE_QUALS (type)); - } - - /* Check all other uses of type modifiers. */ - - if (RIDBIT_SETP (RID_UNSIGNED, specbits) - || RIDBIT_SETP (RID_SIGNED, specbits) - || RIDBIT_SETP (RID_LONG, specbits) - || RIDBIT_SETP (RID_SHORT, specbits)) - { - int ok = 0; - - if (TREE_CODE (type) == REAL_TYPE) - error ("short, signed or unsigned invalid for `%s'", name); - else if (TREE_CODE (type) != INTEGER_TYPE) - error ("long, short, signed or unsigned invalid for `%s'", name); - else if (RIDBIT_SETP (RID_LONG, specbits) - && RIDBIT_SETP (RID_SHORT, specbits)) - error ("long and short specified together for `%s'", name); - else if ((RIDBIT_SETP (RID_LONG, specbits) - || RIDBIT_SETP (RID_SHORT, specbits)) - && explicit_char) - error ("long or short specified with char for `%s'", name); - else if ((RIDBIT_SETP (RID_LONG, specbits) - || RIDBIT_SETP (RID_SHORT, specbits)) - && TREE_CODE (type) == REAL_TYPE) - error ("long or short specified with floating type for `%s'", name); - else if (RIDBIT_SETP (RID_SIGNED, specbits) - && RIDBIT_SETP (RID_UNSIGNED, specbits)) - error ("signed and unsigned given together for `%s'", name); - else - { - ok = 1; - if (!explicit_int && !defaulted_int && !explicit_char && pedantic) - { - pedwarn ("long, short, signed or unsigned used invalidly for `%s'", - name); - if (flag_pedantic_errors) - ok = 0; - } - } - - /* Discard the type modifiers if they are invalid. */ - if (! ok) - { - RIDBIT_RESET (RID_UNSIGNED, specbits); - RIDBIT_RESET (RID_SIGNED, specbits); - RIDBIT_RESET (RID_LONG, specbits); - RIDBIT_RESET (RID_SHORT, specbits); - longlong = 0; - } - } - - if (RIDBIT_SETP (RID_COMPLEX, specbits) - && TREE_CODE (type) != INTEGER_TYPE && TREE_CODE (type) != REAL_TYPE) - { - error ("complex invalid for `%s'", name); - RIDBIT_RESET (RID_COMPLEX, specbits); - } - - /* Decide whether an integer type is signed or not. - Optionally treat bitfields as signed by default. */ - if (RIDBIT_SETP (RID_UNSIGNED, specbits) - || (bitfield && ! flag_signed_bitfields - && (explicit_int || defaulted_int || explicit_char - /* A typedef for plain `int' without `signed' - can be controlled just like plain `int'. */ - || ! (typedef_decl != NULL_TREE - && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl))) - && TREE_CODE (type) != ENUMERAL_TYPE - && RIDBIT_NOTSETP (RID_SIGNED, specbits))) - { - if (longlong) - type = long_long_unsigned_type_node; - else if (RIDBIT_SETP (RID_LONG, specbits)) - type = long_unsigned_type_node; - else if (RIDBIT_SETP (RID_SHORT, specbits)) - type = short_unsigned_type_node; - else if (type == char_type_node) - type = unsigned_char_type_node; - else if (typedef_decl) - type = unsigned_type (type); - else - type = unsigned_type_node; - } - else if (RIDBIT_SETP (RID_SIGNED, specbits) - && type == char_type_node) - type = signed_char_type_node; - else if (longlong) - type = long_long_integer_type_node; - else if (RIDBIT_SETP (RID_LONG, specbits)) - type = long_integer_type_node; - else if (RIDBIT_SETP (RID_SHORT, specbits)) - type = short_integer_type_node; - - if (RIDBIT_SETP (RID_COMPLEX, specbits)) - { - /* If we just have "complex", it is equivalent to - "complex double", but if any modifiers at all are specified it is - the complex form of TYPE. E.g, "complex short" is - "complex short int". */ - - if (defaulted_int && ! longlong - && ! (RIDBIT_SETP (RID_LONG, specbits) - || RIDBIT_SETP (RID_SHORT, specbits) - || RIDBIT_SETP (RID_SIGNED, specbits) - || RIDBIT_SETP (RID_UNSIGNED, specbits))) - type = complex_double_type_node; - else if (type == integer_type_node) - type = complex_integer_type_node; - else if (type == float_type_node) - type = complex_float_type_node; - else if (type == double_type_node) - type = complex_double_type_node; - else if (type == long_double_type_node) - type = complex_long_double_type_node; - else - type = build_complex_type (type); - } - - if (return_type == return_conversion - && (RIDBIT_SETP (RID_CONST, specbits) - || RIDBIT_SETP (RID_VOLATILE, specbits) - || RIDBIT_SETP (RID_RESTRICT, specbits))) - cp_error ("qualifiers are not allowed on declaration of `operator %T'", - ctor_return_type); - - /* Set CONSTP if this declaration is `const', whether by - explicit specification or via a typedef. - Likewise for VOLATILEP. */ - - constp = !! RIDBIT_SETP (RID_CONST, specbits) + CP_TYPE_CONST_P (type); - restrictp = - !! RIDBIT_SETP (RID_RESTRICT, specbits) + CP_TYPE_RESTRICT_P (type); - volatilep = - !! RIDBIT_SETP (RID_VOLATILE, specbits) + CP_TYPE_VOLATILE_P (type); - type_quals = ((constp ? TYPE_QUAL_CONST : 0) - | (restrictp ? TYPE_QUAL_RESTRICT : 0) - | (volatilep ? TYPE_QUAL_VOLATILE : 0)); - type = cp_build_qualified_type (type, type_quals); - staticp = 0; - inlinep = !! RIDBIT_SETP (RID_INLINE, specbits); - virtualp = RIDBIT_SETP (RID_VIRTUAL, specbits); - RIDBIT_RESET (RID_VIRTUAL, specbits); - explicitp = RIDBIT_SETP (RID_EXPLICIT, specbits) != 0; - RIDBIT_RESET (RID_EXPLICIT, specbits); - - if (RIDBIT_SETP (RID_STATIC, specbits)) - staticp = 1 + (decl_context == FIELD); - - if (virtualp && staticp == 2) - { - cp_error ("member `%D' cannot be declared both virtual and static", - dname); - staticp = 0; - } - friendp = RIDBIT_SETP (RID_FRIEND, specbits); - RIDBIT_RESET (RID_FRIEND, specbits); - - /* $7.1.2, Function specifiers */ - if (friendp && explicitp) - error ("only declarations of constructors can be `explicit'"); - - if (RIDBIT_SETP (RID_MUTABLE, specbits)) - { - if (decl_context == PARM) - { - error ("non-member `%s' cannot be declared `mutable'", name); - RIDBIT_RESET (RID_MUTABLE, specbits); - } - else if (friendp || decl_context == TYPENAME) - { - error ("non-object member `%s' cannot be declared `mutable'", name); - RIDBIT_RESET (RID_MUTABLE, specbits); - } - } - - /* Warn if two storage classes are given. Default to `auto'. */ - - if (RIDBIT_ANY_SET (specbits)) - { - if (RIDBIT_SETP (RID_STATIC, specbits)) nclasses++; - if (RIDBIT_SETP (RID_EXTERN, specbits)) nclasses++; - if (decl_context == PARM && nclasses > 0) - error ("storage class specifiers invalid in parameter declarations"); - if (RIDBIT_SETP (RID_TYPEDEF, specbits)) - { - if (decl_context == PARM) - error ("typedef declaration invalid in parameter declaration"); - nclasses++; - } - if (RIDBIT_SETP (RID_AUTO, specbits)) nclasses++; - if (RIDBIT_SETP (RID_REGISTER, specbits)) nclasses++; - } - - /* Give error if `virtual' is used outside of class declaration. */ - if (virtualp - && (current_class_name == NULL_TREE || decl_context != FIELD)) - { - error ("virtual outside class declaration"); - virtualp = 0; - } - if (current_class_name == NULL_TREE && RIDBIT_SETP (RID_MUTABLE, specbits)) - { - error ("only members can be declared mutable"); - RIDBIT_RESET (RID_MUTABLE, specbits); - } - - /* Static anonymous unions are dealt with here. */ - if (staticp && decl_context == TYPENAME - && TREE_CODE (declspecs) == TREE_LIST - && ANON_UNION_TYPE_P (TREE_VALUE (declspecs))) - decl_context = FIELD; - - /* Give error if `const,' `volatile,' `inline,' `friend,' or `virtual' - is used in a signature member function declaration. */ - if (decl_context == FIELD - && IS_SIGNATURE (current_class_type) - && RIDBIT_NOTSETP (RID_TYPEDEF, specbits)) - { - if (type_quals != TYPE_UNQUALIFIED) - { - error ("type qualifiers specified for signature member function `%s'", name); - type_quals = TYPE_UNQUALIFIED; - } - if (inlinep) - { - error ("`inline' specified for signature member function `%s'", name); - /* Later, we'll make signature member functions inline. */ - inlinep = 0; - } - if (friendp) - { - error ("`friend' declaration in signature definition"); - friendp = 0; - } - if (virtualp) - { - error ("`virtual' specified for signature member function `%s'", - name); - /* Later, we'll make signature member functions virtual. */ - virtualp = 0; - } - } - - /* Warn about storage classes that are invalid for certain - kinds of declarations (parameters, typenames, etc.). */ - - if (nclasses > 1) - error ("multiple storage classes in declaration of `%s'", name); - else if (decl_context != NORMAL && nclasses > 0) - { - if ((decl_context == PARM || decl_context == CATCHPARM) - && (RIDBIT_SETP (RID_REGISTER, specbits) - || RIDBIT_SETP (RID_AUTO, specbits))) - ; - else if (RIDBIT_SETP (RID_TYPEDEF, specbits)) - ; - else if (decl_context == FIELD - && ! IS_SIGNATURE (current_class_type) - /* C++ allows static class elements */ - && RIDBIT_SETP (RID_STATIC, specbits)) - /* C++ also allows inlines and signed and unsigned elements, - but in those cases we don't come in here. */ - ; - else - { - if (decl_context == FIELD) - { - tree tmp = NULL_TREE; - register int op = 0; - - if (declarator) - { - /* Avoid trying to get an operand off an identifier node. */ - if (TREE_CODE (declarator) == IDENTIFIER_NODE) - tmp = declarator; - else - tmp = TREE_OPERAND (declarator, 0); - op = IDENTIFIER_OPNAME_P (tmp); - } - error ("storage class specified for %s `%s'", - IS_SIGNATURE (current_class_type) - ? (op - ? "signature member operator" - : "signature member function") - : (op ? "member operator" : "field"), - op ? operator_name_string (tmp) : name); - } - else - error (((decl_context == PARM || decl_context == CATCHPARM) - ? "storage class specified for parameter `%s'" - : "storage class specified for typename"), name); - RIDBIT_RESET (RID_REGISTER, specbits); - RIDBIT_RESET (RID_AUTO, specbits); - RIDBIT_RESET (RID_EXTERN, specbits); - - if (decl_context == FIELD && IS_SIGNATURE (current_class_type)) - { - RIDBIT_RESET (RID_STATIC, specbits); - staticp = 0; - } - } - } - else if (RIDBIT_SETP (RID_EXTERN, specbits) && initialized && !funcdef_flag) - { - if (toplevel_bindings_p ()) - { - /* It's common practice (and completely valid) to have a const - be initialized and declared extern. */ - if (!(type_quals & TYPE_QUAL_CONST)) - warning ("`%s' initialized and declared `extern'", name); - } - else - error ("`%s' has both `extern' and initializer", name); - } - else if (RIDBIT_SETP (RID_EXTERN, specbits) && funcdef_flag - && ! toplevel_bindings_p ()) - error ("nested function `%s' declared `extern'", name); - else if (toplevel_bindings_p ()) - { - if (RIDBIT_SETP (RID_AUTO, specbits)) - error ("top-level declaration of `%s' specifies `auto'", name); - } - - if (nclasses > 0 && friendp) - error ("storage class specifiers invalid in friend function declarations"); - - /* Now figure out the structure of the declarator proper. - Descend through it, creating more complex types, until we reach - the declared identifier (or NULL_TREE, in an absolute declarator). */ - - inner_attrs = NULL_TREE; - ignore_attrs = 0; - - while (declarator && TREE_CODE (declarator) != IDENTIFIER_NODE - && TREE_CODE (declarator) != TEMPLATE_ID_EXPR) - { - /* Each level of DECLARATOR is either an ARRAY_REF (for ...[..]), - an INDIRECT_REF (for *...), - a CALL_EXPR (for ...(...)), - an identifier (for the name being declared) - or a null pointer (for the place in an absolute declarator - where the name was omitted). - For the last two cases, we have just exited the loop. - - For C++ it could also be - a SCOPE_REF (for class :: ...). In this case, we have converted - sensible names to types, and those are the values we use to - qualify the member name. - an ADDR_EXPR (for &...), - a BIT_NOT_EXPR (for destructors) - - At this point, TYPE is the type of elements of an array, - or for a function to return, or for a pointer to point to. - After this sequence of ifs, TYPE is the type of the - array or function or pointer, and DECLARATOR has had its - outermost layer removed. */ - - if (type == error_mark_node) - { - if (TREE_CODE (declarator) == SCOPE_REF) - declarator = TREE_OPERAND (declarator, 1); - else - declarator = TREE_OPERAND (declarator, 0); - continue; - } - if (quals != NULL_TREE - && (declarator == NULL_TREE - || TREE_CODE (declarator) != SCOPE_REF)) - { - if (ctype == NULL_TREE && TREE_CODE (type) == METHOD_TYPE) - ctype = TYPE_METHOD_BASETYPE (type); - if (ctype != NULL_TREE) - { - tree dummy = build_decl (TYPE_DECL, NULL_TREE, type); - ctype = grok_method_quals (ctype, dummy, quals); - type = TREE_TYPE (dummy); - quals = NULL_TREE; - } - } - - /* See the comment for the TREE_LIST case, below. */ - if (ignore_attrs) - ignore_attrs = 0; - else if (inner_attrs) - { - decl_attributes (type, inner_attrs, NULL_TREE); - inner_attrs = NULL_TREE; - } - - switch (TREE_CODE (declarator)) - { - case TREE_LIST: - { - /* We encode a declarator with embedded attributes using - a TREE_LIST. The attributes apply to the declarator - directly inside them, so we have to skip an iteration - before applying them to the type. If the declarator just - inside is the declarator-id, we apply the attrs to the - decl itself. */ - inner_attrs = TREE_PURPOSE (declarator); - ignore_attrs = 1; - declarator = TREE_VALUE (declarator); - } - break; - - case ARRAY_REF: - { - register tree itype = NULL_TREE; - register tree size = TREE_OPERAND (declarator, 1); - /* The index is a signed object `sizetype' bits wide. */ - tree index_type = signed_type (sizetype); - - declarator = TREE_OPERAND (declarator, 0); - - /* Check for some types that there cannot be arrays of. */ - - if (TREE_CODE (type) == VOID_TYPE) - { - cp_error ("declaration of `%D' as array of voids", dname); - type = error_mark_node; - } - - if (TREE_CODE (type) == FUNCTION_TYPE) - { - cp_error ("declaration of `%D' as array of functions", dname); - type = error_mark_node; - } - - /* ARM $8.4.3: Since you can't have a pointer to a reference, - you can't have arrays of references. If we allowed them, - then we'd be saying x[i] is valid for an array x, but - then you'd have to ask: what does `*(x + i)' mean? */ - if (TREE_CODE (type) == REFERENCE_TYPE) - { - if (decl_context == TYPENAME) - cp_error ("cannot make arrays of references"); - else - cp_error ("declaration of `%D' as array of references", - dname); - type = error_mark_node; - } - - if (TREE_CODE (type) == OFFSET_TYPE) - { - cp_error ("declaration of `%D' as array of data members", - dname); - type = error_mark_node; - } - - if (TREE_CODE (type) == METHOD_TYPE) - { - cp_error ("declaration of `%D' as array of function members", - dname); - type = error_mark_node; - } - - if (size == error_mark_node) - type = error_mark_node; - else if (TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type)) - { - /* [dcl.array] - - the constant expressions that specify the bounds of - the arrays can be omitted only for the first member - of the sequence. */ - cp_error ("declaration of `%D' as multidimensional array", - dname); - cp_error ("must have bounds for all dimensions except the first"); - type = error_mark_node; - } - - if (type == error_mark_node) - continue; - - /* VC++ spells a zero-sized array with []. */ - if (size == NULL_TREE && decl_context == FIELD && ! staticp - && ! RIDBIT_SETP (RID_TYPEDEF, specbits)) - size = integer_zero_node; - - if (size) - { - /* Must suspend_momentary here because the index - type may need to live until the end of the function. - For example, it is used in the declaration of a - variable which requires destructing at the end of - the function; then build_vec_delete will need this - value. */ - int yes = suspend_momentary (); - /* Might be a cast. */ - if (TREE_CODE (size) == NOP_EXPR - && TREE_TYPE (size) == TREE_TYPE (TREE_OPERAND (size, 0))) - size = TREE_OPERAND (size, 0); - - /* If this involves a template parameter, it will be a - constant at instantiation time, but we don't know - what the value is yet. Even if no template - parameters are involved, we may an expression that - is not a constant; we don't even simplify `1 + 2' - when processing a template. */ - if (processing_template_decl) - { - /* Resolve a qualified reference to an enumerator or - static const data member of ours. */ - if (TREE_CODE (size) == SCOPE_REF - && TREE_OPERAND (size, 0) == current_class_type) - { - tree t = lookup_field (current_class_type, - TREE_OPERAND (size, 1), 0, 0); - if (t) - size = t; - } - - itype = build_index_type (build_min - (MINUS_EXPR, sizetype, size, integer_one_node)); - goto dont_grok_size; - } - - if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE - && TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE - && TREE_CODE (TREE_TYPE (size)) != BOOLEAN_TYPE) - { - cp_error ("size of array `%D' has non-integer type", - dname); - size = integer_one_node; - } - if (TREE_READONLY_DECL_P (size)) - size = decl_constant_value (size); - if (pedantic && integer_zerop (size)) - cp_pedwarn ("ANSI C++ forbids zero-size array `%D'", dname); - if (TREE_CONSTANT (size)) - { - int old_flag_pedantic_errors = flag_pedantic_errors; - int old_pedantic = pedantic; - pedantic = flag_pedantic_errors = 1; - /* Always give overflow errors on array subscripts. */ - constant_expression_warning (size); - pedantic = old_pedantic; - flag_pedantic_errors = old_flag_pedantic_errors; - if (INT_CST_LT (size, integer_zero_node)) - { - cp_error ("size of array `%D' is negative", dname); - size = integer_one_node; - } - } - else - { - if (pedantic) - { - if (dname) - cp_pedwarn ("ANSI C++ forbids variable-size array `%D'", - dname); - else - cp_pedwarn ("ANSI C++ forbids variable-size array"); - } - } - - itype - = fold (build_binary_op (MINUS_EXPR, - cp_convert (index_type, size), - cp_convert (index_type, - integer_one_node))); - if (! TREE_CONSTANT (itype)) - itype = variable_size (itype); - else if (TREE_OVERFLOW (itype)) - { - error ("overflow in array dimension"); - TREE_OVERFLOW (itype) = 0; - } - - /* If we're a parm, we need to have a permanent type so - mangling checks for re-use will work right. If both the - element and index types are permanent, the array type - will be, too. */ - if (decl_context == PARM - && allocation_temporary_p () && TREE_PERMANENT (type)) - { - push_obstacks (&permanent_obstack, &permanent_obstack); - itype = build_index_type (itype); - pop_obstacks (); - } - else - itype = build_index_type (itype); - - dont_grok_size: - resume_momentary (yes); - } - - type = build_cplus_array_type (type, itype); - ctype = NULL_TREE; - } - break; - - case CALL_EXPR: - { - tree arg_types; - int funcdecl_p; - tree inner_parms = TREE_OPERAND (declarator, 1); - tree inner_decl = TREE_OPERAND (declarator, 0); - - /* Declaring a function type. - Make sure we have a valid type for the function to return. */ - - /* We now know that the TYPE_QUALS don't apply to the - decl, but to its return type. */ - type_quals = TYPE_UNQUALIFIED; - - /* Warn about some types functions can't return. */ - - if (TREE_CODE (type) == FUNCTION_TYPE) - { - error ("`%s' declared as function returning a function", name); - type = integer_type_node; - } - if (TREE_CODE (type) == ARRAY_TYPE) - { - error ("`%s' declared as function returning an array", name); - type = integer_type_node; - } - - if (inner_decl && TREE_CODE (inner_decl) == SCOPE_REF) - inner_decl = TREE_OPERAND (inner_decl, 1); - - if (inner_decl && TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR) - inner_decl = dname; - - /* Pick up type qualifiers which should be applied to `this'. */ - quals = TREE_OPERAND (declarator, 2); - - /* Pick up the exception specifications. */ - raises = TREE_TYPE (declarator); - - /* Say it's a definition only for the CALL_EXPR - closest to the identifier. */ - funcdecl_p - = inner_decl - && (TREE_CODE (inner_decl) == IDENTIFIER_NODE - || TREE_CODE (inner_decl) == TEMPLATE_ID_EXPR - || TREE_CODE (inner_decl) == BIT_NOT_EXPR); - - if (ctype == NULL_TREE - && decl_context == FIELD - && funcdecl_p - && (friendp == 0 || dname == current_class_name)) - ctype = current_class_type; - - if (ctype && return_type == return_conversion) - TYPE_HAS_CONVERSION (ctype) = 1; - if (ctype && constructor_name (ctype) == dname) - { - /* We are within a class's scope. If our declarator name - is the same as the class name, and we are defining - a function, then it is a constructor/destructor, and - therefore returns a void type. */ - - if (flags == DTOR_FLAG) - { - /* ANSI C++ June 5 1992 WP 12.4.1. A destructor may - not be declared const or volatile. A destructor - may not be static. */ - if (staticp == 2) - error ("destructor cannot be static member function"); - if (quals) - { - cp_error ("destructors may not be `%s'", - IDENTIFIER_POINTER (TREE_VALUE (quals))); - quals = NULL_TREE; - } - if (decl_context == FIELD) - { - if (! member_function_or_else (ctype, current_class_type, - "destructor for alien class `%s' cannot be a member")) - return void_type_node; - } - } - else /* It's a constructor. */ - { - if (explicitp == 1) - explicitp = 2; - /* ANSI C++ June 5 1992 WP 12.1.2. A constructor may - not be declared const or volatile. A constructor may - not be virtual. A constructor may not be static. */ - if (staticp == 2) - error ("constructor cannot be static member function"); - if (virtualp) - { - pedwarn ("constructors cannot be declared virtual"); - virtualp = 0; - } - if (quals) - { - cp_error ("constructors may not be `%s'", - IDENTIFIER_POINTER (TREE_VALUE (quals))); - quals = NULL_TREE; - } - { - RID_BIT_TYPE tmp_bits; - bcopy ((void*)&specbits, (void*)&tmp_bits, sizeof (RID_BIT_TYPE)); - RIDBIT_RESET (RID_INLINE, tmp_bits); - RIDBIT_RESET (RID_STATIC, tmp_bits); - if (RIDBIT_ANY_SET (tmp_bits)) - error ("return value type specifier for constructor ignored"); - } - type = build_pointer_type (ctype); - if (decl_context == FIELD - && IS_SIGNATURE (current_class_type)) - { - error ("constructor not allowed in signature"); - return void_type_node; - } - else if (decl_context == FIELD) - { - if (! member_function_or_else (ctype, current_class_type, - "constructor for alien class `%s' cannot be member")) - return void_type_node; - TYPE_HAS_CONSTRUCTOR (ctype) = 1; - if (return_type != return_ctor) - return NULL_TREE; - } - } - if (decl_context == FIELD) - staticp = 0; - } - else if (friendp) - { - if (initialized) - error ("can't initialize friend function `%s'", name); - if (virtualp) - { - /* Cannot be both friend and virtual. */ - error ("virtual functions cannot be friends"); - RIDBIT_RESET (RID_FRIEND, specbits); - friendp = 0; - } - if (decl_context == NORMAL) - error ("friend declaration not in class definition"); - if (current_function_decl && funcdef_flag) - cp_error ("can't define friend function `%s' in a local class definition", - name); - } - - /* Construct the function type and go to the next - inner layer of declarator. */ - - declarator = TREE_OPERAND (declarator, 0); - - /* FIXME: This is where default args should be fully - processed. */ - - arg_types = grokparms (inner_parms, funcdecl_p ? funcdef_flag : 0); - - if (declarator && flags == DTOR_FLAG) - { - /* A destructor declared in the body of a class will - be represented as a BIT_NOT_EXPR. But, we just - want the underlying IDENTIFIER. */ - if (TREE_CODE (declarator) == BIT_NOT_EXPR) - declarator = TREE_OPERAND (declarator, 0); - - if (strict_prototype == 0 && arg_types == NULL_TREE) - arg_types = void_list_node; - else if (arg_types == NULL_TREE - || arg_types != void_list_node) - { - cp_error ("destructors may not have parameters"); - arg_types = void_list_node; - last_function_parms = NULL_TREE; - } - } - - /* ANSI says that `const int foo ();' - does not make the function foo const. */ - type = build_function_type (type, arg_types); - - { - tree t; - for (t = arg_types; t; t = TREE_CHAIN (t)) - if (TREE_PURPOSE (t) - && TREE_CODE (TREE_PURPOSE (t)) == DEFAULT_ARG) - { - add_defarg_fn (type); - break; - } - } - } - break; - - case ADDR_EXPR: - case INDIRECT_REF: - /* Filter out pointers-to-references and references-to-references. - We can get these if a TYPE_DECL is used. */ - - if (TREE_CODE (type) == REFERENCE_TYPE) - { - error ("cannot declare %s to references", - TREE_CODE (declarator) == ADDR_EXPR - ? "references" : "pointers"); - declarator = TREE_OPERAND (declarator, 0); - continue; - } - - if (TREE_CODE (type) == OFFSET_TYPE - && (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE - || TREE_CODE (TREE_TYPE (type)) == REFERENCE_TYPE)) - { - cp_error ("cannot declare pointer to `%#T' member", - TREE_TYPE (type)); - type = TREE_TYPE (type); - } - - /* Merge any constancy or volatility into the target type - for the pointer. */ - - /* We now know that the TYPE_QUALS don't apply to the decl, - but to the target of the pointer. */ - type_quals = TYPE_UNQUALIFIED; - - if (IS_SIGNATURE (type)) - { - if (TREE_CODE (declarator) == ADDR_EXPR) - { - if (CLASSTYPE_METHOD_VEC (type) == NULL_TREE - && TYPE_SIZE (type)) - cp_warning ("empty signature `%T' used in signature reference declaration", - type); -#if 0 - type = build_signature_reference_type (type); -#else - sorry ("signature reference"); - return NULL_TREE; -#endif - } - else - { - if (CLASSTYPE_METHOD_VEC (type) == NULL_TREE - && TYPE_SIZE (type)) - cp_warning ("empty signature `%T' used in signature pointer declaration", - type); - type = build_signature_pointer_type (type); - } - } - else if (TREE_CODE (declarator) == ADDR_EXPR) - { - if (TREE_CODE (type) == VOID_TYPE) - error ("invalid type: `void &'"); - else - type = build_reference_type (type); - } - else if (TREE_CODE (type) == METHOD_TYPE) - type = build_ptrmemfunc_type (build_pointer_type (type)); - else - type = build_pointer_type (type); - - /* Process a list of type modifier keywords (such as - const or volatile) that were given inside the `*' or `&'. */ - - if (TREE_TYPE (declarator)) - { - register tree typemodlist; - int erred = 0; - - constp = 0; - volatilep = 0; - restrictp = 0; - for (typemodlist = TREE_TYPE (declarator); typemodlist; - typemodlist = TREE_CHAIN (typemodlist)) - { - tree qualifier = TREE_VALUE (typemodlist); - - if (qualifier == ridpointers[(int) RID_CONST]) - constp++; - else if (qualifier == ridpointers[(int) RID_VOLATILE]) - volatilep++; - else if (qualifier == ridpointers[(int) RID_RESTRICT]) - restrictp++; - else if (!erred) - { - erred = 1; - error ("invalid type modifier within pointer declarator"); - } - } - if (constp > 1) - pedwarn ("duplicate `const'"); - if (volatilep > 1) - pedwarn ("duplicate `volatile'"); - if (restrictp > 1) - pedwarn ("duplicate `restrict'"); - - type_quals = ((constp ? TYPE_QUAL_CONST : 0) - | (restrictp ? TYPE_QUAL_RESTRICT : 0) - | (volatilep ? TYPE_QUAL_VOLATILE : 0)); - if (TREE_CODE (declarator) == ADDR_EXPR - && (constp || volatilep)) - { - if (constp) - pedwarn ("discarding `const' applied to a reference"); - if (volatilep) - pedwarn ("discarding `volatile' applied to a reference"); - type_quals &= ~(TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE); - } - type = cp_build_qualified_type (type, type_quals); - } - declarator = TREE_OPERAND (declarator, 0); - ctype = NULL_TREE; - break; - - case SCOPE_REF: - { - /* We have converted type names to NULL_TREE if the - name was bogus, or to a _TYPE node, if not. - - The variable CTYPE holds the type we will ultimately - resolve to. The code here just needs to build - up appropriate member types. */ - tree sname = TREE_OPERAND (declarator, 1); - tree t; - - /* Destructors can have their visibilities changed as well. */ - if (TREE_CODE (sname) == BIT_NOT_EXPR) - sname = TREE_OPERAND (sname, 0); - - if (TREE_COMPLEXITY (declarator) == 0) - /* This needs to be here, in case we are called - multiple times. */ ; - else if (TREE_COMPLEXITY (declarator) == -1) - /* Namespace member. */ - pop_decl_namespace (); - else if (friendp && (TREE_COMPLEXITY (declarator) < 2)) - /* Don't fall out into global scope. Hides real bug? --eichin */ ; - else if (! IS_AGGR_TYPE_CODE - (TREE_CODE (TREE_OPERAND (declarator, 0)))) - ; - else if (TREE_COMPLEXITY (declarator) == current_class_depth) - { - /* Resolve any TYPENAME_TYPEs from the decl-specifier-seq - that refer to ctype. They couldn't be resolved earlier - because we hadn't pushed into the class yet. - Example: resolve 'B::type' in - 'B::type> B::f () { }'. */ - if (current_template_parms - && uses_template_parms (type) - && uses_template_parms (current_class_type)) - { - tree args = current_template_args (); - type = tsubst (type, args, /*complain=*/1, NULL_TREE); - } - - /* This pop_nested_class corresponds to the - push_nested_class used to push into class scope for - parsing the argument list of a function decl, in - qualified_id. */ - pop_nested_class (); - TREE_COMPLEXITY (declarator) = current_class_depth; - } - else - my_friendly_abort (16); - - if (TREE_OPERAND (declarator, 0) == NULL_TREE) - { - /* We had a reference to a global decl, or - perhaps we were given a non-aggregate typedef, - in which case we cleared this out, and should just - keep going as though it wasn't there. */ - declarator = sname; - continue; - } - ctype = TREE_OPERAND (declarator, 0); - - t = ctype; - while (t != NULL_TREE && CLASS_TYPE_P (t)) - { - if (CLASSTYPE_TEMPLATE_INFO (t) && - !CLASSTYPE_TEMPLATE_SPECIALIZATION (t)) - template_count += 1; - t = TYPE_MAIN_DECL (t); - if (DECL_LANG_SPECIFIC (t)) - t = DECL_CLASS_CONTEXT (t); - else - t = NULL_TREE; - } - - if (sname == NULL_TREE) - goto done_scoping; - - if (TREE_CODE (sname) == IDENTIFIER_NODE) - { - /* This is the `standard' use of the scoping operator: - basetype :: member . */ - - if (ctype == current_class_type) - { - /* class A { - void A::f (); - }; - - Is this ill-formed? */ - - if (pedantic) - cp_pedwarn ("extra qualification `%T::' on member `%s' ignored", - ctype, name); - } - else if (TREE_CODE (type) == FUNCTION_TYPE) - { - if (current_class_type == NULL_TREE - || friendp) - type = build_cplus_method_type (ctype, TREE_TYPE (type), - TYPE_ARG_TYPES (type)); - else - { - cp_error ("cannot declare member function `%T::%s' within `%T'", - ctype, name, current_class_type); - return void_type_node; - } - } - else if (RIDBIT_SETP (RID_TYPEDEF, specbits) - || TYPE_SIZE (complete_type (ctype)) != NULL_TREE) - { - /* Have to move this code elsewhere in this function. - this code is used for i.e., typedef int A::M; M *pm; - - It is? How? jason 10/2/94 */ - - if (current_class_type) - { - cp_error ("cannot declare member `%T::%s' within `%T'", - ctype, name, current_class_type); - return void_type_node; - } - type = build_offset_type (ctype, type); - } - else if (uses_template_parms (ctype)) - { - if (TREE_CODE (type) == FUNCTION_TYPE) - type - = build_cplus_method_type (ctype, TREE_TYPE (type), - TYPE_ARG_TYPES (type)); - } - else - { - cp_error ("structure `%T' not yet defined", ctype); - return error_mark_node; - } - - declarator = sname; - } - else if (TREE_CODE (sname) == SCOPE_REF) - my_friendly_abort (17); - else - { - done_scoping: - declarator = TREE_OPERAND (declarator, 1); - if (declarator && TREE_CODE (declarator) == CALL_EXPR) - /* In this case, we will deal with it later. */ - ; - else - { - if (TREE_CODE (type) == FUNCTION_TYPE) - type = build_cplus_method_type (ctype, TREE_TYPE (type), - TYPE_ARG_TYPES (type)); - else - type = build_offset_type (ctype, type); - } - } - } - break; - - case BIT_NOT_EXPR: - declarator = TREE_OPERAND (declarator, 0); - break; - - case RECORD_TYPE: - case UNION_TYPE: - case ENUMERAL_TYPE: - declarator = NULL_TREE; - break; - - case ERROR_MARK: - declarator = NULL_TREE; - break; - - default: - my_friendly_abort (158); - } - } - - /* See the comment for the TREE_LIST case, above. */ - if (inner_attrs) - { - if (! ignore_attrs) - decl_attributes (type, inner_attrs, NULL_TREE); - else if (attrlist) - TREE_VALUE (attrlist) = chainon (inner_attrs, TREE_VALUE (attrlist)); - else - attrlist = build_decl_list (NULL_TREE, inner_attrs); - } - - /* Now TYPE has the actual type. */ - - if (explicitp == 1) - { - error ("only constructors can be declared `explicit'"); - explicitp = 0; - } - - if (RIDBIT_SETP (RID_MUTABLE, specbits)) - { - if (type_quals & TYPE_QUAL_CONST) - { - error ("const `%s' cannot be declared `mutable'", name); - RIDBIT_RESET (RID_MUTABLE, specbits); - } - else if (staticp) - { - error ("static `%s' cannot be declared `mutable'", name); - RIDBIT_RESET (RID_MUTABLE, specbits); - } - } - - if (declarator == NULL_TREE - || TREE_CODE (declarator) == IDENTIFIER_NODE - || (TREE_CODE (declarator) == TEMPLATE_ID_EXPR - && (TREE_CODE (type) == FUNCTION_TYPE - || TREE_CODE (type) == METHOD_TYPE))) - /* OK */; - else if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR) - { - cp_error ("template-id `%D' used as a declarator", declarator); - declarator = dname; - } - else - /* Unexpected declarator format. */ - my_friendly_abort (990210); - - /* If this is declaring a typedef name, return a TYPE_DECL. */ - - if (RIDBIT_SETP (RID_TYPEDEF, specbits) && decl_context != TYPENAME) - { - tree decl; - - /* Note that the grammar rejects storage classes - in typenames, fields or parameters. */ - if (current_lang_name == lang_name_java) - TYPE_FOR_JAVA (type) = 1; - - if (decl_context == FIELD) - { - if (declarator == constructor_name (current_class_type)) - cp_pedwarn ("ANSI C++ forbids nested type `%D' with same name as enclosing class", - declarator); - decl = build_lang_decl (TYPE_DECL, declarator, type); - if (IS_SIGNATURE (current_class_type) && opaque_typedef) - SIGNATURE_HAS_OPAQUE_TYPEDECLS (current_class_type) = 1; - } - else - { - /* Make sure this typedef lives as long as its type, - since it might be used as a template parameter. */ - if (type != error_mark_node) - push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type)); - decl = build_decl (TYPE_DECL, declarator, type); - if (type != error_mark_node) - pop_obstacks (); - } - - /* If the user declares "struct {...} foo" then `foo' will have - an anonymous name. Fill that name in now. Nothing can - refer to it, so nothing needs know about the name change. - The TYPE_NAME field was filled in by build_struct_xref. */ - if (type != error_mark_node - && TYPE_NAME (type) - && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL - && ANON_AGGRNAME_P (TYPE_IDENTIFIER (type))) - { - tree oldname = TYPE_NAME (type); - tree t; - - /* FIXME: This is bogus; we should not be doing this for - cv-qualified types. */ - - /* Replace the anonymous name with the real name everywhere. */ - lookup_tag_reverse (type, declarator); - for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t)) - if (TYPE_NAME (t) == oldname) - TYPE_NAME (t) = decl; - - if (TYPE_LANG_SPECIFIC (type)) - TYPE_WAS_ANONYMOUS (type) = 1; - - /* If this is a typedef within a template class, the nested - type is a (non-primary) template. The name for the - template needs updating as well. */ - if (TYPE_LANG_SPECIFIC (type) && CLASSTYPE_TEMPLATE_INFO (type)) - DECL_NAME (CLASSTYPE_TI_TEMPLATE (type)) - = TYPE_IDENTIFIER (type); - - /* XXX Temporarily set the scope. - When returning, start_decl expects it as NULL_TREE, - and will then then set it using pushdecl. */ - my_friendly_assert (DECL_CONTEXT (decl) == NULL_TREE, 980404); - if (current_class_type) - DECL_CONTEXT (decl) = current_class_type; - else - DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); - - DECL_ASSEMBLER_NAME (decl) = DECL_NAME (decl); - DECL_ASSEMBLER_NAME (decl) - = get_identifier (build_overload_name (type, 1, 1)); - DECL_CONTEXT (decl) = NULL_TREE; - - /* FIXME remangle member functions; member functions of a - type with external linkage have external linkage. */ - } - - if (TREE_CODE (type) == OFFSET_TYPE || TREE_CODE (type) == METHOD_TYPE) - { - cp_error_at ("typedef name may not be class-qualified", decl); - return NULL_TREE; - } - else if (quals) - { - if (ctype == NULL_TREE) - { - if (TREE_CODE (type) != METHOD_TYPE) - cp_error_at ("invalid type qualifier for non-method type", decl); - else - ctype = TYPE_METHOD_BASETYPE (type); - } - if (ctype != NULL_TREE) - grok_method_quals (ctype, decl, quals); - } - - if (RIDBIT_SETP (RID_SIGNED, specbits) - || (typedef_decl && C_TYPEDEF_EXPLICITLY_SIGNED (typedef_decl))) - C_TYPEDEF_EXPLICITLY_SIGNED (decl) = 1; - - if (RIDBIT_SETP (RID_MUTABLE, specbits)) - error ("non-object member `%s' cannot be declared mutable", name); - - bad_specifiers (decl, "type", virtualp, quals != NULL_TREE, - inlinep, friendp, raises != NULL_TREE); - - if (initialized) - error ("typedef declaration includes an initializer"); - - return decl; - } - - /* Detect the case of an array type of unspecified size - which came, as such, direct from a typedef name. - We must copy the type, so that each identifier gets - a distinct type, so that each identifier's size can be - controlled separately by its own initializer. */ - - if (type == typedef_type && TREE_CODE (type) == ARRAY_TYPE - && TYPE_DOMAIN (type) == NULL_TREE) - { - type = build_cplus_array_type (TREE_TYPE (type), TYPE_DOMAIN (type)); - } - - /* If this is a type name (such as, in a cast or sizeof), - compute the type and return it now. */ - - if (decl_context == TYPENAME) - { - /* Note that the grammar rejects storage classes - in typenames, fields or parameters. */ - if (type_quals != TYPE_UNQUALIFIED) - { - if (IS_SIGNATURE (type)) - error ("type qualifiers specified for signature type"); - type_quals = TYPE_UNQUALIFIED; - } - - /* Special case: "friend class foo" looks like a TYPENAME context. */ - if (friendp) - { - if (type_quals != TYPE_UNQUALIFIED) - { - cp_error ("type qualifiers specified for friend class declaration"); - type_quals = TYPE_UNQUALIFIED; - } - if (inlinep) - { - cp_error ("`inline' specified for friend class declaration"); - inlinep = 0; - } - - /* Only try to do this stuff if we didn't already give up. */ - if (type != integer_type_node) - { - /* A friendly class? */ - if (current_class_type) - make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type)); - else - error ("trying to make class `%s' a friend of global scope", - TYPE_NAME_STRING (type)); - type = void_type_node; - } - } - else if (quals) - { - tree dummy = build_decl (TYPE_DECL, declarator, type); - if (ctype == NULL_TREE) - { - my_friendly_assert (TREE_CODE (type) == METHOD_TYPE, 159); - ctype = TYPE_METHOD_BASETYPE (type); - } - grok_method_quals (ctype, dummy, quals); - type = TREE_TYPE (dummy); - } - - return type; - } - else if (declarator == NULL_TREE && decl_context != PARM - && decl_context != CATCHPARM - && TREE_CODE (type) != UNION_TYPE - && ! bitfield) - { - cp_error ("abstract declarator `%T' used as declaration", type); - declarator = make_anon_name (); - } - - /* `void' at top level (not within pointer) - is allowed only in typedefs or type names. - We don't complain about parms either, but that is because - a better error message can be made later. */ - - if (TREE_CODE (type) == VOID_TYPE && decl_context != PARM) - { - if (! declarator) - error ("unnamed variable or field declared void"); - else if (TREE_CODE (declarator) == IDENTIFIER_NODE) - { - if (IDENTIFIER_OPNAME_P (declarator)) - my_friendly_abort (356); - else - error ("variable or field `%s' declared void", name); - } - else - error ("variable or field declared void"); - type = integer_type_node; - } - - /* Now create the decl, which may be a VAR_DECL, a PARM_DECL - or a FUNCTION_DECL, depending on DECL_CONTEXT and TYPE. */ - - if (decl_context == PARM || decl_context == CATCHPARM) - { - if (ctype || in_namespace) - error ("cannot use `::' in parameter declaration"); - - /* A parameter declared as an array of T is really a pointer to T. - One declared as a function is really a pointer to a function. - One declared as a member is really a pointer to member. */ - - if (TREE_CODE (type) == ARRAY_TYPE) - { - /* Transfer const-ness of array into that of type pointed to. */ - type = build_pointer_type (TREE_TYPE (type)); - type_quals = TYPE_UNQUALIFIED; - } - else if (TREE_CODE (type) == FUNCTION_TYPE) - type = build_pointer_type (type); - else if (TREE_CODE (type) == OFFSET_TYPE) - type = build_pointer_type (type); - else if (TREE_CODE (type) == VOID_TYPE && declarator) - { - error ("declaration of `%s' as void", name); - return NULL_TREE; - } - } - - { - register tree decl; - - if (decl_context == PARM) - { - decl = build_decl (PARM_DECL, declarator, type); - - bad_specifiers (decl, "parameter", virtualp, quals != NULL_TREE, - inlinep, friendp, raises != NULL_TREE); - if (current_class_type - && IS_SIGNATURE (current_class_type)) - { - if (inlinep) - error ("parameter of signature member function declared `inline'"); - if (RIDBIT_SETP (RID_AUTO, specbits)) - error ("parameter of signature member function declared `auto'"); - if (RIDBIT_SETP (RID_REGISTER, specbits)) - error ("parameter of signature member function declared `register'"); - } - - /* Compute the type actually passed in the parmlist, - for the case where there is no prototype. - (For example, shorts and chars are passed as ints.) - When there is a prototype, this is overridden later. */ - - DECL_ARG_TYPE (decl) = type_promotes_to (type); - } - else if (decl_context == FIELD) - { - if (type == error_mark_node) - { - /* Happens when declaring arrays of sizes which - are error_mark_node, for example. */ - decl = NULL_TREE; - } - else if (in_namespace && !friendp) - { - /* Something like struct S { int N::j; }; */ - cp_error ("invalid use of `::'"); - decl = NULL_TREE; - } - else if (TREE_CODE (type) == FUNCTION_TYPE) - { - int publicp = 0; - tree function_context; - - /* We catch the others as conflicts with the builtin - typedefs. */ - if (friendp && declarator == ridpointers[(int) RID_SIGNED]) - { - cp_error ("function `%D' cannot be declared friend", - declarator); - friendp = 0; - } - - if (friendp == 0) - { - if (ctype == NULL_TREE) - ctype = current_class_type; - - if (ctype == NULL_TREE) - { - cp_error ("can't make `%D' into a method -- not in a class", - declarator); - return void_type_node; - } - - /* ``A union may [ ... ] not [ have ] virtual functions.'' - ARM 9.5 */ - if (virtualp && TREE_CODE (ctype) == UNION_TYPE) - { - cp_error ("function `%D' declared virtual inside a union", - declarator); - return void_type_node; - } - - if (declarator == ansi_opname[(int) NEW_EXPR] - || declarator == ansi_opname[(int) VEC_NEW_EXPR] - || declarator == ansi_opname[(int) DELETE_EXPR] - || declarator == ansi_opname[(int) VEC_DELETE_EXPR]) - { - if (virtualp) - { - cp_error ("`%D' cannot be declared virtual, since it is always static", - declarator); - virtualp = 0; - } - } - else if (staticp < 2) - type = build_cplus_method_type (ctype, TREE_TYPE (type), - TYPE_ARG_TYPES (type)); - } - - /* Tell grokfndecl if it needs to set TREE_PUBLIC on the node. */ - function_context = (ctype != NULL_TREE) ? - hack_decl_function_context (TYPE_MAIN_DECL (ctype)) : NULL_TREE; - publicp = (! friendp || ! staticp) - && function_context == NULL_TREE; - decl = grokfndecl (ctype, type, - TREE_CODE (declarator) != TEMPLATE_ID_EXPR - ? declarator : dname, - declarator, - virtualp, flags, quals, raises, - friendp ? -1 : 0, friendp, publicp, inlinep, - funcdef_flag, template_count, in_namespace); - if (decl == NULL_TREE) - return decl; -#if 0 - /* This clobbers the attrs stored in `decl' from `attrlist'. */ - /* The decl and setting of decl_machine_attr is also turned off. */ - decl = build_decl_attribute_variant (decl, decl_machine_attr); -#endif - - /* [class.conv.ctor] - - A constructor declared without the function-specifier - explicit that can be called with a single parameter - specifies a conversion from the type of its first - parameter to the type of its class. Such a constructor - is called a converting constructor. */ - if (explicitp == 2) - DECL_NONCONVERTING_P (decl) = 1; - else if (DECL_CONSTRUCTOR_P (decl)) - { - /* The constructor can be called with exactly one - parameter if there is at least one parameter, and - any subsequent parameters have default arguments. - We don't look at the first parameter, which is - really just the `this' parameter for the new - object. */ - tree arg_types = - TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl))); - - /* Skip the `in_chrg' argument too, if present. */ - if (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (decl))) - arg_types = TREE_CHAIN (arg_types); - - /* And the `vlist' argument. */ - if (TYPE_USES_PVBASES (DECL_CONTEXT (decl))) - arg_types = TREE_CHAIN (arg_types); - - if (arg_types == void_list_node - || (arg_types - && TREE_CHAIN (arg_types) - && TREE_CHAIN (arg_types) != void_list_node - && !TREE_PURPOSE (TREE_CHAIN (arg_types)))) - DECL_NONCONVERTING_P (decl) = 1; - } - } - else if (TREE_CODE (type) == METHOD_TYPE) - { - /* We only get here for friend declarations of - members of other classes. */ - /* All method decls are public, so tell grokfndecl to set - TREE_PUBLIC, also. */ - decl = grokfndecl (ctype, type, declarator, declarator, - virtualp, flags, quals, raises, - friendp ? -1 : 0, friendp, 1, 0, funcdef_flag, - template_count, in_namespace); - if (decl == NULL_TREE) - return NULL_TREE; - } - else if (!staticp && ! processing_template_decl - && TYPE_SIZE (complete_type (type)) == NULL_TREE - && (TREE_CODE (type) != ARRAY_TYPE || initialized == 0)) - { - if (declarator) - cp_error ("field `%D' has incomplete type", declarator); - else - cp_error ("name `%T' has incomplete type", type); - - /* If we're instantiating a template, tell them which - instantiation made the field's type be incomplete. */ - if (current_class_type - && TYPE_NAME (current_class_type) - && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (current_class_type)) - && declspecs && TREE_VALUE (declspecs) - && TREE_TYPE (TREE_VALUE (declspecs)) == type) - cp_error (" in instantiation of template `%T'", - current_class_type); - - type = error_mark_node; - decl = NULL_TREE; - } - else - { - if (friendp) - { - error ("`%s' is neither function nor method; cannot be declared friend", - IDENTIFIER_POINTER (declarator)); - friendp = 0; - } - decl = NULL_TREE; - } - - if (friendp) - { - /* Friends are treated specially. */ - if (ctype == current_class_type) - warning ("member functions are implicitly friends of their class"); - else - { - tree t = NULL_TREE; - if (decl && DECL_NAME (decl)) - { - if (template_class_depth (current_class_type) == 0) - { - decl - = check_explicit_specialization - (declarator, decl, - template_count, 2 * (funcdef_flag != 0) + 4); - if (decl == error_mark_node) - return error_mark_node; - } - - t = do_friend (ctype, declarator, decl, - last_function_parms, attrlist, flags, quals, - funcdef_flag); - } - if (t && funcdef_flag) - return t; - - return void_type_node; - } - } - - /* Structure field. It may not be a function, except for C++ */ - - if (decl == NULL_TREE) - { - if (initialized) - { - if (!staticp) - { - /* An attempt is being made to initialize a non-static - member. But, from [class.mem]: - - 4 A member-declarator can contain a - constant-initializer only if it declares a static - member (_class.static_) of integral or enumeration - type, see _class.static.data_. - - This used to be relatively common practice, but - the rest of the compiler does not correctly - handle the initialization unless the member is - static so we make it static below. */ - cp_pedwarn ("ANSI C++ forbids initialization of member `%D'", - declarator); - cp_pedwarn ("making `%D' static", declarator); - staticp = 1; - } - - if (uses_template_parms (type)) - /* We'll check at instantiation time. */ - ; - else if (check_static_variable_definition (declarator, - type)) - /* If we just return the declaration, crashes - will sometimes occur. We therefore return - void_type_node, as if this was a friend - declaration, to cause callers to completely - ignore this declaration. */ - return void_type_node; - } - - /* 9.2p13 [class.mem] */ - if (declarator == constructor_name (current_class_type) - /* Divergence from the standard: In extern "C", we - allow non-static data members here, because C does - and /usr/include/netinet/in.h uses that. */ - && (staticp || ! in_system_header)) - cp_pedwarn ("ANSI C++ forbids data member `%D' with same name as enclosing class", - declarator); - - if (staticp) - { - /* C++ allows static class members. - All other work for this is done by grokfield. - This VAR_DCL is built by build_lang_field_decl. - All other VAR_DECLs are built by build_decl. */ - decl = build_lang_field_decl (VAR_DECL, declarator, type); - TREE_STATIC (decl) = 1; - /* In class context, 'static' means public access. */ - TREE_PUBLIC (decl) = DECL_EXTERNAL (decl) = 1; - } - else - { - decl = build_lang_field_decl (FIELD_DECL, declarator, type); - if (RIDBIT_SETP (RID_MUTABLE, specbits)) - { - DECL_MUTABLE_P (decl) = 1; - RIDBIT_RESET (RID_MUTABLE, specbits); - } - } - - bad_specifiers (decl, "field", virtualp, quals != NULL_TREE, - inlinep, friendp, raises != NULL_TREE); - } - } - else if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE) - { - tree original_name; - int publicp = 0; - - if (! declarator) - return NULL_TREE; - - if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR) - original_name = dname; - else - original_name = declarator; - - if (RIDBIT_SETP (RID_AUTO, specbits)) - error ("storage class `auto' invalid for function `%s'", name); - else if (RIDBIT_SETP (RID_REGISTER, specbits)) - error ("storage class `register' invalid for function `%s'", name); - - /* Function declaration not at top level. - Storage classes other than `extern' are not allowed - and `extern' makes no difference. */ - if (! toplevel_bindings_p () - && (RIDBIT_SETP (RID_STATIC, specbits) - || RIDBIT_SETP (RID_INLINE, specbits)) - && pedantic) - { - if (RIDBIT_SETP (RID_STATIC, specbits)) - pedwarn ("storage class `static' invalid for function `%s' declared out of global scope", name); - else - pedwarn ("storage class `inline' invalid for function `%s' declared out of global scope", name); - } - - if (ctype == NULL_TREE) - { - if (virtualp) - { - error ("virtual non-class function `%s'", name); - virtualp = 0; - } - } - else if (TREE_CODE (type) == FUNCTION_TYPE && staticp < 2) - type = build_cplus_method_type (ctype, TREE_TYPE (type), - TYPE_ARG_TYPES (type)); - - /* Record presence of `static'. */ - publicp = (ctype != NULL_TREE - || RIDBIT_SETP (RID_EXTERN, specbits) - || !RIDBIT_SETP (RID_STATIC, specbits)); - - decl = grokfndecl (ctype, type, original_name, declarator, - virtualp, flags, quals, raises, - 1, friendp, - publicp, inlinep, funcdef_flag, - template_count, in_namespace); - if (decl == NULL_TREE) - return NULL_TREE; - - if (staticp == 1) - { - int illegal_static = 0; - - /* Don't allow a static member function in a class, and forbid - declaring main to be static. */ - if (TREE_CODE (type) == METHOD_TYPE) - { - cp_pedwarn ("cannot declare member function `%D' to have static linkage", decl); - illegal_static = 1; - } - else if (current_function_decl) - { - /* FIXME need arm citation */ - error ("cannot declare static function inside another function"); - illegal_static = 1; - } - - if (illegal_static) - { - staticp = 0; - RIDBIT_RESET (RID_STATIC, specbits); - } - } - } - else - { - /* It's a variable. */ - - /* An uninitialized decl with `extern' is a reference. */ - decl = grokvardecl (type, declarator, &specbits, - initialized, - (type_quals & TYPE_QUAL_CONST) != 0, - in_namespace); - bad_specifiers (decl, "variable", virtualp, quals != NULL_TREE, - inlinep, friendp, raises != NULL_TREE); - - if (ctype) - { - DECL_CONTEXT (decl) = ctype; - if (staticp == 1) - { - cp_pedwarn ("static member `%D' re-declared as static", decl); - staticp = 0; - RIDBIT_RESET (RID_STATIC, specbits); - } - if (RIDBIT_SETP (RID_REGISTER, specbits) && TREE_STATIC (decl)) - { - cp_error ("static member `%D' declared `register'", decl); - RIDBIT_RESET (RID_REGISTER, specbits); - } - if (RIDBIT_SETP (RID_EXTERN, specbits) && pedantic) - { - cp_pedwarn ("cannot explicitly declare member `%#D' to have extern linkage", - decl); - RIDBIT_RESET (RID_EXTERN, specbits); - } - } - } - - if (RIDBIT_SETP (RID_MUTABLE, specbits)) - { - error ("`%s' cannot be declared mutable", name); - } - - /* Record `register' declaration for warnings on & - and in case doing stupid register allocation. */ - - if (RIDBIT_SETP (RID_REGISTER, specbits)) - DECL_REGISTER (decl) = 1; - - if (RIDBIT_SETP (RID_EXTERN, specbits)) - DECL_THIS_EXTERN (decl) = 1; - - if (RIDBIT_SETP (RID_STATIC, specbits)) - DECL_THIS_STATIC (decl) = 1; - - /* Record constancy and volatility. */ - /* FIXME: Disallow `restrict' pointer-to-member declarations. */ - c_apply_type_quals_to_decl (type_quals, decl); - - return decl; - } -} - -/* Tell if a parmlist/exprlist looks like an exprlist or a parmlist. - An empty exprlist is a parmlist. An exprlist which - contains only identifiers at the global level - is a parmlist. Otherwise, it is an exprlist. */ - -int -parmlist_is_exprlist (exprs) - tree exprs; -{ - if (exprs == NULL_TREE || TREE_PARMLIST (exprs)) - return 0; - - if (toplevel_bindings_p ()) - { - /* At the global level, if these are all identifiers, - then it is a parmlist. */ - while (exprs) - { - if (TREE_CODE (TREE_VALUE (exprs)) != IDENTIFIER_NODE) - return 1; - exprs = TREE_CHAIN (exprs); - } - return 0; - } - return 1; -} - -/* Subroutine of start_function. Ensure that each of the parameter - types (as listed in PARMS) is complete, as is required for a - function definition. */ - -static void -require_complete_types_for_parms (parms) - tree parms; -{ - while (parms) - { - tree type = TREE_TYPE (parms); - if (TYPE_SIZE (complete_type (type)) == NULL_TREE) - { - if (DECL_NAME (parms)) - error ("parameter `%s' has incomplete type", - IDENTIFIER_POINTER (DECL_NAME (parms))); - else - error ("parameter has incomplete type"); - TREE_TYPE (parms) = error_mark_node; - } - else - layout_decl (parms, 0); - - parms = TREE_CHAIN (parms); - } -} - -/* Returns DECL if DECL is a local variable (or parameter). Returns - NULL_TREE otherwise. */ - -static tree -local_variable_p (t) - tree t; -{ - if ((TREE_CODE (t) == VAR_DECL - /* A VAR_DECL with a context that is a _TYPE is a static data - member. */ - && !TYPE_P (CP_DECL_CONTEXT (t)) - /* Any other non-local variable must be at namespace scope. */ - && TREE_CODE (CP_DECL_CONTEXT (t)) != NAMESPACE_DECL) - || (TREE_CODE (t) == PARM_DECL)) - return t; - - return NULL_TREE; -} - -/* Check that ARG, which is a default-argument expression for a - parameter DECL, is legal. Returns ARG, or ERROR_MARK_NODE, if - something goes wrong. DECL may also be a _TYPE node, rather than a - DECL, if there is no DECL available. */ - -tree -check_default_argument (decl, arg) - tree decl; - tree arg; -{ - tree var; - tree decl_type; - - if (TREE_CODE (arg) == DEFAULT_ARG) - /* We get a DEFAULT_ARG when looking at an in-class declaration - with a default argument. Ignore the argument for now; we'll - deal with it after the class is complete. */ - return arg; - - if (processing_template_decl || uses_template_parms (arg)) - /* We don't do anything checking until instantiation-time. Note - that there may be uninstantiated arguments even for an - instantiated function, since default arguments are not - instantiated until they are needed. */ - return arg; - - if (TYPE_P (decl)) - { - decl_type = decl; - decl = NULL_TREE; - } - else - decl_type = TREE_TYPE (decl); - - if (arg == error_mark_node - || decl == error_mark_node - || TREE_TYPE (arg) == error_mark_node - || decl_type == error_mark_node) - /* Something already went wrong. There's no need to check - further. */ - return error_mark_node; - - /* [dcl.fct.default] - - A default argument expression is implicitly converted to the - parameter type. */ - if (!TREE_TYPE (arg) - || !can_convert_arg (decl_type, TREE_TYPE (arg), arg)) - { - if (decl) - cp_error ("default argument for `%#D' has type `%T'", - decl, TREE_TYPE (arg)); - else - cp_error ("default argument for paramter of type `%T' has type `%T'", - decl_type, TREE_TYPE (arg)); - - return error_mark_node; - } - - /* [dcl.fct.default] - - Local variables shall not be used in default argument - expressions. - - The keyword `this' shall not be used in a default argument of a - member function. */ - var = search_tree (arg, local_variable_p); - if (var) - { - cp_error ("default argument `%E' uses local variable `%D'", - arg, var); - return error_mark_node; - } - - /* All is well. */ - return arg; -} - -/* Decode the list of parameter types for a function type. - Given the list of things declared inside the parens, - return a list of types. - - The list we receive can have three kinds of elements: - an IDENTIFIER_NODE for names given without types, - a TREE_LIST node for arguments given as typespecs or names with typespecs, - or void_type_node, to mark the end of an argument list - when additional arguments are not permitted (... was not used). - - FUNCDEF_FLAG is nonzero for a function definition, 0 for - a mere declaration. A nonempty identifier-list gets an error message - when FUNCDEF_FLAG is zero. - If FUNCDEF_FLAG is 1, then parameter types must be complete. - If FUNCDEF_FLAG is -1, then parameter types may be incomplete. - - If all elements of the input list contain types, - we return a list of the types. - If all elements contain no type (except perhaps a void_type_node - at the end), we return a null list. - If some have types and some do not, it is an error, and we - return a null list. - - Also set last_function_parms to either - a list of names (IDENTIFIER_NODEs) or a chain of PARM_DECLs. - A list of names is converted to a chain of PARM_DECLs - by store_parm_decls so that ultimately it is always a chain of decls. - - Note that in C++, parameters can take default values. These default - values are in the TREE_PURPOSE field of the TREE_LIST. It is - an error to specify default values which are followed by parameters - that have no default values, or an ELLIPSES. For simplicities sake, - only parameters which are specified with their types can take on - default values. */ - -static tree -grokparms (first_parm, funcdef_flag) - tree first_parm; - int funcdef_flag; -{ - tree result = NULL_TREE; - tree decls = NULL_TREE; - - if (first_parm != NULL_TREE - && TREE_CODE (TREE_VALUE (first_parm)) == IDENTIFIER_NODE) - { - if (! funcdef_flag) - pedwarn ("parameter names (without types) in function declaration"); - last_function_parms = first_parm; - return NULL_TREE; - } - else if (first_parm != NULL_TREE - && TREE_CODE (TREE_VALUE (first_parm)) != TREE_LIST - && TREE_CODE (TREE_VALUE (first_parm)) != VOID_TYPE) - my_friendly_abort (145); - else - { - /* Types were specified. This is a list of declarators - each represented as a TREE_LIST node. */ - register tree parm, chain; - int any_init = 0, any_error = 0; - - if (first_parm != NULL_TREE) - { - tree last_result = NULL_TREE; - tree last_decl = NULL_TREE; - - for (parm = first_parm; parm != NULL_TREE; parm = chain) - { - tree type = NULL_TREE, list_node = parm; - register tree decl = TREE_VALUE (parm); - tree init = TREE_PURPOSE (parm); - - chain = TREE_CHAIN (parm); - /* @@ weak defense against parse errors. */ - if (TREE_CODE (decl) != VOID_TYPE - && TREE_CODE (decl) != TREE_LIST) - { - /* Give various messages as the need arises. */ - if (TREE_CODE (decl) == STRING_CST) - cp_error ("invalid string constant `%E'", decl); - else if (TREE_CODE (decl) == INTEGER_CST) - error ("invalid integer constant in parameter list, did you forget to give parameter name?"); - continue; - } - - if (TREE_CODE (decl) != VOID_TYPE) - { - decl = grokdeclarator (TREE_VALUE (decl), - TREE_PURPOSE (decl), - PARM, init != NULL_TREE, - NULL_TREE); - if (! decl || TREE_TYPE (decl) == error_mark_node) - continue; - - /* Top-level qualifiers on the parameters are - ignored for function types. */ - type = TYPE_MAIN_VARIANT (TREE_TYPE (decl)); - - if (TREE_CODE (type) == VOID_TYPE) - decl = void_type_node; - else if (TREE_CODE (type) == METHOD_TYPE) - { - if (DECL_NAME (decl)) - /* Cannot use the decl here because - we don't have DECL_CONTEXT set up yet. */ - cp_error ("parameter `%D' invalidly declared method type", - DECL_NAME (decl)); - else - error ("parameter invalidly declared method type"); - type = build_pointer_type (type); - TREE_TYPE (decl) = type; - } - else if (TREE_CODE (type) == OFFSET_TYPE) - { - if (DECL_NAME (decl)) - cp_error ("parameter `%D' invalidly declared offset type", - DECL_NAME (decl)); - else - error ("parameter invalidly declared offset type"); - type = build_pointer_type (type); - TREE_TYPE (decl) = type; - } - else if (TREE_CODE (type) == RECORD_TYPE - && TYPE_LANG_SPECIFIC (type) - && CLASSTYPE_ABSTRACT_VIRTUALS (type)) - { - abstract_virtuals_error (decl, type); - any_error = 1; /* Seems like a good idea. */ - } - else if (TREE_CODE (type) == RECORD_TYPE - && TYPE_LANG_SPECIFIC (type) - && IS_SIGNATURE (type)) - { - signature_error (decl, type); - any_error = 1; /* Seems like a good idea. */ - } - else if (POINTER_TYPE_P (type)) - { - tree t = type; - while (POINTER_TYPE_P (t) - || (TREE_CODE (t) == ARRAY_TYPE - && TYPE_DOMAIN (t) != NULL_TREE)) - t = TREE_TYPE (t); - if (TREE_CODE (t) == ARRAY_TYPE) - cp_error ("parameter type `%T' includes %s to array of unknown bound", - type, - TYPE_PTR_P (type) ? "pointer" : "reference"); - } - } - - if (TREE_CODE (decl) == VOID_TYPE) - { - if (result == NULL_TREE) - { - result = void_list_node; - last_result = result; - } - else - { - TREE_CHAIN (last_result) = void_list_node; - last_result = void_list_node; - } - if (chain - && (chain != void_list_node || TREE_CHAIN (chain))) - error ("`void' in parameter list must be entire list"); - break; - } - - /* Since there is a prototype, args are passed in their own types. */ - DECL_ARG_TYPE (decl) = TREE_TYPE (decl); -#ifdef PROMOTE_PROTOTYPES - if ((TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == ENUMERAL_TYPE) - && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)) - DECL_ARG_TYPE (decl) = integer_type_node; -#endif - if (!any_error && init) - { - any_init++; - init = check_default_argument (decl, init); - } - else - init = NULL_TREE; - - if (decls == NULL_TREE) - { - decls = decl; - last_decl = decls; - } - else - { - TREE_CHAIN (last_decl) = decl; - last_decl = decl; - } - if (! current_function_decl && TREE_PERMANENT (list_node)) - { - TREE_PURPOSE (list_node) = init; - TREE_VALUE (list_node) = type; - TREE_CHAIN (list_node) = NULL_TREE; - } - else - list_node = saveable_tree_cons (init, type, NULL_TREE); - if (result == NULL_TREE) - { - result = list_node; - last_result = result; - } - else - { - TREE_CHAIN (last_result) = list_node; - last_result = list_node; - } - } - if (last_result) - TREE_CHAIN (last_result) = NULL_TREE; - /* If there are no parameters, and the function does not end - with `...', then last_decl will be NULL_TREE. */ - if (last_decl != NULL_TREE) - TREE_CHAIN (last_decl) = NULL_TREE; - } - } - - last_function_parms = decls; - - return result; -} - -/* Called from the parser to update an element of TYPE_ARG_TYPES for some - FUNCTION_TYPE with the newly parsed version of its default argument, which - was previously digested as text. See snarf_defarg et al in lex.c. */ - -void -replace_defarg (arg, init) - tree arg, init; -{ - if (! processing_template_decl - && ! can_convert_arg (TREE_VALUE (arg), TREE_TYPE (init), init)) - cp_pedwarn ("invalid type `%T' for default argument to `%T'", - TREE_TYPE (init), TREE_VALUE (arg)); - TREE_PURPOSE (arg) = init; -} - -/* Return 1 if D copies its arguments. This is used to test for copy - constructors and copy assignment operators. */ - -int -copy_args_p (d) - tree d; -{ - tree t = FUNCTION_ARG_CHAIN (d); - if (DECL_CONSTRUCTOR_P (d) - && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (d))) - { - t = TREE_CHAIN (t); - if (TYPE_USES_PVBASES (DECL_CONTEXT (d))) - t = TREE_CHAIN (t); - } - - if (t && TREE_CODE (TREE_VALUE (t)) == REFERENCE_TYPE - && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (t))) - == DECL_CLASS_CONTEXT (d)) - && (TREE_CHAIN (t) == NULL_TREE - || TREE_CHAIN (t) == void_list_node - || TREE_PURPOSE (TREE_CHAIN (t)))) - return 1; - return 0; -} - -/* These memoizing functions keep track of special properties which - a class may have. `grok_ctor_properties' notices whether a class - has a constructor of the form X(X&), and also complains - if the class has a constructor of the form X(X). - `grok_op_properties' takes notice of the various forms of - operator= which are defined, as well as what sorts of type conversion - may apply. Both functions take a FUNCTION_DECL as an argument. */ - -int -grok_ctor_properties (ctype, decl) - tree ctype, decl; -{ - tree parmtypes = FUNCTION_ARG_CHAIN (decl); - tree parmtype = parmtypes ? TREE_VALUE (parmtypes) : void_type_node; - - /* When a type has virtual baseclasses, a magical first int argument is - added to any ctor so we can tell if the class has been initialized - yet. This could screw things up in this function, so we deliberately - ignore the leading int if we're in that situation. */ - if (TYPE_USES_VIRTUAL_BASECLASSES (ctype) - && !CLASSTYPE_IS_TEMPLATE (ctype)) - { - my_friendly_assert (parmtypes - && TREE_VALUE (parmtypes) == integer_type_node, - 980529); - parmtypes = TREE_CHAIN (parmtypes); - parmtype = TREE_VALUE (parmtypes); - } - - if (TYPE_USES_PVBASES (ctype)) - { - my_friendly_assert (parmtypes - && TREE_VALUE (parmtypes) == vlist_type_node, - 980529); - parmtypes = TREE_CHAIN (parmtypes); - parmtype = TREE_VALUE (parmtypes); - } - - /* [class.copy] - - A non-template constructor for class X is a copy constructor if - its first parameter is of type X&, const X&, volatile X& or const - volatile X&, and either there are no other parameters or else all - other parameters have default arguments. */ - if (TREE_CODE (parmtype) == REFERENCE_TYPE - && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == ctype - && (TREE_CHAIN (parmtypes) == NULL_TREE - || TREE_CHAIN (parmtypes) == void_list_node - || TREE_PURPOSE (TREE_CHAIN (parmtypes))) - && !(DECL_TEMPLATE_INSTANTIATION (decl) - && is_member_template (DECL_TI_TEMPLATE (decl)))) - { - TYPE_HAS_INIT_REF (ctype) = 1; - if (CP_TYPE_CONST_P (TREE_TYPE (parmtype))) - TYPE_HAS_CONST_INIT_REF (ctype) = 1; - } - /* [class.copy] - - A declaration of a constructor for a class X is ill-formed if its - first parameter is of type (optionally cv-qualified) X and either - there are no other parameters or else all other parameters have - default arguments. - - We *don't* complain about member template instantiations that - have this form, though; they can occur as we try to decide what - constructor to use during overload resolution. Since overload - resolution will never prefer such a constructor to the - non-template copy constructor (which is either explicitly or - implicitly defined), there's no need to worry about their - existence. Theoretically, they should never even be - instantiated, but that's hard to forestall. */ - else if (TYPE_MAIN_VARIANT (parmtype) == ctype - && (TREE_CHAIN (parmtypes) == NULL_TREE - || TREE_CHAIN (parmtypes) == void_list_node - || TREE_PURPOSE (TREE_CHAIN (parmtypes))) - && !(DECL_TEMPLATE_INSTANTIATION (decl) - && is_member_template (DECL_TI_TEMPLATE (decl)))) - { - cp_error ("invalid constructor; you probably meant `%T (const %T&)'", - ctype, ctype); - SET_IDENTIFIER_ERROR_LOCUS (DECL_NAME (decl), ctype); - return 0; - } - else if (TREE_CODE (parmtype) == VOID_TYPE - || TREE_PURPOSE (parmtypes) != NULL_TREE) - TYPE_HAS_DEFAULT_CONSTRUCTOR (ctype) = 1; - - return 1; -} - -/* An operator with this name can be either unary or binary. */ - -static int -ambi_op_p (name) - tree name; -{ - return (name == ansi_opname [(int) INDIRECT_REF] - || name == ansi_opname [(int) ADDR_EXPR] - || name == ansi_opname [(int) NEGATE_EXPR] - || name == ansi_opname[(int) POSTINCREMENT_EXPR] - || name == ansi_opname[(int) POSTDECREMENT_EXPR] - || name == ansi_opname [(int) CONVERT_EXPR]); -} - -/* An operator with this name can only be unary. */ - -static int -unary_op_p (name) - tree name; -{ - return (name == ansi_opname [(int) TRUTH_NOT_EXPR] - || name == ansi_opname [(int) BIT_NOT_EXPR] - || name == ansi_opname [(int) COMPONENT_REF] - || IDENTIFIER_TYPENAME_P (name)); -} - -/* Do a little sanity-checking on how they declared their operator. */ - -void -grok_op_properties (decl, virtualp, friendp) - tree decl; - int virtualp, friendp; -{ - tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl)); - int methodp = (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE); - tree name = DECL_NAME (decl); - - if (current_class_type == NULL_TREE) - friendp = 1; - - if (! friendp) - { - /* [class.copy] - - A user-declared copy assignment operator X::operator= is a - non-static non-template member function of class X with - exactly one parameter of type X, X&, const X&, volatile X& or - const volatile X&. */ - if (name == ansi_opname[(int) MODIFY_EXPR] - && !(DECL_TEMPLATE_INSTANTIATION (decl) - && is_member_template (DECL_TI_TEMPLATE (decl)))) - ; - else if (name == ansi_opname[(int) CALL_EXPR]) - TYPE_OVERLOADS_CALL_EXPR (current_class_type) = 1; - else if (name == ansi_opname[(int) ARRAY_REF]) - TYPE_OVERLOADS_ARRAY_REF (current_class_type) = 1; - else if (name == ansi_opname[(int) COMPONENT_REF] - || name == ansi_opname[(int) MEMBER_REF]) - TYPE_OVERLOADS_ARROW (current_class_type) = 1; - else if (name == ansi_opname[(int) NEW_EXPR]) - TYPE_GETS_NEW (current_class_type) |= 1; - else if (name == ansi_opname[(int) DELETE_EXPR]) - TYPE_GETS_DELETE (current_class_type) |= 1; - else if (name == ansi_opname[(int) VEC_NEW_EXPR]) - TYPE_GETS_NEW (current_class_type) |= 2; - else if (name == ansi_opname[(int) VEC_DELETE_EXPR]) - TYPE_GETS_DELETE (current_class_type) |= 2; - } - - if (name == ansi_opname[(int) NEW_EXPR] - || name == ansi_opname[(int) VEC_NEW_EXPR]) - { - /* When the compiler encounters the definition of A::operator new, it - doesn't look at the class declaration to find out if it's static. */ - if (methodp) - revert_static_member_fn (&decl, NULL, NULL); - - /* Take care of function decl if we had syntax errors. */ - if (argtypes == NULL_TREE) - TREE_TYPE (decl) - = build_function_type (ptr_type_node, - hash_tree_chain (integer_type_node, - void_list_node)); - else - TREE_TYPE (decl) = coerce_new_type (TREE_TYPE (decl)); - } - else if (name == ansi_opname[(int) DELETE_EXPR] - || name == ansi_opname[(int) VEC_DELETE_EXPR]) - { - if (methodp) - revert_static_member_fn (&decl, NULL, NULL); - - if (argtypes == NULL_TREE) - TREE_TYPE (decl) - = build_function_type (void_type_node, - hash_tree_chain (ptr_type_node, - void_list_node)); - else - { - TREE_TYPE (decl) = coerce_delete_type (TREE_TYPE (decl)); - - if (! friendp && name == ansi_opname[(int) VEC_DELETE_EXPR] - && (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl))) - != void_list_node)) - TYPE_VEC_DELETE_TAKES_SIZE (current_class_type) = 1; - } - } - else - { - /* An operator function must either be a non-static member function - or have at least one parameter of a class, a reference to a class, - an enumeration, or a reference to an enumeration. 13.4.0.6 */ - if (! methodp || DECL_STATIC_FUNCTION_P (decl)) - { - if (IDENTIFIER_TYPENAME_P (name) - || name == ansi_opname[(int) CALL_EXPR] - || name == ansi_opname[(int) MODIFY_EXPR] - || name == ansi_opname[(int) COMPONENT_REF] - || name == ansi_opname[(int) ARRAY_REF]) - cp_error ("`%D' must be a nonstatic member function", decl); - else - { - tree p = argtypes; - - if (DECL_STATIC_FUNCTION_P (decl)) - cp_error ("`%D' must be either a non-static member function or a non-member function", decl); - - if (p) - for (; TREE_CODE (TREE_VALUE (p)) != VOID_TYPE ; p = TREE_CHAIN (p)) - { - tree arg = TREE_VALUE (p); - if (TREE_CODE (arg) == REFERENCE_TYPE) - arg = TREE_TYPE (arg); - - /* This lets bad template code slip through. */ - if (IS_AGGR_TYPE (arg) - || TREE_CODE (arg) == ENUMERAL_TYPE - || TREE_CODE (arg) == TEMPLATE_TYPE_PARM - || TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM) - goto foundaggr; - } - cp_error - ("`%D' must have an argument of class or enumerated type", - decl); - foundaggr: - ; - } - } - - if (name == ansi_opname[(int) CALL_EXPR]) - return; /* No restrictions on args. */ - - if (IDENTIFIER_TYPENAME_P (name) && ! DECL_TEMPLATE_INFO (decl)) - { - tree t = TREE_TYPE (name); - if (TREE_CODE (t) == VOID_TYPE) - pedwarn ("void is not a valid type conversion operator"); - else if (! friendp) - { - int ref = (TREE_CODE (t) == REFERENCE_TYPE); - const char *what = 0; - if (ref) - t = TYPE_MAIN_VARIANT (TREE_TYPE (t)); - - if (t == current_class_type) - what = "the same type"; - /* Don't force t to be complete here. */ - else if (IS_AGGR_TYPE (t) - && TYPE_SIZE (t) - && DERIVED_FROM_P (t, current_class_type)) - what = "a base class"; - - if (what) - warning ("conversion to %s%s will never use a type conversion operator", - ref ? "a reference to " : "", what); - } - } - - if (name == ansi_opname[(int) MODIFY_EXPR]) - { - tree parmtype; - - if (list_length (argtypes) != 3 && methodp) - { - cp_error ("`%D' must take exactly one argument", decl); - return; - } - parmtype = TREE_VALUE (TREE_CHAIN (argtypes)); - - if (copy_assignment_arg_p (parmtype, virtualp) - && ! friendp) - { - TYPE_HAS_ASSIGN_REF (current_class_type) = 1; - if (TREE_CODE (parmtype) != REFERENCE_TYPE - || CP_TYPE_CONST_P (TREE_TYPE (parmtype))) - TYPE_HAS_CONST_ASSIGN_REF (current_class_type) = 1; - } - } - else if (name == ansi_opname[(int) COND_EXPR]) - { - /* 13.4.0.3 */ - pedwarn ("ANSI C++ prohibits overloading operator ?:"); - if (list_length (argtypes) != 4) - cp_error ("`%D' must take exactly three arguments", decl); - } - else if (ambi_op_p (name)) - { - if (list_length (argtypes) == 2) - /* prefix */; - else if (list_length (argtypes) == 3) - { - if ((name == ansi_opname[(int) POSTINCREMENT_EXPR] - || name == ansi_opname[(int) POSTDECREMENT_EXPR]) - && ! processing_template_decl - && ! same_type_p (TREE_VALUE (TREE_CHAIN (argtypes)), integer_type_node)) - { - if (methodp) - cp_error ("postfix `%D' must take `int' as its argument", - decl); - else - cp_error - ("postfix `%D' must take `int' as its second argument", - decl); - } - } - else - { - if (methodp) - cp_error ("`%D' must take either zero or one argument", decl); - else - cp_error ("`%D' must take either one or two arguments", decl); - } - - /* More Effective C++ rule 6. */ - if (warn_ecpp - && (name == ansi_opname[(int) POSTINCREMENT_EXPR] - || name == ansi_opname[(int) POSTDECREMENT_EXPR])) - { - tree arg = TREE_VALUE (argtypes); - tree ret = TREE_TYPE (TREE_TYPE (decl)); - if (methodp || TREE_CODE (arg) == REFERENCE_TYPE) - arg = TREE_TYPE (arg); - arg = TYPE_MAIN_VARIANT (arg); - if (list_length (argtypes) == 2) - { - if (TREE_CODE (ret) != REFERENCE_TYPE - || !same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (ret)), - arg)) - cp_warning ("prefix `%D' should return `%T'", decl, - build_reference_type (arg)); - } - else - { - if (!same_type_p (TYPE_MAIN_VARIANT (ret), arg)) - cp_warning ("postfix `%D' should return `%T'", decl, arg); - } - } - } - else if (unary_op_p (name)) - { - if (list_length (argtypes) != 2) - { - if (methodp) - cp_error ("`%D' must take `void'", decl); - else - cp_error ("`%D' must take exactly one argument", decl); - } - } - else /* if (binary_op_p (name)) */ - { - if (list_length (argtypes) != 3) - { - if (methodp) - cp_error ("`%D' must take exactly one argument", decl); - else - cp_error ("`%D' must take exactly two arguments", decl); - } - - /* More Effective C++ rule 7. */ - if (warn_ecpp - && (name == ansi_opname [TRUTH_ANDIF_EXPR] - || name == ansi_opname [TRUTH_ORIF_EXPR] - || name == ansi_opname [COMPOUND_EXPR])) - cp_warning ("user-defined `%D' always evaluates both arguments", - decl); - } - - /* Effective C++ rule 23. */ - if (warn_ecpp - && list_length (argtypes) == 3 - && (name == ansi_opname [PLUS_EXPR] - || name == ansi_opname [MINUS_EXPR] - || name == ansi_opname [TRUNC_DIV_EXPR] - || name == ansi_opname [MULT_EXPR]) - && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == REFERENCE_TYPE) - cp_warning ("`%D' should return by value", decl); - - /* 13.4.0.8 */ - if (argtypes) - for (; argtypes != void_list_node ; argtypes = TREE_CHAIN (argtypes)) - if (TREE_PURPOSE (argtypes)) - { - TREE_PURPOSE (argtypes) = NULL_TREE; - if (name == ansi_opname[(int) POSTINCREMENT_EXPR] - || name == ansi_opname[(int) POSTDECREMENT_EXPR]) - { - if (pedantic) - cp_pedwarn ("`%D' cannot have default arguments", decl); - } - else - cp_error ("`%D' cannot have default arguments", decl); - } - } -} - -static const char * -tag_name (code) - enum tag_types code; -{ - switch (code) - { - case record_type: - return "struct"; - case class_type: - return "class"; - case union_type: - return "union "; - case enum_type: - return "enum"; - case signature_type: - return "signature"; - default: - my_friendly_abort (981122); - } -} - -/* Get the struct, enum or union (CODE says which) with tag NAME. - Define the tag as a forward-reference if it is not defined. - - C++: If a class derivation is given, process it here, and report - an error if multiple derivation declarations are not identical. - - If this is a definition, come in through xref_tag and only look in - the current frame for the name (since C++ allows new names in any - scope.) */ - -tree -xref_tag (code_type_node, name, globalize) - tree code_type_node; - tree name; - int globalize; -{ - enum tag_types tag_code; - enum tree_code code; - int temp = 0; - register tree ref, t; - struct binding_level *b = current_binding_level; - int got_type = 0; - tree attributes = NULL_TREE; - tree context = NULL_TREE; - - /* If we are called from the parser, code_type_node will sometimes be a - TREE_LIST. This indicates that the user wrote - "class __attribute__ ((foo)) bar". Extract the attributes so we can - use them later. */ - if (TREE_CODE (code_type_node) == TREE_LIST) - { - attributes = TREE_PURPOSE (code_type_node); - code_type_node = TREE_VALUE (code_type_node); - } - - tag_code = (enum tag_types) TREE_INT_CST_LOW (code_type_node); - switch (tag_code) - { - case record_type: - case class_type: - case signature_type: - code = RECORD_TYPE; - break; - case union_type: - code = UNION_TYPE; - break; - case enum_type: - code = ENUMERAL_TYPE; - break; - default: - my_friendly_abort (18); - } - - /* If a cross reference is requested, look up the type - already defined for this tag and return it. */ - if (TREE_CODE_CLASS (TREE_CODE (name)) == 't') - { - t = name; - name = TYPE_IDENTIFIER (t); - got_type = 1; - } - else - t = IDENTIFIER_TYPE_VALUE (name); - - if (t && TREE_CODE (t) != code && TREE_CODE (t) != TEMPLATE_TYPE_PARM - && TREE_CODE (t) != TEMPLATE_TEMPLATE_PARM) - t = NULL_TREE; - - if (! globalize) - { - /* If we know we are defining this tag, only look it up in - this scope and don't try to find it as a type. */ - ref = lookup_tag (code, name, b, 1); - } - else - { - if (t) - { - /* [dcl.type.elab] If the identifier resolves to a - typedef-name or a template type-parameter, the - elaborated-type-specifier is ill-formed. */ - if (t != TYPE_MAIN_VARIANT (t) - || (CLASS_TYPE_P (t) && TYPE_WAS_ANONYMOUS (t))) - cp_pedwarn ("using typedef-name `%D' after `%s'", - TYPE_NAME (t), tag_name (tag_code)); - else if (TREE_CODE (t) == TEMPLATE_TYPE_PARM) - cp_error ("using template type parameter `%T' after `%s'", - t, tag_name (tag_code)); - - ref = t; - } - else - ref = lookup_tag (code, name, b, 0); - - if (! ref) - { - /* Try finding it as a type declaration. If that wins, - use it. */ - ref = lookup_name (name, 1); - - if (ref != NULL_TREE - && processing_template_decl - && DECL_CLASS_TEMPLATE_P (ref) - && template_class_depth (current_class_type) == 0) - /* Since GLOBALIZE is true, we're declaring a global - template, so we want this type. */ - ref = DECL_RESULT (ref); - - if (ref && TREE_CODE (ref) == TYPE_DECL - && TREE_CODE (TREE_TYPE (ref)) == code) - ref = TREE_TYPE (ref); - else - ref = NULL_TREE; - } - - if (ref && current_class_type - && template_class_depth (current_class_type) - && PROCESSING_REAL_TEMPLATE_DECL_P ()) - { - /* Since GLOBALIZE is non-zero, we are not looking at a - definition of this tag. Since, in addition, we are currently - processing a (member) template declaration of a template - class, we must be very careful; consider: - - template - struct S1 - - template - struct S2 - { template - friend struct S1; }; - - Here, the S2::S1 declaration should not be confused with the - outer declaration. In particular, the inner version should - have a template parameter of level 2, not level 1. This - would be particularly important if the member declaration - were instead: - - template friend struct S1; - - say, when we should tsubst into `U' when instantiating - S2. On the other hand, when presented with: - - template - struct S1 { - template - struct S2 {}; - template - friend struct S2; - }; - - we must find the inner binding eventually. We - accomplish this by making sure that the new type we - create to represent this declaration has the right - TYPE_CONTEXT. */ - context = TYPE_CONTEXT (ref); - ref = NULL_TREE; - } - } - - push_obstacks_nochange (); - - if (! ref) - { - /* If no such tag is yet defined, create a forward-reference node - and record it as the "definition". - When a real declaration of this type is found, - the forward-reference will be altered into a real type. */ - - /* In C++, since these migrate into the global scope, we must - build them on the permanent obstack. */ - - temp = allocation_temporary_p (); - if (temp) - end_temporary_allocation (); - - if (code == ENUMERAL_TYPE) - { - cp_error ("use of enum `%#D' without previous declaration", name); - - ref = make_node (ENUMERAL_TYPE); - - /* Give the type a default layout like unsigned int - to avoid crashing if it does not get defined. */ - TYPE_MODE (ref) = TYPE_MODE (unsigned_type_node); - TYPE_ALIGN (ref) = TYPE_ALIGN (unsigned_type_node); - TREE_UNSIGNED (ref) = 1; - TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node); - TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node); - TYPE_MAX_VALUE (ref) = TYPE_MAX_VALUE (unsigned_type_node); - - /* Enable us to recognize when a type is created in class context. - To do nested classes correctly, this should probably be cleared - out when we leave this classes scope. Currently this in only - done in `start_enum'. */ - - pushtag (name, ref, globalize); - } - else - { - struct binding_level *old_b = class_binding_level; - - ref = make_lang_type (code); - TYPE_CONTEXT (ref) = context; - - if (tag_code == signature_type) - { - SET_SIGNATURE (ref); - /* Since a signature type will be turned into the type - of signature tables, it's not only an interface. */ - CLASSTYPE_INTERFACE_ONLY (ref) = 0; - SET_CLASSTYPE_INTERFACE_KNOWN (ref); - /* A signature doesn't have a vtable. */ - CLASSTYPE_VTABLE_NEEDS_WRITING (ref) = 0; - } - -#ifdef NONNESTED_CLASSES - /* Class types don't nest the way enums do. */ - class_binding_level = (struct binding_level *)0; -#endif - pushtag (name, ref, globalize); - class_binding_level = old_b; - } - } - else - { - /* If it no longer looks like a nested type, make sure it's - in global scope. - If it is not an IDENTIFIER, this is not a declaration */ - if (b->namespace_p && !class_binding_level - && TREE_CODE (name) == IDENTIFIER_NODE) - { - if (IDENTIFIER_NAMESPACE_VALUE (name) == NULL_TREE) - SET_IDENTIFIER_NAMESPACE_VALUE (name, TYPE_NAME (ref)); - } - - if (!globalize && processing_template_decl && IS_AGGR_TYPE (ref)) - redeclare_class_template (ref, current_template_parms); - } - - /* Until the type is defined, tentatively accept whatever - structure tag the user hands us. */ - if (TYPE_SIZE (ref) == NULL_TREE - && ref != current_class_type - /* Have to check this, in case we have contradictory tag info. */ - && IS_AGGR_TYPE_CODE (TREE_CODE (ref))) - { - if (tag_code == class_type) - CLASSTYPE_DECLARED_CLASS (ref) = 1; - else if (tag_code == record_type || tag_code == signature_type) - CLASSTYPE_DECLARED_CLASS (ref) = 0; - } - - pop_obstacks (); - - TREE_TYPE (ref) = attributes; - - return ref; -} - -tree -xref_tag_from_type (old, id, globalize) - tree old, id; - int globalize; -{ - tree code_type_node; - - if (TREE_CODE (old) == RECORD_TYPE) - code_type_node = (CLASSTYPE_DECLARED_CLASS (old) - ? class_type_node : record_type_node); - else - code_type_node = union_type_node; - - if (id == NULL_TREE) - id = TYPE_IDENTIFIER (old); - - return xref_tag (code_type_node, id, globalize); -} - -/* REF is a type (named NAME), for which we have just seen some - baseclasses. BINFO is a list of those baseclasses; the - TREE_PURPOSE is an access_* node, and the TREE_VALUE is the type of - the base-class. CODE_TYPE_NODE indicates whether REF is a class, - struct, or union. */ - -void -xref_basetypes (code_type_node, name, ref, binfo) - tree code_type_node; - tree name, ref; - tree binfo; -{ - /* In the declaration `A : X, Y, ... Z' we mark all the types - (A, X, Y, ..., Z) so we can check for duplicates. */ - tree binfos; - tree base; - - int i, len; - enum tag_types tag_code = (enum tag_types) TREE_INT_CST_LOW (code_type_node); - - if (tag_code == union_type) - { - cp_error ("derived union `%T' invalid", ref); - return; - } - - len = list_length (binfo); - push_obstacks (TYPE_OBSTACK (ref), TYPE_OBSTACK (ref)); - - /* First, make sure that any templates in base-classes are - instantiated. This ensures that if we call ourselves recursively - we do not get confused about which classes are marked and which - are not. */ - for (base = binfo; base; base = TREE_CHAIN (base)) - complete_type (TREE_VALUE (base)); - - SET_CLASSTYPE_MARKED (ref); - BINFO_BASETYPES (TYPE_BINFO (ref)) = binfos = make_tree_vec (len); - - for (i = 0; binfo; binfo = TREE_CHAIN (binfo)) - { - /* The base of a derived struct is public by default. */ - int via_public - = (TREE_PURPOSE (binfo) == access_public_node - || TREE_PURPOSE (binfo) == access_public_virtual_node - || (tag_code != class_type - && (TREE_PURPOSE (binfo) == access_default_node - || TREE_PURPOSE (binfo) == access_default_virtual_node))); - int via_protected - = (TREE_PURPOSE (binfo) == access_protected_node - || TREE_PURPOSE (binfo) == access_protected_virtual_node); - int via_virtual - = (TREE_PURPOSE (binfo) == access_private_virtual_node - || TREE_PURPOSE (binfo) == access_protected_virtual_node - || TREE_PURPOSE (binfo) == access_public_virtual_node - || TREE_PURPOSE (binfo) == access_default_virtual_node); - tree basetype = TREE_VALUE (binfo); - tree base_binfo; - - if (basetype && TREE_CODE (basetype) == TYPE_DECL) - basetype = TREE_TYPE (basetype); - if (!basetype - || (TREE_CODE (basetype) != RECORD_TYPE - && TREE_CODE (basetype) != TYPENAME_TYPE - && TREE_CODE (basetype) != TEMPLATE_TYPE_PARM - && TREE_CODE (basetype) != TEMPLATE_TEMPLATE_PARM)) - { - cp_error ("base type `%T' fails to be a struct or class type", - TREE_VALUE (binfo)); - continue; - } - - GNU_xref_hier (name, basetype, via_public, via_virtual, 0); - - /* This code replaces similar code in layout_basetypes. - We put the complete_type first for implicit `typename'. */ - if (TYPE_SIZE (basetype) == NULL_TREE - && ! (current_template_parms && uses_template_parms (basetype))) - { - cp_error ("base class `%T' has incomplete type", basetype); - continue; - } - else - { - if (CLASSTYPE_MARKED (basetype)) - { - if (basetype == ref) - cp_error ("recursive type `%T' undefined", basetype); - else - cp_error ("duplicate base type `%T' invalid", basetype); - continue; - } - - if (TYPE_FOR_JAVA (basetype) - && current_lang_stack == current_lang_base) - TYPE_FOR_JAVA (ref) = 1; - - /* Note that the BINFO records which describe individual - inheritances are *not* shared in the lattice! They - cannot be shared because a given baseclass may be - inherited with different `accessibility' by different - derived classes. (Each BINFO record describing an - individual inheritance contains flags which say what - the `accessibility' of that particular inheritance is.) */ - - base_binfo - = make_binfo (integer_zero_node, basetype, - CLASS_TYPE_P (basetype) - ? TYPE_BINFO_VTABLE (basetype) : NULL_TREE, - CLASS_TYPE_P (basetype) - ? TYPE_BINFO_VIRTUALS (basetype) : NULL_TREE); - - TREE_VEC_ELT (binfos, i) = base_binfo; - TREE_VIA_PUBLIC (base_binfo) = via_public; - TREE_VIA_PROTECTED (base_binfo) = via_protected; - TREE_VIA_VIRTUAL (base_binfo) = via_virtual; - BINFO_INHERITANCE_CHAIN (base_binfo) = TYPE_BINFO (ref); - - /* We need to unshare the binfos now so that lookups during class - definition work. */ - unshare_base_binfos (base_binfo); - - SET_CLASSTYPE_MARKED (basetype); - - /* We are free to modify these bits because they are meaningless - at top level, and BASETYPE is a top-level type. */ - if (via_virtual || TYPE_USES_VIRTUAL_BASECLASSES (basetype)) - { - TYPE_USES_VIRTUAL_BASECLASSES (ref) = 1; - TYPE_USES_COMPLEX_INHERITANCE (ref) = 1; - /* The PVBASES flag is never set for templates; we know - only for instantiations whether the virtual bases are - polymorphic. */ - if (flag_vtable_thunks >= 2 && !CLASSTYPE_IS_TEMPLATE (ref)) - { - if (via_virtual && TYPE_VIRTUAL_P (basetype)) - TYPE_USES_PVBASES (ref) = 1; - else if (TYPE_USES_PVBASES (basetype)) - TYPE_USES_PVBASES (ref) = 1; - } - } - - if (CLASS_TYPE_P (basetype)) - { - TYPE_GETS_NEW (ref) |= TYPE_GETS_NEW (basetype); - TYPE_GETS_DELETE (ref) |= TYPE_GETS_DELETE (basetype); - } - - i += 1; - } - } - if (i) - TREE_VEC_LENGTH (binfos) = i; - else - BINFO_BASETYPES (TYPE_BINFO (ref)) = NULL_TREE; - - if (i > 1) - TYPE_USES_MULTIPLE_INHERITANCE (ref) = 1; - else if (i == 1) - { - tree basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, 0)); - - if (CLASS_TYPE_P (basetype)) - TYPE_USES_MULTIPLE_INHERITANCE (ref) - = TYPE_USES_MULTIPLE_INHERITANCE (basetype); - } - - if (TYPE_USES_MULTIPLE_INHERITANCE (ref)) - TYPE_USES_COMPLEX_INHERITANCE (ref) = 1; - - /* Unmark all the types. */ - while (--i >= 0) - CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (TREE_VEC_ELT (binfos, i))); - CLEAR_CLASSTYPE_MARKED (ref); - - /* Now that we know all the base-classes, set up the list of virtual - bases. */ - CLASSTYPE_VBASECLASSES (ref) = get_vbase_types (ref); - - pop_obstacks (); -} - - -/* Begin compiling the definition of an enumeration type. - NAME is its name (or null if anonymous). - Returns the type object, as yet incomplete. - Also records info about it so that build_enumerator - may be used to declare the individual values as they are read. */ - -tree -start_enum (name) - tree name; -{ - register tree enumtype = NULL_TREE; - struct binding_level *b = current_binding_level; - - /* We are wasting space here and putting these on the permanent_obstack so - that typeid(local enum) will work correctly. */ - push_obstacks (&permanent_obstack, &permanent_obstack); - - /* If this is the real definition for a previous forward reference, - fill in the contents in the same object that used to be the - forward reference. */ - - if (name != NULL_TREE) - enumtype = lookup_tag (ENUMERAL_TYPE, name, b, 1); - - if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE) - cp_error ("multiple definition of `%#T'", enumtype); - else - { - enumtype = make_node (ENUMERAL_TYPE); - pushtag (name, enumtype, 0); - } - - if (current_class_type) - TREE_ADDRESSABLE (b->tags) = 1; - - /* We don't copy this value because build_enumerator needs to do it. */ - enum_next_value = integer_zero_node; - enum_overflow = 0; - - GNU_xref_decl (current_function_decl, enumtype); - return enumtype; -} - -/* After processing and defining all the values of an enumeration type, - install their decls in the enumeration type and finish it off. - ENUMTYPE is the type object and VALUES a list of name-value pairs. - Returns ENUMTYPE. */ - -tree -finish_enum (enumtype) - tree enumtype; -{ - register tree minnode = NULL_TREE, maxnode = NULL_TREE; - /* Calculate the maximum value of any enumerator in this type. */ - - tree values = TYPE_VALUES (enumtype); - if (values) - { - tree pair; - - for (pair = values; pair; pair = TREE_CHAIN (pair)) - { - tree decl; - tree value; - - /* The TREE_VALUE is a CONST_DECL for this enumeration - constant. */ - decl = TREE_VALUE (pair); - - /* The DECL_INITIAL will be NULL if we are processing a - template declaration and this enumeration constant had no - explicit initializer. */ - value = DECL_INITIAL (decl); - if (value && !processing_template_decl) - { - /* Set the TREE_TYPE for the VALUE as well. That's so - that when we call decl_constant_value we get an - entity of the right type (but with the constant - value). Since we shouldn't ever call - decl_constant_value on a template type, there's no - reason to do that when processing_template_decl. - And, if the expression is something like a - TEMPLATE_PARM_INDEX or a CAST_EXPR doing so will - wreak havoc on the intended type of the expression. - - Of course, there's also no point in trying to compute - minimum or maximum values if we're in a template. */ - TREE_TYPE (value) = enumtype; - - if (!minnode) - minnode = maxnode = value; - else if (tree_int_cst_lt (maxnode, value)) - maxnode = value; - else if (tree_int_cst_lt (value, minnode)) - minnode = value; - } - - if (processing_template_decl) - /* If this is just a template, leave the CONST_DECL - alone. That way tsubst_copy will find CONST_DECLs for - CONST_DECLs, and not INTEGER_CSTs. */ - ; - else - /* In the list we're building up, we want the enumeration - values, not the CONST_DECLs. */ - TREE_VALUE (pair) = value; - } - } - else - maxnode = minnode = integer_zero_node; - - TYPE_VALUES (enumtype) = nreverse (values); - - if (processing_template_decl) - { - tree scope = current_scope (); - if (scope && TREE_CODE (scope) == FUNCTION_DECL) - add_tree (build_min (TAG_DEFN, enumtype)); - } - else - { - int unsignedp = tree_int_cst_sgn (minnode) >= 0; - int lowprec = min_precision (minnode, unsignedp); - int highprec = min_precision (maxnode, unsignedp); - int precision = MAX (lowprec, highprec); - tree tem; - - TYPE_SIZE (enumtype) = NULL_TREE; - - /* Set TYPE_MIN_VALUE and TYPE_MAX_VALUE according to `precision'. */ - - TYPE_PRECISION (enumtype) = precision; - if (unsignedp) - fixup_unsigned_type (enumtype); - else - fixup_signed_type (enumtype); - - if (flag_short_enums || (precision > TYPE_PRECISION (integer_type_node))) - /* Use the width of the narrowest normal C type which is wide - enough. */ - TYPE_PRECISION (enumtype) = TYPE_PRECISION (type_for_size - (precision, 1)); - else - TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node); - - TYPE_SIZE (enumtype) = 0; - layout_type (enumtype); - - /* Fix up all variant types of this enum type. */ - for (tem = TYPE_MAIN_VARIANT (enumtype); tem; - tem = TYPE_NEXT_VARIANT (tem)) - { - TYPE_VALUES (tem) = TYPE_VALUES (enumtype); - TYPE_MIN_VALUE (tem) = TYPE_MIN_VALUE (enumtype); - TYPE_MAX_VALUE (tem) = TYPE_MAX_VALUE (enumtype); - TYPE_SIZE (tem) = TYPE_SIZE (enumtype); - TYPE_SIZE_UNIT (tem) = TYPE_SIZE_UNIT (enumtype); - TYPE_MODE (tem) = TYPE_MODE (enumtype); - TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype); - TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype); - TREE_UNSIGNED (tem) = TREE_UNSIGNED (enumtype); - } - - /* Finish debugging output for this type. */ - rest_of_type_compilation (enumtype, namespace_bindings_p ()); - } - - /* In start_enum we pushed obstacks. Here, we must pop them. */ - pop_obstacks (); - - return enumtype; -} - -/* Build and install a CONST_DECL for an enumeration constant of the - enumeration type TYPE whose NAME and VALUE (if any) are provided. - Assignment of sequential values by default is handled here. */ - -tree -build_enumerator (name, value, type) - tree name; - tree value; - tree type; -{ - tree decl, result; - tree context; - - /* Remove no-op casts from the value. */ - if (value) - STRIP_TYPE_NOPS (value); - - if (! processing_template_decl) - { - /* Validate and default VALUE. */ - if (value != NULL_TREE) - { - if (TREE_READONLY_DECL_P (value)) - value = decl_constant_value (value); - - if (TREE_CODE (value) == INTEGER_CST) - { - value = default_conversion (value); - constant_expression_warning (value); - } - else - { - cp_error ("enumerator value for `%D' not integer constant", name); - value = NULL_TREE; - } - } - - /* Default based on previous value. */ - if (value == NULL_TREE && ! processing_template_decl) - { - value = enum_next_value; - if (enum_overflow) - cp_error ("overflow in enumeration values at `%D'", name); - } - - /* Remove no-op casts from the value. */ - if (value) - STRIP_TYPE_NOPS (value); -#if 0 - /* To fix MAX_VAL enum consts. (bkoz) */ - TREE_TYPE (value) = integer_type_node; -#endif - } - - /* We always have to copy here; not all INTEGER_CSTs are unshared. - Even in other cases, we will later (in finish_enum) be setting the - type of VALUE. */ - if (value != NULL_TREE) - value = copy_node (value); - - /* C++ associates enums with global, function, or class declarations. */ - - context = current_scope (); - if (context && context == current_class_type) - /* This enum declaration is local to the class. */ - decl = build_lang_field_decl (CONST_DECL, name, type); - else - /* It's a global enum, or it's local to a function. (Note local to - a function could mean local to a class method. */ - decl = build_decl (CONST_DECL, name, type); - - DECL_CONTEXT (decl) = FROB_CONTEXT (context); - DECL_INITIAL (decl) = value; - TREE_READONLY (decl) = 1; - - if (context && context == current_class_type) - /* In something like `struct S { enum E { i = 7 }; };' we put `i' - on the TYPE_FIELDS list for `S'. (That's so that you can say - things like `S::i' later.) */ - finish_member_declaration (decl); - else - { - pushdecl (decl); - GNU_xref_decl (current_function_decl, decl); - } - - if (! processing_template_decl) - { - /* Set basis for default for next value. */ - enum_next_value = build_binary_op_nodefault (PLUS_EXPR, value, - integer_one_node, PLUS_EXPR); - enum_overflow = tree_int_cst_lt (enum_next_value, value); - } - - result = saveable_tree_cons (name, decl, NULL_TREE); - return result; -} - - -static int function_depth; - -/* Create the FUNCTION_DECL for a function definition. - DECLSPECS and DECLARATOR are the parts of the declaration; - they describe the function's name and the type it returns, - but twisted together in a fashion that parallels the syntax of C. - - If PRE_PARSED_P is non-zero then DECLARATOR is really the DECL for - the function we are about to process; DECLSPECS are ignored. For - example, we set PRE_PARSED_P when processing the definition of - inline function that was defined in-class; the definition is - actually processed when the class is complete. In this case, - PRE_PARSED_P is 2. We also set PRE_PARSED_P when instanting the - body of a template function, and when constructing thunk functions - and such; in these cases PRE_PARSED_P is 1. - - This function creates a binding context for the function body - as well as setting up the FUNCTION_DECL in current_function_decl. - - Returns 1 on success. If the DECLARATOR is not suitable for a function - (it defines a datum instead), we return 0, which tells - yyparse to report a parse error. - - For C++, we must first check whether that datum makes any sense. - For example, "class A local_a(1,2);" means that variable local_a - is an aggregate of type A, which should have a constructor - applied to it with the argument list [1, 2]. - - @@ There is currently no way to retrieve the storage - @@ allocated to FUNCTION (or all of its parms) if we return - @@ something we had previously. */ - -int -start_function (declspecs, declarator, attrs, pre_parsed_p) - tree declspecs, declarator, attrs; - int pre_parsed_p; -{ - tree decl1; - tree ctype = NULL_TREE; - tree fntype; - tree restype; - extern int have_extern_spec; - extern int used_extern_spec; - int doing_friend = 0; - - /* Sanity check. */ - my_friendly_assert (TREE_CODE (TREE_VALUE (void_list_node)) == VOID_TYPE, 160); - my_friendly_assert (TREE_CHAIN (void_list_node) == NULL_TREE, 161); - - /* Assume, until we see it does. */ - current_function_returns_value = 0; - current_function_returns_null = 0; - named_labels = 0; - shadowed_labels = 0; - current_function_assigns_this = 0; - current_function_just_assigned_this = 0; - current_function_parms_stored = 0; - original_result_rtx = NULL_RTX; - base_init_expr = NULL_TREE; - current_base_init_list = NULL_TREE; - current_member_init_list = NULL_TREE; - ctor_label = dtor_label = NULL_TREE; - static_labelno = 0; - - clear_temp_name (); - - /* This should only be done once on the top most decl. */ - if (have_extern_spec && !used_extern_spec) - { - declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"), declspecs); - used_extern_spec = 1; - } - - if (pre_parsed_p) - { - decl1 = declarator; - -#if 0 - /* What was this testing for, exactly? */ - if (! DECL_ARGUMENTS (decl1) - && !DECL_STATIC_FUNCTION_P (decl1) - && !DECL_ARTIFICIAL (decl1) - && DECL_CLASS_SCOPE_P (decl1) - && TYPE_IDENTIFIER (DECL_CONTEXT (decl1)) - && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1)))) - { - tree binding = binding_for_name (DECL_NAME (decl1), - current_namespace); - cp_error ("redeclaration of `%#D'", decl1); - if (IDENTIFIER_CLASS_VALUE (DECL_NAME (decl1))) - cp_error_at ("previous declaration here", IDENTIFIER_CLASS_VALUE (DECL_NAME (decl1))); - else if (BINDING_VALUE (binding)) - cp_error_at ("previous declaration here", BINDING_VALUE (binding)); - } -#endif - - fntype = TREE_TYPE (decl1); - if (TREE_CODE (fntype) == METHOD_TYPE) - ctype = TYPE_METHOD_BASETYPE (fntype); - - /* ANSI C++ June 5 1992 WP 11.4.5. A friend function defined in a - class is in the (lexical) scope of the class in which it is - defined. */ - if (!ctype && DECL_FRIEND_P (decl1)) - { - ctype = DECL_CLASS_CONTEXT (decl1); - - /* CTYPE could be null here if we're dealing with a template; - for example, `inline friend float foo()' inside a template - will have no CTYPE set. */ - if (ctype && TREE_CODE (ctype) != RECORD_TYPE) - ctype = NULL_TREE; - else - doing_friend = 1; - } - - last_function_parms = DECL_ARGUMENTS (decl1); - last_function_parm_tags = NULL_TREE; - } - else - { - decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL_TREE); - /* If the declarator is not suitable for a function definition, - cause a syntax error. */ - if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) return 0; - - fntype = TREE_TYPE (decl1); - - restype = TREE_TYPE (fntype); - if (CLASS_TYPE_P (restype) && !CLASSTYPE_GOT_SEMICOLON (restype)) - { - cp_error ("semicolon missing after declaration of `%#T'", restype); - shadow_tag (build_expr_list (NULL_TREE, restype)); - CLASSTYPE_GOT_SEMICOLON (restype) = 1; - if (TREE_CODE (fntype) == FUNCTION_TYPE) - fntype = build_function_type (integer_type_node, - TYPE_ARG_TYPES (fntype)); - else - fntype = build_cplus_method_type (build_type_variant (TYPE_METHOD_BASETYPE (fntype), TREE_READONLY (decl1), TREE_SIDE_EFFECTS (decl1)), - integer_type_node, - TYPE_ARG_TYPES (fntype)); - TREE_TYPE (decl1) = fntype; - } - - if (TREE_CODE (fntype) == METHOD_TYPE) - ctype = TYPE_METHOD_BASETYPE (fntype); - else if (DECL_MAIN_P (decl1)) - { - /* If this doesn't return integer_type, complain. */ - if (TREE_TYPE (TREE_TYPE (decl1)) != integer_type_node) - { - if (pedantic || warn_return_type) - pedwarn ("return type for `main' changed to `int'"); - TREE_TYPE (decl1) = fntype = default_function_type; - } - } - } - - /* Warn if function was previously implicitly declared - (but not if we warned then). */ - if (! warn_implicit - && IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1)) != NULL_TREE) - cp_warning_at ("`%D' implicitly declared before its definition", IDENTIFIER_IMPLICIT_DECL (DECL_NAME (decl1))); - - announce_function (decl1); - - /* Set up current_class_type, and enter the scope of the class, if - appropriate. */ - if (ctype) - push_nested_class (ctype, 1); - else if (DECL_STATIC_FUNCTION_P (decl1)) - push_nested_class (DECL_CONTEXT (decl1), 2); - - /* Now that we have entered the scope of the class, we must restore - the bindings for any template parameters surrounding DECL1, if it - is an inline member template. (Order is important; consider the - case where a template parameter has the same name as a field of - the class.) It is not until after this point that - PROCESSING_TEMPLATE_DECL is guaranteed to be set up correctly. */ - if (pre_parsed_p == 2) - maybe_begin_member_template_processing (decl1); - - /* We are now in the scope of the function being defined. */ - current_function_decl = decl1; - - /* Save the parm names or decls from this function's declarator - where store_parm_decls will find them. */ - current_function_parms = last_function_parms; - current_function_parm_tags = last_function_parm_tags; - - if (! processing_template_decl) - { - /* In a function definition, arg types must be complete. */ - require_complete_types_for_parms (current_function_parms); - - if (TYPE_SIZE (complete_type (TREE_TYPE (fntype))) == NULL_TREE) - { - cp_error ("return-type `%#T' is an incomplete type", - TREE_TYPE (fntype)); - - /* Make it return void instead, but don't change the - type of the DECL_RESULT, in case we have a named return value. */ - if (ctype) - TREE_TYPE (decl1) - = build_cplus_method_type (build_type_variant (ctype, - TREE_READONLY (decl1), - TREE_SIDE_EFFECTS (decl1)), - void_type_node, - FUNCTION_ARG_CHAIN (decl1)); - else - TREE_TYPE (decl1) - = build_function_type (void_type_node, - TYPE_ARG_TYPES (TREE_TYPE (decl1))); - DECL_RESULT (decl1) - = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (TREE_TYPE (fntype))); - TREE_READONLY (DECL_RESULT (decl1)) - = CP_TYPE_CONST_P (TREE_TYPE (fntype)); - TREE_THIS_VOLATILE (DECL_RESULT (decl1)) - = CP_TYPE_VOLATILE_P (TREE_TYPE (fntype)); - } - - if (TYPE_LANG_SPECIFIC (TREE_TYPE (fntype)) - && CLASSTYPE_ABSTRACT_VIRTUALS (TREE_TYPE (fntype))) - abstract_virtuals_error (decl1, TREE_TYPE (fntype)); - } - - /* Effective C++ rule 15. See also c_expand_return. */ - if (warn_ecpp - && DECL_NAME (decl1) == ansi_opname[(int) MODIFY_EXPR] - && TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE) - cp_warning ("`operator=' should return a reference to `*this'"); - - /* Make the init_value nonzero so pushdecl knows this is not tentative. - error_mark_node is replaced below (in poplevel) with the BLOCK. */ - DECL_INITIAL (decl1) = error_mark_node; - -#ifdef SET_DEFAULT_DECL_ATTRIBUTES - SET_DEFAULT_DECL_ATTRIBUTES (decl1, attrs); -#endif - - /* This function exists in static storage. - (This does not mean `static' in the C sense!) */ - TREE_STATIC (decl1) = 1; - - /* We must call push_template_decl after current_class_type is set - up. (If we are processing inline definitions after exiting a - class scope, current_class_type will be NULL_TREE until set above - by push_nested_class.) */ - if (processing_template_decl) - decl1 = push_template_decl (decl1); - - /* Record the decl so that the function name is defined. - If we already have a decl for this name, and it is a FUNCTION_DECL, - use the old decl. */ - if (!processing_template_decl && pre_parsed_p == 0) - { - /* A specialization is not used to guide overload resolution. */ - if ((flag_guiding_decls - || !DECL_TEMPLATE_SPECIALIZATION (decl1)) - && ! DECL_FUNCTION_MEMBER_P (decl1)) - decl1 = pushdecl (decl1); - else - { - /* We need to set the DECL_CONTEXT. */ - if (!DECL_CONTEXT (decl1) && DECL_TEMPLATE_INFO (decl1)) - DECL_CONTEXT (decl1) = DECL_CONTEXT (DECL_TI_TEMPLATE (decl1)); - /* And make sure we have enough default args. */ - check_default_args (decl1); - } - DECL_MAIN_VARIANT (decl1) = decl1; - fntype = TREE_TYPE (decl1); - } - - current_function_decl = decl1; - - if (DECL_INTERFACE_KNOWN (decl1)) - { - tree ctx = hack_decl_function_context (decl1); - - if (DECL_NOT_REALLY_EXTERN (decl1)) - DECL_EXTERNAL (decl1) = 0; - - if (ctx != NULL_TREE && DECL_THIS_INLINE (ctx) - && TREE_PUBLIC (ctx)) - /* This is a function in a local class in an extern inline - function. */ - comdat_linkage (decl1); - } - /* If this function belongs to an interface, it is public. - If it belongs to someone else's interface, it is also external. - This only affects inlines and template instantiations. */ - else if (interface_unknown == 0 - && (! DECL_TEMPLATE_INSTANTIATION (decl1) - || flag_alt_external_templates)) - { - if (DECL_THIS_INLINE (decl1) || DECL_TEMPLATE_INSTANTIATION (decl1) - || processing_template_decl) - { - DECL_EXTERNAL (decl1) - = (interface_only - || (DECL_THIS_INLINE (decl1) && ! flag_implement_inlines - && !DECL_VINDEX (decl1))); - - /* For WIN32 we also want to put these in linkonce sections. */ - maybe_make_one_only (decl1); - } - else - DECL_EXTERNAL (decl1) = 0; - DECL_NOT_REALLY_EXTERN (decl1) = 0; - DECL_INTERFACE_KNOWN (decl1) = 1; - } - else if (interface_unknown && interface_only - && (! DECL_TEMPLATE_INSTANTIATION (decl1) - || flag_alt_external_templates)) - { - /* If MULTIPLE_SYMBOL_SPACES is defined and we saw a #pragma - interface, we will have interface_only set but not - interface_known. In that case, we don't want to use the normal - heuristics because someone will supply a #pragma implementation - elsewhere, and deducing it here would produce a conflict. */ - comdat_linkage (decl1); - DECL_EXTERNAL (decl1) = 0; - DECL_INTERFACE_KNOWN (decl1) = 1; - DECL_DEFER_OUTPUT (decl1) = 1; - } - else - { - /* This is a definition, not a reference. - So clear DECL_EXTERNAL. */ - DECL_EXTERNAL (decl1) = 0; - - if ((DECL_THIS_INLINE (decl1) || DECL_TEMPLATE_INSTANTIATION (decl1)) - && ! DECL_INTERFACE_KNOWN (decl1) - /* Don't try to defer nested functions for now. */ - && ! hack_decl_function_context (decl1)) - DECL_DEFER_OUTPUT (decl1) = 1; - else - DECL_INTERFACE_KNOWN (decl1) = 1; - } - - if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1)) - { - if (TREE_CODE (fntype) == METHOD_TYPE) - TREE_TYPE (decl1) = fntype - = build_function_type (TREE_TYPE (fntype), - TREE_CHAIN (TYPE_ARG_TYPES (fntype))); - current_function_parms = TREE_CHAIN (current_function_parms); - DECL_ARGUMENTS (decl1) = current_function_parms; - ctype = NULL_TREE; - } - restype = TREE_TYPE (fntype); - - if (ctype) - { - /* If we're compiling a friend function, neither of the variables - current_class_ptr nor current_class_type will have values. */ - if (! doing_friend) - { - /* We know that this was set up by `grokclassfn'. - We do not wait until `store_parm_decls', since evil - parse errors may never get us to that point. Here - we keep the consistency between `current_class_type' - and `current_class_ptr'. */ - tree t = current_function_parms; - - my_friendly_assert (t != NULL_TREE - && TREE_CODE (t) == PARM_DECL, 162); - - if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE) - { - int i; - - if (! hack_decl_function_context (decl1)) - temporary_allocation (); - i = suspend_momentary (); - - /* Normally, build_indirect_ref returns - current_class_ref whenever current_class_ptr is - dereferenced. This time, however, we want it to - *create* current_class_ref, so we temporarily clear - current_class_ptr to fool it. */ - current_class_ptr = NULL_TREE; - current_class_ref = build_indirect_ref (t, NULL_PTR); - current_class_ptr = t; - - resume_momentary (i); - if (! hack_decl_function_context (decl1)) - end_temporary_allocation (); - } - else - /* We're having a signature pointer here. */ - current_class_ref = current_class_ptr = t; - - } - } - else - current_class_ptr = current_class_ref = NULL_TREE; - - pushlevel (0); - current_binding_level->parm_flag = 1; - - GNU_xref_function (decl1, current_function_parms); - - if (attrs) - cplus_decl_attributes (decl1, NULL_TREE, attrs); - - make_function_rtl (decl1); - - /* Promote the value to int before returning it. */ - if (C_PROMOTING_INTEGER_TYPE_P (restype)) - restype = type_promotes_to (restype); - - /* If this fcn was already referenced via a block-scope `extern' decl - (or an implicit decl), propagate certain information about the usage. */ - if (TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl1))) - TREE_ADDRESSABLE (decl1) = 1; - - if (DECL_RESULT (decl1) == NULL_TREE) - { - DECL_RESULT (decl1) - = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype)); - TREE_READONLY (DECL_RESULT (decl1)) = CP_TYPE_CONST_P (restype); - TREE_THIS_VOLATILE (DECL_RESULT (decl1)) = CP_TYPE_VOLATILE_P (restype); - } - - /* Allocate further tree nodes temporarily during compilation - of this function only. Tiemann moved up here from bottom of fn. */ - /* If this is a nested function, then we must continue to allocate RTL - on the permanent obstack in case we need to inline it later. */ - if (! hack_decl_function_context (decl1)) - temporary_allocation (); - - if (processing_template_decl) - { - ++minimal_parse_mode; - last_tree = DECL_SAVED_TREE (decl1) - = build_nt (EXPR_STMT, void_zero_node); - } - - ++function_depth; - - if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl1)) - && DECL_LANGUAGE (decl1) == lang_cplusplus) - { - dtor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - ctor_label = NULL_TREE; - } - else - { - dtor_label = NULL_TREE; - if (DECL_CONSTRUCTOR_P (decl1)) - ctor_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - } - - return 1; -} - -/* Called after store_parm_decls for a function-try-block. We need to update - last_parm_cleanup_insn so that the base initializers for a constructor - are run within this block, not before it. */ - -void -expand_start_early_try_stmts () -{ - expand_start_try_stmts (); - last_parm_cleanup_insn = get_last_insn (); -} - -/* Store the parameter declarations into the current function declaration. - This is called after parsing the parameter declarations, before - digesting the body of the function. - - Also install to binding contour return value identifier, if any. */ - -void -store_parm_decls () -{ - register tree fndecl = current_function_decl; - register tree parm; - int parms_have_cleanups = 0; - tree cleanups = NULL_TREE; - - /* This is either a chain of PARM_DECLs (when a prototype is used). */ - tree specparms = current_function_parms; - - /* This is a list of types declared among parms in a prototype. */ - tree parmtags = current_function_parm_tags; - - /* This is a chain of any other decls that came in among the parm - declarations. If a parm is declared with enum {foo, bar} x; - then CONST_DECLs for foo and bar are put here. */ - tree nonparms = NULL_TREE; - - if (toplevel_bindings_p ()) - fatal ("parse errors have confused me too much"); - - /* Initialize RTL machinery. */ - init_function_start (fndecl, input_filename, lineno); - - /* Create a binding level for the parms. */ - expand_start_bindings (0); - - if (specparms != NULL_TREE) - { - /* This case is when the function was defined with an ANSI prototype. - The parms already have decls, so we need not do anything here - except record them as in effect - and complain if any redundant old-style parm decls were written. */ - - register tree next; - - /* Must clear this because it might contain TYPE_DECLs declared - at class level. */ - storedecls (NULL_TREE); - - for (parm = nreverse (specparms); parm; parm = next) - { - next = TREE_CHAIN (parm); - if (TREE_CODE (parm) == PARM_DECL) - { - tree cleanup; - if (DECL_NAME (parm) == NULL_TREE) - { - pushdecl (parm); - } - else if (TREE_CODE (TREE_TYPE (parm)) == VOID_TYPE) - cp_error ("parameter `%D' declared void", parm); - else - { - /* Now fill in DECL_REFERENCE_SLOT for any of the parm decls. - A parameter is assumed not to have any side effects. - If this should change for any reason, then this - will have to wrap the bashed reference type in a save_expr. - - Also, if the parameter type is declared to be an X - and there is an X(X&) constructor, we cannot lay it - into the stack (any more), so we make this parameter - look like it is really of reference type. Functions - which pass parameters to this function will know to - create a temporary in their frame, and pass a reference - to that. */ - - if (TREE_CODE (TREE_TYPE (parm)) == REFERENCE_TYPE - && TYPE_SIZE (TREE_TYPE (TREE_TYPE (parm)))) - SET_DECL_REFERENCE_SLOT (parm, convert_from_reference (parm)); - - pushdecl (parm); - } - if (! processing_template_decl - && (cleanup = maybe_build_cleanup (parm), cleanup)) - { - expand_decl (parm); - parms_have_cleanups = 1; - - /* Keep track of the cleanups. */ - cleanups = tree_cons (parm, cleanup, cleanups); - } - } - else - { - /* If we find an enum constant or a type tag, - put it aside for the moment. */ - TREE_CHAIN (parm) = NULL_TREE; - nonparms = chainon (nonparms, parm); - } - } - - /* Get the decls in their original chain order - and record in the function. This is all and only the - PARM_DECLs that were pushed into scope by the loop above. */ - DECL_ARGUMENTS (fndecl) = getdecls (); - - storetags (chainon (parmtags, gettags ())); - } - else - DECL_ARGUMENTS (fndecl) = NULL_TREE; - - /* Now store the final chain of decls for the arguments - as the decl-chain of the current lexical scope. - Put the enumerators in as well, at the front so that - DECL_ARGUMENTS is not modified. */ - - storedecls (chainon (nonparms, DECL_ARGUMENTS (fndecl))); - - /* Declare __FUNCTION__ and __PRETTY_FUNCTION__ for this function. */ - declare_function_name (); - - /* Initialize the RTL code for the function. */ - DECL_SAVED_INSNS (fndecl) = NULL_RTX; - if (! processing_template_decl) - expand_function_start (fndecl, parms_have_cleanups); - - current_function_parms_stored = 1; - - /* If this function is `main', emit a call to `__main' - to run global initializers, etc. */ - if (DECL_MAIN_P (fndecl)) - expand_main_function (); - - /* Now that we have initialized the parms, we can start their - cleanups. We cannot do this before, since expand_decl_cleanup - should not be called before the parm can be used. */ - if (cleanups - && ! processing_template_decl) - { - for (cleanups = nreverse (cleanups); cleanups; cleanups = TREE_CHAIN (cleanups)) - { - if (! expand_decl_cleanup (TREE_PURPOSE (cleanups), TREE_VALUE (cleanups))) - cp_error ("parser lost in parsing declaration of `%D'", - TREE_PURPOSE (cleanups)); - } - } - - /* Create a binding contour which can be used to catch - cleanup-generated temporaries. Also, if the return value needs or - has initialization, deal with that now. */ - if (parms_have_cleanups) - { - pushlevel (0); - expand_start_bindings (0); - } - - if (! processing_template_decl && flag_exceptions) - { - /* Do the starting of the exception specifications, if we have any. */ - if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (current_function_decl))) - expand_start_eh_spec (); - } - - last_parm_cleanup_insn = get_last_insn (); - last_dtor_insn = get_last_insn (); -} - -/* Bind a name and initialization to the return value of - the current function. */ - -void -store_return_init (return_id, init) - tree return_id, init; -{ - tree decl = DECL_RESULT (current_function_decl); - - if (pedantic) - /* Give this error as many times as there are occurrences, - so that users can use Emacs compilation buffers to find - and fix all such places. */ - pedwarn ("ANSI C++ does not permit named return values"); - - if (return_id != NULL_TREE) - { - if (DECL_NAME (decl) == NULL_TREE) - { - DECL_NAME (decl) = return_id; - DECL_ASSEMBLER_NAME (decl) = return_id; - } - else - cp_error ("return identifier `%D' already in place", decl); - } - - /* Can't let this happen for constructors. */ - if (DECL_CONSTRUCTOR_P (current_function_decl)) - { - error ("can't redefine default return value for constructors"); - return; - } - - /* If we have a named return value, put that in our scope as well. */ - if (DECL_NAME (decl) != NULL_TREE) - { - /* If this named return value comes in a register, - put it in a pseudo-register. */ - if (DECL_REGISTER (decl)) - { - original_result_rtx = DECL_RTL (decl); - DECL_RTL (decl) = gen_reg_rtx (DECL_MODE (decl)); - } - - /* Let `cp_finish_decl' know that this initializer is ok. */ - DECL_INITIAL (decl) = init; - pushdecl (decl); - - if (minimal_parse_mode) - add_tree (build_min_nt (RETURN_INIT, return_id, - copy_to_permanent (init))); - else - cp_finish_decl (decl, init, NULL_TREE, 0, 0); - } -} - - -/* Emit implicit code for a destructor. This is a subroutine of - finish_function. */ - -static void -finish_dtor () -{ - tree binfo = TYPE_BINFO (current_class_type); - tree cond = integer_one_node; - tree exprstmt; - tree in_charge_node = lookup_name (in_charge_identifier, 0); - tree virtual_size; - int ok_to_optimize_dtor = 0; - int empty_dtor = get_last_insn () == last_dtor_insn; - rtx insns, last_parm_insn; - - if (current_function_assigns_this) - cond = build (NE_EXPR, boolean_type_node, - current_class_ptr, integer_zero_node); - else - { - int n_baseclasses = CLASSTYPE_N_BASECLASSES (current_class_type); - - /* If this destructor is empty, then we don't need to check - whether `this' is NULL in some cases. */ - if ((flag_this_is_variable & 1) == 0) - ok_to_optimize_dtor = 1; - else if (empty_dtor) - ok_to_optimize_dtor - = (n_baseclasses == 0 - || (n_baseclasses == 1 - && TYPE_HAS_DESTRUCTOR (TYPE_BINFO_BASETYPE (current_class_type, 0)))); - } - - /* If this has a vlist1 parameter, allocate the corresponding vlist - parameter. */ - if (DECL_DESTRUCTOR_FOR_PVBASE_P (current_function_decl)) - { - /* _Vlist __vlist; */ - tree vlist; - - mark_all_temps_used(); - vlist = pushdecl (build_decl (VAR_DECL, vlist_identifier, - vlist_type_node)); - TREE_USED (vlist) = 1; - DECL_ARTIFICIAL (vlist) = 1; - expand_decl (vlist); - expand_decl_init (vlist); - } - - /* These initializations might go inline. Protect - the binding level of the parms. */ - pushlevel (0); - expand_start_bindings (0); - - if (current_function_assigns_this) - { - current_function_assigns_this = 0; - current_function_just_assigned_this = 0; - } - - /* Generate the code to call destructor on base class. - If this destructor belongs to a class with virtual - functions, then set the virtual function table - pointer to represent the type of our base class. */ - - /* This side-effect makes call to `build_delete' generate the - code we have to have at the end of this destructor. - `build_delete' will set the flag again. */ - TYPE_HAS_DESTRUCTOR (current_class_type) = 0; - - /* These are two cases where we cannot delegate deletion. */ - if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type) - || TYPE_GETS_REG_DELETE (current_class_type)) - exprstmt = build_delete - (current_class_type, current_class_ref, integer_zero_node, - LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0); - else - exprstmt = build_delete - (current_class_type, current_class_ref, in_charge_node, - LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0); - - /* If we did not assign to this, then `this' is non-zero at - the end of a destructor. As a special optimization, don't - emit test if this is an empty destructor. If it does nothing, - it does nothing. If it calls a base destructor, the base - destructor will perform the test. */ - - if (exprstmt != error_mark_node - && (TREE_CODE (exprstmt) != NOP_EXPR - || TREE_OPERAND (exprstmt, 0) != integer_zero_node - || TYPE_USES_VIRTUAL_BASECLASSES (current_class_type))) - { - expand_label (dtor_label); - if (cond != integer_one_node) - expand_start_cond (cond, 0); - if (exprstmt != void_zero_node) - /* Don't call `expand_expr_stmt' if we're not going to do - anything, since -Wall will give a diagnostic. */ - expand_expr_stmt (exprstmt); - - /* Run destructor on all virtual baseclasses. */ - if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)) - { - tree vbases = nreverse - (copy_list (CLASSTYPE_VBASECLASSES (current_class_type))); - expand_start_cond (build (BIT_AND_EXPR, integer_type_node, - in_charge_node, integer_two_node), 0); - while (vbases) - { - if (TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (vbases))) - { - tree vb = get_vbase - (BINFO_TYPE (vbases), - TYPE_BINFO (current_class_type)); - - expand_expr_stmt - (build_base_dtor_call (current_class_ref, - vb, integer_zero_node)); - } - vbases = TREE_CHAIN (vbases); - } - expand_end_cond (); - } - - do_pending_stack_adjust (); - if (cond != integer_one_node) - expand_end_cond (); - } - - virtual_size = c_sizeof (current_class_type); - - /* At the end, call delete if that's what's requested. */ - - /* FDIS sez: At the point of definition of a virtual destructor - (including an implicit definition), non-placement operator - delete shall be looked up in the scope of the destructor's - class and if found shall be accessible and unambiguous. - - This is somewhat unclear, but I take it to mean that if the - class only defines placement deletes we don't do anything here. - So we pass LOOKUP_SPECULATIVELY; delete_sanity will complain - for us if they ever try to delete one of these. */ - - if (TYPE_GETS_REG_DELETE (current_class_type) - || TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)) - exprstmt = build_op_delete_call - (DELETE_EXPR, current_class_ptr, virtual_size, - LOOKUP_NORMAL | LOOKUP_SPECULATIVELY, NULL_TREE); - else - exprstmt = NULL_TREE; - - if (exprstmt) - { - cond = build (BIT_AND_EXPR, integer_type_node, - in_charge_node, integer_one_node); - expand_start_cond (cond, 0); - expand_expr_stmt (exprstmt); - expand_end_cond (); - } - - /* End of destructor. */ - expand_end_bindings (NULL_TREE, getdecls () != NULL_TREE, 0); - poplevel (getdecls () != NULL_TREE, 0, 0); - - /* Back to the top of destructor. */ - /* Don't execute destructor code if `this' is NULL. */ - - start_sequence (); - - /* If we need thunk-style vlists, initialize them if the caller did - not pass them. This requires a new temporary. The generated code - looks like - if (!(__in_charge & 4)) - __vlist = __vl. + sizeof(__vl.); - else - __vlist = __vlist1; - */ - if (TYPE_USES_PVBASES (current_class_type)) - { - tree vlist = lookup_name (vlist_identifier, 0); - tree vlist1 = lookup_name (get_identifier (VLIST1_NAME), 0); - cond = build (BIT_AND_EXPR, integer_type_node, - in_charge_node, build_int_2 (4, 0)); - cond = build1 (TRUTH_NOT_EXPR, boolean_type_node, cond); - expand_start_cond (cond, 0); - init_vlist (current_class_type); - expand_start_else (); - expand_expr_stmt (build_modify_expr (vlist, NOP_EXPR, vlist1)); - expand_end_cond (); - } - - /* If the dtor is empty, and we know there is not possible way we - could use any vtable entries, before they are possibly set by - a base class dtor, we don't have to setup the vtables, as we - know that any base class dtoring will set up any vtables it - needs. We avoid MI, because one base class dtor can do a - virtual dispatch to an overridden function that would need to - have a non-related vtable set up, we cannot avoid setting up - vtables in that case. We could change this to see if there is - just one vtable. */ - if (! empty_dtor || TYPE_USES_COMPLEX_INHERITANCE (current_class_type)) - { - /* Make all virtual function table pointers in non-virtual base - classes point to CURRENT_CLASS_TYPE's virtual function - tables. */ - expand_direct_vtbls_init (binfo, binfo, 1, 0, current_class_ptr); - - if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)) - expand_indirect_vtbls_init (binfo, current_class_ref, current_class_ptr); - } - - if (! ok_to_optimize_dtor) - { - cond = build_binary_op (NE_EXPR, - current_class_ptr, integer_zero_node); - expand_start_cond (cond, 0); - } - - insns = get_insns (); - end_sequence (); - - last_parm_insn = get_first_nonparm_insn (); - if (last_parm_insn == NULL_RTX) - last_parm_insn = get_last_insn (); - else - last_parm_insn = previous_insn (last_parm_insn); - - emit_insns_after (insns, last_parm_insn); - - if (! ok_to_optimize_dtor) - expand_end_cond (); -} - -/* Emit implicit code for a constructor. This is a subroutine of - finish_function. CALL_POPLEVEL is the same variable in - finish_function. */ - -static void -finish_ctor (call_poplevel) - int call_poplevel; -{ - register tree fndecl = current_function_decl; - tree cond = NULL_TREE, thenclause = NULL_TREE; - rtx insns; - tree decls; - - /* Allow constructor for a type to get a new instance of the object - using `build_new'. */ - tree abstract_virtuals = CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type); - CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type) = NULL_TREE; - - if (flag_this_is_variable > 0) - { - cond = build_binary_op (EQ_EXPR, current_class_ptr, integer_zero_node); - thenclause = - build_modify_expr (current_class_ptr, NOP_EXPR, - build_new (NULL_TREE, current_class_type, - void_type_node, 0)); - } - - CLASSTYPE_ABSTRACT_VIRTUALS (current_class_type) = abstract_virtuals; - - start_sequence (); - - if (flag_this_is_variable > 0) - { - expand_start_cond (cond, 0); - expand_expr_stmt (thenclause); - expand_end_cond (); - } - - /* Emit insns from `emit_base_init' which sets up virtual - function table pointer(s). */ - if (base_init_expr) - { - expand_expr_stmt (base_init_expr); - base_init_expr = NULL_TREE; - } - - insns = get_insns (); - end_sequence (); - - /* This is where the body of the constructor begins. */ - - emit_insns_after (insns, last_parm_cleanup_insn); - - end_protect_partials (); - - /* This is where the body of the constructor ends. */ - expand_label (ctor_label); - ctor_label = NULL_TREE; - - if (call_poplevel) - { - decls = getdecls (); - expand_end_bindings (decls, decls != NULL_TREE, 0); - poplevel (decls != NULL_TREE, 1, 0); - } - - /* c_expand_return knows to return 'this' from a constructor. */ - c_expand_return (NULL_TREE); - - current_function_assigns_this = 0; - current_function_just_assigned_this = 0; -} - - -/* Finish up a function declaration and compile that function - all the way to assembler language output. The free the storage - for the function definition. - - This is called after parsing the body of the function definition. - LINENO is the current line number. - - FLAGS is a bitwise or of the following values: - 1 - CALL_POPLEVEL - An extra call to poplevel (and expand_end_bindings) must be - made to take care of the binding contour for the base - initializers. This is only relevant for constructors. - 2 - INCLASS_INLINE - We just finished processing the body of an in-class inline - function definition. (This processing will have taken place - after the class definition is complete.) - - NESTED is nonzero if we were in the middle of compiling another function - when we started on this one. */ - -void -finish_function (lineno, flags, nested) - int lineno; - int flags; - int nested; -{ - register tree fndecl = current_function_decl; - tree fntype, ctype = NULL_TREE; - /* Label to use if this function is supposed to return a value. */ - tree no_return_label = NULL_TREE; - tree decls = NULL_TREE; - int call_poplevel = (flags & 1) != 0; - int inclass_inline = (flags & 2) != 0; - int in_template; - - /* When we get some parse errors, we can end up without a - current_function_decl, so cope. */ - if (fndecl == NULL_TREE) - return; - - if (function_depth > 1) - nested = 1; - - fntype = TREE_TYPE (fndecl); - -/* TREE_READONLY (fndecl) = 1; - This caused &foo to be of type ptr-to-const-function - which then got a warning when stored in a ptr-to-function variable. */ - - /* This happens on strange parse errors. */ - if (! current_function_parms_stored) - { - call_poplevel = 0; - store_parm_decls (); - } - - if (processing_template_decl) - { - if (DECL_CONSTRUCTOR_P (fndecl) && call_poplevel) - { - decls = getdecls (); - expand_end_bindings (decls, decls != NULL_TREE, 0); - poplevel (decls != NULL_TREE, 0, 0); - } - } - else - { - if (write_symbols != NO_DEBUG /*&& TREE_CODE (fntype) != METHOD_TYPE*/) - { - tree ttype = target_type (fntype); - tree parmdecl; - - if (IS_AGGR_TYPE (ttype)) - /* Let debugger know it should output info for this type. */ - note_debug_info_needed (ttype); - - for (parmdecl = DECL_ARGUMENTS (fndecl); parmdecl; parmdecl = TREE_CHAIN (parmdecl)) - { - ttype = target_type (TREE_TYPE (parmdecl)); - if (IS_AGGR_TYPE (ttype)) - /* Let debugger know it should output info for this type. */ - note_debug_info_needed (ttype); - } - } - - /* Clean house because we will need to reorder insns here. */ - do_pending_stack_adjust (); - - if (dtor_label) - finish_dtor (); - else if (current_function_assigns_this) - { - /* Does not need to call emit_base_init, because - that is done (if needed) just after assignment to this - is seen. */ - - if (DECL_CONSTRUCTOR_P (current_function_decl)) - { - end_protect_partials (); - expand_label (ctor_label); - ctor_label = NULL_TREE; - - if (call_poplevel) - { - decls = getdecls (); - expand_end_bindings (decls, decls != NULL_TREE, 0); - poplevel (decls != NULL_TREE, 0, 0); - } - /* c_expand_return knows to return 'this' from a constructor. */ - c_expand_return (NULL_TREE); - } - else if (TREE_CODE (TREE_TYPE (DECL_RESULT (current_function_decl))) != VOID_TYPE - && return_label != NULL_RTX) - no_return_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - - current_function_assigns_this = 0; - current_function_just_assigned_this = 0; - base_init_expr = NULL_TREE; - } - else if (DECL_CONSTRUCTOR_P (fndecl) - && !DECL_VLIST_CTOR_WRAPPER_P (fndecl)) - finish_ctor (call_poplevel); - else if (DECL_MAIN_P (fndecl)) - { - /* Make it so that `main' always returns 0 by default. */ -#ifdef VMS - c_expand_return (integer_one_node); -#else - c_expand_return (integer_zero_node); -#endif - } - else if (return_label != NULL_RTX - && current_function_return_value == NULL_TREE - && ! DECL_NAME (DECL_RESULT (current_function_decl))) - no_return_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - - if (flag_exceptions) - expand_exception_blocks (); - - /* If this function is supposed to return a value, ensure that - we do not fall into the cleanups by mistake. The end of our - function will look like this: - - user code (may have return stmt somewhere) - goto no_return_label - cleanup_label: - cleanups - goto return_label - no_return_label: - NOTE_INSN_FUNCTION_END - return_label: - things for return - - If the user omits a return stmt in the USER CODE section, we - will have a control path which reaches NOTE_INSN_FUNCTION_END. - Otherwise, we won't. */ - if (no_return_label) - { - DECL_CONTEXT (no_return_label) = fndecl; - DECL_INITIAL (no_return_label) = error_mark_node; - DECL_SOURCE_FILE (no_return_label) = input_filename; - DECL_SOURCE_LINE (no_return_label) = lineno; - expand_goto (no_return_label); - } - - if (cleanup_label) - { - /* Remove the binding contour which is used - to catch cleanup-generated temporaries. */ - expand_end_bindings (0, 0, 0); - poplevel (0, 0, 0); - - /* Emit label at beginning of cleanup code for parameters. */ - emit_label (cleanup_label); - } - - /* Get return value into register if that's where it's supposed to be. */ - if (original_result_rtx) - fixup_result_decl (DECL_RESULT (fndecl), original_result_rtx); - - /* Finish building code that will trigger warnings if users forget - to make their functions return values. */ - if (no_return_label || cleanup_label) - emit_jump (return_label); - if (no_return_label) - { - /* We don't need to call `expand_*_return' here because we - don't need any cleanups here--this path of code is only - for error checking purposes. */ - expand_label (no_return_label); - } - - /* Generate rtl for function exit. */ - expand_function_end (input_filename, lineno, 1); - } - - /* If we're processing a template, squirrel away the definition - until we do an instantiation. */ - if (processing_template_decl) - { - --minimal_parse_mode; - DECL_SAVED_TREE (fndecl) = TREE_CHAIN (DECL_SAVED_TREE (fndecl)); - /* We have to save this value here in case - maybe_end_member_template_processing decides to pop all the - template parameters. */ - in_template = 1; - } - else - in_template = 0; - - /* This must come after expand_function_end because cleanups might - have declarations (from inline functions) that need to go into - this function's blocks. */ - if (current_binding_level->parm_flag != 1) - my_friendly_abort (122); - poplevel (1, 0, 1); - - /* If this is a in-class inline definition, we may have to pop the - bindings for the template parameters that we added in - maybe_begin_member_template_processing when start_function was - called. */ - if (inclass_inline) - maybe_end_member_template_processing (); - - /* Reset scope for C++: if we were in the scope of a class, - then when we finish this function, we are not longer so. - This cannot be done until we know for sure that no more - class members will ever be referenced in this function - (i.e., calls to destructors). */ - if (current_class_name) - { - ctype = current_class_type; - pop_nested_class (); - } - - /* Must mark the RESULT_DECL as being in this function. */ - DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl; - - /* Set the BLOCK_SUPERCONTEXT of the outermost function scope to point - to the FUNCTION_DECL node itself. */ - BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl; - - if (!in_template) - { - int saved_flag_keep_inline_functions = - flag_keep_inline_functions; - - /* So we can tell if jump_optimize sets it to 1. */ - can_reach_end = 0; - - if (DECL_CONTEXT (fndecl) != NULL_TREE - && hack_decl_function_context (fndecl)) - /* Trick rest_of_compilation into not deferring output of this - function, even if it is inline, since the rtl_obstack for - this function is the function_obstack of the enclosing - function and will be deallocated when the enclosing - function is gone. See save_tree_status. */ - flag_keep_inline_functions = 1; - - /* Run the optimizers and output the assembler code for this - function. */ - - if (DECL_ARTIFICIAL (fndecl)) - { - /* Do we really *want* to inline this synthesized method? */ - - int save_fif = flag_inline_functions; - flag_inline_functions = 1; - - /* Turn off DECL_INLINE for the moment so function_cannot_inline_p - will check our size. */ - DECL_INLINE (fndecl) = 0; - - rest_of_compilation (fndecl); - flag_inline_functions = save_fif; - } - else - rest_of_compilation (fndecl); - - flag_keep_inline_functions = saved_flag_keep_inline_functions; - - if (DECL_SAVED_INSNS (fndecl) && ! TREE_ASM_WRITTEN (fndecl)) - { - /* Set DECL_EXTERNAL so that assemble_external will be called as - necessary. We'll clear it again in finish_file. */ - if (! DECL_EXTERNAL (fndecl)) - DECL_NOT_REALLY_EXTERN (fndecl) = 1; - DECL_EXTERNAL (fndecl) = 1; - mark_inline_for_output (fndecl); - } - - if (ctype && TREE_ASM_WRITTEN (fndecl)) - note_debug_info_needed (ctype); - - current_function_returns_null |= can_reach_end; - - /* Since we don't normally go through c_expand_return for constructors, - this normally gets the wrong value. - Also, named return values have their return codes emitted after - NOTE_INSN_FUNCTION_END, confusing jump.c. */ - if (DECL_CONSTRUCTOR_P (fndecl) - || DECL_NAME (DECL_RESULT (fndecl)) != NULL_TREE) - current_function_returns_null = 0; - - if (TREE_THIS_VOLATILE (fndecl) && current_function_returns_null) - cp_warning ("`noreturn' function `%D' does return", fndecl); - else if ((warn_return_type || pedantic) - && current_function_returns_null - && TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE) - { - /* If this function returns non-void and control can drop through, - complain. */ - cp_warning ("control reaches end of non-void function `%D'", fndecl); - } - /* With just -W, complain only if function returns both with - and without a value. */ - else if (extra_warnings - && current_function_returns_value && current_function_returns_null) - warning ("this function may return with or without a value"); - } - - --function_depth; - - /* Free all the tree nodes making up this function. */ - /* Switch back to allocating nodes permanently - until we start another function. */ - if (! nested) - permanent_allocation (1); - - if (DECL_SAVED_INSNS (fndecl) == NULL_RTX) - { - tree t; - - /* Stop pointing to the local nodes about to be freed. */ - /* But DECL_INITIAL must remain nonzero so we know this - was an actual function definition. */ - DECL_INITIAL (fndecl) = error_mark_node; - for (t = DECL_ARGUMENTS (fndecl); t; t = TREE_CHAIN (t)) - DECL_RTL (t) = DECL_INCOMING_RTL (t) = NULL_RTX; - } - - if (DECL_STATIC_CONSTRUCTOR (fndecl)) - static_ctors = perm_tree_cons (NULL_TREE, fndecl, static_ctors); - if (DECL_STATIC_DESTRUCTOR (fndecl)) - static_dtors = perm_tree_cons (NULL_TREE, fndecl, static_dtors); - - if (! nested) - { - /* Let the error reporting routines know that we're outside a - function. For a nested function, this value is used in - pop_cp_function_context and then reset via pop_function_context. */ - current_function_decl = NULL_TREE; - } - - named_label_uses = NULL; - current_class_ptr = NULL_TREE; - current_class_ref = NULL_TREE; -} - -/* Create the FUNCTION_DECL for a function definition. - DECLSPECS and DECLARATOR are the parts of the declaration; - they describe the return type and the name of the function, - but twisted together in a fashion that parallels the syntax of C. - - This function creates a binding context for the function body - as well as setting up the FUNCTION_DECL in current_function_decl. - - Returns a FUNCTION_DECL on success. - - If the DECLARATOR is not suitable for a function (it defines a datum - instead), we return 0, which tells yyparse to report a parse error. - - May return void_type_node indicating that this method is actually - a friend. See grokfield for more details. - - Came here with a `.pushlevel' . - - DO NOT MAKE ANY CHANGES TO THIS CODE WITHOUT MAKING CORRESPONDING - CHANGES TO CODE IN `grokfield'. */ - -tree -start_method (declspecs, declarator, attrlist) - tree declarator, declspecs, attrlist; -{ - tree fndecl = grokdeclarator (declarator, declspecs, MEMFUNCDEF, 0, - attrlist); - - /* Something too ugly to handle. */ - if (fndecl == NULL_TREE) - return NULL_TREE; - - /* Pass friends other than inline friend functions back. */ - if (fndecl == void_type_node) - return fndecl; - - if (TREE_CODE (fndecl) != FUNCTION_DECL) - /* Not a function, tell parser to report parse error. */ - return NULL_TREE; - - if (IS_SIGNATURE (current_class_type)) - IS_DEFAULT_IMPLEMENTATION (fndecl) = 1; - - if (DECL_IN_AGGR_P (fndecl)) - { - if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (fndecl)) != current_class_type) - { - if (DECL_CONTEXT (fndecl) - && TREE_CODE( DECL_CONTEXT (fndecl)) != NAMESPACE_DECL) - cp_error ("`%D' is already defined in class %s", fndecl, - TYPE_NAME_STRING (DECL_CONTEXT (fndecl))); - } - return void_type_node; - } - - check_template_shadow (fndecl); - - DECL_THIS_INLINE (fndecl) = 1; - - if (flag_default_inline) - DECL_INLINE (fndecl) = 1; - - /* We process method specializations in finish_struct_1. */ - if (processing_template_decl && !DECL_TEMPLATE_SPECIALIZATION (fndecl)) - fndecl = push_template_decl (fndecl); - - /* We read in the parameters on the maybepermanent_obstack, - but we won't be getting back to them until after we - may have clobbered them. So the call to preserve_data - will keep them safe. */ - preserve_data (); - - if (! DECL_FRIEND_P (fndecl)) - { - if (TREE_CHAIN (fndecl)) - { - fndecl = copy_node (fndecl); - TREE_CHAIN (fndecl) = NULL_TREE; - } - - if (DECL_CONSTRUCTOR_P (fndecl)) - { - if (! grok_ctor_properties (current_class_type, fndecl)) - return void_type_node; - } - else if (IDENTIFIER_OPNAME_P (DECL_NAME (fndecl))) - grok_op_properties (fndecl, DECL_VIRTUAL_P (fndecl), 0); - } - - cp_finish_decl (fndecl, NULL_TREE, NULL_TREE, 0, 0); - - /* Make a place for the parms */ - pushlevel (0); - current_binding_level->parm_flag = 1; - - DECL_IN_AGGR_P (fndecl) = 1; - return fndecl; -} - -/* Go through the motions of finishing a function definition. - We don't compile this method until after the whole class has - been processed. - - FINISH_METHOD must return something that looks as though it - came from GROKFIELD (since we are defining a method, after all). - - This is called after parsing the body of the function definition. - STMTS is the chain of statements that makes up the function body. - - DECL is the ..._DECL that `start_method' provided. */ - -tree -finish_method (decl) - tree decl; -{ - register tree fndecl = decl; - tree old_initial; - - register tree link; - - if (decl == void_type_node) - return decl; - - old_initial = DECL_INITIAL (fndecl); - - /* Undo the level for the parms (from start_method). - This is like poplevel, but it causes nothing to be - saved. Saving information here confuses symbol-table - output routines. Besides, this information will - be correctly output when this method is actually - compiled. */ - - /* Clear out the meanings of the local variables of this level; - also record in each decl which block it belongs to. */ - - for (link = current_binding_level->names; link; link = TREE_CHAIN (link)) - { - if (DECL_NAME (link) != NULL_TREE) - pop_binding (DECL_NAME (link), link); - my_friendly_assert (TREE_CODE (link) != FUNCTION_DECL, 163); - DECL_CONTEXT (link) = NULL_TREE; - } - - GNU_xref_end_scope ((HOST_WIDE_INT) current_binding_level, - (HOST_WIDE_INT) current_binding_level->level_chain, - current_binding_level->parm_flag, - current_binding_level->keep); - - poplevel (0, 0, 0); - - DECL_INITIAL (fndecl) = old_initial; - - /* We used to check if the context of FNDECL was different from - current_class_type as another way to get inside here. This didn't work - for String.cc in libg++. */ - if (DECL_FRIEND_P (fndecl)) - { - CLASSTYPE_INLINE_FRIENDS (current_class_type) - = tree_cons (NULL_TREE, fndecl, CLASSTYPE_INLINE_FRIENDS (current_class_type)); - decl = void_type_node; - } - - return decl; -} - -/* Called when a new struct TYPE is defined. - If this structure or union completes the type of any previous - variable declaration, lay it out and output its rtl. */ - -void -hack_incomplete_structures (type) - tree type; -{ - tree *list; - - if (current_binding_level->incomplete == NULL_TREE) - return; - - if (!type) /* Don't do this for class templates. */ - return; - - for (list = ¤t_binding_level->incomplete; *list; ) - { - tree decl = TREE_VALUE (*list); - if ((decl && TREE_TYPE (decl) == type) - || (TREE_TYPE (decl) - && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE - && TREE_TYPE (TREE_TYPE (decl)) == type)) - { - int toplevel = toplevel_bindings_p (); - if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE - && TREE_TYPE (TREE_TYPE (decl)) == type) - layout_type (TREE_TYPE (decl)); - layout_decl (decl, 0); - rest_of_decl_compilation (decl, NULL_PTR, toplevel, 0); - if (! toplevel) - { - tree cleanup; - expand_decl (decl); - cleanup = maybe_build_cleanup (decl); - expand_decl_init (decl); - if (! expand_decl_cleanup (decl, cleanup)) - cp_error ("parser lost in parsing declaration of `%D'", - decl); - } - *list = TREE_CHAIN (*list); - } - else - list = &TREE_CHAIN (*list); - } -} - -/* If DECL is of a type which needs a cleanup, build that cleanup here. - See build_delete for information about AUTO_DELETE. - - Don't build these on the momentary obstack; they must live - the life of the binding contour. */ - -static tree -maybe_build_cleanup_1 (decl, auto_delete) - tree decl, auto_delete; -{ - tree type = TREE_TYPE (decl); - if (type != error_mark_node && TYPE_NEEDS_DESTRUCTOR (type)) - { - int temp = 0, flags = LOOKUP_NORMAL|LOOKUP_DESTRUCTOR; - tree rval; - - if (TREE_CODE (decl) != PARM_DECL) - temp = suspend_momentary (); - - if (TREE_CODE (type) == ARRAY_TYPE) - rval = decl; - else - { - mark_addressable (decl); - rval = build_unary_op (ADDR_EXPR, decl, 0); - } - - /* Optimize for space over speed here. */ - if (! TYPE_USES_VIRTUAL_BASECLASSES (type) - || flag_expensive_optimizations) - flags |= LOOKUP_NONVIRTUAL; - - rval = build_delete (TREE_TYPE (rval), rval, auto_delete, flags, 0); - - if (TYPE_USES_VIRTUAL_BASECLASSES (type) - && ! TYPE_HAS_DESTRUCTOR (type)) - rval = build_compound_expr (expr_tree_cons (NULL_TREE, rval, - build_expr_list (NULL_TREE, build_vbase_delete (type, decl)))); - - if (TREE_CODE (decl) != PARM_DECL) - resume_momentary (temp); - - return rval; - } - return 0; -} - -/* If DECL is of a type which needs a cleanup, build that cleanup - here. The cleanup does free the storage with a call to delete. */ - -tree -maybe_build_cleanup_and_delete (decl) - tree decl; -{ - return maybe_build_cleanup_1 (decl, integer_three_node); -} - -/* If DECL is of a type which needs a cleanup, build that cleanup - here. The cleanup does not free the storage with a call a delete. */ - -tree -maybe_build_cleanup (decl) - tree decl; -{ - return maybe_build_cleanup_1 (decl, integer_two_node); -} - -/* Expand a C++ expression at the statement level. - This is needed to ferret out nodes which have UNKNOWN_TYPE. - The C++ type checker should get all of these out when - expressions are combined with other, type-providing, expressions, - leaving only orphan expressions, such as: - - &class::bar; / / takes its address, but does nothing with it. */ - -void -cplus_expand_expr_stmt (exp) - tree exp; -{ - if (processing_template_decl) - { - add_tree (build_min_nt (EXPR_STMT, exp)); - return; - } - - /* Arrange for all temps to disappear. */ - expand_start_target_temps (); - - exp = require_complete_type_in_void (exp); - - if (TREE_CODE (exp) == FUNCTION_DECL) - { - cp_warning ("reference, not call, to function `%D'", exp); - warning ("at this point in file"); - } - -#if 0 - /* We should do this eventually, but right now this causes regex.o from - libg++ to miscompile, and tString to core dump. */ - exp = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp); -#endif - - /* Strip unused implicit INDIRECT_REFs of references. */ - if (TREE_CODE (exp) == INDIRECT_REF - && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == REFERENCE_TYPE) - exp = TREE_OPERAND (exp, 0); - - /* If we don't do this, we end up down inside expand_expr - trying to do TYPE_MODE on the ERROR_MARK, and really - go outside the bounds of the type. */ - if (exp != error_mark_node) - expand_expr_stmt (break_out_cleanups (exp)); - - /* Clean up any pending cleanups. This happens when a function call - returns a cleanup-needing value that nobody uses. */ - expand_end_target_temps (); -} - -/* When a stmt has been parsed, this function is called. - - Currently, this function only does something within a - constructor's scope: if a stmt has just assigned to this, - and we are in a derived class, we call `emit_base_init'. */ - -void -finish_stmt () -{ - extern struct nesting *cond_stack, *loop_stack, *case_stack; - - - if (current_function_assigns_this - || ! current_function_just_assigned_this) - return; - if (DECL_CONSTRUCTOR_P (current_function_decl)) - { - /* Constructors must wait until we are out of control - zones before calling base constructors. */ - if (cond_stack || loop_stack || case_stack) - return; - expand_expr_stmt (base_init_expr); - check_base_init (current_class_type); - } - current_function_assigns_this = 1; -} - -/* Change a static member function definition into a FUNCTION_TYPE, instead - of the METHOD_TYPE that we create when it's originally parsed. - - WARNING: DO NOT pass &TREE_TYPE (decl) to FN or &TYPE_ARG_TYPES - (TREE_TYPE (decl)) to ARGTYPES, as doing so will corrupt the types of - other decls. Either pass the addresses of local variables or NULL. */ - -void -revert_static_member_fn (decl, fn, argtypes) - tree *decl, *fn, *argtypes; -{ - tree tmp; - tree function = fn ? *fn : TREE_TYPE (*decl); - tree args = argtypes ? *argtypes : TYPE_ARG_TYPES (function); - - if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args))) - != TYPE_UNQUALIFIED) - cp_error ("static member function `%#D' declared with type qualifiers", - *decl); - - args = TREE_CHAIN (args); - tmp = build_function_type (TREE_TYPE (function), args); - tmp = build_qualified_type (tmp, CP_TYPE_QUALS (function)); - tmp = build_exception_variant (tmp, - TYPE_RAISES_EXCEPTIONS (function)); - TREE_TYPE (*decl) = tmp; - if (DECL_ARGUMENTS (*decl)) - DECL_ARGUMENTS (*decl) = TREE_CHAIN (DECL_ARGUMENTS (*decl)); - DECL_STATIC_FUNCTION_P (*decl) = 1; - if (fn) - *fn = tmp; - if (argtypes) - *argtypes = args; -} - -struct cp_function -{ - int returns_value; - int returns_null; - int assigns_this; - int just_assigned_this; - int parms_stored; - int temp_name_counter; - tree named_labels; - struct named_label_list *named_label_uses; - tree shadowed_labels; - tree ctor_label; - tree dtor_label; - rtx last_dtor_insn; - rtx last_parm_cleanup_insn; - tree base_init_list; - tree member_init_list; - tree base_init_expr; - tree current_class_ptr; - tree current_class_ref; - rtx result_rtx; - struct cp_function *next; - struct binding_level *binding_level; - int static_labelno; -}; - -static struct cp_function *cp_function_chain; - -extern int temp_name_counter; - -/* Save and reinitialize the variables - used during compilation of a C++ function. */ - -void -push_cp_function_context (context) - tree context; -{ - struct cp_function *p - = (struct cp_function *) xmalloc (sizeof (struct cp_function)); - - push_function_context_to (context); - - p->next = cp_function_chain; - cp_function_chain = p; - - p->named_labels = named_labels; - p->named_label_uses = named_label_uses; - p->shadowed_labels = shadowed_labels; - p->returns_value = current_function_returns_value; - p->returns_null = current_function_returns_null; - p->binding_level = current_binding_level; - p->ctor_label = ctor_label; - p->dtor_label = dtor_label; - p->last_dtor_insn = last_dtor_insn; - p->last_parm_cleanup_insn = last_parm_cleanup_insn; - p->assigns_this = current_function_assigns_this; - p->just_assigned_this = current_function_just_assigned_this; - p->parms_stored = current_function_parms_stored; - p->result_rtx = original_result_rtx; - p->base_init_expr = base_init_expr; - p->temp_name_counter = temp_name_counter; - p->base_init_list = current_base_init_list; - p->member_init_list = current_member_init_list; - p->current_class_ptr = current_class_ptr; - p->current_class_ref = current_class_ref; - p->static_labelno = static_labelno; -} - -/* Restore the variables used during compilation of a C++ function. */ - -void -pop_cp_function_context (context) - tree context; -{ - struct cp_function *p = cp_function_chain; - tree link; - - /* Bring back all the labels that were shadowed. */ - for (link = shadowed_labels; link; link = TREE_CHAIN (link)) - if (DECL_NAME (TREE_VALUE (link)) != 0) - SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link)), - TREE_VALUE (link)); - - pop_function_context_from (context); - - cp_function_chain = p->next; - - named_labels = p->named_labels; - named_label_uses = p->named_label_uses; - shadowed_labels = p->shadowed_labels; - current_function_returns_value = p->returns_value; - current_function_returns_null = p->returns_null; - current_binding_level = p->binding_level; - ctor_label = p->ctor_label; - dtor_label = p->dtor_label; - last_dtor_insn = p->last_dtor_insn; - last_parm_cleanup_insn = p->last_parm_cleanup_insn; - current_function_assigns_this = p->assigns_this; - current_function_just_assigned_this = p->just_assigned_this; - current_function_parms_stored = p->parms_stored; - original_result_rtx = p->result_rtx; - base_init_expr = p->base_init_expr; - temp_name_counter = p->temp_name_counter; - current_base_init_list = p->base_init_list; - current_member_init_list = p->member_init_list; - current_class_ptr = p->current_class_ptr; - current_class_ref = p->current_class_ref; - static_labelno = p->static_labelno; - - free (p); -} - -int -in_function_p () -{ - return function_depth != 0; -} diff --git a/contrib/gcc/cp/decl.h b/contrib/gcc/cp/decl.h deleted file mode 100644 index fcb247e70202..000000000000 --- a/contrib/gcc/cp/decl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Variables and structures for declaration processing. - Copyright (C) 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* In grokdeclarator, distinguish syntactic contexts of declarators. */ -enum decl_context -{ NORMAL, /* Ordinary declaration */ - FUNCDEF, /* Function definition */ - PARM, /* Declaration of parm before function body */ - CATCHPARM, /* Declaration of catch parm */ - FIELD, /* Declaration inside struct or union */ - BITFIELD, /* Likewise but with specified width */ - TYPENAME, /* Typename (inside cast or sizeof) */ - MEMFUNCDEF /* Member function definition */ -}; - -/* We need this in here to get the decl_context definition. */ -extern tree grokdeclarator PROTO((tree, tree, enum decl_context, int, tree)); - -/* C++: Keep these around to reduce calls to `get_identifier'. - Identifiers for `this' in member functions and the auto-delete - parameter for destructors. */ -extern tree this_identifier, in_charge_identifier; - -/* Parsing a function declarator leaves a list of parameter names - or a chain or parameter decls here. */ -extern tree last_function_parms; - -/* A list of objects which have constructors or destructors - which reside in the global scope. The decl is stored in - the TREE_VALUE slot and the initializer is stored - in the TREE_PURPOSE slot. */ -extern tree static_aggregates; - -#ifdef DEBUG_CP_BINDING_LEVELS -/* Purely for debugging purposes. */ -extern int debug_bindings_indentation; -#endif diff --git a/contrib/gcc/cp/decl2.c b/contrib/gcc/cp/decl2.c deleted file mode 100644 index 069aaaf3fdf3..000000000000 --- a/contrib/gcc/cp/decl2.c +++ /dev/null @@ -1,5379 +0,0 @@ -/* Process declarations and variables for C compiler. - Copyright (C) 1988, 92-98, 1999 Free Software Foundation, Inc. - Hacked by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* Process declarations and symbol lookup for C front end. - Also constructs types; the standard scalar types at initialization, - and structure, union, array and enum types when they are declared. */ - -/* ??? not all decl nodes are given the most useful possible - line numbers. For example, the CONST_DECLs for enum values. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "rtl.h" -#include "flags.h" -#include "cp-tree.h" -#include "decl.h" -#include "lex.h" -#include "output.h" -#include "except.h" -#include "expr.h" -#include "defaults.h" -#include "toplev.h" -#include "dwarf2out.h" -#include "dwarfout.h" -#include "splay-tree.h" -#include "varray.h" - -#if USE_CPPLIB -#include "cpplib.h" -extern cpp_reader parse_in; -#endif - -/* This structure contains information about the initializations - and/or destructions required for a particular priority level. */ -typedef struct priority_info_s { - /* A label indicating where we should generate the next - initialization with this priority. */ - rtx initialization_sequence; - /* A label indicating where we should generate the next destruction - with this priority. */ - rtx destruction_sequence; - /* Non-zero if there have been any initializations at this priority - throughout the translation unit. */ - int initializations_p; - /* Non-zero if there have been any destructions at this priority - throughout the translation unit. */ - int destructions_p; -} *priority_info; - -static tree get_sentry PROTO((tree)); -static void mark_vtable_entries PROTO((tree)); -static void grok_function_init PROTO((tree, tree)); -static int finish_vtable_vardecl PROTO((tree *, void *)); -static int prune_vtable_vardecl PROTO((tree *, void *)); -static int finish_sigtable_vardecl PROTO((tree *, void *)); -static int is_namespace_ancestor PROTO((tree, tree)); -static void add_using_namespace PROTO((tree, tree, int)); -static tree ambiguous_decl PROTO((tree, tree, tree,int)); -static tree build_anon_union_vars PROTO((tree, tree*, int, int)); -static int acceptable_java_type PROTO((tree)); -static void output_vtable_inherit PROTO((tree)); -static void start_objects PROTO((int, int)); -static void finish_objects PROTO((int, int)); -static tree merge_functions PROTO((tree, tree)); -static tree decl_namespace PROTO((tree)); -static tree validate_nonmember_using_decl PROTO((tree, tree *, tree *)); -static void do_nonmember_using_decl PROTO((tree, tree, tree, tree, - tree *, tree *)); -static void start_static_storage_duration_function PROTO((void)); -static int generate_inits_for_priority PROTO((splay_tree_node, void *)); -static void finish_static_storage_duration_function PROTO((void)); -static priority_info get_priority_info PROTO((int)); -static void do_static_initialization PROTO((tree, tree, tree, int)); -static void do_static_destruction PROTO((tree, tree, int)); -static void do_static_initialization_and_destruction PROTO((tree, tree)); -static void generate_ctor_or_dtor_function PROTO((int, int)); -static int generate_ctor_and_dtor_functions_for_priority - PROTO((splay_tree_node, void *)); -extern int current_class_depth; - -/* A list of virtual function tables we must make sure to write out. */ -tree pending_vtables; - -/* A list of static class variables. This is needed, because a - static class variable can be declared inside the class without - an initializer, and then initialized, staticly, outside the class. */ -static varray_type pending_statics; -static size_t pending_statics_used; - -/* A list of functions which were declared inline, but which we - may need to emit outline anyway. */ -static varray_type saved_inlines; -static size_t saved_inlines_used; - -/* Used to help generate temporary names which are unique within - a function. Reset to 0 by start_function. */ - -int temp_name_counter; - -/* Same, but not reset. Local temp variables and global temp variables - can have the same name. */ -static int global_temp_name_counter; - -/* Flag used when debugging spew.c */ - -extern int spew_debug; - -/* Nonzero if we're done parsing and into end-of-file activities. */ - -int at_eof; - -/* Functions called along with real static constructors and destructors. */ - -tree static_ctors, static_dtors; - -/* The current open namespace, and ::. */ - -tree current_namespace; -tree global_namespace; - -/* The stack for namespaces of current declarations. */ - -static tree decl_namespace_list; - - -/* C (and C++) language-specific option variables. */ - -/* Nonzero means allow type mismatches in conditional expressions; - just make their values `void'. */ - -int flag_cond_mismatch; - -/* Nonzero means give `double' the same size as `float'. */ - -int flag_short_double; - -/* Nonzero means don't recognize the keyword `asm'. */ - -int flag_no_asm; - -/* Nonzero means don't recognize any extension keywords. */ - -int flag_no_gnu_keywords; - -/* Nonzero means don't recognize the non-ANSI builtin functions. */ - -int flag_no_builtin; - -/* Nonzero means don't recognize the non-ANSI builtin functions. - -ansi sets this. */ - -int flag_no_nonansi_builtin; - -/* Nonzero means do some things the same way PCC does. Only provided so - the compiler will link. */ - -int flag_traditional; - -/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */ - -int flag_signed_bitfields = 1; - -/* Nonzero means enable obscure ANSI features and disable GNU extensions - that might cause ANSI-compliant code to be miscompiled. */ - -int flag_ansi; - -/* Nonzero means do emit exported implementations of functions even if - they can be inlined. */ - -int flag_implement_inlines = 1; - -/* Nonzero means do emit exported implementations of templates, instead of - multiple static copies in each file that needs a definition. */ - -int flag_external_templates; - -/* Nonzero means that the decision to emit or not emit the implementation of a - template depends on where the template is instantiated, rather than where - it is defined. */ - -int flag_alt_external_templates; - -/* Nonzero means that implicit instantiations will be emitted if needed. */ - -int flag_implicit_templates = 1; - -/* Nonzero means that implicit instantiations of inline templates will be - emitted if needed, even if instantiations of non-inline templates - aren't. */ - -int flag_implicit_inline_templates = 1; - -/* Nonzero means warn about implicit declarations. */ - -int warn_implicit = 1; - -/* Nonzero means warn about usage of long long when `-pedantic'. */ - -int warn_long_long = 1; - -/* Nonzero means warn when all ctors or dtors are private, and the class - has no friends. */ - -int warn_ctor_dtor_privacy = 1; - -/* 1 or 2 if we want to implement vtables using "thunks". - The default is off. Version 1 indicates "old" implementation; - Version 2 passes the __vlist argument in pvbase cases. */ - -#ifndef DEFAULT_VTABLE_THUNKS -#define DEFAULT_VTABLE_THUNKS 0 -#endif -int flag_vtable_thunks = DEFAULT_VTABLE_THUNKS; - -#if DEFAULT_VTABLE_THUNKS == 2 -int flag_vtable_thunks_compat = 1; -#else -int flag_vtable_thunks_compat = 0; -#endif - -/* True if we want to deal with repository information. */ - -int flag_use_repository; - -/* Nonzero if we want to issue diagnostics that the standard says are not - required. */ - -int flag_optional_diags = 1; - -/* Nonzero means give string constants the type `const char *', as mandated - by the standard. */ - -int flag_const_strings = 1; - -/* Nonzero means warn about deprecated conversion from string constant to - `char *'. */ - -int warn_write_strings; - -/* Nonzero means warn about pointer casts that can drop a type qualifier - from the pointer target type. */ - -int warn_cast_qual; - -/* Nonzero means warn about sizeof(function) or addition/subtraction - of function pointers. */ - -int warn_pointer_arith = 1; - -/* Nonzero means warn for any function def without prototype decl. */ - -int warn_missing_prototypes; - -/* Nonzero means warn about multiple (redundant) decls for the same single - variable or function. */ - -int warn_redundant_decls; - -/* Warn if initializer is not completely bracketed. */ - -int warn_missing_braces; - -/* Warn about comparison of signed and unsigned values. */ - -int warn_sign_compare; - -/* Warn about *printf or *scanf format/argument anomalies. */ - -int warn_format; - -/* Warn about a subscript that has type char. */ - -int warn_char_subscripts; - -/* Warn if a type conversion is done that might have confusing results. */ - -int warn_conversion; - -/* Warn if adding () is suggested. */ - -int warn_parentheses; - -/* Non-zero means warn in function declared in derived class has the - same name as a virtual in the base class, but fails to match the - type signature of any virtual function in the base class. */ -int warn_overloaded_virtual; - -/* Non-zero means warn when declaring a class that has a non virtual - destructor, when it really ought to have a virtual one. */ -int warn_nonvdtor; - -/* Non-zero means warn when a function is declared extern and later inline. */ -int warn_extern_inline; - -/* Non-zero means warn when the compiler will reorder code. */ -int warn_reorder; - -/* Non-zero means warn when synthesis behavior differs from Cfront's. */ -int warn_synth; - -/* Non-zero means warn when we convert a pointer to member function - into a pointer to (void or function). */ -int warn_pmf2ptr = 1; - -/* Nonzero means warn about violation of some Effective C++ style rules. */ - -int warn_ecpp; - -/* Nonzero means warn where overload resolution chooses a promotion from - unsigned to signed over a conversion to an unsigned of the same size. */ - -int warn_sign_promo; - -/* Nonzero means warn when an old-style cast is used. */ - -int warn_old_style_cast; - -/* Warn about #pragma directives that are not recognised. */ - -int warn_unknown_pragmas; /* Tri state variable. */ - -/* Nonzero means warn about use of multicharacter literals. */ - -int warn_multichar = 1; - -/* Nonzero means warn when non-templatized friend functions are - declared within a template */ - -int warn_nontemplate_friend = 1; - -/* Nonzero means complain about deprecated features. */ - -int warn_deprecated = 1; - -/* Nonzero means `$' can be in an identifier. */ - -#ifndef DOLLARS_IN_IDENTIFIERS -#define DOLLARS_IN_IDENTIFIERS 1 -#endif -int dollars_in_ident = DOLLARS_IN_IDENTIFIERS; - -/* Nonzero for -fno-strict-prototype switch: do not consider empty - argument prototype to mean function takes no arguments. */ - -int flag_strict_prototype = 2; -int strict_prototype = 1; -int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus = 1; - -/* Nonzero means that labels can be used as first-class objects */ - -int flag_labels_ok; - -/* Non-zero means to collect statistics which might be expensive - and to print them when we are done. */ -int flag_detailed_statistics; - -/* C++ specific flags. */ -/* Zero means that `this' is a *const. This gives nice behavior in the - 2.0 world. 1 gives 1.2-compatible behavior. 2 gives Spring behavior. - -2 means we're constructing an object and it has fixed type. */ - -int flag_this_is_variable; - -/* 3 means write out only virtuals function tables `defined' - in this implementation file. - 0 means write out virtual function tables and give them - (C) static access (default). */ - -int write_virtuals; - -/* Nonzero means we should attempt to elide constructors when possible. */ - -int flag_elide_constructors = 1; - -/* Nonzero means recognize and handle signature language constructs. */ - -int flag_handle_signatures; - -/* Nonzero means that member functions defined in class scope are - inline by default. */ - -int flag_default_inline = 1; - -/* Controls whether compiler generates 'type descriptor' that give - run-time type information. */ -int flag_rtti = 1; - -/* Nonzero if we wish to output cross-referencing information - for the GNU class browser. */ -extern int flag_gnu_xref; - -/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes) - objects. */ - -int flag_huge_objects; - -/* Nonzero if we want to conserve space in the .o files. We do this - by putting uninitialized data and runtime initialized data into - .common instead of .data at the expense of not flagging multiple - definitions. */ - -int flag_conserve_space; - -/* Nonzero if we want to obey access control semantics. */ - -int flag_access_control = 1; - -/* Nonzero if we want to understand the operator names, i.e. 'bitand'. */ - -int flag_operator_names; - -/* Nonzero if we want to check the return value of new and avoid calling - constructors if it is a null pointer. */ - -int flag_check_new; - -/* Nonzero if we want the new ANSI rules for pushing a new scope for `for' - initialization variables. - 0: Old rules, set by -fno-for-scope. - 2: New ANSI rules, set by -ffor-scope. - 1: Try to implement new ANSI rules, but with backup compatibility - (and warnings). This is the default, for now. */ - -int flag_new_for_scope = 1; - -/* Nonzero if we want to emit defined symbols with common-like linkage as - weak symbols where possible, in order to conform to C++ semantics. - Otherwise, emit them as local symbols. */ - -int flag_weak = 1; - -/* Nonzero to enable experimental ABI changes. */ - -int flag_new_abi; - -/* Nonzero to not ignore namespace std. */ - -int flag_honor_std; - -/* Maximum template instantiation depth. Must be at least 17 for ANSI - compliance. */ - -int max_tinst_depth = 17; - -/* The name-mangling scheme to use. Must be 1 or greater to support - template functions with identical types, but different template - arguments. */ -int name_mangling_version = 2; - -/* Nonzero means that guiding declarations are allowed. */ -int flag_guiding_decls; - -/* Nonzero if squashed mangling is to be performed. - This uses the B and K codes to reference previously seen class types - and class qualifiers. */ -int flag_do_squangling; - -/* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */ - -int flag_vtable_gc; - -/* Nonzero means make the default pedwarns warnings instead of errors. - The value of this flag is ignored if -pedantic is specified. */ - -int flag_permissive; - -/* Table of language-dependent -f options. - STRING is the option name. VARIABLE is the address of the variable. - ON_VALUE is the value to store in VARIABLE - if `-fSTRING' is seen as an option. - (If `-fno-STRING' is seen as an option, the opposite value is stored.) */ - -static struct { const char *string; int *variable; int on_value;} -lang_f_options[] = -{ - /* C/C++ options. */ - {"signed-char", &flag_signed_char, 1}, - {"unsigned-char", &flag_signed_char, 0}, - {"signed-bitfields", &flag_signed_bitfields, 1}, - {"unsigned-bitfields", &flag_signed_bitfields, 0}, - {"short-enums", &flag_short_enums, 1}, - {"short-double", &flag_short_double, 1}, - {"cond-mismatch", &flag_cond_mismatch, 1}, - {"asm", &flag_no_asm, 0}, - {"builtin", &flag_no_builtin, 0}, - - /* C++-only options. */ - {"access-control", &flag_access_control, 1}, - {"check-new", &flag_check_new, 1}, - {"conserve-space", &flag_conserve_space, 1}, - {"const-strings", &flag_const_strings, 1}, - {"default-inline", &flag_default_inline, 1}, - {"dollars-in-identifiers", &dollars_in_ident, 1}, - {"elide-constructors", &flag_elide_constructors, 1}, - {"external-templates", &flag_external_templates, 1}, - {"for-scope", &flag_new_for_scope, 2}, - {"gnu-keywords", &flag_no_gnu_keywords, 0}, - {"handle-exceptions", &flag_exceptions, 1}, - {"handle-signatures", &flag_handle_signatures, 1}, - {"honor-std", &flag_honor_std, 1}, - {"huge-objects", &flag_huge_objects, 1}, - {"implement-inlines", &flag_implement_inlines, 1}, - {"implicit-inline-templates", &flag_implicit_inline_templates, 1}, - {"implicit-templates", &flag_implicit_templates, 1}, - {"labels-ok", &flag_labels_ok, 1}, - {"nonansi-builtins", &flag_no_nonansi_builtin, 0}, - {"operator-names", &flag_operator_names, 1}, - {"optional-diags", &flag_optional_diags, 1}, - {"permissive", &flag_permissive, 1}, - {"repo", &flag_use_repository, 1}, - {"rtti", &flag_rtti, 1}, - {"squangle", &flag_do_squangling, 1}, - {"stats", &flag_detailed_statistics, 1}, - {"strict-prototype", &flag_strict_prototype, 1}, - {"this-is-variable", &flag_this_is_variable, 1}, - {"vtable-gc", &flag_vtable_gc, 1}, - {"vtable-thunks", &flag_vtable_thunks, 1}, - {"weak", &flag_weak, 1}, - {"xref", &flag_gnu_xref, 1} -}; - -/* Decode the string P as a language-specific option. - Return the number of strings consumed for a valid option. - Otherwise return 0. */ - -int -lang_decode_option (argc, argv) - int argc -#if !USE_CPPLIB - ATTRIBUTE_UNUSED -#endif - ; - char **argv; - -{ - int strings_processed; - char *p = argv[0]; -#if USE_CPPLIB - strings_processed = cpp_handle_option (&parse_in, argc, argv); -#else - strings_processed = 0; -#endif /* ! USE_CPPLIB */ - - if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) - /* ignore */; - else if (p[0] == '-' && p[1] == 'f') - { - /* Some kind of -f option. - P's value is the option sans `-f'. - Search for it in the table of options. */ - int found = 0; - size_t j; - - p += 2; - /* Try special -f options. */ - - if (!strcmp (p, "handle-exceptions") - || !strcmp (p, "no-handle-exceptions")) - warning ("-fhandle-exceptions has been renamed to -fexceptions (and is now on by default)"); - - if (!strcmp (p, "memoize-lookups") - || !strcmp (p, "no-memoize-lookups") - || !strcmp (p, "save-memoized") - || !strcmp (p, "no-save-memoized") - || !strcmp (p, "no-all-virtual") - || !strcmp (p, "no-enum-int-equiv") - || !strcmp (p, "nonnull-objects") - || !strcmp (p, "ansi-overloading")) - { - /* ignore */ - found = 1; - } - else if (!strcmp (p, "all-virtual") - || !strcmp (p, "enum-int-equiv") - || !strcmp (p, "no-nonnull-objects") - || !strcmp (p, "no-ansi-overloading")) - { - warning ("-f%s is no longer supported", p); - found = 1; - } - else if (! strcmp (p, "alt-external-templates")) - { - flag_external_templates = 1; - flag_alt_external_templates = 1; - found = 1; - cp_deprecated ("-falt-external-templates"); - } - else if (! strcmp (p, "no-alt-external-templates")) - { - flag_alt_external_templates = 0; - found = 1; - } - else if (!strcmp (p, "repo")) - { - flag_use_repository = 1; - flag_implicit_templates = 0; - found = 1; - } - else if (!strcmp (p, "guiding-decls")) - { - flag_guiding_decls = 1; - name_mangling_version = 0; - found = 1; - } - else if (!strcmp (p, "no-guiding-decls")) - { - flag_guiding_decls = 0; - found = 1; - } - else if (!strcmp (p, "this-is-variable")) - { - flag_this_is_variable = 1; - found = 1; - cp_deprecated ("-fthis-is-variable"); - } - else if (!strcmp (p, "external-templates")) - { - flag_external_templates = 1; - found = 1; - cp_deprecated ("-fexternal-templates"); - } - else if (!strncmp (p, "vtable-thunks", 13)) - { - if (p[13] == '=') - { - flag_vtable_thunks = - read_integral_parameter (p+14, p, 1); - } - else - { - /* If the machine file has a default setting, use that - for -fvtable-thunks. Otherwise, set it to version - 2. */ -#if DEFAULT_VTABLE_THUNKS - flag_vtable_thunks = DEFAULT_VTABLE_THUNKS; -#else - flag_vtable_thunks = 1; -#endif - } - if (flag_vtable_thunks == 2) - /* v2 is a compatibility mode between v1 and v3. */ - flag_vtable_thunks_compat = 1; - else if(flag_vtable_thunks == 3) - flag_vtable_thunks_compat = 0; - found = 1; - } - else if (!strcmp (p, "handle-signatures")) - { - flag_handle_signatures = 1; - found = 1; - cp_deprecated ("-fhandle-signatures"); - } - else if (!strcmp (p, "new-abi")) - { - flag_new_abi = 1; - flag_do_squangling = 1; - flag_honor_std = 1; - flag_vtable_thunks = 2; - } - else if (!strcmp (p, "no-new-abi")) - { - flag_new_abi = 0; - flag_do_squangling = 0; - flag_honor_std = 0; - } - else if (!strncmp (p, "template-depth-", 15)) - { - max_tinst_depth = - read_integral_parameter (p + 15, p - 2, max_tinst_depth); - } - else if (!strncmp (p, "name-mangling-version-", 22)) - { - name_mangling_version = - read_integral_parameter (p + 22, p - 2, name_mangling_version); - } - else for (j = 0; - !found && j < sizeof (lang_f_options) / sizeof (lang_f_options[0]); - j++) - { - if (!strcmp (p, lang_f_options[j].string)) - { - *lang_f_options[j].variable = lang_f_options[j].on_value; - /* A goto here would be cleaner, - but breaks the vax pcc. */ - found = 1; - } - if (p[0] == 'n' && p[1] == 'o' && p[2] == '-' - && ! strcmp (p+3, lang_f_options[j].string)) - { - *lang_f_options[j].variable = ! lang_f_options[j].on_value; - found = 1; - } - } - return found; - } - else if (p[0] == '-' && p[1] == 'W') - { - int setting = 1; - - /* The -W options control the warning behavior of the compiler. */ - p += 2; - - if (p[0] == 'n' && p[1] == 'o' && p[2] == '-') - setting = 0, p += 3; - - if (!strcmp (p, "implicit")) - warn_implicit = setting; - else if (!strcmp (p, "long-long")) - warn_long_long = setting; - else if (!strcmp (p, "return-type")) - warn_return_type = setting; - else if (!strcmp (p, "ctor-dtor-privacy")) - warn_ctor_dtor_privacy = setting; - else if (!strcmp (p, "write-strings")) - warn_write_strings = setting; - else if (!strcmp (p, "cast-qual")) - warn_cast_qual = setting; - else if (!strcmp (p, "char-subscripts")) - warn_char_subscripts = setting; - else if (!strcmp (p, "pointer-arith")) - warn_pointer_arith = setting; - else if (!strcmp (p, "missing-prototypes")) - warn_missing_prototypes = setting; - else if (!strcmp (p, "redundant-decls")) - warn_redundant_decls = setting; - else if (!strcmp (p, "missing-braces")) - warn_missing_braces = setting; - else if (!strcmp (p, "sign-compare")) - warn_sign_compare = setting; - else if (!strcmp (p, "format")) - warn_format = setting; - else if (!strcmp (p, "conversion")) - warn_conversion = setting; - else if (!strcmp (p, "parentheses")) - warn_parentheses = setting; - else if (!strcmp (p, "non-virtual-dtor")) - warn_nonvdtor = setting; - else if (!strcmp (p, "extern-inline")) - warn_extern_inline = setting; - else if (!strcmp (p, "reorder")) - warn_reorder = setting; - else if (!strcmp (p, "synth")) - warn_synth = setting; - else if (!strcmp (p, "pmf-conversions")) - warn_pmf2ptr = setting; - else if (!strcmp (p, "effc++")) - warn_ecpp = setting; - else if (!strcmp (p, "sign-promo")) - warn_sign_promo = setting; - else if (!strcmp (p, "old-style-cast")) - warn_old_style_cast = setting; - else if (!strcmp (p, "overloaded-virtual")) - warn_overloaded_virtual = setting; - else if (!strcmp (p, "multichar")) - warn_multichar = setting; - else if (!strcmp (p, "unknown-pragmas")) - /* Set to greater than 1, so that even unknown pragmas in - system headers will be warned about. */ - warn_unknown_pragmas = setting * 2; - else if (!strcmp (p, "non-template-friend")) - warn_nontemplate_friend = setting; - else if (!strcmp (p, "deprecated")) - warn_deprecated = setting; - else if (!strcmp (p, "comment")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "comments")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "trigraphs")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "import")) - ; /* cpp handles this one. */ - else if (!strcmp (p, "all")) - { - warn_return_type = setting; - warn_unused = setting; - warn_implicit = setting; - warn_switch = setting; - warn_format = setting; - warn_parentheses = setting; - warn_missing_braces = setting; - warn_sign_compare = setting; - warn_multichar = setting; - /* We save the value of warn_uninitialized, since if they put - -Wuninitialized on the command line, we need to generate a - warning about not using it without also specifying -O. */ - if (warn_uninitialized != 1) - warn_uninitialized = (setting ? 2 : 0); - /* Only warn about unknown pragmas that are not in system - headers. */ - warn_unknown_pragmas = 1; - - /* C++-specific warnings. */ - warn_ctor_dtor_privacy = setting; - warn_nonvdtor = setting; - warn_reorder = setting; - warn_nontemplate_friend = setting; - } - else return strings_processed; - } - else if (!strcmp (p, "-ansi")) - flag_no_nonansi_builtin = 1, flag_ansi = 1, - flag_no_gnu_keywords = 1, flag_operator_names = 1; -#ifdef SPEW_DEBUG - /* Undocumented, only ever used when you're invoking cc1plus by hand, since - it's probably safe to assume no sane person would ever want to use this - under normal circumstances. */ - else if (!strcmp (p, "-spew-debug")) - spew_debug = 1; -#endif - else - return strings_processed; - - return 1; -} - -/* Incorporate `const' and `volatile' qualifiers for member functions. - FUNCTION is a TYPE_DECL or a FUNCTION_DECL. - QUALS is a list of qualifiers. */ - -tree -grok_method_quals (ctype, function, quals) - tree ctype, function, quals; -{ - tree fntype = TREE_TYPE (function); - tree raises = TYPE_RAISES_EXCEPTIONS (fntype); - int type_quals = TYPE_UNQUALIFIED; - int dup_quals = TYPE_UNQUALIFIED; - - do - { - int tq = cp_type_qual_from_rid (TREE_VALUE (quals)); - - if (type_quals & tq) - dup_quals |= tq; - else - type_quals |= tq; - quals = TREE_CHAIN (quals); - } - while (quals); - - if (dup_quals != TYPE_UNQUALIFIED) - cp_error ("duplicate type qualifiers in %s declaration", - TREE_CODE (function) == FUNCTION_DECL - ? "member function" : "type"); - - ctype = cp_build_qualified_type (ctype, type_quals); - fntype = build_cplus_method_type (ctype, TREE_TYPE (fntype), - (TREE_CODE (fntype) == METHOD_TYPE - ? TREE_CHAIN (TYPE_ARG_TYPES (fntype)) - : TYPE_ARG_TYPES (fntype))); - if (raises) - fntype = build_exception_variant (fntype, raises); - - TREE_TYPE (function) = fntype; - return ctype; -} - -/* Warn when -fexternal-templates is used and #pragma - interface/implementation is not used all the times it should be, - inform the user. */ - -void -warn_if_unknown_interface (decl) - tree decl; -{ - static int already_warned = 0; - if (already_warned++) - return; - - if (flag_alt_external_templates) - { - struct tinst_level *til = tinst_for_decl (); - int sl = lineno; - char *sf = input_filename; - - if (til) - { - lineno = til->line; - input_filename = til->file; - } - cp_warning ("template `%#D' instantiated in file without #pragma interface", - decl); - lineno = sl; - input_filename = sf; - } - else - cp_warning_at ("template `%#D' defined in file without #pragma interface", - decl); -} - -/* A subroutine of the parser, to handle a component list. */ - -void -grok_x_components (specs) - tree specs; -{ - struct pending_inline **p; - tree t; - - specs = strip_attrs (specs); - - check_tag_decl (specs); - t = groktypename (build_decl_list (specs, NULL_TREE)); - - /* The only case where we need to do anything additional here is an - anonymous union field, e.g.: `struct S { union { int i; }; };'. */ - if (t == NULL_TREE || !ANON_UNION_TYPE_P (t)) - return; - - fixup_anonymous_union (t); - finish_member_declaration (build_lang_field_decl (FIELD_DECL, - NULL_TREE, - t)); - - /* Ignore any inline function definitions in the anonymous union - since an anonymous union may not have function members. */ - p = &pending_inlines; - for (; *p; *p = (*p)->next) - if (DECL_CONTEXT ((*p)->fndecl) != t) - break; -} - -/* Constructors for types with virtual baseclasses need an "in-charge" flag - saying whether this constructor is responsible for initialization of - virtual baseclasses or not. All destructors also need this "in-charge" - flag, which additionally determines whether or not the destructor should - free the memory for the object. - - This function adds the "in-charge" flag to member function FN if - appropriate. It is called from grokclassfn and tsubst. - FN must be either a constructor or destructor. - - For vtable thunks, types with polymorphic virtual bases need an - additional "vlist" argument which is an array of virtual tables. - In addition, if backwards-compatibility to v1 thunks is requested, - a wrapper constructor may be needed as well. */ - -void -maybe_retrofit_in_chrg (fn) - tree fn; -{ - tree basetype, arg_types, parms, parm, fntype; - tree wrapper; - - if (CLASSTYPE_IS_TEMPLATE (DECL_CLASS_CONTEXT (fn))) - /* Never retrofit arguments on template methods. */ - return; - - if (DECL_CONSTRUCTOR_P (fn) - && TYPE_USES_VIRTUAL_BASECLASSES (DECL_CLASS_CONTEXT (fn)) - && DECL_CONSTRUCTOR_FOR_VBASE (fn) == 0) - /* OK */; - else if (! DECL_CONSTRUCTOR_P (fn) - && TREE_CHAIN (DECL_ARGUMENTS (fn)) == NULL_TREE) - /* OK */; - else - return; - - if (DECL_CONSTRUCTOR_P (fn)) - { - if (TYPE_USES_PVBASES (DECL_CLASS_CONTEXT (fn))) - DECL_CONSTRUCTOR_FOR_VBASE (fn) = CONSTRUCTOR_FOR_PVBASE; - else - DECL_CONSTRUCTOR_FOR_VBASE (fn) = CONSTRUCTOR_FOR_VBASE; - } - else if (TYPE_USES_PVBASES (DECL_CLASS_CONTEXT (fn))) - DECL_CONSTRUCTOR_FOR_VBASE (fn) = DESTRUCTOR_FOR_PVBASE; - - /* Retrieve the arguments, because it is potentially modified twice. */ - arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn)); - basetype = TREE_TYPE (TREE_VALUE (arg_types)); - arg_types = TREE_CHAIN (arg_types); - - if (DECL_CONSTRUCTOR_FOR_PVBASE_P (fn) - || DECL_DESTRUCTOR_FOR_PVBASE_P (fn)) - { - /* Add the __vlist argument first. See __in_chrg below. */ - tree id = vlist_identifier; - if (DECL_DESTRUCTOR_FOR_PVBASE_P (fn)) - id = get_identifier (VLIST1_NAME); - parm = build_decl (PARM_DECL, id, vlist_type_node); - SET_DECL_ARTIFICIAL (parm); - DECL_ARG_TYPE (parm) = vlist_type_node; - parms = DECL_ARGUMENTS (fn); - /* Add it after 'this'. */ - TREE_CHAIN (parm) = TREE_CHAIN (parms); - TREE_CHAIN (parms) = parm; - - arg_types = hash_tree_chain (vlist_type_node, arg_types); - } - - /* First add it to DECL_ARGUMENTS... */ - parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node); - /* Mark the artificial `__in_chrg' parameter as "artificial". */ - SET_DECL_ARTIFICIAL (parm); - DECL_ARG_TYPE (parm) = integer_type_node; - TREE_READONLY (parm) = 1; - parms = DECL_ARGUMENTS (fn); - TREE_CHAIN (parm) = TREE_CHAIN (parms); - TREE_CHAIN (parms) = parm; - - /* ...and then to TYPE_ARG_TYPES. */ - arg_types = hash_tree_chain (integer_type_node, arg_types); - fntype = build_cplus_method_type (basetype, TREE_TYPE (TREE_TYPE (fn)), - arg_types); - if (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn))) - fntype = build_exception_variant (fntype, - TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn))); - TREE_TYPE (fn) = fntype; - - if (flag_vtable_thunks_compat - && DECL_CONSTRUCTOR_FOR_PVBASE_P (fn)) - make_vlist_ctor_wrapper (fn); -} - -/* Classes overload their constituent function names automatically. - When a function name is declared in a record structure, - its name is changed to it overloaded name. Since names for - constructors and destructors can conflict, we place a leading - '$' for destructors. - - CNAME is the name of the class we are grokking for. - - FUNCTION is a FUNCTION_DECL. It was created by `grokdeclarator'. - - FLAGS contains bits saying what's special about today's - arguments. 1 == DESTRUCTOR. 2 == OPERATOR. - - If FUNCTION is a destructor, then we must add the `auto-delete' field - as a second parameter. There is some hair associated with the fact - that we must "declare" this variable in the manner consistent with the - way the rest of the arguments were declared. - - QUALS are the qualifiers for the this pointer. */ - -void -grokclassfn (ctype, function, flags, quals) - tree ctype, function; - enum overload_flags flags; - tree quals; -{ - tree fn_name = DECL_NAME (function); - tree arg_types; - tree parm; - tree qualtype; - - if (fn_name == NULL_TREE) - { - error ("name missing for member function"); - fn_name = get_identifier (""); - DECL_NAME (function) = fn_name; - } - - if (quals) - qualtype = grok_method_quals (ctype, function, quals); - else - qualtype = ctype; - - arg_types = TYPE_ARG_TYPES (TREE_TYPE (function)); - if (TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE) - { - /* Must add the class instance variable up front. */ - /* Right now we just make this a pointer. But later - we may wish to make it special. */ - tree type = TREE_VALUE (arg_types); - int constp = 1; - - if ((flag_this_is_variable > 0) - && (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function))) - constp = 0; - - parm = build_decl (PARM_DECL, this_identifier, type); - /* Mark the artificial `this' parameter as "artificial". */ - SET_DECL_ARTIFICIAL (parm); - DECL_ARG_TYPE (parm) = type; - /* We can make this a register, so long as we don't - accidentally complain if someone tries to take its address. */ - DECL_REGISTER (parm) = 1; - if (constp) - TREE_READONLY (parm) = 1; - TREE_CHAIN (parm) = last_function_parms; - last_function_parms = parm; - } - - DECL_ARGUMENTS (function) = last_function_parms; - /* First approximations. */ - DECL_CONTEXT (function) = ctype; - DECL_CLASS_CONTEXT (function) = ctype; - - if (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function)) - { - maybe_retrofit_in_chrg (function); - arg_types = TYPE_ARG_TYPES (TREE_TYPE (function)); - } - - if (flags == DTOR_FLAG) - { - DECL_ASSEMBLER_NAME (function) = - build_destructor_name (ctype, DECL_DESTRUCTOR_FOR_PVBASE_P (function)); - TYPE_HAS_DESTRUCTOR (ctype) = 1; - } - else - set_mangled_name_for_decl (function); -} - -/* Work on the expr used by alignof (this is only called by the parser). */ - -tree -grok_alignof (expr) - tree expr; -{ - tree best, t; - int bestalign; - - if (processing_template_decl) - return build_min (ALIGNOF_EXPR, sizetype, expr); - - if (TREE_CODE (expr) == COMPONENT_REF - && DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1))) - error ("`__alignof__' applied to a bit-field"); - - if (TREE_CODE (expr) == INDIRECT_REF) - { - best = t = TREE_OPERAND (expr, 0); - bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t))); - - while (TREE_CODE (t) == NOP_EXPR - && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE) - { - int thisalign; - t = TREE_OPERAND (t, 0); - thisalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t))); - if (thisalign > bestalign) - best = t, bestalign = thisalign; - } - return c_alignof (TREE_TYPE (TREE_TYPE (best))); - } - else - { - /* ANSI says arrays and fns are converted inside comma. - But we can't convert them in build_compound_expr - because that would break commas in lvalues. - So do the conversion here if operand was a comma. */ - if (TREE_CODE (expr) == COMPOUND_EXPR - && (TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE - || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)) - expr = default_conversion (expr); - return c_alignof (TREE_TYPE (expr)); - } -} - -/* Create an ARRAY_REF, checking for the user doing things backwards - along the way. */ - -tree -grok_array_decl (array_expr, index_exp) - tree array_expr, index_exp; -{ - tree type = TREE_TYPE (array_expr); - tree p1, p2, i1, i2; - - if (type == error_mark_node || index_exp == error_mark_node) - return error_mark_node; - if (processing_template_decl) - return build_min (ARRAY_REF, type ? TREE_TYPE (type) : NULL_TREE, - array_expr, index_exp); - - if (type == NULL_TREE) - { - /* Something has gone very wrong. Assume we are mistakenly reducing - an expression instead of a declaration. */ - error ("parser may be lost: is there a '{' missing somewhere?"); - return NULL_TREE; - } - - if (TREE_CODE (type) == OFFSET_TYPE - || TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); - - /* If they have an `operator[]', use that. */ - if (IS_AGGR_TYPE (type) || IS_AGGR_TYPE (TREE_TYPE (index_exp))) - return build_opfncall (ARRAY_REF, LOOKUP_NORMAL, - array_expr, index_exp, NULL_TREE); - - /* Otherwise, create an ARRAY_REF for a pointer or array type. It - is a little-known fact that, if `a' is an array and `i' is an - int, you can write `i[a]', which means the same thing as `a[i]'. */ - - if (TREE_CODE (type) == ARRAY_TYPE) - p1 = array_expr; - else - p1 = build_expr_type_conversion (WANT_POINTER, array_expr, 0); - - if (TREE_CODE (TREE_TYPE (index_exp)) == ARRAY_TYPE) - p2 = index_exp; - else - p2 = build_expr_type_conversion (WANT_POINTER, index_exp, 0); - - i1 = build_expr_type_conversion (WANT_INT | WANT_ENUM, array_expr, 0); - i2 = build_expr_type_conversion (WANT_INT | WANT_ENUM, index_exp, 0); - - if ((p1 && i2) && (i1 && p2)) - error ("ambiguous conversion for array subscript"); - - if (p1 && i2) - array_expr = p1, index_exp = i2; - else if (i1 && p2) - array_expr = p2, index_exp = i1; - else - { - cp_error ("invalid types `%T[%T]' for array subscript", - type, TREE_TYPE (index_exp)); - return error_mark_node; - } - - if (array_expr == error_mark_node || index_exp == error_mark_node) - error ("ambiguous conversion for array subscript"); - - return build_array_ref (array_expr, index_exp); -} - -/* Given the cast expression EXP, checking out its validity. Either return - an error_mark_node if there was an unavoidable error, return a cast to - void for trying to delete a pointer w/ the value 0, or return the - call to delete. If DOING_VEC is 1, we handle things differently - for doing an array delete. If DOING_VEC is 2, they gave us the - array size as an argument to delete. - Implements ARM $5.3.4. This is called from the parser. */ - -tree -delete_sanity (exp, size, doing_vec, use_global_delete) - tree exp, size; - int doing_vec, use_global_delete; -{ - tree t, type; - /* For a regular vector delete (aka, no size argument) we will pass - this down as a NULL_TREE into build_vec_delete. */ - tree maxindex = NULL_TREE; - - if (exp == error_mark_node) - return exp; - - if (processing_template_decl) - { - t = build_min (DELETE_EXPR, void_type_node, exp, size); - DELETE_EXPR_USE_GLOBAL (t) = use_global_delete; - DELETE_EXPR_USE_VEC (t) = doing_vec; - return t; - } - - if (TREE_CODE (exp) == OFFSET_REF) - exp = resolve_offset_ref (exp); - exp = convert_from_reference (exp); - t = stabilize_reference (exp); - t = build_expr_type_conversion (WANT_POINTER, t, 1); - - if (t == NULL_TREE || t == error_mark_node) - { - cp_error ("type `%#T' argument given to `delete', expected pointer", - TREE_TYPE (exp)); - return error_mark_node; - } - - if (doing_vec == 2) - { - maxindex = build_binary_op (MINUS_EXPR, size, integer_one_node); - pedwarn ("anachronistic use of array size in vector delete"); - } - - type = TREE_TYPE (t); - - /* As of Valley Forge, you can delete a pointer to const. */ - - /* You can't delete functions. */ - if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) - { - error ("cannot delete a function"); - return error_mark_node; - } - - /* Deleting ptr to void is undefined behaviour [expr.delete/3]. */ - if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE) - cp_warning ("`%T' is not a pointer-to-object type", type); - - /* An array can't have been allocated by new, so complain. */ - if (TREE_CODE (t) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL - && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == ARRAY_TYPE) - cp_warning ("deleting array `%#D'", TREE_OPERAND (t, 0)); - - /* Deleting a pointer with the value zero is valid and has no effect. */ - if (integer_zerop (t)) - return build1 (NOP_EXPR, void_type_node, t); - - if (doing_vec) - return build_vec_delete (t, maxindex, integer_one_node, - integer_zero_node, use_global_delete); - else - { - if (IS_AGGR_TYPE (TREE_TYPE (type)) - && TYPE_GETS_REG_DELETE (TREE_TYPE (type))) - { - /* Only do access checking here; we'll be calling op delete - from the destructor. */ - tree tmp = build_op_delete_call (DELETE_EXPR, t, size_zero_node, - LOOKUP_NORMAL, NULL_TREE); - if (tmp == error_mark_node) - return error_mark_node; - } - - return build_delete (type, t, integer_three_node, - LOOKUP_NORMAL, use_global_delete); - } -} - -/* Report an error if the indicated template declaration is not the - sort of thing that should be a member template. */ - -void -check_member_template (tmpl) - tree tmpl; -{ - tree decl; - - my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 0); - decl = DECL_TEMPLATE_RESULT (tmpl); - - if (TREE_CODE (decl) == FUNCTION_DECL - || (TREE_CODE (decl) == TYPE_DECL - && IS_AGGR_TYPE (TREE_TYPE (decl)))) - { - if (current_function_decl) - /* 14.5.2.2 [temp.mem] - - A local class shall not have member templates. */ - cp_error ("declaration of member template `%#D' in local class", - decl); - - if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl)) - { - /* 14.5.2.3 [temp.mem] - - A member function template shall not be virtual. */ - cp_error - ("invalid use of `virtual' in template declaration of `%#D'", - decl); - DECL_VIRTUAL_P (decl) = 0; - } - - /* The debug-information generating code doesn't know what to do - with member templates. */ - DECL_IGNORED_P (tmpl) = 1; - } - else - cp_error ("template declaration of `%#D'", decl); -} - -/* Return true iff TYPE is a valid Java parameter or return type. */ - -static int -acceptable_java_type (type) - tree type; -{ - if (TREE_CODE (type) == VOID_TYPE || TYPE_FOR_JAVA (type)) - return 1; - if (TREE_CODE (type) == POINTER_TYPE) - { - type = TREE_TYPE (type); - if (TREE_CODE (type) == RECORD_TYPE) - { - tree args; int i; - if (! TYPE_FOR_JAVA (type)) - return 0; - if (! CLASSTYPE_TEMPLATE_INFO (type)) - return 1; - args = CLASSTYPE_TI_ARGS (type); - i = TREE_VEC_LENGTH (args); - while (--i >= 0) - { - type = TREE_VEC_ELT (args, i); - if (TREE_CODE (type) == POINTER_TYPE) - type = TREE_TYPE (type); - if (! TYPE_FOR_JAVA (type)) - return 0; - } - return 1; - } - } - return 0; -} - -/* For a METHOD in a Java class CTYPE, return 1 if - the parameter and return types are valid Java types. - Otherwise, print appropriate error messages, and return 0. */ - -int -check_java_method (method) - tree method; -{ - int jerr = 0; - tree arg_types = TYPE_ARG_TYPES (TREE_TYPE (method)); - tree ret_type = TREE_TYPE (TREE_TYPE (method)); - if (! acceptable_java_type (ret_type)) - { - cp_error ("Java method '%D' has non-Java return type `%T'", - method, ret_type); - jerr++; - } - for (; arg_types != NULL_TREE; arg_types = TREE_CHAIN (arg_types)) - { - tree type = TREE_VALUE (arg_types); - if (! acceptable_java_type (type)) - { - cp_error ("Java method '%D' has non-Java parameter type `%T'", - method, type); - jerr++; - } - } - return jerr ? 0 : 1; -} - -/* Sanity check: report error if this function FUNCTION is not - really a member of the class (CTYPE) it is supposed to belong to. - CNAME is the same here as it is for grokclassfn above. */ - -tree -check_classfn (ctype, function) - tree ctype, function; -{ - tree fn_name = DECL_NAME (function); - tree fndecl, fndecls; - tree method_vec = CLASSTYPE_METHOD_VEC (complete_type (ctype)); - tree *methods = 0; - tree *end = 0; - - if (DECL_USE_TEMPLATE (function) - && is_member_template (DECL_TI_TEMPLATE (function))) - /* Since this is a specialization of a member template, - we're not going to find the declaration in the class. - For example, in: - - struct S { template void f(T); }; - template <> void S::f(int); - - we're not going to find `S::f(int)', but there's no - reason we should, either. We let our callers know we didn't - find the method, but we don't complain. */ - return NULL_TREE; - - if (method_vec != 0) - { - methods = &TREE_VEC_ELT (method_vec, 0); - end = TREE_VEC_END (method_vec); - - /* First suss out ctors and dtors. */ - if (*methods && fn_name == DECL_NAME (OVL_CURRENT (*methods)) - && DECL_CONSTRUCTOR_P (function)) - goto got_it; - if (*++methods && fn_name == DECL_NAME (OVL_CURRENT (*methods)) - && DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (function))) - goto got_it; - - while (++methods != end && *methods) - { - fndecl = *methods; - if (fn_name == DECL_NAME (OVL_CURRENT (*methods))) - { - got_it: - for (fndecls = *methods; fndecls != NULL_TREE; - fndecls = OVL_NEXT (fndecls)) - { - fndecl = OVL_CURRENT (fndecls); - /* The DECL_ASSEMBLER_NAME for a TEMPLATE_DECL, or - for a for member function of a template class, is - not mangled, so the check below does not work - correctly in that case. Since mangled destructor - names do not include the type of the arguments, - we can't use this short-cut for them, either. - (It's not legal to declare arguments for a - destructor, but some people try.) */ - if (!DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (function)) - && (DECL_ASSEMBLER_NAME (function) - != DECL_NAME (function)) - && (DECL_ASSEMBLER_NAME (fndecl) - != DECL_NAME (fndecl)) - && (DECL_ASSEMBLER_NAME (function) - == DECL_ASSEMBLER_NAME (fndecl))) - return fndecl; - - /* We cannot simply call decls_match because this - doesn't work for static member functions that are - pretending to be methods, and because the name - may have been changed by asm("new_name"). */ - if (DECL_NAME (function) == DECL_NAME (fndecl)) - { - tree p1 = TYPE_ARG_TYPES (TREE_TYPE (function)); - tree p2 = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); - - /* Get rid of the this parameter on functions that become - static. */ - if (DECL_STATIC_FUNCTION_P (fndecl) - && TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE) - p1 = TREE_CHAIN (p1); - - if (same_type_p (TREE_TYPE (TREE_TYPE (function)), - TREE_TYPE (TREE_TYPE (fndecl))) - && compparms (p1, p2) - && (DECL_TEMPLATE_SPECIALIZATION (function) - == DECL_TEMPLATE_SPECIALIZATION (fndecl)) - && (!DECL_TEMPLATE_SPECIALIZATION (function) - || (DECL_TI_TEMPLATE (function) - == DECL_TI_TEMPLATE (fndecl)))) - return fndecl; - } - } - break; /* loser */ - } - } - } - - if (methods != end && *methods) - { - tree fndecl = *methods; - cp_error ("prototype for `%#D' does not match any in class `%T'", - function, ctype); - cp_error_at ("candidate%s: %+#D", OVL_NEXT (fndecl) ? "s are" : " is", - OVL_CURRENT (fndecl)); - while (fndecl = OVL_NEXT (fndecl), fndecl) - cp_error_at (" %#D", OVL_CURRENT(fndecl)); - } - else - { - methods = 0; - if (TYPE_SIZE (ctype) == 0) - incomplete_type_error (function, ctype); - else - cp_error ("no `%#D' member function declared in class `%T'", - function, ctype); - } - - /* If we did not find the method in the class, add it to avoid - spurious errors (unless the CTYPE is not yet defined, in which - case we'll only confuse ourselves when the function is declared - properly within the class. */ - if (TYPE_SIZE (ctype)) - add_method (ctype, methods, function); - return NULL_TREE; -} - -/* We have just processed the DECL, which is a static data member. - Its initializer, if present, is INIT. The ASMSPEC_TREE, if - present, is the assembly-language name for the data member. - NEED_POP and FLAGS are as for cp_finish_decl. */ - -void -finish_static_data_member_decl (decl, init, asmspec_tree, need_pop, flags) - tree decl; - tree init; - tree asmspec_tree; - int need_pop; - int flags; -{ - char* asmspec = 0; - - if (asmspec_tree) - asmspec = TREE_STRING_POINTER (asmspec_tree); - - my_friendly_assert (TREE_PUBLIC (decl), 0); - - /* We cannot call pushdecl here, because that would fill in the - decl of our TREE_CHAIN. Instead, we modify cp_finish_decl to do - the right thing, namely, to put this decl out straight away. */ - /* current_class_type can be NULL_TREE in case of error. */ - if (!asmspec && current_class_type) - { - DECL_INITIAL (decl) = error_mark_node; - DECL_ASSEMBLER_NAME (decl) - = build_static_name (current_class_type, DECL_NAME (decl)); - } - if (! processing_template_decl) - { - if (!pending_statics) - VARRAY_TREE_INIT (pending_statics, 32, "pending_statics"); - - if (pending_statics_used == pending_statics->num_elements) - VARRAY_GROW (pending_statics, - 2 * pending_statics->num_elements); - VARRAY_TREE (pending_statics, pending_statics_used) = decl; - ++pending_statics_used; - } - - /* Static consts need not be initialized in the class definition. */ - if (init != NULL_TREE && TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl))) - { - static int explanation = 0; - - error ("initializer invalid for static member with constructor"); - if (explanation++ == 0) - error ("(you really want to initialize it separately)"); - init = 0; - } - /* Force the compiler to know when an uninitialized static const - member is being used. */ - if (CP_TYPE_CONST_P (TREE_TYPE (decl)) && init == 0) - TREE_USED (decl) = 1; - DECL_INITIAL (decl) = init; - DECL_IN_AGGR_P (decl) = 1; - DECL_CONTEXT (decl) = current_class_type; - DECL_CLASS_CONTEXT (decl) = current_class_type; - - cp_finish_decl (decl, init, asmspec_tree, need_pop, flags); -} - -/* Process the specs, declarator (NULL if omitted) and width (NULL if omitted) - of a structure component, returning a FIELD_DECL node. - QUALS is a list of type qualifiers for this decl (such as for declaring - const member functions). - - This is done during the parsing of the struct declaration. - The FIELD_DECL nodes are chained together and the lot of them - are ultimately passed to `build_struct' to make the RECORD_TYPE node. - - C++: - - If class A defines that certain functions in class B are friends, then - the way I have set things up, it is B who is interested in permission - granted by A. However, it is in A's context that these declarations - are parsed. By returning a void_type_node, class A does not attempt - to incorporate the declarations of the friends within its structure. - - DO NOT MAKE ANY CHANGES TO THIS CODE WITHOUT MAKING CORRESPONDING - CHANGES TO CODE IN `start_method'. */ - -tree -grokfield (declarator, declspecs, init, asmspec_tree, attrlist) - tree declarator, declspecs, init, asmspec_tree, attrlist; -{ - register tree value; - char *asmspec = 0; - int flags = LOOKUP_ONLYCONVERTING; - - /* Convert () initializers to = initializers. */ - if (init == NULL_TREE && declarator != NULL_TREE - && TREE_CODE (declarator) == CALL_EXPR - && TREE_OPERAND (declarator, 0) - && (TREE_CODE (TREE_OPERAND (declarator, 0)) == IDENTIFIER_NODE - || TREE_CODE (TREE_OPERAND (declarator, 0)) == SCOPE_REF) - && parmlist_is_exprlist (TREE_OPERAND (declarator, 1))) - { - init = TREE_OPERAND (declarator, 1); - declarator = TREE_OPERAND (declarator, 0); - flags = 0; - } - - if (declspecs == NULL_TREE - && TREE_CODE (declarator) == SCOPE_REF - && TREE_CODE (TREE_OPERAND (declarator, 1)) == IDENTIFIER_NODE) - { - /* Access declaration */ - if (! IS_AGGR_TYPE_CODE (TREE_CODE (TREE_OPERAND (declarator, 0)))) - ; - else if (TREE_COMPLEXITY (declarator) == current_class_depth) - pop_nested_class (); - return do_class_using_decl (declarator); - } - - if (init - && TREE_CODE (init) == TREE_LIST - && TREE_VALUE (init) == error_mark_node - && TREE_CHAIN (init) == NULL_TREE) - init = NULL_TREE; - - value = grokdeclarator (declarator, declspecs, FIELD, init != 0, attrlist); - if (! value || value == error_mark_node) - /* friend or constructor went bad. */ - return value; - - /* Pass friendly classes back. */ - if (TREE_CODE (value) == VOID_TYPE) - return void_type_node; - - if (DECL_NAME (value) != NULL_TREE - && IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_' - && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr")) - cp_error ("member `%D' conflicts with virtual function table field name", - value); - - /* Stash away type declarations. */ - if (TREE_CODE (value) == TYPE_DECL) - { - DECL_NONLOCAL (value) = 1; - DECL_CONTEXT (value) = current_class_type; - DECL_CLASS_CONTEXT (value) = current_class_type; - - /* Now that we've updated the context, we need to remangle the - name for this TYPE_DECL. */ - DECL_ASSEMBLER_NAME (value) = DECL_NAME (value); - if (!uses_template_parms (value)) - DECL_ASSEMBLER_NAME (value) = - get_identifier (build_overload_name (TREE_TYPE (value), 1, 1)); - - return value; - } - - if (IS_SIGNATURE (current_class_type) - && TREE_CODE (value) != FUNCTION_DECL) - { - error ("field declaration not allowed in signature"); - return void_type_node; - } - - if (DECL_IN_AGGR_P (value)) - { - cp_error ("`%D' is already defined in `%T'", value, - DECL_CONTEXT (value)); - return void_type_node; - } - - if (asmspec_tree) - asmspec = TREE_STRING_POINTER (asmspec_tree); - - if (init) - { - if (IS_SIGNATURE (current_class_type) - && TREE_CODE (value) == FUNCTION_DECL) - { - error ("function declarations cannot have initializers in signature"); - init = NULL_TREE; - } - else if (TREE_CODE (value) == FUNCTION_DECL) - { - grok_function_init (value, init); - init = NULL_TREE; - } - else if (pedantic && TREE_CODE (value) != VAR_DECL) - /* Already complained in grokdeclarator. */ - init = NULL_TREE; - else - { - /* We allow initializers to become parameters to base - initializers. */ - if (TREE_CODE (init) == TREE_LIST) - { - if (TREE_CHAIN (init) == NULL_TREE) - init = TREE_VALUE (init); - else - init = digest_init (TREE_TYPE (value), init, (tree *)0); - } - - if (TREE_CODE (init) == CONST_DECL) - init = DECL_INITIAL (init); - else if (TREE_READONLY_DECL_P (init)) - init = decl_constant_value (init); - else if (TREE_CODE (init) == CONSTRUCTOR) - init = digest_init (TREE_TYPE (value), init, (tree *)0); - my_friendly_assert (TREE_PERMANENT (init), 192); - if (init == error_mark_node) - /* We must make this look different than `error_mark_node' - because `decl_const_value' would mis-interpret it - as only meaning that this VAR_DECL is defined. */ - init = build1 (NOP_EXPR, TREE_TYPE (value), init); - else if (processing_template_decl) - ; - else if (! TREE_CONSTANT (init)) - { - /* We can allow references to things that are effectively - static, since references are initialized with the address. */ - if (TREE_CODE (TREE_TYPE (value)) != REFERENCE_TYPE - || (TREE_STATIC (init) == 0 - && (TREE_CODE_CLASS (TREE_CODE (init)) != 'd' - || DECL_EXTERNAL (init) == 0))) - { - error ("field initializer is not constant"); - init = error_mark_node; - } - } - } - } - - /* The corresponding pop_obstacks is in cp_finish_decl. */ - push_obstacks_nochange (); - - if (processing_template_decl && ! current_function_decl - && (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == FUNCTION_DECL)) - value = push_template_decl (value); - - if (attrlist) - cplus_decl_attributes (value, TREE_PURPOSE (attrlist), - TREE_VALUE (attrlist)); - - if (TREE_CODE (value) == VAR_DECL) - { - finish_static_data_member_decl (value, init, asmspec_tree, - /*need_pop=*/1, flags); - return value; - } - if (TREE_CODE (value) == FIELD_DECL) - { - if (asmspec) - { - /* This must override the asm specifier which was placed - by grokclassfn. Lay this out fresh. */ - DECL_RTL (value) = NULL_RTX; - DECL_ASSEMBLER_NAME (value) = get_identifier (asmspec); - } - if (DECL_INITIAL (value) == error_mark_node) - init = error_mark_node; - cp_finish_decl (value, init, asmspec_tree, 1, flags); - DECL_INITIAL (value) = init; - DECL_IN_AGGR_P (value) = 1; - return value; - } - if (TREE_CODE (value) == FUNCTION_DECL) - { - if (asmspec) - { - /* This must override the asm specifier which was placed - by grokclassfn. Lay this out fresh. */ - DECL_RTL (value) = NULL_RTX; - DECL_ASSEMBLER_NAME (value) = get_identifier (asmspec); - } - cp_finish_decl (value, init, asmspec_tree, 1, flags); - - /* Pass friends back this way. */ - if (DECL_FRIEND_P (value)) - return void_type_node; - -#if 0 /* Just because a fn is declared doesn't mean we'll try to define it. */ - if (current_function_decl && ! IS_SIGNATURE (current_class_type)) - cp_error ("method `%#D' of local class must be defined in class body", - value); -#endif - - DECL_IN_AGGR_P (value) = 1; - return value; - } - my_friendly_abort (21); - /* NOTREACHED */ - return NULL_TREE; -} - -/* Like `grokfield', but for bitfields. - WIDTH is non-NULL for bit fields only, and is an INTEGER_CST node. */ - -tree -grokbitfield (declarator, declspecs, width) - tree declarator, declspecs, width; -{ - register tree value = grokdeclarator (declarator, declspecs, BITFIELD, - 0, NULL_TREE); - - if (! value) return NULL_TREE; /* friends went bad. */ - - /* Pass friendly classes back. */ - if (TREE_CODE (value) == VOID_TYPE) - return void_type_node; - - if (TREE_CODE (value) == TYPE_DECL) - { - cp_error ("cannot declare `%D' to be a bitfield type", value); - return NULL_TREE; - } - - /* Usually, finish_struct_1 catches bitifields with invalid types. - But, in the case of bitfields with function type, we confuse - ourselves into thinking they are member functions, so we must - check here. */ - if (TREE_CODE (value) == FUNCTION_DECL) - { - cp_error ("cannot declare bitfield `%D' with funcion type", - DECL_NAME (value)); - return NULL_TREE; - } - - if (IS_SIGNATURE (current_class_type)) - { - error ("field declaration not allowed in signature"); - return void_type_node; - } - - if (DECL_IN_AGGR_P (value)) - { - cp_error ("`%D' is already defined in the class %T", value, - DECL_CONTEXT (value)); - return void_type_node; - } - - GNU_xref_member (current_class_name, value); - - if (TREE_STATIC (value)) - { - cp_error ("static member `%D' cannot be a bitfield", value); - return NULL_TREE; - } - cp_finish_decl (value, NULL_TREE, NULL_TREE, 0, 0); - - if (width != error_mark_node) - { - constant_expression_warning (width); - DECL_INITIAL (value) = width; - SET_DECL_C_BIT_FIELD (value); - } - - DECL_IN_AGGR_P (value) = 1; - return value; -} - -tree -grokoptypename (declspecs, declarator) - tree declspecs, declarator; -{ - tree t = grokdeclarator (declarator, declspecs, TYPENAME, 0, NULL_TREE); - return build_typename_overload (t); -} - -/* When a function is declared with an initializer, - do the right thing. Currently, there are two possibilities: - - class B - { - public: - // initialization possibility #1. - virtual void f () = 0; - int g (); - }; - - class D1 : B - { - public: - int d1; - // error, no f (); - }; - - class D2 : B - { - public: - int d2; - void f (); - }; - - class D3 : B - { - public: - int d3; - // initialization possibility #2 - void f () = B::f; - }; - -*/ - -int -copy_assignment_arg_p (parmtype, virtualp) - tree parmtype; - int virtualp ATTRIBUTE_UNUSED; -{ - if (current_class_type == NULL_TREE) - return 0; - - if (TREE_CODE (parmtype) == REFERENCE_TYPE) - parmtype = TREE_TYPE (parmtype); - - if ((TYPE_MAIN_VARIANT (parmtype) == current_class_type) -#if 0 - /* Non-standard hack to support old Booch components. */ - || (! virtualp && DERIVED_FROM_P (parmtype, current_class_type)) -#endif - ) - return 1; - - return 0; -} - -static void -grok_function_init (decl, init) - tree decl; - tree init; -{ - /* An initializer for a function tells how this function should - be inherited. */ - tree type = TREE_TYPE (decl); - - if (TREE_CODE (type) == FUNCTION_TYPE) - cp_error ("initializer specified for non-member function `%D'", decl); -#if 0 - /* We'll check for this in finish_struct_1. */ - else if (DECL_VINDEX (decl) == NULL_TREE) - cp_error ("initializer specified for non-virtual method `%D'", decl); -#endif - else if (integer_zerop (init)) - { -#if 0 - /* Mark this function as being "defined". */ - DECL_INITIAL (decl) = error_mark_node; - /* pure virtual destructors must be defined. */ - /* pure virtual needs to be defined (as abort) only when put in - vtbl. For wellformed call, it should be itself. pr4737 */ - if (!DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl))) - { - extern tree abort_fndecl; - /* Give this node rtl from `abort'. */ - DECL_RTL (decl) = DECL_RTL (abort_fndecl); - } -#endif - DECL_ABSTRACT_VIRTUAL_P (decl) = 1; - if (DECL_NAME (decl) == ansi_opname [(int) MODIFY_EXPR]) - { - tree parmtype - = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (decl)))); - - if (copy_assignment_arg_p (parmtype, 1)) - TYPE_HAS_ABSTRACT_ASSIGN_REF (current_class_type) = 1; - } - } - else - cp_error ("invalid initializer for virtual method `%D'", decl); -} - -void -cplus_decl_attributes (decl, attributes, prefix_attributes) - tree decl, attributes, prefix_attributes; -{ - if (decl == NULL_TREE || decl == void_type_node) - return; - - if (TREE_CODE (decl) == TEMPLATE_DECL) - decl = DECL_TEMPLATE_RESULT (decl); - - decl_attributes (decl, attributes, prefix_attributes); - - if (TREE_CODE (decl) == TYPE_DECL) - SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (decl), TREE_TYPE (decl)); -} - -/* CONSTRUCTOR_NAME: - Return the name for the constructor (or destructor) for the - specified class. Argument can be RECORD_TYPE, TYPE_DECL, or - IDENTIFIER_NODE. When given a template, this routine doesn't - lose the specialization. */ - -tree -constructor_name_full (thing) - tree thing; -{ - if (TREE_CODE (thing) == TEMPLATE_TYPE_PARM - || TREE_CODE (thing) == TEMPLATE_TEMPLATE_PARM - || TREE_CODE (thing) == TYPENAME_TYPE) - thing = TYPE_NAME (thing); - else if (IS_AGGR_TYPE_CODE (TREE_CODE (thing))) - { - if (TYPE_WAS_ANONYMOUS (thing) && TYPE_HAS_CONSTRUCTOR (thing)) - thing = DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (thing), 0))); - else - thing = TYPE_NAME (thing); - } - if (TREE_CODE (thing) == TYPE_DECL - || (TREE_CODE (thing) == TEMPLATE_DECL - && TREE_CODE (DECL_TEMPLATE_RESULT (thing)) == TYPE_DECL)) - thing = DECL_NAME (thing); - my_friendly_assert (TREE_CODE (thing) == IDENTIFIER_NODE, 197); - return thing; -} - -/* CONSTRUCTOR_NAME: - Return the name for the constructor (or destructor) for the - specified class. Argument can be RECORD_TYPE, TYPE_DECL, or - IDENTIFIER_NODE. When given a template, return the plain - unspecialized name. */ - -tree -constructor_name (thing) - tree thing; -{ - tree t; - thing = constructor_name_full (thing); - t = IDENTIFIER_TEMPLATE (thing); - if (!t) - return thing; - return t; -} - -/* Cache the value of this class's main virtual function table pointer - in a register variable. This will save one indirection if a - more than one virtual function call is made this function. */ - -void -setup_vtbl_ptr () -{ - extern tree base_init_expr; - - if (base_init_expr == 0 - && DECL_CONSTRUCTOR_P (current_function_decl)) - { - if (processing_template_decl) - add_tree (build_min_nt - (CTOR_INITIALIZER, - current_member_init_list, current_base_init_list)); - else - emit_base_init (current_class_type, 0); - } -} - -/* Record the existence of an addressable inline function. */ - -void -mark_inline_for_output (decl) - tree decl; -{ - decl = DECL_MAIN_VARIANT (decl); - if (DECL_SAVED_INLINE (decl)) - return; - my_friendly_assert (TREE_PERMANENT (decl), 363); - DECL_SAVED_INLINE (decl) = 1; - if (!saved_inlines) - VARRAY_TREE_INIT (saved_inlines, 32, "saved_inlines"); - - if (saved_inlines_used == saved_inlines->num_elements) - VARRAY_GROW (saved_inlines, - 2 * saved_inlines->num_elements); - VARRAY_TREE (saved_inlines, saved_inlines_used) = decl; - ++saved_inlines_used; -} - -void -clear_temp_name () -{ - temp_name_counter = 0; -} - -/* Hand off a unique name which can be used for variable we don't really - want to know about anyway, for example, the anonymous variables which - are needed to make references work. Declare this thing so we can use it. - The variable created will be of type TYPE. - - STATICP is nonzero if this variable should be static. */ - -tree -get_temp_name (type, staticp) - tree type; - int staticp; -{ - char buf[sizeof (AUTO_TEMP_FORMAT) + 20]; - tree decl; - int toplev = toplevel_bindings_p (); - - push_obstacks_nochange (); - if (toplev || staticp) - { - end_temporary_allocation (); - sprintf (buf, AUTO_TEMP_FORMAT, global_temp_name_counter++); - decl = pushdecl_top_level (build_decl (VAR_DECL, get_identifier (buf), type)); - } - else - { - sprintf (buf, AUTO_TEMP_FORMAT, temp_name_counter++); - decl = pushdecl (build_decl (VAR_DECL, get_identifier (buf), type)); - } - TREE_USED (decl) = 1; - TREE_STATIC (decl) = staticp; - DECL_ARTIFICIAL (decl) = 1; - - /* If this is a local variable, then lay out its rtl now. - Otherwise, callers of this function are responsible for dealing - with this variable's rtl. */ - if (! toplev) - { - expand_decl (decl); - expand_decl_init (decl); - } - pop_obstacks (); - - return decl; -} - -/* Get a variable which we can use for multiple assignments. - It is not entered into current_binding_level, because - that breaks things when it comes time to do final cleanups - (which take place "outside" the binding contour of the function). */ - -tree -get_temp_regvar (type, init) - tree type, init; -{ - tree decl; - - decl = build_decl (VAR_DECL, NULL_TREE, type); - TREE_USED (decl) = 1; - DECL_REGISTER (decl) = 1; - DECL_ARTIFICIAL (decl) = 1; - - DECL_RTL (decl) = assign_temp (type, 2, 0, 1); - /* We can expand these without fear, since they cannot need - constructors or destructors. */ - expand_expr (build_modify_expr (decl, INIT_EXPR, init), - NULL_RTX, VOIDmode, 0); - - return decl; -} - -/* Hunts through the global anonymous union ANON_DECL, building - appropriate VAR_DECLs. Stores cleanups on the list of ELEMS, and - returns a VAR_DECL whose size is the same as the size of the - ANON_DECL, if one is available. */ - -static tree -build_anon_union_vars (anon_decl, elems, static_p, external_p) - tree anon_decl; - tree* elems; - int static_p; - int external_p; -{ - tree type = TREE_TYPE (anon_decl); - tree main_decl = NULL_TREE; - tree field; - - for (field = TYPE_FIELDS (type); - field != NULL_TREE; - field = TREE_CHAIN (field)) - { - tree decl; - - if (DECL_ARTIFICIAL (field)) - continue; - if (TREE_CODE (field) != FIELD_DECL) - { - cp_pedwarn_at ("`%#D' invalid; an anonymous union can only have non-static data members", - field); - continue; - } - - if (TREE_PRIVATE (field)) - cp_pedwarn_at ("private member `%#D' in anonymous union", field); - else if (TREE_PROTECTED (field)) - cp_pedwarn_at ("protected member `%#D' in anonymous union", field); - - if (DECL_NAME (field) == NULL_TREE - && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE) - { - decl = build_anon_union_vars (field, elems, static_p, external_p); - if (!decl) - continue; - } - else if (DECL_NAME (field) == NULL_TREE) - continue; - else - { - decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field)); - /* tell `pushdecl' that this is not tentative. */ - DECL_INITIAL (decl) = error_mark_node; - TREE_PUBLIC (decl) = 0; - TREE_STATIC (decl) = static_p; - DECL_EXTERNAL (decl) = external_p; - decl = pushdecl (decl); - DECL_INITIAL (decl) = NULL_TREE; - } - - /* Only write out one anon union element--choose the one that - can hold them all. */ - if (main_decl == NULL_TREE - && simple_cst_equal (DECL_SIZE (decl), - DECL_SIZE (anon_decl)) == 1) - main_decl = decl; - else - /* ??? This causes there to be no debug info written out - about this decl. */ - TREE_ASM_WRITTEN (decl) = 1; - - if (DECL_NAME (field) == NULL_TREE - && TREE_CODE (TREE_TYPE (field)) == UNION_TYPE) - /* The remainder of the processing was already done in the - recursive call. */ - continue; - - /* If there's a cleanup to do, it belongs in the - TREE_PURPOSE of the following TREE_LIST. */ - *elems = scratch_tree_cons (NULL_TREE, decl, *elems); - TREE_TYPE (*elems) = type; - } - - return main_decl; -} - -/* Finish off the processing of a UNION_TYPE structure. - If there are static members, then all members are - static, and must be laid out together. If the - union is an anonymous union, we arrange for that - as well. PUBLIC_P is nonzero if this union is - not declared static. */ - -void -finish_anon_union (anon_union_decl) - tree anon_union_decl; -{ - tree type = TREE_TYPE (anon_union_decl); - tree elems = NULL_TREE; - tree main_decl; - int public_p = TREE_PUBLIC (anon_union_decl); - int static_p = TREE_STATIC (anon_union_decl); - int external_p = DECL_EXTERNAL (anon_union_decl); - - if (TYPE_FIELDS (type) == NULL_TREE) - return; - - if (public_p) - { - error ("global anonymous unions must be declared static"); - return; - } - - main_decl = build_anon_union_vars (anon_union_decl, &elems, - static_p, external_p); - - if (main_decl == NULL_TREE) - { - warning ("anonymous union with no members"); - return; - } - - if (static_p) - { - make_decl_rtl (main_decl, 0, toplevel_bindings_p ()); - DECL_RTL (anon_union_decl) = DECL_RTL (main_decl); - } - - /* The following call assumes that there are never any cleanups - for anonymous unions--a reasonable assumption. */ - expand_anon_union_decl (anon_union_decl, NULL_TREE, elems); -} - -/* Finish processing a builtin type TYPE. It's name is NAME, - its fields are in the array FIELDS. LEN is the number of elements - in FIELDS minus one, or put another way, it is the maximum subscript - used in FIELDS. - - It is given the same alignment as ALIGN_TYPE. */ - -void -finish_builtin_type (type, name, fields, len, align_type) - tree type; - const char *name; - tree fields[]; - int len; - tree align_type; -{ - register int i; - - TYPE_FIELDS (type) = fields[0]; - for (i = 0; i < len; i++) - { - layout_type (TREE_TYPE (fields[i])); - DECL_FIELD_CONTEXT (fields[i]) = type; - TREE_CHAIN (fields[i]) = fields[i+1]; - } - DECL_FIELD_CONTEXT (fields[i]) = type; - DECL_CLASS_CONTEXT (fields[i]) = type; - TYPE_ALIGN (type) = TYPE_ALIGN (align_type); - layout_type (type); -#if 0 /* not yet, should get fixed properly later */ - TYPE_NAME (type) = make_type_decl (get_identifier (name), type); -#else - TYPE_NAME (type) = build_decl (TYPE_DECL, get_identifier (name), type); -#endif - TYPE_STUB_DECL (type) = TYPE_NAME (type); - layout_decl (TYPE_NAME (type), 0); -} - -/* Auxiliary functions to make type signatures for - `operator new' and `operator delete' correspond to - what compiler will be expecting. */ - -tree -coerce_new_type (type) - tree type; -{ - int e1 = 0, e2 = 0; - - if (TREE_CODE (type) == METHOD_TYPE) - type = build_function_type (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type))); - if (! same_type_p (TREE_TYPE (type), ptr_type_node)) - e1 = 1, error ("`operator new' must return type `void *'"); - - /* Technically the type must be `size_t', but we may not know - what that is. */ - if (TYPE_ARG_TYPES (type) == NULL_TREE) - e1 = 1, error ("`operator new' takes type `size_t' parameter"); - else if (! same_type_p (TREE_VALUE (TYPE_ARG_TYPES (type)), sizetype)) - e2 = 1, error ("`operator new' takes type `size_t' as first parameter"); - if (e2) - type = build_function_type (ptr_type_node, tree_cons (NULL_TREE, sizetype, TREE_CHAIN (TYPE_ARG_TYPES (type)))); - else if (e1) - type = build_function_type (ptr_type_node, TYPE_ARG_TYPES (type)); - return type; -} - -tree -coerce_delete_type (type) - tree type; -{ - int e1 = 0, e2 = 0; -#if 0 - e3 = 0; -#endif - tree arg_types = TYPE_ARG_TYPES (type); - - if (TREE_CODE (type) == METHOD_TYPE) - { - type = build_function_type (TREE_TYPE (type), TREE_CHAIN (arg_types)); - arg_types = TREE_CHAIN (arg_types); - } - - if (TREE_TYPE (type) != void_type_node) - e1 = 1, error ("`operator delete' must return type `void'"); - - if (arg_types == NULL_TREE - || ! same_type_p (TREE_VALUE (arg_types), ptr_type_node)) - e2 = 1, error ("`operator delete' takes type `void *' as first parameter"); - -#if 0 - if (arg_types - && TREE_CHAIN (arg_types) - && TREE_CHAIN (arg_types) != void_list_node) - { - /* Again, technically this argument must be `size_t', but again - we may not know what that is. */ - tree t2 = TREE_VALUE (TREE_CHAIN (arg_types)); - if (! same_type_p (t2, sizetype)) - e3 = 1, error ("second argument to `operator delete' must be of type `size_t'"); - else if (TREE_CHAIN (TREE_CHAIN (arg_types)) != void_list_node) - { - e3 = 1; - if (TREE_CHAIN (TREE_CHAIN (arg_types))) - error ("too many arguments in declaration of `operator delete'"); - else - error ("`...' invalid in specification of `operator delete'"); - } - } - - if (e3) - arg_types = tree_cons (NULL_TREE, ptr_type_node, - build_tree_list (NULL_TREE, sizetype)); - else if (e3 |= e2) - { - if (arg_types == NULL_TREE) - arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - else - arg_types = tree_cons (NULL_TREE, ptr_type_node, TREE_CHAIN (arg_types)); - } - else e3 |= e1; -#endif - - if (e2) - arg_types = tree_cons (NULL_TREE, ptr_type_node, - arg_types ? TREE_CHAIN (arg_types): NULL_TREE); - if (e2 || e1) - type = build_function_type (void_type_node, arg_types); - - return type; -} - -extern tree abort_fndecl; - -static void -mark_vtable_entries (decl) - tree decl; -{ - tree entries = CONSTRUCTOR_ELTS (DECL_INITIAL (decl)); - - for (; entries; entries = TREE_CHAIN (entries)) - { - tree fnaddr; - tree fn; - - fnaddr = (flag_vtable_thunks ? TREE_VALUE (entries) - : FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (entries))); - - if (TREE_CODE (fnaddr) == NOP_EXPR) - /* RTTI offset. */ - continue; - - fn = TREE_OPERAND (fnaddr, 0); - TREE_ADDRESSABLE (fn) = 1; - if (DECL_LANG_SPECIFIC (fn) && DECL_ABSTRACT_VIRTUAL_P (fn)) - { - TREE_OPERAND (fnaddr, 0) = fn = copy_node (fn); - DECL_RTL (fn) = DECL_RTL (abort_fndecl); - mark_used (abort_fndecl); - } - if (TREE_CODE (fn) == THUNK_DECL && DECL_EXTERNAL (fn)) - { - DECL_EXTERNAL (fn) = 0; - emit_thunk (fn); - } - mark_used (fn); - } -} - -/* Set DECL up to have the closest approximation of "initialized common" - linkage available. */ - -void -comdat_linkage (decl) - tree decl; -{ - if (flag_weak) - make_decl_one_only (decl); - else if (TREE_CODE (decl) == FUNCTION_DECL || DECL_VIRTUAL_P (decl)) - /* We can just emit functions and vtables statically; it doesn't really - matter if we have multiple copies. */ - TREE_PUBLIC (decl) = 0; - else - { - /* Static data member template instantiations, however, cannot - have multiple copies. */ - if (DECL_INITIAL (decl) == 0 - || DECL_INITIAL (decl) == error_mark_node) - DECL_COMMON (decl) = 1; - else if (EMPTY_CONSTRUCTOR_P (DECL_INITIAL (decl))) - { - DECL_COMMON (decl) = 1; - DECL_INITIAL (decl) = error_mark_node; - } - else - { - /* We can't do anything useful; leave vars for explicit - instantiation. */ - DECL_EXTERNAL (decl) = 1; - DECL_NOT_REALLY_EXTERN (decl) = 0; - } - } - - if (DECL_LANG_SPECIFIC (decl)) - DECL_COMDAT (decl) = 1; -} - -/* For win32 we also want to put explicit instantiations in - linkonce sections, so that they will be merged with implicit - instantiations; otherwise we get duplicate symbol errors. */ - -void -maybe_make_one_only (decl) - tree decl; -{ - /* We used to say that this was not necessary on targets that support weak - symbols, because the implicit instantiations will defer to the explicit - one. However, that's not actually the case in SVR4; a strong definition - after a weak one is an error. Also, not making explicit - instantiations one_only means that we can end up with two copies of - some template instantiations. */ - if (! supports_one_only ()) - return; - - /* We can't set DECL_COMDAT on functions, or finish_file will think - we can get away with not emitting them if they aren't used. We need - to for variables so that cp_finish_decl will update their linkage, - because their DECL_INITIAL may not have been set properly yet. */ - - make_decl_one_only (decl); - - if (TREE_CODE (decl) == VAR_DECL && DECL_LANG_SPECIFIC (decl)) - DECL_COMDAT (decl) = 1; -} - -/* Set TREE_PUBLIC and/or DECL_EXTERN on the vtable DECL, - based on TYPE and other static flags. - - Note that anything public is tagged TREE_PUBLIC, whether - it's public in this file or in another one. */ - -void -import_export_vtable (decl, type, final) - tree decl, type; - int final; -{ - if (DECL_INTERFACE_KNOWN (decl)) - return; - - if (TYPE_FOR_JAVA (type)) - { - TREE_PUBLIC (decl) = 1; - DECL_EXTERNAL (decl) = 1; - DECL_INTERFACE_KNOWN (decl) = 1; - } - else if (CLASSTYPE_INTERFACE_KNOWN (type)) - { - TREE_PUBLIC (decl) = 1; - DECL_EXTERNAL (decl) = ! CLASSTYPE_VTABLE_NEEDS_WRITING (type); - DECL_INTERFACE_KNOWN (decl) = 1; - } - else - { - /* We can only wait to decide if we have real non-inline virtual - functions in our class, or if we come from a template. */ - - int found = CLASSTYPE_TEMPLATE_INSTANTIATION (type); - - if (! found && ! final) - { - tree method; - for (method = TYPE_METHODS (type); method != NULL_TREE; - method = TREE_CHAIN (method)) - if (DECL_VINDEX (method) != NULL_TREE - && ! DECL_THIS_INLINE (method) - && ! DECL_ABSTRACT_VIRTUAL_P (method)) - { - found = 1; - break; - } - } - - if (final || ! found) - { - comdat_linkage (decl); - DECL_EXTERNAL (decl) = 0; - } - else - { - TREE_PUBLIC (decl) = 1; - DECL_EXTERNAL (decl) = 1; - } - } -} - -/* Determine whether or not we want to specifically import or export CTYPE, - using various heuristics. */ - -void -import_export_class (ctype) - tree ctype; -{ - /* -1 for imported, 1 for exported. */ - int import_export = 0; - - if (CLASSTYPE_INTERFACE_KNOWN (ctype)) - return; - - /* If MULTIPLE_SYMBOL_SPACES is defined and we saw a #pragma interface, - we will have CLASSTYPE_INTERFACE_ONLY set but not - CLASSTYPE_INTERFACE_KNOWN. In that case, we don't want to use this - heuristic because someone will supply a #pragma implementation - elsewhere, and deducing it here would produce a conflict. */ - if (CLASSTYPE_INTERFACE_ONLY (ctype)) - return; - -#ifdef VALID_MACHINE_TYPE_ATTRIBUTE - /* FIXME this should really use some sort of target-independent macro. */ - if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (ctype))) - import_export = -1; - else if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (ctype))) - import_export = 1; -#endif - - /* If we got -fno-implicit-templates, we import template classes that - weren't explicitly instantiated. */ - if (import_export == 0 - && CLASSTYPE_IMPLICIT_INSTANTIATION (ctype) - && ! flag_implicit_templates) - import_export = -1; - - /* Base our import/export status on that of the first non-inline, - non-abstract virtual function, if any. */ - if (import_export == 0 - && TYPE_VIRTUAL_P (ctype) - && ! CLASSTYPE_TEMPLATE_INSTANTIATION (ctype)) - { - tree method; - for (method = TYPE_METHODS (ctype); method != NULL_TREE; - method = TREE_CHAIN (method)) - { - if (DECL_VINDEX (method) != NULL_TREE - && !DECL_THIS_INLINE (method) - && !DECL_ABSTRACT_VIRTUAL_P (method)) - { - import_export = (DECL_REALLY_EXTERN (method) ? -1 : 1); - break; - } - } - } - -#ifdef MULTIPLE_SYMBOL_SPACES - if (import_export == -1) - import_export = 0; -#endif - - if (import_export) - { - SET_CLASSTYPE_INTERFACE_KNOWN (ctype); - CLASSTYPE_VTABLE_NEEDS_WRITING (ctype) = (import_export > 0); - CLASSTYPE_INTERFACE_ONLY (ctype) = (import_export < 0); - } -} - -/* We need to describe to the assembler the relationship between - a vtable and the vtable of the parent class. */ - -static void -output_vtable_inherit (vars) - tree vars; -{ - tree parent; - rtx op[2]; - - op[0] = XEXP (DECL_RTL (vars), 0); /* strip the mem ref */ - - parent = binfo_for_vtable (vars); - - if (parent == TYPE_BINFO (DECL_CONTEXT (vars))) - op[1] = const0_rtx; - else if (parent) - { - parent = TYPE_BINFO_VTABLE (BINFO_TYPE (parent)); - op[1] = XEXP (DECL_RTL (parent), 0); /* strip the mem ref */ - } - else - my_friendly_abort (980826); - - output_asm_insn (".vtable_inherit %c0, %c1", op); -} - -static int -finish_vtable_vardecl (t, data) - tree *t; - void *data ATTRIBUTE_UNUSED; -{ - tree vars = *t; - tree ctype = DECL_CONTEXT (vars); - import_export_class (ctype); - import_export_vtable (vars, ctype, 1); - - if (! DECL_EXTERNAL (vars) - && (DECL_INTERFACE_KNOWN (vars) - || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars)) - || (hack_decl_function_context (vars) && TREE_USED (vars))) - && ! TREE_ASM_WRITTEN (vars)) - { - /* Write it out. */ - mark_vtable_entries (vars); - if (TREE_TYPE (DECL_INITIAL (vars)) == 0) - store_init_value (vars, DECL_INITIAL (vars)); - - if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG) - { - /* Mark the VAR_DECL node representing the vtable itself as a - "gratuitous" one, thereby forcing dwarfout.c to ignore it. - It is rather important that such things be ignored because - any effort to actually generate DWARF for them will run - into trouble when/if we encounter code like: - - #pragma interface - struct S { virtual void member (); }; - - because the artificial declaration of the vtable itself (as - manufactured by the g++ front end) will say that the vtable - is a static member of `S' but only *after* the debug output - for the definition of `S' has already been output. This causes - grief because the DWARF entry for the definition of the vtable - will try to refer back to an earlier *declaration* of the - vtable as a static member of `S' and there won't be one. - We might be able to arrange to have the "vtable static member" - attached to the member list for `S' before the debug info for - `S' get written (which would solve the problem) but that would - require more intrusive changes to the g++ front end. */ - - DECL_IGNORED_P (vars) = 1; - } - - /* Always make vtables weak. */ - if (flag_weak) - comdat_linkage (vars); - - rest_of_decl_compilation (vars, NULL_PTR, 1, 1); - - if (flag_vtable_gc) - output_vtable_inherit (vars); - - return 1; - } - else if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars))) - /* We don't know what to do with this one yet. */ - return 0; - - *t = TREE_CHAIN (vars); - return 0; -} - -static int -prune_vtable_vardecl (t, data) - tree *t; - void *data ATTRIBUTE_UNUSED; -{ - *t = TREE_CHAIN (*t); - return 1; -} - -static int -finish_sigtable_vardecl (t, data) - tree *t; - void *data ATTRIBUTE_UNUSED; -{ - /* We don't need to mark sigtable entries as addressable here as is done - for vtables. Since sigtables, unlike vtables, are always written out, - that was already done in build_signature_table_constructor. */ - - rest_of_decl_compilation (*t, NULL_PTR, 1, 1); - *t = TREE_CHAIN (*t); - return 1; -} - -/* Determines the proper settings of TREE_PUBLIC and DECL_EXTERNAL for an - inline function or template instantiation at end-of-file. */ - -void -import_export_decl (decl) - tree decl; -{ - if (DECL_INTERFACE_KNOWN (decl)) - return; - - if (DECL_TEMPLATE_INSTANTIATION (decl) - || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl)) - { - DECL_NOT_REALLY_EXTERN (decl) = 1; - if ((DECL_IMPLICIT_INSTANTIATION (decl) - || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl)) - && (flag_implicit_templates - || (flag_implicit_inline_templates && DECL_THIS_INLINE (decl)))) - { - if (!TREE_PUBLIC (decl)) - /* Templates are allowed to have internal linkage. See - [basic.link]. */ - ; - else - comdat_linkage (decl); - } - else - DECL_NOT_REALLY_EXTERN (decl) = 0; - } - else if (DECL_FUNCTION_MEMBER_P (decl)) - { - tree ctype = DECL_CLASS_CONTEXT (decl); - import_export_class (ctype); - if (CLASSTYPE_INTERFACE_KNOWN (ctype) - && (! DECL_ARTIFICIAL (decl) || DECL_VINDEX (decl))) - { - DECL_NOT_REALLY_EXTERN (decl) - = ! (CLASSTYPE_INTERFACE_ONLY (ctype) - || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines - && !DECL_VINDEX (decl))); - - /* Always make artificials weak. */ - if (DECL_ARTIFICIAL (decl) && flag_weak) - comdat_linkage (decl); - else - maybe_make_one_only (decl); - } - else - comdat_linkage (decl); - } - else if (DECL_TINFO_FN_P (decl)) - { - tree ctype = TREE_TYPE (DECL_NAME (decl)); - - if (IS_AGGR_TYPE (ctype)) - import_export_class (ctype); - - if (IS_AGGR_TYPE (ctype) && CLASSTYPE_INTERFACE_KNOWN (ctype) - && TYPE_VIRTUAL_P (ctype) - /* If the type is a cv-qualified variant of a type, then we - must emit the tinfo function in this translation unit - since it will not be emitted when the vtable for the type - is output (which is when the unqualified version is - generated). */ - && same_type_p (ctype, TYPE_MAIN_VARIANT (ctype))) - { - DECL_NOT_REALLY_EXTERN (decl) - = ! (CLASSTYPE_INTERFACE_ONLY (ctype) - || (DECL_THIS_INLINE (decl) && ! flag_implement_inlines - && !DECL_VINDEX (decl))); - - /* Always make artificials weak. */ - if (flag_weak) - comdat_linkage (decl); - } - else if (TYPE_BUILT_IN (ctype) - && same_type_p (ctype, TYPE_MAIN_VARIANT (ctype))) - DECL_NOT_REALLY_EXTERN (decl) = 0; - else - comdat_linkage (decl); - } - else - comdat_linkage (decl); - - DECL_INTERFACE_KNOWN (decl) = 1; -} - -tree -build_cleanup (decl) - tree decl; -{ - tree temp; - tree type = TREE_TYPE (decl); - - if (TREE_CODE (type) == ARRAY_TYPE) - temp = decl; - else - { - mark_addressable (decl); - temp = build1 (ADDR_EXPR, build_pointer_type (type), decl); - } - temp = build_delete (TREE_TYPE (temp), temp, - integer_two_node, - LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0); - return temp; -} - -extern int parse_time, varconst_time; - -static tree -get_sentry (base) - tree base; -{ - tree sname = get_id_2 ("__sn", base); - /* For struct X foo __attribute__((weak)), there is a counter - __snfoo. Since base is already an assembler name, sname should - be globally unique */ - tree sentry = IDENTIFIER_GLOBAL_VALUE (sname); - if (! sentry) - { - push_obstacks_nochange (); - end_temporary_allocation (); - sentry = build_decl (VAR_DECL, sname, integer_type_node); - TREE_PUBLIC (sentry) = 1; - DECL_ARTIFICIAL (sentry) = 1; - TREE_STATIC (sentry) = 1; - TREE_USED (sentry) = 1; - DECL_COMMON (sentry) = 1; - pushdecl_top_level (sentry); - cp_finish_decl (sentry, NULL_TREE, NULL_TREE, 0, 0); - pop_obstacks (); - } - return sentry; -} - -/* Start the process of running a particular set of global constructors - or destructors. Subroutine of do_[cd]tors. */ - -static void -start_objects (method_type, initp) - int method_type, initp; -{ - tree fnname; - char type[10]; - - /* Make ctor or dtor function. METHOD_TYPE may be 'I' or 'D'. */ - - if (initp != DEFAULT_INIT_PRIORITY) - { - char joiner; - -#ifdef JOINER - joiner = JOINER; -#else - joiner = '_'; -#endif - - sprintf (type, "%c%c%.5u", method_type, joiner, initp); - } - else - sprintf (type, "%c", method_type); - - fnname = get_file_function_name_long (type); - - start_function (void_list_node, - make_call_declarator (fnname, void_list_node, NULL_TREE, - NULL_TREE), - NULL_TREE, 0); - -#if defined(ASM_OUTPUT_CONSTRUCTOR) && defined(ASM_OUTPUT_DESTRUCTOR) - /* It can be a static function as long as collect2 does not have - to scan the object file to find its ctor/dtor routine. */ - TREE_PUBLIC (current_function_decl) = 0; -#endif - - store_parm_decls (); - pushlevel (0); - clear_last_expr (); - push_momentary (); - expand_start_bindings (0); - - /* We cannot allow these functions to be elided, even if they do not - have external linkage. And, there's no point in deferring - copmilation of thes functions; they're all going to have to be - out anyhow. */ - current_function_cannot_inline - = "static constructors and destructors cannot be inlined"; -} - -/* Finish the process of running a particular set of global constructors - or destructors. Subroutine of do_[cd]tors. */ - -static void -finish_objects (method_type, initp) - int method_type, initp; -{ - char *fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); - - /* Finish up. */ - expand_end_bindings (getdecls (), 1, 0); - poplevel (1, 0, 0); - pop_momentary (); - finish_function (lineno, 0, 0); - - if (initp == DEFAULT_INIT_PRIORITY) - { - if (method_type == 'I') - assemble_constructor (fnname); - else - assemble_destructor (fnname); - } - -#if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR) - /* If we're using init priority we can't use assemble_*tor, but on ELF - targets we can stick the references into named sections for GNU ld - to collect. */ - else - { - char buf[15]; - sprintf (buf, ".%ctors.%.5u", method_type == 'I' ? 'c' : 'd', - /* invert the numbering so the linker puts us in the proper - order; constructors are run from right to left, and the - linker sorts in increasing order. */ - MAX_INIT_PRIORITY - initp); - named_section (NULL_TREE, buf, 0); - assemble_integer (gen_rtx_SYMBOL_REF (Pmode, fnname), - POINTER_SIZE / BITS_PER_UNIT, 1); - } -#endif -} - -/* The names of the parameters to the function created to handle - initializations and destructions for objects with static storage - duration. */ -#define INITIALIZE_P_IDENTIFIER "__initialize_p" -#define PRIORITY_IDENTIFIER "__priority" - -/* The name of the function we create to handle initializations and - destructions for objects with static storage duration. */ -#define SSDF_IDENTIFIER "__static_initialization_and_destruction" - -/* The declaration for the __INITIALIZE_P argument. */ -static tree initialize_p_decl; - -/* The declaration for the __PRIORITY argument. */ -static tree priority_decl; - -/* The declaration for the static storage duration function. */ -static tree ssdf_decl; - -/* All the static storage duration functions created in this - translation unit. */ -static varray_type ssdf_decls; -static size_t ssdf_decls_used; - -/* A map from priority levels to information about that priority - level. There may be many such levels, so efficient lookup is - important. */ -static splay_tree priority_info_map; - -/* Begins the generation of the function that will handle all - initialization and destruction of objects with static storage - duration. The function generated takes two parameters of type - `int': __INITIALIZE_P and __PRIORITY. If __INITIALIZE_P is - non-zero, it performs initializations. Otherwise, it performs - destructions. It only performs those initializations or - destructions with the indicated __PRIORITY. The generated function - returns no value. - - It is assumed that this function will only be called once per - translation unit. */ - -static void -start_static_storage_duration_function () -{ - static unsigned ssdf_number; - - tree parm_types; - tree type; - char id[sizeof (SSDF_IDENTIFIER) + 1 /* '\0' */ + 32]; - - /* Create the identifier for this function. It will be of the form - SSDF_IDENTIFIER_. */ - sprintf (id, "%s_%u", SSDF_IDENTIFIER, ssdf_number++); - if (ssdf_number == 0) - { - /* Overflow occurred. That means there are at least 4 billion - initialization functions. */ - sorry ("too many initialization functions required"); - my_friendly_abort (19990430); - } - - /* Create the parameters. */ - parm_types = void_list_node; - parm_types = perm_tree_cons (NULL_TREE, integer_type_node, parm_types); - parm_types = perm_tree_cons (NULL_TREE, integer_type_node, parm_types); - type = build_function_type (void_type_node, parm_types); - - /* Create the FUNCTION_DECL itself. */ - ssdf_decl = build_lang_decl (FUNCTION_DECL, - get_identifier (id), - type); - TREE_PUBLIC (ssdf_decl) = 0; - DECL_ARTIFICIAL (ssdf_decl) = 1; - - /* Put this function in the list of functions to be called from the - static constructors and destructors. */ - if (!ssdf_decls) - { - VARRAY_TREE_INIT (ssdf_decls, 32, "ssdf_decls"); - - /* Take this opportunity to initialize the map from priority - numbers to information about that priority level. */ - priority_info_map = splay_tree_new (splay_tree_compare_ints, - /*delete_key_fn=*/0, - /*delete_value_fn=*/ - (splay_tree_delete_value_fn) &free); - - /* We always need to generate functions for the - DEFAULT_INIT_PRIORITY so enter it now. That way when we walk - priorities later, we'll be sure to find the - DEFAULT_INIT_PRIORITY. */ - get_priority_info (DEFAULT_INIT_PRIORITY); - } - - if (ssdf_decls_used == ssdf_decls->num_elements) - VARRAY_GROW (ssdf_decls, 2 * ssdf_decls_used); - VARRAY_TREE (ssdf_decls, ssdf_decls_used) = ssdf_decl; - ++ssdf_decls_used; - - /* Create the argument list. */ - initialize_p_decl = build_decl (PARM_DECL, - get_identifier (INITIALIZE_P_IDENTIFIER), - integer_type_node); - DECL_CONTEXT (initialize_p_decl) = ssdf_decl; - DECL_ARG_TYPE (initialize_p_decl) = integer_type_node; - TREE_USED (initialize_p_decl) = 1; - priority_decl = build_decl (PARM_DECL, get_identifier (PRIORITY_IDENTIFIER), - integer_type_node); - DECL_CONTEXT (priority_decl) = ssdf_decl; - DECL_ARG_TYPE (priority_decl) = integer_type_node; - TREE_USED (priority_decl) = 1; - - TREE_CHAIN (initialize_p_decl) = priority_decl; - DECL_ARGUMENTS (ssdf_decl) = initialize_p_decl; - - /* Start the function itself. This is equivalent to declarating the - function as: - - static void __ssdf (int __initialize_p, init __priority_p); - - It is static because we only need to call this function from the - various constructor and destructor functions for this module. */ - start_function (/*specs=*/NULL_TREE, - ssdf_decl, - /*attrs=*/NULL_TREE, - /*pre_parsed_p=*/1); - - /* Set up the scope of the outermost block in the function. */ - store_parm_decls (); - pushlevel (0); - clear_last_expr (); - push_momentary (); - expand_start_bindings (0); - - /* This function must not be deferred because we are depending on - its compilation to tell us what is TREE_SYMBOL_REFERENCED. */ - current_function_cannot_inline - = "static storage duration functions cannot be inlined"; -} - -/* Generate the initialization code for the priority indicated in N. */ - -static int -generate_inits_for_priority (n, data) - splay_tree_node n; - void *data ATTRIBUTE_UNUSED; -{ - int priority = (int) n->key; - priority_info pi = (priority_info) n->value; - - /* For each priority N which has been used generate code which looks - like: - - if (__priority == N) { - if (__initialize_p) - ... - else - ... - } - - We use the sequences we've accumulated to fill in the `...'s. */ - expand_start_cond (build_binary_op (EQ_EXPR, - priority_decl, - build_int_2 (priority, 0)), - /*exit_flag=*/0); - - /* Do the initializations. */ - expand_start_cond (build_binary_op (NE_EXPR, - initialize_p_decl, - integer_zero_node), - /*exit_flag=*/0); - if (pi->initialization_sequence) - { - rtx insns; - - push_to_sequence (pi->initialization_sequence); - insns = gen_sequence (); - end_sequence (); - - emit_insn (insns); - pi->initialization_sequence = NULL_RTX; - pi->initializations_p = 1; - } - - /* Do the destructions. */ - expand_start_else (); - if (pi->destruction_sequence) - { - rtx insns; - - push_to_sequence (pi->destruction_sequence); - insns = gen_sequence (); - end_sequence (); - - emit_insn (insns); - pi->destruction_sequence = NULL_RTX; - pi->destructions_p = 1; - } - - /* Close out the conditionals. */ - expand_end_cond (); - expand_end_cond (); - - /* Don't stop iterating. */ - return 0; -} - -/* Finish the generation of the function which performs initialization - and destruction of objects with static storage duration. After - this point, no more such objects can be created. */ - -static void -finish_static_storage_duration_function () -{ - splay_tree_foreach (priority_info_map, - generate_inits_for_priority, - /*data=*/0); - - /* Close out the function. */ - expand_end_bindings (getdecls (), 1, 0); - poplevel (1, 0, 0); - pop_momentary (); - finish_function (lineno, 0, 0); -} - -/* Return the information about the indicated PRIORITY level. If no - code to handle this level has yet been generated, generate the - appropriate prologue. */ - -static priority_info -get_priority_info (priority) - int priority; -{ - priority_info pi; - splay_tree_node n; - - n = splay_tree_lookup (priority_info_map, - (splay_tree_key) priority); - if (!n) - { - /* Create a new priority information structure, and insert it - into the map. */ - pi = (priority_info) xmalloc (sizeof (struct priority_info_s)); - pi->initialization_sequence = NULL_RTX; - pi->destruction_sequence = NULL_RTX; - pi->initializations_p = 0; - pi->destructions_p = 0; - splay_tree_insert (priority_info_map, - (splay_tree_key) priority, - (splay_tree_value) pi); - } - else - pi = (priority_info) n->value; - - return pi; -} - -/* Generate code to do the static initialization of DECL. The - initialization is INIT. If DECL may be initialized more than once - in different object files, SENTRY is the guard variable to - check. PRIORITY is the priority for the initialization. */ - -static void -do_static_initialization (decl, init, sentry, priority) - tree decl; - tree init; - tree sentry; - int priority; -{ - priority_info pi; - - /* Get the priority information for this PRIORITY, */ - pi = get_priority_info (priority); - if (!pi->initialization_sequence) - start_sequence (); - else - push_to_sequence (pi->initialization_sequence); - - /* Tell the debugger that we are at the location of the static - variable in question. */ - emit_note (input_filename, lineno); - - /* If there's a SENTRY, we only do the initialization if it is - zero, i.e., if we are the first to initialize it. */ - if (sentry) - expand_start_cond (build_binary_op (EQ_EXPR, - build_unary_op (PREINCREMENT_EXPR, - sentry, - /*noconvert=*/0), - integer_one_node), - /*exit_flag=*/0); - - /* Prepare a binding level for temporaries created during the - initialization. */ - expand_start_target_temps (); - - if (IS_AGGR_TYPE (TREE_TYPE (decl)) - || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) - expand_aggr_init (decl, init, 0); - else if (TREE_CODE (init) == TREE_VEC) - expand_expr (expand_vec_init (decl, TREE_VEC_ELT (init, 0), - TREE_VEC_ELT (init, 1), - TREE_VEC_ELT (init, 2), 0), - const0_rtx, VOIDmode, EXPAND_NORMAL); - else - expand_assignment (decl, init, 0, 0); - - /* The expression might have involved increments and decrements. */ - emit_queue (); - - /* Cleanup any temporaries needed for the initial value. */ - expand_end_target_temps (); - - /* Cleanup any deferred pops from function calls. This would be done - by expand_end_cond, but we also need it when !SENTRY, since we are - constructing these sequences by parts. */ - do_pending_stack_adjust (); - - /* Close the conditional opened above. */ - if (sentry) - expand_end_cond (); - - /* Save the sequence for later use. */ - pi->initialization_sequence = get_insns (); - end_sequence (); -} - -/* Generate code to do the static destruction of DECL. If DECL may be - initialized more than once in different object files, SENTRY is the - guard variable to check. PRIORITY is the priority for the - destruction. */ - -static void -do_static_destruction (decl, sentry, priority) - tree decl; - tree sentry; - int priority; -{ - rtx new_insns; - priority_info pi; - - /* If we don't need a destructor, there's nothing to do. */ - if (!TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (decl))) - return; - - /* Get the priority information for this PRIORITY, */ - pi = get_priority_info (priority); - if (!pi->destruction_sequence) - start_sequence (); - else - push_to_sequence (pi->destruction_sequence); - - /* Start a new sequence to handle just this destruction. */ - start_sequence (); - - /* Tell the debugger that we are at the location of the static - variable in question. */ - emit_note (input_filename, lineno); - - /* If there's a SENTRY, we only do the destruction if it is one, - i.e., if we are the last to destroy it. */ - if (sentry) - expand_start_cond (build_binary_op (EQ_EXPR, - build_unary_op (PREDECREMENT_EXPR, - sentry, - /*nonconvert=*/1), - integer_zero_node), - /*exit_flag=*/0); - - /* Actually to the destruction. */ - expand_expr_stmt (build_cleanup (decl)); - - /* Cleanup any deferred pops from function calls. This would be done - by expand_end_cond, but we also need it when !SENTRY, since we are - constructing these sequences by parts. */ - do_pending_stack_adjust (); - - /* Close the conditional opened above. */ - if (sentry) - expand_end_cond (); - - /* Insert the NEW_INSNS before the current insns. (Destructions are - run in reverse order of initializations.) */ - new_insns = gen_sequence (); - end_sequence (); - if (pi->destruction_sequence) - emit_insn_before (new_insns, pi->destruction_sequence); - else - emit_insn (new_insns); - - /* Save the sequence for later use. */ - pi->destruction_sequence = get_insns (); - end_sequence (); -} - -/* Add code to the static storage duration function that will handle - DECL (a static variable that needs initializing and/or destruction) - with the indicated PRIORITY. If DECL needs initializing, INIT is - the initializer. */ - -static void -do_static_initialization_and_destruction (decl, init) - tree decl; - tree init; -{ - tree sentry = NULL_TREE; - int priority; - - /* Deal gracefully with error. */ - if (decl == error_mark_node) - return; - - /* The only things that can be initialized are variables. */ - my_friendly_assert (TREE_CODE (decl) == VAR_DECL, 19990420); - - /* If this object is not defined, we don't need to do anything - here. */ - if (DECL_EXTERNAL (decl)) - return; - - /* Also, if the initializer already contains errors, we can bail out - now. */ - if (init && TREE_CODE (init) == TREE_LIST - && value_member (error_mark_node, init)) - return; - - /* Trick the compiler into thinking we are at the file and line - where DECL was declared so that error-messages make sense, and so - that the debugger will show somewhat sensible file and line - information. */ - input_filename = DECL_SOURCE_FILE (decl); - lineno = DECL_SOURCE_LINE (decl); - - /* Because of: - - [class.access.spec] - - Access control for implicit calls to the constructors, - the conversion functions, or the destructor called to - create and destroy a static data member is performed as - if these calls appeared in the scope of the member's - class. - - we pretend we are in a static member function of the class of - which the DECL is a member. */ - if (member_p (decl)) - { - DECL_CLASS_CONTEXT (current_function_decl) = DECL_CONTEXT (decl); - DECL_STATIC_FUNCTION_P (current_function_decl) = 1; - } - - /* We need a sentry if this is an object with external linkage that - might be initialized in more than one place. */ - if (TREE_PUBLIC (decl) && (DECL_COMMON (decl) - || DECL_ONE_ONLY (decl) - || DECL_WEAK (decl))) - sentry = get_sentry (DECL_ASSEMBLER_NAME (decl)); - - /* Generate the code to actually do the intialization and - destruction. */ - priority = DECL_INIT_PRIORITY (decl); - if (!priority) - priority = DEFAULT_INIT_PRIORITY; - do_static_initialization (decl, init, sentry, priority); - do_static_destruction (decl, sentry, priority); - - /* Now that we're done with DECL we don't need to pretend to be a - member of its class any longer. */ - DECL_CLASS_CONTEXT (current_function_decl) = NULL_TREE; - DECL_STATIC_FUNCTION_P (current_function_decl) = 0; -} - -/* Generate a static constructor (if CONSTRUCTOR_P) or destructor - (otherwise) that will initialize all gobal objects with static - storage duration having the indicated PRIORITY. */ - -static void -generate_ctor_or_dtor_function (constructor_p, priority) - int constructor_p; - int priority; -{ - char function_key; - tree arguments; - size_t i; - - /* We use `I' to indicate initialization and `D' to indicate - destruction. */ - if (constructor_p) - function_key = 'I'; - else - function_key = 'D'; - - /* Begin the function. */ - start_objects (function_key, priority); - - /* Call the static storage duration function with appropriate - arguments. */ - for (i = 0; i < ssdf_decls_used; ++i) - { - arguments = tree_cons (NULL_TREE, build_int_2 (priority, 0), - NULL_TREE); - arguments = tree_cons (NULL_TREE, build_int_2 (constructor_p, 0), - arguments); - expand_expr_stmt (build_function_call (VARRAY_TREE (ssdf_decls, i), - arguments)); - } - - /* If we're generating code for the DEFAULT_INIT_PRIORITY, throw in - calls to any functions marked with attributes indicating that - they should be called at initialization- or destruction-time. */ - if (priority == DEFAULT_INIT_PRIORITY) - { - tree fns; - - for (fns = constructor_p ? static_ctors : static_dtors; - fns; - fns = TREE_CHAIN (fns)) - expand_expr_stmt (build_function_call (TREE_VALUE (fns), NULL_TREE)); - } - - /* Close out the function. */ - finish_objects (function_key, priority); -} - -/* Generate constructor and destructor functions for the priority - indicated by N. */ - -static int -generate_ctor_and_dtor_functions_for_priority (n, data) - splay_tree_node n; - void *data ATTRIBUTE_UNUSED; -{ - int priority = (int) n->key; - priority_info pi = (priority_info) n->value; - - /* Generate the functions themselves, but only if they are really - needed. */ - if (pi->initializations_p - || (priority == DEFAULT_INIT_PRIORITY && static_ctors)) - generate_ctor_or_dtor_function (/*constructor_p=*/1, - priority); - if (pi->destructions_p - || (priority == DEFAULT_INIT_PRIORITY && static_dtors)) - generate_ctor_or_dtor_function (/*constructor_p=*/0, - priority); - - /* Keep iterating. */ - return 0; -} - -/* This routine is called from the last rule in yyparse (). - Its job is to create all the code needed to initialize and - destroy the global aggregates. We do the destruction - first, since that way we only need to reverse the decls once. */ - -void -finish_file () -{ - extern int lineno; - int start_time, this_time; - tree vars; - int reconsider; - size_t i; - - at_eof = 1; - - /* Bad parse errors. Just forget about it. */ - if (! global_bindings_p () || current_class_type || decl_namespace_list) - return; - - start_time = get_run_time (); - - /* Otherwise, GDB can get confused, because in only knows - about source for LINENO-1 lines. */ - lineno -= 1; - - interface_unknown = 1; - interface_only = 0; - - /* We now have to write out all the stuff we put off writing out. - These include: - - o Template specializations that we have not yet instantiated, - but which are needed. - o Initialization and destruction for non-local objects with - static storage duration. (Local objects with static storage - duration are initialized when their scope is first entered, - and are cleaned up via atexit.) - o Virtual function tables. - - All of these may cause others to be needed. For example, - instantiating one function may cause another to be needed, and - generating the intiailzer for an object may cause templates to be - instantiated, etc., etc. */ - - this_time = get_run_time (); - parse_time -= this_time - start_time; - varconst_time += this_time - start_time; - start_time = get_run_time (); - permanent_allocation (1); - - do - { - /* Non-zero if we need a static storage duration function on - this iteration through the loop. */ - int need_ssdf_p = 0; - - reconsider = 0; - - /* If there are templates that we've put off instantiating, do - them now. */ - instantiate_pending_templates (); - - /* Write out signature-tables and virtual tables as required. - Note that writing out the virtual table for a template class - may cause the instantiation of members of that class. */ - if (flag_handle_signatures - && walk_globals (sigtable_decl_p, - finish_sigtable_vardecl, - /*data=*/0)) - reconsider = 1; - if (walk_globals (vtable_decl_p, - finish_vtable_vardecl, - /*data=*/0)) - reconsider = 1; - - /* The list of objects with static storage duration is built up - in reverse order, so we reverse it here. We also clear - STATIC_AGGREGATES so that any new aggregates added during the - initialization of these will be initialized in the correct - order when we next come around the loop. */ - vars = nreverse (static_aggregates); - static_aggregates = NULL_TREE; - while (vars) - { - if (! TREE_ASM_WRITTEN (TREE_VALUE (vars))) - rest_of_decl_compilation (TREE_VALUE (vars), 0, 1, 1); - if (!need_ssdf_p) - { - /* We need to start a new initialization function each - time through the loop. That's because we need to - know which vtables have been referenced, and - TREE_SYMBOL_REFERENCED isn't computed until a - function is finished, and written out. That's a - deficiency in the back-end. When this is fixed, - these initialization functions could all become - inline, with resulting performance improvements. */ - start_static_storage_duration_function (); - need_ssdf_p = 1; - } - - do_static_initialization_and_destruction (TREE_VALUE (vars), - TREE_PURPOSE (vars)); - reconsider = 1; - vars = TREE_CHAIN (vars); - } - - /* Finish up the static storage duration function for this - round. */ - if (need_ssdf_p) - finish_static_storage_duration_function (); - - /* Go through the various inline functions, and see if any need - synthesizing. */ - for (i = 0; i < saved_inlines_used; ++i) - { - tree decl = VARRAY_TREE (saved_inlines, i); - import_export_decl (decl); - if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl) - && TREE_USED (decl) - && (! DECL_REALLY_EXTERN (decl) || DECL_INLINE (decl))) - { - /* Even though we're already at the top-level, we push - there again. That way, when we pop back a few lines - hence, all of our state is restored. Otherwise, - finish_function doesn't clean things up, and we end - up with CURRENT_FUNCTION_DECL set. */ - push_to_top_level (); - if (DECL_TINFO_FN_P (decl)) - synthesize_tinfo_fn (decl); - else - synthesize_method (decl); - pop_from_top_level (); - reconsider = 1; - } - } - - /* Mark all functions that might deal with exception-handling as - referenced. */ - mark_all_runtime_matches (); - - /* We lie to the back-end, pretending that some functions are - not defined when they really are. This keeps these functions - from being put out unncessarily. But, we must stop lying - when the functions are referenced, or if they are not comdat - since they need to be put out now. */ - for (i = 0; i < saved_inlines_used; ++i) - { - tree decl = VARRAY_TREE (saved_inlines, i); - - if (DECL_NOT_REALLY_EXTERN (decl) - && DECL_INITIAL (decl) - && (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) - || !DECL_COMDAT (decl))) - DECL_EXTERNAL (decl) = 0; - } - - if (saved_inlines_used - && wrapup_global_declarations (&VARRAY_TREE (saved_inlines, 0), - saved_inlines_used)) - reconsider = 1; - if (walk_namespaces (wrapup_globals_for_namespace, /*data=*/0)) - reconsider = 1; - - /* Static data members are just like namespace-scope globals. */ - for (i = 0; i < pending_statics_used; ++i) - { - tree decl = VARRAY_TREE (pending_statics, i); - if (TREE_ASM_WRITTEN (decl)) - continue; - import_export_decl (decl); - if (DECL_NOT_REALLY_EXTERN (decl) && ! DECL_IN_AGGR_P (decl)) - DECL_EXTERNAL (decl) = 0; - } - if (pending_statics - && wrapup_global_declarations (&VARRAY_TREE (pending_statics, 0), - pending_statics_used)) - reconsider = 1; - } - while (reconsider); - - /* We give C linkage to static constructors and destructors. */ - push_lang_context (lang_name_c); - - /* Generate initialization and destruction functions for all - priorities for which they are required. */ - if (priority_info_map) - splay_tree_foreach (priority_info_map, - generate_ctor_and_dtor_functions_for_priority, - /*data=*/0); - - /* We're done with the splay-tree now. */ - if (priority_info_map) - splay_tree_delete (priority_info_map); - - /* We're done with static constructors, so we can go back to "C++" - linkage now. */ - pop_lang_context (); - - /* Now delete from the chain of variables all virtual function tables. - We output them all ourselves, because each will be treated - specially. */ - walk_globals (vtable_decl_p, prune_vtable_vardecl, /*data=*/0); - - /* Now, issue warnings about static, but not defined, functions, - etc. */ - walk_namespaces (wrapup_globals_for_namespace, /*data=*/&reconsider); - - finish_repo (); - - this_time = get_run_time (); - parse_time -= this_time - start_time; - varconst_time += this_time - start_time; - - if (flag_detailed_statistics) - { - dump_tree_statistics (); - dump_time_statistics (); - } -} - -/* This is something of the form 'A()()()()()+1' that has turned out to be an - expr. Since it was parsed like a type, we need to wade through and fix - that. Unfortunately, since operator() is left-associative, we can't use - tail recursion. In the above example, TYPE is `A', and DECL is - `()()()()()'. - - Maybe this shouldn't be recursive, but how often will it actually be - used? (jason) */ - -tree -reparse_absdcl_as_expr (type, decl) - tree type, decl; -{ - /* do build_functional_cast (type, NULL_TREE) at bottom */ - if (TREE_OPERAND (decl, 0) == NULL_TREE) - return build_functional_cast (type, NULL_TREE); - - /* recurse */ - decl = reparse_absdcl_as_expr (type, TREE_OPERAND (decl, 0)); - - decl = build_x_function_call (decl, NULL_TREE, current_class_ref); - - if (TREE_CODE (decl) == CALL_EXPR - && (! TREE_TYPE (decl) - || TREE_CODE (TREE_TYPE (decl)) != VOID_TYPE)) - decl = require_complete_type (decl); - - return decl; -} - -/* This is something of the form `int ((int)(int)(int)1)' that has turned - out to be an expr. Since it was parsed like a type, we need to wade - through and fix that. Since casts are right-associative, we are - reversing the order, so we don't have to recurse. - - In the above example, DECL is the `(int)(int)(int)', and EXPR is the - `1'. */ - -tree -reparse_absdcl_as_casts (decl, expr) - tree decl, expr; -{ - tree type; - - if (TREE_CODE (expr) == CONSTRUCTOR - && TREE_TYPE (expr) == 0) - { - type = groktypename (TREE_VALUE (TREE_OPERAND (decl, 1))); - decl = TREE_OPERAND (decl, 0); - - if (IS_SIGNATURE (type)) - { - error ("cast specifies signature type"); - return error_mark_node; - } - - expr = digest_init (type, expr, (tree *) 0); - if (TREE_CODE (type) == ARRAY_TYPE && TYPE_SIZE (type) == 0) - { - int failure = complete_array_type (type, expr, 1); - if (failure) - my_friendly_abort (78); - } - } - - while (decl) - { - type = groktypename (TREE_VALUE (TREE_OPERAND (decl, 1))); - decl = TREE_OPERAND (decl, 0); - expr = build_c_cast (type, expr); - } - - if (warn_old_style_cast && ! in_system_header - && current_lang_name != lang_name_c) - warning ("use of old-style cast"); - - return expr; -} - -/* Given plain tree nodes for an expression, build up the full semantics. */ - -tree -build_expr_from_tree (t) - tree t; -{ - if (t == NULL_TREE || t == error_mark_node) - return t; - - switch (TREE_CODE (t)) - { - case IDENTIFIER_NODE: - return do_identifier (t, 0, NULL_TREE); - - case LOOKUP_EXPR: - if (LOOKUP_EXPR_GLOBAL (t)) - return do_scoped_id (TREE_OPERAND (t, 0), 0); - else - return do_identifier (TREE_OPERAND (t, 0), 0, NULL_TREE); - - case TEMPLATE_ID_EXPR: - return (lookup_template_function - (build_expr_from_tree (TREE_OPERAND (t, 0)), - build_expr_from_tree (TREE_OPERAND (t, 1)))); - - case INDIRECT_REF: - return build_x_indirect_ref - (build_expr_from_tree (TREE_OPERAND (t, 0)), "unary *"); - - case CAST_EXPR: - return build_functional_cast - (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0))); - - case REINTERPRET_CAST_EXPR: - return build_reinterpret_cast - (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0))); - - case CONST_CAST_EXPR: - return build_const_cast - (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0))); - - case DYNAMIC_CAST_EXPR: - return build_dynamic_cast - (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0))); - - case STATIC_CAST_EXPR: - return build_static_cast - (TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0))); - - case PREDECREMENT_EXPR: - case PREINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - case POSTINCREMENT_EXPR: - case NEGATE_EXPR: - case BIT_NOT_EXPR: - case ABS_EXPR: - case TRUTH_NOT_EXPR: - case ADDR_EXPR: - case CONVERT_EXPR: /* Unary + */ - if (TREE_TYPE (t)) - return t; - return build_x_unary_op (TREE_CODE (t), - build_expr_from_tree (TREE_OPERAND (t, 0))); - - case PLUS_EXPR: - case MINUS_EXPR: - case MULT_EXPR: - case TRUNC_DIV_EXPR: - case CEIL_DIV_EXPR: - case FLOOR_DIV_EXPR: - case ROUND_DIV_EXPR: - case EXACT_DIV_EXPR: - case BIT_AND_EXPR: - case BIT_ANDTC_EXPR: - case BIT_IOR_EXPR: - case BIT_XOR_EXPR: - case TRUNC_MOD_EXPR: - case FLOOR_MOD_EXPR: - case TRUTH_ANDIF_EXPR: - case TRUTH_ORIF_EXPR: - case TRUTH_AND_EXPR: - case TRUTH_OR_EXPR: - case RSHIFT_EXPR: - case LSHIFT_EXPR: - case RROTATE_EXPR: - case LROTATE_EXPR: - case EQ_EXPR: - case NE_EXPR: - case MAX_EXPR: - case MIN_EXPR: - case LE_EXPR: - case GE_EXPR: - case LT_EXPR: - case GT_EXPR: - case MEMBER_REF: - return build_x_binary_op - (TREE_CODE (t), - build_expr_from_tree (TREE_OPERAND (t, 0)), - build_expr_from_tree (TREE_OPERAND (t, 1))); - - case DOTSTAR_EXPR: - return build_m_component_ref - (build_expr_from_tree (TREE_OPERAND (t, 0)), - build_expr_from_tree (TREE_OPERAND (t, 1))); - - case SCOPE_REF: - return build_offset_ref (TREE_OPERAND (t, 0), TREE_OPERAND (t, 1)); - - case ARRAY_REF: - if (TREE_OPERAND (t, 0) == NULL_TREE) - /* new-type-id */ - return build_parse_node (ARRAY_REF, NULL_TREE, - build_expr_from_tree (TREE_OPERAND (t, 1))); - return grok_array_decl (build_expr_from_tree (TREE_OPERAND (t, 0)), - build_expr_from_tree (TREE_OPERAND (t, 1))); - - case SIZEOF_EXPR: - case ALIGNOF_EXPR: - { - tree r = build_expr_from_tree (TREE_OPERAND (t, 0)); - if (TREE_CODE_CLASS (TREE_CODE (r)) != 't') - r = TREE_TYPE (r); - return TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r); - } - - case MODOP_EXPR: - return build_x_modify_expr - (build_expr_from_tree (TREE_OPERAND (t, 0)), - TREE_CODE (TREE_OPERAND (t, 1)), - build_expr_from_tree (TREE_OPERAND (t, 2))); - - case ARROW_EXPR: - return build_x_arrow - (build_expr_from_tree (TREE_OPERAND (t, 0))); - - case NEW_EXPR: - return build_new - (build_expr_from_tree (TREE_OPERAND (t, 0)), - build_expr_from_tree (TREE_OPERAND (t, 1)), - build_expr_from_tree (TREE_OPERAND (t, 2)), - NEW_EXPR_USE_GLOBAL (t)); - - case DELETE_EXPR: - return delete_sanity - (build_expr_from_tree (TREE_OPERAND (t, 0)), - build_expr_from_tree (TREE_OPERAND (t, 1)), - DELETE_EXPR_USE_VEC (t), DELETE_EXPR_USE_GLOBAL (t)); - - case COMPOUND_EXPR: - if (TREE_OPERAND (t, 1) == NULL_TREE) - return build_x_compound_expr - (build_expr_from_tree (TREE_OPERAND (t, 0))); - else - my_friendly_abort (42); - - case METHOD_CALL_EXPR: - if (TREE_CODE (TREE_OPERAND (t, 0)) == SCOPE_REF) - { - tree ref = TREE_OPERAND (t, 0); - return build_scoped_method_call - (build_expr_from_tree (TREE_OPERAND (t, 1)), - build_expr_from_tree (TREE_OPERAND (ref, 0)), - TREE_OPERAND (ref, 1), - build_expr_from_tree (TREE_OPERAND (t, 2))); - } - else - { - tree fn = TREE_OPERAND (t, 0); - - /* We can get a TEMPLATE_ID_EXPR here on code like: - - x->f<2>(); - - so we must resolve that. However, we can also get things - like a BIT_NOT_EXPR here, when referring to a destructor, - and things like that are not correctly resolved by - build_expr_from_tree. So, just use build_expr_from_tree - when we really need it. */ - if (TREE_CODE (fn) == TEMPLATE_ID_EXPR) - fn = lookup_template_function - (TREE_OPERAND (fn, 0), - build_expr_from_tree (TREE_OPERAND (fn, 1))); - - return build_method_call - (build_expr_from_tree (TREE_OPERAND (t, 1)), - fn, - build_expr_from_tree (TREE_OPERAND (t, 2)), - NULL_TREE, LOOKUP_NORMAL); - } - - case CALL_EXPR: - if (TREE_CODE (TREE_OPERAND (t, 0)) == SCOPE_REF) - { - tree ref = TREE_OPERAND (t, 0); - return build_member_call - (build_expr_from_tree (TREE_OPERAND (ref, 0)), - TREE_OPERAND (ref, 1), - build_expr_from_tree (TREE_OPERAND (t, 1))); - } - else - { - tree name = TREE_OPERAND (t, 0); - tree id; - tree args = build_expr_from_tree (TREE_OPERAND (t, 1)); - if (args != NULL_TREE && TREE_CODE (name) == LOOKUP_EXPR - && !LOOKUP_EXPR_GLOBAL (name) - && TREE_CODE ((id = TREE_OPERAND (name, 0))) == IDENTIFIER_NODE - && (!current_class_type - || !lookup_member (current_class_type, id, 0, 0))) - { - /* Do Koenig lookup if there are no class members. */ - name = do_identifier (id, 0, args); - } - else if (TREE_CODE (name) == TEMPLATE_ID_EXPR - || ! really_overloaded_fn (name)) - name = build_expr_from_tree (name); - return build_x_function_call (name, args, current_class_ref); - } - - case COND_EXPR: - return build_x_conditional_expr - (build_expr_from_tree (TREE_OPERAND (t, 0)), - build_expr_from_tree (TREE_OPERAND (t, 1)), - build_expr_from_tree (TREE_OPERAND (t, 2))); - - case TREE_LIST: - { - tree purpose, value, chain; - - if (t == void_list_node) - return t; - - purpose = TREE_PURPOSE (t); - if (purpose) - purpose = build_expr_from_tree (purpose); - value = TREE_VALUE (t); - if (value) - value = build_expr_from_tree (value); - chain = TREE_CHAIN (t); - if (chain && chain != void_type_node) - chain = build_expr_from_tree (chain); - return expr_tree_cons (purpose, value, chain); - } - - case COMPONENT_REF: - { - tree object = build_expr_from_tree (TREE_OPERAND (t, 0)); - tree field = TREE_OPERAND (t, 1); - - /* We use a COMPONENT_REF to indicate things of the form `x.b' - and `x.A::b'. We must distinguish between those cases - here. */ - if (TREE_CODE (field) == SCOPE_REF) - return build_object_ref (object, - TREE_OPERAND (field, 0), - TREE_OPERAND (field, 1)); - else - return build_x_component_ref (object, field, - NULL_TREE, 1); - } - - case THROW_EXPR: - return build_throw (build_expr_from_tree (TREE_OPERAND (t, 0))); - - case CONSTRUCTOR: - { - tree r; - - /* digest_init will do the wrong thing if we let it. */ - if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))) - return t; - - r = build_nt (CONSTRUCTOR, NULL_TREE, - build_expr_from_tree (CONSTRUCTOR_ELTS (t))); - TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t); - - if (TREE_TYPE (t)) - return digest_init (TREE_TYPE (t), r, 0); - return r; - } - - case TYPEID_EXPR: - if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 0))) == 't') - return get_typeid (TREE_OPERAND (t, 0)); - return build_x_typeid (build_expr_from_tree (TREE_OPERAND (t, 0))); - - case VAR_DECL: - return convert_from_reference (t); - - default: - return t; - } -} - -/* This is something of the form `int (*a)++' that has turned out to be an - expr. It was only converted into parse nodes, so we need to go through - and build up the semantics. Most of the work is done by - build_expr_from_tree, above. - - In the above example, TYPE is `int' and DECL is `*a'. */ - -tree -reparse_decl_as_expr (type, decl) - tree type, decl; -{ - decl = build_expr_from_tree (decl); - if (type) - return build_functional_cast (type, build_expr_list (NULL_TREE, decl)); - else - return decl; -} - -/* This is something of the form `int (*a)' that has turned out to be a - decl. It was only converted into parse nodes, so we need to do the - checking that make_{pointer,reference}_declarator do. */ - -tree -finish_decl_parsing (decl) - tree decl; -{ - extern int current_class_depth; - - switch (TREE_CODE (decl)) - { - case IDENTIFIER_NODE: - return decl; - case INDIRECT_REF: - return make_pointer_declarator - (NULL_TREE, finish_decl_parsing (TREE_OPERAND (decl, 0))); - case ADDR_EXPR: - return make_reference_declarator - (NULL_TREE, finish_decl_parsing (TREE_OPERAND (decl, 0))); - case BIT_NOT_EXPR: - TREE_OPERAND (decl, 0) = finish_decl_parsing (TREE_OPERAND (decl, 0)); - return decl; - case SCOPE_REF: - push_nested_class (TREE_TYPE (TREE_OPERAND (decl, 0)), 3); - TREE_COMPLEXITY (decl) = current_class_depth; - return decl; - case ARRAY_REF: - TREE_OPERAND (decl, 0) = finish_decl_parsing (TREE_OPERAND (decl, 0)); - return decl; - case TREE_LIST: - /* For attribute handling. */ - TREE_VALUE (decl) = finish_decl_parsing (TREE_VALUE (decl)); - return decl; - default: - my_friendly_abort (5); - return NULL_TREE; - } -} - -tree -check_cp_case_value (value) - tree value; -{ - if (value == NULL_TREE) - return value; - - /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */ - STRIP_TYPE_NOPS (value); - - if (TREE_READONLY_DECL_P (value)) - { - value = decl_constant_value (value); - STRIP_TYPE_NOPS (value); - } - value = fold (value); - - if (TREE_CODE (value) != INTEGER_CST - && value != error_mark_node) - { - cp_error ("case label `%E' does not reduce to an integer constant", - value); - value = error_mark_node; - } - else - /* Promote char or short to int. */ - value = default_conversion (value); - - constant_expression_warning (value); - - return value; -} - -/* Return 1 if root encloses child. */ - -static int -is_namespace_ancestor (root, child) - tree root, child; -{ - if (root == child) - return 1; - if (root == global_namespace) - return 1; - if (child == global_namespace) - return 0; - return is_namespace_ancestor (root, CP_DECL_CONTEXT (child)); -} - - -/* Return the namespace that is the common ancestor - of two given namespaces. */ - -tree -namespace_ancestor (ns1, ns2) - tree ns1, ns2; -{ - if (is_namespace_ancestor (ns1, ns2)) - return ns1; - return namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2); -} - -/* Insert used into the using list of user. Set indirect_flag if this - directive is not directly from the source. Also find the common - ancestor and let our users know about the new namespace */ -static void -add_using_namespace (user, used, indirect) - tree user; - tree used; - int indirect; -{ - tree t; - /* Using oneself is a no-op. */ - if (user == used) - return; - my_friendly_assert (TREE_CODE (user) == NAMESPACE_DECL, 380); - my_friendly_assert (TREE_CODE (used) == NAMESPACE_DECL, 380); - /* Check if we already have this. */ - t = purpose_member (used, DECL_NAMESPACE_USING (user)); - if (t != NULL_TREE) - { - if (!indirect) - /* Promote to direct usage. */ - TREE_INDIRECT_USING (t) = 0; - return; - } - - /* Add used to the user's using list. */ - DECL_NAMESPACE_USING (user) - = perm_tree_cons (used, namespace_ancestor (user, used), - DECL_NAMESPACE_USING (user)); - - TREE_INDIRECT_USING (DECL_NAMESPACE_USING (user)) = indirect; - - /* Add user to the used's users list. */ - DECL_NAMESPACE_USERS (used) - = perm_tree_cons (user, 0, DECL_NAMESPACE_USERS (used)); - - /* Recursively add all namespaces used. */ - for (t = DECL_NAMESPACE_USING (used); t; t = TREE_CHAIN (t)) - /* indirect usage */ - add_using_namespace (user, TREE_PURPOSE (t), 1); - - /* Tell everyone using us about the new used namespaces. */ - for (t = DECL_NAMESPACE_USERS (user); t; t = TREE_CHAIN (t)) - add_using_namespace (TREE_PURPOSE (t), used, 1); -} - -/* Combines two sets of overloaded functions into an OVERLOAD chain, removing - duplicates. The first list becomes the tail of the result. - - The algorithm is O(n^2). We could get this down to O(n log n) by - doing a sort on the addresses of the functions, if that becomes - necessary. */ - -static tree -merge_functions (s1, s2) - tree s1; - tree s2; -{ - for (; s2; s2 = OVL_NEXT (s2)) - { - tree fn = OVL_CURRENT (s2); - if (! ovl_member (fn, s1)) - s1 = build_overload (fn, s1); - } - return s1; -} - -/* This should return an error not all definitions define functions. - It is not an error if we find two functions with exactly the - same signature, only if these are selected in overload resolution. - old is the current set of bindings, new the freshly-found binding. - XXX Do we want to give *all* candidates in case of ambiguity? - XXX In what way should I treat extern declarations? - XXX I don't want to repeat the entire duplicate_decls here */ - -static tree -ambiguous_decl (name, old, new, flags) - tree name; - tree old; - tree new; - int flags; -{ - tree val, type; - my_friendly_assert (old != NULL_TREE, 393); - /* Copy the value. */ - val = BINDING_VALUE (new); - if (val) - switch (TREE_CODE (val)) - { - case TEMPLATE_DECL: - /* If we expect types or namespaces, and not templates, - or this is not a template class. */ - if (LOOKUP_QUALIFIERS_ONLY (flags) - && !DECL_CLASS_TEMPLATE_P (val)) - val = NULL_TREE; - break; - case TYPE_DECL: - if (LOOKUP_NAMESPACES_ONLY (flags)) - val = NULL_TREE; - break; - case NAMESPACE_DECL: - if (LOOKUP_TYPES_ONLY (flags)) - val = NULL_TREE; - break; - default: - if (LOOKUP_QUALIFIERS_ONLY (flags)) - val = NULL_TREE; - } - - if (!BINDING_VALUE (old)) - BINDING_VALUE (old) = val; - else if (val && val != BINDING_VALUE (old)) - { - if (is_overloaded_fn (BINDING_VALUE (old)) - && is_overloaded_fn (val)) - { - BINDING_VALUE (old) = merge_functions (BINDING_VALUE (old), - val); - } - else - { - /* Some declarations are functions, some are not. */ - if (flags & LOOKUP_COMPLAIN) - { - /* If we've already given this error for this lookup, - BINDING_VALUE (old) is error_mark_node, so let's not - repeat ourselves. */ - if (BINDING_VALUE (old) != error_mark_node) - { - cp_error ("use of `%D' is ambiguous", name); - cp_error_at (" first declared as `%#D' here", - BINDING_VALUE (old)); - } - cp_error_at (" also declared as `%#D' here", val); - } - return error_mark_node; - } - } - /* ... and copy the type. */ - type = BINDING_TYPE (new); - if (LOOKUP_NAMESPACES_ONLY (flags)) - type = NULL_TREE; - if (!BINDING_TYPE (old)) - BINDING_TYPE (old) = type; - else if (type && BINDING_TYPE (old) != type) - { - if (flags & LOOKUP_COMPLAIN) - { - cp_error ("`%D' denotes an ambiguous type",name); - cp_error_at (" first type here", BINDING_TYPE (old)); - cp_error_at (" other type here", type); - } - } - return old; -} - -/* Add the bindings of name in used namespaces to val. - The using list is defined by usings, and the lookup goes to scope. - Returns zero on errors. */ - -int -lookup_using_namespace (name, val, usings, scope, flags) - tree name, val, usings, scope; - int flags; -{ - tree iter; - tree val1; - /* Iterate over all used namespaces in current, searching for using - directives of scope. */ - for (iter = usings; iter; iter = TREE_CHAIN (iter)) - if (TREE_VALUE (iter) == scope) - { - val1 = binding_for_name (name, TREE_PURPOSE (iter)); - /* Resolve ambiguities. */ - val = ambiguous_decl (name, val, val1, flags); - } - return val != error_mark_node; -} - -/* [namespace.qual] - Excepts the name to lookup and its qualifying scope. - Returns the name/type pair found into the CPLUS_BINDING result, - or 0 on error. */ - -int -qualified_lookup_using_namespace (name, scope, result, flags) - tree name; - tree scope; - tree result; - int flags; -{ - /* Maintain a list of namespaces visited... */ - tree seen = NULL_TREE; - /* ... and a list of namespace yet to see. */ - tree todo = NULL_TREE; - tree usings; - while (scope && (result != error_mark_node)) - { - seen = temp_tree_cons (scope, NULL_TREE, seen); - result = ambiguous_decl (name, result, - binding_for_name (name, scope), flags); - if (!BINDING_VALUE (result) && !BINDING_TYPE (result)) - /* Consider using directives. */ - for (usings = DECL_NAMESPACE_USING (scope); usings; - usings = TREE_CHAIN (usings)) - /* If this was a real directive, and we have not seen it. */ - if (!TREE_INDIRECT_USING (usings) - && !purpose_member (TREE_PURPOSE (usings), seen)) - todo = temp_tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo); - if (todo) - { - scope = TREE_PURPOSE (todo); - todo = TREE_CHAIN (todo); - } - else - scope = NULL_TREE; /* If there never was a todo list. */ - } - return result != error_mark_node; -} - -/* [namespace.memdef]/2 */ - -/* Set the context of a declaration to scope. Complain if we are not - outside scope. */ - -void -set_decl_namespace (decl, scope, friendp) - tree decl; - tree scope; - int friendp; -{ - tree old; - if (scope == std_node) - scope = global_namespace; - /* Get rid of namespace aliases. */ - scope = ORIGINAL_NAMESPACE (scope); - - /* It is ok for friends to be qualified in parallel space. */ - if (!friendp && !is_namespace_ancestor (current_namespace, scope)) - cp_error ("declaration of `%D' not in a namespace surrounding `%D'", - decl, scope); - DECL_CONTEXT (decl) = FROB_CONTEXT (scope); - if (scope != current_namespace) - { - /* See whether this has been declared in the namespace. */ - old = namespace_binding (DECL_NAME (decl), scope); - if (!old) - /* No old declaration at all. */ - goto complain; - if (!is_overloaded_fn (decl)) - /* Don't compare non-function decls with decls_match here, - since it can't check for the correct constness at this - point. pushdecl will find those errors later. */ - return; - /* Since decl is a function, old should contain a function decl. */ - if (!is_overloaded_fn (old)) - goto complain; - if (processing_template_decl || processing_specialization) - /* We have not yet called push_template_decl to turn the - FUNCTION_DECL into a TEMPLATE_DECL, so the declarations - won't match. But, we'll check later, when we construct the - template. */ - return; - for (; old; old = OVL_NEXT (old)) - if (decls_match (decl, OVL_CURRENT (old))) - return; - } - else - return; - complain: - cp_error ("`%D' should have been declared inside `%D'", - decl, scope); -} - -/* Compute the namespace where a declaration is defined. */ - -static tree -decl_namespace (decl) - tree decl; -{ - while (DECL_CONTEXT (decl)) - { - decl = DECL_CONTEXT (decl); - if (TREE_CODE (decl) == NAMESPACE_DECL) - return decl; - if (TREE_CODE_CLASS (TREE_CODE (decl)) == 't') - decl = TYPE_STUB_DECL (decl); - my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd', 390); - } - - return global_namespace; -} - -/* Return the namespace where the current declaration is declared. */ - -tree -current_decl_namespace () -{ - tree result; - /* If we have been pushed into a different namespace, use it. */ - if (decl_namespace_list) - return TREE_PURPOSE (decl_namespace_list); - - if (current_class_type) - result = decl_namespace (TYPE_STUB_DECL (current_class_type)); - else if (current_function_decl) - result = decl_namespace (current_function_decl); - else - result = current_namespace; - return result; -} - -/* Temporarily set the namespace for the current declaration. */ - -void -push_decl_namespace (decl) - tree decl; -{ - if (TREE_CODE (decl) != NAMESPACE_DECL) - decl = decl_namespace (decl); - decl_namespace_list = tree_cons (decl, NULL_TREE, decl_namespace_list); -} - -void -pop_decl_namespace () -{ - decl_namespace_list = TREE_CHAIN (decl_namespace_list); -} - -/* Enter a class or namespace scope. */ - -void -push_scope (t) - tree t; -{ - if (TREE_CODE (t) == NAMESPACE_DECL) - push_decl_namespace (t); - else - pushclass (t, 2); -} - -/* Leave scope pushed by push_scope. */ - -void -pop_scope (t) - tree t; -{ - if (TREE_CODE (t) == NAMESPACE_DECL) - pop_decl_namespace (); - else - popclass (); -} - -/* [basic.lookup.koenig] */ -/* A non-zero return value in the functions below indicates an error. - All nodes allocated in the procedure are on the scratch obstack. */ - -struct arg_lookup -{ - tree name; - tree namespaces; - tree classes; - tree functions; -}; - -static int arg_assoc PROTO((struct arg_lookup*, tree)); -static int arg_assoc_args PROTO((struct arg_lookup*, tree)); -static int arg_assoc_type PROTO((struct arg_lookup*, tree)); -static int add_function PROTO((struct arg_lookup *, tree)); -static int arg_assoc_namespace PROTO((struct arg_lookup *, tree)); -static int arg_assoc_class PROTO((struct arg_lookup *, tree)); - -/* Add a function to the lookup structure. - Returns 1 on error. */ - -static int -add_function (k, fn) - struct arg_lookup *k; - tree fn; -{ - if (ovl_member (fn, k->functions)) - return 0; - /* We must find only functions, or exactly one non-function. */ - if (k->functions && is_overloaded_fn (k->functions) - && is_overloaded_fn (fn)) - k->functions = build_overload (fn, k->functions); - else - if(k->functions) - { - tree f1 = OVL_CURRENT (k->functions); - tree f2 = fn; - if (is_overloaded_fn (f1)) - { - fn = f1; f1 = f2; f2 = fn; - } - cp_error_at ("`%D' is not a function,", f1); - cp_error_at (" conflict with `%D'", f2); - cp_error (" in call to `%D'", k->name); - return 1; - } - else - k->functions = fn; - return 0; -} - -/* Add functions of a namespace to the lookup structure. - Returns 1 on error. */ - -static int -arg_assoc_namespace (k, scope) - struct arg_lookup *k; - tree scope; -{ - tree value; - - if (purpose_member (scope, k->namespaces)) - return 0; - k->namespaces = tree_cons (scope, NULL_TREE, k->namespaces); - - value = namespace_binding (k->name, scope); - if (!value) - return 0; - - for (; value; value = OVL_NEXT (value)) - if (add_function (k, OVL_CURRENT (value))) - return 1; - - return 0; -} - -/* Adds everything associated with class to the lookup structure. - Returns 1 on error. */ - -static int -arg_assoc_class (k, type) - struct arg_lookup* k; - tree type; -{ - tree list, friends, context; - int i; - - if (purpose_member (type, k->classes)) - return 0; - k->classes = tree_cons (type, NULL_TREE, k->classes); - - context = decl_namespace (TYPE_MAIN_DECL (type)); - if (arg_assoc_namespace (k, context)) - return 1; - - /* Process baseclasses. */ - for (i = 0; i < CLASSTYPE_N_BASECLASSES (type); i++) - if (arg_assoc_class (k, TYPE_BINFO_BASETYPE (type, i))) - return 1; - - /* Process friends. */ - for (list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type)); list; - list = TREE_CHAIN (list)) - if (k->name == TREE_PURPOSE (list)) - for (friends = TREE_VALUE (list); friends; - friends = TREE_CHAIN (friends)) - /* Only interested in global functions with potentially hidden - (i.e. unqualified) declarations. */ - if (TREE_PURPOSE (list) == error_mark_node && TREE_VALUE (list) - && decl_namespace (TREE_VALUE (list)) == context) - if (add_function (k, TREE_VALUE (list))) - return 1; - - /* Process template arguments. */ - if (CLASSTYPE_TEMPLATE_INFO (type)) - { - list = innermost_args (CLASSTYPE_TI_ARGS (type)); - for (i = 0; i < TREE_VEC_LENGTH (list); ++i) - arg_assoc (k, TREE_VEC_ELT (list, i)); - } - - return 0; -} - -/* Adds everything associated with a given type. - Returns 1 on error. */ - -static int -arg_assoc_type (k, type) - struct arg_lookup *k; - tree type; -{ - switch (TREE_CODE (type)) - { - case VOID_TYPE: - case INTEGER_TYPE: - case REAL_TYPE: - case COMPLEX_TYPE: - case CHAR_TYPE: - case BOOLEAN_TYPE: - return 0; - case RECORD_TYPE: - if (TYPE_PTRMEMFUNC_P (type)) - return arg_assoc_type (k, TYPE_PTRMEMFUNC_FN_TYPE (type)); - return arg_assoc_class (k, type); - case POINTER_TYPE: - case REFERENCE_TYPE: - case ARRAY_TYPE: - return arg_assoc_type (k, TREE_TYPE (type)); - case UNION_TYPE: - case ENUMERAL_TYPE: - return arg_assoc_namespace (k, decl_namespace (TYPE_MAIN_DECL (type))); - case OFFSET_TYPE: - /* Pointer to member: associate class type and value type. */ - if (arg_assoc_type (k, TYPE_OFFSET_BASETYPE (type))) - return 1; - return arg_assoc_type (k, TREE_TYPE (type)); - case METHOD_TYPE: - /* The basetype is referenced in the first arg type, so just - fall through. */ - case FUNCTION_TYPE: - /* Associate the parameter types. */ - if (arg_assoc_args (k, TYPE_ARG_TYPES (type))) - return 1; - /* Associate the return type. */ - return arg_assoc_type (k, TREE_TYPE (type)); - case TEMPLATE_TYPE_PARM: - case TEMPLATE_TEMPLATE_PARM: - return 0; - case LANG_TYPE: - if (type == unknown_type_node) - return 0; - /* else fall through */ - default: - my_friendly_abort (390); - } - return 0; -} - -/* Adds everything associated with arguments. Returns 1 on error. */ - -static int -arg_assoc_args (k, args) - struct arg_lookup* k; - tree args; -{ - for (; args; args = TREE_CHAIN (args)) - if (arg_assoc (k, TREE_VALUE (args))) - return 1; - return 0; -} - -/* Adds everything associated with a given tree_node. Returns 1 on error. */ - -static int -arg_assoc (k, n) - struct arg_lookup* k; - tree n; -{ - if (n == error_mark_node) - return 0; - - if (TREE_CODE_CLASS (TREE_CODE (n)) == 't') - return arg_assoc_type (k, n); - - if (! type_unknown_p (n)) - return arg_assoc_type (k, TREE_TYPE (n)); - - if (TREE_CODE (n) == ADDR_EXPR) - n = TREE_OPERAND (n, 0); - if (TREE_CODE (n) == COMPONENT_REF) - n = TREE_OPERAND (n, 1); - if (TREE_CODE (n) == OFFSET_REF) - n = TREE_OPERAND (n, 1); - while (TREE_CODE (n) == TREE_LIST) - n = TREE_VALUE (n); - - if (TREE_CODE (n) == FUNCTION_DECL) - return arg_assoc_type (k, TREE_TYPE (n)); - if (TREE_CODE (n) == TEMPLATE_ID_EXPR) - { - /* [basic.lookup.koenig] - - If T is a template-id, its associated namespaces and classes - are the namespace in which the template is defined; for - member templates, the member template's class; the namespaces - and classes associated with the types of the template - arguments provided for template type parameters (excluding - template template parameters); the namespaces in which any - template template arguments are defined; and the classes in - which any member templates used as template template - arguments are defined. [Note: non-type template arguments do - not contribute to the set of associated namespaces. ] */ - tree template = TREE_OPERAND (n, 0); - tree args = TREE_OPERAND (n, 1); - tree ctx; - tree arg; - - /* First, the template. There may actually be more than one if - this is an overloaded function template. But, in that case, - we only need the first; all the functions will be in the same - namespace. */ - template = OVL_CURRENT (template); - - ctx = CP_DECL_CONTEXT (template); - - if (TREE_CODE (ctx) == NAMESPACE_DECL) - { - if (arg_assoc_namespace (k, ctx) == 1) - return 1; - } - /* It must be a member template. */ - else if (arg_assoc_class (k, ctx) == 1) - return 1; - - /* Now the arguments. */ - for (arg = args; arg != NULL_TREE; arg = TREE_CHAIN (arg)) - { - tree t = TREE_VALUE (arg); - - if (TREE_CODE (t) == TEMPLATE_DECL) - { - ctx = CP_DECL_CONTEXT (t); - if (TREE_CODE (ctx) == NAMESPACE_DECL) - { - if (arg_assoc_namespace (k, ctx) == 1) - return 1; - } - else if (arg_assoc_class (k, ctx) == 1) - return 1; - } - else if (TREE_CODE_CLASS (TREE_CODE (t)) == 't' - && arg_assoc_type (k, t) == 1) - return 1; - } - } - else - { - my_friendly_assert (TREE_CODE (n) == OVERLOAD, 980715); - - for (; n; n = OVL_CHAIN (n)) - if (arg_assoc_type (k, TREE_TYPE (OVL_FUNCTION (n)))) - return 1; - } - - return 0; -} - -/* Performs Koenig lookup depending on arguments, where fns - are the functions found in normal lookup. */ - -tree -lookup_arg_dependent (name, fns, args) - tree name; - tree fns; - tree args; -{ - struct arg_lookup k; - - k.name = name; - k.functions = fns; - k.classes = NULL_TREE; - - /* Note that we've already looked at the current namespace during normal - unqualified lookup, unless we found a decl in function scope. */ - if (fns && ! TREE_PERMANENT (OVL_CURRENT (fns))) - k.namespaces = NULL_TREE; - else - k.namespaces = scratch_tree_cons (current_decl_namespace (), - NULL_TREE, NULL_TREE); - - push_scratch_obstack (); - arg_assoc_args (&k, args); - pop_obstacks (); - return k.functions; -} - -/* Process a namespace-alias declaration. */ - -void -do_namespace_alias (alias, namespace) - tree alias, namespace; -{ - if (TREE_CODE (namespace) != NAMESPACE_DECL) - { - /* The parser did not find it, so it's not there. */ - cp_error ("unknown namespace `%D'", namespace); - return; - } - - namespace = ORIGINAL_NAMESPACE (namespace); - - /* Build the alias. */ - alias = build_lang_decl (NAMESPACE_DECL, alias, void_type_node); - DECL_NAMESPACE_ALIAS (alias) = namespace; - pushdecl (alias); -} - -/* Check a non-member using-declaration. Return the name and scope - being used, and the USING_DECL, or NULL_TREE on failure. */ - -static tree -validate_nonmember_using_decl (decl, scope, name) - tree decl; - tree *scope; - tree *name; -{ - if (TREE_CODE (decl) == SCOPE_REF - && TREE_OPERAND (decl, 0) == std_node) - { - if (namespace_bindings_p () - && current_namespace == global_namespace) - /* There's no need for a using declaration at all, here, - since `std' is the same as `::'. We can't just pass this - on because we'll complain later about declaring something - in the same scope as a using declaration with the same - name. We return NULL_TREE which indicates to the caller - that there's no need to do any further processing. */ - return NULL_TREE; - - *scope = global_namespace; - *name = TREE_OPERAND (decl, 1); - } - else if (TREE_CODE (decl) == SCOPE_REF) - { - *scope = TREE_OPERAND (decl, 0); - *name = TREE_OPERAND (decl, 1); - - /* [namespace.udecl] - - A using-declaration for a class member shall be a - member-declaration. */ - if (TREE_CODE (*scope) != NAMESPACE_DECL) - { - if (TYPE_P (*scope)) - cp_error ("`%T' is not a namespace", *scope); - else - cp_error ("`%D' is not a namespace", *scope); - return NULL_TREE; - } - } - else if (TREE_CODE (decl) == IDENTIFIER_NODE - || TREE_CODE (decl) == TYPE_DECL - || TREE_CODE (decl) == TEMPLATE_DECL) - { - *scope = global_namespace; - *name = decl; - } - else - my_friendly_abort (382); - if (TREE_CODE_CLASS (TREE_CODE (*name)) == 'd') - *name = DECL_NAME (*name); - /* Make a USING_DECL. */ - return push_using_decl (*scope, *name); -} - -/* Process local and global using-declarations. */ - -static void -do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype) - tree scope, name; - tree oldval, oldtype; - tree *newval, *newtype; -{ - tree decls; - struct tree_binding _decls; - - *newval = *newtype = NULL_TREE; - decls = binding_init (&_decls); - if (!qualified_lookup_using_namespace (name, scope, decls, 0)) - /* Lookup error */ - return; - - if (!BINDING_VALUE (decls) && !BINDING_TYPE (decls)) - { - cp_error ("`%D' not declared", name); - return; - } - - /* Check for using functions. */ - if (BINDING_VALUE (decls) && is_overloaded_fn (BINDING_VALUE (decls))) - { - tree tmp, tmp1; - - if (oldval && !is_overloaded_fn (oldval)) - { - duplicate_decls (OVL_CURRENT (BINDING_VALUE (decls)), oldval); - oldval = NULL_TREE; - } - - *newval = oldval; - for (tmp = BINDING_VALUE (decls); tmp; tmp = OVL_NEXT (tmp)) - { - tree new_fn = OVL_CURRENT (tmp); - - /* [namespace.udecl] - - If a function declaration in namespace scope or block - scope has the same name and the same parameter types as a - function introduced by a using declaration the program is - ill-formed. */ - for (tmp1 = oldval; tmp1; tmp1 = OVL_NEXT (tmp1)) - { - tree old_fn = OVL_CURRENT (tmp1); - - if (!OVL_USED (tmp1) - && compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)), - TYPE_ARG_TYPES (TREE_TYPE (old_fn)))) - { - /* There was already a non-using declaration in - this scope with the same parameter types. */ - cp_error ("`%D' is already declared in this scope", - name); - break; - } - else if (duplicate_decls (new_fn, old_fn)) - /* We're re-using something we already used - before. We don't need to add it again. */ - break; - } - - /* If we broke out of the loop, there's no reason to add - this function to the using declarations for this - scope. */ - if (tmp1) - continue; - - *newval = build_overload (OVL_CURRENT (tmp), *newval); - if (TREE_CODE (*newval) != OVERLOAD) - *newval = ovl_cons (*newval, NULL_TREE); - OVL_USED (*newval) = 1; - } - } - else - { - *newval = BINDING_VALUE (decls); - if (oldval) - duplicate_decls (*newval, oldval); - } - - *newtype = BINDING_TYPE (decls); - if (oldtype && *newtype && oldtype != *newtype) - { - cp_error ("using directive `%D' introduced ambiguous type `%T'", - name, oldtype); - return; - } -} - -/* Process a using-declaration not appearing in class or local scope. */ - -void -do_toplevel_using_decl (decl) - tree decl; -{ - tree scope, name, binding; - tree oldval, oldtype, newval, newtype; - - decl = validate_nonmember_using_decl (decl, &scope, &name); - if (decl == NULL_TREE) - return; - - binding = binding_for_name (name, current_namespace); - - oldval = BINDING_VALUE (binding); - oldtype = BINDING_TYPE (binding); - - do_nonmember_using_decl (scope, name, oldval, oldtype, &newval, &newtype); - - /* Copy declarations found. */ - if (newval) - BINDING_VALUE (binding) = newval; - if (newtype) - BINDING_TYPE (binding) = newtype; - return; -} - -/* Process a using-declaration at function scope. */ - -void -do_local_using_decl (decl) - tree decl; -{ - tree scope, name; - tree oldval, oldtype, newval, newtype; - - decl = validate_nonmember_using_decl (decl, &scope, &name); - if (decl == NULL_TREE) - return; - - oldval = lookup_name_current_level (name); - oldtype = lookup_type_current_level (name); - - do_nonmember_using_decl (scope, name, oldval, oldtype, &newval, &newtype); - - if (newval) - { - if (is_overloaded_fn (newval)) - { - tree fn, term; - - /* We only need to push declarations for those functions - that were not already bound in the current level. - The old value might be NULL_TREE, it might be a single - function, or an OVERLOAD. */ - if (oldval && TREE_CODE (oldval) == OVERLOAD) - term = OVL_FUNCTION (oldval); - else - term = oldval; - for (fn = newval; fn && OVL_CURRENT (fn) != term; - fn = OVL_NEXT (fn)) - push_overloaded_decl (OVL_CURRENT (fn), - PUSH_LOCAL | PUSH_USING); - } - else - push_local_binding (name, newval, PUSH_USING); - } - if (newtype) - set_identifier_type_value (name, newtype); -} - -tree -do_class_using_decl (decl) - tree decl; -{ - tree name, value; - - if (TREE_CODE (decl) != SCOPE_REF - || TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (decl, 0))) != 't') - { - cp_error ("using-declaration for non-member at class scope"); - return NULL_TREE; - } - name = TREE_OPERAND (decl, 1); - if (TREE_CODE (name) == BIT_NOT_EXPR) - { - cp_error ("using-declaration for destructor"); - return NULL_TREE; - } - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 980716); - - value = build_lang_field_decl (USING_DECL, name, void_type_node); - DECL_INITIAL (value) = TREE_OPERAND (decl, 0); - return value; -} - -/* Process a using-directive. */ - -void -do_using_directive (namespace) - tree namespace; -{ - if (namespace == std_node) - return; - /* using namespace A::B::C; */ - if (TREE_CODE (namespace) == SCOPE_REF) - namespace = TREE_OPERAND (namespace, 1); - if (TREE_CODE (namespace) == IDENTIFIER_NODE) - { - /* Lookup in lexer did not find a namespace. */ - cp_error ("namespace `%T' undeclared", namespace); - return; - } - if (TREE_CODE (namespace) != NAMESPACE_DECL) - { - cp_error ("`%T' is not a namespace", namespace); - return; - } - namespace = ORIGINAL_NAMESPACE (namespace); - if (!toplevel_bindings_p ()) - push_using_directive (namespace); - else - /* direct usage */ - add_using_namespace (current_namespace, namespace, 0); -} - -void -check_default_args (x) - tree x; -{ - tree arg = TYPE_ARG_TYPES (TREE_TYPE (x)); - int saw_def = 0, i = 0 - (TREE_CODE (TREE_TYPE (x)) == METHOD_TYPE); - for (; arg && arg != void_list_node; arg = TREE_CHAIN (arg), ++i) - { - if (TREE_PURPOSE (arg)) - saw_def = 1; - else if (saw_def) - { - cp_error_at ("default argument missing for parameter %P of `%+#D'", - i, x); - break; - } - } -} - -void -mark_used (decl) - tree decl; -{ - TREE_USED (decl) = 1; - if (processing_template_decl) - return; - assemble_external (decl); - - /* Is it a synthesized method that needs to be synthesized? */ - if (TREE_CODE (decl) == FUNCTION_DECL && DECL_CLASS_CONTEXT (decl) - && DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl) - /* Kludge: don't synthesize for default args. */ - && current_function_decl) - synthesize_method (decl); - - /* If this is a function or variable that is an instance of some - template, we now know that we will need to actually do the - instantiation. A TEMPLATE_DECL may also have DECL_TEMPLATE_INFO, - if it's a partial instantiation, but there's no need to - instantiate such a thing. We check that DECL is not an explicit - instantiation because that is not checked in instantiate_decl. */ - if (TREE_CODE (decl) != TEMPLATE_DECL - && DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl) - && !DECL_EXPLICIT_INSTANTIATION (decl)) - instantiate_decl (decl); -} - -/* Helper function for named_class_head_sans_basetype nonterminal. We - have just seen something of the form `AGGR SCOPE::ID'. Return a - TYPE_DECL for the type declared by ID in SCOPE. */ - -tree -handle_class_head (aggr, scope, id) - tree aggr, scope, id; -{ - tree decl; - - if (TREE_CODE (id) == TYPE_DECL) - decl = id; - else if (DECL_CLASS_TEMPLATE_P (id)) - decl = DECL_TEMPLATE_RESULT (id); - else - { - if (scope) - cp_error ("`%T' does not have a nested type named `%D'", scope, id); - else - cp_error ("no file-scope type named `%D'", id); - - decl = TYPE_MAIN_DECL (xref_tag (aggr, make_anon_name (), 1)); - } - - /* This syntax is only allowed when we're defining a type, so we - enter the SCOPE. */ - push_scope (CP_DECL_CONTEXT (decl)); - - /* If we see something like: - - template struct S::I .... - - we must create a TEMPLATE_DECL for the nested type. */ - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - decl = push_template_decl (decl); - - return decl; -} diff --git a/contrib/gcc/cp/edsel.c b/contrib/gcc/cp/edsel.c deleted file mode 100644 index 35099d523f76..000000000000 --- a/contrib/gcc/cp/edsel.c +++ /dev/null @@ -1,928 +0,0 @@ -/* Interface to LUCID Cadillac system for GNU compiler. - Copyright (C) 1988, 1992, 1993 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" - -#include "tree.h" -#include "flags.h" -#include -#include "cp-tree.h" -#include "obstack.h" - -#ifdef CADILLAC -#include -#include -#include -#include -#include -#include - -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -void init_cadillac (); - -extern char *input_filename; -extern int lineno; - -/* Put random information we might want to get back from - Cadillac here. */ -typedef struct -{ - /* The connection to the Cadillac kernel. */ - Connection *conn; - - /* Input and output file descriptors for Cadillac. */ - short fd_input, fd_output; - - /* #include nesting of current file. */ - short depth; - - /* State variables for the connection. */ - char messages; - char conversion; - char emission; - char process_until; - - /* #if level of current file. */ - int iflevel; - - /* Line number that starts current source file. */ - int lineno; - - /* Name of current file. */ - char *filename; - - /* Where to stop processing (if process_until is set). */ - char *end_filename; - int end_position; - -} cadillac_struct; -static cadillac_struct cadillacObj; - -/* Nonzero if in the process of exiting. */ -static int exiting; - -void cadillac_note_source (); -static void CWriteLanguageDecl (); -static void CWriteLanguageType (); -static void CWriteTopLevel (); -static void cadillac_note_filepos (); -static void cadillac_process_request (), cadillac_process_requests (); -static void cadillac_switch_source (); -static void exit_cadillac (); - -/* Blocking test. */ -static int -readable_p (fd) - int fd; -{ - fd_set f; - - FD_ZERO (&f); - FD_SET (fd, &f); - - return select (32, &f, NULL, NULL, 0) == 1; -} - -static CObjectType *tree_to_cadillac_map; -struct obstack cadillac_obstack; - - -#include "stack.h" - -struct context_level -{ - struct stack_level base; - - tree context; -}; - -/* Stack for maintaining contexts (in case functions or types are nested). - When defining a struct type, the `context' field is the RECORD_TYPE. - When defining a function, the `context' field is the FUNCTION_DECL. */ - -static struct context_level *context_stack; - -static struct context_level * -push_context_level (stack, obstack) - struct stack_level *stack; - struct obstack *obstack; -{ - struct context_level tem; - - tem.base.prev = stack; - return (struct context_level *)push_stack_level (obstack, &tem, sizeof (tem)); -} - -/* Discard a level of search allocation. */ - -static struct context_level * -pop_context_level (stack) - struct context_level *stack; -{ - stack = (struct context_level *)pop_stack_level (stack); - return stack; -} - -void -init_cadillac () -{ - extern FILE *finput; - extern int errno; - CCompilerMessage* req; - cadillac_struct *cp = &cadillacObj; - int i; - - if (! flag_cadillac) - return; - - tree_to_cadillac_map = (CObjectType*) xmalloc (sizeof (CObjectType) * LAST_CPLUS_TREE_CODE); - for (i = 0; i < LAST_CPLUS_TREE_CODE; i++) - tree_to_cadillac_map[i] = MiscOType; - tree_to_cadillac_map[RECORD_TYPE] = StructOType; - tree_to_cadillac_map[UNION_TYPE] = UnionOType; - tree_to_cadillac_map[ENUMERAL_TYPE] = EnumTypeOType; - tree_to_cadillac_map[TYPE_DECL] = TypedefOType; - tree_to_cadillac_map[VAR_DECL] = VariableOType; - tree_to_cadillac_map[CONST_DECL] = EnumConstantOType; - tree_to_cadillac_map[FUNCTION_DECL] = FunctionOType; - tree_to_cadillac_map[FIELD_DECL] = FieldOType; - -#ifdef sun - on_exit (&exit_cadillac, 0); -#endif - - gcc_obstack_init (&cadillac_obstack); - - /* Yow! This is the way Cadillac was designed to deal with - Oregon C++ compiler! */ - cp->fd_input = flag_cadillac; - cp->fd_output = flag_cadillac; - - /* Start in "turned-on" state. */ - cp->messages = 1; - cp->conversion = 1; - cp->emission = 1; - - /* Establish a connection with Cadillac here. */ - cp->conn = NewConnection (cp, cp->fd_input, cp->fd_output); - - CWriteHeader (cp->conn, WaitingMType, 0); - CWriteRequestBuffer (cp->conn); - - if (!readable_p (cp->fd_input)) - ; - - req = CReadCompilerMessage (cp->conn); - - if (!req) - switch (errno) - { - case EWOULDBLOCK: - sleep (5); - return; - - case 0: - fatal ("init_cadillac: EOF on connection to kernel, exiting\n"); - break; - - default: - perror ("Editor to kernel connection"); - exit (0); - } -} - -static void -cadillac_process_requests (conn) - Connection *conn; -{ - CCompilerMessage *req; - while (req = (CCompilerMessage*) CPeekNextRequest (conn)) - { - req = CReadCompilerMessage (conn); - cadillac_process_request (&cadillacObj, req); - } -} - -static void -cadillac_process_request (cp, req) - cadillac_struct *cp; - CCompilerMessage *req; -{ - if (! req) - return; - - switch (req->reqType) - { - case ProcessUntilMType: - if (cp->process_until) - my_friendly_abort (23); - cp->process_until = 1; - /* This is not really right. */ - cp->end_position = ((CCompilerCommand*)req)->processuntil.position; -#if 0 - cp->end_filename = req->processuntil.filename; -#endif - break; - - case CommandMType: - switch (req->header.data) - { - case MessagesOnCType: - cp->messages = 1; - break; - case MessagesOffCType: - cp->messages = 0; - break; - case ConversionOnCType: - cp->conversion = 1; - break; - case ConversionOffCType: - cp->conversion = 0; - break; - case EmissionOnCType: - cp->emission = 1; - break; - case EmissionOffCType: - cp->emission = 0; - break; - - case FinishAnalysisCType: - return; - - case PuntAnalysisCType: - case ContinueAnalysisCType: - case GotoFileposCType: - case OpenSucceededCType: - case OpenFailedCType: - fprintf (stderr, "request type %d not implemented\n", req->reqType); - return; - - case DieCType: - if (! exiting) - my_friendly_abort (24); - return; - - } - break; - - default: - fatal ("unknown request type %d", req->reqType); - } -} - -void -cadillac_start () -{ - Connection *conn = cadillacObj.conn; - CCompilerMessage *req; - - /* Let Cadillac know that we start in C++ language scope. */ - CWriteHeader (conn, ForeignLinkageMType, LinkCPlus); - CWriteLength (conn); - CWriteRequestBuffer (conn); - - cadillac_process_requests (conn); -} - -static void -cadillac_printf (msg, name) -{ - if (cadillacObj.messages) - printf ("[%s,%4d] %s `%s'\n", input_filename, lineno, msg, name); -} - -void -cadillac_start_decl (decl) - tree decl; -{ - Connection *conn = cadillacObj.conn; - CObjectType object_type = tree_to_cadillac_map [TREE_CODE (decl)]; - - if (context_stack) - switch (TREE_CODE (context_stack->context)) - { - case FUNCTION_DECL: - /* Currently, cadillac only implements top-level forms. */ - return; - case RECORD_TYPE: - case UNION_TYPE: - cadillac_printf ("start class-level decl", IDENTIFIER_POINTER (DECL_NAME (decl))); - break; - default: - my_friendly_abort (25); - } - else - { - cadillac_printf ("start top-level decl", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); - CWriteTopLevel (conn, StartMType); - } - - CWriteLanguageDecl (conn, decl, tree_to_cadillac_map[TREE_CODE (decl)]); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_finish_decl (decl) - tree decl; -{ - Connection *conn = cadillacObj.conn; - - if (context_stack) - switch (TREE_CODE (context_stack->context)) - { - case FUNCTION_DECL: - return; - case RECORD_TYPE: - case UNION_TYPE: - cadillac_printf ("end class-level decl", IDENTIFIER_POINTER (DECL_NAME (decl))); - CWriteHeader (conn, EndDefMType, 0); - CWriteLength (conn); - break; - default: - my_friendly_abort (26); - } - else - { - cadillac_printf ("end top-level decl", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); - CWriteHeader (conn, EndDefMType, 0); - CWriteLength (conn); - CWriteTopLevel (conn, StopMType); - } - - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_start_function (fndecl) - tree fndecl; -{ - Connection *conn = cadillacObj.conn; - - if (context_stack) - /* nested functions not yet handled. */ - my_friendly_abort (27); - - cadillac_printf ("start top-level function", lang_printable_name (fndecl)); - context_stack = push_context_level (context_stack, &cadillac_obstack); - context_stack->context = fndecl; - - CWriteTopLevel (conn, StartMType); - my_friendly_assert (TREE_CODE (fndecl) == FUNCTION_DECL, 202); - CWriteLanguageDecl (conn, fndecl, - (TREE_CODE (TREE_TYPE (fndecl)) == METHOD_TYPE - ? MemberFnOType : FunctionOType)); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_finish_function (fndecl) - tree fndecl; -{ - Connection *conn = cadillacObj.conn; - - cadillac_printf ("end top-level function", lang_printable_name (fndecl)); - context_stack = pop_context_level (context_stack); - - if (context_stack) - /* nested functions not yet implemented. */ - my_friendly_abort (28); - - CWriteHeader (conn, EndDefMType, 0); - CWriteLength (conn); - CWriteTopLevel (conn, StopMType); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_finish_anon_union (decl) - tree decl; -{ - Connection *conn = cadillacObj.conn; - - if (! global_bindings_p ()) - return; - cadillac_printf ("finish top-level anon union", ""); - CWriteHeader (conn, EndDefMType, 0); - CWriteLength (conn); - CWriteTopLevel (conn, StopMType); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_start_enum (type) - tree type; -{ - Connection *conn = cadillacObj.conn; - - tree name = TYPE_NAME (type); - - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - - if (context_stack) - switch (TREE_CODE (context_stack->context)) - { - case FUNCTION_DECL: - return; - case RECORD_TYPE: - case UNION_TYPE: - break; - default: - my_friendly_abort (29); - } - else - { - cadillac_printf ("start top-level enum", IDENTIFIER_POINTER (name)); - CWriteTopLevel (conn, StartMType); - } - - CWriteLanguageType (conn, type, tree_to_cadillac_map[ENUMERAL_TYPE]); -} - -void -cadillac_finish_enum (type) - tree type; -{ - Connection *conn = cadillacObj.conn; - tree name = TYPE_NAME (type); - - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - - if (context_stack) - switch (TREE_CODE (context_stack->context)) - { - case FUNCTION_DECL: - return; - case RECORD_TYPE: - case UNION_TYPE: - CWriteHeader (conn, EndDefMType, 0); - CWriteLength (conn); - break; - default: - my_friendly_abort (30); - } - else - { - CWriteHeader (conn, EndDefMType, 0); - CWriteLength (conn); - cadillac_printf ("finish top-level enum", IDENTIFIER_POINTER (name)); - CWriteTopLevel (conn, StopMType); - } - - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_start_struct (type) - tree type; -{ - Connection *conn = cadillacObj.conn; - tree name = TYPE_NAME (type); - - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - - if (context_stack) - switch (TREE_CODE (context_stack->context)) - { - case FUNCTION_DECL: - return; - case RECORD_TYPE: - case UNION_TYPE: - return; - default: - my_friendly_abort (31); - } - else - { - cadillac_printf ("start struct", IDENTIFIER_POINTER (name)); - CWriteTopLevel (conn, StartMType); - } - - context_stack = push_context_level (context_stack, &cadillac_obstack); - context_stack->context = type; - - CWriteLanguageType (conn, type, - TYPE_LANG_SPECIFIC (type) && CLASSTYPE_DECLARED_CLASS (type) ? ClassOType : tree_to_cadillac_map[TREE_CODE (type)]); -} - -void -cadillac_finish_struct (type) - tree type; -{ - Connection *conn = cadillacObj.conn; - tree name = TYPE_NAME (type); - - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - - context_stack = pop_context_level (context_stack); - if (context_stack) - return; - - cadillac_printf ("finish struct", IDENTIFIER_POINTER (name)); - CWriteHeader (conn, EndDefMType, 0); - CWriteLength (conn); - CWriteTopLevel (conn, StopMType); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_finish_exception (type) - tree type; -{ - Connection *conn = cadillacObj.conn; - - fatal ("cadillac_finish_exception"); - CWriteHeader (conn, EndDefMType, 0); - CWriteLength (conn); - CWriteTopLevel (conn, StopMType); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_push_class (type) - tree type; -{ -} - -void -cadillac_pop_class () -{ -} - -void -cadillac_push_lang (name) - tree name; -{ - Connection *conn = cadillacObj.conn; - CLinkLanguageType m; - - if (name == lang_name_cplusplus) - m = LinkCPlus; - else if (name == lang_name_c) - m = LinkC; - else - my_friendly_abort (32); - CWriteHeader (conn, ForeignLinkageMType, m); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_pop_lang () -{ - Connection *conn = cadillacObj.conn; - - CWriteHeader (conn, ForeignLinkageMType, LinkPop); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_finish_stmt () -{ -} - -void -cadillac_note_source () -{ - cadillacObj.lineno = lineno; - cadillacObj.filename = input_filename; -} - -static void -CWriteTopLevel (conn, m) - Connection *conn; - CMessageSubType m; -{ - static context_id = 0; - CWriteHeader (conn, TopLevelFormMType, m); - cadillac_note_filepos (); - - /* Eventually, this will point somewhere into the digest file. */ - context_id += 1; - CWriteSomething (conn, &context_id, sizeof (BITS32)); - - CWriteSomething (conn, &cadillacObj.iflevel, sizeof (BITS32)); - CWriteLength (conn); -} - -static void -cadillac_note_filepos () -{ - extern FILE *finput; - int pos = ftell (finput); - CWriteSomething (cadillacObj.conn, &pos, sizeof (BITS32)); -} - -void -cadillac_switch_source (startflag) - int startflag; -{ - Connection *conn = cadillacObj.conn; - /* Send out the name of the source file being compiled. */ - - CWriteHeader (conn, SourceFileMType, startflag ? StartMType : StopMType); - CWriteSomething (conn, &cadillacObj.depth, sizeof (BITS16)); - CWriteVstring0 (conn, input_filename); - CWriteLength (conn); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -void -cadillac_push_source () -{ - cadillacObj.depth += 1; - cadillac_switch_source (1); -} - -void -cadillac_pop_source () -{ - cadillacObj.depth -= 1; - cadillac_switch_source (0); -} - -struct cadillac_mdep -{ - short object_type; - char linkage; - char access; - short length; -}; - -static void -CWriteLanguageElem (conn, p, name) - Connection *conn; - struct cadillac_mdep *p; - char *name; -{ - CWriteSomething (conn, &p->object_type, sizeof (BITS16)); - CWriteSomething (conn, &p->linkage, sizeof (BITS8)); - CWriteSomething (conn, &p->access, sizeof (BITS8)); - CWriteSomething (conn, &p->length, sizeof (BITS16)); - CWriteVstring0 (conn, name); - -#if 0 - /* Don't write date_type. */ - CWriteVstring0 (conn, ""); -#endif - CWriteLength (conn); -} - -static void -CWriteLanguageDecl (conn, decl, object_type) - Connection *conn; - tree decl; - CObjectType object_type; -{ - struct cadillac_mdep foo; - tree name; - - CWriteHeader (conn, LanguageElementMType, StartDefineMType); - foo.object_type = object_type; - if (decl_type_context (decl)) - { - foo.linkage = ParentLinkage; - if (TREE_PRIVATE (decl)) - foo.access = PrivateAccess; - else if (TREE_PROTECTED (decl)) - foo.access = ProtectedAccess; - else - foo.access = PublicAccess; - } - else - { - if (TREE_PUBLIC (decl)) - foo.linkage = GlobalLinkage; - else - foo.linkage = FileLinkage; - foo.access = PublicAccess; - } - name = DECL_NAME (decl); - foo.length = IDENTIFIER_LENGTH (name); - - CWriteLanguageElem (conn, &foo, IDENTIFIER_POINTER (name)); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -static void -CWriteLanguageType (conn, type, object_type) - Connection *conn; - tree type; - CObjectType object_type; -{ - struct cadillac_mdep foo; - tree name = TYPE_NAME (type); - - CWriteHeader (conn, LanguageElementMType, StartDefineMType); - foo.object_type = object_type; - if (current_class_type) - { - foo.linkage = ParentLinkage; - if (TREE_PRIVATE (type)) - foo.access = PrivateAccess; - else if (TREE_PROTECTED (type)) - foo.access = ProtectedAccess; - else - foo.access = PublicAccess; - } - else - { - foo.linkage = NoLinkage; - foo.access = PublicAccess; - } - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - - foo.length = IDENTIFIER_LENGTH (name); - - CWriteLanguageElem (conn, &foo, IDENTIFIER_POINTER (name)); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -static void -CWriteUseObject (conn, type, object_type, use) - Connection *conn; - tree type; - CObjectType object_type; - CMessageSubType use; -{ - struct cadillac_mdep foo; - tree name = NULL_TREE; - - CWriteHeader (conn, LanguageElementMType, use); - foo.object_type = object_type; - if (current_class_type) - { - foo.linkage = ParentLinkage; - if (TREE_PRIVATE (type)) - foo.access = PrivateAccess; - else if (TREE_PROTECTED (type)) - foo.access = ProtectedAccess; - else - foo.access = PublicAccess; - } - else - { - foo.linkage = NoLinkage; - foo.access = PublicAccess; - } - switch (TREE_CODE (type)) - { - case VAR_DECL: - case FIELD_DECL: - case TYPE_DECL: - case CONST_DECL: - case FUNCTION_DECL: - name = DECL_NAME (type); - break; - - default: - my_friendly_abort (33); - } - - foo.length = IDENTIFIER_LENGTH (name); - - CWriteLanguageElem (conn, &foo, IDENTIFIER_POINTER (name)); - CWriteRequestBuffer (conn); - cadillac_process_requests (conn); -} - -/* Here's how we exit under cadillac. */ - -static void -exit_cadillac () -{ - extern int errorcount; - - Connection *conn = cadillacObj.conn; - - if (flag_cadillac) - { - CCompilerMessage *req; - - CWriteHeader (conn, FinishedMType, - errorcount ? 0 : CsObjectWritten | CsComplete); - /* Bye, bye! */ - CWriteRequestBuffer (conn); - - /* Block on read. */ - while (! readable_p (cadillacObj.fd_input)) - { - if (exiting) - my_friendly_abort (34); - exiting = 1; - } - exiting = 1; - - req = CReadCompilerMessage (conn); - cadillac_process_request (&cadillacObj, req); - } -} - -#else -/* Stubs. */ -void init_cadillac () {} -void cadillac_start () {} -void cadillac_start_decl (decl) - tree decl; -{} -void -cadillac_finish_decl (decl) - tree decl; -{} -void -cadillac_start_function (fndecl) - tree fndecl; -{} -void -cadillac_finish_function (fndecl) - tree fndecl; -{} -void -cadillac_finish_anon_union (decl) - tree decl; -{} -void -cadillac_start_enum (type) - tree type; -{} -void -cadillac_finish_enum (type) - tree type; -{} -void -cadillac_start_struct (type) - tree type; -{} -void -cadillac_finish_struct (type) - tree type; -{} -void -cadillac_finish_exception (type) - tree type; -{} -void -cadillac_push_class (type) - tree type; -{} -void -cadillac_pop_class () -{} -void -cadillac_push_lang (name) - tree name; -{} -void -cadillac_pop_lang () -{} -void -cadillac_note_source () -{} -void -cadillac_finish_stmt () -{} -void -cadillac_switch_source () -{} -void -cadillac_push_source () -{} -void -cadillac_pop_source () -{} -#endif diff --git a/contrib/gcc/cp/errfn.c b/contrib/gcc/cp/errfn.c deleted file mode 100644 index b5d3eeccd5a9..000000000000 --- a/contrib/gcc/cp/errfn.c +++ /dev/null @@ -1,352 +0,0 @@ -/* Provide a call-back mechanism for handling error output. - Copyright (C) 1993, 94-98, 1999 Free Software Foundation, Inc. - Contributed by Jason Merrill (jason@cygnus.com) - - This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "cp-tree.h" -#include "toplev.h" - -/* cp_printer is the type of a function which converts an argument into - a string for digestion by printf. The cp_printer function should deal - with all memory management; the functions in this file will not free - the char*s returned. See error.c for an example use of this code. */ - -typedef char* cp_printer PROTO((tree, int)); -extern cp_printer * cp_printers[256]; - -/* Whether or not we should try to be quiet for errors and warnings; this is - used to avoid being too talkative about problems with tentative choices - when we're computing the conversion costs for a method call. */ -int cp_silent = 0; - -typedef void errorfn (); /* deliberately vague */ - -static void cp_thing PROTO ((errorfn *, int, const char *, va_list)); - -#define STRDUP(f) (ap = (char *) alloca (strlen (f) +1), strcpy (ap, (f)), ap) - -/* This function supports only `%s', `%d', `%%', and the C++ print - codes. */ - -static void -cp_thing (errfn, atarg1, format, ap) - errorfn *errfn; - int atarg1; - const char *format; - va_list ap; -{ - static char *buf; - static long buflen; - int nargs = 0; - long len; - long offset; - const char *f; - tree atarg = 0; - - len = strlen (format) + 1; - if (len > buflen) - { - buflen = len; - buf = xrealloc (buf, buflen); - } - offset = 0; - - for (f = format; *f; ++f) - { - cp_printer * function; - int alternate; - int maybe_here; - - /* ignore text */ - if (*f != '%') - { - buf[offset++] = *f; - continue; - } - - ++f; - - alternate = 0; - maybe_here = 0; - - /* Check for '+' and '#' (in that order). */ - if (*f == '+') - { - maybe_here = 1; - ++f; - } - if (*f == '#') - { - alternate = 1; - ++f; - } - - /* no field width or precision */ - - function = cp_printers[(int)*f]; - - if (function || *f == 's') - { - char *p; - int plen; - - if (*f == 's') - { - p = va_arg (ap, char *); - nargs++; - } - else - { - tree t = va_arg (ap, tree); - nargs++; - - /* This indicates that ATARG comes from a different - location than normal. */ - if (maybe_here && atarg1) - atarg = t; - - /* If atarg1 is set and this is the first argument, then - set ATARG appropriately. */ - if (atarg1 && nargs == 1) - atarg = t; - - p = (*function) (t, alternate); - } - - plen = strlen (p); - len += plen; - if (len > buflen) - { - buflen = len; - buf = xrealloc (buf, len); - } - strcpy (buf + offset, p); - offset += plen; - } - else if (*f == '%') - { - /* A `%%' has occurred in the input string. Replace it with - a `%' in the formatted message buf. */ - - if (++len > buflen) - { - buflen = len; - buf = xrealloc (buf, len); - } - buf[offset++] = '%'; - } - else - { - if (*f != 'd') - abort (); - len += HOST_BITS_PER_INT / 2; - if (len > buflen) - { - buflen = len; - buf = xrealloc (buf, len); - } - sprintf (buf + offset, "%d", va_arg (ap, int)); - nargs++; - offset += strlen (buf + offset); - /* With an ANSI C library one could write - out += sprintf (...); */ - } - } - buf[offset] = '\0'; - - /* If ATARG1 is set, but we haven't extracted any arguments, then - extract one tree argument for ATARG. */ - if (nargs == 0 && atarg1) - atarg = va_arg (ap, tree); - - if (atarg) - { - char *file = cp_file_of (atarg); - int line = cp_line_of (atarg); - (*errfn) (file, line, "%s", buf); - } - else - (*errfn) ("%s", buf); - -} - -void -cp_error VPROTO((const char *format, ...)) -{ -#ifndef ANSI_PROTOTYPES - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); -#endif - - if (! cp_silent) - cp_thing ((errorfn *) error, 0, format, ap); - va_end (ap); -} - -void -cp_warning VPROTO((const char *format, ...)) -{ -#ifndef ANSI_PROTOTYPES - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); -#endif - - if (! cp_silent) - cp_thing ((errorfn *) warning, 0, format, ap); - va_end (ap); -} - -void -cp_pedwarn VPROTO((const char *format, ...)) -{ -#ifndef ANSI_PROTOTYPES - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); -#endif - - if (! cp_silent) - cp_thing ((errorfn *) pedwarn, 0, format, ap); - va_end (ap); -} - -void -cp_compiler_error VPROTO((const char *format, ...)) -{ -#ifndef ANSI_PROTOTYPES - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); -#endif - - if (! cp_silent) - cp_thing ((errorfn *) compiler_error, 0, format, ap); - va_end (ap); -} - -void -cp_deprecated (msg) - const char *msg; -{ - extern int warn_deprecated; - if (!warn_deprecated) - return; - cp_warning ("%s is deprecated.", msg); - cp_warning ("Please see the documentation for details."); -} - -void -cp_sprintf VPROTO((const char *format, ...)) -{ -#ifndef ANSI_PROTOTYPES - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); -#endif - - cp_thing ((errorfn *) sprintf, 0, format, ap); - va_end (ap); -} - -void -cp_error_at VPROTO((const char *format, ...)) -{ -#ifndef ANSI_PROTOTYPES - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); -#endif - - if (! cp_silent) - cp_thing ((errorfn *) error_with_file_and_line, 1, format, ap); - va_end (ap); -} - -void -cp_warning_at VPROTO((const char *format, ...)) -{ -#ifndef ANSI_PROTOTYPES - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); -#endif - - if (! cp_silent) - cp_thing ((errorfn *) warning_with_file_and_line, 1, format, ap); - va_end (ap); -} - -void -cp_pedwarn_at VPROTO((const char *format, ...)) -{ -#ifndef ANSI_PROTOTYPES - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef ANSI_PROTOTYPES - format = va_arg (ap, char *); -#endif - - if (! cp_silent) - cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, format, ap); - va_end (ap); -} diff --git a/contrib/gcc/cp/error.c b/contrib/gcc/cp/error.c deleted file mode 100644 index 4da1d2f3b87d..000000000000 --- a/contrib/gcc/cp/error.c +++ /dev/null @@ -1,2093 +0,0 @@ -/* Call-backs for C++ error reporting. - This code is non-reentrant. - Copyright (C) 1993, 94-97, 1998, 1999 Free Software Foundation, Inc. - - This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "cp-tree.h" -#include "obstack.h" -#include "toplev.h" - -typedef char* cp_printer (); - -#define A args_as_string -#define C code_as_string -#define D decl_as_string -#define E expr_as_string -#define F fndecl_as_string -#define L language_as_string -#define O op_as_string -#define P parm_as_string -#define Q assop_as_string -#define T type_as_string -#define V cv_as_string - -#define o (cp_printer *) 0 -cp_printer * cp_printers[256] = -{ -/*0 1 2 3 4 5 6 7 8 9 A B C D E F */ - o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x00 */ - o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x10 */ - o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x20 */ - o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x30 */ - o, A, o, C, D, E, F, o, o, o, o, o, L, o, o, O, /* 0x40 */ - P, Q, o, o, T, o, V, o, o, o, o, o, o, o, o, o, /* 0x50 */ - o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x60 */ - o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, o, /* 0x70 */ -}; -#undef C -#undef D -#undef E -#undef F -#undef L -#undef O -#undef P -#undef Q -#undef T -#undef V -#undef o - -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -/* Obstack where we build text strings for overloading, etc. */ -static struct obstack scratch_obstack; -static char *scratch_firstobj; - -# define OB_INIT() (scratch_firstobj ? (obstack_free (&scratch_obstack, scratch_firstobj), 0) : 0) -# define OB_PUTC(C) (obstack_1grow (&scratch_obstack, (C))) -# define OB_PUTC2(C1,C2) \ - (obstack_1grow (&scratch_obstack, (C1)), obstack_1grow (&scratch_obstack, (C2))) -# define OB_PUTS(S) (obstack_grow (&scratch_obstack, (S), sizeof (S) - 1)) -# define OB_PUTID(ID) \ - (obstack_grow (&scratch_obstack, IDENTIFIER_POINTER (ID), \ - IDENTIFIER_LENGTH (ID))) -# define OB_PUTCP(S) (obstack_grow (&scratch_obstack, (S), strlen (S))) -# define OB_FINISH() (obstack_1grow (&scratch_obstack, '\0')) -# define OB_PUTI(CST) do { sprintf (digit_buffer, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(CST)); \ - OB_PUTCP (digit_buffer); } while (0) -# define OB_UNPUT(N) obstack_blank (&scratch_obstack, - (N)); - -# define OB_END_TEMPLATE_ID() \ - ((obstack_next_free (&scratch_obstack) != obstack_base (&scratch_obstack) \ - && obstack_next_free (&scratch_obstack)[-1] == '>') \ - ? OB_PUTC2 (' ', '>') : OB_PUTC ('>')) - -# define NEXT_CODE(t) (TREE_CODE (TREE_TYPE (t))) - -enum pad { none, before, after }; - -static void dump_type PROTO((tree, int)); -static void dump_type_real PROTO((tree, int, int)); -static void dump_simple_decl PROTO((tree, tree, int)); -static void dump_decl PROTO((tree, int)); -static void dump_function_decl PROTO((tree, int)); -static void dump_expr PROTO((tree, int)); -static void dump_unary_op PROTO((char *, tree, int)); -static void dump_binary_op PROTO((char *, tree)); -static void dump_aggr_type PROTO((tree, int, int)); -static void dump_type_prefix PROTO((tree, int, int)); -static void dump_type_suffix PROTO((tree, int, int)); -static void dump_function_name PROTO((tree)); -static void dump_expr_list PROTO((tree)); -static void dump_global_iord PROTO((tree)); -static void dump_qualifiers PROTO((tree, enum pad)); -static void dump_char PROTO((int)); -static void dump_parameters PROTO((tree, int, int)); -static void dump_exception_spec PROTO((tree, int)); -static char *aggr_variety PROTO((tree)); -static tree ident_fndecl PROTO((tree)); -static int interesting_scope_p PROTO((tree)); - -void -init_error () -{ - gcc_obstack_init (&scratch_obstack); - scratch_firstobj = (char *)obstack_alloc (&scratch_obstack, 0); -} - -/* Returns nonzero if SCOPE is something we want to print for random decls. */ - -static int -interesting_scope_p (scope) - tree scope; -{ - if (scope == NULL_TREE - || scope == global_namespace) - return 0; - - return (TREE_CODE (scope) == NAMESPACE_DECL - || AGGREGATE_TYPE_P (scope)); -} - -static void -dump_qualifiers (t, p) - tree t; - enum pad p; -{ - if (TYPE_QUALS (t)) - { - if (p == before) OB_PUTC (' '); - switch (TYPE_QUALS (t)) - { - case TYPE_QUAL_CONST: - OB_PUTS ("const"); - break; - - case TYPE_QUAL_VOLATILE: - OB_PUTS ("volatile"); - break; - - case TYPE_QUAL_RESTRICT: - OB_PUTS ("__restrict"); - break; - - case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE: - OB_PUTS ("const volatile"); - break; - - case TYPE_QUAL_CONST | TYPE_QUAL_RESTRICT: - OB_PUTS ("const __restrict"); - break; - - case TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT: - OB_PUTS ("volatile __restrict"); - break; - - case TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE | TYPE_QUAL_RESTRICT: - OB_PUTS ("const volatile __restrict"); - break; - - default: - my_friendly_abort (0); - } - if (p == after) OB_PUTC (' '); - } -} - -/* This must be large enough to hold any printed integer or floating-point - value. */ -static char digit_buffer[128]; - -/* Dump into the obstack a human-readable equivalent of TYPE. */ - -static void -dump_type_real (t, v, canonical_name) - tree t; - int v; /* verbose? */ - int canonical_name; -{ - if (t == NULL_TREE) - return; - - if (TYPE_PTRMEMFUNC_P (t)) - goto offset_type; - - switch (TREE_CODE (t)) - { - case ERROR_MARK: - OB_PUTS ("{error}"); - break; - - case UNKNOWN_TYPE: - OB_PUTS ("{unknown type}"); - break; - - case TREE_LIST: - /* A list of function parms. */ - dump_parameters (t, 0, canonical_name); - break; - - case IDENTIFIER_NODE: - OB_PUTID (t); - break; - - case TREE_VEC: - dump_type_real (BINFO_TYPE (t), v, canonical_name); - break; - - case RECORD_TYPE: - case UNION_TYPE: - case ENUMERAL_TYPE: - if (TYPE_LANG_SPECIFIC (t) - && (IS_SIGNATURE_POINTER (t) || IS_SIGNATURE_REFERENCE (t))) - { - dump_qualifiers (t, after); - dump_type_real (SIGNATURE_TYPE (t), v, canonical_name); - if (IS_SIGNATURE_POINTER (t)) - OB_PUTC ('*'); - else - OB_PUTC ('&'); - } - else - dump_aggr_type (t, v, canonical_name); - break; - - case TYPE_DECL: - case TEMPLATE_DECL: - case NAMESPACE_DECL: - dump_decl (t, v); - break; - - case COMPLEX_TYPE: - OB_PUTS ("complex "); - dump_type_real (TREE_TYPE (t), v, canonical_name); - break; - - case INTEGER_TYPE: - if (!TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)) && TREE_UNSIGNED (t)) - OB_PUTS ("unsigned "); - else if (TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)) && !TREE_UNSIGNED (t)) - OB_PUTS ("signed "); - - /* fall through. */ - case REAL_TYPE: - case VOID_TYPE: - case BOOLEAN_TYPE: - { - tree type; - dump_qualifiers (t, after); - type = canonical_name ? TYPE_MAIN_VARIANT (t) : t; - if (TYPE_NAME (type) && TYPE_IDENTIFIER (type)) - OB_PUTID (TYPE_IDENTIFIER (type)); - else - /* Types like intQI_type_node and friends have no names. - These don't come up in user error messages, but it's nice - to be able to print them from the debugger. */ - OB_PUTS ("{anonymous}"); - } - break; - - case TEMPLATE_TEMPLATE_PARM: - if (!TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t)) - { - /* For parameters inside template signature. */ - if (TYPE_IDENTIFIER (t)) - OB_PUTID (TYPE_IDENTIFIER (t)); - else - OB_PUTS ("{anonymous template template parm}"); - } - else - { - int i; - tree args = TYPE_TI_ARGS (t); - OB_PUTID (TYPE_IDENTIFIER (t)); - OB_PUTC ('<'); - for (i = 0; i < TREE_VEC_LENGTH (args); i++) - { - tree arg = TREE_VEC_ELT (args, i); - if (TREE_CODE_CLASS (TREE_CODE (arg)) == 't' - || TREE_CODE (arg) == TEMPLATE_DECL) - dump_type_real (arg, 0, canonical_name); - else - dump_expr (arg, 0); - if (i < TREE_VEC_LENGTH (args)-1) - OB_PUTC2 (',', ' '); - } - OB_END_TEMPLATE_ID (); - } - break; - - case TEMPLATE_TYPE_PARM: - dump_qualifiers (t, after); - if (TYPE_IDENTIFIER (t)) - OB_PUTID (TYPE_IDENTIFIER (t)); - else - OB_PUTS ("{anonymous template type parm}"); - break; - - /* This is not always necessary for pointers and such, but doing this - reduces code size. */ - case ARRAY_TYPE: - case POINTER_TYPE: - case REFERENCE_TYPE: - case OFFSET_TYPE: - offset_type: - case FUNCTION_TYPE: - case METHOD_TYPE: - dump_type_prefix (t, v, canonical_name); - dump_type_suffix (t, v, canonical_name); - break; - - case TYPENAME_TYPE: - OB_PUTS ("typename "); - dump_type_real (TYPE_CONTEXT (t), 0, canonical_name); - OB_PUTS ("::"); - dump_decl (TYPENAME_TYPE_FULLNAME (t), v); - break; - - case TYPEOF_TYPE: - OB_PUTS ("__typeof ("); - dump_expr (TYPE_FIELDS (t), 1); - OB_PUTC (')'); - break; - - default: - sorry ("`%s' not supported by dump_type", - tree_code_name[(int) TREE_CODE (t)]); - } -} - -static char * -aggr_variety (t) - tree t; -{ - if (TREE_CODE (t) == ENUMERAL_TYPE) - return "enum"; - else if (TREE_CODE (t) == UNION_TYPE) - return "union"; - else if (TYPE_LANG_SPECIFIC (t) && CLASSTYPE_DECLARED_CLASS (t)) - return "class"; - else if (TYPE_LANG_SPECIFIC (t) && IS_SIGNATURE (t)) - return "signature"; - else - return "struct"; -} - -static void -dump_type (t, v) - tree t; - int v; /* verbose? */ -{ - dump_type_real (t, v, 0); -} - -/* Print out a class declaration, in the form `class foo'. */ - -static void -dump_aggr_type (t, v, canonical_name) - tree t; - int v; /* verbose? */ - int canonical_name; -{ - tree name; - char *variety = aggr_variety (t); - - dump_qualifiers (t, after); - - if (v > 0) - { - OB_PUTCP (variety); - OB_PUTC (' '); - } - - name = TYPE_NAME (canonical_name ? TYPE_MAIN_VARIANT (t) : t); - - if (name && CP_DECL_CONTEXT (name) != global_namespace) - { - /* FUNCTION_DECL or RECORD_TYPE */ - dump_decl (DECL_CONTEXT (name), 0); - OB_PUTC2 (':', ':'); - } - - /* kludge around weird behavior on g++.brendan/line1.C */ - if (name && TREE_CODE (name) != IDENTIFIER_NODE) - name = DECL_NAME (name); - - if (name == 0 || ANON_AGGRNAME_P (name)) - { - OB_PUTS ("{anonymous"); - if (!v) - { - OB_PUTC (' '); - OB_PUTCP (variety); - } - OB_PUTC ('}'); - } - else - OB_PUTID (name); -} - -/* Dump into the obstack the initial part of the output for a given type. - This is necessary when dealing with things like functions returning - functions. Examples: - - return type of `int (* fee ())()': pointer -> function -> int. Both - pointer (and reference and offset) and function (and member) types must - deal with prefix and suffix. - - Arrays must also do this for DECL nodes, like int a[], and for things like - int *[]&. */ - -static void -dump_type_prefix (t, v, canonical_name) - tree t; - int v; /* verbosity */ - int canonical_name; -{ - if (TYPE_PTRMEMFUNC_P (t)) - { - t = TYPE_PTRMEMFUNC_FN_TYPE (t); - goto offset_type; - } - - switch (TREE_CODE (t)) - { - case POINTER_TYPE: - case REFERENCE_TYPE: - { - tree sub = TREE_TYPE (t); - - dump_type_prefix (sub, v, canonical_name); - /* A tree for a member pointer looks like pointer to offset, - so let the OFFSET_TYPE case handle it. */ - if (!TYPE_PTRMEM_P (t)) - { - switch (TREE_CODE (sub)) - { - /* We don't want int ( *)() */ - case FUNCTION_TYPE: - case METHOD_TYPE: - break; - - case ARRAY_TYPE: - OB_PUTC2 (' ', '('); - break; - - case POINTER_TYPE: - /* We don't want "char * *" */ - if (TYPE_QUALS (sub) == TYPE_UNQUALIFIED) - break; - /* But we do want "char *const *" */ - - default: - OB_PUTC (' '); - } - if (TREE_CODE (t) == POINTER_TYPE) - OB_PUTC ('*'); - else - OB_PUTC ('&'); - dump_qualifiers (t, none); - } - } - break; - - case OFFSET_TYPE: - offset_type: - dump_type_prefix (TREE_TYPE (t), v, canonical_name); - if (TREE_CODE (t) == OFFSET_TYPE) /* pmfs deal with this in d_t_p */ - { - OB_PUTC (' '); - dump_type_real (TYPE_OFFSET_BASETYPE (t), 0, canonical_name); - OB_PUTC2 (':', ':'); - } - OB_PUTC ('*'); - dump_qualifiers (t, none); - break; - - /* Can only be reached through function pointer -- this would not be - correct if FUNCTION_DECLs used it. */ - case FUNCTION_TYPE: - dump_type_prefix (TREE_TYPE (t), v, canonical_name); - OB_PUTC2 (' ', '('); - break; - - case METHOD_TYPE: - dump_type_prefix (TREE_TYPE (t), v, canonical_name); - OB_PUTC2 (' ', '('); - dump_aggr_type (TYPE_METHOD_BASETYPE (t), 0, canonical_name); - OB_PUTC2 (':', ':'); - break; - - case ARRAY_TYPE: - dump_type_prefix (TREE_TYPE (t), v, canonical_name); - break; - - case ENUMERAL_TYPE: - case ERROR_MARK: - case IDENTIFIER_NODE: - case INTEGER_TYPE: - case BOOLEAN_TYPE: - case REAL_TYPE: - case RECORD_TYPE: - case TEMPLATE_TYPE_PARM: - case TEMPLATE_TEMPLATE_PARM: - case TREE_LIST: - case TYPE_DECL: - case TREE_VEC: - case UNION_TYPE: - case UNKNOWN_TYPE: - case VOID_TYPE: - case TYPENAME_TYPE: - case COMPLEX_TYPE: - dump_type_real (t, v, canonical_name); - break; - - default: - sorry ("`%s' not supported by dump_type_prefix", - tree_code_name[(int) TREE_CODE (t)]); - } -} - -static void -dump_type_suffix (t, v, canonical_name) - tree t; - int v; /* verbose? */ - int canonical_name; -{ - if (TYPE_PTRMEMFUNC_P (t)) - t = TYPE_PTRMEMFUNC_FN_TYPE (t); - - switch (TREE_CODE (t)) - { - case POINTER_TYPE: - case REFERENCE_TYPE: - case OFFSET_TYPE: - if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) - OB_PUTC (')'); - dump_type_suffix (TREE_TYPE (t), v, canonical_name); - break; - - /* Can only be reached through function pointer */ - case FUNCTION_TYPE: - case METHOD_TYPE: - { - tree arg; - OB_PUTC (')'); - arg = TYPE_ARG_TYPES (t); - if (TREE_CODE (t) == METHOD_TYPE) - arg = TREE_CHAIN (arg); - - /* Function pointers don't have default args. Not in standard C++, - anyway; they may in g++, but we'll just pretend otherwise. */ - dump_parameters (arg, 0, canonical_name); - - if (TREE_CODE (t) == METHOD_TYPE) - dump_qualifiers - (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))), before); - dump_type_suffix (TREE_TYPE (t), v, canonical_name); - dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), canonical_name); - break; - } - - case ARRAY_TYPE: - OB_PUTC ('['); - if (TYPE_DOMAIN (t)) - { - if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == INTEGER_CST) - OB_PUTI (TREE_INT_CST_LOW (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) + 1); - else if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == MINUS_EXPR) - dump_expr (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0), 0); - else - dump_expr (fold (build_binary_op - (PLUS_EXPR, TYPE_MAX_VALUE (TYPE_DOMAIN (t)), - integer_one_node)), 0); - } - OB_PUTC (']'); - dump_type_suffix (TREE_TYPE (t), v, canonical_name); - break; - - case ENUMERAL_TYPE: - case ERROR_MARK: - case IDENTIFIER_NODE: - case INTEGER_TYPE: - case BOOLEAN_TYPE: - case REAL_TYPE: - case RECORD_TYPE: - case TEMPLATE_TYPE_PARM: - case TEMPLATE_TEMPLATE_PARM: - case TREE_LIST: - case TYPE_DECL: - case TREE_VEC: - case UNION_TYPE: - case UNKNOWN_TYPE: - case VOID_TYPE: - case TYPENAME_TYPE: - case COMPLEX_TYPE: - break; - - default: - sorry ("`%s' not supported by dump_type_suffix", - tree_code_name[(int) TREE_CODE (t)]); - } -} - -/* Return a function declaration which corresponds to the IDENTIFIER_NODE - argument. */ - -static tree -ident_fndecl (t) - tree t; -{ - tree n = lookup_name (t, 0); - - if (n == NULL_TREE) - return NULL_TREE; - - if (TREE_CODE (n) == FUNCTION_DECL) - return n; - else if (TREE_CODE (n) == TREE_LIST - && TREE_CODE (TREE_VALUE (n)) == FUNCTION_DECL) - return TREE_VALUE (n); - - my_friendly_abort (66); - return NULL_TREE; -} - -#ifndef NO_DOLLAR_IN_LABEL -# define GLOBAL_THING "_GLOBAL_$" -#else -# ifndef NO_DOT_IN_LABEL -# define GLOBAL_THING "_GLOBAL_." -# else -# define GLOBAL_THING "_GLOBAL__" -# endif -#endif - -#define GLOBAL_IORD_P(NODE) \ - ! strncmp (IDENTIFIER_POINTER(NODE), GLOBAL_THING, sizeof (GLOBAL_THING) - 1) - -static void -dump_global_iord (t) - tree t; -{ - char *name = IDENTIFIER_POINTER (t); - - OB_PUTS ("(static "); - if (name [sizeof (GLOBAL_THING) - 1] == 'I') - OB_PUTS ("initializers"); - else if (name [sizeof (GLOBAL_THING) - 1] == 'D') - OB_PUTS ("destructors"); - else - my_friendly_abort (352); - - OB_PUTS (" for "); - OB_PUTCP (input_filename); - OB_PUTC (')'); -} - -static void -dump_simple_decl (t, type, v) - tree t; - tree type; - int v; -{ - if (v > 0) - { - dump_type_prefix (type, v, 0); - OB_PUTC (' '); - } - if (interesting_scope_p (DECL_CONTEXT (t))) - { - dump_decl (DECL_CONTEXT (t), 0); - OB_PUTC2 (':',':'); - } - if (DECL_NAME (t)) - dump_decl (DECL_NAME (t), v); - else - OB_PUTS ("{anon}"); - if (v > 0) - dump_type_suffix (type, v, 0); -} - -static void -dump_decl (t, v) - tree t; - int v; /* verbosity */ -{ - if (t == NULL_TREE) - return; - - switch (TREE_CODE (t)) - { - case ERROR_MARK: - OB_PUTS (" /* decl error */ "); - break; - - case TYPE_DECL: - { - /* Don't say 'typedef class A' */ - if (DECL_ARTIFICIAL (t)) - { - if (v > 0 && TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM) - /* Say `class T' not just `T'. */ - OB_PUTS ("class "); - - dump_type (TREE_TYPE (t), v); - break; - } - } - if (v > 0) - OB_PUTS ("typedef "); - dump_simple_decl (t, DECL_ORIGINAL_TYPE (t) - ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), v); - break; - - case VAR_DECL: - if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t))) - { - OB_PUTS ("vtable for "); - if (TYPE_P (DECL_CONTEXT (t))) - dump_type (DECL_CONTEXT (t), v); - else - /* This case can arise with -fno-vtable-thunks. See - expand_upcast_fixups. It's not clear what to print - here. */ - OB_PUTS ("{unknown type}"); - break; - } - /* else fall through */ - case FIELD_DECL: - case PARM_DECL: - dump_simple_decl (t, TREE_TYPE (t), v); - break; - - case NAMESPACE_DECL: - if (CP_DECL_CONTEXT (t) != global_namespace) - { - dump_decl (DECL_CONTEXT (t), v); - OB_PUTC2 (':',':'); - } - if (DECL_NAME (t) == anonymous_namespace_name) - OB_PUTS ("{anonymous}"); - else - OB_PUTID (DECL_NAME (t)); - break; - - case SCOPE_REF: - dump_decl (TREE_OPERAND (t, 0), 0); - OB_PUTS ("::"); - dump_decl (TREE_OPERAND (t, 1), 0); - break; - - case ARRAY_REF: - dump_decl (TREE_OPERAND (t, 0), v); - OB_PUTC ('['); - dump_decl (TREE_OPERAND (t, 1), v); - OB_PUTC (']'); - break; - - /* So that we can do dump_decl in dump_aggr_type and have it work for - both class and function scope. */ - case RECORD_TYPE: - case UNION_TYPE: - case ENUMERAL_TYPE: - dump_type (t, v); - break; - - case TYPE_EXPR: - my_friendly_abort (69); - break; - - /* These special cases are duplicated here so that other functions - can feed identifiers to cp_error and get them demangled properly. */ - case IDENTIFIER_NODE: - { tree f; - if (DESTRUCTOR_NAME_P (t) - && (f = ident_fndecl (t)) - && DECL_LANGUAGE (f) == lang_cplusplus) - { - OB_PUTC ('~'); - dump_decl (DECL_NAME (f), 0); - } - else if (IDENTIFIER_TYPENAME_P (t)) - { - OB_PUTS ("operator "); - /* Not exactly IDENTIFIER_TYPE_VALUE. */ - dump_type (TREE_TYPE (t), 0); - break; - } - else if (IDENTIFIER_OPNAME_P (t)) - { - char *name_string = operator_name_string (t); - OB_PUTS ("operator "); - OB_PUTCP (name_string); - } - else - OB_PUTID (t); - } - break; - - case OVERLOAD: - t = OVL_CURRENT (t); - /* Fall through. */ - - case FUNCTION_DECL: - if (GLOBAL_IORD_P (DECL_ASSEMBLER_NAME (t))) - dump_global_iord (DECL_ASSEMBLER_NAME (t)); - else if (! DECL_LANG_SPECIFIC (t)) - OB_PUTS ("{internal}"); - else - dump_function_decl (t, v); - break; - - case TEMPLATE_DECL: - { - tree orig_args = DECL_TEMPLATE_PARMS (t); - tree args; - int i; - for (args = orig_args = nreverse (orig_args); - args; - args = TREE_CHAIN (args)) - { - int len = TREE_VEC_LENGTH (TREE_VALUE (args)); - - OB_PUTS ("template <"); - for (i = 0; i < len; i++) - { - tree arg = TREE_VEC_ELT (TREE_VALUE (args), i); - tree defval = TREE_PURPOSE (arg); - arg = TREE_VALUE (arg); - if (TREE_CODE (arg) == TYPE_DECL) - { - if (DECL_NAME (arg)) - { - OB_PUTS ("class "); - OB_PUTID (DECL_NAME (arg)); - } - else - OB_PUTS ("class"); - } - else - dump_decl (arg, 1); - - if (defval) - { - OB_PUTS (" = "); - if (TREE_CODE (arg) == TYPE_DECL - || TREE_CODE (arg) == TEMPLATE_DECL) - dump_type (defval, 1); - else - dump_expr (defval, 1); - } - - OB_PUTC2 (',', ' '); - } - if (len != 0) - OB_UNPUT (2); - OB_END_TEMPLATE_ID (); - OB_PUTC (' '); - } - nreverse(orig_args); - - if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == TYPE_DECL) - dump_type (TREE_TYPE (t), v); - else if (TREE_CODE (DECL_TEMPLATE_RESULT (t)) == VAR_DECL) - dump_decl (DECL_TEMPLATE_RESULT (t), v); - else if (TREE_TYPE (t) == NULL_TREE) - my_friendly_abort (353); - else switch (NEXT_CODE (t)) - { - case METHOD_TYPE: - case FUNCTION_TYPE: - dump_function_decl (t, v); - break; - - default: - /* This case can occur with some illegal code. */ - dump_type (TREE_TYPE (t), v); - } - } - break; - - case TEMPLATE_ID_EXPR: - { - tree args; - tree name = TREE_OPERAND (t, 0); - if (is_overloaded_fn (name)) - name = DECL_NAME (get_first_fn (name)); - dump_decl (name, v); - OB_PUTC ('<'); - for (args = TREE_OPERAND (t, 1); args; args = TREE_CHAIN (args)) - { - if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (args))) == 't' - || TREE_CODE (TREE_VALUE (args)) == TEMPLATE_DECL) - dump_type (TREE_VALUE (args), 0); - else - dump_expr (TREE_VALUE (args), 0); - if (TREE_CHAIN (args)) - OB_PUTC2 (',', ' '); - } - OB_END_TEMPLATE_ID (); - } - break; - - case LOOKUP_EXPR: - dump_decl (TREE_OPERAND (t, 0), v); - break; - - case LABEL_DECL: - OB_PUTID (DECL_NAME (t)); - break; - - case CONST_DECL: - if ((TREE_TYPE (t) != NULL_TREE && NEXT_CODE (t) == ENUMERAL_TYPE) - || (DECL_INITIAL (t) && - TREE_CODE (DECL_INITIAL (t)) == TEMPLATE_PARM_INDEX)) - dump_simple_decl (t, TREE_TYPE (t), v); - else if (DECL_NAME (t)) - dump_decl (DECL_NAME (t), v); - else if (DECL_INITIAL (t)) - dump_expr (DECL_INITIAL (t), 0); - else - OB_PUTS ("enumerator"); - break; - - case USING_DECL: - OB_PUTS ("using "); - dump_type (DECL_INITIAL (t), 0); - OB_PUTS ("::"); - OB_PUTID (DECL_NAME (t)); - break; - - default: - sorry ("`%s' not supported by dump_decl", - tree_code_name[(int) TREE_CODE (t)]); - } -} - -/* Pretty print a function decl. There are several ways we want to print a - function declaration. We use V to tell us what. - V - 01 23 - args - ++ ++ - retval - -+ ++ - default- -+ -+ - throw - -- ++ - As cp_error can only apply the '#' flag once to give 0 and 1 for V, there - is %D which doesn't print the throw specs, and %F which does. */ - -static void -dump_function_decl (t, v) - tree t; - int v; -{ - tree name; - tree fntype; - tree parmtypes; - tree cname = NULL_TREE; - - if (TREE_CODE (t) == TEMPLATE_DECL) - t = DECL_TEMPLATE_RESULT (t); - - name = DECL_ASSEMBLER_NAME (t); - fntype = TREE_TYPE (t); - parmtypes = TYPE_ARG_TYPES (fntype); - - /* Friends have DECL_CLASS_CONTEXT set, but not DECL_CONTEXT. */ - if (DECL_CLASS_SCOPE_P (t)) - cname = DECL_CLASS_CONTEXT (t); - /* this is for partially instantiated template methods */ - else if (TREE_CODE (fntype) == METHOD_TYPE) - cname = TREE_TYPE (TREE_VALUE (parmtypes)); - - /* Print the return type. */ - if (v > 0) - { - if (DECL_STATIC_FUNCTION_P (t)) - OB_PUTS ("static "); - - if (! DECL_CONV_FN_P (t) - && ! DECL_CONSTRUCTOR_P (t) - && ! DECL_DESTRUCTOR_P (t)) - { - dump_type_prefix (TREE_TYPE (fntype), 1, 0); - OB_PUTC (' '); - } - } - - /* Print the function name. */ - if (cname) - { - dump_type (cname, 0); - OB_PUTC2 (':', ':'); - if (TREE_CODE (fntype) == METHOD_TYPE && parmtypes) - parmtypes = TREE_CHAIN (parmtypes); - if (DECL_CONSTRUCTOR_FOR_VBASE_P (t)) - /* Skip past "in_charge" identifier. */ - parmtypes = TREE_CHAIN (parmtypes); - } - else if (CP_DECL_CONTEXT (t) != global_namespace) - { - dump_decl (DECL_CONTEXT (t), 0); - OB_PUTC2 (':',':'); - } - - if (DESTRUCTOR_NAME_P (name) && DECL_LANGUAGE (t) == lang_cplusplus) - parmtypes = TREE_CHAIN (parmtypes); - - dump_function_name (t); - - /* If V is negative, we don't print the argument types. */ - if (v < 0) - return; - - dump_parameters (parmtypes, v & 1, 0); - - if (v && ! DECL_CONV_FN_P (t)) - dump_type_suffix (TREE_TYPE (fntype), 1, 0); - - if (TREE_CODE (fntype) == METHOD_TYPE) - { - if (IS_SIGNATURE (cname)) - /* We look at the type pointed to by the `optr' field of `this.' */ - dump_qualifiers - (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_VALUE (TYPE_ARG_TYPES (fntype))))), before); - else - dump_qualifiers - (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))), before); - } - - if (v >= 2) - dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), 0); -} - -/* Print a parameter list. V indicates if we show default values or not. If - these are for a member function, the member object ptr - (and any other hidden args) should have already been removed. */ - -static void -dump_parameters (parmtypes, v, canonical_name) - tree parmtypes; - int v; - int canonical_name; -{ - int first; - OB_PUTC ('('); - - for (first = 1; parmtypes != void_list_node; - parmtypes = TREE_CHAIN (parmtypes)) - { - if (!first) - OB_PUTC2 (',', ' '); - first = 0; - if (!parmtypes) - { - OB_PUTS ("..."); - break; - } - dump_type_real (TREE_VALUE (parmtypes), 0, canonical_name); - - if (TREE_PURPOSE (parmtypes) && v) - { - OB_PUTS (" = "); - dump_expr (TREE_PURPOSE (parmtypes), 0); - } - } - - OB_PUTC (')'); -} - -/* Print an exception specification. T is the exception specification. */ - -static void -dump_exception_spec (t, canonical_name) - tree t; - int canonical_name; -{ - if (t) - { - OB_PUTS (" throw ("); - if (TREE_VALUE (t) != NULL_TREE) - while (1) - { - dump_type_real (TREE_VALUE (t), 0, canonical_name); - t = TREE_CHAIN (t); - if (!t) - break; - OB_PUTC2 (',', ' '); - } - OB_PUTC (')'); - } -} - -/* Handle the function name for a FUNCTION_DECL node, grokking operators - and destructors properly. */ - -static void -dump_function_name (t) - tree t; -{ - tree name = DECL_NAME (t); - - if (DECL_DESTRUCTOR_P (t)) - { - OB_PUTC ('~'); - dump_decl (name, 0); - } - else if (DECL_CONV_FN_P (t)) - { - /* This cannot use the hack that the operator's return - type is stashed off of its name because it may be - used for error reporting. In the case of conflicting - declarations, both will have the same name, yet - the types will be different, hence the TREE_TYPE field - of the first name will be clobbered by the second. */ - OB_PUTS ("operator "); - dump_type (TREE_TYPE (TREE_TYPE (t)), 0); - } - else if (IDENTIFIER_OPNAME_P (name)) - { - char *name_string = operator_name_string (name); - OB_PUTS ("operator "); - OB_PUTCP (name_string); - } - else - dump_decl (name, 0); - - if (DECL_LANG_SPECIFIC (t) && DECL_USE_TEMPLATE (t) - && DECL_TEMPLATE_INFO (t) - && (DECL_TEMPLATE_SPECIALIZATION (t) - || TREE_CODE (DECL_TI_TEMPLATE (t)) != TEMPLATE_DECL - || DECL_TEMPLATE_SPECIALIZATION (DECL_TI_TEMPLATE (t)) - || PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t)))) - { - tree args = DECL_TEMPLATE_INFO (t) ? DECL_TI_ARGS (t) : NULL_TREE; - OB_PUTC ('<'); - - /* Be careful only to print things when we have them, so as not - to crash producing error messages. */ - if (args) - { - if (TREE_CODE (args) == TREE_LIST) - { - tree arg; - int need_comma = 0; - - for (arg = args; arg; arg = TREE_CHAIN (arg)) - { - tree a = TREE_VALUE (arg); - - if (need_comma) - OB_PUTS (", "); - - if (a) - { - if (TREE_CODE_CLASS (TREE_CODE (a)) == 't' - || TREE_CODE (a) == TEMPLATE_DECL) - dump_type (a, 0); - else - dump_expr (a, 0); - } - - need_comma = 1; - } - } - else if (TREE_CODE (args) == TREE_VEC) - { - int i; - int need_comma = 0; - - if (TREE_VEC_LENGTH (args) > 0 - && TREE_CODE (TREE_VEC_ELT (args, 0)) == TREE_VEC) - args = TREE_VEC_ELT (args, - TREE_VEC_LENGTH (args) - 1); - - for (i = 0; i < TREE_VEC_LENGTH (args); i++) - { - tree a = TREE_VEC_ELT (args, i); - - if (need_comma) - OB_PUTS (", "); - - if (a) - { - if (TREE_CODE_CLASS (TREE_CODE (a)) == 't' - || TREE_CODE (a) == TEMPLATE_DECL) - dump_type (a, 0); - else - dump_expr (a, 0); - } - - need_comma = 1; - } - } - } - OB_END_TEMPLATE_ID (); - } -} - -static void -dump_char (c) - int c; -{ - switch (c) - { - case TARGET_NEWLINE: - OB_PUTS ("\\n"); - break; - case TARGET_TAB: - OB_PUTS ("\\t"); - break; - case TARGET_VT: - OB_PUTS ("\\v"); - break; - case TARGET_BS: - OB_PUTS ("\\b"); - break; - case TARGET_CR: - OB_PUTS ("\\r"); - break; - case TARGET_FF: - OB_PUTS ("\\f"); - break; - case TARGET_BELL: - OB_PUTS ("\\a"); - break; - case '\\': - OB_PUTS ("\\\\"); - break; - case '\'': - OB_PUTS ("\\'"); - break; - case '\"': - OB_PUTS ("\\\""); - break; - default: - if (ISPRINT (c)) - OB_PUTC (c); - else - { - sprintf (digit_buffer, "\\%03o", (int) c); - OB_PUTCP (digit_buffer); - } - } -} - -/* Print out a list of initializers (subr of dump_expr) */ - -static void -dump_expr_list (l) - tree l; -{ - while (l) - { - dump_expr (TREE_VALUE (l), 0); - if (TREE_CHAIN (l)) - OB_PUTC2 (',', ' '); - l = TREE_CHAIN (l); - } -} - -/* Print out an expression */ - -static void -dump_expr (t, nop) - tree t; - int nop; /* suppress parens */ -{ - switch (TREE_CODE (t)) - { - case VAR_DECL: - case PARM_DECL: - case FIELD_DECL: - case CONST_DECL: - case FUNCTION_DECL: - case TEMPLATE_DECL: - case NAMESPACE_DECL: - dump_decl (t, -1); - break; - - case INTEGER_CST: - { - tree type = TREE_TYPE (t); - my_friendly_assert (type != 0, 81); - - /* If it's an enum, output its tag, rather than its value. */ - if (TREE_CODE (type) == ENUMERAL_TYPE) - { - char *p = enum_name_string (t, type); - OB_PUTCP (p); - } - else if (type == boolean_type_node) - { - if (t == boolean_false_node - || (TREE_INT_CST_LOW (t) == 0 - && TREE_INT_CST_HIGH (t) == 0)) - OB_PUTS ("false"); - else if (t == boolean_true_node) - OB_PUTS ("true"); - } - else if (type == char_type_node) - { - OB_PUTC ('\''); - dump_char (TREE_INT_CST_LOW (t)); - OB_PUTC ('\''); - } - else if (TREE_INT_CST_HIGH (t) - != (TREE_INT_CST_LOW (t) >> (HOST_BITS_PER_WIDE_INT - 1))) - { - tree val = t; - if (TREE_INT_CST_HIGH (val) < 0) - { - OB_PUTC ('-'); - val = build_int_2 (~TREE_INT_CST_LOW (val), - -TREE_INT_CST_HIGH (val)); - } - /* Would "%x%0*x" or "%x%*0x" get zero-padding on all - systems? */ - { - static char format[10]; /* "%x%09999x\0" */ - if (!format[0]) - sprintf (format, "%%x%%0%dx", HOST_BITS_PER_INT / 4); - sprintf (digit_buffer, format, TREE_INT_CST_HIGH (val), - TREE_INT_CST_LOW (val)); - OB_PUTCP (digit_buffer); - } - } - else - OB_PUTI (TREE_INT_CST_LOW (t)); - } - break; - - case REAL_CST: -#ifndef REAL_IS_NOT_DOUBLE - sprintf (digit_buffer, "%g", TREE_REAL_CST (t)); -#else - { - unsigned char *p = (unsigned char *) &TREE_REAL_CST (t); - size_t i; - strcpy (digit_buffer, "0x"); - for (i = 0; i < sizeof TREE_REAL_CST (t); i++) - sprintf (digit_buffer + 2 + 2*i, "%02x", *p++); - } -#endif - OB_PUTCP (digit_buffer); - break; - - case PTRMEM_CST: - OB_PUTC ('&'); - dump_type (PTRMEM_CST_CLASS (t), 0); - OB_PUTS ("::"); - OB_PUTID (DECL_NAME (PTRMEM_CST_MEMBER (t))); - break; - - case STRING_CST: - { - char *p = TREE_STRING_POINTER (t); - int len = TREE_STRING_LENGTH (t) - 1; - int i; - - OB_PUTC ('\"'); - for (i = 0; i < len; i++) - dump_char (p[i]); - OB_PUTC ('\"'); - } - break; - - case COMPOUND_EXPR: - dump_binary_op (",", t); - break; - - case COND_EXPR: - OB_PUTC ('('); - dump_expr (TREE_OPERAND (t, 0), 0); - OB_PUTS (" ? "); - dump_expr (TREE_OPERAND (t, 1), 0); - OB_PUTS (" : "); - dump_expr (TREE_OPERAND (t, 2), 0); - OB_PUTC (')'); - break; - - case SAVE_EXPR: - if (TREE_HAS_CONSTRUCTOR (t)) - { - OB_PUTS ("new "); - dump_type (TREE_TYPE (TREE_TYPE (t)), 0); - } - else - { - dump_expr (TREE_OPERAND (t, 0), 0); - } - break; - - case AGGR_INIT_EXPR: - OB_PUTID (TYPE_IDENTIFIER (TREE_TYPE (t))); - OB_PUTC ('('); - if (TREE_OPERAND (t, 1)) - dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1))); - OB_PUTC (')'); - break; - - case CALL_EXPR: - { - tree fn = TREE_OPERAND (t, 0); - tree args = TREE_OPERAND (t, 1); - - if (TREE_CODE (fn) == ADDR_EXPR) - fn = TREE_OPERAND (fn, 0); - - if (TREE_TYPE (fn) != NULL_TREE && NEXT_CODE (fn) == METHOD_TYPE) - { - tree ob = TREE_VALUE (args); - if (TREE_CODE (ob) == ADDR_EXPR) - { - dump_expr (TREE_OPERAND (ob, 0), 0); - OB_PUTC ('.'); - } - else if (TREE_CODE (ob) != PARM_DECL - || strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this")) - { - dump_expr (ob, 0); - OB_PUTC2 ('-', '>'); - } - args = TREE_CHAIN (args); - } - dump_expr (fn, 0); - OB_PUTC ('('); - dump_expr_list (args); - OB_PUTC (')'); - } - break; - - case NEW_EXPR: - { - tree type = TREE_OPERAND (t, 1); - if (NEW_EXPR_USE_GLOBAL (t)) - OB_PUTS ("::"); - OB_PUTS ("new "); - if (TREE_OPERAND (t, 0)) - { - OB_PUTC ('('); - dump_expr_list (TREE_OPERAND (t, 0)); - OB_PUTS (") "); - } - if (TREE_CODE (type) == ARRAY_REF) - type = build_cplus_array_type - (TREE_OPERAND (type, 0), - build_index_type (size_binop (MINUS_EXPR, TREE_OPERAND (type, 1), - integer_one_node))); - dump_type (type, 0); - if (TREE_OPERAND (t, 2)) - { - OB_PUTC ('('); - dump_expr_list (TREE_OPERAND (t, 2)); - OB_PUTC (')'); - } - } - break; - - case TARGET_EXPR: - /* Note that this only works for G++ target exprs. If somebody - builds a general TARGET_EXPR, there's no way to represent that - it initializes anything other that the parameter slot for the - default argument. Note we may have cleared out the first - operand in expand_expr, so don't go killing ourselves. */ - if (TREE_OPERAND (t, 1)) - dump_expr (TREE_OPERAND (t, 1), 0); - break; - - case MODIFY_EXPR: - case PLUS_EXPR: - case MINUS_EXPR: - case MULT_EXPR: - case TRUNC_DIV_EXPR: - case TRUNC_MOD_EXPR: - case MIN_EXPR: - case MAX_EXPR: - case LSHIFT_EXPR: - case RSHIFT_EXPR: - case BIT_IOR_EXPR: - case BIT_XOR_EXPR: - case BIT_AND_EXPR: - case BIT_ANDTC_EXPR: - case TRUTH_ANDIF_EXPR: - case TRUTH_ORIF_EXPR: - case LT_EXPR: - case LE_EXPR: - case GT_EXPR: - case GE_EXPR: - case EQ_EXPR: - case NE_EXPR: - dump_binary_op (opname_tab[(int) TREE_CODE (t)], t); - break; - - case CEIL_DIV_EXPR: - case FLOOR_DIV_EXPR: - case ROUND_DIV_EXPR: - dump_binary_op ("/", t); - break; - - case CEIL_MOD_EXPR: - case FLOOR_MOD_EXPR: - case ROUND_MOD_EXPR: - dump_binary_op ("%", t); - break; - - case COMPONENT_REF: - { - tree ob = TREE_OPERAND (t, 0); - if (TREE_CODE (ob) == INDIRECT_REF) - { - ob = TREE_OPERAND (ob, 0); - if (TREE_CODE (ob) != PARM_DECL - || strcmp (IDENTIFIER_POINTER (DECL_NAME (ob)), "this")) - { - dump_expr (ob, 0); - OB_PUTC2 ('-', '>'); - } - } - else - { - dump_expr (ob, 0); - OB_PUTC ('.'); - } - dump_expr (TREE_OPERAND (t, 1), 1); - } - break; - - case ARRAY_REF: - dump_expr (TREE_OPERAND (t, 0), 0); - OB_PUTC ('['); - dump_expr (TREE_OPERAND (t, 1), 0); - OB_PUTC (']'); - break; - - case CONVERT_EXPR: - dump_unary_op ("+", t, nop); - break; - - case ADDR_EXPR: - if (TREE_CODE (TREE_OPERAND (t, 0)) == FUNCTION_DECL - || TREE_CODE (TREE_OPERAND (t, 0)) == STRING_CST) - dump_expr (TREE_OPERAND (t, 0), 0); - else - dump_unary_op ("&", t, nop); - break; - - case INDIRECT_REF: - if (TREE_HAS_CONSTRUCTOR (t)) - { - t = TREE_OPERAND (t, 0); - my_friendly_assert (TREE_CODE (t) == CALL_EXPR, 237); - dump_expr (TREE_OPERAND (t, 0), 0); - OB_PUTC ('('); - dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1))); - OB_PUTC (')'); - } - else - { - if (TREE_OPERAND (t,0) != NULL_TREE - && TREE_TYPE (TREE_OPERAND (t, 0)) - && NEXT_CODE (TREE_OPERAND (t, 0)) == REFERENCE_TYPE) - dump_expr (TREE_OPERAND (t, 0), nop); - else - dump_unary_op ("*", t, nop); - } - break; - - case NEGATE_EXPR: - case BIT_NOT_EXPR: - case TRUTH_NOT_EXPR: - case PREDECREMENT_EXPR: - case PREINCREMENT_EXPR: - dump_unary_op (opname_tab [(int)TREE_CODE (t)], t, nop); - break; - - case POSTDECREMENT_EXPR: - case POSTINCREMENT_EXPR: - OB_PUTC ('('); - dump_expr (TREE_OPERAND (t, 0), 0); - OB_PUTCP (opname_tab[(int)TREE_CODE (t)]); - OB_PUTC (')'); - break; - - case NON_LVALUE_EXPR: - /* FIXME: This is a KLUDGE workaround for a parsing problem. There - should be another level of INDIRECT_REF so that I don't have to do - this. */ - if (TREE_TYPE (t) != NULL_TREE && NEXT_CODE (t) == POINTER_TYPE) - { - tree next = TREE_TYPE (TREE_TYPE (t)); - - while (TREE_CODE (next) == POINTER_TYPE) - next = TREE_TYPE (next); - - if (TREE_CODE (next) == FUNCTION_TYPE) - { - if (!nop) OB_PUTC ('('); - OB_PUTC ('*'); - dump_expr (TREE_OPERAND (t, 0), 1); - if (!nop) OB_PUTC (')'); - break; - } - /* else FALLTHRU */ - } - dump_expr (TREE_OPERAND (t, 0), 0); - break; - - case NOP_EXPR: - dump_expr (TREE_OPERAND (t, 0), nop); - break; - - case CONSTRUCTOR: - if (TREE_TYPE (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))) - { - tree idx = build_component_ref (t, index_identifier, NULL_TREE, 0); - - if (integer_all_onesp (idx)) - { - tree pfn = PFN_FROM_PTRMEMFUNC (t); - dump_unary_op ("&", pfn, 0); - break; - } - else if (TREE_CODE (idx) == INTEGER_CST - && tree_int_cst_equal (idx, integer_zero_node)) - { - /* A NULL pointer-to-member constant. */ - OB_PUTS ("(("); - dump_type (TREE_TYPE (t), 0); - OB_PUTS (") 0)"); - break; - } - else if (TREE_CODE (idx) == INTEGER_CST - && TREE_INT_CST_HIGH (idx) == 0) - { - tree virtuals; - unsigned HOST_WIDE_INT n; - - t = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t))); - t = TYPE_METHOD_BASETYPE (t); - virtuals = BINFO_VIRTUALS (TYPE_BINFO (TYPE_MAIN_VARIANT (t))); - - n = TREE_INT_CST_LOW (idx); - - /* Map vtable index back one, to allow for the null pointer to - member. */ - --n; - - while (n > 0 && virtuals) - { - --n; - virtuals = TREE_CHAIN (virtuals); - } - if (virtuals) - { - dump_expr (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0); - break; - } - } - } - OB_PUTC ('{'); - dump_expr_list (CONSTRUCTOR_ELTS (t)); - OB_PUTC ('}'); - break; - - case OFFSET_REF: - { - tree ob = TREE_OPERAND (t, 0); - if (is_dummy_object (ob)) - { - t = TREE_OPERAND (t, 1); - if (TREE_CODE (t) == FUNCTION_DECL) - /* A::f */ - dump_expr (t, 0); - else if (BASELINK_P (t)) - dump_expr (OVL_CURRENT (TREE_VALUE (t)), 0); - else - dump_decl (t, 0); - } - else - { - if (TREE_CODE (ob) == INDIRECT_REF) - { - dump_expr (TREE_OPERAND (ob, 0), 0); - OB_PUTS (" ->* "); - } - else - { - dump_expr (ob, 0); - OB_PUTS (" .* "); - } - dump_expr (TREE_OPERAND (t, 1), 0); - } - break; - } - - case TEMPLATE_PARM_INDEX: - dump_decl (TEMPLATE_PARM_DECL (t), -1); - break; - - case IDENTIFIER_NODE: - OB_PUTID (t); - break; - - case SCOPE_REF: - dump_type (TREE_OPERAND (t, 0), 0); - OB_PUTS ("::"); - dump_expr (TREE_OPERAND (t, 1), 0); - break; - - case CAST_EXPR: - if (TREE_OPERAND (t, 0) == NULL_TREE - || TREE_CHAIN (TREE_OPERAND (t, 0))) - { - dump_type (TREE_TYPE (t), 0); - OB_PUTC ('('); - dump_expr_list (TREE_OPERAND (t, 0)); - OB_PUTC (')'); - } - else - { - OB_PUTC ('('); - dump_type (TREE_TYPE (t), 0); - OB_PUTC (')'); - OB_PUTC ('('); - dump_expr_list (TREE_OPERAND (t, 0)); - OB_PUTC (')'); - } - break; - - case LOOKUP_EXPR: - OB_PUTID (TREE_OPERAND (t, 0)); - break; - - case ARROW_EXPR: - dump_expr (TREE_OPERAND (t, 0), nop); - OB_PUTS ("->"); - break; - - case SIZEOF_EXPR: - case ALIGNOF_EXPR: - if (TREE_CODE (t) == SIZEOF_EXPR) - OB_PUTS ("sizeof ("); - else - { - my_friendly_assert (TREE_CODE (t) == ALIGNOF_EXPR, 0); - OB_PUTS ("__alignof__ ("); - } - if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 0))) == 't') - dump_type (TREE_OPERAND (t, 0), 0); - else - dump_unary_op ("*", t, 0); - OB_PUTC (')'); - break; - - case DEFAULT_ARG: - OB_PUTS ("{unparsed}"); - break; - - case TRY_CATCH_EXPR: - case WITH_CLEANUP_EXPR: - case CLEANUP_POINT_EXPR: - dump_expr (TREE_OPERAND (t, 0), nop); - break; - - case TEMPLATE_ID_EXPR: - dump_decl (t, 0); - break; - - case TREE_LIST: - if (TREE_VALUE (t) && TREE_CODE (TREE_VALUE (t)) == FUNCTION_DECL) - { - OB_PUTID (DECL_NAME (TREE_VALUE (t))); - break; - } - /* else fall through */ - - /* This list is incomplete, but should suffice for now. - It is very important that `sorry' does not call - `report_error_function'. That could cause an infinite loop. */ - default: - sorry ("`%s' not supported by dump_expr", - tree_code_name[(int) TREE_CODE (t)]); - - /* fall through to ERROR_MARK... */ - case ERROR_MARK: - OB_PUTCP ("{error}"); - break; - } -} - -static void -dump_binary_op (opstring, t) - char *opstring; - tree t; -{ - OB_PUTC ('('); - dump_expr (TREE_OPERAND (t, 0), 1); - OB_PUTC (' '); - OB_PUTCP (opstring); - OB_PUTC (' '); - dump_expr (TREE_OPERAND (t, 1), 1); - OB_PUTC (')'); -} - -static void -dump_unary_op (opstring, t, nop) - char *opstring; - tree t; - int nop; -{ - if (!nop) OB_PUTC ('('); - OB_PUTCP (opstring); - dump_expr (TREE_OPERAND (t, 0), 1); - if (!nop) OB_PUTC (')'); -} - -/* Print a function decl with exception specification included. */ - -char * -fndecl_as_string (fndecl, print_default_args_p) - tree fndecl; - int print_default_args_p; -{ - OB_INIT (); - - dump_function_decl (fndecl, 2 + print_default_args_p); - - OB_FINISH (); - - return (char *)obstack_base (&scratch_obstack); -} - -/* Same, but handle a _TYPE. - Called from convert_to_reference, mangle_class_name_for_template, - build_unary_op, and GNU_xref_decl. If CANONICAL_NAME is non-zero, - when describing a typedef, we use the name of the type described, - rather than the name of the typedef. */ - -char * -type_as_string_real (typ, v, canonical_name) - tree typ; - int v; - int canonical_name; -{ - OB_INIT (); - - dump_type_real (typ, v, canonical_name); - - OB_FINISH (); - - return (char *)obstack_base (&scratch_obstack); -} - - -char * -type_as_string (typ, v) - tree typ; - int v; -{ - return type_as_string_real (typ, v, 0); -} - -char * -expr_as_string (decl, v) - tree decl; - int v ATTRIBUTE_UNUSED; -{ - OB_INIT (); - - dump_expr (decl, 1); - - OB_FINISH (); - - return (char *)obstack_base (&scratch_obstack); -} - -/* A cross between type_as_string and fndecl_as_string. - Only called from substitute_nice_name. */ - -char * -decl_as_string (decl, v) - tree decl; - int v; -{ - OB_INIT (); - - dump_decl (decl, v); - - OB_FINISH (); - - return (char *)obstack_base (&scratch_obstack); -} - -/* Generate the three forms of printable names for lang_printable_name. */ - -char * -lang_decl_name (decl, v) - tree decl; - int v; -{ - if (v >= 2) - return decl_as_string (decl, 1); - - OB_INIT (); - - if (v == 1 && DECL_CLASS_SCOPE_P (decl)) - { - tree cname; - if (TREE_CODE (decl) == FUNCTION_DECL) - cname = DECL_CLASS_CONTEXT (decl); - else - cname = DECL_CONTEXT (decl); - dump_type (cname, 0); - OB_PUTC2 (':', ':'); - } - - if (TREE_CODE (decl) == FUNCTION_DECL) - dump_function_name (decl); - else - dump_decl (DECL_NAME (decl), 0); - - OB_FINISH (); - - return (char *)obstack_base (&scratch_obstack); -} - - -char * -cp_file_of (t) - tree t; -{ - if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t)) - return DECL_SOURCE_FILE (DECL_CONTEXT (t)); - else if (TREE_CODE_CLASS (TREE_CODE (t)) == 't') - return DECL_SOURCE_FILE (TYPE_MAIN_DECL (t)); - else if (TREE_CODE (t) == OVERLOAD) - return DECL_SOURCE_FILE (OVL_FUNCTION (t)); - else - return DECL_SOURCE_FILE (t); -} - -int -cp_line_of (t) - tree t; -{ - int line = 0; - if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t)) - line = DECL_SOURCE_LINE (DECL_CONTEXT (t)); - if (TREE_CODE (t) == TYPE_DECL && DECL_ARTIFICIAL (t) - && TYPE_MAIN_DECL (TREE_TYPE (t))) - t = TREE_TYPE (t); - - if (TREE_CODE_CLASS (TREE_CODE (t)) == 't') - line = DECL_SOURCE_LINE (TYPE_MAIN_DECL (t)); - else if (TREE_CODE (t) == OVERLOAD) - line = DECL_SOURCE_LINE (OVL_FUNCTION (t)); - else - line = DECL_SOURCE_LINE (t); - - if (line == 0) - return lineno; - - return line; -} - -char * -code_as_string (c, v) - enum tree_code c; - int v ATTRIBUTE_UNUSED; -{ - return tree_code_name [c]; -} - -char * -language_as_string (c, v) - enum languages c; - int v ATTRIBUTE_UNUSED; -{ - switch (c) - { - case lang_c: - return "C"; - - case lang_cplusplus: - return "C++"; - - case lang_java: - return "Java"; - - default: - my_friendly_abort (355); - return 0; - } -} - -/* Return the proper printed version of a parameter to a C++ function. */ - -char * -parm_as_string (p, v) - int p; - int v ATTRIBUTE_UNUSED; -{ - if (p < 0) - return "`this'"; - - sprintf (digit_buffer, "%d", p+1); - return digit_buffer; -} - -char * -op_as_string (p, v) - enum tree_code p; - int v ATTRIBUTE_UNUSED; -{ - static char buf[] = "operator "; - - if (p == 0) - return "{unknown}"; - - strcpy (buf + 9, opname_tab [p]); - return buf; -} - -char * -assop_as_string (p, v) - enum tree_code p; - int v ATTRIBUTE_UNUSED; -{ - static char buf[] = "operator "; - - if (p == 0) - return "{unknown}"; - - strcpy (buf + 9, assignop_tab [p]); - return buf; -} - -char * -args_as_string (p, v) - tree p; - int v; -{ - if (p == NULL_TREE) - return ""; - - if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (p))) == 't') - return type_as_string (p, v); - - OB_INIT (); - for (; p; p = TREE_CHAIN (p)) - { - if (TREE_VALUE (p) == null_node) - OB_PUTS ("NULL"); - else - dump_type (error_type (TREE_VALUE (p)), v); - if (TREE_CHAIN (p)) - OB_PUTS (", "); - } - OB_FINISH (); - return (char *)obstack_base (&scratch_obstack); -} - -char * -cv_as_string (p, v) - tree p; - int v ATTRIBUTE_UNUSED; -{ - OB_INIT (); - - dump_qualifiers (p, before); - - OB_FINISH (); - - return (char *)obstack_base (&scratch_obstack); -} diff --git a/contrib/gcc/cp/except.c b/contrib/gcc/cp/except.c deleted file mode 100644 index 9e2d6af592aa..000000000000 --- a/contrib/gcc/cp/except.c +++ /dev/null @@ -1,1161 +0,0 @@ -/* Handle exceptional things in C++. - Copyright (C) 1989, 92-97, 1998, 1999 Free Software Foundation, Inc. - Contributed by Michael Tiemann - Rewritten by Mike Stump , based upon an - initial re-implementation courtesy Tad Hunt. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "rtl.h" -#include "cp-tree.h" -#include "flags.h" -#include "obstack.h" -#include "expr.h" -#include "output.h" -#include "except.h" -#include "function.h" -#include "defaults.h" -#include "toplev.h" -#include "eh-common.h" - -rtx expand_builtin_return_addr PROTO((enum built_in_function, int, rtx)); - -/* Holds the fndecl for __builtin_return_address. */ -tree builtin_return_address_fndecl; - -/* A couple of backend routines from m88k.c */ - -static void push_eh_cleanup PROTO((void)); -static tree build_eh_type_type PROTO((tree)); -static tree build_eh_type PROTO((tree)); -static void expand_end_eh_spec PROTO((tree)); -static tree call_eh_info PROTO((void)); -static void push_eh_info PROTO((void)); -static tree get_eh_info PROTO((void)); -static tree get_eh_value PROTO((void)); -#if 0 -static tree get_eh_type PROTO((void)); -static tree get_eh_caught PROTO((void)); -static tree get_eh_handlers PROTO((void)); -#endif -static tree do_pop_exception PROTO((void)); -static void process_start_catch_block PROTO((tree, tree)); -static tree build_eh_type_type_ref PROTO((tree)); -static tree build_terminate_handler PROTO((void)); -static tree alloc_eh_object PROTO((tree)); - -#if 0 -/* This is the startup, and finish stuff per exception table. */ - -/* XXX - Tad: exception handling section */ -#ifndef EXCEPT_SECTION_ASM_OP -#define EXCEPT_SECTION_ASM_OP "section\t.gcc_except_table,\"a\",@progbits" -#endif - -#ifdef EXCEPT_SECTION_ASM_OP - - /* on machines which support it, the exception table lives in another section, - but it needs a label so we can reference it... This sets up that - label! */ -asm (EXCEPT_SECTION_ASM_OP); -exception_table __EXCEPTION_TABLE__[1] = { (void*)0, (void*)0, (void*)0 }; -asm (TEXT_SECTION_ASM_OP); - -#endif /* EXCEPT_SECTION_ASM_OP */ - -#ifdef EXCEPT_SECTION_ASM_OP - - /* we need to know where the end of the exception table is... so this - is how we do it! */ - -asm (EXCEPT_SECTION_ASM_OP); -exception_table __EXCEPTION_END__[1] = { (void*)-1, (void*)-1, (void*)-1 }; -asm (TEXT_SECTION_ASM_OP); - -#endif /* EXCEPT_SECTION_ASM_OP */ - -#endif - -#include "decl.h" -#include "insn-flags.h" -#include "obstack.h" - -/* ====================================================================== - Briefly the algorithm works like this: - - When a constructor or start of a try block is encountered, - push_eh_entry (&eh_stack) is called. Push_eh_entry () creates a - new entry in the unwind protection stack and returns a label to - output to start the protection for that block. - - When a destructor or end try block is encountered, pop_eh_entry - (&eh_stack) is called. Pop_eh_entry () returns the eh_entry it - created when push_eh_entry () was called. The eh_entry structure - contains three things at this point. The start protect label, - the end protect label, and the exception handler label. The end - protect label should be output before the call to the destructor - (if any). If it was a destructor, then its parse tree is stored - in the finalization variable in the eh_entry structure. Otherwise - the finalization variable is set to NULL to reflect the fact that - it is the end of a try block. Next, this modified eh_entry node - is enqueued in the finalizations queue by calling - enqueue_eh_entry (&queue,entry). - - +---------------------------------------------------------------+ - |XXX: Will need modification to deal with partially | - | constructed arrays of objects | - | | - | Basically, this consists of keeping track of how many | - | of the objects have been constructed already (this | - | should be in a register though, so that shouldn't be a | - | problem. | - +---------------------------------------------------------------+ - - When a catch block is encountered, there is a lot of work to be - done. - - Since we don't want to generate the catch block inline with the - regular flow of the function, we need to have some way of doing - so. Luckily, we can use sequences to defer the catch sections. - When the start of a catch block is encountered, we start the - sequence. After the catch block is generated, we end the - sequence. - - Next we must insure that when the catch block is executed, all - finalizations for the matching try block have been completed. If - any of those finalizations throw an exception, we must call - terminate according to the ARM (section r.15.6.1). What this - means is that we need to dequeue and emit finalizations for each - entry in the eh_queue until we get to an entry with a NULL - finalization field. For any of the finalization entries, if it - is not a call to terminate (), we must protect it by giving it - another start label, end label, and exception handler label, - setting its finalization tree to be a call to terminate (), and - enqueue'ing this new eh_entry to be output at an outer level. - Finally, after all that is done, we can get around to outputting - the catch block which basically wraps all the "catch (...) {...}" - statements in a big if/then/else construct that matches the - correct block to call. - - ===================================================================== */ - -/* local globals for function calls - ====================================================================== */ - -/* Used to cache "terminate" and "__throw_type_match*". */ -static tree Terminate, CatchMatch; - -/* Used to cache __find_first_exception_table_match for throw. */ -static tree FirstExceptionMatch; - -/* Used to cache a call to __unwind_function. */ -static tree Unwind; - -/* ====================================================================== */ - - -/* ========================================================================= */ - - - -/* local globals - these local globals are for storing data necessary for - generating the exception table and code in the correct order. - - ========================================================================= */ - -extern rtx catch_clauses; -extern tree const_ptr_type_node; - -/* ========================================================================= */ - -/* sets up all the global eh stuff that needs to be initialized at the - start of compilation. - - This includes: - - Setting up all the function call trees. */ - -void -init_exception_processing () -{ - /* void vtype () */ - tree vtype = build_function_type (void_type_node, void_list_node); - - if (flag_honor_std) - push_namespace (get_identifier ("std")); - Terminate = auto_function (get_identifier ("terminate"), - vtype, NOT_BUILT_IN); - TREE_THIS_VOLATILE (Terminate) = 1; - if (flag_honor_std) - pop_namespace (); - - push_lang_context (lang_name_c); - - set_exception_lang_code (EH_LANG_C_plus_plus); - set_exception_version_code (1); - - CatchMatch - = builtin_function (flag_rtti - ? "__throw_type_match_rtti" - : "__throw_type_match", - build_function_type (ptr_type_node, - tree_cons (NULL_TREE, const_ptr_type_node, - tree_cons (NULL_TREE, const_ptr_type_node, - tree_cons (NULL_TREE, ptr_type_node, - void_list_node)))), - NOT_BUILT_IN, NULL_PTR); - FirstExceptionMatch - = builtin_function ("__find_first_exception_table_match", - build_function_type (ptr_type_node, - tree_cons (NULL_TREE, ptr_type_node, - void_list_node)), - NOT_BUILT_IN, NULL_PTR); - Unwind - = builtin_function ("__unwind_function", - build_function_type (void_type_node, - tree_cons (NULL_TREE, ptr_type_node, - void_list_node)), - NOT_BUILT_IN, NULL_PTR); - - pop_lang_context (); - - /* If we use setjmp/longjmp EH, arrange for all cleanup actions to - be protected with __terminate. */ - protect_cleanup_actions_with_terminate = 1; -} - -/* Retrieve a pointer to the cp_eh_info node for the current exception. */ - -static tree -call_eh_info () -{ - tree fn; - - fn = get_identifier ("__start_cp_handler"); - if (IDENTIFIER_GLOBAL_VALUE (fn)) - fn = IDENTIFIER_GLOBAL_VALUE (fn); - else - { - tree t1, t, fields[7]; - - /* Declare cp_eh_info * __start_cp_handler (void), - as defined in exception.cc. */ - push_obstacks_nochange (); - end_temporary_allocation (); - - /* struct cp_eh_info. This must match exception.cc. Note that this - type is not pushed anywhere. */ - t1= make_lang_type (RECORD_TYPE); - fields[0] = build_lang_field_decl (FIELD_DECL, - get_identifier ("handler_label"), ptr_type_node); - fields[1] = build_lang_field_decl (FIELD_DECL, - get_identifier ("dynamic_handler_chain"), ptr_type_node); - fields[2] = build_lang_field_decl (FIELD_DECL, - get_identifier ("info"), ptr_type_node); - fields[3] = build_lang_field_decl (FIELD_DECL, - get_identifier ("table_index"), ptr_type_node); - /* N.B.: The fourth field LEN is expected to be - the number of fields - 1, not the total number of fields. */ - finish_builtin_type (t1, "eh_context", fields, 3, ptr_type_node); - t1 = build_pointer_type (t1); - - t1= make_lang_type (RECORD_TYPE); - fields[0] = build_lang_field_decl (FIELD_DECL, - get_identifier ("match_function"), ptr_type_node); - fields[1] = build_lang_field_decl (FIELD_DECL, - get_identifier ("language"), short_integer_type_node); - fields[2] = build_lang_field_decl (FIELD_DECL, - get_identifier ("version"), short_integer_type_node); - /* N.B.: The fourth field LEN is expected to be - the number of fields - 1, not the total number of fields. */ - finish_builtin_type (t1, "__eh_info", fields, 2, ptr_type_node); - t = make_lang_type (RECORD_TYPE); - fields[0] = build_lang_field_decl (FIELD_DECL, - get_identifier ("eh_info"), t1); - fields[1] = build_lang_field_decl (FIELD_DECL, get_identifier ("value"), - ptr_type_node); - fields[2] = build_lang_field_decl (FIELD_DECL, get_identifier ("type"), - ptr_type_node); - fields[3] = build_lang_field_decl - (FIELD_DECL, get_identifier ("cleanup"), - build_pointer_type (build_function_type - (ptr_type_node, tree_cons - (NULL_TREE, ptr_type_node, void_list_node)))); - fields[4] = build_lang_field_decl (FIELD_DECL, get_identifier ("caught"), - boolean_type_node); - fields[5] = build_lang_field_decl (FIELD_DECL, get_identifier ("next"), - build_pointer_type (t)); - fields[6] = build_lang_field_decl - (FIELD_DECL, get_identifier ("handlers"), long_integer_type_node); - /* N.B.: The fourth field LEN is expected to be - the number of fields - 1, not the total number of fields. */ - finish_builtin_type (t, "cp_eh_info", fields, 6, ptr_type_node); - t = build_pointer_type (t); - - /* And now the function. */ - fn = build_lang_decl (FUNCTION_DECL, fn, - build_function_type (t, void_list_node)); - DECL_EXTERNAL (fn) = 1; - TREE_PUBLIC (fn) = 1; - DECL_ARTIFICIAL (fn) = 1; - pushdecl_top_level (fn); - make_function_rtl (fn); - pop_obstacks (); - } - mark_used (fn); - return build_function_call (fn, NULL_TREE); -} - -/* Retrieve a pointer to the cp_eh_info node for the current exception - and save it in the current binding level. */ - -static void -push_eh_info () -{ - tree decl, fn = call_eh_info (); - - /* Remember the pointer to the current exception info; it won't change - during this catch block. */ - decl = build_decl (VAR_DECL, get_identifier ("__exception_info"), - TREE_TYPE (fn)); - DECL_ARTIFICIAL (decl) = 1; - DECL_INITIAL (decl) = fn; - decl = pushdecl (decl); - cp_finish_decl (decl, fn, NULL_TREE, 0, 0); -} - -/* Returns a reference to the cp_eh_info node for the current exception. */ - -static tree -get_eh_info () -{ - /* Look for the pointer pushed in push_eh_info. */ - tree t = lookup_name (get_identifier ("__exception_info"), 0); - return build_indirect_ref (t, NULL_PTR); -} - -/* Returns a reference to the current exception object. */ - -static tree -get_eh_value () -{ - return build_component_ref (get_eh_info (), get_identifier ("value"), - NULL_TREE, 0); -} - -/* Returns a reference to the current exception type. */ - -#if 0 -static tree -get_eh_type () -{ - return build_component_ref (get_eh_info (), get_identifier ("type"), - NULL_TREE, 0); -} - -/* Returns a reference to whether or not the current exception - has been caught. */ - -static tree -get_eh_caught () -{ - return build_component_ref (get_eh_info (), get_identifier ("caught"), - NULL_TREE, 0); -} - -/* Returns a reference to whether or not the current exception - has been caught. */ - -static tree -get_eh_handlers () -{ - return build_component_ref (get_eh_info (), get_identifier ("handlers"), - NULL_TREE, 0); -} -#endif - -/* Build a type value for use at runtime for a type that is matched - against by the exception handling system. */ - -static tree -build_eh_type_type (type) - tree type; -{ - const char *typestring; - tree exp; - - if (type == error_mark_node) - return error_mark_node; - - /* peel back references, so they match. */ - if (TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); - - /* Peel off cv qualifiers. */ - type = TYPE_MAIN_VARIANT (type); - - if (flag_rtti) - return build1 (ADDR_EXPR, ptr_type_node, get_typeid_1 (type)); - - typestring = build_overload_name (type, 1, 1); - exp = combine_strings (build_string (strlen (typestring)+1, typestring)); - return build1 (ADDR_EXPR, ptr_type_node, exp); -} - -/* Build the address of a runtime type for use in the runtime matching - field of the new exception model */ - -static tree -build_eh_type_type_ref (type) - tree type; -{ - const char *typestring; - tree exp; - - if (type == error_mark_node) - return error_mark_node; - - /* peel back references, so they match. */ - if (TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); - - /* Peel off cv qualifiers. */ - type = TYPE_MAIN_VARIANT (type); - - push_obstacks_nochange (); - end_temporary_allocation (); - - if (flag_rtti) - { - exp = get_tinfo_fn (type); - TREE_USED (exp) = 1; - mark_inline_for_output (exp); - exp = build1 (ADDR_EXPR, ptr_type_node, exp); - } - else - { - typestring = build_overload_name (type, 1, 1); - exp = combine_strings (build_string (strlen (typestring)+1, typestring)); - exp = build1 (ADDR_EXPR, ptr_type_node, exp); - } - pop_obstacks (); - return (exp); -} - - -/* Build a type value for use at runtime for a exp that is thrown or - matched against by the exception handling system. */ - -static tree -build_eh_type (exp) - tree exp; -{ - if (flag_rtti) - { - exp = build_typeid (exp); - return build1 (ADDR_EXPR, ptr_type_node, exp); - } - return build_eh_type_type (TREE_TYPE (exp)); -} - -/* This routine is called to mark all the symbols representing runtime - type functions in the exception table as haveing been referenced. - This will make sure code is emitted for them. Called from finish_file. */ -void -mark_all_runtime_matches () -{ - int x,num; - void **ptr; - tree exp; - - num = find_all_handler_type_matches (&ptr); - if (num == 0 || ptr == NULL) - return; - - for (x=0; x -#include "gansidecl.h" /* Needed to support macros used in eh-common.h. */ -#include "eh-common.h" - -/* Define terminate, unexpected, set_terminate, set_unexpected as - well as the default terminate func and default unexpected func. */ - -extern std::terminate_handler __terminate_func __attribute__((__noreturn__)); -using std::terminate; - -void -std::terminate () -{ - __terminate_func (); -} - -void -__default_unexpected () -{ - terminate (); -} - -static std::unexpected_handler __unexpected_func __attribute__((__noreturn__)) - = __default_unexpected; - -std::terminate_handler -std::set_terminate (std::terminate_handler func) -{ - std::terminate_handler old = __terminate_func; - - __terminate_func = func; - return old; -} - -std::unexpected_handler -std::set_unexpected (std::unexpected_handler func) -{ - std::unexpected_handler old = __unexpected_func; - - __unexpected_func = func; - return old; -} - -void -std::unexpected () -{ - __unexpected_func (); -} - -/* C++-specific state about the current exception. - This must match init_exception_processing(). - - Note that handlers and caught are not redundant; when rethrown, an - exception can have multiple active handlers and still be considered - uncaught. */ - -struct cp_eh_info -{ - __eh_info eh_info; - void *value; - void *type; - void (*cleanup)(void *, int); - bool caught; - cp_eh_info *next; - long handlers; - void *original_value; -}; - -/* Language-specific EH info pointer, defined in libgcc2. */ - -extern "C" cp_eh_info **__get_eh_info (); // actually void ** - -/* Is P the type_info node for a pointer of some kind? */ - -extern bool __is_pointer (void *); - - -/* OLD Compiler hook to return a pointer to the info for the current exception. - Used by get_eh_info (). This fudges the actualy returned value to - point to the beginning of what USE to be the cp_eh_info structure. - THis is so that old code that dereferences this pointer will find - things where it expects it to be.*/ -extern "C" void * -__cp_exception_info (void) -{ - return &((*__get_eh_info ())->value); -} - -#define CP_EH_INFO ((cp_eh_info *) *__get_eh_info ()) - -/* Old Compiler hook to return a pointer to the info for the current exception. - Used by get_eh_info (). */ - -extern "C" cp_eh_info * -__cp_eh_info (void) -{ - cp_eh_info *p = CP_EH_INFO; - return p; -} - -/* Compiler hook to return a pointer to the info for the current exception, - Set the caught bit, and increment the number of handlers that are - looking at this exception. This makes handlers smaller. */ - -extern "C" cp_eh_info * -__start_cp_handler (void) -{ - cp_eh_info *p = CP_EH_INFO; - p->caught = 1; - p->handlers++; - return p; -} - -/* Allocate a buffer for a cp_eh_info and an exception object of size SIZE, - and return a pointer to the beginning of the object's space. */ - -extern "C" void * malloc (size_t); -extern "C" void * -__eh_alloc (size_t size) -{ - void *p = malloc (size); - if (p == 0) - terminate (); - return p; -} - -/* Free the memory for an cp_eh_info and associated exception, given - a pointer to the cp_eh_info. */ - -extern "C" void free (void *); -extern "C" void -__eh_free (void *p) -{ - free (p); -} - - -typedef void * (* rtimetype) (void); - -extern "C" void * -__cplus_type_matcher (cp_eh_info *info, rtimetype match_info, - exception_descriptor *exception_table) -{ - void *ret; - - /* No exception table implies the old style mechanism, so don't check. */ - if (exception_table != NULL - && exception_table->lang.language != EH_LANG_C_plus_plus) - return NULL; - - if (match_info == CATCH_ALL_TYPE) - return info->value; - - /* we don't worry about version info yet, there is only one version! */ - - void *match_type = match_info (); - ret = __throw_type_match_rtti (match_type, info->type, info->original_value); - /* change value of exception */ - if (ret) - info->value = ret; - return ret; -} - - -/* Compiler hook to push a new exception onto the stack. - Used by expand_throw(). */ - -extern "C" void -__cp_push_exception (void *value, void *type, void (*cleanup)(void *, int)) -{ - cp_eh_info *p = (cp_eh_info *) __eh_alloc (sizeof (cp_eh_info)); - - p->value = value; - p->type = type; - p->cleanup = cleanup; - p->handlers = 0; - p->caught = false; - p->original_value = value; - - p->eh_info.match_function = __cplus_type_matcher; - p->eh_info.language = EH_LANG_C_plus_plus; - p->eh_info.version = 1; - - cp_eh_info **q = __get_eh_info (); - - p->next = *q; - *q = p; -} - -/* Compiler hook to pop an exception that has been finalized. Used by - push_eh_cleanup(). P is the info for the exception caught by the - current catch block. */ - -extern "C" void -__cp_pop_exception (cp_eh_info *p) -{ - cp_eh_info **q = __get_eh_info (); - - --p->handlers; - - /* Don't really pop if there are still active handlers for our exception, - or if our exception is being rethrown (i.e. if the active exception is - our exception and it is uncaught). */ - if (p->handlers != 0 - || (p == *q && !p->caught)) - return; - - for (; *q; q = &((*q)->next)) - if (*q == p) - break; - - if (! *q) - terminate (); - - *q = p->next; - - if (p->cleanup) - /* 2 is a magic value for destructors; see build_delete(). */ - p->cleanup (p->original_value, 2); // value may have been adjusted. - - if (! __is_pointer (p->type)) - __eh_free (p->original_value); // value may have been adjusted. - - __eh_free (p); -} - -extern "C" void -__uncatch_exception (void) -{ - cp_eh_info *p = CP_EH_INFO; - if (p == 0) - terminate (); - p->caught = false; -} - -/* As per [except.unexpected]: - If an exception is thrown, we check it against the spec. If it doesn't - match, we call unexpected (). If unexpected () throws, we check that - exception against the spec. If it doesn't match, if the spec allows - bad_exception we throw that; otherwise we call terminate (). - - The compiler treats an exception spec as a try block with a generic - handler that just calls this function with a list of the allowed - exception types, so we have an active exception that can be rethrown. - - This function does not return. */ - -extern "C" void -__check_eh_spec (int n, const void **spec) -{ - cp_eh_info *p = CP_EH_INFO; - - for (int i = 0; i < n; ++i) - { - if (__throw_type_match_rtti (spec[i], p->type, p->value)) - throw; - } - - try - { - std::unexpected (); - } - catch (...) - { - // __exception_info is an artificial var pushed into each catch block. - if (p != __exception_info) - { - p = __exception_info; - for (int i = 0; i < n; ++i) - { - if (__throw_type_match_rtti (spec[i], p->type, p->value)) - throw; - } - } - - const std::type_info &bad_exc = typeid (std::bad_exception); - for (int i = 0; i < n; ++i) - { - if (__throw_type_match_rtti (spec[i], &bad_exc, p->value)) - throw std::bad_exception (); - } - - terminate (); - } -} - -extern "C" void -__throw_bad_cast (void) -{ - throw std::bad_cast (); -} - -extern "C" void -__throw_bad_typeid (void) -{ - throw std::bad_typeid (); -} - -/* Has the current exception been caught? */ - -bool -std::uncaught_exception () -{ - cp_eh_info *p = CP_EH_INFO; - return p && ! p->caught; -} - -const char * std::exception:: -what () const -{ - return typeid (*this).name (); -} diff --git a/contrib/gcc/cp/expr.c b/contrib/gcc/cp/expr.c deleted file mode 100644 index 83bdff9eba76..000000000000 --- a/contrib/gcc/cp/expr.c +++ /dev/null @@ -1,461 +0,0 @@ -/* Convert language-specific tree expression to rtl instructions, - for GNU compiler. - Copyright (C) 1988, 92-97, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "tree.h" -#include "flags.h" -#include "expr.h" -#include "cp-tree.h" -#include "toplev.h" - -#if 0 -static tree extract_aggr_init PROTO((tree, tree)); -static tree extract_scalar_init PROTO((tree, tree)); -#endif -static rtx cplus_expand_expr PROTO((tree, rtx, enum machine_mode, - enum expand_modifier)); - -/* Hook used by output_constant to expand language-specific - constants. */ - -static tree -cplus_expand_constant (cst) - tree cst; -{ - switch (TREE_CODE (cst)) - { - case PTRMEM_CST: - { - tree type = TREE_TYPE (cst); - tree member; - tree offset; - - /* Find the member. */ - member = PTRMEM_CST_MEMBER (cst); - - if (TREE_CODE (member) == FIELD_DECL) - { - /* Find the offset for the field. */ - offset = convert (sizetype, - size_binop (EASY_DIV_EXPR, - DECL_FIELD_BITPOS (member), - size_int (BITS_PER_UNIT))); - - /* We offset all pointer to data members by 1 so that we - can distinguish between a null pointer to data member - and the first data member of a structure. */ - offset = size_binop (PLUS_EXPR, offset, size_int (1)); - - cst = cp_convert (type, offset); - } - else - { - tree delta; - tree idx; - tree pfn; - tree delta2; - - expand_ptrmemfunc_cst (cst, &delta, &idx, &pfn, &delta2); - - cst = build_ptrmemfunc1 (type, delta, idx, - pfn, delta2); - } - } - break; - - default: - /* There's nothing to do. */ - break; - } - - return cst; -} - -/* Hook used by expand_expr to expand language-specific tree codes. */ - -static rtx -cplus_expand_expr (exp, target, tmode, modifier) - tree exp; - rtx target; - enum machine_mode tmode; - enum expand_modifier modifier; -{ - tree type = TREE_TYPE (exp); - register enum machine_mode mode = TYPE_MODE (type); - register enum tree_code code = TREE_CODE (exp); - int ignore = target == const0_rtx; - - if (ignore) - target = 0; - - /* No sense saving up arithmetic to be done - if it's all in the wrong mode to form part of an address. - And force_operand won't know whether to sign-extend or zero-extend. */ - - if (mode != Pmode && modifier == EXPAND_SUM) - modifier = EXPAND_NORMAL; - - switch (code) - { - case AGGR_INIT_EXPR: - { - /* Something needs to be initialized, but we didn't know - where that thing was when building the tree. For example, - it could be the return value of a function, or a parameter - to a function which lays down in the stack, or a temporary - variable which must be passed by reference. - - Cleanups are handled in a language-specific way: they - might be run by the called function (true in GNU C++ - for parameters with cleanups), or they might be - run by the caller, after the call (true in GNU C++ - for other cleanup needs). */ - - tree func = TREE_OPERAND (exp, 0); - tree args = TREE_OPERAND (exp, 1); - tree type = TREE_TYPE (exp), slot; - tree call_exp; - rtx call_target, return_target; - int pcc_struct_return = 0; - - /* The expression `init' wants to initialize what - `target' represents. SLOT holds the slot for TARGET. */ - slot = TREE_OPERAND (exp, 2); - - /* Should always be called with a target. */ - my_friendly_assert (target != NULL_RTX, 205); - - /* The target the initializer will initialize (CALL_TARGET) - must now be directed to initialize the target we are - supposed to initialize (TARGET). The semantics for - choosing what CALL_TARGET is is language-specific, - as is building the call which will perform the - initialization. It is left here to show the choices that - exist for C++. */ - - if (TREE_CODE (func) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (func, 0)) == FUNCTION_DECL - && DECL_CONSTRUCTOR_P (TREE_OPERAND (func, 0))) - { - type = build_pointer_type (type); - /* Don't clobber a value that might be part of a default - parameter value. */ - mark_addressable (slot); - if (TREE_PERMANENT (args)) - args = expr_tree_cons (0, build1 (ADDR_EXPR, type, slot), - TREE_CHAIN (args)); - else - TREE_VALUE (args) = build1 (ADDR_EXPR, type, slot); - call_target = 0; - } - else - { - call_target = target; -#ifdef PCC_STATIC_STRUCT_RETURN - if (aggregate_value_p (type)) - { - pcc_struct_return = 1; - call_target = 0; - } -#endif - } - - call_exp = build (CALL_EXPR, type, func, args, NULL_TREE); - TREE_SIDE_EFFECTS (call_exp) = 1; - return_target = expand_call (call_exp, call_target, ignore); - - if (call_target) - /* Trust that the right thing has been done; it's too hard to - verify. */ - return return_target; - - /* If we're suffering under the ancient PCC_STATIC_STRUCT_RETURN - calling convention, we need to copy the return value out of - the static return buffer into slot. */ - if (pcc_struct_return) - { - extern int flag_access_control; - int old_ac = flag_access_control; - - tree init = build_decl (VAR_DECL, NULL_TREE, - build_reference_type (type)); - DECL_RTL (init) = XEXP (return_target, 0); - init = convert_from_reference (init); - - flag_access_control = 0; - expand_aggr_init (slot, init, LOOKUP_ONLYCONVERTING); - flag_access_control = old_ac; - - if (TYPE_NEEDS_DESTRUCTOR (type)) - { - init = maybe_build_cleanup (init); - if (init != NULL_TREE) - expand_expr (init, const0_rtx, VOIDmode, 0); - } - } - - return DECL_RTL (slot); - } - - case PTRMEM_CST: - return expand_expr (cplus_expand_constant (exp), - target, tmode, modifier); - - case OFFSET_REF: - { - return expand_expr (default_conversion (resolve_offset_ref (exp)), - target, tmode, EXPAND_NORMAL); - } - - case THUNK_DECL: - return DECL_RTL (exp); - - case THROW_EXPR: - expand_throw (TREE_OPERAND (exp, 0)); - return NULL; - - case VEC_INIT_EXPR: - return expand_expr - (expand_vec_init - (NULL_TREE, TREE_OPERAND (exp, 0), - build_binary_op (MINUS_EXPR, TREE_OPERAND (exp, 2), - integer_one_node), - TREE_OPERAND (exp, 1), 0), target, tmode, modifier); - - case NEW_EXPR: - return expand_expr (build_new_1 (exp), target, tmode, modifier); - - default: - break; - } - my_friendly_abort (40); - /* NOTREACHED */ - return NULL; -} - -void -init_cplus_expand () -{ - lang_expand_expr = cplus_expand_expr; - lang_expand_constant = cplus_expand_constant; -} - -/* If DECL had its rtl moved from where callers expect it - to be, fix it up. RESULT is the nominal rtl for the RESULT_DECL, - which may be a pseudo instead of a hard register. */ - -void -fixup_result_decl (decl, result) - tree decl; - rtx result; -{ - if (REG_P (result)) - { - if (REGNO (result) >= FIRST_PSEUDO_REGISTER) - { - rtx real_decl_result; - -#ifdef FUNCTION_OUTGOING_VALUE - real_decl_result - = FUNCTION_OUTGOING_VALUE (TREE_TYPE (decl), current_function_decl); -#else - real_decl_result - = FUNCTION_VALUE (TREE_TYPE (decl), current_function_decl); -#endif - REG_FUNCTION_VALUE_P (real_decl_result) = 1; - result = real_decl_result; - } - store_expr (decl, result, 0); - emit_insn (gen_rtx (USE, VOIDmode, result)); - } -} - -#if 0 -/* Expand this initialization inline and see if it's simple enough that - it can be done at compile-time. */ - -static tree -extract_aggr_init (decl, init) - tree decl, init; -{ - return 0; -} - -static tree -extract_scalar_init (decl, init) - tree decl, init; -{ - rtx value, insns, insn; - extern struct obstack temporary_obstack; - tree t = NULL_TREE; - - push_obstacks (&temporary_obstack, &temporary_obstack); - start_sequence (); - value = expand_expr (init, NULL_RTX, VOIDmode, 0); - insns = get_insns (); - end_sequence (); - reg_scan (insns, max_reg_num (), 0); - jump_optimize (insns, 0, 0, 1); - pop_obstacks (); - - for (insn = insns; insn; insn = NEXT_INSN (insn)) - { - rtx r, to; - - if (GET_CODE (insn) == NOTE) - continue; - else if (GET_CODE (insn) != INSN) - return 0; - - r = PATTERN (insn); - if (GET_CODE (r) != SET) - return 0; - - to = XEXP (r, 0); - - if (! (to == value - || (GET_CODE (to) == SUBREG && XEXP (to, 0) == value))) - return 0; - - r = XEXP (r, 1); - - switch (GET_CODE (r)) - { - case CONST_INT: - t = build_int_2 (XEXP (r, 0), 0); - break; - default: - return 0; - } - } - - return t; -} -#endif - -int -extract_init (decl, init) - tree decl ATTRIBUTE_UNUSED, init ATTRIBUTE_UNUSED; -{ - return 0; - -#if 0 - if (IS_AGGR_TYPE (TREE_TYPE (decl)) - || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE) - init = extract_aggr_init (decl, init); - else - init = extract_scalar_init (decl, init); - - if (init == NULL_TREE) - return 0; - - DECL_INITIAL (decl) = init; - return 1; -#endif -} - -void -do_case (start, end) - tree start, end; -{ - tree value1 = NULL_TREE, value2 = NULL_TREE, label; - - if (start != NULL_TREE && TREE_TYPE (start) != NULL_TREE - && POINTER_TYPE_P (TREE_TYPE (start))) - error ("pointers are not permitted as case values"); - - if (end && pedantic) - pedwarn ("ANSI C++ forbids range expressions in switch statement"); - - if (processing_template_decl) - { - add_tree (build_min_nt (CASE_LABEL, start, end)); - return; - } - - if (start) - value1 = check_cp_case_value (start); - if (end) - value2 = check_cp_case_value (end); - - label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - - if (value1 != error_mark_node - && value2 != error_mark_node) - { - tree duplicate; - int success; - - if (end) - success = pushcase_range (value1, value2, convert_and_check, - label, &duplicate); - else if (start) - success = pushcase (value1, convert_and_check, label, &duplicate); - else - success = pushcase (NULL_TREE, 0, label, &duplicate); - - if (success == 1) - { - if (end) - error ("case label not within a switch statement"); - else if (start) - cp_error ("case label `%E' not within a switch statement", start); - else - error ("default label not within a switch statement"); - } - else if (success == 2) - { - if (end) - { - error ("duplicate (or overlapping) case value"); - cp_error_at ("this is the first entry overlapping that value", - duplicate); - } - else if (start) - { - cp_error ("duplicate case value `%E'", start); - cp_error_at ("previously used here", duplicate); - } - else - { - error ("multiple default labels in one switch"); - cp_error_at ("this is the first default label", duplicate); - } - } - else if (success == 3) - warning ("case value out of range"); - else if (success == 4) - warning ("empty range specified"); - else if (success == 5) - { - if (end) - error ("case label within scope of cleanup or variable array"); - else if (! start) - error ("`default' label within scope of cleanup or variable array"); - else - cp_error ("case label `%E' within scope of cleanup or variable array", start); - } - } - define_case_label (); -} diff --git a/contrib/gcc/cp/friend.c b/contrib/gcc/cp/friend.c deleted file mode 100644 index 5085ebc7747c..000000000000 --- a/contrib/gcc/cp/friend.c +++ /dev/null @@ -1,472 +0,0 @@ -/* Help friends in C++. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "rtl.h" -#include "cp-tree.h" -#include "flags.h" -#include "output.h" -#include "toplev.h" - -/* Friend data structures are described in cp-tree.h. */ - -/* Returns non-zero if SUPPLICANT is a friend of TYPE. */ - -int -is_friend (type, supplicant) - tree type, supplicant; -{ - int declp; - register tree list; - tree context; - - if (supplicant == NULL_TREE || type == NULL_TREE) - return 0; - - declp = (TREE_CODE_CLASS (TREE_CODE (supplicant)) == 'd'); - - if (declp) - /* It's a function decl. */ - { - tree list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type)); - tree name = DECL_NAME (supplicant); - tree ctype; - - if (DECL_FUNCTION_MEMBER_P (supplicant)) - ctype = DECL_CLASS_CONTEXT (supplicant); - else - ctype = NULL_TREE; - - for (; list ; list = TREE_CHAIN (list)) - { - if (name == FRIEND_NAME (list)) - { - tree friends = FRIEND_DECLS (list); - for (; friends ; friends = TREE_CHAIN (friends)) - { - if (same_type_p (ctype, TREE_PURPOSE (friends))) - return 1; - - if (TREE_VALUE (friends) == NULL_TREE) - continue; - - if (supplicant == TREE_VALUE (friends)) - return 1; - - /* With -fguiding-decls we are more lenient about - friendship. This is bogus in general since two - specializations of a template with non-type - template parameters may have the same type, but - be different. - - Temporarily, we are also more lenient to deal - with nested friend functions, for which there can - be more than one FUNCTION_DECL, despite being the - same function. When that's fixed, the - FUNCTION_MEMBER_P bit can go. */ - if ((flag_guiding_decls - || DECL_FUNCTION_MEMBER_P (supplicant)) - && same_type_p (TREE_TYPE (supplicant), - TREE_TYPE (TREE_VALUE (friends)))) - return 1; - - if (TREE_CODE (TREE_VALUE (friends)) == TEMPLATE_DECL - && is_specialization_of (supplicant, - TREE_VALUE (friends))) - return 1; - } - break; - } - } - } - else - /* It's a type. */ - { - if (type == supplicant) - return 1; - - list = CLASSTYPE_FRIEND_CLASSES (TREE_TYPE (TYPE_MAIN_DECL (type))); - for (; list ; list = TREE_CHAIN (list)) - { - tree t = TREE_VALUE (list); - - if (TREE_CODE (t) == TEMPLATE_DECL ? - is_specialization_of (TYPE_MAIN_DECL (supplicant), t) : - same_type_p (supplicant, t)) - return 1; - } - } - - if (declp && DECL_FUNCTION_MEMBER_P (supplicant)) - context = DECL_CLASS_CONTEXT (supplicant); - else if (! declp) - /* Local classes have the same access as the enclosing function. */ - context = hack_decl_function_context (TYPE_MAIN_DECL (supplicant)); - else - context = NULL_TREE; - - /* A namespace is not friend to anybody. */ - if (context && TREE_CODE (context) == NAMESPACE_DECL) - context = NULL_TREE; - - if (context) - return is_friend (type, context); - - return 0; -} - -/* Add a new friend to the friends of the aggregate type TYPE. - DECL is the FUNCTION_DECL of the friend being added. */ - -void -add_friend (type, decl) - tree type, decl; -{ - tree typedecl; - tree list; - tree name; - - if (decl == error_mark_node) - return; - - typedecl = TYPE_MAIN_DECL (type); - list = DECL_FRIENDLIST (typedecl); - name = DECL_NAME (decl); - type = TREE_TYPE (typedecl); - - while (list) - { - if (name == FRIEND_NAME (list)) - { - tree friends = FRIEND_DECLS (list); - for (; friends ; friends = TREE_CHAIN (friends)) - { - if (decl == TREE_VALUE (friends)) - { - cp_warning ("`%D' is already a friend of class `%T'", - decl, type); - cp_warning_at ("previous friend declaration of `%D'", - TREE_VALUE (friends)); - return; - } - } - TREE_VALUE (list) = tree_cons (error_mark_node, decl, - TREE_VALUE (list)); - return; - } - list = TREE_CHAIN (list); - } - - DECL_FRIENDLIST (typedecl) - = tree_cons (DECL_NAME (decl), build_tree_list (error_mark_node, decl), - DECL_FRIENDLIST (typedecl)); - if (!uses_template_parms (type)) - DECL_BEFRIENDING_CLASSES (decl) - = tree_cons (NULL_TREE, type, - DECL_BEFRIENDING_CLASSES (decl)); -} - -/* Declare that every member function NAME in FRIEND_TYPE - (which may be NULL_TREE) is a friend of type TYPE. */ - -void -add_friends (type, name, friend_type) - tree type, name, friend_type; -{ - tree typedecl = TYPE_MAIN_DECL (type); - tree list = DECL_FRIENDLIST (typedecl); - - while (list) - { - if (name == FRIEND_NAME (list)) - { - tree friends = FRIEND_DECLS (list); - while (friends && TREE_PURPOSE (friends) != friend_type) - friends = TREE_CHAIN (friends); - if (friends) - { - if (friend_type) - warning ("method `%s::%s' is already a friend of class", - TYPE_NAME_STRING (friend_type), - IDENTIFIER_POINTER (name)); - else - warning ("function `%s' is already a friend of class `%s'", - IDENTIFIER_POINTER (name), - IDENTIFIER_POINTER (DECL_NAME (typedecl))); - } - else - TREE_VALUE (list) = tree_cons (friend_type, NULL_TREE, - TREE_VALUE (list)); - return; - } - list = TREE_CHAIN (list); - } - DECL_FRIENDLIST (typedecl) - = tree_cons (name, - build_tree_list (friend_type, NULL_TREE), - DECL_FRIENDLIST (typedecl)); -} - -/* Make FRIEND_TYPE a friend class to TYPE. If FRIEND_TYPE has already - been defined, we make all of its member functions friends of - TYPE. If not, we make it a pending friend, which can later be added - when its definition is seen. If a type is defined, then its TYPE_DECL's - DECL_UNDEFINED_FRIENDS contains a (possibly empty) list of friend - classes that are not defined. If a type has not yet been defined, - then the DECL_WAITING_FRIENDS contains a list of types - waiting to make it their friend. Note that these two can both - be in use at the same time! */ - -void -make_friend_class (type, friend_type) - tree type, friend_type; -{ - tree classes; - int is_template_friend; - - if (IS_SIGNATURE (type)) - { - error ("`friend' declaration in signature definition"); - return; - } - if (IS_SIGNATURE (friend_type) || ! IS_AGGR_TYPE (friend_type)) - { - cp_error ("invalid type `%T' declared `friend'", friend_type); - return; - } - - if (CLASS_TYPE_P (friend_type) - && CLASSTYPE_TEMPLATE_SPECIALIZATION (friend_type) - && uses_template_parms (friend_type)) - { - /* [temp.friend] - - Friend declarations shall not declare partial - specializations. */ - cp_error ("partial specialization `%T' declared `friend'", - friend_type); - return; - } - - if (processing_template_decl > template_class_depth (type)) - /* If the TYPE is a template then it makes sense for it to be - friends with itself; this means that each instantiation is - friends with all other instantiations. */ - is_template_friend = 1; - else if (same_type_p (type, friend_type)) - { - pedwarn ("class `%s' is implicitly friends with itself", - TYPE_NAME_STRING (type)); - return; - } - else - is_template_friend = 0; - - GNU_xref_hier (type, friend_type, 0, 0, 1); - - if (is_template_friend) - friend_type = CLASSTYPE_TI_TEMPLATE (friend_type); - - classes = CLASSTYPE_FRIEND_CLASSES (type); - while (classes - /* Stop if we find the same type on the list. */ - && !(TREE_CODE (TREE_VALUE (classes)) == TEMPLATE_DECL ? - friend_type == TREE_VALUE (classes) : - same_type_p (TREE_VALUE (classes), friend_type))) - classes = TREE_CHAIN (classes); - if (classes) - cp_warning ("`%T' is already a friend of `%T'", - TREE_VALUE (classes), type); - else - { - CLASSTYPE_FRIEND_CLASSES (type) - = tree_cons (NULL_TREE, friend_type, CLASSTYPE_FRIEND_CLASSES (type)); - if (is_template_friend) - friend_type = TREE_TYPE (friend_type); - if (!uses_template_parms (type)) - CLASSTYPE_BEFRIENDING_CLASSES (friend_type) - = tree_cons (NULL_TREE, type, - CLASSTYPE_BEFRIENDING_CLASSES (friend_type)); - } -} - -/* Main friend processor. This is large, and for modularity purposes, - has been removed from grokdeclarator. It returns `void_type_node' - to indicate that something happened, though a FIELD_DECL is - not returned. - - CTYPE is the class this friend belongs to. - - DECLARATOR is the name of the friend. - - DECL is the FUNCTION_DECL that the friend is. - - In case we are parsing a friend which is part of an inline - definition, we will need to store PARM_DECL chain that comes - with it into the DECL_ARGUMENTS slot of the FUNCTION_DECL. - - FLAGS is just used for `grokclassfn'. - - QUALS say what special qualifies should apply to the object - pointed to by `this'. */ - -tree -do_friend (ctype, declarator, decl, parmdecls, attrlist, - flags, quals, funcdef_flag) - tree ctype, declarator, decl, parmdecls, attrlist; - enum overload_flags flags; - tree quals; - int funcdef_flag; -{ - int is_friend_template = 0; - tree prefix_attributes, attributes; - - /* Every decl that gets here is a friend of something. */ - DECL_FRIEND_P (decl) = 1; - - if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR) - { - declarator = TREE_OPERAND (declarator, 0); - if (TREE_CODE (declarator) == LOOKUP_EXPR) - declarator = TREE_OPERAND (declarator, 0); - if (is_overloaded_fn (declarator)) - declarator = DECL_NAME (get_first_fn (declarator)); - } - - if (TREE_CODE (decl) != FUNCTION_DECL) - my_friendly_abort (990513); - - is_friend_template = PROCESSING_REAL_TEMPLATE_DECL_P (); - - if (ctype) - { - tree cname = TYPE_NAME (ctype); - if (TREE_CODE (cname) == TYPE_DECL) - cname = DECL_NAME (cname); - - /* A method friend. */ - if (flags == NO_SPECIAL && ctype && declarator == cname) - DECL_CONSTRUCTOR_P (decl) = 1; - - /* This will set up DECL_ARGUMENTS for us. */ - grokclassfn (ctype, decl, flags, quals); - - if (is_friend_template) - decl = DECL_TI_TEMPLATE (push_template_decl (decl)); - else if (template_class_depth (current_class_type)) - decl = push_template_decl_real (decl, /*is_friend=*/1); - - /* We can't do lookup in a type that involves template - parameters. Instead, we rely on tsubst_friend_function - to check the validity of the declaration later. */ - if (uses_template_parms (ctype)) - add_friend (current_class_type, decl); - /* A nested class may declare a member of an enclosing class - to be a friend, so we do lookup here even if CTYPE is in - the process of being defined. */ - else if (TYPE_SIZE (ctype) != 0 || TYPE_BEING_DEFINED (ctype)) - { - decl = check_classfn (ctype, decl); - - if (decl) - add_friend (current_class_type, decl); - } - else - cp_error ("member `%D' declared as friend before type `%T' defined", - decl, ctype); - } - /* A global friend. - @@ or possibly a friend from a base class ?!? */ - else if (TREE_CODE (decl) == FUNCTION_DECL) - { - /* Friends must all go through the overload machinery, - even though they may not technically be overloaded. - - Note that because classes all wind up being top-level - in their scope, their friend wind up in top-level scope as well. */ - DECL_ARGUMENTS (decl) = parmdecls; - if (funcdef_flag) - DECL_CLASS_CONTEXT (decl) = current_class_type; - - if (! DECL_USE_TEMPLATE (decl)) - { - /* We can call pushdecl here, because the TREE_CHAIN of this - FUNCTION_DECL is not needed for other purposes. Don't do - this for a template instantiation. However, we don't - call pushdecl() for a friend function of a template - class, since in general, such a declaration depends on - template parameters. Instead, we call pushdecl when the - class is instantiated. */ - if (!is_friend_template - && template_class_depth (current_class_type) == 0) - decl = pushdecl (decl); - else - decl = push_template_decl_real (decl, /*is_friend=*/1); - - if (warn_nontemplate_friend - && ! funcdef_flag && ! flag_guiding_decls && ! is_friend_template - && current_template_parms && uses_template_parms (decl)) - { - static int explained; - cp_warning ("friend declaration `%#D'", decl); - warning (" declares a non-template function"); - if (! explained) - { - warning (" (if this is not what you intended, make sure"); - warning (" the function template has already been declared,"); - warning (" and add <> after the function name here)"); - warning (" -Wno-non-template-friend disables this warning."); - explained = 1; - } - } - } - - make_decl_rtl (decl, NULL_PTR, 1); - add_friend (current_class_type, - is_friend_template ? DECL_TI_TEMPLATE (decl) : decl); - DECL_FRIEND_P (decl) = 1; - } - - /* Unfortunately, we have to handle attributes here. Normally we would - handle them in start_decl_1, but since this is a friend decl start_decl_1 - never gets to see it. */ - - if (attrlist) - { - attributes = TREE_PURPOSE (attrlist); - prefix_attributes = TREE_VALUE (attrlist); - } - else - { - attributes = NULL_TREE; - prefix_attributes = NULL_TREE; - } - -#ifdef SET_DEFAULT_DECL_ATTRIBUTES - SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes); -#endif - - /* Set attributes here so if duplicate decl, will have proper attributes. */ - cplus_decl_attributes (decl, attributes, prefix_attributes); - - return decl; -} diff --git a/contrib/gcc/cp/g++.1 b/contrib/gcc/cp/g++.1 deleted file mode 100644 index 5101d5fc1f64..000000000000 --- a/contrib/gcc/cp/g++.1 +++ /dev/null @@ -1,642 +0,0 @@ -.\" Copyright (c) 1991, 1992 Free Software Foundation -*-Text-*- -.\" See section COPYING for conditions for redistribution -.\" FIXME: no info here on predefines. Should there be? extra for C++... -.TH G++ 1 "30apr1993" "GNU Tools" "GNU Tools" -.de BP -.sp -.ti \-.2i -\(** -.. -.SH NAME -g++ \- GNU project C++ Compiler -.SH SYNOPSIS -.RB g++ " [" \c -.IR option " | " filename " ].\|.\|. -.SH DESCRIPTION -The C and C++ compilers are integrated; -.B g++ -is a script to call -.B gcc with options to recognize C++. -.B gcc -processes input files -through one or more of four stages: preprocessing, compilation, -assembly, and linking. This man page contains full descriptions for -.I only -C++ specific aspects of the compiler, though it also contains -summaries of some general-purpose options. For a fuller explanation -of the compiler, see -.BR gcc ( 1 ). - -C++ source files use one of the suffixes `\|\c -.B .C\c -\&\|', `\|\c -.B .cc\c -\&\|', `\|\c -.B .cxx\c -\&\|', `\|\c -.B .cpp\c -\&\|', or `\|\c -.B .c++\c -\&\|'; preprocessed C++ files use the suffix `\|\c -.B .ii\c -\&\|'. -.SH OPTIONS -There are many command-line options, including options to control -details of optimization, warnings, and code generation, which are -common to both -.B gcc -and -.B g++\c -\&. For full information on all options, see -.BR gcc ( 1 ). - -Options must be separate: `\|\c -.B \-dr\c -\&\|' is quite different from `\|\c -.B \-d \-r -\&\|'. - -Most `\|\c -.B \-f\c -\&\|' and `\|\c -.B \-W\c -\&\|' options have two contrary forms: -.BI \-f name -and -.BI \-fno\- name\c -\& (or -.BI \-W name -and -.BI \-Wno\- name\c -\&). Only the non-default forms are shown here. - -.TP -.B \-c -Compile or assemble the source files, but do not link. The compiler -output is an object file corresponding to each source file. -.TP -.BI \-D macro -Define macro \c -.I macro\c -\& with the string `\|\c -.B 1\c -\&\|' as its definition. -.TP -.BI \-D macro = defn -Define macro \c -.I macro\c -\& as \c -.I defn\c -\&. -.TP -.B \-E -Stop after the preprocessing stage; do not run the compiler proper. The -output is preprocessed source code, which is sent to the -standard output. -.TP -.B \-fall\-virtual -Treat all possible member functions as virtual, implicitly. All -member functions (except for constructor functions and -.B new -or -.B delete -member operators) are treated as virtual functions of the class where -they appear. - -This does not mean that all calls to these member functions will be -made through the internal table of virtual functions. Under some -circumstances, the compiler can determine that a call to a given -virtual function can be made directly; in these cases the calls are -direct in any case. -.TP -.B \-fdollars\-in\-identifiers -Permit the use of `\|\c -.B $\c -\&\|' in identifiers. -Traditional C allowed the character `\|\c -.B $\c -\&\|' to form part of identifiers; by default, GNU C also -allows this. However, ANSI C forbids `\|\c -.B $\c -\&\|' in identifiers, and GNU C++ also forbids it by default on most -platforms (though on some platforms it's enabled by default for GNU -C++ as well). -.TP -.B \-felide\-constructors -Use this option to instruct the compiler to be smarter about when it can -elide constructors. Without this flag, GNU C++ and cfront both -generate effectively the same code for: -.sp -.br -A\ foo\ (); -.br -A\ x\ (foo\ ());\ \ \ //\ x\ initialized\ by\ `foo\ ()',\ no\ ctor\ called -.br -A\ y\ =\ foo\ ();\ \ \ //\ call\ to\ `foo\ ()'\ heads\ to\ temporary, -.br -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ //\ y\ is\ initialized\ from\ the\ temporary. -.br -.sp -Note the difference! With this flag, GNU C++ initializes `\|\c -.B y\c -\&\|' directly -from the call to -.B foo () -without going through a temporary. -.TP -.B \-fenum\-int\-equiv -Normally GNU C++ allows conversion of -.B enum -to -.B int\c -\&, but not the other way around. Use this option if you want GNU C++ -to allow conversion of -.B int -to -.B enum -as well. -.TP -.B \-fexternal\-templates -Produce smaller code for template declarations, by generating only a -single copy of each template function where it is defined. -To use this option successfully, you must also mark all files that -use templates with either `\|\c -.B #pragma implementation\c -\&\|' (the definition) or -`\|\c -.B #pragma interface\c -\&\|' (declarations). - -When your code is compiled with `\|\c -.B \-fexternal\-templates\c -\&\|', all -template instantiations are external. You must arrange for all -necessary instantiations to appear in the implementation file; you can -do this with a \c -.B typedef\c -\& that references each instantiation needed. -Conversely, when you compile using the default option -`\|\c -.B \-fno\-external\-templates\c -\&\|', all template instantiations are -explicitly internal. -.TP -.B \-fno\-gnu\-linker -Do not output global initializations (such as C++ constructors and -destructors) in the form used by the GNU linker (on systems where the GNU -linker is the standard method of handling them). Use this option when -you want to use a non-GNU linker, which also requires using the -.B collect2 -program to make sure the system linker includes -constructors and destructors. (\c -.B collect2 -is included in the GNU CC distribution.) For systems which -.I must -use -.B collect2\c -\&, the compiler driver -.B gcc -is configured to do this automatically. -.TP -.B \-fmemoize\-lookups -.TP -.B \-fsave\-memoized -These flags are used to get the compiler to compile programs faster -using heuristics. They are not on by default since they are only effective -about half the time. The other half of the time programs compile more -slowly (and take more memory). - -The first time the compiler must build a call to a member function (or -reference to a data member), it must (1) determine whether the class -implements member functions of that name; (2) resolve which member -function to call (which involves figuring out what sorts of type -conversions need to be made); and (3) check the visibility of the member -function to the caller. All of this adds up to slower compilation. -Normally, the second time a call is made to that member function (or -reference to that data member), it must go through the same lengthy -process again. This means that code like this -.sp -.br -\ \ cout\ <<\ "This\ "\ <<\ p\ <<\ "\ has\ "\ <<\ n\ <<\ "\ legs.\en"; -.br -.sp -makes six passes through all three steps. By using a software cache, -a ``hit'' significantly reduces this cost. Unfortunately, using the -cache introduces another layer of mechanisms which must be implemented, -and so incurs its own overhead. `\|\c -.B \-fmemoize\-lookups\c -\&\|' enables -the software cache. - -Because access privileges (visibility) to members and member functions -may differ from one function context to the next, -.B g++ -may need to flush the cache. With the `\|\c -.B \-fmemoize\-lookups\c -\&\|' flag, the cache is flushed after every -function that is compiled. The `\|\c -\-fsave\-memoized\c -\&\|' flag enables the same software cache, but when the compiler -determines that the context of the last function compiled would yield -the same access privileges of the next function to compile, it -preserves the cache. -This is most helpful when defining many member functions for the same -class: with the exception of member functions which are friends of -other classes, each member function has exactly the same access -privileges as every other, and the cache need not be flushed. -.TP -.B \-fno\-default\-inline -Do not make member functions inline by default merely because they are -defined inside the class scope. Otherwise, when you specify -.B \-O\c -\&, member functions defined inside class scope are compiled -inline by default; i.e., you don't need to add `\|\c -.B inline\c -\&\|' in front of -the member function name. -.TP -.B \-fno\-strict\-prototype -Consider the declaration \c -.B int foo ();\c -\&. In C++, this means that the -function \c -.B foo\c -\& takes no arguments. In ANSI C, this is declared -.B int foo(void);\c -\&. With the flag `\|\c -.B \-fno\-strict\-prototype\c -\&\|', -declaring functions with no arguments is equivalent to declaring its -argument list to be untyped, i.e., \c -.B int foo ();\c -\& is equivalent to -saying \c -.B int foo (...);\c -\&. -.TP -.B \-fnonnull\-objects -Normally, GNU C++ makes conservative assumptions about objects reached -through references. For example, the compiler must check that `\|\c -.B a\c -\&\|' is not null in code like the following: -.br -\ \ \ \ obj\ &a\ =\ g\ (); -.br -\ \ \ \ a.f\ (2); -.br -Checking that references of this sort have non-null values requires -extra code, however, and it is unnecessary for many programs. You can -use `\|\c -.B \-fnonnull\-objects\c -\&\|' to omit the checks for null, if your program doesn't require the -default checking. -.TP -.B \-fhandle\-signatures -.TP -.B \-fno\-handle\-signatures -These options control the recognition of the \c -.B signature\c -\& and \c -.B sigof\c -\& constructs for specifying abstract types. By default, these -constructs are not recognized. -.TP -.B \-fthis\-is\-variable -The incorporation of user-defined free store management into C++ has -made assignment to \c -.B this\c -\& an anachronism. Therefore, by default GNU -C++ treats the type of \c -.B this\c -\& in a member function of \c -.B class X\c -\& -to be \c -.B X *const\c -\&. In other words, it is illegal to assign to -\c -.B this\c -\& within a class member function. However, for backwards -compatibility, you can invoke the old behavior by using -\&`\|\c -.B \-fthis\-is\-variable\c -\&\|'. -.TP -.B \-g -Produce debugging information in the operating system's native format -(for DBX or SDB or DWARF). GDB also can work with this debugging -information. On most systems that use DBX format, `\|\c -.B \-g\c -\&\|' enables use -of extra debugging information that only GDB can use. - -Unlike most other C compilers, GNU CC allows you to use `\|\c -.B \-g\c -\&\|' with -`\|\c -.B \-O\c -\&\|'. The shortcuts taken by optimized code may occasionally -produce surprising results: some variables you declared may not exist -at all; flow of control may briefly move where you did not expect it; -some statements may not be executed because they compute constant -results or their values were already at hand; some statements may -execute in different places because they were moved out of loops. - -Nevertheless it proves possible to debug optimized output. This makes -it reasonable to use the optimizer for programs that might have bugs. -.TP -.BI "\-I" "dir"\c -\& -Append directory \c -.I dir\c -\& to the list of directories searched for include files. -.TP -.BI "\-L" "dir"\c -\& -Add directory \c -.I dir\c -\& to the list of directories to be searched -for `\|\c -.B \-l\c -\&\|'. -.TP -.BI \-l library\c -\& -Use the library named \c -.I library\c -\& when linking. (C++ programs often require `\|\c -\-lg++\c -\&\|' for successful linking.) -.TP -.B \-nostdinc -Do not search the standard system directories for header files. Only -the directories you have specified with -.B \-I -options (and the current directory, if appropriate) are searched. -.TP -.B \-nostdinc++ -Do not search for header files in the standard directories specific to -C++, but do still search the other standard directories. (This option -is used when building libg++.) -.TP -.B \-O -Optimize. Optimizing compilation takes somewhat more time, and a lot -more memory for a large function. -.TP -.BI "\-o " file\c -\& -Place output in file \c -.I file\c -\&. -.TP -.B \-S -Stop after the stage of compilation proper; do not assemble. The output -is an assembler code file for each non-assembler input -file specified. -.TP -.B \-traditional -Attempt to support some aspects of traditional C compilers. - -Specifically, for both C and C++ programs: -.TP -\ \ \ \(bu -In the preprocessor, comments convert to nothing at all, rather than -to a space. This allows traditional token concatenation. -.TP -\ \ \ \(bu -In the preprocessor, macro arguments are recognized within string -constants in a macro definition (and their values are stringified, -though without additional quote marks, when they appear in such a -context). The preprocessor always considers a string constant to end -at a newline. -.TP -\ \ \ \(bu -The preprocessor does not predefine the macro \c -.B __STDC__\c -\& when you use -`\|\c -.B \-traditional\c -\&\|', but still predefines\c -.B __GNUC__\c -\& (since the GNU extensions indicated by -.B __GNUC__\c -\& are not affected by -`\|\c -.B \-traditional\c -\&\|'). If you need to write header files that work -differently depending on whether `\|\c -.B \-traditional\c -\&\|' is in use, by -testing both of these predefined macros you can distinguish four -situations: GNU C, traditional GNU C, other ANSI C compilers, and -other old C compilers. -.PP -.TP -\ \ \ \(bu -String ``constants'' are not necessarily constant; they are stored in -writable space, and identical looking constants are allocated -separately. - -For C++ programs only (not C), `\|\c -.B \-traditional\c -\&\|' has one additional effect: assignment to -.B this -is permitted. This is the same as the effect of `\|\c -.B \-fthis\-is\-variable\c -\&\|'. -.TP -.BI \-U macro -Undefine macro \c -.I macro\c -\&. -.TP -.B \-Wall -Issue warnings for conditions which pertain to usage that we recommend -avoiding and that we believe is easy to avoid, even in conjunction -with macros. -.TP -.B \-Wenum\-clash -Warn when converting between different enumeration types. -.TP -.B \-Woverloaded\-virtual -In a derived class, the definitions of virtual functions must match -the type signature of a virtual function declared in the base class. -Use this option to request warnings when a derived class declares a -function that may be an erroneous attempt to define a virtual -function: that is, warn when a function with the same name as a -virtual function in the base class, but with a type signature that -doesn't match any virtual functions from the base class. -.TP -.B \-Wtemplate\-debugging -When using templates in a C++ program, warn if debugging is not yet -fully available. -.TP -.B \-w -Inhibit all warning messages. -.TP -.BI +e N -Control how virtual function definitions are used, in a fashion -compatible with -.B cfront -1.x. -.PP - -.SH PRAGMAS -Two `\|\c -.B #pragma\c -\&\|' directives are supported for GNU C++, to permit using the same -header file for two purposes: as a definition of interfaces to a given -object class, and as the full definition of the contents of that object class. -.TP -.B #pragma interface -Use this directive in header files that define object classes, to save -space in most of the object files that use those classes. Normally, -local copies of certain information (backup copies of inline member -functions, debugging information, and the internal tables that -implement virtual functions) must be kept in each object file that -includes class definitions. You can use this pragma to avoid such -duplication. When a header file containing `\|\c -.B #pragma interface\c -\&\|' is included in a compilation, this auxiliary information -will not be generated (unless the main input source file itself uses -`\|\c -.B #pragma implementation\c -\&\|'). Instead, the object files will contain references to be -resolved at link time. -.tr !" -.TP -.B #pragma implementation -.TP -.BI "#pragma implementation !" objects .h! -Use this pragma in a main input file, when you want full output from -included header files to be generated (and made globally visible). -The included header file, in turn, should use `\|\c -.B #pragma interface\c -\&\|'. -Backup copies of inline member functions, debugging information, and -the internal tables used to implement virtual functions are all -generated in implementation files. - -If you use `\|\c -.B #pragma implementation\c -\&\|' with no argument, it applies to an include file with the same -basename as your source file; for example, in `\|\c -.B allclass.cc\c -\&\|', `\|\c -.B #pragma implementation\c -\&\|' by itself is equivalent to `\|\c -.B -#pragma implementation "allclass.h"\c -\&\|'. Use the string argument if you want a single implementation -file to include code from multiple header files. - -There is no way to split up the contents of a single header file into -multiple implementation files. -.SH FILES -.ta \w'LIBDIR/g++\-include 'u -file.h C header (preprocessor) file -.br -file.i preprocessed C source file -.br -file.C C++ source file -.br -file.cc C++ source file -.br -file.cxx C++ source file -.br -file.s assembly language file -.br -file.o object file -.br -a.out link edited output -.br -\fITMPDIR\fR/cc\(** temporary files -.br -\fILIBDIR\fR/cpp preprocessor -.br -\fILIBDIR\fR/cc1plus compiler -.br -\fILIBDIR\fR/collect linker front end needed on some machines -.br -\fILIBDIR\fR/libgcc.a GCC subroutine library -.br -/lib/crt[01n].o start-up routine -.br -\fILIBDIR\fR/ccrt0 additional start-up routine for C++ -.br -/lib/libc.a standard C library, see -.IR intro (3) -.br -/usr/include standard directory for -.B #include -files -.br -\fILIBDIR\fR/include standard gcc directory for -.B #include -files -.br -\fILIBDIR\fR/g++\-include additional g++ directory for -.B #include -.sp -.I LIBDIR -is usually -.B /usr/local/lib/\c -.IR machine / version . -.br -.I TMPDIR -comes from the environment variable -.B TMPDIR -(default -.B /usr/tmp -if available, else -.B /tmp\c -\&). -.SH "SEE ALSO" -gcc(1), cpp(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1). -.br -.RB "`\|" gcc "\|', `\|" cpp \|', -.RB `\| as \|', `\| ld \|', -and -.RB `\| gdb \|' -entries in -.B info\c -\&. -.br -.I -Using and Porting GNU CC (for version 2.0)\c -, Richard M. Stallman; -.I -The C Preprocessor\c -, Richard M. Stallman; -.I -Debugging with GDB: the GNU Source-Level Debugger\c -, Richard M. Stallman and Roland H. Pesch; -.I -Using as: the GNU Assembler\c -, Dean Elsner, Jay Fenlason & friends; -.I -gld: the GNU linker\c -, Steve Chamberlain and Roland Pesch. - -.SH BUGS -For instructions on how to report bugs, see the GCC manual. - -.SH COPYING -Copyright (c) 1991, 1992, 1993 Free Software Foundation, Inc. -.PP -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. -.PP -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. -.PP -Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be included in -translations approved by the Free Software Foundation instead of in -the original English. -.SH AUTHORS -See the GNU CC Manual for the contributors to GNU CC. diff --git a/contrib/gcc/cp/g++.c b/contrib/gcc/cp/g++.c deleted file mode 100644 index f694898fa966..000000000000 --- a/contrib/gcc/cp/g++.c +++ /dev/null @@ -1,582 +0,0 @@ -/* G++ preliminary semantic processing for the compiler driver. - Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. - Contributed by Brendan Kehoe (brendan@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This program is a wrapper to the main `gcc' driver. For GNU C++, - we need to do two special things: a) append `-lg++' in situations - where it's appropriate, to link in libg++, and b) add `-xc++'..`-xnone' - around file arguments named `foo.c' or `foo.i'. So, we do all of - this semantic processing then just exec gcc with the new argument - list. - - We used to do all of this in a small shell script, but many users - found the performance of this as a shell script to be unacceptable. - In situations where your PATH has a lot of NFS-mounted directories, - using a script that runs sed and other things would be a nasty - performance hit. With this program, we never search the PATH at all. */ - -#include "config.h" -#ifdef __STDC__ -#include -#else -#include -#endif -#include -#include -#if !defined(_WIN32) -#include /* May get R_OK, etc. on some systems. */ -#else -#include -#endif -#include - -/* Defined to the name of the compiler; if using a cross compiler, the - Makefile should compile this file with the proper name - (e.g., "i386-aout-gcc"). */ -#ifndef GCC_NAME -#define GCC_NAME "gcc" -#endif - -/* This bit is set if we saw a `-xfoo' language specification. */ -#define LANGSPEC (1<<1) -/* This bit is set if they did `-lm' or `-lmath'. */ -#define MATHLIB (1<<2) - -#ifndef MATH_LIBRARY -#define MATH_LIBRARY "-lm" -#endif - -/* On MSDOS, write temp files in current dir - because there's no place else we can expect to use. */ -#ifdef __MSDOS__ -#ifndef P_tmpdir -#define P_tmpdir "." -#endif -#ifndef R_OK -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 -#endif -#endif - -#ifndef VPROTO -#ifdef __STDC__ -#define PVPROTO(ARGS) ARGS -#define VPROTO(ARGS) ARGS -#define VA_START(va_list,var) va_start(va_list,var) -#else -#define PVPROTO(ARGS) () -#define VPROTO(ARGS) (va_alist) va_dcl -#define VA_START(va_list,var) va_start(va_list) -#endif -#endif - -#ifndef errno -extern int errno; -#endif - -extern int sys_nerr; -#ifndef HAVE_STRERROR -#if defined(bsd4_4) -extern const char *const sys_errlist[]; -#else -extern char *sys_errlist[]; -#endif -#else -extern char *strerror(); -#endif - -/* Name with which this program was invoked. */ -static char *programname; - -char * -my_strerror(e) - int e; -{ - -#ifdef HAVE_STRERROR - return strerror(e); - -#else - - static char buffer[30]; - if (!e) - return ""; - - if (e > 0 && e < sys_nerr) - return sys_errlist[e]; - - sprintf (buffer, "Unknown error %d", e); - return buffer; -#endif -} - -#ifdef HAVE_VPRINTF -/* Output an error message and exit */ - -static void -fatal VPROTO((char *format, ...)) -{ -#ifndef __STDC__ - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef __STDC__ - format = va_arg (ap, char*); -#endif - - fprintf (stderr, "%s: ", programname); - vfprintf (stderr, format, ap); - va_end (ap); - fprintf (stderr, "\n"); -#if 0 - /* XXX Not needed for g++ driver. */ - delete_temp_files (); -#endif - exit (1); -} - -static void -error VPROTO((char *format, ...)) -{ -#ifndef __STDC__ - char *format; -#endif - va_list ap; - - VA_START (ap, format); - -#ifndef __STDC__ - format = va_arg (ap, char*); -#endif - - fprintf (stderr, "%s: ", programname); - vfprintf (stderr, format, ap); - va_end (ap); - - fprintf (stderr, "\n"); -} - -#else /* not HAVE_VPRINTF */ - -static void -error (msg, arg1, arg2) - char *msg, *arg1, *arg2; -{ - fprintf (stderr, "%s: ", programname); - fprintf (stderr, msg, arg1, arg2); - fprintf (stderr, "\n"); -} - -static void -fatal (msg, arg1, arg2) - char *msg, *arg1, *arg2; -{ - error (msg, arg1, arg2); -#if 0 - /* XXX Not needed for g++ driver. */ - delete_temp_files (); -#endif - exit (1); -} - -#endif /* not HAVE_VPRINTF */ - -/* More 'friendly' abort that prints the line and file. - config.h can #define abort fancy_abort if you like that sort of thing. */ - -void -fancy_abort () -{ - fatal ("Internal g++ abort."); -} - -char * -xmalloc (size) - unsigned size; -{ - register char *value = (char *) malloc (size); - if (value == 0) - fatal ("virtual memory exhausted"); - return value; -} - -/* Return a newly-allocated string whose contents concatenate those - of s1, s2, s3. */ -static char * -concat (s1, s2, s3) - char *s1, *s2, *s3; -{ - int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); - char *result = xmalloc (len1 + len2 + len3 + 1); - - strcpy (result, s1); - strcpy (result + len1, s2); - strcpy (result + len1 + len2, s3); - *(result + len1 + len2 + len3) = 0; - - return result; -} - -static void -pfatal_with_name (name) - char *name; -{ - fatal (concat ("%s: ", my_strerror (errno), ""), name); -} - -#ifdef __MSDOS__ -/* This is the common prefix we use to make temp file names. */ -char *temp_filename; - -/* Length of the prefix. */ -int temp_filename_length; - -/* Compute a string to use as the base of all temporary file names. */ -static char * -choose_temp_base_try (try, base) -char *try; -char *base; -{ - char *rv; - if (base) - rv = base; - else if (try == (char *)0) - rv = 0; - else if (access (try, R_OK | W_OK) != 0) - rv = 0; - else - rv = try; - return rv; -} - -static void -choose_temp_base () -{ - char *base = 0; - int len; - - base = choose_temp_base_try (getenv ("TMPDIR"), base); - base = choose_temp_base_try (getenv ("TMP"), base); - base = choose_temp_base_try (getenv ("TEMP"), base); - -#ifdef P_tmpdir - base = choose_temp_base_try (P_tmpdir, base); -#endif - - base = choose_temp_base_try ("/usr/tmp", base); - base = choose_temp_base_try ("/tmp", base); - - /* If all else fails, use the current directory! */ - if (base == (char *)0) - base = "./"; - - len = strlen (base); - temp_filename = xmalloc (len + sizeof("/ccXXXXXX")); - strcpy (temp_filename, base); - if (len > 0 && temp_filename[len-1] != '/') - temp_filename[len++] = '/'; - strcpy (temp_filename + len, "ccXXXXXX"); - - mktemp (temp_filename); - temp_filename_length = strlen (temp_filename); - if (temp_filename_length == 0) - abort (); -} - -static void -perror_exec (name) - char *name; -{ - char *s; - - if (errno < sys_nerr) - s = concat ("installation problem, cannot exec %s: ", - my_strerror( errno ), ""); - else - s = "installation problem, cannot exec %s"; - error (s, name); -} - -/* This is almost exactly what's in gcc.c:pexecute for MSDOS. */ -void -run_dos (program, argv) - char *program; - char *argv[]; -{ - char *scmd, *rf; - FILE *argfile; - int i; - - choose_temp_base (); /* not in gcc.c */ - - scmd = (char *) malloc (strlen (program) + strlen (temp_filename) + 10); - rf = scmd + strlen (program) + 6; - sprintf (scmd, "%s.exe @%s.gp", program, temp_filename); - - argfile = fopen (rf, "w"); - if (argfile == 0) - pfatal_with_name (rf); - - for (i=1; argv[i]; i++) - { - char *cp; - for (cp = argv[i]; *cp; cp++) - { - if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp)) - fputc ('\\', argfile); - fputc (*cp, argfile); - } - fputc ('\n', argfile); - } - fclose (argfile); - - i = system (scmd); - - remove (rf); - - if (i == -1) - perror_exec (program); -} -#endif /* __MSDOS__ */ - -int -main (argc, argv) - int argc; - char **argv; -{ - register int i, j = 0; - register char *p; - int verbose = 0; - - /* This will be 0 if we encounter a situation where we should not - link in libstdc++, or 2 if we should link in libg++ as well. */ - int library = 1; - - /* Used to track options that take arguments, so we don't go wrapping - those with -xc++/-xnone. */ - char *quote = NULL; - - /* The new argument list will be contained in this. */ - char **arglist; - - /* The name of the compiler we will want to run---by default, it - will be the definition of `GCC_NAME', e.g., `gcc'. */ - char *gcc = GCC_NAME; - - /* Non-zero if we saw a `-xfoo' language specification on the - command line. Used to avoid adding our own -xc++ if the user - already gave a language for the file. */ - int saw_speclang = 0; - - /* Non-zero if we saw `-lm' or `-lmath' on the command line. */ - char *saw_math = 0; - - /* The number of arguments being added to what's in argv, other than - libraries. We use this to track the number of times we've inserted - -xc++/-xnone. */ - int added = 0; - - /* An array used to flag each argument that needs a bit set for - LANGSPEC or MATHLIB. */ - int *args; - - p = argv[0] + strlen (argv[0]); - - /* If we're called as g++ (or i386-aout-g++), link in libg++ as well. */ - - if (strcmp (p - 3, "g++") == 0) - { - library = 2; - } - - while (p != argv[0] && p[-1] != '/') - --p; - programname = p; - - if (argc == 1) - fatal ("No input files specified.\n"); - -#ifndef __MSDOS__ - /* We do a little magic to find out where the main gcc executable - is. If they ran us as /usr/local/bin/g++, then we will look - for /usr/local/bin/gcc; similarly, if they just ran us as `g++', - we'll just look for `gcc'. */ - if (p != argv[0]) - { - *--p = '\0'; - gcc = (char *) malloc ((strlen (argv[0]) + 1 + strlen (GCC_NAME) + 1) - * sizeof (char)); - sprintf (gcc, "%s/%s", argv[0], GCC_NAME); - } -#endif - - args = (int *) malloc (argc * sizeof (int)); - bzero ((char *) args, argc * sizeof (int)); - - for (i = 1; i < argc; i++) - { - /* If the previous option took an argument, we swallow it here. */ - if (quote) - { - quote = NULL; - continue; - } - - if (argv[i][0] == '\0' || argv[i][1] == '\0') - continue; - - if (argv[i][0] == '-') - { - if (library != 0 && strcmp (argv[i], "-nostdlib") == 0) - { - library = 0; - } - else if (strcmp (argv[i], "-lm") == 0 - || strcmp (argv[i], "-lmath") == 0) - args[i] |= MATHLIB; - else if (strcmp (argv[i], "-v") == 0) - { - verbose = 1; - if (argc == 2) - { - /* If they only gave us `-v', don't try to link - in libg++. */ - library = 0; - } - } - else if (strncmp (argv[i], "-x", 2) == 0) - saw_speclang = 1; - else if (((argv[i][2] == '\0' - && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL) - || strcmp (argv[i], "-Tdata") == 0)) - quote = argv[i]; - else if (library != 0 && ((argv[i][2] == '\0' - && (char *) strchr ("cSEM", argv[i][1]) != NULL) - || strcmp (argv[i], "-MM") == 0)) - { - /* Don't specify libraries if we won't link, since that would - cause a warning. */ - library = 0; - } - else - /* Pass other options through. */ - continue; - } - else - { - int len; - - if (saw_speclang) - { - saw_speclang = 0; - continue; - } - - /* If the filename ends in .c or .i, put options around it. - But not if a specified -x option is currently active. */ - len = strlen (argv[i]); - if (len > 2 - && (argv[i][len - 1] == 'c' || argv[i][len - 1] == 'i') - && argv[i][len - 2] == '.') - { - args[i] |= LANGSPEC; - added += 2; - } - } - } - - if (quote) - fatal ("argument to `%s' missing\n", quote); - - if (added || library) - { - arglist = (char **) malloc ((argc + added + 4) * sizeof (char *)); - - for (i = 1, j = 1; i < argc; i++, j++) - { - arglist[j] = argv[i]; - - /* Make sure -lg++ is before the math library, since libg++ - itself uses those math routines. */ - if (!saw_math && (args[i] & MATHLIB) && library) - { - --j; - saw_math = argv[i]; - } - - /* Wrap foo.c and foo.i files in a language specification to - force the gcc compiler driver to run cc1plus on them. */ - if (args[i] & LANGSPEC) - { - int len = strlen (argv[i]); - if (argv[i][len - 1] == 'i') - arglist[j++] = "-xc++-cpp-output"; - else - arglist[j++] = "-xc++"; - arglist[j++] = argv[i]; - arglist[j] = "-xnone"; - } - } - - /* Add `-lg++' if we haven't already done so. */ - if (library == 2) - arglist[j++] = "-lg++"; - if (library) - arglist[j++] = "-lstdc++"; - if (saw_math) - arglist[j++] = saw_math; - else if (library) - arglist[j++] = MATH_LIBRARY; - - arglist[j] = NULL; - } - else - /* No need to copy 'em all. */ - arglist = argv; - - arglist[0] = gcc; - - if (verbose) - { - if (j == 0) - j = argc; - - for (i = 0; i < j; i++) - fprintf (stderr, " %s", arglist[i]); - fprintf (stderr, "\n"); - } -#if !defined(OS2) && !defined (_WIN32) -#ifdef __MSDOS__ - run_dos (gcc, arglist); -#else /* !__MSDOS__ */ - if (execvp (gcc, arglist) < 0) - pfatal_with_name (gcc); -#endif /* __MSDOS__ */ -#else /* OS2 or _WIN32 */ - if (spawnvp (1, gcc, arglist) < 0) - pfatal_with_name (gcc); -#endif - - return 0; -} diff --git a/contrib/gcc/cp/g++spec.c b/contrib/gcc/cp/g++spec.c deleted file mode 100644 index 806b90ea96f0..000000000000 --- a/contrib/gcc/cp/g++spec.c +++ /dev/null @@ -1,266 +0,0 @@ -/* Specific flags and argument handling of the C++ front-end. - Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "config.h" -#include "system.h" - -/* This bit is set if we saw a `-xfoo' language specification. */ -#define LANGSPEC (1<<1) -/* This bit is set if they did `-lm' or `-lmath'. */ -#define MATHLIB (1<<2) -/* This bit is set if they did `-lc'. */ -#define WITHLIBC (1<<3) - -#ifndef MATH_LIBRARY -#define MATH_LIBRARY "-lm" -#endif - -#ifndef LIBSTDCXX -#define LIBSTDCXX "-lstdc++" -#endif - -void -lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) - void (*fn)(); - int *in_argc; - char ***in_argv; - int *in_added_libraries; -{ - int i, j; - - /* If non-zero, the user gave us the `-v' flag. */ - int saw_verbose_flag = 0; - - /* This will be 0 if we encounter a situation where we should not - link in libstdc++. */ - int library = 1; - - /* The number of arguments being added to what's in argv, other than - libraries. We use this to track the number of times we've inserted - -xc++/-xnone. */ - int added = 2; - - /* Used to track options that take arguments, so we don't go wrapping - those with -xc++/-xnone. */ - char *quote = NULL; - - /* The new argument list will be contained in this. */ - char **arglist; - - /* Non-zero if we saw a `-xfoo' language specification on the - command line. Used to avoid adding our own -xc++ if the user - already gave a language for the file. */ - int saw_speclang = 0; - - /* "-lm" or "-lmath" if it appears on the command line. */ - char *saw_math = 0; - - /* "-lc" if it appears on the command line. */ - char *saw_libc = 0; - - /* An array used to flag each argument that needs a bit set for - LANGSPEC, MATHLIB, or WITHLIBC. */ - int *args; - - /* By default, we throw on the math library if we have one. */ - int need_math = (MATH_LIBRARY[0] != '\0'); - - /* The total number of arguments with the new stuff. */ - int argc; - - /* The argument list. */ - char **argv; - - /* The number of libraries added in. */ - int added_libraries; - - /* The total number of arguments with the new stuff. */ - int num_args = 1; - - argc = *in_argc; - argv = *in_argv; - added_libraries = *in_added_libraries; - - args = (int *) xmalloc (argc * sizeof (int)); - bzero ((char *) args, argc * sizeof (int)); - - for (i = 1; i < argc; i++) - { - /* If the previous option took an argument, we swallow it here. */ - if (quote) - { - quote = NULL; - continue; - } - - /* We don't do this anymore, since we don't get them with minus - signs on them. */ - if (argv[i][0] == '\0' || argv[i][1] == '\0') - continue; - - if (argv[i][0] == '-') - { - if (library != 0 && (strcmp (argv[i], "-nostdlib") == 0 - || strcmp (argv[i], "-nodefaultlibs") == 0)) - { - library = 0; - } - else if (strcmp (argv[i], "-lm") == 0 - || strcmp (argv[i], "-lmath") == 0 - || strcmp (argv[i], MATH_LIBRARY) == 0 -#ifdef ALT_LIBM - || strcmp (argv[i], ALT_LIBM) == 0 -#endif - ) - { - args[i] |= MATHLIB; - need_math = 0; - } - else if (strcmp (argv[i], "-lc") == 0) - args[i] |= WITHLIBC; - else if (strcmp (argv[i], "-v") == 0) - { - saw_verbose_flag = 1; - if (argc == 2) - { - /* If they only gave us `-v', don't try to link - in libg++. */ - library = 0; - } - } - else if (strncmp (argv[i], "-x", 2) == 0) - saw_speclang = 1; - else if (((argv[i][2] == '\0' - && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL) - || strcmp (argv[i], "-Tdata") == 0)) - quote = argv[i]; - else if (library != 0 && ((argv[i][2] == '\0' - && (char *) strchr ("cSEM", argv[i][1]) != NULL) - || strcmp (argv[i], "-MM") == 0)) - { - /* Don't specify libraries if we won't link, since that would - cause a warning. */ - library = 0; - added -= 2; - } - else - /* Pass other options through. */ - continue; - } - else - { - int len; - - if (saw_speclang) - { - saw_speclang = 0; - continue; - } - - /* If the filename ends in .c or .i, put options around it. - But not if a specified -x option is currently active. */ - len = strlen (argv[i]); - if (len > 2 - && (argv[i][len - 1] == 'c' || argv[i][len - 1] == 'i') - && argv[i][len - 2] == '.') - { - args[i] |= LANGSPEC; - added += 2; - } - } - } - - if (quote) - (*fn) ("argument to `%s' missing\n", quote); - - /* If we know we don't have to do anything, bail now. */ - if (! added && ! library) - { - free (args); - return; - } - - num_args = argc + added + need_math; - arglist = (char **) xmalloc (num_args * sizeof (char *)); - - /* NOTE: We start at 1 now, not 0. */ - for (i = 0, j = 0; i < argc; i++, j++) - { - arglist[j] = argv[i]; - - /* Make sure -lstdc++ is before the math library, since libstdc++ - itself uses those math routines. */ - if (!saw_math && (args[i] & MATHLIB) && library) - { - --j; - saw_math = argv[i]; - } - - if (!saw_libc && (args[i] & WITHLIBC) && library) - { - --j; - saw_libc = argv[i]; - } - - /* Wrap foo.c and foo.i files in a language specification to - force the gcc compiler driver to run cc1plus on them. */ - if (args[i] & LANGSPEC) - { - int len = strlen (argv[i]); - if (argv[i][len - 1] == 'i') - arglist[j++] = "-xc++-cpp-output"; - else - arglist[j++] = "-xc++"; - arglist[j++] = argv[i]; - arglist[j] = "-xnone"; - } - } - - /* Add `-lstdc++' if we haven't already done so. */ - if (library) - { - arglist[j++] = LIBSTDCXX; - added_libraries++; - } - if (saw_math) - arglist[j++] = saw_math; - else if (library && need_math) - { - arglist[j++] = MATH_LIBRARY; - added_libraries++; - } - if (saw_libc) - arglist[j++] = saw_libc; - - arglist[j] = NULL; - - *in_argc = j; - *in_argv = arglist; - *in_added_libraries = added_libraries; -} - -/* Called before linking. Returns 0 on success and -1 on failure. */ -int lang_specific_pre_link () /* Not used for C++. */ -{ - return 0; -} - -/* Number of extra output files that lang_specific_pre_link may generate. */ -int lang_specific_extra_outfiles = 0; /* Not used for C++. */ diff --git a/contrib/gcc/cp/gc.c b/contrib/gcc/cp/gc.c deleted file mode 100644 index cff1635f53a4..000000000000 --- a/contrib/gcc/cp/gc.c +++ /dev/null @@ -1,1550 +0,0 @@ -/* Garbage collection primitives for GNU C++. - Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#include "config.h" -#include "tree.h" -#include "cp-tree.h" -#include "flags.h" -#include "output.h" - -#undef NULL -#define NULL 0 - -extern tree define_function (); -extern tree build_t_desc_overload (); -extern struct obstack *permanent_obstack; - -/* This is the function decl for the (pseudo-builtin) __gc_protect - function. Args are (class *value, int index); Returns value. */ -tree gc_protect_fndecl; - -/* This is the function decl for the (pseudo-builtin) __gc_unprotect - function. Args are (int index); void return. */ -tree gc_unprotect_fndecl; - -/* This is the function decl for the (pseudo-builtin) __gc_push - function. Args are (int length); void return. */ -tree gc_push_fndecl; - -/* This is the function decl for the (pseudo-builtin) __gc_pop - function. Args are void; void return. */ -tree gc_pop_fndecl; - -/* Special integers that are used to represent bits in gc-safe objects. */ -tree gc_nonobject; -tree gc_visible; -tree gc_white; -tree gc_offwhite; -tree gc_grey; -tree gc_black; - -/* in c-common.c */ -extern tree combine_strings PROTO((tree)); - -/* Predicate that returns non-zero if TYPE needs some kind of - entry for the GC. Returns zero otherwise. */ -int -type_needs_gc_entry (type) - tree type; -{ - tree ttype = type; - - if (! flag_gc || type == error_mark_node) - return 0; - - /* Aggregate types need gc entries if any of their members - need gc entries. */ - if (IS_AGGR_TYPE (type)) - { - tree binfos; - tree fields = TYPE_FIELDS (type); - int i; - - /* We don't care about certain pointers. Pointers - to virtual baseclasses are always up front. We also - cull out virtual function table pointers because it's - easy, and it simplifies the logic.*/ - while (fields - && (DECL_NAME (fields) == NULL_TREE - || VFIELD_NAME_P (DECL_NAME (fields)) - || VBASE_NAME_P (DECL_NAME (fields)) - || !strcmp (IDENTIFIER_POINTER (DECL_NAME (fields)), "__bits"))) - fields = TREE_CHAIN (fields); - - while (fields) - { - if (type_needs_gc_entry (TREE_TYPE (fields))) - return 1; - fields = TREE_CHAIN (fields); - } - - binfos = TYPE_BINFO_BASETYPES (type); - if (binfos) - for (i = TREE_VEC_LENGTH (binfos)-1; i >= 0; i--) - if (type_needs_gc_entry (BINFO_TYPE (TREE_VEC_ELT (binfos, i)))) - return 1; - - return 0; - } - - while (TREE_CODE (ttype) == ARRAY_TYPE - && TREE_CODE (TREE_TYPE (ttype)) == ARRAY_TYPE) - ttype = TREE_TYPE (ttype); - if ((TREE_CODE (ttype) == POINTER_TYPE - || TREE_CODE (ttype) == ARRAY_TYPE - || TREE_CODE (ttype) == REFERENCE_TYPE) - && IS_AGGR_TYPE (TREE_TYPE (ttype)) - && CLASSTYPE_RTTI (TREE_TYPE (ttype))) - return 1; - - return 0; -} - -/* Predicate that returns non-zero iff FROM is safe from the GC. - - If TO is nonzero, it means we know that FROM is being stored - in TO, which make make it safe. */ -int -value_safe_from_gc (to, from) - tree to, from; -{ - /* First, return non-zero for easy cases: parameters, - static variables. */ - if (TREE_CODE (from) == PARM_DECL - || (TREE_CODE (from) == VAR_DECL - && TREE_STATIC (from))) - return 1; - - /* If something has its address taken, it cannot be - in the heap, so it doesn't need to be protected. */ - if (TREE_CODE (from) == ADDR_EXPR || TREE_REFERENCE_EXPR (from)) - return 1; - - /* If we are storing into a static variable, then what - we store will be safe from the gc. */ - if (to && TREE_CODE (to) == VAR_DECL - && TREE_STATIC (to)) - return 1; - - /* Now recurse on structure of FROM. */ - switch (TREE_CODE (from)) - { - case COMPONENT_REF: - /* These guys are special, and safe. */ - if (TREE_CODE (TREE_OPERAND (from, 1)) == FIELD_DECL - && (VFIELD_NAME_P (DECL_NAME (TREE_OPERAND (from, 1))) - || VBASE_NAME_P (DECL_NAME (TREE_OPERAND (from, 1))))) - return 1; - /* fall through... */ - case NOP_EXPR: - case CONVERT_EXPR: - case NON_LVALUE_EXPR: - case WITH_CLEANUP_EXPR: - case SAVE_EXPR: - case PREDECREMENT_EXPR: - case PREINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - case POSTINCREMENT_EXPR: - if (value_safe_from_gc (to, TREE_OPERAND (from, 0))) - return 1; - break; - - case VAR_DECL: - case PARM_DECL: - /* We can safely pass these things as parameters to functions. */ - if (to == 0) - return 1; - - case ARRAY_REF: - case INDIRECT_REF: - case RESULT_DECL: - case OFFSET_REF: - case CALL_EXPR: - case METHOD_CALL_EXPR: - break; - - case COMPOUND_EXPR: - case TARGET_EXPR: - if (value_safe_from_gc (to, TREE_OPERAND (from, 1))) - return 1; - break; - - case COND_EXPR: - if (value_safe_from_gc (to, TREE_OPERAND (from, 1)) - && value_safe_from_gc (to, TREE_OPERAND (from, 2))) - return 1; - break; - - case PLUS_EXPR: - case MINUS_EXPR: - if ((type_needs_gc_entry (TREE_TYPE (TREE_OPERAND (from, 0))) - || value_safe_from_gc (to, TREE_OPERAND (from, 0))) - && (type_needs_gc_entry (TREE_TYPE (TREE_OPERAND (from, 1))) == 0 - || value_safe_from_gc (to, TREE_OPERAND (from, 1)))) - return 1; - break; - - case RTL_EXPR: - /* Every time we build an RTL_EXPR in the front-end, we must - ensure that everything in it is safe from the garbage collector. - ??? This has only been done for `build_new'. */ - return 1; - - default: - my_friendly_abort (41); - } - - if (to == 0) - return 0; - - /* FROM wasn't safe. But other properties of TO might make it safe. */ - switch (TREE_CODE (to)) - { - case VAR_DECL: - case PARM_DECL: - /* We already culled out static VAR_DECLs above. */ - return 0; - - case COMPONENT_REF: - /* These guys are special, and safe. */ - if (TREE_CODE (TREE_OPERAND (to, 1)) == FIELD_DECL - && (VFIELD_NAME_P (DECL_NAME (TREE_OPERAND (to, 1))) - || VBASE_NAME_P (DECL_NAME (TREE_OPERAND (to, 1))))) - return 1; - /* fall through... */ - - case NOP_EXPR: - case NON_LVALUE_EXPR: - case WITH_CLEANUP_EXPR: - case SAVE_EXPR: - case PREDECREMENT_EXPR: - case PREINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - case POSTINCREMENT_EXPR: - return value_safe_from_gc (TREE_OPERAND (to, 0), from); - - case COMPOUND_EXPR: - case TARGET_EXPR: - return value_safe_from_gc (TREE_OPERAND (to, 1), from); - - case COND_EXPR: - return (value_safe_from_gc (TREE_OPERAND (to, 1), from) - && value_safe_from_gc (TREE_OPERAND (to, 2), from)); - - case INDIRECT_REF: - case ARRAY_REF: - /* This used to be 0, but our current restricted model - allows this to be 1. We'll never get arrays this way. */ - return 1; - - default: - my_friendly_abort (42); - } - - /* Catch-all case is that TO/FROM is not safe. */ - return 0; -} - -/* Function to build a static GC entry for DECL. TYPE is DECL's type. - - For objects of type `class *', this is just an entry in the - static vector __PTR_LIST__. - - For objects of type `class[]', this requires building an entry - in the static vector __ARR_LIST__. - - For aggregates, this records all fields of type `class *' - and `class[]' in the respective lists above. */ -void -build_static_gc_entry (decl, type) - tree decl; - tree type; -{ - /* Now, figure out what sort of entry to build. */ - if (TREE_CODE (type) == POINTER_TYPE - || TREE_CODE (type) == REFERENCE_TYPE) - assemble_gc_entry (IDENTIFIER_POINTER (DECL_NAME (decl))); - else if (TREE_CODE (type) == RECORD_TYPE) - { - tree ref = get_temp_name (build_reference_type (type), 1); - DECL_INITIAL (ref) = build1 (ADDR_EXPR, TREE_TYPE (ref), decl); - TREE_CONSTANT (DECL_INITIAL (ref)) = 1; - cp_finish_decl (ref, DECL_INITIAL (ref), NULL_TREE, 0, 0); - } - else - { - /* Not yet implemented. - - Cons up a static variable that holds address and length info - and add that to ___ARR_LIST__. */ - my_friendly_abort (43); - } -} - -/* Protect FROM from the GC, assuming FROM is going to be - stored into TO. We handle three cases for TO here: - - case 1: TO is a stack variable. - case 2: TO is zero (which means it is a parameter). - case 3: TO is a return value. */ - -tree -protect_value_from_gc (to, from) - tree to, from; -{ - if (to == 0) - { - tree cleanup; - - to = get_temp_regvar (TREE_TYPE (from), from); - - /* Convert from integer to list form since we'll use it twice. */ - DECL_GC_OFFSET (to) = build_tree_list (NULL_TREE, DECL_GC_OFFSET (to)); - cleanup = build_function_call (gc_unprotect_fndecl, - DECL_GC_OFFSET (to)); - - if (! cp_expand_decl_cleanup (to, cleanup)) - { - compiler_error ("cannot unprotect parameter in this scope"); - return error_mark_node; - } - } - - /* Should never need to protect a value that's headed for static storage. */ - if (TREE_STATIC (to)) - my_friendly_abort (44); - - switch (TREE_CODE (to)) - { - case COMPONENT_REF: - case INDIRECT_REF: - return protect_value_from_gc (TREE_OPERAND (to, 0), from); - - case VAR_DECL: - case PARM_DECL: - { - tree rval; - if (DECL_GC_OFFSET (to) == NULL_TREE) - { - /* Because of a cast or a conversion, we might stick - a value into a variable that would not normally - have a GC entry. */ - DECL_GC_OFFSET (to) = size_int (++current_function_obstack_index); - } - - if (TREE_CODE (DECL_GC_OFFSET (to)) != TREE_LIST) - { - DECL_GC_OFFSET (to) - = build_tree_list (NULL_TREE, DECL_GC_OFFSET (to)); - } - - current_function_obstack_usage = 1; - rval = build_function_call (gc_protect_fndecl, - tree_cons (NULL_TREE, from, - DECL_GC_OFFSET (to))); - TREE_TYPE (rval) = TREE_TYPE (from); - return rval; - } - } - - /* If we fall through the switch, assume we lost. */ - my_friendly_abort (45); - /* NOTREACHED */ - return NULL_TREE; -} - -/* Given the expression EXP of type `class *', return the head - of the object pointed to by EXP. */ -tree -build_headof (exp) - tree exp; -{ - tree type = TREE_TYPE (exp); - tree vptr, offset; - - if (TREE_CODE (type) != POINTER_TYPE) - { - error ("`headof' applied to non-pointer type"); - return error_mark_node; - } - type = TREE_TYPE (type); - - if (!TYPE_VIRTUAL_P (type) || CLASSTYPE_VFIELD (type) == NULL_TREE) - return exp; - - vptr = fold (size_binop (PLUS_EXPR, - size_binop (FLOOR_DIV_EXPR, - DECL_FIELD_BITPOS (CLASSTYPE_VFIELD (type)), - size_int (BITS_PER_UNIT)), - exp)); - vptr = build1 (INDIRECT_REF, build_pointer_type (vtable_entry_type), vptr); - - if (flag_vtable_thunks) - offset = build_array_ref (vptr, integer_zero_node); - else - offset = build_component_ref (build_array_ref (vptr, integer_zero_node), - delta_identifier, - NULL_TREE, 0); - - type = build_type_variant (ptr_type_node, TREE_READONLY (exp), - TREE_THIS_VOLATILE (exp)); - return build (PLUS_EXPR, type, exp, - convert (ptrdiff_type_node, offset)); -} - -/* Return the type_info node associated with the expression EXP. If EXP is - a reference to a polymorphic class, return the dynamic type; otherwise - return the static type of the expression. */ -tree -build_typeid (exp) - tree exp; -{ - tree type; - - if (!flag_rtti) - cp_error ("cannot take typeid of object when -frtti is not specified"); - - if (exp == error_mark_node) - return error_mark_node; - - type = TREE_TYPE (exp); - - /* Strip top-level cv-qualifiers. */ - type = TYPE_MAIN_VARIANT (type); - - /* if b is an instance of B, typeid(b) == typeid(B). Do this before - reference trickiness. */ - if (TREE_CODE (exp) == VAR_DECL && TREE_CODE (type) == RECORD_TYPE) - return get_typeid (type); - - /* peel back references, so they match. */ - if (TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); - - /* Peel off cv qualifiers. */ - type = TYPE_MAIN_VARIANT (type); - - /* Apply trivial conversion T -> T& for dereferenced ptrs. */ - if (TREE_CODE (type) == RECORD_TYPE) - type = build_reference_type (type); - - /* If exp is a reference to polymorphic type, get the real type_info. */ - if (TREE_CODE (type) == REFERENCE_TYPE && TYPE_VIRTUAL_P (TREE_TYPE (type))) - { - /* build reference to type_info from vtable. */ - tree t; - - if (flag_vtable_thunks) - t = build_vfn_ref ((tree *) NULL_TREE, exp, integer_one_node); - else - t = build_vfn_ref ((tree *) NULL_TREE, exp, integer_zero_node); - - TREE_TYPE (t) = build_pointer_type (__class_desc_type_node); - t = build_indirect_ref (t, NULL); - return t; - } - - /* otherwise return the type_info for the static type of the expr. */ - return get_typeid (type); -} - -/* Return the type_info object for TYPE, creating it if necessary. */ -tree -get_typeid (type) - tree type; -{ - tree t, td; - - if (type == error_mark_node) - return error_mark_node; - - /* Is it useful (and/or correct) to have different typeids for `T &' - and `T'? */ - if (TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); - - td = build_t_desc (type, 1); - if (td == error_mark_node) - return error_mark_node; - - t = TREE_OPERAND (td, 0); - return t; -} - -/* Get a bad_cast node for the program to throw... - - See libstdc++::exception{,.cc} for __bad_cast_object */ -tree -get_bad_cast_node () -{ - static tree t; - if (t == NULL_TREE - && (t = lookup_name (get_identifier ("__bad_cast_object"), 0)) - == NULL_TREE) - { - error ("you must #include "); - return error_mark_node; - } - return t; -} - -/* Execute a dynamic cast, as described in section 5.2.6 of the 9/93 working - paper. */ -tree -build_dynamic_cast (type, expr) - tree type, expr; -{ - enum tree_code tc = TREE_CODE (type); - tree exprtype = TREE_TYPE (expr); - enum tree_code ec = TREE_CODE (exprtype); - tree retval; - - if (type == error_mark_node || expr == error_mark_node) - return error_mark_node; - - switch (tc) - { - case POINTER_TYPE: - if (ec == REFERENCE_TYPE) - { - expr = convert_from_reference (expr); - exprtype = TREE_TYPE (expr); - ec = TREE_CODE (exprtype); - } - if (ec != POINTER_TYPE) - goto fail; - if (TREE_CODE (TREE_TYPE (exprtype)) != RECORD_TYPE) - goto fail; - if (TYPE_SIZE (TREE_TYPE (exprtype)) == 0) - goto fail; - if (TREE_READONLY (TREE_TYPE (exprtype)) && - ! TYPE_READONLY (TREE_TYPE (type))) - goto fail; - if (TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node) - break; - /* else fall through */ - case REFERENCE_TYPE: - if (TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE - && TYPE_SIZE (TREE_TYPE (type)) != NULL_TREE) - break; - /* else fall through */ - default: - goto fail; - } - - /* Apply trivial conversion T -> T& for dereferenced ptrs. */ - if (ec == RECORD_TYPE) - { - exprtype = build_type_variant (exprtype, TREE_READONLY (expr), - TREE_THIS_VOLATILE (expr)); - exprtype = build_reference_type (exprtype); - expr = convert_to_reference (exprtype, expr, CONV_IMPLICIT, - LOOKUP_NORMAL, NULL_TREE); - ec = REFERENCE_TYPE; - } - - if (tc == REFERENCE_TYPE) - { - if (ec != REFERENCE_TYPE) - goto fail; - if (TREE_CODE (TREE_TYPE (exprtype)) != RECORD_TYPE) - goto fail; - if (TYPE_SIZE (TREE_TYPE (exprtype)) == 0) - goto fail; - } - - /* If *type is an unambiguous accessible base class of *exprtype, - convert statically. */ - { - int distance; - tree path; - - distance = get_base_distance (TREE_TYPE (type), TREE_TYPE (exprtype), 1, - &path); - if (distance >= 0) - return build_vbase_path (PLUS_EXPR, type, expr, path, 0); - } - - /* Otherwise *exprtype must be a polymorphic class (have a vtbl). */ - if (TYPE_VIRTUAL_P (TREE_TYPE (exprtype))) - { - /* if TYPE is `void *', return pointer to complete object. */ - if (tc == POINTER_TYPE - && TYPE_MAIN_VARIANT (TREE_TYPE (type)) == void_type_node) - { - /* if b is an object, dynamic_cast(&b) == (void *)&b. */ - if (TREE_CODE (expr) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (expr, 0)) == VAR_DECL - && TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == RECORD_TYPE) - return build1 (NOP_EXPR, type, expr); - - return build_headof (expr); - } - else - { - tree retval; - tree result, td1, td2, elems, tmp1, expr1; - - /* If we got here, we can't convert statically. Therefore, - dynamic_cast(b) (b an object) cannot succeed. */ - if (ec == REFERENCE_TYPE) - { - if (TREE_CODE (expr) == VAR_DECL - && TREE_CODE (TREE_TYPE (expr)) == RECORD_TYPE) - { - cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed", - expr, type); - return build_throw (get_bad_cast_node ()); - } - } - /* Ditto for dynamic_cast(&b). */ - else if (TREE_CODE (expr) == ADDR_EXPR) - { - tree op = TREE_OPERAND (expr, 0); - if (TREE_CODE (op) == VAR_DECL - && TREE_CODE (TREE_TYPE (op)) == RECORD_TYPE) - { - cp_warning ("dynamic_cast of `%#D' to `%#T' can never succeed", - expr, type); - retval = build_int_2 (0, 0); - TREE_TYPE (retval) = type; - return retval; - } - } - - expr1 = expr; - if (tc == REFERENCE_TYPE) - expr1 = build_unary_op (ADDR_EXPR, expr1, 0); - - /* Build run-time conversion. */ - expr1 = build_headof (expr1); - - if (ec == POINTER_TYPE) - td1 = build_typeid (build_indirect_ref (expr, NULL_PTR)); - else - td1 = build_typeid (expr); - - if (tc == POINTER_TYPE) - td2 = get_typeid (TREE_TYPE (type)); - else - td2 = get_typeid (type); - - elems = tree_cons (NULL_TREE, td2, - tree_cons (NULL_TREE, build_int_2 (1, 0), - tree_cons (NULL_TREE, expr1, NULL_TREE))); - result = build_method_call (td1, - get_identifier ("__rtti_match"), elems, NULL_TREE, LOOKUP_NORMAL); - - if (tc == REFERENCE_TYPE) - { - expr1 = build_throw (get_bad_cast_node ()); - expr1 = build_compound_expr (tree_cons (NULL_TREE, expr1, - build_tree_list (NULL_TREE, convert (type, integer_zero_node)))); - TREE_TYPE (expr1) = type; - return build (COND_EXPR, type, result, result, expr1); - } - - /* Now back to the type we want from a void*. */ - result = convert (type, result); - return result; - } - } - - fail: - cp_error ("cannot dynamic_cast `%E' (of type `%#T') to type `%#T'", - expr, exprtype, type); - return error_mark_node; -} - -/* Build and initialize various sorts of descriptors. Every descriptor - node has a name associated with it (the name created by mangling). - For this reason, we use the identifier as our access to the __*_desc - nodes, instead of sticking them directly in the types. Otherwise we - would burden all built-in types (and pointer types) with slots that - we don't necessarily want to use. - - For each descriptor we build, we build a variable that contains - the descriptor's information. When we need this info at runtime, - all we need is access to these variables. - - Note: these constructors always return the address of the descriptor - info, since that is simplest for their mutual interaction. */ - -static tree -build_generic_desc (tdecl, type, elems) - tree tdecl; - tree type; - tree elems; -{ - tree init = elems; - int toplev = global_bindings_p (); - - TREE_CONSTANT (init) = 1; - TREE_STATIC (init) = 1; - TREE_READONLY (init) = 1; - - TREE_TYPE (tdecl) = type; - DECL_INITIAL (tdecl) = init; - TREE_STATIC (tdecl) = 1; - DECL_SIZE (tdecl) = NULL_TREE; - layout_decl (tdecl, 0); - if (! toplev) - push_to_top_level (); - cp_finish_decl (tdecl, init, NULL_TREE, 0, 0); - if (! toplev) - pop_from_top_level (); - - if (! TREE_USED (tdecl)) - { - assemble_external (tdecl); - TREE_USED (tdecl) = 1; - } - - return IDENTIFIER_AS_DESC (DECL_NAME (tdecl)); -} - -/* Build an initializer for a __bltn_desc node. */ -static tree -build_bltn_desc (tdecl, type) - tree tdecl; - tree type; -{ - tree elems, t; - - if (type == boolean_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_BOOL"), - 0, 0); - else if (type == char_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_CHAR"), - 0, 0); - else if (type == short_integer_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_SHORT"), - 0, 0); - else if (type == integer_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_INT"), - 0, 0); - else if (type == long_integer_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_LONG"), - 0, 0); - else if (type == long_long_integer_type_node) - t = lookup_field (__bltn_desc_type_node, - get_identifier("_RTTI_BI_LONGLONG"), 0, 0); - else if (type == float_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_FLOAT"), - 0, 0); - else if (type == double_type_node) - t = lookup_field (__bltn_desc_type_node, - get_identifier("_RTTI_BI_DOUBLE"), 0, 0); - else if (type == long_double_type_node) - t = lookup_field (__bltn_desc_type_node, - get_identifier("_RTTI_BI_LDOUBLE"), 0, 0); - else if (type == unsigned_char_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_UCHAR"), - 0, 0); - else if (type == short_unsigned_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_USHORT"), - 0, 0); - else if (type == unsigned_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_UINT"), - 0, 0); - else if (type == long_unsigned_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_ULONG"), - 0, 0); - else if (type == long_long_unsigned_type_node) - t = lookup_field (__bltn_desc_type_node, - get_identifier("_RTTI_BI_ULONGLONG"), 0, 0); - else if (type == signed_char_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_SCHAR"), - 0, 0); - else if (type == wchar_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_WCHAR"), - 0, 0); - else if (type == void_type_node) - t = lookup_field (__bltn_desc_type_node, get_identifier("_RTTI_BI_VOID"), - 0, 0); - else - { - cp_compiler_error ("type `%T' not handled as a built-in type"); - } - - elems = tree_cons (NULL_TREE, t, NULL_TREE); - return build_generic_desc (tdecl, __bltn_desc_type_node, elems); -} - -/* Build an initializer for a __user_desc node. */ -static tree -build_user_desc (tdecl) - tree tdecl; -{ - tree elems, name_string, t; - tree tname = DECL_NAME (tdecl); - - name_string = combine_strings (build_string - (IDENTIFIER_LENGTH (tname)+1, IDENTIFIER_POINTER (tname))); - elems = name_string; - return build_generic_desc (tdecl, __user_desc_type_node, elems); -} - -/* Build an initializer for a __class_type_info node. */ -static tree -build_class_desc (tdecl, type) - tree tdecl; - tree type; -{ - tree tname = DECL_NAME (tdecl); - tree name_string; - - int i = CLASSTYPE_N_BASECLASSES (type); - int n_base = i; - int base_cnt = 0; - tree binfos = TYPE_BINFO_BASETYPES (type); - tree vb = CLASSTYPE_VBASECLASSES (type); - tree base, elems, access, offset, isvir; - tree base_list, off_list, acc_list, isvir_list; - tree t; - static tree acc_pub = NULL_TREE; - static tree acc_pro = NULL_TREE; - static tree acc_pri = NULL_TREE; - - if (acc_pub == NULL_TREE) - { - acc_pub = lookup_field (__class_desc_type_node, - get_identifier("_RTTI_ACCESS_PUBLIC"), 0, 0); - acc_pro = lookup_field (__class_desc_type_node, - get_identifier("_RTTI_ACCESS_PROTECTED"), 0, 0); - acc_pri = lookup_field (__class_desc_type_node, - get_identifier("_RTTI_ACCESS_PRIVATE"), 0, 0); - } - - base_list = build_tree_list (NULL_TREE, integer_zero_node); - off_list = build_tree_list (NULL_TREE, integer_zero_node); - acc_list = build_tree_list (NULL_TREE, integer_zero_node); - isvir_list = build_tree_list (NULL_TREE, integer_zero_node); - while (--i >= 0) - { - tree binfo = TREE_VEC_ELT (binfos, i); - - base = build_t_desc (BINFO_TYPE (binfo), 1); - if (TREE_VIA_VIRTUAL (binfo)) - { - tree t = BINFO_TYPE (binfo); - char *name; - tree field; - int off; - - name = (char *) alloca (TYPE_NAME_LENGTH (t)+sizeof (VBASE_NAME)+1); - sprintf (name, VBASE_NAME_FORMAT, TYPE_NAME_STRING (t)); - field = lookup_field (type, get_identifier (name), 0, 0); - offset = size_binop (FLOOR_DIV_EXPR, - DECL_FIELD_BITPOS (field), size_int (BITS_PER_UNIT)); - } - else - offset = BINFO_OFFSET (binfo); - - if (TREE_VIA_PUBLIC (binfo)) - access = acc_pub; - else if (TREE_VIA_PROTECTED (binfo)) - access = acc_pro; - else - access = acc_pri; - if (TREE_VIA_VIRTUAL (binfo)) - isvir = build_int_2 (1, 0); - else - isvir = build_int_2 (0, 0); - - base_list = tree_cons (NULL_TREE, base, base_list); - isvir_list = tree_cons (NULL_TREE, isvir, isvir_list); - acc_list = tree_cons (NULL_TREE, access, acc_list); - off_list = tree_cons (NULL_TREE, offset, off_list); - base_cnt++; - } -#if 0 - i = n_base; - while (vb) - { - tree b; - access = acc_pub; - while (--i >= 0) - { - b = TREE_VEC_ELT (binfos, i); - if (BINFO_TYPE (vb) == BINFO_TYPE (b) && TREE_VIA_VIRTUAL (b)) - { - if (TREE_VIA_PUBLIC (b)) - access = acc_pub; - else if (TREE_VIA_PROTECTED (b)) - access = acc_pro; - else - access = acc_pri; - break; - } - } - base = build_t_desc (BINFO_TYPE (vb), 1); - offset = BINFO_OFFSET (vb); - isvir = build_int_2 (1, 0); - - base_list = tree_cons (NULL_TREE, base, base_list); - isvir_list = tree_cons (NULL_TREE, isvir, isvir_list); - acc_list = tree_cons (NULL_TREE, access, acc_list); - off_list = tree_cons (NULL_TREE, offset, off_list); - - base_cnt++; - vb = TREE_CHAIN (vb); - } -#endif - base_list = finish_table (NULL_TREE, build_pointer_type (__t_desc_type_node), - base_list, 0); - off_list = finish_table (NULL_TREE, integer_type_node, - off_list, 0); - isvir_list = finish_table (NULL_TREE, integer_type_node, - isvir_list, 0); - acc_list = finish_table (NULL_TREE, __access_mode_type_node, - acc_list, 0); - - - name_string = combine_strings (build_string (IDENTIFIER_LENGTH (tname)+1, IDENTIFIER_POINTER (tname))); - - elems = tree_cons (NULL_TREE, name_string, - tree_cons (NULL_TREE, default_conversion (base_list), - tree_cons (NULL_TREE, default_conversion (off_list), - tree_cons (NULL_TREE, default_conversion (isvir_list), - tree_cons (NULL_TREE, default_conversion (acc_list), - tree_cons (NULL_TREE, build_int_2 (base_cnt, 0), NULL_TREE)))))); - - return build_generic_desc (tdecl, __class_desc_type_node, elems); -} - -/* Build an initializer for a __pointer_type_info node. */ -static tree -build_ptr_desc (tdecl, type) - tree tdecl; - tree type; -{ - tree t, elems; - - t = TREE_TYPE (type); - t = build_t_desc (t, 1); - t = build_indirect_ref (t, NULL); - elems = tree_cons (NULL_TREE, t, NULL_TREE); - return build_generic_desc (tdecl, __ptr_desc_type_node, elems); -} - -/* Build an initializer for a __attr_type_info node. */ -static tree -build_attr_desc (tdecl, type) - tree tdecl; - tree type; -{ - tree elems, t, attrval; - - if (TYPE_READONLY (type)) - { - if (TYPE_VOLATILE (type)) - attrval = lookup_field (__attr_desc_type_node, - get_identifier("_RTTI_ATTR_CONSTVOL"), 0, 0); - else - attrval = lookup_field (__attr_desc_type_node, - get_identifier("_RTTI_ATTR_CONST"), 0, 0); - } - else - { - if (TYPE_VOLATILE (type)) - attrval = lookup_field (__attr_desc_type_node, - get_identifier("_RTTI_ATTR_VOLATILE"), 0, 0); - } - t = build_t_desc (TYPE_MAIN_VARIANT (type), 1); - t = build_indirect_ref (t , NULL); - elems = tree_cons (NULL_TREE, attrval, tree_cons (NULL_TREE, t, NULL_TREE)); - return build_generic_desc (tdecl, __attr_desc_type_node, elems); -} - -/* Build an initializer for a __func_type_info node. */ -static tree -build_func_desc (tdecl) - tree tdecl; -{ - tree elems, name_string; - tree tname = DECL_NAME (tdecl); - - name_string = combine_strings (build_string - (IDENTIFIER_LENGTH (tname)+1, IDENTIFIER_POINTER (tname))); - elems = name_string; - return build_generic_desc (tdecl, __func_desc_type_node, elems); -} - -/* Build an initializer for a __ptmf_type_info node. */ -static tree -build_ptmf_desc (tdecl, type) - tree tdecl; - tree type; -{ - tree elems, name_string; - tree tname = DECL_NAME (tdecl); - - name_string = combine_strings (build_string - (IDENTIFIER_LENGTH (tname)+1, IDENTIFIER_POINTER (tname))); - elems = name_string; - return build_generic_desc (tdecl, __ptmf_desc_type_node, elems); -} - -/* Build an initializer for a __ptmd_type_info node. */ -static tree -build_ptmd_desc (tdecl, type) - tree tdecl; - tree type; -{ - tree tc, t, elems; - tc = build_t_desc (TYPE_OFFSET_BASETYPE (type), 1); - tc = build_indirect_ref (tc , NULL); - t = build_t_desc (TREE_TYPE (type), 1); - t = build_indirect_ref (t , NULL); - elems = tree_cons (NULL_TREE, tc, - tree_cons (NULL_TREE, t, NULL_TREE)); - return build_generic_desc (tdecl, __ptmd_desc_type_node, elems); -} - -struct uninst_st { - tree type; - struct uninst_st *next; -}; -typedef struct uninst_st uninst_node; -static uninst_node * uninst_desc = (uninst_node *)NULL; - -static void -add_uninstantiated_desc (type) - tree type; -{ - uninst_node *t; - - t = (uninst_node *) xmalloc (sizeof (struct uninst_st)); - t->type = type; - t->next = uninst_desc; - uninst_desc = t; -} - -/* We may choose to link the emitting of certain high use TDs for certain - objects, we do that here. Return the type to link against if such a - link exists, otherwise just return TYPE. */ - -tree -get_def_to_follow (type) - tree type; -{ -#if 0 - /* For now we don't lay out T&, T* TDs with the main TD for the object. */ - /* Let T* and T& be written only when T is written (if T is an aggr). - We do this for const, but not for volatile, since volatile - is rare and const is not. */ - if (!TYPE_VOLATILE (taggr) - && (TREE_CODE (taggr) == POINTER_TYPE - || TREE_CODE (taggr) == REFERENCE_TYPE) - && IS_AGGR_TYPE (TREE_TYPE (taggr))) - taggr = TREE_TYPE (taggr); -#endif - return type; -} - -/* build a general type_info node. */ -tree -build_t_desc (type, definition) - tree type; - int definition; -{ - tree tdecl; - tree tname, name_string; - tree elems; - tree t, tt, taggr; - - if (__ptmd_desc_type_node == NULL_TREE) - { - init_type_desc(); - if (__ptmd_desc_type_node) - { - for ( ; uninst_desc; uninst_desc = uninst_desc->next ) - build_t_desc (uninst_desc->type, 1); - } - } - if (__t_desc_type_node == NULL_TREE) - { - static int warned = 0; - if (! warned) - { - cp_error ("failed to build type descriptor node of '%T', maybe typeinfo.h not included", type); - } - warned = 1; - return error_mark_node; - } - if (__ptmd_desc_type_node == NULL_TREE) - { - add_uninstantiated_desc (type); - definition = 0; - } - - push_obstacks (&permanent_obstack, &permanent_obstack); - tname = build_t_desc_overload (type); - - if (!IDENTIFIER_AS_DESC (tname)) - { - tdecl = build_decl (VAR_DECL, tname, __t_desc_type_node); - DECL_EXTERNAL (tdecl) = 1; - TREE_PUBLIC (tdecl) = 1; - tdecl = pushdecl_top_level (tdecl); - SET_IDENTIFIER_AS_DESC (tname, build_unary_op (ADDR_EXPR, tdecl, 0)); - if (!definition) - cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0); - } - else - tdecl = TREE_OPERAND (IDENTIFIER_AS_DESC (tname), 0); - - /* If it's not a definition, don't do anything more. */ - if (!definition) - return IDENTIFIER_AS_DESC (tname); - - /* If it has already been written, don't to anything more. */ - /* Should this be on tdecl? */ - if (TREE_ASM_WRITTEN (IDENTIFIER_AS_DESC (tname))) - return IDENTIFIER_AS_DESC (tname); - - /* If we previously defined it, return the defined result. */ - if (DECL_INITIAL (tdecl)) - return IDENTIFIER_AS_DESC (tname); - - taggr = get_def_to_follow (type); - - /* If we know that we don't need to write out this type's - vtable, then don't write out it's type_info. Somebody - else will take care of that. */ - if (IS_AGGR_TYPE (taggr) && CLASSTYPE_VFIELD (taggr)) - { - /* Let's play follow the vtable. */ - TREE_PUBLIC (tdecl) = CLASSTYPE_INTERFACE_KNOWN (taggr); - DECL_EXTERNAL (tdecl) = CLASSTYPE_INTERFACE_ONLY (taggr); - } - else - { - DECL_EXTERNAL (tdecl) = 0; - TREE_PUBLIC (tdecl) = (definition > 1); - } - - if (DECL_EXTERNAL (tdecl)) - return IDENTIFIER_AS_DESC (tname); - - /* Show that we are defining the t_desc for this type. */ - DECL_INITIAL (tdecl) = error_mark_node; - t = DECL_CONTEXT (tdecl); - if ( t && TREE_CODE_CLASS (TREE_CODE (t)) == 't') - pushclass (t, 2); - - if (TYPE_VOLATILE (type) || TYPE_READONLY (type)) - t = build_attr_desc (tdecl, type); - else if (TREE_CODE (type) == ARRAY_TYPE) - t = build_ptr_desc (tdecl, type); - else if (TREE_CODE (type) == POINTER_TYPE) - { - if (TREE_CODE (TREE_TYPE (type)) == OFFSET_TYPE) - { - type = TREE_TYPE (type); - t = build_ptmd_desc (tdecl, type); - } - else - { - t = build_ptr_desc (tdecl, type); - } - } - else if (TYPE_BUILT_IN (type)) - t = build_bltn_desc (tdecl, type); - else if (IS_AGGR_TYPE (type)) - { - if (TYPE_PTRMEMFUNC_P (type)) - { - t = build_ptmf_desc (tdecl, type); - } - else - { - t = build_class_desc (tdecl, type); - } - } - else if (TREE_CODE (type) == FUNCTION_TYPE) - t = build_func_desc (tdecl); - else - t = build_user_desc (tdecl); - - pop_obstacks (); - return t; -} - -#if 0 -/* This is the old dossier type descriptor generation code, it's much - more extended than rtti. It's reserved for later use. */ -/* Build an initializer for a __t_desc node. So that we can take advantage - of recursion, we accept NULL for TYPE. - DEFINITION is greater than zero iff we must define the type descriptor - (as opposed to merely referencing it). 1 means treat according to - #pragma interface/#pragma implementation rules. 2 means define as - global and public, no matter what. */ -tree -build_t_desc (type, definition) - tree type; - int definition; -{ - tree tdecl; - tree tname, name_string; - tree elems, fields; - tree parents, vbases, offsets, ivars, methods, target_type; - int method_count = 0, field_count = 0; - - if (type == NULL_TREE) - return NULL_TREE; - - tname = build_t_desc_overload (type); - if (IDENTIFIER_AS_DESC (tname) - && (!definition || TREE_ASM_WRITTEN (IDENTIFIER_AS_DESC (tname)))) - return IDENTIFIER_AS_DESC (tname); - - tdecl = lookup_name (tname, 0); - if (tdecl == NULL_TREE) - { - tdecl = build_decl (VAR_DECL, tname, __t_desc_type_node); - DECL_EXTERNAL (tdecl) = 1; - TREE_PUBLIC (tdecl) = 1; - tdecl = pushdecl_top_level (tdecl); - } - /* If we previously defined it, return the defined result. */ - else if (definition && DECL_INITIAL (tdecl)) - return IDENTIFIER_AS_DESC (tname); - - if (definition) - { - tree taggr = type; - /* Let T* and T& be written only when T is written (if T is an aggr). - We do this for const, but not for volatile, since volatile - is rare and const is not. */ - if (!TYPE_VOLATILE (taggr) - && (TREE_CODE (taggr) == POINTER_TYPE - || TREE_CODE (taggr) == REFERENCE_TYPE) - && IS_AGGR_TYPE (TREE_TYPE (taggr))) - taggr = TREE_TYPE (taggr); - - /* If we know that we don't need to write out this type's - vtable, then don't write out it's dossier. Somebody - else will take care of that. */ - if (IS_AGGR_TYPE (taggr) && CLASSTYPE_VFIELD (taggr)) - { - if (CLASSTYPE_VTABLE_NEEDS_WRITING (taggr)) - { - TREE_PUBLIC (tdecl) = ! CLASSTYPE_INTERFACE_ONLY (taggr) - && CLASSTYPE_INTERFACE_KNOWN (taggr); - DECL_EXTERNAL (tdecl) = 0; - } - else - { - if (write_virtuals != 0) - TREE_PUBLIC (tdecl) = 1; - } - } - else - { - DECL_EXTERNAL (tdecl) = 0; - TREE_PUBLIC (tdecl) = (definition > 1); - } - } - SET_IDENTIFIER_AS_DESC (tname, build_unary_op (ADDR_EXPR, tdecl, 0)); - - if (!definition || DECL_EXTERNAL (tdecl)) - { - /* That's it! */ - cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0); - return IDENTIFIER_AS_DESC (tname); - } - - /* Show that we are defining the t_desc for this type. */ - DECL_INITIAL (tdecl) = error_mark_node; - - parents = build_tree_list (NULL_TREE, integer_zero_node); - vbases = build_tree_list (NULL_TREE, integer_zero_node); - offsets = build_tree_list (NULL_TREE, integer_zero_node); - methods = NULL_TREE; - ivars = NULL_TREE; - - if (TYPE_LANG_SPECIFIC (type)) - { - int i = CLASSTYPE_N_BASECLASSES (type); - tree method_vec = CLASSTYPE_METHOD_VEC (type); - tree *meth, *end; - tree binfos = TYPE_BINFO_BASETYPES (type); - tree vb = CLASSTYPE_VBASECLASSES (type); - - while (--i >= 0) - parents = tree_cons (NULL_TREE, build_t_desc (BINFO_TYPE (TREE_VEC_ELT (binfos, i)), 0), parents); - - while (vb) - { - vbases = tree_cons (NULL_TREE, build_t_desc (BINFO_TYPE (vb), 0), vbases); - offsets = tree_cons (NULL_TREE, BINFO_OFFSET (vb), offsets); - vb = TREE_CHAIN (vb); - } - - if (method_vec) - for (meth = TREE_VEC_END (method_vec), - end = &TREE_VEC_ELT (method_vec, 0); meth-- != end; ) - if (*meth) - { - methods = tree_cons (NULL_TREE, build_m_desc (*meth), methods); - method_count++; - } - } - - if (IS_AGGR_TYPE (type)) - { - for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields)) - if (TREE_CODE (fields) == FIELD_DECL - || TREE_CODE (fields) == VAR_DECL) - { - ivars = tree_cons (NULL_TREE, build_i_desc (fields), ivars); - field_count++; - } - ivars = nreverse (ivars); - } - - parents = finish_table (NULL_TREE, build_pointer_type (__t_desc_type_node), parents, 0); - vbases = finish_table (NULL_TREE, build_pointer_type (__t_desc_type_node), vbases, 0); - offsets = finish_table (NULL_TREE, integer_type_node, offsets, 0); - if (methods == NULL_TREE) - methods = null_pointer_node; - else - methods = build_unary_op (ADDR_EXPR, - finish_table (NULL_TREE, __m_desc_type_node, methods, 0), - 0); - if (ivars == NULL_TREE) - ivars = null_pointer_node; - else - ivars = build_unary_op (ADDR_EXPR, - finish_table (NULL_TREE, __i_desc_type_node, ivars, 0), - 0); - if (TREE_TYPE (type)) - target_type = build_t_desc (TREE_TYPE (type), definition); - else - target_type = integer_zero_node; - - name_string = combine_strings (build_string (IDENTIFIER_LENGTH (tname)+1, IDENTIFIER_POINTER (tname))); - - elems = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, name_string, 0), - tree_cons (NULL_TREE, - TYPE_SIZE(type)? size_in_bytes(type) : integer_zero_node, - /* really should use bitfield initialization here. */ - tree_cons (NULL_TREE, integer_zero_node, - tree_cons (NULL_TREE, target_type, - tree_cons (NULL_TREE, build_int_2 (field_count, 2), - tree_cons (NULL_TREE, build_int_2 (method_count, 2), - tree_cons (NULL_TREE, ivars, - tree_cons (NULL_TREE, methods, - tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, parents, 0), - tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, vbases, 0), - build_tree_list (NULL_TREE, build_unary_op (ADDR_EXPR, offsets, 0)))))))))))); - return build_generic_desc (tdecl, elems); -} - -/* Build an initializer for a __i_desc node. */ -tree -build_i_desc (decl) - tree decl; -{ - tree elems, name_string; - tree taggr; - - name_string = DECL_NAME (decl); - name_string = combine_strings (build_string (IDENTIFIER_LENGTH (name_string)+1, IDENTIFIER_POINTER (name_string))); - - /* Now decide whether this ivar should cause it's type to get - def'd or ref'd in this file. If the type we are looking at - has a proxy definition, we look at the proxy (i.e., a - `foo *' is equivalent to a `foo'). */ - taggr = TREE_TYPE (decl); - - if ((TREE_CODE (taggr) == POINTER_TYPE - || TREE_CODE (taggr) == REFERENCE_TYPE) - && TYPE_VOLATILE (taggr) == 0) - taggr = TREE_TYPE (taggr); - - elems = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, name_string, 0), - tree_cons (NULL_TREE, DECL_FIELD_BITPOS (decl), - build_tree_list (NULL_TREE, build_t_desc (TREE_TYPE (decl), - ! IS_AGGR_TYPE (taggr))))); - taggr = build (CONSTRUCTOR, __i_desc_type_node, NULL_TREE, elems); - TREE_CONSTANT (taggr) = 1; - TREE_STATIC (taggr) = 1; - TREE_READONLY (taggr) = 1; - return taggr; -} - -/* Build an initializer for a __m_desc node. */ -tree -build_m_desc (decl) - tree decl; -{ - tree taggr, elems, name_string; - tree parm_count, req_count, vindex, vcontext; - tree parms; - int p_count, r_count; - tree parm_types = NULL_TREE; - - for (parms = TYPE_ARG_TYPES (TREE_TYPE (decl)), p_count = 0, r_count = 0; - parms != NULL_TREE; parms = TREE_CHAIN (parms), p_count++) - { - taggr = TREE_VALUE (parms); - if ((TREE_CODE (taggr) == POINTER_TYPE - || TREE_CODE (taggr) == REFERENCE_TYPE) - && TYPE_VOLATILE (taggr) == 0) - taggr = TREE_TYPE (taggr); - - parm_types = tree_cons (NULL_TREE, build_t_desc (TREE_VALUE (parms), - ! IS_AGGR_TYPE (taggr)), - parm_types); - if (TREE_PURPOSE (parms) == NULL_TREE) - r_count++; - } - - parm_types = finish_table (NULL_TREE, build_pointer_type (__t_desc_type_node), - nreverse (parm_types), 0); - parm_count = build_int_2 (p_count, 0); - req_count = build_int_2 (r_count, 0); - - if (DECL_VINDEX (decl)) - vindex = DECL_VINDEX (decl); - else - vindex = integer_zero_node; - if (DECL_CONTEXT (decl) - && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't') - vcontext = build_t_desc (DECL_CONTEXT (decl), 0); - else - vcontext = integer_zero_node; - name_string = DECL_NAME (decl); - if (name_string == NULL) - name_string = DECL_ASSEMBLER_NAME (decl); - name_string = combine_strings (build_string (IDENTIFIER_LENGTH (name_string)+1, IDENTIFIER_POINTER (name_string))); - - /* Now decide whether the return type of this mvar - should cause it's type to get def'd or ref'd in this file. - If the type we are looking at has a proxy definition, - we look at the proxy (i.e., a `foo *' is equivalent to a `foo'). */ - taggr = TREE_TYPE (TREE_TYPE (decl)); - - if ((TREE_CODE (taggr) == POINTER_TYPE - || TREE_CODE (taggr) == REFERENCE_TYPE) - && TYPE_VOLATILE (taggr) == 0) - taggr = TREE_TYPE (taggr); - - elems = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, name_string, 0), - tree_cons (NULL_TREE, vindex, - tree_cons (NULL_TREE, vcontext, - tree_cons (NULL_TREE, build_t_desc (TREE_TYPE (TREE_TYPE (decl)), - ! IS_AGGR_TYPE (taggr)), - tree_cons (NULL_TREE, build_c_cast (build_pointer_type (default_function_type), build_unary_op (ADDR_EXPR, decl, 0), 0), - tree_cons (NULL_TREE, parm_count, - tree_cons (NULL_TREE, req_count, - build_tree_list (NULL_TREE, build_unary_op (ADDR_EXPR, parm_types, 0))))))))); - - taggr = build (CONSTRUCTOR, __m_desc_type_node, NULL_TREE, elems); - TREE_CONSTANT (taggr) = 1; - TREE_STATIC (taggr) = 1; - TREE_READONLY (taggr) = 1; - return taggr; -} -#endif /* dossier */ - - -/* Conditionally emit code to set up an unwind-protect for the - garbage collector. If this function doesn't do anything that involves - the garbage collector, then do nothing. Otherwise, call __gc_push - at the beginning and __gc_pop at the end. - - NOTE! The __gc_pop function must operate transparently, since - it comes where the logical return label lies. This means that - at runtime *it* must preserve any return value registers. */ - -void -expand_gc_prologue_and_epilogue () -{ - extern tree maybe_gc_cleanup; - struct rtx_def *last_parm_insn, *mark; - extern struct rtx_def *get_last_insn (); - extern struct rtx_def *get_first_nonparm_insn (); - extern struct rtx_def *previous_insn (); - tree action; - - /* If we didn't need the obstack, don't cons any space. */ - if (current_function_obstack_index == 0 - || current_function_obstack_usage == 0) - return; - - mark = get_last_insn (); - last_parm_insn = get_first_nonparm_insn (); - if (last_parm_insn == 0) last_parm_insn = mark; - else last_parm_insn = previous_insn (last_parm_insn); - - action = build_function_call (gc_push_fndecl, - build_tree_list (NULL_TREE, size_int (++current_function_obstack_index))); - expand_expr_stmt (action); - - reorder_insns (next_insn (mark), get_last_insn (), last_parm_insn); - - /* This will be expanded as a cleanup. */ - TREE_VALUE (maybe_gc_cleanup) - = build_function_call (gc_pop_fndecl, NULL_TREE); -} - -/* Some day we'll use this function as a call-back and clean - up all the unnecessary gc dribble that we otherwise create. */ -void -lang_expand_end_bindings (first, last) - struct rtx_def *first, *last; -{ -} - -void -init_gc_processing () -{ - tree parmtypes = hash_tree_chain (class_star_type_node, - hash_tree_chain (integer_type_node, NULL_TREE)); - gc_protect_fndecl = define_function ("__gc_protect", - build_function_type (class_star_type_node, parmtypes), - NOT_BUILT_IN, 0, 0); - - parmtypes = hash_tree_chain (integer_type_node, NULL_TREE); - gc_unprotect_fndecl = define_function ("__gc_unprotect", - build_function_type (void_type_node, parmtypes), - NOT_BUILT_IN, 0, 0); - - gc_push_fndecl = define_function ("__gc_push", - TREE_TYPE (gc_unprotect_fndecl), - NOT_BUILT_IN, 0, 0); - - gc_pop_fndecl = define_function ("__gc_pop", - build_function_type (void_type_node, - void_list_node), - NOT_BUILT_IN, 0, 0); - gc_nonobject = build_int_2 (0x80000000, 0); - gc_visible = build_int_2 (0x40000000, 0); - gc_white = integer_zero_node; - gc_offwhite = build_int_2 (0x10000000, 0); - gc_grey = build_int_2 (0x20000000, 0); - gc_black = build_int_2 (0x30000000, 0); -} diff --git a/contrib/gcc/cp/gpcompare.texi b/contrib/gcc/cp/gpcompare.texi deleted file mode 100644 index 7b0d573105b6..000000000000 --- a/contrib/gcc/cp/gpcompare.texi +++ /dev/null @@ -1,236 +0,0 @@ -@node ANSI -@chapter @sc{gnu} C++ Conformance to @sc{ansi} C++ - -These changes in the @sc{gnu} C++ compiler were made to comply more -closely with the @sc{ansi} base document, @cite{The Annotated C++ -Reference Manual} (the @sc{arm}). Further reducing the divergences from -@sc{ansi} C++ is a continued goal of the @sc{gnu} C++ Renovation -Project. - -@b{Section 3.4}, @i{Start and Termination}. It is now invalid to take -the address of the function @samp{main()}. - -@b{Section 4.8}, @i{Pointers to Members}. The compiler produces -an error for trying to convert between a pointer to a member and the type -@samp{void *}. - -@b{Section 5.2.5}, @i{Increment and Decrement}. It is an error to use -the increment and decrement operators on an enumerated type. - -@b{Section 5.3.2}, @i{Sizeof}. Doing @code{sizeof} on a function is now -an error. - -@b{Section 5.3.4}, @i{Delete}. The syntax of a @i{cast-expression} is -now more strictly controlled. - -@b{Section 7.1.1}, @i{Storage Class Specifiers}. Using the -@code{static} and @code{extern} specifiers can now only be applied to -names of objects, functions, and anonymous unions. - -@b{Section 7.1.1}, @i{Storage Class Specifiers}. The compiler no longer complains -about taking the address of a variable which has been declared to have @code{register} -storage. - -@b{Section 7.1.2}, @i{Function Specifiers}. The compiler produces an -error when the @code{inline} or @code{virtual} specifiers are -used on anything other than a function. - -@b{Section 8.3}, @i{Function Definitions}. It is now an error to shadow -a parameter name with a local variable; in the past, the compiler only -gave a warning in such a situation. - -@b{Section 8.4.1}, @i{Aggregates}. The rules concerning declaration of -an aggregate are now all checked in the @sc{gnu} C++ compiler; they -include having no private or protected members and no base classes. - -@b{Section 8.4.3}, @i{References}. Declaring an array of references is -now forbidden. Initializing a reference with an initializer list is -also considered an error. - -@b{Section 9.5}, @i{Unions}. Global anonymous unions must be declared -@code{static}. - -@b{Section 11.4}, @i{Friends}. Declaring a member to be a friend of a -type that has not yet been defined is an error. - -@b{Section 12.1}, @i{Constructors}. The compiler generates a -default copy constructor for a class if no constructor has been declared. - -@ignore -@b{Section 12.4}, @i{Destructors}. In accordance with the @sc{ansi} C++ -draft standard working paper, a pure virtual destructor must now be -defined. -@end ignore - -@b{Section 12.6.2}, @i{Special Member Functions}. When using a -@i{mem-initializer} list, the compiler will now initialize class members -in declaration order, not in the order in which you specify them. -Also, the compiler enforces the rule that non-static @code{const} -and reference members must be initialized with a @i{mem-initializer} -list when their class does not have a constructor. - -@b{Section 12.8}, @i{Copying Class Objects}. The compiler generates -default copy constructors correctly, and supplies default assignment -operators compatible with user-defined ones. - -@b{Section 13.4}, @i{Overloaded Operators}. An overloaded operator may -no longer have default arguments. - -@b{Section 13.4.4}, @i{Function Call}. An overloaded @samp{operator ()} -must be a non-static member function. - -@b{Section 13.4.5}, @i{Subscripting}. An overloaded @samp{operator []} -must be a non-static member function. - -@b{Section 13.4.6}, @i{Class Member Access}. An overloaded @samp{operator ->} -must be a non-static member function. - -@b{Section 13.4.7}, @i{Increment and Decrement}. The compiler will now -make sure a postfix @samp{@w{operator ++}} or @samp{@w{operator --}} has an -@code{int} as its second argument. - - -@node Encoding -@chapter Name Encoding in @sc{gnu} C++ - -@c FIXME!! rewrite name encoding section -@c ...to give complete rules rather than diffs from ARM. -@c To avoid plagiarism, invent some different way of structuring the -@c description of the rules than what ARM uses. - -@cindex mangling -@cindex name encoding -@cindex encoding information in names -In order to support its strong typing rules and the ability to provide -function overloading, the C++ programming language @dfn{encodes} -information about functions and objects, so that conflicts across object -files can be detected during linking. @footnote{This encoding is also -sometimes called, whimsically enough, @dfn{mangling}; the corresponding -decoding is sometimes called @dfn{demangling}.} These rules tend to be -unique to each individual implementation of C++. - -The scheme detailed in the commentary for 7.2.1 of @cite{The Annotated -Reference Manual} offers a description of a possible implementation -which happens to closely resemble the @code{cfront} compiler. The -design used in @sc{gnu} C++ differs from this model in a number of ways: - -@itemize @bullet -@item -In addition to the basic types @code{void}, @code{char}, @code{short}, -@code{int}, @code{long}, @code{float}, @code{double}, and @code{long -double}, @sc{gnu} C++ supports two additional types: @code{wchar_t}, the wide -character type, and @code{long long} (if the host supports it). The -encodings for these are @samp{w} and @samp{x} respectively. - -@item -According to the @sc{arm}, qualified names (e.g., @samp{foo::bar::baz}) are -encoded with a leading @samp{Q}. Followed by the number of -qualifications (in this case, three) and the respective names, this -might be encoded as @samp{Q33foo3bar3baz}. @sc{gnu} C++ adds a leading -underscore to the list, producing @samp{_Q33foo3bar3baz}. - -@item -The operator @samp{*=} is encoded as @samp{__aml}, not @samp{__amu}, to -match the normal @samp{*} operator, which is encoded as @samp{__ml}. - -@c XXX left out ->(), __wr -@item -In addition to the normal operators, @sc{gnu} C++ also offers the minimum and -maximum operators @samp{>?} and @samp{ -@c To: mrs@@charlie.secs.csun.edu -@c Cc: g++@@cygnus.com -@c Subject: Re: ARM and GNU C++ incompatabilities -@c -@c Along with that, we should probably describe how g++ differs from -@c cfront, in ways that the users will notice. (E.g., cfront supposedly -@c allows "free (new char[10])"; does g++? How do the template -@c implementations differ? "New" placement syntax?) -@c @end display -@c -@c XXX For next revision. -@c -@c GNU C++: -@c * supports expanding inline functions in many situations, -@c including those which have static objects, use `for' statements, -@c and other situations. Part of this versatility is due to is -@c ability to not always generate temporaries for assignments. -@c * deliberately allows divide by 0 and mod 0, since [according -@c to Wilson] there are actually situations where you'd like to allow -@c such things. Note on most systems it will cause some sort of trap -@c or bus error. Cfront considers it an error. -@c * does [appear to] support nested classes within templates. -@c * conversion functions among baseclasses are all usable by -@c a class that's derived from all of those bases. -@c * sizeof works even when the class is defined within its ()'s -@c * conditional expressions work with member fns and pointers to -@c members. -@c * can handle non-trivial declarations of variables within switch -@c statements. -@c -@c Cfront: diff --git a/contrib/gcc/cp/gxx.gperf b/contrib/gcc/cp/gxx.gperf deleted file mode 100644 index 1e621c4a22d6..000000000000 --- a/contrib/gcc/cp/gxx.gperf +++ /dev/null @@ -1,111 +0,0 @@ -%{ -/* Command-line: gperf -L KR-C -F ', 0, 0' -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf */ -%} -struct resword { const char *name; short token; enum rid rid;}; -%% -__alignof, ALIGNOF, NORID -__alignof__, ALIGNOF, NORID -__asm, ASM_KEYWORD, NORID -__asm__, ASM_KEYWORD, NORID -__attribute, ATTRIBUTE, NORID -__attribute__, ATTRIBUTE, NORID -__complex, TYPESPEC, RID_COMPLEX -__complex__, TYPESPEC, RID_COMPLEX -__const, CV_QUALIFIER, RID_CONST -__const__, CV_QUALIFIER, RID_CONST -__extension__, EXTENSION, NORID -__imag, IMAGPART, NORID -__imag__, IMAGPART, NORID -__inline, SCSPEC, RID_INLINE -__inline__, SCSPEC, RID_INLINE -__label__, LABEL, NORID -__null, CONSTANT, RID_NULL -__real, REALPART, NORID -__real__, REALPART, NORID -__restrict, CV_QUALIFIER, RID_RESTRICT -__restrict__, CV_QUALIFIER, RID_RESTRICT -__signature__, AGGR, RID_SIGNATURE /* Extension */, -__signed, TYPESPEC, RID_SIGNED -__signed__, TYPESPEC, RID_SIGNED -__sigof__, SIGOF, NORID /* Extension */, -__typeof, TYPEOF, NORID -__typeof__, TYPEOF, NORID -__volatile, CV_QUALIFIER, RID_VOLATILE -__volatile__, CV_QUALIFIER, RID_VOLATILE -__wchar_t, TYPESPEC, RID_WCHAR /* Unique to ANSI C++ */, -asm, ASM_KEYWORD, NORID, -and, ANDAND, NORID, -and_eq, ASSIGN, NORID, -auto, SCSPEC, RID_AUTO, -bitand, '&', NORID, -bitor, '|', NORID, -bool, TYPESPEC, RID_BOOL, -break, BREAK, NORID, -case, CASE, NORID, -catch, CATCH, NORID, -char, TYPESPEC, RID_CHAR, -class, AGGR, RID_CLASS, -compl, '~', NORID, -const, CV_QUALIFIER, RID_CONST, -const_cast, CONST_CAST, NORID, -continue, CONTINUE, NORID, -default, DEFAULT, NORID, -delete, DELETE, NORID, -do, DO, NORID, -double, TYPESPEC, RID_DOUBLE, -dynamic_cast, DYNAMIC_CAST, NORID, -else, ELSE, NORID, -enum, ENUM, NORID, -explicit, SCSPEC, RID_EXPLICIT, -export, SCSPEC, RID_EXPORT, -extern, SCSPEC, RID_EXTERN, -false, CXX_FALSE, NORID, -float, TYPESPEC, RID_FLOAT, -for, FOR, NORID, -friend, SCSPEC, RID_FRIEND, -goto, GOTO, NORID, -if, IF, NORID, -inline, SCSPEC, RID_INLINE, -int, TYPESPEC, RID_INT, -long, TYPESPEC, RID_LONG, -mutable, SCSPEC, RID_MUTABLE, -namespace, NAMESPACE, NORID, -new, NEW, NORID, -not, '!', NORID, -not_eq, EQCOMPARE, NORID, -operator, OPERATOR, NORID, -or, OROR, NORID, -or_eq, ASSIGN, NORID, -private, VISSPEC, RID_PRIVATE, -protected, VISSPEC, RID_PROTECTED, -public, VISSPEC, RID_PUBLIC, -register, SCSPEC, RID_REGISTER, -reinterpret_cast, REINTERPRET_CAST, NORID, -return, RETURN_KEYWORD, NORID, -short, TYPESPEC, RID_SHORT, -signature, AGGR, RID_SIGNATURE /* Extension */, -signed, TYPESPEC, RID_SIGNED, -sigof, SIGOF, NORID /* Extension */, -sizeof, SIZEOF, NORID, -static, SCSPEC, RID_STATIC, -static_cast, STATIC_CAST, NORID, -struct, AGGR, RID_RECORD, -switch, SWITCH, NORID, -template, TEMPLATE, RID_TEMPLATE, -this, THIS, NORID, -throw, THROW, NORID, -true, CXX_TRUE, NORID, -try, TRY, NORID, -typedef, SCSPEC, RID_TYPEDEF, -typename, TYPENAME_KEYWORD, NORID, -typeid, TYPEID, NORID, -typeof, TYPEOF, NORID, -union, AGGR, RID_UNION, -unsigned, TYPESPEC, RID_UNSIGNED, -using, USING, NORID, -virtual, SCSPEC, RID_VIRTUAL, -void, TYPESPEC, RID_VOID, -volatile, CV_QUALIFIER, RID_VOLATILE, -while, WHILE, NORID, -xor, '^', NORID, -xor_eq, ASSIGN, NORID, diff --git a/contrib/gcc/cp/gxxint.texi b/contrib/gcc/cp/gxxint.texi deleted file mode 100644 index 81bcab864250..000000000000 --- a/contrib/gcc/cp/gxxint.texi +++ /dev/null @@ -1,2075 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename g++int.info -@settitle G++ internals -@setchapternewpage odd -@c %**end of header - -@node Top, Limitations of g++, (dir), (dir) -@chapter Internal Architecture of the Compiler - -This is meant to describe the C++ front-end for gcc in detail. -Questions and comments to Benjamin Kosnik @code{}. - -@menu -* Limitations of g++:: -* Routines:: -* Implementation Specifics:: -* Glossary:: -* Macros:: -* Typical Behavior:: -* Coding Conventions:: -* Templates:: -* Access Control:: -* Error Reporting:: -* Parser:: -* Exception Handling:: -* Free Store:: -* Mangling:: Function name mangling for C++ and Java -* Vtables:: Two ways to do virtual functions -* Concept Index:: -@end menu - -@node Limitations of g++, Routines, Top, Top -@section Limitations of g++ - -@itemize @bullet -@item -Limitations on input source code: 240 nesting levels with the parser -stacksize (YYSTACKSIZE) set to 500 (the default), and requires around -16.4k swap space per nesting level. The parser needs about 2.09 * -number of nesting levels worth of stackspace. - -@cindex pushdecl_class_level -@item -I suspect there are other uses of pushdecl_class_level that do not call -set_identifier_type_value in tandem with the call to -pushdecl_class_level. It would seem to be an omission. - -@cindex access checking -@item -Access checking is unimplemented for nested types. - -@cindex @code{volatile} -@item -@code{volatile} is not implemented in general. - -@end itemize - -@node Routines, Implementation Specifics, Limitations of g++, Top -@section Routines - -This section describes some of the routines used in the C++ front-end. - -@code{build_vtable} and @code{prepare_fresh_vtable} is used only within -the @file{cp-class.c} file, and only in @code{finish_struct} and -@code{modify_vtable_entries}. - -@code{build_vtable}, @code{prepare_fresh_vtable}, and -@code{finish_struct} are the only routines that set @code{DECL_VPARENT}. - -@code{finish_struct} can steal the virtual function table from parents, -this prohibits related_vslot from working. When finish_struct steals, -we know that - -@example -get_binfo (DECL_FIELD_CONTEXT (CLASSTYPE_VFIELD (t)), t, 0) -@end example - -@noindent -will get the related binfo. - -@code{layout_basetypes} does something with the VIRTUALS. - -Supposedly (according to Tiemann) most of the breadth first searching -done, like in @code{get_base_distance} and in @code{get_binfo} was not -because of any design decision. I have since found out the at least one -part of the compiler needs the notion of depth first binfo searching, I -am going to try and convert the whole thing, it should just work. The -term left-most refers to the depth first left-most node. It uses -@code{MAIN_VARIANT == type} as the condition to get left-most, because -the things that have @code{BINFO_OFFSET}s of zero are shared and will -have themselves as their own @code{MAIN_VARIANT}s. The non-shared right -ones, are copies of the left-most one, hence if it is its own -@code{MAIN_VARIANT}, we know it IS a left-most one, if it is not, it is -a non-left-most one. - -@code{get_base_distance}'s path and distance matters in its use in: - -@itemize @bullet -@item -@code{prepare_fresh_vtable} (the code is probably wrong) -@item -@code{init_vfields} Depends upon distance probably in a safe way, -build_offset_ref might use partial paths to do further lookups, -hack_identifier is probably not properly checking access. - -@item -@code{get_first_matching_virtual} probably should check for -@code{get_base_distance} returning -2. - -@item -@code{resolve_offset_ref} should be called in a more deterministic -manner. Right now, it is called in some random contexts, like for -arguments at @code{build_method_call} time, @code{default_conversion} -time, @code{convert_arguments} time, @code{build_unary_op} time, -@code{build_c_cast} time, @code{build_modify_expr} time, -@code{convert_for_assignment} time, and -@code{convert_for_initialization} time. - -But, there are still more contexts it needs to be called in, one was the -ever simple: - -@example -if (obj.*pmi != 7) - @dots{} -@end example - -Seems that the problems were due to the fact that @code{TREE_TYPE} of -the @code{OFFSET_REF} was not a @code{OFFSET_TYPE}, but rather the type -of the referent (like @code{INTEGER_TYPE}). This problem was fixed by -changing @code{default_conversion} to check @code{TREE_CODE (x)}, -instead of only checking @code{TREE_CODE (TREE_TYPE (x))} to see if it -was @code{OFFSET_TYPE}. - -@end itemize - -@node Implementation Specifics, Glossary, Routines, Top -@section Implementation Specifics - -@itemize @bullet -@item Explicit Initialization - -The global list @code{current_member_init_list} contains the list of -mem-initializers specified in a constructor declaration. For example: - -@example -foo::foo() : a(1), b(2) @{@} -@end example - -@noindent -will initialize @samp{a} with 1 and @samp{b} with 2. -@code{expand_member_init} places each initialization (a with 1) on the -global list. Then, when the fndecl is being processed, -@code{emit_base_init} runs down the list, initializing them. It used to -be the case that g++ first ran down @code{current_member_init_list}, -then ran down the list of members initializing the ones that weren't -explicitly initialized. Things were rewritten to perform the -initializations in order of declaration in the class. So, for the above -example, @samp{a} and @samp{b} will be initialized in the order that -they were declared: - -@example -class foo @{ public: int b; int a; foo (); @}; -@end example - -@noindent -Thus, @samp{b} will be initialized with 2 first, then @samp{a} will be -initialized with 1, regardless of how they're listed in the mem-initializer. - -@item The Explicit Keyword - -The use of @code{explicit} on a constructor is used by @code{grokdeclarator} -to set the field @code{DECL_NONCONVERTING_P}. That value is used by -@code{build_method_call} and @code{build_user_type_conversion_1} to decide -if a particular constructor should be used as a candidate for conversions. - -@end itemize - -@node Glossary, Macros, Implementation Specifics, Top -@section Glossary - -@table @r -@item binfo -The main data structure in the compiler used to represent the -inheritance relationships between classes. The data in the binfo can be -accessed by the BINFO_ accessor macros. - -@item vtable -@itemx virtual function table - -The virtual function table holds information used in virtual function -dispatching. In the compiler, they are usually referred to as vtables, -or vtbls. The first index is not used in the normal way, I believe it -is probably used for the virtual destructor. There are two forms of -virtual tables, one that has offsets in addition to pointers, and one -using thunks. @xref{Vtables}. - -@item vfield - -vfields can be thought of as the base information needed to build -vtables. For every vtable that exists for a class, there is a vfield. -See also vtable and virtual function table pointer. When a type is used -as a base class to another type, the virtual function table for the -derived class can be based upon the vtable for the base class, just -extended to include the additional virtual methods declared in the -derived class. The virtual function table from a virtual base class is -never reused in a derived class. @code{is_normal} depends upon this. - -@item virtual function table pointer - -These are @code{FIELD_DECL}s that are pointer types that point to -vtables. See also vtable and vfield. -@end table - -@node Macros, Typical Behavior, Glossary, Top -@section Macros - -This section describes some of the macros used on trees. The list -should be alphabetical. Eventually all macros should be documented -here. - -@table @code -@item BINFO_BASETYPES -A vector of additional binfos for the types inherited by this basetype. -The binfos are fully unshared (except for virtual bases, in which -case the binfo structure is shared). - - If this basetype describes type D as inherited in C, - and if the basetypes of D are E anf F, - then this vector contains binfos for inheritance of E and F by C. - -Has values of: - - TREE_VECs - - -@item BINFO_INHERITANCE_CHAIN -Temporarily used to represent specific inheritances. It usually points -to the binfo associated with the lesser derived type, but it can be -reversed by reverse_path. For example: - -@example - Z ZbY least derived - | - Y YbX - | - X Xb most derived - -TYPE_BINFO (X) == Xb -BINFO_INHERITANCE_CHAIN (Xb) == YbX -BINFO_INHERITANCE_CHAIN (Yb) == ZbY -BINFO_INHERITANCE_CHAIN (Zb) == 0 -@end example - -Not sure is the above is really true, get_base_distance has is point -towards the most derived type, opposite from above. - -Set by build_vbase_path, recursive_bounded_basetype_p, -get_base_distance, lookup_field, lookup_fnfields, and reverse_path. - -What things can this be used on: - - TREE_VECs that are binfos - - -@item BINFO_OFFSET -The offset where this basetype appears in its containing type. -BINFO_OFFSET slot holds the offset (in bytes) from the base of the -complete object to the base of the part of the object that is allocated -on behalf of this `type'. This is always 0 except when there is -multiple inheritance. - -Used on TREE_VEC_ELTs of the binfos BINFO_BASETYPES (...) for example. - - -@item BINFO_VIRTUALS -A unique list of functions for the virtual function table. See also -TYPE_BINFO_VIRTUALS. - -What things can this be used on: - - TREE_VECs that are binfos - - -@item BINFO_VTABLE -Used to find the VAR_DECL that is the virtual function table associated -with this binfo. See also TYPE_BINFO_VTABLE. To get the virtual -function table pointer, see CLASSTYPE_VFIELD. - -What things can this be used on: - - TREE_VECs that are binfos - -Has values of: - - VAR_DECLs that are virtual function tables - - -@item BLOCK_SUPERCONTEXT -In the outermost scope of each function, it points to the FUNCTION_DECL -node. It aids in better DWARF support of inline functions. - - -@item CLASSTYPE_TAGS -CLASSTYPE_TAGS is a linked (via TREE_CHAIN) list of member classes of a -class. TREE_PURPOSE is the name, TREE_VALUE is the type (pushclass scans -these and calls pushtag on them.) - -finish_struct scans these to produce TYPE_DECLs to add to the -TYPE_FIELDS of the type. - -It is expected that name found in the TREE_PURPOSE slot is unique, -resolve_scope_to_name is one such place that depends upon this -uniqueness. - - -@item CLASSTYPE_METHOD_VEC -The following is true after finish_struct has been called (on the -class?) but not before. Before finish_struct is called, things are -different to some extent. Contains a TREE_VEC of methods of the class. -The TREE_VEC_LENGTH is the number of differently named methods plus one -for the 0th entry. The 0th entry is always allocated, and reserved for -ctors and dtors. If there are none, TREE_VEC_ELT(N,0) == NULL_TREE. -Each entry of the TREE_VEC is a FUNCTION_DECL. For each FUNCTION_DECL, -there is a DECL_CHAIN slot. If the FUNCTION_DECL is the last one with a -given name, the DECL_CHAIN slot is NULL_TREE. Otherwise it is the next -method that has the same name (but a different signature). It would -seem that it is not true that because the DECL_CHAIN slot is used in -this way, we cannot call pushdecl to put the method in the global scope -(cause that would overwrite the TREE_CHAIN slot), because they use -different _CHAINs. finish_struct_methods setups up one version of the -TREE_CHAIN slots on the FUNCTION_DECLs. - -friends are kept in TREE_LISTs, so that there's no need to use their -TREE_CHAIN slot for anything. - -Has values of: - - TREE_VECs - - -@item CLASSTYPE_VFIELD -Seems to be in the process of being renamed TYPE_VFIELD. Use on types -to get the main virtual function table pointer. To get the virtual -function table use BINFO_VTABLE (TYPE_BINFO ()). - -Has values of: - - FIELD_DECLs that are virtual function table pointers - -What things can this be used on: - - RECORD_TYPEs - - -@item DECL_CLASS_CONTEXT -Identifies the context that the _DECL was found in. For virtual function -tables, it points to the type associated with the virtual function -table. See also DECL_CONTEXT, DECL_FIELD_CONTEXT and DECL_FCONTEXT. - -The difference between this and DECL_CONTEXT, is that for virtuals -functions like: - -@example -struct A -@{ - virtual int f (); -@}; - -struct B : A -@{ - int f (); -@}; - -DECL_CONTEXT (A::f) == A -DECL_CLASS_CONTEXT (A::f) == A - -DECL_CONTEXT (B::f) == A -DECL_CLASS_CONTEXT (B::f) == B -@end example - -Has values of: - - RECORD_TYPEs, or UNION_TYPEs - -What things can this be used on: - - TYPE_DECLs, _DECLs - - -@item DECL_CONTEXT -Identifies the context that the _DECL was found in. Can be used on -virtual function tables to find the type associated with the virtual -function table, but since they are FIELD_DECLs, DECL_FIELD_CONTEXT is a -better access method. Internally the same as DECL_FIELD_CONTEXT, so -don't us both. See also DECL_FIELD_CONTEXT, DECL_FCONTEXT and -DECL_CLASS_CONTEXT. - -Has values of: - - RECORD_TYPEs - - -What things can this be used on: - -@display -VAR_DECLs that are virtual function tables -_DECLs -@end display - - -@item DECL_FIELD_CONTEXT -Identifies the context that the FIELD_DECL was found in. Internally the -same as DECL_CONTEXT, so don't us both. See also DECL_CONTEXT, -DECL_FCONTEXT and DECL_CLASS_CONTEXT. - -Has values of: - - RECORD_TYPEs - -What things can this be used on: - -@display -FIELD_DECLs that are virtual function pointers -FIELD_DECLs -@end display - - -@item DECL_NAME - -Has values of: - -@display -0 for things that don't have names -IDENTIFIER_NODEs for TYPE_DECLs -@end display - -@item DECL_IGNORED_P -A bit that can be set to inform the debug information output routines in -the back-end that a certain _DECL node should be totally ignored. - -Used in cases where it is known that the debugging information will be -output in another file, or where a sub-type is known not to be needed -because the enclosing type is not needed. - -A compiler constructed virtual destructor in derived classes that do not -define an explicit destructor that was defined explicit in a base class -has this bit set as well. Also used on __FUNCTION__ and -__PRETTY_FUNCTION__ to mark they are ``compiler generated.'' c-decl and -c-lex.c both want DECL_IGNORED_P set for ``internally generated vars,'' -and ``user-invisible variable.'' - -Functions built by the C++ front-end such as default destructors, -virtual destructors and default constructors want to be marked that -they are compiler generated, but unsure why. - -Currently, it is used in an absolute way in the C++ front-end, as an -optimization, to tell the debug information output routines to not -generate debugging information that will be output by another separately -compiled file. - - -@item DECL_VIRTUAL_P -A flag used on FIELD_DECLs and VAR_DECLs. (Documentation in tree.h is -wrong.) Used in VAR_DECLs to indicate that the variable is a vtable. -It is also used in FIELD_DECLs for vtable pointers. - -What things can this be used on: - - FIELD_DECLs and VAR_DECLs - - -@item DECL_VPARENT -Used to point to the parent type of the vtable if there is one, else it -is just the type associated with the vtable. Because of the sharing of -virtual function tables that goes on, this slot is not very useful, and -is in fact, not used in the compiler at all. It can be removed. - -What things can this be used on: - - VAR_DECLs that are virtual function tables - -Has values of: - - RECORD_TYPEs maybe UNION_TYPEs - - -@item DECL_FCONTEXT -Used to find the first baseclass in which this FIELD_DECL is defined. -See also DECL_CONTEXT, DECL_FIELD_CONTEXT and DECL_CLASS_CONTEXT. - -How it is used: - - Used when writing out debugging information about vfield and - vbase decls. - -What things can this be used on: - - FIELD_DECLs that are virtual function pointers - FIELD_DECLs - - -@item DECL_REFERENCE_SLOT -Used to hold the initialize for the reference. - -What things can this be used on: - - PARM_DECLs and VAR_DECLs that have a reference type - - -@item DECL_VINDEX -Used for FUNCTION_DECLs in two different ways. Before the structure -containing the FUNCTION_DECL is laid out, DECL_VINDEX may point to a -FUNCTION_DECL in a base class which is the FUNCTION_DECL which this -FUNCTION_DECL will replace as a virtual function. When the class is -laid out, this pointer is changed to an INTEGER_CST node which is -suitable to find an index into the virtual function table. See -get_vtable_entry as to how one can find the right index into the virtual -function table. The first index 0, of a virtual function table it not -used in the normal way, so the first real index is 1. - -DECL_VINDEX may be a TREE_LIST, that would seem to be a list of -overridden FUNCTION_DECLs. add_virtual_function has code to deal with -this when it uses the variable base_fndecl_list, but it would seem that -somehow, it is possible for the TREE_LIST to pursist until method_call, -and it should not. - - -What things can this be used on: - - FUNCTION_DECLs - - -@item DECL_SOURCE_FILE -Identifies what source file a particular declaration was found in. - -Has values of: - - "" on TYPE_DECLs to mean the typedef is built in - - -@item DECL_SOURCE_LINE -Identifies what source line number in the source file the declaration -was found at. - -Has values of: - -@display -0 for an undefined label - -0 for TYPE_DECLs that are internally generated - -0 for FUNCTION_DECLs for functions generated by the compiler - (not yet, but should be) - -0 for ``magic'' arguments to functions, that the user has no - control over -@end display - - -@item TREE_USED - -Has values of: - - 0 for unused labels - - -@item TREE_ADDRESSABLE -A flag that is set for any type that has a constructor. - - -@item TREE_COMPLEXITY -They seem a kludge way to track recursion, poping, and pushing. They only -appear in cp-decl.c and cp-decl2.c, so the are a good candidate for -proper fixing, and removal. - - -@item TREE_HAS_CONSTRUCTOR -A flag to indicate when a CALL_EXPR represents a call to a constructor. -If set, we know that the type of the object, is the complete type of the -object, and that the value returned is nonnull. When used in this -fashion, it is an optimization. Can also be used on SAVE_EXPRs to -indicate when they are of fixed type and nonnull. Can also be used on -INDIRECT_EXPRs on CALL_EXPRs that represent a call to a constructor. - - -@item TREE_PRIVATE -Set for FIELD_DECLs by finish_struct. But not uniformly set. - -The following routines do something with PRIVATE access: -build_method_call, alter_access, finish_struct_methods, -finish_struct, convert_to_aggr, CWriteLanguageDecl, CWriteLanguageType, -CWriteUseObject, compute_access, lookup_field, dfs_pushdecl, -GNU_xref_member, dbxout_type_fields, dbxout_type_method_1 - - -@item TREE_PROTECTED -The following routines do something with PROTECTED access: -build_method_call, alter_access, finish_struct, convert_to_aggr, -CWriteLanguageDecl, CWriteLanguageType, CWriteUseObject, -compute_access, lookup_field, GNU_xref_member, dbxout_type_fields, -dbxout_type_method_1 - - -@item TYPE_BINFO -Used to get the binfo for the type. - -Has values of: - - TREE_VECs that are binfos - -What things can this be used on: - - RECORD_TYPEs - - -@item TYPE_BINFO_BASETYPES -See also BINFO_BASETYPES. - -@item TYPE_BINFO_VIRTUALS -A unique list of functions for the virtual function table. See also -BINFO_VIRTUALS. - -What things can this be used on: - - RECORD_TYPEs - - -@item TYPE_BINFO_VTABLE -Points to the virtual function table associated with the given type. -See also BINFO_VTABLE. - -What things can this be used on: - - RECORD_TYPEs - -Has values of: - - VAR_DECLs that are virtual function tables - - -@item TYPE_NAME -Names the type. - -Has values of: - -@display -0 for things that don't have names. -should be IDENTIFIER_NODE for RECORD_TYPEs UNION_TYPEs and - ENUM_TYPEs. -TYPE_DECL for RECORD_TYPEs, UNION_TYPEs and ENUM_TYPEs, but - shouldn't be. -TYPE_DECL for typedefs, unsure why. -@end display - -What things can one use this on: - -@display -TYPE_DECLs -RECORD_TYPEs -UNION_TYPEs -ENUM_TYPEs -@end display - -History: - - It currently points to the TYPE_DECL for RECORD_TYPEs, - UNION_TYPEs and ENUM_TYPEs, but it should be history soon. - - -@item TYPE_METHODS -Synonym for @code{CLASSTYPE_METHOD_VEC}. Chained together with -@code{TREE_CHAIN}. @file{dbxout.c} uses this to get at the methods of a -class. - - -@item TYPE_DECL -Used to represent typedefs, and used to represent bindings layers. - -Components: - - DECL_NAME is the name of the typedef. For example, foo would - be found in the DECL_NAME slot when @code{typedef int foo;} is - seen. - - DECL_SOURCE_LINE identifies what source line number in the - source file the declaration was found at. A value of 0 - indicates that this TYPE_DECL is just an internal binding layer - marker, and does not correspond to a user supplied typedef. - - DECL_SOURCE_FILE - -@item TYPE_FIELDS -A linked list (via @code{TREE_CHAIN}) of member types of a class. The -list can contain @code{TYPE_DECL}s, but there can also be other things -in the list apparently. See also @code{CLASSTYPE_TAGS}. - - -@item TYPE_VIRTUAL_P -A flag used on a @code{FIELD_DECL} or a @code{VAR_DECL}, indicates it is -a virtual function table or a pointer to one. When used on a -@code{FUNCTION_DECL}, indicates that it is a virtual function. When -used on an @code{IDENTIFIER_NODE}, indicates that a function with this -same name exists and has been declared virtual. - -When used on types, it indicates that the type has virtual functions, or -is derived from one that does. - -Not sure if the above about virtual function tables is still true. See -also info on @code{DECL_VIRTUAL_P}. - -What things can this be used on: - - FIELD_DECLs, VAR_DECLs, FUNCTION_DECLs, IDENTIFIER_NODEs - - -@item VF_BASETYPE_VALUE -Get the associated type from the binfo that caused the given vfield to -exist. This is the least derived class (the most parent class) that -needed a virtual function table. It is probably the case that all uses -of this field are misguided, but they need to be examined on a -case-by-case basis. See history for more information on why the -previous statement was made. - -Set at @code{finish_base_struct} time. - -What things can this be used on: - - TREE_LISTs that are vfields - -History: - - This field was used to determine if a virtual function table's - slot should be filled in with a certain virtual function, by - checking to see if the type returned by VF_BASETYPE_VALUE was a - parent of the context in which the old virtual function existed. - This incorrectly assumes that a given type _could_ not appear as - a parent twice in a given inheritance lattice. For single - inheritance, this would in fact work, because a type could not - possibly appear more than once in an inheritance lattice, but - with multiple inheritance, a type can appear more than once. - - -@item VF_BINFO_VALUE -Identifies the binfo that caused this vfield to exist. If this vfield -is from the first direct base class that has a virtual function table, -then VF_BINFO_VALUE is NULL_TREE, otherwise it will be the binfo of the -direct base where the vfield came from. Can use @code{TREE_VIA_VIRTUAL} -on result to find out if it is a virtual base class. Related to the -binfo found by - -@example -get_binfo (VF_BASETYPE_VALUE (vfield), t, 0) -@end example - -@noindent -where @samp{t} is the type that has the given vfield. - -@example -get_binfo (VF_BASETYPE_VALUE (vfield), t, 0) -@end example - -@noindent -will return the binfo for the given vfield. - -May or may not be set at @code{modify_vtable_entries} time. Set at -@code{finish_base_struct} time. - -What things can this be used on: - - TREE_LISTs that are vfields - - -@item VF_DERIVED_VALUE -Identifies the type of the most derived class of the vfield, excluding -the class this vfield is for. - -Set at @code{finish_base_struct} time. - -What things can this be used on: - - TREE_LISTs that are vfields - - -@item VF_NORMAL_VALUE -Identifies the type of the most derived class of the vfield, including -the class this vfield is for. - -Set at @code{finish_base_struct} time. - -What things can this be used on: - - TREE_LISTs that are vfields - - -@item WRITABLE_VTABLES -This is a option that can be defined when building the compiler, that -will cause the compiler to output vtables into the data segment so that -the vtables maybe written. This is undefined by default, because -normally the vtables should be unwritable. People that implement object -I/O facilities may, or people that want to change the dynamic type of -objects may want to have the vtables writable. Another way of achieving -this would be to make a copy of the vtable into writable memory, but the -drawback there is that that method only changes the type for one object. - -@end table - -@node Typical Behavior, Coding Conventions, Macros, Top -@section Typical Behavior - -@cindex parse errors - -Whenever seemingly normal code fails with errors like -@code{syntax error at `\@{'}, it's highly likely that grokdeclarator is -returning a NULL_TREE for whatever reason. - -@node Coding Conventions, Templates, Typical Behavior, Top -@section Coding Conventions - -It should never be that case that trees are modified in-place by the -back-end, @emph{unless} it is guaranteed that the semantics are the same -no matter how shared the tree structure is. @file{fold-const.c} still -has some cases where this is not true, but rms hypothesizes that this -will never be a problem. - -@node Templates, Access Control, Coding Conventions, Top -@section Templates - -A template is represented by a @code{TEMPLATE_DECL}. The specific -fields used are: - -@table @code -@item DECL_TEMPLATE_RESULT -The generic decl on which instantiations are based. This looks just -like any other decl. - -@item DECL_TEMPLATE_PARMS -The parameters to this template. -@end table - -The generic decl is parsed as much like any other decl as possible, -given the parameterization. The template decl is not built up until the -generic decl has been completed. For template classes, a template decl -is generated for each member function and static data member, as well. - -Template members of template classes are represented by a TEMPLATE_DECL -for the class' parameters around another TEMPLATE_DECL for the member's -parameters. - -All declarations that are instantiations or specializations of templates -refer to their template and parameters through DECL_TEMPLATE_INFO. - -How should I handle parsing member functions with the proper param -decls? Set them up again or try to use the same ones? Currently we do -the former. We can probably do this without any extra machinery in -store_pending_inline, by deducing the parameters from the decl in -do_pending_inlines. PRE_PARSED_TEMPLATE_DECL? - -If a base is a parm, we can't check anything about it. If a base is not -a parm, we need to check it for name binding. Do finish_base_struct if -no bases are parameterized (only if none, including indirect, are -parms). Nah, don't bother trying to do any of this until instantiation --- we only need to do name binding in advance. - -Always set up method vec and fields, inc. synthesized methods. Really? -We can't know the types of the copy folks, or whether we need a -destructor, or can have a default ctor, until we know our bases and -fields. Otherwise, we can assume and fix ourselves later. Hopefully. - -@node Access Control, Error Reporting, Templates, Top -@section Access Control -The function compute_access returns one of three values: - -@table @code -@item access_public -means that the field can be accessed by the current lexical scope. - -@item access_protected -means that the field cannot be accessed by the current lexical scope -because it is protected. - -@item access_private -means that the field cannot be accessed by the current lexical scope -because it is private. -@end table - -DECL_ACCESS is used for access declarations; alter_access creates a list -of types and accesses for a given decl. - -Formerly, DECL_@{PUBLIC,PROTECTED,PRIVATE@} corresponded to the return -codes of compute_access and were used as a cache for compute_access. -Now they are not used at all. - -TREE_PROTECTED and TREE_PRIVATE are used to record the access levels -granted by the containing class. BEWARE: TREE_PUBLIC means something -completely unrelated to access control! - -@node Error Reporting, Parser, Access Control, Top -@section Error Reporting - -The C++ front-end uses a call-back mechanism to allow functions to print -out reasonable strings for types and functions without putting extra -logic in the functions where errors are found. The interface is through -the @code{cp_error} function (or @code{cp_warning}, etc.). The -syntax is exactly like that of @code{error}, except that a few more -conversions are supported: - -@itemize @bullet -@item -%C indicates a value of `enum tree_code'. -@item -%D indicates a *_DECL node. -@item -%E indicates a *_EXPR node. -@item -%L indicates a value of `enum languages'. -@item -%P indicates the name of a parameter (i.e. "this", "1", "2", ...) -@item -%T indicates a *_TYPE node. -@item -%O indicates the name of an operator (MODIFY_EXPR -> "operator ="). - -@end itemize - -There is some overlap between these; for instance, any of the node -options can be used for printing an identifier (though only @code{%D} -tries to decipher function names). - -For a more verbose message (@code{class foo} as opposed to just @code{foo}, -including the return type for functions), use @code{%#c}. -To have the line number on the error message indicate the line of the -DECL, use @code{cp_error_at} and its ilk; to indicate which argument you want, -use @code{%+D}, or it will default to the first. - -@node Parser, Exception Handling, Error Reporting, Top -@section Parser - -Some comments on the parser: - -The @code{after_type_declarator} / @code{notype_declarator} hack is -necessary in order to allow redeclarations of @code{TYPENAME}s, for -instance - -@example -typedef int foo; -class A @{ - char *foo; -@}; -@end example - -In the above, the first @code{foo} is parsed as a @code{notype_declarator}, -and the second as a @code{after_type_declarator}. - -Ambiguities: - -There are currently four reduce/reduce ambiguities in the parser. They are: - -1) Between @code{template_parm} and -@code{named_class_head_sans_basetype}, for the tokens @code{aggr -identifier}. This situation occurs in code looking like - -@example -template class A @{ @}; -@end example - -It is ambiguous whether @code{class T} should be parsed as the -declaration of a template type parameter named @code{T} or an unnamed -constant parameter of type @code{class T}. Section 14.6, paragraph 3 of -the January '94 working paper states that the first interpretation is -the correct one. This ambiguity results in two reduce/reduce conflicts. - -2) Between @code{primary} and @code{type_id} for code like @samp{int()} -in places where both can be accepted, such as the argument to -@code{sizeof}. Section 8.1 of the pre-San Diego working paper specifies -that these ambiguous constructs will be interpreted as @code{typename}s. -This ambiguity results in six reduce/reduce conflicts between -@samp{absdcl} and @samp{functional_cast}. - -3) Between @code{functional_cast} and -@code{complex_direct_notype_declarator}, for various token strings. -This situation occurs in code looking like - -@example -int (*a); -@end example - -This code is ambiguous; it could be a declaration of the variable -@samp{a} as a pointer to @samp{int}, or it could be a functional cast of -@samp{*a} to @samp{int}. Section 6.8 specifies that the former -interpretation is correct. This ambiguity results in 7 reduce/reduce -conflicts. Another aspect of this ambiguity is code like 'int (x[2]);', -which is resolved at the '[' and accounts for 6 reduce/reduce conflicts -between @samp{direct_notype_declarator} and -@samp{primary}/@samp{overqualified_id}. Finally, there are 4 r/r -conflicts between @samp{expr_or_declarator} and @samp{primary} over code -like 'int (a);', which could probably be resolved but would also -probably be more trouble than it's worth. In all, this situation -accounts for 17 conflicts. Ack! - -The second case above is responsible for the failure to parse 'LinppFile -ppfile (String (argv[1]), &outs, argc, argv);' (from Rogue Wave -Math.h++) as an object declaration, and must be fixed so that it does -not resolve until later. - -4) Indirectly between @code{after_type_declarator} and @code{parm}, for -type names. This occurs in (as one example) code like - -@example -typedef int foo, bar; -class A @{ - foo (bar); -@}; -@end example - -What is @code{bar} inside the class definition? We currently interpret -it as a @code{parm}, as does Cfront, but IBM xlC interprets it as an -@code{after_type_declarator}. I believe that xlC is correct, in light -of 7.1p2, which says "The longest sequence of @i{decl-specifiers} that -could possibly be a type name is taken as the @i{decl-specifier-seq} of -a @i{declaration}." However, it seems clear that this rule must be -violated in the case of constructors. This ambiguity accounts for 8 -conflicts. - -Unlike the others, this ambiguity is not recognized by the Working Paper. - -@node Exception Handling, Free Store, Parser, Top -@section Exception Handling - -Note, exception handling in g++ is still under development. - -This section describes the mapping of C++ exceptions in the C++ -front-end, into the back-end exception handling framework. - -The basic mechanism of exception handling in the back-end is -unwind-protect a la elisp. This is a general, robust, and language -independent representation for exceptions. - -The C++ front-end exceptions are mapping into the unwind-protect -semantics by the C++ front-end. The mapping is describe below. - -When -frtti is used, rtti is used to do exception object type checking, -when it isn't used, the encoded name for the type of the object being -thrown is used instead. All code that originates exceptions, even code -that throws exceptions as a side effect, like dynamic casting, and all -code that catches exceptions must be compiled with either -frtti, or --fno-rtti. It is not possible to mix rtti base exception handling -objects with code that doesn't use rtti. The exceptions to this, are -code that doesn't catch or throw exceptions, catch (...), and code that -just rethrows an exception. - -Currently we use the normal mangling used in building functions names -(int's are "i", const char * is PCc) to build the non-rtti base type -descriptors for exception handling. These descriptors are just plain -NULL terminated strings, and internally they are passed around as char -*. - -In C++, all cleanups should be protected by exception regions. The -region starts just after the reason why the cleanup is created has -ended. For example, with an automatic variable, that has a constructor, -it would be right after the constructor is run. The region ends just -before the finalization is expanded. Since the backend may expand the -cleanup multiple times along different paths, once for normal end of the -region, once for non-local gotos, once for returns, etc, the backend -must take special care to protect the finalization expansion, if the -expansion is for any other reason than normal region end, and it is -`inline' (it is inside the exception region). The backend can either -choose to move them out of line, or it can created an exception region -over the finalization to protect it, and in the handler associated with -it, it would not run the finalization as it otherwise would have, but -rather just rethrow to the outer handler, careful to skip the normal -handler for the original region. - -In Ada, they will use the more runtime intensive approach of having -fewer regions, but at the cost of additional work at run time, to keep a -list of things that need cleanups. When a variable has finished -construction, they add the cleanup to the list, when the come to the end -of the lifetime of the variable, the run the list down. If the take a -hit before the section finishes normally, they examine the list for -actions to perform. I hope they add this logic into the back-end, as it -would be nice to get that alternative approach in C++. - -On an rs6000, xlC stores exception objects on that stack, under the try -block. When is unwinds down into a handler, the frame pointer is -adjusted back to the normal value for the frame in which the handler -resides, and the stack pointer is left unchanged from the time at which -the object was thrown. This is so that there is always someplace for -the exception object, and nothing can overwrite it, once we start -throwing. The only bad part, is that the stack remains large. - -The below points out some things that work in g++'s exception handling. - -All completely constructed temps and local variables are cleaned up in -all unwinded scopes. Completely constructed parts of partially -constructed objects are cleaned up. This includes partially built -arrays. Exception specifications are now handled. Thrown objects are -now cleaned up all the time. We can now tell if we have an active -exception being thrown or not (__eh_type != 0). We use this to call -terminate if someone does a throw; without there being an active -exception object. uncaught_exception () works. Exception handling -should work right if you optimize. Exception handling should work with --fpic or -fPIC. - -The below points out some flaws in g++'s exception handling, as it now -stands. - -Only exact type matching or reference matching of throw types works when --fno-rtti is used. Only works on a SPARC (like Suns) (both -mflat and --mno-flat models work), SPARClite, Hitachi SH, i386, arm, rs6000, -PowerPC, Alpha, mips, VAX, m68k and z8k machines. SPARC v9 may not -work. HPPA is mostly done, but throwing between a shared library and -user code doesn't yet work. Some targets have support for data-driven -unwinding. Partial support is in for all other machines, but a stack -unwinder called __unwind_function has to be written, and added to -libgcc2 for them. The new EH code doesn't rely upon the -__unwind_function for C++ code, instead it creates per function -unwinders right inside the function, unfortunately, on many platforms -the definition of RETURN_ADDR_RTX in the tm.h file for the machine port -is wrong. See below for details on __unwind_function. RTL_EXPRs for EH -cond variables for && and || exprs should probably be wrapped in -UNSAVE_EXPRs, and RTL_EXPRs tweaked so that they can be unsaved. - -We only do pointer conversions on exception matching a la 15.3 p2 case -3: `A handler with type T, const T, T&, or const T& is a match for a -throw-expression with an object of type E if [3]T is a pointer type and -E is a pointer type that can be converted to T by a standard pointer -conversion (_conv.ptr_) not involving conversions to pointers to private -or protected base classes.' when -frtti is given. - -We don't call delete on new expressions that die because the ctor threw -an exception. See except/18 for a test case. - -15.2 para 13: The exception being handled should be rethrown if control -reaches the end of a handler of the function-try-block of a constructor -or destructor, right now, it is not. - -15.2 para 12: If a return statement appears in a handler of -function-try-block of a constructor, the program is ill-formed, but this -isn't diagnosed. - -15.2 para 11: If the handlers of a function-try-block contain a jump -into the body of a constructor or destructor, the program is ill-formed, -but this isn't diagnosed. - -15.2 para 9: Check that the fully constructed base classes and members -of an object are destroyed before entering the handler of a -function-try-block of a constructor or destructor for that object. - -build_exception_variant should sort the incoming list, so that it -implements set compares, not exact list equality. Type smashing should -smash exception specifications using set union. - -Thrown objects are usually allocated on the heap, in the usual way. If -one runs out of heap space, throwing an object will probably never work. -This could be relaxed some by passing an __in_chrg parameter to track -who has control over the exception object. Thrown objects are not -allocated on the heap when they are pointer to object types. We should -extend it so that all small (<4*sizeof(void*)) objects are stored -directly, instead of allocated on the heap. - -When the backend returns a value, it can create new exception regions -that need protecting. The new region should rethrow the object in -context of the last associated cleanup that ran to completion. - -The structure of the code that is generated for C++ exception handling -code is shown below: - -@example -Ln: throw value; - copy value onto heap - jump throw (Ln, id, address of copy of value on heap) - - try @{ -+Lstart: the start of the main EH region -|... ... -+Lend: the end of the main EH region - @} catch (T o) @{ - ...1 - @} -Lresume: - nop used to make sure there is something before - the next region ends, if there is one -... ... - - jump Ldone -[ -Lmainhandler: handler for the region Lstart-Lend - cleanup -] zero or more, depending upon automatic vars with dtors -+Lpartial: -| jump Lover -+Lhere: - rethrow (Lhere, same id, same obj); -Lterm: handler for the region Lpartial-Lhere - call terminate -Lover: -[ - [ - call throw_type_match - if (eq) @{ - ] these lines disappear when there is no catch condition -+Lsregion2: -| ...1 -| jump Lresume -|Lhandler: handler for the region Lsregion2-Leregion2 -| rethrow (Lresume, same id, same obj); -+Leregion2 - @} -] there are zero or more of these sections, depending upon how many - catch clauses there are ------------------------------ expand_end_all_catch -------------------------- - here we have fallen off the end of all catch - clauses, so we rethrow to outer - rethrow (Lresume, same id, same obj); ------------------------------ expand_end_all_catch -------------------------- -[ -L1: maybe throw routine -] depending upon if we have expanded it or not -Ldone: - ret - -start_all_catch emits labels: Lresume, - -@end example - -The __unwind_function takes a pointer to the throw handler, and is -expected to pop the stack frame that was built to call it, as well as -the frame underneath and then jump to the throw handler. It must -restore all registers to their proper values as well as all other -machine state as determined by the context in which we are unwinding -into. The way I normally start is to compile: - - void *g; - foo(void* a) @{ g = a; @} - -with -S, and change the thing that alters the PC (return, or ret -usually) to not alter the PC, making sure to leave all other semantics -(like adjusting the stack pointer, or frame pointers) in. After that, -replicate the prologue once more at the end, again, changing the PC -altering instructions, and finally, at the very end, jump to `g'. - -It takes about a week to write this routine, if someone wants to -volunteer to write this routine for any architecture, exception support -for that architecture will be added to g++. Please send in those code -donations. One other thing that needs to be done, is to double check -that __builtin_return_address (0) works. - -@subsection Specific Targets - -For the alpha, the __unwind_function will be something resembling: - -@example -void -__unwind_function(void *ptr) -@{ - /* First frame */ - asm ("ldq $15, 8($30)"); /* get the saved frame ptr; 15 is fp, 30 is sp */ - asm ("bis $15, $15, $30"); /* reload sp with the fp we found */ - - /* Second frame */ - asm ("ldq $15, 8($30)"); /* fp */ - asm ("bis $15, $15, $30"); /* reload sp with the fp we found */ - - /* Return */ - asm ("ret $31, ($16), 1"); /* return to PTR, stored in a0 */ -@} -@end example - -@noindent -However, there are a few problems preventing it from working. First of -all, the gcc-internal function @code{__builtin_return_address} needs to -work given an argument of 0 for the alpha. As it stands as of August -30th, 1995, the code for @code{BUILT_IN_RETURN_ADDRESS} in @file{expr.c} -will definitely not work on the alpha. Instead, we need to define -the macros @code{DYNAMIC_CHAIN_ADDRESS} (maybe), -@code{RETURN_ADDR_IN_PREVIOUS_FRAME}, and definitely need a new -definition for @code{RETURN_ADDR_RTX}. - -In addition (and more importantly), we need a way to reliably find the -frame pointer on the alpha. The use of the value 8 above to restore the -frame pointer (register 15) is incorrect. On many systems, the frame -pointer is consistently offset to a specific point on the stack. On the -alpha, however, the frame pointer is pushed last. First the return -address is stored, then any other registers are saved (e.g., @code{s0}), -and finally the frame pointer is put in place. So @code{fp} could have -an offset of 8, but if the calling function saved any registers at all, -they add to the offset. - -The only places the frame size is noted are with the @samp{.frame} -directive, for use by the debugger and the OSF exception handling model -(useless to us), and in the initial computation of the new value for -@code{sp}, the stack pointer. For example, the function may start with: - -@example -lda $30,-32($30) -.frame $15,32,$26,0 -@end example - -@noindent -The 32 above is exactly the value we need. With this, we can be sure -that the frame pointer is stored 8 bytes less---in this case, at 24(sp)). -The drawback is that there is no way that I (Brendan) have found to let -us discover the size of a previous frame @emph{inside} the definition -of @code{__unwind_function}. - -So to accomplish exception handling support on the alpha, we need two -things: first, a way to figure out where the frame pointer was stored, -and second, a functional @code{__builtin_return_address} implementation -for except.c to be able to use it. - -Or just support DWARF 2 unwind info. - -@subsection New Backend Exception Support - -This subsection discusses various aspects of the design of the -data-driven model being implemented for the exception handling backend. - -The goal is to generate enough data during the compilation of user code, -such that we can dynamically unwind through functions at run time with a -single routine (@code{__throw}) that lives in libgcc.a, built by the -compiler, and dispatch into associated exception handlers. - -This information is generated by the DWARF 2 debugging backend, and -includes all of the information __throw needs to unwind an arbitrary -frame. It specifies where all of the saved registers and the return -address can be found at any point in the function. - -Major disadvantages when enabling exceptions are: - -@itemize @bullet -@item -Code that uses caller saved registers, can't, when flow can be -transferred into that code from an exception handler. In high performance -code this should not usually be true, so the effects should be minimal. - -@end itemize - -@subsection Backend Exception Support - -The backend must be extended to fully support exceptions. Right now -there are a few hooks into the alpha exception handling backend that -resides in the C++ frontend from that backend that allows exception -handling to work in g++. An exception region is a segment of generated -code that has a handler associated with it. The exception regions are -denoted in the generated code as address ranges denoted by a starting PC -value and an ending PC value of the region. Some of the limitations -with this scheme are: - -@itemize @bullet -@item -The backend replicates insns for such things as loop unrolling and -function inlining. Right now, there are no hooks into the frontend's -exception handling backend to handle the replication of insns. When -replication happens, a new exception region descriptor needs to be -generated for the new region. - -@item -The backend expects to be able to rearrange code, for things like jump -optimization. Any rearranging of the code needs have exception region -descriptors updated appropriately. - -@item -The backend can eliminate dead code. Any associated exception region -descriptor that refers to fully contained code that has been eliminated -should also be removed, although not doing this is harmless in terms of -semantics. - -@end itemize - -The above is not meant to be exhaustive, but does include all things I -have thought of so far. I am sure other limitations exist. - -Below are some notes on the migration of the exception handling code -backend from the C++ frontend to the backend. - -NOTEs are to be used to denote the start of an exception region, and the -end of the region. I presume that the interface used to generate these -notes in the backend would be two functions, start_exception_region and -end_exception_region (or something like that). The frontends are -required to call them in pairs. When marking the end of a region, an -argument can be passed to indicate the handler for the marked region. -This can be passed in many ways, currently a tree is used. Another -possibility would be insns for the handler, or a label that denotes a -handler. I have a feeling insns might be the best way to pass it. -Semantics are, if an exception is thrown inside the region, control is -transferred unconditionally to the handler. If control passes through -the handler, then the backend is to rethrow the exception, in the -context of the end of the original region. The handler is protected by -the conventional mechanisms; it is the frontend's responsibility to -protect the handler, if special semantics are required. - -This is a very low level view, and it would be nice is the backend -supported a somewhat higher level view in addition to this view. This -higher level could include source line number, name of the source file, -name of the language that threw the exception and possibly the name of -the exception. Kenner may want to rope you into doing more than just -the basics required by C++. You will have to resolve this. He may want -you to do support for non-local gotos, first scan for exception handler, -if none is found, allow the debugger to be entered, without any cleanups -being done. To do this, the backend would have to know the difference -between a cleanup-rethrower, and a real handler, if would also have to -have a way to know if a handler `matches' a thrown exception, and this -is frontend specific. - -The stack unwinder is one of the hardest parts to do. It is highly -machine dependent. The form that kenner seems to like was a couple of -macros, that would do the machine dependent grunt work. One preexisting -function that might be of some use is __builtin_return_address (). One -macro he seemed to want was __builtin_return_address, and the other -would do the hard work of fixing up the registers, adjusting the stack -pointer, frame pointer, arg pointer and so on. - - -@node Free Store, Mangling, Exception Handling, Top -@section Free Store - -@code{operator new []} adds a magic cookie to the beginning of arrays -for which the number of elements will be needed by @code{operator delete -[]}. These are arrays of objects with destructors and arrays of objects -that define @code{operator delete []} with the optional size_t argument. -This cookie can be examined from a program as follows: - -@example -typedef unsigned long size_t; -extern "C" int printf (const char *, ...); - -size_t nelts (void *p) -@{ - struct cookie @{ - size_t nelts __attribute__ ((aligned (sizeof (double)))); - @}; - - cookie *cp = (cookie *)p; - --cp; - - return cp->nelts; -@} - -struct A @{ - ~A() @{ @} -@}; - -main() -@{ - A *ap = new A[3]; - printf ("%ld\n", nelts (ap)); -@} -@end example - -@section Linkage -The linkage code in g++ is horribly twisted in order to meet two design goals: - -1) Avoid unnecessary emission of inlines and vtables. - -2) Support pedantic assemblers like the one in AIX. - -To meet the first goal, we defer emission of inlines and vtables until -the end of the translation unit, where we can decide whether or not they -are needed, and how to emit them if they are. - -@node Mangling, Vtables, Free Store, Top -@section Function name mangling for C++ and Java - -Both C++ and Jave provide overloaded function and methods, -which are methods with the same types but different parameter lists. -Selecting the correct version is done at compile time. -Though the overloaded functions have the same name in the source code, -they need to be translated into different assembler-level names, -since typical assemblers and linkers cannot handle overloading. -This process of encoding the parameter types with the method name -into a unique name is called @dfn{name mangling}. The inverse -process is called @dfn{demangling}. - -It is convenient that C++ and Java use compatible mangling schemes, -since the makes life easier for tools such as gdb, and it eases -integration between C++ and Java. - -Note there is also a standard "Jave Native Interface" (JNI) which -implements a different calling convention, and uses a different -mangling scheme. The JNI is a rather abstract ABI so Java can call methods -written in C or C++; -we are concerned here about a lower-level interface primarily -intended for methods written in Java, but that can also be used for C++ -(and less easily C). - -Note that on systems that follow BSD tradition, a C identifier @code{var} -would get "mangled" into the assembler name @samp{_var}. On such -systems, all other mangled names are also prefixed by a @samp{_} -which is not shown in the following examples. - -@subsection Method name mangling - -C++ mangles a method by emitting the function name, followed by @code{__}, -followed by encodings of any method qualifiers (such as @code{const}), -followed by the mangling of the method's class, -followed by the mangling of the parameters, in order. - -For example @code{Foo::bar(int, long) const} is mangled -as @samp{bar__C3Fooil}. - -For a constructor, the method name is left out. -That is @code{Foo::Foo(int, long) const} is mangled -as @samp{__C3Fooil}. - -GNU Java does the same. - -@subsection Primitive types - -The C++ types @code{int}, @code{long}, @code{short}, @code{char}, -and @code{long long} are mangled as @samp{i}, @samp{l}, -@samp{s}, @samp{c}, and @samp{x}, respectively. -The corresponding unsigned types have @samp{U} prefixed -to the mangling. The type @code{signed char} is mangled @samp{Sc}. - -The C++ and Java floating-point types @code{float} and @code{double} -are mangled as @samp{f} and @samp{d} respectively. - -The C++ @code{bool} type and the Java @code{boolean} type are -mangled as @samp{b}. - -The C++ @code{wchar_t} and the Java @code{char} types are -mangled as @samp{w}. - -The Java integral types @code{byte}, @code{short}, @code{int} -and @code{long} are mangled as @samp{c}, @samp{s}, @samp{i}, -and @samp{x}, respectively. - -C++ code that has included @code{javatypes.h} will mangle -the typedefs @code{jbyte}, @code{jshort}, @code{jint} -and @code{jlong} as respectively @samp{c}, @samp{s}, @samp{i}, -and @samp{x}. (This has not been implemented yet.) - -@subsection Mangling of simple names - -A simple class, package, template, or namespace name is -encoded as the number of characters in the name, followed by -the actual characters. Thus the class @code{Foo} -is encoded as @samp{3Foo}. - -If any of the characters in the name are not alphanumeric -(i.e not one of the standard ASCII letters, digits, or '_'), -or the initial character is a digit, then the name is -mangled as a sequence of encoded Unicode letters. -A Unicode encoding starts with a @samp{U} to indicate -that Unicode escapes are used, followed by the number of -bytes used by the Unicode encoding, followed by the bytes -representing the encoding. ASSCI letters and -non-initial digits are encoded without change. However, all -other characters (including underscore and initial digits) are -translated into a sequence starting with an underscore, -followed by the big-endian 4-hex-digit lower-case encoding of the character. - -If a method name contains Unicode-escaped characters, the -entire mangled method name is followed by a @samp{U}. - -For example, the method @code{X\u0319::M\u002B(int)} is encoded as -@samp{M_002b__U6X_0319iU}. - - -@subsection Pointer and reference types - -A C++ pointer type is mangled as @samp{P} followed by the -mangling of the type pointed to. - -A C++ reference type as mangled as @samp{R} followed by the -mangling of the type referenced. - -A Java object reference type is equivalent -to a C++ pointer parameter, so we mangle such an parameter type -as @samp{P} followed by the mangling of the class name. - -@subsection Squangled type compression - -Squangling (enabled with the @samp{-fsquangle} option), utilizes the -@samp{B} code to indicate reuse of a previously seen type within an -indentifier. Types are recognized in a left to right manner and given -increasing values, which are appended to the code in the standard -manner. Ie, multiple digit numbers are delimited by @samp{_} -characters. A type is considered to be any non primitive type, -regardless of whether its a parameter, template parameter, or entire -template. Certain codes are considered modifiers of a type, and are not -included as part of the type. These are the @samp{C}, @samp{V}, -@samp{P}, @samp{A}, @samp{R}, @samp{U} and @samp{u} codes, denoting -constant, volatile, pointer, array, reference, unsigned, and restrict. -These codes may precede a @samp{B} type in order to make the required -modifications to the type. - -For example: -@example -template class class1 @{ @}; - -template class class2 @{ @}; - -class class3 @{ @}; - -int f(class2 > a ,int b, const class1&c, class3 *d) @{ @} - - B0 -> class2 - B1 -> class1 - B2 -> class3 -@end example -Produces the mangled name @samp{f__FGt6class21Zt6class11Z6class3iRCB1PB2}. -The int parameter is a basic type, and does not receive a B encoding... - -@subsection Qualified names - -Both C++ and Java allow a class to be lexically nested inside another -class. C++ also supports namespaces (not yet implemented by G++). -Java also supports packages. - -These are all mangled the same way: First the letter @samp{Q} -indicates that we are emitting a qualified name. -That is followed by the number of parts in the qualified name. -If that number is 9 or less, it is emitted with no delimiters. -Otherwise, an underscore is written before and after the count. -Then follows each part of the qualified name, as described above. - -For example @code{Foo::\u0319::Bar} is encoded as -@samp{Q33FooU5_03193Bar}. - -Squangling utilizes the the letter @samp{K} to indicate a -remembered portion of a qualified name. As qualified names are processed -for an identifier, the names are numbered and remembered in a -manner similar to the @samp{B} type compression code. -Names are recognized left to right, and given increasing values, which are -appended to the code in the standard manner. ie, multiple digit numbers -are delimited by @samp{_} characters. - -For example -@example -class Andrew -@{ - class WasHere - @{ - class AndHereToo - @{ - @}; - @}; -@}; - -f(Andrew&r1, Andrew::WasHere& r2, Andrew::WasHere::AndHereToo& r3) @{ @} - - K0 -> Andrew - K1 -> Andrew::WasHere - K2 -> Andrew::WasHere::AndHereToo -@end example -Function @samp{f()} would be mangled as : -@samp{f__FR6AndrewRQ2K07WasHereRQ2K110AndHereToo} - -There are some occasions when either a @samp{B} or @samp{K} code could -be chosen, preference is always given to the @samp{B} code. Ie, the example -in the section on @samp{B} mangling could have used a @samp{K} code -instead of @samp{B2}. - -@subsection Templates - -A class template instantiation is encoded as the letter @samp{t}, -followed by the encoding of the template name, followed -the number of template parameters, followed by encoding of the template -parameters. If a template parameter is a type, it is written -as a @samp{Z} followed by the encoding of the type. - -A function template specialization (either an instantiation or an -explicit specialization) is encoded by an @samp{H} followed by the -encoding of the template parameters, as described above, followed by an -@samp{_}, the encoding of the argument types to the template function -(not the specialization), another @samp{_}, and the return type. (Like -the argument types, the return type is the return type of the function -template, not the specialization.) Template parameters in the argument -and return types are encoded by an @samp{X} for type parameters, or a -@samp{Y} for constant parameters, an index indicating their position -in the template parameter list declaration, and their template depth. - -@subsection Arrays - -C++ array types are mangled by emitting @samp{A}, followed by -the length of the array, followed by an @samp{_}, followed by -the mangling of the element type. Of course, normally -array parameter types decay into a pointer types, so you -don't see this. - -Java arrays are objects. A Java type @code{T[]} is mangled -as if it were the C++ type @code{JArray}. -For example @code{java.lang.String[]} is encoded as -@samp{Pt6JArray1ZPQ34java4lang6String}. - -@subsection Static fields - -Both C++ and Java classes can have static fields. -These are allocated statically, and are shared among all instances. - -The mangling starts with a prefix (@samp{_} in most systems), which is -followed by the mangling -of the class name, followed by the "joiner" and finally the field name. -The joiner (see @code{JOINER} in @code{cp-tree.h}) is a special -separator character. For historical reasons (and idiosyncracies -of assembler syntax) it can @samp{$} or @samp{.} (or even -@samp{_} on a few systems). If the joiner is @samp{_} then the prefix -is @samp{__static_} instead of just @samp{_}. - -For example @code{Foo::Bar::var} (or @code{Foo.Bar.var} in Java syntax) -would be encoded as @samp{_Q23Foo3Bar$var} or @samp{_Q23Foo3Bar.var} -(or rarely @samp{__static_Q23Foo3Bar_var}). - -If the name of a static variable needs Unicode escapes, -the Unicode indicator @samp{U} comes before the "joiner". -This @code{\u1234Foo::var\u3445} becomes @code{_U8_1234FooU.var_3445}. - -@subsection Table of demangling code characters - -The following special characters are used in mangling: - -@table @samp -@item A -Indicates a C++ array type. - -@item b -Encodes the C++ @code{bool} type, -and the Java @code{boolean} type. - -@item B -Used for squangling. Similar in concept to the 'T' non-squangled code. - -@item c -Encodes the C++ @code{char} type, and the Java @code{byte} type. - -@item C -A modifier to indicate a @code{const} type. -Also used to indicate a @code{const} member function -(in which cases it precedes the encoding of the method's class). - -@item d -Encodes the C++ and Java @code{double} types. - -@item e -Indicates extra unknown arguments @code{...}. - -@item E -Indicates the opening parenthesis of an expression. - -@item f -Encodes the C++ and Java @code{float} types. - -@item F -Used to indicate a function type. - -@item H -Used to indicate a template function. - -@item i -Encodes the C++ and Java @code{int} types. - -@item I -Encodes typedef names of the form @code{int@var{n}_t}, where @var{n} is a -positive decimal number. The @samp{I} is followed by either two -hexidecimal digits, which encode the value of @var{n}, or by an -arbitrary number of hexidecimal digits between underscores. For -example, @samp{I40} encodes the type @code{int64_t}, and @samp{I_200_} -encodes the type @code{int512_t}. - -@item J -Indicates a complex type. - -@item K -Used by squangling to compress qualified names. - -@item l -Encodes the C++ @code{long} type. - -@item n -Immediate repeated type. Followed by the repeat count. - -@item N -Repeated type. Followed by the repeat count of the repeated type, -followed by the type index of the repeated type. Due to a bug in -g++ 2.7.2, this is only generated if index is 0. Superceded by -@samp{n} when squangling. - -@item P -Indicates a pointer type. Followed by the type pointed to. - -@item Q -Used to mangle qualified names, which arise from nested classes. -Also used for namespaces. -In Java used to mangle package-qualified names, and inner classes. - -@item r -Encodes the GNU C++ @code{long double} type. - -@item R -Indicates a reference type. Followed by the referenced type. - -@item s -Encodes the C++ and java @code{short} types. - -@item S -A modifier that indicates that the following integer type is signed. -Only used with @code{char}. - -Also used as a modifier to indicate a static member function. - -@item t -Indicates a template instantiation. - -@item T -A back reference to a previously seen type. - -@item U -A modifier that indicates that the following integer type is unsigned. -Also used to indicate that the following class or namespace name -is encoded using Unicode-mangling. - -@item u -The @code{restrict} type qualifier. - -@item v -Encodes the C++ and Java @code{void} types. - -@item V -A modifier for a @code{volatile} type or method. - -@item w -Encodes the C++ @code{wchar_t} type, and the Java @code{char} types. - -@item W -Indicates the closing parenthesis of an expression. - -@item x -Encodes the GNU C++ @code{long long} type, and the Java @code{long} type. - -@item X -Encodes a template type parameter, when part of a function type. - -@item Y -Encodes a template constant parameter, when part of a function type. - -@item Z -Used for template type parameters. - -@end table - -The letters @samp{G}, @samp{M}, @samp{O}, and @samp{p} -also seem to be used for obscure purposes ... - -@node Vtables, Concept Index, Mangling, Top -@section Virtual Tables - -In order to invoke virtual functions, GNU C++ uses virtual tables. Each -virtual function gets an index, and the table entry points to the -overridden function to call. Sometimes, and adjustment to the this -pointer has to be made before calling a virtual function: - -@example -struct A@{ - int i; - virtual void foo(); -@}; - -struct B@{ - int j; - virtual void bar(); -@}; - -struct C:A,B@{ - virtual void bar(); -@}; - -void C::bar() -@{ - i++; -@} - -int main() -@{ - C *c = new C; - B *b = c; - c->bar(); -@} -@end example - -Here, casting from @samp{c} to @samp{b} adds an offset. When @samp{bar} -is called, this offset needs to be subtracted, so that @samp{C::bar} can -properly access @samp{i}. One approach of achieving this is to use -@emph{thunks}, which are small half-functions put into the virtual -table. The modify the first argument (the @samp{this} pointer), and then -jump into the real function. - -The other (traditional) approach is to have an additional integer in the -virtual table which is added to this. This is an additional overhead -both at the function call, and in the size of virtual tables: In the -case of single inheritance (or for the first base class), these integers -will always be zero. - -@subsection Virtual Base Classes with Virtual Tables - -In case of virtual bases, the code is even more -complicated. Constructors and destructors need to know whether they are -"in charge" of the virtual bases, and an implicit integer -@samp{__in_chrg} for that purpose. - -@example -struct A@{ - int i; - virtual void bar(); - void call_bar()@{bar();@} -@}; - -struct B:virtual A@{ - B(); - int j; - virtual void bar(); -@}; - -B::B()@{ - call_bar(); -@} - -struct C@{ - int k; -@}; - -struct D:C,B@{ - int l; - virtual void bar(); -@}; - -@end example - -When constructing an instance of B, it will have the following layout: -@samp{vbase pointer to A}, @samp{j}, @samp{A virtual table}, @samp{i}. -On a 32-bit machine, downcasting from @samp{A*} to @samp{B*} would need -to subtract 8, which would be the thunk executed when calling -@samp{B::bar} inside @samp{call_bar}. - -When constructing an instance of D, it will have a different layout: -@samp{k}, @samp{vbase pointer to A}, @samp{j}, @samp{l}, @samp{A virtual -table}, @samp{i}. So, when downcasting from @samp{A*} to @samp{B*} in a -@samp{D} object, the offset would be @samp{12}. - -This means that during construction of the @samp{B} base of a @samp{D} -object, a virtual table is needed which has a @samp{-12} thunk to -@samp{B::bar}. This is @emph{only} needed during construction and -destruction, as the full object will use a @samp{-16} thunk to -@samp{D::bar}. - -In order to implement this, the compiler generates an implicit argument -(in addition to @code{__in_chrg}): the virtual list argument -@code{__vlist}. This is a list of virtual tables needed during -construction and destruction. The virtual pointers are ordered in the -way they are used during construction; the destructors will process the -array in reverse order. The ordering is as follows: -@itemize @bullet -@item -If the class is in charge, the vlist starts with virtual table pointers -for the virtual bases that have virtual bases themselves. Here, only -@emph{polymorphic} virtual bases (pvbases) are interesting: if a vbase -has no virtual functions, it doesn't have a virtual table. - -@item -Next, the vlist has virtual tables for the initialization of the -non-virtual bases. These bases are not in charge, so the layout is -recursive, but ignores virtual bases during recursion. - -@item -Next, there is a number of virtual tables for each virtual base. These -are sorted in the order in which virtual bases are constructed. Each -virtual base may have more than one @code{vfield}, and therefore require -more than one @code{vtable}. The order of vtables is the same as used -when initializing vfields of non-virtual bases in a constructor. -@end itemize - -The compiler emits a virtual table list in a variable mangled as -@code{__vl.classname}. - -Class with virtual bases, but without pvbases, only have the -@code{__in_chrg} argument to their ctors and dtors: they don't have any -vfields in the vbases to initialize. - -A further problem arises with virtual destructors: A destructor -typically has only the @code{__in_chrg} argument, which also indicates -whether the destructor should call @code{operator delete}. A dtor of a -class with pvbases has an additional argument. Unfortunately, a caller -of a virtual dtor might not know whether to pass that argument or not. -Therefore, the dtor processes the @code{__vlist} argument in an -automatic variable, which is initialized from the class' vlist if the -__in_chrg flag has a zero value in bit 2 (bit mask 4), or from the -argument @code{__vlist1} if bit 2 of the __in_chrg parameter is set to -one. - -@subsection Specification of non-thunked vtables - -In the traditional implementation of vtables, each slot contains three -fields: The offset to be added to the this pointer before invoking a -virtual function, an unused field that is always zero, and the pointer -to the virtual function. The first two fields are typically 16 bits -wide. The unused field is called `index'; it may be non-zero in -pointer-to-member-functions, which use the same layout. - -The virtual table then is an array of vtable slots. The first slot is -always the virtual type info function, the other slots are in the order -in which the virtual functions appear in the class declaration. - -If a class has base classes, it may inherit other bases' vfields. Each -class may have a primary vfield; the primary vfield of the derived class -is the primary vfield of the left-most non-virtual base class. If a -class inherits a primary vfield, any new virtual functions in the -derived class are appended to the virtual table of the primary -vfield. If there are new virtual functions in the derived class, and no -primary vfield is inherited, a new vfield is introduced which becomes -primary. The redefined virtual functions fill the vtable slots inherited -from the base; new virtual functions are put into the primary vtable in -the order of declaration. If no new virtual functions are introduced, no -primary vfield is allocated. - -In a base class that has pvbases, virtual tables are needed which are -used only in the constructor (see example above). At run-time, the -virtual tables of the base class are adjusted, to reflect the new offset -of the pvbase. The compiler knows statically what offset the pvbase has -for a complete object. At run-time, the offset of the pvbase can be -extracted from the vbase pointer, which is set in the constructor of the -complete object. These two offsets result in a delta, which is used to -adjust the deltas in the vtable (the adjustment might be different for -different vtable slots). To adjust the vtables, the compiler emits code -that creates a vtable on the stack. This vtable is initialized with the -vtable for the complete base type, and then adjusted. - -In order to call a virtual function, the compiler gets the offset field -from the vtable entry, and adds it to the this pointer. It then -indirectly calls the virtual function pointer, passing the adjusted this -pointer, and any arguments the virtual function may have. - -To implement dynamic casting, the dynamic_cast function needs typeinfos -for the complete type, and the pointer to the complete type. The -typeinfo pointer is obtained by calling the virtual typeinfo function -(which doesn't take a this parameter). The pointer to the complete -object is obtained by adding the offset of the virtual typeinfo vtable -slot, since this virtual function is always implemented in the complete -object. - -@subsection Specification of thunked vtables - -For vtable thunks, each slot only consists of a pointer to the virtual -function, which might be a thunk function. The first slot in the vtable -is an offset of the this pointer to the complete object, which is needed -as a parameter to __dynamic_cast. The second slot is the virtual -typeinfo function. All other slots are allocated with the same procedure -as in the non-thunked case. Allocation of vfields also uses the same -procedure as described above. - -If the virtual function needs an adjusted this pointer, a thunk function -is emitted. If supported by the target architecture, this is only a -half-function. Such a thunk has no stack frame; it merely adjusts the -first argument of the function, and then directly branches into the -implementation of the virtual function. If the architecture does not -support half-functions (i.e. if ASM_OUTPUT_MI_THUNK is not defined), the -compiler emits a wrapper function, which copies all arguments, adjust -the this pointer, and then calls the original function. Since objects of -non-aggregate type are passed by invisible reference, this copies only -POD arguments. The approach fails for virtual functions with a variable -number of arguments. - -In order to support the vtables needed in base constructors with -pvbases, the compiler passes an implicit __vlist argument as described -above, if the version 2 thunks are used. For version 1 thunks, the base -class constructor will fill in the vtables for the complete base class, -which will incorrectly adjust the this pointer, leading to a dynamic -error. - -@node Concept Index, , Vtables, Top - -@section Concept Index - -@printindex cp - -@bye diff --git a/contrib/gcc/cp/inc/exception b/contrib/gcc/cp/inc/exception deleted file mode 100644 index 32efb9f82cae..000000000000 --- a/contrib/gcc/cp/inc/exception +++ /dev/null @@ -1,39 +0,0 @@ -// Exception Handling support header for -*- C++ -*- -// Copyright (C) 1995, 96-97, 1998 Free Software Foundation - -#ifndef __EXCEPTION__ -#define __EXCEPTION__ - -#pragma interface "exception" - -extern "C++" { - -namespace std { - -class exception { -public: - exception () { } - virtual ~exception () { } - virtual const char* what () const; -}; - -class bad_exception : public exception { -public: - bad_exception () { } - virtual ~bad_exception () { } -}; - -typedef void (*terminate_handler) (); -typedef void (*unexpected_handler) (); - -terminate_handler set_terminate (terminate_handler); -void terminate () __attribute__ ((__noreturn__)); -unexpected_handler set_unexpected (unexpected_handler); -void unexpected () __attribute__ ((__noreturn__)); -bool uncaught_exception (); - -} // namespace std - -} // extern "C++" - -#endif diff --git a/contrib/gcc/cp/inc/new b/contrib/gcc/cp/inc/new deleted file mode 100644 index b66673dc3a6b..000000000000 --- a/contrib/gcc/cp/inc/new +++ /dev/null @@ -1,42 +0,0 @@ -// The -*- C++ -*- dynamic memory management header. -// Copyright (C) 1994, 96-97, 1998 Free Software Foundation - -#ifndef __NEW__ -#define __NEW__ - -#pragma interface "new" -#include -#include - -extern "C++" { - -namespace std { - - class bad_alloc : public exception { - public: - virtual const char* what() const throw() { return "bad_alloc"; } - }; - - struct nothrow_t {}; - extern const nothrow_t nothrow; - typedef void (*new_handler)(); - new_handler set_new_handler (new_handler); - -} // namespace std - -// replaceable signatures -void *operator new (size_t) throw (std::bad_alloc); -void *operator new[] (size_t) throw (std::bad_alloc); -void operator delete (void *) throw(); -void operator delete[] (void *) throw(); -void *operator new (size_t, const std::nothrow_t&) throw(); -void *operator new[] (size_t, const std::nothrow_t&) throw(); -void operator delete (void *, const std::nothrow_t&) throw(); -void operator delete[] (void *, const std::nothrow_t&) throw(); - -// default placement versions of operator new -inline void *operator new(size_t, void *place) throw() { return place; } -inline void *operator new[](size_t, void *place) throw() { return place; } -} // extern "C++" - -#endif diff --git a/contrib/gcc/cp/inc/new.h b/contrib/gcc/cp/inc/new.h deleted file mode 100644 index 006be7efb07f..000000000000 --- a/contrib/gcc/cp/inc/new.h +++ /dev/null @@ -1,11 +0,0 @@ -// -*- C++ -*- forwarding header. - -#ifndef __NEW_H__ -#define __NEW_H__ - -#include - -using std::new_handler; -using std::set_new_handler; - -#endif // __NEW_H__ diff --git a/contrib/gcc/cp/inc/typeinfo b/contrib/gcc/cp/inc/typeinfo deleted file mode 100644 index 934784968c54..000000000000 --- a/contrib/gcc/cp/inc/typeinfo +++ /dev/null @@ -1,58 +0,0 @@ -// RTTI support for -*- C++ -*- -// Copyright (C) 1994, 95-97, 1998 Free Software Foundation - -#ifndef __TYPEINFO__ -#define __TYPEINFO__ - -#pragma interface "typeinfo" - -#include - -extern "C++" { - -namespace std { - -class type_info { -private: - // assigning type_info is not supported. made private. - type_info& operator= (const type_info&); - type_info (const type_info&); - -protected: - explicit type_info (const char *n): _name (n) { } - - const char *_name; - -public: - // destructor - virtual ~type_info (); - - bool before (const type_info& arg) const; - const char* name () const - { return _name; } - bool operator== (const type_info& arg) const; - bool operator!= (const type_info& arg) const; -}; - -inline bool type_info:: -operator!= (const type_info& arg) const -{ - return !operator== (arg); -} - -class bad_cast : public exception { -public: - bad_cast() { } - virtual ~bad_cast() { } -}; - -class bad_typeid : public exception { - public: - bad_typeid () { } - virtual ~bad_typeid () { } -}; - -} // namespace std - -} // extern "C++" -#endif diff --git a/contrib/gcc/cp/init.c b/contrib/gcc/cp/init.c deleted file mode 100644 index aed1fde65519..000000000000 --- a/contrib/gcc/cp/init.c +++ /dev/null @@ -1,3499 +0,0 @@ -/* Handle initialization things in C++. - Copyright (C) 1987, 89, 92-98, 1999 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* High-level class interface. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "rtl.h" -#include "cp-tree.h" -#include "flags.h" -#include "output.h" -#include "except.h" -#include "expr.h" -#include "toplev.h" - -/* In C++, structures with well-defined constructors are initialized by - those constructors, unasked. CURRENT_BASE_INIT_LIST - holds a list of stmts for a BASE_INIT term in the grammar. - This list has one element for each base class which must be - initialized. The list elements are [basename, init], with - type basetype. This allows the possibly anachronistic form - (assuming d : a, b, c) "d (int a) : c(a+5), b (a-4), a (a+3)" - where each successive term can be handed down the constructor - line. Perhaps this was not intended. */ -tree current_base_init_list, current_member_init_list; - -static void expand_aggr_vbase_init_1 PROTO((tree, tree, tree, tree)); -static void construct_virtual_bases PROTO((tree, tree, tree, tree, tree)); -static void expand_aggr_init_1 PROTO((tree, tree, tree, tree, int)); -static void expand_default_init PROTO((tree, tree, tree, tree, int)); -static tree build_vec_delete_1 PROTO((tree, tree, tree, tree, tree, - int)); -static void perform_member_init PROTO((tree, tree, tree, int)); -static void sort_base_init PROTO((tree, tree *, tree *)); -static tree build_builtin_delete_call PROTO((tree)); -static int member_init_ok_or_else PROTO((tree, tree, const char *)); -static void expand_virtual_init PROTO((tree, tree)); -static tree sort_member_init PROTO((tree)); -static tree initializing_context PROTO((tree)); -static void expand_vec_init_try_block PROTO((tree)); -static void expand_vec_init_catch_clause PROTO((tree, tree, tree, tree)); -static tree build_java_class_ref PROTO((tree)); -static void expand_cleanup_for_base PROTO((tree, tree, tree)); -static int pvbasecount PROTO((tree, int)); - -/* Cache the identifier nodes for the magic field of a new cookie. */ -static tree nc_nelts_field_id; - -static tree minus_one; - -/* Set up local variable for this file. MUST BE CALLED AFTER - INIT_DECL_PROCESSING. */ - -static tree BI_header_type, BI_header_size; - -void init_init_processing () -{ - tree fields[1]; - - minus_one = build_int_2 (-1, -1); - - /* Define the structure that holds header information for - arrays allocated via operator new. */ - BI_header_type = make_lang_type (RECORD_TYPE); - nc_nelts_field_id = get_identifier ("nelts"); - fields[0] = build_lang_field_decl (FIELD_DECL, nc_nelts_field_id, sizetype); - finish_builtin_type (BI_header_type, "__new_cookie", fields, - 0, double_type_node); - BI_header_size = size_in_bytes (BI_header_type); -} - -/* Subroutine of emit_base_init. For BINFO, initialize all the - virtual function table pointers, except those that come from - virtual base classes. Initialize binfo's vtable pointer, if - INIT_SELF is true. CAN_ELIDE is true when we know that all virtual - function table pointers in all bases have been initialized already, - probably because their constructors have just be run. ADDR is the - pointer to the object whos vtables we are going to initialize. - - REAL_BINFO is usually the same as BINFO, except when addr is not of - pointer to the type of the real derived type that we want to - initialize for. This is the case when addr is a pointer to a sub - object of a complete object, and we only want to do part of the - complete object's initialization of vtable pointers. This is done - for all virtual table pointers in virtual base classes. REAL_BINFO - is used to find the BINFO_VTABLE that we initialize with. BINFO is - used for conversions of addr to subobjects. - - BINFO_TYPE (real_binfo) must be BINFO_TYPE (binfo). - - Relies upon binfo being inside TYPE_BINFO (TREE_TYPE (TREE_TYPE - (addr))). */ - -void -expand_direct_vtbls_init (real_binfo, binfo, init_self, can_elide, addr) - tree real_binfo, binfo, addr; - int init_self, can_elide; -{ - tree real_binfos = BINFO_BASETYPES (real_binfo); - tree binfos = BINFO_BASETYPES (binfo); - int i, n_baselinks = real_binfos ? TREE_VEC_LENGTH (real_binfos) : 0; - - for (i = 0; i < n_baselinks; i++) - { - tree real_base_binfo = TREE_VEC_ELT (real_binfos, i); - tree base_binfo = TREE_VEC_ELT (binfos, i); - int is_not_base_vtable - = i != CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (real_binfo)); - if (! TREE_VIA_VIRTUAL (real_base_binfo)) - expand_direct_vtbls_init (real_base_binfo, base_binfo, - is_not_base_vtable, can_elide, addr); - } -#if 0 - /* Before turning this on, make sure it is correct. */ - if (can_elide && ! BINFO_MODIFIED (binfo)) - return; -#endif - /* Should we use something besides CLASSTYPE_VFIELDS? */ - if (init_self && CLASSTYPE_VFIELDS (BINFO_TYPE (real_binfo))) - { - tree base_ptr = convert_pointer_to_real (binfo, addr); - expand_virtual_init (real_binfo, base_ptr); - } -} - -/* 348 - 351 */ -/* Subroutine of emit_base_init. */ - -static void -perform_member_init (member, name, init, explicit) - tree member, name, init; - int explicit; -{ - tree decl; - tree type = TREE_TYPE (member); - - expand_start_target_temps (); - - if (TYPE_NEEDS_CONSTRUCTING (type) - || (init && TYPE_HAS_CONSTRUCTOR (type))) - { - /* Since `init' is already a TREE_LIST on the current_member_init_list, - only build it into one if we aren't already a list. */ - if (init != NULL_TREE && TREE_CODE (init) != TREE_LIST) - init = build_expr_list (NULL_TREE, init); - - decl = build_component_ref (current_class_ref, name, NULL_TREE, explicit); - - if (explicit - && TREE_CODE (type) == ARRAY_TYPE - && init != NULL_TREE - && TREE_CHAIN (init) == NULL_TREE - && TREE_CODE (TREE_TYPE (TREE_VALUE (init))) == ARRAY_TYPE) - { - /* Initialization of one array from another. */ - expand_vec_init (TREE_OPERAND (decl, 1), decl, - array_type_nelts (type), TREE_VALUE (init), 1); - } - else - expand_aggr_init (decl, init, 0); - } - else - { - if (init == NULL_TREE) - { - if (explicit) - { - /* default-initialization. */ - if (AGGREGATE_TYPE_P (type)) - init = build (CONSTRUCTOR, type, NULL_TREE, NULL_TREE); - else if (TREE_CODE (type) == REFERENCE_TYPE) - { - cp_error ("default-initialization of `%#D', which has reference type", - member); - init = error_mark_node; - } - else - init = integer_zero_node; - } - /* member traversal: note it leaves init NULL */ - else if (TREE_CODE (TREE_TYPE (member)) == REFERENCE_TYPE) - cp_pedwarn ("uninitialized reference member `%D'", member); - } - else if (TREE_CODE (init) == TREE_LIST) - { - /* There was an explicit member initialization. Do some - work in that case. */ - if (TREE_CHAIN (init)) - { - warning ("initializer list treated as compound expression"); - init = build_compound_expr (init); - } - else - init = TREE_VALUE (init); - } - - /* We only build this with a null init if we got it from the - current_member_init_list. */ - if (init || explicit) - { - decl = build_component_ref (current_class_ref, name, NULL_TREE, - explicit); - expand_expr_stmt (build_modify_expr (decl, INIT_EXPR, init)); - } - } - - expand_end_target_temps (); - free_temp_slots (); - - if (TYPE_NEEDS_DESTRUCTOR (type)) - { - tree expr; - - /* All cleanups must be on the function_obstack. */ - push_obstacks_nochange (); - resume_temporary_allocation (); - - expr = build_component_ref (current_class_ref, name, NULL_TREE, - explicit); - expr = build_delete (type, expr, integer_zero_node, - LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0); - - if (expr != error_mark_node) - add_partial_entry (expr); - - pop_obstacks (); - } -} - -extern int warn_reorder; - -/* Subroutine of emit_member_init. */ - -static tree -sort_member_init (t) - tree t; -{ - tree x, member, name, field; - tree init_list = NULL_TREE; - int last_pos = 0; - tree last_field = NULL_TREE; - - for (member = TYPE_FIELDS (t); member ; member = TREE_CHAIN (member)) - { - int pos; - - /* member could be, for example, a CONST_DECL for an enumerated - tag; we don't want to try to initialize that, since it already - has a value. */ - if (TREE_CODE (member) != FIELD_DECL || !DECL_NAME (member)) - continue; - - for (x = current_member_init_list, pos = 0; x; x = TREE_CHAIN (x), ++pos) - { - /* If we cleared this out, then pay no attention to it. */ - if (TREE_PURPOSE (x) == NULL_TREE) - continue; - name = TREE_PURPOSE (x); - -#if 0 - /* This happens in templates, since the IDENTIFIER is replaced - with the COMPONENT_REF in tsubst_expr. */ - field = (TREE_CODE (name) == COMPONENT_REF - ? TREE_OPERAND (name, 1) : IDENTIFIER_CLASS_VALUE (name)); -#else - /* Let's find out when this happens. */ - my_friendly_assert (TREE_CODE (name) != COMPONENT_REF, 348); - field = IDENTIFIER_CLASS_VALUE (name); -#endif - - /* If one member shadows another, get the outermost one. */ - if (TREE_CODE (field) == TREE_LIST) - field = TREE_VALUE (field); - - if (field == member) - { - if (warn_reorder) - { - if (pos < last_pos) - { - cp_warning_at ("member initializers for `%#D'", last_field); - cp_warning_at (" and `%#D'", field); - warning (" will be re-ordered to match declaration order"); - } - last_pos = pos; - last_field = field; - } - - /* Make sure we won't try to work on this init again. */ - TREE_PURPOSE (x) = NULL_TREE; - x = build_tree_list (name, TREE_VALUE (x)); - goto got_it; - } - } - - /* If we didn't find MEMBER in the list, create a dummy entry - so the two lists (INIT_LIST and the list of members) will be - symmetrical. */ - x = build_tree_list (NULL_TREE, NULL_TREE); - got_it: - init_list = chainon (init_list, x); - } - - /* Initializers for base members go at the end. */ - for (x = current_member_init_list ; x ; x = TREE_CHAIN (x)) - { - name = TREE_PURPOSE (x); - if (name) - { - if (purpose_member (name, init_list)) - { - cp_error ("multiple initializations given for member `%D'", - IDENTIFIER_CLASS_VALUE (name)); - continue; - } - - init_list = chainon (init_list, - build_tree_list (name, TREE_VALUE (x))); - TREE_PURPOSE (x) = NULL_TREE; - } - } - - return init_list; -} - -static void -sort_base_init (t, rbase_ptr, vbase_ptr) - tree t, *rbase_ptr, *vbase_ptr; -{ - tree binfos = BINFO_BASETYPES (TYPE_BINFO (t)); - int n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0; - - int i; - tree x; - tree last; - - /* For warn_reorder. */ - int last_pos = 0; - tree last_base = NULL_TREE; - - tree rbases = NULL_TREE; - tree vbases = NULL_TREE; - - /* First walk through and splice out vbase and invalid initializers. - Also replace names with binfos. */ - - last = tree_cons (NULL_TREE, NULL_TREE, current_base_init_list); - for (x = TREE_CHAIN (last); x; x = TREE_CHAIN (x)) - { - tree basetype = TREE_PURPOSE (x); - tree binfo = NULL_TREE; - - if (basetype == NULL_TREE) - { - /* Initializer for single base class. Must not - use multiple inheritance or this is ambiguous. */ - switch (n_baseclasses) - { - case 0: - cp_error ("`%T' does not have a base class to initialize", - current_class_type); - return; - case 1: - break; - default: - cp_error ("unnamed initializer ambiguous for `%T' which uses multiple inheritance", - current_class_type); - return; - } - binfo = TREE_VEC_ELT (binfos, 0); - } - else if (is_aggr_type (basetype, 1)) - { - binfo = binfo_or_else (basetype, t); - if (binfo == NULL_TREE) - continue; - - /* Virtual base classes are special cases. Their initializers - are recorded with this constructor, and they are used when - this constructor is the top-level constructor called. */ - if (TREE_VIA_VIRTUAL (binfo)) - { - tree v = CLASSTYPE_VBASECLASSES (t); - while (BINFO_TYPE (v) != BINFO_TYPE (binfo)) - v = TREE_CHAIN (v); - - vbases = tree_cons (v, TREE_VALUE (x), vbases); - continue; - } - else - { - /* Otherwise, if it is not an immediate base class, complain. */ - for (i = n_baseclasses-1; i >= 0; i--) - if (BINFO_TYPE (binfo) == BINFO_TYPE (TREE_VEC_ELT (binfos, i))) - break; - if (i < 0) - { - cp_error ("`%T' is not an immediate base class of `%T'", - basetype, current_class_type); - continue; - } - } - } - else - my_friendly_abort (365); - - TREE_PURPOSE (x) = binfo; - TREE_CHAIN (last) = x; - last = x; - } - TREE_CHAIN (last) = NULL_TREE; - - /* Now walk through our regular bases and make sure they're initialized. */ - - for (i = 0; i < n_baseclasses; ++i) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - int pos; - - if (TREE_VIA_VIRTUAL (base_binfo)) - continue; - - for (x = current_base_init_list, pos = 0; x; x = TREE_CHAIN (x), ++pos) - { - tree binfo = TREE_PURPOSE (x); - - if (binfo == NULL_TREE) - continue; - - if (binfo == base_binfo) - { - if (warn_reorder) - { - if (pos < last_pos) - { - cp_warning_at ("base initializers for `%#T'", last_base); - cp_warning_at (" and `%#T'", BINFO_TYPE (binfo)); - warning (" will be re-ordered to match inheritance order"); - } - last_pos = pos; - last_base = BINFO_TYPE (binfo); - } - - /* Make sure we won't try to work on this init again. */ - TREE_PURPOSE (x) = NULL_TREE; - x = build_tree_list (binfo, TREE_VALUE (x)); - goto got_it; - } - } - - /* If we didn't find BASE_BINFO in the list, create a dummy entry - so the two lists (RBASES and the list of bases) will be - symmetrical. */ - x = build_tree_list (NULL_TREE, NULL_TREE); - got_it: - rbases = chainon (rbases, x); - } - - *rbase_ptr = rbases; - *vbase_ptr = vbases; -} - -/* Invoke a base-class destructor. REF is the object being destroyed, - BINFO is the base class, and DTOR_ARG indicates whether the base - class should invoke delete. */ - -tree -build_base_dtor_call (ref, binfo, dtor_arg) - tree ref, binfo, dtor_arg; -{ - tree args = NULL_TREE; - tree vlist = lookup_name (vlist_identifier, 0); - tree call, decr; - - if (TYPE_USES_PVBASES (BINFO_TYPE (binfo))) - { - args = expr_tree_cons (NULL_TREE, vlist, args); - dtor_arg = build (BIT_IOR_EXPR, integer_type_node, - dtor_arg, build_int_2 (4, 0)); - dtor_arg = fold (dtor_arg); - } - args = expr_tree_cons (NULL_TREE, dtor_arg, args); - call = build_scoped_method_call (ref, binfo, dtor_identifier, args); - - if (!TYPE_USES_PVBASES (BINFO_TYPE (binfo))) - /* For plain inheritance, do not try to adjust __vlist. */ - return call; - - /* Now decrement __vlist by the number of slots consumed by the base - dtor. */ - decr = build_int_2 (pvbasecount (BINFO_TYPE (binfo), 0), 0); - decr = build_binary_op (MINUS_EXPR, vlist, decr); - decr = build_modify_expr (vlist, NOP_EXPR, decr); - - return build (COMPOUND_EXPR, void_type_node, call, decr); -} - -/* Return the number of vlist entries needed to initialize TYPE, - depending on whether it is IN_CHARGE. */ - -static int -pvbasecount (type, in_charge) - tree type; - int in_charge; -{ - int i; - int result = 0; - tree vbase; - - for (vbase = (CLASSTYPE_VBASECLASSES (type)); vbase; - vbase = TREE_CHAIN (vbase)) - { - result += list_length (CLASSTYPE_VFIELDS (BINFO_TYPE (vbase))); - if (in_charge) - result += pvbasecount (BINFO_TYPE (vbase), 0); - } - - for (i=0; i < CLASSTYPE_N_BASECLASSES (type); i++) - { - tree base = TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), i); - if (TREE_VIA_VIRTUAL (base)) - continue; - result += pvbasecount (BINFO_TYPE (base), 0); - } - return result; -} - -void -init_vlist (t) - tree t; -{ - char *name; - tree expr; - tree vlist = lookup_name (vlist_identifier, 0); - - name = alloca (strlen (VLIST_NAME_FORMAT) - + TYPE_ASSEMBLER_NAME_LENGTH (t) + 2); - sprintf (name, VLIST_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (t)); - - expr = get_identifier (name); - expr = lookup_name (expr, 0); - expr = build1 (ADDR_EXPR, TREE_TYPE (vlist), expr); - if (DECL_DESTRUCTOR_FOR_PVBASE_P (current_function_decl)) - /* Move to the end of the vlist. */ - expr = build_binary_op (PLUS_EXPR, expr, - build_int_2 (pvbasecount (t, 1), 0)); - expand_expr_stmt (build_modify_expr (vlist, NOP_EXPR, expr)); -} - -/* Perform whatever initializations have yet to be done on the base - class of the class variable. These actions are in the global - variable CURRENT_BASE_INIT_LIST. Such an action could be - NULL_TREE, meaning that the user has explicitly called the base - class constructor with no arguments. - - If there is a need for a call to a constructor, we must surround - that call with a pushlevel/poplevel pair, since we are technically - at the PARM level of scope. - - Argument IMMEDIATELY, if zero, forces a new sequence to be - generated to contain these new insns, so it can be emitted later. - This sequence is saved in the global variable BASE_INIT_EXPR. - Otherwise, the insns are emitted into the current sequence. - - Note that emit_base_init does *not* initialize virtual base - classes. That is done specially, elsewhere. */ - -extern tree base_init_expr, rtl_expr_chain; - -void -emit_base_init (t, immediately) - tree t; - int immediately; -{ - tree member; - tree mem_init_list; - tree rbase_init_list, vbase_init_list; - tree t_binfo = TYPE_BINFO (t); - tree binfos = BINFO_BASETYPES (t_binfo); - int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0; - tree expr = NULL_TREE; - tree vlist = lookup_name (vlist_identifier, 0); - - if (! immediately) - { - int momentary; - do_pending_stack_adjust (); - /* Make the RTL_EXPR node temporary, not momentary, - so that rtl_expr_chain doesn't become garbage. */ - momentary = suspend_momentary (); - expr = make_node (RTL_EXPR); - resume_momentary (momentary); - start_sequence_for_rtl_expr (expr); - } - - if (write_symbols == NO_DEBUG) - /* As a matter of principle, `start_sequence' should do this. */ - emit_note (0, -1); - else - /* Always emit a line number note so we can step into constructors. */ - emit_line_note_force (DECL_SOURCE_FILE (current_function_decl), - DECL_SOURCE_LINE (current_function_decl)); - - mem_init_list = sort_member_init (t); - current_member_init_list = NULL_TREE; - - sort_base_init (t, &rbase_init_list, &vbase_init_list); - current_base_init_list = NULL_TREE; - - /* First, initialize the virtual base classes, if we are - constructing the most-derived object. */ - if (TYPE_USES_VIRTUAL_BASECLASSES (t)) - { - tree first_arg = TREE_CHAIN (DECL_ARGUMENTS (current_function_decl)); - construct_virtual_bases (t, current_class_ref, current_class_ptr, - vbase_init_list, first_arg); - } - - /* Now, perform initialization of non-virtual base classes. */ - for (i = 0; i < n_baseclasses; i++) - { - tree base_binfo = TREE_VEC_ELT (binfos, i); - tree init = void_list_node; - - if (TREE_VIA_VIRTUAL (base_binfo)) - continue; - - my_friendly_assert (BINFO_INHERITANCE_CHAIN (base_binfo) == t_binfo, - 999); - - if (TREE_PURPOSE (rbase_init_list)) - init = TREE_VALUE (rbase_init_list); - else if (TYPE_NEEDS_CONSTRUCTING (BINFO_TYPE (base_binfo))) - { - init = NULL_TREE; - if (extra_warnings && copy_args_p (current_function_decl)) - cp_warning ("base class `%#T' should be explicitly initialized in the copy constructor", - BINFO_TYPE (base_binfo)); - } - - if (init != void_list_node) - { - expand_start_target_temps (); - - member = convert_pointer_to_real (base_binfo, current_class_ptr); - expand_aggr_init_1 (base_binfo, NULL_TREE, - build_indirect_ref (member, NULL_PTR), init, - LOOKUP_NORMAL); - - expand_end_target_temps (); - free_temp_slots (); - } - - expand_cleanup_for_base (base_binfo, vlist, NULL_TREE); - rbase_init_list = TREE_CHAIN (rbase_init_list); - } - - /* Initialize all the virtual function table fields that - do come from virtual base classes. */ - if (TYPE_USES_VIRTUAL_BASECLASSES (t)) - expand_indirect_vtbls_init (t_binfo, current_class_ref, current_class_ptr); - - /* Initialize all the virtual function table fields that - do not come from virtual base classes. */ - expand_direct_vtbls_init (t_binfo, t_binfo, 1, 1, current_class_ptr); - - for (member = TYPE_FIELDS (t); member; member = TREE_CHAIN (member)) - { - tree init, name; - int from_init_list; - - /* member could be, for example, a CONST_DECL for an enumerated - tag; we don't want to try to initialize that, since it already - has a value. */ - if (TREE_CODE (member) != FIELD_DECL || !DECL_NAME (member)) - continue; - - /* See if we had a user-specified member initialization. */ - if (TREE_PURPOSE (mem_init_list)) - { - name = TREE_PURPOSE (mem_init_list); - init = TREE_VALUE (mem_init_list); - from_init_list = 1; - -#if 0 - if (TREE_CODE (name) == COMPONENT_REF) - name = DECL_NAME (TREE_OPERAND (name, 1)); -#else - /* Also see if it's ever a COMPONENT_REF here. If it is, we - need to do `expand_assignment (name, init, 0, 0);' and - a continue. */ - my_friendly_assert (TREE_CODE (name) != COMPONENT_REF, 349); -#endif - } - else - { - name = DECL_NAME (member); - init = DECL_INITIAL (member); - - from_init_list = 0; - - /* Effective C++ rule 12. */ - if (warn_ecpp && init == NULL_TREE - && !DECL_ARTIFICIAL (member) - && TREE_CODE (TREE_TYPE (member)) != ARRAY_TYPE) - cp_warning ("`%D' should be initialized in the member initialization list", member); - } - - perform_member_init (member, name, init, from_init_list); - mem_init_list = TREE_CHAIN (mem_init_list); - } - - /* Now initialize any members from our bases. */ - while (mem_init_list) - { - tree name, init, field; - - if (TREE_PURPOSE (mem_init_list)) - { - name = TREE_PURPOSE (mem_init_list); - init = TREE_VALUE (mem_init_list); - /* XXX: this may need the COMPONENT_REF operand 0 check if - it turns out we actually get them. */ - field = IDENTIFIER_CLASS_VALUE (name); - - /* If one member shadows another, get the outermost one. */ - if (TREE_CODE (field) == TREE_LIST) - { - field = TREE_VALUE (field); - if (decl_type_context (field) != current_class_type) - cp_error ("field `%D' not in immediate context", field); - } - -#if 0 - /* It turns out if you have an anonymous union in the - class, a member from it can end up not being on the - list of fields (rather, the type is), and therefore - won't be seen by the for loop above. */ - - /* The code in this for loop is derived from a general loop - which had this check in it. Theoretically, we've hit - every initialization for the list of members in T, so - we shouldn't have anything but these left in this list. */ - my_friendly_assert (DECL_FIELD_CONTEXT (field) != t, 351); -#endif - - perform_member_init (field, name, init, 1); - } - mem_init_list = TREE_CHAIN (mem_init_list); - } - - if (! immediately) - { - do_pending_stack_adjust (); - my_friendly_assert (base_init_expr == 0, 207); - base_init_expr = expr; - TREE_TYPE (expr) = void_type_node; - RTL_EXPR_RTL (expr) = const0_rtx; - RTL_EXPR_SEQUENCE (expr) = get_insns (); - rtl_expr_chain = tree_cons (NULL_TREE, expr, rtl_expr_chain); - end_sequence (); - TREE_SIDE_EFFECTS (expr) = 1; - } - - /* All the implicit try blocks we built up will be zapped - when we come to a real binding contour boundary. */ -} - -/* Check that all fields are properly initialized after - an assignment to `this'. */ - -void -check_base_init (t) - tree t; -{ - tree member; - for (member = TYPE_FIELDS (t); member; member = TREE_CHAIN (member)) - if (DECL_NAME (member) && TREE_USED (member)) - cp_error ("field `%D' used before initialized (after assignment to `this')", - member); -} - -/* This code sets up the virtual function tables appropriate for - the pointer DECL. It is a one-ply initialization. - - BINFO is the exact type that DECL is supposed to be. In - multiple inheritance, this might mean "C's A" if C : A, B. */ - -static void -expand_virtual_init (binfo, decl) - tree binfo, decl; -{ - tree type = BINFO_TYPE (binfo); - tree vtbl, vtbl_ptr; - tree vtype, vtype_binfo; - - /* This code is crusty. Should be simple, like: - vtbl = BINFO_VTABLE (binfo); - */ - vtype = DECL_CONTEXT (CLASSTYPE_VFIELD (type)); - vtype_binfo = get_binfo (vtype, TREE_TYPE (TREE_TYPE (decl)), 0); - vtbl = BINFO_VTABLE (binfo_value (DECL_FIELD_CONTEXT (CLASSTYPE_VFIELD (type)), binfo)); - assemble_external (vtbl); - TREE_USED (vtbl) = 1; - vtbl = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (vtbl)), vtbl); - decl = convert_pointer_to_real (vtype_binfo, decl); - vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, NULL_PTR), vtype); - if (vtbl_ptr == error_mark_node) - return; - - /* Have to convert VTBL since array sizes may be different. */ - vtbl = convert_force (TREE_TYPE (vtbl_ptr), vtbl, 0); - expand_expr_stmt (build_modify_expr (vtbl_ptr, NOP_EXPR, vtbl)); -} - -/* If an exception is thrown in a constructor, those base classes already - constructed must be destroyed. This function creates the cleanup - for BINFO, which has just been constructed. If FLAG is non-NULL, - it is a DECL which is non-zero when this base needs to be - destroyed. */ - -static void -expand_cleanup_for_base (binfo, vlist, flag) - tree binfo; - tree vlist; - tree flag; -{ - tree expr; - - if (TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (binfo))) - { - /* All cleanups must be on the function_obstack. */ - push_obstacks_nochange (); - resume_temporary_allocation (); - - /* Call the destructor. */ - expr = build_base_dtor_call (current_class_ref, binfo, - integer_zero_node); - if (flag) - expr = fold (build (COND_EXPR, void_type_node, - truthvalue_conversion (flag), - expr, integer_zero_node)); - - pop_obstacks (); - add_partial_entry (expr); - } - - if (TYPE_USES_PVBASES (BINFO_TYPE (binfo))) - { - /* Increment vlist by number of base's vbase classes. */ - expr = build_int_2 (pvbasecount (BINFO_TYPE (binfo), 0), 0); - expr = build_binary_op (PLUS_EXPR, vlist, expr); - expr = build_modify_expr (vlist, NOP_EXPR, expr); - expand_expr_stmt (expr); - } -} - -/* Subroutine of `expand_aggr_vbase_init'. - BINFO is the binfo of the type that is being initialized. - INIT_LIST is the list of initializers for the virtual baseclass. */ - -static void -expand_aggr_vbase_init_1 (binfo, exp, addr, init_list) - tree binfo, exp, addr, init_list; -{ - tree init = purpose_member (binfo, init_list); - tree ref = build_indirect_ref (addr, NULL_PTR); - - expand_start_target_temps (); - - if (init) - init = TREE_VALUE (init); - /* Call constructors, but don't set up vtables. */ - expand_aggr_init_1 (binfo, exp, ref, init, LOOKUP_COMPLAIN); - - expand_end_target_temps (); - free_temp_slots (); -} - -/* Construct the virtual base-classes of THIS_REF (whose address is - THIS_PTR). The object has the indicated TYPE. The construction - actually takes place only if FLAG is non-zero. INIT_LIST is list - of initialization for constructor to perform. */ - -static void -construct_virtual_bases (type, this_ref, this_ptr, init_list, flag) - tree type; - tree this_ref; - tree this_ptr; - tree init_list; - tree flag; -{ - tree vbases; - tree result; - tree vlist = NULL_TREE; - - /* If there are no virtual baseclasses, we shouldn't even be here. */ - my_friendly_assert (TYPE_USES_VIRTUAL_BASECLASSES (type), 19990621); - - /* First set the pointers in our object that tell us where to find - our virtual baseclasses. */ - expand_start_cond (flag, 0); - if (TYPE_USES_PVBASES (type)) - { - init_vlist (type); - vlist = lookup_name (vlist_identifier, 0); - } - result = init_vbase_pointers (type, this_ptr); - if (result) - expand_expr_stmt (build_compound_expr (result)); - expand_end_cond (); - - /* Now, run through the baseclasses, initializing each. */ - for (vbases = CLASSTYPE_VBASECLASSES (type); vbases; - vbases = TREE_CHAIN (vbases)) - { - tree tmp = purpose_member (vbases, result); - - /* If there are virtual base classes with destructors, we need to - emit cleanups to destroy them if an exception is thrown during - the construction process. These exception regions (i.e., the - period during which the cleanups must occur) begin from the time - the construction is complete to the end of the function. If we - create a conditional block in which to initialize the - base-classes, then the cleanup region for the virtual base begins - inside a block, and ends outside of that block. This situation - confuses the sjlj exception-handling code. Therefore, we do not - create a single conditional block, but one for each - initialization. (That way the cleanup regions always begin - in the outer block.) We trust the back-end to figure out - that the FLAG will not change across initializations, and - avoid doing multiple tests. */ - expand_start_cond (flag, 0); - expand_aggr_vbase_init_1 (vbases, this_ref, - TREE_OPERAND (TREE_VALUE (tmp), 0), - init_list); - expand_end_cond (); - - expand_cleanup_for_base (vbases, vlist, flag); - } -} - -/* Find the context in which this FIELD can be initialized. */ - -static tree -initializing_context (field) - tree field; -{ - tree t = DECL_CONTEXT (field); - - /* Anonymous union members can be initialized in the first enclosing - non-anonymous union context. */ - while (t && ANON_UNION_TYPE_P (t)) - t = TYPE_CONTEXT (t); - return t; -} - -/* Function to give error message if member initialization specification - is erroneous. FIELD is the member we decided to initialize. - TYPE is the type for which the initialization is being performed. - FIELD must be a member of TYPE. - - MEMBER_NAME is the name of the member. */ - -static int -member_init_ok_or_else (field, type, member_name) - tree field; - tree type; - const char *member_name; -{ - if (field == error_mark_node) - return 0; - if (field == NULL_TREE || initializing_context (field) != type) - { - cp_error ("class `%T' does not have any field named `%s'", type, - member_name); - return 0; - } - if (TREE_STATIC (field)) - { - cp_error ("field `%#D' is static; only point of initialization is its declaration", - field); - return 0; - } - - return 1; -} - -/* If NAME is a viable field name for the aggregate DECL, - and PARMS is a viable parameter list, then expand an _EXPR - which describes this initialization. - - Note that we do not need to chase through the class's base classes - to look for NAME, because if it's in that list, it will be handled - by the constructor for that base class. - - We do not yet have a fixed-point finder to instantiate types - being fed to overloaded constructors. If there is a unique - constructor, then argument types can be got from that one. - - If INIT is non-NULL, then it the initialization should - be placed in `current_base_init_list', where it will be processed - by `emit_base_init'. */ - -void -expand_member_init (exp, name, init) - tree exp, name, init; -{ - tree basetype = NULL_TREE, field; - tree type; - - if (exp == NULL_TREE) - return; /* complain about this later */ - - type = TYPE_MAIN_VARIANT (TREE_TYPE (exp)); - - if (name && TREE_CODE (name) == TYPE_DECL) - { - basetype = TYPE_MAIN_VARIANT (TREE_TYPE (name)); - name = DECL_NAME (name); - } - - if (name == NULL_TREE && IS_AGGR_TYPE (type)) - switch (CLASSTYPE_N_BASECLASSES (type)) - { - case 0: - error ("base class initializer specified, but no base class to initialize"); - return; - case 1: - basetype = TYPE_BINFO_BASETYPE (type, 0); - break; - default: - error ("initializer for unnamed base class ambiguous"); - cp_error ("(type `%T' uses multiple inheritance)", type); - return; - } - - my_friendly_assert (init != NULL_TREE, 0); - - /* The grammar should not allow fields which have names that are - TYPENAMEs. Therefore, if the field has a non-NULL TREE_TYPE, we - may assume that this is an attempt to initialize a base class - member of the current type. Otherwise, it is an attempt to - initialize a member field. */ - - if (init == void_type_node) - init = NULL_TREE; - - if (name == NULL_TREE || basetype) - { - tree base_init; - - if (name == NULL_TREE) - { -#if 0 - if (basetype) - name = TYPE_IDENTIFIER (basetype); - else - { - error ("no base class to initialize"); - return; - } -#endif - } - else if (basetype != type - && ! current_template_parms - && ! vec_binfo_member (basetype, - TYPE_BINFO_BASETYPES (type)) - && ! binfo_member (basetype, CLASSTYPE_VBASECLASSES (type))) - { - if (IDENTIFIER_CLASS_VALUE (name)) - goto try_member; - if (TYPE_USES_VIRTUAL_BASECLASSES (type)) - cp_error ("type `%T' is not an immediate or virtual basetype for `%T'", - basetype, type); - else - cp_error ("type `%T' is not an immediate basetype for `%T'", - basetype, type); - return; - } - - if (purpose_member (basetype, current_base_init_list)) - { - cp_error ("base class `%T' already initialized", basetype); - return; - } - - if (warn_reorder && current_member_init_list) - { - cp_warning ("base initializer for `%T'", basetype); - warning (" will be re-ordered to precede member initializations"); - } - - base_init = build_tree_list (basetype, init); - current_base_init_list = chainon (current_base_init_list, base_init); - } - else - { - tree member_init; - - try_member: - field = lookup_field (type, name, 1, 0); - - if (! member_init_ok_or_else (field, type, IDENTIFIER_POINTER (name))) - return; - - if (purpose_member (name, current_member_init_list)) - { - cp_error ("field `%D' already initialized", field); - return; - } - - member_init = build_tree_list (name, init); - current_member_init_list = chainon (current_member_init_list, member_init); - } -} - -/* This is like `expand_member_init', only it stores one aggregate - value into another. - - INIT comes in two flavors: it is either a value which - is to be stored in EXP, or it is a parameter list - to go to a constructor, which will operate on EXP. - If INIT is not a parameter list for a constructor, then set - LOOKUP_ONLYCONVERTING. - If FLAGS is LOOKUP_ONLYCONVERTING then it is the = init form of - the initializer, if FLAGS is 0, then it is the (init) form. - If `init' is a CONSTRUCTOR, then we emit a warning message, - explaining that such initializations are invalid. - - ALIAS_THIS is nonzero iff we are initializing something which is - essentially an alias for current_class_ref. In this case, the base - constructor may move it on us, and we must keep track of such - deviations. - - If INIT resolves to a CALL_EXPR which happens to return - something of the type we are looking for, then we know - that we can safely use that call to perform the - initialization. - - The virtual function table pointer cannot be set up here, because - we do not really know its type. - - Virtual baseclass pointers are also set up here. - - This never calls operator=(). - - When initializing, nothing is CONST. - - A default copy constructor may have to be used to perform the - initialization. - - A constructor or a conversion operator may have to be used to - perform the initialization, but not both, as it would be ambiguous. */ - -void -expand_aggr_init (exp, init, flags) - tree exp, init; - int flags; -{ - tree type = TREE_TYPE (exp); - int was_const = TREE_READONLY (exp); - int was_volatile = TREE_THIS_VOLATILE (exp); - - if (init == error_mark_node) - return; - - TREE_READONLY (exp) = 0; - TREE_THIS_VOLATILE (exp) = 0; - - if (init && TREE_CODE (init) != TREE_LIST) - flags |= LOOKUP_ONLYCONVERTING; - - if (TREE_CODE (type) == ARRAY_TYPE) - { - /* Must arrange to initialize each element of EXP - from elements of INIT. */ - tree itype = init ? TREE_TYPE (init) : NULL_TREE; - if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED) - { - TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type); - if (init) - TREE_TYPE (init) = TYPE_MAIN_VARIANT (itype); - } - if (init && TREE_TYPE (init) == NULL_TREE) - { - /* Handle bad initializers like: - class COMPLEX { - public: - double re, im; - COMPLEX(double r = 0.0, double i = 0.0) {re = r; im = i;}; - ~COMPLEX() {}; - }; - - int main(int argc, char **argv) { - COMPLEX zees(1.0, 0.0)[10]; - } - */ - error ("bad array initializer"); - return; - } - expand_vec_init (exp, exp, array_type_nelts (type), init, - init && same_type_p (TREE_TYPE (init), - TREE_TYPE (exp))); - TREE_READONLY (exp) = was_const; - TREE_THIS_VOLATILE (exp) = was_volatile; - TREE_TYPE (exp) = type; - if (init) - TREE_TYPE (init) = itype; - return; - } - - if (TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == PARM_DECL) - /* just know that we've seen something for this node */ - TREE_USED (exp) = 1; - -#if 0 - /* If initializing from a GNU C CONSTRUCTOR, consider the elts in the - constructor as parameters to an implicit GNU C++ constructor. */ - if (init && TREE_CODE (init) == CONSTRUCTOR - && TYPE_HAS_CONSTRUCTOR (type) - && TREE_TYPE (init) == type) - init = CONSTRUCTOR_ELTS (init); -#endif - - TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type); - expand_aggr_init_1 (TYPE_BINFO (type), exp, exp, - init, LOOKUP_NORMAL|flags); - TREE_TYPE (exp) = type; - TREE_READONLY (exp) = was_const; - TREE_THIS_VOLATILE (exp) = was_volatile; -} - -static tree -no_vlist_base_init (rval, exp, init, binfo, flags) - tree rval, exp, init, binfo; - int flags; -{ - tree nrval, func, parms; - - /* Obtain the vlist-expecting ctor. */ - func = rval; - my_friendly_assert (TREE_CODE (func) == CALL_EXPR, 20000131); - func = TREE_OPERAND (func, 0); - my_friendly_assert (TREE_CODE (func) == ADDR_EXPR, 20000132); - - if (init == NULL_TREE - || (TREE_CODE (init) == TREE_LIST && ! TREE_TYPE (init))) - { - parms = init; - if (parms) - init = TREE_VALUE (parms); - } - else - parms = build_expr_list (NULL_TREE, init); - - flags &= ~LOOKUP_HAS_VLIST; - - parms = expr_tree_cons (NULL_TREE, integer_zero_node, parms); - flags |= LOOKUP_HAS_IN_CHARGE; - - nrval = build_method_call (exp, ctor_identifier, - parms, binfo, flags); - - func = build (NE_EXPR, boolean_type_node, - func, null_pointer_node); - nrval = build (COND_EXPR, void_type_node, - func, rval, nrval); - return nrval; -} - -static void -expand_default_init (binfo, true_exp, exp, init, flags) - tree binfo; - tree true_exp, exp; - tree init; - int flags; -{ - tree type = TREE_TYPE (exp); - - /* It fails because there may not be a constructor which takes - its own type as the first (or only parameter), but which does - take other types via a conversion. So, if the thing initializing - the expression is a unit element of type X, first try X(X&), - followed by initialization by X. If neither of these work - out, then look hard. */ - tree rval; - tree parms; - tree vlist = NULL_TREE; - tree orig_init = init; - - if (init && TREE_CODE (init) != TREE_LIST - && (flags & LOOKUP_ONLYCONVERTING)) - { - /* Base subobjects should only get direct-initialization. */ - if (true_exp != exp) - abort (); - - if (flags & DIRECT_BIND) - /* Do nothing. We hit this in two cases: Reference initialization, - where we aren't initializing a real variable, so we don't want - to run a new constructor; and catching an exception, where we - have already built up the constructor call so we could wrap it - in an exception region. */; - else - init = ocp_convert (type, init, CONV_IMPLICIT|CONV_FORCE_TEMP, flags); - - if (TREE_CODE (init) == TRY_CATCH_EXPR) - /* We need to protect the initialization of a catch parm - with a call to terminate(), which shows up as a TRY_CATCH_EXPR - around the TARGET_EXPR for the copy constructor. See - expand_start_catch_block. */ - TREE_OPERAND (init, 0) = build (INIT_EXPR, TREE_TYPE (exp), exp, - TREE_OPERAND (init, 0)); - else - init = build (INIT_EXPR, TREE_TYPE (exp), exp, init); - TREE_SIDE_EFFECTS (init) = 1; - expand_expr_stmt (init); - return; - } - - if (init == NULL_TREE - || (TREE_CODE (init) == TREE_LIST && ! TREE_TYPE (init))) - { - parms = init; - if (parms) - init = TREE_VALUE (parms); - } - else - parms = build_expr_list (NULL_TREE, init); - - if (TYPE_USES_VIRTUAL_BASECLASSES (type)) - { - if (TYPE_USES_PVBASES (type)) - { - /* In compatibility mode, when not calling a base ctor, - we do not pass the vlist argument. */ - if (true_exp == exp) - vlist = flag_vtable_thunks_compat? NULL_TREE : vlist_zero_node; - else - vlist = lookup_name (vlist_identifier, 0); - - if (vlist) - { - parms = expr_tree_cons (NULL_TREE, vlist, parms); - flags |= LOOKUP_HAS_VLIST; - } - } - if (true_exp == exp) - parms = expr_tree_cons (NULL_TREE, integer_one_node, parms); - else - parms = expr_tree_cons (NULL_TREE, integer_zero_node, parms); - flags |= LOOKUP_HAS_IN_CHARGE; - } - - rval = build_method_call (exp, ctor_identifier, - parms, binfo, flags); - if (vlist && true_exp != exp && flag_vtable_thunks_compat) - { - rval = no_vlist_base_init (rval, exp, orig_init, binfo, flags); - } - if (TREE_SIDE_EFFECTS (rval)) - expand_expr_stmt (rval); -} - -/* This function is responsible for initializing EXP with INIT - (if any). - - BINFO is the binfo of the type for who we are performing the - initialization. For example, if W is a virtual base class of A and B, - and C : A, B. - If we are initializing B, then W must contain B's W vtable, whereas - were we initializing C, W must contain C's W vtable. - - TRUE_EXP is nonzero if it is the true expression being initialized. - In this case, it may be EXP, or may just contain EXP. The reason we - need this is because if EXP is a base element of TRUE_EXP, we - don't necessarily know by looking at EXP where its virtual - baseclass fields should really be pointing. But we do know - from TRUE_EXP. In constructors, we don't know anything about - the value being initialized. - - ALIAS_THIS serves the same purpose it serves for expand_aggr_init. - - FLAGS is just passes to `build_method_call'. See that function for - its description. */ - -static void -expand_aggr_init_1 (binfo, true_exp, exp, init, flags) - tree binfo; - tree true_exp, exp; - tree init; - int flags; -{ - tree type = TREE_TYPE (exp); - - my_friendly_assert (init != error_mark_node && type != error_mark_node, 211); - - /* Use a function returning the desired type to initialize EXP for us. - If the function is a constructor, and its first argument is - NULL_TREE, know that it was meant for us--just slide exp on - in and expand the constructor. Constructors now come - as TARGET_EXPRs. */ - - if (init && TREE_CODE (exp) == VAR_DECL - && TREE_CODE (init) == CONSTRUCTOR - && TREE_HAS_CONSTRUCTOR (init)) - { - tree t = store_init_value (exp, init); - if (!t) - { - expand_decl_init (exp); - return; - } - t = build (INIT_EXPR, type, exp, init); - TREE_SIDE_EFFECTS (t) = 1; - expand_expr_stmt (t); - return; - } - - /* We know that expand_default_init can handle everything we want - at this point. */ - expand_default_init (binfo, true_exp, exp, init, flags); -} - -/* Report an error if NAME is not the name of a user-defined, - aggregate type. If OR_ELSE is nonzero, give an error message. */ - -int -is_aggr_typedef (name, or_else) - tree name; - int or_else; -{ - tree type; - - if (name == error_mark_node) - return 0; - - if (IDENTIFIER_HAS_TYPE_VALUE (name)) - type = IDENTIFIER_TYPE_VALUE (name); - else - { - if (or_else) - cp_error ("`%T' is not an aggregate typedef", name); - return 0; - } - - if (! IS_AGGR_TYPE (type) - && TREE_CODE (type) != TEMPLATE_TYPE_PARM - && TREE_CODE (type) != TEMPLATE_TEMPLATE_PARM) - { - if (or_else) - cp_error ("`%T' is not an aggregate type", type); - return 0; - } - return 1; -} - -/* Report an error if TYPE is not a user-defined, aggregate type. If - OR_ELSE is nonzero, give an error message. */ - -int -is_aggr_type (type, or_else) - tree type; - int or_else; -{ - if (type == error_mark_node) - return 0; - - if (! IS_AGGR_TYPE (type) - && TREE_CODE (type) != TEMPLATE_TYPE_PARM - && TREE_CODE (type) != TEMPLATE_TEMPLATE_PARM) - { - if (or_else) - cp_error ("`%T' is not an aggregate type", type); - return 0; - } - return 1; -} - -/* Like is_aggr_typedef, but returns typedef if successful. */ - -tree -get_aggr_from_typedef (name, or_else) - tree name; - int or_else; -{ - tree type; - - if (name == error_mark_node) - return NULL_TREE; - - if (IDENTIFIER_HAS_TYPE_VALUE (name)) - type = IDENTIFIER_TYPE_VALUE (name); - else - { - if (or_else) - cp_error ("`%T' fails to be an aggregate typedef", name); - return NULL_TREE; - } - - if (! IS_AGGR_TYPE (type) - && TREE_CODE (type) != TEMPLATE_TYPE_PARM - && TREE_CODE (type) != TEMPLATE_TEMPLATE_PARM) - { - if (or_else) - cp_error ("type `%T' is of non-aggregate type", type); - return NULL_TREE; - } - return type; -} - -tree -get_type_value (name) - tree name; -{ - if (name == error_mark_node) - return NULL_TREE; - - if (IDENTIFIER_HAS_TYPE_VALUE (name)) - return IDENTIFIER_TYPE_VALUE (name); - else - return NULL_TREE; -} - - -/* This code could just as well go in `class.c', but is placed here for - modularity. */ - -/* For an expression of the form TYPE :: NAME (PARMLIST), build - the appropriate function call. */ - -tree -build_member_call (type, name, parmlist) - tree type, name, parmlist; -{ - tree t; - tree method_name; - int dtor = 0; - tree basetype_path, decl; - - if (TREE_CODE (name) == TEMPLATE_ID_EXPR - && TREE_CODE (type) == NAMESPACE_DECL) - { - /* 'name' already refers to the decls from the namespace, since we - hit do_identifier for template_ids. */ - method_name = TREE_OPERAND (name, 0); - /* FIXME: Since we don't do independent names right yet, the - name might also be a LOOKUP_EXPR. Once we resolve this to a - real decl earlier, this can go. This may happen during - tsubst'ing. */ - if (TREE_CODE (method_name) == LOOKUP_EXPR) - { - method_name = lookup_namespace_name - (type, TREE_OPERAND (method_name, 0)); - TREE_OPERAND (name, 0) = method_name; - } - my_friendly_assert (is_overloaded_fn (method_name), 980519); - return build_x_function_call (name, parmlist, current_class_ref); - } - - if (type == std_node) - return build_x_function_call (do_scoped_id (name, 0), parmlist, - current_class_ref); - if (TREE_CODE (type) == NAMESPACE_DECL) - return build_x_function_call (lookup_namespace_name (type, name), - parmlist, current_class_ref); - - if (TREE_CODE (name) == TEMPLATE_ID_EXPR) - { - method_name = TREE_OPERAND (name, 0); - if (TREE_CODE (method_name) == COMPONENT_REF) - method_name = TREE_OPERAND (method_name, 1); - if (is_overloaded_fn (method_name)) - method_name = DECL_NAME (OVL_CURRENT (method_name)); - TREE_OPERAND (name, 0) = method_name; - } - else - method_name = name; - - if (TREE_CODE (method_name) == BIT_NOT_EXPR) - { - method_name = TREE_OPERAND (method_name, 0); - dtor = 1; - } - - /* This shouldn't be here, and build_member_call shouldn't appear in - parse.y! (mrs) */ - if (type && TREE_CODE (type) == IDENTIFIER_NODE - && get_aggr_from_typedef (type, 0) == 0) - { - tree ns = lookup_name (type, 0); - if (ns && TREE_CODE (ns) == NAMESPACE_DECL) - { - return build_x_function_call (build_offset_ref (type, name), parmlist, current_class_ref); - } - } - - if (type == NULL_TREE || ! is_aggr_type (type, 1)) - return error_mark_node; - - /* An operator we did not like. */ - if (name == NULL_TREE) - return error_mark_node; - - if (dtor) - { - cp_error ("cannot call destructor `%T::~%T' without object", type, - method_name); - return error_mark_node; - } - - decl = maybe_dummy_object (type, &basetype_path); - - /* Convert 'this' to the specified type to disambiguate conversion - to the function's context. Apparently Standard C++ says that we - shouldn't do this. */ - if (decl == current_class_ref - && ! pedantic - && ACCESSIBLY_UNIQUELY_DERIVED_P (type, current_class_type)) - { - tree olddecl = current_class_ptr; - tree oldtype = TREE_TYPE (TREE_TYPE (olddecl)); - if (oldtype != type) - { - tree newtype = build_qualified_type (type, TYPE_QUALS (oldtype)); - decl = convert_force (build_pointer_type (newtype), olddecl, 0); - decl = build_indirect_ref (decl, NULL_PTR); - } - } - - if (method_name == constructor_name (type) - || method_name == constructor_name_full (type)) - return build_functional_cast (type, parmlist); - if (lookup_fnfields (basetype_path, method_name, 0)) - return build_method_call (decl, - TREE_CODE (name) == TEMPLATE_ID_EXPR - ? name : method_name, - parmlist, basetype_path, - LOOKUP_NORMAL|LOOKUP_NONVIRTUAL); - if (TREE_CODE (name) == IDENTIFIER_NODE - && ((t = lookup_field (TYPE_BINFO (type), name, 1, 0)))) - { - if (t == error_mark_node) - return error_mark_node; - if (TREE_CODE (t) == FIELD_DECL) - { - if (is_dummy_object (decl)) - { - cp_error ("invalid use of non-static field `%D'", t); - return error_mark_node; - } - decl = build (COMPONENT_REF, TREE_TYPE (t), decl, t); - } - else if (TREE_CODE (t) == VAR_DECL) - decl = t; - else - { - cp_error ("invalid use of member `%D'", t); - return error_mark_node; - } - if (TYPE_LANG_SPECIFIC (TREE_TYPE (decl))) - return build_opfncall (CALL_EXPR, LOOKUP_NORMAL, decl, - parmlist, NULL_TREE); - return build_function_call (decl, parmlist); - } - else - { - cp_error ("no method `%T::%D'", type, name); - return error_mark_node; - } -} - -/* Build a reference to a member of an aggregate. This is not a - C++ `&', but really something which can have its address taken, - and then act as a pointer to member, for example TYPE :: FIELD - can have its address taken by saying & TYPE :: FIELD. - - @@ Prints out lousy diagnostics for operator - @@ fields. - - @@ This function should be rewritten and placed in search.c. */ - -tree -build_offset_ref (type, name) - tree type, name; -{ - tree decl, t = error_mark_node; - tree member; - tree basebinfo = NULL_TREE; - tree orig_name = name; - - /* class templates can come in as TEMPLATE_DECLs here. */ - if (TREE_CODE (name) == TEMPLATE_DECL) - return name; - - if (type == std_node) - return do_scoped_id (name, 0); - - if (processing_template_decl || uses_template_parms (type)) - return build_min_nt (SCOPE_REF, type, name); - - /* Handle namespace names fully here. */ - if (TREE_CODE (type) == NAMESPACE_DECL) - { - t = lookup_namespace_name (type, name); - if (t != error_mark_node && ! type_unknown_p (t)) - { - mark_used (t); - t = convert_from_reference (t); - } - return t; - } - - if (type == NULL_TREE || ! is_aggr_type (type, 1)) - return error_mark_node; - - if (TREE_CODE (name) == TEMPLATE_ID_EXPR) - { - /* If the NAME is a TEMPLATE_ID_EXPR, we are looking at - something like `a.template f' or the like. For the most - part, we treat this just like a.f. We do remember, however, - the template-id that was used. */ - name = TREE_OPERAND (orig_name, 0); - - if (TREE_CODE (name) == LOOKUP_EXPR) - /* This can happen during tsubst'ing. */ - name = TREE_OPERAND (name, 0); - - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 0); - } - - if (TREE_CODE (name) == BIT_NOT_EXPR) - { - if (! check_dtor_name (type, name)) - cp_error ("qualified type `%T' does not match destructor name `~%T'", - type, TREE_OPERAND (name, 0)); - name = dtor_identifier; - } -#if 0 - /* I think this is wrong, but the draft is unclear. --jason 6/15/98 */ - else if (name == constructor_name_full (type) - || name == constructor_name (type)) - name = ctor_identifier; -#endif - - if (TYPE_SIZE (complete_type (type)) == 0 - && !TYPE_BEING_DEFINED (type)) - { - cp_error ("incomplete type `%T' does not have member `%D'", type, - name); - return error_mark_node; - } - - decl = maybe_dummy_object (type, &basebinfo); - - member = lookup_member (basebinfo, name, 1, 0); - - if (member == error_mark_node) - return error_mark_node; - - /* A lot of this logic is now handled in lookup_field and - lookup_fnfield. */ - if (member && BASELINK_P (member)) - { - /* Go from the TREE_BASELINK to the member function info. */ - tree fnfields = member; - t = TREE_VALUE (fnfields); - - if (TREE_CODE (orig_name) == TEMPLATE_ID_EXPR) - { - /* The FNFIELDS are going to contain functions that aren't - necessarily templates, and templates that don't - necessarily match the explicit template parameters. We - save all the functions, and the explicit parameters, and - then figure out exactly what to instantiate with what - arguments in instantiate_type. */ - - if (TREE_CODE (t) != OVERLOAD) - /* The code in instantiate_type which will process this - expects to encounter OVERLOADs, not raw functions. */ - t = ovl_cons (t, NULL_TREE); - - return build (OFFSET_REF, - unknown_type_node, - decl, - build (TEMPLATE_ID_EXPR, - TREE_TYPE (t), - t, - TREE_OPERAND (orig_name, 1))); - } - - if (!really_overloaded_fn (t)) - { - /* Get rid of a potential OVERLOAD around it */ - t = OVL_CURRENT (t); - - /* unique functions are handled easily. */ - basebinfo = TREE_PURPOSE (fnfields); - if (!enforce_access (basebinfo, t)) - return error_mark_node; - mark_used (t); - if (DECL_STATIC_FUNCTION_P (t)) - return t; - return build (OFFSET_REF, TREE_TYPE (t), decl, t); - } - - /* FNFIELDS is most likely allocated on the search_obstack, - which will go away after this class scope. If we need - to save this value for later (i.e. for use as an initializer - for a static variable), then do so here. - - ??? The smart thing to do for the case of saving initializers - is to resolve them before we're done with this scope. */ - if (!TREE_PERMANENT (fnfields) - && ! allocation_temporary_p ()) - fnfields = copy_list (fnfields); - - TREE_TYPE (fnfields) = unknown_type_node; - return build (OFFSET_REF, unknown_type_node, decl, fnfields); - } - - t = member; - - if (t == NULL_TREE) - { - cp_error ("`%D' is not a member of type `%T'", name, type); - return error_mark_node; - } - - if (TREE_CODE (t) == TYPE_DECL) - { - TREE_USED (t) = 1; - return t; - } - /* static class members and class-specific enum - values can be returned without further ado. */ - if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == CONST_DECL) - { - mark_used (t); - return convert_from_reference (t); - } - - if (TREE_CODE (t) == FIELD_DECL && DECL_C_BIT_FIELD (t)) - { - cp_error ("illegal pointer to bit field `%D'", t); - return error_mark_node; - } - - /* static class functions too. */ - if (TREE_CODE (t) == FUNCTION_DECL - && TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE) - my_friendly_abort (53); - - /* In member functions, the form `type::name' is no longer - equivalent to `this->type::name', at least not until - resolve_offset_ref. */ - return build (OFFSET_REF, build_offset_type (type, TREE_TYPE (t)), decl, t); -} - -/* If a OFFSET_REF made it through to here, then it did - not have its address taken. */ - -tree -resolve_offset_ref (exp) - tree exp; -{ - tree type = TREE_TYPE (exp); - tree base = NULL_TREE; - tree member; - tree basetype, addr; - - if (TREE_CODE (exp) == OFFSET_REF) - { - member = TREE_OPERAND (exp, 1); - base = TREE_OPERAND (exp, 0); - } - else - { - my_friendly_assert (TREE_CODE (type) == OFFSET_TYPE, 214); - if (TYPE_OFFSET_BASETYPE (type) != current_class_type) - { - error ("object missing in use of pointer-to-member construct"); - return error_mark_node; - } - member = exp; - type = TREE_TYPE (type); - base = current_class_ref; - } - - if (BASELINK_P (member)) - { - cp_pedwarn ("assuming & on overloaded member function"); - return build_unary_op (ADDR_EXPR, exp, 0); - } - - if (TREE_CODE (TREE_TYPE (member)) == METHOD_TYPE) - { - cp_pedwarn ("assuming & on `%E'", member); - return build_unary_op (ADDR_EXPR, exp, 0); - } - - if ((TREE_CODE (member) == VAR_DECL - && ! TYPE_PTRMEMFUNC_P (TREE_TYPE (member)) - && ! TYPE_PTRMEM_P (TREE_TYPE (member))) - || TREE_CODE (TREE_TYPE (member)) == FUNCTION_TYPE) - { - /* These were static members. */ - if (mark_addressable (member) == 0) - return error_mark_node; - return member; - } - - if (TREE_CODE (TREE_TYPE (member)) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (TREE_TYPE (member))) == METHOD_TYPE) - return member; - - /* Syntax error can cause a member which should - have been seen as static to be grok'd as non-static. */ - if (TREE_CODE (member) == FIELD_DECL && current_class_ref == NULL_TREE) - { - if (TREE_ADDRESSABLE (member) == 0) - { - cp_error_at ("member `%D' is non-static but referenced as a static member", - member); - error ("at this point in file"); - TREE_ADDRESSABLE (member) = 1; - } - return error_mark_node; - } - - /* The first case is really just a reference to a member of `this'. */ - if (TREE_CODE (member) == FIELD_DECL - && (base == current_class_ref || is_dummy_object (base))) - { - tree basetype_path; - tree expr; - - if (TREE_CODE (exp) == OFFSET_REF && TREE_CODE (type) == OFFSET_TYPE) - basetype = TYPE_OFFSET_BASETYPE (type); - else - basetype = DECL_CONTEXT (member); - - base = current_class_ptr; - - if (get_base_distance (basetype, TREE_TYPE (TREE_TYPE (base)), 0, &basetype_path) < 0) - { - error_not_base_type (basetype, TREE_TYPE (TREE_TYPE (base))); - return error_mark_node; - } - /* Kludge: we need to use basetype_path now, because - convert_pointer_to will bash it. */ - enforce_access (basetype_path, member); - addr = convert_pointer_to (basetype, base); - - /* Even in the case of illegal access, we form the - COMPONENT_REF; that will allow better error recovery than - just feeding back error_mark_node. */ - expr = build (COMPONENT_REF, TREE_TYPE (member), - build_indirect_ref (addr, NULL_PTR), member); - return convert_from_reference (expr); - } - - /* Ensure that we have an object. */ - if (is_dummy_object (base)) - addr = error_mark_node; - else - /* If this is a reference to a member function, then return the - address of the member function (which may involve going - through the object's vtable), otherwise, return an expression - for the dereferenced pointer-to-member construct. */ - addr = build_unary_op (ADDR_EXPR, base, 0); - - if (TYPE_PTRMEM_P (TREE_TYPE (member))) - { - if (addr == error_mark_node) - { - cp_error ("object missing in `%E'", exp); - return error_mark_node; - } - - basetype = TYPE_OFFSET_BASETYPE (TREE_TYPE (TREE_TYPE (member))); - addr = convert_pointer_to (basetype, addr); - member = cp_convert (ptrdiff_type_node, member); - - /* Pointer to data members are offset by one, so that a null - pointer with a real value of 0 is distinguishable from an - offset of the first member of a structure. */ - member = build_binary_op (MINUS_EXPR, member, - cp_convert (ptrdiff_type_node, integer_one_node)); - - return build1 (INDIRECT_REF, type, - build (PLUS_EXPR, build_pointer_type (type), - addr, member)); - } - else if (TYPE_PTRMEMFUNC_P (TREE_TYPE (member))) - { - return get_member_function_from_ptrfunc (&addr, member); - } - my_friendly_abort (56); - /* NOTREACHED */ - return NULL_TREE; -} - -/* Return either DECL or its known constant value (if it has one). */ - -tree -decl_constant_value (decl) - tree decl; -{ - if (! TREE_THIS_VOLATILE (decl) - && DECL_INITIAL (decl) - && DECL_INITIAL (decl) != error_mark_node - /* This is invalid if initial value is not constant. - If it has either a function call, a memory reference, - or a variable, then re-evaluating it could give different results. */ - && TREE_CONSTANT (DECL_INITIAL (decl)) - /* Check for cases where this is sub-optimal, even though valid. */ - && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR) - return DECL_INITIAL (decl); - return decl; -} - -/* Common subroutines of build_new and build_vec_delete. */ - -/* Call the global __builtin_delete to delete ADDR. */ - -static tree -build_builtin_delete_call (addr) - tree addr; -{ - mark_used (global_delete_fndecl); - return build_call (global_delete_fndecl, - void_type_node, build_expr_list (NULL_TREE, addr)); -} - -/* Generate a C++ "new" expression. DECL is either a TREE_LIST - (which needs to go through some sort of groktypename) or it - is the name of the class we are newing. INIT is an initialization value. - It is either an EXPRLIST, an EXPR_NO_COMMAS, or something in braces. - If INIT is void_type_node, it means do *not* call a constructor - for this instance. - - For types with constructors, the data returned is initialized - by the appropriate constructor. - - Whether the type has a constructor or not, if it has a pointer - to a virtual function table, then that pointer is set up - here. - - Unless I am mistaken, a call to new () will return initialized - data regardless of whether the constructor itself is private or - not. NOPE; new fails if the constructor is private (jcm). - - Note that build_new does nothing to assure that any special - alignment requirements of the type are met. Rather, it leaves - it up to malloc to do the right thing. Otherwise, folding to - the right alignment cal cause problems if the user tries to later - free the memory returned by `new'. - - PLACEMENT is the `placement' list for user-defined operator new (). */ - -extern int flag_check_new; - -tree -build_new (placement, decl, init, use_global_new) - tree placement; - tree decl, init; - int use_global_new; -{ - tree type, rval; - tree nelts = NULL_TREE, t; - int has_array = 0; - - tree pending_sizes = NULL_TREE; - - if (decl == error_mark_node) - return error_mark_node; - - if (TREE_CODE (decl) == TREE_LIST) - { - tree absdcl = TREE_VALUE (decl); - tree last_absdcl = NULL_TREE; - int old_immediate_size_expand = 0; - - if (current_function_decl - && DECL_CONSTRUCTOR_P (current_function_decl)) - { - old_immediate_size_expand = immediate_size_expand; - immediate_size_expand = 0; - } - - nelts = integer_one_node; - - if (absdcl && TREE_CODE (absdcl) == CALL_EXPR) - my_friendly_abort (215); - while (absdcl && TREE_CODE (absdcl) == INDIRECT_REF) - { - last_absdcl = absdcl; - absdcl = TREE_OPERAND (absdcl, 0); - } - - if (absdcl && TREE_CODE (absdcl) == ARRAY_REF) - { - /* probably meant to be a vec new */ - tree this_nelts; - - while (TREE_OPERAND (absdcl, 0) - && TREE_CODE (TREE_OPERAND (absdcl, 0)) == ARRAY_REF) - { - last_absdcl = absdcl; - absdcl = TREE_OPERAND (absdcl, 0); - } - - has_array = 1; - this_nelts = TREE_OPERAND (absdcl, 1); - if (this_nelts != error_mark_node) - { - if (this_nelts == NULL_TREE) - error ("new of array type fails to specify size"); - else if (processing_template_decl) - { - nelts = this_nelts; - absdcl = TREE_OPERAND (absdcl, 0); - } - else - { - int flags = pedantic ? WANT_INT : (WANT_INT | WANT_ENUM); - if (build_expr_type_conversion (flags, this_nelts, 0) - == NULL_TREE) - pedwarn ("size in array new must have integral type"); - - this_nelts = save_expr (cp_convert (sizetype, this_nelts)); - absdcl = TREE_OPERAND (absdcl, 0); - if (this_nelts == integer_zero_node) - { - warning ("zero size array reserves no space"); - nelts = integer_zero_node; - } - else - nelts = build_binary_op (MULT_EXPR, nelts, this_nelts); - } - } - else - nelts = integer_zero_node; - } - - if (last_absdcl) - TREE_OPERAND (last_absdcl, 0) = absdcl; - else - TREE_VALUE (decl) = absdcl; - - type = groktypename (decl); - if (! type || type == error_mark_node) - { - immediate_size_expand = old_immediate_size_expand; - return error_mark_node; - } - - if (current_function_decl - && DECL_CONSTRUCTOR_P (current_function_decl)) - { - pending_sizes = get_pending_sizes (); - immediate_size_expand = old_immediate_size_expand; - } - } - else if (TREE_CODE (decl) == IDENTIFIER_NODE) - { - if (IDENTIFIER_HAS_TYPE_VALUE (decl)) - { - /* An aggregate type. */ - type = IDENTIFIER_TYPE_VALUE (decl); - decl = TYPE_MAIN_DECL (type); - } - else - { - /* A builtin type. */ - decl = lookup_name (decl, 1); - my_friendly_assert (TREE_CODE (decl) == TYPE_DECL, 215); - type = TREE_TYPE (decl); - } - } - else if (TREE_CODE (decl) == TYPE_DECL) - { - type = TREE_TYPE (decl); - } - else - { - type = decl; - decl = TYPE_MAIN_DECL (type); - } - - if (processing_template_decl) - { - if (has_array) - t = min_tree_cons (min_tree_cons (NULL_TREE, type, NULL_TREE), - build_min_nt (ARRAY_REF, NULL_TREE, nelts), - NULL_TREE); - else - t = type; - - rval = build_min_nt (NEW_EXPR, placement, t, init); - NEW_EXPR_USE_GLOBAL (rval) = use_global_new; - return rval; - } - - /* ``A reference cannot be created by the new operator. A reference - is not an object (8.2.2, 8.4.3), so a pointer to it could not be - returned by new.'' ARM 5.3.3 */ - if (TREE_CODE (type) == REFERENCE_TYPE) - { - error ("new cannot be applied to a reference type"); - type = TREE_TYPE (type); - } - - if (TREE_CODE (type) == FUNCTION_TYPE) - { - error ("new cannot be applied to a function type"); - return error_mark_node; - } - - /* When the object being created is an array, the new-expression yields a - pointer to the initial element (if any) of the array. For example, - both new int and new int[10] return an int*. 5.3.4. */ - if (TREE_CODE (type) == ARRAY_TYPE && has_array == 0) - { - nelts = array_type_nelts_top (type); - has_array = 1; - type = TREE_TYPE (type); - } - - if (has_array) - t = build_nt (ARRAY_REF, type, nelts); - else - t = type; - - rval = build (NEW_EXPR, build_pointer_type (type), placement, t, init); - NEW_EXPR_USE_GLOBAL (rval) = use_global_new; - TREE_SIDE_EFFECTS (rval) = 1; - - /* Wrap it in a NOP_EXPR so warn_if_unused_value doesn't complain. */ - rval = build1 (NOP_EXPR, TREE_TYPE (rval), rval); - TREE_NO_UNUSED_WARNING (rval) = 1; - - if (pending_sizes) - rval = build_compound_expr (chainon (pending_sizes, - build_expr_list (NULL_TREE, rval))); - - return rval; -} - -/* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */ - -static tree jclass_node = NULL_TREE; - -/* Given a Java class, return a decl for the corresponding java.lang.Class. */ - -static tree -build_java_class_ref (type) - tree type; -{ - tree name, class_decl; - static tree CL_prefix = NULL_TREE; - if (CL_prefix == NULL_TREE) - CL_prefix = get_identifier("_CL_"); - if (jclass_node == NULL_TREE) - { - jclass_node = IDENTIFIER_GLOBAL_VALUE (get_identifier("jclass")); - if (jclass_node == NULL_TREE) - fatal("call to Java constructor, while `jclass' undefined"); - jclass_node = TREE_TYPE (jclass_node); - } - name = build_overload_with_type (CL_prefix, type); - class_decl = IDENTIFIER_GLOBAL_VALUE (name); - if (class_decl == NULL_TREE) - { - push_obstacks_nochange (); - end_temporary_allocation (); - class_decl = build_decl (VAR_DECL, name, TREE_TYPE (jclass_node)); - TREE_STATIC (class_decl) = 1; - DECL_EXTERNAL (class_decl) = 1; - TREE_PUBLIC (class_decl) = 1; - DECL_ARTIFICIAL (class_decl) = 1; - DECL_IGNORED_P (class_decl) = 1; - pushdecl_top_level (class_decl); - make_decl_rtl (class_decl, NULL_PTR, 1); - pop_obstacks (); - } - return class_decl; -} - -/* Called from cplus_expand_expr when expanding a NEW_EXPR. The return - value is immediately handed to expand_expr. */ - -tree -build_new_1 (exp) - tree exp; -{ - tree placement, init; - tree type, true_type, size, rval; - tree nelts = NULL_TREE; - tree alloc_expr, alloc_node = NULL_TREE; - int has_array = 0; - enum tree_code code = NEW_EXPR; - int use_cookie, nothrow, check_new; - int use_global_new; - int use_java_new = 0; - - placement = TREE_OPERAND (exp, 0); - type = TREE_OPERAND (exp, 1); - init = TREE_OPERAND (exp, 2); - use_global_new = NEW_EXPR_USE_GLOBAL (exp); - - if (TREE_CODE (type) == ARRAY_REF) - { - has_array = 1; - nelts = TREE_OPERAND (type, 1); - type = TREE_OPERAND (type, 0); - } - true_type = type; - - if (CP_TYPE_QUALS (type)) - type = TYPE_MAIN_VARIANT (type); - - /* If our base type is an array, then make sure we know how many elements - it has. */ - while (TREE_CODE (true_type) == ARRAY_TYPE) - { - tree this_nelts = array_type_nelts_top (true_type); - nelts = build_binary_op (MULT_EXPR, nelts, this_nelts); - true_type = TREE_TYPE (true_type); - } - - if (!complete_type_or_else (true_type, exp)) - return error_mark_node; - - if (has_array) - size = fold (build_binary_op (MULT_EXPR, size_in_bytes (true_type), - nelts)); - else - size = size_in_bytes (type); - - if (TREE_CODE (true_type) == VOID_TYPE) - { - error ("invalid type `void' for new"); - return error_mark_node; - } - - if (TYPE_LANG_SPECIFIC (true_type) - && CLASSTYPE_ABSTRACT_VIRTUALS (true_type)) - { - abstract_virtuals_error (NULL_TREE, true_type); - return error_mark_node; - } - - if (TYPE_LANG_SPECIFIC (true_type) && IS_SIGNATURE (true_type)) - { - signature_error (NULL_TREE, true_type); - return error_mark_node; - } - - /* When we allocate an array, and the corresponding deallocation - function takes a second argument of type size_t, and that's the - "usual deallocation function", we allocate some extra space at - the beginning of the array to store the size of the array. - - Well, that's what we should do. For backwards compatibility, we - have to do this whenever there's a two-argument array-delete - operator. - - FIXME: For -fnew-abi, we don't have to maintain backwards - compatibility and we should fix this. */ - use_cookie = (has_array && TYPE_VEC_NEW_USES_COOKIE (true_type) - && ! (placement && ! TREE_CHAIN (placement) - && TREE_TYPE (TREE_VALUE (placement)) == ptr_type_node)); - - if (use_cookie) - { - tree extra = BI_header_size; - - size = size_binop (PLUS_EXPR, size, extra); - } - - if (has_array) - { - code = VEC_NEW_EXPR; - - if (init && pedantic) - cp_pedwarn ("initialization in array new"); - } - - /* Allocate the object. */ - - if (! has_array && ! placement && flag_this_is_variable > 0 - && TYPE_NEEDS_CONSTRUCTING (true_type) && init != void_type_node) - { - if (init == NULL_TREE || TREE_CODE (init) == TREE_LIST) - rval = NULL_TREE; - else - { - error ("constructors take parameter lists"); - return error_mark_node; - } - } - else if (! placement && TYPE_FOR_JAVA (true_type)) - { - tree class_addr, alloc_decl; - tree class_decl = build_java_class_ref (true_type); - tree class_size = size_in_bytes (true_type); - static char alloc_name[] = "_Jv_AllocObject"; - use_java_new = 1; - alloc_decl = IDENTIFIER_GLOBAL_VALUE (get_identifier (alloc_name)); - if (alloc_decl == NULL_TREE) - fatal("call to Java constructor, while `%s' undefined", alloc_name); - class_addr = build1 (ADDR_EXPR, jclass_node, class_decl); - rval = build_function_call (alloc_decl, - tree_cons (NULL_TREE, class_addr, - build_tree_list (NULL_TREE, - class_size))); - rval = cp_convert (build_pointer_type (true_type), rval); - } - else - { - int susp = 0; - - if (flag_exceptions) - /* We will use RVAL when generating an exception handler for - this new-expression, so we must save it. */ - susp = suspend_momentary (); - - rval = build_op_new_call - (code, true_type, expr_tree_cons (NULL_TREE, size, placement), - LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL)); - rval = cp_convert (build_pointer_type (true_type), rval); - - if (flag_exceptions) - resume_momentary (susp); - } - - /* unless an allocation function is declared with an empty excep- - tion-specification (_except.spec_), throw(), it indicates failure to - allocate storage by throwing a bad_alloc exception (clause _except_, - _lib.bad.alloc_); it returns a non-null pointer otherwise If the allo- - cation function is declared with an empty exception-specification, - throw(), it returns null to indicate failure to allocate storage and a - non-null pointer otherwise. - - So check for a null exception spec on the op new we just called. */ - - nothrow = 0; - if (rval) - { - /* The CALL_EXPR. */ - tree t = TREE_OPERAND (rval, 0); - /* The function. */ - t = TREE_OPERAND (TREE_OPERAND (t, 0), 0); - nothrow = TYPE_NOTHROW_P (TREE_TYPE (t)); - } - check_new = (flag_check_new || nothrow) && ! use_java_new; - - if ((check_new || flag_exceptions) && rval) - { - alloc_expr = get_target_expr (rval); - alloc_node = rval = TREE_OPERAND (alloc_expr, 0); - } - else - alloc_expr = NULL_TREE; - - /* if rval is NULL_TREE I don't have to allocate it, but are we totally - sure we have some extra bytes in that case for the BI_header_size - cookies? And how does that interact with the code below? (mrs) */ - /* Finish up some magic for new'ed arrays */ - if (use_cookie && rval != NULL_TREE) - { - tree extra = BI_header_size; - tree cookie, exp1; - rval = convert (string_type_node, rval); /* for ptr arithmetic */ - rval = save_expr (build_binary_op (PLUS_EXPR, rval, extra)); - /* Store header info. */ - cookie = build_indirect_ref (build (MINUS_EXPR, - build_pointer_type (BI_header_type), - rval, extra), NULL_PTR); - exp1 = build (MODIFY_EXPR, void_type_node, - build_component_ref (cookie, nc_nelts_field_id, - NULL_TREE, 0), - nelts); - TREE_SIDE_EFFECTS (exp1) = 1; - rval = cp_convert (build_pointer_type (true_type), rval); - rval = build_compound_expr - (expr_tree_cons (NULL_TREE, exp1, - build_expr_list (NULL_TREE, rval))); - } - - if (rval == error_mark_node) - return error_mark_node; - - /* Don't call any constructors or do any initialization. */ - if (init == void_type_node) - goto done; - - if (TYPE_NEEDS_CONSTRUCTING (type) || init) - { - if (! TYPE_NEEDS_CONSTRUCTING (type) - && ! IS_AGGR_TYPE (type) && ! has_array) - { - /* We are processing something like `new int (10)', which - means allocate an int, and initialize it with 10. */ - tree deref; - tree deref_type; - - /* At present RVAL is a temporary variable, created to hold - the value from the call to `operator new'. We transform - it to (*RVAL = INIT, RVAL). */ - rval = save_expr (rval); - deref = build_indirect_ref (rval, NULL_PTR); - - /* Even for something like `new const int (10)' we must - allow the expression to be non-const while we do the - initialization. */ - deref_type = TREE_TYPE (deref); - if (CP_TYPE_CONST_P (deref_type)) - TREE_TYPE (deref) - = cp_build_qualified_type (deref_type, - CP_TYPE_QUALS (deref_type) - & ~TYPE_QUAL_CONST); - TREE_READONLY (deref) = 0; - - if (TREE_CHAIN (init) != NULL_TREE) - pedwarn ("initializer list being treated as compound expression"); - else if (TREE_CODE (init) == CONSTRUCTOR) - { - pedwarn ("initializer list appears where operand should be used"); - init = TREE_OPERAND (init, 1); - } - init = build_compound_expr (init); - - init = convert_for_initialization (deref, type, init, LOOKUP_NORMAL, - "new", NULL_TREE, 0); - rval = build (COMPOUND_EXPR, TREE_TYPE (rval), - build_modify_expr (deref, NOP_EXPR, init), - rval); - TREE_NO_UNUSED_WARNING (rval) = 1; - TREE_SIDE_EFFECTS (rval) = 1; - } - else if (! has_array) - { - tree newrval; - /* Constructors are never virtual. If it has an initialization, we - need to complain if we aren't allowed to use the ctor that took - that argument. */ - int flags = LOOKUP_NORMAL|LOOKUP_NONVIRTUAL|LOOKUP_COMPLAIN; - - if (rval && TYPE_USES_VIRTUAL_BASECLASSES (true_type)) - { - if (TYPE_USES_PVBASES (true_type) - && !flag_vtable_thunks_compat) - { - init = expr_tree_cons (NULL_TREE, vlist_zero_node, init); - flags |= LOOKUP_HAS_VLIST; - } - init = expr_tree_cons (NULL_TREE, integer_one_node, init); - flags |= LOOKUP_HAS_IN_CHARGE; - } - - if (use_java_new) - rval = save_expr (rval); - newrval = rval; - - if (newrval && TREE_CODE (TREE_TYPE (newrval)) == POINTER_TYPE) - newrval = build_indirect_ref (newrval, NULL_PTR); - - newrval = build_method_call (newrval, ctor_identifier, - init, TYPE_BINFO (true_type), flags); - - if (newrval == NULL_TREE || newrval == error_mark_node) - return error_mark_node; - - /* Java constructors compiled by jc1 do not return this. */ - if (use_java_new) - newrval = build (COMPOUND_EXPR, TREE_TYPE (newrval), - newrval, rval); - rval = newrval; - TREE_HAS_CONSTRUCTOR (rval) = 1; - } - else - rval = build (VEC_INIT_EXPR, TREE_TYPE (rval), - save_expr (rval), init, nelts); - - /* If any part of the object initialization terminates by throwing an - exception and a suitable deallocation function can be found, the - deallocation function is called to free the memory in which the - object was being constructed, after which the exception continues - to propagate in the context of the new-expression. If no - unambiguous matching deallocation function can be found, - propagating the exception does not cause the object's memory to be - freed. */ - if (flag_exceptions && alloc_expr && ! use_java_new) - { - enum tree_code dcode = has_array ? VEC_DELETE_EXPR : DELETE_EXPR; - tree cleanup, fn = NULL_TREE; - int flags = LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL); - - /* All cleanups must last longer than normal. */ - int yes = suspend_momentary (); - - if (placement) - { - flags |= LOOKUP_SPECULATIVELY; - - /* We expect alloc_expr to look like a TARGET_EXPR around - a NOP_EXPR around the CALL_EXPR we want. */ - fn = TREE_OPERAND (alloc_expr, 1); - fn = TREE_OPERAND (fn, 0); - } - - /* Copy size to the saveable obstack. */ - size = mapcar (size, permanent_p); - - cleanup = build_op_delete_call (dcode, alloc_node, size, flags, fn); - - resume_momentary (yes); - - /* Ack! First we allocate the memory. Then we set our sentry - variable to true, and expand a cleanup that deletes the memory - if sentry is true. Then we run the constructor and store the - returned pointer in buf. Then we clear sentry and return buf. */ - - if (cleanup) - { - tree end, sentry, begin, buf, t = TREE_TYPE (rval); - - begin = get_target_expr (boolean_true_node); - sentry = TREE_OPERAND (begin, 0); - - yes = suspend_momentary (); - TREE_OPERAND (begin, 2) - = build (COND_EXPR, void_type_node, sentry, - cleanup, void_zero_node); - resume_momentary (yes); - - rval = get_target_expr (rval); - - end = build (MODIFY_EXPR, TREE_TYPE (sentry), - sentry, boolean_false_node); - TREE_SIDE_EFFECTS (end) = 1; - - buf = TREE_OPERAND (rval, 0); - - rval = build (COMPOUND_EXPR, t, begin, - build (COMPOUND_EXPR, t, rval, - build (COMPOUND_EXPR, t, end, buf))); - } - } - } - else if (CP_TYPE_CONST_P (true_type)) - cp_error ("uninitialized const in `new' of `%#T'", true_type); - - done: - - if (alloc_expr && rval == alloc_node) - { - rval = TREE_OPERAND (alloc_expr, 1); - alloc_expr = NULL_TREE; - } - - if (check_new && alloc_expr) - { - /* Did we modify the storage? */ - tree ifexp = build_binary_op (NE_EXPR, alloc_node, - integer_zero_node); - rval = build_conditional_expr (ifexp, rval, alloc_node); - } - - if (alloc_expr) - rval = build (COMPOUND_EXPR, TREE_TYPE (rval), alloc_expr, rval); - - if (rval && TREE_TYPE (rval) != build_pointer_type (type)) - { - /* The type of new int [3][3] is not int *, but int [3] * */ - rval = build_c_cast (build_pointer_type (type), rval); - } - - return rval; -} - -static tree -build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete, - use_global_delete) - tree base, maxindex, type; - tree auto_delete_vec, auto_delete; - int use_global_delete; -{ - tree virtual_size; - tree ptype = build_pointer_type (type = complete_type (type)); - tree size_exp = size_in_bytes (type); - - /* Temporary variables used by the loop. */ - tree tbase, tbase_init; - - /* This is the body of the loop that implements the deletion of a - single element, and moves temp variables to next elements. */ - tree body; - - /* This is the LOOP_EXPR that governs the deletion of the elements. */ - tree loop; - - /* This is the thing that governs what to do after the loop has run. */ - tree deallocate_expr = 0; - - /* This is the BIND_EXPR which holds the outermost iterator of the - loop. It is convenient to set this variable up and test it before - executing any other code in the loop. - This is also the containing expression returned by this function. */ - tree controller = NULL_TREE; - - if (! IS_AGGR_TYPE (type) || ! TYPE_NEEDS_DESTRUCTOR (type)) - { - loop = integer_zero_node; - goto no_destructor; - } - - /* The below is short by BI_header_size */ - virtual_size = fold (size_binop (MULT_EXPR, size_exp, maxindex)); - - tbase = build_decl (VAR_DECL, NULL_TREE, ptype); - tbase_init = build_modify_expr (tbase, NOP_EXPR, - fold (build (PLUS_EXPR, ptype, - base, - virtual_size))); - DECL_REGISTER (tbase) = 1; - controller = build (BIND_EXPR, void_type_node, tbase, NULL_TREE, NULL_TREE); - TREE_SIDE_EFFECTS (controller) = 1; - - if (auto_delete != integer_zero_node - && auto_delete != integer_two_node) - { - tree base_tbd = cp_convert (ptype, - build_binary_op (MINUS_EXPR, - cp_convert (ptr_type_node, base), - BI_header_size)); - /* This is the real size */ - virtual_size = size_binop (PLUS_EXPR, virtual_size, BI_header_size); - body = build_expr_list (NULL_TREE, - build_x_delete (base_tbd, - 2 | use_global_delete, - virtual_size)); - body = build (COND_EXPR, void_type_node, - build (BIT_AND_EXPR, integer_type_node, - auto_delete, integer_one_node), - body, integer_zero_node); - } - else - body = NULL_TREE; - - body = expr_tree_cons (NULL_TREE, - build_delete (ptype, tbase, auto_delete, - LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 1), - body); - - body = expr_tree_cons (NULL_TREE, - build_modify_expr (tbase, NOP_EXPR, build (MINUS_EXPR, ptype, tbase, size_exp)), - body); - - body = expr_tree_cons (NULL_TREE, - build (EXIT_EXPR, void_type_node, - build (EQ_EXPR, boolean_type_node, base, tbase)), - body); - - loop = build (LOOP_EXPR, void_type_node, build_compound_expr (body)); - - loop = expr_tree_cons (NULL_TREE, tbase_init, - expr_tree_cons (NULL_TREE, loop, NULL_TREE)); - loop = build_compound_expr (loop); - - no_destructor: - /* If the delete flag is one, or anything else with the low bit set, - delete the storage. */ - if (auto_delete_vec == integer_zero_node) - deallocate_expr = integer_zero_node; - else - { - tree base_tbd; - - /* The below is short by BI_header_size */ - virtual_size = fold (size_binop (MULT_EXPR, size_exp, maxindex)); - - if (! TYPE_VEC_NEW_USES_COOKIE (type)) - /* no header */ - base_tbd = base; - else - { - base_tbd = cp_convert (ptype, - build_binary_op (MINUS_EXPR, - cp_convert (string_type_node, base), - BI_header_size)); - /* True size with header. */ - virtual_size = size_binop (PLUS_EXPR, virtual_size, BI_header_size); - } - deallocate_expr = build_x_delete (base_tbd, - 2 | use_global_delete, - virtual_size); - if (auto_delete_vec != integer_one_node) - deallocate_expr = build (COND_EXPR, void_type_node, - build (BIT_AND_EXPR, integer_type_node, - auto_delete_vec, integer_one_node), - deallocate_expr, integer_zero_node); - } - - if (loop && deallocate_expr != integer_zero_node) - { - body = expr_tree_cons (NULL_TREE, loop, - expr_tree_cons (NULL_TREE, deallocate_expr, NULL_TREE)); - body = build_compound_expr (body); - } - else - body = loop; - - /* Outermost wrapper: If pointer is null, punt. */ - body = build (COND_EXPR, void_type_node, - build (NE_EXPR, boolean_type_node, base, integer_zero_node), - body, integer_zero_node); - body = build1 (NOP_EXPR, void_type_node, body); - - if (controller) - { - TREE_OPERAND (controller, 1) = body; - return controller; - } - else - return cp_convert (void_type_node, body); -} - -/* Protect the vector initialization with a try-block so that we can - destroy the first few elements if constructing a later element - causes an exception to be thrown. TYPE is the type of the array - elements. */ - -static void -expand_vec_init_try_block (type) - tree type; -{ - if (!TYPE_NEEDS_DESTRUCTOR (type) || !flag_exceptions) - return; - - /* The code we generate looks like: - - try { - // Initialize the vector. - } catch (...) { - // Destory the elements that need destroying. - throw; - } - - Here we're just beginning the `try'. */ - - expand_eh_region_start (); -} - -/* Add code to destroy the array elements constructed so far if the - construction of some element in the array causes an exception to be - thrown. RVAL is the address of the last element in the array. - TYPE is the type of the array elements. MAXINDEX is the maximum - allowable index into the array. ITERATOR is an integer variable - indicating how many elements remain to be constructed. */ - -static void -expand_vec_init_catch_clause (rval, type, maxindex, iterator) - tree rval; - tree type; - tree maxindex; - tree iterator; -{ - tree e; - tree cleanup; - - if (!TYPE_NEEDS_DESTRUCTOR (type) || !flag_exceptions) - return; - - /* We have to ensure that this can live to the cleanup expansion - time, since we know it is only ever needed once, generate code - now. */ - push_obstacks_nochange (); - resume_temporary_allocation (); - - cleanup = make_node (RTL_EXPR); - TREE_TYPE (cleanup) = void_type_node; - RTL_EXPR_RTL (cleanup) = const0_rtx; - TREE_SIDE_EFFECTS (cleanup) = 1; - do_pending_stack_adjust (); - start_sequence_for_rtl_expr (cleanup); - - e = build_vec_delete_1 (rval, - build_binary_op (MINUS_EXPR, maxindex, - iterator), - type, - /*auto_delete_vec=*/integer_zero_node, - /*auto_delete=*/integer_zero_node, - /*use_global_delete=*/0); - expand_expr (e, const0_rtx, VOIDmode, EXPAND_NORMAL); - - do_pending_stack_adjust (); - RTL_EXPR_SEQUENCE (cleanup) = get_insns (); - end_sequence (); - cleanup = protect_with_terminate (cleanup); - expand_eh_region_end (cleanup); - pop_obstacks (); -} - -/* `expand_vec_init' performs initialization of a vector of aggregate - types. - - DECL is passed only for error reporting, and provides line number - and source file name information. - BASE is the space where the vector will be. - MAXINDEX is the maximum index of the array (one less than the - number of elements). - INIT is the (possibly NULL) initializer. - - FROM_ARRAY is 0 if we should init everything with INIT - (i.e., every element initialized from INIT). - FROM_ARRAY is 1 if we should index into INIT in parallel - with initialization of DECL. - FROM_ARRAY is 2 if we should index into INIT in parallel, - but use assignment instead of initialization. */ - -tree -expand_vec_init (decl, base, maxindex, init, from_array) - tree decl, base, maxindex, init; - int from_array; -{ - tree rval; - tree base2 = NULL_TREE; - tree type = TREE_TYPE (TREE_TYPE (base)); - tree size; - tree itype = NULL_TREE; - tree iterator; - int num_initialized_elts = 0; - - maxindex = cp_convert (ptrdiff_type_node, maxindex); - if (maxindex == error_mark_node) - return error_mark_node; - - if (current_function_decl == NULL_TREE) - { - rval = make_tree_vec (3); - TREE_VEC_ELT (rval, 0) = base; - TREE_VEC_ELT (rval, 1) = maxindex; - TREE_VEC_ELT (rval, 2) = init; - return rval; - } - - size = size_in_bytes (type); - - base = default_conversion (base); - base = cp_convert (build_pointer_type (type), base); - rval = get_temp_regvar (build_pointer_type (type), base); - base = get_temp_regvar (build_pointer_type (type), base); - iterator = get_temp_regvar (ptrdiff_type_node, maxindex); - - /* Protect the entire array initialization so that we can destroy - the partially constructed array if an exception is thrown. */ - expand_vec_init_try_block (type); - - if (init != NULL_TREE && TREE_CODE (init) == CONSTRUCTOR - && (!decl || same_type_p (TREE_TYPE (init), TREE_TYPE (decl)))) - { - /* Do non-default initialization resulting from brace-enclosed - initializers. */ - - tree elts; - tree baseref = build1 (INDIRECT_REF, type, base); - - from_array = 0; - - for (elts = CONSTRUCTOR_ELTS (init); elts; elts = TREE_CHAIN (elts)) - { - tree elt = TREE_VALUE (elts); - - num_initialized_elts++; - - if (IS_AGGR_TYPE (type) || TREE_CODE (type) == ARRAY_TYPE) - expand_aggr_init (baseref, elt, 0); - else - expand_assignment (baseref, elt, 0, 0); - - expand_assignment (base, - build (PLUS_EXPR, build_pointer_type (type), - base, size), - 0, 0); - expand_assignment (iterator, - build (MINUS_EXPR, ptrdiff_type_node, - iterator, integer_one_node), - 0, 0); - } - - /* Clear out INIT so that we don't get confused below. */ - init = NULL_TREE; - - if (obey_regdecls) - use_variable (DECL_RTL (base)); - } - else if (from_array) - { - /* If initializing one array from another, initialize element by - element. We rely upon the below calls the do argument - checking. */ - if (decl == NULL_TREE) - { - sorry ("initialization of array from dissimilar array type"); - return error_mark_node; - } - if (init) - { - base2 = default_conversion (init); - itype = TREE_TYPE (base2); - base2 = get_temp_regvar (itype, base2); - itype = TREE_TYPE (itype); - } - else if (TYPE_LANG_SPECIFIC (type) - && TYPE_NEEDS_CONSTRUCTING (type) - && ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type)) - { - error ("initializer ends prematurely"); - return error_mark_node; - } - } - - /* Now, default-initialize any remaining elements. We don't need to - do that if a) the type does not need constructing, or b) we've - already initialized all the elements. - - We do need to keep going if we're copying an array. */ - - if (from_array - || (TYPE_NEEDS_CONSTRUCTING (type) - && !(TREE_CODE (maxindex) == INTEGER_CST - && num_initialized_elts == TREE_INT_CST_LOW (maxindex) + 1))) - { - /* If the ITERATOR is equal to -1, then we don't have to loop; - we've already initialized all the elements. */ - expand_start_cond (build (NE_EXPR, boolean_type_node, - iterator, minus_one), - 0); - - /* Otherwise, loop through the elements. */ - expand_start_loop_continue_elsewhere (1); - - /* The initialization of each array element is a full-expression. */ - expand_start_target_temps (); - - if (from_array) - { - tree to = build1 (INDIRECT_REF, type, base); - tree from; - - if (base2) - from = build1 (INDIRECT_REF, itype, base2); - else - from = NULL_TREE; - - if (from_array == 2) - expand_expr_stmt (build_modify_expr (to, NOP_EXPR, from)); - else if (TYPE_NEEDS_CONSTRUCTING (type)) - expand_aggr_init (to, from, 0); - else if (from) - expand_assignment (to, from, 0, 0); - else - my_friendly_abort (57); - } - else if (TREE_CODE (type) == ARRAY_TYPE) - { - if (init != 0) - sorry ("cannot initialize multi-dimensional array with initializer"); - expand_vec_init (decl, - build1 (NOP_EXPR, - build_pointer_type (TREE_TYPE - (type)), - base), - array_type_nelts (type), 0, 0); - } - else - expand_aggr_init (build1 (INDIRECT_REF, type, base), init, 0); - - expand_assignment (base, - build (PLUS_EXPR, build_pointer_type (type), - base, size), 0, 0); - if (base2) - expand_assignment (base2, - build (PLUS_EXPR, build_pointer_type (type), - base2, size), 0, 0); - - /* Cleanup any temporaries needed for the initial value. */ - expand_end_target_temps (); - - expand_loop_continue_here (); - expand_exit_loop_if_false (0, build (NE_EXPR, boolean_type_node, - build (PREDECREMENT_EXPR, - ptrdiff_type_node, - iterator, - integer_one_node), - minus_one)); - - if (obey_regdecls) - { - use_variable (DECL_RTL (base)); - if (base2) - use_variable (DECL_RTL (base2)); - } - - expand_end_loop (); - expand_end_cond (); - } - - /* Make sure to cleanup any partially constructed elements. */ - expand_vec_init_catch_clause (rval, type, maxindex, iterator); - - if (obey_regdecls) - { - use_variable (DECL_RTL (iterator)); - use_variable (DECL_RTL (rval)); - } - - return rval; -} - -/* Free up storage of type TYPE, at address ADDR. - - TYPE is a POINTER_TYPE and can be ptr_type_node for no special type - of pointer. - - VIRTUAL_SIZE is the amount of storage that was allocated, and is - used as the second argument to operator delete. It can include - things like padding and magic size cookies. It has virtual in it, - because if you have a base pointer and you delete through a virtual - destructor, it should be the size of the dynamic object, not the - static object, see Free Store 12.5 ANSI C++ WP. - - This does not call any destructors. */ - -tree -build_x_delete (addr, which_delete, virtual_size) - tree addr; - int which_delete; - tree virtual_size; -{ - int use_global_delete = which_delete & 1; - int use_vec_delete = !!(which_delete & 2); - enum tree_code code = use_vec_delete ? VEC_DELETE_EXPR : DELETE_EXPR; - int flags = LOOKUP_NORMAL | (use_global_delete * LOOKUP_GLOBAL); - - return build_op_delete_call (code, addr, virtual_size, flags, NULL_TREE); -} - -/* Generate a call to a destructor. TYPE is the type to cast ADDR to. - ADDR is an expression which yields the store to be destroyed. - AUTO_DELETE is nonzero if a call to DELETE should be made or not. - If in the program, (AUTO_DELETE & 2) is non-zero, we tear down the - virtual baseclasses. - If in the program, (AUTO_DELETE & 1) is non-zero, then we deallocate. - - FLAGS is the logical disjunction of zero or more LOOKUP_ - flags. See cp-tree.h for more info. - - This function does not delete an object's virtual base classes. */ - -tree -build_delete (type, addr, auto_delete, flags, use_global_delete) - tree type, addr; - tree auto_delete; - int flags; - int use_global_delete; -{ - tree member; - tree expr; - tree ref; - - if (addr == error_mark_node) - return error_mark_node; - - /* Can happen when CURRENT_EXCEPTION_OBJECT gets its type - set to `error_mark_node' before it gets properly cleaned up. */ - if (type == error_mark_node) - return error_mark_node; - - type = TYPE_MAIN_VARIANT (type); - - if (TREE_CODE (type) == POINTER_TYPE) - { - type = TYPE_MAIN_VARIANT (TREE_TYPE (type)); - if (type != void_type_node && !complete_type_or_else (type, addr)) - return error_mark_node; - if (TREE_CODE (type) == ARRAY_TYPE) - goto handle_array; - if (! IS_AGGR_TYPE (type)) - { - /* Call the builtin operator delete. */ - return build_builtin_delete_call (addr); - } - if (TREE_SIDE_EFFECTS (addr)) - addr = save_expr (addr); - - /* throw away const and volatile on target type of addr */ - addr = convert_force (build_pointer_type (type), addr, 0); - ref = build_indirect_ref (addr, NULL_PTR); - } - else if (TREE_CODE (type) == ARRAY_TYPE) - { - handle_array: - if (TREE_SIDE_EFFECTS (addr)) - addr = save_expr (addr); - if (TYPE_DOMAIN (type) == NULL_TREE) - { - error ("unknown array size in delete"); - return error_mark_node; - } - return build_vec_delete (addr, array_type_nelts (type), - auto_delete, integer_zero_node, - use_global_delete); - } - else - { - /* Don't check PROTECT here; leave that decision to the - destructor. If the destructor is accessible, call it, - else report error. */ - addr = build_unary_op (ADDR_EXPR, addr, 0); - if (TREE_SIDE_EFFECTS (addr)) - addr = save_expr (addr); - - if (TREE_CONSTANT (addr)) - addr = convert_pointer_to (type, addr); - else - addr = convert_force (build_pointer_type (type), addr, 0); - - ref = build_indirect_ref (addr, NULL_PTR); - } - - my_friendly_assert (IS_AGGR_TYPE (type), 220); - - if (! TYPE_NEEDS_DESTRUCTOR (type)) - { - if (auto_delete == integer_zero_node) - return void_zero_node; - - return build_op_delete_call - (DELETE_EXPR, addr, c_sizeof_nowarn (type), - LOOKUP_NORMAL | (use_global_delete * LOOKUP_GLOBAL), - NULL_TREE); - } - - /* Below, we will reverse the order in which these calls are made. - If we have a destructor, then that destructor will take care - of the base classes; otherwise, we must do that here. */ - if (TYPE_HAS_DESTRUCTOR (type)) - { - tree passed_auto_delete; - tree do_delete = NULL_TREE; - tree ifexp; - - if (use_global_delete) - { - tree cond = fold (build (BIT_AND_EXPR, integer_type_node, - auto_delete, integer_one_node)); - tree call = build_builtin_delete_call (addr); - - cond = fold (build (COND_EXPR, void_type_node, cond, - call, void_zero_node)); - if (cond != void_zero_node) - do_delete = cond; - - passed_auto_delete = fold (build (BIT_AND_EXPR, integer_type_node, - auto_delete, integer_two_node)); - } - else - passed_auto_delete = auto_delete; - - /* Maybe pass vlist pointer to destructor. */ - if (TYPE_USES_PVBASES (type)) - { - /* Pass vlist_zero even if in backwards compatibility mode, - as the extra argument should not hurt if it is not used. */ - expr = build_expr_list (NULL_TREE, vlist_zero_node); - flags |= LOOKUP_HAS_VLIST; - } - else - expr = NULL_TREE; - - expr = expr_tree_cons (NULL_TREE, passed_auto_delete, expr); - - expr = build_method_call (ref, dtor_identifier, expr, - NULL_TREE, flags); - - if (do_delete) - expr = build (COMPOUND_EXPR, void_type_node, expr, do_delete); - - if (flags & LOOKUP_DESTRUCTOR) - /* Explicit destructor call; don't check for null pointer. */ - ifexp = integer_one_node; - else - /* Handle deleting a null pointer. */ - ifexp = fold (build_binary_op (NE_EXPR, addr, integer_zero_node)); - - if (ifexp != integer_one_node) - expr = build (COND_EXPR, void_type_node, - ifexp, expr, void_zero_node); - - return expr; - } - else - { - /* We only get here from finish_function for a destructor. */ - tree binfos = BINFO_BASETYPES (TYPE_BINFO (type)); - int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0; - tree base_binfo = n_baseclasses > 0 ? TREE_VEC_ELT (binfos, 0) : NULL_TREE; - tree exprstmt = NULL_TREE; - tree parent_auto_delete = auto_delete; - tree cond; - - /* Set this again before we call anything, as we might get called - recursively. */ - TYPE_HAS_DESTRUCTOR (type) = 1; - - /* If we have member delete or vbases, we call delete in - finish_function. */ - if (auto_delete == integer_zero_node) - cond = NULL_TREE; - else if (base_binfo == NULL_TREE - || ! TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo))) - { - cond = build (COND_EXPR, void_type_node, - build (BIT_AND_EXPR, integer_type_node, auto_delete, integer_one_node), - build_builtin_delete_call (addr), - void_zero_node); - } - else - cond = NULL_TREE; - - if (cond) - exprstmt = build_expr_list (NULL_TREE, cond); - - if (base_binfo - && ! TREE_VIA_VIRTUAL (base_binfo) - && TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo))) - { - tree this_auto_delete; - - /* Should the base invoke delete? */ - if (BINFO_OFFSET_ZEROP (base_binfo)) - this_auto_delete = parent_auto_delete; - else - this_auto_delete = integer_zero_node; - - expr = build_base_dtor_call (ref, base_binfo, this_auto_delete); - exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt); - } - - /* Take care of the remaining baseclasses. */ - for (i = 1; i < n_baseclasses; i++) - { - base_binfo = TREE_VEC_ELT (binfos, i); - if (! TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (base_binfo)) - || TREE_VIA_VIRTUAL (base_binfo)) - continue; - - expr = build_base_dtor_call (ref, base_binfo, integer_zero_node); - - exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt); - } - - for (member = TYPE_FIELDS (type); member; member = TREE_CHAIN (member)) - { - if (TREE_CODE (member) != FIELD_DECL) - continue; - if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (member))) - { - tree this_member = build_component_ref (ref, DECL_NAME (member), NULL_TREE, 0); - tree this_type = TREE_TYPE (member); - expr = build_delete (this_type, this_member, integer_two_node, flags, 0); - exprstmt = expr_tree_cons (NULL_TREE, expr, exprstmt); - } - } - - if (exprstmt) - return build_compound_expr (exprstmt); - /* Virtual base classes make this function do nothing. */ - return void_zero_node; - } -} - -/* For type TYPE, delete the virtual baseclass objects of DECL. */ - -tree -build_vbase_delete (type, decl) - tree type, decl; -{ - tree vbases = CLASSTYPE_VBASECLASSES (type); - tree result = NULL_TREE; - tree addr = build_unary_op (ADDR_EXPR, decl, 0); - - my_friendly_assert (addr != error_mark_node, 222); - - while (vbases) - { - tree this_addr = convert_force (build_pointer_type (BINFO_TYPE (vbases)), - addr, 0); - result = expr_tree_cons (NULL_TREE, - build_delete (TREE_TYPE (this_addr), this_addr, - integer_zero_node, - LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 0), - result); - vbases = TREE_CHAIN (vbases); - } - return build_compound_expr (nreverse (result)); -} - -/* Build a C++ vector delete expression. - MAXINDEX is the number of elements to be deleted. - ELT_SIZE is the nominal size of each element in the vector. - BASE is the expression that should yield the store to be deleted. - This function expands (or synthesizes) these calls itself. - AUTO_DELETE_VEC says whether the container (vector) should be deallocated. - AUTO_DELETE say whether each item in the container should be deallocated. - - This also calls delete for virtual baseclasses of elements of the vector. - - Update: MAXINDEX is no longer needed. The size can be extracted from the - start of the vector for pointers, and from the type for arrays. We still - use MAXINDEX for arrays because it happens to already have one of the - values we'd have to extract. (We could use MAXINDEX with pointers to - confirm the size, and trap if the numbers differ; not clear that it'd - be worth bothering.) */ - -tree -build_vec_delete (base, maxindex, auto_delete_vec, auto_delete, - use_global_delete) - tree base, maxindex; - tree auto_delete_vec, auto_delete; - int use_global_delete; -{ - tree type; - - if (TREE_CODE (base) == OFFSET_REF) - base = resolve_offset_ref (base); - - type = TREE_TYPE (base); - - base = stabilize_reference (base); - - /* Since we can use base many times, save_expr it. */ - if (TREE_SIDE_EFFECTS (base)) - base = save_expr (base); - - if (TREE_CODE (type) == POINTER_TYPE) - { - /* Step back one from start of vector, and read dimension. */ - tree cookie_addr = build (MINUS_EXPR, build_pointer_type (BI_header_type), - base, BI_header_size); - tree cookie = build_indirect_ref (cookie_addr, NULL_PTR); - maxindex = build_component_ref (cookie, nc_nelts_field_id, NULL_TREE, 0); - do - type = TREE_TYPE (type); - while (TREE_CODE (type) == ARRAY_TYPE); - } - else if (TREE_CODE (type) == ARRAY_TYPE) - { - /* get the total number of things in the array, maxindex is a bad name */ - maxindex = array_type_nelts_total (type); - while (TREE_CODE (type) == ARRAY_TYPE) - type = TREE_TYPE (type); - base = build_unary_op (ADDR_EXPR, base, 1); - } - else - { - if (base != error_mark_node) - error ("type to vector delete is neither pointer or array type"); - return error_mark_node; - } - - return build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete, - use_global_delete); -} diff --git a/contrib/gcc/cp/input.c b/contrib/gcc/cp/input.c deleted file mode 100644 index 9148c8656233..000000000000 --- a/contrib/gcc/cp/input.c +++ /dev/null @@ -1,207 +0,0 @@ -/* Input handling for G++. - Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc. - Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* G++ needs to do enough saving and re-parsing of text that it is - necessary to abandon the simple FILE* model and use a mechanism where - we can pre-empt one input stream with another derived from saved text; - we may need to do this arbitrarily often, and cannot depend on having - the GNU library available, so FILE objects just don't cut it. - - This file is written as a separate module, but can be included by - lex.c for very minor efficiency gains (primarily in function - inlining). */ - -#include "system.h" - -extern FILE *finput; - -struct input_source { - /* saved string */ - char *str; - int length; - /* current position, when reading as input */ - int offset; - /* linked list maintenance */ - struct input_source *next; - /* values to restore after reading all of current string */ - char *filename; - int lineno; - struct pending_input *input; - int putback_char; -}; - -static struct input_source *input, *free_inputs; - -extern char *input_filename; -extern int lineno; - -#if USE_CPPLIB -extern unsigned char *yy_cur, *yy_lim; -extern int yy_get_token (); -#define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ()) -#else -#define GETC() getc (finput) -#endif - -extern void feed_input PROTO((char *, int)); -extern void put_input PROTO((int)); -extern void put_back PROTO((int)); -extern int getch PROTO((void)); -extern int input_redirected PROTO((void)); - -static inline struct input_source * allocate_input PROTO((void)); -static inline void free_input PROTO((struct input_source *)); -static inline void end_input PROTO((void)); -static inline int sub_getch PROTO((void)); - -static inline struct input_source * -allocate_input () -{ - struct input_source *inp; - if (free_inputs) - { - inp = free_inputs; - free_inputs = inp->next; - inp->next = 0; - return inp; - } - inp = (struct input_source *) xmalloc (sizeof (struct input_source)); - inp->next = 0; - return inp; -} - -static inline void -free_input (inp) - struct input_source *inp; -{ - inp->str = 0; - inp->length = 0; - inp->next = free_inputs; - free_inputs = inp; -} - -static int putback_char = -1; - -/* Some of these external functions are declared inline in case this file - is included in lex.c. */ - -inline -void -feed_input (str, len) - char *str; - int len; -{ - struct input_source *inp = allocate_input (); - - /* This shouldn't be necessary. */ - while (len && !str[len-1]) - len--; - - inp->str = str; - inp->length = len; - inp->offset = 0; - inp->next = input; - inp->filename = input_filename; - inp->lineno = lineno; - inp->input = save_pending_input (); - inp->putback_char = putback_char; - putback_char = -1; - input = inp; -} - -struct pending_input *to_be_restored; /* XXX */ -extern int end_of_file; - -static inline void -end_input () -{ - struct input_source *inp = input; - - end_of_file = 0; - input = inp->next; - input_filename = inp->filename; - lineno = inp->lineno; - /* Get interface/implementation back in sync. */ - extract_interface_info (); - putback_char = inp->putback_char; - restore_pending_input (inp->input); - free_input (inp); -} - -static inline int -sub_getch () -{ - if (putback_char != -1) - { - int ch = putback_char; - putback_char = -1; - return ch; - } - if (input) - { - if (input->offset >= input->length) - { - my_friendly_assert (putback_char == -1, 223); - ++(input->offset); - if (input->offset - input->length < 64) - return EOF; - - /* We must be stuck in an error-handling rule; give up. */ - end_input (); - return getch (); - } - return (unsigned char)input->str[input->offset++]; - } - return GETC (); -} - -inline -void -put_back (ch) - int ch; -{ - if (ch != EOF) - { - my_friendly_assert (putback_char == -1, 224); - putback_char = ch; - } -} - -extern int linemode; - -int -getch () -{ - int ch = sub_getch (); - if (linemode && ch == '\n') - { - put_back (ch); - ch = EOF; - } - return ch; -} - -inline -int -input_redirected () -{ - return input != 0; -} diff --git a/contrib/gcc/cp/lang-options.h b/contrib/gcc/cp/lang-options.h deleted file mode 100644 index cfc64564028f..000000000000 --- a/contrib/gcc/cp/lang-options.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Definitions for switches for C++. - Copyright (C) 1995, 96-97, 1998 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -DEFINE_LANG_NAME ("C++") - -/* This is the contribution to the `lang_options' array in gcc.c for - g++. */ - - { "-faccess-control", "" }, - { "-fno-access-control", "Do not obey access control semantics" }, - { "-fall-virtual", "Make all member functions virtual" }, - { "-fno-all-virtual", "" }, - { "-falt-external-templates", "Change when template instances are emitted" }, - { "-fno-alt-external-templates", "" }, - { "-fansi-overloading", "" }, - { "-fno-ansi-overloading", "" }, - { "-fcheck-new", "Check the return value of new" }, - { "-fno-check-new", "" }, - { "-fconserve-space", "Reduce size of object files" }, - { "-fno-conserve-space", "" }, - { "-fconst-strings", "" }, - { "-fno-const-strings", "Make string literals `char[]' instead of `const char[]'" }, - { "-fdefault-inline", "" }, - { "-fno-default-inline", "Do not inline member functions by default"}, - { "-frtti", "" }, - { "-fno-rtti", "Do not generate run time type descriptor information" }, - { "-felide-constructors", "" }, - { "-fno-elide-constructors", "" }, - { "-fenum-int-equiv", "" }, - { "-fno-enum-int-equiv", "" }, - { "-fexternal-templates", "" }, - { "-fno-external-templates", "" }, - { "-ffor-scope", "" }, - { "-fno-for-scope", "Scope of for-init-statement vars extends outside" }, - { "-fguiding-decls", "Implement guiding declarations" }, - { "-fno-guiding-decls", "" }, - { "-fgnu-keywords", "" }, - { "-fno-gnu-keywords", "Do not recognise GNU defined keywords" }, - { "-fhandle-exceptions", "" }, - { "-fno-handle-exceptions", "" }, - { "-fhandle-signatures", "Handle signature language constructs" }, - { "-fno-handle-signatures", "" }, - { "-fhonor-std", "Treat the namespace `std' as a normal namespace" }, - { "-fno-honor-std", "" }, - { "-fhuge-objects", "Enable support for huge objects" }, - { "-fno-huge-objects", "" }, - { "-fimplement-inlines", "" }, - { "-fno-implement-inlines", "Export functions even if they can be inlined" }, - { "-fimplicit-templates", "" }, - { "-fno-implicit-templates", "Only emit explicit template instatiations" }, - { "-fimplicit-inline-templates", "" }, - { "-fno-implicit-inline-templates", "Only emit explicit instatiations of inline templates" }, - { "-finit-priority", "Handle the init_priority attribute" }, - { "-fno-init-priority", "" }, - { "-flabels-ok", "Labels can be used as first class objects" }, - { "-fno-labels-ok", "" }, - { "-fmemoize-lookups", "" }, - { "-fno-memoize-lookups", "" }, - { "-fname-mangling-version-", "" }, - { "-fnew-abi", "Enable experimental ABI changes" }, - { "-fno-new-abi", "" }, - { "-fnonnull-objects", "" }, - { "-fno-nonnull-objects", "Do not assume that a reference is always valid" }, - { "-foperator-names", "Recognise and/bitand/bitor/compl/not/or/xor" }, - { "-fno-operator-names", "" }, - { "-foptional-diags", "" }, - { "-fno-optional-diags", "Disable optional diagnostics" }, - { "-fpermissive", "Downgrade conformance errors to warnings" }, - { "-fno-permissive", "" }, - { "-frepo", "Enable automatic template instantiation" }, - { "-fno-repo", "" }, - { "-fsave-memoized", "" }, - { "-fno-save-memoized", "" }, - { "-fsquangle", "Enable squashed name mangling" }, - { "-fno-squangle", "" }, - { "-fstats", "Display statistics accumulated during compilation" }, - { "-fno-stats", "" }, - { "-fstrict-prototype", "" }, - { "-fno-strict-prototype", "Do not assume that empty prototype means no args" }, - { "-ftemplate-depth-", "Specify maximum template instantiation depth"}, - { "-fthis-is-variable", "Make 'this' not be type '* const'" }, - { "-fno-this-is-variable", "" }, - { "-fvtable-gc", "Discard unused virtual functions" }, - { "-fno-vtable-gc", "" }, - { "-fvtable-thunks", "Implement vtables using thunks" }, - { "-fno-vtable-thunks", "" }, - { "-fweak", "Emit common-like symbols as weak symbols" }, - { "-fno-weak", "" }, - { "-fxref", "Emit cross referencing information" }, - { "-fno-xref", "" }, - - { "-Wreturn-type", "Warn about inconsistent return types" }, - { "-Wno-return-type", "" }, - { "-Woverloaded-virtual", "Warn about overloaded virtual function names" }, - { "-Wno-overloaded-virtual", "" }, - { "-Wctor-dtor-privacy", "" }, - { "-Wno-ctor-dtor-privacy", "Don't warn when all ctors/dtors are private" }, - { "-Wnon-virtual-dtor", "Warn about non virtual destructors" }, - { "-Wno-non-virtual-dtor", "" }, - { "-Wextern-inline", "Warn when a function is declared extern, then inline" }, - { "-Wno-extern-inline", "" }, - { "-Wreorder", "Warn when the compiler reorders code" }, - { "-Wno-reorder", "" }, - { "-Wsynth", "Warn when synthesis behaviour differs from Cfront" }, - { "-Wno-synth", "" }, - { "-Wpmf-conversions", "" }, - { "-Wno-pmf-conversions", "Don't warn when type converting pointers to member functions" }, - { "-Weffc++", "Warn about violations of Effective C++ style rules" }, - { "-Wno-effc++", "" }, - { "-Wsign-promo", "Warn when overload promotes from unsigned to signed" }, - { "-Wno-sign-promo", "" }, - { "-Wold-style-cast", "Warn if a C style cast is used in a program" }, - { "-Wno-old-style-cast", "" }, - { "-Wnon-template-friend", "" }, - { "-Wno-non-template-friend", "Don't warn when non-templatized friend functions are declared within a template" }, - { "-Wdeprecated", "" }, - { "-Wno-deprecated", "Don't announce deprecation of compiler features" }, diff --git a/contrib/gcc/cp/lang-specs.h b/contrib/gcc/cp/lang-specs.h deleted file mode 100644 index 648bc1f09536..000000000000 --- a/contrib/gcc/cp/lang-specs.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Definitions for specs for C++. - Copyright (C) 1995, 96-98, 1999 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This is the contribution to the `default_compilers' array in gcc.c for - g++. */ - - {".cc", {"@c++"}}, - {".cp", {"@c++"}}, - {".cxx", {"@c++"}}, - {".cpp", {"@c++"}}, - {".c++", {"@c++"}}, - {".C", {"@c++"}}, - {"@c++", -#if USE_CPPLIB - { - "%{E|M|MM:cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ - %{C:%{!E:%eGNU C++ does not support -C without using -E}}\ - %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - %{!no-gcc:-D__GNUC__=%v1 -D__GNUG__=%v1 -D__GNUC_MINOR__=%v2}\ - -D__cplusplus\ - %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\ - %{!fno-exceptions:-D__EXCEPTIONS}\ - %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\ - %{ffast-math:-D__FAST_MATH__}\ - %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ - %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\ - %{!E:%{!M:%{!MM:cc1plus %i %1 %2\ - -lang-c++ %{nostdinc*} %{C} %{A*} %{I*} %{P} %{$} %I\ - %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - %{!no-gcc:-D__GNUC__=%v1 -D__GNUG__=%v1\ - -D__GNUC_MINOR__=%v2} -D__cplusplus\ - %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\ - %{!fno-exceptions:-D__EXCEPTIONS}\ - %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ - %{ffast-math:-D__FAST_MATH__}\ - %{trigraphs}\ - %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\ - %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\ - %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ - %{v:-version} %{pg:-p} %{p}\ - %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\ - %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ - %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}}|\n\ - %{!S:as %a %Y\ - %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ - %{!pipe:%g.s} %A\n }}}}"}}, -#else /* ! USE_CPPLIB */ - {"cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ - %{C:%{!E:%eGNU C++ does not support -C without using -E}}\ - %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ - %{!no-gcc:-D__GNUC__=%v1 -D__GNUG__=%v1 -D__GNUC_MINOR__=%v2}\ - -D__cplusplus\ - %{ansi:-trigraphs -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\ - %{!fno-exceptions:-D__EXCEPTIONS}\ - %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{trigraphs}\ - %{ffast-math:-D__FAST_MATH__}\ - %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ - %i %{!M:%{!MM:%{!E:%{!pipe:%g.ii}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", - "%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.ii} %1 %2\ - %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\ - %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\ - %{v:-version} %{pg:-p} %{p}\ - %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\ - %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ - %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}}|\n\ - %{!S:as %a %Y\ - %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ - %{!pipe:%g.s} %A\n }}}}"}}, -#endif /* ! USE_CPPLIB */ - {".ii", {"@c++-cpp-output"}}, - {"@c++-cpp-output", - {"%{!M:%{!MM:%{!E:cc1plus %i %1 %2 %{!Q:-quiet} %{d*} %{m*} %{a}\ - %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi}\ - %{v:-version} %{pg:-p} %{p}\ - %{f*} %{+e*} %{aux-info*} %{Qn:-fno-ident}\ - %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ - %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ - %{!S:as %a %Y\ - %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ - %{!pipe:%g.s} %A\n }}}}"}}, diff --git a/contrib/gcc/cp/lex.c b/contrib/gcc/cp/lex.c deleted file mode 100644 index d9f2262f69d3..000000000000 --- a/contrib/gcc/cp/lex.c +++ /dev/null @@ -1,5025 +0,0 @@ -/* Separate lexical analyzer for GNU C++. - Copyright (C) 1987, 89, 92-98, 1999 Free Software Foundation, Inc. - Hacked by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* This file is the lexical analyzer for GNU C++. */ - -/* Cause the `yydebug' variable to be defined. */ -#define YYDEBUG 1 - -#include "config.h" -#include "system.h" -#include "input.h" -#include "tree.h" -#include "lex.h" -#include "cp-tree.h" -#include "parse.h" -#include "flags.h" -#include "obstack.h" -#include "c-pragma.h" -#include "toplev.h" -#include "output.h" - -#ifdef MULTIBYTE_CHARS -#include "mbchar.h" -#include -#endif - -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -extern struct obstack permanent_obstack; -extern struct obstack *current_obstack, *saveable_obstack; - -extern void yyprint PROTO((FILE *, int, YYSTYPE)); - -static tree get_time_identifier PROTO((const char *)); -static int check_newline PROTO((void)); -static int skip_white_space PROTO((int)); -static void finish_defarg PROTO((void)); -static int my_get_run_time PROTO((void)); -static int get_last_nonwhite_on_line PROTO((void)); -static int interface_strcmp PROTO((const char *)); -static int readescape PROTO((int *)); -static char *extend_token_buffer PROTO((const char *)); -static void consume_string PROTO((struct obstack *, int)); -static int set_typedecl_interface_info PROTO((tree *, void *)); -static void feed_defarg PROTO((tree, tree)); -static int set_vardecl_interface_info PROTO((tree *, void *)); -static void store_pending_inline PROTO((tree, struct pending_inline *)); -static void reinit_parse_for_expr PROTO((struct obstack *)); -static int *init_cpp_parse PROTO((void)); -static int handle_cp_pragma PROTO((const char *)); -#ifdef HANDLE_GENERIC_PRAGMAS -static int handle_generic_pragma PROTO((int)); -#endif -#ifdef GATHER_STATISTICS -#ifdef REDUCE_LENGTH -static int reduce_cmp PROTO((int *, int *)); -static int token_cmp PROTO((int *, int *)); -#endif -#endif -static void begin_definition_of_inclass_inline PROTO((struct pending_inline*)); -static void parse_float PROTO((PTR)); -static int is_global PROTO((tree)); -static void init_filename_times PROTO((void)); - -/* Given a file name X, return the nondirectory portion. - Keep in mind that X can be computed more than once. */ -char * -file_name_nondirectory (x) - const char *x; -{ - char *tmp = (char *) rindex (x, '/'); - if (DIR_SEPARATOR != '/' && ! tmp) - tmp = (char *) rindex (x, DIR_SEPARATOR); - if (tmp) - return (char *) (tmp + 1); - else - return (char *) x; -} - -/* This obstack is needed to hold text. It is not safe to use - TOKEN_BUFFER because `check_newline' calls `yylex'. */ -struct obstack inline_text_obstack; -char *inline_text_firstobj; - -#if USE_CPPLIB -#include "cpplib.h" -extern cpp_reader parse_in; -extern cpp_options parse_options; -extern unsigned char *yy_cur, *yy_lim; -#else -FILE *finput; -#endif -int end_of_file; - -/* Pending language change. - Positive is push count, negative is pop count. */ -int pending_lang_change = 0; - -/* Wrap the current header file in extern "C". */ -static int c_header_level = 0; - -extern int first_token; -extern struct obstack token_obstack; - -/* ??? Don't really know where this goes yet. */ -#if 1 -#include "input.c" -#else -extern void put_back (/* int */); -extern int input_redirected (); -extern void feed_input (/* char *, int */); -#endif - -/* Holds translations from TREE_CODEs to operator name strings, - i.e., opname_tab[PLUS_EXPR] == "+". */ -char **opname_tab; -char **assignop_tab; - -extern int yychar; /* the lookahead symbol */ -extern YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ - -#if 0 -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - - -/* the declaration found for the last IDENTIFIER token read in. - yylex must look this up to detect typedefs, which get token type TYPENAME, - so it is left around in case the identifier is not a typedef but is - used in a context which makes it a reference to a variable. */ -tree lastiddecl; - -/* The elements of `ridpointers' are identifier nodes - for the reserved type names and storage classes. - It is indexed by a RID_... value. */ -tree ridpointers[(int) RID_MAX]; - -/* We may keep statistics about how long which files took to compile. */ -static int header_time, body_time; -static tree filename_times; -static tree this_filename_time; - -/* Array for holding counts of the numbers of tokens seen. */ -extern int *token_count; - -/* Return something to represent absolute declarators containing a *. - TARGET is the absolute declarator that the * contains. - CV_QUALIFIERS is a list of modifiers such as const or volatile - to apply to the pointer type, represented as identifiers. - - We return an INDIRECT_REF whose "contents" are TARGET - and whose type is the modifier list. */ - -tree -make_pointer_declarator (cv_qualifiers, target) - tree cv_qualifiers, target; -{ - if (target && TREE_CODE (target) == IDENTIFIER_NODE - && ANON_AGGRNAME_P (target)) - error ("type name expected before `*'"); - target = build_parse_node (INDIRECT_REF, target); - TREE_TYPE (target) = cv_qualifiers; - return target; -} - -/* Return something to represent absolute declarators containing a &. - TARGET is the absolute declarator that the & contains. - CV_QUALIFIERS is a list of modifiers such as const or volatile - to apply to the reference type, represented as identifiers. - - We return an ADDR_EXPR whose "contents" are TARGET - and whose type is the modifier list. */ - -tree -make_reference_declarator (cv_qualifiers, target) - tree cv_qualifiers, target; -{ - if (target) - { - if (TREE_CODE (target) == ADDR_EXPR) - { - error ("cannot declare references to references"); - return target; - } - if (TREE_CODE (target) == INDIRECT_REF) - { - error ("cannot declare pointers to references"); - return target; - } - if (TREE_CODE (target) == IDENTIFIER_NODE && ANON_AGGRNAME_P (target)) - error ("type name expected before `&'"); - } - target = build_parse_node (ADDR_EXPR, target); - TREE_TYPE (target) = cv_qualifiers; - return target; -} - -tree -make_call_declarator (target, parms, cv_qualifiers, exception_specification) - tree target, parms, cv_qualifiers, exception_specification; -{ - target = build_parse_node (CALL_EXPR, target, parms, cv_qualifiers); - TREE_TYPE (target) = exception_specification; - return target; -} - -void -set_quals_and_spec (call_declarator, cv_qualifiers, exception_specification) - tree call_declarator, cv_qualifiers, exception_specification; -{ - TREE_OPERAND (call_declarator, 2) = cv_qualifiers; - TREE_TYPE (call_declarator) = exception_specification; -} - -/* Build names and nodes for overloaded operators. */ - -tree ansi_opname[LAST_CPLUS_TREE_CODE]; -tree ansi_assopname[LAST_CPLUS_TREE_CODE]; - -char * -operator_name_string (name) - tree name; -{ - char *opname = IDENTIFIER_POINTER (name) + 2; - tree *opname_table; - int i, assign; - - /* Works for builtin and user defined types. */ - if (IDENTIFIER_GLOBAL_VALUE (name) - && TREE_CODE (IDENTIFIER_GLOBAL_VALUE (name)) == TYPE_DECL) - return IDENTIFIER_POINTER (name); - - if (opname[0] == 'a' && opname[2] != '\0' && opname[2] != '_') - { - opname += 1; - assign = 1; - opname_table = ansi_assopname; - } - else - { - assign = 0; - opname_table = ansi_opname; - } - - for (i = 0; i < (int) LAST_CPLUS_TREE_CODE; i++) - { - if (opname[0] == IDENTIFIER_POINTER (opname_table[i])[2+assign] - && opname[1] == IDENTIFIER_POINTER (opname_table[i])[3+assign]) - break; - } - - if (i == LAST_CPLUS_TREE_CODE) - return ""; - - if (assign) - return assignop_tab[i]; - else - return opname_tab[i]; -} - -int interface_only; /* whether or not current file is only for - interface definitions. */ -int interface_unknown; /* whether or not we know this class - to behave according to #pragma interface. */ - -/* lexical analyzer */ - -#ifndef WCHAR_TYPE_SIZE -#ifdef INT_TYPE_SIZE -#define WCHAR_TYPE_SIZE INT_TYPE_SIZE -#else -#define WCHAR_TYPE_SIZE BITS_PER_WORD -#endif -#endif - -/* Number of bytes in a wide character. */ -#define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT) - -static int maxtoken; /* Current nominal length of token buffer. */ -char *token_buffer; /* Pointer to token buffer. - Actual allocated length is maxtoken + 2. */ - -#include "hash.h" - - -/* Nonzero tells yylex to ignore \ in string constants. */ -static int ignore_escape_flag = 0; - -static tree -get_time_identifier (name) - const char *name; -{ - tree time_identifier; - int len = strlen (name); - char *buf = (char *) alloca (len + 6); - strcpy (buf, "file "); - bcopy (name, buf+5, len); - buf[len+5] = '\0'; - time_identifier = get_identifier (buf); - if (TIME_IDENTIFIER_TIME (time_identifier) == NULL_TREE) - { - push_obstacks_nochange (); - end_temporary_allocation (); - TIME_IDENTIFIER_TIME (time_identifier) = build_int_2 (0, 0); - TIME_IDENTIFIER_FILEINFO (time_identifier) - = build_int_2 (0, 1); - SET_IDENTIFIER_GLOBAL_VALUE (time_identifier, filename_times); - filename_times = time_identifier; - pop_obstacks (); - } - return time_identifier; -} - -#ifdef __GNUC__ -__inline -#endif -static int -my_get_run_time () -{ - int old_quiet_flag = quiet_flag; - int this_time; - quiet_flag = 0; - this_time = get_run_time (); - quiet_flag = old_quiet_flag; - return this_time; -} - -/* Table indexed by tree code giving a string containing a character - classifying the tree code. Possibilities are - t, d, s, c, r, <, 1 and 2. See cp/cp-tree.def for details. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, - -char cplus_tree_code_type[] = { - 'x', -#include "cp-tree.def" -}; -#undef DEFTREECODE - -/* Table indexed by tree code giving number of expression - operands beyond the fixed part of the node structure. - Not used for types or decls. */ - -#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, - -int cplus_tree_code_length[] = { - 0, -#include "cp-tree.def" -}; -#undef DEFTREECODE - -/* Names of tree components. - Used for printing out the tree and error messages. */ -#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, - -const char *cplus_tree_code_name[] = { - "@@dummy", -#include "cp-tree.def" -}; -#undef DEFTREECODE - -/* toplev.c needs to call these. */ - -void -lang_init_options () -{ -#if USE_CPPLIB - cpp_reader_init (&parse_in); - parse_in.opts = &parse_options; - cpp_options_init (&parse_options); -#endif - - /* Default exceptions on. */ - flag_exceptions = 1; -} - -void -lang_init () -{ - /* the beginning of the file is a new line; check for # */ - /* With luck, we discover the real source file's name from that - and put it in input_filename. */ -#if ! USE_CPPLIB - put_back (check_newline ()); -#else - check_newline (); - yy_cur--; -#endif - if (flag_gnu_xref) GNU_xref_begin (input_filename); - init_repo (input_filename); -} - -void -lang_finish () -{ - extern int errorcount, sorrycount; - if (flag_gnu_xref) GNU_xref_end (errorcount+sorrycount); -} - -char * -lang_identify () -{ - return "cplusplus"; -} - -static void -init_filename_times () -{ - this_filename_time = get_time_identifier (""); - if (flag_detailed_statistics) - { - header_time = 0; - body_time = my_get_run_time (); - TREE_INT_CST_LOW (TIME_IDENTIFIER_TIME (this_filename_time)) - = body_time; - } -} - -/* Change by Bryan Boreham, Kewill, Thu Jul 27 09:46:05 1989. - Stuck this hack in to get the files open correctly; this is called - in place of init_parse if we are an unexec'd binary. */ - -#if 0 -void -reinit_lang_specific () -{ - init_filename_times (); - reinit_search_statistics (); -} -#endif - -static int * -init_cpp_parse () -{ -#ifdef GATHER_STATISTICS -#ifdef REDUCE_LENGTH - reduce_count = (int *)malloc (sizeof (int) * (REDUCE_LENGTH + 1)); - bzero (reduce_count, sizeof (int) * (REDUCE_LENGTH + 1)); - reduce_count += 1; - token_count = (int *)malloc (sizeof (int) * (TOKEN_LENGTH + 1)); - bzero (token_count, sizeof (int) * (TOKEN_LENGTH + 1)); - token_count += 1; -#endif -#endif - return token_count; -} - -char * -init_parse (filename) - char *filename; -{ - extern int flag_no_gnu_keywords; - extern int flag_operator_names; - - int i; - -#ifdef MULTIBYTE_CHARS - /* Change to the native locale for multibyte conversions. */ - setlocale (LC_CTYPE, ""); - literal_codeset = getenv ("LANG"); -#endif - -#if USE_CPPLIB - parse_in.show_column = 1; - if (! cpp_start_read (&parse_in, filename)) - abort (); - - /* cpp_start_read always puts at least one line directive into the - token buffer. We must arrange to read it out here. */ - yy_cur = parse_in.token_buffer; - yy_lim = CPP_PWRITTEN (&parse_in); - -#else - /* Open input file. */ - if (filename == 0 || !strcmp (filename, "-")) - { - finput = stdin; - filename = "stdin"; - } - else - finput = fopen (filename, "r"); - if (finput == 0) - pfatal_with_name (filename); - -#ifdef IO_BUFFER_SIZE - setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE); -#endif -#endif /* !USE_CPPLIB */ - - /* Initialize the lookahead machinery. */ - init_spew (); - - /* Make identifier nodes long enough for the language-specific slots. */ - set_identifier_size (sizeof (struct lang_identifier)); - decl_printable_name = lang_printable_name; - - init_cplus_expand (); - - bcopy (cplus_tree_code_type, - tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE, - (int)LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE); - bcopy ((char *)cplus_tree_code_length, - (char *)(tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE), - (LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (int)); - bcopy ((char *)cplus_tree_code_name, - (char *)(tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE), - (LAST_CPLUS_TREE_CODE - (int)LAST_AND_UNUSED_TREE_CODE) * sizeof (char *)); - - opname_tab = (char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *)); - bzero ((char *)opname_tab, (int)LAST_CPLUS_TREE_CODE * sizeof (char *)); - assignop_tab = (char **)oballoc ((int)LAST_CPLUS_TREE_CODE * sizeof (char *)); - bzero ((char *)assignop_tab, (int)LAST_CPLUS_TREE_CODE * sizeof (char *)); - - ansi_opname[0] = get_identifier (""); - for (i = 0; i < (int) LAST_CPLUS_TREE_CODE; i++) - { - ansi_opname[i] = ansi_opname[0]; - ansi_assopname[i] = ansi_opname[0]; - } - - ansi_opname[(int) MULT_EXPR] = get_identifier ("__ml"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) MULT_EXPR]) = 1; - ansi_opname[(int) INDIRECT_REF] = ansi_opname[(int) MULT_EXPR]; - ansi_assopname[(int) MULT_EXPR] = get_identifier ("__aml"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) MULT_EXPR]) = 1; - ansi_assopname[(int) INDIRECT_REF] = ansi_assopname[(int) MULT_EXPR]; - ansi_opname[(int) TRUNC_MOD_EXPR] = get_identifier ("__md"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUNC_MOD_EXPR]) = 1; - ansi_assopname[(int) TRUNC_MOD_EXPR] = get_identifier ("__amd"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) TRUNC_MOD_EXPR]) = 1; - ansi_opname[(int) CEIL_MOD_EXPR] = ansi_opname[(int) TRUNC_MOD_EXPR]; - ansi_opname[(int) FLOOR_MOD_EXPR] = ansi_opname[(int) TRUNC_MOD_EXPR]; - ansi_opname[(int) ROUND_MOD_EXPR] = ansi_opname[(int) TRUNC_MOD_EXPR]; - ansi_opname[(int) MINUS_EXPR] = get_identifier ("__mi"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) MINUS_EXPR]) = 1; - ansi_opname[(int) NEGATE_EXPR] = ansi_opname[(int) MINUS_EXPR]; - ansi_assopname[(int) MINUS_EXPR] = get_identifier ("__ami"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) MINUS_EXPR]) = 1; - ansi_assopname[(int) NEGATE_EXPR] = ansi_assopname[(int) MINUS_EXPR]; - ansi_opname[(int) RSHIFT_EXPR] = get_identifier ("__rs"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) RSHIFT_EXPR]) = 1; - ansi_assopname[(int) RSHIFT_EXPR] = get_identifier ("__ars"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) RSHIFT_EXPR]) = 1; - ansi_opname[(int) NE_EXPR] = get_identifier ("__ne"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) NE_EXPR]) = 1; - ansi_opname[(int) GT_EXPR] = get_identifier ("__gt"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) GT_EXPR]) = 1; - ansi_opname[(int) GE_EXPR] = get_identifier ("__ge"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) GE_EXPR]) = 1; - ansi_opname[(int) BIT_IOR_EXPR] = get_identifier ("__or"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_IOR_EXPR]) = 1; - ansi_assopname[(int) BIT_IOR_EXPR] = get_identifier ("__aor"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) BIT_IOR_EXPR]) = 1; - ansi_opname[(int) TRUTH_ANDIF_EXPR] = get_identifier ("__aa"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUTH_ANDIF_EXPR]) = 1; - ansi_opname[(int) TRUTH_NOT_EXPR] = get_identifier ("__nt"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUTH_NOT_EXPR]) = 1; - ansi_opname[(int) PREINCREMENT_EXPR] = get_identifier ("__pp"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) PREINCREMENT_EXPR]) = 1; - ansi_opname[(int) POSTINCREMENT_EXPR] = ansi_opname[(int) PREINCREMENT_EXPR]; - ansi_opname[(int) MODIFY_EXPR] = get_identifier ("__as"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) MODIFY_EXPR]) = 1; - ansi_assopname[(int) NOP_EXPR] = ansi_opname[(int) MODIFY_EXPR]; - ansi_opname[(int) COMPOUND_EXPR] = get_identifier ("__cm"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) COMPOUND_EXPR]) = 1; - ansi_opname[(int) EXACT_DIV_EXPR] = get_identifier ("__dv"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) EXACT_DIV_EXPR]) = 1; - ansi_assopname[(int) EXACT_DIV_EXPR] = get_identifier ("__adv"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) EXACT_DIV_EXPR]) = 1; - ansi_opname[(int) TRUNC_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR]; - ansi_opname[(int) CEIL_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR]; - ansi_opname[(int) FLOOR_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR]; - ansi_opname[(int) ROUND_DIV_EXPR] = ansi_opname[(int) EXACT_DIV_EXPR]; - ansi_opname[(int) PLUS_EXPR] = get_identifier ("__pl"); - ansi_assopname[(int) TRUNC_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR]; - ansi_assopname[(int) CEIL_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR]; - ansi_assopname[(int) FLOOR_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR]; - ansi_assopname[(int) ROUND_DIV_EXPR] = ansi_assopname[(int) EXACT_DIV_EXPR]; - IDENTIFIER_OPNAME_P (ansi_opname[(int) PLUS_EXPR]) = 1; - ansi_assopname[(int) PLUS_EXPR] = get_identifier ("__apl"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) PLUS_EXPR]) = 1; - ansi_opname[(int) CONVERT_EXPR] = ansi_opname[(int) PLUS_EXPR]; - ansi_assopname[(int) CONVERT_EXPR] = ansi_assopname[(int) PLUS_EXPR]; - ansi_opname[(int) LSHIFT_EXPR] = get_identifier ("__ls"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) LSHIFT_EXPR]) = 1; - ansi_assopname[(int) LSHIFT_EXPR] = get_identifier ("__als"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) LSHIFT_EXPR]) = 1; - ansi_opname[(int) EQ_EXPR] = get_identifier ("__eq"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) EQ_EXPR]) = 1; - ansi_opname[(int) LT_EXPR] = get_identifier ("__lt"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) LT_EXPR]) = 1; - ansi_opname[(int) LE_EXPR] = get_identifier ("__le"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) LE_EXPR]) = 1; - ansi_opname[(int) BIT_AND_EXPR] = get_identifier ("__ad"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_AND_EXPR]) = 1; - ansi_assopname[(int) BIT_AND_EXPR] = get_identifier ("__aad"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) BIT_AND_EXPR]) = 1; - ansi_opname[(int) ADDR_EXPR] = ansi_opname[(int) BIT_AND_EXPR]; - ansi_assopname[(int) ADDR_EXPR] = ansi_assopname[(int) BIT_AND_EXPR]; - ansi_opname[(int) BIT_XOR_EXPR] = get_identifier ("__er"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_XOR_EXPR]) = 1; - ansi_assopname[(int) BIT_XOR_EXPR] = get_identifier ("__aer"); - IDENTIFIER_OPNAME_P (ansi_assopname[(int) BIT_XOR_EXPR]) = 1; - ansi_opname[(int) TRUTH_ORIF_EXPR] = get_identifier ("__oo"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) TRUTH_ORIF_EXPR]) = 1; - ansi_opname[(int) BIT_NOT_EXPR] = get_identifier ("__co"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) BIT_NOT_EXPR]) = 1; - ansi_opname[(int) PREDECREMENT_EXPR] = get_identifier ("__mm"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) PREDECREMENT_EXPR]) = 1; - ansi_opname[(int) POSTDECREMENT_EXPR] = ansi_opname[(int) PREDECREMENT_EXPR]; - ansi_opname[(int) COMPONENT_REF] = get_identifier ("__rf"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) COMPONENT_REF]) = 1; - ansi_opname[(int) MEMBER_REF] = get_identifier ("__rm"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) MEMBER_REF]) = 1; - ansi_opname[(int) CALL_EXPR] = get_identifier ("__cl"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) CALL_EXPR]) = 1; - ansi_opname[(int) ARRAY_REF] = get_identifier ("__vc"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) ARRAY_REF]) = 1; - ansi_opname[(int) NEW_EXPR] = get_identifier ("__nw"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) NEW_EXPR]) = 1; - ansi_opname[(int) DELETE_EXPR] = get_identifier ("__dl"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) DELETE_EXPR]) = 1; - ansi_opname[(int) VEC_NEW_EXPR] = get_identifier ("__vn"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) VEC_NEW_EXPR]) = 1; - ansi_opname[(int) VEC_DELETE_EXPR] = get_identifier ("__vd"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) VEC_DELETE_EXPR]) = 1; - ansi_opname[(int) TYPE_EXPR] = get_identifier (OPERATOR_TYPENAME_FORMAT); - IDENTIFIER_OPNAME_P (ansi_opname[(int) TYPE_EXPR]) = 1; - - /* This is not true: these operators are not defined in ANSI, - but we need them anyway. */ - ansi_opname[(int) MIN_EXPR] = get_identifier ("__mn"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) MIN_EXPR]) = 1; - ansi_opname[(int) MAX_EXPR] = get_identifier ("__mx"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) MAX_EXPR]) = 1; - ansi_opname[(int) COND_EXPR] = get_identifier ("__cn"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) COND_EXPR]) = 1; - ansi_opname[(int) SIZEOF_EXPR] = get_identifier ("__sz"); - IDENTIFIER_OPNAME_P (ansi_opname[(int) SIZEOF_EXPR]) = 1; - - init_method (); - init_error (); - gcc_obstack_init (&inline_text_obstack); - inline_text_firstobj = (char *) obstack_alloc (&inline_text_obstack, 0); - - /* Start it at 0, because check_newline is called at the very beginning - and will increment it to 1. */ - lineno = 0; - input_filename = ""; - current_function_decl = NULL; - - maxtoken = 40; - token_buffer = (char *) xmalloc (maxtoken + 2); - - ridpointers[(int) RID_INT] = get_identifier ("int"); - ridpointers[(int) RID_BOOL] = get_identifier ("bool"); - ridpointers[(int) RID_CHAR] = get_identifier ("char"); - ridpointers[(int) RID_VOID] = get_identifier ("void"); - ridpointers[(int) RID_FLOAT] = get_identifier ("float"); - ridpointers[(int) RID_DOUBLE] = get_identifier ("double"); - ridpointers[(int) RID_SHORT] = get_identifier ("short"); - ridpointers[(int) RID_LONG] = get_identifier ("long"); - ridpointers[(int) RID_UNSIGNED] = get_identifier ("unsigned"); - ridpointers[(int) RID_SIGNED] = get_identifier ("signed"); - ridpointers[(int) RID_INLINE] = get_identifier ("inline"); - ridpointers[(int) RID_CONST] = get_identifier ("const"); - ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile"); - ridpointers[(int) RID_RESTRICT] = get_identifier ("__restrict"); - ridpointers[(int) RID_AUTO] = get_identifier ("auto"); - ridpointers[(int) RID_STATIC] = get_identifier ("static"); - ridpointers[(int) RID_EXTERN] = get_identifier ("extern"); - ridpointers[(int) RID_TYPEDEF] = get_identifier ("typedef"); - ridpointers[(int) RID_REGISTER] = get_identifier ("register"); - ridpointers[(int) RID_COMPLEX] = get_identifier ("__complex"); - - /* C++ extensions. These are probably not correctly named. */ - ridpointers[(int) RID_WCHAR] = get_identifier ("__wchar_t"); - class_type_node = build_int_2 (class_type, 0); - TREE_TYPE (class_type_node) = class_type_node; - ridpointers[(int) RID_CLASS] = class_type_node; - - record_type_node = build_int_2 (record_type, 0); - TREE_TYPE (record_type_node) = record_type_node; - ridpointers[(int) RID_RECORD] = record_type_node; - - union_type_node = build_int_2 (union_type, 0); - TREE_TYPE (union_type_node) = union_type_node; - ridpointers[(int) RID_UNION] = union_type_node; - - enum_type_node = build_int_2 (enum_type, 0); - TREE_TYPE (enum_type_node) = enum_type_node; - ridpointers[(int) RID_ENUM] = enum_type_node; - - ridpointers[(int) RID_VIRTUAL] = get_identifier ("virtual"); - ridpointers[(int) RID_EXPLICIT] = get_identifier ("explicit"); - ridpointers[(int) RID_EXPORT] = get_identifier ("export"); - ridpointers[(int) RID_FRIEND] = get_identifier ("friend"); - - ridpointers[(int) RID_PUBLIC] = get_identifier ("public"); - ridpointers[(int) RID_PRIVATE] = get_identifier ("private"); - ridpointers[(int) RID_PROTECTED] = get_identifier ("protected"); - ridpointers[(int) RID_TEMPLATE] = get_identifier ("template"); - /* This is for ANSI C++. */ - ridpointers[(int) RID_MUTABLE] = get_identifier ("mutable"); - - /* Signature handling extensions. */ - signature_type_node = build_int_2 (signature_type, 0); - TREE_TYPE (signature_type_node) = signature_type_node; - ridpointers[(int) RID_SIGNATURE] = signature_type_node; - - /* Create the built-in __null node. Note that we can't yet call for - type_for_size here because integer_type_node and so forth are not - set up. Therefore, we don't set the type of these nodes until - init_decl_processing. */ - null_node = build_int_2 (0, 0); - ridpointers[RID_NULL] = null_node; - - opname_tab[(int) COMPONENT_REF] = "->"; - opname_tab[(int) MEMBER_REF] = "->*"; - opname_tab[(int) INDIRECT_REF] = "*"; - opname_tab[(int) ARRAY_REF] = "[]"; - opname_tab[(int) MODIFY_EXPR] = "="; - opname_tab[(int) NEW_EXPR] = "new"; - opname_tab[(int) DELETE_EXPR] = "delete"; - opname_tab[(int) VEC_NEW_EXPR] = "new []"; - opname_tab[(int) VEC_DELETE_EXPR] = "delete []"; - opname_tab[(int) COND_EXPR] = "?:"; - opname_tab[(int) CALL_EXPR] = "()"; - opname_tab[(int) PLUS_EXPR] = "+"; - opname_tab[(int) MINUS_EXPR] = "-"; - opname_tab[(int) MULT_EXPR] = "*"; - opname_tab[(int) TRUNC_DIV_EXPR] = "/"; - opname_tab[(int) CEIL_DIV_EXPR] = "(ceiling /)"; - opname_tab[(int) FLOOR_DIV_EXPR] = "(floor /)"; - opname_tab[(int) ROUND_DIV_EXPR] = "(round /)"; - opname_tab[(int) TRUNC_MOD_EXPR] = "%"; - opname_tab[(int) CEIL_MOD_EXPR] = "(ceiling %)"; - opname_tab[(int) FLOOR_MOD_EXPR] = "(floor %)"; - opname_tab[(int) ROUND_MOD_EXPR] = "(round %)"; - opname_tab[(int) NEGATE_EXPR] = "-"; - opname_tab[(int) MIN_EXPR] = "?"; - opname_tab[(int) ABS_EXPR] = "abs"; - opname_tab[(int) FFS_EXPR] = "ffs"; - opname_tab[(int) LSHIFT_EXPR] = "<<"; - opname_tab[(int) RSHIFT_EXPR] = ">>"; - opname_tab[(int) BIT_IOR_EXPR] = "|"; - opname_tab[(int) BIT_XOR_EXPR] = "^"; - opname_tab[(int) BIT_AND_EXPR] = "&"; - opname_tab[(int) BIT_ANDTC_EXPR] = "&~"; - opname_tab[(int) BIT_NOT_EXPR] = "~"; - opname_tab[(int) TRUTH_ANDIF_EXPR] = "&&"; - opname_tab[(int) TRUTH_ORIF_EXPR] = "||"; - opname_tab[(int) TRUTH_AND_EXPR] = "strict &&"; - opname_tab[(int) TRUTH_OR_EXPR] = "strict ||"; - opname_tab[(int) TRUTH_NOT_EXPR] = "!"; - opname_tab[(int) LT_EXPR] = "<"; - opname_tab[(int) LE_EXPR] = "<="; - opname_tab[(int) GT_EXPR] = ">"; - opname_tab[(int) GE_EXPR] = ">="; - opname_tab[(int) EQ_EXPR] = "=="; - opname_tab[(int) NE_EXPR] = "!="; - opname_tab[(int) IN_EXPR] = "in"; - opname_tab[(int) RANGE_EXPR] = "..."; - opname_tab[(int) CONVERT_EXPR] = "+"; - opname_tab[(int) ADDR_EXPR] = "&"; - opname_tab[(int) PREDECREMENT_EXPR] = "--"; - opname_tab[(int) PREINCREMENT_EXPR] = "++"; - opname_tab[(int) POSTDECREMENT_EXPR] = "--"; - opname_tab[(int) POSTINCREMENT_EXPR] = "++"; - opname_tab[(int) COMPOUND_EXPR] = ","; - - assignop_tab[(int) NOP_EXPR] = "="; - assignop_tab[(int) PLUS_EXPR] = "+="; - assignop_tab[(int) CONVERT_EXPR] = "+="; - assignop_tab[(int) MINUS_EXPR] = "-="; - assignop_tab[(int) NEGATE_EXPR] = "-="; - assignop_tab[(int) MULT_EXPR] = "*="; - assignop_tab[(int) INDIRECT_REF] = "*="; - assignop_tab[(int) TRUNC_DIV_EXPR] = "/="; - assignop_tab[(int) EXACT_DIV_EXPR] = "(exact /=)"; - assignop_tab[(int) CEIL_DIV_EXPR] = "(ceiling /=)"; - assignop_tab[(int) FLOOR_DIV_EXPR] = "(floor /=)"; - assignop_tab[(int) ROUND_DIV_EXPR] = "(round /=)"; - assignop_tab[(int) TRUNC_MOD_EXPR] = "%="; - assignop_tab[(int) CEIL_MOD_EXPR] = "(ceiling %=)"; - assignop_tab[(int) FLOOR_MOD_EXPR] = "(floor %=)"; - assignop_tab[(int) ROUND_MOD_EXPR] = "(round %=)"; - assignop_tab[(int) MIN_EXPR] = "?="; - assignop_tab[(int) LSHIFT_EXPR] = "<<="; - assignop_tab[(int) RSHIFT_EXPR] = ">>="; - assignop_tab[(int) BIT_IOR_EXPR] = "|="; - assignop_tab[(int) BIT_XOR_EXPR] = "^="; - assignop_tab[(int) BIT_AND_EXPR] = "&="; - assignop_tab[(int) ADDR_EXPR] = "&="; - - init_filename_times (); - - /* Some options inhibit certain reserved words. - Clear those words out of the hash table so they won't be recognized. */ -#define UNSET_RESERVED_WORD(STRING) \ - do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \ - if (s) s->name = ""; } while (0) - -#if 0 - /* let's parse things, and if they use it, then give them an error. */ - if (!flag_exceptions) - { - UNSET_RESERVED_WORD ("throw"); - UNSET_RESERVED_WORD ("try"); - UNSET_RESERVED_WORD ("catch"); - } -#endif - - if (!flag_rtti || flag_no_gnu_keywords) - { - UNSET_RESERVED_WORD ("classof"); - UNSET_RESERVED_WORD ("headof"); - } - - if (! flag_handle_signatures || flag_no_gnu_keywords) - { - /* Easiest way to not recognize signature - handling extensions... */ - UNSET_RESERVED_WORD ("signature"); - UNSET_RESERVED_WORD ("sigof"); - } - if (flag_no_asm || flag_no_gnu_keywords) - UNSET_RESERVED_WORD ("typeof"); - if (! flag_operator_names) - { - /* These are new ANSI keywords that may break code. */ - UNSET_RESERVED_WORD ("and"); - UNSET_RESERVED_WORD ("and_eq"); - UNSET_RESERVED_WORD ("bitand"); - UNSET_RESERVED_WORD ("bitor"); - UNSET_RESERVED_WORD ("compl"); - UNSET_RESERVED_WORD ("not"); - UNSET_RESERVED_WORD ("not_eq"); - UNSET_RESERVED_WORD ("or"); - UNSET_RESERVED_WORD ("or_eq"); - UNSET_RESERVED_WORD ("xor"); - UNSET_RESERVED_WORD ("xor_eq"); - } - - token_count = init_cpp_parse (); - interface_unknown = 1; - - return filename; -} - -void -finish_parse () -{ -#if USE_CPPLIB - cpp_finish (&parse_in); -#else - fclose (finput); -#endif -} - -void -reinit_parse_for_function () -{ - current_base_init_list = NULL_TREE; - current_member_init_list = NULL_TREE; -} - -#ifdef __GNUC__ -__inline -#endif -void -yyprint (file, yychar, yylval) - FILE *file; - int yychar; - YYSTYPE yylval; -{ - tree t; - switch (yychar) - { - case IDENTIFIER: - case TYPENAME: - case TYPESPEC: - case PTYPENAME: - case IDENTIFIER_DEFN: - case TYPENAME_DEFN: - case PTYPENAME_DEFN: - case SCSPEC: - case PRE_PARSED_CLASS_DECL: - t = yylval.ttype; - if (TREE_CODE (t) == TYPE_DECL || TREE_CODE (t) == TEMPLATE_DECL) - { - fprintf (file, " `%s'", IDENTIFIER_POINTER (DECL_NAME (t))); - break; - } - my_friendly_assert (TREE_CODE (t) == IDENTIFIER_NODE, 224); - if (IDENTIFIER_POINTER (t)) - fprintf (file, " `%s'", IDENTIFIER_POINTER (t)); - break; - case AGGR: - if (yylval.ttype == class_type_node) - fprintf (file, " `class'"); - else if (yylval.ttype == record_type_node) - fprintf (file, " `struct'"); - else if (yylval.ttype == union_type_node) - fprintf (file, " `union'"); - else if (yylval.ttype == enum_type_node) - fprintf (file, " `enum'"); - else if (yylval.ttype == signature_type_node) - fprintf (file, " `signature'"); - else - my_friendly_abort (80); - break; - } -} - -#if defined(GATHER_STATISTICS) && defined(REDUCE_LENGTH) -static int *reduce_count; -#endif - -int *token_count; - -#if 0 -#define REDUCE_LENGTH (sizeof (yyr2) / sizeof (yyr2[0])) -#define TOKEN_LENGTH (256 + sizeof (yytname) / sizeof (yytname[0])) -#endif - -#ifdef GATHER_STATISTICS -#ifdef REDUCE_LENGTH -void -yyhook (yyn) - int yyn; -{ - reduce_count[yyn] += 1; -} - -static int -reduce_cmp (p, q) - int *p, *q; -{ - return reduce_count[*q] - reduce_count[*p]; -} - -static int -token_cmp (p, q) - int *p, *q; -{ - return token_count[*q] - token_count[*p]; -} -#endif -#endif - -void -print_parse_statistics () -{ -#ifdef GATHER_STATISTICS -#ifdef REDUCE_LENGTH -#if YYDEBUG != 0 - int i; - int maxlen = REDUCE_LENGTH; - unsigned *sorted; - - if (reduce_count[-1] == 0) - return; - - if (TOKEN_LENGTH > REDUCE_LENGTH) - maxlen = TOKEN_LENGTH; - sorted = (unsigned *) alloca (sizeof (int) * maxlen); - - for (i = 0; i < TOKEN_LENGTH; i++) - sorted[i] = i; - qsort (sorted, TOKEN_LENGTH, sizeof (int), token_cmp); - for (i = 0; i < TOKEN_LENGTH; i++) - { - int idx = sorted[i]; - if (token_count[idx] == 0) - break; - if (token_count[idx] < token_count[-1]) - break; - fprintf (stderr, "token %d, `%s', count = %d\n", - idx, yytname[YYTRANSLATE (idx)], token_count[idx]); - } - fprintf (stderr, "\n"); - for (i = 0; i < REDUCE_LENGTH; i++) - sorted[i] = i; - qsort (sorted, REDUCE_LENGTH, sizeof (int), reduce_cmp); - for (i = 0; i < REDUCE_LENGTH; i++) - { - int idx = sorted[i]; - if (reduce_count[idx] == 0) - break; - if (reduce_count[idx] < reduce_count[-1]) - break; - fprintf (stderr, "rule %d, line %d, count = %d\n", - idx, yyrline[idx], reduce_count[idx]); - } - fprintf (stderr, "\n"); -#endif -#endif -#endif -} - -/* Sets the value of the 'yydebug' variable to VALUE. - This is a function so we don't have to have YYDEBUG defined - in order to build the compiler. */ - -void -set_yydebug (value) - int value; -{ -#if YYDEBUG != 0 - extern int yydebug; - yydebug = value; -#else - warning ("YYDEBUG not defined."); -#endif -} - - -/* Functions and data structures for #pragma interface. - - `#pragma implementation' means that the main file being compiled - is considered to implement (provide) the classes that appear in - its main body. I.e., if this is file "foo.cc", and class `bar' - is defined in "foo.cc", then we say that "foo.cc implements bar". - - All main input files "implement" themselves automagically. - - `#pragma interface' means that unless this file (of the form "foo.h" - is not presently being included by file "foo.cc", the - CLASSTYPE_INTERFACE_ONLY bit gets set. The effect is that none - of the vtables nor any of the inline functions defined in foo.h - will ever be output. - - There are cases when we want to link files such as "defs.h" and - "main.cc". In this case, we give "defs.h" a `#pragma interface', - and "main.cc" has `#pragma implementation "defs.h"'. */ - -struct impl_files -{ - char *filename; - struct impl_files *next; -}; - -static struct impl_files *impl_file_chain; - -/* Helper function to load global variables with interface - information. */ - -void -extract_interface_info () -{ - tree fileinfo = 0; - - if (flag_alt_external_templates) - { - struct tinst_level *til = tinst_for_decl (); - - if (til) - fileinfo = get_time_identifier (til->file); - } - if (!fileinfo) - fileinfo = get_time_identifier (input_filename); - fileinfo = TIME_IDENTIFIER_FILEINFO (fileinfo); - interface_only = TREE_INT_CST_LOW (fileinfo); - interface_unknown = TREE_INT_CST_HIGH (fileinfo); -} - -/* Return nonzero if S is not considered part of an - INTERFACE/IMPLEMENTATION pair. Otherwise, return 0. */ - -static int -interface_strcmp (s) - const char *s; -{ - /* Set the interface/implementation bits for this scope. */ - struct impl_files *ifiles; - const char *s1; - - for (ifiles = impl_file_chain; ifiles; ifiles = ifiles->next) - { - const char *t1 = ifiles->filename; - s1 = s; - - if (*s1 != *t1 || *s1 == 0) - continue; - - while (*s1 == *t1 && *s1 != 0) - s1++, t1++; - - /* A match. */ - if (*s1 == *t1) - return 0; - - /* Don't get faked out by xxx.yyy.cc vs xxx.zzz.cc. */ - if (index (s1, '.') || index (t1, '.')) - continue; - - if (*s1 == '\0' || s1[-1] != '.' || t1[-1] != '.') - continue; - - /* A match. */ - return 0; - } - - /* No matches. */ - return 1; -} - -static int -set_typedecl_interface_info (t, data) - tree *t; - void *data ATTRIBUTE_UNUSED; -{ - tree id = get_time_identifier (DECL_SOURCE_FILE (*t)); - tree fileinfo = TIME_IDENTIFIER_FILEINFO (id); - tree type = TREE_TYPE (*t); - - CLASSTYPE_INTERFACE_ONLY (type) = TREE_INT_CST_LOW (fileinfo) - = interface_strcmp (file_name_nondirectory (DECL_SOURCE_FILE (*t))); - return 0; -} - -static int -set_vardecl_interface_info (t, data) - tree *t; - void *data ATTRIBUTE_UNUSED; -{ - tree type = DECL_CONTEXT (*t); - - if (CLASSTYPE_INTERFACE_KNOWN (type)) - { - if (CLASSTYPE_INTERFACE_ONLY (type)) - set_typedecl_interface_info (&TYPE_MAIN_DECL (type), data); - else - CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 1; - DECL_EXTERNAL (*t) = CLASSTYPE_INTERFACE_ONLY (type); - TREE_PUBLIC (*t) = 1; - return 1; - } - return 0; -} - -/* Set up the state required to correctly handle the definition of the - inline function whose preparsed state has been saved in PI. */ - -static void -begin_definition_of_inclass_inline (pi) - struct pending_inline* pi; -{ - tree context; - - if (!pi->fndecl) - return; - - /* If this is an inline function in a local class, we must make sure - that we save all pertinent information about the function - surrounding the local class. */ - context = hack_decl_function_context (pi->fndecl); - if (context) - push_cp_function_context (context); - - feed_input (pi->buf, pi->len); - lineno = pi->lineno; - input_filename = pi->filename; - yychar = PRE_PARSED_FUNCTION_DECL; - yylval.ttype = build_tree_list ((tree) pi, pi->fndecl); - /* Pass back a handle to the rest of the inline functions, so that they - can be processed later. */ - DECL_PENDING_INLINE_INFO (pi->fndecl) = 0; - interface_unknown = pi->interface == 1; - interface_only = pi->interface == 0; -} - -/* Called from the top level: if there are any pending inlines to - do, set up to process them now. This function sets up the first function - to be parsed; after it has been, the rule for fndef in parse.y will - call process_next_inline to start working on the next one. */ - -void -do_pending_inlines () -{ - struct pending_inline *t; - - /* Oops, we're still dealing with the last batch. */ - if (yychar == PRE_PARSED_FUNCTION_DECL) - return; - - /* Reverse the pending inline functions, since - they were cons'd instead of appended. */ - { - struct pending_inline *prev = 0, *tail; - t = pending_inlines; - pending_inlines = 0; - - for (; t; t = tail) - { - tail = t->next; - t->next = prev; - t->deja_vu = 1; - prev = t; - } - t = prev; - } - - if (t == 0) - return; - - /* Now start processing the first inline function. */ - begin_definition_of_inclass_inline (t); -} - -static int nextchar = -1; - -/* Called from the fndecl rule in the parser when the function just parsed - was declared using a PRE_PARSED_FUNCTION_DECL (i.e. came from - do_pending_inlines). */ - -void -process_next_inline (t) - tree t; -{ - tree context; - struct pending_inline *i = (struct pending_inline *) TREE_PURPOSE (t); - context = hack_decl_function_context (i->fndecl); - if (context) - pop_cp_function_context (context); - i = i->next; - if (yychar == YYEMPTY) - yychar = yylex (); - if (yychar != END_OF_SAVED_INPUT) - { - error ("parse error at end of saved function text"); - - /* restore_pending_input will abort unless yychar is either - END_OF_SAVED_INPUT or YYEMPTY; since we already know we're - hosed, feed back YYEMPTY. We also need to discard nextchar, - since that may have gotten set as well. */ - nextchar = -1; - } - yychar = YYEMPTY; - end_input (); - if (i) - begin_definition_of_inclass_inline (i); - else - extract_interface_info (); -} - -/* Since inline methods can refer to text which has not yet been seen, - we store the text of the method in a structure which is placed in the - DECL_PENDING_INLINE_INFO field of the FUNCTION_DECL. - After parsing the body of the class definition, the FUNCTION_DECL's are - scanned to see which ones have this field set. Those are then digested - one at a time. - - This function's FUNCTION_DECL will have a bit set in its common so - that we know to watch out for it. */ - -static void -consume_string (this_obstack, matching_char) - register struct obstack *this_obstack; - int matching_char; -{ - register int c; - int starting_lineno = lineno; - do - { - c = getch (); - if (c == EOF) - { - int save_lineno = lineno; - lineno = starting_lineno; - if (matching_char == '"') - error ("end of file encountered inside string constant"); - else - error ("end of file encountered inside character constant"); - lineno = save_lineno; - return; - } - if (c == '\\') - { - obstack_1grow (this_obstack, c); - c = getch (); - obstack_1grow (this_obstack, c); - - /* Make sure we continue the loop */ - c = 0; - continue; - } - if (c == '\n') - { - if (pedantic) - pedwarn ("ANSI C++ forbids newline in string constant"); - lineno++; - } - obstack_1grow (this_obstack, c); - } - while (c != matching_char); -} - -static int nextyychar = YYEMPTY; -static YYSTYPE nextyylval; - -struct pending_input { - int nextchar, yychar, nextyychar, eof; - YYSTYPE yylval, nextyylval; - struct obstack token_obstack; - int first_token; -}; - -struct pending_input * -save_pending_input () -{ - struct pending_input *p; - p = (struct pending_input *) xmalloc (sizeof (struct pending_input)); - p->nextchar = nextchar; - p->yychar = yychar; - p->nextyychar = nextyychar; - p->yylval = yylval; - p->nextyylval = nextyylval; - p->eof = end_of_file; - yychar = nextyychar = YYEMPTY; - nextchar = -1; - p->first_token = first_token; - p->token_obstack = token_obstack; - - first_token = 0; - gcc_obstack_init (&token_obstack); - end_of_file = 0; - return p; -} - -void -restore_pending_input (p) - struct pending_input *p; -{ - my_friendly_assert (nextchar == -1, 229); - nextchar = p->nextchar; - my_friendly_assert (yychar == YYEMPTY || yychar == END_OF_SAVED_INPUT, 230); - yychar = p->yychar; - my_friendly_assert (nextyychar == YYEMPTY, 231); - nextyychar = p->nextyychar; - yylval = p->yylval; - nextyylval = p->nextyylval; - first_token = p->first_token; - obstack_free (&token_obstack, (char *) 0); - token_obstack = p->token_obstack; - end_of_file = p->eof; - free (p); -} - -/* Unget character CH from the input stream. - If RESCAN is non-zero, then we want to `see' this - character as the next input token. */ - -void -yyungetc (ch, rescan) - int ch; - int rescan; -{ - /* Unget a character from the input stream. */ - if (yychar == YYEMPTY || rescan == 0) - { - if (nextchar >= 0) - put_back (nextchar); - nextchar = ch; - } - else - { - my_friendly_assert (nextyychar == YYEMPTY, 232); - nextyychar = yychar; - nextyylval = yylval; - yychar = ch; - } -} - -void -clear_inline_text_obstack () -{ - obstack_free (&inline_text_obstack, inline_text_firstobj); -} - -/* This function stores away the text for an inline function that should - be processed later. It decides how much later, and may need to move - the info between obstacks; therefore, the caller should not refer to - the T parameter after calling this function. */ - -static void -store_pending_inline (decl, t) - tree decl; - struct pending_inline *t; -{ - t->fndecl = decl; - DECL_PENDING_INLINE_INFO (decl) = t; - - /* Because we use obstacks, we must process these in precise order. */ - t->next = pending_inlines; - pending_inlines = t; -} - -void -reinit_parse_for_method (yychar, decl) - int yychar; - tree decl; -{ - int len; - int starting_lineno = lineno; - char *starting_filename = input_filename; - - reinit_parse_for_block (yychar, &inline_text_obstack); - - len = obstack_object_size (&inline_text_obstack); - current_base_init_list = NULL_TREE; - current_member_init_list = NULL_TREE; - if (decl == void_type_node - || (current_class_type && TYPE_REDEFINED (current_class_type))) - { - /* Happens when we get two declarations of the same - function in the same scope. */ - char *buf = obstack_finish (&inline_text_obstack); - obstack_free (&inline_text_obstack, buf); - return; - } - else - { - struct pending_inline *t; - char *buf = obstack_finish (&inline_text_obstack); - - t = (struct pending_inline *) obstack_alloc (&inline_text_obstack, - sizeof (struct pending_inline)); - t->lineno = starting_lineno; - t->filename = starting_filename; - t->token = YYEMPTY; - t->token_value = 0; - t->buf = buf; - t->len = len; - t->deja_vu = 0; -#if 0 - if (interface_unknown && processing_template_defn && flag_external_templates && ! DECL_IN_SYSTEM_HEADER (decl)) - warn_if_unknown_interface (decl); -#endif - t->interface = (interface_unknown ? 1 : (interface_only ? 0 : 2)); - store_pending_inline (decl, t); - } -} - -/* Consume a block -- actually, a method beginning - with `:' or `{' -- and save it away on the specified obstack. */ - -void -reinit_parse_for_block (pyychar, obstackp) - int pyychar; - struct obstack *obstackp; -{ - register int c = 0; - int blev = 1; - int starting_lineno = lineno; - char *starting_filename = input_filename; - int len; - int look_for_semicolon = 0; - int look_for_lbrac = 0; - - if (pyychar == '{') - obstack_1grow (obstackp, '{'); - else if (pyychar == '=') - look_for_semicolon = 1; - else if (pyychar == ':') - { - obstack_1grow (obstackp, pyychar); - /* Add a space so we don't get confused by ': ::A(20)'. */ - obstack_1grow (obstackp, ' '); - look_for_lbrac = 1; - blev = 0; - } - else if (pyychar == RETURN_KEYWORD) - { - obstack_grow (obstackp, "return", 6); - look_for_lbrac = 1; - blev = 0; - } - else if (pyychar == TRY) - { - obstack_grow (obstackp, "try", 3); - look_for_lbrac = 1; - blev = 0; - } - else - { - yyerror ("parse error in method specification"); - obstack_1grow (obstackp, '{'); - } - - if (nextchar != EOF) - { - c = nextchar; - nextchar = EOF; - } - else - c = getch (); - - while (c != EOF) - { - int this_lineno = lineno; - - c = skip_white_space (c); - - /* Don't lose our cool if there are lots of comments. */ - if (lineno == this_lineno + 1) - obstack_1grow (obstackp, '\n'); - else if (lineno == this_lineno) - ; - else if (lineno - this_lineno < 10) - { - int i; - for (i = lineno - this_lineno; i > 0; i--) - obstack_1grow (obstackp, '\n'); - } - else - { - char buf[16]; - sprintf (buf, "\n# %d \"", lineno); - len = strlen (buf); - obstack_grow (obstackp, buf, len); - - len = strlen (input_filename); - obstack_grow (obstackp, input_filename, len); - obstack_1grow (obstackp, '\"'); - obstack_1grow (obstackp, '\n'); - } - - while (c > ' ') /* ASCII dependent... */ - { - obstack_1grow (obstackp, c); - if (c == '{') - { - look_for_lbrac = 0; - blev++; - } - else if (c == '}') - { - blev--; - if (blev == 0 && !look_for_semicolon) - { - if (pyychar == TRY) - { - if (peekyylex () == CATCH) - { - yylex (); - obstack_grow (obstackp, " catch ", 7); - look_for_lbrac = 1; - } - else - { - yychar = '{'; - goto done; - } - } - else - { - goto done; - } - } - } - else if (c == '\\') - { - /* Don't act on the next character...e.g, doing an escaped - double-quote. */ - c = getch (); - if (c == EOF) - { - error_with_file_and_line (starting_filename, - starting_lineno, - "end of file read inside definition"); - goto done; - } - obstack_1grow (obstackp, c); - } - else if (c == '\"') - consume_string (obstackp, c); - else if (c == '\'') - consume_string (obstackp, c); - else if (c == ';') - { - if (look_for_lbrac) - { - error ("function body for constructor missing"); - obstack_1grow (obstackp, '{'); - obstack_1grow (obstackp, '}'); - len += 2; - goto done; - } - else if (look_for_semicolon && blev == 0) - goto done; - } - c = getch (); - } - - if (c == EOF) - { - error_with_file_and_line (starting_filename, - starting_lineno, - "end of file read inside definition"); - goto done; - } - else if (c != '\n') - { - obstack_1grow (obstackp, c); - c = getch (); - } - } - done: - obstack_1grow (obstackp, '\0'); -} - -/* Consume a no-commas expression -- actually, a default argument -- and - save it away on the specified obstack. */ - -static void -reinit_parse_for_expr (obstackp) - struct obstack *obstackp; -{ - register int c = 0; - int starting_lineno = lineno; - char *starting_filename = input_filename; - int len; - int plev = 0; - - if (nextchar != EOF) - { - c = nextchar; - nextchar = EOF; - } - else - c = getch (); - - while (c != EOF) - { - int this_lineno = lineno; - - c = skip_white_space (c); - - /* Don't lose our cool if there are lots of comments. */ - if (lineno == this_lineno + 1) - obstack_1grow (obstackp, '\n'); - else if (lineno == this_lineno) - ; - else if (lineno - this_lineno < 10) - { - int i; - for (i = lineno - this_lineno; i > 0; --i) - obstack_1grow (obstackp, '\n'); - } - else - { - char buf[16]; - sprintf (buf, "\n# %d \"", lineno); - len = strlen (buf); - obstack_grow (obstackp, buf, len); - - len = strlen (input_filename); - obstack_grow (obstackp, input_filename, len); - obstack_1grow (obstackp, '\"'); - obstack_1grow (obstackp, '\n'); - } - - while (c > ' ') /* ASCII dependent... */ - { - if (plev <= 0 && (c == ')' || c == ',')) - { - put_back (c); - goto done; - } - obstack_1grow (obstackp, c); - if (c == '(' || c == '[') - ++plev; - else if (c == ']' || c == ')') - --plev; - else if (c == '\\') - { - /* Don't act on the next character...e.g, doing an escaped - double-quote. */ - c = getch (); - if (c == EOF) - { - error_with_file_and_line (starting_filename, - starting_lineno, - "end of file read inside definition"); - goto done; - } - obstack_1grow (obstackp, c); - } - else if (c == '\"') - consume_string (obstackp, c); - else if (c == '\'') - consume_string (obstackp, c); - c = getch (); - } - - if (c == EOF) - { - error_with_file_and_line (starting_filename, - starting_lineno, - "end of file read inside definition"); - goto done; - } - else if (c != '\n') - { - obstack_1grow (obstackp, c); - c = getch (); - } - } - done: - obstack_1grow (obstackp, '\0'); -} - -int do_snarf_defarg; - -/* Decide whether the default argument we are about to see should be - gobbled up as text for later parsing. */ - -void -maybe_snarf_defarg () -{ - if (current_class_type && TYPE_BEING_DEFINED (current_class_type)) - do_snarf_defarg = 1; -} - -/* When we see a default argument in a method declaration, we snarf it as - text using snarf_defarg. When we get up to namespace scope, we then go - through and parse all of them using do_pending_defargs. Since yacc - parsers are not reentrant, we retain defargs state in these two - variables so that subsequent calls to do_pending_defargs can resume - where the previous call left off. */ - -tree defarg_fns; -tree defarg_parm; - -tree -snarf_defarg () -{ - int len; - char *buf; - tree arg; - - reinit_parse_for_expr (&inline_text_obstack); - len = obstack_object_size (&inline_text_obstack); - buf = obstack_finish (&inline_text_obstack); - - push_obstacks (&inline_text_obstack, &inline_text_obstack); - arg = make_node (DEFAULT_ARG); - DEFARG_LENGTH (arg) = len - 1; - DEFARG_POINTER (arg) = buf; - pop_obstacks (); - - return arg; -} - -/* Called from grokfndecl to note a function decl with unparsed default - arguments for later processing. Also called from grokdeclarator - for function types with unparsed defargs; the call from grokfndecl - will always come second, so we can overwrite the entry from the type. */ - -void -add_defarg_fn (decl) - tree decl; -{ - if (TREE_CODE (decl) == FUNCTION_DECL) - TREE_VALUE (defarg_fns) = decl; - else - { - push_obstacks (&inline_text_obstack, &inline_text_obstack); - defarg_fns = tree_cons (current_class_type, decl, defarg_fns); - pop_obstacks (); - } -} - -/* Helper for do_pending_defargs. Starts the parsing of a default arg. */ - -static void -feed_defarg (f, p) - tree f, p; -{ - tree d = TREE_PURPOSE (p); - feed_input (DEFARG_POINTER (d), DEFARG_LENGTH (d)); - if (TREE_CODE (f) == FUNCTION_DECL) - { - lineno = DECL_SOURCE_LINE (f); - input_filename = DECL_SOURCE_FILE (f); - } - yychar = DEFARG_MARKER; - yylval.ttype = p; -} - -/* Helper for do_pending_defargs. Ends the parsing of a default arg. */ - -static void -finish_defarg () -{ - if (yychar == YYEMPTY) - yychar = yylex (); - if (yychar != END_OF_SAVED_INPUT) - { - error ("parse error at end of saved function text"); - - /* restore_pending_input will abort unless yychar is either - END_OF_SAVED_INPUT or YYEMPTY; since we already know we're - hosed, feed back YYEMPTY. We also need to discard nextchar, - since that may have gotten set as well. */ - nextchar = -1; - } - yychar = YYEMPTY; - end_input (); -} - -/* Main function for deferred parsing of default arguments. Called from - the parser. */ - -void -do_pending_defargs () -{ - if (defarg_parm) - finish_defarg (); - - for (; defarg_fns; defarg_fns = TREE_CHAIN (defarg_fns)) - { - tree defarg_fn = TREE_VALUE (defarg_fns); - if (defarg_parm == NULL_TREE) - { - push_nested_class (TREE_PURPOSE (defarg_fns), 1); - pushlevel (0); - if (TREE_CODE (defarg_fn) == FUNCTION_DECL) - maybe_begin_member_template_processing (defarg_fn); - - if (TREE_CODE (defarg_fn) == FUNCTION_DECL) - { -#if 0 - tree p; - for (p = DECL_ARGUMENTS (defarg_fn); p; p = TREE_CHAIN (p)) - pushdecl (copy_node (p)); -#endif - defarg_parm = TYPE_ARG_TYPES (TREE_TYPE (defarg_fn)); - } - else - defarg_parm = TYPE_ARG_TYPES (defarg_fn); - } - else - defarg_parm = TREE_CHAIN (defarg_parm); - - for (; defarg_parm; defarg_parm = TREE_CHAIN (defarg_parm)) - if (TREE_PURPOSE (defarg_parm) - && TREE_CODE (TREE_PURPOSE (defarg_parm)) == DEFAULT_ARG) - { - feed_defarg (defarg_fn, defarg_parm); - - /* Return to the parser, which will process this defarg - and call us again. */ - return; - } - - if (TREE_CODE (defarg_fn) == FUNCTION_DECL) - { - maybe_end_member_template_processing (); - check_default_args (defarg_fn); - } - - poplevel (0, 0, 0); - pop_nested_class (); - } -} - -/* Build a default function named NAME for type TYPE. - KIND says what to build. - - When KIND == 0, build default destructor. - When KIND == 1, build virtual destructor. - When KIND == 2, build default constructor. - When KIND == 3, build default X(const X&) constructor. - When KIND == 4, build default X(X&) constructor. - When KIND == 5, build default operator = (const X&). - When KIND == 6, build default operator = (X&). */ - -tree -cons_up_default_function (type, full_name, kind) - tree type, full_name; - int kind; -{ - extern tree void_list_node; - tree declspecs = NULL_TREE; - tree fn, args = NULL_TREE; - tree argtype; - int retref = 0; - tree name = constructor_name (full_name); - - switch (kind) - { - /* Destructors. */ - case 1: - declspecs = build_decl_list (NULL_TREE, ridpointers [(int) RID_VIRTUAL]); - /* Fall through... */ - case 0: - name = build_parse_node (BIT_NOT_EXPR, name); - args = void_list_node; - break; - - case 2: - /* Default constructor. */ - args = void_list_node; - break; - - case 3: - type = build_qualified_type (type, TYPE_QUAL_CONST); - /* Fall through... */ - case 4: - /* According to ARM $12.8, the default copy ctor will be declared, but - not defined, unless it's needed. */ - argtype = build_reference_type (type); - args = tree_cons (NULL_TREE, - build_tree_list (hash_tree_chain (argtype, NULL_TREE), - get_identifier ("_ctor_arg")), - void_list_node); - break; - - case 5: - case 6: - retref = 1; - declspecs = build_decl_list (NULL_TREE, type); - - if (kind == 5) - type = build_qualified_type (type, TYPE_QUAL_CONST); - - name = ansi_opname [(int) MODIFY_EXPR]; - - argtype = build_reference_type (type); - args = tree_cons (NULL_TREE, - build_tree_list (hash_tree_chain (argtype, NULL_TREE), - get_identifier ("_ctor_arg")), - void_list_node); - break; - - default: - my_friendly_abort (59); - } - - declspecs = decl_tree_cons (NULL_TREE, ridpointers [(int) RID_INLINE], - declspecs); - - TREE_PARMLIST (args) = 1; - - { - tree declarator = make_call_declarator (name, args, NULL_TREE, NULL_TREE); - if (retref) - declarator = build_parse_node (ADDR_EXPR, declarator); - - fn = grokfield (declarator, declspecs, NULL_TREE, NULL_TREE, NULL_TREE); - } - - if (fn == void_type_node) - return fn; - - if (kind > 2) - SET_DECL_ARTIFICIAL (TREE_CHAIN (DECL_ARGUMENTS (fn))); - -#if 0 - if (processing_template_defn) - { - SET_DECL_IMPLICIT_INSTANTIATION (fn); - repo_template_used (fn); - } -#endif - -#if 0 - if (CLASSTYPE_INTERFACE_KNOWN (type)) - { - DECL_INTERFACE_KNOWN (fn) = 1; - DECL_NOT_REALLY_EXTERN (fn) = (!CLASSTYPE_INTERFACE_ONLY (type) - && flag_implement_inlines); - } - else -#endif - DECL_NOT_REALLY_EXTERN (fn) = 1; - - mark_inline_for_output (fn); - -#ifdef DEBUG_DEFAULT_FUNCTIONS - { char *fn_type = NULL; - tree t = name; - switch (kind) - { - case 0: fn_type = "default destructor"; break; - case 1: fn_type = "virtual destructor"; break; - case 2: fn_type = "default constructor"; break; - case 3: fn_type = "default X(const X&)"; break; - case 4: fn_type = "default X(X&)"; break; - } - if (fn_type) - { - if (TREE_CODE (name) == BIT_NOT_EXPR) - t = TREE_OPERAND (name, 0); - fprintf (stderr, "[[[[ %s for %s:\n%s]]]]\n", fn_type, - IDENTIFIER_POINTER (t), func_buf); - } - } -#endif /* DEBUG_DEFAULT_FUNCTIONS */ - - /* Show that this function was generated by the compiler. */ - SET_DECL_ARTIFICIAL (fn); - - return fn; -} - -/* Heuristic to tell whether the user is missing a semicolon - after a struct or enum declaration. Emit an error message - if we know the user has blown it. */ - -void -check_for_missing_semicolon (type) - tree type; -{ - if (yychar < 0) - yychar = yylex (); - - if ((yychar > 255 - && yychar != SCSPEC - && yychar != IDENTIFIER - && yychar != TYPENAME - && yychar != CV_QUALIFIER - && yychar != SELFNAME) - || end_of_file) - { - if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (type))) - error ("semicolon missing after %s declaration", - TREE_CODE (type) == ENUMERAL_TYPE ? "enum" : "struct"); - else - cp_error ("semicolon missing after declaration of `%T'", type); - shadow_tag (build_tree_list (0, type)); - } - /* Could probably also hack cases where class { ... } f (); appears. */ - clear_anon_tags (); -} - -void -note_got_semicolon (type) - tree type; -{ - if (TREE_CODE_CLASS (TREE_CODE (type)) != 't') - my_friendly_abort (60); - if (CLASS_TYPE_P (type)) - CLASSTYPE_GOT_SEMICOLON (type) = 1; -} - -void -note_list_got_semicolon (declspecs) - tree declspecs; -{ - tree link; - - for (link = declspecs; link; link = TREE_CHAIN (link)) - { - tree type = TREE_VALUE (link); - if (TREE_CODE_CLASS (TREE_CODE (type)) == 't') - note_got_semicolon (type); - } - clear_anon_tags (); -} - -/* If C is not whitespace, return C. - Otherwise skip whitespace and return first nonwhite char read. */ - -static int -skip_white_space (c) - register int c; -{ - for (;;) - { - switch (c) - { - case '\n': - c = check_newline (); - break; - - case ' ': - case '\t': - case '\f': - case '\r': - case '\v': - case '\b': - do - c = getch (); - while (c == ' ' || c == '\t'); - break; - - case '\\': - c = getch (); - if (c == '\n') - lineno++; - else - error ("stray '\\' in program"); - c = getch (); - break; - - default: - return (c); - } - } -} - - - -/* Make the token buffer longer, preserving the data in it. - P should point to just beyond the last valid character in the old buffer. - The value we return is a pointer to the new buffer - at a place corresponding to P. */ - -static char * -extend_token_buffer (p) - const char *p; -{ - int offset = p - token_buffer; - - maxtoken = maxtoken * 2 + 10; - token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2); - - return token_buffer + offset; -} - -static int -get_last_nonwhite_on_line () -{ - register int c; - - /* Is this the last nonwhite stuff on the line? */ - if (nextchar >= 0) - c = nextchar, nextchar = -1; - else - c = getch (); - - while (c == ' ' || c == '\t') - c = getch (); - return c; -} - -#if defined HANDLE_PRAGMA -/* Local versions of these macros, that can be passed as function pointers. */ -static int -pragma_getc () -{ - int c; - - if (nextchar != EOF) - { - c = nextchar; - nextchar = EOF; - } - else - c = getch (); - - return c; -} - -static void -pragma_ungetc (arg) - int arg; -{ - yyungetc (arg, 0); -} -#endif /* HANDLE_PRAGMA */ - -/* At the beginning of a line, increment the line number - and process any #-directive on this line. - If the line is a #-directive, read the entire line and return a newline. - Otherwise, return the line's first non-whitespace character. */ - -int linemode; - -static int -check_newline () -{ - register int c; - register int token; - int saw_line = 0; - - /* Read first nonwhite char on the line. Do this before incrementing the - line number, in case we're at the end of saved text. */ - - do - c = getch (); - while (c == ' ' || c == '\t'); - - lineno++; - - if (c != '#') - { - /* If not #, return it so caller will use it. */ - return c; - } - - /* Don't read beyond this line. */ - linemode = 1; - - /* Read first nonwhite char after the `#'. */ - - do - c = getch (); - while (c == ' ' || c == '\t'); - - /* If a letter follows, then if the word here is `line', skip - it and ignore it; otherwise, ignore the line, with an error - if the word isn't `pragma'. */ - - if (ISALPHA (c)) - { - if (c == 'p') - { - if (getch () == 'r' - && getch () == 'a' - && getch () == 'g' - && getch () == 'm' - && getch () == 'a') - { - token = real_yylex (); - if (token == IDENTIFIER - && TREE_CODE (yylval.ttype) == IDENTIFIER_NODE) - { - /* If this is 1, we handled it; if it's -1, it was one we - wanted but had something wrong with it. Only if it's - 0 was it not handled. */ - if (handle_cp_pragma (IDENTIFIER_POINTER (yylval.ttype))) - goto skipline; - } - else if (token == END_OF_LINE) - goto skipline; - -#ifdef HANDLE_PRAGMA - /* We invoke HANDLE_PRAGMA before HANDLE_GENERIC_PRAGMAS - (if both are defined), in order to give the back - end a chance to override the interpretation of - SYSV style pragmas. */ - if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc, - IDENTIFIER_POINTER (yylval.ttype))) - goto skipline; -#endif /* HANDLE_PRAGMA */ - -#ifdef HANDLE_GENERIC_PRAGMAS - if (handle_generic_pragma (token)) - goto skipline; -#endif /* HANDLE_GENERIC_PRAGMAS */ - - /* Issue a warning message if we have been asked to do so. - Ignoring unknown pragmas in system header file unless - an explcit -Wunknown-pragmas has been given. */ - if (warn_unknown_pragmas > 1 - || (warn_unknown_pragmas && ! in_system_header)) - warning ("ignoring pragma: %s", token_buffer); - } - - goto skipline; - } - else if (c == 'd') - { - if (getch () == 'e' - && getch () == 'f' - && getch () == 'i' - && getch () == 'n' - && getch () == 'e' - && ((c = getch ()) == ' ' || c == '\t')) - { - debug_define (lineno, GET_DIRECTIVE_LINE ()); - goto skipline; - } - } - else if (c == 'u') - { - if (getch () == 'n' - && getch () == 'd' - && getch () == 'e' - && getch () == 'f' - && ((c = getch ()) == ' ' || c == '\t')) - { - debug_undef (lineno, GET_DIRECTIVE_LINE ()); - goto skipline; - } - } - else if (c == 'l') - { - if (getch () == 'i' - && getch () == 'n' - && getch () == 'e' - && ((c = getch ()) == ' ' || c == '\t')) - { - saw_line = 1; - goto linenum; - } - } - else if (c == 'i') - { - if (getch () == 'd' - && getch () == 'e' - && getch () == 'n' - && getch () == 't' - && ((c = getch ()) == ' ' || c == '\t')) - { - /* #ident. The pedantic warning is now in cccp.c. */ - - /* Here we have just seen `#ident '. - A string constant should follow. */ - - token = real_yylex (); - if (token == END_OF_LINE) - goto skipline; - if (token != STRING - || TREE_CODE (yylval.ttype) != STRING_CST) - { - error ("invalid #ident"); - goto skipline; - } - - if (! flag_no_ident) - { -#ifdef ASM_OUTPUT_IDENT - ASM_OUTPUT_IDENT (asm_out_file, - TREE_STRING_POINTER (yylval.ttype)); -#endif - } - - /* Skip the rest of this line. */ - goto skipline; - } - } - else if (c == 'n') - { - if (getch () == 'e' - && getch () == 'w' - && getch () == 'w' - && getch () == 'o' - && getch () == 'r' - && getch () == 'l' - && getch () == 'd' - && ((c = getch ()) == ' ' || c == '\t')) - { - /* Used to test incremental compilation. */ - sorry ("#pragma newworld"); - goto skipline; - } - } - error ("undefined or invalid # directive"); - goto skipline; - } - -linenum: - /* Here we have either `#line' or `# '. - In either case, it should be a line number; a digit should follow. */ - - while (c == ' ' || c == '\t') - c = getch (); - - /* If the # is the only nonwhite char on the line, - just ignore it. Check the new newline. */ - if (c == EOF) - goto skipline; - - /* Something follows the #; read a token. */ - - put_back (c); - token = real_yylex (); - - if (token == CONSTANT - && TREE_CODE (yylval.ttype) == INTEGER_CST) - { - int old_lineno = lineno; - enum { act_none, act_push, act_pop } action = act_none; - int entering_system_header = 0; - int entering_c_header = 0; - - /* subtract one, because it is the following line that - gets the specified number */ - - int l = TREE_INT_CST_LOW (yylval.ttype) - 1; - c = get_last_nonwhite_on_line (); - if (c == EOF) - { - /* No more: store the line number and check following line. */ - lineno = l; - goto skipline; - } - put_back (c); - - /* More follows: it must be a string constant (filename). */ - - if (saw_line) - { - /* Don't treat \ as special if we are processing #line 1 "...". - If you want it to be treated specially, use # 1 "...". */ - ignore_escape_flag = 1; - } - - /* Read the string constant. */ - token = real_yylex (); - - ignore_escape_flag = 0; - - if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST) - { - error ("invalid #line"); - goto skipline; - } - - /* Changing files again. This means currently collected time - is charged against header time, and body time starts back - at 0. */ - if (flag_detailed_statistics) - { - int this_time = my_get_run_time (); - tree time_identifier = get_time_identifier (TREE_STRING_POINTER (yylval.ttype)); - header_time += this_time - body_time; - TREE_INT_CST_LOW (TIME_IDENTIFIER_TIME (this_filename_time)) - += this_time - body_time; - this_filename_time = time_identifier; - body_time = this_time; - } - - input_filename - = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1); - strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype)); - lineno = l; - GNU_xref_file (input_filename); - - if (main_input_filename == 0) - { - struct impl_files *ifiles = impl_file_chain; - - if (ifiles) - { - while (ifiles->next) - ifiles = ifiles->next; - ifiles->filename = file_name_nondirectory (input_filename); - } - - main_input_filename = input_filename; - if (write_virtuals == 3) - { - walk_globals (vtable_decl_p, - set_vardecl_interface_info, - /*data=*/0); - walk_globals (vtype_decl_p, - set_typedecl_interface_info, - /*data=*/0); - } - } - - extract_interface_info (); - - c = get_last_nonwhite_on_line (); - if (c == EOF) - { - /* Update the name in the top element of input_file_stack. */ - if (input_file_stack) - input_file_stack->name = input_filename; - } - else - { - put_back (c); - - token = real_yylex (); - - /* `1' after file name means entering new file. - `2' after file name means just left a file. */ - - if (token == CONSTANT - && TREE_CODE (yylval.ttype) == INTEGER_CST) - { - if (TREE_INT_CST_LOW (yylval.ttype) == 1) - action = act_push; - else if (TREE_INT_CST_LOW (yylval.ttype) == 2) - action = act_pop; - - if (action) - { - c = get_last_nonwhite_on_line (); - if (c != EOF) - { - put_back (c); - token = real_yylex (); - } - } - } - - /* `3' after file name means this is a system header file. */ - - if (token == CONSTANT - && TREE_CODE (yylval.ttype) == INTEGER_CST - && TREE_INT_CST_LOW (yylval.ttype) == 3) - { - entering_system_header = 1; - - c = get_last_nonwhite_on_line (); - if (c != EOF) - { - put_back (c); - token = real_yylex (); - } - } - - /* `4' after file name means this is a C header file. */ - - if (token == CONSTANT - && TREE_CODE (yylval.ttype) == INTEGER_CST - && TREE_INT_CST_LOW (yylval.ttype) == 4) - { - entering_c_header = 1; - - c = get_last_nonwhite_on_line (); - if (c != EOF) - { - put_back (c); - token = real_yylex (); - } - } - - /* Do the actions implied by the preceding numbers. */ - - if (action == act_push) - { - /* Pushing to a new file. */ - struct file_stack *p; - - p = (struct file_stack *) xmalloc (sizeof (struct file_stack)); - input_file_stack->line = old_lineno; - p->next = input_file_stack; - p->name = input_filename; - input_file_stack = p; - input_file_stack_tick++; - debug_start_source_file (input_filename); - in_system_header = entering_system_header; - if (c_header_level) - ++c_header_level; - else if (entering_c_header) - { - c_header_level = 1; - ++pending_lang_change; - } - } - else if (action == act_pop) - { - /* Popping out of a file. */ - if (input_file_stack->next) - { - struct file_stack *p; - - if (c_header_level && --c_header_level == 0) - { - if (entering_c_header) - warning ("badly nested C headers from preprocessor"); - --pending_lang_change; - } - in_system_header = entering_system_header; - - p = input_file_stack; - input_file_stack = p->next; - free (p); - input_file_stack_tick++; - debug_end_source_file (input_file_stack->line); - } - else - error ("#-lines for entering and leaving files don't match"); - } - else - in_system_header = entering_system_header; - } - - /* If NEXTCHAR is not end of line, we don't care what it is. */ - if (nextchar == EOF) - c = EOF; - } - else - error ("invalid #-line"); - - /* skip the rest of this line. */ - skipline: - linemode = 0; - end_of_file = 0; - nextchar = -1; - while ((c = getch ()) != EOF && c != '\n'); - return c; -} - -void -do_pending_lang_change () -{ - for (; pending_lang_change > 0; --pending_lang_change) - push_lang_context (lang_name_c); - for (; pending_lang_change < 0; ++pending_lang_change) - pop_lang_context (); -} - -#define ENDFILE -1 /* token that represents end-of-file */ - -/* Read an escape sequence, returning its equivalent as a character, - or store 1 in *ignore_ptr if it is backslash-newline. */ - -static int -readescape (ignore_ptr) - int *ignore_ptr; -{ - register int c = getch (); - register int code; - register unsigned count; - unsigned firstdig = 0; - int nonnull; - - switch (c) - { - case 'x': - code = 0; - count = 0; - nonnull = 0; - while (1) - { - c = getch (); - if (! ISXDIGIT (c)) - { - put_back (c); - break; - } - code *= 16; - if (c >= 'a' && c <= 'f') - code += c - 'a' + 10; - if (c >= 'A' && c <= 'F') - code += c - 'A' + 10; - if (c >= '0' && c <= '9') - code += c - '0'; - if (code != 0 || count != 0) - { - if (count == 0) - firstdig = code; - count++; - } - nonnull = 1; - } - if (! nonnull) - error ("\\x used with no following hex digits"); - else if (count == 0) - /* Digits are all 0's. Ok. */ - ; - else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node) - || (count > 1 - && (((unsigned)1 << - (TYPE_PRECISION (integer_type_node) - (count - 1) * 4)) - <= firstdig))) - pedwarn ("hex escape out of range"); - return code; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': - code = 0; - count = 0; - while ((c <= '7') && (c >= '0') && (count++ < 3)) - { - code = (code * 8) + (c - '0'); - c = getch (); - } - put_back (c); - return code; - - case '\\': case '\'': case '"': - return c; - - case '\n': - lineno++; - *ignore_ptr = 1; - return 0; - - case 'n': - return TARGET_NEWLINE; - - case 't': - return TARGET_TAB; - - case 'r': - return TARGET_CR; - - case 'f': - return TARGET_FF; - - case 'b': - return TARGET_BS; - - case 'a': - return TARGET_BELL; - - case 'v': - return TARGET_VT; - - case 'e': - case 'E': - if (pedantic) - pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c); - return 033; - - case '?': - return c; - - /* `\(', etc, are used at beginning of line to avoid confusing Emacs. */ - case '(': - case '{': - case '[': - /* `\%' is used to prevent SCCS from getting confused. */ - case '%': - if (pedantic) - pedwarn ("unknown escape sequence `\\%c'", c); - return c; - } - if (ISGRAPH (c)) - pedwarn ("unknown escape sequence `\\%c'", c); - else - pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c); - return c; -} - -/* Value is 1 (or 2) if we should try to make the next identifier look like - a typename (when it may be a local variable or a class variable). - Value is 0 if we treat this name in a default fashion. */ -int looking_for_typename; - -#ifdef __GNUC__ -__inline -#endif -int -identifier_type (decl) - tree decl; -{ - tree t; - if (TREE_CODE (decl) == TEMPLATE_DECL) - { - if (TREE_CODE (DECL_RESULT (decl)) == TYPE_DECL) - return PTYPENAME; - else if (looking_for_template) - return PFUNCNAME; - } - if (looking_for_template && really_overloaded_fn (decl)) - { - /* See through a baselink. */ - if (TREE_CODE (decl) == TREE_LIST) - decl = TREE_VALUE (decl); - - for (t = decl; t != NULL_TREE; t = OVL_CHAIN (t)) - if (DECL_FUNCTION_TEMPLATE_P (OVL_FUNCTION (t))) - return PFUNCNAME; - } - if (TREE_CODE (decl) == NAMESPACE_DECL) - return NSNAME; - if (TREE_CODE (decl) != TYPE_DECL) - return IDENTIFIER; - if (DECL_ARTIFICIAL (decl) && TREE_TYPE (decl) == current_class_type) - return SELFNAME; - - /* A constructor declarator for a template type will get here as an - implicit typename, a TYPENAME_TYPE with a type. */ - t = got_scope; - if (t && TREE_CODE (t) == TYPENAME_TYPE) - t = TREE_TYPE (t); - decl = TREE_TYPE (decl); - if (TREE_CODE (decl) == TYPENAME_TYPE) - decl = TREE_TYPE (decl); - if (t && t == decl) - return SELFNAME; - - return TYPENAME; -} - -void -see_typename () -{ - /* Only types expected, not even namespaces. */ - looking_for_typename = 2; - if (yychar < 0) - if ((yychar = yylex ()) < 0) yychar = 0; - looking_for_typename = 0; - if (yychar == IDENTIFIER) - { - lastiddecl = lookup_name (yylval.ttype, -2); - if (lastiddecl == 0) - { - if (flag_labels_ok) - lastiddecl = IDENTIFIER_LABEL_VALUE (yylval.ttype); - } - else - yychar = identifier_type (lastiddecl); - } -} - -/* Return true if d is in a global scope. */ - -static int -is_global (d) - tree d; -{ - while (1) - switch (TREE_CODE (d)) - { - case ERROR_MARK: - return 1; - - case OVERLOAD: d = OVL_FUNCTION (d); continue; - case TREE_LIST: d = TREE_VALUE (d); continue; - default: - my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (d)) == 'd', 980629); - d = CP_DECL_CONTEXT (d); - return TREE_CODE (d) == NAMESPACE_DECL; - } -} - -tree -do_identifier (token, parsing, args) - register tree token; - int parsing; - tree args; -{ - register tree id; - int lexing = (parsing == 1); - int in_call = (parsing == 2); - - if (! lexing || IDENTIFIER_OPNAME_P (token)) - id = lookup_name (token, 0); - else - id = lastiddecl; - - /* Scope class declarations before global - declarations. */ - if ((!id || is_global (id)) - && current_class_type != 0 - && TYPE_SIZE (current_class_type) == 0) - { - /* Could be from one of the base classes. */ - tree field = lookup_field (current_class_type, token, 1, 0); - if (field == 0) - ; - else if (field == error_mark_node) - /* We have already generated the error message. - But we still want to return this value. */ - id = lookup_field (current_class_type, token, 0, 0); - else if (TREE_CODE (field) == VAR_DECL - || TREE_CODE (field) == CONST_DECL - || TREE_CODE (field) == TEMPLATE_DECL) - id = field; - else if (TREE_CODE (field) == TYPE_DECL - && DECL_ARTIFICIAL (field) - && IMPLICIT_TYPENAME_P (TREE_TYPE (field))) - /* When we did name-lookup before, we will have eschewed - implicit typenames in favor of global bindings. Therefore, - if lookup_field returns an implicit typename, but ID is not - an implicit typename, then we should skip this one, too. */ - ; - else if (TREE_CODE (field) != FIELD_DECL) - my_friendly_abort (61); - else - { - cp_error ("invalid use of member `%D'", field); - id = error_mark_node; - return id; - } - } - - /* Do Koenig lookup if appropriate (inside templates we build lookup - expressions instead). */ - if (args && !current_template_parms && (!id || is_global (id))) - /* If we have arguments and we only found global names, do Koenig - lookup. */ - id = lookup_arg_dependent (token, id, args); - - /* Remember that this name has been used in the class definition, as per - [class.scope0] */ - if (id && parsing - /* Avoid breaking if we get called for a default argument that - refers to an overloaded method. Eventually this will not be - necessary, since default arguments shouldn't be parsed until - after the class is complete. (jason 3/12/97) */ - && TREE_CODE (id) != OVERLOAD) - maybe_note_name_used_in_class (token, id); - - if (id == error_mark_node) - { - /* lookup_name quietly returns error_mark_node if we're parsing, - as we don't want to complain about an identifier that ends up - being used as a declarator. So we call it again to get the error - message. */ - id = lookup_name (token, 0); - return error_mark_node; - } - - if (!id) - { - if (current_template_parms) - return build_min_nt (LOOKUP_EXPR, token); - else if (IDENTIFIER_OPNAME_P (token)) - { - if (token != ansi_opname[ERROR_MARK]) - cp_error ("`%D' not defined", token); - id = error_mark_node; - } - else if (in_call && ! flag_strict_prototype) - { - id = implicitly_declare (token); - } - else if (current_function_decl == 0) - { - cp_error ("`%D' was not declared in this scope", token); - id = error_mark_node; - } - else - { - if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node - || IDENTIFIER_ERROR_LOCUS (token) != current_function_decl) - { - static int undeclared_variable_notice; - - cp_error ("`%D' undeclared (first use this function)", token); - - if (! undeclared_variable_notice) - { - error ("(Each undeclared identifier is reported only once"); - error ("for each function it appears in.)"); - undeclared_variable_notice = 1; - } - } - id = error_mark_node; - /* Prevent repeated error messages. */ - SET_IDENTIFIER_NAMESPACE_VALUE (token, error_mark_node); - SET_IDENTIFIER_ERROR_LOCUS (token, current_function_decl); - } - } - - if (TREE_CODE (id) == VAR_DECL && DECL_DEAD_FOR_LOCAL (id)) - { - tree shadowed = DECL_SHADOWED_FOR_VAR (id); - while (shadowed != NULL_TREE && TREE_CODE (shadowed) == VAR_DECL - && DECL_DEAD_FOR_LOCAL (shadowed)) - shadowed = DECL_SHADOWED_FOR_VAR (shadowed); - if (!shadowed) - shadowed = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (id)); - if (shadowed) - { - if (!DECL_ERROR_REPORTED (id)) - { - warning ("name lookup of `%s' changed", - IDENTIFIER_POINTER (token)); - cp_warning_at (" matches this `%D' under current ANSI rules", - shadowed); - cp_warning_at (" matches this `%D' under old rules", id); - DECL_ERROR_REPORTED (id) = 1; - } - id = shadowed; - } - else if (!DECL_ERROR_REPORTED (id)) - { - static char msg[] - = "name lookup of `%s' changed for new ANSI `for' scoping"; - DECL_ERROR_REPORTED (id) = 1; - if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (id))) - { - error (msg, IDENTIFIER_POINTER (token)); - cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", id); - id = error_mark_node; - } - else - { - pedwarn (msg, IDENTIFIER_POINTER (token)); - cp_pedwarn_at (" using obsolete binding at `%D'", id); - } - } - } - /* TREE_USED is set in `hack_identifier'. */ - if (TREE_CODE (id) == CONST_DECL) - { - /* Check access. */ - if (IDENTIFIER_CLASS_VALUE (token) == id) - enforce_access (DECL_REAL_CONTEXT(id), id); - if (!processing_template_decl || DECL_TEMPLATE_PARM_P (id)) - id = DECL_INITIAL (id); - } - else - id = hack_identifier (id, token); - - /* We must look up dependent names when the template is - instantiated, not while parsing it. For now, we don't - distinguish between dependent and independent names. So, for - example, we look up all overloaded functions at - instantiation-time, even though in some cases we should just use - the DECL we have here. We also use LOOKUP_EXPRs to find things - like local variables, rather than creating TEMPLATE_DECLs for the - local variables and then finding matching instantiations. */ - if (current_template_parms - && (is_overloaded_fn (id) - /* If it's not going to be around at instantiation time, we - look it up then. This is a hack, and should go when we - really get dependent/independent name lookup right. */ - || !TREE_PERMANENT (id) - /* Some local VAR_DECLs (such as those for local variables - in member functions of local classes) are built on the - permanent obstack. */ - || (TREE_CODE (id) == VAR_DECL - && CP_DECL_CONTEXT (id) - && TREE_CODE (CP_DECL_CONTEXT (id)) == FUNCTION_DECL) - || TREE_CODE (id) == PARM_DECL - || TREE_CODE (id) == RESULT_DECL - || TREE_CODE (id) == USING_DECL)) - id = build_min_nt (LOOKUP_EXPR, token); - - return id; -} - -tree -do_scoped_id (token, parsing) - tree token; - int parsing; -{ - tree id; - /* during parsing, this is ::name. Otherwise, it is black magic. */ - if (parsing) - { - struct tree_binding _b; - id = binding_init (&_b); - if (!qualified_lookup_using_namespace (token, global_namespace, id, 0)) - id = NULL_TREE; - else - id = BINDING_VALUE (id); - } - else - id = IDENTIFIER_GLOBAL_VALUE (token); - if (parsing && yychar == YYEMPTY) - yychar = yylex (); - if (! id) - { - if (processing_template_decl) - { - id = build_min_nt (LOOKUP_EXPR, token); - LOOKUP_EXPR_GLOBAL (id) = 1; - return id; - } - if (parsing && (yychar == '(' || yychar == LEFT_RIGHT) - && ! flag_strict_prototype) - id = implicitly_declare (token); - else - { - if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node) - cp_error ("`::%D' undeclared (first use here)", token); - id = error_mark_node; - /* Prevent repeated error messages. */ - SET_IDENTIFIER_NAMESPACE_VALUE (token, error_mark_node); - } - } - else - { - if (TREE_CODE (id) == ADDR_EXPR) - mark_used (TREE_OPERAND (id, 0)); - else if (TREE_CODE (id) != OVERLOAD) - mark_used (id); - } - if (TREE_CODE (id) == CONST_DECL && ! processing_template_decl) - { - /* XXX CHS - should we set TREE_USED of the constant? */ - id = DECL_INITIAL (id); - /* This is to prevent an enum whose value is 0 - from being considered a null pointer constant. */ - id = build1 (NOP_EXPR, TREE_TYPE (id), id); - TREE_CONSTANT (id) = 1; - } - - if (processing_template_decl) - { - if (is_overloaded_fn (id)) - { - id = build_min_nt (LOOKUP_EXPR, token); - LOOKUP_EXPR_GLOBAL (id) = 1; - return id; - } - /* else just use the decl */ - } - return convert_from_reference (id); -} - -tree -identifier_typedecl_value (node) - tree node; -{ - tree t, type; - type = IDENTIFIER_TYPE_VALUE (node); - if (type == NULL_TREE) - return NULL_TREE; - - if (IDENTIFIER_BINDING (node)) - { - t = IDENTIFIER_VALUE (node); - if (t && TREE_CODE (t) == TYPE_DECL && TREE_TYPE (t) == type) - return t; - } - if (IDENTIFIER_NAMESPACE_VALUE (node)) - { - t = IDENTIFIER_NAMESPACE_VALUE (node); - if (t && TREE_CODE (t) == TYPE_DECL && TREE_TYPE (t) == type) - return t; - } - - /* Will this one ever happen? */ - if (TYPE_MAIN_DECL (type)) - return TYPE_MAIN_DECL (type); - - /* We used to do an internal error of 62 here, but instead we will - handle the return of a null appropriately in the callers. */ - return NULL_TREE; -} - -struct pf_args -{ - /* Input */ - /* I/O */ - char *p; - int c; - int imag; - tree type; - /* Output */ - REAL_VALUE_TYPE value; -}; - -static void -parse_float (data) - PTR data; -{ - struct pf_args * args = (struct pf_args *) data; - int fflag = 0, lflag = 0; - /* Copy token_buffer now, while it has just the number - and not the suffixes; once we add `f' or `i', - REAL_VALUE_ATOF may not work any more. */ - char *copy = (char *) alloca (args->p - token_buffer + 1); - bcopy (token_buffer, copy, args->p - token_buffer + 1); - - while (1) - { - int lose = 0; - - /* Read the suffixes to choose a data type. */ - switch (args->c) - { - case 'f': case 'F': - if (fflag) - error ("more than one `f' in numeric constant"); - fflag = 1; - break; - - case 'l': case 'L': - if (lflag) - error ("more than one `l' in numeric constant"); - lflag = 1; - break; - - case 'i': case 'I': - if (args->imag) - error ("more than one `i' or `j' in numeric constant"); - else if (pedantic) - pedwarn ("ANSI C++ forbids imaginary numeric constants"); - args->imag = 1; - break; - - default: - lose = 1; - } - - if (lose) - break; - - if (args->p >= token_buffer + maxtoken - 3) - args->p = extend_token_buffer (args->p); - *(args->p++) = args->c; - *(args->p) = 0; - args->c = getch (); - } - - /* The second argument, machine_mode, of REAL_VALUE_ATOF - tells the desired precision of the binary result - of decimal-to-binary conversion. */ - - if (fflag) - { - if (lflag) - error ("both `f' and `l' in floating constant"); - - args->type = float_type_node; - args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type)); - /* A diagnostic is required here by some ANSI C testsuites. - This is not pedwarn, become some people don't want - an error for this. */ - if (REAL_VALUE_ISINF (args->value) && pedantic) - warning ("floating point number exceeds range of `float'"); - } - else if (lflag) - { - args->type = long_double_type_node; - args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type)); - if (REAL_VALUE_ISINF (args->value) && pedantic) - warning ("floating point number exceeds range of `long double'"); - } - else - { - args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type)); - if (REAL_VALUE_ISINF (args->value) && pedantic) - warning ("floating point number exceeds range of `double'"); - } -} - -int -real_yylex () -{ - register int c; - register int value; - int wide_flag = 0; - int dollar_seen = 0; - int i; - - if (nextchar >= 0) - c = nextchar, nextchar = -1; - else - c = getch (); - - /* Effectively do c = skip_white_space (c) - but do it faster in the usual cases. */ - while (1) - switch (c) - { - case ' ': - case '\t': - case '\f': - case '\v': - case '\b': - c = getch (); - break; - - case '\r': - /* Call skip_white_space so we can warn if appropriate. */ - - case '\n': - case '/': - case '\\': - c = skip_white_space (c); - default: - goto found_nonwhite; - } - found_nonwhite: - - token_buffer[0] = c; - token_buffer[1] = 0; - -/* yylloc.first_line = lineno; */ - - switch (c) - { - case EOF: - token_buffer[0] = '\0'; - end_of_file = 1; - if (input_redirected ()) - value = END_OF_SAVED_INPUT; - else if (linemode) - value = END_OF_LINE; - else - value = ENDFILE; - break; - - case '$': - if (! dollars_in_ident) - error ("`$' in identifier"); - else if (pedantic) - pedwarn ("`$' in identifier"); - dollar_seen = 1; - goto letter; - - case 'L': - /* Capital L may start a wide-string or wide-character constant. */ - { - register int c = getch (); - if (c == '\'') - { - wide_flag = 1; - goto char_constant; - } - if (c == '"') - { - wide_flag = 1; - goto string_constant; - } - put_back (c); - } - - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': case 'G': case 'H': case 'I': case 'J': - case 'K': case 'M': case 'N': case 'O': - case 'P': case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': case 'Y': - case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': case 'g': case 'h': case 'i': case 'j': - case 'k': case 'l': case 'm': case 'n': case 'o': - case 'p': case 'q': case 'r': case 's': case 't': - case 'u': case 'v': case 'w': case 'x': case 'y': - case 'z': - case '_': - letter: - { - register char *p; - - p = token_buffer; - if (input == 0) - { - /* We know that `token_buffer' can hold at least on char, - so we install C immediately. - We may have to read the value in `putback_char', so call - `getch' once. */ - *p++ = c; - c = getch (); - - /* Make this run fast. We know that we are reading straight - from FINPUT in this case (since identifiers cannot straddle - input sources. */ - while (ISALNUM (c) || (c == '_') || c == '$') - { - if (c == '$') - { - if (! dollars_in_ident) - error ("`$' in identifier"); - else if (pedantic) - pedwarn ("`$' in identifier"); - } - - if (p >= token_buffer + maxtoken) - p = extend_token_buffer (p); - - *p++ = c; - c = getch (); - } - - if (linemode && c == '\n') - { - put_back (c); - c = EOF; - } - } - else - { - /* We know that `token_buffer' can hold at least on char, - so we install C immediately. */ - *p++ = c; - c = getch (); - - while (ISALNUM (c) || (c == '_') || c == '$') - { - if (c == '$') - { - if (! dollars_in_ident) - error ("`$' in identifier"); - else if (pedantic) - pedwarn ("`$' in identifier"); - } - - if (p >= token_buffer + maxtoken) - p = extend_token_buffer (p); - - *p++ = c; - c = getch (); - } - } - - *p = 0; - nextchar = c; - - value = IDENTIFIER; - yylval.itype = 0; - - /* Try to recognize a keyword. Uses minimum-perfect hash function */ - - { - register struct resword *ptr; - - if ((ptr = is_reserved_word (token_buffer, p - token_buffer))) - { - if (ptr->rid) - { - tree old_ttype = ridpointers[(int) ptr->rid]; - - /* If this provides a type for us, then revert lexical - state to standard state. */ - if (TREE_CODE (old_ttype) == IDENTIFIER_NODE - && IDENTIFIER_GLOBAL_VALUE (old_ttype) != 0 - && TREE_CODE (IDENTIFIER_GLOBAL_VALUE (old_ttype)) == TYPE_DECL) - looking_for_typename = 0; - else if (ptr->token == AGGR || ptr->token == ENUM) - looking_for_typename = 2; - - /* Check if this is a language-type declaration. - Just glimpse the next non-white character. */ - nextchar = skip_white_space (nextchar); - if (nextchar == '"') - { - /* We are looking at a string. Complain - if the token before the string is no `extern'. - - Could cheat some memory by placing this string - on the temporary_, instead of the saveable_ - obstack. */ - - if (ptr->rid != RID_EXTERN) - error ("invalid modifier `%s' for language string", - ptr->name); - real_yylex (); - value = EXTERN_LANG_STRING; - yylval.ttype = get_identifier (TREE_STRING_POINTER (yylval.ttype)); - break; - } - if (ptr->token == VISSPEC) - { - switch (ptr->rid) - { - case RID_PUBLIC: - yylval.ttype = access_public_node; - break; - case RID_PRIVATE: - yylval.ttype = access_private_node; - break; - case RID_PROTECTED: - yylval.ttype = access_protected_node; - break; - default: - my_friendly_abort (63); - } - } - else - yylval.ttype = old_ttype; - } - else if (ptr->token == EQCOMPARE) - { - yylval.code = NE_EXPR; - token_buffer[0] = '!'; - token_buffer[1] = '='; - token_buffer[2] = 0; - } - else if (ptr->token == ASSIGN) - { - if (strcmp ("and_eq", token_buffer) == 0) - { - yylval.code = BIT_AND_EXPR; - token_buffer[0] = '&'; - } - else if (strcmp ("or_eq", token_buffer) == 0) - { - yylval.code = BIT_IOR_EXPR; - token_buffer[0] = '|'; - } - else if (strcmp ("xor_eq", token_buffer) == 0) - { - yylval.code = BIT_XOR_EXPR; - token_buffer[0] = '^'; - } - token_buffer[1] = '='; - token_buffer[2] = 0; - } - else if (ptr->token == '&') - { - yylval.code = BIT_AND_EXPR; - token_buffer[0] = '&'; - token_buffer[1] = 0; - } - else if (ptr->token == '|') - { - yylval.code = BIT_IOR_EXPR; - token_buffer[0] = '|'; - token_buffer[1] = 0; - } - else if (ptr->token == '^') - { - yylval.code = BIT_XOR_EXPR; - token_buffer[0] = '^'; - token_buffer[1] = 0; - } - - value = (int) ptr->token; - } - } - - /* If we did not find a keyword, look for an identifier - (or a typename). */ - - if (value == IDENTIFIER || value == TYPESPEC) - GNU_xref_ref (current_function_decl, token_buffer); - - if (value == IDENTIFIER) - { - register tree tmp = get_identifier (token_buffer); - -#if !defined(VMS) && defined(JOINER) - /* Make sure that user does not collide with our internal - naming scheme. */ - if (JOINER == '$' - && dollar_seen - && (THIS_NAME_P (tmp) - || VPTR_NAME_P (tmp) - || DESTRUCTOR_NAME_P (tmp) - || VTABLE_NAME_P (tmp) - || TEMP_NAME_P (tmp) - || ANON_AGGRNAME_P (tmp) - || ANON_PARMNAME_P (tmp))) - warning ("identifier name `%s' conflicts with GNU C++ internal naming strategy", - token_buffer); -#endif - - yylval.ttype = tmp; - } - if (value == NEW && ! global_bindings_p ()) - { - value = NEW; - goto done; - } - } - break; - - case '.': - { - register int c1 = getch (); - token_buffer[0] = c; - token_buffer[1] = c1; - if (c1 == '*') - { - value = DOT_STAR; - token_buffer[2] = 0; - goto done; - } - if (c1 == '.') - { - c1 = getch (); - if (c1 == '.') - { - token_buffer[2] = c1; - token_buffer[3] = 0; - value = ELLIPSIS; - goto done; - } - error ("parse error at `..'"); - } - if (ISDIGIT (c1)) - { - put_back (c1); - goto resume_numerical_scan; - } - nextchar = c1; - value = '.'; - token_buffer[1] = 0; - goto done; - } - case '0': case '1': - /* Optimize for most frequent case. */ - { - register int c1 = getch (); - if (! ISALNUM (c1) && c1 != '.') - { - /* Terminate string. */ - token_buffer[0] = c; - token_buffer[1] = 0; - if (c == '0') - yylval.ttype = integer_zero_node; - else - yylval.ttype = integer_one_node; - nextchar = c1; - value = CONSTANT; - goto done; - } - put_back (c1); - } - /* fall through... */ - case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - resume_numerical_scan: - { - register char *p; - int base = 10; - int count = 0; - int largest_digit = 0; - int numdigits = 0; - /* for multi-precision arithmetic, - we actually store only HOST_BITS_PER_CHAR bits in each part. - The number of parts is chosen so as to be sufficient to hold - the enough bits to fit into the two HOST_WIDE_INTs that contain - the integer value (this is always at least as many bits as are - in a target `long long' value, but may be wider). */ -#define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2 + 2) - int parts[TOTAL_PARTS]; - int overflow = 0; - - enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS} floatflag - = NOT_FLOAT; - - for (count = 0; count < TOTAL_PARTS; count++) - parts[count] = 0; - - p = token_buffer; - *p++ = c; - - if (c == '0') - { - *p++ = (c = getch ()); - if ((c == 'x') || (c == 'X')) - { - base = 16; - *p++ = (c = getch ()); - } - /* Leading 0 forces octal unless the 0 is the only digit. */ - else if (c >= '0' && c <= '9') - { - base = 8; - numdigits++; - } - else - numdigits++; - } - - /* Read all the digits-and-decimal-points. */ - - while (c == '.' - || (ISALNUM (c) && (c != 'l') && (c != 'L') - && (c != 'u') && (c != 'U') - && c != 'i' && c != 'I' && c != 'j' && c != 'J' - && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F'))))) - { - if (c == '.') - { - if (base == 16) - error ("floating constant may not be in radix 16"); - if (floatflag == TOO_MANY_POINTS) - /* We have already emitted an error. Don't need another. */ - ; - else if (floatflag == AFTER_POINT) - { - error ("malformed floating constant"); - floatflag = TOO_MANY_POINTS; - /* Avoid another error from atof by forcing all characters - from here on to be ignored. */ - p[-1] = '\0'; - } - else - floatflag = AFTER_POINT; - - base = 10; - *p++ = c = getch (); - /* Accept '.' as the start of a floating-point number - only when it is followed by a digit. - Otherwise, unread the following non-digit - and use the '.' as a structural token. */ - if (p == token_buffer + 2 && !ISDIGIT (c)) - { - if (c == '.') - { - c = getch (); - if (c == '.') - { - *p++ = '.'; - *p = '\0'; - value = ELLIPSIS; - goto done; - } - error ("parse error at `..'"); - } - nextchar = c; - token_buffer[1] = '\0'; - value = '.'; - goto done; - } - } - else - { - /* It is not a decimal point. - It should be a digit (perhaps a hex digit). */ - - if (ISDIGIT (c)) - { - c = c - '0'; - } - else if (base <= 10) - { - if (c == 'e' || c == 'E') - { - base = 10; - floatflag = AFTER_POINT; - break; /* start of exponent */ - } - error ("nondigits in number and not hexadecimal"); - c = 0; - } - else if (c >= 'a') - { - c = c - 'a' + 10; - } - else - { - c = c - 'A' + 10; - } - if (c >= largest_digit) - largest_digit = c; - numdigits++; - - for (count = 0; count < TOTAL_PARTS; count++) - { - parts[count] *= base; - if (count) - { - parts[count] - += (parts[count-1] >> HOST_BITS_PER_CHAR); - parts[count-1] - &= (1 << HOST_BITS_PER_CHAR) - 1; - } - else - parts[0] += c; - } - - /* If the extra highest-order part ever gets anything in it, - the number is certainly too big. */ - if (parts[TOTAL_PARTS - 1] != 0) - overflow = 1; - - if (p >= token_buffer + maxtoken - 3) - p = extend_token_buffer (p); - *p++ = (c = getch ()); - } - } - - if (numdigits == 0) - error ("numeric constant with no digits"); - - if (largest_digit >= base) - error ("numeric constant contains digits beyond the radix"); - - /* Remove terminating char from the token buffer and delimit the string */ - *--p = 0; - - if (floatflag != NOT_FLOAT) - { - tree type = double_type_node; - int exceeds_double = 0; - int imag = 0; - REAL_VALUE_TYPE value; - struct pf_args args; - - /* Read explicit exponent if any, and put it in tokenbuf. */ - - if ((c == 'e') || (c == 'E')) - { - if (p >= token_buffer + maxtoken - 3) - p = extend_token_buffer (p); - *p++ = c; - c = getch (); - if ((c == '+') || (c == '-')) - { - *p++ = c; - c = getch (); - } - if (! ISDIGIT (c)) - error ("floating constant exponent has no digits"); - while (ISDIGIT (c)) - { - if (p >= token_buffer + maxtoken - 3) - p = extend_token_buffer (p); - *p++ = c; - c = getch (); - } - } - - *p = 0; - errno = 0; - - /* Setup input for parse_float() */ - args.p = p; - args.c = c; - args.imag = imag; - args.type = type; - - /* Convert string to a double, checking for overflow. */ - if (do_float_handler (parse_float, (PTR) &args)) - { - /* Receive output from parse_float() */ - value = args.value; - } - else - { - /* We got an exception from parse_float() */ - error ("floating constant out of range"); - value = dconst0; - } - - /* Receive output from parse_float() */ - p = args.p; - c = args.c; - imag = args.imag; - type = args.type; - -#ifdef ERANGE - if (errno == ERANGE && pedantic) - { - /* ERANGE is also reported for underflow, - so test the value to distinguish overflow from that. */ - if (REAL_VALUES_LESS (dconst1, value) - || REAL_VALUES_LESS (value, dconstm1)) - { - pedwarn ("floating point number exceeds range of `%s'", - IDENTIFIER_POINTER (TYPE_IDENTIFIER (type))); - exceeds_double = 1; - } - } -#endif - - /* If the result is not a number, assume it must have been - due to some error message above, so silently convert - it to a zero. */ - if (REAL_VALUE_ISNAN (value)) - value = dconst0; - - /* Create a node with determined type and value. */ - if (imag) - yylval.ttype = build_complex (NULL_TREE, - cp_convert (type, integer_zero_node), - build_real (type, value)); - else - yylval.ttype = build_real (type, value); - } - else - { - tree type; - HOST_WIDE_INT high, low; - int spec_unsigned = 0; - int spec_long = 0; - int spec_long_long = 0; - int spec_imag = 0; - int bytes, warn; - - while (1) - { - if (c == 'u' || c == 'U') - { - if (spec_unsigned) - error ("two `u's in integer constant"); - spec_unsigned = 1; - } - else if (c == 'l' || c == 'L') - { - if (spec_long) - { - if (spec_long_long) - error ("three `l's in integer constant"); - else if (pedantic && ! in_system_header && warn_long_long) - pedwarn ("ANSI C++ forbids long long integer constants"); - spec_long_long = 1; - } - spec_long = 1; - } - else if (c == 'i' || c == 'j' || c == 'I' || c == 'J') - { - if (spec_imag) - error ("more than one `i' or `j' in numeric constant"); - else if (pedantic) - pedwarn ("ANSI C++ forbids imaginary numeric constants"); - spec_imag = 1; - } - else - break; - if (p >= token_buffer + maxtoken - 3) - p = extend_token_buffer (p); - *p++ = c; - c = getch (); - } - - /* If the constant is not long long and it won't fit in an - unsigned long, or if the constant is long long and won't fit - in an unsigned long long, then warn that the constant is out - of range. */ - - /* ??? This assumes that long long and long integer types are - a multiple of 8 bits. This better than the original code - though which assumed that long was exactly 32 bits and long - long was exactly 64 bits. */ - - if (spec_long_long) - bytes = TYPE_PRECISION (long_long_integer_type_node) / 8; - else - bytes = TYPE_PRECISION (long_integer_type_node) / 8; - - warn = overflow; - for (i = bytes; i < TOTAL_PARTS; i++) - if (parts[i]) - warn = 1; - if (warn) - pedwarn ("integer constant out of range"); - - /* This is simplified by the fact that our constant - is always positive. */ - high = low = 0; - - for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++) - { - high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT - / HOST_BITS_PER_CHAR)] - << (i * HOST_BITS_PER_CHAR)); - low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR); - } - - - yylval.ttype = build_int_2 (low, high); - TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node; - - /* Calculate the ANSI type. */ - if (!spec_long && !spec_unsigned - && int_fits_type_p (yylval.ttype, integer_type_node)) - type = integer_type_node; - else if (!spec_long && (base != 10 || spec_unsigned) - && int_fits_type_p (yylval.ttype, unsigned_type_node)) - /* Nondecimal constants try unsigned even in traditional C. */ - type = unsigned_type_node; - else if (!spec_unsigned && !spec_long_long - && int_fits_type_p (yylval.ttype, long_integer_type_node)) - type = long_integer_type_node; - else if (! spec_long_long) - type = long_unsigned_type_node; - else if (! spec_unsigned - /* Verify value does not overflow into sign bit. */ - && TREE_INT_CST_HIGH (yylval.ttype) >= 0 - && int_fits_type_p (yylval.ttype, - long_long_integer_type_node)) - type = long_long_integer_type_node; - else - type = long_long_unsigned_type_node; - - if (!int_fits_type_p (yylval.ttype, type) && !warn) - pedwarn ("integer constant out of range"); - - if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type)) - warning ("decimal integer constant is so large that it is unsigned"); - - if (spec_imag) - { - if (TYPE_PRECISION (type) - <= TYPE_PRECISION (integer_type_node)) - yylval.ttype - = build_complex (NULL_TREE, integer_zero_node, - cp_convert (integer_type_node, - yylval.ttype)); - else - error ("complex integer constant is too wide for `__complex int'"); - } - else - TREE_TYPE (yylval.ttype) = type; - } - - put_back (c); - *p = 0; - - value = CONSTANT; break; - } - - case '\'': - char_constant: - { - register int result = 0; - register int num_chars = 0; - int chars_seen = 0; - unsigned width = TYPE_PRECISION (char_type_node); - int max_chars; -#ifdef MULTIBYTE_CHARS - int longest_char = local_mb_cur_max (); - (void) local_mbtowc (NULL_PTR, NULL_PTR, 0); -#endif - - max_chars = TYPE_PRECISION (integer_type_node) / width; - if (wide_flag) - width = WCHAR_TYPE_SIZE; - - while (1) - { - tryagain: - c = getch (); - - if (c == '\'' || c == EOF) - break; - - ++chars_seen; - if (c == '\\') - { - int ignore = 0; - c = readescape (&ignore); - if (ignore) - goto tryagain; - if (width < HOST_BITS_PER_INT - && (unsigned) c >= ((unsigned)1 << width)) - pedwarn ("escape sequence out of range for character"); -#ifdef MAP_CHARACTER - if (ISPRINT (c)) - c = MAP_CHARACTER (c); -#endif - } - else if (c == '\n') - { - if (pedantic) - pedwarn ("ANSI C forbids newline in character constant"); - lineno++; - } - else - { -#ifdef MULTIBYTE_CHARS - wchar_t wc; - int i; - int char_len = -1; - for (i = 1; i <= longest_char; ++i) - { - if (i > maxtoken - 4) - extend_token_buffer (token_buffer); - - token_buffer[i] = c; - char_len = local_mbtowc (& wc, - token_buffer + 1, - i); - if (char_len != -1) - break; - c = getch (); - } - if (char_len > 1) - { - /* mbtowc sometimes needs an extra char before accepting */ - if (char_len < i) - put_back (c); - if (! wide_flag) - { - /* Merge character into result; ignore excess chars. */ - for (i = 1; i <= char_len; ++i) - { - if (i > max_chars) - break; - if (width < HOST_BITS_PER_INT) - result = (result << width) - | (token_buffer[i] - & ((1 << width) - 1)); - else - result = token_buffer[i]; - } - num_chars += char_len; - goto tryagain; - } - c = wc; - } - else - { - if (char_len == -1) - warning ("Ignoring invalid multibyte character"); - if (wide_flag) - c = wc; -#ifdef MAP_CHARACTER - else - c = MAP_CHARACTER (c); -#endif - } -#else /* ! MULTIBYTE_CHARS */ -#ifdef MAP_CHARACTER - c = MAP_CHARACTER (c); -#endif -#endif /* ! MULTIBYTE_CHARS */ - } - - if (wide_flag) - { - if (chars_seen == 1) /* only keep the first one */ - result = c; - goto tryagain; - } - - /* Merge character into result; ignore excess chars. */ - num_chars++; - if (num_chars < max_chars + 1) - { - if (width < HOST_BITS_PER_INT) - result = (result << width) | (c & ((1 << width) - 1)); - else - result = c; - } - } - - if (c != '\'') - error ("malformatted character constant"); - else if (chars_seen == 0) - error ("empty character constant"); - else if (num_chars > max_chars) - { - num_chars = max_chars; - error ("character constant too long"); - } - else if (chars_seen != 1 && warn_multichar) - warning ("multi-character character constant"); - - /* If char type is signed, sign-extend the constant. */ - if (! wide_flag) - { - int num_bits = num_chars * width; - if (num_bits == 0) - /* We already got an error; avoid invalid shift. */ - yylval.ttype = build_int_2 (0, 0); - else if (TREE_UNSIGNED (char_type_node) - || ((result >> (num_bits - 1)) & 1) == 0) - yylval.ttype - = build_int_2 (result & (~(unsigned HOST_WIDE_INT) 0 - >> (HOST_BITS_PER_WIDE_INT - num_bits)), - 0); - else - yylval.ttype - = build_int_2 (result | ~(~(unsigned HOST_WIDE_INT) 0 - >> (HOST_BITS_PER_WIDE_INT - num_bits)), - -1); - if (chars_seen <= 1) - TREE_TYPE (yylval.ttype) = char_type_node; - else - TREE_TYPE (yylval.ttype) = integer_type_node; - } - else - { - yylval.ttype = build_int_2 (result, 0); - TREE_TYPE (yylval.ttype) = wchar_type_node; - } - - value = CONSTANT; - break; - } - - case '"': - string_constant: - { - register char *p; - unsigned width = wide_flag ? WCHAR_TYPE_SIZE - : TYPE_PRECISION (char_type_node); -#ifdef MULTIBYTE_CHARS - int longest_char = local_mb_cur_max (); - (void) local_mbtowc (NULL_PTR, NULL_PTR, 0); -#endif - - c = getch (); - p = token_buffer + 1; - - while (c != '"' && c >= 0) - { - /* ignore_escape_flag is set for reading the filename in #line. */ - if (!ignore_escape_flag && c == '\\') - { - int ignore = 0; - c = readescape (&ignore); - if (ignore) - goto skipnewline; - if (width < HOST_BITS_PER_INT - && (unsigned) c >= ((unsigned)1 << width)) - warning ("escape sequence out of range for character"); - } - else if (c == '\n') - { - if (pedantic) - pedwarn ("ANSI C++ forbids newline in string constant"); - lineno++; - } - else - { -#ifdef MULTIBYTE_CHARS - wchar_t wc; - int i; - int char_len = -1; - for (i = 0; i < longest_char; ++i) - { - if (p + i >= token_buffer + maxtoken) - p = extend_token_buffer (p); - p[i] = c; - - char_len = local_mbtowc (& wc, p, i + 1); - if (char_len != -1) - break; - c = getch (); - } - if (char_len == -1) - warning ("Ignoring invalid multibyte character"); - else - { - /* mbtowc sometimes needs an extra char before accepting */ - if (char_len <= i) - put_back (c); - if (! wide_flag) - { - p += (i + 1); - c = getch (); - continue; - } - c = wc; - } -#endif /* MULTIBYTE_CHARS */ - } - - /* Add this single character into the buffer either as a wchar_t - or as a single byte. */ - if (wide_flag) - { - unsigned width = TYPE_PRECISION (char_type_node); - unsigned bytemask = (1 << width) - 1; - int byte; - - if (p + WCHAR_BYTES > token_buffer + maxtoken) - p = extend_token_buffer (p); - - for (byte = 0; byte < WCHAR_BYTES; ++byte) - { - int value; - if (byte >= (int) sizeof(c)) - value = 0; - else - value = (c >> (byte * width)) & bytemask; - if (BYTES_BIG_ENDIAN) - p[WCHAR_BYTES - byte - 1] = value; - else - p[byte] = value; - } - p += WCHAR_BYTES; - } - else - { - if (p >= token_buffer + maxtoken) - p = extend_token_buffer (p); - *p++ = c; - } - - skipnewline: - c = getch (); - if (c == EOF) { - error ("Unterminated string"); - break; - } - } - - /* Terminate the string value, either with a single byte zero - or with a wide zero. */ - if (wide_flag) - { - if (p + WCHAR_BYTES > token_buffer + maxtoken) - p = extend_token_buffer (p); - bzero (p, WCHAR_BYTES); - p += WCHAR_BYTES; - } - else - { - if (p >= token_buffer + maxtoken) - p = extend_token_buffer (p); - *p++ = 0; - } - - /* We have read the entire constant. - Construct a STRING_CST for the result. */ - - if (processing_template_decl) - push_obstacks (&permanent_obstack, &permanent_obstack); - yylval.ttype = build_string (p - (token_buffer + 1), token_buffer + 1); - if (processing_template_decl) - pop_obstacks (); - - if (wide_flag) - TREE_TYPE (yylval.ttype) = wchar_array_type_node; - else - TREE_TYPE (yylval.ttype) = char_array_type_node; - - value = STRING; break; - } - - case '+': - case '-': - case '&': - case '|': - case '<': - case '>': - case '*': - case '/': - case '%': - case '^': - case '!': - case '=': - { - register int c1; - - combine: - - switch (c) - { - case '+': - yylval.code = PLUS_EXPR; break; - case '-': - yylval.code = MINUS_EXPR; break; - case '&': - yylval.code = BIT_AND_EXPR; break; - case '|': - yylval.code = BIT_IOR_EXPR; break; - case '*': - yylval.code = MULT_EXPR; break; - case '/': - yylval.code = TRUNC_DIV_EXPR; break; - case '%': - yylval.code = TRUNC_MOD_EXPR; break; - case '^': - yylval.code = BIT_XOR_EXPR; break; - case LSHIFT: - yylval.code = LSHIFT_EXPR; break; - case RSHIFT: - yylval.code = RSHIFT_EXPR; break; - case '<': - yylval.code = LT_EXPR; break; - case '>': - yylval.code = GT_EXPR; break; - } - - token_buffer[1] = c1 = getch (); - token_buffer[2] = 0; - - if (c1 == '=') - { - switch (c) - { - case '<': - value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done; - case '>': - value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done; - case '!': - value = EQCOMPARE; yylval.code = NE_EXPR; goto done; - case '=': - value = EQCOMPARE; yylval.code = EQ_EXPR; goto done; - } - value = ASSIGN; goto done; - } - else if (c == c1) - switch (c) - { - case '+': - value = PLUSPLUS; goto done; - case '-': - value = MINUSMINUS; goto done; - case '&': - value = ANDAND; goto done; - case '|': - value = OROR; goto done; - case '<': - c = LSHIFT; - goto combine; - case '>': - c = RSHIFT; - goto combine; - } - else if ((c == '-') && (c1 == '>')) - { - nextchar = getch (); - if (nextchar == '*') - { - nextchar = -1; - value = POINTSAT_STAR; - } - else - value = POINTSAT; - goto done; - } - else if (c1 == '?' && (c == '<' || c == '>')) - { - token_buffer[3] = 0; - - c1 = getch (); - yylval.code = (c == '<' ? MIN_EXPR : MAX_EXPR); - if (c1 == '=') - { - /* ?= expression. */ - token_buffer[2] = c1; - value = ASSIGN; - } - else - { - value = MIN_MAX; - nextchar = c1; - } - if (pedantic) - pedwarn ("use of `operator %s' is not standard C++", - token_buffer); - goto done; - } - /* digraphs */ - else if (c == '<' && c1 == '%') - { value = '{'; goto done; } - else if (c == '<' && c1 == ':') - { value = '['; goto done; } - else if (c == '%' && c1 == '>') - { value = '}'; goto done; } - else if (c == '%' && c1 == ':') - { value = '#'; goto done; } - - nextchar = c1; - token_buffer[1] = 0; - - value = c; - goto done; - } - - case ':': - c = getch (); - if (c == ':') - { - token_buffer[1] = ':'; - token_buffer[2] = '\0'; - value = SCOPE; - yylval.itype = 1; - } - else if (c == '>') - { - value = ']'; - goto done; - } - else - { - nextchar = c; - value = ':'; - } - break; - - case 0: - /* Don't make yyparse think this is eof. */ - value = 1; - break; - - case '(': - /* try, weakly, to handle casts to pointers to functions. */ - nextchar = skip_white_space (getch ()); - if (nextchar == '*') - { - int next_c = skip_white_space (getch ()); - if (next_c == ')') - { - nextchar = -1; - yylval.ttype = build1 (INDIRECT_REF, 0, 0); - value = PAREN_STAR_PAREN; - } - else - { - put_back (next_c); - value = c; - } - } - else if (nextchar == ')') - { - nextchar = -1; - yylval.ttype = NULL_TREE; - value = LEFT_RIGHT; - } - else value = c; - break; - - default: - value = c; - } - -done: -/* yylloc.last_line = lineno; */ -#ifdef GATHER_STATISTICS -#ifdef REDUCE_LENGTH - token_count[value] += 1; -#endif -#endif - - return value; -} - -int -is_rid (t) - tree t; -{ - return !!is_reserved_word (IDENTIFIER_POINTER (t), IDENTIFIER_LENGTH (t)); -} - -#ifdef GATHER_STATISTICS -/* The original for tree_node_kind is in the toplevel tree.c; changes there - need to be brought into here, unless this were actually put into a header - instead. */ -/* Statistics-gathering stuff. */ -typedef enum -{ - d_kind, - t_kind, - b_kind, - s_kind, - r_kind, - e_kind, - c_kind, - id_kind, - op_id_kind, - perm_list_kind, - temp_list_kind, - vec_kind, - x_kind, - lang_decl, - lang_type, - all_kinds -} tree_node_kind; - -extern int tree_node_counts[]; -extern int tree_node_sizes[]; -#endif - -/* Place to save freed lang_decls which were allocated on the - permanent_obstack. @@ Not currently used. */ -tree free_lang_decl_chain; - -tree -build_lang_decl (code, name, type) - enum tree_code code; - tree name; - tree type; -{ - register tree t = build_decl (code, name, type); - retrofit_lang_decl (t); - return t; -} - -/* Add DECL_LANG_SPECIFIC info to T. Called from build_lang_decl - and pushdecl (for functions generated by the backend). */ - -void -retrofit_lang_decl (t) - tree t; -{ - struct obstack *obstack = current_obstack; - register int i = sizeof (struct lang_decl) / sizeof (int); - register int *pi; - - if (! TREE_PERMANENT (t)) - obstack = saveable_obstack; - else - /* Could be that saveable is permanent and current is not. */ - obstack = &permanent_obstack; - - if (free_lang_decl_chain && obstack == &permanent_obstack) - { - pi = (int *)free_lang_decl_chain; - free_lang_decl_chain = TREE_CHAIN (free_lang_decl_chain); - } - else - pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl)); - - while (i > 0) - pi[--i] = 0; - - DECL_LANG_SPECIFIC (t) = (struct lang_decl *) pi; - LANG_DECL_PERMANENT ((struct lang_decl *) pi) - = obstack == &permanent_obstack; - my_friendly_assert (LANG_DECL_PERMANENT ((struct lang_decl *) pi) - == TREE_PERMANENT (t), 234); - DECL_MAIN_VARIANT (t) = t; - if (current_lang_name == lang_name_cplusplus) - DECL_LANGUAGE (t) = lang_cplusplus; - else if (current_lang_name == lang_name_c) - DECL_LANGUAGE (t) = lang_c; - else if (current_lang_name == lang_name_java) - DECL_LANGUAGE (t) = lang_java; - else my_friendly_abort (64); - -#if 0 /* not yet, should get fixed properly later */ - if (code == TYPE_DECL) - { - tree id; - id = get_identifier (build_overload_name (type, 1, 1)); - DECL_ASSEMBLER_NAME (t) = id; - } - -#endif -#ifdef GATHER_STATISTICS - tree_node_counts[(int)lang_decl] += 1; - tree_node_sizes[(int)lang_decl] += sizeof (struct lang_decl); -#endif -} - -tree -build_lang_field_decl (code, name, type) - enum tree_code code; - tree name; - tree type; -{ - extern struct obstack *current_obstack, *saveable_obstack; - register tree t = build_decl (code, name, type); - struct obstack *obstack = current_obstack; - register int i = sizeof (struct lang_decl_flags) / sizeof (int); - register int *pi; -#if 0 /* not yet, should get fixed properly later */ - - if (code == TYPE_DECL) - { - tree id; - id = get_identifier (build_overload_name (type, 1, 1)); - DECL_ASSEMBLER_NAME (t) = id; - } -#endif - - if (! TREE_PERMANENT (t)) - obstack = saveable_obstack; - else - my_friendly_assert (obstack == &permanent_obstack, 235); - - pi = (int *) obstack_alloc (obstack, sizeof (struct lang_decl_flags)); - while (i > 0) - pi[--i] = 0; - - DECL_LANG_SPECIFIC (t) = (struct lang_decl *) pi; - return t; -} - -void -copy_lang_decl (node) - tree node; -{ - int size; - int *pi; - - if (! DECL_LANG_SPECIFIC (node)) - return; - - if (TREE_CODE (node) == FIELD_DECL) - size = sizeof (struct lang_decl_flags); - else - size = sizeof (struct lang_decl); - pi = (int *)obstack_alloc (&permanent_obstack, size); - bcopy ((char *)DECL_LANG_SPECIFIC (node), (char *)pi, size); - DECL_LANG_SPECIFIC (node) = (struct lang_decl *)pi; -} - -tree -make_lang_type (code) - enum tree_code code; -{ - extern struct obstack *current_obstack, *saveable_obstack; - register tree t = make_node (code); - - /* Set up some flags that give proper default behavior. */ - if (IS_AGGR_TYPE_CODE (code)) - { - struct obstack *obstack = current_obstack; - struct lang_type *pi; - - SET_IS_AGGR_TYPE (t, 1); - - if (! TREE_PERMANENT (t)) - obstack = saveable_obstack; - else - my_friendly_assert (obstack == &permanent_obstack, 236); - - pi = (struct lang_type *) obstack_alloc (obstack, sizeof (struct lang_type)); - bzero ((char *) pi, (int) sizeof (struct lang_type)); - - TYPE_LANG_SPECIFIC (t) = pi; - SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown); - CLASSTYPE_INTERFACE_ONLY (t) = interface_only; - - /* Make sure this is laid out, for ease of use later. In the - presence of parse errors, the normal was of assuring this - might not ever get executed, so we lay it out *immediately*. */ - build_pointer_type (t); - -#ifdef GATHER_STATISTICS - tree_node_counts[(int)lang_type] += 1; - tree_node_sizes[(int)lang_type] += sizeof (struct lang_type); -#endif - } - else - /* We use TYPE_ALIAS_SET for the CLASSTYPE_MARKED bits. But, - TYPE_ALIAS_SET is initialized to -1 by default, so we must - clear it here. */ - TYPE_ALIAS_SET (t) = 0; - - /* We need to allocate a TYPE_BINFO even for TEMPALTE_TYPE_PARMs - since they can be virtual base types, and we then need a - canonical binfo for them. Ideally, this would be done lazily for - all types. */ - if (IS_AGGR_TYPE_CODE (code) || code == TEMPLATE_TYPE_PARM) - TYPE_BINFO (t) = make_binfo (integer_zero_node, t, NULL_TREE, NULL_TREE); - - return t; -} - -void -dump_time_statistics () -{ - register tree prev = 0, decl, next; - int this_time = my_get_run_time (); - TREE_INT_CST_LOW (TIME_IDENTIFIER_TIME (this_filename_time)) - += this_time - body_time; - - fprintf (stderr, "\n******\n"); - print_time ("header files (total)", header_time); - print_time ("main file (total)", this_time - body_time); - fprintf (stderr, "ratio = %g : 1\n", - (double)header_time / (double)(this_time - body_time)); - fprintf (stderr, "\n******\n"); - - for (decl = filename_times; decl; decl = next) - { - next = IDENTIFIER_GLOBAL_VALUE (decl); - SET_IDENTIFIER_GLOBAL_VALUE (decl, prev); - prev = decl; - } - - for (decl = prev; decl; decl = IDENTIFIER_GLOBAL_VALUE (decl)) - print_time (IDENTIFIER_POINTER (decl), - TREE_INT_CST_LOW (TIME_IDENTIFIER_TIME (decl))); -} - -void -compiler_error VPROTO ((const char *msg, ...)) -{ -#ifndef ANSI_PROTOTYPES - const char *msg; -#endif - char buf[1024]; - va_list ap; - - VA_START (ap, msg); - -#ifndef ANSI_PROTOTYPES - msg = va_arg (ap, const char *); -#endif - - vsprintf (buf, msg, ap); - error_with_file_and_line (input_filename, lineno, "%s (compiler error)", buf); -} - -void -yyerror (string) - const char *string; -{ - extern int end_of_file; - char buf[200]; - - strcpy (buf, string); - - /* We can't print string and character constants well - because the token_buffer contains the result of processing escapes. */ - if (end_of_file) - strcat (buf, input_redirected () - ? " at end of saved text" - : " at end of input"); - else if (token_buffer[0] == 0) - strcat (buf, " at null character"); - else if (token_buffer[0] == '"') - strcat (buf, " before string constant"); - else if (token_buffer[0] == '\'') - strcat (buf, " before character constant"); - else if (!ISGRAPH ((unsigned char)token_buffer[0])) - sprintf (buf + strlen (buf), " before character 0%o", - (unsigned char) token_buffer[0]); - else - strcat (buf, " before `%s'"); - - error (buf, token_buffer); -} - -static int -handle_cp_pragma (pname) - const char *pname; -{ - register int token; - - if (! strcmp (pname, "vtable")) - { - extern tree pending_vtables; - - /* More follows: it must be a string constant (class name). */ - token = real_yylex (); - if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST) - { - error ("invalid #pragma vtable"); - return -1; - } - - if (write_virtuals != 2) - { - warning ("use `+e2' option to enable #pragma vtable"); - return -1; - } - pending_vtables - = perm_tree_cons (NULL_TREE, - get_identifier (TREE_STRING_POINTER (yylval.ttype)), - pending_vtables); - token = real_yylex (); - if (token != END_OF_LINE) - warning ("trailing characters ignored"); - return 1; - } - else if (! strcmp (pname, "unit")) - { - /* More follows: it must be a string constant (unit name). */ - token = real_yylex (); - if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST) - { - error ("invalid #pragma unit"); - return -1; - } - token = real_yylex (); - if (token != END_OF_LINE) - warning ("trailing characters ignored"); - return 1; - } - else if (! strcmp (pname, "interface")) - { - tree fileinfo - = TIME_IDENTIFIER_FILEINFO (get_time_identifier (input_filename)); - char *main_filename = input_filename; - - main_filename = file_name_nondirectory (main_filename); - - token = real_yylex (); - - if (token != END_OF_LINE) - { - if (token != STRING - || TREE_CODE (yylval.ttype) != STRING_CST) - { - error ("invalid `#pragma interface'"); - return -1; - } - main_filename = TREE_STRING_POINTER (yylval.ttype); - token = real_yylex (); - } - - if (token != END_OF_LINE) - warning ("garbage after `#pragma interface' ignored"); - - write_virtuals = 3; - - if (impl_file_chain == 0) - { - /* If this is zero at this point, then we are - auto-implementing. */ - if (main_input_filename == 0) - main_input_filename = input_filename; - -#ifdef AUTO_IMPLEMENT - filename = file_name_nondirectory (main_input_filename); - fi = get_time_identifier (filename); - fi = TIME_IDENTIFIER_FILEINFO (fi); - TREE_INT_CST_LOW (fi) = 0; - TREE_INT_CST_HIGH (fi) = 1; - /* Get default. */ - impl_file_chain = (struct impl_files *)permalloc (sizeof (struct impl_files)); - impl_file_chain->filename = filename; - impl_file_chain->next = 0; -#endif - } - - interface_only = interface_strcmp (main_filename); -#ifdef MULTIPLE_SYMBOL_SPACES - if (! interface_only) - interface_unknown = 0; -#else /* MULTIPLE_SYMBOL_SPACES */ - interface_unknown = 0; -#endif /* MULTIPLE_SYMBOL_SPACES */ - TREE_INT_CST_LOW (fileinfo) = interface_only; - TREE_INT_CST_HIGH (fileinfo) = interface_unknown; - - return 1; - } - else if (! strcmp (pname, "implementation")) - { - tree fileinfo - = TIME_IDENTIFIER_FILEINFO (get_time_identifier (input_filename)); - char *main_filename = main_input_filename ? main_input_filename : input_filename; - - main_filename = file_name_nondirectory (main_filename); - token = real_yylex (); - if (token != END_OF_LINE) - { - if (token != STRING - || TREE_CODE (yylval.ttype) != STRING_CST) - { - error ("invalid `#pragma implementation'"); - return -1; - } - main_filename = TREE_STRING_POINTER (yylval.ttype); - token = real_yylex (); - } - - if (token != END_OF_LINE) - warning ("garbage after `#pragma implementation' ignored"); - - if (write_virtuals == 3) - { - struct impl_files *ifiles = impl_file_chain; - while (ifiles) - { - if (! strcmp (ifiles->filename, main_filename)) - break; - ifiles = ifiles->next; - } - if (ifiles == 0) - { - ifiles = (struct impl_files*) permalloc (sizeof (struct impl_files)); - ifiles->filename = main_filename; - ifiles->next = impl_file_chain; - impl_file_chain = ifiles; - } - } - else if ((main_input_filename != 0 - && ! strcmp (main_input_filename, input_filename)) - || ! strcmp (input_filename, main_filename)) - { - write_virtuals = 3; - if (impl_file_chain == 0) - { - impl_file_chain = (struct impl_files*) permalloc (sizeof (struct impl_files)); - impl_file_chain->filename = main_filename; - impl_file_chain->next = 0; - } - } - else - error ("`#pragma implementation' can only appear at top-level"); - interface_only = 0; -#if 1 - /* We make this non-zero so that we infer decl linkage - in the impl file only for variables first declared - in the interface file. */ - interface_unknown = 1; -#else - /* We make this zero so that templates in the impl - file will be emitted properly. */ - interface_unknown = 0; -#endif - TREE_INT_CST_LOW (fileinfo) = interface_only; - TREE_INT_CST_HIGH (fileinfo) = interface_unknown; - - return 1; - } - - return 0; -} - -/* Return the type-qualifier corresponding to the identifier given by - RID. */ - -int -cp_type_qual_from_rid (rid) - tree rid; -{ - if (rid == ridpointers[(int) RID_CONST]) - return TYPE_QUAL_CONST; - else if (rid == ridpointers[(int) RID_VOLATILE]) - return TYPE_QUAL_VOLATILE; - else if (rid == ridpointers[(int) RID_RESTRICT]) - return TYPE_QUAL_RESTRICT; - - my_friendly_abort (0); - return TYPE_UNQUALIFIED; -} - - -#ifdef HANDLE_GENERIC_PRAGMAS - -/* Handle a #pragma directive. TOKEN is the type of the word following - the #pragma directive on the line. Process the entire input line and - return non-zero iff the directive successfully parsed. */ - -/* This function has to be in this file, in order to get at - the token types. */ - -static int -handle_generic_pragma (token) - register int token; -{ - for (;;) - { - switch (token) - { - case IDENTIFIER: - case TYPENAME: - case STRING: - case CONSTANT: - handle_pragma_token (token_buffer, yylval.ttype); - break; - - case LEFT_RIGHT: - handle_pragma_token ("(", NULL_TREE); - handle_pragma_token (")", NULL_TREE); - break; - - case END_OF_LINE: - return handle_pragma_token (NULL_PTR, NULL_TREE); - - default: - handle_pragma_token (token_buffer, NULL_TREE); - } - - token = real_yylex (); - } -} -#endif /* HANDLE_GENERIC_PRAGMAS */ diff --git a/contrib/gcc/cp/lex.h b/contrib/gcc/cp/lex.h deleted file mode 100644 index 249eef9bb0f6..000000000000 --- a/contrib/gcc/cp/lex.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Define constants and variables for communication with parse.y. - Copyright (C) 1987, 92-97, 1998 Free Software Foundation, Inc. - Hacked by Michael Tiemann (tiemann@cygnus.com) - and by Brendan Kehoe (brendan@cygnus.com). - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. */ - - - -enum rid -{ - RID_UNUSED, - RID_INT, - RID_BOOL, - RID_CHAR, - RID_WCHAR, - RID_FLOAT, - RID_DOUBLE, - RID_VOID, - - /* C++ extension */ - RID_CLASS, - RID_RECORD, - RID_UNION, - RID_ENUM, - RID_LONGLONG, - - /* This is where grokdeclarator starts its search when setting the specbits. - The first seven are in the order of most frequently used, as found - building libg++. */ - - RID_EXTERN, - RID_CONST, - RID_LONG, - RID_TYPEDEF, - RID_UNSIGNED, - RID_SHORT, - RID_INLINE, - - RID_STATIC, - - RID_REGISTER, - RID_VOLATILE, - RID_FRIEND, - RID_VIRTUAL, - RID_EXPLICIT, - RID_EXPORT, - RID_SIGNED, - RID_AUTO, - RID_MUTABLE, - RID_COMPLEX, - RID_RESTRICT, - - /* This is where grokdeclarator ends its search when setting the - specbits. */ - - RID_PUBLIC, - RID_PRIVATE, - RID_PROTECTED, - RID_EXCEPTION, - RID_TEMPLATE, - RID_SIGNATURE, - RID_NULL, - /* Before adding enough to get up to 64, the RIDBIT_* macros - will have to be changed a little. */ - RID_MAX -}; - -#define NORID RID_UNUSED - -#define RID_FIRST_MODIFIER RID_EXTERN -#define RID_LAST_MODIFIER RID_COMPLEX - -/* The type that can represent all values of RIDBIT. */ -/* We assume that we can stick in at least 32 bits into this. */ -typedef struct { unsigned long idata[2]; } - RID_BIT_TYPE; - -/* Be careful, all these modify N twice. */ -#define RIDBIT_SETP(N, V) (((unsigned long)1 << (int) ((N)%32)) \ - & (V).idata[(N)/32]) -#define RIDBIT_NOTSETP(NN, VV) (! RIDBIT_SETP (NN, VV)) -#define RIDBIT_SET(N, V) do { \ - (V).idata[(N)/32] \ - |= ((unsigned long)1 << (int) ((N)%32)); \ - } while (0) -#define RIDBIT_RESET(N, V) do { \ - (V).idata[(N)/32] \ - &= ~((unsigned long)1 << (int) ((N)%32)); \ - } while (0) -#define RIDBIT_RESET_ALL(V) do { \ - (V).idata[0] = 0; \ - (V).idata[1] = 0; \ - } while (0) -#define RIDBIT_ANY_SET(V) ((V).idata[0] || (V).idata[1]) - -/* The elements of `ridpointers' are identifier nodes - for the reserved type names and storage classes. - It is indexed by a RID_... value. */ -extern tree ridpointers[(int) RID_MAX]; - -/* the declaration found for the last IDENTIFIER token read in. - yylex must look this up to detect typedefs, which get token type TYPENAME, - so it is left around in case the identifier is not a typedef but is - used in a context which makes it a reference to a variable. */ -extern tree lastiddecl; - -extern char *token_buffer; /* Pointer to token buffer. */ - -/* Back-door communication channel to the lexer. */ -extern int looking_for_typename; -extern int looking_for_template; - -/* Tell the lexer where to look for names. */ -extern tree got_scope; -extern tree got_object; - -/* Pending language change. - Positive is push count, negative is pop count. */ -extern int pending_lang_change; - -extern int yylex PROTO((void)); diff --git a/contrib/gcc/cp/method.c b/contrib/gcc/cp/method.c deleted file mode 100644 index d60bfda52422..000000000000 --- a/contrib/gcc/cp/method.c +++ /dev/null @@ -1,2656 +0,0 @@ -/* Handle the hair of processing (but not expanding) inline functions. - Also manage function and variable name overloading. - Copyright (C) 1987, 89, 92-97, 1998, 1999 Free Software Foundation, Inc. - Contributed by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -#ifndef __GNUC__ -#define __inline -#endif - -#ifndef PARM_CAN_BE_ARRAY_TYPE -#define PARM_CAN_BE_ARRAY_TYPE 1 -#endif - -/* Handle method declarations. */ -#include "config.h" -#include "system.h" -#include "tree.h" -#include "cp-tree.h" -#include "obstack.h" -#include "rtl.h" -#include "expr.h" -#include "output.h" -#include "hard-reg-set.h" -#include "flags.h" -#include "toplev.h" -#include "decl.h" - -/* TREE_LIST of the current inline functions that need to be - processed. */ -struct pending_inline *pending_inlines; - -int static_labelno; - -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -/* Obstack where we build text strings for overloading, etc. */ -static struct obstack scratch_obstack; -static char *scratch_firstobj; - -static void icat PROTO((HOST_WIDE_INT)); -static void dicat PROTO((HOST_WIDE_INT, HOST_WIDE_INT)); -static int old_backref_index PROTO((tree)); -static int flush_repeats PROTO((int, tree)); -static void build_overload_identifier PROTO((tree)); -static void build_overload_nested_name PROTO((tree)); -static void build_overload_int PROTO((tree, int)); -static void build_overload_identifier PROTO((tree)); -static void build_qualified_name PROTO((tree)); -static void build_overload_value PROTO((tree, tree, int)); -static void issue_nrepeats PROTO((int, tree)); -static char *build_mangled_name PROTO((tree,int,int)); -static void process_modifiers PROTO((tree)); -static void process_overload_item PROTO((tree,int)); -static void do_build_assign_ref PROTO((tree)); -static void do_build_copy_constructor PROTO((tree)); -static tree largest_union_member PROTO((tree)); -static void build_template_template_parm_names PROTO((tree)); -static void build_template_parm_names PROTO((tree, tree)); -static void build_underscore_int PROTO((int)); -static void start_squangling PROTO((void)); -static void end_squangling PROTO((void)); -static int check_ktype PROTO((tree, int)); -static int issue_ktype PROTO((tree)); -static void build_overload_scope_ref PROTO((tree)); -static void build_mangled_template_parm_index PROTO((char *, tree)); -#if HOST_BITS_PER_WIDE_INT >= 64 -static void build_mangled_C9x_name PROTO((int)); -#endif -static int is_back_referenceable_type PROTO((tree)); -static int check_btype PROTO((tree)); -static void build_mangled_name_for_type PROTO((tree)); -static void build_mangled_name_for_type_with_Gcode PROTO((tree, int)); -static tree build_base_path PROTO((tree, int)); - - -# define OB_INIT() (scratch_firstobj ? (obstack_free (&scratch_obstack, scratch_firstobj), 0) : 0) -# define OB_PUTC(C) (obstack_1grow (&scratch_obstack, (C))) -# define OB_PUTC2(C1,C2) \ - (obstack_1grow (&scratch_obstack, (C1)), obstack_1grow (&scratch_obstack, (C2))) -# define OB_PUTS(S) (obstack_grow (&scratch_obstack, (S), sizeof (S) - 1)) -# define OB_PUTID(ID) \ - (obstack_grow (&scratch_obstack, IDENTIFIER_POINTER (ID), \ - IDENTIFIER_LENGTH (ID))) -# define OB_PUTCP(S) (obstack_grow (&scratch_obstack, (S), strlen (S))) -# define OB_FINISH() (obstack_1grow (&scratch_obstack, '\0')) -# define OB_LAST() (obstack_next_free (&scratch_obstack)[-1]) - -void -init_method () -{ - gcc_obstack_init (&scratch_obstack); - scratch_firstobj = (char *)obstack_alloc (&scratch_obstack, 0); -} - -/* This must be large enough to hold any printed integer or floating-point - value. */ -static char digit_buffer[128]; - -/* Move inline function definitions out of structure so that they - can be processed normally. CNAME is the name of the class - we are working from, METHOD_LIST is the list of method lists - of the structure. We delete friend methods here, after - saving away their inline function definitions (if any). */ - -void -do_inline_function_hair (type, friend_list) - tree type, friend_list; -{ - tree method = TYPE_METHODS (type); - - if (method && TREE_CODE (method) == TREE_VEC) - { - if (TREE_VEC_ELT (method, 1)) - method = TREE_VEC_ELT (method, 1); - else if (TREE_VEC_ELT (method, 0)) - method = TREE_VEC_ELT (method, 0); - else - method = TREE_VEC_ELT (method, 2); - } - - while (method) - { - /* Do inline member functions. */ - struct pending_inline *info = DECL_PENDING_INLINE_INFO (method); - if (info) - { - tree args; - - my_friendly_assert (info->fndecl == method, 238); - args = DECL_ARGUMENTS (method); - while (args) - { - DECL_CONTEXT (args) = method; - args = TREE_CHAIN (args); - } - } - method = TREE_CHAIN (method); - } - while (friend_list) - { - tree fndecl = TREE_VALUE (friend_list); - struct pending_inline *info = DECL_PENDING_INLINE_INFO (fndecl); - if (info) - { - tree args; - - my_friendly_assert (info->fndecl == fndecl, 239); - args = DECL_ARGUMENTS (fndecl); - while (args) - { - DECL_CONTEXT (args) = fndecl; - args = TREE_CHAIN (args); - } - } - - friend_list = TREE_CHAIN (friend_list); - } -} - -/* Here is where overload code starts. */ - -/* type tables for K and B type compression */ -static tree *btypelist = NULL; -static tree *ktypelist = NULL; -static int maxbsize = 0; -static int maxksize = 0; - -/* number of each type seen */ -static int maxbtype = 0; -static int maxktype = 0; - -/* Array of types seen so far in top-level call to `build_mangled_name'. - Allocated and deallocated by caller. */ -static tree *typevec = NULL; -static int typevec_size; - -/* Number of types interned by `build_mangled_name' so far. */ -static int maxtype = 0; - -/* Nonzero if we should not try folding parameter types. */ -static int nofold; - -/* This appears to be set to true if an underscore is required to be - comcatenated before another number can be outputed. */ -static int numeric_output_need_bar; - -static __inline void -start_squangling () -{ - if (flag_do_squangling) - { - nofold = 0; - maxbtype = 0; - maxktype = 0; - maxbsize = 50; - maxksize = 50; - btypelist = (tree *)xmalloc (sizeof (tree) * maxbsize); - ktypelist = (tree *)xmalloc (sizeof (tree) * maxksize); - } -} - -static __inline void -end_squangling () -{ - if (flag_do_squangling) - { - if (ktypelist) - free (ktypelist); - if (btypelist) - free (btypelist); - maxbsize = 0; - maxksize = 0; - maxbtype = 0; - maxktype = 0; - ktypelist = NULL; - btypelist = NULL; - } -} - -/* Code to concatenate an asciified integer to a string. */ - -static __inline void -icat (i) - HOST_WIDE_INT i; -{ - unsigned HOST_WIDE_INT ui; - - /* Handle this case first, to go really quickly. For many common values, - the result of ui/10 below is 1. */ - if (i == 1) - { - OB_PUTC ('1'); - return; - } - - if (i >= 0) - ui = i; - else - { - OB_PUTC ('m'); - ui = -i; - } - - if (ui >= 10) - icat (ui / 10); - - OB_PUTC ('0' + (ui % 10)); -} - -static void -dicat (lo, hi) - HOST_WIDE_INT lo, hi; -{ - unsigned HOST_WIDE_INT ulo, uhi, qlo, qhi; - - if (hi >= 0) - { - uhi = hi; - ulo = lo; - } - else - { - uhi = (lo == 0 ? -hi : -hi-1); - ulo = -lo; - } - if (uhi == 0 - && ulo < ((unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT - 1))) - { - icat (ulo); - return; - } - /* Divide 2^HOST_WIDE_INT*uhi+ulo by 10. */ - qhi = uhi / 10; - uhi = uhi % 10; - qlo = uhi * (((unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT - 1)) / 5); - qlo += ulo / 10; - ulo = ulo % 10; - ulo += uhi * (((unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT - 1)) % 5) - * 2; - qlo += ulo / 10; - ulo = ulo % 10; - /* Quotient is 2^HOST_WIDE_INT*qhi+qlo, remainder is ulo. */ - dicat (qlo, qhi); - OB_PUTC ('0' + ulo); -} - -/* Returns the index of TYPE in the typevec, or -1 if it's not there. */ - -static __inline int -old_backref_index (type) - tree type; -{ - int tindex = 0; - - if (! is_back_referenceable_type (type)) - return -1; - - /* The entry for this parm is at maxtype-1, so don't look there for - something to repeat. */ - for (tindex = 0; tindex < maxtype - 1; ++tindex) - if (same_type_p (typevec[tindex], type)) - break; - - if (tindex == maxtype - 1) - return -1; - - return tindex; -} - -/* Old mangling style: If TYPE has already been used in the parameter list, - emit a backward reference and return non-zero; otherwise, return 0. - - NREPEATS is the number of repeats we've recorded of this type, or 0 if - this is the first time we've seen it and we're just looking to see if - it had been used before. */ - -static __inline int -flush_repeats (nrepeats, type) - int nrepeats; - tree type; -{ - int tindex = old_backref_index (type); - - if (tindex == -1) - { - my_friendly_assert (nrepeats == 0, 990316); - return 0; - } - - if (nrepeats > 1) - { - OB_PUTC ('N'); - icat (nrepeats); - if (nrepeats > 9) - OB_PUTC ('_'); - } - else - OB_PUTC ('T'); - icat (tindex); - if (tindex > 9) - OB_PUTC ('_'); - - return 1; -} - -/* Returns nonzero iff this is a type to which we will want to make - back-references (using the `B' code). */ - -static int -is_back_referenceable_type (type) - tree type; -{ - /* For some reason, the Java folks don't want back refs on these. */ - if (TYPE_FOR_JAVA (type)) - return 0; - - switch (TREE_CODE (type)) - { - case BOOLEAN_TYPE: - if (!flag_do_squangling) - /* Even though the mangling of this is just `b', we did - historically generate back-references for it. */ - return 1; - /* Fall through. */ - - case INTEGER_TYPE: - case REAL_TYPE: - case VOID_TYPE: - /* These types have single-character manglings, so there's no - point in generating back-references. */ - return 0; - - case TEMPLATE_TYPE_PARM: - /* It would be a bit complex to demangle signatures correctly if - we generated back-references to these, and the manglings of - type parameters are short. */ - return 0; - - default: - return 1; - } -} - -/* Issue the squangling code indicating NREPEATS repetitions of TYPE, - which was the last parameter type output. */ - -static void -issue_nrepeats (nrepeats, type) - int nrepeats; - tree type; -{ - if (nrepeats == 1 && !is_back_referenceable_type (type)) - /* For types whose manglings are short, don't bother using the - repetition code if there's only one repetition, since the - repetition code will be about as long as the ordinary mangling. */ - build_mangled_name_for_type (type); - else - { - OB_PUTC ('n'); - icat (nrepeats); - if (nrepeats > 9) - OB_PUTC ('_'); - } -} - -/* Check to see if a tree node has been entered into the Kcode typelist. - If not, add it. Returns -1 if it isn't found, otherwise returns the - index. */ - -static int -check_ktype (node, add) - tree node; - int add; -{ - int x; - tree localnode = node; - - if (ktypelist == NULL) - return -1; - - if (TREE_CODE (node) == TYPE_DECL) - localnode = TREE_TYPE (node); - - for (x=0; x < maxktype; x++) - { - if (same_type_p (localnode, ktypelist[x])) - return x; - } - /* Didn't find it, so add it here. */ - if (add) - { - if (maxksize <= maxktype) - { - maxksize = maxksize* 3 / 2; - ktypelist = (tree *)xrealloc (ktypelist, sizeof (tree) * maxksize); - } - ktypelist[maxktype++] = localnode; - } - return -1; -} - - -static __inline int -issue_ktype (decl) - tree decl; -{ - int kindex; - kindex = check_ktype (decl, FALSE); - if (kindex != -1) - { - OB_PUTC ('K'); - icat (kindex); - if (kindex > 9) - OB_PUTC ('_'); - return TRUE; - } - return FALSE; -} - -/* Build a representation for DECL, which may be an entity not at - global scope. If so, a marker indicating that the name is - qualified has already been output, but the qualifying context has - not. */ - -static void -build_overload_nested_name (decl) - tree decl; -{ - tree context; - - if (ktypelist && issue_ktype (decl)) - return; - - if (decl == global_namespace) - return; - - context = CP_DECL_CONTEXT (decl); - - /* try to issue a K type, and if we can't continue the normal path */ - if (!(ktypelist && issue_ktype (context))) - { - /* For a template type parameter, we want to output an 'Xn' - rather than 'T' or some such. */ - if (TREE_CODE (context) == TEMPLATE_TYPE_PARM - || TREE_CODE (context) == TEMPLATE_TEMPLATE_PARM) - build_mangled_name_for_type (context); - else - { - if (TREE_CODE_CLASS (TREE_CODE (context)) == 't') - context = TYPE_NAME (context); - build_overload_nested_name (context); - } - } - - if (TREE_CODE (decl) == FUNCTION_DECL) - { - tree name = DECL_ASSEMBLER_NAME (decl); - char *label; - - ASM_FORMAT_PRIVATE_NAME (label, IDENTIFIER_POINTER (name), static_labelno); - static_labelno++; - - if (numeric_output_need_bar) - OB_PUTC ('_'); - icat (strlen (label)); - OB_PUTCP (label); - numeric_output_need_bar = 1; - } - else if (TREE_CODE (decl) == NAMESPACE_DECL) - build_overload_identifier (DECL_NAME (decl)); - else /* TYPE_DECL */ - build_overload_identifier (decl); -} - -/* Output the decimal representation of I. If I > 9, the decimal - representation is preceeded and followed by an underscore. */ - -static void -build_underscore_int (i) - int i; -{ - if (i > 9) - OB_PUTC ('_'); - icat (i); - if (i > 9) - OB_PUTC ('_'); -} - -static void -build_overload_scope_ref (value) - tree value; -{ - OB_PUTC2 ('Q', '2'); - numeric_output_need_bar = 0; - build_mangled_name_for_type (TREE_OPERAND (value, 0)); - build_overload_identifier (TREE_OPERAND (value, 1)); -} - -/* Encoding for an INTEGER_CST value. */ - -static void -build_overload_int (value, in_template) - tree value; - int in_template; -{ - if (in_template && TREE_CODE (value) != INTEGER_CST) - { - if (TREE_CODE (value) == SCOPE_REF) - { - build_overload_scope_ref (value); - return; - } - - OB_PUTC ('E'); - numeric_output_need_bar = 0; - - if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (value)))) - { - int i; - int operands = tree_code_length[(int) TREE_CODE (value)]; - tree id; - char* name; - - id = ansi_opname [(int) TREE_CODE (value)]; - my_friendly_assert (id != NULL_TREE, 0); - name = IDENTIFIER_POINTER (id); - if (name[0] != '_' || name[1] != '_') - /* On some erroneous inputs, we can get here with VALUE a - LOOKUP_EXPR. In that case, the NAME will be the - identifier for "". We must survive - this routine in order to issue a sensible error - message, so we fall through to the case below. */ - goto bad_value; - - for (i = 0; i < operands; ++i) - { - tree operand; - enum tree_code tc; - - /* We just outputted either the `E' or the name of the - operator. */ - numeric_output_need_bar = 0; - - if (i != 0) - /* Skip the leading underscores. */ - OB_PUTCP (name + 2); - - operand = TREE_OPERAND (value, i); - tc = TREE_CODE (operand); - - if (TREE_CODE_CLASS (tc) == 't') - /* We can get here with sizeof, e.g.: - - template void f(A); */ - build_mangled_name_for_type (operand); - else if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (tc))) - build_overload_int (operand, in_template); - else - build_overload_value (TREE_TYPE (operand), - operand, - in_template); - } - } - else - { - /* We don't ever want this output, but it's - inconvenient not to be able to build the string. - This should cause assembler errors we'll notice. */ - - static int n; - bad_value: - sprintf (digit_buffer, " *%d", n++); - OB_PUTCP (digit_buffer); - } - - OB_PUTC ('W'); - numeric_output_need_bar = 0; - return; - } - - my_friendly_assert (TREE_CODE (value) == INTEGER_CST, 243); - if (TYPE_PRECISION (TREE_TYPE (value)) == 2 * HOST_BITS_PER_WIDE_INT) - { - if (TREE_INT_CST_HIGH (value) - != (TREE_INT_CST_LOW (value) >> (HOST_BITS_PER_WIDE_INT - 1))) - { - /* need to print a DImode value in decimal */ - dicat (TREE_INT_CST_LOW (value), TREE_INT_CST_HIGH (value)); - numeric_output_need_bar = 1; - return; - } - /* else fall through to print in smaller mode */ - } - /* Wordsize or smaller */ - icat (TREE_INT_CST_LOW (value)); - numeric_output_need_bar = 1; -} - - -/* Output S followed by a representation of the TEMPLATE_PARM_INDEX - supplied in INDEX. */ - -static void -build_mangled_template_parm_index (s, index) - char* s; - tree index; -{ - OB_PUTCP (s); - build_underscore_int (TEMPLATE_PARM_IDX (index)); - /* We use the LEVEL, not the ORIG_LEVEL, because the mangling is a - representation of the function from the point of view of its - type. */ - build_underscore_int (TEMPLATE_PARM_LEVEL (index)); -} - - -/* Mangling for C9X integer types (and Cygnus extensions for 128-bit - and other types) is based on the letter "I" followed by the hex - representations of the bitsize for the type in question. For - encodings that result in larger than two digits, a leading and - trailing underscore is added. - - Thus: - int1_t = 001 = I01 - int8_t = 008 = I08 - int16_t = 010 = I10 - int24_t = 018 = I18 - int32_t = 020 = I20 - int64_t = 040 = I40 - int80_t = 050 = I50 - int128_t = 080 = I80 - int256_t = 100 = I_100_ - int512_t = 200 = I_200_ - - Given an integer in decimal format, mangle according to this scheme. */ - -#if HOST_BITS_PER_WIDE_INT >= 64 -static void -build_mangled_C9x_name (bits) - int bits; -{ - char mangled[10] = ""; - - if (bits > 255) - sprintf (mangled, "I_%x_", bits); - else - sprintf (mangled, "I%.2x", bits); - - OB_PUTCP (mangled); -} -#endif - -static void -build_overload_value (type, value, in_template) - tree type, value; - int in_template; -{ - my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (type)) == 't', 0); - - while (TREE_CODE (value) == NON_LVALUE_EXPR - || TREE_CODE (value) == NOP_EXPR) - value = TREE_OPERAND (value, 0); - - if (numeric_output_need_bar) - { - OB_PUTC ('_'); - numeric_output_need_bar = 0; - } - - if (TREE_CODE (value) == TEMPLATE_PARM_INDEX) - { - build_mangled_template_parm_index ("Y", value); - return; - } - - if (TYPE_PTRMEM_P (type)) - { - if (TREE_CODE (value) != PTRMEM_CST) - /* We should have already rejected this pointer to member, - since it is not a constant. */ - my_friendly_abort (0); - - /* Get the actual FIELD_DECL. */ - value = PTRMEM_CST_MEMBER (value); - my_friendly_assert (TREE_CODE (value) == FIELD_DECL, 0); - - /* Output the name of the field. */ - build_overload_identifier (DECL_NAME (value)); - return; - } - - switch (TREE_CODE (type)) - { - case INTEGER_TYPE: - case ENUMERAL_TYPE: - case BOOLEAN_TYPE: - { - build_overload_int (value, in_template); - return; - } - case REAL_TYPE: - { - REAL_VALUE_TYPE val; - char *bufp = digit_buffer; - - pedwarn ("ANSI C++ forbids floating-point template arguments"); - - my_friendly_assert (TREE_CODE (value) == REAL_CST, 244); - val = TREE_REAL_CST (value); - if (REAL_VALUE_ISNAN (val)) - { - sprintf (bufp, "NaN"); - } - else - { - if (REAL_VALUE_NEGATIVE (val)) - { - val = REAL_VALUE_NEGATE (val); - *bufp++ = 'm'; - } - if (REAL_VALUE_ISINF (val)) - { - sprintf (bufp, "Infinity"); - } - else - { - REAL_VALUE_TO_DECIMAL (val, "%.20e", bufp); - bufp = (char *) index (bufp, 'e'); - if (!bufp) - strcat (digit_buffer, "e0"); - else - { - char *p; - bufp++; - if (*bufp == '-') - { - *bufp++ = 'm'; - } - p = bufp; - if (*p == '+') - p++; - while (*p == '0') - p++; - if (*p == 0) - { - *bufp++ = '0'; - *bufp = 0; - } - else if (p != bufp) - { - while (*p) - *bufp++ = *p++; - *bufp = 0; - } - } -#ifdef NO_DOT_IN_LABEL - bufp = (char *) index (bufp, '.'); - if (bufp) - *bufp = '_'; -#endif - } - } - OB_PUTCP (digit_buffer); - numeric_output_need_bar = 1; - return; - } - case POINTER_TYPE: - if (TREE_CODE (value) == INTEGER_CST) - { - build_overload_int (value, in_template); - return; - } - else if (TREE_CODE (value) == TEMPLATE_PARM_INDEX) - { - build_mangled_template_parm_index ("", value); - numeric_output_need_bar = 1; - return; - } - - value = TREE_OPERAND (value, 0); - - /* Fall through. */ - - case REFERENCE_TYPE: - if (TREE_CODE (value) == VAR_DECL) - { - my_friendly_assert (DECL_NAME (value) != 0, 245); - build_overload_identifier (DECL_ASSEMBLER_NAME (value)); - return; - } - else if (TREE_CODE (value) == FUNCTION_DECL) - { - my_friendly_assert (DECL_NAME (value) != 0, 246); - build_overload_identifier (DECL_ASSEMBLER_NAME (value)); - return; - } - else if (TREE_CODE (value) == SCOPE_REF) - build_overload_scope_ref (value); - else - my_friendly_abort (71); - break; /* not really needed */ - - case RECORD_TYPE: - { - tree delta; - tree idx; - tree pfn; - tree delta2; - - my_friendly_assert (TYPE_PTRMEMFUNC_P (type), 0); - - /* We'll get a ADDR_EXPR of a SCOPE_REF here if we're - mangling, an instantiation of something like: - - template class C {}; - template C x(); - - We mangle the return type of the function, and that - contains template parameters. */ - if (TREE_CODE (value) == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (value, 0)) == SCOPE_REF) - { - build_overload_scope_ref (TREE_OPERAND (value, 0)); - break; - } - - my_friendly_assert (TREE_CODE (value) == PTRMEM_CST, 0); - - expand_ptrmemfunc_cst (value, &delta, &idx, &pfn, &delta2); - build_overload_int (delta, in_template); - OB_PUTC ('_'); - build_overload_int (idx, in_template); - OB_PUTC ('_'); - if (pfn) - { - numeric_output_need_bar = 0; - build_overload_identifier (DECL_ASSEMBLER_NAME - (PTRMEM_CST_MEMBER (value))); - } - else - { - OB_PUTC ('i'); - build_overload_int (delta2, in_template); - } - } - break; - - default: - sorry ("conversion of %s as template parameter", - tree_code_name [(int) TREE_CODE (type)]); - my_friendly_abort (72); - } -} - - -/* Add encodings for the declaration of template template parameters. - PARMLIST must be a TREE_VEC. */ - -static void -build_template_template_parm_names (parmlist) - tree parmlist; -{ - int i, nparms; - - my_friendly_assert (TREE_CODE (parmlist) == TREE_VEC, 246.5); - nparms = TREE_VEC_LENGTH (parmlist); - icat (nparms); - for (i = 0; i < nparms; i++) - { - tree parm = TREE_VALUE (TREE_VEC_ELT (parmlist, i)); - if (TREE_CODE (parm) == TYPE_DECL) - { - /* This parameter is a type. */ - OB_PUTC ('Z'); - } - else if (TREE_CODE (parm) == TEMPLATE_DECL) - { - /* This parameter is a template. */ - OB_PUTC ('z'); - build_template_template_parm_names (DECL_INNERMOST_TEMPLATE_PARMS (parm)); - } - else - /* It's a PARM_DECL. */ - build_mangled_name_for_type (TREE_TYPE (parm)); - } -} - - -/* Add encodings for the vector of template parameters in PARMLIST, - given the vector of arguments to be substituted in ARGLIST. */ - -static void -build_template_parm_names (parmlist, arglist) - tree parmlist; - tree arglist; -{ - int i, nparms; - tree inner_args = innermost_args (arglist); - - nparms = TREE_VEC_LENGTH (parmlist); - icat (nparms); - for (i = 0; i < nparms; i++) - { - tree parm = TREE_VALUE (TREE_VEC_ELT (parmlist, i)); - tree arg = TREE_VEC_ELT (inner_args, i); - if (TREE_CODE (parm) == TYPE_DECL) - { - /* This parameter is a type. */ - OB_PUTC ('Z'); - build_mangled_name_for_type (arg); - } - else if (TREE_CODE (parm) == TEMPLATE_DECL) - { - /* This parameter is a template. */ - if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM) - /* Output parameter declaration, argument index and level. */ - build_mangled_name_for_type (arg); - else - { - /* A TEMPLATE_DECL node, output the parameter declaration - and template name */ - - OB_PUTC ('z'); - build_template_template_parm_names - (DECL_INNERMOST_TEMPLATE_PARMS (parm)); - icat (IDENTIFIER_LENGTH (DECL_NAME (arg))); - OB_PUTID (DECL_NAME (arg)); - } - } - else - { - parm = tsubst (parm, arglist, /*complain=*/1, NULL_TREE); - /* It's a PARM_DECL. */ - build_mangled_name_for_type (TREE_TYPE (parm)); - build_overload_value (TREE_TYPE (parm), arg, - uses_template_parms (arglist)); - } - } - } - -/* Output the representation for NAME, which is either a TYPE_DECL or - an IDENTIFIER. */ - -static void -build_overload_identifier (name) - tree name; -{ - if (TREE_CODE (name) == TYPE_DECL - && CLASS_TYPE_P (TREE_TYPE (name)) - && CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (name)) - && (PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (TREE_TYPE (name))) - || (TREE_CODE (DECL_CONTEXT (CLASSTYPE_TI_TEMPLATE - (TREE_TYPE (name)))) - == FUNCTION_DECL))) - { - /* NAME is the TYPE_DECL for a template specialization. */ - tree template, parmlist, arglist, tname; - template = CLASSTYPE_TI_TEMPLATE (TREE_TYPE (name)); - arglist = CLASSTYPE_TI_ARGS (TREE_TYPE (name)); - tname = DECL_NAME (template); - parmlist = DECL_INNERMOST_TEMPLATE_PARMS (template); - OB_PUTC ('t'); - icat (IDENTIFIER_LENGTH (tname)); - OB_PUTID (tname); - build_template_parm_names (parmlist, arglist); - } - else - { - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - if (numeric_output_need_bar) - { - OB_PUTC ('_'); - numeric_output_need_bar = 0; - } - icat (IDENTIFIER_LENGTH (name)); - OB_PUTID (name); - } -} - -/* Given DECL, either a class TYPE, TYPE_DECL or FUNCTION_DECL, produce - the mangling for it. Used by build_mangled_name and build_static_name. */ - -static void -build_qualified_name (decl) - tree decl; -{ - tree context; - int i = 1; - - if (TREE_CODE_CLASS (TREE_CODE (decl)) == 't') - decl = TYPE_NAME (decl); - - /* If DECL_ASSEMBLER_NAME has been set properly, use it. */ - if (TREE_CODE (decl) == TYPE_DECL - && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl) && !flag_do_squangling) - { - tree id = DECL_ASSEMBLER_NAME (decl); - OB_PUTID (id); - if (ISDIGIT (IDENTIFIER_POINTER (id) [IDENTIFIER_LENGTH (id) - 1])) - numeric_output_need_bar = 1; - return; - } - - context = decl; - /* If we can't find a Ktype, do it the hard way. */ - if (check_ktype (context, FALSE) == -1) - { - /* Count type and namespace scopes. */ - while (1) - { - context = CP_DECL_CONTEXT (context); - if (context == global_namespace) - break; - i += 1; - if (check_ktype (context, FALSE) != -1) - /* Found one! */ - break; - if (TREE_CODE_CLASS (TREE_CODE (context)) == 't') - context = TYPE_NAME (context); - } - } - - if (i > 1) - { - OB_PUTC ('Q'); - build_underscore_int (i); - numeric_output_need_bar = 0; - } - build_overload_nested_name (decl); -} - -/* Output the mangled representation for TYPE. If EXTRA_GCODE is - non-zero, mangled names for structure/union types are intentionally - mangled differently from the method described in the ARM. */ - -static void -build_mangled_name_for_type_with_Gcode (type, extra_Gcode) - tree type; - int extra_Gcode; -{ - if (TYPE_PTRMEMFUNC_P (type)) - type = TYPE_PTRMEMFUNC_FN_TYPE (type); - process_modifiers (type); - process_overload_item (type, extra_Gcode); -} - -/* Like build_mangled_name_for_type_with_Gcode, but never outputs the - `G'. */ - -static void -build_mangled_name_for_type (type) - tree type; -{ - build_mangled_name_for_type_with_Gcode (type, 0); -} - -/* Given a list of parameters in PARMTYPES, create an unambiguous - overload string. Should distinguish any type that C (or C++) can - distinguish. I.e., pointers to functions are treated correctly. - - Caller must deal with whether a final `e' goes on the end or not. - - Any default conversions must take place before this function - is called. - - BEGIN and END control initialization and finalization of the - obstack where we build the string. */ - -char * -build_overload_name (parmtypes, begin, end) - tree parmtypes; - int begin, end; -{ - char *ret; - start_squangling (); - ret = build_mangled_name (parmtypes, begin, end); - end_squangling (); - return ret ; -} - -/* Output the mangled representation for PARMTYPES. If PARMTYPES is a - TREE_LIST, then it is a list of parameter types. Otherwise, - PARMTYPES must be a single type. */ - -static char * -build_mangled_name (parmtypes, begin, end) - tree parmtypes; - int begin, end; -{ - if (begin) - OB_INIT (); - - if (TREE_CODE (parmtypes) != TREE_LIST) - /* There is only one type. */ - build_mangled_name_for_type (parmtypes); - else - { - /* There are several types in a parameter list. */ - int nrepeats = 0; - int old_style_repeats = !flag_do_squangling && !nofold && typevec; - tree last_type = NULL_TREE; - - for (; parmtypes && parmtypes != void_list_node; - parmtypes = TREE_CHAIN (parmtypes)) - { - /* We used to call canonical_type_variant here, but that isn't - good enough; it doesn't handle pointers to typedef types. So - we can't just set TREE_USED to say we've seen a type already; - we have to check each of the earlier types with same_type_p. */ - tree parmtype = TREE_VALUE (parmtypes); - - if (old_style_repeats) - { - /* Every argument gets counted. */ - my_friendly_assert (maxtype < typevec_size, 387); - typevec[maxtype++] = parmtype; - } - - if (last_type && same_type_p (parmtype, last_type)) - { - if (flag_do_squangling - || (old_style_repeats - && is_back_referenceable_type (parmtype))) - { - /* The next type is the same as this one. Keep - track of the repetition, and output the repeat - count later. */ - nrepeats++; - continue; - } - } - else if (nrepeats != 0) - { - /* Indicate how many times the previous parameter was - repeated. */ - if (old_style_repeats) - flush_repeats (nrepeats, last_type); - else - issue_nrepeats (nrepeats, last_type); - nrepeats = 0; - } - - last_type = parmtype; - - /* Note that for bug-compatibility with 2.7.2, we can't build up - repeats of types other than the most recent one. So we call - flush_repeats every round, if we get this far. */ - if (old_style_repeats && flush_repeats (0, parmtype)) - continue; - - /* Output the PARMTYPE. */ - build_mangled_name_for_type_with_Gcode (parmtype, 1); - } - - /* Output the repeat count for the last parameter, if - necessary. */ - if (nrepeats != 0) - { - if (old_style_repeats) - flush_repeats (nrepeats, last_type); - else - issue_nrepeats (nrepeats, last_type); - nrepeats = 0; - } - - if (!parmtypes) - /* The parameter list ends in an ellipsis. */ - OB_PUTC ('e'); - } - - if (end) - OB_FINISH (); - return (char *)obstack_base (&scratch_obstack); -} - -/* Emit modifiers such as constant, read-only, and volatile. */ - -static void -process_modifiers (parmtype) - tree parmtype; -{ - /* Note that here we do not use CP_TYPE_CONST_P and friends because - we describe types recursively; we will get the `const' in - `const int ()[10]' when processing the `const int' part. */ - if (TYPE_READONLY (parmtype)) - OB_PUTC ('C'); - if (TREE_CODE (parmtype) == INTEGER_TYPE - && parmtype != char_type_node - && parmtype != wchar_type_node - && (TYPE_MAIN_VARIANT (parmtype) - == unsigned_type (TYPE_MAIN_VARIANT (parmtype))) - && ! TYPE_FOR_JAVA (parmtype)) - OB_PUTC ('U'); - if (TYPE_VOLATILE (parmtype)) - OB_PUTC ('V'); - /* It would be better to use `R' for `restrict', but that's already - used for reference types. And `r' is used for `long double'. */ - if (TYPE_RESTRICT (parmtype)) - OB_PUTC ('u'); -} - -/* Check to see if TYPE has been entered into the Bcode typelist. If - so, return 1 and emit a backreference to TYPE. Otherwise, add TYPE - to the list of back-referenceable types and return 0. */ - -static int -check_btype (type) - tree type; -{ - int x; - - if (btypelist == NULL) - return 0; - - if (!is_back_referenceable_type (type)) - return 0; - - for (x = 0; x < maxbtype; x++) - if (same_type_p (type, btypelist[x])) - { - OB_PUTC ('B'); - icat (x); - if (x > 9) - OB_PUTC ('_'); - return 1 ; - } - - if (maxbsize <= maxbtype) - { - /* Enlarge the table. */ - maxbsize = maxbsize * 3 / 2; - btypelist = (tree *)xrealloc (btypelist, sizeof (tree) * maxbsize); - } - - /* Register the TYPE. */ - btypelist[maxbtype++] = type; - - return 0; -} - -/* Emit the correct code for various node types. */ - -static void -process_overload_item (parmtype, extra_Gcode) - tree parmtype; - int extra_Gcode; -{ - numeric_output_need_bar = 0; - - /* Our caller should have already handed any qualifiers, so pull out the - TYPE_MAIN_VARIANT to avoid typedef confusion. Except we can't do that - for arrays, because they are transparent to qualifiers. Sigh. */ - if (TREE_CODE (parmtype) == ARRAY_TYPE) - parmtype = canonical_type_variant (parmtype); - else - parmtype = TYPE_MAIN_VARIANT (parmtype); - - /* These tree types are considered modifiers for B code squangling, - and therefore should not get entries in the Btypelist. They are, - however, repeatable types. */ - - switch (TREE_CODE (parmtype)) - { - case REFERENCE_TYPE: - OB_PUTC ('R'); - goto more; - - case ARRAY_TYPE: -#if PARM_CAN_BE_ARRAY_TYPE - { - OB_PUTC ('A'); - if (TYPE_DOMAIN (parmtype) == NULL_TREE) - OB_PUTC ('_'); - else - { - tree length = array_type_nelts (parmtype); - if (TREE_CODE (length) != INTEGER_CST || flag_do_squangling) - { - length = fold (build (PLUS_EXPR, TREE_TYPE (length), - length, integer_one_node)); - STRIP_NOPS (length); - } - build_overload_value (sizetype, length, 1); - } - if (numeric_output_need_bar && ! flag_do_squangling) - OB_PUTC ('_'); - goto more; - } -#else - OB_PUTC ('P'); - goto more; -#endif - - case POINTER_TYPE: - /* Even though the vlist_type_node is PPPFe (i.e. `int - (***)(...)'), it is different from the any other occurence of - the pointer type, because the underlying function type is - different. */ - if (parmtype == vlist_type_node) - { - OB_PUTS (VLIST_TYPE_NAME); - return; - } - OB_PUTC ('P'); - more: - build_mangled_name_for_type (TREE_TYPE (parmtype)); - return; - break; - - default: - break; - } - - if (flag_do_squangling && check_btype (parmtype)) - /* If PARMTYPE is already in the list of back-referenceable types, - then check_btype will output the appropriate reference, and - there's nothing more to do. */ - return; - - switch (TREE_CODE (parmtype)) - { - case OFFSET_TYPE: - OB_PUTC ('O'); - build_mangled_name_for_type (TYPE_OFFSET_BASETYPE (parmtype)); - OB_PUTC ('_'); - build_mangled_name_for_type (TREE_TYPE (parmtype)); - break; - - case FUNCTION_TYPE: - case METHOD_TYPE: - { - tree parms = TYPE_ARG_TYPES (parmtype); - - /* Rather than implementing a reentrant TYPEVEC, we turn off - repeat codes here, unless we're squangling. Squangling - doesn't make use of the TYPEVEC, so there's no reentrancy - problem. */ - int old_nofold = nofold; - if (!flag_do_squangling) - nofold = 1; - - if (TREE_CODE (parmtype) == METHOD_TYPE) - { - /* Mark this as a method. */ - OB_PUTC ('M'); - /* Output the class of which this method is a member. */ - build_mangled_name_for_type (TYPE_METHOD_BASETYPE (parmtype)); - /* Output any qualifiers for the `this' parameter. */ - process_modifiers (TREE_TYPE (TREE_VALUE (parms))); - } - - /* Output the parameter types. */ - OB_PUTC ('F'); - if (parms == NULL_TREE) - OB_PUTC ('e'); - else if (parms == void_list_node) - OB_PUTC ('v'); - else - build_mangled_name (parms, 0, 0); - - /* Output the return type. */ - OB_PUTC ('_'); - build_mangled_name_for_type (TREE_TYPE (parmtype)); - - nofold = old_nofold; - break; - } - - case INTEGER_TYPE: - if (parmtype == integer_type_node - || parmtype == unsigned_type_node - || parmtype == java_int_type_node) - OB_PUTC ('i'); - else if (parmtype == long_integer_type_node - || parmtype == long_unsigned_type_node) - OB_PUTC ('l'); - else if (parmtype == short_integer_type_node - || parmtype == short_unsigned_type_node - || parmtype == java_short_type_node) - OB_PUTC ('s'); - else if (parmtype == signed_char_type_node) - { - OB_PUTC ('S'); - OB_PUTC ('c'); - } - else if (parmtype == char_type_node - || parmtype == unsigned_char_type_node - || parmtype == java_byte_type_node) - OB_PUTC ('c'); - else if (parmtype == wchar_type_node - || parmtype == java_char_type_node) - OB_PUTC ('w'); - else if (parmtype == long_long_integer_type_node - || parmtype == long_long_unsigned_type_node - || parmtype == java_long_type_node) - OB_PUTC ('x'); - else if (parmtype == java_boolean_type_node) - OB_PUTC ('b'); -#if HOST_BITS_PER_WIDE_INT >= 64 - else if (parmtype == intTI_type_node - || parmtype == unsigned_intTI_type_node) - { - /* Should just check a flag here instead of specific - *_type_nodes, because all C9x types could use this. */ - int bits = TREE_INT_CST_LOW (TYPE_SIZE (parmtype)); - build_mangled_C9x_name (bits); - } -#endif - else - my_friendly_abort (73); - break; - - case BOOLEAN_TYPE: - OB_PUTC ('b'); - break; - - case REAL_TYPE: - if (parmtype == long_double_type_node) - OB_PUTC ('r'); - else if (parmtype == double_type_node - || parmtype == java_double_type_node) - OB_PUTC ('d'); - else if (parmtype == float_type_node - || parmtype == java_float_type_node) - OB_PUTC ('f'); - else my_friendly_abort (74); - break; - - case COMPLEX_TYPE: - OB_PUTC ('J'); - build_mangled_name_for_type (TREE_TYPE (parmtype)); - break; - - case VOID_TYPE: - OB_PUTC ('v'); - break; - - case ERROR_MARK: /* not right, but nothing is anyway */ - break; - - /* have to do these */ - case UNION_TYPE: - case RECORD_TYPE: - { - if (extra_Gcode) - OB_PUTC ('G'); /* make it look incompatible with AT&T */ - /* drop through into next case */ - } - case ENUMERAL_TYPE: - { - tree name = TYPE_NAME (parmtype); - - my_friendly_assert (TREE_CODE (name) == TYPE_DECL, 248); - - build_qualified_name (name); - break; - } - - case UNKNOWN_TYPE: - /* This will take some work. */ - OB_PUTC ('?'); - break; - - case TEMPLATE_TEMPLATE_PARM: - /* Find and output the original template parameter - declaration. */ - if (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (parmtype)) - { - build_mangled_template_parm_index ("tzX", - TEMPLATE_TYPE_PARM_INDEX - (parmtype)); - build_template_parm_names - (DECL_INNERMOST_TEMPLATE_PARMS (TYPE_TI_TEMPLATE (parmtype)), - TYPE_TI_ARGS (parmtype)); - } - else - { - build_mangled_template_parm_index ("ZzX", - TEMPLATE_TYPE_PARM_INDEX - (parmtype)); - build_template_template_parm_names - (DECL_INNERMOST_TEMPLATE_PARMS (TYPE_STUB_DECL (parmtype))); - } - break; - - case TEMPLATE_TYPE_PARM: - build_mangled_template_parm_index ("X", - TEMPLATE_TYPE_PARM_INDEX - (parmtype)); - break; - - case TYPENAME_TYPE: - /* When mangling the type of a function template whose - declaration looks like: - - template void foo(typename T::U) - - we have to mangle these. */ - build_qualified_name (parmtype); - break; - - default: - my_friendly_abort (75); - } - -} - -/* Produce the mangling for a variable named NAME in CONTEXT, which can - be either a class TYPE or a FUNCTION_DECL. */ - -tree -build_static_name (context, name) - tree context, name; -{ - OB_INIT (); - numeric_output_need_bar = 0; - start_squangling (); -#ifdef JOINER - OB_PUTC ('_'); - build_qualified_name (context); - OB_PUTC (JOINER); -#else - OB_PUTS ("__static_"); - build_qualified_name (context); - OB_PUTC ('_'); -#endif - OB_PUTID (name); - OB_FINISH (); - end_squangling (); - - return get_identifier ((char *)obstack_base (&scratch_obstack)); -} - -/* FOR_METHOD should be 1 if the declaration in question is for a member - of a class (including a static member) and 2 if the declaration is - for a constructor. */ -tree -build_decl_overload_real (dname, parms, ret_type, tparms, targs, - for_method) - tree dname; - tree parms; - tree ret_type; - tree tparms; - tree targs; - int for_method; -{ - char *name = IDENTIFIER_POINTER (dname); - - /* member operators new and delete look like methods at this point. */ - if (! for_method && parms != NULL_TREE && TREE_CODE (parms) == TREE_LIST - && TREE_CHAIN (parms) == void_list_node) - { - if (dname == ansi_opname[(int) DELETE_EXPR]) - return get_identifier ("__builtin_delete"); - else if (dname == ansi_opname[(int) VEC_DELETE_EXPR]) - return get_identifier ("__builtin_vec_delete"); - if (dname == ansi_opname[(int) NEW_EXPR]) - return get_identifier ("__builtin_new"); - else if (dname == ansi_opname[(int) VEC_NEW_EXPR]) - return get_identifier ("__builtin_vec_new"); - } - - start_squangling (); - OB_INIT (); - if (for_method != 2) - OB_PUTCP (name); - /* Otherwise, we can divine that this is a constructor, - and figure out its name without any extra encoding. */ - - OB_PUTC2 ('_', '_'); - numeric_output_need_bar = 0; - - if (tparms) - { - OB_PUTC ('H'); - build_template_parm_names (tparms, targs); - OB_PUTC ('_'); - } - else if (!for_method && current_namespace == global_namespace) - /* XXX this works only if we call this in the same namespace - as the declaration. Unfortunately, we don't have the _DECL, - only its name */ - OB_PUTC ('F'); - - if (!for_method && current_namespace != global_namespace) - /* qualify with namespace */ - build_qualified_name (current_namespace); - - if (parms == NULL_TREE) - OB_PUTC ('e'); - else if (parms == void_list_node) - OB_PUTC ('v'); - else - { - if (!flag_do_squangling) - { - /* Allocate typevec array. */ - maxtype = 0; - typevec_size = list_length (parms); - if (!for_method && current_namespace != global_namespace) - /* The namespace of a global function needs one slot. */ - typevec_size++; - typevec = (tree *)alloca (typevec_size * sizeof (tree)); - } - nofold = 0; - - if (for_method) - { - tree this_type = TREE_VALUE (parms); - - if (TREE_CODE (this_type) == RECORD_TYPE) /* a signature pointer */ - this_type = SIGNATURE_TYPE (this_type); - else - this_type = TREE_TYPE (this_type); - - build_mangled_name_for_type (this_type); - - if (!flag_do_squangling) - { - my_friendly_assert (maxtype < typevec_size, 387); - typevec[maxtype++] = this_type; - } - - if (TREE_CHAIN (parms)) - build_mangled_name (TREE_CHAIN (parms), 0, 0); - else - OB_PUTC ('e'); - } - else - { - /* the namespace qualifier for a global function - will count as type */ - if (current_namespace != global_namespace - && !flag_do_squangling) - { - my_friendly_assert (maxtype < typevec_size, 387); - typevec[maxtype++] = current_namespace; - } - build_mangled_name (parms, 0, 0); - } - - if (!flag_do_squangling) - /* Deallocate typevec array. */ - typevec = NULL; - } - - if (ret_type != NULL_TREE && for_method != 2) - { - /* Add the return type. */ - OB_PUTC ('_'); - build_mangled_name_for_type (ret_type); - } - - OB_FINISH (); - end_squangling (); - { - tree n = get_identifier (obstack_base (&scratch_obstack)); - if (IDENTIFIER_OPNAME_P (dname)) - IDENTIFIER_OPNAME_P (n) = 1; - return n; - } -} - -/* Change the name of a function definition so that it may be - overloaded. NAME is the name of the function to overload, - PARMS is the parameter list (which determines what name the - final function obtains). - - FOR_METHOD is 1 if this overload is being performed - for a method, rather than a function type. It is 2 if - this overload is being performed for a constructor. */ - -tree -build_decl_overload (dname, parms, for_method) - tree dname; - tree parms; - int for_method; -{ - return build_decl_overload_real (dname, parms, NULL_TREE, NULL_TREE, - NULL_TREE, for_method); -} - -/* Set the mangled name (DECL_ASSEMBLER_NAME) for DECL. */ - -void -set_mangled_name_for_decl (decl) - tree decl; -{ - tree parm_types; - - if (processing_template_decl) - /* There's no need to mangle the name of a template function. */ - return; - - parm_types = TYPE_ARG_TYPES (TREE_TYPE (decl)); - - if (DECL_STATIC_FUNCTION_P (decl)) - parm_types = - hash_tree_chain (build_pointer_type (DECL_CLASS_CONTEXT (decl)), - parm_types); - else - /* The only member functions whose type is a FUNCTION_TYPE, rather - than a METHOD_TYPE, should be static members. */ - my_friendly_assert (!DECL_CONTEXT (decl) - || !IS_AGGR_TYPE_CODE (TREE_CODE (DECL_CONTEXT (decl))) - || TREE_CODE (TREE_TYPE (decl)) != FUNCTION_TYPE, - 0); - - DECL_ASSEMBLER_NAME (decl) - = build_decl_overload (DECL_NAME (decl), parm_types, - DECL_FUNCTION_MEMBER_P (decl) - + DECL_CONSTRUCTOR_P (decl)); -} - -/* Build an overload name for the type expression TYPE. */ - -tree -build_typename_overload (type) - tree type; -{ - tree id; - - OB_INIT (); - OB_PUTID (ansi_opname[(int) TYPE_EXPR]); - nofold = 1; - start_squangling (); - build_mangled_name (type, 0, 1); - id = get_identifier (obstack_base (&scratch_obstack)); - IDENTIFIER_OPNAME_P (id) = 1; -#if 0 - IDENTIFIER_GLOBAL_VALUE (id) = TYPE_MAIN_DECL (type); -#endif - TREE_TYPE (id) = type; - end_squangling (); - return id; -} - -tree -build_overload_with_type (name, type) - tree name, type; -{ - OB_INIT (); - OB_PUTID (name); - nofold = 1; - - start_squangling (); - build_mangled_name (type, 0, 1); - end_squangling (); - return get_identifier (obstack_base (&scratch_obstack)); -} - -tree -get_id_2 (name, name2) - char *name; - tree name2; -{ - OB_INIT (); - OB_PUTCP (name); - OB_PUTID (name2); - OB_FINISH (); - return get_identifier (obstack_base (&scratch_obstack)); -} - -/* Print a binfo path T, starting with the most derived class. If - OMIT_LAST is set, drop and return the most derived class. */ - -static tree -build_base_path (t, omit_last) - tree t; - int omit_last; -{ - tree ret = NULL_TREE; - if (BINFO_INHERITANCE_CHAIN (t)) - ret = build_base_path (BINFO_INHERITANCE_CHAIN (t), omit_last); - else if (omit_last) - return t; - process_overload_item (BINFO_TYPE (t), 0); - return ret; -} - -/* Return a mangled name for a vlist vtable, using the path of both - BASE and VBASE. */ - -tree -get_vlist_vtable_id (base, vbase) - tree base, vbase; -{ - tree last; - OB_INIT (); - OB_PUTS (VCTABLE_NAME); - build_base_path (base, 0); - OB_PUTC ('_'); - /* Since the base path should end where the vbase path starts, we - can omit the most-derived class in the vbase path. Check below - that this really happens. */ - last = build_base_path (vbase, 1); - my_friendly_assert (BINFO_TYPE (last) == BINFO_TYPE (base), 990402); - OB_FINISH (); - return get_identifier (obstack_base (&scratch_obstack)); -} - -/* Returns a DECL_ASSEMBLER_NAME for the destructor of type TYPE. If - HAS_VLIST is set, also add the vlist argument. */ - -tree -build_destructor_name (type, has_vlist) - tree type; - int has_vlist; -{ - OB_INIT (); - OB_PUTS (DESTRUCTOR_DECL_PREFIX); - start_squangling (); - build_mangled_name_for_type (type); - /* If we need backwards compatibility, we can get aways by - not linking type-safely, as the dtor will check whether - the argument was provided. */ - if (has_vlist && !flag_vtable_thunks_compat) - OB_PUTS (VLIST_TYPE_NAME); - OB_FINISH (); - end_squangling (); - return get_identifier (obstack_base (&scratch_obstack)); -} - -/* Given a tree_code CODE, and some arguments (at least one), - attempt to use an overloaded operator on the arguments. - - For unary operators, only the first argument need be checked. - For binary operators, both arguments may need to be checked. - - Member functions can convert class references to class pointers, - for one-level deep indirection. More than that is not supported. - Operators [](), ()(), and ->() must be member functions. - - We call function call building calls with LOOKUP_COMPLAIN if they - are our only hope. This is true when we see a vanilla operator - applied to something of aggregate type. If this fails, we are free - to return `error_mark_node', because we will have reported the - error. - - Operators NEW and DELETE overload in funny ways: operator new takes - a single `size' parameter, and operator delete takes a pointer to the - storage being deleted. When overloading these operators, success is - assumed. If there is a failure, report an error message and return - `error_mark_node'. */ - -/* NOSTRICT */ -tree -build_opfncall (code, flags, xarg1, xarg2, arg3) - enum tree_code code; - int flags; - tree xarg1, xarg2, arg3; -{ - return build_new_op (code, flags, xarg1, xarg2, arg3); -} - -/* This function takes an identifier, ID, and attempts to figure out what - it means. There are a number of possible scenarios, presented in increasing - order of hair: - - 1) not in a class's scope - 2) in class's scope, member name of the class's method - 3) in class's scope, but not a member name of the class - 4) in class's scope, member name of a class's variable - - NAME is $1 from the bison rule. It is an IDENTIFIER_NODE. - VALUE is $$ from the bison rule. It is the value returned by lookup_name ($1) - - As a last ditch, try to look up the name as a label and return that - address. - - Values which are declared as being of REFERENCE_TYPE are - automatically dereferenced here (as a hack to make the - compiler faster). */ - -tree -hack_identifier (value, name) - tree value, name; -{ - tree type; - - if (value == error_mark_node) - { - if (current_class_name) - { - tree fields = lookup_fnfields (TYPE_BINFO (current_class_type), name, 1); - if (fields == error_mark_node) - return error_mark_node; - if (fields) - { - tree fndecl; - - fndecl = TREE_VALUE (fields); - my_friendly_assert (TREE_CODE (fndecl) == FUNCTION_DECL, 251); - /* I could not trigger this code. MvL */ - my_friendly_abort (980325); -#ifdef DEAD - if (DECL_CHAIN (fndecl) == NULL_TREE) - { - warning ("methods cannot be converted to function pointers"); - return fndecl; - } - else - { - error ("ambiguous request for method pointer `%s'", - IDENTIFIER_POINTER (name)); - return error_mark_node; - } -#endif - } - } - if (flag_labels_ok && IDENTIFIER_LABEL_VALUE (name)) - { - return IDENTIFIER_LABEL_VALUE (name); - } - return error_mark_node; - } - - type = TREE_TYPE (value); - if (TREE_CODE (value) == FIELD_DECL) - { - if (current_class_ptr == NULL_TREE) - { - if (current_function_decl - && DECL_STATIC_FUNCTION_P (current_function_decl)) - cp_error ("invalid use of member `%D' in static member function", - value); - else - /* We can get here when processing a bad default - argument, like: - struct S { int a; void f(int i = a); } */ - cp_error ("invalid use of member `%D'", value); - - return error_mark_node; - } - TREE_USED (current_class_ptr) = 1; - - /* Mark so that if we are in a constructor, and then find that - this field was initialized by a base initializer, - we can emit an error message. */ - TREE_USED (value) = 1; - value = build_component_ref (current_class_ref, name, NULL_TREE, 1); - } - else if ((TREE_CODE (value) == FUNCTION_DECL - && DECL_FUNCTION_MEMBER_P (value)) - || (TREE_CODE (value) == OVERLOAD - && DECL_FUNCTION_MEMBER_P (OVL_CURRENT (value)))) - { - tree decl; - - if (TREE_CODE (value) == OVERLOAD) - value = OVL_CURRENT (value); - - if (IS_SIGNATURE (DECL_CLASS_CONTEXT (value))) - return value; - - decl = maybe_dummy_object (DECL_CLASS_CONTEXT (value), 0); - value = build_component_ref (decl, name, NULL_TREE, 1); - } - else if (really_overloaded_fn (value)) - ; - else if (TREE_CODE (value) == OVERLOAD) - /* not really overloaded function */ - mark_used (OVL_FUNCTION (value)); - else if (TREE_CODE (value) == TREE_LIST) - { - /* Ambiguous reference to base members, possibly other cases?. */ - tree t = value; - while (t && TREE_CODE (t) == TREE_LIST) - { - mark_used (TREE_VALUE (t)); - t = TREE_CHAIN (t); - } - } - else if (TREE_CODE (value) == NAMESPACE_DECL) - { - cp_error ("use of namespace `%D' as expression", value); - return error_mark_node; - } - else if (DECL_CLASS_TEMPLATE_P (value)) - { - cp_error ("use of class template `%T' as expression", value); - return error_mark_node; - } - else - mark_used (value); - - if (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == PARM_DECL - || TREE_CODE (value) == RESULT_DECL) - { - tree context = decl_function_context (value); - if (context != NULL_TREE && context != current_function_decl - && ! TREE_STATIC (value)) - { - cp_error ("use of %s from containing function", - (TREE_CODE (value) == VAR_DECL - ? "`auto' variable" : "parameter")); - cp_error_at (" `%#D' declared here", value); - value = error_mark_node; - } - } - - if (TREE_CODE_CLASS (TREE_CODE (value)) == 'd' && DECL_NONLOCAL (value)) - { - if (DECL_LANG_SPECIFIC (value) - && DECL_CLASS_CONTEXT (value) != current_class_type) - { - tree path; - register tree context - = (TREE_CODE (value) == FUNCTION_DECL && DECL_VIRTUAL_P (value)) - ? DECL_CLASS_CONTEXT (value) - : DECL_CONTEXT (value); - - get_base_distance (context, current_class_type, 0, &path); - if (path && !enforce_access (current_class_type, value)) - return error_mark_node; - } - } - else if (TREE_CODE (value) == TREE_LIST - && TREE_TYPE (value) == error_mark_node) - { - error ("request for member `%s' is ambiguous in multiple inheritance lattice", - IDENTIFIER_POINTER (name)); - print_candidates (value); - return error_mark_node; - } - - if (! processing_template_decl) - value = convert_from_reference (value); - return value; -} - - -tree -make_thunk (function, delta) - tree function; - int delta; -{ - tree thunk_id; - tree thunk; - tree func_decl; - - if (TREE_CODE (function) != ADDR_EXPR) - abort (); - func_decl = TREE_OPERAND (function, 0); - if (TREE_CODE (func_decl) != FUNCTION_DECL) - abort (); - - OB_INIT (); - OB_PUTS ("__thunk_"); - if (delta > 0) - { - OB_PUTC ('n'); - icat (delta); - } - else - icat (-delta); - OB_PUTC ('_'); - OB_PUTID (DECL_ASSEMBLER_NAME (func_decl)); - OB_FINISH (); - thunk_id = get_identifier (obstack_base (&scratch_obstack)); - - thunk = IDENTIFIER_GLOBAL_VALUE (thunk_id); - if (thunk && TREE_CODE (thunk) != THUNK_DECL) - { - cp_error ("implementation-reserved name `%D' used", thunk_id); - thunk = NULL_TREE; - SET_IDENTIFIER_GLOBAL_VALUE (thunk_id, thunk); - } - if (thunk == NULL_TREE) - { - thunk = build_decl (FUNCTION_DECL, thunk_id, TREE_TYPE (func_decl)); - TREE_READONLY (thunk) = TREE_READONLY (func_decl); - TREE_THIS_VOLATILE (thunk) = TREE_THIS_VOLATILE (func_decl); - comdat_linkage (thunk); - TREE_SET_CODE (thunk, THUNK_DECL); - DECL_INITIAL (thunk) = function; - THUNK_DELTA (thunk) = delta; - DECL_EXTERNAL (thunk) = 1; - DECL_ARTIFICIAL (thunk) = 1; - /* So that finish_file can write out any thunks that need to be: */ - pushdecl_top_level (thunk); - } - return thunk; -} - -/* Emit the definition of a C++ multiple inheritance vtable thunk. */ - -void -emit_thunk (thunk_fndecl) - tree thunk_fndecl; -{ - tree function = TREE_OPERAND (DECL_INITIAL (thunk_fndecl), 0); - int delta = THUNK_DELTA (thunk_fndecl); - - if (TREE_ASM_WRITTEN (thunk_fndecl)) - return; - - TREE_ASM_WRITTEN (thunk_fndecl) = 1; - - TREE_ADDRESSABLE (function) = 1; - mark_used (function); - - if (current_function_decl) - abort (); - - TREE_SET_CODE (thunk_fndecl, FUNCTION_DECL); - - { -#ifdef ASM_OUTPUT_MI_THUNK - char *fnname; - current_function_decl = thunk_fndecl; - /* Make sure we build up its RTL before we go onto the - temporary obstack. */ - make_function_rtl (thunk_fndecl); - temporary_allocation (); - DECL_RESULT (thunk_fndecl) - = build_decl (RESULT_DECL, 0, integer_type_node); - fnname = XSTR (XEXP (DECL_RTL (thunk_fndecl), 0), 0); - init_function_start (thunk_fndecl, input_filename, lineno); - current_function_is_thunk = 1; - assemble_start_function (thunk_fndecl, fnname); - ASM_OUTPUT_MI_THUNK (asm_out_file, thunk_fndecl, delta, function); - assemble_end_function (thunk_fndecl, fnname); - permanent_allocation (1); - current_function_decl = 0; -#else /* ASM_OUTPUT_MI_THUNK */ - /* If we don't have the necessary macro for efficient thunks, generate a - thunk function that just makes a call to the real function. - Unfortunately, this doesn't work for varargs. */ - - tree a, t; - - if (varargs_function_p (function)) - cp_error ("generic thunk code fails for method `%#D' which uses `...'", - function); - - /* Set up clone argument trees for the thunk. */ - t = NULL_TREE; - for (a = DECL_ARGUMENTS (function); a; a = TREE_CHAIN (a)) - { - tree x = copy_node (a); - TREE_CHAIN (x) = t; - DECL_CONTEXT (x) = thunk_fndecl; - t = x; - } - a = nreverse (t); - DECL_ARGUMENTS (thunk_fndecl) = a; - DECL_RESULT (thunk_fndecl) = NULL_TREE; - DECL_LANG_SPECIFIC (thunk_fndecl) = DECL_LANG_SPECIFIC (function); - copy_lang_decl (thunk_fndecl); - DECL_INTERFACE_KNOWN (thunk_fndecl) = 1; - DECL_NOT_REALLY_EXTERN (thunk_fndecl) = 1; - - start_function (NULL_TREE, thunk_fndecl, NULL_TREE, 1); - store_parm_decls (); - current_function_is_thunk = 1; - - /* Build up the call to the real function. */ - t = build_int_2 (delta, -1 * (delta < 0)); - TREE_TYPE (t) = signed_type (sizetype); - t = fold (build (PLUS_EXPR, TREE_TYPE (a), a, t)); - t = expr_tree_cons (NULL_TREE, t, NULL_TREE); - for (a = TREE_CHAIN (a); a; a = TREE_CHAIN (a)) - t = expr_tree_cons (NULL_TREE, a, t); - t = nreverse (t); - t = build_call (function, TREE_TYPE (TREE_TYPE (function)), t); - c_expand_return (t); - - finish_function (lineno, 0, 0); - - /* Don't let the backend defer this function. */ - if (DECL_DEFER_OUTPUT (thunk_fndecl)) - { - output_inline_function (thunk_fndecl); - permanent_allocation (1); - } -#endif /* ASM_OUTPUT_MI_THUNK */ - } - - TREE_SET_CODE (thunk_fndecl, THUNK_DECL); -} - -void -make_vlist_ctor_wrapper (fn) - tree fn; -{ - tree fntype, decl; - tree arg_types, parms, parm, basetype, pbasetype; - tree t, ctors; - - arg_types = TYPE_ARG_TYPES (TREE_TYPE (fn)); - pbasetype = TREE_VALUE (arg_types); - basetype = TREE_TYPE (pbasetype); - parms = DECL_ARGUMENTS (fn); - - /* Skip this, __in_chrg, and _vlist */ - arg_types = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arg_types))); - - - /* Add __in_charge. */ - arg_types = hash_tree_chain (integer_type_node, arg_types); - - /* Don't add this to arg_types, as build_cplus_method_type does so. */ - - fntype = build_cplus_method_type (basetype, TREE_TYPE (TREE_TYPE (fn)), - arg_types); - - decl = build_lang_decl (FUNCTION_DECL, DECL_NAME (fn), fntype); - DECL_LANG_SPECIFIC (decl)->decl_flags = DECL_LANG_SPECIFIC (fn)->decl_flags; - DECL_EXTERNAL (decl) = 0; - TREE_PUBLIC (decl) = 1; - DECL_ARTIFICIAL (decl) = 1; - DECL_CONSTRUCTOR_P (decl) = 1; - DECL_CONSTRUCTOR_FOR_VBASE (decl) = CONSTRUCTOR_FOR_VBASE; - /* Claim that this is never a template instantiation. */ - DECL_USE_TEMPLATE (decl) = 0; - DECL_TEMPLATE_INFO (decl) = NULL_TREE; - - /* Set up clone argument trees for the thunk. */ - parms = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (parms))); - /* Add this */ - t = build_decl (PARM_DECL, this_identifier, pbasetype); - SET_DECL_ARTIFICIAL (t); - DECL_ARG_TYPE (t) = pbasetype; - DECL_REGISTER (t) = 1; - /* Add __in_charge. */ - parm = build_decl (PARM_DECL, in_charge_identifier, integer_type_node); - SET_DECL_ARTIFICIAL (parm); - DECL_ARG_TYPE (parm) = integer_type_node; - TREE_CHAIN (parm) = t; - t = parm; - - while (parms) - { - tree x = copy_node (parms); - TREE_CHAIN (x) = t; - DECL_CONTEXT (x) = decl; - t = x; - parms = TREE_CHAIN (parms); - } - parms = nreverse (t); - DECL_ARGUMENTS (decl) = parms; - - DECL_ASSEMBLER_NAME (decl) - = build_decl_overload (DECL_NAME (decl), - TYPE_ARG_TYPES (TREE_TYPE (decl)), 2); - - ctors = CLASSTYPE_METHOD_VEC (basetype); - if (ctors) - ctors = TREE_VEC_ELT (ctors, 0); - for ( ; ctors; ctors = OVL_NEXT (ctors)) - if (DECL_ASSEMBLER_NAME (OVL_CURRENT (ctors)) - == DECL_ASSEMBLER_NAME (decl)) - break; - - if (!ctors) - { - add_method (basetype, 0, decl); - cp_finish_decl (decl, NULL_TREE, NULL_TREE, 0, 0); - } - else - decl = OVL_CURRENT (ctors); - - /* Remember the original function. */ - DECL_VLIST_CTOR_WRAPPED (decl) = fn; - - /* When fn is declared, DECL_INITIAL is null. When it is defined, - DECL_INITIAL will be error_mark_node. */ - if (DECL_INITIAL (fn) == error_mark_node) - { - /* Record that the ctor is being defined, so we also emit the - wrapper later. */ - TREE_USED (decl) = 1; - DECL_NOT_REALLY_EXTERN (decl) = 1; - DECL_INITIAL (decl) = NULL_TREE; - mark_inline_for_output (decl); - } -} - -static void -emit_vlist_ctor_wrapper (decl) - tree decl; -{ - tree t, parms, fn; - - current_function_is_thunk = 1; - - parms = DECL_ARGUMENTS (decl); - fn = DECL_VLIST_CTOR_WRAPPED (decl); - mark_used (fn); - - /* Build up the call to the real function. */ - t = NULL_TREE; - /* Push this, __in_charge. */ - t = expr_tree_cons (NULL_TREE, parms, t); - parms = TREE_CHAIN (parms); - t = expr_tree_cons (NULL_TREE, parms, t); - parms = TREE_CHAIN (parms); - /* Push 0 as __vlist. */ - t = expr_tree_cons (NULL_TREE, vlist_zero_node, t); - /* Push rest of arguments. */ - while (parms) - { - t = expr_tree_cons (NULL_TREE, parms, t); - parms = TREE_CHAIN (parms); - } - t = nreverse (t); - t = build_call (fn, TREE_TYPE (TREE_TYPE (fn)), t); - expand_expr_stmt (t); -} - - -/* Code for synthesizing methods which have default semantics defined. */ - -/* For the anonymous union in TYPE, return the member that is at least as - large as the rest of the members, so we can copy it. */ - -static tree -largest_union_member (type) - tree type; -{ - tree f, type_size = TYPE_SIZE (type); - - for (f = TYPE_FIELDS (type); f; f = TREE_CHAIN (f)) - if (simple_cst_equal (DECL_SIZE (f), type_size) == 1) - return f; - - /* We should always find one. */ - my_friendly_abort (323); - return NULL_TREE; -} - -/* Generate code for default X(X&) constructor. */ - -static void -do_build_copy_constructor (fndecl) - tree fndecl; -{ - tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl)); - tree t; - - clear_last_expr (); - push_momentary (); - - if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)) - parm = TREE_CHAIN (parm); - if (TYPE_USES_PVBASES (current_class_type)) - parm = TREE_CHAIN (parm); - parm = convert_from_reference (parm); - - if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type) - && is_empty_class (current_class_type)) - /* Don't copy the padding byte; it might not have been allocated - if *this is a base subobject. */; - else if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)) - { - t = build (INIT_EXPR, void_type_node, current_class_ref, parm); - TREE_SIDE_EFFECTS (t) = 1; - cplus_expand_expr_stmt (t); - } - else - { - tree fields = TYPE_FIELDS (current_class_type); - int n_bases = CLASSTYPE_N_BASECLASSES (current_class_type); - tree binfos = TYPE_BINFO_BASETYPES (current_class_type); - int i; - - /* Initialize all the base-classes. */ - for (t = CLASSTYPE_VBASECLASSES (current_class_type); t; - t = TREE_CHAIN (t)) - current_base_init_list - = tree_cons (BINFO_TYPE (t), parm, current_base_init_list); - for (i = 0; i < n_bases; ++i) - { - t = TREE_VEC_ELT (binfos, i); - if (TREE_VIA_VIRTUAL (t)) - continue; - - current_base_init_list - = tree_cons (BINFO_TYPE (t), parm, current_base_init_list); - } - - for (; fields; fields = TREE_CHAIN (fields)) - { - tree init, t; - tree field = fields; - - if (TREE_CODE (field) != FIELD_DECL) - continue; - - init = parm; - if (DECL_NAME (field)) - { - if (VFIELD_NAME_P (DECL_NAME (field))) - continue; - if (VBASE_NAME_P (DECL_NAME (field))) - continue; - - /* True for duplicate members. */ - if (IDENTIFIER_CLASS_VALUE (DECL_NAME (field)) != field) - continue; - } - else if ((t = TREE_TYPE (field)) != NULL_TREE - && ANON_UNION_TYPE_P (t) - && TYPE_FIELDS (t) != NULL_TREE) - { - do - { - init = build (COMPONENT_REF, t, init, field); - field = largest_union_member (t); - } - while ((t = TREE_TYPE (field)) != NULL_TREE - && ANON_UNION_TYPE_P (t) - && TYPE_FIELDS (t) != NULL_TREE); - } - else - continue; - - init = build (COMPONENT_REF, TREE_TYPE (field), init, field); - init = build_tree_list (NULL_TREE, init); - - current_member_init_list - = tree_cons (DECL_NAME (field), init, current_member_init_list); - } - current_member_init_list = nreverse (current_member_init_list); - current_base_init_list = nreverse (current_base_init_list); - setup_vtbl_ptr (); - } - - pop_momentary (); -} - -static void -do_build_assign_ref (fndecl) - tree fndecl; -{ - tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl)); - - clear_last_expr (); - push_momentary (); - - parm = convert_from_reference (parm); - - if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type) - && is_empty_class (current_class_type)) - /* Don't copy the padding byte; it might not have been allocated - if *this is a base subobject. */; - else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)) - { - tree t = build (MODIFY_EXPR, void_type_node, current_class_ref, parm); - TREE_SIDE_EFFECTS (t) = 1; - cplus_expand_expr_stmt (t); - } - else - { - tree fields = TYPE_FIELDS (current_class_type); - int n_bases = CLASSTYPE_N_BASECLASSES (current_class_type); - tree binfos = TYPE_BINFO_BASETYPES (current_class_type); - int i; - - for (i = 0; i < n_bases; ++i) - { - tree basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, i)); - tree p = convert_to_reference - (build_reference_type (basetype), parm, - CONV_IMPLICIT|CONV_CONST, LOOKUP_COMPLAIN, NULL_TREE); - p = convert_from_reference (p); - p = build_member_call (basetype, ansi_opname [MODIFY_EXPR], - build_expr_list (NULL_TREE, p)); - expand_expr_stmt (p); - } - for (; fields; fields = TREE_CHAIN (fields)) - { - tree comp, init, t; - tree field = fields; - - if (TREE_CODE (field) != FIELD_DECL) - continue; - - if (CP_TYPE_CONST_P (TREE_TYPE (field))) - { - if (DECL_NAME (field)) - cp_error ("non-static const member `%#D', can't use default assignment operator", field); - else - cp_error ("non-static const member in type `%T', can't use default assignment operator", current_class_type); - continue; - } - else if (TREE_CODE (TREE_TYPE (field)) == REFERENCE_TYPE) - { - if (DECL_NAME (field)) - cp_error ("non-static reference member `%#D', can't use default assignment operator", field); - else - cp_error ("non-static reference member in type `%T', can't use default assignment operator", current_class_type); - continue; - } - - comp = current_class_ref; - init = parm; - - if (DECL_NAME (field)) - { - if (VFIELD_NAME_P (DECL_NAME (field))) - continue; - if (VBASE_NAME_P (DECL_NAME (field))) - continue; - - /* True for duplicate members. */ - if (IDENTIFIER_CLASS_VALUE (DECL_NAME (field)) != field) - continue; - } - else if ((t = TREE_TYPE (field)) != NULL_TREE - && ANON_UNION_TYPE_P (t) - && TYPE_FIELDS (t) != NULL_TREE) - { - do - { - comp = build (COMPONENT_REF, t, comp, field); - init = build (COMPONENT_REF, t, init, field); - field = largest_union_member (t); - } - while ((t = TREE_TYPE (field)) != NULL_TREE - && ANON_UNION_TYPE_P (t) - && TYPE_FIELDS (t) != NULL_TREE); - } - else - continue; - - comp = build (COMPONENT_REF, TREE_TYPE (field), comp, field); - init = build (COMPONENT_REF, TREE_TYPE (field), init, field); - - expand_expr_stmt (build_modify_expr (comp, NOP_EXPR, init)); - } - } - c_expand_return (current_class_ref); - pop_momentary (); -} - -void -synthesize_method (fndecl) - tree fndecl; -{ - int nested = (current_function_decl != NULL_TREE); - tree context = hack_decl_function_context (fndecl); - - /* If this is a wrapper around a undefined vlist ctor, don't emit it - even if it is used. */ - if (DECL_VLIST_CTOR_WRAPPER_P (fndecl)) - { - tree orig_fn = DECL_VLIST_CTOR_WRAPPED (fndecl); - mark_used (orig_fn); - if (DECL_INITIAL (orig_fn) == NULL_TREE) - return; - } - - if (at_eof) - import_export_decl (fndecl); - - if (! context) - push_to_top_level (); - else if (nested) - push_cp_function_context (context); - - interface_unknown = 1; - start_function (NULL_TREE, fndecl, NULL_TREE, 1); - store_parm_decls (); - - if (DECL_NAME (fndecl) == ansi_opname[MODIFY_EXPR]) - do_build_assign_ref (fndecl); - else if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl))) - ; - else - { - tree arg_chain = FUNCTION_ARG_CHAIN (fndecl); - if (DECL_CONSTRUCTOR_FOR_VBASE_P (fndecl)) - arg_chain = TREE_CHAIN (arg_chain); - else if (DECL_CONSTRUCTOR_FOR_PVBASE_P (fndecl)) - arg_chain = TREE_CHAIN (TREE_CHAIN (arg_chain)); - if (DECL_VLIST_CTOR_WRAPPER_P (fndecl)) - emit_vlist_ctor_wrapper (fndecl); - else if (arg_chain != void_list_node) - do_build_copy_constructor (fndecl); - else if (TYPE_NEEDS_CONSTRUCTING (current_class_type)) - setup_vtbl_ptr (); - } - - finish_function (lineno, 0, nested); - - extract_interface_info (); - if (! context) - pop_from_top_level (); - else if (nested) - pop_cp_function_context (context); -} - - - diff --git a/contrib/gcc/cp/mpw-config.in b/contrib/gcc/cp/mpw-config.in deleted file mode 100644 index 88dd85f72e9f..000000000000 --- a/contrib/gcc/cp/mpw-config.in +++ /dev/null @@ -1,11 +0,0 @@ -# Configuration fragment for G++. -# Most of the real configuration work happens in the main GCC configure. - -# We need to join some lines in the Makefile.in before the sed -# process will work properly. The funky little sed script works by -# recognizing lines with a trailing '$@ \', adding the next line to -# its "pattern space", editing out the backslash and line, then -# putting the result out. - -sed -e '/$@ \\/{N;s/$@ \\./$@ /;P;D;}' \Option-d - "{srcdir}"Makefile.in >"{o}"hacked_Makefile.in diff --git a/contrib/gcc/cp/mpw-make.sed b/contrib/gcc/cp/mpw-make.sed deleted file mode 100644 index 120b5a1fa3a5..000000000000 --- a/contrib/gcc/cp/mpw-make.sed +++ /dev/null @@ -1,112 +0,0 @@ -# Sed commands to finish translating the G++ Unix makefile into MPW syntax. - -# Remove control-Ls, they upset MPW make. -s/ //g - -# Remove references to always-empty variables used to mark things. -/CYGNUS-LOCAL-/s/{CYGNUS-LOCAL-[a-z0-9]*}//g - -# Add a bunch of definitions, mostly empty. -/^# Variables that exist for you to override.$/a\ -\ -xmake_file = \ -tmake_file = \ -build_xm_file = \ -MALLOC = \ -MD_DEPS = \ -REAL_H = \ -HOST_CC_LD = {CC_LD}\ -ALL_CCLDFLAGS = \ -HOST_CCLDFLAGS = \ -CONFIG_H = \ -LIBDEPS = \ - -# The "target" variable is special to MPW make, avoid it. -/{target}/s/{target}/{target_canonical}/g - -# Suppress the suppression of smart makes. -/^\.y\.c/d - -# Whack out "..." assignments. -/\.\.\./s/^\([a-z_]*= \.\.\.\)/#\1/ - -# Previous edits go a little overboard, undo. -/^objext = /s/"{o}"// - -# Always link in low-level MPW functions. -/^LIBDEPS=/s/$/ ::strerror.c.o ::mpwlib.c.o/ -/{CLIB}/s/{CLIB}/ ::strerror.c.o ::mpwlib.c.o {CLIB}/ - -# Don't get tricky about finding various .o file, point at dir above. -/^SUBDIR_OBSTACK/s/`.*`/::obstack.c.o/ -/^SUBDIR_USE_ALLOCA/s/`.*`/::alloca.c.o/ -/^SUBDIR_MALLOC/s/`.*`// - -# Point includes at parent directly correctly. -/^INCLUDES = /s/:\./::/g -/^INCLUDES = /s/"{srcdir}"\.\./"{topsrcdir}"gcc:/g -/^INCLUDES = /s,"{srcdir}"/\.\.,"{topsrcdir}"gcc:,g -/^INCLUDES = /s,"{srcdir}":config,"{topsrcdir}"gcc:config:,g - -# Add the special MPW include dirs. -/^INCLUDES = /s/$/ -i "{topsrcdir}"include:mpw: -i :::extra-include:/ - -# A nasty hack to reduce confusion. -/true/s/ ; @true$// - -# (should be in common translation?) -/{CC_LD} /s/$/ {EXTRALIBS}/ - -# Don't use general compiler flags (which may include definitions -# and other compiler-only bits) with linking commands. -/{CC_LD} /s/ALL_CFLAGS/ALL_CCLDFLAGS/ - -# Whack out build rules that are not useful. -/^Makefile \\Option-f /,/^$/d -/^config.status \\Option-f /,/^$/d -# (Note that MPW make is not case sensitive, and so this name -# is considered the same as "md_file".) -/^{MD_FILE} \\Option-f/,/^$/d - -# Depending on config.status is not useful for us. -/config.status/s/ config.status// - -# Repeat of stuff from generic edit. -/{s}/s/"{s}""{s}"/"{s}"/g -/{s}/s/"{s}""{srcdir}"/"{s}"/g -/{s}/s/"{srcdir}""{s}"/"{s}"/g - -# Fix references to C frontend files in main dir. -/::c-/s/"{o}"::c-/"{o}":c-/g - -# Fix pathnames to generated files in the objdir. -/parse/s/"{s}"parse\.\([chy]\)/"{o}"parse.\1/g -/parse/s/^parse\.\([chy]\)/"{o}"parse.\1/ -/y.tab.c/s/"{s}"y\.tab\.c/"{o}"y.tab.c/g -/y.tab.c/s/^y\.tab\.c/"{o}"y.tab.c/ -/y.tab.h/s/"{s}"y\.tab\.h/"{o}"y.tab.h/g -/y.tab.h/s/^y\.tab\.h/"{o}"y.tab.h/ - -# Put in the definition of YYEMPTY directly. -/grep/s/grep .* >>/Echo '#define YYEMPTY -1' >>/ - -# If the dates are wrong, then this tries to run gperf, which we don't -# really want. -/^"{srcdir}"hash.h/,/hash.h$/d - -# Sed the object file list instead of using cat (meow). -/cat/s/`cat /`sed -e 's,:,::,g' -e 's,{objext},.o,g' / - -# Simplify dependencies of generated parser files. -/^{PARSE_C}/s/^/#/ -/^stamp-parse/s/^stamp-parse/{PARSE_C}/ - -# Fix the compile line for the generated parser. -/{CC} -c/,/echo {PARSE_C}/c\ - {CC} @DASH_C_FLAG@ {ALL_CFLAGS} {ALL_CPPFLAGS} {INCLUDES} {BIG_SWITCHFLAG} "{o}"parse.c -o "{o}"parse.c.o\ - -# Change all Rez commands to use mac-gcc.r. -/{REZ}/s/"{s}"[-a-zA-Z{}]*\.r/"{topsrcdir}"gcc:mac-gcc.r/ - -# Remove pathname junk from the container name. -/{REZ}/s/'"'::cc1plus'"'/'"'cc1plus'"'/ diff --git a/contrib/gcc/cp/new.cc b/contrib/gcc/cp/new.cc deleted file mode 100644 index 3197012150d8..000000000000 --- a/contrib/gcc/cp/new.cc +++ /dev/null @@ -1,42 +0,0 @@ -// Implementation file for the -*- C++ -*- dynamic memory management header. -// Copyright (C) 1996, 1997, 1998 Free Software Foundation - -// This file is part of GNU CC. - -// GNU CC 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. - -// GNU CC 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. - -// You should have received a copy of the GNU General Public License -// along with GNU CC; see the file COPYING. If not, write to -// the Free Software Foundation, 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with other files, -// some of which are compiled with GCC, to produce an executable, -// this library does not by itself cause the resulting executable -// to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -#pragma implementation "new" -#include "new" - -const std::nothrow_t std::nothrow = { }; - -using std::new_handler; -new_handler __new_handler; - -new_handler -set_new_handler (new_handler handler) -{ - new_handler prev_handler = __new_handler; - __new_handler = handler; - return prev_handler; -} diff --git a/contrib/gcc/cp/new1.cc b/contrib/gcc/cp/new1.cc deleted file mode 100644 index 73fbcd2b1fd4..000000000000 --- a/contrib/gcc/cp/new1.cc +++ /dev/null @@ -1,89 +0,0 @@ -// Support routines for the -*- C++ -*- dynamic memory management. -// Copyright (C) 1997, 1998 Free Software Foundation - -// This file is part of GNU CC. - -// GNU CC 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. - -// GNU CC 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. - -// You should have received a copy of the GNU General Public License -// along with GNU CC; see the file COPYING. If not, write to -// the Free Software Foundation, 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with other files, -// some of which are compiled with GCC, to produce an executable, -// this library does not by itself cause the resulting executable -// to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -#include "new" -using std::new_handler; -using std::bad_alloc; - -extern "C" void *malloc (size_t); -extern new_handler __new_handler; - -#define WEAK(x) \ - x __attribute__ ((weak)); \ - x - -#ifdef L_op_newnt -WEAK (void * operator new (size_t sz, const std::nothrow_t&) throw()) -{ - void *p; - - /* malloc (0) is unpredictable; avoid it. */ - if (sz == 0) - sz = 1; - p = (void *) malloc (sz); - while (p == 0) - { - new_handler handler = __new_handler; - if (! handler) - return 0; - try - { - handler (); - } - catch (bad_alloc &) - { - return 0; - } - - p = (void *) malloc (sz); - } - - return p; -} -#endif - -#ifdef L_op_new -WEAK (void * operator new (size_t sz) throw (std::bad_alloc)) -{ - void *p; - - /* malloc (0) is unpredictable; avoid it. */ - if (sz == 0) - sz = 1; - p = (void *) malloc (sz); - while (p == 0) - { - new_handler handler = __new_handler; - if (! handler) - throw bad_alloc (); - handler (); - p = (void *) malloc (sz); - } - - return p; -} -#endif diff --git a/contrib/gcc/cp/new2.cc b/contrib/gcc/cp/new2.cc deleted file mode 100644 index 2833ea23414d..000000000000 --- a/contrib/gcc/cp/new2.cc +++ /dev/null @@ -1,80 +0,0 @@ -// Boilerplate support routines for -*- C++ -*- dynamic memory management. -// Copyright (C) 1997, 1998 Free Software Foundation - -// This file is part of GNU CC. - -// GNU CC 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. - -// GNU CC 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. - -// You should have received a copy of the GNU General Public License -// along with GNU CC; see the file COPYING. If not, write to -// the Free Software Foundation, 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with other files, -// some of which are compiled with GCC, to produce an executable, -// this library does not by itself cause the resulting executable -// to be covered by the GNU General Public License. -// This exception does not however invalidate any other reasons why -// the executable file might be covered by the GNU General Public License. - -#include "new" - -extern "C" void free (void *); - -#define WEAK(x) \ - x __attribute__ ((weak)); \ - x - -#ifdef L_op_vnew -WEAK(void * operator new[] (size_t sz) throw (std::bad_alloc)) -{ - return ::operator new(sz); -} -#endif - -#ifdef L_op_vnewnt -WEAK(void *operator new[] (size_t sz, const std::nothrow_t& nothrow) throw()) -{ - return ::operator new(sz, nothrow); -} -#endif - -#ifdef L_op_delete -WEAK (void operator delete (void *ptr) throw ()) -{ - if (ptr) - free (ptr); -} -#endif - -#ifdef L_op_vdel -WEAK (void operator delete[] (void *ptr) throw ()) -{ - if (ptr) - free (ptr); -} -#endif - -#ifdef L_op_delnt -WEAK (void operator delete (void *ptr, const std::nothrow_t&) throw ()) -{ - if (ptr) - free (ptr); -} -#endif - -#ifdef L_op_vdelnt -WEAK (void operator delete[] (void *ptr, const std::nothrow_t&) throw ()) -{ - if (ptr) - free (ptr); -} -#endif diff --git a/contrib/gcc/cp/parse.y b/contrib/gcc/cp/parse.y deleted file mode 100644 index 7b5d3bdede9b..000000000000 --- a/contrib/gcc/cp/parse.y +++ /dev/null @@ -1,3807 +0,0 @@ -/* YACC parser for C++ syntax. - Copyright (C) 1988, 89, 93-98, 1999 Free Software Foundation, Inc. - Hacked by Michael Tiemann (tiemann@cygnus.com) - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -/* This grammar is based on the GNU CC grammar. */ - -/* Note: Bison automatically applies a default action of "$$ = $1" for - all derivations; this is applied before the explicit action, if one - is given. Keep this in mind when reading the actions. */ - -%{ -/* Cause the `yydebug' variable to be defined. */ -#define YYDEBUG 1 - -#include "config.h" - -#include "system.h" - -#include "tree.h" -#include "input.h" -#include "flags.h" -#include "lex.h" -#include "cp-tree.h" -#include "output.h" -#include "except.h" -#include "toplev.h" - -/* Since parsers are distinct for each language, put the language string - definition here. (fnf) */ -char *language_string = "GNU C++"; - -extern tree void_list_node; -extern struct obstack permanent_obstack; - -extern int end_of_file; - -/* Like YYERROR but do call yyerror. */ -#define YYERROR1 { yyerror ("syntax error"); YYERROR; } - -#define OP0(NODE) (TREE_OPERAND (NODE, 0)) -#define OP1(NODE) (TREE_OPERAND (NODE, 1)) - -/* Contains the statement keyword (if/while/do) to include in an - error message if the user supplies an empty conditional expression. */ -static const char *cond_stmt_keyword; - -static tree empty_parms PROTO((void)); -static int parse_decl PROTO((tree, tree, tree, int, tree *)); - -/* Nonzero if we have an `extern "C"' acting as an extern specifier. */ -int have_extern_spec; -int used_extern_spec; - -/* Cons up an empty parameter list. */ -#ifdef __GNUC__ -__inline -#endif -static tree -empty_parms () -{ - tree parms; - - if (strict_prototype - || current_class_type != NULL) - parms = void_list_node; - else - parms = NULL_TREE; - return parms; -} - -%} - -%start program - -%union {long itype; tree ttype; char *strtype; enum tree_code code; flagged_type_tree ftype; } - -/* All identifiers that are not reserved words - and are not declared typedefs in the current block */ -%token IDENTIFIER - -/* All identifiers that are declared typedefs in the current block. - In some contexts, they are treated just like IDENTIFIER, - but they can also serve as typespecs in declarations. */ -%token TYPENAME -%token SELFNAME - -/* A template function. */ -%token PFUNCNAME - -/* Reserved words that specify storage class. - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token SCSPEC - -/* Reserved words that specify type. - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token TYPESPEC - -/* Reserved words that qualify type: "const" or "volatile". - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token CV_QUALIFIER - -/* Character or numeric constants. - yylval is the node for the constant. */ -%token CONSTANT - -/* String constants in raw form. - yylval is a STRING_CST node. */ -%token STRING - -/* "...", used for functions with variable arglists. */ -%token ELLIPSIS - -/* the reserved words */ -/* SCO include files test "ASM", so use something else. */ -%token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT -%token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF -%token SIGOF -%token ATTRIBUTE EXTENSION LABEL -%token REALPART IMAGPART - -/* the reserved words... C++ extensions */ -%token AGGR -%token VISSPEC -%token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE -%token NAMESPACE TYPENAME_KEYWORD USING -%token LEFT_RIGHT TEMPLATE -%token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST -%token SCOPE - -/* Define the operator tokens and their precedences. - The value is an integer because, if used, it is the tree code - to use in the expression made from the operator. */ - -%left EMPTY /* used to resolve s/r with epsilon */ - -%left error - -/* Add precedence rules to solve dangling else s/r conflict */ -%nonassoc IF -%nonassoc ELSE - -%left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD - -%left '{' ',' ';' - -%nonassoc THROW -%right ':' -%right ASSIGN '=' -%right '?' -%left OROR -%left ANDAND -%left '|' -%left '^' -%left '&' -%left MIN_MAX -%left EQCOMPARE -%left ARITHCOMPARE '<' '>' -%left LSHIFT RSHIFT -%left '+' '-' -%left '*' '/' '%' -%left POINTSAT_STAR DOT_STAR -%right UNARY PLUSPLUS MINUSMINUS '~' -%left HYPERUNARY -%left PAREN_STAR_PAREN LEFT_RIGHT -%left POINTSAT '.' '(' '[' - -%right SCOPE /* C++ extension */ -%nonassoc NEW DELETE TRY CATCH - -%type unop - -%type identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist -%type PFUNCNAME maybe_identifier -%type paren_expr_or_null nontrivial_exprlist SELFNAME -%type expr_no_commas cast_expr unary_expr primary string STRING -%type reserved_declspecs boolean.literal -%type reserved_typespecquals -%type declmods -%type SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier -%type initdecls notype_initdecls initdcl /* C++ modification */ -%type init initlist maybeasm maybe_init defarg defarg1 -%type asm_operands nonnull_asm_operands asm_operand asm_clobbers -%type maybe_attribute attributes attribute attribute_list attrib -%type any_word - -%type compstmt implicitly_scoped_stmt - -%type declarator notype_declarator after_type_declarator -%type notype_declarator_intern absdcl_intern -%type after_type_declarator_intern -%type direct_notype_declarator direct_after_type_declarator -%type components notype_components -%type component_decl component_decl_1 -%type component_declarator component_declarator0 -%type notype_component_declarator notype_component_declarator0 -%type after_type_component_declarator after_type_component_declarator0 -%type enumlist enumerator -%type absdcl cv_qualifiers -%type direct_abstract_declarator conversion_declarator -%type new_declarator direct_new_declarator -%type xexpr parmlist parms bad_parm -%type identifiers_or_typenames -%type fcast_or_absdcl regcast_or_absdcl -%type expr_or_declarator expr_or_declarator_intern -%type complex_notype_declarator -%type notype_unqualified_id unqualified_id qualified_id -%type template_id do_id object_template_id notype_template_declarator -%type overqualified_id notype_qualified_id any_id -%type complex_direct_notype_declarator functional_cast -%type complex_parmlist parms_comma -%type namespace_qualifier namespace_using_decl - -%type type_id new_type_id typed_typespecs typespec typed_declspecs -%type typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers -%type structsp typespecqual_reserved parm named_parm full_parm - -/* C++ extensions */ -%token PTYPENAME -%token PRE_PARSED_FUNCTION_DECL EXTERN_LANG_STRING ALL -%token PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER -%type component_constructor_declarator -%type fn.def2 return_id fn.defpen constructor_declarator -%type ctor_initializer_opt function_try_block -%type named_class_head_sans_basetype -%type class_head named_class_head -%type named_complex_class_head_sans_basetype -%type unnamed_class_head -%type base_class_list -%type base_class_access_list -%type base_class maybe_base_class_list base_class.1 -%type exception_specification_opt ansi_raise_identifier ansi_raise_identifiers -%type operator_name -%type object aggr -%type new delete .begin_new_placement -/* %type primary_no_id */ -%type nonmomentary_expr maybe_parmlist -%type initdcl0 notype_initdcl0 member_init_list initdcl0_innards -%type template_header template_parm_list template_parm -%type template_type_parm template_template_parm -%type template_close_bracket -%type apparent_template_type -%type template_type template_arg_list template_arg_list_opt -%type template_arg -%type condition xcond paren_cond_or_null -%type type_name nested_name_specifier nested_type ptr_to_mem -%type complete_type_name notype_identifier nonnested_type -%type complex_type_name nested_name_specifier_1 -%type new_initializer new_placement -%type using_decl -%type typename_sub typename_sub0 typename_sub1 typename_sub2 -%type explicit_template_type -/* in order to recognize aggr tags as defining and thus shadowing. */ -%token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN -%type named_class_head_sans_basetype_defn -%type identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN - -%type self_template_type .finish_template_type - -%token NSNAME -%type NSNAME - -/* Used in lex.c for parsing pragmas. */ -%token END_OF_LINE - -/* lex.c and pt.c depend on this being the last token. Define - any new tokens before this one! */ -%token END_OF_SAVED_INPUT - -%{ -/* List of types and structure classes of the current declaration. */ -static tree current_declspecs; - -/* List of prefix attributes in effect. - Prefix attributes are parsed by the reserved_declspecs and declmods - rules. They create a list that contains *both* declspecs and attrs. */ -/* ??? It is not clear yet that all cases where an attribute can now appear in - a declspec list have been updated. */ -static tree prefix_attributes; - -/* When defining an aggregate, this is the kind of the most recent one - being defined. (For example, this might be class_type_node.) */ -static tree current_aggr; - -/* When defining an enumeration, this is the type of the enumeration. */ -static tree current_enum_type; - -/* Tell yyparse how to print a token's value, if yydebug is set. */ - -#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL) -extern void yyprint PROTO((FILE *, int, YYSTYPE)); -extern tree combine_strings PROTO((tree)); - -static int -parse_decl(declarator, specs_attrs, attributes, initialized, decl) - tree declarator; - tree specs_attrs; - tree attributes; - int initialized; - tree* decl; -{ - int sm; - - split_specs_attrs (specs_attrs, ¤t_declspecs, &prefix_attributes); - if (current_declspecs - && TREE_CODE (current_declspecs) != TREE_LIST) - current_declspecs = build_decl_list (NULL_TREE, current_declspecs); - if (have_extern_spec && !used_extern_spec) - { - current_declspecs = decl_tree_cons (NULL_TREE, - get_identifier ("extern"), - current_declspecs); - used_extern_spec = 1; - } - sm = suspend_momentary (); - *decl = start_decl (declarator, current_declspecs, initialized, - attributes, prefix_attributes); - return sm; -} -%} - -%% -program: - /* empty */ - | extdefs - { finish_translation_unit (); } - ; - -/* the reason for the strange actions in this rule - is so that notype_initdecls when reached via datadef - can find a valid list of type and sc specs in $0. */ - -extdefs: - { $$ = NULL_TREE; } - lang_extdef - { $$ = NULL_TREE; } - | extdefs lang_extdef - { $$ = NULL_TREE; } - ; - -extdefs_opt: - extdefs - | /* empty */ - ; - -.hush_warning: - { have_extern_spec = 1; - used_extern_spec = 0; - $$ = NULL_TREE; } - ; -.warning_ok: - { have_extern_spec = 0; } - ; - -extension: - EXTENSION - { $$ = pedantic; - pedantic = 0; } - ; - -asm_keyword: - ASM_KEYWORD - ; - -lang_extdef: - { if (pending_lang_change) do_pending_lang_change(); } - extdef - { if (! toplevel_bindings_p () && ! pseudo_global_level_p()) - pop_everything (); } - ; - -extdef: - fndef eat_saved_input - { if (pending_inlines) do_pending_inlines (); } - | datadef - { if (pending_inlines) do_pending_inlines (); } - | template_def - { if (pending_inlines) do_pending_inlines (); } - | asm_keyword '(' string ')' ';' - { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); - assemble_asm ($3); } - | extern_lang_string '{' extdefs_opt '}' - { pop_lang_context (); } - | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input - { if (pending_inlines) do_pending_inlines (); - pop_lang_context (); } - | extern_lang_string .hush_warning datadef .warning_ok - { if (pending_inlines) do_pending_inlines (); - pop_lang_context (); } - | NAMESPACE identifier '{' - { push_namespace ($2); } - extdefs_opt '}' - { pop_namespace (); } - | NAMESPACE '{' - { push_namespace (NULL_TREE); } - extdefs_opt '}' - { pop_namespace (); } - | namespace_alias - | using_decl ';' - { do_toplevel_using_decl ($1); } - | using_directive - | extension extdef - { pedantic = $1; } - ; - -namespace_alias: - NAMESPACE identifier '=' - { begin_only_namespace_names (); } - any_id ';' - { - end_only_namespace_names (); - if (lastiddecl) - $5 = lastiddecl; - do_namespace_alias ($2, $5); - } - ; - -using_decl: - USING qualified_id - { $$ = $2; } - | USING global_scope qualified_id - { $$ = $3; } - | USING global_scope unqualified_id - { $$ = $3; } - ; - -namespace_using_decl: - USING namespace_qualifier identifier - { $$ = build_parse_node (SCOPE_REF, $2, $3); } - | USING global_scope identifier - { $$ = build_parse_node (SCOPE_REF, global_namespace, $3); } - | USING global_scope namespace_qualifier identifier - { $$ = build_parse_node (SCOPE_REF, $3, $4); } - ; - -using_directive: - USING NAMESPACE - { begin_only_namespace_names (); } - any_id ';' - { - end_only_namespace_names (); - /* If no declaration was found, the using-directive is - invalid. Since that was not reported, we need the - identifier for the error message. */ - if (TREE_CODE ($4) == IDENTIFIER_NODE && lastiddecl) - $4 = lastiddecl; - do_using_directive ($4); - } - ; - -namespace_qualifier: - NSNAME SCOPE - { - if (TREE_CODE ($$) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$; - } - | namespace_qualifier NSNAME SCOPE - { - $$ = $2; - if (TREE_CODE ($$) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$; - } - -any_id: - unqualified_id - | qualified_id - | global_scope qualified_id - { $$ = $2; } - | global_scope unqualified_id - { $$ = $2; } - ; - -extern_lang_string: - EXTERN_LANG_STRING - { push_lang_context ($1); } - | extern_lang_string EXTERN_LANG_STRING - { if (current_lang_name != $2) - cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name); - pop_lang_context (); push_lang_context ($2); } - ; - -template_header: - TEMPLATE '<' - { begin_template_parm_list (); } - template_parm_list '>' - { $$ = end_template_parm_list ($4); } - | TEMPLATE '<' '>' - { begin_specialization(); - $$ = NULL_TREE; } - ; - -template_parm_list: - template_parm - { $$ = process_template_parm (NULL_TREE, $1); } - | template_parm_list ',' template_parm - { $$ = process_template_parm ($1, $3); } - ; - -maybe_identifier: - identifier - { $$ = $1; } - | /* empty */ - { $$ = NULL_TREE; } - -template_type_parm: - aggr maybe_identifier - { $$ = finish_template_type_parm ($1, $2); } - | TYPENAME_KEYWORD maybe_identifier - { $$ = finish_template_type_parm (class_type_node, $2); } - ; - -template_template_parm: - template_header aggr maybe_identifier - { $$ = finish_template_template_parm ($2, $3); } - ; - -template_parm: - /* The following rules introduce a new reduce/reduce - conflict on the ',' and '>' input tokens: they are valid - prefixes for a `structsp', which means they could match a - nameless parameter. See 14.6, paragraph 3. - By putting them before the `parm' rule, we get - their match before considering them nameless parameter - declarations. */ - template_type_parm - { $$ = build_tree_list (NULL_TREE, $1); } - | template_type_parm '=' type_id - { $$ = build_tree_list (groktypename ($3.t), $1); } - | parm - { $$ = build_tree_list (NULL_TREE, $1.t); } - | parm '=' expr_no_commas %prec ARITHCOMPARE - { $$ = build_tree_list ($3, $1.t); } - | template_template_parm - { $$ = build_tree_list (NULL_TREE, $1); } - | template_template_parm '=' template_arg - { - if (TREE_CODE ($3) != TEMPLATE_DECL - && TREE_CODE ($3) != TEMPLATE_TEMPLATE_PARM - && TREE_CODE ($3) != TYPE_DECL) - { - error ("invalid default template argument"); - $3 = error_mark_node; - } - $$ = build_tree_list ($3, $1); - } - ; - -template_def: - template_header template_extdef - { finish_template_decl ($1); } - | template_header error %prec EMPTY - { finish_template_decl ($1); } - ; - -template_extdef: - fndef eat_saved_input - { if (pending_inlines) do_pending_inlines (); } - | template_datadef - { if (pending_inlines) do_pending_inlines (); } - | template_def - { if (pending_inlines) do_pending_inlines (); } - | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input - { if (pending_inlines) do_pending_inlines (); - pop_lang_context (); } - | extern_lang_string .hush_warning template_datadef .warning_ok - { if (pending_inlines) do_pending_inlines (); - pop_lang_context (); } - | extension template_extdef - { pedantic = $1; } - ; - -template_datadef: - nomods_initdecls ';' - | declmods notype_initdecls ';' - {} - | typed_declspecs initdecls ';' - { note_list_got_semicolon ($1.t); } - | structsp ';' - { maybe_process_partial_specialization ($1.t); - note_got_semicolon ($1.t); } - ; - -datadef: - nomods_initdecls ';' - | declmods notype_initdecls ';' - {} - | typed_declspecs initdecls ';' - { note_list_got_semicolon ($1.t); } - | declmods ';' - { pedwarn ("empty declaration"); } - | explicit_instantiation ';' - | typed_declspecs ';' - { - tree t, attrs; - split_specs_attrs ($1.t, &t, &attrs); - shadow_tag (t); - note_list_got_semicolon ($1.t); - } - | error ';' - | error '}' - | ';' - ; - -ctor_initializer_opt: - nodecls - { $$ = 0; } - | base_init - { $$ = 1; } - ; - -maybe_return_init: - /* empty */ - | return_init - | return_init ';' - ; - -eat_saved_input: - /* empty */ - | END_OF_SAVED_INPUT - ; - -fndef: - fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error - { finish_function (lineno, (int)$3, 0); } - | fn.def1 maybe_return_init function_try_block - { - int nested = (hack_decl_function_context - (current_function_decl) != NULL_TREE); - finish_function (lineno, (int)$3, nested); - } - | fn.def1 maybe_return_init error - { } - ; - -constructor_declarator: - nested_name_specifier SELFNAME '(' - { $$ = begin_constructor_declarator ($1, $2); } - parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($4, $5, $7, $8); } - | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = begin_constructor_declarator ($1, $2); - $$ = make_call_declarator ($$, empty_parms (), $4, $5); - } - | global_scope nested_name_specifier SELFNAME '(' - { $$ = begin_constructor_declarator ($2, $3); } - parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($5, $6, $8, $9); } - | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = begin_constructor_declarator ($2, $3); - $$ = make_call_declarator ($$, empty_parms (), $5, $6); - } - | nested_name_specifier self_template_type '(' - { $$ = begin_constructor_declarator ($1, $2); } - parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($4, $5, $7, $8); } - | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = begin_constructor_declarator ($1, $2); - $$ = make_call_declarator ($$, empty_parms (), $4, $5); - } - | global_scope nested_name_specifier self_template_type '(' - { $$ = begin_constructor_declarator ($2, $3); } - parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($5, $6, $8, $9); } - | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = begin_constructor_declarator ($2, $3); - $$ = make_call_declarator ($$, empty_parms (), $5, $6); - } - ; - -fn.def1: - typed_declspecs declarator - { if (!begin_function_definition ($1.t, $2)) - YYERROR1; } - | declmods notype_declarator - { if (!begin_function_definition ($1, $2)) - YYERROR1; } - | notype_declarator - { if (!begin_function_definition (NULL_TREE, $1)) - YYERROR1; } - | declmods constructor_declarator - { if (!begin_function_definition ($1, $2)) - YYERROR1; } - | constructor_declarator - { if (!begin_function_definition (NULL_TREE, $1)) - YYERROR1; } - ; - -component_constructor_declarator: - SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($1, $3, $5, $6); } - | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($1, empty_parms (), $3, $4); } - | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($1, $3, $5, $6); } - | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($1, empty_parms (), $3, $4); } - ; - -/* more C++ complexity. See component_decl for a comment on the - reduce/reduce conflict introduced by these rules. */ -fn.def2: - declmods component_constructor_declarator - { tree specs, attrs; - split_specs_attrs ($1, &specs, &attrs); - attrs = build_tree_list (attrs, NULL_TREE); - $$ = start_method (specs, $2, attrs); - rest_of_mdef: - if (! $$) - YYERROR1; - if (yychar == YYEMPTY) - yychar = YYLEX; - reinit_parse_for_method (yychar, $$); } - | component_constructor_declarator - { $$ = start_method (NULL_TREE, $1, NULL_TREE); - goto rest_of_mdef; } - | typed_declspecs declarator - { tree specs, attrs; - split_specs_attrs ($1.t, &specs, &attrs); - attrs = build_tree_list (attrs, NULL_TREE); - $$ = start_method (specs, $2, attrs); goto rest_of_mdef; } - | declmods notype_declarator - { tree specs, attrs; - split_specs_attrs ($1, &specs, &attrs); - attrs = build_tree_list (attrs, NULL_TREE); - $$ = start_method (specs, $2, attrs); goto rest_of_mdef; } - | notype_declarator - { $$ = start_method (NULL_TREE, $$, NULL_TREE); - goto rest_of_mdef; } - | declmods constructor_declarator - { tree specs, attrs; - split_specs_attrs ($1, &specs, &attrs); - attrs = build_tree_list (attrs, NULL_TREE); - $$ = start_method (specs, $2, attrs); goto rest_of_mdef; } - | constructor_declarator - { $$ = start_method (NULL_TREE, $$, NULL_TREE); - goto rest_of_mdef; } - ; - -return_id: - RETURN_KEYWORD IDENTIFIER - { - if (! current_function_parms_stored) - store_parm_decls (); - $$ = $2; - } - ; - -return_init: - return_id maybe_init - { store_return_init ($$, $2); } - | return_id '(' nonnull_exprlist ')' - { store_return_init ($$, $3); } - | return_id LEFT_RIGHT - { store_return_init ($$, NULL_TREE); } - ; - -base_init: - ':' .set_base_init member_init_list - { - if ($3 == 0) - error ("no base initializers given following ':'"); - setup_vtbl_ptr (); - /* Always keep the BLOCK node associated with the outermost - pair of curley braces of a function. These are needed - for correct operation of dwarfout.c. */ - keep_next_level (); - } - ; - -.set_base_init: - /* empty */ - { - if (! current_function_parms_stored) - store_parm_decls (); - - if (DECL_CONSTRUCTOR_P (current_function_decl)) - { - /* Make a contour for the initializer list. */ - pushlevel (0); - clear_last_expr (); - expand_start_bindings (0); - } - else if (current_class_type == NULL_TREE) - error ("base initializers not allowed for non-member functions"); - else if (! DECL_CONSTRUCTOR_P (current_function_decl)) - error ("only constructors take base initializers"); - } - ; - -member_init_list: - /* empty */ - { $$ = 0; } - | member_init - { $$ = 1; } - | member_init_list ',' member_init - | member_init_list error - ; - -member_init: - '(' nonnull_exprlist ')' - { - if (current_class_name) - pedwarn ("anachronistic old style base class initializer"); - expand_member_init (current_class_ref, NULL_TREE, $2); - } - | LEFT_RIGHT - { - if (current_class_name) - pedwarn ("anachronistic old style base class initializer"); - expand_member_init (current_class_ref, NULL_TREE, void_type_node); - } - | notype_identifier '(' nonnull_exprlist ')' - { expand_member_init (current_class_ref, $1, $3); } - | notype_identifier LEFT_RIGHT - { expand_member_init (current_class_ref, $1, void_type_node); } - | nonnested_type '(' nonnull_exprlist ')' - { expand_member_init (current_class_ref, $1, $3); } - | nonnested_type LEFT_RIGHT - { expand_member_init (current_class_ref, $1, void_type_node); } - | typename_sub '(' nonnull_exprlist ')' - { expand_member_init (current_class_ref, TYPE_MAIN_DECL ($1), - $3); } - | typename_sub LEFT_RIGHT - { expand_member_init (current_class_ref, TYPE_MAIN_DECL ($1), - void_type_node); } - ; - -identifier: - IDENTIFIER - | TYPENAME - | SELFNAME - | PTYPENAME - | NSNAME - ; - -notype_identifier: - IDENTIFIER - | PTYPENAME - | NSNAME %prec EMPTY - ; - -identifier_defn: - IDENTIFIER_DEFN - | TYPENAME_DEFN - | PTYPENAME_DEFN - ; - -explicit_instantiation: - TEMPLATE begin_explicit_instantiation typespec ';' - { do_type_instantiation ($3.t, NULL_TREE); - yyungetc (';', 1); } - end_explicit_instantiation - | TEMPLATE begin_explicit_instantiation typed_declspecs declarator - { tree specs = strip_attrs ($3.t); - do_decl_instantiation (specs, $4, NULL_TREE); } - end_explicit_instantiation - | TEMPLATE begin_explicit_instantiation notype_declarator - { do_decl_instantiation (NULL_TREE, $3, NULL_TREE); } - end_explicit_instantiation - | TEMPLATE begin_explicit_instantiation constructor_declarator - { do_decl_instantiation (NULL_TREE, $3, NULL_TREE); } - end_explicit_instantiation - | SCSPEC TEMPLATE begin_explicit_instantiation typespec ';' - { do_type_instantiation ($4.t, $1); - yyungetc (';', 1); } - end_explicit_instantiation - | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs - declarator - { tree specs = strip_attrs ($4.t); - do_decl_instantiation (specs, $5, $1); } - end_explicit_instantiation - | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator - { do_decl_instantiation (NULL_TREE, $4, $1); } - end_explicit_instantiation - | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator - { do_decl_instantiation (NULL_TREE, $4, $1); } - end_explicit_instantiation - ; - -begin_explicit_instantiation: - { begin_explicit_instantiation(); } - -end_explicit_instantiation: - { end_explicit_instantiation(); } - -/* The TYPENAME expansions are to deal with use of a template class name as - a template within the class itself, where the template decl is hidden by - a type decl. Got all that? */ - -template_type: - PTYPENAME '<' template_arg_list_opt template_close_bracket - .finish_template_type - { $$ = $5; } - | TYPENAME '<' template_arg_list_opt template_close_bracket - .finish_template_type - { $$ = $5; } - | self_template_type - ; - -apparent_template_type: - template_type - | identifier '<' template_arg_list_opt '>' - .finish_template_type - { $$ = $5; } - -self_template_type: - SELFNAME '<' template_arg_list_opt template_close_bracket - .finish_template_type - { $$ = $5; } - ; - -.finish_template_type: - { - if (yychar == YYEMPTY) - yychar = YYLEX; - - $$ = finish_template_type ($-3, $-1, - yychar == SCOPE); - } - -template_close_bracket: - '>' - | RSHIFT - { - /* Handle `Class>' without space in the `>>' */ - pedwarn ("`>>' should be `> >' in template class name"); - yyungetc ('>', 1); - } - ; - -template_arg_list_opt: - /* empty */ - { $$ = NULL_TREE; } - | template_arg_list - ; - -template_arg_list: - template_arg - { $$ = build_tree_list (NULL_TREE, $$); } - | template_arg_list ',' template_arg - { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); } - ; - -template_arg: - type_id - { $$ = groktypename ($1.t); } - | PTYPENAME - { $$ = lastiddecl; } - | expr_no_commas %prec ARITHCOMPARE - ; - -unop: - '-' - { $$ = NEGATE_EXPR; } - | '+' - { $$ = CONVERT_EXPR; } - | PLUSPLUS - { $$ = PREINCREMENT_EXPR; } - | MINUSMINUS - { $$ = PREDECREMENT_EXPR; } - | '!' - { $$ = TRUTH_NOT_EXPR; } - ; - -expr: - nontrivial_exprlist - { $$ = build_x_compound_expr ($$); } - | expr_no_commas - ; - -paren_expr_or_null: - LEFT_RIGHT - { error ("ANSI C++ forbids an empty condition for `%s'", - cond_stmt_keyword); - $$ = integer_zero_node; } - | '(' expr ')' - { $$ = $2; } - ; - -paren_cond_or_null: - LEFT_RIGHT - { error ("ANSI C++ forbids an empty condition for `%s'", - cond_stmt_keyword); - $$ = integer_zero_node; } - | '(' condition ')' - { $$ = $2; } - ; - -xcond: - /* empty */ - { $$ = NULL_TREE; } - | condition - | error - { $$ = NULL_TREE; } - ; - -condition: - type_specifier_seq declarator maybeasm maybe_attribute '=' - { { - tree d; - for (d = getdecls (); d; d = TREE_CHAIN (d)) - if (TREE_CODE (d) == TYPE_DECL) { - tree s = TREE_TYPE (d); - if (TREE_CODE (s) == RECORD_TYPE) - cp_error ("definition of class `%T' in condition", s); - else if (TREE_CODE (s) == ENUMERAL_TYPE) - cp_error ("definition of enum `%T' in condition", s); - } - } - current_declspecs = $1.t; - $5 = suspend_momentary (); - $$ = start_decl ($2, current_declspecs, 1, - $4, /*prefix_attributes*/ NULL_TREE); - } - init - { - cp_finish_decl ($6, $7, $4, 1, LOOKUP_ONLYCONVERTING); - resume_momentary ($5); - $$ = convert_from_reference ($6); - if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE) - cp_error ("definition of array `%#D' in condition", $$); - } - | expr - ; - -compstmtend: - '}' - | maybe_label_decls stmts '}' - | maybe_label_decls stmts error '}' - | maybe_label_decls error '}' - ; - -already_scoped_stmt: - '{' - { $$ = begin_compound_stmt (1); } - compstmtend - { finish_compound_stmt (1, $2); } - | simple_stmt - ; - - -nontrivial_exprlist: - expr_no_commas ',' expr_no_commas - { $$ = expr_tree_cons (NULL_TREE, $$, - build_expr_list (NULL_TREE, $3)); } - | expr_no_commas ',' error - { $$ = expr_tree_cons (NULL_TREE, $$, - build_expr_list (NULL_TREE, error_mark_node)); } - | nontrivial_exprlist ',' expr_no_commas - { chainon ($$, build_expr_list (NULL_TREE, $3)); } - | nontrivial_exprlist ',' error - { chainon ($$, build_expr_list (NULL_TREE, error_mark_node)); } - ; - -nonnull_exprlist: - expr_no_commas - { $$ = build_expr_list (NULL_TREE, $$); } - | nontrivial_exprlist - ; - -unary_expr: - primary %prec UNARY - { $$ = $1; } - /* __extension__ turns off -pedantic for following primary. */ - | extension cast_expr %prec UNARY - { $$ = $2; - pedantic = $1; } - | '*' cast_expr %prec UNARY - { $$ = build_x_indirect_ref ($2, "unary *"); } - | '&' cast_expr %prec UNARY - { $$ = build_x_unary_op (ADDR_EXPR, $2); } - | '~' cast_expr - { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); } - | unop cast_expr %prec UNARY - { $$ = finish_unary_op_expr ($1, $2); } - /* Refer to the address of a label as a pointer. */ - | ANDAND identifier - { if (pedantic) - pedwarn ("ANSI C++ forbids `&&'"); - $$ = finish_label_address_expr ($2); } - | SIZEOF unary_expr %prec UNARY - { $$ = expr_sizeof ($2); } - | SIZEOF '(' type_id ')' %prec HYPERUNARY - { $$ = c_sizeof (groktypename ($3.t)); - check_for_new_type ("sizeof", $3); } - | ALIGNOF unary_expr %prec UNARY - { $$ = grok_alignof ($2); } - | ALIGNOF '(' type_id ')' %prec HYPERUNARY - { $$ = c_alignof (groktypename ($3.t)); - check_for_new_type ("alignof", $3); } - - /* The %prec EMPTY's here are required by the = init initializer - syntax extension; see below. */ - | new new_type_id %prec EMPTY - { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1); - check_for_new_type ("new", $2); } - | new new_type_id new_initializer - { $$ = build_new (NULL_TREE, $2.t, $3, $1); - check_for_new_type ("new", $2); } - | new new_placement new_type_id %prec EMPTY - { $$ = build_new ($2, $3.t, NULL_TREE, $1); - check_for_new_type ("new", $3); } - | new new_placement new_type_id new_initializer - { $$ = build_new ($2, $3.t, $4, $1); - check_for_new_type ("new", $3); } - /* The .begin_new_placement in the following rules is - necessary to avoid shift/reduce conflicts that lead to - mis-parsing some expressions. Of course, these constructs - are not really new-placement and it is bogus to call - begin_new_placement. But, the parser cannot always tell at this - point whether the next thing is an expression or a type-id, - so there is nothing we can do. Fortunately, - begin_new_placement does nothing harmful. When we rewrite - the parser, this lossage should be removed, of course. */ - | new '(' .begin_new_placement type_id .finish_new_placement - %prec EMPTY - { $$ = build_new (NULL_TREE, groktypename($4.t), - NULL_TREE, $1); - check_for_new_type ("new", $4); } - | new '(' .begin_new_placement type_id .finish_new_placement - new_initializer - { $$ = build_new (NULL_TREE, groktypename($4.t), $6, $1); - check_for_new_type ("new", $4); } - | new new_placement '(' .begin_new_placement type_id - .finish_new_placement %prec EMPTY - { $$ = build_new ($2, groktypename($5.t), NULL_TREE, $1); - check_for_new_type ("new", $5); } - | new new_placement '(' .begin_new_placement type_id - .finish_new_placement new_initializer - { $$ = build_new ($2, groktypename($5.t), $7, $1); - check_for_new_type ("new", $5); } - - | delete cast_expr %prec UNARY - { $$ = delete_sanity ($2, NULL_TREE, 0, $1); } - | delete '[' ']' cast_expr %prec UNARY - { $$ = delete_sanity ($4, NULL_TREE, 1, $1); - if (yychar == YYEMPTY) - yychar = YYLEX; } - | delete '[' expr ']' cast_expr %prec UNARY - { $$ = delete_sanity ($5, $3, 2, $1); - if (yychar == YYEMPTY) - yychar = YYLEX; } - | REALPART cast_expr %prec UNARY - { $$ = build_x_unary_op (REALPART_EXPR, $2); } - | IMAGPART cast_expr %prec UNARY - { $$ = build_x_unary_op (IMAGPART_EXPR, $2); } - ; - - /* Note this rule is not suitable for use in new_placement - since it uses NULL_TREE as the argument to - finish_new_placement. This rule serves only to avoid - reduce/reduce conflicts in unary_expr. See the comments - there on the use of begin/finish_new_placement. */ -.finish_new_placement: - ')' - { finish_new_placement (NULL_TREE, $-1); } - -.begin_new_placement: - { $$ = begin_new_placement (); } - -new_placement: - '(' .begin_new_placement nonnull_exprlist ')' - { $$ = finish_new_placement ($3, $2); } - | '{' .begin_new_placement nonnull_exprlist '}' - { cp_pedwarn ("old style placement syntax, use () instead"); - $$ = finish_new_placement ($3, $2); } - ; - -new_initializer: - '(' nonnull_exprlist ')' - { $$ = $2; } - | LEFT_RIGHT - { $$ = NULL_TREE; } - | '(' typespec ')' - { - cp_error ("`%T' is not a valid expression", $2.t); - $$ = error_mark_node; - } - /* GNU extension so people can use initializer lists. Note that - this alters the meaning of `new int = 1', which was previously - syntactically valid but semantically invalid. */ - | '=' init - { - if (pedantic) - pedwarn ("ANSI C++ forbids initialization of new expression with `='"); - if (TREE_CODE ($2) != TREE_LIST - && TREE_CODE ($2) != CONSTRUCTOR) - $$ = build_expr_list (NULL_TREE, $2); - else - $$ = $2; - } - ; - -/* This is necessary to postpone reduction of `int ((int)(int)(int))'. */ -regcast_or_absdcl: - '(' type_id ')' %prec EMPTY - { $2.t = finish_parmlist (build_tree_list (NULL_TREE, $2.t), 0); - $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE); - check_for_new_type ("cast", $2); } - | regcast_or_absdcl '(' type_id ')' %prec EMPTY - { $3.t = finish_parmlist (build_tree_list (NULL_TREE, $3.t), 0); - $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE); - check_for_new_type ("cast", $3); } - ; - -cast_expr: - unary_expr - | regcast_or_absdcl unary_expr %prec UNARY - { $$ = reparse_absdcl_as_casts ($$, $2); } - | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY - { - tree init = build_nt (CONSTRUCTOR, NULL_TREE, - nreverse ($3)); - if (pedantic) - pedwarn ("ANSI C++ forbids constructor-expressions"); - /* Indicate that this was a GNU C constructor expression. */ - TREE_HAS_CONSTRUCTOR (init) = 1; - - $$ = reparse_absdcl_as_casts ($$, init); - } - ; - -expr_no_commas: - cast_expr - /* Handle general members. */ - | expr_no_commas POINTSAT_STAR expr_no_commas - { $$ = build_x_binary_op (MEMBER_REF, $$, $3); } - | expr_no_commas DOT_STAR expr_no_commas - { $$ = build_m_component_ref ($$, $3); } - | expr_no_commas '+' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '-' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '*' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '/' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '%' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas LSHIFT expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas RSHIFT expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas ARITHCOMPARE expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '<' expr_no_commas - { $$ = build_x_binary_op (LT_EXPR, $$, $3); } - | expr_no_commas '>' expr_no_commas - { $$ = build_x_binary_op (GT_EXPR, $$, $3); } - | expr_no_commas EQCOMPARE expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas MIN_MAX expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '&' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '|' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '^' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas ANDAND expr_no_commas - { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); } - | expr_no_commas OROR expr_no_commas - { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); } - | expr_no_commas '?' xexpr ':' expr_no_commas - { $$ = build_x_conditional_expr ($$, $3, $5); } - | expr_no_commas '=' expr_no_commas - { $$ = build_x_modify_expr ($$, NOP_EXPR, $3); - if ($$ != error_mark_node) - C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); } - | expr_no_commas ASSIGN expr_no_commas - { $$ = build_x_modify_expr ($$, $2, $3); } - | THROW - { $$ = build_throw (NULL_TREE); } - | THROW expr_no_commas - { $$ = build_throw ($2); } -/* These extensions are not defined. The second arg to build_m_component_ref - is old, build_m_component_ref now does an implicit - build_indirect_ref (x, NULL_PTR) on the second argument. - | object '&' expr_no_commas %prec UNARY - { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); } - | object unop expr_no_commas %prec UNARY - { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); } - | object '(' type_id ')' expr_no_commas %prec UNARY - { tree type = groktypename ($3.t); - $$ = build_m_component_ref ($$, build_c_cast (type, $5)); } - | object primary_no_id %prec UNARY - { $$ = build_m_component_ref ($$, $2); } -*/ - ; - -notype_unqualified_id: - '~' see_typename identifier - { $$ = build_parse_node (BIT_NOT_EXPR, $3); } - | '~' see_typename template_type - { $$ = build_parse_node (BIT_NOT_EXPR, $3); } - | template_id - | operator_name - | IDENTIFIER - | PTYPENAME - | NSNAME %prec EMPTY - ; - -do_id: - { - /* If lastiddecl is a TREE_LIST, it's a baselink, which - means that we're in an expression like S::f, so - don't do_identifier; we only do that for unqualified - identifiers. */ - if (lastiddecl && TREE_CODE (lastiddecl) != TREE_LIST) - $$ = do_identifier ($-1, 1, NULL_TREE); - else - $$ = $-1; - } - -template_id: - PFUNCNAME '<' do_id template_arg_list_opt template_close_bracket - { $$ = lookup_template_function ($3, $4); } - | operator_name '<' do_id template_arg_list_opt template_close_bracket - { $$ = lookup_template_function ($3, $4); } - ; - -object_template_id: - TEMPLATE identifier '<' template_arg_list_opt template_close_bracket - { $$ = lookup_template_function ($2, $4); } - | TEMPLATE PFUNCNAME '<' template_arg_list_opt template_close_bracket - { $$ = lookup_template_function ($2, $4); } - | TEMPLATE operator_name '<' template_arg_list_opt - template_close_bracket - { $$ = lookup_template_function ($2, $4); } - ; - -unqualified_id: - notype_unqualified_id - | TYPENAME - | SELFNAME - ; - -expr_or_declarator_intern: - expr_or_declarator - | attributes expr_or_declarator - { - /* Provide support for '(' attributes '*' declarator ')' - etc */ - $$ = decl_tree_cons ($1, $2, NULL_TREE); - } - ; - -expr_or_declarator: - notype_unqualified_id - | '*' expr_or_declarator_intern %prec UNARY - { $$ = build_parse_node (INDIRECT_REF, $2); } - | '&' expr_or_declarator_intern %prec UNARY - { $$ = build_parse_node (ADDR_EXPR, $2); } - | '(' expr_or_declarator_intern ')' - { $$ = $2; } - ; - -notype_template_declarator: - IDENTIFIER '<' template_arg_list_opt template_close_bracket - { $$ = lookup_template_function ($1, $3); } - | NSNAME '<' template_arg_list template_close_bracket - { $$ = lookup_template_function ($1, $3); } - ; - -direct_notype_declarator: - complex_direct_notype_declarator - /* This precedence declaration is to prefer this reduce - to the Koenig lookup shift in primary, below. I hate yacc. */ - | notype_unqualified_id %prec '(' - | notype_template_declarator - | '(' expr_or_declarator_intern ')' - { $$ = finish_decl_parsing ($2); } - ; - -primary: - notype_unqualified_id - { - if (TREE_CODE ($1) == BIT_NOT_EXPR) - $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($1, 0)); - else - $$ = finish_id_expr ($1); - } - | CONSTANT - | boolean.literal - | string - { - if (processing_template_decl) - push_obstacks (&permanent_obstack, &permanent_obstack); - $$ = combine_strings ($$); - /* combine_strings doesn't set up TYPE_MAIN_VARIANT of - a const array the way we want, so fix it. */ - if (flag_const_strings) - TREE_TYPE ($$) = build_cplus_array_type - (TREE_TYPE (TREE_TYPE ($$)), - TYPE_DOMAIN (TREE_TYPE ($$))); - if (processing_template_decl) - pop_obstacks (); - } - | '(' expr ')' - { $$ = finish_parenthesized_expr ($2); } - | '(' expr_or_declarator_intern ')' - { $2 = reparse_decl_as_expr (NULL_TREE, $2); - $$ = finish_parenthesized_expr ($2); } - | '(' error ')' - { $$ = error_mark_node; } - | '(' - { tree scope = current_scope (); - if (!scope || TREE_CODE (scope) != FUNCTION_DECL) - { - error ("braced-group within expression allowed only inside a function"); - YYERROR; - } - if (pedantic) - pedwarn ("ANSI C++ forbids braced-groups within expressions"); - $$ = begin_stmt_expr (); - } - compstmt ')' - { $$ = finish_stmt_expr ($2, $3); } - /* Koenig lookup support - We could store lastiddecl in $1 to avoid another lookup, - but that would result in many additional reduce/reduce conflicts. */ - | notype_unqualified_id '(' nonnull_exprlist ')' - { $$ = finish_call_expr ($1, $3, 1); } - | notype_unqualified_id LEFT_RIGHT - { $$ = finish_call_expr ($1, NULL_TREE, 1); } - | primary '(' nonnull_exprlist ')' - { $$ = finish_call_expr ($1, $3, 0); } - | primary LEFT_RIGHT - { $$ = finish_call_expr ($1, NULL_TREE, 0); } - | primary '[' expr ']' - { $$ = grok_array_decl ($$, $3); } - | primary PLUSPLUS - { $$ = finish_increment_expr ($1, POSTINCREMENT_EXPR); } - | primary MINUSMINUS - { $$ = finish_increment_expr ($1, POSTDECREMENT_EXPR); } - /* C++ extensions */ - | THIS - { $$ = finish_this_expr (); } - | CV_QUALIFIER '(' nonnull_exprlist ')' - { - /* This is a C cast in C++'s `functional' notation - using the "implicit int" extension so that: - `const (3)' is equivalent to `const int (3)'. */ - tree type; - - if ($3 == error_mark_node) - { - $$ = error_mark_node; - break; - } - - type = cp_build_qualified_type (integer_type_node, - cp_type_qual_from_rid ($1)); - $$ = build_c_cast (type, build_compound_expr ($3)); - } - | functional_cast - | DYNAMIC_CAST '<' type_id '>' '(' expr ')' - { tree type = groktypename ($3.t); - check_for_new_type ("dynamic_cast", $3); - $$ = build_dynamic_cast (type, $6); } - | STATIC_CAST '<' type_id '>' '(' expr ')' - { tree type = groktypename ($3.t); - check_for_new_type ("static_cast", $3); - $$ = build_static_cast (type, $6); } - | REINTERPRET_CAST '<' type_id '>' '(' expr ')' - { tree type = groktypename ($3.t); - check_for_new_type ("reinterpret_cast", $3); - $$ = build_reinterpret_cast (type, $6); } - | CONST_CAST '<' type_id '>' '(' expr ')' - { tree type = groktypename ($3.t); - check_for_new_type ("const_cast", $3); - $$ = build_const_cast (type, $6); } - | TYPEID '(' expr ')' - { $$ = build_x_typeid ($3); } - | TYPEID '(' type_id ')' - { tree type = groktypename ($3.t); - check_for_new_type ("typeid", $3); - $$ = get_typeid (TYPE_MAIN_VARIANT (type)); } - | global_scope IDENTIFIER - { $$ = do_scoped_id ($2, 1); } - | global_scope template_id - { $$ = $2; } - | global_scope operator_name - { - got_scope = NULL_TREE; - if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = do_scoped_id ($2, 1); - else - $$ = $2; - } - | overqualified_id %prec HYPERUNARY - { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); } - | overqualified_id '(' nonnull_exprlist ')' - { $$ = finish_qualified_call_expr ($1, $3); } - | overqualified_id LEFT_RIGHT - { $$ = finish_qualified_call_expr ($1, NULL_TREE); } - | object object_template_id %prec UNARY - { - $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); - } - | object object_template_id '(' nonnull_exprlist ')' - { $$ = finish_object_call_expr ($2, $1, $4); } - | object object_template_id LEFT_RIGHT - { $$ = finish_object_call_expr ($2, $1, NULL_TREE); } - | object unqualified_id %prec UNARY - { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); } - | object overqualified_id %prec UNARY - { if (processing_template_decl) - $$ = build_min_nt (COMPONENT_REF, $1, copy_to_permanent ($2)); - else - $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); } - | object unqualified_id '(' nonnull_exprlist ')' - { $$ = finish_object_call_expr ($2, $1, $4); } - | object unqualified_id LEFT_RIGHT - { $$ = finish_object_call_expr ($2, $1, NULL_TREE); } - | object overqualified_id '(' nonnull_exprlist ')' - { $$ = finish_qualified_object_call_expr ($2, $1, $4); } - | object overqualified_id LEFT_RIGHT - { $$ = finish_qualified_object_call_expr ($2, $1, NULL_TREE); } - /* p->int::~int() is valid -- 12.4 */ - | object '~' TYPESPEC LEFT_RIGHT - { $$ = finish_pseudo_destructor_call_expr ($1, NULL_TREE, $3); } - | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT - { $$ = finish_pseudo_destructor_call_expr ($1, $2, $5); } - | object error - { - $$ = error_mark_node; - } - ; - -/* Not needed for now. - -primary_no_id: - '(' expr ')' - { $$ = $2; } - | '(' error ')' - { $$ = error_mark_node; } - | '(' - { if (current_function_decl == 0) - { - error ("braced-group within expression allowed only inside a function"); - YYERROR; - } - $$ = expand_start_stmt_expr (); } - compstmt ')' - { if (pedantic) - pedwarn ("ANSI C++ forbids braced-groups within expressions"); - $$ = expand_end_stmt_expr ($2); } - | primary_no_id '(' nonnull_exprlist ')' - { $$ = build_x_function_call ($$, $3, current_class_ref); } - | primary_no_id LEFT_RIGHT - { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); } - | primary_no_id '[' expr ']' - { goto do_array; } - | primary_no_id PLUSPLUS - { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); } - | primary_no_id MINUSMINUS - { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); } - | SCOPE IDENTIFIER - { goto do_scoped_id; } - | SCOPE operator_name - { if (TREE_CODE ($2) == IDENTIFIER_NODE) - goto do_scoped_id; - goto do_scoped_operator; - } - ; -*/ - -new: - NEW - { $$ = 0; } - | global_scope NEW - { got_scope = NULL_TREE; $$ = 1; } - ; - -delete: - DELETE - { $$ = 0; } - | global_scope delete - { got_scope = NULL_TREE; $$ = 1; } - ; - -boolean.literal: - CXX_TRUE - { $$ = boolean_true_node; } - | CXX_FALSE - { $$ = boolean_false_node; } - ; - -/* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */ -string: - STRING - | string STRING - { $$ = chainon ($$, $2); } - ; - -nodecls: - /* empty */ - { - if (! current_function_parms_stored) - store_parm_decls (); - setup_vtbl_ptr (); - /* Always keep the BLOCK node associated with the outermost - pair of curley braces of a function. These are needed - for correct operation of dwarfout.c. */ - keep_next_level (); - } - ; - -object: - primary '.' - { got_object = TREE_TYPE ($$); } - | primary POINTSAT - { - $$ = build_x_arrow ($$); - got_object = TREE_TYPE ($$); - } - ; - -decl: - typespec initdecls ';' - { - resume_momentary ($2); - if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t))) - note_got_semicolon ($1.t); - } - | typed_declspecs initdecls ';' - { - resume_momentary ($2); - note_list_got_semicolon ($1.t); - } - | declmods notype_initdecls ';' - { resume_momentary ($2); } - | typed_declspecs ';' - { - shadow_tag ($1.t); - note_list_got_semicolon ($1.t); - } - | declmods ';' - { warning ("empty declaration"); } - | extension decl - { pedantic = $1; } - ; - -/* Any kind of declarator (thus, all declarators allowed - after an explicit typespec). */ - -declarator: - after_type_declarator %prec EMPTY - | notype_declarator %prec EMPTY - ; - -/* This is necessary to postpone reduction of `int()()()()'. */ -fcast_or_absdcl: - LEFT_RIGHT %prec EMPTY - { $$ = make_call_declarator (NULL_TREE, empty_parms (), - NULL_TREE, NULL_TREE); } - | fcast_or_absdcl LEFT_RIGHT %prec EMPTY - { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE, - NULL_TREE); } - ; - -/* ANSI type-id (8.1) */ -type_id: - typed_typespecs absdcl - { $$.t = build_decl_list ($1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | nonempty_cv_qualifiers absdcl - { $$.t = build_decl_list ($1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | typespec absdcl - { $$.t = build_decl_list (build_decl_list (NULL_TREE, $1.t), - $2); - $$.new_type_flag = $1.new_type_flag; } - | typed_typespecs %prec EMPTY - { $$.t = build_decl_list ($1.t, NULL_TREE); - $$.new_type_flag = $1.new_type_flag; } - | nonempty_cv_qualifiers %prec EMPTY - { $$.t = build_decl_list ($1.t, NULL_TREE); - $$.new_type_flag = $1.new_type_flag; } - ; - -/* Declspecs which contain at least one type specifier or typedef name. - (Just `const' or `volatile' is not enough.) - A typedef'd name following these is taken as a name to be declared. - In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */ - -typed_declspecs: - typed_typespecs %prec EMPTY - | typed_declspecs1 - ; - -typed_declspecs1: - declmods typespec - { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1); - $$.new_type_flag = $2.new_type_flag; } - | typespec reserved_declspecs %prec HYPERUNARY - { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | typespec reserved_typespecquals reserved_declspecs - { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3)); - $$.new_type_flag = $1.new_type_flag; } - | declmods typespec reserved_declspecs - { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1)); - $$.new_type_flag = $2.new_type_flag; } - | declmods typespec reserved_typespecquals - { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1)); - $$.new_type_flag = $2.new_type_flag; } - | declmods typespec reserved_typespecquals reserved_declspecs - { $$.t = decl_tree_cons (NULL_TREE, $2.t, - chainon ($3, chainon ($4, $1))); - $$.new_type_flag = $2.new_type_flag; } - ; - -reserved_declspecs: - SCSPEC - { if (extra_warnings) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ($$)); - $$ = build_decl_list (NULL_TREE, $$); } - | reserved_declspecs typespecqual_reserved - { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); } - | reserved_declspecs SCSPEC - { if (extra_warnings) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ($2)); - $$ = decl_tree_cons (NULL_TREE, $2, $$); } - | reserved_declspecs attributes - { $$ = decl_tree_cons ($2, NULL_TREE, $1); } - | attributes - { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); } - ; - -/* List of just storage classes and type modifiers. - A declaration can start with just this, but then it cannot be used - to redeclare a typedef-name. - In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */ - -/* We use hash_tree_cons for lists of typeless declspecs so that they end - up on a persistent obstack. Otherwise, they could appear at the - beginning of something like - - static const struct { int foo () { } } b; - - and would be discarded after we finish compiling foo. We don't need to - worry once we see a type. */ - -declmods: - nonempty_cv_qualifiers %prec EMPTY - { $$ = $1.t; TREE_STATIC ($$) = 1; } - | SCSPEC - { $$ = hash_tree_cons (NULL_TREE, $$, NULL_TREE); } - | declmods CV_QUALIFIER - { $$ = hash_tree_cons (NULL_TREE, $2, $$); - TREE_STATIC ($$) = 1; } - | declmods SCSPEC - { if (extra_warnings && TREE_STATIC ($$)) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ($2)); - $$ = hash_tree_cons (NULL_TREE, $2, $$); - TREE_STATIC ($$) = TREE_STATIC ($1); } - | declmods attributes - { $$ = hash_tree_cons ($2, NULL_TREE, $1); } - | attributes %prec EMPTY - { $$ = hash_tree_cons ($1, NULL_TREE, NULL_TREE); } - ; - -/* Used instead of declspecs where storage classes are not allowed - (that is, for typenames and structure components). - - C++ can takes storage classes for structure components. - Don't accept a typedef-name if anything but a modifier precedes it. */ - -typed_typespecs: - typespec %prec EMPTY - { $$.t = build_decl_list (NULL_TREE, $1.t); - $$.new_type_flag = $1.new_type_flag; } - | nonempty_cv_qualifiers typespec - { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t); - $$.new_type_flag = $2.new_type_flag; } - | typespec reserved_typespecquals - { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | nonempty_cv_qualifiers typespec reserved_typespecquals - { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); - $$.new_type_flag = $1.new_type_flag; } - ; - -reserved_typespecquals: - typespecqual_reserved - { $$ = build_decl_list (NULL_TREE, $1.t); } - | reserved_typespecquals typespecqual_reserved - { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); } - ; - -/* A typespec (but not a type qualifier). - Once we have seen one of these in a declaration, - if a typedef name appears then it is being redeclared. */ - -typespec: - structsp - | TYPESPEC %prec EMPTY - { $$.t = $1; $$.new_type_flag = 0; } - | complete_type_name - { $$.t = $1; $$.new_type_flag = 0; } - | TYPEOF '(' expr ')' - { $$.t = finish_typeof ($3); - $$.new_type_flag = 0; } - | TYPEOF '(' type_id ')' - { $$.t = groktypename ($3.t); - $$.new_type_flag = 0; } - | SIGOF '(' expr ')' - { tree type = TREE_TYPE ($3); - - $$.new_type_flag = 0; - if (IS_AGGR_TYPE (type)) - { - sorry ("sigof type specifier"); - $$.t = type; - } - else - { - error ("`sigof' applied to non-aggregate expression"); - $$.t = error_mark_node; - } - } - | SIGOF '(' type_id ')' - { tree type = groktypename ($3.t); - - $$.new_type_flag = 0; - if (IS_AGGR_TYPE (type)) - { - sorry ("sigof type specifier"); - $$.t = type; - } - else - { - error("`sigof' applied to non-aggregate type"); - $$.t = error_mark_node; - } - } - ; - -/* A typespec that is a reserved word, or a type qualifier. */ - -typespecqual_reserved: - TYPESPEC - { $$.t = $1; $$.new_type_flag = 0; } - | CV_QUALIFIER - { $$.t = $1; $$.new_type_flag = 0; } - | structsp - ; - -initdecls: - initdcl0 - | initdecls ',' initdcl - { check_multiple_declarators (); } - ; - -notype_initdecls: - notype_initdcl0 - | notype_initdecls ',' initdcl - { check_multiple_declarators (); } - ; - -nomods_initdecls: - nomods_initdcl0 - | nomods_initdecls ',' initdcl - { check_multiple_declarators (); } - ; - -maybeasm: - /* empty */ - { $$ = NULL_TREE; } - | asm_keyword '(' string ')' - { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; } - ; - -initdcl: - declarator maybeasm maybe_attribute '=' - { $$ = start_decl ($1, current_declspecs, 1, - $3, prefix_attributes); } - init -/* Note how the declaration of the variable is in effect while its init is parsed! */ - { cp_finish_decl ($5, $6, $2, 1, LOOKUP_ONLYCONVERTING); } - | declarator maybeasm maybe_attribute - { $$ = start_decl ($1, current_declspecs, 0, - $3, prefix_attributes); - cp_finish_decl ($$, NULL_TREE, $2, 1, 0); } - ; - - /* This rule assumes a certain configuration of the parser stack. - In particular, $0, the element directly before the beginning of - this rule on the stack, must be a maybeasm. $-1 must be a - declarator or notype_declarator. And $-2 must be some declmods - or declspecs. We can't move the maybeasm into this rule because - we need that reduce so we prefer fn.def1 when appropriate. */ -initdcl0_innards: - maybe_attribute '=' - { $2 = parse_decl ($-1, $-2, - $1, 1, &$$); } - /* Note how the declaration of the variable is in effect - while its init is parsed! */ - init - { cp_finish_decl ($3, $4, $0, 1, - LOOKUP_ONLYCONVERTING); - $$ = $2; } - | maybe_attribute - { tree d; - $$ = parse_decl ($-1, $-2, $1, 0, &d); - cp_finish_decl (d, NULL_TREE, $0, 1, 0); } - ; - -initdcl0: - declarator maybeasm initdcl0_innards - { $$ = $3; } - -notype_initdcl0: - notype_declarator maybeasm initdcl0_innards - { $$ = $3; } - ; - -nomods_initdcl0: - notype_declarator maybeasm - { /* Set things up as initdcl0_innards expects. */ - $2 = $1; - $1 = NULL_TREE; } - initdcl0_innards - {} - | constructor_declarator maybeasm maybe_attribute - { tree d; - parse_decl($1, NULL_TREE, $3, 0, &d); - cp_finish_decl (d, NULL_TREE, $2, 1, 0); } - ; - -/* the * rules are dummies to accept the Apollo extended syntax - so that the header files compile. */ -maybe_attribute: - /* empty */ - { $$ = NULL_TREE; } - | attributes - { $$ = $1; } - ; - -attributes: - attribute - { $$ = $1; } - | attributes attribute - { $$ = chainon ($1, $2); } - ; - -attribute: - ATTRIBUTE '(' '(' attribute_list ')' ')' - { $$ = $4; } - ; - -attribute_list: - attrib - { $$ = $1; } - | attribute_list ',' attrib - { $$ = chainon ($1, $3); } - ; - -attrib: - /* empty */ - { $$ = NULL_TREE; } - | any_word - { $$ = build_tree_list ($1, NULL_TREE); } - | any_word '(' IDENTIFIER ')' - { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); } - | any_word '(' IDENTIFIER ',' nonnull_exprlist ')' - { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); } - | any_word '(' nonnull_exprlist ')' - { $$ = build_tree_list ($1, $3); } - ; - -/* This still leaves out most reserved keywords, - shouldn't we include them? */ - -any_word: - identifier - | SCSPEC - | TYPESPEC - | CV_QUALIFIER - ; - -/* A nonempty list of identifiers, including typenames. */ -identifiers_or_typenames: - identifier - { $$ = build_tree_list (NULL_TREE, $1); } - | identifiers_or_typenames ',' identifier - { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); } - ; - -maybe_init: - /* empty */ %prec EMPTY - { $$ = NULL_TREE; } - | '=' init - { $$ = $2; } - -/* If we are processing a template, we don't want to expand this - initializer yet. */ - -init: - expr_no_commas %prec '=' - | '{' '}' - { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE); - TREE_HAS_CONSTRUCTOR ($$) = 1; } - | '{' initlist '}' - { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2)); - TREE_HAS_CONSTRUCTOR ($$) = 1; } - | '{' initlist ',' '}' - { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2)); - TREE_HAS_CONSTRUCTOR ($$) = 1; } - | error - { $$ = NULL_TREE; } - ; - -/* This chain is built in reverse order, - and put in forward order where initlist is used. */ -initlist: - init - { $$ = build_tree_list (NULL_TREE, $$); } - | initlist ',' init - { $$ = expr_tree_cons (NULL_TREE, $3, $$); } - /* These are for labeled elements. */ - | '[' expr_no_commas ']' init - { $$ = build_expr_list ($2, $4); } - | identifier ':' init - { $$ = build_expr_list ($$, $3); } - | initlist ',' identifier ':' init - { $$ = expr_tree_cons ($3, $5, $$); } - ; - -fn.defpen: - PRE_PARSED_FUNCTION_DECL - { start_function (NULL_TREE, TREE_VALUE ($1), - NULL_TREE, 2); - reinit_parse_for_function (); } - -pending_inline: - fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error - { - int nested = (hack_decl_function_context - (current_function_decl) != NULL_TREE); - finish_function (lineno, (int)$3 | 2, nested); - process_next_inline ($1); - } - | fn.defpen maybe_return_init function_try_block - { - int nested = (hack_decl_function_context - (current_function_decl) != NULL_TREE); - finish_function (lineno, (int)$3 | 2, nested); - process_next_inline ($1); - } - | fn.defpen maybe_return_init error - { process_next_inline ($1); } - ; - -pending_inlines: - /* empty */ - | pending_inlines pending_inline eat_saved_input - ; - -/* A regurgitated default argument. The value of DEFARG_MARKER will be - the TREE_LIST node for the parameter in question. */ -defarg_again: - DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT - { replace_defarg ($1, $2); } - | DEFARG_MARKER error END_OF_SAVED_INPUT - { replace_defarg ($1, error_mark_node); } - -pending_defargs: - /* empty */ %prec EMPTY - | pending_defargs defarg_again - { do_pending_defargs (); } - | pending_defargs error - { do_pending_defargs (); } - ; - -structsp: - ENUM identifier '{' - { $3 = suspend_momentary (); - $$ = current_enum_type; - current_enum_type = start_enum ($2); } - enumlist maybecomma_warn '}' - { TYPE_VALUES (current_enum_type) = $5; - $$.t = finish_enum (current_enum_type); - $$.new_type_flag = 1; - current_enum_type = $4; - resume_momentary ((int) $3); - check_for_missing_semicolon ($$.t); } - | ENUM identifier '{' '}' - { $$.t = finish_enum (start_enum ($2)); - $$.new_type_flag = 1; - check_for_missing_semicolon ($$.t); } - | ENUM '{' - { $2 = suspend_momentary (); - $$ = current_enum_type; - current_enum_type = start_enum (make_anon_name ()); } - enumlist maybecomma_warn '}' - { TYPE_VALUES (current_enum_type) = $4; - $$.t = finish_enum (current_enum_type); - $$.new_type_flag = 1; - current_enum_type = $3; - resume_momentary ((int) $1); - check_for_missing_semicolon ($$.t); } - | ENUM '{' '}' - { $$.t = finish_enum (start_enum (make_anon_name())); - $$.new_type_flag = 1; - check_for_missing_semicolon ($$.t); } - | ENUM identifier - { $$.t = xref_tag (enum_type_node, $2, 1); - $$.new_type_flag = 0; } - | ENUM complex_type_name - { $$.t = xref_tag (enum_type_node, $2, 1); - $$.new_type_flag = 0; } - | TYPENAME_KEYWORD typename_sub - { $$.t = $2; - $$.new_type_flag = 0; - if (!processing_template_decl) - cp_pedwarn ("using `typename' outside of template"); } - /* C++ extensions, merged with C to avoid shift/reduce conflicts */ - | class_head '{' - { $1.t = begin_class_definition ($1.t); } - opt.component_decl_list '}' maybe_attribute - { - int semi; - - if (yychar == YYEMPTY) - yychar = YYLEX; - semi = yychar == ';'; - - $$ = finish_class_definition ($1.t, $6, semi, - $1.new_type_flag); - } - pending_defargs - { - begin_inline_definitions (); - } - pending_inlines - { - finish_inline_definitions (); - $$.t = $7; - $$.new_type_flag = 1; - } - | class_head %prec EMPTY - { - if ($1.new_type_flag) - pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL ($1.t))); - $$.new_type_flag = 0; - if (TYPE_BINFO ($1.t) == NULL_TREE) - { - cp_error ("%T is not a class type", $1.t); - $$.t = error_mark_node; - } - else - { - $$.t = $1.t; - /* struct B: public A; is not accepted by the WP grammar. */ - if (TYPE_BINFO_BASETYPES ($$.t) && !TYPE_SIZE ($$.t) - && ! TYPE_BEING_DEFINED ($$.t)) - cp_error ("base clause without member specification for `%#T'", - $$.t); - } - } - ; - -maybecomma: - /* empty */ - | ',' - ; - -maybecomma_warn: - /* empty */ - | ',' - { if (pedantic && !in_system_header) - pedwarn ("comma at end of enumerator list"); } - ; - -aggr: - AGGR - | aggr SCSPEC - { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); } - | aggr TYPESPEC - { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); } - | aggr CV_QUALIFIER - { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); } - | aggr AGGR - { error ("no body nor ';' separates two class, struct or union declarations"); } - | aggr attributes - { $$ = build_decl_list ($2, $1); } - ; - -named_class_head_sans_basetype: - aggr identifier - { - current_aggr = $1; - $$ = $2; - } - ; - -named_class_head_sans_basetype_defn: - aggr identifier_defn %prec EMPTY - { current_aggr = $$; $$ = $2; } - | named_class_head_sans_basetype '{' - { yyungetc ('{', 1); } - | named_class_head_sans_basetype ':' - { yyungetc (':', 1); } - ; - -named_complex_class_head_sans_basetype: - aggr nested_name_specifier identifier - { - current_aggr = $1; - $$.t = handle_class_head ($1, $2, $3); - $$.new_type_flag = 1; - } - | aggr global_scope nested_name_specifier identifier - { - current_aggr = $1; - $$.t = handle_class_head ($1, $3, $4); - $$.new_type_flag = 1; - } - | aggr global_scope identifier - { - current_aggr = $1; - $$.t = handle_class_head ($1, NULL_TREE, $3); - $$.new_type_flag = 1; - } - | aggr apparent_template_type - { - current_aggr = $1; - $$.t = $2; - $$.new_type_flag = 0; - } - | aggr nested_name_specifier apparent_template_type - { - current_aggr = $1; - $$.t = $3; - if (CP_DECL_CONTEXT ($$.t)) - push_scope (CP_DECL_CONTEXT ($$.t)); - $$.new_type_flag = 1; - } - ; - -named_class_head: - named_class_head_sans_basetype %prec EMPTY - { - $$.t = xref_tag (current_aggr, $1, 1); - $$.new_type_flag = 0; - } - | named_class_head_sans_basetype_defn - { $$ = xref_tag (current_aggr, $1, 0); } - /* Class name is unqualified, so we look for base classes - in the current scope. */ - maybe_base_class_list %prec EMPTY - { - $$.t = $2; - $$.new_type_flag = 0; - if ($3) - xref_basetypes (current_aggr, $1, $2, $3); - } - | named_complex_class_head_sans_basetype - maybe_base_class_list - { - if ($1.t != error_mark_node) - { - $$.t = TREE_TYPE ($1.t); - $$.new_type_flag = $1.new_type_flag; - if (current_aggr == union_type_node - && TREE_CODE ($$.t) != UNION_TYPE) - cp_pedwarn ("`union' tag used in declaring `%#T'", - $$.t); - else if (TREE_CODE ($$.t) == UNION_TYPE - && current_aggr != union_type_node) - cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$); - else if (TREE_CODE ($$.t) == RECORD_TYPE) - /* We might be specializing a template with a different - class-key; deal. */ - CLASSTYPE_DECLARED_CLASS ($$.t) - = (current_aggr == class_type_node); - if ($2) - { - maybe_process_partial_specialization ($$.t); - xref_basetypes (current_aggr, $1.t, $$.t, $2); - } - } - } - ; - -unnamed_class_head: - aggr '{' - { $$ = xref_tag ($$, make_anon_name (), 0); - yyungetc ('{', 1); } - ; - -/* The tree output of this nonterminal a declarationf or the type - named. If NEW_TYPE_FLAG is set, then the name used in this - class-head was explicitly qualified, e.g.: `struct X::Y'. We have - already called push_scope for X. */ -class_head: - unnamed_class_head - { - $$.t = $1; - $$.new_type_flag = 0; - } - | named_class_head - ; - -maybe_base_class_list: - /* empty */ %prec EMPTY - { $$ = NULL_TREE; } - | ':' see_typename %prec EMPTY - { yyungetc(':', 1); $$ = NULL_TREE; } - | ':' see_typename base_class_list %prec EMPTY - { $$ = $3; } - ; - -base_class_list: - base_class - | base_class_list ',' see_typename base_class - { $$ = chainon ($$, $4); } - ; - -base_class: - base_class.1 - { $$ = finish_base_specifier (access_default_node, $1, - current_aggr - == signature_type_node); } - | base_class_access_list see_typename base_class.1 - { $$ = finish_base_specifier ($1, $3, - current_aggr - == signature_type_node); } - ; - -base_class.1: - typename_sub - { if ($$ != error_mark_node) $$ = TYPE_MAIN_DECL ($1); } - | nonnested_type - | SIGOF '(' expr ')' - { - if (current_aggr == signature_type_node) - { - if (IS_AGGR_TYPE (TREE_TYPE ($3))) - { - sorry ("`sigof' as base signature specifier"); - $$ = TREE_TYPE ($3); - } - else - { - error ("`sigof' applied to non-aggregate expression"); - $$ = error_mark_node; - } - } - else - { - error ("`sigof' in struct or class declaration"); - $$ = error_mark_node; - } - } - | SIGOF '(' type_id ')' - { - if (current_aggr == signature_type_node) - { - if (IS_AGGR_TYPE (groktypename ($3.t))) - { - sorry ("`sigof' as base signature specifier"); - $$ = groktypename ($3.t); - } - else - { - error ("`sigof' applied to non-aggregate expression"); - $$ = error_mark_node; - } - } - else - { - error ("`sigof' in struct or class declaration"); - $$ = error_mark_node; - } - } - ; - -base_class_access_list: - VISSPEC see_typename - | SCSPEC see_typename - { if ($1 != ridpointers[(int)RID_VIRTUAL]) - cp_error ("`%D' access", $1); - $$ = access_default_virtual_node; } - | base_class_access_list VISSPEC see_typename - { - if ($1 != access_default_virtual_node) - error ("multiple access specifiers"); - else if ($2 == access_public_node) - $$ = access_public_virtual_node; - else if ($2 == access_protected_node) - $$ = access_protected_virtual_node; - else /* $2 == access_private_node */ - $$ = access_private_virtual_node; - } - | base_class_access_list SCSPEC see_typename - { if ($2 != ridpointers[(int)RID_VIRTUAL]) - cp_error ("`%D' access", $2); - else if ($$ == access_public_node) - $$ = access_public_virtual_node; - else if ($$ == access_protected_node) - $$ = access_protected_virtual_node; - else if ($$ == access_private_node) - $$ = access_private_virtual_node; - else - error ("multiple `virtual' specifiers"); - } - ; - -opt.component_decl_list: - | component_decl_list - | opt.component_decl_list access_specifier component_decl_list - | opt.component_decl_list access_specifier - ; - -access_specifier: - VISSPEC ':' - { - if (current_aggr == signature_type_node) - { - error ("access specifier not allowed in signature"); - $1 = access_public_node; - } - - current_access_specifier = $1; - } - ; - -/* Note: we no longer warn about the semicolon after a component_decl_list. - ARM $9.2 says that the semicolon is optional, and therefore allowed. */ -component_decl_list: - component_decl - { - finish_member_declaration ($1); - } - | component_decl_list component_decl - { - finish_member_declaration ($2); - } - ; - -component_decl: - component_decl_1 ';' - | component_decl_1 '}' - { error ("missing ';' before right brace"); - yyungetc ('}', 0); } - /* C++: handle constructors, destructors and inline functions */ - /* note that INLINE is like a TYPESPEC */ - | fn.def2 ':' /* base_init compstmt */ - { $$ = finish_method ($$); } - | fn.def2 TRY /* base_init compstmt */ - { $$ = finish_method ($$); } - | fn.def2 RETURN_KEYWORD /* base_init compstmt */ - { $$ = finish_method ($$); } - | fn.def2 '{' /* nodecls compstmt */ - { $$ = finish_method ($$); } - | ';' - { $$ = NULL_TREE; } - | extension component_decl - { $$ = $2; - pedantic = $1; } - | template_header component_decl - { - if ($2) - $$ = finish_member_template_decl ($2); - else - /* The component was already processed. */ - $$ = NULL_TREE; - - finish_template_decl ($1); - } - | template_header typed_declspecs ';' - { - $$ = finish_member_class_template ($2.t); - finish_template_decl ($1); - } - ; - -component_decl_1: - /* Do not add a "typed_declspecs declarator" rule here for - speed; we need to call grok_x_components for enums, so the - speedup would be insignificant. */ - typed_declspecs components - { - /* Most of the productions for component_decl only - allow the creation of one new member, so we call - finish_member_declaration in component_decl_list. - For this rule and the next, however, there can be - more than one member, e.g.: - - int i, j; - - and we need the first member to be fully - registered before the second is processed. - Therefore, the rules for components take care of - this processing. To avoid registering the - components more than once, we send NULL_TREE up - here; that lets finish_member_declaration know - that there is nothing to do. */ - if (!$2) - grok_x_components ($1.t); - $$ = NULL_TREE; - } - | declmods notype_components - { - if (!$2) - grok_x_components ($1); - $$ = NULL_TREE; - } - | notype_declarator maybeasm maybe_attribute maybe_init - { $$ = grokfield ($$, NULL_TREE, $4, $2, - build_tree_list ($3, NULL_TREE)); } - | constructor_declarator maybeasm maybe_attribute maybe_init - { $$ = grokfield ($$, NULL_TREE, $4, $2, - build_tree_list ($3, NULL_TREE)); } - | ':' expr_no_commas - { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); } - | error - { $$ = NULL_TREE; } - - /* These rules introduce a reduce/reduce conflict; in - typedef int foo, bar; - class A { - foo (bar); - }; - should "A::foo" be declared as a function or "A::bar" as a data - member? In other words, is "bar" an after_type_declarator or a - parmlist? */ - | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init - { tree specs, attrs; - split_specs_attrs ($1, &specs, &attrs); - $$ = grokfield ($2, specs, $5, $3, - build_tree_list ($4, attrs)); } - | component_constructor_declarator maybeasm maybe_attribute maybe_init - { $$ = grokfield ($$, NULL_TREE, $4, $2, - build_tree_list ($3, NULL_TREE)); } - | using_decl - { $$ = do_class_using_decl ($1); } - -/* The case of exactly one component is handled directly by component_decl. */ -/* ??? Huh? ^^^ */ -components: - /* empty: possibly anonymous */ - { $$ = 0; } - | component_declarator0 - { - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - $1 = finish_member_template_decl ($1); - finish_member_declaration ($1); - $$ = 1; - } - | components ',' component_declarator - { - check_multiple_declarators (); - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - $3 = finish_member_template_decl ($3); - finish_member_declaration ($3); - $$ = 2; - } - ; - -notype_components: - /* empty: possibly anonymous */ - { $$ = 0; } - | notype_component_declarator0 - { - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - $1 = finish_member_template_decl ($1); - finish_member_declaration ($1); - $$ = 1; - } - | notype_components ',' notype_component_declarator - { - check_multiple_declarators (); - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - $3 = finish_member_template_decl ($3); - finish_member_declaration ($3); - $$ = 2; - } - ; - -component_declarator0: - after_type_component_declarator0 - | notype_component_declarator0 - ; - -component_declarator: - after_type_component_declarator - | notype_component_declarator - ; - -after_type_component_declarator0: - after_type_declarator maybeasm maybe_attribute maybe_init - { split_specs_attrs ($0, ¤t_declspecs, - &prefix_attributes); - $0 = current_declspecs; - $$ = grokfield ($$, current_declspecs, $4, $2, - build_tree_list ($3, prefix_attributes)); } - | TYPENAME ':' expr_no_commas maybe_attribute - { split_specs_attrs ($0, ¤t_declspecs, - &prefix_attributes); - $0 = current_declspecs; - $$ = grokbitfield ($$, current_declspecs, $3); - cplus_decl_attributes ($$, $4, prefix_attributes); } - ; - -notype_component_declarator0: - notype_declarator maybeasm maybe_attribute maybe_init - { split_specs_attrs ($0, ¤t_declspecs, - &prefix_attributes); - $0 = current_declspecs; - $$ = grokfield ($$, current_declspecs, $4, $2, - build_tree_list ($3, prefix_attributes)); } - | constructor_declarator maybeasm maybe_attribute maybe_init - { split_specs_attrs ($0, ¤t_declspecs, - &prefix_attributes); - $0 = current_declspecs; - $$ = grokfield ($$, current_declspecs, $4, $2, - build_tree_list ($3, prefix_attributes)); } - | IDENTIFIER ':' expr_no_commas maybe_attribute - { split_specs_attrs ($0, ¤t_declspecs, - &prefix_attributes); - $0 = current_declspecs; - $$ = grokbitfield ($$, current_declspecs, $3); - cplus_decl_attributes ($$, $4, prefix_attributes); } - | ':' expr_no_commas maybe_attribute - { split_specs_attrs ($0, ¤t_declspecs, - &prefix_attributes); - $0 = current_declspecs; - $$ = grokbitfield (NULL_TREE, current_declspecs, $2); - cplus_decl_attributes ($$, $3, prefix_attributes); } - ; - -after_type_component_declarator: - after_type_declarator maybeasm maybe_attribute maybe_init - { $$ = grokfield ($$, current_declspecs, $4, $2, - build_tree_list ($3, prefix_attributes)); } - | TYPENAME ':' expr_no_commas maybe_attribute - { $$ = grokbitfield ($$, current_declspecs, $3); - cplus_decl_attributes ($$, $4, prefix_attributes); } - ; - -notype_component_declarator: - notype_declarator maybeasm maybe_attribute maybe_init - { $$ = grokfield ($$, current_declspecs, $4, $2, - build_tree_list ($3, prefix_attributes)); } - | IDENTIFIER ':' expr_no_commas maybe_attribute - { $$ = grokbitfield ($$, current_declspecs, $3); - cplus_decl_attributes ($$, $4, prefix_attributes); } - | ':' expr_no_commas maybe_attribute - { $$ = grokbitfield (NULL_TREE, current_declspecs, $2); - cplus_decl_attributes ($$, $3, prefix_attributes); } - ; - -/* We chain the enumerators in reverse order. - Because of the way enums are built, the order is - insignificant. Take advantage of this fact. */ - -enumlist: - enumerator - | enumlist ',' enumerator - { TREE_CHAIN ($3) = $$; $$ = $3; } - ; - -enumerator: - identifier - { $$ = build_enumerator ($$, NULL_TREE, current_enum_type); } - | identifier '=' expr_no_commas - { $$ = build_enumerator ($$, $3, current_enum_type); } - ; - -/* ANSI new-type-id (5.3.4) */ -new_type_id: - type_specifier_seq new_declarator - { $$.t = build_decl_list ($1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | type_specifier_seq %prec EMPTY - { $$.t = build_decl_list ($1.t, NULL_TREE); - $$.new_type_flag = $1.new_type_flag; } - /* GNU extension to allow arrays of arbitrary types with - non-constant dimension. For the use of begin_new_placement - here, see the comments in unary_expr above. */ - | '(' .begin_new_placement type_id .finish_new_placement - '[' expr ']' - { - if (pedantic) - pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new"); - $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($3.t), $6); - $$.t = build_decl_list (TREE_PURPOSE ($3.t), $$.t); - $$.new_type_flag = $3.new_type_flag; - } - ; - -cv_qualifiers: - /* empty */ %prec EMPTY - { $$ = NULL_TREE; } - | cv_qualifiers CV_QUALIFIER - { $$ = decl_tree_cons (NULL_TREE, $2, $$); } - ; - -nonempty_cv_qualifiers: - CV_QUALIFIER - { $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE); - $$.new_type_flag = 0; } - | nonempty_cv_qualifiers CV_QUALIFIER - { $$.t = hash_tree_cons (NULL_TREE, $2, $1.t); - $$.new_type_flag = $1.new_type_flag; } - ; - -/* These rules must follow the rules for function declarations - and component declarations. That way, longer rules are preferred. */ - -suspend_mom: - /* empty */ - { $$ = suspend_momentary (); } - -/* An expression which will not live on the momentary obstack. */ -nonmomentary_expr: - suspend_mom expr - { resume_momentary ((int) $1); $$ = $2; } - ; - -/* An expression which will not live on the momentary obstack. */ -maybe_parmlist: - suspend_mom '(' nonnull_exprlist ')' - { resume_momentary ((int) $1); $$ = $3; } - | suspend_mom '(' parmlist ')' - { resume_momentary ((int) $1); $$ = $3; } - | suspend_mom LEFT_RIGHT - { resume_momentary ((int) $1); $$ = empty_parms (); } - | suspend_mom '(' error ')' - { resume_momentary ((int) $1); $$ = NULL_TREE; } - ; - -/* A declarator that is allowed only after an explicit typespec. */ - -after_type_declarator_intern: - after_type_declarator - | attributes after_type_declarator - { - /* Provide support for '(' attributes '*' declarator ')' - etc */ - $$ = decl_tree_cons ($1, $2, NULL_TREE); - } - ; - -/* may all be followed by prec '.' */ -after_type_declarator: - '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY - { $$ = make_pointer_declarator ($2.t, $3); } - | '&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY - { $$ = make_reference_declarator ($2.t, $3); } - | '*' after_type_declarator_intern %prec UNARY - { $$ = make_pointer_declarator (NULL_TREE, $2); } - | '&' after_type_declarator_intern %prec UNARY - { $$ = make_reference_declarator (NULL_TREE, $2); } - | ptr_to_mem cv_qualifiers after_type_declarator_intern - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_parse_node (SCOPE_REF, $1, arg); - } - | direct_after_type_declarator - ; - -direct_after_type_declarator: - direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator ($$, $2, $3, $4); } - | direct_after_type_declarator '[' nonmomentary_expr ']' - { $$ = build_parse_node (ARRAY_REF, $$, $3); } - | direct_after_type_declarator '[' ']' - { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); } - | '(' after_type_declarator_intern ')' - { $$ = $2; } - | nested_name_specifier type_name %prec EMPTY - { push_nested_class ($1, 3); - $$ = build_parse_node (SCOPE_REF, $$, $2); - TREE_COMPLEXITY ($$) = current_class_depth; } - | type_name %prec EMPTY - ; - -nonnested_type: - type_name %prec EMPTY - { - if (TREE_CODE ($1) == IDENTIFIER_NODE) - { - $$ = lookup_name ($1, 1); - maybe_note_name_used_in_class ($1, $$); - } - else - $$ = $1; - } - | global_scope type_name - { - if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = IDENTIFIER_GLOBAL_VALUE ($2); - else - $$ = $2; - got_scope = NULL_TREE; - } - ; - -complete_type_name: - nonnested_type - | nested_type - | global_scope nested_type - { $$ = $2; } - ; - -nested_type: - nested_name_specifier type_name %prec EMPTY - { $$ = get_type_decl ($2); } - ; - -/* A declarator allowed whether or not there has been - an explicit typespec. These cannot redeclare a typedef-name. */ - -notype_declarator_intern: - notype_declarator - | attributes notype_declarator - { - /* Provide support for '(' attributes '*' declarator ')' - etc */ - $$ = decl_tree_cons ($1, $2, NULL_TREE); - } - ; - -notype_declarator: - '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY - { $$ = make_pointer_declarator ($2.t, $3); } - | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY - { $$ = make_reference_declarator ($2.t, $3); } - | '*' notype_declarator_intern %prec UNARY - { $$ = make_pointer_declarator (NULL_TREE, $2); } - | '&' notype_declarator_intern %prec UNARY - { $$ = make_reference_declarator (NULL_TREE, $2); } - | ptr_to_mem cv_qualifiers notype_declarator_intern - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_parse_node (SCOPE_REF, $1, arg); - } - | direct_notype_declarator - ; - -complex_notype_declarator: - '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY - { $$ = make_pointer_declarator ($2.t, $3); } - | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY - { $$ = make_reference_declarator ($2.t, $3); } - | '*' complex_notype_declarator %prec UNARY - { $$ = make_pointer_declarator (NULL_TREE, $2); } - | '&' complex_notype_declarator %prec UNARY - { $$ = make_reference_declarator (NULL_TREE, $2); } - | ptr_to_mem cv_qualifiers notype_declarator_intern - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_parse_node (SCOPE_REF, $1, arg); - } - | complex_direct_notype_declarator - ; - -complex_direct_notype_declarator: - direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator ($$, $2, $3, $4); } - | '(' complex_notype_declarator ')' - { $$ = $2; } - | direct_notype_declarator '[' nonmomentary_expr ']' - { $$ = build_parse_node (ARRAY_REF, $$, $3); } - | direct_notype_declarator '[' ']' - { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); } - | notype_qualified_id - { enter_scope_of ($1); } - | nested_name_specifier notype_template_declarator - { got_scope = NULL_TREE; - $$ = build_parse_node (SCOPE_REF, $1, $2); - enter_scope_of ($$); - } - ; - -qualified_id: - nested_name_specifier unqualified_id - { got_scope = NULL_TREE; - $$ = build_parse_node (SCOPE_REF, $$, $2); } - | nested_name_specifier object_template_id - { got_scope = NULL_TREE; - $$ = build_parse_node (SCOPE_REF, $1, $2); } - ; - -notype_qualified_id: - nested_name_specifier notype_unqualified_id - { got_scope = NULL_TREE; - $$ = build_parse_node (SCOPE_REF, $$, $2); } - | nested_name_specifier object_template_id - { got_scope = NULL_TREE; - $$ = build_parse_node (SCOPE_REF, $1, $2); } - ; - -overqualified_id: - notype_qualified_id - | global_scope notype_qualified_id - { $$ = $2; } - ; - -functional_cast: - typespec '(' nonnull_exprlist ')' - { $$ = build_functional_cast ($1.t, $3); } - | typespec '(' expr_or_declarator_intern ')' - { $$ = reparse_decl_as_expr ($1.t, $3); } - | typespec fcast_or_absdcl %prec EMPTY - { $$ = reparse_absdcl_as_expr ($1.t, $2); } - ; -type_name: - TYPENAME - | SELFNAME - | template_type %prec EMPTY - ; - -nested_name_specifier: - nested_name_specifier_1 - | nested_name_specifier nested_name_specifier_1 - { $$ = $2; } - | nested_name_specifier TEMPLATE explicit_template_type SCOPE - { got_scope = $$ = make_typename_type ($1, $3); } - ; - -/* Why the @#$%^& do type_name and notype_identifier need to be expanded - inline here?!? (jason) */ -nested_name_specifier_1: - TYPENAME SCOPE - { - if (TREE_CODE ($1) == IDENTIFIER_NODE) - { - $$ = lastiddecl; - maybe_note_name_used_in_class ($1, $$); - } - got_scope = $$ = - complete_type (TYPE_MAIN_VARIANT (TREE_TYPE ($$))); - } - | SELFNAME SCOPE - { - if (TREE_CODE ($1) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$ = TREE_TYPE ($$); - } - | NSNAME SCOPE - { - if (TREE_CODE ($$) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$; - } - | template_type SCOPE - { got_scope = $$ = complete_type (TREE_TYPE ($1)); } -/* These break 'const i;' - | IDENTIFIER SCOPE - { - failed_scope: - cp_error ("`%D' is not an aggregate typedef", - lastiddecl ? lastiddecl : $$); - $$ = error_mark_node; - } - | PTYPENAME SCOPE - { goto failed_scope; } */ - ; - -typename_sub: - typename_sub0 - | global_scope typename_sub0 - { $$ = $2; } - ; - -typename_sub0: - typename_sub1 identifier %prec EMPTY - { - if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't') - $$ = make_typename_type ($1, $2); - else if (TREE_CODE ($2) == IDENTIFIER_NODE) - cp_error ("`%T' is not a class or namespace", $2); - else - { - $$ = $2; - if (TREE_CODE ($$) == TYPE_DECL) - $$ = TREE_TYPE ($$); - } - } - | typename_sub1 template_type %prec EMPTY - { $$ = TREE_TYPE ($2); } - | typename_sub1 explicit_template_type %prec EMPTY - { $$ = make_typename_type ($1, $2); } - | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY - { $$ = make_typename_type ($1, $3); } - ; - -typename_sub1: - typename_sub2 - { - if (TREE_CODE ($1) == IDENTIFIER_NODE) - cp_error ("`%T' is not a class or namespace", $1); - } - | typename_sub1 typename_sub2 - { - if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't') - $$ = make_typename_type ($1, $2); - else if (TREE_CODE ($2) == IDENTIFIER_NODE) - cp_error ("`%T' is not a class or namespace", $2); - else - { - $$ = $2; - if (TREE_CODE ($$) == TYPE_DECL) - $$ = TREE_TYPE ($$); - } - } - | typename_sub1 explicit_template_type SCOPE - { got_scope = $$ = make_typename_type ($1, $2); } - | typename_sub1 TEMPLATE explicit_template_type SCOPE - { got_scope = $$ = make_typename_type ($1, $3); } - ; - -typename_sub2: - TYPENAME SCOPE - { - if (TREE_CODE ($1) != IDENTIFIER_NODE) - $1 = lastiddecl; - - /* Retrieve the type for the identifier, which might involve - some computation. */ - got_scope = $$ = complete_type (IDENTIFIER_TYPE_VALUE ($1)); - - if ($$ == error_mark_node) - cp_error ("`%T' is not a class or namespace", $1); - } - | SELFNAME SCOPE - { - if (TREE_CODE ($1) != IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$ = complete_type (TREE_TYPE ($$)); - } - | template_type SCOPE - { got_scope = $$ = complete_type (TREE_TYPE ($$)); } - | PTYPENAME SCOPE - | IDENTIFIER SCOPE - | NSNAME SCOPE - { - if (TREE_CODE ($$) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$; - } - ; - -explicit_template_type: - identifier '<' template_arg_list_opt template_close_bracket - { $$ = build_min_nt (TEMPLATE_ID_EXPR, $1, $3); } - ; - -complex_type_name: - global_scope type_name - { - if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = IDENTIFIER_GLOBAL_VALUE ($2); - else - $$ = $2; - got_scope = NULL_TREE; - } - | nested_type - | global_scope nested_type - { $$ = $2; } - ; - -ptr_to_mem: - nested_name_specifier '*' - { got_scope = NULL_TREE; } - | global_scope nested_name_specifier '*' - { $$ = $2; got_scope = NULL_TREE; } - ; - -/* All uses of explicit global scope must go through this nonterminal so - that got_scope will be set before yylex is called to get the next token. */ -global_scope: - SCOPE - { got_scope = void_type_node; } - ; - -/* ANSI new-declarator (5.3.4) */ -new_declarator: - '*' cv_qualifiers new_declarator - { $$ = make_pointer_declarator ($2, $3); } - | '*' cv_qualifiers %prec EMPTY - { $$ = make_pointer_declarator ($2, NULL_TREE); } - | '&' cv_qualifiers new_declarator %prec EMPTY - { $$ = make_reference_declarator ($2, $3); } - | '&' cv_qualifiers %prec EMPTY - { $$ = make_reference_declarator ($2, NULL_TREE); } - | ptr_to_mem cv_qualifiers %prec EMPTY - { tree arg = make_pointer_declarator ($2, NULL_TREE); - $$ = build_parse_node (SCOPE_REF, $1, arg); - } - | ptr_to_mem cv_qualifiers new_declarator - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_parse_node (SCOPE_REF, $1, arg); - } - | direct_new_declarator %prec EMPTY - ; - -/* ANSI direct-new-declarator (5.3.4) */ -direct_new_declarator: - '[' expr ']' - { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); } - | direct_new_declarator '[' nonmomentary_expr ']' - { $$ = build_parse_node (ARRAY_REF, $$, $3); } - ; - -absdcl_intern: - absdcl - | attributes absdcl - { - /* Provide support for '(' attributes '*' declarator ')' - etc */ - $$ = decl_tree_cons ($1, $2, NULL_TREE); - } - ; - -/* ANSI abstract-declarator (8.1) */ -absdcl: - '*' nonempty_cv_qualifiers absdcl_intern - { $$ = make_pointer_declarator ($2.t, $3); } - | '*' absdcl_intern - { $$ = make_pointer_declarator (NULL_TREE, $2); } - | '*' nonempty_cv_qualifiers %prec EMPTY - { $$ = make_pointer_declarator ($2.t, NULL_TREE); } - | '*' %prec EMPTY - { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); } - | '&' nonempty_cv_qualifiers absdcl_intern - { $$ = make_reference_declarator ($2.t, $3); } - | '&' absdcl_intern - { $$ = make_reference_declarator (NULL_TREE, $2); } - | '&' nonempty_cv_qualifiers %prec EMPTY - { $$ = make_reference_declarator ($2.t, NULL_TREE); } - | '&' %prec EMPTY - { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); } - | ptr_to_mem cv_qualifiers %prec EMPTY - { tree arg = make_pointer_declarator ($2, NULL_TREE); - $$ = build_parse_node (SCOPE_REF, $1, arg); - } - | ptr_to_mem cv_qualifiers absdcl_intern - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_parse_node (SCOPE_REF, $1, arg); - } - | direct_abstract_declarator %prec EMPTY - ; - -/* ANSI direct-abstract-declarator (8.1) */ -direct_abstract_declarator: - '(' absdcl_intern ')' - { $$ = $2; } - /* `(typedef)1' is `int'. */ - | PAREN_STAR_PAREN - | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator ($$, $3, $5, $6); } - | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator ($$, empty_parms (), $3, $4); } - | direct_abstract_declarator '[' nonmomentary_expr ']' %prec '.' - { $$ = build_parse_node (ARRAY_REF, $$, $3); } - | direct_abstract_declarator '[' ']' %prec '.' - { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); } - | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); } - | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.' - { set_quals_and_spec ($$, $2, $3); } - | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.' - { set_quals_and_spec ($$, $2, $3); } - | '[' nonmomentary_expr ']' %prec '.' - { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); } - | '[' ']' %prec '.' - { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); } - ; - -/* For C++, decls and stmts can be intermixed, so we don't need to - have a special rule that won't start parsing the stmt section - until we have a stmt that parses without errors. */ - -stmts: - stmt - | errstmt - | stmts stmt - | stmts errstmt - ; - -errstmt: - error ';' - ; - -/* Read zero or more forward-declarations for labels - that nested functions can jump to. */ -maybe_label_decls: - /* empty */ - | label_decls - { if (pedantic) - pedwarn ("ANSI C++ forbids label declarations"); } - ; - -label_decls: - label_decl - | label_decls label_decl - ; - -label_decl: - LABEL identifiers_or_typenames ';' - { tree link; - for (link = $2; link; link = TREE_CHAIN (link)) - { - tree label = shadow_label (TREE_VALUE (link)); - C_DECLARED_LABEL_FLAG (label) = 1; - declare_nonlocal_label (label); - } - } - ; - -/* This is the body of a function definition. - It causes syntax errors to ignore to the next openbrace. */ -compstmt_or_error: - compstmt - {} - | error compstmt - ; - -compstmt: - '{' - { $$ = begin_compound_stmt (0); } - compstmtend - { $$ = finish_compound_stmt (0, $2); } - ; - -simple_if: - IF - { - $$ = begin_if_stmt (); - cond_stmt_keyword = "if"; - } - paren_cond_or_null - { finish_if_stmt_cond ($3, $2); } - implicitly_scoped_stmt - { $$ = finish_then_clause ($2); } - ; - -implicitly_scoped_stmt: - compstmt - | { $$ = begin_compound_stmt (0); } - simple_stmt - { $$ = finish_compound_stmt (0, $1); } - ; - -stmt: - compstmt - {} - | simple_stmt - ; - -simple_stmt: - decl - { finish_stmt (); } - | expr ';' - { finish_expr_stmt ($1); } - | simple_if ELSE - { begin_else_clause (); } - implicitly_scoped_stmt - { - finish_else_clause ($1); - finish_if_stmt (); - } - | simple_if %prec IF - { finish_if_stmt (); } - | WHILE - { - $$ = begin_while_stmt (); - cond_stmt_keyword = "while"; - } - paren_cond_or_null - { finish_while_stmt_cond ($3, $2); } - already_scoped_stmt - { finish_while_stmt ($2); } - | DO - { $$ = begin_do_stmt (); } - implicitly_scoped_stmt WHILE - { - finish_do_body ($2); - cond_stmt_keyword = "do"; - } - paren_expr_or_null ';' - { finish_do_stmt ($6, $2); } - | FOR - { $$ = begin_for_stmt (); } - '(' for.init.statement - { finish_for_init_stmt ($2); } - xcond ';' - { finish_for_cond ($6, $2); } - xexpr ')' - { finish_for_expr ($9, $2); } - already_scoped_stmt - { finish_for_stmt ($9, $2); } - | SWITCH - { begin_switch_stmt (); } - '(' condition ')' - { $$ = finish_switch_cond ($4); } - implicitly_scoped_stmt - { finish_switch_stmt ($4, $6); } - | CASE expr_no_commas ':' - { finish_case_label ($2, NULL_TREE); } - stmt - | CASE expr_no_commas ELLIPSIS expr_no_commas ':' - { finish_case_label ($2, $4); } - stmt - | DEFAULT ':' - { finish_case_label (NULL_TREE, NULL_TREE); } - stmt - | BREAK ';' - { finish_break_stmt (); } - | CONTINUE ';' - { finish_continue_stmt (); } - | RETURN_KEYWORD ';' - { finish_return_stmt (NULL_TREE); } - | RETURN_KEYWORD expr ';' - { finish_return_stmt ($2); } - | asm_keyword maybe_cv_qualifier '(' string ')' ';' - { - finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE, - NULL_TREE); - } - /* This is the case with just output operands. */ - | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';' - { - finish_asm_stmt ($2, $4, $6, NULL_TREE, - NULL_TREE); - } - /* This is the case with input operands as well. */ - | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';' - { finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); } - /* This is the case with clobbered registers as well. */ - | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' - asm_operands ':' asm_clobbers ')' ';' - { finish_asm_stmt ($2, $4, $6, $8, $10); } - | GOTO '*' expr ';' - { - if (pedantic) - pedwarn ("ANSI C++ forbids computed gotos"); - finish_goto_stmt ($3); - } - | GOTO identifier ';' - { finish_goto_stmt ($2); } - | label_colon stmt - { finish_stmt (); } - | label_colon '}' - { error ("label must be followed by statement"); - yyungetc ('}', 0); - finish_stmt (); } - | ';' - { finish_stmt (); } - | try_block - | using_directive - | namespace_using_decl - { do_local_using_decl ($1); } - | namespace_alias - ; - -function_try_block: - TRY - { - if (! current_function_parms_stored) - store_parm_decls (); - expand_start_early_try_stmts (); - } - ctor_initializer_opt compstmt - { - end_protect_partials (); - expand_start_all_catch (); - } - handler_seq - { - expand_end_all_catch (); - $$ = $3; - } - ; - -try_block: - TRY - { $$ = begin_try_block (); } - compstmt - { finish_try_block ($2); } - handler_seq - { finish_handler_sequence ($2); } - ; - -handler_seq: - handler - | handler_seq handler - ; - -handler: - CATCH - { $$ = begin_handler(); } - handler_args - { finish_handler_parms ($2); } - compstmt - { finish_handler ($2); } - ; - -type_specifier_seq: - typed_typespecs %prec EMPTY - | nonempty_cv_qualifiers %prec EMPTY - ; - -handler_args: - '(' ELLIPSIS ')' - { expand_start_catch_block (NULL_TREE, NULL_TREE); } - /* This doesn't allow reference parameters, the below does. - | '(' type_specifier_seq absdcl ')' - { check_for_new_type ("inside exception declarations", $2); - expand_start_catch_block ($2.t, $3); } - | '(' type_specifier_seq ')' - { check_for_new_type ("inside exception declarations", $2); - expand_start_catch_block ($2.t, NULL_TREE); } - | '(' type_specifier_seq notype_declarator ')' - { check_for_new_type ("inside exception declarations", $2); - expand_start_catch_block ($2.t, $3); } - | '(' typed_typespecs after_type_declarator ')' - { check_for_new_type ("inside exception declarations", $2); - expand_start_catch_block ($2.t, $3); } - This allows reference parameters... */ - | '(' parm ')' - { check_for_new_type ("inside exception declarations", $2); - expand_start_catch_block (TREE_PURPOSE ($2.t), - TREE_VALUE ($2.t)); } - ; - -label_colon: - IDENTIFIER ':' - { tree label; - do_label: - label = define_label (input_filename, lineno, $1); - if (label && ! minimal_parse_mode) - expand_label (label); - } - | PTYPENAME ':' - { goto do_label; } - | TYPENAME ':' - { goto do_label; } - | SELFNAME ':' - { goto do_label; } - ; - -for.init.statement: - xexpr ';' - { if ($1) cplus_expand_expr_stmt ($1); } - | decl - | '{' compstmtend - { if (pedantic) - pedwarn ("ANSI C++ forbids compound statements inside for initializations"); - } - ; - -/* Either a type-qualifier or nothing. First thing in an `asm' statement. */ - -maybe_cv_qualifier: - /* empty */ - { emit_line_note (input_filename, lineno); - $$ = NULL_TREE; } - | CV_QUALIFIER - { emit_line_note (input_filename, lineno); } - ; - -xexpr: - /* empty */ - { $$ = NULL_TREE; } - | expr - | error - { $$ = NULL_TREE; } - ; - -/* These are the operands other than the first string and colon - in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */ -asm_operands: - /* empty */ - { $$ = NULL_TREE; } - | nonnull_asm_operands - ; - -nonnull_asm_operands: - asm_operand - | nonnull_asm_operands ',' asm_operand - { $$ = chainon ($$, $3); } - ; - -asm_operand: - STRING '(' expr ')' - { $$ = build_tree_list ($$, $3); } - ; - -asm_clobbers: - STRING - { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); } - | asm_clobbers ',' STRING - { $$ = tree_cons (NULL_TREE, $3, $$); } - ; - -/* This is what appears inside the parens in a function declarator. - Its value is represented in the format that grokdeclarator expects. - - In C++, declaring a function with no parameters - means that that function takes *no* parameters. */ - -parmlist: - /* empty */ - { - $$ = empty_parms(); - } - | complex_parmlist - | type_id - { $$ = finish_parmlist (build_tree_list (NULL_TREE, $1.t), 0); - check_for_new_type ("inside parameter list", $1); } - ; - -/* This nonterminal does not include the common sequence '(' type_id ')', - as it is ambiguous and must be disambiguated elsewhere. */ -complex_parmlist: - parms - { $$ = finish_parmlist ($$, 0); } - | parms_comma ELLIPSIS - { $$ = finish_parmlist ($1, 1); } - /* C++ allows an ellipsis without a separating ',' */ - | parms ELLIPSIS - { $$ = finish_parmlist ($1, 1); } - | type_id ELLIPSIS - { $$ = finish_parmlist (build_tree_list (NULL_TREE, - $1.t), 1); } - | ELLIPSIS - { $$ = finish_parmlist (NULL_TREE, 1); } - | parms ':' - { - /* This helps us recover from really nasty - parse errors, for example, a missing right - parenthesis. */ - yyerror ("possibly missing ')'"); - $$ = finish_parmlist ($1, 0); - yyungetc (':', 0); - yychar = ')'; - } - | type_id ':' - { - /* This helps us recover from really nasty - parse errors, for example, a missing right - parenthesis. */ - yyerror ("possibly missing ')'"); - $$ = finish_parmlist (build_tree_list (NULL_TREE, - $1.t), 0); - yyungetc (':', 0); - yychar = ')'; - } - ; - -/* A default argument to a */ -defarg: - '=' - { maybe_snarf_defarg (); } - defarg1 - { $$ = $3; } - ; - -defarg1: - DEFARG - | init - ; - -/* A nonempty list of parameter declarations or type names. */ -parms: - named_parm - { check_for_new_type ("in a parameter list", $1); - $$ = build_tree_list (NULL_TREE, $1.t); } - | parm defarg - { check_for_new_type ("in a parameter list", $1); - $$ = build_tree_list ($2, $1.t); } - | parms_comma full_parm - { check_for_new_type ("in a parameter list", $2); - $$ = chainon ($$, $2.t); } - | parms_comma bad_parm - { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); } - | parms_comma bad_parm '=' init - { $$ = chainon ($$, build_tree_list ($4, $2)); } - ; - -parms_comma: - parms ',' - | type_id ',' - { check_for_new_type ("in a parameter list", $1); - $$ = build_tree_list (NULL_TREE, $1.t); } - ; - -/* A single parameter declaration or parameter type name, - as found in a parmlist. */ -named_parm: - /* Here we expand typed_declspecs inline to avoid mis-parsing of - TYPESPEC IDENTIFIER. */ - typed_declspecs1 declarator - { tree specs = strip_attrs ($1.t); - $$.new_type_flag = $1.new_type_flag; - $$.t = build_tree_list (specs, $2); } - | typed_typespecs declarator - { $$.t = build_tree_list ($1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | typespec declarator - { $$.t = build_tree_list (build_decl_list (NULL_TREE, $1.t), - $2); - $$.new_type_flag = $1.new_type_flag; } - | typed_declspecs1 absdcl - { tree specs = strip_attrs ($1.t); - $$.t = build_tree_list (specs, $2); - $$.new_type_flag = $1.new_type_flag; } - | typed_declspecs1 %prec EMPTY - { tree specs = strip_attrs ($1.t); - $$.t = build_tree_list (specs, NULL_TREE); - $$.new_type_flag = $1.new_type_flag; } - | declmods notype_declarator - { tree specs = strip_attrs ($1); - $$.t = build_tree_list (specs, $2); - $$.new_type_flag = 0; } - ; - -full_parm: - parm - { $$.t = build_tree_list (NULL_TREE, $1.t); - $$.new_type_flag = $1.new_type_flag; } - | parm defarg - { $$.t = build_tree_list ($2, $1.t); - $$.new_type_flag = $1.new_type_flag; } - ; - -parm: - named_parm - | type_id - ; - -see_typename: - /* empty */ %prec EMPTY - { see_typename (); } - ; - -bad_parm: - /* empty */ %prec EMPTY - { - error ("type specifier omitted for parameter"); - $$ = build_tree_list (integer_type_node, NULL_TREE); - } - | notype_declarator - { - error ("type specifier omitted for parameter"); - if (TREE_CODE ($$) == SCOPE_REF - && (TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM - || TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TEMPLATE_PARM)) - cp_error (" perhaps you want `typename %E' to make it a type", $$); - $$ = build_tree_list (integer_type_node, $$); - } - ; - -exception_specification_opt: - /* empty */ %prec EMPTY - { $$ = NULL_TREE; } - | THROW '(' ansi_raise_identifiers ')' %prec EMPTY - { $$ = $3; } - | THROW LEFT_RIGHT %prec EMPTY - { $$ = build_decl_list (NULL_TREE, NULL_TREE); } - ; - -ansi_raise_identifier: - type_id - { $$ = build_decl_list (NULL_TREE, groktypename($1.t)); } - ; - -ansi_raise_identifiers: - ansi_raise_identifier - | ansi_raise_identifiers ',' ansi_raise_identifier - { - TREE_CHAIN ($3) = $$; - $$ = $3; - } - ; - -conversion_declarator: - /* empty */ %prec EMPTY - { $$ = NULL_TREE; } - | '*' cv_qualifiers conversion_declarator - { $$ = make_pointer_declarator ($2, $3); } - | '&' cv_qualifiers conversion_declarator - { $$ = make_reference_declarator ($2, $3); } - | ptr_to_mem cv_qualifiers conversion_declarator - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_parse_node (SCOPE_REF, $1, arg); - } - ; - -operator: - OPERATOR - { got_scope = NULL_TREE; } - ; - -operator_name: - operator '*' - { $$ = ansi_opname[MULT_EXPR]; } - | operator '/' - { $$ = ansi_opname[TRUNC_DIV_EXPR]; } - | operator '%' - { $$ = ansi_opname[TRUNC_MOD_EXPR]; } - | operator '+' - { $$ = ansi_opname[PLUS_EXPR]; } - | operator '-' - { $$ = ansi_opname[MINUS_EXPR]; } - | operator '&' - { $$ = ansi_opname[BIT_AND_EXPR]; } - | operator '|' - { $$ = ansi_opname[BIT_IOR_EXPR]; } - | operator '^' - { $$ = ansi_opname[BIT_XOR_EXPR]; } - | operator '~' - { $$ = ansi_opname[BIT_NOT_EXPR]; } - | operator ',' - { $$ = ansi_opname[COMPOUND_EXPR]; } - | operator ARITHCOMPARE - { $$ = ansi_opname[$2]; } - | operator '<' - { $$ = ansi_opname[LT_EXPR]; } - | operator '>' - { $$ = ansi_opname[GT_EXPR]; } - | operator EQCOMPARE - { $$ = ansi_opname[$2]; } - | operator ASSIGN - { $$ = ansi_assopname[$2]; } - | operator '=' - { $$ = ansi_opname [MODIFY_EXPR]; } - | operator LSHIFT - { $$ = ansi_opname[$2]; } - | operator RSHIFT - { $$ = ansi_opname[$2]; } - | operator PLUSPLUS - { $$ = ansi_opname[POSTINCREMENT_EXPR]; } - | operator MINUSMINUS - { $$ = ansi_opname[PREDECREMENT_EXPR]; } - | operator ANDAND - { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; } - | operator OROR - { $$ = ansi_opname[TRUTH_ORIF_EXPR]; } - | operator '!' - { $$ = ansi_opname[TRUTH_NOT_EXPR]; } - | operator '?' ':' - { $$ = ansi_opname[COND_EXPR]; } - | operator MIN_MAX - { $$ = ansi_opname[$2]; } - | operator POINTSAT %prec EMPTY - { $$ = ansi_opname[COMPONENT_REF]; } - | operator POINTSAT_STAR %prec EMPTY - { $$ = ansi_opname[MEMBER_REF]; } - | operator LEFT_RIGHT - { $$ = ansi_opname[CALL_EXPR]; } - | operator '[' ']' - { $$ = ansi_opname[ARRAY_REF]; } - | operator NEW %prec EMPTY - { $$ = ansi_opname[NEW_EXPR]; } - | operator DELETE %prec EMPTY - { $$ = ansi_opname[DELETE_EXPR]; } - | operator NEW '[' ']' - { $$ = ansi_opname[VEC_NEW_EXPR]; } - | operator DELETE '[' ']' - { $$ = ansi_opname[VEC_DELETE_EXPR]; } - /* Names here should be looked up in class scope ALSO. */ - | operator type_specifier_seq conversion_declarator - { $$ = grokoptypename ($2.t, $3); } - | operator error - { $$ = ansi_opname[ERROR_MARK]; } - ; - -%% - -#ifdef SPEW_DEBUG -const char * -debug_yytranslate (value) - int value; -{ - return yytname[YYTRANSLATE (value)]; -} - -#endif diff --git a/contrib/gcc/cp/pt.c b/contrib/gcc/cp/pt.c deleted file mode 100644 index 28c295695e44..000000000000 --- a/contrib/gcc/cp/pt.c +++ /dev/null @@ -1,9876 +0,0 @@ -/* Handle parameterized types (templates) for GNU C++. - Copyright (C) 1992, 93-97, 1998, 1999 Free Software Foundation, Inc. - Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing. - Rewritten by Jason Merrill (jason@cygnus.com). - -This file is part of GNU CC. - -GNU CC 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. - -GNU CC 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. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Known bugs or deficiencies include: - - all methods must be provided in header files; can't use a source - file that contains only the method templates and "just win". */ - -#include "config.h" -#include "system.h" -#include "obstack.h" - -#include "tree.h" -#include "flags.h" -#include "cp-tree.h" -#include "decl.h" -#include "parse.h" -#include "lex.h" -#include "output.h" -#include "defaults.h" -#include "except.h" -#include "toplev.h" -#include "rtl.h" -#include "varray.h" - -/* The type of functions taking a tree, and some additional data, and - returning an int. */ -typedef int (*tree_fn_t) PROTO((tree, void*)); - -extern struct obstack permanent_obstack; - -extern int lineno; -extern char *input_filename; - -tree current_template_parms; -HOST_WIDE_INT processing_template_decl; - -/* The PENDING_TEMPLATES is a TREE_LIST of templates whose - instantiations have been deferred, either because their definitions - were not yet available, or because we were putting off doing the - work. The TREE_PURPOSE of each entry is a SRCLOC indicating where - the instantiate request occurred; the TREE_VALUE is a either a DECL - (for a function or static data member), or a TYPE (for a class) - indicating what we are hoping to instantiate. */ -static tree pending_templates; -static tree *template_tail = &pending_templates; - -static tree maybe_templates; -static tree *maybe_template_tail = &maybe_templates; - -int minimal_parse_mode; - -int processing_specialization; -int processing_explicit_instantiation; -int processing_template_parmlist; -static int template_header_count; - -static tree saved_trees; -static varray_type inline_parm_levels; -static size_t inline_parm_levels_used; - -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free - -#define UNIFY_ALLOW_NONE 0 -#define UNIFY_ALLOW_MORE_CV_QUAL 1 -#define UNIFY_ALLOW_LESS_CV_QUAL 2 -#define UNIFY_ALLOW_DERIVED 4 -#define UNIFY_ALLOW_INTEGER 8 - -#define GTB_VIA_VIRTUAL 1 /* The base class we are examining is - virtual, or a base class of a virtual - base. */ -#define GTB_IGNORE_TYPE 2 /* We don't need to try to unify the current - type with the desired type. */ - -static int resolve_overloaded_unification PROTO((tree, tree, tree, tree, - unification_kind_t, int)); -static int try_one_overload PROTO((tree, tree, tree, tree, tree, - unification_kind_t, int)); -static int unify PROTO((tree, tree, tree, tree, int)); -static void add_pending_template PROTO((tree)); -static int push_tinst_level PROTO((tree)); -static tree classtype_mangled_name PROTO((tree)); -static char *mangle_class_name_for_template PROTO((char *, tree, tree)); -static tree tsubst_expr_values PROTO((tree, tree)); -static int list_eq PROTO((tree, tree)); -static tree get_class_bindings PROTO((tree, tree, tree)); -static tree coerce_template_parms PROTO((tree, tree, tree, int, int)); -static void tsubst_enum PROTO((tree, tree, tree)); -static tree add_to_template_args PROTO((tree, tree)); -static tree add_outermost_template_args PROTO((tree, tree)); -static void maybe_adjust_types_for_deduction PROTO((unification_kind_t, tree*, - tree*)); -static int type_unification_real PROTO((tree, tree, tree, tree, - int, unification_kind_t, int)); -static void note_template_header PROTO((int)); -static tree maybe_fold_nontype_arg PROTO((tree)); -static tree convert_nontype_argument PROTO((tree, tree)); -static tree convert_template_argument PROTO ((tree, tree, tree, int, - int , tree)); -static tree get_bindings_overload PROTO((tree, tree, tree)); -static int for_each_template_parm PROTO((tree, tree_fn_t, void*)); -static tree build_template_parm_index PROTO((int, int, int, tree, tree)); -static int inline_needs_template_parms PROTO((tree)); -static void push_inline_template_parms_recursive PROTO((tree, int)); -static tree retrieve_specialization PROTO((tree, tree)); -static tree register_specialization PROTO((tree, tree, tree)); -static int unregister_specialization PROTO((tree, tree)); -static tree reduce_template_parm_level PROTO((tree, tree, int)); -static tree build_template_decl PROTO((tree, tree)); -static int mark_template_parm PROTO((tree, void *)); -static tree tsubst_friend_function PROTO((tree, tree)); -static tree tsubst_friend_class PROTO((tree, tree)); -static tree get_bindings_real PROTO((tree, tree, tree, int)); -static int template_decl_level PROTO((tree)); -static tree maybe_get_template_decl_from_type_decl PROTO((tree)); -static int check_cv_quals_for_unify PROTO((int, tree, tree)); -static tree tsubst_template_arg_vector PROTO((tree, tree, int)); -static tree tsubst_template_parms PROTO((tree, tree, int)); -static void regenerate_decl_from_template PROTO((tree, tree)); -static tree most_specialized PROTO((tree, tree, tree)); -static tree most_specialized_class PROTO((tree, tree)); -static tree most_general_template PROTO((tree)); -static void set_mangled_name_for_template_decl PROTO((tree)); -static int template_class_depth_real PROTO((tree, int)); -static tree tsubst_aggr_type PROTO((tree, tree, int, tree, int)); -static tree tsubst_decl PROTO((tree, tree, tree, tree)); -static tree tsubst_arg_types PROTO((tree, tree, int, tree)); -static tree tsubst_function_type PROTO((tree, tree, int, tree)); -static void check_specialization_scope PROTO((void)); -static tree process_partial_specialization PROTO((tree)); -static void set_current_access_from_decl PROTO((tree)); -static void check_default_tmpl_args PROTO((tree, tree, int, int)); -static tree tsubst_call_declarator_parms PROTO((tree, tree, int, tree)); -static tree get_template_base_recursive PROTO((tree, tree, - tree, tree, tree, int)); -static tree get_template_base PROTO((tree, tree, tree, tree)); -static tree try_class_unification PROTO((tree, tree, tree, tree)); -static int coerce_template_template_parms PROTO((tree, tree, int, - tree, tree)); -static tree determine_specialization PROTO((tree, tree, tree *, int)); -static int template_args_equal PROTO((tree, tree)); -static void print_template_context PROTO((int)); -static int has_pvbases_p PROTO((tree, tree)); - -/* We use TREE_VECs to hold template arguments. If there is only one - level of template arguments, then the TREE_VEC contains the - arguments directly. If there is more than one level of template - arguments, then each entry in the TREE_VEC is itself a TREE_VEC, - containing the template arguments for a single level. The first - entry in the outer TREE_VEC is the outermost level of template - parameters; the last is the innermost. - - It is incorrect to ever form a template argument vector containing - only one level of arguments, but which is a TREE_VEC containing as - its only entry the TREE_VEC for that level. */ - -/* Non-zero if the template arguments is actually a vector of vectors, - rather than just a vector. */ -#define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \ - (NODE != NULL_TREE \ - && TREE_CODE (NODE) == TREE_VEC \ - && TREE_VEC_LENGTH (NODE) > 0 \ - && TREE_VEC_ELT (NODE, 0) != NULL_TREE \ - && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC) - -/* The depth of a template argument vector. When called directly by - the parser, we use a TREE_LIST rather than a TREE_VEC to represent - template arguments. In fact, we may even see NULL_TREE if there - are no template arguments. In both of those cases, there is only - one level of template arguments. */ -#define TMPL_ARGS_DEPTH(NODE) \ - (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1) - -/* The LEVELth level of the template ARGS. Note that template - parameter levels are indexed from 1, not from 0. */ -#define TMPL_ARGS_LEVEL(ARGS, LEVEL) \ - (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \ - ? TREE_VEC_ELT ((ARGS), (LEVEL) - 1) : ARGS) - -/* Set the LEVELth level of the template ARGS to VAL. This macro does - not work with single-level argument vectors. */ -#define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \ - (TREE_VEC_ELT ((ARGS), (LEVEL) - 1) = (VAL)) - -/* Accesses the IDXth parameter in the LEVELth level of the ARGS. */ -#define TMPL_ARG(ARGS, LEVEL, IDX) \ - (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX)) - -/* Set the IDXth element in the LEVELth level of ARGS to VAL. This - macro does not work with single-level argument vectors. */ -#define SET_TMPL_ARG(ARGS, LEVEL, IDX, VAL) \ - (TREE_VEC_ELT (TREE_VEC_ELT ((ARGS), (LEVEL) - 1), (IDX)) = (VAL)) - -/* Given a single level of template arguments in NODE, return the - number of arguments. */ -#define NUM_TMPL_ARGS(NODE) \ - ((NODE) == NULL_TREE ? 0 \ - : (TREE_CODE (NODE) == TREE_VEC \ - ? TREE_VEC_LENGTH (NODE) : list_length (NODE))) - -/* The number of levels of template parameters given by NODE. */ -#define TMPL_PARMS_DEPTH(NODE) \ - (TREE_INT_CST_HIGH (TREE_PURPOSE (NODE))) - -/* Do any processing required when DECL (a member template declaration - using TEMPLATE_PARAMETERS as its innermost parameter list) is - finished. Returns the TEMPLATE_DECL corresponding to DECL, unless - it is a specialization, in which case the DECL itself is returned. */ - -tree -finish_member_template_decl (decl) - tree decl; -{ - if (decl == NULL_TREE || decl == void_type_node) - return NULL_TREE; - else if (decl == error_mark_node) - /* By returning NULL_TREE, the parser will just ignore this - declaration. We have already issued the error. */ - return NULL_TREE; - else if (TREE_CODE (decl) == TREE_LIST) - { - /* Assume that the class is the only declspec. */ - decl = TREE_VALUE (decl); - if (IS_AGGR_TYPE (decl) && CLASSTYPE_TEMPLATE_INFO (decl) - && ! CLASSTYPE_TEMPLATE_SPECIALIZATION (decl)) - { - tree tmpl = CLASSTYPE_TI_TEMPLATE (decl); - check_member_template (tmpl); - return tmpl; - } - return NULL_TREE; - } - else if (DECL_TEMPLATE_INFO (decl)) - { - if (!DECL_TEMPLATE_SPECIALIZATION (decl)) - { - check_member_template (DECL_TI_TEMPLATE (decl)); - return DECL_TI_TEMPLATE (decl); - } - else - return decl; - } - else - cp_error ("invalid member template declaration `%D'", decl); - - return error_mark_node; -} - -/* Returns the template nesting level of the indicated class TYPE. - - For example, in: - template - struct A - { - template - struct B {}; - }; - - A::B has depth two, while A has depth one. - Both A::B and A::B have depth one, if - COUNT_SPECIALIZATIONS is 0 or if they are instantiations, not - specializations. - - This function is guaranteed to return 0 if passed NULL_TREE so - that, for example, `template_class_depth (current_class_type)' is - always safe. */ - -static int -template_class_depth_real (type, count_specializations) - tree type; - int count_specializations; -{ - int depth; - - for (depth = 0; - type && TREE_CODE (type) != NAMESPACE_DECL; - type = (TREE_CODE (type) == FUNCTION_DECL) - ? DECL_REAL_CONTEXT (type) : TYPE_CONTEXT (type)) - { - if (TREE_CODE (type) != FUNCTION_DECL) - { - if (CLASSTYPE_TEMPLATE_INFO (type) - && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (type)) - && ((count_specializations - && CLASSTYPE_TEMPLATE_SPECIALIZATION (type)) - || uses_template_parms (CLASSTYPE_TI_ARGS (type)))) - ++depth; - } - else - { - if (DECL_TEMPLATE_INFO (type) - && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (type)) - && ((count_specializations - && DECL_TEMPLATE_SPECIALIZATION (type)) - || uses_template_parms (DECL_TI_ARGS (type)))) - ++depth; - } - } - - return depth; -} - -/* Returns the template nesting level of the indicated class TYPE. - Like template_class_depth_real, but instantiations do not count in - the depth. */ - -int -template_class_depth (type) - tree type; -{ - return template_class_depth_real (type, /*count_specializations=*/0); -} - -/* Returns 1 if processing DECL as part of do_pending_inlines - needs us to push template parms. */ - -static int -inline_needs_template_parms (decl) - tree decl; -{ - if (! DECL_TEMPLATE_INFO (decl)) - return 0; - - return (TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (most_general_template (decl))) - > (processing_template_decl + DECL_TEMPLATE_SPECIALIZATION (decl))); -} - -/* Subroutine of maybe_begin_member_template_processing. - Push the template parms in PARMS, starting from LEVELS steps into the - chain, and ending at the beginning, since template parms are listed - innermost first. */ - -static void -push_inline_template_parms_recursive (parmlist, levels) - tree parmlist; - int levels; -{ - tree parms = TREE_VALUE (parmlist); - int i; - - if (levels > 1) - push_inline_template_parms_recursive (TREE_CHAIN (parmlist), levels - 1); - - ++processing_template_decl; - current_template_parms - = tree_cons (build_int_2 (0, processing_template_decl), - parms, current_template_parms); - TEMPLATE_PARMS_FOR_INLINE (current_template_parms) = 1; - - pushlevel (0); - for (i = 0; i < TREE_VEC_LENGTH (parms); ++i) - { - tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i)); - my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (parm)) == 'd', 0); - - switch (TREE_CODE (parm)) - { - case TYPE_DECL: - case TEMPLATE_DECL: - pushdecl (parm); - break; - - case PARM_DECL: - { - /* Make a CONST_DECL as is done in process_template_parm. - It is ugly that we recreate this here; the original - version built in process_template_parm is no longer - available. */ - tree decl = build_decl (CONST_DECL, DECL_NAME (parm), - TREE_TYPE (parm)); - SET_DECL_ARTIFICIAL (decl); - DECL_INITIAL (decl) = DECL_INITIAL (parm); - DECL_TEMPLATE_PARM_P (decl) = 1; - pushdecl (decl); - } - break; - - default: - my_friendly_abort (0); - } - } -} - -/* Restore the template parameter context for a member template or - a friend template defined in a class definition. */ - -void -maybe_begin_member_template_processing (decl) - tree decl; -{ - tree parms; - int levels = 0; - - if (inline_needs_template_parms (decl)) - { - parms = DECL_TEMPLATE_PARMS (most_general_template (decl)); - levels = TMPL_PARMS_DEPTH (parms) - processing_template_decl; - - if (DECL_TEMPLATE_SPECIALIZATION (decl)) - { - --levels; - parms = TREE_CHAIN (parms); - } - - push_inline_template_parms_recursive (parms, levels); - } - - /* Remember how many levels of template parameters we pushed so that - we can pop them later. */ - if (!inline_parm_levels) - VARRAY_INT_INIT (inline_parm_levels, 4, "inline_parm_levels"); - if (inline_parm_levels_used == inline_parm_levels->num_elements) - VARRAY_GROW (inline_parm_levels, 2 * inline_parm_levels_used); - VARRAY_INT (inline_parm_levels, inline_parm_levels_used) = levels; - ++inline_parm_levels_used; -} - -/* Undo the effects of begin_member_template_processing. */ - -void -maybe_end_member_template_processing () -{ - int i; - - if (!inline_parm_levels_used) - return; - - --inline_parm_levels_used; - for (i = 0; - i < VARRAY_INT (inline_parm_levels, inline_parm_levels_used); - ++i) - { - --processing_template_decl; - current_template_parms = TREE_CHAIN (current_template_parms); - poplevel (0, 0, 0); - } -} - -/* Returns non-zero iff T is a member template function. We must be - careful as in - - template class C { void f(); } - - Here, f is a template function, and a member, but not a member - template. This function does not concern itself with the origin of - T, only its present state. So if we have - - template class C { template void f(U); } - - then neither C::f nor C::f is considered - to be a member template. But, `template void - C::f(U)' is considered a member template. */ - -int -is_member_template (t) - tree t; -{ - if (!DECL_FUNCTION_TEMPLATE_P (t)) - /* Anything that isn't a function or a template function is - certainly not a member template. */ - return 0; - - /* A local class can't have member templates. */ - if (hack_decl_function_context (t)) - return 0; - - return (DECL_FUNCTION_MEMBER_P (DECL_TEMPLATE_RESULT (t)) - /* If there are more levels of template parameters than - there are template classes surrounding the declaration, - then we have a member template. */ - && (TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (t)) > - template_class_depth (DECL_CLASS_CONTEXT (t)))); -} - -#if 0 /* UNUSED */ -/* Returns non-zero iff T is a member template class. See - is_member_template for a description of what precisely constitutes - a member template. */ - -int -is_member_template_class (t) - tree t; -{ - if (!DECL_CLASS_TEMPLATE_P (t)) - /* Anything that isn't a class template, is certainly not a member - template. */ - return 0; - - if (!DECL_CLASS_SCOPE_P (t)) - /* Anything whose context isn't a class type is surely not a - member template. */ - return 0; - - /* If there are more levels of template parameters than there are - template classes surrounding the declaration, then we have a - member template. */ - return (TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (t)) > - template_class_depth (DECL_CONTEXT (t))); -} -#endif - -/* Return a new template argument vector which contains all of ARGS, - but has as its innermost set of arguments the EXTRA_ARGS. The - resulting vector will be built on a temporary obstack, and so must - be explicitly copied to the permanent obstack, if required. */ - -static tree -add_to_template_args (args, extra_args) - tree args; - tree extra_args; -{ - tree new_args; - int extra_depth; - int i; - int j; - - extra_depth = TMPL_ARGS_DEPTH (extra_args); - new_args = make_temp_vec (TMPL_ARGS_DEPTH (args) + extra_depth); - - for (i = 1; i <= TMPL_ARGS_DEPTH (args); ++i) - SET_TMPL_ARGS_LEVEL (new_args, i, TMPL_ARGS_LEVEL (args, i)); - - for (j = 1; j <= extra_depth; ++j, ++i) - SET_TMPL_ARGS_LEVEL (new_args, i, TMPL_ARGS_LEVEL (extra_args, j)); - - return new_args; -} - -/* Like add_to_template_args, but only the outermost ARGS are added to - the EXTRA_ARGS. In particular, all but TMPL_ARGS_DEPTH - (EXTRA_ARGS) levels are added. This function is used to combine - the template arguments from a partial instantiation with the - template arguments used to attain the full instantiation from the - partial instantiation. */ - -static tree -add_outermost_template_args (args, extra_args) - tree args; - tree extra_args; -{ - tree new_args; - - /* If there are more levels of EXTRA_ARGS than there are ARGS, - something very fishy is going on. */ - my_friendly_assert (TMPL_ARGS_DEPTH (args) >= TMPL_ARGS_DEPTH (extra_args), - 0); - - /* If *all* the new arguments will be the EXTRA_ARGS, just return - them. */ - if (TMPL_ARGS_DEPTH (args) == TMPL_ARGS_DEPTH (extra_args)) - return extra_args; - - /* For the moment, we make ARGS look like it contains fewer levels. */ - TREE_VEC_LENGTH (args) -= TMPL_ARGS_DEPTH (extra_args); - - new_args = add_to_template_args (args, extra_args); - - /* Now, we restore ARGS to its full dimensions. */ - TREE_VEC_LENGTH (args) += TMPL_ARGS_DEPTH (extra_args); - - return new_args; -} - -/* We've got a template header coming up; push to a new level for storing - the parms. */ - -void -begin_template_parm_list () -{ - /* We use a non-tag-transparent scope here, which causes pushtag to - put tags in this scope, rather than in the enclosing class or - namespace scope. This is the right thing, since we want - TEMPLATE_DECLS, and not TYPE_DECLS for template classes. For a - global template class, push_template_decl handles putting the - TEMPLATE_DECL into top-level scope. For a nested template class, - e.g.: - - template struct S1 { - template struct S2 {}; - }; - - pushtag contains special code to call pushdecl_with_scope on the - TEMPLATE_DECL for S2. */ - pushlevel (0); - declare_pseudo_global_level (); - ++processing_template_decl; - ++processing_template_parmlist; - note_template_header (0); -} - -/* This routine is called when a specialization is declared. If it is - illegal to declare a specialization here, an error is reported. */ - -static void -check_specialization_scope () -{ - tree scope = current_scope (); - - /* [temp.expl.spec] - - An explicit specialization shall be declared in the namespace of - which the template is a member, or, for member templates, in the - namespace of which the enclosing class or enclosing class - template is a member. An explicit specialization of a member - function, member class or static data member of a class template - shall be declared in the namespace of which the class template - is a member. */ - if (scope && TREE_CODE (scope) != NAMESPACE_DECL) - cp_error ("explicit specialization in non-namespace scope `%D'", - scope); - - /* [temp.expl.spec] - - In an explicit specialization declaration for a member of a class - template or a member template that appears in namespace scope, - the member template and some of its enclosing class templates may - remain unspecialized, except that the declaration shall not - explicitly specialize a class member template if its enclosing - class templates are not explicitly specialized as well. */ - if (current_template_parms) - cp_error ("enclosing class templates are not explicitly specialized"); -} - -/* We've just seen template <>. */ - -void -begin_specialization () -{ - note_template_header (1); - check_specialization_scope (); -} - -/* Called at then end of processing a declaration preceeded by - template<>. */ - -void -end_specialization () -{ - reset_specialization (); -} - -/* Any template <>'s that we have seen thus far are not referring to a - function specialization. */ - -void -reset_specialization () -{ - processing_specialization = 0; - template_header_count = 0; -} - -/* We've just seen a template header. If SPECIALIZATION is non-zero, - it was of the form template <>. */ - -static void -note_template_header (specialization) - int specialization; -{ - processing_specialization = specialization; - template_header_count++; -} - -/* We're beginning an explicit instantiation. */ - -void -begin_explicit_instantiation () -{ - ++processing_explicit_instantiation; -} - - -void -end_explicit_instantiation () -{ - my_friendly_assert(processing_explicit_instantiation > 0, 0); - --processing_explicit_instantiation; -} - -/* The TYPE is being declared. If it is a template type, that means it - is a partial specialization. Do appropriate error-checking. */ - -void -maybe_process_partial_specialization (type) - tree type; -{ - if (IS_AGGR_TYPE (type) && CLASSTYPE_USE_TEMPLATE (type)) - { - if (CLASSTYPE_IMPLICIT_INSTANTIATION (type) - && TYPE_SIZE (type) == NULL_TREE) - { - if (current_namespace - != decl_namespace_context (CLASSTYPE_TI_TEMPLATE (type))) - { - cp_pedwarn ("specializing `%#T' in different namespace", type); - cp_pedwarn_at (" from definition of `%#D'", - CLASSTYPE_TI_TEMPLATE (type)); - } - SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (type); - if (processing_template_decl) - push_template_decl (TYPE_MAIN_DECL (type)); - } - else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type)) - cp_error ("specialization of `%T' after instantiation", type); - } - else if (processing_specialization) - cp_error ("explicit specialization of non-template `%T'", type); -} - -/* Retrieve the specialization (in the sense of [temp.spec] - a - specialization is either an instantiation or an explicit - specialization) of TMPL for the given template ARGS. If there is - no such specialization, return NULL_TREE. The ARGS are a vector of - arguments, or a vector of vectors of arguments, in the case of - templates with more than one level of parameters. */ - -static tree -retrieve_specialization (tmpl, args) - tree tmpl; - tree args; -{ - tree s; - - my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 0); - - /* There should be as many levels of arguments as there are - levels of parameters. */ - my_friendly_assert (TMPL_ARGS_DEPTH (args) - == TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl)), - 0); - - for (s = DECL_TEMPLATE_SPECIALIZATIONS (tmpl); - s != NULL_TREE; - s = TREE_CHAIN (s)) - if (comp_template_args (TREE_PURPOSE (s), args)) - return TREE_VALUE (s); - - return NULL_TREE; -} - -/* Returns non-zero iff DECL is a specialization of TMPL. */ - -int -is_specialization_of (decl, tmpl) - tree decl; - tree tmpl; -{ - tree t; - - if (TREE_CODE (decl) == FUNCTION_DECL) - { - for (t = decl; - t != NULL_TREE; - t = DECL_TEMPLATE_INFO (t) ? DECL_TI_TEMPLATE (t) : NULL_TREE) - if (t == tmpl) - return 1; - } - else - { - my_friendly_assert (TREE_CODE (decl) == TYPE_DECL, 0); - - for (t = TREE_TYPE (decl); - t != NULL_TREE; - t = CLASSTYPE_USE_TEMPLATE (t) - ? TREE_TYPE (CLASSTYPE_TI_TEMPLATE (t)) : NULL_TREE) - if (same_type_p (TYPE_MAIN_VARIANT (t), - TYPE_MAIN_VARIANT (TREE_TYPE (tmpl)))) - return 1; - } - - return 0; -} - -/* Register the specialization SPEC as a specialization of TMPL with - the indicated ARGS. Returns SPEC, or an equivalent prior - declaration, if available. */ - -static tree -register_specialization (spec, tmpl, args) - tree spec; - tree tmpl; - tree args; -{ - tree s; - - my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 0); - - if (TREE_CODE (spec) == FUNCTION_DECL - && uses_template_parms (DECL_TI_ARGS (spec))) - /* This is the FUNCTION_DECL for a partial instantiation. Don't - register it; we want the corresponding TEMPLATE_DECL instead. - We use `uses_template_parms (DECL_TI_ARGS (spec))' rather than - the more obvious `uses_template_parms (spec)' to avoid problems - with default function arguments. In particular, given - something like this: - - template void f(T t1, T t = T()) - - the default argument expression is not substituted for in an - instantiation unless and until it is actually needed. */ - return spec; - - /* There should be as many levels of arguments as there are - levels of parameters. */ - my_friendly_assert (TMPL_ARGS_DEPTH (args) - == TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl)), - 0); - - for (s = DECL_TEMPLATE_SPECIALIZATIONS (tmpl); - s != NULL_TREE; - s = TREE_CHAIN (s)) - if (comp_template_args (TREE_PURPOSE (s), args)) - { - tree fn = TREE_VALUE (s); - - if (DECL_TEMPLATE_SPECIALIZATION (spec)) - { - if (DECL_TEMPLATE_INSTANTIATION (fn)) - { - if (TREE_USED (fn) - || DECL_EXPLICIT_INSTANTIATION (fn)) - { - cp_error ("specialization of %D after instantiation", - fn); - return spec; - } - else - { - /* This situation should occur only if the first - specialization is an implicit instantiation, - the second is an explicit specialization, and - the implicit instantiation has not yet been - used. That situation can occur if we have - implicitly instantiated a member function and - then specialized it later. - - We can also wind up here if a friend - declaration that looked like an instantiation - turns out to be a specialization: - - template void foo(T); - class S { friend void foo<>(int) }; - template <> void foo(int); - - We transform the existing DECL in place so that - any pointers to it become pointers to the - updated declaration. - - If there was a definition for the template, but - not for the specialization, we want this to - look as if there is no definition, and vice - versa. */ - DECL_INITIAL (fn) = NULL_TREE; - duplicate_decls (spec, fn); - - return fn; - } - } - else if (DECL_TEMPLATE_SPECIALIZATION (fn)) - { - duplicate_decls (spec, fn); - return fn; - } - } - } - - DECL_TEMPLATE_SPECIALIZATIONS (tmpl) - = perm_tree_cons (args, spec, DECL_TEMPLATE_SPECIALIZATIONS (tmpl)); - - return spec; -} - -/* Unregister the specialization SPEC as a specialization of TMPL. - Returns nonzero if the SPEC was listed as a specialization of - TMPL. */ - -static int -unregister_specialization (spec, tmpl) - tree spec; - tree tmpl; -{ - tree* s; - - for (s = &DECL_TEMPLATE_SPECIALIZATIONS (tmpl); - *s != NULL_TREE; - s = &TREE_CHAIN (*s)) - if (TREE_VALUE (*s) == spec) - { - *s = TREE_CHAIN (*s); - return 1; - } - - return 0; -} - -/* Print the list of candidate FNS in an error message. */ - -void -print_candidates (fns) - tree fns; -{ - tree fn; - - const char *str = "candidates are:"; - - for (fn = fns; fn != NULL_TREE; fn = TREE_CHAIN (fn)) - { - tree f; - - for (f = TREE_VALUE (fn); f; f = OVL_NEXT (f)) - cp_error_at ("%s %+#D", str, OVL_CURRENT (f)); - str = " "; - } -} - -/* Returns the template (one of the functions given by TEMPLATE_ID) - which can be specialized to match the indicated DECL with the - explicit template args given in TEMPLATE_ID. The DECL may be - NULL_TREE if none is available. In that case, the functions in - TEMPLATE_ID are non-members. - - If NEED_MEMBER_TEMPLATE is non-zero the function is known to be a - specialization of a member template. - - The template args (those explicitly specified and those deduced) - are output in a newly created vector *TARGS_OUT. - - If it is impossible to determine the result, an error message is - issued. The error_mark_node is returned to indicate failure. */ - -static tree -determine_specialization (template_id, decl, targs_out, - need_member_template) - tree template_id; - tree decl; - tree* targs_out; - int need_member_template; -{ - tree fn; - tree fns; - tree targs; - tree explicit_targs; - tree candidates = NULL_TREE; - tree templates = NULL_TREE; - - *targs_out = NULL_TREE; - - if (template_id == error_mark_node) - return error_mark_node; - - fns = TREE_OPERAND (template_id, 0); - explicit_targs = TREE_OPERAND (template_id, 1); - - if (fns == error_mark_node) - return error_mark_node; - - /* Check for baselinks. */ - if (TREE_CODE (fns) == TREE_LIST) - fns = TREE_VALUE (fns); - - for (; fns; fns = OVL_NEXT (fns)) - { - tree tmpl; - - fn = OVL_CURRENT (fns); - - if (TREE_CODE (fn) == TEMPLATE_DECL) - /* DECL might be a specialization of FN. */ - tmpl = fn; - else if (need_member_template) - /* FN is an ordinary member function, and we need a - specialization of a member template. */ - continue; - else if (TREE_CODE (fn) != FUNCTION_DECL) - /* We can get IDENTIFIER_NODEs here in certain erroneous - cases. */ - continue; - else if (!DECL_FUNCTION_MEMBER_P (fn)) - /* This is just an ordinary non-member function. Nothing can - be a specialization of that. */ - continue; - else - { - tree decl_arg_types; - - /* This is an ordinary member function. However, since - we're here, we can assume it's enclosing class is a - template class. For example, - - template struct S { void f(); }; - template <> void S::f() {} - - Here, S::f is a non-template, but S is a - template class. If FN has the same type as DECL, we - might be in business. */ - if (!same_type_p (TREE_TYPE (TREE_TYPE (decl)), - TREE_TYPE (TREE_TYPE (fn)))) - /* The return types differ. */ - continue; - - /* Adjust the type of DECL in case FN is a static member. */ - decl_arg_types = TYPE_ARG_TYPES (TREE_TYPE (decl)); - if (DECL_STATIC_FUNCTION_P (fn) - && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) - decl_arg_types = TREE_CHAIN (decl_arg_types); - - if (compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)), - decl_arg_types)) - /* They match! */ - candidates = tree_cons (NULL_TREE, fn, candidates); - - continue; - } - - /* See whether this function might be a specialization of this - template. */ - targs = get_bindings (tmpl, decl, explicit_targs); - - if (!targs) - /* We cannot deduce template arguments that when used to - specialize TMPL will produce DECL. */ - continue; - - /* Save this template, and the arguments deduced. */ - templates = scratch_tree_cons (targs, tmpl, templates); - } - - if (templates && TREE_CHAIN (templates)) - { - /* We have: - - [temp.expl.spec] - - It is possible for a specialization with a given function - signature to be instantiated from more than one function - template. In such cases, explicit specification of the - template arguments must be used to uniquely identify the - function template specialization being specialized. - - Note that here, there's no suggestion that we're supposed to - determine which of the candidate templates is most - specialized. However, we, also have: - - [temp.func.order] - - Partial ordering of overloaded function template - declarations is used in the following contexts to select - the function template to which a function template - specialization refers: - - -- when an explicit specialization refers to a function - template. - - So, we do use the partial ordering rules, at least for now. - This extension can only serve to make illegal programs legal, - so it's safe. And, there is strong anecdotal evidence that - the committee intended the partial ordering rules to apply; - the EDG front-end has that behavior, and John Spicer claims - that the committee simply forgot to delete the wording in - [temp.expl.spec]. */ - tree tmpl = most_specialized (templates, decl, explicit_targs); - if (tmpl && tmpl != error_mark_node) - { - targs = get_bindings (tmpl, decl, explicit_targs); - templates = scratch_tree_cons (targs, tmpl, NULL_TREE); - } - } - - if (templates == NULL_TREE && candidates == NULL_TREE) - { - cp_error_at ("template-id `%D' for `%+D' does not match any template declaration", - template_id, decl); - return error_mark_node; - } - else if ((templates && TREE_CHAIN (templates)) - || (candidates && TREE_CHAIN (candidates)) - || (templates && candidates)) - { - cp_error_at ("ambiguous template specialization `%D' for `%+D'", - template_id, decl); - chainon (candidates, templates); - print_candidates (candidates); - return error_mark_node; - } - - /* We have one, and exactly one, match. */ - if (candidates) - { - /* It was a specialization of an ordinary member function in a - template class. */ - *targs_out = copy_node (DECL_TI_ARGS (TREE_VALUE (candidates))); - return DECL_TI_TEMPLATE (TREE_VALUE (candidates)); - } - - /* It was a specialization of a template. */ - targs = DECL_TI_ARGS (DECL_RESULT (TREE_VALUE (templates))); - if (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (targs)) - { - *targs_out = copy_node (targs); - SET_TMPL_ARGS_LEVEL (*targs_out, - TMPL_ARGS_DEPTH (*targs_out), - TREE_PURPOSE (templates)); - } - else - *targs_out = TREE_PURPOSE (templates); - return TREE_VALUE (templates); -} - -/* Check to see if the function just declared, as indicated in - DECLARATOR, and in DECL, is a specialization of a function - template. We may also discover that the declaration is an explicit - instantiation at this point. - - Returns DECL, or an equivalent declaration that should be used - instead if all goes well. Issues an error message if something is - amiss. Returns error_mark_node if the error is not easily - recoverable. - - FLAGS is a bitmask consisting of the following flags: - - 2: The function has a definition. - 4: The function is a friend. - - The TEMPLATE_COUNT is the number of references to qualifying - template classes that appeared in the name of the function. For - example, in - - template struct S { void f(); }; - void S::f(); - - the TEMPLATE_COUNT would be 1. However, explicitly specialized - classes are not counted in the TEMPLATE_COUNT, so that in - - template struct S {}; - template <> struct S { void f(); } - template <> void S::f(); - - the TEMPLATE_COUNT would be 0. (Note that this declaration is - illegal; there should be no template <>.) - - If the function is a specialization, it is marked as such via - DECL_TEMPLATE_SPECIALIZATION. Furthermore, its DECL_TEMPLATE_INFO - is set up correctly, and it is added to the list of specializations - for that template. */ - -tree -check_explicit_specialization (declarator, decl, template_count, flags) - tree declarator; - tree decl; - int template_count; - int flags; -{ - int have_def = flags & 2; - int is_friend = flags & 4; - int specialization = 0; - int explicit_instantiation = 0; - int member_specialization = 0; - - tree ctype = DECL_CLASS_CONTEXT (decl); - tree dname = DECL_NAME (decl); - - if (processing_specialization) - { - /* The last template header was of the form template <>. */ - - if (template_header_count > template_count) - { - /* There were more template headers than qualifying template - classes. */ - if (template_header_count - template_count > 1) - /* There shouldn't be that many template parameter lists. - There can be at most one parameter list for every - qualifying class, plus one for the function itself. */ - cp_error ("too many template parameter lists in declaration of `%D'", decl); - - SET_DECL_TEMPLATE_SPECIALIZATION (decl); - if (ctype) - member_specialization = 1; - else - specialization = 1; - } - else if (template_header_count == template_count) - { - /* The counts are equal. So, this might be a - specialization, but it is not a specialization of a - member template. It might be something like - - template struct S { - void f(int i); - }; - template <> - void S::f(int i) {} */ - specialization = 1; - SET_DECL_TEMPLATE_SPECIALIZATION (decl); - } - else - { - /* This cannot be an explicit specialization. There are not - enough headers for all of the qualifying classes. For - example, we might have: - - template <> - void S::T::f(); - - But, we're missing another template <>. */ - cp_error("too few template parameter lists in declaration of `%D'", decl); - return decl; - } - } - else if (processing_explicit_instantiation) - { - if (template_header_count) - cp_error ("template parameter list used in explicit instantiation"); - - if (have_def) - cp_error ("definition provided for explicit instantiation"); - - explicit_instantiation = 1; - } - else if (ctype != NULL_TREE - && !TYPE_BEING_DEFINED (ctype) - && CLASSTYPE_TEMPLATE_INSTANTIATION (ctype) - && !is_friend) - { - /* This case catches outdated code that looks like this: - - template struct S { void f(); }; - void S::f() {} // Missing template <> - - We disable this check when the type is being defined to - avoid complaining about default compiler-generated - constructors, destructors, and assignment operators. - Since the type is an instantiation, not a specialization, - these are the only functions that can be defined before - the class is complete. */ - - /* If they said - template void S::f() {} - that's bogus. */ - if (template_header_count) - { - cp_error ("template parameters specified in specialization"); - return decl; - } - - if (pedantic) - cp_pedwarn - ("explicit specialization not preceded by `template <>'"); - specialization = 1; - SET_DECL_TEMPLATE_SPECIALIZATION (decl); - } - else if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR) - { - if (is_friend) - /* This could be something like: - - template void f(T); - class S { friend void f<>(int); } */ - specialization = 1; - else - { - /* This case handles bogus declarations like template <> - template void f(); */ - - cp_error ("template-id `%D' in declaration of primary template", - declarator); - return decl; - } - } - - if (specialization || member_specialization) - { - tree t = TYPE_ARG_TYPES (TREE_TYPE (decl)); - for (; t; t = TREE_CHAIN (t)) - if (TREE_PURPOSE (t)) - { - cp_pedwarn - ("default argument specified in explicit specialization"); - break; - } - if (current_lang_name == lang_name_c) - cp_error ("template specialization with C linkage"); - } - - if (specialization || member_specialization || explicit_instantiation) - { - tree tmpl = NULL_TREE; - tree targs = NULL_TREE; - - /* Make sure that the declarator is a TEMPLATE_ID_EXPR. */ - if (TREE_CODE (declarator) != TEMPLATE_ID_EXPR) - { - tree fns; - - my_friendly_assert (TREE_CODE (declarator) == IDENTIFIER_NODE, - 0); - if (!ctype) - fns = IDENTIFIER_NAMESPACE_VALUE (dname); - else - fns = dname; - - declarator = - lookup_template_function (fns, NULL_TREE); - } - - if (declarator == error_mark_node) - return error_mark_node; - - if (ctype != NULL_TREE && TYPE_BEING_DEFINED (ctype)) - { - if (!explicit_instantiation) - /* A specialization in class scope. This is illegal, - but the error will already have been flagged by - check_specialization_scope. */ - return error_mark_node; - else - { - /* It's not legal to write an explicit instantiation in - class scope, e.g.: - - class C { template void f(); } - - This case is caught by the parser. However, on - something like: - - template class C { void f(); }; - - (which is illegal) we can get here. The error will be - issued later. */ - ; - } - - return decl; - } - else if (TREE_CODE (TREE_OPERAND (declarator, 0)) == LOOKUP_EXPR) - { - /* A friend declaration. We can't do much, because we don't - know what this resolves to, yet. */ - my_friendly_assert (is_friend != 0, 0); - my_friendly_assert (!explicit_instantiation, 0); - SET_DECL_IMPLICIT_INSTANTIATION (decl); - return decl; - } - else if (ctype != NULL_TREE - && (TREE_CODE (TREE_OPERAND (declarator, 0)) == - IDENTIFIER_NODE)) - { - /* Find the list of functions in ctype that have the same - name as the declared function. */ - tree name = TREE_OPERAND (declarator, 0); - tree fns = NULL_TREE; - int idx; - - if (name == constructor_name (ctype) - || name == constructor_name_full (ctype)) - { - int is_constructor = DECL_CONSTRUCTOR_P (decl); - - if (is_constructor ? !TYPE_HAS_CONSTRUCTOR (ctype) - : !TYPE_HAS_DESTRUCTOR (ctype)) - { - /* From [temp.expl.spec]: - - If such an explicit specialization for the member - of a class template names an implicitly-declared - special member function (clause _special_), the - program is ill-formed. - - Similar language is found in [temp.explicit]. */ - cp_error ("specialization of implicitly-declared special member function"); - return error_mark_node; - } - - name = is_constructor ? ctor_identifier : dtor_identifier; - } - - if (!IDENTIFIER_TYPENAME_P (name)) - { - idx = lookup_fnfields_1 (ctype, name); - if (idx >= 0) - fns = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (ctype), idx); - } - else - { - tree methods; - - /* For a type-conversion operator, we cannot do a - name-based lookup. We might be looking for `operator - int' which will be a specialization of `operator T'. - So, we find *all* the conversion operators, and then - select from them. */ - fns = NULL_TREE; - - methods = CLASSTYPE_METHOD_VEC (ctype); - if (methods) - for (idx = 2; idx < TREE_VEC_LENGTH (methods); ++idx) - { - tree ovl = TREE_VEC_ELT (methods, idx); - - if (!ovl || !DECL_CONV_FN_P (OVL_CURRENT (ovl))) - /* There are no more conversion functions. */ - break; - - /* Glue all these conversion functions together - with those we already have. */ - for (; ovl; ovl = OVL_NEXT (ovl)) - fns = ovl_cons (OVL_CURRENT (ovl), fns); - } - } - - if (fns == NULL_TREE) - { - cp_error ("no member function `%D' declared in `%T'", - name, ctype); - return error_mark_node; - } - else - TREE_OPERAND (declarator, 0) = fns; - } - - /* Figure out what exactly is being specialized at this point. - Note that for an explicit instantiation, even one for a - member function, we cannot tell apriori whether the - instantiation is for a member template, or just a member - function of a template class. Even if a member template is - being instantiated, the member template arguments may be - elided if they can be deduced from the rest of the - declaration. */ - tmpl = determine_specialization (declarator, decl, - &targs, - member_specialization); - - if (!tmpl || tmpl == error_mark_node) - /* We couldn't figure out what this declaration was - specializing. */ - return error_mark_node; - else - { - tree gen_tmpl = most_general_template (tmpl); - - if (explicit_instantiation) - { - /* We don't set DECL_EXPLICIT_INSTANTIATION here; that - is done by do_decl_instantiation later. */ - - int arg_depth = TMPL_ARGS_DEPTH (targs); - int parm_depth = TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl)); - - if (arg_depth > parm_depth) - { - /* If TMPL is not the most general template (for - example, if TMPL is a friend template that is - injected into namespace scope), then there will - be too many levels fo TARGS. Remove some of them - here. */ - int i; - tree new_targs; - - new_targs = make_temp_vec (parm_depth); - for (i = arg_depth - parm_depth; i < arg_depth; ++i) - TREE_VEC_ELT (new_targs, i - (arg_depth - parm_depth)) - = TREE_VEC_ELT (targs, i); - targs = new_targs; - } - - decl = instantiate_template (tmpl, targs); - return decl; - } - - /* If we though that the DECL was a member function, but it - turns out to be specializing a static member function, - make DECL a static member function as well. */ - if (DECL_STATIC_FUNCTION_P (tmpl) - && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)) - { - revert_static_member_fn (&decl, 0, 0); - last_function_parms = TREE_CHAIN (last_function_parms); - } - - /* Set up the DECL_TEMPLATE_INFO for DECL. */ - DECL_TEMPLATE_INFO (decl) - = perm_tree_cons (tmpl, targs, NULL_TREE); - - /* Mangle the function name appropriately. Note that we do - not mangle specializations of non-template member - functions of template classes, e.g. with - - template struct S { void f(); } - - and given the specialization - - template <> void S::f() {} - - we do not mangle S::f() here. That's because it's - just an ordinary member function and doesn't need special - treatment. We do this here so that the ordinary, - non-template, name-mangling algorith will not be used - later. */ - if ((is_member_template (tmpl) || ctype == NULL_TREE) - && name_mangling_version >= 1) - set_mangled_name_for_template_decl (decl); - - if (is_friend && !have_def) - /* This is not really a declaration of a specialization. - It's just the name of an instantiation. But, it's not - a request for an instantiation, either. */ - SET_DECL_IMPLICIT_INSTANTIATION (decl); - - /* Register this specialization so that we can find it - again. */ - decl = register_specialization (decl, gen_tmpl, targs); - } - } - - return decl; -} - -/* TYPE is being declared. Verify that the use of template headers - and such is reasonable. Issue error messages if not. */ - -void -maybe_check_template_type (type) - tree type; -{ - if (template_header_count) - { - /* We are in the scope of some `template <...>' header. */ - - int context_depth - = template_class_depth_real (TYPE_CONTEXT (type), - /*count_specializations=*/1); - - if (template_header_count <= context_depth) - /* This is OK; the template headers are for the context. We - are actually too lenient here; like - check_explicit_specialization we should consider the number - of template types included in the actual declaration. For - example, - - template struct S { - template template - struct I {}; - }; - - is illegal, but: - - template struct S { - template struct I; - }; - - template template ::I {}; - - is not. */ - ; - else if (template_header_count > context_depth + 1) - /* There are two many template parameter lists. */ - cp_error ("too many template parameter lists in declaration of `%T'", type); - } -} - -/* Returns 1 iff PARMS1 and PARMS2 are identical sets of template - parameters. These are represented in the same format used for - DECL_TEMPLATE_PARMS. */ - -int comp_template_parms (parms1, parms2) - tree parms1; - tree parms2; -{ - tree p1; - tree p2; - - if (parms1 == parms2) - return 1; - - for (p1 = parms1, p2 = parms2; - p1 != NULL_TREE && p2 != NULL_TREE; - p1 = TREE_CHAIN (p1), p2 = TREE_CHAIN (p2)) - { - tree t1 = TREE_VALUE (p1); - tree t2 = TREE_VALUE (p2); - int i; - - my_friendly_assert (TREE_CODE (t1) == TREE_VEC, 0); - my_friendly_assert (TREE_CODE (t2) == TREE_VEC, 0); - - if (TREE_VEC_LENGTH (t1) != TREE_VEC_LENGTH (t2)) - return 0; - - for (i = 0; i < TREE_VEC_LENGTH (t2); ++i) - { - tree parm1 = TREE_VALUE (TREE_VEC_ELT (t1, i)); - tree parm2 = TREE_VALUE (TREE_VEC_ELT (t2, i)); - - if (TREE_CODE (parm1) != TREE_CODE (parm2)) - return 0; - - if (TREE_CODE (parm1) == TEMPLATE_TYPE_PARM) - continue; - else if (!same_type_p (TREE_TYPE (parm1), TREE_TYPE (parm2))) - return 0; - } - } - - if ((p1 != NULL_TREE) != (p2 != NULL_TREE)) - /* One set of parameters has more parameters lists than the - other. */ - return 0; - - return 1; -} - -/* Complain if DECL shadows a template parameter. - - [temp.local]: A template-parameter shall not be redeclared within its - scope (including nested scopes). */ - -void -check_template_shadow (decl) - tree decl; -{ - tree olddecl; - - /* If we're not in a template, we can't possibly shadow a template - parameter. */ - if (!current_template_parms) - return; - - /* Figure out what we're shadowing. */ - if (TREE_CODE (decl) == OVERLOAD) - decl = OVL_CURRENT (decl); - olddecl = IDENTIFIER_VALUE (DECL_NAME (decl)); - - /* If there's no previous binding for this name, we're not shadowing - anything, let alone a template parameter. */ - if (!olddecl) - return; - - /* If we're not shadowing a template parameter, we're done. Note - that OLDDECL might be an OVERLOAD (or perhaps even an - ERROR_MARK), so we can't just blithely assume it to be a _DECL - node. */ - if (TREE_CODE_CLASS (TREE_CODE (olddecl)) != 'd' - || !DECL_TEMPLATE_PARM_P (olddecl)) - return; - - /* We check for decl != olddecl to avoid bogus errors for using a - name inside a class. We check TPFI to avoid duplicate errors for - inline member templates. */ - if (decl == olddecl - || TEMPLATE_PARMS_FOR_INLINE (current_template_parms)) - return; - - cp_error_at ("declaration of `%#D'", decl); - cp_error_at (" shadows template parm `%#D'", olddecl); -} - -/* Return a new TEMPLATE_PARM_INDEX with the indicated INDEX, LEVEL, - ORIG_LEVEL, DECL, and TYPE. */ - -static tree -build_template_parm_index (index, level, orig_level, decl, type) - int index; - int level; - int orig_level; - tree decl; - tree type; -{ - tree t = make_node (TEMPLATE_PARM_INDEX); - TEMPLATE_PARM_IDX (t) = index; - TEMPLATE_PARM_LEVEL (t) = level; - TEMPLATE_PARM_ORIG_LEVEL (t) = orig_level; - TEMPLATE_PARM_DECL (t) = decl; - TREE_TYPE (t) = type; - - return t; -} - -/* Return a TEMPLATE_PARM_INDEX, similar to INDEX, but whose - TEMPLATE_PARM_LEVEL has been decreased by LEVELS. If such a - TEMPLATE_PARM_INDEX already exists, it is returned; otherwise, a - new one is created. */ - -static tree -reduce_template_parm_level (index, type, levels) - tree index; - tree type; - int levels; -{ - if (TEMPLATE_PARM_DESCENDANTS (index) == NULL_TREE - || (TEMPLATE_PARM_LEVEL (TEMPLATE_PARM_DESCENDANTS (index)) - != TEMPLATE_PARM_LEVEL (index) - levels)) - { - tree decl - = build_decl (TREE_CODE (TEMPLATE_PARM_DECL (index)), - DECL_NAME (TEMPLATE_PARM_DECL (index)), - type); - tree t - = build_template_parm_index (TEMPLATE_PARM_IDX (index), - TEMPLATE_PARM_LEVEL (index) - levels, - TEMPLATE_PARM_ORIG_LEVEL (index), - decl, type); - TEMPLATE_PARM_DESCENDANTS (index) = t; - - /* Template template parameters need this. */ - DECL_TEMPLATE_PARMS (decl) - = DECL_TEMPLATE_PARMS (TEMPLATE_PARM_DECL (index)); - } - - return TEMPLATE_PARM_DESCENDANTS (index); -} - -/* Process information from new template parameter NEXT and append it to the - LIST being built. */ - -tree -process_template_parm (list, next) - tree list, next; -{ - tree parm; - tree decl = 0; - tree defval; - int is_type, idx; - - parm = next; - my_friendly_assert (TREE_CODE (parm) == TREE_LIST, 259); - defval = TREE_PURPOSE (parm); - parm = TREE_VALUE (parm); - is_type = TREE_PURPOSE (parm) == class_type_node; - - if (list) - { - tree p = TREE_VALUE (tree_last (list)); - - if (TREE_CODE (p) == TYPE_DECL) - idx = TEMPLATE_TYPE_IDX (TREE_TYPE (p)); - else if (TREE_CODE (p) == TEMPLATE_DECL) - idx = TEMPLATE_TYPE_IDX (TREE_TYPE (DECL_TEMPLATE_RESULT (p))); - else - idx = TEMPLATE_PARM_IDX (DECL_INITIAL (p)); - ++idx; - } - else - idx = 0; - - if (!is_type) - { - my_friendly_assert (TREE_CODE (TREE_PURPOSE (parm)) == TREE_LIST, 260); - /* is a const-param */ - parm = grokdeclarator (TREE_VALUE (parm), TREE_PURPOSE (parm), - PARM, 0, NULL_TREE); - - /* [temp.param] - - The top-level cv-qualifiers on the template-parameter are - ignored when determining its type. */ - TREE_TYPE (parm) = TYPE_MAIN_VARIANT (TREE_TYPE (parm)); - - /* A template parameter is not modifiable. */ - TREE_READONLY (parm) = 1; - if (IS_AGGR_TYPE (TREE_TYPE (parm)) - && TREE_CODE (TREE_TYPE (parm)) != TEMPLATE_TYPE_PARM - && TREE_CODE (TREE_TYPE (parm)) != TYPENAME_TYPE) - { - cp_error ("`%#T' is not a valid type for a template constant parameter", - TREE_TYPE (parm)); - if (DECL_NAME (parm) == NULL_TREE) - error (" a template type parameter must begin with `class' or `typename'"); - TREE_TYPE (parm) = void_type_node; - } - else if (pedantic - && (TREE_CODE (TREE_TYPE (parm)) == REAL_TYPE - || TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE)) - cp_pedwarn ("`%T' is not a valid type for a template constant parameter", - TREE_TYPE (parm)); - if (TREE_PERMANENT (parm) == 0) - { - parm = copy_node (parm); - TREE_PERMANENT (parm) = 1; - } - decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm)); - DECL_INITIAL (parm) = DECL_INITIAL (decl) - = build_template_parm_index (idx, processing_template_decl, - processing_template_decl, - decl, TREE_TYPE (parm)); - } - else - { - tree t; - parm = TREE_VALUE (parm); - - if (parm && TREE_CODE (parm) == TEMPLATE_DECL) - { - t = make_lang_type (TEMPLATE_TEMPLATE_PARM); - /* This is for distinguishing between real templates and template - template parameters */ - TREE_TYPE (parm) = t; - TREE_TYPE (DECL_TEMPLATE_RESULT (parm)) = t; - decl = parm; - } - else - { - t = make_lang_type (TEMPLATE_TYPE_PARM); - /* parm is either IDENTIFIER_NODE or NULL_TREE */ - decl = build_decl (TYPE_DECL, parm, t); - } - - TYPE_NAME (t) = decl; - TYPE_STUB_DECL (t) = decl; - parm = decl; - TEMPLATE_TYPE_PARM_INDEX (t) - = build_template_parm_index (idx, processing_template_decl, - processing_template_decl, - decl, TREE_TYPE (parm)); - } - SET_DECL_ARTIFICIAL (decl); - DECL_TEMPLATE_PARM_P (decl) = 1; - pushdecl (decl); - parm = build_tree_list (defval, parm); - return chainon (list, parm); -} - -/* The end of a template parameter list has been reached. Process the - tree list into a parameter vector, converting each parameter into a more - useful form. Type parameters are saved as IDENTIFIER_NODEs, and others - as PARM_DECLs. */ - -tree -end_template_parm_list (parms) - tree parms; -{ - int nparms; - tree parm; - tree saved_parmlist = make_tree_vec (list_length (parms)); - - current_template_parms - = tree_cons (build_int_2 (0, processing_template_decl), - saved_parmlist, current_template_parms); - - for (parm = parms, nparms = 0; parm; parm = TREE_CHAIN (parm), nparms++) - TREE_VEC_ELT (saved_parmlist, nparms) = parm; - - --processing_template_parmlist; - - return saved_parmlist; -} - -/* end_template_decl is called after a template declaration is seen. */ - -void -end_template_decl () -{ - reset_specialization (); - - if (! processing_template_decl) - return; - - /* This matches the pushlevel in begin_template_parm_list. */ - poplevel (0, 0, 0); - - --processing_template_decl; - current_template_parms = TREE_CHAIN (current_template_parms); - (void) get_pending_sizes (); /* Why? */ -} - -/* Given a template argument vector containing the template PARMS. - The innermost PARMS are given first. */ - -tree -current_template_args () -{ - tree header; - tree args = NULL_TREE; - int length = TMPL_PARMS_DEPTH (current_template_parms); - int l = length; - - /* If there is only one level of template parameters, we do not - create a TREE_VEC of TREE_VECs. Instead, we return a single - TREE_VEC containing the arguments. */ - if (length > 1) - args = make_tree_vec (length); - - for (header = current_template_parms; header; header = TREE_CHAIN (header)) - { - tree a = copy_node (TREE_VALUE (header)); - int i; - - TREE_TYPE (a) = NULL_TREE; - for (i = TREE_VEC_LENGTH (a) - 1; i >= 0; --i) - { - tree t = TREE_VEC_ELT (a, i); - - /* T will be a list if we are called from within a - begin/end_template_parm_list pair, but a vector directly - if within a begin/end_member_template_processing pair. */ - if (TREE_CODE (t) == TREE_LIST) - { - t = TREE_VALUE (t); - - if (TREE_CODE (t) == TYPE_DECL - || TREE_CODE (t) == TEMPLATE_DECL) - t = TREE_TYPE (t); - else - t = DECL_INITIAL (t); - TREE_VEC_ELT (a, i) = t; - } - } - - if (length > 1) - TREE_VEC_ELT (args, --l) = a; - else - args = a; - } - - return args; -} - -/* Return a TEMPLATE_DECL corresponding to DECL, using the indicated - template PARMS. Used by push_template_decl below. */ - -static tree -build_template_decl (decl, parms) - tree decl; - tree parms; -{ - tree tmpl = build_lang_decl (TEMPLATE_DECL, DECL_NAME (decl), NULL_TREE); - DECL_TEMPLATE_PARMS (tmpl) = parms; - DECL_CONTEXT (tmpl) = DECL_CONTEXT (decl); - if (DECL_LANG_SPECIFIC (decl)) - { - DECL_CLASS_CONTEXT (tmpl) = DECL_CLASS_CONTEXT (decl); - DECL_STATIC_FUNCTION_P (tmpl) = DECL_STATIC_FUNCTION_P (decl); - DECL_CONSTRUCTOR_P (tmpl) = DECL_CONSTRUCTOR_P (decl); - } - - return tmpl; -} - -struct template_parm_data -{ - /* The level of the template parameters we are currently - processing. */ - int level; - - /* The index of the specialization argument we are currently - processing. */ - int current_arg; - - /* An array whose size is the number of template parameters. The - elements are non-zero if the parameter has been used in any one - of the arguments processed so far. */ - int* parms; - - /* An array whose size is the number of template arguments. The - elements are non-zero if the argument makes use of template - parameters of this level. */ - int* arg_uses_template_parms; -}; - -/* Subroutine of push_template_decl used to see if each template - parameter in a partial specialization is used in the explicit - argument list. If T is of the LEVEL given in DATA (which is - treated as a template_parm_data*), then DATA->PARMS is marked - appropriately. */ - -static int -mark_template_parm (t, data) - tree t; - void* data; -{ - int level; - int idx; - struct template_parm_data* tpd = (struct template_parm_data*) data; - - if (TREE_CODE (t) == TEMPLATE_PARM_INDEX) - { - level = TEMPLATE_PARM_LEVEL (t); - idx = TEMPLATE_PARM_IDX (t); - } - else - { - level = TEMPLATE_TYPE_LEVEL (t); - idx = TEMPLATE_TYPE_IDX (t); - } - - if (level == tpd->level) - { - tpd->parms[idx] = 1; - tpd->arg_uses_template_parms[tpd->current_arg] = 1; - } - - /* Return zero so that for_each_template_parm will continue the - traversal of the tree; we want to mark *every* template parm. */ - return 0; -} - -/* Process the partial specialization DECL. */ - -static tree -process_partial_specialization (decl) - tree decl; -{ - tree type = TREE_TYPE (decl); - tree maintmpl = CLASSTYPE_TI_TEMPLATE (type); - tree specargs = CLASSTYPE_TI_ARGS (type); - tree inner_args = innermost_args (specargs); - tree inner_parms = INNERMOST_TEMPLATE_PARMS (current_template_parms); - tree main_inner_parms = DECL_INNERMOST_TEMPLATE_PARMS (maintmpl); - int nargs = TREE_VEC_LENGTH (inner_args); - int ntparms = TREE_VEC_LENGTH (inner_parms); - int i; - int did_error_intro = 0; - struct template_parm_data tpd; - struct template_parm_data tpd2; - - /* We check that each of the template parameters given in the - partial specialization is used in the argument list to the - specialization. For example: - - template struct S; - template struct S; - - The second declaration is OK because `T*' uses the template - parameter T, whereas - - template struct S; - - is no good. Even trickier is: - - template - struct S1 - { - template - struct S2; - template - struct S2; - }; - - The S2 declaration is actually illegal; it is a - full-specialization. Of course, - - template - struct S2; - - or some such would have been OK. */ - tpd.level = TMPL_PARMS_DEPTH (current_template_parms); - tpd.parms = alloca (sizeof (int) * ntparms); - bzero ((PTR) tpd.parms, sizeof (int) * ntparms); - - tpd.arg_uses_template_parms = alloca (sizeof (int) * nargs); - bzero ((PTR) tpd.arg_uses_template_parms, sizeof (int) * nargs); - for (i = 0; i < nargs; ++i) - { - tpd.current_arg = i; - for_each_template_parm (TREE_VEC_ELT (inner_args, i), - &mark_template_parm, - &tpd); - } - for (i = 0; i < ntparms; ++i) - if (tpd.parms[i] == 0) - { - /* One of the template parms was not used in the - specialization. */ - if (!did_error_intro) - { - cp_error ("template parameters not used in partial specialization:"); - did_error_intro = 1; - } - - cp_error (" `%D'", - TREE_VALUE (TREE_VEC_ELT (inner_parms, i))); - } - - /* [temp.class.spec] - - The argument list of the specialization shall not be identical to - the implicit argument list of the primary template. */ - if (comp_template_args (inner_args, - innermost_args (CLASSTYPE_TI_ARGS (TREE_TYPE - (maintmpl))))) - cp_error ("partial specialization `%T' does not specialize any template arguments", type); - - /* [temp.class.spec] - - A partially specialized non-type argument expression shall not - involve template parameters of the partial specialization except - when the argument expression is a simple identifier. - - The type of a template parameter corresponding to a specialized - non-type argument shall not be dependent on a parameter of the - specialization. */ - my_friendly_assert (nargs == DECL_NTPARMS (maintmpl), 0); - tpd2.parms = 0; - for (i = 0; i < nargs; ++i) - { - tree arg = TREE_VEC_ELT (inner_args, i); - if (/* These first two lines are the `non-type' bit. */ - TREE_CODE_CLASS (TREE_CODE (arg)) != 't' - && TREE_CODE (arg) != TEMPLATE_DECL - /* This next line is the `argument expression is not just a - simple identifier' condition and also the `specialized - non-type argument' bit. */ - && TREE_CODE (arg) != TEMPLATE_PARM_INDEX) - { - if (tpd.arg_uses_template_parms[i]) - cp_error ("template argument `%E' involves template parameter(s)", arg); - else - { - /* Look at the corresponding template parameter, - marking which template parameters its type depends - upon. */ - tree type = - TREE_TYPE (TREE_VALUE (TREE_VEC_ELT (main_inner_parms, - i))); - - if (!tpd2.parms) - { - /* We haven't yet initialized TPD2. Do so now. */ - tpd2.arg_uses_template_parms - = (int*) alloca (sizeof (int) * nargs); - /* The number of parameters here is the number in the - main template, which, as checked in the assertion - above, is NARGS. */ - tpd2.parms = (int*) alloca (sizeof (int) * nargs); - tpd2.level = - TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (maintmpl)); - } - - /* Mark the template parameters. But this time, we're - looking for the template parameters of the main - template, not in the specialization. */ - tpd2.current_arg = i; - tpd2.arg_uses_template_parms[i] = 0; - bzero ((PTR) tpd2.parms, sizeof (int) * nargs); - for_each_template_parm (type, - &mark_template_parm, - &tpd2); - - if (tpd2.arg_uses_template_parms [i]) - { - /* The type depended on some template parameters. - If they are fully specialized in the - specialization, that's OK. */ - int j; - for (j = 0; j < nargs; ++j) - if (tpd2.parms[j] != 0 - && tpd.arg_uses_template_parms [j]) - { - cp_error ("type `%T' of template argument `%E' depends on template parameter(s)", - type, - arg); - break; - } - } - } - } - } - - if (retrieve_specialization (maintmpl, specargs)) - /* We've already got this specialization. */ - return decl; - - DECL_TEMPLATE_SPECIALIZATIONS (maintmpl) = CLASSTYPE_TI_SPEC_INFO (type) - = perm_tree_cons (inner_args, inner_parms, - DECL_TEMPLATE_SPECIALIZATIONS (maintmpl)); - TREE_TYPE (DECL_TEMPLATE_SPECIALIZATIONS (maintmpl)) = type; - return decl; -} - -/* Check that a template declaration's use of default arguments is not - invalid. Here, PARMS are the template parameters. IS_PRIMARY is - non-zero if DECL is the thing declared by a primary template. - IS_PARTIAL is non-zero if DECL is a partial specialization. */ - -static void -check_default_tmpl_args (decl, parms, is_primary, is_partial) - tree decl; - tree parms; - int is_primary; - int is_partial; -{ - const char *msg; - int last_level_to_check; - - /* [temp.param] - - A default template-argument shall not be specified in a - function template declaration or a function template definition, nor - in the template-parameter-list of the definition of a member of a - class template. */ - - if (current_class_type - && !TYPE_BEING_DEFINED (current_class_type) - && DECL_LANG_SPECIFIC (decl) - /* If this is either a friend defined in the scope of the class - or a member function. */ - && DECL_CLASS_CONTEXT (decl) == current_class_type - /* And, if it was a member function, it really was defined in - the scope of the class. */ - && (!DECL_FUNCTION_MEMBER_P (decl) || DECL_DEFINED_IN_CLASS_P (decl))) - /* We already checked these parameters when the template was - declared, so there's no need to do it again now. This function - was defined in class scope, but we're processing it's body now - that the class is complete. */ - return; - - if (TREE_CODE (decl) != TYPE_DECL || is_partial || !is_primary) - /* For an ordinary class template, default template arguments are - allowed at the innermost level, e.g.: - template - struct S {}; - but, in a partial specialization, they're not allowed even - there, as we have in [temp.class.spec]: - - The template parameter list of a specialization shall not - contain default template argument values. - - So, for a partial specialization, or for a function template, - we look at all of them. */ - ; - else - /* But, for a primary class template that is not a partial - specialization we look at all template parameters except the - innermost ones. */ - parms = TREE_CHAIN (parms); - - /* Figure out what error message to issue. */ - if (TREE_CODE (decl) == FUNCTION_DECL) - msg = "default argument for template parameter in function template `%D'"; - else if (is_partial) - msg = "default argument in partial specialization `%D'"; - else - msg = "default argument for template parameter for class enclosing `%D'"; - - if (current_class_type && TYPE_BEING_DEFINED (current_class_type)) - /* If we're inside a class definition, there's no need to - examine the parameters to the class itself. On the one - hand, they will be checked when the class is defined, and, - on the other, default arguments are legal in things like: - template - struct S { template void f(U); }; - Here the default argument for `S' has no bearing on the - declaration of `f'. */ - last_level_to_check = template_class_depth (current_class_type) + 1; - else - /* Check everything. */ - last_level_to_check = 0; - - for (; parms && TMPL_PARMS_DEPTH (parms) >= last_level_to_check; - parms = TREE_CHAIN (parms)) - { - tree inner_parms = TREE_VALUE (parms); - int i, ntparms; - - ntparms = TREE_VEC_LENGTH (inner_parms); - for (i = 0; i < ntparms; ++i) - if (TREE_PURPOSE (TREE_VEC_ELT (inner_parms, i))) - { - if (msg) - { - cp_error (msg, decl); - msg = 0; - } - - /* Clear out the default argument so that we are not - confused later. */ - TREE_PURPOSE (TREE_VEC_ELT (inner_parms, i)) = NULL_TREE; - } - - /* At this point, if we're still interested in issuing messages, - they must apply to classes surrounding the object declared. */ - if (msg) - msg = "default argument for template parameter for class enclosing `%D'"; - } -} - -/* Creates a TEMPLATE_DECL for the indicated DECL using the template - parameters given by current_template_args, or reuses a - previously existing one, if appropriate. Returns the DECL, or an - equivalent one, if it is replaced via a call to duplicate_decls. - - If IS_FRIEND is non-zero, DECL is a friend declaration. */ - -tree -push_template_decl_real (decl, is_friend) - tree decl; - int is_friend; -{ - tree tmpl; - tree args; - tree info; - tree ctx; - int primary; - int is_partial; - - /* See if this is a partial specialization. */ - is_partial = (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl) - && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE - && CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl))); - - is_friend |= (TREE_CODE (decl) == FUNCTION_DECL && DECL_FRIEND_P (decl)); - - if (is_friend) - /* For a friend, we want the context of the friend function, not - the type of which it is a friend. */ - ctx = DECL_CONTEXT (decl); - else if (DECL_REAL_CONTEXT (decl) - && TREE_CODE (DECL_REAL_CONTEXT (decl)) != NAMESPACE_DECL) - /* In the case of a virtual function, we want the class in which - it is defined. */ - ctx = DECL_REAL_CONTEXT (decl); - else - /* Otherwise, if we're currently definining some class, the DECL - is assumed to be a member of the class. */ - ctx = current_class_type; - - if (ctx && TREE_CODE (ctx) == NAMESPACE_DECL) - ctx = NULL_TREE; - - if (!DECL_CONTEXT (decl)) - DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); - - /* For determining whether this is a primary template or not, we're really - interested in the lexical context, not the true context. */ - if (is_friend) - info = current_class_type; - else - info = ctx; - - /* See if this is a primary template. */ - if (info && TREE_CODE (info) == FUNCTION_DECL) - primary = 0; - /* Note that template_class_depth returns 0 if given NULL_TREE, so - this next line works even when we are at global scope. */ - else if (processing_template_decl > template_class_depth (info)) - primary = 1; - else - primary = 0; - - if (primary) - { - if (current_lang_name == lang_name_c) - cp_error ("template with C linkage"); - if (TREE_CODE (decl) == TYPE_DECL && ANON_AGGRNAME_P (DECL_NAME (decl))) - cp_error ("template class without a name"); - if (TREE_CODE (decl) == TYPE_DECL - && TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE) - cp_error ("template declaration of `%#T'", TREE_TYPE (decl)); - } - - /* Check to see that the rules regarding the use of default - arguments are not being violated. */ - check_default_tmpl_args (decl, current_template_parms, - primary, is_partial); - - if (is_partial) - return process_partial_specialization (decl); - - args = current_template_args (); - - if (!ctx - || TREE_CODE (ctx) == FUNCTION_DECL - || TYPE_BEING_DEFINED (ctx) - || (is_friend && !DECL_TEMPLATE_INFO (decl))) - { - if (DECL_LANG_SPECIFIC (decl) - && DECL_TEMPLATE_INFO (decl) - && DECL_TI_TEMPLATE (decl)) - tmpl = DECL_TI_TEMPLATE (decl); - else - { - tmpl = build_template_decl (decl, current_template_parms); - - if (DECL_LANG_SPECIFIC (decl) - && DECL_TEMPLATE_SPECIALIZATION (decl)) - { - /* A specialization of a member template of a template - class. */ - SET_DECL_TEMPLATE_SPECIALIZATION (tmpl); - DECL_TEMPLATE_INFO (tmpl) = DECL_TEMPLATE_INFO (decl); - DECL_TEMPLATE_INFO (decl) = NULL_TREE; - } - } - } - else - { - tree a, t, current, parms; - int i; - - if (CLASSTYPE_TEMPLATE_INSTANTIATION (ctx)) - cp_error ("must specialize `%#T' before defining member `%#D'", - ctx, decl); - if (TREE_CODE (decl) == TYPE_DECL) - { - if ((IS_AGGR_TYPE_CODE (TREE_CODE (TREE_TYPE (decl))) - || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE) - && TYPE_TEMPLATE_INFO (TREE_TYPE (decl)) - && TYPE_TI_TEMPLATE (TREE_TYPE (decl))) - tmpl = TYPE_TI_TEMPLATE (TREE_TYPE (decl)); - else - { - cp_error ("`%D' does not declare a template type", decl); - return decl; - } - } - else if (! DECL_TEMPLATE_INFO (decl)) - { - cp_error ("template definition of non-template `%#D'", decl); - return decl; - } - else - tmpl = DECL_TI_TEMPLATE (decl); - - if (is_member_template (tmpl) - && DECL_FUNCTION_TEMPLATE_P (tmpl) - && DECL_TEMPLATE_INFO (decl) && DECL_TI_ARGS (decl) - && DECL_TEMPLATE_SPECIALIZATION (decl)) - { - tree new_tmpl; - - /* The declaration is a specialization of a member - template, declared outside the class. Therefore, the - innermost template arguments will be NULL, so we - replace them with the arguments determined by the - earlier call to check_explicit_specialization. */ - args = DECL_TI_ARGS (decl); - - new_tmpl - = build_template_decl (decl, current_template_parms); - DECL_TEMPLATE_RESULT (new_tmpl) = decl; - TREE_TYPE (new_tmpl) = TREE_TYPE (decl); - DECL_TI_TEMPLATE (decl) = new_tmpl; - SET_DECL_TEMPLATE_SPECIALIZATION (new_tmpl); - DECL_TEMPLATE_INFO (new_tmpl) = - perm_tree_cons (tmpl, args, NULL_TREE); - - register_specialization (new_tmpl, tmpl, args); - return decl; - } - - /* Make sure the template headers we got make sense. */ - - parms = DECL_TEMPLATE_PARMS (tmpl); - i = TMPL_PARMS_DEPTH (parms); - if (TMPL_ARGS_DEPTH (args) != i) - { - cp_error ("expected %d levels of template parms for `%#D', got %d", - i, decl, TMPL_ARGS_DEPTH (args)); - } - else - for (current = decl; i > 0; --i, parms = TREE_CHAIN (parms)) - { - a = TMPL_ARGS_LEVEL (args, i); - t = INNERMOST_TEMPLATE_PARMS (parms); - - if (TREE_VEC_LENGTH (t) != TREE_VEC_LENGTH (a)) - { - if (current == decl) - cp_error ("got %d template parameters for `%#D'", - TREE_VEC_LENGTH (a), decl); - else - cp_error ("got %d template parameters for `%#T'", - TREE_VEC_LENGTH (a), current); - cp_error (" but %d required", TREE_VEC_LENGTH (t)); - } - - /* Perhaps we should also check that the parms are used in the - appropriate qualifying scopes in the declarator? */ - - if (current == decl) - current = ctx; - else - current = TYPE_CONTEXT (current); - } - } - - DECL_TEMPLATE_RESULT (tmpl) = decl; - TREE_TYPE (tmpl) = TREE_TYPE (decl); - - /* Push template declarations for global functions and types. Note - that we do not try to push a global template friend declared in a - template class; such a thing may well depend on the template - parameters of the class. */ - if (! ctx - && !(is_friend && template_class_depth (current_class_type) > 0)) - tmpl = pushdecl_namespace_level (tmpl); - - if (primary) - DECL_PRIMARY_TEMPLATE (tmpl) = tmpl; - - info = perm_tree_cons (tmpl, args, NULL_TREE); - - if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl)) - { - SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info); - if ((!ctx || TREE_CODE (ctx) != FUNCTION_DECL) - && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE) - DECL_NAME (decl) = classtype_mangled_name (TREE_TYPE (decl)); - } - else if (! DECL_LANG_SPECIFIC (decl)) - cp_error ("template declaration of `%#D'", decl); - else - DECL_TEMPLATE_INFO (decl) = info; - - return DECL_TEMPLATE_RESULT (tmpl); -} - -tree -push_template_decl (decl) - tree decl; -{ - return push_template_decl_real (decl, 0); -} - -/* Called when a class template TYPE is redeclared with the indicated - template PARMS, e.g.: - - template struct S; - template struct S {}; */ - -void -redeclare_class_template (type, parms) - tree type; - tree parms; -{ - tree tmpl; - tree tmpl_parms; - int i; - - if (!TYPE_TEMPLATE_INFO (type)) - { - cp_error ("`%T' is not a template type", type); - return; - } - - tmpl = TYPE_TI_TEMPLATE (type); - if (!PRIMARY_TEMPLATE_P (tmpl)) - /* The type is nested in some template class. Nothing to worry - about here; there are no new template parameters for the nested - type. */ - return; - - parms = INNERMOST_TEMPLATE_PARMS (parms); - tmpl_parms = DECL_INNERMOST_TEMPLATE_PARMS (tmpl); - - if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms)) - { - cp_error_at ("previous declaration `%D'", tmpl); - cp_error ("used %d template parameter%s instead of %d", - TREE_VEC_LENGTH (tmpl_parms), - TREE_VEC_LENGTH (tmpl_parms) == 1 ? "" : "s", - TREE_VEC_LENGTH (parms)); - return; - } - - for (i = 0; i < TREE_VEC_LENGTH (tmpl_parms); ++i) - { - tree tmpl_parm = TREE_VALUE (TREE_VEC_ELT (tmpl_parms, i)); - tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i)); - tree tmpl_default = TREE_PURPOSE (TREE_VEC_ELT (tmpl_parms, i)); - tree parm_default = TREE_PURPOSE (TREE_VEC_ELT (parms, i)); - - if (TREE_CODE (tmpl_parm) != TREE_CODE (parm)) - { - cp_error_at ("template parameter `%#D'", tmpl_parm); - cp_error ("redeclared here as `%#D'", parm); - return; - } - - if (tmpl_default != NULL_TREE && parm_default != NULL_TREE) - { - /* We have in [temp.param]: - - A template-parameter may not be given default arguments - by two different declarations in the same scope. */ - cp_error ("redefinition of default argument for `%#D'", parm); - cp_error_at (" original definition appeared here", tmpl_parm); - return; - } - - if (parm_default != NULL_TREE) - /* Update the previous template parameters (which are the ones - that will really count) with the new default value. */ - TREE_PURPOSE (TREE_VEC_ELT (tmpl_parms, i)) = parm_default; - } -} - -/* Attempt to convert the non-type template parameter EXPR to the - indicated TYPE. If the conversion is successful, return the - converted value. If the conversion is unsuccesful, return - NULL_TREE if we issued an error message, or error_mark_node if we - did not. We issue error messages for out-and-out bad template - parameters, but not simply because the conversion failed, since we - might be just trying to do argument deduction. By the time this - function is called, neither TYPE nor EXPR may make use of template - parameters. */ - -static tree -convert_nontype_argument (type, expr) - tree type; - tree expr; -{ - tree expr_type = TREE_TYPE (expr); - - /* A template-argument for a non-type, non-template - template-parameter shall be one of: - - --an integral constant-expression of integral or enumeration - type; or - - --the name of a non-type template-parameter; or - - --the name of an object or function with external linkage, - including function templates and function template-ids but - excluding non-static class members, expressed as id-expression; - or - - --the address of an object or function with external linkage, - including function templates and function template-ids but - excluding non-static class members, expressed as & id-expression - where the & is optional if the name refers to a function or - array; or - - --a pointer to member expressed as described in _expr.unary.op_. */ - - /* An integral constant-expression can include const variables - or enumerators. */ - if (INTEGRAL_TYPE_P (expr_type) && TREE_READONLY_DECL_P (expr)) - expr = decl_constant_value (expr); - - if (is_overloaded_fn (expr)) - /* OK for now. We'll check that it has external linkage later. - Check this first since if expr_type is the unknown_type_node - we would otherwise complain below. */ - ; - else if (TYPE_PTRMEM_P (expr_type) - || TYPE_PTRMEMFUNC_P (expr_type)) - { - if (TREE_CODE (expr) != PTRMEM_CST) - goto bad_argument; - } - else if (TYPE_PTR_P (expr_type) - || TYPE_PTRMEM_P (expr_type) - || TREE_CODE (expr_type) == ARRAY_TYPE - || TREE_CODE (type) == REFERENCE_TYPE - /* If expr is the address of an overloaded function, we - will get the unknown_type_node at this point. */ - || expr_type == unknown_type_node) - { - tree referent; - tree e = expr; - STRIP_NOPS (e); - - if (TREE_CODE (type) == REFERENCE_TYPE - || TREE_CODE (expr_type) == ARRAY_TYPE) - referent = e; - else - { - if (TREE_CODE (e) != ADDR_EXPR) - { - bad_argument: - cp_error ("`%E' is not a valid template argument", expr); - if (TYPE_PTR_P (expr_type)) - { - if (TREE_CODE (TREE_TYPE (expr_type)) == FUNCTION_TYPE) - cp_error ("it must be the address of a function with external linkage"); - else - cp_error ("it must be the address of an object with external linkage"); - } - else if (TYPE_PTRMEM_P (expr_type) - || TYPE_PTRMEMFUNC_P (expr_type)) - cp_error ("it must be a pointer-to-member of the form `&X::Y'"); - - return NULL_TREE; - } - - referent = TREE_OPERAND (e, 0); - STRIP_NOPS (referent); - } - - if (TREE_CODE (referent) == STRING_CST) - { - cp_error ("string literal %E is not a valid template argument", - referent); - error ("because it is the address of an object with static linkage"); - return NULL_TREE; - } - - if (is_overloaded_fn (referent)) - /* We'll check that it has external linkage later. */ - ; - else if (TREE_CODE (referent) != VAR_DECL) - goto bad_argument; - else if (!TREE_PUBLIC (referent)) - { - cp_error ("address of non-extern `%E' cannot be used as template argument", referent); - return error_mark_node; - } - } - else if (INTEGRAL_TYPE_P (expr_type) - || TYPE_PTRMEM_P (expr_type) - || TYPE_PTRMEMFUNC_P (expr_type) - /* The next two are g++ extensions. */ - || TREE_CODE (expr_type) == REAL_TYPE - || TREE_CODE (expr_type) == COMPLEX_TYPE) - { - if (! TREE_CONSTANT (expr)) - { - non_constant: - cp_error ("non-constant `%E' cannot be used as template argument", - expr); - return NULL_TREE; - } - } - else - { - cp_error ("object `%E' cannot be used as template argument", expr); - return NULL_TREE; - } - - switch (TREE_CODE (type)) - { - case INTEGER_TYPE: - case BOOLEAN_TYPE: - case ENUMERAL_TYPE: - /* For a non-type template-parameter of integral or enumeration - type, integral promotions (_conv.prom_) and integral - conversions (_conv.integral_) are applied. */ - if (!INTEGRAL_TYPE_P (expr_type)) - return error_mark_node; - - /* It's safe to call digest_init in this case; we know we're - just converting one integral constant expression to another. */ - expr = digest_init (type, expr, (tree*) 0); - - if (TREE_CODE (expr) != INTEGER_CST) - /* Curiously, some TREE_CONSTANT integral expressions do not - simplify to integer constants. For example, `3 % 0', - remains a TRUNC_MOD_EXPR. */ - goto non_constant; - - return expr; - - case REAL_TYPE: - case COMPLEX_TYPE: - /* These are g++ extensions. */ - if (TREE_CODE (expr_type) != TREE_CODE (type)) - return error_mark_node; - - expr = digest_init (type, expr, (tree*) 0); - - if (TREE_CODE (expr) != REAL_CST) - goto non_constant; - - return expr; - - case POINTER_TYPE: - { - tree type_pointed_to = TREE_TYPE (type); - - if (TYPE_PTRMEM_P (type)) - { - tree e; - - /* For a non-type template-parameter of type pointer to data - member, qualification conversions (_conv.qual_) are - applied. */ - e = perform_qualification_conversions (type, expr); - if (TREE_CODE (e) == NOP_EXPR) - /* The call to perform_qualification_conversions will - insert a NOP_EXPR over EXPR to do express conversion, - if necessary. But, that will confuse us if we use - this (converted) template parameter to instantiate - another template; then the thing will not look like a - valid template argument. So, just make a new - constant, of the appropriate type. */ - e = make_ptrmem_cst (type, PTRMEM_CST_MEMBER (expr)); - return e; - } - else if (TREE_CODE (type_pointed_to) == FUNCTION_TYPE) - { - /* For a non-type template-parameter of type pointer to - function, only the function-to-pointer conversion - (_conv.func_) is applied. If the template-argument - represents a set of overloaded functions (or a pointer to - such), the matching function is selected from the set - (_over.over_). */ - tree fns; - tree fn; - - if (TREE_CODE (expr) == ADDR_EXPR) - fns = TREE_OPERAND (expr, 0); - else - fns = expr; - - fn = instantiate_type (type_pointed_to, fns, 0); - - if (fn == error_mark_node) - return error_mark_node; - - if (!TREE_PUBLIC (fn)) - { - if (really_overloaded_fn (fns)) - return error_mark_node; - else - goto bad_argument; - } - - expr = build_unary_op (ADDR_EXPR, fn, 0); - - my_friendly_assert (same_type_p (type, TREE_TYPE (expr)), - 0); - return expr; - } - else - { - /* For a non-type template-parameter of type pointer to - object, qualification conversions (_conv.qual_) and the - array-to-pointer conversion (_conv.array_) are applied. - [Note: In particular, neither the null pointer conversion - (_conv.ptr_) nor the derived-to-base conversion - (_conv.ptr_) are applied. Although 0 is a valid - template-argument for a non-type template-parameter of - integral type, it is not a valid template-argument for a - non-type template-parameter of pointer type.] - - The call to decay_conversion performs the - array-to-pointer conversion, if appropriate. */ - expr = decay_conversion (expr); - - if (expr == error_mark_node) - return error_mark_node; - else - return perform_qualification_conversions (type, expr); - } - } - break; - - case REFERENCE_TYPE: - { - tree type_referred_to = TREE_TYPE (type); - - if (TREE_CODE (type_referred_to) == FUNCTION_TYPE) - { - /* For a non-type template-parameter of type reference to - function, no conversions apply. If the - template-argument represents a set of overloaded - functions, the matching function is selected from the - set (_over.over_). */ - tree fns = expr; - tree fn; - - fn = instantiate_type (type_referred_to, fns, 0); - - if (fn == error_mark_node) - return error_mark_node; - - if (!TREE_PUBLIC (fn)) - { - if (really_overloaded_fn (fns)) - /* Don't issue an error here; we might get a different - function if the overloading had worked out - differently. */ - return error_mark_node; - else - goto bad_argument; - } - - my_friendly_assert (same_type_p (type_referred_to, - TREE_TYPE (fn)), - 0); - - return fn; - } - else - { - /* For a non-type template-parameter of type reference to - object, no conversions apply. The type referred to by the - reference may be more cv-qualified than the (otherwise - identical) type of the template-argument. The - template-parameter is bound directly to the - template-argument, which must be an lvalue. */ - if ((TYPE_MAIN_VARIANT (expr_type) - != TYPE_MAIN_VARIANT (type_referred_to)) - || !at_least_as_qualified_p (type_referred_to, - expr_type) - || !real_lvalue_p (expr)) - return error_mark_node; - else - return expr; - } - } - break; - - case RECORD_TYPE: - { - if (!TYPE_PTRMEMFUNC_P (type)) - /* This handles templates like - template void f(); - when T is substituted with any class. The second template - parameter becomes invalid and the template candidate is - rejected. */ - return error_mark_node; - - /* For a non-type template-parameter of type pointer to member - function, no conversions apply. If the template-argument - represents a set of overloaded member functions, the - matching member function is selected from the set - (_over.over_). */ - - if (!TYPE_PTRMEMFUNC_P (expr_type) && - expr_type != unknown_type_node) - return error_mark_node; - - if (TREE_CODE (expr) == PTRMEM_CST) - { - /* A ptr-to-member constant. */ - if (!same_type_p (type, expr_type)) - return error_mark_node; - else - return expr; - } - - if (TREE_CODE (expr) != ADDR_EXPR) - return error_mark_node; - - expr = instantiate_type (type, expr, 0); - - if (expr == error_mark_node) - return error_mark_node; - - my_friendly_assert (same_type_p (type, TREE_TYPE (expr)), - 0); - return expr; - } - break; - - default: - /* All non-type parameters must have one of these types. */ - my_friendly_abort (0); - break; - } - - return error_mark_node; -} - -/* Return 1 if PARM_PARMS and ARG_PARMS matches using rule for - template template parameters. Both PARM_PARMS and ARG_PARMS are - vectors of TREE_LIST nodes containing TYPE_DECL, TEMPLATE_DECL - or PARM_DECL. - - ARG_PARMS may contain more parameters than PARM_PARMS. If this is - the case, then extra parameters must have default arguments. - - Consider the example: - template class vector; - template